include_once("/home/duane/translingo.org/includes/general.php"); $pid = intval($_REQUEST['pid']); $baseid = intval($_REQUEST['baseid']); $noskip = intval($_GET['noskip']); $translated = intval($_REQUEST['translated']); $lang = trim(stripslashes($_REQUEST['editlanguage'])); $skip = trim(stripslashes($_REQUEST['skip'])); $update = trim(stripslashes($_REQUEST['update'])); $newtranslation = doit($_POST['newtranslation']); $smarty->assign('editlanguage', $lang); $proj =& new DataObject_Projects(); $proj->id = $pid; $proj->find(false); $proj->fetch(); $smarty->assign('project_name', $proj->short); unset($proj); if(!is_array($_SESSION['_config']['skip']) || $noskip == 1) $_SESSION['_config']['skip'] = array(); if($skip != '' && $baseid > 0) { if(!in_array($baseid, $_SESSION['_config']['skip'])) $_SESSION['_config']['skip'][] = $baseid; } else if($update != '' && $baseid > 0) { $trans =& new DataObject_Translations(); $trans->pid = $pid; $trans->baseid = $baseid; $trans->language = $lang; $doupdate = $trans->count(); if($doupdate > 0) { $trans->find(false); $trans->fetch(); $transid = $trans->id; } $trans =& new DataObject_Translations(); $trans->memid = $user->id; $trans->revision = gmdate("Y-m-d H:i:s"); $trans->string = $newtranslation; if($doupdate > 0) { $trans->fuzzy = 0; $trans->id = $transid; $trans->dl = 0; $trans->update(); } else { $trans->fuzzy = 0; $trans->pid = $pid; $trans->baseid = $baseid; $trans->language = $lang; $trans->insert(); } $rev =& new DataObject_Revisions(); $rev->pid = $pid; $rev->baseid = $baseid; $rev->language = $lang; $rev->memid = $user->id; $rev->revision = gmdate("Y-m-d H:i:s"); $rev->fuzzy = 0; $rev->string = $newtranslation; $rev->insert(); unset($rev); unset($trans); } unset($baseid); $proj =& new DataObject_Base(); $proj->pid = $pid; $smarty->assign('base',$proj->count()); $smarty->assign('languages',$language); $smarty->assign('pid',$pid); $alltranslation = $notranslation = $baseid = array(); $blank =& new DataObject_Base(); $blank->whereAdd("`pid` = '$pid'"); $blank->OrderBy("`id`"); $blank->find(false); $inarray = 0; while($blank->fetch()) { if(is_array($_SESSION['_config']['skip'])) if(in_array($blank->id, $_SESSION['_config']['skip'])) continue; $langs =& new DataObject_Translations(); $langs->whereAdd("`pid` = '$pid'"); $langs->whereAdd("`language` = '$lang'"); $langs->whereAdd("`baseid` = '$blank->id'"); $langs->GroupBy("`baseid`"); $langs->OrderBy("`id` DESC"); $langs->limit(1); $langs->find(false); while($langs->fetch()) { if($langs->fuzzy == 1) { $baseid[] = array($blank->id, $langs->string); break 2; } } if($langs->id > 0) continue; if(count($notranslation) <= 0) $notranslation[] = array($blank->id, $blank->string); } if(count($baseid) <= 0) $baseid = $notranslation; if(count($baseid) <= 0) { $smarty->display('lheader.tpl'); echo "
"._("There are no more records needing to be translated, or you've skipped them all.")."
\n"; echo "\n"; $smarty->display('lfooter.tpl'); die; } foreach($baseid as $id) { if(is_array($id)) { $check =& new DataObject_Base(); $check->id = $id['0']; $check->find(false); $check->fetch(); $trans['id'] = $id['0']; $trans['fuzzy'] = $id['1']; $trans['base'] = $check->string; $trans['comment'] = $check->comment; $trans['isfuzzy'] = "Yes"; } else { $check =& new DataObject_Base(); $check->id = $id; $check->find(false); $check->fetch(); $trans['id'] = $id; $trans['fuzzy'] = babelfish($check->string, $lang); $trans['base'] = $check->string; $trans['comment'] = $check->comment; $trans['isfuzzy'] = "No"; } $trans['base'] = str_replace("\n", "