# HG changeset patch # User Dan # Date 1260653027 18000 # Node ID 9c0c519066acb8c3758a22d5ee6af1d38d2f0dce # Parent c0e0a1787a635b2ad00f8ec4e05479c1f57cdfe0 Drafts saved on nonexistent pages now show up. Fixes issue 7. diff -r c0e0a1787a63 -r 9c0c519066ac ajax.php --- a/ajax.php Sat Dec 12 15:44:36 2009 -0500 +++ b/ajax.php Sat Dec 12 16:23:47 2009 -0500 @@ -33,8 +33,12 @@ $page->password = $password; $have_draft = false; - if ( $src = $page->fetch_source() ) + // Kinda hacky fix for issue 7: draft restore not offered for nonexistent pages + if ( $src = $page->fetch_source() || !$page->exists() ) { + if ( !$page->exists() ) + $src = ''; + $allowed = true; $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\' AND page_id = \'' . $db->escape($paths->page_id) . '\'