Giancarlo 7 years ago
parent
commit
624e5f0a2b

+ 1 - 1
package.json

@@ -10,7 +10,7 @@
 		"Build DEV": "webpack --mode=none --config webpack.config.js --display-error-details",
 		"Build DEV": "webpack --mode=none --config webpack.config.js --display-error-details",
 		"Build PROD": "webpack --mode=production --config webpack.config.js --display-error-details",
 		"Build PROD": "webpack --mode=production --config webpack.config.js --display-error-details",
 		"Watch": "webpack --mode=none --config webpack.config.js --display-error-details --watch",
 		"Watch": "webpack --mode=none --config webpack.config.js --display-error-details --watch",
-		"Deploy": "tar -zcvf deploy.tar.gz --exclude masterpage_template.tpl --exclude node_modules assets lib src ui/*.tpl index.php *.sql cfg"
+		"Deploy": "tar -zcvf deploy.tar.gz --exclude cfg/config.ini --exclude masterpage_template.tpl --exclude node_modules assets lib src ui/frontend/*.tpl index.php *.sql cfg"
 	},
 	},
 	"devDependencies": {
 	"devDependencies": {
 		"acorn": "^6.1.1",
 		"acorn": "^6.1.1",

+ 2 - 1
src/Modules/Blank/Pages.php

@@ -9,6 +9,7 @@
 namespace Modules\Blank;
 namespace Modules\Blank;
 
 
 use OpenMind\Web\Controller;
 use OpenMind\Web\Controller;
+use Template;
 
 
 class Pages extends Controller
 class Pages extends Controller
 {
 {
@@ -16,6 +17,6 @@ class Pages extends Controller
 	{
 	{
 		$f3->set('MESSAGE', 'Hello World');
 		$f3->set('MESSAGE', 'Hello World');
 		$f3->set('CONTENT', 'message.tpl');
 		$f3->set('CONTENT', 'message.tpl');
-		echo \Template::instance()->render('masterpage.tpl');
+		echo Template::instance()->render('masterpage.tpl');
 	}
 	}
 }
 }

+ 18 - 18
src/OpenMind/Admin/Admin.php

@@ -12,30 +12,30 @@ use OpenMind\System\UserRoles;
 
 
 class Admin extends PluginStrategy
 class Admin extends PluginStrategy
 {
 {
-  public function __construct()
-  {
-    $this->AddRoute('GET @admin: /admin', __NAMESPACE__ . '\Pages->Admin');
-    $this->AddRoute('GET @admin: /admin/eslstatus', __NAMESPACE__ . '\Pages->ESLStatus');
-    $this->AddRoute('GET @admin: /admin/eslissues', __NAMESPACE__ . '\Pages->ESLIssues');
+	public function __construct()
+	{
+		$this->AddRoute('GET @admin: /admin', __NAMESPACE__ . '\Pages->Admin');
+		$this->AddRoute('GET @admin: /admin/eslstatus', __NAMESPACE__ . '\Pages->ESLStatus');
+		$this->AddRoute('GET @admin: /admin/eslissues', __NAMESPACE__ . '\Pages->ESLIssues');
 		$this->AddRoute('GET @admin: /admin/apstatus', __NAMESPACE__ . '\Pages->APStatus');
 		$this->AddRoute('GET @admin: /admin/apstatus', __NAMESPACE__ . '\Pages->APStatus');
 		$this->AddRoute('GET @admin: /admin/omlsettings', __NAMESPACE__ . '\Pages->OML_Settings');
 		$this->AddRoute('GET @admin: /admin/omlsettings', __NAMESPACE__ . '\Pages->OML_Settings');
 		// Admin Load/Save
 		// Admin Load/Save
 		$this->AddRoute('POST @admin: /admin/config', __NAMESPACE__ . '\Pages->Config');
 		$this->AddRoute('POST @admin: /admin/config', __NAMESPACE__ . '\Pages->Config');
 
 
-    $this->AddMenuItem('Admin', ['url' => 'admin', 'permissionName' => 'admin']);
+		$this->AddMenuItem('Admin', ['url' => 'admin', 'permissionName' => 'admin']);
 
 
-    // System Settings
-    $this->AddMenuItem('System Settings', ['mainMenu' => 'adminMainMenu', 'mdiClass' => 'settings', 'permissionName' => 'admin']);
-    $this->AddMenuItem('OM-Link Settings', ['mainMenu' => 'System Settings', 'url' => 'admin/omlsettings', 'permissionName' => 'admin']);
+		// System Settings
+		$this->AddMenuItem('System Settings', ['mainMenu' => 'adminMainMenu', 'mdiClass' => 'settings', 'permissionName' => 'admin']);
+		$this->AddMenuItem('OM-Link Settings', ['mainMenu' => 'System Settings', 'url' => 'admin/omlsettings', 'permissionName' => 'admin']);
 
 
-    // Menu: ESL Ops
-    $this->AddMenuItem('ESL Ops', ['mainMenu' => 'adminMainMenu', 'mdiClass' => 'label', 'permissionName' => 'admin']);
-    $this->AddMenuItem('Status', ['mainMenu' => 'ESL Ops', 'url' => 'admin/eslstatus', 'permissionName' => 'admin']);
-    $this->AddMenuItem('Issues and Fixes', ['mainMenu' => 'ESL Ops', 'url' => 'admin/eslissues', 'permissionName' => 'admin']);
-    $this->AddMenuItem('AP Status', ['mainMenu' => 'ESL Ops', 'url' => 'admin/apstatus', 'permissionName' => 'admin']);
-    $this->AddMenuItem('FB Core Settings', ['mainMenu' => 'ESL Ops', 'url' => 'admin/fbcoresettings', 'permissionName' => 'admin']);
+		// Menu: ESL Ops
+		$this->AddMenuItem('ESL Ops', ['mainMenu' => 'adminMainMenu', 'mdiClass' => 'label', 'permissionName' => 'admin']);
+		$this->AddMenuItem('Status', ['mainMenu' => 'ESL Ops', 'url' => 'admin/eslstatus', 'permissionName' => 'admin']);
+		$this->AddMenuItem('Issues and Fixes', ['mainMenu' => 'ESL Ops', 'url' => 'admin/eslissues', 'permissionName' => 'admin']);
+		$this->AddMenuItem('AP Status', ['mainMenu' => 'ESL Ops', 'url' => 'admin/apstatus', 'permissionName' => 'admin']);
+		$this->AddMenuItem('FB Core Settings', ['mainMenu' => 'ESL Ops', 'url' => 'admin/fbcoresettings', 'permissionName' => 'admin']);
 
 
-    $roles = new UserRoles();
-    $roles->add('admin');
-  }
+		$roles = new UserRoles();
+		$roles->add('admin');
+	}
 }
 }

+ 2 - 1
src/OpenMind/Admin/Pages.php

@@ -7,6 +7,7 @@
 
 
 namespace OpenMind\Admin;
 namespace OpenMind\Admin;
 
 
+use Exception;
 use OpenMind\FindBox\FindBoxCoreSystem;
 use OpenMind\FindBox\FindBoxCoreSystem;
 use OpenMind\FindBox\SmartESL;
 use OpenMind\FindBox\SmartESL;
 use OpenMind\Web\Controller;
 use OpenMind\Web\Controller;
@@ -55,7 +56,7 @@ class Pages extends Controller
 
 
 		$path = 'cfg/config.bin';
 		$path = 'cfg/config.bin';
 		if (!file_exists($path))
 		if (!file_exists($path))
-			throw new \Exception('Config file not found');
+			throw new Exception('Config file not found');
 
 
 		$data = file_get_contents($path);
 		$data = file_get_contents($path);
 		$config = $frameworkUtils->Decrypt($data);
 		$config = $frameworkUtils->Decrypt($data);

+ 9 - 5
src/OpenMind/DataManager/CSVImporter.php

@@ -8,6 +8,10 @@
 
 
 namespace OpenMind\DataManager;
 namespace OpenMind\DataManager;
 
 
+use DB\SQL\Mapper;
+use F3;
+use PDOException;
+
 class ENUM_DIMATEC_CSV
 class ENUM_DIMATEC_CSV
 {
 {
 	public const MXORDI = 7;
 	public const MXORDI = 7;
@@ -31,9 +35,9 @@ class CSVImporter
 
 
 	public function __construct(string $folderPath)
 	public function __construct(string $folderPath)
 	{
 	{
-		$this->user = (int)\F3::get('USER')->id;
+		$this->user = (int)F3::get('USER')->id;
 		$this->folderToWatch = $folderPath;
 		$this->folderToWatch = $folderPath;
-		$this->dbMysql = \F3::get('DB');
+		$this->dbMysql = F3::get('DB');
 	}
 	}
 
 
 	/**
 	/**
@@ -67,14 +71,14 @@ class CSVImporter
 							if ($data[0] == "MXIDDM")
 							if ($data[0] == "MXIDDM")
 								return;
 								return;
 							try {
 							try {
-								$distinta = new \DB\SQL\Mapper($this->dbMysql, 'distinte');
+								$distinta = new Mapper($this->dbMysql, 'distinte');
 								$distinta->idUtente = $this->user;
 								$distinta->idUtente = $this->user;
 								$distinta->commessa = $data[ENUM_DIMATEC_CSV::MXORDI];
 								$distinta->commessa = $data[ENUM_DIMATEC_CSV::MXORDI];
 								$distinta->barcode = $data[ENUM_DIMATEC_CSV::MXARTI];
 								$distinta->barcode = $data[ENUM_DIMATEC_CSV::MXARTI];
 								$distinta->descrizione = $data[ENUM_DIMATEC_CSV::MXDESC];
 								$distinta->descrizione = $data[ENUM_DIMATEC_CSV::MXDESC];
 								$distinta->qta_prelevare = $data[ENUM_DIMATEC_CSV::MXQTMI];
 								$distinta->qta_prelevare = $data[ENUM_DIMATEC_CSV::MXQTMI];
 								$distinta->save();
 								$distinta->save();
-							} catch (\PDOException $e) {
+							} catch (PDOException $e) {
 								$this->output .= $e->getMessage();
 								$this->output .= $e->getMessage();
 							}
 							}
 						});
 						});
@@ -105,9 +109,9 @@ class CSVImporter
 	}
 	}
 
 
 	/**
 	/**
-	 * @deprecated from 24/07/2018
 	 * @param string $fileName
 	 * @param string $fileName
 	 * @param array $data
 	 * @param array $data
+	 * @deprecated from 24/07/2018
 	 */
 	 */
 	private function importOnDatabase(string $fileName, array $data)
 	private function importOnDatabase(string $fileName, array $data)
 	{
 	{

+ 1 - 1
src/OpenMind/FindBox/FindBox.php

@@ -19,5 +19,5 @@ class FindBox extends PluginStrategy
 	}
 	}
 }
 }
 
 
-/** @var \OpenMind\FindBox\FindBox $FindBox */
+/** @var FindBox $FindBox */
 Global $FindBox;
 Global $FindBox;

+ 17 - 17
src/OpenMind/FindBox/FindBoxCoreSystem.php

@@ -179,23 +179,6 @@ class FindBoxCoreSystem
 			return $this->returnCode(1, 'No label exist on Findbox');
 			return $this->returnCode(1, 'No label exist on Findbox');
 	}
 	}
 
 
