Skip to content
This repository has been archived by the owner on May 17, 2022. It is now read-only.

Commit

Permalink
improvements in load system
Browse files Browse the repository at this point in the history
  • Loading branch information
DaviMenezes committed Mar 22, 2018
1 parent 4c751c6 commit 4ec06d0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 47 deletions.
6 changes: 4 additions & 2 deletions download.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

use Adianti\Base\Lib\Registry\TSession;

require_once 'init.php';
new TSession;
new TSession();

if (isset($_GET['file']) and TSession::getValue('logged')) {
$file = $_GET['file'];
$info = pathinfo($file);
if (empty($info['extension'])) {
die();
}
$extension = $info['extension'];

$content_type_list = array();
Expand Down
5 changes: 1 addition & 4 deletions engine.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php


use Adianti\Base\App\Lib\Util\ApplicationTranslator;
use Adianti\Base\Lib\Core\TApplication;
use App\Init;

require_once 'init.php';
new Init();

function _t($msg, $param1 = null, $param2 = null, $param3 = null)
{
return ApplicationTranslator::translate($msg, $param1, $param2, $param3);
}

TApplication::run(true);

6 changes: 2 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<?php
namespace App;

use Adianti\Base\App\Lib\Menu\AdiantiMenuBuilder;
use Adianti\Base\App\Lib\Util\ApplicationTranslator;
use Adianti\Base\Lib\Control\TPage;
use Adianti\Base\Lib\Core\AdiantiCoreApplication;
use Adianti\Base\Lib\Registry\TSession;
use App\Init;

function dd($var)
{
var_dump($var);
die();
}

require_once 'init.php';
$init = new Init();
$ini = $init->getIni();
$ini = require_once 'init.php';

$theme = $ini['general']['theme'];
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
Expand Down
53 changes: 16 additions & 37 deletions init.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,26 @@
<?php
namespace App;

// define the autoloader
//require_once 'lib/adianti/core/AdiantiCoreLoader.php';
//spl_autoload_register(array('Adianti\Core\AdiantiCoreLoader', 'autoload'));
//Adianti\Core\AdiantiCoreLoader::loadClassMap();

use Adianti\Base\App\Lib\Util\ApplicationTranslator;
use Adianti\Base\Lib\Core\AdiantiApplicationConfig;
use Adianti\Base\Lib\Core\AdiantiCoreTranslator;

class Init
{
private $ini;

public function __construct()
{
$loader = require 'vendor/autoload.php';
$loader->register();

$loader = require 'vendor/autoload.php';
$loader->register();
// read configurations
$ini = parse_ini_file('app/config/application.ini', true);
date_default_timezone_set($ini['general']['timezone']);
AdiantiCoreTranslator::setLanguage($ini['general']['language']);
ApplicationTranslator::setLanguage($ini['general']['language']);
AdiantiApplicationConfig::load($ini);

// read configurations
$this->ini = parse_ini_file('app/config/application.ini', true);
date_default_timezone_set($this->ini['general']['timezone']);
AdiantiCoreTranslator::setLanguage($this->ini['general']['language']);
ApplicationTranslator::setLanguage($this->ini['general']['language']);
AdiantiApplicationConfig::load($this->ini);
// define constants
define('APPLICATION_NAME', $ini['general']['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
define('LANG', $ini['general']['language']);

// define constants
define('APPLICATION_NAME', $this->ini['general']['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
define('LANG', $this->ini['general']['language']);

if (version_compare(PHP_VERSION, '5.5.0') == -1) {
die(AdiantiCoreTranslator::translate('The minimum version required for PHP is ^1', '5.5.0'));
}
}

public function getIni()
{
return $this->ini;
}
if (version_compare(PHP_VERSION, '5.5.0') == -1) {
die(AdiantiCoreTranslator::translate('The minimum version required for PHP is ^1', '5.5.0'));
}


return $ini;

0 comments on commit 4ec06d0

Please sign in to comment.