/** * Store ThankYou into the table * * @since 1.6 */ function setThankyou() { if (JRequest::checkToken('get') == false) { $this->_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error'); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); return; } if (!$this->my->id) { $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_LOGIN')); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); } if (!$this->config->showthankyou) { $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_DISABLED')); $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); while (@ob_end_clean()) { } } require_once KPATH_SITE . '/lib/kunena.posting.class.php'; $post = new CKunenaPosting(); if (!$post->action($this->pid)) { $errors = $post->getErrors(); $this->_app->enqueueMessage(reset($post->getErrors())); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); } $this->targetuserid = $post->get('userid'); //Check if the user already said thank you to this post if ($this->my->id == $this->targetuserid) { $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_NOT_YOURSELF')); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); return; } $saidit = KunenaThankYou::checkIfThankYouAllready($this->pid, $this->my->id); if (!empty($saidit)) { $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_ALLREADY')); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); return; } //Perform the insert if (KunenaThankYou::storeThankYou($this->pid, $this->my->id, $this->targetuserid) !== true) { KunenaError::checkDatabaseError(); } $activityIntegration = KunenaFactory::getActivityIntegration(); $activityIntegration->onAfterThankyou($this->targetuserid, $this->my->id, $post); $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_SUCCESS')); while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false)); }
public function ApproveMessage() { if ($this->_checkToken()) { return false; } $array = JRequest::getVar('cb', array(0), 'post', 'array'); $backUrl = JRequest::getVar('HTTP_REFERER', JURI::base(true), 'server'); $success = 0; require_once KUNENA_PATH_LIB . '/kunena.posting.class.php'; foreach ($array as $id => $value) { if (!$value) { continue; } $message = new CKunenaPosting(); $message->action($id); if (!$message->canApprove()) { $errors = $message->getErrors(); foreach ($errors as $field => $error) { $this->_app->enqueueMessage($field . ': ' . $error, 'error'); } continue; } $this->_db->setQuery("UPDATE `#__kunena_messages` SET hold='0' WHERE id={$this->_db->Quote($id)}"); $this->_db->query(); if (KunenaError::checkDatabaseError()) { return; } CKunenaTools::modifyCategoryStats($message->get('id'), $message->get('parent'), $message->get('time'), $message->get('catid')); $message->emailToSubscribers(null, $this->config->allowsubscriptions, false, false); $success++; } //end foreach if ($success) { $this->app->enqueueMessage(JText::_('COM_KUNENA_MODERATE_APPROVE_SUCCESS'), 'notice'); } while (@ob_end_clean()) { } $this->app->redirect($backUrl); }
protected function replyTopic($row, $catid, $thread, $subject) { if (JRequest::checkToken () == false) { $this->_app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); return false; } $this->isBanned(); $this->verifyCaptcha(); $this->checkFlood(); require_once (KPATH_SITE . '/lib/kunena.posting.class.php'); if (intval ( $thread ) == 0) { $thread = $this->createTopic ( $row, $catid, $subject ); } $message = new CKunenaPosting ( ); $myprofile = KunenaFactory::getUser(); $fields ['name'] = JRequest::getString ( 'name', $myprofile->getName (), 'POST' ); $fields ['email'] = JRequest::getString ( 'email', null, 'POST' ); $fields ['subject'] = $subject; $fields ['message'] = JRequest::getString ( 'message', null, 'POST' ); $success = $message->reply ( $thread, $fields ); if ($success) { $newMessageId = $message->save (); } // Handle errors if (! $success || ! $newMessageId) { $errors = $message->getErrors (); foreach ( $errors as $field => $error ) { $this->_app->enqueueMessage ( $field . ': ' . $error, 'error' ); } return false; } $config = KunenaFactory::getConfig(); $holdPost = $message->get ( 'hold' ); require_once (KPATH_SITE . '/lib/kunena.link.class.php'); $message->emailToSubscribers(false, $config->allowsubscriptions && ! $holdPost, $config->mailmod || $holdPost, $config->mailadmin || $holdPost); if ($holdPost) { $result = JText::_ ( 'PLG_KUNENADISCUSS_PENDING_MODERATOR_APPROVAL' ); } else { $result = JText::_ ( 'PLG_KUNENADISCUSS_MESSAGE_POSTED' ); } // Redirect $uri = JFactory::getURI (); $app = JFactory::getApplication ( 'site' ); $app->redirect ( $uri->toString (), $result ); }
protected function undelete() { if ($this->tokenProtection('get')) { return false; } if ($this->isUserBanned()) { return false; } if ($this->isIPBanned()) { return false; } require_once KUNENA_PATH_LIB . '/kunena.posting.class.php'; $message = new CKunenaPosting(); $success = $message->undelete($this->id); // Handle errors if (!$success) { $errors = $message->getErrors(); foreach ($errors as $field => $error) { $this->_app->enqueueMessage($field . ': ' . $error, 'error'); } } else { $this->_app->enqueueMessage(JText::_('COM_KUNENA_POST_SUCCESS_UNDELETE')); } while (@ob_end_clean()) { } $this->_app->redirect(CKunenaLink::GetMessageURL($this->id, $this->catid, 0, false)); }
/** * process the plugin, called when form is submitted * * @param object $params * @param object form */ function onBeforeStore(&$params, &$formModel) { jimport('joomla.filesystem.file'); $files[] = COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'class.kunena.php'; $define = COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'lib' . DS . 'kunena.defines.php'; $files[] = COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'lib' . DS . 'kunena.defines.php'; $files[] = COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'lib' . DS . 'kunena.link.class.php'; $files[] = COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'lib' . DS . 'kunena.link.class.php'; if (!JFile::exists($define)) { JError::raiseError(500, 'could not find the Kunena component'); return false; } require_once $define; foreach ($files as $file) { if (!JFile::exists($file)) { JError::raiseError(500, 'could not find the Kunena file: ' . $file); return false; } require_once $file; } $postfile = KUNENA_PATH_FUNCS . DS . 'post.php'; $w = new FabrikWorker(); if (!JFile::exists($postfile)) { JError::raiseError(500, "cant find post file"); return false; } //new include_once COM_FABRIK_BASE . DS . 'components' . DS . 'com_kunena' . DS . 'lib' . DS . 'kunena.timeformat.class.php'; if (file_exists(KUNENA_ABSTMPLTPATH . '/initialize.php')) { require_once KUNENA_ABSTMPLTPATH . '/initialize.php'; } else { require_once KPATH_SITE . '/template/default/initialize.php'; } // Kunena Current Template Icons Pack if (file_exists(KUNENA_ABSTMPLTPATH . '/icons.php')) { include KUNENA_ABSTMPLTPATH . '/icons.php'; } else { include KUNENA_PATH_TEMPLATE_DEFAULT . DS . 'icons.php'; } $kunena_session = KunenaFactory::getSession(true); //end new $catid = $params->get('kunena_category', 0); $msg = $w->parseMessageForPlaceHolder($params->get('kunena_content'), $formModel->_fullFormData); $subject = $params->get('kunena_title'); $subject = $w->parseMessageForPlaceHolder($subject, $formModel->_fullFormData); include $postfile; $page = new CKunenaPost(); require_once KUNENA_PATH_LIB . DS . 'kunena.posting.class.php'; $message = new CKunenaPosting(); $user =& JFactory::getUser(); $fields['name'] = $user->guest ? 'Annonymous' : $user->get('name'); $fields['email'] = $user->guest ? '*****@*****.**' : $user->get('email'); $fields['subject'] = $subject; $fields['message'] = $msg; $fields['topic_emoticon'] = JRequest::getInt('topic_emoticon', null); $options['attachments'] = 1; $options['anonymous'] = 0; $lang =& JFactory::getLanguage(); $lang->load('com_kunena'); $success = $message->post($catid, $fields, $options); // Handle errors if (!$success) { $errors = $message->getErrors(); foreach ($errors as $field => $error) { JError::raiseNotice(500, "{$field}: {$error}"); return false; } } else { $success = $message->save(); // Handle errors if (!$success) { $errors = $message->getErrors(); foreach ($errors as $field => $error) { JError::raiseNotice(500, "{$field}: {$error}"); return false; } } } }