Ejemplo n.º 1
0
 static function Run()
 {
     EClassApi::CheckDir(PAGE_CACHE_DIR);
     if (isset($_REQUEST['page']) && $_REQUEST['page'] != '') {
         if ($_REQUEST['page'] == "home") {
             Url::redirect_url(WEB_DIR, 301);
         }
         $page_name = strtolower($_REQUEST['page']);
     } else {
         //echo $_COOKIE['lang'];die();
         $page_name = 'home';
     }
     EClass::$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(EClass::$page_cache_file)) {
         require_once EClass::$page_cache_file;
     } else {
         $re = DB::query('SELECT id, name, title, layout  FROM page WHERE name="' . addslashes($page_name) . '"', __LINE__ . __FILE__);
         if ($re) {
             EClass::$page = mysql_fetch_assoc($re);
         }
         if (!EClass::$page) {
             Url::redirect_url(WEB_DIR, 301);
         }
         require_once ROOT_PATH . 'core/EClassGen.php';
         EClassGen::PageGenerate();
     }
 }
Ejemplo n.º 2
0
 function on_submit()
 {
     if (User::is_admin()) {
         $submit = Url::get('submit');
         if ($submit == "Cập nhật") {
             $title_news = Url::get('title_news');
             $news_ids = Url::get('news_ids');
             $config_update = array('title' => $title_news, 'news_ids' => implode(',', explode(',', $news_ids)));
             ###########################
             if (isset(CGlobal::$configs['NewsHomeHot'])) {
                 DB::update('configs', array("conf_val" => addslashes(serialize($config_update))), "conf_key='NewsHomeHot'", __FILE__ . " Dòng:" . __LINE__);
             } else {
                 DB::insert('configs', array("conf_key" => 'NewsHomeHot', "conf_val" => addslashes(serialize($config_update))), __FILE__ . " Dòng:" . __LINE__);
             }
             AZLib::get_config(0, 1);
         }
         if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) {
             $referer = $_SERVER['HTTP_REFERER'];
         } else {
             $referer = $_SERVER['REQUEST_URI'];
         }
         Url::redirect_url($referer);
     }
     Url::redirect_url($_SERVER['REQUEST_URI']);
 }
Ejemplo n.º 3
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();
     }
 }
Ejemplo n.º 4
0
 function AdminNews($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case "edit":
             case "add_item":
                 require_once 'forms/detail.php';
                 $this->add_form(new AdminNewsDetail());
                 break;
             case "delete":
                 $url = urldecode(Url::get('url'));
                 $id = Url::get('id');
                 if (!is_numeric($id)) {
                     Url::redirect('admin_news_item');
                     return;
                 }
                 DB::delete_id('news_item', $id);
                 eb_memcache::do_remove('news_item:' . $id);
                 Url::redirect_url($url);
                 break;
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new AdminNewsForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Ejemplo n.º 5
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();
     }
 }
Ejemplo n.º 6
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();
     }
 }
Ejemplo n.º 7
0
 function check_login()
 {
     if (!User::is_login()) {
         AZLib::check_uri();
         Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
     }
 }
Ejemplo n.º 8
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));
     }
 }
Ejemplo n.º 9
0
    function draw()
    {
        global $display;
        if (CGlobal::$curCategory) {
            $page_no = (int) Url::get('page_no', 1);
            if ($page_no <= 0) {
                $page_no = 1;
            }
            if (User::have_permit(ADMIN_ITEM)) {
                $subDir = 'list_item_admin';
            } else {
                $subDir = 'list_item';
            }
            //if(StaticCache::notExistCache('c'.CGlobal::$curCategory.'_'.$page_no,30,false,$subDir)){
            if (StaticCache::notExistCache('c' . CGlobal::$curCategory . '_' . $page_no, 1, FALSE, $subDir)) {
                StaticCache::startCache();
                $this->draw_from();
                StaticCache::endCache();
            }
            if (User::have_permit(ADMIN_ITEM)) {
                echo '<script>
						jQuery(document).ready(function(){		
							jQuery("div.admin_button").show();
							jQuery(".mod_menu").show();
						});
						
						function check_permit(catid){
							return true;
						}
					</script>';
            }
        } else {
            Url::redirect_url(WEB_DIR, 301);
        }
    }
