예제 #1
0
 function reportComment()
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $acl =& JCommentsFactory::getACL();
     $db =& JCommentsFactory::getDBO();
     $config =& JCommentsFactory::getConfig();
     $response =& JCommentsFactory::getAjaxResponse();
     $values = JCommentsAJAX::prepareValues($_POST);
     $id = (int) $values['commentid'];
     $reason = trim(strip_tags($values['reason']));
     $name = trim(strip_tags($values['name']));
     $ip = $acl->getUserIP();
     if ($reason == '') {
         JCommentsAJAX::showErrorMessage(JText::_('Please enter the reason for your report!'), '', 'comments-report-form');
         return $response;
     }
     $query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
     if ($acl->getUserId()) {
         $query .= ' AND userid = ' . $acl->getUserId();
     } else {
         $query .= ' AND ip = "' . $ip . '"';
     }
     $db->setQuery($query);
     $reported = $db->loadResult();
     if (!$reported) {
         $query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
         $db->setQuery($query);
         $reported = $db->loadResult();
         if (!$reported) {
             $comment = new JCommentsDB($db);
             if ($comment->load($id)) {
                 if ($acl->canReport($comment)) {
                     $allowed = true;
                     if ($config->getInt('enable_mambots') == 1) {
                         require_once JCOMMENTS_HELPERS . DS . 'plugin.php';
                         JCommentsPluginHelper::importPlugin('jcomments');
                         JCommentsPluginHelper::trigger('onReportComment', array(&$comment, &$response, &$allowed, &$value));
                     }
                     if ($allowed !== false) {
                         if ($acl->getUserId()) {
                             $user = JCommentsFactory::getUser();
                             $name = $user->name;
                         } else {
                             if ($name == '') {
                                 $name = JText::_('Guest');
                             }
                         }
                         $query = "INSERT INTO `#__jcomments_reports`(`commentid`,`userid`, `name`,`ip`,`date`,`reason`)" . "VALUES('" . $comment->id . "', '" . $acl->getUserId() . "', '" . $db->getEscaped($name) . "', '" . $db->getEscaped($ip) . "', now(), '" . $db->getEscaped($reason) . "')";
                         $db->setQuery($query);
                         $db->query();
                         if ($config->getInt('enable_notification') == 1) {
                             if ($config->check('notification_type', 2)) {
                                 $comment->datetime = $comment->date;
                                 if (is_string($comment->datetime)) {
                                     $comment->datetime = strtotime($comment->datetime);
                                 }
                                 JComments::sendReport($comment, $name, $reason);
                             }
                         }
                         $html = JText::_('Report successfully sent!');
                         $html = str_replace("\n", '\\n', $html);
                         $html = str_replace('\\n', '<br />', $html);
                         $html = JCommentsText::jsEscape($html);
                         $response->addScript("jcomments.closeReport('{$html}');");
                     }
                 } else {
                     JCommentsAJAX::showErrorMessage(JText::_('You have no rights to report comment!'), '', 'comments-report-form');
                 }
             } else {
                 $response->addAlert(JText::_('ERROR_NOT_FOUND'));
             }
             unset($comment);
         } else {
             JCommentsAJAX::showErrorMessage(JText::_('Comment already reported to the site administrator'), '', 'comments-report-form');
         }
     } else {
         JCommentsAJAX::showErrorMessage(JText::_('You can\'t report the same comment more than once!'), '', 'comments-report-form');
     }
     return $response;
 }
