set_file("album_view_tp", "templates/album_view.tpl");
$tpl->set_block("album_view_tp", "ONLINEALBUM", "onlinealbum");
$tpl->set_block("album_view_tp", "WRONGLINK", "wronglink");
//blocks
$tpl->set_block("ONLINEALBUM", "ALBUM_SEPARATOR", "album_separator");
$tpl->set_block("ONLINEALBUM", "BARCODE_ALBUM", "barcode_album");
$tpl->set_block("ONLINEALBUM", "BARCODE_COVER", "barcode_cover");
$tpl->set_block("ONLINEALBUM", "NAVIGATOR", "navigator");
$tpl->set_block("ONLINEALBUM", "ZOOM", "zoom");
$tpl->set_block("ONLINEALBUM", "PAGE_SELECTOR", "page_selector");
$tpl->set_block("PAGE_SELECTOR", "PAGE_SELECTOR_OPTION", "page_selector_option");
$tpl->set_block("ONLINEALBUM", "ALBUMLINK", "albumlink");
$tpl->set_block("ONLINEALBUM", "ALBUMTEXT", "albumtext");
$tpl->set_block("ONLINEALBUM", "COVERLINK", "coverlink");
$tpl->set_block("ONLINEALBUM", "COVERTEXT", "covertext");
// check the link if it's correct or check if it's a mac/pdf album
$loginlink = false;
$albumpdf = false;
$albummac = false;
$albumdeleted = false;
$order_data = array();
$amlfile = "";
if(isset($_REQUEST["orderid"]) && isset($_REQUEST["password"])) {
if(check_orderid($_REQUEST["orderid"])) {
$order_data = get_fields('orders','*',"id = '".$_REQUEST["orderid"]."'");
$client_data = get_fields('clients','*',"email = '".$order_data["email"]."'");
if(md5($client_data["password"]) == $_REQUEST["password"]) {
$loginlink = true;
}
if(!checkMapOnServer($order_data["email"], $order_data["orifilename"]) && $G_current_root != "c:/inetpub/wwwroot/var/www/html/debug/pixbook_extranet_new") {
$loginlink = false;
$albumdeleted = true;
}
if(!record_exists("orders", "id", $_REQUEST["orderid"])) $loginlink = false;
if($_REQUEST["orderid"] == "") $loginlink = false;
if(substr_count($order_data["comment"], "pdf") > 0 || $order_data["code"] == "PRICE") $albumpdf = true;
if(substr_count($order_data["comment"], "mac") > 0) $albummac = true;
$amlfile = "$G_current_root/onlinealbum/".$order_data['email']."/".$order_data['orifilename'].".aml";
}
}
$orientation = "H";
//parse aml file to an array
if(is_file($amlfile)) {
$amldata = file_get_contents($amlfile);
$p = xml_parser_create();
xml_parse_into_struct($p, $amldata, $aml_array, $index);
xml_parser_free($p);
if(isset($aml_array[0]["attributes"]["ORIENTATION"])) $orientation = $aml_array[0]["attributes"]["ORIENTATION"];
}
if($loginlink && !$albumpdf && !$albummac && !$albumdeleted) {
$tpl->parse("onlinealbum" , "ONLINEALBUM" , true);
$width = $height = $maxpages = 0;
$recto = false;
$isAlbum = true;
if(substr_count($order_data["code"], "CRD") > 0 || substr_count($order_data["code"], "KAL") > 0 || substr_count($order_data["code"], "PT") > 0 || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0 || substr_count($order_data["code"], "POSTER") > 0 || substr_count($order_data["code"], "PLACE") > 0) {
$isAlbum = false;
}
//$codebackground = "A4";
$codebackground = (substr($order_data["code"],2));
$showalert = false;
$orderformvis = "hidden";
$message = "";
$errormessage1 = "";
$errormessage2 = "";
$errormessage3 = "";
$fname = "";
$name = "";
$email = "";
if(isset($_REQUEST["showorderform"])) {
$orderformvis = "visible";
}
else if(isset($_REQUEST["submit_order"])) {
$allesOk = true;
$fname = $_REQUEST["fname"];
$name = $_REQUEST["name"];
$email = $_REQUEST["email"];
if($fname == "") {
$errormessage1 = "
".put_txt("msg_fname_empty")."";
$tpl->set_var("STYLE_FNAME" , "border: solid 1px Red;");
$allesOk = false;
}
else if(preg_match("#[1-9\/\\<>&%\$\?\"!=]#", $fname)) {
$errormessage1 = put_txt("msg_fname_error");
$tpl->set_var("STYLE_FNAME" , "border: solid 1px Red;");
$allesOk = false;
}
if($name == "") {
$errormessage2 = "".put_txt("msg_name_empty")."";
$tpl->set_var("STYLE_NAME" , "border: solid 1px Red;");
$allesOk = false;
}
else if(preg_match("#[1-9\/\\<>&%\$\?\"!=]#", $name)) {
$errormessage2 = put_txt("msg_name_error");
$tpl->set_var("STYLE_NAME" , "border: solid 1px Red;");
$allesOk = false;
}
if($email == "") {
$errormessage3 = "".put_txt("msg_email_empty")."";
$tpl->set_var("STYLE_EMAIL" , "border: solid 1px Red;");
$allesOk = false;
}
else if(!preg_match("#^[a-z0-9\._-]+@([a-z0-9][a-z0-9-]*[a-z0-9]\.)+([a-z]+\.)?([a-z]+)$#i", $email)) {
$errormessage3 = "".put_txt("msg_email_false")."";
$tpl->set_var("STYLE_EMAIL" , "border: solid 1px Red; color: Red;");
$allesOk = false;
}
if($allesOk) {
// copy the files to the clients folder
$new_orifilename = reorderalbum(strtolower($order_data["email"]), $order_data["orifilename"], strtolower($email));
$new_name = $fname." ".$name;
$pagetype = $order_data['code'];
$cover = $order_data['cover'];
$albumname = urlencode($order_data['albumname']);
$version = $order_data['version'];
$lang = $order_data['lang'];
$partner = $order_data['partner'];
$G_lang = "NL";
if(isset($_REQUEST["LANG"])) {
if(strlen($_REQUEST["LANG"]) == 2) $G_lang = strtoupper($_REQUEST["LANG"]);
}
$orderedfromstring = "";
if($order_data['email'] != $email) $orderedfromstring = "&INTERNALCOMMENT=orderedfrom:".$order_data["email"];
//HTTP request to place the order
$response = file_get_contents("https://newextranet.pixbook.net/pixbook.php?ACTION=album.submit&EMAIL=$email&NAME=".urlencode($new_name)."&FILE=$new_orifilename&PAGETYPE=$pagetype&COVER=$cover&ALBUMNAME=$albumname&VERSION=".urlencode($version)."&LANG=$G_lang&PARTNER=$partner&ORIENTATION=".$orderedfromstring);
if(!$response) logmsg("error in HTTP request: $email, file $new_orifilename");
$message = put_txt("msg_succes", $email);
$fname = "";
$name = "";
$email = "";
}
else $orderformvis = "visible";
}
if(!isset($_SESSION["cover"])) $_SESSION["cover"] = "false";
if(isset($_REQUEST["cover"])) {
$_SESSION["cover"] = "true";
$_SESSION["currPage"] = 1;
}
if(isset($_REQUEST["album"])) {
$_SESSION["cover"] = "false";
$_SESSION["currPage"] = 1;
}
$zoom = 2;
if(isset($_SESSION["zoom"])) {
$zoom = $_SESSION["zoom"];
}
else if(substr_count($order_data["code"], "CRD") > 0) {
$zoom = 3.5;
}
if(isset($_REQUEST["zoomout_x"]) || isset($_REQUEST["zoomout.x"])) {
if($zoom > 1 && $zoom <= 2.5) $zoom -= 0.5;
else if($zoom == 3.5) $zoom -= 1;
else if($zoom == 5) $zoom -= 1.5;
}
else if(isset($_REQUEST["zoomin_x"]) || isset($_REQUEST["zoomin.x"])) {
if($zoom >= 1 && $zoom < 2.5) $zoom += 0.5;
else if($zoom == 2.5) $zoom += 1;
else if($zoom == 3.5) $zoom += 1.5;
}
if(!isset($_SESSION["currPage"])) $_SESSION["currPage"] = 1;
$currPage = $_SESSION["currPage"];
//visibility buttons
$v_first = "visible";
$v_last = "visible";
$v_previous = "visible";
$v_next = "visible";
$v_zoomin = "visible";
$v_zoomout = "visible";
if($loginlink) getPagesize();
/*if(!isset($_REQUEST["go"]) && $G_current_root != "c:/inetpub/wwwroot/var/www/html/debug/pixbook_debug") {
call_user_func('checkfile', $order_data["email"], $order_data["orifilename"]);
}*/
if(isset($_REQUEST["firstpage_x"])) {
if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") {
$currPage = 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else {
$currPage = 1;
if($order_data["cover"] == "CRD") $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
else if(isset($_REQUEST["lastpage_x"])) {
if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") {
$currPage = $maxpages;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$currPage = $maxpages;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$currPage = $maxpages-1;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
$currPage = $maxpages;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else {
$currPage = $maxpages;
if($recto) $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "left"));
}
}
else if(isset($_REQUEST["nextpage_x"])) {
if($_SESSION["cover"] == "true") {
if($currPage == 1 || $currPage == 2) cover_inside_size();
else getPagesize();
}
if($_SESSION["cover"] == "true"){
if($order_data["cover"] == "BP") {
$currPage = $maxpages;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "WP") {
if($currPage < $maxpages) $currPage = $currPage + 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
}
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD" || ($_SESSION["cover"] == "true" && $order_data["cover"] == "WP")) {
$currPage = $currPage + 2;
if($currPage >= $maxpages) $currPage = $maxpages;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
$currPage = $currPage + 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$currPage = $currPage + 1;
if($currPage >= $maxpages) $currPage = $maxpages;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$currPage = $currPage + 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else
{
if(!$recto) {
$currPage = $currPage + 2;
if($currPage >= $maxpages) {
$currPage = $maxpages;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "left"));
}
else {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
}
else {
$currPage = $currPage + 1;
if($currPage >= $maxpages) $currPage = $maxpages;
if($order_data["cover"] == "CRD") $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
}
else if(isset($_REQUEST["previouspage_x"])) {
if($_SESSION["cover"] == "true") {
if($currPage == 4 || $currPage == 3) cover_inside_size();
else getPagesize();
}
if($_SESSION["cover"] == "true"){
if($order_data["cover"] == "BP") {
$currPage = 1;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
}
else if($order_data["cover"] == "WP") {
if($currPage > 1) $currPage = $currPage - 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
}
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD" || ($_SESSION["cover"] == "true" && $order_data["cover"] == "WP")) {
if($currPage != 2) $currPage = $currPage - 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
if($currPage > 1) $currPage = $currPage-1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
if($currPage != 1) $currPage = $currPage-1;
if($currPage >= $maxpages) $currPage = $maxpages;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
if($currPage != 1) $currPage = $currPage - 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else
{
if(!$recto)
{
if($currPage == $maxpages) $currPage--;
else if($currPage != 1) $currPage = $currPage - 2;
if($currPage != 1) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
else
{
if($currPage != 1) $currPage = $currPage - 1;
if($order_data["cover"] == "CRD") $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
}
else if(isset($_REQUEST["zoomout_x"]) || isset($_REQUEST["zoomin_x"])) {
if($_SESSION["cover"] == "true"){
if($currPage == 2 || $currPage == 3) cover_inside_size();
else getPagesize();
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD" || ($_SESSION["cover"] == "true" && $order_data["cover"] == "WP")) {
if($currPage < 2) $currPage = 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage-1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0 || $order_data["code"] == "PLACE" || substr_count($order_data["code"], "POSTER") > 0 || substr_count($order_data["code"], "PT") > 0 || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) {
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else
{
if(!$recto) {
if($currPage >= $maxpages) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "left"));
}
else if($currPage != 1) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
else {
if($order_data["cover"] == "CRD") $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
}
else if(isset($_REQUEST["jumptopage"])) {
$currPage = $_REQUEST["jumptopage"];
if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD" || ($_SESSION["cover"] == "true" && $order_data["cover"] == "WP")) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else
{
if(!$recto)
{
if($currPage == 1) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
else if($currPage >= $maxpages) {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "left"));
}
else {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
}
else
{
if($order_data["cover"] == "CRD") $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
}
else {
if(isset($_REQUEST["go"])) {
if(isset($_SESSION)) session_destroy();
$currPage = 1;
logmsg("ALBUM_VIEW: ".$order_data["email"].", file ".$order_data["orifilename"]);
if($loginlink) {
//copytoalbumonline($order_data["email"], $order_data["orifilename"], $_REQUEST["orderid"]);
call_user_func('copytoalbumonline', $order_data["email"], $order_data["orifilename"], $_REQUEST["orderid"]);
}
$showalert = true;
if(strtolower($G_lang) == "en" || strtolower($G_lang) == "de") $alert = "alert(textalert_en)";
else if(strtolower($G_lang) == "fr") $alert = "alert(textalert_fr)";
else $alert = "alert(textalert)";
}
if($_SESSION["cover"] == "true"){
$currPage = 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") {
$currPage = 2;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage - 1, $zoom, $height, $width));
}
else if(substr_count($order_data["code"], "KAL") > 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$currPage = 1;
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage+1, $zoom, $height, $width, 0, "right"));
$tpl->set_var('RETURNPAGE_LEFT' , returnPage($currPage, $zoom, $height, $width));
}
else {
$currPage = 1;
if($order_data["cover"] == "CRD" || substr_count($order_data["code"], "PT") > 0 || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0 || substr_count($order_data["code"], "POSTER") > 0 || $order_data["code"] == "PLACE") {
$tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, 0, "right"));
}
else $tpl->set_var('RETURNPAGE_RIGHT' , returnPage($currPage, $zoom, $height, $width, $width, "right"));
}
}
if($maxpages == 1) $tpl->parse("zoom", "ZOOM", true);
else $tpl->parse("navigator", "NAVIGATOR", true);
//sessions updaten
$_SESSION["currPage"] = $currPage;
$_SESSION["zoom"] = $zoom;
//table styles
$header_width = 250;
$loader_width = 200;
$hor_margin = 50;
$ver_margin = 180;
if($orientation == "V") {
$temp = $width;
$width = $height;
$height = $temp;
}
$table_left = $hor_margin * $zoom;
$table_top = (($height + 20) * $zoom) + $ver_margin;
$table_width = ($width * 2) * $zoom;
$bleed = 2;
if($order_data["code"] == "CRD3") {
$table_width = ($width * 4) * $zoom;
}
else if($order_data["code"] == "KAL") {
$table_top = (($height * 2 + 10) * $zoom) + $ver_margin;
$table_width = $width * $zoom;
}
else if($order_data["code"] == "KALP" || $order_data["code"] == "KALBUR" || $order_data["cover"] == "CRD") {
$table_width = $width * $zoom;
}
else if($order_data["code"] == "PLACE" || $order_data["code"] == "POSTER" || $order_data["code"] == "POSTERP" || $order_data["code"] == "KALA3P") {
$table_width = $width * $zoom;
}
else if(substr_count($order_data["code"], "PT") || substr_count($order_data["code"], "CV") || substr_count($order_data["code"], "DB") || substr_count($order_data["code"], "PX") || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) {
$table_width = $width * $zoom;
$bleed = 3;
if(substr_count($order_data["code"], "CV")) $bleed = 25;
if(substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) $bleed = 0;
}
else if($order_data["cover"] == "SP") {
if(substr_count($order_data["code"], "_2") > 0) $table_width = $width * $zoom;
else if($_SESSION["cover"] == "true") $table_width = $width * $zoom;
$bleed = 3;
}
else if($_SESSION["cover"] == "true") {
$table_width = $width * $zoom;
$bleed = 0;
}
$table_width1 = $table_width - ($bleed*2*$zoom);
$table_width2 = ($table_width-($bleed*2))/2;
//if(substr_count($order_data["code"], "_2") > 0) $table_width2 -= $bleed;
$totalpages = $maxpages;
//paging
if($order_data["code"] == "KALP" || $order_data["code"] == "KALA3P" || $order_data["code"] == "KALBUR") $tpl->set_var('PAGE' , $currPage);
else if($order_data["code"] == "POSTER" || $order_data["code"] == "POSTERP" || $order_data["code"] == "PLACE" || substr_count($order_data["code"], "PT") || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) $tpl->set_var('PAGE' , $maxpages);
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") $tpl->set_var('PAGE' , ($currPage-1)."-".$currPage);
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2")) {
$tpl->set_var('PAGE' , (($currPage*2)-1)."-".($currPage*2));
$totalpages = $maxpages*2;
}
else {
if($recto && $isAlbum) {
$tpl->set_var('PAGE' , ($currPage*2)-1);
$totalpages = $maxpages*2;
$maxpages = $totalpages;
}
else if($currPage == 1 || $currPage == $maxpages) $tpl->set_var('PAGE' , $currPage);
else $tpl->set_var('PAGE' , ($currPage-1)."-".$currPage);
}
if($_SESSION["cover"] != "true") {
$tpl->set_var('TXT_PAGE' , put_txt("page"));
$tpl->set_var('TOTALPAGES' , $totalpages);
for($i=1; $i<=$maxpages; $i++) {
if($order_data["code"] == "KALP" || $order_data["code"] == "KALA3P" || $order_data["code"] == "KALBUR") $tpl->set_var('PAGE_SELECTOR_VALUE' , $i);
else if($order_data["code"] == "POSTER" || $order_data["code"] == "POSTERP" || $order_data["code"] == "PLACE" || substr_count($order_data["code"], "PT") > 0 || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) $tpl->set_var('PAGE_SELECTOR_VALUE' , $maxpages);
else if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") $tpl->set_var('PAGE_SELECTOR_VALUE' , $i."-".($i+1));
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2")) {
$tpl->set_var('PAGE_SELECTOR_VALUE' , (($i*2)-1)."-".($i*2));
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) {
$tpl->set_var('PAGE_SELECTOR_VALUE' , ($i."-".($i+1)));
}
else {
if($recto) {
if($i < $maxpages) $tpl->set_var('PAGE_SELECTOR_VALUE' , $i);
else break;
}
else if($i == 1 || $i == $maxpages) $tpl->set_var('PAGE_SELECTOR_VALUE' , $i);
else $tpl->set_var('PAGE_SELECTOR_VALUE' , ($i-1)."-".$i);
}
if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") {
$tpl->set_var('PAGE_SELECTOR_NR' , $i+1);
if(($i+1)==$currPage) $tpl->set_var('PAGE_SELECTOR_SEL' , "selected");
}
else {
if($recto && $isAlbum) {
if($i < $maxpages) $tpl->set_var('PAGE_SELECTOR_NR' , ($i+1)/2);
if(($i+1)/2==$currPage) $tpl->set_var('PAGE_SELECTOR_SEL' , "selected");
}
else {
$tpl->set_var('PAGE_SELECTOR_NR' , $i);
if($i==$currPage) $tpl->set_var('PAGE_SELECTOR_SEL' , "selected");
}
}
$tpl->parse("page_selector_option", "PAGE_SELECTOR_OPTION", true);
$tpl->set_var('PAGE_SELECTOR_SEL' , "");
if(($i<($maxpages-1) || $order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") && $order_data["cover"] != "SP" && $order_data["code"] != "KALP" && $order_data["code"] != "KALA3P" && $order_data["code"] != "KALBUR") $i++;
if($i<$maxpages && $order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0) $i++;
}
$tpl->parse("page_selector", "PAGE_SELECTOR", true);
}
else {
if($order_data["cover"] == "WP") {
if($currPage == 1 || $currPage == 4) $tpl->set_var('TXT_PAGE' , "Buitenkaft");
else $tpl->set_var('TXT_PAGE' , "Binnenkaft");
}
if($order_data["cover"] == "BP" || $order_data["cover"] == "SP") {
if($currPage == 1) $tpl->set_var('TXT_PAGE' , "Buitenkaft");
else $tpl->set_var('TXT_PAGE' , "Binnenkaft");
}
}
//zoom percentage
if($zoom < 2) {
$schaal = (($zoom*100) / 2);
}
else {
$schaal = (($zoom*100) - 100);
}
switch($zoom) {
case 1: $fontschaal = $schaal*0.90; break;
case 1.5: $fontschaal = $schaal*0.95; break;
case 2: $fontschaal = $schaal; break;
case 2.5: $fontschaal = $schaal*0.85; break;
case 3.5: $fontschaal = $schaal*0.70; break;
case 5: $fontschaal = $schaal*0.65; break;
default: $fontschaal = $schaal; break;
}
$tpl->set_var('SCHAAL' , $schaal);
$tpl->set_var('FONTSCHAAL' , $fontschaal);
//cover
if($order_data["cover"] == "WP" || $order_data["cover"] == "BP" || $order_data["cover"] == "SP") {
$tpl->set_var('TXT_COVER' , put_txt("cover"));
if($_SESSION["cover"] == "true") {
$tpl->parse("albumlink", "ALBUMLINK", true);
$tpl->parse("covertext", "COVERTEXT", true);
}
else {
$tpl->parse("albumtext", "ALBUMTEXT", true);
$tpl->parse("coverlink", "COVERLINK", true);
}
}
else $tpl->set_var('COVER' , "");
//table styles
$tpl->set_var('LOADER_LEFT' , ($table_width/2) + $table_left - ($loader_width/2));
$tpl->set_var('LOADER_TOP' , ($table_top + 70)/2);
$tpl->set_var('HEADER_LEFT' , ($table_width/2) + $table_left - ($header_width/2));
$tpl->set_var('TABLE_LEFT' , $table_left);
$tpl->set_var('TABLE_TOP' , $table_top);
$tpl->set_var('TABLE_WIDTH', $table_width1);
$tpl->set_var('TABLE_WIDTH2', $table_width2);
//visibiliy buttons
if($order_data["code"] == "KAL" || substr($order_data["code"], 0, 3) == "CRD") {
if($currPage == 2) {
$v_first = "hidden";
$v_previous = "hidden";
}
}
else {
if($currPage == 1) {
$v_first = "hidden";
$v_previous = "hidden";
}
}
if($_SESSION["cover"] == "true") {
$v_first = "hidden";
$v_last = "hidden";
if($order_data["cover"] == "SP") {
$v_next = "hidden";
$v_previous = "hidden";
}
}
if($recto && $currPage == $maxpages/2) {
$v_next = "hidden";
$v_last = "hidden";
}
else if($currPage == $maxpages) {
$v_next = "hidden";
$v_last = "hidden";
}
if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") == 0 && $currPage == $maxpages-1) {
$v_next = "hidden";
$v_last = "hidden";
}
if($zoom == 1) $v_zoomout = "hidden";
if($zoom == 5) $v_zoomin = "hidden";
$tpl->set_var('V_FIRST' , $v_first);
$tpl->set_var('V_LAST' , $v_last);
$tpl->set_var('V_PREVIOUS' , $v_previous);
$tpl->set_var('V_NEXT' , $v_next);
$tpl->set_var('V_ZOOMIN' , $v_zoomin);
$tpl->set_var('V_ZOOMOUT' , $v_zoomout);
//separator between albums
/*if(($order_data["cover"] == "SP" || substr_count($order_data["code"], "A7") > 0 || substr_count($order_data["code"], "A5") > 0 || substr_count($order_data["code"], "A4") > 0 || substr_count($order_data["code"], "A3") > 0 || substr_count($order_data["code"], "LUX") > 0) && substr_count($order_data["code"], "KAL") == 0 && substr_count($order_data["code"], "AGA") == 0 && $order_data["cover"] != "CRD" && $_SESSION["cover"] == "false") {
$tpl->parse("album_separator", "ALBUM_SEPARATOR", true);
}*/
/*if($order_data["cover"] != "WP" && $_SESSION["cover"] == "true") {
$tpl->parse("album_separator", "ALBUM_SEPARATOR", true);
}*/
$schaalfactor = $schaal;
if($schaal <= 50) {
$schaalfactor = $schaal/2.5;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
else if($schaal <= 75) {
$schaalfactor = $schaal/2.5;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
else if($schaal <= 100) {
$schaalfactor = $schaal/2.5;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
else if($schaal <= 150) {
$schaalfactor = $schaal/3;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
else if($schaal <= 250) {
$schaalfactor = $schaal/3.5;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
else {
$schaalfactor = $schaal/4.5;
$tpl->set_var('BARCODE_SIZE' , $schaalfactor);
}
//show barcode on the cover and the last page of SP albums
if($_SESSION["cover"] == "false" && $order_data["cover"] == "SP" && ((substr_count($order_data["code"], "_2") > 0 && $currPage == $maxpages) || (substr_count($order_data["code"], "_2")== 0 && $currPage >= $maxpages-1))) {
if(substr_count($order_data["code"], "_2")== 0) $width = $width*2;
if(substr_count($order_data["code"], "B4P") > 0) {
$tpl->set_var('BARCODE_ALBUM_LEFT' , ($width*$zoom)-(15*$zoom));
$tpl->set_var('BARCODE_ALBUM_TOP' , ($height*$zoom)-(22*$zoom));
}
else if(substr_count($order_data["code"], "B4") > 0) {
$tpl->set_var('BARCODE_ALBUM_LEFT' , ($width*$zoom)-(15*$zoom));
$tpl->set_var('BARCODE_ALBUM_TOP' , ($height*$zoom)-(22*$zoom));
}
else if(substr_count($order_data["code"], "LUX5") > 0) {
$tpl->set_var('BARCODE_ALBUM_LEFT' , ($width*$zoom)-(15*$zoom));
$tpl->set_var('BARCODE_ALBUM_TOP' , ($height*$zoom)-(22*$zoom));
}
else if(substr_count($order_data["code"], "LUX3") > 0) {
$tpl->set_var('BARCODE_ALBUM_LEFT' , ($width*$zoom)-(15*$zoom));
$tpl->set_var('BARCODE_ALBUM_TOP' , ($height*$zoom)-(22*$zoom));
}
else if(substr_count($order_data["code"], "B3") > 0) {
$tpl->set_var('BARCODE_ALBUM_LEFT' , ($width*$zoom)-(15*$zoom));
$tpl->set_var('BARCODE_ALBUM_TOP' , ($height*$zoom)-(22*$zoom));
}
if(substr_count($order_data["code"], "LUX4") == 0 && substr_count($order_data["code"], "B6") == 0 && substr_count($order_data["code"], "B5P") == 0) $tpl->parse("barcode_album", "BARCODE_ALBUM", true);
if(substr_count($order_data["code"], "_2")== 0) $width = $width/2;
}
if($order_data["cover"] == "SP" && $_SESSION["cover"] == "true") {
if(substr_count($order_data["code"], "B6") > 0) {
if($schaal == 50) $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-43);
else $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(30*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "B5P") > 0) {
if($schaal == 50) $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-43);
else $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(30*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "B4P") > 0) {
$tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(31*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "B4") > 0) {
$tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(31*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "LUX5") > 0) {
$tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(31*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "LUX4") > 0) {
if($schaal == 50) $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-43);
else $tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(30*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
else if(substr_count($order_data["code"], "LUX3") > 0) {
$tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(31*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
if(substr_count($order_data["code"], "B3") > 0) {
$tpl->set_var('BARCODE_COVER_RIGHT' , ($width*$zoom)-(31*$zoom));
$tpl->set_var('BARCODE_COVER_TOP' , ($height*$zoom)-(25*$zoom));
}
$tpl->parse("barcode_cover", "BARCODE_COVER", true);
}
//description album on top
if($order_data["cover"] == "SP") $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".substr(str_replace("_2", "", $order_data["code"]), 2)."'").", ".substr($order_data["code"], 0, 2)." ".get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
else if($order_data["code"] == "FRAME") $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'FRAME2'")));
else if(substr_count($order_data["code"], "KALK") > 0) {
if(substr_count($order_data["code"], "A3") > 0) $tpl->set_var("ALBUM" , intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A3KALK'")));
else if(substr_count($order_data["code"], "A4") > 0) $tpl->set_var("ALBUM" , intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A4KALK'")));
else if(substr_count($order_data["code"], "A5") > 0) $tpl->set_var("ALBUM" , intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A5KALK'")));
else if(substr_count($order_data["code"], "LUX2") > 0) $tpl->set_var("ALBUM" , intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUX2KALK'")));
else if(substr_count($order_data["code"], "LUX") > 0) $tpl->set_var("ALBUM" , intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUXKALK'")));
}
else if(substr_count($order_data["code"], "PRO") > 0 && substr_count($order_data["code"], "BOX") == 0) {
if(substr_count($order_data["code"], "A3") > 0) $descrpro = (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A3PRO'"));
else if(substr_count($order_data["code"], "A4") > 0) $descrpro = (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A4PRO'"));
else if(substr_count($order_data["code"], "LUX") > 0) $descrpro = (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUXPRO'"));
if(substr_count($order_data["code"], "RPRO") > 0) $descrpro .= ", ".intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'"));
else $descrpro .= ", ".intval($order_data["code"])." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'"));
$tpl->set_var("ALBUM" , $descrpro);
}
else if(substr_count($order_data["code"], "PT") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'PT'")." ".str_replace("pt", "", strtolower($order_data["code"]))."cm"));
else if(substr_count($order_data["code"], "CV") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'CV'")." ".str_replace("cv", "", strtolower($order_data["code"]))."cm"));
else if(substr_count($order_data["code"], "DB") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'DB'")." ".str_replace("db", "", strtolower($order_data["code"]))."cm"));
else if(substr_count($order_data["code"], "PX") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'PX'")." ".str_replace("px", "", strtolower($order_data["code"]))."cm"));
else if(substr_count($order_data["code"], "MG") > 0) {
$color = "";
$fotopos = "";
if($order_data["cover"] == "C") $color = " ".get_field("descriptions", "descr_".strtolower($G_lang), "code = '".$order_data["covercolor"]."'");
if($order_data["covertype"] != "") $fotopos = " (".get_field("descriptions", "descr_".strtolower($G_lang), "code = '".$order_data["covertype"]."'").")";
$tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'MG'")." ".get_field("descriptions", "descr_".strtolower($G_lang), "code = 'MG".$order_data["cover"]."'")."$color ".str_replace("mg", "", strtolower($order_data["code"]))."cm".$fotopos));
}
else if(substr_count($order_data["code"], "PL") > 0 && $order_data["code"] != "PLACE") $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'PL'")." ".get_field("descriptions", "descr_".strtolower($G_lang), "code = 'PL".$order_data["cover"]."'")." ".str_replace("pl", "", strtolower($order_data["code"]))."cm"));
else if(substr_count($order_data["code"], "BK") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'BK'")." ".str_replace("bk", "", strtolower($order_data["code"]))."cm"));
else if($order_data["cover"] == "CRD") {
if(substr_count($order_data["code"], "A3") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("A3", "CRDA3", str_replace("R", "", str_replace("P", "", substr($order_data["code"], 2))))."'")));
else if(substr_count($order_data["code"], "A4") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("A4", "CRDA4", str_replace("R", "", str_replace("P", "", substr($order_data["code"], 2))))."'")));
else if(substr_count($order_data["code"], "A5") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("A5", "CRDA5", str_replace("R", "", str_replace("P", "", substr($order_data["code"], 2))))."'")));
else if(substr_count($order_data["code"], "LUX2") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("LUX2", "CRDLUX2", str_replace("R", "", substr($order_data["code"], 2)))."'")));
else if(substr_count($order_data["code"], "LUX") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("LUX", "CRDLUX", str_replace("R", "", substr($order_data["code"], 2)))."'")));
}
else if(substr_count($order_data["code"], "BOX") > 0) {
if(substr_count($order_data["code"], "PRO") > 0) $descr = "Pro: ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = '".str_replace("PRO", "", $order_data["code"])."'"));
else $descr = (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".$order_data["code"]."'"));
$tpl->set_var("ALBUM" , $descr);
}
else if((substr_count($order_data["code"], "A3") > 0 || substr_count($order_data["code"], "A4") > 0 || substr_count($order_data["code"], "A5") > 0 || substr_count($order_data["code"], "LUX") > 0) && $order_data["cover"] != "CRD" && $order_data["cover"] != "SP" && substr_count($order_data["code"], "KAL") == 0 && substr_count($order_data["code"], "AGA") == 0 && substr_count($order_data["code"], "BOX") == 0) {
if(substr_count($order_data["code"], "A3R") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A3'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'")));
else if(substr_count($order_data["code"], "A4R") > 0 || substr_count($order_data["code"], "A4PR") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A4'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'")));
else if(substr_count($order_data["code"], "A5R") > 0 || substr_count($order_data["code"], "A5PR") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A5'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'")));
else if(substr_count($order_data["code"], "LUX2R") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUX2'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'")));
else if(substr_count($order_data["code"], "LUXR") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUX'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheetsR'")));
else if(substr_count($order_data["code"], "A3") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A3'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
else if(substr_count($order_data["code"], "A4") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A4'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
else if(substr_count($order_data["code"], "A5") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'A5'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
else if(substr_count($order_data["code"], "LUX2") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUX2'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
else if(substr_count($order_data["code"], "LUX") > 0) $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = 'LUX'").", ".intval($order_data["code"]))." ".(get_field("descriptions", "descr_".strtolower($G_lang), "code = 'xsheets'")));
}
else $tpl->set_var("ALBUM" , (get_field("descriptions", "descr_".strtolower($G_lang), "code = '".$order_data["code"]."'")));
$tpl->set_var('NAME' , $order_data["addressee"]);
$tpl->set_var('EMAIL' , $order_data["email"]);
$tpl->set_var('ORDER_ID' , $_REQUEST["orderid"]);
$tpl->set_var('PASSWORD' , $_REQUEST["password"]);
$tpl->set_var('LANG' , $G_lang);
//xml data
$tpl->set_var('TITLE' , put_txt("title"));
$tpl->set_var('LOADING' , put_txt("LOADING"));
$tpl->set_var('TXT_ORDER' , put_txt("order"));
$tpl->set_var('TXT_FNAME' , put_txt("fname"));
$tpl->set_var('TXT_NAME' , put_txt("name"));
$tpl->set_var('TXT_POPUP_ORDER' , put_txt("popup_order"));
$tpl->set_var('TXT_JAAR' , date("Y"));
$tpl->set_var('ORDER_VISIBILITY' , $orderformvis);
//persistence
$tpl->set_var('VALUE_FNAME' , $fname);
$tpl->set_var('VALUE_NAME' , $name);
$tpl->set_var('VALUE_EMAIL' , $email);
//message after order
$tpl->set_var('MESSAGE' , $message);
//errormessage
$tpl->set_var('ERRORMESSAGE' , $errormessage1.$errormessage2.$errormessage3);
//indien de eerste keer, toon alert
if($showalert) $tpl->set_var('ALERT' , $alert);
else $tpl->set_var('ALERT' , "");
//form action
$tpl->set_var('FORM_ACTION', $_SERVER['PHP_SELF']);
}
else {
if($albummac) $tpl->set_var('TXT_WRONG_LINK' , put_txt("album_mac"));
else if($albumpdf) $tpl->set_var('TXT_WRONG_LINK' , put_txt("album_pdf"));
else if($albumdeleted) $tpl->set_var('TXT_WRONG_LINK' , put_txt("album_deleted"));
else $tpl->set_var('TXT_WRONG_LINK' , put_txt("wrong_link"));
$tpl->parse("wronglink" , "WRONGLINK" , true);
}
//functions
function returnPage($nr, $zoom, $height, $width, $padding = 0, $position = "left") {
global $G_current_root, $recto, $codebackground, $order_data, $page_right_color, $page_left_color, $albumpdf, $albummac, $albumdeleted, $loginlink;
$xh = xslt_create();
$extension = "aml";
$cover = "nocover";
if($_SESSION["cover"] == "true") {
if($order_data["cover"] != "SP" && file_exists("$G_current_root/onlinealbum/".$order_data['email']."/".$order_data['orifilename'].".cml") && filesize("$G_current_root/onlinealbum/".$order_data['email']."/".$order_data['orifilename'].".cml") > 0) $extension = "cml";
$cover = $order_data["cover"];
}
if($order_data["code"] == "KALP" || $order_data["code"] == "KALA3P" || $order_data["code"] == "KALBUR") {
$recto = true;
}
$bleed = 2;
if(substr_count($order_data["code"], "PT") > 0 || substr_count($order_data["code"], "CV") > 0 || substr_count($order_data["code"], "DB") > 0 || substr_count($order_data["code"], "PX") > 0 || $order_data["cover"] == "SP") {
$bleed = 3;
if(substr_count($order_data["code"], "CV")) $bleed = 25;
}
if(substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0) {
$bleed = 0;
}
if($order_data["code"] == "KAL") {
if($nr%2 == 0) $pageheight = $height * $zoom + 20;
else $pageheight = 0;
$pagewidth = 0;
}
else if($order_data["code"] == "KALP" || $order_data["code"] == "KALA3P") {
$pageheight = 0;
$pagewidth = $zoom;
}
else if($order_data["code"] == "PLACE" || $order_data["code"] == "POSTER" || $order_data["code"] == "POSTERP" || substr_count($order_data["code"], "MG") > 0 || substr_count($order_data["code"], "BK") > 0 || substr_count($order_data["code"], "PL") > 0 || ($_SESSION["cover"] == "true" && $order_data["cover"] == "BP")) {
$pageheight = 0;
$pagewidth = $zoom;
}
else if(substr($order_data["code"], 0, 3) == "CRD") {
$pageheight = 0;
if($nr%2 == 0) $pagewidth = ($width + 10) * $zoom;
else $pagewidth = $zoom;
}
else if($order_data["cover"] == "SP" && substr_count($order_data["code"], "_2") > 0) {
$pageheight = 0;
$pagewidth = 0;
}
else{
if($nr%2 == 0 && !$recto || $nr == 0) $pagewidth = 1;
else $pagewidth = $width * $zoom;
$pageheight = 0;
}
$parameters=array(
"id" => $order_data["id"],
"nr" => $nr,
"zoom" => $zoom,
"height" => $height,
"width" => $width,
"path" => "onlinealbum/".$order_data["email"]."/".$order_data["orifilename"]."/",
"pagewidth" => $pagewidth,
"pageheight" => $pageheight,
"padding" => $padding,
"code" => $codebackground,
"cover" => $cover,
"bleed" => $bleed,
"position" => $position
);
//return utf8_encode(xslt_process($xh, "/data/home/ftp/albumsubmit/".$order_data["email"]."/".$order_data["orifilename"].".".$extension, "phpinc/albumonline.xsl", NULL, NULL, $parameters));
if($loginlink && !$albumpdf && !$albummac && !$albumdeleted) {
if(file_exists("$G_current_root/onlinealbum/".$order_data['email']."/".$order_data['orifilename'].".$extension")) {
return str_replace("<", "<", str_replace(">", ">", utf8_encode(xslt_process($xh, "file://$G_current_root/onlinealbum/".$order_data["email"]."/".$order_data["orifilename"].".".$extension, "file://$G_current_root/phpinc/albumonline.xsl", NULL, NULL, $parameters))));
}
else {
header("Location: album_view.php?orderid=".$_REQUEST["orderid"]."&password=".$_REQUEST["password"]."&go=true");
}
}
}
function switchsize() {
global $width, $height;
$temp = $width;
$width = $height;
$height = $temp;
}
function cover_inside_size() {
global $width, $height, $order_data;
$code = $order_data["code"];
if($_SESSION["cover"] == "true") {
if($order_data["cover"] == "WP") {
if(substr_count($code, "A3") > 0 || substr_count($code, "A3R") > 0) {
$width = 415;
$height = 297;
}
else if(substr_count($code, "A4P") > 0 || substr_count($code, "A4PR") > 0 || substr_count($code, "AGA4") > 0) {
$width = 205;
$height = 297;
}
else if(substr_count($code, "A4") > 0 || substr_count($code, "A4R") > 0) {
$width = 292;
$height = 210;
}
else if(substr_count($code, "A5P") > 0 || substr_count($code, "A5PR") > 0 || substr_count($code, "AGA5") > 0) {
$width = 143;
$height = 210;
}
else if(substr_count($code, "A5") > 0 || substr_count($code, "A5R") > 0) {
$width = 205;
$height = 148;
}
else if(substr_count($code, "AGA6") > 0) {
$width = 100;
$height = 148;
}
}
else if($order_data["cover"] == "BP") {
if(substr_count($code, "A3PRO") > 0 || substr_count($code, "A3RPRO") > 0) {
$width = 911;
$height = 300;
}
else if(substr_count($code, "LUXPRO") > 0 || substr_count($code, "LUXRRPRO") > 0) {
$width = 671;
$height = 300;
}
else if(substr_count($code, "A4PRO") > 0 || substr_count($code, "A4RPRO") > 0) {
$width = 654;
$height = 210;
}
else if(substr_count($code, "A3") > 0) {
$width = 877;
$height = 300;
}
else if(substr_count($code, "LUX2") > 0) {
$width = 457;
$height = 210;
}
else if(substr_count($code, "LUX") > 0) {
$width = 637;
$height = 300;
}
else if(substr_count($code, "A4") > 0) {
$width = 637;
$height = 210;
}
else if(substr_count($code, "A5") > 0) {
$width = 469;
$height = 150;
}
}
}
}
function getPagesize() {
global $width, $height, $maxpages, $recto, $codebackground, $order_data;
$code = $order_data["code"];
$maxpages = 1;
if($_SESSION["cover"] == "true") {
if($order_data["cover"] == "WP") {
$maxpages = 4;
if(substr_count($code, "A3") > 0 || substr_count($code, "A3R") > 0) {
$codebackground = "A3B";
$width = 421;
$height = 303;
}
else if(substr_count($code, "A4P") > 0 || substr_count($code, "A4PR") > 0 || substr_count($code, "AGA4") > 0) {
$codebackground = "A4B";
$width = 215;
$height = 307;
}
else if(substr_count($code, "A4") > 0 || substr_count($code, "A4R") > 0) {
$codebackground = "A4B";
$width = 301;
$height = 220;
}
else if(substr_count($code, "A5P") > 0 || substr_count($code, "A5PR") > 0 || substr_count($code, "AGA5") > 0) {
$codebackground = "A5B";
$width = 153;
$height = 220;
}
else if(substr_count($code, "A5") > 0 || substr_count($code, "A5R") > 0) {
$codebackground = "A5B";
$width = 215;
$height = 158;
}
else if(substr_count($code, "AGA6") > 0) {
$width = 110;
$height = 158;
}
}
else if($order_data["cover"] == "BP") {
$maxpages = 2;
if(substr_count($code, "A3PRO") > 0 || substr_count($code, "A3RPRO") > 0) {
$codebackground = "A3B";
$width = 921;
$height = 310;
}
else if(substr_count($code, "LUXPRO") > 0 || substr_count($code, "LUXRRPRO") > 0) {
$codebackground = "LUXB";
$width = 681;
$height = 310;
}
else if(substr_count($code, "A4PRO") > 0 || substr_count($code, "A4RPRO") > 0) {
$codebackground = "A4B";
$width = 664;
$height = 210;
}
else if(substr_count($code, "A3") > 0) {
$codebackground = "A3B";
$width = 887;
$height = 310;
}
else if(substr_count($code, "LUX2") > 0) {
$codebackground = "LUX2B";
$width = 467;
$height = 220;
}
else if(substr_count($code, "LUX") > 0) {
$codebackground = "LUXB";
$width = 647;
$height = 310;
}
else if(substr_count($code, "A4") > 0) {
$codebackground = "A4B";
$width = 647;
$height = 220;
}
else if(substr_count($code, "A5") > 0) {
$codebackground = "A5B";
$width = 475;
$height = 156;
}
}
else if($order_data["cover"] == "SP") {
$maxpages = 1;
$numberofspreads = intval($code);
if(substr_count($code, "B3") > 0) {
$width = 883;
$height = 288;
if($numberofspreads <= 16) $width = 879;
else if($numberofspreads <= 20) $width = 880.3;
else if($numberofspreads <= 25) $width = 882;
else if($numberofspreads <= 28) $width = 883;
else if($numberofspreads <= 31) $width = 883.9;
else if($numberofspreads <= 34) $width = 884.9;
else if($numberofspreads <= 37) $width = 885.9;
else if($numberofspreads <= 40) $width = 886.9;
else if($numberofspreads <= 43) $width = 887.9;
else if($numberofspreads <= 45) $width = 888.6;
else if($numberofspreads <= 48) $width = 889.6;
else if($numberofspreads > 48) $width = 890.3;
}
else if(substr_count($code, "B4P") > 0) {
$width = 460;
$height = 288;
if($numberofspreads <= 16) $width = 458.5;
else if($numberofspreads <= 20) $width = 459.8;
else if($numberofspreads <= 25) $width = 458.5;
else if($numberofspreads <= 28) $width = 459.8;
else if($numberofspreads <= 31) $width = 458.5;
else if($numberofspreads <= 34) $width = 459.8;
else if($numberofspreads <= 37) $width = 458.5;
else if($numberofspreads <= 40) $width = 466.4;
else if($numberofspreads <= 43) $width = 467.4;
else if($numberofspreads <= 45) $width = 468.1;
else if($numberofspreads <= 48) $width = 469.1;
else if($numberofspreads <= 51) $width = 469.8;
else if($numberofspreads <= 54) $width = 470.5;
else if($numberofspreads <= 57) $width = 471.2;
else if($numberofspreads > 57) $width = 471.9;
}
else if(substr_count($code, "B4") > 0) {
$width = 608;
$height = 206;
if($numberofspreads <= 16) $width = 598;
else if($numberofspreads <= 20) $width = 599.8;
else if($numberofspreads <= 22) $width = 600.4;
else if($numberofspreads <= 24) $width = 601.1;
else if($numberofspreads <= 27) $width = 602.1;
else if($numberofspreads <= 31) $width = 603.4;
else if($numberofspreads <= 34) $width = 604.4;
else if($numberofspreads <= 37) $width = 605.4;
else if($numberofspreads <= 40) $width = 606.7;
else if($numberofspreads <= 43) $width = 607.4;
else if($numberofspreads <= 46) $width = 608;
else if($numberofspreads <= 48) $width = 609.1;
else if($numberofspreads <= 51) $width = 609.8;
else if($numberofspreads <= 54) $width = 610.5;
else if($numberofspreads <= 57) $width = 611.2;
else if($numberofspreads > 57) $width = 611.9;
}
else if(substr_count($code, "LUX3") > 0) {
$width = 582;
$height = 288;
if($numberofspreads <= 16) $width = 578.5;
else if($numberofspreads <= 20) $width = 579.8;
else if($numberofspreads <= 25) $width = 581.5;
else if($numberofspreads <= 28) $width = 582.5;
else if($numberofspreads <= 31) $width = 583.4;
else if($numberofspreads <= 34) $width = 584.4;
else if($numberofspreads <= 37) $width = 585.4;
else if($numberofspreads <= 40) $width = 586.4;
else if($numberofspreads <= 43) $width = 587.4;
else if($numberofspreads <= 45) $width = 588.1;
else if($numberofspreads <= 48) $width = 589.1;
else if($numberofspreads <= 51) $width = 589.8;
else if($numberofspreads <= 54) $width = 590.5;
else if($numberofspreads <= 57) $width = 591.2;
else if($numberofspreads > 57) $width = 591.9;
}
else if(substr_count($code, "LUX4") > 0) {
$width = 388;
$height = 194;
if($numberofspreads <= 10) $width = 386.5;
else if($numberofspreads <= 14) $width = 388.5;
else if($numberofspreads <= 18) $width = 390.5;
}
else if(substr_count($code, "B5P") > 0) {
$width = 275;
$height = 201;
if($numberofspreads <= 10) $width = 268.5;
else if($numberofspreads <= 14) $width = 270.5;
else if($numberofspreads <= 18) $width = 279.5;
}
else if(substr_count($code, "LUX5") > 0) {
$width = 420;
$height = 206;
if($numberofspreads <= 16) $width = 414.4;
else if($numberofspreads <= 20) $width = 415.8;
else if($numberofspreads <= 22) $width = 416.4;
else if($numberofspreads <= 24) $width = 417.1;
else if($numberofspreads <= 27) $width = 418.1;
else if($numberofspreads <= 31) $width = 419.4;
else if($numberofspreads <= 34) $width = 420.4;
else if($numberofspreads <= 37) $width = 421.4;
else if($numberofspreads <= 40) $width = 422.4;
else if($numberofspreads <= 43) $width = 423.4;
else if($numberofspreads <= 46) $width = 424;
else if($numberofspreads <= 48) $width = 425.1;
else if($numberofspreads <= 51) $width = 425.8;
else if($numberofspreads <= 54) $width = 426.5;
else if($numberofspreads <= 57) $width = 427.2;
else if($numberofspreads > 57) $width = 427.9;
}
else if(substr_count($code, "B6") > 0) {
$width = 276.5;
$height = 107;
}
}
/*$width += 2;
$height += 2;*/
}
else {
$codebackground = $code;
// get max number of pages
if(is_numeric(substr($code,0,1))) {
$maxpages = intval($code)*2;
if($order_data["cover"] == "SP" && substr_count($code, "_2") > 0) $maxpages = intval($code);
if(substr_count($code, "A3") > 0) {
$width = 424;
$height = 301;
}
else if((substr_count($code, "A4P") > 0 || substr_count($code, "AGA4") > 0) && substr_count($code, "PRO") == 0) {
$width = 214;
$height = 301;
}
else if(substr_count($code, "A4") > 0) {
$width = 301;
$height = 214;
}
else if(substr_count($code, "A5P") > 0 || substr_count($code, "AGA5") > 0) {
$width = 152.5;
$height = 214;
}
else if(substr_count($code, "A5") > 0) {
$width = 214;
$height = 152.5;
}
else if(substr_count($code, "A7") > 0) {
$width = 108;
$height = 77;
}
else if(substr_count($code, "LUX4") > 0) {
$width = 381.5;
$height = 193.5;
}
else if(substr_count($code, "LUX5") > 0) {
$width = 381.5;
$height = 193.5;
}
else if(substr_count($code, "LUX3") > 0) {
$width = 546;
$height = 276;
}
else if(substr_count($code, "LUX2") > 0) {
$width = 214;
$height = 214;
}
else if(substr_count($code, "LUX") > 0) {
$width = 304;
$height = 304;
}
else if(substr_count($code, "B6") > 0) {
$width = 270;
$height = 106;
}
else if(substr_count($code, "B4P") > 0) {
$width = 426;
$height = 276;
}
else if(substr_count($code, "B5P") > 0) {
$width = 270;
$height = 201;
}
else if(substr_count($code, "B4") > 0) {
$width = 562;
$height = 192;
}
else if(substr_count($code, "B3") > 0) {
$width = 846;
$height = 276;
}
if(substr_count($code, "A7R") > 0 || substr_count($code, "A5R") > 0 || substr_count($code, "A5PR") > 0 || substr_count($code, "A4R") > 0 || (substr_count($code, "A4PR") > 0 && substr_count($code, "PRO") == 0) || substr_count($code, "A3R") > 0 || substr_count($code, "LUXR") > 0 || substr_count($code, "LUX2R") > 0) {
$maxpages = $maxpages / 2;
$recto = true;
}
//booklets have 4 pages per sheet + the cover
else if($order_data["cover"] == "N") {
$maxpages = ($maxpages+2) * 2;
}
//get the folder of the backgroundimages
if(substr_count($code, "A3") > 0) {
$codebackground = "A3B";
if(substr($order_data["cover"], 0, 1) == "B") $codebackground = "A3B";
else if(substr($order_data["cover"], 0, 1) == "W") $codebackground = "A3W";
}
else if(substr_count($code, "A4") > 0) {
$codebackground = "A4B";
if(substr($code,4,1) == "P" && substr_count($code, "PRO") == 0) $codebackground = "A4P";
else if(substr($order_data["cover"], 0, 1) == "B" || substr($order_data["cover"], 0, 1) == "P") $codebackground = "A4B";
else if(substr($order_data["cover"], 0, 1) == "W" || substr($order_data["cover"], 0, 1) == "H") $codebackground = "A4W";
}
else if(substr_count($code, "A5") > 0) {
$codebackground = "A5B";
if(substr($code,4,1) == "P") $codebackground = "A5P";
else if(substr($order_data["cover"], 0, 1) == "B" || substr($order_data["cover"], 0, 1) == "P") $codebackground = "A5B";
else if(substr($order_data["cover"], 0, 1) == "W" || substr($order_data["cover"], 0, 1) == "H") $codebackground = "A5W";
}
else if(substr_count($code, "LUX2") > 0) {
$codebackground = "LUX2";
}
else if(substr_count($code, "LUX") > 0 && substr_count($code, "LUX3") == 0 && substr_count($code, "LUX4") == 0 && substr_count($code, "LUX5") == 0) {
$codebackground = "LUX";
}
else if(substr_count($code, "B5P_2") > 0) {
$codebackground = "A3B";
}
else if(substr_count($code, "B5P") > 0) {
$codebackground = "A4P";
}
else {
$codebackground = (substr($code,2));
}
if(substr_count($code, "_2") == 0 && $order_data["cover"] == "SP") $width = $width/2;
}
if(substr($code,0,3)=="KAL") {
switch($code){
case "KAL":
$maxpages = 24;
$width = 214;
$height = 152.5;
break;
case "KALBUR":
$maxpages = 13;
$width = 214;
$height = 152.5;
$recto = true;
break;
case "KALP":
$maxpages = 13;
$width = 214;
$height = 301;
$recto = true;
break;
case "KALA3P":
$maxpages = 13;
$width = 301;
$height = 424;
$recto = true;
break;
default:
break;
}
}
if($code == "AGA6") {
$maxpages = 136;
$width = 109;
$height = 152.5;
}
else if($code == "AGA5") {
$maxpages = 136;
$width = 152.5;
$height = 214;
}
else if($code == "AGA5_") {
$maxpages = 136;
$width = 152.5;
$height = 214;
}
else if($code == "AGA4_") {
$maxpages = 136;
$width = 214;
$height = 301;
}
if(substr($code, 0, 3) == "CRD") {
$maxpages = 40;
if($code == "CRD1") {
$width = 214;
$height = 104;
}
else if($code == "CRD2") {
$width = 124;
$height = 124;
}
else if($code == "CRD3") {
$width = 94;
$height = 184;
}
else if($code == "CRD4" || $code == "CRD7") {
$width = 304;
$height = 104;
}
else if($code == "CRD5" || $code == "CRD8") {
$width = 424;
$height = 104;
}
else if($code == "CRD6" || $code == "CRD9") {
$width = 244;
$height = 124;
}
else if($code == "CRD10") {
$maxpages = 2;
$width = 424;
$height = 301;
}
else if($code == "CRD11") {
$width = 204;
$height = 154;
}
else if($code == "CRD12") {
$width = 89;
$height = 59;
}
else if($code == "CRD13") {
$width = 153.5;
$height = 104;
}
}
if($code == "POSTER" || $code == "PLACE"){
$maxpages = 1;
$width = 424;
$height = 301;
$recto = true;
}
else if($code == "POSTERP"){
$maxpages = 1;
$width = 301;
$height = 424;
$recto = true;
}
if(substr($code, 0, 2) == "PT" || substr($code, 0, 2) == "CV" || substr($code, 0, 2) == "DB" || substr($code, 0, 2) == "PX") {
$maxpages = 1;
$recto = true;
if(substr($code, 0, 2) == "CV") $overlap = 50;
else $overlap = 6;
switch(substr($code, 2)) {
case "100X100":
$width = 1000;
$height = 1000;
break;
case "100X50":
$width = 1000;
$height = 500;
break;
case "100X75":
$width = 1000;
$height = 750;
break;
case "120X40":
$width = 1200;
$height = 400;
break;
case "120X80":
$width = 1200;
$height = 800;
break;
case "120X90":
$width = 1200;
$height = 900;
break;
case "150X100":
$width = 1500;
$height = 1000;
break;
case "150X50":
$width = 1500;
$height = 500;
break;
case "150X75":
$width = 1500;
$height = 750;
break;
case "200X100":
$width = 2000;
$height = 1000;
break;
case "30X30":
$width = 300;
$height = 300;
break;
case "40X30":
$width = 400;
$height = 300;
break;
case "40X40":
$width = 400;
$height = 400;
break;
case "45X30":
$width = 450;
$height = 300;
break;
case "50X50":
$width = 500;
$height = 500;
break;
case "60X40":
$width = 600;
$height = 400;
break;
case "60X45":
$width = 600;
$height = 450;
break;
case "60X60":
$width = 600;
$height = 600;
break;
case "75X50":
$width = 750;
$height = 500;
break;
case "80X60":
$width = 800;
$height = 600;
break;
case "80X80":
$width = 800;
$height = 800;
break;
case "90X30":
$width = 900;
$height = 300;
break;
case "90X60":
$width = 900;
$height = 600;
break;
}
$width += $overlap;
$height += $overlap;
}
if(substr($code, 0, 2) == "MG" || substr($code, 0, 2) == "PL" || substr($code, 0, 2) == "BK") {
$maxpages = 1;
$recto = true;
$overlap = 0;
switch(substr($code, 2)) {
case "100X70":
$width = 1000;
$height = 700;
break;
case "150X100":
$width = 1500;
$height = 1000;
break;
case "200X150":
$width = 2000;
$height = 1500;
break;
case "30X30":
$width = 300;
$height = 300;
break;
case "40X40":
$width = 400;
$height = 400;
break;
case "60X60":
$width = 600;
$height = 600;
break;
case "8X9":
$width = 80;
$height = 90;
break;
case "12X9":
$width = 120;
$height = 90;
break;
case "20X9":
$width = 200;
$height = 90;
break;
case "7X7":
$width = 70;
$height = 70;
break;
case "12X7":
$width = 120;
$height = 70;
break;
case "18X7":
$width = 180;
$height = 70;
break;
}
}
}
//echo "maxpages=".$maxpages."";
//echo "size= $width X $height ";
}
$tpl->parse("htmlcode", "album_view_tp");
$tpl->p("htmlcode");
?>