ajax.php
changeset 21 663fcf528726
parent 16 64e0d3d4cf14
child 22 d0314575e2f0
equal deleted inserted replaced
20:40105681f495 21:663fcf528726
     1 <?php
     1 <?php
     2 /*
     2 /*
     3  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     3  * Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
     4  * Version 1.0 release candidate 3 (Druid)
     4  * Version 1.0 (Banshee)
     5  * Copyright (C) 2006-2007 Dan Fuhry
     5  * Copyright (C) 2006-2007 Dan Fuhry
     6  *
     6  *
     7  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     7  * This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
     8  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     8  * as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
     9  *
     9  *
    26       $p = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
    26       $p = ( isset($_GET['pagepass']) ) ? $_GET['pagepass'] : false;
    27       echo PageUtils::getsource($paths->page, $p);
    27       echo PageUtils::getsource($paths->page, $p);
    28       break;
    28       break;
    29     case "getpage":
    29     case "getpage":
    30       // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    30       // echo PageUtils::getpage($paths->page, false, ( (isset($_GET['oldid'])) ? $_GET['oldid'] : false ));
    31       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace );
    31       $revision_id = ( (isset($_GET['oldid'])) ? intval($_GET['oldid']) : 0 );
       
    32       $page = new PageProcessor( $paths->cpage['urlname_nons'], $paths->namespace, $revision_id );
    32       $page->send();
    33       $page->send();
    33       break;
    34       break;
    34     case "savepage":
    35     case "savepage":
    35       $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
    36       $summ = ( isset($_POST['summary']) ) ? $_POST['summary'] : '';
    36       $minor = isset($_POST['minor']);
    37       $minor = isset($_POST['minor']);
    52       echo PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace);
    53       echo PageUtils::histlist($paths->cpage['urlname_nons'], $paths->namespace);
    53       break;
    54       break;
    54     case "rollback":
    55     case "rollback":
    55       echo PageUtils::rollback( (int)$_GET['id'] );
    56       echo PageUtils::rollback( (int)$_GET['id'] );
    56       break;
    57       break;
    57       
       
    58       /*
       
    59        * This is old code and should not be used. It's badly broken and a perfect example of bad database organization.
       
    60        
       
    61     case "addcomment":
       
    62       $cc = ( isset($_POST['captcha_code']) ) ? $_POST['captcha_code'] : false;
       
    63       $ci = ( isset($_POST['captcha_id']  ) ) ? $_POST['captcha_id']   : false;
       
    64       if(!isset($_POST['text']) ||
       
    65          !isset($_POST['subj']) ||
       
    66          !isset($_POST['name'])) die('alert(\'Error in POST DATA string, aborting\');');
       
    67       if($_POST['text']=='' ||
       
    68          $_POST['name']=='' ||
       
    69          $_POST['subj']=='') die('alert(\'One or more POST DATA fields was empty, aborting post submission\')');
       
    70      echo PageUtils::addcomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $cc, $ci);
       
    71      break;
       
    72     case "comments":
       
    73       echo PageUtils::comments($paths->cpage['urlname_nons'], $paths->namespace, ( isset($_GET['action']) ? $_GET['action'] : false ), Array(
       
    74           'name' => ( isset($_POST['name']) ) ? $_POST['name'] : '',
       
    75           'subj' => ( isset($_POST['subj']) ) ? $_POST['subj'] : '',
       
    76           'text' => ( isset($_POST['text']) ) ? $_POST['text'] : ''
       
    77         ));
       
    78       break;
       
    79     case "savecomment":
       
    80       echo PageUtils::savecomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['s'], $_POST['t'], $_POST['os'], $_POST['ot'], $_POST['id']);
       
    81       break;
       
    82     case "deletecomment":
       
    83       echo PageUtils::deletecomment($paths->cpage['urlname_nons'], $paths->namespace, $_POST['name'], $_POST['subj'], $_POST['text'], $_GET['id']);
       
    84       break;
       
    85       */
       
    86       
       
    87     case "comments":
    58     case "comments":
    88       $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
    59       $comments = new Comments($paths->cpage['urlname_nons'], $paths->namespace);
    89       if ( isset($_POST['data']) )
    60       if ( isset($_POST['data']) )
    90       {
    61       {
    91         $comments->process_json($_POST['data']);
    62         $comments->process_json($_POST['data']);