本文整理汇总了PHP中resultBlock函数的典型用法代码示例。如果您正苦于以下问题:PHP resultBlock函数的具体用法?PHP resultBlock怎么用?PHP resultBlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resultBlock函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
$baseURL = getcwd();
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
//Forms posted
if (!empty($_POST)) {
if (!empty($_POST['delete']) || !empty($_POST['newPermission'])) {
//Delete permission levels
if (!empty($_POST['delete'])) {
$deletions = $_POST['delete'];
if ($deletion_count = deletePermission($deletions)) {
$successes[] = lang("PERMISSION_DELETIONS_SUCCESSFUL", array($deletion_count));
}
}
//Create new permission level
if (!empty($_POST['newPermission'])) {
$permission = trim($_POST['newPermission']);
//Validate request
if (permissionNameExists($permission)) {
$errors[] = lang("PERMISSION_NAME_IN_USE", array($permission));
} elseif (minMaxRange(1, 50, $permission)) {
$errors[] = lang("PERMISSION_CHAR_LIMIT", array(1, 50));
} else {
if (createPermission($permission)) {
$successes[] = lang("PERMISSION_CREATION_SUCCESSFUL", array($permission));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
} else {
$errors[] = lang("NO_PERMISSION_SELECTED");
}
}
$permissionData = fetchAllPermissions();
//Retrieve list of all permission levels
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Permissions</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminPermissions' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n<table class='admin'>\r\n<tr>\r\n<th>Delete</th><th>Permission Name</th>\r\n</tr>";
//List each permission level
foreach ($permissionData as $v1) {
echo "\r\n\t<tr>\r\n\t<td><input type='checkbox' name='delete[" . $v1['id'] . "]' id='delete[" . $v1['id'] . "]' value='" . $v1['id'] . "'></td>\r\n\t<td><a href='" . str_replace('index.php/', '', site_url('admin_permission')) . "?id=" . $v1['id'] . "'>" . $v1['name'] . "</a></td>\r\n\t</tr>";
}
echo "\r\n</table>\r\n<p>\r\n<label>Permission Name:</label>\r\n<input type='text' name='newPermission' />\r\n</p> \r\n<input type='submit' name='Submit' value='Submit' />\r\n</form>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}
示例2: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
$baseURL = getcwd();
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
//Forms posted
if (!empty($_POST)) {
if (!empty($_POST['delete'])) {
$deletions = $_POST['delete'];
if ($deletion_count = deleteUsers($deletions)) {
$successes[] = lang("ACCOUNT_DELETIONS_SUCCESSFUL", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
} else {
$errors[] = lang("NO_SELECTION_TO_DELETE_USER");
}
}
$userData = fetchAllUsers();
//Fetch information for all users
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Users</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminUsers' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n<table class='admin'>\r\n<tr>\r\n<th>Delete</th><th>Username</th><th>Display Name</th><th>Title</th><th>Last Sign In</th>\r\n</tr>";
//Cycle through users
foreach ($userData as $v1) {
echo "\r\n\t<tr>\r\n\t<td><input type='checkbox' name='delete[" . $v1['id'] . "]' id='delete[" . $v1['id'] . "]' value='" . $v1['id'] . "'></td>\r\n\t<td><a href='" . str_replace('index.php/', '', site_url('admin_user')) . "?id=" . $v1['id'] . "'>" . $v1['user_name'] . "</a></td>\r\n\t<td>" . $v1['display_name'] . "</td>\r\n\t<td>" . $v1['title'] . "</td>\r\n\t<td>\r\n\t";
//Interprety last login
if ($v1['last_sign_in_stamp'] == '0') {
echo "Never";
} else {
echo date("j M, Y", $v1['last_sign_in_stamp']);
}
echo "\r\n\t</td>\r\n\t</tr>";
}
echo "\r\n</table>\r\n<input type='submit' name='Submit' value='Delete' />\r\n</form>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}
示例3: userCakeMail
//We can use the template builder here
//We use the activation token again for the url key it gets regenerated everytime it's used.
$mail = new userCakeMail();
$confirm_url = lang("CONFIRM") . "\n" . $websiteUrl . "forgot-password.php?confirm=" . $userdetails["activation_token"];
$deny_url = lang("DENY") . "\n" . $websiteUrl . "forgot-password.php?deny=" . $userdetails["activation_token"];
//Setup our custom hooks
$hooks = array("searchStrs" => array("#CONFIRM-URL#", "#DENY-URL#", "#USERNAME#"), "subjectStrs" => array($confirm_url, $deny_url, $userdetails["user_name"]));
if (!$mail->newTemplateMsg("lost-password-request.txt", $hooks)) {
$errors[] = lang("MAIL_TEMPLATE_BUILD_ERROR");
} else {
if (!$mail->sendMail($userdetails["email"], "Lost password request")) {
$errors[] = lang("MAIL_ERROR");
} else {
//Update the DB to show this account has an outstanding request
if (!flagLostPasswordRequest($userdetails["user_name"], 1)) {
$errors[] = lang("SQL_ERROR");
} else {
$successes[] = lang("FORGOTPASS_REQUEST_SUCCESS");
}
}
}
}
}
}
}
require_once "models/admin_head.php";
echo "\n<body>\n<div id='wrapper'>\n<div id='top'><div id='logo'></div></div>\n<div id='content'>\n<h1>UserCake</h1>\n<h2>Forgot Password</h2>\n<div id='left-nav'>";
include "left-nav.php";
echo "\n</div>\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\n<div id='regbox'>\n<form name='newLostPass' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\n<p>\n<label>Username:</label>\n<input type='text' name='username' />\n</p>\n<p> \n<label>Email:</label>\n<input type='text' name='email' />\n</p>\n<p>\n<label> </label>\n<input type='submit' value='Submit' class='submit' />\n</p>\n</form>\n</div>\n</div>\n<div id='bottom'></div>\n</div>\n</body>\n</html>";
示例4: index
//.........这里部分代码省略.........
if ($indPage['page'] == $pageNameWithoutExt) {
$pageCheck = true;
}
}
if (preg_match('/^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$/', $pageNameWithoutExt) && !$pageCheck) {
$comment = $_POST['pageComment'];
$nameWords = explode("_", $pageNameWithoutExt);
$className = '';
if (sizeof($nameWords)) {
for ($i = 0; $i < sizeof($nameWords); $i++) {
$sep = $i ? "_" : "";
$className .= $sep . ucfirst($nameWords[$i]);
}
} else {
$className = ucfirst($pageNameWithoutExt);
}
$file = fopen("{$baseURL}/application/controllers/{$pageName}.php", "w");
fwrite($file, '<?php
/* This pase was created by ' . $loggedInUser->displayname . ' at "' . date("Y m d H-i-s") . '". */
/* ' . $comment . ' */
class ' . $className . ' extends CI_Controller{
public function __construct(){
parent::__construct();
global $baseURL;
$baseURL = getcwd();
// File requires to check logged in user information.
require_once("$baseURL/application/third_party/user_cake/models/class.user.php");
// Basic helper and libraries
$this->load->helper();
$this->load->library("session");
}
public function index(){
global $baseURL;
// Require config file
require_once("$baseURL/application/third_party/user_cake/models/config.php");
// Write your code after this line
// Code ends here
// index function
$this->load->view("' . $pageName . '");
}
}
?>');
fclose($file);
$file = fopen("{$baseURL}/application/views/{$pageName}.php", "w");
fwrite($file, '<?php
global $baseURL;
require_once("$baseURL/application/third_party/user_cake/models/header.php");
?>
<!DOCTYPE html PUBLIC \'-//W3C//DTD XHTML 1.0 Transitional//EN\' \'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\'>
<html xmlns=\'http://www.w3.org/1999/xhtml\'>
<head>
<meta http-equiv=\'Content-Type\' content=\'text/html; charset=utf-8\' />
<title>' . $pageName . '</title>
</head>
<body>
<div id="wrapper">
<div id="top"><div id="logo"></div></div>
<div id="content">
<h1>UserCake (Via CupCake)</h1>
<h2>Account</h2>
<div id="left-nav">
<?php
include("$baseURL/application/third_party/user_cake/left-nav.php");
?>
</div>
<div id="main">
</div>
<div id="bottom"></div>
</div>
</body>
</html>');
fclose($file);
$newPage = array(str_replace(".php", "", $pageName));
createPages($newPage);
$successes[] = lang("PAGE_CREATED_SUCCESSFULLY", array($baseURL, $pageName));
} else {
if ($pageCheck) {
$errors[] = lang("USER_CREATED_PAGE_EXIST");
} else {
$errors[] = lang("PAGE_VALIDATION_ERROR");
}
}
}
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Page</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='newPage' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n<input type='hidden' name='process' value='1'>\r\n<table class='admin'>\r\n<tr><td>\r\n<h3>Add New Page</h3>\r\n<div id='regbox'>\r\n<p>\r\n<label>New Page Name:</label>\r\n<input type = 'text' name = 'pageName' id = 'pageName'><br/>\r\n(only underscore '_' is allowed as special character.)<br/>\r\n<label>Write your comment:</label><textarea rows = '5' cols = '30' name = 'pageComment' id = 'pageComment'></textarea><br/>\r\n<div>( This is only for documentation purpose. )</div>";
echo "<input type='submit' value='Create' class='submit'/>\r\n</p>\r\n</form>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}
示例5: lang
$errors[] = lang("INVENTAR_EMPTY");
}
}
if (!empty($_POST)) {
$error = implode(",", $errors);
$success = implode(",", $successes);
header('Location:' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '&errors=' . urlencode($error) . '&successes=' . urlencode($success));
die;
}
include "header.php";
echo "\n<div id='content'>\n<h2>Inventarliste for " . utf8_encode($hutName) . " </h2>";
echo "\n<div class='left-navbar' id='left-nav'>";
include "left-nav.php";
echo "\n</div>\n<div class='beside-leftnav' id='main'>";
echo "\n<form name='adminHut' action='" . $_SERVER['PHP_SELF'] . "?id=" . $hutId . "' method='post'>\n<input type='hidden' name='process' value='1'>\n<table class='admin tablestyle'>\n<tr class='tablespacing'><th class='col-md-1'>#</th><th class='col-md-2'><span style='margin-left: 10px;'>Navn</span></th><th class='col-md-6'><span style='margin-left: 13px;'>Antall</span></th></tr>";
//Display list of pages
foreach ($hutDetails as $inventar) {
echo "\n\t<tr class='tablespacing'>\n\t<td>\n\t" . $inventar['inventar_id'] . "\n\t</td>\n\t<td><span style='margin-left: 10px;'>\n\t" . $inventar['navn'] . "</span>\n\t</td>\n\t<td>\n\t";
if ($inventar['navn'] == "vedstatus") {
echo "\n\t\t<div class='form-group'>\n <div class='col-md-3'>\n <div class='input-group'>\n <input id='" . $inventar['inventar_id'] . "' name='" . $inventar['inventar_id'] . "' class='form-control input-md' required='' type='text' value='" . $inventar['antall'] . "'/>\n <span class='input-group-addon'>%</span>\n </div>\n </div>\n</div>";
} else {
echo "\n\t\t<div class='form-group'>\n <div class='col-md-3'>\n <div class='input-group'>\n <input id='" . $inventar['inventar_id'] . "' name='" . $inventar['inventar_id'] . "' class='form-control input-md' required='' type='text' value='" . $inventar['antall'] . "'/>\n <span class='input-group-addon'>stk</span>\n </div>\n </div>\n</div>";
}
echo "\n\t</td>\n\t</tr>";
}
echo "\n<tr class='tablespacing'>\n<td>Legg til:</td>\n<td>\n<div class='form-group'>\n <input id='nyinventar' name='nyinventar' type='text' placeholder='Nytt inventar' class='form-control input-md' />\n</div>\n</td>\n<td>\n<div class='form-group'>\n <div class='col-md-3'>\n <div class='input-group'>\n <input id='nyinventarverdi' name='nyinventarverdi' class='form-control input-md' type='text'/>\n <span class='input-group-addon'>stk</span>\n </div>\n </div>\n</div>\n</td>\n</tr>\n</table>\n<!-- Button -->\n<div class='form-group'>\n <label class='control-label' for='submit'></label>\n <div style='margin-top:1px;'>\n <button id='submit' name='Submit' class='btn btn-default'>Oppdater</button>\n </div>\n</div>";
echo resultBlock($err, $succ);
echo "\n</form>\n</div>\n</div>\n<div id='bottom'></div>\n</div>\n</div>\n</body>\n<script>\ndocument.getElementById('koieinventar').className += 'aktiv';\n</script>\n</html>";
?>
示例6: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
global $baseURL;
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
$permissionId = $_GET['id'];
//Check if selected permission level exists
if (!permissionIdExists($permissionId)) {
header("Location: " . site_url('admin_permissions'));
die;
}
$permissionDetails = fetchPermissionDetails($permissionId);
//Fetch information specific to permission level
//Forms posted
if (!empty($_POST)) {
//Delete selected permission level
if (!empty($_POST['delete'])) {
$deletions = $_POST['delete'];
if ($deletion_count = deletePermission($deletions)) {
$successes[] = lang("PERMISSION_DELETIONS_SUCCESSFUL", array($deletion_count));
header("Location: " . site_url('admin_permissions'));
} else {
$errors[] = lang("SQL_ERROR");
}
} else {
//Update permission level name
if ($permissionDetails[0]['name'] != $_POST['name']) {
$permission = trim($_POST['name']);
//Validate new name
if (permissionNameExists($permission)) {
$errors[] = lang("ACCOUNT_PERMISSIONNAME_IN_USE", array($permission));
} elseif (minMaxRange(1, 50, $permission)) {
$errors[] = lang("ACCOUNT_PERMISSION_CHAR_LIMIT", array(1, 50));
} else {
if (updatePermissionName($permissionId, $permission)) {
$successes[] = lang("PERMISSION_NAME_UPDATE", array($permission));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove access to pages
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($permissionId, $remove)) {
$successes[] = lang("PERMISSION_REMOVE_USERS", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($permissionId, $add)) {
$successes[] = lang("PERMISSION_ADD_USERS", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove access to pages
if (!empty($_POST['removePage'])) {
$remove = $_POST['removePage'];
if ($deletion_count = removePage($remove, $permissionId)) {
$successes[] = lang("PERMISSION_REMOVE_PAGES", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add access to pages
if (!empty($_POST['addPage'])) {
$add = $_POST['addPage'];
if ($addition_count = addPage($add, $permissionId)) {
$successes[] = lang("PERMISSION_ADD_PAGES", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
$permissionDetails = fetchPermissionDetails($permissionId);
}
}
$pagePermissions = fetchPermissionPages($permissionId);
//Retrieve list of accessible pages
$permissionUsers = fetchPermissionUsers($permissionId);
//Retrieve list of users with membership
$userData = fetchAllUsers();
//Fetch all users
$pageData = fetchAllPages();
//Fetch all pages
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Permissions</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminPermission' action='" . $_SERVER['PHP_SELF'] . "?id=" . $permissionId . "' method='post'>\r\n<table class='admin'>\r\n<tr><td>\r\n<h3>Permission Information</h3>\r\n<div id='regbox'>\r\n<p>\r\n<label>ID:</label>\r\n" . $permissionDetails[0]['id'] . "\r\n</p>\r\n<p>\r\n<label>Name:</label>\r\n<input type='text' name='name' value='" . $permissionDetails[0]['name'] . "' />\r\n</p>\r\n<label>Delete:</label>\r\n<input type='checkbox' name='delete[" . $permissionDetails[0]['id'] . "]' id='delete[" . $permissionDetails[0]['id'] . "]' value='" . $permissionDetails[0]['id'] . "'>\r\n</p>\r\n</div></td><td>\r\n<h3>Permission Membership</h3>\r\n<div id='regbox'>\r\n<p>\r\nRemove Members:";
//.........这里部分代码省略.........
示例7: index
//.........这里部分代码省略.........
//Validate email activation selection
if ($newSettings[4] != $emailActivation) {
$newActivation = $newSettings[4];
if ($newActivation != "true" and $newActivation != "false") {
$errors[] = lang("CONFIG_ACTIVATION_TRUE_FALSE");
} else {
if (count($errors) == 0) {
$cfgId[] = 4;
$cfgValue[4] = $newActivation;
$emailActivation = $newActivation;
}
}
}
//Validate new email activation resend threshold
if ($newSettings[5] != $resend_activation_threshold) {
$newResend_activation_threshold = $newSettings[5];
if ($newResend_activation_threshold > 72 or $newResend_activation_threshold < 0) {
$errors[] = lang("CONFIG_ACTIVATION_RESEND_RANGE", array(0, 72));
} else {
if (count($errors) == 0) {
$cfgId[] = 5;
$cfgValue[5] = $newResend_activation_threshold;
$resend_activation_threshold = $newResend_activation_threshold;
}
}
}
//Validate new language selection
if ($newSettings[6] != $language) {
$newLanguage = $newSettings[6];
if (minMaxRange(1, 150, $language)) {
$errors[] = lang("CONFIG_LANGUAGE_CHAR_LIMIT", array(1, 150));
} elseif (!file_exists($baseURL . $newLanguage)) {
$errors[] = lang("CONFIG_LANGUAGE_INVALID", array($newLanguage));
} else {
if (count($errors) == 0) {
$cfgId[] = 6;
$cfgValue[6] = $newLanguage;
$language = $newLanguage;
}
}
}
//Validate new template selection
if ($newSettings[7] != $template) {
$newTemplate = $newSettings[7];
if (minMaxRange(1, 150, $template)) {
$errors[] = lang("CONFIG_TEMPLATE_CHAR_LIMIT", array(1, 150));
} elseif (!file_exists($baseURL . $newTemplate)) {
$errors[] = lang("CONFIG_TEMPLATE_INVALID", array($newTemplate));
} else {
if (count($errors) == 0) {
$cfgId[] = 7;
$cfgValue[7] = $newTemplate;
$template = $newTemplate;
}
}
}
//Update configuration table with new settings
if (count($errors) == 0 and count($cfgId) > 0) {
updateConfig($cfgId, $cfgValue);
$successes[] = lang("CONFIG_UPDATE_SUCCESSFUL");
}
}
$languages = getLanguageFiles();
//Retrieve list of language files
$templates = getTemplateFiles();
//Retrieve list of template files
$permissionData = fetchAllPermissions();
//Retrieve list of all permission levels
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Configuration</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<div id='regbox'>\r\n<form name='adminConfiguration' action='" . $_SERVER['PHP_SELF'] . "' method='post'>\r\n<p>\r\n<label>Website Name:</label>\r\n<input type='text' name='settings[" . $settings['website_name']['id'] . "]' value='" . $websiteName . "' />\r\n</p>\r\n<p>\r\n<label>Website URL:</label>\r\n<input type='text' name='settings[" . $settings['website_url']['id'] . "]' value='" . $websiteUrl . "' />\r\n</p>\r\n<p>\r\n<label>Email:</label>\r\n<input type='text' name='settings[" . $settings['email']['id'] . "]' value='" . $emailAddress . "' />\r\n</p>\r\n<p>\r\n<label>Activation Threshold:</label>\r\n<input type='text' name='settings[" . $settings['resend_activation_threshold']['id'] . "]' value='" . $resend_activation_threshold . "' />\r\n</p>\r\n<p>\r\n<label>Language:</label>\r\n<select name='settings[" . $settings['language']['id'] . "]'>";
//Display language options
foreach ($languages as $optLang) {
if ($optLang == $language) {
echo "<option value='" . $optLang . "' selected>{$optLang}</option>";
} else {
echo "<option value='" . $optLang . "'>{$optLang}</option>";
}
}
echo "\r\n</select>\r\n</p>\r\n<p>\r\n<label>Email Activation:</label>\r\n<select name='settings[" . $settings['activation']['id'] . "]'>";
//Display email activation options
if ($emailActivation == "true") {
echo "\r\n\t<option value='true' selected>True</option>\r\n\t<option value='false'>False</option>\r\n\t</select>";
} else {
echo "\r\n\t<option value='true'>True</option>\r\n\t<option value='false' selected>False</option>\r\n\t</select>";
}
echo "</p>\r\n<p>\r\n<label>Template:</label>\r\n<select name='settings[" . $settings['template']['id'] . "]'>";
//Display template options
foreach ($templates as $temp) {
if ($temp == $template) {
echo "<option value='" . $temp . "' selected>{$temp}</option>";
} else {
echo "<option value='" . $temp . "'>{$temp}</option>";
}
}
echo "\r\n</select>\r\n</p>\r\n<input type='submit' name='Submit' value='Submit' />\r\n</form>\r\n</div>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}
示例8: index
//.........这里部分代码省略.........
}
}
} else {
$displayname = $userdetails['display_name'];
}
//Activate account
if (isset($_POST['activate']) && $_POST['activate'] == "activate") {
if (setUserActive($userdetails['activation_token'])) {
$successes[] = lang("ACCOUNT_MANUALLY_ACTIVATED", array($displayname));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Update email
if ($userdetails['email'] != $_POST['email']) {
$email = trim($_POST["email"]);
//Validate email
if (!isValidEmail($email)) {
$errors[] = lang("ACCOUNT_INVALID_EMAIL");
} elseif (emailExists($email)) {
$errors[] = lang("ACCOUNT_EMAIL_IN_USE", array($email));
} else {
if (updateEmail($userId, $email)) {
$successes[] = lang("ACCOUNT_EMAIL_UPDATED");
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Update title
if ($userdetails['title'] != $_POST['title']) {
$title = trim($_POST['title']);
//Validate title
if (minMaxRange(1, 50, $title)) {
$errors[] = lang("ACCOUNT_TITLE_CHAR_LIMIT", array(1, 50));
} else {
if (updateTitle($userId, $title)) {
$successes[] = lang("ACCOUNT_TITLE_UPDATED", array($displayname, $title));
} else {
$errors[] = lang("SQL_ERROR");
}
}
}
//Remove permission level
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePermission($remove, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_REMOVED", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPermission($add, $userId)) {
$successes[] = lang("ACCOUNT_PERMISSION_ADDED", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
$userdetails = fetchUserDetails(NULL, NULL, $userId);
}
}
$userPermission = fetchUserPermissions($userId);
$permissionData = fetchAllPermissions();
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin User</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminUser' action='" . $_SERVER['PHP_SELF'] . "?id=" . $userId . "' method='post'>\r\n<table class='admin'><tr><td>\r\n<h3>User Information</h3>\r\n<div id='regbox'>\r\n<p>\r\n<label>ID:</label>\r\n" . $userdetails['id'] . "\r\n</p>\r\n<p>\r\n<label>Username:</label>\r\n" . $userdetails['user_name'] . "\r\n</p>\r\n<p>\r\n<label>Display Name:</label>\r\n<input type='text' name='display' value='" . $userdetails['display_name'] . "' />\r\n</p>\r\n<p>\r\n<label>Email:</label>\r\n<input type='text' name='email' value='" . $userdetails['email'] . "' />\r\n</p>\r\n<p>\r\n<label>Active:</label>";
//Display activation link, if account inactive
if ($userdetails['active'] == '1') {
echo "Yes";
} else {
echo "No\r\n\t</p>\r\n\t<p>\r\n\t<label>Activate:</label>\r\n\t<input type='checkbox' name='activate' id='activate' value='activate'>\r\n\t";
}
echo "\r\n</p>\r\n<p>\r\n<label>Title:</label>\r\n<input type='text' name='title' value='" . $userdetails['title'] . "' />\r\n</p>\r\n<p>\r\n<label>Sign Up:</label>\r\n" . date("j M, Y", $userdetails['sign_up_stamp']) . "\r\n</p>\r\n<p>\r\n<label>Last Sign In:</label>";
//Last sign in, interpretation
if ($userdetails['last_sign_in_stamp'] == '0') {
echo "Never";
} else {
echo date("j M, Y", $userdetails['last_sign_in_stamp']);
}
echo "\r\n</p>\r\n<p>\r\n<label>Delete:</label>\r\n<input type='checkbox' name='delete[" . $userdetails['id'] . "]' id='delete[" . $userdetails['id'] . "]' value='" . $userdetails['id'] . "'>\r\n</p>\r\n<p>\r\n<label> </label>\r\n<input type='submit' value='Update' class='submit' />\r\n</p>\r\n</div>\r\n</td>\r\n<td>\r\n<h3>Permission Membership</h3>\r\n<div id='regbox'>\r\n<p>Remove Permission:";
//List of permission levels user is apart of
foreach ($permissionData as $v1) {
if (isset($userPermission[$v1['id']])) {
echo "<br><input type='checkbox' name='removePermission[" . $v1['id'] . "]' id='removePermission[" . $v1['id'] . "]' value='" . $v1['id'] . "'> " . $v1['name'];
}
}
//List of permission levels user is not apart of
echo "</p><p>Add Permission:";
foreach ($permissionData as $v1) {
if (!isset($userPermission[$v1['id']])) {
echo "<br><input type='checkbox' name='addPermission[" . $v1['id'] . "]' id='addPermission[" . $v1['id'] . "]' value='" . $v1['id'] . "'> " . $v1['name'];
}
}
echo "\r\n</p>\r\n</div>\r\n</td>\r\n</tr>\r\n</table>\r\n</form>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}
示例9: index
public function index()
{
/*
UserCake (Via CupCake) Version: 2.0.2
http://usercake.com
*/
global $baseURL;
require_once "{$baseURL}/application/third_party/user_cake/models/config.php";
if (!securePage($_SERVER['PHP_SELF'])) {
die;
}
$pageId = $_GET['id'];
//Check if selected pages exist
if (!pageIdExists($pageId)) {
header("Location: " . str_replace('index.php/', '', site_url('admin_pages')));
die;
}
$pageDetails = fetchPageDetails($pageId);
//Fetch information specific to page
//Forms posted
if (!empty($_POST)) {
$update = 0;
if (!empty($_POST['private'])) {
$private = $_POST['private'];
}
//Toggle private page setting
if (isset($private) and $private == 'Yes') {
if ($pageDetails['private'] == 0) {
if (updatePrivate($pageId, 1)) {
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("private"));
} else {
$errors[] = lang("SQL_ERROR");
}
}
} elseif ($pageDetails['private'] == 1) {
if (updatePrivate($pageId, 0)) {
$successes[] = lang("PAGE_PRIVATE_TOGGLED", array("public"));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Remove permission level(s) access to page
if (!empty($_POST['removePermission'])) {
$remove = $_POST['removePermission'];
if ($deletion_count = removePage($pageId, $remove)) {
$successes[] = lang("PAGE_ACCESS_REMOVED", array($deletion_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
//Add permission level(s) access to page
if (!empty($_POST['addPermission'])) {
$add = $_POST['addPermission'];
if ($addition_count = addPage($pageId, $add)) {
$successes[] = lang("PAGE_ACCESS_ADDED", array($addition_count));
} else {
$errors[] = lang("SQL_ERROR");
}
}
$pageDetails = fetchPageDetails($pageId);
}
$pagePermissions = fetchPagePermissions($pageId);
$permissionData = fetchAllPermissions();
require_once "{$baseURL}/application/third_party/user_cake/models/header.php";
echo "\r\n<body>\r\n<div id='wrapper'>\r\n<div id='top'><div id='logo'></div></div>\r\n<div id='content'>\r\n<h1>UserCake (Via CupCake)</h1>\r\n<h2>Admin Page</h2>\r\n<div id='left-nav'>";
include "{$baseURL}/application/third_party/user_cake/left-nav.php";
echo "\r\n</div>\r\n<div id='main'>";
echo resultBlock($errors, $successes);
echo "\r\n<form name='adminPage' action='" . $_SERVER['PHP_SELF'] . "?id=" . $pageId . "' method='post'>\r\n<input type='hidden' name='process' value='1'>\r\n<table class='admin'>\r\n<tr><td>\r\n<h3>Page Information</h3>\r\n<div id='regbox'>\r\n<p>\r\n<label>ID:</label>\r\n" . $pageDetails['id'] . "\r\n</p>\r\n<p>\r\n<label>Name:</label>\r\n" . $pageDetails['page'] . "\r\n</p>\r\n<p>\r\n<label>Private:</label>";
//Display private checkbox
if ($pageDetails['private'] == 1) {
echo "<input type='checkbox' name='private' id='private' value='Yes' checked>";
} else {
echo "<input type='checkbox' name='private' id='private' value='Yes'>";
}
echo "\r\n</p>\r\n</div></td><td>\r\n<h3>Page Access</h3>\r\n<div id='regbox'>\r\n<p>\r\nRemove Access:";
//Display list of permission levels with access
foreach ($permissionData as $v1) {
if (isset($pagePermissions[$v1['id']])) {
echo "<br><input type='checkbox' name='removePermission[" . $v1['id'] . "]' id='removePermission[" . $v1['id'] . "]' value='" . $v1['id'] . "'> " . $v1['name'];
}
}
echo "\r\n</p><p>Add Access:";
//Display list of permission levels without access
foreach ($permissionData as $v1) {
if (!isset($pagePermissions[$v1['id']])) {
echo "<br><input type='checkbox' name='addPermission[" . $v1['id'] . "]' id='addPermission[" . $v1['id'] . "]' value='" . $v1['id'] . "'> " . $v1['name'];
}
}
echo "\r\n</p>\r\n</div>\r\n</td>\r\n</tr>\r\n</table>\r\n<p>\r\n<label> </label>\r\n<input type='submit' value='Update' class='submit' />\r\n</p>\r\n</form>\r\n</div>\r\n<div id='bottom'></div>\r\n</div>\r\n</body>\r\n</html>";
}