Exemplo n.º 1
1
 public function preload()
 {
     $this->mdata['objlang'] = $this->language;
     $this->mdata['objurl'] = $this->url;
     $this->load->model('tool/image');
     $this->load->language('module/pavblog');
     $this->load->model("pavblog/blog");
     $this->load->model("pavblog/comment");
     $mparams = $this->config->get('pavblog');
     $default = $this->model_pavblog_blog->getDefaultConfig();
     $mparams = !empty($mparams) ? $mparams : array();
     if ($mparams) {
         $mparams = array_merge($default, $mparams);
     } else {
         $mparams = $default;
     }
     $config = new Config();
     if ($mparams) {
         foreach ($mparams as $key => $value) {
             $config->set($key, $value);
         }
     }
     $this->mparams = $config;
     if (!defined("_PAVBLOG_MEDIA_")) {
         if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css')) {
             $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css');
         } else {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/pavblog.css');
         }
         define("_PAVBLOG_MEDIA_", true);
     }
 }
Exemplo n.º 2
0
 static function register($table, $key, $value = "")
 {
     // create the global config object if not available
     if (!array_key_exists('config', $GLOBALS)) {
         $GLOBALS['config'] = array();
     }
     // exit now if variable already available
     $key_exists = array_key_exists($table, $GLOBALS['config']) && array_key_exists($key, $GLOBALS['config'][$table]) && !(empty($GLOBALS['config'][$table][$key]) && is_null($GLOBALS['config'][$table][$key]));
     if ($key_exists) {
         return;
     }
     // then check if the table exists
     if (empty($GLOBALS['config'][$table])) {
         $config = new Config(0, $table);
         // FIX: The id needs to be setup as autoincrement
         //$config->create_table($table, "id INTEGER PRIMARY KEY ASC," . implode(",", array_keys( $config->rs )) );
         $config->create_table($table, "id INTEGER PRIMARY KEY ASC, key, value");
         $GLOBALS['config'][$table] = array();
     }
     // we already know the key doesn't exist - just create it
     $config = new Config(0, $table);
     $config->set('key', "{$key}");
     // FIX: special case for admin password (use cipher if available)
     $cipher = is_null(CIPHER) ? $value : CIPHER;
     $value = $key == "admin_password" ? crypt($value, $cipher) : $value;
     $config->set('value', "{$value}");
     $config->create();
     // save in the global object
     $GLOBALS['config'][$table][$key] = $value;
 }
Exemplo n.º 3
0
	function secondstageAction()
	{
		$request = new RivetyCore_Request($this->getRequest());
		$appNamespace = new Zend_Session_Namespace('RivetyCore_Temp');
		$basepath = Zend_Registry::get('basepath');
		$config_table = new Config();
		$config_table->set('default', 'upload_path', $basepath."/uploads", true);
		$config_table->set('default', 'theme', 'default', true);
		$config_table->set('default', 'missing_image', $basepath . "/themes/frontend/default/images/image-missing.jpg", true);
		$config_table->set('default', 'site_url', 'http://' . $_SERVER['SERVER_NAME']);
		$config_table->set('default', 'salt', substr(md5(rand(1, 1000)), 0, 10));
		$config_table->cache();
		$username = $request->username;
		$users_table = new Users();
		$user = $users_table->fetchByUsername($username);
		$password = substr(md5(rand(50000, 100000)), 0, 8);
		if (!is_null($user))
		{
			$user->password = $password;
			$user->save();
			// $users_table->setMetaData($username, "is_installer", 1);
			$appNamespace->autoLogin = true;
       		$appNamespace->autoLoginUsername = $username;
       		$appNamespace->autoLoginPassword = $password;
			$appNamespace->autoLoginPasswordHash = md5($password);
		}
		else
		{
			die("Somehow the admin user didn't get created or didn't get sent with the request. This is bad. Really, really bad.");
		}
		$this->_redirect("/default/install/finished/username/" . $username);
	}
