mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
#4452 - Add e_print addon code and check
This commit is contained in:
@@ -3,33 +3,10 @@ if (!defined('e107_INIT')) { exit; }
|
|||||||
|
|
||||||
function print_item($thread_id)
|
function print_item($thread_id)
|
||||||
{
|
{
|
||||||
global $tp;
|
// moved to e_print.php
|
||||||
$gen = new convert;
|
|
||||||
include_once(e_PLUGIN.'forum/forum_class.php');
|
|
||||||
$forum = new e107forum;
|
|
||||||
|
|
||||||
$thread_info = $forum->threadGet($thread_id,0,999);
|
|
||||||
$thread_name = $tp->toHTML($thread_info[0]['thread_name'], TRUE);
|
|
||||||
$text = "<b>".$thread_name."</b><br />
|
|
||||||
".$thread_info[0]['user_name'].", ".$gen->convert_date($thread_info[0]['thread_datestamp'], "forum")."<br /><br />
|
|
||||||
".$tp->toHTML($thread_info[0]['thread_thread'], TRUE);
|
|
||||||
|
|
||||||
|
|
||||||
$count = 1;
|
|
||||||
|
|
||||||
unset($thread_info[0], $thread_info['head']);
|
|
||||||
foreach($thread_info as $reply)
|
|
||||||
{
|
|
||||||
$text .= "<br /><br />Re: <b>".$thread_name."</b><br />
|
|
||||||
".$reply['user_name'].", ".$gen->convert_date($reply['thread_datestamp'], "forum")."<br /><br />
|
|
||||||
".$tp->toHTML($reply['thread_thread'], TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// return "<pre>".print_r($thread_info,TRUE)."</pre>";
|
|
||||||
return $text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function email_item($thread_id)
|
function email_item($thread_id)
|
||||||
{
|
{
|
||||||
global $tp;
|
global $tp;
|
||||||
@@ -53,5 +30,4 @@ function email_item($thread_id)
|
|||||||
".$tp->toHTML($reply['thread_thread'], TRUE);
|
".$tp->toHTML($reply['thread_thread'], TRUE);
|
||||||
}
|
}
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
@@ -1,15 +1,52 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
class forum_print // plugin-folder + '_print'
|
class forum_print // plugin-folder + '_print'
|
||||||
{
|
{
|
||||||
|
public function render($thread_id)
|
||||||
public function render($parm)
|
|
||||||
{
|
{
|
||||||
// var_dump($parm);
|
$tp = e107::getParser();
|
||||||
return "TODO!";
|
$text = '';
|
||||||
|
|
||||||
}
|
include_once(e_PLUGIN.'forum/forum_class.php');
|
||||||
|
$forum = new e107forum;
|
||||||
|
|
||||||
|
// Get basic topic info
|
||||||
|
$thread_info = $forum->threadGet($thread_id);
|
||||||
|
//print_a($thread_info);
|
||||||
|
|
||||||
|
// Check if user is allowed to view this forum topic
|
||||||
}
|
if(!$forum->checkPerm($thread_info['thread_forum_id'], 'view'))
|
||||||
|
{
|
||||||
|
return LAN_FORUM_0008;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all posts in this topic
|
||||||
|
$post_list = $forum->postGet($thread_id, 0, 9999);
|
||||||
|
//print_a($post_list);
|
||||||
|
|
||||||
|
// Set topic name
|
||||||
|
$topic_name = e107::getParser()->toHTML($thread_info['thread_name'], true);
|
||||||
|
|
||||||
|
// Display topic name
|
||||||
|
$text .= "<strong>".$topic_name."</strong><br />";
|
||||||
|
|
||||||
|
// Display initial (first) post in topic
|
||||||
|
$text .= "
|
||||||
|
".$post_list[0]['user_name'].", ".e107::getDate()->convert_date($post_list[0]['post_datestamp'], "forum")."
|
||||||
|
<br /><br />
|
||||||
|
".$tp->toHTML($post_list[0]['post_entry'], true);
|
||||||
|
|
||||||
|
// Remove original post from $post_list array, so only replies are left
|
||||||
|
unset($post_list['0']);
|
||||||
|
|
||||||
|
// Loop through each reply
|
||||||
|
foreach($post_list as $reply)
|
||||||
|
{
|
||||||
|
$text .= "<br /><br />Re: <strong>".$topic_name."</strong><br />
|
||||||
|
".$reply['user_name'].", ".e107::getDate()->convert_date($reply['post_datestamp'], "forum")."<br /><br />
|
||||||
|
".$tp->toHTML($reply['post_entry'], TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
}
|
@@ -71,6 +71,12 @@ class forum_setup
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Check if e_print addon is loaded
|
||||||
|
if(!e107::getAddon('forum','e_print'))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,5 +134,11 @@ class forum_setup
|
|||||||
$mes->addSuccess("Migration is required. Please click 'Continue'.<br /><a class='btn btn-primary' href='".e_PLUGIN."forum/forum_update.php'>Continue</a>");
|
$mes->addSuccess("Migration is required. Please click 'Continue'.<br /><a class='btn btn-primary' href='".e_PLUGIN."forum/forum_update.php'>Continue</a>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(!e107::getAddon('forum','e_print'))
|
||||||
|
{
|
||||||
|
e107::getPlug()->clearCache()->buildAddonPrefLists();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user