/**
  * 站点设置
  */
 public function site()
 {
     if (IS_POST) {
         $setting_db = D('Setting');
         if (I('get.dosubmit')) {
             $state = $setting_db->dosave($_POST['data']);
             $state ? $this->success('操作成功') : $this->error('操作失败');
         } else {
             if (S('setting_site')) {
                 $data = S('setting_site');
             } else {
                 $data = $setting_db->getSetting();
                 S('setting_site', $data);
             }
             $this->ajaxReturn($data);
         }
     } else {
         $menu_db = D('Menu');
         $currentpos = $menu_db->currentPos(I('get.menuid'));
         //栏目位置
         $propertygrid = array('options' => array('title' => $currentpos, 'url' => U('Setting/site', array('grid' => 'propertygrid')), 'toolbar' => 'setting_site_propertygrid_toolbar'));
         $this->assign('propertygrid', $propertygrid);
         $this->display();
     }
 }
Example #2
0
function getName($number, $pwd)
{
    $TRY_TIMES = 10;
    S(array('prefix' => 'verify', 'expire' => 3 * $TRY_TIMES));
    $verify_array = S('verify_array');
    if (!$verify_array) {
        $verify_array = array();
    }
    if (!in_array($number, $verify_array)) {
        array_push($verify_array, $number);
    } else {
        return false;
    }
    S('verify_' . $number, $pwd);
    S('verify_array', $verify_array);
    $i = 0;
    while ($i++ < $TRY_TIMES && S('verify_' . $number) == $pwd) {
        sleep(1);
    }
    $name = S('verify_' . $number);
    S(array('prefix' => ''));
    if ($i < $TRY_TIMES && $name != '0') {
        return $name;
    } else {
        return false;
    }
}
 public function index()
 {
     /* 下载链接 */
     $vo['data_setting'] = S('data_setting');
     $this->assign('vo', $vo);
     $this->display();
 }
