protected function _beforeDispatch(KCommandContext $context) { if ($this->getRequest()->container === 'docman-files') { KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.file'))); KService::setConfig('com://admin/files.controller.folder', array('behaviors' => array('com://admin/docman.controller.behavior.folder'))); KService::setAlias('com://admin/files.model.containers', 'com://admin/docman.model.containers'); KService::setAlias('com://site/files.model.containers', 'com://admin/docman.model.containers'); } // Use our own ACL instead of com_files' KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/docman.controller.behavior.executable'); if ($this->getRequest()->routed) { $app = JFactory::getApplication(); $behavior = 'com://admin/docman.controller.behavior.cacheable'; // If the upload_folder parameter is set, we change the container path so results are different if ($app->isSite() && $app->getMenu()->getActive()->params->get('upload_folder')) { $behavior = $this->getService($behavior, array('only_clear' => true)); } foreach (array('file', 'folder', 'node', 'thumbnail') as $name) { KService::setConfig('com://admin/files.controller.' . $name, array('behaviors' => array($behavior))); } if (!in_array($this->getRequest()->container, array('docman-files', 'docman-icons', 'docman-images'))) { $this->getRequest()->container = 'docman-files'; } if ($this->getRequest()->container === 'docman-icons') { KService::setConfig('com://admin/files.controller.file', array('behaviors' => array('com://admin/docman.controller.behavior.icon'))); } // Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249 JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true)); $context->result = $this->getService('com://admin/files.dispatcher', array('request' => array('container' => $this->getRequest()->container)))->dispatch(); return false; } }
public function __construct($subject, $config = array()) { // Turn off E_STRICT errors for now error_reporting(error_reporting() & ~E_STRICT); // Check if database type is MySQLi if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') { if (JFactory::getApplication()->getName() === 'administrator') { $string = version_compare(JVERSION, '1.6', '<') ? 'mysqli' : 'MySQLi'; $link = JRoute::_('index.php?option=com_config'); $error = 'In order to use Joomlatools framework, your database type in Global Configuration should be set to <strong>%1$s</strong>. Please go to <a href="%2$s">Global Configuration</a> and in the \'Server\' tab change your Database Type to <strong>%1$s</strong>.'; JError::raiseWarning(0, sprintf(JText::_($error), $string, $link)); } return; } // Set pcre.backtrack_limit to a larger value // See: https://bugs.php.net/bug.php?id=40846 if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) { @ini_set('pcre.backtrack_limit', 1000000); } //Set constants define('KDEBUG', JDEBUG); //Set path definitions define('JPATH_FILES', JPATH_ROOT); define('JPATH_IMAGES', JPATH_ROOT . DIRECTORY_SEPARATOR . 'images'); //Set exception handler set_exception_handler(array($this, 'exceptionHandler')); // Koowa : setup require_once JPATH_LIBRARIES . '/koowa/koowa.php'; Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false)); KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE))); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component')); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('translator', 'com:default.translator'); //Setup the request if (JFactory::getApplication()->getName() !== 'site') { KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base())); } //Load the koowa plugins JPluginHelper::importPlugin('koowa', null, true); //Bugfix : Set offset accoording to user's timezone if (!JFactory::getUser()->guest) { if ($offset = JFactory::getUser()->getParam('timezone')) { if (version_compare(JVERSION, '3.0', '>=')) { JFactory::getConfig()->set('offset', $offset); } else { JFactory::getConfig()->setValue('config.offset', $offset); } } } // Load language files for the framework KService::get('com:default.translator')->loadLanguageFiles(); parent::__construct($subject, $config); }
public function setAliases() { if (!$this->_loaded) { $maps = array('com://site/wufoo.model.forms' => 'com://admin/wufoo.model.forms', 'com://site/wufoo.model.entries' => 'com://admin/wufoo.model.entries'); foreach ($maps as $alias => $identifier) { KService::setAlias($alias, $identifier); } $this->setLoaded(true); } return $this; }
public function setAliases() { if (!$this->_loaded) { $maps = array('com://site/events.database.table.events' => 'com://admin/events.database.table.events'); foreach ($maps as $alias => $identifier) { KService::setAlias($alias, $identifier); } $this->setLoaded(true); } return $this; }
public function setAliases() { if (!$this->_loaded) { $maps = array(); foreach ($maps as $alias => $identifier) { KService::setAlias($alias, $identifier); } $this->setLoaded(true); } return $this; }
public function setAliases() { if (!$this->_loaded) { $maps = array('com://admin/users.template.helper.listbox' => 'com://admin/logman.template.helper.listbox', 'com://admin/users.template.helper.autocomplete' => 'com://admin/logman.template.helper.autocomplete'); foreach ($maps as $from => $to) { KService::setAlias($from, $to); } $this->setLoaded(true); } return $this; }
public function setAliases() { if (!$this->_loaded) { $loader = KService::get('koowa:loader'); if (KRequest::get('get.view', 'cmd') === 'doclink') { $loader->loadIdentifier('com://site/docman.model.default'); } // This is here because if we map the controller, backend view will be used instead of the frontend $loader->loadIdentifier('com://admin/docman.controller.file'); $loader->loadIdentifier('com://admin/docman.controller.behaviors.permissions'); $loader->loadIdentifier('com://admin/default.controller.toolbars.default'); $loader->loadIdentifier('com://admin/docman.controller.toolbars.default'); $loader->loadIdentifier('com://admin/docman.model.documents'); $maps = array( 'com://site/docman.controller.doclink' => 'com://admin/docman.controller.doclink', 'com://site/docman.controller.file' => 'com://admin/docman.controller.file', 'com://site/docman.controller.behavior.aclable' => 'com://admin/docman.controller.behavior.aclable', 'com://site/docman.controller.behavior.image' => 'com://admin/docman.controller.behavior.image', 'com://site/docman.model.files' => 'com://admin/docman.model.files', 'com://site/docman.model.nodes' => 'com://admin/docman.model.nodes', 'com://site/docman.database.table.nodes' => 'com://admin/docman.database.table.nodes', 'com://site/docman.database.table.categories' => 'com://admin/docman.database.table.categories', 'com://site/docman.database.table.documents' => 'com://admin/docman.database.table.documents', 'com://site/docman.database.row.node' => 'com://admin/docman.database.row.node', 'com://site/docman.database.row.category' => 'com://admin/docman.database.row.category', 'com://site/docman.database.row.document' => 'com://admin/docman.database.row.document', 'com://site/docman.database.row.file' => 'com://admin/docman.database.row.file', 'com://site/docman.database.rowset.nodes' => 'com://admin/docman.database.rowset.nodes', 'com://site/docman.database.rowset.files' => 'com://admin/docman.database.rowset.files', 'com://site/docman.template.helper.grid' => 'com://admin/docman.template.helper.grid', 'com://site/docman.template.helper.listbox' => 'com://admin/docman.template.helper.listbox', 'com://site/docman.template.helper.toolbar' => 'com://admin/default.template.helper.toolbar', 'com://site/docman.template.helper.modal' => 'com://admin/docman.template.helper.modal', 'com://site/docman.template.filter.bootstrap' => 'com://admin/docman.template.filter.bootstrap', 'com://site/docman.template.filter.form' => 'com://admin/docman.template.filter.form', 'com://site/docman.template.filter.style' => 'com://admin/docman.template.filter.style' ); foreach ($maps as $alias => $identifier) { KService::setAlias($alias, $identifier); } $this->setLoaded(true); } return $this; }
protected function _actionDispatch(KCommandContext $context) { if ($this->_request->routed) { // Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249 // TODO: Move this to the Nooku Framework plugin JFactory::getSession()->set('com_fileman.fix.the.session.bug', microtime(true)); // Use our own ACL instead of com_files' KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/fileman.controller.behavior.executable'); $context->result = $this->getService('com://admin/files.dispatcher')->dispatch(); return $context->result; } return parent::_actionDispatch($context); }
protected function _beforeDispatch(KCommandContext $context) { // Use our own ACL instead of com_files' KService::setAlias('com://admin/files.controller.behavior.executable', 'com://admin/fileman.controller.behavior.executable'); // Cache the hell out of JSON requests foreach (array('file', 'folder', 'node', 'thumbnail') as $name) { KService::setConfig('com://admin/files.controller.' . $name, array('behaviors' => array('com://admin/fileman.controller.behavior.cacheable'))); } if ($this->getRequest()->routed) { $this->getRequest()->container = 'fileman-files'; // Work-around the bug here: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=28249 // TODO: Move this to the Nooku Framework plugin JFactory::getSession()->set('com_docman.fix.the.session.bug', microtime(true)); // Swap the language object temporarily to use our own translator /*$lang = JFactory::getLanguage(); JFactory::$language = $this->getService('com://admin/docman.language.decorator', array('object' => $lang));*/ $context->result = $this->getService('com://admin/files.dispatcher')->dispatch(); //JFactory::$language = $lang; return false; } }
<?php /** * LICENSE: ##LICENSE## * * @category Anahita * @author Arash Sanieyan <*****@*****.**> * @author Rastin Mehr <*****@*****.**> * @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html> * @version SVN: $Id: view.php 13650 2012-04-11 08:56:41Z asanieyan $ * @link http://www.anahitapolis.com */ $config = new JConfig(); $config->cache_prefix = md5($config->secret) . '-cache-system'; $config->cache_enabled = $config->caching; KService::setAlias('application.registry', 'com://site/application.registry'); KService::setAlias('application', 'com://site/application'); KService::setConfig('application.registry', array('cache_prefix' => $config->cache_prefix, 'cache_enabled' => $config->cache_enabled));
<? KService::setAlias('com://site/calendar.model.events', 'com://admin/calendar.model.events'); KService::setAlias('com://site/calendar.database.table.events', 'com://admin/calendar.database.table.events'); KService::setAlias('com://site/calendar.database.table.days', 'com://admin/calendar.database.table.days'); KService::setAlias('com://site/calendar.template.helper.behavior', 'com://site/news.template.helper.behavior');
<?php KService::setAlias('com://site/kutafuta.model.terms', 'com://admin/kutafuta.model.terms'); KService::setAlias('com://site/kutafuta.database.row.term', 'com://admin/kutafuta.database.row.term'); echo KService::get('com://site/kutafuta.dispatcher')->dispatch();
public function onAfterRoute() { //map the actor helper class to a custom class PlgSystemActorhelper KService::setAlias('com://site/actors.template.helper', 'plg://site/system.username.helper'); KService::setAlias('com://site/actors.template.helper.story', 'plg://site/system.username.story'); }
<?php KService::setAlias('com://site/news.database.table.articles', 'com://admin/news.database.table.articles'); KService::setAlias('com://site/news.model.activities', 'com://admin/news.model.activities'); KService::setAlias('com://site/news.model.articles', 'com://admin/news.model.articles'); KService::setAlias('com://site/news.model.comments', 'com://admin/news.model.comments'); KService::setAlias('com://site/news.template.helper.listbox', 'com://admin/news.template.helper.listbox'); KService::setAlias('com://admin/attachments.controller.behavior.executable', 'com://site/news.controller.behavior.executable');
if (!defined('JPATH_BASE')) { $base = dirname($_SERVER['DOCUMENT_ROOT'] . $_SERVER['SCRIPT_NAME']); $base = str_replace('/components/com_notifications', '', $base); define('JPATH_BASE', $base); require_once JPATH_BASE . '/includes/framework.php'; KService::get('com://site/application.dispatcher')->load(); } class ComNotificationsRouterApplication extends ComApplicationRouter { /** * Always return absolute URL. * * (non-PHPdoc) * * @see ComApplicationRouter::build() */ public function build(&$query = '', $fqr = false) { return parent::build($query, true); } } KService::setAlias('com://site/application.router', 'com://site/notifications.router.application'); $base_url = KService::get('koowa:http.url', array('url' => rtrim(JURI::base(), '/'))); KService::setConfig('com://site/application.router', array('base_url' => $base_url)); $controller = KService::get('com://site/notifications.controller.processor', array('base_url' => $base_url)); $ids = (array) KRequest::get('get.id', 'int', array()); if (!empty($ids)) { $controller->id($ids); } $controller->process(); exit(0);
public function __construct($subject, $config = array()) { // Turn off E_STRICT errors for now error_reporting(error_reporting() & ~E_STRICT); // Command line fixes for Joomla if (PHP_SAPI === 'cli') { if (!isset($_SERVER['HTTP_HOST'])) { $_SERVER['HTTP_HOST'] = ''; } if (!isset($_SERVER['REQUEST_METHOD'])) { $_SERVER['REQUEST_METHOD'] = ''; } } // Check if Koowa is active if (JFactory::getApplication()->getCfg('dbtype') != 'mysqli') { JError::raiseWarning(0, JText::_("Koowa plugin requires MySQLi Database Driver. Please change your database configuration settings to 'mysqli'")); return; } // Check for suhosin if (in_array('suhosin', get_loaded_extensions())) { //Attempt setting the whitelist value @ini_set('suhosin.executor.include.whitelist', 'tmpl://, file://'); //Checking if the whitelist is ok if (!@ini_get('suhosin.executor.include.whitelist') || strpos(@ini_get('suhosin.executor.include.whitelist'), 'tmpl://') === false) { JError::raiseWarning(0, sprintf(JText::_('Your server has Suhosin loaded. Please follow <a href="%s" target="_blank">this</a> tutorial.'), 'http://www.joomlatools.com/framework-known-issues')); return; } } //Safety Extender compatibility if (extension_loaded('safeex') && strpos('tmpl', @ini_get('safeex.url_include_proto_whitelist')) === false) { $whitelist = @ini_get('safeex.url_include_proto_whitelist'); $whitelist = (strlen($whitelist) ? $whitelist . ',' : '') . 'tmpl'; @ini_set('safeex.url_include_proto_whitelist', $whitelist); } // Set pcre.backtrack_limit to a larger value // See: https://bugs.php.net/bug.php?id=40846 if (version_compare(PHP_VERSION, '5.3.6', '<=') && @ini_get('pcre.backtrack_limit') < 1000000) { @ini_set('pcre.backtrack_limit', 1000000); } //Set constants define('KDEBUG', JDEBUG); //Set path definitions define('JPATH_FILES', JPATH_ROOT); define('JPATH_IMAGES', JPATH_ROOT . DS . 'images'); //Set exception handler set_exception_handler(array($this, 'exceptionHandler')); // Koowa : setup require_once JPATH_LIBRARIES . '/koowa/koowa.php'; Koowa::getInstance(array('cache_prefix' => md5(JFactory::getApplication()->getCfg('secret')) . '-cache-koowa', 'cache_enabled' => false)); KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE))); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component')); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('translator', 'com:default.translator'); //Setup the request KRequest::root(str_replace('/' . JFactory::getApplication()->getName(), '', KRequest::base())); //Load the koowa plugins JPluginHelper::importPlugin('koowa', null, true, KService::get('com://admin/default.event.dispatcher')); //Bugfix : Set offset accoording to user's timezone if (!JFactory::getUser()->guest) { if ($offset = JFactory::getUser()->getParam('timezone')) { JFactory::getConfig()->setValue('config.offset', $offset); } } // Load language files for the framework KService::get('com:default.translator')->loadLanguageFiles(); parent::__construct($subject, $config); }
<?php KService::setAlias('com://site/comments.command.authorize', 'com://admin/comments.command.authorize'); KService::setAlias('com://site/comments.model.comments', 'com://admin/comments.model.comments');
<?php KService::setAlias('com://site/attachments.model.attachments', 'com://admin/attachments.model.attachments'); KService::setAlias('com://site/attachments.view.attachment.file', 'com://admin/attachments.view.attachment.file');
<?php /** * @package FILEman * @copyright Copyright (C) 2012 Timble CVBA. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.joomlatools.com */ defined('_JEXEC') or die; KService::setAlias('com://site/fileman.controller.filelink', 'com://admin/fileman.controller.filelink'); if (KRequest::get('get.routed', 'int')) { KService::setAlias('com://site/fileman.dispatcher', 'com://admin/files.dispatcher'); }
<?php /** * @version $Id: aliases.php 3024 2011-10-09 01:44:30Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Weblinks * @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Service Aliases * * @author Jeremy Wilken <http://nooku.assembla.com/profile/gnomeontherun> * @category Nooku * @package Nooku_Server * @subpackage Weblinks */ KService::setAlias('com://site/weblinks.model.categories', 'com://admin/weblinks.model.categories'); KService::setAlias('com://site/weblinks.model.weblinks', 'com://admin/weblinks.model.weblinks');
<?php /** * @version $Id: aliases.php 3024 2011-10-09 01:44:30Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Users * @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net). * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Service Aliases * * @author Gergo Erdosi <http://nooku.assembla.com/profile/gergoerdosi> * @category Nooku * @package Nooku_Server * @subpackage Users */ KService::setAlias('com://site/users.controller.default', 'com://admin/users.controller.default'); KService::setAlias('com://site/users.model.users', 'com://admin/users.model.users'); KService::setAlias('com://site/users.database.row.user', 'com://admin/users.database.row.user'); KService::setAlias('com://site/users.database.table.groups', 'com://admin/users.database.table.groups'); KService::setAlias('com://site/users.database.table.users', 'com://admin/users.database.table.users'); KService::setAlias('com://site/users.helper.password', 'com://admin/users.helper.password');
<?php /** * LICENSE: ##LICENSE##. * * @category Anahita * * @author Arash Sanieyan <*****@*****.**> * @author Rastin Mehr <*****@*****.**> * @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html> * * @version SVN: $Id: view.php 13650 2012-04-11 08:56:41Z asanieyan $ * * @link http://www.GetAnahita.com */ $config = new JConfig(); $config->cache_prefix = md5($config->secret) . '-cache-system'; $config->cache_enabled = $config->caching; KService::setAlias('application.registry', 'com://admin/application.registry'); KService::setConfig('application.registry', array('cache_prefix' => $config->cache_prefix, 'cache_enabled' => $config->cache_enabled));
jimport('joomla.user.user'); jimport('joomla.environment.uri'); jimport('joomla.html.html'); jimport('joomla.html.parameter'); jimport('joomla.utilities.utility'); jimport('joomla.event.event'); jimport('joomla.event.dispatcher'); jimport('joomla.language.language'); jimport('joomla.utilities.string'); jimport('joomla.plugin.helper'); require_once JPATH_CONFIGURATION . '/configuration.php'; require_once JPATH_LIBRARIES . '/anahita/anahita.php'; $config = new JConfig(); //instantiate anahita and nooku Anahita::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching)); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component')); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KLoader::addAdapter(new AnLoaderAdapterTemplate(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.template')); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli'); KService::setAlias('anahita:domain.store.database', 'com:base.domain.store.database'); KService::setAlias('anahita:domain.space', 'com:base.domain.space'); //make sure for the autoloader to be reigstered after nooku $autoloader = (require_once JPATH_VENDOR . '/autoload.php'); $autoloader->unregister(); $autoloader->register(); KLoader::getInstance()->loadIdentifier('com://site/application.aliases');
static function renderComponent($name, $params = array()) { global $mainframe, $option; // Define component path define('JPATH_COMPONENT', JPATH_BASE . DS . 'components' . DS . $name); define('JPATH_COMPONENT_SITE', JPATH_SITE . DS . 'components' . DS . $name); define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . DS . 'components' . DS . $name); if (!file_exists(JPATH_COMPONENT)) { JError::raiseError(404, JText::_('Component Not Found')); } $file = substr($name, 4); // get component path if ($mainframe->isAdmin() && file_exists(JPATH_COMPONENT . DS . 'admin.' . $file . '.php')) { $path = JPATH_COMPONENT . DS . 'admin.' . $file . '.php'; } else { $path = JPATH_COMPONENT . DS . $file . '.php'; } $identifier = KService::getIdentifier("com:{$file}.aliases"); $identifier->application = $mainframe->isAdmin() ? 'admin' : 'site'; $lang =& JFactory::getLanguage(); $lang->load($name); KLoader::getInstance()->loadIdentifier($identifier); //new way of doing it if (!file_exists($path)) { $identifier->name = 'dispatcher'; register_default(array('identifier' => $identifier, 'default' => 'ComBaseDispatcherDefault')); $dispatcher = ComBaseDispatcher::getInstance(); KService::setAlias('component.dispatcher', $dispatcher->getIdentifier()); KService::set('component.dispatcher', $dispatcher); return $dispatcher->dispatch(); } else { $contents = self::_renderComponent($path); // Build the component toolbar jimport('joomla.application.helper'); if (($path = JApplicationHelper::getPath('toolbar')) && $mainframe->isAdmin()) { // Get the task again, in case it has changed $task = JRequest::getString('task'); // Make the toolbar include_once $path; } return $contents; } }
<?php KService::setAlias('com://site/businesses.database.table.businesses', 'com://admin/businesses.database.table.businesses'); KService::setAlias('com://site/businesses.database.table.dashboards', 'com://admin/businesses.database.table.dashboards'); KService::setAlias('com://site/businesses.model.businesses', 'com://admin/businesses.model.businesses'); KService::setAlias('com://site/businesses.template.helper.grid', 'com://admin/businesses.template.helper.grid'); KService::setAlias('com://site/businesses.template.helper.listbox', 'com://admin/businesses.template.helper.listbox');
public function postflight($type, $installer) { /* * Temporary fix: When upgrading from RC3 to RC4 we added a constant in KHttpUrl * and use it in KFilterInternalurl. The problem is we load KHttpUrl on upgrade before * overwriting the files. So KFilterInternalurl tries to reach a non-existent constant * which is a fatal error. Hence this: */ if (class_exists('Koowa')) { KService::get('koowa:filter.internalurl'); } $this->helper->installFramework(); $this->helper->installExtensions(); // Hide component in the menu manager in Joomla 1.5 if (version_compare(JVERSION, '1.6', '<')) { $db = JFactory::getDBO(); $db->setQuery("UPDATE #__components SET link = '' WHERE link = 'option=com_extman'"); $db->query(); } if ($this->helper->bootFramework()) { KService::setAlias('translator', 'com:default.translator'); $controller = KService::get('com://admin/extman.controller.extension', array('request' => array('view' => 'extension', 'layout' => 'success'))); $controller->event = $type === 'update' ? 'update' : 'install'; $extension = $controller->read(); $extension->name = 'EXTman'; $extension->version = (string) $this->helper->manifest->version; echo $controller->display(); } }
<?php /** * @version $Id: portfolio.php 51 2011-11-07 12:50:48Z richie $ * @category Portfolio * @copyright 2011 Wintersett. All rights reserved. * @license http://www.gnu.org/licenses/gpl.html * @link http://wintersettmedia.co.uk */ defined('_JEXEC') or die('Restricted access'); KService::setAlias('com://site/portfolio.model.people', 'com://admin/portfolio.model.people');
/** * Creates the admin user */ public static function createAdminUser(&$vars) { $DBtype = JArrayHelper::getValue($vars, 'DBtype', 'mysqli'); $DBhostname = JArrayHelper::getValue($vars, 'DBhostname', ''); $DBuserName = JArrayHelper::getValue($vars, 'DBuserName', ''); $DBpassword = JArrayHelper::getValue($vars, 'DBpassword', ''); $DBname = JArrayHelper::getValue($vars, 'DBname', ''); $DBPrefix = JArrayHelper::getValue($vars, 'DBPrefix', ''); $adminPassword = JArrayHelper::getValue($vars, 'adminPassword', ''); $adminEmail = JArrayHelper::getValue($vars, 'adminEmail', ''); jimport('joomla.user.helper'); // Create random salt/password for the admin user $salt = JUserHelper::genRandomPassword(32); $crypt = JUserHelper::getCryptedPassword($adminPassword, $salt); $cryptpass = $crypt . ':' . $salt; $db =& JInstallationHelper::getDBO($DBtype, $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix); $vars = array_merge(array('adminLogin' => 'admin', 'adminName' => 'Administrator'), $vars); $adminLogin = $vars['adminLogin']; $adminName = $vars['adminName']; // create the admin user $installdate = date('Y-m-d H:i:s'); $nullDate = $db->getNullDate(); $query = "INSERT INTO #__users VALUES (62, '{$adminName}', '{$adminLogin}', " . $db->Quote($adminEmail) . ", " . $db->Quote($cryptpass) . ", 'Super Administrator', 0, 1, 25, '{$installdate}', '{$nullDate}', '', '')"; $db->setQuery($query); if (!$db->query()) { // is there already and existing admin in migrated data if ($db->getErrorNum() == 1062) { $vars['adminLogin'] = JText::_('Admin login in migrated content was kept'); $vars['adminPassword'] = JText::_('Admin password in migrated content was kept'); return; } else { echo $db->getErrorMsg(); return; } } // add the ARO (Access Request Object) $query = "INSERT INTO #__core_acl_aro VALUES (10,'users','62',0,'Administrator',0)"; $db->setQuery($query); if (!$db->query()) { echo $db->getErrorMsg(); return; } // add the map between the ARO and the Group $query = "INSERT INTO #__core_acl_groups_aro_map VALUES (25,'',10)"; $db->setQuery($query); if (!$db->query()) { echo $db->getErrorMsg(); return; } //Anahita Installation require_once JPATH_LIBRARIES . '/anahita/anahita.php'; //instantiate anahita and nooku Anahita::getInstance(array('cache_prefix' => uniqid(), 'cache_enabled' => false)); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KLoader::addAdapter(new AnLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('anahita:service.locator.component')); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KService::setAlias('anahita:domain.space', 'com:base.domain.space'); KService::set('koowa:database.adapter.mysqli', KService::get('koowa:database.adapter.mysqli', array('connection' => $db->_resource, 'table_prefix' => $DBPrefix))); KService::set('anahita:domain.store.database', KService::get('anahita:domain.store.database', array('adapter' => KService::get('koowa:database.adapter.mysqli')))); KService::set('plg:storage.default', new KObject()); $person = KService::get('repos://site/people')->getEntity()->setData(array('name' => $adminName, 'userId' => 62, 'username' => $adminLogin, 'userType' => 'Super Administrator', 'email' => $adminEmail)); $note = KService::get('repos://site/notes')->getEntity()->setData(array('author' => $person, 'owner' => $person, 'body' => 'Welcome to Anahita!')); $comment = $note->addComment(array('author' => $person, 'body' => 'The best Social Platform there is', 'component' => 'com_notes')); $story = KService::get('repos://site/stories')->getEntity()->setData(array('component' => 'com_notes', 'name' => 'note_comment', 'object' => $note, 'comment' => $comment, 'target' => $person, 'owner' => $person, 'subject' => $person)); $entities = array(); $comment->save($entities); return true; }
} // System includes require_once JPATH_LIBRARIES . '/joomla/import.php'; // Joomla : setup jimport('joomla.application.menu'); jimport('joomla.user.user'); jimport('joomla.environment.uri'); jimport('joomla.html.html'); jimport('joomla.html.parameter'); jimport('joomla.utilities.utility'); jimport('joomla.event.event'); jimport('joomla.event.dispatcher'); jimport('joomla.language.language'); jimport('joomla.utilities.string'); jimport('joomla.plugin.helper'); // Koowa : setup require_once JPATH_CONFIGURATION . '/configuration.php'; $config = new JConfig(); require_once JPATH_LIBRARIES . '/koowa/koowa.php'; Koowa::getInstance(array('cache_prefix' => md5($config->secret) . '-cache-koowa', 'cache_enabled' => $config->caching)); unset($config); KLoader::addAdapter(new KLoaderAdapterModule(array('basepath' => JPATH_BASE))); KLoader::addAdapter(new KLoaderAdapterPlugin(array('basepath' => JPATH_ROOT))); KLoader::addAdapter(new KLoaderAdapterComponent(array('basepath' => JPATH_BASE))); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.module')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.plugin')); KServiceIdentifier::addLocator(KService::get('koowa:service.locator.component')); KServiceIdentifier::setApplication('site', JPATH_SITE); KServiceIdentifier::setApplication('admin', JPATH_ADMINISTRATOR); KService::setAlias('koowa:database.adapter.mysqli', 'com://admin/default.database.adapter.mysqli');
<?php /** * @version $Id: mappings.php 1295 2011-05-16 22:58:08Z johanjanssens $ * @category Nooku * @package Nooku_Server * @subpackage Weblinks * @copyright Copyright (C) 2011 Timble CVBA and Contributors. (http://www.timble.net) * @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html> * @link http://www.nooku.org */ /** * Service aliases * * @author Cristiano Cucco <http://nooku.assembla.com/profile/cristiano.cucco> * @category Nooku * @package Nooku_Server * @subpackage Weblinks */ KService::setAlias('com://site/banners.model.banners', 'com://admin/banners.model.banners');