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 check_login()
 {
     if (!User::is_login()) {
         EClassApi::check_uri();
         Url::redirect_url('?page=signin&href=' . base64_encode(CGlobal::$query_string));
     }
 }
Ejemplo n.º 3
0
    static function get_fees($pid = null) {
        $fees = unserialize(self::get_key('fees'));
        if (empty($fees) || !is_array($fees)) {
            return null;
        }
        $list_city = City::get_list(true);

        $list_district = District::get_list(true, $pid);

        $list_fee = array();
        if (!empty($fees)) {
            foreach ($fees as $did => $fee) {
                if (!empty($list_district[$did])) {
                    $fee['city'] = $list_city[$fee['cid']];
                    $fee['district'] = $list_district[$did];
                    $fee['delivery_fee_formatted'] = EClassApi::numberFormat($fee['delivery_fee']);
                    $fee['min_order_formatted'] = EClassApi::numberFormat($fee['min_order']);
                    $fee['min_order_fee_formatted'] = EClassApi::numberFormat($fee['min_order_fee']);
                    $fee['free_delivery_formatted'] = EClassApi::numberFormat($fee['free_delivery']);
                    $list_fee[$did] = $fee;
                }
            }
        }

        return $list_fee;
    }
Ejemplo n.º 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();
     }
 }
Ejemplo n.º 5
0
Archivo: edit.php Proyecto: hqd276/bigs
 function draw()
 {
     $this->beginForm();
     if (Url::get('cmd') == 'edit' && ($row = DB::select('bad_words', 'id=' . intval(EClassApi::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();
 }
Ejemplo n.º 6
0
 function piclens_gallery()
 {
     $item_id = EClassApi::getParam('item_id');
     $entry = '';
     if ($item_id) {
         $sql = 'select id, original_image_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['original_image_url'])) {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['original_image_url']}"));
                 } else {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['original_image_url']}"));
                 }
                 $entry .= "\n\t\t \t \t<item>\n\t\t \t \t\t\t<title>" . stripslashes($rows['title']) . "</title>\n\t\t\t\t\t\t<link>{$url}</link>\n\t\t\t\t\t\t<guid>Image {$rows['position']}</guid>\n\t\t\t\t\t\t<media:thumbnail url=\"{$url}\" />\n\t\t\t\t\t\t<media:content url=\"{$url}\" />\n\t\t\t\t</item>\n\t\t \t \t";
             }
             @header("Content-type: text/xml");
             echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n\t\t\t <rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">\n\t\t\t <channel>\t\t\t\n\t\t\t <title>Enbac.com</title>\n\t\t\t <link>http://www.chonmon.vn/</link>\n\t\t\t <description>Enbac.com - </description>\n\t\t\t <logo url=\"style/images/logo.piclens.png\" />\n\t\t\t";
             echo $entry;
             echo "\n\t\t \t </channel>\n\t\t\t </rss>\n\t\t\t";
         } else {
             die("no_info");
         }
     } else {
         die("no_info");
     }
 }
