<?php //$web="http://http://127.0.0.1/media/sda1/scripts/xLiveCZ/kinotip/serialy/"; function RootFullPath() { return $_SERVER['HTTP_HOST'] . dirname($_SERVER["SCRIPT_NAME"]); } function RootPath() { $folder = explode("/", dirname($_SERVER["SCRIPT_NAME"])); unset($folder[0]); $folder = array_values($folder); return $folder[0]; } $ROOT = RootPath(); $ROOT_FULL_PATH = RootFullPath(); $web = "http://" . $ROOT_FULL_PATH . "/";
/** * @return array|false */ function InitPath(&$_initPathError) { $_cfg = array(); $_result = true; if (@file_exists(RootPath() . '/' . AP_CFG_FILE)) { $settings_path = null; if (@(include RootPath() . '/' . AP_CFG_FILE) && isset($settings_path)) { if (is_array($settings_path) && count($settings_path) > 0) { foreach ($settings_path as $_name => $_path) { if (is_string($_path)) { $_cfg[$_name . '_path'] = ap_AddUtils::GetFullPath($_path, RootPath()); } } $dataPath = null; if (@isset($_cfg['webmail_web_path'])) { if (@file_exists($_cfg['webmail_web_path'] . '/inc_settings_path.php')) { if (@(include $_cfg['webmail_web_path'] . '/inc_settings_path.php') && isset($dataPath) && $dataPath !== null) { $_cfg['webmail_data_path'] = ap_AddUtils::GetFullPath($dataPath, $_cfg['webmail_web_path']); } else { $_initPathError = 'Installer can\'t include ' . $_cfg['webmail_web_path'] . '/inc_settings_path.php file (probably, because PHP process does not have permissions to access inc_settings_path.php file or the file\'s content is incorrect).'; } } else { $_initPathError = $_cfg['webmail_web_path'] . '/inc_settings_path.php file doesn\'t exist (or PHP process does not have permissions to check this file for existance).'; } } else { $_initPathError = RootPath() . '/' . AP_CFG_FILE . ' file\'s content is incorrect.'; } unset($dataPath); } } else { $_initPathError = 'Installer can\'t include ' . RootPath() . '/' . AP_CFG_FILE . ' file (probably, because PHP process does not have permissions to access ' . AP_CFG_FILE . ' file or the file\'s content is incorrect).'; } unset($settings_path); } else { $_initPathError = RootPath() . '/' . AP_CFG_FILE . ' file doesn\'t exist (or PHP process does not have permissions to check this file for existance).'; $_result = false; } return $_result ? $_cfg : false; }