Example #4
0
 /**
  * 读取数据 do_data
  */
 public function do_data()
 {
     $topic_id = I('get.id');
     /* 判断是否存在缓存 */
     $cache = S('HOME_TOPIC_ARTICLE_ID_' . $topic_id);
     if ($cache) {
         $data = $cache;
     } else {
         /* 查询条件 */
         $field = 'topic.id as topic_id,topic.upfile,topic.content,topic.province,topic.city,topic.create_time,
                   user.nick_name,user.sex,user.upfile_head as user_upfile_head';
         $where['topic.id'] = array('EQ', $topic_id);
         $where['topic.status'] = array('EQ', 1);
         $where['topic.display'] = array('EQ', 1);
         $where['user.status'] = array('EQ', 1);
         $where['user.display'] = array('EQ', 1);
         /* 查询数据 */
         $data = $this->alias('topic')->field($field)->where($where)->join('__USER__ user on topic.user_id = user.id')->find();
         /* 读取用户头像 */
         if ($data['user_upfile_head'] && !strstr($data['user_upfile_head'], 'http://')) {
             $data['user_upfile_head'] = C('APP_URL') . '/Uploads/Images/User/' . $data['user_upfile_head'];
         }
         /* 转换数据 */
         if ($data['content']) {
             $data['content'] = urldecode($data['content']);
         }
         /* 设置缓存 */
         S('HOME_TOPIC_ARTICLE_ID_' . $topic_id, $data, C('CACHE_TIME'));
     }
     /* 下载链接 */
     $data['data_setting'] = S('data_setting');
     return $data;
 }
 /**
  * @param mixed $content
  */
 public function run(&$content)
 {
     /**
      *  //真不知道说什么好。。。
      *      这里      原因是tp 不能把tag放在项目配置中,只能放在common中,而common模块先于install 初始化
      *     so。。。。。
      *
      */
     if (C('DB_TYPE') == 'GreenCMS_DB_TYPE') {
     } else {
         if (isset($_GET['m']) && strtolower($_GET['m']) == 'install') {
             return;
         }
         $data = S('hooks');
         if (!$data) {
             $hooks = M('Hooks')->getField('name,addons');
             foreach ($hooks as $key => $value) {
                 if ($value) {
                     $map['status'] = 1;
                     $names = explode(',', $value);
                     $map['name'] = array('IN', $names);
                     $data = M('Addons')->where($map)->getField('id,name');
                     if ($data) {
                         $addons = array_intersect($names, $data);
                         Hook::add($key, $addons);
                     }
                 }
             }
             S('hooks', Hook::get());
         } else {
             Hook::import($data, false);
         }
     }
 }
 public function run(&$params)
 {
     if (C('UPGRADE_NOTICE_ON') && (!S('think_upgrade_interval') || C('UPGRADE_NOTICE_DEBUG'))) {
         if (IS_SAE && C('UPGRADE_NOTICE_QUEUE') && !isset($_POST['think_upgrade_queque'])) {
             $queue = new SaeTaskQueue(C('UPGRADE_NOTICE_QUEUE'));
             $queue->addTask('http://' . $_SERVER['HTTP_HOST'] . __APP__, 'think_upgrade_queque=1');
             if (!$queue->push()) {
                 trace('升级提醒队列执行失败,错误原因:' . $queue->errmsg(), '升级通知出错', 'NOTIC', true);
             }
             return;
         }
         $akey = C('UPGRADE_NOTICE_AKEY', null, '');
         $skey = C('UPGRADE_NOTICE_SKEY', null, '');
         $this->accesskey_ = $akey ? $akey : (defined('SAE_ACCESSKEY') ? SAE_ACCESSKEY : '');
         $this->secretkey_ = $skey ? $skey : (defined('SAE_SECRETKEY') ? SAE_SECRETKEY : '');
         $current_version = C('UPGRADE_CURRENT_VERSION', null, 0);
         //读取接口
         $info = $this->send('http://sinaclouds.sinaapp.com/thinkapi/upgrade.php?v=' . $current_version);
         if ($info['version'] != $current_version) {
             if ($this->send_sms($info['msg'])) {
                 trace($info['msg'], '升级通知成功', 'NOTIC', true);
             }
             //发送升级短信
         }
         S('think_upgrade_interval', true, C('UPGRADE_NOTICE_CHECK_INTERVAL', null, 604800));
     }
 }
 public function edit($id = null)
 {
     if (IS_POST) {
         $FrindLink = D('WebFriendlink');
         $data = $FrindLink->create();
         if ($data) {
             if ($FrindLink->save()) {
                 S('h_i_friendlinks', null);
                 $this->success('更新成功');
             } else {
                 $this->error('更新失败');
             }
         } else {
             $this->error($FrindLink->getError());
         }
     } else {
         $info = array();
         $info = M('WebFriendlink')->field(true)->find($id);
         if (false === $info) {
             $this->error('获取配置信息错误');
         }
         $this->assign('info', $info);
         $this->display();
     }
 }
Example #8
0
 private function comformPay($orderNo, $type, $payInfo)
 {
     $m = M('Company_order');
     \Log::DEBUG($orderNo);
     $opt['orderNo'] = $orderNo;
     $result = $m->where($opt)->find();
     if ($result) {
         if ($result['payInfo']) {
             return true;
         }
         if ($type == 'topup') {
             $option['payInfo'] = json_encode($payInfo);
             $option['state'] = 1;
             $option['id'] = $result['id'];
             $row = $m->save($option);
             S('pay_' . $orderNo, 1, 600);
             $topup = json_decode($result['goods'], true);
             $topupCount = intval($topup['amount']) + intval($topup['present']);
             $this->updateUserTopup($result['uId'], $topupCount);
             $log = array("userId" => $result['uId'], "amount" => $topup['amount'], "present" => $topup['present'], "topuptime" => date("Y-m-d H:i:s"), "payType" => 'wechat', "orderNo" => $orderNo);
             $this->topupLog($log);
         }
         if ($type == 'goods') {
             $payTemp = json_decode($result['payTemp']['items'], true);
             $payTemp[count($payTemp)] = $payInfo;
             $option['payInfo'] = json_encode($payTemp);
             \Log::DEBUG($option['payInfo']);
             $option['state'] = 1;
             $option['id'] = $result['id'];
             $row = $m->save($option);
             S('pay_' . $orderNo, 1, 600);
             $this->sendOrderMsg($result);
         }
     }
 }
