function __construct($modelid, $catid = 0, $categorys = array())
 {
     $this->modelid = $modelid;
     $this->catid = $catid;
     $this->categorys = $categorys;
     $this->fields = F("Model_field_" . $modelid);
 }
 /**
  * 主页
  */
 public function friend()
 {
     //获取好友列表
     $mfriend_list = F('mfriend_list' . $this->qq['qq']);
     $mfriend_list = null;
     if (!unserialize($mfriend_list)) {
         $url = "http://r.cnc.qzone.qq.com/cgi-bin/tfriend/friend_mngfrd_get.cgi?uin=" . $this->qq['qq'] . "&rd=" . rand(1, 999) . "&g_tk=" . $this->qq['gtk'];
         $result = $this->sendToQq($url);
         $result = $this->filterCallback($result);
         $results = json_decode($result);
         F('mfriend_list' . $this->qq['qq'], serialize($results));
     } else {
         $results = unserialize($mfriend_list);
     }
     $datas = $results->items;
     $gpnames = $results->gpnames;
     //存储相关数据
     //F('fl_' . $this->qq['qq'], $results);
     $this->groud = $gpnames;
     //$this->autoZantask = F('zan_lock_' . $this->qq['qq']);
     //$this->autoCommtask = F('comm_lock_' . $this->qq['qq']);
     //设置cookie
     $this->assign("qq", $this->qq['qq']);
     $this->assign("groud", $gpnames);
     $this->assign("data", $datas);
     $this->display();
 }
Example #3
0
 /**
  * 专辑分类
  * 如果用户传入了非默认field,order则直接查询数据库,所以不推荐传入这些参数
  * @param array $options 
  */
 public function cate($options)
 {
     $options['field'] = isset($options['field']) ? trim($options['field']) : '*';
     $options['where'] = isset($options['where']) ? trim($options['where']) : '';
     $options['num'] = isset($options['num']) ? intval($options['num']) : 0;
     $options['order'] = isset($options['order']) ? trim($options['order']) : 'ordid';
     if ($options['field'] != '*' || $options['where'] || $options['order'] != 'ordid') {
         $album_cate_mod = M('album_cate');
         $map = array('status' => '1');
         $select = $album_cate_mod->field($options['field']);
         //字段
         $options['where'] && ($map['_string'] = $options['where']);
         $select->where($map);
         //条件
         $options['num'] && $select->limit($options['num']);
         //个数
         $select->order($options['order']);
         //排序
         $data = $select->select();
     } else {
         //分类缓存
         if (false === ($cate_list = F('album_cate_list'))) {
             $cate_list = D('album_cate')->cate_cache();
         }
         $options['num'] && ($cate_list = array_slice($cate_list, 0, $options['num']));
         $data = $cate_list;
     }
     return $data;
 }
 public function __construct()
 {
     parent::__construct();
     $this->assign('controller', CONTROLLER_NAME);
     //读取配置信息
     $web_stting = F('setting');
     if ($web_stting === false) {
         $params = array();
         $list = M('Setting')->getField('name,value');
         foreach ($list as $key => $val) {
             $params[$key] = unserialize($val) ? unserialize($val) : $val;
         }
         F('setting', $params);
         $web_stting = F('setting');
     }
     $this->web_stting = $web_stting;
     //站点状态判断
     if ($this->web_stting['site_status'] != 1) {
         echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
         echo $this->web_stting['closed_reason'];
         exit;
     } else {
         $this->assign('seo', seo());
     }
     //检查登录
     /* session('member_id',null);
     		if(!session('member_id'))
     		{
     			$this->wx_auto_login(); //自动登录	
     		}
     		$this->mid = session('member_id'); */
     $this->mid = 10;
     $this->m_info = M('Member')->where('member_id=' . $this->mid)->find();
 }
Example #5
0
 public function update_cache()
 {
     //获得表中的所有栏目数据
     $category = Data::tree($this->all(), 'cname');
     return F("category", $category);
     //file_put_contents()储存文件缓存
 }
Example #6
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     /**
      * 验证圈子是否开启
      */
     if (C('circle_isuse') != '1') {
         @header('location: ' . SHOP_SITE_URL);
         die;
     }
     /**
      * 读取通用、布局的语言包
      */
     Language::read('common');
     /**
      * 设置布局文件内容
      */
     Tpl::setLayout('circle_layout');
     /**
      * 查询是否是超管
      */
     $this->checkSuper();
     /**
      * 获取导航
      */
     Tpl::output('nav_list', ($nav = F('nav')) ? $nav : rkcache('nav', true, 'file'));
 }
