Example #1
0
 function PostItem($row)
 {
     Module::Module($row);
     if (User::is_login()) {
         if (!User::have_permit(ADMIN_ITEM) || User::is_block()) {
             Url::access_denied();
         } else {
             if (Url::get('cmd') == 'edit') {
                 if (Url::get('id')) {
                     require_once 'forms/EditItemForm.php';
                     $this->add_form(new EditItemForm());
                     return;
                 }
             }
             if (Url::get('cmd') != '') {
                 Url::redirect_current();
             }
             require_once 'forms/PostItemForm.php';
             $this->add_form(new PostItemForm());
         }
     } else {
         AZLib::check_uri();
         Url::redirect_url('?page=sign_in&href=' . base64_encode(CGlobal::$query_string));
     }
 }
Example #2
0
 function draw()
 {
     global $display;
     if (User::id() != 0) {
         if (User::$current->data["avatar_url"] != "") {
             $avatar = '<img src="' . AZLib::getImageThumb(User::$current->data["avatar_url"], 100, 100, 0, User::$current->data["img_server"]) . '" />';
         } else {
             $avatar = '<img src="style/images/no_avatar_item.gif" width="94" height="94"/>';
         }
         $display->add('avatar', $avatar);
         $display->add('user_name', User::$current->data["user_name"]);
         $display->add('get_cmd', Url::get('cmd'));
         $display->add('get_action', Url::get('action'));
         $display->add('get_page', Url::get('page'));
         $display->add('get_page', AZNet::$page['name']);
         $display->add('get_cmd', Url::get('cmd'));
         $display->add('user_name', User::user_name());
         $display->add('can_edit_blast', User::is_admin() || !User::is_block());
         $blast = User::$current->data['blast'];
         $avatar_link = '';
         $avatar_url = 'style/images/no_avatar_item.gif';
         if (User::$current->data['avatar_url'] != '') {
             $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url'];
             $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']);
         }
         if ($blast == '') {
             $blast = '...';
         } else {
             $blast = ' ' . $blast;
             if (strpos($blast, 'http://')) {
                 $user_blast = $blast;
                 while (strpos($user_blast, 'http://')) {
                     $tmp = substr($user_blast, strpos($user_blast, 'http://'));
                     if (strpos($tmp, ' ') || strpos($tmp, '<')) {
                         if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) {
                             $blast_url = substr($tmp, 0, strpos($tmp, '<'));
                         } else {
                             $blast_url = substr($tmp, 0, strpos($tmp, ' '));
                         }
                     } else {
                         $blast_url = $tmp;
                     }
                     $user_blast = str_replace($blast_url, '', $user_blast);
                 }
                 $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>';
                 $blast = substr($user_blast . $new_blast_url, 1);
             }
         }
         $display->add('avatar_link', $avatar_link);
         $display->add('avatar_url', $avatar_url);
         $display->add('blast', $blast);
         $display->add('user_id', User::id());
         $TopMenu = $display->output('TopMenu', true, 'Personal');
         $display->add('TopMenu', $TopMenu);
         $display->output('change_pass', false, 'Personal');
     } else {
         Url::redirect('home');
     }
 }
Example #3
0
    function draw()
    {
        global $display;
        $display->add('get_cmd', Url::get('cmd'));
        $display->add('get_action', Url::get('action'));
        $display->add('get_page', Url::get('page'));
        echo '<script language="javascript">
	    		var url_root = "' . WEB_ROOT . '"
	    	  </script>';
        $display->add('get_page', AZNet::$page['name']);
        $display->add('get_cmd', Url::get('cmd'));
        $display->add('user_name', User::user_name());
        $display->add('can_edit_blast', User::is_admin() || !User::is_block());
        $blast = User::$current->data['blast'];
        $avatar_link = '';
        $avatar_url = 'style/images/no_avatar_item.gif';
        if (User::$current->data['avatar_url'] != '') {
            $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url'];
            $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']);
        }
        if ($blast == '') {
            $blast = '...';
        } else {
            $blast = ' ' . $blast;
            if (strpos($blast, 'http://')) {
                $user_blast = $blast;
                while (strpos($user_blast, 'http://')) {
                    $tmp = substr($user_blast, strpos($user_blast, 'http://'));
                    if (strpos($tmp, ' ') || strpos($tmp, '<')) {
                        if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) {
                            $blast_url = substr($tmp, 0, strpos($tmp, '<'));
                        } else {
                            $blast_url = substr($tmp, 0, strpos($tmp, ' '));
                        }
                    } else {
                        $blast_url = $tmp;
                    }
                    $user_blast = str_replace($blast_url, '', $user_blast);
                }
                $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>';
                $blast = substr($user_blast . $new_blast_url, 1);
            }
        }
        $display->add('avatar_link', $avatar_link);
        $display->add('avatar_url', $avatar_url);
        $display->add('blast', $blast);
        $display->add('user_id', User::id());
        $TopMenu = $display->output('TopMenu', true, 'Personal');
        $display->add('TopMenu', $TopMenu);
        $display->output('success', false, 'Personal');
    }
