1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

edit and quote progress

This commit is contained in:
mcfly
2008-12-11 21:50:18 +00:00
parent 9af14eaf19
commit 87d254582c
7 changed files with 141 additions and 68 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_class.php,v $
| $Revision: 1.23 $ | $Revision: 1.24 $
| $Date: 2008-12-11 16:02:05 $ | $Date: 2008-12-11 21:50:18 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -293,23 +293,35 @@ class e107forum
return false; return false;
} }
function postGet($threadId, $start, $num) function postGet($id, $start, $num)
{ {
$id = (int)$id;
$ret = false; $ret = false;
$e107 = e107::getInstance(); $e107 = e107::getInstance();
$qry = ' if('post' === $start)
SELECT p.*, {
u.user_name, u.user_customtitle, u.user_hideemail, u.user_email, u.user_signature, $qry = '
u.user_admin, u.user_image, u.user_join, ue.user_plugin_forum_posts, SELECT u.user_name, t.thread_active, t.thread_datestamp, t.thread_name, p.* FROM `#forum_post` AS p
eu.user_name AS edit_name LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread
FROM `#forum_post` AS p LEFT JOIN `#user` AS u ON u.user_id = p.post_user
LEFT JOIN `#user` AS u ON p.post_user = u.user_id WHERE p.post_id = '.$id;
LEFT JOIN `#user` AS eu ON p.post_edit_user IS NOT NULL AND p.post_edit_user = eu.user_id }
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = p.post_user else
WHERE p.post_thread = '.$threadId." {
ORDER BY p.post_datestamp ASC $qry = "
LIMIT {$start}, {$num} SELECT p.*,
"; u.user_name, u.user_customtitle, u.user_hideemail, u.user_email, u.user_signature,
u.user_admin, u.user_image, u.user_join, ue.user_plugin_forum_posts,
eu.user_name AS edit_name
FROM `#forum_post` AS p
LEFT JOIN `#user` AS u ON p.post_user = u.user_id
LEFT JOIN `#user` AS eu ON p.post_edit_user IS NOT NULL AND p.post_edit_user = eu.user_id
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = p.post_user
WHERE p.post_thread = {$id}
ORDER BY p.post_datestamp ASC
LIMIT {$start}, {$num}
";
}
if($e107->sql->db_Select_gen($qry)) if($e107->sql->db_Select_gen($qry))
{ {
$ret = array(); $ret = array();
@@ -318,6 +330,7 @@ class e107forum
$ret[] = $row; $ret[] = $row;
} }
} }
if('post' === $start) { return $ret[0]; }
return $ret; return $ret;
} }

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_post.php,v $
| $Revision: 1.29 $ | $Revision: 1.30 $
| $Date: 2008-12-11 16:02:05 $ | $Date: 2008-12-11 21:50:18 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -22,27 +22,23 @@ $e_wysiwyg = 'post';
$lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php'; $lan_file = e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum_post.php';
include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php'); include(file_exists($lan_file) ? $lan_file : e_PLUGIN.'forum/languages/English/lan_forum_post.php');
//var_dump($_POST);
//exit;
if (isset($_POST['fjsubmit'])) if (isset($_POST['fjsubmit']))
{ {
header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id'=>$_POST['forumjump']))); header('location:'.$e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id'=>$_POST['forumjump'])));
exit; exit;
} }
//$_POST['forumjump']
require_once(e_PLUGIN.'forum/forum_class.php'); require_once(e_PLUGIN.'forum/forum_class.php');
$forum = new e107forum; $forum = new e107forum;
if (!e_QUERY || !isset($_REQUEST['id'])) if (!e_QUERY || !isset($_GET['id']))
{ {
header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main'))); header('Location:'.$e107->url->getUrl('forum', 'forum', array('func' => 'main')));
exit; exit;
} }
$action = trim($_REQUEST['f']); $action = trim($_GET['f']);
$id = (int)$_REQUEST['id']; $id = (int)$_GET['id'];
switch($action) switch($action)
{ {
@@ -58,13 +54,13 @@ switch($action)
case 'quote': case 'quote':
case 'edit': case 'edit':
$thread_info = $forum->thread_get_postinfo($id, true); $postInfo = $forum->postGet($id, 'post');
$forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']); $threadInfo = $postInfo;
if($_REQUST['f'] == 'quote') $forumId = $postInfo['post_forum'];
{ // print_a($postInfo);
$id = $thread_info['head']['thread_id']; // exit;
} // $forum_info = $forum->forum_get($thread_info['head']['thread_forum_id']);
$forumId = $forum_info['forum_id']; // $forumId = $forum_info['forum_id'];
break; break;
default: default:
@@ -73,6 +69,7 @@ switch($action)
} }
echo "forumId = $forumId <br />";
// check if user can post to this forum ... // check if user can post to this forum ...
if (!$forum->checkPerm($forumId, 'post')) if (!$forum->checkPerm($forumId, 'post'))
{ {
@@ -419,45 +416,45 @@ if ($error)
if ($action == 'edit' || $action == 'quote') if ($action == 'edit' || $action == 'quote')
{ {
if ($action == "edit") if ($action == 'edit')
{ {
if (!isAuthor()) if (!isAuthor())
{ {
$ns->tablerender(LAN_95, "<div style='text-align:center'>".LAN_96."</div>"); $ns->tablerender(LAN_95, "<div style='text-align:center'>".LAN_96.'</div>');
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
} }
} }
if(!is_array($thread_info[0]))
{
$ns -> tablerender(LAN_20, "<div style='text-align:center'>".LAN_96."</div>");
require_once(FOOTERF);
exit;
}
$thread_info[0]['user_name'] = $forum->thread_user($thread_info[0]);
if (!isset($_POST['fpreview'])) if (!isset($_POST['fpreview']))
{ {
$subject = $thread_info['0']['thread_name']; $post = $e107->tp->toForm($postInfo['post_entry']);
$post = $tp->toForm($thread_info[0]['thread_thread']); if($postInfo['post_datestamp'] == $postInfo['thread_datestamp'])
{
$subject = $e107->tp->toForm($postInfo['thread_name']);
}
} }
$post = preg_replace("/&lt;span class=&#39;smallblacktext&#39;.*\span\>/", "", $post);
if ($action == 'quote') { if ($action == 'quote')
$post = preg_replace("#\[hide].*?\[/hide]#s", "", $post); {
$tmp = explode(chr(1), $thread_info[0]['user_name']); //remote [hide] bbcode, or else it doesn't hide stuff too well :)
$timeStamp = time(); $post = preg_replace('#\[hide].*?\[/hide]#s', '', $post);
$post = "[quote{$timeStamp}={$tmp[0]}]\n".$post."\n[/quote{$timeStamp}]\n"; $quoteName = ($postInfo['user_name'] ? $postInfo['user_name'] : $postInfo['post_user_anon']);
$eaction = FALSE; $post = "[quote={$quoteName}]\n".$post."\n[/quote]\n";
// $eaction = true;
$action = 'reply'; $action = 'reply';
} else { }
$eaction = TRUE; else
if ($thread_info['0']['thread_parent']) { {
$action = "reply"; $eaction = true;
} else { if($postInfo['post_datestamp'] != $postInfo['thread_datestamp'])
$action = "nt"; {
$sact = "canc"; // added to override the bugtracker query below $action = 'reply';
}
else
{
$action = 'nt';
$sact = 'canc'; // added to override the bugtracker query below
} }
} }
} }
@@ -526,7 +523,8 @@ else
function isAuthor() function isAuthor()
{ {
global $threadInfo; global $postInfo;
print_a($postInfo);
return ((USERID === $postInfo['post_user']) || MODERATOR); return ((USERID === $postInfo['post_user']) || MODERATOR);
} }

View File

@@ -47,7 +47,7 @@ SC_END
SC_BEGIN SUBJECTBOX SC_BEGIN SUBJECTBOX
global $subjectbox, $action; global $subjectbox, $action;
return ($action == "nt" ? $subjectbox : ""); return ($action == 'nt' ? $subjectbox : '');
SC_END SC_END
SC_BEGIN POSTTYPE SC_BEGIN POSTTYPE
@@ -121,7 +121,8 @@ return $BREADCRUMB;
SC_END SC_END
SC_BEGIN EMAILNOTIFY SC_BEGIN EMAILNOTIFY
global $pref, $thread_info, $action; global $pref, $thread_info, $action, $eaction;
if($eaction == true) { return ; }
if ($pref['email_notify'] && $action == 'nt' && USER) if ($pref['email_notify'] && $action == 'nt' && USER)
{ {
if(isset($_POST['fpreview'])) if(isset($_POST['fpreview']))

View File

@@ -27,6 +27,19 @@ $e107 = e107::getInstance();
return $e107->tp->toHTML($postInfo['post_entry'], true, 'USER_BODY', 'class:'.$post_info['user_class']); return $e107->tp->toHTML($postInfo['post_entry'], true, 'USER_BODY', 'class:'.$post_info['user_class']);
SC_END SC_END
SC_BEGIN POSTDELETED
global $postInfo;
if($postInfo['post_s'])
{
$info = unserialize($postInfo['post_options']);
return "
Post delete on: {$info['deldate']}<br />
reason: {$info['delreason']}
";
$ret = '<pre>'.print_r($info, true).'</pre>';
}
SC_END
SC_BEGIN ATTACHMENTS SC_BEGIN ATTACHMENTS
global $postInfo; global $postInfo;
$e107 = e107::getInstance(); $e107 = e107::getInstance();

View File

@@ -47,6 +47,7 @@ CREATE TABLE forum_post (
`post_entry` text NOT NULL, `post_entry` text NOT NULL,
`post_thread` int(10) unsigned default NULL, `post_thread` int(10) unsigned default NULL,
`post_forum` int(10) unsigned default NULL, `post_forum` int(10) unsigned default NULL,
`post_s` tinyint(1) unsigned NOT NULL default '0',
`post_datestamp` int(10) unsigned NOT NULL default '0', `post_datestamp` int(10) unsigned NOT NULL default '0',
`post_user` int(10) unsigned NOT NULL, `post_user` int(10) unsigned NOT NULL,
`post_edit_datestamp` int(10) unsigned NOT NULL default '0', `post_edit_datestamp` int(10) unsigned NOT NULL default '0',

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/forum_viewtopic.php,v $
| $Revision: 1.12 $ | $Revision: 1.13 $
| $Date: 2008-12-11 16:02:05 $ | $Date: 2008-12-11 21:50:18 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -208,14 +208,16 @@ foreach ($postList as $postInfo)
{ {
$postInfo['thread_start'] = false; $postInfo['thread_start'] = false;
$alt = !$alt; $alt = !$alt;
if (isset($FORUMREPLYSTYLE_ALT) && $alt)
if($postInfo['post_s'])
{ {
$forrep .= $e107->tp->parseTemplate($FORUMREPLYSTYLE_ALT, true, $forum_shortcodes) . "\n"; $_style = (isset($FORUMDELETEDSTYLE_ALT) && $alt ? $FORUMDELETEDSTYLE_ALT : $FORUMDELETEDSTYLE);
} }
else else
{ {
$forrep .= $e107->tp->parseTemplate($FORUMREPLYSTYLE, true, $forum_shortcodes) . "\n"; $_style = (isset($FORUMREPLYSTYLE_ALT) && $alt ? $FORUMREPLYSTYLE_ALT : $FORUMREPLYSTYLE);
} }
$forrep .= $e107->tp->parseTemplate($_style, true, $forum_shortcodes) . "\n";
} }
else else
{ {

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_viewtopic_template.php,v $ | $Source: /cvs_backup/e107_0.8/e107_plugins/forum/templates/forum_viewtopic_template.php,v $
| $Revision: 1.3 $ | $Revision: 1.4 $
| $Date: 2008-12-08 02:33:34 $ | $Date: 2008-12-11 21:50:18 $
| $Author: mcfly_e107 $ | $Author: mcfly_e107 $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -246,6 +246,51 @@ $FORUMREPLYSTYLE = "<tr>
</td> </td>
</tr>"; </tr>";
$FORUMDELETEDSTYLE = "<tr>
<td class='forumheader' style='vertical-align:middle'>
{POSTER}
{ANON_IP}
</td>
<td class='forumheader' style='vertical-align:middle'>
<table cellspacing='0' cellpadding='0' style='width:100%'>
<tr>
<td class='smallblacktext'>
{THREADDATESTAMP}
</td>
<td style='text-align:right'>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class='forumheader3' style='vertical-align:top' colspan='2'>
{POSTDELETED}
</td>
</tr>
<tr>
<td class='finfobar'>
<span class='smallblacktext'>
</span>
</td>
<td class='finfobar' style='vertical-align:top' colspan='2'>
<table cellspacing='0' cellpadding='0' style='width:100%'>
<tr>
<td>
</td>
<td style='text-align:right'>
{MODOPTIONS}
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan='2'>
</td>
</tr>";
$FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>"; $FORUM_CRUMB['sitename']['value'] = "<a class='forumlink' {SITENAME_HREF}>{SITENAME}</a>";
$FORUM_CRUMB['sitename']['sep'] = " :: "; $FORUM_CRUMB['sitename']['sep'] = " :: ";