includes/log.php
changeset 909 94c1ff984286
parent 905 1e40b33f2e3e
child 912 95d0d8596c87
equal deleted inserted replaced
908:44302dd20d62 909:94c1ff984286
   110     {
   110     {
   111       list($type, $value) = $criterion;
   111       list($type, $value) = $criterion;
   112       switch($type)
   112       switch($type)
   113       {
   113       {
   114         case 'user':
   114         case 'user':
   115           $where_bits['user'][] = "author = '" . $db->escape($value) . "'";
   115           $where_bits['user'][] = "author = '" . $db->escape(str_replace('_', ' ', $value)) . "'";
   116           break;
   116           break;
   117         case 'action':
   117         case 'action':
   118           $where_bits['action'][] = "action = '" . $db->escape($value) . "'";
   118           if ( $value === 'protect' )
       
   119           {
       
   120             $where_bits['action'][] = "action = 'prot'";
       
   121             $where_bits['action'][] = "action = 'unprot'";
       
   122             $where_bits['action'][] = "action = 'semiprot'";
       
   123           }
       
   124           else
       
   125           {
       
   126             $where_bits['action'][] = "action = '" . $db->escape($value) . "'";
       
   127           }
   119           break;
   128           break;
   120         case 'page':
   129         case 'page':
   121           list($page_id, $namespace) = RenderMan::strToPageId($value);
   130           list($page_id, $namespace) = RenderMan::strToPageId($value);
   122           $where_bits['page'][] = "page_id = '" . $db->escape($page_id) . "' AND namespace = '" . $db->escape($namespace) . "'";
   131           $where_bits['page'][] = "page_id = '" . $db->escape($page_id) . "' AND namespace = '" . $db->escape($namespace) . "'";
   123           break;
   132           break;
   247     list($count) = $db->fetchrow_num();
   256     list($count) = $db->fetchrow_num();
   248     return $count;
   257     return $count;
   249   }
   258   }
   250   
   259   
   251   /**
   260   /**
       
   261    * Returns the list of criteria
       
   262    * @return array
       
   263    */
       
   264   
       
   265   public function get_criteria()
       
   266   {
       
   267     return $this->criteria;
       
   268   }
       
   269   
       
   270   /**
   252    * Formats a result row into pretty HTML.
   271    * Formats a result row into pretty HTML.
   253    * @param array dataset from LogDisplay::get_data()
   272    * @param array dataset from LogDisplay::get_data()
   254    * @static
   273    * @static
   255    * @return string
   274    * @return string
   256    */
   275    */
   276       $html .= $lang->get('pagetools_rc_btn_diff');
   295       $html .= $lang->get('pagetools_rc_btn_diff');
   277       if ( isPage($pagekey) )
   296       if ( isPage($pagekey) )
   278       {
   297       {
   279         $html .= '</a>';
   298         $html .= '</a>';
   280       }
   299       }
       
   300       if ( $row['parent_revid'] > 0 && isPage($pagekey) )
       
   301       {
       
   302         $html .= ', <a href="' . makeUrlNS($row['namespace'], $row['page_id'], false, true) . '#do:edit;rev:' . $row['parent_revid'] . '">' . $lang->get('pagetools_rc_btn_undo') . '</a>';
       
   303       }
   281       $html .= ') ';
   304       $html .= ') ';
   282     }
   305     }
   283     
   306     
   284     // hist button
   307     // hist button
   285     $html .= '(';
   308     $html .= '(';
   297     // new page?
   320     // new page?
   298     if ( $row['action'] == 'edit' && empty($row['parent_revid']) )
   321     if ( $row['action'] == 'edit' && empty($row['parent_revid']) )
   299     {
   322     {
   300       $html .= '<b>N</b> ';
   323       $html .= '<b>N</b> ';
   301     }
   324     }
       
   325     // minor edit?
       
   326     if ( $row['action'] == 'edit' && $row['minor_edit'] )
       
   327     {
       
   328       $html .= '<b>m</b> ';
       
   329     }
   302     
   330     
   303     // link to the page
   331     // link to the page
   304     $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"';
   332     $cls = ( isPage($pagekey) ) ? '' : ' class="wikilink-nonexistent"';
   305     $html .= '<a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '"' . $cls . '>' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '</a>; ';
   333     $html .= '<a href="' . makeUrlNS($row['namespace'], $row['page_id']) . '"' . $cls . '>' . htmlspecialchars(get_page_title_ns($row['page_id'], $row['namespace'])) . '</a>; ';
   306     
   334     
   307     // date
   335     // date
   308     $today = time() - ( time() % 86400 );
   336     $today = time() - ( time() % 86400 );
   309     $date = ( $row['time_id'] > $today ) ? '' : MemberlistFormatter::format_date($row['time_id']) . ' ';
   337     $date = MemberlistFormatter::format_date($row['time_id']) . ' ';
   310     $date .= date('h:i:s', $row['time_id']);
   338     $date .= date('h:i:s', $row['time_id']);
   311     $html .= "$date . . ";
   339     $html .= "$date . . ";
   312     
   340     
   313     // size counter
   341     // size counter
   314     if ( $row['action'] == 'edit' )
   342     if ( $row['action'] == 'edit' )
   371             'prot' => 'log_action_protect_full',
   399             'prot' => 'log_action_protect_full',
   372             'unprot' => 'log_action_protect_none',
   400             'unprot' => 'log_action_protect_none',
   373             'semiprot' => 'log_action_protect_semi',
   401             'semiprot' => 'log_action_protect_semi',
   374             'delete' => 'log_action_delete'
   402             'delete' => 'log_action_delete'
   375           );
   403           );
   376         $reason = ( !empty($row['edit_summary']) ) ? htmlspecialchars($row['edit_summary']) : '<span style="color: #808080;">' . $lang->get('log_msg_no_reason_provided') . '</span>';
   404         
       
   405         if ( $row['edit_summary'] === '__REVERSION__' )
       
   406            $reason = '<span style="color: #808080;">' . $lang->get('log_msg_reversion') . '</span>';
       
   407         else
       
   408           $reason = ( !empty($row['edit_summary']) ) ? htmlspecialchars($row['edit_summary']) : '<span style="color: #808080;">' . $lang->get('log_msg_no_reason_provided') . '</span>';
   377         
   409         
   378         $html .= $lang->get($stringmap[$row['action']], array('reason' => $reason));
   410         $html .= $lang->get($stringmap[$row['action']], array('reason' => $reason));
   379       }
   411       }
   380     }
   412     }
   381     
   413