Example #4
0
 function on_submit()
 {
     if (!User::is_block()) {
         $email = trim(strip_tags(Url::get('email')));
         $user_name = trim(strip_tags(Url::get('user_name')));
         $full_name = trim(strip_tags(Url::get('name')));
         $this->checkFormInput('Email', 'email', $email, 'email', true, '', 6, 50);
         if (DB::exists('SELECT id FROM `account` WHERE `email`="' . $email . '" AND id != ' . User::$current->data['id'])) {
             $this->setFormError('email', "<b>Email</b> bạn chọn đã tồn tại, hãy chọn lại một <b>Email</b> khác!");
         }
         if (!$this->errNum) {
             $new_row = array('full_name' => trim($full_name), 'user_name' => $user_name, 'email' => $email);
             PersonalDB::update_account_information($new_row);
             User::getUser(User::id(), true);
             $this->setFormSucces('', "Thông tin của bạn đã được cập nhật!");
         }
     } else {
         $this->setFormError('', "Tài khoản của bạn hiện đang bị khóa, bạn không thể thực hiện chức năng này!");
     }
 }
Example #5
0
 function fn_del_comment_user()
 {
     $id = (int) Url::get('id');
     if (!$id || User::is_block() || !User::have_permit(ADMIN_ITEM)) {
         echo "not_perm";
         exit;
     }
     $sql = "SELECT sender_user_id,receiver_user_id,status FROM comment_user WHERE id={$id}";
     $comment = DB::fetch($sql);
     if ($comment && DB::delete('comment_user', "id={$id}")) {
         //Xoá feed
         DB::query("DELETE FROM feed WHERE ref_id = {$id} AND type=3");
         if ($comment['status'] == 0) {
             DB::query('UPDATE account set total_comment_user = total_comment_user-1 WHERE id=' . $comment['receiver_user_id'] . ' AND total_comment_user>0');
             // so luu but
             User::getUser($comment['receiver_user_id'], 0, 1);
         }
         echo EClassApi::getParam('id');
         exit;
     } else {
         echo "unsuccess";
         exit;
     }
 }
Example #6
0
 function payment_bill()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (User::is_block()) {
         echo "no_perm";
         exit;
     }
     $bill_id = Url::get("bill_id");
     $full_name = Url::get('full_name');
     $mobile = Url::get('mobile');
     $user = User::$current->data;
     if ($bill_id) {
         if (!$full_name || !$mobile) {
             echo "error_info";
             exit;
         }
         $arr = explode(",", $bill_id);
         $id_arr = array();
         foreach ($arr as $payid) {
             $id_arr[$payid] = $payid;
         }
         $p_premium = array();
         #################################################################################
         #Lấy ra bản các bản ghi và kiểm tra
         $re = DB::query("SELECT * FROM payment_premium WHERE id IN({$bill_id})");
         $price = 0;
         if ($re) {
             while ($row = mysql_fetch_assoc($re)) {
                 if ($row['user_id'] == User::id() && $row['status'] == 0) {
                     if (isset($id_arr[$row['id']])) {
                         unset($id_arr[$row['id']]);
                     }
                     $price += $row['price'];
                     $p_premium[$row['id']] = $row;
                 }
             }
         }
         if ($id_arr || $price == 0) {
             echo 'error_service';
             exit;
         }
         //$order_code         = "{$service_code}_{$user['user_name']}_".TIME_NOW;
         $return_url = WEB_ROOT . "personal.html?cmd=bill_payment&bill_id={$bill_id}";
         $transaction_info = "Thanh toán hóa đơn trả sau cho các GD trả sau có mã {$bill_id}, trị giá " . number_format($price, 0, '', '.') . " VNĐ) cho {$full_name} ({$user['user_name']}), số ĐT liên hệ: {$mobile}";
         $payment_ebp = array("item_id" => 0, "log_id" => $bill_id, "user_id" => User::id(), "user_name" => User::user_name(), "service_type" => 2, "service_code" => "Bill", "payment_info" => $transaction_info, "order_code" => '', "price" => $price, "time" => TIME_NOW, "payment_time" => 0, "error_text" => '', "payment_status" => 0, "sent_mail" => 0, "mobile" => $this->check_mobile($mobile));
         $payid = DB::insert("payment_ebp", $payment_ebp);
         if ($payid) {
             $order_code = "Bill_{$payid}";
             if (DB::update("payment_ebp", array("order_code" => $order_code), "id={$payid}")) {
                 //Tạo link thanh toán đến Soha Payment
                 $url = SohaPay::buildCheckoutUrl($return_url, $transaction_info, $order_code, $price, $user['email'], EBP_MERCHANT_SITE_CODE, EBP_SECURE_CODE);
                 echo $url;
                 exit;
             }
         }
     }
     echo "error_service";
     exit;
 }