Ejemplo n.º 10
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();
     }
 }
Ejemplo n.º 11
0
 function AdminBanner($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         switch (Url::get('cmd')) {
             case 'remove_banner':
                 $id = Url::get('id', 0);
                 if (empty($id)) {
                     Url::redirect_url('admin_banner.html');
                     exit;
                 }
                 Banner::delete_banner($id);
                 Url::redirect_url('admin_banner.html');
                 break;
             case 'edit_banner':
                 require_once 'forms/EditBanner.php';
                 $this->add_form(new EditBannerForm());
                 break;
             case 'list_banner':
                 require_once 'forms/ListBanner.php';
                 $this->add_form(new ListBannerForm());
                 break;
             default:
                 require_once 'forms/ListBanner.php';
                 $this->add_form(new ListBannerForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Ejemplo n.º 12
0
 function Signin($row)
 {
     Module::Module($row);
     switch (Url::get('cmd')) {
         case 'check_account':
             $this->check_account();
             exit;
         case 'check_email':
             $this->check_email();
             exit;
         case 'check_security_code':
             $this->check_security_code();
             exit;
         case 'check_email_format':
             $this->check_email_format();
             exit;
         default:
             if (!User::is_login()) {
                 require_once 'forms/signin.php';
                 $this->add_form(new SigninForm());
             } else {
                 $href = base64_decode(Url::get('href'));
                 if ($href) {
                     $href = str_replace('SID=' . $_COOKIE['PHPSESSID'], '', $href);
                     Url::redirect_url($href);
                 } else {
                     Url::redirect();
                 }
             }
             break;
     }
 }
Ejemplo n.º 13
0
Archivo: Edit.php Proyecto: hqd276/bigs
 function on_submit()
 {
     $type = intval(trim(Url::get('type')));
     $data = Url::get('data');
     if (empty($data['is_active'])) {
         $data['is_active'] = 0;
     }
     if (empty($data['id'])) {
         // if (!empty($data['name']) && faq::is_exists('name', $data['name'])) {
         //     $this->setErrorMessage('admin/faq/error', 'Exists faq with name: ' . $data['name']);
         //     Url::redirect_url('admin_faq.html?cmd=edit_faq');
         //     exit();
         // }
         // if (empty($data['name'])) {
         //     $this->setErrorMessage('admin/faq/error', 'faq name is null ');
         //     Url::redirect_url('admin_faq.html?cmd=edit_faq');
         //     exit();
         // }
         $data['created'] = TIME_NOW;
         $id = Faq::add_faq($data);
     } else {
         Faq::update_faq($data['id'], $data);
         $id = $data['id'];
     }
     Faq::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_faq.html?cmd=edit_faq&id=' . $id);
     } else {
         Url::redirect_url('admin_faq.html?cmd=edit_faq');
     }
     exit;
 }
 function SignIn($row)
 {
     Module::Module($row);
     if (User::is_login()) {
         if ($data = Session::get('user_data') and $data['home_page']) {
             Url::redirect_url($data['home_page']);
         } else {
             Url::redirect('home');
         }
     } else {
         // xoa toan bo du lieu dang co truoc khi dang nhap
         if (Session::is_set('user_id')) {
             $id = Session::get('user_id');
             DB::update('account', array('last_online_time' => time()), 'id=\'' . $id . '\'');
             setcookie('user_id', "", time() - 3600);
             Session::destroy('user_id');
         }
         //if(URL::get("m")== "mobile"){
         //	require_once 'forms/mlogin.php';
         //	$this->add_form(new SignInmForm);
         //}else{
         require_once 'forms/sign_in.php';
         $this->add_form(new SignInForm());
         //}
     }
 }
Ejemplo n.º 15
0
 function draw()
 {
     //xoa 1 id
     if (Url::get("act") == "del" && Url::get('id')) {
         DB::query('DELETE FROM ban_ip WHERE id=' . Url::get('id'));
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'act', 'id')));
     }
     global $display;
     //list
     $this->beginForm();
     $items = array();
     $sql = "SELECT * FROM ban_ip Order by id desc";
     $result = DB::query($sql);
     while ($row = mysql_fetch_assoc($result)) {
         $row['create_time'] = date('d/m - h:i', $row['create_time']);
         $items[$row['id']] = $row;
         $arr_mem_cache[$row['ip']] = $row;
     }
     // cho mang vao memcache
     AZMemcache::do_put('list_ban_ip', $arr_mem_cache);
     $display->add('items', $items);
     $display->add('items_json', json_encode($items));
     $display->output('ManageBanIp');
     $this->endForm();
 }
