/** * @ignore */ public static function renderview($uObject) { if (self::$engine === null) { $tPath = Io::translatePath(Config::get('raintpl/path', '{core}include/3rdparty/raintpl/inc')); require $tPath . '/rain.tpl.class.php'; raintpl::configure('base_url', null); raintpl::configure('tpl_dir', $uObject['templatePath']); raintpl::configure('tpl_ext', '.rain'); raintpl::configure('cache_dir', Io::translatePath('{writable}cache/raintpl/')); if (Framework::$disableCaches) { raintpl::configure('check_template_update', true); } self::$engine = new \RainTPL(); } else { self::$engine = new \RainTPL(); } self::$engine->assign('model', $uObject['model']); if (is_array($uObject['model'])) { foreach ($uObject['model'] as $tKey => $tValue) { self::$engine->assign($tKey, $tValue); } } foreach (Framework::$variables as $tKey => $tValue) { self::$engine->assign($tKey, $tValue); } self::$engine->draw($uObject['templateFile']); }
/** * @ignore */ public static function extensionLoad() { self::$filename = Config::get('logger/filename', '{date|\'d-m-Y\'}.txt'); self::$line = Config::get('logger/line', '[{date|\'d-m-Y H:i:s\'}] {strtoupper|@category} | {@ip} | {@location} | {@message}'); set_exception_handler('Scabbia\\Extensions\\Logger\\Logger::exceptionCallback'); set_error_handler('Scabbia\\Extensions\\Logger\\Logger::errorCallback', E_ALL); }
/** * @ignore */ public static function renderview($uObject) { if (self::$engine === null) { $tPath = Io::translatePath(Config::get('smarty/path', '{core}include/3rdparty/smarty/libs')); require $tPath . '/Smarty.class.php'; self::$engine = new \Smarty(); self::$engine->setTemplateDir($uObject['templatePath']); self::$engine->setCompileDir(Io::translatePath('{writable}cache/smarty/')); if (Framework::$disableCaches) { self::$engine->force_compile = true; } } else { self::$engine->clearAllAssign(); } self::$engine->assignByRef('model', $uObject['model']); if (is_array($uObject['model'])) { foreach ($uObject['model'] as $tKey => $tValue) { self::$engine->assignByRef($tKey, $tValue); } } foreach (Framework::$variables as $tKey => $tValue) { self::$engine->assignByRef($tKey, $tValue); } self::$engine->display($uObject['templateFile']); }
/** * @ignore */ public static function routing() { if (self::$packs === null) { self::$packs = Config::get('assets/packList', array()); foreach (Config::get('assets/fileList', array()) as $tFile) { self::$packs[] = array('partList' => array(array('bindtype' => $tFile['bindtype'], 'name' => $tFile['name'])), 'name' => $tFile['name'], 'type' => $tFile['type'], 'cacheTtl' => isset($tFile['cacheTtl']) ? $tFile['cacheTtl'] : 0); } self::$directories = Config::get('assets/directoryList', array()); } foreach (self::$directories as $tDirectory) { $tDirectoryName = rtrim($tDirectory['name'], '/'); $tLen = strlen($tDirectoryName); if (substr(Request::$pathInfo, 0, $tLen) === $tDirectoryName) { if (self::getDirectory($tDirectory, substr(Request::$pathInfo, $tLen)) === true) { // to interrupt event-chain execution return true; } } } if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) { $tSubParts = explode(',', $_SERVER['QUERY_STRING']); } else { $tSubParts = array(); } if (self::getPack(Request::$pathInfo, $tSubParts) === true) { // to interrupt event-chain execution return true; } return null; }
/** * @ignore */ public static function renderview($uObject) { if (self::$engine === null) { $tPath = Io::translatePath(Config::get('phptal/path', '{core}include/3rdparty/PHPTAL')); require $tPath . '/PHPTAL.php'; self::$engine = new \PHPTAL(); } else { unset(self::$engine); // I just don't want to do it in this way, // but phptal.org documentation says it so. self::$engine = new \PHPTAL(); } self::$engine->set('model', $uObject['model']); if (is_array($uObject['model'])) { foreach ($uObject['model'] as $tKey => $tValue) { self::$engine->set($tKey, $tValue); } } foreach (Framework::$variables as $tKey => $tValue) { self::$engine->set($tKey, $tValue); } self::$engine->setForceReparse(false); self::$engine->setTemplateRepository($uObject['templatePath']); self::$engine->setPhpCodeDestination(Io::translatePath('{writable}cache/phptal/')); self::$engine->setOutputMode(PHPTAL::HTML5); self::$engine->setEncoding('UTF-8'); self::$engine->setTemplate($uObject['templateFile']); if (Framework::$disableCaches) { self::$engine->prepare(); } self::$engine->echoExecute(); }
/** * Checks the set of rules against visitor's data. */ public static function prerun(array $uParms) { self::$maintenance = Config::get('access/maintenance/mode', false); self::$maintenanceExcludeIps = Config::get('access/maintenance/ipExcludeList', array()); foreach (Config::get('access/ipFilter/ipFilterList', array()) as $tIpFilterList) { if (preg_match('/^' . str_replace(array('.', '*', '?'), array('\\.', '[0-9]{1,3}', '[0-9]{1}'), $tIpFilterList['pattern']) . '$/i', $_SERVER['REMOTE_ADDR'])) { if ($tIpFilterList['type'] === 'allow') { self::$ipFilters = array(); continue; } self::$ipFilters[] = $tIpFilterList['pattern']; } } if (self::$maintenance && !in_array($_SERVER['REMOTE_ADDR'], self::$maintenanceExcludeIps)) { header(Request::$protocol . ' 503 Service Unavailable', true, 503); header('Retry-After: 600', true); // to interrupt event-chain execution throw new CustomException('maintenance', I18n::_('Service Unavailable'), I18n::_('This service is currently undergoing scheduled maintenance. ' . 'Please try back later. Sorry for the inconvenience.')); } if (count(self::$ipFilters) > 0) { header(Request::$protocol . ' 403 Forbidden', true, 403); // to interrupt event-chain execution throw new CustomException('ipban', I18n::_('Service Unavailable'), I18n::_('Your access have been banned from this service.')); } return null; }
/** * @ignore */ public static function load() { if (self::$languages === null) { self::$languages = array(); foreach (Config::get('i18n/languageList', array()) as $tLanguage) { self::$languages[$tLanguage['id']] = array('key' => $tLanguage['id'], 'locale' => $tLanguage['locale'], 'internalEncoding' => $tLanguage['internalEncoding'], 'name' => $tLanguage['name']); } } }
/** * @ignore */ public static function load() { if (self::$autoModels === null) { self::$autoModels = array(); foreach (Config::get('autoModelList', array()) as $tAutoModelKey => $tAutoModel) { self::$autoModels[$tAutoModelKey] = $tAutoModel; } } }
/** * @ignore */ public static function getDataset($uDataset = null) { if (self::$datasets === null) { foreach (Config::get('datasetList', array()) as $tDatasetConfig) { $tDataset = new DatabaseDataset($tDatasetConfig); self::$datasets[$tDataset->id] = $tDataset; } } return self::$datasets[$uDataset]; }
/** * @ignore */ public static function viewFile($uView, $uModel = null) { $tViewFilePath = Io::translatePath($uView); $tViewFileInfo = pathinfo($tViewFilePath); if (self::$viewEngines === null) { self::$viewEngines = Config::get('views/viewEngineList', array()); } if (!isset(self::$viewEngines[$tViewFileInfo['extension']])) { $tViewFileInfo['extension'] = Config::get('views/defaultViewExtension', 'php'); } $tTemplatePath = $tViewFileInfo['dirname'] . '/'; $tViewFile = $tViewFileInfo['basename']; $tViewArray = array('templatePath' => &$tTemplatePath, 'templateFile' => &$tViewFile, 'compiledFile' => hash('adler32', $uView) . '-' . $tViewFileInfo['basename'], 'model' => &$uModel); call_user_func(self::$viewEngines[$tViewFileInfo['extension']] . '::renderview', $tViewArray); }
/** * @ignore */ public static function get($uDatasource = null) { if (self::$interfaces === null) { self::$interfaces = Config::get('dataInterfaceList', array()); } if (self::$datasources === null) { foreach (Config::get('datasourceList', array()) as $tDatasourceConfig) { $tDatasource = new self::$interfaces[$tDatasourceConfig['interface']]($tDatasourceConfig); self::$datasources[$tDatasourceConfig['id']] = $tDatasource; } } // default name is dbconn if ($uDatasource === null) { $uDatasource = 'dbconn'; } return self::$datasources[$uDatasource]; }
/** * @ignore */ public static function exportJs() { $tReturn = <<<EOD \$l.extend({ EOD; $tMethods = array(); foreach (Config::get('larouxjs/methods', array()) as $tMethod) { $tSplit = explode('.', $tMethod); $tMethodName = array_pop($tSplit); // $tNamespace = Framework::$application->name . '\\Controllers\\' . implode('\\', $tSplit); $tPath = implode('/', $tSplit); if (!isset($tMethods[$tPath])) { $tMethods[$tPath] = array(); } $tMethods[$tPath][] = $tMethodName; } if (count($tMethods) > 0) { foreach ($tMethods as $tMethodController => $tMethodActions) { $tLines = array(); if (isset($tFirst)) { $tReturn .= ','; } else { $tFirst = false; } $tReturn .= PHP_EOL . "\t" . str_replace('/', '_', $tMethodController) . ': {' . PHP_EOL; foreach ($tMethodActions as $tMethodAction) { $tLines[] = "\t\t" . $tMethodAction . ': function(values, successfnc, errorfnc, method) { if (typeof method == \'undefined\') method = \'post\'; $l.ajax[method](\'' . Http::url($tMethodController . '/' . $tMethodAction) . '\', values, successfnc, errorfnc); }'; } $tReturn .= implode(',' . PHP_EOL, $tLines) . PHP_EOL . "\t" . '}'; } $tReturn .= ','; } $tReturn .= <<<EOD translations: EOD; $tReturn .= json_encode(self::$translations); $tReturn .= <<<EOD }); EOD; return $tReturn; }
/** * @ignore */ public static function renderview($uObject) { if (self::$engine === null) { $tPath = Io::translatePath(Config::get('twig/path', '{core}include/3rdparty/twig/lib/Twig')); require $tPath . '/Autoloader.php'; Twig_Autoloader::register(); self::$loader = new \Twig_Loader_Filesystem($uObject['templatePath']); $tOptions = array('cache' => Io::translatePath('{writable}cache/twig/')); if (Framework::$disableCaches) { $tOptions['auto_reload'] = true; } self::$engine = new \Twig_Environment(self::$loader, $tOptions); } $model = array('model' => &$uObject['model']); if (is_array($uObject['model'])) { $model = array_merge($model, $uObject['model']); } $model = array_merge($model, Framework::$variables); echo self::$engine->render($uObject['templateFile'], $model); }
/** * @ignore */ public static function loadApi($uForceClear = false) { self::$appId = Config::get('facebook/applicationId'); self::$appSecret = Config::get('facebook/applicationSecret'); self::$appUrl = Config::get('facebook/applicationUrl'); self::$appPermissions = Config::get('facebook/permissions', 'email'); self::$appRedirectUri = Config::get('facebook/redirectUrl'); self::$appFileUpload = Config::get('facebook/fileUpload', false); self::$appExtendedAccess = Config::get('facebook/extendedAccess', false); self::$api = new \Facebook(array('appId' => self::$appId, 'secret' => self::$appSecret, 'cookie' => true, 'fileUpload' => self::$appFileUpload)); self::$userId = self::$api->getUser(); self::$facebookData = Session::get('facebookData', null); $tFirstTime = self::$facebookData === null || self::$facebookData['userid'] !== self::$userId; if ($tFirstTime && self::$appExtendedAccess) { self::$api->setExtendedAccessToken(); } if ($uForceClear || $tFirstTime) { self::$facebookData = array('userid' => self::$userId, 'access_token' => self::$api->getAccessToken(), 'cache' => array()); Session::set('facebookData', self::$facebookData); } }
/** * @ignore */ public static function send($uFrom, $uTo, $uData) { $tResult = array(); self::$host = Config::get('smtp/host', 'localhost'); self::$port = Config::get('smtp/port', 25); self::$username = Config::get('smtp/username'); self::$password = Config::get('smtp/password'); // self::$from =; $tSmtp = fsockopen(self::$host, self::$port); if ($tSmtp !== false) { self::sockwait($tSmtp, '220'); fputs($tSmtp, 'EHLO ' . self::$host . "\n"); self::sockwait($tSmtp, '250'); if (strlen(self::$username) > 0) { fputs($tSmtp, 'AUTH LOGIN' . "\n"); self::sockwait($tSmtp, '334'); fputs($tSmtp, base64_encode(self::$username) . "\n"); self::sockwait($tSmtp, '334'); fputs($tSmtp, base64_encode(self::$password) . "\n"); self::sockwait($tSmtp, '235'); } fputs($tSmtp, 'MAIL FROM: ' . $uFrom . "\n"); self::sockwait($tSmtp, '250'); // todo: to+cc+bcc parsing foreach ((array) $uTo as $tToRecipient) { echo "{$tToRecipient}<br>"; fputs($tSmtp, 'RCPT TO: ' . $tToRecipient . "\n"); self::sockwait($tSmtp, '250'); } fputs($tSmtp, 'DATA' . "\n"); self::sockwait($tSmtp, '354'); fputs($tSmtp, $uData . "\n.\n"); self::sockwait($tSmtp, '250'); fputs($tSmtp, 'QUIT' . "\n"); fclose($tSmtp); } return $tResult; }
/** * @ignore */ public static function open() { self::$datasource = Datasources::get(Config::get('session/datasource', 'fileCache')); self::$sessionName = Config::get('session/cookie/name', 'sessid'); if (Config::get('session/cookie/nameIp', true)) { self::$sessionName .= hash('adler32', $_SERVER['REMOTE_ADDR']); } self::$sessionTtl = Config::get('session/cookie/ttl', 0); if (isset($_COOKIE[self::$sessionName])) { self::$id = $_COOKIE[self::$sessionName]; } if (self::$id !== null) { $tIpCheck = Config::get('session/cookie/ipCheck', false); $tUACheck = Config::get('session/cookie/uaCheck', true); $tData = self::$datasource->cacheGet('sessions/' . self::$id); if ($tData !== false) { if ((!$tIpCheck || $tData['ip'] === $_SERVER['REMOTE_ADDR']) && (!$tUACheck || $tData['ua'] === $_SERVER['HTTP_USER_AGENT'])) { self::$data = $tData['data']; return; } } } self::$data = array(); }
/** * @ignore */ private function load() { if ($this->rewrites !== null) { return; } $this->rewrites = new \SplPriorityQueue(); foreach (Config::get('http/rewriteList', array()) as $tRewriteList) { $this->addRewrite($tRewriteList['match'], $tRewriteList['forward'], isset($tRewriteList['priority']) ? (int) $tRewriteList['priority'] : 10); } $this->routes = new \SplPriorityQueue(); foreach (Config::get('http/routeList', array()) as $tRouteList) { $tDefaults = array(); foreach ($tRouteList as $tRouteListKey => $tRouteListItem) { if (strncmp($tRouteListKey, 'defaults/', 9) === 0) { $tDefaults[substr($tRouteListKey, 9)] = $tRouteListItem; } } $this->addRoute($tRouteList['match'], $tRouteList['callback'], $tDefaults, isset($tRewriteList['priority']) ? (int) $tRewriteList['priority'] : 10); } }
/** * @ignore */ public static function setController($uControllerInstance, $uActionName, $uFormat, array $uParams = array(), array $uInput = array()) { Framework::$variables['controller'] = $uControllerInstance; $uControllerInstance->route = array('controller' => get_class($uControllerInstance), 'action' => $uActionName, 'params' => $uParams); if (($tPos = strrpos($uControllerInstance->route['controller'], '\\')) !== false) { $uControllerInstance->route['controller'] = substr($uControllerInstance->route['controller'], $tPos + 1); } $uControllerInstance->view = lcfirst($uControllerInstance->route['controller']) . '/' . $uControllerInstance->route['action'] . '.' . Config::get('views/defaultViewExtension', 'php'); $uControllerInstance->format = $uFormat; }
/** * @ignore */ public static function setRoutes() { // $siteroot if (self::$siteroot === null) { self::$siteroot = Config::get('options/siteroot', strtr(pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME), '\\', '/')); } self::$siteroot = trim(self::$siteroot, '/'); if (strlen(self::$siteroot) > 0) { self::$siteroot = '/' . self::$siteroot; } // $pathinfo if (($tPos = strpos(self::$requestUri, '?')) !== false) { $tBaseUriPath = substr(self::$requestUri, 0, $tPos); } else { $tBaseUriPath = self::$requestUri; } self::$pathInfo = ltrim(substr($tBaseUriPath, strlen(self::$siteroot)), '/'); // $route self::$route = Framework::$application->resolve(self::$pathInfo, self::$methodext); Framework::$variables['root'] = self::$siteroot; }
echo I18n::_('Scabbia Framework'), ' ', Framework::VERSION; ?> "><?php echo I18n::_('Scabbia Framework'); ?> </a> <div class="clearfix"></div> </div> </div> <div id="pageTopLogo"> <div class="containerBox inner"> <a href="<?php echo Http::url('panel'); ?> "><img src="<?php echo $root, Config::get('panel/logo', '/scabbia-assets/panel/images/logo.png'); ?> " alt="" /></a> </div> </div> <div id="pageTopMenu"> <div class="containerBox inner"> <nav> <div id="pageTopNavbar" class="navbar navbar-static"> <div class="navbar-inner"> <div class="container" style="width: auto;"> <!-- <a class="brand" href="#">Panel</a> --> <ul class="nav" role="navigation"> <?php foreach (Panel::$menuItems as $tKey => $tMenu) { ?>
/** * Redirects users to another location if user does not have required roles * * @uses Auth::check($uRequiredRoles) * @param string $uRequiredRoles roles */ public static function checkRedirect($uRequiredRoles = 'user') { self::load(); if (self::check($uRequiredRoles)) { return; } $tLoginUrl = Config::get('auth/loginUrl', null); if ($tLoginUrl !== null) { //! todo: warning messages like insufficent privileges. Http::redirect($tLoginUrl, true); } Framework::end(0); }
/** * @ignore */ public static function error($uErrorType, $uTitle = null, $uMessage = null) { if (!isset(self::$errorPages[$uErrorType])) { self::$errorPages[$uErrorType] = Config::get('http/errorPages/' . $uErrorType, '{core}views/shared/error.php'); } //! todo internalization. // maybe just include? Views::viewFile(self::$errorPages[$uErrorType], array('title' => $uTitle, 'message' => $uMessage)); Framework::end(1); }
<body class="<?php echo Config::get('panel/bodyStyle', 'stretch'); ?> login"> <script type="text/javascript"> $l.contentBegin('login', '<?php echo $root; ?> /'); </script> <div class="block"> <div class="block_head"> <h2><?php echo I18n::_(Config::get('panel/loginTitle', 'Scabbia: Panel Login')); ?> </h2> </div> <div class="block_content"> <form method="POST" action="<?php echo Http::url('panel/' . Panel::LOGIN_MODULE_INDEX); ?> "> <fieldset> <div class="indent"> <?php Views::viewFile('{core}views/panel/sectionError.php'); ?>
/** * @ignore */ public function render($uAction, array $uParams, array $uInput) { I18n::setLanguage('en'); self::$modules = Config::get('panel/menuList', array()); self::$modules[self::LOGIN_MODULE_INDEX] = array('actions' => array(self::DEFAULT_ACTION_INDEX => array('callback' => array(&$this, 'login')))); foreach (Config::get('panel/menuGeneratorList', array()) as $tGeneratorMethod) { call_user_func_array($tGeneratorMethod, array(&self::$modules)); } self::$module = strlen($uAction) > 0 ? strtolower($uAction) : self::DEFAULT_MODULE_INDEX; if (!isset(self::$modules[self::$module])) { return false; } foreach (self::$modules as $tKey => $tMenu) { if (!isset($tMenu['title']) || isset($tMenu['role']) && !Auth::check($tMenu['role'])) { continue; } self::$menuItems[$tKey] = array($tKey === self::DEFAULT_MODULE_INDEX ? Http::url('panel') : Http::url('panel/' . $tKey), I18n::_($tMenu['title']), array()); foreach ($tMenu['actions'] as $tMenuActionKey => $tMenuAction) { if (!isset($tMenuAction['title']) || isset($tMenuAction['role']) && !Auth::check($tMenuAction['role'])) { continue; } if (isset($tMenuAction['before'])) { if ($tMenuAction['before'] === 'separator') { self::$menuItems[$tKey][self::MENU_ITEMS][] = '-'; } } if (isset($tMenuAction['customurl'])) { $tUrl = $tMenuAction['customurl']; } elseif ($tMenuActionKey === self::DEFAULT_ACTION_INDEX) { if ($tKey === self::DEFAULT_MODULE_INDEX) { $tUrl = Http::url('panel'); } else { $tUrl = Http::url('panel/' . $tKey); } } else { $tUrl = Http::url('panel/' . $tKey . '/' . $tMenuActionKey); } self::$menuItems[$tKey][self::MENU_ITEMS][] = array($tUrl, isset($tMenuAction['icon']) ? $tMenuAction['icon'] : 'minus', I18n::_($tMenuAction['title'])); if (isset($tMenuAction['after'])) { if ($tMenuAction['after'] === 'separator') { self::$menuItems[$tKey][self::MENU_ITEMS][] = '-'; } } } } $tSubAction = count($uParams) > 0 ? array_shift($uParams) : self::DEFAULT_ACTION_INDEX; if (!isset(self::$modules[self::$module]['actions'][$tSubAction])) { return false; } return call_user_func_array(self::$modules[self::$module]['actions'][$tSubAction]['callback'], $uParams); }
/** * Generates and outputs a captcha image * * @param string $uCookieName name of the cookie which will be stored on the client side * * @return string generated captcha code */ public static function generate($uCookieName = 'captcha') { $tFontFile = Io::translatePath(Config::get('captcha/fontFile', '{core}resources/fonts/KabobExtrabold.ttf')); $tFontSize = (int) Config::get('captcha/fontSize', 45); $tLength = (int) Config::get('captcha/length', 8); // pick a random word $tCode = String::generatePassword($tLength); // create a random gray shade $tColorScale = rand(40, 120); // allocate the image and colors $tImageCanvas = imagecreatetruecolor(300, 80); $tColorBackground = imagecolorallocate($tImageCanvas, 255, 255, 255); $tColorBackgroundChars = imagecolorallocatealpha($tImageCanvas, $tColorScale, $tColorScale, $tColorScale, 80); $tColorTextShadow = imagecolorallocatealpha($tImageCanvas, 255, 255, 255, 20); $tColorText = imagecolorallocatealpha($tImageCanvas, $tColorScale + 25, $tColorScale + 10, $tColorScale + 10, 30); // clear the background imagefilledrectangle($tImageCanvas, 0, 0, 300, 80, $tColorBackground); // create the background letters $tBackgroundChars = 'abcdefghijklmnopqrstuvwxyz'; for ($i = 0; $i < rand(60, 120); $i++) { // randomize the place and angle $x = rand(-50, 300); $y = rand(-50, 80); $tAngle = rand(-90, 90); imagettftext($tImageCanvas, $tFontSize, $tAngle, $x, $y, $tColorBackgroundChars, $tFontFile, $tBackgroundChars[rand(0, strlen($tBackgroundChars) - 1)]); } // randomize the start of the code $x = 50 + rand(-40, 30 - (strlen($tCode) - 6) * 24); $y = 56 + rand(-8, 8); // write the code letter-by-letter for ($i = 0; $i < strlen($tCode); $i++) { // angle is random $tAngle = rand(-10, 10); // create the shadow for the letter for ($ax = -1; $ax < 0; $ax++) { for ($ay = -1; $ay < 0; $ay++) { imagettftext($tImageCanvas, $tFontSize, $tAngle, $x + $ax, $y + $ay, $tColorTextShadow, $tFontFile, $tCode[$i]); } } // create the letter imagettftext($tImageCanvas, $tFontSize, $tAngle, $x, $y, $tColorText, $tFontFile, $tCode[$i]); // calculate the place of the next letter $y += rand(-2, 2); $tTemp = imagettfbbox($tFontSize, 0, $tFontFile, $tCode[$i]); $x += $tTemp[2] + rand(-4, 0); } // fancy border imagerectangle($tImageCanvas, 0, 0, 299, 79, $tColorText); imagerectangle($tImageCanvas, 1, 1, 298, 78, $tColorBackground); // store the code in session Session::set($uCookieName, $tCode); // try to avoid caching header('Expires: Thu, 01 Jan 1970 00:00:00 GMT', true); header('Pragma: public', true); header('Cache-Control: no-store, no-cache, must-revalidate', true); header('Cache-Control: pre-check=0, post-check=0, max-age=0'); header('Content-Type: image/png', true); header('Content-Disposition: inline;filename=' . $uCookieName . '.png', true); // clean up imagepng($tImageCanvas); imagedestroy($tImageCanvas); // return the code return $tCode; }
/** * Output callback method which will be called when the output buffer * is flushed at the end of the request. * * @param string $uValue the generated content * @param int $uStatus the status of the output buffer * * @return string final content */ public static function output($uValue, $uStatus) { $tParms = array('exitStatus' => &self::$exitStatus, 'responseFormat' => &self::$responseFormat, 'content' => &$uValue); Events::invoke('output', $tParms); if (ini_get('output_handler') === "") { $tParms['content'] = mb_output_handler($tParms['content'], $uStatus); // PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END if (!ini_get('zlib.output_compression') && PHP_SAPI !== 'cli' && Config::get('options/gzip', true) === true) { $tParms['content'] = ob_gzhandler($tParms['content'], $uStatus); // PHP_OUTPUT_HANDLER_START | PHP_OUTPUT_HANDLER_END } } return $tParms['content']; }
/** * @ignore */ public static function extensionLoad() { self::$cachePath = Io::translatePath('{writable}cache/media/', true); self::$cacheTtl = (int) Config::get('media/cacheTtl', 120); }