XOOPS  2.6.0
page_pathsettings.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
27 require_once __DIR__ . '/include/common.inc.php';
28 
29 include_once XOOPS_INSTALL_PATH . '/class/pathcontroller.php';
30 
31 $ctrl = new XoopsPathController($wizard->configs['xoopsPathDefault'], $wizard->configs['dataPath']);
32 
33 if ($_SERVER['REQUEST_METHOD'] == 'GET' && @$_GET['var'] && @$_GET['action'] == 'checkpath') {
34  $path = $_GET['var'];
35  $ctrl->xoopsPath[$path] = htmlspecialchars( trim($_GET['path']) );
36  echo genPathCheckHtml( $path, $ctrl->checkPath($path) );
37  exit();
38 }
39 $ctrl->execute();
40 if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
41  return;
42 }
43 ob_start();
44 ?>
45 <script type="text/javascript">
46 function removeTrailing(id, val) {
47  if (val[val.length-1] == '/') {
48  val = val.substr(0, val.length-1);
49  $(id).value = val;
50  }
51  return val;
52 }
53 
54 function updPath( key, val ) {
55  val = removeTrailing(key, val);
56  new Ajax.Updater(
57  key+'pathimg', '<?php echo $_SERVER['PHP_SELF']; ?>',
58  { method:'get',parameters:'action=checkpath&var='+key+'&path='+val }
59  );
60  $(key+'perms').style.display='none';
61 }
62 </script>
63 <fieldset>
64  <label class="xolabel" for="root"><?php echo XOOPS_ROOT_PATH_LABEL; ?></label>
65  <div class="xoform-help"><?php echo XOOPS_ROOT_PATH_HELP; ?></div>
66  <input type="text" name="root" id="root" value="<?php echo $ctrl->xoopsPath['root']; ?>" onchange="updPath('root', this.value)" />
67  <span id="rootpathimg"><?php echo genPathCheckHtml( 'root', $ctrl->validPath['root'] ); ?></span>
68  <?php
69  if ($ctrl->validPath['root'] && !empty( $ctrl->permErrors['root'])) {
70  echo '<div id="rootperms" class="x2-note">';
71  echo CHECKING_PERMISSIONS . '<br /><p>' . ERR_NEED_WRITE_ACCESS . '</p>';
72  echo '<ul class="diags">';
73  foreach ($ctrl->permErrors['root'] as $path => $result) {
74  if ($result) {
75  echo '<li class="success">' . sprintf(IS_WRITABLE, $path) . '</li>';
76  } else {
77  echo '<li class="failure">' . sprintf(IS_NOT_WRITABLE, $path) . '</li>';
78  }
79  }
80  echo '</ul>';
81  } else {
82  echo '<div id="rootperms" class="x2-note" style="display: none;" />';
83  }
84  ?>
85  </div>
86 
87  <label class="xolabel" for="data"><?php echo XOOPS_DATA_PATH_LABEL; ?></label>
88  <div class="xoform-help"><?php echo XOOPS_DATA_PATH_HELP; ?></div>
89  <input type="text" name="data" id="data" value="<?php echo $ctrl->xoopsPath['data']; ?>" onchange="updPath('data', this.value)" />
90  <span id="datapathimg"><?php echo genPathCheckHtml('data', $ctrl->validPath['data'] ); ?></span>
91  <?php
92  if ($ctrl->validPath['data'] && !empty( $ctrl->permErrors['data'])) {
93  echo '<div id="dataperms" class="x2-note">';
94  echo CHECKING_PERMISSIONS . '<br /><p>' . ERR_NEED_WRITE_ACCESS . '</p>';
95  echo '<ul class="diags">';
96  foreach ($ctrl->permErrors['data'] as $path => $result) {
97  if ($result) {
98  echo '<li class="success">' . sprintf(IS_WRITABLE, $path) . '</li>';
99  } else {
100  echo '<li class="failure">' . sprintf(IS_NOT_WRITABLE, $path) . '</li>';
101  }
102  }
103  echo '</ul>';
104  } else {
105  echo '<div id="dataperms" class="x2-note" style="display: none;" />';
106  }
107  ?>
108  </div>
109 
110  <label class="xolabel" for="lib"><?php echo XOOPS_LIB_PATH_LABEL; ?></label>
111  <div class="xoform-help"><?php echo XOOPS_LIB_PATH_HELP; ?></div>
112  <input type="text" name="lib" id="lib" value="<?php echo $ctrl->xoopsPath['lib']; ?>" onchange="updPath('lib', this.value)" />
113  <span id="libpathimg"><?php echo genPathCheckHtml('lib', $ctrl->validPath['lib']); ?></span>
114  <div id="libperms" class="x2-note" style="display: none;" />
115 </fieldset>
116 
117 <fieldset>
118  <label class="xolabel" for="url"><?php echo XOOPS_URL_LABEL; ?></label>
119  <div class="xoform-help"><?php echo XOOPS_URL_HELP; ?></div>
120  <input type="text" name="URL" id="url" value="<?php echo $ctrl->xoopsUrl; ?>" onchange="removeTrailing('url', this.value)" />
121 </fieldset>
122 
123 <?php
124 $content = ob_get_contents();
125 ob_end_clean();
126 
127 $_SESSION['pageHasHelp'] = true;
128 $_SESSION['pageHasForm'] = true;
129 $_SESSION['content'] = $content;
130 include XOOPS_INSTALL_PATH . '/include/install_tpl.php';
const CHECKING_PERMISSIONS
Definition: install.php:133
$path
Definition: execute.php:31
const XOOPS_URL_HELP
Definition: install.php:81
$result
Definition: pda.php:33
$_SERVER['REQUEST_URI']
genPathCheckHtml($path, $valid)
Definition: functions.php:240
exit
Definition: browse.php:104
$wizard
Definition: common.inc.php:66
const XOOPS_DATA_PATH_HELP
Definition: install.php:78
const XOOPS_ROOT_PATH_LABEL
Definition: install.php:72
const XOOPS_LIB_PATH_LABEL
Definition: install.php:75
const XOOPS_INSTALL_PATH
Definition: common.inc.php:33
const ERR_NEED_WRITE_ACCESS
Definition: install.php:151
const IS_WRITABLE
Definition: install.php:135
const XOOPS_LIB_PATH_HELP
Definition: install.php:76
$_SESSION['pageHasHelp']
const XOOPS_URL_LABEL
Definition: install.php:80
const XOOPS_DATA_PATH_LABEL
Definition: install.php:77
const XOOPS_ROOT_PATH_HELP
Definition: install.php:73
const IS_NOT_WRITABLE
Definition: install.php:134