Exemplo n.º 4
0
 public function __construct($app, $app_config = array())
 {
     $this->registry = new Registry();
     $this->registry->set("app", $app);
     $configs = new Config();
     if (!isset($app_config['controllers_path']) || !isset($app_config['models_path']) || !isset($app_config['library_path'])) {
         trigger_error("Directory information is required for controllers, models and library");
         return;
     }
     if (!file_exists($app_config['controllers_path']) || !file_exists($app_config['models_path']) || !file_exists($app_config['library_path'])) {
         trigger_error("Directory information is required for controllers, models and library");
         return;
     }
     if (isset($app_config['template_constants']) && $app_config['template_constants']) {
         $configs->set("template_constants", $app_config['template_constants']);
     } else {
         $configs->set("template_constants", array());
     }
     $configs->set("controllers_path", $app_config['controllers_path']);
     $configs->set("library_path", $app_config['library_path']);
     $configs->set("models_path", $app_config['models_path']);
     $this->registry->set("config", $configs);
     $this->registry->set("hooks", new Hooks((array) $this->config->get("hooks")));
     $loader = new Loader($this->registry);
     $this->registry->set("load", $loader);
 }
Exemplo n.º 5
0
 public function testSetterMultidimensionOverwritesNestedValues()
 {
     $c = new Config(array('config' => array('deploy' => array('release_dir' => '/var/www'))));
     $this->assertEquals('/var/www', $c->get('config.deploy.release_dir'));
     $c->set('config.deploy.release_dir', '/var/www');
     $c->set('config.deploy.release_dir', '/var/www');
     $this->assertEquals('/var/www', $c->get('config.deploy.release_dir'));
 }
Exemplo n.º 6
0
Arquivo: MainTest.php Projeto: jasny/Q
 /**
  * Test adding settings
  *
  * @param Config $config
  */
 function setgetTest($config)
 {
     $this->assertEquals(array('grp1' => array('q' => 'abc', 'b' => 27), 'grp2' => array('a' => 'original')), $config->get());
     $config->set('grp2', array('b' => 'changed'));
     $config->set('grp3', array('rew' => 'MY VALUE', 'qq' => 2));
     $this->assertEquals(array('grp1' => array('q' => 'abc', 'b' => 27), 'grp2' => array('b' => 'changed'), 'grp3' => array('rew' => 'MY VALUE', 'qq' => 2)), $config->get());
     $this->assertEquals(array('rew' => 'MY VALUE', 'qq' => 2), $config->get('grp3'));
     $config->set(array('grp3', 'qq'), 19);
     $this->assertEquals(array('rew' => 'MY VALUE', 'qq' => 19), $config->get('grp3'));
 }
 public function testEmpty()
 {
     file_put_contents($this->file, '');
     $this->assertEquals($this->object->get('test.trees.oak.fairies', 'default'), 'default');
     $this->object->set('test.trees.oak.second_fairy', 'Trixie');
     $this->assertEquals($this->object->get('test.trees.oak.second_fairy'), 'Trixie');
     $this->object->write('test');
     $group = $this->object->get('test');
     $this->assertArrayHasKey('trees', $group);
     $this->assertArrayHasKey('oak', $group['trees']);
     $this->assertArrayHasKey('second_fairy', $group['trees']['oak']);
     $this->assertEquals($group['trees']['oak']['second_fairy'], 'Trixie');
 }
