Skip to content

Commit

Permalink
Fixes bug in paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmj committed Jan 30, 2012
1 parent 8c5aea7 commit 0128adf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
16 changes: 9 additions & 7 deletions CommentForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -22,7 +22,7 @@ public function init()
'privkey' => get_option('recaptcha_private_key')
)
));

}

$urlOptions = array(
Expand Down Expand Up @@ -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');

}
}
2 changes: 1 addition & 1 deletion controllers/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion helpers/commenting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0128adf

Please sign in to comment.