-	/**
-	 * Check the response of FindBoxOS, return an array if no error, else NULL
-	 *
-	 * @param array $fbOS_Response
-	 * @return NULL|array
-	 */
-	public function getLabelsFromResponse(array $fbOS_Response): ?array
-	{
-		// Check if response have field 'value' that is an array
-		$haveArray = isset($fbOS_Response['value']['value']) && is_array($fbOS_Response['value']['value']);
-
-		if (!$haveArray)
-			return NULL;
-
-		return $fbOS_Response['value']['value'];
-	}
-
 	/**
 	/**
 	 * Request all label status to FindBox core.
 	 * Request all label status to FindBox core.
 	 * If request is forced may require large amount of time to retrieve status directly from labels
 	 * If request is forced may require large amount of time to retrieve status directly from labels
@@ -246,6 +229,23 @@ class FindBoxCoreSystem
 		return $eslStatus;
 		return $eslStatus;
 	}
 	}
 
 
+	/**
+	 * Check the response of FindBoxOS, return an array if no error, else NULL
+	 *
+	 * @param array $fbOS_Response
+	 * @return NULL|array
+	 */
+	public function getLabelsFromResponse(array $fbOS_Response): ?array
+	{
+		// Check if response have field 'value' that is an array
+		$haveArray = isset($fbOS_Response['value']['value']) && is_array($fbOS_Response['value']['value']);
+
+		if (!$haveArray)
+			return NULL;
+
+		return $fbOS_Response['value']['value'];
+	}
+
 	/**
 	/**
 	 * Add 'data.template_name' to the structure returned by GetStatus
 	 * Add 'data.template_name' to the structure returned by GetStatus
 	 *
 	 *

+ 6 - 3
src/OpenMind/FindBox/FindBoxService.php

@@ -9,6 +9,9 @@
 namespace OpenMind\FindBox;
 namespace OpenMind\FindBox;
 
 
 use DB\SQL;
 use DB\SQL;
+use Exception;
+use F3;
+use Log;
 use OpenMind\System\QueueSystem;
 use OpenMind\System\QueueSystem;
 
 
 class FindBoxService
 class FindBoxService
@@ -23,13 +26,13 @@ class FindBoxService
 	{
 	{
 		global $f3;
 		global $f3;
 
 
-		$this->ServiceLogger = new \Log('ServiceLogger.log');
+		$this->ServiceLogger = new Log('ServiceLogger.log');
 
 
 		$this->dbHandle = $f3->get('DB');
 		$this->dbHandle = $f3->get('DB');
 		while ($this->findBoxCore == null)
 		while ($this->findBoxCore == null)
 			try {
 			try {
 				$this->findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb')));
 				$this->findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb')));
-			} catch (\Exception $e) {
+			} catch (Exception $e) {
 				$this->ServiceLogger->write("Can't find FindBoxCore, retry in 1 second..", 'd/m/Y H:i:s');
 				$this->ServiceLogger->write("Can't find FindBoxCore, retry in 1 second..", 'd/m/Y H:i:s');
 				sleep(1);
 				sleep(1);
 			}
 			}
@@ -39,7 +42,7 @@ class FindBoxService
 	/**
 	/**
 	 * Called from php spawn process. This script end after MAX_BLINK_TIME
 	 * Called from php spawn process. This script end after MAX_BLINK_TIME
 	 *
 	 *
-	 * @param \F3 $f3
+	 * @param F3 $f3
 	 */
 	 */
 	public function Main($f3)
 	public function Main($f3)
 	{
 	{

+ 5 - 2
src/OpenMind/System/ErrorHandlers.php

@@ -8,13 +8,16 @@
 namespace OpenMind\System;
 namespace OpenMind\System;
 
 
 
 
+use Base;
+use Template;
+
 class ErrorHandlers
 class ErrorHandlers
 {
 {
 	private $f3;
 	private $f3;
 
 
 	public function __construct()
 	public function __construct()
 	{
 	{
-		$this->f3 = \Base::instance();
+		$this->f3 = Base::instance();
 	}
 	}
 
 
 	/**
 	/**
@@ -37,7 +40,7 @@ class ErrorHandlers
 		}
 		}
 
 
 		if (!$this->f3->get('AJAX')) {
 		if (!$this->f3->get('AJAX')) {
-			echo \Template::instance()->render('errors.tpl');
+			echo Template::instance()->render('errors.tpl');
 			return;
 			return;
 		}
 		}
 
 

+ 20 - 16
src/OpenMind/System/OMUtils.php

@@ -7,10 +7,13 @@
 
 
 namespace OpenMind\System;
 namespace OpenMind\System;
 
 
+use Exception;
 use FilesystemIterator;
 use FilesystemIterator;
+use Log;
 use OpenMind\Web\Web;
 use OpenMind\Web\Web;
 use RecursiveDirectoryIterator;
 use RecursiveDirectoryIterator;
 use RecursiveIteratorIterator;
 use RecursiveIteratorIterator;
+use Template;
 
 
 class OMUtils
 class OMUtils
 {
 {
@@ -19,7 +22,7 @@ class OMUtils
 
 
 	public function __construct()
 	public function __construct()
 	{
 	{
-		$this->Logger = new \Log('Site.log');
+		$this->Logger = new Log('Site.log');
 	}
 	}
 
 
 	/**
 	/**
@@ -39,9 +42,9 @@ class OMUtils
 	/**
 	/**
 	 * Get logger classe
 	 * Get logger classe
 	 *
 	 *
-	 * @return \Log
+	 * @return Log
 	 */
 	 */
-	public function getLogger(): \Log
+	public function getLogger(): Log
 	{
 	{
 		return $this->Logger;
 		return $this->Logger;
 	}
 	}
@@ -85,7 +88,7 @@ class OMUtils
 	 */
 	 */
 	public function getStringFromTemplate(string $strTemplate)
 	public function getStringFromTemplate(string $strTemplate)
 	{
 	{
-		return \Template::instance()->resolve($strTemplate);
+		return Template::instance()->resolve($strTemplate);
 	}
 	}
 
 
 
 
@@ -93,13 +96,13 @@ class OMUtils
 	 * Load an encrypted file with the method "base64_encode(gzcompress(<path to config.ini>))", save it in a temporary file in temp folder of system and load with F3::config()
 	 * Load an encrypted file with the method "base64_encode(gzcompress(<path to config.ini>))", save it in a temporary file in temp folder of system and load with F3::config()
 	 *
 	 *
 	 * @param string $path
 	 * @param string $path
-	 * @throws \Exception
+	 * @throws Exception
 	 */
 	 */
 	public function LoadEncryptedConfig(string $path)
 	public function LoadEncryptedConfig(string $path)
 	{
 	{
 		global $f3;
 		global $f3;
 		if (!file_exists($path))
 		if (!file_exists($path))
-			throw new \Exception('Config file not found');
+			throw new Exception('Config file not found');
 
 
 		$tmpFilepath = tempnam(sys_get_temp_dir(), 'om');
 		$tmpFilepath = tempnam(sys_get_temp_dir(), 'om');
 		$config = $this->Decrypt(file_get_contents($path));
 		$config = $this->Decrypt(file_get_contents($path));
@@ -109,34 +112,35 @@ class OMUtils
 	}
 	}
 
 
 	/**
 	/**
-	 * Encrypt $data using OM-Link algorithm
+	 * Decrypt $data using OM-Link algorithm
 	 *
 	 *
-	 * @param $data
+	 * @param $binaryData
 	 * @return string
 	 * @return string
 	 */
 	 */
-	public function Encrypt($data)
+	public function Decrypt($binaryData)
 	{
 	{
-		return base64_encode(gzcompress($data));
+		return gzuncompress(base64_decode($binaryData));
 	}
 	}
 
 
 	/**
 	/**
-	 * Decrypt $data using OM-Link algorithm
+	 * Encrypt $data using OM-Link algorithm
 	 *
 	 *
-	 * @param $binaryData
+	 * @param $data
 	 * @return string
 	 * @return string
 	 */
 	 */
-	public function Decrypt($binaryData)
+	public function Encrypt($data)
 	{
 	{
-		return gzuncompress(base64_decode($binaryData));
+		return base64_encode(gzcompress($data));
 	}
 	}
 
 
 	/*
 	/*
 	 * Exit from APP if the OMLINK requirement aren't meet
 	 * Exit from APP if the OMLINK requirement aren't meet
 	 */
 	 */
+
 	public function DieByOldPhpVersion()
 	public function DieByOldPhpVersion()
 	{
 	{
 		if (version_compare(PHP_VERSION, '7.2') != 1)
 		if (version_compare(PHP_VERSION, '7.2') != 1)
-			throw new \Exception('PHP 7.2+ is need to run the project');
+			throw new Exception('PHP 7.2+ is need to run the project');
 	}
 	}
 
 
 	/**
 	/**
@@ -151,7 +155,7 @@ class OMUtils
 	{
 	{
 		try {
 		try {
 			@fclose($sck = @fsockopen($ip, $port, $errno, $errstr, $timeout_sec));
 			@fclose($sck = @fsockopen($ip, $port, $errno, $errstr, $timeout_sec));
-		} catch (\Exception $e) {
+		} catch (Exception $e) {
 			die($e->getMessage());
 			die($e->getMessage());
 		}
 		}
 		return $errno;
 		return $errno;

+ 15 - 12
src/OpenMind/System/PluginStrategy.php

@@ -7,6 +7,8 @@
 
 
 namespace OpenMind\System;
 namespace OpenMind\System;
 
 
+use Exception;
+
 /**
 /**
  * Interface IPluginStrategy
  * Interface IPluginStrategy
  * Main interface for plugin system, it use Strategy Pattern.
  * Main interface for plugin system, it use Strategy Pattern.
@@ -51,10 +53,21 @@ class PluginStrategy implements IPluginStrategy
 
 
 	public function __construct()
 	public function __construct()
 	{
 	{
-		throw new \Exception("Plugin " . $this->getName() . ' doesn\'t have a __constructor() function. Please provide one.');
+		throw new Exception("Plugin " . $this->getName() . ' doesn\'t have a __constructor() function. Please provide one.');
+	}
+
+	/**
+	 * Return Class name, useful when a list of installed plugins is need
+	 *
+	 * @return string
+	 */
+	public function getName(): string
+	{
+		return get_class($this);
 	}
 	}
 
 
-	static function setTsStartLoad() {
+	static function setTsStartLoad()
+	{
 		self::$timeLoadStart = round(microtime(true) * 1000);
 		self::$timeLoadStart = round(microtime(true) * 1000);
 	}
 	}
 
 
@@ -69,16 +82,6 @@ class PluginStrategy implements IPluginStrategy
 		}
 		}
 	}
 	}
 
 
