[agora] Thread locking ineffectual (patches included)

sayotte@alkaloid.net sayotte at alkaloid.net
Thu Jun 15 11:25:01 PDT 2006


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
==========================<

-------------- next part --------------
A non-text attachment was scrubbed...
Name: message.php.diff
Type: text/x-patch
Size: 1524 bytes
Desc: not available
Url : http://lists.horde.org/archives/agora/attachments/20060615/9882d9bb/message.php.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Messages.php.diff
Type: text/x-patch
Size: 766 bytes
Desc: not available
Url : http://lists.horde.org/archives/agora/attachments/20060615/9882d9bb/Messages.php.bin


More information about the agora mailing list