Beispiel #1
0
 function piclens_gallery()
 {
     $item_id = AZLib::getParam('item_id');
     $entry = '';
     if ($item_id) {
         $sql = 'select id, img_url, title, position from item_image where item_id = ' . intval($item_id) . ' ORDER BY position ';
         DB::query($sql);
         if (DB::num_rows()) {
             $entry = '';
             while ($rows = DB::fetch_row()) {
                 $rows['title'] = $rows['title'] ? $rows['title'] : "Image {$rows['position']}";
                 $rows['title'] = trim(XMLLib::_xml_encode_attribute($rows['title']));
                 if (ereg('/', $rows['img_url'])) {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "{$rows['img_url']}"));
                 } else {
                     $url = trim(XMLLib::_xml_encode_attribute("http://" . IMAGE_PATH . "uploaded/items/{$rows['img_url']}"));
                 }
                 $entry .= "\r\n\t\t \t \t<item>\r\n\t\t \t \t\t\t<title>" . stripslashes($rows['title']) . "</title>\r\n\t\t\t\t\t\t<link>{$url}</link>\r\n\t\t\t\t\t\t<guid>Image {$rows['position']}</guid>\r\n\t\t\t\t\t\t<media:thumbnail url=\"{$url}\" />\r\n\t\t\t\t\t\t<media:content url=\"{$url}\" />\r\n\t\t\t\t</item>\r\n\t\t \t \t";
             }
             @header("Content-type: text/xml");
             echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n\t\t\t <rss version=\"2.0\" xmlns:media=\"http://search.yahoo.com/mrss\">\r\n\t\t\t <channel>\t\t\t\r\n\t\t\t <title>Enbac.com</title>\r\n\t\t\t <link>http://www.enbac.com/</link>\r\n\t\t\t <description>Enbac.com - </description>\r\n\t\t\t <logo url=\"style/images/logo.piclens.png\" />\r\n\t\t\t";
             echo $entry;
             echo "\r\n\t\t \t </channel>\r\n\t\t\t </rss>\r\n\t\t\t";
         } else {
             die("no_info");
         }
     } else {
         die("no_info");
     }
 }
Beispiel #2
0
 function draw()
 {
     $this->beginForm();
     if (Url::get('cmd') == 'edit' && ($row = DB::select('bad_words', 'id=' . intval(AZLib::getParam('id'))))) {
         $contents = $row['contents'];
         $reason = $row['reason'];
         $exact = $row['exact'];
         if ($row['is_phone'] == 1) {
             $contents = BadWord::filter_badword_show($contents);
         }
         $is_phone = $row['is_phone'];
     } else {
         $contents = '';
         $exact = '';
         $is_phone = '';
         $reason = '';
     }
     global $display;
     $display->add('msg', $this->showFormErrorMessages());
     $display->add('contents', $contents);
     $display->add('reason', $reason);
     $display->add('exact', $exact);
     $display->add('is_phone', $is_phone);
     $display->add('cmd', Url::get('cmd'));
     $display->output('edit');
     $this->endForm();
 }
 function on_submit()
 {
     $user_name = AZLib::getParam('user_name');
     $content = AZLib::getParam('content');
     $active = (int) Url::get('active');
     $expire = (int) Url::get('expire', 7);
     $id = (int) Url::get('id');
     $cmd = Url::get('cmd');
     $sql = "SELECT id FROM user WHERE user_name='{$user_name}'";
     $row = DB::fetch($sql);
     $user_id = (int) $row["id"];
     if (!$user_id) {
         $this->setFormError('user_name', 'Không tồn tại thành viên này!');
     } elseif (!$user_name || !$content) {
         $this->setFormError('content', 'Dữ liệu không hợp lệ!');
     } else {
         if ($cmd == "add") {
             $item_array = array('content' => $content, 'user_name' => $user_name, 'user_id' => $user_id, 'admin_add' => User::user_name(), 'active' => $active, 'time_add' => TIME_NOW, 'expire_date' => TIME_NOW + 86400 * $expire);
             DB::insert('admin_notice_user', $item_array);
         } elseif ($cmd == "edit" && $id) {
             $item_array = array('content' => $content, 'user_name' => $user_name, 'user_id' => $user_id, 'admin_edit' => User::user_name(), 'active' => $active, 'time_edit' => TIME_NOW, 'expire_date' => TIME_NOW + 86400 * $expire);
             DB::update_id('admin_notice_user', $item_array, $id);
         }
         User::getAdminNoticeUser($user_id, 0, 1);
         Url::redirect_current(array('act'));
     }
 }
Beispiel #4
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'ebd_payment':
             $this->ebd_payment();
             break;
         case 'ebu_payment':
             $this->ebu_payment();
             break;
         case 'ebd_premium_payment':
             $this->ebd_premium_payment();
             break;
         case 'ebu_premium_payment':
             $this->ebu_premium_payment();
             break;
         case 'check_item_id':
             $this->check_item_id();
             break;
         case 'payment_vip_finish':
             $this->payment_vip_finish();
             break;
         case 'check_slot_vip':
             $this->check_slot_vip();
             break;
         case 'display_date_ordered':
             $this->display_date_ordered();
             break;
         case 'card_payment':
             $this->card_payment();
             break;
         case 'card_payment_item':
             $this->card_payment_item();
             break;
         case 'payment_bill':
             $this->payment_bill();
             break;
         case 'get_cart':
             $this->get_cart();
             break;
         case 'add_to_cart':
             $this->add_to_cart();
             break;
         case 'update_to_cart':
             $this->update_to_cart();
             break;
         case 'del_cart':
             $this->del_cart();
             break;
         default:
             $this->home();
             break;
     }
 }
Beispiel #5
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'trans':
             $this->transaction();
             break;
         default:
             $this->home();
             break;
     }
 }
Beispiel #6
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'home':
             $this->home();
             break;
         default:
             $this->home();
             break;
     }
     //$print->html = $skin->index();
     //$print->display();
 }
Beispiel #7
0
 function on_submit()
 {
     AZLib::getCats();
     $item_id = (int) Url::get("item_id", 0);
     $time_s = Url::get("time_start", '');
     $time_e = Url::get("time_end", '');
     $category = (int) Url::get("category", 0);
     $num_contract = Url::get("num_contract", '');
     $item = Item::get_item($this->booking_vip['item_id']);
     if (!$this->errNum) {
         $time_start = 0;
         if ($time_s != '') {
             $arr = explode('-', $time_s);
             if (count($arr) == 3) {
                 $time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_start) {
             $time_start = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW));
         }
         $time_end = 0;
         if ($time_e != '') {
             $arr = explode('-', $time_e);
             if (count($arr) == 3) {
                 $time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_end) {
             $this->setFormError('time_end', 'Bạn chưa nhập vào thời gian kết thúc!');
             return;
         }
         if ($time_end < $time_start) {
             $this->setFormError('time_end', 'Thời gian kết thúc phải lớn hơn thời gian bắt đầu!');
             return;
         }
         $item = Item::get_item($item_id);
         // xac dinh xem co hien thi o danh muc cha khong
         $top_cat = 0;
         $cat_id = 0;
         if ($category == 1) {
             $top_cat = $item['level_1_catid'];
         } else {
             if ($category == 2) {
                 $cat_id = $item['category_id'];
             }
         }
         $id = DB::update("bookings_vip", array('item_id' => $item_id, 'cat_id' => $cat_id, 'top_cat' => $top_cat, 'note' => AZLib::getParam('note'), 'time_start' => $time_start, 'time_end' => $time_end, 'time_edit' => TIME_NOW, 'user_edit' => User::user_name(), 'num_contract' => $num_contract), "id=" . $this->booking_vip['id']);
         Url::redirect_current();
     }
 }
Beispiel #8
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'piclens_gallery':
             $this->piclens_gallery();
             break;
         case 'flash_view_gallery':
             $this->flash_view_gallery();
             break;
         default:
             $this->home();
             break;
     }
 }
Beispiel #9
0
 function on_submit()
 {
     $title = AZLib::getParam('title');
     $sapo = AZLib::getParam('sapo');
     $link = AZLib::getParam('link', '');
     $active = (int) Url::get('active');
     $id = (int) Url::get('id');
     $cmd = Url::get('cmd');
     if (!$title || !$sapo) {
         $this->setFormError('title', 'Dữ liệu không hợp lệ!');
     } else {
         if ($cmd == "add") {
             $item_array = array('title' => $title, 'sapo' => $sapo, 'link' => $link, 'admin_add' => User::user_name(), 'active' => $active, 'time_add' => TIME_NOW);
             DB::insert('admin_notice', $item_array);
         } elseif ($cmd == "edit" && $id) {
             $item_array = array('title' => $title, 'sapo' => $sapo, 'link' => $link, 'admin_edit' => User::user_name(), 'active' => $active, 'time_edit' => TIME_NOW);
             DB::update_id('admin_notice', $item_array, $id);
         }
         User::getAdminNotice(0, 1);
         Url::redirect_current();
     }
 }
Beispiel #10
0
 function playme()
 {
     $code = AZLib::getParam('code');
     switch ($code) {
         case 'modifyStatus':
             $this->modifyStatus();
             break;
         case 'edit_ad_item':
             $this->edit_ad_item();
             break;
         case 'submit_ad_item':
             $this->submit_ad_item();
             break;
         case 'change_to_edit':
             $this->change_to_edit();
             break;
         case 'active_ad':
             $this->active_ad();
             break;
         case 'updateContract':
             $this->updateContract();
             break;
         case 'updateAdminNote':
             $this->updateAdminNote();
             break;
         case 'updateTT':
             $this->updateTT();
             break;
         case 'upload':
             $this->upload();
             break;
         default:
             $this->home();
             break;
     }
 }
