Файловый менеджер - Редактировать - /home/lmsyaran/public_html/khsh/components.zip
Назад
PK 8F�[j�)e e com_ajax/ajax.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_ajax * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /* * References * Support plugins in your component * - https://docs.joomla.org/Special:MyLanguage/Supporting_plugins_in_your_component * * Best way for JSON output * - https://groups.google.com/d/msg/joomla-dev-cms/WsC0nA9Fixo/Ur-gPqpqh-EJ */ /** @var \Joomla\CMS\Application\CMSApplication $app */ $app = JFactory::getApplication(); $app->allowCache(false); // Prevent the api url from being indexed $app->setHeader('X-Robots-Tag', 'noindex, nofollow'); // JInput object $input = $app->input; // Requested format passed via URL $format = strtolower($input->getWord('format')); // Initialize default response and module name $results = null; $parts = null; // Check for valid format if (!$format) { $results = new InvalidArgumentException(JText::_('COM_AJAX_SPECIFY_FORMAT'), 404); } /* * Module support. * * modFooHelper::getAjax() is called where 'foo' is the value * of the 'module' variable passed via the URL * (i.e. index.php?option=com_ajax&module=foo). * */ elseif ($input->get('module')) { $module = $input->get('module'); $table = JTable::getInstance('extension'); $moduleId = $table->find(array('type' => 'module', 'element' => 'mod_' . $module)); if ($moduleId && $table->load($moduleId) && $table->enabled) { $helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php'; if (strpos($module, '_')) { $parts = explode('_', $module); } elseif (strpos($module, '-')) { $parts = explode('-', $module); } if ($parts) { $class = 'Mod'; foreach ($parts as $part) { $class .= ucfirst($part); } $class .= 'Helper'; } else { $class = 'Mod' . ucfirst($module) . 'Helper'; } $method = $input->get('method') ?: 'get'; if (is_file($helperFile)) { JLoader::register($class, $helperFile); if (method_exists($class, $method . 'Ajax')) { // Load language file for module $basePath = JPATH_BASE; $lang = JFactory::getLanguage(); $lang->load('mod_' . $module, $basePath, null, false, true) || $lang->load('mod_' . $module, $basePath . '/modules/mod_' . $module, null, false, true); try { $results = call_user_func($class . '::' . $method . 'Ajax'); } catch (Exception $e) { $results = $e; } } // Method does not exist else { $results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404); } } // The helper file does not exist else { $results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'mod_' . $module . '/helper.php'), 404); } } // Module is not published, you do not have access to it, or it is not assigned to the current menu item else { $results = new LogicException(JText::sprintf('COM_AJAX_MODULE_NOT_ACCESSIBLE', 'mod_' . $module), 404); } } /* * Plugin support by default is based on the "Ajax" plugin group. * An optional 'group' variable can be passed via the URL. * * The plugin event triggered is onAjaxFoo, where 'foo' is * the value of the 'plugin' variable passed via the URL * (i.e. index.php?option=com_ajax&plugin=foo) * */ elseif ($input->get('plugin')) { $group = $input->get('group', 'ajax'); JPluginHelper::importPlugin($group); $plugin = ucfirst($input->get('plugin')); $dispatcher = JEventDispatcher::getInstance(); try { $results = $dispatcher->trigger('onAjax' . $plugin); } catch (Exception $e) { $results = $e; } } /* * Template support. * * tplFooHelper::getAjax() is called where 'foo' is the value * of the 'template' variable passed via the URL * (i.e. index.php?option=com_ajax&template=foo). * */ elseif ($input->get('template')) { $template = $input->get('template'); $table = JTable::getInstance('extension'); $templateId = $table->find(array('type' => 'template', 'element' => $template)); if ($templateId && $table->load($templateId) && $table->enabled) { $basePath = ($table->client_id) ? JPATH_ADMINISTRATOR : JPATH_SITE; $helperFile = $basePath . '/templates/' . $template . '/helper.php'; if (strpos($template, '_')) { $parts = explode('_', $template); } elseif (strpos($template, '-')) { $parts = explode('-', $template); } if ($parts) { $class = 'Tpl'; foreach ($parts as $part) { $class .= ucfirst($part); } $class .= 'Helper'; } else { $class = 'Tpl' . ucfirst($template) . 'Helper'; } $method = $input->get('method') ?: 'get'; if (is_file($helperFile)) { JLoader::register($class, $helperFile); if (method_exists($class, $method . 'Ajax')) { // Load language file for template $lang = JFactory::getLanguage(); $lang->load('tpl_' . $template, $basePath, null, false, true) || $lang->load('tpl_' . $template, $basePath . '/templates/' . $template, null, false, true); try { $results = call_user_func($class . '::' . $method . 'Ajax'); } catch (Exception $e) { $results = $e; } } // Method does not exist else { $results = new LogicException(JText::sprintf('COM_AJAX_METHOD_NOT_EXISTS', $method . 'Ajax'), 404); } } // The helper file does not exist else { $results = new RuntimeException(JText::sprintf('COM_AJAX_FILE_NOT_EXISTS', 'tpl_' . $template . '/helper.php'), 404); } } // Template is not assigned to the current menu item else { $results = new LogicException(JText::sprintf('COM_AJAX_TEMPLATE_NOT_ACCESSIBLE', 'tpl_' . $template), 404); } } // Return the results in the desired format switch ($format) { // JSONinzed case 'json' : echo new JResponseJson($results, null, false, $input->get('ignoreMessages', true, 'bool')); break; // Handle as raw format default : // Output exception if ($results instanceof Exception) { // Log an error JLog::add($results->getMessage(), JLog::ERROR); // Set status header code $app->setHeader('status', $results->getCode(), true); // Echo exception type and message $out = get_class($results) . ': ' . $results->getMessage(); } // Output string/ null elseif (is_scalar($results)) { $out = (string) $results; } // Output array/ object else { $out = implode((array) $results); } echo $out; break; } PK 8F�[�XW� � com_banners/banners.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_banners * * @copyright (C) 2005 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; $controller = JControllerLegacy::getInstance('Banners'); $controller->execute(JFactory::getApplication()->input->get('task')); $controller->redirect(); PK 8F�[,�1�� � com_banners/controller.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banners Controller * * @since 1.5 */ class BannersController extends JControllerLegacy { /** * Method when a banner is clicked on. * * @return void * * @since 1.5 */ public function click() { $id = $this->input->getInt('id', 0); if ($id) { $model = $this->getModel('Banner', 'BannersModel', array('ignore_request' => true)); $model->setState('banner.id', $id); $model->click(); $this->setRedirect($model->getUrl()); } } } PK ;F�[Aؽb� � com_banners/helpers/banner.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banner Helper Class * * @since 1.6 */ abstract class BannerHelper { /** * Checks if a URL is an image * * @param string $url The URL path to the potential image * * @return boolean True if an image of type bmp, gif, jp(e)g or png, false otherwise * * @since 1.6 */ public static function isImage($url) { return preg_match('#\.(?:bmp|gif|jpe?g|png)$#i', $url); } /** * Checks if a URL is a Flash file * * @param string $url The URL path to the potential flash file * * @return boolean True if an image of type bmp, gif, jp(e)g or png, false otherwise * * @since 1.6 */ public static function isFlash($url) { return preg_match('#\.swf$#i', $url); } } PK ;F�[�r�y y com_banners/helpers/category.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_banners * * @copyright (C) 2009 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; /** * Banners Component Category Tree * * @since 1.6 */ class BannersCategories extends JCategories { /** * Constructor * * @param array $options Array of options * * @since 1.6 */ public function __construct($options = array()) { $options['table'] = '#__banners'; $options['extension'] = 'com_banners'; parent::__construct($options); } } PK ;F�[hbh� � com_banners/models/banner.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_banners * * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); /** * Banner model for the Joomla Banners component. * * @since 1.5 */ class BannersModelBanner extends JModelLegacy { /** * Cached item object * * @var object * @since 1.6 */ protected $_item; /** * Clicks the URL, incrementing the counter * * @return void * * @since 1.5 */ public function click() { $item = $this->getItem(); if (empty($item)) { throw new Exception(JText::_('JERROR_PAGE_NOT_FOUND'), 404); } $id = $this->getState('banner.id'); // Update click count $db = $this->getDbo(); $query = $db->getQuery(true) ->update('#__banners') ->set('clicks = (clicks + 1)') ->where('id = ' . (int) $id); $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseError(500, $e->getMessage()); } // Track clicks $trackClicks = $item->track_clicks; if ($trackClicks < 0 && $item->cid) { $trackClicks = $item->client_track_clicks; } if ($trackClicks < 0) { $config = JComponentHelper::getParams('com_banners'); $trackClicks = $config->get('track_clicks'); } if ($trackClicks > 0) { $trackDate = JFactory::getDate()->format('Y-m-d H:00:00'); $trackDate = JFactory::getDate($trackDate)->toSql(); $query->clear() ->select($db->quoteName('count')) ->from('#__banner_tracks') ->where('track_type=2') ->where('banner_id=' . (int) $id) ->where('track_date=' . $db->quote($trackDate)); $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseError(500, $e->getMessage()); } $count = $db->loadResult(); $query->clear(); if ($count) { // Update count $query->update('#__banner_tracks') ->set($db->quoteName('count') . ' = (' . $db->quoteName('count') . ' + 1)') ->where('track_type=2') ->where('banner_id=' . (int) $id) ->where('track_date=' . $db->quote($trackDate)); } else { // Insert new count $query->insert('#__banner_tracks') ->columns( array( $db->quoteName('count'), $db->quoteName('track_type'), $db->quoteName('banner_id'), $db->quoteName('track_date') ) ) ->values('1, 2,' . (int) $id . ',' . $db->quote($trackDate)); } $db->setQuery($query); try { $db->execute(); } catch (RuntimeException $e) { JError::raiseError(500, $e->getMessage()); } } } /** * Get the data for a banner. * * @return object * * @since 1.6 */ public function &getItem() { if (!isset($this->_item)) { /** @var JCacheControllerCallback $cache */ $cache = JFactory::getCache('com_banners', 'callback'); $id = $this->getState('banner.id'); // For PHP 5.3 compat we can't use $this in the lambda function below, so grab the database driver now to use it $db = $this->getDbo(); $loader = function ($id) use ($db) { $query = $db->getQuery(true) ->select( array( $db->quoteName('a.clickurl', 'clickurl'), $db->quoteName('a.cid', 'cid'), $db->quoteName('a.track_clicks', 'track_clicks'), $db->quoteName('cl.track_clicks', 'client_track_clicks'), ) ) ->from($db->quoteName('#__banners', 'a')) ->join('LEFT', '#__banner_clients AS cl ON cl.id = a.cid') ->where('a.id = ' . (int) $id); $db->setQuery($query); return $db->loadObject(); }; try { $this->_item = $cache->get($loader, array($id), md5(__METHOD__ . $id)); } catch (JCacheException $e) { $this->_item = $loader($id); } } return $this->_item; } /** * Get the URL for a banner * * @return string * * @since 1.5 */ public function getUrl() { $item = $this->getItem(); $url = $item->clickurl; // Check for links if (!preg_match('#http[s]?://|index[2]?\.php#', $url)) { $url = "http://$url"; } return $url; } } PK =F�[q1��X"