1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Class MyalbumUtility |
5
|
|
|
*/ |
6
|
|
|
class SoapboxUtility extends XoopsObject |
|
|
|
|
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Function responsible for checking if a directory exists, we can also write in and create an index.html file |
10
|
|
|
* |
11
|
|
|
* @param string $folder The full path of the directory to check |
12
|
|
|
* |
13
|
|
|
* @return void |
14
|
|
|
*/ |
15
|
|
|
public static function createFolder($folder) |
16
|
|
|
{ |
17
|
|
|
try { |
18
|
|
|
if (!file_exists($folder)) { |
19
|
|
|
if (!mkdir($folder) && !is_dir($folder)) { |
20
|
|
|
throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); |
21
|
|
|
} else { |
22
|
|
|
file_put_contents($folder . '/index.html', '<script>history.go(-1);</script>'); |
23
|
|
|
} |
24
|
|
|
} |
25
|
|
|
} |
26
|
|
|
catch (Exception $e) { |
27
|
|
|
echo 'Caught exception: ', $e->getMessage(), "\n", '<br/>'; |
28
|
|
|
} |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @param $file |
33
|
|
|
* @param $folder |
34
|
|
|
* @return bool |
35
|
|
|
*/ |
36
|
|
|
public static function copyFile($file, $folder) |
37
|
|
|
{ |
38
|
|
|
return copy($file, $folder); |
39
|
|
|
// try { |
40
|
|
|
// if (!is_dir($folder)) { |
|
|
|
|
41
|
|
|
// throw new \RuntimeException(sprintf('Unable to copy file as: %s ', $folder)); |
|
|
|
|
42
|
|
|
// } else { |
|
|
|
|
43
|
|
|
// return copy($file, $folder); |
|
|
|
|
44
|
|
|
// } |
45
|
|
|
// } catch (Exception $e) { |
|
|
|
|
46
|
|
|
// echo 'Caught exception: ', $e->getMessage(), "\n", "<br/>"; |
|
|
|
|
47
|
|
|
// } |
48
|
|
|
// return false; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param $src |
53
|
|
|
* @param $dst |
54
|
|
|
*/ |
55
|
|
|
public static function recurseCopy($src, $dst) |
56
|
|
|
{ |
57
|
|
|
$dir = opendir($src); |
58
|
|
|
// @mkdir($dst); |
59
|
|
|
while (false !== ($file = readdir($dir))) { |
60
|
|
|
if (($file !== '.') && ($file !== '..')) { |
61
|
|
|
if (is_dir($src . '/' . $file)) { |
62
|
|
|
self::recurseCopy($src . '/' . $file, $dst . '/' . $file); |
63
|
|
|
} else { |
64
|
|
|
copy($src . '/' . $file, $dst . '/' . $file); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
closedir($dir); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* |
73
|
|
|
* Verifies XOOPS version meets minimum requirements for this module |
74
|
|
|
* @static |
75
|
|
|
* @param XoopsModule $module |
76
|
|
|
* |
77
|
|
|
* @return bool true if meets requirements, false if not |
78
|
|
|
*/ |
79
|
|
|
public static function checkVerXoops(XoopsModule $module) |
80
|
|
|
{ |
81
|
|
|
xoops_loadLanguage('admin', $module->dirname()); |
82
|
|
|
//check for minimum XOOPS version |
83
|
|
|
$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
84
|
|
|
$currArray = explode('.', $currentVer); |
85
|
|
|
$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
86
|
|
|
$reqArray = explode('.', $requiredVer); |
87
|
|
|
$success = true; |
88
|
|
|
foreach ($reqArray as $k => $v) { |
89
|
|
|
if (isset($currArray[$k])) { |
90
|
|
|
if ($currArray[$k] > $v) { |
91
|
|
|
break; |
92
|
|
|
} elseif ($currArray[$k] == $v) { |
93
|
|
|
continue; |
94
|
|
|
} else { |
95
|
|
|
$success = false; |
96
|
|
|
break; |
97
|
|
|
} |
98
|
|
|
} else { |
99
|
|
|
if ((int)$v > 0) { // handles things like x.x.x.0_RC2 |
100
|
|
|
$success = false; |
101
|
|
|
break; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
if (!$success) { |
107
|
|
|
$module->setErrors(sprintf(_AM_SOAPBOX_ERROR_BAD_XOOPS, $requiredVer, $currentVer)); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
return $success; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* |
115
|
|
|
* Verifies PHP version meets minimum requirements for this module |
116
|
|
|
* @static |
117
|
|
|
* @param XoopsModule $module |
118
|
|
|
* |
119
|
|
|
* @return bool true if meets requirements, false if not |
120
|
|
|
*/ |
121
|
|
|
public static function checkVerPhp(XoopsModule $module) |
122
|
|
|
{ |
123
|
|
|
xoops_loadLanguage('admin', $module->dirname()); |
124
|
|
|
// check for minimum PHP version |
125
|
|
|
$success = true; |
126
|
|
|
$verNum = PHP_VERSION; |
127
|
|
|
$reqVer =& $module->getInfo('min_php'); |
128
|
|
|
if (false !== $reqVer && '' !== $reqVer) { |
129
|
|
|
if (version_compare($verNum, $reqVer, '<')) { |
130
|
|
|
$module->setErrors(sprintf(_AM_SOAPBOX_ERROR_BAD_PHP, $reqVer, $verNum)); |
131
|
|
|
$success = false; |
132
|
|
|
} |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
return $success; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* getLinkedUnameFromId() |
140
|
|
|
* |
141
|
|
|
* @param integer $userid Userid of author etc |
142
|
|
|
* @param integer $name : 0 Use Usenamer 1 Use realname |
143
|
|
|
* @return string |
144
|
|
|
*/ |
145
|
|
View Code Duplication |
public static function getLinkedUnameFromId($userid = 0, $name = 0) |
|
|
|
|
146
|
|
|
{ |
147
|
|
|
if (!is_numeric($userid)) { |
148
|
|
|
return $userid; |
149
|
|
|
} |
150
|
|
|
$myts = MyTextSanitizer::getInstance(); |
151
|
|
|
$userid = (int)$userid; |
152
|
|
|
if ($userid > 0) { |
153
|
|
|
$memberHandler = xoops_getHandler('member'); |
154
|
|
|
$user = $memberHandler->getUser($userid); |
155
|
|
|
|
156
|
|
|
if (is_object($user)) { |
157
|
|
|
$username = $user->getVar('uname'); |
158
|
|
|
$usernameu = $user->getVar('name'); |
159
|
|
|
|
160
|
|
|
if ($name && !empty($usernameu)) { |
161
|
|
|
$username = $user->getVar('name'); |
162
|
|
|
} |
163
|
|
|
if (!empty($usernameu)) { |
164
|
|
|
$linkeduser = $myts->htmlSpecialChars($usernameu) . " [<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>]'; |
165
|
|
|
} else { |
166
|
|
|
// $linkeduser = "<a href='".XOOPS_URL."/userinfo.php?uid=".$userid."'>". ucfirst($ts->htmlSpecialChars($username)) .'</a>'; |
|
|
|
|
167
|
|
|
$linkeduser = "<a href='" . XOOPS_URL . '/userinfo.php?uid=' . $userid . "'>" . $myts->htmlSpecialChars($username) . '</a>'; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
return $linkeduser; |
171
|
|
|
} |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
return $myts->htmlSpecialChars($GLOBALS['xoopsConfig']['anonymous']); |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
/* |
|
|
|
|
178
|
|
|
public static function displayimage($image = 'blank.gif', $path = '', $imgsource = '', $alttext = '') |
179
|
|
|
{ |
180
|
|
|
global $xoopsConfig, $xoopsUser, $xoopsModule; |
181
|
|
|
$myts = MyTextSanitizer::getInstance(); |
182
|
|
|
$showimage = ''; |
183
|
|
|
|
184
|
|
|
if ($path) { |
185
|
|
|
$showimage = "<a href='" . $myts->htmlSpecialChars(strip_tags($path)) . "'>"; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
if (!is_dir(XOOPS_ROOT_PATH."/".$imgsource."/".$image) && file_exists(XOOPS_ROOT_PATH."/".$imgsource."/".$image)) { |
189
|
|
|
$showimage .= "<img src='".XOOPS_URL."/".$myts->htmlSpecialChars(strip_tags($imgsource))."/".$myts->htmlSpecialChars(strip_tags($image))."' border='0' alt=".$myts->htmlSpecialChars(strip_tags($alttext))." /></a>"; |
190
|
|
|
} else { |
191
|
|
|
if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { |
192
|
|
|
$showimage .= "<img src='".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/brokenimg.png' border='0' alt='"._AM_SOAPBOX_ISADMINNOTICE."' /></a>"; |
193
|
|
|
} else { |
194
|
|
|
$showimage .= "<img src='".XOOPS_URL.'/modules/'.$xoopsModule->dirname()."/assets/images/blank.png' border='0' alt=".$myts->htmlSpecialChars(strip_tags($alttext))." /></a>"; |
195
|
|
|
} |
196
|
|
|
} |
197
|
|
|
// clearstatcache(); |
198
|
|
|
return $showimage; |
199
|
|
|
} |
200
|
|
|
*/ |
201
|
|
|
/** |
202
|
|
|
* @param $allowed_mimetypes |
203
|
|
|
* @param $httppostfiles |
204
|
|
|
* @param string $redirecturl |
205
|
|
|
* @param int $num |
206
|
|
|
* @param string $dir |
207
|
|
|
* @param int $redirect |
208
|
|
|
*/ |
209
|
|
View Code Duplication |
public static function uploadFile( |
|
|
|
|
210
|
|
|
$allowed_mimetypes, |
211
|
|
|
$httppostfiles, |
212
|
|
|
$redirecturl = 'index.php', |
213
|
|
|
$num = 0, |
214
|
|
|
$dir = 'uploads', |
215
|
|
|
$redirect = 0 |
216
|
|
|
) { |
217
|
|
|
require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
218
|
|
|
$myts = MyTextSanitizer::getInstance(); |
219
|
|
|
|
220
|
|
|
global $xoopsConfig, $xoopsModuleConfig, $_POST; |
|
|
|
|
221
|
|
|
|
222
|
|
|
$maxfilesize = (int)$xoopsModuleConfig['maxfilesize']; |
223
|
|
|
$maxfilewidth = (int)$xoopsModuleConfig['maximgwidth']; |
224
|
|
|
$maxfileheight = (int)$xoopsModuleConfig['maximgheight']; |
225
|
|
|
$uploaddir = XOOPS_ROOT_PATH . '/' . $myts->htmlSpecialChars(strip_tags($dir)) . '/'; |
226
|
|
|
|
227
|
|
|
$uploader = new XoopsMediaUploader($uploaddir, $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); |
228
|
|
|
|
229
|
|
|
if ($uploader->fetchMedia($myts->htmlSpecialChars(strip_tags($_POST['xoops_upload_file'][$num])))) { |
230
|
|
|
if (!$uploader->upload()) { |
231
|
|
|
$errors = $uploader->getErrors(); |
232
|
|
|
redirect_header($redirecturl, 1, $errors); |
233
|
|
|
} else { |
234
|
|
|
if ($redirect) { |
235
|
|
|
redirect_header($redirecturl, '1', 'Image Uploaded'); |
236
|
|
|
} |
237
|
|
|
} |
238
|
|
|
} else { |
239
|
|
|
$errors = $uploader->getErrors(); |
240
|
|
|
redirect_header($redirecturl, 1, $errors); |
241
|
|
|
} |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/* |
|
|
|
|
245
|
|
|
public static function htmlarray($thishtmlpage, $thepath) |
246
|
|
|
{ |
247
|
|
|
global $xoopsConfig, $wfsConfig; |
248
|
|
|
|
249
|
|
|
$file_array = filesarray( $thepath ); |
250
|
|
|
|
251
|
|
|
echo "<select size='1' name='htmlpage'>"; |
252
|
|
|
echo "<option value='-1'>------</option>"; |
253
|
|
|
foreach ($file_array as $htmlpage) { |
254
|
|
|
if ($htmlpage == $thishtmlpage) { |
255
|
|
|
$opt_selected = "selected"; |
256
|
|
|
} else { |
257
|
|
|
$opt_selected = ""; |
258
|
|
|
} |
259
|
|
|
echo "<option value='" . $htmlpage . "' $opt_selected>" . $htmlpage . "</option>"; |
260
|
|
|
} |
261
|
|
|
echo "</select>"; |
262
|
|
|
|
263
|
|
|
return $htmlpage; |
264
|
|
|
} |
265
|
|
|
*/ |
266
|
|
|
/* |
|
|
|
|
267
|
|
|
public static function filesarray($filearray) |
268
|
|
|
{ |
269
|
|
|
$files = array(); |
270
|
|
|
$dir = opendir( $filearray ); |
271
|
|
|
|
272
|
|
|
while ( ( $file = readdir( $dir ) ) !== false ) { |
273
|
|
|
if ( ( !preg_match( "/^[.]{1,2}$/", $file ) && preg_match( "/[.htm|.html|.xhtml]$/i", $file ) && !is_dir( $file ) ) ) { |
274
|
|
|
if ( strtolower( $file ) != 'cvs' && !is_dir( $file ) ) { |
275
|
|
|
$files[$file] = $file; |
276
|
|
|
} |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
closedir( $dir ); |
280
|
|
|
asort( $files ); |
281
|
|
|
reset( $files ); |
282
|
|
|
|
283
|
|
|
return $files; |
284
|
|
|
} |
285
|
|
|
*/ |
286
|
|
|
/* |
|
|
|
|
287
|
|
|
public static function getuserForm($user) |
288
|
|
|
{ |
289
|
|
|
global $xoopsDB, $xoopsConfig; |
290
|
|
|
$myts = MyTextSanitizer::getInstance(); |
291
|
|
|
|
292
|
|
|
echo "<select name='author'>"; |
293
|
|
|
echo "<option value='-1'>------</option>"; |
294
|
|
|
$result = $xoopsDB->query("SELECT uid, uname FROM ".$xoopsDB->prefix("users")." ORDER BY uname"); |
295
|
|
|
|
296
|
|
|
while (list($uid, $uname) = $xoopsDB->fetchRow($result)) { |
297
|
|
|
if ($uid == $user) { |
298
|
|
|
$opt_selected = "selected"; |
299
|
|
|
} else { |
300
|
|
|
$opt_selected = ""; |
301
|
|
|
} |
302
|
|
|
echo "<option value='".(int)($uid)."' $opt_selected>".$myts->htmlSpecialChars($uname)."</option>"; |
303
|
|
|
} |
304
|
|
|
echo "</select>"; |
305
|
|
|
} |
306
|
|
|
*/ |
307
|
|
|
|
308
|
|
|
/** |
309
|
|
|
* @param $author |
310
|
|
|
* @return string |
311
|
|
|
*/ |
312
|
|
View Code Duplication |
public static function getAuthorName($author) |
|
|
|
|
313
|
|
|
{ |
314
|
|
|
$ret = ''; |
|
|
|
|
315
|
|
|
//get author |
316
|
|
|
$_authoruserHandler = xoops_getHandler('user'); |
317
|
|
|
$_authoruser = $_authoruserHandler->get($author); |
318
|
|
|
if (!is_object($_authoruser)) { |
319
|
|
|
$name3 = ''; |
|
|
|
|
320
|
|
|
$uname3 = ''; |
321
|
|
|
$authorname = ''; |
322
|
|
|
} else { |
323
|
|
|
$name3 = $_authoruser->getVar('name'); |
324
|
|
|
$uname3 = $_authoruser->getVar('uname'); |
325
|
|
|
$authorname = $name3; |
326
|
|
|
} |
327
|
|
|
//------------------------------------- |
328
|
|
|
$ret = $authorname; |
329
|
|
|
if (empty($authorname) || $authorname === '') { |
330
|
|
|
$ret = $uname3; |
331
|
|
|
} |
332
|
|
|
|
333
|
|
|
return $ret; |
334
|
|
|
//------------------------------------- |
335
|
|
|
} |
336
|
|
|
|
337
|
|
|
/** |
338
|
|
|
* @param int $showCreate |
339
|
|
|
*/ |
340
|
|
View Code Duplication |
public static function showColumns($showCreate = 0) |
|
|
|
|
341
|
|
|
{ |
342
|
|
|
global $xoopsGTicket; |
|
|
|
|
343
|
|
|
global $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
344
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
345
|
|
|
$myts = MyTextSanitizer::getInstance(); |
|
|
|
|
346
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
347
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
348
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php'; |
349
|
|
|
$module_id = $xoopsModule->getVar('mid'); |
|
|
|
|
350
|
|
|
$startcol = isset($_GET['startcol']) ? (int)$_GET['startcol'] : 0; |
351
|
|
|
|
352
|
|
|
/* Code to show existing columns */ |
353
|
|
|
echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWCOLS . '</h3>'; |
354
|
|
|
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_COLSTEXT . '</span>'; |
355
|
|
|
|
356
|
|
|
// if ($showCreate == 1) { |
|
|
|
|
357
|
|
|
// echo |
358
|
|
|
// "<a style='border: 1px solid #5E5D63; color: #000000; font-family: verdana, tahoma, arial, helvetica, sans-serif; font-size: 1em; padding: 4px 8px; text-align:center;' href='column.php'>" |
359
|
|
|
// . _AM_SOAPBOX_CREATECOL . "</a><br><br>"; |
360
|
|
|
// } |
361
|
|
|
// To create existing columns table |
362
|
|
|
//---------------------------- |
363
|
|
|
//get category object |
364
|
|
|
$entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname()); |
365
|
|
|
$numrows = $entrydataHandler->getColumnCount(); |
366
|
|
|
$criteria = new CriteriaCompo(); |
367
|
|
|
$criteria->setSort('weight'); |
368
|
|
|
$criteria->setLimit((int)$xoopsModuleConfig['perpage']); |
369
|
|
|
$criteria->setStart((int)$startcol); |
370
|
|
|
$categoryobArray = $entrydataHandler->getColumns($criteria); |
371
|
|
|
unset($criteria); |
372
|
|
|
if ($numrows > 0) { |
373
|
|
|
echo '<form action="column.php" method="post" name="reordercols">'; |
374
|
|
|
} |
375
|
|
|
echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
376
|
|
|
echo '<tr>'; |
377
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ID . '</b></td>'; |
378
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_WEIGHT . '</b></td>'; |
379
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_AUTHOR . '</b></td>'; |
380
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTCOLNAME . '</b></td>'; |
381
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_DESCRIP . '</b></td>'; |
382
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ACTION . '</b></td>'; |
383
|
|
|
echo '</tr>'; |
384
|
|
|
|
385
|
|
|
if ($numrows > 0) { // That is, if there ARE columns in the system |
386
|
|
|
//---------------------------- |
387
|
|
|
$cont = 0; |
388
|
|
|
foreach ($categoryobArray as $_categoryob) { |
389
|
|
|
//---------------------------- |
390
|
|
|
//get vars |
391
|
|
|
++$cont; |
392
|
|
|
$category = $_categoryob->toArray(); //all assign |
393
|
|
|
$category_vars = $_categoryob->getVars(); |
394
|
|
|
foreach ($category_vars as $k => $v) { |
395
|
|
|
${$k} = $_categoryob->getVar($k); |
396
|
|
|
} |
397
|
|
|
//---------------------------- |
398
|
|
|
|
399
|
|
|
$author = SoapboxUtility::getLinkedUnameFromId($author, 0); |
|
|
|
|
400
|
|
|
$modify = "<a href='column.php?op=mod&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITCOL . "'></a>"; |
401
|
|
|
$delete = "<a href='column.php?op=del&columnID=" . $category['columnID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETECOL . "'></a>"; |
402
|
|
|
$style = (($cont % 2) === 0) ? 'even' : 'odd'; |
403
|
|
|
echo '<tr class="' . $style . '">'; |
404
|
|
|
echo '<td class="txtcenter">' . $category['columnID'] . '</td>'; |
405
|
|
|
echo '<td class="txtcenter"><input type="text" name="columnweight[' . $category['columnID'] . ']" value="' . $weight . '" size="3" maxlength="3" style="text-align: center;"></td>'; |
|
|
|
|
406
|
|
|
echo '<td class="txtcenter">' . $category['author'] . '</td>'; |
407
|
|
|
echo '<td class="txtcenter">' . $category['name'] . '</td>'; |
408
|
|
|
echo '<td class="txtcenter">' . $category['description'] . '</td>'; |
409
|
|
|
echo '<td class="txtcenter">' . $modify . ' ' . $delete . '</td>'; |
410
|
|
|
echo '</tr>'; |
411
|
|
|
} |
412
|
|
|
} else { // that is, $numrows = 0, there's no columns yet |
413
|
|
|
echo '<tr>'; |
414
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOCOLS . '</td>'; |
415
|
|
|
echo '</tr>'; |
416
|
|
|
$category['columnID'] = '0'; |
|
|
|
|
417
|
|
|
} |
418
|
|
|
echo "</table>\n"; |
419
|
|
|
$pagenav = new XoopsPageNav($numrows, (int)$xoopsModuleConfig['perpage'], $startcol, 'startcol', 'columnID=' . $category['columnID']); |
|
|
|
|
420
|
|
|
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
421
|
|
|
echo "<br>\n"; |
422
|
|
|
|
423
|
|
|
if ($numrows > 0) { |
424
|
|
|
echo "<input type='hidden' name='op' value='reorder' />"; |
425
|
|
|
//-------------------- |
426
|
|
|
echo $xoopsGTicket->getTicketHtml(__LINE__); |
427
|
|
|
//-------------------- |
428
|
|
|
echo '<div style="margin-bottom: 18px;"><input type="submit" name="submit" class="formButton" value="' . _AM_SOAPBOX_REORDERCOL . '" /></div>'; |
429
|
|
|
echo '</form>'; |
430
|
|
|
} |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* @param int $showCreate |
435
|
|
|
*/ |
436
|
|
View Code Duplication |
public static function showArticles($showCreate = 0) |
|
|
|
|
437
|
|
|
{ |
438
|
|
|
global $xoopsGTicket; |
|
|
|
|
439
|
|
|
global $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
440
|
|
|
$myts = MyTextSanitizer::getInstance(); |
441
|
|
|
|
442
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
443
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
444
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
445
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
446
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php'; |
447
|
|
|
|
448
|
|
|
$module_id = $xoopsModule->getVar('mid'); |
|
|
|
|
449
|
|
|
$startart = isset($_GET['startart']) ? (int)$_GET['startart'] : 0; |
450
|
|
|
if (isset($_POST['entries'])) { |
451
|
|
|
$entries = (int)$_POST['entries']; |
452
|
|
|
} else { |
453
|
|
|
$entries = isset($_GET['entries']) ? (int)$_GET['entries'] : 0; |
454
|
|
|
} |
455
|
|
|
//---GET view sort -- |
456
|
|
|
$sortname = isset($_GET['sortname']) ? strtolower(trim(strip_tags($myts->stripSlashesGPC($_GET['sortname'])))) : 'datesub'; |
457
|
|
|
if (!in_array($sortname, array('datesub', 'weight', 'counter', 'rating', 'headline'))) { |
458
|
|
|
$sortname = 'datesub'; |
459
|
|
|
} |
460
|
|
|
$sortorder = isset($_GET['sortorder']) ? strtoupper(trim(strip_tags($myts->stripSlashesGPC($_GET['sortorder'])))) : 'DESC'; |
461
|
|
|
if (!in_array($sortorder, array('ASC', 'DESC'))) { |
462
|
|
|
$sortorder = 'DESC'; |
463
|
|
|
} |
464
|
|
|
//--------------- |
465
|
|
|
/* Code to show existing articles */ |
466
|
|
|
echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWARTS . '</h3>'; |
467
|
|
|
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_ARTSTEXT . '</span>'; |
468
|
|
|
|
469
|
|
|
// if ($showCreate == 1) { |
|
|
|
|
470
|
|
|
// echo |
471
|
|
|
// "<a style='border: 1px solid #5E5D63; color: #000000; font-family: verdana, tahoma, arial, helvetica, sans-serif; font-size: 1em; padding: 4px 8px; text-align:center;' href='article.php'>" |
472
|
|
|
// . _AM_SOAPBOX_CREATEART . "</a><br><br>"; |
473
|
|
|
// } |
474
|
|
|
// Articles count |
475
|
|
|
$entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname()); |
476
|
|
|
//---------------------------- |
477
|
|
|
$criteria = new CriteriaCompo(); |
478
|
|
|
$criteria->add(new Criteria('submit', 0)); |
479
|
|
|
$criteria->add(new Criteria('offline', 0)); |
480
|
|
|
$tot_published = $entrydataHandler->getArticleCount($criteria); |
481
|
|
|
unset($criteria); |
482
|
|
|
//---------------------------- |
483
|
|
|
$criteria = new CriteriaCompo(); |
484
|
|
|
$criteria->add(new Criteria('submit', 0)); |
485
|
|
|
$criteria->add(new Criteria('offline', 1)); |
486
|
|
|
$tot_offline = $entrydataHandler->getArticleCount($criteria); |
487
|
|
|
unset($criteria); |
488
|
|
|
//---------------------------- |
489
|
|
|
$criteria = new CriteriaCompo(); |
490
|
|
|
$criteria->add(new Criteria('submit', 1)); |
491
|
|
|
$tot_submitted = $entrydataHandler->getArticleCount($criteria); |
492
|
|
|
unset($criteria); |
493
|
|
|
//---------------------------- |
494
|
|
|
$tot_all = $entrydataHandler->getArticleCount(); |
495
|
|
|
//---------------------------- |
496
|
|
|
$criteria = new CriteriaCompo(); |
497
|
|
|
$criteria->add(new Criteria('submit', 0)); |
498
|
|
|
$tot_ok = $entrydataHandler->getArticleCount($criteria); |
499
|
|
|
unset($criteria); |
500
|
|
|
//---------------------------- |
501
|
|
|
|
502
|
|
|
// Prepare string for table head |
503
|
|
|
if ($entries === 0) { |
504
|
|
|
$string = _AM_SOAPBOX_SHWALL; |
505
|
|
|
} |
506
|
|
|
if ($entries === 1) { |
507
|
|
|
$string = _AM_SOAPBOX_SHWONL; |
508
|
|
|
} |
509
|
|
|
if ($entries === 2) { |
510
|
|
|
$string = _AM_SOAPBOX_SHWOFF; |
511
|
|
|
} |
512
|
|
|
if ($entries === 3) { |
513
|
|
|
$string = _AM_SOAPBOX_SHWSUB; |
514
|
|
|
} |
515
|
|
|
if ($entries === 4) { |
516
|
|
|
$string = _AM_SOAPBOX_SHWAPV; |
517
|
|
|
} |
518
|
|
|
|
519
|
|
|
/* Code to show selected articles */ |
520
|
|
|
echo "<form name='pick' id='pick' action='" . $myts->htmlSpecialChars(xoops_getenv('PHP_SELF')) . "' method='POST' style='margin: 0;'>"; ?> |
521
|
|
|
<table width='100%' cellspacing='1' cellpadding='2' border='0' |
522
|
|
|
style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'> |
523
|
|
|
<tr> |
524
|
|
|
<td class='odd'><span style='font-weight: bold; font-variant: small-caps;'><?php echo $string ?></span></td> |
|
|
|
|
525
|
|
|
<td class='odd' width='40%' align='right'><?php echo _AM_SOAPBOX_SELECTSTATUS; ?> |
526
|
|
|
<select name='entries' onchange='submit()'> |
527
|
|
|
<option value='0' |
528
|
|
|
<?php |
529
|
|
|
if ($entries === 0) { |
530
|
|
|
echo 'selected'; |
531
|
|
|
} ?>> |
532
|
|
|
<?php echo _AM_SOAPBOX_SELALL; ?> |
533
|
|
|
[<?php echo $tot_all; ?>] |
534
|
|
|
</option> |
535
|
|
|
<option value='1' <?php if ($entries === 1) { |
536
|
|
|
echo 'selected'; |
537
|
|
|
} ?>><?php echo _AM_SOAPBOX_SELONL; ?> |
538
|
|
|
[<?php echo $tot_published; ?>] |
539
|
|
|
</option> |
540
|
|
|
<option value='2' <?php if ($entries === 2) { |
541
|
|
|
echo 'selected'; |
542
|
|
|
} ?>> |
543
|
|
|
<?php echo _AM_SOAPBOX_SELOFF; ?> |
544
|
|
|
[<?php echo $tot_offline; ?>] |
545
|
|
|
</option> |
546
|
|
|
<option value='3' <?php if ($entries === 3) { |
547
|
|
|
echo 'selected'; |
548
|
|
|
} ?>> |
549
|
|
|
<?php echo _AM_SOAPBOX_SELSUB; ?> |
550
|
|
|
[<?php echo $tot_submitted; ?>] |
551
|
|
|
</option> |
552
|
|
|
<option value='4' <?php if ($entries === 4) { |
553
|
|
|
echo 'selected'; |
554
|
|
|
} ?>><?php echo _AM_SOAPBOX_SELAPV; ?> |
555
|
|
|
[<?php echo $tot_ok; ?>] |
556
|
|
|
</option> |
557
|
|
|
</select> |
558
|
|
|
</td> |
559
|
|
|
</tr> |
560
|
|
|
</table> |
561
|
|
|
</form> |
562
|
|
|
<?php |
563
|
|
|
|
564
|
|
|
//---------------------------- |
565
|
|
|
// Put column names in an array, to avoid a query in the while loop further ahead |
566
|
|
|
switch ($entries) { |
567
|
|
|
case 1: |
568
|
|
|
$submit = 0; |
569
|
|
|
$offline = 0; |
570
|
|
|
break; |
571
|
|
|
case 2: |
572
|
|
|
//---------------------------- |
573
|
|
|
$submit = 0; |
574
|
|
|
$offline = 1; |
575
|
|
|
break; |
576
|
|
|
case 3: |
577
|
|
|
//---------------------------- |
578
|
|
|
$submit = 1; |
579
|
|
|
$offline = null; |
580
|
|
|
break; |
581
|
|
|
case 4: |
582
|
|
|
//---------------------------- |
583
|
|
|
$submit = 0; |
584
|
|
|
break; |
585
|
|
|
case 0: |
586
|
|
|
default: |
587
|
|
|
$submit = null; |
588
|
|
|
$offline = null; |
589
|
|
|
break; |
590
|
|
|
} |
591
|
|
|
// function &getArticlesAllPermcheck( |
|
|
|
|
592
|
|
|
// $limit=0, $start=0, |
|
|
|
|
593
|
|
|
// $checkRight = true, $published = true, $submit = 0, $offline = 0, $block = null , |
|
|
|
|
594
|
|
|
// $sortname = 'datesub', $sortorder = 'DESC', |
|
|
|
|
595
|
|
|
// $select_sbcolumns = null , $NOTarticleIDs = null , |
|
|
|
|
596
|
|
|
// $approve_submit = false , |
|
|
|
|
597
|
|
|
// $id_as_key = false ) |
|
|
|
|
598
|
|
|
//------------------------------------- |
599
|
|
|
$_entryob_arr = $entrydataHandler->getArticlesAllPermcheck((int)$xoopsModuleConfig['perpage'], $startart, false, false, $submit, $offline, null, $sortname, $sortorder, null, null, false, true); |
|
|
|
|
600
|
|
|
// Get number of articles in the selected condition ($cond) |
601
|
|
|
$numrows = $entrydataHandler->total_getArticlesAllPermcheck; |
602
|
|
|
if ($numrows > 0) { |
603
|
|
|
echo '<form action="article.php" method="post" name="reorderarticles\">'; |
604
|
|
|
} |
605
|
|
|
echo "<table width='100%' cellspacing='1' cellpadding='3' border='0' class='outer'>"; |
606
|
|
|
echo '<tr>'; |
607
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTID . '</b></td>'; |
608
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_WEIGHT . '</b></td>'; |
609
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTCOLNAME . '</b></td>'; |
610
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTHEADLINE . '</b></td>'; |
611
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ARTCREATED . '</b></td>'; |
612
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_STATUS . '</b></td>'; |
613
|
|
|
echo '<th class="txtcenter"><b>' . _AM_SOAPBOX_ACTION . '</b></td>'; |
614
|
|
|
echo '</tr>'; |
615
|
|
|
|
616
|
|
|
if ($numrows > 0) { // That is, if there ARE articles in the said condition |
617
|
|
|
// Retrieve rows for those items |
618
|
|
|
|
619
|
|
|
$colarray = array(); |
|
|
|
|
620
|
|
|
$cont = 0; |
621
|
|
|
|
622
|
|
|
foreach ($_entryob_arr as $key => $_entryob) { |
623
|
|
|
//get vars |
624
|
|
|
++$cont; |
625
|
|
|
//------------------------------------- |
626
|
|
|
$articles = $_entryob->toArray(); |
627
|
|
|
//-------------------- |
628
|
|
|
$colname = !empty($_entryob->_sbcolumns) ? $_entryob->_sbcolumns->getVar('name') : ''; |
629
|
|
|
//-------------------- |
630
|
|
|
$created = $myts->htmlSpecialChars(formatTimestamp($articles['datesub'], $xoopsModuleConfig['dateformat'])); |
631
|
|
|
$modify = "<a href='article.php?op=mod&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITART . "'></a>"; |
632
|
|
|
$delete = "<a href='article.php?op=del&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETEART . "'></a>"; |
633
|
|
|
|
634
|
|
|
//if ($offline == 0) { |
|
|
|
|
635
|
|
|
if ($articles['offline'] === 0) { |
636
|
|
|
$status = "<img src='" . $pathIcon16 . "/1.png' alt='" . _AM_SOAPBOX_ARTISON . "'>"; |
637
|
|
|
} else { |
638
|
|
|
//if ($offline == 1 && $submit == 0) { |
|
|
|
|
639
|
|
|
if ($submit === 0 && $articles['offline'] === 1) { |
640
|
|
|
$status = "<img src='" . $pathIcon16 . "/0.png' alt='" . _AM_SOAPBOX_ARTISOFF . "'>"; |
641
|
|
|
} else { |
642
|
|
|
if ($submit === 1) { |
643
|
|
|
$status = '<img src=' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . "/assets/images/icon/sub.gif alt='" . _AM_SOAPBOX_ARTISSUB . "'>"; |
644
|
|
|
} |
645
|
|
|
} |
646
|
|
|
} |
647
|
|
|
|
648
|
|
|
//mb ---------------------------- |
649
|
|
|
//echo $cont.' - '.$offline.': '.$status.'</br>'; |
|
|
|
|
650
|
|
|
|
651
|
|
|
$style = (($cont % 2) === 0) ? 'even' : 'odd'; |
652
|
|
|
echo '<tr class="' . $style . '">'; |
653
|
|
|
echo '<td align="center"><a href="' . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/article.php?articleID=' . $articles['articleID'] . '" title="' . $articles['headline'] . '" target="_blank">' . $articles['articleID'] . '</a></td>'; |
654
|
|
|
echo '<td class="txtcenter"><input type="text" name="articleweight[' . $articles['articleID'] . ']" value="' . $articles['weight'] . '" size="3" maxlength="3" style="text-align: center;"></td>'; |
655
|
|
|
echo '<td class="txtcenter">' . $colname . '</td>'; |
656
|
|
|
echo '<td>' . $articles['headline'] . '</td>'; |
657
|
|
|
echo '<td class="txtcenter">' . $created . '</td>'; |
658
|
|
|
echo '<td class="txtcenter">' . $status . '</td>'; |
|
|
|
|
659
|
|
|
echo '<td class="txtcenter">' . $modify . $delete . '</td>'; |
660
|
|
|
echo '</tr>'; |
661
|
|
|
} |
662
|
|
|
} else { // that is, $numrows = 0, there's no columns yet |
663
|
|
|
echo '<tr>'; |
664
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOARTS . '</td>'; |
665
|
|
|
echo '</tr>'; |
666
|
|
|
} |
667
|
|
|
echo "</table>\n"; |
668
|
|
|
$pagenav = new XoopsPageNav($numrows, (int)$xoopsModuleConfig['perpage'], $startart, 'startart', 'entries=' . $entries . '&sortname=' . $sortname . '&sortorder=' . $sortorder); |
669
|
|
|
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
670
|
|
|
|
671
|
|
|
if ($numrows > 0) { |
672
|
|
|
echo "<input type='hidden' name='op' value='reorder' />"; |
673
|
|
|
//-------------------- |
674
|
|
|
echo $xoopsGTicket->getTicketHtml(__LINE__); |
675
|
|
|
//-------------------- |
676
|
|
|
echo '<div style="margin-bottom: 18px;"><input type="submit" name="submit" class="formButton" value="' . _AM_SOAPBOX_REORDERART . '" /></div>'; |
677
|
|
|
echo '</form>'; |
678
|
|
|
} |
679
|
|
|
echo "<br>\n"; |
680
|
|
|
} |
681
|
|
|
|
682
|
|
View Code Duplication |
public static function showSubmissions() |
|
|
|
|
683
|
|
|
{ |
684
|
|
|
global $xoopsGTicket; |
|
|
|
|
685
|
|
|
global $xoopsModuleConfig, $xoopsModule; |
|
|
|
|
686
|
|
|
|
687
|
|
|
$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
688
|
|
|
$myts = MyTextSanitizer::getInstance(); |
689
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
690
|
|
|
require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
691
|
|
|
require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
692
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->dirname() . '/include/cleantags.php'; |
693
|
|
|
$module_id = $xoopsModule->getVar('mid'); |
|
|
|
|
694
|
|
|
$startsub = isset($_GET['startsub']) ? (int)$_GET['startsub'] : 0; |
695
|
|
|
$datesub = isset($_GET['datesub']) ? (int)$_GET['datesub'] : 0; |
696
|
|
|
|
697
|
|
|
//---GET view sort -- |
698
|
|
|
$sortname = isset($_GET['sortname']) ? strtolower(trim(strip_tags($myts->stripSlashesGPC($_GET['sortname'])))) : 'datesub'; |
699
|
|
|
if (!in_array($sortname, array('datesub', 'weight', 'counter', 'rating', 'headline'))) { |
700
|
|
|
$sortname = 'datesub'; |
701
|
|
|
} |
702
|
|
|
$sortorder = isset($_GET['sortorder']) ? strtoupper(trim(strip_tags($myts->stripSlashesGPC($_GET['sortorder'])))) : 'DESC'; |
703
|
|
|
if (!in_array($sortorder, array('ASC', 'DESC'))) { |
704
|
|
|
$sortorder = 'DESC'; |
705
|
|
|
} |
706
|
|
|
//--------------- |
707
|
|
|
/* Code to show submitted articles */ |
708
|
|
|
echo "<h3 style='color: #2F5376; margin: 0 0 4px 0;'>" . _AM_SOAPBOX_SHOWSUBMISSIONS . '</h3>'; |
709
|
|
|
echo '<span style="color: #567; margin: 3px 0 12px 0; font-size: small; display: block; ">' . _AM_SOAPBOX_SUBTEXT . '</span>'; |
710
|
|
|
echo "<table width='100%' cellspacing=1 cellpadding=3 border=0 class = outer>"; |
711
|
|
|
echo '<tr>'; |
712
|
|
|
echo "<td width='40' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTID . '</b></td>'; |
713
|
|
|
echo "<td width='20%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCOLNAME . '</b></td>'; |
714
|
|
|
echo "<td width='45%' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTHEADLINE . '</b></td>'; |
715
|
|
|
echo "<td width='90' class='bg3' align='center'><b>" . _AM_SOAPBOX_ARTCREATED . '</b></td>'; |
716
|
|
|
echo "<td width='60' class='bg3' align='center'><b>" . _AM_SOAPBOX_ACTION . '</b></td>'; |
717
|
|
|
echo '</tr>'; |
718
|
|
|
|
719
|
|
|
// Put column names in an array, to avoid a query in the while loop farther ahead |
720
|
|
|
/* Code to show submitted articles */ |
721
|
|
|
// Articles count |
722
|
|
|
// function &getArticlesAllPermcheck( |
|
|
|
|
723
|
|
|
// $limit=0, $start=0, |
|
|
|
|
724
|
|
|
// $checkRight = true, $published = true, $submit = 0, $offline = 0, $block = null , |
|
|
|
|
725
|
|
|
// $sortname = 'datesub', $sortorder = 'DESC', |
|
|
|
|
726
|
|
|
// $select_sbcolumns = null , $NOTarticleIDs = null , |
|
|
|
|
727
|
|
|
// $approve_submit = false , |
|
|
|
|
728
|
|
|
// $id_as_key = false ) |
|
|
|
|
729
|
|
|
// Articles count |
730
|
|
|
$entrydataHandler = xoops_getModuleHandler('entrydata', $xoopsModule->dirname()); |
731
|
|
|
//------------------------------------- |
732
|
|
|
$_entryob_arr = $entrydataHandler->getArticlesAllPermcheck((int)$xoopsModuleConfig['perpage'], $startsub, false, false, 1, null, null, $sortname, $sortorder, null, null, false); |
733
|
|
|
// Get number of articles in the selected condition ($cond) |
734
|
|
|
$numrows = $entrydataHandler->total_getArticlesAllPermcheck; |
735
|
|
|
|
736
|
|
|
if ($numrows > 0) { // That is, if there ARE unauthorized articles in the system |
737
|
|
|
foreach ($_entryob_arr as $_entryob) { |
738
|
|
|
//get vars |
739
|
|
|
//------------------------------------- |
740
|
|
|
$articles = $_entryob->toArray(); |
741
|
|
|
//-------------------- |
742
|
|
|
$colname = !empty($_entryob->_sbcolumns) ? $_entryob->_sbcolumns->getVar('name') : ''; |
743
|
|
|
$created = $myts->htmlSpecialChars(formatTimestamp($datesub, $xoopsModuleConfig['dateformat'])); |
744
|
|
|
$modify = "<a href='submissions.php?op=mod&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/edit.png' ALT='" . _AM_SOAPBOX_EDITSUBM . "'></a>"; |
745
|
|
|
$delete = "<a href='submissions.php?op=del&articleID=" . $articles['articleID'] . "'><img src='" . $pathIcon16 . "/delete.png' ALT='" . _AM_SOAPBOX_DELETESUBM . "'></a>"; |
746
|
|
|
|
747
|
|
|
echo '<tr>'; |
748
|
|
|
echo "<td class='head' align='center'>" . $articles['articleID'] . '</td>'; |
749
|
|
|
echo "<td class='even' align='left'>" . $colname . '</td>'; |
750
|
|
|
echo "<td class='even' align='left'>" . $articles['headline'] . '</td>'; |
751
|
|
|
echo "<td class='even' align='center'>" . $created . '</td>'; |
752
|
|
|
echo "<td class='even' align='center'>" . $modify . $delete . '</td>'; |
753
|
|
|
echo '</tr>'; |
754
|
|
|
} |
755
|
|
|
} else { // that is, $numrows = 0, there's no columns yet |
756
|
|
|
echo '<tr>'; |
757
|
|
|
echo "<td class='head' align='center' colspan= '7'>" . _AM_SOAPBOX_NOSUBMISSYET . '</td>'; |
758
|
|
|
echo '</tr>'; |
759
|
|
|
} |
760
|
|
|
echo "</table>\n"; |
761
|
|
|
$pagenav = new XoopsPageNav($numrows, $xoopsModuleConfig['perpage'], $startsub, 'startsub', '&sortname=' . $sortname . '&sortorder=' . $sortorder); |
762
|
|
|
echo '<div style="text-align:right;">' . $pagenav->renderNav() . '</div>'; |
763
|
|
|
echo "<br>\n"; |
764
|
|
|
} |
765
|
|
|
|
766
|
|
|
//HACK bydomifara for add method |
767
|
|
|
|
768
|
|
|
/** |
769
|
|
|
* @return string |
770
|
|
|
*/ |
771
|
|
View Code Duplication |
public static function getAcceptLang() |
|
|
|
|
772
|
|
|
{ |
773
|
|
|
//---access language |
774
|
|
|
$al = 'en'; |
775
|
|
|
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { |
776
|
|
|
$accept_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); |
777
|
|
|
foreach ($accept_langs as $al) { |
778
|
|
|
$al = strtolower($al); |
779
|
|
|
$al_len = strlen($al); |
780
|
|
|
if ($al_len > 2) { |
781
|
|
|
if (preg_match('/([a-z]{2});q=[0-9.]+$/', $al, $al_match)) { |
782
|
|
|
$al = $al_match[1]; |
783
|
|
|
break; |
784
|
|
|
} else { |
785
|
|
|
continue; |
786
|
|
|
} |
787
|
|
|
} |
788
|
|
|
} |
789
|
|
|
} |
790
|
|
|
|
791
|
|
|
return $al; |
792
|
|
|
} |
793
|
|
|
|
794
|
|
|
} |
795
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.