Beispiel #11
0
 function BadWord($row)
 {
     Module::Module($row);
     if (User::is_admin()) {
         CGlobal::$website_title = 'Quản lý từ xấu';
         switch (Url::get('cmd')) {
             case 'delete':
                 DB::query('DELETE FROM bad_words WHERE id=' . AZLib::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;
             default:
                 require_once 'forms/list.php';
                 $this->add_form(new BadWordForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Beispiel #12
0
 function draw2()
 {
     $keywords = AZLib::getParam('keywords');
     $total_item = 0;
     $search_result = false;
     $items = array();
     $paging = '';
     $cmd = '';
     $cat_search_id = 0;
     $item_array = array();
     $listCat = array();
     if ($keywords) {
         //AZLib::getCats();
         require "./includes/sphinxapi.class.php";
         foreach (CGlobal::$allCategories as $value) {
             if ($value['parent_id'] == 0) {
                 $cat_list[$value['id']] = $value['brief_name'];
             }
         }
         $category = $this->getTotalPerCategory($keywords);
         foreach ($category as $row) {
             $row['brief_name'] = isset($cat_list[$row['level_1_catid']]) && $cat_list[$row['level_1_catid']] ? $cat_list[$row['level_1_catid']] : "Khác";
             $listCat[$row['level_1_catid']] = array("level_1_catid" => $row["level_1_catid"], "brief_name" => $row['brief_name'], "count_ad" => $row['@count']);
         }
         $total = 0;
         $catid = 0;
         $catActive = '';
         $total_cat = 0;
         if ($listCat) {
             $first_val = array_slice($listCat, 0, 1);
             $total = $first_val[0]['count_ad'];
             $catid = $first_val[0]['level_1_catid'];
             $catActive = $first_val[0]['brief_name'];
             $total_cat = count($listCat);
         }
         $i = 0;
         $allrecord = 0;
         $otherCat = '';
         $cat_content = "";
         foreach ($listCat as $cat) {
             if ($i < 3) {
                 $active = $i == 0 ? "class=\"active\"" : "";
                 $cat_content .= "<li id=\"tab_{$i}\" {$active} onclick=\"javascript:acive_tab_cat(this);\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></li>";
             } else {
                 $otherCat .= "<div class=\"other\"><a href=\"javascript:void(0);\" onclick=\"javascript:search_cat({$cat['level_1_catid']},{$cat['count_ad']},1,0);acive_tab_cat(this);\" id=\"tab_{$i}\"><span id=\"kby_{$cat['level_1_catid']}\">" . $cat['brief_name'] . " <font style=\"color: #5a7e92;font-weight: normal;\">(" . $cat['count_ad'] . ")</font></span></a></div>";
             }
             $i++;
             $allrecord = $allrecord + $cat['count_ad'];
         }
         $display->add("cat_content", $cat_content);
         $display->add("CatActiveId", $catid);
         $display->add("catActive", $catActive);
         $display->add("listCat", $listCat);
         $display->add("allrecord", $allrecord);
         $display->add("otherCat", str_replace(array(chr(13), chr(10)), "", $otherCat));
         $display->add("total_cat", $total_cat);
         //Init for sphinx search paging
         $pager = new Pager();
         //config
         $limit = SEARCH_LIMIT;
         $pager->type = "search";
         $pager->catid = $catid;
         $pager->total = $total;
         $pager->limit = $limit;
         $pager->page_param = 'page';
         $pager->page = 1;
         $offset = $pager->get_offset();
         $limit_from = $pager->limit_from();
         $limit_to = $pager->limit_to();
         //Sphinx search by Nova
         $q = $keywords;
         $mode = SPH_MATCH_EXTENDED2;
         //Init config
         $host = SPHINX_SERVER;
         $port = SPHINX_PORT;
         //$index 		= SPHINX_INDEX;
         $index = "enbac delta";
         $filtervals = array();
         $ranker = SPH_RANK_WORDCOUNT;
         $cl = new SphinxClient();
         $cl->SetServer($host, $port);
         $cl->SetConnectTimeout(1);
         $cl->SetWeights(array(100, 1));
         $cl->SetMatchMode($mode);
         //filter
         if ($catid) {
             $cl->SetFilter('level_1_catid', array($catid));
         }
         $cl->SetFilter('status', array('1'));
         $cl->SetFieldWeights(array('user_name' => 10000, 'name' => 1000, 'description' => 1));
         //$cl->SetSortMode( SPH_SORT_EXTENDED, 'up_time DESC' );
         //$cl->SetSortMode( SPH_SORT_RELEVANCE);//Sort theo kq chính xác nhất
         //$cl->SetSortMode ( SPH_SORT_EXPR, "@weight + ( user_karma + ln(pageviews) )*0.1");
         $cl->SetSortMode(SPH_SORT_EXPR, "@weight");
         //Sort theo trọng số
         //SPH_RANK_WORDCOUNT
         //SPH_MATCH_EXTENDED2
         //end filter
         $cl->SetLimits($offset, $limit, 10000);
         $cl->SetRankingMode($ranker);
         $cl->SetArrayResult(true);
         $res = $cl->Query($q, $index);
         /*echo '<pre>';
         		print_r($res["matches"]);*/
         if ($res && isset($res["matches"])) {
             if (is_array($res["matches"])) {
                 foreach ($res["matches"] as $results) {
                     $list_item_id[] = $results['id'];
                 }
             }
             $comma_separated = join(",", $list_item_id);
         }
         if ($total) {
             if ($limit_to > $total) {
                 $limit_to = $total;
             }
             $comma_separated = join(",", $list_item_id);
             if ($comma_separated) {
                 //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1 ORDER BY up_time DESC";
                 //$sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN($comma_separated) AND status=1  AND state=0 ORDER BY find_in_set(id,'$comma_separated')";
                 $sql = "SELECT id,name,up_time,price,user_id,user_name, level_1_catid,category_id,description,img_url, img_server FROM item WHERE id IN({$comma_separated}) AND status=1 ORDER BY find_in_set(id,'{$comma_separated}')";
                 $search_result = DB::query($sql);
                 $pager->total = $total;
                 $paging = $pager->page_link();
             }
         }
     }
     $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);
     }
     $highlight1 = '';
     if ($highlight) {
         $arr = explode(' ', $highlight);
         if ($arr) {
             $highlight = "";
             foreach ($arr as $word) {
                 $highlight = ($highlight ? $highlight . ', ' : '') . "'{$word}'";
                 $highlight1 = ($highlight1 ? $highlight1 . ',' : '') . $word;
             }
         }
     }
     if ($keywords && $search_result) {
         while ($item = mysql_fetch_assoc($search_result)) {
             $item['profile_url'] = WEB_DIR . $item['user_name'];
             $item['name_hl'] = AZLib::HighLightKeyword(strip_tags(AZLib::filter_title($item['name'])), $highlight1);
             $item_time = TIME_NOW - $item['up_time'];
             //neu nho hon 1h thi tinh ra phut
             if ($item_time < 3600) {
                 $item['item_time'] = floor($item_time / 60) . " phút trước đây";
             } elseif ($item_time < 86400) {
                 $item['item_time'] = floor($item_time / 3600) . " giờ trước đây";
             } else {
                 $item['item_time'] = date('\\n\\gà\\y j \\t\\há\\n\\g n', $item['up_time']);
             }
             $item['description'] = AZLib::HighLightKeyword(AZLib::delDoubleSpace(AZLib::trimSpace(strip_tags(AZLib::post_db_parse_html(preg_replace('/\\[[0-9]{1,3}\\]/', '', $item['description']))))), $highlight1, 35, "background:yellow;font-size:14px;font-weight:bold;color:blue;");
             $ebname = AZLib::safe_title($item['name']);
             $ebname_tmp = substr(AZLib::safe_title($item['name']), 0, 20);
             if (isset(CGlobal::$allCategories[$item['category_id']])) {
                 $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname . '&nice_name=' . CGlobal::$allCategories[$item['category_id']]['nice_name']);
                 $item['item_url_tmp'] = WEB_ROOT . CGlobal::$allCategories[$item['category_id']]['nice_name'] . '/p' . $item['id'] . '/' . $ebname_tmp . '...';
             } else {
                 $item['item_url'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . $ebname);
                 $item['item_url_tmp'] = WEB_ROOT . 'p' . $item['id'] . '/' . $ebname_tmp . '...';
             }
             if ($item['img_url']) {
                 $item['img_url'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item['img_server']);
             }
             $item['price'] = number_format($item['price'], 0, ',', '.');
             $item_array[] = $item;
         }
     }
     global $start_rb;
     $mtime = microtime();
     $mtime = explode(" ", $mtime);
     $mtime = $mtime[1] + $mtime[0];
     $end_rb = $mtime;
     $search_time = round($end_rb - $start_rb, 3);
     $display->add('limit_from', $limit_from);
     $display->add('limit_to', $limit_to);
     $display->add('search_time', $search_time);
     $display->add('keywords', $keywords);
     $display->add('base_url', WEB_ROOT);
     $display->add('highlight', $highlight);
     $display->add('total_item_cat', $total);
     $display->add('name_item_cat', $catActive);
     $display->add('block_id', Module::$block_id);
     $display->add('paging', $paging);
     $display->add('items', $item_array);
     $display->output('sphinx_search');
 }
 function draw()
 {
     //$tbl_source     = "category_bk";
     $tbl_source = "category";
     global $display;
     $keywords = AZLib::getParam('searchKeyword');
     $src_catid = (int) Url::get('sourceCategories');
     $src_l1_catid = 0;
     $src_l2_catid = 0;
     $src_l3_catid = 0;
     if ($src_catid) {
         //Kiểm tra danh mục nguồn
         $src_cat = DB::select("{$tbl_source}", "id={$src_catid}");
         if ($src_cat) {
             if ($src_cat && $src_cat['parent_id']) {
                 //DM cấp 2
                 /*$src_l1_catid = $src_cat['parent_id'];
                 		$src_l2_catid = $src_catid;
                 		*/
                 $src_cat_parent = DB::select("{$tbl_source}", "id={$src_cat['id']}");
                 if (!$src_cat_parent || $src_cat_parent && $src_cat_parent['parent_id']) {
                     //DM cấp 3
                     $src_l1_catid = $src_cat_parent['parent_id'];
                     $src_l2_catid = $src_cat['parent_id'];
                     $src_l3_catid = $src_catid;
                 } else {
                     $src_l1_catid = $src_cat['parent_id'];
                     $src_l2_catid = $src_catid;
                 }
             } else {
                 $src_l1_catid = $src_catid;
             }
         }
     }
     $des_catid = (int) AZLib::getParam('desCategories');
     $search_result = false;
     $items = array();
     $total = 0;
     if ($keywords) {
         //Nếu tìm theo từ khóa
         $q = $keywords;
         $mode = SPH_MATCH_ALL;
         //Init config
         $host = SPHINX_SERVER;
         $port = SPHINX_PORT;
         $index = SPHINX_INDEX;
         $ranker = SPH_RANK_PROXIMITY_BM25;
         $cl = new SphinxClient();
         $cl->SetServer($host, $port);
         $cl->SetConnectTimeout(1);
         $cl->_limit = 50000;
         $cl->_maxmatches = 50000;
         $cl->SetWeights(array(100, 1));
         $cl->SetMatchMode($mode);
         if ($src_l2_catid) {
             $cl->SetFilter('category_id', array($src_catid));
         } elseif ($src_l1_catid) {
             $cl->SetFilter('level_1_catid', array($src_catid));
         }
         //$cl->SetLimits( $offset , $limit, 10000 );
         $cl->SetRankingMode($ranker);
         $cl->SetArrayResult(true);
         $res = $cl->Query($q, $index);
         if ($res && isset($res["matches"])) {
             if (is_array($res["matches"])) {
                 $itemIDs = '';
                 $count = 0;
                 foreach ($res["matches"] as $results) {
                     $itemIDs .= ($itemIDs != '' ? ',' : '') . $results['id'];
                 }
                 if ($itemIDs != '') {
                     //Đếm lại số bản ghi chính xác
                     $sql = 'SELECT count(*) AS totalItem FROM item WHERE id IN(' . $itemIDs . ')';
                     if ($src_catid) {
                         if ($src_l3_catid) {
                             // Nếu tìm kiếm theo từ khóa trong danh mục cấp 3
                             $sql .= ' AND category_id = ' . $src_l3_catid;
                         } elseif ($src_l2_catid) {
                             // Nếu tìm kiếm theo từ khóa trong danh mục nào đó
                             $sql .= ' AND level_2_catid = ' . $src_l2_catid;
                         } elseif ($src_l1_catid) {
                             $sql .= ' AND level_1_catid = ' . $src_l1_catid;
                         }
                     }
                     if ($des_catid) {
                         $sql .= ' AND category_id != ' . $des_catid;
                     }
                     $re = DB::Query($sql);
                     if ($re) {
                         $row = mysql_fetch_assoc($re);
                         $total += (int) $row['totalItem'];
                     }
                     $display->add('itemids', $itemIDs);
                 }
             }
         }
     } elseif ($src_catid) {
         // Nếu giới hạn theo danh mục
         $sql = "SELECT count(*) AS itemTotal FROM item";
         if ($src_l3_catid) {
             $sql .= ' WHERE category_id = ' . $src_l3_catid;
         } elseif ($src_l2_catid) {
             $sql .= ' WHERE level_3_category_id = ' . $src_l2_catid;
         } elseif ($src_l1_catid) {
             $sql .= ' WHERE level_1_catid = ' . $src_l1_catid;
         }
         $re = DB::query($sql);
         if ($re) {
             $row = mysql_fetch_assoc($re);
             $total = $row['itemTotal'];
         }
     }
     $this->beginForm();
     //Build source categories list
     $cat_search_name = '';
     $re = DB::query("SELECT id,name,parent_id ,position,status FROM {$tbl_source} ORDER BY parent_id,position");
     $all_cats = array();
     $all_subcats = array();
     if ($re) {
         while ($cat = mysql_fetch_assoc($re)) {
             if ($cat['parent_id']) {
                 //Là danh mục cấp 2
                 if (isset($all_cats[$cat['parent_id']]) && $all_cats[$cat['parent_id']]['parent_id'] == 0) {
                     //Là danh mục cấp 2
                     $all_subcats[$cat['parent_id']][$cat['id']] = $cat;
                 }
             } else {
                 if (!isset($all_subcats[$cat['id']])) {
                     $all_subcats[$cat['id']] = array();
                 }
             }
             $all_cats[$cat['id']] = $cat;
         }
     }
     $all_top_cat = array();
     $all_top_cat[0] = 'Tất cả các danh mục';
     foreach ($all_subcats as $topid => $subcats) {
         if ($src_catid && $src_catid == $topid) {
             $cat_search_name = $all_cats[$topid]['name'];
         }
         if ($all_cats[$topid]['status'] == 'HIDE') {
             $all_cats[$topid]['name'] .= ' (ẨN)';
         }
         $all_top_cat[$topid] = $all_cats[$topid]['name'];
         foreach ($subcats as $subcat) {
             if ($src_catid && $src_catid == $subcat['id']) {
                 $cat_search_name = $subcat['name'];
             }
             if ($subcat['status'] == 'HIDE') {
                 $subcat['name'] .= ' (ẨN)';
             }
             $all_top_cat[$subcat['id']] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;" . $subcat['name'];
         }
     }
     //print_r($all_top_cat);
     $display->add('msg', $this->showFormSuccesMessages(1));
     $display->add('sourceCategories', $all_top_cat);
     //Build destination categories list
     $re = DB::query("SELECT id,name,parent_id,status,position FROM category ORDER BY parent_id,position");
     $all_cats = array();
     $all_subcats = array();
     $level1_cats = array();
     $level2_cats = array();
     $level3_cats = array();
     if ($re) {
         while ($cat = mysql_fetch_assoc($re)) {
             if ($cat['parent_id']) {
                 //Là danh mục cấp 2 hoặc 3
                 if (isset($all_cats[$cat['parent_id']]) && $all_cats[$cat['parent_id']]['parent_id'] == 0) {
                     //Là danh mục cấp 2
                     $all_subcats[$cat['parent_id']][$cat['id']] = $cat;
                     $cat['max'] = 0;
                     if ($cat['position'] > $level1_cats[$cat['parent_id']]['max']) {
                         $level1_cats[$cat['parent_id']]['max'] = $cat['position'];
                     }
                     $level2_cats[$cat['id']] = $cat;
                 } else {
                     //là danh mục cấp 3
                     if ($cat['position'] > $level2_cats[$cat['parent_id']]['max']) {
                         $level2_cats[$cat['parent_id']]['max'] = $cat['position'];
                     }
                     $level3_cats[$all_cats[$cat['parent_id']]['parent_id']][$cat['parent_id']][$cat['id']] = $cat;
                 }
             } else {
                 $cat['max'] = 0;
                 $level1_cats[$cat['id']] = $cat;
                 if (!isset($all_subcats[$cat['id']])) {
                     $all_subcats[$cat['id']] = array();
                 }
             }
             $all_cats[$cat['id']] = $cat;
         }
     }
     $all_top_cat = array();
     $categories = array();
     foreach ($all_subcats as $topid => $subcats) {
         if ($all_cats[$topid]['status'] == 'HIDE') {
             $all_cats[$topid]['name'] .= ' (ẨN)';
         }
         $categories[$topid] = $all_cats[$topid];
         $all_top_cat[$topid] = $all_cats[$topid]['name'];
         foreach ($subcats as $subcat) {
             if ($subcat['status'] == 'HIDE') {
                 $subcat['name'] .= ' (ẨN)';
             }
             $all_top_cat[$subcat['id']] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;" . $subcat['name'];
             $categories[$subcat['id']] = $subcat;
             if (isset($level2_cats[$subcat['id']]) && $level2_cats[$subcat['id']]['max']) {
                 $subcatsl3 = $level3_cats[$subcat['parent_id']][$subcat['id']];
                 foreach ($subcatsl3 as $subcatl3) {
                     if ($subcatl3['status'] == 'HIDE') {
                         $subcatl3['name'] .= ' (ẨN)';
                     }
                     $all_top_cat[$subcatl3['id']] = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;" . $subcatl3['name'];
                     $subcatl3['parent_id'] .= ',' . $subcat['parent_id'];
                     $categories[$subcatl3['id']] = $subcatl3;
                 }
             }
         }
     }
     $display->add('desCategories', $all_top_cat);
     $display->add('desJSONCategories', json_encode($categories));
     $display->add("allrecord", $total);
     $display->add('keywords', $keywords);
     $display->add('cat_search_id', $src_catid);
     $display->add('cat_search_name', $cat_search_name);
     $display->add('category_id', $des_catid);
     $display->output("ManageContentCategory");
     $this->endForm();
 }
Beispiel #14
0
 function on_submit()
 {
     $item_id = (int) Url::get("item_id", 0);
     $category = (int) Url::get("category", 0);
     $num_contract = Url::get("num_contract", '');
     $time_s = Url::get("time_start", '');
     $time_e = Url::get("time_end", '');
     if ($item_id <= 0) {
         $this->setFormError('item_id', 'Bạn chưa nhập vào ID tin!');
         return;
     }
     $item = Item::get_item($item_id);
     if (!$item || $item && $item['status'] == -1) {
         $this->setFormError('item_id', 'Tin bạn nhập vào không tồn tại!');
         return;
     }
     if (!$this->errNum) {
         $time_start = 0;
         if ($time_s != '') {
             $arr = explode('-', $time_s);
             if (count($arr) == 3) {
                 $time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_start) {
             $time_start = mktime(0, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW));
         }
         $time_end = 0;
         if ($time_e != '') {
             $arr = explode('-', $time_e);
             if (count($arr) == 3) {
                 $time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]);
             }
         }
         if (!$time_end) {
             $this->setFormError('time_end', 'Bạn chưa nhập vào thời gian kết thúc!');
             return;
         }
         if ($time_end < $time_start) {
             $this->setFormError('time_end', 'Thời gian kết thúc phải lớn hơn thời gian bắt đầu!');
             return;
         }
         // xac dinh xem co hien thi o danh muc cha khong
         $top_cat = 0;
         $cat_id = 0;
         if ($category == 1) {
             $top_cat = $item['level_1_catid'];
         } else {
             if ($category == 2) {
                 $cat_id = $item['category_id'];
             }
         }
         $id = DB::insert("bookings_vip", array('item_id' => $item_id, 'cat_id' => $cat_id, 'top_cat' => $top_cat, 'note' => AZLib::getParam('note'), 'time_start' => $time_start, 'time_end' => $time_end, 'time_add' => TIME_NOW, 'user_add' => User::user_name(), 'time_edit' => TIME_NOW, 'user_edit' => User::user_name(), 'num_contract' => $num_contract));
         if ($id) {
             $content_email = "Có tin vip mới, id={$id}";
             $email_managa_vip = '*****@*****.**';
             if (System::sendEBEmail($email_managa_vip, 'Có booking vip mới', $content_email)) {
                 //                    DB::update('bookings_vip', array('note' => 'Gửi mail thành công'), "id=$id");
             }
         }
         Url::redirect_current();
     }
 }
