Spade
Mini Shell
home/lmsyaran/public_html/components/com_content/router.php000064400000015322151167475650020376
0ustar00<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @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;
/**
* Routing class of com_content
*
* @since 3.3
*/
class ContentRouter extends JComponentRouterView
{
protected $noIDs = false;
/**
* Content Component router constructor
*
* @param JApplicationCms $app The application object
* @param JMenu $menu The menu object to work with
*/
public function __construct($app = null, $menu = null)
{
$params = JComponentHelper::getParams('com_content');
$this->noIDs = (bool) $params->get('sef_ids');
$categories = new
JComponentRouterViewconfiguration('categories');
$categories->setKey('id');
$this->registerView($categories);
$category = new JComponentRouterViewconfiguration('category');
$category->setKey('id')->setParent($categories,
'catid')->setNestable()->addLayout('blog');
$this->registerView($category);
$article = new JComponentRouterViewconfiguration('article');
$article->setKey('id')->setParent($category,
'catid');
$this->registerView($article);
$this->registerView(new
JComponentRouterViewconfiguration('archive'));
$this->registerView(new
JComponentRouterViewconfiguration('featured'));
$form = new JComponentRouterViewconfiguration('form');
$form->setKey('a_id');
$this->registerView($form);
parent::__construct($app, $menu);
$this->attachRule(new JComponentRouterRulesMenu($this));
if ($params->get('sef_advanced', 0))
{
$this->attachRule(new JComponentRouterRulesStandard($this));
$this->attachRule(new JComponentRouterRulesNomenu($this));
}
else
{
JLoader::register('ContentRouterRulesLegacy', __DIR__ .
'/helpers/legacyrouter.php');
$this->attachRule(new ContentRouterRulesLegacy($this));
}
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategorySegment($id, $query)
{
$category = JCategories::getInstance($this->getName())->get($id);
if ($category)
{
$path = array_reverse($category->getPath(), true);
$path[0] = '1:root';
if ($this->noIDs)
{
foreach ($path as &$segment)
{
list($id, $segment) = explode(':', $segment, 2);
}
}
return $path;
}
return array();
}
/**
* Method to get the segment(s) for a category
*
* @param string $id ID of the category to retrieve the segments
for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getCategoriesSegment($id, $query)
{
return $this->getCategorySegment($id, $query);
}
/**
* Method to get the segment(s) for an article
*
* @param string $id ID of the article to retrieve the segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*/
public function getArticleSegment($id, $query)
{
if (!strpos($id, ':'))
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('alias'))
->from($dbquery->qn('#__content'))
->where('id = ' . $dbquery->q($id));
$db->setQuery($dbquery);
$id .= ':' . $db->loadResult();
}
if ($this->noIDs)
{
list($void, $segment) = explode(':', $id, 2);
return array($void => $segment);
}
return array((int) $id => $id);
}
/**
* Method to get the segment(s) for a form
*
* @param string $id ID of the article form to retrieve the
segments for
* @param array $query The request that is built right now
*
* @return array|string The segments of this item
*
* @since 3.7.3
*/
public function getFormSegment($id, $query)
{
return $this->getArticleSegment($id, $query);
}
/**
* Method to get the id for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoryId($segment, $query)
{
if (isset($query['id']))
{
$category = JCategories::getInstance($this->getName(),
array('access' => false))->get($query['id']);
if ($category)
{
foreach ($category->getChildren() as $child)
{
if ($this->noIDs)
{
if ($child->alias == $segment)
{
return $child->id;
}
}
else
{
if ($child->id == (int) $segment)
{
return $child->id;
}
}
}
}
}
return false;
}
/**
* Method to get the segment(s) for a category
*
* @param string $segment Segment to retrieve the ID for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getCategoriesId($segment, $query)
{
return $this->getCategoryId($segment, $query);
}
/**
* Method to get the segment(s) for an article
*
* @param string $segment Segment of the article to retrieve the ID
for
* @param array $query The request that is parsed right now
*
* @return mixed The id of this item or false
*/
public function getArticleId($segment, $query)
{
if ($this->noIDs)
{
$db = JFactory::getDbo();
$dbquery = $db->getQuery(true);
$dbquery->select($dbquery->qn('id'))
->from($dbquery->qn('#__content'))
->where('alias = ' . $dbquery->q($segment))
->where('catid = ' .
$dbquery->q($query['id']));
$db->setQuery($dbquery);
return (int) $db->loadResult();
}
return (int) $segment;
}
}
/**
* Content router functions
*
* These functions are proxys for the new router interface
* for old SEF extensions.
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent URL.
*
* @deprecated 4.0 Use Class based routers instead
*/
function contentBuildRoute(&$query)
{
$app = JFactory::getApplication();
$router = new ContentRouter($app, $app->getMenu());
return $router->build($query);
}
/**
* Parse the segments of a URL.
*
* This function is a proxy for the new router interface
* for old SEF extensions.
*
* @param array $segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
* @deprecated 4.0 Use Class based routers instead
*/
function contentParseRoute($segments)
{
$app = JFactory::getApplication();
$router = new ContentRouter($app, $app->getMenu());
return $router->parse($segments);
}
home/lmsyaran/public_html/components/com_reservation/router.php000064400000025357151170503560021260
0ustar00<?php
/*----------------------------------------------------------------------------------|
www.vdm.io |----/
fdsh
/-------------------------------------------------------------------------------------------------------/
@version 1.0.39
@build 4th April, 2023
@created 17th December, 2020
@package Reservation
@subpackage router.php
@author farhad shahbazi <http://farhad.com>
@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');
/**
* Routing class from com_reservation
*
* @since 3.3
*/
class ReservationRouter extends JComponentRouterBase
{
/**
* Build the route for the com_reservation component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_reservation');
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
}
else
{
$menuItem = $this->menu->getItem($query['Itemid']);
}
$mView = (empty($menuItem->query['view'])) ? null :
$menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null :
$menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']))
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a item that is attached to a menu item?
if (isset($view) && ($mView == $view) and
(isset($query['id'])) and ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
unset($query['id']);
return $segments;
}
if (isset($view) && isset($query['id']) &&
($view === 'plan' || $view === 'messages' || $view ===
'consultantitem' || $view === 'usersign' || $view ===
'payment' || $view === 'firstqst' || $view ===
'consultantsignup' || $view === 'comment' || $view ===
'doctors' || $view === 'doctorsignup' || $view ===
'doctor' || $view === 'reserve_appointment' || $view
=== 'consultant_plan' || $view === 'login' || $view ===
'res_list'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if (($view === 'plan' || $view === 'messages' ||
$view === 'consultantitem' || $view === 'usersign' ||
$view === 'payment' || $view === 'firstqst' || $view
=== 'consultantsignup' || $view === 'comment' || $view
=== 'doctors' || $view === 'doctorsignup' || $view ===
'doctor' || $view === 'reserve_appointment' || $view
=== 'consultant_plan' || $view === 'login' || $view ===
'res_list'))
{
$segments[] = $view;
$id = explode(':', $query['id']);
if (count($id) == 2)
{
$segments[] = $id[1];
}
else
{
$segments[] = $id[0];
}
}
}
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$count = count($segments);
$vars = array();
//Handle View and Identifier
switch($segments[0])
{
case 'plan':
$vars['view'] = 'plan';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
break;
case 'messages':
$vars['view'] = 'messages';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultantitem':
$vars['view'] = 'consultantitem';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'usersign':
$vars['view'] = 'usersign';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('usersign', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'payment':
$vars['view'] = 'payment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('payment', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'firstqst':
$vars['view'] = 'firstqst';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultantsignup':
$vars['view'] = 'consultantsignup';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultantsignup',
$segments[$count-1], 'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'comment':
$vars['view'] = 'comment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctors':
$vars['view'] = 'doctors';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctorsignup':
$vars['view'] = 'doctorsignup';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('doctorsignup', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctor':
$vars['view'] = 'doctor';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'reserve_appointment':
$vars['view'] = 'reserve_appointment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultant_plan':
$vars['view'] = 'consultant_plan';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'login':
$vars['view'] = 'login';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('login', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'res_list':
$vars['view'] = 'res_list';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
}
return $vars;
}
protected function getVar($table, $where = null, $whereString = null,
$what = null, $category = false, $operator = '=', $main =
'reservation')
{
if(!$where || !$what || !$whereString)
{
return false;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table ||
$category)
{
$getTable = '#__categories';
$query->from($db->quoteName($getTable));
// we need this to target the components categories (TODO will keep an
eye on this)
$query->where($db->quoteName('extension') . ' LIKE
'. $db->quote((string)'com_' . $main . '%'));
}
else
{
// we must check if the table exist (TODO not ideal)
$tables = $db->getTableList();
$app = JFactory::getApplication();
$prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table;
if (in_array($check, $tables))
{
$getTable = '#__'.$main.'_'.$table;
$query->from($db->quoteName($getTable));
}
else
{
return false;
}
}
if (is_numeric($where))
{
return false;
}
elseif ($this->checkString($where))
{
// we must first check if this table has the column
$columns = $db->getTableColumns($getTable);
if (isset($columns[$whereString]))
{
$query->where($db->quoteName($whereString) . '
'.$operator.' '. $db->quote((string)$where));
}
else
{
return false;
}
}
else
{
return false;
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
protected function checkString($string)
{
if (isset($string) && is_string($string) &&
strlen($string) > 0)
{
return true;
}
return false;
}
}
function ReservationBuildRoute(&$query)
{
$router = new ReservationRouter;
return $router->build($query);
}
function ReservationParseRoute($segments)
{
$router = new ReservationRouter;
return $router->parse($segments);
}home/lmsyaran/public_html/libraries/joomla/application/web/router.php000064400000007564151171030300022175
0ustar00<?php
/**
* @package Joomla.Platform
* @subpackage Application
*
* @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All
rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
/**
* Class to define an abstract Web application router.
*
* @since 3.0
* @deprecated 4.0 Use the `joomla/router` package via Composer instead
*/
abstract class JApplicationWebRouter
{
/**
* @var JApplicationWeb The web application on whose behalf we are
routing the request.
* @since 3.0
*/
protected $app;
/**
* @var string The default page controller name for an empty route.
* @since 3.0
*/
protected $default;
/**
* @var string Controller class name prefix for creating controller
objects by name.
* @since 3.0
*/
protected $controllerPrefix;
/**
* @var JInput An input object from which to derive the route.
* @since 3.0
*/
protected $input;
/**
* Constructor.
*
* @param JApplicationWeb $app The web application on whose behalf
we are routing the request.
* @param JInput $input An optional input object from which
to derive the route. If none
* is given than the input from the
application object will be used.
*
* @since 3.0
*/
public function __construct(JApplicationWeb $app, JInput $input = null)
{
$this->app = $app;
$this->input = ($input === null) ? $this->app->input : $input;
}
/**
* Find and execute the appropriate controller based on a given route.
*
* @param string $route The route string for which to find and execute
a controller.
*
* @return mixed The return value of the controller executed
*
* @since 3.0
* @throws InvalidArgumentException
* @throws RuntimeException
*/
public function execute($route)
{
// Get the controller name based on the route patterns and requested
route.
$name = $this->parseRoute($route);
// Get the controller object by name.
$controller = $this->fetchController($name);
// Execute the controller.
return $controller->execute();
}
/**
* Set the controller name prefix.
*
* @param string $prefix Controller class name prefix for creating
controller objects by name.
*
* @return JApplicationWebRouter This object for method chaining.
*
* @since 3.0
*/
public function setControllerPrefix($prefix)
{
$this->controllerPrefix = (string) $prefix;
return $this;
}
/**
* Set the default controller name.
*
* @param string $name The default page controller name for an empty
route.
*
* @return JApplicationWebRouter This object for method chaining.
*
* @since 3.0
*/
public function setDefaultController($name)
{
$this->default = (string) $name;
return $this;
}
/**
* Parse the given route and return the name of a controller mapped to the
given route.
*
* @param string $route The route string for which to find and execute
a controller.
*
* @return string The controller name for the given route excluding
prefix.
*
* @since 3.0
* @throws InvalidArgumentException
*/
abstract protected function parseRoute($route);
/**
* Get a JController object for a given name.
*
* @param string $name The controller name (excluding prefix) for
which to fetch and instance.
*
* @return JController
*
* @since 3.0
* @throws RuntimeException
*/
protected function fetchController($name)
{
// Derive the controller class name.
$class = $this->controllerPrefix . ucfirst($name);
// If the controller class does not exist panic.
if (!class_exists($class) || !is_subclass_of($class,
'JController'))
{
throw new RuntimeException(sprintf('Unable to locate controller
`%s`.', $class), 404);
}
// Instantiate the controller.
$controller = new $class($this->input, $this->app);
return $controller;
}
}
home/lmsyaran/public_html/components/com_rsticketspro/router.php000064400000022451151171636540021451
0ustar00<?php
/**
* @package RSTickets! Pro
*
* @copyright (c) 2010 - 2016 RSJoomla!
* @link https://www.rsjoomla.com
* @license GNU General Public License
http://www.gnu.org/licenses/gpl-3.0.en.html
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
class RsticketsproRouter extends JComponentRouterBase
{
public function preprocess($query)
{
if (!isset($query['Itemid']))
{
if ($item = JFactory::getApplication()->getMenu()->getActive())
{
$query['Itemid'] = $item->id;
}
}
return $query;
}
public function build(&$query)
{
JFactory::getLanguage()->load('com_rsticketspro',
JPATH_SITE);
$segments = array();
// get a menu item based on Itemid or currently active
$menu = JFactory::getApplication()->getMenu();
if (!empty($query['Itemid']) && $item =
$menu->getItem($query['Itemid']))
{
if (isset($item->query['view']) &&
isset($query['view']) &&
$item->query['view'] == $query['view'] &&
!isset($query['cid']) &&
!isset($query['layout']))
{
unset($query['view']);
return $segments;
}
}
if (!empty($query['view']))
{
switch ($query['view'])
{
case 'tickets':
$segments[] = JText::_('RST_SEF_TICKETS');
break;
case 'predefinedsearches':
$segments[] = JText::_('RST_SEF_SEARCHES');
break;
case 'users':
$segments[] = JText::_('RST_SEF_SELECT_USER_FROM_LIST');
break;
case 'submit':
$segments[] = JText::_('RST_SEF_SUBMIT_TICKET');
break;
case 'dashboard':
$segments[] = JText::_('RST_SEF_DASHBOARD');
break;
case 'predefinedsearch':
if (!empty($query['id']))
{
$segments[] = JText::_('RST_SEF_EDIT_PREDEFINED_SEARCH');
$segments[] = $query['id'];
unset($query['id']);
}
else
{
$segments[] = JText::_('RST_SEF_NEW_PREDEFINED_SEARCH');
}
break;
case 'knowledgebase':
if (!isset($query['layout']))
{
$query['layout'] = 'default';
}
if ($query['layout'] == 'default')
{
$segments[] = JText::_('RST_SEF_KB');
if (!empty($query['cid']))
{
$segments[] = $query['cid'];
unset($query['cid']);
}
}
else
{
$segments[] = JText::_('RST_SEF_KB_RESULTS');
}
break;
case 'article':
$segments[] = JText::_('RST_SEF_KB_ARTICLE');
if (isset($query['cid']))
{
$segments[] = $query['cid'];
unset($query['cid']);
}
break;
case 'search':
if (!empty($query['advanced']))
{
$segments[] = JText::_('RST_SEF_ADVANCED_SEARCH');
unset($query['advanced']);
}
else
{
$segments[] = JText::_('RST_SEF_SEARCH');
}
break;
case 'ticket':
if (!empty($query['print']))
{
$segments[] = JText::_('RST_SEF_PRINT_TICKET');
unset($query['print']);
}
else
{
$segments[] = JText::_('RST_SEF_TICKET');
}
if (isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
}
break;
case 'signature':
$segments[] = JText::_('RST_SEF_SIGNATURE');
break;
case 'history':
$segments[] = JText::_('RST_SEF_HISTORY');
if (isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
}
break;
case 'notes':
$segments[] = JText::_('RST_SEF_NOTES');
if (isset($query['ticket_id']))
{
$segments[] = $query['ticket_id'];
unset($query['ticket_id']);
}
break;
case 'note':
if (!empty($query['id']))
{
$segments[] = JText::_('RST_SEF_EDIT_NOTE');
if (isset($query['ticket_id']))
{
$segments[] = $query['ticket_id'];
unset($query['ticket_id']);
}
$segments[] = $query['id'];
unset($query['id']);
}
else
{
$segments[] = JText::_('RST_SEF_ADD_NOTE');
if (isset($query['ticket_id']))
{
$segments[] = $query['ticket_id'];
unset($query['ticket_id']);
}
}
break;
case 'ticketmessage':
$segments[] = JText::_('RST_SEF_EDIT_TICKET_MESSAGE');
if (isset($query['id']))
{
$segments[] = $query['id'];
unset($query['id']);
}
break;
case 'removedata':
if (isset($query['layout']) &&
$query['layout'] == 'success')
{
$segments[] = JText::_('RST_SEF_REMOVE_DATA_SUCCESS');
}
else
{
$segments[] = JText::_('RST_SEF_REMOVE_DATA');
}
break;
}
}
if (!empty($query['task']))
{
switch ($query['task'])
{
case 'resetsearch':
$segments[] = JText::_('RST_SEF_RESET_SEARCH');
unset($query['task']);
break;
case 'captcha':
$segments[] = 'captcha';
unset($query['task']);
break;
case 'removedata.process':
$segments[] = JText::_('RST_SEF_REMOVE_DATA_PROCESS');
unset($query['task']);
break;
}
}
unset($query['view'], $query['controller'],
$query['file_id']);
unset($query['tmpl']);
unset($query['layout']);
return $segments;
}
public function parse(&$segments)
{
$lang = JFactory::getLanguage();
$lang->load('com_rsticketspro', JPATH_SITE,
'en-GB', true);
$lang->load('com_rsticketspro', JPATH_SITE,
$lang->getDefault(), true);
$lang->load('com_rsticketspro', JPATH_SITE, null, true);
$query = array();
$segments[0] = str_replace(':', '-', $segments[0]);
switch ($segments[0])
{
case JText::_('RST_SEF_TICKETS'):
$query['view'] = 'tickets';
break;
case JText::_('RST_SEF_SEARCHES'):
$query['view'] = 'predefinedsearches';
break;
case JText::_('RST_SEF_SELECT_USER_FROM_LIST'):
$query['view'] = 'users';
$query['layout'] = 'modal';
$query['tmpl'] = 'component';
break;
case JText::_('RST_SEF_SUBMIT_TICKET'):
$query['view'] = 'submit';
break;
case JText::_('RST_SEF_DASHBOARD'):
$query['view'] = 'dashboard';
break;
case JText::_('RST_SEF_EDIT_PREDEFINED_SEARCH'):
$query['view'] = 'predefinedsearch';
$query['layout'] = 'edit';
if (isset($segments[1]))
{
$query['id'] = $segments[1];
}
break;
case JText::_('RST_SEF_NEW_PREDEFINED_SEARCH'):
$query['view'] = 'predefinedsearch';
$query['layout'] = 'edit';
break;
case JText::_('RST_SEF_KB'):
$query['view'] = 'knowledgebase';
if (!empty($segments[1]))
{
$query['cid'] = $segments[1];
}
break;
case JText::_('RST_SEF_KB_RESULTS'):
$query['view'] = 'knowledgebase';
$query['layout'] = 'results';
break;
case JText::_('RST_SEF_KB_ARTICLE'):
$query['view'] = 'article';
if (!empty($segments[1]))
{
$query['cid'] = $segments[1];
}
break;
case JText::_('RST_SEF_ADVANCED_SEARCH'):
$query['view'] = 'search';
$query['advanced'] = 'true';
break;
case JText::_('RST_SEF_SEARCH'):
$query['view'] = 'search';
break;
case JText::_('RST_SEF_PRINT_TICKET'):
$query['view'] = 'ticket';
if (!empty($segments[1]))
{
$query['id'] = $segments[1];
}
$query['tmpl'] = 'component';
$query['print'] = 1;
break;
case JText::_('RST_SEF_TICKET'):
$query['view'] = 'ticket';
if (!empty($segments[1]))
{
$query['id'] = $segments[1];
}
break;
case JText::_('RST_SEF_SIGNATURE'):
$query['view'] = 'signature';
break;
case JText::_('RST_SEF_HISTORY'):
$query['view'] = 'history';
$query['tmpl'] = 'component';
if (!empty($segments[1]))
{
$query['id'] = $segments[1];
}
break;
case JText::_('RST_SEF_NOTES'):
$query['view'] = 'notes';
$query['tmpl'] = 'component';
if (!empty($segments[1]))
{
$query['ticket_id'] = $segments[1];
}
break;
case JText::_('RST_SEF_ADD_NOTE'):
$query['view'] = 'note';
$query['layout'] = 'edit';
$query['tmpl'] = 'component';
if (!empty($segments[1]))
{
$query['ticket_id'] = $segments[1];
}
break;
case JText::_('RST_SEF_EDIT_NOTE'):
$query['view'] = 'note';
$query['layout'] = 'edit';
$query['tmpl'] = 'component';
if (!empty($segments[1]))
{
$query['ticket_id'] = $segments[1];
}
if (!empty($segments[2]))
{
$query['id'] = $segments[2];
}
break;
case JText::_('RST_SEF_EDIT_TICKET_MESSAGE'):
$query['view'] = 'ticketmessage';
$query['tmpl'] = 'component';
if (!empty($segments[1]))
{
$query['id'] = $segments[1];
}
break;
case JText::_('RST_SEF_RESET_SEARCH'):
$query['task'] = 'resetsearch';
break;
case JText::_('RST_SEF_REMOVE_DATA'):
$query['view'] = 'removedata';
$query['layout'] = 'default';
break;
case JText::_('RST_SEF_REMOVE_DATA_SUCCESS'):
$query['view'] = 'removedata';
$query['layout'] = 'success';
break;
case JText::_('RST_SEF_REMOVE_DATA_PROCESS'):
$query['task'] = 'removedata.process';
break;
case 'captcha':
$query['task'] = 'captcha';
break;
}
$segments = array();
return $query;
}
}home/lmsyaran/public_html/j3/components/com_reservation/router.php000064400000025357151171722340021574
0ustar00<?php
/*----------------------------------------------------------------------------------|
www.vdm.io |----/
fdsh
/-------------------------------------------------------------------------------------------------------/
@version 1.0.39
@build 4th April, 2023
@created 17th December, 2020
@package Reservation
@subpackage router.php
@author farhad shahbazi <http://farhad.com>
@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');
/**
* Routing class from com_reservation
*
* @since 3.3
*/
class ReservationRouter extends JComponentRouterBase
{
/**
* Build the route for the com_reservation component
*
* @param array &$query An array of URL arguments
*
* @return array The URL arguments to use to assemble the subsequent
URL.
*
* @since 3.3
*/
public function build(&$query)
{
$segments = array();
// Get a menu item based on Itemid or currently active
$params = JComponentHelper::getParams('com_reservation');
if (empty($query['Itemid']))
{
$menuItem = $this->menu->getActive();
}
else
{
$menuItem = $this->menu->getItem($query['Itemid']);
}
$mView = (empty($menuItem->query['view'])) ? null :
$menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null :
$menuItem->query['id'];
if (isset($query['view']))
{
$view = $query['view'];
if (empty($query['Itemid']))
{
$segments[] = $query['view'];
}
unset($query['view']);
}
// Are we dealing with a item that is attached to a menu item?
if (isset($view) && ($mView == $view) and
(isset($query['id'])) and ($mId == (int) $query['id']))
{
unset($query['view']);
unset($query['catid']);
unset($query['id']);
return $segments;
}
if (isset($view) && isset($query['id']) &&
($view === 'plan' || $view === 'messages' || $view ===
'consultantitem' || $view === 'usersign' || $view ===
'payment' || $view === 'firstqst' || $view ===
'consultantsignup' || $view === 'comment' || $view ===
'doctors' || $view === 'doctorsignup' || $view ===
'doctor' || $view === 'reserve_appointment' || $view
=== 'consultant_plan' || $view === 'login' || $view ===
'res_list'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if (($view === 'plan' || $view === 'messages' ||
$view === 'consultantitem' || $view === 'usersign' ||
$view === 'payment' || $view === 'firstqst' || $view
=== 'consultantsignup' || $view === 'comment' || $view
=== 'doctors' || $view === 'doctorsignup' || $view ===
'doctor' || $view === 'reserve_appointment' || $view
=== 'consultant_plan' || $view === 'login' || $view ===
'res_list'))
{
$segments[] = $view;
$id = explode(':', $query['id']);
if (count($id) == 2)
{
$segments[] = $id[1];
}
else
{
$segments[] = $id[0];
}
}
}
unset($query['id']);
}
$total = count($segments);
for ($i = 0; $i < $total; $i++)
{
$segments[$i] = str_replace(':', '-',
$segments[$i]);
}
return $segments;
}
/**
* Parse the segments of a URL.
*
* @param array &$segments The segments of the URL to parse.
*
* @return array The URL attributes to be used by the application.
*
* @since 3.3
*/
public function parse(&$segments)
{
$count = count($segments);
$vars = array();
//Handle View and Identifier
switch($segments[0])
{
case 'plan':
$vars['view'] = 'plan';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
break;
case 'messages':
$vars['view'] = 'messages';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultantitem':
$vars['view'] = 'consultantitem';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'usersign':
$vars['view'] = 'usersign';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('usersign', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'payment':
$vars['view'] = 'payment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('payment', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'firstqst':
$vars['view'] = 'firstqst';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultantsignup':
$vars['view'] = 'consultantsignup';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultantsignup',
$segments[$count-1], 'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'comment':
$vars['view'] = 'comment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctors':
$vars['view'] = 'doctors';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctorsignup':
$vars['view'] = 'doctorsignup';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('doctorsignup', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'doctor':
$vars['view'] = 'doctor';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'reserve_appointment':
$vars['view'] = 'reserve_appointment';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'consultant_plan':
$vars['view'] = 'consultant_plan';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'login':
$vars['view'] = 'login';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('login', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
case 'res_list':
$vars['view'] = 'res_list';
if (is_numeric($segments[$count-1]))
{
$vars['id'] = (int) $segments[$count-1];
}
elseif ($segments[$count-1])
{
$id = $this->getVar('consultant', $segments[$count-1],
'alias', 'id');
if($id)
{
$vars['id'] = $id;
}
}
break;
}
return $vars;
}
protected function getVar($table, $where = null, $whereString = null,
$what = null, $category = false, $operator = '=', $main =
'reservation')
{
if(!$where || !$what || !$whereString)
{
return false;
}
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName(array($what)));
if ('categories' == $table || 'category' == $table ||
$category)
{
$getTable = '#__categories';
$query->from($db->quoteName($getTable));
// we need this to target the components categories (TODO will keep an
eye on this)
$query->where($db->quoteName('extension') . ' LIKE
'. $db->quote((string)'com_' . $main . '%'));
}
else
{
// we must check if the table exist (TODO not ideal)
$tables = $db->getTableList();
$app = JFactory::getApplication();
$prefix = $app->get('dbprefix');
$check = $prefix.$main.'_'.$table;
if (in_array($check, $tables))
{
$getTable = '#__'.$main.'_'.$table;
$query->from($db->quoteName($getTable));
}
else
{
return false;
}
}
if (is_numeric($where))
{
return false;
}
elseif ($this->checkString($where))
{
// we must first check if this table has the column
$columns = $db->getTableColumns($getTable);
if (isset($columns[$whereString]))
{
$query->where($db->quoteName($whereString) . '
'.$operator.' '. $db->quote((string)$where));
}
else
{
return false;
}
}
else
{
return false;
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadResult();
}
return false;
}
protected function checkString($string)
{
if (isset($string) && is_string($string) &&
strlen($string) > 0)
{
return true;
}
return false;
}
}
function ReservationBuildRoute(&$query)
{
$router = new ReservationRouter;
return $router->build($query);
}
function ReservationParseRoute($segments)
{
$router = new ReservationRouter;
return $router->parse($segments);
}