function Execute(&$template, $request, &$dba, &$session, &$user) { global $_DATASTORE, $_USERGROUPS; /* Set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_BLOGS')); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Get the current forum/category */ $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($request['id'])); if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } if ($forum['is_link'] == 1) { if ($forum['is_forum'] == 1) { if ($forum['row_right'] - $forum['row_left'] > 0) { header("Location: viewforum.php?id=" . intval($forum['id'])); } } if (!isset($forum['link_href']) || $forum['link_href'] == '') { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_INVALIDLINKFORUM')); return TRUE; } $dba->executeUpdate("UPDATE " . FORUMS . " SET link_redirects=link_redirects+1 WHERE forum_id=" . intval($forum['id'])); header("Location: " . $forum['link_href']); } else { header("Location: viewforum.php?id=" . intval($forum['id'])); } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { if ($user['perms'] >= ADMIN) { $template->setVar('current_location', $template->getVar('L_ADMINISTRATION')); } else { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFilename('forum_base.html'); $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS'), FALSE); } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { if (is_a($session['user'], 'Member') && $user['perms'] >= ADMIN) { $template->setFile('content', 'admin/admin_head.html'); $template->hide('copyright'); } else { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFile('content', 'login_form.html'); $template->show('no_perms'); return TRUE; } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('cotent', $template->getVar('L_INVALIDFORUMASREAD'), FALSE); } else { $forum = $dba->getRow("SELECT * FROM " . INFO . " WHERE id = " . intval($request['id'])); if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('cotent', $template->getVar('L_INVALIDFORUMASREAD'), FALSE); } else { if ($forum['row_type'] & CATEGORY) { /* Set the Breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_MARKFORUMSREAD'), $forum['row_left'], $forum['row_right']); /* Get the forums of this Category */ $result = $dba->executeQuery("SELECT * FROM " . INFO . " WHERE row_left > " . $forum['row_left'] . " AND row_right < " . $forum['row_right'] . " AND row_type = " . FORUM); $forums = isset($request['forums']) && $request['forums'] != null && $request['forums'] != '' ? iif(!unserialize($request['forums']), array(), nserialize($request['forums'])) : array(); /* Loop through the forums */ while ($result->next()) { $temp = $result->current(); $forums[$temp['id']] = array(); } $forums = serialize($forums); /* Cache some info to set a cookie on the next refresh */ bb_setcookie_cache('forums', $forums, time() + ini_get('session.gc_maxlifetime')); $template->setInfo('content', sprintf($template->getVar('L_MARKEDFORUMSREADCAT'), $forum['name']), TRUE); $template->setRedirect('viewforum.php?id=' . $forum['id'], 3); } else { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_INVALIDFORUMASREAD'), FALSE); } } } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS, $_DATASTORE; /* Check the request ID */ if (!isset($request['forum_id']) || !$request['forum_id'] || intval($request['forum_id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($request['forum_id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Make sure the we are trying to edit in a forum */ if (!($forum['row_type'] & FORUM)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_CANTEDITTONONFORUM'), FALSE); return TRUE; } if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } /* Get our topic */ $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } if (!isset($request['name']) || $request['name'] == '') { $name = $topic['name']; } else { $name = $request['name']; } if (!is_moderator($user, $forum)) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFile('content', 'login_form.html'); $template->show('no_perms'); return TRUE; } if ($topic['poster_id'] == $user['id']) { if ($user['perms'] < get_map($user, 'topics', 'can_edit', array('forum_id' => $forum['id']))) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFile('content', 'login_form.html'); $template->show('no_perms'); return TRUE; } } else { if ($user['perms'] < get_map($user, 'other_topics', 'can_edit', array('forum_id' => $forum['id']))) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFile('content', 'login_form.html'); $template->show('no_perms'); return TRUE; } } $update_a =& $dba->prepareStatement("UPDATE " . INFO . " SET name=? WHERE id=?"); $update_b =& $dba->prepareStatement("UPDATE " . TOPICS . " SET edited_time=?,edited_username=?,edited_userid=? WHERE topic_id=?"); $update_a->setString(1, $name); $update_a->setInt(2, $topic['id']); $update_b->setInt(1, time()); $update_b->setString(2, $user['name']); $update_b->setInt(3, $user['id']); $update_b->setInt(4, $topic['id']); $update_a->executeUpdate(); $update_b->executeUpdate(); if ($forum['topic_id'] == $topic['id']) { $update_c =& $dba->prepareStatement("UPDATE " . FORUMS . " SET topic_name=? WHERE forum_id=?"); $update_c->setString(1, $name); $update_c->setInt(2, $forum['id']); $update_c->executeUpdate(); } if ($forum['post_id'] == $topic['id']) { $update_d =& $dba->prepareStatement("UPDATE " . FORUMS . " SET post_name=? WHERE forum_id=?"); $update_d->setString(1, $name); $update_d->setInt(2, $forum['id']); $update_d->executeUpdate(); } $template = BreadCrumbs($template, $template->getVar('L_EDITTOPIC'), $forum['row_left'], $forum['row_right']); $template->setInfo('content', sprintf($template->getVar('L_UPDATEDTOPIC'), $topic['name'])); $template->setRedirect(referer(), 3); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_URL, $_QUERYPARAMS, $_USERGROUPS, $_SESS, $_ALLFORUMS; if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Get the current forum/category */ $forum = $_ALLFORUMS[$request['id']]; $query = $forum['row_type'] & FORUM ? "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($request['id']) : "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['category'] . " FROM " . CATEGORIES . " c LEFT JOIN " . INFO . " i ON c.category_id = i.id WHERE i.id = " . intval($request['id']); $forum = $dba->getRow($query); if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } if ($forum['row_type'] == FORUM && @$forum['is_link'] == 1) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']); $template->setInfo('content', $template->getVar('L_REDIRECTING')); if ($forum['link_show_redirects'] == 1) { $template->setRedirect('redirect.php?id=' . $forum['id'], 3); } else { $template->setRedirect($forum['link_href'], 3); } return TRUE; } /* Set the extra SQL query fields to check */ $extra = " AND s.location_file = '" . $dba->Quote($_URL->file) . "' AND s.location_id = " . intval($forum['id']); $forum_can_view = $forum['row_type'] & CATEGORY ? get_map($user, 'categories', 'can_view', array()) : get_map($user, 'forums', 'can_view', array()); $expired = time() - ini_get('session.gc_maxlifetime'); $num_online_total = $dba->getValue("SELECT COUNT(s.id) as num_online_total FROM " . SESSIONS . " s WHERE s.seen >= {$expired} {$extra}"); /* If there are more than 0 people browsing the forum, display the stats */ if ($num_online_total > 0 && $forum_can_view <= $user['perms'] && ($forum['row_type'] & CATEGORY || $forum['row_type'] & FORUM)) { $users_browsing =& new OnlineUsersIterator($extra); /* Set the users browsing list */ $template->setList('users_browsing', $users_browsing); $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total); $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible']; $element = $forum['row_type'] & CATEGORY ? 'L_USERSBROWSINGCAT' : 'L_USERSBROWSINGFORUM'; $template->setVar('num_online_members', $stats['num_online_members']); $template->setVar('users_browsing', $template->getVar($element)); $template->setVar('online_stats', sprintf($template->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible'])); /* Set the User's Browsing file */ $template->setFile('users_browsing', 'users_browsing.html'); $groups = array(); /* Set the usergroups legend list */ foreach ($_USERGROUPS as $group) { if ($group['display_legend'] == 1) { $groups[] = $group; } } $groups =& new FAArrayIterator($groups); $template->setList('usergroups_legend', $groups); } if ($forum_can_view > $user['perms']) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']); $template->setInfo('content', $template->getVar('L_PERMCANTVIEW'), FALSE); return TRUE; } /* Set the breadcrumbs bit */ $template = BreadCrumbs($template, NULL, $forum['row_left'], $forum['row_right']); /* Set all of the category/forum info to the template */ $template->setVarArray($forum); /* If we are looking at a category */ if ($forum['row_type'] & CATEGORY) { if (get_map($user, 'categories', 'can_view', array()) > $user['perms']) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']); $template->setInfo('content', $template->getVar('L_PERMCANTVIEW')); return TRUE; } /* Set the proper query params */ $query_params = $_QUERYPARAMS['info'] . $_QUERYPARAMS['category']; /* Set the Categories list */ $categories =& new CategoriesIterator("SELECT {$query_params} FROM " . INFO . " i LEFT JOIN " . CATEGORIES . " c ON c.category_id = i.id WHERE i.row_type = " . CATEGORY . " AND i.row_left = " . $forum['row_left'] . " AND i.row_right = " . $forum['row_right'] . " AND i.id = " . $forum['id'] . " ORDER BY i.row_order ASC"); $template->setList('categories', $categories); /* Hide the welcome message at the top of the forums.html template */ $template->hide('welcome_msg'); /* Show the forum status icons */ $template->show('forum_status_icons'); /* Show the 'Mark these forums Read' link */ $template->show('mark_these_forums'); /* Set the forums template to content variable */ $template->setFile('content', 'forums.html'); /* If we are looking at a forum */ } else { if ($forum['row_type'] & FORUM) { /* Add the forum info to the template */ foreach ($forum as $key => $val) { $template->setVar('forum_' . $key, $val); } /* If this forum has sub-forums */ if (isset_forum_cache_item('subforums', $forum['id']) && $forum['subforums'] == 1) { /* Cache this forum as having subforums */ set_forum_cache_item('subforums', 1, $forum['id']); /* Show the table that holds the subforums */ $template->show('subforums'); /* Set the proper query params */ $query_params = $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum']; /* Set the sub-forums list */ $template->setList('subforums', new ForumsIterator("SELECT {$query_params} FROM " . INFO . " i LEFT JOIN " . FORUMS . " f ON f.forum_id = i.id WHERE i.row_left > " . $forum['row_left'] . " AND i.row_right < " . $forum['row_right'] . " AND i.row_type = " . FORUM . " AND i.parent_id = " . $forum['id'] . " ORDER BY i.row_order ASC")); $template->setFile('content', 'subforums.html'); } if (get_map($user, 'topics', 'can_view', array('forum_id' => $forum['id'])) > $user['perms']) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']); $template->setInfo('content_extra', $template->getVar('L_CANTVIEWFORUMTOPICS'), FALSE); return TRUE; } /** * Forum settings */ /* Set the topics template to the content variable */ $template->setFile('content_extra', 'topics.html'); /* Set what this user can/cannot do in this forum */ $template->setVar('forum_user_topic_options', sprintf($template->getVar('L_FORUMUSERTOPICPERMS'), iif(get_map($user, 'topics', 'can_add', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')), iif(get_map($user, 'topics', 'can_edit', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')), iif(get_map($user, 'topics', 'can_del', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')), iif(get_map($user, 'attachments', 'can_add', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')))); $template->setVar('forum_user_reply_options', sprintf($template->getVar('L_FORUMUSERREPLYPERMS'), iif(get_map($user, 'replies', 'can_add', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')), iif(get_map($user, 'replies', 'can_edit', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')), iif(get_map($user, 'replies', 'can_del', array('forum_id' => $forum['id'])) > $user['perms'], $template->getVar('L_CANNOT'), $template->getVar('L_CAN')))); /* Create an array with all of the possible sort orders we can have */ $sort_orders = array('name', 'reply_time', 'num_replies', 'views', 'reply_uname', 'rating'); /** * Pagination */ /* Create the Pagination */ $resultsperpage = $forum['topicsperpage']; $num_results = $forum['topics']; $perpage = isset($request['limit']) && ctype_digit($request['limit']) && intval($request['limit']) > 0 ? intval($request['limit']) : $resultsperpage; $num_pages = ceil($num_results / $perpage); $page = isset($request['page']) && ctype_digit($request['page']) && intval($request['page']) > 0 ? intval($request['page']) : 1; $pager =& new TPL_Paginator($_URL, $num_results, $page, $perpage); if ($num_results > $perpage) { $template->setPager('topics_pager', $pager); } /* Get the topics for this forum */ $daysprune = isset($request['daysprune']) && ctype_digit($request['daysprune']) ? iif($request['daysprune'] == -1, 0, intval($request['daysprune'])) : 30; $sortorder = isset($request['order']) && ($request['order'] == 'ASC' || $request['order'] == 'DESC') ? $request['order'] : 'DESC'; $sortedby = isset($request['sort']) && in_array($request['sort'], $sort_orders) ? $request['sort'] : 'created'; $start = ($page - 1) * $perpage; if ($forum['topics'] > 0) { /** * Topic Setting */ /* get the topics */ $topics =& $dba->prepareStatement("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.created>=? AND t.is_draft=0 AND t.queue = 0 AND t.display = 1 AND i.row_type=" . TOPIC . " AND t.forum_id = " . intval($forum['id']) . " AND (t.topic_type <> " . TOPIC_GLOBAL . " AND t.topic_type <> " . TOPIC_ANNOUNCE . " AND t.topic_type <> " . TOPIC_STICKY . " AND t.is_feature = 0) ORDER BY {$sortedby} {$sortorder} LIMIT ?,?"); /* Set the query values */ $topics->setInt(1, $daysprune * (3600 * 24)); $topics->setInt(2, $start); $topics->setInt(3, $perpage); /* Execute the query */ $result =& $topics->executeQuery(); /* Apply the topics iterator */ $it =& new TopicsIterator($result, &$session, $template->getVar('IMG_DIR'), $forum); $template->setList('topics', $it); /** * Get announcement/global topics */ if ($page == 1) { $announcements =& $dba->executeQuery("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE t.is_draft=0 AND t.queue = 0 AND t.display = 1 AND i.row_type=" . TOPIC . " AND t.forum_id = " . intval($forum['id']) . " AND (t.topic_type = " . TOPIC_GLOBAL . " OR t.topic_type = " . TOPIC_ANNOUNCE . ") ORDER BY i.created DESC"); if ($announcements->numrows() > 0) { $a_it =& new TopicsIterator($announcements, &$session, $template->getVar('IMG_DIR'), $forum); $template->setList('announcements', $a_it); } } /** * Get sticky/feature topics */ $importants =& $dba->executeQuery("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE t.is_draft=0 AND t.queue = 0 AND t.display = 1 AND i.row_type=" . TOPIC . " AND t.forum_id = " . intval($forum['id']) . " AND (t.topic_type <> " . TOPIC_GLOBAL . " AND t.topic_type <> " . TOPIC_ANNOUNCE . ") AND (t.topic_type = " . TOPIC_STICKY . " OR t.is_feature = 1) ORDER BY i.created DESC"); if ($importants->numrows() > 0) { $i_it =& new TopicsIterator($importants, &$session, $template->getVar('IMG_DIR'), $forum); $template->setList('importants', $i_it); } /* Outside valid page range, redirect */ if (!$pager->hasPage($page) && $num_results > $resultsperpage) { $template->setVar('topics_message', $template->getVar('L_PASTPAGELIMIT')); $template->setRedirect('viewforum.php?id=' . $forum['id'] . '&limit=' . $perpage . '&page=' . $num_pages, 3); return TRUE; } } /* If there are no topics, set the right messageto display */ if ($forum['topics'] <= 0) { $template->show('no_topics'); $template->setVar('topics_message', iif($daysprune == 0, $template->getVar('L_NOPOSTSINFORUM'), sprintf($template->getVar('L_FORUMNOPOSTSSINCE'), $daysprune))); return TRUE; } /** * Moderator functions */ $template->setVar('modpanel', 0); if (is_moderator($user, $forum)) { $template->setVar('modpanel', 1); } } else { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } } /* Add the cookies for this forum's topics */ bb_execute_topiccache(); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { /* Create the ancestors bar (if we run into any trouble */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); if (is_a($session['user'], 'Guest')) { $template->setFile('content', 'remindme_form.html'); return TRUE; } else { $template->setInfo('content', $template->getVar('L_CANTBELOGGEDIN'), FALSE); } return FALSE; }
$scripts = $Core->HTML->MakeElement('script', array('type' => 'text/javascript'), 'var MY_URL = "' . FULL_URL . '";' . "\n" . 'var ADMIN_URL = "' . FULL_URL . '";' . "\n"); $scripts .= $Core->HTML->MakeElement('script', array('type' => 'text/javascript'), 'var SITE_PATH = "' . SITE . '/";'); # ################################################################################### # Get the Admin skin # ################################################################################### $html = GetAdminTemplate($mgr); # ################################################################################### # Load any content buffered by the current manager # ################################################################################### LoadBuffers($html); # ################################################################################### # Merge all output with the current skin # ################################################################################### ReplaceContentToken(TOKEN_PAGE_TITLE, SB_SITE_NAME . ' :: ' . ucwords($mgr), $html); ReplaceContentToken(TOKEN_SCRIPTS, $scripts, $html); ReplaceContentToken(TOKEN_ADMIN_NAV, BreadCrumbs(), $html); ReplaceContentToken(TOKEN_DASHBOARD, $dashboard, $html); ReplaceContentToken(TOKEN_CONTENT, $content, $html); ReplaceContentToken(TOKEN_SB_VERSION, SB_VERSION, $html); ReplaceContentToken(TOKEN_SB_NAME, SB_PROD_NAME, $html); $html = str_replace('{doc:lang}', ' lang="' . SB_LANGUAGE . '"', $html); if (file_exists(INFO_IFRAME_SRC)) { ReplaceContentToken(TOKEN_INFO_IFRAME, INFO_IFRAME_TAG, $html); } if ($Core->GetVar($_GET, VAR_MGR, 'login') != 'login') { ReplaceContentToken(TOKEN_LINK_LOGOUT, LINK_LOGOUT, $html); ReplaceContentToken(TOKEN_LINK_INBOX, str_replace(TOKEN_UNREAD_MESSAGES, ' (' . $Core->GetUnreadMailCount() . ')', LINK_INBOX), $html); $Core->editor('.wymeditor, #story_content, .editor', $html, isset($config['site_editor']) ? $config['site_editor'] : 'wymeditor'); } ReplaceContentToken(TOKEN_ANALYTICS, null, $html); # ###################################################################################
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; /** * Error checking on this member */ if (!isset($request['id']) || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_USERDOESNTEXIST'), TRUE); return TRUE; } $member = $dba->getRow("SELECT " . $_QUERYPARAMS['user'] . $_QUERYPARAMS['userinfo'] . " FROM " . USERS . " u LEFT JOIN " . USERINFO . " ui ON u.id = ui.user_id WHERE u.id = " . intval($request['id'])); if (!$member || !is_array($member) || empty($member)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_USERDOESNTEXIST'), TRUE); return TRUE; } foreach ($member as $key => $val) { $template->setVar('member_' . $key, $val); } /** * Set the info we need */ $template = BreadCrumbs($template, $template->getVar('L_FINDPOSTS')); $template->setFile('content', 'user_posts.html'); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; $next = FALSE; $prev = FALSE; if (isset($request['next']) && intval($request['next']) == 1) { $next = TRUE; } if (isset($request['prev']) && intval($request['prev']) == 1) { $prev = TRUE; } /** * Error Checking */ if (!isset($request['id']) || !$request['id'] || intval($request['id']) <= 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDPOST')); $template->setInfo('content', $template->getVar('L_POSTDOESNTEXIST'), FALSE); } $post = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . " FROM " . INFO . " i WHERE i.id = " . intval($request['id'])); if (!is_array($post) || !$post || empty($post)) { if ($next || $prev) { header("Location: " . referer()); } /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDPOST')); $template->setInfo('content', $template->getVar('L_POSTDOESNTEXIST'), FALSE); } if ($post['row_type'] != TOPIC && $post['row_type'] != REPLY) { if ($next || $prev) { header("Location: " . referer()); } /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDPOST')); $template->setInfo('content', $template->getVar('L_POSTDOESNTEXIST'), FALSE); } /* If this is a topic */ if ($post['row_type'] == TOPIC) { /** * We don't error check here because that would just be redundant. There is already * error checking in viewtopic.php, and it will make sure that this isn't a draft, * its info exits, etc. */ header("Location: viewtopic.php?id=" . $post['id']); /* If this is a reply */ } else { if ($next || $prev) { header("Location: " . referer()); } $reply = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON i.id=r.reply_id WHERE r.reply_id = " . intval($post['id'])); if (!$reply || !is_array($reply) || empty($reply)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDPOST')); $template->setInfo('content', $template->getVar('L_POSTDOESNTEXIST'), FALSE); return TRUE; } $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($reply['topic_id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($topic['forum_id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Make sure the we are trying to delete from a forum */ if (!($forum['row_type'] & FORUM)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } $num_replies = @intval(($topic['row_right'] - $topic['row_left'] - 1) / 2); /* If the number of replies on this topic is greater than the posts per page for this forum */ if ($num_replies > $forum['postsperpage']) { $whereinline = $dba->getValue("SELECT COUNT(r.reply_id) FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON i.id = r.reply_id WHERE r.topic_id = " . intval($reply['topic_id']) . " AND i.created < " . intval($reply['created']) . " ORDER BY i.created ASC"); $page = ceil($whereinline / $forum['postsperpage']); $page = $page <= 0 ? 1 : $page; header("Location: viewtopic.php?id=" . $topic['id'] . "&page=" . intval($page) . "&limit=" . $forum['postsperpage'] . "&order=ASC&sort=created&daysprune=0#" . $post['id']); exit; } else { header("Location: viewtopic.php?id=" . $topic['id'] . "#" . $post['id']); exit; } } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; /* Check the request ID */ if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); return $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); } $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($request['id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Make sure the we are trying to post into a forum */ if (!($forum['row_type'] & FORUM)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_CANTPOSTTOCATEGORY'), FALSE); return TRUE; } $is_poll = isset($request['poll']) && intval($request['poll']) == 1 ? TRUE : FALSE; $perm = $is_poll ? 'polls' : 'topics'; /* Do we have permission to post to this forum? */ if ($user['perms'] < get_map($user, $perm, 'can_add', array('forum_id' => $forum['id']))) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_PERMCANTPOST'), FALSE); return TRUE; } /* Prevent post flooding */ $last_topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE t.poster_ip = '" . USER_IP . "' ORDER BY i.created DESC LIMIT 1"); $last_reply = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON r.reply_id = i.id WHERE r.poster_ip = '" . USER_IP . "' ORDER BY i.created DESC LIMIT 1"); if (is_array($last_topic) && !empty($last_topic)) { if (intval($last_topic['created']) + POST_IMPULSE_LIMIT > time()) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_MUSTWAITSECSTOPOST'), TRUE); return TRUE; } } if (is_array($last_reply) && !empty($last_reply)) { if (intval($last_reply['created']) + POST_IMPULSE_LIMIT > time()) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_MUSTWAITSECSTOPOST'), TRUE); return TRUE; } } /** * Start setting useful template information */ if ($is_poll) { $template->setVar('poll', 1); } /* Get and set the emoticons and post icons to the template */ $emoticons =& $dba->executeQuery("SELECT * FROM " . EMOTICONS . " WHERE clickable = 1"); $posticons =& $dba->executeQuery("SELECT * FROM " . POSTICONS); $template->setList('emoticons', $emoticons); $template->setList('posticons', $posticons); $template->setVar('emoticons_per_row', $template->getVar('smcolumns')); $template->setVar('emoticons_per_row_remainder', $template->getVar('smcolumns') - 1); $template = topic_post_options($template, $user, $forum); /* Set the forum info to the template */ foreach ($forum as $key => $val) { $template->setVar('forum_' . $key, $val); } $template->setVar('newtopic_action', 'newtopic.php?act=posttopic'); /** * Get topic drafts for this forum */ $drafts = $dba->executeQuery("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE t.forum_id = " . intval($forum['id']) . " AND t.is_draft = 1 AND t.poster_id = " . intval($user['id'])); if ($drafts->numrows() > 0) { $template->show('load_button'); if (isset($request['load_drafts']) && $request['load_drafts'] == 1) { $template->hide('load_button'); $template->setFile('drafts', 'post_drafts.html'); $template->setList('drafts', $drafts); } if (isset($request['draft']) && intval($request['draft']) != 0) { /* Get our topic */ $draft = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['draft']) . " AND t.is_draft = 1 AND t.poster_id = " . intval($user['id'])); if (!$draft || !is_array($draft) || empty($draft)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDDRAFT')); $template->setInfo('content', $template->getVar('L_DRAFTDOESNTEXIST'), FALSE); return TRUE; } $template->setVar('newtopic_action', 'newtopic.php?act=postdraft'); $template->setInfo('drafts', $template->getVar('L_DRAFTLOADED'), FALSE, '<br />'); /* Turn the draft text back into bbcode */ $bbcode = new BBCodex($user, $draft['body_text'], $forum['id'], TRUE, TRUE, TRUE, TRUE); $draft['body_text'] = $bbcode->revert(); $template->hide('save_draft'); $template->hide('load_button'); $template->show('edit_topic'); $template->show('topic_id'); /* Assign the draft information to the template */ foreach ($draft as $key => $val) { $template->setVar('topic_' . $key, $val); } } } /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_POSTTOPIC'), $forum['row_left'], $forum['row_right']); /* Set the post topic form */ $template->setFile('content', 'newtopic.html'); return TRUE; }
/** * The function which calls everything from the controller * and render the template(s). * @param mixed template The template variable, holds all current * template information * @param mixed session The session variable, holds all current * session information * @return method template render * @see Template * @see Session */ function Execute(&$template) { global $_DBA, $_URL, $_SETTINGS; /** * General Variable Setting */ /* Start the timer */ $this->timer =& new Timer(); /* Merge the post and get arrays */ $request = array_merge($this->get, $this->post, $this->cookie); /* Strip annoying slashes on everything */ foreach ($request as $key => $val) { if (!is_array($val)) { $request[$key] = stripslashes($val); } } $result = FALSE; /* Get the act var */ $act_var = get_setting('application', 'action_var') or $act_var = 'act'; /* get the session and user variables */ $session =& $_SESSION; $user =& $_SESSION['user']->info; /** * Member/Guest Settings */ /* Figure out which styleset, imageset and templateset to use */ $styleset = is_a($session['user'], 'Member') && $user['styleset'] != '' || is_a($session['user'], 'Guest') && $user['styleset'] != '' ? $user['styleset'] : $template->getVar('styleset'); $imageset = is_a($session['user'], 'Member') && $user['imgset'] != '' ? $user['imgset'] : $template->getVar('imageset'); $templateset = is_a($session['user'], 'Member') && $user['tplset'] != '' ? $user['tplset'] : $template->getVar('templateset'); /* Set the style, template and image sets */ $this->template->setVar('css_styles', get_cached_styleset($styleset, $template->getVar('styleset'))); $template_dir = FORUM_BASE_DIR . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR; $imgs_dir = FORUM_BASE_DIR . DIRECTORY_SEPARATOR . 'Images' . DIRECTORY_SEPARATOR; /* Should we get the template set that goes with this styleset? */ $templateset = is_dir($template_dir . $styleset) ? $template_dir . $styleset : $template_dir . $templateset; /* Should we get the image set that goes with this styleset? */ $imageset = is_dir($imgs_dir . $styleset) ? $styleset : $imageset; /* Check to see if our templates directory exists */ if (!is_dir($templateset)) { exit('Invalid template set for: ' . $templateset); } /* Check to see if our images directory exists */ if (!is_dir($imgs_dir . $imageset)) { exit('Invalid image set for: ' . $imageset); } /* Set the template an image sets */ $this->template->setDirname($templateset); $this->template->setVar('IMG_DIR', $imageset); /* Determine which language to get, and then include the appropriate file */ $language = is_a($session['user'], 'Member') ? strtolower($user['language']) : strtolower(get_setting('application', 'lang')); /* Check to see if this is an invalid language file */ if (!file_exists(FORUM_BASE_DIR . '/includes/lang/' . $language . '/lang.php')) { exit('Invalid Language file.'); } /* Require the language file */ include FORUM_BASE_DIR . '/includes/lang/' . $language . '/lang.php'; /* Set the language variable to the template */ $template->setVar('LANG', $language); global $lang; /* Check if the language function exists */ if (!isset($lang) || !is_array($lang) || empty($lang)) { exit('Invalid Language file.'); } /* Set the locale to which language we are using */ setlocale(LC_ALL, $lang['locale']); /* Set the language array */ $template->setVarArray($lang); /* Memory Saving */ unset($lang); /** * Event Execution */ if (get_map($user, 'can_see_board', 'can_view', array()) > $user['perms']) { /* This user doesn't have permission to see the bb */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_YOUNEEDPERMS')); } else { if (intval($_SETTINGS['bbactive']) == 0 && $user['perms'] < SUPERMOD) { /* The board is closed */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $_SETTINGS['bbclosedreason']); } else { /* get the result of our event call */ if (isset($request[$act_var]) && isset($this->events[$request[$act_var]])) { $result = $this->events[$request[$act_var]]->Execute(&$template, $request, &$_DBA, &$session, &$user); } /* If the result is false, execute our defaultevent class */ if ($result == FALSE) { $this->default->Execute(&$template, $request, &$_DBA, &$session, &$user); } } } /** * User Information */ /* Clear the session and user variables */ $session =& $_SESSION; $user =& $_SESSION['user']->info; /** * Filters */ /* Apply each Filter to the request */ for ($i = 0; $i < count($this->filters); $i++) { $this->filters[$i]->Execute(&$template, &$session, $this->cookie, $this->post, $this->get); } /* If the user is logged in, set all of his user info to the template */ if (is_a($session['user'], 'Member')) { foreach ($user as $key => $val) { $this->template->setVar('user_' . $key, $val); } } /* Set the number of queries */ $template->setVar('num_queries', $_DBA->num_queries); /* Set the Load time */ $template->setVar('load_time', $this->timer->__toString()); if (DEBUG_SQL) { $debug_url =& new Url($_URL->__toString()); $debug_url->args['debug'] = 1; $template->setVar('debug_url', $debug_url->__toString()); $template->show('sql_debug'); if (isset($request['debug']) && $request['debug'] == 1) { /* Output our debugged SQL */ debug_sql(); } } /* Do the mail queue */ execute_mail_queue(); /* Do the topic queue */ execute_topic_queue(); /** * Render the template */ error::reset(); $template->Render(); if (error::grab()) { critical_error(); } }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_URL, $_QUERYPARAMS, $_USERGROUPS, $_SESS; /** * Error Checking */ if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } /* Get our topic */ $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } if ($topic['is_draft'] == 1) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW')); $template->setInfo('content', $template->getVar('L_CANTVIEWDRAFT'), FALSE); return TRUE; } if ($topic['queue'] == 1) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW')); $template->setInfo('content', $template->getVar('L_TOPICPENDINGMOD'), FALSE); return TRUE; } if ($topic['display'] == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPICVIEW')); $template->setInfo('content', $template->getVar('L_TOPICISHIDDEN'), FALSE); return TRUE; } /* Get the current forum */ $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($topic['forum_id'])); if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } if (get_map($user, 'forums', 'can_view', array()) > $user['perms'] || get_map($user, 'topics', 'can_view', array('forum_id' => $forum['id'])) > $user['perms']) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION'), $forum['row_left'], $forum['row_right']); $template->setInfo('content', $template->getVar('L_PERMCANTVIEWTOPIC'), FALSE); return TRUE; } /** * Set the new breadcrumbs bit */ $template = BreadCrumbs($template, $topic['name'], iif($topic['topic_type'] == TOPIC_GLOBAL, FALSE, $forum['row_left']), iif($topic['topic_type'] == TOPIC_GLOBAL, FALSE, $forum['row_right'])); /** * Get the users Browsing this topic */ /* Set the extra SQL query fields to check */ $extra = " AND s.location_file = '" . $dba->Quote($_URL->file) . "' AND s.location_id = " . intval($topic['id']); $expired = time() - ini_get('session.gc_maxlifetime'); $num_online_total = $dba->getValue("SELECT COUNT(s.id) FROM " . SESSIONS . " s WHERE s.seen >= {$expired} {$extra}"); if ($num_online_total > 0) { $users_browsing =& new OnlineUsersIterator($extra); /* Set the users browsing list */ $template->setList('users_browsing', $users_browsing); $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_online_total' => $num_online_total); $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible']; $template->setVar('num_online_members', $stats['num_online_members']); $template->setVar('users_browsing', $template->getVar('L_USERSBROWSINGTOPIC')); $template->setVar('online_stats', sprintf($template->getVar('L_USERSBROWSINGSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible'])); /* Set the User's Browsing file */ $template->setFile('users_browsing', 'users_browsing.html'); $groups = array(); /* Set the usergroups legend list */ foreach ($_USERGROUPS as $group) { if ($group['display_legend'] == 1) { $groups[] = $group; } } $groups =& new FAArrayIterator($groups); $template->setList('usergroups_legend', $groups); } /** * Is this topic expired? */ $extra = ''; if ($topic['topic_type'] > TOPIC_NORMAL && $topic['topic_expire'] > 0) { if ($topic['created'] + 3600 * 24 * $topic['topic_expire'] > time()) { $extra = ",topic_expire=0,topic_type=" . TOPIC_NORMAL; } } /** * Is this user subscribed to this topic? */ $subscription = $dba->getRow("SELECT * FROM " . SUBSCRIPTIONS . " WHERE topic_id = " . intval($topic['id']) . " AND user_id = " . intval($user['id'])); if (is_array($subscription) && !empty($subscription)) { if ($subscription['last_visit'] < $topic['reply_time']) { /* Set the user to keep subscribing to this topic */ $dba->executeUpdate("UPDATE " . SUBSCRIPTIONS . " SET requires_revisit = 0, last_visit = " . time() . " WHERE topic_id = " . intval($topic['id']) . " AND user_id = " . intval($user['id'])); } } /* Add the topic info to the template */ foreach ($topic as $key => $val) { $template->setVar('topic_' . $key, $val); } /* Update the number of views for this topic */ $dba->executeUpdate("UPDATE " . TOPICS . " SET views=views+1 {$extra} WHERE topic_id=" . intval($topic['id'])); $resultsperpage = $forum['postsperpage']; $num_results = @(($topic['row_right'] - $topic['row_left'] - 1) / 2); $perpage = isset($request['limit']) && ctype_digit($request['limit']) && intval($request['limit']) > 0 ? intval($request['limit']) : $resultsperpage; $num_pages = ceil($num_results / $perpage); $page = isset($request['page']) && ctype_digit($request['page']) && intval($request['page']) > 0 ? intval($request['page']) : 1; $pager =& new TPL_Paginator($_URL, $num_results, $page, $perpage); if ($num_results > $perpage) { $template->setPager('replies_pager', $pager); } /* Outside valid page range, redirect */ if (!$pager->hasPage($page) && $num_results > $resultsperpage) { $template->setInfo('content', $template->getVar('L_PASTPAGELIMIT')); $template->setRedirect('viewtopic.php?id=' . $topic['id'] . '&limit=' . $perpage . '&page=' . $num_pages, 3); } $sort_orders = array('name', 'created', 'id', 'poster_name'); /* Get the replies for this topic */ $topic['daysprune'] = isset($request['daysprune']) && ctype_digit($request['daysprune']) ? iif($request['daysprune'] == -1, 0, intval($request['daysprune'])) : 0; $topic['sortorder'] = isset($request['order']) && ($request['order'] == 'ASC' || $request['order'] == 'DESC') ? $request['order'] : 'ASC'; $topic['sortedby'] = isset($request['sort']) && in_array($request['sort'], $sort_orders) ? $request['sort'] : 'created'; $topic['start'] = ($page - 1) * $perpage; $topic['postsperpage'] = $perpage; /* Do we set the similar topics? */ $result =& $dba->executeQuery("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE ((lower(i.name) LIKE lower('%" . $dba->quote($topic['name']) . "%') OR lower(i.name) LIKE lower('%" . $dba->quote($topic['body_text']) . "%')) OR (lower(t.body_text) LIKE lower('%" . $dba->quote($topic['name']) . "%') OR lower(t.body_text) LIKE lower('%" . $dba->quote($topic['body_text']) . "%'))) AND t.is_draft = 0 AND i.id <> " . intval($topic['id'])); if ($result->numrows() > 0) { $it =& new TopicsIterator($result, &$session, $template->getVar('IMG_DIR'), $forum); $template->setList('similar_topics', $it); $template->setFile('similar_topics', 'similar_topics.html'); } /* set the topic iterator */ $topic_list =& new TopicIterator($topic, TRUE); $template->setList('topic', $topic_list); $template->setVar('next_oldest', intval($dba->getValue("SELECT id FROM " . INFO . " WHERE id < " . $topic['id'] . " AND row_type = " . TOPIC . " LIMIT 1"))); $template->setVar('next_newest', intval($dba->getValue("SELECT id FROM " . INFO . " WHERE id > " . $topic['id'] . " AND row_type = " . TOPIC . " LIMIT 1"))); /* Set the file we need */ $template->setFile('content', 'viewtopic.html'); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { //$dba->executeUpdate("UPDATE ". USERINFO ." SET msn = '*****@*****.**' WHERE user_id = 1"); global $_DATASTORE, $_USERGROUPS, $_SESS; //$str = "[poll][question=hello?][answer]maybe[/answer][answer]good[/answer][/question][question=yes][answer]maybe[/answer][answer]good[/answer][/question][/poll]"; //$dba->executeUpdate("UPDATE k4_topics set display=1"); /* //echo str_replace('"','\"', serialize(array('spiderstrings'=>'googlebot|lycos|ask jeeves|scooter|fast-webcrawler|slurp@inktomi|turnitinbot','spidernames'=>array('googlebot' => 'Google','lycos' => 'Lycos','ask jeeves' => 'Ask Jeeves','scooter' => 'Altavista','fast-webcrawler' => 'AllTheWeb','slurp@inktomi' => 'Inktomi','turnitinbot' => 'Turnitin.com')))); $bbcode = &new BBCodex(&$user, $text, 2, TRUE, TRUE, TRUE, TRUE); $text = $bbcode->parse(); echo $text; echo '<br />'; $bbcode = &new BBCodex(&$user, $text, 2, TRUE, TRUE, TRUE, TRUE); $text = $bbcode->revert(); echo '<textarea rows="5" cols="100">'. $text .'</textarea>'; */ /* Set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_HOME')); //$dba->executeUpdate("update k4_information set row_level = 3 where row_type = 2 and parent_id = 2"); /*$dba->executeQuery("delete from k4_information"); $dba->executeQuery("delete from k4_categories"); $dba->executeQuery("delete from k4_forums"); $dba->executeQuery("delete from k4_topics"); $dba->executeQuery("delete from k4_replies"); $dba->executeQuery("delete from k4_maps"); $dba->executeQuery("delete from k4_topicqueue"); $dba->executeQuery("delete from k4_mailqueue"); $dba->executeUpdate("UPDATE ". USERINFO ." SET num_posts = 0");*/ //print_r($dba->getRow("SELECT sql, name, type FROM sqlite_master WHERE tbl_name = '". USERINFO ."' ORDER BY type DESC")); //$dba->executeQuery("delete from ". PROFILEFIELDS ." where name = 'field6'"); /* Set the Categories list */ $categories =& new CategoriesIterator(NULL); $template->setList('categories', $categories); if (!is_a($session['user'], 'Member')) { $template->setVar('welcome_title', sprintf($template->getVar('L_WELCOMETITLE'), $template->getVar('bbtitle'))); $template->show('welcome_msg'); $template->setFile('quick_login', 'login_form_quick.html'); } /* Set the online users list */ $online_users =& new OnlineUsersIterator(NULL); $template->setList('online_users', $online_users); $newest_user = $dba->getRow("SELECT name, id FROM " . USERS . " ORDER BY id DESC LIMIT 1"); $expired = time() - ini_get('session.gc_maxlifetime'); $stats = array('num_online_members' => Globals::getGlobal('num_online_members'), 'num_invisible' => Globals::getGlobal('num_online_invisible'), 'num_topics' => intval($_DATASTORE['forumstats']['num_topics']), 'num_replies' => intval($_DATASTORE['forumstats']['num_replies']), 'num_members' => intval($_DATASTORE['forumstats']['num_members']), 'num_online_total' => $dba->getValue("SELECT COUNT(*) FROM " . SESSIONS . " WHERE seen >= {$expired}") + iif(is_a($session['user'], 'Guest') && $_SESS->is_new, 1, 0), 'newest_uid' => $newest_user['id'], 'newest_user' => $newest_user['name']); $stats['num_guests'] = $stats['num_online_total'] - $stats['num_online_members'] - $stats['num_invisible']; $template->setVar('num_online_members', $stats['num_online_members']); $template->setVar('newest_member', sprintf($template->getVar('L_NEWESTMEMBER'), $stats['newest_uid'], $stats['newest_user'])); $template->setVar('total_users', sprintf($template->getVar('L_TOTALUSERS'), $stats['num_members'])); $template->setVar('total_posts', sprintf($template->getVar('L_TOTALPOSTS'), $stats['num_topics'] + $stats['num_replies'], $stats['num_topics'], $stats['num_replies'])); $template->setVar('online_stats', sprintf($template->getVar('L_ONLINEUSERSTATS'), $stats['num_online_total'], $stats['num_online_members'], $stats['num_guests'], $stats['num_invisible'])); $template->setVar('most_users_ever', sprintf($template->getVar('L_MOSTUSERSEVERONLINE'), $_DATASTORE['maxloggedin']['maxonline'], date("n/j/Y", bbtime($_DATASTORE['maxloggedin']['maxonlinedate'])), date("g:ia", bbtime($_DATASTORE['maxloggedin']['maxonlinedate'])))); if ($stats['num_online_total'] >= $_DATASTORE['maxloggedin']['maxonline']) { $maxloggedin = array('maxonline' => $stats['num_online_total'], 'maxonlinedate' => time()); $query = $dba->prepareStatement("UPDATE " . DATASTORE . " SET data = ? WHERE varname = ?"); $query->setString(1, serialize($maxloggedin)); $query->setString(2, 'maxloggedin'); $query->executeUpdate(); if (!@touch(CACHE_FILE, time() - 86460)) { @unlink(CACHE_FILE); } } /* Show the forum status icons */ $template->show('forum_status_icons'); $groups = array(); /* Set the usergroups legend list */ foreach ($_USERGROUPS as $group) { if ($group['display_legend'] == 1) { $groups[] = $group; } } $groups =& new FAArrayIterator($groups); $template->setList('usergroups_legend', $groups); /* Set the forums template to content variable */ $template->setFile('content', 'forums.html'); $template->setFile('forum_info', 'forum_info.html'); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_USERGROUPS, $_QUERYPARAMS; if (!isset($request['id']) || intval($request['id']) == 0) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_GROUPDOESNTEXIST')); } if (!isset($_USERGROUPS[intval($request['id'])])) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_GROUPDOESNTEXIST')); } if (!isset($request['name']) || !$request['name'] || $request['name'] == '') { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_USERDOESNTEXIST'), TRUE); return TRUE; } $group = $_USERGROUPS[intval($request['id'])]; $member = $dba->getRow("SELECT " . $_QUERYPARAMS['user'] . $_QUERYPARAMS['userinfo'] . " FROM " . USERS . " u LEFT JOIN " . USERINFO . " ui ON u.id=ui.user_id WHERE u.name = '" . $dba->quote($request['name']) . "'"); if (!$member || !is_array($member) || empty($member)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_USERDOESNTEXIST'), TRUE); return TRUE; } /* Should we set the group moderator? */ if ($group['mod_name'] == '' || $group['mod_id'] == 0) { $admin = $dba->getRow("SELECT * FROM " . USERS . " WHERE perms >= " . intval(ADMIN) . " ORDER BY perms,id ASC LIMIT 1"); $dba->executeUpdate("UPDATE " . USERGROUPS . " SET mod_name = '" . $dba->quote($admin['name']) . "', mod_id = " . intval($admin['id']) . " WHERE id = " . intval($group['id'])); if (!@touch(CACHE_FILE, time() - 86460)) { @unlink(CACHE_FILE); } $group['mod_name'] = $admin['name']; $group['mod_id'] = $admin['id']; } if ($group['mod_id'] == $member['id']) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_YOUAREMODERATOR'), TRUE); return TRUE; } $groups = $member['usergroups'] != '' ? iif(!unserialize($member['usergroups']), force_usergroups($member), unserialize($member['usergroups'])) : array(); $in_group = FALSE; foreach ($groups as $id) { if (isset($_USERGROUPS[$id]) && $id == $group['id']) { $in_group = TRUE; } } if ($in_group) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_BELONGSTOGROUP'), TRUE); return TRUE; } $groups[] = intval($group['id']); $extra = NULL; if ($user['perms'] < $group['min_perm']) { $extra .= ', perms=' . intval($group['min_perm']); } /* Add this user to the group and change his perms if we need to */ $dba->executeUpdate("UPDATE " . USERS . " SET usergroups='" . $dba->quote(serialize($groups)) . "' {$extra} WHERE id = " . intval($member['id'])); $template = BreadCrumbs($template, $template->getVar('L_ADDUSER')); $template->setInfo('content', sprintf($template->getVar('L_ADDEDUSERTOGROUP'), $member['name'], $group['name']), FALSE); $template->setRedirect('usergroups.php?id=' . intval($group['id']), 3); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; /** * Error checking */ if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } /* Get our topic */ $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } $forum = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['forum'] . " FROM " . FORUMS . " f LEFT JOIN " . INFO . " i ON f.forum_id = i.id WHERE i.id = " . intval($topic['forum_id'])); /* Check the forum data given */ if (!$forum || !is_array($forum) || empty($forum)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDFORUM')); $template->setInfo('content', $template->getVar('L_FORUMDOESNTEXIST'), FALSE); return TRUE; } /* Make sure the we are trying to delete from a forum */ if (!($forum['row_type'] & FORUM)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_CANTDELFROMNONFORUM'), FALSE); return TRUE; } /* Do we have permission to post to this topic in this forum? */ if ($user['perms'] < get_map($user, 'replies', 'can_add', array('forum_id' => $forum['id']))) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); return $template->setInfo('content', $template->getVar('L_PERMCANTPOST'), FALSE); } if (isset($request['r']) && intval($request['r']) != 0) { $reply = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON r.reply_id = i.id WHERE i.id = " . intval($request['r'])); if (!$reply || !is_array($reply) || empty($reply)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDREPLY')); $template->setInfo('content', $template->getVar('L_REPLYDOESNTEXIST'), FALSE); return TRUE; } else { $template->show('parent_id'); $template->setVar('parent_id', $reply['id']); } } /* Prevent post flooding */ $last_topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE t.poster_ip = '" . USER_IP . "' ORDER BY i.created DESC LIMIT 1"); $last_reply = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON r.reply_id = i.id WHERE r.poster_ip = '" . USER_IP . "' ORDER BY i.created DESC LIMIT 1"); if (is_array($last_topic) && !empty($last_topic)) { if (intval($last_topic['created']) + POST_IMPULSE_LIMIT > time()) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_MUSTWAITSECSTOPOST'), TRUE); return TRUE; } } if (is_array($last_reply) && !empty($last_reply)) { if (intval($last_reply['created']) + POST_IMPULSE_LIMIT > time()) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_MUSTWAITSECSTOPOST'), TRUE); return TRUE; } } $parent = isset($reply) && is_array($reply) ? $reply : $topic; /** * Start setting useful template information */ /* Get and set the emoticons and post icons to the template */ $emoticons =& $dba->executeQuery("SELECT * FROM " . EMOTICONS . " WHERE clickable = 1"); $posticons =& $dba->executeQuery("SELECT * FROM " . POSTICONS); $template->setList('emoticons', $emoticons); $template->setList('posticons', $posticons); $template->setVar('emoticons_per_row', $template->getVar('smcolumns')); $template->setVar('emoticons_per_row_remainder', $template->getVar('smcolumns') - 1); $template = topic_post_options($template, $user, $forum); /* Set the forum and topic info to the template */ foreach ($forum as $key => $val) { $template->setVar('forum_' . $key, $val); } /* We set topic information to be reply information */ foreach ($topic as $key => $val) { /* Omit the body text variable */ if ($key != 'body_text') { $template->setVar('reply_' . $key, $val); } } /* If this is a quote, put quote tags around the message */ if (isset($request['quote']) && intval($request['quote']) == 1) { $bbcode =& new BBCodex($user, $parent['body_text'], $forum['id'], TRUE, TRUE, TRUE, TRUE); $template->setVar('reply_body_text', '[quote=' . $parent['poster_name'] . ']' . $bbcode->revert() . '[/quote]'); } /* Set the title variable */ if (isset($reply)) { $template->setVar('reply_name', $template->getVar('L_RE') . ': ' . $reply['name']); } else { $template->setVar('reply_name', $template->getVar('L_RE') . ': ' . $topic['name']); } $template->setVar('newtopic_action', 'newreply.php?act=postreply'); /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_POSTREPLY'), $parent['row_left'], $parent['row_right']); foreach ($parent as $key => $val) { $template->setVar('parent_' . $key, $val); } /* Get the number of replies to this topic */ $num_replies = @intval(($topic['row_right'] - $topic['row_left'] - 1) / 2); /* Get replies that are above this point */ if ($num_replies > $forum['postsperpage']) { /* This will get all parent replies */ $query = "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON i.id = r.reply_id WHERE i.row_left >= " . $parent['row_left'] . " AND i.row_right <= " . $parent['row_right'] . " AND i.row_type = " . REPLY . " ORDER BY i.created DESC LIMIT 10"; } else { /* Get generalized replies */ $query = "SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['reply'] . " FROM " . REPLIES . " r LEFT JOIN " . INFO . " i ON i.id = r.reply_id WHERE r.topic_id = " . $topic['id'] . " AND i.row_type = " . REPLY . " ORDER BY i.created DESC LIMIT 10"; } $replies =& $dba->executeQuery($query); /* Set the form actiob */ $template->setVar('newreply_act', 'newreply.php?act=postreply'); $template->setList('topic_review', new TopicReviewIterator($topic, $replies, $user)); /* Set the post topic form */ $template->setFile('content', 'newreply.html'); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_USERGROUPS, $_QUERYPARAMS, $_URL; /** * Are we looking at the list of user groups? */ if (!isset($request['id']) || intval($request['id']) == 0) { $groups = isset($user['usergroups']) && $user['usergroups'] != '' ? iif(!unserialize($user['usergroups']), force_usergroups($user), unserialize($user['usergroups'])) : array(); $query = "SELECT * FROM " . USERGROUPS . " WHERE display_legend = 1"; if ($user['perms'] < ADMIN) { foreach ($groups as $id) { if (isset($_USERGROUPS[$id])) { $query .= ' OR id = ' . intval($id); } } } else { $query = "SELECT * FROM " . USERGROUPS; } $groups = $dba->executeQuery($query); $template->setList('usergroups', $groups); $template = BreadCrumbs($template, $template->getVar('L_USERGROUPS')); $template->setFile('content', 'usergroups.html'); /** * Are we looking at a specific user group? */ } else { /* Is this user group set? */ if (!isset($_USERGROUPS[intval($request['id'])])) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setInfo('content', $template->getVar('L_GROUPDOESNTEXIST')); } $group = $_USERGROUPS[intval($request['id'])]; /** * If the group admin has yet to be set, set it to our administrator */ if ($group['mod_name'] == '' || $group['mod_id'] == 0) { /* Get our administrator */ $admin = $dba->getRow("SELECT * FROM " . USERS . " WHERE perms >= " . intval(ADMIN) . " ORDER BY perms,id ASC LIMIT 1"); $dba->executeUpdate("UPDATE " . USERGROUPS . " SET mod_name = '" . $dba->quote($admin['name']) . "', mod_id = " . intval($admin['id']) . " WHERE id = " . intval($group['id'])); /* Change the file modification time of our cache file */ if (!@touch(CACHE_FILE, time() - 86460)) { @unlink(CACHE_FILE); } /* Add this info to the group array so that we can access it later */ $group['mod_name'] = $admin['name']; $group['mod_id'] = $admin['id']; } /* Get our admins max user group.. it _should_ be the administrators group */ $g = get_user_max_group($dba->getRow("SELECT " . $_QUERYPARAMS['user'] . $_QUERYPARAMS['userinfo'] . " FROM " . USERS . " u LEFT JOIN " . USERINFO . " ui ON u.id=ui.user_id WHERE u.id = " . intval($group['mod_id'])), $_USERGROUPS); /* Set his group's color */ $group['mod_color'] = !isset($g['color']) || $g['color'] == '' ? '000000' : $g['color']; /* Add this group's info to the database */ foreach ($group as $key => $val) { $template->setVar('group_' . $key, $val); } /* Create the Pagination */ $resultsperpage = 10; $num_results = $dba->getValue("SELECT COUNT(*) FROM " . USERS . " WHERE usergroups LIKE '%;i:" . intval($group['id']) . ";%' AND id <> " . intval($group['mod_id'])); $perpage = isset($request['limit']) && ctype_digit($request['limit']) && intval($request['limit']) > 0 ? intval($request['limit']) : $resultsperpage; $num_pages = ceil($num_results / $perpage); $page = isset($request['page']) && ctype_digit($request['page']) && intval($request['page']) > 0 ? intval($request['page']) : 1; $pager =& new TPL_Paginator($_URL, $num_results, $page, $perpage); if ($num_results > $perpage) { $template->setPager('users_pager', $pager); } /* Outside valid page range, redirect */ if (!$pager->hasPage($page) && $num_results > $resultsperpage) { $template->setInfo('content', $template->getVar('L_PASTPAGELIMIT')); $template->setRedirect('usergroups.php?id=' . $group['id'] . '&limit=' . $perpage . '&page=' . $num_pages, 3); } /* Get the members for this usergroup */ $start = ($page - 1) * $perpage; /* Get the members of this usergroup */ $result =& $dba->executeQuery("SELECT " . $_QUERYPARAMS['user'] . $_QUERYPARAMS['userinfo'] . " FROM " . USERS . " u LEFT JOIN " . USERINFO . " ui ON u.id=ui.user_id WHERE u.usergroups LIKE '%;i:" . intval($group['id']) . ";%' AND u.id <> " . intval($group['mod_id']) . " LIMIT " . intval($start) . ", " . intval($perpage)); $users =& new UsersIterator($result); $template->setVar('num_group_members', $num_results); if ($user['id'] == $group['mod_id']) { $template->show('add_user'); } $template = BreadCrumbs($template, $group['name']); $template->setList('users_in_usergroup', $users); $template->setFile('content', 'lookup_usergroup.html'); } return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { global $_QUERYPARAMS; if (!is_a($session['user'], 'Member')) { $template = BreadCrumbs($template, $template->getVar('L_INFORMATION')); $template->setFile('content', 'login_form.html'); $template->show('no_perms'); return TRUE; } if (!isset($request['id']) || !$request['id'] || intval($request['id']) == 0) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } /* Get our topic */ $topic = $dba->getRow("SELECT " . $_QUERYPARAMS['info'] . $_QUERYPARAMS['topic'] . " FROM " . TOPICS . " t LEFT JOIN " . INFO . " i ON t.topic_id = i.id WHERE i.id = " . intval($request['id'])); if (!$topic || !is_array($topic) || empty($topic)) { /* set the breadcrumbs bit */ $template = BreadCrumbs($template, $template->getVar('L_INVALIDTOPIC')); $template->setInfo('content', $template->getVar('L_TOPICDOESNTEXIST'), FALSE); return TRUE; } $subscribe =& $dba->prepareStatement("DELETE FROM " . SUBSCRIPTIONS . " WHERE user_id=? AND topic_id=?"); $subscribe->setInt(1, $user['id']); $subscribe->setInt(2, $topic['id']); $subscribe->executeUpdate(); /* Redirect the user */ $template = BreadCrumbs($template, $template->getVar('L_SUBSCRIPTIONS'), $topic['row_left'], $topic['row_right']); $template->setInfo('content', sprintf($template->getVar('L_UNSUBSCRIBEDTOPIC'), $topic['name'])); $template->setRedirect('viewtopic.php?id=' . $topic['id'], 3); return TRUE; }
function Execute(&$template, $request, &$dba, &$session, &$user) { /* Create the ancestors bar */ $template = BreadCrumbs($template, $template->getVar('L_LOGIN')); /* Check if the user is logged in or not */ if (!is_a($session['user'], 'Member')) { $template->setFile('content', 'login_form.html'); } else { $template->setInfo('content', $template->getVar('L_YOUARELOGGEDIN')); } return TRUE; }