Ejemplo n.º 7
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.º 8
0
 function draw()
 {
     $this->beginForm();
     global $display;
     $user_id = intval(Url::get('user_id'));
     $user_info = DB::select('account', '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 = '';
         require_once ROOT_PATH . 'core/ECPagging.php';
         $paging = ECPagging::pagingSE($limit, $total, $item_per_page, 10, 'page_no', true, 'Giao dịch', 'Trang');
         $sql = 'SELECT id,name,created_time,up_time,up_count,user_id,user_name,status FROM item WHERE user_id = "' . $user_id . '" AND ' . $search_value . ' ORDER BY up_time  DESC ' . $limit;
         $result = DB::query($sql);
         if ($result) {
             while ($row = mysql_fetch_assoc($result)) {
                 $row['ebname'] = EClassApi::safe_title($row['name']);
                 $row['up_time'] = date('d/m/y H:i', $row['up_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();
 }
Ejemplo n.º 9
0
/**
 * Smarty is_image modifier plugin
 *
 * Type:     modifier<br>
 * Name:     is_image<br>
 * Purpose:  check a string is image or not
 * @author   Linhph
 * @param string
 * @return integer
 */
function smarty_modifier_is_image($string)
{
    $file_ext = strtolower(EClassApi::getExtension($string));
    if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 10
0
 function on_submit()
 {
     $us = trim(Url::get('user_name_this', ''));
     $pa = Url::get('password_this', '');
     $err = false;
     if ($us == '') {
         $err = true;
         $this->setErrorMessage('dangnhap', 'Bạn chưa nhập Tên tài khoản!');
     }
     if ($pa == '') {
         $err = true;
         $this->setErrorMessage('dangnhap', 'Bạn chưa nhập Mật khẩu!');
     }
     if (!$err) {
         $data = "u=" . $us . "&p=" . $pa;
         $loginInfo = json_decode(EClassApi::execPostRequest(CGlobal::$login_url, $data), true);
         // var_dump($loginInfo);die;
         if ($loginInfo['s']) {
             $user = $loginInfo['v']['u'];
             $user['t'] = $loginInfo['v']['t'];
             $u = User::getUserById($user['id']);
             if (!$user['fn']) {
                 $user['fn'] = $user['un'];
             }
             if (!$u) {
                 // user chua co trong db => clone
                 $data = array('id' => $user['id'], 'user_name' => $user['un'], 'full_name' => $user['fn'], 'avatar_url' => $user['av']);
                 $id = DB::insert('account', $data);
             } else {
                 DB::update('account', array('full_name' => $user['fn']), 'id=' . $user['id']);
             }
             $_SESSION['token'] = $loginInfo['t'];
             User::LogIn2($user);
             header('Location:' . STATIC_URL);
         } else {
             switch ($regInfo['m']) {
                 case 2:
                     $this->setErrorMessage('dangnhap', 'Hệ thống lỗi, xin vui lòng quay lại sau');
                     break;
                 case 4:
                     $this->setErrorMessage('dangnhap', 'Tài khoản chưa kích hoạt');
                     break;
                 case 5:
                     $this->setErrorMessage('dangnhap', 'Tên tài khoản không được để trống');
                     break;
                 case 6:
                     $this->setErrorMessage('dangnhap', 'Tên tài khoản không được chứa kí tự đặc biệt');
                     break;
                 default:
                     $this->setErrorMessage('dangnhap', 'Hệ thống lỗi, xin vui lòng quay lại sau');
             }
         }
     }
 }
Ejemplo n.º 11
0
    function playme() {
        $code = EClassApi::getParam('code');

        if (method_exists($this, $code))
		{
            $this->$code();
        }
        else
        {
            $this->home();
        }
    }
Ejemplo n.º 12
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'search_more':
             $this->search_more();
             break;
         default:
             $this->search_more();
             break;
     }
 }
Ejemplo n.º 13
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'trans':
             $this->transaction();
             break;
         default:
             $this->home();
             break;
     }
 }
Ejemplo n.º 14
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $display->add('mode', "Thêm");
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('user_name', Url::get('user_name', $this->a_row['user_name']));
     $status_arr = array(0 => "Chưa KH", 1 => "Đã KH", 2 => "Vi phạm, không KH");
     $display->add('status_option', EClassApi::getOption($status_arr, Url::get('status', $this->a_row['status'])));
     $display->add('sms_total', Url::get('sms_total', $this->a_row['sms_total']));
     $display->add('note', Url::get('note', $this->a_row['note']));
     $display->output('UserActiveAdd');
     $this->endForm();
 }
Ejemplo n.º 15
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'home':
             $this->home();
             break;
         default:
             $this->home();
             break;
     }
     //$print->html = $skin->index();
     //$print->display();
 }