Ejemplo n.º 16
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['name'] = Url::get('name');
     $data['name_en'] = Url::get('name_en');
     if (empty($data['shortcut'])) {
         $data['shortcut'] = strtolower(EClassApi::safe_title($data['name']));
     } else {
         $data['shortcut'] = strtolower(EClassApi::safe_title(Url::get('shorcut')));
     }
     $data['description'] = Url::get('description');
     $data['description_en'] = Url::get('description_en');
     $data['keywords'] = Url::get('keywords');
     $data['is_active'] = Url::get('is_active');
     if (empty($data['name'])) {
         $this->setErrorMessage('news/category/error', 'Tên danh mục không được để trống');
         Url::redirect_current();
         return;
     }
     if (intval($id) == 0) {
         $id = DB::insert('news_category', $data);
         $this->setSuccessMessage('news/category/form', serialize($data));
         $this->setSuccessMessage('news/category/success', 'Lưu thông tin danh mục [' . $data['name'] . '] thành công');
     } else {
         DB::update('news_category', $data, 'id=' . $id);
         $this->setSuccessMessage('news/category/success', 'Cập nhật thông tin danh mục [' . $data['name'] . '] thành công');
     }
     Url::redirect_url('admin_news_category.html?cmd=edit&id=' . $id);
 }
Ejemplo n.º 17
0
    function on_submit()
    {
        $email = Url::get('email');
        $this->checkFormInput("Emal", 'email', $email, 'email', true);
        if (!$this->errNum) {
            if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) {
                $referer = $_SERVER['HTTP_REFERER'];
            } else {
                $referer = $_SERVER['REQUEST_URI'];
            }
            $email = Url::get('email');
            if ($email != '') {
                if (!DB::select('news_letter_email', 'email="' . $email . '"')) {
                    DB::insert('news_letter_email', array('email' => $email, 'time_add' => TIME_NOW));
                }
                AZNet::$extraFooter .= '<script>
										alert("Đăng ký nhận bản tin thành công, cảm ơn bạn đã sử dụng dịch vụ!"); 				
										window.location = "' . $referer . '";
								 	</script>';
                return;
            }
            Url::redirect_url($referer);
        } else {
            AZNet::$extraFooter .= '<script>
										alert("Email bạn nhập không đúng định dạng!"); 				
										document.NewsLetterForm.email.focus(); 
										document.NewsLetterForm.email.select();
								 	</script>';
            return;
        }
    }
Ejemplo n.º 18
0
 function PageAdmin($row)
 {
     Module::Module($row);
     if (User::is_root()) {
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'delete_all_cache':
                 EClass::update_all_page();
                 require_once ROOT_PATH . 'includes/enbac/dir.php';
                 empty_all_dir(PAGE_CACHE_DIR, true);
                 Url::redirect_current();
                 break;
             case 'refresh':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     EClass::update_page($id);
                     if (Url::check('href')) {
                         Url::redirect_url($_REQUEST['href']);
                     } else {
                         Url::redirect_current();
                     }
                 }
                 Url::redirect_current();
                 break;
             case 'delete':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     DB::delete('block', 'page_id=' . $id);
                     DB::delete_id('page', $id);
                     require_once ROOT_PATH . 'includes/enbac/dir.php';
                     empty_all_dir(DIR_CACHE . 'pages', true);
                     empty_all_dir(DIR_CACHE . 'modules', true);
                 }
                 Url::redirect_current();
                 break;
             case 'edit':
             case 'add':
             case 'copy':
                 require_once 'forms/edit.php';
                 $this->add_form(new EditPageAdminForm());
                 break;
             case 'export_xml':
                 require_once 'forms/export_xml.php';
                 $this->add_form(new ExportXmlPageAdminForm());
                 break;
             case 'import_xml':
                 require_once 'forms/import_xml.php';
                 $this->add_form(new ImportXmlPageAdminForm());
                 break;
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new ListPageAdminForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Ejemplo n.º 19
0
 function on_submit()
 {
     $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
     if (count($ids) > 0) {
         for ($i = 0; $i < count($ids); $i++) {
             DB::query('DELETE FROM bad_content WHERE id="' . $ids[$i] . '"');
         }
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id')));
     }
 }
