function phpextension($name) { global $phpextension_loaded, $debug; $name = strtolower($name); if (!isset($phpextension_loaded[$name])) { $path = get_root_path() . '/library/' . strtr($name, '_', '.') . '.php'; if (!file_exists($path)) { trigger_error(trigger_message("Failed loading extension '{$name}' - File '{$path}' not found"), E_USER_ERROR); } require_once $path; $phpextension_loaded[$name] = true; } }
private function _check_directories_mode() { $messages = array(); //$config['convert_files']['uploaded'] $convert_files = $this->config->item('convert_files'); //php-file-converter\convert-files\completed //php-file-converter\convert-files\uploaded //php-file-converter\application\db //php-file-converter\application\db\php-file-converter.sqlite.db $dir_ary = array(get_root_path($convert_files['uploaded']), get_root_path($convert_files['completed']), get_root_path("application/db"), get_root_path("application/db/php-file-converter.sqlite.orig.db"), get_root_path("application/db/php-file-converter.sqlite.db")); foreach ($dir_ary as $dir) { $dir_mode = is_writable($dir); if ($dir_mode === FALSE) { $result = @chmod($dir, 755); if ($result === FALSE) { array_push($messages, $dir); } } } return $messages; }
* Bad stuff protection */ define('IN_GS', TRUE); include_once 'nonce.php'; include_once 'xss.php'; if (version_compare(PHP_VERSION, "5") >= 0) { foreach ($_GET as &$xss) { $xss = antixss($xss); } } /** * Basic file inclusions */ include 'basic.php'; include 'template_functions.php'; define('GSROOTPATH', get_root_path()); if (file_exists(GSROOTPATH . 'gsconfig.php')) { require_once GSROOTPATH . 'gsconfig.php'; } if (defined('GSADMIN')) { $GSADMIN = GSADMIN; } else { $GSADMIN = 'admin'; } /** * Define some constants */ define('GSADMINPATH', get_admin_path()); define('GSADMININCPATH', GSADMINPATH . 'inc/'); define('GSPLUGINPATH', GSROOTPATH . 'plugins/'); define('GSLANGPATH', GSADMINPATH . 'lang/');
| ['autoinit'] Whether or not to automatically initialize the database. | ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections | - good for ensuring strict SQL while developing | | The $active_group variable lets you choose which connection group to | make active. By default there is only one group (the 'default' group). | | The $active_record variables lets you determine whether or not to load | the active record class */ $active_group = 'default'; $active_record = TRUE; $db['default']['hostname'] = 'sqlite:' . APPPATH . 'db/php-file-converter.sqlite.db'; $custom_db = get_root_path() . "application/db/php-file-converter.sqlite.db"; $orig_db = get_root_path() . "application/db/php-file-converter.sqlite.orig.db"; if (!is_file(get_root_path() . "application/db/php-file-converter.sqlite.db")) { copy($orig_db, $custom_db); } $db['default']['username'] = ''; $db['default']['password'] = ''; $db['default']['database'] = ''; $db['default']['dbdriver'] = 'pdo'; $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = TRUE; $db['default']['db_debug'] = TRUE; $db['default']['cache_on'] = FALSE; $db['default']['cachedir'] = ''; $db['default']['char_set'] = 'utf8'; $db['default']['dbcollat'] = 'utf8_general_ci'; $db['default']['swap_pre'] = ''; $db['default']['autoinit'] = TRUE;
function get_local($url) { $urlParts = parse_url($url); return get_root_path() . $urlParts['path']; }
/** * 重置資料 */ public function reset() { $debug = false; $this->load->library("Convert_handler"); $convert_handler = new Convert_handler(); $convert_handler->unlock(); // 刪除指定目錄檔案 $file_dirs = $this->config->item("convert_files"); foreach ($file_dirs as $file_dir) { $files = get_filenames($file_dir); foreach ($files as $file) { $path = get_root_path($file_dir . DIRECTORY_SEPARATOR . $file); if ($debug) { echo "unlink: " . $path . "<br />"; } else { unlink($path); } } } // 刪除SQLite檔案 $sqlite_path = get_root_path("application/db/php-file-converter.sqlite.db"); $sqlite_orig_path = get_root_path("application/db/php-file-converter.sqlite.orig.db"); if ($debug) { echo "copy: " . $sqlite_orig_path . "<br />"; echo "copy to: " . $sqlite_path . "<br />"; } else { copy($sqlite_orig_path, $sqlite_path); } $this->load->view('component/header'); $this->load->view('reset_view'); $this->load->view('component/footer'); }
// Basic functionality include 'basic.php'; include 'template_functions.php'; // Define some constants define('GSROOTPATH', get_root_path()); define('GSADMINPATH', get_admin_path()); define('GSADMININCPATH', get_admin_path() . 'inc/'); define('GSPLUGINPATH', get_root_path() . 'plugins/'); define('GSLANGPATH', get_admin_path() . 'lang/'); define('GSDATAPATH', get_root_path() . 'data/'); define('GSDATAOTHERPATH', get_root_path() . 'data/other/'); define('GSDATAPAGESPATH', get_root_path() . 'data/pages/'); define('GSDATAUPLOADPATH', get_root_path() . 'data/uploads/'); define('GSTHUMBNAILPATH', get_root_path() . 'data/thumbs/'); define('GSBACKUPSPATH', get_root_path() . 'backups/'); define('GSTHEMESPATH', get_root_path() . 'theme/'); if (file_exists(GSROOTPATH . 'gsconfig.php')) { include GSROOTPATH . 'gsconfig.php'; } // Debugging if (defined('GSDEBUG') && GSDEBUG == TRUE) { error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 1); } else { error_reporting(0); @ini_set('display_errors', 0); } ini_set('log_errors', 1); ini_set('error_log', GSDATAOTHERPATH . 'logs/errorlog.txt'); // Variable check to prevent debugging going off $relative = isset($relative) ? $relative : '';
public static function option_factory($mysqli, $user_id, $question, $number, &$lang_strings, $data = -1) { $object = null; $root = get_root_path(); $root .= '/classes/'; $question_type = $question->get_type(); $classname = 'Option' . strtoupper($question_type); $classfile = 'options/option_' . strtolower($question_type) . '.class.php'; if (file_exists($root . $classfile)) { include_once $classfile; } else { $classname = 'OptionEdit'; } if ($data != -1 and ctype_digit($data)) { try { $object = new $classname($mysqli, $user_id, $question, $number, $lang_strings, $data); } catch (Exception $ex) { throw new ClassNotFoundException(sprintf($lang_strings['noclasserror'], $classname)); } } else { try { if (is_array($data)) { $object = new $classname($mysqli, $user_id, $question, $number, $lang_strings, $data); } else { $object = new $classname($mysqli, $user_id, $question, $number, $lang_strings); } } catch (Exception $ex) { throw new ClassNotFoundException(sprintf($lang_strings['noclasserror'], $classname)); } } return $object; }
?> <!DOCTYPE html> <html> <head> <title>Error: PHP is Missing</title> </head> <body> <h2>Error: PHP is Missing</h2> <p>Rogō requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p> </body> </html> <?php exit; } require '../include/path_functions.inc.php'; $cfg_web_root = get_root_path() . '/'; $cfg_root_path = ltrim(str_replace($_SERVER['DOCUMENT_ROOT'], '', $cfg_web_root), '/'); require $cfg_web_root . 'classes/installutils.class.php'; $version = '6.0.4'; set_time_limit(0); //basic checks InstallUtils::displayHeader(); //InstallUtils::checkHTTPS(); InstallUtils::checkSoftware(); InstallUtils::checkDirPermissionsPre(); //have we got a config file? exits if we do, as this is an install InstallUtils::configFile(); //output form if (isset($_POST['install'])) { InstallUtils::checkDirPermissionsPost(); InstallUtils::processForm();
<?php define('DEBUG', false); # page settings define('BASE_URL', get_site_path()); define('SITENAME', 'Example Company'); # site settings define('USE_DATABASE', FALSE); # email settings define('FROM_EMAIL_ADDRESS', ''); # mysql database settings if (USE_DATABASE) { if (!strstr(BASE_URL, 'projects')) { define('DB_HOST', ''); define('DB_USER', ''); define('DB_PASS', ''); define('DB_DATABASE', ''); } else { define('DB_HOST', '127.0.0.1'); define('DB_USER', 'root'); define('DB_PASS', 'admin'); define('DB_DATABASE', 'admin_test'); } connect_database(); } # data paths define('EXPORT_PATH', get_root_path() . 'data/exports/');
/** * 取得上鎖檔案路徑 * @return {String} */ private function _get_lock_file_path() { $rootpath = get_root_path(); return $rootpath . "converter-lock.txt"; }
function format_link($url, $base_url) { $root_path = get_root_path($base_url); if (substr($base_url, -1, 1) !== '/') { $base_url = substr($base_url, 0, strrpos($base_url, '/') + 1); } if (preg_match("@(https?:\\/\\/[^/]*)@i", $url)) { $path = $url; } elseif ($url[0] == '/') { $path = $root_path . $url; } elseif (substr($url, 0, 2) == './') { $path = $base_url . (strlen($url) > 2 ? substr($url, 2) : ''); } elseif (substr($url, 0, 3) == '../') { while (substr($url, 0, 3) == '../') { if (strpos(preg_replace('&^\\s*http://([^/]*)/?&i', '', $base_url), '/') === false) { $url = preg_replace('/(\\.\\.\\/)+/i', '', $url); break; } $rp = strrpos(rtrim($base_url, '/'), '/'); if ($rp === false) { break; } $base_url = substr($base_url, 0, $rp + 1); $url = substr($url, 3); } $path = $base_url . $url; } else { $path = $base_url . $url; } return str_replace('&', '&', $path); }