コード例 #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;
 }
コード例 #5
0
 /**
  * 获取子目录的名称
  * @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
ファイル: ObjectLoader.php プロジェクト: neeravbm/3dmart
 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();
 }