@@ -49,9 +49,9 @@ public function __construct()
49
49
$ this ->_cRequest = A::app ()->getRequest ();
50
50
$ this ->_pdoExtensionRequired = true ;
51
51
$ this ->_configMain = include (APPHP_PATH . '/protected/data/config.main.tpl ' );
52
- $ this ->_languages = array ( 'en ' => 'English ' , 'es ' => utf8_encode ('Español ' ), 'de ' => utf8_encode ('Deutsch ' )) ;
53
-
54
- $ this ->_view ->errorField = '' ;
52
+ $ this ->_languages = [ 'en ' => 'English ' , 'es ' => utf8_encode ('Español ' ), 'de ' => utf8_encode ('Deutsch ' )] ;
53
+
54
+ $ this ->_view ->errorField = '' ;
55
55
$ this ->_view ->_programName = isset ($ this ->_configMain ['name ' ]) ? $ this ->_configMain ['name ' ] : '' ;
56
56
$ this ->_view ->_programVersion = isset ($ this ->_configMain ['version ' ]) ? $ this ->_configMain ['version ' ] : '' ;
57
57
@@ -280,22 +280,22 @@ public function databaseAction()
280
280
$ dbConnectTypes = ['host ' => A::t ('setup ' , 'host ' ), 'socket ' => A::t ('setup ' , 'socket ' )];
281
281
$ msg = '' ;
282
282
283
- $ separatorGeneralFields = array (
283
+ $ separatorGeneralFields = [
284
284
'separatorInfo ' => ['legend ' => 'General Settings ' ],
285
285
'setupType ' => ['type ' => 'dropdownlist ' , 'value ' => $ this ->_view ->setupType , 'title ' => A::t ('setup ' , 'Setup Type ' ), 'mandatoryStar ' => false , 'data ' => array ('install ' => A::t ('setup ' , 'New Installation ' ), 'update ' => A::t ('setup ' , 'Update ' )), 'htmlOptions ' => [], 'validation ' => array ('required ' => true , 'type ' => 'text ' , 'source ' => array ('install ' ))],
286
286
'dbDriver ' => ['type ' => 'dropdownlist ' , 'value ' => $ this ->_view ->dbDriver , 'title ' => A::t ('setup ' , 'Database Driver ' ), 'mandatoryStar ' => true , 'data ' => $ dbDrivers , 'htmlOptions ' => array ('style ' => 'width:85px ' ), 'validation ' => array ('required ' => true , 'type ' => 'text ' , 'source ' => array_keys ($ dbDrivers ))],
287
287
'dbPrefix ' => ['type ' => 'textbox ' , 'value ' => $ this ->_view ->dbPrefix , 'title ' => A::t ('setup ' , 'Database (tables) Prefix ' ), 'mandatoryStar ' => false , 'htmlOptions ' => array ('maxLength ' => '10 ' , 'autocomplete ' => 'off ' ), 'validation ' => array ('required ' => false , 'type ' => 'variable ' )],
288
- ) ;
289
- $ separatorConenctionSettingsFields = array (
290
- 'separatorInfo ' => array ( 'legend ' => 'Connection Settings ' ) ,
291
- 'dbConnectType ' => array ( 'type ' => 'dropdownlist ' , 'value ' => $ this ->_view ->dbConnectType , 'title ' => A::t ('setup ' , 'Connection Type ' ), 'mandatoryStar ' => true , 'data ' => $ dbConnectTypes , 'htmlOptions ' => array ('style ' => 'width:85px ' ), 'validation ' => array ( 'required ' => true , 'type ' => 'text ' , 'source ' => array_keys ($ dbConnectTypes ))) ,
292
- 'dbSocket ' => array ( 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbSocket , 'title ' => A::t ('setup ' , 'Database Socket ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '60 ' , 'autocomplete ' => 'off ' , 'placeholder ' => '/tmp/mysql.sock ' ), 'validation ' => array ('required ' => ($ this ->_view ->dbConnectType == 'socket ' ? true : false ), 'type ' => 'text ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'socket ' ? false : true )) ,
293
- 'dbHost ' => array ( 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbHost , 'title ' => A::t ('setup ' , 'Database Host ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '60 ' , 'autocomplete ' => 'off ' , 'placeholder ' => 'e.g. localhost ' ), 'validation ' => array ('required ' => ($ this ->_view ->dbConnectType == 'host ' ? true : false ), 'type ' => 'text ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'host ' ? false : true )) ,
294
- 'dbPort ' => array ( 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbPort , 'title ' => A::t ('setup ' , 'Database Port ' ), 'mandatoryStar ' => false , 'htmlOptions ' => array ('maxLength ' => '10 ' , 'autocomplete ' => 'off ' , 'placeholder ' => 'e.g. 3306 ' , 'style ' => 'width:80px ' ), 'validation ' => array ('required ' => false , 'type ' => 'integer ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'host ' ? false : true )) ,
295
- 'dbName ' => array ( 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbName , 'title ' => A::t ('setup ' , 'Database Name ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '30 ' , 'autocomplete ' => 'off ' ), 'validation ' => array ('required ' => true , 'type ' => 'text ' )) ,
296
- 'dbUser ' => array ( 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbUser , 'title ' => A::t ('setup ' , 'Database User ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '30 ' , 'autocomplete ' => 'off ' ), 'validation ' => array ('required ' => true , 'type ' => 'text ' )) ,
297
- 'dbPassword ' => array ( 'type ' => 'password ' , 'value ' => $ this ->_view ->dbPassword , 'title ' => A::t ('setup ' , 'Database Password ' ), 'mandatoryStar ' => false , 'htmlOptions ' => array ('maxLength ' => '20 ' , 'autocomplete ' => 'off ' , 'id ' => 'db_password ' ), 'validation ' => array ('required ' => false , 'type ' => 'text ' ), 'appendCode ' => '<div for="db_password" class="toggle_password" data-field="db_password"></div> ' ) ,
298
- ) ;
288
+ ] ;
289
+ $ separatorConenctionSettingsFields = [
290
+ 'separatorInfo ' => [ 'legend ' => 'Connection Settings ' ] ,
291
+ 'dbConnectType ' => [ 'type ' => 'dropdownlist ' , 'value ' => $ this ->_view ->dbConnectType , 'title ' => A::t ('setup ' , 'Connection Type ' ), 'mandatoryStar ' => true , 'data ' => $ dbConnectTypes , 'htmlOptions ' => array ('style ' => 'width:85px ' ), 'validation ' => [ 'required ' => true , 'type ' => 'text ' , 'source ' => array_keys ($ dbConnectTypes )]] ,
292
+ 'dbSocket ' => [ 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbSocket , 'title ' => A::t ('setup ' , 'Database Socket ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '60 ' , 'autocomplete ' => 'off ' , 'placeholder ' => '/tmp/mysql.sock ' ), 'validation ' => array ('required ' => ($ this ->_view ->dbConnectType == 'socket ' ? true : false ), 'type ' => 'text ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'socket ' ? false : true )] ,
293
+ 'dbHost ' => [ 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbHost , 'title ' => A::t ('setup ' , 'Database Host ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '60 ' , 'autocomplete ' => 'off ' , 'placeholder ' => 'e.g. localhost ' ), 'validation ' => array ('required ' => ($ this ->_view ->dbConnectType == 'host ' ? true : false ), 'type ' => 'text ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'host ' ? false : true )] ,
294
+ 'dbPort ' => [ 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbPort , 'title ' => A::t ('setup ' , 'Database Port ' ), 'mandatoryStar ' => false , 'htmlOptions ' => array ('maxLength ' => '10 ' , 'autocomplete ' => 'off ' , 'placeholder ' => 'e.g. 3306 ' , 'style ' => 'width:80px ' ), 'validation ' => array ('required ' => false , 'type ' => 'integer ' ), 'disabled ' => ($ this ->_view ->dbConnectType == 'host ' ? false : true )] ,
295
+ 'dbName ' => [ 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbName , 'title ' => A::t ('setup ' , 'Database Name ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '30 ' , 'autocomplete ' => 'off ' ), 'validation ' => array ('required ' => true , 'type ' => 'text ' )] ,
296
+ 'dbUser ' => [ 'type ' => 'textbox ' , 'value ' => $ this ->_view ->dbUser , 'title ' => A::t ('setup ' , 'Database User ' ), 'mandatoryStar ' => true , 'htmlOptions ' => array ('maxLength ' => '30 ' , 'autocomplete ' => 'off ' ), 'validation ' => array ('required ' => true , 'type ' => 'text ' )] ,
297
+ 'dbPassword ' => [ 'type ' => 'password ' , 'value ' => $ this ->_view ->dbPassword , 'title ' => A::t ('setup ' , 'Database Password ' ), 'mandatoryStar ' => false , 'htmlOptions ' => array ('maxLength ' => '20 ' , 'autocomplete ' => 'off ' , 'id ' => 'db_password ' ), 'validation ' => array ('required ' => false , 'type ' => 'text ' ), 'appendCode ' => '<div for="db_password" class="toggle_password" data-field="db_password"></div> ' ] ,
298
+ ] ;
299
299
$ validationFields = array_merge ($ separatorGeneralFields , $ separatorConenctionSettingsFields );
300
300
$ this ->_view ->formFields = array (
301
301
'act ' => array ('type ' => 'hidden ' , 'value ' => 'send ' ),
@@ -307,16 +307,13 @@ public function databaseAction()
307
307
if ($ this ->_cSession ->get ('step ' ) < 2 ) {
308
308
$ this ->redirect ('setup/index ' );
309
309
} elseif ($ this ->_cRequest ->getPost ('act ' ) == 'send ' ) {
310
-
311
- $ result = CWidget::create ('CFormValidation ' , array (
312
- 'fields ' => $ validationFields
313
- ));
314
-
315
- if ($ result ['error ' ]) {
310
+ $ result = CWidget::create ('CFormValidation ' , ['fields ' => $ validationFields ]);
311
+
312
+ if ($ result ['error ' ]) {
316
313
$ msg = $ result ['errorMessage ' ];
317
314
$ this ->_view ->errorField = $ result ['errorField ' ];
318
315
} else {
319
- $ model = new Setup (array (
316
+ $ model = new Setup ([
320
317
'dbDriver ' => $ this ->_view ->dbDriver ,
321
318
'dbConnectType ' => $ this ->_view ->dbConnectType ,
322
319
'dbSocket ' => $ this ->_view ->dbSocket ,
@@ -325,7 +322,7 @@ public function databaseAction()
325
322
'dbName ' => $ this ->_view ->dbName ,
326
323
'dbUser ' => $ this ->_view ->dbUser ,
327
324
'dbPassword ' => $ this ->_view ->dbPassword
328
- ) );
325
+ ] );
329
326
330
327
if ($ model ->getError ()) {
331
328
$ this ->_view ->actionMessage = CWidget::create ('CMessage ' , ['error ' , $ model ->getErrorMessage ()]);
@@ -381,9 +378,9 @@ public function administratorAction()
381
378
382
379
$ result = CWidget::create ('CFormValidation ' , [
383
380
'fields ' => [
384
- 'email ' => array ( 'title ' => A::t ('setup ' , 'Email ' ), 'validation ' => array ( 'required ' => false , 'type ' => 'email ' )) ,
385
- 'username ' => array ( 'title ' => A::t ('setup ' , 'Username ' ), 'validation ' => array ( 'required ' => true , 'type ' => 'any ' , 'minLength ' => 4 , 'maxLength ' => 32 )) ,
386
- 'password ' => array ( 'title ' => A::t ('setup ' , 'Password ' ), 'validation ' => array ( 'required ' => true , 'type ' => 'any ' , 'minLength ' => 4 , 'maxLength ' => 25 )) ,
381
+ 'email ' => [ 'title ' => A::t ('setup ' , 'Email ' ), 'validation ' => [ 'required ' => false , 'type ' => 'email ' ]] ,
382
+ 'username ' => [ 'title ' => A::t ('setup ' , 'Username ' ), 'validation ' => [ 'required ' => true , 'type ' => 'any ' , 'minLength ' => 4 , 'maxLength ' => 32 ]] ,
383
+ 'password ' => [ 'title ' => A::t ('setup ' , 'Password ' ), 'validation ' => [ 'required ' => true , 'type ' => 'any ' , 'minLength ' => 4 , 'maxLength ' => 25 ]] ,
387
384
],
388
385
]);
389
386
@@ -456,8 +453,8 @@ public function readyAction()
456
453
]);
457
454
458
455
if ($ model ->getError ()) {
459
- $ this ->_view ->actionMessage = CWidget::create ('CMessage ' , array ( 'error ' , $ model ->getErrorMessage ()) );
460
- } else {
456
+ $ this ->_view ->actionMessage = CWidget::create ('CMessage ' , [ 'error ' , $ model ->getErrorMessage ()] );
457
+ } else {
461
458
if ($ model ->install ($ sqlDump )) {
462
459
$ modulesError = false ;
463
460
$ modulesWarning = false ;
@@ -481,7 +478,7 @@ public function readyAction()
481
478
$ model ->doBeginTransaction ();
482
479
if (!$ model ->install ($ sqlDump , false )) {
483
480
$ modulesError = true ;
484
- $ this ->_view ->actionMessage = CWidget::create ('CMessage ' , array ( 'error ' , $ model ->getErrorMessage ()) );
481
+ $ this ->_view ->actionMessage = CWidget::create ('CMessage ' , [ 'error ' , $ model ->getErrorMessage ()] );
485
482
} else {
486
483
// Copy module files
487
484
foreach ($ xml ->files ->children () as $ folder ) {
0 commit comments