28 'data' =>
'xoops_data',
41 'root' =>
'ROOT_PATH',
66 if ( isset(
$_SESSION[
'settings'][
'ROOT_PATH'] ) ) {
67 foreach ($this->path_lookup as $req => $sess) {
68 $this->xoopsPath[$req] =
$_SESSION[
'settings'][$sess];
71 $path = str_replace(
"\\",
"/", realpath(
'../' ) );
72 if ( substr(
$path, -1 ) ==
'/' ) {
75 if ( file_exists(
"$path/mainfile.php" ) ) {
76 $this->xoopsPath[
'root'] =
$path;
79 $this->xoopsPath[
'lib'] = dirname(
$path) .
"/" . ($this->xoopsPathDefault[
'lib']);
81 if ( !is_dir($this->xoopsPath[
'lib'] .
"/") ) {
82 $this->xoopsPath[
'lib'] =
$path .
"/" . ($this->xoopsPathDefault[
'lib']);
85 $this->xoopsPath[
'data'] = dirname(
$path) .
"/" . ($this->xoopsPathDefault[
'data']);
87 if ( !is_dir($this->xoopsPath[
'data'] .
"/") ) {
88 $this->xoopsPath[
'data'] =
$path .
"/" . ($this->xoopsPathDefault[
'data']);
91 if ( isset(
$_SESSION[
'settings'][
'URL'] ) ) {
92 $this->xoopsUrl =
$_SESSION[
'settings'][
'URL'];
95 $this->xoopsUrl = substr(
$path, 0, strrpos(
$path,
'/' ) );
103 if (
$_SERVER[
'REQUEST_METHOD'] ==
'POST' ) {
104 foreach ($this->path_lookup as $req => $sess) {
105 $_SESSION[
'settings'][$sess] = $this->xoopsPath[$req];
109 $GLOBALS[
'wizard']->redirectToPage(
'+1' );
111 $GLOBALS[
'wizard']->redirectToPage(
'+0' );
118 if (
$_SERVER[
'REQUEST_METHOD'] ==
'POST' ) {
120 foreach ($this->path_lookup as $req => $sess) {
121 if ( isset($request[$req]) ) {
122 $request[$req] = str_replace(
"\\",
"/", trim($request[$req]) );
123 if ( substr( $request[$req], -1 ) ==
'/' ) {
124 $request[$req] = substr( $request[$req], 0, -1 );
126 $this->xoopsPath[$req] = $request[$req];
129 if ( isset( $request[
'URL'] ) ) {
130 $request[
'URL'] = trim($request[
'URL']);
131 if ( substr( $request[
'URL'], -1 ) ==
'/' ) {
132 $request[
'URL'] = substr( $request[
'URL'], 0, -1 );
134 $this->xoopsUrl = $request[
'URL'];
141 foreach (array_keys($this->xoopsPath) as
$path) {
146 $this->validUrl = !empty($this->xoopsUrl);
147 $validPaths = ( array_sum(array_values($this->validPath)) == count(array_keys($this->validPath)) ) ? 1 : 0;
149 foreach ($this->permErrors as $key => $errs) {
150 if (empty($errs))
continue;
151 foreach ($errs as $path =>
$status) {
158 return ( $validPaths && $this->validUrl && $validPerms );
164 if ( $PATH ==
'root' || empty($PATH) ) {
166 if ( is_dir( $this->xoopsPath[
$path] ) && is_readable( $this->xoopsPath[$path] ) ) {
167 @include_once
"{$this->xoopsPath[$path]}/include/version.php";
168 if ( file_exists(
"{$this->xoopsPath[$path]}/mainfile.php" ) && defined(
'XOOPS_VERSION' ) ) {
169 $this->validPath[
$path] = 1;
174 if ( $PATH ==
'lib' || empty($PATH) ) {
176 if ( is_dir( $this->xoopsPath[
$path] ) && is_readable( $this->xoopsPath[$path] ) ) {
177 $this->validPath[
$path] = 1;
181 if ( $PATH ==
'data' || empty($PATH) ) {
183 if ( is_dir( $this->xoopsPath[
$path] ) && is_readable( $this->xoopsPath[$path] ) ) {
184 $this->validPath[
$path] = 1;
193 if (is_array(
$path)) {
194 foreach ( array_keys(
$path) as $item ) {
195 if (is_string($item)) {
197 if (empty(
$path[$item]))
continue;
198 foreach (
$path[$item] as $child) {
214 'root' => array(
'mainfile.php',
'uploads', ),
215 'data' => $this->dataPath
222 if (!isset($this->xoopsPath[
$path])) {
229 if ( in_array(
false,
$errors[$path] ) ) {
243 $mode = intval(
'0777', 8);
244 if ( !file_exists(
$path ) ) {
251 if ( !is_writable(
$path) ) {
252 chmod(
$path, $mode );
255 if ( is_writable(
$path ) ) {
256 $info = stat(
$path );
257 if ( $info[
'mode'] & 0002 ) {
259 } elseif ( $info[
'mode'] & 0020 ) {