+ /**
+ * session cleanup
+ *
+ * this function will cleanup user's session information
+ */
+ private function session_cleanup()
+ {
+ unset($_SESSION['begin_with']);
+ $this->resetDateSearch();
+ $this->resetPhotoView();
+ $this->resetTagSearch();
+ $this->resetNameSearch();
+ $this->resetDateSearch();
+ $this->resetTags();
+
+ } // session_cleanup()
+
+ /**
+ * get database version
+ *
+ * this function queries the meta table
+ * and returns the current database version.
+ *
+ * @return integer
+ */
+ public function get_db_version()
+ {
+ if($row = $this->cfg_db->db_fetchSingleRow("
+ SELECT meta_value as meta_value
+ FROM
+ meta
+ WHERE
+ meta_key LIKE 'phpfspot Database Version'
+ ")) {
+
+ return $row['meta_value'];
+
+ }
+
+ return 0;
+
+ } // get_db_version()
+
+ /**
+ * get photo versions
+ *
+ * this function returns an array of all available
+ * alterntaive versions of the provided photo id.
+ * has alternative photo versions available
+ *
+ * @param int $idx
+ * @return array
+ */
+ public function get_photo_versions($idx)
+ {
+ $versions = Array();
+
+ $result = $this->db->db_query("
+ SELECT
+ version_id
+ FROM
+ photo_versions
+ WHERE
+ photo_id LIKE '". $idx ."'");
+
+ while($row = $this->cfg_db->db_fetch_object($result)) {
+ array_push($versions, $row['version_id']);
+ }
+
+ return $versions;
+
+ } // get_photo_versions()
+
+ /**
+ * check for invalid version of photo
+ *
+ * this function validates the provided photo-id and version-id
+ *
+ * @param int $photo_idx
+ * @param int $version_idx
+ * @return bool
+ */
+ public function is_valid_version($photo_idx, $version_idx)
+ {
+ /* the original version is always valid */
+ if($version_idx == 0)
+ return true;
+
+ if($versions = $this->get_photo_versions($photo_idx)) {
+ if(in_array($version_idx, $versions))
+ return true;
+ }
+
+ return false;
+
+ } // is_valid_version()
+
+ /**
+ * get photo version name
+ *
+ * this function returns the name of the version
+ * identified by the photo-id and version-id.
+ *
+ * @param int $photo_idx
+ * @param int $version_idx
+ * @return string
+ */
+ public function get_photo_version_name($photo_idx, $version_idx)
+ {
+ if($row = $this->db->db_fetchSingleRow("
+ SELECT
+ name
+ FROM
+ photo_versions
+ WHERE
+ photo_id LIKE '". $photo_idx ."'
+ AND
+ version_id LIKE '". $version_idx ."'")) {
+
+ return $row['name'];
+
+ }
+
+ return false;
+
+ } // get_photo_version_name()
+
+ /**
+ */
+ public function is_valid_width($image_width)
+ {
+ if(in_array($image_width,
+ Array($this->cfg->thumb_width,
+ $this->cfg->photo_width,
+ $this->cfg->mini_width,
+ 30)))
+
+ return true;
+
+ return false;
+
+ } // is_valid_width()