Ejemplo n.º 20
0
 function on_submit()
 {
     $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
     if (count($ids) > 0) {
         for ($i = 0; $i < count($ids); $i++) {
             $this->delete_images($ids[$i]);
         }
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id')));
     }
 }
Ejemplo n.º 21
0
 function on_submit()
 {
     $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
     if (count($ids) > 0) {
         for ($i = 0; $i < count($ids); $i++) {
             Item::delete_item($ids[$i]);
         }
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'id', 'lock_die_all', 'hd_ac')));
     }
 }
Ejemplo n.º 22
0
 function draw()
 {
     global $display;
     $id = intval(Url::get('id', 0));
     if (!empty($id)) {
         $item = News::get_item($id);
     }
     if (empty($item)) {
         Url::redirect_url('/tin-tuc.html');
         exit;
     }
     if (!empty($item)) {
         if (!empty($item['category_id'])) {
             $categories = NewsCategory::get_by_ids($item['category_id']);
         }
         if ($item['is_active'] == 0) {
             Url::redirect_url('/tin-tuc.html');
             exit;
         }
         if ($item['uid'] > 0) {
             $author = User::getUserById($item['uid']);
             // var_dump($author);die;
             if ($author['full_name'] == '') {
                 $item['author'] = $author['user_name'];
             } else {
                 $item['author'] = $author['full_name'];
             }
         }
         $item['view'] += 1;
         News::update_view(array('view' => $item['view']), 'id=' . $id);
     }
     $tags = News::render_tags($item['keywords']);
     $related_items = NewsCategory::get_top_news($item['category_id'], 4);
     if (count($related_items > 0)) {
         foreach ($related_items as $key => $value) {
             // $list_news[$key]['title'] = Util::split_char($value['title'],40,-1) . ' ...';
             if ($value['uid'] > 0) {
                 $author = User::getUserById($value['uid']);
                 // var_dump($author);die;
                 if ($author['full_name'] == '') {
                     $related_items[$key]['author'] = $author['user_name'];
                 } else {
                     $related_items[$key]['author'] = $author['full_name'];
                 }
             }
         }
     }
     $display->add('roots', NewsCategory::get_categories());
     $display->add('item', $item);
     $display->add('tags', $tags);
     $display->add('related_items', $related_items);
     $display->add("categories", $categories);
     $display->output("Detail");
 }