Example #9
0
 private function loadAddons()
 {
     $data = S('hooks');
     if (!$data) {
         $hooks = M('hooks')->getField('name,addons', true);
         foreach ($hooks as $key => $value) {
             if ($value) {
                 $map['status'] = 1;
                 $names = explode(',', $value);
                 $map['name'] = array('IN', $names);
                 $data = M('Addons')->where($map)->getField('id,name');
                 if ($data) {
                     $addons = array_intersect($names, $data);
                     Hook::add($key, $addons);
                 }
             }
         }
         S('hooks', Hook::get());
         //插件标签
         $tpl_tags = array();
         $data = M('addons')->getField('id,name');
         if ($data) {
             foreach ($data as $addon) {
                 if (is_file("HDCMS/Addons/{$addon}/Tag/{$addon}Tag.class.php")) {
                     $tpl_tags[] = "@.Addons.{$addon}.Tag.{$addon}Tag";
                 }
             }
         }
         S('HookTag', array_unique($tpl_tags));
     } else {
         Hook::import($data, false);
         C('TPL_TAGS', array_unique(array_merge(C('TPL_TAGS'), S('HookTag'))));
     }
 }
 /**
  * 获取友情链接列表(type_list)
  * 参数名	 是否必须	 默认值	 说明
  * order	 是	 id DESC	 排序方式
  * termsid	 否	 null	 分类ID
  * id	 否	 null	 链接ID 
  */
 public function type_list($data)
 {
     //缓存时间
     $cache = (int) $data['cache'];
     $cacheID = md5(implode(",", $data));
     $cacheData = S($cacheID);
     if ($cache && $cacheData) {
         return $cacheData;
     }
     $termsid = (int) $data['termsid'];
     $id = (int) $data['id'];
     $num = empty($data['num']) ? 10 : (int) $data['num'];
     $order = empty($data['order']) ? "id DESC" : $data['order'];
     $db = M("Links");
     $where = array();
     if ($id > 0) {
         $where['id'] = array("EQ", $id);
         $data = $db->where($where)->find();
     } else {
         if ($termsid > 0) {
             $where['termsid'] = array("EQ", $termsid);
             $data = $db->where($where)->order($order)->limit($num)->select();
         }
     }
     //结果进行缓存
     if ($cache) {
         S($cacheID, $data, $cache);
     }
     return $data;
 }
 /**
  * 获取用户的相关数据
  *
  * @param array $data
  *        	配置相关数据
  * @return array 显示所需数据
  */
 private function _getRelatedZhanggui($data)
 {
     // 用户ID
     $var['uid'] = isset($data['uid']) ? intval($data['uid']) : $GLOBALS['ts']['mid'];
     // 显示相关人数
     $var['limit'] = isset($data['limit']) ? intval($data['limit']) : 4;
     // 掌柜信息
     $key = '_getRelatedZhanggui' . $var['uid'] . '_' . $var['limit'] . '_' . date('Ymd');
     $var['user'] = S($key);
     if ($var['user'] === false || intval($_REQUEST['rel']) == 1) {
         $sql = "SELECT uid FROM `ts_user_verified` WHERE usergroup_id=5 AND verified=1 order by rand() limit " . $var['limit'];
         $list = M()->query($sql);
         // 			dump($list);
         $uids = getSubByKey($list, 'uid');
         $userInfos = model('User')->getUserInfoByUids($uids);
         $userStates = model('Follow')->getFollowStateByFids($GLOBALS['mid'], $uids);
         foreach ($list as $v) {
             $key = $v['uid'];
             $arr[$key]['userInfo'] = $userInfos[$key];
             $arr[$key]['followState'] = $userStates[$key];
             $arr[$key]['info']['msg'] = '掌柜';
             $arr[$key]['info']['extendMsg'] = '';
         }
         $var['user'] = $arr;
         S($key, $var['user'], 86400);
         // 			S ( 'now_'.$key, $var ['user'], 86400 );
     }
     // 		dump($var);
     return $var;
 }