Example #7
0
function G()
{
    static $myvar = 4;
    echo "{$myvar} ";
    echo F();
    echo "{$myvar}";
}
 public function index()
 {
     //URL规则
     $urlrules = F('urlrules');
     $where = array();
     if (isset($_GET['tagid'])) {
         $where['tagid'] = array("EQ", (int) $this->_get("tagid"));
         $r = M("Tags")->where($where)->find();
         $where['tag'] = $r['tag'];
         unset($where['tagid']);
     } else {
         $where['tag'] = array("EQ", $this->_get("tag"));
     }
     $data = M("Tags")->where($where)->find();
     if (!$data) {
         $this->error("该Tag不存在!");
     }
     $this->assign($data);
     M("Tags")->where($where)->setInc("hits");
     M("Tags")->where($where)->save(array("lasthittime" => time()));
     $page = $this->_get(C("VAR_PAGE"));
     $this->assign("page", $page);
     $urlrules = $urlrules[CONFIG_TAGURL];
     define('URLRULE', str_replace('|', '~', str_replace(array('{$tag}', '{$tagid}'), array($this->_get('tag'), (int) $this->_get("tagid")), $urlrules)));
     $SEO = seo();
     //seo分配到模板
     $this->assign("SEO", $SEO);
     //把分页分配到模板
     $this->assign(C("VAR_PAGE"), $page);
     $this->display("Tags:tag");
 }
 /**
  * 系统初始化方法
  *
  * @access protected
  */
 protected function _initialize()
 {
     header("Content-type:text/html;charset=utf-8");
     Load('extend');
     $this->ajax = $this->IS_AJAX;
     $this->post = strtolower($_SERVER['REQUEST_METHOD']) == 'post';
     $this->ip = get_client_ip();
     $this->timestamp = time();
     $this->root_path = dirname($_SERVER['PHP_SELF']);
     $this->root_path = $this->root_path == '\\' || $this->root_path == '/' ? '' : $this->root_path;
     define('__ROOT_PATH__', $this->root_path);
     C('TMPL_PARSE_STRING.__ROOT_PATH__', __ROOT_PATH__);
     $this->site_cfg = F('site_cfg');
     $this->assign('site_cfg', $this->site_cfg);
     define('__TPL_PATH__', '/Application/Home/View');
     C('TMPL_PARSE_STRING.__TPL_PATH__', __TPL_PATH__);
     $this->upload_dir = $this->root_path . '/upload/';
     define('__UPLOAD_PATH__', $this->upload_dir);
     C('TMPL_PARSE_STRING.__UPLOAD_PATH__', __UPLOAD_PATH__);
     // 如果当前用户验证身份cookie有效则获取相用户信息
     $_SESSION['auth'] = isset($_SESSION['auth']) ? $_SESSION['auth'] : '';
     if ($_SESSION['auth'] != '' && $this->validAuthCookie()) {
         C('formtoken_extra', $this->user['mid'] . $this->user['password']);
     }
     if (method_exists($this, '_init')) {
         $this->_init();
     }
 }
Example #10
0
 public function updateVerify()
 {
     //verify配置文件源码
     /*//验证码长度
     'VERIFY_LENGTH' => '2', 
     //验证码图片宽度(像素)
     'VERIFY_WIDTH' => '100', 
     //验证码图片高度(像素
     'VERIFY_HEIGHT' => '35', 
     //验证码背影颜色(16进制色值
     'VERIFY_BGCOLOR' => '#ffffff',
     //验证码种子
     'VERIFY_SEED' => '3456789aAbBcCdDeEfFgGhHjJkKmMnNpPqQrRsStTuUvVwWxXyY',
     //验证码字体文件
     'VERIFY_FONTFILE' => './Data/font.ttf',
     //验证码字体大小
     'VERIFY_SIZE' => '25', 
     //验证码字体颜色(16进制色值)
     'VERIFY_COLOR' => '#444', 
     //SESSION识别名称
     'VERIFY_NAME' => 'verify', 
     //存储验证码到SESSION时使用函数
     'VERIFY_FUNC' => 'strtolower', */
     if (F('verify', $_POST, CONF_PATH)) {
         $this->SUCCESS('修改成功', U(GROUP_NAME . '/System/verify'));
     } else {
         $this->error('修改失败' . CONF_PATH . 'verify.php权限');
     }
 }