Ejemplo n.º 16
0
 static function cache($sql, $call_pos = '', $expire = 3600, $update_type = 0, $key = '', $subDirCache = '', $del_cache = false)
 {
     // $update_type:
     // 0: auto
     // 1: Xoá cache ( multi server ) và tạo lại cache
     // 2: Tạo lại cache
     if (!self::is_select($sql)) {
         self::$result = DB::query($sql, $call_pos);
         return;
     }
     if ($subDirCache != '') {
         self::$subDir = $subDirCache;
     } else {
         self::$subDir = 'system';
     }
     if (CACHE_ON && EClassApi::CheckDir(DIR_CACHE . 'db/' . self::$subDir . '/', MEMCACHE_ON)) {
         self::$key = $key ? $key : md5($sql);
         if ($del_cache) {
             self::auto_delete(self::_my_file());
             return true;
         }
         if ($expire < 0) {
             $expire = 0;
         }
         self::$expire = $expire;
         if ($update_type == 1) {
             self::auto_delete(self::_my_file());
             $result = false;
             //$result = self::get();
         } else {
             $result = self::get();
         }
         if ($result === false) {
             $result = self::getRows($sql, $call_pos);
             self::set($result);
         } else {
             if (DEBUG) {
                 if (class_exists('Module') && Module::$name != '') {
                     $module_name = Module::$name;
                 } else {
                     $module_name = "-- Enbac system";
                 }
                 CGlobal::$query_debug .= "<table width='95%' border='1' cellpadding='6' cellspacing='0' bgcolor='#FEFEFE'  align='center'>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t <td style='font-size:14px' bgcolor='#EFEFEF'><span style='color:green'><b>Query cache</b> -- Module : <span style='color:red;font-weight:bold'>" . $module_name . "</span></span> " . ($call_pos ? "<br /><b>Run at:</b> {$call_pos}" : "") . "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t <td style='font-family:courier, monaco, arial;font-size:14px;color:green'>{$sql}</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t <td style='font-size:14px' bgcolor='#EFEFEF'>[ Cache time : {$expire}s  - <b>Created:</b> " . date('d/m/Y H:i:s', self::$createdTime) . "<b> Expire:</b> " . (self::$expire ? date('d/m/Y H:i:s', self::$createdTime + self::$expire) : 'forever') . " ]<br /><b>File:</b> " . DIR_CACHE . 'db/' . self::_my_file() . "</span></td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t       </table><br />\n\n";
             }
         }
     } else {
         $result = self::getRows($sql, $call_pos);
     }
     return $result;
 }
Ejemplo n.º 17
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'change_item':
             $this->change_item();
             break;
         case 'change_status':
             $this->change_status();
             break;
         default:
             $this->change_item();
             break;
     }
 }
Ejemplo n.º 18
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'show_more':
             $this->show_more();
             break;
         case 'show_detail':
             $this->show_detail();
             break;
         default:
             $this->show_more();
             break;
     }
 }
Ejemplo n.º 19
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'piclens_gallery':
             $this->piclens_gallery();
             break;
         case 'flash_view_gallery':
             $this->flash_view_gallery();
             break;
         default:
             $this->home();
             break;
     }
 }
Ejemplo n.º 20
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.º 21
0
 function on_submit()
 {
     $content = Url::get('content');
     if (get_magic_quotes_gpc()) {
         $content = stripslashes($content);
     }
     $this->checkFormInput('Nội dung', 'content', $content, 'str', false);
     if (!$this->errNum) {
         if (isset(CGlobal::$configs['VI_Info_' . EClass::$page['name']])) {
             DB::update('configs', array("conf_val" => $content), "conf_key='VI_Info_" . EClass::$page['name'] . "'");
         } else {
             DB::insert('configs', array("conf_key" => 'VI_Info_' . EClass::$page['name'], "conf_val" => $content));
         }
         EClassApi::get_config(0, 1);
         Url::redirect_current();
     }
 }
