| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/Topogeo/ojs/classes/handler/validation/ |
Upload File : |
<?php
/**
* @file classes/handler/HandlerValidatorSubmissionComment.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class HandlerValidatorSubmissionComment
* @ingroup handler_validation
*
* @brief Class to validate that a comment exists (by id) and that the current user has access
*/
import('lib.pkp.classes.handler.validation.HandlerValidator');
class HandlerValidatorSubmissionComment extends HandlerValidator {
var $commentId;
/**
* Constructor.
* @param $handler Handler the associated form
* @param $roles array of role id's
* @param $all bool flag for whether all roles must exist or just 1
*/
function HandlerValidatorSubmissionComment(&$handler, $commentId) {
parent::HandlerValidator($handler);
$this->commentId = $commentId;
}
/**
* Check if field value is valid.
* Value is valid if it is empty and optional or validated by user-supplied function.
* @return boolean
*/
function isValid() {
$isValid = true;
$articleCommentDao =& DAORegistry::getDAO('ArticleCommentDAO');
$user =& Request::getUser();
$comment =& $articleCommentDao->getArticleCommentById($this->commentId);
if ($comment == null) {
$isValid = false;
} else if ($comment->getAuthorId() != $user->getId()) {
$isValid = false;
}
if (!$isValid) {
Request::redirect(null, Request::getRequestedPage());
}
$handler =& $this->handler;
$handler->comment =& $comment;
return true;
}
}
?>