| [ Index ] | PHP Cross Reference of Mambo 4.6.5 |
|
| [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @package Mambo 4 * @subpackage Polls 5 * @author Mambo Foundation Inc see README.php 6 * @copyright (C) 2000 - 2009 Mambo Foundation Inc. 7 * See COPYRIGHT.php for copyright notices and details. 8 * @license GNU/GPL Version 2, see LICENSE.php 9 * 10 * Redistributions of files must retain the above copyright notice. 11 * 12 * Mambo is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; version 2 of the License. 15 */ 16 17 //** ensure this file is being included by a parent file */ 18 defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); 19 20 class mosPoll extends mosDBTable { 21 /** @var int Primary key */ 22 var $id=null; 23 /** @var string */ 24 var $title=null; 25 /** @var string */ 26 var $checked_out=null; 27 /** @var time */ 28 var $checked_out_time=null; 29 /** @var boolean */ 30 var $published=null; 31 /** @var int */ 32 var $access=null; 33 /** @var int */ 34 var $lag=null; 35 36 /** 37 * @param database A database connector object 38 */ 39 function mosPoll( &$db ) { 40 $this->mosDBTable( '#__polls', 'id', $db ); 41 } 42 // overloaded check function 43 function check() { 44 // check for valid name 45 if (trim( $this->title ) == '') { 46 $this->_error = T_('Your Poll must contain a title.'); 47 return false; 48 } 49 // check for valid lag 50 $this->lag = intval( $this->lag ); 51 if ($this->lag == 0) { 52 $this->_error = T_("Your Poll must have a non-zero lag time."); 53 return false; 54 } 55 // check for existing title 56 // @RawSQLUse, trivial_implementation, SELECT 57 $this->_db->setQuery( "SELECT id FROM #__polls WHERE title='$this->title'" 58 ); 59 60 $xid = intval( $this->_db->loadResult() ); 61 if ($xid && $xid != intval( $this->id )) { 62 $this->_error = T_("There is a module already with that name, please try again."); 63 return false; 64 } 65 66 // sanitise some data 67 if (!get_magic_quotes_gpc()) { 68 $row->title = addslashes( $row->title ); 69 } 70 71 return true; 72 } 73 // overloaded delete function 74 function delete( $oid=null ) { 75 $k = $this->_tbl_key; 76 if ($oid) { 77 $this->$k = intval( $oid ); 78 } 79 80 if (mosDBTable::delete( $oid )) { 81 // @RawSQLUse, trivial_implementation, DELETE 82 $this->_db->setQuery( "DELETE FROM #__poll_data WHERE pollid='".$this->$k."'" ); 83 if (!$this->_db->query()) { 84 $this->_error .= $this->_db->getErrorMsg() . "\n"; 85 } 86 87 // @RawSQLUse, trivial_implementation, DELETE 88 $this->_db->setQuery( "DELETE FROM #__poll_date WHERE pollid='".$this->$k."'" ); 89 if (!$this->_db->query()) { 90 $this->_error .= $this->_db->getErrorMsg() . "\n"; 91 } 92 93 // @RawSQLUse, trivial_implementation, DELETE 94 $this->_db->setQuery( "DELETE from #__poll_menu where pollid='".$this->$k."'" ); 95 if (!$this->_db->query()) { 96 $this->_error .= $this->_db->getErrorMsg() . "\n"; 97 } 98 99 return true; 100 } else { 101 return false; 102 } 103 } 104 } 105 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Feb 8 00:05:01 2012 | Cross-referenced by PHPXref 0.7 |
| Mambo API: Mambo is Free software released under the GNU/General Public License, Version 2 |