本文整理汇总了PHP中CSession::keyExists方法的典型用法代码示例。如果您正苦于以下问题:PHP CSession::keyExists方法的具体用法?PHP CSession::keyExists怎么用?PHP CSession::keyExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSession
的用法示例。
在下文中一共展示了CSession::keyExists方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doAction
protected function doAction()
{
$data = ['theme' => getUserTheme(CWebUser::$data), 'messages' => []];
if (CSession::keyExists('messages')) {
$data['messages'] = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
$this->setResponse(new CControllerResponseData($data));
}
示例2: local_showMessage
function local_showMessage()
{
global $ZBX_MESSAGES;
if (CSession::keyExists('messageOk') || CSession::keyExists('messageError')) {
if (CSession::keyExists('messages')) {
$ZBX_MESSAGES = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
if (CSession::keyExists('messageOk')) {
show_messages(true, CSession::getValue('messageOk'));
} else {
show_messages(false, null, CSession::getValue('messageError'));
}
CSession::unsetValue(['messageOk', 'messageError']);
}
}
示例3: imageThumb
$ico = imageThumb($ico, $width, $height);
}
$w = imagesx($ico);
$h = imagesy($ico);
$css .= 'div.sysmap_iconid_' . $image['imageid'] . '{' . ' height: ' . $h . 'px;' . ' width: ' . $w . 'px;' . ' background: url("imgstore.php?iconid=' . $image['imageid'] . '&width=' . $w . '&height=' . $h . '") no-repeat center center;}' . "\n";
}
echo $css;
} elseif (isset($_REQUEST['iconid'])) {
$iconid = getRequest('iconid', 0);
if ($iconid > 0) {
$image = get_image_by_imageid($iconid);
$source = $image['image'] ? imageFromString($image['image']) : get_default_image();
} else {
$source = get_default_image();
}
if ($resize) {
$source = imageThumb($source, $width, $height);
}
imageOut($source);
} elseif (isset($_REQUEST['imageid'])) {
$imageid = getRequest('imageid', 0);
if (CSession::keyExists('image_id')) {
$image_data = CSession::getValue('image_id');
if (array_key_exists($imageid, $image_data)) {
echo $image_data[$imageid];
unset($image_data[$imageid]);
CSession::setValue('image_id', $image_data);
}
}
}
require_once dirname(__FILE__) . '/include/page_footer.php';
示例4: define
define('PAGE_HEADER_LOADED', 1);
if (defined('ZBX_PAGE_NO_HEADER')) {
return null;
}
// checking messages from MVC pages
$message_good = null;
$message_ok = null;
$message_error = null;
$messages = [];
// this code show messages generated by MVC pages
if (CSession::keyExists('messageOk') || CSession::keyExists('messageError')) {
if (CSession::keyExists('messages')) {
$messages = CSession::getValue('messages');
CSession::unsetValue(['messages']);
}
if (CSession::keyExists('messageOk')) {
$message_good = true;
$message_ok = CSession::getValue('messageOk');
} else {
$message_good = false;
$message_error = CSession::getValue('messageError');
}
CSession::unsetValue(['messageOk', 'messageError']);
}
if (!defined('ZBX_PAGE_NO_MENU')) {
$pageMenu = new CView('layout.htmlpage.menu', ['server_name' => isset($ZBX_SERVER_NAME) ? $ZBX_SERVER_NAME : '', 'menu' => ['main_menu' => $main_menu, 'sub_menus' => $sub_menus, 'selected' => $page['menu']], 'user' => ['is_guest' => CWebUser::isGuest(), 'alias' => CWebUser::$data['alias'], 'name' => CWebUser::$data['name'], 'surname' => CWebUser::$data['surname']]]);
echo $pageMenu->getOutput();
}
if ($page['type'] == PAGE_TYPE_HTML) {
echo '<div class="' . ZBX_STYLE_ARTICLE . '">';
}
示例5: getConfig
function getConfig($name, $default = null)
{
return CSession::keyExists($name) ? CSession::getValue($name) : $default;
}
示例6: dirname
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/classes/core/Z.php';
$page['file'] = 'setup.php';
try {
Z::getInstance()->run(ZBase::EXEC_MODE_SETUP);
} catch (Exception $e) {
(new CView('general.warning', ['header' => $e->getMessage(), 'messages' => [], 'theme' => ZBX_DEFAULT_THEME]))->render();
exit;
}
// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
$fields = ['type' => [T_ZBX_STR, O_OPT, null, IN('"' . ZBX_DB_MYSQL . '","' . ZBX_DB_POSTGRESQL . '","' . ZBX_DB_ORACLE . '","' . ZBX_DB_DB2 . '","' . ZBX_DB_SQLITE3 . '"'), null], 'server' => [T_ZBX_STR, O_OPT, null, null, null], 'port' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Database port')], 'database' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, null, _('Database name')], 'user' => [T_ZBX_STR, O_OPT, null, null, null], 'password' => [T_ZBX_STR, O_OPT, null, null, null], 'schema' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server_name' => [T_ZBX_STR, O_OPT, null, null, null], 'zbx_server_port' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), null, _('Port')], 'save_config' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'retry' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'finish' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'next' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'back' => [T_ZBX_STR, O_OPT, P_SYS, null, null]];
CSession::start();
CSession::setValue('check_fields_result', check_fields($fields, false));
if (!CSession::keyExists('step')) {
CSession::setValue('step', 0);
}
// if a guest or a non-super admin user is logged in
if (CWebUser::$data && CWebUser::getType() < USER_TYPE_SUPER_ADMIN) {
// on the last step of the setup we always have a guest user logged in;
// when he presses the "Finish" button he must be redirected to the login screen
if (CWebUser::isGuest() && CSession::getValue('step') == 5 && hasRequest('finish')) {
CSession::clear();
redirect('index.php');
} elseif (!(CWebUser::isGuest() && CSession::getValue('step') == 5)) {
access_deny(ACCESS_DENY_PAGE);
}
} elseif (hasRequest('cancel') || hasRequest('finish')) {
CSession::clear();
redirect('index.php');
示例7: array_multisort
}
}
array_multisort($sortClock, SORT_ASC, $sortEvent, SORT_ASC, $result);
break;
case 'message.closeAll':
$msgsettings = getMessageSettings();
switch (strtolower($data['params']['caption'])) {
case 'events':
$msgsettings['last.clock'] = (int) $data['params']['time'] + 1;
updateMessageSettings($msgsettings);
break;
}
break;
case 'zabbix.status':
CSession::start();
if (!CSession::keyExists('serverCheckResult') || CSession::getValue('serverCheckTime') + SERVER_CHECK_INTERVAL <= time()) {
$zabbixServer = new CZabbixServer($ZBX_SERVER, $ZBX_SERVER_PORT, ZBX_SOCKET_TIMEOUT, 0);
CSession::setValue('serverCheckResult', $zabbixServer->isRunning());
CSession::setValue('serverCheckTime', time());
}
$result = ['result' => (bool) CSession::getValue('serverCheckResult'), 'message' => CSession::getValue('serverCheckResult') ? '' : _('Zabbix server is not running: the information displayed may not be current.')];
break;
case 'screen.get':
$result = '';
$screenBase = CScreenBuilder::getScreen($data);
if ($screenBase !== null) {
$screen = $screenBase->get();
if ($data['mode'] == SCREEN_MODE_JS) {
$result = $screen;
} else {
if (is_object($screen)) {
示例8: validateInput
/**
* Validate input parameters.
*
* @return var
*/
public function validateInput($validationRules)
{
if (CSession::keyExists('formData')) {
$input = array_merge($_REQUEST, CSession::getValue('formData'));
CSession::unsetValue(['formData']);
} else {
$input = $_REQUEST;
}
$validator = new CNewValidator($input, $validationRules);
foreach ($validator->getAllErrors() as $error) {
info($error);
}
if ($validator->isErrorFatal()) {
$this->validationResult = self::VALIDATION_FATAL_ERROR;
} else {
if ($validator->isError()) {
$this->input = $validator->getValidInput();
$this->validationResult = self::VALIDATION_ERROR;
} else {
$this->input = $validator->getValidInput();
$this->validationResult = self::VALIDATION_OK;
}
}
return $this->validationResult == self::VALIDATION_OK;
}