/**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $Category = new Category();
     $Category->delete(array('cid' => $id));
     WaveCommon::exportResult(true, '成功!');
 }
 /**
  * 提交信息
  */
 public function actionModified()
 {
     $data = WaveCommon::getFilter($_POST);
     $id = (int) $data['mid'];
     unset($data['mid']);
     $GhMenu = new GhMenu();
     if ($id == 0) {
         $GhMenu->insert($data);
     } else {
         $GhMenu->update($data, array('mid' => $id));
     }
     $this->jumpBox('成功!', Wave::app()->homeUrl . 'wxmenu', 1);
 }
 /**
  * 设置密码
  */
 public function actionSetpwd()
 {
     $Users = new Users();
     $data = WaveCommon::getFilter($_POST);
     if (empty($data['pwd']) || empty($data['newpwd']) || empty($data['confirmpwd'])) {
         $this->jumpBox('参数错误!', Wave::app()->homeUrl . 'member', 1);
     }
     if ($data['newpwd'] != $data['confirmpwd']) {
         $this->jumpBox('两次密码不一样!', Wave::app()->homeUrl . 'member', 1);
     }
     $updateData = array('password' => md5($data['newpwd']));
     $Users->update($updateData, array('userid' => $this->userinfo['userid']));
     $this->jumpBox('修改成功!', Wave::app()->homeUrl . 'member', 1);
 }
 /**
  * 提交信息
  */
 public function actionModified()
 {
     $data = WaveCommon::getFilter($_POST);
     $id = (int) $data['gid'];
     unset($data['gid']);
     $md5 = md5($data['gh_id']);
     $data['gh_key'] = substr($md5, 16);
     $data['gh_token'] = substr($md5, 8, 8);
     $data['gh_enaeskey'] = $md5 . substr($md5, 21);
     $GhManage = new GhManage();
     if ($id == 0) {
         $data['userid'] = $this->userinfo['userid'];
         $GhManage->insert('gh_manage', $data);
     } else {
         $GhManage->update($data, array('gid' => $id));
     }
     $this->jumpBox('成功!', Wave::app()->homeUrl . 'wx', 1);
 }
Esempio n. 5
0
 public function actionRegisting()
 {
     $Users = new Users();
     $data = WaveCommon::getFilter($_POST);
     if (empty($data['email'])) {
         WaveCommon::exportResult(false, '请输入邮箱!');
     }
     if (empty($data['password'])) {
         WaveCommon::exportResult(false, '请输入密码!');
     }
     $data['add_date'] = WaveCommon::getDate();
     $data['password'] = md5($data['password']);
     if ($Users->insert($data)) {
         WaveCommon::exportResult(true, '注册成功!');
     } else {
         WaveCommon::exportResult(false, '注册失败!');
     }
 }
 /**
  * 登录
  */
 public function actionLoging()
 {
     $data = WaveCommon::getFilter($_POST);
     $Users = new Users();
     $array = $Users->getOne('*', array('email' => $data['user_login']));
     $Log = new Log();
     if (!empty($array)) {
         if ($array['password'] == md5($data['user_pass'])) {
             Wave::app()->session->setState('userinfo', $array);
             $Log->saveLogs('用户登录', 1, $data);
             $this->jumpBox('登录成功!', Wave::app()->homeUrl, 1);
         } else {
             $Log->saveLogs('用户登录', 0, $data);
             $this->jumpBox('用户名或密码错误!', Wave::app()->homeUrl, 1);
         }
     } else {
         $Log->saveLogs('用户登录', 0, $data);
         $this->jumpBox('没有该用户!', Wave::app()->homeUrl, 1);
     }
 }
Esempio n. 7
0
 /**
  * 默认函数
  */
 public function actionIndex()
 {
     $data = WaveCommon::getFilter($_GET);
     $GhManage = new GhManage();
     $WxModel = new WxModel();
     $array = $GhManage->getOne('*', array('gh_key' => $data['key']));
     if ($array) {
         $this->token = $array['gh_token'];
         $this->enaeskey = $array['gh_enaeskey'];
         $this->appid = $array['gh_appid'];
         $this->appsecret = $array['gh_appsecret'];
     }
     $echoStr = isset($_GET["echostr"]) ? $_GET["echostr"] : 'no echoStr';
     $WxModel->recordLog($echoStr);
     if ($this->checkSignature()) {
         $WxModel->recordLog($echoStr);
         echo $echoStr;
         die;
     }
     die;
     $this->responseMsg();
 }
Esempio n. 8
0
 /**
  * 初始化smarty模板引擎
  */
 public function __construct()
 {
     $app = Wave::app();
     $dir = $app->projectPath . $app->projectName;
     $config = Wave::app()->config['smarty'];
     $smarty = new Smarty();
     $smarty->left_delimiter = $config['left_delimiter'];
     $smarty->right_delimiter = $config['right_delimiter'];
     $smarty->debugging = $config['debugging'];
     $smarty->caching = $config['caching'];
     $smarty->cache_lifetime = $config['cache_lifetime'];
     $smarty->compile_check = $config['compile_check'];
     $smarty->template_dir = $dir . '/' . $config['template_dir'];
     $smarty->cache_dir = $dir . '/' . $config['cache_dir'];
     $smarty->config_dir = $dir . '/' . $config['config_dir'];
     $smarty->compile_dir = $app->projectPath . $config['compile_dir'];
     WaveCommon::mkDir($smarty->compile_dir);
     if ($config['caching']) {
         WaveCommon::mkDir($smarty->config_dir);
     }
     $this->engin = $smarty;
 }
