diff -r 1316404e4ea8 -r a6ed8b6cdbe1 includes/pageutils.php --- a/includes/pageutils.php Sun Oct 28 21:19:36 2007 -0400 +++ b/includes/pageutils.php Sun Oct 28 23:50:10 2007 -0400 @@ -1364,6 +1364,7 @@ function rename($page_id, $namespace, $name) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; $pname = $paths->nslist[$namespace] . $page_id; @@ -1372,7 +1373,7 @@ if( empty($name)) { - die('Name is too short'); + return($lang->get('ajax_rename_too_short')); } if( ( $session->get_permissions('rename') && ( ( $prot && $session->get_permissions('even_when_protected') ) || !$prot ) ) && ( $paths->namespace != 'Special' && $paths->namespace != 'Admin' )) { @@ -1388,12 +1389,16 @@ } else { - return('The page "' . $paths->pages[$pname]['name'] . '" has been renamed to "' . $name . '". You are encouraged to leave a comment explaining your action.' . "\n\n" . 'You will see the change take effect the next time you reload this page.'); + $subst = array( + 'page_name_old' => $paths->pages[$pname]['name'], + 'page_name_new' => $name + ); + return $lang->get('ajax_rename_success', $subst); } } else { - return('Access is denied.'); + return($lang->get('etc_access_denied')); } } @@ -1407,7 +1412,11 @@ function flushlogs($page_id, $namespace) { global $db, $session, $paths, $template, $plugins; // Common objects - if(!$session->get_permissions('clear_logs')) die('Administrative privileges are required to flush logs, you loser.'); + global $lang; + if(!$session->get_permissions('clear_logs')) + { + return $lang->get('etc_access_denied'); + } $e = $db->sql_query('DELETE FROM ' . table_prefix.'logs WHERE page_id=\'' . $db->escape($page_id) . '\' AND namespace=\'' . $db->escape($namespace) . '\';'); if(!$e) $db->_die('The log entries could not be deleted.'); @@ -1422,7 +1431,7 @@ $q='INSERT INTO ' . table_prefix.'logs(log_type,action,time_id,date_string,page_id,namespace,page_text,char_tag,author,edit_summary,minor_edit) VALUES(\'page\', \'edit\', '.time().', \''.date('d M Y h:i a').'\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $db->escape($row['page_text']) . '\', \'' . $row['char_tag'] . '\', \'' . $session->username . '\', \''."Automatic backup created when logs were purged".'\', '.'false'.');'; if(!$db->sql_query($q)) $db->_die('The history (log) entry could not be inserted into the logs table.'); } - return('The logs for this page have been cleared. A backup of this page has been added to the logs table so that this page can be restored in case of vandalism or spam later.'); + return $lang->get('ajax_clearlogs_success'); } /** @@ -1436,11 +1445,12 @@ function deletepage($page_id, $namespace, $reason) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; $perms = $session->fetch_page_acl($page_id, $namespace); $x = trim($reason); if ( empty($x) ) { - return 'Invalid reason for deletion passed'; + return $lang->get('ajax_delete_need_reason'); } if(!$perms->get_permissions('delete_page')) return('Administrative privileges are required to delete pages, you loser.'); $e = $db->sql_query('INSERT INTO ' . table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'delete\', \'' . $page_id . '\', \'' . $namespace . '\', \'' . $session->username . '\', \'' . $db->escape(htmlspecialchars($reason)) . '\')'); @@ -1455,7 +1465,7 @@ if(!$e) $db->_die('The page entry could not be deleted.'); $e = $db->sql_query('DELETE FROM ' . table_prefix.'files WHERE page_id=\'' . $page_id . '\''); if(!$e) $db->_die('The file entry could not be deleted.'); - return('This page has been deleted. Note that there is still a log of edits and actions in the database, and anyone with admin rights can raise this page from the dead unless the log is cleared. If the deleted file is an image, there may still be cached thumbnails of it in the cache/ directory, which is inaccessible to users.'); + return $lang->get('ajax_delete_success'); } /** @@ -1468,9 +1478,10 @@ function delvote($page_id, $namespace) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; if ( !$session->get_permissions('vote_delete') ) { - return 'Access denied'; + return $lang->get('etc_access_denied'); } if ( $namespace == 'Admin' || $namespace == 'Special' || $namespace == 'System' ) @@ -1509,7 +1520,7 @@ if ( in_array($session->username, $ips['u']) || in_array($_SERVER['REMOTE_ADDR'], $ips['ip']) ) { - return 'It appears that you have already voted to have this page deleted.'; + return $lang->get('ajax_delvote_already_voted'); } $ips['u'][] = $session->username; @@ -1521,7 +1532,7 @@ $q = 'UPDATE ' . table_prefix.'pages SET delvotes=' . $cv . ',delvote_ips=\'' . $ips . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''; $w = $db->sql_query($q); - return 'Your vote to have this page deleted has been cast.'."\nYou are encouraged to leave a comment explaining the reason for your vote."; + return $lang->get('ajax_delvote_success'); } /** @@ -1534,11 +1545,18 @@ function resetdelvotes($page_id, $namespace) { global $db, $session, $paths, $template, $plugins; // Common objects - if(!$session->get_permissions('vote_reset')) die('You need moderator rights in order to do this, stinkin\' hacker.'); + global $lang; + if(!$session->get_permissions('vote_reset')) + { + return $lang->get('etc_access_denied'); + } $q = 'UPDATE ' . table_prefix.'pages SET delvotes=0,delvote_ips=\'' . $db->escape(serialize(array('ip'=>array(),'u'=>array()))) . '\' WHERE urlname=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\''; $e = $db->sql_query($q); if(!$e) $db->_die('The number of delete votes was not reset.'); - else return('The number of votes for having this page deleted has been reset to zero.'); + else + { + return $lang->get('ajax_delvote_reset_success'); + } } /** @@ -1599,6 +1617,8 @@ function catedit_raw($page_id, $namespace) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; + ob_start(); $_ob = ''; $e = $db->sql_query('SELECT category_id FROM ' . table_prefix.'categories WHERE page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\''); @@ -1636,11 +1656,11 @@ } echo 'catlist = new Array();'; // Initialize the client-side category list - $_ob .= '