343 <?php |
343 <?php |
344 $template->footer(); |
344 $template->footer(); |
345 break; |
345 break; |
346 case 'setwikimode': |
346 case 'setwikimode': |
347 if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '<p>Changing the wiki mode setting <u>requires</u> admin rights.</p>'); |
347 if(!$session->get_permissions('set_wiki_mode')) die_friendly('Access denied', '<p>Changing the wiki mode setting <u>requires</u> admin rights.</p>'); |
348 if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '<p>Level not specified</p>'); |
348 if ( isset($_POST['finish']) ) |
349 $template->header(); |
349 { |
350 $template->footer(); |
350 $level = intval($_POST['level']); |
|
351 if ( !in_array($level, array(0, 1, 2) ) ) |
|
352 { |
|
353 die_friendly('Invalid request', '<p>Level not specified</p>'); |
|
354 } |
|
355 $q = $db->sql_query('UPDATE '.table_prefix.'pages SET wiki_mode=' . $level . ' WHERE urlname=\'' . $db->escape($paths->cpage['urlname_nons']) . '\' AND namespace=\'' . $paths->namespace . '\';'); |
|
356 if ( !$q ) |
|
357 $db->_die(); |
|
358 redirect(makeUrl($paths->page), htmlspecialchars($paths->cpage['name']), 'Wiki mode for this page has been set. Redirecting you to the page...', 2); |
|
359 } |
|
360 else |
|
361 { |
|
362 $template->header(); |
|
363 if(!isset($_GET['level']) || ( isset($_GET['level']) && !preg_match('#^([0-9])$#', $_GET['level']))) die_friendly('Invalid request', '<p>Level not specified</p>'); |
|
364 $level = intval($_GET['level']); |
|
365 if ( !in_array($level, array(0, 1, 2) ) ) |
|
366 { |
|
367 die_friendly('Invalid request', '<p>Level not specified</p>'); |
|
368 } |
|
369 echo '<form action="' . makeUrl($paths->page, 'do=setwikimode', true) . '" method="post">'; |
|
370 echo '<input type="hidden" name="finish" value="foo" />'; |
|
371 echo '<input type="hidden" name="level" value="' . $level . '" />'; |
|
372 $level_txt = ( $level == 0 ) ? 'disabled' : ( ( $level == 1 ) ? 'enabled' : 'use the global setting' ); |
|
373 $blurb = ( $level == 0 || ( $level == 2 && getConfig('wiki_mode') != '1' ) ) ? 'Because this will disable the wiki behavior on this page, several features, most |
|
374 notably the ability for users to vote to have this page deleted, will be disabled as they are not relevant to non-wiki pages. In addition, users will not be able |
|
375 to edit this page unless an ACL rule specifically permits them.' : 'Because this will enable the wiki behavior on this page, users will gain the ability to |
|
376 freely edit this page unless an ACL rule specifically denies them. If your site is public and gets good traffic, you should be aware of the possiblity of vandalism, and you need to be ready to revert |
|
377 malicious edits to this page.'; |
|
378 ?> |
|
379 <h3>You are changing wiki mode for this page.</h3> |
|
380 <p>Wiki features will be set to <?php echo $level_txt; ?>. <?php echo $blurb; ?></p> |
|
381 <p>If you want to continue, please click the button below.</p> |
|
382 <p><input type="submit" value="Set wiki mode" /></p> |
|
383 <?php |
|
384 echo '</form>'; |
|
385 $template->footer(); |
|
386 } |
351 break; |
387 break; |
352 case 'diff': |
388 case 'diff': |
353 $template->header(); |
389 $template->header(); |
354 $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false; |
390 $id1 = ( isset($_GET['diff1']) ) ? (int)$_GET['diff1'] : false; |
355 $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false; |
391 $id2 = ( isset($_GET['diff2']) ) ? (int)$_GET['diff2'] : false; |