Completed
Push — master ( 10bab4...a0a78b )
by Michael
02:06
created
action.blog.php 2 patches
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 $blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
38 38
 
39 39
 if (empty($helper->getConfig('newblog_submit')) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) {
40
-    redirect_header('index.php', 2, _NOPERM);
40
+	redirect_header('index.php', 2, _NOPERM);
41 41
 }
42 42
 
43 43
 if ('save' === $op && !empty(Request::getString('fetch', '', 'POST'))) {//!empty($_POST['fetch'])) {
44
-    $op = 'edit';
44
+	$op = 'edit';
45 45
 }
46 46
 
47 47
 if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) {
48
-    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
48
+	redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
49 49
 }
50 50
 include XOOPS_ROOT_PATH . '/header.php';
51 51
 include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
@@ -54,110 +54,110 @@  discard block
 block discarded – undo
54 54
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
55 55
 
56 56
 switch ($op) {
57
-    /* save a single blog */
58
-    case 'save':
59
-
60
-        if ($blog_id) {
61
-            $blog_obj = $blogHandler->get($blog_id);
62
-            if ($xoopsUser->isAdmin()) {
63
-                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
64
-            }
65
-        } else {
66
-            if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
67
-            ) {
68
-                redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
69
-            }
70
-
71
-            $blog_obj = $blogHandler->create();
72
-            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
73
-
74
-            switch ($helper->getConfig('newblog_submit')) {
75
-                case 2:
76
-                    if (!is_object($xoopsUser)) {
77
-                        $status = 0;
78
-                    } else {
79
-                        $status = 1;
80
-                    }
81
-                    break;
82
-                case 0:
83
-                case 3:
84
-                    $status = 1;
85
-                    break;
86
-                case 1:
87
-                default:
88
-                    if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
89
-                        $status = 0;
90
-                    } else {
91
-                        $status = 1;
92
-                    }
93
-                    break;
94
-            }
95
-
96
-            $blog_obj->setVar('blog_status', $status);
97
-        }
98
-
99
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
100
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
101
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
102
-        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
103
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
104
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
105
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
106
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
107
-        if ($blog_obj->isNew()) {
108
-            $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
109
-        }
110
-
111
-        if (!$blogHandler->insert($blog_obj)) {
112
-        } elseif (0 !== count(Request::getArray('categories', [], 'POST'))) {
113
-            $blog_id = $blog_obj->getVar('blog_id');
114
-            if (in_array(0, $_POST['categories'])) {
115
-                $_POST['categories'] = [];
116
-            }
117
-            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
118
-        }
119
-        $message = planet_constant('MD_DBUPDATED');
120
-        redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
121
-
122
-    /* edit a single blog */
123
-    // no break
124
-    case 'edit':
125
-    default:
126
-        if (!empty(Request::getString('fetch', '', 'POST'))) {
127
-            $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
128
-            $blog_obj->setVar('blog_id', $blog_id);
129
-        } else {
130
-            $blog_obj = $blogHandler->get($blog_id);
131
-        }
132
-        $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
133
-        if (in_array('-1', $categories)) {
134
-            $categories = [];
135
-        }
136
-        if (empty($categories) && $blog_id > 0) {
137
-            $crit       = new \Criteria('bc.blog_id', $blog_id);
138
-            $categories = array_keys($categoryHandler->getByBlog($crit));
139
-        }
140
-        if (empty($categories)) {
141
-            $categories = [0 => _NONE];
142
-        }
143
-
144
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
145
-        echo '<br>';
146
-        if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
147
-            $criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
148
-            $blogs_obj = $blogHandler->getList($criteria);
149
-            if (count($blogs_obj) > 0) {
150
-                echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS');
151
-                foreach (array_keys($blogs_obj) as $bid) {
152
-                    echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
153
-                }
154
-                echo '</div>';
155
-                unset($blogs_obj, $criteria);
156
-            }
157
-        }
158
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
159
-        echo '</fieldset>';
160
-        break;
57
+	/* save a single blog */
58
+	case 'save':
59
+
60
+		if ($blog_id) {
61
+			$blog_obj = $blogHandler->get($blog_id);
62
+			if ($xoopsUser->isAdmin()) {
63
+				$blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
64
+			}
65
+		} else {
66
+			if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
67
+			) {
68
+				redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
69
+			}
70
+
71
+			$blog_obj = $blogHandler->create();
72
+			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
73
+
74
+			switch ($helper->getConfig('newblog_submit')) {
75
+				case 2:
76
+					if (!is_object($xoopsUser)) {
77
+						$status = 0;
78
+					} else {
79
+						$status = 1;
80
+					}
81
+					break;
82
+				case 0:
83
+				case 3:
84
+					$status = 1;
85
+					break;
86
+				case 1:
87
+				default:
88
+					if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
89
+						$status = 0;
90
+					} else {
91
+						$status = 1;
92
+					}
93
+					break;
94
+			}
95
+
96
+			$blog_obj->setVar('blog_status', $status);
97
+		}
98
+
99
+		$blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
100
+		$blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
101
+		$blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
102
+		$blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
103
+		$blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
104
+		$blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
105
+		$blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
106
+		$blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
107
+		if ($blog_obj->isNew()) {
108
+			$blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
109
+		}
110
+
111
+		if (!$blogHandler->insert($blog_obj)) {
112
+		} elseif (0 !== count(Request::getArray('categories', [], 'POST'))) {
113
+			$blog_id = $blog_obj->getVar('blog_id');
114
+			if (in_array(0, $_POST['categories'])) {
115
+				$_POST['categories'] = [];
116
+			}
117
+			$blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
118
+		}
119
+		$message = planet_constant('MD_DBUPDATED');
120
+		redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
121
+
122
+	/* edit a single blog */
123
+	// no break
124
+	case 'edit':
125
+	default:
126
+		if (!empty(Request::getString('fetch', '', 'POST'))) {
127
+			$blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
128
+			$blog_obj->setVar('blog_id', $blog_id);
129
+		} else {
130
+			$blog_obj = $blogHandler->get($blog_id);
131
+		}
132
+		$categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
133
+		if (in_array('-1', $categories)) {
134
+			$categories = [];
135
+		}
136
+		if (empty($categories) && $blog_id > 0) {
137
+			$crit       = new \Criteria('bc.blog_id', $blog_id);
138
+			$categories = array_keys($categoryHandler->getByBlog($crit));
139
+		}
140
+		if (empty($categories)) {
141
+			$categories = [0 => _NONE];
142
+		}
143
+
144
+		echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
145
+		echo '<br>';
146
+		if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
147
+			$criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
148
+			$blogs_obj = $blogHandler->getList($criteria);
149
+			if (count($blogs_obj) > 0) {
150
+				echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS');
151
+				foreach (array_keys($blogs_obj) as $bid) {
152
+					echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
153
+				}
154
+				echo '</div>';
155
+				unset($blogs_obj, $criteria);
156
+			}
157
+		}
158
+		include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
159
+		echo '</fieldset>';
160
+		break;
161 161
 }
162 162
 
163 163
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 use Xmf\Request;
28 28
 use XoopsModules\Planet;
29 29
 
30
-include __DIR__ . '/header.php';
30
+include __DIR__.'/header.php';
31 31
 
32 32
 /** @var Planet\Helper $helper */
33 33
 $helper = Planet\Helper::getInstance();
34 34
 
35
-$op      = Request::getString('op', Request::getString('op', '', 'POST'), 'GET');//!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
36
-$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET');//!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
37
-$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int)$blog_id;
35
+$op      = Request::getString('op', Request::getString('op', '', 'POST'), 'GET'); //!empty($_POST['op']) ? $_POST['op'] : (!empty($_GET['op']) ? $_GET['op'] : '');
36
+$blog_id = Request::getArray('blog', Request::getArray('blog', [], 'POST'), 'GET'); //!empty($_POST['blog']) ? $_POST['blog'] : (!empty($_GET['blog']) ? $_GET['blog'] : 0);
37
+$blog_id = is_array($blog_id) ? array_map('intval', $blog_id) : (int) $blog_id;
38 38
 
39 39
 if (empty($helper->getConfig('newblog_submit')) && (!is_object($xoopsUser) || !$xoopsUser->isAdmin())) {
40 40
     redirect_header('index.php', 2, _NOPERM);
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 if ('save' === $op && !$GLOBALS['xoopsSecurity']->check()) {
48
-    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID') . ': security check failed');
48
+    redirect_header('javascript:history.go(-1);', 1, planet_constant('MD_INVALID').': security check failed');
49 49
 }
50
-include XOOPS_ROOT_PATH . '/header.php';
51
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
50
+include XOOPS_ROOT_PATH.'/header.php';
51
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
52 52
 
53 53
 $blogHandler     = xoops_getModuleHandler('blog', $GLOBALS['moddirname']);
54 54
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         if ($blog_id) {
61 61
             $blog_obj = $blogHandler->get($blog_id);
62 62
             if ($xoopsUser->isAdmin()) {
63
-                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST'));// @$_POST['blog_status']);
63
+                $blog_obj->setVar('blog_status', Request::getInt('blog_status', 0, 'POST')); // @$_POST['blog_status']);
64 64
             }
65
-        } else {
65
+        }else {
66 66
             if ($blog_exists = $blogHandler->getCount(new \Criteria('blog_feed', $myts->addSlashes(trim(Request::getText('blog_feed', '', 'POST')))))  //$_POST['blog_feed']))))
67 67
             ) {
68 68
                 redirect_header('index.php', 2, planet_constant('MD_BLOGEXISTS'));
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 case 2:
76 76
                     if (!is_object($xoopsUser)) {
77 77
                         $status = 0;
78
-                    } else {
78
+                    }else {
79 79
                         $status = 1;
80 80
                     }
81 81
                     break;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
                 default:
88 88
                     if (!is_object($xoopsUser) || !$xoopsUser->isAdmin()) {
89 89
                         $status = 0;
90
-                    } else {
90
+                    }else {
91 91
                         $status = 1;
92 92
                     }
93 93
                     break;
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
             $blog_obj->setVar('blog_status', $status);
97 97
         }
98 98
 
99
-        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST'));//$_POST['blog_title']);
100
-        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST'));//$_POST['blog_desc']);
101
-        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST'));//$_POST['blog_image']);
102
-        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST'));//$_POST['blog_feed']);
103
-        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST'));//$_POST['blog_link']);
104
-        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST'));//$_POST['blog_language']);
105
-        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST'));//$_POST['blog_charset']);
106
-        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST'));//$_POST['blog_trackback']);
99
+        $blog_obj->setVar('blog_title', Request::getString('blog_title', '', 'POST')); //$_POST['blog_title']);
100
+        $blog_obj->setVar('blog_desc', Request::getString('blog_desc', '', 'POST')); //$_POST['blog_desc']);
101
+        $blog_obj->setVar('blog_image', Request::getString('blog_image', '', 'POST')); //$_POST['blog_image']);
102
+        $blog_obj->setVar('blog_feed', Request::getText('blog_feed', '', 'POST')); //$_POST['blog_feed']);
103
+        $blog_obj->setVar('blog_link', Request::getString('blog_link', '', 'POST')); //$_POST['blog_link']);
104
+        $blog_obj->setVar('blog_language', Request::getString('blog_language', '', 'POST')); //$_POST['blog_language']);
105
+        $blog_obj->setVar('blog_charset', Request::getString('blog_charset', '', 'POST')); //$_POST['blog_charset']);
106
+        $blog_obj->setVar('blog_trackback', Request::getString('blog_trackback', '', 'POST')); //$_POST['blog_trackback']);
107 107
         if ($blog_obj->isNew()) {
108 108
             $blog_obj->setVar('blog_submitter', is_object($xoopsUser) ? $xoopsUser->getVar('uid') : PlanetUtility::planetGetIP(true));
109 109
         }
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
             if (in_array(0, $_POST['categories'])) {
115 115
                 $_POST['categories'] = [];
116 116
             }
117
-            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST'));//$_POST['categories']);
117
+            $blogHandler->setCategories($blog_id, Request::getString('andor', '', 'POST')); //$_POST['categories']);
118 118
         }
119 119
         $message = planet_constant('MD_DBUPDATED');
120
-        redirect_header('index.php' . URL_DELIMITER . 'b' . $blog_id, 2, $message);
120
+        redirect_header('index.php'.URL_DELIMITER.'b'.$blog_id, 2, $message);
121 121
 
122 122
     /* edit a single blog */
123 123
     // no break
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
         if (!empty(Request::getString('fetch', '', 'POST'))) {
127 127
             $blog_obj = $blogHandler->fetch(Request::getText('blog_feed', '', 'POST'));
128 128
             $blog_obj->setVar('blog_id', $blog_id);
129
-        } else {
129
+        }else {
130 130
             $blog_obj = $blogHandler->get($blog_id);
131 131
         }
132
-        $categories = Request::getArray('categories', [], 'POST');//isset($_POST['categories']) ? $_POST['categories'] : array();
132
+        $categories = Request::getArray('categories', [], 'POST'); //isset($_POST['categories']) ? $_POST['categories'] : array();
133 133
         if (in_array('-1', $categories)) {
134 134
             $categories = [];
135 135
         }
136
-        if (empty($categories) && $blog_id > 0) {
136
+        if (empty($categories) && $blog_id>0) {
137 137
             $crit       = new \Criteria('bc.blog_id', $blog_id);
138 138
             $categories = array_keys($categoryHandler->getByBlog($crit));
139 139
         }
@@ -141,23 +141,23 @@  discard block
 block discarded – undo
141 141
             $categories = [0 => _NONE];
142 142
         }
143 143
 
144
-        echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _EDIT . '</legend>';
144
+        echo "<fieldset><legend style='font-weight: bold; color: #900;'>"._EDIT.'</legend>';
145 145
         echo '<br>';
146 146
         if (empty($blog_id) && $blog_obj->getVar('blog_feed')) {
147 147
             $criteria  = new \Criteria('blog_feed', $blog_obj->getVar('blog_feed'));
148 148
             $blogs_obj = $blogHandler->getList($criteria);
149
-            if (count($blogs_obj) > 0) {
150
-                echo '<div class="errorMsg">' . planet_constant('MD_BLOGEXISTS');
149
+            if (count($blogs_obj)>0) {
150
+                echo '<div class="errorMsg">'.planet_constant('MD_BLOGEXISTS');
151 151
                 foreach (array_keys($blogs_obj) as $bid) {
152
-                    echo '<br><a href="' . XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $bid . '" target="_blank">' . $blogs_obj[$bid] . '</a>';
152
+                    echo '<br><a href="'.XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$bid.'" target="_blank">'.$blogs_obj[$bid].'</a>';
153 153
                 }
154 154
                 echo '</div>';
155 155
                 unset($blogs_obj, $criteria);
156 156
             }
157 157
         }
158
-        include XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/form.blog.php';
158
+        include XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/form.blog.php';
159 159
         echo '</fieldset>';
160 160
         break;
161 161
 }
162 162
 
163
-include XOOPS_ROOT_PATH . '/footer.php';
163
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
xml.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 include __DIR__ . '/header.php';
34 34
 
35 35
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
36
-    $args['article'] = @$args_num[0];
37
-    $args['type']    = @$args_str[0];
36
+	$args['article'] = @$args_num[0];
37
+	$args['type']    = @$args_str[0];
38 38
 }
