示例#1
0
 public function getEmail($emailId)
 {
     $component = FreeComponentSite::getInstance();
     $row = $component->getTable('Email');
     $row->load((int) $emailId);
     return $row;
 }
示例#2
0
 public function display($tpl = null)
 {
     $app = Factory::getApplication();
     $component = FreeComponentSite::getInstance();
     $model = $component->getModel('Item');
     $params = $app->getParams('com_osdownloads');
     $id = (int) $params->get("document_id");
     $itemId = (int) $app->input->get('Itemid');
     if (JRequest::getVar("id")) {
         $id = (int) JRequest::getVar("id");
     }
     $item = $model->getItem($id);
     if (empty($item)) {
         JError::raiseWarning(404, JText::_("COM_OSDOWNLOADS_THIS_DOWNLOAD_ISNT_AVAILABLE"));
         return;
     }
     $paths = null;
     $this->buildBreadcrumbs($paths, $item);
     // Load the extension
     $component->loadLibrary();
     $isPro = $component->isPro();
     // Add the agreementLink property
     if (!empty($item)) {
         $item->agreementLink = '';
         if ((bool) $item->require_agree) {
             $item->agreementLink = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $item->agreement_article_id);
         }
     }
     $this->assignRef("item", $item);
     $this->assignRef("itemId", $itemId);
     $this->assignRef("paths", $paths);
     $this->assignRef("params", $params);
     $this->assignRef("isPro", $isPro);
     parent::display($tpl);
 }
示例#3
0
 /**
  * Get the document's query
  *
  * @param  int $documentId
  * @return JDatabaseQuery
  */
 public function getItemQuery($documentId = null)
 {
     $db = $this->getDBO();
     $user = Factory::getUser();
     $groups = $user->getAuthorisedViewLevels();
     $component = FreeComponentSite::getInstance();
     $query = $db->getQuery(true)->select('doc.*')->select('cat.access AS cat_access')->select('cat.title AS cat_title')->from('#__osdownloads_documents AS doc')->leftJoin('#__categories AS cat' . ' ON (doc.cate_id = cat.id AND cat.extension = ' . $db->quote('com_osdownloads') . ')')->where(array('cat.published = 1', 'doc.published = 1', 'doc.access IN (' . implode(',', $groups) . ')', 'cat.access IN (' . implode(',', $groups) . ')'));
     if (!empty($documentId)) {
         $query->where('doc.id = ' . $db->quote((int) $documentId));
     }
     if ($component->isFree()) {
         $query->select("doc.require_email as require_user_email");
     }
     return $query;
 }
示例#4
0
 public function getList()
 {
     $db = Factory::getDBO();
     $osdownloads = FreeComponentSite::getInstance();
     $model = $osdownloads->getModel('Item');
     $query = $model->getItemQuery();
     $query->where("cate_id = " . $db->quote($this->params->get('category', 0)));
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     if (!empty($rows)) {
         foreach ($rows as &$row) {
             $row->agreementLink = JRoute::_('index.php?option=com_content&view=article&id=' . (int) $row->agreement_article_id);
         }
     }
     return $rows;
 }
<?php

/**
 * @package   OSDownloads
 * @contact   www.alledia.com, hello@alledia.com
 * @copyright 2015 Open Source Training, LLC. All rights reserved
 * @license   http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */
defined('_JEXEC') or die;
use Alledia\OSDownloads\Free\Joomla\Component\Site as SiteComponent;
require_once JPATH_SITE . '/administrator/components/com_osdownloads/include.php';
$component = SiteComponent::getInstance();
$component->init();
示例#6
0
 public function download()
 {
     $id = (int) JRequest::getVar('id');
     $component = FreeComponentSite::getInstance();
     $model = $component->getModel('Item');
     $model->incrementDownloadCount($id);
     JRequest::setVar("view", "download");
     $this->display();
 }