forked from nbuy/xoops-modules-ccenter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.php
62 lines (46 loc) · 1.91 KB
/
list.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
// show message list
// $Id: list.php,v 1.5 2009/10/05 06:00:15 nobu Exp $
include "../../mainfile.php";
include "functions.php";
include_once XOOPS_ROOT_PATH.'/class/pagenav.php';
$myts =& MyTextSanitizer::getInstance();
$xoopsOption['template_main'] = "ccenter_list.html";
$uid = is_object($xoopsUser)?$xoopsUser->getVar('uid'):0;
if (!is_object($xoopsUser)) {
redirect_header(XOOPS_URL.'/user.php', 3, _NOPERM);
exit;
}
include XOOPS_ROOT_PATH."/header.php";
// query from login user
if ($xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
if (isset($_GET['uid'])) $uid = intval($_GET['uid']);
}
$labels=array('mtime'=>_MD_POSTDATE, 'formid'=>_MD_CONTACT_FORM,
'touid'=>_MD_CONTACT_FROM, 'status'=>_CC_STATUS);
$orders=array('mtime'=>'ASC', 'formid'=>'ASC', 'touid'=>'ASC', 'status'=>'ASC',
'orders'=>array('mtime'));
$listctrl = new ListCtrl('mylist', $orders);
$cond = " AND ".$listctrl->sqlcondition();
if (isset($_GET['form'])) {
$cond .= " AND formid=".intval($_GET['form']);
}
$sqlx = "FROM ".CCMES." m,".FORMS." WHERE uid=$uid $cond AND fidref=formid";
$res = $xoopsDB->query("SELECT count(msgid) $sqlx");
list($total) = $xoopsDB->fetchRow($res);
$max = $xoopsModuleConfig['max_lists'];
$start = isset($_GET['start'])?intval($_GET['start']):0;
$nav = new XoopsPageNav($total, $max, $start, "start");
$xoopsTpl->assign('pagenav', $total>$max?$nav->renderNav():"");
$xoopsTpl->assign('statctrl', $listctrl->renderStat());
$xoopsTpl->assign('total', $total);
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsModule->getVar('name')." - "._MD_CCENTER_QUERY));
$xoopsTpl->assign('labels', $listctrl->getLabels($labels));
$res = $xoopsDB->query("SELECT m.*, title $sqlx ".$listctrl->sqlorder(), $max, $start);
$list = array();
while ($data = $xoopsDB->fetchArray($res)) {
$list[] = cc_message_entry($data);
}
$xoopsTpl->assign('list', $list);
include XOOPS_ROOT_PATH."/footer.php";
?>