Example #7
0
 function delete_exten()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (User::is_block()) {
         echo "no_permission";
         exit;
     }
     $id = (int) Url::get('id', 0);
     $aryOrderService = array();
     if ($id) {
         $aryOrderService = DB::select("order_services", "id = {$id} AND active = -3 AND reg_exten_stt = 1");
         if ($aryOrderService['user_use'] != User::user_name()) {
             echo "error";
             exit;
         } else {
             DB::update('order_services', array("active" => -2), "id={$id}");
             DB::update('order_services', array("del_status" => -1), "id={$id}");
         }
     }
 }
 function view_more_o_trans()
 {
     $page_no = (int) Url::get('page_no', 0);
     $cur_group = (int) Url::get('cur_total_group', 0);
     $action = Url::get('get_act');
     if (!User::is_login()) {
         $json = '({"msg":"no_login"})';
         echo $json;
         exit;
     }
     if (User::is_block()) {
         $json = '({"msg":"no_perm"})';
         echo $json;
         exit;
     }
     if ($page_no > 0) {
         $json = '({"msg":"success"';
         require_once DIR_MODULE . "Personal/forms/Office.php";
         $OfficeForm = new OfficeForm("OfficeForm");
         $transact_office = $OfficeForm->draw();
         $json .= ',"content":"' . addslashes(str_replace(array(chr(13), chr(10)), ' ', $transact_office)) . '"';
         $json .= ',"total_group":"' . $OfficeForm->total_group . '","show_more":"' . $OfficeForm->show_more . '"';
         $json .= '})';
         echo $json;
         System::halt();
     }
     $json = '({"msg":"no_perm"})';
     echo $json;
     exit;
 }
Example #9
0
 function modifyStatus()
 {
     // khi user ha quang cao
     $json = array();
     if (!User::is_login() || User::is_block()) {
         $json['error'] = 'not_perm';
     } else {
         $ad_id = (int) Url::get('ad_id', 0);
         $status = (int) Url::get('status', 0);
         //-1: xoa , 0:nguoi dung dung, 1:doi kiem duyet, 3: quang cao can phai sua, 4: admin ha
         $item = $ad_id > 0 ? DB::select('ad_item', " id = " . $ad_id) : '';
         if ($item) {
             if ($item['end_time'] < TIME_NOW && $status != -1) {
                 $json['error'] = 'expired';
             } else {
                 if ($item['user_id'] == User::id() || User::have_permit(ADMIN_AD_ITEM)) {
                     $value = array('user_edit' => User::id(), 'name_edit' => User::user_name(), 'changed' => TIME_NOW);
                     if ($item['status'] == 2) {
                         include_once ROOT_PATH . 'includes/nusoap/nusoap.php';
                         require_once ROOT_PATH . 'includes/nusoap/tokenpartner.php';
                         require_once ROOT_PATH . 'core/CpcLib.php';
                         $CpcLip = new CpcLib();
                         $return = $CpcLip->sendToSoap($item);
                         if (!$return) {
                             $json['error'] = 'error';
                             echo json_encode($json);
                             exit;
                         }
                     } else {
                         $value['status'] = $status;
                     }
                     DB::update('ad_item', $value, ' id = ' . $item['id']);
                     if ($item['payType'] == 3 && $item['isPay'] == 0) {
                         // Cập nhật số lượng tiền trả sau đã dùng
                         $money_used = $item['click'] * $item['per_price'] / 1000;
                         // Trừ money_used của thành viên, tăng khả năng trả sau của khách hàng
                         DB::query("UPDATE user SET money_used = money_used - (" . $money_used . ") WHERE id=" . $item['user_id']);
                         // Cập nhật số tiền có thể trả sau vào cache thành viên
                         User::getUser($item['user_id'], 0, 1);
                         // Soft delete bản ghi log trong bảng payment_premium
                         DB::query("UPDATE payment_premium SET status = 2,user_m='" . User::user_name() . "',time_m=" . TIME_NOW . " WHERE log_id={$ad_id} AND type=4");
                     }
                     $json['error'] = 'success';
                 } else {
                     $json['error'] = 'not_perm';
                 }
             }
         } else {
             $json['error'] = 'not_ad';
         }
     }
     echo json_encode($json);
     exit;
 }
