source: temp/test-xoops.ec-cube.net/html/modules/newbb/include/notification.inc.php @ 405

Revision 405, 4.0 KB checked in by root, 20 years ago (diff)
Line 
1<?php
2// $Id: notification.inc.php,v 1.3 2005/08/03 12:39:14 onokazu Exp $
3//  ------------------------------------------------------------------------ //
4//                XOOPS - PHP Content Management System                      //
5//                    Copyright (c) 2000 XOOPS.org                           //
6//                       <http://www.xoops.org/>                             //
7//  ------------------------------------------------------------------------ //
8//  This program is free software; you can redistribute it and/or modify     //
9//  it under the terms of the GNU General Public License as published by     //
10//  the Free Software Foundation; either version 2 of the License, or        //
11//  (at your option) any later version.                                      //
12//                                                                           //
13//  You may not change or alter any portion of this comment or credits       //
14//  of supporting developers from this source code or any supporting         //
15//  source code which is considered copyrighted (c) material of the          //
16//  original comment or credit authors.                                      //
17//                                                                           //
18//  This program is distributed in the hope that it will be useful,          //
19//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21//  GNU General Public License for more details.                             //
22//                                                                           //
23//  You should have received a copy of the GNU General Public License        //
24//  along with this program; if not, write to the Free Software              //
25//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26//  ------------------------------------------------------------------------ //
27
28function newbb_notify_iteminfo($category, $item_id)
29{
30    $module_handler =& xoops_gethandler('module');
31    $module =& $module_handler->getByDirname('newbb');
32
33    if ($category=='global') {
34        $item['name'] = '';
35        $item['url'] = '';
36        return $item;
37    }
38
39    global $xoopsDB;
40    if ($category=='forum') {
41        // Assume we have a valid forum id
42        $sql = 'SELECT forum_name FROM ' . $xoopsDB->prefix('bb_forums') . ' WHERE forum_id = '.$item_id;
43        $result = $xoopsDB->query($sql); // TODO: error check
44        $result_array = $xoopsDB->fetchArray($result);
45        $item['name'] = $result_array['forum_name'];
46        $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewforum.php?forum=' . $item_id;
47        $item['uname'] = "uehara";
48        return $item;
49    }
50
51    if ($category=='thread') {
52        // Assume we have a valid topid id
53        $sql = 'SELECT t.topic_title,f.forum_id,f.forum_name, u.uname FROM '.$xoopsDB->prefix('bb_topics') . ' t, ' . $xoopsDB->prefix('bb_forums') . ' f, '.$xoopsDB->prefix('users').' u ,' .$xoopsDB->prefix('bb_posts').' p WHERE t.forum_id = f.forum_id AND t.topic_id = '. $item_id . ' AND t.topic_id = p.topic_id AND p.uid = u.uid limit 1';
54        $result = $xoopsDB->query($sql); // TODO: error check
55        $result_array = $xoopsDB->fetchArray($result);
56        $item['name'] = $result_array['topic_title'];
57        $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum=' . $result_array['forum_id'] . '&amp;topic_id=' . $item_id;
58        $item['uname'] = $result_array['uname'];
59        return $item;
60    }
61
62    if ($category=='post') {
63        // Assume we have a valid post id
64        $sql = 'SELECT subject,topic_id,forum_id FROM ' . $xoopsDB->prefix('bb_posts') . ' WHERE post_id = ' . $item_id . ' LIMIT 1';
65        $result = $xoopsDB->query($sql);
66        $result_array = $xoopsDB->fetchArray($result);
67        $item['name'] = $result_array['subject'];
68        $item['url'] = XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/viewtopic.php?forum= ' . $result_array['forum_id'] . '&amp;topic_id=' . $result_array['topic_id'] . '#forumpost' . $item_id;
69        return $item;
70    }
71}
72?>
Note: See TracBrowser for help on using the repository browser.