");
rawoutput("$namespace
");
rawoutput("$texta
");
rawoutput("
");
rawoutput("$translation
");
rawoutput("
");
rawoutput("");
rawoutput("");
rawoutput("");
popup_footer();
}elseif ($_GET['op']=='save'){
$uri = httppost('uri');
$text = httppost('text');
$trans = httppost('trans');
$page = $uri;
if (strpos($page,"?")!==false) $page = substr($page,0,strpos($page,"?"));
if ($trans==""){
$sql = "DELETE ";
}else{
$sql = "SELECT * ";
}
$sql .= "
FROM ".db_prefix("translations")."
WHERE language='".LANGUAGE."'
AND intext='$text'
AND (uri='$page' OR uri='$uri')";
if ($trans>""){
$result = db_query($sql);
invalidatedatacache("translations-".$uri."-".$language);
//invalidatedatacache("translations-".$namespace."-".$language);
if (db_num_rows($result)==0){
$sql = "INSERT INTO ".db_prefix("translations")." (language,uri,intext,outtext,author,version) VALUES ('".LANGUAGE."','$uri','$text','$trans','{$session['user']['login']}','$logd_version ')";
$sql1 = "DELETE FROM " . db_prefix("untranslated") .
" WHERE intext='$text' AND language='" . LANGUAGE .
"' AND namespace='$url'";
db_query($sql1);
}elseif(db_num_rows($result)==1){
$row = db_fetch_assoc($result);
// MySQL is case insensitive so we need to do it here.
if ($row['intext'] == $text){
$sql = "UPDATE ".db_prefix("translations")." SET author='{$session['user']['login']}', version='$logd_version', uri='$uri', outtext='$trans' WHERE tid={$row['tid']}";
}else{
$sql = "INSERT INTO " . db_prefix("translations") . " (language,uri,intext,outtext,author,version) VALUES ('" . LANGUAGE . "','$uri','$text','$trans','{$session['user']['login']}','$logd_version ')";
$sql1 = "DELETE FROM " . db_prefix("untranslated") . " WHERE intext='$text' AND language='" . LANGUAGE . "' AND namespace='$url'";
db_query($sql1);
}
}elseif(db_num_rows($result)>1){
$rows = array();
while ($row = db_fetch_assoc($result)){
// MySQL is case insensitive so we need to do it here.
if ($row['intext'] == $text){
$rows['tid']=$row['tid'];
}
}
$sql = "UPDATE ".db_prefix("translations")." SET author='{$session['user']['login']}', version='$logd_version', uri='$page', outtext='$trans' WHERE tid IN (".join(",",$rows).")";
}
}
db_query($sql);
if (httppost("savenotclose")>""){
header("Location: translatortool.php?op=list&u=$page");
exit();
}else{
popup_header("Updated");
rawoutput("");
popup_footer();
}
}elseif($op=="list"){
popup_header("Translation List");
$sql = "SELECT uri,count(*) AS c FROM " . db_prefix("translations") . " WHERE language='".LANGUAGE."' GROUP BY uri ORDER BY uri ASC";
$result = db_query($sql);
rawoutput("
$ops | $from | $to | $version | $author |
"); $edit = translate_inline("Edit"); rawoutput("$edit"); rawoutput(" | "); rawoutput(htmlentities($row['intext'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))); rawoutput(" | "); rawoutput(htmlentities($row['outtext'], ENT_COMPAT, getsetting("charset", "ISO-8859-1"))); rawoutput(" | "); rawoutput($row['version']); rawoutput(" | "); rawoutput($row['author']); rawoutput(" |
$norows |