Esempio n. 1
0
 public function postSave()
 {
     $user = ClientUser::getInstance();
     if (!$user->isAdmin()) {
         return $this->get();
     }
     $page_id = Request::post('page_id', 'int');
     $title = Request::post('title');
     $url = Request::post('url', 'url');
     // Create an array of the new values.
     $new_values = array('title' => $title, 'url' => !empty($url) ? $url : Scrub::url($title), 'keywords' => Request::post('keywords'), 'description' => Request::post('description'), 'site_map' => Request::post('sitemap', 'int'), 'body' => Request::post('page_body', 'html', '', '', true), 'last_update' => time(), 'layout' => Request::post('layout', 'int'));
     // Save the page.
     if ($page_id != 0) {
         Database::getInstance()->update('page', $new_values, array('page_id' => $page_id));
     } else {
         $page_id = Database::getInstance()->insert('page', $new_values);
     }
     $output = array();
     $output['url'] = $new_values['url'];
     $output['page_id'] = $page_id;
     $output['title'] = $title;
     Output::json($output);
 }
Esempio n. 2
0
 function categories_list()
 {
     $list = $this->allCategories();
     if ($list->rowCount() > 0) {
         echo "<ul>";
         foreach ($list as $r) {
             echo "<li><a href='/category/" . Scrub::url($r['category']) . ".htm'>{$r['category']}</a> ({$r['count']})</li>";
         }
         echo "</ul>";
     }
 }