Exemplo n.º 1
0
 static function Run()
 {
     AZLib::CheckDir(PAGE_CACHE_DIR);
     if (isset($_REQUEST['page'])) {
         if ($_REQUEST['page'] == "home") {
             Url::redirect_url(WEB_DIR, 301);
         }
         $page_name = strtolower($_REQUEST['page']);
     } else {
         $page_name = 'home';
     }
     AZNet::$page_cache_file = PAGE_CACHE_DIR . $page_name . '.php';
     if (Url::get('refresh_page') == 1) {
         self::del_page_cache($page_name);
     }
     if (Url::get('refresh_page') != 1 && PAGE_CACHE_ON && file_exists(AZNet::$page_cache_file)) {
         require_once AZNet::$page_cache_file;
     } else {
         $re = DB::query('SELECT id, name, title, layout  FROM page WHERE name="' . addslashes($page_name) . '"', __LINE__ . __FILE__);
         if ($re) {
             AZNet::$page = mysql_fetch_assoc($re);
         }
         if (!AZNet::$page) {
             Url::redirect_url(WEB_DIR, 301);
         }
         AZGen::PageGenerate();
     }
 }
Exemplo n.º 2
0
 function on_submit()
 {
     $user_name = AZLib::getParam('user_name');
     $content = AZLib::getParam('content');
     $active = (int) Url::get('active');
     $expire = (int) Url::get('expire', 7);
     $id = (int) Url::get('id');
     $cmd = Url::get('cmd');
     $sql = "SELECT id FROM user WHERE user_name='{$user_name}'";
     $row = DB::fetch($sql);
     $user_id = (int) $row["id"];
     if (!$user_id) {
         $this->setFormError('user_name', 'Không tồn tại thành viên này!');
     } elseif (!$user_name || !$content) {
         $this->setFormError('content', 'Dữ liệu không hợp lệ!');
     } else {
         if ($cmd == "add") {
             $item_array = array('content' => $content, 'user_name' => $user_name, 'user_id' => $user_id, 'admin_add' => User::user_name(), 'active' => $active, 'time_add' => TIME_NOW, 'expire_date' => TIME_NOW + 86400 * $expire);
             DB::insert('admin_notice_user', $item_array);
         } elseif ($cmd == "edit" && $id) {
             $item_array = array('content' => $content, 'user_name' => $user_name, 'user_id' => $user_id, 'admin_edit' => User::user_name(), 'active' => $active, 'time_edit' => TIME_NOW, 'expire_date' => TIME_NOW + 86400 * $expire);
             DB::update_id('admin_notice_user', $item_array, $id);
         }
         User::getAdminNoticeUser($user_id, 0, 1);
         Url::redirect_current(array('act'));
     }
 }
Exemplo n.º 3
0
 function on_submit()
 {
     $og_name = Url::get('og_name');
     $u_name = Url::get('u_name');
     $u_yahoo = Url::get('u_yahoo');
     $u_skype = Url::get('u_skype');
     $OnlineSupport = array();
     if ($og_name) {
         foreach ($og_name as $gid => $g_name) {
             if ($g_name != '' && isset($u_name[$gid], $u_yahoo[$gid], $u_skype[$gid])) {
                 $garray = array('name' => $g_name, 'users' => array());
                 foreach ($u_name[$gid] as $uid => $name) {
                     if ($name != '' && isset($u_yahoo[$gid][$uid], $u_skype[$gid][$uid]) && ($u_yahoo[$gid][$uid] != '' || $u_skype[$gid][$uid] != '')) {
                         $garray['users'][$uid] = array('name' => $name, 'yahoo' => $u_yahoo[$gid][$uid], 'skype' => $u_skype[$gid][$uid]);
                     }
                 }
                 if ($garray['users']) {
                     $OnlineSupport[$gid] = $garray;
                 }
             }
         }
     }
     if (isset(CGlobal::$configs['OnlineSupport'])) {
         DB::update('configs', array("conf_val" => addslashes(serialize($OnlineSupport))), "conf_key='OnlineSupport'", __FILE__ . " Dòng:" . __LINE__);
     } else {
         DB::insert('configs', array("conf_key" => 'OnlineSupport', "conf_val" => addslashes(serialize($OnlineSupport))), __FILE__ . " Dòng:" . __LINE__);
     }
     AZLib::get_config(0, 1);
     AZLib::refreshParent();
 }
