Файловый менеджер - Редактировать - /home/lmsyaran/public_html/pusher/com_jea.zip
Назад
PK Y��[ 5��� � controllers/gateway.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/dispatcher.php'; /** * Gateway controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 3.4 */ class JeaControllerGateway extends JControllerForm { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy::__construct() */ public function __construct($config = array()) { parent::__construct($config); $this->view_item .= '&type=' . JFactory::getApplication()->input->getCmd('type'); } /** * Output current gateway logs * * @return void */ public function getLogs() { $gateway = $this->getGateway(); // @var JApplicationWeb $application $application = JFactory::getApplication(); $application->setHeader('Content-Type', 'text/plain', true); $application->sendHeaders(); echo $gateway->getLogs(); $application->close(); } /** * Delete current gateway logs * * @return void */ public function deleteLogs() { $gateway = $this->getGateway(); $gateway->deleteLogs(); $this->getLogs(); } /** * Serve current gateway logs * * @return void */ public function downloadLogs() { JFactory::getApplication()->setHeader('Content-Disposition', 'attachment; filename="logs.txt"'); $this->getLogs(); } /** * Return the current gateway * * @return JeaGateway */ protected function getGateway() { $model = $this->getModel('Gateway', 'JeaModel', array('ignore_request' => false)); $item = $model->getItem(); $dispatcher = GatewaysEventDispatcher::getInstance(); return $dispatcher->loadGateway($item); } } PK Y��[��/�� � controllers/gateways.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Gateways controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 3.4 */ class JeaControllerGateways extends JControllerAdmin { /** * Ask the gateways to execute their export handlers * * @return void */ public function export() { $this->gatewaysExecute('export'); } /** * Ask the gateways to execute their import handlers * * @return void */ public function import() { $this->gatewaysExecute('import'); } /** * Ask the gateways to execute their action handlers * * @param string $task Action to execute * * @return void */ protected function gatewaysExecute($task) { // Check for request forgeries. JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); $application = JFactory::getApplication(); $application->setHeader('Content-Type', 'text/plain', true); $application->sendHeaders(); $interpreter = JFactory::getApplication()->input->getString('php_interpreter', 'php'); $matches = array(); if (preg_match('/^([a-zA-Z0-9-_.\/]+)/', $interpreter, $matches) !== false) { $interpreter = $matches[1]; } if (strpos($interpreter, 'php') === false) { echo "PHP interpreter must contains 'php' in its name"; $application->close(); } $command = ($task == 'export' ? $interpreter . ' ' . JPATH_COMPONENT_ADMINISTRATOR . '/cli/gateways.php --export --basedir="' . JPATH_ROOT . '" --baseurl="' . JUri::root() . '"' : $interpreter . ' ' . JPATH_COMPONENT_ADMINISTRATOR . '/cli/gateways.php --import --basedir="' . JPATH_ROOT . '"'); echo "> $command\n\n"; $output = array(); $return = 0; exec($command, $output, $return); if ($return > 0) { echo "Error\n"; } foreach ($output as $line) { echo "$line\n"; } $application->close(); } /** * Method to get a JeaModelGateway model object, loading it if required. * * @param string $name The model name. * @param string $prefix The class prefix. * @param array $config Configuration array for model. * * @return JeaModelGateway|boolean Model object on success; otherwise false on failure. * * @see JControllerForm::getModel() */ public function getModel($name = 'Gateway', $prefix = 'JeaModel', $config = array()) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK Y��[5ݑ�; ; controllers/featurelist.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Featurelist controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerFeaturelist extends JControllerAdmin { /** * Method to get a JeaModelFeature model object, loading it if required. * * @param string $name The model name. * @param string $prefix The class prefix. * @param array $config Configuration array for model. * * @return JeaModelFeature|boolean Model object on success; otherwise false on failure. * * @see JControllerForm::getModel() */ public function getModel($name = 'Feature', $prefix = 'JeaModel', $config = array()) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK Y��[��^� � controllers/features.json.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Features controller class for AJAX requests. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerFeatures extends JControllerLegacy { /** * Get list of areas in relation with a town * * @return void */ public function get_areas() { $response = false; // Require town id if ($town_id = $this->input->getInt('town_id', 0)) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('f.id , f.value'); $query->from('#__jea_areas AS f'); $query->where('town_id=' . $town_id); $query->order('f.value ASC'); $db->setQuery($query); $response = $db->loadObjectList(); } echo json_encode($response); } /** * Get list of towns in relation with a department * * @return void */ public function get_towns() { $response = false; // Require department id if ($department_id = $this->input->getInt('department_id', 0)) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('f.id , f.value'); $query->from('#__jea_towns AS f'); $query->where('department_id=' . $department_id); $query->order('f.value ASC'); $db->setQuery($query); $response = $db->loadObjectList(); } echo json_encode($response); } /** * Get a feature list filtered by language * * @return void */ public function get_list() { // TODO: Check if this method is used $response = false; $featName = $this->input->getAlnum('feature'); if (!is_null($featName)) { $model = $this->getModel('Features', 'JeaModel'); $features = $model->getItems(); if (isset($features[$featName])) { if (!$language = $this->input->getString('language', '*')) { $language = '*'; } $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('f.id , f.value'); $query->from($db->quoteName($features[$featName]->table) . ' AS f'); if ($language != '*') { $query->where('f.language=' . $db->quote($language) . 'OR f.language=\'*\''); } $query->order('f.value ASC'); $db->setQuery($query); $response = $db->loadObjectList(); } } echo json_encode($response); } } PK Y��[��q�� � controllers/properties.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Properties controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 1.0 */ class JeaControllerProperties extends JControllerAdmin { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy::__construct() */ public function __construct($config = array()) { parent::__construct($config); $this->registerTask('unfeatured', 'featured'); } /** * Method to toggle the featured setting of a list of properties. * * @return void */ public function featured() { // Check for request forgeries JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $user = JFactory::getUser(); $ids = $this->input->get('cid', array(), 'array'); $values = array( 'featured' => 1, 'unfeatured' => 0 ); $task = $this->getTask(); $value = ArrayHelper::getValue($values, $task, 0, 'int'); // Access checks. foreach ($ids as $i => $id) { if (!$user->authorise('core.edit.state', 'com_jea.property.' . (int) $id)) { // Prune items that you can't change. unset($ids[$i]); $this->setMessage(JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'), 'warning'); } } if (empty($ids)) { $this->setMessage(JText::_('JERROR_NO_ITEMS_SELECTED'), 'warning'); } else { $model = $this->getModel(); try { $model->featured($ids, $value); } catch (\Exception $e) { $this->setMessage($e->getMessage(), 'error'); } } $this->setRedirect('index.php?option=com_jea&view=properties'); } /** * Method to copy a list of properties. * * @return void */ public function copy() { // Check for request forgeries JSession::checkToken()or jexit(JText::_('JINVALID_TOKEN')); // Initialise variables. $user = JFactory::getUser(); $ids = $this->input->get('cid', array(), 'array'); // Access checks. if (! $user->authorise('core.create')) { $this->setMessage(JText::_('JLIB_APPLICATION_ERROR_CREATE_RECORD_NOT_PERMITTED'), 'warning'); } elseif (empty($ids)) { $this->setMessage(JText::_('JERROR_NO_ITEMS_SELECTED'), 'warning'); } else { $model = $this->getModel(); try { $model->copy($ids); } catch (\Exception $e) { $this->setMessage($e->getMessage(), 'error'); } } $this->setRedirect('index.php?option=com_jea&view=properties'); } /** * Method to import properties. * * @return void */ public function import() { $app = JFactory::getApplication(); $model = $this->getModel('Import'); $type = $app->input->get('type'); $model->setState('import.type', $type); $model->setState('param.jea_version', $app->input->get('jea_version')); $model->setState('param.joomla_path', $app->input->get('joomla_path', '', 'string')); try { $model->import(); $app->enqueueMessage(JText::sprintf('COM_JEA_PROPERTIES_FOUND_TOTAL', $model->total)); $app->enqueueMessage(JText::sprintf('COM_JEA_PROPERTIES_UPDATED', $model->updated)); $app->enqueueMessage(JText::sprintf('COM_JEA_PROPERTIES_CREATED', $model->created)); } catch (Exception $e) { $this->setMessage($e->getMessage(), 'warning'); } $this->setRedirect('index.php?option=com_jea&view=import&layout=' . $type); } /** * Method to get a JeaModelProperty model object, loading it if required. * * @param string $name The model name. * @param string $prefix The class prefix. * @param array $config Configuration array for model. * * @return JeaModelProperty|boolean Model object on success; otherwise false on failure. * * @see JControllerForm::getModel() */ public function getModel($name = 'Property', $prefix = 'JeaModel', $config = array()) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK Y��[��� controllers/feature.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Feature controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerFeature extends JControllerForm { /** * The default view for the display method. * * @var string */ protected $view_list = 'featurelist'; /** * Gets the URL arguments to append to an item redirect. * * @param integer $recordId The primary key id for the item. * @param string $urlVar The name of the URL variable for the id. * * @return string The arguments to append to the redirect URL. * * @see JControllerForm::getRedirectToItemAppend() */ protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { $feature = $this->input->getCmd('feature'); $append = parent::getRedirectToItemAppend($recordId, $urlVar); if ($feature) { $append .= '&feature=' . $feature; } return $append; } /** * Method to get a JeaModelFeature model object, loading it if required. * * @param string $name The model name. * @param string $prefix The class prefix. * @param array $config Configuration array for model. * * @return JeaModelFeature|boolean Model object on success; otherwise false on failure. * * @see JControllerForm::getModel() */ public function getModel($name = 'Feature', $prefix = 'JeaModel', $config = array()) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK Z��[Յ+� � controllers/features.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Features controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerFeatures extends JControllerLegacy { /** * Method to export features tables as CSV * * @return void */ public function export() { $application = JFactory::getApplication(); $features = $this->input->get('cid', array(), 'array'); if (!empty($features)) { $config = JFactory::getConfig(); $exportPath = $config->get('tmp_path') . '/jea_export'; if (JFolder::create($exportPath) === false) { $msg = JText::_('JLIB_FILESYSTEM_ERROR_FOLDER_CREATE') . ' : ' . $exportPath; $this->setRedirect('index.php?option=com_jea&view=features', $msg, 'warning'); } else { $xmlPath = JPATH_COMPONENT . '/models/forms/features/'; $xmlFiles = JFolder::files($xmlPath); $model = $this->getModel(); $files = array(); foreach ($xmlFiles as $filename) { $matches = array(); if (preg_match('/^[0-9]{2}-([a-z]*).xml/', $filename, $matches)) { $feature = $matches[1]; if (in_array($feature, $features)) { $form = simplexml_load_file($xmlPath . '/' . $filename); $table = (string) $form['table']; $files[] = array( 'data' => $model->getCSVData($table), 'name' => $table . '.csv' ); } } } $zipFile = $exportPath . '/jea_export_' . uniqid() . '.zip'; $zip = JArchive::getAdapter('zip'); $zip->create($zipFile, $files); $application->setHeader('Content-Type', 'application/zip', true); $application->setHeader('Content-Disposition', 'attachment; filename="jea_features.zip"', true); $application->setHeader('Content-Transfer-Encoding', 'binary', true); $application->sendHeaders(); echo readfile($zipFile); // Clean tmp files JFile::delete($zipFile); JFolder::delete($exportPath); $application->close(); } } else { $msg = JText::_('JERROR_NO_ITEMS_SELECTED'); $this->setRedirect('index.php?option=com_jea&view=features', $msg); } } /** * Method to import data in features tables * * @return void */ public function import() { $application = JFactory::getApplication(); $upload = JeaUpload::getUpload('csv'); $validExtensions = array('csv', 'CSV', 'txt', 'TXT'); $xmlPath = JPATH_COMPONENT . '/models/forms/features/'; $xmlFiles = JFolder::files($xmlPath); $model = $this->getModel(); $tables = array(); // Retrieve the table names foreach ($xmlFiles as $filename) { $matches = array(); if (preg_match('/^[0-9]{2}-([a-z]*).xml/', $filename, $matches)) { $feature = $matches[1]; if (!isset($tables[$feature])) { $form = simplexml_load_file($xmlPath . '/' . $filename); $tables[$feature] = (string) $form['table']; } } } foreach ($upload as $file) { if ($file->isPosted() && isset($tables[$file->key])) { $file->setValidExtensions($validExtensions); $file->check(); $fileErrors = $file->getErrors(); if (!$fileErrors) { try { $rows = $model->importFromCSV($file->temp_name, $tables[$file->key]); $msg = JText::sprintf('COM_JEA_NUM_LINES_IMPORTED_ON_TABLE', $rows, $tables[$file->key]); $application->enqueueMessage($msg); } catch (Exception $e) { $application->enqueueMessage($e->getMessage(), 'warning'); } } else { foreach ($fileErrors as $error) { $application->enqueueMessage($error, 'warning'); } } } } $this->setRedirect('index.php?option=com_jea&view=features'); } /** * Method to get a JeaModelFeatures model object, loading it if required. * * @param string $name The model name. * @param string $prefix The class prefix. * @param array $config Configuration array for model. * * @return JeaModelFeatures|boolean Model object on success; otherwise false on failure. * * @see JControllerForm::getModel() */ public function getModel($name = 'Features', $prefix = 'JeaModel', $config = array()) { $model = parent::getModel($name, $prefix, $config); return $model; } } PK Z��[�\Ȕ� � controllers/default.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Default controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerDefault extends JControllerLegacy { /** * The default view for the display method. * * @var string */ protected $default_view = 'properties'; } PK Z��[�MA A controllers/property.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Property controller class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaControllerProperty extends JControllerForm { /** * Method to check if you can edit an existing record. * * @param array $data An array of input data. * @param string $key The name of the key for the primary key; default is id. * * @return boolean * * @see JControllerForm::allowEdit() */ protected function allowEdit($data = array(), $key = 'id') { // Initialise variables. $recordId = (int) isset($data[$key]) ? $data[$key] : 0; $user = JFactory::getUser(); $asset = 'com_jea.property.' . $recordId; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { return true; } // Fallback on edit.own. // First test if the permission is available. if ($user->authorise('core.edit.own', $asset)) { // Now test the owner is the user. $ownerId = (int) isset($data['created_by']) ? $data['created_by'] : 0; if (empty($ownerId) && $recordId) { // Need to do a lookup from the model. $record = $this->getModel()->getItem($recordId); if (empty($record)) { return false; } $ownerId = $record->created_by; } // If the owner matches 'me' then do the test. if ($ownerId == $user->id) { return true; } } // Since there is no asset tracking, revert to the component // permissions. return parent::allowEdit($data, $key); } } PK Z��[�6 6 controllers/gateway.json.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/dispatcher.php'; /** * Gateway controller class for AJAX requests. * * @package Joomla.Administrator * @subpackage com_jea * * @since 3.4 */ class JeaControllerGateway extends JControllerLegacy { /** * Constructor. * * @param array $config An optional associative array of configuration settings. * * @see JControllerLegacy::__construct() */ public function __construct($config = array()) { parent::__construct($config); set_exception_handler(array('JeaControllerGateway', 'error')); } /** * Custom Exception Handler * displaying Exception in Json format * * @param Exception $e An error exception * * @return void */ public static function error($e) { $error = array( 'error' => $e->getmessage(), 'errorCode' => $e->getCode(), 'trace' => $e->getTraceAsString(), ); echo json_encode($error); } /** * Ask the gateway to execute export * * @return void */ public function export() { $this->gatewayExecute('export'); } /** * Ask the gateway to execute import * * @return void */ public function import() { $this->gatewayExecute('import'); } /** * Ask the gateway to execute action * * @param string $task Action to execute * * @return void */ protected function gatewayExecute($task) { $model = $this->getModel('Gateway', 'JeaModel'); $gateway = $model->getItem(); $dispatcher = GatewaysEventDispatcher::getInstance(); $dispatcher->loadGateway($gateway); if ($task == 'import') { $dispatcher->trigger('activatePersistance'); } $responses = $dispatcher->trigger($task); echo isset($responses[0]) ? json_encode($responses[0]) : '{}'; } } PK Z��[$Tr� � gateways/gateway.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; use Joomla\CMS\Log\Log; /** * The base class for all gateways * * @since 3.4 */ abstract class JeaGateway extends JEvent { /** * A Registry object holding the parameters for the gateway * * @var Registry */ public $params = null; /** * The id of the gateway * * @var string */ public $id = null; /** * The provider of the gateway * * @var string */ public $provider = null; /** * The title of the gateway * * @var string */ public $title = null; /** * The gateway type * * @var string */ public $type = null; /** * The gateway log file * * @var string */ protected $logFile = ''; /** * Constructor * * @param object $subject The object to observe * @param array $config An optional associative array of configuration settings. */ public function __construct(&$subject, $config = array()) { if (isset($config['params']) && $config['params'] instanceof Registry) { $this->params = $config['params']; } if (isset($config['id'])) { $this->id = $config['id']; } if (isset($config['type'])) { $this->type = $config['type']; } if (isset($config['provider'])) { $this->provider = $config['provider'] . '_' . $this->id; } if (isset($config['title'])) { $this->title = $config['title']; } $this->logFile = $this->type . '_' . $this->provider . '.php'; parent::__construct($subject); } /** * Write a log message * * Status codes : * * EMERG = 0; // Emergency: system is unusable * ALERT = 1; // Alert: action must be taken immediately * CRIT = 2; // Critical: critical conditions * ERR = 3; // Error: error conditions * WARN = 4; // Warning: warning conditions * NOTICE = 5; // Notice: normal but significant condition * INFO = 6; // Informational: informational messages * DEBUG = 7; // Debug: debug messages * * @param string $message The log message * @param string $status See status codes above * * @return void */ public function log($message, $status = '') { // A category name $cat = $this->provider; Log::addLogger( array('text_file' => $this->logFile), Log::ALL, $cat ); $status = strtoupper($status); $levels = array( 'EMERG' => Log::EMERGENCY, 'ALERT' => Log::ALERT, 'CRIT' => Log::CRITICAL, 'ERR' => Log::ERROR, 'WARN' => Log::WARNING, 'NOTICE' => Log::NOTICE, 'INFO' => Log::INFO, 'DEBUG' => Log::DEBUG ); $status = isset($levels[$status]) ? $levels[$status] : Log::INFO; Log::add($message, $status, $cat); } /** * Output a message in CLI mode * * @param string $message A message * * @return void */ public function out($message = '') { $application = JFactory::getApplication(); if ($application instanceof JApplicationCli) { // @var JApplicationCli $application $application->out($message); } } /** * Get logs * * @return string */ public function getLogs() { $file = JFactory::getConfig()->get('log_path') . '/' . $this->logFile; if (JFile::exists($file)) { return file_get_contents($file); } return ''; } /** * Delete logs * * @return boolean */ public function deleteLogs() { $file = JFactory::getConfig()->get('log_path') . '/' . $this->logFile; if (JFile::exists($file)) { return JFile::delete($file); } return false; } } PK Z��[p&�` ` gateways/dispatcher.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Registry\Registry; /** * Custom Event dispatcher class for JEA gateways * * @since 3.4 */ class GatewaysEventDispatcher extends JEventDispatcher { /** * Stores the singleton instance of the dispatcher. * * @var GatewaysEventDispatcher */ protected static $gInstance = null; /** * Get unique Instance of GatewaysEventDispatcher * * @return GatewaysEventDispatcher */ public static function getInstance() { if (self::$gInstance === null) { self::$gInstance = new static; } return self::$gInstance; } /** * Attach an observer object * * @param object $observer An observer object to attach * * @return void */ public function attach($observer) { if (! ($observer instanceof JeaGateway)) { return; } /* * The main difference with the parent method * is to attach several instances of the same * class. */ $this->_observers[] = $observer; $methods = get_class_methods($observer); end($this->_observers); $key = key($this->_observers); foreach ($methods as $method) { $method = strtolower($method); if (! isset($this->_methods[$method])) { $this->_methods[$method] = array(); } $this->_methods[$method][] = $key; } } /** * Triggers an event by dispatching arguments to all observers that handle * the event and returning their return values. * * @param string $event The event to trigger. * @param array $args An array of arguments. * * @return array An array of results from each function call. */ public function trigger($event, $args = array()) { $result = array(); $args = (array) $args; $event = strtolower($event); // Check if any gateways are attached to the event. if (!isset($this->_methods[$event]) || empty($this->_methods[$event])) { // No gateways associated to the event! return $result; } // Loop through all gateways having a method matching our event foreach ($this->_methods[$event] as $key) { // Check if the gateway is present. if (!isset($this->_observers[$key])) { continue; } if ($this->_observers[$key] instanceof JeaGateway) { try { $args['event'] = $event; $value = $this->_observers[$key]->update($args); } catch (Exception $e) { $application = JFactory::getApplication(); $gateway = $this->_observers[$key]; $gateway->log($e->getMessage(), 'err'); if ($application instanceof JApplicationCli) { /* * In CLI mode, output the error but don't stop the * execution loop of other gateways */ $gateway->out('Error [' . $gateway->title . '] : ' . $e->getMessage()); } else { /* * In AJAX mode, only one gateway is loaded per request, * so we can stop the loop. * Exception will be catched later in a custom Exception handler */ throw $e; } } } if (isset($value)) { $result[] = $value; } } return $result; } /** * Load JEA gateways * * @param string $type If set, must be 'export' or 'import' * * @return void */ public function loadGateways($type = null) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*'); $query->from('#__jea_gateways'); $query->where('published=1'); if (! empty($type)) { $query->where('type=' . $db->Quote($type)); } $query->order('ordering ASC'); $db->setQuery($query); $rows = $db->loadObjectList(); foreach ($rows as $row) { $this->loadGateway($row); } } /** * Load one JEA gateway * * @param $object $gateway he row DB gateway * * @return JeaGateway * * @throws Exception if gateway cannot be loaded */ public function loadGateway($gateway) { $gatewayFile = JPATH_ADMINISTRATOR . '/components/com_jea/gateways/providers/' . $gateway->provider . '/' . $gateway->type . '.php'; if (JFile::exists($gatewayFile)) { require_once $gatewayFile; $className = 'JeaGateway' . ucfirst($gateway->type) . ucfirst($gateway->provider); if (class_exists($className)) { $dispatcher = static::getInstance(); $config = array( 'id' => $gateway->id, 'provider' => $gateway->provider, 'title' => $gateway->title, 'type' => $gateway->type, 'params' => new Registry($gateway->params) ); return new $className($dispatcher, $config); } else { throw new Exception('Gateway class not found : ' . $className); } } else { throw new Exception('Gateway file not found : ' . $gatewayFile); } } } PK Z��[%��4 �4 gateways/import.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/gateway.php'; /** * The base class for import gateways * * @since 3.4 */ abstract class JeaGatewayImport extends JeaGateway { /** * Delete Jea properties which are not included in the import set * * @var boolean */ protected $autoDeletion = true; /** * Remember the last import * * @var boolean */ protected $persistance = false; /** * The number of properties to import. * Used to split the import in several requests (AJAX) * * @var integer */ protected $propertiesPerStep = 0; /** * The number of properties created during import * * @var integer */ protected $created = 0; /** * The number of properties updated during import * * @var integer */ protected $updated = 0; /** * The number of properties created or imported during import * * @var integer */ protected $imported = 0; /** * The number of properties removed during import * * @var integer */ protected $removed = 0; /** * The number of properties that should be imported * * @var integer */ protected $total = 0; /** * Array of properties already imported * * @var array */ protected $importedProperties = array(); /** * Constructor * * @param object $subject The object to observe * @param array $config An optional associative array of configuration settings. */ public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config); $this->autoDeletion = (bool) $this->params->get('auto_deletion', 0); } /** * Remember the last import * * @return void */ public function activatePersistance() { $this->persistance = true; $this->propertiesPerStep = $this->params->get('properties_per_step', 5); } /** * InitWebConsole event handler * * @return void */ public function initWebConsole() { JHtml::script('media/com_jea/js/admin/gateway.js'); $title = addslashes($this->title); // Register script messages JText::script('COM_JEA_IMPORT_START_MESSAGE', true); JText::script('COM_JEA_IMPORT_END_MESSAGE', true); JText::script('COM_JEA_GATEWAY_PROPERTIES_FOUND', true); JText::script('COM_JEA_GATEWAY_PROPERTIES_CREATED', true); JText::script('COM_JEA_GATEWAY_PROPERTIES_UPDATED', true); JText::script('COM_JEA_GATEWAY_PROPERTIES_DELETED', true); $script = "jQuery(document).on('registerGatewayAction', function(event, webConsole, dispatcher) {\n" . " dispatcher.register(function() {\n" . " JeaGateway.startImport($this->id, '$title', webConsole);\n" . " });\n" . "});"; JFactory::getDocument()->addScriptDeclaration($script); } /** * Method called before the import * This could be overriden in child class * * @return void */ protected function beforeImport() { } /** * Method called after the import * This could be overriden in child class * * @return void */ protected function afterImport() { } /** * The import handler method * * @return array the import summary */ public function import() { if ($this->persistance == true && $this->hasPersistentProperties()) { $properties = $this->getPersistentProperties(); } else { $this->beforeImport(); $properties = & $this->parse(); } $this->total = count($properties); if (empty($this->total)) { // Do nothing if there is no properties return $this->getSummary(); } $idsToRemove = array(); $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('#__jea_properties'); if (! empty($this->provider)) { $query->where('provider=' . $db->quote($this->provider)); } $db->setQuery($query); $existingProperties = $db->loadObjectList(); foreach ($existingProperties as $row) { if (isset($this->importedProperties[$row->ref])) { // Property already been imported continue; } if (isset($properties[$row->ref]) && $properties[$row->ref] instanceof JEAPropertyInterface) { if ($this->persistance == true && $this->propertiesPerStep > 0 && $this->updated == $this->propertiesPerStep) { break; } // Verify update time $date = new JDate($row->modified); if ($date->toUnix() < $properties[$row->ref]->modified) { // Update needed if ($properties[$row->ref]->save($this->provider, $row->id)) { $this->updated ++; } } $this->imported ++; $this->importedProperties[$row->ref] = true; unset($properties[$row->ref]); } elseif ($this->autoDeletion === true) { // Property not in the $imported_properties // So we can delete it if the autodeletion option is set to true $idsToRemove[] = $row->id; } } if ($this->autoDeletion === true) { // Remove outdated properties $this->removeProperties($idsToRemove); } foreach ($properties as $ref => $row) { if ($this->persistance == true && $this->propertiesPerStep > 0 && ($this->updated + $this->created) == $this->propertiesPerStep) { break; } if ($row instanceof JEAPropertyInterface) { if ($row->save($this->provider)) { $this->created ++; $this->importedProperties[$ref] = true; } else { $msg = "Property can't be saved : "; foreach ($row->getErrors() as $error) { $msg .= " $error\n"; } $this->log($msg, 'WARN'); JError::raiseNotice(200, "A property cant'be saved. See logs for more infos"); } } $this->imported ++; unset($properties[$ref]); } if ($this->persistance == true && ! empty($properties)) { $this->setPersistentProperties($properties); } elseif ($this->persistance == true && empty($properties)) { $this->cleanPersistentProperties(); } if (empty($properties)) { $msg = JText::sprintf('COM_JEA_IMPORT_END_MESSAGE', $this->title) . '. [' . JText::sprintf('COM_JEA_GATEWAY_PROPERTIES_FOUND', $this->total) . ' - ' . JText::sprintf('COM_JEA_GATEWAY_PROPERTIES_CREATED', $this->created) . ' - ' . JText::sprintf('COM_JEA_GATEWAY_PROPERTIES_UPDATED', $this->updated) . ' - ' . JText::sprintf('COM_JEA_GATEWAY_PROPERTIES_DELETED', $this->removed) . ']'; $this->out($msg); $this->log($msg, 'info'); $this->afterImport(); } return $this->getSummary(); } /** * Return import summary * * @return number[] */ protected function getSummary() { return array( 'gateway_id' => $this->id, 'gateway_title' => $this->title, 'total' => $this->total, 'created' => $this->created, 'updated' => $this->updated, 'imported' => $this->imported, 'removed' => $this->removed ); } /** * The gateway parser method. * This method must be overriden in child class * * @return JEAPropertyInterface[] */ protected function &parse() { $properties = array(); return $properties; } /** * Check for properties stored in cache * * @return boolean */ protected function hasPersistentProperties() { $cache = JFactory::getCache('jea_import', 'output', 'file'); $cache->setCaching(true); $properties = $cache->get('properties'); if (is_string($properties)) { return true; } return false; } /** * Get properties stored in cache * * @return array */ protected function getPersistentProperties() { $cache = JFactory::getCache('jea_import', 'output', 'file'); $cache->setCaching(true); $infos = $cache->get('infos'); if (is_string($infos)) { $infos = unserialize($infos); $this->importedProperties = $infos->importedProperties; } $properties = $cache->get('properties'); if ($properties === false) { return array(); } return unserialize($properties); } /** * Store properties in cache * * @param JEAPropertyInterface[] $properties An array of JEAPropertyInterface instances * * @return void */ protected function setPersistentProperties($properties = array()) { $cache = JFactory::getCache('jea_import', 'output', 'file'); $cache->setCaching(true); $cache->store(serialize($properties), 'properties'); $infos = $cache->get('infos'); if (! $infos) { $infos = new stdClass; $infos->total = $this->total; $infos->updated = $this->updated; $infos->removed = $this->removed; $infos->created = $this->created; $infos->imported = $this->imported; $infos->importedProperties = $this->importedProperties; $cache->store(serialize($infos), 'infos'); } else { $infos = unserialize($infos); $infos->updated += $this->updated; $infos->removed += $this->removed; $infos->created += $this->created; $infos->imported += $this->imported; foreach ($this->importedProperties as $k => $v) { $infos->importedProperties[$k] = $v; } $cache->store(serialize($infos), 'infos'); } // Update interface informations $this->total = $infos->total; $this->updated = $infos->updated; $this->removed = $infos->removed; $this->created = $infos->created; $this->imported = $infos->imported; } /** * Remove properties stored in cache * * @return void */ protected function cleanPersistentProperties() { $cache = JFactory::getCache('jea_import', 'output', 'file'); $cache->setCaching(true); $infos = $cache->get('infos'); if (is_string($infos)) { $infos = @unserialize($infos); // Update interface informations $this->total = $infos->total; $this->updated += $infos->updated; $this->removed += $infos->removed; $this->created += $infos->created; $this->imported += $infos->imported; } // Delete cache infos $cache->clean(); } /** * Remove JEA properties * * @param array $ids An array of ids to remove * * @return boolean */ protected function removeProperties($ids = array()) { if (empty($ids)) { return false; } $dbo = JFactory::getDbo(); $dbo->setQuery('DELETE FROM #__jea_properties WHERE id IN(' . implode(',', $ids) . ')'); $dbo->execute(); // Remove images folder foreach ($ids as $id) { if (JFolder::exists(JPATH_ROOT . '/images/com_jea/images/' . $id)) { JFolder::delete(JPATH_ROOT . '/images/com_jea/images/' . $id); } } $this->removed = count($ids); return true; } /** * Return the cache path for the gateway instance * * @param boolean $createDir If true, the Directory will be created * * @return string */ protected function getCachePath($createDir = false) { $cachePath = JFactory::getApplication()->get('cache_path', JPATH_CACHE) . '/' . $this->type . '_' . $this->provider; if (!JFolder::exists($cachePath) && $createDir) { JFolder::create($cachePath); } if (!JFolder::exists($cachePath)) { throw RuntimeException("Cache directory : $cachePath cannot be created."); } return $cachePath; } /** * Parse an xml file * * @param string $xmlFile The xml file path * * @return SimpleXMLElement * * @throws Exception if xml cannot be parsed */ protected function parseXmlFile($xmlFile = '') { // Disable libxml errors and allow to fetch error information as needed libxml_use_internal_errors(true); $xml = simplexml_load_file($xmlFile, 'SimpleXMLElement', LIBXML_PARSEHUGE); if (! $xml) { $msg = "Cannot load : $xmlFile. "; $errors = libxml_get_errors(); foreach ($errors as $error) { switch ($error->level) { case LIBXML_ERR_WARNING: $msg .= "Warning $error->code: "; break; case LIBXML_ERR_ERROR: $msg .= "Err Error $error->code: "; break; case LIBXML_ERR_FATAL: $msg .= "Fatal Error $error->code: "; break; } $msg .= trim($error->message) . " - Line: $error->line - Column: $error->column"; if ($error->file) { $msg .= " File: $error->file"; } } libxml_clear_errors(); throw new Exception($msg, $error->code); } return $xml; } /** * Download a file and return the file as local file path * * @param string $url The file url to download * @param string $destFile Optionnal file destination name * * @return string the downloaded file destination name */ protected function downloadFile($url, $destFile = '') { if (empty($destFile)) { $cachePath = $this->getCachePath(true); $fileName = JFilterOutput::stringUrlSafe(basename($url)); if (strlen($fileName) > 20) { $fileName = substr($fileName, 0, 20); } $destFile = $cachePath . '/' . $fileName; } if (JFile::exists($destFile)) { JFile::delete($destFile); } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // Don't check SSL certificate curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, false); $data = curl_exec($ch); if ($data === false) { $errno = curl_errno($ch); $error = curl_error($ch); $msg = "Cannot download $url. Error code : $errno, Message : $error"; $this->log($msg, 'ERR'); throw new RuntimeException($msg); } curl_close($ch); JFile::write($destFile, $data); return $destFile; } } PK Z��[.��@� � gateways/export.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/gateway.php'; /** * The base class for export gateways * * @since 3.4 */ abstract class JeaGatewayExport extends JeaGateway { /** * Site base url * * @var string */ protected $baseUrl = ''; /** * Constructor * * @param object $subject The object to observe * @param array $config An optional associative array of configuration settings. */ public function __construct(&$subject, $config = array()) { $application = JFactory::getApplication(); if (defined('BASE_URL')) { $this->baseUrl = BASE_URL; } if ($application instanceof JApplicationWeb) { $this->baseUrl = JUri::root(); } parent::__construct($subject, $config); } /** * This method must be implemented by child class * * @return array containg export summary data */ abstract public function export(); /** * Get all JEA properties * * @param boolean $published If true, get only published properties * * @return array */ protected function getJeaProperties($published = true) { $db = JFactory::getDbo(); $query = 'SELECT p.*, t.value AS town, ht.value AS heating_type' . ', hwt.value AS hot_water_type, d.value AS department' . ', a.value AS `area`, s.value AS slogan, c.value AS `condition`, type.value AS type' . PHP_EOL . 'FROM #__jea_properties AS p' . PHP_EOL . 'LEFT JOIN #__jea_towns AS t ON t.id = p.town_id' . PHP_EOL . 'LEFT JOIN #__jea_departments AS d ON d.id = p.department_id' . PHP_EOL . 'LEFT JOIN #__jea_areas AS a ON a.id = p.area_id' . PHP_EOL . 'LEFT JOIN #__jea_heatingtypes AS ht ON ht.id = p.heating_type' . PHP_EOL . 'LEFT JOIN #__jea_hotwatertypes AS hwt ON hwt.id = p.heating_type' . PHP_EOL . 'LEFT JOIN #__jea_types AS type ON type.id = p.type_id' . PHP_EOL . 'LEFT JOIN #__jea_conditions AS c ON c.id = p.condition_id' . PHP_EOL . 'LEFT JOIN #__jea_slogans AS s ON s.id = p.slogan_id' . PHP_EOL; if ($published) { $query .= 'WHERE p.published = 1'; } $db->setQuery($query); $properties = $db->loadAssocList(); $db->setQuery('SELECT `id`, `value` FROM #__jea_amenities'); $amenities = $db->loadObjectList('id'); $unsets = array( 'asset_id', 'town_id', 'area_id', 'department_id', 'slogan_id', 'published', 'access', 'publish_up', 'publish_down', 'checked_out', 'checked_out_time', 'created_by', 'hits' ); foreach ($properties as &$property) { foreach ($unsets as $key) { if (isset($property[$key])) { unset($property[$key]); } } $exp = explode('-', $property['amenities']); $tmp = array(); foreach ($exp as $id) { if (isset($amenities[$id])) { $tmp[$id] = $amenities[$id]->value; } } $property['amenities'] = $tmp; $property['images'] = $this->getImages((object) $property); } return $properties; } /** * Get pictures of a property * * @param object $row The property DB row * * @return array */ private function getImages($row) { $result = array(); $images = json_decode($row->images); if (empty($images) && ! is_array($images)) { return $result; } $imgDir = 'images/com_jea/images/' . $row->id; if (! JFolder::exists(JPATH_ROOT . '/' . $imgDir)) { return $result; } foreach ($images as $image) { $path = JPATH_ROOT . '/' . $imgDir . '/' . $image->name; if (JFile::exists($path)) { $result[] = array( 'path' => $path, 'url' => $this->baseUrl . $imgDir . '/' . $image->name, 'name' => $image->name, 'title' => $image->title, 'description' => $image->description ); } } return $result; } } PK Z��[���? ? ! gateways/providers/jea/import.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <field name="import_directory" type="text" size="50" default="" label="COM_JEA_FIELD_IMPORT_DIRECTORY_LABEL" description="COM_JEA_FIELD_IMPORT_DIRECTORY_DESC" /> <field name="auto_deletion" type="radio" default="0" class="btn-group" label="COM_JEA_FIELD_AUTO_DELETE_PROPERTIES_LABEL" description="COM_JEA_FIELD_AUTO_DELETE_PROPERTIES_DESC"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="import_user" type="user" label="COM_JEA_FIELD_IMPORT_USER_LABEL" description="COM_JEA_FIELD_IMPORT_USER_DESC" /> <field name="properties_per_step" type="text" size="4" default="5" label="COM_JEA_FIELD_PROPERTIES_PER_STEP_LABEL" description="COM_JEA_FIELD_PROPERTIES_PER_STEP_DESC" /> </fields> </form> PK Z��[�,��� � ! gateways/providers/jea/export.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fields name="params"> <field name="export_directory" type="text" default="tmp" label="COM_JEA_FIELD_EXPORT_DIRECTORY_LABEL" description="COM_JEA_FIELD_EXPORT_DIRECTORY_DESC" size="60" /> <field name="export_images" type="list" label="COM_JEA_FIELD_EXPORT_IMAGE_AS_LABEL" description="COM_JEA_FIELD_EXPORT_IMAGE_AS_DESC" default="url" class="chzn-color"> <option value="url">COM_JEA_OPTION_URL</option> <option value="file">COM_JEA_OPTION_FILE</option> </field> <field name="zip_name" type="text" default="jea_export_{{date}}.zip" label="COM_JEA_FIELD_ZIP_NAME_LABEL" description="COM_JEA_FIELD_ZIP_NAME_DESC" size="60" /> <field name="send_by_ftp" type="radio" label="COM_JEA_FIELD_SEND_OVER_FTP_LABEL" description="COM_JEA_FIELD_SEND_OVER_FTP_DESC" default="0" class="btn-group"> <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="ftp_host" type="text" default="" label="COM_JEA_FIELD_FTP_HOST_LABEL" description="COM_JEA_FIELD_FTP_HOST_DESC" class="inputbox" size="60" /> <field name="ftp_username" type="text" default="" label="COM_JEA_FIELD_FTP_USERNAME_LABEL" description="COM_JEA_FIELD_FTP_USERNAME_DESC" class="inputbox" size="60" /> <field name="ftp_password" type="text" default="" label="COM_JEA_FIELD_FTP_PASSWORD_LABEL" description="COM_JEA_FIELD_FTP_PASSWORD_DESC" class="inputbox" size="60" /> </fields> </form> PK Z��[�]M� ! gateways/providers/jea/import.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/import.php'; require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/propertyInterface.php'; /** * The import class for JEA gateway provider * * @since 3.4 */ class JeaGatewayImportJea extends JeaGatewayImport { /** * The gateway parser method. * * @return JEAPropertyInterface[] */ protected function &parse() { // @var JEAPropertyInterface[] $properties $properties = array(); $importDir = $this->params->get('import_directory'); if (! JFolder::exists($importDir)) { // Maybe a relative path to Joomla ? if (! JFolder::exists(JPATH_ROOT . '/' . trim($importDir, '/'))) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_IMPORT_DIRECTORY_NOT_FOUND', $importDir)); } $importDir = JPATH_ROOT . '/' . trim($importDir, '/'); } $tmpDirs = $this->extractZips($importDir); if (empty($tmpDirs)) { return $properties; } foreach ($tmpDirs as $dir) { $xmlFiles = JFolder::files($dir, '.(xml|XML)$', false, true); if (empty($xmlFiles)) { continue; } $xmlFile = array_shift($xmlFiles); $this->parseXML($properties, $xmlFile); } return $properties; } /** * Extract Zip files and return extracting directories * * @param string $importDir The directory where to find zip files * * @return array */ protected function extractZips($importDir) { $tmpDirs = array(); $tmpPath = JFactory::getConfig()->get('tmp_path'); // Find zip files $zips = JFolder::files($importDir, '.(zip|ZIP)$', false, true); if (empty($zips)) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_IMPORT_NO_ZIP_FOUND', $importDir)); } // Extract zips foreach ($zips as $zipfile) { $tmpDir = $tmpPath . '/' . basename($zipfile); if (! JFolder::create($tmpDir)) { throw new Exception(JText::sprintf('COM_JEA_ERROR_CANNOT_CREATE_DIR', $tmpDir)); } $tmpDirs[] = $tmpDir; if (! JArchive::extract($zipfile, $tmpDir)) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_CANNOT_EXTRACT_ZIP', $zipfile)); } } return $tmpDirs; } /** * Xml parser * * @param array $properties Will be filled with JEAPropertyInterface instances * @param string $xmlFile The xml file path * * @return void * * @throws Exception if xml cannot be parsed */ protected function parseXML(&$properties, $xmlFile = '') { $xml = $this->parseXmlFile($xmlFile); $currentDirectory = dirname($xmlFile); // Check root tag if ($xml->getName() != 'jea') { throw new Exception("$xmlFile is not an export from JEA"); } $children = $xml->children(); foreach ($children as $child) { if ($child->getName() != 'property') { continue; } $fields = $child->children(); $property = new JEAPropertyInterface; $ref = (string) $child->ref; // Ref must be unique if (isset($properties[$ref])) { $ref .= '-' . (string) $child->id; } foreach ($fields as $field) { $fieldName = $field->getName(); if ($fieldName == 'id') { continue; } if ($fieldName == 'images') { $images = $field->children(); foreach ($images as $image) { if (JFile::exists($currentDirectory . '/' . $image->name)) { $property->images[] = $currentDirectory . '/' . $image->name; } } continue; } if ($fieldName == 'amenities') { $amenities = $field->children(); foreach ($amenities as $amenity) { $property->amenities[] = (string) $amenity; } continue; } $value = (string) $field; if ($fieldName == 'ref') { $value = $ref; } // Filter values if (ctype_digit($value)) { $value = (int) $value; } if (property_exists($property, $fieldName)) { $property->$fieldName = $value; } else { $property->addAdditionalField($fieldName, $value); } } $properties[$ref] = $property; } } } PK Z��[ �X\{ { ! gateways/providers/jea/export.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Archive\Archive; use Joomla\CMS\Client\FtpClient; require_once JPATH_COMPONENT_ADMINISTRATOR . '/gateways/export.php'; /** * The export class for JEA gateway provider * * @since 3.4 */ class JeaGatewayExportJea extends JeaGatewayExport { /** * The directory where to write data * * @var string */ protected $exportDirectory = ''; /** * Get the export directory path * * @throws Exception if directory is not found * * @return string The export dir */ protected function getExportDirectory() { if (empty($this->exportDirectory)) { $dir = $this->params->get('export_directory'); if (! JFolder::exists($dir)) { // Try to create dir into joomla root dir $dir = JPATH_ROOT . '/' . trim($dir, '/'); if (JFolder::exists(basename($dir)) && ! JFolder::create($dir)) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_EXPORT_DIRECTORY_CANNOT_BE_CREATED', $dir)); } } $this->exportDirectory = $dir; } return $this->exportDirectory; } /** * Create the zip file * * @param string $filename The zipfile path to create. * @param array $files A set of files to be included into the zipfile. * * @throws Exception if zip file cannot be created * @return void */ protected function createZip($filename, &$files) { $zipAdapter = (new Archive)->getAdapter('zip'); if (!@$zipAdapter->create($filename, $files)) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_ZIP_CREATION', $filename)); } $this->log("Zip creation : $filename"); } /** * Build XML * * @param string|array $data The data to convert * @param string $elementName The element name * * @return DOMDocument|DOMElement */ protected function buildXMl(&$data, $elementName = '') { static $doc; $rootName = 'jea'; if ($elementName == $rootName) { $doc = new DOMDocument('1.0', 'utf-8'); } $element = $doc->createElement($elementName); if (is_array($data)) { foreach ($data as $key => $value) { if (is_int($key)) { $childsName = array( $rootName => 'property', 'amenities' => 'amenity', 'images' => 'image' ); if (! isset($childsName[$elementName])) { continue; } $key = $childsName[$elementName]; } $child = $this->buildXMl($value, $key); $element->appendChild($child); } } else { $text = ctype_alnum($data) ? $doc->createTextNode((string) $data) : $doc->createCDATASection((string) $data); $element->appendChild($text); } if ($elementName == $rootName) { $doc->appendChild($element); return $doc; } return $element; } /** * Send File over FTP * * @param string $file The file to send * * @throws Exception if FTP transfer fails * @return void */ protected function ftpSend($file) { $ftpClient = new FtpClient(array('timeout' => 5, 'type' => FTP_BINARY)); if (!$ftpClient->connect($this->params->get('ftp_host'))) { throw new Exception(JText::sprintf('COM_JEA_GATEWAY_ERROR_FTP_UNABLE_TO_CONNECT_TO_HOST', $this->params->get('ftp_host'))); } if (!$ftpClient->login($this->params->get('ftp_username'), $this->params->get('ftp_password'))) { throw new Exception(JText::_('COM_JEA_GATEWAY_ERROR_FTP_UNABLE_TO_LOGIN')); } if (!$ftpClient->store($file)) { throw new Exception(JText::_('COM_JEA_GATEWAY_ERROR_FTP_UNABLE_TO_SEND_FILE')); } $ftpClient->quit(); } /** * InitWebConsole event handler * * @return void */ public function initWebConsole() { JHtml::script('media/com_jea/js/gateway-jea.js', true); $title = addslashes($this->title); // Register script messages JText::script('COM_JEA_EXPORT_START_MESSAGE', true); JText::script('COM_JEA_EXPORT_END_MESSAGE', true); JText::script('COM_JEA_GATEWAY_FTP_TRANSFERT_SUCCESS', true); JText::script('COM_JEA_GATEWAY_DOWNLOAD_ZIP', true); $document = JFactory::getDocument(); $script = "jQuery(document).on('registerGatewayAction', function(event, webConsole, dispatcher) {" . " dispatcher.register(function() {" . " JeaGateway.startExport($this->id, '$title', webConsole);" . " });" . "});"; $document->addScriptDeclaration($script); } /** * The export event handler * * @return array An array containing the response model */ public function export() { $dir = $this->getExportDirectory(); $xmlFile = $dir . '/export.xml'; $zipName = $this->params->get('zip_name', 'jea_export_{{date}}.zip'); $zipName = str_replace('{{date}}', date('Y-m-d-H:i:s'), $zipName); $zipFile = $dir . '/' . $zipName; $zipUrl = rtrim($this->baseUrl, '/') . str_replace(JPATH_ROOT, '', $dir) . '/' . $zipName; $files = array(); $properties = $this->getJeaProperties(); $exportImages = $this->params->get('export_images'); foreach ($properties as &$property) { foreach ($property['images'] as &$image) { if ($exportImages == 'file') { $name = $property['id'] . '_' . basename($image['path']); $files[] = array( 'data' => file_get_contents($image['path']), 'name' => $name ); $image['name'] = $name; unset($image['url']); } unset($image['path']); } } // Init $xmlFile before DOMDocument::save() JFile::write($xmlFile, ''); $xml = $this->buildXMl($properties, 'jea'); $xml->formatOutput = true; $xml->save($xmlFile); $files[] = array( 'data' => file_get_contents($xmlFile), 'name' => 'export.xml' ); $this->createZip($zipFile, $files); $response = array( 'exported_properties' => count($properties), 'zip_url' => $zipUrl, 'ftp_sent' => false ); $message = JText::_('COM_JEA_EXPORT_END_MESSAGE'); $message = str_replace( array('{title}', '{count}'), array($this->title, $response['exported_properties']), $message ); if ($this->params->get('send_by_ftp') == '1') { $this->ftpSend($zipFile); $response['ftp_sent'] = true; $message .= ' ' . JText::_('COM_JEA_GATEWAY_FTP_TRANSFERT_SUCCESS'); } $this->out($message); $this->log($message); return $response; } } PK Z��[�Xl� helpers/jea.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Jea Helper class * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaHelper { /** * Configure the Linkbar. * * @param string $viewName The name of the active view. * * @return void */ public static function addSubmenu($viewName) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('m.*') ->from('#__menu AS m') ->innerJoin('#__menu AS m2 ON m.parent_id = m2.id') ->where("m2.link='index.php?option=com_jea'") ->order('id ASC'); $db->setQuery($query); $items = $db->loadObjectList(); foreach ($items as $item) { $active = false; switch ($item->title) { case 'com_jea_properties': $item->title = 'COM_JEA_PROPERTIES_MANAGEMENT'; break; case 'com_jea_features': $item->title = 'COM_JEA_FEATURES_MANAGEMENT'; break; } $matches = array(); if (preg_match('#&view=([a-z]+)#', $item->link, $matches)) { $active = $matches[1] == $viewName; } JHtmlSidebar::addEntry(JText::_($item->title), $item->link, $active); } JHtmlSidebar::addEntry( JText::_('COM_JEA_ABOUT'), 'index.php?option=com_jea&view=about', $viewName == 'about' ); } /** * Gets a list of actions that can be performed. * * @param int $propertyId The property ID. * * @return Jobject */ public static function getActions($propertyId = 0) { $user = JFactory::getUser(); $result = new JObject; if (empty($propertyId)) { $assetName = 'com_jea'; } else { $assetName = 'com_jea.property.' . (int) $propertyId; } $actions = array( 'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.own', 'core.edit.state', 'core.delete' ); foreach ($actions as $action) { $result->set($action, $user->authorise($action, $assetName)); } return $result; } /** * Gets the list of tools icons. * * @return array A button list */ public static function getToolsIcons() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('link', 'title AS text', 'icon AS image', 'access')); $query->from('#__jea_tools'); $query->order('id ASC'); $db->setQuery($query); $buttons = $db->loadAssocList(); foreach ($buttons as &$button) { $button['text'] = JText::_($button['text']); if (!empty($button['access'])) { $button['access'] = json_decode($button['access']); } } return $buttons; } } PK Z��[��Ŗ� � helpers/utility.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Utility class helper. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaHelperUtility { /** * Transform an array to csv strng * * @param array $data An array of data * * @return string CSV formatted */ public static function arrayToCSV($data) { $outstream = fopen("php://temp", 'r+'); fputcsv($outstream, $data, ';', '"'); rewind($outstream); $csv = fgets($outstream); fclose($outstream); return $csv; } /** * Transform csv to array * * @param string $data The CSV string * * @return array */ protected function CSVToArray($data) { $instream = fopen("php://temp", 'r+'); fwrite($instream, $data); rewind($instream); $csv = fgetcsv($instream, 9999999, ';', '"'); fclose($instream); return $csv; } } PK Z��[��^&Q Q helpers/upload.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\CMS\Filesystem\File; use Joomla\CMS\Filesystem\Folder; /** * Upload class helper. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ class JeaUpload { /** * The upload key * (ex: $files[0][{picture}] or $files[0][{1}] or $files[0][{picture1}]) * * @var string */ public $key = ''; /** * @var string */ public $name = ''; /** * @var string */ public $temp_name = ''; /** * @var string */ public $type = ''; /** * @var integer */ public $error; /** * Errors list * * @var array */ protected $errors = array(); /** * It's a common security risk in pages who has the upload dir * under the document root * * @var array * @see JeaUpload::setValidExtensions() */ protected $extensionsCheck = array(); /** * @var string * @see JeaUpload::setValidExtensions() */ protected $extensionsMode = 'deny'; /** * Constructor * * @param array $params File upload infos (given by $_FILES) */ public function __construct($params) { $this->name = isset($params['name']) ? $params['name'] : ''; $this->temp_name = isset($params['tmp_name']) ? $params['tmp_name'] : ''; $this->type = isset($params['type']) ? $params['type'] : ''; $this->error = isset($params['error']) ? (int) $params['error'] : UPLOAD_ERR_NO_FILE; $this->extensionsCheck = array('php', 'phtm', 'phtml', 'php3', 'inc'); } /** * Return one or multiple instances of JeaUpload * * @param string $name The name of the posted file * * @return mixed */ public static function getUpload($name = '') { if (!isset($_FILES[$name])) { throw new \RuntimeException('No file with name ' . $name . ' was posted.'); } $rawUploaded = $_FILES[$name]; if (is_array($rawUploaded['name'])) { $fields = array( 'name', 'type', 'tmp_name', 'error', 'size' ); $arrUploaded = array(); $keys = array_keys($rawUploaded['name']); foreach ($keys as $key) { $params = array(); foreach ($fields as $field) { $params[$field] = $rawUploaded[$field][$key]; } $uploaded = new JeaUpload($params); $uploaded->key = $key; $arrUploaded[] = $uploaded; } return $arrUploaded; } else { // Single post $uploaded = new JeaUpload($rawUploaded); $uploaded->key = $name; return $uploaded; } } /** * Verify if the file was uploaded * * @return boolean */ public function isPosted() { if ($this->error === UPLOAD_ERR_NO_FILE) { return false; } return true; } /** * Check errors * * @return JeaUpload */ public function check() { if ($this->error !== UPLOAD_ERR_OK) { switch ($this->error) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $this->errors[] = 'COM_JEA_UPLOAD_ERR_SIZE'; break; case UPLOAD_ERR_PARTIAL: $this->errors[] = 'COM_JEA_UPLOAD_ERR_PARTIAL'; break; case UPLOAD_ERR_NO_TMP_DIR: $this->errors[] = 'COM_JEA_UPLOAD_ERR_NO_TMP_DIR'; break; case UPLOAD_ERR_CANT_WRITE: $this->errors[] = 'COM_JEA_UPLOAD_ERR_CANT_WRITE'; break; default: $this->errors[] = 'COM_JEA_UPLOAD_UNKNOWN_ERROR'; } } // Valid extensions check if (! $this->_evalValidExtensions()) { $this->errors[] = 'COM_JEA_UPLOAD_FILE_EXTENSION_NOT_PERMITTED'; } return $this; } /** * Get the errors list * * @return array */ public function getErrors() { return $this->errors; } /** * Set the file name * * @param string $name The file name * * @return JeaUpload */ public function setName($name) { // Verify extention before change the filename if ($this->_evalValidExtensions()) { $this->name = $name; } return $this; } /** * Moves the uploaded file to its destination directory. * * @param string $dir Destination directory * @param boolean $overwrite Overwrite if destination file exists? * * @return boolean true on success or false on error */ public function moveTo($dir = '', $overwrite = true) { $this->check(); if (!Folder::exists($dir)) { $this->errors[] = 'COM_JEA_UPLOAD_DESTINATION_DIRECTORY_DOESNT_EXISTS'; } if (! is_writable($dir)) { $this->errors[] = 'COM_JEA_UPLOAD_DESTINATION_DIRECTORY_NOT_WRITABLE'; } $file = $dir . '/' . $this->name; if (File::exists($file)) { if ($overwrite === false) { $this->errors[] = 'COM_JEA_UPLOAD_DESTINATION_FILE_ALREADY_EXISTS'; } elseif (! is_writable($file)) { $this->errors[] = 'COM_JEA_UPLOAD_DESTINATION_FILE_NOT_WRITABLE'; } } if (empty($this->errors)) { return File::upload($this->temp_name, $file); } return false; } /** * Format file name to be safe * * @param integer $maxlen Maximun permited string lenght * * @return JeaUpload */ public function nameToSafe($maxlen = 250) { $this->name = substr($this->name, 0, $maxlen); $this->name = File::makeSafe($this->name); $this->name = preg_replace('/\s+/', '-', $this->name); return $this; } /** * Function to restrict the valid extensions on file uploads * * @param array $exts File extensions to validate * @param string $mode The type of validation : * 1) 'deny' Will deny only the supplied extensions * 2) 'accept' Will accept only the supplied extensions as valid * * @return JeaUpload */ public function setValidExtensions($exts, $mode = 'accept') { $this->extensionsCheck = $exts; $this->extensionsMode = $mode; return $this; } /** * Evaluates the validity of the extensions set by setValidExtensions * * @return boolean false on non valid extensions, true if they are valid */ protected function _evalValidExtensions() { $extension = File::getExt($this->name); if ($this->extensionsMode == 'deny') { if (! in_array($extension, $this->extensionsCheck)) { return true; } } else { if (in_array($extension, $this->extensionsCheck)) { return true; } } return false; } } PK Z��[��� � helpers/html/features.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Fatures html helper class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ abstract class JHtmlFeatures { /** * Method to get property types in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function types($value = 0, $name = 'type_id', $attr = '') { $cond = self::getLanguageCondition(); return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_PROPERTY_TYPE_LABEL', $attr, 'types', $cond, 'f.ordering'); } /** * Method to get departments in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function departments($value = 0, $name = 'department_id', $attr = '') { return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_DEPARTMENT_LABEL', $attr, 'departments'); } /** * Method to get towns in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * @param string $department_id To get the department town list * * @return string HTML for the select list. */ static public function towns($value = 0, $name = 'town_id', $attr = '', $department_id = null) { $condition = ''; if ($department_id !== null) { // Potentially Too much results so this will give en empty result $condition = 'f.department_id = -1'; if ($department_id > 0) { $condition = 'f.department_id =' . intval($department_id); } } return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_TOWN_LABEL', $attr, 'towns', $condition); } /** * Method to get areas in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * @param string $town_id To get the town area list * * @return string HTML for the select list. */ static public function areas($value = 0, $name = 'area_id', $attr = '', $town_id = null) { $condition = ''; if ($town_id !== null) { $condition = 'f.town_id = -1'; if ($town_id > 0) { $condition = 'f.town_id =' . intval($town_id); } } return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_AREA_LABEL', $attr, 'areas', $condition); } /** * Method to get conditions in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function conditions($value = 0, $name = 'condition_id', $attr = '') { $cond = self::getLanguageCondition(); return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_CONDITION_LABEL', $attr, 'conditions', $cond); } /** * Method to get hot water types in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function hotwatertypes($value = 0, $name = 'hot_water_type', $attr = '') { $cond = self::getLanguageCondition(); return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_HOTWATERTYPE_LABEL', $attr, 'hotwatertypes', $cond); } /** * Method to get hot heating types in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function heatingtypes($value = 0, $name = 'heating_type', $attr = '') { $cond = self::getLanguageCondition(); return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_HEATINGTYPE_LABEL', $attr, 'heatingtypes', $cond); } /** * Method to get slogans in a HTML <select> element * * @param string $value The selected value * @param string $name The element name * @param mixed $attr An array or a string of element attributes * * @return string HTML for the select list. */ static public function slogans($value = 0, $name = 'slogan_id', $attr = '') { $cond = self::getLanguageCondition(); return self::getHTMLSelectList($value, $name, 'COM_JEA_FIELD_SLOGAN_LABEL', $attr, 'slogans', $cond); } /** * Generic method to get HTML list of feature in a <select> element * * @param string $value The selected value * @param string $name The element name * @param string $defaultOptionLabel The first option label * @param mixed $attr An array or a string of element attributes * @param string $featureTable The feature table name without the prefix "#__jea_" * @param mixed $conditions A string or an array of where conditions to filter the database request * @param string $ordering The list ordering * * @return string HTML for the select list. */ static public function getHTMLSelectList($value = 0, $name = '', $defaultOptionLabel = 'JOPTION_ANY', $attr = '', $featureTable = '', $conditions = null, $ordering = 'f.value asc' ) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('f.id , f.value'); $query->from('#__jea_' . $featureTable . ' AS f'); if (! empty($conditions)) { if (is_string($conditions)) { $query->where($conditions); } elseif (is_array($conditions)) { foreach ($conditions as $condition) { $query->where($condition); } } } $query->order($ordering); $db->setQuery($query); $items = $db->loadObjectList(); // Assemble the list options. $options = array(); $options[] = JHTML::_('select.option', '', '- ' . JText::_($defaultOptionLabel) . ' - '); foreach ($items as &$item) { $options[] = JHtml::_('select.option', $item->id, $item->value); } // Manage attributes $idTag = false; if (is_array($attr)) { if (isset($attr['id'])) { $idTag = $attr['id']; unset($attr['id']); } if (empty($attr['size'])) { $attr['size'] = 1; } if (empty($attr['class'])) { $attr['class'] = 'inputbox'; } $attr['class'] = trim($attr['class']); } else { if ((float) JVERSION > 3 && JFactory::getApplication()->isClient('administrator')) { $attr = 'class="inputbox span12 small" size="1" ' . $attr; } else { $attr = 'class="inputbox" size="1" ' . $attr; } } return JHTML::_('select.genericlist', $options, $name, $attr, 'value', 'text', $value, $idTag); } /** * Get language condition * * @return string */ protected static function getLanguageCondition() { $condition = ''; if (JFactory::getApplication()->isClient('site')) { $db = JFactory::getDbo(); $condition = 'f.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')'; } return $condition; } } PK Z��[�M�8 8 % helpers/html/contentadministrator.phpnu �[��� <?php /** * This file is part of Joomla Estate Agency - Joomla! extension for real estate agency * * @package Joomla.Administrator * @subpackage com_jea * @copyright Copyright (C) 2008 - 2020 PHILIP Sylvain. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; use Joomla\Utilities\ArrayHelper; /** * Content administrator html helper class. * * @package Joomla.Administrator * @subpackage com_jea * * @since 2.0 */ abstract class JHtmlContentAdministrator { /** * Helper to display the featured icon in a list of items * * @param int $value The state value * @param int $i The list counter value * @param boolean $canChange The user right to change the state * * @return string */ static public function featured($value = 0, $i = 0, $canChange = true) { // Array of image, task, title, action $states = array( 0 => array( 'disabled.png', 'properties.featured', 'COM_JEA_UNFEATURED', 'COM_JEA_TOGGLE_TO_FEATURE' ), 1 => array( 'featured.png', 'properties.unfeatured', 'COM_JEA_FEATURED', 'COM_JEA_TOGGLE_TO_UNFEATURE' ) ); $state = ArrayHelper::getValue($states, (int) $value, $states[1]); $html = JHtml::_('image', 'admin/' . $state[0], JText::_($state[2]), null, true); if ($canChange) { $html = '<a href="#" onclick="return listItemTask(\'cb' . $i . '\',\'' . $state[1] . '\')" title="' . JText::_($state[3]) . '">' . $html . '</a>'; } return $html; } } PK Z��[�.xQ? ? $ language/es-ES/es-ES.com_jea.sys.ininu �[��� ; @author Roberto Segura ; @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL ; @note Complete ; @note All ini files need to be saved as UTF-8 COM_JEA="Joomla Estate Agency" JEA="Joomla Estate Agency" COM_JEA_FEATURES="Administrar auxiliares" COM_JEA_PROPERTIES_DEFAULT_LAYOUT_TITLE="Inmuebles" COM_JEA_PROPERTIES_DEFAULT_LAYOUT_DESC="Mostrar un listado de inmuebles" COM_JEA_PROPERTIES="Administrar inmuebles" COM_JEA_PROPERTIES_MANAGE_LAYOUT_TITLE="Administración de inmuebles" COM_JEA_PROPERTIES_MANAGE_LAYOUT_DESC="Mostrar un listado de propiedades administrables por un usuario" COM_JEA_FORM_EDIT_LAYOUT_TITLE="Formulario de inmueble" COM_JEA_FORM_EDIT_LAYOUT_DESC="Mostrar un formulario para dar de alta un inmueble" COM_JEA_PROPERTIES_SEARCH_LAYOUT_TITLE="Búsqueda" COM_JEA_PROPERTIES_SEARCH_LAYOUT_DESC="Mostrar un formulario de búsqueda" COM_JEA_PROPERTIES_SEARCHMAP_LAYOUT_TITLE="Búsqueda geolocalizada" COM_JEA_PROPERTIES_SEARCHMAP_LAYOUT_DESC="Mostrar un formulario de búsqueda interactuando con un mapa de Google" COM_JEA_TOOLS="Herramientas"PK Z��[i� F>