imgpath = $imgpath; // id if (isset ($id)) { $this->id = $id; } // title $this->title = $title; // description $this->description = $description; // longitude if (!isset ($lon) || !is_numeric ($lon) || ($lon < -180) || ($lon > 180)) { throw new Exception ($this->err_lonlat_invalid); } $this->lon = $lon; // latitude if (!isset ($lat) || !is_numeric ($lat) || ($lat < -90) || ($lat > 90)) { throw new Exception ($this->err_lonlat_invalid); } $this->lat = $lat; } public function __get ($attr) { if (isset ($this->$attr)) return $this->$attr; else throw new Exception ('Unknow attribute '.$attr); } public function __set ($attr,$value) { throw new Exception ('properties can only be set in constructor'); } } interface anydbConnection { const err_driver_unavailable = 1; const err_connection = 2; const err_unknown_database = 3; const err_query = 3; /* * connect to database; That method may be called multiple times. */ public function connect($host, $user, $pwd, $dbname, $dbprefix); /* * return true if users table already exists */ public function users_table_exists(); /* * create users table; * throws an err_query error in case users table already exists. */ public function create_users_table(); /* * return true if items table already exists */ public function items_table_exists(); /* * create items table; * throws an err_query error in case items table already exists. */ public function create_items_table(); /* * set password $pwd for user $usrname. If $usrname does not exist, create * it. */ public function setpwd($usrname, $pwd); /* * check that $pwd_md5 is md5 for $username password. */ public function checkpwdmd5($usrname, $pwd_md5); /* * saves feature in database. If feature has an id, feature will be updated * in database; otherwise it will be created. Returns saved feature */ public function save_feature($feature); /* * delete feature from database. Returns true in case of success, even if * image was not referenced in the database. */ public function delete_feature($feature); /* * Returns feature with given id. If none exists, returns null. */ public function getfeature($id); /* * returns an array of available features */ public function listfeatures(); /* * returns true if a feature with imgpath exists */ public function imgpath_exists($imgpath); /* * returns Minimum Bounding Rectangle containing all feature locations. * That function must return a result even if database is not functional. * Minimum Bounding Rectangle is presented as an Array: * [bottom, left, top, right] */ public function mbr(); /* * get name of database backend */ public function getdbname(); } ?>