Example #10
0
 function draw()
 {
     global $display;
     if (isset($_POST['update'])) {
         $this->on_submit();
     }
     $user = PersonalDB::get_user_information();
     foreach ($user as $key => $value) {
         if (is_string($value) and !isset($_REQUEST[$key])) {
             $_REQUEST[$key] = $value;
         }
     }
     if ($user['show_home_phone'] == 0) {
         $user['show_home_phone_checked'] = '';
     } else {
         $user['show_home_phone_checked'] = 'checked';
     }
     if ($user['show_email'] == 0) {
         $user['checked'] = '';
     } else {
         $user['checked'] = 'checked';
     }
     if ($user['email_alert'] == 0) {
         $user['alert_email_checked'] = '';
     } else {
         $user['alert_email_checked'] = 'checked';
     }
     if ($user['birth_day']) {
         $arrBirtday = explode('-', $user['birth_day']);
         $user['birth_day'] = $arrBirtday['2'] . '-' . $arrBirtday['1'] . '-' . $arrBirtday['0'];
     }
     if ($user['avatar_url'] != "") {
         $user['avatar_url'] = '<img src="' . AZLib::getImageThumb($user['avatar_url'], 100, 100, 0, $user['img_server']) . '" />';
     } else {
         $user['avatar_url'] = '<img src="style/images/no_avatar_item.gif" width="94" height="94" />';
     }
     $display->add('msg', $this->showFormErrorMessages(1));
     $display->add('user', $user);
     $openids = array();
     $re = DB::query("SELECT id, openid_url FROM openid WHERE user_id=" . $user['id']);
     if ($re) {
         while ($openid = mysql_fetch_assoc($re)) {
             $openid['openid'] = AZLib::strippedLink($openid['openid_url'], 48) . ' <img src="style/images/delete.gif" title="Xoá bỏ OpenID Url này khỏi tài khoản của bạn!" onclick="return del_openid(' . $openid['id'] . ');" />';
             $openids[$openid['id']] = $openid;
         }
     }
     $display->add('openids', $openids);
     $display->add('can_edit_blast', User::is_admin() || !User::is_block());
     $blast = User::$current->data['blast'];
     $avatar_link = '';
     $avatar_url = 'style/images/no_avatar_item.gif';
     if (User::$current->data['avatar_url'] != '') {
         $avatar_link = "http://" . CGlobal::$img_server[User::$current->data['img_server']] . User::$current->data['avatar_url'];
         $avatar_url = AZLib::getImageThumb(User::$current->data['avatar_url'], 80, 80, 0, User::$current->data['img_server']);
     }
     if ($blast == '') {
         $blast = '...';
     } else {
         $blast = ' ' . $blast;
         if (strpos($blast, 'http://')) {
             $user_blast = $blast;
             while (strpos($user_blast, 'http://')) {
                 $tmp = substr($user_blast, strpos($user_blast, 'http://'));
                 if (strpos($tmp, ' ') || strpos($tmp, '<')) {
                     if (strpos($tmp, ' ') && strpos($tmp, '<') && strpos($tmp, ' ') > strpos($tmp, '<')) {
                         $blast_url = substr($tmp, 0, strpos($tmp, '<'));
                     } else {
                         $blast_url = substr($tmp, 0, strpos($tmp, ' '));
                     }
                 } else {
                     $blast_url = $tmp;
                 }
                 $user_blast = str_replace($blast_url, '', $user_blast);
             }
             $new_blast_url = ' <a rel="nofollow" href="' . $blast_url . '" target="_blank">Click here</a>';
             $blast = substr($user_blast . $new_blast_url, 1);
         }
     }
     $display->add('avatar_link', $avatar_link);
     $display->add('avatar_url', $avatar_url);
     $display->add('blast', $blast);
     $display->add('get_cmd', Url::get('cmd'));
     $display->add('get_action', Url::get('action'));
     $display->add('get_page', Url::get('page'));
     $display->add('url', Url::build_all());
     $display->add('user_name', User::user_name());
     $display->add('user_id', User::id());
     $TopMenu = $display->output('TopMenu', true, 'Personal');
     $display->add('TopMenu', $TopMenu);
     $display->output('edit_user', false, 'Personal');
 }
