Пример #1
0
 function __construct()
 {
     Form::Form('NewsDetailForm');
     $id = Url::get('news_id', 0);
     if ($id) {
         if (!CGlobal::$news_details) {
             CGlobal::$news_details = DB::select("news", "id={$id}");
         }
         if (CGlobal::$news_details && (CGlobal::$news_details['status'] == 1 || CGlobal::$news_details['status'] == 0 && User::have_permit(ADMIN_NEWS))) {
             $this->news = CGlobal::$news_details;
         }
     }
     if (!$this->news) {
         Url::redirect('news_list', array('news_catid', 'azname'));
     } else {
         DB::query("UPDATE news SET view_num=view_num+1 WHERE id =" . $this->news['id']);
     }
     $news_title = $this->news['title'];
     $catid = $this->news['news_catid'];
     $str_keywords = '';
     $str_catSub = '';
     $meta_keywords = '';
     $meta_desc = '';
     if (isset(CGlobal::$allNewsCategories[$catid])) {
         $news_title .= " - " . CGlobal::$allNewsCategories[$catid]['name'];
         $curMainCat = CGlobal::$allNewsCategories[$catid];
         $str_catSub = $curMainCat['name'];
         if ($curMainCat['keywords']) {
             $meta_keywords .= ($meta_keywords ? ', ' : '') . $curMainCat['keywords'];
         }
         if ($curMainCat['description']) {
             $meta_desc .= ($meta_desc ? ', ' : '') . $curMainCat['description'];
         }
     }
     if ($this->news['brief']) {
         CGlobal::$meta_desc = AZLib::cleanHtml($this->news['brief']);
     } elseif ($meta_desc != '') {
         CGlobal::$meta_desc = $meta_desc;
     }
     if ($meta_keywords != '') {
         CGlobal::$keywords = $meta_keywords;
     } elseif ($str_catSub != '') {
         CGlobal::$keywords = $str_catSub;
     }
     CGlobal::$website_title = stripslashes($news_title) . ' - Tin tức';
     //CGlobal::$website_title = AznetLib::subString($news_title,0,100,true);
     //		$this->link_css('style/aznet/jquery.lightbox.css');
     //		$this->link_js('javascript/jquery/lightbox/jquery.lightbox.js');
 }
Пример #2
0
 function send_pm()
 {
     if (User::is_login()) {
         $user_id = (int) Url::get('user_id');
         $title_pm = AZLib::getParam('title_pm');
         $content_pm = AZLib::cleanHtml(AZLib::getParam('content_pm'));
         if (!$user_id) {
             echo "false_send";
             exit;
         }
         if (AZLib::isBlackList(User::id(), $user_id)) {
             echo "blacklist";
             exit;
         }
         if (User::id() == $user_id) {
             echo "no_send_yourself";
             exit;
         }
         if ($title_pm == '' || $title_pm == 'Tiêu đề') {
             echo "no_title";
             exit;
         } elseif ($content_pm == '') {
             echo "no_content";
             exit;
         }
         $receiver_user = User::getUser($user_id);
         $id_mess = AZLib::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm);
         if ($id_mess) {
             echo "success";
             exit;
         } else {
             echo "false_send";
             exit;
         }
     } else {
         echo "not_login";
         exit;
     }
 }
Пример #3
0
echo CGlobal::$js_ver;
?>
"></script>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
?>
javascript/enbac/header.js?v=<?php 
echo CGlobal::$js_ver;
?>
"></script>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
?>
javascript/mudim.packed.js?v=0.8-r142"></script>
<?php 
if (Url::get('keywords') && AZLib::trimSpace(AZLib::cleanHtml(Url::get('keywords')))) {
    echo '<script type="text/javascript" src="' . STATIC_URL . 'javascript/jquery/packed/jquery.highlight-2.js"></script>';
}
?>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
?>
javascript/tooltip.js"></script>