Exemplo n.º 8
0
 /**
  * Construct
  * 
  * @param Config $config
  */
 public function __construct(Config $config)
 {
     $this->config = $config;
     $this->routes = $this->config->get('routes');
     $this->project_host = $this->config->get('project_host');
     if (empty($this->project_host) && isset($_SERVER['SERVER_PORT'], $_SERVER['HTTP_HOST'])) {
         $this->project_host = ($_SERVER['SERVER_PORT'] == 443 ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'];
     }
     if (empty($this->project_host)) {
         trigger_error('Not specified project host', E_USER_WARNING);
     }
     $this->project_host = rtrim($this->project_host, '/') . '/';
     $this->config->set('project_host', $this->project_host);
 }
Exemplo n.º 9
0
 function config($params = array())
 {
     // if saving...
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         // loop through all the other data and reorganise them properly
         foreach ($params as $k => $v) {
             // exit if the values is empty (but not false)?
             if (empty($v) && $v != "0") {
                 continue;
             }
             // get the controller from the field name
             $name = explode("|", $k);
             if (count($name) < 2) {
                 continue;
             }
             $table = $name[0];
             $key = $name[1];
             //#25 - encrypting 'password' fields
             $cipher = is_null(CIPHER) ? $v : CIPHER;
             $value = $key == "admin_password" ? crypt($v, $cipher) : $v;
             // only save the data that has changed
             if ($GLOBALS["config"][$table][$key] != $value) {
                 $config = new Config(0, $table);
                 // find the entry with the right key
                 $config->retrieve_one("key=?", $key);
                 //$config->pkname = 'key';
                 $config->set('key', $key);
                 $config->set('value', $value);
                 // update model
                 $config->update();
                 // update memory
                 $GLOBALS["config"][$table][$key] = $value;
             }
         }
         // generate the humans.txt file
         $humans = $this->humansText();
         // redirect back to the configuration page
         header('Location: ' . url('admin/config'));
     } else {
         // show the configuration
         //$this->data['body']['admin']=View::do_fetch( getPath('views/admin/config.php'),$this->data);
         $data['view'] = getPath('views/admin/config.php');
         $this->data['status'] = "config";
         $this->data['body'][] = $data;
         $this->data['template'] = ADMIN_TEMPLATE;
         // display the page
         Template::output($this->data);
     }
 }
 function __construct()
 {
     parent::__construct();
     if (!Config::get('RPC')) {
         Config::set('RPC', array('class' => 2, 'method' => 3, 'action' => 4, 'path' => 'procedure'));
     }
 }
 protected function redirect($link, $type = 301)
 {
     Config::set("Redirect", $link);
     Config::set("RedirectType", $type);
     Loader::loadNew('controller', '/controller/RedirectController')->activate();
     exit;
 }
Exemplo n.º 12
0
 public function testReturnDifferentCompiledFiles()
 {
     \Config::set('laravel-gcc::env', array('testing'));
     $scriptTagOne = javascript_compiled('file1.js');
     $scriptTagTwo = javascript_compiled('file2.js');
     $this->assertNotEquals($scriptTagOne, $scriptTagTwo);
 }
Exemplo n.º 13
0
 public function update()
 {
     switch ($this->scenario) {
         case 'Save':
             Config::set(self::optionName . '_CLIENT_NAME', $this->clientName);
             Config::set(self::optionName . '_PERIOD', $this->period);
             Config::set(self::optionName . '_EMAIL', $this->email);
             Config::set(self::optionName . '_FTP', $this->ftp);
             Config::set(self::optionName . '_FTP_PORT', $this->ftpPort);
             Config::set(self::optionName . '_FTP_DIR', $this->ftpDir);
             Config::set(self::optionName . '_FTP_USER', $this->ftpUser);
             Config::set(self::optionName . '_FTP_PASSWORD', $this->ftpPassword);
             break;
         case 'Start':
             $this->status = 1;
             Config::set(self::optionName . '_STATUS', $this->status);
             break;
         case 'Stop':
             $this->status = 0;
             Config::set(self::optionName . '_STATUS', $this->status);
             break;
         case 'Add':
             $this->email[] = $this->newEMail;
             Config::set(self::optionName . '_EMAIL', $this->email);
             break;
         case 'Delete':
             Config::set(self::optionName . '_EMAIL', $this->email);
             break;
     }
 }
Exemplo n.º 14
0
 public function login($id = null)
 {
     $user = $this->user;
     $this->data['user']['name'] = $user->data()->user;
     Config::set('html.title', 'Авторизация');
     Config::set('html.description.val', 'На этой странице можно залогиниться');
     //$user = new User();
     $salt = uniqid();
     if (!Session::exists(Config::get('session.token_name'))) {
         Token::generate();
     }
     if (Input::exists()) {
         if (Token::check(Input::get('token'))) {
             $validate = new VALIDATE();
             $validation = $validate->check($_POST, array('user' => array('required' => true), 'password' => array('required' => true)));
             if ($validate->passed()) {
                 $remember = Input::get('remember') === 'on' ? true : false;
                 $login = $user->login(Input::get('user'), Input::get('password'), null);
                 if ($login) {
                     Redirect::to('/');
                 } else {
                     echo '<p>Sorry, logging in failed</p>';
                 }
             } else {
                 foreach ($validation->errors() as $error) {
                     //echo $error, '<br/>';
                     $this->data['validate_errors'][] = $error;
                 }
             }
         }
     }
     //$this->data['id']=$id;
     //$this->data['name']=Input::get('name');
     $this->view('user/login');
 }
