コード例 #1
0
 public function index()
 {
     $notice = $this->db('notice')->field('notice_type, count(notice_type) AS total_notice')->where('notice_read = 0 AND user_id = :user_id')->group('user_id, notice_type')->select(array('user_id' => $_SESSION['team']['user_id']));
     $this->assign('notice', $notice);
     $this->assign('sitetile', \Model\Option::findOption('sitetitle')['value']);
     $this->assign('menu', \Model\Menu::menu($_SESSION['team']['user_group_id']));
     $this->display();
 }
コード例 #2
0
 /**
  * 更新系统
  */
 public function upgrade()
 {
     \Model\Option::getUpdate();
     $version = \Model\Option::findOption('version')['value'];
     $content = \Model\Content::findContent('update_list', $version, 'update_list_pre_version');
     $this->assign($content);
     $this->assign('title', \Model\Menu::getTitleWithMenu());
     $this->layout();
 }
コード例 #3
0
 /**
  * 获取系统更新信息
  * @return boolean 返回抓去结果
  */
 public static function getUpdate()
 {
     $version = \Model\Option::findOption('version')['value'];
     $findUpdate = \Model\Content::findContent('update_list', $version, 'update_list_pre_version');
     if (empty($findUpdate)) {
         $update = \Model\Extra::getUpdate($version);
         return $update['status'];
     }
 }
コード例 #4
0
 public function __init()
 {
     parent::__init();
     $this->table = strtolower(MODULE);
     $this->fieldPrefix = $this->table . "_";
     $this->model = \Model\Model::findModel($this->table, 'model_name');
     if (empty($this->model)) {
         $this->error($GLOBALS['_LANG']['MODEL']['NOT_EXIST_MODEL']);
     }
     $this->assign('fieldPrefix', $this->fieldPrefix);
     $this->theme = \Model\Option::findOption('theme');
 }
コード例 #5
0
ファイル: User.class.php プロジェクト: tarscoding/PESCMS-TEAM
 /**
  * 更新用户头像
  */
 public function setHead()
 {
     if (empty($_FILES['file']['tmp_name'])) {
         $this->error('请选择您要裁剪的头像');
     }
     $width = $this->isP('width', '请选择您要裁剪的高度');
     $height = $this->isP('height', '请选择您要裁剪的高度');
     $x = $this->p('x');
     $y = $this->p('y');
     $allowFormat = json_decode(\Model\Option::findOption('upload_img')['value'], true);
     $extension = pathinfo($_FILES['file']['name'])['extension'];
     if (!in_array($extension, $allowFormat)) {
         $this->error('图片格式不被支持');
     }
     $uploadPath = PES_PATH . $this->loadConfig('UPLOAD_PATH');
     if (is_dir($uploadPath) === false) {
         mkdir($uploadPath);
         fopen("{$uploadPath}/index.html", 'w');
     }
     $savePath = $uploadPath . date('/Ymd/');
     if (is_dir($savePath) === false) {
         mkdir($savePath);
         fopen("{$savePath}/index.html", 'w');
     }
     $name = uniqid() . ".{$extension}";
     switch (strtolower($extension)) {
         case 'jpg':
         case 'jpeg':
             $image = imagecreatefromjpeg($_FILES['file']['tmp_name']);
             break;
         case 'gif':
             $image = imagecreatefromgif($_FILES['file']['tmp_name']);
             break;
         case 'png':
             $image = imagecreatefrompng($_FILES['file']['tmp_name']);
             break;
     }
     $cutimg = imagecreatetruecolor($width, $height);
     $alpha = imagecolorallocatealpha($cutimg, 0, 0, 0, 127);
     imagefill($cutimg, 0, 0, $alpha);
     imagecopyresampled($cutimg, $image, 0, 0, $x, $y, $width, $height, $width, $height);
     imagepng($cutimg, $savePath . $name);
     imagedestroy($cutimg);
     imagedestroy($back);
     $updateHeadPath = str_replace(PES_PATH, "", $savePath . $name);
     $setHeadResult = $this->db('user')->where('user_id = :user_id')->update(array('noset' => array('user_id' => $_SESSION['team']['user_id']), 'user_head' => DOCUMENT_ROOT . $updateHeadPath));
     if ($setHeadResult == false) {
         $this->error('设置头像失败');
     }
     $_SESSION['team']['user_head'] = DOCUMENT_ROOT . $updateHeadPath;
     $this->success('设置成功!', $this->url('Team-Index-dynamic'));
 }