Beispiel #15
0
<?php

//TuấnNK add (20080617_10h):
//Các xử lý cho ajax:
//echo basename($_SERVER['PHP_SELF']);
require_once 'core/Debug.php';
//System Debug...
require_once 'core/config.php';
//System Config...
require_once 'core/Init.php';
//System Init...
//System process & output for ajax request
$choice = array("index" => "index", "user" => "ajax_user", "item" => "ajax_item", "comment" => "ajax_comment", "misc" => "ajax_misc", "personal" => "ajax_personal", "admin" => "ajax_admin", "manage" => "ajax_manage", "upload" => "ajax_upload", "shop_giaodich" => "ajax_shop_giaodich", "shop" => "ajax_shop", "ad" => "ajax_ad", "payment" => "ajax_payment");
$action = AZLib::getParam('act');
if ($action == "" || $choice[$action] == "") {
    $choice[$action] = "index";
}
require_once ROOT_PATH . "includes/ajax_action/" . $choice[$action] . ".ajax.php";
$run_me = new $choice[$action]();
$run_me->playme();
//End process & ouput
//Stop System
System::halt();
Beispiel #16
0
 function get_gallery_entry()
 {
     if (User::is_login()) {
         global $display;
         if ((User::have_permit(ADMIN_ITEM) || User::is_mod()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
             $user_id = (int) Url::get('user_id', 0);
             $display->add('user_id', $user_id);
         } else {
             $user_id = User::id();
         }
         $search_value = ' user_id=' . $user_id . ' AND root_id=0 ';
         //search theo ngay thang nam
         //$year=(int)Url::get('year',date('Y'));
         $year = (int) Url::get('year', -1);
         //$mon= (int)Url::get('month',(int)date('m'));
         $mon = (int) Url::get('month', -1);
         $day = (int) Url::get('day', -1);
         if ($year == 0) {
             $year = -1;
         }
         if ($mon == 0) {
             $mon = -1;
         }
         if ($day == 0) {
             $day = -1;
         }
         $created_time_from = 0;
         $created_time_to = 0;
         if ($year != -1) {
             if ($mon != -1) {
                 if ($day != -1) {
                     $created_time_from = mktime(0, 0, 0, $mon, $day, $year);
                     $created_time_to = mktime(23, 59, 59, $mon, $day, $year);
                 } else {
                     $max_day = 31;
                     if (in_array($mon, array(4, 6, 9, 11))) {
                         $max_day = 30;
                     } elseif ($mon == 2) {
                         $year % 4 ? $max_day = 28 : ($max_day = 29);
                     }
                     $created_time_from = mktime(0, 0, 0, $mon, 1, $year);
                     $created_time_to = mktime(23, 59, 59, $mon, $max_day, $year);
                 }
             } else {
                 $created_time_from = mktime(0, 0, 0, 1, 1, $year);
                 $created_time_to = mktime(23, 59, 59, 12, 31, $year);
             }
         }
         $y_arr = array(-1 => '-Lọc theo Năm-');
         for ($i = 2008; $i <= date('Y'); $i++) {
             $y_arr[$i] = "---Năm {$i}-";
         }
         $m_arr = array(-1 => '-Lọc theo Tháng-');
         for ($i = 1; $i <= 12; $i++) {
             $m_arr[$i] = "---Tháng {$i}-";
         }
         $d_arr = array(0 => '-Lọc theo Ngày-');
         for ($i = 1; $i <= 31; $i++) {
             $d_arr[$i] = "---Ngày {$i}-";
         }
         $display->add('option_year', AZLib::getOption($y_arr, $year));
         $display->add('option_month', AZLib::getOption($m_arr, $mon));
         $display->add('option_day', AZLib::getOption($d_arr, $day));
         if ($created_time_from) {
             $search_value .= ' AND time >= ' . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ' AND time <= ' . $created_time_to;
         }
         $keywords = AZLib::trimSpace(AZLib::getParam('keywords'));
         $display->add('keywords', $keywords);
         if ($keywords) {
             $search_value .= ' AND des LIKE "%' . $keywords . '%" ';
         }
         $item_per_page = 20;
         $sql_count = 'SELECT count(*) AS total_img FROM item_image WHERE ' . $search_value;
         $total = DB::fetch($sql_count, 'total_img', 0);
         $paging = '';
         $items = array();
         $gallery_url = WEB_DIR . 'ajax.php' . Url::build_all(array('page_no'));
         if ($total) {
             $limit = '';
             $paging = AjaxGalleryPaging($limit, $total, $item_per_page, 5, $gallery_url, 'gallery_content');
             $sql = 'SELECT id, des, item_id, title, img_server, img_url, time FROM `item_image` WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit;
             $re = DB::query($sql);
             if ($re) {
                 while ($row = mysql_fetch_assoc($re)) {
                     $row['image_url'] = $row['img_url'];
                     $row['img_url'] = AZLib::getImageThumb($row['img_url'], 100, 100, 0, $row['img_server']);
                     $items[$row['id']] = $row;
                 }
             }
         }
         $display->add('items', $items);
         $display->add('total', $total);
         $display->add('paging', $paging);
         $display->output('gallery_ajax_entry', false, 'Personal');
         System::halt();
     } else {
         echo "Bạn chưa đăng nhập hoặc đã thoát khỏi hệ thống - Hãy đăng nhập lại!";
     }
 }
Beispiel #17
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $display->add('msg_register', $this->showFormErrorMessages(1));
     $display->add('msg_success', $this->showFormSuccesMessages(1));
     $display->add('show_form', $this->show_form);
     if (AZLib::getParam('page') == 'sign_in' && AZLib::getParam('cmd') == 'register') {
         $is_register = 1;
     } else {
         $is_register = "";
     }
     $display->add('is_register', $is_register);
     $display->add('error_full_name', Url::get('full_name'));
     $display->add('error_email', Url::get('email'));
     $display->add('error_user_name', Url::get('register_user_name'));
     $display->add('error_mobile_phone', Url::get('mobile_phone'));
     $display->add('register_password', Url::get('register_password'));
     $display->add('confirm_password', Url::get('confirm_password'));
     if (isset($_POST['confirm_register_checked']) && $_POST['confirm_register_checked'] == 1) {
         $display->add('confirm_register_checked', 'checked="checked"');
     } else {
         $display->add('confirm_register_checked', '');
     }
     $display->output('Register');
     $this->endForm();
 }
Beispiel #18
0
 function build_user_rss()
 {
     $user_id = (int) AZLib::getParam('user_id');
     $user = User::getUser($user_id);
     if ($user) {
         $subDir = 'rss1/' . floor($user_id / 1000);
         //echo
         $user_id = $user['id'];
         $user['full_name'] != '' ? $user_name = trim(XMLLib::_xml_encode_attribute($user['full_name'])) : ($user_name = trim(XMLLib::_xml_encode_attribute($user['user_name'])));
         $cachefile = 'rss1_user_' . $user_id;
         header("content-type: text/xml");
         if (StaticCache::notExistCache($cachefile, 3600, false, $subDir)) {
             StaticCache::startCache();
             $user_name = "Tin &#273;&#259;ng c&#7911;a " . $user_name;
             $rss = $this->build_rss_cat(0, $user_name, 100, $user_id);
             echo $rss;
             StaticCache::endCache();
         }
     } else {
         REWRITE_ON ? header("Location:" . WEB_ROOT . "rss/") : header("Location:" . WEB_ROOT . "?page=rss");
     }
     System::halt();
 }