Example #11
0
          appId      : '895242387208591',
          xfbml      : true,
          version    : 'v2.4'
        });
      };

      (function(d, s, id){
         var js, fjs = d.getElementsByTagName(s)[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement(s); js.id = id;
         js.src = "//connect.facebook.net/en_US/sdk.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>

    <script language="javascript">
        var query_string = "?<?=urlencode($_SERVER['QUERY_STRING']);?>", BASE_URL = "<?=WEB_ROOT?>", TINYMCE = "<?=TINYMCE?>", WEB_DIR = "<?=WEB_DIR?>";
        <?php
            echo 'var IS_ROOT = '.(int)User::is_root().', IS_ADMIN = '.(int)User::is_admin().', IS_MOD='.(int)User::is_mod().', IS_LOGIN = '******',EB_USER_NAME = "'.(User::is_login()?User::user_name():'').'", IS_BLOCK='.(User::is_block()?1:0).', CUR_AREA = '. CGlobal::$curArea .';';
        ?>
    </script>
    
    <?=EClass::$extraHeader;?>
</head>

<body>
<div id='loading-layer' style="display:none">
    <div id='loading-layer-text' style="vertical-align:middle; padding-left: 10px">
        Đang tải dữ liệu&nbsp;&nbsp;<img src="<?= STATIC_URL ?>images/ajax-loader.gif?v=0.1121989" style="vertical-align:text-bottom" width="16" height="16" hspace="5" class="displayIn"/>
    </div>
</div>
Example #12
0
 function admin_links(&$item_detail)
 {
     //Menu admin
     global $display;
     $edit_link = '';
     $del_link = '';
     $del_link_item = '';
     if (!User::is_block() && User::have_permit(ADMIN_ITEM)) {
         $edit_link = WEB_DIR . AZRewrite::formatUrl('?page=post_item&cmd=edit&id=' . $item_detail['id']);
         if (Item::$item['status'] != -1) {
             $del_link = 1;
         }
         $display->add("have_permit", 1);
         $del_link_item = ' [ <a class="delete" href="javascript:void(0)" title="Xóa sản phẩm này!" onclick="del_item(' . $item_detail['id'] . ');return false;">Xóa</a> ] ';
         if ($item_detail['status'] == -1) {
             $this->setFormError('', '<center><font color=red>Sản phẩm đã bị xoá (bởi <b>' . $item_detail['del_user'] . '</b> lúc <b>' . date('d/m/Y H:i', $item_detail['del_time']) . '</b>)</font></center>');
         } elseif ($item_detail['status'] == 2) {
             //Sản phẩm bị ẩn
             $this->setFormError('', '<center><font color=red>Sản phẩm đang bị ẩn (bởi <b>' . $item_detail['modify_user_name'] . '</b> lúc <b>' . date('d/m/Y H:i', $item_detail['modify__time']) . '</b>)</font></center>');
         }
     }
     $display->add("edit_link", $edit_link);
     $display->add("del_link", $del_link);
     $display->add("del_link_item", $del_link_item);
 }
Example #13
0
 function up_item()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     } elseif (!User::is_admin() && User::is_block()) {
         //Nếu ko fải admin mà bị khóa hoặc chưa là THÀNH VIÊN CHÍNH THỨC
         echo "no_perm";
         exit;
     }
     $item_id = (int) Url::get('item_id');
     $up_tk = (int) Url::get('up');
     //0:up free; 1: up tài khoản
     if ($item_id) {
         $item = Item::get_item($item_id);
         $item_memcache = $item;
         $item_update = array();
         $have_permit = false;
         $up_log_sql = '';
         if (!$item) {
             echo "no_perm";
             exit;
         }
         if ($item["state"] == 1 || $item["status"] != 1) {
             //Nêu bị khóa hoặc tin bị xóa hoặc kiểm duyệt...
             echo "lock_topic";
             exit;
         }
         $user = DB::fetch('SELECT id, user_name, up_item, block_time, invalid_time FROM user WHERE id=' . $item['user_id']);
         if ($user['block_time'] > TIME_NOW || $user['block_time'] == -1) {
             echo "no_perm";
             exit;
         }
         $up_free = 0;
         $is_up_free = false;
         $up_type = 0;
         //Kiểu up: 0: up free; 1: up tay; 2: up lịch; 3: up lẻ
         $up_zone_id = 0;
         //Zone ID
         $up_top_cat = $item['level_1_catid'];
         //TopCatID
         $up_cat_id = $item['category_id'];
         //CatID
         $mid_noon = mktime(12, 0, 0, date('m', TIME_NOW), date('d', TIME_NOW), date('Y', TIME_NOW));
         //thời điểm giữa trưa cùng ngày
         //Là up free && hết lượt up tài khoản && ko fải là admin
         if (!$up_tk && User::level() && !User::have_permit(ADMIN_ITEM) && !User::have_cat_permit($item['category_id'])) {
             if (TIME_NOW < $mid_noon) {
                 $up_free = DB::select("up_free", "user_id=" . $user['id'] . " AND catid = {$up_top_cat} AND date ='" . date("Ymd", TIME_NOW) . "S'");
                 $str_time = 'buổi sáng';
                 $type_time = 1;
                 //buổi sáng
             } else {
                 $up_free = DB::select("up_free", "user_id=" . $user['id'] . " AND catid = {$up_top_cat} AND date ='" . date("Ymd", TIME_NOW) . "C'");
                 $str_time = 'buổi chiều tối';
                 $type_time = 2;
                 //buổi chiều tối
             }
             if (date("dmY", $item["up_time"]) == date("dmY")) {
                 echo "time_out";
                 exit;
             } elseif ($up_free && (isset(CGlobal::$UP_FREE_CAT[$up_top_cat]) && (int) (CGlobal::$UP_FREE_CAT[$up_top_cat] / 2) <= (int) $up_free['up'] || !isset(CGlobal::$UP_FREE_CAT[$up_top_cat]) && (int) (UP_FREE_MAX / 2) <= (int) $up_free['up'])) {
                 echo "time_out{$type_time}";
                 exit;
             }
             //else =>> còn lượt up trong ngày
         }
         $out_put = "";
         if (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']) || $item['user_id'] == User::id()) {
             $main_cat = CGlobal::$allCategories[$up_top_cat];
             if ($main_cat && isset($main_cat['zones'])) {
                 foreach ($main_cat['zones'] as $zid) {
                     if ($zid && isset(CGlobal::$allZones[$zid])) {
                         $up_zone_id = $zid;
                         if ($main_cat['id'] != 100) {
                             break;
                         }
                     }
                 }
             }
             $out_put = "Còn lượt up tin trong ngày";
             $user_up_item = $user['up_item'];
             $up_order = "0";
             if (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id'])) {
                 $item_update['up_time'] = TIME_NOW;
                 $item_memcache['up_time'] = TIME_NOW;
                 $out_put = "up-0";
                 $up_log_sql = "INSERT INTO up_item_log \r\n\t\t\t\t\t\t\t\t\t(up_id, item_id, \t\tzone_id, \ttop_cat_id, \tcat_id, \t\titem_title, \t\tuser_id, \t\tuser_name, \t\t\t\tup_time, \t\ttype, \t\trun_order, \t\t\t\t\t\t\tup_remain, \t\tup_total, \t\t\tstatus) VALUES ";
                 $up_log_sql .= "\t(0,\t\t{$item['id']},\t{$up_zone_id},{$up_top_cat},\t{$up_cat_id},\t'{$item['name']}',\t{$user['id']},\t'{$user['user_name']}',\t" . TIME_NOW . ",\t{$up_type},\t'admin: (" . User::user_name() . ")',\t{$user_up_item},\t{$user['up_item']},\t1)";
                 DB::query($up_log_sql);
             } else {
                 $up_time = TIME_NOW;
                 $is_up = true;
                 $out_put = "up-1";
                 if (User::level() == 0) {
                     if ($user['up_item'] > 0) {
                         $up_type = 1;
                         //up tài khoản
                         //$re = DB::query("SELECT id,up_time FROM item WHERE user_id = ".$item['user_id']." AND id ORDER BY up_time DESC LIMIT 1");
                         $re = DB::query("SELECT id,up_time,category_id,level_1_catid FROM item WHERE user_id = " . $item['user_id'] . " AND level_1_catid = {$item['level_1_catid']} ORDER BY up_time DESC LIMIT 1");
                         if ($re) {
                             $old_item = mysql_fetch_assoc($re);
                             if ($old_item) {
                                 if ($old_item['up_time'] > TIME_NOW - 300 && $old_item['id'] != $item['id']) {
                                     $up_time = $old_item['up_time'] - 300;
                                 }
                             }
                         }
                         //End down time
                         $item_update['up_time'] = $up_time;
                         $item_memcache['up_time'] = $up_time;
                         //DB::query('UPDATE user SET up_item = '.(int)($user['up_item']-1).' WHERE id='.$item['user_id']);
                         DB::query('UPDATE user SET up_item = up_item-1 WHERE id=' . $item['user_id']);
                         User::getUser($item['user_id'], 0, 1);
                         $user_up_item--;
                         $up_order = "{$user_up_item}/" . $user['up_item'];
                     } else {
                         echo "no_perm_offical";
                         //echo "no_perm";
                         exit;
                     }
                 } else {
                     //Down time item nếu mới up hoặc đăng một tin nào đó chưa quá 5 phút
                     //$re = DB::query("SELECT id,up_time FROM item WHERE user_id = ".$item['user_id']." AND id ORDER BY up_time DESC LIMIT 1");
                     $re = DB::query("SELECT id,up_time,category_id,level_1_catid FROM item WHERE user_id = " . $item['user_id'] . " AND level_1_catid = {$item['level_1_catid']} ORDER BY up_time DESC LIMIT 1");
                     if ($re) {
                         $old_item = mysql_fetch_assoc($re);
                         if ($old_item) {
                             //if($old_item['up_time']>TIME_NOW-300 && $old_item['id']!=$item['id'] && ($old_item['category_id']==$item['category_id'] || $old_item['level_1_catid']==$item['level_1_catid']))
                             if ($old_item['up_time'] > TIME_NOW - 300 && $old_item['id'] != $item['id']) {
                                 $up_time = $old_item['up_time'] - 300;
                             }
                         }
                     }
                     //End down time
                     if ($up_tk) {
                         if ($user['up_item'] > 0) {
                             $up_type = 1;
                             //up tài khoản
                             $item_update['up_time'] = $up_time;
                             $item_memcache['up_time'] = $up_time;
                             //DB::query('UPDATE user SET up_item = '.(int)($user['up_item']-1).' WHERE id='.$item['user_id']);
                             DB::query('UPDATE user SET up_item = up_item-1 WHERE id=' . $item['user_id']);
                             User::getUser($item['user_id'], 0, 1);
                             $user_up_item--;
                             $up_order = "{$user_up_item}/" . $user['up_item'];
                         } else {
                             $out_put = "up_over";
                             $is_up = false;
                         }
                     } else {
                         $out_put = "Hết lượt up tin {$str_time}";
                         $is_up_free = true;
                         $item_update['up_time'] = $up_time;
                         $item_memcache['up_time'] = $up_time;
                         $up_order = "Up free";
                         if ($up_free) {
                             DB::query("UPDATE up_free SET time_up = " . TIME_NOW . ",up= up+ 1 WHERE id={$up_free['id']}");
                         } else {
                             DB::insert("up_free", array('user_id' => $user['id'], 'user_name' => $user['user_name'], 'time_f' => TIME_NOW, 'time_up' => TIME_NOW, 'catid' => $up_top_cat, 'date' => date("Ymd", TIME_NOW) . (TIME_NOW < $mid_noon ? "S" : "C"), 'up' => 1));
                         }
                     }
                 }
                 if ($is_up) {
                     $up_log_sql = "INSERT INTO up_item_log \r\n\t\t\t\t\t\t\t\t\t\t\t(up_id, \titem_id, \t\tzone_id, \t\ttop_cat_id, \tcat_id, \titem_title, \t\tuser_id, \t\tuser_name, \t\t\t\tup_time, \t\ttype, \t\trun_order, \t\t\t\tup_remain, \tup_total, \t\tstatus) VALUES ";
                     $up_log_sql .= "\t(0,\t\t\t{$item['id']},\t{$up_zone_id},\t{$up_top_cat},\t{$up_cat_id},\t'{$item['name']}',\t{$user['id']},\t'{$user['user_name']}',\t" . TIME_NOW . ",\t{$up_type},\t'{$up_order} (" . User::user_name() . ")',\t{$user_up_item},\t{$user['up_item']},\t1)";
                     DB::query($up_log_sql);
                 }
             }
         } else {
             $out_put = "no_perm";
         }
         //Up item
         if ($item_update) {
             DB::update('item', $item_update, "id={$item_id}");
             if (MEMCACHE_ON) {
                 AZMemcache::do_put("item:{$item_id}", $item_memcache);
             }
         }
         //return...
         echo $out_put;
         exit;
     }
 }
Example #14
0
 function finish_edit_item_id()
 {
     $json = array('error' => '');
     if (!User::is_login()) {
         $json['error'] = "not_login";
         echo json_encode($json);
         exit;
     }
     if (User::is_block()) {
         $json['error'] = "no_permission";
         echo json_encode($json);
         exit;
     }
     $user = User::$current->data;
     $item_id = Url::get('item_id', 0);
     $bidding_id = Url::get('bidding_id', 0);
     if ($item_id) {
         $item = Item::get_item($item_id);
     }
     if ($item) {
         //Check trạng thái tin và quyền thao tác:
         if ($item['status'] != 1) {
             if (in_array($item['status'], array(0, 2, 3, 5))) {
                 $data['error'] = 'item_invalid';
                 echo json_encode($data);
                 exit;
             } elseif ($item['status'] == -1 && !User::have_permit(ADMIN_ITEM)) {
                 //Nếu tin ở trạng thái xóa
                 $json['error'] = "item_not_exist";
                 echo json_encode($json);
                 exit;
             }
         } else {
             $bidding_info = DB::select('bidding', "id={$bidding_id}");
             if ($user['id'] != $bidding_info['user_id']) {
                 $json['error'] = "wrong_user";
                 echo json_encode($json);
                 exit;
             }
             if ($item['category_id'] != $bidding_info['cat_id']) {
                 $json['error'] = "wrong_item_id";
                 echo json_encode($json);
                 exit;
             }
         }
         if (DB::query("UPDATE bidding SET item_id = {$item_id} WHERE id={$bidding_id}")) {
             $json['error'] = "success";
             echo json_encode($json);
             exit;
         } else {
             $json['error'] = "error_update";
             echo json_encode($json);
             exit;
         }
     } else {
         $json['error'] = "item_not_exist";
         echo json_encode($json);
         exit;
     }
 }
Example #15
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 = EClassApi::getParam('item_id');
         $id = "item:{$item_id}";
         eb_memcache::do_remove($id);
         echo "success";
     } else {
         die("no_permission");
     }
 }
