public static function getS($value, $default) { Environment::load(); $return = Environment::$currentEnvironment->get($value, $default); switch ($value) { case "onLogout": return str_replace("%CLOUDUSER", Environment::$currentEnvironment->cloudUser(), $return); break; case "databaseData": if (is_array($return)) { return $return; } $ex = explode(";;", $return); $dbData = array(); $dbData["host"] = $ex[0]; $dbData["user"] = $ex[1]; $dbData["password"] = $ex[2]; $dbData["httpHost"] = "*"; $dbData["datab"] = $ex[3]; $return = $dbData; break; case "allowedApplications": if ($return == null) { return null; } return explode(",", $return); break; case "pluginsExtra": case "allowedPlugins": case "hiddenPlugins": if ($return == null) { return $default; } return explode(",", $return); break; case "customizer": case "customizerExtra": if ($return == null) { return $default; } return explode(",", $return); break; } $return = Aspect::joinPoint("alter", null, __METHOD__, array($value, $default), $return); return $return; }
public static function getS($value, $default, $forceReload = false) { Environment::load($forceReload); $return = Environment::$currentEnvironment->get($value, $default); switch ($value) { case "usePWEncryption": try { $LD = LoginData::get("ADServerUserPass"); if ($LD != null and $LD->A("server") != "") { return false; } } catch (Exception $e) { } return true; break; case "onLogout": case "onTimeout": return str_replace("%CLOUDUSER", Environment::$currentEnvironment->cloudUser(), $return); break; case "databaseData": if (is_array($return)) { return $return; } $ex = explode(";;", $return); $dbData = array(); $dbData["host"] = $ex[0]; $dbData["user"] = $ex[1]; $dbData["password"] = $ex[2]; $dbData["httpHost"] = "*"; $dbData["datab"] = $ex[3]; $return = $dbData; break; case "databaseDataWrite": if ($return == null) { return null; } if (is_array($return)) { return $return; } $ex = explode(";;", $return); $dbData = array(); $dbData["host"] = $ex[0]; $dbData["user"] = $ex[1]; $dbData["password"] = $ex[2]; $dbData["httpHost"] = "*"; $dbData["datab"] = $ex[3]; $return = $dbData; case "allowedApplications": if ($return == null) { return null; } return explode(",", $return); break; case "pluginsExtra": case "allowedPlugins": case "hiddenPlugins": if ($return == null) { return $default; } return explode(",", $return); break; case "customizer": case "customizerExtra": if ($return == null) { return $default; } return explode(",", $return); break; } $return = Aspect::joinPoint("alter", null, __METHOD__, array($value, $default), $return); return $return; }
public static function getTempDir() { $dirtouse = Util::getRootPath() . "system/IECache/"; if (!is_writable($dirtouse)) { $file = tempnam(":\n\\/?><", ""); $dirtouse = dirname($file); unlink($file); } else { Util::clearIECache($dirtouse); } $subdir = (isset($_SESSION["S"]) and $_SESSION["S"]->getCurrentUser() != null) ? $_SESSION["S"]->getCurrentUser()->getID() : "info"; $CH = Util::getCloudHost(); if ($CH !== null and get_class($CH) != "CloudHostAny") { $dirtouse = "/tmp"; Environment::load(); $subdir = Environment::$currentEnvironment->cloudUser() . "/{$subdir}"; } $dirtouse .= ($dirtouse[strlen($dirtouse) - 1] != "/" ? "/" : "") . $subdir . "/"; if (!is_dir($dirtouse)) { #echo "create $dirtouse...\n"; if (!mkdir($dirtouse, 0777, true)) { throw new Exception("Could not create temp dir " . $dirtouse); } chmod($dirtouse . "../", 0777); chmod($dirtouse, 0777); } else { chmod($dirtouse . "../", 0777); chmod($dirtouse, 0777); } if (!is_dir($dirtouse)) { throw new Exception("Did not create temp dir {$dirtouse}"); } #echo gethostname().":"; #var_dump(is_dir($dirtouse)); #print_r($dirtouse); #die(); if (PHYNX_USE_TEMP_HTACCESS and strpos($dirtouse, Util::getRootPath()) !== false and is_writable($dirtouse)) { $content = "<IfModule mod_authz_core.c>\n Require ip " . $_SERVER["REMOTE_ADDR"] . "\n</IfModule>"; if (strstr($_SERVER["REMOTE_ADDR"], ".")) { //USE ONLY WHEN ON IPV4 due to APACHE BUG https://issues.apache.org/bugzilla/show_bug.cgi?id=49737 $content .= "\n<IfModule !mod_authz_core.c>\n\tallow from " . $_SERVER["REMOTE_ADDR"] . "\n\tdeny from all\n\tallow from " . $_SERVER["REMOTE_ADDR"] . "\n</IfModule>"; } file_put_contents($dirtouse . ".htaccess", $content); } elseif (file_exists($dirtouse . ".htaccess")) { unlink($dirtouse . ".htaccess"); } if (!PHYNX_USE_TEMP_HTACCESS and file_exists($dirtouse . ".htaccess")) { unlink($dirtouse . ".htaccess"); } return $dirtouse; }
public static function getFilesDir() { $CH = Util::getCloudHost(); if ($CH != null) { Environment::load(); $dir = $CH->scientiaDir . "/" . strtolower(Environment::$currentEnvironment->cloudUser()) . "/specifics/"; if (!file_exists($dir)) { #mkdir($CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/"); mkdir($CH->scientiaDir . "/" . strtolower(Environment::$currentEnvironment->cloudUser()) . "/specifics/", 0777, true); } return $dir; } return realpath(Util::getRootPath() . "specifics") . "/"; }
public static function getFilesDir() { $path = realpath(Util::getRootPath()) . "/specifics/"; if (!file_exists($path . ".htaccess") and is_writable($path)) { file_put_contents($path . ".htaccess", "<IfModule mod_authz_core.c>\n Require all denied\n</IfModule>\n\n<IfModule !mod_authz_core.c>\n Order Allow,Deny\n Deny from all\n</IfModule>"); } $CH = Util::getCloudHost(); if ($CH != null) { Environment::load(); $cloudUser = strtolower(Environment::$currentEnvironment->cloudUser()); $dir = $CH->scientiaDir . "/" . ($cloudUser != "" ? "{$cloudUser}/" : "") . "specifics/"; if (!file_exists($dir)) { #mkdir($CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/"); mkdir($dir, 0777, true); chmod($dir, 0777); } return realpath($dir) . "/"; } return $path; }
public static function getFilesDir() { $path = realpath(Util::getRootPath() . "specifics") . "/"; if (!file_exists($path . ".htaccess") and is_writable($path)) { file_put_contents($path . ".htaccess", "deny from all"); } $CH = Util::getCloudHost(); if ($CH != null) { Environment::load(); $cloudUser = strtolower(Environment::$currentEnvironment->cloudUser()); $dir = $CH->scientiaDir . "/" . ($cloudUser != "" ? "{$cloudUser}/" : "") . "specifics/"; if (!file_exists($dir)) { #mkdir($CH->scientiaDir."/".strtolower(Environment::$currentEnvironment->cloudUser())."/"); mkdir($CH->scientiaDir . "/" . ($cloudUser != "" ? "{$cloudUser}/" : "") . "specifics/", 0777, true); } return $dir; } return $path; }