1 | <?php |
||
9 | class CInterface { |
||
10 | |||
11 | /** |
||
12 | * Sample function to integrate with a phpbb installation and lend some |
||
13 | * information on the authorized user. |
||
14 | * |
||
15 | * @param string $path is the install path of PHPBB. |
||
16 | * @return array with details of user. |
||
17 | */ |
||
18 | function getSessionDetails($path) { |
||
38 | |||
39 | |||
40 | |||
41 | /** |
||
42 | * Get latest topics. |
||
43 | * |
||
44 | * @param int $max items to return. |
||
45 | * @return array |
||
46 | */ |
||
47 | /* |
||
48 | public function LatestTopics($max=3) { |
||
49 | global $auth, $db; |
||
50 | |||
51 | // Create arrays |
||
52 | $topics = array(); |
||
53 | |||
54 | // Get forums that current user has read rights to. |
||
55 | $forums = array_unique(array_keys($auth->acl_getf('f_read', true))); |
||
56 | |||
57 | // Get active topics. |
||
58 | $sql="SELECT * |
||
59 | FROM " . TOPICS_TABLE . " |
||
60 | WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . " |
||
61 | ORDER BY topic_last_post_time DESC"; |
||
62 | $result = $db->sql_query_limit($sql, $max); |
||
63 | while ($r = $db->sql_fetchrow($result)) { |
||
64 | $topics[] = $r; |
||
65 | } |
||
66 | $db->sql_freeresult($result); |
||
67 | |||
68 | $items = array(); |
||
69 | foreach($topics as $t) { |
||
70 | // Get folder img, topic status/type related information |
||
71 | //$topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']); |
||
72 | //$unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false; |
||
73 | //topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type); |
||
74 | // href = $phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&t=' . $t['topic_id'] . '&p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id']; |
||
75 | $item['forum_id'] = $t['forum_id']; |
||
76 | $item['topic_id'] = $t['topic_id']; |
||
77 | $item['topic_last_post_id'] = $t['topic_last_post_id']; |
||
78 | $item['topic_title'] = $t['topic_title']; |
||
79 | $items[] = $item; |
||
80 | } |
||
81 | |||
82 | return($items); |
||
83 | } |
||
84 | */ |
||
85 | } |
||
86 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.