--- a/ajax.php Wed Jun 27 00:59:42 2007 -0400
+++ b/ajax.php Wed Jun 27 12:09:02 2007 -0400
@@ -73,7 +73,10 @@
echo PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace);
break;
case "deletepage":
- echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace);
+ $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
+ if ( empty($reason) )
+ die('Please enter a reason for deleting this page.');
+ echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
break;
case "delvote":
echo PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace);
--- a/includes/clientside/static/ajax.js Wed Jun 27 00:59:42 2007 -0400
+++ b/includes/clientside/static/ajax.js Wed Jun 27 12:09:02 2007 -0400
@@ -226,12 +226,18 @@
}
function ajaxDeletePage() {
+ var reason = prompt('Please enter you reason for deleting this page.');
+ if ( !reason || reason == '' )
+ {
+ return false;
+ }
c = confirm('You are about to DESTROY this page. Do you REALLY want to do this?');
- if(!c) return;
- c = confirm('You\'re ABSOLUTELY sure???');
- if(!c) return;
+ if(!c)
+ {
+ return;
+ }
setAjaxLoading();
- ajaxGet(stdAjaxPrefix+'&_mode=deletepage', function() {
+ ajaxPost(stdAjaxPrefix+'&_mode=deletepage', 'reason=' + escape(reason), function() {
if(ajax.readyState == 4) {
unsetAjaxLoading();
alert(ajax.responseText);
--- a/includes/pageprocess.php Wed Jun 27 00:59:42 2007 -0400
+++ b/includes/pageprocess.php Wed Jun 27 12:09:02 2007 -0400
@@ -752,6 +752,12 @@
echo '<tr><td class="'.$class.'">Enjoys: ' . htmlspecialchars($userdata['user_hobbies']) . '</td></tr>';
}
+ if ( empty($userdata['user_location']) && empty($userdata['user_job']) && empty($userdata['user_hobbies']) )
+ {
+ $class = ( $class == 'row1' ) ? 'row3' : 'row1';
+ echo '<tr><td class="'.$class.'">' . htmlspecialchars($target_username) . ' hasn\'t posted any real-life contact information.</td></tr>';
+ }
+
echo ' </table>
</div>';
@@ -865,7 +871,7 @@
if ( $db->numrows() > 0 )
{
$r = $db->fetchrow();
- echo '<p>This page also appears to have some log entries in the database - it seems that it was deleted on ' . $r['date_string'] . '. You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
+ echo '<p><b>This page was deleted on ' . $r['date_string'] . '.</b> The stated reason was:</p><blockquote>' . $r['edit_summary'] . '</blockquote><p>You can probably <a href="'.makeUrl($paths->page, 'do=rollback&id='.$r['time_id']).'" onclick="ajaxRollback(\''.$r['time_id'].'\'); return false;">roll back</a> the deletion.</p>';
}
$db->free_result();
}
--- a/includes/pageutils.php Wed Jun 27 00:59:42 2007 -0400
+++ b/includes/pageutils.php Wed Jun 27 12:09:02 2007 -0400
@@ -613,7 +613,7 @@
elseif($r['action']=='semiprot') echo 'Semi-protected page</td><td class="'.$cls.'">Reason: '.$r['edit_summary'];
elseif($r['action']=='rename') echo 'Renamed page</td><td class="'.$cls.'">Old title: '.$r['edit_summary'];
elseif($r['action']=='create') echo 'Created page</td><td class="'.$cls.'">';
- elseif($r['action']=='delete') echo 'Deleted page</td><td class="'.$cls.'">';
+ elseif($r['action']=='delete') echo 'Deleted page</td><td class="'.$cls.'">Reason: '.$r['edit_summary'];
elseif($r['action']=='reupload') echo 'Uploaded new file version</td><td class="'.$cls.'">Reason: '.$r['edit_summary'];
echo '</td>';
@@ -1253,17 +1253,23 @@
/**
* Deletes a page.
- * @param $page_id the condemned page ID
- * @param $namespace the condemned namespace
+ * @param string $page_id the condemned page ID
+ * @param string $namespace the condemned namespace
+ * @param string The reason for deleting the page in question
* @return string
*/
- function deletepage($page_id, $namespace)
+ function deletepage($page_id, $namespace, $reason)
{
global $db, $session, $paths, $template, $plugins; // Common objects
$perms = $session->fetch_page_acl($page_id, $namespace);
- if(!$perms->get_permissions('delete_page')) die('Administrative privileges are required to delete pages, you loser.');
- $e = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'delete\', \''.$page_id.'\', \''.$namespace.'\', \''.$session->username.'\')');
+ $x = trim($reason);
+ if ( empty($x) )
+ {
+ return 'Invalid reason for deletion passed';
+ }
+ if(!$perms->get_permissions('delete_page')) return('Administrative privileges are required to delete pages, you loser.');
+ $e = $db->sql_query('INSERT INTO '.table_prefix.'logs(time_id,date_string,log_type,action,page_id,namespace,author,edit_summary) VALUES('.time().', \''.date('d M Y h:i a').'\', \'page\', \'delete\', \''.$page_id.'\', \''.$namespace.'\', \''.$session->username.'\', \'' . $db->escape(htmlspecialchars($reason)) . '\')');
if(!$e) $db->_die('The page log entry could not be inserted.');
$e = $db->sql_query('DELETE FROM '.table_prefix.'categories WHERE page_id=\''.$page_id.'\' AND namespace=\''.$namespace.'\'');
if(!$e) $db->_die('The page categorization entries could not be deleted.');
--- a/index.php Wed Jun 27 00:59:42 2007 -0400
+++ b/index.php Wed Jun 27 12:09:02 2007 -0400
@@ -311,11 +311,17 @@
if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '<p>Deleting pages <u>requires</u> admin rights.</p>');
if(isset($_POST['_adiossucker']))
{
- $template->header();
- $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace);
- echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
- $template->footer();
- break;
+ $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false;
+ if ( empty($reason) )
+ $error = 'Please enter a reason for deleting this page.';
+ else
+ {
+ $template->header();
+ $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason);
+ echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">Return to the page</a>.</p>';
+ $template->footer();
+ break;
+ }
}
$template->header();
?>
@@ -324,6 +330,8 @@
<p>While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.</p>
<p>Are you <u>absolutely sure</u> that you want to continue?<br />
You will not be asked again.</p>
+ <?php if ( isset($error) ) echo "<p>$error</p>"; ?>
+ <p>Reason for deleting: <input type="text" name="reason" size="50" /></p>
<p><input type="submit" name="_adiossucker" value="Delete this page" style="color: red; font-weight: bold;" /></p>
</form>
<?php