本文整理汇总了PHP中camp_session_get函数的典型用法代码示例。如果您正苦于以下问题:PHP camp_session_get函数的具体用法?PHP camp_session_get怎么用?PHP camp_session_get使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了camp_session_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDisplayName
/**
* Gets the translation for a given language; default language is the
* session language. If no translation is set for that language, we
* return the dbTableName.
*
* @param int p_lang
*
* @return string
*/
public function getDisplayName($p_lang = 0)
{
if (!$p_lang) {
$lang = camp_session_get('LoginLanguageId', 1);
} else {
$lang = $p_lang;
}
$aObj = new ArticleType($this->m_articleTypeName);
$translations = $aObj->getTranslations();
if (!isset($translations[$lang])) return substr($aObj->getTableName(), 1);
return $translations[$lang];
} // fn getDisplayName
示例2: read_user_common_parameters
function read_user_common_parameters()
{
global $uType, $userOffs, $ItemsPerPage;
global $defaultUserSearchParameters, $userSearchParameters;
$uType = Input::Get('uType', 'string', '');
$userOffs = camp_session_get('userOffs', 0);
if ($userOffs < 0) {
$userOffs = 0;
}
$ItemsPerPage = Input::Get('ItemsPerPage', 'int', 20);
foreach ($userSearchParameters as $parameter => $defaultValue) {
$userSearchParameters[$parameter] = camp_session_get($parameter, $defaultUserSearchParameters[$parameter]);
}
}
示例3: camp_session_get
<?php
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/topics/topics_common.php";
$f_show_languages = camp_session_get('f_show_languages', array());
$topics = Topic::GetTree();
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$loginLanguageId = 0;
$loginLanguage = Language::GetLanguages(null, camp_session_get('TOL_Language', 'en'), null, array(), array(), true);
if (is_array($loginLanguage) && count($loginLanguage) > 0) {
$loginLanguage = array_pop($loginLanguage);
$loginLanguageId = $loginLanguage->getLanguageId();
}
if (count($f_show_languages) <= 0) {
$f_show_languages = DbObjectArray::GetColumn($allLanguages, 'Id');
}
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Topics"), "");
echo camp_html_breadcrumbs($crumbs);
camp_html_display_msgs("0.5em", 0);
?>
<form action="" method="post">
<fieldset class="controls">
<legend><?php
putGS("Show languages");
?>
</legend>
<div class="buttons">
<input type="button" value="<?php
示例4: putGS
}
?>
</SELECT>
</TD>
</TR>
<tr style="display: none;" id="topic_list">
<td align="right"><?php
putGS("Top element");
?>
:</td>
<td>
<select name="f_root_topic_id" class="input_select">
<?php
$TOL_Language = camp_session_get('LoginLanguageId', 1);
$lang = new Language($TOL_Language);
$currentLanguageId = $lang->getLanguageId();
//$currentLanguages = Language::GetLanguages(null, $TOL_Language);
//$currentLanguageId = $currentLanguages[0]->getLanguageId();
$topics = Topic::GetTree();
foreach ($topics as $topicPath) {
$printTopic = array();
foreach ($topicPath as $topicId => $topic) {
$translations = $topic->getTranslations();
if (array_key_exists($currentLanguageId, $translations)) {
$currentTopic = $translations[$currentLanguageId];
} elseif ($currentLanguageId != 1 && array_key_exists(1, $translations)) {
$currentTopic = $translations[1];
} else {
$currentTopic = end($translations);
示例5: header
header("HTTP/1.1 404 Not found");
exit;
}
}
// Clean up the global namespace before we call the script
unset($access);
unset($extension);
unset($extension_start);
unset($question_mark);
unset($no_menu_scripts);
unset($request_uri);
// Restore POST request
$requestId = Input::Get('request', 'string', '', TRUE);
$request = camp_session_get("request_$requestId", '');
if (!empty($request)) {
$request = unserialize($request);
// Update security token.
$token_field = SecurityToken::SECURITY_TOKEN;
$request['post'][$token_field] = SecurityToken::GetToken();
// Set values.
foreach ($request['post'] as $key => $val) {
$_POST[$key] = $_REQUEST[$key] = $val;
}
}
if (file_exists($Campsite['HTML_DIR'] . '/reset_cache')) {
CampCache::singleton()->clear('user');
示例6: camp_load_translation_strings
camp_load_translation_strings("logs");
camp_load_translation_strings("api");
require_once($GLOBALS['g_campsiteDir']."/classes/Language.php");
require_once($GLOBALS['g_campsiteDir']."/classes/User.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Input.php");
require_once($GLOBALS['g_campsiteDir']."/classes/Log.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Event.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/SimplePager.php');
if (!$g_user->hasPermission('ViewLogs')) {
camp_html_display_error(getGS("You do not have the right to view logs."));
exit;
}
$f_event_search_id = Input::Get('f_event_search_id', 'int', null, true);
$f_log_page_offset = camp_session_get('f_log_page_offset', 0);
if ($f_event_search_id == 0) {
$f_event_search_id = null;
}
$events = Event::GetEvents();
if ($f_log_page_offset < 0) {
$f_log_page_offset = 0;
}
$ItemsPerPage = 15;
$logs = Log::GetLogs($f_event_search_id,
array('LIMIT' => array('MAX_ROWS' => $ItemsPerPage, 'START' => $f_log_page_offset)));
$numLogLines = Log::GetNumLogs($f_event_search_id);
$pager = new SimplePager($numLogLines, $ItemsPerPage, "f_log_page_offset", "index.php?f_event_search_id=".urlencode($f_event_search_id)."&");
示例7: camp_load_translation_strings
<?php
camp_load_translation_strings("article_type_fields");
camp_load_translation_strings("api");
require_once $GLOBALS['g_campsiteDir'] . '/classes/Input.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/ArticleType.php';
require_once $GLOBALS['g_campsiteDir'] . '/classes/Translation.php';
if (!Saas::singleton()->hasPermission('ManageArticleTypes')) {
camp_html_display_error(getGS("You do not have the right to manage article types."));
exit;
}
$articleTypeName = Input::Get('f_article_type');
// return value is sorted by language
$allLanguages = Language::GetLanguages(null, null, null, array(), array(), true);
$lang = camp_session_get('LoginLanguageId', 1);
$languageObj = new Language($lang);
$articleType = new ArticleType($articleTypeName);
$fields = $articleType->getUserDefinedColumns(null, true, true);
$crumbs = array();
$crumbs[] = array(getGS("Configure"), "");
$crumbs[] = array(getGS("Article Types"), "/{$ADMIN}/article_types/");
$crumbs[] = array($articleTypeName, "");
$crumbs[] = array(getGS("Article type fields"), "");
echo camp_html_breadcrumbs($crumbs);
$row_rank = 0;
if ($g_user->hasPermission("ManageArticleTypes")) {
include_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/javascript_common.php";
?>
<script>
var field_ids = new Array;
var allShown = 0;
示例8: SimplePager
/**
* SimplePager, unlike the PEAR Pager class, is a pager made to work
* with template-like layouts. The constructor sets up the variables
* you need to render the links, and you can render them
* however you like. There is a default render function for
* reference.
*
* @param int $p_totalItems
* Total number of items.
*
* @param int $p_itemsPerPage
* Number of items to display per page.
*
* @param string $p_offsetVarName
* The name of the REQUEST variable which holds the order number
* of the first item on the selected page.
*
* @param string $p_baseUrl
* The url to which we attach the offset variable name.
*
* @param boolean $p_useSessions
* Set to TRUE if you want the offset item number to be stored in
* the session so that the user will return to their previous
* position in the pager when they leave the screen and come back
* to it.
*/
public function SimplePager($p_totalItems, $p_itemsPerPage, $p_offsetVarName,
$p_baseUrl, $p_useSessions = true, $p_width = 10)
{
global $_REQUEST;
$this->m_urls["links"] = array();
if ($p_totalItems < 0) {
$p_totalItems = 0;
}
if ($p_itemsPerPage < 1) {
$p_itemsPerPage = 1;
}
// Get the current page number.
if ($p_useSessions) {
$this->m_offset = camp_session_get($p_offsetVarName, 0);
} else {
$this->m_offset = isset($_REQUEST[$p_offsetVarName]) ? $_REQUEST[$p_offsetVarName] : 0;
}
if ($this->m_offset < 0) {
$this->m_offset = 0;
} elseif ( ($this->m_offset) > $p_totalItems) {
// If the offset is past the total number of items,
// reset it.
$this->m_offset = 0;
if ($p_useSessions) {
camp_session_set($p_offsetVarName, 0);
}
}
// Only generate pager if there is more than one page of information.
if ($p_totalItems > $p_itemsPerPage) {
// Generate the offsets into the list.
$remainder = $p_totalItems % $p_itemsPerPage;
if ($remainder == 0) {
$this->m_offsets = SimplePager::_range(0, $p_totalItems-1, $p_itemsPerPage);
} else {
$this->m_offsets = SimplePager::_range(0, $p_totalItems, $p_itemsPerPage);
}
$this->m_numPages = count($this->m_offsets);
$this->m_selectedPageNumber = floor($this->m_offset/$p_itemsPerPage)+1;
if ($p_width > $this->m_numPages) {
$p_width = $this->m_numPages;
}
// Generate the numbered links
if ($this->m_selectedPageNumber < ($p_width/2 + 1)) {
$begin = 0;
$end = $p_width;
} else if ($this->m_selectedPageNumber > ($this->m_numPages - ($p_width/2))) {
$begin = $this->m_numPages - $p_width;
$end = $this->m_numPages;
} else {
$begin = $this->m_selectedPageNumber - ceil($p_width/2) - 1;
$end = $this->m_selectedPageNumber + ceil($p_width/2);
}
for ($index = $begin; $index < $end; $index++) {
$this->m_urls["links"][$index+1] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[$index];
}
// Generate special links.
if ($this->m_selectedPageNumber > 1) {
$this->m_urls["first"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[0];
$this->m_urls["previous"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-2)];
}
if ($this->m_selectedPageNumber > 10) {
$this->m_urls["previous_10_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-11)];
}
if ($this->m_selectedPageNumber > 100) {
$this->m_urls["previous_100_pages"] = $p_baseUrl."$p_offsetVarName=".$this->m_offsets[max(0, $this->m_selectedPageNumber-101)];
}
//.........这里部分代码省略.........
示例9: camp_load_translation_strings
camp_load_translation_strings('api');
require_once($GLOBALS['g_campsiteDir'].'/include/campsite_constants.php');
require_once($GLOBALS['g_campsiteDir']."/$ADMIN_DIR/articles/article_common.php");
require_once($GLOBALS['g_campsiteDir'].'/classes/Image.php');
require_once($GLOBALS['g_campsiteDir'].'/classes/ImageSearch.php');
if (!$g_user->hasPermission("AttachImageToArticle")) {
$errorStr = getGS('You do not have the right to attach images to articles.');
camp_html_display_error($errorStr, null, true);
exit;
}
$f_language_id = Input::Get('f_language_id', 'int', 0);
$f_language_selected = Input::Get('f_language_selected', 'int', 0);
$f_article_number = Input::Get('f_article_number', 'int', 0);
$f_image_attach_mode = camp_session_get('f_image_attach_mode', 'new');
if (!Input::IsValid()) {
camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI'], true);
exit;
}
$articleObj = new Article($f_language_selected, $f_article_number);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Expires" content="now" />
<link rel="stylesheet" type="text/css" href="<?php echo $Campsite['ADMIN_STYLE_URL']; ?>/admin_stylesheet_new.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $Campsite['ADMIN_STYLE_URL']; ?>/admin_stylesheet.css" />
<title><?php putGS("Attach Image To Article"); ?></title>
示例10: camp_load_translation_strings
<?php
require_once $GLOBALS['g_campsiteDir'] . "/{$ADMIN_DIR}/pub/pub_common.php";
require_once $GLOBALS['g_campsiteDir'] . "/classes/SimplePager.php";
camp_load_translation_strings("api");
// Check permissions
$PubOffs = camp_session_get('PubOffs', 0);
if ($PubOffs < 0) {
$PubOffs = 0;
}
$ItemsPerPage = 15;
$sqlOptions = array("LIMIT" => array("START" => $PubOffs, "MAX_ROWS" => $ItemsPerPage), "ORDER BY" => array("Name" => "ASC"));
$publications = Publication::GetPublications(null, null, $sqlOptions);
$numPublications = Publication::GetNumPublications();
$pager = new SimplePager($numPublications, $ItemsPerPage, "PubOffs", "index.php?");
camp_html_content_top(getGS('Publication List'), null);
if ($g_user->hasPermission("ManagePub") && SaaS::singleton()->hasPermission("AddPub")) {
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="1" class="action_buttons">
<TR>
<TD>
<A HREF="/<?php
echo $ADMIN;
?>
/pub/add.php?Back=<?php
p(urlencode($_SERVER['REQUEST_URI']));
?>
"><IMG SRC="<?php
echo $Campsite["ADMIN_IMAGE_BASE_URL"];
?>
示例11: camp_session_get
<select class="input_select" name="<?php
echo $dbColumn->getName();
?>
" id="<?php
echo $dbColumn->getName();
?>
" <?php
if ($f_edit_mode != "edit") {
?>
disabled<?php
}
?>
>
<option value="0"></option>
<?php
$TOL_Language = camp_session_get('TOL_Language', 'en');
$currentLanguage = new Language($TOL_Language);
$currentLanguageId = $currentLanguage->getLanguageId();
foreach ($subtopics as $topicPath) {
$printTopic = array();
foreach ($topicPath as $topicId => $topic) {
$translations = $topic->getTranslations();
if (array_key_exists($currentLanguageId, $translations)) {
$currentTopic = $translations[$currentLanguageId];
} elseif ($currentLanguageId != 1 && array_key_exists(1, $translations)) {
$currentTopic = $translations[1];
} else {
$currentTopic = end($translations);
}
$printTopic[] = $currentTopic;
}
示例12: translationForm
/**
* Creates a form for translation.
* @param array $p_request
*/
function translationForm($p_request)
{
global $g_localizerConfig;
$localizerTargetLanguage = camp_session_get('localizer_target_language', $g_localizerConfig['DEFAULT_LANGUAGE']);
$localizerSourceLanguage = camp_session_get('localizer_source_language', '');
if (empty($localizerSourceLanguage)) {
if (isset($p_request['TOL_Language'])) {
$lang = $p_request['TOL_Language'];
} else {
$lang = $g_localizerConfig['DEFAULT_LANGUAGE'];
}
$tmpLanguage = new LocalizerLanguage(null, $lang);
$localizerSourceLanguage = $tmpLanguage->getLanguageId();
}
$prefix = camp_session_get('prefix', '');
$screenDropDownSelection = $prefix;
// Load the language files.
//echo "Prefix: $prefix<br>";
$sourceLang = new LocalizerLanguage($prefix, $localizerSourceLanguage);
$targetLang = new LocalizerLanguage($prefix, $localizerTargetLanguage);
$defaultLang = new LocalizerLanguage($prefix, $g_localizerConfig['DEFAULT_LANGUAGE']);
$mode = Localizer::GetMode();
if (!empty($prefix)) {
// If the language files do not exist, create them.
if (!$defaultLang->loadFile($mode)) {
$defaultLang->saveFile($mode);
}
if (!$sourceLang->loadFile($mode)) {
$sourceLang->saveFile($mode);
}
if (!$targetLang->loadFile($mode)) {
$targetLang->saveFile($mode);
}
// Make sure that the languages have the same strings and are in the same
// order as the default language file.
$modified = $sourceLang->syncToDefault();
if ($modified) {
$sourceSaveSuccess = $sourceLang->saveFile($mode);
camp_html_add_msg($sourceSaveSuccess);
}
$modified = $targetLang->syncToDefault();
if ($modified) {
$targetSaveSuccess = $targetLang->saveFile($mode);
camp_html_add_msg($targetSaveSuccess);
}
}
$defaultStrings = $defaultLang->getTranslationTable();
$searchString = camp_session_get('search_string', '');
if (!empty($searchString)) {
$sourceStrings = $sourceLang->search($searchString);
}
else {
$sourceStrings = $sourceLang->getTranslationTable();
}
$targetStrings = $targetLang->getTranslationTable();
$languages = Localizer::GetAllLanguages($mode);
$missingStrings = Localizer::FindMissingStrings($prefix);
$unusedStrings = Localizer::FindUnusedStrings($prefix);
// Mapping of language prefixes to human-readable strings.
$mapPrefixToDisplay = array();
$mapPrefixToDisplay[] = "";
$mapPrefixToDisplay["globals"] = getGS("Globals");
$mapPrefixToDisplay["home"] = getGS("Dashboard");
$mapPrefixToDisplay["api"] = getGS("API");
$mapPrefixToDisplay["library"] = getGS("Libraries");
$mapPrefixToDisplay["pub"] = getGS("Publications");
$mapPrefixToDisplay["issues"] = getGS("Issues");
$mapPrefixToDisplay["sections"] = getGS("Sections");
$mapPrefixToDisplay["articles"] = getGS("Articles");
$mapPrefixToDisplay["article_images"] = getGS("Article Images");
$mapPrefixToDisplay["article_files"] = getGS("Article Files");
$mapPrefixToDisplay["article_topics"] = getGS("Article Topics");
$mapPrefixToDisplay["article_comments"] = getGS("Article Comments");
$mapPrefixToDisplay["media_archive"] = getGS("Media Archive");
$mapPrefixToDisplay["geolocation"] = getGS("Geo-location");
$mapPrefixToDisplay["comments"] = getGS("Comments");
$mapPrefixToDisplay["system_pref"] = getGS("System Preferences");
$mapPrefixToDisplay["templates"] = getGS("Templates");
$mapPrefixToDisplay["article_types"] = getGS("Article Types");
$mapPrefixToDisplay["article_type_fields"] = getGS("Article Type Fields");
$mapPrefixToDisplay["topics"] = getGS("Topics");
$mapPrefixToDisplay["languages"] = getGS("Languages");
$mapPrefixToDisplay["country"] = getGS("Countries");
$mapPrefixToDisplay["localizer"] = getGS("Localizer");
$mapPrefixToDisplay["logs"] = getGS("Logs");
$mapPrefixToDisplay["users"] = getGS("Users");
$mapPrefixToDisplay["user_subscriptions"] = getGS("User Subscriptions");
//.........这里部分代码省略.........
示例13: count
$numArticles = count($articles);
$numArticlesDeleted = 0;
$f_delete_all_section_translations = $f_delete_all_section_translations == 'Y' ? true : false;
$f_delete_all_articles_translations = $f_delete_all_articles_translations == 'Y' ? true : false;
if ($f_delete_all_section_translations == false) {
$numArticlesDeleted = $sectionObj->delete(true, $f_delete_all_articles_translations);
$cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
$cacheService->clearNamespace('section');
} else {
$sectionTranslations = Section::GetSections($f_publication_id, $f_issue_number, null, null, $sectionObj->getName(), null);
foreach ($sectionTranslations as $key => $sectionTranslation) {
$numArticlesDeleted += $sectionTranslation->delete(true, $f_delete_all_articles_translations);
}
}
$offsetVarName = 'SectOffs_' . $f_publication_id . '_' . $f_issue_number . '_' . $f_language_id;
$SectOffs = camp_session_get($offsetVarName, 0);
$totalSections = Section::GetTotalSections($f_publication_id, $f_issue_number, $f_language_id);
if ($SectOffs >= $totalSections) {
camp_session_set($offsetVarName, 0);
}
$topArray = array('Pub' => $publicationObj, 'Issue' => $issueObj, 'Section' => $sectionObj);
camp_html_content_top($translator->trans('Delete section', array(), 'sections'), $topArray);
?>
<P>
<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="8" class="message_box">
<TR>
<TD COLSPAN="2">
<B> <?php
echo $translator->trans("Deleting section", array(), 'sections');
?>
示例14: regGS
/**
* Register a string in the global translation file. (Legacy code for GS files)
*
* @param string $p_value
* @param string $p_key
* @return void
*/
function regGS($p_key, $p_value)
{
global $g_translationStrings;
if (isset($g_translationStrings[$p_key])) {
if ($p_key!='') {
print "The global string is already set in ".$_SERVER['PHP_SELF'].": $p_key<BR>";
}
}
else{
if (substr($p_value, strlen($p_value)-3)==(":".camp_session_get('TOL_Language', 'en'))){
$p_value = substr($p_value, 0, strlen($p_value)-3);
}
$g_translationStrings[$p_key] = $p_value;
}
} // fn regGS
示例15: camp_session_get
<?php
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
// ignore for logged user
return;
}
$f_user_name = Input::Get('f_user_name');
$f_password = Input::Get('f_password');
$f_login_language = Input::Get('f_login_language', 'string', 'en');
$f_is_encrypted = Input::Get('f_is_encrypted', 'int', '1');
$f_captcha_code = Input::Get('f_captcha_code', 'string', '', true);
$xorkey = camp_session_get('xorkey', '');
if (trim($xorkey) == '') {
return 'xorkey';
}
if (!Input::isValid()) {
return 'userpass';
}
$t_password = rc4($xorkey, base64ToText($f_password));
//
// Valid logins
//
// if user valid, password valid, encrypted, no CAPTCHA -> login
// if user valid, password valid, encrypted, CAPTCHA valid -> login
// if user valid, password valid, not encrypted, no CAPTCHA -> login, upgrade
// if user valid, password valid, not encrypted, CAPTCHA valid -> login, upgrade
//
// Invalid logins
//
// CAPTCHA invalid -> captcha