Пример #1
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');
 }
Пример #2
0
 public function __init()
 {
     parent::__init();
     if (empty($_FILES)) {
         $this->callBack($GLOBALS['_LANG']['UPLOAD']['EMPTY_UPLOAD'], '0');
     }
     /**
      * 获取允许上传的文件格式
      */
     $result = \Model\Option::getOptionRange('upload');
     foreach ($result as $key => $value) {
         $this->allowFormat[$value['option_name']] = json_decode($value['value'], true);
     }
     /**
      * 获取配置文件的上传目录
      */
     $this->uploadPath = PES_PATH . $this->loadConfig('UPLOAD_PATH');
     /**
      * 分析上传目录
      */
     $this->uploadFileType = pathinfo($_FILES['file']['name']);
     /**
      * 存储路径
      */
     $this->savePath = $this->uploadPath . date('/Ymd/');
     /**
      * 移除完整的目录信息
      * 以便记录入库
      */
     $this->recordPath = DOCUMENT_ROOT . str_replace(PES_PATH, "", $this->savePath);
     /**
      * 判断上传目录是否存在
      */
     if (is_dir($this->uploadPath) === false) {
         mkdir($this->uploadPath);
         fopen("{$this->uploadPath}/index.html", 'w');
     }
     /**
      * 创建以日期形式存储目录
      */
     if (is_dir($this->savePath) === false) {
         mkdir($this->savePath);
         fopen("{$this->savePath}/index.html", 'w');
     }
 }
Пример #3
0
 public function __init()
 {
     parent::__init();
     $this->assign('sitetile', \Model\Option::findOption('sitetitle')['value']);
     $this->assign('signup', \Model\Option::findOption('signup')['value']);
 }