diff -r 30b857a6b811 -r 1316404e4ea8 includes/pageutils.php --- a/includes/pageutils.php Sun Oct 28 19:57:29 2007 -0400 +++ b/includes/pageutils.php Sun Oct 28 21:19:36 2007 -0400 @@ -521,6 +521,7 @@ function histlist($page_id, $namespace) { global $db, $session, $paths, $template, $plugins; // Common objects + global $lang; if(!$session->get_permissions('history_view')) return 'Access denied'; @@ -533,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 ? '' : '') . ' @@ -548,17 +552,18 @@
- - - - - - + + + + + + '."\n"."\n"; $cls = 'row2'; $ticker = 0; - while($r = $db->fetchrow()) { + while ( $r = $db->fetchrow() ) + { $ticker++; @@ -592,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 { @@ -606,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"; @@ -623,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()) { @@ -658,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 ''; } @@ -897,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; @@ -937,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; } @@ -966,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' => '<FIXME> whatever' + ); + + $_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(); @@ -995,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 @@ -1013,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); @@ -1033,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 { @@ -1048,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'] = ''; @@ -1078,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') . '
'; @@ -1818,6 +1848,7 @@ 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'; if(!preg_match('#^([0-9]+)$#', (string)$id1) || @@ -1836,7 +1867,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);