--- a/includes/log.php Mon Apr 13 12:32:28 2009 -0400
+++ b/includes/log.php Mon Apr 13 12:32:36 2009 -0400
@@ -50,6 +50,7 @@
{
case 'user':
case 'page':
+ case 'action':
$this->criteria[] = array($criterion, $value);
break;
case 'within':
@@ -102,7 +103,8 @@
$where_extra = '';
$where_bits = array(
'user' => array(),
- 'page' => array()
+ 'page' => array(),
+ 'action' => array()
);
foreach ( $this->criteria as $criterion )
{
@@ -112,6 +114,9 @@
case 'user':
$where_bits['user'][] = "author = '" . $db->escape($value) . "'";
break;
+ case 'action':
+ $where_bits['action'][] = "action = '" . $db->escape($value) . "'";
+ break;
case 'page':
list($page_id, $namespace) = RenderMan::strToPageId($value);
$where_bits['page'][] = "page_id = '" . $db->escape($page_id) . "' AND namespace = '" . $db->escape($namespace) . "'";
@@ -130,6 +135,10 @@
{
$where_extra .= "\n AND ( (" . implode(") OR (", $where_bits['page']) . ") )";
}
+ if ( !empty($where_bits['action']) )
+ {
+ $where_extra .= "\n AND ( (" . implode(") OR (", $where_bits['action']) . ") )";
+ }
$limit = ( $page_size > 0 ) ? "\n LIMIT $offset, $page_size" : '';
$columns = ( $just_page_count ) ? 'COUNT(*)' : 'log_id, action, page_id, namespace, CHAR_LENGTH(page_text) AS revision_size, author, time_id, edit_summary, minor_edit';
$sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs\n"
@@ -312,10 +321,6 @@
$html .= "<span style=\"$css\">({$size_change})</span>";
$html .= ' . . ';
}
- else
- {
- $html .= " FIXME {$row['action']} . . ";
- }
// link to userpage
$cls = ( isPage($paths->nslist['User'] . $row['author']) ) ? '' : ' class="wikilink-nonexistent"';
@@ -331,16 +336,48 @@
$html .= ') . . ';
// Edit summary
- $html .= '<i>(';
- if ( empty($row['edit_summary']) )
+
+ if ( $row['action'] == 'edit' )
{
- $html .= '<span style="color: #808080;">' . $lang->get('history_summary_none_given') . '</span>';
+ $html .= '<i>(';
+ if ( empty($row['edit_summary']) )
+ {
+ $html .= '<span style="color: #808080;">' . $lang->get('history_summary_none_given') . '</span>';
+ }
+ else
+ {
+ $html .= RenderMan::parse_internal_links(htmlspecialchars($row['edit_summary']));
+ }
+ $html .= ')</i>';
}
else
{
- $html .= RenderMan::parse_internal_links(htmlspecialchars($row['edit_summary']));
+ switch($row['action'])
+ {
+ default:
+ $html .= $row['action'];
+ break;
+ case 'rename':
+ $html .= $lang->get('log_action_rename', array('old_name' => htmlspecialchars($row['edit_summary'])));
+ break;
+ case 'create':
+ $html .= $lang->get('log_action_create');
+ break;
+ case 'prot':
+ case 'unprot':
+ case 'semiprot':
+ case 'delete':
+ $stringmap = array(
+ 'prot' => 'log_action_protect_full',
+ 'unprot' => 'log_action_protect_none',
+ 'semiprot' => 'log_action_protect_semi',
+ 'delete' => 'log_action_delete'
+ );
+ $reason = ( !empty($row['edit_summary']) ) ? htmlspecialchars($row['edit_summary']) : '<span style="color: #808080;">' . $lang->get('log_msg_no_reason_provided') . '</span>';
+
+ $html .= $lang->get($stringmap[$row['action']], array('reason' => $reason));
+ }
}
- $html .= ')</i>';
return $html;
}
--- a/language/english/tools.json Mon Apr 13 12:32:28 2009 -0400
+++ b/language/english/tools.json Mon Apr 13 12:32:36 2009 -0400
@@ -12,13 +12,14 @@
var enano_lang = {
categories: [
- 'meta', 'search', 'specialpage', 'pagetools'
+ 'meta', 'search', 'specialpage', 'pagetools', 'log'
],
strings: {
meta: {
search: 'Search page',
specialpage: 'Special pages',
pagetools: 'Userspace page-management tools',
+ log: 'Log and history display',
},
specialpage: {
administration: 'Administration',
@@ -148,6 +149,16 @@
rc_btn_pm: 'PM',
rc_btn_usertalk: 'comment',
},
+ log: {
+ action_rename: 'Renamed (old name: %old_name%)',
+ action_create: 'Created page',
+ action_delete: 'Deleted page (%reason%)',
+ action_protect_none: 'Unprotected page (%reason%)',
+ action_protect_semi: 'Semiprotected page (%reason%)',
+ action_protect_full: 'Protected page (%reason%)',
+
+ msg_no_reason_provided: 'No reason provided',
+ }
}
};
--- a/plugins/SpecialLog.php Mon Apr 13 12:32:28 2009 -0400
+++ b/plugins/SpecialLog.php Mon Apr 13 12:32:36 2009 -0400
@@ -48,7 +48,7 @@
{
foreach ( $params as $param )
{
- if ( preg_match('/^(user|page|within|resultpage|size)=(.+?)$/', $param, $match) )
+ if ( preg_match('/^([a-z]+)=(.+?)$/', $param, $match) )
{
$name =& $match[1];
$value =& $match[2];
@@ -82,4 +82,5 @@
echo LogDisplay::render_row($row) . '<br />';
}
$output->footer();
-}
+}
+