Exemplo n.º 15
0
 public function __construct()
 {
     parent::__construct();
     Config::set('auth.driver', 'adminauth');
     Asset::add('bootstrap', 'bundles/adminify/css/bootstrap.min.css');
     Asset::add('style', 'bundles/adminify/css/style.css');
 }
Exemplo n.º 16
0
 public function setUp()
 {
     parent::setUp();
     \Config::set('database.default', 'sqlite');
     \Config::set('database.connections', ['sqlite' => array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '')]);
     $this->createDatabase();
 }
Exemplo n.º 17
0
 public function getAdminConfig()
 {
     \Config::set('website.has_admin', true);
     $value = \Config::get('website.has_admin');
     echo $value;
     //return view('install.admin_config');
 }
Exemplo n.º 18
0
 /**
  * Tests Uri::create()
  *
  * @test
  */
 public function test_create()
 {
     Config::set('url_suffix', '');
     $prefix = Uri::create('');
     $output = Uri::create('controller/method');
     $expected = $prefix . "controller/method";
     $this->assertEquals($expected, $output);
     $output = Uri::create('controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'));
     $expected = $prefix . "controller/thing?what=more";
     $this->assertEquals($expected, $output);
     Config::set('url_suffix', '.html');
     $output = Uri::create('controller/method');
     $expected = $prefix . "controller/method.html";
     $this->assertEquals($expected, $output);
     $output = Uri::create('controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'));
     $expected = $prefix . "controller/thing.html?what=more";
     $this->assertEquals($expected, $output);
     $output = Uri::create('http://example.com/controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'));
     $expected = "http://example.com/controller/thing.html?what=more";
     $this->assertEquals($expected, $output);
     $output = Uri::create('http://example.com/controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'), true);
     $expected = "https://example.com/controller/thing.html?what=more";
     $this->assertEquals($expected, $output);
     $output = Uri::create('https://example.com/controller/:some', array('some' => 'thing', 'and' => 'more'), array('what' => ':and'), false);
     $expected = "http://example.com/controller/thing.html?what=more";
     $this->assertEquals($expected, $output);
 }
 public function store_connector(Request $request, ConnectorValidator $input)
 {
     // This needs to be written into a middleware.
     \Config::set('suitecrm.url', $request->get('hostname'));
     \Config::set('suitecrm.url', $request->get('username'));
     \Config::set('suitecrm.password', $request->get('password'));
 }
Exemplo n.º 20
0
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion'));
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD);
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="http://luid.inetrobots.com" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
Exemplo n.º 21
0
 /**
  *
  */
 public function preload()
 {
     $this->load->model('pavblog/blog');
     $this->load->model('pavblog/comment');
     $this->load->model('tool/image');
     $mparams = $this->config->get('pavblog');
     $config = new Config();
     if ($mparams) {
         foreach ($mparams as $key => $value) {
             $config->set($key, $value);
         }
     }
     $this->mparams = $config;
     if ($this->mparams->get('comment_engine') == '' || $this->mparams->get('comment_engine') == 'local') {
     } else {
         $this->mparams->set('blog_show_comment_counter', 0);
         $this->mparams->set('cat_show_comment_counter', 0);
     }
     $this->language->load('module/pavblog');
     $this->load->model("pavblog/category");
     if (!defined("_PAVBLOG_MEDIA_")) {
         if (file_exists('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css')) {
             $this->document->addStyle('catalog/view/theme/' . $this->config->get('config_template') . '/stylesheet/pavblog.css');
         } else {
             $this->document->addStyle('catalog/view/theme/default/stylesheet/pavblog.css');
         }
         define("_PAVBLOG_MEDIA_", true);
     }
 }
