Completed
Push — master ( b3fce7...c570af )
by Michael
02:32
created
class/Utility.php 3 patches
Doc Comments   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
     /**
400 400
      * Thanks to the NewBB2 Development Team
401
-     * @param $target
401
+     * @param string $target
402 402
      * @return bool
403 403
      */
404 404
     public static function mkdirAsAdmin($target)
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 
552 552
     /**
553 553
      * @param $dirname
554
-     * @return bool
554
+     * @return boolean|null
555 555
      */
556 556
     public static function deleteFile($dirname)
557 557
     {
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
     }
745 745
 
746 746
     /**
747
-     * @param $name
747
+     * @param string $name
748 748
      */
749 749
     public static function closeCollapsable($name)
750 750
     {
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
     }
755 755
 
756 756
     /**
757
-     * @param     $name
757
+     * @param     string $name
758 758
      * @param     $value
759 759
      * @param int $time
760 760
      */
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
     }
769 769
 
770 770
     /**
771
-     * @param         $name
771
+     * @param         string $name
772 772
      * @param  string $default
773 773
      * @return string
774 774
      */
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
     }
918 918
 
919 919
     /**
920
-     * @param $src
920
+     * @param string $src
921 921
      */
922 922
     public static function addScript($src)
923 923
     {
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
     }
1097 1097
 
1098 1098
     /**
1099
-     * @param $module
1100
-     * @param $file
1099
+     * @param string $module
1100
+     * @param string $file
1101 1101
      */
1102 1102
     public static function loadLanguageFile($module, $file)
1103 1103
     {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
      * This function should be able to cover almost all floats that appear in an european environment.
1216 1216
      * @param            $str
1217 1217
      * @param  bool      $set
1218
-     * @return float|int
1218
+     * @return double
1219 1219
      */
1220 1220
     public static function getFloat($str, $set = false)
1221 1221
     {
@@ -1250,7 +1250,7 @@  discard block
 block discarded – undo
1250 1250
     /**
1251 1251
      * @param                         $var
1252 1252
      * @param  bool                   $currencyObj
1253
-     * @return float|int|mixed|string
1253
+     * @return string
1254 1254
      */
1255 1255
     public static function getCurrency($var, $currencyObj = false)
1256 1256
     {
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
 
1279 1279
     /**
1280 1280
      * @param $var
1281
-     * @return float|int|mixed|string
1281
+     * @return string
1282 1282
      */
1283 1283
     public static function float($var)
1284 1284
     {
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
     /**
1327 1327
      * @param $moduleName
1328 1328
      * @param $items
1329
-     * @return array
1329
+     * @return string[]
1330 1330
      */
1331 1331
     public static function getTablesArray($moduleName, $items)
1332 1332
     {
Please login to merge, or discard this patch.
Indentation   +1241 added lines, -1241 removed lines patch added patch discarded remove patch
@@ -9,186 +9,186 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class Utility
11 11
 {
12
-    use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits
13
-
14
-    use Common\ServerStats; // getServerStats Trait
15
-
16
-    use Common\FilesManagement; // Files Management Trait
17
-
18
-    //--------------- Custom module methods -----------------------------
19
-
20
-
21
-
22
-    /**
23
-     * @param $cssfile
24
-     * @return string
25
-     */
26
-    public static function getCssLink($cssfile)
27
-    {
28
-        $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">';
29
-
30
-        return $ret;
31
-    }
32
-
33
-    /**
34
-     * @return string
35
-     */
36
-    public static function getPageBeforeForm()
37
-    {
38
-        global $smart_previous_page;
39
-
40
-        return isset($_POST['smart_page_before_form']) ? $_POST['smart_page_before_form'] : $smart_previous_page;
41
-    }
42
-
43
-    /**
44
-     * Checks if a user is admin of $module
45
-     *
46
-     * @param  bool $module
47
-     * @return bool: true if user is admin
48
-     */
49
-    public static function userIsAdmin($module = false)
50
-    {
51
-        global $xoopsUser;
52
-        static $smart_isAdmin;
53
-        if (!$module) {
54
-            global $xoopsModule;
55
-            $module = $xoopsModule->getVar('dirname');
56
-        }
57
-        if (isset($smart_isAdmin[$module])) {
58
-            return $smart_isAdmin[$module];
59
-        }
60
-        if (!$xoopsUser) {
61
-            $smart_isAdmin[$module] = false;
62
-
63
-            return $smart_isAdmin[$module];
64
-        }
65
-        $smart_isAdmin[$module] = false;
66
-        $smartModule            = static::getModuleInfo($module);
67
-        if (!is_object($smartModule)) {
68
-            return false;
69
-        }
70
-        $module_id              = $smartModule->getVar('mid');
71
-        $smart_isAdmin[$module] = $xoopsUser->isAdmin($module_id);
72
-
73
-        return $smart_isAdmin[$module];
74
-    }
75
-
76
-    /**
77
-     * @return bool
78
-     */
79
-    public static function isXoops22()
80
-    {
81
-        $xoops22 = false;
82
-        $xv      = str_replace('XOOPS ', '', XOOPS_VERSION);
83
-        if ('2' == substr($xv, 2, 1)) {
84
-            $xoops22 = true;
85
-        }
86
-
87
-        return $xoops22;
88
-    }
89
-
90
-    /**
91
-     * @param  bool $withLink
92
-     * @param  bool $forBreadCrumb
93
-     * @param  bool $moduleName
94
-     * @return string
95
-     */
96
-    public static function getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false)
97
-    {
98
-        if (!$moduleName) {
99
-            global $xoopsModule;
100
-            $moduleName = $xoopsModule->getVar('dirname');
101
-        }
102
-        $smartModule       = static::getModuleInfo($moduleName);
103
-        $smartModuleConfig = static::getModuleConfig($moduleName);
104
-        if (!isset($smartModule)) {
105
-            return '';
106
-        }
107
-
108
-        if ($forBreadCrumb
109
-            && (isset($smartModuleConfig['show_mod_name_breadcrumb'])
110
-                && !$smartModuleConfig['show_mod_name_breadcrumb'])) {
111
-            return '';
112
-        }
113
-        if (!$withLink) {
114
-            return $smartModule->getVar('name');
115
-        } else {
116
-            $seoMode = static::getModuleModeSEO($moduleName);
117
-            if ('rewrite' === $seoMode) {
118
-                $seoModuleName = static::getModuleNameForSEO($moduleName);
119
-                $ret           = XOOPS_URL . '/' . $seoModuleName . '/';
120
-            } elseif ('pathinfo' === $seoMode) {
121
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/';
122
-            } else {
123
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/';
124
-            }
125
-
126
-            return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>';
127
-        }
128
-    }
129
-
130
-    /**
131
-     * @param  bool $moduleName
132
-     * @return string
133
-     */
134
-    public static function getModuleNameForSEO($moduleName = false)
135
-    {
136
-        $smartModule       = static::getModuleInfo($moduleName);
137
-        $smartModuleConfig = static::getModuleConfig($moduleName);
138
-        if (isset($smartModuleConfig['seo_module_name'])) {
139
-            return $smartModuleConfig['seo_module_name'];
140
-        }
141
-        $ret = static::getModuleName(false, false, $moduleName);
142
-
143
-        return strtolower($ret);
144
-    }
145
-
146
-    /**
147
-     * @param  bool $moduleName
148
-     * @return bool
149
-     */
150
-    public static function getModuleModeSEO($moduleName = false)
151
-    {
152
-        $smartModule       = static::getModuleInfo($moduleName);
153
-        $smartModuleConfig = static::getModuleConfig($moduleName);
154
-
155
-        return isset($smartModuleConfig['seo_mode']) ? $smartModuleConfig['seo_mode'] : false;
156
-    }
157
-
158
-    /**
159
-     * @param  bool $moduleName
160
-     * @return bool
161
-     */
162
-    public static function getModuleIncludeIdSEO($moduleName = false)
163
-    {
164
-        $smartModule       = static::getModuleInfo($moduleName);
165
-        $smartModuleConfig = static::getModuleConfig($moduleName);
166
-
167
-        return !empty($smartModuleConfig['seo_inc_id']);
168
-    }
169
-
170
-    /**
171
-     * @param $key
172
-     * @return string
173
-     */
174
-    public static function getEnv($key)
175
-    {
176
-        $ret = '';
177
-        $ret = isset($_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : '');
178
-
179
-        return $ret;
180
-    }
181
-
182
-    public static function getXoopsCpHeader()
183
-    {
184
-        xoops_cp_header();
185
-        global $xoopsModule, $xoopsConfig;
186
-        /**
187
-         * include SmartObject admin language file
188
-         */
189
-        /** @var Smartobject\Helper $helper */
190
-        $helper = Smartobject\Helper::getInstance();
191
-        $helper->loadLanguage('admin'); ?>
12
+	use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits
13
+
14
+	use Common\ServerStats; // getServerStats Trait
15
+
16
+	use Common\FilesManagement; // Files Management Trait
17
+
18
+	//--------------- Custom module methods -----------------------------
19
+
20
+
21
+
22
+	/**
23
+	 * @param $cssfile
24
+	 * @return string
25
+	 */
26
+	public static function getCssLink($cssfile)
27
+	{
28
+		$ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">';
29
+
30
+		return $ret;
31
+	}
32
+
33
+	/**
34
+	 * @return string
35
+	 */
36
+	public static function getPageBeforeForm()
37
+	{
38
+		global $smart_previous_page;
39
+
40
+		return isset($_POST['smart_page_before_form']) ? $_POST['smart_page_before_form'] : $smart_previous_page;
41
+	}
42
+
43
+	/**
44
+	 * Checks if a user is admin of $module
45
+	 *
46
+	 * @param  bool $module
47
+	 * @return bool: true if user is admin
48
+	 */
49
+	public static function userIsAdmin($module = false)
50
+	{
51
+		global $xoopsUser;
52
+		static $smart_isAdmin;
53
+		if (!$module) {
54
+			global $xoopsModule;
55
+			$module = $xoopsModule->getVar('dirname');
56
+		}
57
+		if (isset($smart_isAdmin[$module])) {
58
+			return $smart_isAdmin[$module];
59
+		}
60
+		if (!$xoopsUser) {
61
+			$smart_isAdmin[$module] = false;
62
+
63
+			return $smart_isAdmin[$module];
64
+		}
65
+		$smart_isAdmin[$module] = false;
66
+		$smartModule            = static::getModuleInfo($module);
67
+		if (!is_object($smartModule)) {
68
+			return false;
69
+		}
70
+		$module_id              = $smartModule->getVar('mid');
71
+		$smart_isAdmin[$module] = $xoopsUser->isAdmin($module_id);
72
+
73
+		return $smart_isAdmin[$module];
74
+	}
75
+
76
+	/**
77
+	 * @return bool
78
+	 */
79
+	public static function isXoops22()
80
+	{
81
+		$xoops22 = false;
82
+		$xv      = str_replace('XOOPS ', '', XOOPS_VERSION);
83
+		if ('2' == substr($xv, 2, 1)) {
84
+			$xoops22 = true;
85
+		}
86
+
87
+		return $xoops22;
88
+	}
89
+
90
+	/**
91
+	 * @param  bool $withLink
92
+	 * @param  bool $forBreadCrumb
93
+	 * @param  bool $moduleName
94
+	 * @return string
95
+	 */
96
+	public static function getModuleName($withLink = true, $forBreadCrumb = false, $moduleName = false)
97
+	{
98
+		if (!$moduleName) {
99
+			global $xoopsModule;
100
+			$moduleName = $xoopsModule->getVar('dirname');
101
+		}
102
+		$smartModule       = static::getModuleInfo($moduleName);
103
+		$smartModuleConfig = static::getModuleConfig($moduleName);
104
+		if (!isset($smartModule)) {
105
+			return '';
106
+		}
107
+
108
+		if ($forBreadCrumb
109
+			&& (isset($smartModuleConfig['show_mod_name_breadcrumb'])
110
+				&& !$smartModuleConfig['show_mod_name_breadcrumb'])) {
111
+			return '';
112
+		}
113
+		if (!$withLink) {
114
+			return $smartModule->getVar('name');
115
+		} else {
116
+			$seoMode = static::getModuleModeSEO($moduleName);
117
+			if ('rewrite' === $seoMode) {
118
+				$seoModuleName = static::getModuleNameForSEO($moduleName);
119
+				$ret           = XOOPS_URL . '/' . $seoModuleName . '/';
120
+			} elseif ('pathinfo' === $seoMode) {
121
+				$ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/';
122
+			} else {
123
+				$ret = XOOPS_URL . '/modules/' . $moduleName . '/';
124
+			}
125
+
126
+			return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>';
127
+		}
128
+	}
129
+
130
+	/**
131
+	 * @param  bool $moduleName
132
+	 * @return string
133
+	 */
134
+	public static function getModuleNameForSEO($moduleName = false)
135
+	{
136
+		$smartModule       = static::getModuleInfo($moduleName);
137
+		$smartModuleConfig = static::getModuleConfig($moduleName);
138
+		if (isset($smartModuleConfig['seo_module_name'])) {
139
+			return $smartModuleConfig['seo_module_name'];
140
+		}
141
+		$ret = static::getModuleName(false, false, $moduleName);
142
+
143
+		return strtolower($ret);
144
+	}
145
+
146
+	/**
147
+	 * @param  bool $moduleName
148
+	 * @return bool
149
+	 */
150
+	public static function getModuleModeSEO($moduleName = false)
151
+	{
152
+		$smartModule       = static::getModuleInfo($moduleName);
153
+		$smartModuleConfig = static::getModuleConfig($moduleName);
154
+
155
+		return isset($smartModuleConfig['seo_mode']) ? $smartModuleConfig['seo_mode'] : false;
156
+	}
157
+
158
+	/**
159
+	 * @param  bool $moduleName
160
+	 * @return bool
161
+	 */
162
+	public static function getModuleIncludeIdSEO($moduleName = false)
163
+	{
164
+		$smartModule       = static::getModuleInfo($moduleName);
165
+		$smartModuleConfig = static::getModuleConfig($moduleName);
166
+
167
+		return !empty($smartModuleConfig['seo_inc_id']);
168
+	}
169
+
170
+	/**
171
+	 * @param $key
172
+	 * @return string
173
+	 */
174
+	public static function getEnv($key)
175
+	{
176
+		$ret = '';
177
+		$ret = isset($_SERVER[$key]) ? $_SERVER[$key] : (isset($_ENV[$key]) ? $_ENV[$key] : '');
178
+
179
+		return $ret;
180
+	}
181
+
182
+	public static function getXoopsCpHeader()
183
+	{
184
+		xoops_cp_header();
185
+		global $xoopsModule, $xoopsConfig;
186
+		/**
187
+		 * include SmartObject admin language file
188
+		 */
189
+		/** @var Smartobject\Helper $helper */
190
+		$helper = Smartobject\Helper::getInstance();
191
+		$helper->loadLanguage('admin'); ?>
192 192
 
193 193
         <script type='text/javascript'>
194 194
             <!--
@@ -202,504 +202,504 @@  discard block
 block discarded – undo
202 202
             src='<?php echo SMARTOBJECT_URL ?>include/smart.js'></script>
203 203
         <?php
204 204
 
205
-        /**
206
-         * Include the admin language constants for the SmartObject Framework
207
-         */
208
-        /** @var Smartobject\Helper $helper */
209
-        $helper = Smartobject\Helper::getInstance();
210
-        $helper->loadLanguage('admin');
211
-    }
212
-
213
-    /**
214
-     * Detemines if a table exists in the current db
215
-     *
216
-     * @param  string $table the table name (without XOOPS prefix)
217
-     * @return bool   True if table exists, false if not
218
-     *
219
-     * @access public
220
-     * @author xhelp development team
221
-     */
222
-    public static function isTable($table)
223
-    {
224
-        $bRetVal = false;
225
-        //Verifies that a MySQL table exists
226
-        $xoopsDB  = \XoopsDatabaseFactory::getDatabaseConnection();
227
-        $realname = $xoopsDB->prefix($table);
228
-        $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
229
-        $ret      = $xoopsDB->queryF($sql);
230
-        while (false !== (list($m_table) = $xoopsDB->fetchRow($ret))) {
231
-            if ($m_table == $realname) {
232
-                $bRetVal = true;
233
-                break;
234
-            }
235
-        }
236
-        $xoopsDB->freeRecordSet($ret);
237
-
238
-        return $bRetVal;
239
-    }
240
-
241
-    /**
242
-     * Gets a value from a key in the xhelp_meta table
243
-     *
244
-     * @param  string $key
245
-     * @param  bool   $moduleName
246
-     * @return string $value
247
-     *
248
-     * @access public
249
-     * @author xhelp development team
250
-     */
251
-    public static function getMeta($key, $moduleName = false)
252
-    {
253
-        if (!$moduleName) {
254
-            $moduleName = static::getCurrentModuleName();
255
-        }
256
-        $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
257
-        $sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key));
258
-        $ret     = $xoopsDB->query($sql);
259
-        if (!$ret) {
260
-            $value = false;
261
-        } else {
262
-            list($value) = $xoopsDB->fetchRow($ret);
263
-        }
264
-
265
-        return $value;
266
-    }
267
-
268
-    /**
269
-     * @return bool
270
-     */
271
-    public static function getCurrentModuleName()
272
-    {
273
-        global $xoopsModule;
274
-        if (is_object($xoopsModule)) {
275
-            return $xoopsModule->getVar('dirname');
276
-        } else {
277
-            return false;
278
-        }
279
-    }
280
-
281
-    /**
282
-     * Sets a value for a key in the xhelp_meta table
283
-     *
284
-     * @param  string $key
285
-     * @param  string $value
286
-     * @param  bool   $moduleName
287
-     * @return bool   TRUE if success, FALSE if failure
288
-     *
289
-     * @access public
290
-     * @author xhelp development team
291
-     */
292
-    public static function setMeta($key, $value, $moduleName = false)
293
-    {
294
-        if (!$moduleName) {
295
-            $moduleName = static::getCurrentModuleName();
296
-        }
297
-        $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
298
-        $ret     = static::getMeta($key, $moduleName);
299
-        if ('0' === $ret || $ret > 0) {
300
-            $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
301
-        } else {
302
-            $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
303
-        }
304
-        $ret = $xoopsDB->queryF($sql);
305
-        if (!$ret) {
306
-            return false;
307
-        }
308
-
309
-        return true;
310
-    }
311
-
312
-    // Thanks to Mithrandir:-)
313
-    /**
314
-     * @param         $str
315
-     * @param         $start
316
-     * @param         $length
317
-     * @param  string $trimmarker
318
-     * @return string
319
-     */
320
-    public static function getSubstr($str, $start, $length, $trimmarker = '...')
321
-    {
322
-        // if the string is empty, let's get out ;-)
323
-        if ('' === $str) {
324
-            return $str;
325
-        }
326
-        // reverse a string that is shortened with '' as trimmarker
327
-        $reversed_string = strrev(xoops_substr($str, $start, $length, ''));
328
-        // find first space in reversed string
329
-        $position_of_space = strpos($reversed_string, ' ', 0);
330
-        // truncate the original string to a length of $length
331
-        // minus the position of the last space
332
-        // plus the length of the $trimmarker
333
-        $truncated_string = xoops_substr($str, $start, $length - $position_of_space + strlen($trimmarker), $trimmarker);
334
-
335
-        return $truncated_string;
336
-    }
337
-
338
-    /**
339
-     * @param              $key
340
-     * @param  bool        $moduleName
341
-     * @param  string      $default
342
-     * @return null|string
343
-     */
344
-    public static function getConfig($key, $moduleName = false, $default = 'default_is_undefined')
345
-    {
346
-        if (!$moduleName) {
347
-            $moduleName = static::getCurrentModuleName();
348
-        }
349
-        $configs = static::getModuleConfig($moduleName);
350
-        if (isset($configs[$key])) {
351
-            return $configs[$key];
352
-        } else {
353
-            if ('default_is_undefined' === $default) {
354
-                return null;
355
-            } else {
356
-                return $default;
357
-            }
358
-        }
359
-    }
360
-
361
-    /**
362
-     * Copy a file, or a folder and its contents
363
-     *
364
-     * @author      Aidan Lister <[email protected]>
365
-     * @param  string $source The source
366
-     * @param  string $dest   The destination
367
-     * @return bool   Returns true on success, false on failure
368
-     */
369
-    public static function copyr($source, $dest)
370
-    {
371
-        // Simple copy for a file
372
-        if (is_file($source)) {
373
-            return copy($source, $dest);
374
-        }
375
-        // Make destination directory
376
-        if (!is_dir($dest)) {
377
-            mkdir($dest);
378
-        }
379
-        // Loop through the folder
380
-        $dir = dir($source);
381
-        while (false !== $entry = $dir->read()) {
382
-            // Skip pointers
383
-            if ('.' === $entry || '..' === $entry) {
384
-                continue;
385
-            }
386
-            // Deep copy directories
387
-            if (is_dir("$source/$entry") && ("$source/$entry" !== $dest)) {
388
-                static::copyr("$source/$entry", "$dest/$entry");
389
-            } else {
390
-                copy("$source/$entry", "$dest/$entry");
391
-            }
392
-        }
393
-        // Clean up
394
-        $dir->close();
395
-
396
-        return true;
397
-    }
398
-
399
-    /**
400
-     * Thanks to the NewBB2 Development Team
401
-     * @param $target
402
-     * @return bool
403
-     */
404
-    public static function mkdirAsAdmin($target)
405
-    {
406
-        // http://www.php.net/manual/en/function.mkdir.php
407
-        // saint at corenova.com
408
-        // bart at cdasites dot com
409
-        if (is_dir($target) || empty($target)) {
410
-            return true; // best case check first
411
-        }
412
-        if (file_exists($target) && !is_dir($target)) {
413
-            return false;
414
-        }
415
-        if (static::mkdirAsAdmin(substr($target, 0, strrpos($target, '/')))) {
416
-            if (!file_exists($target)) {
417
-                $res = mkdir($target, 0777); // crawl back up & create dir tree
418
-                static::chmodAsAdmin($target);
419
-
420
-                return $res;
421
-            }
422
-        }
423
-        $res = is_dir($target);
424
-
425
-        return $res;
426
-    }
427
-
428
-    /**
429
-     * Thanks to the NewBB2 Development Team
430
-     * @param       $target
431
-     * @param  int  $mode
432
-     * @return bool
433
-     */
434
-    public static function chmodAsAdmin($target, $mode = 0777)
435
-    {
436
-        return @ chmod($target, $mode);
437
-    }
438
-
439
-    /**
440
-     * @param $src
441
-     * @param $maxWidth
442
-     * @param $maxHeight
443
-     * @return array
444
-     */
445
-    public static function imageResize($src, $maxWidth, $maxHeight)
446
-    {
447
-        $width  = '';
448
-        $height = '';
449
-        $type   = '';
450
-        $attr   = '';
451
-        if (file_exists($src)) {
452
-            list($width, $height, $type, $attr) = getimagesize($src);
453
-            if ($width > $maxWidth) {
454
-                $originalWidth = $width;
455
-                $width         = $maxWidth;
456
-                $height        = $width * $height / $originalWidth;
457
-            }
458
-            if ($height > $maxHeight) {
459
-                $originalHeight = $height;
460
-                $height         = $maxHeight;
461
-                $width          = $height * $width / $originalHeight;
462
-            }
463
-            $attr = " width='$width' height='$height'";
464
-        }
465
-
466
-        return [
467
-            $width,
468
-            $height,
469
-            $type,
470
-            $attr
471
-        ];
472
-    }
473
-
474
-    /**
475
-     * @param  bool $moduleName
476
-     * @return mixed
477
-     */
478
-    public static function getModuleInfo($moduleName = false)
479
-    {
480
-        static $smartModules;
481
-        if (isset($smartModules[$moduleName])) {
482
-            $ret =& $smartModules[$moduleName];
483
-
484
-            return $ret;
485
-        }
486
-        global $xoopsModule;
487
-        if (!$moduleName) {
488
-            if (isset($xoopsModule) && is_object($xoopsModule)) {
489
-                $smartModules[$xoopsModule->getVar('dirname')] = $xoopsModule;
490
-
491
-                return $smartModules[$xoopsModule->getVar('dirname')];
492
-            }
493
-        }
494
-        if (!isset($smartModules[$moduleName])) {
495
-            if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) {
496
-                $smartModules[$moduleName] = $xoopsModule;
497
-            } else {
498
-                $hModule = xoops_getHandler('module');
499
-                if ('xoops' !== $moduleName) {
500
-                    $smartModules[$moduleName] = $hModule->getByDirname($moduleName);
501
-                } else {
502
-                    $smartModules[$moduleName] = $hModule->getByDirname('system');
503
-                }
504
-            }
505
-        }
506
-
507
-        return $smartModules[$moduleName];
508
-    }
509
-
510
-    /**
511
-     * @param  bool $moduleName
512
-     * @return bool
513
-     */
514
-    public static function getModuleConfig($moduleName = false)
515
-    {
516
-        static $smartConfigs;
517
-        if (isset($smartConfigs[$moduleName])) {
518
-            $ret =& $smartConfigs[$moduleName];
519
-
520
-            return $ret;
521
-        }
522
-        global $xoopsModule, $xoopsModuleConfig;
523
-        if (!$moduleName) {
524
-            if (isset($xoopsModule) && is_object($xoopsModule)) {
525
-                $smartConfigs[$xoopsModule->getVar('dirname')] = $xoopsModuleConfig;
526
-
527
-                return $smartConfigs[$xoopsModule->getVar('dirname')];
528
-            }
529
-        }
530
-        // if we still did not found the xoopsModule, this is because there is none
531
-        if (!$moduleName) {
532
-            $ret = false;
533
-
534
-            return $ret;
535
-        }
536
-        if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) {
537
-            $smartConfigs[$moduleName] = $xoopsModuleConfig;
538
-        } else {
539
-            $module = static::getModuleInfo($moduleName);
540
-            if (!is_object($module)) {
541
-                $ret = false;
542
-
543
-                return $ret;
544
-            }
545
-            $hModConfig                = xoops_getHandler('config');
546
-            $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
547
-        }
548
-
549
-        return $smartConfigs[$moduleName];
550
-    }
551
-
552
-    /**
553
-     * @param $dirname
554
-     * @return bool
555
-     */
556
-    public static function deleteFile($dirname)
557
-    {
558
-        // Simple delete for a file
559
-        if (is_file($dirname)) {
560
-            return unlink($dirname);
561
-        }
562
-    }
563
-
564
-    /**
565
-     * @param  array $errors
566
-     * @return string
567
-     */
568
-    public static function formatErrors($errors = [])
569
-    {
570
-        $ret = '';
571
-        foreach ($errors as $key => $value) {
572
-            $ret .= '<br> - ' . $value;
573
-        }
574
-
575
-        return $ret;
576
-    }
577
-
578
-    /**
579
-     * getLinkedUnameFromId()
580
-     *
581
-     * @param  integer $userid Userid of poster etc
582
-     * @param  integer $name   :  0 Use Usenamer 1 Use realname
583
-     * @param  array   $users
584
-     * @param  bool    $withContact
585
-     * @return string
586
-     */
587
-    public static function getLinkedUnameFromId($userid = 0, $name = 0, $users = [], $withContact = false)
588
-    {
589
-        if (!is_numeric($userid)) {
590
-            return $userid;
591
-        }
592
-        $userid = (int)$userid;
593
-        if ($userid > 0) {
594
-            if ($users == []) {
595
-                //fetching users
596
-                $memberHandler = xoops_getHandler('member');
597
-                $user          =& $memberHandler->getUser($userid);
598
-            } else {
599
-                if (!isset($users[$userid])) {
600
-                    return $GLOBALS['xoopsConfig']['anonymous'];
601
-                }
602
-                $user =& $users[$userid];
603
-            }
604
-            if (is_object($user)) {
605
-                $ts        = \MyTextSanitizer:: getInstance();
606
-                $username  = $user->getVar('uname');
607
-                $fullname  = '';
608
-                $fullname2 = $user->getVar('name');
609
-                if ($name && !empty($fullname2)) {
610
-                    $fullname = $user->getVar('name');
611
-                }
612
-                if (!empty($fullname)) {
613
-                    $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
614
-                } else {
615
-                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
616
-                }
617
-                // add contact info: email + PM
618
-                if ($withContact) {
619
-                    $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>';
620
-                    $js         = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);";
621
-                    $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>';
622
-                }
623
-
624
-                return $linkeduser;
625
-            }
626
-        }
627
-
628
-        return $GLOBALS['xoopsConfig']['anonymous'];
629
-    }
630
-
631
-    /**
632
-     * @param int    $currentoption
633
-     * @param string $breadcrumb
634
-     * @param bool   $submenus
635
-     * @param int    $currentsub
636
-     */
637
-    public static function getAdminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1)
638
-    {
639
-        global $xoopsModule, $xoopsConfig;
640
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
641
-
642
-
643
-        /** @var Smartobject\Helper $helper */
644
-        $helper = Smartobject\Helper::getInstance();
645
-        $helper->loadLanguage('admin');
646
-        $helper->loadLanguage('modinfo');
647
-        $headermenu  = [];
648
-        $adminObject = [];
649
-        include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php';
650
-        $tpl = new \XoopsTpl();
651
-        $tpl->assign([
652
-                         'headermenu'      => $headermenu,
653
-                         'adminmenu'       => $adminObject,
654
-                         'current'         => $currentoption,
655
-                         'breadcrumb'      => $breadcrumb,
656
-                         'headermenucount' => count($headermenu),
657
-                         'submenus'        => $submenus,
658
-                         'currentsub'      => $currentsub,
659
-                         'submenuscount'   => count($submenus)
660
-                     ]);
661
-        $tpl->display('db:smartobject_admin_menu.tpl');
662
-    }
663
-
664
-    /**
665
-     * @param string $id
666
-     * @param string $title
667
-     * @param string $dsc
668
-     */
669
-    public static function getCollapsableBar($id = '', $title = '', $dsc = '')
670
-    {
671
-        global $xoopsModule;
672
-        echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>";
673
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
674
-        echo "<div id='" . $id . "'>";
675
-        if ('' !== $dsc) {
676
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
677
-        }
678
-    }
679
-
680
-    /**
681
-     * @param string $id
682
-     * @param string $title
683
-     * @param string $dsc
684
-     */
685
-    public static function getAjaxCollapsableBar($id = '', $title = '', $dsc = '')
686
-    {
687
-        global $xoopsModule;
688
-        $onClick = "ajaxtogglecollapse('$id')";
689
-        //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')";
690
-        echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">';
691
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
692
-        echo "<div id='" . $id . "'>";
693
-        if ('' !== $dsc) {
694
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
695
-        }
696
-    }
697
-
698
-    /**
699
-     * Ajax testing......
700
-     * @param $name
701
-     */
702
-    /*
205
+		/**
206
+		 * Include the admin language constants for the SmartObject Framework
207
+		 */
208
+		/** @var Smartobject\Helper $helper */
209
+		$helper = Smartobject\Helper::getInstance();
210
+		$helper->loadLanguage('admin');
211
+	}
212
+
213
+	/**
214
+	 * Detemines if a table exists in the current db
215
+	 *
216
+	 * @param  string $table the table name (without XOOPS prefix)
217
+	 * @return bool   True if table exists, false if not
218
+	 *
219
+	 * @access public
220
+	 * @author xhelp development team
221
+	 */
222
+	public static function isTable($table)
223
+	{
224
+		$bRetVal = false;
225
+		//Verifies that a MySQL table exists
226
+		$xoopsDB  = \XoopsDatabaseFactory::getDatabaseConnection();
227
+		$realname = $xoopsDB->prefix($table);
228
+		$sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
229
+		$ret      = $xoopsDB->queryF($sql);
230
+		while (false !== (list($m_table) = $xoopsDB->fetchRow($ret))) {
231
+			if ($m_table == $realname) {
232
+				$bRetVal = true;
233
+				break;
234
+			}
235
+		}
236
+		$xoopsDB->freeRecordSet($ret);
237
+
238
+		return $bRetVal;
239
+	}
240
+
241
+	/**
242
+	 * Gets a value from a key in the xhelp_meta table
243
+	 *
244
+	 * @param  string $key
245
+	 * @param  bool   $moduleName
246
+	 * @return string $value
247
+	 *
248
+	 * @access public
249
+	 * @author xhelp development team
250
+	 */
251
+	public static function getMeta($key, $moduleName = false)
252
+	{
253
+		if (!$moduleName) {
254
+			$moduleName = static::getCurrentModuleName();
255
+		}
256
+		$xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
257
+		$sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key));
258
+		$ret     = $xoopsDB->query($sql);
259
+		if (!$ret) {
260
+			$value = false;
261
+		} else {
262
+			list($value) = $xoopsDB->fetchRow($ret);
263
+		}
264
+
265
+		return $value;
266
+	}
267
+
268
+	/**
269
+	 * @return bool
270
+	 */
271
+	public static function getCurrentModuleName()
272
+	{
273
+		global $xoopsModule;
274
+		if (is_object($xoopsModule)) {
275
+			return $xoopsModule->getVar('dirname');
276
+		} else {
277
+			return false;
278
+		}
279
+	}
280
+
281
+	/**
282
+	 * Sets a value for a key in the xhelp_meta table
283
+	 *
284
+	 * @param  string $key
285
+	 * @param  string $value
286
+	 * @param  bool   $moduleName
287
+	 * @return bool   TRUE if success, FALSE if failure
288
+	 *
289
+	 * @access public
290
+	 * @author xhelp development team
291
+	 */
292
+	public static function setMeta($key, $value, $moduleName = false)
293
+	{
294
+		if (!$moduleName) {
295
+			$moduleName = static::getCurrentModuleName();
296
+		}
297
+		$xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
298
+		$ret     = static::getMeta($key, $moduleName);
299
+		if ('0' === $ret || $ret > 0) {
300
+			$sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
301
+		} else {
302
+			$sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
303
+		}
304
+		$ret = $xoopsDB->queryF($sql);
305
+		if (!$ret) {
306
+			return false;
307
+		}
308
+
309
+		return true;
310
+	}
311
+
312
+	// Thanks to Mithrandir:-)
313
+	/**
314
+	 * @param         $str
315
+	 * @param         $start
316
+	 * @param         $length
317
+	 * @param  string $trimmarker
318
+	 * @return string
319
+	 */
320
+	public static function getSubstr($str, $start, $length, $trimmarker = '...')
321
+	{
322
+		// if the string is empty, let's get out ;-)
323
+		if ('' === $str) {
324
+			return $str;
325
+		}
326
+		// reverse a string that is shortened with '' as trimmarker
327
+		$reversed_string = strrev(xoops_substr($str, $start, $length, ''));
328
+		// find first space in reversed string
329
+		$position_of_space = strpos($reversed_string, ' ', 0);
330
+		// truncate the original string to a length of $length
331
+		// minus the position of the last space
332
+		// plus the length of the $trimmarker
333
+		$truncated_string = xoops_substr($str, $start, $length - $position_of_space + strlen($trimmarker), $trimmarker);
334
+
335
+		return $truncated_string;
336
+	}
337
+
338
+	/**
339
+	 * @param              $key
340
+	 * @param  bool        $moduleName
341
+	 * @param  string      $default
342
+	 * @return null|string
343
+	 */
344
+	public static function getConfig($key, $moduleName = false, $default = 'default_is_undefined')
345
+	{
346
+		if (!$moduleName) {
347
+			$moduleName = static::getCurrentModuleName();
348
+		}
349
+		$configs = static::getModuleConfig($moduleName);
350
+		if (isset($configs[$key])) {
351
+			return $configs[$key];
352
+		} else {
353
+			if ('default_is_undefined' === $default) {
354
+				return null;
355
+			} else {
356
+				return $default;
357
+			}
358
+		}
359
+	}
360
+
361
+	/**
362
+	 * Copy a file, or a folder and its contents
363
+	 *
364
+	 * @author      Aidan Lister <[email protected]>
365
+	 * @param  string $source The source
366
+	 * @param  string $dest   The destination
367
+	 * @return bool   Returns true on success, false on failure
368
+	 */
369
+	public static function copyr($source, $dest)
370
+	{
371
+		// Simple copy for a file
372
+		if (is_file($source)) {
373
+			return copy($source, $dest);
374
+		}
375
+		// Make destination directory
376
+		if (!is_dir($dest)) {
377
+			mkdir($dest);
378
+		}
379
+		// Loop through the folder
380
+		$dir = dir($source);
381
+		while (false !== $entry = $dir->read()) {
382
+			// Skip pointers
383
+			if ('.' === $entry || '..' === $entry) {
384
+				continue;
385
+			}
386
+			// Deep copy directories
387
+			if (is_dir("$source/$entry") && ("$source/$entry" !== $dest)) {
388
+				static::copyr("$source/$entry", "$dest/$entry");
389
+			} else {
390
+				copy("$source/$entry", "$dest/$entry");
391
+			}
392
+		}
393
+		// Clean up
394
+		$dir->close();
395
+
396
+		return true;
397
+	}
398
+
399
+	/**
400
+	 * Thanks to the NewBB2 Development Team
401
+	 * @param $target
402
+	 * @return bool
403
+	 */
404
+	public static function mkdirAsAdmin($target)
405
+	{
406
+		// http://www.php.net/manual/en/function.mkdir.php
407
+		// saint at corenova.com
408
+		// bart at cdasites dot com
409
+		if (is_dir($target) || empty($target)) {
410
+			return true; // best case check first
411
+		}
412
+		if (file_exists($target) && !is_dir($target)) {
413
+			return false;
414
+		}
415
+		if (static::mkdirAsAdmin(substr($target, 0, strrpos($target, '/')))) {
416
+			if (!file_exists($target)) {
417
+				$res = mkdir($target, 0777); // crawl back up & create dir tree
418
+				static::chmodAsAdmin($target);
419
+
420
+				return $res;
421
+			}
422
+		}
423
+		$res = is_dir($target);
424
+
425
+		return $res;
426
+	}
427
+
428
+	/**
429
+	 * Thanks to the NewBB2 Development Team
430
+	 * @param       $target
431
+	 * @param  int  $mode
432
+	 * @return bool
433
+	 */
434
+	public static function chmodAsAdmin($target, $mode = 0777)
435
+	{
436
+		return @ chmod($target, $mode);
437
+	}
438
+
439
+	/**
440
+	 * @param $src
441
+	 * @param $maxWidth
442
+	 * @param $maxHeight
443
+	 * @return array
444
+	 */
445
+	public static function imageResize($src, $maxWidth, $maxHeight)
446
+	{
447
+		$width  = '';
448
+		$height = '';
449
+		$type   = '';
450
+		$attr   = '';
451
+		if (file_exists($src)) {
452
+			list($width, $height, $type, $attr) = getimagesize($src);
453
+			if ($width > $maxWidth) {
454
+				$originalWidth = $width;
455
+				$width         = $maxWidth;
456
+				$height        = $width * $height / $originalWidth;
457
+			}
458
+			if ($height > $maxHeight) {
459
+				$originalHeight = $height;
460
+				$height         = $maxHeight;
461
+				$width          = $height * $width / $originalHeight;
462
+			}
463
+			$attr = " width='$width' height='$height'";
464
+		}
465
+
466
+		return [
467
+			$width,
468
+			$height,
469
+			$type,
470
+			$attr
471
+		];
472
+	}
473
+
474
+	/**
475
+	 * @param  bool $moduleName
476
+	 * @return mixed
477
+	 */
478
+	public static function getModuleInfo($moduleName = false)
479
+	{
480
+		static $smartModules;
481
+		if (isset($smartModules[$moduleName])) {
482
+			$ret =& $smartModules[$moduleName];
483
+
484
+			return $ret;
485
+		}
486
+		global $xoopsModule;
487
+		if (!$moduleName) {
488
+			if (isset($xoopsModule) && is_object($xoopsModule)) {
489
+				$smartModules[$xoopsModule->getVar('dirname')] = $xoopsModule;
490
+
491
+				return $smartModules[$xoopsModule->getVar('dirname')];
492
+			}
493
+		}
494
+		if (!isset($smartModules[$moduleName])) {
495
+			if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) {
496
+				$smartModules[$moduleName] = $xoopsModule;
497
+			} else {
498
+				$hModule = xoops_getHandler('module');
499
+				if ('xoops' !== $moduleName) {
500
+					$smartModules[$moduleName] = $hModule->getByDirname($moduleName);
501
+				} else {
502
+					$smartModules[$moduleName] = $hModule->getByDirname('system');
503
+				}
504
+			}
505
+		}
506
+
507
+		return $smartModules[$moduleName];
508
+	}
509
+
510
+	/**
511
+	 * @param  bool $moduleName
512
+	 * @return bool
513
+	 */
514
+	public static function getModuleConfig($moduleName = false)
515
+	{
516
+		static $smartConfigs;
517
+		if (isset($smartConfigs[$moduleName])) {
518
+			$ret =& $smartConfigs[$moduleName];
519
+
520
+			return $ret;
521
+		}
522
+		global $xoopsModule, $xoopsModuleConfig;
523
+		if (!$moduleName) {
524
+			if (isset($xoopsModule) && is_object($xoopsModule)) {
525
+				$smartConfigs[$xoopsModule->getVar('dirname')] = $xoopsModuleConfig;
526
+
527
+				return $smartConfigs[$xoopsModule->getVar('dirname')];
528
+			}
529
+		}
530
+		// if we still did not found the xoopsModule, this is because there is none
531
+		if (!$moduleName) {
532
+			$ret = false;
533
+
534
+			return $ret;
535
+		}
536
+		if (isset($xoopsModule) && is_object($xoopsModule) && $xoopsModule->getVar('dirname') == $moduleName) {
537
+			$smartConfigs[$moduleName] = $xoopsModuleConfig;
538
+		} else {
539
+			$module = static::getModuleInfo($moduleName);
540
+			if (!is_object($module)) {
541
+				$ret = false;
542
+
543
+				return $ret;
544
+			}
545
+			$hModConfig                = xoops_getHandler('config');
546
+			$smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
547
+		}
548
+
549
+		return $smartConfigs[$moduleName];
550
+	}
551
+
552
+	/**
553
+	 * @param $dirname
554
+	 * @return bool
555
+	 */
556
+	public static function deleteFile($dirname)
557
+	{
558
+		// Simple delete for a file
559
+		if (is_file($dirname)) {
560
+			return unlink($dirname);
561
+		}
562
+	}
563
+
564
+	/**
565
+	 * @param  array $errors
566
+	 * @return string
567
+	 */
568
+	public static function formatErrors($errors = [])
569
+	{
570
+		$ret = '';
571
+		foreach ($errors as $key => $value) {
572
+			$ret .= '<br> - ' . $value;
573
+		}
574
+
575
+		return $ret;
576
+	}
577
+
578
+	/**
579
+	 * getLinkedUnameFromId()
580
+	 *
581
+	 * @param  integer $userid Userid of poster etc
582
+	 * @param  integer $name   :  0 Use Usenamer 1 Use realname
583
+	 * @param  array   $users
584
+	 * @param  bool    $withContact
585
+	 * @return string
586
+	 */
587
+	public static function getLinkedUnameFromId($userid = 0, $name = 0, $users = [], $withContact = false)
588
+	{
589
+		if (!is_numeric($userid)) {
590
+			return $userid;
591
+		}
592
+		$userid = (int)$userid;
593
+		if ($userid > 0) {
594
+			if ($users == []) {
595
+				//fetching users
596
+				$memberHandler = xoops_getHandler('member');
597
+				$user          =& $memberHandler->getUser($userid);
598
+			} else {
599
+				if (!isset($users[$userid])) {
600
+					return $GLOBALS['xoopsConfig']['anonymous'];
601
+				}
602
+				$user =& $users[$userid];
603
+			}
604
+			if (is_object($user)) {
605
+				$ts        = \MyTextSanitizer:: getInstance();
606
+				$username  = $user->getVar('uname');
607
+				$fullname  = '';
608
+				$fullname2 = $user->getVar('name');
609
+				if ($name && !empty($fullname2)) {
610
+					$fullname = $user->getVar('name');
611
+				}
612
+				if (!empty($fullname)) {
613
+					$linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
614
+				} else {
615
+					$linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
616
+				}
617
+				// add contact info: email + PM
618
+				if ($withContact) {
619
+					$linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>';
620
+					$js         = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);";
621
+					$linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>';
622
+				}
623
+
624
+				return $linkeduser;
625
+			}
626
+		}
627
+
628
+		return $GLOBALS['xoopsConfig']['anonymous'];
629
+	}
630
+
631
+	/**
632
+	 * @param int    $currentoption
633
+	 * @param string $breadcrumb
634
+	 * @param bool   $submenus
635
+	 * @param int    $currentsub
636
+	 */
637
+	public static function getAdminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1)
638
+	{
639
+		global $xoopsModule, $xoopsConfig;
640
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
641
+
642
+
643
+		/** @var Smartobject\Helper $helper */
644
+		$helper = Smartobject\Helper::getInstance();
645
+		$helper->loadLanguage('admin');
646
+		$helper->loadLanguage('modinfo');
647
+		$headermenu  = [];
648
+		$adminObject = [];
649
+		include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php';
650
+		$tpl = new \XoopsTpl();
651
+		$tpl->assign([
652
+						 'headermenu'      => $headermenu,
653
+						 'adminmenu'       => $adminObject,
654
+						 'current'         => $currentoption,
655
+						 'breadcrumb'      => $breadcrumb,
656
+						 'headermenucount' => count($headermenu),
657
+						 'submenus'        => $submenus,
658
+						 'currentsub'      => $currentsub,
659
+						 'submenuscount'   => count($submenus)
660
+					 ]);
661
+		$tpl->display('db:smartobject_admin_menu.tpl');
662
+	}
663
+
664
+	/**
665
+	 * @param string $id
666
+	 * @param string $title
667
+	 * @param string $dsc
668
+	 */
669
+	public static function getCollapsableBar($id = '', $title = '', $dsc = '')
670
+	{
671
+		global $xoopsModule;
672
+		echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>";
673
+		echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
674
+		echo "<div id='" . $id . "'>";
675
+		if ('' !== $dsc) {
676
+			echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
677
+		}
678
+	}
679
+
680
+	/**
681
+	 * @param string $id
682
+	 * @param string $title
683
+	 * @param string $dsc
684
+	 */
685
+	public static function getAjaxCollapsableBar($id = '', $title = '', $dsc = '')
686
+	{
687
+		global $xoopsModule;
688
+		$onClick = "ajaxtogglecollapse('$id')";
689
+		//$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')";
690
+		echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">';
691
+		echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
692
+		echo "<div id='" . $id . "'>";
693
+		if ('' !== $dsc) {
694
+			echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
695
+		}
696
+	}
697
+
698
+	/**
699
+	 * Ajax testing......
700
+	 * @param $name
701
+	 */
702
+	/*
703 703
      public static function getCollapsableBar($id = '', $title = '', $dsc='')
704 704
      {
705 705
     
@@ -717,22 +717,22 @@  discard block
 block discarded – undo
717 717
      }
718 718
      }
719 719
      */
