Commit d46976c0 authored by Jonny Bradley's avatar Jonny Bradley

[MOD] comments: Tidy up access to commentslib globally.

Often was using an incorrect and undefined $dbTiki parameter, and/or unnecessary tests and includes.
Also [FIX] on a couple of obvious syntax errors in tiki-admin_actionlog.php & mod-func-user_bookmarks.php
parent c6418e69
......@@ -38,7 +38,6 @@ if (!empty($_REQUEST['moveWikiUp'])) {
}
// Included for the forum dropdown
include_once ('lib/comments/commentslib.php');
if (isset($_REQUEST['createtag'])) {
check_ticket('admin-inc-wiki');
// Check existance
......
......@@ -153,8 +153,7 @@ if (!isset($_REQUEST["comments_reply_threadId"])) {
$smarty->assign("comments_reply_threadId", $_REQUEST["comments_reply_threadId"]);
// Include the library for comments (if not included)
include_once ("lib/comments/commentslib.php");global $dbTiki;
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
if (!isset($comments_prefix_var)) {
$comments_prefix_var = '';
......
......@@ -500,14 +500,9 @@ class BlogLib extends TikiDb_Bridge
)
{
global $tikilib, $tiki_p_admin, $tiki_p_blog_admin, $tiki_p_blog_post, $user, $prefs;
global $commentslib; require_once('lib/comments/commentslib.php');
$parserlib = TikiLib::lib('parser');
if (!is_object($commentslib)) {
$commentslib = new Comments();
}
$mid = array();
$bindvars = array();
......@@ -566,7 +561,7 @@ class BlogLib extends TikiDb_Bridge
$ret = array();
while ($res = $result->fetchRow()) {
$res["comments"] = $commentslib->count_comments('blog post:' . $res['postId']);
$res["comments"] = TikiLib::lib('comments')->count_comments('blog post:' . $res['postId']);
$res['pages'] = $this->get_number_of_pages($res['data']);
$res['avatar'] = $tikilib->get_user_avatar($res['user']);
......
......@@ -68,8 +68,7 @@ class Services_Favorite_Controller
}
if ($prefs['feature_score'] == 'y' && $target) {
if ($type == 'forum post') {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments();
$commentslib = TikiLib::lib('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);
......
......@@ -93,9 +93,7 @@ class Tiki_Profile_InstallHandler_Forum extends Tiki_Profile_InstallHandler
function _install()
{
global $dbTiki;
require_once 'lib/comments/commentslib.php';
$comments = new Comments($dbTiki);
$comments = TikiLib::lib('comments');
$data = $this->getData();
$this->replaceReferences($data);
......
......@@ -414,11 +414,7 @@ class TikiImporter_Blog extends TikiImporter
*/
function insertComments($objId, $objType, $comments)
{
global $commentslib; require_once('lib/comments/commentslib.php');
if (!is_object($commentslib)) {
$commentslib = new Comments();
}
$commentslib = TikiLib::lib('comments');
$objRef = $objType . ':' . $objId;
......
......@@ -11,8 +11,6 @@ if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) {
exit;
}
require_once ('lib/comments/commentslib.php');
/**
* Importer
* A library to handle importing of forum posts from Tiki or from other forum
......
......@@ -1536,8 +1536,7 @@ class LogsLib extends TikiLib
}
if (!isset($forumNames)) {
global $commentslib; include_once('lib/comments/commentslib.php');
$objects = $commentslib->list_forums(0, -1, 'name_asc', '');
$objects = TikiLib::lib('comments')->list_forums(0, -1, 'name_asc', '');
$forumNames = array();
foreach ($objects['data'] as $object) {
$forumNames[$object['forumId']] = $object['name'];
......
......@@ -427,7 +427,7 @@ function prefs_global_list($partial = false)
*/
function feature_home_pages($partial = false)
{
global $prefs, $tikilib, $commentslib;
global $prefs, $tikilib;
$tikiIndex = array();
//wiki
......@@ -470,12 +470,9 @@ function feature_home_pages($partial = false)
// 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']);
$hforuminfo = TikiLib::lib('comments')->get_forum($prefs['home_forum']);
$home_forum_name = substr($hforuminfo['name'], 0, 20);
} else {
$home_forum_name = tra('Set Forum homepage first');
......
......@@ -103,9 +103,7 @@ function listfgal_pref()
*/
function listforum_pref()
{
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments();
$allforums = $commentslib->list_forums(0, -1, 'name_desc', '');
$allforums = TikiLib::lib('comments')->list_forums(0, -1, 'name_desc', '');
$listforums = array('' => 'None');
......
......@@ -190,11 +190,10 @@ class RankLib extends TikiLib
function forums_ranking_last_posts($limit, $toponly=false, $forumId='')
{
global $user;
$commentslib = TikiLib::lib('comments');
$offset=0;
$count = 0;
$ret = array();
$result = $commentslib->get_all_comments('forum', 0, $limit, 'commentDate_desc', '', '', '', $toponly, $forumId);
$result = TikiLib::lib('comments')->get_all_comments('forum', 0, $limit, 'commentDate_desc', '', '', '', $toponly, $forumId);
$result['data'] = Perms::filter(array('type' => 'forum'), 'object', $result['data'], array('object' => 'object'), 'forum_read');
foreach ($result['data'] as $res) {
$aux['name'] = $res['title'];
......@@ -223,13 +222,7 @@ class RankLib extends TikiLib
*/
function forums_ranking_most_read_topics($limit, $forumId='')
{
global $commentslib;
if (! $commentslib) {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments;
}
$result = $commentslib->get_all_comments('forum', 0, $limit, 'hits_desc', '', '', '', true, $forumId);
$result = TikiLib::lib('comments')->get_all_comments('forum', 0, $limit, 'hits_desc', '', '', '', true, $forumId);
$ret = array();
foreach ($result['data'] as $res) {
......@@ -273,14 +266,8 @@ class RankLib extends TikiLib
*/
function forums_ranking_top_topics($limit)
{
global $commentslib;
if (! $commentslib) {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments;
}
$ret = array();
$comments = $commentslib->get_forum_topics(null, 0, $limit, 'average_desc');
$comments = TikiLib::lib('comments')->get_forum_topics(null, 0, $limit, 'average_desc');
foreach ($comments as $res) {
$aux = array();
$aux['name'] = $res['name'] . ': ' . $res['title'];
......@@ -303,13 +290,7 @@ class RankLib extends TikiLib
*/
function forums_ranking_most_visited_forums($limit)
{
global $commentslib;
if (! $commentslib) {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments;
}
$result = $commentslib->list_forums(0, $limit, 'hits_desc');
$result = TikiLib::lib('comments')->list_forums(0, $limit, 'hits_desc');
$ret = array();
$count = 0;
foreach ($result['data'] as $res) {
......@@ -332,13 +313,7 @@ class RankLib extends TikiLib
*/
function forums_ranking_most_commented_forum($limit)
{
global $commentslib;
if (! $commentslib) {
require_once 'lib/comments/commentslib.php';
$commentslib = new Comments;
}
$result = $commentslib->list_forums(0, $limit, 'comments_desc');
$result = TikiLib::lib('comments')->list_forums(0, $limit, 'comments_desc');
$ret = array();
$count = 0;
foreach ($result['data'] as $res) {
......
......@@ -13,17 +13,16 @@ if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
function smarty_function_poll($params, $smarty)
{
global $polllib, $dbTiki, $commentslib, $prefs;
global $polllib, $prefs;
global $tiki_p_view_poll_results, $tiki_p_vote_poll;
extract($params);
// Param = zone
if (!is_object($polllib)) {
include_once('lib/polls/polllib_shared.php');
}
include_once('lib/comments/commentslib.php');
if (isset($rate)) {
if (!$tikilib->page_exists($rate)) {
if (!TikiLib::lib('tiki')->page_exists($rate)) {
return false;
}
}
......@@ -43,8 +42,7 @@ function smarty_function_poll($params, $smarty)
if ($menu_info) {
$channels = $polllib->list_poll_options($id);
if ($prefs['feature_poll_comments'] == 'y') {
$commentslib = new Comments($dbTiki);
$comments_count = $commentslib->count_comments("poll:" . $menu_info["pollId"]);
$comments_count = TikiLib::lib('comments')->count_comments("poll:" . $menu_info["pollId"]);
} else
$comments_count = 0;
$smarty->assign('comments_cant', $comments_count);
......
......@@ -7,7 +7,7 @@
function smarty_function_rating( $params, $smarty )
{
global $prefs, $ratinglib;
global $prefs, $ratinglib, $user;
require_once 'lib/rating/ratinglib.php';
if ( ! isset($params['type'], $params['id']) ) {
......@@ -29,10 +29,9 @@ function smarty_function_rating( $params, $smarty )
// Handle type-specific actions
if ( $type == 'comment' ) {
global $user; require_once 'lib/comments/commentslib.php';
if ( $user ) {
$commentslib = new Comments();
$commentslib = TikiLib::lib('comments');
$commentslib->vote_comment($id, $user, $value);
}
} elseif ($type == 'article' ) {
......
......@@ -10,7 +10,6 @@ function smarty_function_rating_override_menu( $params, $smarty )
global $prefs, $headerlib, $ratinglib;
require_once("lib/rating/ratinglib.php");
require_once('lib/comments/commentslib.php');
$menu = '';
$options = $ratinglib->override_array($params['type'], true, true);
$optionsLength = count($options);
......
......@@ -339,9 +339,6 @@ function wikiplugin_articles($data, $params)
$filter['notArticleId'] = $notArticleId;
}
include_once("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
if ( count($categId) == 0 ) {
$categIds = '';
} elseif ( count($categId) == 1 ) {
......@@ -381,7 +378,7 @@ function wikiplugin_articles($data, $params)
$comments_prefix_var='article:';
$comments_object_var=$listpages["data"][$i]["articleId"];
$comments_objectId = $comments_prefix_var.$comments_object_var;
$listpages["data"][$i]["comments_cant"] = $commentslib->count_comments($comments_objectId);
$listpages["data"][$i]["comments_cant"] = TikiLib::lib('comments')->count_comments($comments_objectId);
//print_r($listpages["data"][$i]['title']);
}
global $artlib; require_once ('lib/articles/artlib.php');
......
......@@ -611,10 +611,7 @@ class WikiRenderer
private function setupComments()
{
global $commentslib;
include_once('lib/comments/commentslib.php');
$commentslib = new Comments();
$count_comments = $commentslib->count_comments('wiki page:'.$this->page, 'n');
$count_comments = TikiLib::lib('comments')->count_comments('wiki page:'.$this->page, 'n');
$this->smartyassign('count_comments', $count_comments);
}
}
......@@ -245,10 +245,7 @@ class WikiLib extends TikiLib
//$data=addslashes(str_replace($oldName,$newName,$info['data']));
$data = $info['data'];
} elseif ($type == 'forum post' || substr($type, -7) == 'comment') {
include_once ('lib/comments/commentslib.php');
global $dbTiki;
$commentslib = new Comments($dbTiki);
$comment_info = $commentslib->get_comment($objectId);
$comment_info = TikiLib::lib('comments')->get_comment($objectId);
$data = $comment_info['data'];
}
......
......@@ -126,7 +126,7 @@ class XmlLib extends TikiLib
}
if ($prefs['feature_wiki_comments'] == 'y' && $this->config['comments']) {
global $dbTiki; include_once('lib/comments/commentslib.php'); $commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$comments = $commentslib->get_comments('wiki page:'.$page, 0, 0, 0, 'commentDate_asc', '', 0, 'commentStyle_plain');
if (!empty($comments['cant'])) {
$smarty->assign_by_ref('comments', $comments['data']);
......@@ -340,7 +340,7 @@ class XmlLib extends TikiLib
if ($prefs['feature_wiki_comments'] == 'y' && $tiki_p_edit_comments == 'y' && !empty($info['comments'])) {
foreach ($info['comments'] as $comment) {
global $commentslib; include_once('lib/comments/commentslib.php'); $commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$parentId = empty($comment['parentId']) ? 0: $newThreadIds[$comment['parentId']];
if ($parentId) {
$reply_info = $commentslib->get_comment($parentd);
......
......@@ -41,12 +41,7 @@ function module_most_commented_info()
function module_most_commented($mod_reference, $module_params)
{
global $smarty;
global $commentslib;
if (!isset($commentslib)) {
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments();
}
$type = 'wiki';
if (isset($module_params['objectType'])) {
$type = $module_params['objectType'];
......@@ -56,7 +51,7 @@ function module_most_commented($mod_reference, $module_params)
}
}
$result = $commentslib->order_comments_by_count($type, isset($module_params['objectLanguageFilter']) ? $module_params['objectLanguageFilter'] : '', $mod_reference['rows']);
$result = TikiLib::lib('comments')->order_comments_by_count($type, isset($module_params['objectLanguageFilter']) ? $module_params['objectLanguageFilter'] : '', $mod_reference['rows']);
if ($result === false) {
$smarty->assign('module_error', tra('Feature disabled'));
return;
......
......@@ -68,7 +68,7 @@ function module_since_last_visit_new_info()
function module_since_last_visit_new($mod_reference, $params = null)
{
global $smarty, $user;
global $commentslib; require_once('lib/comments/commentslib.php'); $commentslib = new Comments();
include_once('tiki-sefurl.php');
if (!$user) {
......@@ -143,7 +143,7 @@ function module_since_last_visit_new($mod_reference, $params = null)
$count = 0;
while ($res = $result->fetchRow()) {
$ret['items']['comments']['list'][$count]['href'] = $commentslib->getHref($res['objectType'], $res['object'], $res['threadId']);
$ret['items']['comments']['list'][$count]['href'] = TikiLib::lib('comments')->getHref($res['objectType'], $res['object'], $res['threadId']);
switch ($res['objectType']) {
case 'article':
$perm = 'tiki_p_read_article';
......
......@@ -119,20 +119,13 @@ function module_user_bookmarks($mod_reference, $module_params)
// 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"]);
$info = TikiLib::lib('comments')->get_forum($setup_query_data["forumId"]);
$name = $info["name"];
}
// Check if we are bookmarking a faq
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_faq')) {
require_once ('lib/faqs/faqlib.php');
$info = $faqlib->get_faq($setup_query_data["faqId"]);
$info = TikiLib::lib('faq')->get_faq($setup_query_data["faqId"]);
$name = $info["title"];
}
......
......@@ -14,11 +14,10 @@ if (empty($prefs['feature_jpgraph'])) {
$prefs['feature_jpgraph'] = 'n'; //optional package does not go througp prefs
}
include_once ('lib/comments/commentslib.php');
include_once ('lib/categories/categlib.php');
include_once ('lib/contribution/contributionlib.php');
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$access->check_user($user);
$access->check_feature('feature_actionlog');
$access->check_permission_either(array('tiki_p_view_actionlog', 'tiki_p_view_actionlog_owngroups'));
......@@ -340,12 +339,12 @@ if (isset($_REQUEST['list']) || isset($_REQUEST['export']) || isset($_REQUEST['g
echo "user,object,Time in bigbluebutton (in minutes)\r\n";
$logins = $logslib->list_actions('', 'bigbluebutton', $_REQUEST['selectedUsers'], 0, -1, 'lastModif_asc', $find, $startDate, $endDate, false);
$stay_in_big_Times = $logslib->get_bigblue_login_time($logins['data'], $startDate, $endDate, $actions);
if (empty($logins['data']))
break;
$csv = $logslib->export_bbb($stay_in_big_Times);
echo $csv;
$offset += $maxRecords;
die();
if (!empty($logins['data'])) {
$csv = $logslib->export_bbb($stay_in_big_Times);
echo $csv;
$offset += $maxRecords;
die();
}
}
$results = $logslib->list_actions('', '', $_REQUEST['selectedUsers'], $offset, $maxRecords, 'lastModif_desc', $find, $startDate, $endDate, $_REQUEST['categId']);
$actions = &$results['data'];
......
......@@ -99,8 +99,7 @@ if (!empty($_REQUEST['banId'])) {
// Handle case when coming from tiki-list_comments with a list of IPs to ban
if (!empty($_REQUEST['mass_ban_ip'])) {
check_ticket('admin-banning');
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments;
$commentslib = TikiLib::lib('comments');
$smarty->assign('mass_ban_ip', $_REQUEST['mass_ban_ip']);
$info['mode'] = 'mass_ban_ip';
$info['title'] = tr('Multiple IP Banning');
......
......@@ -381,10 +381,7 @@ if ( $prefs['feature_file_galleries'] == 'y' ) {
}
if ( $prefs['feature_forums'] == 'y' ) {
include_once ('lib/comments/commentslib.php');
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$commentslib = TikiLib::lib('comments');
$forums = $commentslib->list_forums($offset, -1, 'name_asc', $find_objects);
}
......
......@@ -28,8 +28,7 @@ $auto_query_args = array(
'find',
);
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
if (isset($_REQUEST["remove"])) {
$access->check_authenticity();
$commentslib->remove_forum($_REQUEST["remove"]);
......
......@@ -133,8 +133,7 @@ if ($prefs['feature_trackers'] == 'y') {
$smarty->assign_by_ref('trackers', $trackers);
}
if ($prefs['feature_forums'] == 'y') {
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$forums = $commentslib->get_outbound_emails();
$smarty->assign_by_ref('forums', $forums);
}
......
......@@ -56,8 +56,7 @@ foreach ($languages as $clang) {
}
$smarty->assign_by_ref('templates', $templates);
if ($prefs['feature_forums'] == 'y') {
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$dirs = $commentslib->list_directories_to_save();
} else {
$dirs = array();
......
......@@ -11,8 +11,6 @@
$force_no_compression = true;
require_once ('tiki-setup.php');
include_once ('lib/comments/commentslib.php');
// roysinn: shouldn't need attach permission for download . . .
//if ($tiki_p_forum_attach != 'y') {
// die;
......@@ -22,7 +20,7 @@ if (!isset($_REQUEST["attId"])) {
die;
}
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$info = $commentslib->get_thread_attachment($_REQUEST["attId"]);
if ( empty($info['filetype']) || $info['filetype'] == 'application/x-octetstream' || $info['filetype'] == 'application/octet-stream' ) {
......
......@@ -17,8 +17,7 @@ if (!isset($_REQUEST["forumId"])) {
}
$smarty->assign('forumId', $_REQUEST["forumId"]);
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$forum_info = $commentslib->get_forum($_REQUEST["forumId"]);
//Check individual permissions for this forum
......
......@@ -30,10 +30,7 @@ if ($tiki_p_forum_read != 'y') {
require_once ('tiki-rss_error.php');
}
require_once('lib/comments/commentslib.php');
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$commentslib = TikiLib::lib('comments');
$feed = "forum";
$id = "forumId";
......
......@@ -17,8 +17,7 @@ $access->check_feature('feature_forums');
$access->check_permission('tiki_p_forum_read');
// This shows a list of forums everybody can use this listing
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
if (!isset($_REQUEST["sort_mode"])) {
$sort_mode = $prefs['forums_ordering'];
......
......@@ -21,8 +21,7 @@ if (!isset($_REQUEST["forumId"])) {
}
$smarty->assign('forumId', $_REQUEST["forumId"]);
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$forum_info = $commentslib->get_forum($_REQUEST["forumId"]);
//Check individual permissions for this forum
......
......@@ -9,7 +9,7 @@
// $Id$
require_once ('tiki-setup.php');
include_once ('lib/comments/commentslib.php');
$auto_query_args = array('types_section', 'types', 'show_types', 'sort_mode', 'offset', 'find', 'findfilter_approved');
if (isset($_REQUEST['blogId'])) {
......@@ -28,7 +28,7 @@ if (isset($_REQUEST['blogId'])) {
$access->check_permission('tiki_p_admin_comments');
}
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$title = tra('Comments');
$sections_keys = array('objectType' => 'commentsFeature', 'itemObjectType' => 'itemCommentsFeature');
......
......@@ -105,7 +105,7 @@ if ($del || $dup) {
}
$types = array('wiki page', 'file gallery', 'tracker', 'forum', 'group');
include_once ("lib/comments/commentslib.php"); global $commentslib; $commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$all_groups = $userlib->list_all_groups();
$res = array();
foreach ($types as $type) {
......
......@@ -76,16 +76,14 @@ if ($prefs['feature_trackers'] == 'y') {
if ($prefs['feature_forums'] == 'y') {
$mytiki_forum_replies = $tikilib->get_user_preference($user, 'mytiki_forum_replies', 'y');
if ($mytiki_forum_replies == 'y') {
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$user_forum_replies = $commentslib->get_user_forum_comments($userwatch, -1, 'replies');
$smarty->assign_by_ref('user_forum_replies', $user_forum_replies);
$smarty->assign('mytiki_forum_replies', 'y');
}
$mytiki_forum_topics = $tikilib->get_user_preference($user, 'mytiki_forum_topics', 'y');
if ($mytiki_forum_topics == 'y') {
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$user_forum_topics = $commentslib->get_user_forum_comments($userwatch, -1, 'topics');
$smarty->assign_by_ref('user_forum_topics', $user_forum_topics);
$smarty->assign('mytiki_forum_topics', 'y');
......
......@@ -71,9 +71,7 @@ if ($where == '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);
$commentslib = TikiLib::lib('comments');
$forum_info = $commentslib->get_forum($_REQUEST['forumId']);
$where = 'forum';
$smarty->assign_by_ref('where_forum', $forum_info['name']);
......
......@@ -71,8 +71,7 @@ if (empty($_REQUEST['report']) || $_REQUEST['report'] != 'y') {
$smarty->assign('messageto', (isset($_REQUEST['messageto'])?$_REQUEST['messageto']:''));
if (isset($prefs['feature_forums']) and $prefs['feature_forums'] == 'y') {
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments($dbTiki); // not done in commentslib
$commentslib = TikiLib::lib('comments'); // not done in commentslib
$sort_mode = $prefs['forums_ordering'];
$channels = $commentslib->list_forums(0, -1, $sort_mode, '');
Perms::bulk(array( 'type' => 'forum' ), 'object', $channels['data'], 'forumId');
......
......@@ -55,11 +55,7 @@ switch ($_REQUEST['type']) {
break;
case 'forum':
require_once ('lib/comments/commentslib.php');
if (!isset($commentslib)) {
$commentslib = new Comments($dbTiki);
}
$objects = $commentslib->list_forums(0, -1, 'name_asc', $find_objects);
$objects = TikiLib::lib('comments')->list_forums(0, -1, 'name_asc', $find_objects);
$smarty->assign_by_ref('objects', $objects["data"]);
$objects = $objects['data'];
correct_array($objects, 'forumId', 'name');
......
......@@ -142,8 +142,7 @@ if ($prefs['feature_display_my_to_others'] == 'y') {
$smarty->assign_by_ref('user_articles', $user_articles);
}
if ($prefs['feature_forums'] == 'y') {
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
$user_forum_comments = $commentslib->get_user_forum_comments($userwatch, -1);
$smarty->assign_by_ref('user_forum_comments', $user_forum_comments);
$user_forum_topics = $commentslib->get_user_forum_comments($userwatch, -1, 'topics');
......
......@@ -12,14 +12,12 @@ $section = 'cms';
//get_strings tra('Articles Home');
require_once ('tiki-setup.php');
include_once ('lib/articles/artlib.php');
include_once ("lib/comments/commentslib.php");
if ($prefs['feature_freetags'] == 'y') {
include_once ('lib/freetag/freetaglib.php');
}
if ($prefs['feature_categories'] == 'y') {
include_once ('lib/categories/categlib.php');
}
$commentslib = new Comments($dbTiki);
$access->check_feature('feature_articles');
$access->check_permission_either(array('tiki_p_read_article', 'tiki_p_articles_read_heading'));
......@@ -117,7 +115,7 @@ for ($i = 0; $i < $temp_max; $i++) {
$comments_prefix_var = 'article:';
$comments_object_var = $listpages["data"][$i]["articleId"];
$comments_objectId = $comments_prefix_var . $comments_object_var;
$listpages["data"][$i]["comments_cant"] = $commentslib->count_comments($comments_objectId);
$listpages["data"][$i]["comments_cant"] = TikiLib::lib('comments')->count_comments($comments_objectId);
if ($prefs['feature_freetags'] == 'y') { // And get the Tags for the posts
$listpages["data"][$i]["freetags"] = $freetaglib->get_tags_on_object($listpages["data"][$i]["articleId"], "article");
}
......
......@@ -35,9 +35,7 @@ $auto_query_args = array(
'reply_state'
);
include_once ('lib/comments/commentslib.php');
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
if (!isset($_REQUEST['forumId']) || !($forum_info = $commentslib->get_forum($_REQUEST['forumId']))) {
$smarty->assign('errortype', 'no_redirect_login');
......
......@@ -13,8 +13,7 @@ require_once ('tiki-setup.php');
$access->check_feature('feature_forums');
include_once ("lib/comments/commentslib.php");
$commentslib = new Comments($dbTiki);
$commentslib = TikiLib::lib('comments');
if (!isset($_REQUEST['comments_parentId']) && isset($_REQUEST['threadId'])) {
$_REQUEST['comments_parentId'] = $_REQUEST['threadId'];
}
......
Markdown is supported
0%
or