index.php
changeset 408 7ecbe721217c
parent 391 85f91037cd4f
child 411 d1a95497b68f
equal deleted inserted replaced
407:35d94240a197 408:7ecbe721217c
   151         echo '<div class="usermessage">' . $lang->get('editor_err_captcha_wrong') . '</div>';
   151         echo '<div class="usermessage">' . $lang->get('editor_err_captcha_wrong') . '</div>';
   152       }
   152       }
   153       if(isset($_POST['_preview']))
   153       if(isset($_POST['_preview']))
   154       {
   154       {
   155         $text = $_POST['page_text'];
   155         $text = $_POST['page_text'];
       
   156         $edsumm = $_POST['edit_summary'];
   156         echo PageUtils::genPreview($_POST['page_text']);
   157         echo PageUtils::genPreview($_POST['page_text']);
   157         $text = htmlspecialchars($text);
   158         $text = htmlspecialchars($text);
       
   159         $revid = 0;
   158       }
   160       }
   159       else
   161       else
   160       {
   162       {
   161         $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
   163         $revid = ( isset($_GET['revid']) ) ? intval($_GET['revid']) : 0;
       
   164         $page = new PageProcessor($paths->page_id, $paths->namespace, $revid);
       
   165         $text = $page->fetch_source();
       
   166         $edsumm = '';
       
   167         // $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false);
       
   168       }
       
   169       if ( $revid > 0 )
       
   170       {
       
   171         echo '<div class="usermessage">' . $lang->get('editor_msg_editing_old_revision') . '</div>';
       
   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
       
   174   LEFT JOIN ' . table_prefix . 'logs AS l2
       
   175     ON ( l2.time_id = ' . $revid . '
       
   176          AND l2.log_type  = \'page\'
       
   177          AND l2.action    = \'edit\'
       
   178          AND l2.page_id   = \'ACL_Tests\'
       
   179          AND l2.namespace = \'Article\'
       
   180         )
       
   181   WHERE l1.log_type  = \'page\'
       
   182     AND l1.action    = \'edit\'
       
   183     AND l1.page_id   = \'ACL_Tests\'
       
   184     AND l1.namespace = \'Article\'
       
   185     AND l1.time_id >= ' . $revid . '
       
   186   ORDER BY l1.time_id DESC;');
       
   187         if ( !$q )
       
   188           $db->die_json();
       
   189         
       
   190         $rev_count = $db->numrows() - 1;
       
   191         $row = $db->fetchrow();
       
   192         $undo_info = array(
       
   193           'old_author'     => $row['oldrev_author'],
       
   194           'current_author' => $row['currentrev_author'],
       
   195           'undo_count'     => $rev_count,
       
   196           'last_rev_id'    => $revid
       
   197         );
       
   198         $db->free_result();
   162       }
   199       }
   163       echo '
   200       echo '
   164         <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
   201         <form action="'.makeUrl($paths->page, 'do=edit').'" method="post" enctype="multipart/form-data">
   165         <br />
   202         <br />
   166         <textarea name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea><br />
   203         <textarea name="page_text" rows="20" cols="60" style="width: 97%;">'.$text.'</textarea><br />
   167         <br />
   204         <br />
   168         ';
   205         ';
   169       echo $lang->get('editor_lbl_edit_summary') . ' <input name="edit_summary" type="text" size="40" /><br /><label><input type="checkbox" name="minor" /> ' . $lang->get('editor_lbl_minor_edit_field') . '</label><br />';
   206       $edsumm = ( $revid > 0 ) ? $lang->get('editor_reversion_edit_summary', $undo_info) : $edsumm;
       
   207       echo $lang->get('editor_lbl_edit_summary') . ' <input name="edit_summary" type="text" size="40" value="' . htmlspecialchars($edsumm) . '" /><br /><label><input type="checkbox" name="minor" /> ' . $lang->get('editor_lbl_minor_edit_field') . '</label><br />';
   170       if ( !$session->user_logged_in && getConfig('guest_edit_require_captcha') == '1' )
   208       if ( !$session->user_logged_in && getConfig('guest_edit_require_captcha') == '1' )
   171       {
   209       {
   172         echo '<br /><table border="0"><tr><td>';
   210         echo '<br /><table border="0"><tr><td>';
   173         echo '<b>' . $lang->get('editor_lbl_field_captcha') . '</b><br />'
   211         echo '<b>' . $lang->get('editor_lbl_field_captcha') . '</b><br />'
   174              . '<br />'
   212              . '<br />'