} /* * Check who made the template */ if (!empty($_POST['replace'])) { if (!is_user_creator($_POST['replace'])) { die(IMPORT_OWNER_FILE . "****"); } } $folder_id = ""; /* * Check the file is the right type */ if (substr($_FILES['filenameuploaded']['name'], strlen($_FILES['filenameuploaded']['name']) - 3, 3) === "zip") { $this_dir = rand() . "/"; if (!_is_writable($xerte_toolkits_site->import_path)) { _debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import"); die("{$xerte_toolkits_site->import_path}: " . IMPORT_NOT_WRITABLE . "****"); } $ok = mkdir($xerte_toolkits_site->import_path . $this_dir) && chmod($xerte_toolkits_site->import_path . $this_dir, 0777); if (!$ok) { _debug("Warning: we had problems either creating the temp dir {$xerte_toolkits_site->import_path}{$this_dir} or chmod'ing it 0777."); } $new_file_name = $xerte_toolkits_site->import_path . $this_dir . time() . $_FILES['filenameuploaded']['name']; if (@move_uploaded_file($_FILES['filenameuploaded']['tmp_name'], $new_file_name)) { require_once dirname(__FILE__) . "/../dUnzip2.inc.php"; $zip = new dUnzip2($new_file_name); $zip->debug = false; $res = $zip->getList(); if ($res === false) { delete_loop($xerte_toolkits_site->import_path . $this_dir);
static function fileSystem($path = '') { $check = new stdClass(); $check->passed = false; $error_message = 'Please fix by changing the permission to 0777 or changing the ownership to the user account that runs the webserver.'; if (_is_writable($path)) { $check->passed = true; $check->css = 'ok'; $check->message = 'OK'; } else { $check->passed = false; $check->css = 'error'; $check->message = $error_message; } // uncomment next line to simulate failure // $check->passed = false; return $check; }
if (!is_user_admin()) { management_fail(); } if ($_FILES['filenameuploaded']['type'] == "application/x-zip-compressed" || $_FILES['filenameuploaded']['type'] == "application/zip" || $_FILES['filenameuploaded']['type'] == "application/octet-stream") { $this_dir = rand() . "/"; if (!_is_writable($xerte_toolkits_site->import_path)) { _debug("{$xerte_toolkits_site->import_path} needs to be writeable. Cannot perform import"); echo IMPORT_LANGUAGE_FAILED . $lang_dir . $xerte_toolkits_site->import_path . IMPORT_LANGUAGE_WRITABLE; exit(0); } if (!_is_writable($xerte_toolkits_site->root_file_path . "languages/")) { _debug("{$xerte_toolkits_site->root_file_path} languages/ needs to be writeable. Cannot perform import"); echo IMPORT_LANGUAGE_FAILED . $lang_dir . $xerte_toolkits_site->root_file_path . "languages/" . IMPORT_LANGUAGE_WRITABLE; exit(0); } if (!_is_writable($xerte_toolkits_site->root_file_path . "modules/xerte/parent_templates/Nottingham/wizards/")) { _debug("{$xerte_toolkits_site->root_file_path} modules/xerte/parent_templates/Nottingham/wizards/ needs to be writeable. Cannot perform import"); echo IMPORT_LANGUAGE_FAILED . $lang_dir . $xerte_toolkits_site->root_file_path . "modules/xerte/parent_templates/Nottingham/wizards/" . IMPORT_LANGUAGE_WRITABLE; exit(0); } $ok = mkdir($xerte_toolkits_site->import_path . $this_dir) && chmod($xerte_toolkits_site->import_path . $this_dir, 0777); if (!$ok) { _debug("Warning: we had problems either creating the temp dir {$xerte_toolkits_site->import_path}{$this_dir} or chmod'ing it 0777."); } $new_file_name = $xerte_toolkits_site->import_path . $this_dir . time() . $_FILES['filenameuploaded']['name']; if (@move_uploaded_file($_FILES['filenameuploaded']['tmp_name'], $new_file_name)) { require_once dirname(__FILE__) . "/../dUnzip2.inc.php"; $zip = new dUnzip2($new_file_name); $zip->debug = false; $zip->getList(); $file_data = array();
<?php if (_is_writable($root . "/error_logs")) { echo "<div class='ok'>OK</div>"; } else { echo "<div class='error'><p>Please fix by changing the permission to 0777 or changing the ownership to the user account that runs the webserver.</p></div>"; $ok = false; } ?> </li> <li> The import folder for this install (<?php echo $root . "/import"; ?> ) must be writable. <?php if (_is_writable($root . "/import")) { echo "<div class='ok'>OK</div>"; } else { echo "<div class='error'><p>Please fix by changing the permission to 0777 or changing the ownership to the user account that runs the webserver.</p></div>"; $ok = false; } ?> </li> </ol> </p> <?php if ($ok) { echo "<form action=\"php_modules_test.php\"><button type=\"submit\">Next</button></form>"; } else { echo "<form action=\"file_system_test.php\"><button type=\"submit\">Try again</button></form>"; }
public function isWritable() { return _is_writable($this->_path); }
} } else { if (!unlink($path . $f)) { return $path . $f; } } } closedir($d); if (!rmdir($path)) { return $path; } return ""; } if (isset($_POST['code']) && file_exists($xerte_toolkits_site->root_file_path . "languages/" . $_POST['code'])) { $code = $_POST['code']; if (!_is_writable($xerte_toolkits_site->root_file_path . "languages/" . $code)) { _debug("{$xerte_toolkits_site->root_file_path}languages/{$code} needs to be writeable. Cannot perform import"); echo DELETE_LANGUAGE_FAILED . $lang_dir . $xerte_toolkits_site->root_file_path . "languages/" . $code . DELETE_LANGUAGE_WRITABLE; exit(0); } $abort = false; if (file_exists($xerte_toolkits_site->root_file_path . "languages/" . $code)) { $p = folder_delete($xerte_toolkits_site->root_file_path . "languages/" . $code . "/"); if ($p != "") { echo DELETE_LANGUAGE_FAILED . $lang_dir . DELETE_LANGUAGE_UNABLE_TO_DELETE . $p; $abort = true; } } if (file_exists($xerte_toolkits_site->root_file_path . "modules/xerte/parent_templates/Nottingham/wizards/" . $code)) { $p = folder_delete($xerte_toolkits_site->root_file_path . "modules/xerte/parent_templates/Nottingham/wizards/" . $code . "/"); if ($p != "") {
function __is_writable($path) { _is_writable($path); }