本文整理汇总了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;
}