39 39
 
40 40
 /* Specified Article */
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 
52 52
 $valid_format = ['RSS0.91', 'RSS1.0', 'RSS2.0', 'PIE0.1', 'MBOX', 'OPML', 'ATOM', 'ATOM0.3', 'HTML', 'JS'];
53 53
 if ('RDF' === $type) {
54
-    $type = 'RSS1.0';
54
+	$type = 'RSS1.0';
55 55
 }
56 56
 if ('RSS' === $type) {
57
-    $type = 'RSS0.91';
57
+	$type = 'RSS0.91';
58 58
 }
59 59
 if (empty($type) || !in_array($type, $valid_format)) {
60
-    PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
61
-    exit();
60
+	PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
61
+	exit();
62 62
 }
63 63
 
64 64
 $categoryHandler = xoops_getModuleHandler('category', $GLOBALS['moddirname']);
@@ -67,30 +67,30 @@  discard block
 block discarded – undo
67 67
 $bookmarkHandler = xoops_getModuleHandler('bookmark', $GLOBALS['moddirname']);
68 68
 
69 69
 if (!empty($article_id)) {
70
-    $article_obj = $articleHandler->get($article_id);
71
-    if (!$article_obj->getVar('art_id')) {
72
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
73
-        exit();
74
-    }
75
-    $source = 'article';
70
+	$article_obj = $articleHandler->get($article_id);
71
+	if (!$article_obj->getVar('art_id')) {
72
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_EXPIRED'));
73
+		exit();
74
+	}
75
+	$source = 'article';
76 76
 } elseif (!empty($blog_id)) {
77
-    $blog_obj = $blogHandler->get($blog_id);
78
-    if (!$blog_obj->getVar('blog_id')) {
79
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
80
-        exit();
81
-    }
82
-    $source = 'blog';
77
+	$blog_obj = $blogHandler->get($blog_id);
78
+	if (!$blog_obj->getVar('blog_id')) {
79
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
80
+		exit();
81
+	}
82
+	$source = 'blog';
83 83
 } elseif (!empty($category_id)) {
84
-    $source       = 'category';
85
-    $category_obj = $categoryHandler->get($category_id);
86
-    if (!$category_obj->getVar('cat_id')) {
87
-        PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
88
-        exit();
89
-    }
84
+	$source       = 'category';
85
+	$category_obj = $categoryHandler->get($category_id);
86
+	if (!$category_obj->getVar('cat_id')) {
87
+		PlanetUtility::planetRespondToTrackback(1, planet_constant('MD_INVALID'));
88
+		exit();
89
+	}
90 90
 } elseif (!empty($uid)) {
91
-    $source = 'bookmark';
91
+	$source = 'bookmark';
92 92
 } else {
93
-    $source = '';
93
+	$source = '';
94 94
 }
95 95
 
96 96
 $xml_charset = 'UTF-8';
@@ -100,102 +100,102 @@  discard block
 block discarded – undo
100 100
 $tpl->xoops_setCacheTime(3600);
101 101
 $xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type);
102 102
 if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) {
103
-    $criteria = new \CriteriaCompo();
104
-    $criteria->setLimit($helper->getConfig('articles_perpage'));
105
-    $articles_obj = [];
106
-    switch ($source) {
107
-        case 'article':
108
-            $pagetitle = planet_constant('MD_ARTICLE');
109
-            $rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
110
-
111
-            $articles_obj[$article_id] = $article_obj;
112
-
113
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
114
-            break;
115
-
116
-        case 'category':
117
-            $pagetitle = planet_constant('MD_CATEGORY');
118
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
119
-
120
-            $criteria->add(new \Criteria('bc.cat_id', $category_id));
121
-            $articles_obj = $articleHandler->getByCategory($criteria);
122
-
123
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
124
-            break;
125
-
126
-        case 'blog':
127
-            $pagetitle = planet_constant('MD_BLOG');
128
-            $rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
129
-
130
-            $criteria->add(new \Criteria('blog_id', $blog_id));
131
-            $articles_obj = $articleHandler->getAll($criteria);
132
-
133
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
134
-            break;
135
-
136
-        case 'bookmark':
137
-            $author_name = XoopsUser::getUnameFromId($uid);
138
-            $pagetitle   = planet_constant('MD_BOOKMARKS');
139
-            $rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
140
-
141
-            $criteria->add(new \Criteria('bm.bm_uid', $uid));
142
-            $articles_obj = $articleHandler->getByBookmark($criteria);
143
-
144
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
145
-
146
-            break;
147
-
148
-        default:
149
-            $pagetitle = planet_constant('MD_INDEX');
150
-            $rssdesc   = planet_constant('MD_XMLDESC_INDEX');
151
-
152
-            $articles_obj = $articleHandler->getAll($criteria);
153
-
154
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
155
-            break;
156
-    }
157
-    $items = [];
158
-    foreach (array_keys($articles_obj) as $id) {
159
-        $content = $articles_obj[$id]->getVar('art_content');
160
-        $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
161
-        $items[] = [
162
-            'title'                     => $articles_obj[$id]->getVar('art_title'),
163
-            'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
164
-            'description'               => $content,
165
-            'descriptionHtmlSyndicated' => true,
166
-            'date'                      => $articles_obj[$id]->getTime('rss'),
167
-            'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
168
-            'author'                    => $articles_obj[$id]->getVar('art_author')
169
-        ];
170
-    }
171
-    unset($articles_obj, $criteria);
172
-
173
-    $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
174
-    $xml        = $xmlHandler->create($type);
175
-    $xml->setVar('encoding', $xml_charset);
176
-    $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
177
-    $xml->setVar('description', $rssdesc, true);
178
-    $xml->setVar('descriptionHtmlSyndicated', true);
179
-    $xml->setVar('link', $xml_link);
180
-    $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
181
-    $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
182
-    $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
183
-    $xml->setVar('category', $xoopsModule->getVar('name'), true);
184
-    $xml->setVar('generator', $xoopsModule->getInfo('version'));
185
-    $xml->setVar('language', _LANGCODE);
186
-
187
-    $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
188
-    $image     = [
189
-        'width'       => $dimention[0],
190
-        'height'      => $dimention[1],
191
-        'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
192
-        'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
193
-        'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
194
-        'description' => $rssdesc
195
-    ];
196
-    $xml->setImage($image);
197
-
198
-    /*
103
+	$criteria = new \CriteriaCompo();
104
+	$criteria->setLimit($helper->getConfig('articles_perpage'));
105
+	$articles_obj = [];
106
+	switch ($source) {
107
+		case 'article':
108
+			$pagetitle = planet_constant('MD_ARTICLE');
109
+			$rssdesc   = planet_constant('MD_XMLDESC_ARTICLE');
110
+
111
+			$articles_obj[$article_id] = $article_obj;
112
+
113
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
114
+			break;
115
+
116
+		case 'category':
117
+			$pagetitle = planet_constant('MD_CATEGORY');
118
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_CATEGORY'), $category_obj->getVar('cat_title'));
119
+
120
+			$criteria->add(new \Criteria('bc.cat_id', $category_id));
121
+			$articles_obj = $articleHandler->getByCategory($criteria);
122
+
123
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
124
+			break;
125
+
126
+		case 'blog':
127
+			$pagetitle = planet_constant('MD_BLOG');
128
+			$rssdesc   = sprintf(planet_constant('MD_XMLDESC_BLOG'), $blog_obj->getVar('blog_title'));
129
+
130
+			$criteria->add(new \Criteria('blog_id', $blog_id));
131
+			$articles_obj = $articleHandler->getAll($criteria);
132
+
133
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
134
+			break;
135
+
136
+		case 'bookmark':
137
+			$author_name = XoopsUser::getUnameFromId($uid);
138
+			$pagetitle   = planet_constant('MD_BOOKMARKS');
139
+			$rssdesc     = sprintf(planet_constant('MD_XMLDESC_BOOKMARK'), $author_name);
140
+
141
+			$criteria->add(new \Criteria('bm.bm_uid', $uid));
142
+			$articles_obj = $articleHandler->getByBookmark($criteria);
143
+
144
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
145
+
146
+			break;
147
+
148
+		default:
149
+			$pagetitle = planet_constant('MD_INDEX');
150
+			$rssdesc   = planet_constant('MD_XMLDESC_INDEX');
151
+
152
+			$articles_obj = $articleHandler->getAll($criteria);
153
+
154
+			$xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
155
+			break;
156
+	}
157
+	$items = [];
158
+	foreach (array_keys($articles_obj) as $id) {
159
+		$content = $articles_obj[$id]->getVar('art_content');
160
+		$content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
161
+		$items[] = [
162
+			'title'                     => $articles_obj[$id]->getVar('art_title'),
163
+			'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
164
+			'description'               => $content,
165
+			'descriptionHtmlSyndicated' => true,
166
+			'date'                      => $articles_obj[$id]->getTime('rss'),
167
+			'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
168
+			'author'                    => $articles_obj[$id]->getVar('art_author')
169
+		];
170
+	}
171
+	unset($articles_obj, $criteria);
172
+
173
+	$xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
174
+	$xml        = $xmlHandler->create($type);
175
+	$xml->setVar('encoding', $xml_charset);
176
+	$xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
177
+	$xml->setVar('description', $rssdesc, true);
178
+	$xml->setVar('descriptionHtmlSyndicated', true);
179
+	$xml->setVar('link', $xml_link);
180
+	$xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
181
+	$xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
182
+	$xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
183
+	$xml->setVar('category', $xoopsModule->getVar('name'), true);
184
+	$xml->setVar('generator', $xoopsModule->getInfo('version'));
185
+	$xml->setVar('language', _LANGCODE);
186
+
187
+	$dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
188
+	$image     = [
189
+		'width'       => $dimention[0],
190
+		'height'      => $dimention[1],
191
+		'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
192
+		'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
193
+		'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
194
+		'description' => $rssdesc
195
+	];
196
+	$xml->setImage($image);
197
+
198
+	/*
199 199
     $item = array(
200 200
         "title" => $datatitle,
201 201
         "link" => $dataurl,
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
         "author" => $dataauthor
207 207
         );
208 208
     */
209
-    $xml->addItems($items);
209
+	$xml->addItems($items);
210 210
 
211
-    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
211
+	$dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
212 212
 
213
-    $tpl->assign_by_ref('dummy_content', $dummy_content);
213
+	$tpl->assign_by_ref('dummy_content', $dummy_content);
214 214
 }
