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; } }
/** * Injects behaviors to target identifiers. * * @param array $dependencies Associative array with target identifiers as keys and arrays * with behavior identifiers as values. * * @see ComLogmanPluginInjector::inject() */ public final function inject($dependencies = array()) { foreach ($dependencies as $target => $behaviors) { $behaviors = (array) $behaviors; foreach ($behaviors as $behavior) { KService::setConfig($target, array('behaviors' => array($behavior))); } } }
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; } }
/** * Return a set of notification objects * * @param KCommandContext $context Context parameter * * @return AnDomainEntitysetDefault */ protected function _actionBrowse($context) { $this->actor->resetNotifications(); if ($this->actor->eql(get_viewer())) { $title = JText::_('COM-NOTIFICATIONS-ACTORBAR-YOUR-NOTIFICATIONS'); } else { $title = sprintf(JText::_('COM-NOTIFICATIONS-ACTORBAR-ACTOR-NOTIFICATIONS'), $this->actor->name); } $this->getToolbar('actorbar')->setTitle($title); $context->query = $this->actor->getNotifications()->getQuery(); $set = parent::_actionBrowse($context)->order('creationTime', 'DESC'); if ($this->new) { $set->id($this->actor->newNotificationIds->toArray()); } //only zero the notifications if the viewer is the same as the //actor. prevents from admin zeroing others notifications if ($set->count() > 0 && get_viewer()->eql($this->actor)) { //set the number of notification, since it's going to be //reset by the time it gets to the mod_viewer KService::setConfig('com://site/viewer.html', array('data' => array('num_notifications' => $this->actor->numOfNewNotifications()))); $this->registerCallback('after.get', array($this->actor, 'viewedNotifications'), $set->toArray()); } return $set; }
<?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));
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);
/** * Constructor */ public function __construct($dispatcher, $config = array()) { if (!$config instanceof KConfig) { $config = new KConfig($config); } //Inject the identifier $config->service_identifier = KService::getIdentifier('plg:koowa.' . $config['name']); //Inject the service container $config->service_container = KService::getInstance(); parent::__construct($config); //Set the plugin params if (is_string($config->params)) { $config->params = $this->_parseParams($config->params); } $this->_params = $config->params; //Setup lazy wiring for publishers we are subscribing too foreach ($config->event_publishers as $publisher) { KService::setConfig($publisher, array('event_subscribers' => array($this))); } if ($dispatcher instanceof KEventDispatcher) { $dispatcher->addEventSubscriber($this); } }