diff -r 000000000000 -r 902822492a68 index.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/index.php Wed Jun 13 16:03:00 2007 -0400 @@ -0,0 +1,425 @@ +The action "'.$_GET['do'].'" is not defined. Return to viewing this page\'s text.

'); + break; + case 'view': + // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false )); + $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace ); + $page->send_headers = true; + $page->send(); + break; + case 'comments': + $template->header(); + $sub = ( isset ($_GET['sub']) ) ? $_GET['sub'] : false; + switch($sub) + { + case 'admin': + default: + $act = ( isset ($_GET['action']) ) ? $_GET['action'] : false; + $id = ( isset ($_GET['id']) ) ? intval($_GET['id']) : -1; + echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace, $act, Array('id'=>$id)); + break; + case 'postcomment': + if(empty($_POST['name']) || + empty($_POST['subj']) || + empty($_POST['text']) + ) { echo 'Invalid request'; break; } + $cid = ( isset($_POST['captcha_id']) ) ? $_POST['captcha_id'] : false; + $cin = ( isset($_POST['captcha_input']) ) ? $_POST['captcha_input'] : false; + PageUtils::addcomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cin, $cid); // All filtering, etc. is handled inside this method + echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace); + break; + case 'editcomment': + if(!isset($_GET['id']) || ( isset($_GET['id']) && !preg_match('#^([0-9]+)$#', $_GET['id']) )) { echo '

Invalid comment ID

'; break; } + $q = $db->sql_query('SELECT subject,comment_data,comment_id FROM '.table_prefix.'comments WHERE comment_id='.$_GET['id']); + if(!$q) $db->_die('The comment data could not be selected.'); + $row = $db->fetchrow(); + $db->free_result(); + echo '
'; + echo "
+ + + +
Subject:
Comment:
"; + echo '
'; + break; + case 'savecomment': + if(empty($_POST['subj']) || empty($_POST['text'])) { echo '

Invalid request

'; break; } + $r = PageUtils::savecomment_neater($paths->cpage['urlname_nons'], $paths->namespace, $_POST['subj'], $_POST['text'], (int)$_POST['id']); + if($r != 'good') { echo "
$r
"; break; } + echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace); + break; + case 'deletecomment': + if(!empty($_GET['id'])) + { + PageUtils::deletecomment_neater($paths->cpage['urlname_nons'], $paths->namespace, (int)$_GET['id']); + } + echo PageUtils::comments_html($paths->cpage['urlname_nons'], $paths->namespace); + break; + } + $template->footer(); + break; + case 'edit': + if(isset($_POST['_cancel'])) { header('Location: '.makeUrl($paths->page)); echo 'Redirecting...If you haven\'t been redirected yet, click here.'; break; } + if(isset($_POST['_save'])) { + $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor'])); + header('Location: '.makeUrl($paths->page)); echo 'Redirecting...If you haven\'t been redirected yet, click here.'; break; + } + $template->header(); + if(isset($_POST['_preview'])) + { + $text = $_POST['page_text']; + echo PageUtils::genPreview($_POST['page_text']); + } + else $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + echo ' +
+
+
+
+ '; + if($paths->wiki_mode) + echo 'Edit summary:

'; + echo '
+ + + + +
+ '; + $template->footer(); + break; + case 'viewsource': + $template->header(); + $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + echo ' +
+
+ '; + echo '
+ +
+ '; + $template->footer(); + break; + case 'history': + $hist = PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace); + $template->header(); + echo $hist; + $template->footer(); + break; + case 'rollback': + $id = (isset($_GET['id'])) ? $_GET['id'] : false; + if(!$id || !preg_match('#^([0-9]+)$#', $id)) die_friendly('Invalid action ID', '

The URL parameter "id" is not an integer. Exiting to prevent nasties like SQL injection, etc.

'); + $rb = PageUtils::rollback( (int) $id ); + $template->header(); + echo '

'.$rb.' Return to the page.