Example #11
0
 public function testBack()
 {
     $arrays = ['a', 'b', 'c', 'd'];
     $expect = ['c', 'd'];
     $actual = F()->back(2, $arrays)->call();
     $this->assertEquals($expect, $actual);
 }
 public function edit()
 {
     if (IS_POST) {
         $db = D("Domains");
         $data = $db->create();
         if ($data) {
             $status = $db->editDomains($data);
             if ($status !== false) {
                 $this->success("编辑成功,请及时更新缓存!");
                 F("Domains_list", null);
             } else {
                 $this->error("编辑失败!");
             }
         } else {
             $this->error($db->getError());
         }
     } else {
         $db = M("Domains");
         $id = (int) $this->_get("id");
         $info = $db->where(array("id" => $id))->find();
         if (!$info) {
             $this->error("该信息不存在!");
         }
         $this->assign($info);
         $this->display();
     }
 }
 function __construct($modelid, $id)
 {
     $this->modelid = $modelid;
     $this->fields = F("Model_field_" . $modelid);
     $this->id = $id;
     load("@.treatfun");
 }
Example #14
0
 public function testIfFalse()
 {
     $person = (object) ['gender' => 'male'];
     $expect = 'Woman';
     $actual = F($person)->if(F()->gender->equalTo('male')->not(), F('Man'), F('Woman'))->call();
     $this->assertEquals($expect, $actual);
 }
Example #15
0
 /**
  * 第三方登陆模块
  */
 private function _assign_oauth()
 {
     if (false === ($oauth_list = F('oauth_list'))) {
         $oauth_list = D('oauth')->oauth_cache();
     }
     $this->assign('oauth_list', $oauth_list);
 }
Example #16
0
 function _initialize()
 {
     parent::_initialize();
     $this->dao = D('User');
     $this->usergroup = F('Role');
     $this->assign('usergroup', $this->usergroup);
 }