720
-    public static function opencloseCollapsable($name)
721
-    {
722
-        $urls        = static::getCurrentUrls();
723
-        $path        = $urls['phpself'];
724
-        $cookie_name = $path . '_smart_collaps_' . $name;
725
-        $cookie_name = str_replace('.', '_', $cookie_name);
726
-        $cookie      = static::getCookieVar($cookie_name, '');
727
-        if ('none' === $cookie) {
728
-            echo '
720
+	public static function opencloseCollapsable($name)
721
+	{
722
+		$urls        = static::getCurrentUrls();
723
+		$path        = $urls['phpself'];
724
+		$cookie_name = $path . '_smart_collaps_' . $name;
725
+		$cookie_name = str_replace('.', '_', $cookie_name);
726
+		$cookie      = static::getCookieVar($cookie_name, '');
727
+		if ('none' === $cookie) {
728
+			echo '
729 729
                 <script type="text/javascript"><!--
730 730
                 togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon");
731 731
                     //-->
732 732
                 </script>
733 733
                 ';
734
-        }
735
-        /*  if ($cookie == 'none') {
734
+		}
735
+		/*  if ($cookie == 'none') {
736 736
          echo '
737 737
          <script type="text/javascript"><!--
738 738
          hideElement("' . $name . '");
@@ -741,96 +741,96 @@  discard block
 block discarded – undo
741 741
          ';
742 742
          }
743 743
          */
744
-    }
745
-
746
-    /**
747
-     * @param $name
748
-     */
749
-    public static function closeCollapsable($name)
750
-    {
751
-        echo '</div>';
752
-        static::opencloseCollapsable($name);
753
-        echo '<br>';
754
-    }
755
-
756
-    /**
757
-     * @param     $name
758
-     * @param     $value
759
-     * @param int $time
760
-     */
761
-    public static function setCookieVar($name, $value, $time = 0)
762
-    {
763
-        if (0 == $time) {
764
-            $time = time() + 3600 * 24 * 365;
765
-            //$time = '';
766
-        }
767
-        setcookie($name, $value, $time, '/');
768
-    }
769
-
770
-    /**
771
-     * @param         $name
772
-     * @param  string $default
773
-     * @return string
774
-     */
775
-    public static function getCookieVar($name, $default = '')
776
-    {
777
-        $name = str_replace('.', '_', $name);
778
-        if (isset($_COOKIE[$name]) && ($_COOKIE[$name] > '')) {
779
-            return $_COOKIE[$name];
780
-        } else {
781
-            return $default;
782
-        }
783
-    }
784
-
785
-    /**
786
-     * @return array
787
-     */
788
-    public static function getCurrentUrls()
789
-    {
790
-        $urls        = [];
791
-        $http        = (false === strpos(XOOPS_URL, 'https://')) ? 'http://' : 'https://';
792
-        $phpself     = $_SERVER['PHP_SELF'];
793
-        $httphost    = $_SERVER['HTTP_HOST'];
794
-        $querystring = $_SERVER['QUERY_STRING'];
795
-        if ('' !== $querystring) {
796
-            $querystring = '?' . $querystring;
797
-        }
798
-        $currenturl           = $http . $httphost . $phpself . $querystring;
799
-        $urls                 = [];
800
-        $urls['http']         = $http;
801
-        $urls['httphost']     = $httphost;
802
-        $urls['phpself']      = $phpself;
803
-        $urls['querystring']  = $querystring;
804
-        $urls['full_phpself'] = $http . $httphost . $phpself;
805
-        $urls['full']         = $currenturl;
806
-        $urls['isHomePage']   = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself);
807
-
808
-        return $urls;
809
-    }
810
-
811
-    /**
812
-     * @return mixed
813
-     */
814
-    public static function getCurrentPage()
815
-    {
816
-        $urls = static::getCurrentUrls();
817
-
818
-        return $urls['full'];
819
-    }
820
-
821
-    /**
822
-     * Create a title for the short_url field of an article
823
-     *
824
-     * @credit psylove
825
-     *
826
-     * @var    string $title   title of the article
827
-     * @var    string $withExt do we add an html extension or not
828
-     * @return string sort_url for the article
829
-     */
830
-    /**
831
-     * Moved in SmartMetaGenClass
832
-     */
833
-    /*
744
+	}
745
+
746
+	/**
747
+	 * @param $name
748
+	 */
749
+	public static function closeCollapsable($name)
750
+	{
751
+		echo '</div>';
752
+		static::opencloseCollapsable($name);
753
+		echo '<br>';
754
+	}
755
+
756
+	/**
757
+	 * @param     $name
758
+	 * @param     $value
759
+	 * @param int $time
760
+	 */
761
+	public static function setCookieVar($name, $value, $time = 0)
762
+	{
763
+		if (0 == $time) {
764
+			$time = time() + 3600 * 24 * 365;
765
+			//$time = '';
766
+		}
767
+		setcookie($name, $value, $time, '/');
768
+	}
769
+
770
+	/**
771
+	 * @param         $name
772
+	 * @param  string $default
773
+	 * @return string
774
+	 */
775
+	public static function getCookieVar($name, $default = '')
776
+	{
777
+		$name = str_replace('.', '_', $name);
778
+		if (isset($_COOKIE[$name]) && ($_COOKIE[$name] > '')) {
779
+			return $_COOKIE[$name];
780
+		} else {
781
+			return $default;
782
+		}
783
+	}
784
+
785
+	/**
786
+	 * @return array
787
+	 */
788
+	public static function getCurrentUrls()
789
+	{
790
+		$urls        = [];
791
+		$http        = (false === strpos(XOOPS_URL, 'https://')) ? 'http://' : 'https://';
792
+		$phpself     = $_SERVER['PHP_SELF'];
793
+		$httphost    = $_SERVER['HTTP_HOST'];
794
+		$querystring = $_SERVER['QUERY_STRING'];
795
+		if ('' !== $querystring) {
796
+			$querystring = '?' . $querystring;
797
+		}
798
+		$currenturl           = $http . $httphost . $phpself . $querystring;
799
+		$urls                 = [];
800
+		$urls['http']         = $http;
801
+		$urls['httphost']     = $httphost;
802
+		$urls['phpself']      = $phpself;
803
+		$urls['querystring']  = $querystring;
804
+		$urls['full_phpself'] = $http . $httphost . $phpself;
805
+		$urls['full']         = $currenturl;
806
+		$urls['isHomePage']   = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself);
807
+
808
+		return $urls;
809
+	}
810
+
811
+	/**
812
+	 * @return mixed
813
+	 */
814
+	public static function getCurrentPage()
815
+	{
816
+		$urls = static::getCurrentUrls();
817
+
818
+		return $urls['full'];
819
+	}
820
+
821
+	/**
822
+	 * Create a title for the short_url field of an article
823
+	 *
824
+	 * @credit psylove
825
+	 *
826
+	 * @var    string $title   title of the article
827
+	 * @var    string $withExt do we add an html extension or not
828
+	 * @return string sort_url for the article
829
+	 */
830
+	/**
831
+	 * Moved in SmartMetaGenClass
832
+	 */
833
+	/*
834 834
      public static function smart_seo_title($title='', $withExt=true)
835 835
      {
836 836
      // Transformation de la chaine en minuscule
@@ -876,468 +876,468 @@  discard block
 block discarded – undo
876 876
      return '';
877 877
      }
878 878
      */
