Example #1
0
 function setRead_items_cookie($status, $items)
 {
     $cookie_name = "LF";
     $items = array();
     if (!empty($status)) {
         $item_handler =& xoops_getmodulehandler('forum', 'newbb');
         $items_id = $item_handler->getIds();
         foreach ($items_id as $key) {
             $items[$key] = time();
         }
     }
     newbb_setcookie($cookie_name, $items);
     return true;
 }
Example #2
0
            $criteria_status_post->add(new Criteria("p.approved", 1));
        }
        break;
    default:
        $criteria_status_count = new Criteria("approved", 1);
        $criteria_status_post = new Criteria("p.approved", 1);
        break;
}
$criteria_count->add($criteria_status_count);
$criteria_post->add($criteria_status_post);
$karma_handler =& xoops_getmodulehandler('karma', 'newbb');
$user_karma = $karma_handler->getUserKarma();
$valid_modes = array("flat", "compact");
$viewmode_cookie = newbb_getcookie("V");
if (isset($_GET['viewmode']) && $_GET['viewmode'] == "compact") {
    newbb_setcookie("V", "compact", $forumCookie['expire']);
}
$viewmode = isset($_GET['viewmode']) ? $_GET['viewmode'] : (!empty($viewmode_cookie) ? $viewmode_cookie : @$valid_modes[$xoopsModuleConfig['view_mode'] - 1]);
$viewmode = in_array($viewmode, $valid_modes) ? $viewmode : $valid_modes[0];
$postCount = $post_handler->getPostCount($criteria_count);
$posts = $post_handler->getPostsByLimit($criteria_post, $post_perpage, $start);
$poster_array = array();
if (count($posts) > 0) {
    foreach (array_keys($posts) as $id) {
        $poster_array[$posts[$id]->getVar('uid')] = 1;
    }
}
$xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . _MD_VIEWALLPOSTS;
$xoopsOption['xoops_pagetitle'] = $xoops_pagetitle;
$xoopsOption['xoops_module_header'] = $xoops_module_header;
$xoopsOption['template_main'] = 'newbb_viewpost.html';
    $status = "";
    $mode = 0;
}
if ($mode) {
    $_GET['viewmode'] = "flat";
}
if (!$topic_handler->getPermission($forum_obj, $topic_obj->getVar('topic_status'), "view")) {
    redirect_header("viewforum.php?forum=" . $forum_id, 2, _MD_NORIGHTTOVIEW);
    exit;
}
$karma_handler =& xoops_getmodulehandler('karma', 'newbb');
$user_karma = $karma_handler->getUserKarma();
$valid_modes = array("flat", "thread", "compact");
$viewmode_cookie = newbb_getcookie("V");
if (isset($_GET['viewmode']) && in_array($_GET['viewmode'], $valid_modes)) {
    newbb_setcookie("V", $_GET['viewmode'], $forumCookie['expire']);
}
$viewmode = isset($_GET['viewmode']) ? $_GET['viewmode'] : (!empty($viewmode_cookie) ? $viewmode_cookie : @$valid_modes[$xoopsModuleConfig['view_mode'] - 1]);
$viewmode = in_array($viewmode, $valid_modes) ? $viewmode : "flat";
$order = isset($_GET['order']) && in_array(strtoupper($_GET['order']), array("DESC", "ASC")) ? $_GET['order'] : "ASC";
$total_posts = $topic_handler->getPostCount($topic_obj, $status);
if ($viewmode == "thread") {
    $xoopsOption['template_main'] = 'newbb_viewtopic_thread.html';
    if (!empty($xoopsModuleConfig["posts_for_thread"]) && $total_posts > $xoopsModuleConfig["posts_for_thread"]) {
        redirect_header("view.topic.php?topic_id={$topic_id}&viewmode=flat", 2, _MD_EXCEEDTHREADVIEW);
        exit;
    }
    $postsArray = $topic_handler->getAllPosts($topic_obj, $order, $total_posts, $start, 0, $status);
} else {
    $xoopsOption['template_main'] = 'newbb_viewtopic_flat.html';
    $postsArray = $topic_handler->getAllPosts($topic_obj, $order, $xoopsModuleConfig['posts_per_page'], $start, $post_id, $status);
Example #4
0
include XOOPS_ROOT_PATH . "/header.php";
if (!empty($forum_id)) {
    if (!$forum_handler->getPermission($forum, $perm)) {
        redirect_header("index.php", 2, _MD_NORIGHTTOACCESS);
        exit;
    }
    if ($forum->isSubforum()) {
        $q = "select forum_name from " . $xoopsDB->prefix('bb_forums') . " WHERE forum_id=" . $forum->getVar('parent_forum');
        $row = $xoopsDB->fetchArray($xoopsDB->query($q));
        $xoopsTpl->assign(array('parent_forum' => $forum->getVar('parent_forum'), 'parent_name' => $myts->htmlSpecialChars($row['forum_name'])));
    }
    $xoopsTpl->assign('forum_name', $forum->getVar('forum_name'));
    $xoopsTpl->assign('forum_moderators', $forum->disp_forumModerators());
    $forum_lastview = newbb_getcookie('LF', true);
    $forum_lastview[$forum_id] = time();
    newbb_setcookie("LF", $forum_lastview);
    $xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . $forum->getVar('forum_name') . ' - ' . _MD_VIEWALLPOSTS;
    $xoopsTpl->assign("forum_id", $forum->getVar('forum_id'));
    if (!empty($xoopsModuleConfig['rss_enable'])) {
        $xoops_module_header .= '<link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $forum->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $forum_id . '" />';
    }
} elseif (!empty($xoopsModuleConfig['rss_enable'])) {
    $xoops_module_header .= '<link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php" />';
}
$xoopsTpl->assign('xoops_module_header', $xoops_module_header);
$xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle);
$userid_array = array();
if (count($poster_array) > 0) {
    $member_handler =& xoops_gethandler('member');
    $userid_array = array_keys($poster_array);
    $user_criteria = "(" . implode(",", $userid_array) . ")";
Example #5
0
$subject_form = new XoopsFormText(_MD_SUBJECTC, 'subject', 60, 100, $subject);
$subject_form->setExtra("tabindex='1'");
$forum_form->addElement($subject_form, true);
if (!is_object($xoopsUser) && empty($admin_form_action)) {
    $required = empty($xoopsModuleConfig["require_name"]) ? false : true;
    $forum_form->addElement(new XoopsFormText(_MD_NAMEMAIL, 'poster_name', 60, 255, !empty($isedit) && !empty($poster_name) ? $poster_name : ''), $required);
}
$icons_radio = new XoopsFormRadio(_MD_MESSAGEICON, 'icon', $icon);
$subject_icons = XoopsLists::getSubjectsList();
foreach ($subject_icons as $iconfile) {
    $icons_radio->addOption($iconfile, '<img src="' . XOOPS_URL . '/images/subject/' . $iconfile . '" alt="" />');
}
$forum_form->addElement($icons_radio);
$nohtml = $forum->getVar('allow_html') ? false : true;
if (!empty($editor)) {
    newbb_setcookie("editor", $editor);
} else {
    $editor = newbb_getcookie("editor");
    if (empty($editor) && is_object($xoopsUser)) {
        $editor = @$xoopsUser->getVar("editor");
        // Need set through user profile
    }
}
$forum_form->addElement(new XoopsFormSelectEditor($forum_form, "editor", $editor, $nohtml));
$editor_configs["name"] = "message";
$editor_configs["value"] = $message;
$editor_configs["rows"] = 35;
$editor_configs["cols"] = 60;
$editor_configs["width"] = "100%";
$editor_configs["height"] = "400px";
$forum_form->addElement(new XoopsFormEditor(_MD_MESSAGEC, $editor, $editor_configs, $nohtml, $onfailure = null), true);
Example #6
0
// one month
$forumCookie['prefix'] = '';
// set cookie name to avoid subsites confusion such as: domain.com, sub1.domain.com, sub2.domain.com, domain.com/xoopss, domain.com/xoops2
if (empty($forumCookie['prefix'])) {
    $cookie_prefix = preg_replace("/[^a-z_0-9]+/i", "_", preg_replace("/(http(s)?:\\/\\/)?(www.)?/i", "", XOOPS_URL));
    $cookie_userid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
    $forumCookie['prefix'] = $cookie_prefix . "_" . $xoopsModule->dirname() . $cookie_userid . "_";
}
// set LastVisitTemp cookie, which only gets the time from the LastVisit cookie if it does not exist yet
// otherwise, it gets the time from the LastVisitTemp cookie
//$last_visit = newbb_getcookie("LVT");
$last_visit = newbb_getsession("LV");
$last_visit = $last_visit ? $last_visit : newbb_getcookie("LV");
$last_visit = $last_visit ? $last_visit : time();
// update LastVisit cookie.
newbb_setcookie("LV", time(), $forumCookie['expire']);
// set cookie life time to one month
//newbb_setcookie("LVT", $last_visit);
newbb_setsession("LV", $last_visit);
/* NewBB cookie storage
	Long term cookie: (configurable, generally one month)
		LV - Last Visit
		M - Menu mode
		V - View mode
		G - Toggle
	Short term cookie: (same as session life time)
		ST - Stored Topic IDs for mark
		LP - Last Post
		LF - Forum Last view
		LT - Topic Last read
		LVT - Last Visit Temp
Example #7
0
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
include '../../mainfile.php';
include XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php';
include XOOPS_ROOT_PATH . '/modules/newbb/include/vars.php';
$myts =& MyTextSanitizer::getInstance();
// MENU handler
$valid_menumodes = array(0 => _MD_MENU_SELECT, 1 => _MD_MENU_CLICK, 2 => _MD_MENU_HOVER);
// menumode cookie
if (isset($_REQUEST['menumode'])) {
    $menumode = intval($_REQUEST['menumode']);
    newbb_setcookie("M", $menumode, $forumCookie['expire']);
} else {
    $cookie_M = intval(newbb_getcookie("M"));
    $menumode = $cookie_M === null || !isset($valid_menumodes[$cookie_M]) ? $xoopsModuleConfig['menu_mode'] : $cookie_M;
}
$menumode_other = array();
$menu_url = htmlSpecialChars($_SERVER['REQUEST_URI']);
$menu_url .= false === strpos($menu_url, "?") ? "?menumode=" : "&amp;menumode=";
foreach ($valid_menumodes as $key => $val) {
    if ($key != $menumode) {
        $menumode_other[] = array("title" => $val, "link" => $menu_url . $key);
    }
}
if (!empty($xoopsModuleConfig['pngforie_enabled'])) {
    $xTheme->addCSS(null, null, 'img {behavior:url("include/pngbehavior.htc");}');
}
Example #8
0
    if (!empty($xoopsModuleConfig["posts_for_thread"]) && $total_posts > $xoopsModuleConfig["posts_for_thread"]) {
        redirect_header("viewtopic.php?topic_id={$topic_id}&amp;viewmode=flat", 2, _MD_EXCEEDTHREADVIEW);
        exit;
    }
    $postsArray = $topic_handler->getAllPosts($forumtopic, $order, $total_posts, $start);
} else {
    $xoopsOption['template_main'] = 'newbb_viewtopic_flat.html';
    $postsArray = $topic_handler->getAllPosts($forumtopic, $order, $xoopsModuleConfig['posts_per_page'], $start, $post_id);
}
// cookie should be handled before calling XOOPS_ROOT_PATH."/header.php", otherwise it won't work for cache
$topic_lastread = newbb_getcookie('LT', true);
if (empty($topic_lastread[$topic_id])) {
    $forumtopic->incrementCounter();
}
$topic_lastread[$topic_id] = time();
newbb_setcookie("LT", $topic_lastread);
$topic_title = $myts->htmlSpecialChars($forumdata['topic_title']);
$xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . $myts->htmlSpecialChars($forumdata['forum_name']) . ' - ' . $topic_title;
include XOOPS_ROOT_PATH . "/header.php";
$xoopsTpl->assign('xoops_pagetitle', $xoops_pagetitle);
if (!empty($xoopsModuleConfig['rss_enable'])) {
    $xoops_module_header .= '<link rel="alternate" type="application/xml+rss" title="' . $xoopsModule->getVar('name') . '-' . $viewtopic_forum->getVar('forum_name') . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/rss.php?f=' . $viewtopic_forum->getVar("forum_id") . '" />';
}
$xoopsTpl->assign('xoops_module_header', $xoops_module_header);
if ($xoopsModuleConfig['wol_enabled']) {
    $online_handler =& xoops_getmodulehandler('online', 'newbb');
    $online_handler->init($viewtopic_forum, $forumtopic);
    $xoopsTpl->assign('online', $online_handler->show_online());
    $xoopsTpl->assign('color_admin', $xoopsModuleConfig['wol_admin_col']);
    $xoopsTpl->assign('color_mod', $xoopsModuleConfig['wol_mod_col']);
}
Example #9
0
 function setRead_items_cookie($status, $forum_id)
 {
     $cookie_name = "LT";
     $cookie_vars = newbb_getcookie($cookie_name, true);
     $item_handler =& xoops_getmodulehandler('topic', 'newbb');
     $criteria = new CriteriaCompo(new Criteria("forum_id", $forum_id));
     $criteria->setSort("topic_last_post_id");
     $criteria->setOrder("DESC");
     $criteria->setLimit($this->items_per_forum);
     $items = $item_handler->getIds($criteria);
     foreach ($items as $var) {
         if (empty($status)) {
             if (isset($cookie_vars[$var])) {
                 unset($cookie_vars[$var]);
             }
         } else {
             $cookie_vars[$var] = time();
         }
     }
     newbb_setcookie($cookie_name, $cookie_vars);
     return true;
 }
Example #10
0
 function setRead_cookie($read_item, $post_id)
 {
     $cookie_name = $this->type == "forum" ? "LF" : "LT";
     $lastview = newbb_getcookie($cookie_name, true);
     $lastview[$read_item] = time();
     newbb_setcookie($cookie_name, $lastview);
 }
Example #11
0
$forum_selection_since =& newbb_sinceSelectBox($since);
$xoopsTpl->assign('forum_selection_since', $forum_selection_since);
$xoopsTpl->assign('h_topic_link', "viewforum.php?forum={$forumid}&amp;sortname=t.topic_title&amp;since={$since}&amp;sortorder=" . ($sortname == "t.topic_title" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_reply_link', "viewforum.php?forum={$forumid}&amp;sortname=t.topic_replies&amp;since={$since}&amp;sortorder=" . ($sortname == "t.topic_replies" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_poster_link', "viewforum.php?forum={$forumid}&amp;sortname=u.uname&amp;since={$since}&amp;sortorder=" . ($sortname == "u.uname" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_views_link', "viewforum.php?forum={$forumid}&amp;sortname=t.topic_views&amp;since={$since}&amp;sortorder=" . ($sortname == "t.topic_views" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_ratings_link', "viewforum.php?forum={$forumid}&amp;sortname=t.topic_ratings&amp;since={$since}&amp;sortorder=" . ($sortname == "t.topic_ratings" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_date_link', "viewforum.php?forum={$forumid}&amp;sortname=p.post_time&amp;since={$since}&amp;sortorder=" . ($sortname == "p.post_time" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('h_publish_link', "viewforum.php?forum={$forumid}&amp;sortname=t.topic_time&amp;since={$since}&amp;sortorder=" . ($sortname == "t.topic_time" && $sortorder == "DESC" ? "ASC" : "DESC")) . "&amp;type={$type}";
$xoopsTpl->assign('forum_since', $since);
// For $since in search.php
$startdate = empty($since) ? 0 : time() - newbb_getSinceTime($since);
$start = !empty($_GET['start']) ? intval($_GET['start']) : 0;
list($allTopics, $sticky) = $forum_handler->getAllTopics($forum, $startdate, $start, $sortname, $sortorder, $type, $xoopsModuleConfig['post_excerpt']);
// the cookie should be set before calling xoops/header.php, however, ...
newbb_setcookie("ST", array_keys($allTopics));
$xoopsTpl->assign('topics', $allTopics);
unset($allTopics);
$xoopsTpl->assign("subforum", $forum->getSubforums());
$xoopsTpl->assign('sticky', $sticky);
$xoopsTpl->assign('rating_enable', $xoopsModuleConfig['rating_enabled']);
$xoopsTpl->assign('img_newposts', newbb_displayImage($forumImage['newposts_topic']));
$xoopsTpl->assign('img_hotnewposts', newbb_displayImage($forumImage['hot_newposts_topic']));
$xoopsTpl->assign('img_folder', newbb_displayImage($forumImage['folder_topic']));
$xoopsTpl->assign('img_hotfolder', newbb_displayImage($forumImage['hot_folder_topic']));
$xoopsTpl->assign('img_locked', newbb_displayImage($forumImage['locked_topic']));
$xoopsTpl->assign('img_sticky', newbb_displayImage($forumImage['folder_sticky'], _MD_TOPICSTICKY));
$xoopsTpl->assign('img_digest', newbb_displayImage($forumImage['folder_digest'], _MD_TOPICDIGEST));
$xoopsTpl->assign('img_poll', newbb_displayImage($forumImage['poll'], _MD_TOPICHASPOLL));
$mark_read_link = "viewforum.php?mark_read=1&amp;start={$start}&amp;forum=" . $forum->getVar('forum_id') . "&amp;sortname={$sortname}&amp;sortorder={$sortorder}&amp;since={$since}&amp;type={$type}";
$mark_unread_link = "viewforum.php?mark_read=2&amp;start={$start}&amp;forum=" . $forum->getVar('forum_id') . "&amp;sortname={$sortname}&amp;sortorder={$sortorder}&amp;since={$since}&amp;type={$type}";