Example #1
0
 function on_submit()
 {
     $ids = isset($_POST['chk_id']) ? $_POST['chk_id'] : array();
     if (count($ids) > 0) {
         for ($i = 0; $i < count($ids); $i++) {
             Item::delete_item($ids[$i]);
         }
         Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'id', 'lock_die_all', 'hd_ac')));
     }
 }
Example #2
0
 function delete_multi($item_array)
 {
     if ($item_array && is_array($item_array)) {
         $censor = Url::get('censor', 2);
         foreach ($item_array as $key => $item_id) {
             if ($item_id) {
                 if ($censor == -1 && User::have_permit(ADMIN_DEL_ITEM)) {
                     Item::delete_item_physical($item_id);
                 } else {
                     Item::delete_item($item_id);
                 }
             }
         }
     }
     Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
 }
Example #3
0
    function fn_del_item()
    {
        $id = (int) Url::get('id', 0);
        if (!User::is_login()) {
            echo "not_login";
            exit;
        }
        if ($id > 0) {
            $item = Item::get_item($id);
            $item_memcache = $item;
            if (!User::have_permit(ADMIN_ITEM) && !User::have_cat_permit($item['category_id'])) {
                if ($item['user_id'] != User::id() || User::is_block()) {
                    echo "not_perm";
                    exit;
                }
            }
            $reason_del = EClassApi::getParam("reason_del");
            Item::delete_item($id);
            DB::query("UPDATE account SET total_transaction = total_transaction-1 WHERE id=" . $item["user_id"]);
            if ((User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id'])) && $reason_del) {
                //$receiver_user = DB::select('account', 'id = ' . $item["user_id"]);
                $title_pm = 'Thông báo xóa tin từ EClass';
                /*hoặc [url=http://blog.chonmon.vn/2008/09/22/huong-dan-cac-chuc-nang-cua-enbac.html]hướng dẫn[/url]*/
                /*  $content_pm = 'Tin đăng \"' . $item['name'] . '\" của bạn đã bị xóa với lý do: ' . $reason_del . '
                
                				Đề nghị bạn tham khảo [url=http://blog.chonmon.vn/2008/10/14/quy-che-dang-tin-tren-enbaccom.html]Quy định đăng tin[/url]  trên blog.chonmon.vn
                				
                				Ban quản trị Én bạc.
                				
                				Vui lòng không trả lời tin nhắn này!';*/
                $content_pm = 'Tin đăng "' . $item['name'] . '" của bạn đã bị xóa với lý do: ' . $reason_del . '

				Đề nghị bạn tham khảo <a href="http://blog.chonmon.vn/2008/10/14/quy-che-dang-tin-tren-enbaccom.html">Quy định đăng tin</a>  trên blog.chonmon.vn
				<br/>
				Ban quản trị Én bạc.
				<br/>
				Vui lòng không trả lời tin nhắn này!';
                if (User::$current->data['signature']) {
                    $content_pm .= '<br /><hr /><br />Mọi thắc mắc vui lòng liên hệ theo số ĐT: 04.39743410 - Số máy lẻ: ' . User::$current->data['signature'];
                }
                $receiver_user = User::getUser($item["user_id"]);
                $receiver_user = $receiver_user['id'];
                EClassApi::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, true);
                //EClassApi::sendNotification($receiver_user,$title_pm,$content_pm);
                $item_array = array('item_id' => $id, 'user_id' => User::id(), 'user_name' => User::user_name(), 'lock_time' => TIME_NOW, 'type' => 1, 'reason_lock' => $reason_del);
                DB::insert('item_lock', $item_array);
            }
            echo "success";
            exit;
        } else {
            echo "unsuccess";
            exit;
        }
    }
Example #4
0
 function UserAdmin($row)
 {
     define('BAN_NICK_DATE', 7);
     CGlobal::$website_title = 'Quản lý thành viên';
     Module::Module($row);
     if (User::have_permit(ADMIN_USER)) {
         switch (Url::get('cmd')) {
             case 'lockdie':
                 //Khoá vĩnh viễn
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     $user = User::getUser($id);
                     if ($user) {
                         DB::update('user', array('block_time' => -1), 'id=' . $id);
                         DB::insert('user_lock', array('time' => TIME_NOW, 'user_id' => $id, 'user_name' => $user['user_name'], 'type' => 3, 'admin_id' => User::id(), 'admin_name' => User::user_name()));
                         User::getUser($id, 0, 1);
                     }
                 }
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac')));
                 break;
             case 'delete':
                 Item::delete_item(Url::get('id'));
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac'), "cmd=item_list"));
                 break;
             case 'del_cache':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     User::getUser($id, 0, 1);
                 }
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac')));
                 break;
             case 'del_avatar':
                 $user = DB::select('user', (int) Url::get('id'));
                 if ($user) {
                     if ($user['avatar_url']) {
                         AZLib::ftp_image_delete_file($user['avatar_url'], $user['img_server']);
                         DB::update('user', array('avatar_url' => '', 'img_server' => 0), 'id=' . $user['id']);
                         User::getUser($user['id'], 0, 1);
                     }
                 }
                 Url::redirect_url(Url::build_all(array('chk_id', 'del_all', 'cmd', 'id', 'lock_die_all', 'hd_ac')));
                 break;
             case 'item_list':
                 require_once 'forms/item_list.php';
                 $this->add_form(new ItemListForm());
                 break;
             case 'user_log':
                 require_once 'forms/user_log.php';
                 $this->add_form(new UserLogForm());
                 break;
             case 'detail':
                 require_once 'forms/UserDetail.php';
                 $this->add_form(new UserDetailForm());
                 break;
             case 'add':
                 require_once 'forms/UserAdd.php';
                 $this->add_form(new UserAddForm());
                 break;
             case 'edit':
                 require_once 'forms/UserEdit.php';
                 $this->add_form(new UserEditForm());
                 break;
             default:
                 require_once 'forms/UserAdmin.php';
                 $this->add_form(new ListUserAdminForm());
                 break;
         }
     } else {
         Url::access_denied();
     }
 }
