本文整理汇总了PHP中forum类的典型用法代码示例。如果您正苦于以下问题:PHP forum类的具体用法?PHP forum怎么用?PHP forum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了forum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dofpower
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");
}
示例2: dofpower
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();
}
示例3: dofpower
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");
}
示例4: doUpdate
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');
}
示例5: finish
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);
}
示例6: doarticle
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();
}
示例7: display
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);
}
示例8: display
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');
}
示例9: exit
<?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();
示例10: database
<?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'])) {
示例11: exit
/**
* 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');
示例12: print_discussion_page
/**
* 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();
}
}
示例13: optional_param
$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) . '" />';
示例14: required_param
$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;
示例15: dolist
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');
}