本文整理汇总了PHP中Kit::GetParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Kit::GetParam方法的具体用法?PHP Kit::GetParam怎么用?PHP Kit::GetParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kit
的用法示例。
在下文中一共展示了Kit::GetParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(database $db, User $user, $menu)
{
$this->db =& $db;
$this->user =& $user;
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
$this->q = Kit::GetParam('q', _REQUEST, _WORD);
$this->userid = Kit::GetParam('userid', _SESSION, _INT);
$usertypeid = Kit::GetParam('usertype', _SESSION, _INT);
if ($menu == '') {
$this->message = __('No menu provided');
return false;
}
if (!($this->theMenu = $user->MenuAuth($menu))) {
$this->message = __('No permissions for this menu.');
return false;
}
// Set some information about this menu
$this->current = 0;
$this->numberItems = count($this->theMenu);
// We dont want to do 0 items
if ($this->numberItems == 0) {
$this->numberItems = -1;
}
$this->message = $this->numberItems . ' menu items loaded';
return true;
}
示例2: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
// Include the layout data class
include_once "lib/data/layout.data.class.php";
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$this->auth = $user->LayoutAuth($this->layoutid, true);
if (!$this->auth->view) {
trigger_error(__("You do not have permissions to view this layout"), E_USER_ERROR);
}
$sql = " SELECT layout, description, userid, retired, tags, xml FROM layout ";
$sql .= sprintf(" WHERE layoutID = %d ", $this->layoutid);
if (!($results = $db->query($sql))) {
trigger_error($db->error());
trigger_error(__("Cannot retrieve the Information relating to this layout. The layout may be corrupt."), E_USER_ERROR);
}
if ($db->num_rows($results) == 0) {
$this->has_permissions = false;
}
while ($aRow = $db->get_row($results)) {
$this->layout = Kit::ValidateParam($aRow[0], _STRING);
$this->description = Kit::ValidateParam($aRow[1], _STRING);
$this->retired = Kit::ValidateParam($aRow[3], _INT);
$this->tags = Kit::ValidateParam($aRow[4], _STRING);
$this->xml = $aRow[5];
}
}
}
示例3: __construct
public function __construct()
{
// Determine if this is an AJAX call or not
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
// Assume success
$this->success = true;
$this->clockUpdate = false;
$this->focusInFirstInput = true;
$this->appendHiddenSubmit = true;
$this->uniqueReference = '';
$this->buttons = '';
$this->pageSize = 10;
$this->pageNumber = 0;
$this->initialSortColumn = 1;
$this->initialSortOrder = 1;
$this->modal = false;
$this->extra = array();
$this->dialogClass = '';
// Start a DB transaction for all returns from the Web Portal
try {
$dbh = PDOConnect::init();
if (!$dbh->inTransaction()) {
$dbh->beginTransaction();
}
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
trigger_error(__('Unable to open connection and start transaction'), E_USER_ERROR);
}
return true;
}
示例4: handle_form_data
protected function handle_form_data($file, $index)
{
// Handle form data, e.g. $_REQUEST['description'][$index]
// Link the file to the module
$name = $_REQUEST['name'][$index];
$duration = $_REQUEST['duration'][$index];
$layoutId = Kit::GetParam('layoutid', _REQUEST, _INT);
$type = Kit::GetParam('type', _REQUEST, _WORD);
Debug::LogEntry('audit', 'Upload complete for Type: ' . $type . ' and file name: ' . $file->name . '. Name: ' . $name . '. Duration:' . $duration);
// We want to create a module for each of the uploaded files.
// Do not pass in the region ID so that we only assign to the library and not to the layout
try {
$module = ModuleFactory::createForLibrary($type, $layoutId, $this->options['db'], $this->options['user']);
} catch (Exception $e) {
$file->error = $e->getMessage();
exit;
}
// We want to add this item to our library
if (!($storedAs = $module->AddLibraryMedia($file->name, $name, $duration, $file->name))) {
$file->error = $module->GetErrorMessage();
}
// Set new file details
$file->storedas = $storedAs;
// Delete the file
@unlink($this->get_upload_path($file->name));
}
示例5: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
Theme::Set('ErrorMessage', $error);
Theme::Render('error');
}
示例6: displayPage
function displayPage()
{
$db =& $this->db;
$user =& $this->user;
$error = Kit::GetParam('ErrorMessage', _SESSION, _HTMLSTRING, __('Unknown Error'));
echo __('There has been an application error.');
echo $error;
exit;
}
示例7: modify
function modify()
{
$db =& $this->db;
// Check the token
if (!Kit::CheckToken()) {
trigger_error('Token does not match', E_USER_ERROR);
}
$refer = Kit::GetParam('refer', _POST, _STRING);
$usertype = Kit::GetParam('usertype', _SESSION, _INT);
$ids = Kit::GetParam('id', _POST, _ARRAY);
$values = Kit::GetParam('value', _POST, _ARRAY);
$size = count($ids);
if ($usertype != 1) {
setMessage(__("Only admin users are allowed to modify settings"));
return $refer;
}
// Get the SettingId for LIBRARY_LOCATION
$SQL = sprintf("SELECT settingid FROM setting WHERE setting = '%s'", 'LIBRARY_LOCATION');
if (!($result = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
if ($db->num_rows($result) == 0) {
trigger_error(__('Cannot find the Library Location Setting - this is serious.'), E_USER_ERROR);
}
$row = $db->get_row($result);
$librarySettingId = $row[0];
// Loop through and modify the settings
for ($i = 0; $i < $size; $i++) {
$value = Kit::ValidateParam($values[$i], _STRING);
$id = $ids[$i];
// Is this the library location setting
if ($id == $librarySettingId) {
// Check for a trailing slash and add it if its not there
$value = rtrim($value, '/') . '/';
// Attempt to add the directory specified
if (!file_exists($value . 'temp')) {
// Make the directory with broad permissions recursively (so will add the whole path)
mkdir($value . 'temp', 0777, true);
}
if (!is_writable($value . 'temp')) {
trigger_error(__('The Library Location you have picked is not writable'), E_USER_ERROR);
}
}
$SQL = sprintf("UPDATE setting SET value = '%s' WHERE settingid = %d ", $db->escape_string($value), $id);
if (!$db->query($SQL)) {
trigger_error($db->error());
trigger_error(__('Update of settings failed.'), E_USER_ERROR);
}
}
$response = new ResponseManager();
$response->SetFormSubmitResponse(__('Settings Updated'), false);
$response->Respond();
}
示例8: InitLocale
/**
* Gets and Sets the Local
* @return
*/
public static function InitLocale()
{
$localeDir = 'locale';
$default = Config::GetSetting('DEFAULT_LANGUAGE');
global $transEngine;
global $stream;
//Debug::LogEntry('audit', 'IN', 'TranslationEngine', 'InitLocal');
// Try to get the local firstly from _REQUEST (post then get)
$lang = Kit::GetParam('lang', _REQUEST, _WORD, '');
// Build an array of supported languages
$supportedLangs = scandir($localeDir);
if ($lang != '') {
// Set the language
Debug::LogEntry('audit', 'Set the Language from REQUEST [' . $lang . ']', 'TranslationEngine', 'InitLocal');
// Is this language supported?
// if not just use the default (eb_GB).
if (!in_array($lang . '.mo', $supportedLangs)) {
trigger_error(sprintf('Language not supported. %s', $lang));
// Use the default language instead.
$lang = $default;
}
} else {
$langs = Kit::GetParam('HTTP_ACCEPT_LANGUAGE', $_SERVER, _STRING);
if ($langs != '') {
//Debug::LogEntry('audit', ' HTTP_ACCEPT_LANGUAGE [' . $langs . ']', 'TranslationEngine', 'InitLocal');
$langs = explode(',', $langs);
foreach ($langs as $lang) {
// Remove any quality rating (as we aren't interested)
$rawLang = explode(';', $lang);
$lang = str_replace("-", "_", $rawLang[0]);
if (in_array($lang . '.mo', $supportedLangs)) {
//Debug::LogEntry('audit', 'Obtained the Language from HTTP_ACCEPT_LANGUAGE [' . $lang . ']', 'TranslationEngine', 'InitLocal');
break;
}
// Set lang as the default
$lang = $default;
}
} else {
$lang = $default;
}
}
// We have the language
//Debug::LogEntry('audit', 'Creating new file streamer for '. $localeDir . '/' . $lang . '.mo', 'TranslationEngine', 'InitLocal');
if (!($stream = new CachedFileReader($localeDir . '/' . $lang . '.mo'))) {
trigger_error('Unable to translate this language');
$transEngine = false;
return;
}
$transEngine = new gettext_reader($stream);
}
示例9: audit
/**
* Audit Log
* @param string $entity
* @param int $entityId
* @param string $message
* @param string|object|array $object
*/
public static function audit($entity, $entityId, $message, $object)
{
\Debug::Audit(sprintf('Audit Trail message recorded for %s with id %d. Message: %s', $entity, $entityId, $message));
if (self::$_auditLogStatement == null) {
$dbh = \PDOConnect::newConnection();
self::$_auditLogStatement = $dbh->prepare('
INSERT INTO `auditlog` (logDate, userId, entity, message, entityId, objectAfter)
VALUES (:logDate, :userId, :entity, :message, :entityId, :objectAfter)
');
}
// If we aren't a string then encode
if (!is_string($object)) {
$object = json_encode($object);
}
self::$_auditLogStatement->execute(array('logDate' => time(), 'userId' => \Kit::GetParam('userid', _SESSION, _INT, 0), 'entity' => $entity, 'message' => $message, 'entityId' => $entityId, 'objectAfter' => $object));
}
示例10: __construct
function __construct(database $db, user $user, $page)
{
$this->db =& $db;
$this->user =& $user;
$this->path = 'lib/pages/' . $page . '.class.php';
$this->page = $page . 'DAO';
$this->p = $page;
$this->ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
$this->q = Kit::GetParam('q', _REQUEST, _WORD);
$this->userid = $this->user->userid;
// Default not authorised
$this->authed = false;
// Create a theme
new Theme($db, $user);
Theme::SetPagename($this->p);
}
示例11: Redirect
static function Redirect($page, $message = '', $pageIsUrl = false)
{
$url = $page;
$ajax = Kit::GetParam('ajax', _REQUEST, _BOOL, false);
if ($ajax) {
echo json_encode($page);
die;
}
// Header or JS redirect
if (headers_sent()) {
echo "<script>document.location.href='{$url}';</script>\n";
} else {
header('Location: ' . $url);
}
die;
}
示例12: Link
/**
* Outputs a help link
* @return
* @param $topic Object[optional]
* @param $category Object[optional]
*/
public static function Link($topic = "", $category = "General")
{
// if topic is empty use the page name
$topic = $topic == '' ? Kit::GetParam('p', _REQUEST, _WORD) : $topic;
$topic = ucfirst($topic);
// Get the link
try {
$dbh = PDOConnect::init();
$sth = $dbh->prepare('SELECT Link FROM help WHERE Topic = :topic and Category = :cat');
$sth->execute(array('topic' => $topic, 'cat' => $category));
if (!($link = $sth->fetchColumn(0))) {
$sth->execute(array('topic' => $topic, 'cat' => 'General'));
$link = $sth->fetchColumn(0);
}
return Config::GetSetting('HELP_BASE') . $link;
} catch (Exception $e) {
return false;
}
}
示例13: __construct
function __construct(database $db, user $user)
{
$this->db =& $db;
$this->user =& $user;
$this->layoutid = Kit::GetParam('layoutid', _REQUEST, _INT);
//if we have modify selected then we need to get some info
if ($this->layoutid != '') {
// get the permissions
Debug::LogEntry('audit', 'Loading permissions for layoutid ' . $this->layoutid);
$layout = $this->user->LayoutList(NULL, array('layoutId' => $this->layoutid));
if (count($layout) <= 0) {
trigger_error(__('You do not have permissions to view this layout'), E_USER_ERROR);
}
$layout = $layout[0];
$this->layout = $layout['layout'];
$this->description = $layout['description'];
$this->retired = $layout['retired'];
$this->tags = $layout['tags'];
$this->xml = $layout['xml'];
}
}
示例14: Exec
/**
* What action to perform?
* @return
*/
public function Exec()
{
// What module has been requested?
$method = Kit::GetParam('method', _REQUEST, _WORD);
$raw = Kit::GetParam('raw', _REQUEST, _WORD);
if (method_exists($this->module, $method)) {
$response = $this->module->{$method}();
} else {
// Set the error to display
trigger_error(__('This Module does not exist'), E_USER_ERROR);
}
if ($raw == 'true') {
echo $response;
exit;
} else {
$response->Respond();
}
}
示例15: GetResource
/**
* Get Resource
*/
public function GetResource($displayId = 0)
{
// Load the HtmlTemplate
$template = file_get_contents('modules/preview/HtmlTemplateForGetResource.html');
// What is the data source for this ticker?
$sourceId = $this->GetOption('sourceId', 1);
// Information from the Module
$direction = $this->GetOption('direction');
$scrollSpeed = $this->GetOption('scrollSpeed');
$fitText = $this->GetOption('fitText', 0);
$itemsSideBySide = $this->GetOption('itemsSideBySide', 0);
$duration = $this->duration;
$durationIsPerItem = $this->GetOption('durationIsPerItem', 0);
$numItems = $this->GetOption('numItems', 0);
$takeItemsFrom = $this->GetOption('takeItemsFrom', 'start');
$itemsPerPage = $this->GetOption('itemsPerPage', 0);
// Get the text out of RAW
$rawXml = new DOMDocument();
$rawXml->loadXML($this->GetRaw());
// Get the Text Node
$textNodes = $rawXml->getElementsByTagName('template');
$textNode = $textNodes->item(0);
$text = $textNode->nodeValue;
// Get the CSS Node
$cssNodes = $rawXml->getElementsByTagName('css');
if ($cssNodes->length > 0) {
$cssNode = $cssNodes->item(0);
$css = $cssNode->nodeValue;
} else {
$css = '';
}
$options = array('type' => 'ticker', 'sourceid' => $sourceId, 'direction' => $direction, 'duration' => $duration, 'durationIsPerItem' => $durationIsPerItem == 0 ? false : true, 'numItems' => $numItems, 'takeItemsFrom' => $takeItemsFrom, 'itemsPerPage' => $itemsPerPage, 'scrollSpeed' => $scrollSpeed, 'scaleMode' => $fitText == 0 ? 'scale' : 'fit', 'originalWidth' => $this->width, 'originalHeight' => $this->height, 'previewWidth' => Kit::GetParam('width', _GET, _DOUBLE, 0), 'previewHeight' => Kit::GetParam('height', _GET, _DOUBLE, 0));
// Generate a JSON string of substituted items.
if ($sourceId == 2) {
$items = $this->GetDataSetItems($displayId, $text);
} else {
$items = $this->GetRssItems($text);
}
// Return empty string if there are no items to show.
if (count($items) == 0) {
return '';
}
// Work out how many pages we will be showing.
$pages = $numItems;
if ($numItems > count($items) || $numItems == 0) {
$pages = count($items);
}
$pages = $itemsPerPage > 0 ? ceil($pages / $itemsPerPage) : $pages;
$totalDuration = $durationIsPerItem == 0 ? $duration : $duration * $pages;
$controlMeta = array('numItems' => $pages, 'totalDuration' => $totalDuration);
// Replace and Control Meta options
$template = str_replace('<!--[[[CONTROLMETA]]]-->', '<!-- NUMITEMS=' . $pages . ' -->' . PHP_EOL . '<!-- DURATION=' . $totalDuration . ' -->', $template);
// Replace the head content
$headContent = '<script type="text/javascript">';
$headContent .= ' function init() { ';
$headContent .= ' $("body").xiboRender(options, items);';
$headContent .= ' } ';
$headContent .= ' var options = ' . json_encode($options) . ';';
$headContent .= ' var items = ' . json_encode($items) . ';';
$headContent .= '</script>';
if ($itemsSideBySide == 1) {
$headContent .= '<style type="text/css">';
$headContent .= ' .item, .page { float: left; }';
$headContent .= '</style>';
}
// Add the CSS if it isn't empty
if ($css != '') {
$headContent .= '<style type="text/css">' . $css . '</style>';
}
// Replace the View Port Width?
if (isset($_GET['preview'])) {
$template = str_replace('[[ViewPortWidth]]', $this->width . 'px', $template);
}
// Replace the Head Content with our generated javascript
$template = str_replace('<!--[[[HEADCONTENT]]]-->', $headContent, $template);
// Replace the Body Content with our generated text
$template = str_replace('<!--[[[BODYCONTENT]]]-->', '', $template);
return $template;
}