function file_which($path) { $paths = explode(PATH_SEPARATOR, get_include_path()); if (count($paths) == 0) { if (file_exists($path)) { return $path; } else { return false; } } foreach ($paths as $p) { $x = normalise_path($p . "/" . $path); if (file_exists($x)) { return $x; } } return false; }
$i++; } } if ($language == '') { $language = 'en'; } // Default to English if no languages found return $language; } static function loadlangfile($file, $str = null) { if (is_null($str)) { global $string; } else { $string = $str; } $configObj = Config::get_instance(); $cfg_web_root = $configObj->get('cfg_web_root'); $language = LangUtils::getLang($cfg_web_root); $lang_path = "{$cfg_web_root}lang/{$language}/" . $file; if (file_exists($lang_path)) { require $lang_path; } return $string; } } $language = LangUtils::getLang($cfg_web_root); $lang_path = "{$cfg_web_root}lang/{$language}/" . str_replace($cfg_web_root, '', normalise_path($_SERVER['SCRIPT_FILENAME'])); if (file_exists($lang_path)) { require $lang_path; }
/** * Check Apache can write to the required directories * */ static function checkDirPermissionsPost() { global $string; self::$rogo_path = str_ireplace('/install/index.php', '', normalise_path($_SERVER['SCRIPT_FILENAME'])); $errors = array(); //tmp if (!is_writable($_POST['tmpdir'])) { $errors['100'] = sprintf($string['errors3'], $_POST['tmpdir']); } if (count($errors) > 0) { self::displayError($errors); } }
// Rogō is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Rogō. If not, see <http://www.gnu.org/licenses/>. /** * * @author Simon Atack, Simon Wilkinson * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ $root = str_replace('/include', '/', str_replace('\\', '/', dirname(__FILE__))); $cfg_root_path = rtrim('/' . trim(str_replace(normalise_path($_SERVER['DOCUMENT_ROOT']), '', $root), '/'), '/'); ?> <!DOCTYPE html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="content-type" content="text/html;charset=<?php echo $this->configObj->get('cfg_page_charset'); ?> " /> <title>Rogō - <?php echo $string['signin']; ?> </title> <link rel="stylesheet" type="text/css" href="<?php
/** * * Path related utility functions * * @author Rob Ingram * @version 1.0 * @copyright Copyright (c) 2014 The University of Nottingham * @package */ function get_root_path() { $path_parts = pathinfo(dirname(__FILE__)); return normalise_path($path_parts['dirname']); }