require_once "phpfspot_tmpl.php";
$this->tmpl = new PHPFSPOT_TMPL();
+ $this->tmpl->assign('web_path', $this->cfg->web_path);
+
/* check if all necessary indices exist */
$this->checkDbIndices();
$this->tmpl->assign('from_date', $this->get_calendar('from'));
$this->tmpl->assign('to_date', $this->get_calendar('to'));
- if(!isset($content))
+ if(!isset($content)) {
+ $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
+ $this->tmpl->assign('preset_available_tags', $this->getAvailableTags());
$this->tmpl->assign('content_page', $this->tmpl->fetch('welcome.tpl'));
+ }
else
$this->tmpl->assign('content_page', $content);
}
$output = substr($output, 0, strlen($output)-2);
- print $output;
+ return $output;
} // getAvailableTags()
public function whatToDo()
{
if(isset($_SESSION['current_photo']) && $_SESSION['start_action'] == 'showp') {
- return "show_photo";
}
elseif(isset($_SESSION['selected_tags']) && !empty($_SESSION['selected_tags'])) {
return "showpi_tags";
return "showpi";
}
- return "nothing special";
-
} // whatToDo()
/**
*/
private function get_phpfspot_url()
{
- if($this->cfg->web_path == "/")
- $web_path = "";
- /* remove trailing slash */
- elseif(preg_match('/\/$/', $this->cfg->web_path))
- $web_path = preg_replace('/\/$/', '', $this->cfg->web_path);
- else
- $web_path = $this->cfg->web_path;
-
- return $this->get_web_protocol() ."://". $this->get_server_name() . $web_path;
+ return $this->get_web_protocol() ."://". $this->get_server_name() . $this->cfg->web_path;
} // get_phpfspot_url()
}
- /* check for pending slash on web_path */
- if(!preg_match("/\/$/", $this->cfg->web_path))
- $this->cfg->web_path.= "/";
+ /* remove trailing slash, if set */
+ if($this->cfg->web_path == "/")
+ $this->cfg->web_path = "";
+ elseif(preg_match('/\/$/', $this->cfg->web_path))
+ $this->cfg->web_path = preg_replace('/\/$/', '', $this->cfg->web_path);
return $this->runtime_error;
} // get_tag_name()
-
+ /**
+ * parse user friendly url which got rewritten by the websever
+ * @param string $request_uri
+ * @return string
+ */
private function parse_user_friendly_url($request_uri)
{
if(preg_match('/\/photoview\/|\/photo\/|\/tag\//', $request_uri)) {
switch($options[1]) {
case 'photoview':
if(is_numeric($options[2])) {
+ $_GET['mode'] = 'showp';
return $this->showPhoto($options[2]);
}
break;
if(is_numeric($options[2])) {
$_GET['mode'] = 'showpi';
$_SESSION['selected_tags'] = Array($options[2]);
- $this->tmpl->assign('preset_selected_tags', $this->getSelectedTags());
$_GET['tags'] = $options[2];
return $this->showPhotoIndex();
}