'; + $template->footer(); + break; + case 'catedit': + if(isset($_POST['__enanoSaveButton'])) + { + unset($_POST['__enanoSaveButton']); + $val = PageUtils::catsave($paths->cpage['urlname_nons'], $paths->namespace, $_POST); + if($val == 'GOOD') + { + header('Location: '.makeUrl($paths->page)); echo 'Redirecting...If you haven\'t been redirected yet, click here.'; break; + } else { + die_friendly('Error saving category information', '

'.$val.'

'); + } + } + elseif(isset($_POST['__enanoCatCancel'])) + { + header('Location: '.makeUrl($paths->page)); echo 'Redirecting...If you haven\'t been redirected yet, click here.'; break; + } + $template->header(); + $c = PageUtils::catedit_raw($paths->cpage['urlname_nons'], $paths->namespace); + echo $c[1]; + $template->footer(); + break; + case 'moreoptions': + $template->header(); + echo '
'.$template->tpl_strings['TOOLBAR_EXTRAS'].'
'; + $template->footer(); + break; + case 'protect': + if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '

No protection level specified

'); + if(!empty($_POST['reason'])) + { + if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '

Request validation failed

'); + PageUtils::protect($paths->cpage['urlname_nons'], $paths->namespace, intval($_POST['level']), $_POST['reason']); + die_friendly('Page protected', '

The protection setting has been applied. Return to the page.

'); + } + $template->header(); + ?> +
+ + Error: you must enter a reason for protecting this page.

'; ?> +

Reason for protecting the page:

+


+ Protecion level to be applied: Warning: request validation will fail after clicking submit'; + } + ?>

+

+ + footer(); + break; + case 'rename': + if(!empty($_POST['newname'])) + { + $r = PageUtils::rename($paths->cpage['urlname_nons'], $paths->namespace, $_POST['newname']); + die_friendly('Page renamed', '

'.nl2br($r).' Return to the page.

'); + } + $template->header(); + ?> +
+ Error: you must enter a new name for this page.

'; ?> +

Please enter a new name for this page:

+

+

+
+ footer(); + break; + case 'flushlogs': + if(!$session->get_permissions('clear_logs')) die_friendly('Access denied', '

Flushing the logs for a page requires administrative rights.

'); + if(isset($_POST['_downthejohn'])) + { + $template->header(); + $result = PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); + echo '

'.$result.' Return to the page.

'; + $template->footer(); + break; + } + $template->header(); + ?> +
+

You are about to destroy all logged edits and actions on this page.

+

Unlike deleting or editing this page, this action is not reversible! You should only do this if you are desperate for + database space.

+

Do you really want to continue?

+

+
+ footer(); + break; + case 'delvote': + if(isset($_POST['_ballotbox'])) + { + $template->header(); + $result = PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); + echo '

'.$result.' Return to the page.

'; + $template->footer(); + break; + } + $template->header(); + ?> +
+

Your vote counts.

+

If you think that this page is not relavent to the content on this site, or if it looks like this page was only created in + an attempt to spam the site, you can request that this page be deleted by an administrator.

+

After you vote, you should leave a comment explaining the reason for your vote, especially if you are the first person to + vote against this page.

+

So far, cpage['delvotes'] == 1 ) ? $paths->cpage['delvotes'] . ' person has' : $paths->cpage['delvotes'] . ' people have'; ?> voted to delete this page.

+

+
+ footer(); + break; + case 'resetvotes': + if(!$session->get_permissions('vote_reset')) die_friendly('Access denied', '

Resetting the deletion votes against this page requires admin rights.

'); + if(isset($_POST['_youmaylivealittlelonger'])) + { + $template->header(); + $result = PageUtils::resetdelvotes($paths->cpage['urlname_nons'], $paths->namespace); + echo '

'.$result.' Return to the page.

'; + $template->footer(); + break; + } + $template->header(); + ?> +
+

This action will reset the number of votes against this page to zero. Are you sure you want to do this?

+

+
+ footer(); + break; + case 'deletepage': + if(!$session->get_permissions('delete_page')) die_friendly('Access denied', '

Deleting pages requires admin rights.

'); + if(isset($_POST['_adiossucker'])) + { + $template->header(); + $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace); + echo '

'.$result.' Return to the page.

'; + $template->footer(); + break; + } + $template->header(); + ?> +
+

You are about to destroy this page.

+

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.

+

Are you absolutely sure that you want to continue?
+ You will not be asked again.

+

+
+ footer(); + break; + case 'setwikimode': + if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '

Changing the wiki mode setting requires admin rights.

'); + if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '

Level not specified

'); + $template->header(); + $template->footer(); + break; + case 'diff': + $template->header(); + $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false; + $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false; + if(!$id1 || !$id2) { echo '

Invalid request.

'; $template->footer(); break; } + if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) || + !preg_match('#^([0-9]+)$#', (string)$_GET['diff2'] )) { echo '

SQL injection attempt

'; $template->footer(); break; } + echo PageUtils::pagediff($paths->cpage['urlname_nons'], $paths->namespace, $id1, $id2); + $template->footer(); + break; + case 'aclmanager': + $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups'); + PageUtils::aclmanager($data); + break; + } + + // + // Optimize HTML by replacing newlines with spaces (excludes
,