Example #17
0
 /**
  * 前台台控制器初始化
  */
 protected function _initialize()
 {
     // plugin('Fangke');
     /* 读取数据库中的配置 */
     $config = F('DB_CONFIG_DATA');
     if (!$config || APP_DEBUG) {
         $config = api('Config/lists');
         F('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     C('TMPL_PARSE_STRING', array('__STATIC__' => __ROOT__ . '/Public/Static', '__IMG__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/images', '__CSS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/css', '__JS__' => __ROOT__ . '/Public/' . MODULE_NAME . '/' . C('DEFAULT_THEME') . '/js'));
     defined('__DB_PREFIX__') or define('__DB_PREFIX__', C('DB_PREFIX'));
     defined('UID') or define('UID', is_login());
     if (C('WEB_SITE_CLOSE') && UID != 1) {
         $this->show('网站维护中请稍后访问');
         die;
     }
     $str = run_plugin_method('Spider', 'addinfo');
     //var_dump($config);
     if (UID) {
         //登陆的情况
         //赋值当前登陆用户信息
         $uinfo = session('uinfo');
         $map[get_account_type($uinfo['username'])] = $uinfo['username'];
         $jin = __DB_PREFIX__ . "member_group as a on " . __DB_PREFIX__ . "member.member_group_id=a.member_group_id";
         $field = "*," . __DB_PREFIX__ . "member.status as status";
         $user = D('Member')->field($field)->where($map)->join($jin)->find();
         session('uinfo', $user);
         $this->assign('uinfo', $user);
     }
 }
 /**
  * 初始化后台菜单
  */
 private function initMenu()
 {
     $Menu = F("Menu");
     if (!$Menu) {
         D("Menu")->menu_cache();
     }
 }
Example #19
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     /**
      * 验证圈子是否开启
      */
     if (C('circle_isuse') != '1') {
         @header('location: ' . SiteUrl);
         die;
     }
     /**
      * 短消息检查
      */
     $this->checkMessage();
     /**
      * 读取通用、布局的语言包
      */
     Language::read('common');
     /**
      * 设置布局文件内容
      */
     Tpl::setLayout('circle_layout');
     /**
      * 获取导航
      */
     Tpl::output('nav_list', ($nav = F('nav')) ? $nav : H('nav', true, 'file'));
 }
Example #20
0
function setCounts($prefix, $worksID, $field, $opera = '+', $expire = 1800)
{
    // echo $prefix,$worksID,$field,$opera;
    $worksFlag = $prefix . '-' . $worksID;
    $countsDB = M('works_counts');
    $now = NOW_TIME;
    // dump(F($worksFlag));exit;
    if (!F($worksFlag)) {
        $countsInfo = $countsDB->where('works_id = ' . $worksID)->find();
        $clickInit = array('collect_counts' => $countsInfo['collect_counts'], 'comment_counts' => $countsInfo['comment_counts'], 'praise_counts' => $countsInfo['praise_counts'], 'click_counts' => $countsInfo['click_counts'], 'expire' => $now + $expire);
        F($worksFlag, $clickInit);
        // dump(F($worksFlag));
    }
    $clickData = F($worksFlag);
    if ($opera == '+') {
        $clickData[$field] += 1;
    } else {
        $clickData[$field] -= 1;
    }
    if ($clickData['expire'] < $now) {
        $countsDB->where('works_id = ' . $worksID)->setField($field, $clickData[$field]);
        $clickData['expire'] = $now + $expire;
    }
    F($worksFlag, $clickData);
    // dump(F($worksFlag));
    return F($worksFlag);
}
 public function index()
 {
     $moduleposlist = F('sys_modulepos_tree');
     if (empty($menulist)) {
         $moduleposlist = F_get_modulepos_list();
         F('sys_modulepos_tree', $moduleposlist);
     }
     $moduleposlist[0] = '全部位置';
     $field = array(array('field' => 'modulepos_id', 'name' => 'modulepos_id', 'type' => 'select', 'title' => '模块信息位置置', 'note' => '', 'extra' => $moduleposlist, 'is_show' => 3, 'value' => I('modulepos_id')));
     $this->assign('fieldarr', $field);
     $this->assign('data', null);
     $modulepos_id = I('modulepos_id');
     $title = I('title');
     //$modulepos_id=I('modulepos_id');
     //if(!empty($cat_id))$map['modulepos_id']=$cat_id;
     if (!empty($modulepos_id)) {
         $map[__DB_PREFIX__ . 'module.modulepos_id'] = $modulepos_id;
         $this->meta_title = '模块信息列表>模块信息位置>' . get_modulepos_title($modulepos_id);
     } else {
         $this->meta_title = '模块信息列表';
     }
     $map[__DB_PREFIX__ . 'module.title'] = array('like', '%' . $title . '%');
     //$map[__DB_PREFIX__.'module.status']=1;
     $this->pages(array('model' => 'Module', 'field' => '*,' . __DB_PREFIX__ . 'module.module_id as module_id,' . __DB_PREFIX__ . 'module.sort as sort,' . __DB_PREFIX__ . 'module.title as title,b.title as postitle,' . __DB_PREFIX__ . 'module.status as status', 'join' => __DB_PREFIX__ . 'modulepos as b on b.modulepos_id=' . __DB_PREFIX__ . 'module.modulepos_id', 'where' => $map, 'order' => __DB_PREFIX__ . 'module.modulepos_id,status asc,' . __DB_PREFIX__ . 'module.sort asc,' . __DB_PREFIX__ . 'module.module_id desc'));
     $this->display();
 }
Example #22
0
 /**
  * 分类列表
  */
 public function indexOp()
 {
     Language::read('home_category_index');
     $lang = Language::getLangContent();
     //得到分类类型
     $type = trim($_GET['type']);
     switch ($type) {
         case 'store':
             $model_sc = Model('store_class');
             $sc_list = $model_sc->getTreeList();
             //导航
             $nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_store_class']));
             $model_store = Model('store');
             //推荐店铺
             $recommend_store = $model_store->getRecommendStore(5);
             Tpl::output('recommend_store', $recommend_store);
             //最新店铺
             $new_store = $model_store->getNewStore(5);
             Tpl::output('new_store', $new_store);
             Tpl::output('nav_link_list', $nav_link);
             Tpl::output('sc_list', $sc_list);
             Tpl::showpage('category_store');
             break;
         default:
             //导航
             $nav_link = array('0' => array('title' => $lang['homepage'], 'link' => SiteUrl . '/index.php'), '1' => array('title' => $lang['category_index_goods_class']));
             //分类
             $show_goods_class = ($g = F('goods_class')) ? $g : H('goods_class', true, 'file');
             Tpl::output('nav_link_list', $nav_link);
             Tpl::output('gc_list', $show_goods_class);
             Tpl::output('html_title', C('site_name') . ' - ' . Language::get('category_index_goods_class'));
             Tpl::showpage('category_goods');
             break;
     }
 }
Example #23
0
 /**
  * 生成表结构信息
  *
  * @param string $table
  * @return
  */
 public function tableInfo($table)
 {
     if (empty($table)) {
         return false;
     }
     //只取主键,find(2)等自动匹配主键时使用
     if (file_exists(BASE_DATA_PATH . '/cache/fields/_pk.php')) {
         $this->fields = (require BASE_DATA_PATH . '/cache/fields/_pk.php');
     } else {
         $full_table = Db::showTables();
         $_pk_array = array();
         $count = strlen(C('tablepre'));
         foreach ($full_table as $v_table) {
             $v = array_values($v_table);
             if (substr($v[0], 0, $count) != C('tablepre')) {
                 continue;
             }
             $tb = str_replace(C('tablepre'), '', $v[0]);
             $fields = DB::showColumns($tb);
             foreach ((array) $fields as $k => $v) {
                 if ($v['primary']) {
                     $_pk_array[$tb] = $k;
                     break;
                 }
             }
         }
         $this->fields = $_pk_array;
         F('_pk', $_pk_array, 'cache/fields');
     }
     return $this->fields[$table];
 }
Example #24
0
/**
 * 获取指定位置的导航菜单
 * @param int $type 导航位置
 */
function WSTNavigation($type = 0)
{
    $URL_HTML_SUFFIX = C('URL_HTML_SUFFIX');
    $cururl = U(MODULE_NAME . "/" . CONTROLLER_NAME . "/" . ACTION_NAME);
    $cururl = str_ireplace("." . $URL_HTML_SUFFIX, '', $cururl);
    $areaId2 = (int) session('areaId2');
    $rs = F('navigation/' . $areaId2);
    if (!$rs) {
        $m = M();
        //获取所在省份
        $sql = "select parentId from __PREFIX__areas where areaId=" . $areaId2;
        $areaId1Rs = $m->query($sql);
        $areaId1 = (int) $areaId1Rs[0]['parentId'];
        $sql = "select navType,navTitle,navUrl,isShow,isOpen \n\t\t  from __PREFIX__navs where isShow=1 and (areaId1=0 or areaId1=" . $areaId1 . ") and (areaId2=0 or areaId2=" . $areaId2 . ") \n\t\t  order by navType asc,navSort asc";
        $rs = $m->query($sql);
        F('navigation/' . $areaId2, $rs);
    }
    foreach ($rs as $key => $v) {
        $rs[$key]['url'] = $cururl;
        if (stripos($v['navUrl'], 'https://') === false && stripos($v['navUrl'], 'http://') === false) {
            $rs[$key]['navUrl'] = WSTDomain() . "/" . $rs[$key]['navUrl'];
        }
        $rs[$key]['active'] = stripos($rs[$key]['navUrl'], $cururl) !== false ? 1 : 0;
        $rs[$key]['end'] = $key == count($rs) - 1 ? 1 : 0;
    }
    //分组
    $data = array();
    foreach ($rs as $key => $v) {
        $data[$v['navType']][] = $v;
    }
    return $data[$type];
}
Example #25
0
 function index()
 {
     $diyid = $this->_request('id', 'intval');
     !$diyid && $this->error(L('operation_failure'));
     $this->assign('id', $diyid);
     if (false === ($diyinfo = F('diyinfo_' . $diyid))) {
         $diyinfo = $this->_mod->get_diyform($diyid);
         exit;
     }
     if ($diyinfo['status'] == 0) {
         $this->error(sprintf(L('not_exist'), L('diyform')));
         exit;
     }
     $this->assign('diyinfo', $diyinfo);
     $this->assign('seo_title', $diyinfo['title']);
     //附加字段
     $fields = D('model_fields')->get_fields($diyid, array('mtype' => 2));
     $add_fields = D('model_fields')->fields_input($fields, 0, 2);
     if ($add_fields) {
         $this->assign('has_fields', true);
         $this->assign('add_fields', $add_fields);
         if ($add_fields['imglist']) {
             $this->assign('imglist', $add_fields['imglist']);
         }
         unset($add_fields['imglist']);
     }
     $this->assign('iframe_tools', true);
     $this->display();
 }
Example #26
0
 public function __construct()
 {
     parent::__construct();
     //读取配置信息
     $web_stting = F('setting');
     if ($web_stting === false) {
         $params = array();
         $list = M('Setting')->getField('name,value');
         foreach ($list as $key => $val) {
             $params[$key] = unserialize($val) ? unserialize($val) : $val;
         }
         F('setting', $params);
         $web_stting = F('setting');
     }
     $this->assign('web_stting', $web_stting);
     //站点状态判断
     if ($web_stting['site_status'] != 1) {
         echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
         echo $web_stting['closed_reason'];
         exit;
     } else {
         $this->check_login();
         $link = M('Link')->where(array('status' => 1))->order('sort DESC')->select();
         $this->assign('link', $link);
         $this->assign('seo', seo());
     }
 }
 /**
  * 快递查询
  */
 public function detail()
 {
     $data['id'] = $_GET['id'];
     $vo = $this->db->where($data)->find();
     $this->assign('vo', $vo);
     if (!$vo) {
         $this->error('物流信息不存在');
     }
     $dir = get_dir($vo['id']);
     if (file_exists(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php')) {
         $list = (include C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php');
     } else {
         include C('PUBLIC_INCLUDE') . "kuaidi.class.php";
         $kuaidi = new kuaidi();
         $list = $kuaidi->query($vo['shipping_code'], $vo['shipping_no']);
         krsort($list['data']);
         mk_dir(C('DATA_CACHE_PATH') . '/delivery/');
         if ($list['state'] == 3) {
             mk_dir(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
             F('list', $list, C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
         }
     }
     if ($list) {
         $list['count'] = count($list['data']);
     } else {
         $list['message'] = $kuaidi->error;
     }
     if (!$list) {
         $this->error($kuaidi->getError());
     } else {
         $result['data'] = $list;
         $result['notice'] = '查询成功';
         ajaxSucReturn($result);
     }
 }
 public function getAllExpression($flush = false)
 {
     $cache_id = '_model_expression';
     if (($res = F($cache_id)) === false || $flush === true) {
         global $ts;
         $pkg = $ts['site']['expression'];
         $filepath = SITE_PATH . '/public/themes/' . $ts['site']['site_theme'] . '/images/expression/' . $pkg;
         require_once ADDON_PATH . '/libs/Io/Dir.class.php';
         $expression = new Dir($filepath);
         $expression_pkg = $expression->toArray();
         $res = array();
         foreach ($expression_pkg as $value) {
             if (!is_utf8($value['filename'])) {
                 $value['filename'] = auto_charset($value['filename'], 'GBK', 'UTF8');
             }
             list($file) = explode(".", $value['filename']);
             $temp['title'] = $file;
             $temp['emotion'] = '[' . $file . ']';
             $temp['filename'] = $value['filename'];
             $temp['type'] = $pkg;
             $res[$temp['emotion']] = $temp;
         }
         F($cache_id, $res);
     }
     return $res;
 }
Example #29
0
 /**
  * 生成SEO缓存并返回
  *
  * @param string $type
  * @return array
  */
 private function getSeo($type)
 {
     if (!($list = F('seo'))) {
         $list = H('seo', true, 'file');
     }
     return $list[$type];
 }
 /**
  * 连接
  * @access public
  * @param array $options  配置数组
  * @return object
  */
 public static function connect($options = array())
 {
     if (isset($options['type']) && $options['type']) {
         $type = $options['type'];
         unset($options['type']);
     } else {
         //网站配置
         $config = F("Config");
         if ((int) $config['ftpstatus']) {
             $type = 'Ftp';
         } else {
             $type = 'Local';
         }
     }
     //附件存储方案
     $type = trim($type);
     $class = 'Attachment' . ucwords($type);
     import("Driver.Attachment.{$class}", LIB_PATH);
     if (class_exists($class)) {
         $Atta = new $class($options);
     } else {
         throw_exception('无法加载附件上传方案:' . $type);
     }
     return $Atta;
 }