|
1
|
|
|
<?php namespace Xoopsmodules\Smallworld; |
|
2
|
|
|
/** |
|
3
|
|
|
* You may not change or alter any portion of this comment or credits |
|
4
|
|
|
* of supporting developers from this source code or any supporting source code |
|
5
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
* |
|
7
|
|
|
* This program is distributed in the hope that it will be useful, |
|
8
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* SmallWorld |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright The XOOPS Project (https://xoops.org) |
|
16
|
|
|
* @copyright 2011 Culex |
|
17
|
|
|
* @license GNU GPL (http://www.gnu.org/licenses/gpl-2.0.html/) |
|
18
|
|
|
* @package SmallWorld |
|
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
|
|
|
|
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.