Skip to content

Commit

Permalink
Fix #3 Installation 3.0.1 in Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogdani committed Sep 17, 2013
1 parent 0456b2f commit 4c64a07
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
36 changes: 19 additions & 17 deletions lib/globals.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@

session_start();

if (!is_dir('./sites/default'))
if (@!$root)
{
define('CREATE_SITE', true);
$root = './';
}

if ($_GET['lang'])
define('MAIN_DIR', $root);


if (!is_dir(MAIN_DIR . 'sites/default'))
{
$_SESSION['lang'] = $_GET['lang'];
define('CREATE_SITE', true);
}


if (@!$root)
if (!is_dir(MAIN_DIR . 'tmp'))
{
$root = './';
@mkdir(MAIN_DIR . 'tmp', 0777, true);
}
define('MAIN_DIR', $root);

if (!is_dir(MAIN_DIR . 'cache'))
{
@mkdir(MAIN_DIR . 'cache', 0777, true);
}

if (!is_dir(MAIN_DIR . 'logs'))
{
@mkdir(MAIN_DIR . 'logs', 0777, true);
Expand All @@ -39,16 +42,16 @@ if (!file_exists(MAIN_DIR . 'logs/error.log'))
touch(MAIN_DIR . 'logs/error.log');
}


if (!is_dir(MAIN_DIR . 'tmp'))
{
@mkdir(MAIN_DIR . 'tmp', 0777, true);
}

ini_set('error_log', './logs/error.log');

ini_set('display_errors', 'off');


if (@$_GET['lang'])
{
$_SESSION['lang'] = $_GET['lang'];
}

if (get_magic_quotes_gpc())
{
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
Expand All @@ -74,14 +77,13 @@ if (get_magic_quotes_gpc())
unset($process);
}


require_once $root . 'lib/Autoloader.inc';
Autoloader::start();


require $root . 'vendor/autoload.php';



class_alias('RedBean_Facade', 'R');

//set default date-zone
Expand All @@ -95,7 +97,6 @@ else
date_default_timezone_set(cfg::get('timezone'));
}


!defined('CREATE_SITE') ? define ( 'PREFIX', cfg::get('prefix') ) : '';
!defined('CREATE_SITE') ? define ( 'SYS_LANG',cfg::get('default_lang') ) : '';
define ( 'MOD_DIR', MAIN_DIR . 'modules/');
Expand All @@ -119,7 +120,7 @@ else
{
define('CACHE', serialize(array('cache' => CACHE_DIR)));
}
tr::load_file($_GET['lang']);
tr::load_file(@$_GET['lang'], defined('CREATE_SITE'));

if (defined('CREATE_SITE') || !cfg::get('db_connection'))
{
Expand All @@ -134,3 +135,4 @@ R::setup( ( defined('CREATE_SITE')|| !cfg::get('db_connection')) ? 'sqlite:./sit
R::freeze( true );
R::dependencies(array('arttrans'=>array('articles')));
R::dependencies(array('menutrans'=>array('menu')));

19 changes: 14 additions & 5 deletions lib/tr.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ class tr
* 3) browser default language
* 4) en
*/
public static function load_file($get_lang = false)
public static function load_file($get_lang = false, $silencemode = false)
{
require_once 'locale/en.php';
require_once './locale/en.php';

$en = $_lang;

//if ($get_lang AND cfg::get('languages') AND ( (array_key_exists($get_lang, cfg::get('languages'))) OR $get_lang == cfg::get('sys_lang')) )
if ($get_lang && $get_lang == cfg::get('sys_lang'))
// If silence mode is on (no site is defined yet) english is the only available language!
if ($silencemode)
{
// do nothing
}
else if ($get_lang && $get_lang == cfg::get('sys_lang'))
{
$_SESSION['adm_lang'] = $get_lang;
}
Expand All @@ -37,9 +42,13 @@ class tr
}
}

/**
* Load Admin language
*/
if (!$_SESSION['adm_lang'])
{
$_SESSION['adm_lang'] = cfg::get('sys_lang');
// If silence mode is on (no site is defined yet) english is the only available language!
$_SESSION['adm_lang'] = $silencemode ? 'en' : cfg::get('sys_lang');
}

if (file_exists('locale/' . $_SESSION['adm_lang'] . '.php'))
Expand Down

0 comments on commit 4c64a07

Please sign in to comment.