879
-    public static function getModFooter()
880
-    {
881
-        global $xoopsConfig, $xoopsModule;
882
-
883
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
884
-        $tpl = new \XoopsTpl();
885
-
886
-        $hModule      = xoops_getHandler('module');
887
-        $versioninfo  =& $hModule->get($xoopsModule->getVar('mid'));
888
-        $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . '';
889
-        $modfooter    = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>";
890
-        $tpl->assign('modfooter', $modfooter);
891
-
892
-        if (!defined('_AM_SOBJECT_XOOPS_PRO')) {
893
-            define('_AM_SOBJECT_XOOPS_PRO', 'Do you need help with this module ?<br>Do you need new features not yet available?');
894
-        }
895
-        $smartobjectConfig = static::getModuleConfig('smartobject');
896
-        $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']);
897
-        $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl');
898
-    }
899
-
900
-    public static function getXoopsCpFooter()
901
-    {
902
-        static::getModFooter();
903
-        xoops_cp_footer();
904
-    }
905
-
906
-    /**
907
-     * @param $text
908
-     * @return mixed
909
-     */
910
-    public static function sanitizeForCommonTags($text)
911
-    {
912
-        global $xoopsConfig;
913
-        $text = str_replace('{X_SITENAME}', $xoopsConfig['sitename'], $text);
914
-        $text = str_replace('{X_ADMINMAIL}', $xoopsConfig['adminmail'], $text);
915
-
916
-        return $text;
917
-    }
918
-
919
-    /**
920
-     * @param $src
921
-     */
922
-    public static function addScript($src)
923
-    {
924
-        echo '<script src="' . $src . '" type="text/javascript"></script>';
925
-    }
926
-
927
-    /**
928
-     * @param $src
929
-     */
930
-    public static function addStyle($src)
931
-    {
932
-        if ('smartobject' === $src) {
933
-            $src = SMARTOBJECT_URL . 'assets/css/module.css';
934
-        }
935
-        echo static::getCssLink($src);
936
-    }
937
-
938
-    public static function addAdminAjaxSupport()
939
-    {
940
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js');
941
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js');
942
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js');
943
-    }
944
-
945
-    /**
946
-     * @param $text
947
-     * @return mixed
948
-     */
949
-    public static function sanitizeForSmartpopupLink($text)
950
-    {
951
-        $patterns[]     = "/\[smartpopup=(['\"]?)([^\"'<>]*)\\1](.*)\[\/smartpopup\]/sU";
952
-        $replacements[] = "<a href=\"javascript:openWithSelfMain('\\2', 'smartpopup', 700, 519);\">\\3</a>";
953
-        $ret            = preg_replace($patterns, $replacements, $text);
954
-
955
-        return $ret;
956
-    }
957
-
958
-    /**
959
-     * Finds the width and height of an image (can also be a flash file)
960
-     *
961
-     * @credit phppp
962
-     *
963
-     * @var    string $url    path of the image file
964
-     * @var    string $width  reference to the width
965
-     * @var    string $height reference to the height
966
-     * @return bool   false if impossible to find dimension
967
-     */
968
-    public static function getImageSize($url, & $width, & $height)
969
-    {
970
-        if (empty($width) || empty($height)) {
971
-            if (!$dimension = @ getimagesize($url)) {
972
-                return false;
973
-            }
974
-            if (!empty($width)) {
975
-                $height = $dimension[1] * $width / $dimension[0];
976
-            } elseif (!empty($height)) {
977
-                $width = $dimension[0] * $height / $dimension[1];
978
-            } else {
979
-                list($width, $height) = [
980
-                    $dimension[0],
981
-                    $dimension[1]
982
-                ];
983
-            }
984
-
985
-            return true;
986
-        } else {
987
-            return true;
988
-        }
989
-    }
990
-
991
-    /**
992
-     * Convert characters to decimal values
993
-     *
994
-     * @author eric.wallet at yahoo.fr
995
-     * @link   http://ca.php.net/manual/en/function.htmlentities.php#69913
996
-     * @param $str
997
-     * @return mixed
998
-     */
999
-    public static function getHtmlnumericentities($str)
1000
-    {
1001
-        //    return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str);
1002
-        return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) {
1003
-            return '&#' . ord($m[0]) . chr(59);
1004
-        }, $str);
1005
-    }
1006
-
1007
-    /**
1008
-     * @param        $name
1009
-     * @param  bool  $optional
1010
-     * @return mixed
1011
-     */
1012
-    public static function getCoreHandler($name, $optional = false)
1013
-    {
1014
-        static $handlers;
1015
-        $name = strtolower(trim($name));
1016
-        if (!isset($handlers[$name])) {
1017
-            if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) {
1018
-                require_once $hnd_file;
1019
-            }
1020
-            $class = 'Xoops' . ucfirst($name) . 'Handler';
1021
-            if (class_exists($class)) {
1022
-                $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops');
1023
-            }
1024
-        }
1025
-        if (!isset($handlers[$name]) && !$optional) {
1026
-            trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
1027
-        }
1028
-        if (isset($handlers[$name])) {
1029
-            return $handlers[$name];
1030
-        }
1031
-        $inst = false;
1032
-    }
1033
-
1034
-    /**
1035
-     * @param $matches
1036
-     * @return string
1037
-     */
1038
-    public static function sanitizeAdsenses_callback($matches)
1039
-    {
1040
-        global $smartobjectAdsenseHandler;
1041
-        if (isset($smartobjectAdsenseHandler->objects[$matches[1]])) {
1042
-            $adsenseObj = $smartobjectAdsenseHandler->objects[$matches[1]];
1043
-            $ret        = $adsenseObj->render();
1044
-
1045
-            return $ret;
1046
-        } else {
1047
-            return '';
1048
-        }
1049
-    }
1050
-
1051
-    /**
1052
-     * @param $text
1053
-     * @return mixed
1054
-     */
1055
-    public static function sanitizeAdsenses($text)
1056
-    {
1057
-        $patterns     = [];
1058
-        $replacements = [];
1059
-
1060
-        $patterns[] = "/\[adsense](.*)\[\/adsense\]/sU";
1061
-        $text       = preg_replace_callback($patterns, 'Smartobject\Utility::sanitizeAdsenses_callback', $text);
1062
-
1063
-        return $text;
1064
-    }
1065
-
1066
-    /**
1067
-     * @param $matches
1068
-     * @return string
1069
-     */
1070
-    public static function sanitizeCustomtags_callback($matches)
1071
-    {
1072
-        global $smartobjectCustomtagHandler;
1073
-        if (isset($smartobjectCustomtagHandler->objects[$matches[1]])) {
1074
-            $customObj = $smartobjectCustomtagHandler->objects[$matches[1]];
1075
-            $ret       = $customObj->renderWithPhp();
1076
-
1077
-            return $ret;
1078
-        } else {
1079
-            return '';
1080
-        }
1081
-    }
1082
-
1083
-    /**
1084
-     * @param $text
1085
-     * @return mixed
1086
-     */
1087
-    public static function sanitizeCustomtags($text)
1088
-    {
1089
-        $patterns     = [];
1090
-        $replacements = [];
1091
-
1092
-        $patterns[] = "/\[customtag](.*)\[\/customtag\]/sU";
1093
-        $text       = preg_replace_callback($patterns, 'Smartobject\Utility::sanitizeCustomtags_callback', $text);
1094
-
1095
-        return $text;
1096
-    }
1097
-
1098
-    /**
1099
-     * @param $module
1100
-     * @param $file
1101
-     */
1102
-    public static function loadLanguageFile($module, $file)
1103
-    {
1104
-        global $xoopsConfig;
1105
-
1106
-        $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php';
1107
-        if (!file_exists($filename)) {
1108
-            $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php';
1109
-        }
1110
-        if (file_exists($filename)) {
1111
-            require_once $filename;
1112
-        }
1113
-    }
1114
-
1115
-    public static function loadCommonLanguageFile()
1116
-    {
1117
-        static::loadLanguageFile('smartobject', 'common');
1118
-    }
1119
-
1120
-    /**
1121
-     * @param               $text
1122
-     * @param  bool         $keyword
1123
-     * @return mixed|string
1124
-     */
1125
-    public static function purifyText($text, $keyword = false)
1126
-    {
1127
-        global $myts;
1128
-        $text = str_replace('&nbsp;', ' ', $text);
1129
-        $text = str_replace('<br>', ' ', $text);
1130
-        $text = str_replace('<br>', ' ', $text);
1131
-        $text = str_replace('<br', ' ', $text);
1132
-        $text = strip_tags($text);
1133
-        $text = html_entity_decode($text);
1134
-        $text = $myts->undoHtmlSpecialChars($text);
1135
-        $text = str_replace(')', ' ', $text);
1136
-        $text = str_replace('(', ' ', $text);
1137
-        $text = str_replace(':', ' ', $text);
1138
-        $text = str_replace('&euro', ' euro ', $text);
1139
-        $text = str_replace('&hellip', '...', $text);
1140
-        $text = str_replace('&rsquo', ' ', $text);
1141
-        $text = str_replace('!', ' ', $text);
1142
-        $text = str_replace('?', ' ', $text);
1143
-        $text = str_replace('"', ' ', $text);
1144
-        $text = str_replace('-', ' ', $text);
1145
-        $text = str_replace('\n', ' ', $text);
1146
-        $text = str_replace('&#8213;', ' ', $text);
1147
-
1148
-        if ($keyword) {
1149
-            $text = str_replace('.', ' ', $text);
1150
-            $text = str_replace(',', ' ', $text);
1151
-            $text = str_replace('\'', ' ', $text);
1152
-        }
1153
-        $text = str_replace(';', ' ', $text);
1154
-
1155
-        return $text;
1156
-    }
1157
-
1158
-    /**
1159
-     * @param $document
1160
-     * @return mixed
1161
-     */
1162
-    public static function getHtml2text($document)
1163
-    {
1164
-        // PHP Manual:: function preg_replace
1165
-        // $document should contain an HTML document.
1166
-        // This will remove HTML tags, javascript sections
1167
-        // and white space. It will also convert some
1168
-        // common HTML entities to their text equivalent.
1169
-        // Credits: newbb2
1170
-        $search = [
1171
-            "'<script[^>]*?>.*?</script>'si", // Strip out javascript
1172
-            "'<img.*?>'si", // Strip out img tags
1173
-            "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
1174
-            "'([\r\n])[\s]+'", // Strip out white space
1175
-            "'&(quot|#34);'i", // Replace HTML entities
1176
-            "'&(amp|#38);'i",
1177
-            "'&(lt|#60);'i",
1178
-            "'&(gt|#62);'i",
1179
-            "'&(nbsp|#160);'i",
1180
-            "'&(iexcl|#161);'i",
1181
-            "'&(cent|#162);'i",
1182
-            "'&(pound|#163);'i",
1183
-            "'&(copy|#169);'i"
1184
-        ]; // evaluate as php
1185
-
1186
-        $replace = [
1187
-            '',
1188
-            '',
1189
-            '',
1190
-            "\\1",
1191
-            '"',
1192
-            '&',
1193
-            '<',
1194
-            '>',
1195
-            ' ',
1196
-            chr(161),
1197
-            chr(162),
1198
-            chr(163),
1199
-            chr(169),
1200
-        ];
1201
-
1202
-        $text = preg_replace($search, $replace, $document);
1203
-
1204
-        preg_replace_callback('/&#(\d+);/', function ($matches) {
1205
-            return chr($matches[1]);
1206
-        }, $document);
1207
-
1208
-        return $text;
1209
-    }
1210
-
1211
-    /**
1212
-     * @author pillepop2003 at yahoo dot de
1213
-     *
1214
-     * Use this snippet to extract any float out of a string. You can choose how a single dot is treated with the (bool) 'single_dot_as_decimal' directive.
1215
-     * This function should be able to cover almost all floats that appear in an european environment.
1216
-     * @param            $str
1217
-     * @param  bool      $set
1218
-     * @return float|int
1219
-     */
1220
-    public static function getFloat($str, $set = false)
1221
-    {
1222
-        if (preg_match("/([0-9\.,-]+)/", $str, $match)) {
1223
-            // Found number in $str, so set $str that number
1224
-            $str = $match[0];
1225
-            if (false !== strpos($str, ',')) {
1226
-                // A comma exists, that makes it easy, cos we assume it separates the decimal part.
1227
-                $str = str_replace('.', '', $str);    // Erase thousand seps
1228
-                $str = str_replace(',', '.', $str);    // Convert , to . for floatval command
1229
-
1230
-                return (float)$str;
1231
-            } else {
1232
-                // No comma exists, so we have to decide, how a single dot shall be treated
1233
-                if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) {
1234
-                    // Treat single dot as decimal separator
1235
-                    return (float)$str;
1236
-                } else {
1237
-                    //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> ";
1238
-                    // Else, treat all dots as thousand seps
1239
-                    $str = str_replace('.', '', $str);    // Erase thousand seps
1240
-
1241
-                    return (float)$str;
1242
-                }
1243
-            }
1244
-        } else {
1245
-            // No number found, return zero
1246
-            return 0;
1247
-        }
1248
-    }
1249
-
1250
-    /**
1251
-     * @param                         $var
1252
-     * @param  bool                   $currencyObj
1253
-     * @return float|int|mixed|string
1254
-     */
1255
-    public static function getCurrency($var, $currencyObj = false)
1256
-    {
1257
-        $ret = static::getFloat($var, ['single_dot_as_decimal' => true]);
1258
-        $ret = round($ret, 2);
1259
-        // make sur we have at least .00 in the $var
1260
-        $decimal_section_original = strstr($ret, '.');
1261
-        $decimal_section          = $decimal_section_original;
1262
-        if ($decimal_section) {
1263
-            if (1 == strlen($decimal_section)) {
1264
-                $decimal_section = '.00';
1265
-            } elseif (2 == strlen($decimal_section)) {
1266
-                $decimal_section .= '0';
1267
-            }
1268
-            $ret = str_replace($decimal_section_original, $decimal_section, $ret);
1269
-        } else {
1270
-            $ret .= '.00';
1271
-        }
1272
-        if ($currencyObj) {
1273
-            $ret = $ret . ' ' . $currencyObj->getCode();
1274
-        }
1275
-
1276
-        return $ret;
1277
-    }
1278
-
1279
-    /**
1280
-     * @param $var
1281
-     * @return float|int|mixed|string
1282
-     */
1283
-    public static function float($var)
1284
-    {
1285
-        return static::getCurrency($var);
1286
-    }
1287
-
1288
-    /**
1289
-     * @param  bool $moduleName
1290
-     * @return string
1291
-     */
1292
-    public static function getModuleAdminLink($moduleName = false)
1293
-    {
1294
-        global $xoopsModule;
1295
-        if (!$moduleName && (isset($xoopsModule) && is_object($xoopsModule))) {
1296
-            $moduleName = $xoopsModule->getVar('dirname');
1297
-        }
1298
-        $ret = '';
1299
-        if ($moduleName) {
1300
-            $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>';
1301
-        }
1302
-
1303
-        return $ret;
1304
-    }
1305
-
1306
-    /**
1307
-     * @return array|bool
1308
-     */
1309
-    public static function getEditors()
1310
-    {
1311
-        $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php';
1312
-        if (!file_exists($filename)) {
1313
-            return false;
1314
-        }
1315
-        require_once $filename;
1316
-        $xoopseditorHandler = \XoopsEditorHandler::getInstance();
1317
-        $aList              = $xoopseditorHandler->getList();
1318
-        $ret                = [];
1319
-        foreach ($aList as $k => $v) {
1320
-            $ret[$v] = $k;
1321
-        }
1322
-
1323
-        return $ret;
1324
-    }
1325
-
1326
-    /**
1327
-     * @param $moduleName
1328
-     * @param $items
1329
-     * @return array
1330
-     */
1331
-    public static function getTablesArray($moduleName, $items)
1332
-    {
1333
-        $ret = [];
1334
-        foreach ($items as $item) {
1335
-            $ret[] = $moduleName . '_' . $item;
1336
-        }
1337
-        $ret[] = $moduleName . '_meta';
1338
-
1339
-        return $ret;
1340
-    }
879
+	public static function getModFooter()
880
+	{
881
+		global $xoopsConfig, $xoopsModule;
882
+
883
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
884
+		$tpl = new \XoopsTpl();
885
+
886
+		$hModule      = xoops_getHandler('module');
887
+		$versioninfo  =& $hModule->get($xoopsModule->getVar('mid'));
888
+		$modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . '';
889
+		$modfooter    = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>";
890
+		$tpl->assign('modfooter', $modfooter);
891
+
892
+		if (!defined('_AM_SOBJECT_XOOPS_PRO')) {
893
+			define('_AM_SOBJECT_XOOPS_PRO', 'Do you need help with this module ?<br>Do you need new features not yet available?');
894
+		}
895
+		$smartobjectConfig = static::getModuleConfig('smartobject');
896
+		$tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']);
897
+		$tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl');
898
+	}
899
+
900
+	public static function getXoopsCpFooter()
901
+	{
902
+		static::getModFooter();
903
+		xoops_cp_footer();
904
+	}
905
+
906
+	/**
907
+	 * @param $text
908
+	 * @return mixed
909
+	 */
910
+	public static function sanitizeForCommonTags($text)
911
+	{
912
+		global $xoopsConfig;
913
+		$text = str_replace('{X_SITENAME}', $xoopsConfig['sitename'], $text);
914
+		$text = str_replace('{X_ADMINMAIL}', $xoopsConfig['adminmail'], $text);
915
+
916
+		return $text;
917
+	}
918
+
919
+	/**
920
+	 * @param $src
921
+	 */
922
+	public static function addScript($src)
923
+	{
924
+		echo '<script src="' . $src . '" type="text/javascript"></script>';
925
+	}
926
+
927
+	/**
928
+	 * @param $src
929
+	 */
930
+	public static function addStyle($src)
931
+	{
932
+		if ('smartobject' === $src) {
933
+			$src = SMARTOBJECT_URL . 'assets/css/module.css';
934
+		}
935
+		echo static::getCssLink($src);
936
+	}
937
+
938
+	public static function addAdminAjaxSupport()
939
+	{
940
+		static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js');
941
+		static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js');
942
+		static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js');
943
+	}
944
+
945
+	/**
946
+	 * @param $text
947
+	 * @return mixed
948
+	 */
949
+	public static function sanitizeForSmartpopupLink($text)
950
+	{
951
+		$patterns[]     = "/\[smartpopup=(['\"]?)([^\"'<>]*)\\1](.*)\[\/smartpopup\]/sU";
952
+		$replacements[] = "<a href=\"javascript:openWithSelfMain('\\2', 'smartpopup', 700, 519);\">\\3</a>";
953
+		$ret            = preg_replace($patterns, $replacements, $text);
954
+
955
+		return $ret;
956
+	}
957
+
958
+	/**
959
+	 * Finds the width and height of an image (can also be a flash file)
960
+	 *
961
+	 * @credit phppp
962
+	 *
963
+	 * @var    string $url    path of the image file
964
+	 * @var    string $width  reference to the width
965
+	 * @var    string $height reference to the height
966
+	 * @return bool   false if impossible to find dimension
967
+	 */
968
+	public static function getImageSize($url, & $width, & $height)
969
+	{
970
+		if (empty($width) || empty($height)) {
971
+			if (!$dimension = @ getimagesize($url)) {
972
+				return false;
973
+			}
974
+			if (!empty($width)) {
975
+				$height = $dimension[1] * $width / $dimension[0];
976
+			} elseif (!empty($height)) {
977
+				$width = $dimension[0] * $height / $dimension[1];
978
+			} else {
979
+				list($width, $height) = [
980
+					$dimension[0],
981
+					$dimension[1]
982
+				];
983
+			}
984
+
985
+			return true;
986
+		} else {
987
+			return true;
988
+		}
989
+	}
990
+
991
+	/**
992
+	 * Convert characters to decimal values
993
+	 *
994
+	 * @author eric.wallet at yahoo.fr
995
+	 * @link   http://ca.php.net/manual/en/function.htmlentities.php#69913
996
+	 * @param $str
997
+	 * @return mixed
998
+	 */
999
+	public static function getHtmlnumericentities($str)
1000
+	{
1001
+		//    return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str);
1002
+		return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) {
1003
+			return '&#' . ord($m[0]) . chr(59);
1004
+		}, $str);
1005
+	}
1006
+
1007
+	/**
1008
+	 * @param        $name
1009
+	 * @param  bool  $optional
1010
+	 * @return mixed
1011
+	 */
1012
+	public static function getCoreHandler($name, $optional = false)
1013
+	{
1014
+		static $handlers;
1015
+		$name = strtolower(trim($name));
1016
+		if (!isset($handlers[$name])) {
1017
+			if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) {
1018
+				require_once $hnd_file;
1019
+			}
1020
+			$class = 'Xoops' . ucfirst($name) . 'Handler';
1021
+			if (class_exists($class)) {
1022
+				$handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops');
1023
+			}
1024
+		}
1025
+		if (!isset($handlers[$name]) && !$optional) {
1026
+			trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
1027
+		}
1028
+		if (isset($handlers[$name])) {
1029
+			return $handlers[$name];
1030
+		}
1031
+		$inst = false;
1032
+	}
1033
+
1034
+	/**
1035
+	 * @param $matches
1036
+	 * @return string
1037
+	 */
1038
+	public static function sanitizeAdsenses_callback($matches)
1039
+	{
1040
+		global $smartobjectAdsenseHandler;
1041
+		if (isset($smartobjectAdsenseHandler->objects[$matches[1]])) {
1042
+			$adsenseObj = $smartobjectAdsenseHandler->objects[$matches[1]];
1043
+			$ret        = $adsenseObj->render();
1044
+
1045
+			return $ret;
1046
+		} else {
1047
+			return '';
1048
+		}
1049
+	}
1050
+
1051
+	/**
1052
+	 * @param $text
1053
+	 * @return mixed
1054
+	 */
1055
+	public static function sanitizeAdsenses($text)
1056
+	{
1057
+		$patterns     = [];
1058
+		$replacements = [];
1059
+
1060
+		$patterns[] = "/\[adsense](.*)\[\/adsense\]/sU";
1061
+		$text       = preg_replace_callback($patterns, 'Smartobject\Utility::sanitizeAdsenses_callback', $text);
1062
+
1063
+		return $text;
1064
+	}
1065
+
1066
+	/**
1067
+	 * @param $matches
1068
+	 * @return string
1069
+	 */
1070
+	public static function sanitizeCustomtags_callback($matches)
1071
+	{
1072
+		global $smartobjectCustomtagHandler;
1073
+		if (isset($smartobjectCustomtagHandler->objects[$matches[1]])) {
1074
+			$customObj = $smartobjectCustomtagHandler->objects[$matches[1]];
1075
+			$ret       = $customObj->renderWithPhp();
1076
+
1077
+			return $ret;
1078
+		} else {
1079
+			return '';
1080
+		}
1081
+	}
1082
+
1083
+	/**
1084
+	 * @param $text
1085
+	 * @return mixed
1086
+	 */
1087
+	public static function sanitizeCustomtags($text)
1088
+	{
1089
+		$patterns     = [];
1090
+		$replacements = [];
1091
+
1092
+		$patterns[] = "/\[customtag](.*)\[\/customtag\]/sU";
1093
+		$text       = preg_replace_callback($patterns, 'Smartobject\Utility::sanitizeCustomtags_callback', $text);
1094
+
1095
+		return $text;
1096
+	}
1097
+
1098
+	/**
1099
+	 * @param $module
1100
+	 * @param $file
1101
+	 */
1102
+	public static function loadLanguageFile($module, $file)
1103
+	{
1104
+		global $xoopsConfig;
1105
+
1106
+		$filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php';
1107
+		if (!file_exists($filename)) {
1108
+			$filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php';
1109
+		}
1110
+		if (file_exists($filename)) {
1111
+			require_once $filename;
1112
+		}
1113
+	}
1114
+
1115
+	public static function loadCommonLanguageFile()
1116
+	{
1117
+		static::loadLanguageFile('smartobject', 'common');
1118
+	}
1119
+
1120
+	/**
1121
+	 * @param               $text
1122
+	 * @param  bool         $keyword
1123
+	 * @return mixed|string
1124
+	 */
1125
+	public static function purifyText($text, $keyword = false)
1126
+	{
1127
+		global $myts;
1128
+		$text = str_replace('&nbsp;', ' ', $text);
1129
+		$text = str_replace('<br>', ' ', $text);
1130
+		$text = str_replace('<br>', ' ', $text);
1131
+		$text = str_replace('<br', ' ', $text);
1132
+		$text = strip_tags($text);
1133
+		$text = html_entity_decode($text);
1134
+		$text = $myts->undoHtmlSpecialChars($text);
1135
+		$text = str_replace(')', ' ', $text);
1136
+		$text = str_replace('(', ' ', $text);
1137
+		$text = str_replace(':', ' ', $text);
1138
+		$text = str_replace('&euro', ' euro ', $text);
1139
+		$text = str_replace('&hellip', '...', $text);
1140
+		$text = str_replace('&rsquo', ' ', $text);
1141
+		$text = str_replace('!', ' ', $text);
1142
+		$text = str_replace('?', ' ', $text);
1143
+		$text = str_replace('"', ' ', $text);
1144
+		$text = str_replace('-', ' ', $text);
1145
+		$text = str_replace('\n', ' ', $text);
1146
+		$text = str_replace('&#8213;', ' ', $text);
1147
+
1148
+		if ($keyword) {
1149
+			$text = str_replace('.', ' ', $text);
1150
+			$text = str_replace(',', ' ', $text);
1151
+			$text = str_replace('\'', ' ', $text);
1152
+		}
1153
+		$text = str_replace(';', ' ', $text);
1154
+
1155
+		return $text;
1156
+	}
1157
+
1158
+	/**
1159
+	 * @param $document
1160
+	 * @return mixed
1161
+	 */
1162
+	public static function getHtml2text($document)
1163
+	{
1164
+		// PHP Manual:: function preg_replace
1165
+		// $document should contain an HTML document.
1166
+		// This will remove HTML tags, javascript sections
1167
+		// and white space. It will also convert some
1168
+		// common HTML entities to their text equivalent.
1169
+		// Credits: newbb2
1170
+		$search = [
1171
+			"'<script[^>]*?>.*?</script>'si", // Strip out javascript
1172
+			"'<img.*?>'si", // Strip out img tags
1173
+			"'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags
1174
+			"'([\r\n])[\s]+'", // Strip out white space
1175
+			"'&(quot|#34);'i", // Replace HTML entities
1176
+			"'&(amp|#38);'i",
1177
+			"'&(lt|#60);'i",
1178
+			"'&(gt|#62);'i",
1179
+			"'&(nbsp|#160);'i",
1180
+			"'&(iexcl|#161);'i",
1181
+			"'&(cent|#162);'i",
1182
+			"'&(pound|#163);'i",
1183
+			"'&(copy|#169);'i"
1184
+		]; // evaluate as php
1185
+
1186
+		$replace = [
1187
+			'',
1188
+			'',
1189
+			'',
1190
+			"\\1",
1191
+			'"',
1192
+			'&',
1193
+			'<',
1194
+			'>',
1195
+			' ',
1196
+			chr(161),
1197
+			chr(162),
1198
+			chr(163),
1199
+			chr(169),
1200
+		];
1201
+
1202
+		$text = preg_replace($search, $replace, $document);
1203
+
1204
+		preg_replace_callback('/&#(\d+);/', function ($matches) {
1205
+			return chr($matches[1]);
1206
+		}, $document);
1207
+
1208
+		return $text;
1209
+	}
1210
+
1211
+	/**
1212
+	 * @author pillepop2003 at yahoo dot de
1213
+	 *
1214
+	 * Use this snippet to extract any float out of a string. You can choose how a single dot is treated with the (bool) 'single_dot_as_decimal' directive.
1215
+	 * This function should be able to cover almost all floats that appear in an european environment.
1216
+	 * @param            $str
1217
+	 * @param  bool      $set
1218
+	 * @return float|int
1219
+	 */
1220
+	public static function getFloat($str, $set = false)
1221
+	{
1222
+		if (preg_match("/([0-9\.,-]+)/", $str, $match)) {
1223
+			// Found number in $str, so set $str that number
1224
+			$str = $match[0];
1225
+			if (false !== strpos($str, ',')) {
1226
+				// A comma exists, that makes it easy, cos we assume it separates the decimal part.
1227
+				$str = str_replace('.', '', $str);    // Erase thousand seps
1228
+				$str = str_replace(',', '.', $str);    // Convert , to . for floatval command
1229
+
1230
+				return (float)$str;
1231
+			} else {
1232
+				// No comma exists, so we have to decide, how a single dot shall be treated
1233
+				if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) {
1234
+					// Treat single dot as decimal separator
1235
+					return (float)$str;
1236
+				} else {
1237
+					//echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> ";
1238
+					// Else, treat all dots as thousand seps
1239
+					$str = str_replace('.', '', $str);    // Erase thousand seps
1240
+
1241
+					return (float)$str;
1242
+				}
1243
+			}
1244
+		} else {
1245
+			// No number found, return zero
1246
+			return 0;
1247
+		}
1248
+	}
1249
+
1250
+	/**
1251
+	 * @param                         $var
1252
+	 * @param  bool                   $currencyObj
1253
+	 * @return float|int|mixed|string
1254
+	 */
1255
+	public static function getCurrency($var, $currencyObj = false)
1256
+	{
1257
+		$ret = static::getFloat($var, ['single_dot_as_decimal' => true]);
1258
+		$ret = round($ret, 2);
1259
+		// make sur we have at least .00 in the $var
1260
+		$decimal_section_original = strstr($ret, '.');
1261
+		$decimal_section          = $decimal_section_original;
1262
+		if ($decimal_section) {
1263
+			if (1 == strlen($decimal_section)) {
1264
+				$decimal_section = '.00';
1265
+			} elseif (2 == strlen($decimal_section)) {
1266
+				$decimal_section .= '0';
1267
+			}
1268
+			$ret = str_replace($decimal_section_original, $decimal_section, $ret);
1269
+		} else {
1270
+			$ret .= '.00';
1271
+		}
1272
+		if ($currencyObj) {
1273
+			$ret = $ret . ' ' . $currencyObj->getCode();
1274
+		}
1275
+
1276
+		return $ret;
1277
+	}
1278
+
1279
+	/**
1280
+	 * @param $var
1281
+	 * @return float|int|mixed|string
1282
+	 */
1283
+	public static function float($var)
1284
+	{
1285
+		return static::getCurrency($var);
1286
+	}
1287
+
1288
+	/**
1289
+	 * @param  bool $moduleName
1290
+	 * @return string
1291
+	 */
1292
+	public static function getModuleAdminLink($moduleName = false)
1293
+	{
1294
+		global $xoopsModule;
1295
+		if (!$moduleName && (isset($xoopsModule) && is_object($xoopsModule))) {
1296
+			$moduleName = $xoopsModule->getVar('dirname');
1297
+		}
1298
+		$ret = '';
1299
+		if ($moduleName) {
1300
+			$ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>';
1301
+		}
1302
+
1303
+		return $ret;
1304
+	}
1305
+
1306
+	/**
1307
+	 * @return array|bool
1308
+	 */
1309
+	public static function getEditors()
1310
+	{
1311
+		$filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php';
1312
+		if (!file_exists($filename)) {
1313
+			return false;
1314
+		}
1315
+		require_once $filename;
1316
+		$xoopseditorHandler = \XoopsEditorHandler::getInstance();
1317
+		$aList              = $xoopseditorHandler->getList();
1318
+		$ret                = [];
1319
+		foreach ($aList as $k => $v) {
1320
+			$ret[$v] = $k;
1321
+		}
1322
+
1323
+		return $ret;
1324
+	}
1325
+
1326
+	/**
1327
+	 * @param $moduleName
1328
+	 * @param $items
1329
+	 * @return array
1330
+	 */
1331
+	public static function getTablesArray($moduleName, $items)
1332
+	{
1333
+		$ret = [];
1334
+		foreach ($items as $item) {
1335
+			$ret[] = $moduleName . '_' . $item;
1336
+		}
1337
+		$ret[] = $moduleName . '_meta';
1338
+
1339
+		return $ret;
1340
+	}
1341 1341
     