Exemplo n.º 4
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $display->add('url_admin', Url::build_current());
     $display->add('msg', $this->showFormErrorMessages(1));
     if ($this->contact['name']) {
         $email = stripslashes($this->contact['name']) . " ";
     }
     if ($this->contact['address']) {
         $email .= "( " . stripslashes($this->contact['address']) . ") ";
     }
     $email .= '<a href="mailto:' . $this->contact['email'] . '"><font color=blue>' . $this->contact['email'] . "</font></a>";
     $display->add('email', $email);
     $display->add('date', date('H:i:s d/m/Y', $this->contact['time']));
     $display->add('date2', AZLib::duration_time($this->contact['time']));
     $display->add('content', stripslashes($this->contact['content']));
     $display->add('reply_content', stripslashes(Url::get('reply_content')));
     $display->add('subject', stripslashes(Url::get('subject')));
     if ($this->contact['reply_content']) {
         $display->add('replied_content', stripslashes($this->contact['reply_content']));
     } else {
         $display->add('replied_content', "Chưa có");
     }
     $display->output('FeedbackReply');
     $this->endForm();
 }
Exemplo n.º 5
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");
 }
Exemplo n.º 6
0
 function draw()
 {
     global $display;
     $this->beginForm(false, "post", false, Url::build_current());
     $item_per_page = 30;
     $total_row = DB::fetch('SELECT count(*) AS total_row FROM `province` limit 0,1', 'total_row', 0);
     $paging = '';
     $items = array();
     if ($total_row) {
         $limit = '';
         $paging = AZPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true);
         $sql = "SELECT * FROM province ORDER BY id " . $limit;
         $re = DB::query($sql);
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 $area = array(1 => 'Bắc', 2 => 'Trung', 3 => 'Nam');
                 $status = array('SHOW' => 'Hiện', 'HIDE' => '<font color=red>Ẩn</font>', 'HOME' => 'HOME');
                 $row['area'] = $area[$row['area']];
                 $row['status'] = $status[$row['status']];
                 $items[$row['id']] = $row;
                 $items[$row['id']] = $row;
             }
         }
     }
     $display->add('hover', AZLib::mouse_hover('#F7F7F7', true));
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->add('total_row', $total_row);
     $display->output('list');
     $this->endForm();
 }
Exemplo n.º 7
0
 function piclens_gallery()
 {
     $item_id = AZLib::getParam('item_id');
     $entry = '';
     if ($item_id) {
         $sql = 'select id, img_url, title, position from item_image where item_id = ' . intval($item_id) . ' ORDER BY position ';
         DB::query($sql);
         if (DB::num_rows()) {
             $entry = '';
             while ($rows = DB::fetch_row()) {
                 $rows['title'] = $rows['title'] ? $rows['title'] : "Image {$rows['position']}";
                 $rows['title'] = trim(XMLLib::_xml_encode_attribute($rows['title']));
                 if (ereg('/', $rows['img_url'])) {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['img_url']}"));
                 } else {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['img_url']}"));
                 }
                 $entry .= "\r\n\t\t \t \t<item>\r\n\t\t \t \t\t\t<title>" . stripslashes($rows['title']) . "</title>\r\n\t\t\t\t\t\t<link>{$url}</link>\r\n\t\t\t\t\t\t<guid>Image {$rows['position']}</guid>\r\n\t\t\t\t\t\t<media:thumbnail url=\"{$url}\" />\r\n\t\t\t\t\t\t<media:content url=\"{$url}\" />\r\n\t\t\t\t</item>\r\n\t\t \t \t";
             }
             @header("Content-type: text/xml");
             echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n\t\t\t <rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">\r\n\t\t\t <channel>\t\t\t\r\n\t\t\t <title>Enbac.com</title>\r\n\t\t\t <link>http://www.enbac.com/</link>\r\n\t\t\t <description>Enbac.com - </description>\r\n\t\t\t <logo url=\"style/images/logo.piclens.png\" />\r\n\t\t\t";
             echo $entry;
             echo "\r\n\t\t \t </channel>\r\n\t\t\t </rss>\r\n\t\t\t";
         } else {
             die("no_info");
         }
     } else {
         die("no_info");
     }
 }
