diff -r facff435cdaa -r 95d0d8596c87 includes/log.php
--- a/includes/log.php Wed Apr 15 14:23:48 2009 -0400
+++ b/includes/log.php Wed Apr 15 16:20:33 2009 -0400
@@ -164,7 +164,7 @@
* @return array
*/
- public function get_data($offset, $page_size)
+ public function get_data($offset = 0, $page_size = 0)
{
global $db, $session, $paths, $session, $plugins; // Common objects
$sql = $this->build_sql($offset, $page_size);
@@ -270,11 +270,13 @@
/**
* Formats a result row into pretty HTML.
* @param array dataset from LogDisplay::get_data()
+ * @param bool If true (default), shows action buttons.
+ * @param bool If true (default), shows page title; good for integrated displays
* @static
* @return string
*/
- public static function render_row($row)
+ public static function render_row($row, $show_buttons = true, $show_pagetitle = true)
{
global $db, $session, $paths, $session, $plugins; // Common objects
global $lang;
@@ -285,52 +287,64 @@
$pagekey = sanitize_page_id($pagekey);
// diff button
- if ( $row['action'] == 'edit' && !empty($row['parent_revid']) )
+ if ( $show_buttons )
{
+ if ( $row['action'] == 'edit' && !empty($row['parent_revid']) )
+ {
+ $html .= '(';
+ if ( isPage($pagekey) )
+ {
+ $html .= '';
+ }
+ $html .= $lang->get('pagetools_rc_btn_diff');
+ if ( isPage($pagekey) )
+ {
+ $html .= '';
+ }
+ if ( $row['parent_revid'] > 0 && isPage($pagekey) )
+ {
+ $html .= ', ' . $lang->get('pagetools_rc_btn_undo') . '';
+ }
+ $html .= ') ';
+ }
+ else if ( $row['action'] != 'edit' && ( isPage($pagekey) || $row['action'] == 'delete' ) )
+ {
+ $html .= '(';
+ $html .= '' . $lang->get('pagetools_rc_btn_undo') . '';
+ $html .= ') ';
+ }
+
+ // hist button
$html .= '(';
if ( isPage($pagekey) )
{
- $html .= '';
+ $html .= '';
}
- $html .= $lang->get('pagetools_rc_btn_diff');
+ $html .= $lang->get('pagetools_rc_btn_hist');
if ( isPage($pagekey) )
{
$html .= '';
}
- if ( $row['parent_revid'] > 0 && isPage($pagekey) )
- {
- $html .= ', ' . $lang->get('pagetools_rc_btn_undo') . '';
- }
- $html .= ') ';
+ $html .= ') . . ';
}
- // hist button
- $html .= '(';
- if ( isPage($pagekey) )
+ if ( $show_pagetitle )
{
- $html .= '';
- }
- $html .= $lang->get('pagetools_rc_btn_hist');
- if ( isPage($pagekey) )
- {
- $html .= '';
+ // new page?
+ if ( $row['action'] == 'edit' && empty($row['parent_revid']) )
+ {
+ $html .= 'N ';
+ }
+ // minor edit?
+ if ( $row['action'] == 'edit' && $row['minor_edit'] )
+ {
+ $html .= 'm ';
+ }
+
+ // link to the page
+ $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"';
+ $html .= '' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '; ';
}
- $html .= ') . . ';
-
- // new page?
- if ( $row['action'] == 'edit' && empty($row['parent_revid']) )
- {
- $html .= 'N ';
- }
- // minor edit?
- if ( $row['action'] == 'edit' && $row['minor_edit'] )
- {
- $html .= 'm ';
- }
-
- // link to the page
- $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"';
- $html .= '' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '; ';
// date
$today = time() - ( time() % 86400 );
@@ -395,15 +409,19 @@
case 'unprot':
case 'semiprot':
case 'delete':
+ case 'reupload':
$stringmap = array(
'prot' => 'log_action_protect_full',
'unprot' => 'log_action_protect_none',
'semiprot' => 'log_action_protect_semi',
- 'delete' => 'log_action_delete'
+ 'delete' => 'log_action_delete',
+ 'reupload' => 'log_action_reupload'
);
if ( $row['edit_summary'] === '__REVERSION__' )
- $reason = '' . $lang->get('log_msg_reversion') . '';
+ $reason = '' . $lang->get('log_msg_reversion') . '';
+ else if ( $row['action'] == 'reupload' && $row['edit_summary'] === '__ROLLBACK__' )
+ $reason = '' . $lang->get('log_msg_file_restored') . '';
else
$reason = ( !empty($row['edit_summary']) ) ? htmlspecialchars($row['edit_summary']) : '' . $lang->get('log_msg_no_reason_provided') . '';