本文整理汇总了PHP中getPostValue函数的典型用法代码示例。如果您正苦于以下问题:PHP getPostValue函数的具体用法?PHP getPostValue怎么用?PHP getPostValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getPostValue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invoke
/**
* Invokes the whole application.
*/
public function invoke()
{
$this->_pageKey = getGetValue('page', 'accounts');
$this->_subKey = getGetValue('sub');
$sessionLang = jpWotSession::get('active_language');
if (empty($sessionLang)) {
jpWotSession::set('active_language', strtolower(trim(jpWotConfig::$lang)));
}
$changeLang = getPostValue('lang');
if (isset($changeLang['current'], $changeLang['new']) && $changeLang['current'] != $changeLang['new']) {
jpWotSession::set('active_language', $changeLang['new']);
$langKey = $changeLang['new'];
} else {
$langKey = jpWotSession::get('active_language');
}
$langKey = $this->getIniLanguageKey($langKey);
$language = jpWotLanguage::getInstance();
$language->load('main', BPATH, $langKey);
$language->load('filter', BPATH, $langKey);
$language->load($this->_pageKey, BPATH, $langKey);
$controller = $this->getControllerInstance();
$page = getPostValue('request');
if (!empty($page)) {
$controller->setRequestData($page);
}
$controller->index();
}
示例2: initialize_page
function initialize_page()
{
$category_id = requestIdParam();
$category = Categories::FindById($category_id);
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if (isset($_POST['delete'])) {
$category->delete(true);
setFlash("<h3>Category Deleted</h3>");
redirect("/admin/list_categories/");
} else {
if ($post_action == "Edit Category" || $post_action == "Edit and Return to List") {
$category->display_name = getPostValue('display_name');
$category->name = slug(getPostValue('display_name'));
$category->content = getPostValue('category_content');
$category->save();
setFlash("<h3>Category Edited</h3>");
if ($post_action == "Edit and Return to List") {
redirect("admin/list_categories/");
}
}
}
}
示例3: getValue
function getValue($name, $format = '', $fatal = false)
{
global $settings;
$val = getPostValue($name);
if (!isset($val)) {
$val = getGetValue($name);
}
// for older PHP versions...
if (!isset($val) && get_magic_quotes_gpc() == 1 && !empty($GLOBALS[$name])) {
$val = $GLOBALS[$name];
}
if (!isset($val)) {
return '';
}
if (!empty($format) && !preg_match('/^' . $format . '$/', $val)) {
// does not match
if ($fatal) {
if ($settings['mode'] == 'dev') {
$error_str = ' "' . $val . '"';
} else {
$error_str = '';
}
die_miserable_death(translate('Fatal Error') . ': ' . translate('Invalid data format for') . ' ' . $name . $error_str);
}
// ignore value
return '';
}
return $val;
}
示例4: initialize_page
function initialize_page()
{
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Add Category" || $post_action == "Add and Return to List") {
$category = MyActiveRecord::Create('Categories');
$category->display_name = getPostValue('display_name');
$category->name = slug(getPostValue('display_name'));
$category->content = getPostValue('category_content');
$category->save();
setFlash("<h3>Category Added</h3>");
if ($post_action == "Add and Return to List") {
redirect("admin/list_categories/");
}
}
}
示例5: getLoginJSONP
function getLoginJSONP($type)
{
require_once "../leader/jsupport.php";
$success = false;
$username = "";
$key = "";
//Ignore any messages from the login system that may corrupt our JSON
ob_start();
if (array_key_exists("username", $_COOKIE) && array_key_exists("key", $_COOKIE)) {
//We may have saved these via javascript. Try loading them
$username = strtolower($_COOKIE["username"]);
$key = $_COOKIE["key"];
$success = true;
} else {
if (checkPostLogin() == 7) {
//Can we log in with leaderboards?
$username = strtolower(getPostValue("username"));
$key = getKey($username);
$success = true;
} else {
//Nope
$success = false;
}
}
ob_end_clean();
//Return their key formatted as specified
if ($success) {
if ($type === "JS") {
return "webchat.setUser(\"{$username}\", \"{$key}\", \"true\"); webchat.connect();";
} else {
if ($type === "JSON") {
return json_encode(array("success" => true, "username" => $username, "key" => $key));
}
}
} else {
if ($type === "JS") {
return "webchat.enableLogin(true); webchat.setLoginStatus(\"No Saved Login Found\");";
} else {
if ($type === "JSON") {
return json_encode(array("success" => false));
}
}
}
}
示例6: header
header('Cache-Control: no-cache');
}
//end function
/*******************************************/
/*** Let's go ***/
/*******************************************/
$id = getIntValue('id', true);
$format = getValue('format');
if ($format != 'ical' && $format != 'vcal' && $format != 'pilot-csv' && $format != 'pilot-text') {
die_miserable_death("Invalid format '" . $format . "'");
}
$use_all_dates = getPostValue('use_all_dates');
if ($use_all_dates != 'y') {
$use_all_dates = '';
}
$include_layers = getPostValue('include_layers');
if ($include_layers != 'y') {
$include_layers = '';
}
$fromyear = getIntValue('fromyear', true);
$frommonth = getIntValue('frommonth', true);
$fromday = getIntValue('fromday', true);
$endyear = getIntValue('endyear', true);
$endmonth = getIntValue('endmonth', true);
$endday = getIntValue('endday', true);
$modyear = getIntValue('modyear', true);
$modmonth = getIntValue('modmonth', true);
$modday = getIntValue('modday', true);
mt_srand((double) microtime() * 1000000);
if (empty($id)) {
$id = "all";
示例7: require_valide_referring_url
// file in ways they shouldn't. Users may try to type in a URL to get around
// functions that are not being displayed on the web page to them.
include_once 'includes/init.php';
require_valide_referring_url();
load_user_layers();
$delete = getPostValue('delete');
$formtype = getPostValue('formtype');
$add = getPostValue('add');
$user = getPostValue('user');
$ufirstname = getPostValue('ufirstname');
$ulastname = getPostValue('ulastname');
$uemail = getPostValue('uemail');
$upassword1 = getPostValue('upassword1');
$upassword2 = getPostValue('upassword2');
$uis_admin = getPostValue('uis_admin');
$uenabled = getPostValue('uenabled');
$error = '';
if (!$is_admin) {
$user = $login;
}
$deleteStr = translate('Deleting users not supported.');
$notIdenticalStr = translate('The passwords were not identical.');
$noPasswordStr = translate('You have not entered a password.');
$blankUserStr = translate('Username cannot be blank.');
// Don't let them edit users if they'e not authorized.
if (empty($user)) {
// Asking to create a new user. Must be admin...
if (!$is_admin && !access_can_access_function(ACCESS_USER_MANAGEMENT)) {
send_to_preferred_view();
}
if (!$admin_can_add_user) {
示例8: set_env
$GLOBALS['CELLBG'] = $prefarray['CELLBG'];
$GLOBALS['WEEKENDBG'] = $prefarray['WEEKENDBG'];
$GLOBALS['OTHERMONTHBG'] = $prefarray['OTHERMONTHBG'];
$GLOBALS['FONTS'] = $prefarray['FONTS'];
$GLOBALS['MYEVENTS'] = $prefarray['MYEVENTS'];
//determine if we can set timezones, if not don't display any options
$can_set_timezone = set_env('TZ', $prefarray['TIMEZONE']);
$dateYmd = date('Ymd');
$selected = ' selected="selected" ';
$minutesStr = translate('minutes');
//allow css_cache to display public or NUC values
@session_start();
$_SESSION['webcal_tmp_login'] = $prefuser;
//Prh ... add user to edit_template to get/set correct template
$openStr = "\"window.open( 'edit_template.php?type=%s&user=%s','cal_template','dependent,menubar,scrollbars,height=500,width=500,outerHeight=520,outerWidth=520' );\"";
$currenttab = getPostValue('currenttab', 'settings');
$currenttab = !empty($currenttab) ? $currenttab : 'settings';
$BodyX = 'onload="altrows(); showTab( \'' . $currenttab . '\' );"';
$INC = array('js/visible.php', 'js/pref.php');
print_header($INC, '', $BodyX);
?>
<h2><?php
if ($updating_public) {
echo translate($PUBLIC_ACCESS_FULLNAME) . ' ';
}
etranslate('Preferences');
if ($is_nonuser_admin || $is_admin && substr($prefuser, 0, 5) == '_NUC_') {
nonuser_load_variables($user, 'nonuser');
echo '<br /><strong>-- ' . translate('Admin mode') . ': ' . $nonuserfullname . " --</strong>\n";
}
示例9: initialize_page
function initialize_page()
{
$event_types = EventTypes::FindAll();
$event_periods = EventPeriods::FindAll();
$post_action = "";
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
if ($post_action == "Add Event and add another" || $post_action == "Add and Return to List") {
$event = MyActiveRecord::Create('Events', $_POST);
if (!getPostValue('time_start')) {
$event->setDateStart(getPostValue('date_start'), "04:00:00");
} else {
$event->time_start = date("H:i:s", strtotime(getPostValue('time_start')));
}
if (!getPostValue('date_end') && !getPostValue('time_end')) {
$event->setDateEnd(getPostValue('date_start'), "04:00:00");
} else {
if (!getPostValue('date_end') && getPostValue('time_end')) {
$event->setDateEnd(getPostValue('date_start'), date("H:i:s", strtotime(getPostValue('time_end'))));
} else {
$event->setDateEnd(getPostValue('date_end'), date("H:i:s", strtotime(getPostValue('time_end'))));
}
}
$event->eventtype_id = isset($_POST['eventtype_id']) ? $_POST['eventtype_id'] : 1;
$event->eventperiod_id = $_POST['eventperiod_id'];
$event->save();
$notdates = getPostValue('notdates');
if (is_array($notdates)) {
foreach ($notdates as $date) {
if (strlen($date) > 4) {
$query = "INSERT INTO events_notdate VALUES('{$event->id}','" . formatDateView($date, "Y-m-d") . "')";
mysql_query($query, MyActiveRecord::Connection()) or die($query);
}
}
}
add_eventUpdateRecurrences($event);
$thisnewevent = Events::FindById($event->id);
if ($thisnewevent->date_end < $thisnewevent->date_start) {
setFlash("<h3>Whoops! Event Starts after it Ends! Please correct dates...</h3>");
$eventyear = parseDate($thisnewevent->date_start, "Y");
$eventmonth = parseDate($thisnewevent->date_start, "n");
redirect("/admin/edit_event/{$eventyear}/{$eventmonth}/{$thisnewevent->id}");
} else {
setFlash("<h3>Event added</h3>");
if ($post_action == "Add and Return to List") {
// Redirect user to the Main Event List
$datestart = explode("/", getPostValue('date_start'));
setFlash("<h3>Event added</h3>");
redirect("/admin/list_events/{$datestart['2']}/{$datestart['0']}");
}
}
}
}
}
示例10: Category
<?php
// Include common functions and declarations
require_once "../../include/common.php";
// Get category id
$category = new Category(getGetValue("categoryId"));
// Check if user has edit permission
if (!$category->hasEditPermission()) {
$login->printLoginForm();
exit;
}
// Delete entries
$deleteReferences = getPostValue("deleteReferences");
if (!empty($deleteReferences)) {
$references = getPostValue("references");
for ($i = 0; $i < sizeof($references); $i++) {
$dbi->query("DELETE FROM `" . categoryContentRefTableName . "` WHERE id=" . $dbi->quote($references[$i]));
}
// Redirect to category index
redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderCategory . "/" . fileCategoryIndex);
}
// Validate page
$page = !empty($_GET["page"]) ? $_GET["page"] - 1 : 0;
// Generate navigation
$site->addNavigationLink(scriptUrl . "/" . folderAdmin, $lAdminIndex["Header"]);
$site->addNavigationLink(scriptUrl . "/" . folderCategory, $lAdminIndex["Categories"]);
$site->addNavigationLink(scriptUrl . "/" . folderCategory . "/" . fileCategory . "?categoryId=" . $category->id, $category->title);
// Print common header
$site->printHeader();
// Print section header
printf("<p>" . $lCategory["HeaderText"] . "</p>", $category->title);
示例11: getValue
function getValue($name, $format = "", $fatal = false)
{
$val = getPostValue($name);
if (!isset($val)) {
$val = getGetValue($name);
}
// for older PHP versions...
if (!isset($val) && get_magic_quotes_gpc() == 1 && !empty($GLOBALS[$name])) {
$val = $GLOBALS[$name];
}
if (!isset($val)) {
return "";
}
if (!empty($format) && !preg_match("/^" . $format . "\$/", $val)) {
// does not match
if ($fatal) {
echo "Fatal Error: Invalid data format for {$name}\n";
exit;
}
// ignore value
return "";
}
return $val;
}
示例12: redirect
$comment->deleteComment($commentType > 0 ? true : false);
}
}
// Redirect
redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderComment . "/" . folderCommentIndex);
}
// Delete spam comments
$deleteSpamComments = getPostValue("deleteSpamComments");
if (!empty($deleteSpamComments)) {
$comment = new Comment();
$comment->deleteSpamComments();
// Redirect
redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderComment . "/" . folderCommentIndex);
}
// Delete trash comments
$deleteTrashComments = getPostValue("deleteTrashComments");
if (!empty($deleteTrashComments)) {
$comment = new Comment();
$comment->deleteTrashComments();
// Redirect
redirect(!empty($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : scriptUrl . "/" . folderComment . "/" . folderCommentIndex);
}
// Mark comments as spam or not spam
$spam = getValue("spam");
$notSpam = getValue("notSpam");
if (!empty($spam) || !empty($notSpam)) {
$comments = getValue("comments");
if (!empty($comments)) {
for ($i = 0; $i < sizeof($comments); $i++) {
$comment = new Comment($comments[$i]);
$comment->setSpamStatus(!empty($spam) ? 1 : 0);
示例13: validate
/**
* Examines the posted fields, defines $this->_ValidationFields, and enforces the $this->Rules collection on them.
*
* @param array $PostedFields An associative array of posted fields to be validated.
* @param boolean $Insert A boolean value indicating if the posted fields are to be inserted or
* updated. If being inserted, the schema's required field rules will be enforced.
* @return boolean Whether or not the validation was successful.
*/
public function validate($PostedFields, $Insert = false)
{
// Create an array to hold validation result messages
if (!is_array($this->_ValidationResults) || $this->resetOnValidate()) {
$this->_ValidationResults = array();
}
// Check for a honeypot (anti-spam input)
$HoneypotName = C('Garden.Forms.HoneypotName', '');
$HoneypotContents = getPostValue($HoneypotName, '');
if ($HoneypotContents != '') {
$this->addValidationResult($HoneypotName, "You've filled our honeypot! We use honeypots to help prevent spam. If you're not a spammer or a bot, you should contact the application administrator for help.");
}
$FieldRules = $this->defineValidationRules($PostedFields, $Insert);
$Fields = $this->defineValidationFields($PostedFields, $Insert);
// Loop through the fields that should be validated
foreach ($Fields as $FieldName => $FieldValue) {
// If this field has rules to be enforced...
if (array_key_exists($FieldName, $FieldRules) && is_array($FieldRules[$FieldName])) {
// Enforce them.
$Rules = $FieldRules[$FieldName];
// Get the field info for the field.
$FieldInfo = array('Name' => $FieldName);
if (is_array($this->_Schema) && array_key_exists($FieldName, $this->_Schema)) {
$FieldInfo = array_merge($FieldInfo, (array) $this->_Schema[$FieldName]);
}
$FieldInfo = (object) $FieldInfo;
foreach ($Rules as $RuleName) {
if (array_key_exists($RuleName, $this->_Rules)) {
$Rule = $this->_Rules[$RuleName];
// echo '<div>FieldName: '.$FieldName.'; Rule: '.$Rule.'</div>';
if (substr($Rule, 0, 9) == 'function:') {
$Function = substr($Rule, 9);
if (!function_exists($Function)) {
trigger_error(errorMessage('Specified validation function could not be found.', 'Validation', 'Validate', $Function), E_USER_ERROR);
}
$ValidationResult = $Function($FieldValue, $FieldInfo, $PostedFields);
if ($ValidationResult !== true) {
// If $ValidationResult is not FALSE, assume it is an error message
$ErrorCode = $ValidationResult === false ? $Function : $ValidationResult;
// If there is a custom error, use it above all else
$ErrorCode = val($FieldName . '.' . $RuleName, $this->_CustomErrors, $ErrorCode);
// Add the result
$this->addValidationResult($FieldName, $ErrorCode);
// Only add one error per field
}
} elseif (substr($Rule, 0, 6) == 'regex:') {
$Regex = substr($Rule, 6);
if (ValidateRegex($FieldValue, $Regex) !== true) {
$ErrorCode = 'Regex';
// If there is a custom error, use it above all else
$ErrorCode = val($FieldName . '.' . $RuleName, $this->_CustomErrors, $ErrorCode);
// Add the result
$this->addValidationResult($FieldName, $ErrorCode);
}
}
}
}
}
}
$this->_ValidationFields = $Fields;
return count($this->_ValidationResults) === 0;
}
示例14: initialize_page
function initialize_page()
{
$post_action = $success = "";
$gallery = Galleries::FindById(requestIdParam());
if (isset($_POST['submit'])) {
$post_action = $_POST['submit'];
}
if ($post_action == "Edit Gallery" || $post_action == "Edit and Return to List" || $post_action == "Add Image to Gallery") {
if (isset($_POST['delete'])) {
$photos = $gallery->get_photos();
if (count($photos) > 0) {
$success .= "Photos deleted / ";
}
foreach ($photos as $thephoto) {
$thephoto->delete(true);
}
$gallery->delete(true);
$success .= "Gallery deleted / ";
setFlash("<h3>" . substr($success, 0, -3) . "</h3>");
redirect("/admin/list_galleries");
} else {
// Name has changed.
if ($gallery->name != $_POST['name']) {
$gallery->name = $_POST['name'];
$gallery->slug = slug($_POST['name']);
$gallery->save();
$success .= "Gallery name saved / ";
}
// Update captions if they are different.
if (isset($_POST['captions'])) {
$captions = $_POST['captions'];
foreach ($captions as $key => $thecaption) {
$photo = Photos::FindById($key);
if ($photo->caption != $thecaption) {
$photo->caption = $thecaption;
$photo->save();
}
}
//$success .= "Captions edited / ";
}
// Reset the display order if the photos have been moved.
if (isset($_POST['photos_display_order'])) {
$display_orders = $_POST['photos_display_order'];
foreach ($display_orders as $key => $display_order) {
$photo = Photos::FindById($key);
if ($photo->display_order != $display_order) {
$photo->display_order = $display_order;
$photo->save();
}
}
//$success .= "Photo order saved / ";
}
// Upload and save a new file.
if (isset($_FILES['new_photo']) && $_FILES['new_photo']['error'] == 0) {
// Updating the record to include the filename stopped working in photos > save_uploaded_file Jan 2013
$photo = MyActiveRecord::Create('Photos', array('caption' => getPostValue("new_photo_caption"), 'gallery_id' => $gallery->id, 'display_order' => 1));
$photo->save();
$photo->save_uploaded_file($_FILES['new_photo']['tmp_name'], $_FILES['new_photo']['name']);
$photo->setDisplayOrder();
$success .= "New photo added / ";
} else {
// from http://php.net/manual/en/features.file-upload.errors.php
$upload_errors = array("0. UPLOAD_ERR_OK: No errors.", "1. UPLOAD_ERR_INI_SIZE: Larger than upload_max_filesize.", "2. UPLOAD_ERR_FORM_SIZE: Larger than form MAX_FILE_SIZE.", "3. UPLOAD_ERR_PARTIAL: Partial upload.", "4. UPLOAD_ERR_NO_FILE: No file.", "6. UPLOAD_ERR_NO_TMP_DIR: No temporary directory.", "7. UPLOAD_ERR_CANT_WRITE: Can't write to disk.", "8. UPLOAD_ERR_EXTENSION: File upload stopped by extension.", "UPLOAD_ERR_EMPTY: File is empty.");
$err_num = $_FILES['new_photo']['error'];
if ($err_num != 4) {
echo "Upload Error! " . $upload_errors[$err_num];
}
}
// Delete photos that were checked off to be removed
if (isset($_POST['deleted_photos'])) {
$deleted_ids = $_POST['deleted_photos'];
foreach ($deleted_ids as $status => $photo_id) {
$photo = Photos::FindById($photo_id);
$photo->delete(true);
}
$success .= "Photo deleted / ";
}
setFlash("<h3>" . substr($success, 0, -3) . "</h3>");
if ($post_action == "Edit and Return to List") {
redirect("admin/list_galleries");
}
}
}
}
示例15: getGetValue
<?php
// Include common functions and declarations
require_once "include/common.php";
// Add navigation link
$site->addNavigationLink(scriptUrl . "/" . fileProfileForgotPassword, $lForgotPassword["Header"]);
// Print header
$site->printHeader();
echo '<p>' . $lForgotPassword["HeaderText"] . '</p>';
// Get values
$send = getGetValue("send");
$username = getPostValue("username");
$email = getPostValue("email");
$id = getGetValue("id");
$key = getGetValue("key");
$success = getGetValue("success");
if (!empty($id) && !empty($key)) {
$user = new User($id);
if (!empty($user->id)) {
// Check if key matches key in database
$result = $dbi->query("SELECT username,activationKey FROM " . userTableName . " WHERE id=" . $dbi->quote($user->id));
if ($result->rows()) {
list($username, $activationKey) = $result->fetchrow_array();
if ($key == $activationKey) {
// Include password form
$forgotPassword = 1;
include scriptPath . '/' . folderUsers . '/include/form/userPasswordForm.php';
} else {
echo '<p>' . $lForgotPassword["InvalidKey"] . '</p>';
}
}