Exemplo n.º 22
0
 public static function tearDownAfterClass()
 {
     foreach (static::$config_backup as $key => $val) {
         \Config::set($key, $val);
     }
     \Crypt::_init();
 }
Exemplo n.º 23
0
 /**
  * Constructor.
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An array that holds the plugin configuration
  *
  * @since 1.5
  */
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     // Log the deprecated API.
     if ($this->params->get('log-deprecated')) {
         \JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated'));
     }
     // Log database errors
     if ($this->params->get('log-database-errors')) {
         \JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database'));
     }
     // Log database queries
     if ($this->params->get('log-database-queries')) {
         \JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery'));
         // Register the HUBzero database logger as well
         // Don't worry, this won't log things twice...queries through joomla's database driver
         // will get logged above, and this will catch queries through hubzero's database driver
         \Event::listen(function ($event) {
             \Hubzero\Database\Log::add($event->getArgument('query'), $event->getArgument('time'));
         }, 'database_query');
     }
     // Only if debugging or language debug is enabled
     if (Config::get('debug') || Config::get('debug_lang')) {
         Config::set('gzip', 0);
         ob_start();
         ob_implicit_flush(false);
     }
     $this->linkFormat = ini_get('xdebug.file_link_format');
 }
Exemplo n.º 24
0
 /**
  * Destroy the test environment
  */
 public function tearDown()
 {
     Config::set('application.url', '');
     Config::set('application.index', 'index.php');
     Router::$names = array();
     Router::$routes = array();
 }
 public function testCurrentUser()
 {
     //use an simple stdClass object to represent user model in tests
     \Config::set('forum::integration.usermodel', "stdClass");
     //change visibility of getCurrentUser from protected to public
     $controller = $this->getMockForAbstractClass('\\Atrakeur\\Forum\\Controllers\\AbstractForumController');
     $reflectionOfController = new \ReflectionClass('\\Atrakeur\\Forum\\Controllers\\AbstractForumController');
     $method = $reflectionOfController->getMethod('getCurrentUser');
     $method->setAccessible(true);
     //test good current user
     $user = new \stdClass();
     \Config::set('forum::integration.currentuser', function () use($user) {
         return $user;
     });
     $data = $method->invoke($controller);
     $this->assertEquals($user, $data);
     //test falsey responce
     \Config::set('forum::integration.currentuser', function () {
         return false;
     });
     $this->assertEquals(null, $method->invoke($controller));
     //test true like responce
     \Config::set('forum::integration.currentuser', function () {
         return true;
     });
     $this->assertEquals(null, $method->invoke($controller));
 }
Exemplo n.º 26
0
 public function setUp()
 {
     parent::setUp();
     \Mail::pretend(true);
     $this->to = ['address' => '*****@*****.**', 'name' => 'foobar'];
     \Config::set('mailform.delivery_to', $this->to);
 }
Exemplo n.º 27
0
 function tearDown()
 {
     SimpleORMap::expireTableScheme();
     Config::set(null);
     StudipCacheFactory::setConfig(null);
     $GLOBALS['CACHING_ENABLE'] = false;
 }
 protected function extractColumns($input)
 {
     $db_config = array('driver' => 'mysql', 'host' => $input['host'], 'database' => $input['database'], 'username' => $input['username'], 'password' => $input['password'], 'charset' => 'utf8', 'collation' => $input['collation']);
     // Configure a connection
     \Config::set('database.connections.testconnection', $db_config);
     // Make a database connection
     $db = \DB::connection('testconnection');
     // Get the schema builder of the database connection
     $schema = $db->getSchemaBuilder();
     $connection = $schema->getConnection();
     $result = $connection->selectOne($input['query']);
     if (empty($result)) {
         \App::abort(400, 'The query did not return any results.');
     }
     $db_columns = array_keys((array) $result);
     $columns_info = @$config['columns'];
     $pk = @$config['pk'];
     // Prepare the aliases
     $aliases = array();
     if (!empty($columns_info)) {
         foreach ($columns_info as $column_info) {
             $aliases[$column_info['index']] = $column_info['column_name_alias'];
         }
     }
     // Create the columns array
     $columns = array();
     foreach ($db_columns as $index => $column) {
         array_push($columns, array('index' => $index, 'column_name' => $column, 'column_name_alias' => empty($aliases[$index]) ? $column : $aliases[$index], 'pk' => $pk === $index));
     }
     return $columns;
 }