-	/**
-	 * Return Class name, useful when a list of installed plugins is need
-	 *
-	 * @return string
-	 */
-	public function getName(): string
-	{
-		return get_class($this);
-	}
-
 	/**
 	/**
 	 * Return default version for plugins that doesn't have one
 	 * Return default version for plugins that doesn't have one
 	 *
 	 *

+ 2 - 1
src/OpenMind/System/Soap.php

@@ -8,9 +8,10 @@
 
 
 namespace OpenMind\System;
 namespace OpenMind\System;
 
 
+use SoapClient;
 use SoapFault;
 use SoapFault;
 
 
-class Soap extends \SoapClient
+class Soap extends SoapClient
 {
 {
 	private $ws_url;
 	private $ws_url;
 
 

+ 3 - 2
src/OpenMind/System/System.php

@@ -10,6 +10,7 @@ namespace OpenMind\System;
 use Base;
 use Base;
 use Cache;
 use Cache;
 use DB\SQL;
 use DB\SQL;
+use PDO;
 
 
 class System extends PluginStrategy
 class System extends PluginStrategy
 {
 {
@@ -51,8 +52,8 @@ class System extends PluginStrategy
 				$f3->get('dbuser'),
 				$f3->get('dbuser'),
 				$f3->get('dbpass'),
 				$f3->get('dbpass'),
 				array(
 				array(
-					\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
-					\PDO::ATTR_PERSISTENT => $dbMode  // To avoid massive new persistent connections due to php-cgi processes
+					PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
+					PDO::ATTR_PERSISTENT => $dbMode  // To avoid massive new persistent connections due to php-cgi processes
 				));
 				));
 
 
 			// This fix memory leak in ->exec() and all methods of F3 that use this function like load, find, findone etc...
 			// This fix memory leak in ->exec() and all methods of F3 that use this function like load, find, findone etc...

+ 54 - 53
src/OpenMind/Web/Controller.php

@@ -12,49 +12,50 @@ use OpenMind\System\User;
 
 
 class Controller
 class Controller
 {
 {
-  /** @var SQL $dbHandle OM-Link Database */
-  protected $dbHandle;
+	/** @var SQL $dbHandle OM-Link Database */
+	protected $dbHandle;
 	private $timeLoadStart = null;
 	private $timeLoadStart = null;
 
 
 	/**
 	/**
-   * Sanitized POST request, useful if sanitized POST is need
-   * @var array $sanitizedPostRequest
-   */
-  private $sanitizedPostRequest;
+	 * Sanitized POST request, useful if sanitized POST is need
+	 * @var array $sanitizedPostRequest
+	 */
+	private $sanitizedPostRequest;
 
 
-  public function __construct($f3)
-  {
+	public function __construct($f3)
+	{
 		$this->timeLoadStart = round(microtime(true) * 1000);
 		$this->timeLoadStart = round(microtime(true) * 1000);
 
 
-    $this->sanitizedPostRequest = $f3->clean($f3->get('POST'));
-    $this->dbHandle = $f3->get('DB');
+		$this->sanitizedPostRequest = $f3->clean($f3->get('POST'));
+		$this->dbHandle = $f3->get('DB');
+
+		/** @var User $loggedUser */
+		$loggedUser = $f3->exists('SESSION.user') ? User::Restore() : null;
 
 
-    /** @var \OpenMind\System\User $loggedUser */
-    $loggedUser = $f3->exists('SESSION.user') ? User::Restore() : null;
+		$f3->set('USER', $loggedUser);
 
 
-    $f3->set('USER', $loggedUser);
+		// Check if user has permissions to navigate in current url
+		$currentAlias = $f3->get('ALIAS');
 
 
-    // Check if user has permissions to navigate in current url
-    $currentAlias = $f3->get('ALIAS');
+		// If user is not logged and page require a permission, redirect to '/'
+		if (!$loggedUser && $currentAlias) {
+			$f3->reroute('/');
+			return;
+		}
 
 
-    // If user is not logged and page require a permission, redirect to '/'
-    if (!$loggedUser && $currentAlias) {
-      $f3->reroute('/');
-      return;
-    }
+		if (
+			$loggedUser &&  // user is logged in?
+			$currentAlias && // the page require a permission?
+			!$loggedUser->hasPermission($currentAlias) // The user has the permission to go next step?
+		) {
+			$f3->reroute('/homemenu');
+			return;
+		}
 
 
-    if (
-      $loggedUser &&  // user is logged in?
-      $currentAlias && // the page require a permission?
-      !$loggedUser->hasPermission($currentAlias) // The user has the permission to go next step?
-    ) {
-      $f3->reroute('/homemenu');
-      return;
-    }
+		return;
+	}
 
 
-    return;
-  }
-  public function __destruct()
+	public function __destruct()
 	{
 	{
 		global $f3, $frameworkUtils;
 		global $f3, $frameworkUtils;
 		if ($f3->get('DEBUG') > 2) {
 		if ($f3->get('DEBUG') > 2) {
@@ -66,26 +67,26 @@ class Controller
 	}
 	}
 
 
 	/**
 	/**
-   * Return the sanitized POST parameters
-   *
-   * @return mixed
-   */
-  protected function getSanitizedPostRequest()
-  {
-    return $this->sanitizedPostRequest;
-  }
-
-  /**
-   * Use setTimeout to request a change url
-   *
-   * @param string $url to change to
-   * @param int $msDelay
-   */
-  protected function setRedirect(string $url, int $msDelay)
-  {
-    global $f3;
-
-    $f3->set('REQ_REDIRECT', $url);
-    $f3->set('REQ_REDIRECT_MS', $msDelay);
-  }
+	 * Return the sanitized POST parameters
+	 *
+	 * @return mixed
+	 */
+	protected function getSanitizedPostRequest()
+	{
+		return $this->sanitizedPostRequest;
+	}
+
+	/**
+	 * Use setTimeout to request a change url
+	 *
+	 * @param string $url to change to
+	 * @param int $msDelay
+	 */
+	protected function setRedirect(string $url, int $msDelay)
+	{
+		global $f3;
+
+		$f3->set('REQ_REDIRECT', $url);
+		$f3->set('REQ_REDIRECT_MS', $msDelay);
+	}
 }
 }

