コード例 #1
0
 public static function Instance()
 {
     if (self::$instance == null) {
         self::$instance = new M_Users();
     }
     return self::$instance;
 }
コード例 #2
0
ファイル: C_User.php プロジェクト: EvgeniiZaets/Tempo
 public function action_profile()
 {
     $this->title .= ' profile';
     $this->navbar = '';
     // Получение экземпляра модели.
     $mUsers = M_Users::instance();
     // Проверка авторизации.
     if (!$mUsers->checkAuth()) {
         header("Location: index.php?c=user&act=auth");
         exit;
     }
     if (isset($_GET['cmd']) && $_GET['cmd'] == 'exit') {
         $mUsers->logout();
         header("Location: index.php");
         exit;
     }
     $user = $mUsers->user_get($_COOKIE['id']);
     $this->content = $this->Template('view/v_profile.php', array('user' => $user));
 }
コード例 #3
0
ファイル: C_Item.php プロジェクト: EvgeniiZaets/Tempo
 public function action_add()
 {
     $this->title .= ' add';
     $this->navbar = '';
     // Получение экземпляра модели.
     $mUsers = M_Users::instance();
     // Проверка авторизации.
     if (!$mUsers->checkAuth()) {
         header("Location: index.php?c=user&act=auth");
         exit;
     }
     // Получение экземпляра модели.
     $mItems = M_Items::instance();
     $mCats = M_Categories::instance();
     $categories = $mCats->all_cats_subcats();
     if ($this->IsPost()) {
         if ($mItems->add($category, $_POST['title'], $_POST['desc'], $img)) {
             header("Location: index.php?c=item&act=get&");
             die;
         }
     }
     $categories = $mCats->all_cats_subcats();
     $this->content = $this->Template('view/v_add.php', array('categories' => $categories));
 }