[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/components/com_banners/ -> banners.class.php (source)

   1  <?php
   2  /**
   3  * @version $Id: banners.class.php 5072 2006-09-15 16:24:06Z friesengeist $
   4  * @package Joomla
   5  * @subpackage Banners
   6  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   7  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   8  * Joomla! is free software. This version may have been modified pursuant
   9  * to the GNU General Public License, and as distributed it includes or
  10  * is derivative of works licensed under the GNU General Public License or
  11  * other free or open source software licenses.
  12  * See COPYRIGHT.php for copyright notices and details.
  13  */
  14  
  15  // no direct access
  16  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  17  
  18  /**
  19  * @package Joomla
  20  * @subpackage Banners
  21  */
  22  class mosBannerClient extends mosDBTable {
  23      var    $cid                 = null;
  24      var $name                 = '';
  25      var $contact             = '';
  26      var $email                 = '';
  27      var $extrainfo             = '';
  28      var $checked_out         = 0;
  29      var $checked_out_time     = 0;
  30      var $editor                = '';
  31  
  32  	function mosBannerClient( &$_db ) {
  33          $this->mosDBTable( '#__bannerclient', 'cid', $_db );
  34      }
  35  
  36  	function check() {
  37          // check for valid client name
  38          if (trim($this->name == '')) {
  39              $this->_error = _BNR_CLIENT_NAME;
  40              return false;
  41          }
  42  
  43          // check for valid client contact
  44          if (trim($this->contact == '')) {
  45              $this->_error = _BNR_CONTACT;
  46              return false;
  47          }
  48  
  49          // check for valid client email
  50          if ((trim($this->email == '')) || (preg_match("/[\w\.\-]+@\w+[\w\.\-]*?\.\w{1,4}/", $this->email )==false)) {
  51              $this->_error = _BNR_VALID_EMAIL;
  52              return false;
  53          }
  54  
  55          return true;
  56      }
  57  }
  58  
  59  /**
  60  * @package Joomla
  61  */
  62  class mosBanner extends mosDBTable {
  63      /** @var int */
  64      var $bid                = null;
  65      /** @var int */
  66      var $cid                = null;
  67      /** @var string */
  68      var $type                = '';
  69      /** @var string */
  70      var $name                = '';
  71      /** @var int */
  72      var $imptotal            = 0;
  73      /** @var int */
  74      var $impmade            = 0;
  75      /** @var int */
  76      var $clicks                = 0;
  77      /** @var string */
  78      var $imageurl            = '';
  79      /** @var string */
  80      var $clickurl            = '';
  81      /** @var date */
  82      var $date                = null;
  83      /** @var int */
  84      var $showBanner            = 0;
  85      /** @var int */
  86      var $checked_out        = 0;
  87      /** @var date */
  88      var $checked_out_time    = 0;
  89      /** @var string */
  90      var $editor                = '';
  91      /** @var string */
  92      var $custombannercode    = '';
  93  
  94  	function mosBanner( &$_db ) {
  95          $this->mosDBTable( '#__banner', 'bid', $_db );
  96          $this->set( 'date', date( 'Y-m-d G:i:s' ) );
  97      }
  98  
  99  	function clicks() {
 100          $query = "UPDATE #__banner"
 101          . "\n SET clicks = ( clicks + 1 )"
 102          . "\n WHERE bid = " . (int) $this->bid
 103          ;
 104          $this->_db->setQuery( $query );
 105          $this->_db->query();
 106      }
 107  
 108  	function check() {
 109          // check for valid client id
 110          if (is_null($this->cid) || $this->cid == 0) {
 111              $this->_error = _BNR_CLIENT;
 112              return false;
 113          }
 114  
 115          if(trim($this->name) == '') {
 116              $this->_error = _BNR_NAME;
 117              return false;
 118          }
 119  
 120          if(trim($this->imageurl) == '') {
 121              $this->_error = _BNR_IMAGE;
 122              return false;
 123          }
 124          if(trim($this->clickurl) == '' && trim($this->custombannercode) == '') {
 125              $this->_error = _BNR_URL;
 126              return false;
 127          }
 128          $this->imptotal = (int) $this->imptotal;
 129  
 130          return true;
 131      }
 132  }
 133  ?>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics