Example #1
0
    function fn_valid_all_item()
    {
        if (!User::is_login()) {
            echo "not_login";
            exit;
        }
        if (!User::have_permit(ADMIN_ITEM) && !User::is_mod_cat()) {
            echo "no_perm";
            exit;
        }
        $user_id = (int) Url::get('user_id', 0);
        $type = (int) Url::get('type', 2);
        $reason = Url::get('reason', "");
        $time_valid = TIME_NOW;
        $admin_id = User::id();
        $admin_name = User::user_name();
        if ($reason != "" && $user_id > 0 && $type) {
            if (MEMCACHE_ON) {
                $sql = "SELECT * FROM item WHERE user_id = {$user_id} AND status = 1";
                $re = DB::query($sql);
                while ($item_memcache = mysql_fetch_assoc($re)) {
                    $item_memcache['status'] = $type;
                    $item_memcache['valid_time'] = $time_valid;
                    $item_memcache['valid_user'] = $admin_name;
                    eb_memcache::do_put("item:" . $item_memcache['id'], $item_memcache);
                    if (SORL_FILTER_ON) {
                        $solr = new Solr_Search();
                        $solr->doUpdateItem($item_memcache['id']);
                    }
                }
            }
            // UPDATE table bad_content
            $str_sql = "";
            $sql = "SELECT id FROM item WHERE user_id = {$user_id} AND status = 1";
            $re = DB::query($sql);
            while ($item = mysql_fetch_assoc($re)) {
                $str_sql .= ($str_sql ? "," : "") . "({$type}, {$item['id']}, {$admin_id}, '{$admin_name}', '{$reason}', {$time_valid})";
            }
            $str_insert = "INSERT INTO bad_content(type, id_item, user_id, user_name, reason, time_post) VALUES " . $str_sql;
            DB::query($str_insert);
            // end UPDATE table bad_content
            $sql = "UPDATE item SET status = {$type}, valid_time = {$time_valid}, valid_user = '******' WHERE user_id={$user_id} AND status=1";
            $re = DB::query($sql);
            if ($re) {
                //$receiver_user = DB::select('account','id = '.$user_id);
                $receiver_user = User::getUser($user_id);
                $title_pm = 'Thông báo từ EClass';
                $content_pm = 'Tất cả các tin của bạn đã bị kiểm duyệt với lý do: ' . $reason . '
				
				[hr]Bạn click [url=http://blog.chonmon.vn/2008/10/14/quy-che-dang-tin-tren-enbaccom.html][b]vào đây[/b][/url] để xem quy định đăng tin! Hoặc [url=http://blog.chonmon.vn/?p=28][b]vào đây[/b][/url] để xem hướng dẫn đăng tin
				
				[hr]Đề nghị bạn hãy thực hiện đúng yêu cầu của chúng tôi.
				
				[hr]Xin cảm ơn bạn.
				
				[hr]Vui lòng không trả lời tin nhắn này!';
                $id_mess = EClassApi::Send_pm(User::id(), User::user_name(), $receiver_user, $title_pm, $content_pm, TRUE);
                echo "success";
                exit;
            }
        } else {
            echo "unsuccess";
            exit;
        }
    }
Example #2
0
<?php

require_once '../../core/Debug.php';
//System Debug...
require_once '../../core/config.php';
//System Config...
require_once '../../core/Init.php';
//System Init...
if ((User::have_permit(ADMIN_ITEM) || User::have_permit(ADMIN_SUPER_SERVICE) || User::is_mod_cat()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
    $user_id = (int) Url::get('user_id', 0);
    $user_name = '';
    $user = User::getUser($user_id);
    if ($user) {
        $user_name = $user['user_name'];
    }
} else {
    $user_id = (int) Url::get('cur_user_id', 0);
    $user_name = '';
    $user = User::getUser($user_id);
    if ($user) {
        $user_name = $user['user_name'];
    }
    User::$current->data = $user;
    User::$current->groups = User::get_groups($user['gids']);
    $_SESSION['user_id'] = $user_id;
    $_SESSION['user_name'] = $user_name;
}
$arrRet['error'] = 'not_uploaded';
$arrRet['id'] = 0;
$arrRet['img_server'] = -1;
$arrRet['image_url'] = '';
Example #3
0
    function get_gallery_entry() {
        if (User::is_login()) {
            global $display;
            if ((User::have_permit(ADMIN_ITEM) || User::is_mod_cat()) && (int) Url::get('user_id', 0) && (int) Url::get('user_id', 0) != User::id()) {
                $user_id = (int) Url::get('user_id', 0);
                $display->add('user_id', $user_id);
            }
            else
                $user_id=User::id();

            $search_value = ' user_id=' . $user_id . ' AND root_id=0 ';

            //search theo ngay thang nam
            //$year=(int)Url::get('year',date('Y'));
            $year = (int) Url::get('year', -1);
            //$mon= (int)Url::get('month',(int)date('m'));
            $mon = (int) Url::get('month', -1);
            $day = (int) Url::get('day', -1);

            if ($year == 0

                )$year = -1;
            if ($mon == 0

                )$mon = -1;
            if ($day == 0

                )$day = -1;

            $created_time_from = 0;
            $created_time_to = 0;

            if ($year != -1) {
                if ($mon != -1) {
                    if ($day != -1) {
                        $created_time_from = mktime(0, 0, 0, $mon, $day, $year);
                        $created_time_to = mktime(23, 59, 59, $mon, $day, $year);
                    } else {
                        $max_day = 31;
                        if (in_array($mon, array(4, 6, 9, 11))
                        
                            )$max_day = 30;
                        elseif ($mon == 2)
                            ($year % 4) ? $max_day = 28 : $max_day = 29;

                        $created_time_from = mktime(0, 0, 0, $mon, 1, $year);
                        $created_time_to = mktime(23, 59, 59, $mon, $max_day, $year);
                    }
                }
                else {
                    $created_time_from = mktime(0, 0, 0, 1, 1, $year);
                    $created_time_to = mktime(23, 59, 59, 12, 31, $year);
                }
            }

            $y_arr = array(-1 => '-Lọc theo Năm-');
            for ($i = 2008; $i <= date('Y'); $i++) {
                $y_arr[$i] = "---Năm $i-";
            }
            $m_arr = array(-1 => '-Lọc theo Tháng-');
            for ($i = 1; $i <= 12; $i++) {
                $m_arr[$i] = "---Tháng $i-";
            }
            $d_arr = array(0 => '-Lọc theo Ngày-');
            for ($i = 1; $i <= 31; $i++) {
                $d_arr[$i] = "---Ngày $i-";
            }

            $display->add('option_year', EClassApi::getOption($y_arr, $year));
            $display->add('option_month', EClassApi::getOption($m_arr, $mon));
            $display->add('option_day', EClassApi::getOption($d_arr, $day));

            if ($created_time_from) {
                $search_value .= ' AND time >= ' . $created_time_from;
            }
            if ($created_time_to) {
                $search_value .= ' AND time <= ' . $created_time_to;
            }

            $keywords = EClassApi::trimSpace(EClassApi::getParam('keywords'));
            $display->add('keywords', $keywords);

            if ($keywords) {
                $search_value .= ' AND des LIKE "%' . $keywords . '%" ';
            }

            $item_per_page = 20;

            $sql_count = 'SELECT count(*) AS total_img FROM item_image WHERE ' . $search_value;
            $total = DB::fetch($sql_count, 'total_img', 0);

            $paging = '';
            $items = array();

            $gallery_url = WEB_DIR . 'ajax.php' . Url::build_all(array('page_no'));

            if ($total) {
                $limit = '';
                $paging = AjaxGalleryPaging($limit, $total, $item_per_page, 5, $gallery_url, 'gallery_content');
                $sql = 'SELECT id, des, item_id, title, img_server, original_image_url, time FROM `item_image` WHERE ' . $search_value . ' ORDER BY id DESC ' . $limit;
                $re = DB::query($sql);

                if ($re) {
                    while ($row = mysql_fetch_assoc($re)) {
                        $row['image_url'] = $row['original_image_url'];
                        $row['original_image_url'] = EClassApi::getImageThumb($row['original_image_url'], 100, 100, 0, $row['img_server']);
                        $items[$row['id']] = $row;
                    }
                }
            }

            $display->add('items', $items);
            $display->add('total', $total);
            $display->add('paging', $paging);
            $display->output('gallery_ajax_entry', false, 'Personal');
            System::halt();
        } else {
            echo "Bạn chưa đăng nhập hoặc đã thoát khỏi hệ thống - Hãy đăng nhập lại!";
        }
    }