includes/log.php
changeset 980 d13fad911955
parent 947 f222643fb578
child 1081 745200a9cc2a
equal deleted inserted replaced
979:aafb9f6806c9 980:d13fad911955
    51       case 'user':
    51       case 'user':
    52       case 'page':
    52       case 'page':
    53       case 'action':
    53       case 'action':
    54         $this->criteria[] = array($criterion, $value);
    54         $this->criteria[] = array($criterion, $value);
    55         break;
    55         break;
       
    56       case 'minor':
       
    57         $this->criteria[] = array($criterion, intval($value));
       
    58         break;
    56       case 'within':
    59       case 'within':
    57         if ( is_int($value) )
    60         if ( is_int($value) )
    58         {
    61         {
    59           $this->criteria[] = array($criterion, $value);
    62           $this->criteria[] = array($criterion, $value);
    60         }
    63         }
   132           break;
   135           break;
   133         case 'within':
   136         case 'within':
   134           $threshold = time() - $value;
   137           $threshold = time() - $value;
   135           $where_extra .= "\n    AND time_id > $threshold";
   138           $where_extra .= "\n    AND time_id > $threshold";
   136           break;
   139           break;
       
   140         case 'minor':
       
   141           if ( $value == 1 )
       
   142             $where_extra .= "\n    AND ( minor_edit = 1 OR action != 'edit' )";
       
   143           else
       
   144             $where_extra .= "\n    AND minor_edit != 1";
       
   145           break;
   137       }
   146       }
   138     }
   147     }
   139     if ( !empty($where_bits['user']) )
   148     if ( !empty($where_bits['user']) )
   140     {
   149     {
   141       $where_extra .= "\n    AND ( " . implode(" OR ", $where_bits['user']) . " )";
   150       $where_extra .= "\n    AND ( " . implode(" OR ", $where_bits['user']) . " )";
   153     else
   162     else
   154       $limit = ( $page_size > 0 ) ? "\n  LIMIT $offset, $page_size" : '';
   163       $limit = ( $page_size > 0 ) ? "\n  LIMIT $offset, $page_size" : '';
   155     $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';
   164     $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';
   156     $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs AS l\n"
   165     $sql = 'SELECT ' . $columns . ' FROM ' . table_prefix . "logs AS l\n"
   157          . "  WHERE log_type = 'page' AND is_draft != 1$where_extra\n"
   166          . "  WHERE log_type = 'page' AND is_draft != 1$where_extra\n"
   158          . "  GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit"
   167          . ( $just_page_count ? '' : "  GROUP BY log_id, action, page_id, namespace, page_text, author, time_id, edit_summary, minor_edit\n" )
   159          . "  ORDER BY time_id DESC $limit;";
   168          . "  ORDER BY time_id DESC $limit;";
   160     
   169     
   161     return $sql;
   170     return $sql;
   162   }
   171   }
   163   
   172   
   294     if ( $show_buttons )
   303     if ( $show_buttons )
   295     {
   304     {
   296       if ( $row['action'] == 'edit' && !empty($row['parent_revid']) )
   305       if ( $row['action'] == 'edit' && !empty($row['parent_revid']) )
   297       {
   306       {
   298         $html .= '(';
   307         $html .= '(';
   299         if ( isPage($pagekey) )
   308         $ispage = isPage($pagekey);
   300         {
   309         
       
   310         if ( $ispage )
   301           $html .= '<a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=diff&diff1={$row['parent_revid']}&diff2={$row['log_id']}", true) . '">';
   311           $html .= '<a href="' . makeUrlNS($row['namespace'], $row['page_id'], "do=diff&diff1={$row['parent_revid']}&diff2={$row['log_id']}", true) . '">';
   302         }
   312         
   303         $html .= $lang->get('pagetools_rc_btn_diff');
   313         $html .= $lang->get('pagetools_rc_btn_diff');
   304         if ( isPage($pagekey) )
   314         
   305         {
   315         if ( $ispage )
   306           $html .= '</a>';
   316           $html .= '</a>';
   307         }
   317         
       
   318         if ( $ispage )
       
   319           $html .= ', <a href="' . makeUrlNS($row['namespace'], $row['page_id'], "oldid={$row['log_id']}", true) . '">';
       
   320         
       
   321         $html .= $lang->get('pagetools_rc_btn_view');
       
   322         
       
   323         if ( $ispage )
       
   324           $html .= '</a>';
       
   325         
   308         if ( $row['parent_revid'] > 0 && isPage($pagekey) )
   326         if ( $row['parent_revid'] > 0 && isPage($pagekey) )
   309         {
   327         {
   310           $html .= ', <a href="' . makeUrlNS($row['namespace'], $row['page_id'], false, true) . '#do:edit;rev:' . $row['parent_revid'] . '">' . $lang->get('pagetools_rc_btn_undo') . '</a>';
   328           $html .= ', <a href="' . makeUrlNS($row['namespace'], $row['page_id'], false, true) . '#do:edit;rev:' . $row['parent_revid'] . '">' . $lang->get('pagetools_rc_btn_undo') . '</a>';
   311         }
   329         }
   312         $html .= ') ';
   330         $html .= ') ';