function change_status() { $id = intval(Url::get('id'), 0); $amount = intval(Url::get('amount'), 0); if ($amount == '' || $amount <= 0) { echo 'amount_null'; } else { $log = Logs::get_log($id); $str_change = array(); if (!empty($log)) { $str_change = unserialize($log['data']); } $value = array('status' => '00', 'amount' => $amount, 'description' => 'Giao dịch thành công.', 'pin' => $str_change['pin'], 'serial' => $str_change['serial'], 'type' => $str_change['type']); $value = serialize($value); $id = Logs::update_log($id, array('data' => $value)); if ($id) { $str_topup = array('uid' => $log['uid'], 'serial' => $str_change['serial'], 'pin' => $str_change['pin'], 'type' => $str_change['type'], 'created' => $log['origin_time'], 'price' => $amount); DB::insert('topup', $str_topup); $user = PersonalDB::get_account_byId($log['uid']); $new_coin = $user['coin'] + $amount; DB::update_id('account', array('coin' => $new_coin), $user['id']); } } exit; }
function draw() { global $display; $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); $user = PersonalDB::get_account_information(); $display->add('user', $user); $display->output('edit_user', false, 'Personal'); $this->endForm(); }
function draw() { global $display; if (!User::is_login()) { return; } $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); if (CGlobal::$lang == 1) { $display->add('lng', language::$LNG['personal']['en']); } else { $display->add('lng', language::$LNG['personal']['vn']); } $item_per_page = 6; $total_row = DB::fetch('SELECT count(*) AS total_row FROM `order` o WHERE o.uid = ' . User::$current->data['id'] . ' AND o.status <> 0 LIMIT 0,1', 'total_row', 0); $list_bill = array(); $paging = ''; if ($total_row) { $limit = ''; require_once ROOT_PATH . 'core/ECPagging.php'; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $sql = 'SELECT *, o.id as oid FROM `order` o WHERE o.uid = ' . User::$current->data['id'] . ' AND o.status <> 0 ORDER BY o.id DESC ' . $limit; $re = DB::query($sql); if ($re) { while ($row = mysql_fetch_assoc($re)) { if ($_COOKIE['lang'] == 1) { $row['delivery_time'] = date('H:i:s m-d-Y', $row['delivery_time'] * 60 + $row['time']); } else { $row['delivery_time'] = date('H:i:s d-m-Y', $row['delivery_time'] * 60 + $row['time']); } $row['total'] = EClassApi::numberFormat($row['total']); $list_bill[] = $row; } } $display->add('list_bill', $list_bill); $display->add('total_row', $total_row); $display->add('paging', $paging); } $var = null; $sql = "SELECT DISTINCT a.*, d.name AS district_name, d.name_en AS district_name_en, p.id AS pid, p.name AS city_name, p.name_en AS city_name_en FROM delivery_address a INNER JOIN district d ON a.did = d.id INNER JOIN city p ON d.pid = p.id WHERE uid = " . User::$current->data['id']; //Get city $result = DB::query($sql); $list_delivery = array(); $address_default = null; if ($result) { while ($row = mysql_fetch_assoc($result)) { //$address = $row['address']; //$city_name = $row['city_name']; //$district_name = $row['district_name']; //$note = $row['note']; if ($row['is_default'] == 1) { $address_default = $row; } $list_delivery[] = $row; } } $display->add('list_delivery', $list_delivery); $display->add('address_default', $address_default); $user = PersonalDB::get_account_information(); $next_reward = 100 - $user['point'] % 100; $display->add('next_reward', $next_reward); $display->add('list_city', City::get_list()); if (!empty($address_default) && !empty($address_default['pid'])) { $display->add('list_district', City::get_districts($address_default['pid'])); } $display->add('user', $user); $display->add('lang', CGlobal::$lang); $display->add('error_message', $this->getErrorMessage('personal/change_password')); $display->add('success_message', $this->getSuccessMessage('personal/change_password')); $display->add('form_data', $this->getSuccessMessage('personal/form_data')); $display->setTemplate('ManageOrder', $var); $this->endForm(); }
function draw() { global $display; $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); $user = PersonalDB::get_account_information(); $display->add('user', $user); if (intval(date('d')) >= 5) { $month = date('n', strtotime('+1 month')); } else { $month = date('n'); } $list_paid = PersonalDB::get_student_paid('', ' uid = ' . $user['id'] . ' AND month = ' . $month, ''); $display->add('month', $month); $str_class = ''; foreach ($list_paid as $paid) { $str_class .= $str_class == '' ? $paid['cid'] : ', ' . $paid['cid']; } $list_class_paid = array(); $list_paid_all = array(); $list_class = array(); if ($user['class_id'] != '') { if ($str_class != '') { $list_class_paid = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND id NOT IN (' . $str_class . ') AND price > 0'); } else { $list_class_paid = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND price > 0'); } $list_paid_all = PersonalDB::get_student_paid('', ' uid = ' . $user['id'] . ' AND cid IN (' . $user['class_id'] . ')', ''); $list_class = Classes::get_collection(null, ' id IN (' . $user['class_id'] . ') AND price > 0'); } $display->add('list_paid_all', $list_paid_all); $display->add('list_class', $list_class); $display->add('error_message', $this->getErrorMessage('personal/extra_time')); $display->add('success_message', $this->getSuccessMessage('personal/extra_time')); $display->add('form_data', $this->getSuccessMessage('personal/form_data')); $display->add('list_class_paid', $list_class_paid); $display->output('ExtraTime', false, 'Personal'); $this->endForm(); }
function draw() { global $display; // $this->beginForm(false, 'post', false, Url::build_current(array('cmd' => 'list_log'))); $filter_id = intval(trim(Url::get('filter_id'))); $cid = intval(trim(Url::get('cid'))); $display->add('cid', $cid); $display->add('from_time', Url::get('from_time')); $display->add('to_time', Url::get('to_time')); $cond = array(); if (!empty($filter_id)) { $cond[] = 'a.id LIKE "' . $filter_id . '%"'; $display->add('filter_id', $filter_id); } if (!empty($cid)) { $cond[] = 'cid = ' . $cid; } $from_time = 0; $to_time = 0; if (Url::get('from_time')) { $date_arr = explode('/', Url::get('from_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $from_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 0); } } if (Url::get('to_time')) { $date_arr = explode('/', Url::get('to_time')); if (isset($date_arr[0]) && isset($date_arr[1]) && isset($date_arr[2])) { $to_time = EClassApi::render_time($date_arr[1] . '/' . $date_arr[0] . '/' . (int) $date_arr[2], 1); } } if ($from_time) { $cond[] = ' `time` >= ' . $from_time; } if ($to_time) { $cond[] = ' `time` <= ' . $to_time; } // if (intval(date('d')) < 5) // $month = date('n'); // else // $month= date('n', strtotime('+1 month')); $month = date('n'); $cond[] = 'month = ' . $month; $item_per_page = 50; $cond = EClassApi::analyze_conditions($cond); $list_extend = array(); $paging = ''; $total_row = PersonalDB::count_all_paid($cond); if ($total_row) { require_once ROOT_PATH . 'core/ECPagging.php'; $limit = ''; $paging = ECPagging::pagingSE($limit, $total_row, $item_per_page, 10, 'page_no', true); $list_extend = PersonalDB::get_student_paid($limit, $cond, ' ORDER BY uid DESC'); } foreach ($list_extend as $extend) { $time = date('H:i:s d/m/Y', $extend['time']); $list_extend[$extend['id']]['time'] = $time; } $list_class = Classes::get_collection_with_join(null); $error_message = $this->getErrorMessage('admin/log/error'); $display->add('error_message', $error_message); $display->add('paging', $paging); $display->add('list_extend', $list_extend); $display->add('list_class', $list_class); $display->add('is_admin', User::is_admin()); $display->output('Extend'); // $this->endForm(); }
function remove_avatar() { header('Content-Type: text/html; charset=utf-8'); global $display; $id = intval(Url::get('id', 0)); $uid = $_SESSION['user_id']; $image = PersonalDB::get_image_upload_byId($id); if ($image) { unlink($image['path']); } PersonalDB::delete_avatar($id); $user = PersonalDB::get_account_byId($uid); if ($image['path'] == $user['avatar_url']) { $avatar_url = array('avatar_url' => ''); PersonalDB::update_account_information($avatar_url); } if ($image['path'] == $user['banner_url']) { $banner_url = array('banner_url' => ''); PersonalDB::update_account_information($banner_url); } $list_image = PersonalDB::get_image_upload($user['id']); $display->add('list_image', $list_image); exit; }
function update_user($new_path, $phone_verify, $img_server) { if (!isset($_POST['show_email'])) { $show_email = 0; } else { $show_email = 1; } if (!isset($_POST['show_home_phone'])) { $show_home_phone = 0; } else { $show_home_phone = 1; } if (!isset($_POST['email_alert'])) { $email_alert = 0; } else { $email_alert = 1; } $id_card = Url::get('id_card'); if (AZLib::checkBadWord($id_card)) { $id_card = ''; } $new_blast = Url::get('blast'); if (AZLib::checkBadWord($new_blast)) { $new_blast = ''; } $new_sign = Url::get('sign'); if (AZLib::checkBadWord($new_sign)) { $new_sign = ''; } $full_name = Url::get('full_name'); if (AZLib::checkBadWord($full_name)) { $full_name = ''; } $address = Url::get('address'); if (AZLib::checkBadWord($address)) { $address = ''; } $home_phone = Url::get('home_phone'); $home_phone = preg_replace("/[^0-9]/", "", $home_phone); if (AZLib::is_mobile($home_phone) || substr($home_phone, 0, 1) != "0") { $home_phone = ''; } $fax = Url::get('fax'); $fax = preg_replace("/[^0-9]/", "", $fax); $mobile_phone = Url::get('mobile_phone'); $mobile_phone = preg_replace("/[^0-9]/", "", $mobile_phone); if (!AZLib::is_mobile($mobile_phone)) { $mobile_phone = ''; } $website = Url::get('website'); if (AZLib::checkBadWord($website)) { $website = ''; } $yahoo_id = Url::get('yahoo_id'); if (AZLib::checkBadWord($yahoo_id)) { $yahoo_id = ''; } $skype_id = Url::get('skype_id'); if (AZLib::checkBadWord($skype_id)) { $skype_id = ''; } $arr = explode('-', Url::get('birth_day')); if (is_numeric($arr['0']) && is_numeric($arr['1']) && is_numeric($arr['2'])) { $strBirthDay = $arr['2'] . '-' . $arr['1'] . '-' . $arr['0']; } else { $strBirthDay = ""; } if ($new_path) { $new_row = array('full_name' => trim($full_name), 'address' => trim($address), 'id_card' => $id_card, 'birth_day' => $strBirthDay, 'gender' => intval(Url::get('gender')), 'home_phone' => trim($home_phone), 'fax' => trim($fax), 'mobile_phone' => trim($mobile_phone), 'show_home_phone' => $show_home_phone, 'show_email' => $show_email, 'email_alert' => $email_alert, 'website' => trim($website), 'yahoo_id' => trim($yahoo_id), 'skype_id' => $skype_id, 'blast' => trim($new_blast), 'signature' => trim($new_sign), 'img_server' => $img_server, 'avatar_url' => trim($new_path)); } else { $new_row = array('full_name' => trim($full_name), 'address' => trim($address), 'id_card' => $id_card, 'birth_day' => $strBirthDay, 'gender' => intval(Url::get('gender')), 'home_phone' => trim($home_phone), 'show_home_phone' => $show_home_phone, 'fax' => trim($fax), 'mobile_phone' => trim($mobile_phone), 'show_email' => $show_email, 'email_alert' => $email_alert, 'website' => trim($website), 'yahoo_id' => trim($yahoo_id), 'skype_id' => trim($skype_id), 'blast' => $new_blast, 'signature' => trim($new_sign)); } PersonalDB::update_user_information($new_row); if ($new_blast) { //blast không trống DB::delete("feed", "user_id=" . User::id() . " AND type = 8"); DB::query("INSERT INTO feed (type, user_id, act_user_id, time)\r\n\t\t\t\t\t\t\t\t\t\tVALUES (8, " . User::id() . ", " . User::id() . ", " . TIME_NOW . ")"); } else { //Xoá blast DB::delete("feed", "user_id=" . User::id() . " AND type = 8"); } }
function draw() { if (User::is_login()) { global $display; $this->beginForm(true, "post", false, "?" . htmlentities($_SERVER['QUERY_STRING'])); $user = PersonalDB::get_account_information(); $display->add('user', $user); $display->add('error_message', $this->getErrorMessage('personal/change_password')); $display->add('success_message', $this->getSuccessMessage('personal/change_password')); $display->add('form_data', $this->getSuccessMessage('personal/form_data')); $display->output('change_pass', false, 'Personal'); $this->endForm(); } else { Url::redirect_url('home'); } }