if (!isset($_REQUEST['filter_type']))
	$type_param = '';
else
	$type_param = $_REQUEST['filter_type'];

if (!isset($_REQUEST['reply_state']))
	$reply_state = '';
else
	$reply_state = $_REQUEST['reply_state'];

$comments_coms = $commentslib->get_forum_topics(
				$_REQUEST['forumId'], 
				$comments_offset, 
				$_REQUEST['comments_per_page'], 
				$_REQUEST['thread_sort_mode'], 
				$view_archived_topics, 
				$user_param, 
				$type_param, 
				$reply_state, 
				$forum_info
);

$comments_cant = $commentslib->count_forum_topics(
				$_REQUEST['forumId'], 
				$comments_offset, 
				$_REQUEST['comments_per_page'], 
				$_REQUEST['thread_sort_mode'], 
				$view_archived_topics, 
				$user_param, 
				$type_param, 
				$reply_state
Exemple #2
0
// Display the Index Template
$pageRenderer->runSetups();
//TRANSLATING HTML
$page_content = (string) $smarty->getTemplateVars('parsed');
// convert from Tiki_Render_Lazy to string here
if (!empty($_REQUEST['machine_translate_to_lang'])) {
    $page_content = generate_machine_translated_content($page_content, $info, $_REQUEST['machine_translate_to_lang']);
    $smarty->assign('parsed', $page_content);
}
TikiLib::events()->trigger('tiki.wiki.view', array_merge(is_array($info) ? $info : array(), array('type' => 'wiki page', 'object' => $page, 'user' => $GLOBALS['user'])));
if ($prefs['feature_forums'] && $prefs['feature_wiki_discuss'] == 'y' && $prefs['wiki_discuss_visibility'] == 'above') {
    include_once 'lib/comments/commentslib.php';
    $commentslib = new Comments($dbTiki);
    $comments_data = tra('Use this thread to discuss the page:') . " [tiki-index.php?page=" . rawurlencode($page) . "|{$page}]";
    $threadId = $commentslib->check_for_topic($page, $comments_data);
    $comments_coms = $commentslib->get_forum_topics($prefs['wiki_forum_id'], 0, -1);
    $discuss_replies_cant = 0;
    foreach ($comments_coms as $topic) {
        if ($topic['threadId'] == $threadId) {
            $discuss_replies_cant = $topic['replies'];
            break;
        }
    }
    $smarty->assign('discuss_replies_cant', $discuss_replies_cant);
}
$smarty->assign('info', $info);
$smarty->assign('mid', 'tiki-show_page.tpl');
$smarty->display('tiki-show_page.tpl');
// xdebug_dump_function_profile(XDEBUG_PROFILER_CPU);
// debug: print all objects
/**
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
    $find = $_REQUEST["find"];
} else {
    $find = '';
}
$smarty->assign('find', $find);
$smarty->assign_by_ref('sort_mode', $sort_mode);
$items = $commentslib->list_reported($_REQUEST['forumId'], $offset, $maxRecords, $sort_mode, $find);
$smarty->assign('cant', $items['cant']);
$cant_pages = ceil($items["cant"] / $maxRecords);
$smarty->assign_by_ref('cant_pages', $cant_pages);
$smarty->assign('actual_page', 1 + $offset / $maxRecords);
if ($items["cant"] > $offset + $maxRecords) {
    $smarty->assign('next_offset', $offset + $maxRecords);
} else {
    $smarty->assign('next_offset', -1);
}
if ($offset > 0) {
    $smarty->assign('prev_offset', $offset - $maxRecords);
} else {
    $smarty->assign('prev_offset', -1);
}
$smarty->assign_by_ref('items', $items["data"]);
$topics = $commentslib->get_forum_topics($_REQUEST['forumId']);
$smarty->assign_by_ref('topics', $topics);
ask_ticket('forum-reported');
include_once 'tiki-section_options.php';
// Display the template
$smarty->assign('mid', 'tiki-forums_reported.tpl');
$smarty->display("tiki.tpl");
    $tiki_p_forum_vote = 'y';
    $smarty->assign('tiki_p_forum_vote', 'y');
    $tiki_p_forum_post_topic = 'y';
    $smarty->assign('tiki_p_forum_post_topic', 'y');
}
if ($tiki_p_admin_forum != 'y' && $tiki_p_forum_read != 'y') {
    $smarty->assign('errortype', 401);
    $smarty->assign('msg', tra("You do not have permission to use this feature"));
    $smarty->display("error.tpl");
    die;
}
$smarty->assign('topics_next_offset', $_REQUEST['topics_offset'] + 1);
$smarty->assign('topics_prev_offset', $_REQUEST['topics_offset'] - 1);
//$end_time = microtime(true);
//print "TIME2: ".($end_time - $start_time)."\n";
$threads = $commentslib->get_forum_topics($_REQUEST['forumId'], $_REQUEST['topics_offset'] - 1, 3, $_REQUEST["topics_sort_mode"]);
if (count($threads) == 3) {
    $next_thread = $threads[2];
    $smarty->assign('next_topic', $next_thread['threadId']);
} else {
    $smarty->assign('next_topic', false);
}
if (count($threads)) {
    $prev_thread = $threads[0];
    $smarty->assign('prev_topic', $prev_thread['threadId']);
} else {
    $smarty->assign('prev_topic', false);
}
//$end_time = microtime(true);
//print "TIME3: ".($end_time - $start_time)."\n";
if ($tiki_p_admin_forum == 'y') {
Exemple #5
0
 /**
  * @param $limit
  * @return mixed
  */
 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');
     foreach ($comments as $res) {
         $aux = array();
         $aux['name'] = $res['name'] . ': ' . $res['title'];
         $aux['title'] = $res['title'];
         $aux['hits'] = $res['average'];
         $aux['href'] = 'tiki-view_forum_thread.php?forumId=' . $res['forumId'] . '&comments_parentId=' . $res['threadId'];
         $ret[] = $aux;
     }
     $retval["data"] = $ret;
     $retval["title"] = tra("Forums best topics");
     $retval["y"] = tra("Score");
     $retval["type"] = "nb";
     return $retval;
 }
