本文整理汇总了PHP中Comments::get_forum方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::get_forum方法的具体用法?PHP Comments::get_forum怎么用?PHP Comments::get_forum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::get_forum方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: feature_home_pages
/**
* Computes the alternate homes for each feature
* (used in admin general template)
*
* @access public
* @return array of url's and labels of the alternate homepages
*/
function feature_home_pages($partial = false)
{
global $prefs, $tikilib, $commentslib;
$tikiIndex = array();
//wiki
$tikiIndex['tiki-index.php'] = tra('Wiki');
// Articles
if (!$partial && $prefs['feature_articles'] == 'y') {
$tikiIndex['tiki-view_articles.php'] = tra('Articles');
}
// Blog
if (!$partial && $prefs['feature_blogs'] == 'y') {
if ($prefs['home_blog'] != '0') {
global $bloglib;
require_once 'lib/blogs/bloglib.php';
$hbloginfo = $bloglib->get_blog($prefs['home_blog']);
$home_blog_name = substr($hbloginfo['title'], 0, 20);
} else {
$home_blog_name = tra('Set blogs homepage first');
}
$tikiIndex['tiki-view_blog.php?blogId=' . $prefs['home_blog']] = tra('Blog:') . $home_blog_name;
}
// Image gallery
if (!$partial && $prefs['feature_galleries'] == 'y') {
if ($prefs['home_gallery'] != '0') {
$hgalinfo = $tikilib->get_gallery($prefs['home_gallery']);
$home_gal_name = substr($hgalinfo["name"], 0, 20);
} else {
$home_gal_name = tra('Set Image gal homepage first');
}
$tikiIndex['tiki-browse_gallery.php?galleryId=' . $prefs['home_gallery']] = tra('Image Gallery:') . $home_gal_name;
}
// File gallery
if (!$partial && $prefs['feature_file_galleries'] == 'y') {
$filegallib = TikiLib::lib('filegal');
$hgalinfo = $filegallib->get_file_gallery($prefs['home_file_gallery']);
$home_gal_name = substr($hgalinfo["name"], 0, 20);
$tikiIndex['tiki-list_file_gallery.php?galleryId=' . $prefs['home_file_gallery']] = tra('File Gallery:') . $home_gal_name;
}
// Forum
if (!$partial && $prefs['feature_forums'] == 'y') {
require_once 'lib/comments/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments();
}
if ($prefs['home_forum'] != '0') {
$hforuminfo = $commentslib->get_forum($prefs['home_forum']);
$home_forum_name = substr($hforuminfo['name'], 0, 20);
} else {
$home_forum_name = tra('Set Forum homepage first');
}
$tikiIndex['tiki-view_forum.php?forumId=' . $prefs['home_forum']] = tra('Forum:') . $home_forum_name;
}
// Custom home
$tikiIndex['tiki-custom_home.php'] = tra('Custom home');
return $tikiIndex;
}
示例2: foreach
function action_toggle($input)
{
global $user, $tikilib, $prefs, $artlib;
if (!$user) {
throw new Services_Exception(tr('Must be authenticated'), 403);
}
$type = $input->type->none();
$object = $input->object->none();
$target = $input->target->int();
if (!$type || !$object) {
throw new Services_Exception(tr('Invalid input'), 400);
}
$relationlib = TikiLib::lib('relation');
$relations = $this->action_list($input);
if ($target) {
if (!in_array("{$type}:{$object}", $relations) && ($relationId = $relationlib->add_relation('tiki.user.favorite', 'user', $user, $type, $object))) {
$relations[$relationId] = "{$type}:{$object}";
TikiLib::lib('tiki')->refresh_index($type, $object);
}
} else {
foreach ($relations as $id => $key) {
if ($key === "{$type}:{$object}") {
$relationlib->remove_relation($id);
unset($relations[$id]);
TikiLib::lib('tiki')->refresh_index($type, $object);
}
}
}
if ($prefs['feature_score'] == 'y' && $target) {
if ($type == 'forum post') {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments();
$forum_id = $commentslib->get_comment_forum_id($object);
$forum_info = $commentslib->get_forum($forum_id);
$thread_info = $commentslib->get_comment($object, null, $forum_info);
$item_user = $thread_info['userName'];
} elseif ($type == 'article') {
require_once 'lib/articles/artlib.php';
$artlib = new ArtLib();
$res = $artlib->get_article($object);
$item_user = $res['author'];
}
$tikilib->score_event($user, 'item_favorited', "{$type}:{$object}");
$tikilib->score_event($item_user, 'item_is_favorited', "{$user}:{$type}:{$object}");
}
return array('list' => $relations);
}
示例3: smarty_modifier_forumname
function smarty_modifier_forumname($commentid, $retrun_forumid = 'n')
{
global $tikilib, $cachelib;
require_once 'lib/comments/commentslib.php';
$comments = new Comments();
if ($retrun_forumid == 'y') {
$cacheItem = "retrun_forumid" . $commentid;
} else {
$cacheItem = "retrun_forumname" . $commentid;
}
if ($cached = $cachelib->getCached($cacheItem)) {
return $cached;
}
$forum_id = $comments->get_comment_forum_id($commentid);
$cachelib->cacheItem($cacheItem, $forum_id);
if ($retrun_forumid == 'y') {
return $forum_id;
}
$ret = $comments->get_forum($forum_id);
$cachelib->cacheItem($cacheItem, $ret['name']);
return $ret['name'];
}
示例4: Comments
'comment_threadId',
'comment_offset',
'comment_threshold',
'thread_sort_mode',
'time_control',
'show_archived',
'poster',
'filter_type',
'reply_state'
);
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments($dbTiki);
if (!isset($_REQUEST['forumId']) || !($forum_info = $commentslib->get_forum($_REQUEST['forumId']))) {
$smarty->assign('errortype', 'no_redirect_login');
$smarty->assign('msg', tra('No forum indicated'));
$smarty->display('error.tpl');
die;
}
if (isset($_REQUEST['comments_postCancel'])) {
unset($_REQUEST['comments_threadId']);
unset($_REQUEST['comments_title']);
unset($_REQUEST['openpost']);
}
if (isset($_REQUEST['openpost'])) {
$smarty->assign('openpost', 'y');
} else {
示例5: tra
// Forums must be active
if ($prefs['feature_forums'] != 'y') {
$smarty->assign('msg', tra("This feature is disabled") . ": feature_forums");
$smarty->display("error.tpl");
die;
}
// forumId must be received
if (!isset($_REQUEST["forumId"])) {
$smarty->assign('msg', tra("No forum indicated"));
$smarty->display("error.tpl");
die;
}
$smarty->assign('forumId', $_REQUEST["forumId"]);
include_once "lib/commentslib.php";
$commentslib = new Comments($dbTiki);
$forum_info = $commentslib->get_forum($_REQUEST["forumId"]);
//Check individual permissions for this forum
$smarty->assign('individual', 'n');
if ($userlib->object_has_one_permission($_REQUEST["forumId"], 'forum')) {
$smarty->assign('individual', 'y');
if ($tiki_p_admin != 'y') {
$perms = $userlib->get_permissions(0, -1, 'permName_desc', '', 'forums');
foreach ($perms["data"] as $perm) {
$permName = $perm["permName"];
if ($userlib->object_has_permission($user, $_REQUEST["forumId"], 'forum', $permName)) {
${$permName} = 'y';
$smarty->assign("{$permName}", 'y');
} else {
${$permName} = 'n';
$smarty->assign("{$permName}", 'n');
}
示例6: Comments
if (strstr($_SERVER["REQUEST_URI"], 'tiki-list_file_gallery')) {
$info = $tikilib->get_file_gallery($setup_query_data["galleryId"]);
$_REQUEST["bookmark_urlname"] = $info["name"];
}
// Check if we are bookmarking an image
if (strstr($_SERVER["REQUEST_URI"], 'tiki-browse_image')) {
$info = $imagegallib->get_image($setup_query_data["imageId"]);
$_REQUEST["bookmark_urlname"] = $info["name"];
}
// Check if we are bookmarking a forum
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_forum')) {
require_once 'lib/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$info = $commentslib->get_forum($setup_query_data["forumId"]);
$_REQUEST["bookmark_urlname"] = $info["name"];
}
// Check if we are bookmarking a faq
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_faq')) {
$info = $tikilib->get_faq($setup_query_data["faqId"]);
$_REQUEST["bookmark_urlname"] = $info["title"];
}
// Check if we are bookmarking a weblog
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_blog')) {
$info = $tikilib->get_blog($setup_query_data["blogId"]);
$_REQUEST["bookmark_urlname"] = $info["title"];
}
}
if (!empty($_REQUEST["bookmark_urlname"])) {
$bookmarklib->replace_url(0, $_SESSION["bookmarks_parent"], $_REQUEST["bookmark_urlname"], $ownurl, $user);
示例7: tra
require_once 'tiki-rss_error.php';
}
if ($tiki_p_admin_forum != 'y' && $tiki_p_forum_read != 'y') {
$errmsg = tra("Permission denied you cannot view this section");
require_once 'tiki-rss_error.php';
}
if (!isset($_REQUEST["forumId"])) {
$errmsg = tra("No forumId specified");
require_once 'tiki-rss_error.php';
}
require_once 'lib/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$feed = "forum";
$tmp = $commentslib->get_forum($_REQUEST["forumId"]);
$title = tra("Tiki RSS feed for forum: ") . $tmp["name"];
$desc = $tmp["description"];
$now = date("U");
$id = "forumId";
$param = "threadId";
$descId = "data";
$dateId = "commentDate";
$authorId = "userName";
$titleId = "title";
$readrepl = "tiki-view_forum_thread.php?{$id}=%s&comments_parentId=%s";
$uniqueid = "{$feed}.{$id}=" . $_REQUEST["{$id}"];
$tmp = $tikilib->get_preference('title_rss_' . $feed, '');
if ($tmp != '') {
$title = $tmp;
}
示例8:
}
if ($where == 'faqs') {
$access->check_feature('feature_faqs');
$access->check_permission('tiki_p_view_faqs');
}
if ($where == 'forums') {
$access->check_feature('feature_forums');
$access->check_permission('tiki_p_forum_read');
if (!empty($_REQUEST['forumId'])) {
$filter['forumId'] = $_REQUEST['forumId'];
global $commentslib;
include ('lib/comments/commentslib.php');
if (!isset($commentslib)) $commentslib = new Comments($dbTiki);
$forum_info = $commentslib->get_forum($_REQUEST['forumId']);
$where = 'forum';
$smarty->assign_by_ref('where_forum', $forum_info['name']);
$smarty->assign_by_ref('forumId', $_REQUEST['forumId']);
$cant = '';
}
}
if ($where == 'files') {
$access->check_feature('feature_file_galleries');
if (!empty($_REQUEST['galleryId'])) {
$filter['galleryId'] = $_REQUEST['galleryId'];
}
}
if ($where == 'articles') {
示例9: substr
$smarty->assign("home_gallery_url", "tiki-browse_gallery.php?galleryId=" . $prefs['home_gallery']);
$smarty->assign("home_file_gallery_url", "tiki-list_file_gallery.php?galleryId=" . $prefs['home_file_gallery']);
if ($prefs['home_blog']) {
$hbloginfo = $tikilib->get_blog($prefs['home_blog']);
$smarty->assign("home_blog_name", substr($hbloginfo["title"], 0, 20));
} else {
$smarty->assign("home_blog_name", '');
}
if ($prefs['home_gallery']) {
$hgalinfo = $tikilib->get_gallery($prefs['home_gallery']);
$smarty->assign("home_gal_name", substr($hgalinfo["name"], 0, 20));
} else {
$smarty->assign("home_gal_name", '');
}
if ($prefs['home_forum']) {
require_once 'lib/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$hforuminfo = $commentslib->get_forum($prefs['home_forum']);
$smarty->assign("home_forum_name", substr($hforuminfo["name"], 0, 20));
} else {
$smarty->assign("home_forum_name", '');
}
if ($prefs['home_file_gallery']) {
$hgalinfo = $tikilib->get_file_gallery($prefs['home_file_gallery']);
$smarty->assign("home_fil_name", substr($hgalinfo["name"], 0, 20));
} else {
$smarty->assign("home_fil_name", '');
}
ask_ticket('admin-inc-general');
示例10: substr
$smarty->assign("home_blog_name", substr($hbloginfo["title"], 0, 20));
} else {
$smarty->assign("home_blog_name", '');
}
if ($home_gallery) {
$hgalinfo = $tikilib->get_gallery($home_gallery);
$smarty->assign("home_gal_name", substr($hgalinfo["name"], 0, 20));
} else {
$smarty->assign("home_gal_name", '');
}
if ($home_forum) {
require_once 'lib/commentslib.php';
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$hforuminfo = $commentslib->get_forum($home_forum);
$smarty->assign("home_forum_name", substr($hforuminfo["name"], 0, 20));
} else {
$smarty->assign("home_forum_name", '');
}
if ($home_file_gallery) {
$hgalinfo = $tikilib->get_gallery($home_file_gallery);
$smarty->assign("home_fil_name", substr($hgalinfo["name"], 0, 20));
} else {
$smarty->assign("home_fil_name", '');
}
// Get Date/Time preferences
$long_date_format = $tikilib->get_preference("long_date_format", "%A %d " . tra("DATE-of") . " %B, %Y");
$smarty->assign_by_ref("long_date_format", $long_date_format);
$short_date_format = $tikilib->get_preference("short_date_format", "%a %d " . tra("DATE-of") . " %b, %Y");
$smarty->assign_by_ref("short_date_format", $short_date_format);
示例11: smarty_function_rating
function smarty_function_rating($params, $smarty)
{
global $prefs, $ratinglib;
require_once 'lib/rating/ratinglib.php';
if (!isset($params['type'], $params['id'])) {
return tra('No object information provided for rating.');
}
$type = $params['type'];
$id = $params['id'];
if (isset($params['changemandated']) && $params['changemandated'] == 'y') {
$changemandated = true;
// needed to fix multiple submission problem in comments
} else {
$changemandated = false;
}
if (isset($_REQUEST['rating_value'][$type][$id], $_REQUEST['rating_prev'][$type][$id])) {
$value = $_REQUEST['rating_value'][$type][$id];
$prev = $_REQUEST['rating_prev'][$type][$id];
if ((!$changemandated || $value != $prev) && $ratinglib->record_vote($type, $id, $value)) {
// Handle type-specific actions
if ($type == 'comment') {
global $user;
require_once 'lib/comments/commentslib.php';
if ($user) {
$commentslib = new Comments();
$commentslib->vote_comment($id, $user, $value);
}
} elseif ($type == 'article') {
global $artlib, $user;
require_once 'lib/articles/artlib.php';
if ($user) {
$artlib->vote_comment($id, $user, $value);
}
}
if ($prefs['feature_score'] == 'y' && $id) {
global $tikilib;
if ($type == 'comment') {
$forum_id = $commentslib->get_comment_forum_id($id);
$forum_info = $commentslib->get_forum($forum_id);
$thread_info = $commentslib->get_comment($id, null, $forum_info);
$item_user = $thread_info['userName'];
} elseif ($type == 'article') {
require_once 'lib/articles/artlib.php';
$artlib = new ArtLib();
$res = $artlib->get_article($id);
$item_user = $res['author'];
}
if ($value == '1') {
$tikilib->score_event($item_user, 'item_is_rated', "{$user}:{$type}:{$id}");
} elseif ($value == '2') {
$tikilib->score_event($item_user, 'item_is_unrated', "{$user}:{$type}:{$id}");
}
}
} elseif ($value != $prev) {
return tra('An error occurred.');
}
}
$vote = $ratinglib->get_vote($type, $id);
$options = $ratinglib->get_options($type, $id);
if ($prefs['rating_smileys'] == 'y') {
$smiles = $ratinglib->get_options_smiles($type, $id);
$smarty->assign('rating_smiles', $smiles);
}
$smarty->assign('rating_type', $type);
$smarty->assign('rating_id', $id);
$smarty->assign('rating_options', $options);
$smarty->assign('current_rating', $vote);
return $smarty->fetch('rating.tpl');
}
示例12: module_user_bookmarks
function module_user_bookmarks($mod_reference, $module_params)
{
global $tikilib, $smarty;
global $bookmarklib, $imagegallib, $user, $prefs, $tiki_p_create_bookmarks;
include_once ('lib/bookmarks/bookmarklib.php');
$setup_parsed_uri = parse_url($_SERVER["REQUEST_URI"]);
if (isset($setup_parsed_uri["query"])) {
TikiLib::parse_str($setup_parsed_uri["query"], $setup_query_data);
} else {
$setup_query_data = array();
}
if ($user && $tiki_p_create_bookmarks == 'y') {
// check the session to get the directory or create directory =0
$smarty->assign('ownurl', $tikilib->httpPrefix().$_SERVER["REQUEST_URI"]);
if (isset($_REQUEST["bookmarks_directory"])) {
$_SESSION["bookmarks_directory"] = $_REQUEST["bookmarks_directory"];
} elseif (!isset($_SESSION["bookmarks_directory"])) {
$_SESSION["bookmarks_directory"] = 0;
}
$ownurl = $tikilib->httpPrefix(). $_SERVER["REQUEST_URI"];
// Now build urls
if (strstr($ownurl, '?')) {
$modb_sep = '&';
} else {
$modb_sep = '?';
}
$smarty->assign('modb_sep', $modb_sep);
if (isset($_REQUEST["bookmark_removeurl"])) {
$bookmarklib->remove_url($_REQUEST["bookmark_removeurl"], $user);
}
if (isset($_REQUEST["bookmark_create_folder"])) {
$bookmarklib->add_folder($_SESSION["bookmarks_directory"], $_REQUEST['modb_name'], $user);
}
if (isset($_REQUEST["bookmark_mark"])) {
$name = $_REQUEST["modb_name"];
if (empty($name)) {
// Check if we are bookmarking a wiki-page
if (strstr($_SERVER["REQUEST_URI"], 'tiki-index')) {
// Get the page
if (isset($setup_query_data["page"])) {
$name = $setup_query_data["page"];
} else {
$name = $prefs['wikiHomePage'];
}
}
// Check if we are bookmarking an article
if (strstr($_SERVER["REQUEST_URI"], 'tiki-read_article')) {
global $artlib; require_once 'lib/articles/artlib.php';
$info = $artlib->get_article($setup_query_data["articleId"]);
$name = $info["title"];
}
// Check if we are bookmarking a file gallery
if (strstr($_SERVER["REQUEST_URI"], 'tiki-list_file_gallery')) {
$filegallib = TikiLib::lib('filegal');
$info = $filegallib->get_file_gallery($setup_query_data["galleryId"]);
$name = $info["name"];
}
// Check if we are bookmarking an image gallery
if (strstr($_SERVER["REQUEST_URI"], 'tiki-browse_gallery') || strstr($_SERVER["REQUEST_URI"], 'tiki-list_gallery')) {
include_once ("lib/imagegals/imagegallib.php");
$info = $imagegallib->get_gallery($setup_query_data["galleryId"]);
$name = $info["name"];
}
// Check if we are bookmarking an image
if (strstr($_SERVER["REQUEST_URI"], 'tiki-browse_image')) {
include_once ("lib/imagegals/imagegallib.php");
$info = $imagegallib->get_image($setup_query_data["imageId"]);
$name = $info["name"];
}
// Check if we are bookmarking a forum
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_forum')) {
require_once('lib/comments/commentslib.php'); global $commentslib;
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$info = $commentslib->get_forum($setup_query_data["forumId"]);
$name = $info["name"];
}
//.........这里部分代码省略.........