コード例 #6
0
ファイル: Login.class.php プロジェクト: hurricanetx/PESCMS2
 /**
  * 注册帐号
  */
 public function signup()
 {
     if (\Model\Option::findOption('signup')['value'] == '0') {
         $this->error('本系统没有开启注册。');
     }
     $data['user_account'] = $this->isP('account', '请填写帐号');
     $existAccount = \Model\Content::findContent('user', $data['user_account'], 'user_account');
     if (!empty($existAccount)) {
         $this->error('帐号已存在');
     }
     $data['user_password'] = \Core\Func\CoreFunc::generatePwd($data['user_account'] . $this->isP('password', '请填写密码'), 'PRIVATE_KEY');
     $repwd = \Core\Func\CoreFunc::generatePwd($data['user_account'] . $this->isP('repassword', '请填写密码'), 'PRIVATE_KEY');
     if ($data['user_password'] != $repwd) {
         $this->error('两次密码不一致');
     }
     $data['user_mail'] = $this->isP('mail', '请填写帐号');
     $existEmail = \Model\Content::findContent('user', $data['user_mail'], 'user_mail');
     if (!empty($existEmail)) {
         $this->error('邮箱地址已存在');
     }
     \Core\Func\CoreFunc::$defaultPath = false;
     require PES_PATH . '/Expand/Identicon/autoload.php';
     $identicon = new \Identicon\Identicon();
     $imageDataUri = $identicon->getImageDataUri($data['user_mail']);
     $data['user_name'] = $this->isP('name', '请填写帐号');
     $data['user_status'] = '1';
     $data['user_createtime'] = time();
     $data['user_department_id'] = '2';
     //人事部
     $data['user_group_id'] = '2';
     //普通用户
     $data['user_head'] = $imageDataUri;
     $addResult = $this->db('user')->insert($data);
     if (empty($addResult)) {
         $this->error('注册失败');
     }
     unset($data['user_password']);
     $data['user_id'] = $addResult;
     $this->setLogin($data);
     $this->success('注册成功!', $this->url(GROUP . '-Index-index'));
 }
コード例 #7
0
ファイル: Model.class.php プロジェクト: hurricanetx/PESCMS2
 /**
  * 字段添加/编辑
  */
 public function fieldAction()
 {
     $fieldId = $this->g('id');
     $modelId = $this->isG('model', '请选择模型');
     $model = \Model\ModelManage::findModel($modelId);
     if (empty($fieldId)) {
         $this->assign('method', 'POST');
         $this->assign('title', "添加字段 - {$model['lang_key']}");
     } else {
         $field = \Model\Field::findField($fieldId);
         if (empty($field)) {
             $this->error('不存在的字段');
         }
         $this->assign($field);
         $this->assign('method', 'PUT');
         $this->assign('title', "编辑字段 - {$model['lang_key']}");
     }
     $fieldTypeOption = \Model\Option::findOption('fieldType');
     $this->assign('fieldTypeList', json_decode($fieldTypeOption['value'], true));
     $this->assign('modelId', $modelId);
     $this->layout();
 }
コード例 #8
0
 /**
  * 字段添加/编辑
  */
 public function fieldAction()
 {
     $fieldId = $this->g('id');
     $modelId = $this->isG('model', $GLOBALS['_LANG']['MODEL']['SELECT_MODEL_ID']);
     $model = \Model\Model::findModel($modelId);
     if (empty($fieldId)) {
         $this->assign('method', 'POST');
         $this->assign('title', $GLOBALS['_LANG']['MODEL']['FIELD_ADD'] . " - {$model['lang_key']}");
     } else {
         $field = \Model\Field::findField($fieldId);
         if (empty($field)) {
             $this->error($GLOBALS['_LANG']['MODEL']['NOT_EXIST_FIELD']);
         }
         $this->assign($field);
         $this->assign('method', 'PUT');
         $this->assign('title', "{$GLOBALS['_LANG']['MODEL']['FIELD_EDIT']} - {$model['lang_key']}");
     }
     $fieldTypeOption = \Model\Option::findOption('fieldType');
     $this->assign('fieldTypeList', json_decode($fieldTypeOption['value'], true));
     $this->assign('modelId', $modelId);
     $this->layout();
 }
コード例 #9
0
 /**
  * 选择前后台主题名称
  */
 private function chooseTheme()
 {
     if (GROUP == 'Admin') {
         $themeName = \Model\Option::findOption('backstagetheme');
     } else {
         $themeName = \Model\Option::findOption('theme');
     }
     return $themeName['value'];
 }
コード例 #10
0
ファイル: Login.class.php プロジェクト: hurricanetx/PESCMS2
 public function __init()
 {
     parent::__init();
     $this->assign('sitetile', \Model\Option::findOption('sitetitle')['value']);
     $this->assign('signup', \Model\Option::findOption('signup')['value']);
 }
コード例 #11
0
ファイル: Index.class.php プロジェクト: hurricanetx/PESCMS2
 public function index()
 {
     $this->assign('sitetile', \Model\Option::findOption('sitetitle')['value']);
     $this->assign('menu', \Model\Menu::menu($_SESSION['team']['user_group_id']));
     $this->display();
 }
コード例 #12
0
 /**
  * 安装结束,移除下载的更新文件
  */
 public function installEnd()
 {
     $version = \Model\Option::findOption('version')['value'];
     $findUpdate = \Model\Content::findContent('update_list', $version, 'update_list_pre_version');
     //设置系统版本
     $this->db('option')->where('option_name = :option_name')->update(array('noset' => array('option_name' => 'version'), 'value' => $findUpdate['update_list_version']));
     //设置版本为已读.
     $this->db('update_list')->where('update_list_version = :update_list_version')->update(array('noset' => array('update_list_version' => $findUpdate['update_list_version']), 'update_list_read' => '1'));
     $this->success('系统更新已完成');
 }