Example #1
0
$smarty->assign('pdf_export', $prefs['print_pdf_from_url'] != 'none' ? 'y' : 'n');
// 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
	$threadId = $commentslib->post_in_forum($forum_info, $_REQUEST, $feedbacks, $errors);
	if ($threadId && $prefs['feature_freetags'] == 'y') {
		$cat_type = 'forum post';
		$cat_objid = $threadId;
		include_once ('freetag_apply.php');	
	}
	$smarty->assign_by_ref('errors', $errors);
	$smarty->assign_by_ref('feedbacks', $feedbacks);
}

// Here we send the user to the right thread/topic if it already exists; this
// is used for the 'discuss' tab. This is done down here because the thread
// might have to be created, which happens above.
if (isset($_REQUEST['comments_postComment'])) {
	// Check if the thread/topic already existis
	$threadId = $commentslib->check_for_topic($_REQUEST['comments_title'], $_REQUEST['comments_data']);
	// If it does, send the user there with no delay.
	if ($threadId) {
		// If the samely titled comment already
		// exists, go straight to it.
		$url = 'tiki-view_forum_thread.php?comments_parentId=' . urlencode($threadId) . '&forumId=' . urlencode($_REQUEST["forumId"]);
		header('location: ' . $url);
		exit;
	}
}

if ($tiki_p_admin_forum == 'y' || $tiki_p_forum_vote == 'y') {
	// Process a vote here
	if (isset($_REQUEST['comments_vote']) && isset($_REQUEST['comments_threadId'])) {
		check_ticket('view-forum');
		$comments_show = 'y';
Example #3
0
         $commentslib->add_thread_attachment($forum_info, $qId, $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']);
     }
     //END ATTACHMENT PROCESSING
     // Now process attchement here (queued attachment)
 } else {
     $smarty->assign('was_queued', 'n');
     if ($_REQUEST["comments_threadId"] == 0) {
         if (!isset($_REQUEST['comment_topicsummary'])) {
             $_REQUEST['comment_topicsummary'] = '';
         }
         if (!isset($_REQUEST['comment_topicsmiley'])) {
             $_REQUEST['comment_topicsmiley'] = '';
         }
         $message_id = '';
         // Check if the thread/topic already exist
         $threadId = $commentslib->check_for_topic($_REQUEST["comments_title"], $_REQUEST["comments_data"]);
         // The thread/topic does not already exist
         if (!$threadId) {
             $threadId = $commentslib->post_new_comment($comments_objectId, 0, $user, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $message_id, '', $_REQUEST["comment_topictype"], $_REQUEST["comment_topicsummary"], $_REQUEST['comment_topicsmiley']);
             // The thread *WAS* successfully created.
             if ($threadId) {
                 // Deal with mail notifications.
                 include_once 'lib/notifications/notificationemaillib.php';
                 sendForumEmailNotification('forum_post_topic', $_REQUEST['forumId'], $forum_info, $_REQUEST["comments_title"], $_REQUEST["comments_data"], $user, $_REQUEST["comments_title"], $message_id, '', $threadId);
             }
         }
         // PROCESS ATTACHMENT HERE
         if ($threadId && isset($_FILES['userfile1']) && is_uploaded_file($_FILES['userfile1']['tmp_name'])) {
             check_ticket('view-forum');
             $fp = fopen($_FILES['userfile1']['tmp_name'], "rb");
             $commentslib->add_thread_attachment($forum_info, $threadId, $fp, '', $_FILES['userfile1']['name'], $_FILES['userfile1']['type'], $_FILES['userfile1']['size']);