function dofpower() { $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__members` WHERE `uid`='" . intval($_GET['uid']) . "'"); $forum = new forum(); $forum->allArray(); include admincp::tpl("account.fpower"); }
function dofpower() { $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__group` WHERE `gid`='" . intval($_GET['groupid']) . "'"); admincp::head(); $forum = new forum(); $forum->allArray(); include admincp::tpl(); }
function dofpower() { include_once iPATH . 'include/forum.class.php'; $rs = iCMS_DB::getRow("SELECT * FROM `#iCMS@__admin` WHERE `uid`='" . intval($_GET['uid']) . "'"); $forum = new forum(); $forum->allArray(); include admincp::tpl("account.fpower"); }
function doUpdate() { include_once iPATH . 'include/forum.class.php'; if ($_POST['forum']) { $forum = new forum(); $forum->cache(); } if ($_POST['adm']) { include_once iPATH . 'admin/advertise.mo.php'; $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__advertise`", OBJECT); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { adm($rs[$i]); } } $_POST['tpl'] && $this->iCMS->clear_compiled_tpl(); $_POST['iCMS_list'] && FS::rmdir(iPATH . 'cache/list'); $_POST['iCMS_forum'] && FS::rmdir(iPATH . 'cache/forum'); $_POST['iCMS_tag'] && FS::rmdir(iPATH . 'cache/tags'); if ($_POST['iCMS_ALL']) { FS::rmdir(iPATH . 'cache/list'); FS::rmdir(iPATH . 'cache/forum'); FS::rmdir(iPATH . 'cache/tags'); } $_POST['keywords'] && keywords_cache(); $_POST['tags'] && tags_cache(); if ($_POST['model']) { include iPATH . 'include/model.class.php'; model::cache(); } $_POST['field'] && field_cache(); $_POST['config'] && CreateConfigFile(); if ($_POST['Re-Article-Count']) { $rs = iCMS_DB::getArray("SELECT fid FROM `#iCMS@__forum`"); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $c = iCMS_DB::getValue("SELECT count(*) FROM #iCMS@__article where `fid`='" . $rs[$i]['fid'] . "' LIMIT 1 "); iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` ='{$c}' WHERE `fid` ='" . $rs[$i]['fid'] . "' LIMIT 1 "); } } if ($_POST['Re-Tag-Count']) { include_once iPATH . 'include/forum.class.php'; $rs = iCMS_DB::getArray("SELECT id FROM `#iCMS@__tags`"); $_count = count($rs); for ($i = 0; $i < $_count; $i++) { $_count = iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__taglist` WHERE `tid`='" . $rs[$i]['id'] . "'"); iCMS_DB::query("UPDATE `#iCMS@__tags` SET `count` = '{$_count}' WHERE `id` ='" . $rs[$i]['id'] . "'"); tags_cache($rs[$i]['id']); } } javascript::dialog("执行完毕!", 'url:1'); }
function finish($postid, $cloneid, $url, $fromform, $uploadfolder, $ajaxdata = '') { // Clear out used playspace and/or uploadfolder if (isset($fromform->attachmentplayspace)) { // Unless we're keeping it, wipe the playspace forum::delete_attachment_playspace($fromform->attachmentplayspace, optional_param('keepplayspace', 0, PARAM_INT)); } // Get rid of temporary upload folder if ($uploadfolder) { remove_dir($uploadfolder); } global $ajax; if ($ajax) { if ($ajaxdata) { // Print AJAX data if specified header('Content-Type: text/plain'); print $ajaxdata; exit; } else { // Default otherwise is to print post forum_post::print_for_ajax_and_exit($postid, $cloneid, array(forum_post::OPTION_DISCUSSION_SUBJECT => true)); } } redirect($url); }
function doarticle() { $forum = new forum(); $callback = $_GET['callback']; $fid = (int) $_GET['fid']; $sql = " where "; $sql .= $_GET['type'] == 'draft' ? "`status` ='0'" : "`status` ='1'"; $sql .= $act == 'user' ? " AND `postype`='0'" : " AND `postype`='1'"; $_GET['keywords'] && ($sql .= " AND CONCAT(title,keywords,description) REGEXP '{$_GET['keywords']}'"); $fid = member::CP($fid) ? $fid : "0"; if ($fid) { if (isset($_GET['sub'])) { $sql .= " AND ( fid IN(" . $forum->fid($fid) . $fid . ")"; } else { $sql .= " AND ( fid ='{$fid}'"; } $sql .= " OR `vlink` REGEXP '[[:<:]]" . preg_quote($fid, '/') . "[[:>:]]')"; } else { member::$cpower && ($sql .= " AND fid IN(" . implode(',', member::$cpower) . ")"); } isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']); $maxperpage = 8; $total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(*) FROM `#iCMS@__article` {$sql}") : (int) $_GET['rowNum']; page($total, $maxperpage, "篇文章"); $rs = iCMS_DB::getArray("SELECT * FROM `#iCMS@__article`{$sql} order by id DESC LIMIT {$this->firstcount} , {$maxperpage}"); $_count = count($rs); include admincp::tpl(); }
public function display($forum) { $params = $forum->get_link_params_array(); if ($forum->get_group_mode()) { $params['group'] = forum::get_activity_group($forum->get_course_module()); } return parent::get_button($forum, get_string('markallread', 'forumng'), 'markread.php', true, $params); }
public function display($forum) { // Work out current status $manualmark = !forum::mark_read_automatically(); $current = get_string($manualmark ? 'manualmark_manual' : 'manualmark_auto', 'forumng'); // Make a help button $change = get_string('manualmark_change', 'forumng'); $helpbutton = helpbutton('manualmark', $change, 'forumng', true, false, '', true); // Get the button form $params = $forum->get_link_params_array(); return parent::get_button($forum, $change, 'feature/manualmark/change.php', true, $params, $helpbutton, 'forumng-manualmark', $current . ' ', 'forumng-button-to-link'); }
<?php if (!defined('IN_ROSTER')) { exit('Detected invalid access to this file!'); } include $addon['dir'] . 'inc/function.lib.php'; $functions = new forum(); include ROSTER_LIB . 'install.lib.php'; $installer = new Install(); if (isset($_POST['type']) && !empty($_POST['type'])) { $op = isset($_POST['op']) ? $_POST['op'] : ''; $id = isset($_POST['id']) ? $_POST['id'] : ''; switch ($_POST['type']) { case 'deactivate': processActive($id, 0); break; case 'activate': processActive($id, 1); break; case 'unlock': processLock($id, 0); break; case 'lock': processLock($id, 1); break; case 'delete': deleteForum(); break; case 'add': echo 'add forum'; //processPage();
<?php require '../includes/config.php'; require '../structure/base.php'; require '../structure/forum.php'; require '../structure/forum.index.php'; require '../structure/forum.thread.php'; require '../structure/forum.post.php'; require '../structure/database.php'; require '../structure/user.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $forum = new forum($database); $forum_index = new forum_index($database); $thread = new thread($database); $post = new post($database); $user->updateLastActive(); //get config $config = $base->loadConfig(); //set some variables that are used a lot throughout the page $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); $f = $_GET['forum']; $i = $_GET['id']; //preform basic checks if (!ctype_digit($f) || !ctype_digit($i) || !$thread->checkExistence($i) || !$thread->canView($i, $username, $rank)) { $base->redirect('index.php'); } //if the GOTO field is set, let's skip to the selected post if (ctype_digit($_GET['goto'])) {
/** * WoWRoster.net WoWRoster * * @copyright 2002-2011 WoWRoster.net * @license http://www.gnu.org/licenses/gpl.html Licensed under the GNU General Public License v3. * @version SVN: $Id$ * @link http://www.wowroster.net * @package News */ if (!defined('IN_ROSTER')) { exit('Detected invalid access to this file!'); } if (!$roster->auth->getAuthorized($addon['config']['forum_start_topic'])) { echo $roster->auth->getLoginForm($addon['config']['forum_start_topic']); return; //To the addon framework } include $addon['dir'] . 'inc/function.lib.php'; $functions = new forum(); $x = $functions->getCrumbsa($_GET['id']); // Assign template vars $roster->tpl->assign_vars(array('S_ADD_TOPIC' => false, 'CRUMB' => $x, 'U_BACK' => makelink('guild-forum'), 'S_HTML_ENABLE' => false, 'S_TOPIC_HTML' => $addon['config']['forum_html_posts'], 'S_POSTER' => $_COOKIE['roster_user'], 'S_TOPIC_ACCESS' => $roster->auth->rosterAccess(array('name' => 'access', 'value' => '0')), 'U_FORMACTION' => makelink('guild-forum-forum&id=' . $_GET['id']))); if ($addon['config']['forum_html_posts'] >= 0) { $roster->tpl->assign_var('S_HTML_ENABLE', true); } if ($addon['config']['forum_nicedit'] > 0) { roster_add_js('js/nicEdit.js'); roster_add_js('bkLib.onDomLoaded(function() { nicEditors.allTextAreas({xhtml : true, fullPanel : true, iconsPath : \'' . $roster->config['img_url'] . 'nicEditorIcons.gif\'}) });', 'inline', 'header', false, false); } $roster->tpl->set_filenames(array('topic' => $addon['basename'] . '/topic_new.html')); $roster->tpl->display('topic');
/** * Displays the discussion page. * @param forum_discussion $discussion Discussion */ public function print_discussion_page($discussion) { $previousread = (int) $discussion->get_time_read(); // 'Read date' option (used when viewing all posts so that they keep // their read/unread colouring) $timeread = optional_param('timeread', 0, PARAM_INT); if ($timeread) { $discussion->pretend_time_read($timeread); $previousread = $timeread; } // 'Expand all' option (always chosen for non-JS browsers) $expandall = optional_param('expand', 0, PARAM_INT) || forum_utils::is_bad_browser(); // 'Expand all' option (always chosen for non-JS browsers) $collapseall = optional_param('collapse', 0, PARAM_INT); // Magic expand tracker (for use in JS only, never set server-side). // This tracks expanded posts, and makes the Back button 'work' in // the sense that it will expand these posts again. print '<form method="post" action="."><div>' . '<input type="hidden" id="expanded_posts" name="expanded_posts" ' . 'value="" /></div></form>'; // Get content for all posts in the discussion $options = array(); if ($expandall) { $options[forum_post::OPTION_CHILDREN_EXPANDED] = true; } if ($collapseall) { $options[forum_post::OPTION_CHILDREN_COLLAPSED] = true; } $content = $this->display_discussion($discussion, $options); // Some post display options use the read time to construct links // (usually for non-JS version) so that unread state is maintained. $options[forum_post::OPTION_READ_TIME] = $previousread; // Display expand all option if there are any 'Expand' links in content $fakedate = '&timeread=' . $previousread; print '<div id="forumng-expandall">'; $showexpandall = preg_match('~<a [^>]*href="discuss\\.php\\?d=[0-9]+[^"]*&expand=1#p[0-9]+">~', $content); $showcollapseall = preg_match('~<div class="forumng-post forumng-full.*<div class="forumng-post forumng-full~s', $content); if ($showexpandall) { print '<a href="' . $discussion->get_url(forum::PARAM_HTML) . '&expand=1' . $fakedate . '">' . get_string('expandall', 'forumng') . '</a>'; if ($showcollapseall) { print ' • '; } } if ($showcollapseall) { print '<a href="' . $discussion->get_url(forum::PARAM_HTML) . '&collapse=1' . $fakedate . '">' . get_string('collapseall', 'forumng') . '</a> '; } print '</div>'; // Display content print $content; // Print reply/edit forms for AJAX print $this->display_ajax_forms($discussion->get_forum()); // Link back to forum print $discussion->display_link_back_to_forum(); // Display discussion features (row of buttons) print $discussion->display_discussion_features(); // Display the subscription options to this disucssion if available print $discussion->display_subscribe_options(); // Atom/RSS links print $discussion->display_feed_links(); // Set read data [shouldn't this logic be somewhere else as it is not // part of display?] if (forum::mark_read_automatically()) { $discussion->mark_read(); } }
$draftid = optional_param('draft', 0, PARAM_INT); if ($draftid) { $draft = forum_draft::get_from_id($draftid); if (!$draft->is_reply() || $draft->get_discussion_id() != $discussionid) { print_error('draft_mismatch', 'forumng', $forum->get_url(forum::PARAM_HTML)); } $root = $discussion->get_root_post(); $inreplyto = $root->find_child($draft->get_parent_post_id(), false); if (!$inreplyto || !$inreplyto->can_reply($whynot) || !$discussion->can_view()) { print_error('draft_cannotreply', 'forumng', $forum->get_url(forum::PARAM_HTML), get_string($whynot, 'forumng')); } $inreplyto->force_expand(); $draftplayspaceid = 0; if ($draft->has_attachments()) { $draftplayspaceid = forum::create_attachment_playspace(); $target = forum::get_attachment_playspace_folder($draftplayspaceid); $source = $draft->get_attachment_folder(); foreach ($draft->get_attachment_names() as $name) { forum_utils::copy("{$source}/{$name}", "{$target}/{$name}"); } } } // Check that discussion can be viewed [Handles all other permissions] $discussion->require_view(); // Search form for header $buttontext = $forum->display_search_form(); // Atom header meta tag $feedtype = $forum->get_effective_feed_option(); if ($feedtype == forum::FEEDTYPE_ALL_POSTS) { $atomurl = $discussion->get_feed_url(forum::FEEDFORMAT_ATOM); $meta = '<link rel="alternate" type="application/atom+xml" ' . 'title="Atom feed" href="' . htmlspecialchars($atomurl) . '" />';
$id = required_param('id', PARAM_INT); // On the view page ONLY we allow a default for the clone parameter that won't // cause an error if it's omitted. All other pages have default 0, which will // show up any errors caused if the parameter is omitted somewhere. $cloneid = optional_param('clone', forum::CLONE_DIRECT, PARAM_INT); try { // Construct forum variable (will check id is valid) $forum = forum::get_from_cmid($id, $cloneid); $course = $forum->get_course(); $cm = $forum->get_course_module(); // If this is a clone, redirect to original if ($forum->is_clone()) { $forum->redirect_to_original(); } // Check that forum can be viewed [Handles all other permissions] $groupid = forum::get_activity_group($cm, true); $forum->require_view($groupid, 0, true); // Get update button, if allowed for current user $strforum = get_string("modulename", "forum"); $buttontext = $forum->display_search_form(); // Atom header meta tag $feedtype = $forum->get_effective_feed_option(); if ($feedtype == forum::FEEDTYPE_DISCUSSIONS || $feedtype == forum::FEEDTYPE_ALL_POSTS && $forum->can_view_discussions()) { $atomurl = $forum->get_feed_url(forum::FEEDFORMAT_ATOM, $groupid); $meta = '<link rel="alternate" type="application/atom+xml" ' . 'title="Atom feed" href="' . htmlspecialchars($atomurl) . '" />'; } else { $meta = ''; } // Initialize $PAGE, compute blocks require_once $CFG->dirroot . '/mod/forumng/pagelib.php'; global $CURRENTFORUM;
function dolist() { $id = (int) $_GET['id']; $fid = (int) $_GET['fid']; $tagName = iCMS_DB::getValue("SELECT name FROM #iCMS@__tags WHERE id='{$id}'"); $forum = new forum(); $sql = '#iCMS@__article.id = `indexId`'; $_GET['keywords'] && ($sql .= " AND `title` REGEXP '{$_GET['keywords']}'"); isset($_GET['nopic']) && ($sql .= " AND `isPic` ='0'"); $_GET['starttime'] && ($sql .= " and `pubdate`>='" . strtotime($_GET['starttime']) . "'"); $_GET['endtime'] && ($sql .= " and `pubdate`<='" . strtotime($_GET['endtime']) . "'"); isset($_GET['at']) && $_GET['at'] != '-1' && ($sql .= " AND `type` ='" . $_GET['at'] . "'"); isset($_GET['keyword']) && ($uri .= '&keyword=' . $_GET['keyword']); $fid = Admin::CP($fid) ? $fid : "0"; if ($fid) { $cidIN = $forum->fid($fid) . $fid; if (isset($_GET['sub']) && strstr($cidIN, ',')) { $sql .= " AND fid IN(" . $cidIN . ")"; } else { $sql .= " AND fid ='{$fid}'"; } } else { Admin::$cpower && ($sql .= " AND fid IN(" . implode(',', (array) Admin::$cpower) . ")"); } $maxperpage = (int) $_GET['perpage'] > 0 ? $_GET['perpage'] : 20; $total = $page == 1 || empty($_GET['rowNum']) ? iCMS_DB::getValue("SELECT count(#iCMS@__article.id) FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE `tid`='" . $id . "' AND {$sql}") : (int) $_GET['rowNum']; page($total, $maxperpage, "篇文章"); $rs = iCMS_DB::getArray("SELECT #iCMS@__article.* FROM `#iCMS@__article`,`#iCMS@__taglist` WHERE `tid`='" . $id . "' AND {$sql} ORDER BY #iCMS@__taglist.indexId DESC LIMIT {$this->firstcount} , {$maxperpage}"); $_count = count($rs); include admincp::tpl('tag.list'); }
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/base.php'; require '../structure/user.php'; require '../structure/forum.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $forum = new forum($database); $user->updateLastActive(); $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); if ($rank < 4) { $base->redirect('../index.php'); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns:IE> <head> <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <title><?php echo $data['wb_title']; ?> </title> <link href="../css/basic-3.css" rel="stylesheet" type="text/css" media="all"> <link href="../css/admin.css" rel="stylesheet" type="text/css" media="all">
function form($A, $rs = array(), $isUser = false) { $id = $A['field']; $val = $rs[$id] ? $rs[$id] : ''; $mId = $rs['mid']; $mName = $rs['mName']; $option = unserialize($A['option']); $optStr = $option[$A['type']]; if ($optStr) { $_optArray = explode("\n", $optStr); foreach ($_optArray as $k => $optA) { list($index, $choice) = explode("=", $optA); $optArray[trim($index)] = trim($choice); } } if ($A['hidden']) { $FORM['hidden'] = '<input type="hidden" name="content[' . $id . ']" id="' . $id . '" value="' . $val . '" />'; } else { //判读是否为特殊字段 if (in_array($A['field'], array('fid', 'type', 'vlink'))) { switch ($A['field']) { case "fid": $forum = new forum(); $cata_option = $isUser ? $forum->user_select($val, 0, 1, 1, $mId) : $forum->select($val, 0, 1, NULL, $mId); if ($cata_option) { $html = '<select name="content[fid]" id="fid" style="width:auto;">'; $html .= '<option value="0"> == 请选择所属栏目 == </option>'; $html .= $cata_option; } else { if ($isUser) { $html = '<select name="content[fid]" id="fid">'; $html .= '<option value="0"> == 暂无栏目 == </option>'; } else { $html = '<select name="content[fid]" id="fid" onclick="window.location.replace(\'' . __ADMINCP__ . '=forums&do=add\');">'; $html .= '<option value="0"> == 暂无栏目请先添加 == </option>'; } } $html .= '</select>'; break; case "type": $html = '<select name="content[type]"id="type">'; $html .= '<option value="0">默认属性[type=\'0\']</option>'; $html .= contentype($mName, $val); $html .= '</select>'; break; case "vlink": $forum = new forum(); $html = '<select name="content[vlink][]" size="10" multiple="multiple" id="vlink">'; $html .= $isUser ? $forum->user_select($val, 0, 1, 1, $mId) : $forum->select($val, 0, 1, 'all', $mId); $html .= '</select>'; $html .= selected($val, 'vlink', 'js'); break; // case in_array($A['field'],array('hits','digg','comments','status','postype')): break; } } else { switch ($A['type']) { case in_array($A['type'], array('number', 'text', 'email', 'url')): $html = '<input type="text" name="content[' . $id . ']" class="txt" id="' . $id . '" value="' . $val . '" />'; break; case "radio": foreach ((array) $optArray as $value => $text) { $checked = $value == $val ? ' checked="checked"' : ''; $html .= ' <input type="radio" name="content[' . $id . ']" class="radio" id="' . $id . '" value="' . $value . '" /> ' . $text; } break; case "checkbox": $valArray = explode(',', $val); foreach ((array) $optArray as $value => $text) { $checked = in_array($value, $valArray) ? ' checked="checked"' : ''; $html .= ' <input type="checkbox" name="content[' . $id . '][]" class="checkbox" id="' . $id . '.' . $value . '" value="' . $value . '" ' . $checked . '/> ' . $text; } break; case "textarea": $html = '<textarea name="content[' . $id . ']" id="' . $id . '" onKeyUp="textareasize(this)" class="tarea">' . $val . '</textarea>'; break; // case "editor": // $html='<script type="text/javascript" src="editor/fckeditor.js"></script> //<script type="text/javascript" src="admin/js/plus_format_fck.js"></script><select class="BP"> // <option value="1">第 1 页</option> // </select><input type="button" value="新增一页" onClick="newBody();" class="button"> //<iframe id="rtf" style="width: 0px; height: 0px;" marginwidth="0" marginheight="0" src="about:blank" scrolling="no"></iframe> // <label for="x_paste"></label> // <script>rtf.document.designMode="On";</script> // <input type="button" name="formatbutton" value="粘贴排版" onclick="trans(iCMS.eId);" class="button"> // <input type="button" name="formatbutton_img" value="自动排版" onClick="FormatImages(iCMS.eId)" class="button"> // <input type="button" value="批量上传" onClick="multiUpload();" class="button"> // <input type="button" value="插入图片" onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=file&click=file&type=gif,jpg,png,bmp,jpeg&from=editor\',\'iCMSEDITOR\',\'从网站选择\');" class="button"> //<div id="iBody_1" class="nb"> // <textarea id="iEditor_1" name="content['.$id.'][]" cols="80" rows="20" style="display:none">'.$val.'</textarea> // <input type="hidden" id="iEditor_1___Config" value="" style="display:none" /> // <iframe id="iEditor_1___Frame" src="./editor/fckeditor.html?InstanceName=iEditor_1&Toolbar=Default" width="100%" height="500" frameborder="0" scrolling="no"></iframe> // </div>'; // break; // case "editor": // $html='<script type="text/javascript" src="editor/fckeditor.js"></script> //<script type="text/javascript" src="admin/js/plus_format_fck.js"></script><select class="BP"> // <option value="1">第 1 页</option> // </select><input type="button" value="新增一页" onClick="newBody();" class="button"> //<iframe id="rtf" style="width: 0px; height: 0px;" marginwidth="0" marginheight="0" src="about:blank" scrolling="no"></iframe> // <label for="x_paste"></label> // <script>rtf.document.designMode="On";</script> // <input type="button" name="formatbutton" value="粘贴排版" onclick="trans(iCMS.eId);" class="button"> // <input type="button" name="formatbutton_img" value="自动排版" onClick="FormatImages(iCMS.eId)" class="button"> // <input type="button" value="批量上传" onClick="multiUpload();" class="button"> // <input type="button" value="插入图片" onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=file&click=file&type=gif,jpg,png,bmp,jpeg&from=editor\',\'iCMSEDITOR\',\'从网站选择\');" class="button"> //<div id="iBody_1" class="nb"> // <textarea id="iEditor_1" name="content['.$id.'][]" cols="80" rows="20" style="display:none">'.$val.'</textarea> // <input type="hidden" id="iEditor_1___Config" value="" style="display:none" /> // <iframe id="iEditor_1___Frame" src="./editor/fckeditor.html?InstanceName=iEditor_1&Toolbar=Default" width="100%" height="500" frameborder="0" scrolling="no"></iframe> // </div>'; // break; case "editor": global $iCMS; include iPATH . "include/fckeditor.php"; $editor = new FCKeditor('content[' . $id . ']'); $editor->BasePath = $iCMS->config['publicURL']; $editor->ToolbarSet = $isUser ? 'User' : 'Default'; $editor->Value = $val; //$html='<script type="text/javascript" src="'.$iCMS->config['publicURL'].'/ui/editor/fckeditor.js"></script>'; $html = $editor->CreateHtml(); break; case "select": $html = '<select name="content[' . $id . ']" id="' . $id . '" style="width:auto;">'; $html .= '<option value="0"> == 不选择 == </option>'; foreach ((array) $optArray as $value => $text) { $selected = $value == $val ? ' selected="selected"' : ''; $html .= '<option value="' . $value . '"' . $selected . '>' . $text . '</option>'; } $html .= '</select>'; break; case "multiple": $html = '<select name="content[' . $id . '][]" id="' . $id . '" style="width:auto;" size="10" multiple="multiple">'; $html .= '<option value="0"> == 不选择 == </option>'; $valArray = explode(',', $val); foreach ((array) $optArray as $value => $text) { $selected = in_array($value, $valArray) ? ' selected="selected"' : ''; $html .= '<option value="' . $value . '"' . $selected . '>' . $text . '</option>'; } $html .= '</select>'; break; case "calendar": $html = '<input name="content[' . $id . ']" class="txt datepicker" value="' . get_date($val, 'Y-m-d H:i:s') . '" id="' . $id . '" type="text"/>'; break; // case "image": // $html='<input name="content['.$id.']" id="image_'.$id.'" type="text" value="'.$val.'" class="txt" style="width:450px"/>'; // $html.='<button type="button" class="selectdefault button" hidefocus=true to="image_'.$id.'"><span>选 择</span></button>'; // $html.='<div id="image_'.$id.'_menu" style="display:none;">'; // $html.='<ul>'; // $html.='<li onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=Aupload\',\'image_'.$id.'\',\'本地上传\',400,150);">本地上传</li>'; // $html.='<li onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=file&click=file&type=gif,jpg,png,bmp,jpeg\',\'image_'.$id.'\',\'从网站选择\');">从网站选择</li>'; // $html.='<li onClick="viewPic(\'image_'.$id.'\');">查看缩略图</li>'; // $html.='<li onClick="crop(\'image_'.$id.'\');">剪裁图片</li>'; // $html.='</ul></div>'; // break; // case "image": // $html='<input name="content['.$id.']" id="image_'.$id.'" type="text" value="'.$val.'" class="txt" style="width:450px"/>'; // $html.='<button type="button" class="selectdefault button" hidefocus=true to="image_'.$id.'"><span>选 择</span></button>'; // $html.='<div id="image_'.$id.'_menu" style="display:none;">'; // $html.='<ul>'; // $html.='<li onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=Aupload\',\'image_'.$id.'\',\'本地上传\',400,150);">本地上传</li>'; // $html.='<li onClick="iCMS.showDialog(\''.__ADMINCP__.'=dialog&do=file&click=file&type=gif,jpg,png,bmp,jpeg\',\'image_'.$id.'\',\'从网站选择\');">从网站选择</li>'; // $html.='<li onClick="viewPic(\'image_'.$id.'\');">查看缩略图</li>'; // $html.='<li onClick="crop(\'image_'.$id.'\');">剪裁图片</li>'; // $html.='</ul></div>'; // break; case "upload": $html = '<div id="' . $id . '1" style="display:' . ($val ? 'none' : 'block') . ';"><input id="' . $id . 'file" name="content_upload_' . $id . '" type="file" style="width:600px;" /><span id="c' . $id . '1" style="display:' . ($val ? '' : 'none') . '">[<a href="javascript:iCMS.SH(\'' . $id . '2\',\'' . $id . '1\');">取消</a>]</span></div> <div id="' . $id . '2" style="display:' . ($val ? 'block' : 'none') . '"><a class="content_viewPic" ref="' . $id . '" href="javascript:void(0);" title="点击查看图片">' . $val . '</a><input name="content[' . $id . ']" type="text" value="' . $val . '" class="txt content_upload_' . $id . '" style="display:none;"/> [<a href="javascript:iCMS.SH(\'' . $id . '1\',\'' . $id . '2\');">重新上传</a>] [<a href="' . ($isUser ? __USERCP__ : __ADMINCP__) . '=content&do=delpic&mid=' . $mId . '&table=' . $mName . '&id=' . $rs['id'] . '&field=' . $id . '&fp=' . $val . '" target="iCMS_FRAME">删除</a>]</div><script type="text/javascript"> $(".content_viewPic").click(function(){ var path =$(\'.content_upload_\'+$(this).attr(\'ref\')).val(); iCMS.showDialog("' . ($isUser ? __USERCP__ : __ADMINCP__) . '=dialog&do=viewPic",path,\'查看图片\'); });</script>'; break; } } if ($A['show'] || !$isUser) { $FORM['general'] = array('id' => $id, 'label' => $A['name'], 'description' => $A['description'], 'html' => $html); } } if (!model::isDefField($id)) { $valal = '$("#' . $id . '").val()'; //验证 switch ($A['validate']) { case "0": //不能为空 if ($A['type'] == "editor") { $js = 'var ' . $id . '_Editor = FCKeditorAPI.GetInstance(\'content[' . $id . ']\') ; if(' . $id . '_Editor.GetXHTML( true )==""){ alert("' . $A['name'] . '不能为空!"); ' . $id . '_Editor.focus(); return false; }'; } else { $js = 'if(' . $valal . '==""){ alert("' . $A['name'] . '不能为空!"); $("#' . $id . '").focus(); return false;}'; } break; case "2": $js = 'var ' . $id . '_val = ' . $valal . '; var pattern = /^\\d+(\\.\\d+)?$/; chkFlag = pattern.test(' . $id . '_val); if(!chkFlag){ alert("' . $A['name'] . '不是数字"); $("#' . $id . '").focus(); return false;}'; break; case "4": $js = 'var ' . $id . '_val = ' . $valal . '; var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\\.[a-zA-Z0-9_-])+/; if(!pattern.test(' . $id . '_val)){ alert("邮箱地址的格式不正确!!"); $("#' . $id . '").focus(); return false;}'; break; case "5": $js = 'var ' . $id . '_val = ' . $valal . '; var pattern = /^[a-zA-z]+:\\/\\/[^\\s]*/; if(!pattern.test(' . $id . '_val)){ alert("[' . $A['name'] . ']网址格式不正确!!"); $("#' . $id . '").focus(); return false;}'; break; } } if ($A['show'] || !$isUser) { $FORM['js'] = $js; } // var_dump($FORM); // var_dump($A); return $FORM; }
<?php include $addon['dir'] . 'inc/function.lib.php'; $functions = new forum(); if (isset($_POST['type']) && !empty($_POST['type'])) { $op = isset($_POST['op']) ? $_POST['op'] : ''; $id = isset($_POST['id']) ? $_POST['id'] : $_GET['id']; switch ($_POST['type']) { case 'newTopic': createTopic(); break; case 'unlock': processLock($id, 0); break; case 'lock': processLock($id, 1); break; default: break; } } function processLock($id, $mode) { global $roster, $addon, $installer; $query = "UPDATE `" . $roster->db->table('forums', $addon['basename']) . "` SET `locked` = '{$mode}' WHERE `forum_id` = '" . $id . "';"; $result = $roster->db->query($query); if (!$result) { $roster->set_message('Database Error: ' . $roster->db->error() . '<br />SQL: ' . $query); } else { if ($mode == 1) { $roster->set_message($roster->locale->act['f_lock']);
<?php /** * WoWRoster.net WoWRoster * * @copyright 2002-2011 WoWRoster.net * @license http://www.gnu.org/licenses/gpl.html Licensed under the GNU General Public License v3. * @package News */ if (!defined('IN_ROSTER')) { exit('Detected invalid access to this file!'); } if (!$roster->auth->getAuthorized($addon['config']['forum_reply_post'])) { echo $roster->auth->getLoginForm($addon['config']['forum_reply_post']); return; //To the addon framework } include $addon['dir'] . 'inc/function.lib.php'; $functions = new forum(); $x = $functions->getCrumbsb($_GET['tid']); // Assign template vars $roster->tpl->assign_vars(array('S_ADD_TOPIC' => false, 'CRUMB' => $x, 'U_BACK' => makelink('guild-' . $addon['basename'] . '-topic_reply&tid=' . $_GET['tid']), 'S_HTML_ENABLE' => false, 'S_TOPIC_HTML' => $addon['config']['forum_html_posts'], 'S_POSTER' => $_COOKIE['roster_user'], 'U_FORMACTION' => makelink('guild-' . $addon['basename'] . '-topic&tid=' . $_GET['tid']))); if ($addon['config']['forum_html_posts'] >= 0) { $roster->tpl->assign_var('S_HTML_ENABLE', true); if ($addon['config']['forum_nicedit'] > 0) { roster_add_js('js/nicEdit.js'); roster_add_js('bkLib.onDomLoaded(function() { nicEditors.allTextAreas({xhtml : true, fullPanel : true, iconsPath : \'' . $roster->config['img_url'] . 'nicEditorIcons.gif\'}) });', 'inline'); } } $roster->tpl->set_filenames(array('topic' => $addon['basename'] . '/post_reply.html')); $roster->tpl->display('topic');
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/base.php'; require '../structure/forum.php'; require '../structure/forum.index.php'; require '../structure/user.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $forum = new forum($database); $forum_index = new forum_index($database); $user = new user($database); $user->updateLastActive(); $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); if ($rank < 4) { $base->redirect('../index.php'); } if (!isset($_REQUEST['cat'])) { $content = ' <form action="editcat.php" method="POST"> <select name="cat" class="button">'; foreach ($forum_index->retrieveCategories($rank) as $category) { $content .= '<option value="' . $category['id'] . '">' . $category['title'] . '</option>'; } $content .= '<input type="submit" value="Edit"></select></form>'; } else { //make sure it exists if (!$forum->catExists($_REQUEST['cat'])) { $content = 'No category exists with the given ID.';
/** * **************************************************** * UPDATE * **************************************************** */ function update() { codebase_query(Lang::item('admin.update'), 'plugins' . DS . 'forum' . DS . 'sql' . DS . 'update.sql'); forum::message(Lang::item('common.message'), Lang::item('admin.update_success'), 'forum.php?c=admin', 3); }
<?php require '../includes/config.php'; require '../structure/database.php'; require '../structure/forum.php'; require '../structure/forum.thread.php'; require '../structure/base.php'; require '../structure/user.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $base = new base($database); $user = new user($database); $forum = new forum($database); $thread_obj = new thread($database); $user->updateLastActive(); //make sure required data is in the correct format AND they're logged in if (!$user->isLoggedIn() || !ctype_digit($_REQUEST['forum']) || !ctype_digit($_REQUEST['id']) || !ctype_digit($_REQUEST['type']) || !ctype_digit($_REQUEST['pid']) && $_REQUEST['type'] == 1) { $base->redirect('index.php'); } //set some variables that are used a lot throughout the page $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); $f = $_REQUEST['forum']; $thread = $_REQUEST['id']; //instead of typing it a million times, we're going to set our redirect url $redirect = 'viewthread.php?forum=' . $f . '&id=' . $thread; //make sure they are posting in a forum where they have permission if ($user->checkMute($username) || !$thread_obj->canView($thread, $username, $rank) || !$thread_obj->canReply($thread, $rank)) { $base->redirect($redirect); } //extract content for the set type $data = $_REQUEST['type'] == 1 ? $database->processQuery("SELECT `content`,`username`,`status` FROM `posts` WHERE `id` = ?", array($_REQUEST['pid']), true) : $database->processQuery("SELECT `username`,`content`,`status`,`title` FROM `threads` WHERE `id` = ?", array($thread), true);
<?php require '../includes/config.php'; require '../structure/forum.php'; require '../structure/forum.index.php'; require '../structure/database.php'; require '../structure/user.php'; $database = new database($db_host, $db_name, $db_user, $db_password); $user = new user($database); $forum = new forum($database); $forum_index = new forum_index($database); $user->updateLastActive(); //set some variables that are used a lot throughout the page $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns:IE> <head> <meta http-equiv="Expires" content="0"> <meta http-equiv="Pragma" content="no-cache"> <meta http-equiv="Cache-Control" content="no-cache"> <meta name="MSSmartTagsPreventParsing" content="TRUE"> <title><?php echo $data['wb_title']; ?> </title> <link href="../css/basic-3.css" rel="stylesheet" type="text/css" media="all" /> <link href="../css/forum-3.css" rel="stylesheet" type="text/css" media="all" /> <link rel="shortcut icon" href="../img/favicon.ico" />
function dosave() { include_once iPATH . 'include/tag.class.php'; $id = $_POST['id']; $mid = $_POST['mid']; $FArray = model::field($mid); $model = model::data($mid); $content = array(); if ($_POST['content']) { foreach ($_POST['content'] as $field => $value) { if (model::isDefField($field)) { switch ($field) { case "userid": $value = intval($value); break; case "fid": $value = $fid = intval($value); empty($value) && javascript::alert('请选择所属栏目'); break; case "orderNum": $value = _int($value); break; case "top": $value = _int($value); break; case "title": $value = dhtmlspecialchars($value); empty($value) && javascript::alert('标题不能为空!'); break; case "editor": $value = dhtmlspecialchars($value); break; case "tags": $value = iTAG::split(dhtmlspecialchars($value), true); break; case "type": $value = intval($value); break; case "vlink": $value = implode(',', $value); break; case "postype": $value = empty($value) ? intval($value) : "1"; break; case "pubdate": $value = _strtotime($value); break; case "clink": $value = dhtmlspecialchars($value); if ($value) { $clinklen = strlen($value); for ($i = 0; $i < $clinklen; $i++) { !preg_match("/[a-zA-Z0-9_\\-~" . preg_quote($this->iCMS->config['CLsplit'], '/') . "]/", $value[$i]) && javascript::alert('自定链接只能由英文字母、数字或_-~组成(不支持中文)'); } } break; } } elseif ($F = $FArray[$field]) { switch ($F['type']) { case "number": $value = intval($value); break; case "calendar": $value = _strtotime($value); break; case in_array($F['type'], array('text', 'textarea', 'radio', 'select', 'email', 'url', 'image', 'upload')): $value = dhtmlspecialchars($value); break; case in_array($F['type'], array('checkbox', 'multiple')): $value = implode(',', $value); break; case 'editor': $this->iCMS->config['autoformat'] && ($value = autoformat($value)); break; default: $value = dhtmlspecialchars($value); } } WordFilter($value) && javascript::alert($field . '字段包含被系统屏蔽的字符,请返回重新填写。'); $content[$field] = $value; $PF[] = $field; } } if (empty($content['clink'])) { include iPATH . 'include/cn.class.php'; $content['clink'] = CN::pinyin($content['title'], $this->iCMS->config['CLsplit']); } $table = model::tbn($_POST['table']); $MF = explode(',', $model['field']); $diff = array_diff_values($PF, $MF); if ($diff['-']) { foreach ($diff['-'] as $field) { $content[$field] = ''; } } //缺少的字段 填认空值 $SELFURL = __SELF__ . (empty($_POST['REFERER']) ? '?mo=content&do=manage' : $_POST['REFERER']); $forum = new forum(); if (empty($id)) { empty($content['userid']) && ($content['userid'] = member::$uId); $content['hits'] = $content['good'] = $content['bad'] = $content['comments'] = 0; $content['status'] = "1"; $checkCL = iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__{$table}` where `clink` ='" . $content['clink'] . "'"); if ($this->iCMS->config['repeatitle']) { iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__{$table}` where `title` = '{$title}'") && alert('该标题内容已经存在!请检查是否重复'); $checkCL && javascript::alert('该自定链接已经存在!请另选一个'); } else { $checkCL && ($clink .= $this->iCMS->config['CLsplit'] . random(6, 1)); } iCMS_DB::insert($table, $content); $id = iCMS_DB::$insert_id; model::upload($table, $id, $title); iTAG::add($content['tags'], $content['userid'], $id, $forum->rootid($fid), $mid); $vlink = empty($content['vlink']) ? $fid : $content['vlink'] . ',' . $fid; vlinkDiff($vlink, '', $id, $mid); if (!strstr($forum->forum[$fid]['contentRule'], '{PHP}') && !$forum->forum[$fid]['url'] && $forum->forum[$fid]['mode'] == "1" && $content['status']) { include iPATH . 'include/iHtml.class.php'; iHtml::content($id, $mid, $table); iHtml::forum($fid, 1, 0, 1); } iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count+1 WHERE `fid` ='{$fid}' LIMIT 1 "); // $moreaction=array( // array("text"=>"编辑该内容","url"=>__SELF__."?do=content&operation=add&table=".$table."&mid=".$mid."&id=".$id), // array("text"=>"继续添加内容","url"=>__SELF__."?do=content&operation=add&table=".$table."&mid=".$mid."&cid=".$cid), // array("text"=>"查看该内容","url"=>$iCMS->iurl('content',array('mId'=>$mid,'id'=>$id,'link'=>$clink,'pubdate'=>$pubdate,'cid'=>$cid,'dir'=>$catalog->catalog[$cid]['dir'],'domain'=>$catalog->catalog[$cid]['domain'],'htmlext'=>$catalog->catalog[$cid]['htmlext']))->href,"o"=>'target="_blank"'), // array("text"=>"查看网站首页","url"=>"../index.php","o"=>'target="_blank"') // ); javascript::dialog("添加完成!", 'url:' . __SELF__ . "?mo=content&do=manage&table=" . $table . "&mid=" . $mid); } else { $checkCL = iCMS_DB::getValue("SELECT `id` FROM `#iCMS@__{$table}` where `clink` ='{$clink}' AND `id` !='{$id}'"); if ($this->iCMS->config['repeatitle']) { $checkCL && alert('该自定链接已经存在!请另选一个'); } else { $checkCL && ($clink .= $this->iCMS->config['CLsplit'] . random(6, 1)); } $art = iCMS_DB::getRow("SELECT `fid`,`tags`,`vlink` FROM `#iCMS@__{$table}` where `id` ='{$id}'"); iTAG::diff($content['tags'], member::$uId, $art->tags, $id, $forum->rootid($fid)); iCMS_DB::update($table, $content, array('id' => $id)); model::upload($table, $id, $title); $vlink = empty($content['vlink']) ? $fid : $content['vlink'] . ',' . $fid; vlinkDiff($vlink, $art->vlink, $id); if (!strstr($forum->forum[$fid]['contentRule'], '{PHP}') && !$forum->forum[$fid]['url'] && $forum->forum[$fid]['mode'] == "1" && $status) { include iPATH . 'include/iHtml.class.php'; iHtml::content($id, $mid, $table); iHtml::forum($fid, 1, 0, 1); } if ($art->fid != $fid) { iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count-1 WHERE `fid` ='{$art->fid}' LIMIT 1 "); iCMS_DB::query("UPDATE `#iCMS@__forum` SET `count` = count+1 WHERE `fid` ='{$fid}' LIMIT 1 "); } javascript::dialog('编辑完成!<br />3秒后返回项目列表', 'url:' . $SELFURL); } }
* @package forumNG */ require_once '../../../../config.php'; require_once $CFG->dirroot . '/mod/forumng/forum.php'; $cmid = required_param('id', PARAM_INT); $cloneid = optional_param('clone', 0, PARAM_INT); try { $forum = forum::get_from_cmid($cmid, $cloneid); $course = $forum->get_course(); $cm = $forum->get_course_module(); $context = $forum->get_context(); if ($forum->is_shared() || $forum->is_clone()) { throw new forum_exception("<strong>View post by user</strong> doesn't work for a shared forum."); } // Check forum access (using forum group, if required) $forumgroupid = forum::get_activity_group($cm, false); $forum->require_view($forumgroupid); // TODO: Use/define a more accurate capability. This will do for now. require_capability('mod/forumng:viewallposts', $forum->get_context()); // Print page header $forum->print_subpage_header(get_string('userposts', 'forumng')); // This section uses custom groups rather than the normal forum groups. // We are using the groups that are set for the course and not the ones // for the forum. This is because we want it so that even if the forum // does not have groups, or it has weird groups, the control for who can // see which posts is based on the 'real' tutor group which should be // defined at course level. $groups = null; if ($course->groupmode) { // Get groups. Because the logic for this is slightly weird (we're // using course groups regardless of activity group setting; etc) it
function unnotify() { $vars = array(); $errors = array(); $vars['topic_id'] = $this->validate->get->getInt('id'); $this->forum->unnotify_topic($vars['topic_id']); forum::redirect(forum::link('topic', '', $vars['topic_id'])); }
<?php /************************************************** Coppermine 1.5.x Plugin - forum ************************************************* Copyright (c) 2010 foulu (Le Hoai Phuong), eenemeenemuu ************************************************* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. ******************************************** $HeadURL$ $Revision$ $LastChangedBy$ $Date$ **************************************************/ pageheader($fr_title ? $fr_title : Config::item('fr_title')); print html::spacer(); print table::open(0); print table::tds(array(array('text' => $fr_title ? $fr_title : Config::item('fr_title')), array('align' => 'right', 'text' => ($authorizer->is_user() ? html::button('forum.php?c=profile', Lang::item('home.fr_profile')) : '') . NBSP . html::button('forum.php?c=search', Lang::item('home.search'))))); print table::close(); print html::spacer(); print table::open(); print form::hidden('c', 'search'); print table::tds(array(array('class' => 'tableb', 'text' => html::span(forum::nagavitor($nagavitor))))); print table::close(); print html::spacer(); print $fr_contents; pagefooter();
<?php require_once '../../../../config.php'; require_once $CFG->dirroot . '/mod/forumng/forum.php'; $d = required_param('d', PARAM_INT); $target = required_param('target', PARAM_INT); $cloneid = optional_param('clone', 0, PARAM_INT); if (!$target) { print_error('move_notselected', 'forumng'); } try { $discussion = forum_discussion::get_from_id($d, $cloneid); // Get target forum $targetforum = forum::get_from_cmid($target, forum::CLONE_DIRECT); // If it is a clone, find the original $targetforum = $targetforum->get_real_forum(); // Check permission for move $discussion->require_view(); require_capability('mod/forumng:movediscussions', $discussion->get_forum()->get_context()); require_capability('mod/forumng:movediscussions', $targetforum->get_context()); $aag = has_capability('moodle/site:accessallgroups', $targetforum->get_context()); // Work out target group for move $targetgroup = $discussion->get_group_id(); if ($targetforum->get_group_mode() == 0 || !$targetgroup && $aag && $discussion->get_forum()->get_group_mode() != 0) { // Either target forum doesn't have groups, or it does have groups but // so does the source forum and this is already an all-groups post, // and you have access all groups, so it can be all-groups $targetgroup = null; } else { // Target forum has groups :( Need to decide a group if ($targetgroup && $targetforum->get_grouping() != $discussion->get_forum()->get_grouping()) {
function doforums($op = 'html') { $hasChildren = $_GET['hasChildren'] ? true : false; $forum = new forum(); echo $forum->json($_GET["root"], $op, $hasChildren); }
$cloneid = optional_param('clone', 0, PARAM_INT); // User identification $userid = required_param('user', PARAM_INT); $key = required_param('key', PARAM_ALPHANUM); // Feed format $format = required_param('format', PARAM_ALPHA); $rss = $format == 'rss'; try { // Load forum if ($d) { $discussion = forum_discussion::get_from_id($d, $cloneid); $forum = $discussion->get_forum(); $groupid = $discussion->get_group_id(); $url = $discussion->get_url(forum::PARAM_PLAIN); } else { $forum = forum::get_from_cmid($cmid, $cloneid); $url = $forum->get_url(forum::PARAM_PLAIN); if ($groupid == 'unspecified') { $groupid = $forum->get_group_mode() == SEPARATEGROUPS ? forum::ALL_GROUPS : forum::NO_GROUPS; } else { $url .= '&group=' . $groupid; } } // Check it allows feeds $feedtype = $forum->get_effective_feed_option(); switch ($feedtype) { case forum::FEEDTYPE_DISCUSSIONS: if (!$d) { break; } // Fall through