215 215
 //$content = ob_get_contents();
216 216
 ob_end_clean();
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32 32
 ob_start();
33
-include __DIR__ . '/header.php';
33
+include __DIR__.'/header.php';
34 34
 
35 35
 if (PlanetUtility::planetParseArguments($args_num, $args, $args_str)) {
36 36
     $args['article'] = @$args_num[0];
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
     }
90 90
 } elseif (!empty($uid)) {
91 91
     $source = 'bookmark';
92
-} else {
92
+}else {
93 93
     $source = '';
94 94
 }
95 95
 
96 96
 $xml_charset = 'UTF-8';
97
-require_once XOOPS_ROOT_PATH . '/class/template.php';
97
+require_once XOOPS_ROOT_PATH.'/class/template.php';
98 98
 $tpl = new \XoopsTpl();
99
-$tpl->caching=(2);
99
+$tpl->caching = (2);
100 100
 $tpl->xoops_setCacheTime(3600);
101
-$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid') . ',' . $article_id . ',' . $category_id . ',' . $blog_id . ',' . $uid . ',' . $type);
101
+$xoopsCachedTemplateId = md5($xoopsModule->getVar('mid').','.$article_id.','.$category_id.','.$blog_id.','.$uid.','.$type);
102 102
 if (!$tpl->is_cached('db:system_dummy.tpl', $xoopsCachedTemplateId)) {
103 103
     $criteria = new \CriteriaCompo();
104 104
     $criteria->setLimit($helper->getConfig('articles_perpage'));
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
             $articles_obj[$article_id] = $article_obj;
112 112
 
113
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $article_obj->getVar('art_id');
113
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$article_obj->getVar('art_id');
114 114
             break;
115 115
 
116 116
         case 'category':
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
             $criteria->add(new \Criteria('bc.cat_id', $category_id));
121 121
             $articles_obj = $articleHandler->getByCategory($criteria);
122 122
 
123
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'c' . $category_id;
123
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'c'.$category_id;
124 124
             break;
125 125
 
126 126
         case 'blog':
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
             $criteria->add(new \Criteria('blog_id', $blog_id));
131 131
             $articles_obj = $articleHandler->getAll($criteria);
132 132
 
133
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'b' . $blog_id;
133
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'b'.$blog_id;
134 134
             break;
135 135
 
136 136
         case 'bookmark':
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             $criteria->add(new \Criteria('bm.bm_uid', $uid));
142 142
             $articles_obj = $articleHandler->getByBookmark($criteria);
143 143
 
144
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php' . URL_DELIMITER . 'u' . $uid;
144
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php'.URL_DELIMITER.'u'.$uid;
145 145
 
146 146
             break;
147 147
 
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 
152 152
             $articles_obj = $articleHandler->getAll($criteria);
153 153
 
154
-            $xml_link = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php';
154
+            $xml_link = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php';
155 155
             break;
156 156
     }
157 157
     $items = [];
158 158
     foreach (array_keys($articles_obj) as $id) {
159 159
         $content = $articles_obj[$id]->getVar('art_content');
160
-        $content .= '<br>' . planet_constant('MD_SOURCE') . ': ' . $articles_obj[$id]->getVar('art_link') . ' ' . $articles_obj[$id]->getVar('art_author');
160
+        $content .= '<br>'.planet_constant('MD_SOURCE').': '.$articles_obj[$id]->getVar('art_link').' '.$articles_obj[$id]->getVar('art_author');
161 161
         $items[] = [
162 162
             'title'                     => $articles_obj[$id]->getVar('art_title'),
163
-            'link'                      => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/view.article.php' . URL_DELIMITER . '' . $articles_obj[$id]->getVar('art_id'),
163
+            'link'                      => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/view.article.php'.URL_DELIMITER.''.$articles_obj[$id]->getVar('art_id'),
164 164
             'description'               => $content,
165 165
             'descriptionHtmlSyndicated' => true,
166 166
             'date'                      => $articles_obj[$id]->getTime('rss'),
167
-            'source'                    => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
167
+            'source'                    => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/',
168 168
             'author'                    => $articles_obj[$id]->getVar('art_author')
169 169
         ];
170 170
     }
@@ -173,24 +173,24 @@  discard block
 block discarded – undo
173 173
     $xmlHandler = xoops_getModuleHandler('xml', $GLOBALS['moddirname']);
174 174
     $xml        = $xmlHandler->create($type);
175 175
     $xml->setVar('encoding', $xml_charset);
176
-    $xml->setVar('title', $xoopsConfig['sitename'] . ' :: ' . $pagetitle, 'UTF-8', $xml_charset, true);
176
+    $xml->setVar('title', $xoopsConfig['sitename'].' :: '.$pagetitle, 'UTF-8', $xml_charset, true);
177 177
     $xml->setVar('description', $rssdesc, true);
178 178
     $xml->setVar('descriptionHtmlSyndicated', true);
179 179
     $xml->setVar('link', $xml_link);
180
-    $xml->setVar('syndicationURL', XOOPS_URL . '/' . xoops_getenv('PHP_SELF'), 'post', true);
180
+    $xml->setVar('syndicationURL', XOOPS_URL.'/'.xoops_getenv('PHP_SELF'), 'post', true);
181 181
     $xml->setVar('webmaster', checkEmail($xoopsConfig['adminmail'], true));
182 182
     $xml->setVar('editor', checkEmail($xoopsConfig['adminmail'], true));
183 183
     $xml->setVar('category', $xoopsModule->getVar('name'), true);
184 184
     $xml->setVar('generator', $xoopsModule->getInfo('version'));
185 185
     $xml->setVar('language', _LANGCODE);
186 186
 
187
-    $dimention = @getimagesize(XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'));
187
+    $dimention = @getimagesize(XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image'));
188 188
     $image     = [
189 189
         'width'       => $dimention[0],
190 190
         'height'      => $dimention[1],
191
-        'title'       => $xoopsConfig['sitename'] . ' :: ' . $pagetitle,
192
-        'url'         => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/' . $xoopsModule->getInfo('image'),
193
-        'link'        => XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/',
191
+        'title'       => $xoopsConfig['sitename'].' :: '.$pagetitle,
192
+        'url'         => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/'.$xoopsModule->getInfo('image'),
193
+        'link'        => XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/',
194 194
         'description' => $rssdesc
195 195
     ];
196 196
     $xml->setImage($image);
@@ -208,11 +208,11 @@  discard block
 block discarded – undo
208 208
     */
209 209
     $xml->addItems($items);
210 210
 
211
-    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH . '/' . $GLOBALS['moddirname'] . '.xml.tmp');
211
+    $dummy_content = $xmlHandler->display($xml, XOOPS_CACHE_PATH.'/'.$GLOBALS['moddirname'].'.xml.tmp');
212 212
 
213 213
     $tpl->assign_by_ref('dummy_content', $dummy_content);
214 214
 }
215 215
 //$content = ob_get_contents();
216 216
 ob_end_clean();
217
-header('Content-Type:text/xml; charset=' . $xml_charset);
217
+header('Content-Type:text/xml; charset='.$xml_charset);
218 218
 $tpl->display('db:system_dummy.tpl', $xoopsCachedTemplateId);
Please login to merge, or discard this patch.
search.php 2 patches
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 $configHandler     = xoops_getHandler('config');
36 36
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
37 37
 if (empty($xoopsConfigSearch['enable_search'])) {
38
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
38
+	redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
39 39
 }
40 40
 
41 41
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
@@ -53,93 +53,93 @@  discard block
 block discarded – undo
53 53
 $blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
54 54
 $uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
55 55
 $searchin = Request::getArray(
56
-    'searchin',
57
-    0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
58
-                              'POST'
56
+	'searchin',
57
+	0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
58
+							  'POST'
59 59
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
60 60
 $sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
61 61
 $term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
62 62
 
63 63
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
64 64
 $sortby = in_array(strtolower($sortby), [
65
-    'a.art_id desc',
66
-    'a.art_time desc',
67
-    'a.art_title',
68
-    'a.blog_id',
69
-    'b.blog_id',
70
-    'b.blog_feed',
71
-    'b.blog_title',
72
-    'b.blog_time'
65
+	'a.art_id desc',
66
+	'a.art_time desc',
67
+	'a.art_title',
68
+	'a.blog_id',
69
+	'b.blog_id',
70
+	'b.blog_feed',
71
+	'b.blog_title',
72
+	'b.blog_time'
73 73
 ]) ? strtolower($sortby) : '';
74 74
 
75 75
 if (!(empty(Request::getString('submit', '', 'POST')) && empty(Request::getString('term', '', 'GET')))) {
76
-    $next_search['category'] = $category;
77
-    $next_search['blog']     = $blog;
78
-    $next_search['uid']      = $uid;
79
-    $next_search['andor']    = $andor;
76
+	$next_search['category'] = $category;
77
+	$next_search['blog']     = $blog;
78
+	$next_search['uid']      = $uid;
79
+	$next_search['andor']    = $andor;
80 80
 
81
-    $next_search['term'] = $term;
82
-    $query               = trim($term);
81
+	$next_search['term'] = $term;
82
+	$query               = trim($term);
83 83
 
84
-    if ('EXACT' !== $andor) {
85
-        $ignored_queries = []; // holds kewords that are shorter than allowed minmum length
86
-        $temp_queries    = preg_split("/[\s,]+/", $query);
87
-        foreach ($temp_queries as $q) {
88
-            $q = trim($q);
89
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
90
-                $queries[] = $myts->addSlashes($q);
91
-            } else {
92
-                $ignored_queries[] = $myts->addSlashes($q);
93
-            }
94
-        }
95
-        if (0 == count($queries)) {
96
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
97
-        }
98
-    } else {
99
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
100
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
101
-        }
102
-        $queries = [$myts->addSlashes($query)];
103
-    }
84
+	if ('EXACT' !== $andor) {
85
+		$ignored_queries = []; // holds kewords that are shorter than allowed minmum length
86
+		$temp_queries    = preg_split("/[\s,]+/", $query);
87
+		foreach ($temp_queries as $q) {
88
+			$q = trim($q);
89
+			if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
90
+				$queries[] = $myts->addSlashes($q);
91
+			} else {
92
+				$ignored_queries[] = $myts->addSlashes($q);
93
+			}
94
+		}
95
+		if (0 == count($queries)) {
96
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
97
+		}
98
+	} else {
99
+		if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
100
+			redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
101
+		}
102
+		$queries = [$myts->addSlashes($query)];
103
+	}
104 104
 
