本文整理汇总了PHP中lithium\storage\Session类的典型用法代码示例。如果您正苦于以下问题:PHP Session类的具体用法?PHP Session怎么用?PHP Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Session类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: post
public function post()
{
$token = Session::read('oauth.access');
$result = Consumer::post('/1/statuses/update.json', array('status' => 'Testing my status'), compact('token'));
echo $result;
exit;
}
开发者ID:nateabele,项目名称:li3_oauth,代码行数:7,代码来源:FacebookController.php
示例2: check
public function check($credentials, array $options = array())
{
// This enables PHPBB login:
global $phpbb_root_path, $phpEx, $user, $auth, $template, $cache, $db, $config;
define('IN_PHPBB', true);
$phpbb_root_path = \app\util\Config::get('forum_path');
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'common.' . $phpEx;
// creates $user and $auth objects here.
$user->session_begin();
$logged_in = $user->data['is_registered'];
$username = strtolower($user->data['username_clean']);
if ($logged_in === false) {
// Not Logged In
return false;
}
$model = $this->_model;
$query = $this->_query;
$conditions = $this->_scope + array('prv_uid' => $username);
$id = $model::$query(compact('conditions'));
if (!$id) {
\lithium\storage\Session::write('non_linked_phpbb_login', true);
}
return $id;
}
开发者ID:aniston,项目名称:Platypus,代码行数:25,代码来源:Forum.php
示例3: _init
public function _init()
{
parent::_init();
if (!Session::read('user')) {
$this->redirect('Sessions::add');
}
}
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:7,代码来源:PaginasController.php
示例4: index
public function index()
{
Header('Cache-Control: no-cache');
Header('Pragma: no-cache');
$this->_render['layout'] = 'dialog';
$apontador['token'] = Session::read('apontadorToken');
$apontador['name'] = Session::read('apontadorName');
$apontador['email'] = Session::read('apontadorEmail');
$apontador['logged'] = !empty($apontador['token']);
$foursquare['token'] = Session::read('foursquareToken');
$foursquare['name'] = Session::read('foursquareName');
$foursquare['email'] = Session::read('foursquareEmail');
$foursquare['logged'] = !empty($foursquare['token']);
$twitter['token'] = Session::read('twitterToken');
$twitter['name'] = Session::read('twitterName');
$twitter['logged'] = !empty($twitter['token']);
$facebook['token'] = Session::read('facebookToken');
$facebook['name'] = Session::read('facebookName');
$facebook['email'] = Session::read('facebookEmail');
$facebook['logged'] = !empty($facebook['token']);
$orkut['token'] = Session::read('orkutToken');
$orkut['name'] = Session::read('orkutName');
$orkut['email'] = Session::read('orkutEmail');
$orkut['logged'] = !empty($orkut['token']);
$title = "Configurações de conta";
return \array_merge(compact('title', 'apontador', 'foursquare', 'twitter', 'facebook', 'orkut'));
}
开发者ID:EHER,项目名称:chegamos,代码行数:27,代码来源:SettingsController.php
示例5: Rates
public function Rates($FirstCurrency = "BTC", $SecondCurrency = "USD")
{
$title = $FirstCurrency . "/" . $SecondCurrency;
$back = strtolower($FirstCurrency . "_" . $SecondCurrency);
$Refresh = "No";
$user = Session::read('member');
$id = $user['_id'];
$details = Details::find('first', array('conditions' => array('user_id' => $id)));
if ($details['page.refresh'] == true || $details['page.refresh'] == 1) {
$data = array('page.refresh' => false);
Details::find('all', array('conditions' => array('user_id' => $id)))->save($data);
$Refresh = "Yes";
}
$URL = "/" . $locale . 'ex/x/' . $back;
$trades = Trades::find('first', array('conditions' => array('trade' => $title)));
if ($trades['refresh'] == true || $trades['refresh'] == 1) {
$data = array('refresh' => false);
Trades::find('all', array('conditions' => array('trade' => $title)))->save($data);
$Refresh = "Yes";
}
$mongodb = Connections::get('default')->connection;
$Rates = Orders::connection()->connection->command(array('aggregate' => 'orders', 'pipeline' => array(array('$project' => array('_id' => 0, 'Action' => '$Action', 'PerPrice' => '$PerPrice', 'Completed' => '$Completed', 'FirstCurrency' => '$FirstCurrency', 'SecondCurrency' => '$SecondCurrency', 'TransactDateTime' => '$Transact.DateTime')), array('$match' => array('Completed' => 'Y', 'FirstCurrency' => $FirstCurrency, 'SecondCurrency' => $SecondCurrency)), array('$group' => array('_id' => array('year' => array('$year' => '$TransactDateTime'), 'month' => array('$month' => '$TransactDateTime'), 'day' => array('$dayOfMonth' => '$TransactDateTime')), 'min' => array('$min' => '$PerPrice'), 'max' => array('$max' => '$PerPrice'))), array('$sort' => array('_id.year' => -1, '_id.month' => -1, '_id.day' => -1)), array('$limit' => 1))));
// print_r($Rates['result']);
foreach ($Rates['result'] as $r) {
$Low = $r['min'];
$High = $r['max'];
}
$Last = Orders::find('all', array('conditions' => array('Completed' => 'Y', 'FirstCurrency' => $FirstCurrency, 'SecondCurrency' => $SecondCurrency), 'limit' => 1, 'order' => array('Transact.DateTime' => 'DESC')));
foreach ($Last as $l) {
$LastPrice = $l['PerPrice'];
}
$TotalOrders = Orders::connection()->connection->command(array('aggregate' => 'orders', 'pipeline' => array(array('$project' => array('_id' => 0, 'Action' => '$Action', 'Amount' => '$Amount', 'Completed' => '$Completed', 'FirstCurrency' => '$FirstCurrency', 'SecondCurrency' => '$SecondCurrency', 'TransactDateTime' => '$Transact.DateTime', 'TotalAmount' => array('$multiply' => array('$Amount', '$PerPrice')))), array('$match' => array('Completed' => 'Y', 'Action' => 'Buy', 'FirstCurrency' => $FirstCurrency, 'SecondCurrency' => $SecondCurrency)), array('$group' => array('_id' => array('year' => array('$year' => '$TransactDateTime'), 'month' => array('$month' => '$TransactDateTime')), 'Amount' => array('$sum' => '$Amount'), 'TotalAmount' => array('$sum' => '$TotalAmount'))), array('$sort' => array('_id.year' => -1, '_id.month' => -1)), array('$limit' => 1))));
// print_r($SecondCurrency);
return $this->render(array('json' => array('Refresh' => $Refresh, 'URL' => $URL, 'Low' => number_format($Low, 5), 'High' => number_format($High, 5), 'Last' => number_format($LastPrice, 5), 'VolumeFirst' => number_format($TotalOrders['result'][0]['Amount'], 5), 'VolumeSecond' => number_format($TotalOrders['result'][0]['TotalAmount'], 3), 'VolumeFirstUnit' => $FirstCurrency, 'VolumeSecondUnit' => $SecondCurrency)));
}
开发者ID:nilamdoc,项目名称:msx,代码行数:35,代码来源:UpdatesController.php
示例6: init
/**
* 初始化CSRF并检查token是否存在, 不存在则生成token
*/
public static function init()
{
$value = \lithium\storage\Session::read(self::$_session_key);
if (empty($value)) {
RequestToken::get();
}
}
开发者ID:qujian,项目名称:rwe,代码行数:10,代码来源:CSRF.php
示例7: login
public function login()
{
$token = Session::read("{$this->_config['namespace']}.request");
if (empty($token)) {
return $this->redirect('Client::authorize', array('exit' => true));
}
return $this->redirect(Consumer::authenticate($token), array('exit' => true));
}
开发者ID:JacopKane,项目名称:li3_pecl_oauth,代码行数:8,代码来源:ClientController.php
示例8: array
function test_getFromSession()
{
Session::write(Trackers::$name, array(array('_trackPageview'), array('_setDomainName', 'example.org')), array('name' => 'default'));
Trackers::add('test', array('account' => 'test', 'adapter' => 'GoogleAnalytics', 'commands' => array(array('_setDomainName', 'example.org'))));
$expected = array(array('_setAccount', 'test'), array('_trackPageview'), array('_setDomainName', 'example.org'));
$tracking = Trackers::get('test');
$this->assertEqual($expected, $tracking->commands());
}
开发者ID:joseym,项目名称:li3_analytics,代码行数:8,代码来源:TrackersTest.php
示例9: login
public function login()
{
$token = Session::read('oauth.request');
if (empty($token)) {
$this->redirect('Client::authorize');
}
$this->redirect(Consumer::authenticate($token));
}
开发者ID:kevin-jones,项目名称:li3_oauth,代码行数:8,代码来源:ClientController.php
示例10: login
public function login()
{
Session::delete('oauth.request');
Session::delete('oauth.access');
$token = Consumer::token('request', array('params' => array('oauth_callback' => 'http://local.moodpik.com/tweet/success')));
Session::write('oauth.request', $token);
if (empty($token)) {
$this->redirect('Tweet::authorize');
}
$this->redirect(Consumer::authenticate($token));
}
开发者ID:nateabele,项目名称:li3_oauth,代码行数:11,代码来源:TweetController.php
示例11: testWriteReadDelete
public function testWriteReadDelete()
{
$key = 'test';
$value = 'value';
Session::write($key, $value, array('name' => 'test'));
$result = Session::read($key, array('name' => 'test'));
$this->assertEqual($value, $result);
$this->assertTrue(Session::delete($key, array('name' => 'test')));
$result = Session::read($key, array('name' => 'test'));
$this->assertNull($result);
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:11,代码来源:SessionPhpTest.php
示例12: testBasicAuthCheck
public function testBasicAuthCheck()
{
$this->assertFalse(Auth::check('test'));
$user = array('user' => 'bob');
$result = Auth::check('test', $user, array('success' => true));
$this->assertEqual($user, $result);
$result = Session::read('test');
$this->assertEqual($user, $result);
$result = Auth::check('test');
$this->assertEqual($user, $result);
}
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:11,代码来源:AuthTest.php
示例13: index
public function index()
{
$user = Session::read('default');
$id = $user['_id'];
$details = Details::find('first', array('conditions' => array('user_id' => (string) $id)));
$userInfo = Users::find('first', array('conditions' => array('_id' => (string) $id)));
$order = Orders::find('first', array('conditions' => array('user_id' => (string) $id, 'Completed' => 'N')));
$title = "API";
$keywords = "API, documentation, ibwt";
$description = "API documentation for ibwt.co.uk";
return compact('title', 'keywords', 'description', 'details', 'userInfo', 'order');
}
开发者ID:jorzhikgit,项目名称:spotcrypto.com,代码行数:12,代码来源:APIController.php
示例14: document
public function document()
{
$user = Session::read('member');
$id = md5($user['email']);
$document = Details::find('first', array('conditions' => array('user_id' => (string) $user['_id'])));
// if(count($document)==0){return $this->redirect('/');}
$uploadOk = 1;
if ($this->request->data) {
$extension = pathinfo($this->request->data['file']['name'], PATHINFO_EXTENSION);
$allowed = array('pdf');
if (!in_array(strtolower($extension), $allowed)) {
$msg = "Sorry, only PDF files are allowed.";
$uploadOk = 0;
}
if ($uploadOk = 1) {
$option = 'doc';
$data = array('details_' . $option . '_id' => (string) $document['_id'], 'docname' => $this->request->data['docname'], 'date' => $this->request->data['date'], 'DateTime' => new \MongoDate(), 'keywords' => $this->request->data['keywords'], 'description' => $this->request->data['description'], $option => $this->request->data['file'], $option . '.verified' => 'No', $option . '.IP' => $_SERVER['REMOTE_ADDR']);
$field = 'details_' . $option . '_id';
$Documents = Documents::create($data);
$saved = $Documents->save();
$fileData = array('file' => $this->request->data['file'], 'documents_' . $option . '_id' => (string) $Documents->_id);
$file = File::create();
if ($file->save($fileData)) {
$msg = "Upload OK";
}
$image_address = File::find('first', array('conditions' => array('documents_doc_id' => (string) $Documents->_id)));
if ($image_address['filename'] != "") {
$imagename_address = $image_address['_id'] . '_' . $image_address['filename'];
$path = LITHIUM_APP_PATH . '/webroot/download/' . $imagename_address;
file_put_contents($path, $image_address->file->getBytes());
}
// print_r($path);
$pages = $this->getPDFPages($path);
// Output: 13
// print_r($pages);exit;
unlink($path);
$docdata = array();
foreach ($pages as $page) {
$params = explode(":", $page);
$left = $params[0];
$right = $params[1];
$docdata = array_merge($docdata, array($left => trim($right)));
}
$data = array("document" => $docdata);
$conditions = array("_id" => (string) $Documents->_id);
Documents::update($data, $conditions);
// Use the function
}
}
return $this->redirect('ex::save');
}
开发者ID:nilamdoc,项目名称:OxOPDF,代码行数:51,代码来源:UploadController.php
示例15: load
public function load()
{
$this->populate(unserialize(Session::read('location')));
$lat = $this->point->getLat();
$lng = $this->point->getLng();
if (empty($lat) || empty($lng)) {
$city = new City();
$city->setName("São Paulo");
$city->setState("SP");
$this->point->setLat(-23.48033);
$this->point->setLng(-46.63459);
$this->address->setCity($city);
}
}
开发者ID:EHER,项目名称:chegamos,代码行数:14,代码来源:Location.php
示例16: delete
public function delete()
{
// Check Author authentication Session
if (!Auth::check('default')) {
return $this->redirect('Authors::login');
}
$book = Books::find($this->request->id);
if ($book && $book->delete()) {
Session::write('message', 'Book deleted');
$this->redirect(array('Authors::dashboard'));
} else {
Session::write('message', 'Book can not be deleted');
}
}
开发者ID:nicolasramy,项目名称:Book-Community,代码行数:14,代码来源:BooksController.php
示例17: testClear
public function testClear()
{
FlashMessage::write('Foo');
FlashMessage::clear();
$result = Session::read('message.default', array('name' => 'default'));
$this->assertNull($result);
FlashMessage::write('Foo 2', 'test1');
FlashMessage::clear('test1');
$result = Session::read('message.test1', array('name' => 'default'));
$this->assertNull($result);
FlashMessage::write('Foo 3', 'test2');
FlashMessage::write('Foo 4', 'test3');
FlashMessage::clear(null);
$result = Session::read('message', array('name' => 'default'));
$this->assertNull($result);
}
开发者ID:gavd,项目名称:li3_flash_message,代码行数:16,代码来源:FlashMessageTest.php
示例18: editar
public function editar($id)
{
$alliances = alliances::find('first', array('conditions' => array('_id' => $id)));
if ($this->request->data) {
$alliances->name = $this->request->data['name'];
$alliances->power = $this->request->data['power'];
$alliances->overlord = $this->request->data['overlord'];
if ($alliances->save()) {
Session::write('message', array('status' => 'green', 'msg' => 'projecto ' . $alliances->titulo . ' editado com sucesso'));
} else {
Session::write('message', array('status' => 'red', 'msg' => 'Falha ao editar ' . $alliances->titulo));
}
$this->redirect('alliances::index');
}
$alliancestrue = TRUE;
return compact('alliances', 'alliancestrue');
}
开发者ID:guoyu07,项目名称:admin-biarq-com,代码行数:17,代码来源:AlliancesController.php
示例19: facebook_login
/**
* Displays a basic Facebook Connect login button.
* Works with the PHP SDK to get the login URL.
* This does not use the JavaScript SDK for xfbml.
*
* @param $options Array
* @return String
*/
public function facebook_login(array $options = array())
{
$defaults = array('div' => 'fb_login', 'button_image' => '/li3_facebook/img/fb-login-button.png', 'button_alt' => 'Login with Facebook', 'additional_copy' => null, 'fb_login_url_session_key' => 'fb_login_url');
$options += $defaults;
$output = '';
$fb_login_url = Session::read($options['fb_login_url_session_key']);
if (!empty($fb_login_url)) {
if ($options['div'] !== false) {
$output .= '<div id="' . $options['div'] . '">' . $options['additional_copy'];
}
$output .= '<a href="' . $fb_login_url . '"><img src="' . $options['button_image'] . '" alt="' . $options['button_alt'] . '" /></a>';
if ($options['div'] !== false) {
$output .= '</div>';
}
}
return $output;
}
开发者ID:tmaiaroto,项目名称:li3_facebook,代码行数:25,代码来源:Facebook.php
示例20: getKYCWallet
public function getKYCWallet()
{
$kyc = $this->request->query['kyc'];
$opts = array('http' => array('method' => "GET", 'user_agent' => "MozillaXYZ/1.0"));
$context = stream_context_create($opts);
$json = file_get_contents('https://kycglobal.net/kyc/info/' . $kyc, false, $context);
$details = json_decode($json);
if ($details->percent > 60) {
$user = Session::read('default');
$data = array('kyc_id' => $kyc);
$conditions = array("walletid" => $user['walletid']);
Details::update($data, $conditions);
return $this->render(array('json' => array('success' => 1, 'email' => $details->email, 'name' => $details->details->Name->first . " " . $details->details->Name->last, 'phone' => $details->details->Mobile, 'score' => $details->score, 'percent' => $details->percent)));
} else {
return $this->render(array('json' => array('success' => 0)));
}
}
开发者ID:nilamdoc,项目名称:XGCWallet.org,代码行数:17,代码来源:KycController.php
注:本文中的lithium\storage\Session类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论