本文整理汇总了PHP中CHttpSession::open方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpSession::open方法的具体用法?PHP CHttpSession::open怎么用?PHP CHttpSession::open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHttpSession
的用法示例。
在下文中一共展示了CHttpSession::open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderContent
protected function renderContent()
{
yii::beginProfile('loc');
$session = new CHttpSession();
$session->open();
$newCountry = $this->newCountry ? $this->newCountry : ($session['top-country'] ? $session['top-country'] : $this->defaultCountry);
$session['top-country'] = $newCountry;
$newCity = $this->newCity ? $this->newCity : ($session['top-city'] ? $session['top-city'] : $this->defaultCity);
$session['top-location'] = $newCity;
if ($newCountry == "international") {
$country = 'international';
$city = GeoCityApi::getCityByName($newCity);
if ($city) {
$cities = GeoCityApi::getTopPrioritiesInternational($city->id);
} else {
$cities = GeoCityApi::getTopPrioritiesInternational();
}
} else {
$country = GeoCountryApi::getCountryByName($newCountry);
$city = GeoCityApi::getCityByName($newCity);
if ($country && $city) {
$cities = GeoCityApi::getTopPrioritiesByCountry($country->id, $city->id);
} elseif ($country) {
$cities = GeoCityApi::getTopPrioritiesByCountry($country->id);
}
}
if ($country && $cities) {
$this->render('topLocation', array('city' => $city, 'country' => $country, 'current' => $this->current, 'cities' => $cities));
}
yii::endProfile('loc');
}
示例2: run
public function run()
{
$session = new CHttpSession();
$session->open();
$surSess = Yii::app()->session->get("favorites");
if (!Yii::app()->user->isGuest) {
Yii::import('mod.users.models.UserFavorites');
$modelClass = $this->model;
$currentModule = Yii::app()->controller->module->id;
echo Html::openTag('div', array('id' => 'fav' . $this->model->id, 'class' => 'favorite'));
$modelc = UserFavorites::model()->findAll(array('condition' => '`t`.`user_id`=:userid', 'params' => array(':userid' => Yii::app()->user->getId())));
if (count($modelc) < Yii::app()->settings->get('users', 'favorite_limit')) {
if (isset($modelClass)) {
$model = UserFavorites::model()->find(array('condition' => '`t`.`user_id`=:userid AND `t`.`model_class`=:model_class AND `t`.`object_id`=:id', 'params' => array(':userid' => Yii::app()->user->getId(), ':model_class' => $modelClass->getModelName(), ':id' => $modelClass->id)));
if ($this->view && !isset($model)) {
//
$view = "add";
$params = array('model' => $this->model, 'mod' => $currentModule);
} else {
$view = "remove";
$params = array('favorite_id' => $model->id, 'model' => $this->model, 'object_id' => $this->model->id, 'mod' => $currentModule);
}
}
}
$this->render($view, $params);
echo Html::closeTag('div');
}
}
示例3: checkUserAdmin
public function checkUserAdmin($accessRole_id = '')
{
$session = new CHttpSession();
$session->open();
$user_id = $session['uid'];
// App::pr($user_id,2);
$user_rid = $session['rid'];
if (!empty($user_id)) {
if (!empty($accessRole_id)) {
// App::pr($accessRole_id,2);
$record = UserMaster::model()->find("u_id = {$user_id} AND ur_id IN({$accessRole_id})");
// App::pr($record,2);
if (!empty($record)) {
return true;
} else {
return false;
}
} else {
$record = UserMaster::model()->findByPk($user_id);
if (!empty($record)) {
return true;
} else {
return false;
}
}
} else {
return FALSE;
}
}
示例4: actionScheduleBackupGeneratePdf
public function actionScheduleBackupGeneratePdf()
{
$session=new CHttpSession;
$session->open();
Yii::import('application.extensions.tcpdf.*');
require_once('tcpdf/tcpdf.php');
require_once('tcpdf/config/lang/eng.php');
if(isset($session['DatabaseBackupCron_records']))
{
$d=$_SESSION['DatabaseBackupCron_records'];
$model = array();
if($d->data)
$model[]=array_keys($d->data[0]->attributes);//headers: cols name
else
{
$this->render('no_data_found',array('last_page'=>$_SERVER['HTTP_REFERER'],));
exit;
}
foreach ($d->data as $item) {
$model[] = $item->attributes;
}
//print_r($model);exit;
}
$html = $this->renderPartial('/databaseBackupCron/exportGridtoReport', array(
'model'=>$model
), true);
$this->exporttopdf('Schedule Database Backup','ScheduleDatabaseBackup.pdf',$html);
}
示例5: loadModel
/**
* @param $id
* @param $criteria
* @return CActiveRecord
* @throws CHttpException
*/
public function loadModel($id, $criteria = false)
{
if (!$id) {
throw new CHttpException(404, 'Property not found');
}
$criteria = $criteria ?: new CDbCriteria();
$previewSession = new CHttpSession();
$previewSession->open();
$previewString = isset($previewSession['preview']) && $previewSession['preview'] ? $previewSession['preview'] : null;
$previewString = isset($_GET['preview']) && $_GET['preview'] ? $_GET['preview'] : $previewString;
if (Yii::app()->user->isGuest) {
$criteria->scopes = ['notUnderTheRadar'];
if ($previewString) {
$criteria->compare('emailLinkString', $previewString);
} else {
$criteria->scopes = ['publicAvailable', 'notUnderTheRadar'];
}
}
$model = Deal::model()->findByPk($id, $criteria);
if (!$model) {
throw new CHttpException(404, 'Property not found');
} else {
$previewSession['preview'] = $previewString;
$previewSession->close();
}
return $model;
}
示例6: getDevice
public function getDevice()
{
$device = new CHttpSession();
$device->open();
$type = $device['device-type'];
return $type;
}
示例7: flushUploadDir
public function flushUploadDir()
{
$session = new CHttpSession();
$session->open();
$folder = $_SERVER['DOCUMENT_ROOT'] . '/upload/tmp/' . $session->SessionID;
Y::recursiveRemDir($folder);
}
示例8: actionLogOut
public function actionLogOut()
{
$session = new CHttpSession();
$session->open();
$session->remove('usuarioSesion');
$this->redirect('login.php');
}
示例9: actionGeneratePdf
public function actionGeneratePdf()
{
$session = new CHttpSession();
$session->open();
Yii::import('application.modules.admin.extensions.giiplus.bootstrap.*');
require_once 'tcpdf/tcpdf.php';
require_once 'tcpdf/config/lang/eng.php';
if (isset($session['IguProductCategory_records'])) {
$model = $session['IguProductCategory_records'];
} else {
$model = IguProductCategory::model()->findAll();
}
$html = $this->renderPartial('expenseGridtoReport', array('model' => $model), true);
//die($html);
$pdf = new TCPDF();
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor(Yii::app()->name);
$pdf->SetTitle('IguProductCategory Report');
$pdf->SetSubject('IguProductCategory Report');
//$pdf->SetKeywords('example, text, report');
$pdf->SetHeaderData('', 0, "Report", '');
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by " . Yii::app()->name, "");
$pdf->setHeaderFont(array('helvetica', '', 8));
$pdf->setFooterFont(array('helvetica', '', 6));
$pdf->SetMargins(15, 18, 15);
$pdf->SetHeaderMargin(5);
$pdf->SetFooterMargin(10);
$pdf->SetAutoPageBreak(TRUE, 0);
$pdf->SetFont('dejavusans', '', 7);
$pdf->AddPage();
$pdf->writeHTML($html, true, false, true, false, '');
$pdf->LastPage();
$pdf->Output("IguProductCategory_002.pdf", "I");
}
示例10: runAction
public function runAction($action, $data)
{
$this->id = $data;
$s = new CHttpSession();
$s->open();
$storedData = $s[$this->id];
$s->close();
$this->model = $storedData['model'];
if ($action == 'listitems') {
$parent_id = null;
if (isset($_GET['id'])) {
$parent_id = $_GET['id'];
}
return $this->model->eyuiformeditordb_listitems($_GET['item_type'], $parent_id);
}
if ($action == 'newitem') {
$parent_id = null;
if (isset($_GET['id'])) {
$parent_id = $_GET['id'];
}
return $this->model->eyuiformeditordb_newitem($_GET['item_type'], self::t("New Item"), $parent_id);
}
if ($action == 'deleteitem') {
if ($this->model->eyuiformeditordb_deleteitem($_GET['id'])) {
return "OK";
}
}
if ($action == 'updateitem') {
$obj = CJSON::decode(trim(file_get_contents('php://input')));
if ($this->model->eyuiformeditordb_updateitem($obj) == true) {
return "OK";
}
}
}
示例11: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
//print_r($_GET);
//die;
if (isset($_GET['de'])) {
$translator = self::translator();
$translator->setLanguage('de');
}
if (isset($_GET['fr'])) {
$translator = self::translator();
$translator->setLanguage('fr');
}
/** @var $cs CClientScript */
$cs = Yii::app()->clientScript;
$cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.css');
Yii::app()->clientScript->registerCoreScript('jquery.ui');
Yii::app()->clientScript->registerCssFile(Yii::app()->clientScript->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.js');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.cycle.all.js');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/jquery.easing.1.3.js');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/catalog.min.js');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/custom.js');
$cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/css/ui.slider.extras.css');
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/js/selectToUISlider.jQuery.js');
if (isset($_POST['VariationID'])) {
$session = new CHttpSession();
$session->open();
$aOrderVariations = $session['orderVariations'];
$aOrderVariations[$_POST['VariationID']] = $_POST['VariationID'];
$session['orderVariations'] = $aOrderVariations;
echo json_encode(array('counter' => count($aOrderVariations), 'message' => 'success'));
exit;
}
$this->render('index', array('categories' => Category::model()->getCategoriesTree()));
}
示例12: doCallback
/**
* doCallback
* you must process a calilback response comming from host auth provider.
*
* you pass remote data to your local system using:
* $this->setData($anydata);
* $this->setLastError('error message');
*
* @access public
* @return bool boolean result true if login is correct.
*/
public function doCallback()
{
if (isset($_REQUEST['error'])) {
if ($_REQUEST['error'] == 'access_denied') {
$this->setLastError($_REQUEST['error_description']);
return false;
}
}
$s = new CHttpSession();
$s->open();
if (isset($s['state'])) {
if ($s['state'] === $_REQUEST['state']) {
$ac = $this->_getAccessToken($_REQUEST['code']);
$this->setData($this->_requestUser($ac));
$s->close();
return true;
} else {
$this->setLastError('CRSF validation failed.');
$s->close();
return false;
}
} else {
$this->setLastError('invalid state argument.');
$s->close();
return false;
}
}
示例13: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$session = new CHttpSession();
$session->open();
$this->render('index', array('username' => $session["fullname"]));
}
示例14: actionSeenOffer
public function actionSeenOffer()
{
$session = new CHttpSession();
$session->open();
$session['seenBackout'] = 1;
echo "<russia>Have nice day</russia>";
exit;
}
示例15: actionIndex
public function actionIndex()
{
$session = new CHttpSession();
$session->open();
$user = $session['login'];
$session->closeSession(true);
$sql = Yii::app()->db->createCommand("SELECT User.Num_bank_cart, Credit.Type_credit, Credit.Sum_credit, Credit.Proc_stavka, Credit.Srok, Credit.Type_credit, Calendar.Month_pay, Credit.Num_credit, Credit.Type_platezh, Credit.Oforml_credit_date, Calendar.Pay_sum, Calendar.P_sum, Calendar.P_proc, Calendar.Less_sum\nFROM (User INNER JOIN Credit ON User.id_user = Credit.id_user) INNER JOIN Calendar ON Credit.id_credit = Calendar.id_credit WHERE Num_bank_cart = {$user} ")->queryAll();
echo $this->render('index', array('variable' => $sql));
}