105
-    $next_search['sortby']   = $sortby;
106
-    $next_search['searchin'] = implode('|', $searchin);
105
+	$next_search['sortby']   = $sortby;
106
+	$next_search['searchin'] = implode('|', $searchin);
107 107
 
108
-    /* To be added: year-month
108
+	/* To be added: year-month
109 109
      * see view.archive.php
110 110
      */
111
-    if (!empty($time)) {
112
-        $extra = '';
113
-    } else {
114
-        $extra = '';
115
-    }
111
+	if (!empty($time)) {
112
+		$extra = '';
113
+	} else {
114
+		$extra = '';
115
+	}
116 116
 
117
-    $results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
117
+	$results = planet_search($queries, $andor, $limit, $start, $uid, $category, $blog, $sortby, $searchin, $extra);
118 118
 
119
-    /*
119
+	/*
120 120
     if ( count($results) < 1 ) {
121 121
         redirect_header("javascript:history.go(-1);", 2, _SR_NOMATCH);
122 122
     } else
123 123
     */
124
-    {
125
-        $xoopsTpl->assign('results', $results);
124
+	{
125
+		$xoopsTpl->assign('results', $results);
126 126
 
127
-        if (count($next_search) > 0) {
128
-            $items = [];
129
-            foreach ($next_search as $para => $val) {
130
-                if (!empty($val)) {
131
-                    $items[] = "$para=$val";
132
-                }
133
-            }
134
-            if (count($items) > 0) {
135
-                $paras = implode('&', $items);
136
-            }
137
-            unset($next_search);
138
-            unset($items);
139
-        }
140
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
127
+		if (count($next_search) > 0) {
128
+			$items = [];
129
+			foreach ($next_search as $para => $val) {
130
+				if (!empty($val)) {
131
+					$items[] = "$para=$val";
132
+				}
133
+			}
134
+			if (count($items) > 0) {
135
+				$paras = implode('&', $items);
136
+			}
137
+			unset($next_search);
138
+			unset($items);
139
+		}
140
+		$search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
141 141
 
142
-        /*
142
+		/*
143 143
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
144 144
       $next_count = count($next_results);
145 145
       $has_next = false;
@@ -148,41 +148,41 @@  discard block
 block discarded – undo
148 148
       }
149 149
       if (false != $has_next)
150 150
       */
151
-        if (count($results)) {
152
-            $next            = $start + $limit;
153
-            $queries         = implode(',', $queries);
154
-            $search_url_next = $search_url . "&start=$next";
155
-            $search_next     = '<a href="' . htmlspecialchars($search_url_next, ENT_QUOTES | ENT_HTML5) . '">' . _SR_NEXT . '</a>';
156
-            $xoopsTpl->assign('search_next', $search_next);
157
-        }
158
-        if ($start > 0) {
159
-            $prev            = $start - $limit;
160
-            $search_url_prev = $search_url . "&start=$prev";
161
-            $search_prev     = '<a href="' . htmlspecialchars($search_url_prev, ENT_QUOTES | ENT_HTML5) . '">' . _SR_PREVIOUS . '</a>';
162
-            $xoopsTpl->assign('search_prev', $search_prev);
163
-        }
164
-    }
151
+		if (count($results)) {
152
+			$next            = $start + $limit;
153
+			$queries         = implode(',', $queries);
154
+			$search_url_next = $search_url . "&start=$next";
155
+			$search_next     = '<a href="' . htmlspecialchars($search_url_next, ENT_QUOTES | ENT_HTML5) . '">' . _SR_NEXT . '</a>';
156
+			$xoopsTpl->assign('search_next', $search_next);
157
+		}
158
+		if ($start > 0) {
159
+			$prev            = $start - $limit;
160
+			$search_url_prev = $search_url . "&start=$prev";
161
+			$search_prev     = '<a href="' . htmlspecialchars($search_url_prev, ENT_QUOTES | ENT_HTML5) . '">' . _SR_PREVIOUS . '</a>';
162
+			$xoopsTpl->assign('search_prev', $search_prev);
163
+		}
164
+	}
165 165
 
166
-    unset($results);
167
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
168
-    $xoopsTpl->assign('search_info', $search_info);
166
+	unset($results);
167
+	$search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
168
+	$xoopsTpl->assign('search_info', $search_info);
169 169
 }
170 170
 
171 171
 /* type */
172 172
 $type_select = '<select name="andor">';
173 173
 $type_select .= '<option value="OR"';
174 174
 if ('OR' === $andor) {
175
-    $type_select .= ' selected="selected"';
175
+	$type_select .= ' selected="selected"';
176 176
 }
177 177
 $type_select .= '>' . _SR_ANY . '</option>';
178 178
 $type_select .= '<option value="AND"';
179 179
 if ('AND' === $andor) {
180
-    $type_select .= ' selected="selected"';
180
+	$type_select .= ' selected="selected"';
181 181
 }
182 182
 $type_select .= '>' . _SR_ALL . '</option>';
183 183
 $type_select .= '<option value="EXACT"';
184 184
 if ('exact' === $andor) {
185
-    $type_select .= ' selected="selected"';
185
+	$type_select .= ' selected="selected"';
186 186
 }
187 187
 $type_select .= '>' . _SR_EXACT . '</option>';
188 188
 $type_select .= '</select>';
@@ -191,32 +191,32 @@  discard block
 block discarded – undo
191 191
 $searchin_select = '';
192 192
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="title"';
193 193
 if (in_array('title', $searchin)) {
194
-    $searchin_select .= ' checked';
194
+	$searchin_select .= ' checked';
195 195
 }
196 196
 $searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
197 197
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="text"';
198 198
 if (in_array('text', $searchin)) {
199
-    $searchin_select .= ' checked';
199
+	$searchin_select .= ' checked';
200 200
 }
201 201
 $searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
202 202
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="blog"';
203 203
 if (in_array('blog', $searchin)) {
204
-    $searchin_select .= ' checked';
204
+	$searchin_select .= ' checked';
205 205
 }
206 206
 $searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
207 207
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="feed"';
208 208
 if (in_array('feed', $searchin)) {
209
-    $searchin_select .= ' checked';
209
+	$searchin_select .= ' checked';
210 210
 }
211 211
 $searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
212 212
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="desc"';
213 213
 if (in_array('desc', $searchin)) {
214
-    $searchin_select .= ' checked';
214
+	$searchin_select .= ' checked';
215 215
 }
216 216
 $searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
217 217
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="all"';
218 218
 if (empty($searchin)) {
219
-    $searchin_select .= ' checked';
219
+	$searchin_select .= ' checked';
220 220
 }
221 221
 $searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
222 222
 
@@ -224,28 +224,28 @@  discard block
 block discarded – undo
224 224
 $sortby_select = '<select name="sortby">';
225 225
 $sortby_select .= '<option value=""';
226 226
 if (empty($sortby)) {
227
-    $sortby_select .= ' selected="selected"';
227
+	$sortby_select .= ' selected="selected"';
228 228
 }
229 229
 $sortby_select .= '>' . _NONE . '</option>';
230 230
 $sortby_select .= '<option value="a.art_time"';
231 231
 if ('a.art_time' === $sortby) {
232
-    $sortby_select .= ' selected="selected"';
232
+	$sortby_select .= ' selected="selected"';
233 233
 }
234 234
 $sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
235 235
 $sortby_select .= '<option value="a.art_title"';
236 236
 if ('a.art_title' === $sortby) {
237
-    $sortby_select .= ' selected="selected"';
237
+	$sortby_select .= ' selected="selected"';
238 238
 }
239 239
 $sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
240 240
 $sortby_select .= '<option value="">&nbsp;&nbsp;----&nbsp;&nbsp;</option>';
241 241
 $sortby_select .= '<option value="a.blog_title"';
242 242
 if ('a.blog_title' === $sortby) {
243
-    $sortby_select .= ' selected="selected"';
243
+	$sortby_select .= ' selected="selected"';
244 244
 }
245 245
 $sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
246 246
 $sortby_select .= '<option value="a.blog_time"';
247 247
 if ('b.blog_time' === $sortby) {
248
-    $sortby_select .= ' selected="selected"';
248
+	$sortby_select .= ' selected="selected"';
249 249
 }
250 250
 $sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
251 251
 $sortby_select .= '</select>';
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 $xoopsTpl->assign('uid', $uid);
263 263
 
264 264
 if ($xoopsConfigSearch['keyword_min'] > 0) {
265
-    $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
265
+	$xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
266 266
 }
267 267
 
268 268
 include XOOPS_ROOT_PATH . '/footer.php';
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -30,35 +30,35 @@  discard block
 block discarded – undo
30 30
 $helper = Planet\Helper::getInstance();
31 31
 
32 32
 $xoopsOption['pagetype'] = 'search';
33
-include __DIR__ . '/header.php';
33
+include __DIR__.'/header.php';
34 34
 $xoopsModule->loadLanguage('main');
35 35
 $configHandler     = xoops_getHandler('config');
36 36
 $xoopsConfigSearch = $configHandler->getConfigsByCat(XOOPS_CONF_SEARCH);
37 37
 if (empty($xoopsConfigSearch['enable_search'])) {
38
-    redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/index.php', 2, planet_constant('MD_NOACCESS'));
38
+    redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/index.php', 2, planet_constant('MD_NOACCESS'));
39 39
 }
40 40
 
41 41
 $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0;
42 42
 $xoopsOption['template_main']                             = PlanetUtility::planetGetTemplate('search');
43
-include XOOPS_ROOT_PATH . '/header.php';
44
-include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php';
43
+include XOOPS_ROOT_PATH.'/header.php';
44
+include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/include/vars.php';
45 45
 
46
-require_once XOOPS_ROOT_PATH . '/modules/' . $GLOBALS['moddirname'] . '/include/search.inc.php';
46
+require_once XOOPS_ROOT_PATH.'/modules/'.$GLOBALS['moddirname'].'/include/search.inc.php';
47 47
 $limit = $helper->getConfig('articles_perpage');
48 48
 
49 49
 $queries  = [];
50
-$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST');//isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
51
-$start    = Request::getInt('start', 0, 'GET');//isset($_GET['start']) ? $_GET['start'] : 0;
50
+$andor    = Request::getString('andor', Request::getString('andor', '', 'GET'), 'POST'); //isset($_POST['andor']) ? $_POST['andor'] : (isset($_GET['andor']) ? $_GET['andor'] : '');
51
+$start    = Request::getInt('start', 0, 'GET'); //isset($_GET['start']) ? $_GET['start'] : 0;
52 52
 $category = Request::getInt('category', Request::getInt('category', 0, 'GET'), 'POST'); //(int)(isset($_POST['category']) ? $_POST['category'] : (isset($_GET['category']) ? $_GET['category'] : null));
53
-$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST');//(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
54
-$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST');//(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
53
+$blog     = Request::getInt('blog', Request::getInt('blog', 0, 'GET'), 'POST'); //(int)(isset($_POST['blog']) ? $_POST['blog'] : (isset($_GET['blog']) ? $_GET['blog'] : null));
54
+$uid      = Request::getInt('uid', Request::getInt('uid', 0, 'GET'), 'POST'); //(int)(isset($_POST['uid']) ? $_POST['uid'] : (isset($_GET['uid']) ? $_GET['uid'] : null));
55 55
 $searchin = Request::getArray(
56 56
     'searchin',
57 57
     0 !== count(Request::getArray('searchin', [], 'GET')) ? explode('|', Request::getArray('searchin', [], 'GET')) : [],
58 58
                               'POST'
59 59
 ); //isset($_POST['searchin']) ? $_POST['searchin'] : (isset($_GET['searchin']) ? explode('|', $_GET['searchin']) : array());
