Passed
Push — main ( 915a08...2be97f )
by Sammy
01:45
created
Auth/Operator.class.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -12,12 +12,12 @@  discard block
 block discarded – undo
12 12
 
13 13
   use Permissionability;
14 14
 
15
-	public function __toString()
15
+  public function __toString()
16 16
   {
17 17
     return $this->get('username');
18 18
   }
19 19
 
20
-	public function is_active() : bool
20
+  public function is_active() : bool
21 21
   {
22 22
     return !empty($this->get('active'));
23 23
   }
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
   }
39 39
 
40 40
   public function password_change($string)
41
-	{
42
-		$this->password = password_hash($string, PASSWORD_DEFAULT);
43
-	}
41
+  {
42
+    $this->password = password_hash($string, PASSWORD_DEFAULT);
43
+  }
44 44
 
45
-	public function password_verify($string) : bool
46
-	{
47
-		return password_verify($string, $this->password());
48
-	}
45
+  public function password_verify($string) : bool
46
+  {
47
+    return password_verify($string, $this->password());
48
+  }
49 49
 
50 50
   public function name()
51 51
   {
@@ -61,39 +61,39 @@  discard block
 block discarded – undo
61 61
     return $this->get('phone');
62 62
   }
63 63
 
64
-	public function language_code()
64
+  public function language_code()
65 65
   {
66 66
     return $this->get('language_code');
67 67
   }
68 68
 
69
-	public static function query_retrieve($filters=[], $options=[]) : Select
70
-	{
71
-		$Query = static::table()->select();
72
-  	if(isset($options['eager']) && $options['eager'] === true)
73
-		{
69
+  public static function query_retrieve($filters=[], $options=[]) : Select
70
+  {
71
+    $Query = static::table()->select();
72
+    if(isset($options['eager']) && $options['eager'] === true)
73
+    {
74 74
       $Query->group_by('id');
75 75
 
76 76
       $Query->auto_join([ACL::table(), 'acl'], null, 'LEFT OUTER');
77 77
       $Query->auto_join([Permission::table(), 'kadro_permission'], null, 'LEFT OUTER');
78
-			$Query->select_also(["GROUP_CONCAT(DISTINCT kadro_permission.id) as permission_ids", "GROUP_CONCAT(DISTINCT kadro_permission.name) as permission_names"]);
79
-		}
78
+      $Query->select_also(["GROUP_CONCAT(DISTINCT kadro_permission.id) as permission_ids", "GROUP_CONCAT(DISTINCT kadro_permission.name) as permission_names"]);
79
+    }
80 80
 
81
-		if(isset($filters['model']) && !empty($filters['model']))
82
-		{
83
-			$model = $filters['model'];
84
-			$Query->join([static::otm('t'), static::otm('a')],[[static::otm('a'),static::otm('k'), 't_from','id']], 'INNER');
85
-			$Query->aw_fields_eq(['model_id' => $filters['model']->get_id(), 'model_type' => get_class($filters['model'])::model_type()], static::otm('a'));
86
-		}
81
+    if(isset($filters['model']) && !empty($filters['model']))
82
+    {
83
+      $model = $filters['model'];
84
+      $Query->join([static::otm('t'), static::otm('a')],[[static::otm('a'),static::otm('k'), 't_from','id']], 'INNER');
85
+      $Query->aw_fields_eq(['model_id' => $filters['model']->get_id(), 'model_type' => get_class($filters['model'])::model_type()], static::otm('a'));
86
+    }
87 87
 
88 88
     $Query->order_by([$Query->table_label(), 'name', 'ASC']);
89 89
 
90 90
 
91
-		return $Query;
92
-	}
91
+    return $Query;
92
+  }
93 93
 
94
-	public function immortal() : bool
95
-	{
96
-		return true; // never delete a user, always deactivate
97
-	}
94
+  public function immortal() : bool
95
+  {
96
+    return true; // never delete a user, always deactivate
97
+  }
98 98
 }
99 99
 
