uawdijnntqw1x1x1
IP : 216.73.217.142
Hostname : localhost.localdomain
Kernel : Linux localhost.localdomain 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
OS : Linux
PATH:
/
var
/
www
/
consult-e-syn
/
public_html
/
643de
/
..
/
plugins
/
ats
/
autoreply
/
autoreply.php
/
/
<?php /** * @package ats * @copyright Copyright (c)2011-2022 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ defined('_JEXEC') or die(); use Akeeba\TicketSystem\Admin\Model\AutoReplies; use Akeeba\TicketSystem\Admin\Model\Posts; use Akeeba\TicketSystem\Admin\Model\Tickets; use FOF40\Container\Container; use FOF40\Model\DataModel\Collection as DataCollection; use FOF40\Timer\Timer; use Joomla\CMS\Log\Log; use Joomla\CMS\Plugin\CMSPlugin; /** * Automatically replies to tickets based on a set of predefined rules * * @since 3.2.0 */ class plgAtsAutoreply extends CMSPlugin { const atsCommandName = 'autoreply'; /** * @inheritDoc */ public function __construct(&$subject, $config = []) { parent::__construct($subject, $config); if (!defined('FOF40_INCLUDED') && !@include_once(JPATH_LIBRARIES . '/fof40/include.php')) { throw new RuntimeException('This extension requires FOF 4.', 500); } $this->loadLanguage(); } /** * This handles the onATSPost event which is triggered every time a post is created or edited. * * We use this event to detect the first post of a new ticket and send auto-replies if we are configured to do so. * * @param array $info An indexed array with post info. The post key contains an AtsTablePost object. * * @return void */ public function onATSPost($info) { // Is this feature enabled? if ($this->params->get('event', 0) != 1) { return; } // We only need to process NEW posts if (!$info['new']) { return; } // Extract the post and ticket objects /** @var Posts $post */ $post = $info['post']; /** @var Tickets $ticket */ $ticket = $info['ticket']; // Is this a new ticket? /** @var Posts $firstPost */ $firstPost = $this->getFirstPost($ticket); $isNewTicket = $firstPost->getId() == $post->getId(); // Only send auto-replies for NEW tickets if (!$isNewTicket) { return; } // Process auto-replies for the ticket /** @var AutoReplies $model */ $container = Container::getInstance('com_ats'); $model = $container->factory->model('AutoReplies')->tmpInstance(); $result = $model->runAutoreplies([$ticket->getId()]); } /** * Returns information about the CRON task provided by this plugin * * @return array * * @since 3.2.0 */ public function onAtsCronTaskInfo() { $container = Container::getInstance('com_ats'); return [ 'command' => self::atsCommandName, 'label' => 'PLG_ATS_' . $this->_name . '_TASK_LABEL', 'description' => 'PLG_ATS_' . $this->_name . '_TASK_DESC', ]; } /** * Handles the ATS CRON tasks. * * @param string $command The command name ATS CRON was asked to execute. * @param array $options Any options passed to this CRON job * * @return bool|null True on success, null if it's not the expected command name. * @since 3.2.0 */ public function onAtsCronTask($command, array $options = []) { if ($this->params->get('cron', 1) != 1) { return null; } // Make sure we are calling the correct command if ($command != self::atsCommandName) { return null; } $timeLimit = array_key_exists('time_limit', $options) ? $options['time_limit'] : 86400; $timer = new Timer($timeLimit); $container = Container::getInstance('com_ats'); // Loop while we have tickets and we have not hit the time limit /** @var AutoReplies $model */ $model = $container->factory->model('AutoReplies')->tmpInstance(); $result = $model->runAutoreplies(null, $timer); Log::add(sprintf('Bots have replied to %d ticket(s)', $result), Log::DEBUG, 'ats.cron'); return true; } private function getFirstPost(Tickets $ticket) { /** @var DataCollection|null $posts */ $posts = $ticket->posts; $container = Container::getInstance('com_ats'); if (!is_object($posts) || !($posts instanceof DataCollection)) { /** @var Posts $postModel */ $postModel = $container->factory->model('Posts')->tmpInstance(); $postModel->ats_ticket_id($ticket->getId()); $postModel->orderBy('ats_ticket_id', 'ASC'); $postModel->with([]); $posts = $postModel->get(true); } return $posts->first(); } }
/var/www/consult-e-syn/public_html/643de/../plugins/ats/autoreply/autoreply.php