Ejemplo n.º 22
0
 static function is_not_cached($a_name = '', $expire = 3600, $subDirCache = '', $del_cache = false)
 {
     self::$arr_cache = array();
     if (CACHE_ON) {
         $c_name = ($subDirCache ? $subDirCache . '/' : '') . $a_name;
         self::$cache_file = $c_name;
         if ($del_cache || isset($_GET['delscache']) && (int) $_GET['delscache'] == '1') {
             self::del_cache($c_name);
             return true;
         }
         self::$expire = $expire < 0 ? 0 : $expire;
         if (MEMCACHE_ON) {
             self::$arr_cache = eb_memcache::do_get("acache:{$c_name}");
             if (!empty(self::$arr_cache)) {
                 if (DEBUG) {
                     $info = "<br /><font color=red><b>" . self::$cache_file . "</b></font><br /><b>Cache Time:</b> " . self::$expire . "s ";
                     if (!self::$expire) {
                         $info .= "<b> Expire:</b> forever";
                     }
                     self::$cache_list .= "<li>" . $info . "</li>";
                 }
                 return false;
             }
         } elseif (EClassApi::CheckDir(DIR_CACHE . 'arr/' . ($subDirCache ? $subDirCache . '/' : ''), MEMCACHE_ON)) {
             self::$cache_file = DIR_CACHE . 'arr/' . $c_name . '.eb';
             if (file_exists(self::$cache_file)) {
                 self::$createdTime = filemtime(self::$cache_file);
                 if (self::$expire == 0 || self::$expire > 0 && TIME_NOW < self::$createdTime + self::$expire) {
                     self::$arr_cache = unserialize(stripslashes(@file_get_contents(self::$cache_file)));
                     if (DEBUG) {
                         $info = "<br /><font color=red><b>" . self::$cache_file . "</b></font><br /><b>Cache Time:</b> " . self::$expire . "s ";
                         $info .= "<b>Created:</b> " . date('d/m/Y H:i:s', self::$createdTime);
                         if (self::$expire > 0) {
                             $info .= "<b> Expire:</b> " . date('d/m/Y H:i:s', self::$expire + self::$createdTime);
                         } else {
                             $info .= "<b> Expire:</b> forever";
                         }
                         self::$cache_list .= "<li>" . $info . "</li>";
                     }
                     return false;
                 }
             }
         }
     }
     return true;
 }
Ejemplo n.º 23
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'show_more_teacher':
             $this->show_more_teacher();
             break;
         case 'search_more':
             $this->search_more();
             break;
         case 'filter_more':
             $this->filter_more();
             break;
         default:
             $this->show_more();
             break;
     }
 }
Ejemplo n.º 24
0
	function __construct($row){

		Module::Module($row);
		require_once 'forms/header.php';
		
		$str_keywords 	= '';
		$str_catSub 	= '';		
		$meta_desc 		= '';
		
		//limit character description and keyword
		CGlobal::$keywords = EClassApi::word_limit(CGlobal::$keywords,20,'');
		CGlobal::$meta_desc = EClassApi::word_limit(CGlobal::$meta_desc,250,'');
			
		//Gán title cho các trang trong!
		if(isset($page_title_arr[EClass::$page['name']])){
			CGlobal::$website_title = $page_title_arr[EClass::$page['name']].' | '.CGlobal::$website_title;
		}

		$this->add_form(new HeaderForm);
	}