<script>$eb = jQuery.noConflict();
</script>
<?php 
echo AZNet::$extraHeader;
echo AZNet::$extraHeaderJS;
if (!DEBUG) {
    ?>
Пример #4
0
 function gallery_update()
 {
     //Cập nhật ảnh cho thư viện
     if (User::have_permit(ADMIN_IMAGE) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
         $user_id = (int) Url::get('user_id', 0);
     } else {
         $user_id = User::id();
     }
     $image_id = (int) $_GET['image_id'];
     $json['error'] = 'not_updated';
     //not_uploaded
     $json['url_error'] = '';
     $json['img_url'] = '';
     if (User::is_login()) {
         if (User::is_az_team() || User::level() > 0) {
             if ($image_id) {
                 $des = substr(AZLib::trimSpace(AZLib::cleanHtml($_POST['des_update'])), 0, 50);
                 $image = DB::select('item_image', 'id=' . $image_id . ' AND root_id=0 AND user_id=' . $user_id);
                 if ($image) {
                     $upload_path = AZLib::folderUpload($user_id);
                     if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
                         //Check dir for upload
                         if (isset($_FILES['img_upload_update']) && !$_FILES['img_upload_update']['error'] && $_FILES['img_upload_update']['name']) {
                             if (getimagesize($_FILES['img_upload_update']['tmp_name']) && $_FILES['img_upload_update']['size'] <= Item::MAX_UPLOAD_SIZE) {
                                 $file_name = $_FILES['img_upload_update']['name'];
                                 $sourceName = $_FILES['img_upload_update']['tmp_name'];
                                 $file_ext = AZLib::getExtension($file_name);
                                 if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                                     $img_url = $upload_path . date("YmdHis", TIME_NOW) . '_' . substr(AZLib::make_safe_name(basename(strtolower($file_name), $file_ext)), 0, 36) . $file_ext;
                                     if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                         if (DB::update('item_image', array('des' => $des, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url), 'id=' . $image_id . ' OR root_id=' . $image_id)) {
                                             if ($image['img_url']) {
                                                 AZLib::ftp_image_delete_file($image['img_url'], $image['img_server']);
                                                 if (MEMCACHE_ON) {
                                                     $sql = "SELECT * FROM item\tWHERE img_url='{$image['img_url']}' AND status IN(1,2)  AND user_id=" . $user_id;
                                                     $re = DB::query($sql);
                                                     while ($item_memcache = mysql_fetch_assoc($re)) {
                                                         $item_memcache['img_server'] = IMAGE_SERVER_NO;
                                                         $item_memcache['img_url'] = $img_url;
                                                         AZMemcache::do_put("item:" . $item_memcache['id'], $item_memcache);
                                                     }
                                                 }
                                                 DB::query("UPDATE item SET img_server = " . (int) IMAGE_SERVER_NO . ", img_url='{$img_url}' WHERE img_url='{$image['img_url']}' AND status IN(1,2)  AND user_id=" . $user_id);
                                             }
                                             $json['img_server'] = IMAGE_SERVER_NO;
                                             $json['img_url'] = $img_url;
                                             $json['error'] = 'success';
                                         } else {
                                             $json['error'] = 'not_updated';
                                         }
                                     }
                                 } else {
                                     $json['error'] = 'ext_invalid';
                                     //Sai định dạng file
                                 }
                             } else {
                                 $json['error'] = 'over_max_size';
                                 //Sai định dạng file hoặc upload dung lượng quá lớn
                             }
                         } elseif ($_POST['url_update']) {
                             $url = $_POST['url_update'];
                             $tem_cache_dir = DIR_CACHE . 'user_images/';
                             AZLib::CheckDir($tem_cache_dir);
                             $tem_cache_file = User::user_name() . md5($url) . '.gif';
                             $image_content = disguise_curl($url);
                             if ($image_content) {
                                 if (@file_put_contents($tem_cache_dir . $tem_cache_file, $image_content)) {
                                     if (getimagesize($tem_cache_dir . $tem_cache_file) && filesize($tem_cache_dir . $tem_cache_file) <= Item::MAX_UPLOAD_SIZE) {
                                         $sourceName = $tem_cache_dir . $tem_cache_file;
                                         $img_url = $upload_path . TIME_NOW . '_' . $tem_cache_file;
                                         if (AZLib::ftp_image_put_file($img_url, $sourceName, IMAGE_SERVER_NO)) {
                                             if (DB::update('item_image', array('des' => $des, 'img_server' => IMAGE_SERVER_NO, 'img_url' => $img_url), 'id=' . $image_id . ' OR root_id=' . $image_id)) {
                                                 if ($image['img_url']) {
                                                     AZLib::ftp_image_delete_file($image['img_url'], $image['imng_server']);
                                                     if (MEMCACHE_ON) {
                                                         $sql = "SELECT * FROM item\tWHERE img_url='{$image['img_url']}' AND status IN(1,2)  AND user_id=" . $user_id;
                                                         $re = DB::query($sql);
                                                         while ($item_memcache = mysql_fetch_assoc($re)) {
                                                             $item_memcache['img_server'] = IMAGE_SERVER_NO;
                                                             $item_memcache['img_url'] = $img_url;
                                                             AZMemcache::do_put("item:" . $item_memcache['id'], $item_memcache);
                                                         }
                                                     }
                                                     DB::query("UPDATE item SET img_url='{$img_url}' WHERE img_url='{$image['img_url']}' AND status IN(1,2) AND user_id=" . $user_id);
                                                 }
                                                 $json['url_error'] = 'success';
                                                 $json['img_server'] = IMAGE_SERVER_NO;
                                                 $json['img_url'] = $img_url;
                                             } else {
                                                 $json['url_error'] = 'not_updated';
                                             }
                                         } else {
                                             $json['url_error'] = 'not_uploaded';
                                         }
                                     } else {
                                         $json['url_error'] = 'over_max_size';
                                     }
                                     @unlink($tem_cache_dir . $tem_cache_file);
                                 } else {
                                     $json['url_error'] = 'not_cache_file';
                                 }
                             } else {
                                 $json['url_error'] = 'not_get_img';
                             }
                         } else {
                             if ($des != $image['des']) {
                                 if (DB::update('item_image', array('des' => $des), 'id=' . $image_id)) {
                                     $json['error'] = 'success';
                                 } else {
                                     $json['error'] = 'not_updated';
                                 }
                             } else {
                                 $json['error'] = 'success';
                             }
                         }
                     }
                     $json['des'] = $des;
                     //get Item_id
                     $sql = "SELECT item_id FROM item_image WHERE (id = {$image_id} OR root_id = {$image_id}) " . (User::have_permit(ADMIN_IMAGE) ? '' : " AND user_id=" . User::id());
                     $re = DB::query($sql);
                     if ($re) {
                         $item = mysql_fetch_assoc($re);
                         if ($item["item_id"]) {
                             require_once ROOT_PATH . 'core/Item.php';
                             Item::get_item_images($item["item_id"], 1);
                         }
                     }
                 } else {
                     $json['error'] = 'not_exit';
                 }
                 //get Item_id
                 $sql = "SELECT item_id FROM item_image WHERE id = {$image_id}";
                 $re = DB::query($sql);
                 if ($re) {
                     $item = mysql_fetch_assoc($re);
                     require_once ROOT_PATH . 'core/Item.php';
                     Item::get_item_images($item["item_id"], 1);
                 }
             }
         }
     } else {
         $json['error'] = 'not_login';
     }
     echo json_encode($json);
     exit;
 }
