| @@ 527-537 (lines=11) @@ | ||
| 524 | * @param $msg_id_fk |
|
| 525 | * @return mixed |
|
| 526 | */ |
|
| 527 | function smallworld_getOwnerFromComment($msg_id_fk) |
|
| 528 | { |
|
| 529 | global $xoopsDB; |
|
| 530 | $sql = 'SELECT uid_fk FROM ' . $xoopsDB->prefix('smallworld_messages') . " WHERE msg_id = '" . $msg_id_fk . "'"; |
|
| 531 | $result = $xoopsDB->queryF($sql); |
|
| 532 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 533 | $owner = $r['uid_fk']; |
|
| 534 | } |
|
| 535 | ||
| 536 | return $owner; |
|
| 537 | } |
|
| 538 | ||
| 539 | // Get username from userID |
|
| 540 | /** |
|
| @@ 544-554 (lines=11) @@ | ||
| 541 | * @param $userID |
|
| 542 | * @return mixed |
|
| 543 | */ |
|
| 544 | function smallworld_getName($userID) |
|
| 545 | { |
|
| 546 | global $xoopsUser, $xoopsDB; |
|
| 547 | $sql = 'SELECT username FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE userid = '" . (int)$userID . "'"; |
|
| 548 | $result = $xoopsDB->queryF($sql); |
|
| 549 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 550 | $name = $row['username']; |
|
| 551 | } |
|
| 552 | ||
| 553 | return $name; |
|
| 554 | } |
|
| 555 | ||
| 556 | // Check if user has been taken down for inspection by admin |
|
| 557 | // Userid = user id of user to check |
|
| @@ 896-906 (lines=11) @@ | ||
| 893 | * @param $id |
|
| 894 | * @return mixed |
|
| 895 | */ |
|
| 896 | function smallworldCheckPriv($id) |
|
| 897 | { |
|
| 898 | global $xoopsDB; |
|
| 899 | $public = 'SELECT priv FROM ' . $xoopsDB->prefix('smallworld_messages') . ' WHERE msg_id = ' . $id . ''; |
|
| 900 | $result = $xoopsDB->queryF($public); |
|
| 901 | while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
| 902 | $priv = $row['priv']; |
|
| 903 | } |
|
| 904 | ||
| 905 | return $priv; |
|
| 906 | } |
|
| 907 | ||
| 908 | // Function to calculate remaining seconds until user's birthday |
|
| 909 | // Input $d : date('Y-m-d') format |
|
| @@ 1060-1073 (lines=14) @@ | ||
| 1057 | * @return bool|mixed |
|
| 1058 | * @return bool|mixed |
|
| 1059 | */ |
|
| 1060 | function smallworld_getRndImg($userid) |
|
| 1061 | { |
|
| 1062 | global $xoopsDB; |
|
| 1063 | $sql = 'SELECT imgname FROM ' . $xoopsDB->prefix('smallworld_images') . ' WHERE userid = ' . $userid . ' AND time BETWEEN UNIX_TIMESTAMP( ) - 3000 AND UNIX_TIMESTAMP() ORDER BY rand() LIMIT 1'; |
|
| 1064 | $result = $xoopsDB->queryF($sql); |
|
| 1065 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 1066 | $img = $r['imgname']; |
|
| 1067 | } |
|
| 1068 | if (!empty($img)) { |
|
| 1069 | return $img; |
|
| 1070 | } |
|
| 1071 | ||
| 1072 | return false; |
|
| 1073 | } |
|
| 1074 | ||
| 1075 | /** |
|
| 1076 | * @Get url of smallworld |
|
| @@ 1446-1456 (lines=11) @@ | ||
| 1443 | * @param $name |
|
| 1444 | * @return array @users |
|
| 1445 | */ |
|
| 1446 | function smallworld_getUidFromName($name) |
|
| 1447 | { |
|
| 1448 | global $xoopsDB; |
|
| 1449 | $sql = 'SELECT userid FROM ' . $xoopsDB->prefix('smallworld_user') . " WHERE username = '" . $name . "'"; |
|
| 1450 | $result = $xoopsDB->queryF($sql); |
|
| 1451 | while (false !== ($r = $xoopsDB->fetchArray($result))) { |
|
| 1452 | $id = $r['userid']; |
|
| 1453 | } |
|
| 1454 | ||
| 1455 | return $id; |
|
| 1456 | } |
|
| 1457 | ||
| 1458 | /** |
|
| 1459 | * Extract users from @tags |
|