60
-$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST');//isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
61
-$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST');//isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
60
+$sortby   = Request::getString('sortby', Request::getString('sortby', null, 'GET'), 'POST'); //isset($_POST['sortby']) ? $_POST['sortby'] : (isset($_GET['sortby']) ? $_GET['sortby'] : null);
61
+$term     = Request::getString('term', Request::getString('term', '', 'GET'), 'POST'); //isset($_POST['term']) ? $_POST['term'] : (isset($_GET['term']) ? $_GET['term'] : '');
62 62
 
63 63
 $andor  = in_array(strtoupper($andor), ['OR', 'AND', 'EXACT']) ? strtoupper($andor) : 'OR';
64 64
 $sortby = in_array(strtolower($sortby), [
@@ -86,18 +86,18 @@  discard block
 block discarded – undo
86 86
         $temp_queries    = preg_split("/[\s,]+/", $query);
87 87
         foreach ($temp_queries as $q) {
88 88
             $q = trim($q);
89
-            if (strlen($q) >= $xoopsConfigSearch['keyword_min']) {
89
+            if (strlen($q)>=$xoopsConfigSearch['keyword_min']) {
90 90
                 $queries[] = $myts->addSlashes($q);
91
-            } else {
91
+            }else {
92 92
                 $ignored_queries[] = $myts->addSlashes($q);
93 93
             }
94 94
         }
95 95
         if (0 == count($queries)) {
96
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
96
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
97 97
         }
98
-    } else {
99
-        if (strlen($query) < $xoopsConfigSearch['keyword_min']) {
100
-            redirect_header(XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
98
+    }else {
99
+        if (strlen($query)<$xoopsConfigSearch['keyword_min']) {
100
+            redirect_header(XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php', 2, sprintf(_SR_KEYTOOSHORT, $xoopsConfigSearch['keyword_min']));
101 101
         }
102 102
         $queries = [$myts->addSlashes($query)];
103 103
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     if (!empty($time)) {
112 112
         $extra = '';
113
-    } else {
113
+    }else {
114 114
         $extra = '';
115 115
     }
116 116
 
@@ -124,20 +124,20 @@  discard block
 block discarded – undo
124 124
     {
125 125
         $xoopsTpl->assign('results', $results);
126 126
 
127
-        if (count($next_search) > 0) {
127
+        if (count($next_search)>0) {
128 128
             $items = [];
129 129
             foreach ($next_search as $para => $val) {
130 130
                 if (!empty($val)) {
131 131
                     $items[] = "$para=$val";
132 132
                 }
133 133
             }
134
-            if (count($items) > 0) {
134
+            if (count($items)>0) {
135 135
                 $paras = implode('&', $items);
136 136
             }
137 137
             unset($next_search);
138 138
             unset($items);
139 139
         }
140
-        $search_url = XOOPS_URL . '/modules/' . $GLOBALS['moddirname'] . '/search.php?' . $paras;
140
+        $search_url = XOOPS_URL.'/modules/'.$GLOBALS['moddirname'].'/search.php?'.$paras;
141 141
 
142 142
         /*
143 143
          $next_results =& planet_search($queries, $andor, 1, $start + $limit, $uid, $category, $sortby, $searchin, $extra);
@@ -149,22 +149,22 @@  discard block
 block discarded – undo
149 149
       if (false != $has_next)
150 150
       */
151 151
         if (count($results)) {
152
-            $next            = $start + $limit;
152
+            $next            = $start+$limit;
153 153
             $queries         = implode(',', $queries);
154
-            $search_url_next = $search_url . "&start=$next";
155
-            $search_next     = '<a href="' . htmlspecialchars($search_url_next, ENT_QUOTES | ENT_HTML5) . '">' . _SR_NEXT . '</a>';
154
+            $search_url_next = $search_url."&start=$next";
155
+            $search_next     = '<a href="'.htmlspecialchars($search_url_next, ENT_QUOTES | ENT_HTML5).'">'._SR_NEXT.'</a>';
156 156
             $xoopsTpl->assign('search_next', $search_next);
157 157
         }
158
-        if ($start > 0) {
159
-            $prev            = $start - $limit;
160
-            $search_url_prev = $search_url . "&start=$prev";
161
-            $search_prev     = '<a href="' . htmlspecialchars($search_url_prev, ENT_QUOTES | ENT_HTML5) . '">' . _SR_PREVIOUS . '</a>';
158
+        if ($start>0) {
159
+            $prev            = $start-$limit;
160
+            $search_url_prev = $search_url."&start=$prev";
161
+            $search_prev     = '<a href="'.htmlspecialchars($search_url_prev, ENT_QUOTES | ENT_HTML5).'">'._SR_PREVIOUS.'</a>';
162 162
             $xoopsTpl->assign('search_prev', $search_prev);
163 163
         }
164 164
     }
165 165
 
166 166
     unset($results);
167
-    $search_info = _SR_KEYWORDS . ': ' . $myts->htmlSpecialChars($term);
167
+    $search_info = _SR_KEYWORDS.': '.$myts->htmlSpecialChars($term);
168 168
     $xoopsTpl->assign('search_info', $search_info);
169 169
 }
170 170
 
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
 if ('OR' === $andor) {
175 175
     $type_select .= ' selected="selected"';
176 176
 }
177
-$type_select .= '>' . _SR_ANY . '</option>';
177
+$type_select .= '>'._SR_ANY.'</option>';
178 178
 $type_select .= '<option value="AND"';
179 179
 if ('AND' === $andor) {
180 180
     $type_select .= ' selected="selected"';
181 181
 }
182
-$type_select .= '>' . _SR_ALL . '</option>';
182
+$type_select .= '>'._SR_ALL.'</option>';
183 183
 $type_select .= '<option value="EXACT"';
184 184
 if ('exact' === $andor) {
185 185
     $type_select .= ' selected="selected"';
186 186
 }
187
-$type_select .= '>' . _SR_EXACT . '</option>';
187
+$type_select .= '>'._SR_EXACT.'</option>';
188 188
 $type_select .= '</select>';
189 189
 
190 190
 /* scope */
@@ -193,32 +193,32 @@  discard block
 block discarded – undo
193 193
 if (in_array('title', $searchin)) {
194 194
     $searchin_select .= ' checked';
195 195
 }
196
-$searchin_select .= '>' . planet_constant('MD_TITLE') . '&nbsp;&nbsp;';
196
+$searchin_select .= '>'.planet_constant('MD_TITLE').'&nbsp;&nbsp;';
197 197
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="text"';
198 198
 if (in_array('text', $searchin)) {
199 199
     $searchin_select .= ' checked';
200 200
 }
201
-$searchin_select .= '>' . planet_constant('MD_BODY') . '&nbsp;&nbsp;||&nbsp;&nbsp;';
201
+$searchin_select .= '>'.planet_constant('MD_BODY').'&nbsp;&nbsp;||&nbsp;&nbsp;';
202 202
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="blog"';
203 203
 if (in_array('blog', $searchin)) {
204 204
     $searchin_select .= ' checked';
205 205
 }
206
-$searchin_select .= '>' . planet_constant('MD_BLOG') . '&nbsp;&nbsp;';
206
+$searchin_select .= '>'.planet_constant('MD_BLOG').'&nbsp;&nbsp;';
207 207
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="feed"';
208 208
 if (in_array('feed', $searchin)) {
209 209
     $searchin_select .= ' checked';
210 210
 }
211
-$searchin_select .= '>' . planet_constant('MD_FEED') . '&nbsp;&nbsp;';
211
+$searchin_select .= '>'.planet_constant('MD_FEED').'&nbsp;&nbsp;';
212 212
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="desc"';
213 213
 if (in_array('desc', $searchin)) {
214 214
     $searchin_select .= ' checked';
215 215
 }
216
-$searchin_select .= '>' . planet_constant('MD_DESC') . '&nbsp;&nbsp;';
216
+$searchin_select .= '>'.planet_constant('MD_DESC').'&nbsp;&nbsp;';
217 217
 $searchin_select .= '<input type="checkbox" name="searchin[]" value="all"';
218 218
 if (empty($searchin)) {
219 219
     $searchin_select .= ' checked';
220 220
 }
221
-$searchin_select .= '>' . _ALL . '&nbsp;&nbsp;';
221
+$searchin_select .= '>'._ALL.'&nbsp;&nbsp;';
222 222
 
223 223
 /* sortby */
224 224
 $sortby_select = '<select name="sortby">';
@@ -226,28 +226,28 @@  discard block
 block discarded – undo
226 226
 if (empty($sortby)) {
227 227
     $sortby_select .= ' selected="selected"';
228 228
 }
229
-$sortby_select .= '>' . _NONE . '</option>';
229
+$sortby_select .= '>'._NONE.'</option>';
230 230
 $sortby_select .= '<option value="a.art_time"';
231 231
 if ('a.art_time' === $sortby) {
232 232
     $sortby_select .= ' selected="selected"';
233 233
 }
234
-$sortby_select .= '>' . planet_constant('MD_TIME') . '</option>';
234
+$sortby_select .= '>'.planet_constant('MD_TIME').'</option>';
235 235
 $sortby_select .= '<option value="a.art_title"';
236 236
 if ('a.art_title' === $sortby) {
237 237
     $sortby_select .= ' selected="selected"';
238 238
 }
239
-$sortby_select .= '>' . planet_constant('MD_TITLE') . '</option>';
239
+$sortby_select .= '>'.planet_constant('MD_TITLE').'</option>';
240 240
 $sortby_select .= '<option value="">&nbsp;&nbsp;----&nbsp;&nbsp;</option>';
241 241
 $sortby_select .= '<option value="a.blog_title"';
242 242
 if ('a.blog_title' === $sortby) {
243 243
     $sortby_select .= ' selected="selected"';
244 244
 }
245
-$sortby_select .= '>' . planet_constant('MD_BLOG') . '</option>';
245
+$sortby_select .= '>'.planet_constant('MD_BLOG').'</option>';
246 246
 $sortby_select .= '<option value="a.blog_time"';
247 247
 if ('b.blog_time' === $sortby) {
248 248
     $sortby_select .= ' selected="selected"';
249 249
 }
250
-$sortby_select .= '>' . planet_constant('MD_UPDATE') . '</option>';
250
+$sortby_select .= '>'.planet_constant('MD_UPDATE').'</option>';
251 251
 $sortby_select .= '</select>';
252 252
 
253 253
 $xoopsTpl->assign('type_select', $type_select);
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 $xoopsTpl->assign('blog', $blog);
262 262
 $xoopsTpl->assign('uid', $uid);
263 263
 
264
-if ($xoopsConfigSearch['keyword_min'] > 0) {
264
+if ($xoopsConfigSearch['keyword_min']>0) {
265 265
     $xoopsTpl->assign('search_rule', sprintf(_SR_KEYIGNORE, $xoopsConfigSearch['keyword_min']));
266 266
 }
267 267
 
268
-include XOOPS_ROOT_PATH . '/footer.php';
268
+include XOOPS_ROOT_PATH.'/footer.php';
Please login to merge, or discard this patch.
language/english/common.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,51 +21,51 @@
 block discarded – undo
21 21
 $moduleDirName      = basename(dirname(dirname(__DIR__)));
22 22
 $moduleDirNameUpper = strtoupper($moduleDirName);
23 23
 
24
-define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: ');
25
-define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: ');
26
-define('CO_' . $moduleDirNameUpper . '_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
-define('CO_' . $moduleDirNameUpper . '_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
-define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status');
29
-define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
-define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
-define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
-define('CO_' . $moduleDirNameUpper . '_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
-define('CO_' . $moduleDirNameUpper . '_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
-define('CO_' . $moduleDirNameUpper . '_ON', "<span style='font-weight: bold;'>ON</span>");
35
-define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: ');
36
-define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
-define('CO_' . $moduleDirNameUpper . '_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
-define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
24
+define('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS', 'GD library support: ');
25
+define('CO_'.$moduleDirNameUpper.'_GDLIBVERSION', 'GD Library version: ');
26
+define('CO_'.$moduleDirNameUpper.'_GDOFF', "<span style='font-weight: bold;'>Disabled</span> (No thumbnails available)");
27
+define('CO_'.$moduleDirNameUpper.'_GDON', "<span style='font-weight: bold;'>Enabled</span> (Thumbsnails available)");
28
+define('CO_'.$moduleDirNameUpper.'_IMAGEINFO', 'Server status');
29
+define('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): ');
30
+define('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): ');
31
+define('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): ');
32
+define('CO_'.$moduleDirNameUpper.'_METAVERSION', "<span style='font-weight: bold;'>Downloads meta version:</span> ");
33
+define('CO_'.$moduleDirNameUpper.'_OFF', "<span style='font-weight: bold;'>OFF</span>");
34
+define('CO_'.$moduleDirNameUpper.'_ON', "<span style='font-weight: bold;'>ON</span>");
35
+define('CO_'.$moduleDirNameUpper.'_SERVERPATH', 'Server path to XOOPS root: ');
36
+define('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS', 'Server uploads status: ');
37
+define('CO_'.$moduleDirNameUpper.'_SPHPINI', "<span style='font-weight: bold;'>Information taken from PHP ini file:</span>");
38
+define('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.');
39 39
 
40
-define('CO_' . $moduleDirNameUpper . '_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
-define('CO_' . $moduleDirNameUpper . '_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
40
+define('CO_'.$moduleDirNameUpper.'_PRINT', "<span style='font-weight: bold;'>Print</span>");
41
+define('CO_'.$moduleDirNameUpper.'_PDF', "<span style='font-weight: bold;'>Create PDF</span>");
42 42
 
43 43
 
44
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
-define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
-define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s');
48
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
-define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
44
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'");
45
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED1', "Update failed - couldn't add new fields");
46
+define('CO_'.$moduleDirNameUpper.'_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'");
47
+define('CO_'.$moduleDirNameUpper.'_ERROR_COLUMN', 'Could not create column in database : %s');
48
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)');
49
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)');
50
+define('CO_'.$moduleDirNameUpper.'_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module');
51 51
 
52
-define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
52
+define('CO_'.$moduleDirNameUpper.'_FOLDERS_DELETED_OK', 'Upload Folders have been deleted');
53 53
 
54 54
 // Error Msgs
55
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
-define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s');
57
-define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin');
55
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_DEL_PATH', 'Could not delete %s directory');
56
+define('CO_'.$moduleDirNameUpper.'_ERROR_BAD_REMOVE', 'Could not delete %s');
57
+define('CO_'.$moduleDirNameUpper.'_ERROR_NO_PLUGIN', 'Could not load plugin');
58 58
 
59 59
 
60 60
 //Help
61
-define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__))));
62
-define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
-define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of ');
64
-define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview');
61
+define('CO_'.$moduleDirNameUpper.'_DIRNAME', basename(dirname(dirname(__DIR__))));
62
+define('CO_'.$moduleDirNameUpper.'_HELP_HEADER', __DIR__.'/help/helpheader.tpl');
63
+define('CO_'.$moduleDirNameUpper.'_BACK_2_ADMIN', 'Back to Administration of ');
64
+define('CO_'.$moduleDirNameUpper.'_OVERVIEW', 'Overview');
65 65
 
66 66
 //define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__);
67 67
 
68 68
 //help multi-page
69
-define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer');
70
-define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License');
71
-define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support');
69
+define('CO_'.$moduleDirNameUpper.'_DISCLAIMER', 'Disclaimer');
70
+define('CO_'.$moduleDirNameUpper.'_LICENSE', 'License');
71
+define('CO_'.$moduleDirNameUpper.'_SUPPORT', 'Support');
Please login to merge, or discard this patch.
class/Common/ServerStats.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -17,60 +17,60 @@
 block discarded – undo
17 17
  */
18 18
 trait ServerStats
19 19
 {
20
-    /**
21
-     * serverStats()
22
-     *
23
-     * @return string
24
-     */
25
-    public static function getServerStats()
26
-    {
27
-        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
-        $moduleDirName      = basename(dirname(dirname(__DIR__)));
29
-        $moduleDirNameUpper = strtoupper($moduleDirName);
30
-        xoops_loadLanguage('common', $moduleDirName);
31
-        $html = '';
32
-        //        $sql   = 'SELECT metavalue';
33
-        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
-        //        $sql   .= " WHERE metakey='version' LIMIT 1";
35
-        //        $query = $GLOBALS['xoopsDB']->query($sql);
36
-        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
-        $html .= "<div style='padding: 8px;'>\n";
39
-        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
-        //        $html .= "<br>\n";
41
-        //        $html .= "<br>\n";
42
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
-        $html .= "<ul>\n";
44
-        //
45
-        $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
-        if (function_exists('gd_info')) {
48
-            if (true === ($gdlib = gd_info())) {
49
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
-            }
51
-        }
52
-        //
53
-        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
-        //
56
-        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
-        //
59
-        $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
-        //
62
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
-        $html .= "</ul>\n";
66
-        $html .= "<ul>\n";
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
-        $html .= "</ul>\n";
69
-        $html .= "<br>\n";
70
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
-        $html .= '</div>';
72
-        $html .= '</fieldset><br>';
20
+	/**
21
+	 * serverStats()
22
+	 *
23
+	 * @return string
24
+	 */
25
+	public static function getServerStats()
26
+	{
27
+		//mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
+		$moduleDirName      = basename(dirname(dirname(__DIR__)));
29
+		$moduleDirNameUpper = strtoupper($moduleDirName);
30
+		xoops_loadLanguage('common', $moduleDirName);
31
+		$html = '';
32
+		//        $sql   = 'SELECT metavalue';
33
+		//        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
+		//        $sql   .= " WHERE metakey='version' LIMIT 1";
35
+		//        $query = $GLOBALS['xoopsDB']->query($sql);
36
+		//        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
+		$html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
+		$html .= "<div style='padding: 8px;'>\n";
39
+		//        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
+		//        $html .= "<br>\n";
41
+		//        $html .= "<br>\n";
42
+		$html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
+		$html .= "<ul>\n";
44
+		//
45
+		$gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
+		$html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
+		if (function_exists('gd_info')) {
48
+			if (true === ($gdlib = gd_info())) {
49
+				$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
+			}
51
+		}
52
+		//
53
+		//    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
+		//
56
+		//    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
+		//
59
+		$downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
+		$html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
+		//
62
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
+		$html .= "</ul>\n";
66
+		$html .= "<ul>\n";
67
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
+		$html .= "</ul>\n";
69
+		$html .= "<br>\n";
70
+		$html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
+		$html .= '</div>';
72
+		$html .= '</fieldset><br>';
73 73
 
74
-        return $html;
75
-    }
74
+		return $html;
75
+	}
76 76
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,19 +34,19 @@  discard block
 block discarded – undo
34 34
         //        $sql   .= " WHERE metakey='version' LIMIT 1";
35 35
         //        $query = $GLOBALS['xoopsDB']->query($sql);
36 36
         //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
37
+        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>".constant('CO_'.$moduleDirNameUpper.'_IMAGEINFO')."</legend>\n";
38 38
         $html .= "<div style='padding: 8px;'>\n";
39 39
         //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40 40
         //        $html .= "<br>\n";
41 41
         //        $html .= "<br>\n";
42
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
42
+        $html .= '<div>'.constant('CO_'.$moduleDirNameUpper.'_SPHPINI')."</div>\n";
43 43
         $html .= "<ul>\n";
44 44
         //
45
-        $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
45
+        $gdlib = function_exists('gd_info') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_GDON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_GDOFF').'</span>';
46
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBSTATUS').$gdlib;
47 47
         if (function_exists('gd_info')) {
48 48
             if (true === ($gdlib = gd_info())) {
49
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
49
+                $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_GDLIBVERSION').'<b>'.$gdlib['GD Version'].'</b>';
50 50
             }
51 51
         }
52 52
         //
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
         //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57 57
         //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58 58
         //
59
-        $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
59
+        $downloads = ini_get('file_uploads') ? '<span style="color: green;">'.constant('CO_'.$moduleDirNameUpper.'_ON').'</span>' : '<span style="color: red;">'.constant('CO_'.$moduleDirNameUpper.'_OFF').'</span>';
60
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERUPLOADSTATUS').$downloads;
61 61
         //
62
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
62
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXUPLOADSIZE').' <b><span style="color: blue;">'.ini_get('upload_max_filesize')."</span></b>\n";
63
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MAXPOSTSIZE').' <b><span style="color: blue;">'.ini_get('post_max_size')."</span></b>\n";
64
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_MEMORYLIMIT').' <b><span style="color: blue;">'.ini_get('memory_limit')."</span></b>\n";
65 65
         $html .= "</ul>\n";
66 66
         $html .= "<ul>\n";
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
67
+        $html .= '<li>'.constant('CO_'.$moduleDirNameUpper.'_SERVERPATH').' <b>'.XOOPS_ROOT_PATH."</b>\n";
68 68
         $html .= "</ul>\n";
69 69
         $html .= "<br>\n";
70
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
70
+        $html .= constant('CO_'.$moduleDirNameUpper.'_UPLOADPATHDSC')."\n";
71 71
         $html .= '</div>';
72 72
         $html .= '</fieldset><br>';
73 73
 
Please login to merge, or discard this patch.
class/Common/Breadcrumb.php 2 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -31,48 +31,48 @@
 block discarded – undo
31 31
  */
32 32
 class Breadcrumb
33 33
 {
34
-    public $dirname;
35
-    private $bread = [];
34
+	public $dirname;
35
+	private $bread = [];
36 36
 
37
-    /**
38
-     *
39
-     */
40
-    public function __construct()
41
-    {
42
-        $this->dirname = basename(dirname(__DIR__));
43
-    }
37
+	/**
38
+	 *
39
+	 */
40
+	public function __construct()
41
+	{
42
+		$this->dirname = basename(dirname(__DIR__));
43
+	}
44 44
 
45
-    /**
46
-     * Add link to breadcrumb
47
-     *
48
-     * @param string $title
49
-     * @param string $link
50
-     */
51
-    public function addLink($title = '', $link = '')
52
-    {
53
-        $this->bread[] = [
54
-            'link'  => $link,
55
-            'title' => $title
56
-        ];
57
-    }
45
+	/**
46
+	 * Add link to breadcrumb
47
+	 *
48
+	 * @param string $title
49
+	 * @param string $link
50
+	 */
51
+	public function addLink($title = '', $link = '')
52
+	{
53
+		$this->bread[] = [
54
+			'link'  => $link,
55
+			'title' => $title
56
+		];
57
+	}
58 58
 
59
-    /**
60
-     * Render Pedigree BreadCrumb
61
-     *
62
-     */
63
-    public function render()
64
-    {
65
-        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
66
-            require_once $GLOBALS['xoops']->path('class/theme.php');
67
-            $GLOBALS['xoTheme'] = new \xos_opal_Theme();
68
-        }
59
+	/**
60
+	 * Render Pedigree BreadCrumb
61
+	 *
62
+	 */
63
+	public function render()
64
+	{
65
+		if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
66
+			require_once $GLOBALS['xoops']->path('class/theme.php');
67
+			$GLOBALS['xoTheme'] = new \xos_opal_Theme();
68
+		}
69 69
 
70
-        require_once $GLOBALS['xoops']->path('class/template.php');
71
-        $breadcrumbTpl = new \XoopsTpl();
72
-        $breadcrumbTpl->assign('breadcrumb', $this->bread);
73
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
74
-        unset($breadcrumbTpl);
70
+		require_once $GLOBALS['xoops']->path('class/template.php');
71
+		$breadcrumbTpl = new \XoopsTpl();
72
+		$breadcrumbTpl->assign('breadcrumb', $this->bread);
73
+		$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
74
+		unset($breadcrumbTpl);
75 75
 
76
-        return $html;
77
-    }
76
+		return $html;
77
+	}
78 78
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         require_once $GLOBALS['xoops']->path('class/template.php');
71 71
         $breadcrumbTpl = new \XoopsTpl();
72 72
         $breadcrumbTpl->assign('breadcrumb', $this->bread);
73
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
73
+        $html = $breadcrumbTpl->fetch('db:'.$this->dirname.'_common_breadcrumb.tpl');
74 74
         unset($breadcrumbTpl);
75 75
 
76 76
         return $html;
Please login to merge, or discard this patch.
class/Common/VersionChecks.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -17,60 +17,60 @@
 block discarded – undo
17 17
  */
18 18
 trait VersionChecks
19 19
 {
20
-    /**
21
-     *
22
-     * Verifies XOOPS version meets minimum requirements for this module
23
-     * @static
24
-     * @param \XoopsModule $module
25
-     *
26
-     * @param null|string $requiredVer
27
-     * @return bool true if meets requirements, false if not
28
-     */
29
-    public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
30
-    {
31
-        $moduleDirName = basename(dirname(dirname(__DIR__)));
32
-        if (null === $module) {
33
-            $module = \XoopsModule::getByDirname($moduleDirName);
34
-        }
35
-        xoops_loadLanguage('admin', $moduleDirName);
20
+	/**
21
+	 *
22
+	 * Verifies XOOPS version meets minimum requirements for this module
23
+	 * @static
24
+	 * @param \XoopsModule $module
25
+	 *
26
+	 * @param null|string $requiredVer
27
+	 * @return bool true if meets requirements, false if not
28
+	 */
29
+	public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
30
+	{
31
+		$moduleDirName = basename(dirname(dirname(__DIR__)));
32
+		if (null === $module) {
33
+			$module = \XoopsModule::getByDirname($moduleDirName);
34
+		}
35
+		xoops_loadLanguage('admin', $moduleDirName);
36 36
 
37
-        //check for minimum XOOPS version
38
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
39
-        if (null === $requiredVer) {
40
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
-        }
42
-        $success     = true;
37
+		//check for minimum XOOPS version
38
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
39
+		if (null === $requiredVer) {
40
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
+		}
42
+		$success     = true;
43 43
 
44
-        if (version_compare($currentVer, $requiredVer, '<')) {
45
-            $success     = false;
46
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
47
-        }
44
+		if (version_compare($currentVer, $requiredVer, '<')) {
45
+			$success     = false;
46
+			$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
47
+		}
48 48
 
49
-        return $success;
50
-    }
49
+		return $success;
50
+	}
51 51
 
52
-    /**
53
-     *
54
-     * Verifies PHP version meets minimum requirements for this module
55
-     * @static
56
-     * @param \XoopsModule $module
57
-     *
58
-     * @return bool true if meets requirements, false if not
59
-     */
60
-    public static function checkVerPhp(\XoopsModule $module)
61
-    {
62
-        xoops_loadLanguage('admin', $module->dirname());
63
-        // check for minimum PHP version
64
-        $success = true;
65
-        $verNum  = PHP_VERSION;
66
-        $reqVer  = $module->getInfo('min_php');
67
-        if (false !== $reqVer && '' !== $reqVer) {
68
-            if (version_compare($verNum, $reqVer, '<')) {
69
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
70
-                $success = false;
71
-            }
72
-        }
52
+	/**
53
+	 *
54
+	 * Verifies PHP version meets minimum requirements for this module
55
+	 * @static
56
+	 * @param \XoopsModule $module
57
+	 *
58
+	 * @return bool true if meets requirements, false if not
59
+	 */
60
+	public static function checkVerPhp(\XoopsModule $module)
61
+	{
62
+		xoops_loadLanguage('admin', $module->dirname());
63
+		// check for minimum PHP version
64
+		$success = true;
65
+		$verNum  = PHP_VERSION;
66
+		$reqVer  = $module->getInfo('min_php');
67
+		if (false !== $reqVer && '' !== $reqVer) {
68
+			if (version_compare($verNum, $reqVer, '<')) {
69
+				$module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
70
+				$success = false;
71
+			}
72
+		}
73 73
 
74
-        return $success;
75
-    }
74
+		return $success;
75
+	}
76 76
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         //check for minimum XOOPS version
38 38
         $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
39 39
         if (null === $requiredVer) {
40
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
40
+            $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string
41 41
         }
42
-        $success     = true;
42
+        $success = true;
43 43
 
44 44
         if (version_compare($currentVer, $requiredVer, '<')) {
45
-            $success     = false;
46
-            $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
45
+            $success = false;
46
+            $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer));
47 47
         }
48 48
 
49 49
         return $success;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $reqVer  = $module->getInfo('min_php');
67 67
         if (false !== $reqVer && '' !== $reqVer) {
68 68
             if (version_compare($verNum, $reqVer, '<')) {
69
-                $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum));
69
+                $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum));
70 70
                 $success = false;
71 71
             }
72 72
         }
Please login to merge, or discard this patch.
class/Common/FilesManagement.php 2 patches
Indentation   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -17,228 +17,228 @@
 block discarded – undo
17 17
  */
18 18
 trait FilesManagement
19 19
 {
20
-    /**
21
-     * Function responsible for checking if a directory exists, we can also write in and create an index.html file
22
-     *
23
-     * @param string $folder The full path of the directory to check
24
-     *
25
-     * @return void
26
-     */
27
-    public static function createFolder($folder)
28
-    {
29
-        try {
30
-            if (!file_exists($folder)) {
31
-                if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) {
32
-                    throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
33
-                }
34
-
35
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
36
-            }
37
-        } catch (\Exception $e) {
38
-            echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
39
-        }
40
-    }
41
-
42
-    /**
43
-     * @param $file
44
-     * @param $folder
45
-     * @return bool
46
-     */
47
-    public static function copyFile($file, $folder)
48
-    {
49
-        return copy($file, $folder);
50
-    }
51
-
52
-    /**
53
-     * @param $src
54
-     * @param $dst
55
-     */
56
-    public static function recurseCopy($src, $dst)
57
-    {
58
-        $dir = opendir($src);
59
-        //        @mkdir($dst);
60
-        if (!mkdir($dst) && !is_dir($dst)) {
61
-            while (false !== ($file = readdir($dir))) {
62
-                if (('.' !== $file) && ('..' !== $file)) {
63
-                    if (is_dir($src . '/' . $file)) {
64
-                        self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
65
-                    } else {
66
-                        copy($src . '/' . $file, $dst . '/' . $file);
67
-                    }
68
-                }
69
-            }
70
-        }
71
-        closedir($dir);
72
-    }
73
-
74
-    /**
75
-     *
76
-     * Remove files and (sub)directories
77
-     *
78
-     * @param string $src source directory to delete
79
-     *
80
-     * @uses \Xmf\Module\Helper::getHelper()
81
-     * @uses \Xmf\Module\Helper::isUserAdmin()
82
-     *
83
-     * @return bool true on success
84
-     */
85
-    public static function deleteDirectory($src)
86
-    {
87
-        // Only continue if user is a 'global' Admin
88
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
89
-            return false;
90
-        }
91
-
92
-        $success = true;
93
-        // remove old files
94
-        $dirInfo = new \SplFileInfo($src);
95
-        // validate is a directory
96
-        if ($dirInfo->isDir()) {
97
-            $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']);
98
-            foreach ($fileList as $k => $v) {
99
-                $fileInfo = new \SplFileInfo("{$src}/{$v}");
100
-                if ($fileInfo->isDir()) {
101
-                    // recursively handle subdirectories
102
-                    if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
103
-                        break;
104
-                    }
105
-                } else {
106
-                    // delete the file
107
-                    if (!($success = unlink($fileInfo->getRealPath()))) {
108
-                        break;
109
-                    }
110
-                }
111
-            }
112
-            // now delete this (sub)directory if all the files are gone
113
-            if ($success) {
114
-                $success = rmdir($dirInfo->getRealPath());
115
-            }
116
-        } else {
117
-            // input is not a valid directory
118
-            $success = false;
119
-        }
120
-        return $success;
121
-    }
122
-
123
-    /**
124
-     *
125
-     * Recursively remove directory
126
-     *
127
-     * @todo currently won't remove directories with hidden files, should it?
128
-     *
129
-     * @param string $src directory to remove (delete)
130
-     *
131
-     * @return bool true on success
132
-     */
133
-    public static function rrmdir($src)
134
-    {
135
-        // Only continue if user is a 'global' Admin
136
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
137
-            return false;
138
-        }
139
-
140
-        // If source is not a directory stop processing
141
-        if (!is_dir($src)) {
142
-            return false;
143
-        }
144
-
145
-        $success = true;
146
-
147
-        // Open the source directory to read in files
148
-        $iterator = new \DirectoryIterator($src);
149
-        foreach ($iterator as $fObj) {
150
-            if ($fObj->isFile()) {
151
-                $filename = $fObj->getPathname();
152
-                $fObj     = null; // clear this iterator object to close the file
153
-                if (!unlink($filename)) {
154
-                    return false; // couldn't delete the file
155
-                }
156
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
157
-                // Try recursively on directory
158
-                self::rrmdir($fObj->getPathname());
159
-            }
160
-        }
161
-        $iterator = null;   // clear iterator Obj to close file/directory
162
-        return rmdir($src); // remove the directory & return results
163
-    }
164
-
165
-    /**
166
-     * Recursively move files from one directory to another
167
-     *
168
-     * @param string $src  - Source of files being moved
169
-     * @param string $dest - Destination of files being moved
170
-     *
171
-     * @return bool true on success
172
-     */
173
-    public static function rmove($src, $dest)
174
-    {
175
-        // Only continue if user is a 'global' Admin
176
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
177
-            return false;
178
-        }
179
-
180
-        // If source is not a directory stop processing
181
-        if (!is_dir($src)) {
182
-            return false;
183
-        }
184
-
185
-        // If the destination directory does not exist and could not be created stop processing
186
-        if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
187
-            return false;
188
-        }
189
-
190
-        // Open the source directory to read in files
191
-        $iterator = new \DirectoryIterator($src);
192
-        foreach ($iterator as $fObj) {
193
-            if ($fObj->isFile()) {
194
-                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
195
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
196
-                // Try recursively on directory
197
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
198
-                //                rmdir($fObj->getPath()); // now delete the directory
199
-            }
200
-        }
201
-        $iterator = null;   // clear iterator Obj to close file/directory
202
-        return rmdir($src); // remove the directory & return results
203
-    }
204
-
205
-    /**
206
-     * Recursively copy directories and files from one directory to another
207
-     *
208
-     * @param string $src  - Source of files being moved
209
-     * @param string $dest - Destination of files being moved
210
-     *
211
-     * @uses \Xmf\Module\Helper::getHelper()
212
-     * @uses \Xmf\Module\Helper::isUserAdmin()
213
-     *
214
-     * @return bool true on success
215
-     */
216
-    public static function rcopy($src, $dest)
217
-    {
218
-        // Only continue if user is a 'global' Admin
219
-        if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
220
-            return false;
221
-        }
222
-
223
-        // If source is not a directory stop processing
224
-        if (!is_dir($src)) {
225
-            return false;
226
-        }
227
-
228
-        // If the destination directory does not exist and could not be created stop processing
229
-        if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
230
-            return false;
231
-        }
232
-
233
-        // Open the source directory to read in files
234
-        $iterator = new \DirectoryIterator($src);
235
-        foreach ($iterator as $fObj) {
236
-            if ($fObj->isFile()) {
237
-                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
238
-            } elseif (!$fObj->isDot() && $fObj->isDir()) {
239
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
240
-            }
241
-        }
242
-        return true;
243
-    }
20
+	/**
21
+	 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
22
+	 *
23
+	 * @param string $folder The full path of the directory to check
24
+	 *
25
+	 * @return void
26
+	 */
27
+	public static function createFolder($folder)
28
+	{
29
+		try {
30
+			if (!file_exists($folder)) {
31
+				if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) {
32
+					throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
33
+				}
34
+
35
+				file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
36
+			}
37
+		} catch (\Exception $e) {
38
+			echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
39
+		}
40
+	}
41
+
42
+	/**
43
+	 * @param $file
44
+	 * @param $folder
45
+	 * @return bool
46
+	 */
47
+	public static function copyFile($file, $folder)
48
+	{
49
+		return copy($file, $folder);
50
+	}
51
+
52
+	/**
53
+	 * @param $src
54
+	 * @param $dst
55
+	 */
56
+	public static function recurseCopy($src, $dst)
57
+	{
58
+		$dir = opendir($src);
59
+		//        @mkdir($dst);
60
+		if (!mkdir($dst) && !is_dir($dst)) {
61
+			while (false !== ($file = readdir($dir))) {
62
+				if (('.' !== $file) && ('..' !== $file)) {
63
+					if (is_dir($src . '/' . $file)) {
64
+						self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
65
+					} else {
66
+						copy($src . '/' . $file, $dst . '/' . $file);
67
+					}
68
+				}
69
+			}
70
+		}
71
+		closedir($dir);
72
+	}
73
+
74
+	/**
75
+	 *
76
+	 * Remove files and (sub)directories
77
+	 *
78
+	 * @param string $src source directory to delete
79
+	 *
80
+	 * @uses \Xmf\Module\Helper::getHelper()
81
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
82
+	 *
83
+	 * @return bool true on success
84
+	 */
85
+	public static function deleteDirectory($src)
86
+	{
87
+		// Only continue if user is a 'global' Admin
88
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
89
+			return false;
90
+		}
91
+
92
+		$success = true;
93
+		// remove old files
94
+		$dirInfo = new \SplFileInfo($src);
95
+		// validate is a directory
96
+		if ($dirInfo->isDir()) {
97
+			$fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']);
98
+			foreach ($fileList as $k => $v) {
99
+				$fileInfo = new \SplFileInfo("{$src}/{$v}");
100
+				if ($fileInfo->isDir()) {
101
+					// recursively handle subdirectories
102
+					if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
103
+						break;
104
+					}
105
+				} else {
106
+					// delete the file
107
+					if (!($success = unlink($fileInfo->getRealPath()))) {
108
+						break;
109
+					}
110
+				}
111
+			}
112
+			// now delete this (sub)directory if all the files are gone
113
+			if ($success) {
114
+				$success = rmdir($dirInfo->getRealPath());
115
+			}
116
+		} else {
117
+			// input is not a valid directory
118
+			$success = false;
119
+		}
120
+		return $success;
121
+	}
122
+
123
+	/**
124
+	 *
125
+	 * Recursively remove directory
126
+	 *
127
+	 * @todo currently won't remove directories with hidden files, should it?
128
+	 *
129
+	 * @param string $src directory to remove (delete)
130
+	 *
131
+	 * @return bool true on success
132
+	 */
133
+	public static function rrmdir($src)
134
+	{
135
+		// Only continue if user is a 'global' Admin
136
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
137
+			return false;
138
+		}
139
+
140
+		// If source is not a directory stop processing
141
+		if (!is_dir($src)) {
142
+			return false;
143
+		}
144
+
145
+		$success = true;
146
+
147
+		// Open the source directory to read in files
148
+		$iterator = new \DirectoryIterator($src);
149
+		foreach ($iterator as $fObj) {
150
+			if ($fObj->isFile()) {
151
+				$filename = $fObj->getPathname();
152
+				$fObj     = null; // clear this iterator object to close the file
153
+				if (!unlink($filename)) {
154
+					return false; // couldn't delete the file
155
+				}
156
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
157
+				// Try recursively on directory
158
+				self::rrmdir($fObj->getPathname());
159
+			}
160
+		}
161
+		$iterator = null;   // clear iterator Obj to close file/directory
162
+		return rmdir($src); // remove the directory & return results
163
+	}
164
+
165
+	/**
166
+	 * Recursively move files from one directory to another
167
+	 *
168
+	 * @param string $src  - Source of files being moved
169
+	 * @param string $dest - Destination of files being moved
170
+	 *
171
+	 * @return bool true on success
172
+	 */
173
+	public static function rmove($src, $dest)
174
+	{
175
+		// Only continue if user is a 'global' Admin
176
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
177
+			return false;
178
+		}
179
+
180
+		// If source is not a directory stop processing
181
+		if (!is_dir($src)) {
182
+			return false;
183
+		}
184
+
185
+		// If the destination directory does not exist and could not be created stop processing
186
+		if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
187
+			return false;
188
+		}
189
+
190
+		// Open the source directory to read in files
191
+		$iterator = new \DirectoryIterator($src);
192
+		foreach ($iterator as $fObj) {
193
+			if ($fObj->isFile()) {
194
+				rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
195
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
196
+				// Try recursively on directory
197
+				self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
198
+				//                rmdir($fObj->getPath()); // now delete the directory
199
+			}
200
+		}
201
+		$iterator = null;   // clear iterator Obj to close file/directory
202
+		return rmdir($src); // remove the directory & return results
203
+	}
204
+
205
+	/**
206
+	 * Recursively copy directories and files from one directory to another
207
+	 *
208
+	 * @param string $src  - Source of files being moved
209
+	 * @param string $dest - Destination of files being moved
210
+	 *
211
+	 * @uses \Xmf\Module\Helper::getHelper()
212
+	 * @uses \Xmf\Module\Helper::isUserAdmin()
213
+	 *
214
+	 * @return bool true on success
215
+	 */
216
+	public static function rcopy($src, $dest)
217
+	{
218
+		// Only continue if user is a 'global' Admin
219
+		if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
220
+			return false;
221
+		}
222
+
223
+		// If source is not a directory stop processing
224
+		if (!is_dir($src)) {
225
+			return false;
226
+		}
227
+
228
+		// If the destination directory does not exist and could not be created stop processing
229
+		if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
230
+			return false;
231
+		}
232
+
233
+		// Open the source directory to read in files
234
+		$iterator = new \DirectoryIterator($src);
235
+		foreach ($iterator as $fObj) {
236
+			if ($fObj->isFile()) {
237
+				copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
238
+			} elseif (!$fObj->isDot() && $fObj->isDir()) {
239
+				self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
240
+			}
241
+		}
242
+		return true;
243
+	}
244 244
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
                     throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
