Source for file weblinks.class.php

Documentation is available at weblinks.class.php

  1. <?php
  2. /**
  3. @package Mambo
  4. @subpackage Weblinks
  5. @copyright  Refer to copyright.php
  6. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  7. @author Mambo Foundation Inc see README.php
  8. */ 
  9.  
  10. /** ensure this file is being included by a parent file */
  11. defined'_VALID_MOS' or die'Direct Access to this location is not allowed.' );
  12.  
  13. /**
  14. * Category database table class
  15. */
  16. class mosWeblink extends mosDBTable {
  17.     /** @var int Primary key */
  18.     var $id=null;
  19.     /** @var int */
  20.     var $catid=null;
  21.     /** @var int */
  22.     var $sid=null;
  23.     /** @var string */
  24.     var $title=null;
  25.     /** @var string */
  26.     var $url=null;
  27.     /** @var string */
  28.     var $description=null;
  29.     /** @var datetime */
  30.     var $date=null;
  31.     /** @var int */
  32.     var $hits=null;
  33.     /** @var int */
  34.     var $published=null;
  35.     /** @var boolean */
  36.     var $checked_out=null;
  37.     /** @var time */
  38.     var $checked_out_time=null;
  39.     /** @var int */
  40.     var $ordering=null;
  41.     /** @var int */
  42.     var $archived=null;
  43.     /** @var int */
  44.     var $approved=null;
  45.     /** @var string */
  46.     var $params=null;
  47.  
  48.     /**
  49.     * @param database A database connector object
  50.     */
  51.     function mosWeblink&$db {
  52.         $this->mosDBTable'#__weblinks''id'$db );
  53.     }
  54.     /** overloaded check function */
  55.     function check({
  56.         // filter malicious code
  57.         $ignoreList array'params' );
  58.         $this->filter$ignoreList );
  59.  
  60.         // specific filters        
  61.         $callcheck array('InputFilter''process');
  62.         if (!is_callable($callcheck)) require_once(mamboCore::get('mosConfig_absolute_path').'/includes/phpInputFilter/class.inputfilter.php');
  63.         // specific filters
  64.         $iFilter =new InputFilter();
  65.         
  66.         if ($iFilter->badAttributeValuearray'href'$this->url ))) {
  67.             $this->_error = T_('Please provide a valid URL');
  68.             return false;
  69.         }
  70.  
  71.         /** check for valid name */
  72.         if (trim$this->title == ''{
  73.             $this->_error = T_('Your web link must be given a title.');
  74.             return false;
  75.         }
  76.  
  77.         if !eregi'http://'$this->url || eregi'https://',$this->url ) )  || eregi'ftp://',$this->url ) ) ) ) {
  78.             $this->url = 'http://'.$this->url;
  79.         }
  80.  
  81.         /** check for existing name */
  82.         $this->title = $this->_db->getEscaped($this->title);
  83.         $this->catid = $this->_db->getEscaped($this->catid);
  84.         $this->_db->setQuery"SELECT id FROM #__weblinks "
  85.         . "\nWHERE title='$this->title' AND catid='$this->catid'"
  86.         );
  87.  
  88.         $xid intval$this->_db->loadResult() );
  89.         if ($xid && $xid != intval$this->id )) {
  90.             $this->_error = T_('There is already a web link that name, please try again.');
  91.             return false;
  92.         }
  93.         return true;
  94.     }
  95. }
  96. ?>

Documentation generated on Mon, 05 May 2008 16:24:07 +0400 by phpDocumentor 1.4.0