Example #12
0
 public function _makeTree($pid)
 {
     if ($pid == 0 && ($cache = S('Cache_Group_Cate_' . $pid))) {
         // pid=0 才缓存
         return $cache;
     }
     if ($c = $this->where("pid='{$pid}'")->findAll()) {
         if ($pid == 0) {
             foreach ($c as $v) {
                 $cTree['t'] = $v['title'];
                 $cTree['a'] = $v['id'];
                 $cTree['d'] = $this->_makeTree($v['id']);
                 $cTrees[] = $cTree;
             }
         } else {
             foreach ($c as $v) {
                 $cTree['t'] = $v['title'];
                 $cTree['a'] = $v['id'];
                 $cTree['d'] = '';
                 //$v['id'];
                 $cTrees[] = $cTree;
             }
         }
     }
     $pid == 0 && S('Cache_Group_Cate_' . $pid, $cTrees);
     // pid=0 才缓存
     return $cTrees;
 }
Example #13
0
 /**
  * 获取文档模型信息
  * @param  integer $id    模型ID
  * @param  string  $field 模型字段
  * @return array
  */
 public static function get_document_model($id = null, $field = null)
 {
     static $list;
     /* 非法分类ID */
     if (!(is_numeric($id) || is_null($id))) {
         return '';
     }
     /* 读取缓存数据 */
     if (empty($list)) {
         $list = S('DOCUMENT_MODEL_LIST');
     }
     /* 获取模型名称 */
     if (empty($list)) {
         $map = array('status' => 1, 'extend' => 1);
         $model = M('Model')->where($map)->field(true)->select();
         foreach ($model as $value) {
             $list[$value['id']] = $value;
         }
         S('DOCUMENT_MODEL_LIST', $list);
         //更新缓存
     }
     /* 根据条件返回数据 */
     if (is_null($id)) {
         return $list;
     } elseif (is_null($field)) {
         return $list[$id];
     } else {
         return $list[$id][$field];
     }
 }
Example #14
0
 /**
  * 新增或更新一个行为
  * @return boolean fasle 失败 , int  成功 返回完整的数据
  * @author huajie <*****@*****.**>
  */
 public function update()
 {
     $action_rule = $_POST['action_rule'];
     for ($i = 0; $i < count($action_rule['table']); $i++) {
         $_POST['rule'][] = array('table' => $action_rule['table'][$i], 'field' => $action_rule['field'][$i], 'rule' => $action_rule['rule'][$i], 'cycle' => $action_rule['cycle'][$i], 'max' => $action_rule['max'][$i]);
     }
     $_POST['rule'] = serialize($_POST['rule']);
     /* 获取数据对象 */
     $data = $this->create($_POST);
     if (empty($data)) {
         return false;
     }
     /* 添加或新增行为 */
     if (empty($data['id'])) {
         //新增数据
         $id = $this->add();
         //添加行为
         if (!$id) {
             $this->error = '新增行为出错!';
             return false;
         }
     } else {
         //更新数据
         $status = $this->save();
         //更新基础内容
         if (false === $status) {
             $this->error = '更新行为出错!';
             return false;
         }
     }
     //删除缓存
     S('action_list', null);
     //内容添加或更新完成
     return $data;
 }