Exemplo n.º 29
0
 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_live_update');
     $objTemplate->updateClass = 'tl_confirm';
     $objTemplate->updateHeadline = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdate'];
     $objTemplate->isActive = $this->isActive();
     $strMessage = ' <a href="contao/changelog.php" onclick="Backend.openModalIframe({\'width\':860,\'title\':\'CHANGELOG\',\'url\':this.href});return false" title="' . specialchars($GLOBALS['TL_LANG']['tl_maintenance']['changelog']) . '"><img src="' . TL_FILES_URL . 'system/themes/' . \Backend::getTheme() . '/images/changelog.gif" width="14" height="14" alt="" style="vertical-align:text-bottom;padding-left:3px"></a>';
     // Newer version available
     if (\Config::get('latestVersion') && version_compare(VERSION . '.' . BUILD, \Config::get('latestVersion'), '<')) {
         $objTemplate->updateClass = 'tl_info';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['newVersion'], \Config::get('latestVersion')) . $strMessage;
     } else {
         $objTemplate->updateClass = 'tl_confirm';
         $objTemplate->updateMessage = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['upToDate'], VERSION . '.' . BUILD) . $strMessage;
     }
     // Automatically switch to SSL
     if (\Environment::get('ssl')) {
         \Config::set('liveUpdateBase', str_replace('http://', 'https://', \Config::get('liveUpdateBase')));
     }
     $objTemplate->uid = \Config::get('liveUpdateId');
     $objTemplate->updateServer = \Config::get('liveUpdateBase') . 'index.php';
     // Run the update
     if (\Input::get('token') != '') {
         $this->runLiveUpdate($objTemplate);
     }
     $objTemplate->version = VERSION . '.' . BUILD;
     $objTemplate->liveUpdateId = $GLOBALS['TL_LANG']['tl_maintenance']['liveUpdateId'];
     $objTemplate->runLiveUpdate = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['runLiveUpdate']);
     $objTemplate->referer = base64_encode(\Environment::get('base') . \Environment::get('request') . '|' . \Environment::get('server'));
     $objTemplate->updateHelp = sprintf($GLOBALS['TL_LANG']['tl_maintenance']['updateHelp'], '<a href="http://luid.inetrobots.com" target="_blank">Live Update ID</a>');
     $objTemplate->phar = file_exists(TL_ROOT . '/contao/update.phar.php');
     $objTemplate->toLiveUpdate = $GLOBALS['TL_LANG']['tl_maintenance']['toLiveUpdate'];
     return $objTemplate->parse();
 }
 /**
  * Run the controller and parse the template
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_preview');
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['fePreview']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->site = \Input::get('site', true);
     if (\Input::get('url')) {
         $objTemplate->url = \Environment::get('base') . \Input::get('url');
     } elseif (\Input::get('page')) {
         $objTemplate->url = $this->redirectToFrontendPage(\Input::get('page'), \Input::get('article'), true);
     } else {
         $objTemplate->url = \Environment::get('base');
     }
     // Switch to a particular member (see #6546)
     if (\Input::get('user') && $this->User->isAdmin) {
         $objUser = \MemberModel::findByUsername(\Input::get('user'));
         if ($objUser !== null) {
             $strHash = sha1(session_id() . (!\Config::get('disableIpCheck') ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
             // Remove old sessions
             $this->Database->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute(time() - \Config::get('sessionTimeout'), $strHash);
             // Insert the new session
             $this->Database->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute($objUser->id, time(), 'FE_USER_AUTH', session_id(), \Environment::get('ip'), $strHash);
             // Set the cookie
             $this->setCookie('FE_USER_AUTH', $strHash, time() + \Config::get('sessionTimeout'), null, null, false, true);
             $objTemplate->user = \Input::post('user');
         }
     }
     \Config::set('debugMode', false);
     $objTemplate->output();
 }