33 33
                 }
34 34
 
35
-                file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>');
35
+                file_put_contents($folder.'/index.html', '<script>history.go(-1);</script>');
36 36
             }
37 37
         } catch (\Exception $e) {
38 38
             echo 'Caught exception: ', $e->getMessage(), "\n", '<br>';
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         if (!mkdir($dst) && !is_dir($dst)) {
61 61
             while (false !== ($file = readdir($dir))) {
62 62
                 if (('.' !== $file) && ('..' !== $file)) {
63
-                    if (is_dir($src . '/' . $file)) {
64
-                        self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
65
-                    } else {
66
-                        copy($src . '/' . $file, $dst . '/' . $file);
63
+                    if (is_dir($src.'/'.$file)) {
64
+                        self::recurseCopy($src.'/'.$file, $dst.'/'.$file);
65
+                    }else {
66
+                        copy($src.'/'.$file, $dst.'/'.$file);
67 67
                     }
68 68
                 }
69 69
             }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                     if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
103 103
                         break;
104 104
                     }
105
-                } else {
105
+                }else {
106 106
                     // delete the file
107 107
                     if (!($success = unlink($fileInfo->getRealPath()))) {
108 108
                         break;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
             if ($success) {
114 114
                 $success = rmdir($dirInfo->getRealPath());
115 115
             }
116
-        } else {
116
+        }else {
117 117
             // input is not a valid directory
118 118
             $success = false;
119 119
         }
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 self::rrmdir($fObj->getPathname());
159 159
             }
160 160
         }
