Done ! 403WebShell
403Webshell
Server IP : 46.105.57.169  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux webm002.cluster120.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : verseaumee ( 152031)
PHP Version : 8.5.7
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/verseaumee/ptitsanes/cli/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/verseaumee/ptitsanes//cli/invoice.php
<?php

/* ------------------------------------------------------------------------
  Solidres - Hotel booking extension for Joomla
  ------------------------------------------------------------------------
  @Author    Solidres Team
  @Website   http://www.solidres.com
  @Copyright Copyright (C) 2013 - 2018 Solidres. All Rights Reserved.
  @License   GNU General Public License version 3, or later
  ------------------------------------------------------------------------ */

const _JEXEC = 1;
error_reporting(-1);
ini_set('display_errors', 1);

// Load system defines
if (file_exists(dirname(__DIR__) . '/defines.php'))
{
	require_once dirname(__DIR__) . '/defines.php';
}

if (!defined('_JDEFINES'))
{
	define('JPATH_BASE', dirname(__DIR__));
	require_once JPATH_BASE . '/includes/defines.php';
}

require_once JPATH_LIBRARIES . '/import.legacy.php';
require_once JPATH_LIBRARIES . '/cms.php';

// Load the configuration
require_once JPATH_CONFIGURATION . '/configuration.php';

JLoader::register('SRUtilities', JPATH_LIBRARIES . '/solidres/utilities/utilities.php');
use Joomla\Utilities\ArrayHelper;

