equal
deleted
inserted
replaced
17 */ |
17 */ |
18 |
18 |
19 define('ENANO_INTERFACE_INDEX', ''); |
19 define('ENANO_INTERFACE_INDEX', ''); |
20 |
20 |
21 // For the mighty and brave. |
21 // For the mighty and brave. |
22 // define('ENANO_DEBUG', ''); |
22 define('ENANO_DEBUG', ''); |
23 |
23 |
24 // Set up gzip encoding before any output is sent |
24 // Set up gzip encoding before any output is sent |
25 |
25 |
26 $aggressive_optimize_html = false; |
26 $aggressive_optimize_html = false; |
27 |
27 |
63 $page->send(true); |
63 $page->send(true); |
64 $page_timestamp = $page->revision_time; |
64 $page_timestamp = $page->revision_time; |
65 break; |
65 break; |
66 case 'comments': |
66 case 'comments': |
67 $template->header(); |
67 $template->header(); |
|
68 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
68 $sub = ( isset ($_GET['sub']) ) ? $_GET['sub'] : false; |
69 $sub = ( isset ($_GET['sub']) ) ? $_GET['sub'] : false; |
69 switch($sub) |
70 switch($sub) |
70 { |
71 { |
71 case 'admin': |
72 case 'admin': |
72 default: |
73 default: |
119 if(isset($_POST['_cancel'])) |
120 if(isset($_POST['_cancel'])) |
120 { |
121 { |
121 redirect(makeUrl($paths->page), '', '', 0); |
122 redirect(makeUrl($paths->page), '', '', 0); |
122 break; |
123 break; |
123 } |
124 } |
|
125 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
124 if(isset($_POST['_save'])) |
126 if(isset($_POST['_save'])) |
125 { |
127 { |
126 $captcha_valid = true; |
128 $captcha_valid = true; |
127 if ( !$session->user_logged_in && getConfig('guest_edit_require_captcha') == '1' ) |
129 if ( !$session->user_logged_in && getConfig('guest_edit_require_captcha') == '1' ) |
128 { |
130 { |
256 </form> |
258 </form> |
257 '; |
259 '; |
258 $template->footer(); |
260 $template->footer(); |
259 break; |
261 break; |
260 case 'history': |
262 case 'history': |
|
263 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
261 $hist = PageUtils::histlist($paths->page_id, $paths->namespace); |
264 $hist = PageUtils::histlist($paths->page_id, $paths->namespace); |
262 $template->header(); |
265 $template->header(); |
263 echo $hist; |
266 echo $hist; |
264 $template->footer(); |
267 $template->footer(); |
265 break; |
268 break; |
284 $template->header(); |
287 $template->header(); |
285 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a></p>'; |
288 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a></p>'; |
286 $template->footer(); |
289 $template->footer(); |
287 break; |
290 break; |
288 case 'catedit': |
291 case 'catedit': |
|
292 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
289 if(isset($_POST['__enanoSaveButton'])) |
293 if(isset($_POST['__enanoSaveButton'])) |
290 { |
294 { |
291 unset($_POST['__enanoSaveButton']); |
295 unset($_POST['__enanoSaveButton']); |
292 $val = PageUtils::catsave($paths->page_id, $paths->namespace, $_POST); |
296 $val = PageUtils::catsave($paths->page_id, $paths->namespace, $_POST); |
293 if($val == 'GOOD') |
297 if($val == 'GOOD') |
311 echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">' . $lang->get('ajax_lbl_moreoptions_nojs') . '</div><div style="clear: both;"></div></li>'.$template->toolbar_menu.'</ul></div>'; |
315 echo '<div class="menu_nojs" style="width: 150px; padding: 0;"><ul style="display: block;"><li><div class="label">' . $lang->get('ajax_lbl_moreoptions_nojs') . '</div><div style="clear: both;"></div></li>'.$template->toolbar_menu.'</ul></div>'; |
312 $template->footer(); |
316 $template->footer(); |
313 break; |
317 break; |
314 case 'protect': |
318 case 'protect': |
315 if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '<p>No protection level specified</p>'); |
319 if (!isset($_REQUEST['level'])) die_friendly('Invalid request', '<p>No protection level specified</p>'); |
|
320 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
316 if(!empty($_POST['reason'])) |
321 if(!empty($_POST['reason'])) |
317 { |
322 { |
318 if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>'); |
323 if(!preg_match('#^([0-2]*){1}$#', $_POST['level'])) die_friendly('Error protecting page', '<p>Request validation failed</p>'); |
319 PageUtils::protect($paths->page_id, $paths->namespace, intval($_POST['level']), $_POST['reason']); |
324 PageUtils::protect($paths->page_id, $paths->namespace, intval($_POST['level']), $_POST['reason']); |
320 |
325 |
347 </form> |
352 </form> |
348 <?php |
353 <?php |
349 $template->footer(); |
354 $template->footer(); |
350 break; |
355 break; |
351 case 'rename': |
356 case 'rename': |
|
357 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
352 if(!empty($_POST['newname'])) |
358 if(!empty($_POST['newname'])) |
353 { |
359 { |
354 $r = PageUtils::rename($paths->page_id, $paths->namespace, $_POST['newname']); |
360 $r = PageUtils::rename($paths->page_id, $paths->namespace, $_POST['newname']); |
355 die_friendly($lang->get('page_rename_success_title'), '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'); |
361 die_friendly($lang->get('page_rename_success_title'), '<p>'.nl2br($r).' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'); |
356 } |
362 } |
368 case 'flushlogs': |
374 case 'flushlogs': |
369 if(!$session->get_permissions('clear_logs')) |
375 if(!$session->get_permissions('clear_logs')) |
370 { |
376 { |
371 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
377 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
372 } |
378 } |
|
379 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
373 if(isset($_POST['_downthejohn'])) |
380 if(isset($_POST['_downthejohn'])) |
374 { |
381 { |
375 $template->header(); |
382 $template->header(); |
376 $result = PageUtils::flushlogs($paths->page_id, $paths->namespace); |
383 $result = PageUtils::flushlogs($paths->page_id, $paths->namespace); |
377 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
384 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
386 </form> |
393 </form> |
387 <?php |
394 <?php |
388 $template->footer(); |
395 $template->footer(); |
389 break; |
396 break; |
390 case 'delvote': |
397 case 'delvote': |
|
398 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
391 if(isset($_POST['_ballotbox'])) |
399 if(isset($_POST['_ballotbox'])) |
392 { |
400 { |
393 $template->header(); |
401 $template->header(); |
394 $result = PageUtils::delvote($paths->page_id, $paths->namespace); |
402 $result = PageUtils::delvote($paths->page_id, $paths->namespace); |
395 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
403 echo '<p>'.$result.' <a href="'.makeUrl($paths->page).'">' . $lang->get('etc_return_to_page') . '</a>.</p>'; |
414 </form> |
422 </form> |
415 <?php |
423 <?php |
416 $template->footer(); |
424 $template->footer(); |
417 break; |
425 break; |
418 case 'resetvotes': |
426 case 'resetvotes': |
|
427 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
419 if(!$session->get_permissions('vote_reset')) |
428 if(!$session->get_permissions('vote_reset')) |
420 { |
429 { |
421 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
430 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
422 } |
431 } |
423 if(isset($_POST['_youmaylivealittlelonger'])) |
432 if(isset($_POST['_youmaylivealittlelonger'])) |
440 case 'deletepage': |
449 case 'deletepage': |
441 if(!$session->get_permissions('delete_page')) |
450 if(!$session->get_permissions('delete_page')) |
442 { |
451 { |
443 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
452 die_friendly($lang->get('etc_access_denied_short'), '<p>' . $lang->get('etc_access_denied') . '</p>'); |
444 } |
453 } |
|
454 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
445 if(isset($_POST['_adiossucker'])) |
455 if(isset($_POST['_adiossucker'])) |
446 { |
456 { |
447 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
457 $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; |
448 if ( empty($reason) ) |
458 if ( empty($reason) ) |
449 $error = $lang->get('ajax_delete_prompt_reason'); |
459 $error = $lang->get('ajax_delete_prompt_reason'); |
507 echo '</form>'; |
517 echo '</form>'; |
508 $template->footer(); |
518 $template->footer(); |
509 } |
519 } |
510 break; |
520 break; |
511 case 'diff': |
521 case 'diff': |
|
522 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
|
523 require_once(ENANO_ROOT.'/includes/diff.php'); |
512 $template->header(); |
524 $template->header(); |
513 $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false; |
525 $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false; |
514 $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false; |
526 $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false; |
515 if(!$id1 || !$id2) { echo '<p>Invalid request.</p>'; $template->footer(); break; } |
527 if(!$id1 || !$id2) { echo '<p>Invalid request.</p>'; $template->footer(); break; } |
516 if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) || |
528 if(!preg_match('#^([0-9]+)$#', (string)$_GET['diff1']) || |
531 if ( !$q ) |
543 if ( !$q ) |
532 $db->_die('Detag query, index.php:'.__LINE__); |
544 $db->_die('Detag query, index.php:'.__LINE__); |
533 die_friendly($lang->get('page_detag_success_title'), '<p>' . $lang->get('page_detag_success_body') . '</p>'); |
545 die_friendly($lang->get('page_detag_success_title'), '<p>' . $lang->get('page_detag_success_body') . '</p>'); |
534 break; |
546 break; |
535 case 'aclmanager': |
547 case 'aclmanager': |
|
548 require_once(ENANO_ROOT.'/includes/pageutils.php'); |
536 $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups'); |
549 $data = ( isset($_POST['data']) ) ? $_POST['data'] : Array('mode' => 'listgroups'); |
537 PageUtils::aclmanager($data); |
550 PageUtils::aclmanager($data); |
538 break; |
551 break; |
539 case 'sql_report': |
552 case 'sql_report': |
540 $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 ); |
553 $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 ); |