本文整理汇总了PHP中Encryption::encryptId方法的典型用法代码示例。如果您正苦于以下问题:PHP Encryption::encryptId方法的具体用法?PHP Encryption::encryptId怎么用?PHP Encryption::encryptId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encryption
的用法示例。
在下文中一共展示了Encryption::encryptId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: viewUser
/**
* view a user
*
* @param integer|string $userId
*/
public function viewUser($userId = 0)
{
$userId = Encryption::decryptId($userId);
if (!$this->user->exists($userId)) {
return $this->error(404);
}
Config::setJsConfig('curPage', "users");
Config::setJsConfig('userId', Encryption::encryptId($userId));
$this->view->renderWithLayouts(Config::get('VIEWS_PATH') . "layout/default/", Config::get('ADMIN_VIEWS_PATH') . 'users/viewUser.php', array("userId" => $userId));
}
示例2: getUpdateEmailBody
/**
* Construct the body of Update Email email
*
* @access private
* @static static method
* @param array $userData
* @param array $data
* @return string The body of the email.
*
*/
private static function getUpdateEmailBody($userData, $data)
{
$body = "";
$body .= "Dear " . $userData["name"] . ", \n\nPlease confirm your new email from the following link: ";
$body .= Config::get('EMAIL_UPDATE_EMAIL_URL') . "?id=" . urlencode(Encryption::encryptId($userData["id"])) . "&token=" . urlencode($data["pending_email_token"]);
$body .= "\n\nIf you have no idea what is this email for, you can ignore it.";
$body .= "\n\nRegards\nmini PHP Team";
return $body;
}
示例3:
echo PUBLIC_ROOT . "Todo/delete";
?>
" method="post">
<input type='hidden' name= "todo_id" value="<?php
echo "todo-" . Encryption::encryptId($todo["id"]);
?>
">
<input type='hidden' name = "csrf_token" value = "<?php
echo Session::generateCsrfToken();
?>
">
<button type="submit" name="submit" value="submit" class="btn btn-xs btn-danger">Delete</button>
</form>
<!-- in case of ajax request
<form class="form-delete-todo" action= "#" method="post">
<input type='hidden' name= "todo_id" value="<?php
echo "todo-" . Encryption::encryptId($todo["id"]);
?>
">
<button type="submit" name="submit" value="submit" class="btn btn-xs btn-danger">Delete</button>
</form>
-->
</li>
<?php
}
?>
</ul>
</div>
示例4: update
/**
* update a post
*
*/
public function update()
{
$postId = $this->request->data("post_id");
$title = $this->request->data("title");
$content = $this->request->data("content");
$postId = Encryption::decryptId($postId);
if (!$this->post->exists($postId)) {
return $this->error(404);
}
$post = $this->post->update($postId, $title, $content);
if (!$post) {
Session::set('posts-errors', $this->post->errors());
return $this->redirector->root("Posts/View/" . urlencode(Encryption::encryptId($postId)) . "?action=update");
} else {
return $this->redirector->root("Posts/View/" . urlencode(Encryption::encryptId($postId)));
}
}
示例5: urlencode
<div dir='auto' class="panel-heading">
<?php
if (Session::getUserId() === (int) $post["user_id"] || Session::getUserRole() === "admin") {
?>
<div class="pull-right">
<a href="<?php
echo PUBLIC_ROOT . "Posts/View/" . urlencode(Encryption::encryptId($post["id"])) . "?action=update";
?>
">
<button type="button" class="btn btn-default btn-circle edit"><i class="fa fa-pencil"></i></button>
</a>
<a href="<?php
echo PUBLIC_ROOT . "Posts/delete/" . urlencode(Encryption::encryptId($post["id"])) . "?csrf_token=" . urlencode(Session::generateCsrfToken());
?>
">
<button type="button" class="btn btn-danger btn-circle delete"><i class="fa fa-times"></i></button>
</a>
</div>
<?php
}
?>
<h5><?php
echo $post["title"];
?>
</h5>
</div>
<div class="panel-body">
<div class="row">
<div class="col-lg-12">
示例6: foreach
<?php
} else {
foreach ($posts as $post) {
?>
<tr>
<td style="width: 20%;"><strong><?php
echo $post["user_name"];
?>
</strong><br><em><?php
echo $this->timestamp($post["date"]);
?>
</em><br></td>
<td>
<a href="<?php
echo PUBLIC_ROOT . "Posts/View/" . urlencode(Encryption::encryptId($post["id"]));
?>
">
<strong><?php
echo $this->truncate($this->encodeHTML($post["title"]), 25);
?>
</strong>
</a><br>
<span class="text-muted"><?php
echo $this->truncate($this->encodeHTML($post["content"]), 30);
?>
</span>
</td>
<td class="text-center"><h5><strong class="text-primary"><?php
echo $post["comments"];
?>
示例7: foreach
<?php
if (empty($files)) {
?>
<tr class='no-data'><td colspan='4' class='text-muted text-center'>There is no files!</td></tr>
<?php
} else {
foreach ($files as $file) {
?>
<tr id="<?php
echo "file-" . Encryption::encryptId($file["id"]);
?>
">
<td style="width: 20%;"><strong><?php
echo $file["user_name"];
?>
</strong><br>
<em><?php
echo $this->timestamp($file["date"]);
?>
</em><br>
</td>
<td><a href="<?php
echo PUBLIC_ROOT . "downloads/download/" . urlencode($file["hashed_filename"]);
?>
">
<strong><?php
echo $this->truncate($this->encodeHTML($file["filename"]), 20);
示例8: foreach
<?php
if (empty($newsfeed)) {
?>
<li class='no-data text-center'><span class='text-muted'>There is no news feed!!</span></li>
<?php
} else {
foreach ($newsfeed as $feed) {
?>
<li id="<?php
echo "feed-" . Encryption::encryptId($feed["id"]);
?>
" class="left clearfix">
<span class="chat-img pull-left">
<img src="<?php
echo PUBLIC_ROOT . "img/profile_pictures/" . $feed["profile_picture"];
?>
" alt="User Picture" class="img-circle profile-pic-sm">
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php
echo $feed["user_name"];
?>
</strong>
<small class="text-muted"><i class="fa fa-clock-o fa-fw"></i> <?php
echo $this->timestamp($feed["date"]);
?>
</small>
<?php
示例9: foreach
<?php
if (empty($comments)) {
?>
<li class='no-data'><div class='text-center'><span class='text-muted'>There is no comments!</span></div></li>
<?php
} else {
foreach ($comments as $comment) {
?>
<li id="<?php
echo "comment-" . Encryption::encryptId($comment["id"]);
?>
" class="left clearfix">
<span class="chat-img pull-left">
<img src="<?php
echo PUBLIC_ROOT . "img/profile_pictures/" . $comment["profile_picture"];
?>
" alt="User Picture" class="img-circle profile-pic-sm">
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php
echo $comment["user_name"];
?>
</strong>
<small class="text-muted"><i class="fa fa-clock-o fa-fw"></i><?php
echo $this->timestamp($comment["date"]);
示例10: urlencode
?>
<td class='text-danger'>Not Available</td>
<?php
} else {
?>
<td ><em><?php
echo $this->encodeHTML($user["email"]);
?>
</em></td>
<?php
}
?>
<td class="text-center">
<span class="pull-right btn-group btn-group-xs">
<a href="<?php
echo PUBLIC_ROOT . "Admin/viewUser/" . urlencode(Encryption::encryptId($user["id"]));
?>
" class="btn btn-default">
<i class="fa fa-pencil"></i>
</a>
<?php
// current admin can't delete himself!
if (Session::getUserId() !== $user["id"]) {
?>
<a class="btn btn-danger delete"><i class="fa fa-times"></i></a>
<?php
}
?>
</span>
</td>
示例11: getEmailVerificationBody
/**
* Construct the body of Email Verification email
*
* @access private
* @static static method
* @param array $userData
* @param array $data
* @return string The body of the email.
*
*/
private static function getEmailVerificationBody($userData, $data)
{
$body = "";
$body .= "Dear " . $userData["name"] . ", \n\nPlease verify your email from the following link: ";
$body .= EMAIL_EMAIL_VERIFICATION_URL . "?id=" . urlencode(Encryption::encryptId($userData["id"])) . "&token=" . urlencode($data["email_token"]);
$body .= "\n\nIf you didn't edit/add your email, Please contact the admin directly.";
$body .= "\n\nRegards\nmini PHP Team";
return $body;
}
示例12:
" alt="User Picture" class="img-circle profile-pic-sm">
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php
echo $comment["user_name"];
?>
</strong>
<small class="text-muted"><i class="fa fa-clock-o fa-fw"></i><?php
echo $this->timestamp($comment["date"]);
?>
</small>
</div>
<form action="#" id="<?php
echo "form-update-comment-" . Encryption::encryptId($comment["id"]);
?>
" method="post">
<div class="form-group">
<textarea dir="auto" rows="3" maxlength="300" name="content" class="form-control" required
placeholder="Write your Comment"> <?php
echo $this->encodeHTML($comment["content"]);
?>
</textarea>
<p class="help-block"><em>The maximum number of characters allowed is <strong>300</strong></em></p>
</div>
<div class="form-group form-actions text-right">
<button type='button' name='cancel' value='cancel' class="btn btn-sm btn-default"><i class="fa fa-times"></i> Cancel</button>
<button type='submit' name='edit' value='edit' class="btn btn-sm btn-primary"><i class="fa fa-pencil"></i> Edit</button>
</div>
</form>
示例13:
?>
" alt="User Picture" class="img-circle profile-pic-sm">
</span>
<div class="chat-body clearfix">
<div class="header">
<strong class="primary-font"><?php
echo $newsfeed["user_name"];
?>
</strong>
<small class="text-muted"><i class="fa fa-clock-o fa-fw"></i> <?php
echo $this->timestamp($newsfeed["date"]);
?>
</small>
</div>
<form action="#" id="<?php
echo "form-update-feed-" . Encryption::encryptId($newsfeed["id"]);
?>
" method="post" >
<div class="form-group">
<label>Content <span class="text-danger">*</span></label>
<textarea dir="auto" rows="3" maxlength="300" name="content" class="form-control" required
placeholder="What are you thinking?"> <?php
echo $this->encodeHTML($newsfeed["content"]);
?>
</textarea>
<p class="help-block"><em>The maximum number of characters allowed is <strong>300</strong></em></p>
</div>
<div class="form-group form-actions text-right">
<button type='button' name='cancel' value='cancel' class="btn btn-sm btn-default"><i class="fa fa-times"></i> Cancel</button>
<button type='submit' name='edit' value='edit' class="btn btn-sm btn-primary"><i class="fa fa-pencil"></i> Edit</button>
</div>