Exemplo n.º 8
0
 function draw()
 {
     global $display;
     $news_ids = '';
     $hot_newss = array();
     $configs = @CGlobal::$configs['NewsHomeHot']['conf_val'];
     if ($configs) {
         $configs = unserialize(stripslashes($configs));
         $title_news = $configs['title'];
         $news_ids = $configs['news_ids'];
     } else {
         $title_news = "TIN HOT";
         $news_ids = '';
     }
     if ($news_ids != '') {
         $re = DB::query("SELECT id, title, news_catid FROM news WHERE id IN({$news_ids}) AND status = 1 ORDER BY find_in_set(id,'{$news_ids}')");
         if ($re) {
             while ($news = mysql_fetch_assoc($re)) {
                 $news['title'] = stripslashes($news['title']);
                 $news['url'] = Url::build('news_detail', array('news_catid' => $news['news_catid'], 'news_id' => $news['id'], 'azname' => AZLib::safe_title($news['title'])));
                 $hot_newss[$news['id']] = $news;
             }
         }
     }
     if (User::is_admin()) {
         $display->add("is_admin", 1);
         $display->add("msg", $this->showFormErrorMessages(1));
         $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
         $display->add('end_form', $this->endForm(true));
     }
     $display->add('title_news', $title_news);
     $display->add('news_ids', $news_ids);
     $display->add('hot_newss', $hot_newss);
     $display->output("NewsHomeHot");
 }
Exemplo n.º 9
0
 function ListItem($row)
 {
     Module::Module($row);
     CGlobal::$website_title = AZLib::titlePath(CGlobal::$curCategory);
     require_once 'forms/ListItem.php';
     $this->add_form(new ListItemForm());
 }
Exemplo n.º 10
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();
     }
 }
Exemplo n.º 11
0
 function FilterMenuSearch($row)
 {
     Module::Module($row);
     AZLib::getFilters();
     require_once 'forms/FilterMenuSearch.php';
     $this->add_form(new FilterMenuSearchForm());
 }
Exemplo n.º 12
0
 function draw()
 {
     $this->beginForm();
     if (Url::get('cmd') == 'edit' && ($row = DB::select('bad_words', 'id=' . intval(AZLib::getParam('id'))))) {
         $contents = $row['contents'];
         $reason = $row['reason'];
         $exact = $row['exact'];
         if ($row['is_phone'] == 1) {
             $contents = BadWord::filter_badword_show($contents);
         }
         $is_phone = $row['is_phone'];
     } else {
         $contents = '';
         $exact = '';
         $is_phone = '';
         $reason = '';
     }
     global $display;
     $display->add('msg', $this->showFormErrorMessages());
     $display->add('contents', $contents);
     $display->add('reason', $reason);
     $display->add('exact', $exact);
     $display->add('is_phone', $is_phone);
     $display->add('cmd', Url::get('cmd'));
     $display->output('edit');
     $this->endForm();
 }
Exemplo n.º 13
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));
     }
 }
Exemplo n.º 14
0
 function check_login()
 {
     if (!User::is_login()) {
         AZLib::check_uri();
         Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
     }
 }
Exemplo n.º 15
0
 function draw()
 {
     global $display;
     $cmd = Url::get('cmd');
     if ($cmd == 'update') {
         AZMemcache::do_put("prhot_ver:", 0);
         Url::redirect_current();
     }
     $this->beginForm();
     $list_cat = array(999999999 => 'Mặc định', 0 => 'Trang chủ');
     $list_cat += AZLib::getTopCats();
     $item = DB::fetch_all('SELECT item_id,status,product_hot_cat_id,end_time,start_time FROM product_hot');
     $items_tmp = array();
     foreach ($item as $values) {
         if (isset($list_cat[$values['product_hot_cat_id']])) {
             $items_tmp[$values['product_hot_cat_id']]['cat_name'] = $list_cat[$values['product_hot_cat_id']];
             if ($values['status'] == 1) {
                 $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['cat_id'] = $values['product_hot_cat_id'];
                 $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['start_time'] = date("d/m/Y", $values['start_time']);
                 $items_tmp[$values['product_hot_cat_id']]['item_vip'][$values['item_id']]['end_time'] = date("d/m/Y", $values['end_time']);
             } else {
                 $items_tmp[$values['product_hot_cat_id']]['item'][$values['item_id']] = $values['product_hot_cat_id'];
             }
         }
     }
     $items = array();
     foreach ($list_cat as $key => $values) {
         if (isset($items_tmp[$key])) {
             $items[$key] = $items_tmp[$key];
         }
     }
     $display->add('items', $items);
     $display->output('ManageProductHot');
     $this->endForm();
 }
