diff -r 90b7a52bea45 -r b0a4d179be85 includes/pageutils.php --- a/includes/pageutils.php Sat Oct 20 21:59:27 2007 -0400 +++ b/includes/pageutils.php Sat Nov 03 07:40:54 2007 -0400 @@ -1,7 +1,8 @@ get_permissions('history_view')) return 'Access denied'; @@ -532,14 +534,17 @@ $q = 'SELECT time_id,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action=\'edit\' AND page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' ORDER BY time_id DESC;'; if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); - echo 'History of edits and actions

Edits:

'; + echo $lang->get('history_page_subtitle') . ' +

' . $lang->get('history_heading_edits') . '

'; $numrows = $db->numrows(); - if($numrows < 1) echo 'No history entries in this category.'; + if ( $numrows < 1 ) + { + echo $lang->get('history_no_entries'); + } else { - echo '
- + ' . ( urlSeparator == '&' ? '' : '' ) . ' ' . ( $session->sid_super ? '' : '') . ' @@ -547,17 +552,18 @@
- - - - - - + + + + + + '."\n"."\n"; $cls = 'row2'; $ticker = 0; - while($r = $db->fetchrow()) { + while ( $r = $db->fetchrow() ) + { $ticker++; @@ -591,7 +597,7 @@ // User if ( $session->get_permissions('mod_misc') && is_valid_ip($r['author']) ) { - $rc = ' style="cursor: pointer;" title="Click cell background for reverse DNS info" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"'; + $rc = ' style="cursor: pointer;" title="' . $lang->get('history_tip_rdns') . '" onclick="ajaxReverseDNS(this, \'' . $r['author'] . '\');"'; } else { @@ -605,15 +611,19 @@ echo '>' . $r['author'] . ''."\n"; // Edit summary + if ( $r['edit_summary'] == 'Automatic backup created when logs were purged' ) + { + $r['edit_summary'] = $lang->get('history_summary_clearlogs'); + } echo ''."\n"; // Minor edit echo ''."\n"; // Actions! - echo ''."\n"; - echo ''."\n"; - echo ''."\n"; + echo ''."\n"; + echo ''."\n"; + echo ''."\n"; echo ''."\n"."\n"; @@ -622,18 +632,33 @@
- + '; } $db->free_result(); - echo '

Other changes:

'; + echo '

' . $lang->get('history_heading_other') . '

'; $q = 'SELECT time_id,action,date_string,page_id,namespace,author,edit_summary,minor_edit FROM ' . table_prefix.'logs WHERE log_type=\'page\' AND action!=\'edit\' AND page_id=\'' . $paths->cpage['urlname_nons'] . '\' AND namespace=\'' . $paths->namespace . '\' ORDER BY time_id DESC;'; - if(!$db->sql_query($q)) $db->_die('The history data for the page "' . $paths->cpage['name'] . '" could not be selected.'); - if($db->numrows() < 1) echo 'No history entries in this category.'; - else { + if ( !$db->sql_query($q) ) + { + $db->_die('The history data for the page "' . htmlspecialchars($paths->cpage['name']) . '" could not be selected.'); + } + if ( $db->numrows() < 1 ) + { + echo $lang->get('history_no_entries'); + } + else + { - echo '
DiffDate/timeUserEdit summaryMinorActions' . $lang->get('history_col_diff') . '' . $lang->get('history_col_datetime') . '' . $lang->get('history_col_user') . '' . $lang->get('history_col_summary') . '' . $lang->get('history_col_minor') . '' . $lang->get('history_col_actions') . '
' . $r['edit_summary'] . ''. (( $r['minor_edit'] ) ? 'M' : '' ) .'View revisionView user contribsRevert to this revision' . $lang->get('history_action_view') . '' . $lang->get('history_action_contrib') . '' . $lang->get('history_action_restore') . '
'; + echo '
+
Date/timeUserMinorAction takenExtra info
+ + + + + + + '; $cls = 'row2'; while($r = $db->fetchrow()) { @@ -657,23 +682,18 @@ // Action taken echo ''; // Actions! - echo ''; - echo ''; - - //echo '(rollback) ' . $r['date_string'] . ' ' . $r['author'] . ' (Userpage, Contrib): '; - - if($r['minor_edit']) echo ' - minor edit'; - echo '
'; + echo ''; + echo ''; echo ''; } @@ -896,6 +916,7 @@ function comments_raw($page_id, $namespace, $action = false, $flags = Array(), $_ob = '') { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; $pname = $paths->nslist[$namespace] . $page_id; @@ -936,8 +957,8 @@ $q = 'UPDATE ' . table_prefix.'comments SET approved=' . $a . ' WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' AND ' . $where . ';'; $e=$db->sql_query($q); if(!$e) die('alert(unesape(\''.rawurlencode('Error during query: '.mysql_error().'\n\nQuery:\n' . $q) . '\'));'); - if($a=='1') $v = 'Unapprove'; - else $v = 'Approve'; + if($a=='1') $v = $lang->get('comment_btn_mod_unapprove'); + else $v = $lang->get('comment_btn_mod_approve'); echo 'document.getElementById("mdgApproveLink'.intval($_GET['id']).'").innerHTML="' . $v . '";'; break; } @@ -965,22 +986,32 @@ WHERE page_id=\'' . $page_id . '\' AND namespace=\'' . $namespace . '\' ORDER BY c.time ASC;'); if(!$lq) _die('The comment text data could not be selected. '.mysql_error()); - $_ob .= '

Article Comments

'; + $_ob .= '

' . $lang->get('comment_heading') . '

'; + $n = ( $session->get_permissions('mod_comments')) ? $db->numrows() : $num_app; - if($n==1) $s = 'is ' . $n . ' comment'; else $s = 'are ' . $n . ' comments'; - if($n < 1) + + $subst = array( + 'num_comments' => $n, + 'page_type' => $template->namespace_string + ); + + $_ob .= '

'; + $_ob .= ( $n == 0 ) ? $lang->get('comment_msg_count_zero', $subst) : ( $n == 1 ? $lang->get('comment_msg_count_one', $subst) : $lang->get('comment_msg_count_plural', $subst) ); + + if ( $session->get_permissions('mod_comments') && $num_unapp > 0 ) { - $_ob .= '

There are currently no comments on this '.strtolower($namespace).''; - if($namespace != 'Article') $_ob .= ' page'; - $_ob .= '.

'; - } else $_ob .= '

There ' . $s . ' on this article.'; - if($session->get_permissions('mod_comments') && $num_unapp > 0) $_ob .= ' ' . $num_unapp . ' of those are unapproved.'; - elseif(!$session->get_permissions('mod_comments') && $num_unapp > 0) { $u = ($num_unapp == 1) ? "is $num_unapp comment" : "are $num_unapp comments"; $_ob .= ' However, there ' . $u . ' awating approval.'; } + $_ob .= ' ' . $lang->get('comment_msg_count_unapp_mod', array( 'num_unapp' => $num_unapp )) . ''; + } + else if ( !$session->get_permissions('mod_comments') && $num_unapp > 0 ) + { + $ls = ( $num_unapp == 1 ) ? 'comment_msg_count_unapp_one' : 'comment_msg_count_unapp_plural'; + $_ob .= ' ' . $lang->get($ls, array( 'num_unapp' => $num_unapp )) . ''; + } $_ob .= '

'; $list = 'list = { '; // _die(htmlspecialchars($ttext)); $i = -1; - while($row = $db->fetchrow($lq)) + while ( $row = $db->fetchrow($lq) ) { $i++; $strings = Array(); @@ -994,14 +1025,14 @@ // Determine the name, and whether to link to the user page or not $name = ''; - if($row['user_id'] > 0) $name .= ''; + if($row['user_id'] > 1) $name .= ''; $name .= $row['name']; - if($row['user_id'] > 0) $name .= ''; + if($row['user_id'] > 1) $name .= ''; $strings['NAME'] = $name; unset($name); // Subject $s = $row['subject']; - if(!$row['approved']) $s .= ' (Unapproved)'; + if(!$row['approved']) $s .= ' ' . $lang->get('comment_msg_note_unapp') . ''; $strings['SUBJECT'] = $s; // Date and time @@ -1012,16 +1043,17 @@ { default: case USER_LEVEL_GUEST: - $l = 'Guest'; + $l = $lang->get('user_type_guest'); break; case USER_LEVEL_MEMBER: - $l = 'Member'; + case USER_LEVEL_CHPREF: + $l = $lang->get('user_type_member'); break; case USER_LEVEL_MOD: - $l = 'Moderator'; + $l = $lang->get('user_type_mod'); break; case USER_LEVEL_ADMIN: - $l = 'Administrator'; + $l = $lang->get('user_type_admin'); break; } $strings['USER_LEVEL'] = $l; unset($l); @@ -1032,10 +1064,10 @@ if($session->get_permissions('edit_comments')) { // Edit link - $strings['EDIT_LINK'] = 'edit'; + $strings['EDIT_LINK'] = '' . $lang->get('comment_btn_edit') . ''; // Delete link - $strings['DELETE_LINK'] = 'delete'; + $strings['DELETE_LINK'] = '' . $lang->get('comment_btn_delete') . ''; } else { @@ -1047,19 +1079,19 @@ } // Send PM link - $strings['SEND_PM_LINK'] = ( $session->user_logged_in && $row['user_id'] > 0 ) ? 'Send private message
' : ''; + $strings['SEND_PM_LINK'] = ( $session->user_logged_in && $row['user_id'] > 1 ) ? '' . $lang->get('comment_btn_send_privmsg') . '
' : ''; // Add Buddy link - $strings['ADD_BUDDY_LINK'] = ( $session->user_logged_in && $row['user_id'] > 0 ) ? 'Add to buddy list' : ''; + $strings['ADD_BUDDY_LINK'] = ( $session->user_logged_in && $row['user_id'] > 1 ) ? '' . $lang->get('comment_btn_add_buddy') . '' : ''; // Mod links $applink = ''; $applink .= ''; - if($row['approved']) $applink .= 'Unapprove'; - else $applink .= 'Approve'; + if($row['approved']) $applink .= $lang->get('comment_btn_mod_unapprove'); + else $applink .= $lang->get('comment_btn_mod_approve'); $applink .= ''; $strings['MOD_APPROVE_LINK'] = $applink; unset($applink); - $strings['MOD_DELETE_LINK'] = 'Delete'; + $strings['MOD_DELETE_LINK'] = '' . $lang->get('comment_btn_mod_delete') . ''; // Signature $strings['SIGNATURE'] = ''; @@ -1077,32 +1109,31 @@ } if(getConfig('comments_need_login') != '2' || $session->user_logged_in) { - if(!$session->get_permissions('post_comments')) - { - $_ob .= '

Got something to say?

Access to post comments on this page is denied.

'; - } - else + if($session->get_permissions('post_comments')) { - $_ob .= '

Got something to say?

If you have comments or suggestions on this article, you can shout it out here.'; - if(getConfig('approve_comments')=='1') $_ob .= ' Before your comment will be visible to the public, a moderator will have to approve it.'; - if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) $_ob .= ' Because you are not logged in, you will need to enter a visual confirmation before your comment will be posted.'; + $_ob .= '

' . $lang->get('comment_postform_title') . '

'; + $_ob .= $lang->get('comment_postform_blurb'); + if(getConfig('approve_comments')=='1') $_ob .= ' ' . $lang->get('comment_postform_blurb_unapp'); + if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) + { + $_ob .= ' ' . $lang->get('comment_postform_blurb_captcha'); + } $sn = $session->user_logged_in ? $session->username . '' : ''; - $_ob .= ' + $_ob .= '
-

Comment form

' . $lang->get('history_col_datetime') . '' . $lang->get('history_col_user') . '' . $lang->get('history_col_minor') . '' . $lang->get('history_col_action_taken') . '' . $lang->get('history_col_extra') . '
'; // Some of these are sanitized at insert-time. Others follow the newer Enano policy of stripping HTML at runtime. - if ($r['action']=='prot') echo 'Protected pageReason: ' . $r['edit_summary']; - elseif($r['action']=='unprot') echo 'Unprotected pageReason: ' . $r['edit_summary']; - elseif($r['action']=='semiprot') echo 'Semi-protected pageReason: ' . $r['edit_summary']; - elseif($r['action']=='rename') echo 'Renamed pageOld title: '.htmlspecialchars($r['edit_summary']); - elseif($r['action']=='create') echo 'Created page'; - elseif($r['action']=='delete') echo 'Deleted pageReason: ' . $r['edit_summary']; - elseif($r['action']=='reupload') echo 'Uploaded new file versionReason: '.htmlspecialchars($r['edit_summary']); + if ($r['action']=='prot') echo $lang->get('history_log_protect') . '' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; + elseif($r['action']=='unprot') echo $lang->get('history_log_unprotect') . '' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; + elseif($r['action']=='semiprot') echo $lang->get('history_log_semiprotect') . '' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; + elseif($r['action']=='rename') echo $lang->get('history_log_rename') . '' . $lang->get('history_extra_oldtitle') . ' '.htmlspecialchars($r['edit_summary']); + elseif($r['action']=='create') echo $lang->get('history_log_create') . ''; + elseif($r['action']=='delete') echo $lang->get('history_log_delete') . '' . $lang->get('history_extra_reason') . ' ' . $r['edit_summary']; + elseif($r['action']=='reupload') echo $lang->get('history_log_uploadnew') . '' . $lang->get('history_extra_reason') . ' '.htmlspecialchars($r['edit_summary']); echo 'View user contribsRevert action' . $lang->get('history_action_contrib') . '' . $lang->get('history_action_revert') . '
- - '; + + '; if(getConfig('comments_need_login') == '1' && !$session->user_logged_in) { $session->kill_captcha(); $captcha = $session->make_captcha(); - $_ob .= ''; + $_ob .= ''; } $_ob .= ' - - + +
Your name or screen name:' . $sn . '
Comment subject:
' . $lang->get('comment_postform_field_name') . '' . $sn . '
' . $lang->get('comment_postform_field_subject') . '
Visual confirmation:
Please enter the code you see on the right.
Visual confirmation
Code:
' . $lang->get('comment_postform_field_captcha_title') . '
' . $lang->get('comment_postform_field_captcha_blurb') . '
Visual confirmation
' . $lang->get('comment_postform_field_captcha_label') . '
Comment text:
(most HTML will be stripped)
' . $lang->get('comment_postform_field_comment') . '
'; @@ -1333,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; @@ -1341,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' )) { @@ -1357,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')); } } @@ -1376,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.'); @@ -1391,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'); } /** @@ -1405,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)) . '\')'); @@ -1424,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'); } /** @@ -1437,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' ) @@ -1478,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; @@ -1490,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'); } /** @@ -1503,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'); + } } /** @@ -1568,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 . '\''); @@ -1605,11 +1656,11 @@ } echo 'catlist = new Array();'; // Initialize the client-side category list - $_ob .= '

Select which categories this page should be included in.

+ $_ob .= '

' . $lang->get('catedit_title') . '

'; if ( sizeof($cat_info) < 1 ) { - $_ob .= '

There are no categories on this site yet.

'; + $_ob .= '

' . $lang->get('catedit_no_categories') . '

'; } for ( $i = 0; $i < sizeof($cat_info) / 2; $i++ ) { @@ -1630,7 +1681,7 @@ $disabled = ( sizeof($cat_info) < 1 ) ? 'disabled="disabled"' : ''; - $_ob .= '
'; + $_ob .= '
'; $cont = ob_get_contents(); ob_end_clean(); @@ -1745,13 +1796,14 @@ function setpass($page_id, $namespace, $pass) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; // Determine permissions if($paths->pages[$paths->nslist[$namespace].$page_id]['password'] != '') $a = $session->get_permissions('password_reset'); else $a = $session->get_permissions('password_set'); if(!$a) - return 'Access is denied'; + return $lang->get('etc_access_denied'); if(!isset($pass)) return('Password was not set on URL'); $p = $pass; if ( !preg_match('#([0-9a-f]){40,40}#', $p) ) @@ -1769,9 +1821,12 @@ // Is the new password blank? if ( $p == '' ) { - return('The password for this page has been disabled.'); + return $lang->get('ajax_password_disable_success'); } - else return('The password for this page has been set.'); + else + { + return $lang->get('ajax_password_success'); + } } /** @@ -1782,7 +1837,8 @@ function genPreview($text) { - $ret = '
Reminder: This is only a preview - your changes to this page have not yet been saved.
'; + global $lang; + $ret = '
' . $lang->get('editor_preview_blurb') . '
'; $text = RenderMan::render(RenderMan::preprocess_text($text, false, false)); ob_start(); eval('?>' . $text); @@ -1817,8 +1873,9 @@ function pagediff($page_id, $namespace, $id1, $id2) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; if(!$session->get_permissions('history_view')) - return 'Access denied'; + return $lang->get('etc_access_denied'); if(!preg_match('#^([0-9]+)$#', (string)$id1) || !preg_match('#^([0-9]+)$#', (string)$id2 )) return 'SQL injection attempt'; // OK we made it through security @@ -1835,7 +1892,7 @@ $time1 = date('F d, Y h:i a', $id1); $time2 = date('F d, Y h:i a', $id2); $_ob = " -

Comparing revisions: {$time1} → {$time2}

+

" . $lang->get('history_lbl_comparingrevisions') . " {$time1} → {$time2}

"; // Free some memory unset($row1, $row2, $q1, $q2); @@ -1846,8 +1903,6 @@ /** * Gets ACL information about the selected page for target type X and target ID Y. - * @param string $page_id The page ID - * @param string $namespace The namespace * @param array $parms What to select. This is an array purely for JSON compatibility. It should be an associative array with keys target_type and target_id. * @return array */ @@ -1855,11 +1910,13 @@ function acl_editor($parms = Array()) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; + if(!$session->get_permissions('edit_acl') && $session->user_level < USER_LEVEL_ADMIN) { return Array( 'mode' => 'error', - 'error' => 'You are not authorized to view or edit access control lists.' + 'error' => $lang->get('acl_err_access_denied') ); } $parms['page_id'] = ( isset($parms['page_id']) ) ? $parms['page_id'] : false; @@ -1877,7 +1934,7 @@ { return Array( 'mode' => 'error', - 'error' => 'It seems that (a) the file acledit.tpl is missing from these theme, and (b) the JSON response is working.', + 'error' => $lang->get('acl_err_missing_template'), ); } $return['template'] = $template->extract_vars('acledit.tpl'); @@ -1938,7 +1995,7 @@ if(!$q) return(Array('mode'=>'error','error'=>mysql_error())); if($db->numrows() < 1) - return Array('mode'=>'error','error'=>'The username you entered was not found.'); + return Array('mode'=>'error','error'=>$lang->get('acl_err_user_not_found')); $row = $db->fetchrow(); $return['target_name'] = $return['target_id']; $return['target_id'] = intval($row['user_id']); @@ -1985,7 +2042,7 @@ if(!$q) return(Array('mode'=>'error','error'=>mysql_error())); if($db->numrows() < 1) - return Array('mode'=>'error','error'=>'The group ID you submitted is not valid.'); + return Array('mode'=>'error','error'=>$lang->get('acl_err_bad_group_id')); $row = $db->fetchrow(); $return['target_name'] = $row['group_name']; $return['target_id'] = intval($row['group_id']); @@ -2027,7 +2084,7 @@ case 'save_edit': if ( defined('ENANO_DEMO_MODE') ) { - return Array('mode'=>'error','error'=>'Editing access control lists is disabled in the administration demo.'); + return Array('mode'=>'error','error'=>$lang->get('acl_err_demo')); } $q = $db->sql_query('DELETE FROM ' . table_prefix.'acl WHERE target_type='.intval($parms['target_type']).' AND target_id='.intval($parms['target_id']).' ' . $page_where_clause_lite . ';'); @@ -2038,7 +2095,7 @@ { return array( 'mode' => 'error', - 'error' => 'Supplied rule list has a length of zero' + 'error' => $lang->get('acl_err_zero_list') ); } $q = ($page_id && $namespace) ? 'INSERT INTO ' . table_prefix.'acl ( target_type, target_id, page_id, namespace, rules ) @@ -2058,7 +2115,7 @@ case 'delete': if ( defined('ENANO_DEMO_MODE') ) { - return Array('mode'=>'error','error'=>'Editing access control lists is disabled in the administration demo.'); + return Array('mode'=>'error','error'=>$lang->get('acl_err_demo')); } $q = $db->sql_query('DELETE FROM ' . table_prefix.'acl WHERE target_type='.intval($parms['target_type']).' AND target_id='.intval($parms['target_id']).' ' . $page_where_clause_lite . ';'); @@ -2105,6 +2162,7 @@ function aclmanager($parms) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; ob_start(); // Convenience $formstart = '
' . htmlspecialchars($response['text']) . ''; break; case 'stage1': - echo '

