<?php
require_once("include/synophoto_conf.php");
require_once($SYNOPHOTO_INCLUDE_MISC);
require_once($SYNOPHOTO_INCLUDE_LANG);
require_once($SYNOPHOTO_INCLUDE_HOME);
require_once($SYNOPHOTO_INCLUDE_ALBUM_UTIL);
$mobileUAPattern = '/(iPhone|iPod|SymbianOS|Android|Windows CE|PalmOS|BlackBerry|Vodafone|Opera Mobi|Opera Mobi|UP\.Browser|AvantGo|EudoraWeb|PLink|Plucker|NetFront|Xiino|Blazer|WebPro|ProxiNet|Elaine)/i';
$userAgent = isSet($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
$url_prefix = SYNOPHOTO_MISC_GetUrlPrefix();
if (isSet($_GET['forceDesktop']) ||
(isSet($_SESSION[$SYNOPHOTO_ADMIN_USER]['mobileUser']) && 'Desktop' == $_SESSION[$SYNOPHOTO_ADMIN_USER]['mobileUser'])) {
$_SESSION[$SYNOPHOTO_ADMIN_USER]['mobileUser'] = 'Desktop';
} else if (preg_match($mobileUAPattern, $userAgent) ||
isSet($_SERVER['HTTP_UA_OS']) || isSet($_SERVER['HTTP_X_WAP_PROFILE'])) {
header("Location: {$url_prefix}/photo/m/");
exit();
}
SYNOPHOTO_MISC_ServiceCheck("{$url_prefix}/photo/index.php");
SYNOPHOTO_MISC_AccessRightCheck();
$template = file_get_contents($SYNOPHOTO_TEMPLATE_INDEX);
if (isset($_SESSION[$SYNOPHOTO_ADMIN_USER]['admin_syno_user']) && $_SESSION[$SYNOPHOTO_ADMIN_USER]['admin_syno_user'] == $SYNOPHOTO_ADMIN_PASS &&
preg_match('/^(default|customize|style_01|style_02|style_03|style_04|style_05|style_06)$/', $_GET['style'])) {
$theme_name = $_GET['style'];
} else {
$theme_name = SYNOPHOTO_MISC_GetConfig('photo', "photo_style_type", 'photo_config');
}
if($theme_name == "") {
$theme_name = "default";
}
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n";
}
$template_js = file_get_contents($SYNOPHOTO_TEMPLATE_INDEX_JS);
$version = SYNOPHOTO_MISC_SystemInfoGet($SYNO_DEF_VERSION_FILE, "buildnumber");
$ln = SYNOPHOTO_LANG_GetLang();
$template_js = str_replace("{VERSION}", "?v=".$version, $template_js);
$template_js = str_replace("{LAN_PARAM}", "ln=".$ln, $template_js);
if($theme_name == "default") {
$theme_css = "";
} else {
$theme_css = "<link rel=\"stylesheet\" href=\"themes/".$theme_name."/style.css?v=".$version."\"/>";
}
$template_js = str_replace("{THEME_STYLE_CSS}", $theme_css, $template_js);
if($theme_name == "customize") {
$template_js = str_replace("{CUSTOMIZE_STYLE_CSS}", "<link rel=\"stylesheet\" href=\"$url_prefix/photo/customize_style.php\"/>", $template_js);
} else {
$template_js = str_replace("{CUSTOMIZE_STYLE_CSS}", "", $template_js);
}
$GLOBALS['arrange_album'] = 0;
$GLOBALS['manage'] = 0;
if(isset($_SESSION[$SYNOPHOTO_ADMIN_USER]['admin_syno_user']) && $_SESSION[$SYNOPHOTO_ADMIN_USER]['admin_syno_user'] == $SYNOPHOTO_ADMIN_PASS) {
$template_js = str_replace("{JS_NEEDED_BY_ADMIN}", "<script type=\"text/javascript\" src=\"javascripts/synophoto_index_admin.js?v=".$version."\"></script>", $template_js);
if ($_GET['manage'] == 'true') {
$GLOBALS['manage'] = 1;
}
if($_GET['arrange_album'] == "true") {
$template_js = str_replace("{JS_NEEDED_FOR_MOONTOOLS}",
"<script type=\"text/javascript\">g_is_for_arrange_album = 1;</script>".
"<script type=\"text/javascript\" src=\"javascripts/mootools-1.2.3-core-yc.js?v=".$version."\"></script>".
"<script type=\"text/javascript\" src=\"javascripts/mootools-1.2.4.2-more.js?v=".$version."\"></script>",
$template_js);
$GLOBALS['arrange_album'] = 1;
} else {
$template_js = str_replace("{JS_NEEDED_FOR_MOONTOOLS}", "<script type=\"text/javascript\">g_is_for_arrange_album = 0;</script>", $template_js);
}
} else {
$template_js = str_replace("{JS_NEEDED_BY_ADMIN}", "", $template_js);
$template_js = str_replace("{JS_NEEDED_FOR_MOONTOOLS}", "<script type=\"text/javascript\">g_is_for_arrange_album = 0;</script>", $template_js);
}
//{INCLUDE_JS}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{INCLUDE_JS}', $template_js);
//{PHOTO_STATION_TITLE}
$title = SYNOPHOTO_MISC_GetConfig("photo", "photo_page_title", "photo_config");
if($title == null || $title == "") {
$title = $photo_str_ap_name;
}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_STATION_TITLE}', $title);
//{PHOTO_TOP_LOGO}
$logo = "";
if($theme_name == "default") {
$logo = "<img id='photo_top_logo' width='250' height='50' src='/photo/images/ps_logo.png'>";
}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_TOP_LOGO}', $logo);
//{WELCOME_TITLE}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{WELCOME_TITLE}', SYNOPHOTO_HOME_GetWelcomeText());
//{TOP_HEADER_LINK}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{TOP_HEADER_LINK}', SYNOPHOTO_HOME_GetTopHeaderLink());
//{PHOTO_MAINFRAME_BANNER}
if($theme_name == "default") {
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_BANNER}', "");
} else {
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_BANNER}', SYNOPHOTO_MISC_GetConfig('banner', 'content', 'photo_config'));
}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_DIR_LINK}', "");
//{PHOTO_MAINFRAME_INFO}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_INFO}', SYNOPHOTO_HOME_GetMainframeInfo());
//{PHOTO_MAINFRAME_CONTENT}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_CONTENT}', SYNOPHOTO_ALBUM_UTIL_GetAlbums($_GET['page']));
//{PHOTO_MAINFRAME_PAGING}
if($GLOBALS['arrange_album'] || $GLOBALS['manage']) {
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_PAGING}', "");
} else {
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_MAINFRAME_PAGING}', SYNOPHOTO_HOME_GetMainframeIndexPaging($_GET['page']));
}
//{PHOTO_FOOTER_LINK}
$companyname = ucfirst(SYNOPHOTO_MISC_SystemInfoGet($SYNO_DEF_CNF_FILE, "company"));
$companylink = SYNOPHOTO_MISC_SystemInfoGet($SYNO_DEF_CNF_FILE, "updateurl");
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_FOOTER_LINK}', "<a target='_blank' href='".$companylink."'>".$companyname."</a>");
//{PHOTO_FOOTER_PRODUCT_NAME}
$productname = SYNOPHOTO_MISC_SystemInfoGet($SYNO_DEF_CNF_FILE, "product");
$modelname = SYNOPHOTO_MISC_SystemInfoGet($SYNO_DEF_CNF_FILE, "upnpmodelname");
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_FOOTER_PRODUCT_NAME}', $productname." ".$modelname);
//{PHOTO_FOOTER_RSS}
$rss = "<a href=\"$url_prefix/photo/rss.php\"><img src='images/home_rss.gif'></a>";
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PHOTO_FOOTER_RSS}', $rss);
//{PICLENS_ENABLED}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{PICLENS_ENABLED}', "");
//{END}
$template = SYNOPHOTO_MISC_PrintTemplate($template, '{END}', '');
?>