Spade
Mini Shell
| Directory:~$ /home/lmsyaran/public_html/joomla4/ |
| [Home] [System Details] [Kill Me] |
home/lmsyaran/public_html/j3/modules/mod_search/helper.php000064400000001111151156263020017677
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_search
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_search
*
* @since 1.5
*/
class ModSearchHelper
{
/**
* Display the search button as an image.
*
* @return string The HTML for the image.
*
* @since 1.5
*/
public static function getSearchImage()
{
return JHtml::_('image', 'searchButton.gif',
'', null, true, true);
}
}
home/lmsyaran/public_html/libraries/fof/utils/config/helper.php000064400000005143151156322700020754
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* A utility class to help you fetch component parameters without going
through JComponentHelper
*/
class FOFUtilsConfigHelper
{
/**
* Caches the component parameters without going through JComponentHelper.
This is necessary since JComponentHelper
* cannot be reset or updated once you update parameters in the database.
*
* @var array
*/
private static $componentParams = array();
/**
* Loads the component's configuration parameters so they can be
accessed by getComponentConfigurationValue
*
* @param string $component The component for loading the parameters
* @param bool $force Should I force-reload the configuration
information?
*/
public final static function loadComponentConfig($component, $force =
false)
{
if (isset(self::$componentParams[$component]) &&
!is_null(self::$componentParams[$component]) && !$force)
{
return;
}
$db = FOFPlatform::getInstance()->getDbo();
$sql = $db->getQuery(true)
->select($db->qn('params'))
->from($db->qn('#__extensions'))
->where($db->qn('type') . ' = ' .
$db->q('component'))
->where($db->qn('element') . " = " .
$db->q($component));
$db->setQuery($sql);
$config_ini = $db->loadResult();
// OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right!
$config_ini = trim($config_ini);
if ((substr($config_ini, 0, 1) == '{') &&
substr($config_ini, -1) == '}')
{
$config_ini = json_decode($config_ini, true);
}
else
{
$config_ini = FOFUtilsIniParser::parse_ini_file($config_ini, false,
true);
}
if (is_null($config_ini) || empty($config_ini))
{
$config_ini = array();
}
self::$componentParams[$component] = $config_ini;
}
/**
* Retrieves the value of a component configuration parameter without
going through JComponentHelper
*
* @param string $component The component for loading the parameter
value
* @param string $key The key to retrieve
* @param mixed $default The default value to use in case the key
is missing
*
* @return mixed
*/
public final static function getComponentConfigurationValue($component,
$key, $default = null)
{
self::loadComponentConfig($component, false);
if (array_key_exists($key, self::$componentParams[$component]))
{
return self::$componentParams[$component][$key];
}
else
{
return $default;
}
}
}
home/lmsyaran/public_html/libraries/regularlabs/helpers/helper.php000064400000003406151156666340021555
0ustar00<?php
/**
* @package Regular Labs Library
* @version 21.2.19653
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2021 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Article as RL_Article;
use RegularLabs\Library\Cache as RL_Cache;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Parameters as RL_Parameters;
if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
}
class RLHelper
{
public static function getPluginHelper($plugin, $params = null)
{
if ( ! class_exists('RegularLabs\Library\Cache'))
{
return null;
}
$hash = md5('getPluginHelper_' .
$plugin->get('_type') . '_' .
$plugin->get('_name') . '_' . json_encode($params));
if (RL_Cache::has($hash))
{
return RL_Cache::get($hash);
}
if ( ! $params)
{
$params =
RL_Parameters::getInstance()->getPluginParams($plugin->get('_name'));
}
$file = JPATH_PLUGINS . '/' .
$plugin->get('_type') . '/' .
$plugin->get('_name') . '/helper.php';
if ( ! is_file($file))
{
return null;
}
require_once $file;
$class = get_class($plugin) . 'Helper';
return RL_Cache::set(
$hash,
new $class($params)
);
}
public static function processArticle(&$article, &$context,
&$helper, $method, $params = [])
{
class_exists('RegularLabs\Library\Article') &&
RL_Article::process($article, $context, $helper, $method, $params);
}
public static function isCategoryList($context)
{
return class_exists('RegularLabs\Library\Document') &&
RL_Document::isCategoryList($context);
}
}
home/lmsyaran/public_html/j3/modules/mod_articles_categories/helper.php000064400000002025151156731250022457
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_categories
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_articles_categories
*
* @since 1.5
*/
abstract class ModArticlesCategoriesHelper
{
/**
* Get list of articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$options = array();
$options['countItems'] = $params->get('numitems',
0);
$categories = JCategories::getInstance('Content', $options);
$category = $categories->get($params->get('parent',
'root'));
if ($category !== null)
{
$items = $category->getChildren();
$count = $params->get('count', 0);
if ($count > 0 && count($items) > $count)
{
$items = array_slice($items, 0, $count);
}
return $items;
}
}
}
home/lmsyaran/public_html/j3/modules/mod_banners/helper.php000064400000003254151156753240020104
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_banners
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Environment\Browser;
/**
* Helper for mod_banners
*
* @since 1.5
*/
class ModBannersHelper
{
/**
* Retrieve list of banners
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return mixed
*/
public static function &getList(&$params)
{
JModelLegacy::addIncludePath(JPATH_ROOT .
'/components/com_banners/models', 'BannersModel');
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$keywords = explode(',',
$document->getMetaData('keywords'));
$config = ComponentHelper::getParams('com_banners');
$model = JModelLegacy::getInstance('Banners',
'BannersModel', array('ignore_request' => true));
$model->setState('filter.client_id', (int)
$params->get('cid'));
$model->setState('filter.category_id',
$params->get('catid', array()));
$model->setState('list.limit', (int)
$params->get('count', 1));
$model->setState('list.start', 0);
$model->setState('filter.ordering',
$params->get('ordering'));
$model->setState('filter.tag_search',
$params->get('tag_search'));
$model->setState('filter.keywords', $keywords);
$model->setState('filter.language',
$app->getLanguageFilter());
$banners = $model->getItems();
if ($banners)
{
if ($config->get('track_robots_impressions', 1) == 1 ||
!Browser::getInstance()->isRobot())
{
$model->impress();
}
}
return $banners;
}
}
home/lmsyaran/public_html/j3/modules/mod_articles_archive/helper.php000064400000004642151157022630021756
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_archive
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_articles_archive
*
* @since 1.5
*/
class ModArchiveHelper
{
/**
* Retrieve list of archived articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
// Get database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select($query->month($db->quoteName('created'))
. ' AS created_month')
->select('MIN(' . $db->quoteName('created') .
') AS created')
->select($query->year($db->quoteName('created')) .
' AS created_year')
->from('#__content')
->where('state = 2')
->group($query->year($db->quoteName('created')) .
', ' . $query->month($db->quoteName('created')))
->order($query->year($db->quoteName('created')) .
' DESC, ' .
$query->month($db->quoteName('created')) . '
DESC');
// Filter by language
if (JFactory::getApplication()->getLanguageFilter())
{
$query->where('language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
$db->setQuery($query, 0, (int) $params->get('count'));
try
{
$rows = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
return array();
}
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItems('link',
'index.php?option=com_content&view=archive', true);
$itemid = (isset($item) && !empty($item->id)) ?
'&Itemid=' . $item->id : '';
$i = 0;
$lists = array();
foreach ($rows as $row)
{
$date = JFactory::getDate($row->created);
$createdMonth = $date->format('n');
$createdYear = $date->format('Y');
$createdYearCal = JHtml::_('date', $row->created,
'Y');
$monthNameCal = JHtml::_('date', $row->created,
'F');
$lists[$i] = new stdClass;
$lists[$i]->link =
JRoute::_('index.php?option=com_content&view=archive&year='
. $createdYear . '&month=' . $createdMonth . $itemid);
$lists[$i]->text =
JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $monthNameCal,
$createdYearCal);
$i++;
}
return $lists;
}
}
home/lmsyaran/public_html/j3/modules/mod_phocacart_search/helper.php000064400000003040151157370650021737
0ustar00<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die;
class ModPhocaCartSearchHelper
{
public static function getAjax() {
jimport('joomla.application.module.helper');
if (!JComponentHelper::isEnabled('com_phocacart')) {
echo '<div class="alert alert-error
alert-danger">'.JText::_('Phoca Cart Error') .
' - ' . JText::_('Phoca Cart is not installed on your
system').'</div>';
return;
}
JLoader::registerPrefix('Phocacart', JPATH_ADMINISTRATOR
. '/components/com_phocacart/libraries/phocacart');
$lang = JFactory::getLanguage();
$lang->load('com_phocacart');
$module = JModuleHelper::getModule('phocacart_search');
$params = new JRegistry();
$params->loadString($module->params);
$search = new PhocacartSearch();
$search->ajax = 1;
$search->search_options = $params->get(
'search_options', 0 );
$search->hide_buttons = $params->get( 'hide_buttons',
0 );
$search->display_inner_icon = $params->get(
'display_inner_icon', 0 );
$search->load_component_media = $params->get(
'load_component_media', 1 );
$search->placeholder_text = $params->get(
'placeholder_text', '' );
$search->display_active_parameters = $params->get(
'display_active_parameters', 0 );
echo $search->renderSearch();
}
}
home/lmsyaran/public_html/libraries/fof/form/helper.php000064400000013536151157637620017332
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JLoader::import('joomla.form.helper');
/**
* FOFForm's helper class.
* Provides a storage for filesystem's paths where FOFForm's
entities reside and
* methods for creating those entities. Also stores objects with
entities'
* prototypes for further reusing.
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormHelper extends JFormHelper
{
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadFieldType($type, $new = true)
{
return self::loadType('field', $type, $new);
}
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadHeaderType($type, $new = true)
{
return self::loadType('header', $type, $new);
}
/**
* Method to load a form entity object given a type.
* Each type is loaded only once and then used as a prototype for other
objects of same type.
* Please, use this method only with those entities which support types
(forms don't support them).
*
* @param string $entity The entity.
* @param string $type The entity type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed Entity object on success, false otherwise.
*
* @since 11.1
*/
protected static function loadType($entity, $type, $new = true)
{
// Reference to an array with current entity's type instances
$types = &self::$entities[$entity];
$key = md5($type);
// Return an entity object if it already exists and we don't need a
new one.
if (isset($types[$key]) && $new === false)
{
return $types[$key];
}
$class = self::loadClass($entity, $type);
if ($class !== false)
{
// Instantiate a new type object.
$types[$key] = new $class;
return $types[$key];
}
else
{
return false;
}
}
/**
* Attempt to import the JFormField class file if it isn't already
imported.
* You can use this method outside of JForm for loading a field for
inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadFieldClass($type)
{
return self::loadClass('field', $type);
}
/**
* Attempt to import the FOFFormHeader class file if it isn't already
imported.
* You can use this method outside of JForm for loading a field for
inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadHeaderClass($type)
{
return self::loadClass('header', $type);
}
/**
* Load a class for one of the form's entities of a particular type.
* Currently, it makes sense to use this method for the "field"
and "rule" entities
* (but you can support more entities in your subclass).
*
* @param string $entity One of the form entities (field or rule).
* @param string $type Type of an entity.
*
* @return mixed Class name on success or false otherwise.
*
* @since 2.0
*/
public static function loadClass($entity, $type)
{
if (strpos($type, '.'))
{
list($prefix, $type) = explode('.', $type);
$altPrefix = $prefix;
}
else
{
$prefix = 'FOF';
$altPrefix = 'J';
}
$class = JString::ucfirst($prefix, '_') . 'Form' .
JString::ucfirst($entity, '_') . JString::ucfirst($type,
'_');
$altClass = JString::ucfirst($altPrefix, '_') .
'Form' . JString::ucfirst($entity, '_') .
JString::ucfirst($type, '_');
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
// Get the field search path array.
$paths = self::addPath($entity);
// If the type is complex, add the base type to the paths.
if ($pos = strpos($type, '_'))
{
// Add the complex type prefix to the paths.
for ($i = 0, $n = count($paths); $i < $n; $i++)
{
// Derive the new path.
$path = $paths[$i] . '/' . strtolower(substr($type, 0,
$pos));
// If the path does not exist, add it.
if (!in_array($path, $paths))
{
$paths[] = $path;
}
}
// Break off the end of the complex type.
$type = substr($type, $pos + 1);
}
// Try to find the class file.
$type = strtolower($type) . '.php';
$filesystem =
FOFPlatform::getInstance()->getIntegrationObject('filesystem');
foreach ($paths as $path)
{
if ($file = $filesystem->pathFind($path, $type))
{
require_once $file;
if (class_exists($class))
{
break;
}
elseif (class_exists($altClass))
{
break;
}
}
}
// Check for all if the class exists.
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
else
{
return false;
}
}
/**
* Method to add a path to the list of header include paths.
*
* @param mixed $new A path or array of paths to add.
*
* @return array The list of paths that have been added.
*/
public static function addHeaderPath($new = null)
{
return self::addPath('header', $new);
}
}
home/lmsyaran/public_html/j3/modules/mod_menu/helper.php000064400000014546151157705740017431
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_menu
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_menu
*
* @since 1.5
*/
class ModMenuHelper
{
/**
* Get a list of the menu items.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return array
*
* @since 1.5
*/
public static function getList(&$params)
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
// Get active menu item
$base = self::getBase($params);
$user = JFactory::getUser();
$levels = $user->getAuthorisedViewLevels();
asort($levels);
$key = 'menu_items' . $params . implode(',', $levels)
. '.' . $base->id;
$cache = JFactory::getCache('mod_menu', '');
if ($cache->contains($key))
{
$items = $cache->get($key);
}
else
{
$path = $base->tree;
$start = (int) $params->get('startLevel', 1);
$end = (int) $params->get('endLevel', 0);
$showAll = $params->get('showAllChildren', 1);
$items = $menu->getItems('menutype',
$params->get('menutype'));
$hidden_parents = array();
$lastitem = 0;
if ($items)
{
foreach ($items as $i => $item)
{
$item->parent = false;
if (isset($items[$lastitem]) && $items[$lastitem]->id ==
$item->parent_id &&
$item->params->get('menu_show', 1) == 1)
{
$items[$lastitem]->parent = true;
}
if (($start && $start > $item->level)
|| ($end && $item->level > $end)
|| (!$showAll && $item->level > 1 &&
!in_array($item->parent_id, $path))
|| ($start > 1 && !in_array($item->tree[$start - 2],
$path)))
{
unset($items[$i]);
continue;
}
// Exclude item with menu item option set to exclude from menu modules
if (($item->params->get('menu_show', 1) == 0) ||
in_array($item->parent_id, $hidden_parents))
{
$hidden_parents[] = $item->id;
unset($items[$i]);
continue;
}
$item->deeper = false;
$item->shallower = false;
$item->level_diff = 0;
if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = ($item->level >
$items[$lastitem]->level);
$items[$lastitem]->shallower = ($item->level <
$items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level -
$item->level);
}
$lastitem = $i;
$item->active = false;
$item->flink = $item->link;
// Reverted back for CMS version 2.5.6
switch ($item->type)
{
case 'separator':
break;
case 'heading':
// No further action needed.
break;
case 'url':
if ((strpos($item->link, 'index.php?') === 0)
&& (strpos($item->link, 'Itemid=') === false))
{
// If this is an internal Joomla link, ensure the Itemid is set.
$item->flink = $item->link . '&Itemid=' .
$item->id;
}
break;
case 'alias':
$item->flink = 'index.php?Itemid=' .
$item->params->get('aliasoptions');
// Get the language of the target menu item when site is
multilingual
if (JLanguageMultilang::isEnabled())
{
$newItem =
JFactory::getApplication()->getMenu()->getItem((int)
$item->params->get('aliasoptions'));
// Use language code if not set to ALL
if ($newItem != null && $newItem->language &&
$newItem->language !== '*')
{
$item->flink .= '&lang=' . $newItem->language;
}
}
break;
default:
$item->flink = 'index.php?Itemid=' . $item->id;
break;
}
if ((strpos($item->flink, 'index.php?') !== false)
&& strcasecmp(substr($item->flink, 0, 4), 'http'))
{
$item->flink = JRoute::_($item->flink, true,
$item->params->get('secure'));
}
else
{
$item->flink = JRoute::_($item->flink);
}
// We prevent the double encoding because for some reason the $item is
shared for menu modules and we get double encoding
// when the cause of that is found the argument should be removed
$item->title = htmlspecialchars($item->title,
ENT_COMPAT, 'UTF-8', false);
$item->anchor_css =
htmlspecialchars($item->params->get('menu-anchor_css',
''), ENT_COMPAT, 'UTF-8', false);
$item->anchor_title =
htmlspecialchars($item->params->get('menu-anchor_title',
''), ENT_COMPAT, 'UTF-8', false);
$item->anchor_rel =
htmlspecialchars($item->params->get('menu-anchor_rel',
''), ENT_COMPAT, 'UTF-8', false);
$item->menu_image =
$item->params->get('menu_image', '') ?
htmlspecialchars($item->params->get('menu_image',
''), ENT_COMPAT, 'UTF-8', false) : '';
$item->menu_image_css =
htmlspecialchars($item->params->get('menu_image_css',
''), ENT_COMPAT, 'UTF-8', false);
}
if (isset($items[$lastitem]))
{
$items[$lastitem]->deeper = (($start ?: 1) >
$items[$lastitem]->level);
$items[$lastitem]->shallower = (($start ?: 1) <
$items[$lastitem]->level);
$items[$lastitem]->level_diff = ($items[$lastitem]->level -
($start ?: 1));
}
}
$cache->store($items, $key);
}
return $items;
}
/**
* Get base menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getBase(&$params)
{
// Get base menu item from parameters
if ($params->get('base'))
{
$base =
JFactory::getApplication()->getMenu()->getItem($params->get('base'));
}
else
{
$base = false;
}
// Use active menu item if no base found
if (!$base)
{
$base = self::getActive($params);
}
return $base;
}
/**
* Get active menu item.
*
* @param \Joomla\Registry\Registry &$params The module options.
*
* @return object
*
* @since 3.0.2
*/
public static function getActive(&$params)
{
$menu = JFactory::getApplication()->getMenu();
return $menu->getActive() ?: self::getDefault();
}
/**
* Get default menu item (home page) for current language.
*
* @return object
*/
public static function getDefault()
{
$menu = JFactory::getApplication()->getMenu();
$lang = JFactory::getLanguage();
// Look for the home menu
if (JLanguageMultilang::isEnabled())
{
return $menu->getDefault($lang->getTag());
}
else
{
return $menu->getDefault();
}
}
}
home/lmsyaran/public_html/j3/modules/mod_consultants/helper.php000064400000007170151160043550021021
0ustar00<?php
class ModConsultantsHelper
{
public static function getConsultants($params)
{
// select consultans id that do atleast 1 consultation
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('distinct co.id as consultantid')
->from($db->quoteName('#__reservation_session',
's'))
->join('INNER',
$db->quoteName('#__reservation_plan', 'p') . '
ON ' . $db->quoteName('s.planid') . ' = ' .
$db->quoteName('p.id'))
->join('INNER',
$db->quoteName('#__reservation_consultant', 'co') .
' ON ' . $db->quoteName('p.consultantid') . ' =
' . $db->quoteName('co.id'))
->where($db->quoteName('s.pay').'=
1');
$db->setQuery($query);
$results = $db->loadColumn();
// select consultants info that their ids are in $results
if($results)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select($db->quoteName(array('a.id','a.alt','a.image',
'b.name','c.title'),array('consultantid','alt','image','consultantname','specialty')))
->from($db->quoteName('#__reservation_consultant',
'a'))
->join('INNER',
$db->quoteName('#__users', 'b') . ' ON ' .
$db->quoteName('a.userid') . ' = ' .
$db->quoteName('b.id'))
->join('INNER',
$db->quoteName('#__categories', 'c') . ' ON
' . $db->quoteName('a.catid') . ' = ' .
$db->quoteName('c.id'))
->where($db->quoteName('a.published') .
' = 1 ')
->where($db->quoteName('a.id') . ' IN
('.implode(',',$results).') ')
->order('RAND() LIMIT 8');
$db->setQuery($query);
$consultantInfo = $db->loadObjectList();
$consultantid=[];
foreach ($consultantInfo as $item) {
$consultantid[]= $item->consultantid;
}
// select number of sessions performed by consultants
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('co.id as consultantid ,
COUNT(consultantid) as count')
->from($db->quoteName('#__reservation_session',
's'))
->join('INNER',
$db->quoteName('#__reservation_plan', 'p') . '
ON ' . $db->quoteName('s.planid') . ' = ' .
$db->quoteName('p.id'))
->join('INNER',
$db->quoteName('#__reservation_consultant', 'co') .
' ON ' . $db->quoteName('p.consultantid') . ' =
' . $db->quoteName('co.id'))
->where($db->quoteName('s.pay').'=
1')
->where($db->quoteName('co.id').' IN
('.implode(',',$consultantid).')')
->group('consultantid');
$db->setQuery($query);
$sessionCount =
$db->loadAssocList('consultantid');
$commentInfo= self::commentInfo($consultantid);
return [$consultantInfo,$sessionCount, $commentInfo];
}
return [0,0];
}
public static function commentInfo($consultantid)
{
$db= JFactory::getDbo();
$query= $db->getQuery(true)
->select('consultantid, count(consultantid) as count,
sum(rate) as rate')
->from($db->quoteName('#__reservation_comment','cm'))
->where($db->quoteName('cm.consultantid').
'IN ('.implode(',',$consultantid).')')
->where($db->quoteName('cm.published'). '=
1')
->group('consultantid');
$db->setQuery($query);
$result= $db->loadObjectList('consultantid');
return $result;
}
}home/lmsyaran/public_html/j3/modules/mod_emergencyconsultant/helper.php000064400000046015151160070600022532
0ustar00<?php
/*----------------------------------------------------------------------------------|
www.vdm.io |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 2.0.3
@build 14th September, 2023
@created 18th October, 2016
@package Demo
@subpackage helper.php
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later -
http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____
_____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \(
_ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/
)(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__)
(_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
class ModEmergencyConsultantHelper
{
public static function do_step0($input, $cb_user)
{
$topic = $input->get('topic', null, 'string');
if (!$topic)
{
jfactory::getapplication()->enqueuemessage('یکی از
موضوعات را انتخاب کنید', 'warning');
return;
}
$emergency_request_time = (int)
$cb_user->get('cb_emergency_request_time', 0);
$time = time();
$offset = 900;
if (($emergency_request_time + $offset) >= $time)
{
jfactory::getapplication()->enqueuemessage("جهت ثبت
درخواست مجدد باید 15 دقیقه از درخواست قبلی
شما بگذرد", 'warning');
return;
}
else
{
$cb_user->set('cb_emergency_request_time', $time);
}
$user = jfactory::getuser();
$current_user_id = $user->get('id', 0,
'int');
$current_user_name = $user->get('name');
$current_user_username = $user->get('username');
$userIds[] = intval($current_user_id);
$sendTo = $input->get('sendto', 0,
'INT');
if ($sendTo)
{
$userIds[] = $sendTo;
}
$userDetails = self::getUserDetails($userIds, ['user_id',
'firstname', 'lastname',
'cb_mobilenumber']);
$current_user_phone_number = $current_user_id != 0 ?
$userDetails[$current_user_id]->cb_mobilenumber : '';
$groups = $user->get('groups');
$errorfake = "";
if (in_array("10", $groups))
{
$errorfake = "*این درخواست از سمت یک مشاور
جهت آزمایش سامانه بوده است. لطفا بخش
اورژانس سامانه را آزمایش نکنید.فیلم
آموزشی موجود است به آن مراجعه کنید، نیازی
به زدن دکمه پذیرفتن نیست.*";
}
// dump($groups,"groups");
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('title')
->from('#__usergroups')
->where('id IN (' . implode(', ', $groups) .
')');
$db->setQuery($query);
$usergroups = implode(' ', $db->loadColumn());
// $usergroupnames="نقش واقعی فرد:
".$usergroups;
// $timezone = (array)jFactory::getUser()->getTimezone();
// date_default_timezone_set($timezone['timezone']);
// $time = date('H:i:s');
// $emergency_start_time=
$cb_user->get('cb_emergency_start_time',
'00:00:00')== '00:00:00' ? '00:00:00':
$cb_user->get('cb_emergency_start_time');
// $emergency_end_time=
$cb_user->get('cb_emergency_end_time', '00:00:00')==
'00:00:00' ? '23:59:59':
$cb_user->get('cb_emergency_start_time');
$params =
JComponentHelper::getParams('com_reservation');
$category_rules = $params->get('category_rule');
foreach ($category_rules as $category_rule)
{
if ($category_rule->cat_rule == 'eplanrule')
{
$emergency_catid = $category_rule->catid;
}
}
// $db = JFactory::getDbo();
// $query = $db->getQuery(true);
//
// $query->select('c.id as cbid, cb_queue_consultants,
cb_balechatid, cb_emergency_start_time, cb_emergency_end_time');
// $query->from($db->quoteName('#__comprofiler',
'c'));
// $query->join('INNER',
$db->quoteName('#__reservation_consultant', 'rc') .
' ON ' . $db->quoteName('rc.userid') . ' =
' . $db->quoteName('c.id'));
// $query->join('INNER',
$db->quoteName('#__reservation_plan', 'p') . '
ON ' . $db->quoteName('rc.id') . ' = ' .
$db->quoteName('p.consultantid'));
//
$query->where($db->quoteName('c.cb_is_emergency') . '=
1');
// $query->where($db->quoteName('p.catid') .
'='. $emergency_catid);
//
$query->where('TIME_FORMAT('.$db->quoteName('c.cb_emergency_start_time').',
\'%H:%i:%s\')' . '<=\''.
$time.'\'');
//
$query->where('TIME_FORMAT('.$db->quoteName('c.cb_emergency_end_time').',
\'%H:%i:%s\')' . '>=\''.
$time.'\'');
// $query->where($db->quoteName('c.cb_balechatid')
. 'is not null');
// $query->where($db->quoteName('p.published') .
'= 1');
//
// $db->setQuery($query);
// $results = $db->loadObjectList('cbid');
// sent to specefic user
$sendto = $input->get('sendto', 0);
$sendto = $sendto ? "&sendto=" . $sendto : "";
// $sendto= "&sendto=941";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL =>
'https://erammoshaver.ir/index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=125&Itemid=147'
. $sendto,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET'
));
$results = json_decode(curl_exec($curl));
curl_close($curl);
// $file_name = __DIR__ . '/files_log.txt';
// file_put_contents($file_name, "var = " . print_r($results,
true) . "\n", FILE_APPEND);
// echo '<br><pre style="direction:
ltr;">';
// var_dump($results);
//
var_dump('https://erammoshaver.ir/index.php?option=com_comprofiler&view=pluginclass&plugin=cbautoactions&action=action&actions=125&Itemid=147'.$sendto);
// echo '</pre><br>';
// exit();
$text = '';
//custom text for out of que bale message
if ($sendto)
{
$text .= " {$errorfake}درخواست اختصاصی مشاوره
اورژانسی فقط برای شما به صورت *{$topic}* توسط
*{$current_user_name}* ارسال شده است.
چنانچه امکان پاسخگویی دارید تایید
لازم را بدهید و پس از تایید شما، کاربر
مربوطه باید فرآیند پرداخت را انجام بدهد.
در صورتی که فرآیند پرداخت موفق بود برای
شما پیام ارسال می شود که فرآیند مشاوره را
آغاز کنید. ";
}
else
{
$text .= " {$errorfake} مشاوره اورژانسی با
موضوع {$topic} توسط {$current_user_name} درخواست شده
است.
ترتیب پیشنهاد مشاور به مراجعه کننده
بر اساس ترتیب پذیرفتن این مراجعه کننده
است. 15 دقیقه برای پذیرفتن این مراجعه
کننده وقت است.";
}
if (!empty($results))
{
$data = [];
foreach ($results as $result)
{
$consultant_user_id = $result->id;
$data[] = [
"chat_id" => $result->cb_balechatid,
// "chat_id" => '2048243497',
// "text" =>
$text.'-'.$result->cb_balechatid,
"text" => $text,
"reply_markup" => [
"inline_keyboard" => [
[['text' => "پذیرفتن",
"callback_data" =>
"emergency_accept|{$current_user_id}|{$consultant_user_id}"]]
]
]
];
}
$text = <<<EOD
درخواست اورژانسی جدید
موضوع: {$topic}
نام: {$current_user_name}
شناسه کاربر: {$current_user_id}
نقش واقعی کاربر: {$usergroups}
شماره موبایل: {$current_user_phone_number}
نام کاربری: {$current_user_username}
EOD;
if ($sendTo)
{
$consultant = $userDetails[$sendTo];
$consultantStr = "{$consultant->firstname}
{$consultant->lastname} ({$consultant->cb_mobilenumber})";
$text .= "\nمشاور: $consultantStr";
}
$data[] = [
"chat_id" => '@emergencyreq',
// "text" => "کاربر با شناسه
{$current_user_id} و نام {$current_user_name} درخواست
اورژانسی ارسال کرد *{$usergroupnames}* نام کاربری
مخاطب: *{$current_user_username}*"
"text" => $text
];
$filename = __DIR__ . '/log.txt';
// file_put_contents($filename, "count = " .
print_r(count($data), true) . "\n", FILE_APPEND);
// file_put_contents($filename, "data = " . print_r($data,
true) . "\n", FILE_APPEND);
// echo '<pre>';
// var_dump($data);
// echo '</pre>';
// exit();
$bale_response = self::send_bale_message($data);
$time = time();
$cb_user->set('cb_emergency_step', 1);
$cb_user->set('cb_emergency_topic', $topic);
return $cb_user->store();
}
jfactory::getapplication()->enqueuemessage("در حال حاضر
مشاوری آماده پذیرش درخواست مشاوره در
زمینه <b>{$topic}</b> نیست. لطفا مدتی بعد
تلاش کنید.", 'warning');
}
public static function
notifyOtherConsultantsClientChooseSomeoneElse($cb_user,
$selectedConsultant) {
// $cb_user->set('cb_queue_consultants',
serialize(array('3324', '941', '947'))); //
for test and debug
$otherConsultants =
unserialize($cb_user->get('cb_queue_consultants',
''));
$selectedConsKey = array_search($selectedConsultant,
$otherConsultants);
if ($selectedConsKey !== false)
{
unset($otherConsultants[$selectedConsKey]);
}
if ($otherConsultants)
{
$message = <<<EOD
این مراجعه کننده پلن مشاوره اورژانس
را از یکی از مشاورین دیگر خریداری کرد. شما
می توانید از حالت آمادگی جهت مشاوره خارج
شوید.
EOD;
$otherConsultants = array_map('intval', $otherConsultants);
$otherConsultantsDetail = self::getUserDetails($otherConsultants,
['user_id', 'cb_balechatid']);
$data = array();
foreach ($otherConsultantsDetail as $key => $consultant)
{
// for test and debug
// $message = <<<EOD
// consUserId: {$consultant->user_id}
// {$cb_user->name}، مشاور دیگه ای رو برای
گرفتن مشاوره انتخاب کردن.
// این مراجعه کننده پلن مشاوره
اورژانس را از یکی از مشاورین دیگر خریداری
کرد. شما می توانید از حالت آمادگی جهت
مشاوره خارج شوید.
// EOD;
$data[] = [
"chat_id" => $consultant->cb_balechatid,
"text" => $message
];
}
self::send_bale_message($data);
}
}
public static function do_step2($do, $cb_user, $selectedConsultant)
{
if ($do == 'start')
{
self::notifyOtherConsultantsClientChooseSomeoneElse($cb_user,
$selectedConsultant);
$cb_user->set('cb_emergency_step', 0);
$cb_user->set('cb_queue_consultants', '');
$cb_user->set('cb_emergency_topic', '');
$cb_user->store();
$start_url =
jfactory::getApplication()->input->get('start_url',
'', 'string');
header("Location: {$start_url}");
exit();
}
elseif ($do == 'find_next')
{
$emergency_consultants =
unserialize($cb_user->get('cb_queue_consultants'));
array_push($emergency_consultants,
array_shift($emergency_consultants));
$cb_user->set('cb_queue_consultants',
serialize($emergency_consultants));
return $cb_user->store();
}
else
{
$cb_user->set('cb_emergency_step', 0);
$cb_user->set('cb_queue_consultants', '');
$cb_user->set('cb_emergency_topic', '');
return $cb_user->store();
}
}
public static function emergency_consultant($cb_user,
$get_emergency_consultant_from_cbuser_object = null)
{
$params =
JComponentHelper::getParams('com_reservation');
$category_rules = $params->get('category_rule');
foreach ($category_rules as $category_rule)
{
if ($category_rule->cat_rule == 'eplanrule')
{
$emergency_catid = $category_rule->catid;
}
}
if (!$get_emergency_consultant_from_cbuser_object)
{
$emergency_consultant_id =
unserialize($cb_user->get('cb_queue_consultants'))[0];
}
else
{
$emergency_consultant_id = $cb_user->get('id');
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('p.*');
$query->from($db->quoteName('#__reservation_consultant',
'c'));
$query->join('INNER',
$db->quoteName('#__reservation_plan', 'p') . '
ON ' . $db->quoteName('c.id') . ' = ' .
$db->quoteName('p.consultantid'));
$query->where($db->quoteName('c.userid') . '='
. $db->quote($emergency_consultant_id));
$query->where($db->quoteName('p.catid') . '=' .
$db->quote($emergency_catid));
$query->where($db->quoteName('p.published') . '=
1');
$db->setQuery($query);
$emergency_consultant_plan = $db->loadObject();
return [$emergency_consultant_id, $emergency_consultant_plan];
}
public static function calc_step($cb_user)
{
$emergency_step = $cb_user->get('cb_emergency_step', 0);
return (int) $emergency_step;
}
public static function get_topics($cb_user)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('fieldlabel');
$query->from($db->quoteName('#__comprofiler_fields',
'f'));
$query->join('INNER',
$db->quoteName('#__comprofiler_field_values', 'fv')
. ' ON ' . $db->quoteName('f.fieldid') . ' =
' . $db->quoteName('fv.fieldid'));
$query->where($db->quoteName('f.name') . '=' .
$db->quote('cb_userexpertisearea'));
$db->setQuery($query);
$results = $db->loadObjectList();
return $results;
}
public static function send_bale_message($data = [])
{
$params = json_decode(jpluginhelper::getPlugin('chat',
'send_by_bale')->params);
$bot_token = $params->bot_token;
$getupdates_url = "https://tapi.bale.ai/bot" . $bot_token .
"/getupdates";
$sendmessage_url = "https://tapi.bale.ai/bot" . $bot_token .
"/sendMessage";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $sendmessage_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type:
application/json'));
$responses = [];
foreach ($data as $item)
{
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($item));
$response = curl_exec($curl);
// $err = curl_error($curl);
$responses[] = json_decode($response);
}
curl_close($curl);
return $responses;
}
public static function is_time_over_reset_it($cb_user)
{
// $emergency_request_time =
(int)$cb_user->get('cb_emergency_request_time', 0);
// $time = time();
//
// $offset = 900;
// if (($emergency_request_time + $offset) >= $time)
// {
// $cb_user->set('cb_emergency_step', 0);
// $cb_user->set('cb_queue_consultants',
'');
// $cb_user->set('cb_emergency_topic',
'');
// jfactory::getapplication()->enqueuemessage("جهت
ثبت درخواست مجدد باید 15 دقیقه از درخواست
قبلی شما بگذرد", 'warning');
// return;
// }
// else
// {
// $cb_user->set('cb_emergency_request_time',
$time);
// }
//
// return $cb_user->store();
$time = time();
$emergency_request_time =
$cb_user->get('cb_emergency_request_time', time());
$offset = 900;
if (($emergency_request_time + $offset) < $time)
{
$cb_user->set('cb_emergency_step', 0);
$cb_user->set('cb_queue_consultants', '');
$cb_user->set('cb_emergency_topic', '');
$cb_user->store();
return true;
}
return false;
}
public static function getAjax()
{
include_once(JPATH_ADMINISTRATOR .
'/components/com_comprofiler/plugin.foundation.php');
$user = jfactory::getuser();
$current_user_id = $user->get('id', 0, 'int');
$cbUser = &CBuser::getInstance((int) $current_user_id);
$cb_user = $cbUser->getUserData();
$emergency_step = $cb_user->get('cb_emergency_step', null);
if ($emergency_step == 2)
return true;
return false;
// $queue_consultants=
$cb_user->get('cb_queue_consultants', null);
//
// if (empty($queue_consultants))
// return false;
//
// return true;
}
public static function consultantsInQueueAjax()
{
$app = jfactory::getapplication();
$return_data = [];
include_once(JPATH_ADMINISTRATOR .
'/components/com_comprofiler/plugin.foundation.php');
$user = jfactory::getuser();
$current_user_id = $user->get('id', 0, 'int');
$cbUser = &CBuser::getInstance((int) $current_user_id);
$cb_user = $cbUser->getUserData();
$queue_consultants =
unserialize($cb_user->get('cb_queue_consultants'));
$consultant_ids = $app->input->get('consultant_ids');
$to = $app->input->get('to');
$from = $app->input->get('from');
$direction = $app->input->get('direction');
$new_consultant_ids = array_filter($queue_consultants, function ($item)
use ($consultant_ids) {
if (!in_array($item, $consultant_ids)) return true;
});
if (!empty($new_consultant_ids))
{
if ($direction == 'right') $to = $from + 1;
else $to = count($queue_consultants) - 1;
$new_consultants = [];
foreach ($queue_consultants as $queue_consultant)
{
$cbUserIns = &CBuser::getInstance((int) $queue_consultant);
$consultant_user = $cbUserIns->getUserData();
$res = self::emergency_consultant($consultant_user, true);
$new_consultants[] = [
'cb_user' => $consultant_user,
'emergency_plan' => $res[1],
'emergency_consultant_id' => $queue_consultant,
];
}
ob_start();
include(JPATH_SITE .
'/modules/mod_emergencyconsultant/tmpl/carousel.php');
$carousel = ob_get_contents();
ob_end_clean();
$return_data['status'] = true;
$return_data['carousel'] = $carousel;
return $return_data;
}
$return_data['status'] = false;
return $return_data;
}
public static function getUserDetails(array $userIds, array $colList)
{
if (!in_array('user_id', $colList))
{
$colList[] = 'user_id';
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(implode(', ', $colList))
->from('#__comprofiler')
->where('user_id IN (' . implode(', ', $userIds)
. ')');
$db->setQuery($query);
return $db->loadObjectList('user_id');
}
}
home/lmsyaran/public_html/administrator/modules/mod_version/helper.php000064400000002005151160120460022461
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_version
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_version
*
* @since 1.6
*/
abstract class ModVersionHelper
{
/**
* Get the member items of the submenu.
*
* @param \Joomla\Registry\Registry &$params The parameters
object.
*
* @return string String containing the current Joomla version based on
the selected format.
*/
public static function getVersion(&$params)
{
$version = new JVersion;
$versionText = $version->getShortVersion();
$product = $params->get('product', 1);
if ($params->get('format', 'short') ===
'long')
{
$versionText = str_replace($version::PRODUCT . ' ',
'', $version->getLongVersion());
}
if (!empty($product))
{
$versionText = $version::PRODUCT . ' ' . $versionText;
}
return $versionText;
}
}
home/lmsyaran/public_html/j3/modules/mod_stats/helper.php000064400000007005151160146340017600
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_stats
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_stats
*
* @since 1.5
*/
class ModStatsHelper
{
/**
* Get list of stats
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function &getList(&$params)
{
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$rows = array();
$query = $db->getQuery(true);
$serverinfo = $params->get('serverinfo', 0);
$siteinfo = $params->get('siteinfo', 0);
$counter = $params->get('counter', 0);
$increase = $params->get('increase', 0);
$i = 0;
if ($serverinfo)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_OS');
$rows[$i]->data = substr(php_uname(), 0, 7);
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_PHP');
$rows[$i]->data = phpversion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_($db->name);
$rows[$i]->data = $db->getVersion();
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_TIME');
$rows[$i]->data = JHtml::_('date', 'now',
'H:i');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_CACHING');
$rows[$i]->data = $app->get('caching') ?
JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_GZIP');
$rows[$i]->data = $app->get('gzip') ?
JText::_('JENABLED') : JText::_('JDISABLED');
$i++;
}
if ($siteinfo)
{
$query->select('COUNT(id) AS count_users')
->from('#__users');
$db->setQuery($query);
try
{
$users = $db->loadResult();
}
catch (RuntimeException $e)
{
$users = false;
}
$query->clear()
->select('COUNT(id) AS count_items')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$items = $db->loadResult();
}
catch (RuntimeException $e)
{
$items = false;
}
if ($users)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_USERS');
$rows[$i]->data = $users;
$i++;
}
if ($items)
{
$rows[$i] = new stdClass;
$rows[$i]->title = JText::_('MOD_STATS_ARTICLES');
$rows[$i]->data = $items;
$i++;
}
}
if ($counter)
{
$query->clear()
->select('SUM(hits) AS count_hits')
->from('#__content')
->where('state = 1');
$db->setQuery($query);
try
{
$hits = $db->loadResult();
}
catch (RuntimeException $e)
{
$hits = false;
}
if ($hits)
{
$rows[$i] = new stdClass;
$rows[$i]->title =
JText::_('MOD_STATS_ARTICLES_VIEW_HITS');
$rows[$i]->data = $hits + $increase;
$i++;
}
}
// Include additional data defined by published system plugins
JPluginHelper::importPlugin('system');
$arrays = (array) $app->triggerEvent('onGetStats',
array('mod_stats'));
foreach ($arrays as $response)
{
foreach ($response as $row)
{
// We only add a row if the title and data are given
if (isset($row['title']) &&
isset($row['data']))
{
$rows[$i] = new stdClass;
$rows[$i]->title = $row['title'];
$rows[$i]->icon = isset($row['icon']) ?
$row['icon'] : 'info';
$rows[$i]->data = $row['data'];
$i++;
}
}
}
return $rows;
}
}
home/lmsyaran/public_html/administrator/modules/mod_menu/helper.php000064400000003023151160304750021747
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_menu
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_menu
*
* @since 1.5
*/
abstract class ModMenuHelper
{
/**
* Get a list of the available menus.
*
* @return array An array of the available menus (from the menu types
table).
*
* @since 1.6
*/
public static function getMenus()
{
$db = JFactory::getDbo();
// Search for home menu and language if exists
$subQuery = $db->getQuery(true)
->select('b.menutype, b.home, b.language, l.image, l.sef,
l.title_native')
->from('#__menu AS b')
->leftJoin('#__languages AS l ON l.lang_code = b.language')
->where('b.home != 0')
->where('(b.client_id = 0 OR b.client_id IS NULL)');
// Get all menu types with optional home menu and language
$query = $db->getQuery(true)
->select('a.id, a.asset_id, a.menutype, a.title, a.description,
a.client_id')
->select('c.home, c.language, c.image, c.sef,
c.title_native')
->from('#__menu_types AS a')
->leftJoin('(' . (string) $subQuery . ') c ON
c.menutype = a.menutype')
->order('a.id');
$db->setQuery($query);
try
{
$result = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$result = array();
JFactory::getApplication()->enqueueMessage(JText::sprintf('JERROR_LOADING_MENUS',
$e->getMessage()), 'error');
}
return $result;
}
}
home/lmsyaran/public_html/j3/libraries/regularlabs/helpers/helper.php000064400000003406151160357250022061
0ustar00<?php
/**
* @package Regular Labs Library
* @version 21.2.19653
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2021 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die;
use RegularLabs\Library\Article as RL_Article;
use RegularLabs\Library\Cache as RL_Cache;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Parameters as RL_Parameters;
if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
}
class RLHelper
{
public static function getPluginHelper($plugin, $params = null)
{
if ( ! class_exists('RegularLabs\Library\Cache'))
{
return null;
}
$hash = md5('getPluginHelper_' .
$plugin->get('_type') . '_' .
$plugin->get('_name') . '_' . json_encode($params));
if (RL_Cache::has($hash))
{
return RL_Cache::get($hash);
}
if ( ! $params)
{
$params =
RL_Parameters::getInstance()->getPluginParams($plugin->get('_name'));
}
$file = JPATH_PLUGINS . '/' .
$plugin->get('_type') . '/' .
$plugin->get('_name') . '/helper.php';
if ( ! is_file($file))
{
return null;
}
require_once $file;
$class = get_class($plugin) . 'Helper';
return RL_Cache::set(
$hash,
new $class($params)
);
}
public static function processArticle(&$article, &$context,
&$helper, $method, $params = [])
{
class_exists('RegularLabs\Library\Article') &&
RL_Article::process($article, $context, $helper, $method, $params);
}
public static function isCategoryList($context)
{
return class_exists('RegularLabs\Library\Document') &&
RL_Document::isCategoryList($context);
}
}
home/lmsyaran/public_html/j3/htaccess.back/fof/layout/helper.php000064400000002733151160446400020721
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage layout
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* Helper to render a FOFLayout object, storing a base path
*
* @package FrameworkOnFramework
* @since x.y
*/
class FOFLayoutHelper extends JLayoutHelper
{
/**
* Method to render the layout.
*
* @param string $layoutFile Dot separated path to the layout file,
relative to base path
* @param object $displayData Object which properties are used inside
the layout file to build displayed output
* @param string $basePath Base path to use when loading layout
files
* @param mixed $options Optional custom options to load.
Registry or array format
*
* @return string
*/
public static function render($layoutFile, $displayData = null, $basePath
= '', $options = null)
{
$basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
// Make sure we send null to FOFLayoutFile if no path set
$basePath = empty($basePath) ? null : $basePath;
$layout = new FOFLayoutFile($layoutFile, $basePath, $options);
$renderedLayout = $layout->render($displayData);
return $renderedLayout;
}
}
home/lmsyaran/public_html/j3/modules/mod_random_image/helper.php000064400000005723151160527250021074
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_random_image
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\String\StringHelper;
/**
* Helper for mod_random_image
*
* @since 1.5
*/
class ModRandomImageHelper
{
/**
* Retrieves a random image
*
* @param \Joomla\Registry\Registry &$params module parameters
object
* @param array $images list of images
*
* @return mixed
*/
public static function getRandomImage(&$params, $images)
{
$width = $params->get('width', 100);
$height = $params->get('height', null);
$i = count($images);
$random = mt_rand(0, $i - 1);
$image = $images[$random];
$size = getimagesize(JPATH_BASE . '/' . $image->folder .
'/' . $image->name);
if ($size[0] < $width)
{
$width = $size[0];
}
$coeff = $size[0] / $size[1];
if ($height === null)
{
$height = (int) ($width / $coeff);
}
else
{
$newheight = min($height, (int) ($width / $coeff));
if ($newheight < $height)
{
$height = $newheight;
}
else
{
$width = $height * $coeff;
}
}
$image->width = $width;
$image->height = $height;
$image->folder = str_replace('\\', '/',
$image->folder);
return $image;
}
/**
* Retrieves images from a specific folder
*
* @param \Joomla\Registry\Registry &$params module params
* @param string $folder folder to get the images
from
*
* @return array
*/
public static function getImages(&$params, $folder)
{
$type = $params->get('type', 'jpg');
$files = array();
$images = array();
$dir = JPATH_BASE . '/' . $folder;
// Check if directory exists
if (is_dir($dir))
{
if ($handle = opendir($dir))
{
while (false !== ($file = readdir($handle)))
{
if ($file !== '.' && $file !== '..'
&& $file !== 'CVS' && $file !==
'index.html')
{
$files[] = $file;
}
}
}
closedir($handle);
$i = 0;
foreach ($files as $img)
{
if (!is_dir($dir . '/' . $img) &&
preg_match('/' . $type . '/', $img))
{
$images[$i] = new stdClass;
$images[$i]->name = $img;
$images[$i]->folder = $folder;
$i++;
}
}
}
return $images;
}
/**
* Get sanitized folder
*
* @param \Joomla\Registry\Registry &$params module params objects
*
* @return mixed
*/
public static function getFolder(&$params)
{
$folder = $params->get('folder');
$LiveSite = JUri::base();
// If folder includes livesite info, remove
if (StringHelper::strpos($folder, $LiveSite) === 0)
{
$folder = str_replace($LiveSite, '', $folder);
}
// If folder includes absolute path, remove
if (StringHelper::strpos($folder, JPATH_SITE) === 0)
{
$folder = str_replace(JPATH_BASE, '', $folder);
}
return str_replace(array('\\', '/'),
DIRECTORY_SEPARATOR, $folder);
}
}
home/lmsyaran/public_html/j3/htaccess.back/fof/form/helper.php000064400000013536151160536330020354
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage form
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
JLoader::import('joomla.form.helper');
/**
* FOFForm's helper class.
* Provides a storage for filesystem's paths where FOFForm's
entities reside and
* methods for creating those entities. Also stores objects with
entities'
* prototypes for further reusing.
*
* @package FrameworkOnFramework
* @since 2.0
*/
class FOFFormHelper extends JFormHelper
{
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadFieldType($type, $new = true)
{
return self::loadType('field', $type, $new);
}
/**
* Method to load a form field object given a type.
*
* @param string $type The field type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed JFormField object on success, false otherwise.
*
* @since 11.1
*/
public static function loadHeaderType($type, $new = true)
{
return self::loadType('header', $type, $new);
}
/**
* Method to load a form entity object given a type.
* Each type is loaded only once and then used as a prototype for other
objects of same type.
* Please, use this method only with those entities which support types
(forms don't support them).
*
* @param string $entity The entity.
* @param string $type The entity type.
* @param boolean $new Flag to toggle whether we should get a new
instance of the object.
*
* @return mixed Entity object on success, false otherwise.
*
* @since 11.1
*/
protected static function loadType($entity, $type, $new = true)
{
// Reference to an array with current entity's type instances
$types = &self::$entities[$entity];
$key = md5($type);
// Return an entity object if it already exists and we don't need a
new one.
if (isset($types[$key]) && $new === false)
{
return $types[$key];
}
$class = self::loadClass($entity, $type);
if ($class !== false)
{
// Instantiate a new type object.
$types[$key] = new $class;
return $types[$key];
}
else
{
return false;
}
}
/**
* Attempt to import the JFormField class file if it isn't already
imported.
* You can use this method outside of JForm for loading a field for
inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadFieldClass($type)
{
return self::loadClass('field', $type);
}
/**
* Attempt to import the FOFFormHeader class file if it isn't already
imported.
* You can use this method outside of JForm for loading a field for
inheritance or composition.
*
* @param string $type Type of a field whose class should be loaded.
*
* @return mixed Class name on success or false otherwise.
*
* @since 11.1
*/
public static function loadHeaderClass($type)
{
return self::loadClass('header', $type);
}
/**
* Load a class for one of the form's entities of a particular type.
* Currently, it makes sense to use this method for the "field"
and "rule" entities
* (but you can support more entities in your subclass).
*
* @param string $entity One of the form entities (field or rule).
* @param string $type Type of an entity.
*
* @return mixed Class name on success or false otherwise.
*
* @since 2.0
*/
public static function loadClass($entity, $type)
{
if (strpos($type, '.'))
{
list($prefix, $type) = explode('.', $type);
$altPrefix = $prefix;
}
else
{
$prefix = 'FOF';
$altPrefix = 'J';
}
$class = JString::ucfirst($prefix, '_') . 'Form' .
JString::ucfirst($entity, '_') . JString::ucfirst($type,
'_');
$altClass = JString::ucfirst($altPrefix, '_') .
'Form' . JString::ucfirst($entity, '_') .
JString::ucfirst($type, '_');
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
// Get the field search path array.
$paths = self::addPath($entity);
// If the type is complex, add the base type to the paths.
if ($pos = strpos($type, '_'))
{
// Add the complex type prefix to the paths.
for ($i = 0, $n = count($paths); $i < $n; $i++)
{
// Derive the new path.
$path = $paths[$i] . '/' . strtolower(substr($type, 0,
$pos));
// If the path does not exist, add it.
if (!in_array($path, $paths))
{
$paths[] = $path;
}
}
// Break off the end of the complex type.
$type = substr($type, $pos + 1);
}
// Try to find the class file.
$type = strtolower($type) . '.php';
$filesystem =
FOFPlatform::getInstance()->getIntegrationObject('filesystem');
foreach ($paths as $path)
{
if ($file = $filesystem->pathFind($path, $type))
{
require_once $file;
if (class_exists($class))
{
break;
}
elseif (class_exists($altClass))
{
break;
}
}
}
// Check for all if the class exists.
if (class_exists($class))
{
return $class;
}
elseif (class_exists($altClass))
{
return $altClass;
}
else
{
return false;
}
}
/**
* Method to add a path to the list of header include paths.
*
* @param mixed $new A path or array of paths to add.
*
* @return array The list of paths that have been added.
*/
public static function addHeaderPath($new = null)
{
return self::addPath('header', $new);
}
}
home/lmsyaran/public_html/j3/modules/mod_whosonline/helper.php000064400000005213151160536360020633
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_whosonline
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_whosonline
*
* @since 1.5
*/
class ModWhosonlineHelper
{
/**
* Show online count
*
* @return array The number of Users and Guests online.
*
* @since 1.5
**/
public static function getOnlineCount()
{
$db = JFactory::getDbo();
// Calculate number of guests and users
$result = array();
$user_array = 0;
$guest_array = 0;
$whereCondition =
JFactory::getConfig()->get('shared_session', '0') ?
'IS NULL' : '= 0';
$query = $db->getQuery(true)
->select('guest, client_id')
->from('#__session')
->where('client_id ' . $whereCondition);
$db->setQuery($query);
try
{
$sessions = (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
$sessions = array();
}
if (count($sessions))
{
foreach ($sessions as $session)
{
// If guest increase guest count by 1
if ($session->guest == 1)
{
$guest_array ++;
}
// If member increase member count by 1
if ($session->guest == 0)
{
$user_array ++;
}
}
}
$result['user'] = $user_array;
$result['guest'] = $guest_array;
return $result;
}
/**
* Show online member names
*
* @param mixed $params The parameters
*
* @return array (array) $db->loadObjectList() The names of the
online users.
*
* @since 1.5
**/
public static function getOnlineUserNames($params)
{
$whereCondition =
JFactory::getConfig()->get('shared_session', '0') ?
'IS NULL' : '= 0';
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('a.username',
'a.userid', 'a.client_id')))
->from('#__session AS a')
->where($db->quoteName('a.userid') . ' != 0')
->where($db->quoteName('a.client_id') . ' ' .
$whereCondition)
->group($db->quoteName(array('a.username',
'a.userid', 'a.client_id')));
$user = JFactory::getUser();
if (!$user->authorise('core.admin') &&
$params->get('filter_groups', 0) == 1)
{
$groups = $user->getAuthorisedGroups();
if (empty($groups))
{
return array();
}
$query->join('LEFT', '#__user_usergroup_map AS m ON
m.user_id = a.userid')
->join('LEFT', '#__usergroups AS ug ON ug.id =
m.group_id')
->where('ug.id in (' . implode(',', $groups) .
')')
->where('ug.id <> 1');
}
$db->setQuery($query);
try
{
return (array) $db->loadObjectList();
}
catch (RuntimeException $e)
{
return array();
}
}
}
home/lmsyaran/public_html/administrator/modules/mod_logged/helper.php000064400000003515151160731550022254
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_logged
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_logged
*
* @since 1.5
*/
abstract class ModLoggedHelper
{
/**
* Get a list of logged users.
*
* @param \Joomla\Registry\Registry &$params The module
parameters.
*
* @return mixed An array of users, or false on error.
*
* @throws RuntimeException
*/
public static function getList(&$params)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$query = $db->getQuery(true)
->select('s.time, s.client_id, u.id, u.name, u.username')
->from('#__session AS s')
->join('LEFT', '#__users AS u ON s.userid =
u.id')
->where('s.guest = 0');
$db->setQuery($query, 0, $params->get('count', 5));
try
{
$results = $db->loadObjectList();
}
catch (RuntimeException $e)
{
throw $e;
}
foreach ($results as $k => $result)
{
$results[$k]->logoutLink = '';
if ($user->authorise('core.manage', 'com_users'))
{
$results[$k]->editLink =
JRoute::_('index.php?option=com_users&task=user.edit&id='
. $result->id);
$results[$k]->logoutLink =
JRoute::_('index.php?option=com_login&task=logout&uid=' .
$result->id . '&' . JSession::getFormToken() .
'=1');
}
if ($params->get('name', 1) == 0)
{
$results[$k]->name = $results[$k]->username;
}
}
return $results;
}
/**
* Get the alternate title for the module
*
* @param \Joomla\Registry\Registry $params The module parameters.
*
* @return string The alternate title for the module.
*/
public static function getTitle($params)
{
return JText::plural('MOD_LOGGED_TITLE',
$params->get('count', 5));
}
}
home/lmsyaran/public_html/administrator/modules/mod_feed/helper.php000064400000001753151160744100021713
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_feed
*
* @since 1.5
*/
class ModFeedHelper
{
/**
* Method to load a feed.
*
* @param JRegisty $params The parameters object.
*
* @return JFeedReader|string Return a JFeedReader object or a string
message if error.
*
* @since 1.5
*/
public static function getFeed($params)
{
// Module params
$rssurl = $params->get('rssurl', '');
// Get RSS parsed object
try
{
jimport('joomla.feed.factory');
$feed = new JFeedFactory;
$rssDoc = $feed->getFeed($rssurl);
}
catch (Exception $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if (empty($rssDoc))
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
return $rssDoc;
}
}
home/lmsyaran/public_html/j3/modules/mod_sppagebuilder/helper.php000064400000002663151161006350021272
0ustar00<?php
/**
* @package SP Page Builder
* @author JoomShaper http://www.joomshaper.com
* @copyright Copyright (c) 2010 - 2016 JoomShaper
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
*/
//no direct access
defined('_JEXEC') or die('restricted access');
use Joomla\CMS\Factory;
class ModSPagebuilderHelper
{
public static function getData($id, $params)
{
$data = self::pageBuilderData($id);
$data = ApplicationHelper::preparePageData($data);
if (isset($data->text) && $data->text)
{
$data->text = !is_string($data->text) ?
json_encode($data->text) : $data->text;
return $data->text;
}
else
{
$content = $params->get('content', '[]');
if (!self::isJson($content))
{
$content = '[]';
}
}
return $content;
}
private static function pageBuilderData($id)
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__sppagebuilder'));
$query->where($db->quoteName('extension') . ' =
' . $db->quote('mod_sppagebuilder'));
$query->where($db->quoteName('extension_view') . ' =
' . $db->quote('module'));
$query->where($db->quoteName('view_id') . ' = '
. $db->quote($id));
$db->setQuery($query);
$item = $db->loadObject();
return $item;
}
private static function isJson($string)
{
json_decode($string);
return (json_last_error() == JSON_ERROR_NONE);
}
}
home/lmsyaran/public_html/j3/htaccess.back/fof/utils/config/helper.php000064400000005143151161043400022001
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* A utility class to help you fetch component parameters without going
through JComponentHelper
*/
class FOFUtilsConfigHelper
{
/**
* Caches the component parameters without going through JComponentHelper.
This is necessary since JComponentHelper
* cannot be reset or updated once you update parameters in the database.
*
* @var array
*/
private static $componentParams = array();
/**
* Loads the component's configuration parameters so they can be
accessed by getComponentConfigurationValue
*
* @param string $component The component for loading the parameters
* @param bool $force Should I force-reload the configuration
information?
*/
public final static function loadComponentConfig($component, $force =
false)
{
if (isset(self::$componentParams[$component]) &&
!is_null(self::$componentParams[$component]) && !$force)
{
return;
}
$db = FOFPlatform::getInstance()->getDbo();
$sql = $db->getQuery(true)
->select($db->qn('params'))
->from($db->qn('#__extensions'))
->where($db->qn('type') . ' = ' .
$db->q('component'))
->where($db->qn('element') . " = " .
$db->q($component));
$db->setQuery($sql);
$config_ini = $db->loadResult();
// OK, Joomla! 1.6 stores values JSON-encoded so, what do I do? Right!
$config_ini = trim($config_ini);
if ((substr($config_ini, 0, 1) == '{') &&
substr($config_ini, -1) == '}')
{
$config_ini = json_decode($config_ini, true);
}
else
{
$config_ini = FOFUtilsIniParser::parse_ini_file($config_ini, false,
true);
}
if (is_null($config_ini) || empty($config_ini))
{
$config_ini = array();
}
self::$componentParams[$component] = $config_ini;
}
/**
* Retrieves the value of a component configuration parameter without
going through JComponentHelper
*
* @param string $component The component for loading the parameter
value
* @param string $key The key to retrieve
* @param mixed $default The default value to use in case the key
is missing
*
* @return mixed
*/
public final static function getComponentConfigurationValue($component,
$key, $default = null)
{
self::loadComponentConfig($component, false);
if (array_key_exists($key, self::$componentParams[$component]))
{
return self::$componentParams[$component][$key];
}
else
{
return $default;
}
}
}
home/lmsyaran/public_html/j3/modules/mod_wrapper/helper.php000064400000002621151161137370020125
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_wrapper
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_wrapper
*
* @since 1.5
*/
class ModWrapperHelper
{
/**
* Gets the parameters for the wrapper
*
* @param mixed &$params The parameters set in the administrator
section
*
* @return mixed ¶ms The modified parameters
*
* @since 1.5
*/
public static function getParams(&$params)
{
$params->def('url', '');
$params->def('scrolling', 'auto');
$params->def('height', '200');
$params->def('height_auto', 0);
$params->def('width', '100%');
$params->def('add', 1);
$params->def('name', 'wrapper');
$url = $params->get('url');
if ($params->get('add'))
{
// Adds 'http://' if none is set
if (strpos($url, '/') === 0)
{
// Relative URL in component. use server http_host.
$url = 'http://' . $_SERVER['HTTP_HOST'] . $url;
}
elseif (strpos($url, 'http') === false && strpos($url,
'https') === false)
{
$url = 'http://' . $url;
}
}
// Auto height control
if ($params->def('height_auto'))
{
$load = 'onload="iFrameHeight(this)"';
}
else
{
$load = '';
}
$params->set('load', $load);
$params->set('url', $url);
return $params;
}
}
home/lmsyaran/public_html/j3/modules/mod_gantry5_particle/helper.php000064400000012001151161212670021707
0ustar00<?php
/**
* @package Gantry 5
* @author RocketTheme http://www.rockettheme.com
* @copyright Copyright (C) 2007 - 2017 RocketTheme, LLC
* @license GNU/GPLv2 and later
*
* http://www.gnu.org/licenses/gpl-2.0.html
*/
defined('_JEXEC') or die;
class ModGantry5ParticleHelper
{
/**
* Serve module AJAX requests in
'index.php?option=com_ajax&module=gantry5_particle&format=json'.
*
* @return array|null|string
*/
public static function getAjax()
{
$input = JFactory::getApplication()->input;
$format = $input->getCmd('format', 'html');
$id = $input->getInt('id');
$props = $_GET;
unset($props['option'], $props['module'],
$props['format'], $props['id']);
return static::ajax($id, $props, $format);
}
/**
* @param $id
* @param array $props
* @param string $format
* @return array|null|string
*/
public static function ajax($id, $props = [], $format =
'raw')
{
if (!in_array($format, ['json', 'raw',
'debug'])) {
throw new
RuntimeException(JText::_('JERROR_PAGE_NOT_FOUND'), 404);
}
$gantry = \Gantry\Framework\Gantry::instance();
$module = $gantry['platform']->getModule($id);
// Make sure that module really exists.
if (!is_object($module) || strpos($module->module,
'gantry5') === false) {
throw new
RuntimeException(JText::_('JERROR_PAGE_NOT_FOUND'), 404);
}
$attribs = ['style' => 'gantry'];
// Trigger the onRenderModule event.
$dispatcher = \JEventDispatcher::getInstance();
$dispatcher->trigger('onRenderModule',
['module' => &$module, 'attribs' =>
&$attribs]);
$params = new JRegistry($module->params);
$params->set('ajax', $props);
$block = static::render($module, $params);
$data = json_decode($params->get('particle'), true);
$type = $data['type'] . '.' .
$data['particle'];
$identifier = static::getIdentifier($data['particle'],
$module->id);
$html = (string) $block;
if ($format === 'raw') {
return $html;
}
return ['code' => 200, 'type' => $type,
'id' => $identifier, 'props' => (object) $props,
'html' => $html];
}
/**
* @param object $module
* @param object $params
* @return Gantry\Component\Content\Block\ContentBlockInterface
*/
public static function render($module, $params)
{
GANTRY_DEBUGGER &&
\Gantry\Debugger::addMessage("Particle Module #{$module->id} was
not cached");
$data = json_decode($params->get('particle'), true);
$type = $data['type'];
$particle = $data['particle'];
$gantry = \Gantry\Framework\Gantry::instance();
if ($gantry->debug()) {
$enabled_outline =
$gantry['config']->get("particles.{$particle}.enabled",
true);
$enabled =
isset($data['options']['particle']['enabled'])
? $data['options']['particle']['enabled'] :
true;
$location = (!$enabled_outline ? 'Outline' :
(!$enabled ? 'Module' : null));
if ($location) {
$block =
\Gantry\Component\Content\Block\HtmlBlock::create();
$block->setContent(sprintf('<div
class="alert alert-error">The Particle has been disabled from
the %s and won\'t render.</div>', $location));
return $block;
}
}
$id = static::getIdentifier($particle, $module->id);
$object = (object) array(
'id' => $id,
'type' => $type,
'subtype' => $particle,
'attributes' =>
$data['options']['particle'],
);
$context = array(
'gantry' => $gantry,
'inContent' => true,
'ajax' => $params->get('ajax'),
);
/** @var Gantry\Framework\Theme $theme */
$theme = $gantry['theme'];
$block = $theme->getContent($object, $context);
// Create outer block with the particle ID for AJAX calls.
$outer = \Gantry\Component\Content\Block\HtmlBlock::create();
$outer->setContent('<div id="' . $id .
'-particle" class="g-particle">' .
$block->getToken() . '</div>');
$outer->addBlock($block);
return $outer;
}
/**
* @param $module
* @param $params
* @return array
*/
public static function cache($module, $params)
{
return static::render($module, $params)->toArray();
}
/**
* @param $module
* @param $params
* @param $cacheparams
* @return \Gantry\Component\Content\Block\ContentBlockInterface|null
*/
public static function moduleCache($module, $params, $cacheparams)
{
$block = (array) JModuleHelper::moduleCache($module, $params,
$cacheparams);
try {
return $block ?
\Gantry\Component\Content\Block\HtmlBlock::fromArray($block) : null;
} catch (Exception $e) {
return null;
}
}
public static function getIdentifier($particle, $id)
{
return "module-{$particle}-{$id}";
}
}
home/lmsyaran/public_html/libraries/fof/layout/helper.php000064400000002733151161245470017672
0ustar00<?php
/**
* @package FrameworkOnFramework
* @subpackage layout
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba
Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
* @note This file has been modified by the Joomla! Project and no
longer reflects the original work of its author.
*/
// Protect from unauthorized access
defined('FOF_INCLUDED') or die;
/**
* Helper to render a FOFLayout object, storing a base path
*
* @package FrameworkOnFramework
* @since x.y
*/
class FOFLayoutHelper extends JLayoutHelper
{
/**
* Method to render the layout.
*
* @param string $layoutFile Dot separated path to the layout file,
relative to base path
* @param object $displayData Object which properties are used inside
the layout file to build displayed output
* @param string $basePath Base path to use when loading layout
files
* @param mixed $options Optional custom options to load.
Registry or array format
*
* @return string
*/
public static function render($layoutFile, $displayData = null, $basePath
= '', $options = null)
{
$basePath = empty($basePath) ? self::$defaultBasePath : $basePath;
// Make sure we send null to FOFLayoutFile if no path set
$basePath = empty($basePath) ? null : $basePath;
$layout = new FOFLayoutFile($layoutFile, $basePath, $options);
$renderedLayout = $layout->render($displayData);
return $renderedLayout;
}
}
home/lmsyaran/public_html/j3/modules/mod_articles_category/helper.php000064400000034757151161346730022171
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
use Joomla\String\StringHelper;
$com_path = JPATH_SITE . '/components/com_content/';
JLoader::register('ContentHelperRoute', $com_path .
'helpers/route.php');
JModelLegacy::addIncludePath($com_path . 'models',
'ContentModel');
/**
* Helper for mod_articles_category
*
* @since 1.6
*/
abstract class ModArticlesCategoryHelper
{
/**
* Get a list of articles from a specific category
*
* @param \Joomla\Registry\Registry &$params object holding the
models parameters
*
* @return mixed
*
* @since 1.6
*/
public static function getList(&$params)
{
// Get an instance of the generic articles model
$articles = JModelLegacy::getInstance('Articles',
'ContentModel', array('ignore_request' => true));
// Set application parameters in model
$app = JFactory::getApplication();
$appParams = $app->getParams();
$articles->setState('params', $appParams);
$articles->setState('list.start', 0);
$articles->setState('filter.published', 1);
// Set the filters based on the module params
$articles->setState('list.limit', (int)
$params->get('count', 0));
$articles->setState('load_tags',
$params->get('show_tags', 0) ||
$params->get('article_grouping', 'none') ===
'tags');
// Access filter
$access =
!JComponentHelper::getParams('com_content')->get('show_noauth');
$authorised =
JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
$articles->setState('filter.access', $access);
// Prep for Normal or Dynamic Modes
$mode = $params->get('mode', 'normal');
switch ($mode)
{
case 'dynamic' :
$option = $app->input->get('option');
$view = $app->input->get('view');
if ($option === 'com_content')
{
switch ($view)
{
case 'category' :
case 'categories' :
$catids = array($app->input->getInt('id'));
break;
case 'article' :
if ($params->get('show_on_article_page', 1))
{
$article_id = $app->input->getInt('id');
$catid = $app->input->getInt('catid');
if (!$catid)
{
// Get an instance of the generic article model
$article = JModelLegacy::getInstance('Article',
'ContentModel', array('ignore_request' => true));
$article->setState('params', $appParams);
$article->setState('filter.published', 1);
$article->setState('article.id', (int) $article_id);
$item = $article->getItem();
$catids = array($item->catid);
}
else
{
$catids = array($catid);
}
}
else
{
// Return right away if show_on_article_page option is off
return;
}
break;
case 'featured' :
default:
// Return right away if not on the category or article views
return;
}
}
else
{
// Return right away if not on a com_content page
return;
}
break;
case 'normal' :
default:
$catids = $params->get('catid');
$articles->setState('filter.category_id.include', (bool)
$params->get('category_filtering_type', 1));
break;
}
// Category filter
if ($catids)
{
if ($params->get('show_child_category_articles', 0)
&& (int) $params->get('levels', 0) > 0)
{
// Get an instance of the generic categories model
$categories = JModelLegacy::getInstance('Categories',
'ContentModel', array('ignore_request' => true));
$categories->setState('params', $appParams);
$levels = $params->get('levels', 1) ?: 9999;
$categories->setState('filter.get_children', $levels);
$categories->setState('filter.published', 1);
$categories->setState('filter.access', $access);
$additional_catids = array();
foreach ($catids as $catid)
{
$categories->setState('filter.parentId', $catid);
$recursive = true;
$items = $categories->getItems($recursive);
if ($items)
{
foreach ($items as $category)
{
$condition = (($category->level -
$categories->getParent()->level) <= $levels);
if ($condition)
{
$additional_catids[] = $category->id;
}
}
}
}
$catids = array_unique(array_merge($catids, $additional_catids));
}
$articles->setState('filter.category_id', $catids);
}
// Ordering
$ordering = $params->get('article_ordering',
'a.ordering');
switch ($ordering)
{
case 'random':
$articles->setState('list.ordering',
JFactory::getDbo()->getQuery(true)->Rand());
break;
case 'rating_count':
case 'rating':
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction',
$params->get('article_ordering_direction', 'ASC'));
if (!JPluginHelper::isEnabled('content', 'vote'))
{
$articles->setState('list.ordering',
'a.ordering');
}
break;
default:
$articles->setState('list.ordering', $ordering);
$articles->setState('list.direction',
$params->get('article_ordering_direction', 'ASC'));
break;
}
// Filter by multiple tags
$articles->setState('filter.tag',
$params->get('filter_tag', array()));
$articles->setState('filter.featured',
$params->get('show_front', 'show'));
$articles->setState('filter.author_id',
$params->get('created_by', array()));
$articles->setState('filter.author_id.include',
$params->get('author_filtering_type', 1));
$articles->setState('filter.author_alias',
$params->get('created_by_alias', array()));
$articles->setState('filter.author_alias.include',
$params->get('author_alias_filtering_type', 1));
$excluded_articles = $params->get('excluded_articles',
'');
if ($excluded_articles)
{
$excluded_articles = explode("\r\n", $excluded_articles);
$articles->setState('filter.article_id',
$excluded_articles);
// Exclude
$articles->setState('filter.article_id.include', false);
}
$date_filtering = $params->get('date_filtering',
'off');
if ($date_filtering !== 'off')
{
$articles->setState('filter.date_filtering',
$date_filtering);
$articles->setState('filter.date_field',
$params->get('date_field', 'a.created'));
$articles->setState('filter.start_date_range',
$params->get('start_date_range', '1000-01-01
00:00:00'));
$articles->setState('filter.end_date_range',
$params->get('end_date_range', '9999-12-31
23:59:59'));
$articles->setState('filter.relative_date',
$params->get('relative_date', 30));
}
// Filter by language
$articles->setState('filter.language',
$app->getLanguageFilter());
$items = $articles->getItems();
// Display options
$show_date = $params->get('show_date', 0);
$show_date_field = $params->get('show_date_field',
'created');
$show_date_format = $params->get('show_date_format',
'Y-m-d H:i:s');
$show_category = $params->get('show_category', 0);
$show_hits = $params->get('show_hits', 0);
$show_author = $params->get('show_author', 0);
$show_introtext = $params->get('show_introtext', 0);
$introtext_limit = $params->get('introtext_limit', 100);
// Find current Article ID if on an article page
$option = $app->input->get('option');
$view = $app->input->get('view');
if ($option === 'com_content' && $view ===
'article')
{
$active_article_id = $app->input->getInt('id');
}
else
{
$active_article_id = 0;
}
// Prepare data for display using display options
foreach ($items as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' .
$item->category_alias;
if ($access || in_array($item->access, $authorised))
{
// We know that user has the privilege to view the article
$item->link =
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language));
}
else
{
$menu = $app->getMenu();
$menuitems = $menu->getItems('link',
'index.php?option=com_users&view=login');
if (isset($menuitems[0]))
{
$Itemid = $menuitems[0]->id;
}
elseif ($app->input->getInt('Itemid') > 0)
{
// Use Itemid from requesting page only if there is no existing menu
$Itemid = $app->input->getInt('Itemid');
}
$item->link =
JRoute::_('index.php?option=com_users&view=login&Itemid='
. $Itemid);
}
// Used for styling the active article
$item->active = $item->id == $active_article_id ?
'active' : '';
$item->displayDate = '';
if ($show_date)
{
$item->displayDate = JHtml::_('date',
$item->$show_date_field, $show_date_format);
}
if ($item->catid)
{
$item->displayCategoryLink =
JRoute::_(ContentHelperRoute::getCategoryRoute($item->catid));
$item->displayCategoryTitle = $show_category ? '<a
href="' . $item->displayCategoryLink . '">'
. $item->category_title . '</a>' : '';
}
else
{
$item->displayCategoryTitle = $show_category ?
$item->category_title : '';
}
$item->displayHits = $show_hits ? $item->hits :
'';
$item->displayAuthorName = $show_author ? $item->author :
'';
if ($show_introtext)
{
$item->introtext = JHtml::_('content.prepare',
$item->introtext, '',
'mod_articles_category.content');
$item->introtext = self::_cleanIntrotext($item->introtext);
}
$item->displayIntrotext = $show_introtext ?
self::truncate($item->introtext, $introtext_limit) : '';
$item->displayReadmore = $item->alternative_readmore;
}
return $items;
}
/**
* Strips unnecessary tags from the introtext
*
* @param string $introtext introtext to sanitize
*
* @return mixed|string
*
* @since 1.6
*/
public static function _cleanIntrotext($introtext)
{
$introtext =
str_replace(array('<p>','</p>'), '
', $introtext);
$introtext = strip_tags($introtext,
'<a><em><strong>');
$introtext = trim($introtext);
return $introtext;
}
/**
* Method to truncate introtext
*
* The goal is to get the proper length plain text string with as much of
* the html intact as possible with all tags properly closed.
*
* @param string $html The content of the introtext to be
truncated
* @param integer $maxLength The maximum number of characters to
render
*
* @return string The truncated string
*
* @since 1.6
*/
public static function truncate($html, $maxLength = 0)
{
$baseLength = strlen($html);
// First get the plain text string. This is the rendered text we want to
end up with.
$ptString = JHtml::_('string.truncate', $html, $maxLength,
$noSplit = true, $allowHtml = false);
for ($maxLength; $maxLength < $baseLength;)
{
// Now get the string if we allow html.
$htmlString = JHtml::_('string.truncate', $html, $maxLength,
$noSplit = true, $allowHtml = true);
// Now get the plain text from the html string.
$htmlStringToPtString = JHtml::_('string.truncate',
$htmlString, $maxLength, $noSplit = true, $allowHtml = false);
// If the new plain text string matches the original plain text string
we are done.
if ($ptString === $htmlStringToPtString)
{
return $htmlString;
}
// Get the number of html tag characters in the first $maxlength
characters
$diffLength = strlen($ptString) - strlen($htmlStringToPtString);
// Set new $maxlength that adjusts for the html tags
$maxLength += $diffLength;
if ($baseLength <= $maxLength || $diffLength <= 0)
{
return $htmlString;
}
}
return $html;
}
/**
* Groups items by field
*
* @param array $list list of items
* @param string $fieldName name of field that is used for
grouping
* @param string $direction ordering direction
* @param null $fieldNameToKeep field name to keep
*
* @return array
*
* @since 1.6
*/
public static function groupBy($list, $fieldName, $direction,
$fieldNameToKeep = null)
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
if (!isset($grouped[$item->$fieldName]))
{
$grouped[$item->$fieldName] = array();
}
if ($fieldNameToKeep === null)
{
$grouped[$item->$fieldName][$key] = $item;
}
else
{
$grouped[$item->$fieldName][$key] = $item->$fieldNameToKeep;
}
unset($list[$key]);
}
$direction($grouped);
return $grouped;
}
/**
* Groups items by date
*
* @param array $list list of items
* @param string $type type of grouping
* @param string $direction ordering direction
* @param string $monthYearFormat date format to use
* @param string $field date field to group by
*
* @return array
*
* @since 1.6
*/
public static function groupByDate($list, $type = 'year',
$direction = 'ksort', $monthYearFormat = 'F Y', $field
= 'created')
{
$grouped = array();
if (!is_array($list))
{
if ($list == '')
{
return $grouped;
}
$list = array($list);
}
foreach ($list as $key => $item)
{
switch ($type)
{
case 'month_year' :
$month_year = StringHelper::substr($item->$field, 0, 7);
if (!isset($grouped[$month_year]))
{
$grouped[$month_year] = array();
}
$grouped[$month_year][$key] = $item;
break;
case 'year' :
default:
$year = StringHelper::substr($item->$field, 0, 4);
if (!isset($grouped[$year]))
{
$grouped[$year] = array();
}
$grouped[$year][$key] = $item;
break;
}
unset($list[$key]);
}
$direction($grouped);
if ($type === 'month_year')
{
foreach ($grouped as $group => $items)
{
$date = new JDate($group);
$formatted_group = $date->format($monthYearFormat);
$grouped[$formatted_group] = $items;
unset($grouped[$group]);
}
}
return $grouped;
}
/**
* Groups items by tags
*
* @param array $list list of items
* @param string $direction ordering direction
*
* @return array
*
* @since 3.9.0
*/
public static function groupByTags($list, $direction = 'ksort')
{
$grouped = array();
$untagged = array();
if (!$list)
{
return $grouped;
}
foreach ($list as $item)
{
if ($item->tags->itemTags)
{
foreach ($item->tags->itemTags as $tag)
{
$grouped[$tag->title][] = $item;
}
}
else
{
$untagged[] = $item;
}
}
$direction($grouped);
if ($untagged)
{
$grouped['MOD_ARTICLES_CATEGORY_UNTAGGED'] = $untagged;
}
return $grouped;
}
}
home/lmsyaran/public_html/j3/modules/mod_feed/helper.php000064400000001626151161536130017351
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_feed
*
* @since 1.5
*/
class ModFeedHelper
{
/**
* Retrieve feed information
*
* @param \Joomla\Registry\Registry $params module parameters
*
* @return JFeedReader|string
*/
public static function getFeed($params)
{
// Module params
$rssurl = $params->get('rssurl', '');
// Get RSS parsed object
try
{
$feed = new JFeedFactory;
$rssDoc = $feed->getFeed($rssurl);
}
catch (Exception $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if (empty($rssDoc))
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if ($rssDoc)
{
return $rssDoc;
}
}
}
home/lmsyaran/public_html/j3/plugins/jamegafilter/content/helper.php000064400000065362151161600520021726
0ustar00<?php
/**
*
------------------------------------------------------------------------
* JA Filter Plugin - Content
*
------------------------------------------------------------------------
* Copyright (C) 2004-2016 J.O.O.M Solutions Co., Ltd. All Rights
Reserved.
* @license - GNU/GPL, http://www.gnu.org/licenses/gpl.html
* Author: J.O.O.M Solutions Co., Ltd
* Websites: http://www.joomlart.com - http://www.joomlancers.com
* This file may not be redistributed in whole or significant part.
*
------------------------------------------------------------------------
*/
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\LanguageHelper;
use Joomla\Registry\Registry;
use Joomla\String\StringHelper;
use Joomla\Utilities\ArrayHelper;
JLoader::register('BaseFilterHelper', JPATH_ADMINISTRATOR
.'/components/com_jamegafilter/base.php');
JLoader::register('ReservationHelperRoute', JPATH_ROOT
.'/components/com_reservation/helpers/route.php');
class ReservationFilterHelper extends BaseFilterHelper {
public function __construct($params = array())
{
$this->_db = JFactory::getDbo();
$this->_params = new JRegistry($params);
$this->plugin = JPluginHelper::getPlugin('jamegafilter',
'reservation');
$this->plgParams = new JRegistry($this->plugin);
$this->plgParams->loadString($this->plugin->params);
return parent::__construct($params);
}
public function getFilterItems($catid)
{
$filterItems = array();
$lang_sfx = $this->getLangSuffix();
foreach ($lang_sfx AS $lang) {
$filterItems[strtolower(str_replace('-','_',$lang))]
= $this->getItemList($catid,$lang);
}
return $filterItems;
}
public function getLangSuffix()
{
# $langs = JFactory::getLanguage()->getKnownLanguages();
$langs = LanguageHelper::getKnownLanguages();
$lang_sfx = array();
foreach ($langs as $lang) {
$lang_sfx[] = $lang['tag'];
}
return $lang_sfx;
}
public function getCatList($catid, $ordering = 'rgt ASC') {
$catid = $catid ? $catid : '1';
$catList = array();
$include_root = $this->_params->get('include_root',
self::INCLUDE_ROOT);
$subcat = $this->_params->get('subcat', self::ALL);
if ($include_root === self::INCLUDE_ROOT && $catid !==
'1') {
$catList[] = $catid;
}
if ($subcat !== self::NONE) {
$maxLevel = $subcat === self::ALL ? 100 : (int) $subcat;
$categories = $this->getChildCategories($catid, $maxLevel, 0,
$ordering);
foreach ($categories as $category) {
$catList[] = $category->id;
}
}
return $catList;
}
public function getItemList($catid, $lang)
{
$catList = $this->getCatList($catid);
if (!count($catList)) {
return array();
}
$itemList = new stdCLass();
# wrong data here
$itemIdList = $this->getListId($catList, $lang);
if ($itemIdList) {
foreach ($itemIdList as $id) {
$property = 'item_'.$id;
$item = $this->getItem($id, $catList, $lang);
if( !empty($item))
$itemList->{ $property } = $item;
else
continue;
}
}
return $itemList;
}
public function getListId($catids, $lang)
{
$db = $this->_db;
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());
$query = $db->getQuery(true);
$query->select('id')
->from('#__reservation_consultant')
->where('state = 1 AND catid IN (' .implode(',',
$catids) . ') AND language IN ("*",
"'.$lang.'")' )
->where('(publish_up = ' . $nullDate . ' OR
publish_up <= ' . $nowDate . ')')
->order('id desc');
# ->where('(publish_down = ' . $nullDate . ' OR
publish_down >= ' . $nowDate . ')') // between where and
order
# select id from oektv_content where state=1 AND catid IN (2,8,9) AND
language IN ("*", "en-GB")
# AND (publish_up = '0000-00-00 00:00:00' OR publish_up <=
'2022-01-11 04:10:15')
# AND (publish_down = '0000-00-00 00:00:00' OR publish_down
>= '2022-01-11 04:10:15') ORDER BY id DESC;
$db->setQuery($query);
$listId = $db->loadColumn();
return $listId;
}
public function getCategoryListInfo($catList) {
if (version_compare(JVERSION, '3.7', '<'))
return;
$cdata = array();
$cdata['value'] = array();
$cdata['frontend_value'] = array();
$query = $this->_db->getQuery(true);
$query ->select('c.*')
->from('#__categories as c')
->where('c.id in (' . implode(',', $catList) .
')')
->where('c.published = 1');
$this->_db->setQuery($query);
$categories = $this->_db->loadObjectList();
foreach ($categories as $cat) {
$cdata['value'][] = $cat->id;
$cdata['frontend_value'][] =
$this->getCatNameAsTree($cat);
}
return $cdata;
}
public function getItem($id, $catList, $lang)
{
$app = JFactory::getApplication();
$baseItem = $this->getBaseItem($id);
$baseItem->text = $baseItem->introtext . $baseItem->fulltext;
// Process the content plugins.
JPluginHelper::importPlugin('content');
$dispatcher = JFactory::getApplication();
if (isset($baseItem->params)){
$dispatcher->triggerEvent('onContentPrepare', array
('com_content.article', &$baseItem,
&$baseItem->params, 0));
}
$images = new JRegistry($baseItem->images);
$item = new stdCLass();
if (in_array($baseItem->language, array('*', $lang))) {
$item->id = $id;
$item->slug = $id;
$item->lang = $lang;
$item->hits = (int) $baseItem->hits;
$item->name = $baseItem->title;
$img = $images->get('image_intro',
$images->get('image_fulltext', ''));
if (strpos($img, '#joomlaImage:')){
$img = explode('#joomlaImage:', $img)[0];
}
$item->thumbnail = $this->generateThumb($id, $img,
'content');
$juri = JUri::getInstance();
if (preg_match('/^\/\//', $item->thumbnail)) {
$item->thumbnail =
$juri->getScheme().':'.$item->thumbnail;
}
if ($this->checkDisplayOnFO('desc')) {
$text = trim($baseItem->text);
$item->desc = $text ? $this->getDesc($text) : '';
if (preg_match('/<img src="[^http|\/]/',
$item->desc)) {
// change to right link with custom field media. basic use. will be
update change later.
$item->desc = preg_replace('/<img
src="([^http|\/].*?)"/', '<img
src="'.JUri::root(true).'/$1"', $item->desc);
}
}
//Item link
$slug = $baseItem->alias ? ($baseItem->id . ':' .
$baseItem->alias) : $baseItem->id;
$catslug = isset($baseItem->category_alias) ? ($baseItem->catid .
':' . $baseItem->category_alias) : $baseItem->catid;
$route = ContentHelperRoute::getArticleRoute($slug, $catslug,
$item->lang);
$uriLeng = mb_strlen(JUri::root(true));
$item->url = mb_substr(JRoute::_($route), $uriLeng);
$item->attr = array();
if ($this->checkDisplayOnFO('name')) {
$item->attr['name']['frontend_value'] =
$item->name ?? '';
$fieldconfig = $this->getFieldConfig('name');
$item->attr['name']['title'] =
array($fieldconfig['title']);
$item->attr['name']['type'] =
$fieldconfig['type'];
}
//Ratings
if ($this->checkPublished('rating') ||
$this->checkDisplayOnFO('rating')) {
$item->rating = $this->getRating($id) ? $this->getRating($id)
: 0;
$item->width_rating = $item->rating * 20;
$item->attr['rating']['frontend_value'] =
$item->width_rating;
$item->attr['rating']['rating'] =
floatval($item->rating);
$fieldconfig = $this->getFieldConfig('rating');
$item->attr['rating']['title'] =
array($fieldconfig['title']);
$item->attr['rating']['type'] =
$fieldconfig['type'];
}
if ($this->checkDisplayOnFO('hits')) {
$item->attr['hits']['frontend_value'] =
$item->hits ?? '';
$fieldconfig = $this->getFieldConfig('hits');
$item->attr['hits']['title'] =
array($fieldconfig['title']);
$item->attr['hits']['type'] =
$fieldconfig['type'];
}
# print_r($item->desc);
if ($this->checkPublished('attr.fulltext.value') ||
$this->checkDisplayOnFO('attr.fulltext.value')) {
$item->attr['fulltext']['frontend_value'] =
$item->desc ?? '';
$item->attr['fulltext']['value'] =
strip_tags($baseItem->text);
$fieldconfig =
$this->getFieldConfig('attr.fulltext.value');
$item->attr['fulltext']['title'] =
array($fieldconfig['title']);
$item->attr['fulltext']['type'] =
$fieldconfig['type'];
}
$featured = $baseItem->featured;
$item->featured = $featured; // this value for custom use on FO like
icon or something
if ($this->checkDisplayOnFO('attr.featured.value') ||
$this->checkPublished('attr.featured.value')) {
$item->attr['featured']['value'] =
array($featured);
$item->attr['featured']['frontend_value'] =
$featured ? array(JText::_('COM_JAMEGAFILTER_ONLY_FEATURED')) :
array(JText::_('COM_JAMEGAFILTER_NOT_FEATURED'));
$fieldconfig =
$this->getFieldConfig('attr.featured.value');
$item->attr['featured']['title'] =
array($fieldconfig['title']);
$item->attr['featured']['type'] =
$fieldconfig['type'];
}
if ($baseItem->created != '0000-00-00 00:00:00') {
if ($this->checkPublished('created_date')) {
$item->created_date = array( strtotime($baseItem->created) );
}
if ($this->checkDisplayOnFO('created_date')) {
$item->attr['created_date']['frontend_value'] =
array( strtotime($baseItem->created) );
$fieldconfig = $this->getFieldConfig('created_date');
$item->attr['created_date']['title'] =
array($fieldconfig['title']);
$item->attr['created_date']['type'] =
$fieldconfig['type'];
}
}
if ($baseItem->modified != '0000-00-00 00:00:00') {
if ($this->checkPublished('modified_date')) {
$item->modified_date = array( strtotime($baseItem->modified) );
}
if ($this->checkDisplayOnFO('modified_date')) {
$item->attr['modified_date']['frontend_value']
= array( strtotime($baseItem->modified) );
$fieldconfig = $this->getFieldConfig('modified_date');
$item->attr['modified_date']['title'] =
array($fieldconfig['title']);
$item->attr['modified_date']['type'] =
$fieldconfig['type'];
}
}
if ($baseItem->publish_up != '0000-00-00 00:00:00') {
if ($this->checkPublished('published_date')) {
$item->published_date = array( strtotime($baseItem->publish_up)
);
}
if ($this->checkDisplayOnFO('published_date')) {
$item->attr['published_date']['frontend_value']
= array( strtotime($baseItem->publish_up) );
$fieldconfig = $this->getFieldConfig('published_date');
$item->attr['published_date']['title'] =
array($fieldconfig['title']);
$item->attr['published_date']['type'] =
$fieldconfig['type'];
}
}
//Attributes
$this->attr = array();
$this->getAuthorInfo($baseItem);
//Category Info
$this->getCategoryInfo($id, $catList);
//Tag Info
if (!empty($baseItem->tags->tags))
$this->getTagInfo($baseItem->tags->tags, $lang);
//Custom fields
$this->getCustomFieldsInfo($id, $lang);
$item->access = $this->getPermission($baseItem);
$item->attr = array_merge($item->attr, $this->attr);
// support user custom field, only parse to json if template required.
if
(JFile::exists(JPATH_SITE.'/templates/'.$app->getTemplate().'/etc/jamegafilter-ucf.log'))
$item->ucf = $this->getCustomJFields($baseItem->created_by,
"user");
// support ja content type
if (isset($baseItem->attribs['ctm_reservation_type'])
&&
!empty($baseItem->attribs['ctm_'.$baseItem->attribs['ctm_reservation_type']]))
{
$item->{"cmt_".$baseItem->attribs['ctm_reservation_type']}
=
$baseItem->attribs['ctm_'.$baseItem->attribs['ctm_reservation_type']];
}
}
return $item;
}
public function getPermission($item)
{
$sql = 'SELECT rules FROM #__viewlevels WHERE id =
'.$this->_db->quote($item->access);
$this->_db->setQuery($sql);
$access = $this->_db->loadResult();
if (!empty($access))
return str_replace(['[', ']'], ['',
''],$access);
}
public function getDesc($desc) {
$length = 20;
$desc = strip_tags($desc);
$exp = explode(' ', $desc);
$result = '';
foreach ($exp as $key => $value) {
if ($key > $length) {
break;
}
$result .= $value . ' ';
}
return $result;
}
// public function getRating($itemId){
// $rateOption = $this->plgParams->get('rating-option',
'com_reservation');
// if($rateOption === 'com_content'){
// $query = $this->_db->getQuery(true);
// $query->select('rating_sum,
rating_count')->from('#__content_rating')->where('content_id
= ' . (int) $itemId);
// $this->_db->setQuery($query);
// $rating = $this->_db->loadObject();
// if (!$rating){
// return false;
// }
// return round((int) $rating->rating_sum / (int)
$rating->rating_count, 0);
// }
// if (!$this->getComponentStatus('com_komento')){
// return false;
// }
// $query1[] = 'SELECT ax.`component`, ax.`cid`, count(1) AS
`count`, sum(ax.`ratings`) AS `totalRating`, ROUND(AVG(ax.`ratings`)/2,2)
AS `avgRating`';
// $query1[] = 'FROM `#__komento_comments` AS `ax`';
// $query1[] = 'WHERE ax.`published` = ' .
$this->_db->Quote(1);
display the posts that have ratings given
// $query1[] = 'AND ax.`ratings` > 0';
// $query1[] = 'AND ax.`cid` = ' .
$this->_db->Quote($itemId);
// $query1[] = 'AND ax.`created` = ';
// $query1[] = '(SELECT MAX(bx.`created`) FROM `#__komento_comments`
AS `bx`';
// $query1[] = 'WHERE bx.`email` = ax.`email`';
// $query1[] = 'AND bx.`component` = ax.`component`';
// $query1[] = 'AND bx.`cid` = ax.`cid`';
// $query1[] = ')';
// $query1[] = "AND ax.`component` = " .
$this->_db->quote('com_content');
// $query1[] = "GROUP BY ax.`cid`";
// $query1 = implode(' ', $query1);
// $this->_db->setQuery($query1);
// $data = $this->_db->loadObject();
// if (!$data){
// return false;
// }
// return isset($data) && !is_null($data) ? $data->avgRating :
0;
// }
public function getComponentStatus($component)
{
$db = JFactory::getDbo();
$q = 'select enabled from #__extensions where
type="component" and element =
"'.$component.'"';
$db->setQuery($q);
$status = $db->loadResult();
if($status) {
return true;
} else {
return false;
}
}
public function getBaseItem($id)
{
JModelLegacy::addIncludePath(JPATH_ROOT .
'/administrator/components/com_content/models',
'ContentModel');
if (version_compare(JVERSION, '4.0', 'ge'))
$model = new
Joomla\Component\Content\Administrator\Model\ArticleModel();
else
$model = JModelLegacy::getInstance('Article',
'ContentModel');
$baseItem = $model->getItem($id);
return $baseItem;
}
public function getAuthorInfo($baseItem) {
$data = array();
if ($baseItem->created_by_alias) {
$data['value'][] = urlencode($baseItem->created_by_alias);
$data['frontend_value'][] = $baseItem->created_by_alias;
} else if ($baseItem->created_by) {
$query = $this->_db->getQuery(true);
$query->select('*')
->from('#__users')
->where('id = ' . $baseItem->created_by);
$user = $this->_db->setQuery($query)->loadObject();
if ($user) {
$data['value'][] = $baseItem->created_by;
$data['frontend_value'][] = $user->name;
}
}
if (!$data) {
return;
}
if ($this->checkPublished('attr.author.value') ||
$this->checkDisplayOnFO('attr.author.value')) {
$this->attr['author'] = $data;
$this->attr['author']['frontend_value'] =
$data['frontend_value'];
$fieldconfig = $this->getFieldConfig('attr.author.value');
$this->attr['author']['title'] =
array($fieldconfig['title']);
$this->attr['author']['type'] =
$fieldconfig['type'];
}
}
public function getCategoryInfo($article_id, $catList) {
if (version_compare(JVERSION, '3.7', '<'))
return;
$query = $this->_db->getQuery(true);
$query ->select('c.*')
->from('#__categories as c')
->join('LEFT', '#__content as a ON a.catid =
c.id')
->where('a.id = ' . (int) $article_id)
->where('c.id in (' . implode(',', $catList) .
')')
->where('c.published = 1');
$this->_db->setQuery($query);
$category = $this->_db->loadObject();
if ($category) {
$categories = $this->getParentCategories($category->id,
$catList);
$cats = array();
foreach ($categories as $key => $cat) {
$tmp = new stdClass;
$tmp->id = $cat->id;
$tmp->title = $cat->title;
$rest = array_slice($categories, $key + 1);
foreach ($rest as $c) {
$tmp->title = $c->title . ' » ' .
$tmp->title;
}
$cats[] = $tmp;
}
$cdata = array();
$cdata['value'] = array();
$cdata['frontend_value'] = array();
foreach ($cats as $cat) {
if (in_array($cat->id, $cdata['value'])) {
continue;
}
$cdata['value'][] = $cat->id;
$cdata['frontend_value'][] = $cat->title;
}
if ($this->checkPublished('attr.cat.value') ||
$this->checkDisplayOnFO('attr.cat.value')) {
$this->attr['cat'] = $cdata;
$this->attr['cat']['frontend_value'] =
$cdata['frontend_value'];
$fieldconfig = $this->getFieldConfig('attr.cat.value');
$this->attr['cat']['title'] =
array($fieldconfig['title']);
$this->attr['cat']['type'] =
$fieldconfig['type'];
}
}
return $this->attr;
}
public function getParentCategories($catid, $catList) {
$db = $this->_db;
$parents = array();
while (true) {
$query = "SELECT *
FROM `#__categories`
WHERE id = $catid
AND level > 0";
$result = $db->setQuery($query)->loadObject();
if ($result && in_array($result->id, $catList)) {
$parents[] = $result;
$catid = $result->parent_id;
} else {
break;
}
}
return $parents;
}
public function getCatNameAsTree($cat, $catList) {
if (!in_array($cat->parent_id, $catList)) {
return $cat->title;
}
$query = $this->_db->getQuery(true);
$query->select('*')
->from('#__categories')
->where('id = ' . $cat->parent_id . ' and level
> 0');
$this->_db->setQuery($query);
$result = $this->_db->loadObject();
if ($result) {
$result->title = $result->title . ' » ' .
$cat->title;
return $this->getCatNameAsTree($result, $catList);
} else {
return $cat->title;
}
}
public function getCustomJFields($id, $context) {
if ($context == 'article')
$context = 'com_content.article';
else if ($context == 'contact')
$context = 'com_contact.contact';
else if ($context == 'user')
$context = 'com_users.user';
$currentLanguage = JFactory::getLanguage();
$currentTag = $currentLanguage->getTag();
$sql = 'SELECT fv.value, fg.title AS gtitle, f.title AS ftitle,
f.name
FROM #__fields_values fv
LEFT JOIN #__fields f ON fv.field_id = f.id
LEFT JOIN #__fields_groups fg ON fg.id = f.group_id
WHERE fv.item_id = '.$id.'
AND f.context = "'.$context.'"
AND f.language IN ("*",
"'.$currentTag.'")
AND f.access = 1
';
// echo $sql;
$db = JFactory::getDbo();
$db->setQuery($sql);
$result = $db->loadObjectList();
$arr = array();
foreach ($result AS $r) {
$arr[$r->name] = $r->value;
}
return $arr;
}
public function getCustomFieldsInfo($itemId, $lang)
{
if (version_compare(JVERSION, '3.7', '<'))
return;
$query = $this->_db->getQuery(true);
$query->select('f.id, f.title , fv.value, f.type, f.fieldparams,
f.params')
->from('#__fields as f')
->join('LEFT', '#__fields_values as fv ON fv.field_id
= f.id')
->join('LEFT', '#__content as c ON fv.item_id =
c.id')
->where('c.id = '. (int) $itemId);
$this->_db->setQuery($query);
$fields = $this->_db->loadObjectList();
if ($fields) {
$fdata = array();
foreach ($fields as $field) {
if (empty($field->value)) {
continue;
}
switch ($field->type) {
case 'text':
case 'editor' :
case 'textarea' :
if
(empty($fdata['ct'.$field->id]['value']))
$fdata['ct'.$field->id]['value'] =
"";
$fdata['ct'.$field->id]['value'] .=
$field->value;
$fdata['ct'.$field->id]['frontend_value'] =
$field->value;
break;
case 'url' :
if
(empty($fdata['ct'.$field->id]['value']))
$fdata['ct'.$field->id]['value'] =
"";
$fdata['ct'.$field->id]['value'] .=
$field->value;
$fdata['ct'.$field->id]['frontend_value'] =
'<a target="_blank"
href="'.$field->value.'">'.$field->value.'</a>';
break;
case 'calendar' :
$fdata['ct'.$field->id]['value'][] =
strtotime($field->value);
$fdata['ct'.$field->id]['frontend_value'][] =
strtotime($field->value);
break;
case 'integer' :
$fdata['ct'.$field->id]['value'][] =
$field->value;
$fdata['ct'.$field->id]['frontend_value'][] =
$field->value;
break;
case 'checkboxes' :
case 'radio' :
case 'list' :
case 'sql' :
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($field->value));
$name = $this->getCustomName($field->id, $field->type,
$field->value);
$fdata['ct'.$field->id]['frontend_value'][] =
$name;
break;
case 'usergrouplist' :
$gname = $this->getUserGroupName($field->value);
if ($gname) {
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($field->value));
$fdata['ct'.$field->id]['frontend_value'][] =
$gname;
}
break;
case 'user' :
if (JFactory::getUser($field->value)->id) {
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($field->value));
$fdata['ct'.$field->id]['frontend_value'][] =
JFactory::getUser($field->value)->get('name');
}
break;
case 'imagelist' :
if ($field->value == '-1')
break;
$fieldparams = json_decode($field->fieldparams);
$path = 'images/' . $fieldparams->directory .
'/';
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($path .
$field->value));
$fdata['ct'.$field->id]['frontend_value'][] =
$path . $field->value;
break;
case 'media':
$fieldparams = json_decode($field->fieldparams);
if (version_compare(JVERSION, 4, 'ge')) {
$mediaData = new JRegistry($field->value);
$urlData =
JHtml::cleanImageURL($mediaData->get('imagefile'));
$url = $urlData->url;
} else {
$url = $field->value;
}
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($url));
$fdata['ct'.$field->id]['frontend_value'][] =
$url;
break;
case 'repeatable':
// $fieldparams = json_decode($field->fieldparams);
// $values = json_decode($field->value);
// die('<pre>'.print_r($values,
1).'</pre>');
break;
default :
$fdata['ct'.$field->id]['value'][] =
str_replace('+','%20',urlencode($field->value));
$fdata['ct'.$field->id]['frontend_value'][] =
$field->value;
break;
}
}
foreach ($fdata as $k => $f) {
if ($this->checkPublished('attr.'.$k.'.value')
|| $this->checkDisplayOnFO('attr.'.$k.'.value')) {
$this->attr[$k] = $f;
$this->attr[$k]['frontend_value'] =
$f['frontend_value'];
$fieldconfig =
$this->getFieldConfig('attr.'.$k.'.value');
$this->attr[$k]['title'] =
array($fieldconfig['title']);
$this->attr[$k]['type'] =
$fieldconfig['type'];
}
}
}
return $this->attr;
}
public function getUserGroupName($groupId)
{
$query = $this->_db->getQuery(true);
$query->select('title')->from('#__usergroups')->where('id
= '. (int)$groupId);
$this->_db->setQuery($query);
return $this->_db->loadResult();
}
public function getTagInfo($tagId, $lang) {
$query = $this->_db->getQuery(true);
$query->select('id, title, parent_id')
->from('#__tags')
->where('id IN ('.$tagId. ') AND `language` IN
("*", "'.$lang.'") AND published = 1');
$this->_db->setQuery($query);
$tags = $this->_db->loadObjectList();
if ($tags) {
$tdata = array();
foreach ($tags as $tag) {
$tdata['value'][] = $tag->id;
$tdata['frontend_value'][] = $this->getTagTreeName($tag);
}
if ($this->checkPublished('attr.tag.value') ||
$this->checkDisplayOnFO('attr.tag.value')) {
$this->attr['tag'] = $tdata;
$this->attr['tag']['frontend_value'] =
$tdata['frontend_value'];
$fieldconfig = $this->getFieldConfig('attr.tag.value');
$this->attr['tag']['title'] =
array($fieldconfig['title']);
$this->attr['tag']['type'] =
$fieldconfig['type'];
}
}
return $this->attr;
}
public function getTagTreeName($tag) {
$q = 'SELECT * FROM `#__tags` WHERE id = ' . $tag->parent_id
. ' AND id > 1';
$db = JFactory::getDbo()->setQuery($q);
$result = $db->loadObject();
if ($result) {
$result->title = $result->title . ' » ' .
$tag->title;
return $this->getTagTreeName($result);
} else {
return $tag->title;
}
}
public function getCustomFields()
{
if (version_compare(JVERSION, '3.7', '<'))
return;
$query = $this->_db->getQuery(true);
$query->select('*')->from('#__fields')->where('context
= "com_content.article" AND state = 1');
$this->_db->setQuery($query);
$fields = $this->_db->loadObjectList();
return $fields;
}
public function getCustomName($field_id, $field_type, $field_value)
{
$query = $this->_db->getQuery(true);
$query->select('fieldparams')
->from('#__fields')
->where('id = '. (int) $field_id);
$this->_db->setQuery($query);
$fparams = $this->_db->loadResult();
if ($fparams) {
$registry = new Registry;
$registry->loadString($fparams);
$fparams = $registry->toArray();
switch ($field_type) {
case 'sql' :
$q = $fparams['query'];
if (!empty($q)) {
$this->_db->setQuery($q);
$results = $this->_db->loadObjectList();
if ($results) {
foreach ($results as $r) {
if ($r->value == $field_value)
return $r->text;
}
}
}
break;
default :
if (!empty($fparams['options'])) {
foreach ($fparams['options'] as $option) {
if ($option['value'] == $field_value) {
return $option['name'];
}
}
}
break;
}
}
}
// copy from helper.php. if change this need to change there too.
public function getChildCategories($catid = 1, $maxLevel = 100, $level =
0, $ordering = 'rgt ASC')
{
$level++;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*')
->from('#__categories')
->where('parent_id = '. (int)$catid)
->where('extension IN ("com_reservation",
"system")')
->where('published = 1')
->order($ordering);
$db->setQuery($query);
$children = $db->loadObjectList();
$cats = array();
foreach ($children as $child) {
$cats[] = $child;
if ($level < $maxLevel) {
foreach ($this->getChildCategories($child->id, $maxLevel, $level,
$ordering) as $c) {
$cats[] = $c;
}
}
}
return $cats;
}
}
home/lmsyaran/public_html/j3/modules/mod_related_items/helper.php000064400000010304151162002770021257
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_related_items
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('ContentHelperRoute', JPATH_SITE .
'/components/com_content/helpers/route.php');
/**
* Helper for mod_related_items
*
* @since 1.5
*/
abstract class ModRelatedItemsHelper
{
/**
* Get a list of related articles
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function getList(&$params)
{
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
$date = JFactory::getDate();
$maximum = (int) $params->get('maximum', 5);
// Get an instance of the generic articles model
JModelLegacy::addIncludePath(JPATH_SITE .
'/components/com_content/models');
$articles = JModelLegacy::getInstance('Articles',
'ContentModel', array('ignore_request' => true));
if ($articles === false)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
return array();
}
// Set application parameters in model
$appParams = $app->getParams();
$articles->setState('params', $appParams);
$option = $app->input->get('option');
$view = $app->input->get('view');
if (!($option === 'com_content' && $view ===
'article'))
{
return array();
}
$temp = $app->input->getString('id');
$temp = explode(':', $temp);
$id = $temp[0];
$nullDate = $db->getNullDate();
$now = $date->toSql();
$related = array();
$query = $db->getQuery(true);
if ($id)
{
// Select the meta keywords from the item
$query->select('metakey')
->from('#__content')
->where('id = ' . (int) $id);
$db->setQuery($query);
try
{
$metakey = trim($db->loadResult());
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
return array();
}
// Explode the meta keys on a comma
$keys = explode(',', $metakey);
$likes = array();
// Assemble any non-blank word(s)
foreach ($keys as $key)
{
$key = trim($key);
if ($key)
{
$likes[] = $db->escape($key);
}
}
if (count($likes))
{
// Select other items based on the metakey field 'like' the
keys found
$query->clear()
->select('a.id')
->from('#__content AS a')
->where('a.id != ' . (int) $id)
->where('a.state = 1')
->where('a.access IN (' . $groups . ')');
$wheres = array();
foreach ($likes as $keyword)
{
$wheres[] = 'a.metakey LIKE ' . $db->quote('%'
. $keyword . '%');
}
$query->where('(' . implode(' OR ', $wheres) .
')')
->where('(a.publish_up = ' . $db->quote($nullDate) .
' OR a.publish_up <= ' . $db->quote($now) . ')')
->where('(a.publish_down = ' . $db->quote($nullDate) .
' OR a.publish_down >= ' . $db->quote($now) .
')');
// Filter by language
if (JLanguageMultilang::isEnabled())
{
$query->where('a.language in (' .
$db->quote(JFactory::getLanguage()->getTag()) . ',' .
$db->quote('*') . ')');
}
$db->setQuery($query, 0, $maximum);
try
{
$articleIds = $db->loadColumn();
}
catch (RuntimeException $e)
{
JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');
return array();
}
if (count($articleIds))
{
$articles->setState('filter.article_id', $articleIds);
$articles->setState('filter.published', 1);
$related = $articles->getItems();
}
unset($articleIds);
}
}
if (count($related))
{
// Prepare data for display using display options
foreach ($related as &$item)
{
$item->slug = $item->id . ':' . $item->alias;
/** @deprecated Catslug is deprecated, use catid instead. 4.0 */
$item->catslug = $item->catid . ':' .
$item->category_alias;
$item->route =
JRoute::_(ContentHelperRoute::getArticleRoute($item->slug,
$item->catid, $item->language));
}
}
return $related;
}
}
home/lmsyaran/public_html/j3/modules/mod_breadcrumbs/helper.php000064400000004600151162025370020732
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_breadcrumbs
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_breadcrumbs
*
* @since 1.5
*/
class ModBreadCrumbsHelper
{
/**
* Retrieve breadcrumb items
*
* @param \Joomla\Registry\Registry &$params module parameters
*
* @return array
*/
public static function getList(&$params)
{
// Get the PathWay object from the application
$app = JFactory::getApplication();
$pathway = $app->getPathway();
$items = $pathway->getPathWay();
$lang = JFactory::getLanguage();
$menu = $app->getMenu();
// Look for the home menu
if (JLanguageMultilang::isEnabled())
{
$home = $menu->getDefault($lang->getTag());
}
else
{
$home = $menu->getDefault();
}
$count = count($items);
// Don't use $items here as it references JPathway properties
directly
$crumbs = array();
for ($i = 0; $i < $count; $i ++)
{
$crumbs[$i] = new stdClass;
$crumbs[$i]->name =
stripslashes(htmlspecialchars($items[$i]->name, ENT_COMPAT,
'UTF-8'));
$crumbs[$i]->link = JRoute::_($items[$i]->link);
}
if ($params->get('showHome', 1))
{
$item = new stdClass;
$item->name = htmlspecialchars($params->get('homeText',
JText::_('MOD_BREADCRUMBS_HOME')), ENT_COMPAT,
'UTF-8');
$item->link = JRoute::_('index.php?Itemid=' .
$home->id);
array_unshift($crumbs, $item);
}
return $crumbs;
}
/**
* Set the breadcrumbs separator for the breadcrumbs display.
*
* @param string $custom Custom xhtml compliant string to separate the
items of the breadcrumbs
*
* @return string Separator string
*
* @since 1.5
*/
public static function setSeparator($custom = null)
{
$lang = JFactory::getLanguage();
// If a custom separator has not been provided we try to load a template
// specific one first, and if that is not present we load the default
separator
if ($custom === null)
{
if ($lang->isRtl())
{
$_separator = JHtml::_('image',
'system/arrow_rtl.png', null, null, true);
}
else
{
$_separator = JHtml::_('image', 'system/arrow.png',
null, null, true);
}
}
else
{
$_separator = htmlspecialchars($custom, ENT_COMPAT,
'UTF-8');
}
return $_separator;
}
}
home/lmsyaran/public_html/j3/modules/mod_chatters/helper.php000064400000007234151162314200020255
0ustar00<?php
class ModChattersHelper
{
public static function getChatters($params,$userid)
{
$db= JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__reservation_sick'))
->where($db->quoteName('userid').'='.$userid);
$db->setQuery($query);
$res= $db->loadResult();
if ($res)
{
$group= 'sick';
$join= 'co.userid';
$where= 'si.userid';
}
else
{
$group= 'consultant';
$join= 'si.userid';
$where= 'co.userid';
}
$db= JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName(array('u.id','u.name','p.id','se.pay','p.price','se.created','se.id','se.finish'),array('uid','name','pid','pay','price','created','seid','finish')))
->from($db->quoteName('#__reservation_session','se'))
->join('INNER',$db->quoteName('#__reservation_sick','si').'on
('.$db->quoteName('se.sickid').'='.$db->quoteName('si.id').')')
->join('INNER',$db->quoteName('#__reservation_plan','p').'on
('.$db->quoteName('se.planid').'='.$db->quoteName('p.id').')')
->join('INNER',$db->quoteName('#__reservation_consultant','co').'on
('.$db->quoteName('p.consultantid').'='.$db->quoteName('co.id').')')
->join('INNER',$db->quoteName('#__users','u').'on
('.$db->quoteName($join).'='.$db->quoteName('u.id').')')
->where($db->quoteName($where).'='.$userid)
->where($db->quoteName('se.pay').'=1');
$db->setQuery($query);
$res= $db->loadObjectList();
$seidList=[];
foreach ($res as $item) {
$seidList[]= $item->seid;
}
$lastMessage= self::getLastMessage($seidList);
$db= JFactory::getDbo();
$query= $db->getQuery(true)
->select($db->quoteName(array('id','seid','token')))
->from($db->quoteName('#__reservation_comment','cm'));
$db->setQuery($query);
$res2 = $db->loadAssocList('seid');
$messageCount= self::getMessageCount($userid);
return [$res,$res2,$group, $messageCount, $lastMessage];
}
public function getMessageCount($userid)
{
$db= JFactory::getDbo();
$query= $db->getQuery(true)
->select('m.from as sender , m.to as receiver, m.seid
as seid, count(m.from) as count, m.message as message')
->from($db->quoteName('#__reservation_message','m'))
->where($db->quoteName('m.to').'='.
$db->quote($userid))
->where($db->quoteName('m.read').'=
0')
->group('sender, receiver, seid');
$db->setQuery($query);
$result = $db->loadObjectList('sender');
return $result;
}
public function getLastMessage($seidList)
{
if (empty($seidList))
return [];
$db= JFactory::getDbo();
$subQuery = $db->getQuery(true);
$subQuery->select('max(id)')
->from($db->quoteName('#__reservation_message','m'))
->where($db->quoteName('m.seid') . '
IN('.implode(',',$seidList).')' )
->group('m.seid');
$query= $db->getQuery(true)
->select('m.seid as seid , m.message as message')
->from($db->quoteName('#__reservation_message','m'))
->where($db->quoteName('m.id').'IN('.$subQuery.')');
$db->setQuery($query);
$result = $db->loadObjectList('seid');
return $result;
}
}home/lmsyaran/public_html/j3/modules/mod_languages/helper.php000064400000007746151162760260020431
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage mod_languages
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR .
'/components/com_menus/helpers/menus.php');
/**
* Helper for mod_languages
*
* @since 1.6
*/
abstract class ModLanguagesHelper
{
/**
* Gets a list of available languages
*
* @param \Joomla\Registry\Registry &$params module params
*
* @return array
*/
public static function getList(&$params)
{
$user = JFactory::getUser();
$lang = JFactory::getLanguage();
$languages = JLanguageHelper::getLanguages();
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
// Get menu home items
$homes = array();
$homes['*'] = $menu->getDefault('*');
foreach ($languages as $item)
{
$default = $menu->getDefault($item->lang_code);
if ($default && $default->language === $item->lang_code)
{
$homes[$item->lang_code] = $default;
}
}
// Load associations
$assoc = JLanguageAssociations::isEnabled();
if ($assoc)
{
if ($active)
{
$associations = MenusHelper::getAssociations($active->id);
}
// Load component associations
$option = $app->input->get('option');
$class = ucfirst(str_replace('com_', '', $option)) .
'HelperAssociation';
\JLoader::register($class, JPATH_SITE . '/components/' .
$option . '/helpers/association.php');
if (class_exists($class) && is_callable(array($class,
'getAssociations')))
{
$cassociations = call_user_func(array($class,
'getAssociations'));
}
}
$levels = $user->getAuthorisedViewLevels();
$sitelangs = JLanguageHelper::getInstalledLanguages(0);
$multilang = JLanguageMultilang::isEnabled();
// Filter allowed languages
foreach ($languages as $i => &$language)
{
// Do not display language without frontend UI
if (!array_key_exists($language->lang_code, $sitelangs))
{
unset($languages[$i]);
}
// Do not display language without specific home menu
elseif (!isset($homes[$language->lang_code]))
{
unset($languages[$i]);
}
// Do not display language without authorized access level
elseif (isset($language->access) && $language->access
&& !in_array($language->access, $levels))
{
unset($languages[$i]);
}
else
{
$language->active = ($language->lang_code ===
$lang->getTag());
// Fetch language rtl
// If loaded language get from current JLanguage metadata
if ($language->active)
{
$language->rtl = $lang->isRtl();
}
// If not loaded language fetch metadata directly for performance
else
{
$languageMetadata =
JLanguageHelper::getMetadata($language->lang_code);
$language->rtl = $languageMetadata['rtl'];
}
if ($multilang)
{
if (isset($cassociations[$language->lang_code]))
{
$language->link =
JRoute::_($cassociations[$language->lang_code] . '&lang='
. $language->sef);
}
elseif (isset($associations[$language->lang_code]) &&
$menu->getItem($associations[$language->lang_code]))
{
$itemid = $associations[$language->lang_code];
$language->link = JRoute::_('index.php?lang=' .
$language->sef . '&Itemid=' . $itemid);
}
elseif ($active && $active->language == '*')
{
$language->link = JRoute::_('index.php?lang=' .
$language->sef . '&Itemid=' . $active->id);
}
else
{
if ($language->active)
{
$language->link =
JUri::getInstance()->toString(array('path',
'query'));
}
else
{
$itemid = isset($homes[$language->lang_code]) ?
$homes[$language->lang_code]->id : $homes['*']->id;
$language->link = JRoute::_('index.php?lang=' .
$language->sef . '&Itemid=' . $itemid);
}
}
}
else
{
$language->link = JRoute::_('&Itemid=' .
$homes['*']->id);
}
}
}
return $languages;
}
}
home/lmsyaran/public_html/j3/administrator/modules/mod_feed/helper.php000064400000001753151166614470022243
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_feed
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_feed
*
* @since 1.5
*/
class ModFeedHelper
{
/**
* Method to load a feed.
*
* @param JRegisty $params The parameters object.
*
* @return JFeedReader|string Return a JFeedReader object or a string
message if error.
*
* @since 1.5
*/
public static function getFeed($params)
{
// Module params
$rssurl = $params->get('rssurl', '');
// Get RSS parsed object
try
{
jimport('joomla.feed.factory');
$feed = new JFeedFactory;
$rssDoc = $feed->getFeed($rssurl);
}
catch (Exception $e)
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
if (empty($rssDoc))
{
return JText::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED');
}
return $rssDoc;
}
}
home/lmsyaran/public_html/j3/administrator/modules/mod_menu/helper.php000064400000003023151166662200022266
0ustar00<?php
/**
* @package Joomla.Administrator
* @subpackage mod_menu
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see
LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Helper for mod_menu
*
* @since 1.5
*/
abstract class ModMenuHelper
{
/**
* Get a list of the available menus.
*
* @return array An array of the available menus (from the menu types
table).
*
* @since 1.6
*/
public static function getMenus()
{
$db = JFactory::getDbo();
// Search for home menu and language if exists
$subQuery = $db->getQuery(true)
->select('b.menutype, b.home, b.language, l.image, l.sef,
l.title_native')
->from('#__menu AS b')
->leftJoin('#__languages AS l ON l.lang_code = b.language')
->where('b.home != 0')
->where('(b.client_id = 0 OR b.client_id IS NULL)');
// Get all menu types with optional home menu and language
$query = $db->getQuery(true)
->select('a.id, a.asset_id, a.menutype, a.title, a.description,
a.client_id')
->select('c.home, c.language, c.image, c.sef,
c.title_native')
->from('#__menu_types AS a')
->leftJoin('(' . (string) $subQuery . ') c ON
c.menutype = a.menutype')
->order('a.id');
$db->setQuery($query);
try
{
$result = $db->loadObjectList();
}
catch (RuntimeException $e)
{
$result = array();
JFactory::getApplication()->enqueueMessage(JText::sprintf('JERROR_LOADING_MENUS',
$e->getMessage()), 'error');
}
return $result;
}
}