本文整理匯總了PHP中Model\User::getCurrent方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getCurrent方法的具體用法?PHP User::getCurrent怎麽用?PHP User::getCurrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::getCurrent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
public function index()
{
$data['user'] = User::getCurrent();
$data['cronList'] = CronModel::getCronArray();
Template::setContext($data);
Template::setView('admin/cron');
}
示例2: check
public function check()
{
if (self::$isCheck) {
return false;
}
if (User::getCurrent()->isAdmin()) {
$current_version = Option::get("version");
$git_current_version = file_get_contents(DATA_PATH . 'version.lock');
// 從 update.loacg.com 服務器上獲取版本變化
$response = self::doGet(self::UPDATE_SERVER . self::CHECK, array("Cookie: ver:" . $current_version));
if ($response != null) {
$response = json_decode($response, true);
$data = $response['data'];
$online_version = $data['version'];
if ($data['download_url'] != null) {
}
$message = "";
if ($data['message'] != null) {
$message = $data['message'];
}
self::$isCheck = true;
if ($current_version != $online_version) {
if ($git_current_version == $online_version) {
Option::set("version", $git_current_version);
return false;
}
if ($message == "") {
$message = "發現新版本 " . $online_version . " , 可以前往Github下載更新(本消息僅管理員可接收到)";
}
return htmlspecialchars($message);
}
}
}
return false;
}
示例3: afterRoute
public function afterRoute(&$className, &$method)
{
$user = User::getCurrent();
$reflection = new ReflectionMethod($className, $method);
$docComment = $reflection->getDocComment();
// $this->isJson = $this->isJSON($docComment);
if (strpos($docComment, '@Authorization') !== false && !$user) {
$this->black = true;
}
$reflection = new ReflectionObject(new $className());
$docCommentC = $reflection->getDocComment();
if (strpos($docCommentC, '@Authorization') !== false && !$user) {
$this->black = true;
}
if (strpos($docComment, '@Admin') !== false || strpos($docCommentC, '@Admin') !== false) {
if ($user && !$user->isAdmin()) {
$this->data['message'] = '你不是管理員,無法訪問此頁麵';
$this->black = true;
}
}
if ($this->black) {
if ($this->isJson) {
Template::setContext($this->data);
Filter::preRender();
} else {
Message::show($this->data['message'], 'auth/login', 3);
}
}
}
示例4: system
/**
* 詳細參數 頁麵
*/
public function system()
{
$data['user'] = User::getCurrent();
$data['options'] = Option::getOptions();
Template::setContext($data);
Template::setView("admin/system");
}
示例5: index
public function index()
{
$data['user'] = User::getCurrent();
$data['lists'] = MessageModel::getPushMessage(-1);
Template::setContext($data);
Template::setView('admin/message');
}
示例6: index
public function index()
{
$data['user'] = User::getCurrent();
$data['nodes'] = NodeModel::getNodeArray();
Template::setContext($data);
Template::setView('admin/node');
}
示例7: index
public function index()
{
$data['user'] = UserModel::getCurrent();
$data['users'] = UserModel::getUserList();
$data['planList'] = json_decode(Option::get('custom_plan_name'), true);
Template::setContext($data);
Template::setView('admin/user');
}
示例8: index
public function index()
{
$data['user'] = User::getCurrent();
$data['flow_num10'] = Stats::dataUsage(0);
$data['flow_num30'] = Stats::dataUsage(1);
$data['flow_num100'] = Stats::dataUsage(2);
$data['flow_max'] = Stats::dataUsage(3);
$data['userCount'] = Stats::countUser();
$data['money'] = Stats::countMoney();
Template::setContext($data);
Template::setView('admin/index');
}
示例9: getSupportCustomMethodArray
/**
* get support custom method node.
* @return Node[]
*/
public static function getSupportCustomMethodArray()
{
$plan = User::getCurrent()->plan;
$selectSQL = 'SELECT * FROM node WHERE custom_method=1 AND `type` BETWEEN 0 AND ?';
$type = 0;
if ($plan == 'VIP') {
$type = 1;
}
$statement = DB::getInstance()->prepare($selectSQL);
$statement->bindValue(1, $type);
$statement->execute();
return $statement->fetchAll(DB::FETCH_CLASS, __CLASS__);
}
示例10: create
/**
* 創建訂單
*
*/
public function create()
{
$user = User::getCurrent();
$data['custom_plan_name'] = json_decode(Option::get('custom_plan_name'), true);
$data['custom_transfer_level'] = json_decode(Option::get('custom_transfer_level'), true);
$plan = strtoupper($_GET['plan']);
$money = 0;
switch ($plan) {
case 'B':
$money = 12;
break;
case 'C':
$money = 20;
break;
case 'D':
$money = 35;
break;
case 'VIP':
$money = 50;
break;
case 'Z':
$money = 50;
break;
}
/*
if(count(MOrder::getByUserId($user->uid)) > 0) {
header("Location: /order/lists");
exit();
}
*/
$order = new MOrder();
$order->uid = $user->uid;
$order->createTime = time();
$order->money = $money;
$order->plan = $plan;
$order->status = 0;
$order->type = 0;
// 類型: 0 - 購買套餐 1 - 賬戶金額充值 2 - 購買卡號
$remark = $order->type == 0 ? "購買套餐 " : $order->type == 1 ? "金額充值 " : "購買卡號 ";
$remark .= $plan . ', ' . $money . '元';
$order->remark = $remark;
$order->save(Model::SAVE_INSERT);
Template::putContext("order_id", $order->id);
Template::putContext('transfer', $data['custom_transfer_level'][$plan]);
Template::putContext('plan', $plan);
Template::putContext('plan_name', $data['custom_plan_name'][$plan]);
Template::putContext('money', $money);
Template::putContext('user', $user);
Template::setView('panel/order_create');
}
示例11: buy
/**
* 購買邀請碼,必要權限檢查
*
* @JSON
* @Authorization
* @return array
*/
public function buy()
{
$user = User::getUserByUserId(User::getCurrent()->uid);
$result = array('error' => 1, 'message' => '購買失敗,至少需要20GB流量才能購買邀請碼。');
$transfer = Utils::GB * 10;
// update by github.com/BorLee
// 1abd9e6be7bfd7e3b1e9f34acd357fa7fa29923c
if ($user->transfer > $transfer * 2 && $user->transfer - $user->getUseTransfer() > $transfer) {
$user->transfer = $user->transfer - $transfer;
$user->invite_num = $user->invite_num + 1;
$user->save();
$result = array('error' => 0, 'message' => '購買成功,扣除手續費10GB流量', 'invite_num' => $user->invite_num);
}
return $result;
}
示例12: update
/**
* 添加一個邀請碼
* @JSON
*/
public function update()
{
$result = array('error' => -1, 'message' => 'Request failed');
$user = User::getCurrent();
if ($_POST['invite'] == null) {
$result = array('error' => 0, 'message' => '添加成功,刷新可見');
$plan = 'A';
$add_uid = -1;
$inviteNumber = 1;
if ($_POST['plan'] != null) {
$plan = $_POST['plan'];
}
if ($_POST['add_uid'] != null) {
$add_uid = trim($_POST['add_uid']);
if ($add_uid != $user->uid && $add_uid != -1) {
if (!User::getUserByUserId($add_uid)) {
$result['error'] = 1;
$result['message'] = "此UID: " . $add_uid . " 的用戶不存在,添加失敗";
return $result;
}
}
}
if ($_POST['number'] != null) {
$inviteNumber = $_POST['number'];
}
if ($inviteNumber > 1) {
for ($i = 0; $i < $inviteNumber; $i++) {
InviteModel::addInvite($add_uid, $plan);
}
} else {
InviteModel::addInvite($add_uid, $plan);
}
$result['inviteNumber'] = $inviteNumber;
$result['plan'] = $plan;
} else {
if ($_POST['invite'] != null) {
$invite = InviteModel::getInviteByInviteCode(trim($_POST['invite']));
if ($invite != null) {
$invite->dateLine = time();
$invite->expiration = $_POST['expiration'];
$invite->plan = $_POST['plan'];
$invite->save();
$result = array('error' => 0, 'message' => '更新邀請碼成功');
}
}
}
return $result;
}
示例13: getNodeInfo
/**
* @JSON
* @return array
*/
public function getNodeInfo()
{
$id = trim($_REQUEST['id']);
$result = array('error' => -1, 'message' => 'Request failed');
$user = User::getUserByUserId(User::getCurrent()->uid);
$node = MNode::getNodeById($id);
$method = $node->method;
if ($node->custom_method == 1 && $user->method != '' && $user->method != null) {
$method = $user->method;
}
$info = self::nodeDetail($node->server, $user->port, $user->sspwd, $method, $node->name);
if (self::verifyPlan($user->plan, $node->type)) {
$result = array('error' => 0, 'message' => '獲取成功', 'info' => $info, 'node' => $node);
} else {
$result = array('error' => -1, 'message' => '你不是 VIP, 無法使用高級節點!');
}
return $result;
}
示例14: test
/**
* @JSON
*/
public function test()
{
$result = array('error' => 1, 'message' => '發送郵件錯誤,請檢查郵件配置');
$user = User::getCurrent();
$mailer = Mailer1::getInstance();
$mail = new Mail();
$mail->to = $user->email;
$mail->subject = '[' . SITE_NAME . '] 這是一封測試郵件';
$mail->content = '這是一封<b>單條發送</b>測試郵件';
$mail->content .= "<p style=\"padding: 1.5em 1em 0; color: #999; font-size: 12px;\">—— 本郵件由 " . SITE_NAME . " (<a href=\"" . BASE_URL . "\">" . BASE_URL . "</a>) 管理員發送</p>";
if (!$mailer->send($mail)) {
return $result;
}
$mailer->toQueue(true);
$mail->subject = '[' . SITE_NAME . '] 這是一封多條發送測試郵件';
$mail->content = '這是一封<b>多條發送</b>測試郵件';
$mail->content .= "<p style=\"padding: 1.5em 1em 0; color: #999; font-size: 12px;\">—— 本郵件由 " . SITE_NAME . " (<a href=\"" . BASE_URL . "\">" . BASE_URL . "</a>) 管理員發送</p>";
if (!$mailer->send($mail)) {
return $result;
} else {
$result = array('error' => 0, 'message' => '郵件已經發送到您的郵箱上');
return $result;
}
}
示例15: deleteMe
/**
* 刪除自己的賬戶(在本站徹底清空自己注冊的賬戶)
*
* @JSON
* @return array
*/
public function deleteMe()
{
$user = User::getCurrent();
$flag = $_POST['delete'];
$result = array('error' => 1, "message" => "請求錯誤");
if ($flag != null && $flag == '1') {
$user->delete();
$result = array("error" => 0, "message" => "您已經從本站消除所有記憶,將在 3秒 後執行世界初始化...<br/>祝您過得愉快。");
$_SESSION['currentUser'] = null;
setcookie("uid", '', time() - 3600, "/");
setcookie("expire", '', time() - 3600, "/");
setcookie("token", '', time() - 3600, "/");
}
return $result;
}