Exemplo n.º 16
0
 function draw()
 {
     global $display;
     $cats = array();
     $display->add('url_add', Url::build_current(array('cmd' => 'add')));
     /*
     $display->add('url_edit',Url::build_current(array('cmd'=>'edit','id'=>$category['id'])));
     $display->add('url_del',Url::build_current(array('cmd'=>'delete','id'=>$category['id'])));
     $display->add('url_sort_up',Url::build_current(array('cmd'=>'move_home','dir'=>'move_home','id'=>$category['id'])));
     $display->add('url_sort_low',Url::build_current(array('cmd'=>'move_home','dir'=>'move_end','id'=>$category['id'])));
     */
     $posMin = 1;
     $posMax = DB::count("news_categories");
     $re = DB::query('SELECT * FROM news_categories ORDER BY position, id');
     if ($re) {
         $index = 0;
         $column = 1;
         while ($row = mysql_fetch_assoc($re)) {
             $row['url'] = URL::build('news_list', array('news_catid' => $row['id'], 'azname' => AZLib::safe_title($row['name'])));
             $row['edit'] = Url::build_current(array('cmd' => 'edit', 'id' => $row['id']));
             $row['delete'] = Url::build_current(array('cmd' => 'delete', 'id' => $row['id']));
             $row['move_home'] = '<a title="Chuyển lên trên cùng" href="' . Url::build_current(array('cmd' => 'move_home', 'id' => $row['id'])) . '">Move HOME</a>';
             $row['move_end'] = '<a title="Chuyển xuống dưới cùng" href="' . Url::build_current(array('cmd' => 'move_end', 'id' => $row['id'])) . '">Move END</a>';
             if ($row['position'] > $posMin) {
                 $row['move_up'] = '<a title="Chuyển lên" href="' . Url::build_current(array('cmd' => 'move_up', 'id' => $row['id'])) . '"><img src="style/img/admin/move_up.gif"></a>';
             }
             if ($row['position'] < $posMax) {
                 $row['move_down'] = '<a title="Chuyển xuống" href="' . Url::build_current(array('cmd' => 'move_down', 'id' => $row['id'])) . '"><img src="style/img/admin/move_down.gif"></a>';
             }
             $cats[$row['id']] = $row;
         }
     }
     $display->add('cats', $cats);
     $display->output("NewsAdminCats");
 }
Exemplo n.º 17
0
 function draw()
 {
     global $display;
     if (User::id() != 0) {
         if (User::$current->data["avatar_url"] != "") {
             $avatar = '<img src="' . AZLib::getImageThumb(User::$current->data["avatar_url"], 100, 100, 0, User::$current->data["img_server"]) . '" />';
         } else {
             $avatar = '<img src="style/images/no_avatar_item.gif" width="94" height="94"/>';
         }
         $display->add('avatar', $avatar);
         $display->add('user_name', User::$current->data["user_name"]);
         $display->add('get_cmd', Url::get('cmd'));
         $display->add('get_action', Url::get('action'));
         $display->add('get_page', Url::get('page'));
         $display->add('get_page', AZNet::$page['name']);
         $display->add('get_cmd', Url::get('cmd'));
         $display->add('user_name', User::user_name());
         $display->add('can_edit_blast', User::is_admin() || !User::is_block());
         $blast = User::$current->data['blast'];
         $avatar_link = '';
         $avatar_url = 'style/images/no_avatar_item.gif';
         if (User::$current->data['avatar_url'] != '') {
             $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url'];
             $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']);
         }
         if ($blast == '') {
             $blast = '...';
         } else {
             $blast = ' ' . $blast;
             if (strpos($blast, 'http://')) {
                 $user_blast = $blast;
                 while (strpos($user_blast, 'http://')) {
                     $tmp = substr($user_blast, strpos($user_blast, 'http://'));
                     if (strpos($tmp, ' ') || strpos($tmp, '<')) {
                         if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) {
                             $blast_url = substr($tmp, 0, strpos($tmp, '<'));
                         } else {
                             $blast_url = substr($tmp, 0, strpos($tmp, ' '));
                         }
                     } else {
                         $blast_url = $tmp;
                     }
                     $user_blast = str_replace($blast_url, '', $user_blast);
                 }
                 $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>';
                 $blast = substr($user_blast . $new_blast_url, 1);
             }
         }
         $display->add('avatar_link', $avatar_link);
         $display->add('avatar_url', $avatar_url);
         $display->add('blast', $blast);
         $display->add('user_id', User::id());
         $TopMenu = $display->output('TopMenu', true, 'Personal');
         $display->add('TopMenu', $TopMenu);
         $display->output('change_pass', false, 'Personal');
     } else {
         Url::redirect('home');
     }
 }
