[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/components/com_weblinks/ -> weblinks.class.php (source)

   1  <?php
   2  /**
   3  * @version $Id: weblinks.class.php 5074 2006-09-15 22:56:27Z friesengeist $
   4  * @package Joomla
   5  * @subpackage Weblinks
   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  * Category database table class
  20  * @package Joomla
  21  * @subpackage Weblinks
  22  */
  23  class mosWeblink extends mosDBTable {
  24      /** @var int Primary key */
  25      var $id                    = null;
  26      /** @var int */
  27      var $catid                = null;
  28      /** @var int */
  29      var $sid                = null;
  30      /** @var string */
  31      var $title                = null;
  32      /** @var string */
  33      var $url                = null;
  34      /** @var string */
  35      var $description        = null;
  36      /** @var datetime */
  37      var $date                = null;
  38      /** @var int */
  39      var $hits                = null;
  40      /** @var int */
  41      var $published            = null;
  42      /** @var boolean */
  43      var $checked_out        = null;
  44      /** @var time */
  45      var $checked_out_time    = null;
  46      /** @var int */
  47      var $ordering            = null;
  48      /** @var int */
  49      var $archived            = null;
  50      /** @var int */
  51      var $approved            = null;
  52      /** @var string */
  53      var $params                = null;
  54  
  55      /**
  56      * @param database A database connector object
  57      */
  58  	function mosWeblink( &$db ) {
  59          $this->mosDBTable( '#__weblinks', 'id', $db );
  60      }
  61      /** overloaded check function */
  62  	function check() {
  63          // filter malicious code
  64          $ignoreList = array( 'params' );
  65          $this->filter( $ignoreList );
  66  
  67          // specific filters
  68          $iFilter = new InputFilter();
  69  
  70          if ($iFilter->badAttributeValue( array( 'href', $this->url ))) {
  71              $this->_error = 'Please provide a valid URL';
  72              return false;
  73          }
  74  
  75          /** check for valid name */
  76          if (trim( $this->title ) == '') {
  77              $this->_error = _WEBLINK_TITLE;
  78              return false;
  79          }
  80  
  81          if ( !( eregi( 'http://', $this->url ) || ( eregi( 'https://',$this->url ) )  || ( eregi( 'ftp://',$this->url ) ) ) ) {
  82              $this->url = 'http://'.$this->url;
  83          }
  84  
  85          /** check for existing name */
  86          $query = "SELECT id"
  87          . "\n FROM #__weblinks "
  88          . "\n WHERE title = " . $this->_db->Quote( $this->title )
  89          . "\n AND catid = " . (int) $this->catid
  90          ;
  91          $this->_db->setQuery( $query );
  92  
  93          $xid = intval( $this->_db->loadResult() );
  94          if ($xid && $xid != intval( $this->id )) {
  95              $this->_error = _WEBLINK_EXIST;
  96              return false;
  97          }
  98          return true;
  99      }
 100  }
 101  ?>


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