class SolidresInvoiceCli extends JApplicationCli
{
	public function doExecute()
	{
		if (!JPluginHelper::isEnabled('solidres', 'invoice'))
		{
			$this->out(PHP_EOL . 'Solidres Invoice plugin is not enabled.');

			return false;
		}

		$params = JComponentHelper::getParams('com_solidres');

		if (!$params->get('invoice_cron_email', 0))
		{
			$this->out(PHP_EOL . 'Invoice automated is disabled.');

			return false;
		}

		try
		{
			$db    = JFactory::getDbo();
			$days  = (int) $params->get('invoice_cron_days', 0);
			$now   = $db->quote(JFactory::getDate()->toSql());
			$query = $db->getQuery(true)
				->select('a.id, a.code, a.state AS reservation_status, a.payment_status, '
					. 'a.total_price,  COALESCE(a.total_paid, 0) as total_paid, a.customer_email, CONCAT_WS(' . $db->quote(' ')
					. ', a.customer_firstname, a.customer_middlename, a.customer_lastname) AS customer_name, '
					. 'a.reservation_asset_id, a.reservation_asset_name, a.currency_id, a.checkin, a.checkout, '
					. '(
						CASE 
							WHEN 
								a.discount_pre_tax = 1
							THEN
								a.total_price_tax_excl - a.total_discount + a.tax_amount + a.total_extra_price_tax_incl
							ELSE
								a.total_price_tax_excl + a.tax_amount - a.total_discount + a.total_extra_price_tax_incl							
						END
						+ a.tourist_tax_amount + a.payment_method_surcharge - a.payment_method_discount
					) AS grand_total')
				->from($db->quoteName('#__sr_reservations', 'a'))
				->where('a.customer_email IS NOT NULL AND a.customer_email <> ' . $db->quote(''))
				->where('DATEDIFF(a.checkin, DATE(' . $now . ')) = ' . $days)
				->having('grand_total > total_paid');

			if ($resStatuses = $params->get('auto_regenerate_invoice_statuses', []))
			{
				$query->where('a.state IN (' . join(',', ArrayHelper::toInteger($resStatuses)) . ')');
			}

			$db->setQuery($query);

			if ($rows = $db->loadObjectList())
			{
				JLoader::import('solidres.currency.currency');
				JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_solidres/models', 'SolidresModel');
				$dateFormat    = $params->get('date_format', 'd-m-Y');
				$statusesModel = JModelLegacy::getInstance('Statuses', 'SolidresModel', array('ignore_request' => true));
				$statusesModel->setState('filter.scope', 0);
				$statusesModel->setState('filter.state', 1);
				$statusesModel->setState('list.select', 'a.id, a.label, a.code');
				$statusesModel->setState('list.start', 0);
				$statusesModel->setState('list.limit', 0);
				$statusesModel->setState('filter.type', 0);
				$reservationStatuses = $statusesModel->getItems();
				$statusesModel->setState('filter.type', 1);
				$paymentStatuses       = $statusesModel->getItems();
				$app                   = JApplicationCms::getInstance('site');
				$mailer                = JFactory::getMailer();
				$fromMail              = $app->get('mailfrom');
				$fromName              = $app->get('fromname');
				JFactory::$application = $app;

				foreach ($rows as $row)
				{
					$subject = trim($params->get('invoice_cron_email_subject', 'Payment reminder'));
					$body    = trim($params->get('invoice_cron_email_body', 'Dear {customer_name}<br/><br/>This is an automated message to remind you the check-in time for your stay at {reservation_asset_name}: {checkin}. You can always drop your luggage at the Hotel, should you arrive earlier.<br/><br/>Please remember to pay the remaining balance of {remaining_balance} before the arrival.<br/><br/>Thank you,'));

					if (!filter_var($row->customer_email, FILTER_VALIDATE_EMAIL) || empty($body))
					{
						continue;
					}

					if (stripos($body, '{reservation_status}') !== false)
					{
						foreach ($reservationStatuses as $state)
						{
							if ($state->code == (int) $row->reservation_status)
							{
								$body = str_ireplace('{reservation_status}', $state->label, $body);
								break;
							}
						}
					}

					if (stripos($body, '{payment_status}') !== false)
					{
						foreach ($paymentStatuses as $state)
						{
							if ($state->code == (int) $row->payment_status)
							{
								$body = str_ireplace('{payment_status}', $state->label, $body);
								break;
							}
						}
					}

					if (stripos($body, '{reservation_code}') !== false)
					{
						$body = str_ireplace('{reservation_code}', $row->code, $body);
					}

					if (stripos($body, '{customer_name}') !== false)
					{
						$body = str_ireplace('{customer_name}', $row->customer_name, $body);
					}

					if (stripos($body, '{reservation_asset_name}') !== false)
					{
						$body = str_ireplace('{reservation_asset_name}', $row->reservation_asset_name, $body);
					}

					if (stripos($body, '{checkin}') !== false)
					{
						$body = str_ireplace('{checkin}', JHtml::_('date', $row->checkin, $dateFormat), $body);
					}

					if (stripos($body, '{checkout}') !== false)
					{
						$body = str_ireplace('{checkout}', JHtml::_('date', $row->checkout, $dateFormat), $body);
					}

					$currency = new SRCurrency(0, $row->currency_id);

					if (stripos($body, '{grand_total}') !== false)
					{
						$currency->setValue($row->grand_total);
						$body = str_ireplace('{grand_total}', $currency->format(), $body);
					}

					if (stripos($body, '{total_price}') !== false)
					{
						$currency->setValue($row->total_price);
						$body = str_ireplace('{total_price}', $currency->format(), $body);
					}

					if (stripos($body, '{total_paid}') !== false)
					{
						$currency->setValue($row->total_paid);
						$body = str_ireplace('{total_paid}', $currency->format(), $body);
					}

					if (stripos($body, '{remaining_balance}') !== false)
					{
						$currency->setValue($row->grand_total - $row->total_paid);
						$body = str_ireplace('{remaining_balance}', $currency->format(), $body);
					}

					if ($mailer->sendMail($fromMail, $fromName, $row->customer_email, $subject, $body, true))
					{
						$this->out(PHP_EOL . 'Sent mail to receiver ' . $row->customer_email . ' successfully.');
					}
					else
					{
						$this->out(PHP_EOL . 'Oop! cannot send mail to receiver ' . $row->customer_email);
					}
				}
			}
		}
		catch (RuntimeException $e)
		{
			$this->out(PHP_EOL . $e->getMessage());

			return false;
		}
	}
}

JApplicationCli::getInstance('SolidresInvoiceCli')->execute();

Youez - 2016 - github.com/yon3zu
LinuXploit