Exemplo n.º 18
0
 function draw()
 {
     global $display;
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add("url_admin", Url::build_current());
     $status_select = Url::get('status_select', 6);
     //1:Chưa cập nhật; 2: Đã gửi đơn hàng ; 3: Đã TT; 4: Hủy đơn hàng; 5: Đã duyệt
     $status_arr = array(6 => "--Tất cả--", 2 => "Đã gửi đơn hàng", 1 => "Chưa cập nhật", 3 => "Đã Thanh toán", 5 => "Đã duyệt", 4 => "Đã hủy");
     $display->add("status_option", AZLib::getOption($status_arr, $status_select));
     $date_begin = Url::get('date_begin');
     $date_end = Url::get('date_end');
     $display->add("date_begin", $date_begin);
     $display->add("date_end", $date_end);
     $created_time_from = 0;
     $created_time_to = 0;
     if ($date_begin) {
         $date_arr = explode("-", $date_begin);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if ($date_end) {
         $date_arr = explode("-", $date_end);
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $condition = "";
     if ($status_select != 6) {
         $condition .= "status=" . $status_select;
     }
     if ($created_time_from) {
         $condition .= ($condition != '' ? ' AND ' : '') . ' time_create >=' . $created_time_from;
     }
     if ($date_end) {
         $condition .= ($condition != '' ? ' AND ' : '') . " time_create <={$created_time_to}";
     }
     $total = DB::count("cart", $condition);
     $limit = '';
     $display->add('paging', AZPagging::paging_list($limit, $total, 40, 10, 'page_no', '', true, 'Đơn hàng'));
     $all_carts = array();
     $re = DB::query("SELECT * FROM cart " . ($condition != '' ? 'WHERE ' : '') . $condition . " ORDER BY id DESC {$limit}");
     if ($re) {
         while ($Cart = mysql_fetch_assoc($re)) {
             $Cart["time_create"] = date('d/m/Y H:i:s', $Cart['time_create']);
             $Cart["time_change"] = date('d/m/Y H:i:s', $Cart['time_change']);
             $Cart["url"] = Url::build_current(array('cmd' => 'edit', 'id' => $Cart['id']));
             $Cart["status"] = $status_arr[$Cart['status']];
             $Cart["delete"] = Url::build_current(array('cmd' => 'delete', 'id' => $Cart['id']));
             $Cart["price"] = number_format($Cart['price'], null, null, '.');
             $all_carts[$Cart['id']] = $Cart;
         }
     }
     $display->add('all_carts', $all_carts);
     $display->add('is_admin', User::is_admin());
     $this->beginForm();
     $display->output('CartAdmin');
     $this->endForm();
 }
Exemplo n.º 19
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $user_id = intval(Url::get('user_id'));
     $user_info = DB::select('user', 'id="' . $user_id . '"');
     $display->add('created_time_from', Url::get('created_time_from'));
     $display->add('created_time_to', Url::get('created_time_to'));
     //search theo ngay thang nam
     $created_time_from = 0;
     $created_time_to = 0;
     if (Url::get('created_time_from')) {
         $date_arr = explode('-', Url::get('created_time_from'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_from = mktime(0, 0, 0, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     if (Url::get('created_time_to')) {
         $date_arr = explode('-', Url::get('created_time_to'));
         if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) {
             $created_time_to = mktime(23, 59, 59, (int) $date_arr[1], (int) $date_arr[0], (int) $date_arr[2]);
         }
     }
     $search_value = ' 1 ';
     if ($created_time_from) {
         $search_value .= ' AND created_time >= ' . $created_time_from;
     }
     if ($created_time_to) {
         $search_value .= ' AND created_time <= ' . $created_time_to;
     }
     $item_per_page = 50;
     $sql_count = 'SELECT COUNT(id) AS total_item FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value;
     $total = DB::fetch($sql_count, 'total_item', 0);
     $items = array();
     if ($total) {
         $limit = '';
         $paging = AZPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Sản phẩm', 'Trang');
         $sql = 'SELECT * FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY modify_time  DESC ' . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['ebname'] = AZLib::safe_title($row['name']);
                 $row['modify_time'] = date('d/m/y H:i', $row['modify_time']);
                 $row['created_time'] = date('d/m/y H:i', $row['created_time']);
                 $row['del_link'] = Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), 'cmd=delete&id=' . $row['id'] . '&user_id=' . $row['user_id']);
                 $items[$row['id']] = $row;
             }
         }
     } else {
         $paging = '';
     }
     $display->add('user_info', $user_info);
     $display->add('total_item', $total);
     $display->add('items', $items);
     $display->add('paging', $paging);
     $display->output('item_list');
     $this->endForm();
 }
