Example #1
0
 function ManageUserLock($row)
 {
     CGlobal::$website_title = 'Quản lý thành viên bị khóa';
     Module::Module($row);
     if (User::have_permit(ADMIN_USER)) {
         switch (Url::get('cmd')) {
             case 'unban_nick':
                 $id = (int) Url::get('id', 0);
                 $user_id = (int) Url::get('user_id', 0);
                 if ($id) {
                     DB::update('user', array('block_time' => 0), 'id="' . $user_id . '"');
                     DB::update('user_lock', array('unlock_time' => TIME_NOW, 'unlock_user' => User::user_name()), 'id = ' . $id);
                     User::getUser($id, 0, 1);
                 }
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac')));
                 break;
             default:
                 require_once 'forms/ManageUserLock.php';
                 $this->add_form(new ListUserLockForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #2
0
 function ImportExcel($row)
 {
     if (User::have_permit(array(ADMIN_ITEM))) {
         Module::Module($row);
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'download':
                 $file_src = DATA_PATH . "AzNet.xls";
                 if (file_exists(ROOT_PATH . $file_src)) {
                     $ext = AZLib::getExtension($file_src);
                     if ($ext && strlen($ext) <= 5) {
                         $ext_app = substr($ext, 1);
                         header("Content-type: application/{$ext_app}");
                         header("Content-Disposition: attachment; filename=" . date("Y.m.d-H\\hi", TIME_NOW) . "_ANS_Products{$ext}");
                         readfile(ROOT_PATH . $file_src);
                         exit;
                     }
                 }
                 header("HTTP/1.0 404 Not Found");
                 echo "<h1>404 - Not Found!<br />Return to <a href='" . WEB_ROOT . "'>" . WEB_NAME . "</a></h1>";
                 exit;
                 break;
             default:
                 require_once 'forms/ImportExcel.php';
                 $this->add_form(new ImportExcelForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #3
0
 function PostItem($row)
 {
     Module::Module($row);
     if (User::is_login()) {
         if (!User::have_permit(ADMIN_ITEM) || User::is_block()) {
             Url::access_denied();
         } else {
             if (Url::get('cmd') == 'edit') {
                 if (Url::get('id')) {
                     require_once 'forms/EditItemForm.php';
                     $this->add_form(new EditItemForm());
                     return;
                 }
             }
             if (Url::get('cmd') != '') {
                 Url::redirect_current();
             }
             require_once 'forms/PostItemForm.php';
             $this->add_form(new PostItemForm());
         }
     } else {
         AZLib::check_uri();
         Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
     }
 }
Example #4
0
 function ManageSupport($row)
 {
     Module::Module($row);
     if (User::is_admin() || User::have_permit(support_all_perm)) {
         CGlobal::$website_title = 'Quản lý thư góp ý của khách hàng';
         switch (Url::get('cmd')) {
             case 'delete':
                 DB::query('DELETE FROM support WHERE id=' . EClassApi::getParam('id'));
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id')));
                 break;
             case "edit":
                 /*case "add":
                 		require_once 'forms/edit.php';		
                 		$this->add_form(new EditBadWordForm());
                 		break;*/
             /*case "add":
             		require_once 'forms/edit.php';		
             		$this->add_form(new EditBadWordForm());
             		break;*/
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new ManageSupportForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #5
0
 function draw()
 {
     if (CGlobal::$curCategory) {
         global $display;
         $parentNameCat = '';
         $curNameCat = '';
         if (CGlobal::$allCategories[CGlobal::$curCategory]['parent_id'] && isset(CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']])) {
             $linkparentNameCat = WEB_ROOT . "c" . CGlobal::$allCategories[CGlobal::$curCategory]['parent_id'] . "/" . CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['ebname'];
             $parentNameCat = "<a href='" . $linkparentNameCat . "'>" . CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['name'] . "</a> <div class=\"node\"></div> ";
             $ebname = CGlobal::$allCategories[CGlobal::$allCategories[CGlobal::$curCategory]['parent_id']]['ebname'] . '-' . CGlobal::$allCategories[CGlobal::$curCategory]['ebname'];
         } else {
             $ebname = CGlobal::$allCategories[CGlobal::$curCategory]['ebname'];
         }
         if (isset(CGlobal::$allCategories[CGlobal::$curCategory]['name'])) {
             $linkCurNameCat = WEB_ROOT . "c" . CGlobal::$curCategory . "/" . $ebname;
             $curNameCat = "<a href='" . $linkCurNameCat . "' class='selected'>" . CGlobal::$allCategories[CGlobal::$curCategory]['name'] . "</a>";
         }
         $page_no = (int) Url::get('page_no', 1);
         if ($page_no <= 0) {
             $page_no = 1;
         }
         $navigation = $parentNameCat . $curNameCat;
         if (AZNet::$page['name'] == 'list_detail') {
             $navigation .= ' <span style="color:#ccc;float:right;margin-top:3px">[ Trang ' . $page_no . ' ]</span>';
         } elseif (AZNet::$page['name'] == 'item_detail' && Item::$item && User::have_permit(ADMIN_ITEM)) {
             $navigation .= '<span style="color:#c00;float:right;margin-top:3px">&raquo; ID SP [' . Item::$id . ']</span>';
         }
         $display->add('url_home', WEB_DIR);
         $display->add('navigation', $navigation);
         $display->output('HeaderNavigation');
     }
 }
Example #6
0
 function AdminPromotion($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_ADV)) {
         switch (Url::get('cmd')) {
             case 'edit':
                 $promo = urldecode(Url::get('name'));
                 if ($promo && is_dir(ROOT_PATH . 'promotion/' . $promo . '/')) {
                     $this->add_form(new EditPromotionForm());
                 } else {
                     Url::redirect_current();
                 }
                 break;
             case 'delete':
                 $promo = urldecode(Url::get('name'));
                 if ($promo && is_dir(ROOT_PATH . 'promotion/' . $promo . '/')) {
                     AZLib::delDir(ROOT_PATH . 'promotion/' . $promo . '/');
                 }
                 Url::redirect_current();
                 break;
             default:
                 $this->add_form(new AdminPromotionForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #7
0
 function NewsAdminCats($row)
 {
     Module::Module($row);
     if (!User::have_permit(ADMIN_NEWS)) {
         Url::access_denied();
     }
     switch (Url::get('cmd')) {
         case 'delete':
             $this->add_form(new DeleteNewsCatForm());
             break;
         case 'move_down':
         case 'move_up':
             $this->add_form(new MoveNewsCatForm());
             break;
         case 'move_home':
         case 'move_end':
             $this->add_form(new MoveHomeNewsCatForm());
             break;
         case 'edit':
             require_once 'forms/NewsAdminCatsEdit.php';
             $this->add_form(new NewsAdminCatsEditForm());
             break;
         case 'add':
             require_once 'forms/NewsAdminCatsAdd.php';
             $this->add_form(new NewsAdminCatsAddForm());
             break;
         default:
             require_once 'forms/NewsAdminCats.php';
             $this->add_form(new NewsAdminCatsForm());
     }
 }
Example #8
0
 function draw()
 {
     global $display;
     $cat_newss = array();
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->add('url_home', WEB_DIR);
     $display->add('time_now', News::displayTime());
     $display->add('cat_name', $this->news_cat['name']);
     $display->add('cat_url', URL::build('news_list', array('news_catid' => $this->news_cat['id'], 'azname' => AZLib::safe_title($this->news_cat['name']))));
     $condition = ' status=1 ';
     $total = DB::count("news", $condition);
     $limit = '';
     //$pagging	= AZPagging::paging_list($limit,20,'page_no');
     $pagging = AZPagging::paging_list($limit, $total, 20);
     $re = DB::query('SELECT * FROM news WHERE ' . $condition . ' ORDER BY id DESC' . $limit);
     if ($re) {
         while ($news = mysql_fetch_assoc($re)) {
             $news['title'] = stripslashes($news['title']);
             $news['brief'] = stripslashes($news['brief']);
             $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
             if ($news['image']) {
                 $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
             }
             $news['news_h'] = date('H:i', $news['time_created']);
             $news['news_d'] = date('d-m-Y', $news['time_created']);
             $news['admin_link'] = News::admin_link($news);
             $cat_newss[$news['id']] = $news;
         }
     }
     $display->add('pagging', $pagging);
     $display->add('cat_newss', $cat_newss);
     $display->output("NewsPage");
 }
Example #9
0
 function AdminLogs($row)
 {
     Module::Module($row);
     if (User::is_mod() || User::have_permit('logs_all_perm')) {
         switch (Url::get('cmd')) {
             case 'list_log':
                 $id = Url::get('id', 0);
                 if (empty($id)) {
                     Url::redirect_url('admin_log.html');
                     exit;
                 }
                 require_once 'forms/ListLog.php';
                 $this->add_form(new ListLogForm());
                 break;
             case 'list_coin':
                 require_once 'forms/ListCoin.php';
                 $this->add_form(new ListCoinForm());
                 break;
             case 'extend':
                 require_once 'forms/Extend.php';
                 $this->add_form(new ExtendForm());
                 break;
             default:
                 require_once 'forms/ListLog.php';
                 $this->add_form(new ListLogForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #10
0
 static function delete_images($id)
 {
     $row = DB::select('item_image', 'id=' . $id);
     if ($row) {
         if ($row['root_id']) {
             //Ảnh gốc
             DB::delete('item_image', 'root_id=' . $row['root_id']);
         } else {
             DB::delete('item_image', 'id=' . $id);
         }
         //update memcache IMG
         $sql = "SELECT item_id FROM item_image WHERE (id = {$id} OR root_id = {$id}) " . (User::have_permit(ADMIN_IMAGE) ? '' : " AND user_id=" . User::id());
         $re = DB::query($sql);
         if ($re) {
             $item = mysql_fetch_assoc($re);
             if ($item["item_id"]) {
                 require_once ROOT_PATH . 'core/Item.php';
                 Item::get_item_images($item["item_id"], 1);
             }
         }
         //update memcache IMG
         if ($row['img_url']) {
             if (DB::query("UPDATE item SET img_url='' WHERE img_url='" . $row['img_url'] . "'") && MEMCACHE_ON) {
                 $sql = "SELECT * FROM item WHERE img_url = '{$row['img_url']}'";
                 $re = DB::query($sql);
                 while ($item_memcache = mysql_fetch_assoc($re)) {
                     $item_memcache['img_server'] = 0;
                     $item_memcache['img_url'] = '';
                     AZMemcache::do_put("item:" . $item_memcache['id'], $item_memcache);
                 }
             }
             AZLib::ftp_image_delete_file($row['img_url'], $row['img_server']);
         }
     }
 }
Example #11
0
 function CartAdmin($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_ITEM)) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'delete':
                 if (User::is_admin()) {
                     $id = Url::get('id', 0);
                     if ($id) {
                         DB::delete("cart", "id={$id}");
                     }
                 }
                 Url::redirect_current();
                 break;
             case 'edit':
                 require_once 'forms/CartEdit.php';
                 $this->add_form(new CartEditForm());
                 break;
             case '':
             default:
                 require_once 'forms/CartAdmin.php';
                 $this->add_form(new CartAdminForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #12
0
 function ManageFilter($row)
 {
     Module::Module($row);
     if (!class_exists('eCateElectronic')) {
         require_once ROOT_PATH . 'core/eCate.php';
     }
     if (User::have_permit(ADMIN_CATEGORY)) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'add':
                 require_once 'forms/ManageFilterAdd.php';
                 $this->add_form(new ManageFilterAddForm());
                 break;
             case 'edit':
                 require_once 'forms/ManageFilterEdit.php';
                 $this->add_form(new ManageFilterEditForm());
                 break;
             case 'sync':
                 require_once 'forms/ManageFilterSync.php';
                 $this->add_form(new ManageFilterSyncForm());
                 break;
             default:
                 require_once 'forms/ManageFilter.php';
                 $this->add_form(new ManageFilterForm());
                 break;
         }
     } else {
         die('die');
     }
 }
Example #13
0
 function SendMultiMess($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_MESSAGE)) {
         require_once 'forms/send_multi_mess.php';
         $this->add_form(new SendMultiMessForm());
     } else {
         Url::access_denied();
     }
 }
Example #14
0
 function ManageProductHot($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_CATEGORY)) {
         require_once 'forms/ManageProductHot.php';
         $this->add_form(new ManageProductHotForm());
     } else {
         Url::access_denied();
     }
 }
Example #15
0
 function ManageBanIp($row)
 {
     Module::Module($row);
     if (User::have_permit(array(ADMIN_ITEM))) {
         require_once 'forms/ManageBanIp.php';
         $this->add_form(new ManageBanIpForm());
     } else {
         Url::access_denied();
     }
 }
Example #16
0
 function ManageImage($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_IMAGE)) {
         CGlobal::$website_title = 'Quản lý ảnh';
         require_once 'forms/ManageImage.php';
         $this->add_form(new ManageImageForm());
     } else {
         Url::access_denied();
     }
 }
Example #17
0
 function CartPrint($row)
 {
     Module::Module($row);
     CGlobal::$website_title = "in đơn hàng";
     $id = URL::get('id', 0);
     if ($id) {
         CartPrint::$cart = DB::select("cart", "id={$id}");
         if (CartPrint::$cart && (User::have_permit(ADMIN_ITEM) || CartPrint::$cart['user_id'] == User::id() || CartPrint::$cart['session'] == CGlobal::$cart_sess_id)) {
             $re = DB::query("SELECT * FROM cart_item WHERE cart_id=" . CartPrint::$cart['id'] . " ORDER BY id DESC");
             $cart_item_del = '';
             $item_ids = '';
             if ($re) {
                 while ($cart_item = mysql_fetch_assoc($re)) {
                     $item_ids .= ($item_ids != '' ? ',' : '') . $cart_item['item_id'];
                     CartPrint::$cart_items[$cart_item['id']] = $cart_item;
                 }
             }
             if ($item_ids != '') {
                 $re = DB::query("SELECT * FROM item WHERE id IN(" . $item_ids . ") AND status=1 AND price>0");
                 if ($re) {
                     while ($item = mysql_fetch_assoc($re)) {
                         $item['price'] = number_format(AZLib::convertCurrency($item['price'], $item['currency_id']), null, null, '.');
                         CartPrint::$items[$item['id']] = $item;
                     }
                 }
             }
             $cart_item_del = '';
             foreach (CartPrint::$cart_items as $cart_item) {
                 if (isset(CartPrint::$items[$cart_item['item_id']])) {
                     if ($cart_item['price'] != CartPrint::$items[$cart_item['item_id']]['price'] || $cart_item['sku'] != CartPrint::$items[$cart_item['item_id']]['sku']) {
                         $cart_item['price'] = CartPrint::$items[$cart_item['item_id']]['price'];
                         $cart_item['sku'] = CartPrint::$items[$cart_item['item_id']]['sku'];
                         DB::update('cart_item', array('price' => $cart_item['price'], 'sku' => $cart_item['sku']), "id={$cart_item['id']}");
                     }
                     CartPrint::$cart_items[$cart_item['id']] = $cart_item;
                 } else {
                     $cart_item_del .= ($cart_item_del != '' ? ',' : '') . $cart_item['id'];
                 }
             }
             if ($cart_item_del != '') {
                 DB::delete('cart_item', "id IN({$cart_item_del})");
             }
         } else {
             AZLib::closePopup();
             exit;
         }
     }
     if (!CartPrint::$cart) {
         AZLib::closePopup();
         exit;
     }
     require_once 'forms/CartPrint.php';
     $this->add_form(new CartPrintForm());
 }
Example #18
0
 function draw()
 {
     global $display;
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $OnlineSupport = @CGlobal::$configs['OnlineSupport']['conf_val'];
     if ($OnlineSupport != '') {
         $OnlineSupport = unserialize(stripslashes($OnlineSupport));
     } else {
         $OnlineSupport = false;
     }
     $display->add('OnlineSupport', $OnlineSupport);
     $display->output('eBoxSupportOnlineForm');
 }
Example #19
0
 static function un_del_item($id)
 {
     if (User::have_permit(ADMIN_ITEM)) {
         $item = Item::get_item($id);
         if ($item) {
             DB::query("UPDATE item SET status = 1 WHERE id = {$id}");
             if (MEMCACHE_ON) {
                 $item_memcache = $item;
                 $item_memcache['status'] = 1;
                 AZMemcache::do_put("item:{$id}", $item_memcache);
             }
         }
     }
 }
Example #20
0
 function draw()
 {
     global $display;
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $total = (int) DB::fetch('SELECT count(*) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900), 'total', 1);
     $mem = (int) DB::fetch('SELECT count(total) as total FROM ( SELECT count(user_id) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id !=0 GROUP BY user_id) as t', 'total', 1);
     $guest = (int) ($total - $mem);
     $display->add("online", number_format($total, NULL, NULL, '.'));
     $display->add("mem", number_format($mem, NULL, NULL, '.'));
     $display->add("guest", number_format($guest, NULL, NULL, '.'));
     $display->add("site_hit", (int) User::$site_hit);
     $display->add("site_hit_day", (int) User::$site_hit_day);
     $display->output('eBoxMenuCateForm');
 }
Example #21
0
 function draw()
 {
     if (Item::$item && isset(Item::$item['display']) && Item::$item['display']) {
         global $display;
         $re = DB::query("SELECT relate_id FROM item_relate WHERE item_id = " . Item::$item['id']);
         $relate_ids = '';
         $relate_arrs = array();
         if ($re) {
             while ($relate = mysql_fetch_assoc($re)) {
                 $relate_ids .= ($relate_ids != '' ? "," : "") . $relate['relate_id'];
             }
         }
         if ($relate_ids) {
             $re = DB::query("SELECT * FROM item WHERE id IN({$relate_ids}) AND status = 1 ORDER BY item_order");
             $relate_ids = '';
             if ($re) {
                 while ($product = mysql_fetch_assoc($re)) {
                     $relate_ids .= ($relate_ids != '' ? ',' : '') . $product['id'];
                     if ($product['img_url']) {
                         $product['image'] = AZLib::getImageThumb($product['img_url'], 180, 0, 0, $product['img_server']);
                     } else {
                         $product['image'] = "";
                         //"style/images/no-images-35x35.gif";
                     }
                     if (isset(CGlobal::$allCategories[$product['category_id']])) {
                         $product['url'] = WEB_DIR . CGlobal::$allCategories[$product['category_id']]['nice_name'] . "/p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                     } else {
                         $product['url'] = WEB_DIR . "p{$product['id']}/" . AZLib::safe_title($product['name']) . ".html";
                     }
                     $product['name'] = stripslashes($product['name']);
                     $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
                     $relate_arrs[] = $product;
                 }
             }
         }
         $display->add('relate_ids', $relate_ids);
         $display->add('relate_arrs', $relate_arrs);
         $display->add('item_detail', Item::$item);
         $display->add("share_url", urlencode("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']));
         $display->add('WEB_NAME', WEB_NAME);
         if (User::have_permit(ADMIN_ITEM)) {
             $display->add('is_admin', 1);
             $display->add('begin_form', $this->beginForm(false, 'post', false, false, 1));
             $display->add('end_form', $this->endForm(true));
         }
         $display->output("ItemRelate");
     }
 }
Example #22
0
 function AdminMail($row)
 {
     Module::Module($row);
     if (User::is_admin() || User::have_permit('mail_all_perm')) {
         switch (Url::get('cmd')) {
             case 'send':
                 require_once 'forms/Send.php';
                 $this->add_form(new SendMailForm());
                 break;
             default:
                 require_once 'forms/Send.php';
                 $this->add_form(new SendMailForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #23
0
 function AdminNotice($row)
 {
     Module::Module($row);
     $act = Url::get("act");
     $cmd = Url::get("cmd");
     if ($act == "user" && User::have_permit(ADMIN_NOTICE_USER)) {
         switch ($cmd) {
             case 'delete':
                 $id = (int) Url::get('id');
                 $this->delNoticeUser($id);
                 Url::redirect_current(array('act'));
                 break;
             case "add":
             case "edit":
                 require_once 'forms/EditAdminNoticeUser.php';
                 $this->add_form(new EditAdminNoticeUserForm());
                 break;
             default:
                 require_once 'forms/AdminNoticeUser.php';
                 $this->add_form(new AdminNoticeUserForm());
                 break;
         }
     } elseif (User::have_permit(ADMIN_NOTICE)) {
         switch ($cmd) {
             case 'delete':
                 $id = (int) Url::get('id');
                 $this->delNotice($id);
                 Url::redirect_current();
                 break;
             case "add":
             case "edit":
                 require_once 'forms/EditAdminNotice.php';
                 $this->add_form(new EditAdminNoticeForm());
                 break;
             default:
                 require_once 'forms/AdminNotice.php';
                 $this->add_form(new AdminNoticeForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #24
0
 function Province($row)
 {
     Module::Module($row);
     if (User::have_permit(ADMIN_PROVINCE)) {
         switch (Url::get('cmd')) {
             case 'edit':
             case 'add':
                 require_once 'forms/edit.php';
                 $this->add_form(new EditProvinceForm());
                 break;
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new ListProvinceForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #25
0
 function draw()
 {
     global $display;
     $cat_newss = array();
     $news_cat_id = Url::get('news_catid', 'id', 0);
     AZLib::getNewsCats();
     $display->add('news_cat_id', $news_cat_id);
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_cat) {
             if ($news_cat['public']) {
                 $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
                 $cat_newss[$news_cat['id']] = $news_cat;
             }
         }
     }
     $display->add('cat_newss', $cat_newss);
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->output("NewsMenu");
 }
Example #26
0
 function NewsAdmin($row)
 {
     Module::Module($row);
     if (!User::have_permit(ADMIN_NEWS)) {
         Url::access_denied();
     }
     CGlobal::$website_title = 'Quản lý tin tức';
     switch (Url::get('cmd')) {
         case 'del_img':
             $news_id = Url::get('news_id', 'int', 0);
             if ($news_id) {
                 $news = DB::select("news", "id=" . $news_id);
                 if ($news) {
                     DB::update('news', array('image' => '', 'img_server' => 0, 'image_title' => ''), "id=" . $news['id'], __LINE__ . __FILE__);
                 }
             }
             if (Url::get('href')) {
                 Url::redirect_url(urldecode(Url::get('href')));
             } else {
                 Url::redirect_current();
             }
         case 'pub':
             $this->add_form(new PublicNewsForm());
             break;
         case 'delete':
             $this->add_form(new DeleteNewsForm());
             break;
         case 'edit':
             CGlobal::$website_title = 'Sửa tin';
             require_once 'forms/NewsAdminEdit.php';
             $this->add_form(new NewsAdminEditForm());
             break;
         case 'add':
             CGlobal::$website_title = 'Thêm tin';
             require_once 'forms/NewsAdminAdd.php';
             $this->add_form(new NewsAdminAddForm());
             break;
         default:
             require_once 'forms/NewsAdmin.php';
             $this->add_form(new NewsAdminForm());
     }
 }
Example #27
0
 function draw()
 {
     global $display;
     $this->beginForm(false, 'post', false, "?" . htmlentities($_SERVER['QUERY_STRING']));
     $user = $this->user;
     if ($user['email_alert'] == 0) {
         $user['email_alert'] = '';
     } else {
         $user['email_alert'] = '(Newsletter registered)';
     }
     if ($user['avatar_url'] != "") {
         $user['avatar_url'] = '<img src="' . EClassApi::getImageThumb($user['avatar_url'], 100, 100, 0, $user['img_server']) . '" />';
     } else {
         $user['avatar_url'] = '<img src="style/images/no_avatar_item.gif" width="94" height="94" />';
     }
     $user['create_time'] = date('d/m/y H:i', $user['create_time']);
     if ($user['block_time'] > TIME_NOW || $user['block_time'] == -1) {
         if ($user['block_time'] != -1) {
             $user['status'] = "<font color=red><b>" . date('H:i d/m/y', $user['block_time']) . '</b></font>';
         } else {
             $user['status'] = '<font color=red><b>Locked</b></font>';
         }
     } elseif ($user['invalid_time']) {
         $user['status'] = "<font color=red><b>Censored</b></font>";
     } else {
         $user['status'] = "Active";
     }
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('user', $user);
     $display->add('user', $user);
     $display->add('root', User::is_root());
     $display->add('is_root', User::have_permit('user_note') || User::is_root());
     $coin_note = trim(Url::get('coin_note'));
     $error_message = $this->getErrorMessage('admin/user/error');
     $display->add('error_message', $error_message);
     $display->add('coin_note', $coin_note);
     $display->add('can_edit_uname', User::is_root() || User::have_permit('change_user_name'));
     $display->output('UserDetail');
     $this->endForm();
 }
Example #28
0
 function draw()
 {
     global $display;
     if (User::is_admin()) {
         $display->add("is_admin", 1);
     }
     $display->add('url_home', WEB_DIR);
     $display->add('time_create', News::displayTime($this->news['time_created']));
     $display->add('title', stripslashes($this->news['title']));
     $display->add('brief', stripslashes($this->news['brief']));
     $display->add('content', stripslashes($this->news['content']));
     $display->add('pen_name', stripslashes($this->news['pen_name']));
     if ($this->news['source'] != '') {
         $display->add('source', " ( theo <i>" . stripslashes($this->news['source']) . "</i> )");
     } else {
         $display->add('source', "");
     }
     if (User::have_permit(ADMIN_NEWS)) {
         $display->add('admin_link', News::admin_link($this->news));
     }
     if ($this->news['image']) {
         $display->add('img_full_url', "http://" . CGlobal::$img_server[$this->news['img_server']] . $this->news['image']);
         $display->add('img_max_path', AZLib::getImageThumbMax($this->news['image'], '', 1, $this->news['img_server']));
         $display->add('image_title', stripslashes($this->news['image_title']));
         $display->add('image_url', AZLib::getImageThumb($this->news['image'], 180, 0, 0, $this->news['img_server']));
         //AZLib::safe_title($this->news['title']))
         $display->add('image_oringin', $this->news['image']);
     }
     $news_cart = CGlobal::$allNewsCategories[$this->news['news_catid']];
     $display->add('news_home_link', Url::build('news'));
     if ($news_cart) {
         $display->add('cat_link', Url::build('news', array('news_catid' => $news_cart['id'], 'azname' => AZLib::safe_title($news_cart['name']))));
         $display->add('cat_name', $news_cart['name']);
     }
     $display->add("share_title", urlencode(CGlobal::$website_title));
     $display->add("share_url", "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     $display->add("share_des", urlencode(trim(CGlobal::$meta_desc)));
     $display->output("NewsDetail");
 }
Example #29
0
 function draw()
 {
     global $display;
     $home_newss = array();
     $display->add('is_admin', User::have_permit(ADMIN_NEWS));
     $display->add('url_home', WEB_DIR);
     $display->add('time_now', News::displayTime());
     $one_cart = '';
     AZLib::getNewsCats();
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_catid => $news_cat) {
             if ($news_cat['public']) {
                 $newss = array();
                 $re = DB::query("SELECT * FROM news WHERE status=1 AND news_catid={$news_catid} ORDER BY id DESC LIMIT 0,4");
                 if ($re) {
                     $i = 1;
                     while ($news = mysql_fetch_assoc($re)) {
                         if ($i == 1) {
                             if ($news['image']) {
                                 $news['image'] = AZLib::getImageThumb($news['image'], 150, 0, 0, $news['img_server']);
                             }
                             $i++;
                         }
                         $news['url'] = URL::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
                         $news['news_h'] = date('H:i', $news['time_created']);
                         $news['news_d'] = date('d-m-Y', $news['time_created']);
                         $newss[$news['id']] = $news;
                     }
                 }
                 if ($newss) {
                     $home_newss[$news_catid] = array('name' => $news_cat['name'], 'url' => URL::build('news_list', array('news_catid' => $news_catid, 'azname' => AZLib::safe_title($news_cat['name']))), 'newss' => $newss);
                 }
             }
         }
     }
     $display->add('home_newss', $home_newss);
     $display->output("NewsHome");
 }
Example #30
0
 static function admin_link($row)
 {
     $str = '';
     if (User::have_permit(ADMIN_NEWS)) {
         $href = urlencode(Url::build_all());
         $str = '<br />';
         $str .= '<a href="' . Url::build('news_admin', array('cmd' => 'add')) . '"><b>Thêm tin</b></a> | ';
         $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'edit', 'href' => $href)) . '"><b>Sửa tin</b></a> | ';
         if (!$row['status']) {
             $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'pub', 'act' => 'Publish', 'href' => $href)) . '" )"><b>Hiển thị tin</b></a> | ';
         } else {
             $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'pub', 'act' => 'UnPublish', 'href' => $href)) . '" )"><b>Ẩn tin</b></a> | ';
         }
         $str .= '<a href="' . Url::build('news_admin', array('id' => $row['id'], 'cmd' => 'delete', 'href' => $href)) . '" onclick="return confirm(\'Bạn có chắc chắn xóa không?\')"><b>Xóa tin</b></a> ';
         $str .= '<br />[ <b>Thêm:</b> <a href="' . Url::build('profile', array('username' => $row['username'])) . '"><b>' . $row['username'] . '</b></a> - ' . date('d/m/Y H:i', $row['time_created']) . ' || ';
         $str .= '<b>Sửa:</b> <a href="' . Url::build('profile', array('username' => $row['user_modify'])) . '"><b>' . $row['user_modify'] . '</b></a> - ' . date('d/m/Y H:i', $row['time_modify']) . ' ]';
         if ($row['admin_comment'] != '') {
             $str .= '<br /><b><font color="red">Ghi chú: </font></b><font color="red">' . $row['admin_comment'] . '</font></b>';
         }
         // Hien thi comment cua Bien tap
     }
     return $str;
 }