Example #16
0
 function show_log_up_item()
 {
     $item_id = (int) Url::get('item_id', 0);
     if ($item_id > 0 && User::is_login() && !User::is_block()) {
         $log_ups = array();
         $item = Item::get_item($item_id);
         if ($item) {
             if (User::id() == $item['user_id']) {
                 global $display;
                 $re = DB::query("SELECT * FROM up_item_log WHERE item_id={$item_id} ORDER BY id DESC LIMIT 200");
                 if ($re) {
                     $stt = 1;
                     while ($log_up = mysql_fetch_assoc($re)) {
                         $log_up['stt'] = $stt++;
                         $log_up['up_time'] = date('d.m.Y H\\hi:s', $log_up['up_time']);
                         if ($log_up['up_id']) {
                             $log_up['type'] = '<font color=green><b>Up tự động</b></font>';
                         } else {
                             $log_up['type'] = 'Thành viên up';
                         }
                         $arr = explode(' ', $log_up['run_order']);
                         $log_up['run_order'] = $arr[0];
                         if ($log_up['status'] == 0) {
                             $log_up['status'] = '<font color="orange">Chưa kích hoạt</font>';
                         } elseif ($log_up['status'] == 1) {
                             $log_up['status'] = '<font color="green">Hoạt động</font>';
                         } elseif ($log_up['status'] == 2) {
                             $log_up['status'] = '<font color="brown">Hết lượt up</font>';
                         } elseif ($log_up['status'] == 3) {
                             $log_up['status'] = '<span title="Tạm ngừng do tin bị xoá hoặc kiểm duyệt"><font color="red">Tạm ngừng</font></span>';
                         }
                         $log_up['del_link'] = Url::build_current(array('cmd' => 'del_log', 'log_id' => $log_up['id']));
                         $log_up['href'] = '?page=item_detail&id=' . $log_up['item_id'];
                         $log_up['item_c_time'] = '';
                         $log_up['item_up_time'] = '';
                         $log_ups[] = $log_up;
                     }
                 }
                 if ($log_ups) {
                     $display->add('item_id', $item['id']);
                     $display->add('item_name', $item['name']);
                     $display->add('post_time', date('H\\hi d.m.Y', $item['created_time']));
                     $display->add('up_time', date('H\\hi d.m.Y', $item['up_time']));
                     $display->add('item_url', Url::build('item_detail', array('id' => $item['id'], 'ebname' => AZLib::safe_title($item['name']))));
                     $display->add('log_ups', $log_ups);
                     $display->output('UpTinLog', false, 'Personal');
                     System::halt();
                 }
             }
         }
     }
     echo 'no_log';
     exit;
 }