Example #15
0
 /**
  * 新增或更新一个文档
  * @return boolean fasle 失败 , int  成功 返回完整的数据
  * @author Rocks
  */
 public function update()
 {
     /* 获取数据对象 */
     $data = $this->create();
     if (empty($data)) {
         return false;
     }
     /* 添加或新增基础内容 */
     if (empty($data['id'])) {
         //新增数据
         $id = $this->add();
         //添加基础内容
         if (!$id) {
             $this->error = '新增模型出错!';
             return false;
         }
     } else {
         //更新数据
         $status = $this->save();
         //更新基础内容
         if (false === $status) {
             $this->error = '更新模型出错!';
             return false;
         }
     }
     // 清除模型缓存数据
     S('DOCUMENT_MODEL_LIST', null);
     //记录行为
     action_log('update_model', 'model', $data['id'] ? $data['id'] : $id, UID);
     //内容添加或更新完成
     return $data;
 }
 public function index()
 {
     $map = $this->setMap();
     $map['status'] = 1;
     $map['last_login_time'] = array('neq', 0);
     $peoples = S('People_peoples_' . I('page', 0, 'intval') . '_' . serialize($map));
     if (empty($peoples)) {
         $peoples = M('Member')->where($map)->field('uid', 'reg_time', 'last_login_time')->order('last_login_time desc')->findPage(20);
         $userConfigModel = M('Ucenter/UserConfig');
         $titleModel = M('Ucenter/Title');
         foreach ($peoples['data'] as &$v) {
             $v = query_user(array('title', 'avatar128', 'nickname', 'uid', 'space_url', 'score', 'title', 'fans', 'following', 'rank_link'), $v['uid']);
             $v['level'] = $titleModel->getCurrentTitleInfo($v['uid']);
             //获取用户封面id
             $where = getUserConfigMap('user_cover', '', $v['uid']);
             $where['role_id'] = 0;
             $model = $userConfigModel;
             $cover = $model->findData($where);
             $v['cover_id'] = $cover['value'];
             $v['cover_path'] = getThumbImageById($cover['value'], 273, 80);
         }
         unset($v);
         S('People_peoples_' . serialize($map), $peoples, 300);
     }
     $this->assign('tab', 'index');
     $this->assign('lists', $peoples);
     $this->display();
 }
 /**
  * 
  * @return MApplicationNode
  */
 public function __construct(MString $name = null)
 {
     parent::__construct();
     $this->name = $name ? $name : S("");
     $this->parentNode = null;
     $this->childNodes = new MMutableArray();
 }
Example #18
0
 /**
  * 应用信息初始化
  *
  * @access private
  * @return void
  */
 private function initSite()
 {
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = api('Config/lists');
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     // 添加配置
     if (!C('WEB_SITE_CLOSE') && strtolower(MODULE_NAME) != 'admin') {
         $this->error('站点已经关闭,请稍后访问~');
     }
     // 通用表单的控制开关
     $this->assign('add_button', true);
     $this->assign('del_button', true);
     $this->assign('search_button', true);
     $this->assign('check_all', true);
     // js,css的版本
     if (APP_DEBUG) {
         defined('SITE_VERSION') or define('SITE_VERSION', time());
     } else {
         defined('SITE_VERSION') or define('SITE_VERSION', C('SYSTEM_UPDATRE_VERSION'));
     }
     // 版权信息
     $this->assign('system_copy_right', C('COPYRIGHT'));
 }
Example #19
0
 static function models()
 {
     $all = static::all();
     return S(Product::all(array_keys($all)), function ($product) use(&$all) {
         return $product->fill_raw(array('qty' => $all[$product->id], 'sum' => $all[$product->id] * $product->retail));
     });
 }
 /**
  * 后台控制器初始化
  */
 protected function _initialize()
 {
     // 获取当前用户ID
     if (defined('UID')) {
         return;
     }
     define('UID', is_login());
     if (!UID) {
         // 还没登录 跳转到登录页面
         $this->redirect('Public/login');
     }
     /* 读取数据库中的配置 */
     $config = S('DB_CONFIG_DATA');
     if (!$config) {
         $config = D('Config')->lists();
         S('DB_CONFIG_DATA', $config);
     }
     C($config);
     //添加配置
     // 是否是超级管理员
     define('IS_ROOT', is_administrator());
     if (!IS_ROOT && C('ADMIN_ALLOW_IP')) {
         // 检查IP地址访问
         if (!in_array(get_client_ip(), explode(',', C('ADMIN_ALLOW_IP')))) {
             $this->error('403:禁止访问');
         }
     }
 }
