Exemplo n.º 1
0
 public function onBeforeBrowse($tpl = null)
 {
     // Prevent phpStorm's whining...
     if ($tpl) {
     }
     // Load the model
     /** @var Items $model */
     $model = $this->getModel();
     // Assign data to the view, part 1 (we need this later on)
     $this->items = $model->get(true)->filter(function ($item) {
         return Filter::filterItem($item, true);
     });
     /** @var \JApplicationSite $app */
     $app = \JFactory::getApplication();
     $user = $this->container->platform->getUser();
     $params = $app->getParams();
     // Add Breadcrumbs
     /** @var Releases $release */
     $release = $this->getModel('Releases');
     /** @var Categories $category */
     $category = $release->category;
     Breadcrumbs::addRepositoryRoot($category->type);
     Breadcrumbs::addCategory($category->id, $category->title);
     Breadcrumbs::addRelease($release->id, $release->version);
     // DirectLink setup
     $this->downloadId = Filter::myDownloadID();
     $directlink = $params->get('show_directlink', 1) && !$user->guest;
     $this->directlink = $directlink;
     // Pass on Direct Link-related stuff
     if ($directlink) {
         $directlink_extensions = explode(',', $params->get('directlink_extensions', 'zip,tar,tar.gz,tgz,tbz,tar.bz2'));
         if (empty($directlink_extensions)) {
             $directlink_extensions = array();
         } else {
             $temp = array();
             foreach ($directlink_extensions as $ext) {
                 $temp[] = '.' . trim($ext);
             }
             $directlink_extensions = $temp;
         }
         $this->directlink_extensions = $directlink_extensions;
         $this->directlink_description = $params->get('directlink_description', \JText::_('COM_ARS_CONFIG_DIRECTLINKDESCRIPTION_DEFAULT'));
     }
     // Get the ordering
     $this->order = $model->getState('filter_order', 'id', 'cmd');
     $this->order_Dir = $model->getState('filter_order_Dir', 'DESC', 'cmd');
     // Assign data to the view
     $this->pagination = new \JPagination($model->count(), $model->limitstart, $model->limit);
     $this->release = $this->getModel('Releases');
     // Pass page params
     $this->params = $params;
     $this->Itemid = $this->input->getInt('Itemid', 0);
     $this->menu = $app->getMenu()->getActive();
     return true;
 }
Exemplo n.º 2
0
 private static function process($match)
 {
     $ret = '';
     $user = JFactory::getUser();
     if (!$user->guest) {
         if (!isset(self::$cache[$user->id])) {
             self::$cache[$user->id] = \Akeeba\ReleaseSystem\Site\Helper\Filter::myDownloadID();
         }
         $ret = self::$cache[$user->id];
     }
     return $ret;
 }
Exemplo n.º 3
0
<?php

/**
 * @package   AkeebaReleaseSystem
 * @copyright Copyright (c)2010-2014 Nicholas K. Dionysopoulos
 * @license   GNU General Public License version 3, or later
 * @version   $Id$
 */
defined('_JEXEC') or die;
if (!defined('FOF30_INCLUDED') && !@(include_once JPATH_LIBRARIES . '/fof30/include.php')) {
    return;
}
// Do not run if Akeeba Subscriptions is not enabled
JLoader::import('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_ars')) {
    return;
}
if (!class_exists('Akeeba\\ReleaseSystem\\Site\\Helper\\Filter')) {
    // This has the side-effect of initialising our auto-loader
    \FOF30\Container\Container::getInstance('com_ars');
}
$dlid = \Akeeba\ReleaseSystem\Site\Helper\Filter::myDownloadID();
if (!is_null($dlid)) {
    require JModuleHelper::getLayoutPath('mod_arsdlid', $params->get('layout', 'default'));
}
Exemplo n.º 4
0
 private function parseStreamLink($content)
 {
     static $dlid = '';
     $user = JFactory::getUser();
     if (empty($dlid) && !$user->guest) {
         $dlid = \Akeeba\ReleaseSystem\Site\Helper\Filter::myDownloadID();
     }
     $url = 'index.php?option=com_ars&view=update&task=Item&format=raw&id=' . (int) $content;
     if (!empty($dlid)) {
         $url .= '&dlid=' . $dlid;
     }
     $link = JRoute::_($url, false);
     return $link;
 }