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); }
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)); }
/** * Successive call of magicDequote and fromUTF8 * @static * @param string $filesystemElement * @return string */ static function fromPostedFileName($filesystemElement) { return XApp_SystemTextEncoding::fromUTF8(XApp_SystemTextEncoding::magicDequote($filesystemElement)); }