photos p
";
}
- else {
- /* rating value got introduced */
+ elseif($this->dbver < 17) {
+ /* rating value got introduced */
$query_str = "
SELECT
p.id as id,
photos p
";
}
+ else {
+ /* path & filename now splited in base_uri & filename */
+ $query_str = "
+ SELECT
+ p.id as id,
+ p.base_uri ||'/'|| p.filename as uri,
+ p.time as time,
+ p.description as description,
+ p.rating as rating
+ FROM
+ photos p
+ ";
+ }
}
/* if show_tags is set, only return details of photos which are
";
}
- if($row = $this->db->db_fetchSingleRow($query_str)) {
+ if(!$row = $this->db->db_fetchSingleRow($query_str))
+ return null;
- /* before F-Spot db version 9 there was no uri column but
- seperated fields for directory_path and name (= filename).
- */
- if($this->dbver < 9) {
- $row['uri'] = "file://". $row['directory_path'] ."/". $row['name'];
- }
+ /* before F-Spot db version 9 there was no uri column but
+ seperated fields for directory_path and name (= filename).
+ */
+ if($this->dbver < 9) {
+ $row['uri'] = "file://". $row['directory_path'] ."/". $row['name'];
+ }
+ /* starting with dbversion >= 17 we need to rawurldecode() uri */
+ elseif($this->dbver >= 17) {
+ $row['uri'] = rawurldecode($row['uri']);
+ }
- /* if version-idx has not yet been set, get the latest photo version */
- if(!isset($version_idx) || !$this->is_valid_version($idx, $version_idx))
- $version_idx = $this->get_latest_version($idx);
+ /* if version-idx has not yet been set, get the latest photo version */
+ if(!isset($version_idx) || !$this->is_valid_version($idx, $version_idx))
+ $version_idx = $this->get_latest_version($idx);
- /* if an alternative version has been requested. But we
- support this only for F-Spot database versions from
- v9.
- */
- if($version_idx > 0 && $this->dbver >= 9) {
+ /* if an alternative version has been requested. But we
+ support this only for F-Spot database versions from
+ v9.
+ */
+ if($version_idx > 0 && $this->dbver >= 9) {
+ if ($this->dbver < 17) {
/* check for alternative versions */
if($version = $this->db->db_fetchSingleRow("
SELECT
$row['uri'] = $version['uri'];
}
}
+ else {
+ /* path & filename now splited in base_uri & filename */
+ if($version = $this->db->db_fetchSingleRow("
+ SELECT
+ version_id,
+ name,
+ base_uri || '/'||filename as uri
+ FROM
+ photo_versions
+ WHERE
+ photo_id LIKE '". $idx ."'
+ AND
+ version_id LIKE '". $version_idx ."'")) {
- return $row;
-
+ $row['name'] = $version['name'];
+ $row['uri'] = rawurldecode($version['uri']);
+ }
+ }
}
- return null;
+ return $row;
} // get_photo_details()
* @return string
*/
public function translate_path($path)
- {
- return str_replace($this->cfg->path_replace_from, $this->cfg->path_replace_to, $path);
+ {
+ if($this->cfg->enable_replace_path == true)
+ return str_replace(
+ $this->cfg->path_replace_from,
+ $this->cfg->path_replace_to, $path);
+
+ return $path;
} // translate_path
)
";
}
- else {
+ if($this->dbver < 17) {
$additional_where_cond.= "
(
basename(p.uri) LIKE '%". $_SESSION['searchfor_name'] ."%'
)
";
}
+ else {
+ $additional_where_cond.= "
+ (
+ p.filename LIKE '%". $_SESSION['searchfor_name'] ."%'
+ OR
+ p.description LIKE '%". $_SESSION['searchfor_name'] ."%'
+ )
+ ";
+ }
}
/* limit result based on rate-search */
case 4: /* bottom, right */
$flip_vert = true; break;
case 5: /* left side, top */
- $rotate = 90; $flip_vert = true; break;
+ $rotate = 270; $flip_vert = true; break;
case 6: /* right side, top */
- $rotate = 90; break;
+ $rotate = 270; break;
case 7: /* left side, bottom */
- $rotate = 270; $flip_vert = true; break;
+ $rotate = 90; $flip_vert = true; break;
case 8: /* right side, bottom */
- $rotate = 270; break;
+ $rotate = 90; break;
}
}
$missing = true;
}
+ if($this->cfg->db_access == "pdo") {
+ if(array_search("sqlite", PDO::getAvailableDrivers()) === false) {
+ print "PDO SQLite3 driver is missing<br />\n";
+ $missing = true;
+ }
+ }
+
/* Check for HTML_AJAX PEAR package, lent from Horde project */
ini_set('track_errors', 1);
@include_once 'HTML/AJAX/Server.php';
print "PEAR Console_Getopt package is missing<br />\n";
$missing = true;
}
+ @include_once 'Date.php';
+ if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
+ print "PEAR Date package is missing<br />\n";
+ $missing = true;
+ }
@include_once $this->cfg->smarty_path .'/libs/Smarty.class.php';
if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
print "Smarty template engine can not be found in ". $this->cfg->smarty_path ."/libs/Smarty.class.php<br />\n";
* @param integer $month
* @param integer $day
*/
- public function get_calendar_matrix($year = 0, $month = 0, $day = 0)
+ public function get_calendar_matrix($userdate)
{
- if (!isset($year)) $year = date('Y');
- if (!isset($month)) $month = date('m');
- if (!isset($day)) $day = date('d');
+ if(($userdate = strtotime($userdate)) === false) {
+ $year = date('Y');
+ $month = date('m');
+ $day = date('d');
+ }
+ else {
+ $date = new Date();
+ $date->setDate($userdate);
+
+ $year = $date->getYear();
+ $month = $date->getMonth();
+ $day = $date->getDay();
+ }
+
$rows = 1;
$cols = 1;
$matrix = Array();
require_once CALENDAR_ROOT.'Day.php';
// Build the month
- $month = new Calendar_Month_Weekdays($year,$month);
+ $month_cal = new Calendar_Month_Weekdays($year,$month);
// Create links
- $prevStamp = $month->prevMonth(true);
+ $prevStamp = $month_cal->prevMonth(true);
$prev = "javascript:setMonth(". date('Y',$prevStamp) .", ". date('n',$prevStamp) .", ". date('j',$prevStamp) .");";
- $nextStamp = $month->nextMonth(true);
+ $nextStamp = $month_cal->nextMonth(true);
$next = "javascript:setMonth(". date('Y',$nextStamp) .", ". date('n',$nextStamp) .", ". date('j',$nextStamp) .");";
$selectedDays = array (
new Calendar_Day($year,$month,$day),
- new Calendar_Day($year,12,25),
);
// Build the days in the month
- $month->build($selectedDays);
+ $month_cal->build($selectedDays);
- $this->tmpl->assign('current_month', date('F Y',$month->getTimeStamp()));
+ $this->tmpl->assign('current_month', date('F Y',$month_cal->getTimeStamp()));
$this->tmpl->assign('prev_month', $prev);
$this->tmpl->assign('next_month', $next);
- while ( $day = $month->fetch() ) {
+ while ( $day = $month_cal->fetch() ) {
if(!isset($matrix[$rows]))
$matrix[$rows] = Array();
$string = "";
$dayStamp = $day->thisDay(true);
- $link = "javascript:setCalendarDate(". date('Y',$dayStamp) .", ". date('n',$dayStamp).", ". date('j',$dayStamp) .");";
+ $link = "javascript:setCalendarDate('"
+ . date('Y',$dayStamp)
+ . "-"
+ . date('m',$dayStamp)
+ . "-"
+ . date('d',$dayStamp)
+ ."');";
// isFirst() to find start of week
if ( $day->isFirst() )
*/
public function parse_uri($uri, $mode)
{
- if(($components = parse_url($uri)) !== false) {
+ if(($components = parse_url($uri)) === false)
+ return $uri;
- switch($mode) {
- case 'filename':
- return basename($components['path']);
- break;
- case 'dirname':
- return dirname($components['path']);
- break;
- case 'fullpath':
- return $components['path'];
- break;
- }
+ switch($mode) {
+ case 'filename':
+ return basename($components['path']);
+ break;
+ case 'dirname':
+ return dirname($components['path']);
+ break;
+ case 'fullpath':
+ return $components['path'];
+ break;
+ default:
+ $this->throwError("unknown mode ". $mode);
+ break;
}
- return $uri;
-
} // parse_uri()
/**
if(!isset($this->cfg->thumbs_per_page))
$this->_error("Please set \$thumbs_per_page in phpfspot_cfg");
- if(!isset($this->cfg->path_replace_from) || $this->cfg->path_replace_from == "")
- $this->_error("Please set \$path_replace_from in phpfspot_cfg");
+ if(!isset($this->cfg->enable_replace_path))
+ $this->_error("Please set \$enable_replace_path in phpfspot_cfg");
- if(!isset($this->cfg->path_replace_to) || $this->cfg->path_replace_to == "")
- $this->_error("Please set \$path_replace_to in phpfspot_cfg");
+ if($this->cfg->enable_replace_path == true) {
+ if(!isset($this->cfg->path_replace_from) || $this->cfg->path_replace_from == "")
+ $this->_error("Please set \$path_replace_from in phpfspot_cfg");
+
+ if(!isset($this->cfg->path_replace_to) || $this->cfg->path_replace_to == "")
+ $this->_error("Please set \$path_replace_to in phpfspot_cfg");
+ }
if(!isset($this->cfg->hide_tags))
$this->_error("Please set \$hide_tags in phpfspot_cfg");