Esempio n. 1
0
 public static function category_load($id)
 {
     if (empty($id)) {
         $category = array();
         $flash = new Flash();
         $flash->flash('flash_message', 'Category does not exist!', 'warning');
         header("Location: " . BASE_URL . '/404');
     } else {
         $category = db_select_row("SELECT * FROM category where id ='" . $id . "'");
         if (empty($category)) {
             $flash = new Flash();
             $flash->flash('flash_message', 'Category does not exist!', 'warning');
             header("Location: " . BASE_URL . '/404');
         }
     }
     return $category;
 }
Esempio n. 2
0
 public static function navigation_load($id)
 {
     if (empty($id)) {
         $navigation = array();
         $flash = new Flash();
         $flash->flash('flash_message', 'Navigation item does not exist!', 'warning');
         header("Location: " . BASE_URL . '/404');
     } else {
         $navigation = db_select_row("SELECT * FROM navigation where id ='" . $id . "'");
         if (empty($navigation)) {
             $flash = new Flash();
             $flash->flash('flash_message', 'Navigation item does not exist!', 'warning');
             header("Location: " . BASE_URL . '/404');
         }
     }
     return $navigation;
 }
Esempio n. 3
0
 public static function post_load($id)
 {
     if (empty($id)) {
         $post = array();
         $flash = new Flash();
         $flash->flash('flash_message', 'Post does not exist!', 'warning');
         header("Location: " . BASE_URL);
     } else {
         $post = db_select_row("SELECT * FROM post WHERE id = " . $id);
         if (empty($post)) {
             $flash = new Flash();
             $flash->flash('flash_message', 'Post does not exist!', 'warning');
             header("Location: " . BASE_URL);
         }
     }
     return $post;
 }
Esempio n. 4
0
 public static function user_load($id)
 {
     if (empty($id)) {
         $user = array();
         $flash = new Flash();
         $flash->flash('flash_message', 'User does not exist!', 'danger');
         header("Location: " . BASE_URL . '/404');
     } else {
         $user = db_select_row("SELECT * FROM user where id ='" . $id . "'");
         if (empty($user)) {
             $flash = new Flash();
             $flash->flash('flash_message', 'User does not exist!', 'danger');
             header("Location: " . BASE_URL . '/404');
         }
     }
     return $user;
 }
Esempio n. 5
0
<?php

foreach ($_POST['item'] as $key => $value) {
    $navigation = db_select_row("SELECT * FROM navigation WHERE id = " . $value . ";");
    $navigation['position'] = $key + 1;
    db_query("UPDATE " . MYSQL_DB . ".navigation SET position = '" . $navigation['position'] . "' WHERE id = " . $navigation['id'] . ";");
}