Пример #5
0
 function draw()
 {
     global $display;
     AZLib::get_config();
     /*if (CGlobal::$curZone) {
           $zone_id = CGlobal::$curZone['id'];
       } else {
           $zone_id = 0;
       }*/
     $zid = (int) Url::get("zone_id", 0);
     $display->add('cur_page', AZNet::$page['name']);
     $display->add('ADMIN_LOGO', User::have_permit(ADMIN_LOGO));
     $in_detail_page = AZNet::$page['name'] == 'item_detail';
     $topcats = array();
     $pcats = array();
     $stt = 0;
     $stt2 = 0;
     foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
         if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
             $topcat = CGlobal::$allCategories[$top_id];
             if ($topcat['status'] == "HOME") {
                 $topcat['name'] = $topcat['brief_name'];
                 if (count($sub_cats) > 7) {
                     $stt2++;
                 }
                 $topcat['left'] = "-" . (($stt2 - 1) * 30 + 10) . "px";
                 $topcat['url'] = WEB_DIR . "c{$topcat['id']}/{$topcat['ebname']}";
                 $topcat['selected'] = (int) (CGlobal::$curMainCat && CGlobal::$curMainCat['id'] == $topcat['id']);
                 $topcat['selected2'] = 0;
                 if ($topcat['selected']) {
                     if ($sub_cats) {
                         $topcat['class'] = "hm_item_list_sub";
                     } else {
                         $topcat['class'] = "hm_item_seleted";
                     }
                 } else {
                     $topcat['class'] = "hm_item";
                 }
                 if ($sub_cats) {
                     $topcat['subs'] = array();
                     $num_sub = 0;
                     foreach ($sub_cats as $sid => $subcat) {
                         if ($subcat['status'] != "HIDE") {
                             $subcat['url'] = WEB_DIR . "c{$subcat['id']}/{$topcat['ebname']}-{$subcat['ebname']}";
                             //$subcat['name'] 		= $subcat['brief_name'];
                             if (CGlobal::$curLevel2Cat && CGlobal::$curLevel2Cat['id'] == $subcat['id']) {
                                 $topcat['selected2'] = 1;
                                 $topcat['class'] = "hm_item_seleted";
                                 $subcat['class'] = "class='sub_seleted'";
                             }
                             $topcat['subs'][$sid] = $subcat;
                             $num_sub++;
                         }
                     }
                     if ($topcat['selected'] && !$topcat['selected2']) {
                         $max_per_col = ceil($num_sub / 5);
                         if ($max_per_col <= 0) {
                             $max_per_col = 1;
                         }
                         $display->add('max_per_col', $max_per_col);
                         $display->add('subcat_items', $topcat['subs']);
                     }
                 }
                 $topcats[$top_id] = $topcat;
                 // if($stt++ >= 6)
                 //break;
             }
         }
     }
     $display->add('topcats', $topcats);
     $display->add('web_dir', WEB_DIR);
     $display->add('DATA_PATH', DATA_PATH);
     //Load Logo
     //$test_time = mktime(0,0,0,11,26,2010);
     AZLib::getWebsiteLogo();
     if (CGlobal::$websiteLogo !== FALSE && isset(CGlobal::$websiteLogo['current']['expired']) && CGlobal::$websiteLogo['current']['expired'] && CGlobal::$websiteLogo['current']['expired'] < TIME_NOW) {
         //  Nếu Logo đang sử dụng đã hết hạn, lấy Logo còn hạn hoặc lấy Logo mặc định
         AZLib::getWebsiteLogo(1);
     }
     $display->add('logo', CGlobal::$websiteLogo['current']);
     $display->add('logos', CGlobal::$websiteLogo['logos']);
     //Top menu
     if (!isset($_SESSION['is_load_page_first'])) {
         $_SESSION['is_load_page_first'] = 0;
     }
     $display->add('url_root', WEB_ROOT);
     if (!User::is_login()) {
         $num_mess = 0;
     } else {
         $num_mess = User::$current->data['total_pm'] > 0 ? User::$current->data['total_pm'] : 0;
     }
     if (User::id()) {
         $display->add('user_id', User::id());
         $user_name = User::$current->data['user_name'];
         $display->add('user_name', $user_name);
     }
     $referer_login_url = '';
     $yahoo_open_id_href = '';
     $google_open_id_href = '';
     if (isset($_SESSION['openid_url']) && $_SESSION['user_id'] != 0) {
         $display->add('show_openid', FALSE);
     } elseif (!User::is_az_team()) {
         AZLib::check_uri();
         $referer_login_url = base64_encode(CGlobal::$query_string);
         $yahoo_open_id_href = OID_URL . 'index.html?openid_identifier=http://me.yahoo.com/&long_redirect=' . base64_encode(CGlobal::$query_string);
         $google_open_id_href = OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . base64_encode(CGlobal::$query_string);
         $display->add('show_openid', TRUE);
     }
     $display->add('OID_URL', $yahoo_open_id_href);
     $display->add('OID_URL_GOG', $google_open_id_href);
     $display->add('referer_login_url', $referer_login_url);
     $display->add('google_open_id_href', $google_open_id_href);
     $display->add('yahoo_open_id_href', $yahoo_open_id_href);
     $display->add('openid_on', OPENID_ON);
     $display->add('num_mess', $num_mess);
     $display->add('is_login', (int) User::is_login());
     $display->add('is_admin', (int) User::is_az_team());
     $display->add('is_admin_item', (int) User::have_permit(ADMIN_ITEM));
     $display->add('is_root', User::is_root());
     //End Top menu
     $display->add('category_id', CGlobal::$curCategory);
     $display->add('keywords', AZLib::cleanHtml(Url::get('keywords', '')));
     $display->add('not_error_page', (int) (AZNet::$page['name'] != 'error'));
     $display->add('is_load_page_first', $_SESSION['is_load_page_first']);
     // Tỷ giá
     AZLib::get_config();
     //$exchange = CGlobal::$configs['exchange']['conf_val'];
     //$display->add('exchange', number_format($exchange, 0, ',', '.'));
     // End Tỷ giá
     if ($_SESSION['is_load_page_first'] == 1) {
         $_SESSION['is_load_page_first'] = 0;
     }
     //End of top menu
     $curMainCat = CGlobal::$curMainCat;
     $curLevel2Cat = CGlobal::$curLevel2Cat;
     //Cat menu
     $sub_menu = FALSE;
     $sub_menu = $curMainCat && isset(CGlobal::$allCategories[$curMainCat['id']]) && isset(CGlobal::$subCategories[$curMainCat['id']]);
     $display->add('CURENT_TOP_CATID', (int) @$curMainCat['id']);
     $display->add('CURENT_LEVEL2_CATID', (int) @$curLevel2Cat['id']);
     $display->add('CURENT_CITY_ID', CGlobal::$curCity);
     $display->add('cur_page', Url::get('page'));
     $display->add('sub_menu', $sub_menu);
     $display->add('block_id', Module::$block_id);
     // System::debug($display->get_template_vars());
     //End Cat menu
     if (User::is_root()) {
         $display->add("DEBUG", DEBUG);
         $display->add("show_bug_url", AZRewrite::formatUrl(Url::build_all(array(), "ebug=" . (int) (!DEBUG))));
     }
     ################################################################################################################
     #Event config
     $event_on = @CGlobal::$configs['event_on']['conf_val'];
     $submit = Url::get('submit', '');
     if (User::is_admin()) {
         if ($submit == 'Cập nhật') {
             $display->add('msg', $this->showFormErrorMessages(1));
         }
         $status_arr = array(0 => 'Tắt', 1 => 'Bật');
         $display->add('status_option', AZLib::getOption($status_arr, $event_on));
     }
     $display->add('event', $event_on);
     $display->add("data_path", DATA_PATH);
     #Event config
     ################################################################################################################
     ################################################################################################################
     #Search
     $search_catid = (int) Url::get('search_catid');
     $search_cat_arr = array(-1 => '--Tất cả danh mục--');
     foreach (CGlobal::$subCategories as $top_id => $sub_cats) {
         if (isset(CGlobal::$allCategories[$top_id]) && CGlobal::$allCategories[$top_id]['parent_id'] == 0) {
             $topcat = CGlobal::$allCategories[$top_id];
             if ($topcat['status'] != "HIDE") {
                 $search_cat_arr[$top_id] = $topcat['name'];
                 if ($sub_cats) {
                     foreach ($sub_cats as $sid => $subcat) {
                         if ($subcat['status'] != "HIDE") {
                             $search_cat_arr[$sid] = "-----" . $subcat['name'];
                         }
                     }
                 }
             }
         }
     }
     $display->add('search_cat_option', AZLib::getOption($search_cat_arr, $search_catid));
     #Search
     ################################################################################################################
     /*   System::debug($topcats);*/
     $cat_newss = array();
     $news_cat_id = Url::get('news_catid', 'id', 0);
     AZLib::getNewsCats();
     $display->add('news_cat_id', $news_cat_id);
     if (CGlobal::$allNewsCategories) {
         foreach (CGlobal::$allNewsCategories as $news_cat) {
             if ($news_cat['public']) {
                 $news_cat['url'] = URL::build('news_list', array('news_catid' => $news_cat['id'], 'azname' => AZLib::safe_title($news_cat['name'])));
                 $cat_newss[$news_cat['id']] = $news_cat;
             }
         }
     }
     $display->add('cat_newss', $cat_newss);
     $display->output("Header");
     // $display->output("header_old");
 }