Example #21
0
 /**
  * 构造函数
  */
 public function __construct()
 {
     $this->model = S('model');
     $this->category = S('category');
     $this->cid = Q('cid', 0, 'intval');
     $this->mid = Q('mid', 0, 'intval');
 }
 /**
  * 新增或更新一个行为
  * @return boolean fasle 失败 , int  成功 返回完整的数据
  * @author huajie <*****@*****.**>
  */
 public function update()
 {
     /* 获取数据对象 */
     $data = $this->create($_POST);
     if (empty($data)) {
         return false;
     }
     /* 添加或新增行为 */
     if (empty($data['id'])) {
         //新增数据
         $id = $this->add();
         //添加行为
         if (!$id) {
             $this->error = '新增行为出错!';
             return false;
         }
     } else {
         //更新数据
         $status = $this->save();
         //更新基础内容
         if (false === $status) {
             $this->error = '更新行为出错!';
             return false;
         }
     }
     //删除缓存
     S('action_list', null);
     //内容添加或更新完成
     return $data;
 }
 /**
  * 根据角色获取默认头像
  * @param $role_id
  * @param $size
  * @return mixed|string
  * @author 郑钟良<*****@*****.**>
  */
 private function getImageUrlByRoleId($role_id, $size)
 {
     $avatar_id = S('Role_Avatar_Id_' . $role_id);
     if (!$avatar_id) {
         $map = getRoleConfigMap('avatar', $role_id);
         $avatar_id = M('RoleConfig')->where($map)->field('value')->find();
         S('Role_Avatar_Id_' . $role_id, $avatar_id, 600);
     }
     if ($avatar_id) {
         if ($size != 0) {
             $path = getThumbImageById($avatar_id['value'], $size, $size);
         } else {
             $path = getThumbImageById($avatar_id['value']);
         }
     } else {
         //角色没有默认
         if ($size != 0) {
             $default_avatar = "Public/images/default_avatar.jpg";
             $path = $this->getImageUrlByPath($default_avatar, $size, false);
         } else {
             $path = get_pic_src("Public/images/default_avatar.jpg");
         }
     }
     return $path;
 }
 /**
  * 获取网页seo信息
  */
 protected function _seo()
 {
     $site = M("Site")->find(C("SITE_ID"));
     $seo['title'] = $site['title'];
     $seo['keywords'] = $site['keywords'];
     $seo['description'] = $site['description'];
     if (S('SEO_CATE')) {
         $category = S('SEO_CATE');
         $seo['title'] = $category['meta_title'];
         $seo['keywords'] = $category['keywords'];
         $seo['description'] = $category['description'];
     }
     if (S('SEO_ARTICLE')) {
         $article = S('SEO_ARTICLE');
         $category = S('SEO_CATE');
         $seo['title'] = $article['title'];
         $seo['keywords'] = $article['keywords'];
         $seo['description'] = $article['description'];
         // title是否继承分类
         if (C('MULTI_TITLE') == 1) {
             $seo['title'] = $category['title'] . ' - ' . $article['title'];
         }
     }
     // 每次访问删除缓存
     S('SEO_ARTICLE', null);
     S('SEO_CATE', null);
     C('SEO_TITLE', $seo['title']);
     C('SEO_KEYWORDS', $seo['keywords']);
     C('SEO_DESCRIPTION', $seo['description']);
 }
 public function getList($type = 1)
 {
     if ($type) {
         //前台调用
         $list = S('store_home_adv_list');
         if (!$list) {
             $map['status'] = 1;
             $list = $this->where($map)->order('sort desc')->select();
             if (!count($list)) {
                 $list = 1;
             } else {
                 $list = $this->_initSelect($list);
             }
             S('store_home_adv_list', $list);
         }
         if ($list == 1) {
             $list = null;
         }
     } else {
         //后台调用
         $map['status'] = array('gt', -1);
         $list = $this->where($map)->order('sort desc')->select();
         $list = $this->_initSelect($list);
     }
     return $list;
 }
