| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Old Sites/moke/modules/mod_imageads/models/ |
Upload File : |
<?php
/**
* @version $Id: moduleads.php
* @package ImageAds
* @author Andrey Sokolnikov <aasfalcon@gmail.com>
* @copyright (C) 2011 Emergination, LLC. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// date class
jimport('joomla.utilities.date');
/**
* Module Ads model
*
* @package ImageAds
*/
class imageadsModelModuleAds extends JModel
{
/**
* Array of ad rows
*
* @access private
* @var array
*/
var $_data = null;
/**
* Get ad list for the module
*
* @access public
* @return &array Array of record rows
*/
function getModuleAds($params)
{
if (empty($this->_data)) {
// calculate border last paid date
$border_date = imageadsHelper::getBorderDate();
// get sort order
switch ($params->get('sort_by')) {
case 'date_asc':
$order = "a.created_at ASC";
break;
case 'expire_desc':
$order = "a.last_paid_at DESC";
break;
default:
$order = "a.id";
}
$sql = "SELECT a.*"
."\nFROM #__image_ads AS a"
."\nWHERE a.approved=1 AND last_paid_at >= ".$this->_db->quote($border_date)
."\nORDER BY $order";
;
$this->_db->setQuery($sql);
$this->_data = $this->_db->loadObjectList();
if ($this->_db->getErrorNum())
{
JError::raiseError(500, $this->_db->getErrorMsg());
}
}
return $this->_data;
}
}