コード例 #1
0
    $forum_form->addElement(new XoopsFormHidden('forum', $forum_id));
    $forum_form->addElement(new XoopsFormHidden('viewmode', $viewmode));
    $forum_form->addElement(new XoopsFormHidden('order', $order));
    $forum_form->addElement(new XoopsFormHidden('start', $start));
    // backward compatible
    if (!class_exists("XoopsSecurity")) {
        $post_valid = 1;
        $_SESSION['submit_token'] = $post_valid;
        $forum_form->addElement(new XoopsFormHidden('post_valid', $post_valid));
    }
    $forum_form->addElement(new XoopsFormHidden('notify', -1));
    $forum_form->addElement(new XoopsFormHidden('contents_submit', 1));
    $submit_button = new XoopsFormButton('', 'quick_submit', _SUBMIT, "submit");
    $submit_button->setExtra('onclick="if (document.forms.quick_reply.message.value == \'RE\' || document.forms.quick_reply.message.value == \'\') { alert(\'' . _MD_QUICKREPLY_EMPTY . '\'); return false;} else { return true;}"');
    $button_tray = new XoopsFormElementTray('');
    $button_tray->addElement($submit_button);
    $forum_form->addElement($button_tray);
    $toggles = newbb_getcookie('G', true);
    $display = in_array('qr', $toggles) ? 'none;' : 'block;';
    $xoopsTpl->assign('quickreply', array('show' => 1, 'display' => $display, 'icon' => newbb_displayImage($forumImage['t_qr']), 'form' => $forum_form->render()));
    unset($forum_form);
} else {
    $xoopsTpl->assign('quickreply', array('show' => 0));
}
if ($xoopsModuleConfig["do_tag"] && @(include_once XOOPS_ROOT_PATH . "/modules/tag/include/tagbar.php")) {
    $xoopsTpl->assign('tagbar', tagBar($topic_obj->getVar("topic_tags", "n")));
}
if ($transferbar = (include XOOPS_ROOT_PATH . "/Frameworks/transfer/bar.transfer.php")) {
    $xoopsTpl->assign('transfer', $transferbar);
}
include XOOPS_ROOT_PATH . '/footer.php';
コード例 #2
0
            $criteria_status_post = new CriteriaCompo(new Criteria("p.post_time", intval($last_visit), ">"));
            $criteria_status_count->add(new Criteria("approved", 1));
            $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;
コード例 #3
0
$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);
$options_tray = new XoopsFormElementTray(_MD_OPTIONS, '<br />');
if (is_object($xoopsUser) && $xoopsModuleConfig['allow_user_anonymous'] == 1) {
コード例 #4
0
ファイル: viewpost.php プロジェクト: BackupTheBerlios/soopa
$xoops_pagetitle = $xoopsModule->getVar('name') . ' - ' . $isnew ? _MD_VIEWNEWPOSTS : _MD_VIEWALLPOSTS;
$xoopsOption['template_main'] = $isnew ? 'newbb_viewpost_list.html' : 'newbb_viewpost.html';
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');
コード例 #5
0
ファイル: vars.php プロジェクト: BackupTheBerlios/soopa
$forumCookie['path'] = "/";
$forumCookie['secure'] = false;
$forumCookie['expire'] = time() + 3600 * 24 * 30;
// 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
コード例 #6
0
ファイル: forum.php プロジェクト: BackupTheBerlios/soopa
 function getTopicCount($forum, $startdate, $type)
 {
     global $viewall_forums;
     switch ($type) {
         case 'digest':
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = ' AND topic_digest = 1';
             break;
         case 'unreplied':
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = ' AND topic_replies < 1';
             break;
         case 'unread':
             $time_criterion = max($GLOBALS['last_visit'], $startdate);
             $post_time = ' p.post_time > ' . $time_criterion;
             $extra_criteria = '';
             $topics = array();
             $topic_lastread = newbb_getcookie('LT', true);
             if (count($topic_lastread) > 0) {
                 foreach ($topic_lastread as $id => $time) {
                     if ($time > $time_criterion) {
                         $topics[] = $id;
                     }
                 }
             }
             if (count($topics) > 0) {
                 $extra_criteria = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')';
             }
             break;
         case 'all':
             $post_time = ' p.post_time > ' . $startdate;
             $extra_criteria = '';
             break;
         default:
             $post_time = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)';
             $extra_criteria = '';
             break;
     }
     if (is_object($forum)) {
         $forum_criteria = ' AND t.forum_id = ' . $forum->getVar('forum_id');
     } else {
         if (is_array($viewall_forums) && count($viewall_forums) > 0) {
             $forum_criteria = ' AND t.forum_id IN (' . implode(',', array_keys($viewall_forums)) . ')';
         } else {
             $forum_criteria = '';
         }
     }
     $approve_criteria = ' AND t.approved = 1';
     // any others?
     $sql = 'SELECT COUNT(*) as count FROM ' . $this->db->prefix("bb_topics") . ' t LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id WHERE ';
     $sql .= $post_time . $forum_criteria . $extra_criteria . $approve_criteria;
     if (!($result = $this->db->query($sql))) {
         redirect_header('index.php', 2, "<br />NewbbForumHandler::getTopicCount " . _MD_ERROROCCURED . "<br />" . $sql);
         exit;
     }
     $myrow = $this->db->fetchArray($result);
     $count = $myrow['count'];
     return $count;
 }