Example #26
0
 /**
  * swfupload上传附件
  */
 public function swfupload()
 {
     $grouplist = S('member/grouplist');
     if (isset($_POST['dosubmit'])) {
         if ($_POST['swf_auth_key'] != md5(C('config', 'auth_key') . $_POST['SWFUPLOADSESSID']) || $_POST['isadmin'] == 0 && !$grouplist[$_POST['groupid']]['allowattachment']) {
             exit;
         }
         $catid = isset($_POST['catid']) ? intval($_POST['catid']) : 0;
         $attachment = new Attachment($_POST['application'], $catid);
         $attachment->set_userid($_POST['userid']);
         $aids = $attachment->upload('Filedata', $_POST['filetype_post'], '', '', array($_POST['thumb_width'], $_POST['thumb_height']), $_POST['watermark_enable']);
         if ($aids[0]) {
             $filename = strtolower(CHARSET) != 'utf-8' ? iconv('gbk', 'utf-8', $attachment->uploadedfiles[0]['filename']) : '';
             if ($attachment->uploadedfiles[0]['isimage']) {
                 echo $aids[0] . ',' . $this->upload_url . $attachment->uploadedfiles[0]['filepath'] . ',' . $attachment->uploadedfiles[0]['isimage'] . ',' . $filename;
             } else {
                 $fileext = $attachment->uploadedfiles[0]['fileext'];
                 if ($fileext == 'zip' || $fileext == 'rar') {
                     $fileext = 'rar';
                 } elseif ($fileext == 'doc' || $fileext == 'docx') {
                     $fileext = 'doc';
                 } elseif ($fileext == 'xls' || $fileext == 'xlsx') {
                     $fileext = 'xls';
                 } elseif ($fileext == 'ppt' || $fileext == 'pptx') {
                     $fileext = 'ppt';
                 } elseif ($fileext == 'flv' || $fileext == 'swf' || $fileext == 'rm' || $fileext == 'rmvb') {
                     $fileext = 'flv';
                 } else {
                     $fileext = 'do';
                 }
                 echo $aids[0] . ',' . $this->upload_url . $attachment->uploadedfiles[0]['filepath'] . ',' . $fileext . ',' . $filename;
             }
             exit;
         } else {
             echo '0,' . $attachment->error();
             exit;
         }
     } else {
         if ($this->isadmin == 0 && !$grouplist[$this->groupid]['allowattachment']) {
             showmessage(L('att_no_permission'));
         }
         $args = $_GET['args'];
         $authkey = $_GET['authkey'];
         if (upload_key($args) != $authkey) {
             showmessage(L('attachment_parameter_error'));
         }
         extract(getswfinit($_GET['args']));
         $file_size_limit = byte_format(C('attachment', 'maxsize') * 1024);
         $att_not_used = cookie('att_json');
         if (empty($att_not_used) || !isset($att_not_used)) {
             $tab_status = ' class="on"';
         }
         if (!empty($att_not_used)) {
             $div_status = ' hidden';
         }
         // 获取临时未处理文件列表
         $att = $this->att_not_used();
         include $this->view('swfupload');
     }
 }
