/** * Initialize. * @param {array} $settings The settings. (Optional.) */ public static function init($settings = array()) { foreach (self::$cfg as $key => $value) { if (isset($settings[$key])) { self::$cfg[$key] = $settings[$key]; } } if (session_id() == '') { $sessParams = session_get_cookie_params(); session_set_cookie_params($sessParams['lifetime'], $sessParams['path'], $sessParams['domain'], $sessParams['secure'], TRUE); session_name('aestas3'); session_start(); $_SESSION['last_action'] = time(); } if (empty($_SERVER['HTTP_USER_AGENT'])) { ae_Log::warning('[' . get_class() . '] <code>$_SERVER["HTTP_USER_AGENT"] has no value.</code>'); } if (empty($_SERVER['REMOTE_ADDR'])) { ae_Log::warning('[' . get_class() . '] <code>$_SERVER["REMOTE_ADDR"] has no value.</code>'); } }
<?php require_once '../core/autoload.php'; require_once '../core/config.php'; if (!ae_Security::isLoggedIn()) { header('Location: index.php?error=not_logged_in'); exit; } $area = 'dashboard'; if (!isset($_GET['area'])) { $area = 'dashboard'; } else { if (!ae_Security::isValidArea($_GET['area'])) { $msg = sprintf('Area "%s" is not a valid area.', htmlspecialchars($_GET['area'])); ae_Log::warning($msg); } else { $area = $_GET['area']; } } $sb = new ae_SiteBuilder(); include_once 'sb_params.php'; ?> <!DOCTYPE html> <html> <?php $sb->render('templates/head.php', $paramsHead); ?> <body> <?php
/** * Get the file MIME type. * Tries to use the more reliable "fileinfo", but can fall back * to the MIME type from the upload. * @param {string} $tmpName Temporary file name. * @param {string} $uploadType MIME type from the upload. * @return {string} MIME type. */ public static function getMIMEType($tmpName, $uploadType) { // PHP >= 5.3.0 or PECL fileinfo >= 0.1.0 if (!function_exists('finfo_open')) { $msg = sprintf('[%s] Function <code>finfo_open</code> does not exist.', get_class()); ae_Log::warning(); return $uploadType; } $finfoHandle = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfoHandle, $tmpName); finfo_close($finfoHandle); return $mime; }