Example #17
0
?>
" type="text/css"/><![endif]-->
<script>var query_string = "?<?php 
echo urlencode($_SERVER['QUERY_STRING']);
?>
",BASE_URL = "<?php 
echo WEB_ROOT;
?>
",WEB_DIR = "<?php 
echo WEB_DIR;
?>
";CPC_URL="<?php 
echo CPC_URL;
?>
";<?php 
echo 'var IS_ROOT = ' . (int) User::is_root() . ', IS_ADMIN = ' . (int) User::is_admin() . ', IS_MOD=' . (int) User::is_mod() . ', IS_LOGIN = '******',EB_USER_NAME = "' . (User::is_login() ? User::user_name() : '') . '", IS_BLOCK=' . (User::is_block() ? 1 : 0) . ', OPENID_ON=' . (int) OPENID_ON . ';';
?>
</script>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
?>
javascript/jquery/jquery.js?v=1.2.6.packed"></script>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
?>
javascript/jquery/packed/jquery.jcache.js?v=<?php 
echo CGlobal::$js_ver;
?>
"></script>
<script type="text/javascript" src="<?php 
echo STATIC_URL;
Example #18
0
 function mark_label()
 {
     $user_id = (int) Url::get('user_id');
     $item_id = (int) Url::get('item_id');
     $check_ids = Url::get('check_ids');
     $uncheck_ids = Url::get('uncheck_ids');
     if (!User::is_login() || !$user_id) {
         echo "not_login";
         exit;
     }
     if (!$item_id || !$user_id || !User::is_admin() && (User::is_block() || User::id() != $user_id)) {
         echo "not_permit";
         exit;
     }
     $user = User::getUser($user_id);
     $item = Item::get_item($item_id);
     if (!$user || !$item || $item && $item['user_id'] != $user_id) {
         echo "not_permit";
         exit;
     }
     if ($uncheck_ids != '') {
         DB::delete("label_item", "user_id={$user_id} AND label_id IN({$uncheck_ids}) AND item_id = {$item_id}");
     }
     if ($check_ids != '') {
         $label_id_arr = explode(',', $check_ids);
         $label_id_arr = $label_id_arr ? array_unique($label_id_arr) : $label_id_arr;
         if ($label_id_arr) {
             $insert_sql = '';
             foreach ($label_id_arr as $label_id) {
                 $insert_sql .= ($insert_sql != '' ? ',' : '') . "({$label_id},{$item_id},{$user_id},'{$user['user_name']}')";
             }
             if ($insert_sql != '') {
                 $insert_sql = "REPLACE INTO label_item (label_id, item_id, user_id, user_name) VALUES {$insert_sql}";
                 DB::query($insert_sql);
             }
         }
     }
     echo "success";
     exit;
 }