$xoopsOption['template_main'] = "ccenter_message.html"; $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; $msgid = intval($_GET['id']); $data = cc_get_message($msgid); // change to accept status when change user access if ($uid && $uid == $data['touid'] && $data['status'] == _STATUS_NONE) { change_message_status($msgid, $uid, _STATUS_ACCEPT); $data['status'] = _STATUS_ACCEPT; } // recording contactee access time $now = time(); if ($uid == $data['uid'] && $now > $data['atime']) { $xoopsDB->queryF("UPDATE " . CCMES . " SET atime={$now} WHERE msgid={$msgid}"); } include XOOPS_ROOT_PATH . "/header.php"; $breadcrumbs = new XoopsBreadcrumbs(_MD_CCENTER_RECEPTION, 'reception.php'); $pass = isset($_GET['p']) ? $_GET['p'] : ''; $add = $pass ? "p=" . urlencode($pass) : ""; $to_uname = XoopsUser::getUnameFromId($data['touid']); $res = $xoopsDB->query("SELECT * FROM " . FORMS . " WHERE formid=" . $data['fidref']); $form = $xoopsDB->fetchArray($res); $items = get_form_attribute($form['defs']); $raws = unserialize_text($data['body']); $values = cc_display_values($raws, $items, $data['msgid'], $add); $data['comment'] = $myts->displayTarea($data['comment']); $isadmin = $uid && $xoopsUser->isAdmin($xoopsModule->getVar('mid')); $title = $data['title']; if ($isadmin) { $breadcrumbs->set($title, "reception.php?form=" . $data['fidref']); } else { $breadcrumbs->set($title, "index.php?form=" . $data['fidref']);
} if ($conds) { $cond .= " AND (" . join(' OR ', $conds) . ")"; } } else { $cond .= " AND grpperm LIKE '%|" . XOOPS_GROUP_ANONYMOUS . "|%'"; } if ($id) { $cond .= " AND formid={$id}"; } $res = $xoopsDB->query("SELECT * FROM " . FORMS . " WHERE {$cond} ORDER BY weight,formid"); if (!$res) { redirect_header('index.php', 3, _NOPERM); exit; } $breadcrumbs = new XoopsBreadcrumbs(); if ($xoopsDB->getRowsNum($res) != 1) { include XOOPS_ROOT_PATH . "/header.php"; $xoopsOption['template_main'] = "ccenter_index.html"; $forms = array(); while ($form = $xoopsDB->fetchArray($res)) { if ($form['priuid'] < 0) { continue; } // need uid setting $forms[] = $form; } $xoopsTpl->assign('forms', $forms); $breadcrumbs->assign(); include XOOPS_ROOT_PATH . "/footer.php"; exit;
$id = isset($_GET['form']) ? intval($_GET['form']) : 0; $isadmin = $xoopsUser->isAdmin($xoopsModule->getVar('mid')); if ($isadmin) { $cond = "1"; } else { $cond = '(priuid=' . $xoopsUser->getVar('uid') . ' OR cgroup IN (' . join(',', $xoopsUser->getGroups()) . '))'; } if ($id) { $cond .= ' AND formid=' . $id; } $res = $xoopsDB->query("SELECT f.*,count(msgid) nmsg,max(m.mtime) ltime\n FROM " . FORMS . " f LEFT JOIN " . CCMES . " m ON fidref=formid AND status<>" . $xoopsDB->quoteString(_STATUS_DEL) . "\n WHERE {$cond} GROUP BY formid"); if (!$res || $xoopsDB->getRowsNum($res) == 0) { redirect_header('index.php', 3, _NOPERM); exit; } $breadcrumbs = new XoopsBreadcrumbs(); $breadcrumbs->set(_MD_CCENTER_RECEPTION, "reception.php"); if ($xoopsDB->getRowsNum($res) > 1) { include XOOPS_ROOT_PATH . "/header.php"; $xoopsOption['template_main'] = "ccenter_reception.html"; $breadcrumbs->assign(); $forms = array(); $member_handler =& xoops_gethandler('member'); $groups = $member_handler->getGroupList(new Criteria('groupid', XOOPS_GROUP_ANONYMOUS, '!=')); while ($form = $xoopsDB->fetchArray($res)) { $form['title'] = htmlspecialchars($form['title']); $form['ltime'] = $form['ltime'] ? formatTimestamp($form['ltime']) : ""; if ($form['priuid']) { if ($form['priuid'] < 0) { $form['contact'] = '[' . $groups[-$form['priuid']] . ']'; } else {