$level += 1; } if (file_exists($root . '/framework/class.secure.php')) { include $root . '/framework/class.secure.php'; } else { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } // ================================= // ! Include the WB functions file // ================================= include_once CAT_PATH . '/framework/functions.php'; $dirh = CAT_Helper_Directory::getInstance(); $user = CAT_Users::getInstance(); $val = CAT_Helper_Validate::getInstance(); $date = CAT_Helper_DateTime::getInstance(); // check viewing permissions if ($val->sanitizePost('load_url') == '' || $user->checkPermission('media', 'media_view', false) !== true) { header('Location: ' . CAT_ADMIN_URL); exit; } $load_file = urldecode($val->sanitizePost('load_url')); $load_url = $val->sanitizePost('folder_path') . '/' . $load_file; $load_path = CAT_PATH . '/' . $load_url; $ajax = array('initial_folder' => $dirh->sanitizePath($load_url), 'MEDIA_DIRECTORY' => MEDIA_DIRECTORY); $allowed_img_types = array('jpg', 'jpeg', 'png', 'gif', 'tif'); if (is_dir($load_path) || is_dir(utf8_decode($load_path))) { $ajax['is_folder'] = true; $ajax['is_writable'] = is_writable($load_path); // ======================================== // ! Get contents for the intitial folder
$client = new Zend\Http\Client($current['source'], array('timeout' => $current['timeout'], 'adapter' => 'Zend\\Http\\Client\\Adapter\\Proxy', 'proxy_host' => $current['proxy_host'], 'proxy_port' => $current['proxy_port'])); $client->setHeaders(array('Pragma' => 'no-cache', 'Cache-Control' => 'no-cache')); try { $response = $client->send(); if ($response->getStatusCode() != '200') { $error = "Unable to load source " . "(using Proxy: " . (isset($current['proxy_host']) && $current['proxy_host'] != '' ? 'yes' : 'no') . ")<br />" . "Status: " . $response->getStatus() . " - " . $response->getMessage() . ($debug ? "<br />" . var_dump($client->getLastRequest()) : NULL) . "<br />"; $version = 'unknown'; } else { $version = $response->getBody(); } } catch (Exception $e) { $error = "Unable to load source " . "(using Proxy: " . (isset($current['proxy_host']) && $current['proxy_host'] != '' ? 'yes' : 'no') . ")<br />" . $e->getMessage() . "<br />"; $version = 'unknown'; } if ($version && $version != 'unknown') { if (CAT_Helper_Addons::getInstance()->versionCompare($version, CAT_VERSION, '>')) { $newer = true; } } $fh = @fopen(CAT_Helper_Directory::sanitizePath(dirname(__FILE__) . '/../data/.last'), 'w'); if (is_resource($fh)) { fputs($fh, time() . '|' . $version); fclose($fh); } } else { $version = isset($last_version) && $last_version != '' ? $last_version : $version; } global $parser; $parser->setPath(dirname(__FILE__) . '/../templates/default'); $parser->output('widget.tpl', array('error' => $error, 'version' => $version, 'newer' => $newer, 'last' => CAT_Helper_DateTime::getInstance()->getDate($last) . ' ' . CAT_Helper_DateTime::getInstance()->getTime($last), 'CAT_VERSION' => CAT_VERSION, 'uri' => $_SERVER['SCRIPT_NAME'], 'missing_mailer_libs' => count(CAT_Helper_Addons::getLibraries('mail')), 'missing_wysiwyg' => count(CAT_Helper_Addons::get_addons(NULL, 'module', 'wysiwyg'))));
/** * global settings **/ function show_step_globals($step) { global $lang, $parser, $installer_uri, $config, $dirh; global $timezone_table; write2log('> [show_step_globals()]'); // get timezones include dirname(__FILE__) . '/../framework/CAT/Helper/DateTime.php'; $timezone_table = CAT_Helper_DateTime::getInstance()->getTimezones(); $lang_dir = dirname(__FILE__) . "/../languages/"; $lang_files = $dirh->setRecursion(false)->setSkipFiles(array('index'))->getPHPFiles($lang_dir, $lang_dir); $dirh->setRecursion(true); // reset // get language name foreach ($lang_files as $temp_file) { $str = file($lang_dir . $temp_file); $language_name = ""; foreach ($str as $line) { if (strpos($line, "language_name") != false) { eval($line); break; } } $lang_short = pathinfo($temp_file, PATHINFO_FILENAME); $langs[$lang_short] = $language_name; } ksort($langs); if (!isset($config['default_language'])) { $config['default_language'] = $lang->getLang(); } // generate a GUID prefix if (!isset($config['guid_prefix'])) { // VERY simple algorithm, no need for something more creative $config['guid_prefix'] = implode('', array_rand(array_flip(array_merge(range('a', 'z'), range('A', 'Z'), range('0', '9'))), 4)); } // operating system // --> FrankH: Detect OS $ctrue = " checked='checked'"; $cfalse = ""; if (substr(php_uname('s'), 0, 7) == "Windows") { $osw = $ctrue; $osl = $cfalse; $startstyle = "none"; } else { $osw = $cfalse; $osl = $ctrue; $startstyle = "block"; } // <-- FrankH: Detect OS $output = $parser->get('globals.tpl', array('installer_cat_url' => dirname($installer_uri) . '/', 'installer_guid_prefix' => $config['installer_guid_prefix'], 'timezones' => $timezone_table, 'installer_default_timezone_string' => $config['default_timezone_string'], 'languages' => $langs, 'installer_default_language' => $config['default_language'], 'editors' => findWYSIWYG(), 'installer_default_wysiwyg' => $config['default_wysiwyg'], 'installer_ssl' => isset($config['ssl']) ? $config['ssl'] : sslCheck(), 'installer_guid_prefix' => $config['guid_prefix'], 'is_linux' => $osl, 'is_windows' => $osw, 'errors' => $step['errors'], 'ssl_available' => isset($config['ssl_available']) ? $config['ssl_available'] : sslCheck())); write2log('< [show_step_globals()]'); return array(true, $output); }