From 286232872c67c3691c0ba0172a7416aa902e7c23 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:09:44 +0200 Subject: [PATCH 01/20] Rewrote the Router class, now extending RouterView instead of JComponentRouterBase and uses Namespacing --- site/router.php | 457 +++++++++++++++++++++--------------------------- 1 file changed, 201 insertions(+), 256 deletions(-) diff --git a/site/router.php b/site/router.php index a762362..1777182 100644 --- a/site/router.php +++ b/site/router.php @@ -1,259 +1,204 @@ - @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_demo - * - * @since 3.3 - */ -class DemoRouter extends JComponentRouterBase -{ - /** - * Build the route for the com_demo 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_demo'); - - 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 === 'look' || $view === 'looks' || $view === 'looking')) - { - if ($mId != (int) $query['id'] || $mView != $view) - { - if (($view === 'look' || $view === 'looks' || $view === 'looking')) - { - $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]) +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage router.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\CMS\Application\CMSApplication; +use Joomla\CMS\Component\Router\RouterView; +use Joomla\CMS\Component\Router\RouterViewConfiguration; +use Joomla\CMS\Component\Router\Rules\MenuRules; +use Joomla\CMS\Component\Router\Rules\StandardRules; +use Joomla\CMS\Component\Router\Rules\NomenuRules; +use Joomla\CMS\Factory; +use Joomla\CMS\Menu\SiteMenu; + +/** + * Routing class from com_demo + * + * @since 3.3 + */ +class DemoRouter extends RouterView +{ + /** + * The database driver + * + * @var \JDatabaseDriver + * @since 1.0 + */ + protected $db; + + /** + * Search Component router constructor + * + * @param CMSApplication $app The application object + * @param SiteMenu $menu The menu object to work with + */ + public function __construct($app = null, $menu = null) + { + $this->db = Factory::getDbo(); + + $looks = new RouterViewConfiguration('looks'); + $this->registerView($looks); + + $look = (new RouterViewConfiguration('look')) + ->setParent($looks) + ->setKey('id'); + $this->registerView($look); + + $looking = (new RouterViewConfiguration('looking')) + ->setParent($look, 'id') + ->setKey('id'); + + $this->registerView($looking); + + $export = (new RouterViewConfiguration('export')) + ->setKey('cms_version'); + $this->registerView($export); + + parent::__construct($app, $menu); + + $this->attachRule(new MenuRules($this)); + $this->attachRule(new StandardRules($this)); + $this->attachRule(new NomenuRules($this)); + } + + /** + * Method to get the segment(s) for looks + * + * @param string $id ID of the looks 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 getLooksSegment($id, $query) + { + return $this->getLookSegment($id, $query); + } + + /** + * Method to get the segment(s) for looks + * + * @param string $segment Segment of the contact 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 getLooksId($segment, $query) + { + return $this->getLookId($segment, $query); + } + + /** + * Method to get the segment(s) for a look + * + * @param string $id ID of the application 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 getLookSegment($id, $query) + { + if (!strpos($id, ':')) { - case 'look': - $vars['view'] = 'look'; - if (is_numeric($segments[$count-1])) - { - $vars['id'] = (int) $segments[$count-1]; - } - break; - case 'looks': - $vars['view'] = 'looks'; - if (is_numeric($segments[$count-1])) - { - $vars['id'] = (int) $segments[$count-1]; - } - elseif ($segments[$count-1]) - { - $id = $this->getVar('look', $segments[$count-1], 'alias', 'id'); - if($id) - { - $vars['id'] = $id; - } - } - break; - case 'looking': - $vars['view'] = 'looking'; - if (is_numeric($segments[$count-1])) - { - $vars['id'] = (int) $segments[$count-1]; - } - elseif ($segments[$count-1]) - { - $id = $this->getVar('look', $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 = 'demo') - { - 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 DemoBuildRoute(&$query) -{ - $router = new DemoRouter; - - return $router->build($query); -} - -function DemoParseRoute($segments) -{ - $router = new DemoRouter; - - return $router->parse($segments); + $dbquery = $this->db->getQuery(true); + $dbquery->select($this->db->quoteName('alias')) + ->from($this->db->quoteName('#__demo_look')) + ->where('id = ' . $dbquery->q((int) $id)); + $this->db->setQuery($dbquery); + + $id .= ':' . $this->db->loadResult(); + } + + list($void, $segment) = explode(':', $id, 2); + + return array($void => $segment); + } + + /** + * Method to get the segment(s) for an application + * + * @param string $segment Segment of the application 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 getLookId($segment, $query) + { + $query = $this->db->getQuery(true); + $query->select($this->db->quoteName('id')) + ->from($this->db->quoteName('#__demo_look')) + ->where('alias = ' . $this->db->quote($segment)); + $this->db->setQuery($query); + + return (int) $this->db->loadResult(); + } + + /** + * Method to get the segment(s) for a looking + * + * @param string $id ID of the looking 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 getLookingSegment($id, $query) + { + if (!strpos($id, ':')) + { + $dbquery = $this->db->getQuery(true); + $dbquery->select($this->db->quoteName('alias')) + ->from($this->db->quoteName('#__demo_look')) + ->where('id = ' . $dbquery->q((int) $id)); + $this->db->setQuery($dbquery); + + $id .= ':' . $this->db->loadResult(); + } + + list($void, $segment) = explode(':', $id, 2); + + return array($void => $segment); + } + + /** + * Method to get the segment(s) for a looking + * + * @param string $segment Segment of the looking 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 getLookingId($segment, $query) + { + $dbQuery = $this->db->getQuery(true); + $dbQuery->select($this->db->quoteName('id')) + ->from($this->db->quoteName('#__demo_look')) + ->where( + [ + $this->db->quoteName('alias') . ' = ' . $this->db->quote($segment), + $this->db->quoteName('id') . ' = ' . (int) $query['id'], + ] + );; + $this->db->setQuery($dbQuery); + + return (int) $this->db->loadResult(); + } + } \ No newline at end of file -- 2.45.1 From b126fa389e8662de0657d2d36eb6a5b1d40501f0 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:19:01 +0200 Subject: [PATCH 02/20] Comment out: JHtml::_('behavior.tabstate'); --- admin/demo.php | 94 +++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/admin/demo.php b/admin/demo.php index 53a6e52..9fbb308 100644 --- a/admin/demo.php +++ b/admin/demo.php @@ -1,48 +1,48 @@ - @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'); - -JHtml::_('behavior.tabstate'); - -// Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_demo')) -{ - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; - -// Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_demo/assets/css/admin.css'); -$document->addScript('components/com_demo/assets/js/admin.js'); - -// require helper files -JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); -JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); - -// Get an instance of the controller prefixed by Demo -$controller = JControllerLegacy::getInstance('Demo'); - -// Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); - -// Redirect if set by the controller -$controller->redirect(); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage demo.php + @author Llewellyn van der Merwe + @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'); + +//JHtml::_('behavior.tabstate'); + +// Access check. +if (!JFactory::getUser()->authorise('core.manage', 'com_demo')) +{ + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); +}; + +// Add CSS file for all pages +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_demo/assets/css/admin.css'); +$document->addScript('components/com_demo/assets/js/admin.js'); + +// require helper files +JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); + +// Get an instance of the controller prefixed by Demo +$controller = JControllerLegacy::getInstance('Demo'); + +// Perform the Request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); -- 2.45.1 From 1ac2844b76e48b03dad6b14213b9d1517c391460 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:25:09 +0200 Subject: [PATCH 03/20] Comment out: JHtml::_('behavior.tooltip'); --- admin/views/demo/tmpl/default.php | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/admin/views/demo/tmpl/default.php b/admin/views/demo/tmpl/default.php index 09db4ac..fcd0e09 100644 --- a/admin/views/demo/tmpl/default.php +++ b/admin/views/demo/tmpl/default.php @@ -1,28 +1,28 @@ - @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'); - -JHtml::_('behavior.tooltip'); - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage default.php + @author Llewellyn van der Merwe + @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'); + +//JHtml::_('behavior.tooltip'); + ?>
-- 2.45.1 From 92e1dfb005609012ab403cb741b17d9e21fa2b4d Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:32:24 +0200 Subject: [PATCH 04/20] Comment out: JHtml::_('behavior.tooltip') & the spinner/loader, and changed formvalidation to formvalidator --- admin/views/look/tmpl/edit.php | 66 +++++++++++++++++----------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/admin/views/look/tmpl/edit.php b/admin/views/look/tmpl/edit.php index e776779..573c7c9 100644 --- a/admin/views/look/tmpl/edit.php +++ b/admin/views/look/tmpl/edit.php @@ -1,34 +1,34 @@ - @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'); - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage edit.php + @author Llewellyn van der Merwe + @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'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +//JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = $this->params; // will be removed just use $this->params instead -?> - + -- 2.45.1 From f0339880c334a526ab2d6c4483904d5be663e3ab Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:40:36 +0200 Subject: [PATCH 05/20] Comment out: JTableObserverContenthistory::createObserver(, array('typeAlias' => 'com_demo.look')); --- admin/tables/look.php | 636 +++++++++++++++++++++--------------------- 1 file changed, 318 insertions(+), 318 deletions(-) diff --git a/admin/tables/look.php b/admin/tables/look.php index adf28a1..22ceeac 100644 --- a/admin/tables/look.php +++ b/admin/tables/look.php @@ -1,322 +1,322 @@ - @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'); - -use Joomla\Registry\Registry; -use Joomla\String\StringHelper; -use Joomla\Utilities\ArrayHelper; - -/** - * Looks Table class - */ -class DemoTableLook extends JTable -{ - /** - * Ensure the params and metadata in json encoded in the bind method - * - * @var array - * @since 3.3 - */ - protected $_jsonEncode = array('params', 'metadata'); - - /** - * Constructor - * - * @param object Database connector object - */ - function __construct(&$db) - { +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage look.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Registry\Registry; +use Joomla\String\StringHelper; +use Joomla\Utilities\ArrayHelper; + +/** + * Looks Table class + */ +class DemoTableLook extends JTable +{ + /** + * Ensure the params and metadata in json encoded in the bind method + * + * @var array + * @since 3.3 + */ + protected $_jsonEncode = array('params', 'metadata'); + + /** + * Constructor + * + * @param object Database connector object + */ + function __construct(&$db) + { parent::__construct('#__demo_look', 'id', $db); // Adding History Options - JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look')); - } - - public function bind($array, $ignore = '') - { - - if (isset($array['params']) && is_array($array['params'])) - { - $registry = new JRegistry; - $registry->loadArray($array['params']); - $array['params'] = (string) $registry; - } - - if (isset($array['metadata']) && is_array($array['metadata'])) - { - $registry = new JRegistry; - $registry->loadArray($array['metadata']); - $array['metadata'] = (string) $registry; - } - - // Bind the rules. - if (isset($array['rules']) && is_array($array['rules'])) - { - $rules = new JAccessRules($array['rules']); - $this->setRules($rules); - } - return parent::bind($array, $ignore); - } - - /** - * Overload the store method for the Look table. - * - * @param boolean Toggle whether null values should be updated. - * @return boolean True on success, false on failure. - * @since 1.6 - */ - public function store($updateNulls = false) - { - $date = JFactory::getDate(); - $user = JFactory::getUser(); - - if ($this->id) - { - // Existing item - $this->modified = $date->toSql(); - $this->modified_by = $user->get('id'); - } - else - { - // New look. A look created and created_by field can be set by the user, - // so we don't touch either of these if they are set. - if (!(int) $this->created) - { - $this->created = $date->toSql(); - } - if (empty($this->created_by)) - { - $this->created_by = $user->get('id'); - } - } - - if (isset($this->alias)) - { - // Verify that the alias is unique - $table = JTable::getInstance('look', 'DemoTable'); - - if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS')); - return false; - } - } - - if (isset($this->url)) - { - // Convert IDN urls to punycode - $this->url = JStringPunycode::urlToPunycode($this->url); - } - if (isset($this->website)) - { - // Convert IDN urls to punycode - $this->website = JStringPunycode::urlToPunycode($this->website); - } - - return parent::store($updateNulls); - } - - /** - * Overloaded check method to ensure data integrity. - * - * @return boolean True on success. - */ - public function check() - { - if (isset($this->alias)) - { - // Generate a valid alias - $this->generateAlias(); - - $table = JTable::getInstance('look', 'demoTable'); - - while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) - { - $this->alias = StringHelper::increment($this->alias, 'dash'); - } - } - - /* - * Clean up keywords -- eliminate extra spaces between phrases - * and cr (\r) and lf (\n) characters from string. - * Only process if not empty. - */ - if (!empty($this->metakey)) - { - // Array of characters to remove. - $bad_characters = array("\n", "\r", "\"", "<", ">"); - - // Remove bad characters. - $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); - - // Create array using commas as delimiter. - $keys = explode(',', $after_clean); - $clean_keys = array(); - - foreach ($keys as $key) - { - // Ignore blank keywords. - if (trim($key)) - { - $clean_keys[] = trim($key); - } - } - - // Put array back together delimited by ", " - $this->metakey = implode(", ", $clean_keys); - } - - // Clean up description -- eliminate quotes and <> brackets - if (!empty($this->metadesc)) - { - // Only process if not empty - $bad_characters = array("\"", "<", ">"); - $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); - } - - // If we don't have any access rules set at this point just use an empty JAccessRules class - if (!$this->getRules()) - { - $rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id); - $this->setRules($rules); - } - - // Set ordering - if ($this->published < 0) - { - // Set ordering to 0 if state is archived or trashed - $this->ordering = 0; - } - - return true; - } - - /** - * Gets the default asset values for a component. - * - * @param $string $component The component asset name to search for - * - * @return JAccessRules The JAccessRules object for the asset - */ - protected function getDefaultAssetValues($component, $try = true) - { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - if ($db->loadRowList()) - { - // asset already set so use saved rules - $assetId = (int) $db->loadResult(); - return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. - } - // try again - elseif ($try) - { - $try = explode('.',$component); - $result = $this->getDefaultAssetValues($try[0], false); - if ($result instanceof JAccessRules) - { - if (isset($try[1])) - { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($try[1] !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - else - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count( (array) $_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules; - $rules->mergeCollection($_result); - - return $rules; - } - } - return $result; - } - } - return JAccess::getAssetRules(0); - } - - /** - * Method to compute the default name of the asset. - * The default name is in the form 'table_name.id' - * where id is the value of the primary key of the table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetName() - { - $k = $this->_tbl_key; - return 'com_demo.look.'.(int) $this->$k; - } - - /** - * Method to return the title to use for the asset table. - * - * @return string - * @since 2.5 - */ - protected function _getAssetTitle() - { - if (isset($this->title)) - { - return $this->title; - } - return ''; - } - - /** - * Get the parent asset id for the record - * - * @return int - * @since 2.5 - */ - protected function _getAssetParentId(JTable $table = NULL, $id = NULL) - { - $asset = JTable::getInstance('Asset'); - $asset->loadByName('com_demo'); - - return $asset->id; +// JTableObserverContenthistory::createObserver($this, array('typeAlias' => 'com_demo.look')); + } + + public function bind($array, $ignore = '') + { + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new JRegistry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new JRegistry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + return parent::bind($array, $ignore); + } + + /** + * Overload the store method for the Look table. + * + * @param boolean Toggle whether null values should be updated. + * @return boolean True on success, false on failure. + * @since 1.6 + */ + public function store($updateNulls = false) + { + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + // New look. A look created and created_by field can be set by the user, + // so we don't touch either of these if they are set. + if (!(int) $this->created) + { + $this->created = $date->toSql(); + } + if (empty($this->created_by)) + { + $this->created_by = $user->get('id'); + } + } + + if (isset($this->alias)) + { + // Verify that the alias is unique + $table = JTable::getInstance('look', 'DemoTable'); + + if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->setError(JText::_('COM_DEMO_LOOK_ERROR_UNIQUE_ALIAS')); + return false; + } + } + + if (isset($this->url)) + { + // Convert IDN urls to punycode + $this->url = JStringPunycode::urlToPunycode($this->url); + } + if (isset($this->website)) + { + // Convert IDN urls to punycode + $this->website = JStringPunycode::urlToPunycode($this->website); + } + + return parent::store($updateNulls); + } + + /** + * Overloaded check method to ensure data integrity. + * + * @return boolean True on success. + */ + public function check() + { + if (isset($this->alias)) + { + // Generate a valid alias + $this->generateAlias(); + + $table = JTable::getInstance('look', 'demoTable'); + + while ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0)) + { + $this->alias = StringHelper::increment($this->alias, 'dash'); + } + } + + /* + * Clean up keywords -- eliminate extra spaces between phrases + * and cr (\r) and lf (\n) characters from string. + * Only process if not empty. + */ + if (!empty($this->metakey)) + { + // Array of characters to remove. + $bad_characters = array("\n", "\r", "\"", "<", ">"); + + // Remove bad characters. + $after_clean = StringHelper::str_ireplace($bad_characters, "", $this->metakey); + + // Create array using commas as delimiter. + $keys = explode(',', $after_clean); + $clean_keys = array(); + + foreach ($keys as $key) + { + // Ignore blank keywords. + if (trim($key)) + { + $clean_keys[] = trim($key); + } + } + + // Put array back together delimited by ", " + $this->metakey = implode(", ", $clean_keys); + } + + // Clean up description -- eliminate quotes and <> brackets + if (!empty($this->metadesc)) + { + // Only process if not empty + $bad_characters = array("\"", "<", ">"); + $this->metadesc = StringHelper::str_ireplace($bad_characters, "", $this->metadesc); + } + + // If we don't have any access rules set at this point just use an empty JAccessRules class + if (!$this->getRules()) + { + $rules = $this->getDefaultAssetValues('com_demo.look.'.$this->id); + $this->setRules($rules); + } + + // Set ordering + if ($this->published < 0) + { + // Set ordering to 0 if state is archived or trashed + $this->ordering = 0; + } + + return true; + } + + /** + * Gets the default asset values for a component. + * + * @param $string $component The component asset name to search for + * + * @return JAccessRules The JAccessRules object for the asset + */ + protected function getDefaultAssetValues($component, $try = true) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + if ($db->loadRowList()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + return JAccess::getAssetRules($assetId); // (TODO) instead of keeping inherited Allowed it becomes Allowed. + } + // try again + elseif ($try) + { + $try = explode('.',$component); + $result = $this->getDefaultAssetValues($try[0], false); + if ($result instanceof JAccessRules) + { + if (isset($try[1])) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($try[1] !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + else + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count( (array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules; + $rules->mergeCollection($_result); + + return $rules; + } + } + return $result; + } + } + return JAccess::getAssetRules(0); + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form 'table_name.id' + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_demo.look.'.(int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + if (isset($this->title)) + { + return $this->title; + } + return ''; + } + + /** + * Get the parent asset id for the record + * + * @return int + * @since 2.5 + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + $asset = JTable::getInstance('Asset'); + $asset->loadByName('com_demo'); + + return $asset->id; } /** @@ -340,6 +340,6 @@ class DemoTableLook extends JTable } return $this->alias; - } - -} + } + +} -- 2.45.1 From 7a0eb5b7b32c865693c6b575e78d45a1ee53e134 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:45:05 +0200 Subject: [PATCH 06/20] Change JApplication to JApplicationHelper --- admin/tables/look.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/tables/look.php b/admin/tables/look.php index 22ceeac..e4c609e 100644 --- a/admin/tables/look.php +++ b/admin/tables/look.php @@ -332,7 +332,7 @@ class DemoTableLook extends JTable $this->alias = $this->name; } - $this->alias = JApplication::stringURLSafe($this->alias); + $this->alias = JApplicationHelper::stringURLSafe($this->alias); if (trim(str_replace('-', '', $this->alias)) == '') { -- 2.45.1 From ab387061f3ca73b064f299ab3bfd12e335467b61 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:48:25 +0200 Subject: [PATCH 07/20] Comment out: JHtml::_('behavior.tabstate'); --- site/demo.php | 82 +++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/site/demo.php b/site/demo.php index c6e84d2..2fa0ccd 100644 --- a/site/demo.php +++ b/site/demo.php @@ -1,42 +1,42 @@ - @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'); - -JHtml::_('behavior.tabstate'); - -// Set the component css/js -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_demo/assets/css/site.css'); -$document->addScript('components/com_demo/assets/js/site.js'); - -// Require helper files -JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); -JLoader::register('DemoHelperRoute', __DIR__ . '/helpers/route.php'); - -// Get an instance of the controller prefixed by Demo -$controller = JControllerLegacy::getInstance('Demo'); - -// Perform the request task -$controller->execute(JFactory::getApplication()->input->get('task')); - -// Redirect if set by the controller -$controller->redirect(); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage demo.php + @author Llewellyn van der Merwe + @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'); + +//JHtml::_('behavior.tabstate'); + +// Set the component css/js +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_demo/assets/css/site.css'); +$document->addScript('components/com_demo/assets/js/site.js'); + +// Require helper files +JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); +JLoader::register('DemoHelperRoute', __DIR__ . '/helpers/route.php'); + +// Get an instance of the controller prefixed by Demo +$controller = JControllerLegacy::getInstance('Demo'); + +// Perform the request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); -- 2.45.1 From 3c4645f097dfe9c990b7bcbd5f90c48c95601977 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:54:04 +0200 Subject: [PATCH 08/20] Comment out: ('behavior.tooltip'), ('behavior.tabstate') & ('behavior.calender'), and changed formvalidation to formvalidator --- site/views/look/tmpl/edit.php | 66 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/site/views/look/tmpl/edit.php b/site/views/look/tmpl/edit.php index a1853dd..7e748cc 100644 --- a/site/views/look/tmpl/edit.php +++ b/site/views/look/tmpl/edit.php @@ -1,37 +1,37 @@ - @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'); - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage edit.php + @author Llewellyn van der Merwe + @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'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); -JHtml::_('behavior.tooltip'); -JHtml::_('behavior.formvalidation'); +//JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidator'); JHtml::_('formbehavior.chosen', 'select'); JHtml::_('behavior.keepalive'); -JHtml::_('behavior.tabstate'); -JHtml::_('behavior.calendar'); -?> -
-toolbar->render(); ?> -
+//JHtml::_('behavior.tabstate'); +//JHtml::_('behavior.calendar'); +?> +
+toolbar->render(); ?> +
@@ -104,8 +104,8 @@ JHtml::_('behavior.calendar');
- - + +
+ -- 2.45.1 From d58d2f9ff80b8cf6776004fe9b6a12df2522db7d Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 09:57:33 +0200 Subject: [PATCH 09/20] Comment out the JEventDispatcher --- site/models/looking.php | 254 ++++++++++++++++++++-------------------- 1 file changed, 127 insertions(+), 127 deletions(-) diff --git a/site/models/looking.php b/site/models/looking.php index 53b05bb..2f491aa 100644 --- a/site/models/looking.php +++ b/site/models/looking.php @@ -1,91 +1,91 @@ - @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'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Demo Looking Model - */ -class DemoModelLooking extends JModelItem -{ - /** - * Model context string. - * - * @var string - */ - protected $_context = 'com_demo.looking'; - - /** - * Model user data. - * - * @var strings - */ - protected $user; - protected $userId; - protected $guest; - protected $groups; - protected $levels; - protected $app; - protected $input; - protected $uikitComp; - - /** - * @var object item - */ - protected $item; - - /** - * Method to auto-populate the model state. - * - * Note. Calling getState in this method will result in recursion. - * - * @since 1.6 - * - * @return void - */ - protected function populateState() - { - $this->app = JFactory::getApplication(); - $this->input = $this->app->input; - // Get the itme main id - $id = $this->input->getInt('id', null); - $this->setState('looking.id', $id); - - // Load the parameters. - $params = $this->app->getParams(); - $this->setState('params', $params); - parent::populateState(); - } - - /** - * Method to get article data. - * - * @param integer $pk The id of the article. - * - * @return mixed Menu item data object on success, false on failure. - */ - public function getItem($pk = null) - { +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage looking.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Demo Looking Model + */ +class DemoModelLooking extends JModelItem +{ + /** + * Model context string. + * + * @var string + */ + protected $_context = 'com_demo.looking'; + + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * @var object item + */ + protected $item; + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @since 1.6 + * + * @return void + */ + protected function populateState() + { + $this->app = JFactory::getApplication(); + $this->input = $this->app->input; + // Get the itme main id + $id = $this->input->getInt('id', null); + $this->setState('looking.id', $id); + + // Load the parameters. + $params = $this->app->getParams(); + $this->setState('params', $params); + parent::populateState(); + } + + /** + * Method to get article data. + * + * @param integer $pk The id of the article. + * + * @return mixed Menu item data object on success, false on failure. + */ + public function getItem($pk = null) + { $this->user = JFactory::getUser(); // check if this user has permission to access item if (!$this->user->authorise('site.looking.access', 'com_demo')) @@ -95,24 +95,24 @@ class DemoModelLooking extends JModelItem // redirect away to the default view if no access allowed. $app->redirect(JRoute::_('index.php?option=com_demo&view=looks')); return false; - } - $this->userId = $this->user->get('id'); - $this->guest = $this->user->get('guest'); - $this->groups = $this->user->get('groups'); - $this->authorisedGroups = $this->user->getAuthorisedGroups(); - $this->levels = $this->user->getAuthorisedViewLevels(); - $this->initSet = true; - - $pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id'); - - if ($this->_item === null) - { - $this->_item = array(); - } - - if (!isset($this->_item[$pk])) - { - try + } + $this->userId = $this->user->get('id'); + $this->guest = $this->user->get('guest'); + $this->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); + $this->levels = $this->user->getAuthorisedViewLevels(); + $this->initSet = true; + + $pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id'); + + if ($this->_item === null) + { + $this->_item = array(); + } + + if (!isset($this->_item[$pk])) + { + try { // Get a db connection. $db = JFactory::getDbo(); @@ -141,8 +141,8 @@ class DemoModelLooking extends JModelItem return false; } // Load the JEvent Dispatcher - JPluginHelper::importPlugin('content'); - $this->_dispatcher = JEventDispatcher::getInstance(); +// JPluginHelper::importPlugin('content'); +// $this->_dispatcher = JEventDispatcher::getInstance(); // Check if item has params, or pass whole item. $params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data; // Make sure the content prepare plugins fire on description @@ -154,24 +154,24 @@ class DemoModelLooking extends JModelItem $this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp); // set data object to item. - $this->_item[$pk] = $data; - } - catch (Exception $e) - { - if ($e->getCode() == 404) - { - // Need to go thru the error handler to allow Redirect to work. - JError::raiseWarning(404, $e->getMessage()); - } - else - { - $this->setError($e); - $this->_item[$pk] = false; - } - } - } - - return $this->_item[$pk]; + $this->_item[$pk] = $data; + } + catch (Exception $e) + { + if ($e->getCode() == 404) + { + // Need to go thru the error handler to allow Redirect to work. + JError::raiseWarning(404, $e->getMessage()); + } + else + { + $this->setError($e); + $this->_item[$pk] = false; + } + } + } + + return $this->_item[$pk]; } /** @@ -187,5 +187,5 @@ class DemoModelLooking extends JModelItem return $this->uikitComp; } return false; - } -} + } +} -- 2.45.1 From 2c6b1599f7f5c71750d38ecbe9c804c4cc076c80 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 10:03:01 +0200 Subject: [PATCH 10/20] Comment out the Submenu from the admin area --- admin/views/looks/view.html.php | 380 ++++++++++++++++---------------- 1 file changed, 190 insertions(+), 190 deletions(-) diff --git a/admin/views/looks/view.html.php b/admin/views/looks/view.html.php index 43a2687..2906a72 100644 --- a/admin/views/looks/view.html.php +++ b/admin/views/looks/view.html.php @@ -1,47 +1,47 @@ - @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'); - -/** - * Demo View class for the Looks - */ -class DemoViewLooks extends JViewLegacy -{ - /** - * Looks view display method - * @return void - */ - function display($tpl = null) - { - if ($this->getLayout() !== 'modal') - { - // Include helper submenu - DemoHelper::addSubmenu('looks'); - } - - // Assign data to the view - $this->items = $this->get('Items'); - $this->pagination = $this->get('Pagination'); - $this->state = $this->get('State'); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage view.html.php + @author Llewellyn van der Merwe + @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'); + +/** + * Demo View class for the Looks + */ +class DemoViewLooks extends JViewLegacy +{ + /** + * Looks view display method + * @return void + */ + function display($tpl = null) + { +// if ($this->getLayout() !== 'modal') +// { +// // Include helper submenu +// DemoHelper::addSubmenu('looks'); +// } + + // Assign data to the view + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->state = $this->get('State'); $this->user = JFactory::getUser(); // Load the filter form from xml. $this->filterForm = $this->get('FilterForm'); @@ -49,122 +49,122 @@ class DemoViewLooks extends JViewLegacy $this->activeFilters = $this->get('ActiveFilters'); // Add the list ordering clause. $this->listOrder = $this->escape($this->state->get('list.ordering', 'a.id')); - $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); - $this->saveOrder = $this->listOrder == 'a.ordering'; - // set the return here value - $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); - // get global action permissions + $this->listDirn = $this->escape($this->state->get('list.direction', 'DESC')); + $this->saveOrder = $this->listOrder == 'a.ordering'; + // set the return here value + $this->return_here = urlencode(base64_encode((string) JUri::getInstance())); + // get global action permissions $this->canDo = DemoHelper::getActions('look'); $this->canEdit = $this->canDo->get('look.edit'); $this->canState = $this->canDo->get('look.edit.state'); $this->canCreate = $this->canDo->get('look.create'); $this->canDelete = $this->canDo->get('look.delete'); - $this->canBatch = $this->canDo->get('core.batch'); - - // We don't need toolbar in the modal window. - if ($this->getLayout() !== 'modal') - { - $this->addToolbar(); - $this->sidebar = JHtmlSidebar::render(); - // load the batch html - if ($this->canCreate && $this->canEdit && $this->canState) - { - $this->batchDisplay = JHtmlBatch_::render(); - } - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - - // Set the document - $this->setDocument(); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'eye-open'); - JHtmlSidebar::setAction('index.php?option=com_demo&view=looks'); - JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); - - if ($this->canCreate) - { - JToolBarHelper::addNew('look.add'); - } - - // Only load if there are items - if (DemoHelper::checkArray($this->items)) - { - if ($this->canEdit) - { - JToolBarHelper::editList('look.edit'); - } - - if ($this->canState) - { - JToolBarHelper::publishList('looks.publish'); - JToolBarHelper::unpublishList('looks.unpublish'); - JToolBarHelper::archiveList('looks.archive'); - - if ($this->canDo->get('core.admin')) - { - JToolBarHelper::checkin('looks.checkin'); - } - } - - // Add a batch button - if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) - { - // Get the toolbar object instance - $bar = JToolBar::getInstance('toolbar'); - // set the batch button name - $title = JText::_('JTOOLBAR_BATCH'); - // Instantiate a new JLayoutFile instance and render the batch button - $layout = new JLayoutFile('joomla.toolbar.batch'); - // add the button to the page - $dhtml = $layout->render(array('title' => $title)); - $bar->appendButton('Custom', $dhtml, 'batch'); - } - - if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) - { - JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH'); - } - elseif ($this->canState && $this->canDelete) - { - JToolbarHelper::trash('looks.trash'); + $this->canBatch = $this->canDo->get('core.batch'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + // load the batch html + if ($this->canCreate && $this->canEdit && $this->canState) + { + $this->batchDisplay = JHtmlBatch_::render(); + } + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_DEMO_LOOKS'), 'eye-open'); + JHtmlSidebar::setAction('index.php?option=com_demo&view=looks'); + JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields'); + + if ($this->canCreate) + { + JToolBarHelper::addNew('look.add'); + } + + // Only load if there are items + if (DemoHelper::checkArray($this->items)) + { + if ($this->canEdit) + { + JToolBarHelper::editList('look.edit'); + } + + if ($this->canState) + { + JToolBarHelper::publishList('looks.publish'); + JToolBarHelper::unpublishList('looks.unpublish'); + JToolBarHelper::archiveList('looks.archive'); + + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::checkin('looks.checkin'); + } + } + + // Add a batch button + if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState) + { + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + // set the batch button name + $title = JText::_('JTOOLBAR_BATCH'); + // Instantiate a new JLayoutFile instance and render the batch button + $layout = new JLayoutFile('joomla.toolbar.batch'); + // add the button to the page + $dhtml = $layout->render(array('title' => $title)); + $bar->appendButton('Custom', $dhtml, 'batch'); + } + + if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) + { + JToolbarHelper::deleteList('', 'looks.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($this->canState && $this->canDelete) + { + JToolbarHelper::trash('looks.trash'); } if ($this->canDo->get('core.export') && $this->canDo->get('look.export')) { JToolBarHelper::custom('looks.exportData', 'download', '', 'COM_DEMO_EXPORT_DATA', true); - } + } } if ($this->canDo->get('core.import') && $this->canDo->get('look.import')) { JToolBarHelper::custom('looks.importData', 'upload', '', 'COM_DEMO_IMPORT_DATA', false); - } - - // set help url for this view if found - $help_url = DemoHelper::getHelpUrl('looks'); - if (DemoHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); - } - - // add the options comp button - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_demo'); + } + + // set help url for this view if found + $help_url = DemoHelper::getHelpUrl('looks'); + if (DemoHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_demo'); } // Only load published batch if state and batch is allowed @@ -185,55 +185,55 @@ class DemoViewLooks extends JViewLegacy 'batch[access]', JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text') ); - } - } - - /** - * Method to set up the document properties - * - * @return void - */ - protected function setDocument() - { - if (!isset($this->document)) - { - $this->document = JFactory::getDocument(); - } - $this->document->setTitle(JText::_('COM_DEMO_LOOKS')); - $this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/looks.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); - } - - /** - * Escapes a value for output in a view script. - * - * @param mixed $var The output to escape. - * - * @return mixed The escaped value. - */ - public function escape($var) - { - if(strlen($var) > 50) - { - // use the helper htmlEscape method instead and shorten the string - return DemoHelper::htmlEscape($var, $this->_charset, true); - } - // use the helper htmlEscape method instead. - return DemoHelper::htmlEscape($var, $this->_charset); - } - - /** - * Returns an array of fields the table can be sorted by - * - * @return array Array containing the field name to sort by as the key and display text as value - */ - protected function getSortFields() - { + } + } + + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + if (!isset($this->document)) + { + $this->document = JFactory::getDocument(); + } + $this->document->setTitle(JText::_('COM_DEMO_LOOKS')); + $this->document->addStyleSheet(JURI::root() . "administrator/components/com_demo/assets/css/looks.css", (DemoHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + if(strlen($var) > 50) + { + // use the helper htmlEscape method instead and shorten the string + return DemoHelper::htmlEscape($var, $this->_charset, true); + } + // use the helper htmlEscape method instead. + return DemoHelper::htmlEscape($var, $this->_charset); + } + + /** + * Returns an array of fields the table can be sorted by + * + * @return array Array containing the field name to sort by as the key and display text as value + */ + protected function getSortFields() + { return array( 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), 'a.published' => JText::_('JSTATUS'), 'a.name' => JText::_('COM_DEMO_LOOK_NAME_LABEL'), 'a.description' => JText::_('COM_DEMO_LOOK_DESCRIPTION_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') - ); - } -} + ); + } +} -- 2.45.1 From 31fd580a7bd61749c0c006f11d70a8afd4cc6a2d Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 10:32:22 +0200 Subject: [PATCH 11/20] Comment out '->_dispatcher->trigger(onContentPrepare, array('com_demo.looking.description', &, &, 0))', to be able to display the detail view of an item --- site/models/looking.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/models/looking.php b/site/models/looking.php index 2f491aa..1a64c96 100644 --- a/site/models/looking.php +++ b/site/models/looking.php @@ -149,7 +149,7 @@ class DemoModelLooking extends JModelItem $_description = new stdClass(); $_description->text =& $data->description; // value must be in text // Since all values are now in text (Joomla Limitation), we also add the field name (description) to context - $this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0)); +// $this->_dispatcher->trigger("onContentPrepare", array('com_demo.looking.description', &$_description, &$params, 0)); // Checking if description has uikit components that must be loaded. $this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp); -- 2.45.1 From 4dfe6b23b917e2c91d8a68fd87383f6b923f2874 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 17:11:46 +0200 Subject: [PATCH 12/20] Comment out: ('behavior.tooltip') --- admin/views/looks/tmpl/default.php | 62 +++++++++++++++--------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/admin/views/looks/tmpl/default.php b/admin/views/looks/tmpl/default.php index 13e875c..81c0283 100644 --- a/admin/views/looks/tmpl/default.php +++ b/admin/views/looks/tmpl/default.php @@ -1,37 +1,37 @@ - @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'); - -JHtml::_('behavior.tooltip'); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage default.php + @author Llewellyn van der Merwe + @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'); + +//JHtml::_('behavior.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('dropdown.init'); JHtml::_('formbehavior.chosen', '.multipleAccessLevels', null, array('placeholder_text_multiple' => '- ' . JText::_('COM_DEMO_FILTER_SELECT_ACCESS') . ' -')); -JHtml::_('formbehavior.chosen', 'select'); -if ($this->saveOrder) -{ - $saveOrderingUrl = 'index.php?option=com_demo&task=looks.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'lookList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); -} -?> +JHtml::_('formbehavior.chosen', 'select'); +if ($this->saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_demo&task=looks.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'lookList', 'adminForm', strtolower($this->listDirn), $saveOrderingUrl); +} +?>
sidebar)): ?>
@@ -74,4 +74,4 @@ if ($this->saveOrder) - + -- 2.45.1 From 6be3bd3fe025641de5b5d983915edd1670b27102 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 17:19:40 +0200 Subject: [PATCH 13/20] Added an update targeting j4! platform --- demo_updateserver.xml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/demo_updateserver.xml b/demo_updateserver.xml index 7cc5b42..1f53c95 100644 --- a/demo_updateserver.xml +++ b/demo_updateserver.xml @@ -32,6 +32,23 @@ Llewellyn van der Merwe https://www.vdm.io/ + + + Demo + Demo Component + com_demo + component + 2.0.3 + https://www.vdm.io/ + + http://domain.com/demo.zip + + + stable + + Llewellyn van der Merwe + https://www.vdm.io/ + Demo @@ -48,6 +65,6 @@ Llewellyn van der Merwe https://www.vdm.io/ - + \ No newline at end of file -- 2.45.1 From 1c887d506ff3e1211ab42212cffa350066bb0a7d Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 17:22:29 +0200 Subject: [PATCH 14/20] Added 4.0 in the extension tag --- demo.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/demo.xml b/demo.xml index 4bd4272..8e2ffae 100644 --- a/demo.xml +++ b/demo.xml @@ -1,5 +1,5 @@ - + COM_DEMO 8th February, 2021 Llewellyn van der Merwe @@ -36,7 +36,7 @@ index.html js css - images + images uikit-v2 @@ -51,7 +51,7 @@ controller.php index.html router.php - demo.php + demo.php router.php assets helpers @@ -62,14 +62,14 @@ - language/en-GB/en-GB.com_demo.ini + language/en-GB/en-GB.com_demo.ini language/en-GB/en-GB.com_demo.sys.ini COM_DEMO_MENU - + COM_DEMO_MENU_LOOKS @@ -77,7 +77,7 @@ config.xml controller.php index.html - demo.php + demo.php README.txt assets controllers @@ -90,12 +90,12 @@ - language/en-GB/en-GB.com_demo.ini + language/en-GB/en-GB.com_demo.ini language/en-GB/en-GB.com_demo.sys.ini - - - https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml + + + https://raw.githubusercontent.com/namibia/demo-joomla-3-component/master/demo_updateserver.xml \ No newline at end of file -- 2.45.1 From fa04654e94112c39ed09e5151bc174aed19674fe Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 18:02:34 +0200 Subject: [PATCH 15/20] Make column params nullable, to enable users to add data --- admin/sql/install.mysql.utf8.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 096bed3..327ebde 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -10,7 +10,7 @@ CREATE TABLE IF NOT EXISTS `#__demo_look` ( `mobile_phone` VARCHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `website` VARCHAR(255) NOT NULL DEFAULT '', - `params` text NOT NULL, + `params` text NULL, `published` TINYINT(3) NOT NULL DEFAULT 1, `created_by` INT(10) unsigned NOT NULL DEFAULT 0, `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, -- 2.45.1 From 16c0b2af692cfa30c6e896a8b0e717882c2d5eb3 Mon Sep 17 00:00:00 2001 From: Oh Martin Date: Sat, 16 Oct 2021 18:42:23 +0200 Subject: [PATCH 16/20] Moved from (behavior::modal) to (bootstrap::renderModal), JAdapterInstance -> ComponentAdapter, added some namespaces and commented out necessary code to install, update and uninstall on j3! & j4! --- script.php | 828 +++++++++++++++++++++++++++-------------------------- 1 file changed, 419 insertions(+), 409 deletions(-) diff --git a/script.php b/script.php index a1d19ca..799db52 100644 --- a/script.php +++ b/script.php @@ -1,61 +1,71 @@ - @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'); - -JHTML::_('behavior.modal'); - -/** - * Script File of Demo Component - */ -class com_demoInstallerScript -{ - /** - * Constructor - * - * @param JAdapterInstance $parent The object responsible for running this script - */ - public function __construct(JAdapterInstance $parent) {} - - /** - * Called on installation - * - * @param JAdapterInstance $parent The object responsible for running this script - * - * @return boolean True on success - */ - public function install(JAdapterInstance $parent) {} - - /** - * Called on uninstallation - * - * @param JAdapterInstance $parent The object responsible for running this script - */ - public function uninstall(JAdapterInstance $parent) +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 8th February, 2021 + @created 18th October, 2016 + @package Demo + @subpackage script.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Installer\Adapter\ComponentAdapter; +//use Joomla\CMS\Installer\InstallerScript; +//use Joomla\CMS\Filesystem\File; +//use Joomla\CMS\Filesystem\Folder; +//use Joomla\CMS\Installer\InstallerAdapter; +//use Joomla\CMS\Language\Text; +//use Joomla\CMS\Table\Table; + +HTMLHelper::_('bootstrap.renderModal'); + +/** + * Script File of Demo Component + */ +class com_demoInstallerScript +{ + /** + * Constructor + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function __construct(ComponentAdapter $parent) {} + + /** + * Called on installation + * + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function install(ComponentAdapter $parent) {} + + /** + * Called on uninstallation + * + * @param JAdapterInstance $parent The object responsible for running this script + */ + public function uninstall(ComponentAdapter $parent) { // Get Application object - $app = JFactory::getApplication(); + $app = Factory::getApplication(); // Get The Database object - $db = JFactory::getDbo(); + $db = Factory::getDbo(); // Create a new query object. $query = $db->getQuery(true); @@ -325,36 +335,36 @@ class com_demoInstallerScript } // Get the biggest rule column in the assets table at this point. - $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; - $db->setQuery($get_rule_length); - if ($db->execute()) - { - $rule_length = $db->loadResult(); - // Check the size of the rules column - if ($rule_length < 5120) - { - // Revert the assets table rules column back to the default - $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; - $db->setQuery($revert_rule); - $db->execute(); - $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); - } - else - { - - $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); - } - } +// $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; +// $db->setQuery($get_rule_length); +// if ($db->execute()) +// { +// $rule_length = $db->loadResult(); +// // Check the size of the rules column +// if ($rule_length < 5120) +// { +// // Revert the assets table rules column back to the default +// $revert_rule = "ALTER TABLE `#__assets` CHANGE `rules` `rules` varchar(5120) NOT NULL COMMENT 'JSON encoded access control.';"; +// $db->setQuery($revert_rule); +// $db->execute(); +// $app->enqueueMessage(JText::_('Reverted the #__assets table rules column back to its default size of varchar(5120)')); +// } +// else +// { +// +// $app->enqueueMessage(JText::_('Could not revert the #__assets table rules column back to its default size of varchar(5120), since there is still one or more components that still requires the column to be larger.')); +// } +// } // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Demo from the action_logs_extensions table $demo_action_logs_extensions = array( $db->quoteName('extension') . ' = ' . $db->quote('com_demo') ); @@ -374,12 +384,12 @@ class com_demoInstallerScript // Set db if not set already. if (!isset($db)) { - $db = JFactory::getDbo(); + $db = Factory::getDbo(); } // Set app if not set already. if (!isset($app)) { - $app = JFactory::getApplication(); + $app = Factory::getApplication(); } // Remove Demo Look from the action_log_config table $look_action_log_config = array( $db->quoteName('type_alias') . ' = '. $db->quote('com_demo.look') ); @@ -394,114 +404,114 @@ class com_demoInstallerScript { // If successfully removed Demo Look add queued success message. $app->enqueueMessage(JText::_('The com_demo.look type alias was removed from the #__action_log_config table')); - } - // little notice as after service, in case of bad experience with component. - echo '

Did something go wrong? Are you disappointed?

-

Please let me know at joomla@vdm.io. -
We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really! -
Send me your thoughts on improvements that is needed, trust me, I will be very grateful! -
Visit us at https://www.vdm.io/ today!

'; - } - - /** - * Called on update - * - * @param JAdapterInstance $parent The object responsible for running this script - * - * @return boolean True on success - */ - public function update(JAdapterInstance $parent){} - - /** - * Called before any type of action - * - * @param string $type Which action is happening (install|uninstall|discover_install|update) - * @param JAdapterInstance $parent The object responsible for running this script - * - * @return boolean True on success - */ - public function preflight($type, JAdapterInstance $parent) - { - // get application - $app = JFactory::getApplication(); - // is redundant or so it seems ...hmmm let me know if it works again - if ($type === 'uninstall') - { - return true; - } - // the default for both install and update - $jversion = new JVersion(); - if (!$jversion->isCompatible('3.8.0')) - { - $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); - return false; - } - // do any updates needed - if ($type === 'update') - { - } - // do any install needed - if ($type === 'install') - { - } - // check if the PHPExcel stuff is still around - if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php')) - { - // We need to remove this old PHPExcel folder - $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel'); - // We need to remove this old PHPExcel file - JFile::delete(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php'); - } - return true; - } - - /** - * Called after any type of action - * - * @param string $type Which action is happening (install|uninstall|discover_install|update) - * @param JAdapterInstance $parent The object responsible for running this script - * - * @return boolean True on success - */ - public function postflight($type, JAdapterInstance $parent) - { - // get application - $app = JFactory::getApplication(); + } + // little notice as after service, in case of bad experience with component. + echo '

Did something go wrong? Are you disappointed?

+

Please let me know at joomla@vdm.io. +
We at Vast Development Method are committed to building extensions that performs proficiently! You can help us, really! +
Send me your thoughts on improvements that is needed, trust me, I will be very grateful! +
Visit us at https://www.vdm.io/ today!

'; + } + + /** + * Called on update + * + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function update(ComponentAdapter $parent){} + + /** + * Called before any type of action + * + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function preflight($type, ComponentAdapter $parent) + { + // get application + $app = Factory::getApplication(); + // is redundant or so it seems ...hmmm let me know if it works again + if ($type === 'uninstall') + { + return true; + } + // the default for both install and update + $jversion = new JVersion(); + if (!$jversion->isCompatible('3.8.0')) + { + $app->enqueueMessage('Please upgrade to at least Joomla! 3.8.0 before continuing!', 'error'); + return false; + } + // do any updates needed + if ($type === 'update') + { + } + // do any install needed + if ($type === 'install') + { + } + // check if the PHPExcel stuff is still around + if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php')) + { + // We need to remove this old PHPExcel folder + $this->removeFolder(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel'); + // We need to remove this old PHPExcel file + JFile::delete(JPATH_ADMINISTRATOR . '/components/com_demo/helpers/PHPExcel.php'); + } + return true; + } + + /** + * Called after any type of action + * + * @param string $type Which action is happening (install|uninstall|discover_install|update) + * @param JAdapterInstance $parent The object responsible for running this script + * + * @return boolean True on success + */ + public function postflight($type, ComponentAdapter $parent) + { + // get application + $app = Factory::getApplication(); // We check if we have dynamic folders to copy - $this->setDynamicF0ld3rs($app, $parent); - // set the default component settings - if ($type === 'install') + $this->setDynamicF0ld3rs($app, $parent); + // set the default component settings + if ($type === 'install') { // Get The Database object - $db = JFactory::getDbo(); - - // Create the look content type object. - $look = new stdClass(); - $look->type_title = 'Demo Look'; - $look->type_alias = 'com_demo.look'; - $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}'; - $look->router = 'DemoHelperRoute::getLookRoute'; - $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; - - // Set the object into the content types table. - $look_Inserted = $db->insertObject('#__content_types', $look); + $db = Factory::getDbo(); +// +// // Create the look content type object. +// $look = new stdClass(); +// $look->type_title = 'Demo Look'; +// $look->type_alias = 'com_demo.look'; +// $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; +// $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}'; +// $look->router = 'DemoHelperRoute::getLookRoute'; +// $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; +// +// // Set the object into the content types table. +// $look_Inserted = $db->insertObject('#__content_types', $look); // Install the global extenstion assets permission. - $query = $db->getQuery(true); +// $query = $db->getQuery(true); // Field to update. - $fields = array( - $db->quoteName('rules') . ' = ' . $db->quote('{"site.looks.access":{"1":1}}'), - ); +// $fields = array( +// $db->quoteName('rules') . ' = ' . $db->quote('{"site.looks.access":{"1":1}}'), +// ); // Condition. - $conditions = array( - $db->quoteName('name') . ' = ' . $db->quote('com_demo') - ); - $query->update($db->quoteName('#__assets'))->set($fields)->where($conditions); - $db->setQuery($query); - $allDone = $db->execute(); +// $conditions = array( +// $db->quoteName('name') . ' = ' . $db->quote('com_demo') +// ); +// $query->update($db->quoteName('#__assets'))->set($fields)->where($conditions); +// $db->setQuery($query); +// $allDone = $db->execute(); // Install the global extenstion params. $query = $db->getQuery(true); @@ -518,93 +528,93 @@ class com_demoInstallerScript $allDone = $db->execute(); - // Get Application object - $app = JFactory::getApplication(); + // Get Application object + $app = Factory::getApplication(); $app->enqueueMessage('This is a demo component developed in JCB! You can build more components like this with JCB, checkout our page on github for more info. The future of Joomla Component Development is Here!', 'Info'); - // Get the biggest rule column in the assets table at this point. - $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; - $db->setQuery($get_rule_length); - if ($db->execute()) - { - $rule_length = $db->loadResult(); - // Check the size of the rules column - if ($rule_length <= 5600) - { - // Fix the assets table rules column size - $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; - $db->setQuery($fix_rules_size); - $db->execute(); - $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); - } - } - echo ' - - '; +// // Get the biggest rule column in the assets table at this point. +// $get_rule_length = "SELECT CHAR_LENGTH(`rules`) as rule_size FROM #__assets ORDER BY rule_size DESC LIMIT 1"; +// $db->setQuery($get_rule_length); +// if ($db->execute()) +// { +// $rule_length = $db->loadResult(); +// // Check the size of the rules column +// if ($rule_length <= 5600) +// { +// // Fix the assets table rules column size +// $fix_rules_size = "ALTER TABLE `#__assets` CHANGE `rules` `rules` TEXT NOT NULL COMMENT 'JSON encoded access control. Enlarged to TEXT by JCB';"; +// $db->setQuery($fix_rules_size); +// $db->execute(); +// $app->enqueueMessage(JText::_('The #__assets table rules column was resized to the TEXT datatype for the components possible large permission rules.')); +// } +// } +// echo ' +// +// '; // Set db if not set already. - if (!isset($db)) - { - $db = JFactory::getDbo(); - } - // Create the demo action logs extensions object. - $demo_action_logs_extensions = new stdClass(); - $demo_action_logs_extensions->extension = 'com_demo'; - - // Set the object into the action logs extensions table. - $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions); - - // Set db if not set already. - if (!isset($db)) - { - $db = JFactory::getDbo(); - } - // Create the look action log config object. - $look_action_log_config = new stdClass(); - $look_action_log_config->type_title = 'LOOK'; - $look_action_log_config->type_alias = 'com_demo.look'; - $look_action_log_config->id_holder = 'id'; - $look_action_log_config->title_holder = 'name'; - $look_action_log_config->table_name = '#__demo_look'; - $look_action_log_config->text_prefix = 'COM_DEMO'; - - // Set the object into the action log config table. - $look_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config); - } - // do any updates needed - if ($type === 'update') +// if (!isset($db)) +// { +// $db = Factory::getDbo(); +// } +// // Create the demo action logs extensions object. +// $demo_action_logs_extensions = new stdClass(); +// $demo_action_logs_extensions->extension = 'com_demo'; +// +// // Set the object into the action logs extensions table. +// $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions); +// +// // Set db if not set already. +// if (!isset($db)) +// { +// $db = Factory::getDbo(); +// } +// // Create the look action log config object. +// $look_action_log_config = new stdClass(); +// $look_action_log_config->type_title = 'LOOK'; +// $look_action_log_config->type_alias = 'com_demo.look'; +// $look_action_log_config->id_holder = 'id'; +// $look_action_log_config->title_holder = 'name'; +// $look_action_log_config->table_name = '#__demo_look'; +// $look_action_log_config->text_prefix = 'COM_DEMO'; +// +// // Set the object into the action log config table. +// $look_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config); + } + // do any updates needed + if ($type === 'update') { // Get The Database object - $db = JFactory::getDbo(); +// $db = Factory::getDbo(); // Create the look content type object. - $look = new stdClass(); - $look->type_title = 'Demo Look'; - $look->type_alias = 'com_demo.look'; - $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}'; - $look->router = 'DemoHelperRoute::getLookRoute'; - $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; +// $look = new stdClass(); +// $look->type_title = 'Demo Look'; +// $look->type_alias = 'com_demo.look'; +// $look->table = '{"special": {"dbtable": "#__demo_look","key": "id","type": "Look","prefix": "demoTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; +// $look->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "alias","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "metadata","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "metakey","core_metadesc": "metadesc","core_catid": "null","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","description":"description","website":"website","image":"image","dateofbirth":"dateofbirth","mobile_phone":"mobile_phone","email":"email","add":"add","alias":"alias"}}'; +// $look->router = 'DemoHelperRoute::getLookRoute'; +// $look->content_history_options = '{"formFile": "administrator/components/com_demo/models/forms/look.xml","hideFields": ["asset_id","checked_out","checked_out_time","version"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","add"],"displayLookup": [{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"}]}'; // Check if look type is already in content_type DB. - $look_id = null; - $query = $db->getQuery(true); - $query->select($db->quoteName(array('type_id'))); - $query->from($db->quoteName('#__content_types')); - $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look->type_alias)); - $db->setQuery($query); - $db->execute(); - - // Set the object into the content types table. - if ($db->getNumRows()) - { - $look->type_id = $db->loadResult(); - $look_Updated = $db->updateObject('#__content_types', $look, 'type_id'); - } - else - { - $look_Inserted = $db->insertObject('#__content_types', $look); - } +// $look_id = null; +// $query = $db->getQuery(true); +// $query->select($db->quoteName(array('type_id'))); +// $query->from($db->quoteName('#__content_types')); +// $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look->type_alias)); +// $db->setQuery($query); +// $db->execute(); +// +// // Set the object into the content types table. +// if ($db->getNumRows()) +// { +// $look->type_id = $db->loadResult(); +// $look_Updated = $db->updateObject('#__content_types', $look, 'type_id'); +// } +// else +// { +// $look_Inserted = $db->insertObject('#__content_types', $look); +// } echo ' @@ -613,164 +623,164 @@ class com_demoInstallerScript

Upgrade to Version 2.0.3 Was Successful! Let us know if anything is not working as expected.

'; // Set db if not set already. - if (!isset($db)) - { - $db = JFactory::getDbo(); - } - // Create the demo action logs extensions object. - $demo_action_logs_extensions = new stdClass(); - $demo_action_logs_extensions->extension = 'com_demo'; - - // Check if demo action log extension is already in action logs extensions DB. - $query = $db->getQuery(true); - $query->select($db->quoteName(array('id'))); - $query->from($db->quoteName('#__action_logs_extensions')); - $query->where($db->quoteName('extension') . ' LIKE '. $db->quote($demo_action_logs_extensions->extension)); - $db->setQuery($query); - $db->execute(); - - // Set the object into the action logs extensions table if not found. - if (!$db->getNumRows()) - { - $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions); - } - - // Set db if not set already. - if (!isset($db)) - { - $db = JFactory::getDbo(); - } - // Create the look action log config object. - $look_action_log_config = new stdClass(); - $look_action_log_config->id = null; - $look_action_log_config->type_title = 'LOOK'; - $look_action_log_config->type_alias = 'com_demo.look'; - $look_action_log_config->id_holder = 'id'; - $look_action_log_config->title_holder = 'name'; - $look_action_log_config->table_name = '#__demo_look'; - $look_action_log_config->text_prefix = 'COM_DEMO'; - - // Check if look action log config is already in action_log_config DB. - $query = $db->getQuery(true); - $query->select($db->quoteName(array('id'))); - $query->from($db->quoteName('#__action_log_config')); - $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look_action_log_config->type_alias)); - $db->setQuery($query); - $db->execute(); - +// if (!isset($db)) +// { +// $db = Factory::getDbo(); +// } +// // Create the demo action logs extensions object. +// $demo_action_logs_extensions = new stdClass(); +// $demo_action_logs_extensions->extension = 'com_demo'; +// +// // Check if demo action log extension is already in action logs extensions DB. +// $query = $db->getQuery(true); +// $query->select($db->quoteName(array('id'))); +// $query->from($db->quoteName('#__action_logs_extensions')); +// $query->where($db->quoteName('extension') . ' LIKE '. $db->quote($demo_action_logs_extensions->extension)); +// $db->setQuery($query); +// $db->execute(); +// +// // Set the object into the action logs extensions table if not found. +// if (!$db->getNumRows()) +// { +// $demo_action_logs_extensions_Inserted = $db->insertObject('#__action_logs_extensions', $demo_action_logs_extensions); +// } +// +// // Set db if not set already. +// if (!isset($db)) +// { +// $db = Factory::getDbo(); +// } +// // Create the look action log config object. +// $look_action_log_config = new stdClass(); +// $look_action_log_config->id = null; +// $look_action_log_config->type_title = 'LOOK'; +// $look_action_log_config->type_alias = 'com_demo.look'; +// $look_action_log_config->id_holder = 'id'; +// $look_action_log_config->title_holder = 'name'; +// $look_action_log_config->table_name = '#__demo_look'; +// $look_action_log_config->text_prefix = 'COM_DEMO'; +// +// // Check if look action log config is already in action_log_config DB. +// $query = $db->getQuery(true); +// $query->select($db->quoteName(array('id'))); +// $query->from($db->quoteName('#__action_log_config')); +// $query->where($db->quoteName('type_alias') . ' LIKE '. $db->quote($look_action_log_config->type_alias)); +// $db->setQuery($query); +// $db->execute(); +// // Set the object into the content types table. - if ($db->getNumRows()) +// if ($db->getNumRows()) +// { +// $look_action_log_config->id = $db->loadResult(); +// $look_action_log_config_Updated = $db->updateObject('#__action_log_config', $look_action_log_config, 'id'); +// } +// else +// { +// $look_action_log_config_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config); +// } + } + return true; + } + + /** + * Remove folders with files + * + * @param string $dir The path to folder to remove + * @param boolean $ignore The folders and files to ignore and not remove + * + * @return boolean True in all is removed + * + */ + protected function removeFolder($dir, $ignore = false) + { + if (JFolder::exists($dir)) + { + $it = new RecursiveDirectoryIterator($dir); + $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); + // remove ending / + $dir = rtrim($dir, '/'); + // now loop the files & folders + foreach ($it as $file) { - $look_action_log_config->id = $db->loadResult(); - $look_action_log_config_Updated = $db->updateObject('#__action_log_config', $look_action_log_config, 'id'); + if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; + // set file dir + $file_dir = $file->getPathname(); + // check if this is a dir or a file + if ($file->isDir()) + { + $keeper = false; + if ($this->checkArray($ignore)) + { + foreach ($ignore as $keep) + { + if (strpos($file_dir, $dir.'/'.$keep) !== false) + { + $keeper = true; + } + } + } + if ($keeper) + { + continue; + } + JFolder::delete($file_dir); + } + else + { + $keeper = false; + if ($this->checkArray($ignore)) + { + foreach ($ignore as $keep) + { + if (strpos($file_dir, $dir.'/'.$keep) !== false) + { + $keeper = true; + } + } + } + if ($keeper) + { + continue; + } + JFile::delete($file_dir); + } } - else + // delete the root folder if not ignore found + if (!$this->checkArray($ignore)) { - $look_action_log_config_Inserted = $db->insertObject('#__action_log_config', $look_action_log_config); - } - } - return true; - } - - /** - * Remove folders with files - * - * @param string $dir The path to folder to remove - * @param boolean $ignore The folders and files to ignore and not remove - * - * @return boolean True in all is removed - * - */ - protected function removeFolder($dir, $ignore = false) - { - if (JFolder::exists($dir)) - { - $it = new RecursiveDirectoryIterator($dir); - $it = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST); - // remove ending / - $dir = rtrim($dir, '/'); - // now loop the files & folders - foreach ($it as $file) - { - if ('.' === $file->getBasename() || '..' === $file->getBasename()) continue; - // set file dir - $file_dir = $file->getPathname(); - // check if this is a dir or a file - if ($file->isDir()) - { - $keeper = false; - if ($this->checkArray($ignore)) - { - foreach ($ignore as $keep) - { - if (strpos($file_dir, $dir.'/'.$keep) !== false) - { - $keeper = true; - } - } - } - if ($keeper) - { - continue; - } - JFolder::delete($file_dir); - } - else - { - $keeper = false; - if ($this->checkArray($ignore)) - { - foreach ($ignore as $keep) - { - if (strpos($file_dir, $dir.'/'.$keep) !== false) - { - $keeper = true; - } - } - } - if ($keeper) - { - continue; - } - JFile::delete($file_dir); - } - } - // delete the root folder if not ignore found - if (!$this->checkArray($ignore)) - { - return JFolder::delete($dir); - } - return true; - } - return false; - } - - /** - * Check if have an array with a length - * - * @input array The array to check - * - * @returns bool/int number of items in array on success - */ - protected function checkArray($array, $removeEmptyString = false) - { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return $this->checkArray($array, false); - } - return $nr; - } - return false; + return JFolder::delete($dir); + } + return true; + } + return false; + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + */ + protected function checkArray($array, $removeEmptyString = false) + { + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return $this->checkArray($array, false); + } + return $nr; + } + return false; } /** @@ -806,5 +816,5 @@ class com_demoInstallerScript } } } - } -} + } +} -- 2.45.1 From 64390bd418fd453f61c27d5c066fed21f9a2e146 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Mon, 18 Oct 2021 21:47:53 +0200 Subject: [PATCH 17/20] Upgraded to JCB v2.12.10 --- README.md | 4 +- admin/README.txt | 4 +- admin/access.xml | 6 +- admin/assets/css/admin.css | 48 +- admin/assets/css/dashboard.css | 342 +-- admin/assets/css/look.css | 44 +- admin/assets/css/looks.css | 44 +- admin/assets/js/admin.js | 34 +- admin/config.xml | 36 +- admin/controller.php | 238 +- admin/controllers/demo.php | 58 +- admin/controllers/import.php | 126 +- admin/controllers/look.php | 540 ++-- admin/controllers/looks.php | 106 +- admin/demo.php | 94 +- admin/helpers/demo.php | 2693 +++++++++-------- admin/helpers/headercheck.php | 156 +- admin/helpers/html/batch_.php | 172 +- admin/layouts/batchselection.php | 110 +- admin/layouts/look/details_above.php | 104 +- admin/layouts/look/details_fullwidth.php | 104 +- admin/layouts/look/details_under.php | 104 +- admin/layouts/look/metadata.php | 98 +- admin/layouts/look/more_left.php | 100 +- admin/layouts/look/more_right.php | 100 +- admin/layouts/look/publishing.php | 100 +- admin/layouts/trashhelper.php | 46 +- admin/models/demo.php | 446 +-- admin/models/forms/filter_looks.xml | 16 +- admin/models/forms/look.js | 157 - admin/models/forms/look.xml | 18 +- admin/models/import.php | 926 +++--- admin/models/look.php | 898 +++--- admin/models/looks.php | 206 +- admin/sql/updates/mysql/2.0.0.sql | 2 +- admin/sql/updates/mysql/2.0.2.sql | 2 +- admin/tables/look.php | 636 ++-- admin/views/demo/tmpl/default.php | 48 +- admin/views/demo/tmpl/default_main.php | 74 +- admin/views/demo/tmpl/default_vdm.php | 90 +- admin/views/demo/view.html.php | 192 +- admin/views/import/tmpl/default.php | 448 +-- admin/views/import/view.html.php | 202 +- admin/views/look/submitbutton.js | 66 +- admin/views/look/tmpl/edit.php | 60 +- admin/views/look/view.html.php | 256 +- admin/views/looks/tmpl/default.php | 60 +- admin/views/looks/tmpl/default_batch_body.php | 50 +- .../views/looks/tmpl/default_batch_footer.php | 60 +- admin/views/looks/tmpl/default_body.php | 50 +- admin/views/looks/tmpl/default_foot.php | 50 +- admin/views/looks/tmpl/default_head.php | 46 +- admin/views/looks/tmpl/default_toolbar.php | 104 +- admin/views/looks/view.html.php | 380 +-- demo.xml | 182 +- script.php | 478 +-- site/assets/css/look.css | 44 +- site/assets/css/looking.css | 44 +- site/assets/css/looks.css | 44 +- site/assets/css/site.css | 48 +- site/assets/js/site.js | 34 +- site/controller.php | 258 +- site/controllers/look.php | 540 ++-- site/demo.php | 82 +- site/helpers/category.php | 34 +- site/helpers/demo.php | 2673 ++++++++-------- site/helpers/headercheck.php | 156 +- site/helpers/route.php | 440 +-- site/layouts/look/details_above.php | 104 +- site/layouts/look/details_fullwidth.php | 104 +- site/layouts/look/details_under.php | 104 +- site/layouts/look/metadata.php | 98 +- site/layouts/look/more_left.php | 100 +- site/layouts/look/more_right.php | 100 +- site/layouts/look/publishing.php | 100 +- site/models/forms/look.js | 40 +- site/models/forms/look.xml | 18 +- site/models/look.php | 898 +++--- site/models/looking.php | 250 +- site/models/looks.php | 160 +- site/router.php | 440 +-- site/views/look/submitbutton.js | 66 +- site/views/look/tmpl/edit.php | 60 +- site/views/look/view.html.php | 282 +- site/views/looking/tmpl/default.php | 50 +- site/views/looking/view.html.php | 158 +- site/views/looks/tmpl/default.php | 50 +- site/views/looks/view.html.php | 158 +- 88 files changed, 9690 insertions(+), 9861 deletions(-) delete mode 100644 admin/models/forms/look.js diff --git a/README.md b/README.md index c1a101c..6b6461a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Demo](https://www.vdm.io/) + *First Build*: 18th October, 2016 -+ *Last Build*: 8th February, 2021 ++ *Last Build*: 18th October, 2021 + *Version*: 2.0.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -23,7 +23,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **16831** ++ *Line count*: **16817** + *File count*: **156** + *Folder count*: **57** diff --git a/admin/README.txt b/admin/README.txt index c1a101c..6b6461a 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -10,7 +10,7 @@ Just a basic demo of the most basic implementations of the [Joomla](http://www.j + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Demo](https://www.vdm.io/) + *First Build*: 18th October, 2016 -+ *Last Build*: 8th February, 2021 ++ *Last Build*: 18th October, 2021 + *Version*: 2.0.3 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html @@ -23,7 +23,7 @@ due to [Automated Component Builder](https://www.vdm.io/joomla-component-builder > (if creating a folder and file took **5 seconds** and writing one line of code took **10 seconds**, > never making one mistake or taking any coffee break.) -+ *Line count*: **16831** ++ *Line count*: **16817** + *File count*: **156** + *Folder count*: **57** diff --git a/admin/access.xml b/admin/access.xml index 1763447..575e0fb 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -1,5 +1,5 @@ - - + +
@@ -62,5 +62,5 @@ -
+
\ No newline at end of file diff --git a/admin/assets/css/admin.css b/admin/assets/css/admin.css index 19714a1..70781c5 100644 --- a/admin/assets/css/admin.css +++ b/admin/assets/css/admin.css @@ -1,24 +1,24 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage admin.css - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ -.no-click { - pointer-events: none; -} - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage admin.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ +.no-click { + pointer-events: none; +} + diff --git a/admin/assets/css/dashboard.css b/admin/assets/css/dashboard.css index 359dba6..a376faf 100644 --- a/admin/assets/css/dashboard.css +++ b/admin/assets/css/dashboard.css @@ -1,172 +1,172 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage dashboard.css - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - -.dashboard-container { - margin-left: 10px; - margin-top: 10px; - width: 100%; -} -.dashboard-container [class*="span"] { - display: block; - float: none; - margin-left: 0; - width: auto; -} -.dashboard-container:before, .dashboard-container:after { - content: ""; - display: table; -} -.dashboard-container:after { - clear: both; -} -.dashboard-container [class*="span"] { - box-sizing: border-box; - display: block; - float: left; - min-height: 145px; - min-width: 96px; - width: 100%; -} -.dashboard-container [class*="span"]:first-child { - margin-left: 0; -} -.dashboard-wraper { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 5px; - float: left; - margin: 1%; - padding: 3px; - width: 17%; - min-height: 194px; - min-width: 96px; -} -.dashboard-content a { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - min-height: 89px; - padding: 10px; - text-align: center; - text-decoration: none; -} -.dashboard-content a:hover { - background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - color: hsl(200, 100%, 30%); - text-decoration: none; -} -.dashboard-title { - display: block; - padding-top: 5px; -} -.dashboard-info { - background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 85%); - border-radius: 4px; - box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; - color: hsl(0, 0%, 20%); - display: block; - font-size: 12px; - padding: 10px; - text-align: center; -} -.dashboard-info span { - display: block; - text-align: center; -} -.dashboard-info img { - margin: 0 auto; -} -.dashboard-table { - border-top: 1px solid hsl(0, 0%, 87%); - margin-top: 5px; - width: 100%; -} -.dashboard-info h5 { - font-size: 11px; - font-weight: bold; -} -.dashboard-block { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border: 1px solid hsl(0, 0%, 76%); - border-radius: 3px; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; - margin-bottom: 20px; -} -.dashboard-block .dashboard-block-head { - background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); - border-bottom: 1px solid hsl(0, 0%, 76%); - border-radius: 3px 3px 0 0; - box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); - height: 40px; - position: relative; -} -.dashboard-block .dashboard-block-head h5 { - font-size: 12px; - margin: 0; - padding-left: 10px; - padding-top: 11px; - text-transform: uppercase; -} -.dashboard-block .dashboard-block-content { - background: none repeat scroll 0 0 hsl(0, 0%, 93%); - border-radius: 0 0 3px 3px; -} -.dashboard-block .dashboard-block-box { - background: none repeat scroll 0 0 hsl(0, 0%, 100%); - border-top: 1px solid hsl(0, 0%, 82%); - box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; -} -.dashboard-block .dashboard-block-content .dashboard-block-box { - margin-top: 0 !important; -} -.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { - margin-bottom: 0 !important; -} -.dashboard-block-table { - background-color: hsla(0, 0%, 0%, 0); - border-collapse: collapse; - border-spacing: 0; - margin-bottom: 20px; - max-width: 100%; - width: 100%; -} -.dashboard-block-table th, .dashboard-block-table td { - border-top: 1px solid hsl(0, 0%, 87%); - line-height: 20px; - padding: 5px; - text-align: left; - vertical-align: middle; -} -.dashboard-badge { - background-color: hsl(0, 0%, 60%); - border-radius: 9px; - color: hsl(0, 0%, 100%); - font-size: 11.844px; - font-weight: bold; - line-height: 14px; - padding: 1px 9px 2px; - text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); - vertical-align: baseline; - white-space: nowrap; +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage dashboard.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + +.dashboard-container { + margin-left: 10px; + margin-top: 10px; + width: 100%; +} +.dashboard-container [class*="span"] { + display: block; + float: none; + margin-left: 0; + width: auto; +} +.dashboard-container:before, .dashboard-container:after { + content: ""; + display: table; +} +.dashboard-container:after { + clear: both; +} +.dashboard-container [class*="span"] { + box-sizing: border-box; + display: block; + float: left; + min-height: 145px; + min-width: 96px; + width: 100%; +} +.dashboard-container [class*="span"]:first-child { + margin-left: 0; +} +.dashboard-wraper { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 5px; + float: left; + margin: 1%; + padding: 3px; + width: 17%; + min-height: 194px; + min-width: 96px; +} +.dashboard-content a { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + min-height: 89px; + padding: 10px; + text-align: center; + text-decoration: none; +} +.dashboard-content a:hover { + background: linear-gradient(to bottom, hsl(0, 0%, 90%) 0%, hsl(0, 0%, 100%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + color: hsl(200, 100%, 30%); + text-decoration: none; +} +.dashboard-title { + display: block; + padding-top: 5px; +} +.dashboard-info { + background: linear-gradient(to bottom, hsl(0, 0%, 100%) 0%, hsl(0, 0%, 96%) 47%, hsl(0, 0%, 93%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 85%); + border-radius: 4px; + box-shadow: 0 0 3px hsla(0, 0%, 0%, 0.1) inset; + color: hsl(0, 0%, 20%); + display: block; + font-size: 12px; + padding: 10px; + text-align: center; +} +.dashboard-info span { + display: block; + text-align: center; +} +.dashboard-info img { + margin: 0 auto; +} +.dashboard-table { + border-top: 1px solid hsl(0, 0%, 87%); + margin-top: 5px; + width: 100%; +} +.dashboard-info h5 { + font-size: 11px; + font-weight: bold; +} +.dashboard-block { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border: 1px solid hsl(0, 0%, 76%); + border-radius: 3px; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset; + margin-bottom: 20px; +} +.dashboard-block .dashboard-block-head { + background: linear-gradient(to bottom, hsl(0, 0%, 95%) 0%, hsl(0, 0%, 86%) 100%) repeat scroll 0 0 hsla(0, 0%, 0%, 0); + border-bottom: 1px solid hsl(0, 0%, 76%); + border-radius: 3px 3px 0 0; + box-shadow: 0 1px 0 hsl(0, 0%, 98%) inset, 0 0 3px hsl(0, 0%, 87%); + height: 40px; + position: relative; +} +.dashboard-block .dashboard-block-head h5 { + font-size: 12px; + margin: 0; + padding-left: 10px; + padding-top: 11px; + text-transform: uppercase; +} +.dashboard-block .dashboard-block-content { + background: none repeat scroll 0 0 hsl(0, 0%, 93%); + border-radius: 0 0 3px 3px; +} +.dashboard-block .dashboard-block-box { + background: none repeat scroll 0 0 hsl(0, 0%, 100%); + border-top: 1px solid hsl(0, 0%, 82%); + box-shadow: 0 0 5px hsl(0, 0%, 87%) inset; +} +.dashboard-block .dashboard-block-content .dashboard-block-box { + margin-top: 0 !important; +} +.dashboard-block .dashboard-block-content .dashboard-block-box .dashboard-block-table { + margin-bottom: 0 !important; +} +.dashboard-block-table { + background-color: hsla(0, 0%, 0%, 0); + border-collapse: collapse; + border-spacing: 0; + margin-bottom: 20px; + max-width: 100%; + width: 100%; +} +.dashboard-block-table th, .dashboard-block-table td { + border-top: 1px solid hsl(0, 0%, 87%); + line-height: 20px; + padding: 5px; + text-align: left; + vertical-align: middle; +} +.dashboard-badge { + background-color: hsl(0, 0%, 60%); + border-radius: 9px; + color: hsl(0, 0%, 100%); + font-size: 11.844px; + font-weight: bold; + line-height: 14px; + padding: 1px 9px 2px; + text-shadow: 0 -1px 0 hsla(0, 0%, 0%, 0.25); + vertical-align: baseline; + white-space: nowrap; } \ No newline at end of file diff --git a/admin/assets/css/look.css b/admin/assets/css/look.css index 74b5952..26a550b 100644 --- a/admin/assets/css/look.css +++ b/admin/assets/css/look.css @@ -1,22 +1,22 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage look.css - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage look.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/css/looks.css b/admin/assets/css/looks.css index 2a7428e..8373210 100644 --- a/admin/assets/css/looks.css +++ b/admin/assets/css/looks.css @@ -1,22 +1,22 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage looks.css - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - -/------------------------------------------------------------------------------------------------------*/ - -/* CSS Document */ - - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage looks.css + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/assets/js/admin.js b/admin/assets/js/admin.js index 754d51a..706aecb 100644 --- a/admin/assets/js/admin.js +++ b/admin/assets/js/admin.js @@ -1,20 +1,20 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage admin.js - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage admin.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + /------------------------------------------------------------------------------------------------------*/ /* JS Document */ diff --git a/admin/config.xml b/admin/config.xml index 52f4bc2..ba48a93 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -1,5 +1,5 @@ - - + +
COM_DEMO_CONFIG_GRADIANT_LOAD" -
-
- -
+ +
+ +
\ No newline at end of file diff --git a/admin/controller.php b/admin/controller.php index dd8a022..2eb2530 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -1,121 +1,121 @@ - @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'); - -use Joomla\Utilities\ArrayHelper; - -/** - * General Controller of Demo component - */ -class DemoController extends JControllerLegacy -{ - /** - * Constructor. - * - * @param array $config An optional associative array of configuration settings. - * Recognized key values include 'name', 'default_task', 'model_path', and - * 'view_path' (this list is not meant to be comprehensive). - * - * @since 3.0 - */ - public function __construct($config = array()) - { - // set the default view - $config['default_view'] = 'demo'; - - parent::__construct($config); - } - - /** - * display task - * - * @return void - */ - function display($cachable = false, $urlparams = false) - { - // set default view if not set - $view = $this->input->getCmd('view', 'demo'); - $data = $this->getViewRelation($view); - $layout = $this->input->get('layout', null, 'WORD'); - $id = $this->input->getInt('id'); - - // Check for edit form. - if(DemoHelper::checkArray($data)) - { - if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_demo.edit.'.$data['view'], $id)) - { - // Somehow the person just went to the form - we don't allow that. - $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); - $this->setMessage($this->getError(), 'error'); - // check if item was opend from other then its own list view - $ref = $this->input->getCmd('ref', 0); - $refid = $this->input->getInt('refid', 0); - // set redirect - if ($refid > 0 && DemoHelper::checkString($ref)) - { - // redirect to item of ref - $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); - } - elseif (DemoHelper::checkString($ref)) - { - - // redirect to ref - $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false)); - } - else - { - // normal redirect back to the list view - $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false)); - } - - return false; - } - } - - return parent::display($cachable, $urlparams); - } - - protected function getViewRelation($view) - { - // check the we have a value - if (DemoHelper::checkString($view)) - { - // the view relationships +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage controller.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Utilities\ArrayHelper; + +/** + * General Controller of Demo component + */ +class DemoController extends JControllerLegacy +{ + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * Recognized key values include 'name', 'default_task', 'model_path', and + * 'view_path' (this list is not meant to be comprehensive). + * + * @since 3.0 + */ + public function __construct($config = array()) + { + // set the default view + $config['default_view'] = 'demo'; + + parent::__construct($config); + } + + /** + * display task + * + * @return void + */ + function display($cachable = false, $urlparams = false) + { + // set default view if not set + $view = $this->input->getCmd('view', 'demo'); + $data = $this->getViewRelation($view); + $layout = $this->input->get('layout', null, 'WORD'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if(DemoHelper::checkArray($data)) + { + if ($data['edit'] && $layout == 'edit' && !$this->checkEditId('com_demo.edit.'.$data['view'], $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + // check if item was opend from other then its own list view + $ref = $this->input->getCmd('ref', 0); + $refid = $this->input->getInt('refid', 0); + // set redirect + if ($refid > 0 && DemoHelper::checkString($ref)) + { + // redirect to item of ref + $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref.'&layout=edit&id='.(int)$refid, false)); + } + elseif (DemoHelper::checkString($ref)) + { + + // redirect to ref + $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.(string)$ref, false)); + } + else + { + // normal redirect back to the list view + $this->setRedirect(JRoute::_('index.php?option=com_demo&view='.$data['views'], false)); + } + + return false; + } + } + + return parent::display($cachable, $urlparams); + } + + protected function getViewRelation($view) + { + // check the we have a value + if (DemoHelper::checkString($view)) + { + // the view relationships $views = array( - 'look' => 'looks' - ); - // check if this is a list view - if (in_array($view, $views)) - { - // this is a list view - return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); - } - // check if it is an edit view - elseif (array_key_exists($view, $views)) - { - // this is a edit view - return array('edit' => true, 'view' => $view, 'views' => $views[$view]); - } - } - return false; - } -} + 'look' => 'looks' + ); + // check if this is a list view + if (in_array($view, $views)) + { + // this is a list view + return array('edit' => false, 'view' => array_search($view,$views), 'views' => $view); + } + // check if it is an edit view + elseif (array_key_exists($view, $views)) + { + // this is a edit view + return array('edit' => true, 'view' => $view, 'views' => $views[$view]); + } + } + return false; + } +} diff --git a/admin/controllers/demo.php b/admin/controllers/demo.php index 20666a0..f460c8b 100644 --- a/admin/controllers/demo.php +++ b/admin/controllers/demo.php @@ -1,30 +1,30 @@ - @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'); - -/** - * Demo Controller - */ -class DemoControllerDemo extends JControllerAdmin -{ - -} +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage demo.php + @author Llewellyn van der Merwe + @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'); + +/** + * Demo Controller + */ +class DemoControllerDemo extends JControllerAdmin +{ + +} diff --git a/admin/controllers/import.php b/admin/controllers/import.php index 9e8d212..bf051ba 100644 --- a/admin/controllers/import.php +++ b/admin/controllers/import.php @@ -1,64 +1,64 @@ - @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'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Demo Import Controller - */ -class DemoControllerImport extends JControllerLegacy -{ - /** - * Import an spreadsheet. - * - * @return void - */ - public function import() - { - // Check for request forgeries - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - $model = $this->getModel('import'); - if ($model->import()) - { - $cache = JFactory::getCache('mod_menu'); - $cache->clean(); - // TODO: Reset the users acl here as well to kill off any missing bits - } - - $app = JFactory::getApplication(); - $redirect_url = $app->getUserState('com_demo.redirect_url'); - if (empty($redirect_url)) - { - $redirect_url = JRoute::_('index.php?option=com_demo&view=import', false); - } - else - { - // wipe out the user state when we're going to redirect - $app->setUserState('com_demo.redirect_url', ''); - $app->setUserState('com_demo.message', ''); - $app->setUserState('com_demo.extension_message', ''); - } - $this->setRedirect($redirect_url); - } -} +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage import.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Demo Import Controller + */ +class DemoControllerImport extends JControllerLegacy +{ + /** + * Import an spreadsheet. + * + * @return void + */ + public function import() + { + // Check for request forgeries + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $model = $this->getModel('import'); + if ($model->import()) + { + $cache = JFactory::getCache('mod_menu'); + $cache->clean(); + // TODO: Reset the users acl here as well to kill off any missing bits + } + + $app = JFactory::getApplication(); + $redirect_url = $app->getUserState('com_demo.redirect_url'); + if (empty($redirect_url)) + { + $redirect_url = JRoute::_('index.php?option=com_demo&view=import', false); + } + else + { + // wipe out the user state when we're going to redirect + $app->setUserState('com_demo.redirect_url', ''); + $app->setUserState('com_demo.message', ''); + $app->setUserState('com_demo.extension_message', ''); + } + $this->setRedirect($redirect_url); + } +} diff --git a/admin/controllers/look.php b/admin/controllers/look.php index 7122719..40075e1 100644 --- a/admin/controllers/look.php +++ b/admin/controllers/look.php @@ -1,65 +1,65 @@ - @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'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Look Controller - */ -class DemoControllerLook extends JControllerForm -{ - /** - * Current or most recently performed task. - * - * @var string - * @since 12.2 - * @note Replaces _task. - */ - protected $task; - - /** - * Class constructor. - * - * @param array $config A named array of configuration variables. - * - * @since 1.6 - */ - public function __construct($config = array()) - { - $this->view_list = 'Looks'; // safeguard for setting the return view listing to the main view. - parent::__construct($config); - } - - /** - * Method override to check if you can add a new record. - * - * @param array $data An array of input data. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowAdd($data = array()) +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage look.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Look Controller + */ +class DemoControllerLook extends JControllerForm +{ + /** + * Current or most recently performed task. + * + * @var string + * @since 12.2 + * @note Replaces _task. + */ + protected $task; + + /** + * Class constructor. + * + * @param array $config A named array of configuration variables. + * + * @since 1.6 + */ + public function __construct($config = array()) + { + $this->view_list = 'Looks'; // safeguard for setting the return view listing to the main view. + parent::__construct($config); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowAdd($data = array()) { // Get user object. $user = JFactory::getUser(); @@ -71,20 +71,20 @@ class DemoControllerLook extends JControllerForm } // In the absense of better information, revert to the component permissions. - return $user->authorise('look.create', $this->option); - } - - /** - * Method override to check if you can edit an existing record. - * - * @param array $data An array of input data. - * @param string $key The name of the key for the primary key. - * - * @return boolean - * - * @since 1.6 - */ - protected function allowEdit($data = array(), $key = 'id') + return $user->authorise('look.create', $this->option); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'id') { // get user object. $user = JFactory::getUser(); @@ -134,199 +134,199 @@ class DemoControllerLook extends JControllerForm } } // Since there is no permission, revert to the component permissions. - return $user->authorise('look.edit', $this->option); - } - - /** - * Gets the URL arguments to append to an item redirect. - * - * @param integer $recordId The primary key id for the item. - * @param string $urlVar The name of the URL variable for the id. - * - * @return string The arguments to append to the redirect URL. - * - * @since 1.6 - */ - protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') - { - // get the referral options (old method use return instead see parent) - $ref = $this->input->get('ref', 0, 'string'); - $refid = $this->input->get('refid', 0, 'int'); - - // get redirect info. - $append = parent::getRedirectToItemAppend($recordId, $urlVar); - - // set the referral options - if ($refid && $ref) - { - $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; - } - elseif ($ref) - { - $append = '&ref='. (string)$ref . $append; - } - - return $append; - } - - /** - * Method to run batch operations. - * - * @param object $model The model. - * - * @return boolean True if successful, false otherwise and internal error is set. - * - * @since 2.5 - */ - public function batch($model = null) - { - JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); - - // Set the model - $model = $this->getModel('Look', '', array()); - - // Preset the redirect - $this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks' . $this->getRedirectToListAppend(), false)); - - return parent::batch($model); - } - - /** - * Method to cancel an edit. - * - * @param string $key The name of the primary key of the URL variable. - * - * @return boolean True if access level checks pass, false otherwise. - * - * @since 12.2 - */ - public function cancel($key = null) - { - // get the referral options - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - // Check if there is a return value - $return = $this->input->get('return', null, 'base64'); - - $cancel = parent::cancel($key); - - if (!is_null($return) && JUri::isInternal(base64_decode($return))) - { - $redirect = base64_decode($return); - - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view='.(string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - return $cancel; - } - - /** - * Method to save a record. - * - * @param string $key The name of the primary key of the URL variable. - * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). - * - * @return boolean True if successful, false otherwise. - * - * @since 12.2 - */ - public function save($key = null, $urlVar = null) - { - // get the referral options - $this->ref = $this->input->get('ref', 0, 'word'); - $this->refid = $this->input->get('refid', 0, 'int'); - - // Check if there is a return value - $return = $this->input->get('return', null, 'base64'); - $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); - - if ($this->ref || $this->refid || $canReturn) - { - // to make sure the item is checkedin on redirect - $this->task = 'save'; - } - - $saved = parent::save($key, $urlVar); - - // This is not needed since parent save already does this - // Due to the ref and refid implementation we need to add this - if ($canReturn) - { - $redirect = base64_decode($return); - - // Redirect to the return value. - $this->setRedirect( - JRoute::_( - $redirect, false - ) - ); - } - elseif ($this->refid && $this->ref) - { - $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; - - // Redirect to the item screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - elseif ($this->ref) - { - $redirect = '&view=' . (string)$this->ref; - - // Redirect to the list screen. - $this->setRedirect( - JRoute::_( - 'index.php?option=' . $this->option . $redirect, false - ) - ); - } - return $saved; - } - - /** - * Function that allows child controller access to model data - * after the data has been saved. - * - * @param JModel &$model The data model object. - * @param array $validData The validated data. - * - * @return void - * - * @since 11.1 - */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) + return $user->authorise('look.edit', $this->option); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since 1.6 + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') { - return; - } - -} + // get the referral options (old method use return instead see parent) + $ref = $this->input->get('ref', 0, 'string'); + $refid = $this->input->get('refid', 0, 'int'); + + // get redirect info. + $append = parent::getRedirectToItemAppend($recordId, $urlVar); + + // set the referral options + if ($refid && $ref) + { + $append = '&ref=' . (string)$ref . '&refid='. (int)$refid . $append; + } + elseif ($ref) + { + $append = '&ref='. (string)$ref . $append; + } + + return $append; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since 2.5 + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Look', '', array()); + + // Preset the redirect + $this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks' . $this->getRedirectToListAppend(), false)); + + return parent::batch($model); + } + + /** + * Method to cancel an edit. + * + * @param string $key The name of the primary key of the URL variable. + * + * @return boolean True if access level checks pass, false otherwise. + * + * @since 12.2 + */ + public function cancel($key = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + + $cancel = parent::cancel($key); + + if (!is_null($return) && JUri::isInternal(base64_decode($return))) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view='.(string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $cancel; + } + + /** + * Method to save a record. + * + * @param string $key The name of the primary key of the URL variable. + * @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). + * + * @return boolean True if successful, false otherwise. + * + * @since 12.2 + */ + public function save($key = null, $urlVar = null) + { + // get the referral options + $this->ref = $this->input->get('ref', 0, 'word'); + $this->refid = $this->input->get('refid', 0, 'int'); + + // Check if there is a return value + $return = $this->input->get('return', null, 'base64'); + $canReturn = (!is_null($return) && JUri::isInternal(base64_decode($return))); + + if ($this->ref || $this->refid || $canReturn) + { + // to make sure the item is checkedin on redirect + $this->task = 'save'; + } + + $saved = parent::save($key, $urlVar); + + // This is not needed since parent save already does this + // Due to the ref and refid implementation we need to add this + if ($canReturn) + { + $redirect = base64_decode($return); + + // Redirect to the return value. + $this->setRedirect( + JRoute::_( + $redirect, false + ) + ); + } + elseif ($this->refid && $this->ref) + { + $redirect = '&view=' . (string)$this->ref . '&layout=edit&id=' . (int)$this->refid; + + // Redirect to the item screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + elseif ($this->ref) + { + $redirect = '&view=' . (string)$this->ref; + + // Redirect to the list screen. + $this->setRedirect( + JRoute::_( + 'index.php?option=' . $this->option . $redirect, false + ) + ); + } + return $saved; + } + + /** + * Function that allows child controller access to model data + * after the data has been saved. + * + * @param JModel &$model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since 11.1 + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + return; + } + +} diff --git a/admin/controllers/looks.php b/admin/controllers/looks.php index 4c10da9..ed6da0f 100644 --- a/admin/controllers/looks.php +++ b/admin/controllers/looks.php @@ -1,55 +1,55 @@ - @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'); - -use Joomla\Utilities\ArrayHelper; - -/** - * Looks Controller - */ -class DemoControllerLooks extends JControllerAdmin -{ - /** - * The prefix to use with controller messages. - * - * @var string - * @since 1.6 - */ - protected $text_prefix = 'COM_DEMO_LOOKS'; - - /** - * Method to get a model object, loading it if required. - * - * @param string $name The model name. Optional. - * @param string $prefix The class prefix. Optional. - * @param array $config Configuration array for model. Optional. - * - * @return JModelLegacy The model. - * - * @since 1.6 - */ - public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array('ignore_request' => true)) - { - return parent::getModel($name, $prefix, $config); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage looks.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\Utilities\ArrayHelper; + +/** + * Looks Controller + */ +class DemoControllerLooks extends JControllerAdmin +{ + /** + * The prefix to use with controller messages. + * + * @var string + * @since 1.6 + */ + protected $text_prefix = 'COM_DEMO_LOOKS'; + + /** + * Method to get a model object, loading it if required. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JModelLegacy The model. + * + * @since 1.6 + */ + public function getModel($name = 'Look', $prefix = 'DemoModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); } public function exportData() @@ -113,5 +113,5 @@ class DemoControllerLooks extends JControllerAdmin $message = JText::_('COM_DEMO_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_demo&view=looks', false), $message, 'error'); return; - } -} + } +} diff --git a/admin/demo.php b/admin/demo.php index 53a6e52..33d06db 100644 --- a/admin/demo.php +++ b/admin/demo.php @@ -1,48 +1,48 @@ - @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'); - -JHtml::_('behavior.tabstate'); - -// Access check. -if (!JFactory::getUser()->authorise('core.manage', 'com_demo')) -{ - throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); -}; - -// Add CSS file for all pages -$document = JFactory::getDocument(); -$document->addStyleSheet('components/com_demo/assets/css/admin.css'); -$document->addScript('components/com_demo/assets/js/admin.js'); - -// require helper files -JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); -JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); - -// Get an instance of the controller prefixed by Demo -$controller = JControllerLegacy::getInstance('Demo'); - -// Perform the Request task -$controller->execute(JFactory::getApplication()->input->get('task')); - -// Redirect if set by the controller -$controller->redirect(); +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage demo.php + @author Llewellyn van der Merwe + @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'); + +JHtml::_('behavior.tabstate'); + +// Access check. +if (!JFactory::getUser()->authorise('core.manage', 'com_demo')) +{ + throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403); +}; + +// Add CSS file for all pages +$document = JFactory::getDocument(); +$document->addStyleSheet('components/com_demo/assets/css/admin.css'); +$document->addScript('components/com_demo/assets/js/admin.js'); + +// require helper files +JLoader::register('DemoHelper', __DIR__ . '/helpers/demo.php'); +JLoader::register('JHtmlBatch_', __DIR__ . '/helpers/html/batch_.php'); + +// Get an instance of the controller prefixed by Demo +$controller = JControllerLegacy::getInstance('Demo'); + +// Perform the Request task +$controller->execute(JFactory::getApplication()->input->get('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/admin/helpers/demo.php b/admin/helpers/demo.php index 49e13e6..725a43f 100644 --- a/admin/helpers/demo.php +++ b/admin/helpers/demo.php @@ -1,51 +1,52 @@ - @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'); - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage demo.php + @author Llewellyn van der Merwe + @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'); + +use Joomla\CMS\Filesystem\File; use Joomla\CMS\Language\Language; use Joomla\Registry\Registry; use Joomla\String\StringHelper; use Joomla\Utilities\ArrayHelper; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; -use PhpOffice\PhpSpreadsheet\Writer\Xlsx; - -/** - * Demo component helper. - */ -abstract class DemoHelper -{ - /** - * Composer Switch - * - * @var array - */ - protected static $composer = array(); - - /** - * The Main Active Language - * - * @var string - */ +use PhpOffice\PhpSpreadsheet\Writer\Xlsx; + +/** + * Demo component helper. + */ +abstract class DemoHelper +{ + /** + * Composer Switch + * + * @var array + */ + protected static $composer = array(); + + /** + * The Main Active Language + * + * @var string + */ public static $langTag; // <<<=== Privacy integration with Joomla Privacy suite ===>>> @@ -251,91 +252,91 @@ abstract class DemoHelper $model->cleanCache(); } } - - - /** - * Load the Composer Vendors - */ - public static function composerAutoload($target) - { - // insure we load the composer vendor only once - if (!isset(self::$composer[$target])) - { - // get the function name - $functionName = self::safeString('compose' . $target); - // check if method exist - if (method_exists(__CLASS__, $functionName)) - { - return self::{$functionName}(); - } - return false; - } - return self::$composer[$target]; - } - - /** - * Load the Component xml manifest. - */ - public static function manifest() - { - $manifestUrl = JPATH_ADMINISTRATOR."/components/com_demo/demo.xml"; - return simplexml_load_file($manifestUrl); - } - - /** - * Joomla version object - */ - protected static $JVersion; - - /** - * set/get Joomla version - */ - public static function jVersion() - { - // check if set - if (!self::checkObject(self::$JVersion)) - { - self::$JVersion = new JVersion(); - } - return self::$JVersion; - } - - /** - * Load the Contributors details. - */ - public static function getContributors() - { - // get params - $params = JComponentHelper::getParams('com_demo'); - // start contributors array - $contributors = array(); - // get all Contributors (max 20) - $searchArray = range('0','20'); - foreach($searchArray as $nr) - { - if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) - { - // set link based of selected option - if($params->get("useContributor".$nr) == 1) - { - $link_front = '
'; - $link_back = ''; - } - elseif($params->get("useContributor".$nr) == 2) - { - $link_front = ''; - $link_back = ''; - } - else - { - $link_front = ''; - $link_back = ''; - } - $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); - $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; - } - } - return $contributors; + + + /** + * Load the Composer Vendors + */ + public static function composerAutoload($target) + { + // insure we load the composer vendor only once + if (!isset(self::$composer[$target])) + { + // get the function name + $functionName = self::safeString('compose' . $target); + // check if method exist + if (method_exists(__CLASS__, $functionName)) + { + return self::{$functionName}(); + } + return false; + } + return self::$composer[$target]; + } + + /** + * Load the Component xml manifest. + */ + public static function manifest() + { + $manifestUrl = JPATH_ADMINISTRATOR."/components/com_demo/demo.xml"; + return simplexml_load_file($manifestUrl); + } + + /** + * Joomla version object + */ + protected static $JVersion; + + /** + * set/get Joomla version + */ + public static function jVersion() + { + // check if set + if (!self::checkObject(self::$JVersion)) + { + self::$JVersion = new JVersion(); + } + return self::$JVersion; + } + + /** + * Load the Contributors details. + */ + public static function getContributors() + { + // get params + $params = JComponentHelper::getParams('com_demo'); + // start contributors array + $contributors = array(); + // get all Contributors (max 20) + $searchArray = range('0','20'); + foreach($searchArray as $nr) + { + if ((NULL !== $params->get("showContributor".$nr)) && ($params->get("showContributor".$nr) == 1 || $params->get("showContributor".$nr) == 3)) + { + // set link based of selected option + if($params->get("useContributor".$nr) == 1) + { + $link_front = ''; + $link_back = ''; + } + elseif($params->get("useContributor".$nr) == 2) + { + $link_front = ''; + $link_back = ''; + } + else + { + $link_front = ''; + $link_back = ''; + } + $contributors[$nr]['title'] = self::htmlEscape($params->get("titleContributor".$nr)); + $contributors[$nr]['name'] = $link_front.self::htmlEscape($params->get("nameContributor".$nr)).$link_back; + } + } + return $contributors; } /** @@ -344,16 +345,16 @@ abstract class DemoHelper public static function getHelpUrl($view) { return false; - } - - /** - * Configure the Linkbar. - */ - public static function addSubmenu($submenu) - { - // load user for access menus - $user = JFactory::getUser(); - // load the submenus to sidebar + } + + /** + * Configure the Linkbar. + */ + public static function addSubmenu($submenu) + { + // load user for access menus + $user = JFactory::getUser(); + // load the submenus to sidebar JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_DASHBOARD'), 'index.php?option=com_demo&view=demo', $submenu === 'demo'); if ($user->authorise('look.access', 'com_demo') && $user->authorise('look.submenu', 'com_demo')) { @@ -363,7 +364,7 @@ abstract class DemoHelper { JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS'), 'index.php?option=com_fields&context=com_demo.look', $submenu === 'fields.fields'); JHtmlSidebar::addEntry(JText::_('COM_DEMO_SUBMENU_LOOKS_FIELDS_GROUPS'), 'index.php?option=com_fields&view=groups&context=com_demo.look', $submenu === 'fields.groups'); - } + } } /** @@ -471,7 +472,7 @@ abstract class DemoHelper /** * Prepares the xml document */ - public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Joomla Component Builder', $description = null, $category = null,$keywords = null, $modified = null) + public static function xls($rows, $fileName = null, $title = null, $subjectTab = null, $creator = 'Vast Development Method', $description = null, $category = null,$keywords = null, $modified = null) { // set the user $user = JFactory::getUser(); @@ -505,7 +506,7 @@ abstract class DemoHelper // Set document properties $spreadsheet->getProperties() ->setCreator($creator) - ->setCompany('Joomla Component Builder') + ->setCompany('Vast Development Method') ->setLastModifiedBy($modified) ->setTitle($title) ->setSubject($subjectTab); @@ -685,1210 +686,1210 @@ abstract class DemoHelper self::$composer['phpspreadsheet'] = true; return true; - } - - /** - * Get a Variable - * - * @param string $table The table from which to get the variable - * @param string $where The value where - * @param string $whereString The target/field string where/name - * @param string $what The return field - * @param string $operator The operator between $whereString/field and $where/value - * @param string $main The component in which the table is found - * - * @return mix string/int/float - * - */ - public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'demo') - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#__'.$main.'_'.$table)); - } - if (is_numeric($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); - } - elseif (is_string($where)) - { - $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); - } - else - { - return false; - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - return $db->loadResult(); - } - return false; - } - - /** - * Get array of variables - * - * @param string $table The table from which to get the variables - * @param string $where The value where - * @param string $whereString The target/field string where/name - * @param string $what The return field - * @param string $operator The operator between $whereString/field and $where/value - * @param string $main The component in which the table is found - * @param bool $unique The switch to return a unique array - * - * @return array - * - */ - public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'demo', $unique = true) - { - if(!$where) - { - $where = JFactory::getUser()->id; - } - - if (!self::checkArray($where) && $where > 0) - { - $where = array($where); - } - - if (self::checkArray($where)) - { - // prep main <-- why? well if $main='' is empty then $table can be categories or users - if (self::checkString($main)) - { - $main = '_'.ltrim($main, '_'); - } - // Get a db connection. - $db = JFactory::getDbo(); - // Create a new query object. - $query = $db->getQuery(true); - - $query->select($db->quoteName(array($what))); - if (empty($table)) - { - $query->from($db->quoteName('#__'.$main)); - } - else - { - $query->from($db->quoteName('#_'.$main.'_'.$table)); - } - // add strings to array search - if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) - { - $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); - } - else - { - $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); - } - $db->setQuery($query); - $db->execute(); - if ($db->getNumRows()) - { - if ($unique) - { - return array_unique($db->loadColumn()); - } - return $db->loadColumn(); - } - } - return false; - } - - public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') - { - // do some table foot work - $external = false; - if (strpos($table, '#__') !== false) - { - $external = true; - $table = str_replace('#__', '', $table); - } - // check if string is JSON - $result = json_decode($value, true); - if (json_last_error() === JSON_ERROR_NONE) - { - // is JSON - if (self::checkArray($result)) - { - if (self::checkString($table)) - { - $names = array(); - foreach ($result as $val) - { - if ($external) - { - if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) - { - $names[] = $_name; - } - } - else - { - if ($_name = self::getVar($table, $val, $id, $name)) - { - $names[] = $_name; - } - } - } - if (self::checkArray($names)) - { - return (string) implode($sperator,$names); - } - } - return (string) implode($sperator,$result); - } - return (string) json_decode($value); - } - return $value; - } - - public static function isPublished($id,$type) - { - if ($type == 'raw') - { - $type = 'item'; - } - $db = JFactory::getDbo(); - $query = $db->getQuery(true); - $query->select(array('a.published')); - $query->from('#__demo_'.$type.' AS a'); - $query->where('a.id = '. (int) $id); - $query->where('a.published = 1'); - $db->setQuery($query); - $db->execute(); - $found = $db->getNumRows(); - if($found) - { - return true; - } - return false; - } - - public static function getGroupName($id) - { - $db = JFactory::getDBO(); - $query = $db->getQuery(true); - $query->select(array('a.title')); - $query->from('#__usergroups AS a'); - $query->where('a.id = '. (int) $id); - $db->setQuery($query); - $db->execute(); - $found = $db->getNumRows(); - if($found) - { - return $db->loadResult(); - } - return $id; - } - - /** - * Get the action permissions - * - * @param string $view The related view name - * @param int $record The item to act upon - * @param string $views The related list view name - * @param mixed $target Only get this permission (like edit, create, delete) - * @param string $component The target component - * @param object $user The user whose permissions we are loading - * - * @return object The JObject of permission/authorised actions - * - */ - public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'demo', $user = 'null') - { - // load the user if not given - if (!self::checkObject($user)) - { - // get the user object - $user = JFactory::getUser(); - } - // load the JObject - $result = new JObject; - // make view name safe (just incase) - $view = self::safeString($view); - if (self::checkString($views)) - { - $views = self::safeString($views); - } - // get all actions from component - $actions = JAccess::getActionsFromFile( - JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', - "/access/section[@name='component']/" - ); - // if non found then return empty JObject - if (empty($actions)) - { - return $result; - } - // get created by if not found - if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) - { - $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); - } - // set actions only set in component settings - $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); - // check if we have a target - $checkTarget = false; - if ($target) - { - // convert to an array - if (self::checkString($target)) - { - $target = array($target); - } - // check if we are good to go - if (self::checkArray($target)) - { - $checkTarget = true; - } - } - // loop the actions and set the permissions - foreach ($actions as $action) - { - // check target action filter - if ($checkTarget && self::filterActions($view, $action->name, $target)) - { - continue; - } - // set to use component default - $fallback = true; - // reset permission per/action - $permission = false; - $catpermission = false; - // set area - $area = 'comp'; - // check if the record has an ID and the action is item related (not a component action) - if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && - (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) - { - // we are in item - $area = 'item'; - // The record has been set. Check the record permissions. - $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); - // if no permission found, check edit own - if (!$permission) - { - // With edit, if the created_by matches current user then dig deeper. - if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) - { - // the correct target - $coreCheck = (array) explode('.', $action->name); - // check that we have both local and global access - if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && - $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) - { - // allow edit - $result->set($action->name, true); - // set not to use global default - // because we already validated it - $fallback = false; - } - else - { - // do not allow edit - $result->set($action->name, false); - $fallback = false; - } - } - } - elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) - { - // we are in item - $area = 'category'; - // set the core check - $coreCheck = explode('.', $action->name); - $core = $coreCheck[0]; - // make sure we use the core. action check for the categories - if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) - { - $coreCheck[0] = 'core'; - $categoryCheck = implode('.', $coreCheck); - } - else - { - $categoryCheck = $action->name; - } - // The record has a category. Check the category permissions. - $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); - if (!$catpermission && !is_null($catpermission)) - { - // With edit, if the created_by matches current user then dig deeper. - if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) - { - // check that we have both local and global access - if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && - $user->authorise($core . '.edit.own', 'com_' . $component)) - { - // allow edit - $result->set($action->name, true); - // set not to use global default - // because we already validated it - $fallback = false; - } - else - { - // do not allow edit - $result->set($action->name, false); - $fallback = false; - } - } - } - } - } - // if allowed then fallback on component global settings - if ($fallback) - { - // if item/category blocks access then don't fall back on global - if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) - { - // do not allow - $result->set($action->name, false); - } - // Finally remember the global settings have the final say. (even if item allow) - // The local item permissions can block, but it can't open and override of global permissions. - // Since items are created by users and global permissions is set by system admin. - else - { - $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); - } - } - } - return $result; - } - - /** - * Filter the action permissions - * - * @param string $action The action to check - * @param array $targets The array of target actions - * - * @return boolean true if action should be filtered out - * - */ - protected static function filterActions(&$view, &$action, &$targets) - { - foreach ($targets as $target) - { - if (strpos($action, $view . '.' . $target) !== false || - strpos($action, 'core.' . $target) !== false) - { - return false; - break; - } - } - return true; - } - - /** - * Get any component's model - */ - public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Demo', $config = array()) - { - // fix the name - $name = self::safeString($name); - // full path to models - $fullPathModels = $path . '/models'; - // load the model file - JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); - // make sure the table path is loaded - if (!isset($config['table_path']) || !self::checkString($config['table_path'])) - { - // This is the JCB default path to tables in Joomla 3.x - $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; - } - // get instance - $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); - // if model not found (strange) - if ($model == false) - { - jimport('joomla.filesystem.file'); - // get file path - $filePath = $path . '/' . $name . '.php'; - $fullPathModel = $fullPathModels . '/' . $name . '.php'; - // check if it exists - if (JFile::exists($filePath)) - { - // get the file - require_once $filePath; - } - elseif (JFile::exists($fullPathModel)) - { - // get the file - require_once $fullPathModel; - } - // build class names - $modelClass = $Component . 'Model' . $name; - if (class_exists($modelClass)) - { - // initialize the model - return new $modelClass($config); - } - } - return $model; - } - - /** - * Add to asset Table - */ - public static function setAsset($id, $table, $inherit = true) - { - $parent = JTable::getInstance('Asset'); - $parent->loadByName('com_demo'); - - $parentId = $parent->id; - $name = 'com_demo.'.$table.'.'.$id; - $title = ''; - - $asset = JTable::getInstance('Asset'); - $asset->loadByName($name); - - // Check for an error. - $error = $asset->getError(); - - if ($error) - { - return false; - } - else - { - // Specify how a new or moved node asset is inserted into the tree. - if ($asset->parent_id != $parentId) - { - $asset->setLocation($parentId, 'last-child'); - } - - // Prepare the asset to be stored. - $asset->parent_id = $parentId; - $asset->name = $name; - $asset->title = $title; - // get the default asset rules - $rules = self::getDefaultAssetRules('com_demo', $table, $inherit); - if ($rules instanceof JAccessRules) - { - $asset->rules = (string) $rules; - } - - if (!$asset->check() || !$asset->store()) - { - JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); - return false; - } - else - { - // Create an asset_id or heal one that is corrupted. - $object = new stdClass(); - - // Must be a valid primary key value. - $object->id = $id; - $object->asset_id = (int) $asset->id; - - // Update their asset_id to link to the asset table. - return JFactory::getDbo()->updateObject('#__demo_'.$table, $object, 'id'); - } - } - return false; - } - - /** - * Gets the default asset Rules for a component/view. - */ - protected static function getDefaultAssetRules($component, $view, $inherit = true) - { - // if new or inherited - $assetId = 0; - // Only get the actual item rules if not inheriting - if (!$inherit) - { - // Need to find the asset id by the name of the component. - $db = JFactory::getDbo(); - $query = $db->getQuery(true) - ->select($db->quoteName('id')) - ->from($db->quoteName('#__assets')) - ->where($db->quoteName('name') . ' = ' . $db->quote($component)); - $db->setQuery($query); - $db->execute(); - // check that there is a value - if ($db->getNumRows()) - { - // asset already set so use saved rules - $assetId = (int) $db->loadResult(); - } - } - // get asset rules - $result = JAccess::getAssetRules($assetId); - if ($result instanceof JAccessRules) - { - $_result = (string) $result; - $_result = json_decode($_result); - foreach ($_result as $name => &$rule) - { - $v = explode('.', $name); - if ($view !== $v[0]) - { - // remove since it is not part of this view - unset($_result->$name); - } - elseif ($inherit) - { - // clear the value since we inherit - $rule = array(); - } - } - // check if there are any view values remaining - if (count((array) $_result)) - { - $_result = json_encode($_result); - $_result = array($_result); - // Instantiate and return the JAccessRules object for the asset rules. - $rules = new JAccessRules($_result); - // return filtered rules - return $rules; - } - } - return $result; - } - - /** - * xmlAppend - * - * @param SimpleXMLElement $xml The XML element reference in which to inject a comment - * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement - * - * @return null - * - */ - public static function xmlAppend(&$xml, $node) - { - if (!$node) - { - // element was not returned - return; - } - switch (get_class($node)) - { - case 'stdClass': - if (property_exists($node, 'comment')) - { - self::xmlComment($xml, $node->comment); - } - if (property_exists($node, 'fieldXML')) - { - self::xmlAppend($xml, $node->fieldXML); - } - break; - case 'SimpleXMLElement': - $domXML = dom_import_simplexml($xml); - $domNode = dom_import_simplexml($node); - $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); - $xml = simplexml_import_dom($domXML); - break; - } - } - - /** - * xmlComment - * - * @param SimpleXMLElement $xml The XML element reference in which to inject a comment - * @param string $comment The comment to inject - * - * @return null - * - */ - public static function xmlComment(&$xml, $comment) - { - $domXML = dom_import_simplexml($xml); - $domComment = new DOMComment($comment); - $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); - $domXML->appendChild($nodeTarget); - $xml = simplexml_import_dom($domXML); - } - - /** - * xmlAddAttributes - * - * @param SimpleXMLElement $xml The XML element reference in which to inject a comment - * @param array $attributes The attributes to apply to the XML element - * - * @return null - * - */ - public static function xmlAddAttributes(&$xml, $attributes = array()) - { - foreach ($attributes as $key => $value) - { - $xml->addAttribute($key, $value); - } - } - - /** - * xmlAddOptions - * - * @param SimpleXMLElement $xml The XML element reference in which to inject a comment - * @param array $options The options to apply to the XML element - * - * @return void - * - */ - public static function xmlAddOptions(&$xml, $options = array()) - { - foreach ($options as $key => $value) - { - $addOption = $xml->addChild('option'); - $addOption->addAttribute('value', $key); - $addOption[] = $value; - } - } - - /** - * get the field object - * - * @param array $attributes The array of attributes - * @param string $default The default of the field - * @param array $options The options to apply to the XML element - * - * @return object - * - */ - public static function getFieldObject(&$attributes, $default = '', $options = null) - { - // make sure we have attributes and a type value - if (self::checkArray($attributes) && isset($attributes['type'])) - { - // make sure the form helper class is loaded - if (!method_exists('JFormHelper', 'loadFieldType')) - { - jimport('joomla.form.form'); - } - // get field type - $field = JFormHelper::loadFieldType($attributes['type'], true); - // get field xml - $XML = self::getFieldXML($attributes, $options); - // setup the field - $field->setup($XML, $default); - // return the field object - return $field; - } - return false; - } - - /** - * get the field xml - * - * @param array $attributes The array of attributes - * @param array $options The options to apply to the XML element - * - * @return object - * - */ - public static function getFieldXML(&$attributes, $options = null) - { - // make sure we have attributes and a type value - if (self::checkArray($attributes)) - { - // start field xml - $XML = new SimpleXMLElement(''); - // load the attributes - self::xmlAddAttributes($XML, $attributes); - // check if we have options - if (self::checkArray($options)) - { - // load the options - self::xmlAddOptions($XML, $options); - } - // return the field xml - return $XML; - } - return false; - } - - /** - * Render Bool Button - * - * @param array $args All the args for the button - * 0) name - * 1) additional (options class) // not used at this time - * 2) default - * 3) yes (name) - * 4) no (name) - * - * @return string The input html of the button - * - */ - public static function renderBoolButton() - { - $args = func_get_args(); - // check if there is additional button class - $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time - // button attributes - $buttonAttributes = array( - 'type' => 'radio', - 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', - 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway - 'class' => 'btn-group', - 'filter' => 'INT', - 'default' => isset($args[2]) ? (int) $args[2] : 0); - // set the button options - $buttonOptions = array( - '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', - '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); - // return the input - return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; - } - - /** - * Check if have an json string - * - * @input string The json string to check - * - * @returns bool true on success - */ - public static function checkJson($string) - { - if (self::checkString($string)) - { - json_decode($string); - return (json_last_error() === JSON_ERROR_NONE); - } - return false; - } - - /** - * Check if have an object with a length - * - * @input object The object to check - * - * @returns bool true on success - */ - public static function checkObject($object) - { - if (isset($object) && is_object($object)) - { - return count((array)$object) > 0; - } - return false; - } - - /** - * Check if have an array with a length - * - * @input array The array to check - * - * @returns bool/int number of items in array on success - */ - public static function checkArray($array, $removeEmptyString = false) - { - if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) - { - // also make sure the empty strings are removed - if ($removeEmptyString) - { - foreach ($array as $key => $string) - { - if (empty($string)) - { - unset($array[$key]); - } - } - return self::checkArray($array, false); - } - return $nr; - } - return false; - } - - /** - * Check if have a string with a length - * - * @input string The string to check - * - * @returns bool true on success - */ - public static function checkString($string) - { - if (isset($string) && is_string($string) && strlen($string) > 0) - { - return true; - } - return false; - } - - /** - * Check if we are connected - * Thanks https://stackoverflow.com/a/4860432/1429677 - * - * @returns bool true on success - */ - public static function isConnected() - { - // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? - $connected = @fsockopen("www.example.com", 80); - // website, port (try 80 or 443) - if ($connected) - { - //action when connected - $is_conn = true; - fclose($connected); - } - else - { - //action in connection failure - $is_conn = false; - } - return $is_conn; - } - - /** - * Merge an array of array's - * - * @input array The arrays you would like to merge - * - * @returns array on success - */ - public static function mergeArrays($arrays) - { - if(self::checkArray($arrays)) - { - $arrayBuket = array(); - foreach ($arrays as $array) - { - if (self::checkArray($array)) - { - $arrayBuket = array_merge($arrayBuket, $array); - } - } - return $arrayBuket; - } - return false; - } - - // typo sorry! - public static function sorten($string, $length = 40, $addTip = true) - { - return self::shorten($string, $length, $addTip); - } - - /** - * Shorten a string - * - * @input string The you would like to shorten - * - * @returns string on success - */ - public static function shorten($string, $length = 40, $addTip = true) - { - if (self::checkString($string)) - { - $initial = strlen($string); - $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); - $words_count = count((array)$words); - - $word_length = 0; - $last_word = 0; - for (; $last_word < $words_count; ++$last_word) - { - $word_length += strlen($words[$last_word]); - if ($word_length > $length) - { - break; - } - } - - $newString = implode(array_slice($words, 0, $last_word)); - $final = strlen($newString); - if ($initial != $final && $addTip) - { - $title = self::shorten($string, 400 , false); - return ''.trim($newString).'...'; - } - elseif ($initial != $final && !$addTip) - { - return trim($newString).'...'; - } - } - return $string; - } - - /** - * Making strings safe (various ways) - * - * @input string The you would like to make safe - * - * @returns string on success - */ - public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) - { - if ($replaceNumbers === true) - { - // remove all numbers and replace with english text version (works well only up to millions) - $string = self::replaceNumbers($string); - } - // 0nly continue if we have a string - if (self::checkString($string)) - { - // create file name without the extention that is safe - if ($type === 'filename') - { - // make sure VDM is not in the string - $string = str_replace('VDM', 'vDm', $string); - // Remove anything which isn't a word, whitespace, number - // or any of the following caracters -_() - // If you don't need to handle multi-byte characters - // you can use preg_replace rather than mb_ereg_replace - // Thanks @Łukasz Rysiak! - // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); - $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); - // http://stackoverflow.com/a/2021729/1429677 - return preg_replace('/\s+/', ' ', $string); - } - // remove all other characters - $string = trim($string); - $string = preg_replace('/'.$spacer.'+/', ' ', $string); - $string = preg_replace('/\s+/', ' ', $string); - // Transliterate string - $string = self::transliterate($string); - // remove all and keep only characters - if ($keepOnlyCharacters) - { - $string = preg_replace("/[^A-Za-z ]/", '', $string); - } - // keep both numbers and characters - else - { - $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); - } - // select final adaptations - if ($type === 'L' || $type === 'strtolower') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // default is to return lower - return strtolower($string); - } - elseif ($type === 'W') - { - // return a string with all first letter of each word uppercase(no undersocre) - return ucwords(strtolower($string)); - } - elseif ($type === 'w' || $type === 'word') - { - // return a string with all lowercase(no undersocre) - return strtolower($string); - } - elseif ($type === 'Ww' || $type === 'Word') - { - // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) - return ucfirst(strtolower($string)); - } - elseif ($type === 'WW' || $type === 'WORD') - { - // return a string with all the uppercase(no undersocre) - return strtoupper($string); - } - elseif ($type === 'U' || $type === 'strtoupper') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return all upper - return strtoupper($string); - } - elseif ($type === 'F' || $type === 'ucfirst') - { - // replace white space with underscore - $string = preg_replace('/\s+/', $spacer, $string); - // return with first caracter to upper - return ucfirst(strtolower($string)); - } - elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') - { - // convert all words to first letter uppercase - $string = ucwords(strtolower($string)); - // remove white space - $string = preg_replace('/\s+/', '', $string); - // now return first letter lowercase - return lcfirst($string); - } - // return string - return $string; - } - // not a string - return ''; - } - - public static function transliterate($string) - { - // set tag only once - if (!self::checkString(self::$langTag)) - { - // get global value - self::$langTag = JComponentHelper::getParams('com_demo')->get('language', 'en-GB'); - } - // Transliterate on the language requested - $lang = Language::getInstance(self::$langTag); - return $lang->transliterate($string); - } - - public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) - { - if (self::checkString($var)) - { - $filter = new JFilterInput(); - $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); - if ($shorten) - { - return self::shorten($string,$length); - } - return $string; - } - else - { - return ''; - } - } - - public static function replaceNumbers($string) - { - // set numbers array - $numbers = array(); - // first get all numbers - preg_match_all('!\d+!', $string, $numbers); - // check if we have any numbers - if (isset($numbers[0]) && self::checkArray($numbers[0])) - { - foreach ($numbers[0] as $number) - { - $searchReplace[$number] = self::numberToString((int)$number); - } - // now replace numbers in string - $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); - // check if we missed any, strange if we did. - return self::replaceNumbers($string); - } - // return the string with no numbers remaining. - return $string; - } - - /** - * Convert an integer into an English word string - * Thanks to Tom Nicholson - * - * @input an int - * @returns a string - */ - public static function numberToString($x) - { - $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", - "eight", "nine", "ten", "eleven", "twelve", "thirteen", - "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", 30 => "thirty", 40 => "forty", - 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", - 90 => "ninety" ); - - if(!is_numeric($x)) - { - $w = $x; - } - elseif(fmod($x, 1) != 0) - { - $w = $x; - } - else - { - if($x < 0) - { - $w = 'minus '; - $x = -$x; - } - else - { - $w = ''; - // ... now $x is a non-negative integer. - } - - if($x < 21) // 0 to 20 - { - $w .= $nwords[$x]; - } - elseif($x < 100) // 21 to 99 - { - $w .= $nwords[10 * floor($x/10)]; - $r = fmod($x, 10); - if($r > 0) - { - $w .= ' '. $nwords[$r]; - } - } - elseif($x < 1000) // 100 to 999 - { - $w .= $nwords[floor($x/100)] .' hundred'; - $r = fmod($x, 100); - if($r > 0) - { - $w .= ' and '. self::numberToString($r); - } - } - elseif($x < 1000000) // 1000 to 999999 - { - $w .= self::numberToString(floor($x/1000)) .' thousand'; - $r = fmod($x, 1000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - else // millions - { - $w .= self::numberToString(floor($x/1000000)) .' million'; - $r = fmod($x, 1000000); - if($r > 0) - { - $w .= ' '; - if($r < 100) - { - $w .= 'and '; - } - $w .= self::numberToString($r); - } - } - } - return $w; - } - - /** - * Random Key - * - * @returns a string - */ - public static function randomkey($size) - { - $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; - $key = array(); - $bagsize = strlen($bag) - 1; - for ($i = 0; $i < $size; $i++) - { - $get = rand(0, $bagsize); - $key[] = $bag[$get]; - } - return implode($key); - } -} + } + + /** + * Get a Variable + * + * @param string $table The table from which to get the variable + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * + * @return mix string/int/float + * + */ + public static function getVar($table, $where = null, $whereString = 'user', $what = 'id', $operator = '=', $main = 'demo') + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#__'.$main.'_'.$table)); + } + if (is_numeric($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '.(int) $where); + } + elseif (is_string($where)) + { + $query->where($db->quoteName($whereString) . ' '.$operator.' '. $db->quote((string)$where)); + } + else + { + return false; + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + return $db->loadResult(); + } + return false; + } + + /** + * Get array of variables + * + * @param string $table The table from which to get the variables + * @param string $where The value where + * @param string $whereString The target/field string where/name + * @param string $what The return field + * @param string $operator The operator between $whereString/field and $where/value + * @param string $main The component in which the table is found + * @param bool $unique The switch to return a unique array + * + * @return array + * + */ + public static function getVars($table, $where = null, $whereString = 'user', $what = 'id', $operator = 'IN', $main = 'demo', $unique = true) + { + if(!$where) + { + $where = JFactory::getUser()->id; + } + + if (!self::checkArray($where) && $where > 0) + { + $where = array($where); + } + + if (self::checkArray($where)) + { + // prep main <-- why? well if $main='' is empty then $table can be categories or users + if (self::checkString($main)) + { + $main = '_'.ltrim($main, '_'); + } + // Get a db connection. + $db = JFactory::getDbo(); + // Create a new query object. + $query = $db->getQuery(true); + + $query->select($db->quoteName(array($what))); + if (empty($table)) + { + $query->from($db->quoteName('#__'.$main)); + } + else + { + $query->from($db->quoteName('#_'.$main.'_'.$table)); + } + // add strings to array search + if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator) + { + $query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")'); + } + else + { + $query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')'); + } + $db->setQuery($query); + $db->execute(); + if ($db->getNumRows()) + { + if ($unique) + { + return array_unique($db->loadColumn()); + } + return $db->loadColumn(); + } + } + return false; + } + + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') + { + // do some table foot work + $external = false; + if (strpos($table, '#__') !== false) + { + $external = true; + $table = str_replace('#__', '', $table); + } + // check if string is JSON + $result = json_decode($value, true); + if (json_last_error() === JSON_ERROR_NONE) + { + // is JSON + if (self::checkArray($result)) + { + if (self::checkString($table)) + { + $names = array(); + foreach ($result as $val) + { + if ($external) + { + if ($_name = self::getVar(null, $val, $id, $name, '=', $table)) + { + $names[] = $_name; + } + } + else + { + if ($_name = self::getVar($table, $val, $id, $name)) + { + $names[] = $_name; + } + } + } + if (self::checkArray($names)) + { + return (string) implode($sperator,$names); + } + } + return (string) implode($sperator,$result); + } + return (string) json_decode($value); + } + return $value; + } + + public static function isPublished($id,$type) + { + if ($type == 'raw') + { + $type = 'item'; + } + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select(array('a.published')); + $query->from('#__demo_'.$type.' AS a'); + $query->where('a.id = '. (int) $id); + $query->where('a.published = 1'); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return true; + } + return false; + } + + public static function getGroupName($id) + { + $db = JFactory::getDBO(); + $query = $db->getQuery(true); + $query->select(array('a.title')); + $query->from('#__usergroups AS a'); + $query->where('a.id = '. (int) $id); + $db->setQuery($query); + $db->execute(); + $found = $db->getNumRows(); + if($found) + { + return $db->loadResult(); + } + return $id; + } + + /** + * Get the action permissions + * + * @param string $view The related view name + * @param int $record The item to act upon + * @param string $views The related list view name + * @param mixed $target Only get this permission (like edit, create, delete) + * @param string $component The target component + * @param object $user The user whose permissions we are loading + * + * @return object The JObject of permission/authorised actions + * + */ + public static function getActions($view, &$record = null, $views = null, $target = null, $component = 'demo', $user = 'null') + { + // load the user if not given + if (!self::checkObject($user)) + { + // get the user object + $user = JFactory::getUser(); + } + // load the JObject + $result = new JObject; + // make view name safe (just incase) + $view = self::safeString($view); + if (self::checkString($views)) + { + $views = self::safeString($views); + } + // get all actions from component + $actions = JAccess::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_' . $component . '/access.xml', + "/access/section[@name='component']/" + ); + // if non found then return empty JObject + if (empty($actions)) + { + return $result; + } + // get created by if not found + if (self::checkObject($record) && !isset($record->created_by) && isset($record->id)) + { + $record->created_by = self::getVar($view, $record->id, 'id', 'created_by', '=', $component); + } + // set actions only set in component settings + $componentActions = array('core.admin', 'core.manage', 'core.options', 'core.export'); + // check if we have a target + $checkTarget = false; + if ($target) + { + // convert to an array + if (self::checkString($target)) + { + $target = array($target); + } + // check if we are good to go + if (self::checkArray($target)) + { + $checkTarget = true; + } + } + // loop the actions and set the permissions + foreach ($actions as $action) + { + // check target action filter + if ($checkTarget && self::filterActions($view, $action->name, $target)) + { + continue; + } + // set to use component default + $fallback = true; + // reset permission per/action + $permission = false; + $catpermission = false; + // set area + $area = 'comp'; + // check if the record has an ID and the action is item related (not a component action) + if (self::checkObject($record) && isset($record->id) && $record->id > 0 && !in_array($action->name, $componentActions) && + (strpos($action->name, 'core.') !== false || strpos($action->name, $view . '.') !== false)) + { + // we are in item + $area = 'item'; + // The record has been set. Check the record permissions. + $permission = $user->authorise($action->name, 'com_' . $component . '.' . $view . '.' . (int) $record->id); + // if no permission found, check edit own + if (!$permission) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // the correct target + $coreCheck = (array) explode('.', $action->name); + // check that we have both local and global access + if ($user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component . '.' . $view . '.' . (int) $record->id) && + $user->authorise($coreCheck[0] . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + elseif (self::checkString($views) && isset($record->catid) && $record->catid > 0) + { + // we are in item + $area = 'category'; + // set the core check + $coreCheck = explode('.', $action->name); + $core = $coreCheck[0]; + // make sure we use the core. action check for the categories + if (strpos($action->name, $view) !== false && strpos($action->name, 'core.') === false ) + { + $coreCheck[0] = 'core'; + $categoryCheck = implode('.', $coreCheck); + } + else + { + $categoryCheck = $action->name; + } + // The record has a category. Check the category permissions. + $catpermission = $user->authorise($categoryCheck, 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid); + if (!$catpermission && !is_null($catpermission)) + { + // With edit, if the created_by matches current user then dig deeper. + if (($action->name === 'core.edit' || $action->name === $view . '.edit') && $record->created_by > 0 && ($record->created_by == $user->id)) + { + // check that we have both local and global access + if ($user->authorise('core.edit.own', 'com_' . $component . '.' . $views . '.category.' . (int) $record->catid) && + $user->authorise($core . '.edit.own', 'com_' . $component)) + { + // allow edit + $result->set($action->name, true); + // set not to use global default + // because we already validated it + $fallback = false; + } + else + { + // do not allow edit + $result->set($action->name, false); + $fallback = false; + } + } + } + } + } + // if allowed then fallback on component global settings + if ($fallback) + { + // if item/category blocks access then don't fall back on global + if ((($area === 'item') && !$permission) || (($area === 'category') && !$catpermission)) + { + // do not allow + $result->set($action->name, false); + } + // Finally remember the global settings have the final say. (even if item allow) + // The local item permissions can block, but it can't open and override of global permissions. + // Since items are created by users and global permissions is set by system admin. + else + { + $result->set($action->name, $user->authorise($action->name, 'com_' . $component)); + } + } + } + return $result; + } + + /** + * Filter the action permissions + * + * @param string $action The action to check + * @param array $targets The array of target actions + * + * @return boolean true if action should be filtered out + * + */ + protected static function filterActions(&$view, &$action, &$targets) + { + foreach ($targets as $target) + { + if (strpos($action, $view . '.' . $target) !== false || + strpos($action, 'core.' . $target) !== false) + { + return false; + break; + } + } + return true; + } + + /** + * Get any component's model + */ + public static function getModel($name, $path = JPATH_COMPONENT_ADMINISTRATOR, $Component = 'Demo', $config = array()) + { + // fix the name + $name = self::safeString($name); + // full path to models + $fullPathModels = $path . '/models'; + // load the model file + JModelLegacy::addIncludePath($fullPathModels, $Component . 'Model'); + // make sure the table path is loaded + if (!isset($config['table_path']) || !self::checkString($config['table_path'])) + { + // This is the JCB default path to tables in Joomla 3.x + $config['table_path'] = JPATH_ADMINISTRATOR . '/components/com_' . strtolower($Component) . '/tables'; + } + // get instance + $model = JModelLegacy::getInstance($name, $Component . 'Model', $config); + // if model not found (strange) + if ($model == false) + { + jimport('joomla.filesystem.file'); + // get file path + $filePath = $path . '/' . $name . '.php'; + $fullPathModel = $fullPathModels . '/' . $name . '.php'; + // check if it exists + if (File::exists($filePath)) + { + // get the file + require_once $filePath; + } + elseif (File::exists($fullPathModel)) + { + // get the file + require_once $fullPathModel; + } + // build class names + $modelClass = $Component . 'Model' . $name; + if (class_exists($modelClass)) + { + // initialize the model + return new $modelClass($config); + } + } + return $model; + } + + /** + * Add to asset Table + */ + public static function setAsset($id, $table, $inherit = true) + { + $parent = JTable::getInstance('Asset'); + $parent->loadByName('com_demo'); + + $parentId = $parent->id; + $name = 'com_demo.'.$table.'.'.$id; + $title = ''; + + $asset = JTable::getInstance('Asset'); + $asset->loadByName($name); + + // Check for an error. + $error = $asset->getError(); + + if ($error) + { + return false; + } + else + { + // Specify how a new or moved node asset is inserted into the tree. + if ($asset->parent_id != $parentId) + { + $asset->setLocation($parentId, 'last-child'); + } + + // Prepare the asset to be stored. + $asset->parent_id = $parentId; + $asset->name = $name; + $asset->title = $title; + // get the default asset rules + $rules = self::getDefaultAssetRules('com_demo', $table, $inherit); + if ($rules instanceof JAccessRules) + { + $asset->rules = (string) $rules; + } + + if (!$asset->check() || !$asset->store()) + { + JFactory::getApplication()->enqueueMessage($asset->getError(), 'warning'); + return false; + } + else + { + // Create an asset_id or heal one that is corrupted. + $object = new stdClass(); + + // Must be a valid primary key value. + $object->id = $id; + $object->asset_id = (int) $asset->id; + + // Update their asset_id to link to the asset table. + return JFactory::getDbo()->updateObject('#__demo_'.$table, $object, 'id'); + } + } + return false; + } + + /** + * Gets the default asset Rules for a component/view. + */ + protected static function getDefaultAssetRules($component, $view, $inherit = true) + { + // if new or inherited + $assetId = 0; + // Only get the actual item rules if not inheriting + if (!$inherit) + { + // Need to find the asset id by the name of the component. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('id')) + ->from($db->quoteName('#__assets')) + ->where($db->quoteName('name') . ' = ' . $db->quote($component)); + $db->setQuery($query); + $db->execute(); + // check that there is a value + if ($db->getNumRows()) + { + // asset already set so use saved rules + $assetId = (int) $db->loadResult(); + } + } + // get asset rules + $result = JAccess::getAssetRules($assetId); + if ($result instanceof JAccessRules) + { + $_result = (string) $result; + $_result = json_decode($_result); + foreach ($_result as $name => &$rule) + { + $v = explode('.', $name); + if ($view !== $v[0]) + { + // remove since it is not part of this view + unset($_result->$name); + } + elseif ($inherit) + { + // clear the value since we inherit + $rule = array(); + } + } + // check if there are any view values remaining + if (count((array) $_result)) + { + $_result = json_encode($_result); + $_result = array($_result); + // Instantiate and return the JAccessRules object for the asset rules. + $rules = new JAccessRules($_result); + // return filtered rules + return $rules; + } + } + return $result; + } + + /** + * xmlAppend + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param mixed $node A SimpleXMLElement node to append to the XML element reference, or a stdClass object containing a comment attribute to be injected before the XML node and a fieldXML attribute containing a SimpleXMLElement + * + * @return null + * + */ + public static function xmlAppend(&$xml, $node) + { + if (!$node) + { + // element was not returned + return; + } + switch (get_class($node)) + { + case 'stdClass': + if (property_exists($node, 'comment')) + { + self::xmlComment($xml, $node->comment); + } + if (property_exists($node, 'fieldXML')) + { + self::xmlAppend($xml, $node->fieldXML); + } + break; + case 'SimpleXMLElement': + $domXML = dom_import_simplexml($xml); + $domNode = dom_import_simplexml($node); + $domXML->appendChild($domXML->ownerDocument->importNode($domNode, true)); + $xml = simplexml_import_dom($domXML); + break; + } + } + + /** + * xmlComment + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param string $comment The comment to inject + * + * @return null + * + */ + public static function xmlComment(&$xml, $comment) + { + $domXML = dom_import_simplexml($xml); + $domComment = new DOMComment($comment); + $nodeTarget = $domXML->ownerDocument->importNode($domComment, true); + $domXML->appendChild($nodeTarget); + $xml = simplexml_import_dom($domXML); + } + + /** + * xmlAddAttributes + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $attributes The attributes to apply to the XML element + * + * @return null + * + */ + public static function xmlAddAttributes(&$xml, $attributes = array()) + { + foreach ($attributes as $key => $value) + { + $xml->addAttribute($key, $value); + } + } + + /** + * xmlAddOptions + * + * @param SimpleXMLElement $xml The XML element reference in which to inject a comment + * @param array $options The options to apply to the XML element + * + * @return void + * + */ + public static function xmlAddOptions(&$xml, $options = array()) + { + foreach ($options as $key => $value) + { + $addOption = $xml->addChild('option'); + $addOption->addAttribute('value', $key); + $addOption[] = $value; + } + } + + /** + * get the field object + * + * @param array $attributes The array of attributes + * @param string $default The default of the field + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldObject(&$attributes, $default = '', $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes) && isset($attributes['type'])) + { + // make sure the form helper class is loaded + if (!method_exists('JFormHelper', 'loadFieldType')) + { + jimport('joomla.form.form'); + } + // get field type + $field = JFormHelper::loadFieldType($attributes['type'], true); + // get field xml + $XML = self::getFieldXML($attributes, $options); + // setup the field + $field->setup($XML, $default); + // return the field object + return $field; + } + return false; + } + + /** + * get the field xml + * + * @param array $attributes The array of attributes + * @param array $options The options to apply to the XML element + * + * @return object + * + */ + public static function getFieldXML(&$attributes, $options = null) + { + // make sure we have attributes and a type value + if (self::checkArray($attributes)) + { + // start field xml + $XML = new SimpleXMLElement(''); + // load the attributes + self::xmlAddAttributes($XML, $attributes); + // check if we have options + if (self::checkArray($options)) + { + // load the options + self::xmlAddOptions($XML, $options); + } + // return the field xml + return $XML; + } + return false; + } + + /** + * Render Bool Button + * + * @param array $args All the args for the button + * 0) name + * 1) additional (options class) // not used at this time + * 2) default + * 3) yes (name) + * 4) no (name) + * + * @return string The input html of the button + * + */ + public static function renderBoolButton() + { + $args = func_get_args(); + // check if there is additional button class + $additional = isset($args[1]) ? (string) $args[1] : ''; // not used at this time + // button attributes + $buttonAttributes = array( + 'type' => 'radio', + 'name' => isset($args[0]) ? self::htmlEscape($args[0]) : 'bool_button', + 'label' => isset($args[0]) ? self::safeString(self::htmlEscape($args[0]), 'Ww') : 'Bool Button', // not seen anyway + 'class' => 'btn-group', + 'filter' => 'INT', + 'default' => isset($args[2]) ? (int) $args[2] : 0); + // set the button options + $buttonOptions = array( + '1' => isset($args[3]) ? self::htmlEscape($args[3]) : 'JYES', + '0' => isset($args[4]) ? self::htmlEscape($args[4]) : 'JNO'); + // return the input + return self::getFieldObject($buttonAttributes, $buttonAttributes['default'], $buttonOptions)->input; + } + + /** + * Check if have an json string + * + * @input string The json string to check + * + * @returns bool true on success + */ + public static function checkJson($string) + { + if (self::checkString($string)) + { + json_decode($string); + return (json_last_error() === JSON_ERROR_NONE); + } + return false; + } + + /** + * Check if have an object with a length + * + * @input object The object to check + * + * @returns bool true on success + */ + public static function checkObject($object) + { + if (isset($object) && is_object($object)) + { + return count((array)$object) > 0; + } + return false; + } + + /** + * Check if have an array with a length + * + * @input array The array to check + * + * @returns bool/int number of items in array on success + */ + public static function checkArray($array, $removeEmptyString = false) + { + if (isset($array) && is_array($array) && ($nr = count((array)$array)) > 0) + { + // also make sure the empty strings are removed + if ($removeEmptyString) + { + foreach ($array as $key => $string) + { + if (empty($string)) + { + unset($array[$key]); + } + } + return self::checkArray($array, false); + } + return $nr; + } + return false; + } + + /** + * Check if have a string with a length + * + * @input string The string to check + * + * @returns bool true on success + */ + public static function checkString($string) + { + if (isset($string) && is_string($string) && strlen($string) > 0) + { + return true; + } + return false; + } + + /** + * Check if we are connected + * Thanks https://stackoverflow.com/a/4860432/1429677 + * + * @returns bool true on success + */ + public static function isConnected() + { + // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right? + $connected = @fsockopen("www.example.com", 80); + // website, port (try 80 or 443) + if ($connected) + { + //action when connected + $is_conn = true; + fclose($connected); + } + else + { + //action in connection failure + $is_conn = false; + } + return $is_conn; + } + + /** + * Merge an array of array's + * + * @input array The arrays you would like to merge + * + * @returns array on success + */ + public static function mergeArrays($arrays) + { + if(self::checkArray($arrays)) + { + $arrayBuket = array(); + foreach ($arrays as $array) + { + if (self::checkArray($array)) + { + $arrayBuket = array_merge($arrayBuket, $array); + } + } + return $arrayBuket; + } + return false; + } + + // typo sorry! + public static function sorten($string, $length = 40, $addTip = true) + { + return self::shorten($string, $length, $addTip); + } + + /** + * Shorten a string + * + * @input string The you would like to shorten + * + * @returns string on success + */ + public static function shorten($string, $length = 40, $addTip = true) + { + if (self::checkString($string)) + { + $initial = strlen($string); + $words = preg_split('/([\s\n\r]+)/', $string, null, PREG_SPLIT_DELIM_CAPTURE); + $words_count = count((array)$words); + + $word_length = 0; + $last_word = 0; + for (; $last_word < $words_count; ++$last_word) + { + $word_length += strlen($words[$last_word]); + if ($word_length > $length) + { + break; + } + } + + $newString = implode(array_slice($words, 0, $last_word)); + $final = strlen($newString); + if ($initial != $final && $addTip) + { + $title = self::shorten($string, 400 , false); + return ''.trim($newString).'...'; + } + elseif ($initial != $final && !$addTip) + { + return trim($newString).'...'; + } + } + return $string; + } + + /** + * Making strings safe (various ways) + * + * @input string The you would like to make safe + * + * @returns string on success + */ + public static function safeString($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true) + { + if ($replaceNumbers === true) + { + // remove all numbers and replace with english text version (works well only up to millions) + $string = self::replaceNumbers($string); + } + // 0nly continue if we have a string + if (self::checkString($string)) + { + // create file name without the extention that is safe + if ($type === 'filename') + { + // make sure VDM is not in the string + $string = str_replace('VDM', 'vDm', $string); + // Remove anything which isn't a word, whitespace, number + // or any of the following caracters -_() + // If you don't need to handle multi-byte characters + // you can use preg_replace rather than mb_ereg_replace + // Thanks @Łukasz Rysiak! + // $string = mb_ereg_replace("([^\w\s\d\-_\(\)])", '', $string); + $string = preg_replace("([^\w\s\d\-_\(\)])", '', $string); + // http://stackoverflow.com/a/2021729/1429677 + return preg_replace('/\s+/', ' ', $string); + } + // remove all other characters + $string = trim($string); + $string = preg_replace('/'.$spacer.'+/', ' ', $string); + $string = preg_replace('/\s+/', ' ', $string); + // Transliterate string + $string = self::transliterate($string); + // remove all and keep only characters + if ($keepOnlyCharacters) + { + $string = preg_replace("/[^A-Za-z ]/", '', $string); + } + // keep both numbers and characters + else + { + $string = preg_replace("/[^A-Za-z0-9 ]/", '', $string); + } + // select final adaptations + if ($type === 'L' || $type === 'strtolower') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // default is to return lower + return strtolower($string); + } + elseif ($type === 'W') + { + // return a string with all first letter of each word uppercase(no undersocre) + return ucwords(strtolower($string)); + } + elseif ($type === 'w' || $type === 'word') + { + // return a string with all lowercase(no undersocre) + return strtolower($string); + } + elseif ($type === 'Ww' || $type === 'Word') + { + // return a string with first letter of the first word uppercase and all the rest lowercase(no undersocre) + return ucfirst(strtolower($string)); + } + elseif ($type === 'WW' || $type === 'WORD') + { + // return a string with all the uppercase(no undersocre) + return strtoupper($string); + } + elseif ($type === 'U' || $type === 'strtoupper') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return all upper + return strtoupper($string); + } + elseif ($type === 'F' || $type === 'ucfirst') + { + // replace white space with underscore + $string = preg_replace('/\s+/', $spacer, $string); + // return with first caracter to upper + return ucfirst(strtolower($string)); + } + elseif ($type === 'cA' || $type === 'cAmel' || $type === 'camelcase') + { + // convert all words to first letter uppercase + $string = ucwords(strtolower($string)); + // remove white space + $string = preg_replace('/\s+/', '', $string); + // now return first letter lowercase + return lcfirst($string); + } + // return string + return $string; + } + // not a string + return ''; + } + + public static function transliterate($string) + { + // set tag only once + if (!self::checkString(self::$langTag)) + { + // get global value + self::$langTag = JComponentHelper::getParams('com_demo')->get('language', 'en-GB'); + } + // Transliterate on the language requested + $lang = Language::getInstance(self::$langTag); + return $lang->transliterate($string); + } + + public static function htmlEscape($var, $charset = 'UTF-8', $shorten = false, $length = 40) + { + if (self::checkString($var)) + { + $filter = new JFilterInput(); + $string = $filter->clean(html_entity_decode(htmlentities($var, ENT_COMPAT, $charset)), 'HTML'); + if ($shorten) + { + return self::shorten($string,$length); + } + return $string; + } + else + { + return ''; + } + } + + public static function replaceNumbers($string) + { + // set numbers array + $numbers = array(); + // first get all numbers + preg_match_all('!\d+!', $string, $numbers); + // check if we have any numbers + if (isset($numbers[0]) && self::checkArray($numbers[0])) + { + foreach ($numbers[0] as $number) + { + $searchReplace[$number] = self::numberToString((int)$number); + } + // now replace numbers in string + $string = str_replace(array_keys($searchReplace), array_values($searchReplace),$string); + // check if we missed any, strange if we did. + return self::replaceNumbers($string); + } + // return the string with no numbers remaining. + return $string; + } + + /** + * Convert an integer into an English word string + * Thanks to Tom Nicholson + * + * @input an int + * @returns a string + */ + public static function numberToString($x) + { + $nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven", + "eight", "nine", "ten", "eleven", "twelve", "thirteen", + "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", 30 => "thirty", 40 => "forty", + 50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty", + 90 => "ninety" ); + + if(!is_numeric($x)) + { + $w = $x; + } + elseif(fmod($x, 1) != 0) + { + $w = $x; + } + else + { + if($x < 0) + { + $w = 'minus '; + $x = -$x; + } + else + { + $w = ''; + // ... now $x is a non-negative integer. + } + + if($x < 21) // 0 to 20 + { + $w .= $nwords[$x]; + } + elseif($x < 100) // 21 to 99 + { + $w .= $nwords[10 * floor($x/10)]; + $r = fmod($x, 10); + if($r > 0) + { + $w .= ' '. $nwords[$r]; + } + } + elseif($x < 1000) // 100 to 999 + { + $w .= $nwords[floor($x/100)] .' hundred'; + $r = fmod($x, 100); + if($r > 0) + { + $w .= ' and '. self::numberToString($r); + } + } + elseif($x < 1000000) // 1000 to 999999 + { + $w .= self::numberToString(floor($x/1000)) .' thousand'; + $r = fmod($x, 1000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + else // millions + { + $w .= self::numberToString(floor($x/1000000)) .' million'; + $r = fmod($x, 1000000); + if($r > 0) + { + $w .= ' '; + if($r < 100) + { + $w .= 'and '; + } + $w .= self::numberToString($r); + } + } + } + return $w; + } + + /** + * Random Key + * + * @returns a string + */ + public static function randomkey($size) + { + $bag = "abcefghijknopqrstuwxyzABCDDEFGHIJKLLMMNOPQRSTUVVWXYZabcddefghijkllmmnopqrstuvvwxyzABCEFGHIJKNOPQRSTUWXYZ"; + $key = array(); + $bagsize = strlen($bag) - 1; + for ($i = 0; $i < $size; $i++) + { + $get = rand(0, $bagsize); + $key[] = $bag[$get]; + } + return implode($key); + } +} diff --git a/admin/helpers/headercheck.php b/admin/helpers/headercheck.php index 3cb683a..6ec1fa4 100644 --- a/admin/helpers/headercheck.php +++ b/admin/helpers/headercheck.php @@ -1,80 +1,80 @@ - @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 demoHeaderCheck -{ - function js_loaded($script_name) - { - // UIkit check point - if (strpos($script_name,'uikit') !== false) - { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - - if (strpos($getTemplateName,'yoo') !== false) - { - return true; - } - } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - foreach (array_keys($head_data['scripts']) as $script) - { - if (stristr($script, $script_name)) - { - return true; - } - } - - return false; - } - - function css_loaded($script_name) - { - // UIkit check point - if (strpos($script_name,'uikit') !== false) - { - $app = JFactory::getApplication(); - $getTemplateName = $app->getTemplate('template')->template; - - if (strpos($getTemplateName,'yoo') !== false) - { - return true; - } - } - - $document = JFactory::getDocument(); - $head_data = $document->getHeadData(); - - foreach (array_keys($head_data['styleSheets']) as $script) - { - if (stristr($script, $script_name)) - { - return true; - } - } - - return false; - } +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage headercheck.php + @author Llewellyn van der Merwe + @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 demoHeaderCheck +{ + function js_loaded($script_name) + { + // UIkit check point + if (strpos($script_name,'uikit') !== false) + { + $app = JFactory::getApplication(); + $getTemplateName = $app->getTemplate('template')->template; + + if (strpos($getTemplateName,'yoo') !== false) + { + return true; + } + } + + $document = JFactory::getDocument(); + $head_data = $document->getHeadData(); + foreach (array_keys($head_data['scripts']) as $script) + { + if (stristr($script, $script_name)) + { + return true; + } + } + + return false; + } + + function css_loaded($script_name) + { + // UIkit check point + if (strpos($script_name,'uikit') !== false) + { + $app = JFactory::getApplication(); + $getTemplateName = $app->getTemplate('template')->template; + + if (strpos($getTemplateName,'yoo') !== false) + { + return true; + } + } + + $document = JFactory::getDocument(); + $head_data = $document->getHeadData(); + + foreach (array_keys($head_data['styleSheets']) as $script) + { + if (stristr($script, $script_name)) + { + return true; + } + } + + return false; + } } \ No newline at end of file diff --git a/admin/helpers/html/batch_.php b/admin/helpers/html/batch_.php index 609b4b6..f88e013 100644 --- a/admin/helpers/html/batch_.php +++ b/admin/helpers/html/batch_.php @@ -1,87 +1,87 @@ - @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('JPATH_PLATFORM') or die; - -/** - * Utility class to render a list view batch selection options - * - * @since 3.0 - */ -abstract class JHtmlBatch_ -{ - /** - * ListSelection - * - * @var array - * @since 3.0 - */ - protected static $ListSelection = array(); - - /** - * Render the batch selection options. - * - * @return string The necessary HTML to display the batch selection options - * - * @since 3.0 - */ - public static function render() - { - // Collect display data - $data = new stdClass; - $data->ListSelection = static::getListSelection(); - - // Create a layout object and ask it to render the batch selection options - $layout = new JLayoutFile('batchselection'); - $batchHtml = $layout->render($data); - - return $batchHtml; - } - - /** - * Method to add a list selection to the batch modal - * - * @param string $label Label for the menu item. - * @param string $name Name for the filter. Also used as id. - * @param string $options Options for the select field. - * @param bool $noDefault Don't the label as the empty option - * - * @return void - * - * @since 3.0 - */ - public static function addListSelection($label, $name, $options, $noDefault = false) - { - array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault)); - } - - /** - * Returns an array of all ListSelection - * - * @return array - * - * @since 3.0 - */ - public static function getListSelection() - { - return static::$ListSelection; - } -} +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage batch_.php + @author Llewellyn van der Merwe + @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('JPATH_PLATFORM') or die; + +/** + * Utility class to render a list view batch selection options + * + * @since 3.0 + */ +abstract class JHtmlBatch_ +{ + /** + * ListSelection + * + * @var array + * @since 3.0 + */ + protected static $ListSelection = array(); + + /** + * Render the batch selection options. + * + * @return string The necessary HTML to display the batch selection options + * + * @since 3.0 + */ + public static function render() + { + // Collect display data + $data = new stdClass; + $data->ListSelection = static::getListSelection(); + + // Create a layout object and ask it to render the batch selection options + $layout = new JLayoutFile('batchselection'); + $batchHtml = $layout->render($data); + + return $batchHtml; + } + + /** + * Method to add a list selection to the batch modal + * + * @param string $label Label for the menu item. + * @param string $name Name for the filter. Also used as id. + * @param string $options Options for the select field. + * @param bool $noDefault Don't the label as the empty option + * + * @return void + * + * @since 3.0 + */ + public static function addListSelection($label, $name, $options, $noDefault = false) + { + array_push(static::$ListSelection, array('label' => $label, 'name' => $name, 'options' => $options, 'noDefault' => $noDefault)); + } + + /** + * Returns an array of all ListSelection + * + * @return array + * + * @since 3.0 + */ + public static function getListSelection() + { + return static::$ListSelection; + } +} diff --git a/admin/layouts/batchselection.php b/admin/layouts/batchselection.php index 18ea8cc..de9d70b 100644 --- a/admin/layouts/batchselection.php +++ b/admin/layouts/batchselection.php @@ -1,57 +1,57 @@ - @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('JPATH_BASE') or die; - -JHtmlBehavior::core(); -$divWrapper = range(1,120,2); -$counter = 0; -?> -ListSelection) : ?> -
- ListSelection as $ListSelection) : ?> -
-
- - -
-
- -
-
- - - -
-
-
- - -
-
+/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage batchselection.php + @author Llewellyn van der Merwe + @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('JPATH_BASE') or die; + +JHtmlBehavior::core(); +$divWrapper = range(1,120,2); +$counter = 0; +?> +ListSelection) : ?> +
+ ListSelection as $ListSelection) : ?> +
+
+ + +
+
+ +
+
+ + + +
+
+
+ + +
+
\ No newline at end of file diff --git a/admin/layouts/look/details_above.php b/admin/layouts/look/details_above.php index b928e41..606cc70 100644 --- a/admin/layouts/look/details_above.php +++ b/admin/layouts/look/details_above.php @@ -1,54 +1,54 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage details_above.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'name', - 'alias' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- + 'alias' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/look/details_fullwidth.php b/admin/layouts/look/details_fullwidth.php index 8241be9..7b04efa 100644 --- a/admin/layouts/look/details_fullwidth.php +++ b/admin/layouts/look/details_fullwidth.php @@ -1,53 +1,53 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( - 'description' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage details_fullwidth.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'description' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/look/details_under.php b/admin/layouts/look/details_under.php index 8bb743d..1c56d73 100644 --- a/admin/layouts/look/details_under.php +++ b/admin/layouts/look/details_under.php @@ -1,53 +1,53 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( - 'not_required' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - -
- - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - -
- +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage details_under.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'not_required' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + +
+ + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + +
+ diff --git a/admin/layouts/look/metadata.php b/admin/layouts/look/metadata.php index 67df7bd..f33fae2 100644 --- a/admin/layouts/look/metadata.php +++ b/admin/layouts/look/metadata.php @@ -1,50 +1,50 @@ - @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'); - -$form = $displayData->getForm(); - -// JLayout for standard handling of metadata fields in the administrator content edit screens. -$fieldSets = $form->getFieldsets('metadata'); -?> - - $fieldSet) : ?> - description) && trim($fieldSet->description)) : ?> -

escape(JText::_($fieldSet->description)); ?>

- - - renderField('metadesc'); - echo $form->renderField('metakey'); - } - - foreach ($form->getFieldset($name) as $field) - { - if ($field->name != 'jform[metadata][tags][]') - { - echo $field->renderField(); - } - } ?> - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage metadata.php + @author Llewellyn van der Merwe + @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'); + +$form = $displayData->getForm(); + +// JLayout for standard handling of metadata fields in the administrator content edit screens. +$fieldSets = $form->getFieldsets('metadata'); +?> + + $fieldSet) : ?> + description) && trim($fieldSet->description)) : ?> +

escape(JText::_($fieldSet->description)); ?>

+ + + renderField('metadesc'); + echo $form->renderField('metakey'); + } + + foreach ($form->getFieldset($name) as $field) + { + if ($field->name != 'jform[metadata][tags][]') + { + echo $field->renderField(); + } + } ?> + diff --git a/admin/layouts/look/more_left.php b/admin/layouts/look/more_left.php index 0c17e82..b0ccb9f 100644 --- a/admin/layouts/look/more_left.php +++ b/admin/layouts/look/more_left.php @@ -1,51 +1,51 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( - 'add' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage more_left.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( + 'add' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/look/more_right.php b/admin/layouts/look/more_right.php index 9d0588b..7647fb9 100644 --- a/admin/layouts/look/more_right.php +++ b/admin/layouts/look/more_right.php @@ -1,55 +1,55 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage more_right.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'email', 'mobile_phone', 'dateofbirth', 'image', - 'website' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'website' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/look/publishing.php b/admin/layouts/look/publishing.php index 29efb62..64e289f 100644 --- a/admin/layouts/look/publishing.php +++ b/admin/layouts/look/publishing.php @@ -1,40 +1,40 @@ - @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'); - -// get the form -$form = $displayData->getForm(); - -// get the layout fields override method name (from layout path/ID) -$layout_path_array = explode('.', $this->getLayoutId()); -// Since we cannot pass the layout and tab names as parameters to the model method -// this name combination of tab and layout in the method name is the only work around -// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. -// example of layout name: details_left.php -// example of method name: getFields_details_left() -$fields_tab_layout = 'fields_' . $layout_path_array[1]; - -// get the fields -$fields = $displayData->get($fields_tab_layout) ?: array( +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage publishing.php + @author Llewellyn van der Merwe + @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'); + +// get the form +$form = $displayData->getForm(); + +// get the layout fields override method name (from layout path/ID) +$layout_path_array = explode('.', $this->getLayoutId()); +// Since we cannot pass the layout and tab names as parameters to the model method +// this name combination of tab and layout in the method name is the only work around +// seeing that JCB uses those two values (tab_name & layout_name) as the layout file name. +// example of layout name: details_left.php +// example of method name: getFields_details_left() +$fields_tab_layout = 'fields_' . $layout_path_array[1]; + +// get the fields +$fields = $displayData->get($fields_tab_layout) ?: array( 'title', 'created', 'created_by', @@ -45,17 +45,17 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'access', 'version', 'hits', - 'id' -); - -$hiddenFields = $displayData->get('hidden_fields') ?: array(); - -?> - - - - setFieldAttribute($field, 'type', 'hidden'); ?> - - renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> - - + 'id' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +?> + + + + setFieldAttribute($field, 'type', 'hidden'); ?> + + renderField($field, null, null, array('class' => 'control-wrapper-' . $field)); ?> + + diff --git a/admin/layouts/trashhelper.php b/admin/layouts/trashhelper.php index c8491c0..72f833f 100644 --- a/admin/layouts/trashhelper.php +++ b/admin/layouts/trashhelper.php @@ -1,28 +1,28 @@ - @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 +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage trashhelper.php + @author Llewellyn van der Merwe + @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('JPATH_BASE') or die('Restricted access'); - - + + ?> state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?> - -
-
- - sidebar)) : ?> -
- sidebar; ?> -
-
- -
- - - hasPackage && DemoHelper::checkArray($this->headerList) && DemoHelper::checkArray($this->headers)) : ?> -
- -
- -
- -
-
- headerList as $name => $title): ?> -
- -
- -
-
- -
- -
-
- - - 'upload')); ?> - - -
- -
- -
- -
-
-
-     (.csv .xls .ods) -
-
- - - -
- -
- -
- -
-
-
-     (.csv .xls .ods) -
-
- - - -
- -
- -
- -
-
-
-     (.csv .xls .ods) -
-
- - - - - - - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage default.php + @author Llewellyn van der Merwe + @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'); + +JHtml::_('jquery.framework'); +JHtml::_('bootstrap.tooltip'); +JHtml::_('script', 'system/core.js', false, true); +JHtml::_('behavior.keepalive'); +?> + + +
+
+ + sidebar)) : ?> +
+ sidebar; ?> +
+
+ +
+ + + hasPackage && DemoHelper::checkArray($this->headerList) && DemoHelper::checkArray($this->headers)) : ?> +
+ +
+ +
+ +
+
+ headerList as $name => $title): ?> +
+ +
+ +
+
+ +
+ +
+
+ + + 'upload')); ?> + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + +
+ +
+ +
+ +
+
+
+     (.csv .xls .ods) +
+
+ + + + + + +
\ No newline at end of file diff --git a/admin/views/import/view.html.php b/admin/views/import/view.html.php index 64f01e8..3e961f4 100644 --- a/admin/views/import/view.html.php +++ b/admin/views/import/view.html.php @@ -1,102 +1,102 @@ - @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'); - -/** - * Demo Import View - */ -class DemoViewImport extends JViewLegacy -{ - protected $headerList; - protected $hasPackage = false; - protected $headers; - protected $hasHeader = 0; - protected $dataType; - - public function display($tpl = null) - { - if ($this->getLayout() !== 'modal') - { - // Include helper submenu - DemoHelper::addSubmenu('import'); - } - - $paths = new stdClass; - $paths->first = ''; - $state = $this->get('state'); - - $this->paths = &$paths; - $this->state = &$state; - // get global action permissions - $this->canDo = DemoHelper::getActions('import'); - - // We don't need toolbar in the modal window. - if ($this->getLayout() !== 'modal') - { - $this->addToolbar(); - $this->sidebar = JHtmlSidebar::render(); - } - - // get the session object - $session = JFactory::getSession(); - // check if it has package - $this->hasPackage = $session->get('hasPackage', false); - $this->dataType = $session->get('dataType', false); - if($this->hasPackage && $this->dataType) - { - $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); - $this->headers = DemoHelper::getFileHeaders($this->dataType); - // clear the data type - $session->clear('dataType'); - } - - // Check for errors. - if (count($errors = $this->get('Errors'))) - { - throw new Exception(implode("\n", $errors), 500); - } - - // Display the template - parent::display($tpl); - } - - /** - * Setting the toolbar - */ - protected function addToolBar() - { - JToolBarHelper::title(JText::_('COM_DEMO_IMPORT_TITLE'), 'upload'); - JHtmlSidebar::setAction('index.php?option=com_demo&view=import'); - - if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) - { - JToolBarHelper::preferences('com_demo'); - } - - // set help url for this view if found - $help_url = DemoHelper::getHelpUrl('import'); - if (DemoHelper::checkString($help_url)) - { - JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); - } - } -} +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage view.html.php + @author Llewellyn van der Merwe + @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'); + +/** + * Demo Import View + */ +class DemoViewImport extends JViewLegacy +{ + protected $headerList; + protected $hasPackage = false; + protected $headers; + protected $hasHeader = 0; + protected $dataType; + + public function display($tpl = null) + { + if ($this->getLayout() !== 'modal') + { + // Include helper submenu + DemoHelper::addSubmenu('import'); + } + + $paths = new stdClass; + $paths->first = ''; + $state = $this->get('state'); + + $this->paths = &$paths; + $this->state = &$state; + // get global action permissions + $this->canDo = DemoHelper::getActions('import'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + } + + // get the session object + $session = JFactory::getSession(); + // check if it has package + $this->hasPackage = $session->get('hasPackage', false); + $this->dataType = $session->get('dataType', false); + if($this->hasPackage && $this->dataType) + { + $this->headerList = json_decode($session->get($this->dataType.'_VDM_IMPORTHEADERS', false),true); + $this->headers = DemoHelper::getFileHeaders($this->dataType); + // clear the data type + $session->clear('dataType'); + } + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + // Display the template + parent::display($tpl); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + JToolBarHelper::title(JText::_('COM_DEMO_IMPORT_TITLE'), 'upload'); + JHtmlSidebar::setAction('index.php?option=com_demo&view=import'); + + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_demo'); + } + + // set help url for this view if found + $help_url = DemoHelper::getHelpUrl('import'); + if (DemoHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_DEMO_HELP_MANAGER', false, $help_url); + } + } +} diff --git a/admin/views/look/submitbutton.js b/admin/views/look/submitbutton.js index 71a34de..a4b1467 100644 --- a/admin/views/look/submitbutton.js +++ b/admin/views/look/submitbutton.js @@ -1,34 +1,34 @@ -/*----------------------------------------------------------------------------------| www.vdm.io |----/ - Vast Development Method -/-------------------------------------------------------------------------------------------------------/ - - @version 2.0.3 - @build 8th February, 2021 - @created 18th October, 2016 - @package Demo - @subpackage submitbutton.js - @author Llewellyn van der Merwe - @copyright Copyright (C) 2015. All Rights Reserved - @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html - ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ - (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) -.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( -\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) - -/------------------------------------------------------------------------------------------------------*/ - -Joomla.submitbutton = function(task) -{ - if (task == ''){ - return false; - } else { - var action = task.split('.'); - if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ - Joomla.submitform(task, document.getElementById("adminForm")); - return true; - } else { - alert(Joomla.JText._('look, some values are not acceptable.','Some values are unacceptable')); - return false; - } - } +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage submitbutton.js + @author Llewellyn van der Merwe + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + ____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____ + (_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _) +.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )( +\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__) + +/------------------------------------------------------------------------------------------------------*/ + +Joomla.submitbutton = function(task) +{ + if (task == ''){ + return false; + } else { + var action = task.split('.'); + if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){ + Joomla.submitform(task, document.getElementById("adminForm")); + return true; + } else { + alert(Joomla.JText._('look, some values are not acceptable.','Some values are unacceptable')); + return false; + } + } } \ No newline at end of file diff --git a/admin/views/look/tmpl/edit.php b/admin/views/look/tmpl/edit.php index e776779..b013e19 100644 --- a/admin/views/look/tmpl/edit.php +++ b/admin/views/look/tmpl/edit.php @@ -1,33 +1,33 @@ - @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'); - +/*----------------------------------------------------------------------------------| www.vdm.io |----/ + Vast Development Method +/-------------------------------------------------------------------------------------------------------/ + + @version 2.0.3 + @build 18th October, 2021 + @created 18th October, 2016 + @package Demo + @subpackage edit.php + @author Llewellyn van der Merwe + @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'); + JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); JHtml::_('formbehavior.chosen', 'select'); -JHtml::_('behavior.keepalive'); -$componentParams = $this->params; // will be removed just use $this->params instead -?> +JHtml::_('behavior.keepalive'); +$componentParams = $this->params; // will be removed just use $this->params instead +?> -