From 0128adfccfc41722576bc6d4299f98428954375a Mon Sep 17 00:00:00 2001 From: Patrick Murray-John Date: Mon, 30 Jan 2012 11:00:31 -0500 Subject: [PATCH] Fixes bug in paths. --- CommentForm.php | 16 +++++++++------- controllers/CommentController.php | 2 +- helpers/commenting.php | 3 ++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CommentForm.php b/CommentForm.php index 9ef26bc..c107fb1 100644 --- a/CommentForm.php +++ b/CommentForm.php @@ -3,14 +3,14 @@ class Commenting_CommentForm extends Omeka_Form { - + public function init() { parent::init(); $this->setAction(WEB_ROOT . '/commenting/comment/add'); $this->setAttrib('id', 'comment-form'); $user = current_user(); - + //assume registered users are trusted and don't make them play recaptcha if(!$user) { $this->addElement('captcha', 'captcha', array( @@ -22,7 +22,7 @@ public function init() 'privkey' => get_option('recaptcha_private_key') ) )); - + } $urlOptions = array( @@ -59,19 +59,21 @@ public function init() ), ) ); - + $request = Omeka_Context::getInstance()->getRequest(); $params = $request->getParams(); $model = commenting_get_model($request); $record_id = commenting_get_record_id($request); - + $this->addElement('text', 'record_id', array('value'=>$record_id, 'hidden'=>true, 'class' => 'hidden')); $this->addElement('text', 'path', array('value'=> $request->getPathInfo(), 'hidden'=>true, 'class' => 'hidden')); - $this->addElement('text', 'module', array('value'=>$params['module'], 'hidden'=>true, 'class' => 'hidden')); + if(isset($params['module'])) { + $this->addElement('text', 'module', array('value'=>$params['module'], 'hidden'=>true, 'class' => 'hidden')); + } $this->addElement('text', 'record_type', array('value'=>$model, 'hidden'=>true, 'class' => 'hidden')); $this->addElement('text', 'parent_comment_id', array('id'=>'parent-id', 'value'=>null, 'hidden'=>true, 'class' => 'hidden')); $this->addElement('submit', 'submit'); - + } } \ No newline at end of file diff --git a/controllers/CommentController.php b/controllers/CommentController.php index ebd7273..0f4a1a6 100644 --- a/controllers/CommentController.php +++ b/controllers/CommentController.php @@ -93,7 +93,7 @@ public function updateapprovedAction() $commentIds = $_POST['ids']; $status = $_POST['approved']; $table = $this->getTable(); - if(!commentIds) { + if(! $commentIds) { return; } foreach($commentIds as $commentId) { diff --git a/helpers/commenting.php b/helpers/commenting.php index a121b0b..066e6f7 100644 --- a/helpers/commenting.php +++ b/helpers/commenting.php @@ -133,7 +133,8 @@ function commenting_render_comments($comments, $admin=false) function commenting_comment_uri($comment, $includeHash = true) { - $uri = $comment->path; + $uri = PUBLIC_BASE_URL . $comment->path; + if($includeHash) { $uri .= "#comment-" . $comment->id; }