// start of the week $week = mktime(0, 0, 0, $last_month, $start, $year); } else { $week = mktime(0, 0, 0, date("n"), 1, date("Y")); } } /* ----------------------------------------------------------- DO THE OTHER LESS COMPLICATED STUFF -------------------------------------------------------------*/ $month = !isset($request['month']) ? date("n") : intval($request['month']); $year = !isset($request['year']) ? date("Y") : intval($request['year']); $week = !isset($request['week']) ? $week : intval($request['week']); $lm = $cal->rewind_month($month, $year); $template['prev_month'] = $cal->draw_calendar(1, 1, $lm['m'], $lm['y'], TRUE); $nm = $cal->advance_month($month, $year, TRUE); $template['next_month'] = $cal->draw_calendar(1, 1, $nm['m'], $nm['y'], TRUE); $weeks = $cal->week_range($week, $month, $year); //$template->week = !isset($weeks[$week-1]) ? @$weeks[$week+1] : @$weeks[$week-1]; $template->week = $weeks; } else { return new Error($template['L_FEATUREDENIED'], $template); } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('year', new YearlyView()); $app->AddEvent('week', new WeeklyView()); $app->ExecutePage();
protected $forums; public function __construct() { $this->forums = DBA::Open()->Query("SELECT * FROM " . FORUMS . " WHERE row_left > 1 AND row_level > 1 ORDER BY row_left ASC")->GetIterator(); } public function Current() { $temp = $this->forums->Current(); $temp['name'] = str_repeat(" ", intval($temp['row_level'] - 1)) . stripslashes($temp['name']); return $temp; } public function Key() { return $this->forums->Key(); } public function Next() { return $this->forums->Next(); } public function Rewind() { return $this->forums->Rewind(); } public function Valid() { return $this->forums->Valid(); } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('search', new Search()); $app->ExecutePage();
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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('posttopic', new PostTopic()); $app->AddEvent('postdraft', new PostDraft()); $app->AddEvent('deletedraft', new DeleteDraft()); $app->AddEvent('edittopic', new EditTopic()); $app->AddEvent('updatetopic', new UpdateTopic()); $app->ExecutePage();
return new Error($threads->message, $template); } else { $template->threads = $threads; } $template['total_posts'] = $row['threads']; $template['forum_id'] = $row['id']; $template['postlimit'] = $row['threadsperpage']; $template['pag_start'] = isset($request['start']) ? intval(@$request['start']) : 0; } else { return new Error($template['L_PERMCANTVIEW'], $template); } } } else { DBA::Open()->Execute("UPDATE " . FORUMS . " SET referals = referals+1 WHERE id = " . $row['id']); header("Location: " . $row['link_href']); } } else { return new Error($template['L_ERRORVIEWFORUM'], $template); } } } else { return new Error($template['L_INVALIDFORUM'], $template); } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } $app = new Forum_Controller('forum_base.html'); $app->AddAction('a_postthread', new Action('posting.php', 'post_thread&id=' . intval(@$_GET['id']))); $app->ExecutePage();
$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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('track', new SubscribeTopic()); $app->AddEvent('untrack', new UnsubscribeTopic()); //$app->AddEvent('markforums', new MarkCategoryForumsRead); $app->ExecutePage();
} else { return new Error($template['L_FORUMDOESNTEXIST'], $template); } } else { return new Error($template['L_FORUMDOESNTEXIST'], $template); } } else { return new Error($template['L_NEEDLOGGEDIN'], $template); } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } /* Set our wrapper template */ $app = new Forum_Controller('forum_base.html'); /* Apply all of the events */ $app->AddEvent('email', new EmailUserForm()); $app->AddEvent('email_user', new Emailuser()); $app->AddEvent('login', new ForumLogin()); $app->AddEvent('register', new ForumRegister()); $app->AddEvent('rate_thread', new MemberRateThread()); $app->AddEvent('forum_login', new MemberForumLogin()); /* User CP */ $app->AddEvent('profile', new MemberProfile()); $app->AddEvent('update_profile', new MemberUpdateProfile()); $app->AddEvent('settings', new MemberSettings()); $app->AddEvent('update_settings', new MemberUpdateSettings()); $app->AddEvent('avatar', new MemberAvatar()); $app->AddEvent('update_avatar', new MemberUpdateAvatar()); $app->AddEvent('password', new MemberPassword());
$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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('markforums', new MarkForumsRead()); $app->ExecutePage();
$row = $this->dba->GetRow("SELECT * FROM " . POSTS . " WHERE id = " . intval($request['id'])); if (!empty($row) && isset($row['id'])) { /* Lock the thread */ $this->dba->Execute("UPDATE " . POSTS . " SET row_locked = 1 WHERE id = " . $row['id']); return new Error($template['L_LOCKEDTHREAD'] . '<meta http-equiv="refresh" content="2; url=viewforum.php?id=' . $row['forum_id'] . '">', $template); } else { return new Error($template['L_INVALIDTHREADID'], $template); } } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } /* Add all of the events */ $app = new Forum_Controller('admin/null.html'); /* Stuff */ $app->AddEvent('head', new AdminHead()); $app->AddEvent('nav', new AdminMenu()); /* Forum Options */ $app->AddEvent('options', new AdminOptions()); $app->AddEvent('update_options', new AdminUpdateOptions()); /* Categories Stuff */ $app->AddEvent('categories', new AdminCategories()); $app->AddEvent('add_cat', new AdminAddCategory()); /* Generic Stuff */ $app->AddEvent('suspend', new AdminSuspend(1)); $app->AddEvent('unsuspend', new AdminSuspend(0)); $app->AddEvent('update', new AdminUpdate()); $app->AddEvent('delete_single', new AdminDeleteNode()); /* Forums Stuff */
function testMarkAsSpamLink() { $this->logInWithPermission("ADMIN"); $spampost = $this->objFromFixture('Post', 'SpamSecondPost'); $forum = $spampost->Forum(); $author = $spampost->Author(); $link = $forum->AbsoluteLink("markasspam") . '/' . $spampost->ID; $c = new Forum_Controller($forum); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'markasspam/' . $spampost->ID)); // removes the post $this->assertFalse(DataObject::get_by_id('Post', $spampost->ID)); // removes the member $this->assertFalse(DataObject::get_by_id('Member', $author->ID)); // does not effect the thread $thread = DataObject::get_by_id('ForumThread', $spampost->Thread()->ID); $this->assertEquals('1', $thread->getNumPosts()); // mark the first post in that now as spam $spamfirst = $this->objFromFixture('Post', 'SpamFirstPost'); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'markasspam/' . $spamfirst->ID)); // removes the thread $this->assertFalse(DataObject::get_by_id('ForumThread', $spamfirst->Thread()->ID)); }
} $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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('postreply', new PostReply()); $app->AddEvent('editreply', new EditReply()); $app->AddEvent('updatereply', new UpdateReply()); $app->ExecutePage();
{ 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; } } $app = new Forum_Controller('admin/admin_base.html'); /* Things in the Frameset */ $app->AddEvent('admin_header', new AdminHead()); $app->AddEvent('admin_navigation', new AdminMenu()); /* Admin File Browser */ $app->AddEvent('file_browser', new AdminFileBrowser()); /* The GUI for the MAPS permission system */ $app->AddEvent('permissions_gui', new AdminMapsGui()); $app->AddEvent('maps_inherit', new AdminMapsInherit()); $app->AddEvent('maps_update', new AdminMapsUpdate()); $app->AddEvent('maps_add', new AdminMapsAddNode()); $app->AddEvent('maps_insert', new AdminMapsInsertNode()); $app->AddEvent('maps_remove', new AdminMapsRemoveNode()); /* Post Icons */ $app->AddEvent('posticons', new AdminPostIcons()); $app->AddEvent('posticons_add', new AdminAddPostIcon());
$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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('add_user_to_group', new AddUserToGroup()); $app->ExecutePage();
function testGhostLink() { $spampost = $this->objFromFixture('Post', 'SpamSecondPost'); $forum = $spampost->Forum(); $author = $spampost->Author(); $moderator = $this->objFromFixture('Member', 'moderator'); // moderator for "general" forum // without a logged-in moderator $this->assertFalse($spampost->GhostLink(), 'Link not present by default'); $c = new Forum_Controller($forum); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'ghost/' . $spampost->AuthorID), DataModel::inst()); $this->assertEquals(403, $response->getStatusCode()); // with logged-in moderator $moderator->logIn(); $this->assertNotEquals(false, $spampost->GhostLink(), 'Link present for moderators on this forum'); $c = new Forum_Controller($forum); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'ghost/' . $spampost->AuthorID), DataModel::inst()); $this->assertFalse($response->isError()); // post isn't available anymore in normal queries. {@link ForumSpamPostExtension} $post = Post::get()->byId($spampost->ID); $this->assertNull($post); // user is banned $author = Member::get()->byId($author->ID); $this->assertTrue($author->IsGhost()); }
/* 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; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('markforums', new MarkCategoryForumsRead()); $app->AddEvent('track', new SubscribeForum()); $app->AddEvent('untrack', new UnsubscribeForum()); $app->ExecutePage(); ob_flush();
* Prevent direct access and usage from unsupported CMSimple_XH versions. */ if (!defined('CMSIMPLE_XH_VERSION') || strpos(CMSIMPLE_XH_VERSION, 'CMSimple_XH') !== 0 || version_compare(CMSIMPLE_XH_VERSION, 'CMSimple_XH 1.6', 'lt')) { header('HTTP/1.1 403 Forbidden'); header('Content-Type: text/plain; charset=UTF-8'); die(<<<EOT Forum_XH detected an unsupported CMSimple_XH version. Uninstall Forum_XH or upgrade to a supported CMSimple_XH version! EOT ); } /** * The plugin version. */ define('FORUM_VERSION', '@FORUM_VERSION@'); $_Forum = new Forum_Controller(); /** * Handles the forum requests. * * @param string $forum A forum name. * * @return mixed */ function forum($forum) { global $_Forum; return $_Forum->main($forum); } /* * Return the comment preview. */
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * @author Peter Goodman * @version $Id: mod.php,v 1.4 2005/05/24 20:09:16 k4st Exp $ * @package k42 */ error_reporting(E_ALL); ob_start(); require 'forum.inc.php'; class DefaultEvent extends Event { function Execute(&$template, $request, &$dba, &$session, &$user) { global $_DATASTORE, $_USERGROUPS; return TRUE; } } $app = new Forum_Controller('forum_base.html'); $app->AddEvent('deletetopic', new DeleteTopic()); $app->AddEvent('deletereply', new DeleteReply()); $app->AddEvent('locktopic', new LockTopic()); $app->AddEvent('unlocktopic', new UnlockTopic()); $app->AddEvent('moderate_forum', new ModerateForum()); $app->AddEvent('topic_simpleupdate', new SimpleUpdateTopic()); $app->AddEvent('move_topics', new MoveTopics()); $app->ExecutePage(); ob_flush();
/** * Note: See {@link testCanModerate()} for detailed permission tests. */ function testMarkAsSpamLink() { $spampost = $this->objFromFixture('Post', 'SpamSecondPost'); $forum = $spampost->Forum(); $author = $spampost->Author(); $moderator = $this->objFromFixture('Member', 'moderator'); // moderator for "general" forum // without a logged-in moderator $this->assertNull($spampost->MarkAsSpamLink(), 'Link not present by default'); $c = new Forum_Controller($forum); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'markasspam/' . $spampost->ID)); $this->assertEquals(403, $response->getStatusCode()); // with logged-in moderator $moderator->logIn(); $this->assertNotNull($spampost->MarkAsSpamLink(), 'Link present for moderators on this forum'); $this->assertNull($author->SuspendedUntil); $link = $forum->AbsoluteLink("markasspam") . '/' . $spampost->ID; $c = new Forum_Controller($forum); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'markasspam/' . $spampost->ID)); $this->assertFalse($response->isError()); // removes the post $this->assertFalse(DataObject::get_by_id('Post', $spampost->ID)); // suspends the member $author = DataObject::get_by_id('Member', $author->ID); $this->assertNotNull($author->SuspendedUntil); // does not effect the thread $thread = DataObject::get_by_id('ForumThread', $spampost->Thread()->ID); $this->assertEquals('1', $thread->getNumPosts()); // mark the first post in that now as spam $spamfirst = $this->objFromFixture('Post', 'SpamFirstPost'); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'markasspam/' . $spamfirst->ID)); // removes the thread $this->assertFalse(DataObject::get_by_id('ForumThread', $spamfirst->Thread()->ID)); }
$attachment = file_get_contents($fullpath); break; case 'phps': $attachment = highlight_string(file_get_contents($fullpath), TRUE); break; case 'pdf': $attachment = '<a href="' . $fullpath . '" target="_blank">' . $lang['L_CLICKHERE'] . '</a>'; break; case 'doc': $attachment = '<a href="' . $fullpath . '" target="_blank">' . $lang['L_CLICKHERE'] . '</a>'; break; case 'psd': $attachment = '<a href="' . $fullpath . '" target="_blank">' . $lang['L_CLICKHERE'] . '</a>'; break; case 'rtf': $attachment = '<a href="' . $fullpath . '" target="_blank">' . $lang['L_CLICKHERE'] . '</a>'; break; case 'zip': $attachment = '<a href="' . $fullpath . '" target="_blank">' . $lang['L_CLICKHERE'] . '</a>'; break; } $template['attachment'] = $attachment; $template->attachments = $array; } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } $app = new Forum_Controller('attachments.html'); $app->ExecutePage();
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 header('Content-Transfer-Encoding: none'); header('Content-Type: application/octetstream; name="' . $output_file . '"'); //This should work for IE & Opera header('Content-Type: application/octet-stream; name="' . $output_file . '"'); //This should work for the rest header('Content-Disposition: inline; filename="' . $output_file . '"'); echo $str; exit; } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } $app = new Forum_Controller('admin/files.html'); /* Upload background images for the CSS editor */ $app->AddEvent('upload_file', new AdminCSSSelectFile()); $app->AddEvent('upload_bgimage', new AdminUploadImg(1)); /* Upload user rank images */ $app->AddEvent('rank_upload', new AdminRankSelectFile()); $app->AddEvent('upload_img', new AdminUploadImg(2)); /* Export a css file */ $app->AddEvent('export_css', new AdminCSSExport()); /* Deal with avatar uploads */ $app->AddEvent('avatar_upload', new MemberAvatarSelectFile()); $app->AddEvent('upload_avatar', new MemberUploadAvatar()); $app->ExecutePage();
/* Set the thread action */ $template['a_add_thread'] = new Action('posting.php', 'update_post'); /* Set the post id */ $template['post_id'] = $post['id']; } else { return new Error($template['L_PERMSEDITPOST'], $template); } } else { return new Error($template['L_INVALIDPOSTID'], $template); } } else { return new Error($template['L_INVALIDPOSTID'], $template); } } else { return new Error($template['L_NEEDLOGGEDIN'], $template); } /* Set the number of queries */ $template['num_queries'] = $session->dba->num_queries; return TRUE; } } $app = new Forum_Controller('forum_base.html'); //$app->AddAction('a_add_thread', new Action('posting.php', 'add_thread')); $app->AddAction('a_add_reply', new Action('posting.php', 'add_reply')); $app->AddEvent('post_reply', new PostReply()); $app->AddEvent('add_reply', new AddReply()); $app->AddEvent('add_thread', new AddThread()); $app->AddEvent('edit', new EditPost()); $app->AddEvent('update_post', new UpdatePost()); $app->AddEvent('vote', new VoteOnPoll()); $app->ExecutePage();
} class ForumLogin extends Event { 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; } } /* Set our wrapper template */ $app = new Forum_Controller('forum_base.html'); /* Apply all of the events */ $app->AddEvent('login', new ForumLogin()); $app->AddEvent('register', new ForumRegisterUser()); $app->AddEvent('register_user', new ForumInsertUser()); $app->AddEvent('activate_accnt', new ValidateUserByEmail()); $app->AddEvent('login_user', new LoginEvent()); $app->AddEvent('logout', new LogoutEvent()); $app->AddEvent('remindme', new RemindMeEvent()); $app->AddEvent('mail', new EmailUser()); $app->AddEvent('email_user', new SendEmailToUser()); $app->AddEvent('findposts', new FindPostsByUser()); $app->ExecutePage(); ob_flush();