XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
install_modcheck_trust.inc.php
1<?php
10
11// checking XOOPS_ROOT_PATH and XOOPS_URL
12include_once '../mainfile.php';
13
14$writeok = ['cache/', 'templates_c/', 'templates_c/xelfinder/'];
15$error = false;
16echo '<h2>wizard/install_modcheck_trust.inc</h2>';
17
18clearstatcache();
19
20foreach ($writeok as $wok) {
21
22 // try to create this 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 //$permissions = fileperms('../' . $wok);
27 if ($wok && is_writable(XOOPS_TRUST_PATH . '/' . $wok)) {
28
29 $tempFile = tempnam(XOOPS_TRUST_PATH . '/' . $wok, 'tmp');
30 if ($tempFile !== false) {
31 $res = file_put_contents($tempFile, 'test');
32
33 $wokWritable = $res !== false;
34 @unlink($tempFile);
35 $fperm = substr(sprintf('%o', $permissions), -4); //output 0777
36 $wizard->addArray('checks', _OKIMG. '<code>' .$fperm.'</code>' . sprintf(_INSTALL_L86, XOOPS_TRUST_PATH. '/'.$wok));
37 } else {
38 $fperm = substr(sprintf('%o', $permissions), -4); //output 0777
39 $wizard->addArray('checks', _NGIMG. '<span style="color:#e43140">' .$fperm.'</span>' .sprintf(_INSTALL_L85, XOOPS_TRUST_PATH. '/'.$wok));
40 $error = true;
41 }
42 }
43
44// if (!is_dir(XOOPS_TRUST_PATH. '/'. $wok)) {
45// if (file_exists(XOOPS_TRUST_PATH. '/'. $wok)) {
46// @chmod(XOOPS_TRUST_PATH. '/'. $wok, 0666);
47// if (! is_writeable(XOOPS_TRUST_PATH. '/'. $wok)) {
48// $wizard->addArray('checks', _NGIMG.sprintf(_INSTALL_L83, $wok));
49// $error = true;
50// } else {
51// $wizard->addArray('checks', _OKIMG.sprintf(_INSTALL_L84, $wok));
52// }
53// }
54// } else {
55// @chmod(XOOPS_TRUST_PATH. '/'. $wok, 0777);
56// $fperm = substr(sprintf('%o', $permissions), -4); //output 0777
57// if (! is_writeable(XOOPS_TRUST_PATH. '/'. $wok)) {
58//
59// } else {
60// $wizard->addArray('checks', _OKIMG. '<code>' .$fperm.'</code>' . sprintf(_INSTALL_L86, XOOPS_TRUST_PATH. '/'.$wok));
61// }
62// }
63}
64
65if (! $error) {
66 $wizard->assign('message', '<div class="confirmOk">'._INSTALL_L87.'</div>');
67 //$wizard->assign( 'message', '<div class="confirmOk">install_modcheck_trust.inc</div>' );
68} else {
69 $wizard->assign('message', '<div class="confirmError">'._INSTALL_L46.'</div>');
70 $wizard->setReload(true);
71}
72
73//install_modcheck_trust_mkdir($directory);
74
75$wizard->render('install_modcheck.tpl.php');
76
77function install_modcheck_trust_mkdir(/*** string ***/ $directory)
78{
79 if (! is_dir($directory)) {
80 umask(0);
81 mkdir($directory, 0777);
82 }
83}