Exemplo n.º 20
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $user = $this->user;
     if ($user['show_home_phone'] == 0) {
         $user['show_home_phone'] = '';
     } else {
         $user['show_home_phone'] = '(Đã ẩn)';
     }
     if ($user['show_email'] == 0) {
         $user['show_email'] = '';
     } else {
         $user['show_email'] = '(Đã ẩn)';
     }
     if ($user['email_alert'] == 0) {
         $user['email_alert'] = '';
     } else {
         $user['email_alert'] = '(Nhận email thông báo)';
     }
     if ($user['birth_day']) {
         $arrBirtday = explode('-', $user['birth_day']);
         $user['birth_day'] = $arrBirtday['2'] . '-' . $arrBirtday['1'] . '-' . $arrBirtday['0'];
     }
     if ($user['avatar_url'] != "") {
         $user['avatar_url'] = '<img src="' . AZLib::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']);
     $user['reg_ip'] = ($user['reg_ip'] ? "RegIP: <b>{$user['reg_ip']}</b>" : '') . ($user['last_ip'] ? "LastIP: <b>{$user['last_ip']}</b>" : '');
     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>Khóa vĩnh viễn</b></font>';
         }
     } elseif ($user['invalid_time']) {
         $user['status'] = "<font color=red><b>Đang bị kiểm duyệt</b></font>";
     } else {
         $user['status'] = "Bình thường";
     }
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('user', $user);
     $openids = array();
     $re = DB::query("SELECT id, openid_url FROM openid WHERE user_id=" . $user['id']);
     if ($re) {
         while ($openid = mysql_fetch_assoc($re)) {
             $openid['openid'] = $openid['openid_url'];
             $openids[$openid['id']] = $openid;
         }
     }
     $display->add('openids', $openids);
     $display->add('user', $user);
     $display->output('UserDetail');
     $this->endForm();
 }
Exemplo n.º 21
0
 function OnlineSupportEdit($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         require_once 'forms/OnlineSupportEdit.php';
         $this->add_form(new OnlineSupportEditForm());
     } else {
         AZLib::closePopup();
     }
 }
Exemplo n.º 22
0
 static function convertContent($document, $id, $news = 'news')
 {
     return '';
     require_once ROOT_PATH . "includes/client.class.php";
     $check = new client_php();
     $path = AZLib::uploadImgPath($news);
     $link = str_replace(ROOT_PATH, '', AznetLib::uploadImgPath($news));
     $document = $check->getimage($document, $path, $id, $link);
     return $document;
 }
Exemplo n.º 23
0
 function FooterEdit($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         require_once 'forms/FooterEdit.php';
         $this->add_form(new FooterEditForm());
     } else {
         AZLib::closePopup();
     }
 }
