Spade

Mini Shell

Directory:~$ /proc/self/root/home/lmsyaran/public_html/css/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/home/lmsyaran/public_html/css/helper.php.tar

home/lmsyaran/public_html/modules/mod_articles_latest/helper.php000064400000007373151165260300021316
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_articles_latest
 *
 * @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');

JModelLegacy::addIncludePath(JPATH_SITE .
'/components/com_content/models', 'ContentModel');

use Joomla\Utilities\ArrayHelper;

/**
 * Helper for mod_articles_latest
 *
 * @since  1.6
 */
abstract class ModArticlesLatestHelper
{
	/**
	 * Retrieve a list of article
	 *
	 * @param   \Joomla\Registry\Registry  &$params  module parameters
	 *
	 * @return  mixed
	 *
	 * @since   1.6
	 */
	public static function getList(&$params)
	{
		// Get the dbo
		$db = JFactory::getDbo();

		// Get an instance of the generic articles model
		$model = JModelLegacy::getInstance('Articles',
'ContentModel', array('ignore_request' => true));

		// Set application parameters in model
		$app       = JFactory::getApplication();
		$appParams = $app->getParams();
		$model->setState('params', $appParams);

		$model->setState('list.start', 0);
		$model->setState('filter.published', 1);

		// Set the filters based on the module params
		$model->setState('list.limit', (int)
$params->get('count', 5));

		// This module does not use tags data
		$model->setState('load_tags', false);

		// Access filter
		$access     =
!JComponentHelper::getParams('com_content')->get('show_noauth');
		$authorised =
JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
		$model->setState('filter.access', $access);

		// Category filter
		$model->setState('filter.category_id',
$params->get('catid', array()));

		// User filter
		$userId = JFactory::getUser()->get('id');

		switch ($params->get('user_id'))
		{
			case 'by_me' :
				$model->setState('filter.author_id', (int) $userId);
				break;
			case 'not_me' :
				$model->setState('filter.author_id', $userId);
				$model->setState('filter.author_id.include', false);
				break;

			case 'created_by' :
				$model->setState('filter.author_id',
$params->get('author', array()));
				break;

			case '0' :
				break;

			default:
				$model->setState('filter.author_id', (int)
$params->get('user_id'));
				break;
		}

		// Filter by language
		$model->setState('filter.language',
$app->getLanguageFilter());

		// Featured switch
		$featured = $params->get('show_featured', '');

		if ($featured === '')
		{
			$model->setState('filter.featured', 'show');
		}
		elseif ($featured)
		{
			$model->setState('filter.featured', 'only');
		}
		else
		{
			$model->setState('filter.featured', 'hide');
		}

		// Set ordering
		$order_map = array(
			'm_dsc' => 'a.modified DESC, a.created',
			'mc_dsc' => 'CASE WHEN (a.modified = ' .
$db->quote($db->getNullDate()) . ') THEN a.created ELSE
a.modified END',
			'c_dsc' => 'a.created',
			'p_dsc' => 'a.publish_up',
			'random' => $db->getQuery(true)->Rand(),
		);

		$ordering = ArrayHelper::getValue($order_map,
$params->get('ordering'), 'a.publish_up');
		$dir      = 'DESC';

		$model->setState('list.ordering', $ordering);
		$model->setState('list.direction', $dir);

		$items = $model->getItems();

		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
			{
				$item->link =
JRoute::_('index.php?option=com_users&view=login');
			}
		}

		return $items;
	}
}
home/lmsyaran/public_html/modules/mod_users_latest/helper.php000064400000003000151165447620020644
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_users_latest
 *
 * @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_users_latest
 *
 * @since  1.6
 */
class ModUsersLatestHelper
{
	/**
	 * Get users sorted by activation date
	 *
	 * @param   \Joomla\Registry\Registry  $params  module parameters
	 *
	 * @return  array  The array of users
	 *
	 * @since   1.6
	 */
	public static function getUsers($params)
	{
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select($db->quoteName(array('a.id',
'a.name', 'a.username', 'a.registerDate')))
			->order($db->quoteName('a.registerDate') . '
DESC')
			->from('#__users AS a');
		$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.id')
				->join('LEFT', '#__usergroups AS ug ON ug.id =
m.group_id')
				->where('ug.id in (' . implode(',', $groups) .
')')
				->where('ug.id <> 1');
		}

		$db->setQuery($query, 0, $params->get('shownumber', 5));

		try
		{
			return (array) $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'),
'error');

			return array();
		}
	}
}
home/lmsyaran/public_html/modules/mod_articles_category/helper.php000064400000034757151165506150021653
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/administrator/includes/helper.php000064400000001754151166065120020314
0ustar00<?php
/**
 * @package    Joomla.Administrator
 *
 * @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;

/**
 * Joomla! Administrator Application helper class.
 * Provide many supporting API functions.
 *
 * @since       1.5
 *
 * @deprecated  4.0 Deprecated without replacement
 */
class JAdministratorHelper
{
	/**
	 * Return the application option string [main component].
	 *
	 * @return  string  The component to access.
	 *
	 * @since   1.5
	 */
	public static function findOption()
	{
		$app = JFactory::getApplication();
		$option = strtolower($app->input->get('option'));

		$app->loadIdentity();
		$user = $app->getIdentity();

		if ($user->get('guest') ||
!$user->authorise('core.login.admin'))
		{
			$option = 'com_login';
		}

		if (empty($option))
		{
			$option = 'com_cpanel';
		}

		$app->input->set('option', $option);

		return $option;
	}
}
home/lmsyaran/public_html/modules/mod_syndicate/helper.php000064400000001515151166410700020111
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_syndicate
 *
 * @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\Utilities\ArrayHelper;

/**
 * Helper for mod_syndicate
 *
 * @since  1.5
 */
class ModSyndicateHelper
{
	/**
	 * Gets the link
	 *
	 * @param   \Joomla\Registry\Registry  &$params  module parameters
	 *
	 * @return  array  The link as a string
	 *
	 * @since   1.5
	 */
	public static function getLink(&$params)
	{
		$document = JFactory::getDocument();

		foreach ($document->_links as $link => $value)
		{
			$value = ArrayHelper::toString($value);

			if (strpos($value, 'application/' .
$params->get('format') . '+xml'))
			{
				return $link;
			}
		}
	}
}
home/lmsyaran/public_html/modules/mod_consultants/helper.php000064400000007170151166547530020522
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/joomla35/modules/mod_menu/helper.php000064400000014531151172262470020533
0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  mod_menu
 *
 * @copyright   (C) 2009 Open Source Matters, Inc.
<https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see
LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * 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/libraries/regularlabs/helpers/helper.php000064400000003406151172267560022070
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);
	}
}