161
-        $iterator = null;   // clear iterator Obj to close file/directory
161
+        $iterator = null; // clear iterator Obj to close file/directory
162 162
         return rmdir($src); // remove the directory & return results
163 163
     }
164 164
 
@@ -191,14 +191,14 @@  discard block
 block discarded – undo
191 191
         $iterator = new \DirectoryIterator($src);
192 192
         foreach ($iterator as $fObj) {
193 193
             if ($fObj->isFile()) {
194
-                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
194
+                rename($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
195 195
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
196 196
                 // Try recursively on directory
197
-                self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
197
+                self::rmove($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
198 198
                 //                rmdir($fObj->getPath()); // now delete the directory
199 199
             }
200 200
         }
201
-        $iterator = null;   // clear iterator Obj to close file/directory
201
+        $iterator = null; // clear iterator Obj to close file/directory
202 202
         return rmdir($src); // remove the directory & return results
203 203
     }
204 204
 
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
         $iterator = new \DirectoryIterator($src);
235 235
         foreach ($iterator as $fObj) {
236 236
             if ($fObj->isFile()) {
237
-                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
237
+                copy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
238 238
             } elseif (!$fObj->isDot() && $fObj->isDir()) {
239
-                self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
239
+                self::rcopy($fObj->getPathname(), "{$dest}/".$fObj->getFilename());
240 240
             }
241 241
         }
242 242
         return true;
Please login to merge, or discard this patch.
class/Common/Configurator.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -27,35 +27,35 @@
 block discarded – undo
27 27
  */
28 28
 class Configurator
29 29
 {
30
-    public $name;
31
-    public $paths           = [];
32
-    public $uploadFolders   = [];
33
-    public $copyBlankFiles  = [];
34
-    public $copyTestFolders = [];
35
-    public $templateFolders = [];
36
-    public $oldFiles        = [];
37
-    public $oldFolders      = [];
38
-    public $modCopyright;
30
+	public $name;
31
+	public $paths           = [];
32
+	public $uploadFolders   = [];
33
+	public $copyBlankFiles  = [];
34
+	public $copyTestFolders = [];
35
+	public $templateFolders = [];
36
+	public $oldFiles        = [];
37
+	public $oldFolders      = [];
38
+	public $modCopyright;
39 39
 
40
-    /**
41
-     * Configurator constructor.
42
-     */
43
-    public function __construct()
44
-    {
45
-        $moduleDirName = basename(dirname(__DIR__));
46
-        $capsDirName   = strtoupper($moduleDirName);
40
+	/**
41
+	 * Configurator constructor.
42
+	 */
43
+	public function __construct()
44
+	{
45
+		$moduleDirName = basename(dirname(__DIR__));
46
+		$capsDirName   = strtoupper($moduleDirName);
47 47
 
48
-        require_once __DIR__ . '/../../include/config.php';
49
-        $config = getConfig();
48
+		require_once __DIR__ . '/../../include/config.php';
49
+		$config = getConfig();
50 50
 
51
-        $this->name            = $config->name;
52
-        $this->paths           = $config->paths;
53
-        $this->uploadFolders   = $config->uploadFolders;
54
-        $this->copyBlankFiles  = $config->copyBlankFiles;
55
-        $this->copyTestFolders = $config->copyTestFolders;
56
-        $this->templateFolders = $config->templateFolders;
57
-        $this->oldFiles        = $config->oldFiles;
58
-        $this->oldFolders      = $config->oldFolders;
59
-        $this->modCopyright    = $config->modCopyright;
60
-    }
51
+		$this->name            = $config->name;
52
+		$this->paths           = $config->paths;
53
+		$this->uploadFolders   = $config->uploadFolders;
54
+		$this->copyBlankFiles  = $config->copyBlankFiles;
55
+		$this->copyTestFolders = $config->copyTestFolders;
56
+		$this->templateFolders = $config->templateFolders;
57
+		$this->oldFiles        = $config->oldFiles;
58
+		$this->oldFolders      = $config->oldFolders;
59
+		$this->modCopyright    = $config->modCopyright;
60
+	}
61 61
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
  *
21 21
  */
22 22
 
23
-require_once __DIR__ . '/../../include/common.php';
23
+require_once __DIR__.'/../../include/common.php';
24 24
 
25 25
 /**
26 26
  * Class Configurator
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $moduleDirName = basename(dirname(__DIR__));
46 46
         $capsDirName   = strtoupper($moduleDirName);
47 47
 
48
-        require_once __DIR__ . '/../../include/config.php';
48
+        require_once __DIR__.'/../../include/config.php';
49 49
         $config = getConfig();
50 50
 
51 51
         $this->name            = $config->name;
Please login to merge, or discard this patch.