1342 1342
     
1343 1343
 }
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      */
26 26
     public static function getCssLink($cssfile)
27 27
     {
28
-        $ret = '<link rel="stylesheet" type="text/css" href="' . $cssfile . '">';
28
+        $ret = '<link rel="stylesheet" type="text/css" href="'.$cssfile.'">';
29 29
 
30 30
         return $ret;
31 31
     }
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
             $seoMode = static::getModuleModeSEO($moduleName);
117 117
             if ('rewrite' === $seoMode) {
118 118
                 $seoModuleName = static::getModuleNameForSEO($moduleName);
119
-                $ret           = XOOPS_URL . '/' . $seoModuleName . '/';
119
+                $ret           = XOOPS_URL.'/'.$seoModuleName.'/';
120 120
             } elseif ('pathinfo' === $seoMode) {
121
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/seo.php/' . $seoModuleName . '/';
121
+                $ret = XOOPS_URL.'/modules/'.$moduleName.'/seo.php/'.$seoModuleName.'/';
122 122
             } else {
123
-                $ret = XOOPS_URL . '/modules/' . $moduleName . '/';
123
+                $ret = XOOPS_URL.'/modules/'.$moduleName.'/';
124 124
             }
125 125
 
126
-            return '<a href="' . $ret . '">' . $smartModule->getVar('name') . '</a>';
126
+            return '<a href="'.$ret.'">'.$smartModule->getVar('name').'</a>';
127 127
         }
128 128
     }
129 129
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         //Verifies that a MySQL table exists
226 226
         $xoopsDB  = \XoopsDatabaseFactory::getDatabaseConnection();
227 227
         $realname = $xoopsDB->prefix($table);
228
-        $sql      = 'SHOW TABLES FROM ' . XOOPS_DB_NAME;
228
+        $sql      = 'SHOW TABLES FROM '.XOOPS_DB_NAME;
229 229
         $ret      = $xoopsDB->queryF($sql);
230 230
         while (false !== (list($m_table) = $xoopsDB->fetchRow($ret))) {
231 231
             if ($m_table == $realname) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $moduleName = static::getCurrentModuleName();
255 255
         }
256 256
         $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