Beispiel #19
0
 function register_service_exten()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (User::is_block()) {
         echo "no_permission";
         exit;
     }
     //get user
     $user = User::$current->data;
     $user_name = $user['user_name'];
     //Kieu thanh toan
     $payment_types = (int) Url::get('payment_types');
     //Thong tin gia han
     $order_service_id = (int) Url::get('order_service_id', 0);
     //id order service
     $time_exten = (int) Url::get('time_exten', 0);
     //thoi gian gia han (thang)
     $aryOrderService = array();
     if ($order_service_id) {
         $aryOrderService = DB::select("order_services", "id={$order_service_id}");
     }
     if ($aryOrderService) {
         //kiểm tra thông tin đầu vào
         if ($aryOrderService['user_use'] != $user_name) {
             echo "error";
             exit;
         }
         if ($aryOrderService['active'] != 1) {
             echo "error";
             exit;
         }
         $price = $aryOrderService['price'] / $aryOrderService['time_use'] * $time_exten;
     } else {
         echo "error";
         exit;
     }
     if ($payment_types == 1) {
         $full_name = Url::get("full_name");
         $mobile = Url::get("mobile");
         if (!$full_name || !$mobile) {
             echo "error";
             exit;
         }
         $price = $aryOrderService['price'] / $aryOrderService['time_use'] * $time_exten;
         $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -4, "reg_exten_stt" => 1);
         //insert
         $id = DB::insert('order_services', $orderInfo);
         if ($id) {
             $order_code = "GH_{$order_service_id}_{$id}";
             $return_url = WEB_ROOT . "payment_scs.html?cmd=complete_exten&exten_order_id={$id}&payment_types=1&order_service_id={$order_service_id}&time_exten={$time_exten}";
             $transaction_info = "Thanh toán DV gia hạn Siêu Chăm Sóc {$aryOrderService['type_scs']} cho {$full_name} [ {$user['user_name']} ], số ĐT liên hệ: {$mobile}";
             $order_email = $user['email'];
             //insert payment_scs exten
             $pay_info = $full_name . "," . $user['email'] . "," . $mobile . "," . $aryOrderService['type_scs'];
             $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_type_soha" => 0, "payment_info" => $pay_info, "order_code" => $order_code, "price" => $price, "time" => time(), "error_text" => "Đang chờ thanh toán", "payment_status" => -1, "reg_exten_stt" => 1);
             //insert
             DB::insert('payment_scs', $paymentInfo);
             //Tạo link thanh toán đến Soha Payment
             $url = SohaPay::buildCheckoutUrl($return_url, $transaction_info, $order_code, $price, $order_email, SCS_MERCHANT_SITE_CODE, SCS_SECURE_CODE);
             echo $url;
             exit;
         } else {
             echo "error_connect";
             exit;
         }
     } else {
         if ($payment_types == 2) {
             global $display;
             if ($aryOrderService) {
                 $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1);
                 //insert
                 $id = DB::insert('order_services', $orderInfo);
             }
             if ($id) {
                 $payment_info = "";
                 $full_name = AZLib::getParam('ho_ten');
                 $dienthoai = AZLib::getParam('dien_thoai');
                 $dia_chi = AZLib::getParam('dia_chi');
                 $thanh_pho = AZLib::getParam('thanh_pho');
                 $ngay = AZLib::getParam('ngay');
                 $time = AZLib::getParam('time');
                 $payment_info .= $full_name . "," . $dienthoai . "," . $dia_chi . "," . $thanh_pho . "," . $ngay . "," . $time;
                 //Send email here;
                 $display->add('eb_url', WEB_ROOT);
                 $display->add('user_id', $user['id']);
                 $display->add('user_name', $user['user_name']);
                 $display->add('full_name', $full_name);
                 $display->add('dia_chi', $dia_chi);
                 $display->add('thanh_pho', SohaPay::infoForUser($thanh_pho, 'tp'));
                 $display->add('ngay', $ngay);
                 $display->add('time', SohaPay::infoForUser($time, 'time'));
                 $display->add('service_name', $aryOrderService['type_scs']);
                 $display->add('price', number_format($price));
                 $display->add('time_exten', $time_exten);
                 $content_email = $display->output('payment_online_exten_2', 1, 'PaymentScs');
                 $send_mail_stt = "-1";
                 if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) {
                     $send_mail_stt = "1";
                 }
                 //tao mang du lieu cho bang payment scs
                 $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1);
                 //insert
                 DB::insert('payment_scs', $paymentInfo);
                 $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1";
                 echo $url;
                 exit;
             }
         } else {
             if ($payment_types == 3) {
                 global $display;
                 if ($aryOrderService) {
                     $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1);
                     //insert
                     $id = DB::insert('order_services', $orderInfo);
                 }
                 if ($id) {
                     $payment_info = "";
                     if ($user['mobile_phone'] == "") {
                         $phone = $user['home_phone'];
                     } else {
                         $phone = $user['mobile_phone'];
                     }
                     $payment_info .= $user['email'] . "," . $phone;
                     //Send email here;
                     $display->add('eb_url', WEB_ROOT);
                     $display->add('user_id', $user['id']);
                     $display->add('user_name', $user['user_name']);
                     $display->add('service_name', $aryOrderService['type_scs']);
                     $display->add('price', number_format($price));
                     $display->add('time_exten', $time_exten);
                     $content_email = $display->output('payment_online_reg_3', 1, 'PaymentScs');
                     $send_mail_stt = "-1";
                     if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) {
                         $send_mail_stt = "1";
                     }
                     //tao mang du lieu cho bang payment scs
                     $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1);
                     //insert
                     DB::insert('payment_scs', $paymentInfo);
                     $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1";
                     echo $url;
                     exit;
                 }
             } else {
                 if ($payment_types == 4) {
                     global $display;
                     if ($aryOrderService) {
                         $orderInfo = array("user_use" => $user_name, "type_scs" => $aryOrderService['type_scs'], "date_reg" => TIME_NOW, "up_count" => $aryOrderService['up_count'], "cpc_count" => $aryOrderService['cpc_count'], "item_count" => $aryOrderService['item_count'], "take_care" => $aryOrderService['take_care'], "price" => $price, "payment_types" => $payment_types, "time_use" => $time_exten, "active" => -3, "reg_exten_stt" => 1);
                         //insert
                         $id = DB::insert('order_services', $orderInfo);
                     }
                     if ($id) {
                         $banking_type = Url::get('banking_type');
                         $banking_code = SohaPay::listBankCode($banking_type);
                         $payment_info = "";
                         if ($user['mobile_phone'] == "") {
                             $phone = $user['home_phone'];
                         } else {
                             $phone = $user['mobile_phone'];
                         }
                         $payment_info .= $user['email'] . "," . $phone . "," . $banking_code;
                         //Send email here;
                         $display->add('eb_url', WEB_ROOT);
                         $display->add('user_id', $user['id']);
                         $display->add('user_name', $user['user_name']);
                         $display->add('service_name', $aryOrderService['type_scs']);
                         $display->add('price', number_format($price));
                         $display->add('banking_type', $banking_type);
                         $display->add('accNumber', SohaPay::listAccountNumber($banking_code));
                         $display->add('banking_name', SohaPay::listBanking($banking_code));
                         $display->add('banking_note', SohaPay::listBanking($banking_code, true));
                         $display->add('time_exten', $time_exten);
                         $content_email = $display->output('payment_online_reg_4', 1, 'PaymentScs');
                         $send_mail_stt = "-1";
                         if (System::sendEBEmail($user['email'], '[AzNetGroup] Gia hạn thành công dịch vụ Siêu Chăm Sóc!', $content_email)) {
                             $send_mail_stt = "1";
                         }
                         //tao mang du lieu cho ban payment scs
                         $paymentInfo = array("order_service_id" => $id, "user_id" => $user['id'], "user_name" => $user['user_name'], "payment_types" => $payment_types, "payment_info" => $payment_info, "price" => $price, "payment_status" => 0, "send_mail_stt" => $send_mail_stt, "reg_exten_stt" => 1);
                         //insert
                         DB::insert('payment_scs', $paymentInfo);
                         $url = WEB_ROOT . "payment_scs.html?cmd=payment_finish&id={$id}&exten=1";
                         echo $url;
                         exit;
                     }
                 }
             }
         }
     }
 }
