function &art_getWriterNameFromIds($writer_ids, $linked = false) { if (!is_array($writer_ids)) { $writer_ids = array($writer_ids); } $userid = array_map("intval", array_filter($writer_ids)); $myts =& MyTextSanitizer::getInstance(); $users = array(); if (count($userid) > 0) { $sql = 'SELECT writer_id, writer_name FROM ' . art_DB_prefix("writer") . ' WHERE writer_id IN(' . implode(",", array_unique($userid)) . ')'; if (!($result = $GLOBALS['xoopsDB']->query($sql))) { //xoops_error("writer query error: " . $sql); return $users; } mod_loadFunctions("url", $GLOBALS["artdirname"]); while ($row = $GLOBALS['xoopsDB']->fetchArray($result)) { $uid = $row["writer_id"]; $users[$uid] = $myts->htmlSpecialChars($row["writer_name"]); if ($linked) { $users[$uid] = '<a href="' . art_buildUrl(XOOPS_URL . "/modules/" . $GLOBALS["artdirname"] . "/view.writer.php", array("writer" => $uid)) . '">' . $users[$uid] . '</a>'; } } } return $users; }
function getValidItems($mid, $id = 0) { static $suspension = array(); $full_items = array(); if (empty($mid)) { return $full_items; } mod_loadFunctions("user", "newbb"); $uid = is_object($GLOBALS["xoopsUser"]) ? $GLOBALS["xoopsUser"]->getVar("uid") : 0; $ip = newbb_getIP(true); if (!empty($GLOBALS["xoopsModuleConfig"]['enable_usermoderate']) && !isset($suspension[$uid][$id]) && !newbb_isAdmin($id)) { $moderate_handler =& xoops_getmodulehandler('moderate', 'newbb'); if ($moderate_handler->verifyUser($uid, "", $id)) { $suspension[$uid][$ip][$id] = 1; } else { $suspension[$uid][$ip][$id] = 0; } } $items = $this->getValidPerms(); foreach ($items as $item) { /* skip access for suspended users */ //if ( !empty($suspension[$uid][$ip][$id]) && in_array($item, array("post", "reply", "edit", "delete", "addpoll", "vote", "attach", "noapprove", "type")) ) continue; if (!empty($suspension[$uid][$ip][$id])) { continue; } $full_items[] = "'forum_{$item}'"; } return $full_items; }
function xoops_module_update_tag(&$module, $prev_version = null) { load_functions("config"); mod_clearConfg($module->getVar("dirname", "n")); if ($prev_version <= 150) { $GLOBALS['xoopsDB']->queryFromFile(XOOPS_ROOT_PATH . "/modules/" . $module->getVar("dirname") . "/sql/mysql.150.sql"); } /* Do some synchronization */ mod_loadFunctions("recon", $module->getVar("dirname")); tag_synchronization(); return true; }
function getTime($format = "") { if (empty($format)) { if (!is_object($GLOBALS["xoopsModule"]) || $GLOBALS["xoopsModule"]->getVar("dirname") != $GLOBALS["artdirname"]) { $module_handler =& xoops_gethandler("module"); $artModule =& $module_handler->getByDirname($GLOBALS["artdirname"]); $config_handler =& xoops_gethandler("config"); $artConfig =& $config_handler->getConfigsByCat(0, $artModule->getVar("mid")); $format = $artConfig["timeformat"]; } else { $format = $GLOBALS["xoopsModuleConfig"]["timeformat"]; } } mod_loadFunctions("time", $GLOBALS["artdirname"]); $time = art_formatTimestamp($this->getVar("sp_time"), $format); return $time; }
function getPermission($forum, $topic_locked = 0, $type = "view") { global $xoopsUser, $xoopsModule; static $_cachedTopicPerms; mod_loadFunctions("user", "newbb"); if (newbb_isAdmin($forum)) { return 1; } $forum_id = is_object($forum) ? $forum->getVar('forum_id') : intval($forum); if ($forum_id < 1) { return false; } if ($topic_locked && 'view' != $type) { $permission = 0; } else { $perm_handler =& xoops_getmodulehandler('permission', 'newbb'); $permission = $perm_handler->getPermission("forum", $type, $forum_id); } return $permission; }
$articles_count = $article_handler->getCount($criteria); $tags = array("cat_id", "art_summary", "art_title", "art_time_submit", "art_time_publish", "art_summary", "uid"); $criteria->setStart($start); $criteria->setLimit($xoopsModuleConfig["articles_perpage"]); $articles_array = $article_handler->getAll($criteria, $tags, false); } $articles = array(); if (count($articles_array) > 0) { $author_array = array(); foreach ($articles_array as $id => $artcile) { if ($artcile["uid"] > 0) { $author_array[$artcile["uid"]] = 1; } } if (!empty($author_array)) { mod_loadFunctions("author"); $users = art_getAuthorNameFromId(array_keys($author_array), true, true); } foreach ($articles_array as $id => $article) { $_article = array("id" => $article["art_id"], "cat_id" => empty($article["basic_cat_id"]) ? $article["cat_id"] : $article["basic_cat_id"], "title" => $article["art_title"], "submit" => art_formatTimestamp(@$article["art_time_submit"]), "publish" => art_formatTimestamp(@$article["art_time_publish"]), "register_category" => art_formatTimestamp(@$article["ac_register"]), "time_topic" => art_formatTimestamp(@$article["at_time"]), "summary" => $article["art_summary"], "author" => $users[$article["uid"]]); if (!empty($article["ac_feature"])) { $_article["feature_category"] = art_formatTimestamp($article["ac_feature"]); } if (!empty($article["ac_publish"])) { $_article["publish_category"] = art_formatTimestamp($article["ac_publish"]); } if (!empty($category_obj)) { $_article["category"] = array("id" => $category_obj->getVar("cat_id")); } else { $_article["category"] = array("id" => $article["cat_id"], "title" => $categories_obj[$article["cat_id"]]->getVar("cat_title")); }
/** * CBB 4.0, or newbb, the forum module for XOOPS project * * @copyright The XOOPS Project http://xoops.sf.net * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Taiwen Jiang (phppp or D.J.) <*****@*****.**> * @since 4.00 * @version $Id $ * @package module::newbb */ if (!defined('XOOPS_ROOT_PATH')) { exit; } include_once XOOPS_ROOT_PATH . '/modules/newbb/include/functions.ini.php'; mod_loadFunctions("session", "newbb"); // NewBB cookie structure /* 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 */ /* -- Cookie settings -- */
$thread_buttons['reply']['name'] = _MD_REPLY; } if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) { $thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT); $thread_buttons['report']['link'] = "report.php?forum=" . $post->getVar('forum_id') . "&topic_id=" . $post->getVar('topic_id'); $thread_buttons['report']['name'] = _MD_REPORT; } $thread_action = array(); $xoopsTpl->append('posts', array('post_id' => $post->getVar('post_id'), 'topic_id' => $post->getVar('topic_id'), 'forum_id' => $post->getVar('forum_id'), 'post_date' => newbb_formatTimestamp($post->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $post_title, 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $post->displayPostEdit(), 'post_no' => $start + $pn, 'post_signature' => $post->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($post->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'poster' => $poster)); unset($thread_buttons); unset($poster); } unset($viewtopic_users); unset($forums); if (!empty($xoopsModuleConfig['show_jump'])) { mod_loadFunctions("forum", "newbb"); $xoopsTpl->assign('forum_jumpbox', newbb_make_jumpbox($forum_id)); } if ($postCount > $post_perpage) { include XOOPS_ROOT_PATH . '/class/pagenav.php'; $nav = new XoopsPageNav($postCount, $post_perpage, $start, "start", 'forum=' . $forum_id . '&viewmode=' . $viewmode . '&status=' . $status . '&uid=' . $uid . '&order=' . $order . "&mode=" . $mode); $xoopsTpl->assign('pagenav', $nav->renderNav(4)); } else { $xoopsTpl->assign('pagenav', ''); } $xoopsTpl->assign('lang_forum_index', sprintf(_MD_FORUMINDEX, htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES))); switch ($status) { case 'active': $lang_title = _MD_VIEWALLPOSTS . ' [' . _MD_TYPE_ADMIN . ']'; break; case 'pending':
if (count($valid_forums) == 0) { newbb_trackback_response(1, _NOPERM); } $charset = 'UTF-8'; header('Content-Type:text/xml; charset=' . $charset); $tpl = new XoopsTpl(); $tpl->caching = 2; $tpl->cache_lifetime = $xoopsModuleConfig['rss_cachetime'] * 60; if (!empty($xoopsConfig['rewrite'])) { $tpl->load_filter('output', 'xoRewriteModule'); } mod_loadFunctions("cache"); $xoopsCachedTemplateId = md5(mod_generateCacheId_byGroup() . str_replace(XOOPS_URL, '', $_SERVER['REQUEST_URI'])); $compile_id = NULL; if (!$tpl->is_cached('db:newbb_rss.html', $xoopsCachedTemplateId, $compile_id)) { mod_loadFunctions("time", "newbb"); $xmlrss_handler =& xoops_getmodulehandler('xmlrss', 'newbb'); $rss = $xmlrss_handler->create(); $rss->setVarRss('channel_title', $xoopsConfig['sitename'] . ' :: ' . _MD_FORUM); $rss->channel_link = XOOPS_URL . '/'; $rss->setVarRss('channel_desc', $xoopsConfig['slogan'] . ' :: ' . $xoopsModule->getInfo('description')); // There is a "bug" with xoops function formatTimestamp(time(), 'rss') // We have to make a customized function //$rss->channel_lastbuild = formatTimestamp(time(), 'rss'); $rss->setVarRss('channel_lastbuild', newbb_formatTimestamp(time(), 'rss')); $rss->channel_webmaster = $xoopsConfig['adminmail']; $rss->channel_editor = $xoopsConfig['adminmail']; $rss->setVarRss('channel_category', $xoopsModule->getVar('name')); $rss->channel_generator = "CBB " . $xoopsModule->getInfo('version'); $rss->channel_language = _LANGCODE; $rss->xml_encoding = $charset;
function loadUserOnline() { if (empty($this->users) || !$this->enableOnline) { return; } mod_loadFunctions("render", "newbb"); $image_online = newbb_displayImage('online', _MD_ONLINE); $image_offline = newbb_displayImage('offline', _MD_OFFLINE); $online_handler =& xoops_getmodulehandler('online', 'newbb'); $onlines = $online_handler->checkStatus(array_keys($this->users)); foreach (array_keys($this->users) as $uid) { $this->userlist[$uid]["status"] = empty($onlines[$uid]) ? $image_offline : $image_online; } }
// it under the terms of the GNU General Public License as published by // // the Free Software Foundation; either version 2 of the License, or // // (at your option) any later version. // // // // You may not change or alter any portion of this comment or credits // // of supporting developers from this source code or any supporting // // source code which is considered copyrighted (c) material of the // // original comment or credit authors. // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // 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 // // ------------------------------------------------------------------------ // // Author: phppp (D.J., infomax@gmail.com) // // URL: http://xoopsforge.com, http://xoops.org.cn // // Project: Article Project // // ------------------------------------------------------------------------ // include "../../../include/cp_header.php"; include XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/vars.php"; mod_loadFunctions(); load_functions("admin"); // include the default language file for the admin interface if (!@(include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/language/" . $xoopsConfig['language'] . "/main.php")) { include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/language/english/main.php"; } $myts =& MyTextSanitizer::getInstance();
/** * clean orphan links from database * * @return bool true on success */ function cleanOrphan() { mod_loadFunctions("recon"); return tag_cleanOrphan(); return true; }
<?php /** * Article module for XOOPS * * You may not change or alter any portion of this comment or credits * of supporting developers from this source code or any supporting source code * which is considered copyrighted (c) material of the original comment or credit authors. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package article * @since 1.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id: header.php 2178 2008-09-26 08:34:09Z phppp $ */ include_once '../../mainfile.php'; include XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname") . "/include/vars.php"; mod_loadFunctions("", $xoopsModule->getVar("dirname")); art_define_url_delimiter(); $myts =& MyTextSanitizer::getInstance();
/** * get text content of a specified page of the article * * @param int $page page no * @param string $format text format * @return array */ function &getText($page = -1, $format = "s") { global $xoopsModuleConfig; $format = strtolower($format); $text = $this->_getText($page, $format); if (empty($text)) { return $text; } if ($format == "e" || $format == "edit" || $format == "n" || $format == "none") { return $text; } if ($format == "raw") { mod_loadFunctions("render", $GLOBALS["artdirname"]); $ret = array("title" => art_htmlSpecialChars($text["title"]), "body" => art_displayTarea($text["body"])); return $ret; } $body =& $text["body"]; $body = $this->parseNotes($body); $body = $this->parseHeadings($body); $ret = array("title" => $text["title"], "body" => $body); return $ret; }
/** * Deprecated */ function &show_online() { mod_loadFunctions("render", "newbb"); mod_loadFunctions("user", "newbb"); if ($this->topic_id) { $criteria = new Criteria('online_topic', $this->topic_id); } elseif ($this->forum_id) { $criteria = new Criteria('online_forum', $this->forum_id); } else { $criteria = null; } $users =& $this->getAll($criteria); $num_total = count($users); $num_user = 0; $users_id = array(); $users_online = array(); for ($i = 0; $i < $num_total; $i++) { if (empty($users[$i]['online_uid'])) { continue; } $users_id[] = $users[$i]['online_uid']; $users_online[$users[$i]['online_uid']] = array("link" => XOOPS_URL . "/userinfo.php?uid=" . $users[$i]['online_uid'], "uname" => $users[$i]['online_uname']); $num_user++; } $num_anonymous = $num_total - $num_user; $online = array(); $online['image'] = newbb_displayImage('whosonline'); $online['num_total'] = $num_total; $online['num_user'] = $num_user; $online['num_anonymous'] = $num_anonymous; $administrator_list = newbb_isModuleAdministrators($users_id); $moderator_list = array(); if ($member_list = array_diff($users_id, array_keys($administrator_list))) { if (is_object($this->forum_object)) { $moderator_list = $this->forum_object->getVar("forum_moderator"); } else { $moderator_list = newbb_isForumModerators($member_list); } } foreach ($users_online as $uid => $user) { if (in_array($uid, $administrator_list)) { $user['level'] = 2; } elseif (in_array($uid, $moderator_list)) { $user['level'] = 1; } else { $user['level'] = 0; } $online["users"][] = $user; } return $online; }
function renderTopics($xoopsTpl = null) { global $myts; $ret = array(); //$this->parseVars(); if ($this->noperm) { if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("topics", $ret); return; } return $ret; } $selects = array(); $froms = array(); $joins = array(); $wheres = array(); // topic fields $selects[] = 't.*'; // post fields $selects[] = 'p.post_time as last_post_time, p.poster_name as last_poster_name, p.icon, p.post_id, p.uid'; $froms[] = $this->handler->db->prefix("bb_topics") . ' AS t '; $joins[] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts') . ' AS p ON p.post_id = t.topic_last_post_id'; $wheres[] = "1 = 1"; if (!empty($this->config['post_excerpt'])) { $selects[] = 'p.post_karma, p.require_reply, pt.post_text'; $this->query["join"][] = 'LEFT JOIN ' . $this->handler->db->prefix('bb_posts_text') . ' AS pt ON pt.post_id = t.topic_last_post_id'; } if (empty($this->query["sort"])) { $this->query["sort"][] = 't.topic_last_post_id DESC'; } $sql = ' SELECT ' . implode(", ", $selects) . ' FROM ' . implode(", ", $froms) . ' ' . implode(" ", $joins) . ' ' . implode(" ", $this->query["join"]) . ' WHERE ' . implode(" AND ", $wheres) . ' AND ' . @implode(" AND ", @$this->query["where"]) . ' ORDER BY ' . implode(", ", $this->query["sort"]); if (!($result = $this->handler->db->query($sql, $this->config['topics_per_page'], @$this->vars["start"]))) { if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("topics", $ret); return; } return $ret; } mod_loadFunctions("render", "newbb"); mod_loadFunctions("session", "newbb"); mod_loadFunctions("time", "newbb"); mod_loadFunctions("read", "newbb"); mod_loadFunctions("topic", "newbb"); $sticky = 0; $topics = array(); $posters = array(); $reads = array(); $types = array(); $forums = array(); $anonymous = $myts->htmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']); while ($myrow = $this->handler->db->fetchArray($result)) { if ($myrow['topic_sticky']) { $sticky++; } // ------------------------------------------------------ // topic_icon: priority: sticky -> digest -> regular if ($myrow['topic_haspoll']) { if ($myrow['topic_sticky']) { $topic_icon = newbb_displayImage("topic_sticky", _MD_TOPICSTICKY) . '<br />' . newbb_displayImage("poll", _MD_TOPICHASPOLL); } else { $topic_icon = newbb_displayImage('poll', _MD_TOPICHASPOLL); } } elseif ($myrow['topic_sticky']) { $topic_icon = newbb_displayImage('topic_sticky', _MD_TOPICSTICKY); } elseif (!empty($myrow['icon'])) { $topic_icon = '<img src="' . XOOPS_URL . '/images/subject/' . htmlspecialchars($myrow['icon']) . '" alt="" />'; } else { $topic_icon = '<img src="' . XOOPS_URL . '/images/icons/no_posticon.gif" alt="" />'; } // ------------------------------------------------------ // rating_img $rating = number_format($myrow['rating'] / 2, 0); $rating_img = newbb_displayImage($rating < 1 ? 'blank' : 'rate' . $rating); // ------------------------------------------------------ // topic_page_jump $topic_page_jump = ''; $topic_page_jump_icon = ''; $totalpages = ceil(($myrow['topic_replies'] + 1) / $this->config['posts_per_page']); if ($totalpages > 1) { $topic_page_jump .= ' '; $append = false; for ($i = 1; $i <= $totalpages; $i++) { if ($i > 3 && $i < $totalpages) { if (!$append) { $topic_page_jump .= "..."; $append = true; } } else { $topic_page_jump .= '[<a href="viewtopic.php?topic_id=' . $myrow['topic_id'] . '&start=' . ($i - 1) * $this->config['posts_per_page'] . '">' . $i . '</a>]'; $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "&start=" . ($i - 1) * $this->config['posts_per_page'] . "" . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</a>"; } } } else { $topic_page_jump_icon = "<a href='" . XOOPS_URL . "/modules/newbb/viewtopic.php?topic_id=" . $myrow['topic_id'] . "" . "'>" . newbb_displayImage('document', _MD_NEWBB_GOTOLASTPOST) . "</a>"; } // ------------------------------------------------------ // => topic array $topic_title = $myts->htmlSpecialChars($myrow['topic_title']); if ($myrow['topic_digest']) { $topic_title = "<span class='digest'>" . $topic_title . "</span>"; } if (empty($this->config["post_excerpt"])) { $topic_excerpt = ""; } elseif (($myrow['post_karma'] > 0 || $myrow['require_reply'] > 0) && !newbb_isAdmin($myrow['forum_id'])) { $topic_excerpt = ""; } else { $topic_excerpt = xoops_substr(newbb_html2text($myts->displayTarea($myrow['post_text'])), 0, $this->config["post_excerpt"]); $topic_excerpt = str_replace("[", "[", $myts->htmlSpecialChars($topic_excerpt)); } $topics[$myrow['topic_id']] = array('topic_id' => $myrow['topic_id'], 'topic_icon' => $topic_icon, 'type_id' => $myrow['type_id'], 'topic_title' => $topic_title, 'topic_link' => 'viewtopic.php?topic_id=' . $myrow['topic_id'] . '&forum=' . $myrow['forum_id'], 'rating_img' => $rating_img, 'topic_page_jump' => $topic_page_jump, 'topic_page_jump_icon' => $topic_page_jump_icon, 'topic_replies' => $myrow['topic_replies'], 'topic_poster_uid' => $myrow['topic_poster'], 'topic_poster_name' => !empty($myrow['poster_name']) ? $myts->htmlSpecialChars($myrow['poster_name']) : $anonymous, 'topic_views' => $myrow['topic_views'], 'topic_time' => newbb_formatTimestamp($myrow['topic_time']), 'topic_last_posttime' => newbb_formatTimestamp($myrow['last_post_time']), 'topic_last_poster_uid' => $myrow['uid'], 'topic_last_poster_name' => !empty($myrow['last_poster_name']) ? $myts->htmlSpecialChars($myrow['last_poster_name']) : $anonymous, 'topic_forum' => $myrow['forum_id'], 'topic_excerpt' => $topic_excerpt, 'stick' => empty($myrow['topic_sticky']), "stats" => array($myrow['topic_status'], $myrow['topic_digest'], $myrow['topic_replies'])); /* users */ $posters[$myrow['topic_poster']] = 1; $posters[$myrow['uid']] = 1; // reads if (!empty($this->config["read_mode"])) { $reads[$myrow['topic_id']] = $this->config["read_mode"] == 1 ? $myrow['last_post_time'] : $myrow["topic_last_post_id"]; } // types if (!empty($myrow['type_id'])) { //$types[$myrow['type_id']] = 1; } // forums $forums[$myrow['forum_id']] = 1; } $posters_name = newbb_getUnameFromIds(array_keys($posters), $this->config['show_realname'], true); $topic_isRead = newbb_isRead("topic", $reads); /* $type_list = array(); if (count($types) > 0) { $type_handler =& xoops_getmodulehandler('type', 'newbb'); $type_list = $type_handler->getAll(new Criteria("type_id", "(".implode(", ", array_keys($types)).")", "IN"), null, false); } */ $type_list = $this->getTypes(); $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); if (count($forums) > 0) { $forum_list = $forum_handler->getAll(new Criteria("forum_id", "(" . implode(", ", array_keys($forums)) . ")", "IN"), array("forum_name", "hot_threshold"), false); } else { $forum_list = $forum_handler->getAll(); } foreach (array_keys($topics) as $id) { $topics[$id]["topic_forum_link"] = '<a href="' . XOOPS_URL . '/modules/newbb/viewforum.php?forum=' . $topics[$id]["topic_forum"] . '">' . $forum_list[$topics[$id]["topic_forum"]]["forum_name"] . '</a>'; if (!empty($topics[$id]["type_id"]) && isset($type_list[$topics[$id]["type_id"]])) { $topics[$id]["topic_title"] = getTopicTitle($topics[$id]["topic_title"], $type_list[$topics[$id]["type_id"]]["type_name"], $type_list[$topics[$id]["type_id"]]["type_color"]); } $topics[$id]["topic_poster"] = !empty($posters_name[$topics[$id]["topic_poster_uid"]]) ? $posters_name[$topics[$id]["topic_poster_uid"]] : $topics[$id]["topic_poster_name"]; $topics[$id]["topic_last_poster"] = !empty($posters_name[$topics[$id]["topic_last_poster_uid"]]) ? $posters_name[$topics[$id]["topic_last_poster_uid"]] : $topics[$id]["topic_last_poster_name"]; // ------------------------------------------------------ // topic_folder: priority: newhot -> hot/new -> regular list($topic_status, $topic_digest, $topic_replies) = $topics[$id]["stats"]; if ($topic_status == 1) { $topic_folder = 'topic_locked'; } else { if ($topic_digest) { $topic_folder = 'topic_digest'; } elseif ($topic_replies >= $forum_list[$topics[$id]["topic_forum"]]["hot_threshold"]) { $topic_folder = empty($topic_isRead[$id]) ? 'topic_hot_new' : 'topic_hot'; } else { $topic_folder = empty($topic_isRead[$id]) ? 'topic_new' : 'topic'; } } $topics[$id]['topic_folder'] = newbb_displayImage($topic_folder); unset($topics[$id]["topic_poster_name"], $topics[$id]["topic_last_poster_name"], $topics[$id]["stats"]); } if (count($topics) > 0) { $sql = " SELECT DISTINCT topic_id FROM " . $this->handler->db->prefix("bb_posts") . " WHERE attachment != ''" . " AND topic_id IN (" . implode(',', array_keys($topics)) . ")"; if ($result = $this->handler->db->query($sql)) { while (list($topic_id) = $this->handler->db->fetchRow($result)) { $topics[$topic_id]['attachment'] = ' ' . newbb_displayImage('attachment', _MD_TOPICSHASATT); } } } if (is_object($xoopsTpl)) { $xoopsTpl->assign_by_ref("sticky", $sticky); $xoopsTpl->assign_by_ref("topics", $topics); return; } return array($topics, $sticky); }
$result = $xoopsDB->query($sql); list($posts) = $xoopsDB->fetchRow($result); $xoopsDB->queryF("\tINSERT INTO {$stats_handler->table}" . "\t\t(`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) " . "\tVALUES " . "\t\t('{$forum_id}', '{$posts}', '" . array_search("post", $stats_handler->param["type"]) . "', '" . array_search($period, $stats_handler->param["period"]) . "', NOW(), '{$format}')"); @($counts["post"][$period] += $posts); } } $xoopsDB->queryF("\tDELETE FROM {$stats_handler->table}" . "\tWHERE stats_id = '0' AND stats_period <> " . array_search("total", $stats_handler->param["period"])); foreach ($time_start as $period => $format) { foreach (array_keys($counts) as $type) { $xoopsDB->queryF("\tINSERT INTO {$stats_handler->table}" . "\t\t(`stats_id`, `stats_value`, `stats_type`, `stats_period`, `time_update`, `time_format`) " . "\tVALUES " . "\t\t('0', '{$counts[$type][$period]}', '" . array_search($type, $stats_handler->param["type"]) . "', '" . array_search($period, $stats_handler->param["period"]) . "', NOW(), '{$format}')"); } } break; case "misc": default: mod_loadFunctions("recon", "newbb"); newbb_synchronization(); break; } $form = '<fieldset><legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_SYNCFORUM . '</legend>'; $form .= '<form action="admin_synchronization.php" method="get">'; $form .= '<div style="padding: 10px 2px;">'; $form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_FORUM . '</h2>'; $form .= '<input type="hidden" name="type" value="forum">'; $form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="20">'; $form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; $form .= '</div>'; $form .= '</form>'; $form .= '<form action="admin_synchronization.php" method="get">'; $form .= '<div style="padding: 10px 2px;">'; $form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_TOPIC . '</h2>';
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @package article * @since 1.0 * @author Taiwen Jiang <*****@*****.**> * @version $Id: pingback.php 2178 2008-09-26 08:34:09Z phppp $ */ if (!defined("XOOPS_ROOT_PATH")) { exit; } include_once dirname(dirname(__FILE__)) . "/include/vars.php"; mod_loadFunctions("parse", $GLOBALS["artdirname"]); if (!class_exists("Pingback")) { class Pingback extends XoopsObject { //var $db; //var $table; function Pingback($id = null) { //$this->ArtObject(); //$this->db =& Database::getInstance(); //$this->table = art_DB_prefix("pingback"); $this->initVar("pb_id", XOBJ_DTYPE_INT, null); $this->initVar("art_id", XOBJ_DTYPE_INT, 0, true); $this->initVar("pb_time", XOBJ_DTYPE_INT); $this->initVar("pb_host", XOBJ_DTYPE_TXTBOX); $this->initVar("pb_url", XOBJ_DTYPE_TXTBOX);
/** * get verified image url of the category * * @return string */ function getImage() { mod_loadFunctions("url", $GLOBALS["artdirname"]); $image = art_getImageUrl($this->getVar("cat_image")); return $image; }
function showPost($isadmin) { global $xoopsConfig, $xoopsModule, $xoopsModuleConfig, $xoopsUser, $myts; global $forumUrl, $forumImage; global $viewtopic_users, $viewtopic_posters, $forum_obj, $topic_obj, $online, $user_karma, $viewmode, $order, $start, $total_posts, $topic_status; static $post_NO = 0; static $name_anonymous; if (!isset($name_anonymous)) { $name_anonymous = $myts->HtmlSpecialChars($GLOBALS["xoopsConfig"]['anonymous']); } mod_loadFunctions("time", "newbb"); mod_loadFunctions("render", "newbb"); $post_id = $this->getVar('post_id'); $topic_id = $this->getVar('topic_id'); $forum_id = $this->getVar('forum_id'); $query_vars = array("status", "order", "start", "mode", "viewmode"); $query_array = array(); $query_array["topic_id"] = "topic_id={$topic_id}"; foreach ($query_vars as $var) { if (!empty($_GET[$var])) { $query_array[$var] = "{$var}={$_GET[$var]}"; } } $page_query = htmlspecialchars(implode("&", array_values($query_array))); $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0; $post_NO++; if (strtolower($order) == "desc") { $post_no = $total_posts - ($start + $post_NO) + 1; } else { $post_no = $start + $post_NO; } if ($isadmin || $this->checkIdentity()) { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } elseif ($xoopsModuleConfig['enable_karma'] && $this->getVar('post_karma') > $user_karma) { $post_text = "<div class='karma'>" . sprintf(_MD_KARMA_REQUIREMENT, $user_karma, $this->getVar('post_karma')) . "</div>"; $post_attachment = ''; } elseif ($xoopsModuleConfig['allow_require_reply'] && $this->getVar('require_reply') && (!$uid || !in_array($uid, $viewtopic_posters))) { $post_text = "<div class='karma'>" . _MD_REPLY_REQUIREMENT . "</div>"; $post_attachment = ''; } else { $post_text = $this->getVar('post_text'); $post_attachment = $this->displayAttachment(); } if (isset($viewtopic_users[$this->getVar('uid')])) { $poster = $viewtopic_users[$this->getVar('uid')]; } else { $name = ($post_name = $this->getVar('poster_name')) ? $post_name : $name_anonymous; $poster = array('poster_uid' => 0, 'name' => $name, 'link' => $name); } if ($posticon = $this->getVar('icon')) { $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/subject/' . $posticon . '" alt="" /></a>'; } else { $post_image = '<a name="' . $post_id . '"><img src="' . XOOPS_URL . '/images/icons/posticon.gif" alt="" /></a>'; } $thread_buttons = array(); $mod_buttons = array(); if ($isadmin && ($xoopsUser && $xoopsUser->getVar('uid') != $this->getVar('uid')) && $this->getVar('uid') > 0) { $mod_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); $mod_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&fuid=" . $this->getVar('uid'); $mod_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; $thread_buttons['bann']['image'] = newbb_displayImage('p_bann', _MD_SUSPEND_MANAGEMENT); $thread_buttons['bann']['link'] = "moderate.php?forum=" . $forum_id . "&fuid=" . $this->getVar('uid'); $thread_buttons['bann']['name'] = _MD_SUSPEND_MANAGEMENT; } if ($GLOBALS["xoopsModuleConfig"]['enable_permcheck']) { $topic_handler =& xoops_getmodulehandler('topic', 'newbb'); $topic_status = $topic_obj->getVar('topic_status'); if ($topic_handler->getPermission($forum_id, $topic_status, "edit")) { $edit_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('edit_timelimit'); if ($edit_ok) { $thread_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $thread_buttons['edit']['link'] = "edit.php?{$page_query}"; $thread_buttons['edit']['name'] = _EDIT; $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $mod_buttons['edit']['link'] = "edit.php?{$page_query}"; $mod_buttons['edit']['name'] = _EDIT; } } if ($topic_handler->getPermission($forum_id, $topic_status, "delete")) { $delete_ok = $isadmin || $this->checkIdentity() && $this->checkTimelimit('delete_timelimit'); if ($delete_ok) { $thread_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $thread_buttons['delete']['link'] = "delete.php?{$page_query}"; $thread_buttons['delete']['name'] = _DELETE; $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $mod_buttons['delete']['link'] = "delete.php?{$page_query}"; $mod_buttons['delete']['name'] = _DELETE; } } if ($topic_handler->getPermission($forum_id, $topic_status, "reply")) { $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); $thread_buttons['reply']['link'] = "reply.php?{$page_query}"; $thread_buttons['reply']['name'] = _MD_REPLY; $thread_buttons['quote']['image'] = newbb_displayImage('p_quote', _MD_QUOTE); $thread_buttons['quote']['link'] = "reply.php?{$page_query}&quotedac=1"; $thread_buttons['quote']['name'] = _MD_QUOTE; } } else { $mod_buttons['edit']['image'] = newbb_displayImage('p_edit', _EDIT); $mod_buttons['edit']['link'] = "edit.php?{$page_query}"; $mod_buttons['edit']['name'] = _EDIT; $mod_buttons['delete']['image'] = newbb_displayImage('p_delete', _DELETE); $mod_buttons['delete']['link'] = "delete.php?{$page_query}"; $mod_buttons['delete']['name'] = _DELETE; $thread_buttons['reply']['image'] = newbb_displayImage('p_reply', _MD_REPLY); $thread_buttons['reply']['link'] = "reply.php?{$page_query}"; $thread_buttons['reply']['name'] = _MD_REPLY; } if (!$isadmin && $xoopsModuleConfig['reportmod_enabled']) { $thread_buttons['report']['image'] = newbb_displayImage('p_report', _MD_REPORT); $thread_buttons['report']['link'] = "report.php?{$page_query}"; $thread_buttons['report']['name'] = _MD_REPORT; } $thread_action = array(); $thread_action['pdf']['image'] = newbb_displayImage('pdf', _MD_PDF); $thread_action['pdf']['link'] = "makepdf.php?type=post&pageid=0&scale=0.66"; $thread_action['pdf']['name'] = _MD_PDF; $thread_action['pdf']['target'] = '_blank'; $thread_action['print']['image'] = newbb_displayImage('printer', _MD_PRINT); $thread_action['print']['link'] = "print.php?form=2&forum=" . $forum_id . "&topic_id=" . $topic_id; $thread_action['print']['name'] = _MD_PRINT; $thread_action['print']['target'] = '_blank'; $post = array('post_id' => $post_id, 'post_parent_id' => $this->getVar('pid'), 'post_date' => newbb_formatTimestamp($this->getVar('post_time')), 'post_image' => $post_image, 'post_title' => $this->getVar('subject'), 'post_text' => $post_text, 'post_attachment' => $post_attachment, 'post_edit' => $this->displayPostEdit(), 'post_no' => $post_no, 'post_signature' => $this->getVar('attachsig') ? @$poster["signature"] : "", 'poster_ip' => $isadmin && $xoopsModuleConfig['show_ip'] ? long2ip($this->getVar('poster_ip')) : "", 'thread_action' => $thread_action, 'thread_buttons' => $thread_buttons, 'mod_buttons' => $mod_buttons, 'poster' => $poster, 'post_permalink' => '<a href="viewtopic.php?post_id=' . $post_id . '"></a>'); unset($thread_buttons); unset($mod_buttons); unset($eachposter); return $post; }
<?php /** * CBB 4.0, or newbb, the forum module for XOOPS project * * @copyright The XOOPS Project http://xoops.sf.net * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @author Taiwen Jiang (phppp or D.J.) <*****@*****.**> * @since 4.00 * @version $Id $ * @package module::newbb */ if (!defined('XOOPS_ROOT_PATH')) { exit; } defined("NEWBB_FUNCTIONS_INI") || (include dirname(__FILE__) . "/functions.ini.php"); define("NEWBB_FUNCTIONS_LOADED", TRUE); if (!defined("NEWBB_FUNCTIONS")) { define("NEWBB_FUNCTIONS", 1); load_functions(); mod_loadFunctions("image", "newbb"); mod_loadFunctions("user", "newbb"); mod_loadFunctions("render", "newbb"); mod_loadFunctions("forum", "newbb"); mod_loadFunctions("session", "newbb"); mod_loadFunctions("stats", "newbb"); }
function xoops_module_update_art_v097(&$module) { mod_loadFunctions("recon"); return art_updateTag($module->getVar("mid")); }
if ($key != $menumode) { $menumode_other[] = array("title" => $val, "link" => $menu_url . $key); } } $newbb_module_header = ''; $newbb_module_header .= '<link rel="alternate" type="application/rss+xml" title="' . $xoopsModule->getVar("name") . '" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', "n") . '/rss.php" />'; if (!empty($xoopsModuleConfig['pngforie_enabled'])) { $newbb_module_header .= '<style type="text/css">img {behavior:url("include/pngbehavior.htc");}</style>'; } $newbb_module_header .= ' <link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname") . '/templates/style.css" /> <script type="text/javascript">var toggle_cookie="' . $forumCookie['prefix'] . 'G' . '";</script> <script src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname") . '/include/js/newbb_toggle.js" type="text/javascript"></script> '; if ($menumode == 2) { $newbb_module_header .= ' <link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname") . 'templates/newbb_menu_hover.css" /> <style type="text/css">body {behavior:url("include/newbb.htc");}</style> '; } if ($menumode == 1) { $newbb_module_header .= ' <link rel="stylesheet" type="text/css" href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar("dirname") . 'templates/newbb_menu_click.css" /> <script src="include/js/newbb_menu_click.js" type="text/javascript"></script> '; } $xoops_module_header = $newbb_module_header; // for cache hack if (!empty($xoopsModuleConfig["welcome_forum"]) && is_object($xoopsUser) && !$xoopsUser->getVar('posts')) { mod_loadFunctions("welcome", "newbb"); }
if (!defined('XOOPS_ROOT_PATH')) { exit; } include dirname(__FILE__) . "/vars.php"; define($GLOBALS["artdirname"] . "_FUNCTIONS_LOADED", TRUE); if (!defined("ART_FUNCTIONS")) { define("ART_FUNCTIONS", 1); load_functions(); mod_loadFunctions("parse", $GLOBALS["artdirname"]); mod_loadFunctions("url", $GLOBALS["artdirname"]); mod_loadFunctions("render", $GLOBALS["artdirname"]); mod_loadFunctions("user", $GLOBALS["artdirname"]); mod_loadFunctions("rpc", $GLOBALS["artdirname"]); mod_loadFunctions("time", $GLOBALS["artdirname"]); //mod_loadFunctions("cache", $GLOBALS["artdirname"]); mod_loadFunctions("recon", $GLOBALS["artdirname"]); /** * Function to display messages * * @var mixed $messages */ function art_message($message) { return mod_message($message); } // Backword compatible function art_load_lang_file($filename, $module = '', $default = 'english') { if (empty($module) && is_object($GLOBALS["xoopsModule"])) { $module = $GLOBALS["xoopsModule"]->getVar("dirname"); }
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // 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 // // ------------------------------------------------------------------------ // // Author: Kazumi Ono (AKA onokazu) // // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ // // Project: The XOOPS Project // // ------------------------------------------------------------------------- // include 'admin_header.php'; include XOOPS_ROOT_PATH . "/class/xoopstree.php"; include_once XOOPS_ROOT_PATH . "/class/pagenav.php"; mod_loadFunctions("forum", "newbb"); mod_loadFunctions("render", "newbb"); load_functions("cache"); xoops_cp_header(); $op = !empty($_GET['op']) ? $_GET['op'] : (!empty($_POST['op']) ? $_POST['op'] : ""); $forum_id = intval(!empty($_GET['forum']) ? $_GET['forum'] : (!empty($_POST['forum']) ? $_POST['forum'] : 0)); $forum_handler =& xoops_getmodulehandler('forum', 'newbb'); switch ($op) { case 'moveforum': loadModuleAdminMenu(2, ""); if (!empty($_POST['dest_forum'])) { $dest = $_POST['dest_forum']; if ($dest > 0) { $pid = intval($dest); $forum_dest =& $forum_handler->get($pid); $cid = $forum_dest->getVar("cat_id"); unset($forum_dest);
case "delete": $report_ids = $_POST['report_id']; foreach ($report_ids as $rid => $value) { if (!$value) { continue; } if ($report_obj = $report_handler->get($rid)) { $report_handler->delete($report_obj); } } redirect_header("admin_report.php?item={$item}" . (empty($start) ? "" : "&start={$start}"), 1); break; case "default": default: include_once XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar("dirname", "n") . "/class/xoopsformloader.php"; mod_loadFunctions("user", "newbb"); if ($item != 'processed') { $process_result = 0; $item_other = 'processed'; $title_other = _AM_NEWBB_PROCESSEDREPORT; $extra = _AM_NEWBB_REPORTEXTRA; } else { $process_result = 1; $item_other = 'process'; $title_other = _AM_NEWBB_PROCESSREPORT; $extra = _DELETE; } $limit = 10; loadModuleAdminMenu(6, _AM_NEWBB_REPORTADMIN); echo "<fieldset><legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_REPORTADMIN . "</legend>"; echo "<br />";
/** * get formatted expiring time of the topic * * @param string $format format of time * @return string */ function getExpire($format = "") { mod_loadFunctions("time", $GLOBALS["artdirname"]); $time = art_formatTimestamp($this->getVar("top_expire"), $format); return $time; }
function b_newbb_author_edit($options) { mod_loadFunctions("forum", "newbb"); $form = _MB_NEWBB_CRITERIA . "<select name='options[0]'>"; $form .= "<option value='post'"; if ($options[0] == "post") { $form .= " selected='selected' "; } $form .= ">" . _MB_NEWBB_CRITERIA_POST . "</option>"; $form .= "<option value='topic'"; if ($options[0] == "topic") { $form .= " selected='selected' "; } $form .= ">" . _MB_NEWBB_CRITERIA_TOPIC . "</option>"; $form .= "<option value='digest'"; if ($options[0] == "digest") { $form .= " selected='selected' "; } $form .= ">" . _MB_NEWBB_CRITERIA_DIGESTS . "</option>"; $form .= "<option value='sticky'"; if ($options[0] == "sticky") { $form .= " selected='selected' "; } $form .= ">" . _MB_NEWBB_CRITERIA_STICKYS . "</option>"; $form .= "</select>"; $form .= "<br />" . _MB_NEWBB_DISPLAY . "<input type='text' name='options[1]' value='" . $options[1] . "' />"; $form .= "<br />" . _MB_NEWBB_TIME . "<input type='text' name='options[2]' value='" . $options[2] . "' />"; $form .= "<br /> <small>" . _MB_NEWBB_TIME_DESC . "</small>"; $form .= "<br />" . _MB_NEWBB_DISPLAYMODE . "<input type='radio' name='options[3]' value='0'"; if ($options[3] == 0) { $form .= " checked='checked'"; } $form .= " /> " . _MB_NEWBB_DISPLAYMODE_COMPACT . "<input type='radio' name='options[3]' value='1'"; if ($options[3] == 1) { $form .= " checked='checked'"; } $form .= " /> " . _MB_NEWBB_DISPLAYMODE_LITE; $form .= "<br />" . _MB_NEWBB_INDEXNAV . "<input type=\"radio\" name=\"options[4]\" value=\"1\""; if ($options[4] == 1) { $form .= " checked=\"checked\""; } $form .= " />" . _YES . "<input type=\"radio\" name=\"options[4]\" value=\"0\""; if ($options[4] == 0) { $form .= " checked=\"checked\""; } $form .= " />" . _NO; $form .= "<br /><br />" . _MB_NEWBB_FORUMLIST; $options_forum = array_filter(array_slice($options, 5), "b_newbb_array_filter"); // get allowed forums $isAll = count($options_forum) == 0 || empty($options_forum[0]) ? true : false; $form .= "<br /> <select name=\"options[]\" multiple=\"multiple\">"; $form .= "<option value=\"0\" "; if ($isAll) { $form .= " selected=\"selected\""; } $form .= ">" . _ALL . "</option>"; $form .= newbb_forumSelectBox($options_forum); $form .= "</select><br />"; return $form; }
if (intval(@$rates[$key]["art_rates"]) != $articles_obj[$key]->getVar("art_rates")) { $articles_obj[$key]->setVar("art_rates", intval(@$rates[$key]["art_rates"]), true); } if (intval(@$rates[$key]["art_rating"]) != $articles_obj[$key]->getVar("art_rating")) { $articles_obj[$key]->setVar("art_rating", intval(@$rates[$key]["art_rating"]), true); } if (intval(@$tbs[$key]) != $articles_obj[$key]->getVar("art_trackbacks")) { $articles_obj[$key]->setVar("art_trackbacks", intval(@$tbs[$key]), true); } $article_handler->insert($articles_obj[$key]); } redirect_header("admin.synchronization.php?type={$type}&start=" . ($start + $limit) . "&limit={$limit}", 2, art_constant("AM_SYNC_SYNCING") . " {$count}: {$start} - " . ($start + $limit)); exit; case "misc": default: mod_loadFunctions("recon", $xoopsModule->getVar("dirname", "n")); art_synchronization(); break; } $form = '<fieldset><legend style="font-weight: bold; color: #900;">' . art_constant("AM_SYNC_TITLE") . '</legend>'; $form .= '<form action="admin.synchronization.php" method="get">'; $form .= '<div style="padding: 10px 2px;">'; $form .= '<h2>' . art_constant("AM_SYNC_CATEGORY") . '</h2>'; $form .= '<input type="hidden" name="type" value="category">'; $form .= art_constant("AM_SYNC_ITEMS") . '<input type="text" name="limit" value="20"> '; $form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; $form .= '</div>'; $form .= '</form>'; $form .= '<form action="admin.synchronization.php" method="get">'; $form .= '<div style="padding: 10px 2px;">'; $form .= '<h2>' . art_constant("AM_SYNC_ARTICLE") . '</h2>';
function xoops_module_install_newbb(&$module) { /* Create a test category */ $category_handler = xoops_getmodulehandler('category', $module->getVar("dirname")); $category = $category_handler->create(); $category->setVar('cat_title', _MI_NEWBB_INSTALL_CAT_TITLE, true); $category->setVar('cat_image', "", true); $category->setVar('cat_description', _MI_NEWBB_INSTALL_CAT_DESC, true); $category->setVar('cat_url', "http://www.myxoops.org myXOOPS", true); if (!($cat_id = $category_handler->insert($category))) { return true; } /* Create a forum for test */ $forum_handler = xoops_getmodulehandler('forum', $module->getVar("dirname")); $forum = $forum_handler->create(); $forum->setVar('forum_name', _MI_NEWBB_INSTALL_FORUM_NAME, true); $forum->setVar('forum_desc', _MI_NEWBB_INSTALL_FORUM_DESC, true); $forum->setVar('forum_moderator', array()); $forum->setVar('parent_forum', 0); $forum->setVar('cat_id', $cat_id); $forum->setVar('attach_maxkb', 100); $forum->setVar('attach_ext', "zip|jpg|gif|png"); $forum->setVar('hot_threshold', 20); $forum_id = $forum_handler->insert($forum); /* Set corresponding permissions for the category and the forum */ $module_id = $module->getVar("mid"); $gperm_handler = xoops_gethandler("groupperm"); $groups_view = array(XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS, XOOPS_GROUP_ANONYMOUS); $groups_post = array(XOOPS_GROUP_ADMIN, XOOPS_GROUP_USERS); $post_items = array('post', 'reply', 'edit', 'delete', 'addpoll', 'vote', 'attach', 'noapprove', 'type'); foreach ($groups_view as $group_id) { $gperm_handler->addRight("category_access", $cat_id, $group_id, $module_id); $gperm_handler->addRight("forum_access", $forum_id, $group_id, $module_id); $gperm_handler->addRight("forum_view", $forum_id, $group_id, $module_id); } foreach ($groups_post as $group_id) { foreach ($post_items as $item) { $gperm_handler->addRight("forum_" . $item, $forum_id, $group_id, $module_id); } } /* Create a test post */ mod_loadFunctions("user", "newbb"); $post_handler =& xoops_getmodulehandler('post', $module->getVar("dirname")); $forumpost =& $post_handler->create(); $forumpost->setVar('poster_ip', newbb_getIP()); $forumpost->setVar('uid', $GLOBALS["xoopsUser"]->getVar("uid")); $forumpost->setVar('approved', 1); $forumpost->setVar('forum_id', $forum_id); $forumpost->setVar('subject', _MI_NEWBB_INSTALL_POST_SUBJECT, true); $forumpost->setVar('dohtml', 1); $forumpost->setVar('dosmiley', 1); $forumpost->setVar('doxcode', 1); $forumpost->setVar('dobr', 1); $forumpost->setVar('icon', "", true); $forumpost->setVar('attachsig', 1); $forumpost->setVar('post_time', time()); $forumpost->setVar('post_text', _MI_NEWBB_INSTALL_POST_TEXT, true); $postid = $post_handler->insert($forumpost); return true; }