mosDBTable( '#__polls', 'id', $db ); } // overloaded check function function check() { // check for valid name if (trim( $this->title ) == '') { $this->_error = T_('Your Poll must contain a title.'); return false; } // check for valid lag $this->lag = intval( $this->lag ); if ($this->lag == 0) { $this->_error = T_("Your Poll must have a non-zero lag time."); return false; } // check for existing title // @RawSQLUse, trivial_implementation, SELECT $this->_db->setQuery( "SELECT id FROM #__polls WHERE title='$this->title'" ); $xid = intval( $this->_db->loadResult() ); if ($xid && $xid != intval( $this->id )) { $this->_error = T_("There is a module already with that name, please try again."); return false; } // sanitise some data if (!get_magic_quotes_gpc()) { $row->title = addslashes( $row->title ); } return true; } // overloaded delete function function delete( $oid=null ) { $k = $this->_tbl_key; if ($oid) { $this->$k = intval( $oid ); } if (mosDBTable::delete( $oid )) { // @RawSQLUse, trivial_implementation, DELETE $this->_db->setQuery( "DELETE FROM #__poll_data WHERE pollid='".$this->$k."'" ); if (!$this->_db->query()) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } // @RawSQLUse, trivial_implementation, DELETE $this->_db->setQuery( "DELETE FROM #__poll_date WHERE pollid='".$this->$k."'" ); if (!$this->_db->query()) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } // @RawSQLUse, trivial_implementation, DELETE $this->_db->setQuery( "DELETE from #__poll_menu where pollid='".$this->$k."'" ); if (!$this->_db->query()) { $this->_error .= $this->_db->getErrorMsg() . "\n"; } return true; } else { return false; } } } ?>