257
-        $sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key));
257
+        $sql     = sprintf('SELECT metavalue FROM `%s` WHERE metakey=%s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key));
258 258
         $ret     = $xoopsDB->query($sql);
259 259
         if (!$ret) {
260 260
             $value = false;
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
         $xoopsDB = \XoopsDatabaseFactory::getDatabaseConnection();
298 298
         $ret     = static::getMeta($key, $moduleName);
299 299
         if ('0' === $ret || $ret > 0) {
300
-            $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
300
+            $sql = sprintf('UPDATE %s SET metavalue = %s WHERE metakey = %s', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($value), $xoopsDB->quoteString($key));
301 301
         } else {
302
-            $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName . '_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
302
+            $sql = sprintf('INSERT INTO %s (metakey, metavalue) VALUES (%s, %s)', $xoopsDB->prefix($moduleName.'_meta'), $xoopsDB->quoteString($key), $xoopsDB->quoteString($value));
303 303
         }
304 304
         $ret = $xoopsDB->queryF($sql);
305 305
         if (!$ret) {
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
     {
480 480
         static $smartModules;
481 481
         if (isset($smartModules[$moduleName])) {
482
-            $ret =& $smartModules[$moduleName];
482
+            $ret = & $smartModules[$moduleName];
483 483
 
484 484
             return $ret;
485 485
         }
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
     {
516 516
         static $smartConfigs;
517 517
         if (isset($smartConfigs[$moduleName])) {
518
-            $ret =& $smartConfigs[$moduleName];
518
+            $ret = & $smartConfigs[$moduleName];
519 519
 
520 520
             return $ret;
521 521
         }
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
                 return $ret;
544 544
             }
545 545
             $hModConfig                = xoops_getHandler('config');
546
-            $smartConfigs[$moduleName] =& $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
546
+            $smartConfigs[$moduleName] = & $hModConfig->getConfigsByCat(0, $module->getVar('mid'));
547 547
         }
548 548
 
549 549
         return $smartConfigs[$moduleName];
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     {
570 570
         $ret = '';
571 571
         foreach ($errors as $key => $value) {
572
-            $ret .= '<br> - ' . $value;
572
+            $ret .= '<br> - '.$value;
573 573
         }
574 574
 
575 575
         return $ret;
@@ -589,17 +589,17 @@  discard block
 block discarded – undo
589 589
         if (!is_numeric($userid)) {
590 590
             return $userid;
591 591
         }
592
-        $userid = (int)$userid;
592
+        $userid = (int) $userid;
593 593
         if ($userid > 0) {
594 594
             if ($users == []) {
595 595
                 //fetching users
596 596
                 $memberHandler = xoops_getHandler('member');
597
-                $user          =& $memberHandler->getUser($userid);
597
+                $user          = & $memberHandler->getUser($userid);
598 598
             } else {
599 599
                 if (!isset($users[$userid])) {
600 600
                     return $GLOBALS['xoopsConfig']['anonymous'];
601 601
                 }
602
-                $user =& $users[$userid];
602
+                $user = & $users[$userid];
603 603
             }
604 604
             if (is_object($user)) {
605 605
                 $ts        = \MyTextSanitizer:: getInstance();
@@ -610,15 +610,15 @@  discard block
 block discarded – undo
610 610
                     $fullname = $user->getVar('name');
611 611
                 }
612 612
                 if (!empty($fullname)) {
613
-                    $linkeduser = "$fullname [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $ts->htmlSpecialChars($username) . '</a>]';
613
+                    $linkeduser = "$fullname [<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".$ts->htmlSpecialChars($username).'</a>]';
614 614
                 } else {
615
-                    $linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . ucwords($ts->htmlSpecialChars($username)) . '</a>';
615
+                    $linkeduser = "<a href='".XOOPS_URL.'/userinfo.php?uid='.$userid."'>".ucwords($ts->htmlSpecialChars($username)).'</a>';
616 616
                 }
617 617
                 // add contact info: email + PM
618 618
                 if ($withContact) {
619
-                    $linkeduser .= ' <a href="mailto:' . $user->getVar('email') . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/email.gif' . '" alt="' . _CO_SOBJECT_SEND_EMAIL . '" title="' . _CO_SOBJECT_SEND_EMAIL . '"></a>';
620
-                    $js         = "javascript:openWithSelfMain('" . XOOPS_URL . '/pmlite.php?send2=1&to_userid=' . $userid . "', 'pmlite',450,370);";
621
-                    $linkeduser .= ' <a href="' . $js . '"><img style="vertical-align: middle;" src="' . XOOPS_URL . '/images/icons/pm.gif' . '" alt="' . _CO_SOBJECT_SEND_PM . '" title="' . _CO_SOBJECT_SEND_PM . '"></a>';
619
+                    $linkeduser .= ' <a href="mailto:'.$user->getVar('email').'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/email.gif'.'" alt="'._CO_SOBJECT_SEND_EMAIL.'" title="'._CO_SOBJECT_SEND_EMAIL.'"></a>';
620
+                    $js = "javascript:openWithSelfMain('".XOOPS_URL.'/pmlite.php?send2=1&to_userid='.$userid."', 'pmlite',450,370);";
621
+                    $linkeduser .= ' <a href="'.$js.'"><img style="vertical-align: middle;" src="'.XOOPS_URL.'/images/icons/pm.gif'.'" alt="'._CO_SOBJECT_SEND_PM.'" title="'._CO_SOBJECT_SEND_PM.'"></a>';
622 622
                 }
623 623
 
624 624
                 return $linkeduser;
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
     public static function getAdminMenu($currentoption = 0, $breadcrumb = '', $submenus = false, $currentsub = -1)
638 638
     {
639 639
         global $xoopsModule, $xoopsConfig;
640
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
640
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
641 641
 
642 642
 
643 643
         /** @var Smartobject\Helper $helper */
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
         $helper->loadLanguage('modinfo');
647 647
         $headermenu  = [];
648 648
         $adminObject = [];
649
-        include XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/menu.php';
649
+        include XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/admin/menu.php';
650 650
         $tpl = new \XoopsTpl();
651 651
         $tpl->assign([
652 652
                          'headermenu'      => $headermenu,
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
     public static function getCollapsableBar($id = '', $title = '', $dsc = '')
670 670
     {
671 671
         global $xoopsModule;
672
-        echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('" . $id . "'); toggleIcon('" . $id . "_icon')\";>";
673
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
674
-        echo "<div id='" . $id . "'>";
672
+        echo "<h3 style=\"color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; \"><a href='javascript:;' onclick=\"togglecollapse('".$id."'); toggleIcon('".$id."_icon')\";>";
673
+        echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a>&nbsp;".$title.'</h3>';
674
+        echo "<div id='".$id."'>";
675 675
         if ('' !== $dsc) {
676
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
676
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$dsc.'</span>';
677 677
         }
678 678
     }
679 679
 
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
         global $xoopsModule;
688 688
         $onClick = "ajaxtogglecollapse('$id')";
689 689
         //$onClick = "togglecollapse('$id'); toggleIcon('" . $id . "_icon')";
690
-        echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="' . $onClick . '">';
691
-        echo "<img id='" . $id . "_icon' src=" . SMARTOBJECT_URL . "assets/images/close12.gif alt=''></a>&nbsp;" . $title . '</h3>';
692
-        echo "<div id='" . $id . "'>";
690
+        echo '<h3 style="border: 1px solid; color: #2F5376; font-weight: bold; font-size: 14px; margin: 6px 0 0 0; " onclick="'.$onClick.'">';
691
+        echo "<img id='".$id."_icon' src=".SMARTOBJECT_URL."assets/images/close12.gif alt=''></a>&nbsp;".$title.'</h3>';
692
+        echo "<div id='".$id."'>";
693 693
         if ('' !== $dsc) {
694
-            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . $dsc . '</span>';
694
+            echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">'.$dsc.'</span>';
695 695
         }
696 696
     }
697 697
 
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
     {
722 722
         $urls        = static::getCurrentUrls();
723 723
         $path        = $urls['phpself'];
724
-        $cookie_name = $path . '_smart_collaps_' . $name;
724
+        $cookie_name = $path.'_smart_collaps_'.$name;
725 725
         $cookie_name = str_replace('.', '_', $cookie_name);
726 726
         $cookie      = static::getCookieVar($cookie_name, '');
727 727
         if ('none' === $cookie) {
728 728
             echo '
729 729
                 <script type="text/javascript"><!--
730
-                togglecollapse("' . $name . '"); toggleIcon("' . $name . '_icon");
730
+                togglecollapse("' . $name.'"); toggleIcon("'.$name.'_icon");
731 731
                     //-->
732 732
                 </script>
733 733
                 ';
@@ -793,17 +793,17 @@  discard block
 block discarded – undo
793 793
         $httphost    = $_SERVER['HTTP_HOST'];
794 794
         $querystring = $_SERVER['QUERY_STRING'];
795 795
         if ('' !== $querystring) {
796
-            $querystring = '?' . $querystring;
796
+            $querystring = '?'.$querystring;
797 797
         }
798
-        $currenturl           = $http . $httphost . $phpself . $querystring;
798
+        $currenturl           = $http.$httphost.$phpself.$querystring;
799 799
         $urls                 = [];
800 800
         $urls['http']         = $http;
801 801
         $urls['httphost']     = $httphost;
802 802
         $urls['phpself']      = $phpself;
803 803
         $urls['querystring']  = $querystring;
804
-        $urls['full_phpself'] = $http . $httphost . $phpself;
804
+        $urls['full_phpself'] = $http.$httphost.$phpself;
805 805
         $urls['full']         = $currenturl;
806
-        $urls['isHomePage']   = (XOOPS_URL . '/index.php') == ($http . $httphost . $phpself);
806
+        $urls['isHomePage']   = (XOOPS_URL.'/index.php') == ($http.$httphost.$phpself);
807 807
 
808 808
         return $urls;
809 809
     }
@@ -880,13 +880,13 @@  discard block
 block discarded – undo
880 880
     {
881 881
         global $xoopsConfig, $xoopsModule;
882 882
 
883
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
883
+        require_once XOOPS_ROOT_PATH.'/class/template.php';
884 884
         $tpl = new \XoopsTpl();
885 885
 
886 886
         $hModule      = xoops_getHandler('module');
887
-        $versioninfo  =& $hModule->get($xoopsModule->getVar('mid'));
888
-        $modfootertxt = 'Module ' . $versioninfo->getInfo('name') . ' - Version ' . $versioninfo->getInfo('version') . '';
889
-        $modfooter    = "<a href='" . $versioninfo->getInfo('support_site_url') . "' target='_blank'><img src='" . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . "/assets/images/cssbutton.gif' title='" . $modfootertxt . "' alt='" . $modfootertxt . "'></a>";
887
+        $versioninfo  = & $hModule->get($xoopsModule->getVar('mid'));
888
+        $modfootertxt = 'Module '.$versioninfo->getInfo('name').' - Version '.$versioninfo->getInfo('version').'';
889
+        $modfooter    = "<a href='".$versioninfo->getInfo('support_site_url')."' target='_blank'><img src='".XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname')."/assets/images/cssbutton.gif' title='".$modfootertxt."' alt='".$modfootertxt."'></a>";
890 890
         $tpl->assign('modfooter', $modfooter);
891 891
 
892 892
         if (!defined('_AM_SOBJECT_XOOPS_PRO')) {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
         }
895 895
         $smartobjectConfig = static::getModuleConfig('smartobject');
896 896
         $tpl->assign('smartobject_enable_admin_footer', $smartobjectConfig['enable_admin_footer']);
897
-        $tpl->display(SMARTOBJECT_ROOT_PATH . 'templates/smartobject_admin_footer.tpl');
897
+        $tpl->display(SMARTOBJECT_ROOT_PATH.'templates/smartobject_admin_footer.tpl');
898 898
     }
899 899
 
900 900
     public static function getXoopsCpFooter()
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
      */
922 922
     public static function addScript($src)
923 923
     {
924
-        echo '<script src="' . $src . '" type="text/javascript"></script>';
924
+        echo '<script src="'.$src.'" type="text/javascript"></script>';
925 925
     }
926 926
 
927 927
     /**
@@ -930,16 +930,16 @@  discard block
 block discarded – undo
930 930
     public static function addStyle($src)
931 931
     {
932 932
         if ('smartobject' === $src) {
933
-            $src = SMARTOBJECT_URL . 'assets/css/module.css';
933
+            $src = SMARTOBJECT_URL.'assets/css/module.css';
934 934
         }
935 935
         echo static::getCssLink($src);
936 936
     }
937 937
 
938 938
     public static function addAdminAjaxSupport()
939 939
     {
940
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/lib/prototype.js');
941
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/scriptaculous.js');
942
-        static::addScript(SMARTOBJECT_URL . 'include/scriptaculous/src/smart.js');
940
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/lib/prototype.js');
941
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/src/scriptaculous.js');
942
+        static::addScript(SMARTOBJECT_URL.'include/scriptaculous/src/smart.js');
943 943
     }
944 944
 
945 945
     /**
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
     public static function getHtmlnumericentities($str)
1000 1000
     {
1001 1001
         //    return preg_replace('/[^!-%\x27-;=?-~ ]/e', '"&#".ord("$0").chr(59)', $str);
1002
-        return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function ($m) {
1003
-            return '&#' . ord($m[0]) . chr(59);
1002
+        return preg_replace_callback('/[^!-%\x27-;=?-~ ]/', function($m) {
1003
+            return '&#'.ord($m[0]).chr(59);
1004 1004
         }, $str);
1005 1005
     }
1006 1006
 
@@ -1014,16 +1014,16 @@  discard block
 block discarded – undo
1014 1014
         static $handlers;
1015 1015
         $name = strtolower(trim($name));
1016 1016
         if (!isset($handlers[$name])) {
1017
-            if (file_exists($hnd_file = XOOPS_ROOT_PATH . '/kernel/' . $name . '.php')) {
1017
+            if (file_exists($hnd_file = XOOPS_ROOT_PATH.'/kernel/'.$name.'.php')) {
1018 1018
                 require_once $hnd_file;
1019 1019
             }
1020
-            $class = 'Xoops' . ucfirst($name) . 'Handler';
1020
+            $class = 'Xoops'.ucfirst($name).'Handler';
1021 1021
             if (class_exists($class)) {
1022 1022
                 $handlers[$name] = new $class($GLOBALS['xoopsDB'], 'xoops');
1023 1023
             }
1024 1024
         }
1025 1025
         if (!isset($handlers[$name]) && !$optional) {
1026
-            trigger_error('Class <b>' . $class . '</b> does not exist<br>Handler Name: ' . $name, E_USER_ERROR);
1026
+            trigger_error('Class <b>'.$class.'</b> does not exist<br>Handler Name: '.$name, E_USER_ERROR);
1027 1027
         }
1028 1028
         if (isset($handlers[$name])) {
1029 1029
             return $handlers[$name];
@@ -1103,9 +1103,9 @@  discard block
 block discarded – undo
1103 1103
     {
1104 1104
         global $xoopsConfig;
1105 1105
 
1106
-        $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/' . $xoopsConfig['language'] . '/' . $file . '.php';
1106
+        $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/'.$xoopsConfig['language'].'/'.$file.'.php';
1107 1107
         if (!file_exists($filename)) {
1108
-            $filename = XOOPS_ROOT_PATH . '/modules/' . $module . '/language/english/' . $file . '.php';
1108
+            $filename = XOOPS_ROOT_PATH.'/modules/'.$module.'/language/english/'.$file.'.php';
1109 1109
         }
1110 1110
         if (file_exists($filename)) {
1111 1111
             require_once $filename;
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 
1202 1202
         $text = preg_replace($search, $replace, $document);
1203 1203
 
1204
-        preg_replace_callback('/&#(\d+);/', function ($matches) {
1204
+        preg_replace_callback('/&#(\d+);/', function($matches) {
1205 1205
             return chr($matches[1]);
1206 1206
         }, $document);
1207 1207
 
@@ -1224,21 +1224,21 @@  discard block
 block discarded – undo
1224 1224
             $str = $match[0];
1225 1225
             if (false !== strpos($str, ',')) {
1226 1226
                 // A comma exists, that makes it easy, cos we assume it separates the decimal part.
1227
-                $str = str_replace('.', '', $str);    // Erase thousand seps
1228
-                $str = str_replace(',', '.', $str);    // Convert , to . for floatval command
1227
+                $str = str_replace('.', '', $str); // Erase thousand seps
1228
+                $str = str_replace(',', '.', $str); // Convert , to . for floatval command
1229 1229
 
1230
-                return (float)$str;
1230
+                return (float) $str;
1231 1231
             } else {
1232 1232
                 // No comma exists, so we have to decide, how a single dot shall be treated
1233 1233
                 if (true === preg_match("/^[0-9\-]*[\.]{1}[0-9-]+$/", $str) && true === $set['single_dot_as_decimal']) {
1234 1234
                     // Treat single dot as decimal separator
1235
-                    return (float)$str;
1235
+                    return (float) $str;
1236 1236
                 } else {
1237 1237
                     //echo "str: ".$str; echo "ret: ".str_replace('.', '', $str); echo "<br><br> ";
1238 1238
                     // Else, treat all dots as thousand seps
1239
-                    $str = str_replace('.', '', $str);    // Erase thousand seps
1239
+                    $str = str_replace('.', '', $str); // Erase thousand seps
1240 1240
 
1241
-                    return (float)$str;
1241
+                    return (float) $str;
1242 1242
                 }
1243 1243
             }
1244 1244
         } else {
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
             $ret .= '.00';
1271 1271
         }
1272 1272
         if ($currencyObj) {
1273
-            $ret = $ret . ' ' . $currencyObj->getCode();
1273
+            $ret = $ret.' '.$currencyObj->getCode();
1274 1274
         }
1275 1275
 
1276 1276
         return $ret;
@@ -1297,7 +1297,7 @@  discard block
 block discarded – undo
1297 1297
         }
1298 1298
         $ret = '';
1299 1299
         if ($moduleName) {
1300
-            $ret = "<a href='" . XOOPS_URL . "/modules/$moduleName/admin/index.php'>" . _CO_SOBJECT_ADMIN_PAGE . '</a>';
1300
+            $ret = "<a href='".XOOPS_URL."/modules/$moduleName/admin/index.php'>"._CO_SOBJECT_ADMIN_PAGE.'</a>';
1301 1301
         }
1302 1302
 
1303 1303
         return $ret;
@@ -1308,7 +1308,7 @@  discard block
 block discarded – undo
1308 1308
      */
1309 1309
     public static function getEditors()
1310 1310
     {
1311
-        $filename = XOOPS_ROOT_PATH . '/class/xoopseditor/xoopseditor.php';
1311
+        $filename = XOOPS_ROOT_PATH.'/class/xoopseditor/xoopseditor.php';
1312 1312
         if (!file_exists($filename)) {
1313 1313
             return false;
1314 1314
         }
@@ -1332,9 +1332,9 @@  discard block
 block discarded – undo
1332 1332
     {
1333 1333
         $ret = [];
1334 1334
         foreach ($items as $item) {
1335
-            $ret[] = $moduleName . '_' . $item;
1335
+            $ret[] = $moduleName.'_'.$item;
1336 1336
         }
1337
-        $ret[] = $moduleName . '_meta';
1337
+        $ret[] = $moduleName.'_meta';
1338 1338
 
1339 1339
         return $ret;
1340 1340
     }
Please login to merge, or discard this patch.
admin/tag.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -17,45 +17,45 @@  discard block
 block discarded – undo
17 17
 
18 18
 function edittag($tagid = 0, $language = false, $fct = false)
19 19
 {
20
-    global $smartobjectTagHandler;
21
-
22
-    $tagObj = $smartobjectTagHandler->get($tagid);
23
-
24
-    if ($tagObj->isNew()) {
25
-        $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
26
-        $title                 = _AM_SOBJECT_TAG_CREATE;
27
-        $info                  = _AM_SOBJECT_TAG_CREATE_INFO;
28
-        $collaps_name          = 'tagcreate';
29
-        $form_name             = _AM_SOBJECT_TAG_CREATE;
30
-        $submit_button_caption = null;
31
-    //$tagObj->stripMultilanguageFields();
32
-    } else {
33
-        if ($language) {
34
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
35
-            $title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
36
-            $info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
37
-            $collaps_name          = 'tageditlanguage';
38
-            $form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
39
-            $submit_button_caption = null;
40
-            $tagObj->makeNonMLFieldReadOnly();
41
-        } else {
42
-            $breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
43
-            $title                 = _AM_SOBJECT_TAG_EDIT;
44
-            $info                  = _AM_SOBJECT_TAG_EDIT_INFO;
45
-            $collaps_name          = 'tagedit';
46
-            $form_name             = _AM_SOBJECT_TAG_EDIT;
47
-            $submit_button_caption = null;
48
-            $tagObj->stripMultilanguageFields();
49
-        }
50
-    }
51
-
52
-    //Smartobject\Utility::getAdminMenu(2, $breadcrumb);
53
-
54
-    Smartobject\Utility::getCollapsableBar($collaps_name, $title, $info);
55
-
56
-    $sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
57
-    $sform->display();
58
-    Smartobject\Utility::closeCollapsable($collaps_name);
20
+	global $smartobjectTagHandler;
21
+
22
+	$tagObj = $smartobjectTagHandler->get($tagid);
23
+
24
+	if ($tagObj->isNew()) {
25
+		$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_CREATE;
26
+		$title                 = _AM_SOBJECT_TAG_CREATE;
27
+		$info                  = _AM_SOBJECT_TAG_CREATE_INFO;
28
+		$collaps_name          = 'tagcreate';
29
+		$form_name             = _AM_SOBJECT_TAG_CREATE;
30
+		$submit_button_caption = null;
31
+	//$tagObj->stripMultilanguageFields();
32
+	} else {
33
+		if ($language) {
34
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_TAG_EDITING_LANGUAGE;
35
+			$title                 = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
36
+			$info                  = _AM_SOBJECT_TAG_EDIT_LANGUAGE_INFO;
37
+			$collaps_name          = 'tageditlanguage';
38
+			$form_name             = _AM_SOBJECT_TAG_EDIT_LANGUAGE;
39
+			$submit_button_caption = null;
40
+			$tagObj->makeNonMLFieldReadOnly();
41
+		} else {
42
+			$breadcrumb            = _AM_SOBJECT_TAGS . ' > ' . _AM_SOBJECT_EDITING;
43
+			$title                 = _AM_SOBJECT_TAG_EDIT;
44
+			$info                  = _AM_SOBJECT_TAG_EDIT_INFO;
45
+			$collaps_name          = 'tagedit';
46
+			$form_name             = _AM_SOBJECT_TAG_EDIT;
47
+			$submit_button_caption = null;
48
+			$tagObj->stripMultilanguageFields();
49
+		}
50
+	}
51
+
52
+	//Smartobject\Utility::getAdminMenu(2, $breadcrumb);
53
+
54
+	Smartobject\Utility::getCollapsableBar($collaps_name, $title, $info);
55
+
56
+	$sform = $tagObj->getForm($form_name, 'addtag', false, $submit_button_caption);
57
+	$sform->display();
58
+	Smartobject\Utility::closeCollapsable($collaps_name);
59 59
 }
60 60
 
61 61
 require_once __DIR__ . '/admin_header.php';
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 $op = '';
68 68
 
69 69
 if (isset($_GET['op'])) {
70
-    $op = $_GET['op'];
70
+	$op = $_GET['op'];
71 71
 }
72 72
 if (isset($_POST['op'])) {
73
-    $op = $_POST['op'];
73
+	$op = $_POST['op'];
74 74
 }
75 75
 
76 76
 $tagid    = \Xmf\Request::getInt('tagid', 0, 'GET');
@@ -79,65 +79,65 @@  discard block
 block discarded – undo
79 79
 
80 80
 switch ($op) {
81 81
 
82
-    case 'del':
82
+	case 'del':
83 83
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
84
-        $controller = new ObjectController($smartobjectTagHandler);
85
-        $controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
84
+		$controller = new ObjectController($smartobjectTagHandler);
85
+		$controller->handleObjectDeletion(_AM_SOBJECT_TAG_DELETE_CONFIRM);
86 86
 
87
-        break;
87
+		break;
88 88
 
89
-    case 'addtag':
89
+	case 'addtag':
90 90
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
91
-        $controller = new ObjectController($smartobjectTagHandler);
92
-        $tagObj     = $controller->storeSmartObject();
93
-        if ($tagObj->hasError()) {
94
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
95
-        }
91
+		$controller = new ObjectController($smartobjectTagHandler);
92
+		$tagObj     = $controller->storeSmartObject();
93
+		if ($tagObj->hasError()) {
94
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
95
+		}
96 96
 
97
-        if ($tagObj->hasError()) {
98
-            redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
99
-        } else {
100
-            redirect_header(Smartobject\Utility::getPageBeforeForm(), 3, _CO_SOBJECT_SAVE_SUCCESS);
101
-        }
102
-        exit;
103
-        break;
97
+		if ($tagObj->hasError()) {
98
+			redirect_header($smart_previous_page, 3, _CO_SOBJECT_SAVE_ERROR . $tagObj->getHtmlErrors());
99
+		} else {
100
+			redirect_header(Smartobject\Utility::getPageBeforeForm(), 3, _CO_SOBJECT_SAVE_SUCCESS);
101
+		}
102
+		exit;
103
+		break;
104 104
 
105
-    case 'mod':
106
-        Smartobject\Utility::getXoopsCpHeader();
107
-        edittag($tagid, $language, $fct);
108
-        break;
105
+	case 'mod':
106
+		Smartobject\Utility::getXoopsCpHeader();
107
+		edittag($tagid, $language, $fct);
108
+		break;
109 109
 
110
-    default:
110
+	default:
111 111
 
112
-        Smartobject\Utility::getXoopsCpHeader();
112
+		Smartobject\Utility::getXoopsCpHeader();
113 113
 
114
-        //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_TAGS);
114
+		//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_TAGS);
115 115
 
116
-        Smartobject\Utility::getCollapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
116
+		Smartobject\Utility::getCollapsableBar('tags', _AM_SOBJECT_TAGS, _AM_SOBJECT_TAGS_INFO);
117 117
 
118 118
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
119
-        $objectTable = new Table($smartobjectTagHandler, false, ['delete']);
120
-        $objectTable->addColumn(new ObjectColumn('name'));
121
-        $objectTable->addColumn(new ObjectColumn('language'));
122
-        $objectTable->addColumn(new ObjectColumn('value'));
123
-        //      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
119
+		$objectTable = new Table($smartobjectTagHandler, false, ['delete']);
120
+		$objectTable->addColumn(new ObjectColumn('name'));
121
+		$objectTable->addColumn(new ObjectColumn('language'));
122
+		$objectTable->addColumn(new ObjectColumn('value'));
123
+		//      $objectTable->addColumn(new SmartObjectColumn(_AM_SOBJECT_SENT_TAGS_FROM, $align='left', $width=false, 'getFromInfo'));
124 124
 
125
-        $objectTable->addFilter('language', 'getLanguages');
125
+		$objectTable->addFilter('language', 'getLanguages');
126 126
 
127
-        $objectTable->addCustomAction('getEditLanguageLink');
128
-        $objectTable->addCustomAction('getEditItemLink');
127
+		$objectTable->addCustomAction('getEditLanguageLink');
128
+		$objectTable->addCustomAction('getEditItemLink');
129 129
 
130
-        $objectTable->setDefaultSort('tagid');
130
+		$objectTable->setDefaultSort('tagid');
131 131
 
132
-        $objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
132
+		$objectTable->addIntroButton('addtag', 'tag.php?op=mod', _AM_SOBJECT_TAG_CREATE);
133 133
 
134
-        $objectTable->render();
134
+		$objectTable->render();
135 135
 
136
-        echo '<br>';
137
-        Smartobject\Utility::closeCollapsable('tags');
138
-        echo '<br>';
136
+		echo '<br>';
137
+		Smartobject\Utility::closeCollapsable('tags');
138
+		echo '<br>';
139 139
 
140
-        break;
140
+		break;
141 141
 }
142 142
 
143 143
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/admin_header.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,11 +19,11 @@
 block discarded – undo
19 19
 
20 20
 use XoopsModules\Smartobject;
21 21
 
22
-require_once __DIR__ . '/../../../include/cp_header.php';
22
+require_once __DIR__.'/../../../include/cp_header.php';
23 23
 //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php');
24 24
 
25 25
 //require_once __DIR__ . '/../class/Utility.php';
26
-require_once __DIR__ . '/../include/common.php';
26
+require_once __DIR__.'/../include/common.php';
27 27
 
28 28
 $moduleDirName = basename(dirname(__DIR__));
29 29
 $helper = Smartobject\Helper::getInstance();
Please login to merge, or discard this patch.
admin/adsense.php 3 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -19,32 +19,32 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function editclass($showmenu = false, $adsenseid = 0, $clone = false)
21 21
 {
22
-    global $smartobjectAdsenseHandler;
23
-
24
-    $adsenseObj = $smartobjectAdsenseHandler->get($adsenseid);
25
-
26
-    if (!$clone && !$adsenseObj->isNew()) {
27
-        if ($showmenu) {
28
-            //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING);
29
-        }
30
-        Smartobject\Utility::getCollapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO);
31
-
32
-        $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense');
33
-        $sform->display();
34
-        Smartobject\Utility::closeCollapsable('adsenseedit');
35
-    } else {
36
-        $adsenseObj->setVar('adsenseid', 0);
37
-        $adsenseObj->setVar('tag', '');
38
-
39
-        if ($showmenu) {
40
-            //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW);
41
-        }
42
-
43
-        Smartobject\Utility::getCollapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO);
44
-        $sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true);
45
-        $sform->display();
46
-        Smartobject\Utility::closeCollapsable('adsensecreate');
47
-    }
22
+	global $smartobjectAdsenseHandler;
23
+
24
+	$adsenseObj = $smartobjectAdsenseHandler->get($adsenseid);
25
+
26
+	if (!$clone && !$adsenseObj->isNew()) {
27
+		if ($showmenu) {
28
+			//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _AM_SOBJECT_EDITING);
29
+		}
30
+		Smartobject\Utility::getCollapsableBar('adsenseedit', _AM_SOBJECT_ADSENSES_EDIT, _AM_SOBJECT_ADSENSES_EDIT_INFO);
31
+
32
+		$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_EDIT, 'addadsense');
33
+		$sform->display();
34
+		Smartobject\Utility::closeCollapsable('adsenseedit');
35
+	} else {
36
+		$adsenseObj->setVar('adsenseid', 0);
37
+		$adsenseObj->setVar('tag', '');
38
+
39
+		if ($showmenu) {
40
+			//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES . " > " . _CO_SOBJECT_CREATINGNEW);
41
+		}
42
+
43
+		Smartobject\Utility::getCollapsableBar('adsensecreate', _AM_SOBJECT_ADSENSES_CREATE, _AM_SOBJECT_ADSENSES_CREATE_INFO);
44
+		$sform = $adsenseObj->getForm(_AM_SOBJECT_ADSENSES_CREATE, 'addadsense', false, false, false, true);
45
+		$sform->display();
46
+		Smartobject\Utility::closeCollapsable('adsensecreate');
47
+	}
48 48
 }
49 49
 
50 50
 require_once __DIR__ . '/admin_header.php';
@@ -61,72 +61,72 @@  discard block
 block discarded – undo
61 61
 $op = '';
62 62
 
63 63
 if (isset($_GET['op'])) {
64
-    $op = $_GET['op'];
64
+	$op = $_GET['op'];
65 65
 }
66 66
 if (isset($_POST['op'])) {
67
-    $op = $_POST['op'];
67
+	$op = $_POST['op'];
68 68
 }
69 69
 
70 70
 switch ($op) {
71
-    case 'mod':
71
+	case 'mod':
72 72
 
73
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
73
+		$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
74 74
 
75
-        Smartobject\Utility::getXoopsCpHeader();
76
-        $adminObject->displayNavigation(basename(__FILE__));
75
+		Smartobject\Utility::getXoopsCpHeader();
76
+		$adminObject->displayNavigation(basename(__FILE__));
77 77
 
78
-        editclass(true, $adsenseid);
79
-        break;
78
+		editclass(true, $adsenseid);
79
+		break;
80 80
 
81
-    case 'clone':
81
+	case 'clone':
82 82
 
83
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
83
+		$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
84 84
 
85
-        Smartobject\Utility::getXoopsCpHeader();
86
-        $adminObject->displayNavigation(basename(__FILE__));
85
+		Smartobject\Utility::getXoopsCpHeader();
86
+		$adminObject->displayNavigation(basename(__FILE__));
87 87
 
88
-        editclass(true, $adsenseid, true);
89
-        break;
88
+		editclass(true, $adsenseid, true);
89
+		break;
90 90
 
91
-    case 'addadsense':
92
-        if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
-            $xoopsCaptcha = XoopsCaptcha::getInstance();
94
-            if (!$xoopsCaptcha->verify()) {
95
-                redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
-            }
97
-        }
91
+	case 'addadsense':
92
+		if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
+			$xoopsCaptcha = XoopsCaptcha::getInstance();
94
+			if (!$xoopsCaptcha->verify()) {
95
+				redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
+			}
97
+		}
98 98
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
99
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
-        $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
-        break;
99
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
+		$controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
+		break;
102 102
 
103
-    case 'del':
103
+	case 'del':
104 104
 
105 105
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
106
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
-        $controller->handleObjectDeletion();
106
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
+		$controller->handleObjectDeletion();
108 108
 
109
-        break;
109
+		break;
110 110
 
111
-    default:
111
+	default:
112 112
 
113
-        Smartobject\Utility::getXoopsCpHeader();
114
-        $adminObject->displayNavigation(basename(__FILE__));
113
+		Smartobject\Utility::getXoopsCpHeader();
114
+		$adminObject->displayNavigation(basename(__FILE__));
115 115
 
116
-        //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
116
+		//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
117 117
 
118
-        Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
118
+		Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
119 119
 
120 120
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
121
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
121
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
124 124
 
125
-        //      $objectTable->addCustomAction('getCreateItemLink');
126
-        //      $objectTable->addCustomAction('getCreateAttributLink');
125
+		//      $objectTable->addCustomAction('getCreateItemLink');
126
+		//      $objectTable->addCustomAction('getCreateAttributLink');
127 127
 
128
-        $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
-        /*
128
+		$objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
+		/*
130 130
                 $criteria_upcoming = new \CriteriaCompo();
131 131
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
132 132
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
                                             'criteria' => $criteria_last30days
151 151
                 ));
152 152
         */
153
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
154
-        $objectTable->addCustomAction('getCloneLink');
153
+		$objectTable->addQuickSearch(['title', 'summary', 'description']);
154
+		$objectTable->addCustomAction('getCloneLink');
155 155
 
156
-        $objectTable->render();
156
+		$objectTable->render();
157 157
 
158
-        echo '<br>';
159
-        Smartobject\Utility::closeCollapsable('createdadsenses');
160
-        echo '<br>';
158
+		echo '<br>';
159
+		Smartobject\Utility::closeCollapsable('createdadsenses');
160
+		echo '<br>';
161 161
 
162
-        break;
162
+		break;
163 163
 }
164 164
 
165 165
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Switch Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -68,65 +68,65 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 switch ($op) {
71
-    case 'mod':
71
+    	case 'mod':
72 72
 
73
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
73
+        	$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
74 74
 
75
-        Smartobject\Utility::getXoopsCpHeader();
76
-        $adminObject->displayNavigation(basename(__FILE__));
75
+        	Smartobject\Utility::getXoopsCpHeader();
76
+        	$adminObject->displayNavigation(basename(__FILE__));
77 77
 
78
-        editclass(true, $adsenseid);
79
-        break;
78
+        	editclass(true, $adsenseid);
79
+        	break;
80 80
 
81
-    case 'clone':
81
+    	case 'clone':
82 82
 
83
-        $adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
83
+        	$adsenseid = \Xmf\Request::getInt('adsenseid', 0, 'GET');
84 84
 
85
-        Smartobject\Utility::getXoopsCpHeader();
86
-        $adminObject->displayNavigation(basename(__FILE__));
85
+        	Smartobject\Utility::getXoopsCpHeader();
86
+        	$adminObject->displayNavigation(basename(__FILE__));
87 87
 
88
-        editclass(true, $adsenseid, true);
89
-        break;
88
+        	editclass(true, $adsenseid, true);
89
+        	break;
90 90
 
91
-    case 'addadsense':
92
-        if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
-            $xoopsCaptcha = XoopsCaptcha::getInstance();
94
-            if (!$xoopsCaptcha->verify()) {
95
-                redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
-            }
97
-        }
98
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
99
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
-        $controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
-        break;
91
+    	case 'addadsense':
92
+        	if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
93
+            	$xoopsCaptcha = XoopsCaptcha::getInstance();
94
+            	if (!$xoopsCaptcha->verify()) {
95
+                	redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
96
+            	}
97
+        	}
98
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
99
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
100
+        	$controller->storeFromDefaultForm(_AM_SOBJECT_ADSENSES_CREATED, _AM_SOBJECT_ADSENSES_MODIFIED);
101
+        	break;
102 102
 
103
-    case 'del':
103
+    	case 'del':
104 104
 
105
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
106
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
-        $controller->handleObjectDeletion();
105
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
106
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectAdsenseHandler);
107
+        	$controller->handleObjectDeletion();
108 108
 
109
-        break;
109
+        	break;
110 110
 
111
-    default:
111
+    	default:
112 112
 
113
-        Smartobject\Utility::getXoopsCpHeader();
114
-        $adminObject->displayNavigation(basename(__FILE__));
113
+        	Smartobject\Utility::getXoopsCpHeader();
114
+        	$adminObject->displayNavigation(basename(__FILE__));
115 115
 
116
-        //Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
116
+        	//Smartobject\Utility::getAdminMenu(3, _AM_SOBJECT_ADSENSES);
117 117
 
118
-        Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
118
+        	Smartobject\Utility::getCollapsableBar('createdadsenses', _AM_SOBJECT_ADSENSES, _AM_SOBJECT_ADSENSES_DSC);
119 119
 
120
-//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
121
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
120
+	//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
121
+        	$objectTable = new XoopsModules\Smartobject\Table($smartobjectAdsenseHandler);
122
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
123
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn(_AM_SOBJECT_ADSENSE_TAG, 'center', 200, 'getXoopsCode'));
124 124
 
125
-        //      $objectTable->addCustomAction('getCreateItemLink');
126
-        //      $objectTable->addCustomAction('getCreateAttributLink');
125
+        	//      $objectTable->addCustomAction('getCreateItemLink');
126
+        	//      $objectTable->addCustomAction('getCreateAttributLink');
127 127
 
128
-        $objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
-        /*
128
+        	$objectTable->addIntroButton('addadsense', 'adsense.php?op=mod', _AM_SOBJECT_ADSENSES_CREATE);
129
+        	/*
130 130
                 $criteria_upcoming = new \CriteriaCompo();
131 131
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
132 132
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
                                             'criteria' => $criteria_last30days
151 151
                 ));
152 152
         */