Beispiel #20
0
    function get_more_comment()
    {
        $parent_id = AZLib::getParam('comment_id');
        $item_user_name = AZLib::getParam('item_user_name');
        $item_id = AZLib::getParam('item_id');
        $cat_id = AZLib::getParam('cat_id');
        $guest_email = AZLib::getParam('guest_email');
        $guest_name = AZLib::getParam('guest_name');
        //$cur_id  		= AZLib::getParam('cur_id',0);
        $cur_id = User::id();
        $item_user_id = AZLib::getParam('user_id');
        $show_guest_email = User::have_cat_permit($cat_id) || User::id() == $item_user_id;
        $sql = 'SELECT `comment`.`id`, `time`, `content`, `item_id`, `sender_email`, `sender_user_name`, user.img_server, `receiver_user_name`,`sender_user_id`, `receiver_user_id`, `parent_id`, `have_child`, user.avatar_url, user.id as user_id, user.gids, user.block_time FROM `comment` LEFT JOIN `user` ON user.id=comment.sender_user_id
					WHERE `comment`.`parent_id` =' . $parent_id . ' AND `comment`.`display`=0 ORDER BY time DESC LIMIT 0,100';
        $re = DB::query($sql);
        $i = 0;
        $result = '';
        $str_user_id = '';
        while ($item = mysql_fetch_assoc($re)) {
            $item['index'] = $i;
            $i++;
            if ($item['block_time'] > TIME_NOW) {
                $item['is_block'] = 1;
            } else {
                $item['is_block'] = 0;
            }
            $str_user_id .= ($str_user_id != '' ? ',' : '') . $item['sender_user_id'];
            //set quyen quan tri
            if ($item['gids']) {
                $is_admin_mod = CGlobal::$group[User::check_admin($item['gids'])];
            } else {
                $is_admin_mod = array();
            }
            $item['is_admin_mod'] = $is_admin_mod;
            if (TIME_NOW - $item['time'] < 24 * 3600) {
                $time_left = TIME_NOW - $item['time'];
                $hour = floor($time_left / 3600);
                $day = '';
                $minute = floor($time_left % 3600 / 60) . ' phút';
                $time_left = ($hour ? $hour . ' giờ ' : '') . $minute;
                if ($time_left == 0) {
                    $time_left = 'Vài giây';
                }
                $item['created_time'] = $time_left . ' trước';
            } elseif (date('Y') != date('Y', $item['time'])) {
                $item['created_time'] = date('H:i | d.m.Y', $item['time']);
            } else {
                $item['created_time'] = date('H:i | d.m', $item['time']);
            }
            $item['content'] = AZLib::parseBBCode($item['content']);
            if ($item['sender_user_id']) {
                $item['sender_link'] = Url::build('shop', array('user_name' => $item['sender_user_name']));
            } else {
                $item['sender_link'] = '';
            }
            $item['URL_badcontent'] = Url::build('item_detail', array('id' => Url::get('id'), 'ctype' => 'comment', 'id_comment' => $item['id']));
            $result .= '<tr id="' . $item['id'] . '"';
            $result .= ' onmouseover="show_hide_menu(' . $item['id'] . ')" onmouseout="show_hide_menu(' . $item['id'] . ')" ';
            $result .= '><td width="28" align="right" valign="top"><div style="height:5px"><span></span></div>';
            if ($item['sender_user_id'] == 0) {
                if ($item['id'] % 3 == 0) {
                    $item['sender_avatar_url'] = 'style/images/avatar_01.gif';
                } elseif ($item['id'] % 3 == 1) {
                    $item['sender_avatar_url'] = 'style/images/avatar_02.gif';
                } else {
                    $item['sender_avatar_url'] = 'style/images/avatar_03.gif';
                }
                $html_content = '';
                $result .= '<div class="feedbackAvatarSub" id="avatar_content_' . $item['user_id'] . '"><img src="' . $item['sender_avatar_url'] . '" width="25" height="25" /></div>';
            } else {
                if ($item['avatar_url']) {
                    $item['sender_avatar_url'] = AZLib::getImageThumb($item['avatar_url'], 60, 0, 1, $item['img_server']);
                    if ($item['parent_id'] > 0) {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="25"/></a>';
                    } else {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="' . $item['sender_avatar_url'] . '" width="50"/></a>';
                    }
                } else {
                    $item['sender_avatar_url'] = '';
                    if ($item['parent_id'] > 0) {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="25" height="25" /></a>';
                    } else {
                        $html_content = '<a href="' . $item['sender_link'] . '"><img src="style/images/50x50.gif" width="50" height="50" /></a>';
                    }
                }
                $result .= '<div class="profile_load"  id="c' . $item['id'] . '" lang="' . $item['user_id'] . '"><div class="feedbackAvatarSub" ';
                $result .= ' id="avatar_content_' . $item['user_id'] . '"><div class="bubbleInfo" id="info_' . $item['id'] . '" lang="' . $item['user_id'] . '"><div class="commentAva trigger">' . $html_content . '</div><!-- BEGIN POPUP MENU --><div class="popup" style="text-align: left;"><div id="show_mini_profile_c' . $item['id'] . '" style="display:none;"></div><div id="hide_mini_profile_c' . $item['id'] . '"><div class="contentPop" style="background-color:#fff"><div style="margin:4px;"><div class="blastTopLeft"><div class="blastTopRight"><div class="blastTopbg"><span></span></div></div></div><div class="blast"><img src="style/images/ajax-loader4.gif" width="62" height="13" /></div><div class="blastBottomLeft"><div class="blastBottomRight"><div class="blastBottombg"><span></span></div></div></div></div></div></div></div><!--END POPUP MENU --></div></div></div>';
            }
            $result .= '</td><td valign="top"><div class="contentFeedback" align="left"><div ';
            if (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 9 || $item['is_admin_mod']['id'] == 1)) {
                $result .= ' class="topFeedback_admin" ';
            } elseif (isset($item['is_admin_mod']['id']) && ($item['is_admin_mod']['id'] == 2 || $item['is_admin_mod']['id'] == 3)) {
                $result .= ' class="topFeedback_mod" ';
            } elseif ($item['sender_user_name'] == $item_user_name) {
                $result .= ' class="topFeedbackSelf" ';
            } else {
                $result .= ' class="topFeedback"';
            }
            $result .= ' >';
            if ($item['sender_user_id'] == 0) {
                $result .= ' <span class="guest_name">' . $item['sender_user_name'];
                $result .= $show_guest_email ? '<a href="mailto:' . $item['sender_email'] . '" title="Gửi e-mail cho người dùng này!"><img src="style/images/comment_email/email.gif" border="0" width="15" height="11"/></a>' : '';
                $result .= '</span>';
            } else {
                $result .= ' <a ';
                $result .= $item['is_block'] == 1 ? ' title="Đang bị khóa nick" ' : ' ';
                $result .= $item['is_admin_mod'] ? ' title="' . $item['is_admin_mod']['des'] . '" ' : ' ';
                $result .= '  href="' . WEB_DIR . $item['sender_user_name'] . '">';
                $result .= $item['is_block'] == 1 ? ' <s><i> ' : ' ';
                $result .= $item['sender_user_name'];
                $result .= $item['is_block'] == 1 ? ' </i></s> ' : ' ';
                $result .= '</a>';
            }
            $result .= ' <span class="fb_time">' . $item['created_time'] . '</span> ';
            $result .= '<div class="floatRight" style="margin-top:-12px; height:16px"><div id="show_menu_' . $item['id'] . '" style="display:none">';
            if ($item['user_id'] != $cur_id && $item['sender_user_id'] != 0) {
                $result .= ' <span class="send_pm_fb" onclick="fn_send_pm_fb(' . $item['user_id'] . ',\'' . $item['sender_user_name'] . '\');" id="' . $item['user_id'] . '-' . $item['sender_user_name'] . '" style="margin-left:5px"><a href="javascript: void(0)">gửi tin nhắn </a></span>|<span class="send_fb"><a href="' . WEB_DIR . AZRewrite::formatUrl('?page=shop&user_name=' . $item['sender_user_name'] . '&mode=comment') . '">viết lưu bút</a></span> ';
                if ($item && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || User::have_permit(ADMIN_ITEM)) {
                    $result .= ' | ';
                }
            }
            if ($item && $item['sender_user_id'] == 0 && $cur_id == $item['receiver_user_id'] || User::have_permit(ADMIN_ITEM)) {
                $result .= '<span onclick="fn_click_del_comment_aj(' . $item['id'] . ',' . $item_id . ')" id="' . $item['id'] . '|' . $item_id . '"><a href="javascript:void()"><img src="style/images/icon_delete.gif" width="9" height="9" /></a></span>';
            }
            $result .= '</div></div><div style="clear:both"><span></span></div>';
            $result .= ' </div> <div align="center" id="mess_success_' . $item['id'] . '" style="display:none" class="mess_success"></div> <div class="detailFeedback" align="left"  style="width:485px; overflow:hidden">' . $item['content'] . '</div> ';
            if ($item['user_id'] != $cur_id) {
                $result .= '<div id="reply_' . $item['id'] . '" ><div  class="btn_fast_reply" onmouseout="if(this.className==\'btn_fast_reply_hover\')this.className=\'btn_fast_reply\'" onmouseover="if(this.className==\'btn_fast_reply\')this.className=\'btn_fast_reply_hover\'" style="float:right" onclick="show_box_reply(' . $item['id'] . ',' . $item['parent_id'] . ',\'' . $guest_name . '\',\'' . $guest_email . '\',\'' . $item['sender_user_name'] . '\',' . $item['sender_user_id'] . '); return true;">trả lời</div></div>';
                $result .= ' <div style="clear:right" id="box_reply_' . $item['id'] . '"></div>';
            }
            $result .= '</div></td></tr><tr id="space_' . $item['id'] . '"><td height="1" colspan="2"><div style="height:1px; margin:5px 0; background-color:#fff"><span></span></div></td></tr>';
            $result .= '</tr>';
        }
        echo $result;
        System::halt();
    }
 function action_reply_entry_comment()
 {
     $act_ = Url::get('act_');
     $comment_id = (int) Url::get('re_c_entry_id', 0);
     $content = '';
     $json = "";
     if (!User::is_login()) {
         $json = '({"msg":"no_login"})';
         echo $json;
         exit;
     }
     if (User::is_block() || !$comment_id || $act_ != 'skip' && $act_ != 'reply') {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     $comment_row = DB::select('user_entry_comment', "id={$comment_id}");
     if (!$comment_row || $comment_row && $comment_row['replied_user_id'] != User::id()) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     if ($comment_row['parent_id'] == 0 || $comment_row['receiver_user_id'] == User::id() || $comment_row['sender_user_id'] == User::id() || $act_ == 'reply' && $comment_row['replied_status'] == 1) {
         //Không được trả lời cho chính mình! hoặc trả lời phản hồi đã đc trả lời rồi!
         $json = '({"msg":"success"})';
         echo $json;
         exit;
     }
     $entry_id = $comment_row['entry_id'];
     $entry = DB::select('user_entry', "id={$entry_id}");
     if (!$entry || $entry && $entry['status'] == 0) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     $json = '({"msg":"success"';
     if ($act_ == 'reply') {
         $content = trim(AZLib::getParam('content'));
         if (!$content) {
             $json = '({"msg":"short_content"})';
             echo $json;
             exit;
         }
         if (AZLib::checkBadWord($content)) {
             $json = '({"msg":"bad_word"})';
             echo $json;
             exit;
         }
         $content = preg_replace("/\n/", "<br />", $content);
         $content = str_replace('<br /><br />', '&nbsp;', $content);
         $parent_id = $comment_row['parent_id'];
         if ($comment_row['sender_user_id']) {
             $content = '@<a href="' . WEB_DIR . $comment_row['sender_user_name'] . '" class="fast_reply_link" title="' . $comment_row['sender_user_name'] . '">' . $comment_row['sender_user_name'] . '</a>: ' . $content;
         } else {
             $content = '<font color="#999">@<span style="text-decoration:underline">' . $comment_row['sender_user_name'] . '</span> </font>: ' . $content;
         }
         $comment = array('time' => time(), 'post_ip' => AZLib::ip(), 'content' => $content, 'entry_id' => $entry['id'], 'order_time' => time(), 'parent_id' => $parent_id, 'receiver_user_id' => $entry['user_id'], 'receiver_user_name' => $entry['user_name'], 'display' => 1, 'status' => 1);
         $comment['sender_user_id'] = User::id();
         $comment['sender_user_name'] = User::user_name();
         if ($comment_row['sender_user_id']) {
             $comment['replied_user_id'] = $comment_row['sender_user_id'];
             $comment['replied_user_name'] = $comment_row['sender_user_name'];
         }
         $id = DB::insert('user_entry_comment', $comment);
         if ($id) {
             $re = DB::query("SELECT id FROM user_entry_comment WHERE parent_id = {$parent_id} AND display = 1 ORDER BY id DESC LIMIT 3,1");
             if ($re) {
                 if ($row = mysql_fetch_assoc($re)) {
                     if ($row) {
                         DB::query("UPDATE user_entry_comment SET display = 0 WHERE parent_id = {$parent_id} AND display = 1 AND id<={$row['id']}");
                     }
                 }
             }
             if ($comment_id == $parent_id) {
                 DB::query("UPDATE user_entry_comment SET replied_status = 1,have_child = have_child + 1, order_time = " . time() . " WHERE id = {$comment_id}");
             } else {
                 DB::query("UPDATE user_entry_comment SET have_child = have_child + 1, order_time = " . time() . " WHERE id = {$parent_id}");
                 DB::query("UPDATE user_entry_comment SET replied_status = 1 WHERE id = {$comment_id}");
             }
             //Cập nhật đã đọc - trả lời cho feed
             DB::query("UPDATE feed SET status=1 WHERE ref_id = {$comment_id} AND type=6");
         }
         //Cập nhật cron job
         $user_item = User::getUser($entry['user_id']);
         if ($user_item['email'] && $user_item['email_alert'] && $user_item['id'] != User::id()) {
             $link = WEB_ROOT . '?page=user_entry&user_name=' . $entry['user_name'] . '&cmd_entry=view&entry_id=' . $entry['id'] . '&ebname=' . AZLib::safe_title($entry['title']);
             $link = AZRewrite::formatUrl($link);
             $title = "<a href='{$link}' target='_blank' style='text-decoration:none;color:#003399;'><font color='#003399'>{$entry['title']}</font></a>";
             AZLib::addCronJob('entry_comment', AZLib::parseBBCode($content, true), $user_item['id'], User::user_name(), '', $entry['id'], $title, $link);
         }
     } else {
         if ($comment_row['replied_status'] == 0) {
             DB::query("UPDATE user_entry_comment SET replied_status = 1 WHERE id = {$comment_id}");
         }
         //Cập nhật đã đọc - trả lời cho feed
         DB::query("UPDATE feed SET status=1 WHERE ref_id = {$comment_id} AND type=6");
     }
     $json .= "})";
     echo $json;
     exit;
 }
Beispiel #22
0
 function produc_hot()
 {
     if (!User::is_login()) {
         echo 'no_login';
         exit;
     }
     if (!User::have_permit(ADMIN_CATEGORY)) {
         echo 'no_perm';
         exit;
     }
     $cat_id = AZLib::getParam('cat_id', '0');
     $item_ids = AZLib::getParam('item_ids');
     $vip_item_ids = AZLib::getParam('vip_item_ids');
     if ($item_ids == '' && $vip_item_ids == '') {
         //$file = DIR_CACHE."html/product_hot/data_".$cat_id.".js";
         //if(@file_exists($file)){
         //	StaticCache::delCache("product_hot/data_".$cat_id,"js");
         //}
         $sql = "update configs set conf_val = '' where conf_key = 'product_hot_" . $cat_id . "'";
         $sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id;
         DB::query($sql);
         DB::query($sql_vip);
         AZLib::get_item_vip(0, true);
         AZLib::get_config(0, true);
         exit;
     }
     // item thuong
     $item_array = explode(',', $item_ids);
     $items = array();
     foreach ($item_array as $item) {
         if ($item) {
             $items[] = intval($item);
         }
     }
     $id_items_after = '';
     $item_ids = join(',', $items);
     $sql = "delete from configs where conf_key = 'product_hot_" . $cat_id . "'";
     DB::query($sql);
     AZLib::get_config(0, true);
     if ($item_ids != '') {
         $sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t   FROM item \r\n\t\t\t\t\t   WHERE status = 1 AND id IN({$item_ids})";
         $result = DB::query($sql);
         $i = 0;
         while ($item = mysql_fetch_array($result)) {
             if (isset($item['id'])) {
                 $id_items[$i] = $item['id'];
                 $i++;
             }
         }
         $id_items_after = '';
         for ($i = 0; $i < count($item_array); $i++) {
             for ($j = 0; $j < count($id_items); $j++) {
                 if ($item_array[$i] == $id_items[$j]) {
                     $id_items_after .= $id_items[$j] . ",";
                 }
             }
         }
         if ($id_items_after != '') {
             $id_items_after = substr($id_items_after, 0, -1);
         }
         $sql_check = "SELECT id FROM configs WHERE conf_key = 'product_hot_" . $cat_id . "'";
         DB::query($sql_check);
         $row = DB::fetch_row();
         if ($row['id'] != '') {
             $sql = "UPDATE configs SET conf_val = '" . $id_items_after . "' WHERE conf_key = 'product_hot_" . $cat_id . "'";
             DB::query($sql);
             AZLib::get_config(0, true);
             // xoa cache config
         } else {
             $sql = "INSERT INTO configs (`conf_key`,`conf_val`) values ('product_hot_" . $cat_id . "','" . $id_items_after . "')";
             DB::query($sql);
             AZLib::get_config(0, true);
             // xoa cache config
         }
     }
     //item vip
     $vip_item_array = explode(',', $vip_item_ids);
     $vip_items = array();
     foreach ($vip_item_array as $vip_item) {
         if ($vip_item) {
             $vip_items[] = intval($vip_item);
         }
     }
     $vip_id_items_after = '';
     $vip_item_ids = join(',', $vip_items);
     $sql_vip = "delete from item_vip where product_hot_cat_id =" . $cat_id;
     DB::query($sql_vip);
     AZLib::get_item_vip(0, true);
     if ($vip_item_ids != '') {
         $sql = "SELECT id, name, brief, price, currency_id, img_url\r\n\t\t\t\t\t   FROM item \r\n\t\t\t\t\t   WHERE status > 0 AND id IN({$vip_item_ids})";
         $result = DB::query($sql);
         while ($item = mysql_fetch_array($result)) {
             if (isset($item['id'])) {
                 $vip_id_items_after .= $item['id'] . ",";
                 $sql_check = "select count(*) AS total from item_vip where item_id = " . $item['id'] . " And product_hot_cat_id=" . $cat_id;
                 DB::query($sql_check);
                 $row = DB::fetch_row();
                 if ($row['total'] == 0) {
                     $sql = "insert into item_vip (`item_id`,`product_hot_cat_id`) values (" . $item['id'] . "," . $cat_id . ")";
                     DB::query($sql);
                     AZLib::get_item_vip(0, true);
                 }
             }
         }
         if ($vip_id_items_after != '') {
             $vip_id_items_after = substr($vip_id_items_after, 0, -1);
         }
     }
     $id_items_after .= '|' . $vip_id_items_after;
     // check file
     //if(@file_exists(DIR_CACHE."html/product_hot/data_".$cat_id.".js")){
     //StaticCache::delCache("product_hot/data_".$cat_id,"js");
     //}
     AZArrCache::del_cache('arrProductHotCache');
     echo $id_items_after;
     exit;
 }
Beispiel #23
0
    function show_mes_outbox()
    {
        $search_text = AZLib::getParam('search_text');
        $is_archive = Url::get('is_archive', 0);
        $table_topics = 'message_topics';
        $table_text = 'message_text';
        $url_archive = '';
        $url_cmd = '';
        if ($is_archive) {
            $table_topics = $table_topics . '_archive';
            $table_text = $table_text . '_archive';
            $url_cmd = '?cmd=archive';
            $url_archive = '&is_archive=1';
        }
        $condition = $table_topics . '.mt_owner_id =' . User::id() . ' 
					AND ' . $table_topics . '.mt_vid_folder = "sent" 
					AND ' . $table_topics . '.mt_newest = 0';
        if ($search_text && $search_text != "Account thành viên") {
            $condition .= " AND mt_to_name LIKE '%{$search_text}%' ";
        }
        $str_content = '<form name="message">
						<div id="boxFunctions">
							Chọn: 
							<a style="cursor:pointer" id="select_all">Tất cả</a>,
							<a style="cursor:pointer" id="select_read">Đã đọc</a>,
							<a style="cursor:pointer" id="select_unchecked">Không chọn</a>
							<div id="boxFunctionRight">
								<div id="btn_del_mess" align="center" class="btnAllNewFeedback" onmouseout="this.className=\'btnAllNewFeedback\'"  onmouseover="this.className=\'btnAllNewFeedbackHover\'"  style="width:40px;">
									<div class="btnRightAllFeedback" align="center" style="width:40px"><a title="Xóa tất cả tin nhặn đã chọn" href="javascript:void(0)" onClick="return delMessage(0,\'true\',\'outbox\')">Xoá</a></div>
								</div>
							</div>
						</div>
						
						';
        $str_content .= '<table cellpadding="3" cellspacing="0" border="0" width="100%">';
        $sql_count = 'SELECT COUNT(mt_id) AS total_row FROM ' . $table_topics . ' WHERE ' . $condition;
        $total_item = DB::fetch($sql_count, 'total_row', 0);
        $item_per_page = 15;
        $limit = '';
        $divID = 'mess_content';
        $url_path = WEB_DIR . 'ajax.php?act=personal&code=show_mes_outbox' . $url_archive . '&search_text=' . $search_text;
        $paging = AZPagging::AjaxPaging($limit, $total_item, $item_per_page, 5, 'page_mes', '', false, false, $url_path, $divID, true);
        $sql = 'SELECT ' . $table_text . '.msg_id,	' . $table_text . '.msg_author_name, ' . $table_text . '.msg_date, ' . $table_text . '.msg_post, ' . $table_topics . '.mt_id, ' . $table_topics . '.mt_ref_id, 
					' . $table_topics . '.mt_title, ' . $table_topics . '.mt_from_id, ' . $table_topics . '.mt_owner_id, ' . $table_topics . '.mt_read, ' . $table_topics . '.mt_owner_name, ' . $table_topics . '.mt_to_name, 
					user.avatar_url, user.img_server 
				FROM ' . $table_text . ', ' . $table_topics . ', user 
				WHERE ' . $table_text . '.msg_id  = ' . $table_topics . '.mt_msg_id AND ' . $table_topics . '.mt_from_id = user.id AND ' . $condition . ' 
				ORDER BY ' . $table_text . '.msg_date DESC ' . $limit;
        //echo $sql;
        //exit;
        $result = DB::query($sql);
        $stt = 0;
        if ($result) {
            while ($row = mysql_fetch_assoc($result)) {
                if ($stt < $item_per_page) {
                    if ($row['mt_ref_id']) {
                        $sourceTitle = DB::select($table_topics, 'mt_id = ' . $row['mt_ref_id']);
                        if ($sourceTitle['mt_title']) {
                            $row['mt_title'] = $sourceTitle['mt_title'];
                        }
                        //else
                        //{
                        //	$sentTitle = DB::select($table_topics,'mt_mgsid = ' . $row['mt_ref_id']);
                        //}
                        $row["mt_id"] = $row['mt_ref_id'];
                        $row['mt_ref_id'] = 0;
                    }
                    if ($row['avatar_url']) {
                        $row['avatar_url'] = AZLib::getImageThumb($row['avatar_url'], 50, 50, 0, $row['img_server']);
                    } else {
                        $row['avatar_url'] = "style/images/50x50.gif";
                    }
                    //$row['msg_date'] = AZLib::duration_time($row['msg_date']);
                    $msg_date = date('H:i | ', $row['msg_date']);
                    if (date('d.m.y', $row['msg_date']) == date('d.m.y', TIME_NOW)) {
                        $msg_date .= '<font color="green">H&#244;m nay</font>';
                    } else {
                        $msg_date .= date('d.m.y', $row['msg_date']);
                    }
                    $row['msg_date'] = $msg_date;
                    $row['msg_post'] = preg_replace("/\n/", "<br />", $row['msg_post']);
                    $row['msg_post'] = strip_tags(AZLib::parseBBCode(AZLib::convert_one_br($row['msg_post'])), '<br />');
                    if (strlen($row['msg_post']) > 40) {
                        $row['msg_post_short'] = AZLib::word_limit($row['msg_post'], 40, ' ...');
                        //$row['msg_post_short'] = AZLib::cleanHtml(AZLib::word_limit($row['msg_post'],40,' ...'));
                    } else {
                        $row['msg_post_short'] = $row['msg_post'];
                        //$row['msg_post_short'] = AZLib::cleanHtml($row['msg_post']);
                    }
                    //$str_title = '<a onclick="fn_show_mes_detail('.$row["mt_id"].')" rel="history" href="message.html'.$url_cmd.'#outbox/'.$row["mt_id"].'" id="a_'.$row["mt_id"].'" title="Hiển thị chi tiết" >'.$row["mt_title"].'</a> - <span class="textMestime">'.$row['msg_date'].'</span>';
                    if ($row['mt_owner_id'] != User::id()) {
                        $strUser = '******' . $row["mt_owner_name"] . '">' . $row["mt_owner_name"] . '</a>';
                    } else {
                        $strUser = '******' . $row["mt_to_name"] . '">' . $row["mt_to_name"] . '</a>';
                    }
                    if ($row["mt_read"] == 0 && !$is_archive) {
                        $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết" ><b>' . $row["mt_title"] . '</b></a>';
                        $read_class = ' unreadMessage';
                    } else {
                        $str_title = '<a onclick="detail_reload_jcache = true;fn_show_mes_detail(' . $row["mt_id"] . ',1,\'outbox\')" rel="history" id="a_' . $row["mt_id"] . '" href="message.html' . $url_cmd . '#outbox/' . $row["mt_id"] . '" title="Hiển thị chi tiết">' . $row["mt_title"] . '</a>';
                        $read_class = '';
                    }
                    $str_content .= '<tr id="' . $row["mt_id"] . '">
									<td align="center" class="listMessage' . $read_class . '"><input type="checkbox" class="rowbox' . $read_class . '" id="inbox_' . $row["mt_id"] . '" name="inbox[]" value="' . $row["mt_id"] . '"></td>
									<td align="center" class="listMessage' . $read_class . '">
										<a href="' . $row["msg_author_name"] . '"><img src="' . $row["avatar_url"] . '"/></a>
									</td>
									<td valign="top" class="listMessage' . $read_class . '" style="white-space:nowrap; padding-right:15px; vertical-align:middle;">
										<div>' . $strUser . '</div>
										<div class="textMestime">' . $row['msg_date'] . '</div>
									</td>
									<td valign="top" class="listMessage clickable' . $read_class . '" style="padding-right:15px;width:65%;" lang="' . $row["mt_id"] . '">
										<div style="margin-top:6px;">' . $str_title . '</div>
										<div style="margin:6px 0;color:#808080">' . $row['msg_post_short'] . '</div>
									</td>
									<td align="center" class="listMessage' . $read_class . '" style="padding-right:10px;"> <span><a title="Xóa tin nhắn" onClick="return delMessage(' . $row["mt_id"] . ',\'false\',\'inbox\')" href="javascript:void(0)" style="padding:20px;" class="deleteButton"> &nbsp;</a></span></td>
								</tr>
								';
                    /*$str_content .= '<tr id="'.$row["mt_id"].'">
                    			<td align="center" class="listMessage' . $read_class . '"><input type="checkbox" id="inbox_'.$row["mt_id"].'" name="inbox[]" value="'.$row["mt_id"].'"></td>
                    			<td align="center" class="listMessage' . $read_class . '">
                    				<a href="'.$row["mt_to_name"].'"><img src="'.$row["avatar_url"].'"  vspace="4" hspace="4"/></a>
                    				<div><a href="'.$row["mt_to_name"].'">'.$row["mt_to_name"].'</a></div>	
                    			</td>
                    			<td valign="top" style="width:65%;" class="listMessage' . $read_class . '">
                    				<div>'.$str_title.'</div>
                    				<div style="margin-top:6px">'.$row['msg_post_short'].'</div>
                    			</td>
                    			<td align="center" class="listMessage' . $read_class . '"> <span><a title="Xóa tin nhắn" onClick="delMessage('.$row["mt_id"].',\'false\',\'sent\')" href="javascript:void(0)"> <img src="style/images/icon_delete.gif" width="9" height="9" /></a></span></td>
                    		</tr>';*/
                }
                $stt++;
            }
        }
        if ($stt > 0) {
            $str_content .= '<tr><td></td><td>
								</td><td colspan="2"><div style="float:right">' . $paging . '</div><div style="clear:right"></div></td></tr>';
        } else {
            $str_content .= '<tr><td></td><td colspan="3">
								<center><div class="noMess">Không có Tin nhắn nào trong tin đã gửi</div></center>
								</td></tr>';
        }
        $str_content .= '</table></form>';
        echo $str_content;
        exit;
    }
Beispiel #24
0
 function draw()
 {
     global $display;
     AZLib::getCats();
     $this->beginForm(false, 'post', false, Url::build_current());
     $created_time_from = 0;
     $created_time_to = 0;
     $time_from = "";
     $time_to = "";
     $phrase_checked = "";
     $free_cat_checked = "";
     $up_checked = "";
     $pagging = "";
     $limit = "";
     $lock_checked = '';
     $select_subcat_checked = '';
     $items = array();
     $id_search = (int) Url::get("id_search");
     $censor = Url::get("censor", 1);
     $user_name = AZLib::getParam("user_name");
     $zone_id = Url::get("zone_id");
     $searchByCat = Url::get("searchByCat");
     $searchByCatType = Url::get("searchByCatType", 0);
     $searchBySubCat = Url::get("searchBySubCat");
     $searchBySubCatType = Url::get("searchBySubCatType", 0);
     $sort_type = Url::get("sort_type", 1);
     $keywords = Url::get("keywords");
     $have_img = Url::get("have_img", 0);
     $lock_item = Url::get("lock");
     $phrase_selected = Url::get("phrase");
     $free_cat_selected = Url::get("free_cat");
     $up = Url::get("up");
     $select_subcat = Url::get("select_subcat", "");
     $opt_have_img = AZLib::getOption(array(0 => "-Tìm theo ảnh-", 1 => "-Có ảnh-", 2 => "-Không ảnh-"), $have_img);
     if (isset($_REQUEST["created_time"]) && $_REQUEST["created_time"]) {
         $time_from = Url::get("created_time");
     }
     if (isset($_REQUEST["created_time_to"]) && $_REQUEST["created_time_to"]) {
         $time_to = Url::get("created_time_to");
     }
     if ($time_from) {
         $date_arr = explode("-", $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 ($time_to) {
         $date_arr = explode("-", $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 = "";
     $where = "";
     //$order_by   	= "ORDER BY del_time DESC";
     $order_by = "";
     $total_item = 0;
     if ($keywords) {
         $search_value = ($search_value == "" ? " WHERE " : " AND ") . "id IN (0)";
     }
     if ($sort_type == 1) {
         $order_by = "ORDER BY id DESC";
     } elseif ($sort_type == 2) {
         $order_by = "ORDER BY modify_time DESC";
     } elseif ($sort_type == 3) {
         $order_by = "ORDER BY item_order ASC";
     }
     if ($free_cat_selected) {
         $free_cat_checked = "checked";
         $catids = implode(",", array_keys(CGlobal::$allCategories));
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id NOT IN({$catids})";
         $order_by = $order_by != "" ? $order_by : "ORDER BY id DESC";
     } else {
         if ($searchBySubCat) {
             if ($searchBySubCatType) {
                 // Nếu chỉ tìm trong danh mục con của danh mục cấp 2
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_2_catid = " . $searchBySubCat;
                 // Lọc những item có trường level_2_catid là danh mục cấp 2
             } else {
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchBySubCat;
                 // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 2
             }
         } elseif ($searchByCat) {
             // Nếu chỉ tìm trong danh mục con của danh mục cấp 1
             if ($searchByCatType) {
                 // Lọc những item có trường level_1_catid là danh mục cấp 1
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "level_1_catid = " . $searchByCat;
             } else {
                 // Ngược lại, lấy các bản ghi thuộc chính danh mục cấp 1
                 $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "category_id = " . $searchByCat;
             }
         }
     }
     if ($censor != 9) {
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "status=" . $censor;
     }
     if ($user_name != "") {
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "user_name ='{$user_name}'";
     }
     if ($select_subcat) {
         $select_subcat_checked = "checked";
     }
     if ($up) {
         if ($created_time_from) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time >= " . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "created_time <= " . $created_time_to;
         }
         $up_checked = "checked";
     } else {
         if ($created_time_from) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time >= " . $created_time_from;
         }
         if ($created_time_to) {
             $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "modify_time <= " . $created_time_to;
         }
     }
     if ($have_img == 1) {
         //có ảnh
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=1";
     } elseif ($have_img == 2) {
         //ko có ảnh
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "have_image=0";
     }
     if ($id_search) {
         //ID sản phẩm
         $search_value .= ($search_value == "" ? " WHERE " : " AND ") . "id={$id_search}";
     }
     if (Url::get("up")) {
         $order_by = $order_by != "" ? $order_by : "ORDER BY created_time DESC";
     } else {
         $order_by = $order_by != "" ? $order_by : "ORDER BY modify_time DESC";
     }
     $sql = "SELECT * FROM item {$search_value} {$order_by}";
     $sql_count = "SELECT count(*) AS total_row FROM item {$search_value}";
     $total_item = (int) DB::fetch($sql_count, "total_row");
     if ($total_item) {
         $pagging = AZPagging::pagingSE($limit, $total_item, 50, 10, 'page_no', true, 'Sản phẩm', 'Trang');
         $sql .= $limit;
     }
     $re = DB::query($sql);
     if ($re) {
         $index_temp = 0;
         while ($item = mysql_fetch_assoc($re)) {
             //trạng thái sản phẩm:
             if ($item['status'] == -1) {
                 $item['bgcolor'] = "bgcolor=\"#FF6633\"";
             } elseif ($index_temp) {
                 $item['bgcolor'] = "bgcolor=\"#EFEFEF\"";
             } else {
                 $item['bgcolor'] = "";
             }
             $index_temp = 1 - $index_temp;
             $item['created_time'] = 'Đăng: <b>' . date("d/m/Y H:i", $item['created_time']) . '</b>';
             if ($item['del_time'] && $item['del_user'] && $item['status'] == -1) {
                 $item['del_time'] = '<br /><font color=red>Xoá: <b>' . date("d/m/Y H:i", $item['del_time']) . '</font></b> ( <a target="_blank" href="' . WEB_DIR . $item['del_user'] . '"><strong>' . $item['del_user'] . '</strong></a>)';
             } else {
                 $item['del_time'] = '';
             }
             if ($item['modify_user_name'] && $item['status'] != -1) {
                 $item['is_modify'] = '<br><font color=gray>Sửa: <b>' . date("d/m/Y H:i", $item['modify_time']) . '</font></b>';
                 $item['is_modify'] .= ' ( <a target="_blank" href="' . WEB_DIR . $item['modify_user_name'] . '"><strong>' . $item['modify_user_name'] . '</strong></a>)';
             } else {
                 $item['is_modify'] = '';
             }
             $item['name'] = AZLib::filter_title($item['name']);
             $item['description'] = AZLib::remove_4_js(AZLib::plainText($item['description']));
             $item['price'] = number_format($item['price'], 0, ',', '.');
             $item['price_out'] = number_format($item['price_out'], 0, ',', '.');
             $item['currency_option'] = AZLib::getOption(array(1 => "VNĐ", 2 => "\$"), $item['currency_id']);
             //$item['price']	=  "Giá bán: ".AZLib::priceFomart($item['price'],$item['currency_id']);
             //$item['price_out']	=  "<br /><font color='#999999'>Giá TT: ".AZLib::priceFomart($item['price_out'],$item['currency_id']).'</font>';
             if ($item['level_1_catid'] > 0) {
                 if (isset(CGlobal::$allCategories[$item['level_1_catid']])) {
                     $item['cat_name'] = '<b>' . CGlobal::$allCategories[$item['level_1_catid']]['name'] . ' (' . $item['level_1_catid'] . ')</b>';
                 } else {
                     $item['cat_name'] = '<b><font color=red>(' . $item['level_1_catid'] . ')</font></b>';
                 }
                 if ($item['category_id'] > 0 && $item['category_id'] != $item['level_1_catid'] || $item['cat_name'] == '') {
                     if (isset(CGlobal::$allCategories[$item['category_id']])) {
                         $item['cat_name'] .= ' - <i>' . CGlobal::$allCategories[$item['category_id']]['name'] . ' (' . $item['category_id'] . ')</i>';
                     } else {
                         $item['cat_name'] .= ' - <i><b><font color=red>(' . $item['category_id'] . ')</font></b></i>';
                     }
                 }
             }
             if ($item['img_url']) {
                 $item['image_src'] = 'http://' . CGlobal::$img_server[$item['img_server']] . $item['img_url'];
                 $item['image'] = AZLib::getImageThumb($item['img_url'], 110, 0, 1, $item["img_server"]);
             } else {
                 $item['image_src'] = '';
                 $item['image'] = '';
             }
             $item['href'] = WEB_DIR . AZRewrite::formatUrl('?page=item_detail&id=' . $item['id'] . '&ebname=' . AZLib::safe_title($item['name']));
             $item['edit'] = Url::build('post_item', array('cmd' => 'edit', 'id' => $item['id']));
             if ($item['status'] == -1) {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=del_forever&id=' . $item['id']);
                 $item['re_post'] = Url::build_all(array('cmd', 'id'), 'cmd=re_post&id=' . $item['id']);
             } elseif ($item['status'] == 2) {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']);
                 $item['show_link'] = Url::build_all(array('cmd', 'id'), 'cmd=show&id=' . $item['id']);
             } else {
                 $item['del_link'] = Url::build_all(array('cmd', 'id'), 'cmd=delete&id=' . $item['id']);
                 $item['hide_link'] = Url::build_all(array('cmd', 'id'), 'cmd=hide&id=' . $item['id']);
             }
             $item['del_cache'] = Url::build_all(array('cmd', 'id'), 'cmd=del_cache&id=' . $item['id']);
             $items[$item['id']] = $item;
         }
     }
     $display->add('items', $items);
     $type_arr = array(1 => "-Sản phẩm không ẩn-", 2 => "-Sản phẩm ẩn-");
     if (User::have_permit(ADMIN_DEL_ITEM)) {
         $type_arr[-1] = "-Sản phẩm đã xoá-";
         $type_arr[9] = "-Tất cả các sản phẩm (Cả sản phẩm xóa)-";
     }
     $option_censor = AZLib::getOption($type_arr, Url::get('censor', 1));
     $display->add('censor', $censor);
     $display->add('option_censor', $option_censor);
     $display->add('have_img_option', $opt_have_img);
     $display->add('lock_checked', $lock_checked);
     $display->add('user_name', $user_name);
     $display->add('created_time', $time_from);
     $display->add('created_time_to', $time_to);
     $display->add('phrase_checked', $phrase_checked);
     $display->add('free_cat_checked', $free_cat_checked);
     $display->add('up_checked', $up_checked);
     $display->add('select_subcat_checked', $select_subcat_checked);
     $display->add('id_search', $id_search);
     $item_cat_search = $this->GetCatTree();
     $display->add('list_top_cat_js', AZLib::getOption(AZLib::getTopCats(), 999999999));
     $display->add('IS_ADMIN', User::is_admin());
     $display->add('page_no', Url::get('page_no'));
     $display->add('paging', $pagging);
     $display->add('total_item', $total_item);
     $display->add('item_cat', AZLib::getOption($this->getOtionCats(), Url::get('id_cats')));
     $display->add('category_tree', json_encode($item_cat_search));
     $display->add('catSelected', Url::get('searchByCat', 0));
     $display->add('catSelectedType', Url::get('searchByCatType', 0));
     $display->add('subCatSelected', Url::get('searchBySubCat', 0));
     $display->add('subCatSelectedType', Url::get('searchBySubCatType', 0));
     $display->add('keywords', $keywords);
     $display->add('sort_type', $sort_type);
     $display->output('ManageItem');
     $this->endForm();
 }
Beispiel #25
0
 function remove_mem()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (User::is_block()) {
         echo "no_permission";
         exit;
     }
     if (User::have_permit(ADMIN_ITEM)) {
         $item_id = AZLib::getParam('item_id');
         $id = "item:{$item_id}";
         AZMemcache::do_remove($id);
         echo "success";
     } else {
         die("no_permission");
     }
 }
Beispiel #26
0
    function flash_view()
    {
        $item_id = AZLib::getParam('item_id');
        if (!$item_id) {
            die("no_info");
        }
        $html = <<<EOF
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Flash view mode - Enbac.com</title>
<script type="text/javascript" src="javascript/swfobject.js"></script>
<script>
function close_block() { 
  window.parent.jQuery.unblockUI();
}\t
</script>
 
<style type="text/css">\t
\t/* hide from ie on mac \\*/
\t* {
\t\tbackground-color: #000000;
\t\tmargin:0px;
\t\tpadding:0px;
\t}
\t
\thtml {
\t\theight: 100%;
\t\toverflow: hidden;
\t\ttext-align:center;
\t\tmargin:0px;
\t\tpadding:0px;
\t\tbackground-color: #000000;
\t}
\tdiv {
\t\tbackground-color: #000000;
\t\tmargin:0px;
\t\tpadding:0px;
\t\tcolor:#fff;
\t}
\t
\t#flashcontent {
\t\theight: 100%;
\t\tmargin:0px;
\t\tpadding:0px;\t\t
\t}
\t/* end hide */
\t
\tbody {
\t\theight: 100%;
\t\tmargin:0px;
\t\tpadding:0px;
\t\tbackground-color: #000000;
\t\tcolor:#ffffff;
\t\tfont-family:sans-serif;
\t\tfont-size:60;
\t\ttext-align:center;

\t}

\t.close{
\t\tfont-size:22px;
\t\ttext-align:right;
\t\tcursor: pointer;\t\t
\t}
\t#vwraper{
\t\ttext-align:center;\t
\t\theight: 100%;\t
\t} 
\ta {\t
\t\tcolor:#cccccc;
\t}
</style>
</head>
<body>
\t<div id="vwraper">
\t<div class="close" onclick="close_block();">[X] Đóng lại</div>
\t<div id="flashcontent">TiltViewer requires the latest Flash player. <a href="http://www.macromedia.com/go/getflashplayer/">Get Flash here.</a> If you have Flash installed, <a href="index.html?detectflash=false">click to view</a>.</div>
\t<script type="text/javascript">
\t\tvar fo = new SWFObject("includes/extra/TiltViewer.swf", "viewer", "100%", "100%", "9", "#000000");\t\t\t
\t\t
\t\t// TILTVIEWER-PRO CONFIGURATION OPTIONS
\t\t// To use these options, uncomment them by removing the '//' at the start of the line
\t\t// For a description of config options, go to: 
\t\t// http://www.airtightinteractive.com/projects/tiltviewer/pro/config_options.html
\t\t//
\t\t
\t\tfo.addVariable('useFlickr', 'false');
\t\tfo.addVariable('xmlURL', 'ebxml.php%3Fact%3Ditem%26code%3Dtiltviewer_gallery%26item_id%3D{$item_id}');
\t\tfo.addVariable('maxJPGSize','740');
\t\tfo.addVariable('columns', '5');
\t\tfo.addVariable('rows', '3');
\t\tfo.addVariable('linkLabel', "Xem chi tiết");
\t\tfo.addVariable('backColor', "0xDDDDDD");
\t\tfo.addVariable('frameWidth', "-5");
\t\tfo.addVariable('showLinkButton', "false");
\t\t
\t\t//fo.addVariable('showLinkButton', 'true');
\t\tfo.addVariable('zoomedInDistance', '1000');
\t\tfo.addVariable('zoomedOutDistance', '4000');
\t\t//fo.addVariable('fontName', 'Times');
\t\t//fo.addVariable('titleFontSize', '50');
\t\t//fo.addVariable('descriptionFontSize', '20');
\t\t//fo.addVariable('linkFontSize', '40');\t
\t\t//fo.addVariable('textColor', '0xff0000');
\t\t//fo.addVariable('linkTextColor', '0x00ff00');
\t\t//fo.addVariable('linkBkgndColor', '0x0000ff');\t\t
\t\t//fo.addVariable('frameColor', '0xff0000');
\t\t//fo.addVariable('bkgndInnerColor', '0xff00ff');
\t\t//fo.addVariable('bkgndOuterColor', '0x0000ff');\t\t
\t\t//
\t\t// END TILTVIEWER-PRO CONFIGURATION OPTIONS
\t\t
\t\tfo.addParam("allowFullScreen","true");
\t\tfo.addParam("enableSounds","false");
\t    fo.addParam('allowscriptaccess','always');
\t    fo.addParam('allowfullscreen','true');
\t\tfo.write("flashcontent");\t
\t</script>
\t</div>
</body>
</html>
EOF;
        echo $html;
        exit;
    }