Ejemplo n.º 23
0
 function on_submit()
 {
     if (User::have_permit(ADMIN_ADV)) {
         $status = (int) Url::get('status', 0);
         $url_detail = Url::get('url');
         $type = (int) Url::get('type', 0);
         $config_arr = array('status' => (int) $status, 'url_detail' => $url_detail, 'type' => (int) $type);
         if (isset($_FILES['banner']) && $_FILES['banner']['error'] == 0) {
             $banner_file = ROOT_PATH . 'promotion/popup';
             //$file_ext=strtolower(substr($_FILES['banner']['name'],strlen($_FILES['banner']['name'])-4,4));
             $file_ext = AZLib::getExtension($_FILES['banner']['name']);
             if ($type == 0) {
                 if (in_array($file_ext, array('.jpg', '.gif'))) {
                     if (getimagesize($_FILES['banner']['tmp_name'])) {
                         if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . '.gif')) {
                             $this->setFormError('banner', 'Không up load được Banner!');
                             return;
                         }
                     } else {
                         $this->setFormError('banner', 'Sai định dạng ảnh!');
                         return;
                     }
                 } else {
                     $this->setFormError('banner', 'Chỉ chấp nhận các định dạng file .jpg , .gif !');
                     return;
                 }
             } else {
                 if (in_array($file_ext, array('.swf'))) {
                     if (!move_uploaded_file($_FILES['banner']['tmp_name'], $banner_file . $file_ext)) {
                         $this->setFormError('banner', 'Không up load được Banner!');
                         return;
                     }
                 } else {
                     $this->setFormError('banner', 'Flash đại diện chỉ chấp nhận các định dạng file .swf');
                     return;
                 }
             }
         }
         $_SESSION['adv_cover_top'] = 0;
         if (isset(CGlobal::$configs['AdvCover'])) {
             DB::update('configs', array("conf_val" => addslashes(serialize($config_arr))), "conf_key='AdvCover'");
         } else {
             DB::insert('configs', array("conf_key" => 'AdvCover', "conf_val" => addslashes(serialize($config_arr))));
         }
         AZLib::get_config(0, 1);
     }
     if (isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER']) {
         $referer = $_SERVER['HTTP_REFERER'];
     } else {
         $referer = $_SERVER['REQUEST_URI'];
     }
     Url::redirect_url($referer);
 }
Ejemplo n.º 24
0
 function on_submit()
 {
     $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
     if (count($ids) > 0) {
         $all_id = '';
         for ($i = 0; $i < count($ids); $i++) {
             $all_id .= $ids[$i] . ',';
         }
         $all_id = substr($all_id, 0, -1);
         AdminNotice::delNoticeUser($all_id);
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id')));
     }
 }
Ejemplo n.º 25
0
Archivo: list.php Proyecto: hqd276/bigs
 function __construct()
 {
     $this->link_css('style/ec_block.css');
     $this->link_js('javascript/ec_block.js');
     $this->link_js('javascript/default/search.js');
     $keyword = Url::get('keyword');
     if (!$keyword) {
         $keyword = Url::get('keyword_mobile');
     }
     if (!$keyword) {
         Url::redirect_url('/');
     }
     CGlobal::$website_title = ' Tìm kiếm theo từ khóa "' . $keyword . '"';
 }
Ejemplo n.º 26
0
 function on_submit()
 {
     if (Url::get("del_all") == "Xóa Từ Xấu") {
         $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
         $bw_ids = '';
         if (count($ids) > 0) {
             for ($i = 0; $i < count($ids); $i++) {
                 $bw_ids .= ($bw_ids ? ',' : '') . $ids[$i];
             }
             DB::query('DELETE FROM bad_words WHERE id IN(' . $bw_ids . ')');
             Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'contents')));
         }
     }
 }
Ejemplo n.º 27
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['title'] = Url::get('title');
     $data['title_en'] = Url::get('title_en');
     $data['category_id'] = intval(trim(Url::get('category_id', 0)));
     $data['description'] = Url::get('description');
     $data['description_en'] = Url::get('description_en');
     $data['content'] = Url::get('content');
     $data['content_en'] = Url::get('content_en');
     $data['image'] = '';
     $data['keywords'] = Url::get('keywords');
     $data['post_day'] = trim(Url::get('post_day'));
     if (!empty($data['post_day'])) {
         $data['post_day'] = EClassApi::render_time($data['post_day']);
     } else {
         $data['post_day'] = time();
     }
     $data['is_active'] = Url::get('is_active', 0);
     $data['hot_article'] = Url::get('hot_article', 0);
     $data['top_home'] = Url::get('top_home', 0);
     if (empty($data['shortcut'])) {
         $data['shortcut'] = strtolower(EClassApi::safe_title($data['title']));
     } else {
         $data['shortcut'] = strtolower(EClassApi::safe_title(Url::get('shorcut')));
     }
     if (isset($_FILES["file"]) && $_FILES["file"]["size"] > 0) {
         $store_in = 'files/news/' . date('Y/m/d') . '/';
         if (!file_exists($store_in)) {
             mkdir($store_in, 0775, true);
         }
         move_uploaded_file($_FILES["file"]["tmp_name"], $store_in . $_FILES["file"]["name"]);
         $data['image'] = $store_in . $_FILES["file"]["name"];
     } else {
         unset($data['image']);
     }
     if (intval($id) == 0) {
         $data['uid'] = User::id();
         $id = DB::insert('news_item', $data);
         $this->setSuccessMessage('news/item/form', serialize($data));
         $this->setSuccessMessage('news/item/success', 'Lưu thông tin bài viết [' . $data['title'] . '] thành công');
     } else {
         DB::update('news_item', $data, 'id=' . $id);
         $this->setSuccessMessage('news/item/success', 'Cập nhật thông tin bài viết [' . $data['title'] . '] thành công');
     }
     Url::redirect_url('admin_news_item.html?cmd=edit&id=' . $id);
     eb_memcache::do_remove('news_item:' . $id);
 }
