require_once $path . "smarty/smarty_config.php"; //Assign the configuration variables to smarty $smarty->assign("T_CONFIGURATION", $configuration); //Assign global configuration values to smarty $smarty->assign("T_MAX_FILE_SIZE", FileSystemTree::getUploadMaxSize()); //Initialize languages and notify smarty on weather we have an RTL language $languages = EfrontSystem::getLanguages(); if ($languages[$setLanguage]['rtl']) { $smarty->assign("T_RTL", 1); $GLOBALS['rtl'] = true; } //$smarty -> assign("T_RTL", 1);$GLOBALS['rtl'] = true; //Instantiate current theme //$currentTheme = new themes(G_CURRENTTHEME); $smarty->assign("T_THEME_SETTINGS", $currentTheme); $smarty->assign("T_LOGO", EfrontSystem::setLogoFile($currentTheme)); $smarty->assign("T_FAVICON", EfrontSystem::setFaviconFile($currentTheme)); /**Initialize valid currencies * @todo: remove from here, move to a function or class*/ require_once $path . "includes/currencies.php"; //Load filters if smarty is set if (isset($smarty)) { //Convert normal images to css sprites $smarty->load_filter('output', 'eF_template_applyImageMap'); //Convert plain urls to theme-specific urls $smarty->load_filter('output', 'eF_template_applyThemeToImages'); //Format the timestamps according to system settings $smarty->load_filter('output', 'eF_template_formatTimestamp'); //Convert logins to personal-message enabled clickable links $smarty->load_filter('output', 'eF_template_loginToMessageLink'); //Format logins according to system settings
$logoDirectory = new EfrontDirectory(G_LOGOPATH); $filesystem = new FileSystemTree(G_LOGOPATH); try { $logoFile = $filesystem->uploadFile('site_logo', $logoDirectory); if (strpos($logoFile['mime_type'], 'image') === false) { throw new EfrontFileException(_NOTANIMAGEFILE, EfrontFileException::NOT_APPROPRIATE_TYPE); } EfrontConfiguration::setValue('site_logo', $logoFile['id']); } catch (EfrontFileException $e) { if ($e->getCode() != UPLOAD_ERR_NO_FILE) { throw $e; } //Don't halt if no file was uploaded (errcode = 4). Otherwise, throw the exception } if (empty($logoFile)) { $logoFile = new EfrontFile(EfrontSystem::setLogoFile($currentTheme)); } // Normalize avatar picture to the dimensions set in the System Configuration menu. NOTE: the picture will be modified to match existing settings. Future higher settings will be disregarded, while lower ones might affect the quality of the displayed image if ($values["normalize_dimensions"] == 1) { eF_normalizeImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $values["logo_max_width"], $values["logo_max_height"]); } else { list($width, $height) = getimagesize(G_LOGOPATH . $logoFile['name']); eF_createImage(G_LOGOPATH . $logoFile['name'], $logoFile['extension'], $width, $height, $values["logo_max_width"], $values["logo_max_height"]); } EfrontConfiguration::setValue('logo_timestamp', time()); // to avoid browser caching when changing logo dimensions EfrontCache::getInstance()->deleteCache('logo'); eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=appearance&tab=logo&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success"); } catch (Exception $e) { handleNormalFlowExceptions($e); }