Beispiel #27
0
 function on_submit()
 {
     $status = (int) Url::get('status');
     $title = trim(AZLib::getParam('title', ''));
     $note = trim(AZLib::getParam('note', ''));
     if (!$title) {
         $this->setFormError('title', "Bạn chưa nhập vào tiêu đề!");
     }
     $h_start = Url::get('h_start', 0);
     $min_start = Url::get('min_start', 0);
     $date_start = Url::get('date_start', '');
     $h_end = Url::get('h_end', 0);
     $min_end = Url::get('min_end', 0);
     $date_end = Url::get('date_end', '');
     if ($h_start > 23 || $h_start < 0) {
         $this->setFormError('h_start', "Phút bắt đầu chạy sai định dạng!");
     }
     if ($min_start > 59 || $min_start < 0) {
         $this->setFormError('min_start', "Phút bắt đầu chạy sai định dạng!");
     }
     if ($h_end > 23 || $h_end < 0) {
         $this->setFormError('h_start', "Giờ kết thúc sai định dạng!");
     }
     if ($min_end > 59 || $min_end < 0) {
         $this->setFormError('min_end', "Phút kết thúc chạy sai định dạng!");
     }
     $arr = split('-', $date_start);
     if (count($arr) == 3 && $arr[0] > 1 && $arr[0] < 32 && $arr[1] > 1 && $arr[1] < 13 && $arr[2] >= date("Y", TIME_NOW) && $arr[2] <= date("Y", TIME_NOW) + 1) {
         $time_start = mktime($h_start, $min_start, 0, $arr[1], $arr[0], $arr[2]);
     } else {
         $this->setFormError('date_start', "Ngày bắt đầu sai định dạng!");
     }
     $arr = split('-', $date_end);
     if (count($arr) == 3 && $arr[0] > 1 && $arr[0] < 32 && $arr[1] > 1 && $arr[1] < 13 && $arr[2] >= date("Y", TIME_NOW) && $arr[2] <= date("Y", TIME_NOW) + 1) {
         $time_end = mktime($h_end, $min_end, 59, $arr[1], $arr[0], $arr[2]);
     } else {
         $this->setFormError('date_end', "Ngày kết thúc sai định dạng!");
     }
     echo $time_start, '<br />';
     echo $time_end;
     if ($time_end < TIME_NOW - 600) {
         $this->setFormError('date_end', "Thời gian kết thúc phải sau thời gian hiện tại ít nhất là 10 phút!");
     }
     if ($time_start > $time_end - 600) {
         $this->setFormError('date_end', "Thời gian bắt đầu phải trước thời gian kết thúc ít nhất là 10 phút!");
     }
     $img_url = '';
     $img_server = 0;
     if (isset($_FILES["img_url"]) && $_FILES["img_url"]['name']) {
         $upload_path = "event/" . date('Y/m/', TIME_NOW);
         if (AZLib::ftp_check_dir($upload_path, true, IMAGE_SERVER_NO)) {
             $file_name = strtolower($_FILES["img_url"]['name']);
             $file_ext = AZLib::getExtension($file_name);
             if (in_array($file_ext, array('.jpg', '.jpeg', '.gif', '.png'))) {
                 if (!$_FILES["img_url"]['error']) {
                     list($imagewidth, $imageheight, $imageType) = getimagesize($_FILES["img_url"]['tmp_name']);
                     if ($imagewidth && $imageheight && $_FILES["img_url"]['size'] <= Item::MAX_UPLOAD_SIZE) {
                         $img_url = $upload_path . date("YmdHis", TIME_NOW) . '_' . User::id() . "_" . substr(AZLib::make_safe_name(basename(strtolower($file_name), $file_ext)), 0, 36) . $file_ext;
                         $img_server = IMAGE_SERVER_NO;
                         if (!AZLib::ftp_image_put_file($img_url, $_FILES["img_url"]['tmp_name'], IMAGE_SERVER_NO)) {
                             $this->setFormError('img_url', "Không upload được ảnh!");
                         }
                     } else {
                         $json['error'] = 'over_max_size';
                         //Sai định dạng file hoặc upload dung lượng quá lớn
                     }
                 } elseif ($_FILES["img_url"]['error'] == 1) {
                     $json['error'] = 'over_max_size';
                 }
             } else {
                 $this->setFormError('img_url', "Sai định dạng ảnh, chỉ dùng file dạng .jpg, .jpeg, .gif, .png!");
             }
         }
     } else {
         $this->setFormError('img_url', "Ngày kết thúc sai định dạng!");
     }
     if (!$this->errNum) {
         $this->a_row = array('title' => $title, 'status' => $status, 'img_url' => $img_url, 'img_server' => $img_server, 'time_start' => $time_start, 'time_end' => $time_end, 'time_run' => 0, 'run_key' => '', 'user_c' => User::user_name(), 'time_c' => TIME_NOW, 'user_m' => User::user_name(), 'time_m' => TIME_NOW, 'note' => $note);
         DB::insert("event_product", $this->a_row);
         Url::redirect_current();
     }
 }