Exemplo n.º 24
0
 function draw()
 {
     global $display;
     $item_ids = '';
     $item_news = array();
     $configs = @CGlobal::$configs['ItemNew']['conf_val'];
     if ($configs) {
         $configs = unserialize(stripslashes($configs));
         $title_new = $configs['title'];
         $item_ids = $configs['item_ids'];
     } else {
         $title_new = "SẢN PHẨM MỚI";
         $item_ids = '';
     }
     if ($item_ids) {
         $re = DB::query("SELECT * FROM item WHERE id IN({$item_ids}) AND status = 1 ORDER BY find_in_set(id,'{$item_ids}')");
         if ($re) {
             while ($product = mysql_fetch_assoc($re)) {
                 if ($product['img_url']) {
                     $product['image'] = AZLib::getImageThumb($product['img_url'], 160, 150, 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']);
                 if ($product['list_brief'] == '') {
                     $product['list_brief'] = $product['brief'];
                 }
                 $product['list_brief'] = AZLib::remove_4_js(AZLib::plainText(AZLib::parseBBCode(html_entity_decode($product['list_brief'], ENT_QUOTES, "UTF-8"))));
                 $product['list_brief'] = preg_replace("/\\[([\\s]*[0-9]{1,2}[\\s]*)\\]/eis", " ", $product['list_brief']);
                 $product['list_brief'] = str_replace(array("'", "\""), array("", " "), $product['list_brief']);
                 $product['list_brief'] = AZLib::word_limit($product['list_brief'], 50, '');
                 $product['list_brief'] = '<b>' . str_replace(array("'", "\""), array("", " "), $product['name']) . '</b><br />' . $product['list_brief'];
                 $product['price_num'] = $product['price'];
                 $product['price'] = AZLib::getPrice($product['price'], $product['currency_id']);
                 $item_news[$product['id']] = $product;
             }
         }
     }
     if (User::is_admin()) {
         $display->add("is_admin", 1);
         $display->add("msg", $this->showFormErrorMessages(1));
         $display->add('begin_form', $this->beginForm(true, 'post', false, false, 1));
         $display->add('end_form', $this->endForm(true));
     }
     $display->add('title_new', $title_new);
     $display->add('item_ids', $item_ids);
     $display->add('item_news', $item_news);
     $display->output("ItemNew");
 }
Exemplo n.º 25
0
 function on_submit()
 {
     $user_update = array();
     $full_name = Url::get('full_name');
     $user_name = Url::get('register_user_name');
     $mobile_phone = AZLib::trimSpace(Url::get('mobile_phone'));
     $home_phone = AZLib::trimSpace(Url::get('home_phone'));
     $gender = (int) Url::get('gender');
     $yahoo_id = AZLib::trimSpace(Url::get('yahoo_id'));
     $skype_id = AZLib::trimSpace(Url::get('skype_id'));
     $address = AZLib::trimSpace(Url::get('address'));
     $website = AZLib::trimSpace(Url::get('website'));
     $this->checkFormInput('Tên đầy đủ', 'full_name', $full_name, 'str', false, '', 0, 50);
     $this->checkFormInput('Điện thoại di động', 'mobile_phone', $mobile_phone, 'str', false, '', 0, 50);
     $this->checkFormInput('Điện thoại bàn', 'home_phone', $home_phone, 'str', false, '', 0, 50);
     $change_pass = 0;
     $change_mail = 0;
     if (User::is_root() && (User::id() == 1 || $this->user['id'] != 1)) {
         $email = Url::get('email');
         $password = AZLib::trimSpace(Url::get('register_password'));
         $confirm_password = AZLib::trimSpace(Url::get('confirm_password'));
         if ($password && User::encode_password($password) != $this->user['password']) {
             //Có nhập pass mới khác pass cũ
             $this->checkFormInput('Mật khẩu truy cập', 'register_password', $password, 'str', true, '', 6, 50);
             $change_pass = 1;
             if ($password != $confirm_password) {
                 $this->setFormError('confirm_password', "Nhập lại Mật khẩu truy cập không khớp!");
             }
         }
         if ($email && $email != $this->user['email']) {
             //Có nhập email mới khác email cũ
             $this->checkFormInput('Email', 'email', $email, 'email', true, '', 6, 50);
             $change_mail = 1;
         }
     }
     if ($mobile_phone && !AZLib::is_mobile($mobile_phone)) {
         $mobile_phone = "";
     }
     if (!$this->errNum) {
         if ($change_mail && DB::exists('SELECT id FROM `user` WHERE `email`="' . $email . '" AND id!=' . $this->user['id'])) {
             $this->setFormError('email', "<b>Email</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Email</b> khác!");
         } else {
             $user_info = array('full_name' => $full_name, 'mobile_phone' => $mobile_phone, 'home_phone' => $home_phone, 'gender' => $gender == 1 ? 0 : 1, 'yahoo_id' => $yahoo_id, 'skype_id' => $skype_id, 'address' => $address, 'website' => $website);
             if ($change_pass) {
                 $user_info['password'] = User::encode_password($password);
             }
             if ($change_mail) {
                 $user_info['email'] = $email;
             }
             DB::update('user', $user_info, "id=" . $this->user['id']);
             User::getUser($this->user['id'], 0, 1);
             Url::redirect_current();
         }
     }
 }
Exemplo n.º 26
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());
 }
