ajax.php
changeset 1161 9c0c519066ac
parent 1108 c1be67a50d81
child 1162 daa091452877
equal deleted inserted replaced
1160:c0e0a1787a63 1161:9c0c519066ac
    31       $revid = ( isset($_GET['revid']) ) ? intval($_GET['revid']) : 0;
    31       $revid = ( isset($_GET['revid']) ) ? intval($_GET['revid']) : 0;
    32       $page = new PageProcessor($paths->page_id, $paths->namespace, $revid);
    32       $page = new PageProcessor($paths->page_id, $paths->namespace, $revid);
    33       $page->password = $password;
    33       $page->password = $password;
    34       
    34       
    35       $have_draft = false;
    35       $have_draft = false;
    36       if ( $src = $page->fetch_source() )
    36       // Kinda hacky fix for issue 7: draft restore not offered for nonexistent pages
    37       {
    37       if ( $src = $page->fetch_source() || !$page->exists() )
       
    38       {
       
    39         if ( !$page->exists() )
       
    40           $src = '';
       
    41         
    38         $allowed = true;
    42         $allowed = true;
    39         $q = $db->sql_query('SELECT author, time_id, page_text, edit_summary, page_format FROM ' . table_prefix . 'logs WHERE log_type = \'page\' AND action = \'edit\'
    43         $q = $db->sql_query('SELECT author, time_id, page_text, edit_summary, page_format FROM ' . table_prefix . 'logs WHERE log_type = \'page\' AND action = \'edit\'
    40                                AND page_id = \'' . $db->escape($paths->page_id) . '\'
    44                                AND page_id = \'' . $db->escape($paths->page_id) . '\'
    41                                AND namespace = \'' . $db->escape($paths->namespace) . '\'
    45                                AND namespace = \'' . $db->escape($paths->namespace) . '\'
    42                                AND is_draft = 1;');
    46                                AND is_draft = 1;');