<?php
saxue_includedb();
class saxuepages extends saxueobjectdata {
		function saxuepages() {
				$this -> initvar( "id", SAXUE_TYPE_INT, 0, "", false, 4 );
				$this -> initvar( "item", SAXUE_TYPE_TXTBOX, "", "", false, 20 );
				$this -> initvar( "title", SAXUE_TYPE_TXTBOX, "", "", false, 100 );
				$this -> initvar( "content", SAXUE_TYPE_TXTAREA, "", "", false, null );
				$this -> initvar( "htmldir", SAXUE_TYPE_TXTBOX, "", "", false, 100 );
				$this -> initvar( "htmlurl", SAXUE_TYPE_TXTBOX, "", "", false, 200 );
				$this -> initvar( "filename", SAXUE_TYPE_TXTBOX, "", "", false, 30 );
				$this -> initvar( "template", SAXUE_TYPE_TXTBOX, "", "", false, 30 );
				$this -> initvar( "mfilename", SAXUE_TYPE_TXTBOX, "", "", false, 30 );
				$this -> initvar( "mtemplate", SAXUE_TYPE_TXTBOX, "", "", false, 30 );
				$this -> initvar( "listorder", SAXUE_TYPE_INT, 0, "", false, 4 );
		} 
} 

class saxuepageshandler extends saxueobjecthandler {
		function saxuepageshandler( $_db = "" ) {
				$this -> saxueobjecthandler( $_db );
				$this -> basename = "pages";
				$this -> autoid = "id";
				$this -> dbname = "pages";
		} 

		function getlast() {
				$sql = "SELECT * FROM " . saxue_dbprefix( $this -> dbname ) . " ORDER BY id DESC LIMIT 0,1";
				if ( !( $result = $this -> db -> query( $sql ) ) ) {
						return false;
				} 
				$numrows = $this -> db -> getrowsnum( $result );
				if ( 1 <= $numrows ) {
						$tmpvar = "Saxue" . ucfirst( $this -> basename );
						${$this->basename} = new $tmpvar();
						${$this->basename} -> setvars( $this -> db -> fetcharray( $result ) );
						return ${$this->basename};
				} 
				return false;
		} 
}