本文整理汇总了PHP中Kit::Redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Kit::Redirect方法的具体用法?PHP Kit::Redirect怎么用?PHP Kit::Redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kit
的用法示例。
在下文中一共展示了Kit::Redirect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_array
$value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
return $value;
}
$_POST = array_map('stripslashes_deep', $_POST);
$_GET = array_map('stripslashes_deep', $_GET);
$_COOKIE = array_map('stripslashes_deep', $_COOKIE);
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
/*
* Before we do anything else, lets check to see if we have a settings.php file
* Without that file we can deduce that
* a) This is a first time install
* b) This is a corrupt or failed install
*/
if (!file_exists("settings.php")) {
Kit::Redirect("install.php");
die;
}
// parse and init the settings.php
Config::Load();
// Test our DB connection through PDO
try {
PDOConnect::init();
} catch (PDOException $e) {
die('Database connection problem.');
}
// create a database class instance (legacy)
$db = new database();
if (!$db->connect_db($dbhost, $dbuser, $dbpass)) {
die('Database connection problem.');
}
示例2: database
require_once "lib/data/display.data.class.php";
// Required Config Files
require_once "config/config.class.php";
require_once "config/db_config.php";
/*
* Before we do anything else, lets check to see if we have a settings.php file
* Without that file we can deduce that
* a) This is a first time install
* b) This is a corrupt or failed install
*/
if (!file_exists("settings.php")) {
Kit::Redirect("install.php");
die;
}
if (file_exists("upgrade.php")) {
Kit::Redirect("upgrade.php");
die;
}
// parse and init the settings.php
Config::Load();
// create a database class instance
$db = new database();
if (!$db->connect_db($dbhost, $dbuser, $dbpass)) {
die('Xibo has a database connection problem.');
}
if (!$db->select_db($dbname)) {
die('Xibo has a database connection problem.');
}
date_default_timezone_set(Config::GetSetting("defaultTimezone"));
// Error Handling (our error handler requires a DB connection
set_error_handler(array(new Debug(), "ErrorHandler"));
示例3: Respond
/**
* Outputs the Response to the browser
* @return
*/
public function Respond()
{
// Roll back any open transactions if we are in an error state
try {
$dbh = PDOConnect::init();
if (!$this->success) {
$dbh->rollBack();
} else {
$dbh->commit();
}
} catch (Exception $e) {
Debug::LogEntry('audit', 'Unable to commit/rollBack');
}
if ($this->ajax) {
// Construct the Response
$response = array();
// General
$response['html'] = $this->html;
$response['buttons'] = $this->buttons;
$response['fieldActions'] = $this->fieldActions;
$response['uniqueReference'] = $this->uniqueReference;
$response['success'] = $this->success;
$response['callBack'] = $this->callBack;
$response['message'] = $this->message;
$response['clockUpdate'] = $this->clockUpdate;
// Grids
$response['sortable'] = $this->sortable;
$response['sortingDiv'] = $this->sortingDiv;
$response['paging'] = $this->paging;
$response['pageSize'] = $this->pageSize;
$response['pageNumber'] = $this->pageNumber;
$response['initialSortColumn'] = $this->initialSortColumn - 1;
$response['initialSortOrder'] = $this->initialSortOrder - 1;
// Dialogs
$response['dialogSize'] = $this->dialogSize;
$response['dialogWidth'] = $this->dialogWidth;
$response['dialogHeight'] = $this->dialogHeight;
$response['dialogTitle'] = $this->dialogTitle;
$response['dialogClass'] = $this->dialogClass;
// Tweak the width and height
$response['dialogWidth'] = (int) str_replace('px', '', $response['dialogWidth']);
$response['dialogHeight'] = (int) str_replace('px', '', $response['dialogHeight']);
// Form Submits
$response['keepOpen'] = $this->keepOpen;
$response['hideMessage'] = $this->hideMessage;
$response['loadForm'] = $this->loadForm;
$response['loadFormUri'] = $this->loadFormUri;
$response['refresh'] = $this->refresh;
$response['refreshLocation'] = $this->refreshLocation;
$response['focusInFirstInput'] = $this->focusInFirstInput;
$response['modal'] = $this->modal;
$response['nextToken'] = $this->nextToken;
// Login
$response['login'] = $this->login;
// Extra
$response['extra'] = $this->extra;
// Clear the object buffer, and if it isn't empty error with the contents.
$buffer = ob_get_clean();
if ($buffer != '') {
trigger_error($buffer, E_USER_ERROR);
}
echo json_encode($response);
// End the execution
die;
} else {
// If the response does not equal success then output an error
if (!$this->success) {
// Store the message
$_SESSION['ErrorMessage'] = $this->message;
// Redirect to the following
$url = 'index.php?p=error';
} else {
// Have we been asked to refresh?
$url = $this->refresh ? $this->refreshLocation : 'index.php?p=' . Kit::GetParam('p', _GET, _WORD, 'index');
}
// Redirect and end execution
Kit::Redirect($url);
}
return;
}
示例4: Render
/**
* Renders this page
* @return
*/
public function Render()
{
$db =& $this->db;
$user =& $this->user;
if (!$this->authed) {
throw new Exception(__('You do not have permission to access this page.'));
}
// Check the requested pages exits before trying to load it
// this check should be redundant, because the page should have been validated against the pages in the DB first.
// do it just in case...
if (!file_exists($this->path)) {
throw new Exception(__('The requested page does not exist'));
}
// Load the file in question
if (!class_exists($this->page)) {
require_once $this->path;
}
// Create the requested page
$this->thePage = new $this->page($db, $user);
// Are we calling a method
if ($this->q != '') {
// Check the method exists
if (method_exists($this->thePage, $this->q)) {
// Call the method
$function = $this->q;
$reloadLocation = $this->thePage->{$function}();
} else {
trigger_error($this->p . ' does not support the function: ' . $this->q, E_USER_ERROR);
}
if ($this->ajax) {
exit;
}
// once we have dealt with it, reload the page
Kit::Redirect($reloadLocation);
} else {
// Display a page instead
Theme::Render('header');
$this->thePage->displayPage();
Theme::Render('footer');
}
// Clear the session message
$_SESSION['message'] = '';
}
示例5: MenuItemSecurityAssign
/**
* Menu Item Security Assignment to Groups
* @return
*/
function MenuItemSecurityAssign()
{
// Check the token
if (!Kit::CheckToken()) {
trigger_error('Token does not match', E_USER_ERROR);
}
$db =& $this->db;
$groupid = Kit::GetParam('groupid', _POST, _INT);
$pageids = $_POST['pageids'];
foreach ($pageids as $menuItemId) {
$row = explode(",", $menuItemId);
$menuItemId = $row[1];
// If the ID is 0 then this menu item is not currently assigned
if ($row[0] == "0") {
//it isnt assigned and we should assign it
$SQL = sprintf("INSERT INTO lkmenuitemgroup (GroupID, MenuItemID) VALUES (%d, %d)", $groupid, $menuItemId);
if (!$db->query($SQL)) {
trigger_error($db->error());
Kit::Redirect(array('success' => false, 'message' => __('Can\'t assign this menu item to this group')));
}
} else {
//it is already assigned and we should remove it
$SQL = sprintf("DELETE FROM lkmenuitemgroup WHERE groupid = %d AND MenuItemID = %d", $groupid, $menuItemId);
if (!$db->query($SQL)) {
trigger_error($db->error());
Kit::Redirect(array('success' => false, 'message' => __('Can\'t remove this menu item from this group')));
}
}
}
// Response
$response = new ResponseManager();
$response->SetFormSubmitResponse(__('User Group Menu Security Edited'));
$response->keepOpen = true;
$response->Respond();
}