function getDataTemp($share)
 {
     $typeId = $share['typeId'];
     $cache = ts_cache('share_types');
     if (empty($cache)) {
         $cache = type_cache();
     }
     $temp = $cache[$typeId]['temp_list'];
     $data = unserialize($share['data']);
     $list_data = array_merge($share, $data);
     unset($list_data['data']);
     //dump($share);
     if ($temp) {
         foreach ($list_data as $k => $v) {
             //替换
             $v = h($v);
             $temp = str_replace('{' . $k . '}', $v, $temp);
         }
         $temp = str_replace('{WR}', SITE_URL, $temp);
         $temp = str_replace('{SITE_URL}', SITE_URL, $temp);
         return $temp;
     } else {
         return '';
     }
 }
 function getChoiceList()
 {
     //$arrApps = ts_cache('applist');
     if ($arrApps) {
         return $arrApps;
     } else {
         $map["status"] = array('in', array(0, 1));
         $list = $this->where($map)->order('order2 asc')->findAll();
         foreach ($list as $key => $val) {
             $APP_URL = str_replace('http://{APPS_URL}', SITE_URL . '/apps', $val['url']);
             $appid = $val['id'];
             $applist[$appid]['url'] = $APP_URL . '/' . $val['url_exp'];
             $applist[$appid]['uid_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['uid_url']);
             $applist[$appid]['add_url'] = str_replace('http://{APP_URL}', $APP_URL, $val['add_url']);
             $applist[$appid]['icon'] = str_replace('http://{APP_URL}', $APP_URL, $val['icon']);
             $applist[$appid]['id'] = $val['id'];
             $applist[$appid]['name'] = $val['name'];
             $applist[$appid]['enname'] = $val['enname'];
             $applist[$appid]['place'] = $val['place'];
             $applist[$appid]['canvas_url'] = $val['type'];
             $applist[$appid]['add_name'] = $val['add_name'];
             $applist[$appid]['status'] = $val['status'];
         }
         ts_cache('applist', $applist);
         return $applist;
     }
 }
 /**
  * _initialize
  * 初始化函数
  *
  * 初始化数据模型,用户ID
  * @param string $aArgs 参数说明
  * @access public
  * @return void
  */
 public function _initialize()
 {
     $this->model = D('Share');
     $this->Cmodel = D('ShareType');
     $this->types = ts_cache('share_types');
     if (empty($this->types)) {
         $this->types = type_cache();
     }
 }
 function updateCache()
 {
     $data = $this->where("appname='thinksns'")->findAll();
     foreach ($data as $k => $v) {
         $opts[$v["name"]] = $v["value"];
     }
     //缓存起来
     ts_cache("site_options", $opts);
 }
示例#5
0
function getC($name)
{
    $config = ts_cache('gift_config');
    if (empty($value[$name])) {
        $config = D('AppConfig')->getConfig();
        ts_cache('gift_config', $config);
    }
    return $config[$name];
}
 function getGuestPopedom()
 {
     $list = ts_cache('guestpopedom');
     if (!$list) {
         $list = $this->getNodeList(0);
         ts_cache('guestpopedom', $list);
     }
     return $list;
 }
 public function getCreditType()
 {
     $cache = ts_cache('credit_type');
     if (!$cache) {
         $cache = $this->getAllType();
         //存储缓存
         ts_cache('credit_type', $cache);
     }
     return $cache;
 }
 public function render($data)
 {
     $bq_emotion = ts_cache('smile_mini');
     $data['next'] = "下一页";
     $data['prev'] = "上一页";
     $data['perpage'] = 10;
     $data['bq_emotion'] = $bq_emotion;
     $content = $this->renderFile("Comment", $data);
     return $content;
 }
 public function getSmile($type)
 {
     $smile = ts_cache("smile_mini");
     if ($smile) {
         return $smile;
     } else {
         $data = $this->where("type='mini'")->findAll();
         return $data;
         //return $this->setCache( $data,$type );
     }
 }
 function get()
 {
     $opts = ts_cache("site_options");
     if (!$opts) {
         $map['appname'] = 'thinksns';
         $data = $this->where($map)->findAll();
         foreach ($data as $k => $v) {
             $opts[$v["name"]] = $v["value"];
         }
         //缓存起来
         ts_cache("site_options", $opts);
     }
     return $opts;
 }
 /**
  * replaceContent
  * 替换内容
  * @param mixed $content
  * @access private
  * @return void
  */
 private function replaceContent($content, $type)
 {
     //TODO 每一个应用可以应用一套表情
     $path = __PUBLIC__ . "/images/biaoqing/mini/";
     //路径
     $smile = ts_cache("smile_mini");
     //循环替换掉文本中所有ubb表情
     foreach ($smile as $value) {
         $img = sprintf("<img title='%s' src='%s%s'>", $value['title'], $path, $value['filename']);
         $content = str_replace($value['emotion'], $img, $content);
     }
     return $content;
 }
 /**
  * _setCache 
  * 设置缓存
  * @param mixed $id 
  * @param mixed $uid 
  * @access private
  * @return void
  */
 private function _setCache()
 {
     $this->_cache['endTime'] = time() + self::$lefttime;
     return ts_cache(self::$type . 'browse', $this->_cache);
 }
 public function setCache()
 {
     $cache = $this->getAllType();
     //存储缓存
     ts_cache('credit_type', $cache);
 }
 protected function upCache()
 {
     ts_cache('applist', '');
 }
 function dobackup()
 {
     $volume = isset($_GET['volume']) ? intval($_GET['volume']) + 1 : 1;
     $filename = date('ymd') . '_' . substr(md5(uniqid(rand())), 0, 10);
     $tables = array();
     $type = $_REQUEST['type'];
     if ($type == 'all') {
         //备份所有数据
         $tables = D('BackUp')->getTableList();
         $tables = D('BackUp')->arraykey($tables, 'Name');
     } elseif ($type == 'custom') {
         if ($_POST['setup']) {
             $tables = empty($_REQUEST['tablecustom']) ? array() : $_REQUEST['tablecustom'];
             ts_cache('tablecustom', $tables);
             //放入缓存
         } else {
             $tables = ts_cache('tablecustom');
         }
     }
     $filename = trim($_REQUEST['filename']) ? trim($_REQUEST['filename']) : $filename;
     $startfrom = intval($_REQUEST['startform']);
     $tableid = intval($_REQUEST['tableid']);
     $sizelimit = intval($_REQUEST['sizelimit']) ? intval($_REQUEST['sizelimit']) : 1000;
     $tablenum = count($tables);
     $filesize = $sizelimit * 1000;
     $complete = true;
     $tabledump = '';
     if ($tablenum == 0) {
         $this->error('请选择备份的表');
     }
     for (; $complete && $tableid < $tablenum && strlen($tabledump) + 500 < $filesize; $tableid++) {
         $sqlDump = D('BackUp')->sqlDumpTable($tables[$tableid], $startfrom, $filesize, strlen($tabledump), $complete);
         $tabledump .= $sqlDump['tabledump'];
         $complete = $sqlDump['complete'];
         $startfrom = intval($sqlDump['startform']);
         if ($complete) {
             $startfrom = 0;
         }
     }
     !$complete && $tableid--;
     if (trim($tabledump)) {
         $filepath = './data/database/' . $filename . "_{$volume}" . '.sql';
         $fp = @fopen($filepath, 'wb');
         if (!fwrite($fp, $tabledump)) {
             //$this->error('文件目录写入失败');
         } else {
             $url = __APP__ . "/Expert/dobackup/filename/{$filename}/type/{$type}/sizelimit/{$sizelimit}/tableid/{$tableid}/startform/{$startfrom}/volume/{$volume}";
             file_put_contents('1.txt', $url);
             //header('Location:$ur;');
             $this->assign('jumpUrl', $url);
             $this->success("备份第{$volume}卷成功");
         }
     } else {
         $url = __APP__ . "/Expert/backup";
         $this->assign('jumpUrl', $url);
         $this->success("备份成功");
     }
 }
 public function setCache()
 {
     $cache = $this->getAll();
     //存储缓存
     ts_cache('rank_rule', $cache);
 }
 private function setCache()
 {
     ts_cache('miniconfig', "");
     $request = $this->findAll();
     if (!$request) {
         return false;
     }
     foreach ($request as $value) {
         $result[$value['variable']] = $value['value'];
     }
     ts_cache('miniconfig', $result);
     return true;
 }
示例#18
0
function ubb($content)
{
    if (empty($content)) {
        return '';
    }
    $path = __PUBLIC__ . "/images/biaoqing/mini/";
    //路径
    //TODO 多应用表情
    $smile = ts_cache("smile_mini");
    //循环替换掉文本中所有ubb表情
    foreach ($smile as $value) {
        $img = sprintf("<img title='%s' src='%s%s'>", $value['title'], $path, $value['filename']);
        $content = str_replace($value['emotion'], $img, $content);
    }
    return $content;
}
示例#19
0
function type_cache()
{
    $types = D('ShareType')->where("state=0")->order('sort asc')->findAll();
    $arr = array();
    foreach ($types as $k => $v) {
        $id = $v['id'];
        unset($v['id']);
        foreach ($v as $k1 => $v1) {
            $arr[$id][$k1] = $v1;
        }
    }
    ts_cache('share_types', $arr);
    return $arr;
}
 private function rebuildCache()
 {
     ts_cache($this->appname . 'config', "");
     $request = $this->where("appname='{$this->appname}'")->findAll();
     if (!$request) {
         return false;
     }
     foreach ($request as $value) {
         $result[$value['name']] = $value['value'];
     }
     ts_cache($this->appname . '_config', $result);
     return true;
 }
示例#21
0
function GFW($string)
{
    if (!is_array($string)) {
        $site_opts = ts_cache("site_options");
        $badkey = $site_opts["gfw_keywords"];
        $gfw_rep = $site_opts["gfw_rep"];
        $string = preg_replace("/{$badkey}/i", $gfw_rep, $string);
        if (!MAGIC_QUOTES_GPC) {
            //统一将$_POST $_GET $_REQUEST的值进行转义
            $string = addslashes($string);
        }
        return $string;
    } else {
        foreach ($string as $key => $val) {
            $string[$key] = GFW($val);
        }
        return $string;
    }
}
 private function setCache($data)
 {
     $cache = array();
     foreach ($data as $value) {
         $type[] = $value['type'];
         $cache[$value['type']][$value['id']]['title'] = $value['title'];
         $cache[$value['type']][$value['id']]['emotion'] = $value['emotion'];
         $cache[$value['type']][$value['id']]['filename'] = $value['filename'];
     }
     foreach ($type as $value) {
         $result = ts_cache('smile_' . $value, $cache[$value]);
     }
     if ($result) {
         return $cache[APP_NAME];
     }
     return false;
 }
 public function cache()
 {
     if ($xxx = ts_cache("bbb")) {
         dump("cache");
         dump($xxx);
         $ttt = ts_cache("bbb", "");
         dump($ttt);
         $ccc = ts_cache("ccc");
         dump($ccc);
     } else {
         dump("set");
         $xxx["aaa"] = "haha";
         //sql操作 ....
         $xxx["bbb"] = "hehe";
         ts_cache("bbb", $xxx, 10);
         ts_cache("ccc", "ccc", 10);
         dump($xxx);
     }
 }