コード例 #7
0
ファイル: form.post.php プロジェクト: trabisdementia/xuups
    $required = !empty($xoopsModuleConfig["require_name"]);
    $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 = !$topic_handler->getPermission($forum_obj, $topic_status, 'html');
if (count(@$xoopsModuleConfig["editor_allowed"]) == 1) {
    $editor = $xoopsModuleConfig["editor_allowed"][0];
} else {
    if (!empty($editor)) {
        newbb_setcookie("editor", $editor);
    } elseif (!($editor = newbb_getcookie("editor"))) {
        if (is_object($xoopsUser)) {
            $editor = @$xoopsUser->getVar("editor");
            // Need set through user profile
        }
        if (empty($editor)) {
            $editor = @$xoopsModuleConfig["editor_default"];
        }
    }
    $forum_form->addElement(new XoopsFormSelectEditor($forum_form, "editor", $editor, $nohtml, @$xoopsModuleConfig["editor_allowed"]));
}
$editor_configs = array();
$editor_configs["name"] = "message";
$editor_configs["value"] = $message;
$editor_configs["rows"] = empty($xoopsModuleConfig["editor_rows"]) ? 35 : $xoopsModuleConfig["editor_rows"];
$editor_configs["cols"] = empty($xoopsModuleConfig["editor_cols"]) ? 60 : $xoopsModuleConfig["editor_cols"];
コード例 #8
0
ファイル: header.php プロジェクト: BackupTheBerlios/soopa
//  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");}');
}
$xTheme->addJS(XOOPS_URL . "/modules/" . $xoopsModule->getVar("dirname") . "/include/js/newbb_toggle.js");
$xTheme->addJS(null, null, 'var toggle_cookie="' . $forumCookie['prefix'] . 'G' . '";');
コード例 #9
0
ファイル: forum.php プロジェクト: BackupTheBerlios/haxoo-svn
 function getTopicCount(&$forum, $startdate, $type)
 {
     global $xoopsModuleConfig;
     require_once XOOPS_ROOT_PATH . "/modules/newbb/include/functions.session.php";
     $criteria_extra = '';
     $criteria_approve = ' AND t.approved = 1';
     // any others?
     $leftjoin = ' LEFT JOIN ' . $this->db->prefix('bb_posts') . ' p ON p.post_id = t.topic_last_post_id';
     $criteria_post = ' p.post_time > ' . $startdate;
     switch ($type) {
         case 'digest':
             $criteria_extra = ' AND topic_digest = 1';
             break;
         case 'unreplied':
             $criteria_extra = ' AND topic_replies < 1';
             break;
         case 'unread':
             if (empty($xoopsModuleConfig["read_mode"])) {
             } elseif ($xoopsModuleConfig["read_mode"] == 2) {
                 $leftjoin .= ' LEFT JOIN ' . $this->db->prefix('bb_reads_topic') . ' r ON r.read_item = t.topic_id';
                 $criteria_post .= ' AND (r.read_id IS NULL OR r.post_id < t.topic_last_post_id)';
             } elseif ($xoopsModuleConfig["read_mode"] == 1) {
                 $criteria_post = ' p.post_time > ' . max($GLOBALS['last_visit'], $startdate);
                 $topics = array();
                 $topic_lastread = newbb_getcookie('LT', true);
                 if (count($topic_lastread) > 0) {
                     foreach ($topic_lastread as $id => $time) {
                         if ($time > $time_criterion) {
                             $topics[] = $id;
                         }
                     }
                 }
                 if (count($topics) > 0) {
                     $criteria_extra = ' AND t.topic_id NOT IN (' . implode(",", $topics) . ')';
                 }
             }
             break;
         case 'pending':
             $criteria_approve = ' AND t.approved = 0';
             break;
         case 'deleted':
             $criteria_approve = ' AND t.approved = -1';
             break;
         case 'all':
             break;
         default:
             $criteria_post = ' (p.post_time > ' . $startdate . ' OR t.topic_sticky=1)';
             break;
     }
     if (is_object($forum)) {
         $criteria_forum = ' AND t.forum_id = ' . $forum->getVar('forum_id');
     } else {
         if (is_array($forum) && count($forum) > 0) {
             $criteria_forum = ' AND t.forum_id IN (' . implode(',', array_keys($forum)) . ')';
         } elseif (!empty($forum)) {
             $criteria_forum = ' AND t.forum_id =' . intval($forum);
         } else {
             $criteria_forum = '';
         }
     }
     $sql = 'SELECT COUNT(*) as count FROM ' . $this->db->prefix("bb_topics") . ' t ' . $leftjoin;
     $sql .= ' WHERE ' . $criteria_post . $criteria_forum . $criteria_extra . $criteria_approve;
     if (!($result = $this->db->query($sql))) {
         //xoops_error($this->db->error().'<br />'.$sql);
         return null;
     }
     $myrow = $this->db->fetchArray($result);
     $count = $myrow['count'];
     return $count;
 }
コード例 #10
0
ファイル: readtopic.php プロジェクト: trabisdementia/xuups
 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;
 }
コード例 #11
0
ファイル: read.php プロジェクト: BackupTheBerlios/haxoo-svn
 function isRead_items_cookie(&$items)
 {
     $cookie_name = $this->type == "forum" ? "LF" : "LT";
     $cookie_vars = newbb_getcookie($cookie_name, true);
     $ret = array();
     foreach ($items as $key => $last_update) {
         $ret[$key] = max(@$GLOBALS['last_visit'], @$cookie_vars[$key]) >= $last_update;
     }
     return $ret;
 }