本文整理汇总了PHP中Session::newInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::newInstance方法的具体用法?PHP Session::newInstance怎么用?PHP Session::newInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session::newInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doView
function doView($file)
{
osc_run_hook('before_html');
osc_current_web_theme_path($file);
Session::newInstance()->_clearVariables();
osc_run_hook('after_html');
}
示例2: processEditForm
public function processEditForm($new_item = array(), $files = array())
{
$param_name = 'new_item';
Session::newInstance()->_setForm($param_name, $new_item);
// keep values on session
Session::newInstance()->_keepForm($param_name);
$default_fields = array('gn_id' => NULL, 'gn_title' => '', 'gn_description' => '', 'gn_tags' => '', 'gn_lang' => osc_current_admin_locale());
$new_item = array_merge($default_fields, $new_item);
if (!$new_item['gn_title']) {
throw new Exception(__('The title must not be empty', 'gz_news'));
}
if (!$new_item['gn_description']) {
throw new Exception(__('The description must not be empty', 'gz_news'));
}
$dao = GzNewsDao::newInstance();
if ($new_item['gn_id']) {
$item_exists = $dao->findByPrimaryKey($new_item['gn_id']);
if ($item_exists == FALSE) {
throw new Exception(__('The new does not exists anymore', 'gz_news'));
}
}
$success = $dao->save($new_item);
if ($success) {
if (!empty($files)) {
$this->uploadFiles($success, $files);
}
Session::newInstance()->_dropKeepForm($param_name);
}
return $success;
}
示例3: doView
function doView($file)
{
osc_run_hook("before_admin_html");
osc_current_admin_theme_path($file);
Session::newInstance()->_clearVariables();
osc_run_hook("after_admin_html");
}
示例4: doModel
function doModel()
{
switch ($this->action) {
case 'logout':
// unset only the required parameters in Session
Session::newInstance()->_drop('adminId');
Session::newInstance()->_drop('adminUserName');
Session::newInstance()->_drop('adminName');
Session::newInstance()->_drop('adminEmail');
Session::newInstance()->_drop('adminLocale');
Cookie::newInstance()->pop('oc_adminId');
Cookie::newInstance()->pop('oc_adminSecret');
Cookie::newInstance()->pop('oc_adminLocale');
Cookie::newInstance()->set();
$this->redirectTo(osc_admin_base_url(true));
break;
default:
//default dashboard page (main page at oc-admin)
$this->_exportVariableToView("numUsers", User::newInstance()->count());
$this->_exportVariableToView("numAdmins", Admin::newInstance()->count());
$this->_exportVariableToView("numItems", Item::newInstance()->count());
$this->_exportVariableToView("numItemsPerCategory", CategoryStats::newInstance()->toNumItemsMap());
$this->_exportVariableToView("categories", Category::newInstance()->listAll());
$this->_exportVariableToView("newsList", osc_listNews());
$this->_exportVariableToView("comments", ItemComment::newInstance()->getLastComments(5));
//calling the view...
$this->doView('main/index.php');
}
}
示例5: __construct
public function __construct()
{
parent::__construct();
$this->path = osc_themes_path();
if( Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '' ) {
$this->setCurrentTheme( Params::getParam('theme') );
} else {
$this->setCurrentTheme( osc_theme() );
}
$functions_path = $this->getCurrentThemePath() . 'functions.php';
if( file_exists($functions_path) ) {
require_once $functions_path;
}
$info = $this->loadThemeInfo($this->theme);
if($info['template'] != '' ) {
//$this->setCurrentTheme($info['template']);
$parent_functions_path = osc_base_path() . 'oc-content/themes/' . $info['template'] . '/functions.php';
if( file_exists($parent_functions_path) ) {
require_once $parent_functions_path;
}
}
}
示例6: osc_show_flash_message
function osc_show_flash_message($section = 'pubMessages', $class = "FlashMessage", $id = "FlashMessage")
{
$message = Session::newInstance()->_getMessage($section);
if ($message != '') {
echo '<div id="' . $id . '" class="' . $class . '">';
echo Session::newInstance()->_getMessage($section);
echo '</div>';
Session::newInstance()->_dropMessage($section);
}
}
示例7: your_message
public static function your_message()
{
if (Session::newInstance()->_getForm("message_body") != "") {
$message_body = Session::newInstance()->_getForm("message_body");
parent::generic_textarea("message", $message_body, null, false);
} else {
parent::generic_textarea("message", "");
}
return true;
}
示例8: body_input_textarea
public static function body_input_textarea($comment = null)
{
$commentBody = '';
if (isset($comment['s_body'])) {
$commentBody = $comment['s_body'];
}
if (Session::newInstance()->_getForm('commentBody') != '') {
$commentBody = Session::newInstance()->_getForm('commentBody');
}
parent::generic_textarea("body", $commentBody);
}
示例9: logout
function logout()
{
//destroying session
Session::newInstance()->session_destroy();
Session::newInstance()->_drop('userId');
Session::newInstance()->_drop('userName');
Session::newInstance()->_drop('userEmail');
Session::newInstance()->_drop('userPhone');
Cookie::newInstance()->pop('oc_userId');
Cookie::newInstance()->pop('oc_userSecret');
Cookie::newInstance()->set();
}
示例10: osc_resend_flash_messages
/**
* Re-send the flash messages of the given section. Usefull for custom theme/plugins files.
*
* @param string $$section
*/
function osc_resend_flash_messages($section = "pubMessages")
{
$message = Session::newInstance()->_getMessage($section);
if ($message["type"] == "info") {
osc_add_flash_info_message($message['msg'], $section);
} else {
if ($message["type"] == "ok") {
osc_add_flash_ok_message($message['msg'], $section);
} else {
osc_add_flash_error_message($message['msg'], $section);
}
}
}
示例11: __construct
public function __construct()
{
$this->path = osc_themes_path();
if (Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '') {
$this->setCurrentTheme(Params::getParam('theme'));
} else {
$this->setCurrentTheme(osc_theme());
}
$functions_path = $this->getCurrentThemePath() . 'functions.php';
if (file_exists($functions_path)) {
require_once $functions_path;
}
}
示例12: __construct
public function __construct()
{
//#dev.conquer this fix is needed for the preview of appearance in oc-admin
if (Params::getParam('theme') != '' && Session::newInstance()->_get('adminId') != '') {
$this->setCurrentTheme(Params::getParam('theme'));
} else {
$this->setCurrentTheme(osc_theme());
}
//#juanramon: check if exists functions.php
$functions_path = $this->getCurrentThemePath() . 'functions.php';
if (file_exists($functions_path)) {
require_once $functions_path;
}
}
示例13: logout
function logout()
{
//destroying session
Session::newInstance()->session_destroy();
Session::newInstance()->_drop('adminId');
Session::newInstance()->_drop('adminUserName');
Session::newInstance()->_drop('adminName');
Session::newInstance()->_drop('adminEmail');
Session::newInstance()->_drop('adminLocale');
Cookie::newInstance()->pop('oc_adminId');
Cookie::newInstance()->pop('oc_adminSecret');
Cookie::newInstance()->pop('oc_adminLocale');
Cookie::newInstance()->set();
}
示例14: logout
function logout()
{
//destroying session
$locale = Session::newInstance()->_get('userLocale');
Session::newInstance()->session_destroy();
Session::newInstance()->_drop('userId');
Session::newInstance()->_drop('userName');
Session::newInstance()->_drop('userEmail');
Session::newInstance()->_drop('userPhone');
Session::newInstance()->session_start();
Session::newinstance()->_set('userLocale', $locale);
Cookie::newInstance()->pop('oc_userId');
Cookie::newInstance()->pop('oc_userSecret');
Cookie::newInstance()->set();
}
示例15: multilanguage_name_description
public static function multilanguage_name_description($locales, $page = null)
{
$num_locales = count($locales);
if ($num_locales > 1) {
echo '<div class="tabber">';
}
$aFieldsDescription = Session::newInstance()->_getForm("aFieldsDescription");
foreach ($locales as $locale) {
if ($num_locales > 1) {
echo '<div class="tabbertab">';
echo '<h2>' . $locale['s_name'] . '</h2>';
}
echo '<div class="FormElement">';
echo '<div class="FormElementName">' . __('Title') . '</div>';
echo '<div class="FormElementInput">';
$title = '';
if (isset($page['locale'][$locale['pk_c_code']])) {
$title = $page['locale'][$locale['pk_c_code']]['s_title'];
}
if (isset($aFieldsDescription[$locale['pk_c_code']]) && isset($aFieldsDescription[$locale['pk_c_code']]['s_title']) && $aFieldsDescription[$locale['pk_c_code']]['s_title'] != '') {
$title = $aFieldsDescription[$locale['pk_c_code']]['s_title'];
}
parent::generic_input_text($locale['pk_c_code'] . '#s_title', $title);
echo '</div>';
echo '</div>';
echo '<div class="FormElement">';
echo '<div class="FormElementName">' . __('Body') . '</div>';
echo '<div class="FormElementInput">';
$description = '';
if (isset($page['locale'][$locale['pk_c_code']])) {
$description = $page['locale'][$locale['pk_c_code']]['s_text'];
}
if (isset($aFieldsDescription[$locale['pk_c_code']]) && isset($aFieldsDescription[$locale['pk_c_code']]['s_text']) && $aFieldsDescription[$locale['pk_c_code']]['s_text'] != '') {
$description = $aFieldsDescription[$locale['pk_c_code']]['s_text'];
}
parent::generic_textarea($locale['pk_c_code'] . '#s_text', $description);
echo '</div>';
echo '</div>';
if ($num_locales > 1) {
echo '</div>';
}
}
if ($num_locales > 1) {
echo '</div>';
}
}