mirror of
https://github.com/DzzXH/DzzOffice.git
synced 2026-04-08 06:05:12 +08:00
67 lines
1.6 KiB
PHP
67 lines
1.6 KiB
PHP
<?php
|
|
/* PHP SDK
|
|
* @version 2.0.0
|
|
* @author connect@qq.com
|
|
* @copyright © 2013, Tencent Corporation. All rights reserved.
|
|
*/
|
|
|
|
require_once(CLASS_PATH."ErrorCase.class.php");
|
|
class Recorder{
|
|
private static $data;
|
|
private $inc;
|
|
private $error;
|
|
|
|
public function __construct(){
|
|
$this->error = new ErrorCase();
|
|
|
|
//-------读取配置文件
|
|
$incFileContents = file(ROOT."comm/inc.php");
|
|
$incFileContents = $incFileContents[1];
|
|
$this->inc = json_decode($incFileContents);
|
|
if(empty($this->inc)){
|
|
$this->error->showError("20001");
|
|
}
|
|
|
|
if(empty($_SESSION['QC_userData'])){
|
|
self::$data = array();
|
|
}else{
|
|
self::$data = $_SESSION['QC_userData'];
|
|
}
|
|
}
|
|
|
|
public function write($name,$value){
|
|
self::$data[$name] = $value;
|
|
}
|
|
|
|
public function read($name){
|
|
if(empty(self::$data[$name])){
|
|
return null;
|
|
}else{
|
|
return self::$data[$name];
|
|
}
|
|
}
|
|
|
|
public function readInc($name){
|
|
global $_G;
|
|
if($name == 'appid'){
|
|
return $_G['setting']['qq_appid'];
|
|
}else if($name == 'appkey'){
|
|
return $_G['setting']['qq_appkey'];
|
|
}else if($name == 'callback'){
|
|
return $_G['siteurl'].urlencode('user.php?mod=qqlogin&type=callback');
|
|
}else if(empty($this->inc->$name)){
|
|
return $this->inc->$name;
|
|
}else{
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public function delete($name){
|
|
unset(self::$data[$name]);
|
|
}
|
|
|
|
function __destruct(){
|
|
$_SESSION['QC_userData'] = self::$data;
|
|
}
|
|
}
|