Manage page access

-

Please select who should be affected by this access rule.

'; + echo '

' . $lang->get('acl_lbl_welcome_title') . '

+

' . $lang->get('acl_lbl_welcome_body') . '

'; echo $formstart; - echo '

+ echo '

A group of pages

+ $groupsel = '

-

+

' . $template->username_field('data[target_id_user]') . '

-

What should this access rule control?

-

+

' . $lang->get('acl_lbl_scope') . '

+

' . $groupsel . ' -

+

- +
'; echo $formend; break; case 'success': echo '
- Permissions updated
- The permissions for ' . $response['target_name'] . ' on this page have been updated successfully.
+ ' . $lang->get('acl_lbl_save_success_title') . '
+ ' . $lang->get('acl_lbl_save_success_body', array( 'target_name' => $response['target_name'] )) . '
' . $formstart . ' @@ -2174,14 +2233,14 @@ - + ' . $formend . '
'; break; case 'delete': echo '
- Rule deleted
- The selected access rule has been successfully deleted.
+ ' . $lang->get('acl_lbl_delete_success_title') . '
+ ' . $lang->get('acl_lbl_delete_success_body', array('target_name' => $response['target_name'])) . '
' . $formstart . ' @@ -2190,22 +2249,27 @@ - + ' . $formend . '
'; break; case 'seltarget': if ( $response['type'] == 'edit' ) { - echo '