153
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
154
-        $objectTable->addCustomAction('getCloneLink');
153
+        	$objectTable->addQuickSearch(['title', 'summary', 'description']);
154
+        	$objectTable->addCustomAction('getCloneLink');
155 155
 
156
-        $objectTable->render();
156
+        	$objectTable->render();
157 157
 
158
-        echo '<br>';
159
-        Smartobject\Utility::closeCollapsable('createdadsenses');
160
-        echo '<br>';
158
+        	echo '<br>';
159
+        	Smartobject\Utility::closeCollapsable('createdadsenses');
160
+        	echo '<br>';
161 161
 
162
-        break;
162
+        	break;
163 163
 }
164 164
 
165 165
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
     }
48 48
 }
49 49
 
50
-require_once __DIR__ . '/admin_header.php';
50
+require_once __DIR__.'/admin_header.php';
51 51
 //require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
52
-require_once SMARTOBJECT_ROOT_PATH . 'class/adsense.php';
52
+require_once SMARTOBJECT_ROOT_PATH.'class/adsense.php';
53 53
 
54 54
 //$helper = \XoopsModules\Smartobject\Helper::getInstance();
55 55
 //$helper = Smartobject\Helper::getInstance();
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         break;
90 90
 
91 91
     case 'addadsense':
92
-        if (@require_once SMARTOBJECT_ROOT_PATH . 'include/captcha/captcha.php') {
92
+        if (@require_once SMARTOBJECT_ROOT_PATH.'include/captcha/captcha.php') {
93 93
             $xoopsCaptcha = XoopsCaptcha::getInstance();
94 94
             if (!$xoopsCaptcha->verify()) {
95 95
                 redirect_header('javascript:history.go(-1);', 3, $xoopsCaptcha->getMessage());
@@ -164,4 +164,4 @@  discard block
 block discarded – undo
164 164
 
165 165
 //Smartobject\Utility::getModFooter();
166 166
 //xoops_cp_footer();
167
-require_once __DIR__ . '/admin_footer.php';
167
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/link.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -26,81 +26,81 @@
 block discarded – undo
26 26
 $op = '';
27 27
 
28 28
 if (isset($_GET['op'])) {
29
-    $op = $_GET['op'];
29
+	$op = $_GET['op'];
30 30
 }
31 31
 if (isset($_POST['op'])) {
32
-    $op = $_POST['op'];
32
+	$op = $_POST['op'];
33 33
 }
34 34
 
35 35
 switch ($op) {
36 36
 
37
-    case 'del':
37
+	case 'del':
38 38
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
39
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
-        $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
39
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
+		$controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
41 41
 
42
-        break;
42
+		break;
43 43
 
44
-    case 'view':
45
-        $linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
-        $linkObj = $smartobjectLinkHandler->get($linkid);
44
+	case 'view':
45
+		$linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
+		$linkObj = $smartobjectLinkHandler->get($linkid);
47 47
 
48
-        if ($linkObj->isNew()) {
49
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
-        }
48
+		if ($linkObj->isNew()) {
49
+			redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
+		}
51 51
 
52
-        Smartobject\Utility::getXoopsCpHeader();
52
+		Smartobject\Utility::getXoopsCpHeader();
53 53
 
54
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
54
+		//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
55 55
 
56
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
56
+		Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
57 57
 
58
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
58
+		require_once XOOPS_ROOT_PATH . '/class/template.php';
59 59
 
60
-        // ---
61
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
-        //      $xoopsTpl = new \XoopsTpl();
63
-        $xoopsTpl = new \XoopsTpl();
64
-        //---
60
+		// ---
61
+		// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
+		//      $xoopsTpl = new \XoopsTpl();
63
+		$xoopsTpl = new \XoopsTpl();
64
+		//---
65 65
 
66
-        $xoopsTpl->assign('link', $linkObj->toArray());
67
-        $xoopsTpl->display('db:smartobject_sentlink_display.tpl');
66
+		$xoopsTpl->assign('link', $linkObj->toArray());
67
+		$xoopsTpl->display('db:smartobject_sentlink_display.tpl');
68 68
 
69
-        echo '<br>';
70
-        Smartobject\Utility::closeCollapsable('sentlinks');
71
-        echo '<br>';
69
+		echo '<br>';
70
+		Smartobject\Utility::closeCollapsable('sentlinks');
71
+		echo '<br>';
72 72
 
73
-        break;
73
+		break;
74 74
 
75
-    default:
75
+	default:
76 76
 
77
-        Smartobject\Utility::getXoopsCpHeader();
77
+		Smartobject\Utility::getXoopsCpHeader();
78 78
 
79
-        $adminObject->displayNavigation(basename(__FILE__));
79
+		$adminObject->displayNavigation(basename(__FILE__));
80 80
 
81
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
81
+		//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
82 82
 
83
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
83
+		Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
84 84
 
85 85
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
86
-        $objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
-        $objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
-        $objectTable->addColumn(new Smartobject\ObjectColumn('link'));
86
+		$objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
+		$objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
+		$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
+		$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
+		$objectTable->addColumn(new Smartobject\ObjectColumn('link'));
91 91
 
92
-        $objectTable->addCustomAction('getViewItemLink');
92
+		$objectTable->addCustomAction('getViewItemLink');
93 93
 
94
-        $objectTable->setDefaultSort('date');
95
-        $objectTable->setDefaultOrder('DESC');
94
+		$objectTable->setDefaultSort('date');
95
+		$objectTable->setDefaultOrder('DESC');
96 96
 
97
-        $objectTable->render();
97
+		$objectTable->render();
98 98
 
99
-        echo '<br>';
100
-        Smartobject\Utility::closeCollapsable('sentlinks');
101
-        echo '<br>';
99
+		echo '<br>';
100
+		Smartobject\Utility::closeCollapsable('sentlinks');
101
+		echo '<br>';
102 102
 
103
-        break;
103
+		break;
104 104
 }
105 105
 
106 106
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -34,73 +34,73 @@
 block discarded – undo
34 34
 
35 35
 switch ($op) {
36 36
 
37
-    case 'del':
38
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
39
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
-        $controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
37
+    	case 'del':
38
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
39
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectLinkHandler);
40
+        	$controller->handleObjectDeletion(_AM_SOBJECT_SENT_LINK_DELETE_CONFIRM);
41 41
 
42
-        break;
42
+        	break;
43 43
 
44
-    case 'view':
45
-        $linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
-        $linkObj = $smartobjectLinkHandler->get($linkid);
44
+    	case 'view':
45
+        	$linkid  = \Xmf\Request::getInt('linkid', 0, 'GET');
46
+        	$linkObj = $smartobjectLinkHandler->get($linkid);
47 47
 
48
-        if ($linkObj->isNew()) {
49
-            redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
-        }
48
+        	if ($linkObj->isNew()) {
49
+            	redirect_header(SMARTOBJECT_URL . 'admin/link.php', 3, _AM_SOBJECT_LINK_NOT_FOUND);
50
+        	}
51 51
 
52
-        Smartobject\Utility::getXoopsCpHeader();
52
+        	Smartobject\Utility::getXoopsCpHeader();
53 53
 
54
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
54
+        	//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINK_DISPLAY);
55 55
 
56
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
56
+        	Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINK_DISPLAY, _AM_SOBJECT_SENT_LINK_DISPLAY_INFO);
57 57
 
58
-        require_once XOOPS_ROOT_PATH . '/class/template.php';
58
+        	require_once XOOPS_ROOT_PATH . '/class/template.php';
59 59
 
60
-        // ---
61
-        // 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
-        //      $xoopsTpl = new \XoopsTpl();
63
-        $xoopsTpl = new \XoopsTpl();
64
-        //---
60
+        	// ---
61
+        	// 2012-01-01 PHP 5.3: Assigning the return value of new by reference is now deprecated.
62
+        	//      $xoopsTpl = new \XoopsTpl();
63
+        	$xoopsTpl = new \XoopsTpl();
64
+        	//---
65 65
 
66
-        $xoopsTpl->assign('link', $linkObj->toArray());
67
-        $xoopsTpl->display('db:smartobject_sentlink_display.tpl');
66
+        	$xoopsTpl->assign('link', $linkObj->toArray());
67
+        	$xoopsTpl->display('db:smartobject_sentlink_display.tpl');
68 68
 
69
-        echo '<br>';
70
-        Smartobject\Utility::closeCollapsable('sentlinks');
71
-        echo '<br>';
69
+        	echo '<br>';
70
+        	Smartobject\Utility::closeCollapsable('sentlinks');
71
+        	echo '<br>';
72 72
 
73
-        break;
73
+        	break;
74 74
 
75
-    default:
75
+    	default:
76 76
 
77
-        Smartobject\Utility::getXoopsCpHeader();
77
+        	Smartobject\Utility::getXoopsCpHeader();
78 78
 
79
-        $adminObject->displayNavigation(basename(__FILE__));
79
+        	$adminObject->displayNavigation(basename(__FILE__));
80 80
 
81
-        //Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
81
+        	//Smartobject\Utility::getAdminMenu(1, _AM_SOBJECT_SENT_LINKS);
82 82
 
83
-        Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
83
+        	Smartobject\Utility::getCollapsableBar('sentlinks', _AM_SOBJECT_SENT_LINKS, _AM_SOBJECT_SENT_LINKS_INFO);
84 84
 
85
-//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
86
-        $objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
-        $objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
-        $objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
-        $objectTable->addColumn(new Smartobject\ObjectColumn('link'));
85
+	//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
86
+        	$objectTable = new Smartobject\Table($smartobjectLinkHandler, null, ['delete']);
87
+        	$objectTable->addColumn(new Smartobject\ObjectColumn('date'));
88
+        	$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_FROM, $align = 'left', $width = false, 'getFromInfo'));
89
+        	$objectTable->addColumn(new Smartobject\ObjectColumn(_AM_SOBJECT_SENT_LINKS_TO, $align = 'left', $width = false, 'getToInfo'));
90
+        	$objectTable->addColumn(new Smartobject\ObjectColumn('link'));
91 91
 
92
-        $objectTable->addCustomAction('getViewItemLink');
92
+        	$objectTable->addCustomAction('getViewItemLink');
93 93
 
94
-        $objectTable->setDefaultSort('date');
95
-        $objectTable->setDefaultOrder('DESC');
94
+        	$objectTable->setDefaultSort('date');
95
+        	$objectTable->setDefaultOrder('DESC');
96 96
 
97
-        $objectTable->render();
97
+        	$objectTable->render();
98 98
 
99
-        echo '<br>';
100
-        Smartobject\Utility::closeCollapsable('sentlinks');
101
-        echo '<br>';
99
+        	echo '<br>';
100
+        	Smartobject\Utility::closeCollapsable('sentlinks');
101
+        	echo '<br>';
102 102
 
103
-        break;
103
+        	break;
104 104
 }
105 105
 
106 106
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
admin/currency.php 3 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -15,29 +15,29 @@  discard block
 block discarded – undo
15 15
 
16 16
 function editclass($showmenu = false, $currencyid = 0)
17 17
 {
18
-    global $smartobjectCurrencyHandler;
19
-
20
-    $currencyObj = $smartobjectCurrencyHandler->get($currencyid);
21
-
22
-    if (!$currencyObj->isNew()) {
23
-        if ($showmenu) {
24
-            //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING);
25
-        }
26
-        Smartobject\Utility::getCollapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO);
27
-
28
-        $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency');
29
-        $sform->display();
30
-        Smartobject\Utility::closeCollapsable('currencyedit');
31
-    } else {
32
-        if ($showmenu) {
33
-            //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW);
34
-        }
35
-
36
-        Smartobject\Utility::getCollapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO);
37
-        $sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency');
38
-        $sform->display();
39
-        Smartobject\Utility::closeCollapsable('currencycreate');
40
-    }
18
+	global $smartobjectCurrencyHandler;
19
+
20
+	$currencyObj = $smartobjectCurrencyHandler->get($currencyid);
21
+
22
+	if (!$currencyObj->isNew()) {
23
+		if ($showmenu) {
24
+			//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _AM_SOBJECT_EDITING);
25
+		}
26
+		Smartobject\Utility::getCollapsableBar('currencyedit', _AM_SOBJECT_CURRENCIES_EDIT, _AM_SOBJECT_CURRENCIES_EDIT_INFO);
27
+
28
+		$sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_EDIT, 'addcurrency');
29
+		$sform->display();
30
+		Smartobject\Utility::closeCollapsable('currencyedit');
31
+	} else {
32
+		if ($showmenu) {
33
+			//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES . " > " . _CO_SOBJECT_CREATINGNEW);
34
+		}
35
+
36
+		Smartobject\Utility::getCollapsableBar('currencycreate', _AM_SOBJECT_CURRENCIES_CREATE, _AM_SOBJECT_CURRENCIES_CREATE_INFO);
37
+		$sform = $currencyObj->getForm(_AM_SOBJECT_CURRENCIES_CREATE, 'addcurrency');
38
+		$sform->display();
39
+		Smartobject\Utility::closeCollapsable('currencycreate');
40
+	}
41 41
 }
42 42
 
43 43
 require_once __DIR__ . '/admin_header.php';
@@ -48,36 +48,36 @@  discard block
 block discarded – undo
48 48
 $op = '';
49 49
 
50 50
 if (isset($_GET['op'])) {
51
-    $op = $_GET['op'];
51
+	$op = $_GET['op'];
52 52
 }
53 53
 if (isset($_POST['op'])) {
54
-    $op = $_POST['op'];
54
+	$op = $_POST['op'];
55 55
 }
56 56
 
57 57
 switch ($op) {
58
-    case 'mod':
59
-        $currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
58
+	case 'mod':
59
+		$currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
60 60
 
61
-        Smartobject\Utility::getXoopsCpHeader();
61
+		Smartobject\Utility::getXoopsCpHeader();
62 62
 
63
-        editclass(true, $currencyid);
64
-        break;
63
+		editclass(true, $currencyid);
64
+		break;
65 65
 
66
-    case 'updateCurrencies':
66
+	case 'updateCurrencies':
67 67
 
68
-        if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
-            redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
-        }
68
+		if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
+			redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
+		}
71 71
 
72
-        if (isset($_POST['default_currency'])) {
73
-            $newDefaultCurrency = $_POST['default_currency'];
74
-            $sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
-            $smartobjectCurrencyHandler->query($sql);
76
-            $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
-            $smartobjectCurrencyHandler->query($sql);
78
-        }
72
+		if (isset($_POST['default_currency'])) {
73
+			$newDefaultCurrency = $_POST['default_currency'];
74
+			$sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
+			$smartobjectCurrencyHandler->query($sql);
76
+			$sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
+			$smartobjectCurrencyHandler->query($sql);
78
+		}
79 79
 
80
-        /*
80
+		/*
81 81
         $criteria = new \CriteriaCompo();
82 82
         $criteria->add(new \Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN'));
83 83
         $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true);
@@ -87,49 +87,49 @@  discard block
 block discarded – undo
87 87
             $smartobjectCurrencyHandler->insert($currencyObj);
88 88
         }
89 89
         */
90
-        redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
-        break;
90
+		redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
+		break;
92 92
 
93
-    case 'addcurrency':
93
+	case 'addcurrency':
94 94
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new ObjectController($smartobjectCurrencyHandler);
96
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
95
+		$controller = new ObjectController($smartobjectCurrencyHandler);
96
+		$controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
97 97
 
98
-        break;
98
+		break;
99 99
 
100
-    case 'del':
100
+	case 'del':
101 101
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
102
-        $controller = new ObjectController($smartobjectCurrencyHandler);
103
-        $controller->handleObjectDeletion();
102
+		$controller = new ObjectController($smartobjectCurrencyHandler);
103
+		$controller->handleObjectDeletion();
104 104
 
105
-        break;
105
+		break;
106 106
 
107
-    default:
107
+	default:
108 108
 
109
-        Smartobject\Utility::getXoopsCpHeader();
109
+		Smartobject\Utility::getXoopsCpHeader();
110 110
 
111
-        //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
111
+		//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
112 112
 
113
-        Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
113
+		Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
114 114
 
115 115
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
116
-        $objectTable = new Table($smartobjectCurrencyHandler);
117
-        $objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
-        $objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
-        $objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
-        $objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
116
+		$objectTable = new Table($smartobjectCurrencyHandler);
117
+		$objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
+		$objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
+		$objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
+		$objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
121 121
 
122
-        $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
122
+		$objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
123 123
 
124
-        $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
124
+		$objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
125 125
 
126
-        $objectTable->render();
126
+		$objectTable->render();
127 127
 
128
-        echo '<br>';
129
-        Smartobject\Utility::closeCollapsable('createdcurrencies');
130
-        echo '<br>';
128
+		echo '<br>';
129
+		Smartobject\Utility::closeCollapsable('createdcurrencies');
130
+		echo '<br>';
131 131
 
132
-        break;
132
+		break;
133 133
 }
134 134
 
135 135
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -55,29 +55,29 @@  discard block
 block discarded – undo
55 55
 }
56 56
 
57 57
 switch ($op) {
58
-    case 'mod':
59
-        $currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
58
+    	case 'mod':
59
+        	$currencyid = \Xmf\Request::getInt('currencyid', 0, 'GET');
60 60
 
61
-        Smartobject\Utility::getXoopsCpHeader();
61
+        	Smartobject\Utility::getXoopsCpHeader();
62 62
 
63
-        editclass(true, $currencyid);
64
-        break;
63
+        	editclass(true, $currencyid);
64
+        	break;
65 65
 
66
-    case 'updateCurrencies':
66
+    	case 'updateCurrencies':
67 67
 
68
-        if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
-            redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
-        }
68
+        	if (!isset($_POST['SmartobjectCurrency_objects']) || 0 == count($_POST['SmartobjectCurrency_objects'])) {
69
+            	redirect_header($smart_previous_page, 3, _AM_SOBJECT_NO_RECORDS_TO_UPDATE);
70
+        	}
71 71
 
72
-        if (isset($_POST['default_currency'])) {
73
-            $newDefaultCurrency = $_POST['default_currency'];
74
-            $sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
-            $smartobjectCurrencyHandler->query($sql);
76
-            $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
-            $smartobjectCurrencyHandler->query($sql);
78
-        }
72
+        	if (isset($_POST['default_currency'])) {
73
+            	$newDefaultCurrency = $_POST['default_currency'];
74
+            	$sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
75
+            	$smartobjectCurrencyHandler->query($sql);
76
+            	$sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
77
+            	$smartobjectCurrencyHandler->query($sql);
78
+        	}
79 79
 
80
-        /*
80
+        	/*
81 81
         $criteria = new \CriteriaCompo();
82 82
         $criteria->add(new \Criteria('currencyid', '(' . implode(', ', $_POST['SmartobjectCurrency_objects']) . ')', 'IN'));
83 83
         $currenciesObj = $smartobjectCurrencyHandler->getObjects($criteria, true);
@@ -87,49 +87,49 @@  discard block
 block discarded – undo
87 87
             $smartobjectCurrencyHandler->insert($currencyObj);
88 88
         }
89 89
         */
90
-        redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
-        break;
90
+        	redirect_header($smart_previous_page, 3, _AM_SOBJECT_RECORDS_UPDATED);
91
+        	break;
92 92
 
93
-    case 'addcurrency':
94
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new ObjectController($smartobjectCurrencyHandler);
96
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
93
+    	case 'addcurrency':
94
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
+        	$controller = new ObjectController($smartobjectCurrencyHandler);
96
+        	$controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
97 97
 
98
-        break;
98
+        	break;
99 99
 
100
-    case 'del':
101
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
102
-        $controller = new ObjectController($smartobjectCurrencyHandler);
103
-        $controller->handleObjectDeletion();
100
+    	case 'del':
101
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
102
+        	$controller = new ObjectController($smartobjectCurrencyHandler);
103
+        	$controller->handleObjectDeletion();
104 104
 
105
-        break;
105
+        	break;
106 106
 
107
-    default:
107
+    	default:
108 108
 
109
-        Smartobject\Utility::getXoopsCpHeader();
109
+        	Smartobject\Utility::getXoopsCpHeader();
110 110
 
111
-        //Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
111
+        	//Smartobject\Utility::getAdminMenu(5, _AM_SOBJECT_CURRENCIES);
112 112
 
113
-        Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
113
+        	Smartobject\Utility::getCollapsableBar('createdcurrencies', _AM_SOBJECT_CURRENCIES, _AM_SOBJECT_CURRENCIES_DSC);
114 114
 
115
-//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
116
-        $objectTable = new Table($smartobjectCurrencyHandler);
117
-        $objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
-        $objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
-        $objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
-        $objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
115
+	//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
116
+        	$objectTable = new Table($smartobjectCurrencyHandler);
117
+        	$objectTable->addColumn(new ObjectColumn('name', 'left', false, 'getCurrencyLink'));
118
+        	$objectTable->addColumn(new ObjectColumn('rate', 'center', 150));
119
+        	$objectTable->addColumn(new ObjectColumn('iso4217', 'center', 150));
120
+        	$objectTable->addColumn(new ObjectColumn('default_currency', 'center', 150, 'getDefaultCurrencyControl'));
121 121
 
122
-        $objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
122
+        	$objectTable->addIntroButton('addcurrency', 'currency.php?op=mod', _AM_SOBJECT_CURRENCIES_CREATE);
123 123
 
124
-        $objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
124
+        	$objectTable->addActionButton('updateCurrencies', _SUBMIT, _AM_SOBJECT_CURRENCY_UPDATE_ALL);
125 125
 
126
-        $objectTable->render();
126
+        	$objectTable->render();
127 127
 
128
-        echo '<br>';
129
-        Smartobject\Utility::closeCollapsable('createdcurrencies');
130
-        echo '<br>';
128
+        	echo '<br>';
129
+        	Smartobject\Utility::closeCollapsable('createdcurrencies');
130
+        	echo '<br>';
131 131
 
132
-        break;
132
+        	break;
133 133
 }
134 134
 
135 135
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     }
41 41
 }
42 42
 
43
-require_once __DIR__ . '/admin_header.php';
43
+require_once __DIR__.'/admin_header.php';
44 44
 //require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
45 45
 //require_once SMARTOBJECT_ROOT_PATH . 'class/currency.php';
46 46
 $smartobjectCurrencyHandler = Smartobject\Helper::getInstance()->getHandler('Currency');
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 
72 72
         if (isset($_POST['default_currency'])) {
73 73
             $newDefaultCurrency = $_POST['default_currency'];
74
-            $sql                = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=0';
74
+            $sql                = 'UPDATE '.$smartobjectCurrencyHandler->table.' SET default_currency=0';
75 75
             $smartobjectCurrencyHandler->query($sql);
76
-            $sql = 'UPDATE ' . $smartobjectCurrencyHandler->table . ' SET default_currency=1 WHERE currencyid=' . $newDefaultCurrency;
76
+            $sql = 'UPDATE '.$smartobjectCurrencyHandler->table.' SET default_currency=1 WHERE currencyid='.$newDefaultCurrency;
77 77
             $smartobjectCurrencyHandler->query($sql);
78 78
         }
79 79
 
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     case 'addcurrency':
94 94
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95 95
         $controller = new ObjectController($smartobjectCurrencyHandler);
96
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL . 'admin/currency.php');
96
+        $controller->storeFromDefaultForm(_AM_SOBJECT_CURRENCIES_CREATED, _AM_SOBJECT_CURRENCIES_MODIFIED, SMARTOBJECT_URL.'admin/currency.php');
97 97
 
98 98
         break;
99 99
 
@@ -134,4 +134,4 @@  discard block
 block discarded – undo
134 134
 
135 135
 //Smartobject\Utility::getModFooter();
136 136
 //xoops_cp_footer();
137
-require_once __DIR__ . '/admin_footer.php';
137
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/update.php 2 patches
Indentation   +298 added lines, -298 removed lines patch added patch discarded remove patch
@@ -21,188 +21,188 @@  discard block
 block discarded – undo
21 21
 // =========================================================================================
22 22
 function update_tables_to_300()
