本文整理汇总了PHP中drawForm函数的典型用法代码示例。如果您正苦于以下问题:PHP drawForm函数的具体用法?PHP drawForm怎么用?PHP drawForm使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drawForm函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
adminGateKeeper();
$title = "Create a Custom Page";
$body = drawForm(array("name" => "create_custom_page", "method" => "post", "action" => "CreateCustomPage"));
$this->html = drawpage($title, $body);
}
示例2: val_email_form
function val_email_form($character_get, $con, $username)
{
if (isset($_POST['Send'])) {
$new_email = mysqli_real_escape_string($con, $_POST['email']);
$password = mysqli_real_escape_string($con, $_POST['password']);
//check if password is correct, check if email is valid
$get_password = utils::mysqli_result(mysqli_query($con, "SELECT password FROM user WHERE username = '{$username}'"), 0, 0);
$get_salt = utils::mysqli_result(mysqli_query($con, "SELECT salt FROM user WHERE username = '{$username}'"), 0, 0);
//hash provided pw with salt
$newpassword_hash = crypt($password, $get_salt);
if ($newpassword_hash == $get_password) {
//passwords match, check if email is valid (again)
if (!filter_var($new_email, FILTER_VALIDATE_EMAIL)) {
echo "Invalid email format";
return;
} else {
//email is valid, password is valid, proceed to change
$update_email = mysqli_query($con, "UPDATE user SET email = '{$new_email}' WHERE username ='{$username}' ");
if ($update_email) {
echo "Email changed sucessfully";
} else {
echo "There was an error processing your request. Try again later.";
}
}
} else {
echo "Wrong password";
return;
}
//validation goes here
} else {
drawForm($character_get, $username);
}
}
示例3: val_password_form
function val_password_form($character_get, $username, $con)
{
if (isset($_POST['Send'])) {
$oldpassword = $_POST['oldpassword'];
$newpassword1 = $_POST['newpassword1'];
$newpassword2 = $_POST['newpassword2'];
$user = $_POST['user'];
//hash the provided password with the salt and match it against the one stored in the database
$salt = utils::mysqli_result(mysqli_query($con, "SELECT salt FROM user WHERE username = '{$user}'"), 0, 0);
$oldpassword_crypt = crypt($oldpassword, $salt);
$find_current_password = utils::mysqli_result(mysqli_query($con, "SELECT password FROM user WHERE username = '{$user}'"), 0, 0);
if ($find_current_password != $oldpassword_crypt) {
echo "Incorrect password";
} else {
if ($newpassword1 != $newpassword2) {
echo "The new passwords provided don't match";
} else {
//passwords match.
//generate new salt
//hash the new password and store it in the database
$cost = 10;
$new_salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
$new_salt = sprintf("\$2a\$%02d\$", $cost) . $new_salt;
$newpassword_hash = crypt($newpassword1, $new_salt);
$update_password = mysqli_query($con, "UPDATE user SET password = '{$newpassword_hash}', salt = '{$new_salt}' WHERE username = '{$username}'") or die(mysqli_error(${$con}));
if ($update_password) {
echo "Password successfully changed";
}
}
}
//validation goes here
} else {
drawForm($character_get, $username);
}
}
示例4: __construct
public function __construct()
{
$title = $body = $button = NULL;
switch (pageArray(1)) {
case "all":
default:
if (loggedIn()) {
$admin_groups = Setting::get("admin_groups");
if (!$admin_groups) {
$admin_groups = "users";
}
if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
$button = "<a href='" . getSiteURL() . "groups/create' class='btn btn-success'>Create a Group</a>";
}
}
$title = "Groups";
$body = display("pages/groups");
break;
case "create":
$admin_groups = Setting::get("admin_groups");
if (!$admin_groups) {
$admin_groups = "user";
}
if ($admin_groups == "admin" && adminLoggedIn() || $admin_groups == "user") {
$title = "Create a Group";
$body = drawForm(array("name" => "create_group", "action" => "createGroup", "method" => "post", "files" => true));
}
break;
case "view":
$guid = pageArray(2);
$group = getEntity($guid);
$edit_url = getSiteURL() . "groups/edit/{$guid}";
$delete_url = addTokenToURL(getSiteURL() . "action/deleteGroup/{$guid}");
if ($group->ownerIsLoggedIn()) {
$button = "<a href='{$edit_url}' class='btn btn-warning'>Edit Group</a>";
$button .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete Group</a>";
}
if (GroupsPlugin::loggedInUserCanJoin($group)) {
$join_group_url = addTokenToURL(getSiteURL() . "action/JoinGroup/" . $group->guid);
$button .= "<a href='{$join_group_url}' class='btn btn-success confirm'>Join Group</a>";
}
if ($group->loggedInUserIsMember() && $group->owner_guid != getLoggedInUserGuid()) {
$leave_group_url = addTokenToURL(getSiteURL() . "action/LeaveGroup/" . $group->guid);
$button .= "<a href='{$leave_group_url}' class='btn btn-danger confirm'>Leave Group</a>";
}
$title = $group->title;
$body = display("pages/group");
break;
case "edit":
$guid = pageArray(2);
$group = getEntity($guid);
$title = "Edit " . $group->title;
$body = drawForm(array("name" => "edit_group", "action" => "editGroup", "method" => "post", "files" => true));
break;
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button));
}
示例5: __construct
public function __construct()
{
$title = $body = $buttons = $breadcrumbs = NULL;
switch (pageArray(1)) {
default:
$body = display("pages/forum");
$title = "Forum Categories";
if (adminLoggedIn()) {
$add_category_url = getSiteURL() . "forum/add_category";
$buttons = "<a href='{$add_category_url}' class='btn btn-danger'>Add a Category</a>";
}
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"));
break;
case 'add_category':
adminGateKeeper();
$body = drawForm(array("name" => "add_category", "method" => "post", "action" => "addCategory"));
$title = "Add a Forum Category";
break;
case 'category':
$guid = pageArray(2);
if ($guid) {
$category = getEntity($guid);
$body = display("forum/category");
if (loggedIn()) {
$add_topic_url = getSiteURL() . "forum/add_topic/{$guid}";
$buttons = "<a href='{$add_topic_url}' class='btn btn-success'>Add Topic</a>";
}
}
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title));
break;
case "add_topic":
gateKeeper();
$category_guid = pageArray(2);
$category = getEntity($category_guid);
$body = drawForm(array("name" => "add_topic", "method" => "post", "action" => "addTopic"));
$title = "Add a topic to {$category->title}";
break;
case "topic":
$topic = getEntity(pageArray(2));
$category = getEntity($topic->container_guid);
$breadcrumbs = array(array("link" => getSiteURL() . "forum", "label" => "Categories"), array("link" => getSiteURL() . "forum/category/" . $category->guid, "label" => $category->title), array("link" => getSiteURL() . "forum/topic/" . $topic->guid, "label" => $topic->title));
$body = display("forum/topic");
break;
case "editCategory":
adminGateKeeper();
$title = "Edit Forum Category";
$body = drawForm(array("name" => "edit_category", "method" => "post", "action" => "editCategory'"));
break;
case "editTopic":
adminGateKeeper();
$title = "Edit Forum Topic";
$body = drawForm(array("name" => "edit_topic", "method" => "post", "action" => "editTopic"));
break;
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons, "breadcrumbs" => $breadcrumbs));
}
示例6: __construct
public function __construct()
{
$title = $buttons = $body = NULL;
if (BlogsPlugin::userCanCreateBlog()) {
$body = display("page_elements/blogs_tabs");
$buttons = "<a href='" . getSiteURL() . "blogs/add' class='btn btn-success'>Add a Blog</a>";
}
switch (pageArray(1)) {
case "all_blogs":
default:
$title = "Blogs";
$body .= display("pages/all_blogs");
break;
case "friends_blogs":
$title = translate("friends_blogs");
$body .= display("pages/friends_blogs");
break;
case "my_blogs":
$title = "My Blogs";
$body .= display("pages/my_blogs");
break;
case "add":
if (BlogsPlugin::userCanCreateBlog()) {
$title = "Add a Blog";
$body = drawForm(array("name" => "add_blog", "method" => "post", "action" => "addBlog"));
}
break;
case "view":
$guid = pageArray(2);
$blog = getEntity($guid);
if ($blog) {
$title = $blog->title;
}
$owner = getEntity($blog->owner_guid);
$title .= " <small>by {$owner->full_name}</small>";
$body = display("pages/blog");
if (getLoggedInUserGuid() == $blog->owner_guid) {
$edit_url = getSiteURL() . "blogs/edit/{$guid}";
$delete_url = addTokenToURL(getSiteURL() . "action/deleteBlog/{$guid}");
$buttons = "<a href='{$edit_url}' class='btn btn-warning'>Edit</a>";
$buttons .= "<a href='{$delete_url}' class='btn btn-danger confirm'>Delete</a>";
}
break;
case "edit":
$buttons = NULL;
$title = "Edit your blog";
$body = drawForm(array("name" => "edit_blog", "method" => "post", "action" => "addBlog"));
break;
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $buttons));
}
示例7: __construct
/**
* Creates html for forgot password page
*/
public function __construct()
{
$code = pageArray(1);
$email = pageArray(2);
if ($code && $email) {
$access = getIgnoreAccess();
setIgnoreAccess();
$user = getEntities(array("type" => "User", "metadata_name_value_pairs" => array(array("name" => "email", "value" => $email), array("name" => "password_reset_code", "value" => $code))));
setIgnoreAccess($access);
if ($user) {
$user = $user[0];
new Vars("guid", $user->guid);
new Vars("code", $code);
$form = drawForm(array("name" => "new_password", "method" => "post", "action" => "newPassword"));
$header = "Enter your new password.";
$this->html = drawPage($header, $form);
$this->html = drawPage(array("header" => $header, "body" => $form));
}
} else {
$form = drawForm(array("name" => "forgot_password", "method" => "post", "action" => "ForgotPassword"));
$this->html = drawPage(array("header" => "Reset Your Password", "body" => $form));
}
}
示例8: __construct
public function __construct()
{
$page = pageArray();
switch ($page[1]) {
case "upload":
$form = drawForm(array("name" => "file/upload", "method" => "post", "action" => "fileUpload", "enctype" => "multipart/form-data"));
new Vars("container_guid", pageArray());
$this->html = drawPage(array("header" => "Upload File", "body" => $form));
break;
default:
if (is_numeric($page[1])) {
$guid = $page[1];
$file = getEntity($page[1]);
$image_url = Image::getImageURL($guid);
$image_title = $file->name;
$left_content = "<a href='{$image_url}' data-lightbox='image-{$guid}' data-title='{$image_title}'><img src='{$image_url}' class='img-responsive' alt=''/></a>";
$right_content = html_entity_decode($file->description);
$comments = display("output/block_comments", array("guid" => $guid, "show_form" => true));
$download_button = "<a href='" . getSiteURL() . "views/output/file_download.php?guid={$guid}' class='btn btn-success btn-block' style='margin-top:18px;'>Download</a>";
$body = <<<HTML
<div class='col-sm-4'>
{$left_content}
{$download_button}
</div>
<div class='col-sm-8'>
<div class='well'>
{$right_content}
</div>
{$comments}
</div>
HTML;
$this->html = drawPage(array("header" => $file->title, "body" => $body));
}
return false;
break;
}
}
示例9: __construct
function __construct()
{
$header = $body = NULL;
switch (pageArray(1)) {
default:
gateKeeper();
$header = "Report this page to the site admin.";
$body = drawForm(array("name" => "reportThis", "action" => "reportThis", "method" => "post"));
break;
case "reportSent":
$header = "Your report has been sent.";
$body = "<p>Thank you for your report. Our community relies on users like you to keep it safe.</p><p>We will review your report, and make a decision within 24 hours.</p>";
break;
case "view":
switch (pageArray(2)) {
default:
break;
case "":
break;
}
break;
}
$this->html = drawPage(array("header" => $header, "body" => $body));
}
示例10: denyDirect
<?php
/* * ***********************************************************************
*
* SocialApparatus CONFIDENTIAL
* __________________
*
* [2002] - [2017] SocialApparatus (http://SocialApparatus.co)
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of SocialApparatus
* and its suppliers, if any. The intellectual and technical concepts contained herein
* are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign
* Patents, patents in process, and are protected by trade secret or copyright law.
*
* Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from SocialApparatus.
*
* Contact Shane Barron admin@socia.us for more information.
*/
namespace SocialApparatus;
denyDirect();
$guid = Vars::get('guid');
$lead = translate("verification_email_sent:lead");
$form = drawForm(array("name" => "resend_verification_email", "action" => "ResendEmailVerification", "method" => "post"));
$body = <<<HTML
<p class="lead">{$lead}</p>
<p class="text-center">{$form}</p>
HTML;
echo drawPage(array("header" => translate("verification_email_sent:heading"), "body" => $body));
示例11: __construct
public function __construct()
{
gateKeeper();
$title = $body = $button = $wrapper_class = NULL;
switch (pageArray(1)) {
case "view":
$guid = pageArray(2);
$video = getEntity($guid);
if ($video) {
if ($video->title) {
$title = $video->title;
} else {
$title = " ";
}
if (getLoggedInUserGuid() == $video->owner_guid || adminLoggedIn()) {
$delete_url = addTokenToURL(getSiteURL() . "action/deleteVideo/{$guid}");
$button = "<a class='btn btn-info' href='" . getSiteURL() . "videos/edit/{$guid}'>Edit</a>";
$button .= "<a class='btn btn-danger confirm' href='{$delete_url}'>Delete</a>";
}
$body = display("pages/video");
} else {
forward();
}
break;
case "edit":
$title = "Edit Video Details";
$body = drawForm(array("name" => "edit_video", "method" => "post", "action" => "editVideo"));
break;
case "add":
$title = "Add a Video";
$body = drawForm(array("name" => "add_video", "method" => "post", "action" => "AddVideo", "enctype" => "multipart/form-data"));
break;
default:
case "albums":
switch (pageArray(2)) {
default:
$guid = pageArray(1);
if (!$guid) {
$guid = getLoggedInUserGuid();
}
$user = getEntity($guid);
if ($guid == getLoggedInUserGuid()) {
$name = "My";
} else {
$name = $user->full_name . "'s";
}
$title = $name . " Video Albums";
$body = display("pages/video_albums");
$button = "<a class='btn btn-success' href='" . getSiteURL() . "videos/albums/add'>Create an Album</a>";
break;
case "add":
$title = "Add a Video Album";
$body = drawForm(array("name" => "add_video_album", "method" => "post", "action" => "addVideoalbum", "class" => "add_video_album_form", "enctype" => "multipart/form-data"));
break;
case "view":
$guid = pageArray(3);
$album = getEntity($guid);
$title = $album->title;
$body = display("pages/video_album");
$delete_url = getSiteURL() . "action/deleteVideoalbum/{$guid}";
$delete_url = addTokenToURL($delete_url);
if (getLoggedInUserGuid() == $album->owner_guid || adminLoggedIn()) {
$button = "<a class='btn btn-info' href='" . getSiteURL() . "videos/albums/edit/{$guid}'>Edit Album</a>";
$button .= "<a class='btn btn-danger' href='{$delete_url}'>Delete Album</a>";
}
$button .= "<a class='btn btn-success' href='" . getSiteURL() . "videos/add/{$guid}'>Add Video</a>";
$wrapper_class = "masonry4col";
break;
case "edit":
$body = drawForm(array("name" => "edit_video_album", "method" => "post", "action" => "editVideoalbum", "enctype" => "multipart/form-data"));
$title = "Edit Album";
break;
}
}
$this->html = drawPage(array("header" => $title, "body" => $body, "button" => $button, "wrapper_class" => $wrapper_class));
}
示例12: __construct
function __construct()
{
$guid = NULL;
$header = Setting::get("store_name");
$body = $button = NULL;
$category = pageArray(1);
$category_entity = getEntity(array("type" => "Productcategory", "metadata_name" => "short_name", "metadata_value" => $category));
if ($category_entity) {
$guid = $category_entity->guid;
}
if (!$guid) {
$first_category = getEntity(array("type" => "Productcategory"));
if ($first_category) {
$guid = $first_category->guid;
}
}
if (adminLoggedIn()) {
$button = "<a href='" . getSiteURL() . "store/create_category' class='btn btn-default'>Create a Category</a>";
$button .= "<a href='" . getSiteURL() . "store/create_product/{$guid}' class='btn btn-success'>Create Product</a>";
$button .= "<a href='" . getSiteURL() . "store/edit_category/{$guid}' class='btn btn-info'>Edit Category</a>";
} else {
$button = NULL;
}
switch (pageArray(1)) {
case "categories":
default:
$body = display("pages/store");
break;
case "create_category":
adminGateKeeper();
$header = "Create a Category";
$body = drawForm(array("name" => "create_product_category", "method" => "post", "action" => "CreateProductCategory"));
break;
case "create_product":
adminGateKeeper();
$guid = pageArray(2);
$category = getEntity($guid);
$label = $category->label;
$header = "Create a new product in the {$label} category";
$body = drawForm(array("name" => "create_product", "method" => "post", "action" => "CreateProduct", "enctype" => "multipart/form-data"));
break;
case "register":
$header = "Please register to continue.";
$body = "<h2 class='text-center'>Register</h2>";
$body .= "<div class='row'>";
$body .= "<div class='col-md-4 col-md-offset-4'>";
$body .= drawForm(array("name" => "register", "method" => "post", "action" => "register"));
$body .= "</div>";
$body .= "</div>";
$body .= "<h2 class='text-center'>Already have an account? <a href='" . getSiteURL() . "login?referer=cart'>Login</a></h2>";
break;
case "edit_category":
$header = "Edit Category";
$body = drawForm(array("name" => "edit_product_category", "action" => "EditProductCategory", "method" => "post"));
break;
case "edit_product":
$header = "Edit Product";
$body = drawForm(array("name" => "edit_product", "action" => "EditProduct", "method" => "post", "enctype" => "multipart/form-data"));
break;
}
$this->html = drawPage(array("header" => $header, "body" => $body, "button" => $button));
}
示例13: __construct
function __construct()
{
$body = drawForm(array("name" => "edit_custom_page", "action" => "editCustomPage", "method" => "post"));
$title = "Edit Custom Page";
$this->html = drawPage($title, $body);
}
示例14: denyDirect
* [2002] - [2017] SocialApparatus (http://SocialApparatus.co)
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains the property of SocialApparatus
* and its suppliers, if any. The intellectual and technical concepts contained herein
* are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign
* Patents, patents in process, and are protected by trade secret or copyright law.
*
* Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from SocialApparatus.
*
* Contact Shane Barron admin@socia.us for more information.
*/
namespace SocialApparatus;
denyDirect();
gateKeeper();
$owner = getLoggedInUser();
$current_avatar = $owner->icon(EXTRALARGE, "img-responsive");
$form = drawForm(array("name" => "edit_avatar", "action" => "editAvatar", "method" => "post", "enctype" => "multipart/form-data"));
$body = <<<HTML
<div class='row edit_avatar_form'>
<div class="col-sm-4">
{$current_avatar}
</div>
<div class="col-sm-8">
{$form}
</div>
</div>
HTML;
echo drawPage(array("header" => "Edit Avatar", "body" => $body));
示例15: denyDirect
* and its suppliers, if any. The intellectual and technical concepts contained herein
* are proprietary to SocialApparatus and its suppliers and may be covered by U.S. and Foreign
* Patents, patents in process, and are protected by trade secret or copyright law.
*
* Dissemination of this information or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from SocialApparatus.
*
* Contact Shane Barron admin@socia.us for more information.
*/
namespace SocialApparatus;
denyDirect();
if (loggedIn()) {
$guid = pageArray(1);
$user = getEntity($guid);
$form = drawForm(array("name" => "update_status", "method" => "post", "action" => "UpdateStatus"));
$params = array("type" => "Profilestatus", "limit" => 10, "offset" => 0, "metadata_name" => "container_guid", "metadata_value" => $guid, "order_by" => "time_created", "order_reverse" => true);
$status = display("ajax/entity_list", array("params" => $params, "id" => "profile_status", "title" => NULL));
if ($guid == getLoggedInUserGuid()) {
echo <<<HTML
<div class='panel panel-success'>
<div class='panel-heading'>
<h4 class='panel-title'>What's on your mind?</h4>
</div>
<div class='panel-body status_panel_body'>
{$form}
<div id='ajax_profile_status'>
{$status}
</div>
</div>
</div>