예제 #1
0
 public function rename($mount, $filePath, $filename_new, $dest = null, &$errors)
 {
     $filename_new = XApp_Path_Utils::sanitizeEx(XApp_SystemTextEncoding::magicDequote($filename_new), XApp_Path_Utils::SANITIZE_HTML_STRICT);
     $filename_new = substr($filename_new, 0, xapp_get_option(self::NODENAME_MAX_LENGTH, $this));
     $old = $this->toRealPath($mount . DIRECTORY_SEPARATOR . $filePath);
     if (!is_writable($old)) {
         $errors[] = XAPP_TEXT_FORMATTED('FILE_NOT_WRITEABLE', array($old), 55100);
         return;
     }
     if ($dest == null) {
         $new = dirname($old) . "/" . $filename_new;
     } else {
         $new = $this->toRealPath($mount . DIRECTORY_SEPARATOR . $dest);
     }
     if ($filename_new == "" && $dest == null) {
         $errors[] = XAPP_TEXT_FORMATTED('DIRECTORY_NOT_WRITEABLE', array($old), 55100);
         return;
     }
     if (file_exists($new)) {
         $errors[] = XAPP_TEXT_FORMATTED('FILE_EXISTS', array($filename_new), 55100);
     }
     if (!file_exists($old)) {
         $errors[] = XAPP_TEXT_FORMATTED('CAN_NOT_FIND_FILE', array(basename($filePath)), 55100);
         return;
     }
     rename($old, $new);
 }
예제 #2
0
파일: Utils.php 프로젝트: xamiro-dev/xamiro
 public static function decodeSecureMagic($data, $sanitizeLevel = self::SANITIZE_HTML)
 {
     xapp_import('xapp.Utils.SystemTextEncoding');
     return XApp_SystemTextEncoding::fromUTF8(self::sanitizeEx(self::securePath(XApp_SystemTextEncoding::magicDequote($data)), $sanitizeLevel));
 }
예제 #3
0
 /**
  * Successive call of magicDequote and fromUTF8
  * @static
  * @param string $filesystemElement
  * @return string
  */
 static function fromPostedFileName($filesystemElement)
 {
     return XApp_SystemTextEncoding::fromUTF8(XApp_SystemTextEncoding::magicDequote($filesystemElement));
 }