当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeSession::start方法代码示例

本文整理汇总了PHP中CakeSession::start方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeSession::start方法的具体用法?PHP CakeSession::start怎么用?PHP CakeSession::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeSession的用法示例。


在下文中一共展示了CakeSession::start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Default Constructor
  *
  * @param array $config options
  * @access public
  */
 public function __construct($config)
 {
     // _toPost keys are case sensitive for google api, changin them will result in bad authentication
     $_toPost['accountType'] = $config['accounttype'];
     $_toPost['Email'] = $config['email'];
     $_toPost['Passwd'] = $config['passwd'];
     $_toPost['service'] = $config['service'];
     $_toPost['source'] = $config['source'];
     $this->HttpSocket = new HttpSocket();
     // Initializing Cake Session
     $session = new CakeSession();
     $session->start();
     // Validating if curl is available
     if (function_exists('curl_init')) {
         $this->_method = 'curl';
     } else {
         $this->_method = 'fopen';
     }
     // Looking for auth key in cookie of google api client login
     $cookie_key = $session->read('GoogleClientLogin' . $_toPost['service'] . '._auth_key');
     if ($cookie_key == null || $cookie_key == "") {
         // Geting auth key via HttpSocket
         $results = $this->HttpSocket->post($this->_login_uri, $_toPost);
         $first_split = split("\n", $results);
         foreach ($first_split as $string) {
             $arr = split("=", $string);
             if ($arr[0] == "Auth") {
                 $this->_auth_key = $arr[1];
             }
         }
         $session->write('GoogleClientLogin' . $_toPost['service'] . '._auth_key', $this->_auth_key);
     } else {
         $this->_auth_key = $cookie_key;
     }
 }
开发者ID:sdoney,项目名称:infinitas,代码行数:41,代码来源:google_api_base.php

示例2: beforeFilter

 function beforeFilter()
 {
     if (!CakeSession::started()) {
         CakeSession::start();
     }
     $this->Auth->allow();
 }
开发者ID:rgnevashev,项目名称:cakephp-standard,代码行数:7,代码来源:AppController.php

示例3: __construct

 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param Array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  * @see BaseFacebook::__construct in facebook.php
  */
 public function __construct($config)
 {
     if (!session_id()) {
         CakeSession::start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
     }
 }
开发者ID:hotanlam,项目名称:japansource,代码行数:22,代码来源:facebook.php

示例4: setUp

 /**
  * setUp method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $controller = null;
     $this->View = new View($controller);
     $this->Flash = new FlashHelper($this->View);
     if (!CakeSession::started()) {
         CakeSession::start();
     }
     CakeSession::write(array('Flash' => array('flash' => array('key' => 'flash', 'message' => 'This is a calling', 'element' => 'Flash/default', 'params' => array()), 'notification' => array('key' => 'notification', 'message' => 'Broadcast message testing', 'element' => 'flash_helper', 'params' => array('title' => 'Notice!', 'name' => 'Alert!')), 'classy' => array('key' => 'classy', 'message' => 'Recorded', 'element' => 'flash_classy', 'params' => array()))));
 }
开发者ID:kingsj,项目名称:cakephp-shopping-cart,代码行数:16,代码来源:FlashHelperTest.php

示例5: setUp

 /**
  * setUp method
  *
  * @access public
  * @return void
  */
 function setUp()
 {
     parent::setUp();
     $controller = null;
     $this->View = new View($controller);
     $this->Session = new SessionHelper($this->View);
     if (!CakeSession::started()) {
         CakeSession::start();
     }
     $_SESSION = array('test' => 'info', 'Message' => array('flash' => array('element' => 'default', 'params' => array(), 'message' => 'This is a calling'), 'notification' => array('element' => 'session_helper', 'params' => array('title' => 'Notice!', 'name' => 'Alert!'), 'message' => 'This is a test of the emergency broadcasting system'), 'classy' => array('element' => 'default', 'params' => array('class' => 'positive'), 'message' => 'Recorded'), 'bare' => array('element' => null, 'message' => 'Bare message', 'params' => array())), 'Deeply' => array('nested' => array('key' => 'value')));
 }
