示例#1
0
 private function handle($col)
 {
     $globalDAO = new GlobalDAO(DataSource::getInstance());
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $content = trim(remove_slashes($_POST['content']));
         if ($globalDAO->update($col, $content)) {
             $message = array('type' => 'info', 'value' => 'Lưu thành công.');
         } else {
             $message = array('type' => 'error', 'value' => 'Có lỗi xảy ra!');
         }
         $this->registry->template->message = $message;
         $this->registry->template->content = $content;
         $tmp = $globalDAO->select($col);
         $this->registry->template->content_backup = $tmp;
     } else {
         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
             $tmp = $globalDAO->select($col);
             $this->registry->template->content = $tmp;
             $this->registry->template->content_backup = $tmp;
         }
     }
     if ($col == 'about') {
         $s = '“Giới thiệu”';
     } else {
         if ($col == 'contact') {
             $s = '“Liên hệ”';
         }
     }
     $this->registry->template->tile_title = 'Soạn thảo trang ' . $s;
     $this->registry->template->tile_content = 'admin/compose.php';
     $this->registry->template->show('admin/layout/admin.php');
 }
示例#2
0
 public function index()
 {
     if (empty($_GET['seo_url'])) {
         $this->notFound();
         return;
     }
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $promo = $promoDAO->findBySeoUrl($_GET['seo_url']);
     if (!$promo) {
         $this->notFound();
         return;
     }
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->cart = $cart;
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $this->registry->template->is_promo_active = TRUE;
     $this->registry->template->promo = $promo;
     $this->registry->template->related_promos = $promoDAO->findNewestList();
     $this->registry->template->tile_title = $promo['subject'];
     $this->registry->template->tile_content = 'promo.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#3
0
 public function index()
 {
     $globalDAO = new GlobalDAO(DataSource::getInstance());
     $this->registry->template->count_stats = $globalDAO->getStats();
     $this->registry->template->tile_title = 'Trang quản trị';
     $this->registry->template->tile_content = 'admin/dashboard.php';
     $this->registry->template->show('admin/layout/admin.php');
 }
示例#4
0
 public function cleanup()
 {
     $productDAO = new ProductDAO(DataSource::getInstance());
     $file_names = $productDAO->findAllPics();
     $c = clean_upload_images($file_names);
     $this->registry->template->deleted_files = $c;
     $this->registry->template->tile_title = 'Dọn dẹp thư mục upload';
     $this->registry->template->tile_content = 'admin/upload-cleanup.php';
     $this->registry->template->show('admin/layout/admin.php');
 }
示例#5
0
 public function delete()
 {
     if ($_SERVER['REQUEST_METHOD'] != 'POST') {
         echo '0';
         return;
     }
     $id = (int) $_POST['id'];
     $catDAO = new CatDAO(DataSource::getInstance());
     $catDAO->delete($id);
     echo '1';
 }
示例#6
0
 /**
  * load predefined SQL commands into DataSource class
  *
  * @param int $id_game
  * @return void
  */
 public static function init($id_game = null)
 {
     if (self::$DataSource === null) {
         self::$DataSource = DataSource::getInstance();
         self::LoadUserQueries();
         self::LoadGameQueries();
     }
     // clear all prepared statements (reset PDO object) if a new game_id is given
     if ($id_game !== null && $id_game !== self::$id_game && is_int($id_game)) {
         DataSource::getInstance()->reset_game_specific_queries();
         self::$id_game = $id_game;
         self::LoadGameSpecificQueries(self::$id_game);
     }
 }
 public function showError777()
 {
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->cart = $cart;
     $this->registry->template->tile_title = 'Không có quyền truy cập';
     $this->registry->template->tile_content = 'error777.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#8
0
 public function delete()
 {
     if (!isset($_POST['id'])) {
         echo '2';
         return;
     }
     $id = (int) $_POST['id'];
     if ($id <= 0) {
         echo '2';
         return;
     }
     $stockDAO = new StockDAO(DataSource::getInstance());
     $ret = $stockDAO->delete($id);
     echo (string) $ret;
 }
示例#9
0
 public function index()
 {
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $this->registry->template->promo_subject_newest = $promoDAO->findNewestSubject();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->cart = $cart;
     $this->registry->template->tile_title = __SITE_SLOGAN;
     $this->registry->template->body_class = 'index-template';
     $this->registry->template->body_id = 'index-page';
     $this->registry->template->tile_content = 'index.php';
     $this->registry->template->show('layout/user.php');
 }
示例#10
0
 public function index()
 {
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $globalDAO = new GlobalDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $content = $globalDAO->select('help');
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->content = $content;
     $this->registry->template->cart = $cart;
     $this->registry->template->is_help_active = TRUE;
     $this->registry->template->tile_title = 'Trợ Giúp';
     $this->registry->template->tile_content = 'help.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#11
0
 public function index()
 {
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $globalDAO = new GlobalDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $content = $globalDAO->select('contact');
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->content = $content;
     $this->registry->template->cart = $cart;
     $this->registry->template->is_contact_active = TRUE;
     $this->registry->template->facebook_description = 'Ms. Phương Thanh - 0987918796 - pttran87@gmail.com | Ms. Thùy Linh - 0983871412 - ptlinh1412@yahoo.com.vn';
     $this->registry->template->tile_title = 'Liên Hệ';
     $this->registry->template->tile_content = 'contact.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#12
0
 public function index()
 {
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $globalDAO = new GlobalDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $content = $globalDAO->select('about');
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->content = $content;
     $this->registry->template->cart = $cart;
     $this->registry->template->is_about_active = TRUE;
     $this->registry->template->tile_title = 'Giới Thiệu';
     $this->registry->template->body_class = 'page-template';
     $this->registry->template->tile_content = 'about.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#13
0
 public function index()
 {
     if (empty($_GET['seo_url'])) {
         $this->notFound();
         return;
     }
     $productDAO = new ProductDAO(DataSource::getInstance());
     $product = $productDAO->findBySeoUrl($_GET['seo_url']);
     if (!$product) {
         $this->notFound();
         return;
     }
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $brandDAO = new BrandDAO(DataSource::getInstance());
     $cat_id = $product['category_id'];
     $brand_id = $product['brand_id'];
     $categories_list = $categoryDAO->findByAll_Navigation();
     $brands_list = $brandDAO->findByAll();
     $products_list_in_cat = $productDAO->findByCatId($cat_id);
     $products_list_in_brand = $productDAO->findByBrandId($brand_id);
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $this->registry->template->cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->brands_list = $brands_list;
     $this->registry->template->current_cat_id = $cat_id;
     $this->registry->template->current_brand_id = $brand_id;
     $this->registry->template->products_list_in_cat = $products_list_in_cat;
     $this->registry->template->products_list_in_brand = $products_list_in_brand;
     $this->registry->template->product = $product;
     $this->registry->template->product_pics = explode_pics($product['pics']);
     $this->registry->template->tile_title = $categories_list[$cat_id]['name'] . ' / ' . $brands_list[$brand_id] . ' / ' . $product['code'];
     $this->registry->template->facebook_description = $product['description'];
     $this->registry->template->facebook_image = __SITE_CONTEXT . __UPLOAD_DIR . get_pic_at($product['pics'], 1);
     $this->registry->template->body_class = 'product-template';
     $this->registry->template->tile_content = 'product.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#14
0
 public function index()
 {
     echo 'zzzzzzzzzzz 1';
     if ($this->findGroupId() > 0) {
         header('Location: ' . __SITE_CONTEXT . 'admin/dashboard/');
         return;
     }
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $username = remove_slashes($_POST['username']);
         $password = remove_slashes($_POST['password']);
         $memberDAO = new MemberDAO(DataSource::getInstance());
         $group_id = $memberDAO->checkLogin($username, $password);
         if ($group_id == 0) {
             // login failed
             $message = 'Sai username hoặc password!';
             $this->registry->template->message = $message;
             $this->registry->template->username = $username;
         } else {
             $_SESSION['member'] = array('group_id' => $group_id);
             header('Location: ' . __SITE_CONTEXT . 'admin/dashboard/');
             return;
         }
     }
     $categoryDAO = new CatDAO(DataSource::getInstance());
     $categories_list = $categoryDAO->findByAll_Navigation();
     $promoDAO = new PromoDAO(DataSource::getInstance());
     $this->registry->template->promo_seo_url_newest = $promoDAO->findNewestSeoUrl();
     $cart = getCart();
     $this->registry->template->categories_list = $categories_list;
     $this->registry->template->cart = $cart;
     $this->registry->template->tile_title = 'Login';
     $this->registry->template->body_class = 'page-template';
     $this->registry->template->tile_content = 'login.php';
     $this->registry->template->tile_footer = 'footer.php';
     $this->registry->template->show('layout/user.php');
 }
示例#15
0
 public function delete()
 {
     $customerDAO = new CustomerDAO(DataSource::getInstance());
     $customerDAO->delete((int) $_POST['del_cust_id']);
     echo '1';
 }
示例#16
0
 public function sortSave()
 {
     $list_id_str = $_POST['listIdSort'];
     $productDAO = new ProductDAO(DataSource::getInstance());
     if ($productDAO->resort($list_id_str)) {
         echo '0';
     } else {
         echo '1';
     }
 }
示例#17
0
 public function delete()
 {
     $promoDAO = new PromoDAO(DataSource::getInstance());
     if ($promoDAO->delete((int) $_POST['del_promo_id'])) {
         echo '0';
     } else {
         echo '1';
     }
 }
示例#18
0
 public function __construct()
 {
     $this->ds = DataSource::getInstance();
 }
示例#19
0
 public function deleteBatch()
 {
     $strBatch = remove_slashes($_POST['str_batch']);
     $cartDAO = new CartDAO(DataSource::getInstance());
     $cartDAO->deleteBatch($strBatch);
     echo '1';
 }