Thread locking ineffectual (patches included)
[email protected] Thu, 15 Jun 2006 14:25:01 -0400
| Newsgroups | gmane.comp.horde.agora |
|---|---|
| Message-ID | <[email protected]> |
This message is in MIME format.
--=_1qpmeqi7j0d
Content-Type: text/plain;
charset=ISO-8859-1;
format="flowed"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
Thread "locking" removes the Reply link from the threads view, but does not:
a) prevent actual replies from being made at the lib/ level
b) prevent the Reply To (...) form from being displayed when viewing
messages in locked threads
The following is a patch (generated by 'svn diff') for
AGORA_BASE/messages/message.php which prevents the Reply To form from
being displayed:
Index: message.php
===================================================================
@@ -77,9 +77,14 @@
$template->set('message_body',
Text_Filter::filter($message_array['message_body'], 'highlightquotes'));
$template->set('message_attachment', $message->getAttachmentLink(), true);
$template->set('actions', $actions, true);
-
+
$template_file = AGORA_TEMPLATES . '/messages/message.html';
- $title = sprintf(_("Post a Reply to \"%s\""),
$messages->forum->getShortName());
+ if (!$message->isLocked()){
+ $title = sprintf(_("Post a Reply to \"%s\""),
$messages->forum->getShortName());
+ }
+ else{
+ $title = 'ERROR THIS SHOULDN\'T BE DISPLAYED';
+ }
} else {
$template_file = AGORA_TEMPLATES . '/messages/message_thread.html';
$title = sprintf(_("Post a New Message to \"%s\""),
$messages->forum->getShortName());
@@ -115,7 +120,9 @@
$vars->set('message_body', $message_array['plain_body']);
}
$renderer = &new Horde_Form_Renderer();
-$template->set('form', Util::bufferOutput(array($form,
'renderActive'), $renderer, $vars, 'edit.php', 'post'));
+/* Display an edit-dialogue if the thread is not locked. */
+if(!$message->isLocked())
+ $template->set('form', Util::bufferOutput(array($form,
'renderActive'), $renderer, $vars, 'edit.php', 'post'));
$title = $messages->forum->getShortName() . ' :: ' .
$message_array['plain_subject'];
require AGORA_TEMPLATES . '/common-header.inc';
And the following is a patch (generated by 'svn diff') for
AGORA_BASE/lib/Messages.php which prevents the reply from going through
regardless of what dialogues are displayed to the user, and returns a
proper PEAR_Error which edit.php displays appropriately:
Index: Messages.php
===================================================================
@@ -143,6 +143,13 @@
/* Check if message_id exists to figure out if updating or creating
* a new message. */
if (empty($info['message_id'])) {
+
+ /* Check if the thread is locked before changing anything. */
+ if($this->isThreadLocked($info['message_parent_id'])){
+ require_once('PEAR.php');
+ return new PEAR_Error('This thread has been locked.');
+ }
+
/* Increment the message sequential id for this forum and save. */
$this->forum->data['message_seq']++;
$this->forum->saveForumData();
Thanks,
Stephen Ayotte
sayotte (at) alkaloid (dot) net
==========================>
<www.nowdesigning.com>
digital solutions provider
==========================<
--=_1qpmeqi7j0d
Content-Type: text/x-patch;
charset=ISO-8859-1;
name="message.php.diff"
Content-Disposition: attachment;
filename="message.php.diff"
Content-Transfer-Encoding: 7bit
Index: message.php
===================================================================
--- message.php (revision 200)
+++ message.php (working copy)
@@ -77,9 +77,14 @@
$template->set('message_body', Text_Filter::filter($message_array['message_body'], 'highlightquotes'));
$template->set('message_attachment', $message->getAttachmentLink(), true);
$template->set('actions', $actions, true);
-
+
$template_file = AGORA_TEMPLATES . '/messages/message.html';
- $title = sprintf(_("Post a Reply to \"%s\""), $messages->forum->getShortName());
+ if (!$message->isLocked()){
+ $title = sprintf(_("Post a Reply to \"%s\""), $messages->forum->getShortName());
+ }
+ else{
+ $title = 'ERROR THIS SHOULDN\'T BE DISPLAYED';
+ }
} else {
$template_file = AGORA_TEMPLATES . '/messages/message_thread.html';
$title = sprintf(_("Post a New Message to \"%s\""), $messages->forum->getShortName());
@@ -115,7 +120,9 @@
$vars->set('message_body', $message_array['plain_body']);
}
$renderer = &new Horde_Form_Renderer();
-$template->set('form', Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'edit.php', 'post'));
+/* Display an edit-dialogue if the thread is not locked. */
+if(!$message->isLocked())
+ $template->set('form', Util::bufferOutput(array($form, 'renderActive'), $renderer, $vars, 'edit.php', 'post'));
$title = $messages->forum->getShortName() . ' :: ' . $message_array['plain_subject'];
require AGORA_TEMPLATES . '/common-header.inc';
--=_1qpmeqi7j0d
Content-Type: text/x-patch;
charset=ISO-8859-1;
name="Messages.php.diff"
Content-Disposition: attachment;
filename="Messages.php.diff"
Content-Transfer-Encoding: 7bit
Index: Messages.php
===================================================================
--- Messages.php (revision 200)
+++ Messages.php (working copy)
@@ -143,6 +143,13 @@
/* Check if message_id exists to figure out if updating or creating
* a new message. */
if (empty($info['message_id'])) {
+
+ /* Check if the thread is locked before changing anything. */
+ if($this->isThreadLocked($info['message_parent_id'])){
+ require_once('PEAR.php');
+ return new PEAR_Error('This thread has been locked.');
+ }
+
/* Increment the message sequential id for this forum and save. */
$this->forum->data['message_seq']++;
$this->forum->saveForumData();
--=_1qpmeqi7j0d
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
--
agora mailing list - Join the hunt: http://horde.org/bounties/#agora
Frequently Asked Questions: http://horde.org/faq/
To unsubscribe, mail: [email protected]
--=_1qpmeqi7j0d--