Skip to content

Commit

Permalink
Dev Several installer fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Feb 20, 2015
1 parent 52b72d6 commit be273a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 34 deletions.
6 changes: 4 additions & 2 deletions application/config/internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
*
*/

if (file_exists(dirname(__FILE__) . '/config.php')) {
$userConfig = require(dirname(__FILE__) . '/config.php');
if (file_exists(__DIR__ . '/config.php')) {
$userConfig = require(__DIR__ . '/config.php');
} else {
$userConfig = [];
}
@date_default_timezone_set(@date_default_timezone_get());
$internalConfig = array(
Expand Down
38 changes: 8 additions & 30 deletions application/controllers/InstallerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace ls\controllers;
use \Yii;
use PreCheck, InstallerConfigForm, User;
/**
* Installer
*
Expand Down Expand Up @@ -43,37 +44,18 @@ class InstallerController extends \CController {
public $progress = 0;

public $stepTitle = '';
public function run($action = 'index')
{

self::_sessioncontrol();
parent::run($action);
}


/**
* Load and set session vars
*
* @access protected
* @return void
*/
protected function _sessioncontrol()
{
if (empty(Yii::app()->session['installerLang']))
Yii::app()->session['installerLang'] = 'en';
Yii::app()->setLanguage(Yii::app()->session['installerLang']);
}


/**
* welcome and language selection install step
*/
public function actionIndex()
{
App()->session->destroy();
if (!is_null(Yii::app()->request->getPost('installerLang')))
{
Yii::app()->session['installerLang'] = Yii::app()->request->getPost('installerLang');
$this->redirect(array('installer/license'));

if (App()->request->isPostRequest) {
App()->setLanguage(App()->request->getPost('installerLang'));
$this->redirect(['installer/license']);
die('no');
}
App()->loadHelper('surveytranslator');

Expand Down Expand Up @@ -101,11 +83,8 @@ public function actionIndex()
*/
public function actionLicense()
{

// $aData array contain all the information required by view.
$this->stepTitle = gT('License');
// $aData['descp'] = gT('GNU General Public License:');
$this->progress = 15;
$this->progress = 15;

if (App()->request->isPostRequest) {
$this->redirect(array('installer/precheck'));
Expand All @@ -114,7 +93,6 @@ public function actionLicense()
* Load PreCheck model here to allow it to check session stuff.
*/
new PreCheck();

$this->render('license');
}
/**
Expand Down
7 changes: 5 additions & 2 deletions application/core/WebApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ public function initLanguage()
{
// Set language to use.
if ($this->request->getParam('lang') !== null) {
$this->setLanguage($this->request->getParam('lang'));
$this->session->add('language', $this->request->getParam('lang'));
}
if (isset($this->session['language'])) {
$this->setLanguage($this->session['language']);
}
}
/**
Expand Down Expand Up @@ -222,7 +225,7 @@ public function getPluginManager()
*/
public function runController($route) {
$file_name = __DIR__ . '/../config/config.php';
if (!file_exists($file_name) && $route != 'installer') {
if (!file_exists($file_name) && substr_compare('installer', $route, 0, 9) != 0) {
$this->request->redirect($this->urlManager->createUrl('/installer'));
}
return parent::runController($route);
Expand Down

0 comments on commit be273a8

Please sign in to comment.