Please login to merge, or discard this patch.
common.inc.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -2,153 +2,153 @@
 block discarded – undo
2 2
 
3 3
 namespace HexMakina\kadro
4 4
 {
5
-	use \HexMakina\LocalFS\FileSystem;
5
+  use \HexMakina\LocalFS\FileSystem;
6 6
 
7
-	define('KADRO_BASE', APP_BASE.'/lib/kadro/'); // this is project dependant, should be in settings
8
-	// define('QIVIVE_BASE', APP_BASE.'/lib/qivive/'); // this is project dependant, should be in settings
7
+  define('KADRO_BASE', APP_BASE.'/lib/kadro/'); // this is project dependant, should be in settings
8
+  // define('QIVIVE_BASE', APP_BASE.'/lib/qivive/'); // this is project dependant, should be in settings
9 9
 
10
-	set_include_path(implode(PATH_SEPARATOR, [get_include_path(), APP_BASE, APP_BASE.'/lib/', APP_BASE.'/vendor/', KADRO_BASE]));
10
+  set_include_path(implode(PATH_SEPARATOR, [get_include_path(), APP_BASE, APP_BASE.'/lib/', APP_BASE.'/vendor/', KADRO_BASE]));
11 11
 
12
-	//---------------------------------------------------------------     autoloader
12
+  //---------------------------------------------------------------     autoloader
13 13
   require APP_BASE.'vendor/autoload.php';
14 14
 
15
-	require 'PSR4Autoloader.class.php';
16
-	$loader=new PSR4Autoloader;
17
-	$loader->register(); //Register loader with SPL autoloader stack.
15
+  require 'PSR4Autoloader.class.php';
16
+  $loader=new PSR4Autoloader;
17
+  $loader->register(); //Register loader with SPL autoloader stack.
18 18
 
19
-	$loader->addNamespace('HexMakina', APP_BASE.'/lib/');
19
+  $loader->addNamespace('HexMakina', APP_BASE.'/lib/');
20 20
 
21
-	// $loader->addNamespace('HexMakina\Crudites', APP_BASE.'/lib/Crudites/');
22
-	// $loader->addNamespace('HexMakina\ORM', APP_BASE.'/lib/ORM/');
23
-	// $loader->addNamespace('HexMakina\Lezer', APP_BASE.'/lib/Lezer/');
24
-	// $loader->addNamespace('HexMakina\Format', APP_BASE.'/lib/Format');
21
+  // $loader->addNamespace('HexMakina\Crudites', APP_BASE.'/lib/Crudites/');
22
+  // $loader->addNamespace('HexMakina\ORM', APP_BASE.'/lib/ORM/');
23
+  // $loader->addNamespace('HexMakina\Lezer', APP_BASE.'/lib/Lezer/');
24
+  // $loader->addNamespace('HexMakina\Format', APP_BASE.'/lib/Format');
25 25
 
26
-	// $loader->addNamespace('HexMakina\kadro', KADRO_BASE);
27
-	// $loader->addNamespace('HexMakina\qivive', QIVIVE_BASE);
28
-	// $loader->addNamespace('HexMakina\LocalFS', __DIR__.'/Format/File');
29
-	$loader->addNamespaceTree(KADRO_BASE);
26
+  // $loader->addNamespace('HexMakina\kadro', KADRO_BASE);
27
+  // $loader->addNamespace('HexMakina\qivive', QIVIVE_BASE);
28
+  // $loader->addNamespace('HexMakina\LocalFS', __DIR__.'/Format/File');
29
+  $loader->addNamespaceTree(KADRO_BASE);
30 30
 
31
-	//---------------------------------------------------------------     erara raportado
32
-	error_reporting(E_ALL);
31
+  //---------------------------------------------------------------     erara raportado
32
+  error_reporting(E_ALL);
33 33
 
34
-	set_error_handler('\HexMakina\kadro\Logger\LogLaddy::error_handler');
35
-	set_exception_handler('\HexMakina\kadro\Logger\LogLaddy::exception_handler');
34
+  set_error_handler('\HexMakina\kadro\Logger\LogLaddy::error_handler');
35
+  set_exception_handler('\HexMakina\kadro\Logger\LogLaddy::exception_handler');
36 36
 
37
-	\HexMakina\Debugger\Debugger::init();
37
+  \HexMakina\Debugger\Debugger::init();
38 38
 
39
-	//---------------------------------------------------------------     parametroj
40
-	require_once APP_BASE.'configs/settings.php';
41
-	$box=new Container\LeMarchand($settings);
39
+  //---------------------------------------------------------------     parametroj
40
+  require_once APP_BASE.'configs/settings.php';
41
+  $box=new Container\LeMarchand($settings);
42 42
 
43 43
   foreach($box->get('settings.app.namespaces') as $namespace => $path)
44 44
   {
45
-  	$loader->addNamespace($namespace, $path);
45
+    $loader->addNamespace($namespace, $path);
46 46
   }
47 47
 
48
-	define('PRODUCTION', $_SERVER['HTTP_HOST'] === $box->get('settings.app.production_host'));
49
-	ini_set('display_errors', PRODUCTION ? 0 : 1);
48
+  define('PRODUCTION', $_SERVER['HTTP_HOST'] === $box->get('settings.app.production_host'));
49
+  ini_set('display_errors', PRODUCTION ? 0 : 1);
50 50
 
51
-	//---------------------------------------------------------------       logger
52
-	$box->register('LoggerInterface', new Logger\LogLaddy());
51
+  //---------------------------------------------------------------       logger
52
+  $box->register('LoggerInterface', new Logger\LogLaddy());
53 53
 
54
-	//---------------------------------------------------------------       router
55
-	$box->register('RouterInterface', new Router\hopper($box->get('settings.RouterInterface')));
54
+  //---------------------------------------------------------------       router
55
+  $box->register('RouterInterface', new Router\hopper($box->get('settings.RouterInterface')));
56 56
 
57
-	//---------------------------------------------------------------        kuketoj
58
-	setcookie('cookie_test', 'test_value', time()+(365 * 24 * 60 * 60), "/", "");
59
-	$cookies_enabled=isset($_COOKIE['cookie_test']); // houston, do we have cookies ?
57
+  //---------------------------------------------------------------        kuketoj
58
+  setcookie('cookie_test', 'test_value', time()+(365 * 24 * 60 * 60), "/", "");
59
+  $cookies_enabled=isset($_COOKIE['cookie_test']); // houston, do we have cookies ?
60 60
 
61
-	if($cookies_enabled === false)
62
-	{
63
-		ini_set('session.use_cookies', 0);
64
-		ini_set('session.use_only_cookies', 0);
65
-		ini_set('session.use_trans_sid', 1);
66
-		ini_set('session.cache_limiter', 'nocache');
67
-	}
61
+  if($cookies_enabled === false)
62
+  {
63
+    ini_set('session.use_cookies', 0);
64
+    ini_set('session.use_only_cookies', 0);
65
+    ini_set('session.use_trans_sid', 1);
66
+    ini_set('session.cache_limiter', 'nocache');
67
+  }
68 68
 
69 69
 //---------------------------------------------------------------        Session Management
70
-	$StateAgent=new StateAgent($box->get('settings.app.session_start_options') ?? []);
71
-	$StateAgent->add_runtime_filters((array)$box->get('settings.filter'));
72
-	$StateAgent->add_runtime_filters((array)($_SESSION['filter'] ?? []));
73
-	$StateAgent->add_runtime_filters((array)($_REQUEST['filter'] ?? []));
70
+  $StateAgent=new StateAgent($box->get('settings.app.session_start_options') ?? []);
71
+  $StateAgent->add_runtime_filters((array)$box->get('settings.filter'));
72
+  $StateAgent->add_runtime_filters((array)($_SESSION['filter'] ?? []));
73
+  $StateAgent->add_runtime_filters((array)($_REQUEST['filter'] ?? []));
74 74
 
75
-	$box->register('StateAgent', $StateAgent);
75
+  $box->register('StateAgent', $StateAgent);
76 76
 
77 77
 
78
-	//---------------------------------------------------------------     parametroj:signo
78
+  //---------------------------------------------------------------     parametroj:signo
79 79
 
80
-	ini_set('default_charset', $box->get('settings.default.charset'));
81
-	header('Content-type: text/html; charset='.strtolower($box->get('settings.default.charset')));
80
+  ini_set('default_charset', $box->get('settings.default.charset'));
81
+  header('Content-type: text/html; charset='.strtolower($box->get('settings.default.charset')));
82 82
 
83
-	//---------------------------------------------------------------     parametroj:linguo
84
-	putenv('LANG='.$box->get('settings.default.language'));
85
-	setlocale(LC_ALL, $box->get('settings.default.language'));
83
+  //---------------------------------------------------------------     parametroj:linguo
84
+  putenv('LANG='.$box->get('settings.default.language'));
85
+  setlocale(LC_ALL, $box->get('settings.default.language'));
86 86
 
87
-	//---------------------------------------------------------------     parametroj:datoj
88
-	date_default_timezone_set($box->get('settings.default.timezone'));
87
+  //---------------------------------------------------------------     parametroj:datoj
88
+  date_default_timezone_set($box->get('settings.default.timezone'));
89 89
 
90 90
 
91
-	//---------------------------------------------------------------     ŝablonoj
92
-	require_once 'smarty/smarty/libs/Smarty.class.php';
93
-	// Load smarty template parser
94
-	if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path')))
95
-			throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
91
+  //---------------------------------------------------------------     ŝablonoj
92
+  require_once 'smarty/smarty/libs/Smarty.class.php';
93
+  // Load smarty template parser
94
+  if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path')))
95
+      throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
96 96
 
97
-	$smarty=new \Smarty();
98
-	$box->register('template_engine', $smarty);
97
+  $smarty=new \Smarty();
98
+  $box->register('template_engine', $smarty);
99 99
 
100
-	$smarty->setTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path').'app');
101
-	$smarty->addTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path'));
102
-	$smarty->addTemplateDir(KADRO_BASE . 'Views/');
100
+  $smarty->setTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path').'app');
101
+  $smarty->addTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path'));
102
+  $smarty->addTemplateDir(KADRO_BASE . 'Views/');
103 103
 
104
-	$smarty->setCompileDir(APP_BASE . $box->get('settings.smarty.compiled_path'));
105
-	$smarty->setDebugging($box->get('settings.smarty.debug'));
104
+  $smarty->setCompileDir(APP_BASE . $box->get('settings.smarty.compiled_path'));
105
+  $smarty->setDebugging($box->get('settings.smarty.debug'));
106 106
 
107
-	$smarty->registerClass('Lezer', 			'\HexMakina\Lezer\Lezer');
108
-	$smarty->registerClass('Marker', 			'\HexMakina\Format\HTML\Marker');
109
-	$smarty->registerClass('Form', 				'\HexMakina\Format\HTML\Form');
110
-	$smarty->registerClass('TableToForm',	'\HexMakina\kadro\TableToForm');
111
-	$smarty->registerClass('Dato', 				'\HexMakina\Format\Tempo\Dato');
107
+  $smarty->registerClass('Lezer', 			'\HexMakina\Lezer\Lezer');
108
+  $smarty->registerClass('Marker', 			'\HexMakina\Format\HTML\Marker');
109
+  $smarty->registerClass('Form', 				'\HexMakina\Format\HTML\Form');
110
+  $smarty->registerClass('TableToForm',	'\HexMakina\kadro\TableToForm');
111
+  $smarty->registerClass('Dato', 				'\HexMakina\Format\Tempo\Dato');
112 112
 
113
-	$smarty->assign('APP_NAME', $box->get('settings.app.name'));
113
+  $smarty->assign('APP_NAME', $box->get('settings.app.name'));
114 114
 
115
-	//---------------------------------------------------------------     lingva
115
+  //---------------------------------------------------------------     lingva
116 116
 
117
-	$languages=\HexMakina\Lezer\Lezer::languages_by_file(APP_BASE.'locale/');
117
+  $languages=\HexMakina\Lezer\Lezer::languages_by_file(APP_BASE.'locale/');
118 118
 
119 119
   $smarty->assign('languages', $languages);
120 120
 
121
-	$language=null;
122
-
123
-	// changing / setting the language
124
-	if(isset($_GET['lang']))
125
-	{
126
-		if(isset($languages[$_GET['lang']]))
127
-		{
128
-			$language=$_GET['lang'];
129
-			if($cookies_enabled === true)
130
-				setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
131
-			else
132
-				trigger_error('KADRO_SYSTEM_ERR_COOKIES_ARE_DISABLED_LANGUAGE_CANNOT_BE_STORED', E_USER_WARNING);
133
-		}
134
-		else
135
-			throw new \Exception('KADRO_SYSTEM_ERR_INVALID_PARAMETER');
136
-	}
137
-	else if($cookies_enabled === true && array_key_exists('lang', $_COOKIE) && array_key_exists($_COOKIE['lang'], $languages))
138
-		$language=$_COOKIE['lang'];
139
-
140
-	if(is_null($language) && !empty($languages))
141
-	{
142
-		if(count($languages) === 1)
143
-			$language=key($languages);
144
-		elseif(array_key_exists($box->get('settings.default.language'), $languages))
145
-			$language=$box->get('settings.default.language');
146
-		else
147
-			throw new \Exception('FALLBACK_TO_DEFAULT_LANGUAGE_FAILED');
148
-		$i18n = new \HexMakina\Lezer\Lezer(APP_BASE.'locale/'.$language.'/user_interface.json', APP_BASE.'locale/cache/', $language);
149
-		$i18n->init();
150
-		$smarty->assign('language', $language);
151
-	}
121
+  $language=null;
122
+
123
+  // changing / setting the language
124
+  if(isset($_GET['lang']))
125
+  {
126
+    if(isset($languages[$_GET['lang']]))
127
+    {
128
+      $language=$_GET['lang'];
129
+      if($cookies_enabled === true)
130
+        setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
131
+      else
132
+        trigger_error('KADRO_SYSTEM_ERR_COOKIES_ARE_DISABLED_LANGUAGE_CANNOT_BE_STORED', E_USER_WARNING);
133
+    }
134
+    else
135
+      throw new \Exception('KADRO_SYSTEM_ERR_INVALID_PARAMETER');
136
+  }
137
+  else if($cookies_enabled === true && array_key_exists('lang', $_COOKIE) && array_key_exists($_COOKIE['lang'], $languages))
138
+    $language=$_COOKIE['lang'];
139
+
140
+  if(is_null($language) && !empty($languages))
141
+  {
142
+    if(count($languages) === 1)
143
+      $language=key($languages);
144
+    elseif(array_key_exists($box->get('settings.default.language'), $languages))
145
+      $language=$box->get('settings.default.language');
146
+    else
147
+      throw new \Exception('FALLBACK_TO_DEFAULT_LANGUAGE_FAILED');
148
+    $i18n = new \HexMakina\Lezer\Lezer(APP_BASE.'locale/'.$language.'/user_interface.json', APP_BASE.'locale/cache/', $language);
149
+    $i18n->init();
150
+    $smarty->assign('language', $language);
151
+  }
152 152
 }
153 153
 
154 154
 
Please login to merge, or discard this patch.
Controllers/Interfaces/CRUDController.class.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 interface CRUDController
6 6
 {
7
-   public function dashboard();
8
-   public function edit();
9
-   public function save();
10
-   public function listing();
7
+    public function dashboard();
8
+    public function edit();
9
+    public function save();
10
+    public function listing();
11 11
 
12
-   public function destroy();
12
+    public function destroy();
13 13
 
14
-   public function errors() : array;
14
+    public function errors() : array;
15 15
 }
16 16
 
17 17
 
Please login to merge, or discard this patch.