Example #5
0
 function ManageItem($row)
 {
     if (User::have_permit(array(ADMIN_ITEM, ADMIN_DEL_ITEM))) {
         Module::Module($row);
         $cmd = Url::get('cmd');
         switch ($cmd) {
             case 'delete':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     $item = Item::get_item($id);
                     Item::delete_item($id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'del_cache':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     Item::get_item($id, 1);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'del_forever':
                 if (User::have_permit(ADMIN_DEL_ITEM)) {
                     $id = (int) Url::get('id', 0);
                     if ($id) {
                         Item::delete_item_physical($id);
                     }
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'show':
             case 're_post':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     if (MEMCACHE_ON) {
                         $item_memcache = Item::get_item($id);
                         $item_memcache['status'] = 1;
                         $item_memcache['modify_user_name'] = User::user_name();
                         $item_memcache['modify_time'] = TIME_NOW;
                         AZMemcache::do_put("item:{$id}", $item_memcache);
                     }
                     DB::update('item', array('status' => 1, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             case 'hide':
                 $id = (int) Url::get('id', 0);
                 if ($id) {
                     if (MEMCACHE_ON) {
                         $item_memcache = Item::get_item($id);
                         $item_memcache['status'] = 2;
                         $item_memcache['modify_user_name'] = User::user_name();
                         $item_memcache['modify_time'] = TIME_NOW;
                         AZMemcache::do_put("item:{$id}", $item_memcache);
                     }
                     DB::update('item', array('status' => 2, 'modify_user_name' => User::user_name(), 'modify_time' => TIME_NOW), 'id=' . $id);
                 }
                 Url::redirect_url(Url::build_all(array('selected_ids', 'cmd', 'id', 'product_item')));
                 break;
             default:
                 require_once 'forms/ManageItem.php';
                 $this->add_form(new ManageItemForm());
                 break;
         }
     } else {
         Url::redirect('sign_in');
     }
 }
Example #6
0
 protected function api()
 {
     header('Content-Type: application/json');
     try {
         if (empty($_REQUEST['method'])) {
             throw new Exception('No method specified');
         }
         switch ($_REQUEST['method']) {
             case 'add-row':
                 $this->add_row();
                 break;
             case 'delete-row':
                 $this->delete_row();
                 break;
             case 'delete-item':
                 if (empty($_REQUEST['item'])) {
                     throw new Exception('No item specified');
                 }
                 $item = new Item($_REQUEST['item']);
                 $item->delete_item();
                 die(json_encode(array('msg' => 'Deleted item', 'code' => 0)));
                 return;
             default:
                 throw new Exception('Invalid method specified');
         }
     } catch (Exception $e) {
         header('HTTP/1.0 500 Internal Server Error');
         $error = array('msg' => $e->getMessage(), 'code' => $e->getCode(), 'error' => true);
         echo json_encode($error);
         die;
     }
 }
Example #7
0
 function fn_item_del_admin()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     $item_id = (int) Url::get('item_id');
     if ($item_id) {
         $item = Item::get_item($item_id);
     } else {
         $item = array();
     }
     if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
         Item::delete_item($item_id);
         echo "success";
         exit;
     } else {
         echo "no_perm";
         exit;
     }
 }
Example #8
0
 function fn_del_item_reason()
 {
     if (!User::is_login()) {
         echo "not_login";
         exit;
     }
     if (!User::have_permit(ADMIN_ITEM) && !User::is_mod()) {
         echo "no_perm";
         exit;
     }
     $id = (int) Url::get('id', 0);
     if ($id) {
         $item = Item::get_item($id);
         $item_memcache = $item;
     } else {
         $item = array();
     }
     if ($item && (User::have_permit(ADMIN_ITEM) || User::have_cat_permit($item['category_id']))) {
         Item::delete_item($id);
         AZLib::del_reason_mod($id);
         echo $id;
         exit;
     } else {
         echo "no_perm";
         exit;
     }
     echo "unsuccess";
     exit;
 }