function sfpg_javascript() { global $dirs, $images, $files, $misc, $file_ext_thumbs; echo "<script language=\"JavaScript\" TYPE=\"text/javascript\">\n\t\t<!--\n\n\t\tvar phpSelf = '" . $_SERVER["PHP_SELF"] . "';\n\n\t\tvar navLink = [];\n\t\tvar navName = [];\n\n\t\tvar dirLink = [];\n\t\tvar dirThumb = [];\n\t\tvar dirName = [];\n\t\tvar dirInfo = [];\n\n\t\tvar imgLink = [];\n\t\tvar imgName = [];\n\t\tvar imgInfo = [];\n\t\tvar imgSell = [];\n\n\t\tvar fileLink = [];\n\t\tvar fileThumb = [];\n\t\tvar fileName = [];\n\t\tvar fileInfo = [];\n\n\t\tvar imageSpace = 50;\n\t\tvar slideshowActive = false;\n\t\tvar slideshowSec = 0;\n\n\t\tvar waitSpin = ['•-----', '-•----', '--•---', '---•--', '----•-', '-----•'];\n\t\tvar waitSpinNr = 0;\n\t\tvar waitSpinSpeed = 100;\n\n\t\tvar showInfo = " . (TEXT_INFO ? isset($_GET["info"]) ? $_GET["info"] == '1' ? "true" : "false" : (SHOW_INFO_BY_DEFAULT ? "true" : "false") : "false") . ";\n\n\t\tvar actualSize = false;\n\t\tvar fullImgLoaded = false;\n\t\tvar imageLargerThanViewport = false;\n\t\tvar naviOk = true;\n\t\tvar index = false;\n\t\tvar preloadImg = new Image();\n\t\tvar preloaded = -1;\n\t\tvar preloadedFull = -1;\n\n\t\tvar viewportWidth;\n\t\tvar viewportHeight;\n\n\t\tvar imgFullWidth;\n\t\tvar imgFullHeight;\n\n\t\t"; if (KEYBOARD_NAVIGATION) { echo "\n\t\t\tfunction keyNavigate(key)\n\t\t\t{\n\t\t\t\tvar _Key = (window.event) ? event.keyCode : key.keyCode;\n\t\t\t\tswitch(_Key)\n\t\t\t\t{\n\t\t\t\t\tcase 33: // Page up\n\t\t\t\t\tcase 38: // Up arrow\n\t\t\t\t\tcase 37: // Left arrow\n\t\t\t\t\tcycleImg(-1); \n\t\t\t\t\tbreak;\n\t\t\t\t\tcase 32: // Space\n\t\t\t\t\tcase 34: // Page down\n\t\t\t\t\tcase 39: // Right arrow\n\t\t\t\t\tcase 40: // Down arrow\n\t\t\t\t\tcycleImg(1);\n\t\t\t\t\tbreak;\t\t\t\n\t\t\t\t\tcase 27: // ESC\n\t\t\t\t\tif(index)\n\t\t\t\t\t{\n\t\t\t\t\t\tcloseImageView();\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tif(navLink.length>2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdocument.location=phpSelf+'?sfpg='+navLink[navLink.length-3]+(showInfo?'&info=1':'');\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdocument.onkeyup = keyNavigate;\t"; } echo "\n\n\t\tfunction getViewport()\n\t\t{\n\t\t\tif (typeof window.innerWidth != 'undefined')\n\t\t\t{\n\t\t\t\tviewportWidth = window.innerWidth,\n\t\t\t\tviewportHeight = window.innerHeight\n\t\t\t}\n\t\t\telse if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)\n\t\t\t{\n\t\t\t\tviewportWidth = document.documentElement.clientWidth,\n\t\t\t\tviewportHeight = document.documentElement.clientHeight\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tviewportWidth = document.getElementsByTagName('body')[0].clientWidth,\n\t\t\t\tviewportHeight = document.getElementsByTagName('body')[0].clientHeight\n\t\t\t}\n\t\t\tif (showInfo)\n\t\t\t{\n\t\t\t\tviewportWidth -= (" . INFO_BOX_WIDTH . " + 12);\n\t\t\t}\n\t\t\tviewportHeight -= " . MENU_BOX_HEIGHT . ";\n\t\t\tif (viewportHeight < 0) viewportHeight = 20;\n\t\t}\n\n\n\t\tfunction initDisplay()\n\t\t{\n\t\t\tgetViewport();\n\t\t\tif (index)\n\t\t\t{\n\t\t\t\tresizeImage();\n\t\t\t}\n\t\t\tdocument.getElementById('box_image').style.width = viewportWidth;\n\t\t\tdocument.getElementById('box_image').style.height = viewportHeight;\n\t\t\tdocument.getElementById('box_wait').style.width = viewportWidth;\n\t\t\tdocument.getElementById('box_wait').style.height = viewportHeight;\n\t\t\tdocument.getElementById('box_gallery').style.width = viewportWidth;\n\t\t\tdocument.getElementById('box_gallery').style.height = viewportHeight;\n\t\t\tdocument.getElementById('box_info').style.height = viewportHeight-20;\n\t\t\tshowMenu();\n\t\t}\n\n\n\t\tfunction resizeImage()\n\t\t{\n\t\t\tvar availX, availY, aspectX, aspectY, newImgX, newImgY;\n\t\t\tavailX = viewportWidth - imageSpace;\n\t\t\tavailY = viewportHeight - imageSpace;\n\t\t\tif (availX < " . THUMB_MAX_WIDTH . ")\n\t\t\t{\n\t\t\t\tavailX = " . THUMB_MAX_WIDTH . ";\n\t\t\t}\n\t\t\tif (availY < " . THUMB_MAX_HEIGHT . ")\n\t\t\t{\n\t\t\t\tavailY = " . THUMB_MAX_HEIGHT . ";\n\t\t\t}\n\t\t\tif ((imgFullWidth > availX) || (imgFullHeight > availY))\n\t\t\t{\n\t\t\t\timageLargerThanViewport = true;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\timageLargerThanViewport = false;\n\t\t\t}\n\t\t\tif (!actualSize && ((imgFullWidth > availX) || (imgFullHeight > availY)))\n\t\t\t{\n\t\t\t\taspectX = imgFullWidth / availX;\n\t\t\t\taspectY = imgFullHeight / availY;\n\t\t\t\tif (aspectX > aspectY)\n\t\t\t\t{\n\t\t\t\t\tnewImgX = availX;\n\t\t\t\t\tnewImgY = Math.round(imgFullHeight / aspectX);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tnewImgX = Math.round(imgFullWidth / aspectY);\n\t\t\t\t\tnewImgY = availY;\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('img_resize').innerHTML = newImgX + ' x ' + newImgY;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tnewImgX = imgFullWidth;\n\t\t\t\tnewImgY = imgFullHeight;\n\t\t\t\tdocument.getElementById('img_resize').innerHTML = '" . sfpg_str_to_script(TEXT_NOT_SCALED) . "';\n\t\t\t}\n\t\t\tdocument.getElementById('img_size').innerHTML = imgFullWidth + ' x ' + imgFullHeight;\n\t\t\tdocument.getElementById('full').width = newImgX;\n\t\t\tdocument.getElementById('full').height = newImgY;\n\t\t}\n\n\n\t\tfunction fullSize()\n\t\t{\n\t\t\tif (actualSize == true)\n\t\t\t{\n\t\t\t\tactualSize = false;\n\t\t\t\tinitDisplay();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tactualSize = true;\n\t\t\t\tinitDisplay();\n\t\t\t}\n\t\t}\n\n\n\t\tfunction showMenu()\n\t\t{\n\t\t\tif ((imgLink.length>0)&&naviOk)\n\t\t\t{\n\t\t\t\tmenu = '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"cycleImg(-1)\">" . sfpg_str_to_script(TEXT_PREVIOUS) . "</span>';\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"cycleImg(1)\">" . sfpg_str_to_script(TEXT_NEXT) . "</span>';\n\t\t\t\t"; if (TEXT_SLIDESHOW) { echo "\n\t\t\t\t\tif (slideshowActive)\n\t\t\t\t\t{\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" class=\"sfpg_button_on\" onclick=\"slideshowActive=false; showMenu();\">" . sfpg_str_to_script(TEXT_SLIDESHOW) . "</span>';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"slideshowActive=true; showMenu(); slideshow(true);\">" . sfpg_str_to_script(TEXT_SLIDESHOW) . "</span>';\n\t\t\t\t\t}"; } echo "\n\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmenu = '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_PREVIOUS) . "</span>';\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_NEXT) . "</span>';\n\t\t\t\t" . (TEXT_SLIDESHOW ? "menu += '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_SLIDESHOW) . "</span>';" : "") . "\n\t\t\t}"; if (TEXT_INFO) { echo "\n\t\t\t\tif (showInfo)\n\t\t\t\t{\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" onclick=\"toggleInfo(showInfo);\" class=\"sfpg_button_on\">" . sfpg_str_to_script(TEXT_INFO) . "</span>';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" onclick=\"toggleInfo(showInfo);\" class=\"sfpg_button\">" . sfpg_str_to_script(TEXT_INFO) . "</span>';\n\t\t\t\t}"; } echo "\n\t\t\tif (index && imageLargerThanViewport)\n\t\t\t{\n\t\t\t\tif (actualSize)\n\t\t\t\t{\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" class=\"sfpg_button_on\" onclick=\"fullSize()\">" . sfpg_str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"fullSize()\">" . sfpg_str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\n\t\t\t}\n\n\n\t\t\t"; if (USE_PREVIEW) { echo "\n\t\t\t\tif (index)\n\t\t\t\t{\n\t\t\t\t\tif (fullImgLoaded)\n\t\t\t\t\t{\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" class=\"sfpg_button_on\" onclick=\"openImageView('+index+', false)\">" . sfpg_str_to_script(TEXT_FULLRES) . "</span>';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"openImageView('+index+', true)\">" . sfpg_str_to_script(TEXT_FULLRES) . "</span>';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_FULLRES) . "</span>';\n\t\t\t\t}\n\t\t\t\t"; } echo "\n\t\t\tif (index)\n\t\t\t{\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"closeImageView()\">" . sfpg_str_to_script(TEXT_CLOSE_IMG_VIEW) . "</span>';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_CLOSE_IMG_VIEW) . "</span>';\n\t\t\t}\n\t\t\t"; if (LINK_BACK) { echo "menu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"window.location=\\'" . LINK_BACK . "\\'\">" . sfpg_str_to_script(TEXT_LINK_BACK) . "</span>';\n\t\t\t\t"; } echo "menu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"window.location=\\'http://sye.dk/sfpg/\\'\">sfpg - sye.dk</span>';\n\t\t\tdocument.getElementById('div_menu').innerHTML = menu;\n\t\t}\n\n\n\t\tfunction openImageView(imgId, full)\n\t\t{\n\t\t\tif (!index)\n\t\t\t{\n\t\t\t\tdocument.getElementById('box_overlay').style.visibility='visible';\n\t\t\t\tsetOpacity('box_overlay', " . OVERLAY_OPACITY . ");\n\t\t\t}\n\t\t\tindex = imgId;\n\t\t\tfillInfo('img', index);\n\t\t\tsetOpacity('full', 0);\n\t\t\tdocument.getElementById('wait').style.visibility='visible';\n\t\t\tdocument.getElementById('box_wait').style.visibility='visible';\n\t\t\tdocument.getElementById('box_image').style.visibility='visible';\n\t\t\tpreloadImage(index, full);\n\t\t\tactualSize = false;\n\t\t\tfullImgLoaded = full;\n\t\t\tshowMenu();\n\t\t\tshowImage(0);\n\t\t}\n\n\n\t\tfunction preloadImage(imgId, full)\n\t\t{\n\t\t\tif ((preloaded != imgId) || (preloadedFull != full))\n\t\t\t{\n\t\t\t\tpreloadImg = new Image();\n\t\t\t\tif ((full == 1) || (" . (USE_PREVIEW ? "false" : "true") . "))\n\t\t\t\t{\n\t\t\t\t\tpreloadImg.src = '';\n\t\t\t\t\tpreloadImg.src = phpSelf+'?cmd=image&sfpg='+imgLink[imgId];\n\t\t\t\t\tpreloadedFull = 1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tpreloadImg.src = '';\n\t\t\t\t\tpreloadImg.src = phpSelf+'?cmd=preview&sfpg='+imgLink[imgId];\n\t\t\t\t\tpreloadedFull = 0;\n\t\t\t\t}\n\t\t\t\tpreloaded = imgId;\n\t\t\t}\n\t\t}\n\n\n\t\tfunction fillInfo(type, id)\n\t\t{\n\t\t\tif (!index || (type == 'img'))\n\t\t\t{\n\t\t\t\tvar info='<div class=\"thumbimgbox\">';\n\t\t\t\tif (type == 'dir')\n\t\t\t\t{\n\t\t\t\t\tif (dirThumb[id] != '')\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirThumb[id]+'\">';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<br><br>" . sfpg_str_to_script(TEXT_NO_IMAGES) . "';\n\t\t\t\t\t}\n\t\t\t\t\tinfo += '</div>';\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_DIR_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+dirName[id] + '</div><br>';\n\t\t\t\t\tvar splint = dirInfo[id].split('|');\n\t\t\t\t\t" . (DIR_DESC_IN_INFO ? "info += '<strong>" . sfpg_str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">'+splint[4]+'<br></div><br>';" : "") . "\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\n\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_DIRS) . ": '+splint[1]+'<br>';\n\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IMAGES) . ": '+splint[2]+'<br>';"; if (SHOW_FILES) { echo "\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_FILES) . ": '+splint[3]+'<br>';"; } echo "\n\t\t\t\t\tinfo += '</div><br>';\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_LINKS) . "</strong><br><a href=\"'+phpSelf+'?sfpg='+dirLink[id]+'\">" . sfpg_str_to_script(TEXT_DIRECT_LINK_GALLERY) . "</a><br><br>';\n\t\t\t\t}\n\t\t\t\telse if (type == 'img')\n\t\t\t\t{\n\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgLink[id]+'\">';\n\t\t\t\t\tinfo += '</div>';\n\t\t\t\t\tvar splint = imgInfo[id].split('|');\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_IMAGE_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+imgName[id] + '</div><br>';\n\t\t\t\t\t"; if (PAYPAL_ENABLED) { echo "\n\t\t\t\t\t\tif (typeof imgSell[id]!='undefined')\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar sellSplint = imgSell[id].split('|');\n\t\t\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_PAYPAL_FOR_SALE) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_PAYPAL_PRICE) . ": '+(((typeof sellSplint[0]!='undefined')&&(sellSplint[0]!=''))?sellSplint[0]:'" . sfpg_str_to_script(TEXT_PAYPAL_NO_PRICE) . "')+'<br>';\n\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_PAYPAL_IN_STOCK) . ": '+(((typeof sellSplint[1]!='undefined')&&(sellSplint[1]!=''))?sellSplint[1]:'" . sfpg_str_to_script(TEXT_PAYPAL_OUT_OF_STOCK) . "')+'<br>';\n\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_PAYPAL_ITEM_ID) . ": '+sellSplint[2]+'<br>';\n\t\t\t\t\t\t\tif ((typeof sellSplint[1]!='undefined')&&(sellSplint[1]>0)&&(typeof sellSplint[0]!='undefined')&&(sellSplint[0]!=''))\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '<br><span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" onclick=\"window.location=\\''+phpSelf+'?cmd=buy&sfpg='+imgLink[id]+'\\'\" class=\"sfpg_button\">" . sfpg_str_to_script(TEXT_PAYPAL_BUY) . "</span><br><br>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '<br><span class=\"sfpg_button_disabled\">" . sfpg_str_to_script(TEXT_PAYPAL_BUY) . "</span><br><br>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tinfo += '</div><br>';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t"; } echo "\n\t\t\t\t\tif (typeof splint[10] != 'undefined')\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\t\tinfo += splint[29]+'<br>';\n\t\t\t\t\t\tinfo += '</div><br>';\n\n\t\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IMAGESIZE) . ": '+splint[2]+' x '+splint[3]+'<br>';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_DISPLAYED_IMAGE) . ": <span id=\"img_size\"></span> (';\n\t\t\t\t\t\tif (fullImgLoaded || " . (USE_PREVIEW ? "false" : "true") . ")\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_THIS_IS_FULL) . "';\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_THIS_IS_PREVIEW) . "';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinfo += ')<br>';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_SCALED_TO) . ": <span id=\"img_resize\"></span><br>';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_FILESIZE) . ": '+splint[1]+'<br>';\n\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IMAGE_NUMBER) . ": '+id+' / '+(imgLink.length-1)+'<br>';\n\t\t\t\t\t\tinfo += '</div><br>';"; if (SHOW_EXIF_INFO) { echo "\n\t\t\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_EXIF) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\t\t\tif (splint[4] == 'sfpg_no_exif_data_in_file')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_MISSING) . "';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_DATE) . ": '+splint[4]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_CAMERA) . ": '+splint[5]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_ISO) . ": '+splint[6]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_SHUTTER) . ": '+splint[7]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_APERTURE) . ": '+splint[8]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_FOCAL) . ": '+splint[9]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_EXIF_FLASH) . ": '+splint[10]+'<br>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tinfo += '</div><br>';"; } if (SHOW_IPTC_INFO) { echo "\n\t\t\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_IPTC) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\t\t\tif (splint[11] == 'sfpg_no_iptc_data_in_file')\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_MISSING) . "';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_TITLE) . ": '+splint[11]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_URGENCY) . ": '+splint[12]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_CATEGORY) . ": '+splint[13]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_SUBCATEGORIES) . ": '+splint[14]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_SPECIALINSTRUCTIONS) . ": '+splint[15]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_CREATIONDATE) . ": '+splint[16]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_AUTHORBYLINE) . ": '+splint[17]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_AUTHORTITLE) . ": '+splint[18]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_CITY) . ": '+splint[19]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_STATE) . ": '+splint[20]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_COUNTRY) . ": '+splint[21]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_OTR) . ": '+splint[22]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_HEADLINE) . ": '+splint[23]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_SOURCE) . ": '+splint[24]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_PHOTOSOURCE) . ": '+splint[25]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_COPYRIGHT) . ": '+splint[26]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_CAPTION) . ": '+splint[27]+'<br>';\n\t\t\t\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_IPTC_CAPTIONWRITER) . ": '+splint[28]+'<br>';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tinfo += '</div><br>';"; } echo "\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<br><strong>" . sfpg_str_to_script(TEXT_FIRST_VIEW) . "</strong><br><br><span id=\"img_size\"></span><span id=\"img_resize\"></span><br><br>';\n\t\t\t\t\t}\n\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_LINKS) . "</strong><br>';\n\t\t\t\t\tinfo += '<a href=\"'+phpSelf+'?sfpg='+imgLink[id]+'\">" . sfpg_str_to_script(TEXT_DIRECT_LINK_IMAGE) . "</a><br>';\n\t\t\t\t\t" . (TEXT_DOWNLOAD ? "info += '<a href=\"'+phpSelf+'?cmd=dl&sfpg='+imgLink[id]+'\">" . sfpg_str_to_script(TEXT_DOWNLOAD) . "</a><br><br>';" : "") . "\n\t\t\t\t}\n\t\t\t\telse if (type == 'file')\n\t\t\t\t{\n\t\t\t\t\tif (fileThumb[id] != '')\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileThumb[id]+'\">';\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tinfo += '<br><br>" . sfpg_str_to_script(TEXT_NO_PREVIEW_FILE) . "<br>';\n\t\t\t\t\t}\n\t\t\t\t\tinfo += '</div>';\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_FILE_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+fileName[id]+'</div><br>';\n\t\t\t\t\tvar splint = fileInfo[id].split('|');\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">'+splint[2]+'<br></div><br>';\n\t\t\t\t\tinfo += '<strong>" . sfpg_str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\n\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\n\t\t\t\t\tinfo += '" . sfpg_str_to_script(TEXT_FILESIZE) . ": '+splint[1]+'<br>';\n\t\t\t\t\tinfo += '</div><br>';\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('box_inner_info').innerHTML = info;\n\t\t\t}\n\t\t}\n\n\n\t\tfunction toggleInfo(status)\n\t\t{\n\t\t\tif (status)\n\t\t\t{\n\t\t\t\tdocument.getElementById('box_info').style.visibility='hidden';\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tsetOpacity('box_info', 0);\n\t\t\t\tdocument.getElementById('box_info').style.visibility='visible';\n\t\t\t\tfadeOpacity('box_info', 0,\t100, " . FADE_DURATION_MS . ");\n\t\t\t}\n\t\t\tshowInfo = !status;\n\t\t\tinitDisplay();\n\t\t}\n\n\n\t\tfunction openGallery(id, type)\n\t\t{\n\t\t\twindow.location=phpSelf+'?sfpg='+((type=='nav')?navLink[id]:dirLink[id])+(showInfo?'&info=1':'');\n\t\t}\n\n\n\t\tfunction openFile(id)\n\t\t{\n\t\t\tif (" . (FILE_IN_NEW_WINDOW ? "true" : "false") . ")\n\t\t\t{\n\t\t\t\twindow.open(phpSelf+'?cmd=file&sfpg='+fileLink[id]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\twindow.location\t= phpSelf+'?cmd=file&sfpg='+fileLink[id];\n\t\t\t}\n\t\t}\n\n\n\t\tfunction nextImage(direction)\n\t\t{\n\t\t\tvar nextIndex;\n\t\t\tif (!index)\n\t\t\t{\n\t\t\t\tif (direction > 0)\n\t\t\t\t{\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn (imgLink.length - 1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar nextImg = index + direction;\n\t\t\tif (nextImg > imgLink.length - 1)\n\t\t\t{\n\t\t\t\tnextImg = 1;\n\t\t\t}\n\t\t\tif (nextImg < 1)\n\t\t\t{\n\t\t\t\tnextImg = imgLink.length - 1;\n\t\t\t}\n\t\t\treturn nextImg;\n\t\t}\n\n\n\t\tfunction cycleImg(direction)\n\t\t{\n\t\t\tif ((imgLink.length>0)&&naviOk)\n\t\t\t{\n\t\t\t\topenImageView(nextImage(direction), false);\n\t\t\t}\n\t\t}\n\n\n\t\tfunction showImage(stage)\n\t\t{\n\t\t\tif(stage==0)\n\t\t\t{\n\t\t\t\tdocument.getElementById('full').src = '';\n\t\t\t\tnaviOk=false;\n\t\t\t\tshowMenu();\n\t\t\t\tstage=1;\n\t\t\t}\n\t\t\tif(stage==1)\n\t\t\t{\n\t\t\t\tif (preloadImg.complete)\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('full').src = preloadImg.src;\n\t\t\t\t\tinitDisplay();\n\t\t\t\t\tstage=2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(stage==2)\n\t\t\t{\n\t\t\t\tif(document.getElementById('full').complete)\n\t\t\t\t{\n\t\t\t\t\tnaviOk=true;\n\t\t\t\t\timgFullWidth = preloadImg.width;\n\t\t\t\t\timgFullHeight = preloadImg.height;\n\t\t\t\t\tfillInfo('img', index);\n\t\t\t\t\tinitDisplay();\n\t\t\t\t\tpreloadImage(nextImage(1),0);\n\t\t\t\t\tdocument.getElementById('wait').style.visibility='hidden';\n\t\t\t\t\tfadeOpacity('full', 0, 100, " . FADE_DURATION_MS . ");\n\t\t\t\t\tstage=3;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (waitSpinNr >= waitSpin.length)\n\t\t\t{\n\t\t\t\twaitSpinNr = 0;\n\t\t\t}\n\t\t\tdocument.getElementById('wait').innerHTML = '<div class=\"loading\">" . sfpg_str_to_script(TEXT_IMAGE_LOADING) . "' + waitSpin[waitSpinNr] + '</div>';\n\t\t\twaitSpinNr++;\n\t\t\tif ((stage<3) && index)\n\t\t\t{\n\t\t\t\tsetTimeout ('showImage('+stage+')',waitSpinSpeed);\n\t\t\t}\n\t\t}\n\n\n\t\tfunction closeImageView()\n\t\t{\n\t\t\tslideshowActive = false;\n\t\t\tdocument.getElementById('box_wait').style.visibility='hidden';\n\t\t\tdocument.getElementById('wait').style.visibility='hidden';\n\t\t\tdocument.getElementById('box_image').style.visibility='hidden';\n\t\t\tindex = false;\n\t\t\tnaviOk=true;\n\t\t\tshowMenu();\n\t\t\tfadeOpacity('box_overlay', " . OVERLAY_OPACITY . ", 0, " . FADE_DURATION_MS . ");\n\t\t\tdocument.getElementById('full').width = 1;\n\t\t\tdocument.getElementById('full').height = 1;\n\t\t\tdocument.getElementById('full').src = '';\n\t\t\tfillInfo('dir', 0);\n\t\t}\n\n\n\t\tfunction setOpacity(id, opacity)\n\t\t{\n\t\t\tvar element = document.getElementById(id).style;\n\t\t\telement.opacity = (opacity / 100);\t// std\n\t\t\telement.MozOpacity = (opacity / 100);\t// firefox\n\t\t\telement.filter = 'alpha(opacity=' + opacity + ')';\t// IE\n\t\t\telement.KhtmlOpacity = (opacity / 100);\t// Mac\n\t\t}\n\n\n\t\tfunction fadeOpacity(id, opacityStart, opacityEnd, msToFade)\n\t\t{\n\t\t\tvar element = document.getElementById(id);\n\t\t\tvar currentTime = new Date().getTime();\n\t\t\telement.opacityStart = opacityStart;\n\t\t\telement.opacityEnd = opacityEnd;\n\t\t\telement.timeStart = currentTime;\n\t\t\telement.timeEnd = currentTime + msToFade;\n\t\t\tfadeLoop(id, currentTime);\n\t\t}\n\n\n\t\tfunction fadeLoop(id, timeStarted)\n\t\t{\n\t\t\tvar element = document.getElementById(id);\n\t\t\tif (timeStarted != element.timeStart)\n\t\t\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar currentTime = new Date().getTime();\n\t\t\tvar frac = (currentTime - element.timeStart) / (element.timeEnd - element.timeStart);\n\t\t\tif (frac >= 1)\n\t\t\t{\t\n\t\t\t\tsetOpacity(id, element.opacityEnd);\n\t\t\t\tif (element.opacityEnd == 0)\n\t\t\t\t{\n\t\t\t\t\telement.style.visibility='hidden';\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetOpacity(id, ((element.opacityEnd - element.opacityStart) * frac) + element.opacityStart);\n\t\t\tsetTimeout(\"fadeLoop('\" + id + \"', \" + timeStarted + \")\", 50);\n\t\t}\n\n\n\t\tfunction thumbDisplayName(name)\n\t\t{\n\t\t\tdispName = name.substring(0," . THUMB_CHARS_MAX . ");\n\t\t\tif (name.length > " . THUMB_CHARS_MAX . ")\n\t\t\t{\n\t\t\t\tdispName += '...';\n\t\t\t}\n\t\t\treturn dispName;\n\t\t}\n\n\n\t\tfunction addElement(elementNumber, type)\n\t\t{\n\t\t\tvar divClassName = 'thumbbox';\n\t\t\tvar content='';\n\t\t\tif (type == 'dir')\n\t\t\t{\n\t\t\t\tcontent = '<div onclick=\"openGallery('+elementNumber+')\" onmouseover=\"this.className=\\'innerboxdir_hover\\'; fillInfo(\\'dir\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboxdir\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboxdir\"><div class=\"thumbimgbox\">';\n\t\t\t\tif (dirThumb[elementNumber] != '')\n\t\t\t\t{\n\t\t\t\t\tcontent += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirThumb[elementNumber]+'\">';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcontent += '<br><br>" . sfpg_str_to_script(TEXT_NO_IMAGES) . "';\n\t\t\t\t}\n\t\t\t\tcontent += '</div>';\n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += '['+thumbDisplayName(dirName[elementNumber])+']';" : "") . "\n\t\t\t\tcontent += '</div>';\n\t\t\t}\n\t\t\telse if (type == 'img')\n\t\t\t{\n\t\t\t\tcontent = '<div onclick=\"openImageView('+elementNumber+', false)\" onmouseover=\"this.className=\\'innerboximg_hover\\'; fillInfo(\\'img\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboximg\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboximg\"><div class=\"thumbimgbox\"><img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgLink[elementNumber]+'\"></div>';\n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += thumbDisplayName(imgName[elementNumber]);" : "") . "\n\t\t\t\tcontent += '</div>';\n\t\t\t}\n\t\t\telse if (type == 'file')\n\t\t\t{\n\t\t\t\tcontent = '<div onclick=\"openFile('+elementNumber+')\" onmouseover=\"this.className=\\'innerboxfile_hover\\'; fillInfo(\\'file\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboxfile\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboxfile\"><div class=\"thumbimgbox\">';\n\t\t\t\tif (fileThumb[elementNumber] != '')\n\t\t\t\t{\n\t\t\t\t\tcontent += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileThumb[elementNumber]+'\">';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcontent += '<br><br>" . sfpg_str_to_script(TEXT_NO_PREVIEW_FILE) . "';\n\t\t\t\t}\n\t\t\t\tcontent += '</div>'; \n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += thumbDisplayName(fileName[elementNumber]);" : "") . "\n\t\t\t\tcontent += '</div>';\n\t\t\t}\n\t\t\telse if (" . (DIR_DESC_IN_GALLERY ? 'true' : 'false') . " && (type == 'desc'))\n\t\t\t{\n\t\t\t\tvar splint = dirInfo[elementNumber].split('|');\n\t\t\t\tif ((typeof splint[4] != 'undefined') && (splint[4] != ''))\n\t\t\t\t{\n\t\t\t\t\tdivClassName = 'descbox';\n\t\t\t\t\tcontent = '<div class=\"innerboxdesc\">';\n\t\t\t\t\tcontent += splint[4];\n\t\t\t\t\tcontent += '</div>';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (content != '')\n\t\t\t{\n\t\t\t\tvar newdiv = document.createElement('div');\n\t\t\t\tnewdiv.className = divClassName;\n\t\t\t\tnewdiv.innerHTML = content;\n\t\t\t\tvar boxC = document.getElementById('box_gallery');\n\t\t\t\tboxC.appendChild(newdiv);\n\t\t\t}\n\t\t}\n\n\n\t\tfunction showGallery(initOpenImage)\n\t\t{\n\t\t\tinitDisplay();\n\t\t\tif (initOpenImage)\n\t\t\t{\n\t\t\t\topenImageView(initOpenImage, false);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tfillInfo('dir', 0);\n\t\t\t}\n\n\t\t\tif (showInfo)\n\t\t\t{\n\t\t\t\ttoggleInfo(false);\n\t\t\t}\n\n\t\t\tvar navLinks = '';\n\t\t\tfor (i = 1; i < navLink.length; i++)\n\t\t\t{\n\t\t\t\tif (navLink[i] != '')\n\t\t\t\t{\n\t\t\t\t\tnavLinks += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_nav\\';\" class=\"sfpg_button_nav\" onclick=\"openGallery('+i+', \\'nav\\')\">'+navName[i]+'</span>';\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tnavLinks += navName[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tdocument.getElementById('navi').innerHTML = navLinks;\n\t\t\taddElement(0, 'desc');\n\t\t\tfor (i = 1; i < dirLink.length; i++)\n\t\t\t{\n\t\t\t\taddElement(i, 'dir');\n\t\t\t}\n\n\t\t\tfor (i = 1; i < imgLink.length; i++)\n\t\t\t{\n\t\t\t\taddElement(i, 'img');\n\t\t\t}\n\t\t\t\n\t\t\tfor (i = 1; i < fileLink.length; i++)\n\t\t\t{\n\t\t\t\taddElement(i, 'file');\n\t\t\t}\n\t\t}\n\n\n\t\tfunction slideshow(click)\n\t\t{\n\t\t\tif(slideshowActive)\n\t\t\t{\n\t\t\t\tif(click)\n\t\t\t\t{\n\t\t\t\t\topenImageView(nextImage(1),false);\n\t\t\t\t\tslideshowSec=0;\n\t\t\t\t}\n\t\t\t\tif(slideshowSec>=" . SLIDESHOW_DELAY_SEC . ")\n\t\t\t\t{\n\t\t\t\t\tif(preloadImg.complete)\n\t\t\t\t\t{\n\t\t\t\t\t\topenImageView(nextImage(1),false);\n\t\t\t\t\t\tslideshowSec=0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tslideshowSec++;\n\t\t\t\tsetTimeout('slideshow(false)',1000);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tslideshowSec=0;\n\t\t\t}\n\t\t}\n\n\t\t"; if (PAYPAL_ENABLED) { echo "\n\t\t\tfunction paypal(id, buyId)\n\t\t\t{\n\t\t\t\tvar sellSplint = imgSell[id].split('|');\n\t\t\t\tvar SelfUrl = 'http://" . $_SERVER["DOMAIN_NAME"] . $_SERVER["PHP_SELF"] . "';\n\t\t\t\tvar returnSold = SelfUrl+'?sold='+buyId;\n\t\t\t\tvar returnCancel = SelfUrl+'?sfpg=" . $_GET['sfpg'] . "';\n\t\t\t\tdocument.getElementById('paypalReturn').value = returnSold;\n\t\t\t\tdocument.getElementById('paypalCancelReturn').value = returnCancel;\n\t\t\t\tdocument.getElementById('paypalAmount').value = sellSplint[0];\n\t\t\t\tdocument.getElementById('paypalItemName').value = imgName[id];\n\t\t\t\tif((typeof sellSplint[2]!='undefined')&&(sellSplint[2]!=''))\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById('paypalItemNumber').value = sellSplint[2];\n\t\t\t\t}\n\t\t\t\tdocument.forms[\"_xclick\"].submit();\n\t\t\t}\n\t\t\t"; } echo "navLink[1] = '" . sfpg_url_string('') . "';\n"; echo "navName[1] = '" . sfpg_str_to_script(TEXT_HOME) . "';\n\n"; $links = explode("/", GALLERY); $gal_dirs = ""; if (GALLERY and is_array($links)) { for ($i = 0; $i < count($links); $i++) { if ($links[$i] !== '') { $gal_dirs .= $links[$i] . "/"; $display_name = in_array(DIR_NAME_FILE, $misc) ? @file(GALLERY_ROOT . $gal_dirs . DIR_NAME_FILE) : ""; if ($display_name) { $display_name = trim($display_name[0]); } else { $display_name = sfpg_display_name($links[$i], TRUE); } $a_names[] = $display_name; $a_links[] = $gal_dirs; } } $link_disp_lenght = strlen(TEXT_HOME) + 4; $start_link = count($a_names) - 1; for ($i = count($a_names) - 1; $i >= 0; $i--) { $link_disp_lenght += strlen($a_names[$i]) + 5; if ($link_disp_lenght < NAVI_CHARS_MAX) { $start_link = $i; } } $i = 2; for ($link_nr = $start_link; $link_nr < count($a_links); $link_nr++) { if ($start_link > 0 and $link_nr == $start_link) { echo "navLink[" . $i . "] = '';\n"; echo "navName[" . $i . "] = '" . sfpg_str_to_script(" ... ") . "';\n\n"; $i++; } else { echo "navLink[" . $i . "] = '';\n"; echo "navName[" . $i . "] = '" . sfpg_str_to_script(" > ") . "';\n\n"; $i++; } echo "navLink[" . $i . "] = '" . sfpg_url_string($a_links[$link_nr]) . "';\n"; echo "navName[" . $i . "] = '" . sfpg_str_to_script($a_names[$link_nr]) . "';\n\n"; $i++; } echo "dirLink[0] = '" . sfpg_url_string($a_links[count($a_links) - 1]) . "';\n"; echo "dirName[0] = '" . sfpg_str_to_script(count($a_links) == 0 ? TEXT_HOME : $a_names[count($a_links) - 1]) . "';\n"; } else { echo "dirLink[0] = '" . sfpg_url_string("") . "';\n"; echo "dirName[0] = '" . sfpg_str_to_script(TEXT_HOME) . "';\n"; } if (!file_exists(DATA_ROOT . "info/" . GALLERY . "_sfpg_dir")) { sfpg_set_dir_info(GALLERY); } $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . "_sfpg_dir")); if (count($dirs) != $filed[0] or count($images) != $filed[1] or count($files) != $filed[2]) { sfpg_set_dir_info(GALLERY); $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . "_sfpg_dir")); } echo "dirThumb[0] = '" . $filed[4] . "';\n"; echo "dirInfo[0] = '" . sfpg_str_to_script($filed[3] . "|" . $filed[0] . "|" . $filed[1] . "|" . $filed[2] . "|" . (in_array(DIR_DESC_FILE, $misc) ? @file_get_contents(GALLERY_ROOT . GALLERY . DIR_DESC_FILE) : "")) . "';\n\n"; $item = 1; foreach ($dirs as $val) { $display_name = @file(GALLERY_ROOT . GALLERY . $val . "/" . DIR_NAME_FILE); if ($display_name) { $display_name = trim($display_name[0]); } else { $display_name = sfpg_display_name($val, TRUE); } echo "dirName[" . $item . "] = '" . sfpg_str_to_script($display_name) . "';\n"; echo "dirLink[" . $item . "] = '" . sfpg_url_string(GALLERY . $val . "/") . "';\n"; if (!file_exists(DATA_ROOT . "info/" . GALLERY . $val . "/_sfpg_dir")) { sfpg_set_dir_info(GALLERY . $val . "/"); } $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . $val . "/_sfpg_dir")); echo "dirThumb[" . $item . "] = '" . $filed[4] . "';\n"; echo "dirInfo[" . $item . "] = '" . sfpg_str_to_script($filed[3] . "|" . $filed[0] . "|" . $filed[1] . "|" . $filed[2] . "|" . @file_get_contents(GALLERY_ROOT . GALLERY . $val . "/" . DIR_DESC_FILE)) . "';\n\n"; $item++; } $img_direct_link = FALSE; $showImage = true; $item = 1; foreach ($images as $val) { if (SHOW_MAX_IMAGES) { if ($item >= SHOW_MAX_IMAGES) { $showImage = false; } } if (SHOW_IMAGE_DAYS) { if (filemtime(GALLERY_ROOT . GALLERY . $val) < time() - SHOW_IMAGE_DAYS * 86400) { $showImage = false; } } if ($showImage) { if ($val == IMAGE) { $img_direct_link = $item; } echo "imgLink[" . $item . "] = '" . sfpg_url_string(GALLERY, $val) . "';\n"; $img_name = sfpg_display_name($val, SHOW_IMAGE_EXT); echo "imgName[" . $item . "] = '" . sfpg_str_to_script($img_name) . "';\n"; echo "imgInfo[" . $item . "] = '" . sfpg_str_to_script(@file_get_contents(DATA_ROOT . "info/" . GALLERY . $val) . "|" . (in_array($val . DESC_EXT, $misc) ? @file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT) : "")) . "';\n"; if (PAYPAL_ENABLED) { $sell = in_array($val . PAYPAL_EXTENSION, $misc) ? @file(GALLERY_ROOT . GALLERY . $val . PAYPAL_EXTENSION, FILE_IGNORE_NEW_LINES) : false; if ($sell != false) { echo "imgSell[" . $item . "] = '" . sfpg_str_to_script($sell[0]) . "|" . sfpg_str_to_script($sell[1]) . "|" . sfpg_str_to_script($sell[2]) . "';\n"; } } $item++; } } if ($img_direct_link) { define("IMAGE_ID_IN_URL", $img_direct_link); } else { define("IMAGE_ID_IN_URL", FALSE); } $item = 1; foreach ($files as $val) { $ext = sfpg_ext($val); echo "fileLink[" . $item . "] = '" . sfpg_url_string(GALLERY, $val) . "';\n"; if (FILE_THUMB_EXT and file_exists(GALLERY_ROOT . GALLERY . $val . FILE_THUMB_EXT)) { echo "fileThumb[" . $item . "] = '" . sfpg_url_string(GALLERY, $val . FILE_THUMB_EXT) . "';\n"; } elseif (isset($file_ext_thumbs[$ext])) { echo "fileThumb[" . $item . "] = '" . sfpg_url_string(ICONS_DIR, $file_ext_thumbs[$ext]) . "';\n"; } else { echo "fileThumb[" . $item . "] = '';\n"; } echo "fileName[" . $item . "] = '" . sfpg_str_to_script(sfpg_display_name($val, SHOW_FILE_EXT)) . "';\n"; if (!file_exists(DATA_ROOT . "info/" . GALLERY . $val)) { $fp = fopen(DATA_ROOT . "info/" . GALLERY . $val, "w"); fwrite($fp, date(DATE_FORMAT, filemtime(GALLERY_ROOT . GALLERY . $val)) . "|" . sfpg_file_size(filesize(GALLERY_ROOT . GALLERY . $val))); fclose($fp); } echo "fileInfo[" . $item . "] = '" . sfpg_str_to_script(@file_get_contents(DATA_ROOT . "info/" . GALLERY . $val) . "|" . (in_array($val . DESC_EXT, $misc) ? @file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT) : "")) . "';\n\n"; $item++; } echo "\n\t\t//-->\n\t\t</script>"; }
function sfpg_javascript() { global $dirs, $images, $files, $file_ext_thumbs; echo "<script language=\"JavaScript\" TYPE=\"text/javascript\">\r\n\t\t<!--\r\n\r\n\t\tvar phpSelf = '" . $_SERVER["PHP_SELF"] . "';\r\n\r\n\t\tvar navLink = [];\r\n\t\tvar navName = [];\r\n\r\n\t\tvar dirLink = [];\r\n\t\tvar dirThumb = [];\r\n\t\tvar dirName = [];\r\n\t\tvar dirInfo = [];\r\n\r\n\t\tvar imgLink = [];\r\n\t\tvar imgName = [];\r\n\t\tvar imgInfo = [];\r\n\r\n\t\tvar fileLink = [];\r\n\t\tvar fileThumb = [];\r\n\t\tvar fileName = [];\r\n\t\tvar fileInfo = [];\r\n\r\n\t\tvar imageSpace = 50;\r\n\r\n\t\tvar waitSpin = ['•-----', '-•----', '--•---', '---•--', '----•-', '-----•'];\r\n\t\tvar waitSpinNr = 0;\r\n\t\tvar waitSpinSpeed = 100;\r\n\r\n\t\tvar graceMaxRun = Math.ceil(" . LOAD_FADE_GRACE . " / waitSpinSpeed);\r\n\r\n\t\tvar showInfo = " . ((isset($_GET["info"]) and $_GET["info"] == '1') ? "true" : "false") . ";\r\n\t\tvar actualSize = false;\r\n\t\tvar fullImgLoaded = false;\r\n\t\tvar imageLargerThanViewport = false;\r\n\r\n\t\tvar index = false;\r\n\t\tvar preloadImg = new Image();\r\n\t\tvar preloaded = -1;\r\n\t\tvar preloadedFull = -1;\r\n\r\n\t\tvar viewportWidth;\r\n\t\tvar viewportHeight;\r\n\r\n\t\tvar imgFullWidth;\r\n\t\tvar imgFullHeight;\r\n\r\n\r\n\t\tfunction getViewport()\r\n\t\t{\r\n\t\t\tif (typeof window.innerWidth != 'undefined')\r\n\t\t\t{\r\n\t\t\t\tviewportWidth = window.innerWidth,\r\n\t\t\t\tviewportHeight = window.innerHeight\r\n\t\t\t}\r\n\t\t\telse if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)\r\n\t\t\t{\r\n\t\t\t\tviewportWidth = document.documentElement.clientWidth,\r\n\t\t\t\tviewportHeight = document.documentElement.clientHeight\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tviewportWidth = document.getElementsByTagName('body')[0].clientWidth,\r\n\t\t\t\tviewportHeight = document.getElementsByTagName('body')[0].clientHeight\r\n\t\t\t}\r\n\t\t\tif (showInfo)\r\n\t\t\t{\r\n\t\t\t\tviewportWidth -= (" . INFO_BOX_WIDTH . " + 12);\r\n\t\t\t}\r\n\t\t\tviewportHeight -= " . MENU_BOX_HEIGHT . ";\r\n\t\t\tif (viewportHeight < 0) viewportHeight = 20;\r\n\t\t}\r\n\r\n\r\n\t\tfunction initDisplay()\r\n\t\t{\r\n\t\t\tgetViewport();\r\n\t\t\tif (index)\r\n\t\t\t{\r\n\t\t\t\tresizeImage();\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('box_image').style.width = viewportWidth;\r\n\t\t\tdocument.getElementById('box_image').style.height = viewportHeight;\r\n\t\t\tdocument.getElementById('box_wait').style.width = viewportWidth;\r\n\t\t\tdocument.getElementById('box_wait').style.height = viewportHeight;\r\n\t\t\tdocument.getElementById('box_gallery').style.width = viewportWidth;\r\n\t\t\tdocument.getElementById('box_gallery').style.height = viewportHeight;\r\n\t\t\tdocument.getElementById('box_info').style.height = viewportHeight-20;\r\n\t\t\tshowMenu();\r\n\t\t}\r\n\r\n\r\n\t\tfunction resizeImage()\r\n\t\t{\r\n\t\t\tvar availX, availY, aspectX, aspectY, newImgX, newImgY;\r\n\t\t\tavailX = viewportWidth - imageSpace;\r\n\t\t\tavailY = viewportHeight - imageSpace;\r\n\t\t\tif (availX < " . THUMB_MAX_WIDTH . ")\r\n\t\t\t{\r\n\t\t\t\tavailX = " . THUMB_MAX_WIDTH . ";\r\n\t\t\t}\r\n\t\t\tif (availY < " . THUMB_MAX_HEIGHT . ")\r\n\t\t\t{\r\n\t\t\t\tavailY = " . THUMB_MAX_HEIGHT . ";\r\n\t\t\t}\r\n\t\t\tif ((imgFullWidth > availX) || (imgFullHeight > availY))\r\n\t\t\t{\r\n\t\t\t\timageLargerThanViewport = true;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\timageLargerThanViewport = false;\r\n\t\t\t}\r\n\t\t\tif (!actualSize && ((imgFullWidth > availX) || (imgFullHeight > availY)))\r\n\t\t\t{\r\n\t\t\t\taspectX = imgFullWidth / availX;\r\n\t\t\t\taspectY = imgFullHeight / availY;\r\n\t\t\t\tif (aspectX > aspectY)\r\n\t\t\t\t{\r\n\t\t\t\t\tnewImgX = availX;\r\n\t\t\t\t\tnewImgY = Math.round(imgFullHeight / aspectX);\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tnewImgX = Math.round(imgFullWidth / aspectY);\r\n\t\t\t\t\tnewImgY = availY;\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('img_resize').innerHTML = newImgX + ' x ' + newImgY;\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tnewImgX = imgFullWidth;\r\n\t\t\t\tnewImgY = imgFullHeight;\r\n\t\t\t\tdocument.getElementById('img_resize').innerHTML = '" . str_to_script(TEXT_NOT_SCALED) . "';\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('img_size').innerHTML = imgFullWidth + ' x ' + imgFullHeight;\r\n\t\t\tdocument.getElementById('full').width = newImgX;\r\n\t\t\tdocument.getElementById('full').height = newImgY;\r\n\t\t}\r\n\r\n\r\n\t\tfunction fullSize()\r\n\t\t{\r\n\t\t\tif (actualSize == true)\r\n\t\t\t{\r\n\t\t\t\tactualSize = false;\r\n\t\t\t\tinitDisplay();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tactualSize = true;\r\n\t\t\t\tinitDisplay();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction showMenu()\r\n\t\t{\r\n\t\t\tif (imgLink.length > 0)\r\n\t\t\t{\r\n\t\t\t\tmenu = '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"cycleImg(-1)\">" . str_to_script(TEXT_PREVIOUS) . "</span>';\r\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"cycleImg(1)\">" . str_to_script(TEXT_NEXT) . "</span>';\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmenu = '<span class=\"sfpg_button_disabled\">" . str_to_script(TEXT_PREVIOUS) . "</span>';\r\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . str_to_script(TEXT_NEXT) . "</span>';\r\n\t\t\t}\r\n\r\n\t\t\tif (showInfo)\r\n\t\t\t{\r\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" onclick=\"toggleInfo(showInfo);\" class=\"sfpg_button_on\">" . str_to_script(TEXT_INFO) . "</span>';\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" onclick=\"toggleInfo(showInfo);\" class=\"sfpg_button\">" . str_to_script(TEXT_INFO) . "</span>';\r\n\t\t\t}\r\n\r\n\t\t\tif (index && imageLargerThanViewport)\r\n\t\t\t{\r\n\t\t\t\tif (actualSize)\r\n\t\t\t\t{\r\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" class=\"sfpg_button_on\" onclick=\"fullSize()\">" . str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"fullSize()\">" . str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . str_to_script(TEXT_ACTUAL_SIZE) . "</span>';\r\n\t\t\t}\r\n\r\n\r\n\t\t\t"; if (USE_PREVIEW) { echo "\r\n\t\t\t\tif (index)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (fullImgLoaded)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_on\\';\" class=\"sfpg_button_on\" onclick=\"openImageView('+index+', false)\">" . str_to_script(TEXT_FULLRES) . "</span>';\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"openImageView('+index+', true)\">" . str_to_script(TEXT_FULLRES) . "</span>';\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . str_to_script(TEXT_FULLRES) . "</span>';\r\n\t\t\t\t}\r\n\t\t\t\t"; } echo "\r\n\t\t\tif (index)\r\n\t\t\t{\r\n\t\t\t\tmenu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"closeImageView()\">" . str_to_script(TEXT_CLOSE_IMG_VIEW) . "</span>';\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tmenu += '<span class=\"sfpg_button_disabled\">" . str_to_script(TEXT_CLOSE_IMG_VIEW) . "</span>';\r\n\t\t\t}\r\n\t\t\t"; if (LINK_BACK) { echo "menu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"window.location=\\'" . LINK_BACK . "\\'\">" . TEXT_LINK_BACK . "</span>';\r\n\t\t\t\t"; } echo "menu += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button\\';\" class=\"sfpg_button\" onclick=\"window.location=\\'http://sye.dk/sfpg/\\'\">sfpg - sye.dk</span>';\r\n\t\t\tdocument.getElementById('div_menu').innerHTML = menu;\r\n\t\t}\r\n\r\n\r\n\t\tfunction openImageView(imgId, full)\r\n\t\t{\r\n\t\t\tif (!index)\r\n\t\t\t{\r\n\t\t\t\tdocument.getElementById('box_overlay').style.visibility='visible';\r\n\t\t\t\tsetOpacity('box_overlay', " . OVERLAY_OPACITY . ");\r\n\t\t\t}\r\n\t\t\tindex = imgId;\r\n\t\t\tfillInfo('img', index);\r\n\t\t\tsetOpacity('full', 0);\r\n\t\t\tdocument.getElementById('wait').style.visibility='visible';\r\n\t\t\tdocument.getElementById('box_wait').style.visibility='visible';\r\n\t\t\tdocument.getElementById('box_image').style.visibility='visible';\r\n\t\t\tpreloadImage(index, full);\r\n\t\t\tactualSize = false;\r\n\t\t\tfullImgLoaded = full;\r\n\t\t\tshowMenu();\r\n\t\t\tshowImage(0);\r\n\t\t}\r\n\r\n\r\n\t\tfunction preloadImage(imgId, full)\r\n\t\t{\r\n\t\t\tif ((preloaded != imgId) || (preloadedFull != full))\r\n\t\t\t{\r\n\t\t\t\tpreloadImg = new Image();\r\n\t\t\t\tif ((full == 1) || (" . (USE_PREVIEW ? "false" : "true") . "))\r\n\t\t\t\t{\r\n\t\t\t\t\tpreloadImg.src = phpSelf+'?cmd=image&sfpg='+imgLink[imgId];\r\n\t\t\t\t\tpreloadedFull = 1;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tpreloadImg.src = phpSelf+'?cmd=preview&sfpg='+imgLink[imgId];\r\n\t\t\t\t\tpreloadedFull = 0;\r\n\t\t\t\t}\r\n\t\t\t\tpreloaded = imgId;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction fillInfo(type, id)\r\n\t\t{\r\n\t\t\tif (!index || (type == 'img'))\r\n\t\t\t{\r\n\t\t\t\tvar info='<div class=\"thumbimgbox\">';\r\n\t\t\t\tif (type == 'dir')\r\n\t\t\t\t{\r\n\t\t\t\t\tif (dirThumb[id] != '')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirThumb[id]+'\">';\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '<br><br>" . str_to_script(TEXT_NO_IMAGES) . "';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tinfo += '</div>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_DIR_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+dirName[id] + '</div><br>';\r\n\t\t\t\t\tvar splint = dirInfo[id].split('|');\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_DIRS) . ": '+splint[1]+'<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_IMAGES) . ": '+splint[2]+'<br>';"; if (SHOW_FILES) { echo "\r\n\t\t\t\t\t\tinfo += '" . str_to_script(TEXT_FILES) . ": '+splint[3]+'<br>';"; } echo "\r\n\t\t\t\t\tinfo += '</div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">'+splint[4]+'<br></div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_LINKS) . "</strong><br><a href=\"'+phpSelf+'?sfpg='+dirLink[id]+'\">" . str_to_script(TEXT_DIRECT_LINK_GALLERY) . "</a><br><br>';\r\n\t\t\t\t}\r\n\t\t\t\telse if (type == 'img')\r\n\t\t\t\t{\r\n\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgLink[id]+'\">';\r\n\t\t\t\t\tinfo += '</div>';\r\n\t\t\t\t\tvar splint = imgInfo[id].split('|');\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_IMAGE_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+imgName[id] + '</div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_IMAGESIZE) . ": '+splint[2]+' x '+splint[3]+'<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_DISPLAYED_IMAGE) . ": <span id=\"img_size\"></span> (';\r\n\t\t\t\t\tif (fullImgLoaded || " . (USE_PREVIEW ? "false" : "true") . ")\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '" . str_to_script(TEXT_THIS_IS_FULL) . "';\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '" . str_to_script(TEXT_THIS_IS_PREVIEW) . "';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tinfo += ')<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_SCALED_TO) . ": <span id=\"img_resize\"></span><br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_FILESIZE) . ": '+splint[1]+'<br>'+splint[4];\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_IMAGE_NUMBER) . ": '+id+' / '+(imgLink.length-1)+'<br>';\r\n\t\t\t\t\tinfo += '</div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">'+splint[5]+'<br></div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_LINKS) . "</strong><br>';\r\n\t\t\t\t\tinfo += '<a href=\"'+phpSelf+'?sfpg='+imgLink[id]+'\">" . str_to_script(TEXT_DIRECT_LINK_IMAGE) . "</a><br>';\r\n\t\t\t\t\t" . (TEXT_DOWNLOAD ? "info += '<a href=\"'+phpSelf+'?cmd=dl&sfpg='+imgLink[id]+'\">" . str_to_script(TEXT_DOWNLOAD) . "</a><br><br>';" : "") . "\r\n\t\t\t\t}\r\n\t\t\t\telse if (type == 'file')\r\n\t\t\t\t{\r\n\t\t\t\t\tif (fileThumb[id] != '')\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileThumb[id]+'\">';\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tinfo += '<br><br>" . str_to_script(TEXT_NO_PREVIEW_FILE) . "<br>';\r\n\t\t\t\t\t}\r\n\t\t\t\t\tinfo += '</div>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_FILE_NAME) . "</strong><br><div class=\"sfpg_info_text\">'+fileName[id]+'</div><br>';\r\n\t\t\t\t\tvar splint = fileInfo[id].split('|');\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_INFO) . "</strong><br><div class=\"sfpg_info_text\">';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_DATE) . ": '+splint[0]+'<br>';\r\n\t\t\t\t\tinfo += '" . str_to_script(TEXT_FILESIZE) . ": '+splint[1]+'<br>';\r\n\t\t\t\t\tinfo += '</div><br>';\r\n\t\t\t\t\tinfo += '<strong>" . str_to_script(TEXT_DESCRIPTION) . "</strong><br><div class=\"sfpg_info_text\">'+splint[2]+'<br></div><br>';\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('box_inner_info').innerHTML = info;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction toggleInfo(status)\r\n\t\t{\r\n\t\t\tif (status)\r\n\t\t\t{\r\n\t\t\t\tdocument.getElementById('box_info').style.visibility='hidden';\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tsetOpacity('box_info', 0);\r\n\t\t\t\tdocument.getElementById('box_info').style.visibility='visible';\r\n\t\t\t\tfadeOpacity('box_info', 0,\t100, " . FADE_DURATION_MS . ");\r\n\t\t\t}\r\n\t\t\tshowInfo = !status;\r\n\t\t\tinitDisplay();\r\n\t\t}\r\n\r\n\r\n\t\tfunction openGallery(id, type)\r\n\t\t{\r\n\t\t\tvar link;\r\n\t\t\tif (type == 'nav')\r\n\t\t\t{\r\n\t\t\t\tlink=navLink[id];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tlink=dirLink[id];\r\n\t\t\t}\r\n\r\n\t\t\tvar opt='';\r\n\t\t\tif (showInfo)\r\n\t\t\t{\r\n\t\t\t\topt = '&info=1';\r\n\t\t\t}\r\n\t\t\twindow.location\t= phpSelf+'?sfpg='+link+opt;\r\n\t\t}\r\n\r\n\r\n\t\tfunction openFile(id)\r\n\t\t{\r\n\t\t\tif (" . (FILE_IN_NEW_WINDOW ? "true" : "false") . ")\r\n\t\t\t{\r\n\t\t\t\twindow.open(phpSelf+'?cmd=file&sfpg='+fileLink[id]);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\twindow.location\t= phpSelf+'?cmd=file&sfpg='+fileLink[id];\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction nextImage(direction)\r\n\t\t{\r\n\t\t\tvar nextIndex;\r\n\t\t\tif (!index)\r\n\t\t\t{\r\n\t\t\t\tif (direction > 0)\r\n\t\t\t\t{\r\n\t\t\t\t\treturn 1;\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\treturn (imgLink.length - 1);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tvar nextImg = index + direction;\r\n\t\t\tif (nextImg > imgLink.length - 1)\r\n\t\t\t{\r\n\t\t\t\tnextImg = 1;\r\n\t\t\t}\r\n\t\t\tif (nextImg < 1)\r\n\t\t\t{\r\n\t\t\t\tnextImg = imgLink.length - 1;\r\n\t\t\t}\r\n\t\t\treturn nextImg;\r\n\t\t}\r\n\r\n\r\n\t\tfunction cycleImg(direction)\r\n\t\t{\r\n\t\t\topenImageView(nextImage(direction), false);\r\n\t\t}\r\n\r\n\r\n\t\tfunction showImage(graceRun)\r\n\t\t{\r\n\t\t\tif (graceRun < graceMaxRun)\r\n\t\t\t{\r\n\t\t\t\tif (preloadImg.complete || graceRun != 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tif (graceRun == 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tdocument.getElementById('full').src = preloadImg.src;\r\n\t\t\t\t\t\timgFullWidth = preloadImg.width;\r\n\t\t\t\t\t\timgFullHeight = preloadImg.height;\r\n\t\t\t\t\t\tfillInfo('img', index);\r\n\t\t\t\t\t\tinitDisplay();\r\n\t\t\t\t\t\tpreloadImage(nextImage(1),0);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgraceRun++;\r\n\t\t\t\t}\r\n\t\t\t\tif (waitSpinNr >= waitSpin.length)\r\n\t\t\t\t{\r\n\t\t\t\t\twaitSpinNr = 0;\r\n\t\t\t\t}\r\n\t\t\t\tdocument.getElementById('wait').innerHTML = '<div class=\"loading\">" . str_to_script(TEXT_IMAGE_LOADING) . "' + waitSpin[waitSpinNr] + '</div>';\r\n\t\t\t\twaitSpinNr++;\r\n\t\t\t\tif (index)\r\n\t\t\t\t{\r\n\t\t\t\t\tsetTimeout ('showImage(' + graceRun + ')', waitSpinSpeed);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tdocument.getElementById('wait').style.visibility='hidden';\r\n\t\t\t\tfadeOpacity('full', 0, 100, " . FADE_DURATION_MS . ");\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction closeImageView()\r\n\t\t{\r\n\t\t\tdocument.getElementById('box_wait').style.visibility='hidden';\r\n\t\t\tdocument.getElementById('wait').style.visibility='hidden';\r\n\t\t\tdocument.getElementById('box_image').style.visibility='hidden';\r\n\t\t\tindex = false;\r\n\t\t\tshowMenu();\r\n\t\t\tfadeOpacity('box_overlay', " . OVERLAY_OPACITY . ", 0, " . FADE_DURATION_MS . ");\r\n\t\t\tdocument.getElementById('full').width = 1;\r\n\t\t\tdocument.getElementById('full').height = 1;\r\n\t\t\tdocument.getElementById('full').src = '';\r\n\t\t\tfillInfo('dir', 0);\r\n\t\t}\r\n\r\n\r\n\t\tfunction setOpacity(id, opacity)\r\n\t\t{\r\n\t\t\tvar element = document.getElementById(id).style;\r\n\t\t\telement.opacity = (opacity / 100);\t// std\r\n\t\t\telement.MozOpacity = (opacity / 100);\t// firefox\r\n\t\t\telement.filter = 'alpha(opacity=' + opacity + ')';\t// IE\r\n\t\t\telement.KhtmlOpacity = (opacity / 100);\t// Mac\r\n\t\t}\r\n\r\n\r\n\t\tfunction fadeOpacity(id, opacityStart, opacityEnd, msToFade)\r\n\t\t{\r\n\t\t\tif (msToFade > 0)\r\n\t\t\t{\r\n\t\t\t\tvar frames = Math.round((msToFade / 1000) * " . FADE_FRAME_PER_SEC . ");\r\n\t\t\t\tvar msPerFrame = Math.round(msToFade / frames);\r\n\t\t\t\tvar opacityPerFrame = (opacityEnd - opacityStart) / frames;\r\n\t\t\t\tvar opacity = opacityStart;\r\n\t\t\t\tfor (frame = 1; frame <= frames; frame++)\r\n\t\t\t\t{\r\n\t\t\t\t\tsetTimeout('setOpacity(\\'' + id + '\\',' + opacity + ')',(frame * msPerFrame));\r\n\t\t\t\t\topacity += opacityPerFrame;\r\n\t\t\t\t}\r\n\t\t\t\tif (opacityEnd == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tsetTimeout('document.getElementById(\\'' + id + '\\').style.visibility=\\'hidden\\'',((frames+1) * msPerFrame));\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tsetTimeout('setOpacity(\\'' + id + '\\',' + opacityEnd + ')',((frames+1) * msPerFrame));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tsetOpacity(id, opacityEnd);\r\n\t\t\t\tif (opacityEnd == 0)\r\n\t\t\t\t{\r\n\t\t\t\t\tdocument.getElementById(id).style.visibility='hidden';\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\r\n\t\tfunction thumbDisplayName(name)\r\n\t\t{\r\n\t\t\tdispName = name.substring(0," . THUMB_CHARS_MAX . ");\r\n\t\t\tif (name.length > " . THUMB_CHARS_MAX . ")\r\n\t\t\t{\r\n\t\t\t\tdispName += '...';\r\n\t\t\t}\r\n\t\t\treturn dispName;\r\n\t\t}\r\n\r\n\r\n\t\tfunction addElement(elementNumber, type)\r\n\t\t{\r\n\t\t\tvar newdiv = document.createElement('div');\r\n\t\t\tnewdiv.className = 'thumbbox';\r\n\t\t\tif (type == 'dir')\r\n\t\t\t{\r\n\t\t\t\tcontent = '<div onclick=\"openGallery('+elementNumber+')\" onmouseover=\"this.className=\\'innerboxdir_hover\\'; fillInfo(\\'dir\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboxdir\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboxdir\"><div class=\"thumbimgbox\">';\r\n\t\t\t\tif (dirThumb[elementNumber] != '')\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+dirThumb[elementNumber]+'\">';\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent += '<br><br>" . str_to_script(TEXT_NO_IMAGES) . "';\r\n\t\t\t\t}\r\n\t\t\t\tcontent += '</div>';\r\n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += '['+thumbDisplayName(dirName[elementNumber])+']';" : "") . "\r\n\t\t\t\tcontent += '</div>';\r\n\t\t\t}\r\n\t\t\telse if (type == 'img')\r\n\t\t\t{\r\n\t\t\t\tcontent = '<div onclick=\"openImageView('+elementNumber+', false)\" onmouseover=\"this.className=\\'innerboximg_hover\\'; fillInfo(\\'img\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboximg\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboximg\"><div class=\"thumbimgbox\"><img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+imgLink[elementNumber]+'\"></div>';\r\n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += thumbDisplayName(imgName[elementNumber]);" : "") . "\r\n\t\t\t\tcontent += '</div>';\r\n\t\t\t}\r\n\t\t\telse if (type == 'file')\r\n\t\t\t{\r\n\t\t\t\tcontent = '<div onclick=\"openFile('+elementNumber+')\" onmouseover=\"this.className=\\'innerboxfile_hover\\'; fillInfo(\\'file\\', '+elementNumber+')\" onmouseout=\"this.className=\\'innerboxfile\\'; fillInfo(\\'dir\\', 0)\" class=\"innerboxfile\"><div class=\"thumbimgbox\">';\r\n\t\t\t\tif (fileThumb[elementNumber] != '')\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent += '<img class=\"thumb\" alt=\"\" src=\"'+phpSelf+'?cmd=thumb&sfpg='+fileThumb[elementNumber]+'\">';\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tcontent += '<br><br>" . str_to_script(TEXT_NO_PREVIEW_FILE) . "';\r\n\t\t\t\t}\r\n\t\t\t\tcontent += '</div>'; \r\n\t\t\t\t" . (THUMB_CHARS_MAX ? "content += thumbDisplayName(fileName[elementNumber]);" : "") . "\r\n\t\t\t\tcontent += '</div>';\r\n\t\t\t}\r\n\t\t\tnewdiv.innerHTML = content;\r\n\t\t\tvar boxC = document.getElementById('box_gallery');\r\n\t\t\tboxC.appendChild(newdiv);\r\n\t\t}\r\n\r\n\r\n\t\tfunction showGallery(initOpenImage)\r\n\t\t{\r\n\t\t\tinitDisplay();\r\n\t\t\tif (initOpenImage)\r\n\t\t\t{\r\n\t\t\t\topenImageView(initOpenImage, false);\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tfillInfo('dir', 0);\r\n\t\t\t}\r\n\r\n\t\t\tif (showInfo)\r\n\t\t\t{\r\n\t\t\t\ttoggleInfo(false);\r\n\t\t\t}\r\n\r\n\t\t\tvar navLinks = '';\r\n\t\t\tfor (i = 1; i < navLink.length; i++)\r\n\t\t\t{\r\n\t\t\t\tif (navLink[i] != '')\r\n\t\t\t\t{\r\n\t\t\t\t\tnavLinks += '<span onmouseover=\"this.className=\\'sfpg_button_hover\\';\" onmouseout=\"this.className=\\'sfpg_button_nav\\';\" class=\"sfpg_button_nav\" onclick=\"openGallery('+i+', \\'nav\\')\">'+navName[i]+'</span>';\r\n\t\t\t\t}\r\n\t\t\t\telse\r\n\t\t\t\t{\r\n\t\t\t\t\tnavLinks += navName[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('navi').innerHTML = navLinks;\r\n\r\n\t\t\tfor (i = 1; i < dirLink.length; i++)\r\n\t\t\t{\r\n\t\t\t\taddElement(i, 'dir');\r\n\t\t\t}\r\n\r\n\t\t\tfor (i = 1; i < imgLink.length; i++)\r\n\t\t\t{\r\n\t\t\t\taddElement(i, 'img');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor (i = 1; i < fileLink.length; i++)\r\n\t\t\t{\r\n\t\t\t\taddElement(i, 'file');\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t\n\n"; echo "navLink[1] = '" . sfpg_url_string('') . "';\n"; echo "navName[1] = '" . str_to_script(TEXT_HOME) . "';\n\n"; $links = explode("/", GALLERY); $gal_dirs = ""; if (GALLERY and is_array($links)) { for ($i = 0; $i < count($links); $i++) { if ($links[$i]) { $gal_dirs .= $links[$i] . "/"; $display_name = @file(GALLERY_ROOT . $gal_dirs . DIR_NAME_FILE); if ($display_name) { $display_name = trim($display_name[0]); } else { $display_name = sfpg_display_name($links[$i], TRUE); } $a_names[] = $display_name; $a_links[] = $gal_dirs; } } $link_disp_lenght = strlen(TEXT_HOME) + 4; $start_link = count($a_names) - 1; for ($i = count($a_names) - 1; $i >= 0; $i--) { $link_disp_lenght += strlen($a_names[$i]) + 5; if ($link_disp_lenght < NAVI_CHARS_MAX) { $start_link = $i; } } $i = 2; for ($link_nr = $start_link; $link_nr < count($a_links); $link_nr++) { if ($start_link > 0 and $link_nr == $start_link) { echo "navLink[" . $i . "] = '';\n"; echo "navName[" . $i . "] = '" . str_to_script(" ... ") . "';\n\n"; $i++; } else { echo "navLink[" . $i . "] = '';\n"; echo "navName[" . $i . "] = '" . str_to_script(" > ") . "';\n\n"; $i++; } echo "navLink[" . $i . "] = '" . sfpg_url_string($a_links[$link_nr]) . "';\n"; echo "navName[" . $i . "] = '" . str_to_script($a_names[$link_nr]) . "';\n\n"; $i++; } echo "dirLink[0] = '" . sfpg_url_string($a_links[count($a_links) - 1]) . "';\n"; echo "dirName[0] = '" . str_to_script(count($a_links) == 0 ? TEXT_HOME : $a_names[count($a_links) - 1]) . "';\n"; } else { echo "dirLink[0] = '" . sfpg_url_string("") . "';\n"; echo "dirName[0] = '" . str_to_script(TEXT_HOME) . "';\n"; } if (!file_exists(DATA_ROOT . "info/" . GALLERY . "_info.sfpg")) { sfpg_set_dir_info(GALLERY); } $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . "_info.sfpg")); if (count($dirs) != $filed[0] or count($images) != $filed[1] or count($files) != $filed[2]) { sfpg_set_dir_info(GALLERY); $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . "_info.sfpg")); } echo "dirThumb[0] = '" . $filed[4] . "';\n"; echo "dirInfo[0] = '" . str_to_script($filed[3] . "|" . $filed[0] . "|" . $filed[1] . "|" . $filed[2] . "|" . @file_get_contents(GALLERY_ROOT . GALLERY . DIR_DESC_FILE)) . "';\n\n"; $item = 1; foreach ($dirs as $val) { $display_name = @file(GALLERY_ROOT . GALLERY . $val . "/" . DIR_NAME_FILE); if ($display_name) { $display_name = trim($display_name[0]); } else { $display_name = sfpg_display_name($val, TRUE); } echo "dirName[" . $item . "] = '" . str_to_script($display_name) . "';\n"; echo "dirLink[" . $item . "] = '" . sfpg_url_string(GALLERY . $val . "/") . "';\n"; if (!file_exists(DATA_ROOT . "info/" . GALLERY . $val . "/_info.sfpg")) { sfpg_set_dir_info(GALLERY . $val . "/"); } $filed = explode("|", file_get_contents(DATA_ROOT . "info/" . GALLERY . $val . "/_info.sfpg")); echo "dirThumb[" . $item . "] = '" . $filed[4] . "';\n"; echo "dirInfo[" . $item . "] = '" . str_to_script($filed[3] . "|" . $filed[0] . "|" . $filed[1] . "|" . $filed[2] . "|" . @file_get_contents(GALLERY_ROOT . GALLERY . $val . "/" . DIR_DESC_FILE)) . "';\n\n"; $item++; } $img_direct_link = FALSE; $item = 1; foreach ($images as $val) { if ($val == IMAGE) { $img_direct_link = $item; } echo "imgLink[" . $item . "] = '" . sfpg_url_string(GALLERY, $val) . "';\n"; $img_name = sfpg_display_name($val, SHOW_IMAGE_EXT); echo "imgName[" . $item . "] = '" . str_to_script($img_name) . "';\n"; echo "imgInfo[" . $item . "] = '" . str_to_script(@file_get_contents(DATA_ROOT . "info/" . GALLERY . $val . ".sfpg") . "|" . @file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT)) . "';\n\n"; $item++; } if ($img_direct_link) { define("OPEN_IMAGE_ON_LOAD", $img_direct_link); } else { define("OPEN_IMAGE_ON_LOAD", FALSE); } $item = 1; foreach ($files as $val) { $ext = sfpg_ext($val); echo "fileLink[" . $item . "] = '" . sfpg_url_string(GALLERY, $val) . "';\n"; if (FILE_THUMB_EXT and file_exists(GALLERY_ROOT . GALLERY . $val . FILE_THUMB_EXT)) { echo "fileThumb[" . $item . "] = '" . sfpg_url_string(GALLERY, $val . FILE_THUMB_EXT) . "';\n"; } elseif (isset($file_ext_thumbs[$ext])) { echo "fileThumb[" . $item . "] = '" . sfpg_url_string("_sfpg_icons/", $file_ext_thumbs[$ext]) . "';\n"; } else { echo "fileThumb[" . $item . "] = '';\n"; } echo "fileName[" . $item . "] = '" . str_to_script(sfpg_display_name($val, SHOW_FILE_EXT)) . "';\n"; if (!file_exists(DATA_ROOT . "info/" . GALLERY . $val . ".sfpg")) { $fp = fopen(DATA_ROOT . "info/" . GALLERY . $val . ".sfpg", "w"); fwrite($fp, date(DATE_FORMAT, filemtime(GALLERY_ROOT . GALLERY . $val)) . "|" . sfpg_file_size(filesize(GALLERY_ROOT . GALLERY . $val))); fclose($fp); } echo "fileInfo[" . $item . "] = '" . str_to_script(@file_get_contents(DATA_ROOT . "info/" . GALLERY . $val . ".sfpg") . "|" . @file_get_contents(GALLERY_ROOT . GALLERY . $val . DESC_EXT)) . "';\n\n"; $item++; } echo "\r\n\t\t//-->\r\n\t\t</script>"; }