Example #27
0
 public function get()
 {
     $id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit;
     if ($data = $this->db->getby_id($id)) {
         if (!($str = S('dbsource_' . $id))) {
             if ($data['type'] == 1) {
                 // 自定义SQL调用
                 $get_db = Loader::model("get_model");
                 $sql = $data['data'] . (!empty($data['num']) ? " LIMIT {$data['num']}" : '');
                 $str = $get_db->query($sql);
             } else {
                 $filepath = APPS_PATH . $data['application'] . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . $data['application'] . '_tag.php';
                 if (file_exists($filepath)) {
                     $yun_tag = Loader::lib($data['application'] . ':' . $data['application'] . '_tag');
                     if (!method_exists($yun_tag, $data['do'])) {
                         exit;
                     }
                     $sql = string2array($data['data']);
                     $sql['do'] = $data['do'];
                     $sql['limit'] = $data['num'];
                     unset($data['num']);
                     $str = $yun_tag->{$data}['do']($sql);
                 } else {
                     exit;
                 }
             }
             if ($data['cache']) {
                 S('tpl_data/dbsource_' . $id, $str, $data['cache']);
             }
         }
         echo $this->_format($data['id'], $str, $data['dis_type']);
     }
 }
Example #28
0
	public function index($orderid, $paytype, $third_id)
	{
		$this->m_bargain = M('bargain');
		$this->m_order = M('bargain_order');
		$this->m_kanuser = M('bargain_kanuser');
		$this->m_userinfo = M('userinfo');
		$where_order['orderid'] = $orderid;
		$order = $this->m_order->where($where_order)->find();

		if ($order) {
			$this->wecha_id = $order['wecha_id'];
			$this->token = $order['token'];

			if ($order['paid'] != 1) {
				exit('该订单还未支付');
			}

			$save_order['state2'] = 1;
			$update_order = $this->m_order->where($where_order)->save($save_order);
			$where['token'] = $this->token;
			$where['pigcms_id'] = $order['bargain_id'];
			$bargain = $this->m_bargain->where($where)->find();
			$save['inventory'] = $bargain['inventory'] - 1;
			$update = $this->m_bargain->where($where)->save($save);
			S($order['bargain_id'] . 'bargain' . $this->token, NULL);
		}
		else {
			exit('订单不存在:' . $orderid);
		}
	}
 public function run(&$parms)
 {
     //安装时不执行
     if (defined('BIND_MODULE') && BIND_MODULE === 'Install') {
         return;
     }
     $data = S('global_hooks');
     if (!$data) {
         $hooks = M('Hooks', "common_")->getField('name,addons');
         foreach ($hooks as $key => $value) {
             if ($value) {
                 $map['status'] = 1;
                 $names = explode(',', $value);
                 $map['name'] = array('IN', $names);
                 $data = M('Addons', "common_")->where($map)->getField('id,name');
                 if ($data) {
                     $addons = array_intersect($names, $data);
                     Hook::add($key, array_map('get_addon_class', $addons));
                 }
             }
         }
         S('global_hooks', Hook::get());
     } else {
         Hook::import($data, false);
     }
 }
Example #30
0
 /**
  * 批量保存配置
  * @author 麦当苗儿 <*****@*****.**>
  */
 public function save($config)
 {
     $old['artid'] = M('Config')->where(array('name' => 'WXARTID'))->getField('value');
     if ($config && is_array($config)) {
         $Config = M('Config');
         foreach ($config as $name => $value) {
             $map = array('name' => $name);
             if ($name == 'WXARTID') {
                 if ($old['artid'] != $value) {
                     asyn_sendwx();
                     //$WX->sendwx();
                 }
             }
             if ($name == 'WXPASS') {
                 $value = think_encrypt($value, UC_AUTH_KEY);
             }
             $Config->where($map)->setField('value', $value);
         }
     }
     S('DB_CONFIG_DATA', null);
     $config_file = './App/Home/Conf/theme.php';
     $themename = (include $config_file);
     if ($config['WEB_THEME'] != $themename['DEFAULT_THEME']) {
         //写入配置文件
         $theme['DEFAULT_THEME'] = $config['WEB_THEME'];
         file_put_contents($config_file, "<?php \nreturn " . var_export($theme, true) . ";", LOCK_EX);
         dir_delete(RUNTIME_PATH);
     }
     $this->mtReturn(200, '网站配置保存成功!', '', 'forward', U('group'));
 }