3 require_once "phpfspot_cfg.php";
4 require_once "phpfspot_db.php";
5 require_once "phpfspot_tmpl.php";
18 public function __construct()
20 $this->cfg = new PHPFSPOT_CFG;
22 $this->db = new PHPFSPOT_DB(&$this, $this->cfg->db);
23 $this->tmpl = new PHPFSPOT_TMPL(&$this);
28 if(isset($_GET['id']) && is_numeric($_GET['id']))
29 $this->current_photo = $_GET['id'];
33 public function __destruct()
38 public function show()
40 if(isset($this->current_photo)) {
41 $this->tmpl->assign('image_url', 'phpfspot_img.php?idx='. $this->avail_photos[$this->current_photo] ."&width=". $this->cfg->photo_width);
44 if($this->current_photo > 0) {
45 $this->tmpl->assign('previous_url', "javascript:showImage(". ($this->current_photo-1) .");");
48 if($this->current_photo < count($this->avail_photos)) {
49 $this->tmpl->assign('next_url', "javascript:showImage(". ($this->current_photo+1) .");");
52 $this->tmpl->assign('tags', $this->tags);
53 $this->tmpl->show("index.tpl");
58 private function get_tags()
60 $result = $this->db->db_query("
63 ORDER BY sort_priority ASC
66 while($row = $this->db->db_fetch_object($result)) {
69 $tag_name = $row['name'];
71 $this->tags[$tag_id] = $tag_name;
76 private function get_photos()
78 $this->avail_photos = Array();
81 $result = $this->db->db_query("
87 while($row = $this->db->db_fetch_object($result)) {
89 $photo_id = $row['id'];
90 $photo_name = $row['name'];
92 $this->photos[$photo_id] = $photo_name;
93 $this->avail_photos[$count] = $photo_id;
95 if(!isset($this->current_photo))
96 $this->current_photo = $count;
104 public function get_photo_details($idx)
106 $result = $this->db->db_query("
109 WHERE id='". $idx ."'
112 return $this->db->db_fetch_object($result);
114 } // get_photo_details
116 public function translate_path($path, $width = 0)
118 return str_replace($this->cfg->path_replace_from, $this->cfg->path_replace_to, $path);