本文整理汇总了PHP中AZLib::getCats方法的典型用法代码示例。如果您正苦于以下问题:PHP AZLib::getCats方法的具体用法?PHP AZLib::getCats怎么用?PHP AZLib::getCats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AZLib
的用法示例。
在下文中一共展示了AZLib::getCats方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: draw
function draw()
{
global $display;
AZLib::getCats();
$this->beginForm();
$item = Item::get_item($this->booking_vip['item_id']);
if (!$item || $item && $item['status'] == -1) {
$this->setFormError("item_id", "Tin không tồn tại!");
} else {
$display->add('item_name', stripslashes($item['name']));
$display->add('item_link', Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']))));
}
$top_catid = $item['level_1_catid'];
$cat_id = $item['category_id'];
$display->add('msg', $this->showFormErrorMessages(1));
$display->add('item_id', $this->booking_vip['item_id']);
if ($this->booking_vip['top_cat']) {
$display->add('category', 1);
} else {
if ($this->booking_vip['cat_id']) {
$display->add('category', 2);
}
}
$display->add('num_contract', $this->booking_vip['num_contract']);
$display->add('top_cat_name', CGlobal::$allCategories[$top_catid]['name']);
$display->add('cat_name', CGlobal::$allCategories[$cat_id]['name']);
$display->add('note', stripslashes(Url::get("note", $this->booking_vip['note'])));
$display->add('time_start', Url::get("time_start", date('d-m-Y', $this->booking_vip['time_start'])));
if ($this->booking_vip['time_end']) {
$display->add('time_end', Url::get("time_end", date('d-m-Y', $this->booking_vip['time_end'])));
} else {
$display->add('time_end', Url::get("time_end", ''));
}
$display->output('EditBookingVip');
$this->endForm();
}
示例2: mod_have_cat_permit
static function mod_have_cat_permit($catid)
{
if (User::is_login()) {
if (User::have_permit(ADMIN_ITEM)) {
return TRUE;
}
AZLib::getCats();
if (!isset(CGlobal::$allCategories[$catid])) {
return FALSE;
}
if (isset(User::$current->groups['4'])) {
//Nếu đã phân nhóm
self::get_permits();
if (User::$permit_cats) {
if (CGlobal::$allCategories[$catid]['parent_id']) {
return preg_match("/(" . User::$permit_cats . ")/is", $catid) || preg_match("/(" . User::$permit_cats . ")/is", CGlobal::$allCategories[$catid]['parent_id']);
}
return preg_match("/(" . User::$permit_cats . ")/is", $catid);
}
}
}
return FALSE;
}
示例3: Category
function Category($row)
{
Module::Module($row);
if (User::have_permit(ADMIN_CATEGORY)) {
$cmd = Url::get('cmd');
$mod = Url::get('mod');
switch ($mod) {
case 'zone':
switch ($cmd) {
case 'delete':
// AZLib::del_cache_zone_cat();
$id = (int) Url::get('id', 0);
if ($id) {
$cat_zone = DB::select('category_zone', 'id=' . $id);
if ($cat_zone) {
DB::delete('category_zone', "id = {$cat_zone['id']}");
DB::delete('category_zone_cat', "zoneid = {$cat_zone['id']}");
}
AZLib::getCats(0, 1);
}
Url::redirect_current(array("mod"));
break;
case 'add':
case 'edit':
require_once 'forms/ZoneEdit.php';
$this->add_form(new ZoneEditForm());
break;
/*case 'move_zonecat_up':
case 'move_zonecat_down':
$id=(int)Url::get('id',0);
if($id){
$zonecat=DB::select('category_zone_cat','catid='.(int)Url::get('catid',0).' AND zoneid='.$id);
if($zonecat){
if($cmd=='move_zonecat_up'){
$nearest_zonecat=DB::select('category_zone_cat','position<'.$zonecat['position'].' AND zoneid='.$id.' ORDER BY position DESC');
}
else{
$nearest_zonecat=DB::select('category_zone_cat','position>'.$zonecat['position'].' AND zoneid='.$id.' ORDER BY position ASC');
}
if($nearest_zonecat){
// Vị trí của category trong zone đã được chuẩn hóa
DB::update('category_zone_cat',array('position'=>$nearest_zonecat['position']),'id='.$zonecat['id']);
DB::update('category_zone_cat',array('position'=>$zonecat['position']),'id='.$nearest_zonecat['id']);
}
else
{
//Vị trí không chuẩn, vị trí tiếp theo bằng đúng vị trí của category hiện tại
$nearest_zonecat=DB::select('category_zone_cat','position='.$zonecat['position'].' AND catid<>'.$zonecat['catid'].' AND zoneid='.$id.' ORDER BY position ASC');
if($nearest_zonecat){
if($cmd=='move_zonecat_up')
{
$zonecat['position']++;
}
elseif($zonecat['position'] > 0)
{
$zonecat['position']--;
}
DB::update('category_zone_cat',array('position'=>$zonecat['position']),'id='.$nearest_zonecat['id']);
}
}
}
}
Url::redirect_current(array('mod'=>'zone','cmd'=>'edit','id'=>$id));
break;*/
/*case 'move_zonecat_up':
case 'move_zonecat_down':
$id=(int)Url::get('id',0);
if($id){
$zonecat=DB::select('category_zone_cat','catid='.(int)Url::get('catid',0).' AND zoneid='.$id);
if($zonecat){
if($cmd=='move_zonecat_up'){
$nearest_zonecat=DB::select('category_zone_cat','position<'.$zonecat['position'].' AND zoneid='.$id.' ORDER BY position DESC');
}
else{
$nearest_zonecat=DB::select('category_zone_cat','position>'.$zonecat['position'].' AND zoneid='.$id.' ORDER BY position ASC');
}
if($nearest_zonecat){
// Vị trí của category trong zone đã được chuẩn hóa
DB::update('category_zone_cat',array('position'=>$nearest_zonecat['position']),'id='.$zonecat['id']);
DB::update('category_zone_cat',array('position'=>$zonecat['position']),'id='.$nearest_zonecat['id']);
}
else
{
//Vị trí không chuẩn, vị trí tiếp theo bằng đúng vị trí của category hiện tại
$nearest_zonecat=DB::select('category_zone_cat','position='.$zonecat['position'].' AND catid<>'.$zonecat['catid'].' AND zoneid='.$id.' ORDER BY position ASC');
if($nearest_zonecat){
if($cmd=='move_zonecat_up')
{
$zonecat['position']++;
}
elseif($zonecat['position'] > 0)
{
$zonecat['position']--;
}
DB::update('category_zone_cat',array('position'=>$zonecat['position']),'id='.$nearest_zonecat['id']);
}
}
}
}
Url::redirect_current(array('mod'=>'zone','cmd'=>'edit','id'=>$id));
//.........这里部分代码省略.........
示例4: on_submit
function on_submit()
{
$name = Url::get('name');
$brief_name = Url::get('brief_name');
$status = (int) Url::get('status', 'HIDE');
$position = (int) Url::get('position');
$class = Url::get('class');
$catids = Url::get('catids');
$this->checkFormInput('Tên Danh mục', 'name', $name, 'str', true, '', 1, 255);
$this->checkFormInput('Tên vắn tắt', 'brief_name', $brief_name, 'str', false, '', 1, 255);
//$this->checkFormInput('Mô tả','description',$description,'str',false,'',0,250);
if (!$this->errNum) {
$new_row = array('name' => $name, 'brief_name' => $brief_name ? $brief_name : $name, 'status' => $status, 'class' => $class);
$update_orther_pos = false;
if (Url::get('cmd') == 'edit') {
if ($position > 0 && $position != $this->cat_zone['position']) {
$max_pos = (int) DB::fetch("SELECT max(position) AS max_pos FROM category_zone", 'max_pos');
if ($position > $max_pos) {
$position = $max_pos + 1;
}
$new_row['position'] = $position;
} else {
$position = $this->cat_zone['position'];
}
$id = $this->cat_zone['id'];
DB::update('category_zone', $new_row, 'id=' . $this->cat_zone['id']);
} else {
$max_pos = (int) DB::fetch("SELECT max(position) AS max_pos FROM category_zone", 'max_pos');
if ($position > $max_pos || $position == 0) {
$position = $max_pos + 1;
}
$new_row['position'] = $position;
$id = DB::insert('category_zone', $new_row);
}
if ($id && DB::select('category_zone', "position={$position} AND id!={$id}")) {
DB::query("UPDATE category_zone SET position=position+1 WHERE position>={$position} AND id!={$id}");
}
$all_cats = $this->cats;
$sql_inset = "";
$position = 0;
$arrCatIDs = split(',', $catids);
foreach ($arrCatIDs as $catid) {
//if(isset($all_cats[$catid])){
// unset($all_cats[$catid]);
//}
//else{
$position++;
$sql_inset .= ($sql_inset != '' ? ',' : '') . "({$id},{$catid},{$position})";
//}
}
if ($all_cats) {
//$catids = implode(",",array_keys($all_cats));
//if($catids){
//echo "DELETE FROM category_zone_cat WHERE zoneid=$id AND catid IN($all_cats)";
DB::query("DELETE FROM category_zone_cat WHERE zoneid={$id} AND catid IN({$all_cats})");
//}
}
if ($sql_inset) {
$sql_inset = "INSERT INTO category_zone_cat (zoneid, catid,position) VALUES " . $sql_inset;
//echo $sql_inset;
DB::query($sql_inset);
}
//AZLib::del_cache_zone_cat();
AZLib::getCats(1, true);
//Url::redirect_current(array('mod'));
}
}
示例5: draw
function draw()
{
global $display;
$this->beginForm();
AZLib::getCats();
$items = array();
$item_bookings = array();
$where = '';
$order = 'id DESC';
$catid = Url::get('catid', 0);
$item_id = Url::get('item_id', 0);
$user_add = Url::get('user_add', '');
$num_contract = Url::get('num_contract', '');
$status = Url::get('status', 0);
$time_start = 0;
$time_end = 0;
$date_start = Url::get('date_start');
$date_end = Url::get('date_end');
if ($date_start) {
$arr = explode('-', $date_start);
$time_start = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]);
}
if ($date_end) {
$arr = explode('-', $date_end);
$time_end = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]);
}
if ($time_start >= $time_end) {
$date_end = '';
$time_end = 0;
}
if ($time_start) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_start >= {$time_start}";
$order = 'time_start ASC, id DESC';
}
if ($time_end) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_start <= {$time_end}";
}
$display->add('date_start', $date_start);
$display->add('date_end', $date_end);
$time_start2 = 0;
$time_end2 = 0;
$date_start2 = Url::get('date_start2');
$date_end2 = Url::get('date_end2');
if ($date_start2) {
$arr = explode('-', $date_start2);
$time_start2 = mktime(0, 0, 0, $arr[1], $arr[0], $arr[2]);
}
if ($date_end2) {
$arr = explode('-', $date_end2);
$time_end2 = mktime(23, 59, 59, $arr[1], $arr[0], $arr[2]);
}
if ($time_start2 >= $time_end2) {
$date_end2 = '';
$time_end2 = 0;
}
if ($time_start2) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_end >= {$time_start2}";
if ($order != 'time_start ASC, id DESC') {
$order = 'time_end ASC, id DESC';
}
}
if ($time_end2) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " time_end <= {$time_end2}";
}
$display->add('date_start2', $date_start2);
$display->add('date_end2', $date_end2);
if ($status != 3) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " status = {$status}";
} elseif ($status == 3) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " status in (0,1)";
}
if ($item_id) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " item_id = {$item_id}";
}
if ($user_add != '') {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " user_add = '{$user_add}'";
}
if ($num_contract != '') {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " num_contract = '{$num_contract}'";
}
$zone_id = Url::get("zone_id", 0);
$arr = array(0 => "-- Tất cả Zone --");
foreach (CGlobal::$allZones as $zone) {
$arr[$zone['id']] = $zone['name'];
}
$display->add('zone_option', AZLib::getOption($arr, $zone_id));
$arr = array(0 => "-- Tất cả Danh mục --");
if (isset(CGlobal::$allCategories[$catid])) {
if (CGlobal::$allCategories[$catid]['parent_id']) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " cat_id = {$catid}";
} else {
if (isset(CGlobal::$subCategories[$catid]) && CGlobal::$subCategories[$catid]) {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " (top_cat = {$catid} OR cat_id IN(" . implode(",", array_keys(CGlobal::$subCategories[$catid])) . "))";
} else {
$where .= ($where != '' ? ' AND ' : 'WHERE ') . " top_cat = {$catid}";
}
}
}
if (CGlobal::$allCategories && CGlobal::$subCategories) {
foreach (CGlobal::$subCategories as $topid => $subcats) {
//.........这里部分代码省略.........
示例6: on_submit
function on_submit()
{
$title = AZLib::getParam('subject');
$content = AZLib::getParam('content');
$id_cats = AZLib::getParam('id_cats');
$send_all = AZLib::getParam('send_all');
$usernames = Url::get('user_names');
$start_date = Url::get('start_date');
$end_date = Url::get('end_date');
$start_date_a = Url::get('start_date_a');
$end_date_a = Url::get('end_date_a');
$is_active = Url::get('user_active');
set_time_limit(0);
if ($id_cats != 0) {
//gửi cho thành viên bán theo chuyên mục
$sql_user_sell = 'SELECT user_id, user_name FROM item ';
AZLib::getCats();
if (CGlobal::$allCategories[$id_cats]['parent_id'] > 0) {
$condition = ' category_id = "' . $id_cats . '"';
} else {
$condition = ' level_1_catid = "' . $id_cats . '"';
}
$num_row = mysql_fetch_assoc(DB::query("SELECT count(*) as num_total FROM (SELECT count(*) FROM item WHERE status=1 AND {$condition} GROUP BY user_id) AS i"));
if ($num_row) {
$num_row = (int) $num_row['num_total'];
} else {
$num_row = 0;
}
if ($num_row) {
$num_record = 100;
$num_query = ceil($num_row / $num_record);
$new_row_msg = array('msg_date' => TIME_NOW, 'msg_post' => htmlspecialchars_decode(addslashes($content)), 'msg_sent_to_count' => $num_row, 'msg_deleted_count' => 0, 'msg_author_id' => User::$current->data['id'], 'msg_author_name' => User::$current->data['user_name'], 'msg_ip_address' => AZLib::ip());
if ($title && $content && $num_row > 0) {
$msg_id = DB::insert('message_text', $new_row_msg);
for ($j = 0; $j < $num_query; $j++) {
$value_sql = '';
$update_sql = '';
$user = array();
$sql = 'SELECT user_id, item.user_name FROM item WHERE status=1 AND ' . $condition . ' GROUP BY user_id LIMIT ' . $j * $num_record . "," . $num_record;
$re = DB::query($sql);
if ($re) {
while ($user = mysql_fetch_assoc($re)) {
$value_sql .= ($value_sql ? "," : "") . "('" . $msg_id . "','" . TIME_NOW . "','" . $title . "','" . User::id() . "','" . User::user_name() . "','inbox','" . $user['user_id'] . "','" . $user['user_name'] . "')";
$update_sql .= ($update_sql ? "," : "") . $user['user_id'];
$this->total_record++;
}
$insert_sql = "INSERT INTO `message_topics` (`mt_msg_id`,`mt_date`,`mt_title`, `mt_from_id`, `mt_to_name`, `mt_vid_folder`, `mt_owner_id`, `mt_owner_name`) VALUES " . $value_sql;
DB::query($insert_sql);
DB::query('UPDATE user SET total_pm = total_pm + 1 WHERE id IN(' . $update_sql . ')');
}
}
}
}
} elseif ($usernames != '' || $start_date != '' || $end_date != '' || $is_active) {
$where = 'WHERE is_active = 0 AND block_time <= ' . TIME_NOW;
if ($usernames != '') {
//theo danh sách tài khoản thành viên
$usernames = str_replace(' ', '', $usernames);
$usernames = str_replace('"', '', $usernames);
$usernames = str_replace("'", '', $usernames);
$usernames = str_replace(',', "','", $usernames);
$where .= " AND user_name IN ('" . $usernames . "') ";
} else {
if ($is_active) {
// gửi cho thành viên chính thức
$where .= " AND level>0";
if ($start_date_a != '' && strtotime($start_date_a)) {
$where .= " AND create_time>=" . strtotime($start_date_a);
}
if ($end_date_a != '' && strtotime($end_date_a)) {
$where .= " AND create_time<" . strtotime($end_date_a);
}
} else {
//theo ngay thang nam
if ($start_date != '' && strtotime($start_date)) {
$where .= " AND create_time>=" . strtotime($start_date);
}
if ($end_date != '' && strtotime($end_date)) {
$where .= " AND create_time<" . strtotime($end_date);
}
}
}
$count_total_user = 'SELECT COUNT(*) AS total FROM user ' . $where;
// echo $count_total_user;
// exit;
$num_row = DB::fetch($count_total_user);
$num_record = 1000;
$num_query = ceil($num_row['total'] / $num_record);
$new_row_msg = array('msg_date' => TIME_NOW, 'msg_post' => htmlspecialchars_decode(addslashes($content)), 'msg_sent_to_count' => $num_row['total'], 'msg_deleted_count' => 0, 'msg_author_id' => User::$current->data['id'], 'msg_author_name' => User::$current->data['user_name'], 'msg_ip_address' => AZLib::ip());
if ($title && $content && $num_row['total'] > 0) {
$msg_id = DB::insert('message_text', $new_row_msg);
for ($j = 0; $j < $num_query; $j++) {
$value_sql = '';
$update_sql = '';
$user = array();
$sql = "SELECT id, user_name FROM user " . $where . " ORDER BY id DESC LIMIT " . $j * $num_record . "," . $num_record;
$re = DB::query($sql);
if ($re) {
while ($user = mysql_fetch_assoc($re)) {
$value_sql .= ($value_sql ? "," : "") . "('" . $msg_id . "','" . TIME_NOW . "','" . $title . "','" . User::id() . "','" . User::user_name() . "','inbox','" . $user['id'] . "','" . $user['user_name'] . "')";
//.........这里部分代码省略.........
示例7: unset
//TuấnNK add (20080617_10h):
//Xử lý cập nhật lại category js:
require_once 'core/Debug.php';
//System Debug...
require_once 'core/config.php';
//System Config...
require_once ROOT_PATH . 'core/CGlobal.php';
require_once ROOT_PATH . 'core/DB.php';
//Khởi tạo các biến hệ thống:
global $server_list;
CGlobal::$my_server = $server_list;
unset($server_list);
if (MEMCACHE_ON) {
require_once ROOT_PATH . 'core/AZMemcache.php';
}
require_once ROOT_PATH . 'core/AZLib.php';
require_once ROOT_PATH . 'core/AZArrCache.php';
require_once ROOT_PATH . 'core/System.php';
require_once ROOT_PATH . 'core/Url.php';
// Disable ALL magic_quote
set_magic_quotes_runtime(0);
register_shutdown_function(array("DB", "close"));
$cat_file = ROOT_PATH . "javascript/categories.js";
AZLib::getCats();
foreach (CGlobal::$allCategories as $cat) {
$header_eb[] = array('id' => $cat['id'], 'pid' => $cat['parent_id'], 'name' => $cat['name'], 'path' => "c{$cat['id']}/" . ($cat['parent_id'] && isset(CGlobal::$allCategories[$cat['parent_id']]) ? CGlobal::$allCategories[$cat['parent_id']]['ebname'] . "-" : "") . $cat['ebname']);
}
$header_eb_str = "header_eb = " . json_encode($header_eb) . ";";
file_put_contents($cat_file, $header_eb_str);
echo $header_eb_str;
echo "<br /><br /><br />Done!";
示例8: on_submit
//.........这里部分代码省略.........
$new_row = array('name' => $name, 'brief_name' => $brief_name ? $brief_name : $name, 'keywords' => AZLib::word_limit($keywords, 20, ''), 'description' => $description, 'parent_id' => $parent_id, 'ref_id' => $ref_id, 'status' => $status, 'tag_search' => $tag_search, 'img_server' => IMAGE_SERVER_NO, 'price_str' => $price_str, 'recomend' => $recomend);
if (Url::get('cmd') == 'edit') {
if ($position > 0 && $position != $this->cat['position']) {
$max_pos = (int) DB::fetch("SELECT max(position) AS max_pos FROM category WHERE parent_id=" . $parent_id, 'max_pos');
if ($position > $max_pos) {
$position = $max_pos + 1;
}
$new_row['position'] = $position;
} else {
$position = $this->cat['position'];
}
$id = $this->cat['id'];
DB::update('category', $new_row, 'id=' . $this->cat['id']);
/*if($this->cat['parent_id']==0 && $parent_id){
DB::update('category', array('parent_id'=>0),'parent_id='.$this->cat['parent_id']);
}*/
} else {
$max_pos = (int) DB::fetch("SELECT max(position) AS max_pos FROM category WHERE parent_id=" . $parent_id, 'max_pos');
if ($position > $max_pos || $position == 0) {
$position = $max_pos + 1;
}
$new_row['position'] = $position;
$id = DB::insert('category', $new_row);
}
if ($_FILES['cat_image']['tmp_name']) {
if (Url::get('cmd') == 'edit') {
AZLib::ftp_image_delete_file('category/' . $this->cat['id'] . '.gif', $this->cat['img_server']);
}
/*if(AZLib::ftp_image_connect(IMAGE_SERVER_NO)){
if(!AZLib::ftp_check_dir('category/',true,IMAGE_SERVER_NO)){
break ;
}
$file_name ='category/'.$id.'.gif';
$sourceName =$_FILES['cat_image']['tmp_name'];
AZLib::ftp_image_put_file($file_name,$sourceName,IMAGE_SERVER_NO);
//@fopen('http://'.IMAGE_PATH.'?del_cat=1',"r");
}*/
if (AZLib::ftp_check_dir('category/', true, IMAGE_SERVER_NO)) {
$file_name = 'category/' . $id . '.gif';
$sourceName = $_FILES['cat_image']['tmp_name'];
AZLib::ftp_image_put_file($file_name, $sourceName, IMAGE_SERVER_NO);
//@fopen('http://'.IMAGE_PATH.'?del_cat=1',"r");
}
}
if ($id && DB::select('category', 'position="' . $position . '" AND id!="' . $id . '" AND parent_id="' . $parent_id . '"')) {
DB::query('UPDATE category SET position=position+1 WHERE position>=' . $position . ' AND position<=' . $this->cat['position'] . ' AND parent_id="' . $parent_id . '" AND id!=' . $id);
}
$all_zones = $this->zones;
$sql_inset = "";
if ($zoneids) {
foreach ($zoneids as $zoneid) {
if (isset($all_zones[$zoneid])) {
unset($all_zones[$zoneid]);
} else {
$sql_inset .= ($sql_inset != '' ? ',' : '') . "({$zoneid},{$id})";
}
}
}
if ($sql_inset) {
$sql_inset = "INSERT INTO category_zone_cat (zoneid, catid) VALUES " . $sql_inset;
DB::query($sql_inset);
}
if ($all_zones) {
$zoneids = implode(",", array_keys($all_zones));
if ($zoneids) {
DB::query("DELETE FROM category_zone_cat WHERE catid={$id} AND zoneid IN({$zoneids})");
}
}
//AZLib::del_cache_zone_cat();
AZLib::getCats(1, true);
if (Url::get('cmd') == 'edit' && $this->cat['parent_id'] != $parent_id) {
//đổi danh mục cha => cập nhật lại tin
$catid = $this->cat['id'];
$level_1 = 0;
$level_2 = 0;
if ($parent_id) {
if (CGlobal::$allCategories[$parent_id]['parent_id']) {
$level_1 = CGlobal::$allCategories[$parent_id]['parent_id'];
$level_2 = $parent_id;
} else {
$level_1 = $parent_id;
$level_2 = $catid;
}
} else {
$level_1 = $catid;
$level_2 = 0;
}
DB::update("item", array("level_1_catid" => $level_1, "level_2_catid" => $level_2), "category_id={$catid}");
if (MEMCACHE_ON) {
AZMemcache::clear();
}
}
if ($this->cat) {
Url::redirect_current();
} else {
Url::redirect_current(array('cmd'));
}
}
}
示例9: draw
function draw()
{
AZLib::getCats();
global $display;
$this->beginForm();
$page_arr = array();
$page_arr['home'] = 'Trang chủ';
$page_arr['list_detail'] = 'Danh sách sản phẩm';
$page_arr['profile'] = 'Profile thành viên';
$page_arr['sign_in'] = 'Đăng nhập';
$page_arr['item_detail'] = 'Chi tiết sản phẩm';
$page_arr['online'] = 'Thành viên online';
$page_arr['message'] = 'Tin nhắn cá nhân';
$page_arr['post_item'] = 'Đăng sản phẩm';
$page_arr['personal'] = 'Trang cá nhân';
$page_arr['edit_page'] = 'Cấu hình page';
$page_arr['admin'] = 'Trang quản trị';
$page_arr['user'] = 'Quản lý thành viên';
$page_arr['manage_item'] = 'Quản trị Tin';
$page_arr['manage_image'] = 'Quản trị Ảnh';
$page_arr['manage_comment'] = 'Quản Comment';
$page_arr['manage_comment_user'] = 'Quản trị Lưu bút';
$page_arr['manage_bad_content'] = 'Quản trị tin xấu';
$page_arr['manage_badword'] = 'Quản trị Từ xấu';
$page_arr['partner'] = 'Quản trị Đối tác, ADV';
$page_arr['send_multi'] = 'Gửi tin nhắn cho tất cả Thành viên';
$page_arr['page'] = 'Quản trị Page';
$page_arr['module'] = 'Quản trị Modules';
$page_arr['shop'] = 'Trang cá nhân';
$page_arr['sph_search '] = 'Tìm kiếm';
$not_permit_view = array('edit_page', 'admin', 'user', 'manage_item', 'manage_comment', 'manage_image', 'manage_comment', 'manage_comment_user', 'manage_bad_content', 'manage_badword', 'partner', 'send_multi', 'page', 'module');
$cond = '';
$item_type = Url::get('item_type');
$item_id = Url::get('item_id');
$o_name = Url::get('o_name');
$o_id = (int) Url::get('o_id');
$where = 'site';
if ($item_type && $item_id && in_array($item_type, array(1, 2, 3))) {
$cond = ' AND page="ItemDetail" AND item_id=' . $item_id . ' AND item_type=' . $item_type;
if ($item_type == 3) {
$where = '<font color=red>Sản phẩm đấu giá</font>';
} elseif ($item_type == 1) {
$where = '<font color=red>Giao dịch mua</font>';
} else {
$where = '<font color=red>Sản phẩm bán</font>';
}
}
if ($o_name != '') {
$str_search = str_replace("'", '"', $o_name);
$str_search = str_replace("'", '"', $str_search);
$str_search = str_replace(""", '"', $str_search);
$cond .= ' AND session_referer LIKE "%' . $str_search . '%"';
}
if ($o_id) {
$cond .= ' AND user_id =' . $o_id;
} else {
$o_id = '';
}
$open_id_login = (int) Url::get('open_id_login', 0);
if ($open_id_login) {
$display->add('open_id_login_check', 'checked="checked"');
$cond .= " AND login_type = 1 ";
} else {
$display->add('open_id_login_check', '');
}
$display->add('o_name', $o_name);
$display->add('o_id', $o_id);
$total_ss = DB::fetch('SELECT count(*) as total_ss FROM ' . _SESS_TABLE, 'total_ss', 0);
$display->add('total_ss', $total_ss);
$total = DB::fetch('SELECT count(*) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' ' . $cond);
if ($total) {
$total = (int) $total['total'];
} else {
$total = 0;
}
$sql = 'SELECT count(total) as total FROM ( SELECT count(user_id) as total FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id !=0 ' . $cond . ' GROUP BY user_id) as t';
$total_mem = DB::fetch($sql, 'total');
$paging = AZPagging::paging($limit, $total_mem, 25, 10, 'page_view');
DB::query('SELECT session_id, session_expires as time, session_ip as ip, user_id, user_name, session_referer, page, category_id, item_type, item_id, open_id FROM ' . _SESS_TABLE . ' WHERE session_expires >' . (TIME_NOW - 900) . ' AND user_id>0 ' . $cond . ' GROUP BY user_id ORDER BY time DESC' . $limit);
$user_onlines = array();
$i = 1;
while ($item = DB::fetch_row()) {
//$item['viewing_time'] = AZLib::duration(TIME_NOW-$item['time']);
if (date('d', TIME_NOW) != date('d', $item['time'])) {
$item['viewing_time'] = date('H:i d/m/y', $item['time']);
} else {
$item['viewing_time'] = date('H:i', $item['time']);
}
$item['user_name'] = stripslashes($item['user_name']);
$item['title'] = 'Thành viên';
$item['link'] = WEB_DIR . $item['user_name'];
if (isset($page_arr[$item['page']]) && (User::is_admin() || !in_array($item['page'], $not_permit_view))) {
$detail = '';
if ($item['page'] == 'list_detail' && isset(CGlobal::$allCategories[$item['category_id']])) {
$detail = ' - ' . stripslashes(CGlobal::$allCategories[$item['category_id']]['name']);
$parent_id = CGlobal::$allCategories[$item['category_id']]['parent_id'];
if ($parent_id && isset(CGlobal::$allCategories[$parent_id])) {
$detail = ' - ' . stripslashes(CGlobal::$allCategories[$parent_id]['name']) . $detail;
}
}
//.........这里部分代码省略.........
示例10: draw
function draw()
{
global $display;
AZLib::getCats();
$display->add('msg', $this->showFormErrorMessages(1));
$display->add('msgs', $this->showFormSuccesMessages(1));
$this->beginForm(true, 'post', false, Url::build_current());
$display->output('ImportExcel');
$this->endForm();
}
示例11: draw
function draw()
{
$this->beginForm();
global $display;
AZLib::getCats();
$acc_groups = CGlobal::$group;
$user_permits = array();
$user_cats = array();
$all_users = array();
$allist_users = array();
$gids = '';
foreach ($acc_groups as $group) {
$acc_groups[$group['id']]['users'] = array();
$acc_groups[$group['id']]['pids'] = array();
$acc_groups[$group['id']]['pid_str'] = '';
if (!in_array($group['id'], array(1, 9))) {
$gids .= ($gids ? ',' : '') . $group['id'];
}
}
if ($gids) {
// $sql = "SELECT pids,ref_id FROM user_permit WHERE ref_id IN(".$gids.") AND type=0";//lấy quyền của nhóm
$sql = "SELECT type, ref_id, pids, cids FROM user_permit";
//lấy quyền của nhóm
$result = DB::query($sql);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
if ($row['type'] == 0) {
//group
$acc_groups[$row['ref_id']]['pid_str'] .= ($acc_groups[$row['ref_id']]['pid_str'] ? '|' : '') . $row['pids'];
$pids = explode('|', $row['pids']);
$acc_groups[$row['ref_id']]['pids'] = array();
foreach ($pids as $pid) {
$acc_groups[$row['ref_id']]['pids'][$pid] = CGlobal::$permit[$pid];
}
} else {
//user
$user_permits[$row['ref_id']] = $row['pids'];
$user_cats[$row['ref_id']] = $row['cids'];
}
}
}
}
$sql = 'SELECT id, user_name, full_name, gids FROM user AS a WHERE a.gids!="0"';
$result = DB::query($sql);
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$row['full_name'] = AZLib::trimSpace($row['full_name']);
$all_users[$row['id']] = $row;
$row['pid_str'] = isset($user_permits[$row['id']]) ? $user_permits[$row['id']] : '';
$row['cid_str'] = isset($user_cats[$row['id']]) ? $user_cats[$row['id']] : '';
$groups = explode('|', $row['gids']);
foreach ($groups as $gid) {
if (isset($acc_groups[$gid])) {
if (!User::is_root() && $gid == 9) {
$row['del_enable'] = 0;
} else {
$row['del_enable'] = 1;
}
$acc_groups[$gid]['users'][] = $row;
}
}
$pid_str = isset($user_permits[$row['id']]) ? $user_permits[$row['id']] : '';
$cid_str = isset($user_cats[$row['id']]) ? $user_cats[$row['id']] : '';
$pid_arr = explode('|', $pid_str);
$cid_arr = explode(',', $cid_str);
$row['pids'] = array();
$row['cids'] = array();
if ($pid_arr) {
foreach ($pid_arr as $pid) {
if (isset(CGlobal::$permit[$pid])) {
$row['pids'][$pid] = CGlobal::$permit[$pid];
}
}
}
if ($pid_arr) {
foreach ($cid_arr as $cid) {
if (isset(CGlobal::$allCategories[$cid])) {
$row['cids'][$cid] = CGlobal::$allCategories[$cid];
}
}
}
if ($row['pids'] || $row['cids']) {
$allist_users[$row['id']] = $row;
}
}
}
$display->add('acc_groups', $acc_groups);
$display->add('all_users', json_encode($all_users));
$display->add('allist_users', $allist_users);
$all_groups = CGlobal::$group;
if (!User::is_root()) {
unset($all_groups[9]);
}
$display->add('all_groups', json_encode($all_groups));
$display->add('all_permits', json_encode(CGlobal::$permit));
$display->output('ListAdmin');
$this->endForm();
}
示例12: fn_lock_topic
function fn_lock_topic()
{
if (!User::is_login()) {
echo "no_perm";
exit;
}
if (!User::have_permit(ADMIN_ITEM) && !User::is_mod()) {
echo "no_perm";
exit;
}
$id = (int) Url::get('id', 0);
$type = AZLib::getParam('type');
$reason_lock = AZLib::getParam('reason_lock');
$value = $type == 'lock' ? 1 : 0;
if ($id > 0) {
$item = Item::get_item($id);
$item_memcache = $item;
if ($item) {
if (!User::have_permit(ADMIN_ITEM) && !User::have_cat_permit($item['category_id'])) {
echo "no_perm";
exit;
}
DB::query("UPDATE item SET state={$value}, valid_time = " . TIME_NOW . ", valid_user = '" . User::user_name() . "', up_time = " . ($item["up_time"] - TIME_DOWN) . " WHERE id=" . $id);
if (MEMCACHE_ON) {
$item_memcache['state'] = $value;
$item_memcache['valid_time'] = TIME_NOW;
$item_memcache['valid_user'] = User::user_name();
AZMemcache::do_put("item:{$id}", $item_memcache);
}
if ($type == 'lock') {
AZLib::getCats();
$link_help = 'http://help.enbac.com/index.php/Quy_%C4%91%E1%BB%8Bnh_%C4%91%C4%83ng_tin';
if (CGlobal::$allCategories[$item['category_id']]['link_help']) {
$link_help = CGlobal::$allCategories[$item['category_id']]['link_help'];
} elseif (isset(CGlobal::$allCategories[$item['category_id']]['parent_id']) && CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help']) {
$link_help = CGlobal::$allCategories[CGlobal::$allCategories[$item['category_id']]['parent_id']]['link_help'];
}
$receiver_user = DB::select('user', 'id = ' . $item["user_id"]);
$title_pm = 'Thông báo từ EnBac';
$content_pm = 'Tin [url=' . WEB_ROOT . AZRewrite::formatUrl('?page=item_detail&id=' . $id . '&ebname=' . AZLib::safe_title($item['name'])) . ']' . $item['name'] . '[/url] của bạn đã bị khóa với lý do: ' . $reason_lock . '
Bạn click [url=' . $link_help . '][b]vào đây[/b][/url] để xem quy định đăng tin! Hoặc [url=http://blog.enbac.com/?p=28] [b]vào đây[/b][/url] để xem hướng dẫn đăng tin.
Ban quản trị Én bạc.
Vui lòng không trả lời tin nhắn này!';
AZLib::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, true);
$item_array = array('item_id' => $id, 'user_id' => User::id(), 'user_name' => User::user_name(), 'lock_time' => TIME_NOW, 'reason_lock' => $reason_lock);
DB::insert('item_lock', $item_array);
} elseif ($type == 'unlock') {
DB::delete('item_lock', 'item_id=' . $id);
}
echo $type;
exit;
} else {
echo "unsuccess";
exit;
}
} else {
echo "unsuccess";
exit;
}
}
示例13: on_submit
function on_submit()
{
AZLib::getCats();
$sku = AZLib::trimSpace(str_replace("\n", " ", Url::get('sku')));
###############################################################################################
$name = AZLib::trimSpace(str_replace("\n", " ", Url::get('name')));
mb_internal_encoding("UTF-8");
$name = mb_strtoupper(mb_substr($name, 0, 1)) . mb_substr($name, 1);
###############################################################################################
###############################################################################################
$offer = AZLib::trimSpace(str_replace("\n", " ", Url::get('offer')));
mb_internal_encoding("UTF-8");
$offer = mb_strtoupper(mb_substr($offer, 0, 1)) . mb_substr($offer, 1);
###############################################################################################
###############################################################################################
$list_brief = AZLib::trimSpace(str_replace("\n", " ", Url::get('list_brief')));
mb_internal_encoding("UTF-8");
$list_brief = mb_strtoupper(mb_substr($list_brief, 0, 1)) . mb_substr($list_brief, 1);
###############################################################################################
###############################################################################################
//$item_description = AZLib::getParam('item_description');
$item_description = Url::get('item_description');
$brief = Url::get('brief');
if (get_magic_quotes_gpc()) {
$item_description = stripslashes($item_description);
$brief = stripslashes($brief);
}
require_once ROOT_PATH . 'includes/htmLawed.php';
$config = array('safe' => 1, 'elements' => '*', 'deny_attribute' => 'class, id');
$spec = 'a = title, href;';
// The 'a' element can have only these attributes
$item_description = htmLawed($item_description, $config, $spec);
$item_description = AZLib::clean_value($item_description);
$brief = htmLawed($brief, $config, $spec);
$brief = AZLib::clean_value($brief);
###############################################################################################
$category_id = 0;
$level_1_catid = 0;
$first_combo = (int) Url::get('first_combo');
$second_combo = (int) Url::get('second_combo');
$price = Url::cdouble(Url::get('price'));
$price_out = Url::cdouble(Url::get('price_out'));
$currency_id = (int) Url::get('currency_id', 1);
$quantity = Url::cdouble(Url::get('quantity', 0));
if ($quantity < 0) {
$quantity = 0;
}
$item_order = (int) Url::get('item_order');
$made_in = Url::get('made_in');
$warranty = Url::get('warranty');
if (!isset(CGlobal::$currency[$currency_id])) {
$currency_id = 1;
}
$item_category = false;
if ($first_combo && $second_combo) {
$category_id = $second_combo;
$level_1_catid = $first_combo;
$level_2_catid = $second_combo;
if (isset(CGlobal::$allCategories[$category_id])) {
//Kiểm tra sự tồn tai của danh mục
$item_category = CGlobal::$allCategories[$category_id];
if (isset(CGlobal::$subCategories[$category_id]) && CGlobal::$subCategories[$category_id] && $item_category['parent_id'] == 0 || $item_category['parent_id'] != $first_combo) {
//Nếu danh mục của sản phẩm là danh mục cấp 1 và có danh mục con => chọn lại
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
}
}
} elseif ($first_combo) {
//Nếu chọn danh mục cấp 1
$category_id = $first_combo;
$level_1_catid = $first_combo;
$level_2_catid = $first_combo;
if (isset(CGlobal::$allCategories[$category_id])) {
//Kiểm tra sự tồn tai của danh mục
$item_category = CGlobal::$allCategories[$category_id];
if (isset(CGlobal::$subCategories[$category_id]) && CGlobal::$subCategories[$category_id] && $item_category['parent_id'] == 0) {
//Nếu danh mục có danh mục con => Chọn lại!
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
} elseif ($item_category['parent_id'] != 0) {
//Nếu không fải là danh mục cấp 1
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
}
}
}
if (!$item_category) {
$this->setFormError('category_id', 'Bạn chưa chọn <b>Danh mục</b> cho sản phẩm!');
}
/*if($price<=0)
{
$this->setFormError('price','Với tin rao bán bạn phải nhập <b>Giá</b>');
}
else*/
if ($price > 0) {
if ($currency_id == 1) {
$this->checkFormInput("Giá bán", 'price', $price, 'double', false, '', 1, 50000000000);
} else {
$this->checkFormInput("Giá bán", 'price', $price, 'double', false, '', 1, 1000000);
}
}
if ($price_out != '' && $price_out != '0') {
if ($currency_id == 1) {
//.........这里部分代码省略.........
示例14: getOtionCats
function getOtionCats($mod_cat_id = 0)
{
AZLib::getCats();
foreach (CGlobal::$allCategories as $cat) {
if ($mod_cat_id) {
$arr_mod_cat_id = split(",", $mod_cat_id);
if ($cat['parent_id'] && in_array($cat['id'], $arr_mod_cat_id)) {
$subCategories[$cat['parent_id']][$cat['id']] = $cat;
} elseif (!isset($subCategories[$cat['id']]) && in_array($cat['id'], $arr_mod_cat_id)) {
$subCategories[$cat['id']] = array();
}
if (in_array($cat['id'], $arr_mod_cat_id)) {
$allCategories[$cat['id']] = $cat;
} else {
$allCategories[$cat['id']] = array();
}
} else {
if ($cat['parent_id']) {
$subCategories[$cat['parent_id']][$cat['id']] = $cat;
} elseif (!isset($subCategories[$cat['id']])) {
$subCategories[$cat['id']] = array();
}
$allCategories[$cat['id']] = $cat;
}
}
$arr = array();
if ($subCategories) {
foreach ($subCategories as $pid => $subCats) {
if (isset($allCategories[$pid])) {
$arr[$pid] = $allCategories[$pid]['name'];
}
if (isset($allCategories[$pid]) && $subCats) {
foreach ($subCats as $sid => $subCat) {
$arr[$sid] = '-----' . $subCat['name'];
}
}
}
}
return $arr;
}
示例15: on_submit
function on_submit()
{
AZLib::getCats();
$sku = AZLib::trimSpace(str_replace("\n", " ", Url::get('sku')));
###############################################################################################
$name = AZLib::trimSpace(str_replace("\n", " ", Url::get('name')));
mb_internal_encoding("UTF-8");
$name = mb_strtoupper(mb_substr($name, 0, 1)) . mb_substr($name, 1);
###############################################################################################
###############################################################################################
$offer = AZLib::trimSpace(str_replace("\n", " ", Url::get('offer')));
mb_internal_encoding("UTF-8");
$offer = mb_strtoupper(mb_substr($offer, 0, 1)) . mb_substr($offer, 1);
###############################################################################################
###############################################################################################
$list_brief = AZLib::trimSpace(str_replace("\n", " ", Url::get('list_brief')));
mb_internal_encoding("UTF-8");
$list_brief = mb_strtoupper(mb_substr($list_brief, 0, 1)) . mb_substr($list_brief, 1);
###############################################################################################
###############################################################################################
//$item_description = AZLib::getParam('item_description');
$item_description = Url::get('item_description');
$brief = Url::get('brief');
if (get_magic_quotes_gpc()) {
$item_description = stripslashes($item_description);
$brief = stripslashes($brief);
}
require_once ROOT_PATH . 'includes/htmLawed.php';
$config = array('safe' => 1, 'elements' => '*', 'deny_attribute' => 'class, id');
$spec = 'a = title, href;';
// The 'a' element can have only these attributes
$item_description = htmLawed($item_description, $config, $spec);
$item_description = AZLib::clean_value($item_description);
$brief = htmLawed($brief, $config, $spec);
$brief = AZLib::clean_value($brief);
###############################################################################################
$category_id = 0;
$level_1_catid = 0;
$first_combo = (int) Url::get('first_combo');
$second_combo = (int) Url::get('second_combo');
$price = Url::cdouble(Url::get('price', 0));
$price_out = Url::cdouble(Url::get('price_out', 0));
$currency_id = (int) Url::get('currency_id', 1);
$quantity = Url::cdouble(Url::get('quantity', 0));
if ($quantity < 0) {
$quantity = 0;
}
$item_order = (int) Url::get('item_order');
$made_in = Url::get('made_in');
$warranty = Url::get('warranty');
if (!isset(CGlobal::$currency[$currency_id])) {
$currency_id = 1;
}
$item_category = false;
if ($first_combo && $second_combo) {
//Nếu chọn danh mục cấp 2
$category_id = $second_combo;
$level_1_catid = $first_combo;
$level_2_catid = $second_combo;
if (isset(CGlobal::$allCategories[$category_id])) {
//Kiểm tra sự tồn tai của danh mục
$item_category = CGlobal::$allCategories[$category_id];
//Nếu danh mục của sản phẩm là danh mục cấp 1 và có danh mục con => chọn lại
if (isset(CGlobal::$subCategories[$category_id]) && CGlobal::$subCategories[$category_id] && $item_category['parent_id'] == 0 || $item_category['parent_id'] != $first_combo) {
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
}
}
} elseif ($first_combo) {
//Nếu chọn danh mục cấp 1
$category_id = $first_combo;
$level_1_catid = $first_combo;
$level_2_catid = $first_combo;
if (isset(CGlobal::$allCategories[$category_id])) {
//Kiểm tra sự tồn tai của danh mục
$item_category = CGlobal::$allCategories[$category_id];
if (isset(CGlobal::$subCategories[$category_id]) && CGlobal::$subCategories[$category_id] && $item_category['parent_id'] == 0) {
//Nếu danh mục có danh mục con => Chọn lại!
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
} elseif ($item_category['parent_id'] != 0) {
//Nếu không fải là danh mục cấp 1
$this->setFormError('category_id', 'Hãy chọn lại <b>Chủng loại</b> cho sản phẩm!');
}
}
}
if (!$item_category) {
$this->setFormError('category_id', 'Bạn chưa chọn <b>Danh mục</b> cho sản phẩm!');
}
$this->checkFormInput('Tên sản phẩm', 'name', $name, 'str', true, '', 5, 255);
$this->checkFormInput('Mô tả vắn tắt', 'brief', $brief, 'str', false, '', 15, 500000);
$this->checkFormInput('Mô tả sản phẩm', 'item_description', $item_description, 'str', true, '', 15, 500000);
//Check kiểm duyệt
$status = 1;
//Cho hiển thị
$have_image_up = false;
$form_img_server = Url::get('avatar_img_server', 0);
$this->img_url = Url::get('avatar_img_url', '');
foreach ($this->item_images as $page => $page_images) {
//trang
foreach ($page_images as $image) {
if ($image['img_new_id']) {
//.........这里部分代码省略.........