/** * Helper for creating DOM element ids used by javascript behaviors * * If no type and package identifiers were supplied, * uses the current option $_GET variable, and changing com_foo_bar to com-foo_bar. * '-' are used as separators, and in our javascript used to parse identifier strings. * If a form got the id com-foo_bar-people, * then we can assume that the toolbar will have the id toolbar-people, * * @author Stian Didriksen <*****@*****.**> * @param array | int $parts * @return string */ public function id($parts = array()) { if (!is_array($parts) && is_int($parts)) { $parts['id'] = (int) $parts; } // If we pass a string, set $parts back as an array in order to proceed. if (!is_array($parts)) { settype($parts, 'array'); } // Set the defaults, if needed $defaults = array(); if (!isset($parts['type.package'])) { // We only want to replace the first underscore, not the rest. $defaults['type_package'] = str_replace('com_', 'com-', KRequest::get('get.option', 'cmd')); } if (!isset($parts['view'])) { $view = KRequest::get('get.view', 'cmd'); // The view part always needs to be plural to allow ajax BREAD. if (KInflector::isSingular($view)) { $view = KInflector::pluralize($view); } $defaults['view'] = $view; } if (!isset($parts['id']) && KRequest::has('get.id', 'int')) { $defaults['id'] = KRequest::get('get.id', 'int'); } // Filter away parts that are unset on purpose using a null value, or a negative boolean. return implode('-', array_filter(array_merge($defaults, $parts))); }
public function addFile(KCommandContext $context) { if (empty($context->data->file) && KRequest::has('files.file.tmp_name')) { $context->data->file = KRequest::get('files.file.tmp_name', 'raw'); if (empty($context->data->name)) { $context->data->name = KRequest::get('files.file.name', 'raw'); } } }
/** * Constructor * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $options) { parent::__construct($options); $this->registerCallback('before.add', array($this, 'setTitle'))->registerCallback('before.edit', array($this, 'setTitle'))->registerCallback('after.add', array($this, 'setPermissions'))->registerCallback('after.edit', array($this, 'setPermissions')); $showReminder = KFactory::get('admin::com.ninja.helper.default')->formid('show-reminder'); if (!KRequest::has('cookie.' . $showReminder) && $this->getModel()->getTotal() > 0) { $this->registerCallback('after.browse', array($this, 'showReminder')); } }
public function fetchElement($name, $value, &$node, $control_name) { $key = (string) $node['key']; $request = isset($node['request']) ? $node['request'] : $key; //@TODO make the following optional $current = KRequest::has('get.id') ? '&' . KRequest::get('get.view', 'cmd') . '=' . KRequest::get('get.id', 'int') : false; //@TODO make this an reusabe MooTools class KFactory::get('admin::com.ninja.helper.default')->js("\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tvar input = \$('" . $this->id . "'), load = new URI(" . json_encode(JRoute::_((string) $node['load'] . $current, false)) . "), runway = new Element('div', {text: load}).set('load', {onSuccess: function(){window.fireEvent('domupdate')}}), fieldset = input.getParent('fieldset');\n\t\t\t\tif(input) {\n\t\t\t\t\tfieldset.grab(runway, 'after');\n\t\t\t\t\t\n\t\t\t\t\tinput.addEvent('change', function(){\n\t\t\t\t\t\trunway.empty().load(load.setData({" . $key . ": this.value}, true).toString());\n\t\t\t\t\t}).fireEvent('change');\n\t\t\t\t}\n\t\t\t});\n\t\t"); return parent::fetchElement($name, $value, $node, $control_name); }
/** * Dispatch the controller and redirect * * This function divert the standard behavior and will redirect if no view * information can be found in the request. * * @param string The view to dispatch. If null, it will default to * retrieve the controller information from the request or * default to the component name if no controller info can * be found. * * @return KDispatcherDefault */ protected function _actionDispatch(KCommandContext $context) { //Redirect if no view information can be found in the request if (!KRequest::has('get.view')) { $url = clone KRequest::url(); $url->query['view'] = $this->getController()->getView()->getName(); JFactory::getApplication()->redirect($url); } return parent::_actionDispatch($context); }
/** * Dispatch the controller and redirect * * This function divert the standard behavior and will redirect if no view * information can be found in the request. * * @param string The view to dispatch. If null, it will default to * retrieve the controller information from the request or * default to the component name if no controller info can * be found. * * @return KDispatcherDefault */ protected function _actionDispatch(KCommandContext $context) { //Redirect if no view information can be found in the request if (!KRequest::has('get.view')) { $view = count($context->data) ? $context->data : $this->_controller_default; $url = clone KRequest::url(); $url->query['view'] = $view; KFactory::get('lib.joomla.application')->redirect($url); } return parent::_actionDispatch($context); }
/** * Dispatch the controller and redirect * * This function divert the standard behavior and will redirect if no view * information can be found in the request. * * @param string The view to dispatch. If null, it will default to * retrieve the controller information from the request or * default to the component name if no controller info can * be found. * * @return KDispatcherDefault */ protected function _actionDispatch(KCommandContext $context) { //Redirect if no view information can be found in the request if (!KRequest::has('get.view')) { $package = $this->getIdentifier()->package; $view = $this->getController()->getView()->getName(); $route = JRoute::_('index.php?option=com_' . $package . '&view=' . $view, false); JFactory::getApplication()->redirect($route); } return parent::_actionDispatch($context); }
protected function _actionDispatch(KCommandContext $context) { if (KRequest::method() == KHttpRequest::GET) { $view = KRequest::get('get.view', 'cmd', $this->_controller); if ($view == 'modules' && !KRequest::has('get.application')) { $url = clone KRequest::url(); $url->query['application'] = 'site'; JFactory::getApplication()->redirect($url); } } return parent::_actionDispatch($context); }
/** * Draw the toolbar * * @param KCommandContext $context The command context * * @return string */ protected function _actionRender(KCommandContext $context) { if ($context->result !== false) { $view = $this->getController()->getView(); //Set the document mimetype JFactory::getDocument()->setMimeEncoding($view->mimetype); //Disabled the application menubar if (!KInflector::isPlural($view->getName()) && !KRequest::has('get.hidemainmenu')) { KRequest::set('get.hidemainmenu', 1); } } return parent::_actionRender($context); }
/** * Renders and echo's the views output wrapping it in a js callback if present * * @return string JSON data */ public function display() { if (!KRequest::has('get.callback')) { return parent::display(); } $callback = KRequest::get('get.callback', 'cmd'); $json = $callback . '('; $json .= parent::display(); //Set the correct mime type $this->_document->setMimeEncoding('application/javascript'); $json .= ');'; return $json; }
/** * Dispatch the controller and redirect * * This function divert the standard behavior and will redirect if no view * information can be found in the request. * * @param string The view to dispatch. If null, it will default to * retrieve the controller information from the request or * default to the component name if no controller info can * be found. * * @return KDispatcherDefault */ protected function _actionDispatch(KCommandContext $context) { //Redirect if no view information can be found in the request if(!KRequest::has('get.view')) { $url = clone(KRequest::url()); $url->query['option'] = 'com_'.$this->getIdentifier()->package; $url->query['view'] = $this->getController()->getView()->getName(); KFactory::get('joomla:application')->redirect($url); } return parent::_actionDispatch($context); }
public function getRequest() { $request = parent::getRequest(); if (KRequest::has('post.paths')) { $paths = KRequest::get('post.paths', 'raw'); if ($paths) { $request->paths = $paths; } } if (!in_array($request->container, array('docman-files', 'docman-icons', 'docman-images'))) { $request->container = 'docman-files'; } return $request; }
/** * edit a cover * * @param KCommandContext $context Context parameter * * @return AnDomainEntityAbstract */ public function editCover(KCommandContext $context) { $entity = $this->getItem(); if ($entity->isCoverable() && KRequest::has('files.cover')) { $file = KRequest::get('files.cover', 'raw'); if ($this->_mixer->bellowSizeLimit($file) && $file['error'] == 0) { $this->getItem()->setCover(array('url' => $file['tmp_name'], 'mimetype' => $file['type'])); $story = $this->createStory(array('name' => 'cover_edit', 'owner' => $entity, 'target' => $entity)); } else { //$this->_mixer->getItem()->removeCoverImage(); $entity->removeCoverImage(); } } return $entity; }
/** * Set the referrer * * @return void */ public function setReferrer() { $identifier = $this->getMixer()->getIdentifier(); if (!KRequest::has('cookie.referrer_locked')) { $request = KRequest::url(); $referrer = KRequest::referrer(); //Compare request url and referrer if (!isset($referrer) || (string) $referrer == (string) $request) { $option = 'com_' . $identifier->package; $view = KInflector::pluralize($identifier->name); $url = 'index.php?option=' . $option . '&view=' . $view; $referrer = $this->getService('koowa:http.url', array('url' => $url)); } KRequest::set('cookie.referrer', (string) $referrer); } }
protected function _actionDispatch(KCommandContext $context) { $view = KRequest::get('get.view', 'cmd', $this->_controller); if($view == 'pages' && !KRequest::has('get.menu')) { $page = KFactory::get('com://admin/pages.model.pages')->home(1)->getList()->top(); $url = clone(KRequest::url()); $url->query['view'] = $view; $url->query['menu'] = $page->pages_menu_id; KFactory::get('joomla:application')->redirect($url); } return parent::_actionDispatch($context); }
public function getRequest() { $request = parent::getRequest(); /* * If there is a storage_path array in the post, set it as a GET parameter * * This is used to circumvent the URL size exceeding problem (after 2k bytes) * that happens in "create documents" screen */ if (KRequest::has('post.storage_path')) { $paths = KRequest::get('post.storage_path', 'raw'); if (is_array($paths)) { $request->storage_path = $paths; } } return $request; }
/** * Display the view * * @return void */ public function _actionDisplay(KCommandContext $context) { if (!JFolder::exists(JPATH_COMPONENT_ADMINISTRATOR . '/packages/')) { return; } $model = $this->getModel(); $data = array(); if (KRequest::has('get.folder', 'cmd')) { $package = JPATH_COMPONENT_ADMINISTRATOR . '/packages/' . KRequest::get('get.folder', 'cmd') . '/'; $installer = JInstaller::getInstance(); $installer->install($package); $data['html'] = $installer->get('extension.message'); JFolder::delete($package); } elseif (KRequest::has('get.file', 'filename')) { $package = JPATH_COMPONENT_ADMINISTRATOR . '/packages/' . KRequest::get('get.file', 'filename'); $data['package'] = JFile::stripExt(basename($package)); JArchive::extract($package, JPATH_COMPONENT_ADMINISTRATOR . '/packages/' . $data['package']); JFile::delete($package); $files = JFolder::files(JPATH_COMPONENT_ADMINISTRATOR . '/packages/' . $data['package'], '\\.xml$', 1, true); $xml = is_array($files) ? end($files) : $files; $xml = simplexml_load_file($xml); $attribs = $xml->attributes(); $data['package_name'] = (string) $xml->name . ': ' . ucfirst($attribs['type']); $data['package_version'] = (string) '<strong>' . JText::_('OK') . '</strong> - ' . $xml->version . @$xml->version['status']; ob_start(); echo KFactory::get('admin::com.extensions.view.packages.html')->set('i', KRequest::get('get.i', 'int', 0))->set('package', $xml->name . ' ' . $xml->version . @$xml->version['status'])->setLayout('installing')->display(); $data['html'] = ob_get_clean(); } else { ob_start(); echo KFactory::get('admin::com.extensions.view.packages.html')->setLayout('default')->display(); $data['html'] = ob_get_clean(); $packages = $model->getList(); sort($packages); foreach ($packages as $i => $package) { $data['packages'][] = $package; ob_start(); echo KFactory::get('admin::com.extensions.view.packages.html')->set('i', ++$i)->set('package', $package)->setLayout('unpacking')->display(); $data['layouts'][] = ob_get_clean(); } if ($model->getTotal() < 1) { $data['html'] = null; } } return json_encode($data); }
/** * Return the views output * * @return string The output of the view */ public function display() { //If it's not a autocomplete query, don't do anything yet //@TODO in the future show a default json view with data if (!KRequest::has('get.is_autocomplete')) { return; } $model = $this->getModel(); $data = array(); foreach ($model->getList() as $user) { //Autocomplete format is the following: // id, searchable plain text, html (for the textboxlist item, if empty the plain is used), html (for the autocomplete dropdown) //We pass the search state as the plain text as every result in this query is a match on the server side //if a user match by email for instance, we don't want to reveal the email in order for the autocomplete to match $data[] = array($user->id, $model->getState()->search, $user->display_name, '<img src="' . $this->createRoute('view=avatar&id=' . $user->id . '&thumbnail=small&format=file') . '" /> ' . $user->display_name); } return json_encode($data); }
/** * Get a Route for a URL. * * @param string|array $url The url. Can be query fragments * @param bool $fqr Fully qualified route * * @return string */ public function getRoute($url = '', $fqr = true) { if (!is_array($url)) { if (strpos($url, 'http') === 0) { return $url; } if (strpos($url, '/') === 0) { return JRoute::_($url); } $url = str_replace('index.php?', '', trim($url)); $vars = array(); parse_str($url, $vars); $url = $vars; } $parts = array(); if (!isset($url['option'])) { $parts['option'] = KRequest::get('get.option', 'cmd'); } //if not view is set the set if (!isset($url['view'])) { $parts['view'] = KRequest::get('get.view', 'cmd'); //only try to set the layout if we are setting the view if (!isset($url['layout']) && KRequest::has('get.layout')) { $parts['layout'] = KRequest::get('get.layout', 'cmd'); } } //carry format if (!isset($url['format']) && KRequest::has('get.format')) { $parts['format'] = KRequest::get('get.format', 'cmd'); } foreach ($parts as $key => $value) { $url[$key] = $value; } //unset html format since it's a default if (isset($url['format']) && $url['format'] == 'html') { unset($url['format']); } //unset default lyout since it's a default if (isset($url['layout']) && $url['layout'] == 'default') { unset($url['layout']); } $route = JRoute::_('index.php?' . http_build_query($url), false); return $route; }
/** * Post action * * This action installs packages and displays a custom message in one of 3 ways: * 1. Upload, move and unarchive a package before installing it. * 2. Check an inputted directory for an installable package, if found then install it * 3. Download a package from an inputted URL, unarchive and install. * * @param KCommandContext A command context object * @return @TODO */ protected function _actionPost(KCommandContext $context) { if (KRequest::has('files.package') && KRequest::get('files.package.size', 'int') > 0) { $package = $this->_getPackageFromUpload(); } elseif (KRequest::has('post.url') && KRequest::get('post.url', 'url') && KRequest::get('post.url', 'url') != 'http://') { $package = $this->_getPackageFromUrl(); } elseif (KRequest::has('post.directory') && KRequest::get('post.directory', 'path')) { $package = $this->_getPackageFromFolder(); } else { $this->message('No Install Type Found'); return $this->execute('get', $context); } // Was the package unpacked? if (!$package) { $this->message('Unable to find install package'); return $this->execute('get', $context); } // Get an installer instance $installer = JInstaller::getInstance(); // Install the package if (!$installer->install($package['dir'])) { // There was an error installing the package $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Error')); $result = false; } else { // Package installed sucessfully $msg = JText::sprintf('INSTALLEXT', JText::_($package['type']), JText::_('Success')); $result = true; } // Set some model state values JFactory::getApplication()->enqueueMessage($msg); $this->name($installer->get('name')); $this->message($installer->message); $this->extension_message($installer->get('extension.message')); // Cleanup the install files if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->getValue('config.tmp_path') . DS . $package['packagefile']; } JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); return $this->execute('get', $context); }
protected function _actionAdd(KCommandContext $context) { if (empty($context->data->file) && KRequest::has('files.file.tmp_name')) { $context->data->file = KRequest::get('files.file.tmp_name', 'raw'); if (empty($context->data->name)) { $context->data->name = KRequest::get('files.file.name', 'raw'); } } try { $menu = JFactory::getApplication()->getMenu()->getActive(); if ($menu->query['view'] === 'submit') { $params = $this->getService('com://site/fileman.parameter.default', array('params' => $menu->params)); // Force the folder $context->data->folder = $params->get('folder'); } else { $context->data->folder = $this->getRequest()->folder; $menu_folder = isset($menu->query['folder']) ? $menu->query['folder'] : ''; if (!empty($menu_folder) && strpos($context->data->folder, $menu_folder) !== 0) { throw new KControllerException(JText::_('Invalid folder selection')); } } if (empty($context->data->file)) { throw new KControllerException(JText::_('Please select a file to upload')); } if ($context->data->folder) { $this->getRequest()->folder = $context->data->folder; } $controller = $this->getService('com://admin/files.controller.file', array('request' => $this->getRequest())); $result = $controller->add($context); return $result; } catch (KControllerException $e) { /* * We need to hack a bit here to redirect properly with an error message because * if an error exists in $context it displays a 500 error in the KControllerAbstract. * This should do it until KResponse package comes to the life */ $context->setError(null); $context->error = $e; $this->afterSave($context); return false; } }
/** * Push the controller data into the document * * This function divert the standard behavior and will push specific controller data * into the document * * @return KDispatcherDefault */ protected function _actionRender(KCommandContext $context) { $controller = KFactory::get($this->getController()); $view = $controller->getView(); $document = KFactory::get('lib.joomla.document'); $document->setMimeEncoding($view->mimetype); if ($view instanceof ComDefaultViewHtml) { $document->setBuffer($view->getToolbar()->render(), 'modules', 'toolbar'); $document->setBuffer($view->getToolbar()->renderTitle(), 'modules', 'title'); if (KInflector::isSingular($view->getName()) && !KRequest::has('get.hidemainmenu')) { KRequest::set('get.hidemainmenu', 1); } if (isset($view->views)) { foreach ($view->views as $name => $title) { $active = $name == strtolower($view->getName()); $component = $this->_identifier->package; JSubMenuHelper::addEntry(JText::_($title), 'index.php?option=com_' . $component . '&view=' . $name, $active); } } } return parent::_actionRender($context); }
/** * Used by converters importing bridged forums * * @TODO store this value in the db in the future instead of HTML5 localStorage * * @return string|boolean */ public function getPath() { //Get the path from the request if it exists if (KRequest::has('post.path')) { return KRequest::get('post.path', 'admin::com.ninja.filter.path'); } //Get the path from RokBridge, if RokBridge is present $helper = JPATH_ADMINISTRATOR . '/components/com_rokbridge/helper.php'; if (JFile::exists($helper)) { JLoader::register('RokBridgeHelper', $helper); if (!method_exists('RokBridgeHelper', 'getParams')) { return false; } return RokBridgeHelper::getParams()->get('phpbb3_path'); } return false; }
/** * Router action * * @param KCommandContext $context */ protected function _actionRoute(KCommandContext $context) { //legacy if (KRequest::has('post.option')) { KRequest::set('get.option', KRequest::get('post.option', 'cmd')); } parent::_actionRoute($context); $component = $this->getRequest()->get('option'); $user =& JFactory::getUser(); if (!$user->authorize('login', 'administrator')) { $component = 'com_login'; } if (empty($component)) { $component = 'com_cpanel'; } $this->getRequest()->set('option', $component); JRequest::set($this->getRequest()->toArray(), 'get'); $this->setComponent(substr($component, 4)); $this->dispatch(); }
/** * Edit's an actor data. * * @param KCommandContext $context Context parameter * * @return AnDomainEntityAbstract */ protected function _actionEdit(KCommandContext $context) { $entity = parent::_actionEdit($context); if ($entity->isPortraitable() && KRequest::has('files.portrait')) { $file = KRequest::get('files.portrait', 'raw'); if ($this->bellowSizeLimit($file) && $file['error'] == 0) { $this->getItem()->setPortrait(array('url' => $file['tmp_name'], 'mimetype' => $file['type'])); $story = $this->createStory(array('name' => 'avatar_edit', 'owner' => $entity, 'target' => $entity)); } else { $this->getItem()->removePortraitImage(); } } if ($entity->save($context)) { dispatch_plugin('profile.onSave', array('actor' => $entity, 'data' => $context->data)); } return $entity; }
/** * Remebers handling. */ public function onAfterInitialise() { global $mainframe; $viewer = get_viewer(); if (!$viewer->guest() && !$viewer->enabled) { KService::get('com://site/people.helper.person')->logout(); } // No remember me for admin if ($mainframe->isAdmin()) { return; } jimport('joomla.utilities.utility'); jimport('joomla.utilities.simplecrypt'); $user = array(); $remember = JUtility::getHash('JLOGIN_REMEMBER'); // for json requests obtain the username and password from the $_SERVER array // else if the remember me cookie exists, decrypt and obtain the username and password from it if ($viewer->guest() && KRequest::has('server.PHP_AUTH_USER') && KRequest::has('server.PHP_AUTH_PW') && KRequest::format() == 'json') { $user['username'] = KRequest::get('server.PHP_AUTH_USER', 'raw'); $user['password'] = KRequest::get('server.PHP_AUTH_PW', 'raw'); } elseif ($viewer->guest() && isset($_COOKIE[$remember]) && $_COOKIE[$remember] != '') { $key = JUtility::getHash(KRequest::get('server.HTTP_USER_AGENT', 'raw')); if ($key) { $crypt = new JSimpleCrypt($key); $cookie = $crypt->decrypt($_COOKIE[$remember]); $user = (array) @unserialize($cookie); } } else { return; } if ($viewer->guest() && count($user)) { try { jimport('joomla.user.authentication'); $authentication =& JAuthentication::getInstance(); $authResponse = $authentication->authenticate($user, array()); if ($authResponse->status == JAUTHENTICATE_STATUS_SUCCESS) { KService::get('com://site/people.helper.person')->login($user, true); } } catch (RuntimeException $e) { //only throws exception if we are using JSON format //otherwise let the current app handle it if (KRequest::format() == 'json') { throw $e; } } } return; }
if (KRequest::get('get.layout', 'cmd') == 'ninjaboard') { unset($_GET['layout']); } $document = KFactory::get('lib.joomla.document'); $config = KFactory::get('lib.joomla.config'); $debug = $config->getValue('config.debug'); if ($debug && false) { try { //Init plug KFactory::get('plg.koowa.debug'); } catch (KFactoryAdapterException $e) { } $profile = microtime(true); } //@TODO this is pretty dirty, we need to find a better solution to set the offset in our views that currently use KRequest for it if (KRequest::has('get.limitstart')) { KRequest::set('get.offset', KRequest::get('get.limitstart', 'int')); } // Create the component dispatcher echo KFactory::get('site::com.ninjaboard.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'forums')); if ($debug && false) { try { //Init plug $queries = KFactory::get('plg.koowa.debug')->queries; $document->addScriptDeclaration('if(console) { console.group("Ninjaboard SQL queries (' . count($queries) . ')");' . PHP_EOL); foreach ($queries as $query) { $document->addScriptDeclaration('console.log(' . json_encode((string) $query) . ');' . PHP_EOL); } $document->addScriptDeclaration('console.groupEnd(); }' . PHP_EOL); } catch (KFactoryAdapterException $e) { }
/** * Basic authentication support * * This functions tries to log the user in if authentication credentials are * present in the request. * * @return boolean Returns TRUE is basic authentication was successful */ protected function _authenticateUser() { if(KRequest::has('server.PHP_AUTH_USER') && KRequest::has('server.PHP_AUTH_PW')) { $credentials = array( 'username' => KRequest::get('server.PHP_AUTH_USER', 'url'), 'password' => KRequest::get('server.PHP_AUTH_PW' , 'url'), ); if(KFactory::get('joomla:application')->login($credentials) !== true) { throw new KException('Login failed', KHttpResponse::UNAUTHORIZED); return false; } //Reset the user object in the factory KFactory::set('joomla:user', JFactory::getUser()); //Force the token KRequest::set('request._token', JUtility::getToken()); return true; } return false; }
/** * Load the site * * This function checks if the site exists in the request, or in the session. If not it * falls back on the default site. * * @param string $site The name of the site to load * @return void * @throws KException If the site could not be found * @since Nooku Server 0.7 */ protected function _loadSite($default) { $method = strtolower(KRequest::method()); if (KRequest::has($method . '.site')) { $site = KRequest::get($method . '.site', 'cmd'); } else { $site = JFactory::getSession()->get('site', $default); } parent::_loadSite($site); }
* @link http://ninjaforge.com */ // no direct access defined('_JEXEC') or die('Restricted access'); $ninja = JPATH_ADMINISTRATOR . '/components/com_ninja/ninja.php'; if (!file_exists($ninja)) { return JError::raiseWarning(0, JText::_('The Ninja Framework component (com_ninja) is required for this component to run.')); } require_once $ninja; /** * If koowa is unavailable * Abort the dispatcher */ if (!defined('KOOWA')) { return JError::raiseWarning(0, JText::_('This component cannot run without Nooku Framework.')); } KFactory::map('admin::com.ninjaboard.template.helper.default', 'admin::com.ninja.helper.default'); // Uncomment for localhost ajax testing of request spinners and response messages // As it'll delay the request making it closer to the end-user experience //if(KRequest::type() == 'AJAX') sleep(3); //Load the ninjaboard plugins JPluginHelper::importPlugin('ninjaboard', null, true, KFactory::get('lib.koowa.event.dispatcher')); //Debug RTL if (KFactory::get('lib.joomla.language')->isRTL() && KRequest::has('get.debug.rtl')) { KFactory::get('lib.joomla.document')->addScriptDeclaration("\n\t\tString.prototype.reverse = function(){\n\t\t\treturn this.split('').reverse().join('');\n\t\t};\n\t\t\n\t\twindow.addEventListener('blur', function(){\n\t\t\tdocument.html.removeClass('rtl');\n\t\t});\n\t\t\n\t\twindow.addEventListener('focus', function(){\n\t\t\tdocument.html.addClass('rtl');\n\t\t});\n\t"); KFactory::get('lib.joomla.document')->addStyleDeclaration("\n\t\thtml.rtl {\n\t\t\t-webkit-transform: rotateY(180deg);\n\t\t\tdirection: rtl !important; \n\t\t\tunicode-bidi: bidi-override !important;\n\t\t}\n\t"); } // Create the component dispatcher echo KFactory::get('admin::com.ninjaboard.dispatcher')->dispatch(KRequest::get('get.view', 'cmd', 'dashboard')); // Add untranslated words to the current NB language file KFactory::get('admin::com.ninja.helper.language');