/* set application name and version information */
$this->cfg->product = "phpfspot";
- $this->cfg->version = "1.5";
+ $this->cfg->version = "1.6";
$this->sort_orders= array(
'date_asc' => 'Date ↑',
}
$this->tmpl->register_function("sort_select_list", array(&$this, "smarty_sort_select_list"), false);
- $this->tmpl->assign('search_from_date', $this->get_calendar('from'));
- $this->tmpl->assign('search_to_date', $this->get_calendar('to'));
+ $this->tmpl->assign('search_from_date', $this->get_date_text_field('from'));
+ $this->tmpl->assign('search_to_date', $this->get_date_text_field('to'));
$this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
$this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
$this->avail_tags = Array();
$count = 0;
+ /* if show_tags has been set in the configuration (only show photos
+ which are tagged by these tags) they following will take care,
+ that only these other tags are displayed where the photo is also
+ tagged with one of show_tags.
+ */
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
$query_str="
SELECT
*/
public function get_photo_details($idx)
{
+ /* ~ F-Spot version 0.3.x */
if($this->dbver < 9) {
$query_str = "
SELECT p.id, p.name, p.time, p.directory_path, p.description
}
}
- /* if show_tags is set, only return details for photos which
- are specified to be shown
+ /* if show_tags is set, only return details of photos which are
+ tagged with a tag that has been specified to be shown.
*/
if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
$query_str.= "
$row = $this->db->db_fetch_object($result);
+ /* before F-Spot db version 9 there was no uri column but seperated
+ columns for directory_path and name (= filename).
+ */
if($this->dbver < 9) {
$row['uri'] = "file://". $row['directory_path'] ."/". $row['name'];
}
/**
* returns aligned photo names
*
- * this function returns aligned (length) names for
- * an specific photo. If the length of the name exceeds
- * $limit the name will be shrinked (...)
+ * this function returns aligned (length) names for a specific photo.
+ * If the length of the name exceeds $limit the name will bei
+ * shrinked (...).
+ *
* @param integer $idx
* @param integer $limit
* @return string|null
/**
* get photo rating level
*
- * this function will return the integer-based rating
- * level of the photo. This can only be done, if the F-Spot
- * database is at a specific level. If rating value can not
- * be found, zero will be returned indicating no rating value
- * is available.
+ * this function will return the integer-based rating level of a
+ * photo. This can only be done, if the F-Spot database is at a
+ * specific version. If rating value can not be found, zero will
+ * be returned indicating no rating value is available.
+ *
* @param integer idx
* @return integer
*/
/**
* get rate-search bars
*
- * this function will return the rating-bars for the
- * search field.
+ * this function will return the rating-bars for the search field.
+ *
* @return string
*/
public function get_rate_search()
/**
* shrink text according provided limit
*
- * If the length of the name exceeds $limit the
- * text will be shortend and some content in between
- * will be replaced with "..."
+ * If the length of the name exceeds $limit, text will be shortend
+ * and inner content will be replaced with "...".
+ *
* @param string $ext
* @param integer $limit
* @return string
$meta_res = $info[0] ."x". $info[1];
}
- $meta_date = isset($meta['FileDateTime']) ? strftime("%a %x %X", $meta['FileDateTime']) : "n/a";
$meta_make = isset($meta['Make']) ? $meta['Make'] ." / ". $meta['Model'] : "n/a";
$meta_size = isset($meta['FileSize']) ? round($meta['FileSize']/1024, 1) ."kbyte" : "n/a";
$this->tmpl->assign('width', $info_thumb[0]);
$this->tmpl->assign('height', $info_thumb[1]);
- $this->tmpl->assign('ExifMadeOn', $meta_date);
+ $this->tmpl->assign('ExifMadeOn', strftime("%a %x %X", $details['time']));
$this->tmpl->assign('ExifMadeWith', $meta_make);
$this->tmpl->assign('ExifOrigResolution', $meta_res);
$this->tmpl->assign('ExifFileSize', $meta_size);
// loop through our tag array
foreach ($tags as $key => $value) {
+ /* has the currently processed tag already been added to
+ the selected tag list? if so, ignore it here...
+ */
if(isset($_SESSION['selected_tags']) && in_array($key, $_SESSION['selected_tags']))
continue;
// multiply by the font-size increment ($size)
// and add the $min_size set above
$size = $min_size + (($value - $min_qty) * $step);
- // uncomment if you want sizes in whole %:
+ // uncomment if you want sizes in whole %:
$size = ceil($size);
$color = $min_sat + ($value - $min_qty) * $step_sat;
$b = '88';
if(isset($this->tags[$key])) {
- if($this->is_user_friendly_url())
- $output.= "<a href=\"". $this->cfg->web_path ."/tag/". $key ."\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
- else
- $output.= "<a href=\"". $this->cfg->web_path ."/index.php?mode=showpi\" onclick=\"Tags('add', ". $key ."); return false;\" class=\"tag\" style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\">". $this->tags[$key] ."</a>, ";
+ if($this->is_user_friendly_url()) {
+ $output.= "<a href=\"". $this->cfg->web_path ."/tag/". $key ."\"
+ onclick=\"Tags('add', ". $key ."); return false;\"
+ class=\"tag\"
+ style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\"
+ title=\"Tag ". $this->tags[$key] .", ". $tags[$key] ." picture(s)\">". $this->tags[$key] ."</a>, ";
+ }
+ else {
+ $output.= "<a href=\"". $this->cfg->web_path ."/index.php?mode=showpi\"
+ onclick=\"Tags('add', ". $key ."); return false;\"
+ class=\"tag\"
+ style=\"font-size: ". $size ."%; color: #". $r.$g.$b .";\"
+ title=\"Tag ". $this->tags[$key] .", ". $tags[$key] ." picture(s)\">". $this->tags[$key] ."</a>, ";
+ }
}
}
public function startSearch()
{
/* date search */
- if(isset($_POST['from']) && $this->isValidDate($_POST['from'])) {
- $from = $_POST['from'];
+ if(isset($_POST['date_from']) && $this->isValidDate($_POST['date_from'])) {
+ $date_from = $_POST['date_from'];
}
- if(isset($_POST['to']) && $this->isValidDate($_POST['to'])) {
- $to = $_POST['to'];
+ if(isset($_POST['date_to']) && $this->isValidDate($_POST['date_to'])) {
+ $date_to = $_POST['date_to'];
}
/* tag-name search */
$this->get_tags();
- if(isset($from) && !empty($from))
- $_SESSION['from_date'] = strtotime($from ." 00:00:00");
+ if(isset($date_from) && !empty($date_from))
+ $_SESSION['from_date'] = strtotime($date_from ." 00:00:00");
else
unset($_SESSION['from_date']);
- if(isset($to) && !empty($to))
- $_SESSION['to_date'] = strtotime($to ." 23:59:59");
+ if(isset($date_to) && !empty($date_to))
+ $_SESSION['to_date'] = strtotime($date_to ." 23:59:59");
else
unset($_SESSION['to_date']);
} // _error()
/**
- * output calendard input fields
+ * get calendar input-text fields
+ *
+ * this function returns a text-field used for the data selection.
+ * Either it will be filled with the current date or, if available,
+ * filled with the date user entered previously.
+ *
* @param string $mode
* @return string
*/
- private function get_calendar($mode)
+ private function get_date_text_field($mode)
{
- $year = isset($_SESSION[$mode .'_date']) ? date("Y", $_SESSION[$mode .'_date']) : date("Y");
- $month = isset($_SESSION[$mode .'_date']) ? date("m", $_SESSION[$mode .'_date']) : date("m");
- $day = isset($_SESSION[$mode .'_date']) ? date("d", $_SESSION[$mode .'_date']) : date("d");
+ $date = isset($_SESSION[$mode .'_date']) ? date("Y", $_SESSION[$mode .'_date']) : date("Y");
+ $date.= "-";
+ $date.= isset($_SESSION[$mode .'_date']) ? date("m", $_SESSION[$mode .'_date']) : date("m");
+ $date.= "-";
+ $date.= isset($_SESSION[$mode .'_date']) ? date("d", $_SESSION[$mode .'_date']) : date("d");
- $output = "<input type=\"text\" size=\"3\" id=\"". $mode ."year\" value=\"". $year ."\"";
- if(!isset($_SESSION[$mode .'_date']))
- $output.= " disabled=\"disabled\"";
- $output.= " />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."month\" value=\"". $month ."\"";
- if(!isset($_SESSION[$mode .'_date']))
- $output.= " disabled=\"disabled\"";
- $output.= " />\n";
- $output.= "<input type=\"text\" size=\"1\" id=\"". $mode ."day\" value=\"". $day ."\"";
+ $output = "<input type=\"text\" size=\"15\" id=\"date_". $mode ."\" value=\"". $date ."\"";
if(!isset($_SESSION[$mode .'_date']))
$output.= " disabled=\"disabled\"";
$output.= " />\n";
return $output;
- } // get_calendar()
+ } // get_date_text_field()
/**
* output calendar matrix
$meta = $this->get_meta_informations($orig_path);
}
- $meta_date = isset($meta['FileDateTime']) ? $meta['FileDateTime'] : filemtime($orig_path);
-
?>
<item>
<title><?php print htmlspecialchars($this->parse_uri($details['uri'], 'filename')); ?></title>
<link><?php print htmlspecialchars($orig_url); ?></link>
<guid><?php print htmlspecialchars($orig_url); ?></guid>
- <dc:date.Taken><?php print strftime("%Y-%m-%dT%H:%M:%S+00:00", $meta_date); ?></dc:date.Taken>
+ <dc:date.Taken><?php print strftime("%Y-%m-%dT%H:%M:%S+00:00", $details['time']); ?></dc:date.Taken>
<description>
<?php print $thumb_html; ?>
</description>
- <pubDate><?php print strftime("%a, %d %b %Y %T %z", $meta_date); ?></pubDate>
+ <pubDate><?php print strftime("%a, %d %b %Y %T %z", $details['time']); ?></pubDate>
</item>
<?php
return " ORDER BY t.name DESC ,p.time ASC";
break;
case 'rate_asc':
- return " ORDER BY t.name ASC, p.rating ASC";
+ return " ORDER BY p.rating ASC, t.name ASC";
break;
case 'rate_desc':
- return " ORDER BY t.name DESC, p.rating DESC";
+ return " ORDER BY p.rating DESC, t.name DESC";
break;
}