23 23
 {
24
-    $dbupdater = new Wfdownloads\Dbupdater();
24
+	$dbupdater = new Wfdownloads\Dbupdater();
25 25
 
26
-    if (!wfdownloads_TableExists('wfdownloads_meta')) {
27
-        // Create table wfdownloads_meta
28
-        $table = new Wfdownloads\DbupdaterTable('wfdownloads_meta');
29
-        $table->setStructure("CREATE TABLE `%s` (
26
+	if (!wfdownloads_TableExists('wfdownloads_meta')) {
27
+		// Create table wfdownloads_meta
28
+		$table = new Wfdownloads\DbupdaterTable('wfdownloads_meta');
29
+		$table->setStructure("CREATE TABLE `%s` (
30 30
                                 metakey varchar(50) NOT NULL default '',
31 31
                                 metavalue varchar(255) NOT NULL default '',
32 32
                                 PRIMARY KEY (metakey))
33 33
                                 ENGINE=MyISAM;");
34 34
 
35
-        $table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
36
-        if ($dbupdater->updateTable($table)) {
37
-            echo 'wfdownloads_meta table created<br>';
38
-        }
39
-    }
40
-
41
-    $download_fields = [
42
-        'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
43
-        'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
44
-        'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
-        'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
46
-        'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
47
-        'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
48
-        'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
49
-        'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
50
-        'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
51
-        'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
52
-        'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
53
-        'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
54
-        'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
55
-        'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
56
-        'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
57
-        'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
-        'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
59
-        'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
60
-        'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
61
-        'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
-        'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
63
-        'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
64
-        'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
-        'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
66
-        'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
67
-        'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
68
-        'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
69
-        'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
70
-        'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
71
-        'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
72
-        'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
73
-        'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
74
-        'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
75
-        'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
76
-        'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
77
-        'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
78
-        'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
79
-    ];
80
-
81
-    $renamed_fields = [
82
-        'logourl' => 'screenshot'
83
-    ];
84
-
85
-    echo '<br><b>Checking Download table</b><br>';
86
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
87
-    $downloadHandler = $helperWfdownloads->getHandler('Download');
88
-    $download_table  = new Wfdownloads\DbupdaterTable('wfdownloads_downloads');
89
-    $fields          = get_table_info($downloadHandler->table, $download_fields);
90
-    // Check for renamed fields
91
-    rename_fields($download_table, $renamed_fields, $fields, $download_fields);
92
-    update_table($download_fields, $fields, $download_table);
93
-    if ($dbupdater->updateTable($download_table)) {
94
-        echo 'Downloads table updated<br>';
95
-    }
96
-    unset($fields);
97
-
98
-    $mod_fields = [
99
-        'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
100
-        'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
101
-        'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
102
-        'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
-        'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
104
-        'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
105
-        'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
106
-        'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
-        'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
108
-        'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
109
-        'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
110
-        'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
111
-        'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
112
-        'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
113
-        'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
114
-        'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
115
-        'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
116
-        'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
117
-        'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
118
-        'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
119
-        'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
120
-        'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
121
-        'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
122
-        'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
123
-        'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
124
-        'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
125
-        'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
126
-        'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
127
-        'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
128
-        'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
129
-        'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
130
-        'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
131
-        'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
-        'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
133
-        'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
134
-        'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
135
-        'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
136
-        'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
137
-    ];
138
-
139
-    $renamed_fields = [
140
-        'logourl' => 'screenshot'
141
-    ];
142
-
143
-    echo '<br><b>Checking Modified Downloads table</b><br>';
35
+		$table->setData(sprintf("'version', %s", round($GLOBALS['xoopsModule']->getVar('version') / 100, 2)));
36
+		if ($dbupdater->updateTable($table)) {
37
+			echo 'wfdownloads_meta table created<br>';
38
+		}
39
+	}
40
+
41
+	$download_fields = [
42
+		'lid'           => ['Type' => 'int(11) unsigned NOT NULL auto_increment', 'Default' => false],
43
+		'cid'           => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
44
+		'title'         => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
45
+		'url'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
46
+		'filename'      => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
47
+		'filetype'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
48
+		'homepage'      => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
49
+		'version'       => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
50
+		'size'          => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
51
+		'platform'      => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
52
+		'screenshot'    => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
53
+		'submitter'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
54
+		'publisher'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
55
+		'status'        => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
56
+		'date'          => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
57
+		'hits'          => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
58
+		'rating'        => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
59
+		'votes'         => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
60
+		'comments'      => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
61
+		'license'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
62
+		'mirror'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
63
+		'price'         => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
64
+		'paypalemail'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
65
+		'features'      => ['Type' => 'text NOT NULL', 'Default' => false],
66
+		'requirements'  => ['Type' => 'text NOT NULL', 'Default' => false],
67
+		'homepagetitle' => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
68
+		'forumid'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
69
+		'limitations'   => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
70
+		'dhistory'      => ['Type' => 'text NOT NULL', 'Default' => false],
71
+		'published'     => ['Type' => "int(11) NOT NULL default '1089662528'", 'Default' => true],
72
+		'expired'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
73
+		'updated'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
74
+		'offline'       => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
75
+		'description'   => ['Type' => 'text NOT NULL', 'Default' => false],
76
+		'ipaddress'     => ['Type' => "varchar(120) NOT NULL default '0'", 'Default' => true],
77
+		'notifypub'     => ['Type' => "int(1) NOT NULL default '0'", 'Default' => true],
78
+		'summary'       => ['Type' => 'text NOT NULL', 'Default' => false]
79
+	];
80
+
81
+	$renamed_fields = [
82
+		'logourl' => 'screenshot'
83
+	];
84
+
85
+	echo '<br><b>Checking Download table</b><br>';
86
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
87
+	$downloadHandler = $helperWfdownloads->getHandler('Download');
88
+	$download_table  = new Wfdownloads\DbupdaterTable('wfdownloads_downloads');
89
+	$fields          = get_table_info($downloadHandler->table, $download_fields);
90
+	// Check for renamed fields
91
+	rename_fields($download_table, $renamed_fields, $fields, $download_fields);
92
+	update_table($download_fields, $fields, $download_table);
93
+	if ($dbupdater->updateTable($download_table)) {
94
+		echo 'Downloads table updated<br>';
95
+	}
96
+	unset($fields);
97
+
98
+	$mod_fields = [
99
+		'requestid'       => ['Type' => 'int(11) NOT NULL auto_increment', 'Default' => false],
100
+		'lid'             => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
101
+		'cid'             => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
102
+		'title'           => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
103
+		'url'             => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
104
+		'filename'        => ['Type' => "varchar(150) NOT NULL default ''", 'Default' => true],
105
+		'filetype'        => ['Type' => "varchar(100) NOT NULL default ''", 'Default' => true],
106
+		'homepage'        => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
107
+		'version'         => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
108
+		'size'            => ['Type' => "int(8) NOT NULL default '0'", 'Default' => true],
109
+		'platform'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
110
+		'screenshot'      => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
111
+		'submitter'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
112
+		'publisher'       => ['Type' => 'text NOT NULL', 'Default' => false],
113
+		'status'          => ['Type' => "tinyint(2) NOT NULL default '0'", 'Default' => true],
114
+		'date'            => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
115
+		'hits'            => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
116
+		'rating'          => ['Type' => "double(6,4) NOT NULL default '0.0000'", 'Default' => true],
117
+		'votes'           => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
118
+		'comments'        => ['Type' => "int(11) unsigned NOT NULL default '0'", 'Default' => true],
119
+		'license'         => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
120
+		'mirror'          => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
121
+		'price'           => ['Type' => "varchar(10) NOT NULL default 'Free'", 'Default' => true],
122
+		'paypalemail'     => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
123
+		'features'        => ['Type' => 'text NOT NULL', 'Default' => false],
124
+		'requirements'    => ['Type' => 'text NOT NULL', 'Default' => false],
125
+		'homepagetitle'   => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
126
+		'forumid'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
127
+		'limitations'     => ['Type' => "varchar(255) NOT NULL default '30 day trial'", 'Default' => true],
128
+		'dhistory'        => ['Type' => 'text NOT NULL', 'Default' => false],
129
+		'published'       => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
130
+		'expired'         => ['Type' => "int(10) NOT NULL default '0'", 'Default' => true],
131
+		'updated'         => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
132
+		'offline'         => ['Type' => "tinyint(1) NOT NULL default '0'", 'Default' => true],
133
+		'summary'         => ['Type' => 'text NOT NULL', 'Default' => false],
134
+		'description'     => ['Type' => 'text NOT NULL', 'Default' => false],
135
+		'modifysubmitter' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
136
+		'requestdate'     => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
137
+	];
138
+
139
+	$renamed_fields = [
140
+		'logourl' => 'screenshot'
141
+	];
142
+
143
+	echo '<br><b>Checking Modified Downloads table</b><br>';
144 144
 //    $moduleHandler = xoops_getModuleHandler('modification', 'wfdownloads');
145
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
146
-    $moduleHandler = $helperWfdownloads->getHandler('Modification');
147
-    $mod_table     = new Wfdownloads\DbupdaterTable('wfdownloads_mod');
148
-    $fields        = get_table_info($moduleHandler->table, $mod_fields);
149
-    rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
150
-    update_table($mod_fields, $fields, $mod_table);
151
-    if ($dbupdater->updateTable($mod_table)) {
152
-        echo 'Modified Downloads table updated <br>';
153
-    }
154
-    unset($fields);
155
-
156
-    $cat_fields = [
157
-        'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
158
-        'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
159
-        'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
160
-        'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
161
-        'description'  => ['Type' => 'text NULL', 'Default' => true],
162
-        'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
163
-        'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
164
-        'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
165
-        'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
166
-        'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
167
-        'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
168
-        'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
169
-        'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
170
-        'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
171
-        'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
172
-    ];
173
-    echo '<br><b>Checking Category table</b><br>';
145
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
146
+	$moduleHandler = $helperWfdownloads->getHandler('Modification');
147
+	$mod_table     = new Wfdownloads\DbupdaterTable('wfdownloads_mod');
148
+	$fields        = get_table_info($moduleHandler->table, $mod_fields);
149
+	rename_fields($mod_table, $renamed_fields, $fields, $mod_fields);
150
+	update_table($mod_fields, $fields, $mod_table);
151
+	if ($dbupdater->updateTable($mod_table)) {
152
+		echo 'Modified Downloads table updated <br>';
153
+	}
154
+	unset($fields);
155
+
156
+	$cat_fields = [
157
+		'cid'          => ['Type' => 'int(5) unsigned NOT NULL auto_increment', 'Default' => false],
158
+		'pid'          => ['Type' => "int(5) unsigned NOT NULL default '0'", 'Default' => true],
159
+		'title'        => ['Type' => "varchar(50) NOT NULL default ''", 'Default' => true],
160
+		'imgurl'       => ['Type' => "varchar(255) NOT NULL default ''", 'Default' => true],
161
+		'description'  => ['Type' => 'text NULL', 'Default' => true],
162
+		'total'        => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
163
+		'summary'      => ['Type' => 'text NOT NULL', 'Default' => false],
164
+		'spotlighttop' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
165
+		'spotlighthis' => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
166
+		'dohtml'       => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
167
+		'dosmiley'     => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
168
+		'doxcode'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
169
+		'doimage'      => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
170
+		'dobr'         => ['Type' => "tinyint(1) NOT NULL default '1'", 'Default' => true],
171
+		'weight'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true]
172
+	];
173
+	echo '<br><b>Checking Category table</b><br>';
174 174
 //    $catHandler = xoops_getModuleHandler('category', 'wfdownloads');
175
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
176
-    $catHandler = $helperWfdownloads->getHandler('Report');
177
-
178
-    $cat_table  = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
179
-    $fields     = get_table_info($catHandler->table, $cat_fields);
180
-    update_table($cat_fields, $fields, $cat_table);
181
-    if ($dbupdater->updateTable($cat_table)) {
182
-        echo 'Category table updated<br>';
183
-    }
184
-    unset($fields);
185
-
186
-    $broken_fields = [
187
-        'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
188
-        'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
189
-        'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
190
-        'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
191
-        'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
192
-        'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
193
-        'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
194
-    ];
195
-    echo '<br><b>Checking Broken Report table</b><br>';
196
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
197
-    $brokenHandler = $helperWfdownloads->getHandler('Report');
175
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
176
+	$catHandler = $helperWfdownloads->getHandler('Report');
177
+
178
+	$cat_table  = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
179
+	$fields     = get_table_info($catHandler->table, $cat_fields);
180
+	update_table($cat_fields, $fields, $cat_table);
181
+	if ($dbupdater->updateTable($cat_table)) {
182
+		echo 'Category table updated<br>';
183
+	}
184
+	unset($fields);
185
+
186
+	$broken_fields = [
187
+		'reportid'     => ['Type' => 'int(5) NOT NULL auto_increment', 'Default' => false],
188
+		'lid'          => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
189
+		'sender'       => ['Type' => "int(11) NOT NULL default '0'", 'Default' => true],
190
+		'ip'           => ['Type' => "varchar(20) NOT NULL default ''", 'Default' => true],
191
+		'date'         => ['Type' => "varchar(11) NOT NULL default '0'", 'Default' => true],
192
+		'confirmed'    => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true],
193
+		'acknowledged' => ['Type' => "enum('0','1') NOT NULL default '0'", 'Default' => true]
194
+	];
195
+	echo '<br><b>Checking Broken Report table</b><br>';
196
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
197
+	$brokenHandler = $helperWfdownloads->getHandler('Report');
198 198
 //    $brokenHandler = xoops_getModuleHandler('report', 'wfdownloads');
199
-    $broken_table  = new Wfdownloads\DbupdaterTable('wfdownloads_broken');
200
-    $fields        = get_table_info($brokenHandler->table, $broken_fields);
201
-    update_table($broken_fields, $fields, $broken_table);
202
-    if ($dbupdater->updateTable($broken_table)) {
203
-        echo 'Broken Reports table updated<br>';
204
-    }
205
-    unset($fields);
199
+	$broken_table  = new Wfdownloads\DbupdaterTable('wfdownloads_broken');
200
+	$fields        = get_table_info($brokenHandler->table, $broken_fields);
201
+	update_table($broken_fields, $fields, $broken_table);
202
+	if ($dbupdater->updateTable($broken_table)) {
203
+		echo 'Broken Reports table updated<br>';
204
+	}
205
+	unset($fields);
206 206
 }
207 207
 
208 208
 // =========================================================================================
@@ -215,49 +215,49 @@  discard block
 block discarded – undo
215 215
  */
216 216
 function invert_nohtm_dohtml_values()
217 217
 {
218
-    $ret = [];
219
-    global $xoopsDB;
220
-    $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
221
-    $catHandler = $helperWfdownloads->getHandler('Category');
222
-    $result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
223
-    while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
224
-        $fields[$existing_field['field']] = $existing_field['type'];
225
-    }
226
-    if (in_array('nohtml', array_keys($fields))) {
227
-        $dbupdater = new Wfdownloads\Dbupdater();
228
-        //Invert column values
229
-        // alter options in wfdownloads_cat
230
-        $table = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
231
-        $table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
232
-        $table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
233
-        $table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
234
-        $table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
235
-        $table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
236
-
237
-        //inverting values no=1 <=> do=0
238
-        // have to store teporarly as value = 2 to
239
-        // avoid putting everithing to same value
240
-        // if you change 1 to 0, then 0 to one,
241
-        // every value will be 1, follow me?
242
-        $table->addUpdatedWhere('dohtml', 2, '=1');
243
-        $table->addUpdatedWhere('dohtml', 1, '=0');
244
-        $table->addUpdatedWhere('dohtml', 0, '=2');
245
-
246
-        $table->addUpdatedWhere('dosmiley', 2, '=1');
247
-        $table->addUpdatedWhere('dosmiley', 1, '=0');
248
-        $table->addUpdatedWhere('dosmiley', 0, '=2');
249
-
250
-        $table->addUpdatedWhere('doxcode', 2, '=1');
251
-        $table->addUpdatedWhere('doxcode', 1, '=0');
252
-        $table->addUpdatedWhere('doxcode', 0, '=2');
253
-
254
-        $table->addUpdatedWhere('doimage', 2, '=1');
255
-        $table->addUpdatedWhere('doimage', 1, '=0');
256
-        $table->addUpdatedWhere('doimage', 0, '=2');
257
-        $ret = $dbupdater->updateTable($table);
258
-    }
259
-
260
-    return $ret;
218
+	$ret = [];
219
+	global $xoopsDB;
220
+	$helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
221
+	$catHandler = $helperWfdownloads->getHandler('Category');
222
+	$result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
223
+	while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
224
+		$fields[$existing_field['field']] = $existing_field['type'];
225
+	}
226
+	if (in_array('nohtml', array_keys($fields))) {
227
+		$dbupdater = new Wfdownloads\Dbupdater();
228
+		//Invert column values
229
+		// alter options in wfdownloads_cat
230
+		$table = new Wfdownloads\DbupdaterTable('wfdownloads_cat');
231
+		$table->addAlteredField('nohtml', "dohtml tinyint(1) NOT NULL DEFAULT '1'");
232
+		$table->addAlteredField('nosmiley', "dosmiley tinyint(1) NOT NULL DEFAULT '1'");
233
+		$table->addAlteredField('noxcodes', "doxcode tinyint(1) NOT NULL DEFAULT '1'");
234
+		$table->addAlteredField('noimages', "doimage tinyint(1) NOT NULL DEFAULT '1'");
235
+		$table->addAlteredField('nobreak', "dobr tinyint(1) NOT NULL DEFAULT '1'");
236
+
237
+		//inverting values no=1 <=> do=0
238
+		// have to store teporarly as value = 2 to
239
+		// avoid putting everithing to same value
240
+		// if you change 1 to 0, then 0 to one,
241
+		// every value will be 1, follow me?
242
+		$table->addUpdatedWhere('dohtml', 2, '=1');
243
+		$table->addUpdatedWhere('dohtml', 1, '=0');
244
+		$table->addUpdatedWhere('dohtml', 0, '=2');
245
+
246
+		$table->addUpdatedWhere('dosmiley', 2, '=1');
247
+		$table->addUpdatedWhere('dosmiley', 1, '=0');
248
+		$table->addUpdatedWhere('dosmiley', 0, '=2');
249
+
250
+		$table->addUpdatedWhere('doxcode', 2, '=1');
251
+		$table->addUpdatedWhere('doxcode', 1, '=0');
252
+		$table->addUpdatedWhere('doxcode', 0, '=2');
253
+
254
+		$table->addUpdatedWhere('doimage', 2, '=1');
255
+		$table->addUpdatedWhere('doimage', 1, '=0');
256
+		$table->addUpdatedWhere('doimage', 0, '=2');
257
+		$ret = $dbupdater->updateTable($table);
258
+	}
259
+
260
+	return $ret;
261 261
 }
262 262
 
263 263
 /**
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function update_table($new_fields, $existing_fields, &$table)
272 272
 {
273
-    foreach ($new_fields as $field => $fieldinfo) {
274
-        $type = $fieldinfo['Type'];
275
-        if (!in_array($field, array_keys($existing_fields))) {
276
-            //Add field as it is missing
277
-            $table->addNewField($field, $type);
278
-        //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
279
-            //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
280
-        } elseif ($existing_fields[$field] != $type) {
281
-            $table->addAlteredField($field, $field . ' ' . $type);
282
-        // check $fields[$field]['type'] for things like "int(10) unsigned"
283
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
284
-            //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
285
-        } else {
286
-            //echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
287
-        }
288
-    }
273
+	foreach ($new_fields as $field => $fieldinfo) {
274
+		$type = $fieldinfo['Type'];
275
+		if (!in_array($field, array_keys($existing_fields))) {
276
+			//Add field as it is missing
277
+			$table->addNewField($field, $type);
278
+		//$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
279
+			//echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
280
+		} elseif ($existing_fields[$field] != $type) {
281
+			$table->addAlteredField($field, $field . ' ' . $type);
282
+		// check $fields[$field]['type'] for things like "int(10) unsigned"
283
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
284
+			//echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
285
+		} else {
286
+			//echo $field." <FONT COLOR='#0033FF'>Uptodate</FONT><br>";
287
+		}
288
+	}
289 289
 }
290 290
 
291 291
 /**
@@ -298,22 +298,22 @@  discard block
 block discarded – undo
298 298
  */
299 299
 function get_table_info($table, $default_fields)
300 300
 {
301
-    global $xoopsDB;
302
-    $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
303
-    while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
304
-        $fields[$existing_field['Field']] = $existing_field['Type'];
305
-        if ('YES' !== $existing_field['Null']) {
306
-            $fields[$existing_field['Field']] .= ' NOT NULL';
307
-        }
308
-        if ($existing_field['Extra']) {
309
-            $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
310
-        }
311
-        if ($default_fields[$existing_field['Field']]['Default']) {
312
-            $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
313
-        }
314
-    }
315
-
316
-    return $fields;
301
+	global $xoopsDB;
302
+	$result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
303
+	while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
304
+		$fields[$existing_field['Field']] = $existing_field['Type'];
305
+		if ('YES' !== $existing_field['Null']) {
306
+			$fields[$existing_field['Field']] .= ' NOT NULL';
307
+		}
308
+		if ($existing_field['Extra']) {
309
+			$fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
310
+		}
311
+		if ($default_fields[$existing_field['Field']]['Default']) {
312
+			$fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
313
+		}
314
+	}
315
+
316
+	return $fields;
317 317
 }
318 318
 
319 319
 /**
@@ -327,60 +327,60 @@  discard block
 block discarded – undo
327 327
  */
328 328
 function rename_fields(&$table, $renamed_fields, &$fields, $new_fields)
329 329
 {
330
-    foreach (array_keys($fields) as $field) {
331
-        if (in_array($field, array_keys($renamed_fields))) {
332
-            $new_field_name = $renamed_fields[$field];
333
-            $new_field_type = $new_fields[$new_field_name]['Type'];
334
-            $table->addAltered($field, $new_field_name . ' ' . $new_field_type);
335
-            //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
336
-            //echo $field." Renamed to ".$new_field_name."<br>";
337
-            $fields[$new_field_name] = $new_field_type;
338
-        }
339
-    }
340
-    //return $fields;
330
+	foreach (array_keys($fields) as $field) {
331
+		if (in_array($field, array_keys($renamed_fields))) {
332
+			$new_field_name = $renamed_fields[$field];
333
+			$new_field_type = $new_fields[$new_field_name]['Type'];
334
+			$table->addAltered($field, $new_field_name . ' ' . $new_field_type);
335
+			//$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
336
+			//echo $field." Renamed to ".$new_field_name."<br>";
337
+			$fields[$new_field_name] = $new_field_type;
338
+		}
339
+	}
340
+	//return $fields;
341 341
 }
342 342
 
343 343
 $op = \Xmf\Request::getInt('op', 0, 'REQUEST');
344 344
 switch ($op) {
345
-    case 1:
346
-        // Make sure that nohtml is properly changed to dohtml
347
-        invert_nohtm_dohtml_values();
348
-        // Ensure that the proper tables are present
349
-        update_tables_to_300();
350
-        // Import data from MyDownloads
351
-        import_mydownloads_to_wfdownloads();
352
-        break;
353
-
354
-    case 2:
355
-        // Update WF-Downloads
356
-        $log = invert_nohtm_dohtml_values();
357
-        update_tables_to_300();
358
-        break;
359
-
360
-    default:
361
-        //ask what to do
362
-        include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
363
-        $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
364
-
365
-        //Is MyDownloads installed?
366
-        /** @var XoopsModuleHandler $moduleHandler */
367
-        $moduleHandler     = xoops_getHandler('module');
368
-        $mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
369
-        if (is_object($mydownloadsModule)) {
370
-            $mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
371
-            $mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
372
-            $form->addElement($mydownloadsButton);
373
-        }
374
-
375
-        if (!wfdownloads_TableExists('wfdownloads_meta')) {
376
-            $updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
377
-            $updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
378
-            $form->addElement($updateButton);
379
-        }
380
-
381
-        $form->addElement(new \XoopsFormHidden('op', 0));
382
-        $form->display();
383
-        break;
345
+	case 1:
346
+		// Make sure that nohtml is properly changed to dohtml
347
+		invert_nohtm_dohtml_values();
348
+		// Ensure that the proper tables are present
349
+		update_tables_to_300();
350
+		// Import data from MyDownloads
351
+		import_mydownloads_to_wfdownloads();
352
+		break;
353
+
354
+	case 2:
355
+		// Update WF-Downloads
356
+		$log = invert_nohtm_dohtml_values();
357
+		update_tables_to_300();
358
+		break;
359
+
360
+	default:
361
+		//ask what to do
362
+		include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
363
+		$form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
364
+
365
+		//Is MyDownloads installed?
366
+		/** @var XoopsModuleHandler $moduleHandler */
367
+		$moduleHandler     = xoops_getHandler('module');
368
+		$mydownloadsModule = $moduleHandler->getByDirname('mydownloads');
369
+		if (is_object($mydownloadsModule)) {
370
+			$mydownloadsButton = new \XoopsFormButton('Import data from MyDownloads', 'myd_button', 'Import', 'submit');
371
+			$mydownloadsButton->setExtra("onclick='document.forms.form.op.value=\"1\"'");
372
+			$form->addElement($mydownloadsButton);
373
+		}
374
+
375
+		if (!wfdownloads_TableExists('wfdownloads_meta')) {
376
+			$updateButton = new \XoopsFormButton('Update WF-Downloads', 'upd_button', 'Update', 'submit');
377
+			$updateButton->setExtra("onclick='document.forms.form.op.value=\"2\"'");
378
+			$form->addElement($updateButton);
379
+		}
380
+
381
+		$form->addElement(new \XoopsFormHidden('op', 0));
382
+		$form->display();
383
+		break;
384 384
 }
385 385
 //wfdownloads_modFooter();
386 386
 //xoops_cp_footer();
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 use XoopsModules\Wfdownloads;
11 11
 use XoopsModules\Smartobject;
12 12
 
13
-require_once __DIR__ . '/admin_header.php';
14
-require_once SMARTCONTENT_ROOT_PATH . 'class/dbupdater.php';
13
+require_once __DIR__.'/admin_header.php';
14
+require_once SMARTCONTENT_ROOT_PATH.'class/dbupdater.php';
15 15
 
16 16
 smartcontent_xoops_cp_header();
17 17
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     global $xoopsDB;
220 220
     $helperWfdownloads = \Xmf\Module\Helper::getHelper('wfdownloads');
221 221
     $catHandler = $helperWfdownloads->getHandler('Category');
222
-    $result     = $xoopsDB->query('SHOW COLUMNS FROM ' . $catHandler->table);
222
+    $result     = $xoopsDB->query('SHOW COLUMNS FROM '.$catHandler->table);
223 223
     while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
224 224
         $fields[$existing_field['field']] = $existing_field['type'];
225 225
     }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
         //$xoopsDB->query("ALTER TABLE ".$table." ADD ".$field." ".$type);
279 279
             //echo $field."(".$type.") <FONT COLOR='##22DD51'>Added</FONT><br>";