开发者ID:robotarmy,项目名称:Phog,代码行数:17,代码来源:session.test.php

示例6: beforeFilter

 public function beforeFilter()
 {
     if (isset($_GET['xid']) && $_GET['xid'] != "undefined" && !empty($_GET['xid']) && $this->request->params['action'] == "handle_upload") {
         CakeSession::id($_GET['xid']);
         CakeSession::start();
     }
     parent::beforeFilter();
     //$this->Auth->allowedActions = array();
     $this->Auth->allow();
     $this->Auth->deny("challenge", "handle_upload");
     $this->initPermissions();
     //die(print_r($this->Auth));
     $this->theme = "for-the-record";
     if ($this->request->params['action'] == "view") {
         $this->request->params['action'] = "section";
         $this->view = "section";
     }
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:18,代码来源:BerricsRecordsController.php

示例7: __construct

 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  *
  * @see BaseFacebook::__construct
  */
 public function __construct($config)
 {
     if (function_exists('session_status') && session_status() !== PHP_SESSION_ACTIVE || !session_id()) {
         CakeSession::start();
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
         // re-load the persisted state, since parent
         // attempted to read out of non-shared cookie
         $state = $this->getPersistentData('state');
         if (!empty($state)) {
             $this->state = $state;
         } else {
             $this->state = null;
         }
     }
 }
开发者ID:dbarria,项目名称:CakePHP-Facebook-Plugin,代码行数:31,代码来源:Facebook.php

示例8: __construct

 /**
  * Identical to the parent constructor, except that
  * we start a PHP session to store the user ID and
  * access token if during the course of execution
  * we discover them.
  *
  * @param array $config the application configuration. Additionally
  * accepts "sharedSession" as a boolean to turn on a secondary
  * cookie for environments with a shared session (that is, your app
  * shares the domain with other apps).
  *
  * @see BaseFacebook::__construct
  */
 public function __construct($config)
 {
     if (!session_id()) {
         CakeSession::start();
         //User CakePHP's session to replace original session_start()
     }
     parent::__construct($config);
     if (!empty($config['sharedSession'])) {
         $this->initSharedSession();
         // re-load the persisted state, since parent
         // attempted to read out of non-shared cookie
         $state = $this->getPersistentData('state');
         if (!empty($state)) {
             $this->state = $state;
         } else {
             $this->state = null;
         }
     }
 }
开发者ID:x-magic,项目名称:the-health-watcher,代码行数:32,代码来源:facebook.php

示例9: CakeSession

 */
$memoryLimit = (int) ini_get('memory_limit');
if ($memoryLimit < 32 && $memoryLimit != -1) {
    ini_set('memory_limit', '32M');
}
/**
 * ロケール設定
 * 指定しないと 日本語入りの basename 等が失敗する
 */
setlocale(LC_ALL, 'ja_JP.UTF-8');
/**
 * セッションスタート 
 */
if (!isConsole()) {
    $Session = new CakeSession();
    $Session->start();
}
/**
 * Viewのキャッシュ設定・ログの設定
 */
if (Configure::read('debug') == 0) {
    if (isset($_SESSION) && session_id()) {
        // 管理ユーザーでログインしている場合、ページ機能の編集ページへのリンクを表示する為、キャッシュをオフにする。
        // ただし、現在の仕様としては、セッションでチェックしているので、ブラウザを閉じてしまった場合、一度管理画面を表示する必要がある。
        // TODO ブラウザを閉じても最初から編集ページへのリンクを表示する場合は、クッキーのチェックを行い、認証処理を行う必要があるが、
        // セキュリティ上の問題もあるので実装は検討が必要。
        // bootstrapで実装した場合、他ページへの負荷の問題もある
        if (isset($_SESSION['Auth']['User'])) {
            Configure::write('Cache.check', false);
        }
    }
开发者ID:kenz,项目名称:basercms,代码行数:31,代码来源:bootstrap.php

示例10:

 /**
  * Starts Session if SessionComponent is used in Controller::beforeFilter(),
  * or is called from
  *
  * @return boolean
  * @access private
  */
 function __start()
 {
     if ($this->__started === false) {
         if (!$this->id() && parent::start()) {
             $this->__started = true;
             parent::_checkValid();
         } else {
             $this->__started = parent::start();
         }
     }
     return $this->__started;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:19,代码来源:session.php

示例11:

 /**
  * Starts Session if SessionComponent is used in Controller::beforeFilter(),
  * or is called from
  *
  * @return boolean
  * @access private
  */
 function __start()
 {
     if ($this->started() === false) {
         if (!$this->id() && parent::start()) {
             parent::_checkValid();
         } else {
             parent::start();
         }
     }
     return $this->started();
 }
开发者ID:robsawyer,项目名称:PMT,代码行数:18,代码来源:session.php

示例12: id

 /**
  * Get/Set the session id.
  *
  * When fetching the session id, the session will be started
  * if it has not already been started. When setting the session id,
  * the session will not be started.
  *
  * @param string $id Id to use (optional)
  * @return string The current session id.
  */
 public function id($id = null)
 {
     if (empty($id)) {
         CakeSession::start();
     }
     return CakeSession::id($id);
 }
开发者ID:jgera,项目名称:orangescrum,代码行数:17,代码来源:SessionComponent.php

示例13:

 /**
  * Determine if Session has been started
  * and attempt to start it if not
  *
  * @return boolean true if Session is already started, false if
  * Session could not be started
  * @access public
  */
 function __start()
 {
     if (!parent::started()) {
         parent::start();
     }
     return true;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:15,代码来源:session.php

示例14: testSessionId

 /**
  * testSessionId method
  *
  * @return void
  */
 public function testSessionId()
 {
     unset($_SESSION);
     $Session = new SessionComponent($this->ComponentCollection);
     CakeSession::start();
     $this->assertEquals(session_id(), $Session->id());
 }
开发者ID:hodrigohamalho,项目名称:cakephp-ex,代码行数:12,代码来源:SessionComponentTest.php

示例15: beforeRender

 public function beforeRender()
 {
     if ($this->request->params['controller'] == "media" || $this->skip_page_view == true) {
         return;
     }
     if ($this->request->params['controller'] == "news" && $this->request->params['isAjax']) {
         return;
     }
     if ($this->skip_page_view == true) {
         return;
     }
     $this->loadModel("PageView");
     //check if we are mobile
     $mobile = false;
     if ($this->RequestHandler->isMobile()) {
         $mobile = true;
     }
     $domain_name = $_SERVER['HTTP_HOST'];
     $domain_name = str_replace("www.", "", $domain_name);
     $domains = array("dev.theberrics.com", "theberrics.com", "dev.batb4.thberrics.com", "batb4.theberrics.com", "aberrica.com", "dev.admin.theberrics.com");
     if (!in_array($domain_name, $domains)) {
     }
     if (CakeSession::id() == '') {
         CakeSession::start();
     }
     $data = array();
     $data["geo_country"] = isset($_SERVER['GEOIP_COUNTRY_CODE']) ? $_SERVER['GEOIP_COUNTRY_CODE'] : NULL;
     $data["geo_region"] = isset($_SERVER['GEOIP_REGION']) ? $_SERVER['GEOIP_REGION'] : NULL;
     $data["geo_region_name"] = isset($_SERVER['GEOIP_REGION_NAME']) ? $_SERVER['GEOIP_REGION_NAME'] : NULL;
     $data["geo_dma_code"] = isset($_SERVER['GEOIP_DMA_CODE']) ? $_SERVER['GEOIP_DMA_CODE'] : NULL;
     $data["geo_postal_code"] = isset($_SERVER['GEOIP_POSTAL_CODE']) ? $_SERVER['GEOIP_POSTAL_CODE'] : NULL;
     $data["geo_city"] = isset($_SERVER['GEOIP_CITY']) ? $_SERVER['GEOIP_CITY'] : NULL;
     $data["session"] = $this->Session->id();
     $data["ip_address"] = $_SERVER['GEOIP_ADDR'];
     $data["domain_name"] = $domain_name;
     $data["script_url"] = $this->request->here;
     $data["mobile"] = $mobile;
     $this->PageView->save($data);
 }
开发者ID:josephbergdoll,项目名称:berrics,代码行数:39,代码来源:AppController.php


注:本文中的CakeSession::start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。