Ejemplo n.º 1
0
  * read $_POST variables 
  */
 $name = addslashes($_POST['Name']);
 $type = addslashes($_POST['Type']);
 $template = addslashes($_POST['Template']);
 $content = addslashes($_POST['PageContent']);
 $slug = str_replace(' ', '-', $name);
 $home = (int) @$_POST['Homepage'];
 $navigation = @$_POST['Navigation'] == 1 ? 0 : 1;
 $parent = (int) $_POST['Parent'];
 $perm = addslashes(@$_POST['perm']);
 /**
  * make sure a duplicate pagename isn't being created,
  * or a pagename already used by the system 
  */
 if (in_array($name, pages_array()) == false) {
     /**
      * if page should be new home page then remove
      * home tag from previous home page
      */
     if ($home == 1) {
         query('update ' . DB_PAGES . ' set home=0 where home=1');
     }
     /**
      * save page to database 
      */
     query('insert into ' . DB_PAGES . ' values ("","' . $name . '","' . $content . '","' . $slug . '","' . $template . '","' . $type . '","' . date("Y-m-d\n\t\t") . '","' . $User->name() . '","10000","' . $parent . '","' . $perm . '","' . $home . '","' . $navigation . '")');
     /**
      * clear pages cache and redirect to edit pages
      */
     cache_clear('PAGES');
Ejemplo n.º 2
0
 $type = addslashes($_POST['Type']);
 $template = addslashes($_POST['Template']);
 $content = addslashes($_POST['PageContent']);
 $slug = str_replace(' ', '-', $name);
 $home = (int) @$_POST['Homepage'];
 $navigation = @$_POST['Navigation'] == 1 ? 0 : 1;
 $parent = (int) $_POST['Parent'];
 $perm = addslashes(@$_POST['perm']);
 /**
  * update options if they exist
  */
 update_options(@$_POST['options'], 'page_' . $id);
 /**
  * get pages_array and remove current page
  */
 $pages_array = pages_array();
 unset($pages_array[$id]);
 /**
  * check if pagename exists already or if page name
  * clashes with system pagename
  */
 if (in_array($name, $pages_array) == false) {
     /**
      * if page is set as home page remove home
      * tag from previous home page
      */
     if ($home == 1) {
         query('update ' . DB_PAGES . ' set home=0 where home=1');
     }
     /**
      * update database with edited page