280 280
         } elseif ($existing_fields[$field] != $type) {
281
-            $table->addAlteredField($field, $field . ' ' . $type);
281
+            $table->addAlteredField($field, $field.' '.$type);
282 282
         // check $fields[$field]['type'] for things like "int(10) unsigned"
283 283
             //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$field." ".$type);
284 284
             //echo $field." <FONT COLOR='#FF6600'>Changed to</FONT> ".$type."<br>";
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
 function get_table_info($table, $default_fields)
300 300
 {
301 301
     global $xoopsDB;
302
-    $result = $xoopsDB->query('SHOW COLUMNS FROM ' . $table);
302
+    $result = $xoopsDB->query('SHOW COLUMNS FROM '.$table);
303 303
     while (false !== ($existing_field = $xoopsDB->fetchArray($result))) {
304 304
         $fields[$existing_field['Field']] = $existing_field['Type'];
305 305
         if ('YES' !== $existing_field['Null']) {
306 306
             $fields[$existing_field['Field']] .= ' NOT NULL';
307 307
         }
308 308
         if ($existing_field['Extra']) {
309
-            $fields[$existing_field['Field']] .= ' ' . $existing_field['Extra'];
309
+            $fields[$existing_field['Field']] .= ' '.$existing_field['Extra'];
310 310
         }
311 311
         if ($default_fields[$existing_field['Field']]['Default']) {
312
-            $fields[$existing_field['Field']] .= " default '" . $existing_field['Default'] . "'";
312
+            $fields[$existing_field['Field']] .= " default '".$existing_field['Default']."'";
313 313
         }
314 314
     }
315 315
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         if (in_array($field, array_keys($renamed_fields))) {
332 332
             $new_field_name = $renamed_fields[$field];
333 333
             $new_field_type = $new_fields[$new_field_name]['Type'];
334
-            $table->addAltered($field, $new_field_name . ' ' . $new_field_type);
334
+            $table->addAltered($field, $new_field_name.' '.$new_field_type);
335 335
             //$xoopsDB->query("ALTER TABLE ".$table." CHANGE ".$field." ".$new_field_name." ".$new_field_type);
336 336
             //echo $field." Renamed to ".$new_field_name."<br>";
337 337
             $fields[$new_field_name] = $new_field_type;
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
     default:
361 361
         //ask what to do
362
-        include XOOPS_ROOT_PATH . '/class/xoopsformloader.php';
362
+        include XOOPS_ROOT_PATH.'/class/xoopsformloader.php';
363 363
         $form = new \XoopsThemeForm('Upgrade WF-Downloads', 'form', $_SERVER['REQUEST_URI']);
364 364
 
365 365
         //Is MyDownloads installed?
@@ -384,4 +384,4 @@  discard block
 block discarded – undo
384 384
 }
385 385
 //wfdownloads_modFooter();
386 386
 //xoops_cp_footer();
387
-require_once __DIR__ . '/admin_footer.php';
387
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/customtag.php 3 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -17,32 +17,32 @@  discard block
 block discarded – undo
17 17
 
18 18
 function editcustomtag($showmenu = false, $customtagid = 0, $clone = false)
19 19
 {
20
-    global $smartobjectCustomtagHandler;
21
-
22
-    $customtagObj = $smartobjectCustomtagHandler->get($customtagid);
23
-
24
-    if (!$clone && !$customtagObj->isNew()) {
25
-        if ($showmenu) {
26
-            //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING);
27
-        }
28
-        Smartobject\Utility::getCollapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO);
29
-
30
-        $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag');
31
-        $sform->display();
32
-        Smartobject\Utility::closeCollapsable('customtagedit');
33
-    } else {
34
-        $customtagObj->setVar('customtagid', 0);
35
-        $customtagObj->setVar('tag', '');
36
-
37
-        if ($showmenu) {
38
-            //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW);
39
-        }
40
-
41
-        Smartobject\Utility::getCollapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO);
42
-        $sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag');
43
-        $sform->display();
44
-        Smartobject\Utility::closeCollapsable('customtagcreate');
45
-    }
20
+	global $smartobjectCustomtagHandler;
21
+
22
+	$customtagObj = $smartobjectCustomtagHandler->get($customtagid);
23
+
24
+	if (!$clone && !$customtagObj->isNew()) {
25
+		if ($showmenu) {
26
+			//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _AM_SOBJECT_EDITING);
27
+		}
28
+		Smartobject\Utility::getCollapsableBar('customtagedit', _AM_SOBJECT_CUSTOMTAGS_EDIT, _AM_SOBJECT_CUSTOMTAGS_EDIT_INFO);
29
+
30
+		$sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_EDIT, 'addcustomtag');
31
+		$sform->display();
32
+		Smartobject\Utility::closeCollapsable('customtagedit');
33
+	} else {
34
+		$customtagObj->setVar('customtagid', 0);
35
+		$customtagObj->setVar('tag', '');
36
+
37
+		if ($showmenu) {
38
+			//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS . " > " . _CO_SOBJECT_CREATINGNEW);
39
+		}
40
+
41
+		Smartobject\Utility::getCollapsableBar('customtagcreate', _AM_SOBJECT_CUSTOMTAGS_CREATE, _AM_SOBJECT_CUSTOMTAGS_CREATE_INFO);
42
+		$sform = $customtagObj->getForm(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'addcustomtag');
43
+		$sform->display();
44
+		Smartobject\Utility::closeCollapsable('customtagcreate');
45
+	}
46 46
 }
47 47
 
48 48
 require_once __DIR__ . '/admin_header.php';
@@ -57,70 +57,70 @@  discard block
 block discarded – undo
57 57
 $op = '';
58 58
 
59 59
 if (isset($_GET['op'])) {
60
-    $op = $_GET['op'];
60
+	$op = $_GET['op'];
61 61
 }
62 62
 if (isset($_POST['op'])) {
63
-    $op = $_POST['op'];
63
+	$op = $_POST['op'];
64 64
 }
65 65
 
66 66
 switch ($op) {
67
-    case 'mod':
67
+	case 'mod':
68 68
 
69
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
69
+		$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
70 70
 
71
-        Smartobject\Utility::getXoopsCpHeader();
72
-        $adminObject->displayNavigation(basename(__FILE__));
71
+		Smartobject\Utility::getXoopsCpHeader();
72
+		$adminObject->displayNavigation(basename(__FILE__));
73 73
 
74
-        editcustomtag(true, $customtagid);
75
-        break;
74
+		editcustomtag(true, $customtagid);
75
+		break;
76 76
 
77
-    case 'clone':
77
+	case 'clone':
78 78
 
79
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
79
+		$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
80 80
 
81
-        Smartobject\Utility::getXoopsCpHeader();
82
-        $adminObject->displayNavigation(basename(__FILE__));
81
+		Smartobject\Utility::getXoopsCpHeader();
82
+		$adminObject->displayNavigation(basename(__FILE__));
83 83
 
84
-        editcustomtag(true, $customtagid, true);
85
-        break;
84
+		editcustomtag(true, $customtagid, true);
85
+		break;
86 86
 
87
-    case 'addcustomtag':
87
+	case 'addcustomtag':
88 88
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
89
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
-        break;
89
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
+		$controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
+		break;
92 92
 
93
-    case 'del':
93
+	case 'del':
94 94
 
95 95
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
96
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
-        $controller->handleObjectDeletion();
96
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
+		$controller->handleObjectDeletion();
98 98
 
99
-        break;
99
+		break;
100 100
 
101
-    default:
101
+	default:
102 102
 
103
-        Smartobject\Utility::getXoopsCpHeader();
104
-        $adminObject->displayNavigation(basename(__FILE__));
105
-        $adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
-        $adminObject->displayButton('left', '');
103
+		Smartobject\Utility::getXoopsCpHeader();
104
+		$adminObject->displayNavigation(basename(__FILE__));
105
+		$adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
+		$adminObject->displayButton('left', '');
107 107
 
108
-        //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
108
+		//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
109 109
 
110
-        Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
110
+		Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
111 111
 
112 112
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
113
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
113
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
117 117
 
118
-        //      $objectTable->addCustomAction('getCreateItemLink');
119
-        //      $objectTable->addCustomAction('getCreateAttributLink');
118
+		//      $objectTable->addCustomAction('getCreateItemLink');
119
+		//      $objectTable->addCustomAction('getCreateAttributLink');
120 120
 
121
-        //      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
121
+		//      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
122 122
 
123
-        /*
123
+		/*
124 124
                 $criteria_upcoming = new \CriteriaCompo();
125 125
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
126 126
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
                                             'criteria' => $criteria_last30days
145 145
                 ));
146 146
         */
147
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
148
-        $objectTable->addCustomAction('getCloneLink');
147
+		$objectTable->addQuickSearch(['title', 'summary', 'description']);
148
+		$objectTable->addCustomAction('getCloneLink');
149 149
 
150
-        $objectTable->render();
150
+		$objectTable->render();
151 151
 
152
-        echo '<br>';
153
-        Smartobject\Utility::closeCollapsable('createdcustomtags');
154
-        echo '<br>';
152
+		echo '<br>';
153
+		Smartobject\Utility::closeCollapsable('createdcustomtags');
154
+		echo '<br>';
155 155
 
156
-        break;
156
+		break;
157 157
 }
158 158
 
159 159
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -64,63 +64,63 @@  discard block
 block discarded – undo
64 64
 }
65 65
 
66 66
 switch ($op) {
67
-    case 'mod':
67
+    	case 'mod':
68 68
 
69
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
69
+        	$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
70 70
 
71
-        Smartobject\Utility::getXoopsCpHeader();
72
-        $adminObject->displayNavigation(basename(__FILE__));
71
+        	Smartobject\Utility::getXoopsCpHeader();
72
+        	$adminObject->displayNavigation(basename(__FILE__));
73 73
 
74
-        editcustomtag(true, $customtagid);
75
-        break;
74
+        	editcustomtag(true, $customtagid);
75
+        	break;
76 76
 
77
-    case 'clone':
77
+    	case 'clone':
78 78
 
79
-        $customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
79
+        	$customtagid = \Xmf\Request::getInt('customtagid', 0, 'GET');
80 80
 
81
-        Smartobject\Utility::getXoopsCpHeader();
82
-        $adminObject->displayNavigation(basename(__FILE__));
81
+        	Smartobject\Utility::getXoopsCpHeader();
82
+        	$adminObject->displayNavigation(basename(__FILE__));
83 83
 
84
-        editcustomtag(true, $customtagid, true);
85
-        break;
84
+        	editcustomtag(true, $customtagid, true);
85
+        	break;
86 86
 
87
-    case 'addcustomtag':
88
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
89
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
-        $controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
-        break;
87
+    	case 'addcustomtag':
88
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
89
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
90
+        	$controller->storeFromDefaultForm(_AM_SOBJECT_CUSTOMTAGS_CREATED, _AM_SOBJECT_CUSTOMTAGS_MODIFIED);
91
+        	break;
92 92
 
93
-    case 'del':
93
+    	case 'del':
94 94
 
95
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
96
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
-        $controller->handleObjectDeletion();
95
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
96
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectCustomtagHandler);
97
+        	$controller->handleObjectDeletion();
98 98
 
99
-        break;
99
+        	break;
100 100
 
101
-    default:
101
+    	default:
102 102
 
103
-        Smartobject\Utility::getXoopsCpHeader();
104
-        $adminObject->displayNavigation(basename(__FILE__));
105
-        $adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
-        $adminObject->displayButton('left', '');
103
+        	Smartobject\Utility::getXoopsCpHeader();
104
+        	$adminObject->displayNavigation(basename(__FILE__));
105
+        	$adminObject->addItemButton(_AM_SOBJECT_CUSTOMTAGS_CREATE, 'customtag.php?op=mod', 'add', '');
106
+        	$adminObject->displayButton('left', '');
107 107
 
108
-        //Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
108
+        	//Smartobject\Utility::getAdminMenu(2, _AM_SOBJECT_CUSTOMTAGS);
109 109
 
110
-        Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
110
+        	Smartobject\Utility::getCollapsableBar('createdcustomtags', _AM_SOBJECT_CUSTOMTAGS, _AM_SOBJECT_CUSTOMTAGS_DSC);
111 111
 
112
-//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
113
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
112
+	//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
113
+        	$objectTable = new XoopsModules\Smartobject\Table($smartobjectCustomtagHandler);
114
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left', 150, 'getCustomtagName'));
115
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('description', 'left'));
116
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('language', 'center', 150));
117 117
 
118
-        //      $objectTable->addCustomAction('getCreateItemLink');
119
-        //      $objectTable->addCustomAction('getCreateAttributLink');
118
+        	//      $objectTable->addCustomAction('getCreateItemLink');
119
+        	//      $objectTable->addCustomAction('getCreateAttributLink');
120 120
 
121
-        //      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
121
+        	//      $objectTable->addIntroButton('addcustomtag', 'customtag.php?op=mod', _AM_SOBJECT_CUSTOMTAGS_CREATE); //mb button
122 122
 
123
-        /*
123
+        	/*
124 124
                 $criteria_upcoming = new \CriteriaCompo();
125 125
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
126 126
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -144,16 +144,16 @@  discard block
 block discarded – undo
144 144
                                             'criteria' => $criteria_last30days
145 145
                 ));
146 146
         */
147
-        $objectTable->addQuickSearch(['title', 'summary', 'description']);
148
-        $objectTable->addCustomAction('getCloneLink');
147
+        	$objectTable->addQuickSearch(['title', 'summary', 'description']);
148
+        	$objectTable->addCustomAction('getCloneLink');
149 149
 
150
-        $objectTable->render();
150
+        	$objectTable->render();
151 151
 
152
-        echo '<br>';
153
-        Smartobject\Utility::closeCollapsable('createdcustomtags');
154
-        echo '<br>';
152
+        	echo '<br>';
153
+        	Smartobject\Utility::closeCollapsable('createdcustomtags');
154
+        	echo '<br>';
155 155
 
156
-        break;
156
+        	break;
157 157
 }
158 158
 
159 159
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     }
46 46
 }
47 47
 
48
-require_once __DIR__ . '/admin_header.php';
48
+require_once __DIR__.'/admin_header.php';
49 49
 Smartobject\Utility::loadLanguageFile('smartobject', 'customtag');
50 50
 
51 51
 //require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
@@ -158,4 +158,4 @@  discard block
 block discarded – undo
158 158
 
159 159
 //Smartobject\Utility::getModFooter();
160 160
 //xoops_cp_footer();
161
-require_once __DIR__ . '/admin_footer.php';
161
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.
admin/rating.php 3 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -16,44 +16,44 @@  discard block
 block discarded – undo
16 16
 
17 17
 function editclass($showmenu = false, $ratingid = 0)
18 18
 {
19
-    global $smartobjectRatingHandler;
20
-
21
-    $ratingObj = $smartobjectRatingHandler->get($ratingid);
22
-
23
-    if (!$ratingObj->isNew()) {
24
-        if ($showmenu) {
25
-            //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING);
26
-        }
27
-        Smartobject\Utility::getCollapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO);
28
-
29
-        $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating');
30
-        $sform->display();
31
-        Smartobject\Utility::closeCollapsable('ratingedit');
32
-    } else {
33
-        $ratingObj->hideFieldFromForm(['item', 'itemid', 'uid', 'date', 'rate']);
34
-
35
-        if (isset($_POST['op'])) {
36
-            $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
37
-            $controller->postDataToObject($ratingObj);
38
-
39
-            if ('changedField' === $_POST['op']) {
40
-                switch ($_POST['changedField']) {
41
-                    case 'dirname':
42
-                        $ratingObj->showFieldOnForm(['item', 'itemid', 'uid', 'date', 'rate']);
43
-                        break;
44
-                }
45
-            }
46
-        }
47
-
48
-        if ($showmenu) {
49
-            //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW);
50
-        }
51
-
52
-        Smartobject\Utility::getCollapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO);
53
-        $sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating');
54
-        $sform->display();
55
-        Smartobject\Utility::closeCollapsable('ratingcreate');
56
-    }
19
+	global $smartobjectRatingHandler;
20
+
21
+	$ratingObj = $smartobjectRatingHandler->get($ratingid);
22
+
23
+	if (!$ratingObj->isNew()) {
24
+		if ($showmenu) {
25
+			//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _AM_SOBJECT_EDITING);
26
+		}
27
+		Smartobject\Utility::getCollapsableBar('ratingedit', _AM_SOBJECT_RATINGS_EDIT, _AM_SOBJECT_RATINGS_EDIT_INFO);
28
+
29
+		$sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_EDIT, 'addrating');
30
+		$sform->display();
31
+		Smartobject\Utility::closeCollapsable('ratingedit');
32
+	} else {
33
+		$ratingObj->hideFieldFromForm(['item', 'itemid', 'uid', 'date', 'rate']);
34
+
35
+		if (isset($_POST['op'])) {
36
+			$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
37
+			$controller->postDataToObject($ratingObj);
38
+
39
+			if ('changedField' === $_POST['op']) {
40
+				switch ($_POST['changedField']) {
41
+					case 'dirname':
42
+						$ratingObj->showFieldOnForm(['item', 'itemid', 'uid', 'date', 'rate']);
43
+						break;
44
+				}
45
+			}
46
+		}
47
+
48
+		if ($showmenu) {
49
+			//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS . " > " . _CO_SOBJECT_CREATINGNEW);
50
+		}
51
+
52
+		Smartobject\Utility::getCollapsableBar('ratingcreate', _AM_SOBJECT_RATINGS_CREATE, _AM_SOBJECT_RATINGS_CREATE_INFO);
53
+		$sform = $ratingObj->getForm(_AM_SOBJECT_RATINGS_CREATE, 'addrating');
54
+		$sform->display();
55
+		Smartobject\Utility::closeCollapsable('ratingcreate');
56
+	}
57 57
 }
58 58
 
59 59
 require_once __DIR__ . '/admin_header.php';
@@ -65,60 +65,60 @@  discard block
 block discarded – undo
65 65
 $op = '';
66 66
 
67 67
 if (isset($_GET['op'])) {
68
-    $op = $_GET['op'];
68
+	$op = $_GET['op'];
69 69
 }
70 70
 if (isset($_POST['op'])) {
71
-    $op = $_POST['op'];
71
+	$op = $_POST['op'];
72 72
 }
73 73
 
74 74
 switch ($op) {
75
-    case 'mod':
76
-    case 'changedField':
75
+	case 'mod':
76
+	case 'changedField':
77 77
 
78
-        $ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
78
+		$ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
79 79
 
80
-        Smartobject\Utility::getXoopsCpHeader();
81
-        $adminObject->displayNavigation(basename(__FILE__));
80
+		Smartobject\Utility::getXoopsCpHeader();
81
+		$adminObject->displayNavigation(basename(__FILE__));
82 82
 
83
-        editclass(true, $ratingid);
84
-        break;
83
+		editclass(true, $ratingid);
84
+		break;
85 85
 
86
-    case 'addrating':
86
+	case 'addrating':
87 87
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
88
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
-        $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
88
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
+		$controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
90 90
 
91
-        break;
91
+		break;
92 92
 
93
-    case 'del':
93
+	case 'del':
94 94
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
-        $controller->handleObjectDeletion();
95
+		$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
+		$controller->handleObjectDeletion();
97 97
 
98
-        break;
98
+		break;
99 99
 
100
-    default:
100
+	default:
101 101
 
102
-        Smartobject\Utility::getXoopsCpHeader();
103
-        $adminObject->displayNavigation(basename(__FILE__));
102
+		Smartobject\Utility::getXoopsCpHeader();
103
+		$adminObject->displayNavigation(basename(__FILE__));
104 104
 
105
-        //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
105
+		//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
106 106
 
107
-        Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
107
+		Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
108 108
 
109 109
 //        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
110
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
116
-
117
-        //      $objectTable->addCustomAction('getCreateItemLink');
118
-        //      $objectTable->addCustomAction('getCreateAttributLink');
119
-
120
-        $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
-        /*
110
+		$objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
+		$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
116
+
117
+		//      $objectTable->addCustomAction('getCreateItemLink');
118
+		//      $objectTable->addCustomAction('getCreateAttributLink');
119
+
120
+		$objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
+		/*
122 122
                 $criteria_upcoming = new \CriteriaCompo();
123 123
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
124 124
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
                 ));
144 144
         */
145 145
 
146
-        $objectTable->render();
146
+		$objectTable->render();
147 147
 
148
-        echo '<br>';
149
-        Smartobject\Utility::closeCollapsable('createdratings');
150
-        echo '<br>';
148
+		echo '<br>';
149
+		Smartobject\Utility::closeCollapsable('createdratings');
150
+		echo '<br>';
151 151
 
152
-        break;
152
+		break;
153 153
 }
154 154
 
155 155
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -72,53 +72,53 @@  discard block
 block discarded – undo
72 72
 }
73 73
 
74 74
 switch ($op) {
75
-    case 'mod':
76
-    case 'changedField':
75
+    	case 'mod':
76
+    	case 'changedField':
77 77
 
78
-        $ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
78
+        	$ratingid = \Xmf\Request::getInt('ratingid', 0, 'GET');
79 79
 
80
-        Smartobject\Utility::getXoopsCpHeader();
81
-        $adminObject->displayNavigation(basename(__FILE__));
80
+        	Smartobject\Utility::getXoopsCpHeader();
81
+        	$adminObject->displayNavigation(basename(__FILE__));
82 82
 
83
-        editclass(true, $ratingid);
84
-        break;
83
+        	editclass(true, $ratingid);
84
+        	break;
85 85
 
86
-    case 'addrating':
87
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
88
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
-        $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
86
+    	case 'addrating':
87
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
88
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
+        	$controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
90 90
 
91
-        break;
91
+        	break;
92 92
 
93
-    case 'del':
94
-//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
-        $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
-        $controller->handleObjectDeletion();
93
+    	case 'del':
94
+	//        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
95
+        	$controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
96
+        	$controller->handleObjectDeletion();
97 97
 
98
-        break;
98
+        	break;
99 99
 
100
-    default:
100
+    	default:
101 101
 
102
-        Smartobject\Utility::getXoopsCpHeader();
103
-        $adminObject->displayNavigation(basename(__FILE__));
102
+        	Smartobject\Utility::getXoopsCpHeader();
103
+        	$adminObject->displayNavigation(basename(__FILE__));
104 104
 
105
-        //Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
105
+        	//Smartobject\Utility::getAdminMenu(4, _AM_SOBJECT_RATINGS);
106 106
 
107
-        Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
107
+        	Smartobject\Utility::getCollapsableBar('createdratings', _AM_SOBJECT_RATINGS, _AM_SOBJECT_RATINGS_DSC);
108 108
 
109
-//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
110
-        $objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
-        $objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
109
+	//        require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
110
+        	$objectTable = new XoopsModules\Smartobject\Table($smartobjectRatingHandler);
111
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('name', 'left'));
112
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('dirname', 'left'));
113
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('item', 'left', false, 'getItemValue'));
114
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('date', 'center', 150));
115
+        	$objectTable->addColumn(new XoopsModules\Smartobject\ObjectColumn('rate', 'center', 40, 'getRateValue'));
116 116
 
117
-        //      $objectTable->addCustomAction('getCreateItemLink');
118
-        //      $objectTable->addCustomAction('getCreateAttributLink');
117
+        	//      $objectTable->addCustomAction('getCreateItemLink');
118
+        	//      $objectTable->addCustomAction('getCreateAttributLink');
119 119
 
120
-        $objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
-        /*
120
+        	$objectTable->addIntroButton('addrating', 'rating.php?op=mod', _AM_SOBJECT_RATINGS_CREATE);
121
+        	/*
122 122
                 $criteria_upcoming = new \CriteriaCompo();
123 123
                 $criteria_upcoming->add(new \Criteria('start_date', time(), '>'));
124 124
                 $objectTable->addFilter(_AM_SOBJECT_FILTER_UPCOMING, array(
@@ -143,13 +143,13 @@  discard block
 block discarded – undo
143 143
                 ));
144 144
         */
145 145
 
146
-        $objectTable->render();
146
+        	$objectTable->render();
147 147
 
148
-        echo '<br>';
149
-        Smartobject\Utility::closeCollapsable('createdratings');
150
-        echo '<br>';
148
+        	echo '<br>';
149
+        	Smartobject\Utility::closeCollapsable('createdratings');
150
+        	echo '<br>';
151 151
 
152
-        break;
152
+        	break;
153 153
 }
154 154
 
155 155
 //Smartobject\Utility::getModFooter();
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     }
57 57
 }
58 58
 
59
-require_once __DIR__ . '/admin_header.php';
59
+require_once __DIR__.'/admin_header.php';
60 60
 //require_once SMARTOBJECT_ROOT_PATH . 'class/smartobjecttable.php';
61 61
 //require_once SMARTOBJECT_ROOT_PATH . 'class/rating.php';
62 62
 $smartobjectRatingHandler = Smartobject\Helper::getInstance()->getHandler('Rating');
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     case 'addrating':
87 87
 //        require_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectcontroller.php';
88 88
         $controller = new XoopsModules\Smartobject\ObjectController($smartobjectRatingHandler);
89
-        $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL . 'admin/rating.php');
89
+        $controller->storeFromDefaultForm(_AM_SOBJECT_RATINGS_CREATED, _AM_SOBJECT_RATINGS_MODIFIED, SMARTOBJECT_URL.'admin/rating.php');
90 90
 
91 91
         break;
92 92
 
@@ -154,4 +154,4 @@  discard block
 block discarded – undo
154 154
 
155 155
 //Smartobject\Utility::getModFooter();
156 156
 //xoops_cp_footer();
157
-require_once __DIR__ . '/admin_footer.php';
157
+require_once __DIR__.'/admin_footer.php';
Please login to merge, or discard this patch.