Beispiel #28
0
 function draw()
 {
     global $display;
     $this->beginForm();
     $display->add('msg', $this->showFormErrorMessages(1));
     if (AZLib::getParam('page') == 'sign_in') {
         $is_sign_in = 1;
     } else {
         $is_sign_in = 0;
     }
     $display->add('is_sign_in', $is_sign_in);
     $display->add('user_name_this', AZLib::getParam('user_name_this'));
     $display->add('password_this', AZLib::getParam('password_this'));
     if (OPENID_ON) {
         $href = Url::get('href');
         if ($href) {
             $display->add('url_openid', OID_URL . '?openid_identifier=http://me.yahoo.com/&long_redirect=' . $href);
             $display->add('url_openid_gog', OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id&long_redirect=' . $href);
         } else {
             $display->add('url_openid', OID_URL . '?openid_identifier=http://me.yahoo.com/');
             $display->add('url_openid_gog', OID_URL . 'index.html?openid_identifier=https://www.google.com/users/o8/id');
         }
     }
     $display->add('OPENID_ON', (int) OPENID_ON);
     $display->output('sign_in');
     $this->endForm();
 }
Beispiel #29
0
 function add_edit_ban_ip()
 {
     if (!User::have_permit(ADMIN_ITEM)) {
         echo "no_perm";
         exit;
     }
     $user_name = User::user_name();
     $create_time = TIME_NOW;
     $ban_id = Url::get('ban_id', 0);
     $ban_ip = Url::get('ban_ip', 0);
     $ban_reason = AZLib::getParam('ban_reason', "");
     if ($ban_ip) {
         $ban_ip = str_replace(' ', '', $ban_ip);
         $item_array = array('ip' => $ban_ip, 'reason' => $ban_reason, 'create_time' => $create_time, 'user_name' => $user_name);
         if (!$ban_id) {
             DB::insert('ban_ip', $item_array);
             $ban_id = mysql_insert_id();
         } else {
             DB::update('ban_ip', $item_array, 'id = ' . $ban_id);
         }
         $item_array += array('id' => $ban_id);
         $item_array['create_time'] = date('d/m - h:i', $item_array['create_time']);
         // cho mang vao memcache
         $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']);
             $arr_mem_cache[$row['ip']] = $row;
         }
         AZMemcache::do_put('list_ban_ip', $arr_mem_cache);
         echo json_encode($item_array);
     } else {
         echo "not_ip";
     }
     exit;
 }