Editing permissions

'; + echo '

' . $lang->get('acl_lbl_editwin_title_edit') . '

'; } else { - echo '

Create new rule

'; + echo '

' . $lang->get('acl_lbl_editwin_title_create') . '

'; } - $type = ( $response['target_type'] == ACL_TYPE_GROUP ) ? 'group' : 'user'; - $scope = ( $response['page_id'] ) ? ( $response['namespace'] == '__PageGroup' ? 'this group of pages' : 'this page' ) : 'this entire site'; - echo 'This panel allows you to edit what the ' . $type . ' "' . $response['target_name'] . '" can do on ' . $scope . '. Unless you set a permission to "Deny", these permissions may be overridden by other rules.'; + $type = ( $response['target_type'] == ACL_TYPE_GROUP ) ? $lang->get('acl_target_type_group') : $lang->get('acl_target_type_user'); + $scope = ( $response['page_id'] ) ? ( $response['namespace'] == '__PageGroup' ? $lang->get('acl_scope_type_pagegroup') : $lang->get('acl_scope_type_thispage') ) : $lang->get('acl_scope_type_wholesite'); + $subs = array( + 'target_type' => $type, + 'target' => $response['target_name'], + 'scope_type' => $scope + ); + echo $lang->get('acl_lbl_editwin_body', $subs); echo $formstart; $parser = $template->makeParserText( $response['template']['acl_field_begin'] ); echo $parser->run(); @@ -2239,7 +2303,14 @@ break; } $vars['FIELD_NAME'] = 'data[perms][' . $acl_type . ']'; - $vars['FIELD_DESC'] = $response['acl_descs'][$acl_type]; + if ( preg_match('/^([a-z0-9_]+)$/', $response['acl_descs'][$acl_type]) ) + { + $vars['FIELD_DESC'] = $lang->get($response['acl_descs'][$acl_type]); + } + else + { + $vars['FIELD_DESC'] = $response['acl_descs'][$acl_type]; + } $parser->assign_vars($vars); echo $parser->run(); } @@ -2252,7 +2323,7 @@ - ' . ( ( $response['type'] == 'edit' ) ? '  ' : '' ) . ' + ' . ( ( $response['type'] == 'edit' ) ? '  ' : '' ) . '
'; echo $formend; break;