public function execute() { $action = 'none'; if (isset($_GET['action'])) { $action = $_GET['action']; } if (strcmp($action, 'get_categories') == 0) { $this->data = DbForumCategory::GetAll(); } else { if (strcmp($action, 'add_category') == 0) { if (isset($_POST['category_name'])) { if ($this->testPermission('manage_forum_categories')) { DbForumCategory::Add($_POST['category_name']); } } } else { if (strcmp($action, 'add_forum') == 0) { if (isset($_POST['forum_name']) && isset($_POST['forum_description']) && isset($_POST['forum_category'])) { if ($this->testPermission('manage_forums')) { DbForum::Add($_POST['forum_category'], $_POST['forum_name'], $_POST['forum_description']); } } } } } }
function response($oAlert) { global $gConf; $iProfileId = $oAlert->iObject; if (!$iProfileId || $oAlert->sUnit != 'profile' || 'delete' != $oAlert->sAction && 'edit' != $oAlert->sAction) { return; } $sUsername = '******' == $oAlert->sAction ? $oAlert->aExtras['profile_info']['NickName'] : getUsername($iProfileId); if ('edit' == $oAlert->sAction && $oAlert->aExtras['OldProfileInfo']['NickName'] == $sUsername) { return; } $oDb = new DbForum(); $sOldUsername = '******' == $oAlert->sAction ? $sUsername : $oAlert->aExtras['OldProfileInfo']['NickName']; $sNewUsername = '******' == $oAlert->sAction ? $gConf['anonymous'] : $sUsername; $oDb->renameUser($sOldUsername, $sNewUsername); }
function onPostReply($aTopic, $sPostText, $sUser) { $oProfile = new BxDolProfile($sUser); $aPlusOriginal = array('PosterUrl' => $oProfile->_iProfileID ? getProfileLink($oProfile->_iProfileID) : 'javascript:void(0);', 'PosterNickName' => $sUser, 'TopicTitle' => $aTopic['topic_title'], 'ReplyText' => $sPostText); $oEmailTemplate = new BxDolEmailTemplates(); $aTemplate = $oEmailTemplate->getTemplate('bx_forum_notifier'); $fdb = new DbForum(); $a = $fdb->getSubscribersToTopic($aTopic['topic_id']); foreach ($a as $r) { if ($r['user'] == $sUser) { continue; } $oRecipient = new BxDolProfile($r['user']); $aRecipient = getProfileInfo($oRecipient->_iProfileID); $aPlus = array_merge(array('Recipient' => ' ' . $aRecipient['NickName']), $aPlusOriginal); sendMail(trim($aRecipient['Email']), $aTemplate['Subject'], $aTemplate['Body'], '', $aPlus); } $oAlert = new BxDolAlerts('bx_forum', 'reply', $aTopic['topic_id']); $oAlert->alert(); }
public function execute() { $this->doAction(); if (isset($_GET['forum_id'])) { $forum_id = $_GET['forum_id']; $this->forum = DbForum::GetById($forum_id); if (!$this->forum->isNull()) { $this->topics = DbTopic::GetByForum($forum_id); } else { header('location: forums.php'); } } else { header('location: forums.php'); } }
function getXxxPostsXML($wp, $sDbFunc, $sTitle, $sAddXml = '') { global $gConf; global $f; $ui = array(); $fdb = new DbForum(); $adb = new DbAdmin(); if (!$this->_admin) { if ($wp) { $GLOBALS['f']->setTitle('<![CDATA[' . $sTitle . ']]>'); $li = $GLOBALS['f']->_getLoginInfo($u); return $this->addHeaderFooter($li, "<posts></posts>"); } else { return "<root><posts></posts></root>"; } } // check user permissions to delete or edit posts $gl_allow_edit = 1; $gl_allow_del = 1; $gl_allow_hide_posts = 1; $gl_allow_unhide_posts = 1; $gl_allow_clear_report = 1; $gl_allow_download = 1; $u = $f->_getLoginUser(); $a = $adb->{$sDbFunc}($u); reset($a); $p = ''; while (list(, $r) = each($a)) { // acquire user info if (!$ui[$r['user']]) { $aa = $f->_getUserInfo($r['user']); encode_post_text($aa['role']); $ui[$r['user']] = array('posts' => $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar'], 'url' => $aa['profile_url'], 'onclick' => $aa['profile_onclick'], 'role' => $aa['role']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; $files = $GLOBALS['f']->_getAttachmentsXML($r['post_id']); encode_post_text($r['post_text']); $p .= <<<EOF <post id="{$r['post_id']}" force_show="1"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<allow_hide_posts>{$gl_allow_hide_posts}</allow_hide_posts> \t<allow_unhide_posts>{$gl_allow_unhide_posts}</allow_unhide_posts> <allow_download>{$gl_allow_download}</allow_download> {$sAddXml} \t<points>{$r['votes']}</points> <hidden>{$r['hidden']}</hidden> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t\t<url>{$ui[$r['user']]['url']}</url> \t\t<onclick>{$ui[$r['user']]['onclick']}</onclick> <role>{$ui[$r['user']]['role']}</role> \t</user> <attachments>{$files}</attachments> \t<min_point>{$gConf['min_point']}</min_point> </post> EOF; $rr = $r; } if ($wp) { $GLOBALS['f']->setTitle('<![CDATA[' . $sTitle . ']]>'); $li = $GLOBALS['f']->_getLoginInfo($u); return $this->addHeaderFooter($li, "<posts><topic><title>{$sTitle}</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts>"); } else { $cu = $this->getUrlsXml(); return "<root>{$cu}<posts><topic><title>{$sTitle}</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts></root>"; } }
/** * returns reported posts XML */ function getReportedPostsXML() { global $gConf; global $f; $ui = array(); $fdb = new DbForum(); $adb = new DbAdmin(); if (!$this->_admin) { return "<root><posts></posts></root>"; } // check user permissions to delete or edit posts $gl_allow_edit = 1; $gl_allow_del = 1; $u = $f->_getLoginUser(); $a = $adb->getReportedPosts($u); reset($a); $p = ''; while (list(, $r) = each($a)) { // acquire user info if (!$ui[$r['user']]) { $aa = $f->_getUserInfo($r['user']); $ui[$r['user']] = array('posts' => $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; encode_post_text($r['post_text']); $p .= <<<EOF <post id="{$r['post_id']}" force_show="1"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<points>{$r['votes']}</points> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t</user> \t<min_point>{$gConf['min_point']}</min_point> </post> EOF; $rr = $r; } $cu = $this->getUrlsXml(); return "<root>{$cu}<posts><topic><title>Reported Posts</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts></root>"; }
/** * profile xml * @param $u username * @param $wp return whole page XML */ function showProfile($u, $wp) { $fdb = new DbForum(); $a = $this->_getUserInfo($u); $as = $fdb->getUserStat($u); $a['username'] = $u; $a['posts'] = (int) $as['posts']; $a['user_last_post'] = $as['user_last_post']; $a['last_online'] = $fdb->getUserLastOnlineTime($u); $p = array2xml($a); if ($wp) { $li = $this->_getLoginInfo(); return $this->addHeaderFooter($li, "<profile>{$p}</profile>"); } else { $cu = $this->getUrlsXml(); return "<root>{$cu}<profile>{$p}</profile></root>"; } }
function onNewTopic($iForumId, $sTopicSubject, $sTopicText, $isTopicSticky, $sUser, $sTopicUri, $iPostId) { $fdb = new DbForum(); $oProfile = new BxDolProfile($sUser); $aTopic = $fdb->getTopicByUri($sTopicUri); if (BX_ORCA_INTEGRATION == 'dolphin' && !isAdmin($oProfile->getID())) { defineForumActions(); $aForum = $fdb->getForum($iForumId, false); $iActionId = BX_FORUM_PUBLIC_POST; if (isset($aForum['forum_type']) && 'private' == $aForum['forum_type']) { $iActionId = BX_FORUM_PRIVATE_POST; } checkAction($oProfile->getID(), $iActionId, true); // perform action } $a = array($iForumId, $sTopicSubject, $sTopicText, $isTopicSticky, $sUser); forumAlert('new_topic', $aTopic['topic_id'], $oProfile->getID(), $a); }
function uriCheckUniq($s, $sTable, $sField) { $fdb = new DbForum(); return !$fdb->getOne("SELECT 1 FROM {$sTable} WHERE {$sField} = '{$s}' LIMIT 1"); }
/** * show edit forum page * @param $forum_id forum id * @param $cat_id category id * @param return forum edit window xml */ function editForum($forum_id, $cat_id) { $db = new DbAdmin(); $fdb = new DbForum(); if ($forum_id) { $a = $db->getForum((int) $forum_id); } else { $a['cat_id'] = $cat_id; } $c = $fdb->getCat($a['cat_id']); $a['cat_uri'] = $c['cat_uri']; $cu = $this->getUrlsXml(); encode_post_text($a['forum_title'], 0); encode_post_text($a['forum_desc'], 0); return <<<OES <root> {$cu} <forum forum_id="{$forum_id}"> <cat_id>{$a['cat_id']}</cat_id> <cat_uri>{$a['cat_uri']}</cat_uri> <title>{$a['forum_title']}</title> <desc>{$a['forum_desc']}</desc> <type>{$a['forum_type']}</type> <order>{$a['forum_order']}</order> </forum> </root> OES; }
<?php if ($_GET['orca_integration'] && preg_match('/^[0-9a-z]+$/', $_GET['orca_integration'])) { define('BX_ORCA_INTEGRATION', $_GET['orca_integration']); } else { define('BX_ORCA_INTEGRATION', 'dolphin'); } $aPathInfo = pathinfo(__FILE__); require_once $aPathInfo['dirname'] . '/inc/header.inc.php'; if (!class_exists('Thing')) { require_once $GLOBALS['gConf']['dir']['classes'] . 'Thing.php'; } require_once $GLOBALS['gConf']['dir']['classes'] . 'ThingPage.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'Mistake.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'BxXslTransform.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'BxDb.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'DbForum.php'; $oFDB = new DbForum(); $oMemberMenu = bx_instance('BxDolMemberMenu'); $aLinkInfo = array('item_img_src' => getTemplateIcon('modules/boonex/forum/|orca.gif'), 'item_img_alt' => _t('_bx_forums'), 'item_link' => $GLOBALS['site']['url'] . 'forum/', 'item_onclick' => null, 'item_title' => _t('_bx_forums'), 'extra_info' => $oFDB->getUserPosts(getNickName())); return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);
public function execute() { $this->forums = DbForum::GetAll(); }