Exemplo n.º 27
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $sql = "SELECT COUNT(*) AS total_row FROM spam_mail";
     $total = DB::fetch($sql, 'total_row', 0);
     $spam_content = DB::select('spam_content', 'status=1');
     $pagging = '';
     $spam_emails = array();
     if ($total) {
         $limit = '';
         $pagging = AZPagging::pagingSE($limit, $total, 50, 10, 'page_no', true);
         $sql = "SELECT id, email_list, time, time_modify, spam_id, status FROM spam_mail ORDER BY id DESC {$limit}";
         $re = DB::query($sql);
         if ($re) {
             while ($email = mysql_fetch_assoc($re)) {
                 if ($email['time'] != $email['time_modify']) {
                     $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']);
                     $email['time'] .= "<br /><b>Sửa:</b> " . date('H\\hi d.m.Y', $email['time_modify']);
                 } else {
                     $email['time'] = "<b>Tạo:</b> " . date('H\\hi d.m.Y', $email['time']);
                 }
                 if ($spam_content && $spam_content['id'] == $email['spam_id']) {
                     $email['spam_id'] = '<font color="green">Đã spam</font>';
                     $email['reset'] = AZLib::button(Url::build_current(array('cmd' => 'reset_email', 'id' => $email['id'])), 'icon-reload.gif', 'Spam lại');
                 } else {
                     $email['spam_id'] = '<font color="orange">Chưa được Spam</font>';
                     $email['reset'] = '';
                 }
                 if ($email['status']) {
                     $email['status'] = '<font color="green">Có</font>';
                     $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'deactive_email', 'id' => $email['id'])), 'admin/delete_button_dis.gif', 'Không cho phép spam');
                 } else {
                     $email['status'] = '<font color="orange">Không</font>';
                     $email['check'] = AZLib::button(Url::build_current(array('cmd' => 'active_email', 'id' => $email['id'])), 'admin/check.gif', 'Cho phép spam');
                 }
                 if ($email['email_list']) {
                     $email['email_list'] = count(explode("\n", $email['email_list']));
                 } else {
                     $email['email_list'] = 0;
                 }
                 $email['edit_link'] = Url::build_current(array('cmd' => 'edit_email', 'id' => $email['id']));
                 $email['del_link'] = Url::build_current(array('cmd' => 'delete_email', 'id' => $email['id']));
                 $spam_emails[$email['id']] = $email;
             }
         }
     }
     $display->add('check_all', AZLib::button(Url::build_current(array('cmd' => 'active_all_email')), 'admin/check.gif', 'Cho phép spam tất cả các mail'));
     $display->add('check_none', AZLib::button(Url::build_current(array('cmd' => 'deactive_all_email')), 'admin/delete_button_dis.gif', 'Không phép spam tất cả các mail'));
     $display->add('items', $spam_emails);
     $display->add('pagging', $pagging);
     $display->output('ManageEmail');
     $this->endForm();
 }
Exemplo n.º 28
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'trans':
             $this->transaction();
             break;
         default:
             $this->home();
             break;
     }
 }
Exemplo n.º 29
0
 static function sendEBEmail($to, $subject, $content, $FromNameMail = '', $images = array())
 {
     $FromNameMail = WEB_NAME;
     require_once 'includes/mailer/PHPMailer_v5.1/class.phpmailer.php';
     $mail = new PHPMailer();
     //$mail->CharSet 		= 'utf-8';
     $mail->IsSMTP();
     //$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
     //$mail->SetLanguage("vn",ROOT_PATH.'includes/mailer/PHPMailer_v5.1/');
     $mail->Host = SMTP_HOST;
     $mail->SMTPSecure = SMTP_SECURE;
     //For PHPMailer_v5.1
     $mail->Port = SMTP_PORT;
     $mail->SMTPAuth = SMTP_AUTH;
     $mail->SMTPSecure = SMTP_SECURE;
     $mail->Username = SMTP_USER;
     // SMTP username
     $mail->Password = SMTP_PASS;
     // SMTP password
     $mail->From = SMTP_FROM_EMAIL;
     // Email duoc gui tu???
     $mail->FromName = WEB_NAME;
     // Ten hom email duoc gui
     //$mail->SetFrom(SMTP_FROM_EMAIL, WEB_NAME);
     $mail->AddReplyTo(SMTP_FROM_EMAIL, WEB_NAME);
     $mail->AddAddress($to, "");
     // Dia chi email va ten nhan
     $mail->Subject = $subject;
     // Chu de email
     $mail->IsHTML(true);
     // Gui theo dang HTML
     $mail->Body = $content;
     // Noi dung html
     $mail->AltBody = 'Để xem được nội dung Email này, hãy sử dụng một trình duyệt Email tương thích với mã HTML! (To view the message, please use an HTML compatible email viewer!)';
     //optional - MsgHTML will create an alternate automatically
     if (!empty($images)) {
         $mail->message_type = 'attachments';
         foreach ($images as $img) {
             if (!empty($img)) {
                 $ext = AZLib::getExtension($img['src']);
                 $img['mime'] = 'image/' . substr(strtolower($ext), 1, strlen($ext));
                 $mail->AddEmbeddedImage($img['src'], $img['id'], $img['title'], 'base64', $img['mime']);
             }
         }
         //cau hinh nhu sau <img src="cid:ubzsed" />
     }
     if (!$mail->Send()) {
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 30
0
 function on_submit()
 {
     if (User::is_admin()) {
         $map_content = Url::get("map_content");
         if (isset(CGlobal::$configs['map_content'])) {
             DB::update('configs', array("conf_val" => $map_content), "conf_key='map_content'");
         } else {
             DB::insert('configs', array("conf_key" => "map_content", "conf_val" => $map_content));
         }
         AZLib::get_config(0, 1);
         Url::redirect_current();
     }
 }