index.php
changeset 468 194a19711346
parent 411 d1a95497b68f
child 481 07bf15b066bc
equal deleted inserted replaced
467:e4bbd6fb8df3 468:194a19711346
   166         $edsumm = '';
   166         $edsumm = '';
   167         // $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
   167         // $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
   168       }
   168       }
   169       if ( $revid > 0 )
   169       if ( $revid > 0 )
   170       {
   170       {
   171         echo '<div class="usermessage">' . $lang->get('editor_msg_editing_old_revision') . '</div>';
   171         $time = $page->revision_time;
   172         // Retrieve information about this revision and the current one
   172         // Retrieve information about this revision and the current one
   173         $q = $db->sql_query('SELECT l1.author AS currentrev_author, l2.author AS oldrev_author FROM ' . table_prefix . 'logs AS l1
   173         $q = $db->sql_query('SELECT l1.author AS currentrev_author, l2.author AS oldrev_author FROM ' . table_prefix . 'logs AS l1
   174   LEFT JOIN ' . table_prefix . 'logs AS l2
   174   LEFT JOIN ' . table_prefix . 'logs AS l2
   175     ON ( l2.time_id = ' . $revid . '
   175     ON ( l2.log_id = ' . $revid . '
   176          AND l2.log_type  = \'page\'
   176          AND l2.log_type  = \'page\'
   177          AND l2.action    = \'edit\'
   177          AND l2.action    = \'edit\'
   178          AND l2.page_id   = \'ACL_Tests\'
   178          AND l2.page_id   = \'' . $db->escape($paths->page_id) . '\'
   179          AND l2.namespace = \'Article\'
   179          AND l2.namespace = \'' . $db->escape($paths->namespace) . '\'
       
   180          AND l1.is_draft != 1
   180         )
   181         )
   181   WHERE l1.log_type  = \'page\'
   182   WHERE l1.log_type  = \'page\'
   182     AND l1.action    = \'edit\'
   183     AND l1.action    = \'edit\'
   183     AND l1.page_id   = \'ACL_Tests\'
   184     AND l1.page_id   = \'' . $db->escape($paths->page_id) . '\'
   184     AND l1.namespace = \'Article\'
   185     AND l1.namespace = \'' . $db->escape($paths->namespace) . '\'
   185     AND l1.time_id >= ' . $revid . '
   186     AND l1.time_id > ' . $time . '
       
   187     AND l1.is_draft != 1
   186   ORDER BY l1.time_id DESC;');
   188   ORDER BY l1.time_id DESC;');
   187         if ( !$q )
   189         if ( !$q )
   188           $db->die_json();
   190           $db->die_json();
   189         
   191         
   190         $rev_count = $db->numrows() - 1;
   192         if ( $db->numrows() > 0 )
   191         $row = $db->fetchrow();
   193         {
   192         $undo_info = array(
   194           echo '<div class="usermessage">' . $lang->get('editor_msg_editing_old_revision') . '</div>';
   193           'old_author'     => $row['oldrev_author'],
   195           
   194           'current_author' => $row['currentrev_author'],
   196           $rev_count = $db->numrows() - 2;
   195           'undo_count'     => $rev_count,
   197           $row = $db->fetchrow();
   196           'last_rev_id'    => $revid
   198           $undo_info = array(
   197         );
   199             'old_author'     => $row['oldrev_author'],
       
   200             'current_author' => $row['currentrev_author'],
       
   201             'undo_count'     => max($rev_count, 1),
       
   202             'last_rev_id'    => $revid
       
   203           );
       
   204         }
       
   205         else
       
   206         {
       
   207           $revid = 0;
       
   208         }
   198         $db->free_result();
   209         $db->free_result();
   199       }
   210       }
   200       echo '
   211       echo '
   201         <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
   212         <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
   202         <br />
   213         <br />