Completed
Push — master ( 3a6ebc...3a5a05 )
by Michael
04:13
created
xoops_trust_path/libs/altsys/oninstall.php 1 patch
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_install_'.$mydirname.'( $module ) { return altsys_oninstall_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_oninstall_base')) {
6
+if (!function_exists('altsys_oninstall_base')) {
7 7
     function altsys_oninstall_base($module, $mydirname)
8 8
     {
9 9
         // transations on module install
10 10
 
11
-    global $ret ; // TODO :-D
11
+    global $ret; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15
-        $root =& XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_oninstall') ;
17
-        $ret = array() ;
15
+        $root = & XCube_Root::getSingleton();
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleInstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_oninstall');
17
+        $ret = array();
18 18
     } else {
19
-        if (! is_array($ret)) {
20
-            $ret = array() ;
19
+        if (!is_array($ret)) {
20
+            $ret = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
     /*************** BEGIN ALTSYS SPECIFIC PART ******************/
28 28
     // set weight=0
29
-    $db->queryF('UPDATE ' . $db->prefix('modules') . " SET weight=0 WHERE mid=$mid") ;
29
+    $db->queryF('UPDATE '.$db->prefix('modules')." SET weight=0 WHERE mid=$mid");
30 30
     /*************** END ALTSYS SPECIFIC PART ******************/
31 31
 
32 32
     // TABLES (loading mysql.sql)
33
-    $sql_file_path = __DIR__.'/sql/mysql.sql' ;
34
-        $prefix_mod = $db->prefix() . '_' . $mydirname ;
33
+    $sql_file_path = __DIR__.'/sql/mysql.sql';
34
+        $prefix_mod = $db->prefix().'_'.$mydirname;
35 35
         if (file_exists($sql_file_path)) {
36
-            $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br /> Creating tables...';
36
+            $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br /> Creating tables...';
37 37
 
38 38
             if (file_exists(XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php')) {
39
-                include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php' ;
40
-                $sqlutil = new OldSqlUtility ;
39
+                include_once XOOPS_ROOT_PATH.'/class/database/oldsqlutility.php';
40
+                $sqlutil = new OldSqlUtility;
41 41
             } else {
42
-                include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php' ;
43
-                $sqlutil = new SqlUtility ;
42
+                include_once XOOPS_ROOT_PATH.'/class/database/sqlutility.php';
43
+                $sqlutil = new SqlUtility;
44 44
             }
45 45
 
46
-            $sql_query = trim(file_get_contents($sql_file_path)) ;
47
-            $sqlutil->splitMySqlFile($pieces, $sql_query) ;
48
-            $created_tables = array() ;
46
+            $sql_query = trim(file_get_contents($sql_file_path));
47
+            $sqlutil->splitMySqlFile($pieces, $sql_query);
48
+            $created_tables = array();
49 49
             foreach ($pieces as $piece) {
50
-                $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod) ;
51
-                if (! $prefixed_query) {
52
-                    $ret[] = 'Invalid SQL <b>' . htmlspecialchars($piece) . '</b><br />';
53
-                    return false ;
50
+                $prefixed_query = $sqlutil->prefixQuery($piece, $prefix_mod);
51
+                if (!$prefixed_query) {
52
+                    $ret[] = 'Invalid SQL <b>'.htmlspecialchars($piece).'</b><br />';
53
+                    return false;
54 54
                 }
55
-                if (! $db->query($prefixed_query[0])) {
56
-                    $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />' ;
55
+                if (!$db->query($prefixed_query[0])) {
56
+                    $ret[] = '<b>'.htmlspecialchars($db->error()).'</b><br />';
57 57
                 //var_dump( $db->error() ) ;
58
-                return false ;
58
+                return false;
59 59
                 } else {
60
-                    if (! in_array($prefixed_query[4], $created_tables)) {
60
+                    if (!in_array($prefixed_query[4], $created_tables)) {
61 61
                         $ret[] = 'Table <b>'.htmlspecialchars($prefix_mod.'_'.$prefixed_query[4]).'</b> created.<br />';
62 62
                         $created_tables[] = $prefixed_query[4];
63 63
                     } else {
@@ -68,33 +68,33 @@  discard block
 block discarded – undo
68 68
         }
69 69
 
70 70
     // TEMPLATES
71
-    $tplfile_handler = xoops_gethandler('tplfile') ;
72
-        $tpl_path = __DIR__.'/templates' ;
73
-        if ($handler = @opendir($tpl_path . '/')) {
71
+    $tplfile_handler = xoops_gethandler('tplfile');
72
+        $tpl_path = __DIR__.'/templates';
73
+        if ($handler = @opendir($tpl_path.'/')) {
74 74
             while (($file = readdir($handler)) !== false) {
75 75
                 if (substr($file, 0, 1) == '.') {
76
-                    continue ;
76
+                    continue;
77 77
                 }
78
-                $file_path = $tpl_path . '/' . $file ;
78
+                $file_path = $tpl_path.'/'.$file;
79 79
                 if (is_file($file_path)) {
80 80
                     $mtime = (int)(@filemtime($file_path));
81
-                    $tplfile =& $tplfile_handler->create() ;
82
-                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ;
83
-                    $tplfile->setVar('tpl_refid', $mid) ;
84
-                    $tplfile->setVar('tpl_tplset', 'default') ;
85
-                    $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ;
86
-                    $tplfile->setVar('tpl_desc', '', true) ;
87
-                    $tplfile->setVar('tpl_module', $mydirname) ;
88
-                    $tplfile->setVar('tpl_lastmodified', $mtime) ;
89
-                    $tplfile->setVar('tpl_lastimported', 0) ;
90
-                    $tplfile->setVar('tpl_type', 'module') ;
91
-                    if (! $tplfile_handler->insert($tplfile)) {
81
+                    $tplfile = & $tplfile_handler->create();
82
+                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
83
+                    $tplfile->setVar('tpl_refid', $mid);
84
+                    $tplfile->setVar('tpl_tplset', 'default');
85
+                    $tplfile->setVar('tpl_file', $mydirname.'_'.$file);
86
+                    $tplfile->setVar('tpl_desc', '', true);
87
+                    $tplfile->setVar('tpl_module', $mydirname);
88
+                    $tplfile->setVar('tpl_lastmodified', $mtime);
89
+                    $tplfile->setVar('tpl_lastimported', 0);
90
+                    $tplfile->setVar('tpl_type', 'module');
91
+                    if (!$tplfile_handler->insert($tplfile)) {
92 92
                         $ret[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span><br />';
93 93
                     } else {
94
-                        $tplid = $tplfile->getVar('tpl_id') ;
94
+                        $tplid = $tplfile->getVar('tpl_id');
95 95
                         $ret[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)<br />';
96
-                        require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ;
97
-                        altsys_clear_templates_c() ;
96
+                        require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php';
97
+                        altsys_clear_templates_c();
98 98
                     // generate compiled file
99 99
                     /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
100 100
                     include_once XOOPS_ROOT_PATH.'/class/template.php' ;
@@ -106,20 +106,20 @@  discard block
 block discarded – undo
106 106
                     }
107 107
                 }
108 108
             }
109
-            closedir($handler) ;
109
+            closedir($handler);
110 110
         }
111
-        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
112
-        include_once XOOPS_ROOT_PATH.'/class/template.php' ;
113
-        xoops_template_clear_module_cache($mid) ;
111
+        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
112
+        include_once XOOPS_ROOT_PATH.'/class/template.php';
113
+        xoops_template_clear_module_cache($mid);
114 114
 
115
-        return true ;
115
+        return true;
116 116
     }
117 117
 
118 118
     function altsys_message_append_oninstall(&$module_obj, &$log)
119 119
     {
120 120
         if (is_array(@$GLOBALS['ret'])) {
121 121
             foreach ($GLOBALS['ret'] as $message) {
122
-                $log->add(strip_tags($message)) ;
122
+                $log->add(strip_tags($message));
123 123
             }
124 124
         }
125 125
 
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/onuninstall.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,35 +1,35 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_uninstall_'.$mydirname.'( $module ) { return altsys_onuninstall_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_onuninstall_base')) {
6
+if (!function_exists('altsys_onuninstall_base')) {
7 7
     function altsys_onuninstall_base($module, $mydirname)
8 8
     {
9 9
         // transations on module uninstall
10 10
 
11
-    global $ret ; // TODO :-D
11
+    global $ret; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15
-        $root =& XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onuninstall') ;
17
-        $ret = array() ;
15
+        $root = & XCube_Root::getSingleton();
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUninstall.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onuninstall');
17
+        $ret = array();
18 18
     } else {
19
-        if (! is_array($ret)) {
20
-            $ret = array() ;
19
+        if (!is_array($ret)) {
20
+            $ret = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
     // TABLES (loading mysql.sql)
28
-    $sql_file_path = __DIR__.'/sql/mysql.sql' ;
29
-        $prefix_mod = $db->prefix() . '_' . $mydirname ;
28
+    $sql_file_path = __DIR__.'/sql/mysql.sql';
29
+        $prefix_mod = $db->prefix().'_'.$mydirname;
30 30
         if (file_exists($sql_file_path)) {
31
-            $ret[] = 'SQL file found at <b>' . htmlspecialchars($sql_file_path) . '</b>.<br  /> Deleting tables...<br />';
32
-            $sql_lines = file($sql_file_path) ;
31
+            $ret[] = 'SQL file found at <b>'.htmlspecialchars($sql_file_path).'</b>.<br  /> Deleting tables...<br />';
32
+            $sql_lines = file($sql_file_path);
33 33
             foreach ($sql_lines as $sql_line) {
34 34
                 if (preg_match('/^CREATE TABLE \`?([a-zA-Z0-9_-]+)\`? /i', $sql_line, $regs)) {
35 35
                     $sql = 'DROP TABLE '.addslashes($prefix_mod.'_'.$regs[1]);
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
     unset($templates); */
60 60
 
61 61
 
62
-    return true ;
62
+    return true;
63 63
     }
64 64
 
65 65
     function altsys_message_append_onuninstall(&$module_obj, &$log)
66 66
     {
67 67
         if (is_array(@$GLOBALS['ret'])) {
68 68
             foreach ($GLOBALS['ret'] as $message) {
69
-                $log->add(strip_tags($message)) ;
69
+                $log->add(strip_tags($message));
70 70
             }
71 71
         }
72 72
 
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/smarty_plugins/resource.db.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -77,12 +77,12 @@
 block discarded – undo
77 77
     $type = $tplobj->getVar('tpl_type', 'n');
78 78
     $blockpath = ($type == 'block') ? 'blocks/' : '';
79 79
     // First, check for an overloaded version within the theme folder
80
-    $filepath = XOOPS_THEME_PATH . "/$theme/modules/$module/$blockpath$tpl_name";
80
+    $filepath = XOOPS_THEME_PATH."/$theme/modules/$module/$blockpath$tpl_name";
81 81
     if (!file_exists($filepath)) {
82 82
         // If no custom version exists, get the tpl from its default location
83
-        $filepath = XOOPS_ROOT_PATH . "/modules/$module/templates/$blockpath$tpl_name";
83
+        $filepath = XOOPS_ROOT_PATH."/modules/$module/templates/$blockpath$tpl_name";
84 84
         if (!file_exists($filepath)) {
85
-            return $cache[$tpl_name] = $tplobj ;
85
+            return $cache[$tpl_name] = $tplobj;
86 86
         }
87 87
     }
88 88
     return $cache[$tpl_name] = $filepath;
Please login to merge, or discard this patch.
xoops_trust_path/libs/altsys/onupdate.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,75 +1,75 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } ') ;
3
+eval(' function xoops_module_update_'.$mydirname.'( $module ) { return altsys_onupdate_base( $module , "'.$mydirname.'" ) ; } ');
4 4
 
5 5
 
6
-if (! function_exists('altsys_onupdate_base')) {
6
+if (!function_exists('altsys_onupdate_base')) {
7 7
     function altsys_onupdate_base($module, $mydirname)
8 8
     {
9 9
         // transations on module update
10 10
 
11
-    global $msgs ; // TODO :-D
11
+    global $msgs; // TODO :-D
12 12
 
13 13
     // for Cube 2.1
14 14
     if (defined('XOOPS_CUBE_LEGACY')) {
15
-        $root =& XCube_Root::getSingleton();
16
-        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.' . ucfirst($mydirname) . '.Success', 'altsys_message_append_onupdate') ;
17
-        $msgs = array() ;
15
+        $root = & XCube_Root::getSingleton();
16
+        $root->mDelegateManager->add('Legacy.Admin.Event.ModuleUpdate.'.ucfirst($mydirname).'.Success', 'altsys_message_append_onupdate');
17
+        $msgs = array();
18 18
     } else {
19
-        if (! is_array($msgs)) {
20
-            $msgs = array() ;
19
+        if (!is_array($msgs)) {
20
+            $msgs = array();
21 21
         }
22 22
     }
23 23
 
24
-        $db = XoopsDatabaseFactory::getDatabaseConnection() ;
25
-        $mid = $module->getVar('mid') ;
24
+        $db = XoopsDatabaseFactory::getDatabaseConnection();
25
+        $mid = $module->getVar('mid');
26 26
 
27 27
 
28 28
 
29 29
     // TABLES (write here ALTER TABLE etc. if necessary)
30 30
 
31 31
     // configs (Though I know it is not a recommended way...)
32
-    $check_sql = 'SHOW COLUMNS FROM ' . $db->prefix('config') . " LIKE 'conf_title'" ;
32
+    $check_sql = 'SHOW COLUMNS FROM '.$db->prefix('config')." LIKE 'conf_title'";
33 33
         if (($result = $db->query($check_sql)) && ($myrow = $db->fetchArray($result)) && @$myrow['Type'] == 'varchar(30)') {
34
-            $db->queryF('ALTER TABLE ' . $db->prefix('config') . " MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''") ;
34
+            $db->queryF('ALTER TABLE '.$db->prefix('config')." MODIFY `conf_title` varchar(255) NOT NULL default '', MODIFY `conf_desc` varchar(255) NOT NULL default ''");
35 35
         }
36 36
 
37 37
     // 0.4 -> 0.5
38
-    $check_sql = 'SELECT COUNT(*) FROM ' . $db->prefix($mydirname . '_language_constants') ;
39
-        if (! $db->query($check_sql)) {
40
-            $db->queryF('CREATE TABLE ' . $db->prefix($mydirname . '_language_constants') . " (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM") ;
38
+    $check_sql = 'SELECT COUNT(*) FROM '.$db->prefix($mydirname.'_language_constants');
39
+        if (!$db->query($check_sql)) {
40
+            $db->queryF('CREATE TABLE '.$db->prefix($mydirname.'_language_constants')." (mid smallint(5) unsigned NOT NULL default 0,language varchar(32) NOT NULL default '',name varchar(255) NOT NULL default '',value text,PRIMARY KEY (mid,language,name)) ENGINE=MyISAM");
41 41
         }
42 42
 
43 43
 
44 44
     // TEMPLATES (all templates have been already removed by modulesadmin)
45
-    $tplfile_handler = xoops_gethandler('tplfile') ;
46
-        $tpl_path = __DIR__.'/templates' ;
47
-        if ($handler = @opendir($tpl_path . '/')) {
45
+    $tplfile_handler = xoops_gethandler('tplfile');
46
+        $tpl_path = __DIR__.'/templates';
47
+        if ($handler = @opendir($tpl_path.'/')) {
48 48
             while (($file = readdir($handler)) !== false) {
49 49
                 if (substr($file, 0, 1) == '.') {
50
-                    continue ;
50
+                    continue;
51 51
                 }
52
-                $file_path = $tpl_path . '/' . $file ;
52
+                $file_path = $tpl_path.'/'.$file;
53 53
                 if (is_file($file_path)) {
54 54
                     $mtime = (int)(@filemtime($file_path));
55
-                    $tplfile =& $tplfile_handler->create() ;
56
-                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true) ;
57
-                    $tplfile->setVar('tpl_refid', $mid) ;
58
-                    $tplfile->setVar('tpl_tplset', 'default') ;
59
-                    $tplfile->setVar('tpl_file', $mydirname . '_' . $file) ;
60
-                    $tplfile->setVar('tpl_desc', '', true) ;
61
-                    $tplfile->setVar('tpl_module', $mydirname) ;
62
-                    $tplfile->setVar('tpl_lastmodified', $mtime) ;
63
-                    $tplfile->setVar('tpl_lastimported', 0) ;
64
-                    $tplfile->setVar('tpl_type', 'module') ;
65
-                    if (! $tplfile_handler->insert($tplfile)) {
55
+                    $tplfile = & $tplfile_handler->create();
56
+                    $tplfile->setVar('tpl_source', file_get_contents($file_path), true);
57
+                    $tplfile->setVar('tpl_refid', $mid);
58
+                    $tplfile->setVar('tpl_tplset', 'default');
59
+                    $tplfile->setVar('tpl_file', $mydirname.'_'.$file);
60
+                    $tplfile->setVar('tpl_desc', '', true);
61
+                    $tplfile->setVar('tpl_module', $mydirname);
62
+                    $tplfile->setVar('tpl_lastmodified', $mtime);
63
+                    $tplfile->setVar('tpl_lastimported', 0);
64
+                    $tplfile->setVar('tpl_type', 'module');
65
+                    if (!$tplfile_handler->insert($tplfile)) {
66 66
                         $msgs[] = '<span style="color:#ff0000;">ERROR: Could not insert template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> to the database.</span>';
67 67
                     } else {
68
-                        $tplid = $tplfile->getVar('tpl_id') ;
68
+                        $tplid = $tplfile->getVar('tpl_id');
69 69
                         $msgs[] = 'Template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b> added to the database. (ID: <b>'.$tplid.'</b>)';
70 70
                     // generate compiled file
71
-                    require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php' ;
72
-                        altsys_clear_templates_c() ;
71
+                    require_once XOOPS_TRUST_PATH.'/libs/altsys/include/altsys_functions.php';
72
+                        altsys_clear_templates_c();
73 73
                     /*include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
74 74
                     if( ! xoops_template_touch( $tplid ) ) {
75 75
                         $msgs[] = '<span style="color:#ff0000;">ERROR: Failed compiling template <b>'.htmlspecialchars($mydirname.'_'.$file).'</b>.</span>';
@@ -79,20 +79,20 @@  discard block
 block discarded – undo
79 79
                     }
80 80
                 }
81 81
             }
82
-            closedir($handler) ;
82
+            closedir($handler);
83 83
         }
84
-        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php' ;
85
-        include_once XOOPS_ROOT_PATH.'/class/template.php' ;
86
-        xoops_template_clear_module_cache($mid) ;
84
+        include_once XOOPS_ROOT_PATH.'/class/xoopsblock.php';
85
+        include_once XOOPS_ROOT_PATH.'/class/template.php';
86
+        xoops_template_clear_module_cache($mid);
87 87
 
88
-        return true ;
88
+        return true;
89 89
     }
90 90
 
91 91
     function altsys_message_append_onupdate(&$module_obj, &$log)
92 92
     {
93 93
         if (is_array(@$GLOBALS['msgs'])) {
94 94
             foreach ($GLOBALS['msgs'] as $message) {
95
-                $log->add(strip_tags($message)) ;
95
+                $log->add(strip_tags($message));
96 96
             }
97 97
         }
98 98
 
Please login to merge, or discard this patch.