Пример #6
0
 function edit_user_info()
 {
     $user_id = (int) Url::get('user_id', 0);
     $info = AZLib::getParam('id');
     $value = AZLib::getParam('value');
     $input = array();
     $output = '';
     if ($user_id && (User::have_permit(ADMIN_USER) || User::id() == $user_id && !User::is_block())) {
         if ($info == 'up_item') {
             if (User::is_admin()) {
                 $user = DB::select('user', "id={$user_id}");
                 if (User::is_root()) {
                     $value = (int) $value;
                     $input = array('up_item' => $value > 0 ? $value : 0);
                     $output = '<b>' . $value . '</b>';
                     echo $output;
                     $admin = User::$current->data;
                     if ($user) {
                         $up_count = $value - $user['up_item'];
                         if ($up_count != 0) {
                             //type: 0:Tiền mặt; 1:thu tại nhà; 2:chuyển khoản; 3:Free, KM; 8:Online
                             $up_log_sql = "INSERT INTO up_log (`user_id`,\t`user_name`,\t\t\t`admin_id`,\t\t`admin_name`,\t\t\t`time`,\t `up_count`,`up_before`,\t\t`up_after`,\t`price`,\t`type`,\t\t`note`)\r\n\t                                                VALUES ({$user['id']},\t'{$user['user_name']}',{$admin['id']},\t'{$admin['user_name']}'," . TIME_NOW . ",{$up_count},'{$user['up_item']}',{$value},\t\t0,\t\t\t3,\t\t\t'')";
                             DB::query($up_log_sql);
                             if ($up_count > 0) {
                                 $update = DB::query('UPDATE user SET up_item=up_item + ' . $up_count . ' WHERE id=' . $user_id);
                             } else {
                                 $update = DB::query('UPDATE user SET up_item=up_item - ' . abs($up_count) . ' WHERE id=' . $user_id);
                             }
                             //DB::Update('user',$input,"id=$user_id");
                             User::getUser($user_id, 0, 1);
                         }
                     }
                 } else {
                     $output = "<b>" . (int) $user['up_item'] . "</b>";
                     echo $output;
                 }
                 exit;
             } else {
                 $output = '<b>' . $value . '</b>';
                 echo $output;
                 exit;
             }
         } elseif (!AZLib::checkBadWord($value) || User::have_permit(ADMIN_USER)) {
             $output = 'Ch&#7913;c n&#259;ng n&#224;y &#273;ang &#273;&#432;&#7907;c b&#7893; sung. &#7844;n F5 &#273;&#7875; t&#7843;i l&#7841;i trang.';
             if ($info == 'blast') {
                 $input = array('blast' => $value);
                 $userblast = ' ' . AZLib::BBCode(AZLib::cleanHtml($value));
                 if (strpos($userblast, 'http://')) {
                     $user_blast = $userblast;
                     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 href="' . $blast_url . '" target="_blank">Click here</a>';
                     $userblast = substr($user_blast . $new_blast_url, 1);
                 }
                 $user = User::getUser($user_id);
                 if ($value) {
                     //blast không trống
                     if ($value != $user['blast']) {
                         //Thay đổi blast
                         DB::delete("feed", "user_id={$user_id} AND type = 8");
                         //thêm vào feed cho các thành viên theo đuôi
                         DB::query("INSERT INTO \tfeed \t(type, \tuser_id,  act_user_id,  time)\r\n                                                    VALUES\t(8,\t\t{$user_id}, {$user_id}, " . TIME_NOW . ")");
                     }
                 } else {
                     //Xoá blast
                     DB::delete("feed", "user_id={$user_id} AND type = 8");
                 }
                 $output = $userblast . ' <img src="style/images/icon/icon_edit.gif" title="Click để sửa..." alt="Click để sửa..." class="hand_point" rel="blast" align="absmiddle">';
             } elseif ($info == 'address') {
                 $input = array('address' => trim($value));
                 $output = AZLib::word_limit($value, 12, '');
             } elseif ($info == 'mobile_phone') {
                 $value = preg_replace("/[^0-9]/", "", $value);
                 if (!AZLib::is_mobile($value)) {
                     $value = '';
                 }
                 $input = array('mobile_phone' => trim($value));
                 $output = AZLib::word_limit($value, 10, '');
             } elseif ($info == 'home_phone') {
                 if (User::have_permit(ADMIN_USER) || User::$current->data['phone_verify'] == 0) {
                     $value = preg_replace("/[^0-9]/", "", $value);
                     if (AZLib::is_mobile($value) || substr($value, 0, 1) != "0") {
                         $value = '';
                     }
                     $input = array('home_phone' => trim($value));
                     $output = AZLib::word_limit($value, 10, '');
                 }
             } elseif ($info == 'yahoo_id') {
                 $input = array('yahoo_id' => trim($value));
                 $output = AZLib::word_limit($value, 12, '');
             } elseif ($info == 'skype_id') {
                 $input = array('skype_id' => trim($value));
                 $output = AZLib::word_limit($value, 12, '');
             } elseif ($info == 'website') {
                 $input = array('website' => trim($value));
                 $website = $value;
                 if ($website != '') {
                     if (strrpos($website, 'ttp://') != 1) {
                         $website = 'http://' . $website;
                     }
                     if (strlen($website) > 8) {
                         if (strpos($website, '/', 8) > 0) {
                             $website = substr($website, 0, strpos($website, '/', 8));
                         }
                     }
                 }
                 $website = '<a href="' . $value . '" target="_blank" class="lineHeight18"><strong>' . AZLib::strippedLink($website, 26) . '</strong></a>';
                 $output = $website;
             } elseif ($info == 'email' && User::is_admin()) {
                 $input = array('email' => trim($value));
                 $output = $value;
             } elseif ($info == 'signature') {
                 $input = array('signature' => trim($value));
                 $output = AZLib::parseBBCode(AZLib::cleanHtml($value));
             } else {
                 $output = '';
             }
             echo $output;
         } else {
             echo 'N&#7897;i dung c&#243; t&#7915; x&#7845;u! Click &#273;&#7875; s&#7917;a nhanh.';
             exit;
         }
     } else {
         echo 'B&#7841;n kh&#244;ng c&#243; quy&#7873;n s&#7917;a th&#244;ng tin th&#224;nh vi&#234;n';
         exit;
     }
     if ($input) {
         DB::Update('user', $input, "id={$user_id}");
         User::getUser($user_id, 0, 1);
     }
     exit;
 }
Пример #7
0
 function highlight_searchword()
 {
     global $display;
     $keywords = AZLib::cleanHtml(Url::get('keywords', ''));
     $highlight = '';
     if ($keywords) {
         $highlight = $str_search = str_replace(array('+', '/', '|', '-', '*'), "", $keywords);
         $highlight = AZLib::trimSpace($highlight);
         $highlight = str_replace("'", '', $highlight);
         $highlight = str_replace("&#39;", '', $highlight);
         $highlight = str_replace("&quot;", '', $highlight);
     }
     if ($highlight) {
         $arr = explode(' ', $highlight);
         if ($arr) {
             $highlight = "";
             foreach ($arr as $word) {
                 $highlight = ($highlight ? $highlight . ', ' : '') . "'{$word}'";
             }
         }
     }
     $display->add('highlight', $highlight);
 }