require dirname(__FILE__) . '/../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/url.lib.php'; require_once get_path('incRepositorySys') . '/lib/file.lib.php'; require_once get_path('incRepositorySys') . '/lib/file/downloader.lib.php'; $nameTools = get_lang('Display file'); $dialogBox = new DialogBox(); $noPHP_SELF = true; $isDownloadable = true; if (claro_is_in_a_course() && !claro_is_course_allowed()) { claro_disp_auth_form(true); } $claroline->notification->addListener('download', 'trackInCourse'); if (isset($_REQUEST['url'])) { $requestUrl = strip_tags($_REQUEST['url']); } else { $requestUrl = strip_tags(get_path_info()); } if (is_download_url_encoded($requestUrl)) { $requestUrl = download_url_decode($requestUrl); } if (empty($requestUrl)) { $isDownloadable = false; $dialogBox->error(get_lang('Missing parameters')); } else { if (isset($_REQUEST['moduleLabel']) && !empty($_REQUEST['moduleLabel'])) { $moduleLabel = $_REQUEST['moduleLabel']; } else { if (!claro_is_in_a_course()) { $moduleLabel = null; } else { $moduleLabel = 'CLDOC';
function go_home() { header('Location: ' . get_path_info()); exit; }
Response::error(401, $_SERVER["SERVER_PROTOCOL"] . ' 401 Unauthorized (USER is missing required access rights). '); } if (!$feide->hasAdminScope()) { Response::error(401, $_SERVER["SERVER_PROTOCOL"] . ' 401 Unauthorized (CLIENT is missing required scope). '); } } /** * http://stackoverflow.com/questions/4861053/php-sanitize-values-of-a-array/4861211#4861211 */ function sanitizeInput() { $_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING); $_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING); } // -------------------- ./UTILS -------------------- // // ---------------------- MATCH AND EXECUTE REQUESTED ROUTE ---------------------- $match = $router->match(); if ($match && is_callable($match['target'])) { verifyOrgAccess(); sanitizeInput(); call_user_func_array($match['target'], $match['params']); } else { Response::error(404, $_SERVER["SERVER_PROTOCOL"] . " The requested resource [" . get_path_info() . "] could not be found."); } // ---------------------- /.MATCH AND EXECUTE REQUESTED ROUTE ---------------------- function get_path_info() { global $API_BASE_PATH; $requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; return substr($requestUrl, strlen($API_BASE_PATH)); }
<?php //todo:检查是否支持php5及pathinfo if (version_compare(phpversion(), '5', '<')) { Header('Location: view/notice_php.html'); //todo:不支持php5,警告页 exit; } if (isset($_GET['check_path_info'])) { $path_info = get_path_info(); if ($path_info) { echo 'SUPPORT_PATHINFO'; } else { echo 'NO_SUPPORT_PATHINFO'; } exit; } function get_path_info() { $path_info = ''; if (isset($_SERVER['PATH_INFO'])) { $path_info = $_SERVER['PATH_INFO']; } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { $path_info = $_SERVER['ORIG_PATH_INFO']; $script_name = get_script_name(); if (substr($script_name, -1, 1) == '/') { $path_info = $path_info . '/'; } } else { $script_name = get_script_name(); $script_dir = preg_replace('/[^\\/]+$/', '', $script_name);