Ejemplo n.º 28
0
 function on_submit()
 {
     global $oDB;
     $admin_comment = Url::get('admin_comment');
     $act = Url::get('act');
     $status = 1;
     if ($act == 'UnPublish') {
         $status = 0;
     }
     DB::update('news', array('status' => $status, 'time_modify' => TIME_NOW, 'user_modify' => User::user_name(), 'admin_comment' => addslashes(Url::get('admin_comment'))), 'id=' . $this->news['id']);
     if (Url::get('href')) {
         Url::redirect_url(urldecode(Url::get('href')));
     } else {
         Url::redirect_current();
     }
 }
Ejemplo n.º 29
0
 function on_submit()
 {
     $id = intval(Url::get('id'));
     $data['full_name'] = Url::get('full_name', '');
     $data['user_name'] = Url::get('user_name', '');
     // $data['email'] = Url::get('email','');
     if (intval($id) == 0) {
         $data['create_time'] = time();
         $data['password'] = '******';
         $id = DB::insert('account', $data);
         $this->setSuccessMessage('user/item/success', 'Lưu thông tin <strong>[' . $data['user_name'] . ']</strong> thành công');
     } else {
         DB::update('account', $data, 'id=' . $id);
         $this->setSuccessMessage('user/item/success', 'Cập nhật thông tin <strong>[' . $data['user_name'] . ']</strong> thành công');
     }
     Url::redirect_url('/user.html?cmd=edit&id=' . $id);
 }
Ejemplo n.º 30
0
 function on_submit()
 {
     $class_ids = Url::get('class_ids');
     $class_ids = implode(',', $class_ids);
     $list_class = Classes::get_collection(null, ' id IN (' . $class_ids . ') ');
     $total = 0;
     foreach ($list_class as $c) {
         $total = $total + $c['price'];
     }
     $user = PersonalDB::get_account_information();
     if ($user['coin'] >= $total) {
         foreach ($list_class as $class) {
             if ($class['price'] > 0) {
                 $paid = DB::select('student_paid', ' uid =' . User::id() . ' AND cid=' . $class['id']);
                 if (!$paid) {
                     if (intval(date('d')) < 5) {
                         $month = date('n');
                     } else {
                         $month = date('n', strtotime('+1 month'));
                     }
                     $data = array('uid' => User::id(), 'price' => $class['price'], 'cid' => $class['id'], 'time' => time(), 'month' => $month);
                     DB::insert('student_paid', $data);
                 } else {
                     if (intval(date('d')) < 5) {
                         $month = date('n');
                     } else {
                         $month = date('n', strtotime('+1 month'));
                     }
                     $data = array('price' => $class['price'], 'time' => time(), 'month' => $month);
                     DB::update_id('student_paid', $data, $paid['id']);
                 }
             }
         }
         $coin = $user['coin'] - $total;
         $new_coin = array('coin' => $coin);
         PersonalDB::update_account_information($new_coin);
         $this->setSuccessMessage('personal/extra_time', 'Gia hạn thành công, chúc bạn học tập tốt!');
         //Url::redirect_url('personal.html?cmd=extra_time');
     } else {
         $this->setErrorMessage('personal/extra_time', "Số tiền trong tài khoản của bạn không đủ để gia hạn, xin vui lòng nạp thêm!");
         Url::redirect_url('personal.html?cmd=extra_time');
         exit;
     }
     Url::redirect_url('personal.html?cmd=extra_time');
 }