index.php
changeset 228 7846d45bd250
parent 205 62ee6685ad18
child 229 b2f985e4cef3
equal deleted inserted replaced
227:0f039028f7a5 228:7846d45bd250
    52   
    52   
    53   if(!isset($_GET['do'])) $_GET['do'] = 'view';
    53   if(!isset($_GET['do'])) $_GET['do'] = 'view';
    54   switch($_GET['do'])
    54   switch($_GET['do'])
    55   {
    55   {
    56     default:
    56     default:
    57       die_friendly('Invalid action', '<p>The action "'.$_GET['do'].'" is not defined. Return to <a href="'.makeUrl($paths->page).'">viewing this page\'s text</a>.</p>');
    57       die_friendly('Invalid action', '<p>The action "'.htmlspecialchars($_GET['do']).'" is not defined. Return to <a href="'.makeUrl($paths->page).'">viewing this page\'s text</a>.</p>');
    58       break;
    58       break;
    59     case 'view':
    59     case 'view':
    60       // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    60       // echo PageUtils::getpage($paths->page, true, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    61       $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
    61       $rev_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
    62       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $rev_id );
    62       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $rev_id );
   115           break;
   115           break;
   116       }
   116       }
   117       $template->footer();
   117       $template->footer();
   118       break;
   118       break;
   119     case 'edit':
   119     case 'edit':
   120       if(isset($_POST['_cancel'])) { header('Location: '.makeUrl($paths->page)); echo '<html><head><title>Redirecting...</title></head><body>If you haven\'t been redirected yet, <a href="'.makeUrl($paths->page).'">click here</a>.'; break; }
   120       if(isset($_POST['_cancel']))
   121       if(isset($_POST['_save'])) {
   121       {
       
   122         redirect(makeUrl($paths->page), '', '', 0);
       
   123         break;
       
   124       }
       
   125       if(isset($_POST['_save']))
       
   126       {
   122         $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor']));
   127         $e = PageUtils::savepage($paths->cpage['urlname_nons'], $paths->namespace, $_POST['page_text'], $_POST['edit_summary'], isset($_POST['minor']));
   123         header('Location: '.makeUrl($paths->page)); echo '<html><head><title>Redirecting...</title></head><body>If you haven\'t been redirected yet, <a href="'.makeUrl($paths->page).'">click here</a>.'; break;
   128         if ( $e == 'good' )
       
   129         {
       
   130           redirect(makeUrl($paths->page), 'Changes saved', 'Your changes to this page have been saved. Redirecting...', 3);
       
   131         }
   124       }
   132       }
   125       $template->header();
   133       $template->header();
   126       if(isset($_POST['_preview']))
   134       if(isset($_POST['_preview']))
   127       {
   135       {
   128         $text = $_POST['page_text'];
   136         $text = $_POST['page_text'];