Ejemplo n.º 25
0
 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']) && Banner::is_exists('name', $data['name'])) {
         //     $this->setErrorMessage('admin/banner/error', 'Exists banner with name: ' . $data['name']);
         //     Url::redirect_url('admin_banner.html?cmd=edit_banner');
         //     exit();
         // }
         // if (empty($data['name'])) {
         //     $this->setErrorMessage('admin/banner/error', 'Banner name is null ');
         //     Url::redirect_url('admin_banner.html?cmd=edit_banner');
         //     exit();
         // }
         $data['created'] = TIME_NOW;
         $path = Banner::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         $id = Banner::add_banner($data);
     } else {
         $path = Banner::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         Banner::update_banner($data['id'], $data);
         $id = $data['id'];
     }
     Banner::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_banner.html?cmd=edit_banner&id=' . $id);
     } else {
         Url::redirect_url('admin_banner.html?cmd=edit_banner');
     }
     exit;
 }
Ejemplo n.º 26
0
 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']) && About::is_exists('name', $data['name'])) {
             $this->setErrorMessage('admin/about/error', 'Exists about with name: ' . $data['name']);
             Url::redirect_url('admin_about.html?cmd=edit_about');
             exit;
         }
         if (empty($data['name'])) {
             $this->setErrorMessage('admin/about/error', 'About name is null ');
             Url::redirect_url('admin_about.html?cmd=edit_about');
             exit;
         }
         $data['created'] = TIME_NOW;
         $path = About::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         $id = About::add_about($data);
     } else {
         $path = About::upload_file(EClassApi::safe_title($data['name']));
         if ($path) {
             $data['path'] = $path;
         }
         About::update_about($data['id'], $data);
         $id = $data['id'];
     }
     About::remove_cache($id);
     $add_new = intval(trim(Url::get('add_new', 0)));
     if (empty($add_new)) {
         Url::redirect_url('admin_about.html?cmd=edit_about&id=' . $id);
     } else {
         Url::redirect_url('admin_about.html?cmd=edit_about');
     }
     exit;
 }
Ejemplo n.º 27
0
 function playme()
 {
     $code = EClassApi::getParam('code');
     switch ($code) {
         case 'check_lesson_teacher':
             $this->lessonTeacher();
             break;
         case 'choice_lesson_teacher':
             $this->choiceTeacher();
             break;
         case 'request_product':
             $this->requestProduct();
             break;
         case 'show_content':
             $this->show_content();
             break;
         default:
             $this->home();
             break;
     }
 }
Ejemplo n.º 28
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();
 }
Ejemplo n.º 29
0
	function addPerm()
	{
		$res = DB::query("SELECT * FROM module");
		
		$perm= array();

		while($r = @mysql_fetch_assoc($res))
		{
			if($r['name'] != '.svn' && file_exists(DIR_MODULE.$r['name'].'/class.php'))
			{
				require_once DIR_MODULE.$r['name'].'/class.php';

				eval('if(method_exists("'.$r['name'].'","permission"))
					  {
					    $tmp = '.$r['name'].'::permission();

						if($tmp)
						{
							foreach($tmp as $id=>$val)
							{
								unset($tmp["$id"]);
								
								$id = str_replace(\' \',\'_\',$id);
								
								$tmp["$id"] = trim($val);
							}
							
							$perm["'.$r['name'].'"] = $tmp;
						}
					}');
			}
		}
		
		$perm = serialize($perm);
		
		DB::insert("configs", array('conf_key' => 'site_permission', 'conf_val' => $perm),true);
		
		EClassApi::get_config(1);
	}
Ejemplo n.º 30
0
 function draw()
 {
     global $display;
     $arrVar = array();
     $this->beginForm(0);
     EClassApi::getCats();
     $categories = eb_memcache::do_get('categories_new');
     if (!is_array($categories)) {
         //if($total){
         require_once ROOT_PATH . 'core/ECPagging.php';
         $re = DB::query("SELECT * FROM products_category  order by orders");
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 $categories[$row['parent_id']][$row['id']] = $row;
             }
         }
         eb_memcache::do_put('categories_new', $categories);
     }
     $arrVar['zones'] = CGlobal::$allZones;
     $display->templateAdvance = TRUE;
     $display->setTemplate('ManageFilterSync', $arrVar);
     $this->endForm();
 }