Beispiel #30
0
 function draw()
 {
     $keywords = AZLib::getParam('keywords');
     if ($this->search_catid && $keywords != '') {
         global $display;
         $filter_groups = array();
         $filter_ids = trim(DB::fetch("SELECT GROUP_CONCAT(filter_ids SEPARATOR ',') AS filter_ids FROM (SELECT filter_ids FROM item WHERE " . CGlobal::$item_condition . " AND filter_ids != '') AS filter", 'filter_ids', ''));
         $pf_array = array();
         if ($filter_ids != '') {
             $f_array = array_count_values(explode(',', $filter_ids));
             foreach ($f_array as $fid => $count) {
                 if (isset(CGlobal::$allFilters[$fid])) {
                     $fgid = CGlobal::$allFilters[$fid]['fgid'];
                     if (isset(CGlobal::$all_gfilters[$fgid])) {
                         $pf_array[$fgid][$fid] = $count;
                     }
                 }
             }
         }
         //Tạo Menu Filter
         if ($this->filter_groups) {
             foreach ($this->filter_groups as $fgid => $gfilter) {
                 if (isset($pf_array[$fgid])) {
                     if ($gfilter['filters']) {
                         $group_filter = array();
                         foreach ($gfilter['filters'] as $fid => $filter) {
                             if (isset($pf_array[$fgid][$fid])) {
                                 if (!$group_filter) {
                                     $group_filter = array('name' => CGlobal::$all_gfilters[$fgid]['name'], 'filters' => array());
                                 }
                                 $link = '';
                                 if (isset($this->filter_get[$fgid]) && $this->filter_get[$fgid] == $filter['id']) {
                                     $link_name = Url::build_all(array('filter', 'max', 'min'));
                                     foreach ($this->filter_get as $get_gid => $get_fid) {
                                         if ($get_gid != $fgid) {
                                             $link_name .= "&filter[{$get_gid}]={$get_fid}";
                                         }
                                     }
                                     if ($this->min) {
                                         $link_name .= "&min=" . $this->min;
                                     }
                                     if ($this->max) {
                                         $link_name .= "&max=" . $this->max;
                                     }
                                     $group_filter['filters'] = array($fid => array('link' => $link_name, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid], 'remove' => 1));
                                     break;
                                 } else {
                                     $link = Url::build_all(array('filter', 'max', 'min'));
                                     if ($this->filter_get) {
                                         foreach ($this->filter_get as $get_gid => $get_fid) {
                                             if ($get_gid != $fgid) {
                                                 $link .= "&filter[{$get_gid}]={$get_fid}";
                                             }
                                         }
                                     }
                                     $link .= "&filter[{$fgid}]={$filter['id']}";
                                     //$link = str_replace(array('?filter=&','?filter=','&filter='),array('?','',''),$link);
                                     if ($this->min) {
                                         $link .= "&min=" . $this->min;
                                     }
                                     if ($this->max) {
                                         $link .= "&max=" . $this->max;
                                     }
                                 }
                                 $group_filter['filters'][$fid] = array('link' => $link, 'name' => $filter['name'], 'count' => $pf_array[$fgid][$fid]);
                             }
                         }
                         if ($group_filter) {
                             $filter_groups[$fgid] = $group_filter;
                         }
                     }
                 }
             }
         }
         $display->add('url_filter', WEB_DIR . "c" . $this->search_catid . "/" . Url::get('ebname'));
         $display->add('filter_groups', $filter_groups);
         $display->add('filter_price', $this->filter_price);
         $display->output("FilterMenuSearch");
     }
 }