mosDBTable( '#__weblinks', 'id', $db ); } /** overloaded check function */ function check() { // filter malicious code $ignoreList = array( 'params' ); $this->filter( $ignoreList ); // specific filters $iFilter = new InputFilter(); if ($iFilter->badAttributeValue( array( 'href', $this->url ))) { $this->_error = 'Please provide a valid URL'; return false; } /** check for valid name */ if (trim( $this->title ) == '') { $this->_error = _WEBLINK_TITLE; return false; } if ( !( eregi( 'http://', $this->url ) || ( eregi( 'https://',$this->url ) ) || ( eregi( 'ftp://',$this->url ) ) ) ) { $this->url = 'http://'.$this->url; } // SQL injection protection $this->catid = intval($this->catid); $this->title = $this->_db->getEscaped( $this->title ); /** check for existing name */ $query = "SELECT id" . "\n FROM #__weblinks " . "\n WHERE title = '$this->title'" . "\n AND catid = $this->catid" ; $this->_db->setQuery( $query ); $xid = intval( $this->_db->loadResult() ); if ($xid && $xid != intval( $this->id )) { $this->_error = _WEBLINK_EXIST; return false; } return true; } } ?>