protected function _sendPrepareReport($type)
 {
     if (!$this->reportAllowed()) {
         return false;
     }
     if (!JRequest::checkToken()) {
         while (@ob_end_clean()) {
         }
         $this->app->redirect(CKunenaLink::GetThreadPageURL('view', $this->catid, $this->id, NULL, NULL, $this->id, false), COM_KUNENA_ERROR_TOKEN, 'error');
         return false;
     }
     if (!empty($this->reason) && !empty($this->text)) {
         if ($this->id) {
             $query = "SELECT a.id, a.thread, a.name AS nickname, a.catid, a.userid, a.subject, b.mesid, b.message AS msg_text, c.username, c.name, c.id AS userid\n\t\t\t\t\t\t\tFROM #__kunena_messages AS a\n\t\t\t\t\t\t\tINNER JOIN #__kunena_messages_text AS b ON b.mesid = a.id\n\t\t\t\t\t\t\tLEFT JOIN #__users AS c ON c.id = a.userid\n\t\t\t\t\t\t\tWHERE a.id={$this->_db->Quote($this->id)}";
             $this->_db->setQuery($query);
             $row = $this->_db->loadObject();
             if (KunenaError::checkDatabaseError()) {
                 return;
             }
             if ($row->userid && $row->username) {
                 $baduser = $this->config->username ? $row->username : $row->name;
             } else {
                 $baduser = $row->nickname;
             }
             if ($this->reason) {
                 $subject = "[" . $this->config->board_title . " " . JText::_('COM_KUNENA_GEN_FORUM') . "] " . JText::_('COM_KUNENA_REPORT_MSG') . ": " . $this->reason;
             } else {
                 $subject = "[" . $this->config->board_title . " " . JText::_('COM_KUNENA_GEN_FORUM') . "] " . JText::_('COM_KUNENA_REPORT_MSG') . ": " . $row->subject;
             }
             jimport('joomla.environment.uri');
             $uri =& JURI::getInstance(JURI::base());
             $msglink = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&', '&', CKunenaLink::GetThreadPageURL('view', $row->catid, $row->id, NULL, NULL, $row->id));
             $message = "" . JText::_('COM_KUNENA_REPORT_RSENDER') . " " . $this->_getSenderName();
             $message .= "\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_RREASON') . " " . $this->reason;
             $message .= "\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_RMESSAGE') . " " . $this->text;
             $message .= "\n\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_POST_POSTER') . " " . $baduser;
             $message .= "\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_POST_SUBJECT') . " " . $row->subject;
             $message .= "\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_POST_MESSAGE') . "\n-----\n" . $row->msg_text;
             $message .= "\n-----\n\n";
             $message .= "" . JText::_('COM_KUNENA_REPORT_POST_LINK') . " " . $msglink;
             $message .= "\n\n\n\n** Powered by Kunena! - http://www.kunena.org **";
             $message = strtr($message, array(' ' => ''));
             $emailToList = CKunenaTools::getEMailToList($row->catid, $row->thread, false, true, true, $this->my->id);
             if ($type == '0') {
                 // send by mail
                 $this->_sendReportToMail($message, $subject, $emailToList);
             } else {
                 if ($type == '1') {
                     // send by PM
                     // Function not yet implemented
                 } else {
                     // send by PM and mail
                     // Function not yet implemented
                 }
             }
         }
     } else {
         // Do nothing empty subject or reason is empty
         $this->app->enqueueMessage(JText::_('COM_KUNENA_REPORT_FORG0T_SUB_MES'));
         while (@ob_end_clean()) {
         }
         $this->app->redirect(CKunenaLink::GetReportURL());
     }
 }
Example #2
0
$this->id = JRequest::getInt('id', 0);
$this->catid = JRequest::getInt('catid', 0);
?>

<div class="kblock kreport">
	<div class="kheader">
		<h2><span><?php 
echo JText::_('COM_KUNENA_COM_A_REPORT');
?>
</span></h2>
	</div>
	<div class="kcontainer">
		<div class="kbody">
			<div id="kreport-container">
				<form method = "post" action = "<?php 
echo CKunenaLink::GetReportURL();
?>
" class="kform-report">
					<label for="kreport-reason"><?php 
echo JText::_('COM_KUNENA_REPORT_REASON');
?>
:</label>
					<input type = "text" name = "reason" class = "inputbox" size = "30" id="kreport-reason"/>
					<label for="kreport-msg"><?php 
echo JText::_('COM_KUNENA_REPORT_MESSAGE');
?>
:</label>
					<textarea id = "kreport-msg" name = "text" cols = "40" rows = "10" class = "inputbox"></textarea>
					<input type = "hidden" name = "id" value = "<?php 
echo intval($this->id);
?>