+ 6 - 4
src/OpenMind/Web/Login.php

@@ -8,7 +8,9 @@
 
 
 namespace OpenMind\Web;
 namespace OpenMind\Web;
 
 
+use Exception;
 use OpenMind\System\User;
 use OpenMind\System\User;
+use Template;
 
 
 class Login extends Controller
 class Login extends Controller
 {
 {
@@ -23,14 +25,14 @@ class Login extends Controller
 		$f3->clear('COOKIE.username');
 		$f3->clear('COOKIE.username');
 
 
 		$f3->set('CONTENT', 'login.tpl');
 		$f3->set('CONTENT', 'login.tpl');
-		echo \Template::instance()->render('masterpage.tpl');
+		echo Template::instance()->render('masterpage.tpl');
 	}
 	}
 
 
 	/**
 	/**
 	 * Check if username and password are correct
 	 * Check if username and password are correct
 	 *
 	 *
 	 * @param $f3
 	 * @param $f3
-	 * @throws \Exception
+	 * @throws Exception
 	 */
 	 */
 	public function LoginForm($f3)
 	public function LoginForm($f3)
 	{
 	{
@@ -44,7 +46,7 @@ class Login extends Controller
 
 
 			$f3->set('CONTENT', 'login.tpl');
 			$f3->set('CONTENT', 'login.tpl');
 			$f3->set('INFOTEXT', 'Dati di accesso non corretti');
 			$f3->set('INFOTEXT', 'Dati di accesso non corretti');
-			echo \Template::instance()->render('masterpage.tpl');
+			echo Template::instance()->render('masterpage.tpl');
 			return;
 			return;
 			/*http_response_code(500);
 			/*http_response_code(500);
 			throw new \Exception("Dati di accesso non corretti");*/
 			throw new \Exception("Dati di accesso non corretti");*/
@@ -62,7 +64,7 @@ class Login extends Controller
 	 *
 	 *
 	 * @param string $username
 	 * @param string $username
 	 * @param string $password
 	 * @param string $password
-	 * @return int|\OpenMind\System\User
+	 * @return int|User
 	 */
 	 */
 	private function checkLogin(string $username, string $password): ?User
 	private function checkLogin(string $username, string $password): ?User
 	{
 	{

+ 2 - 1
src/OpenMind/Web/Web.php

@@ -8,6 +8,7 @@
 namespace OpenMind\Web;
 namespace OpenMind\Web;
 
 
 use OpenMind\System\PluginStrategy;
 use OpenMind\System\PluginStrategy;
+use Template;
 
 
 class Pages extends Controller
 class Pages extends Controller
 {
 {
@@ -19,7 +20,7 @@ class Pages extends Controller
 		});
 		});
 
 
 		$f3->set('CONTENT', 'homemenu.tpl');
 		$f3->set('CONTENT', 'homemenu.tpl');
-		echo \Template::instance()->render('masterpage.tpl');
+		echo Template::instance()->render('masterpage.tpl');
 	}
 	}
 }
 }
 
 

+ 0 - 2
webpack.config.js

@@ -60,8 +60,6 @@ module.exports = {
 	output: {
 	output: {
 		publicPath: '/omlink/assets/frontend/',
 		publicPath: '/omlink/assets/frontend/',
 		path: path.resolve(__dirname, "assets/frontend/"),
 		path: path.resolve(__dirname, "assets/frontend/"),
-		//publicPath: '/omlink/src/openmind/admin/ui/assets/dist/',
-		//path: path.resolve(__dirname, "ui/assets/dist/"),
 		filename: "bundle.[contenthash].js"
 		filename: "bundle.[contenthash].js"
 	},
 	},
 };
 };