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