| @@ 31-45 (lines=15) @@ | ||
| 28 | * Get oldest message in Db |
|
| 29 | * @returns time |
|
| 30 | */ |
|
| 31 | public function oldestMsg() |
|
| 32 | { |
|
| 33 | global $xoopsDB; |
|
| 34 | $date = 0; |
|
| 35 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_messages') . ' ORDER BY created LIMIT 1'; |
|
| 36 | $result = $xoopsDB->queryF($sql); |
|
| 37 | $counter = $xoopsDB->getRowsNum($result); |
|
| 38 | if ($counter >= 1) { |
|
| 39 | while (false !== ($sqlfetch = $xoopsDB->fetchArray($result))) { |
|
| 40 | $date = $sqlfetch['created']; |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| 44 | return $date; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * Get average messages sent per day |
|
| @@ 229-244 (lines=16) @@ | ||
| 226 | * Get all users |
|
| 227 | * @return array |
|
| 228 | */ |
|
| 229 | public function allUsers() |
|
| 230 | { |
|
| 231 | global $xoopsDB; |
|
| 232 | $sql = 'SELECT userid FROM ' . $xoopsDB->prefix('smallworld_user') . ' ORDER BY userid'; |
|
| 233 | $result = $xoopsDB->queryF($sql); |
|
| 234 | $i = $xoopsDB->getRowsNum($result); |
|
| 235 | if (0 != $i) { |
|
| 236 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 237 | $data[] = $r; |
|
| 238 | } |
|
| 239 | if (!empty($data)) { |
|
| 240 | return smallworld_array_flatten($data, 0); |
|
| 241 | } |
|
| 242 | } |
|
| 243 | //redirect_header(XOOPS_URL . "/modules/smallworld/register.php"); |
|
| 244 | } |
|
| 245 | } |
|
| 246 | ||
| @@ 502-516 (lines=15) @@ | ||
| 499 | * Get version number of xim if exists |
|
| 500 | * @return int $version |
|
| 501 | */ |
|
| 502 | function smallworld_XIMversion() |
|
| 503 | { |
|
| 504 | global $xoopsDB; |
|
| 505 | $sql = 'SELECT version FROM ' . $xoopsDB->prefix('modules') . " WHERE dirname = 'xim'"; |
|
| 506 | $result = $xoopsDB->queryF($sql); |
|
| 507 | if ($xoopsDB->getRowsNum($result) > 0) { |
|
| 508 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 509 | $version = $r['version']; |
|
| 510 | } |
|
| 511 | } else { |
|
| 512 | $version = 0; |
|
| 513 | } |
|
| 514 | ||
| 515 | return $version; |
|
| 516 | } |
|
| 517 | ||
| 518 | /* |
|
| 519 | * Input: Message Id, |
|