| @@ 22-75 (lines=54) @@ | ||
| 19 | * @since 1.0 |
|
| 20 | * @author Michael Albertsen (http://culex.dk) <[email protected]> |
|
| 21 | */ |
|
| 22 | class SmallWorldFriends |
|
| 23 | { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @Show friends of ID |
|
| 27 | * @param int $id |
|
| 28 | * @return string |
|
| 29 | */ |
|
| 30 | public function Showfriends($id) |
|
| 31 | { |
|
| 32 | global $xoopsUser, $xoTheme, $xoopsTpl, $arr04, $arr05, $xoopsDB; |
|
| 33 | if ($xoopsUser) { |
|
| 34 | $user = new XoopsUser($id); |
|
| 35 | $myName = $xoopsUser->getUnameFromId($xoopsUser->getVar('uid')); // My name |
|
| 36 | $db = new SmallWorldDB; |
|
| 37 | $check = new SmallWorldUser; |
|
| 38 | } else { |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @Get friends array of ID |
|
| 44 | * @param int $id |
|
| 45 | * @param string $action |
|
| 46 | * @return array|bool |
|
| 47 | */ |
|
| 48 | public function getFriends($id, $action) |
|
| 49 | { |
|
| 50 | global $xoopsUser, $xoopsDB; |
|
| 51 | $meuser = $xoopsUser->getVar('uid'); |
|
| 52 | $data = []; |
|
| 53 | if ($xoopsUser) { |
|
| 54 | if ('pending' === $action) { |
|
| 55 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . $id . "' AND status = 1"; |
|
| 56 | } elseif ('friends' === $action) { |
|
| 57 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . $id . "' AND status = 2"; |
|
| 58 | } elseif ('following' === $action) { |
|
| 59 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_followers') . " WHERE me = '" . $id . "'"; |
|
| 60 | } elseif ('followingme' === $action) { |
|
| 61 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_followers') . " WHERE you = '" . $id . "'"; |
|
| 62 | } |
|
| 63 | $result = $xoopsDB->queryF($sql); |
|
| 64 | $count = $xoopsDB->getRowsNum($result); |
|
| 65 | if ($count < 1) { |
|
| 66 | return false; |
|
| 67 | } else { |
|
| 68 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 69 | $data[] = $row; |
|
| 70 | } |
|
| 71 | } |
|
| 72 | } |
|
| 73 | return $data; |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||
| @@ 22-75 (lines=54) @@ | ||
| 19 | * @since 1.0 |
|
| 20 | * @author Michael Albertsen (http://culex.dk) <[email protected]> |
|
| 21 | */ |
|
| 22 | class SmallWorldFriends |
|
| 23 | { |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @Show friends of ID |
|
| 27 | * @param int $id |
|
| 28 | * @return string |
|
| 29 | */ |
|
| 30 | public function Showfriends($id) |
|
| 31 | { |
|
| 32 | global $xoopsUser, $xoTheme, $xoopsTpl, $arr04, $arr05, $xoopsDB; |
|
| 33 | if ($xoopsUser) { |
|
| 34 | $user = new \XoopsUser($id); |
|
| 35 | $myName = $xoopsUser->getUnameFromId($xoopsUser->getVar('uid')); // My name |
|
| 36 | $db = new SmallWorldDB; |
|
| 37 | $check = new SmallWorldUser; |
|
| 38 | } else { |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @Get friends array of ID |
|
| 44 | * @param int $id |
|
| 45 | * @param string $action |
|
| 46 | * @return array|bool |
|
| 47 | */ |
|
| 48 | public function getFriends($id, $action) |
|
| 49 | { |
|
| 50 | global $xoopsUser, $xoopsDB; |
|
| 51 | $meuser = $xoopsUser->getVar('uid'); |
|
| 52 | $data = []; |
|
| 53 | if ($xoopsUser) { |
|
| 54 | if ('pending' === $action) { |
|
| 55 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . $id . "' AND status = 1"; |
|
| 56 | } elseif ('friends' === $action) { |
|
| 57 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_friends') . " WHERE me = '" . $id . "' AND status = 2"; |
|
| 58 | } elseif ('following' === $action) { |
|
| 59 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_followers') . " WHERE me = '" . $id . "'"; |
|
| 60 | } elseif ('followingme' === $action) { |
|
| 61 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('smallworld_followers') . " WHERE you = '" . $id . "'"; |
|
| 62 | } |
|
| 63 | $result = $xoopsDB->queryF($sql); |
|
| 64 | $count = $xoopsDB->getRowsNum($result); |
|
| 65 | if ($count < 1) { |
|
| 66 | return false; |
|
| 67 | } else { |
|
| 68 | while ($row = $xoopsDB->fetchArray($result)) { |
|
| 69 | $data[] = $row; |
|
| 70 | } |
|
| 71 | } |
|
| 72 | } |
|
| 73 | return $data; |
|
| 74 | } |
|
| 75 | } |
|
| 76 | ||