예제 #2
0
    function getCommentsFormFull()
    {
        $object_id = $this->getVar('comment-object_id');
        $object_group = $this->getVar('comment-object_group');
        $htmlBeforeForm = $this->getVar('comments-form-html-before');
        $htmlAfterForm = $this->getVar('comments-form-html-after');
        ?>
<h4><?php 
        echo JText::_('FORM_HEADER');
        ?>
</h4>
<?php 
        if ($this->getVar('comments-form-policy', 0) == 1) {
            ?>
<div class="comments-policy"><?php 
            echo $this->getVar('comments-policy');
            ?>
</div>
<?php 
        }
        echo $htmlBeforeForm;
        ?>
<a id="addcomments" href="#addcomments"></a>
<form id="comments-form" name="comments-form" action="javascript:void(null);">
<?php 
        if ($this->getVar('comments-form-user-name', 1) == 1) {
            ?>
<p>
	<input id="comments-form-name" type="text" name="name" value="" maxlength="<?php 
            echo $this->getVar('comment-name-maxlength');
            ?>
" size="22" tabindex="1" />
	<label for="comments-form-name"><?php 
            echo JText::_('FORM_NAME');
            ?>
</label>
</p>
<?php 
        }
        if ($this->getVar('comments-form-user-email', 1) == 1) {
            $text = $this->getVar('comments-form-email-required', 1) == 0 ? JText::_('FORM_EMAIL') : JText::_('FORM_EMAIL_REQUIRED');
            ?>
<p>
	<input id="comments-form-email" type="text" name="email" value="" size="22" tabindex="2" />
	<label for="comments-form-email"><?php 
            echo $text;
            ?>
</label>
</p>
<?php 
        }
        if ($this->getVar('comments-form-user-homepage', 0) == 1) {
            $text = $this->getVar('comments-form-homepage-required', 1) == 0 ? JText::_('FORM_HOMEPAGE') : JText::_('FORM_HOMEPAGE_REQUIRED');
            ?>
<p>
	<input id="comments-form-homepage" type="text" name="homepage" value="" size="22" tabindex="3" />
	<label for="comments-form-homepage"><?php 
            echo $text;
            ?>
</label>
</p>
<?php 
        }
        if ($this->getVar('comments-form-title', 0) == 1) {
            $text = $this->getVar('comments-form-title-required', 1) == 0 ? JText::_('FORM_TITLE') : JText::_('FORM_TITLE_REQUIRED');
            ?>
<p>
	<input id="comments-form-title" type="text" name="title" value="" size="22" tabindex="4" />
	<label for="comments-form-title"><?php 
            echo $text;
            ?>
</label>
</p>
<?php 
        }
        ?>
<p>
	<textarea id="comments-form-comment" name="comment" cols="65" rows="8" tabindex="5"></textarea>
</p>
<?php 
        if ($this->getVar('comments-form-subscribe', 0) == 1) {
            ?>
<p>
	<input class="checkbox" id="comments-form-subscribe" type="checkbox" name="subscribe" value="1" tabindex="5" />
	<label for="comments-form-subscribe"><?php 
            echo JText::_('FORM_SUBSCRIBE');
            ?>
</label><br />
</p>
<?php 
        }
        if ($this->getVar('comments-form-captcha', 0) == 1) {
            $html = $this->getVar('comments-form-captcha-html');
            if ($html != '') {
                echo $html;
            } else {
                $link = JCommentsFactory::getLink('captcha');
                ?>
<p>
	<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" name="captcha-image" src="<?php 
                echo $link;
                ?>
" width="121" height="60" alt="<?php 
                echo JText::_('FORM_CAPTCHA');
                ?>
" /><br />
	<span class="captcha" onclick="jcomments.clear('captcha');"><?php 
                echo JText::_('FORM_CAPTCHA_REFRESH');
                ?>
</span><br />
	<input class="captcha" id="comments-form-captcha" type="text" name="captcha-refid" value="" size="5" tabindex="6" /><br />
</p>
<?php 
            }
        }
        ?>
<div id="comments-form-buttons">
	<div class="btn" id="comments-form-send"><div><a href="#" tabindex="7" onclick="jcomments.saveComment();return false;" title="<?php 
        echo JText::_('FORM_SEND_HINT');
        ?>
"><?php 
        echo JText::_('FORM_SEND');
        ?>
</a></div></div>
	<div class="btn" id="comments-form-cancel" style="display:none;"><div><a href="#" tabindex="8" onclick="return false;" title="<?php 
        echo JText::_('FORM_CANCEL');
        ?>
"><?php 
        echo JText::_('FORM_CANCEL');
        ?>
</a></div></div>
	<div style="clear:both;"></div>
</div>
	<input type="hidden" name="object_id" value="<?php 
        echo $object_id;
        ?>
" />
	<input type="hidden" name="object_group" value="<?php 
        echo $object_group;
        ?>
" />
</form>
<script type="text/javascript">
<!--
function JCommentsInitializeForm()
{
	var jcEditor = new JCommentsEditor('comments-form-comment', true);
<?php 
        if ($this->getVar('comments-form-bbcode', 0) == 1) {
            $bbcodes = array('b' => array(0 => JText::_('FORM_BBCODE_B'), 1 => JText::_('Enter text')), 'i' => array(0 => JText::_('FORM_BBCODE_I'), 1 => JText::_('Enter text')), 'u' => array(0 => JText::_('FORM_BBCODE_U'), 1 => JText::_('Enter text')), 's' => array(0 => JText::_('FORM_BBCODE_S'), 1 => JText::_('Enter text')), 'img' => array(0 => JText::_('FORM_BBCODE_IMG'), 1 => JText::_('Enter full URL to the image')), 'url' => array(0 => JText::_('FORM_BBCODE_URL'), 1 => JText::_('Enter full URL')), 'hide' => array(0 => JText::_('FORM_BBCODE_HIDE'), 1 => JText::_('Enter text to hide it from unregistered')), 'quote' => array(0 => JText::_('FORM_BBCODE_QUOTE'), 1 => JText::_('Enter text to quote')), 'list' => array(0 => JText::_('FORM_BBCODE_LIST'), 1 => JText::_('Enter list item text')));
            foreach ($bbcodes as $k => $v) {
                if ($this->getVar('comments-form-bbcode-' . $k, 0) == 1) {
                    $title = trim(JCommentsText::jsEscape($v[0]));
                    $text = trim(JCommentsText::jsEscape($v[1]));
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
');
<?php 
                }
            }
        }
        $customBBCodes = $this->getVar('comments-form-custombbcodes');
        if (count($customBBCodes)) {
            foreach ($customBBCodes as $code) {
                if ($code->button_enabled) {
                    $k = 'custombbcode' . $code->id;
                    $title = trim(JCommentsText::jsEscape($code->button_title));
                    $text = empty($code->button_prompt) ? JText::_('Enter text') : JText::_($code->button_prompt);
                    $open_tag = $code->button_open_tag;
                    $close_tag = $code->button_close_tag;
                    $icon = $code->button_image;
                    $css = $code->button_css;
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
','<?php 
                    echo $open_tag;
                    ?>
','<?php 
                    echo $close_tag;
                    ?>
','<?php 
                    echo $css;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        $smiles = $this->getVar('comment-form-smiles');
        if (isset($smiles)) {
            if (is_array($smiles) && count($smiles) > 0) {
                ?>
	jcEditor.initSmiles('<?php 
                echo $this->getVar("smilesurl");
                ?>
');
<?php 
                foreach ($smiles as $code => $icon) {
                    $code = trim(JCommentsText::jsEscape($code));
                    $icon = trim(JCommentsText::jsEscape($icon));
                    ?>
	jcEditor.addSmile('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        if ($this->getVar('comments-form-showlength-counter', 0) == 1) {
            ?>
	jcEditor.addCounter(<?php 
            echo $this->getVar('comment-maxlength');
            ?>
, '<?php 
            echo JText::_('FORM_CHARSLEFT_PREFIX');
            ?>
', '<?php 
            echo JText::_('FORM_CHARSLEFT_SUFFIX');
            ?>
', 'counter');
<?php 
        }
        ?>
	jcomments.setForm(new JCommentsForm('comments-form', jcEditor));
}

<?php 
        if ($this->getVar('comments-form-ajax', 0) == 1) {
            ?>
setTimeout(JCommentsInitializeForm, 100);
<?php 
        } else {
            ?>
if (window.addEventListener) {window.addEventListener('load',JCommentsInitializeForm,false);}
else if (document.addEventListener){document.addEventListener('load',JCommentsInitializeForm,false);}
else if (window.attachEvent){window.attachEvent('onload',JCommentsInitializeForm);}
else {if (typeof window.onload=='function'){var oldload=window.onload;window.onload=function(){oldload();JCommentsInitializeForm();}} else window.onload=JCommentsInitializeForm;} 
<?php 
        }
        ?>
//-->
</script>
<?php 
        echo $htmlAfterForm;
    }
예제 #3
0
    function getCommentsFormFull()
    {
        $object_id = $this->getVar('comment-object_id');
        $object_group = $this->getVar('comment-object_group');
        $htmlBeforeForm = $this->getVar('comments-form-html-before');
        $htmlAfterForm = $this->getVar('comments-form-html-after');
        ?>
<div class="comment-formular">
<h3>Leave a comment</h3>
<?php 
        if ($this->getVar('comments-form-policy', 0) == 1) {
            ?>
<div class="comments-policy"><?php 
            echo $this->getVar('comments-policy');
            ?>
</div>
<?php 
        }
        echo $htmlBeforeForm;
        ?>
<a id="addcomments" href="#addcomments"></a>
<form id="comments-form" class="validate" name="comments-form" action="javascript:void(null);">
<?php 
        if ($this->getVar('comments-form-user-name', 1) == 1) {
            $text = $this->getVar('comments-form-user-name-required', 1) == 0 ? JText::_('FORM_NAME') : JText::_('FORM_NAME_REQUIRED');
            ?>
<div class="row">

   <div class="col-md-6 col-sm-6 col-md-6 col-xs-12">
   <div class="form-group">
        <label for="name">Name</label>
		<input id="comments-form-name" type="text" class="form-control input-lg required" name="name" value="" maxlength="<?php 
            echo $this->getVar('comment-name-maxlength');
            ?>
" size="22" tabindex="1" placeholder="Enter name" />
   </div>	
	
<?php 
        }
        if ($this->getVar('comments-form-user-email', 1) == 1) {
            $text = $this->getVar('comments-form-email-required', 1) == 0 ? JText::_('FORM_EMAIL') : JText::_('FORM_EMAIL_REQUIRED');
            ?>
    <div class="form-group">
        <label for="email">Email</label>
		<input id="comments-form-email" type="text" class="form-control input-lg required email" placeholder="Enter email" name="email" value="" size="22" tabindex="2" />
		
	</div>
  </div>
<?php 
        }
        if ($this->getVar('comments-form-user-homepage', 0) == 1) {
            $text = $this->getVar('comments-form-homepage-required', 1) == 0 ? JText::_('FORM_HOMEPAGE') : JText::_('FORM_HOMEPAGE_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-homepage" type="text" name="homepage" value="" size="22" tabindex="3" />
		<label for="comments-form-homepage"><?php 
            echo $text;
            ?>
</label>
	</span>
</p>
<?php 
        }
        if ($this->getVar('comments-form-title', 0) == 1) {
            $text = $this->getVar('comments-form-title-required', 1) == 0 ? JText::_('FORM_TITLE') : JText::_('FORM_TITLE_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-title" type="text" name="title" value="" size="22" tabindex="4" />
		<label for="comments-form-title"><?php 
            echo $text;
            ?>
</label>
	</span>
</p>
<?php 
        }
        ?>
        <div class="col-md-6 col-sm-6 col-md-6 col-xs-12">
        <div class="form-group">
        <label for="message">Message</label>
		<textarea id="comments-form-comment" placeholder="Enter Message" class="form-control input-lg required" name="comment" cols="65" rows="9" tabindex="5"></textarea>
	    </div>
        </div>
        </div>

<div class="row">
 <div class="col-md-12">
    <div class="action form-button medium">
      <div class="mybutton medium">
    
	<div id="comments-form-send"><div><a href="#" tabindex="7" onclick="jcomments.saveComment();return false;" title="<?php 
        echo JText::_('FORM_SEND_HINT');
        ?>
"><span data-hover="Post comment">Post comment</span></a></div></div>
	<div id="comments-form-cancel" style="display:none;"><div><a href="#" tabindex="8" onclick="return false;" title="<?php 
        echo JText::_('FORM_CANCEL');
        ?>
"><span data-hover="<?php 
        echo JText::_('FORM_CANCEL');
        ?>
"><?php 
        echo JText::_('FORM_CANCEL');
        ?>
</span></a></div></div>
	
    </div>
     
    </div>
 </div>

<div>
	<input type="hidden" name="object_id" value="<?php 
        echo $object_id;
        ?>
" />
	<input type="hidden" name="object_group" value="<?php 
        echo $object_group;
        ?>
" />
</div>
</form>
</div>
</div>
<script type="text/javascript">
<!--
function JCommentsInitializeForm()
{
	var jcEditor = new JCommentsEditor('comments-form-comment', true);
<?php 
        if ($this->getVar('comments-form-bbcode', 0) == 1) {
            $bbcodes = array('b' => array(0 => JText::_('FORM_BBCODE_B'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'i' => array(0 => JText::_('FORM_BBCODE_I'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'u' => array(0 => JText::_('FORM_BBCODE_U'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 's' => array(0 => JText::_('FORM_BBCODE_S'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'img' => array(0 => JText::_('FORM_BBCODE_IMG'), 1 => JText::_('BBCODE_HINT_ENTER_FULL_URL_TO_THE_IMAGE')), 'url' => array(0 => JText::_('FORM_BBCODE_URL'), 1 => JText::_('BBCODE_HINT_ENTER_FULL_URL')), 'hide' => array(0 => JText::_('FORM_BBCODE_HIDE'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT_TO_HIDE_IT_FROM_UNREGISTERED')), 'quote' => array(0 => JText::_('FORM_BBCODE_QUOTE'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT_TO_QUOTE')), 'list' => array(0 => JText::_('FORM_BBCODE_LIST'), 1 => JText::_('BBCODE_HINT_ENTER_LIST_ITEM_TEXT')));
            foreach ($bbcodes as $k => $v) {
                if ($this->getVar('comments-form-bbcode-' . $k, 0) == 1) {
                    $title = trim(JCommentsText::jsEscape($v[0]));
                    $text = trim(JCommentsText::jsEscape($v[1]));
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
');
<?php 
                }
            }
        }
        $customBBCodes = $this->getVar('comments-form-custombbcodes');
        if (count($customBBCodes)) {
            foreach ($customBBCodes as $code) {
                if ($code->button_enabled) {
                    $k = 'custombbcode' . $code->id;
                    $title = trim(JCommentsText::jsEscape($code->button_title));
                    $text = empty($code->button_prompt) ? JText::_('BBCODE_HINT_ENTER_TEXT') : JText::_($code->button_prompt);
                    $open_tag = $code->button_open_tag;
                    $close_tag = $code->button_close_tag;
                    $icon = $code->button_image;
                    $css = $code->button_css;
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
','<?php 
                    echo $open_tag;
                    ?>
','<?php 
                    echo $close_tag;
                    ?>
','<?php 
                    echo $css;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        $smiles = $this->getVar('comment-form-smiles');
        if (isset($smiles)) {
            if (is_array($smiles) && count($smiles) > 0) {
                ?>
	jcEditor.initSmiles('<?php 
                echo $this->getVar("smilesurl");
                ?>
');
<?php 
                foreach ($smiles as $code => $icon) {
                    $code = trim(JCommentsText::jsEscape($code));
                    $icon = trim(JCommentsText::jsEscape($icon));
                    ?>
	jcEditor.addSmile('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        if ($this->getVar('comments-form-showlength-counter', 0) == 1) {
            ?>
	jcEditor.addCounter(<?php 
            echo $this->getVar('comment-maxlength');
            ?>
, '<?php 
            echo JText::_('FORM_CHARSLEFT_PREFIX');
            ?>
', '<?php 
            echo JText::_('FORM_CHARSLEFT_SUFFIX');
            ?>
', 'counter');
<?php 
        }
        ?>
	jcomments.setForm(new JCommentsForm('comments-form', jcEditor));
}

<?php 
        if ($this->getVar('comments-form-ajax', 0) == 1) {
            ?>
setTimeout(JCommentsInitializeForm, 100);
<?php 
        } else {
            ?>
if (window.addEventListener) {window.addEventListener('load',JCommentsInitializeForm,false);}
else if (document.addEventListener){document.addEventListener('load',JCommentsInitializeForm,false);}
else if (window.attachEvent){window.attachEvent('onload',JCommentsInitializeForm);}
else {if (typeof window.onload=='function'){var oldload=window.onload;window.onload=function(){oldload();JCommentsInitializeForm();}} else window.onload=JCommentsInitializeForm;} 
<?php 
        }
        ?>
//-->
</script>
<?php 
        echo $htmlAfterForm;
    }
예제 #4
0
 public static function reportComment()
 {
     if (JCommentsSecurity::badRequest() == 1) {
         JCommentsSecurity::notAuth();
     }
     $acl = JCommentsFactory::getACL();
     $db = JCommentsFactory::getDBO();
     $config = JCommentsFactory::getConfig();
     $response = JCommentsFactory::getAjaxResponse();
     $values = self::prepareValues($_POST);
     $id = (int) $values['commentid'];
     $reason = trim(strip_tags($values['reason']));
     $name = trim(strip_tags($values['name']));
     $ip = $acl->getUserIP();
     if (empty($reason)) {
         if ($config->getInt('report_reason_required') == 1) {
             self::showErrorMessage(JText::_('ERROR_NO_REASON_FOR_REPORT'), '', 'comments-report-form');
             return $response;
         } else {
             $reason = JText::_('REPORT_REASON_UNKNOWN_REASON');
         }
     }
     $query = 'SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id;
     if ($acl->getUserId()) {
         $query .= ' AND userid = ' . $acl->getUserId();
     } else {
         $query .= ' AND userid = 0 AND ip = "' . $ip . '"';
     }
     $db->setQuery($query);
     $reported = $db->loadResult();
     if (!$reported) {
         $maxReportsPerComment = $config->getInt('reports_per_comment', 1);
         $maxReportsBeforeUnpublish = $config->getInt('reports_before_unpublish', 0);
         $db->setQuery('SELECT COUNT(*) FROM `#__jcomments_reports` WHERE commentid = ' . $id);
         $reported = $db->loadResult();
         if ($reported < $maxReportsPerComment || $maxReportsPerComment == 0) {
             $comment = new JCommentsTableComment($db);
             if ($comment->load($id)) {
                 if ($acl->canReport($comment)) {
                     if ($acl->getUserId()) {
                         $user = JCommentsFactory::getUser();
                         $name = $user->name;
                     } else {
                         if (empty($name)) {
                             $name = 'Guest';
                             // JText::_('Guest');
                         }
                     }
                     require_once JCOMMENTS_TABLES . '/report.php';
                     $report = new JCommentsTableReport($db);
                     $report->commentid = $comment->id;
                     $report->date = JCommentsFactory::getDate();
                     $report->userid = $acl->getUserId();
                     $report->ip = $ip;
                     $report->name = $name;
                     $report->reason = $reason;
                     $html = '';
                     $result = JCommentsEvent::trigger('onJCommentsCommentBeforeReport', array(&$comment, &$report));
                     if (!in_array(false, $result, true)) {
                         if ($report->store()) {
                             JCommentsEvent::trigger('onJCommentsCommentAfterReport', array(&$comment, $report));
                             if ($config->getInt('enable_notification') == 1) {
                                 if ($config->check('notification_type', 2)) {
                                     JComments::sendReport($comment, $name, $reason);
                                 }
                             }
                             // unpublish comment if reports count is enough
                             if ($maxReportsBeforeUnpublish > 0 && $reported >= $maxReportsBeforeUnpublish) {
                                 $comment->published = 0;
                                 $comment->store();
                             }
                             $html = JText::_('REPORT_SUCCESSFULLY_SENT');
                             $html = str_replace("\n", '\\n', $html);
                             $html = str_replace('\\n', '<br />', $html);
                             $html = JCommentsText::jsEscape($html);
                         }
                     }
                     $response->addScript("jcomments.closeReport('{$html}');");
                 } else {
                     self::showErrorMessage(JText::_('ERROR_YOU_HAVE_NO_RIGHTS_TO_REPORT'), '', 'comments-report-form');
                 }
             } else {
                 $response->addAlert(JText::_('ERROR_NOT_FOUND'));
             }
         } else {
             self::showErrorMessage(JText::_('ERROR_COMMENT_ALREADY_REPORTED'), '', 'comments-report-form');
         }
     } else {
         self::showErrorMessage(JText::_('ERROR_YOU_CAN_NOT_REPORT_THE_SAME_COMMENT_MORE_THAN_ONCE'), '', 'comments-report-form');
     }
     return $response;
 }
예제 #5
0
    function getCommentsFormFull()
    {
        $object_id = $this->getVar('comment-object_id');
        $object_group = $this->getVar('comment-object_group');
        $htmlBeforeForm = $this->getVar('comments-form-html-before');
        $htmlAfterForm = $this->getVar('comments-form-html-after');
        ?>
<!-- <h4><?php 
        echo JText::_('FORM_HEADER');
        ?>
</h4>  -->
<div class="contenedor-blog-1-sep2"></div>
<div class="blogcomentarios-header">Deja un comentario</div>
<?php 
        if ($this->getVar('comments-form-policy', 0) == 1) {
            ?>
<div class="comments-policy"><?php 
            echo $this->getVar('comments-policy');
            ?>
</div>
<?php 
        }
        echo $htmlBeforeForm;
        ?>
<a id="addcomments" href="#addcomments"></a>
<form id="comments-form" name="comments-form" action="javascript:void(null);">
<?php 
        if ($this->getVar('comments-form-user-name', 1) == 1) {
            $text = $this->getVar('comments-form-user-name-required', 1) == 0 ? JText::_('FORM_NAME') : JText::_('FORM_NAME_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-name" type="text" name="name" value="" maxlength="<?php 
            echo $this->getVar('comment-name-maxlength');
            ?>
" size="22" tabindex="1" class="blog-comment-text" />
		<label for="comments-form-name" class="blogcomentarios-campo-form"><b>Nombre</b> requerido</label>
	</span>
</p>
<?php 
        }
        if ($this->getVar('comments-form-user-email', 1) == 1) {
            $text = $this->getVar('comments-form-email-required', 1) == 0 ? JText::_('FORM_EMAIL') : JText::_('FORM_EMAIL_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-email" type="text" name="email" value="" size="22" tabindex="2" class="blog-comment-text" />
		<label for="comments-form-email" class="blogcomentarios-campo-form"><b>E-MAIL</b> requerido (no se publicar&aacute)</label>
	</span>
</p>
<?php 
        }
        if ($this->getVar('comments-form-user-homepage', 0) == 1) {
            $text = $this->getVar('comments-form-homepage-required', 1) == 0 ? JText::_('FORM_HOMEPAGE') : JText::_('FORM_HOMEPAGE_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-homepage" type="text" name="homepage" value="" size="22" tabindex="3" />
		<label for="comments-form-homepage"><?php 
            echo $text;
            ?>
</label>
	</span>
</p>
<?php 
        }
        if ($this->getVar('comments-form-title', 0) == 1) {
            $text = $this->getVar('comments-form-title-required', 1) == 0 ? JText::_('FORM_TITLE') : JText::_('FORM_TITLE_REQUIRED');
            ?>
<p>
	<span>
		<input id="comments-form-title" type="text" name="title" value="" size="22" tabindex="4" />
		<label for="comments-form-title"><?php 
            echo $text;
            ?>
</label>
	</span>
</p>
<?php 
        }
        ?>
<p>
	<span>
		<textarea id="comments-form-comment" name="comment" cols="205" rows="5" tabindex="5" class="blog-comment-text"></textarea>
	</span>
</p>
<?php 
        if ($this->getVar('comments-form-subscribe', 0) == 1) {
            ?>
<p>
	<span>
		<input class="checkbox" id="comments-form-subscribe" type="checkbox" name="subscribe" value="1" tabindex="5" />
		<label for="comments-form-subscribe"><?php 
            echo JText::_('FORM_SUBSCRIBE');
            ?>
</label><br />
	</span>
</p>
<?php 
        }
        if ($this->getVar('comments-form-captcha', 0) == 1) {
            $html = $this->getVar('comments-form-captcha-html');
            if ($html != '') {
                echo $html;
            } else {
                $link = JCommentsFactory::getLink('captcha');
                ?>
<p>
	<span>
		<img class="captcha" onclick="jcomments.clear('captcha');" id="comments-form-captcha-image" src="<?php 
                echo $link;
                ?>
" width="121" height="60" alt="<?php 
                echo JText::_('FORM_CAPTCHA');
                ?>
" /><br />
		<span class="captcha" onclick="jcomments.clear('captcha');">Pulsa para mostrar otra imagen</span><br />
		<input class="captcha" id="comments-form-captcha" type="text" name="captcha_refid" value="" size="5" tabindex="6" /><br />
	</span>
</p>
<?php 
            }
        }
        ?>
<div id="comments-form-buttons">
	
	 <div id="comments-form-send" class="contenidonivel2-lateralderecho-boton-interno" style="background-image:url(http://www.cesae.es/images/btnpeq.png);cursor:hand;" onmouseover="JavaScript:this.style.backgroundImage='url(http://www.cesae.es/images/btnpeqon.png)'" onmouseout="JavaScript:this.style.backgroundImage='url(http://www.cesae.es/images/btnpeq.png)'" ontouchstart="JavaScript:this.style.backgroundImage='url(http://www.cesae.es/images/btnpeqon.png)'" ontouchend="JavaScript:this.style.backgroundImage='url(http://www.cesae.es/images/btnpeq.png)'">
			<a href="#" onclick="jcomments.saveComment();return false;"  title="CESAE ENVIAR COMENTARIO" id="contenidonivel2-lateralderecho-boton-interno-btn"  >ENVIAR COMENTARIO</a>
			</div>
	
	<div class="btn" id="comments-form-cancel" style="display:none;"><div><a href="#" tabindex="8" onclick="return false;" title="<?php 
        echo JText::_('FORM_CANCEL');
        ?>
"><?php 
        echo JText::_('FORM_CANCEL');
        ?>
</a></div></div>
	<div style="clear:both;"></div>
</div>
<div>
	<input type="hidden" name="object_id" value="<?php 
        echo $object_id;
        ?>
" />
	<input type="hidden" name="object_group" value="<?php 
        echo $object_group;
        ?>
" />
</div>
</form>
<script type="text/javascript">
<!--
function JCommentsInitializeForm()
{
	var jcEditor = new JCommentsEditor('comments-form-comment', true);
<?php 
        if ($this->getVar('comments-form-bbcode', 0) == 1) {
            $bbcodes = array('b' => array(0 => JText::_('FORM_BBCODE_B'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'i' => array(0 => JText::_('FORM_BBCODE_I'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'u' => array(0 => JText::_('FORM_BBCODE_U'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 's' => array(0 => JText::_('FORM_BBCODE_S'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT')), 'img' => array(0 => JText::_('FORM_BBCODE_IMG'), 1 => JText::_('BBCODE_HINT_ENTER_FULL_URL_TO_THE_IMAGE')), 'url' => array(0 => JText::_('FORM_BBCODE_URL'), 1 => JText::_('BBCODE_HINT_ENTER_FULL_URL')), 'hide' => array(0 => JText::_('FORM_BBCODE_HIDE'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT_TO_HIDE_IT_FROM_UNREGISTERED')), 'quote' => array(0 => JText::_('FORM_BBCODE_QUOTE'), 1 => JText::_('BBCODE_HINT_ENTER_TEXT_TO_QUOTE')), 'list' => array(0 => JText::_('FORM_BBCODE_LIST'), 1 => JText::_('BBCODE_HINT_ENTER_LIST_ITEM_TEXT')));
            foreach ($bbcodes as $k => $v) {
                if ($this->getVar('comments-form-bbcode-' . $k, 0) == 1) {
                    $title = trim(JCommentsText::jsEscape($v[0]));
                    $text = trim(JCommentsText::jsEscape($v[1]));
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
');
<?php 
                }
            }
        }
        $customBBCodes = $this->getVar('comments-form-custombbcodes');
        if (count($customBBCodes)) {
            foreach ($customBBCodes as $code) {
                if ($code->button_enabled) {
                    $k = 'custombbcode' . $code->id;
                    $title = trim(JCommentsText::jsEscape($code->button_title));
                    $text = empty($code->button_prompt) ? JText::_('BBCODE_HINT_ENTER_TEXT') : JText::_($code->button_prompt);
                    $open_tag = $code->button_open_tag;
                    $close_tag = $code->button_close_tag;
                    $icon = $code->button_image;
                    $css = $code->button_css;
                    ?>
	jcEditor.addButton('<?php 
                    echo $k;
                    ?>
','<?php 
                    echo $title;
                    ?>
','<?php 
                    echo $text;
                    ?>
','<?php 
                    echo $open_tag;
                    ?>
','<?php 
                    echo $close_tag;
                    ?>
','<?php 
                    echo $css;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        $smiles = $this->getVar('comment-form-smiles');
        if (isset($smiles)) {
            if (is_array($smiles) && count($smiles) > 0) {
                ?>
	jcEditor.initSmiles('<?php 
                echo $this->getVar("smilesurl");
                ?>
');
<?php 
                foreach ($smiles as $code => $icon) {
                    $code = trim(JCommentsText::jsEscape($code));
                    $icon = trim(JCommentsText::jsEscape($icon));
                    ?>
	jcEditor.addSmile('<?php 
                    echo $code;
                    ?>
','<?php 
                    echo $icon;
                    ?>
');
<?php 
                }
            }
        }
        if ($this->getVar('comments-form-showlength-counter', 0) == 1) {
            ?>
	jcEditor.addCounter(<?php 
            echo $this->getVar('comment-maxlength');
            ?>
, 'Quedan', 'caracteres', 'counter');
<?php 
        }
        ?>
	jcomments.setForm(new JCommentsForm('comments-form', jcEditor));
}

<?php 
        if ($this->getVar('comments-form-ajax', 0) == 1) {
            ?>
setTimeout(JCommentsInitializeForm, 100);
<?php 
        } else {
            ?>
if (window.addEventListener) {window.addEventListener('load',JCommentsInitializeForm,false);}
else if (document.addEventListener){document.addEventListener('load',JCommentsInitializeForm,false);}
else if (window.attachEvent){window.attachEvent('onload',JCommentsInitializeForm);}
else {if (typeof window.onload=='function'){var oldload=window.onload;window.onload=function(){oldload();JCommentsInitializeForm();}} else window.onload=JCommentsInitializeForm;} 
<?php 
        }
        ?>
//-->
</script>
<?php 
        echo $htmlAfterForm;
    }