本文整理汇总了PHP中lithium\storage\Session::read方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::read方法的具体用法?PHP Session::read怎么用?PHP Session::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lithium\storage\Session
的用法示例。
在下文中一共展示了Session::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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'));
}
示例3: 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)));
}
示例4: _init
public function _init()
{
parent::_init();
if (!Session::read('user')) {
$this->redirect('Sessions::add');
}
}
示例5: init
/**
* 初始化CSRF并检查token是否存在, 不存在则生成token
*/
public static function init()
{
$value = \lithium\storage\Session::read(self::$_session_key);
if (empty($value)) {
RequestToken::get();
}
}
示例6: 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));
}
示例7: login
public function login()
{
$token = Session::read('oauth.request');
if (empty($token)) {
$this->redirect('Client::authorize');
}
$this->redirect(Consumer::authenticate($token));
}
示例8: _init
public function _init()
{
$this->_render['negotiate'] = true;
parent::_init();
if (!Session::read('user')) {
$this->redirect('Sessions::add');
}
}
示例9: 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);
}
示例10: 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);
}
示例11: 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');
}
示例12: 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');
}
示例13: 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);
}
}
示例14: 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);
}
示例15: 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)));
}
}