plugins/SpecialRecentChanges.php
author Dan
Thu, 21 Feb 2008 17:18:25 -0500
changeset 437 b66f029ae12d
parent 430 ec90736b9cb9
child 504 bc8e0e9ee01d
permissions -rw-r--r--
Enabled strong compression on pwstrength.js as it causes problems otherwise in Opera
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
403
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     1
<?php
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     2
/*
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     3
Plugin Name: plugin_specialrecentchanges_title
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     4
Plugin URI: http://enanocms.org/
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     5
Description: plugin_specialrecentchanges_desc
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     6
Author: Dan Fuhry
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     7
Version: 1.1.1
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     8
Author URI: http://enanocms.org/
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
     9
*/
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    10
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    11
/*
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    12
 * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
430
ec90736b9cb9 Started (but disabled) work on the new theme manager, 1.1.2 is being released with this thing halfway done.
Dan
parents: 414
diff changeset
    13
 * Version 1.1.2 (Caoineag alpha 2)
403
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    14
 * Copyright (C) 2006-2007 Dan Fuhry
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    15
 *
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    16
 * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    17
 * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    18
 *
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    19
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    20
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    21
 */
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    22
 
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    23
global $db, $session, $paths, $template, $plugins; // Common objects
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    24
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    25
$plugins->attachHook('session_started', '
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    26
  global $paths;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    27
    $paths->add_page(Array(
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    28
      \'name\'=>\'specialpage_recent_changes\',
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    29
      \'urlname\'=>\'RecentChanges\',
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    30
      \'namespace\'=>\'Special\',
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    31
      \'special\'=>0,\'visible\'=>1,\'comments_on\'=>0,\'protected\'=>1,\'delvotes\'=>0,\'delvote_ips\'=>\'\',
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    32
      ));
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    33
    ');
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    34
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    35
function page_Special_RecentChanges()
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    36
{
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    37
  global $db, $session, $paths, $template, $plugins; // Common objects
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    38
  global $lang;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    39
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    40
  // One super-loaded SQL query to fetch all the info we need:
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    41
  // (theoretical)
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    42
  //   SELECT ( CHAR_LENGTH(l1.page_text) - CHAR_LENGTH(l2.page_text) ) AS size_change, l1.author, l1.page_id, l1.namespace, l1.edit_summary,
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    43
  //       l1.time_id AS currev_time, l2.time_id AS oldrev_time
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    44
  //     FROM logs AS l1
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    45
  //     LEFT JOIN logs AS l2                                                    
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    46
  //       ON ( l1.log_type = l2.log_type AND l1.action = 'edit' AND l1.action = l2.action AND l2.time_id < l1.time_id AND l1.page_id = l2.page_id AND l1.namespace = l2.namespace )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    47
  //     WHERE l2.time_id IS NOT NULL
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    48
  //     GROUP BY l1.page_id, l1.namespace
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    49
  //     ORDER BY l2.time_id DESC, l1.time_id DESC;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    50
  // (the actual query is generated based on filter criteria)
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    51
  // How it works:
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    52
  //  * Join the logs table with itself
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    53
  //  * Select the size_change virtual column, which is based on current_rev_length - old_rev_length
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    54
  //  * Use GROUP BY to group rows from the same page together
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    55
  //  * Make sure that the time_id in the second instance (l2) of enano_logs is LESS than the time_id in the first instance (l1)
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    56
  //  * Use ORDER BY to ensure that the latest revision before current is selected
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    57
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    58
  $where_extra = '';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    59
  if ( isset($_GET['filter_author']) && is_array($_GET['filter_author']) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    60
  {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    61
    $f_author = $_GET['filter_author'];
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    62
    foreach ( $f_author as &$author )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    63
    {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    64
      $author = $db->escape($author);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    65
    }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    66
    $f_author = "\n    AND (\n      l1.author = '" . implode("'\n      OR l1.author = '", $f_author) . "'\n    )";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    67
    $where_extra .= $f_author;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    68
  }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    69
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    70
  if ( ENANO_DBLAYER == 'MYSQL' )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    71
  {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    72
    $sql = 'SELECT ( CHAR_LENGTH(l1.page_text) - CHAR_LENGTH(l2.page_text) ) AS size_change, l1.author, l1.page_id, l1.namespace, l1.edit_summary,
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    73
    l1.time_id AS currev_time, l2.time_id AS oldrev_time
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    74
  FROM ' . table_prefix . 'logs AS l1
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    75
  LEFT JOIN ' . table_prefix . 'logs AS l2                                                    
414
818b4cd12b8b Added "is_draft != 1" where appropriate in SQL queries to prevent drafts from being treated as real revisions.
Dan
parents: 411
diff changeset
    76
    ON ( l1.log_type = l2.log_type AND l1.action = \'edit\' AND l1.action = l2.action AND l2.time_id < l1.time_id AND l1.page_id = l2.page_id AND l1.namespace = l2.namespace AND l2.is_draft != 1 )
403
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    77
  WHERE l2.time_id IS NOT NULL' . $where_extra . '
414
818b4cd12b8b Added "is_draft != 1" where appropriate in SQL queries to prevent drafts from being treated as real revisions.
Dan
parents: 411
diff changeset
    78
        AND l1.is_draft != 1
403
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    79
  GROUP BY oldrev_time
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    80
  ORDER BY l1.time_id DESC, l2.time_id DESC;';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    81
  }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    82
  else
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    83
  {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    84
    $sql = 'SELECT DISTINCT ON (l1.time_id) ( CHAR_LENGTH(l1.page_text) - CHAR_LENGTH(l2.page_text) ) AS size_change, l1.author, l1.page_id, l1.namespace, l1.edit_summary,
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    85
    l1.time_id AS currev_time, l2.time_id AS oldrev_time
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    86
  FROM ' . table_prefix . 'logs AS l1
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    87
  LEFT JOIN ' . table_prefix . 'logs AS l2                                                    
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    88
    ON ( l1.log_type = l2.log_type AND l1.action = \'edit\' AND l1.action = l2.action AND l2.time_id < l1.time_id AND l1.page_id = l2.page_id AND l1.namespace = l2.namespace )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    89
  WHERE l2.time_id IS NOT NULL' . $where_extra . '
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    90
  GROUP BY l1.time_id, l1.page_id, l1.namespace, l1.author, l1.edit_summary, l2.time_id, l1.page_text, l2.page_text
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    91
  ORDER BY l1.time_id DESC, l2.time_id DESC;';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    92
  }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    93
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    94
  $template->header();
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    95
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    96
  $q = $db->sql_unbuffered_query($sql);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    97
  if ( !$q )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    98
    $db->_die();
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
    99
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   100
  if ( $row = $db->fetchrow($q) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   101
  {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   102
    echo '<p>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   103
    do
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   104
    {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   105
      $css = rch_get_css($row['size_change']);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   106
      $pagekey = ( isset($paths->nslist[$row['namespace']]) ) ? $paths->nslist[$row['namespace']] . $row['page_id'] : $row['namespace'] . ':' . $row['page_id'];
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   107
      $pagekey = sanitize_page_id($pagekey);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   108
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   109
      // diff button
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   110
      echo '(';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   111
      if ( isPage($pagekey) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   112
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   113
        echo '<a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=diff&diff1={$row['oldrev_time']}&diff2={$row['currev_time']}", true) . '">';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   114
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   115
      echo $lang->get('pagetools_rc_btn_diff');
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   116
      if ( isPage($pagekey) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   117
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   118
        echo '</a>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   119
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   120
      echo ') ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   121
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   122
      // hist button
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   123
      echo '(';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   124
      if ( isPage($pagekey) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   125
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   126
        echo '<a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=history", true) . '">';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   127
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   128
      echo $lang->get('pagetools_rc_btn_hist');
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   129
      if ( isPage($pagekey) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   130
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   131
        echo '</a>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   132
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   133
      echo ') . . ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   134
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   135
      // link to the page
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   136
      $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   137
      echo '<a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '"' . $cls . '>' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '</a>; ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   138
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   139
      // date
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   140
      $today = time() - ( time() % 86400 );
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   141
      $date = ( $row['currev_time'] > $today ) ? '' : MemberlistFormatter::format_date($row['currev_time']) . ' ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   142
      $date .= date('h:i s', $row['currev_time']);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   143
      echo "$date . . ";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   144
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   145
      // size counter
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   146
      $size_change = number_format($row['size_change']);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   147
      if ( substr($size_change, 0, 1) != '-' )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   148
        $size_change = "+$size_change";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   149
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   150
      echo "<span style=\"$css\">({$size_change})</span>";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   151
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   152
      // link to userpage
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   153
      echo ' . . ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   154
      $cls = ( isPage($paths->nslist['User'] . $row['author']) ) ? '' : ' class="wikilink-nonexistent"';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   155
      echo '<a href="' . makeUrlNS('User', sanitize_page_id($row['author']), false, true) . '"' . $cls . '>' . htmlspecialchars($row['author']) . '</a> ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   156
      echo '(';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   157
      echo '<a href="' . makeUrlNS('Special', 'PrivateMessages/Compose/To/' . sanitize_page_id($row['author']), false, true) . '">';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   158
      echo $lang->get('pagetools_rc_btn_pm');
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   159
      echo '</a>, ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   160
      echo '<a href="' . makeUrlNS('User', sanitize_page_id($row['author']), false, true) . '#do:comments">';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   161
      echo $lang->get('pagetools_rc_btn_usertalk');
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   162
      echo '</a>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   163
      echo ') . . ';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   164
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   165
      // Edit summary
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   166
      echo '<i>(';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   167
      if ( empty($row['edit_summary']) )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   168
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   169
        echo '<span style="color: #808080;">' . $lang->get('history_summary_none_given') . '</span>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   170
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   171
      else
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   172
      {
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   173
        echo RenderMan::parse_internal_links(htmlspecialchars($row['edit_summary']));
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   174
      }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   175
      echo ')</i>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   176
      
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   177
      echo '<br />';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   178
    }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   179
    while ( $row = $db->fetchrow($q) );
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   180
    echo '</p>';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   181
  }
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   182
  
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   183
  $template->footer();
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   184
}
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   185
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   186
function rch_get_css($change_size)
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   187
{
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   188
  // Hardly changed at all? Return a gray
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   189
  if ( $change_size <= 5 && $change_size >= -5 )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   190
    return 'color: #808080;';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   191
  // determine saturation based on size of change (1-500 bytes)
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   192
  $change_abs = abs($change_size);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   193
  $index = 0x70 * ( $change_abs / 500 );
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   194
  if ( $index > 0x70 )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   195
    $index = 0x70;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   196
  $index = $index + 0x40;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   197
  $index = dechex($index);
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   198
  if ( strlen($index) < 2 )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   199
    $index = "0$index";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   200
  $css = ( $change_size > 0 ) ? "color: #00{$index}00;" : "color: #{$index}0000;";
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   201
  if ( $change_abs > 500 )
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   202
    $css .= ' font-weight: bold;';
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   203
  return $css;
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   204
}
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   205
2c9745b5c09d Started on a Special:RecentChanges page, more to come.
Dan
parents:
diff changeset
   206
?>