Exemple #6
0
if (!isset($_REQUEST["comments_offset"])) {
    $comments_offset = 0;
} else {
    $comments_offset = $_REQUEST["comments_offset"];
}
$smarty->assign('comments_offset', $comments_offset);
// Now check if we are displaying top-level comments or a specific comment
if (!isset($_REQUEST["comments_parentId"])) {
    $_REQUEST["comments_parentId"] = 0;
}
$smarty->assign('comments_parentId', $_REQUEST["comments_parentId"]);
if (!isset($_REQUEST['time_control'])) {
    $_REQUEST['time_control'] = 0;
}
$commentslib->set_time_control($_REQUEST['time_control']);
$comments_coms = $commentslib->get_forum_topics($_REQUEST['forumId'], $comments_offset, $_REQUEST['comments_maxComments'], $_REQUEST['comments_sort_mode']);
// Get the last "n" comments to this forum
$last_comments = $commentslib->get_last_forum_posts($_REQUEST['forumId'], $forum_info['forum_last_n']);
$smarty->assign_by_ref('last_comments', $last_comments);
$comments_cant = $commentslib->count_comments_threads($comments_objectId);
$smarty->assign('comments_cant', $comments_cant);
$comments_maxRecords = $_REQUEST["comments_maxComments"];
$comments_cant_pages = ceil($comments_cant / $comments_maxRecords);
$smarty->assign('comments_cant_pages', $comments_cant_pages);
$smarty->assign('comments_actual_page', 1 + $comments_offset / $comments_maxRecords);
if ($comments_cant > $comments_offset + $comments_maxRecords) {
    $smarty->assign('comments_next_offset', $comments_offset + $comments_maxRecords);
} else {
    $smarty->assign('comments_next_offset', -1);
}
// If offset is > 0 then prev_offset
if ($tiki_p_admin_forum == 'y') {
    $tiki_p_forum_post = 'y';
    $smarty->assign('tiki_p_forum_post', 'y');
    $tiki_p_forum_read = 'y';
    $smarty->assign('tiki_p_forum_read', 'y');
    $tiki_p_forum_vote = 'y';
    $smarty->assign('tiki_p_forum_vote', 'y');
    $tiki_p_forum_post_topic = 'y';
    $smarty->assign('tiki_p_forum_post_topic', 'y');
}
if ($tiki_p_admin_forum != 'y' && $tiki_p_forum_read != 'y') {
    $smarty->assign('msg', tra("You do not have permission to use this feature"));
    $smarty->display("error.tpl");
    die;
}
$next_thread = $commentslib->get_forum_topics($_REQUEST['forumId'], $_REQUEST['topics_offset'] + 1, 1, $_REQUEST["topics_sort_mode"]);
if (count($next_thread)) {
    $smarty->assign('next_topic', $next_thread[0]['threadId']);
} else {
    $smarty->assign('next_topic', false);
}
$smarty->assign('topics_next_offset', $_REQUEST['topics_offset'] + 1);
$smarty->assign('topics_prev_offset', $_REQUEST['topics_offset'] - 1);
// Use topics_offset, topics_find, topics_sort_mode to get the next and previous topics!
$prev_thread = $commentslib->get_forum_topics($_REQUEST['forumId'], $_REQUEST['topics_offset'] - 1, 1, $_REQUEST["topics_sort_mode"]);
if (count($prev_thread)) {
    $smarty->assign('prev_topic', $prev_thread[0]['threadId']);
} else {
    $smarty->assign('prev_topic', false);
}
if ($tiki_p_admin_forum == 'y') {
    $comments_offset = $_REQUEST["comments_offset"];
}
$smarty->assign('comments_offset', $comments_offset);
// Now check if we are displaying top-level comments or a specific comment
if (!isset($_REQUEST["comments_parentId"])) {
    $_REQUEST["comments_parentId"] = 0;
}
$smarty->assign('comments_parentId', $_REQUEST["comments_parentId"]);
if (!isset($_REQUEST['time_control'])) {
    $_REQUEST['time_control'] = 0;
}
$commentslib->set_time_control($_REQUEST['time_control']);
$show_archived = isset($_REQUEST['show_archived']);
$smarty->assign('show_archived', $show_archived);
$view_archived_topics = $show_archived == 'y' && ($tiki_p_admin_forum == 'y' || $prefs['feature_forum_topics_archiving'] == 'n');
$comments_coms = $commentslib->get_forum_topics($_REQUEST['forumId'], $comments_offset, $_REQUEST['comments_per_page'], $_REQUEST['thread_sort_mode'], $view_archived_topics);
// Get the last "n" comments to this forum
$last_comments = $commentslib->get_last_forum_posts($_REQUEST['forumId'], $forum_info['forum_last_n']);
$smarty->assign_by_ref('last_comments', $last_comments);
$comments_cant = $commentslib->count_comments_threads($comments_objectId);
$smarty->assign('comments_cant', $comments_cant);
$comments_maxRecords = $_REQUEST["comments_per_page"];
$smarty->assign_by_ref('comments_coms', $comments_coms);
$cat_type = 'forum';
$cat_objid = $_REQUEST["forumId"];
include_once 'tiki-section_options.php';
if ($prefs['feature_user_watches'] == 'y') {
    if ($user && isset($_REQUEST['watch_event'])) {
        check_ticket('view-forum');
        if ($_REQUEST['watch_action'] == 'add') {
            $tikilib->add_user_watch($user, $_REQUEST['watch_event'], $_REQUEST['watch_object'], 'forum', $forum_info['name'], "tiki-view_forum.php?forumId=" . $_REQUEST['forumId']);