예제 #1
0
파일: Upload.php 프로젝트: xingcuntian/yaf
 /**
  * 通过ftp列出图片服务器的图片文件
  * @return boolean
  */
 public function getftpfiles()
 {
     /* 检测上传根目录 */
     if (!$this->uploader->checkRootPath($this->rootPath)) {
         $this->error = $this->uploader->getError();
         return false;
     }
     if (substr($this->savePath, strlen($this->savePath) - 1) != '/') {
         $this->savePath .= '/';
     }
     /* 检查上传目录 */
     $files1 = $this->uploader->nlist($this->rootPath . $this->savePath);
     if (empty($files1)) {
         $this->error = $this->uploader->getError();
         return false;
     }
     //$haha=$this->uploader->pwd();
     //$this->uploader->chdir($this->rootPath.$this->savePath);
     //$haha1=$this->uploader->pwd();
     $allowFiles = substr(str_replace(".", "|", join("", $this->exts)), 1);
     $files = array();
     foreach ($files1 as $file) {
         if (preg_match("/\\.(" . $allowFiles . ")\$/i", $file) || $this->uploader->chdir($file)) {
             $files[] = array('url' => str_replace($this->rootPath, '', $file), 'filename' => str_replace($this->rootPath . $this->savePath, '', $file), 'isdir' => $this->uploader->chdir($file) ? 'dir' : 'img');
         }
     }
     return $files;
 }
예제 #2
0
파일: Ue.class.php 프로젝트: TedaLIEz/AUNET
 private function getConfig($config_path = null)
 {
     $name = $config_path ? ltrim('./', $config_path) : 'ueditor.json';
     $config_path = MODULE_PATH . 'Conf/' . $name;
     if (is_file($config_path)) {
         // $this->config = load_config($config_path); 这种方法加载失败,难道注释影响? !--
         $config = json_decode(preg_replace("/\\/\\*[\\s\\S]+?\\*\\//", "", file_get_contents($config_path)), true);
         $this->config = array_merge($this->config, $config);
     } else {
         echo json_encode(array('state' => '配置文件加载失败!'));
예제 #3
0
 /**
  * 获取子目录的名称
  * @param array $file 上传的文件信息
  */
 private function getSubPath($filename)
 {
     $subpath = '';
     $rule = $this->subName;
     if ($this->autoSub && !empty($rule)) {
         $subpath = $this->getName($rule, $filename) . '/';
         if (!empty($subpath) && !$this->uploader->mkdir($this->savePath . $subpath)) {
             $this->error = $this->uploader->getError();
             return false;
         }
     }
     return $subpath;
 }
예제 #4
0
파일: Factory.php 프로젝트: ssdphp/ssdphp
 /**
  * 获取子目录的名称
  * @param array $file  上传的文件信息
  */
 private function getSubPath($filename)
 {
     $subpath = '';
     $rule = self::$config['subName'];
     if (self::$config['autoSub'] && !empty($rule)) {
         $subpath = $this->getName($rule, $filename) . '/';
         if (!empty($subpath) && !self::$uploader->mkdir(self::$config['savePath'] . $subpath)) {
             $this->error = self::$uploader->getError();
             return false;
         }
     }
     return $subpath;
 }
 /**
  * 获取子目录的名称
  * @param array $file  上传的文件信息
  */
 private static function getSubPath($filename)
 {
     $subpath = '';
     $rule = self::subName;
     if (self::autoSub && !empty($rule)) {
         $subpath = self::getName($rule, $filename) . '/';
         if (!empty($subpath) && !self::$uploader->mkdir(self::savePath . $subpath)) {
             self::$error = self::$uploader->getError();
             return false;
         }
     }
     return $subpath;
 }
예제 #6
0
 public function __construct($filename, $directory)
 {
     if (!file_exists($directory . '/' . $filename)) {
         $this->error = 'File ' . $filename . ' doesn\'t exist.';
         return;
     }
     $handle = fopen($directory . '/' . $filename, 'r');
     $object = NULL;
     $text = '';
     $materials = array();
     $material_filename = '';
     while (($line = fgets($handle)) !== FALSE) {
         $line = trim($line);
         if (strpos($line, 'o ') === 0) {
             // Start of a new object.
             // Store the old object first.
             if (!empty($text)) {
                 $object = new Object($text, $materials[$material_filename], $directory);
                 if ($error = $object->getError()) {
                     $this->error = $error;
                     return;
                 }
                 $this->objects[] = $object;
             }
             $text = $line;
         } elseif (strpos($line, 'mtllib ') === 0) {
             $material_filename = trim(substr($line, 7));
             if (empty($materials[$material_filename])) {
                 $materialLoader = new MaterialLoader($material_filename, $directory);
                 if ($error = $materialLoader->getError()) {
                     $this->error = $error;
                     return;
                 }
                 $materials[$material_filename] = $materialLoader->materials;
             }
         } elseif (!empty($line) && strpos($line, '#') !== 0) {
             $text .= PHP_EOL . $line;
         }
     }
     // It's the end of file. Create a new object.
     if (!empty($text)) {
         $object = new Object($text, $materials[$material_filename], $directory);
         if ($error = $object->getError()) {
             $this->error = $error;
             return;
         }
         $this->objects[] = $object;
     }
 }
예제 #7
0
 /** Return mysql error (return false, if no error occurred)
  *
  * @return bool|string
  */
 public function getError()
 {
     return $this->Db_obj->getError();
 }