Esempio n. 9
0
 /**
  * 默认函数
  */
 public function actionIndex($cid)
 {
     $this->data = WaveCommon::getFilter($_GET);
     $this->cid = (int) $cid;
     $where = array();
     $this->category = array();
     $Category = new Category();
     if ($cid != 0) {
         $where['a.cid'] = $cid;
         $this->category = $Category->from('category a')->getOne('*', $where);
     }
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $pagesize = 15;
     $start = ($page - 1) * $pagesize;
     $Articles = new Articles();
     $this->list = $Articles->select('a.aid,a.title,a.add_date,c.c_name')->from('articles a')->join('category c', 'a.cid=c.cid')->where($where)->limit($start, $pagesize)->order('a.aid', 'desc')->getAll();
     $count = $Articles->from('articles a')->getCount('*', $where);
     $url = 'http://' . Wave::app()->request->hostInfo . $_SERVER['REQUEST_URI'];
     if (empty($data['page'])) {
         $url .= '?page=1';
     }
     $Common = new Common();
     $this->pagebar = $Common->getPageBar($url, $count, $pagesize, $page);
 }
Esempio n. 10
0
 /**
  * 上传文件
  * @param 文件信息数组 $files ,通常是 $_FILES数组
  */
 public function upload($files = '')
 {
     if ('' === $files) {
         $files = $_FILES;
     }
     if (empty($files)) {
         $this->error = '没有上传的文件!';
         return false;
     }
     /* 逐个检测并上传文件 */
     $info = array();
     if (function_exists('finfo_open')) {
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
     }
     // 对上传文件数组信息处理
     $files = $this->dealFiles($files);
     foreach ($files as $key => $file) {
         $file['name'] = strip_tags($file['name']);
         if (!isset($file['key'])) {
             $file['key'] = $key;
         }
         /* 通过扩展获取文件类型,可解决FLASH上传$FILES数组返回文件类型错误的问题 */
         if (isset($finfo)) {
             $file['type'] = finfo_file($finfo, $file['tmp_name']);
         }
         /* 获取上传文件后缀,允许上传无后缀文件 */
         $file['ext'] = pathinfo($file['name'], PATHINFO_EXTENSION);
         /* 文件上传检测 */
         if (!$this->check($file)) {
             continue;
         }
         /* 生成保存文件名 */
         $savename = $this->getSaveName($file);
         if (false == $savename) {
             continue;
         } else {
             $file['savename'] = $savename;
         }
         /* 对图像文件进行严格检测 */
         $ext = strtolower($file['ext']);
         if (in_array($ext, array('gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf'))) {
             $imginfo = getimagesize($file['tmp_name']);
             if (empty($imginfo) || $ext == 'gif' && empty($imginfo['bits'])) {
                 $this->error = '非法图像文件!';
                 continue;
             }
         }
         $saveDir = rtrim($this->savePath, '/') . '/';
         WaveCommon::mkDir($saveDir);
         $savepath = $saveDir . $savename;
         /* 保存文件 并记录保存成功的文件 */
         if (move_uploaded_file($file['tmp_name'], $savepath)) {
             unset($file['error'], $file['tmp_name']);
             $info[$key] = $file;
         } else {
             $this->error = '上传失败!';
             continue;
         }
     }
     if (isset($finfo)) {
         finfo_close($finfo);
     }
     return empty($info) ? false : $info;
 }
Esempio n. 11
0
 /** 
  * 循环创建目录
  * 
  * @param string $dir 文件夹
  * @param $mode 文件夹权限
  *
  * @return bool
  * 
  */
 public static function mkDir($dir, $mode = 0777)
 {
     if ($dir == '') {
         return true;
     }
     if (is_dir($dir) || @mkdir($dir, $mode)) {
         return true;
     }
     if (!WaveCommon::mkDir(dirname($dir), $mode)) {
         return false;
     }
     return @mkdir($dir, $mode);
 }
 /**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $Substance = new Substance();
     $Substance->delete(array('sid' => $id));
     WaveCommon::exportResult(true, '成功!');
 }
Esempio n. 13
0
 /**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $Users = new Users();
     $Users->delete(array('userid' => $id));
     $this->Log->saveLogs('删除用户', 1, array('userid' => $id));
     WaveCommon::exportResult(true, '成功!');
 }
 /**
  * 删除
  */
 public function actionDelete($id)
 {
     $id = (int) $id;
     $where = array('aid' => $id);
     $Articles = new Articles();
     $Articles->delete($where);
     $ArticlesContent = new ArticlesContent();
     $ArticlesContent->delete($where);
     WaveCommon::exportResult(true, '成功!');
 }