XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
install_modcheck_trustext.inc.php
1<?php
11
12// checking XOOPS_ROOT_PATH and XOOPS_URL
13include_once '../mainfile.php';
14
15$writeok = [ 'cache/', 'templates_c/', 'uploads/', 'uploads/xupdate/', 'modules/protector/configs/' ];
16$error = false;
17
18clearstatcache();
19
20foreach ( $writeok as $wok ) {
21
22 // try to create the directory if it doesn't exist
23 is_dir( XOOPS_TRUST_PATH.'/'.$wok) || (mkdir(XOOPS_TRUST_PATH.'/'.$wok, 0777, true) && is_dir(XOOPS_TRUST_PATH.'/'.$wok));
24 $wokWritable = false;
25 $permissions = fileperms(XOOPS_TRUST_PATH.'/'.$wok);
26
27 if (XOOPS_TRUST_PATH.'/'.$wok && is_writable(XOOPS_TRUST_PATH.'/'.$wok)) {
28 $tempFile = tempnam(XOOPS_TRUST_PATH.'/'.$wok, 'tmp');
29 if ($tempFile !== false) {
30 $res = file_put_contents($tempFile, 'test');
31 $wokWritable = $res !== false;
32 @unlink($tempFile);
33 $fperm = substr(sprintf('%o', $permissions), -4); //output 0777
34 $wizard->addArray('checks', _OKIMG . '<code>' .$fperm.'</code><code>'.$wok.'</code> ' . sprintf(_INSTALL_L86, '<p class="data">'.XOOPS_TRUST_PATH. '/'.$wok.'</p>') );
35 } else {
36 $fperm = substr(sprintf('%o', $permissions), -4); //output 0777
37 $wizard->addArray('checks', _NGIMG . '<code>' .$fperm.'</code><code>'.$wok.'</code> ' . sprintf(_INSTALL_L85, '<p class="data"><code style="color:#ff6633">'.XOOPS_TRUST_PATH. '/'.$wok.'</p>') );
38 $error = true;
39 }
40 }
41}
42
43if ( ! $error ) {
44 $wizard->assign( 'message', '<div class="confirmOk">'. _INSTALL_L87 .'</div>' );
45} else {
46 $wizard->assign( 'message', '<div class="confirmError">'. _INSTALL_L46 .'</div>' );
47 $wizard->setReload( true );
48}
49
50$wizard->render( 'install_modcheck.tpl.php' );