includes/namespaces/file.php
changeset 912 95d0d8596c87
parent 801 eb8b23f11744
child 953 323c4cd1aa37
equal deleted inserted replaced
911:facff435cdaa 912:95d0d8596c87
    35   
    35   
    36   function show_info()
    36   function show_info()
    37   {
    37   {
    38     global $db, $session, $paths, $template, $plugins; // Common objects
    38     global $db, $session, $paths, $template, $plugins; // Common objects
    39     global $lang;
    39     global $lang;
       
    40     
       
    41     require_once(ENANO_ROOT . '/includes/log.php');
    40     
    42     
    41     $local_page_id = $this->page_id;
    43     $local_page_id = $this->page_id;
    42     $local_namespace = $this->namespace;
    44     $local_namespace = $this->namespace;
    43     $html = '';
    45     $html = '';
    44     
    46     
   126                       . "  WHERE f.page_id = '$selfn'\n"
   128                       . "  WHERE f.page_id = '$selfn'\n"
   127                       . "    ORDER BY f.time_id DESC;");
   129                       . "    ORDER BY f.time_id DESC;");
   128       if ( !$q )
   130       if ( !$q )
   129         $db->_die();
   131         $db->_die();
   130       
   132       
       
   133       $log = new LogDisplay();
       
   134       $log->add_criterion('page', $paths->nslist['File'] . $this->page_id);
       
   135       $log->add_criterion('action', 'reupload');
       
   136       $data = $log->get_data();
       
   137       $i = -1;
       
   138       
   131       $html .= '<h3>' . $lang->get('onpage_filebox_heading_history') . '</h3><p>';
   139       $html .= '<h3>' . $lang->get('onpage_filebox_heading_history') . '</h3><p>';
   132       $last_rollback_id = false;
   140       $last_rollback_id = false;
   133       while ( $r = $db->fetchrow() )
   141       while ( $r = $db->fetchrow($q) )
   134       {
   142       {
   135         $html .= '(<a href="'.makeUrlNS('Special', 'DownloadFile'.'/'.$selfn.'/'.$r['time_id'].htmlspecialchars(urlSeparator).'download').'">' . $lang->get('onpage_filebox_btn_this_version') . '</a>) ';
   143         $html .= '(<a href="'.makeUrlNS('Special', 'DownloadFile'.'/'.$selfn.'/'.$r['time_id'].htmlspecialchars(urlSeparator).'download').'">' . $lang->get('onpage_filebox_btn_this_version') . '</a>) ';
   136         if ( $session->get_permissions('history_rollback') && $last_rollback_id )
   144         if ( $session->get_permissions('history_rollback') && $last_rollback_id )
   137           $html .= ' (<a href="#rollback:' . $last_rollback_id . '" onclick="ajaxRollback(\''.$last_rollback_id.'\'); return false;">' . $lang->get('onpage_filebox_btn_revert') . '</a>) ';
   145           $html .= ' (<a href="#rollback:' . $last_rollback_id . '" onclick="ajaxRollback(\''.$last_rollback_id.'\'); return false;">' . $lang->get('onpage_filebox_btn_revert') . '</a>) ';
   138         else if ( $session->get_permissions('history_rollback') && !$last_rollback_id )
   146         else if ( $session->get_permissions('history_rollback') && !$last_rollback_id )
   139           $html .= ' (' . $lang->get('onpage_filebox_btn_current') . ') ';
   147           $html .= ' (' . $lang->get('onpage_filebox_btn_current') . ') ';
   140         $last_rollback_id = $r['log_id'];
   148         $last_rollback_id = $r['log_id'];
   141         $mimetype = $r['mimetype'];
       
   142         $datestring = enano_date('F d, Y h:i a', (int)$r['time_id']);
       
   143         
   149         
   144         $html .= $datestring.': '.$r['mimetype'].', ';
   150         $html .= $r['mimetype'].', ';
   145         
   151         
   146         $fs = $r['size'];
   152         $fs = $r['size'];
   147         $fs = (int)$fs;
   153         $fs = (int)$fs;
   148         
   154         
   149         if($fs >= 1048576)
   155         if($fs >= 1048576)
   161         {
   167         {
   162           $size = $fs . ' ' . $lang->get('etc_unit_bytes');
   168           $size = $fs . ' ' . $lang->get('etc_unit_bytes');
   163         }
   169         }
   164         
   170         
   165         $html .= $size;
   171         $html .= $size;
       
   172         if ( isset($data[++$i]) )
       
   173           $html .= ': ' . LogDisplay::render_row($data[$i], false, false);
   166         
   174         
   167         $html .= '<br />';
   175         $html .= '<br />';
   168       }
   176       }
   169       $html .= '</p>';
   177       $html .= '</p>';
   170     }
   178     }