当前位置: 首页>>代码示例>>PHP>>正文


PHP Encryption::decryptId方法代码示例

本文整理汇总了PHP中Encryption::decryptId方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::decryptId方法的具体用法?PHP Encryption::decryptId怎么用?PHP Encryption::decryptId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Encryption的用法示例。


在下文中一共展示了Encryption::decryptId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 /**
  * view a post
  *
  * @param integer|string $postId
  */
 public function view($postId = 0)
 {
     $postId = Encryption::decryptId($postId);
     if (!$this->post->exists($postId)) {
         $this->error("notfound");
     }
     $this->vars['globalPage'] = ["posts", "comments"];
     $this->vars['globalPageId'] = $postId;
     echo $this->view->renderWithLayouts(VIEWS_PATH . "layout/", VIEWS_PATH . 'posts/viewPost.php', array("postId" => $postId));
 }
开发者ID:E01T,项目名称:miniPHP,代码行数:15,代码来源:PostsController.php

示例2: viewUser

 /**
  * view a user
  *
  * @param integer|string $userId
  */
 public function viewUser($userId = 0)
 {
     $userId = Encryption::decryptId($userId);
     if (!$this->user->exists($userId)) {
         $this->error("notfound");
     }
     $this->vars['curPage'] = "users";
     $this->vars['curPageId'] = $userId;
     echo $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('ADMIN_VIEWS_PATH') . 'users/viewUser.php', array("userId" => $userId));
 }
开发者ID:mrSerg161,项目名称:miniPHP,代码行数:15,代码来源:AdminController.php

示例3: viewUser

 /**
  * view a user
  *
  * @param integer|string $userId
  */
 public function viewUser($userId = 0)
 {
     $userId = Encryption::decryptId($userId);
     if (!$this->user->exists($userId)) {
         $this->error("notfound");
     }
     $this->vars['globalPage'] = "users";
     $this->vars['globalPageId'] = $userId;
     echo $this->view->renderWithLayouts(VIEWS_PATH . "layout/", ADMIN_VIEWS_PATH . 'users/viewUser.php', array("userId" => $userId));
 }
开发者ID:E01T,项目名称:miniPHP,代码行数:15,代码来源:AdminController.php

示例4: create

 public function create()
 {
     $postId = Encryption::decryptId($this->request->data("post_id"));
     $content = $this->request->data("content");
     $comment = $this->comment->create(Session::getUserId(), $postId, $content);
     if (!$comment) {
         $this->view->renderErrors($this->comment->errors());
     } else {
         $html = $this->view->render(Config::get('VIEWS_PATH') . 'posts/comments.php', array("comments" => $comment));
         $this->view->renderJson(array("data" => $html));
     }
 }
开发者ID:omarelgabry,项目名称:miniphp,代码行数:12,代码来源:CommentsController.php

示例5: updateEmail

 /**
  * confirm on email updates
  *
  * You must be logged in with your current email
  */
 public function updateEmail()
 {
     $userId = $this->request->query("id");
     $userId = empty($userId) ? null : Encryption::decryptId($this->request->query("id"));
     $token = $this->request->query("token");
     $result = $this->user->updateEmail($userId, $token);
     $errors = $this->user->errors();
     if (!$result && empty($errors)) {
         return $this->error(404);
     } else {
         if (!$result && !empty($errors)) {
             $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php', ["emailUpdates" => ["errors" => $this->user->errors()]]);
         } else {
             $this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('VIEWS_PATH') . 'user/profile.php', ["emailUpdates" => ["success" => "Your email updates has been updated successfully."]]);
         }
     }
 }
开发者ID:omarelgabry,项目名称:miniphp,代码行数:22,代码来源:UserController.php

示例6: resetPassword

 /**
  * If password token valid, then show update password form
  *
  */
 public function resetPassword()
 {
     $userId = Encryption::decryptId($this->request->query("id"));
     $token = $this->request->query("token");
     $result = $this->login->isForgottenPasswordTokenValid($userId, $token);
     if (!$result) {
         $this->error("notfound");
     } else {
         //If there is a user already logged in, then log out.
         //It not necessary for the logged in user to be the same as user_id in the requested reset password URL.
         //But, this won't allow user to open more than one update password form,
         //because every time it loads, it generates a new CSRF Token
         //So, keep it commented
         //$this->login->logOut(Session::getUserId(), true);
         //don't store the user id in a hidden field in the update password form,
         //because user can easily open inspector and change it,
         //so you will ending up using updatePassword() on an invalid user id.
         Session::set("user_id_reset_password", $userId);
         echo $this->view->renderWithLayouts(Config::get('LOGIN_PATH'), Config::get('LOGIN_PATH') . 'updatePassword.php');
     }
 }
开发者ID:reallysend,项目名称:miniPHP,代码行数:25,代码来源:LoginController.php

示例7: isAuthorized

 public function isAuthorized()
 {
     $action = $this->request->param('action');
     $role = Session::getUserRole();
     $resource = "posts";
     // only for admins
     Permission::allow('admin', $resource, ['*']);
     // only for normal users
     Permission::allow('user', $resource, ['index', 'view', 'newPost', 'create']);
     Permission::allow('user', $resource, ['update', 'delete'], 'owner');
     $postId = $action === "delete" ? $this->request->param("args")[0] : $this->request->data("post_id");
     if (!empty($postId)) {
         $postId = Encryption::decryptId($postId);
     }
     $config = ["user_id" => Session::getUserId(), "table" => "posts", "id" => $postId];
     return Permission::check($role, $resource, $action, $config);
 }
开发者ID:omarelgabry,项目名称:miniphp,代码行数:17,代码来源:PostsController.php

示例8: updateUserInfo

 /**
  * update user profile info(name, password, role)
  *
  */
 public function updateUserInfo()
 {
     $userId = Encryption::decryptId($this->request->data("user_id"));
     $name = $this->request->data("name");
     $password = $this->request->data("password");
     $role = $this->request->data("role");
     if (!$this->user->exists($userId)) {
         return $this->error(404);
     }
     $result = $this->admin->updateUserInfo($userId, Session::getUserId(), $name, $password, $role);
     if (!$result) {
         $this->view->renderErrors($this->admin->errors());
     } else {
         $this->view->renderSuccess("Profile has been updated.");
     }
 }
开发者ID:omarelgabry,项目名称:miniphp,代码行数:20,代码来源:AdminController.php


注:本文中的Encryption::decryptId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。