@@ -173,6 +173,7 @@ public function createParamsString($data, $name)
173
173
return $ res ;
174
174
}
175
175
// --------------------------------------------------------------------
176
+
176
177
/**
177
178
* Restoring module data from query string
178
179
*
@@ -251,13 +252,13 @@ public function restoreParams()
251
252
252
253
/**
253
254
* Restoring module data from query string (old version)
254
- * @deprecated
255
255
* @return void
256
+ * @deprecated
256
257
*/
257
258
public function restoreParamsOld ()
258
259
{
259
- $ md= gr ('md ' ); // query param - current module
260
- $ pd= gr ('pd ' ); // query param - all params
260
+ $ md = gr ('md ' ); // query param - current module
261
+ $ pd = gr ('pd ' ); // query param - all params
261
262
262
263
$ global_params = array ();
263
264
@@ -323,7 +324,7 @@ public function saveParentParams()
323
324
public function checkInstalled ()
324
325
{
325
326
326
- $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
327
+ $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
327
328
if (!file_exists ($ flag_filename )) {
328
329
$ this ->install ();
329
330
} else {
@@ -412,13 +413,13 @@ public function install($parent_name = "")
412
413
} else {
413
414
SQLUpdate ("project_modules " , $ rec );
414
415
}
415
- SQLExec ("DELETE FROM project_modules WHERE NAME = ' " . $ this ->name . "' AND ID!= " . $ rec ["ID " ]);
416
+ SQLExec ("DELETE FROM project_modules WHERE NAME = ' " . $ this ->name . "' AND ID!= " . $ rec ["ID " ]);
416
417
417
- if (!is_dir (ROOT . 'cms/modules_installed ' )) {
418
+ if (!is_dir (ROOT . 'cms/modules_installed ' )) {
418
419
umask (0 );
419
- mkdir (ROOT . 'cms/modules_installed ' ,0777 );
420
+ mkdir (ROOT . 'cms/modules_installed ' , 0777 );
420
421
}
421
- $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
422
+ $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
422
423
if (!file_exists ($ flag_filename )) SaveFile ($ flag_filename , date ("H:m d.M.Y " ));
423
424
}
424
425
@@ -445,12 +446,13 @@ public function uninstall()
445
446
SQLExec ($ sqlQuery );
446
447
}
447
448
448
- $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
449
+ $ flag_filename = ROOT . 'cms/modules_installed/ ' . $ this ->name . '.installed ' ;
449
450
if (file_exists ($ flag_filename )) unlink ($ flag_filename );
450
451
}
451
452
452
453
453
454
// --------------------------------------------------------------------
455
+
454
456
/**
455
457
* Module data installation
456
458
*
@@ -528,14 +530,14 @@ public function dbInstall($data)
528
530
$ definition = str_replace ('` ' , '' , $ definition );
529
531
$ sql = "ALTER TABLE $ table ADD $ definition; " ;
530
532
SQLExec ($ sql );
531
- SQLExec ("FLUSH TABLES " . $ table. "; " );
533
+ SQLExec ("FLUSH TABLES " . $ table . "; " );
532
534
$ to_optimize [] = $ table ;
533
535
}
534
536
} elseif (!isset ($ tbl_fields [$ table ][$ field ])) {
535
537
// new field
536
538
$ sql = "ALTER TABLE $ table ADD $ definition; " ;
537
539
SQLExec ($ sql );
538
- SQLExec ("FLUSH TABLES " . $ table. "; " );
540
+ SQLExec ("FLUSH TABLES " . $ table . "; " );
539
541
}
540
542
}
541
543
@@ -599,13 +601,14 @@ public function redirect($url)
599
601
global $ session ;
600
602
601
603
$ new_url = $ this ->makeRealURL ($ url );
602
- if (isset ($ this ->owner ) && $ this ->owner ->name == 'panel ' && preg_match ('/nf\.php/ ' ,$ new_url )) {
603
- $ new_url = str_replace ('nf.php ' ,'admin.php ' ,$ new_url );
604
+ if (isset ($ this ->owner ) && $ this ->owner ->name == 'panel ' && preg_match ('/nf\.php/ ' , $ new_url )) {
605
+ $ new_url = str_replace ('nf.php ' , 'admin.php ' , $ new_url );
604
606
}
605
607
606
608
$ session ->save ();
607
609
608
- if ($ _GET ['part_load ' ]) {
610
+ $ part_load = gr ('part_load ' );
611
+ if ($ part_load ) {
609
612
$ res = array ();
610
613
$ res ['CONTENT ' ] = '' ;
611
614
$ res ['NEED_RELOAD ' ] = 1 ;
@@ -723,7 +726,7 @@ public function dynamic($content)
723
726
*/
724
727
public function parseLinks ($ result )
725
728
{
726
- $ md= gr ('md ' );
729
+ $ md = gr ('md ' );
727
730
if (!isset ($ _SERVER ['PHP_SELF ' ])) {
728
731
global $ PHP_SELF ;
729
732
$ _SERVER ['PHP_SELF ' ] = $ PHP_SELF ;
@@ -843,55 +846,55 @@ public function codeParams($in)
843
846
844
847
return $ res_str ;
845
848
}
846
-
847
- public function sendNotification ($ str , $ type = 'default ' )
849
+
850
+ public function sendNotification ($ str , $ type = 'default ' )
848
851
{
849
852
850
853
if (!SQLTableExists ('module_notifications ' )) {
851
- return json_encode (array ('status ' => false ));
852
- }
853
-
854
- if ($ type != 'info ' && $ type != 'danger ' && $ type != 'warning ' && $ type != 'success ' && $ type != 'default ' ) {
855
- $ type = 'default ' ;
856
- }
857
-
858
- $ rec ["ADDED " ] = date ('Y-m-d H:i:s ' );
859
- $ rec ["TYPE " ] = $ type ;
860
- $ rec ["MODULE_NAME " ] = $ this ->name ;
861
- $ rec ["MESSAGE " ] = htmlspecialchars (strip_tags ($ str ));
862
-
863
- if (SQLSelectOne ("SELECT COUNT(*) AS TOTAL_UNREAD FROM `module_notifications` WHERE `MODULE_NAME` = ' " . $ rec ["MODULE_NAME " ]. "' AND `IS_READ` = '0' " )['TOTAL_UNREAD ' ] > 10 ) {
864
- return json_encode (array ('status ' => false , 'error ' => 'More than 10 notifications in the unread status. ' ));
865
- }
866
-
867
- $ ifExist = SQLSelectOne ("SELECT ID FROM `module_notifications` WHERE `MESSAGE` = ' " . DBSafe ($ rec ['MESSAGE ' ]). "' AND TYPE=' " . DBSafe ($ rec ['TYPE ' ]). "' AND `IS_READ` = '0' " );
868
- if (!empty ($ ifExist ) && is_array ($ ifExist )) {
869
- return json_encode (array ('status ' => false , 'error ' => 'Notification already exists. ID: ' . $ ifExist ['ID ' ], 'id ' => $ ifExist ['ID ' ]));
870
- }
871
-
872
- $ rec ["ID " ] = SQLInsert ("module_notifications " , $ rec );
873
-
874
- return json_encode (array ('status ' => true , 'id ' => $ rec ["ID " ]));
854
+ return json_encode (array ('status ' => false ));
855
+ }
856
+
857
+ if ($ type != 'info ' && $ type != 'danger ' && $ type != 'warning ' && $ type != 'success ' && $ type != 'default ' ) {
858
+ $ type = 'default ' ;
859
+ }
860
+
861
+ $ rec ["ADDED " ] = date ('Y-m-d H:i:s ' );
862
+ $ rec ["TYPE " ] = $ type ;
863
+ $ rec ["MODULE_NAME " ] = $ this ->name ;
864
+ $ rec ["MESSAGE " ] = htmlspecialchars (strip_tags ($ str ));
865
+
866
+ if (SQLSelectOne ("SELECT COUNT(*) AS TOTAL_UNREAD FROM `module_notifications` WHERE `MODULE_NAME` = ' " . $ rec ["MODULE_NAME " ] . "' AND `IS_READ` = '0' " )['TOTAL_UNREAD ' ] > 10 ) {
867
+ return json_encode (array ('status ' => false , 'error ' => 'More than 10 notifications in the unread status. ' ));
868
+ }
869
+
870
+ $ ifExist = SQLSelectOne ("SELECT ID FROM `module_notifications` WHERE `MESSAGE` = ' " . DBSafe ($ rec ['MESSAGE ' ]) . "' AND TYPE=' " . DBSafe ($ rec ['TYPE ' ]) . "' AND `IS_READ` = '0' " );
871
+ if (!empty ($ ifExist ) && is_array ($ ifExist )) {
872
+ return json_encode (array ('status ' => false , 'error ' => 'Notification already exists. ID: ' . $ ifExist ['ID ' ], 'id ' => $ ifExist ['ID ' ]));
873
+ }
874
+
875
+ $ rec ["ID " ] = SQLInsert ("module_notifications " , $ rec );
876
+
877
+ return json_encode (array ('status ' => true , 'id ' => $ rec ["ID " ]));
875
878
876
879
}
877
-
878
- public function readNotification ($ notification_id )
880
+
881
+ public function readNotification ($ notification_id )
879
882
{
880
883
881
884
if (!SQLTableExists ('module_notifications ' )) {
882
- return json_encode (array ('status ' => false ));
883
- }
884
-
885
- $ rec ["ID " ] = $ notification_id ;
886
- $ rec ["IS_READ " ] = 1 ;
887
-
888
- if (empty (SQLSelectOne ("SELECT ID FROM `module_notifications` WHERE `ID` = ' " . $ rec ["ID " ]. "' AND `IS_READ` = '0' " )['ID ' ])) {
889
- return json_encode (array ('status ' => false , 'error ' => 'No such noty found ' ));
890
- }
891
-
892
- SQLUpdate ("module_notifications " , $ rec );
893
-
894
- return json_encode (array ('status ' => true ));
885
+ return json_encode (array ('status ' => false ));
886
+ }
887
+
888
+ $ rec ["ID " ] = $ notification_id ;
889
+ $ rec ["IS_READ " ] = 1 ;
890
+
891
+ if (empty (SQLSelectOne ("SELECT ID FROM `module_notifications` WHERE `ID` = ' " . $ rec ["ID " ] . "' AND `IS_READ` = '0' " )['ID ' ])) {
892
+ return json_encode (array ('status ' => false , 'error ' => 'No such noty found ' ));
893
+ }
894
+
895
+ SQLUpdate ("module_notifications " , $ rec );
896
+
897
+ return json_encode (array ('status ' => true ));
895
898
896
899
}
897
900
}
0 commit comments