howie2293 Posted January 20, 2009 Share Posted January 20, 2009 Hey Having a problem regarding my coding and wondered if anyone can help. I have uploaded it and all the other parts of the coding works fine but this php keeps coming up with this error Parse error: syntax error, unexpected $end in /home/user/domain/htdocs/camcru/viewer.php on line 613 Here is the php coding <?php //$targetTimeStamp=$_GET['timeStamp']; //$targetPhotographer = $_GET['photographer']; require ('parse_albums.php'); require('get_categories.php'); require ('parse_users.php'); $targetImage = $_GET['pictureNumber']; $targetPhotographer = $_GET['photographer']; $targetAlbumTS = $_GET['AlbumID']; getUser(); function doublons2D($TabInit){ global $allPhotographers,$allAlbums; $allPhotographers = array(); $allAlbums = array(); $allTimeStamps = array(); foreach($TabInit as $tabElt){ //echo '(timeStamp:'.$tabElt[1].')'.'resultat:'.(array_search($tabElt[1],$allTimeStamps).'<br>'); if (!is_int( array_search($tabElt['timeStamp'],$allTimeStamps))){ $allAlbums[]= array($tabElt['timeStamp'],$tabElt['albumName'],$tabElt['summary']); $allTimeStamps[]=$tabElt['timeStamp']; } if (!is_int(array_search($tabElt['nickname'],$allPhotographers))){ $allPhotographers[]= $tabElt['nickname']; } getAllAlbums(); $javascriptUpdateVars = ''; $now = time(); $hour = floor($now/60/60); $day = floor($now/60/60/24); $hour = $hour-$day*24; if ($lastUpdated<($now-6*60*60) and ($hour>9)) { //$javascriptUpdateVars .= 'updateAlbums();'; } $albumIndex = 1; $javascriptAlbumDefinition = "document.albums = new Array(); document.allAlbums = new Array();document.photographers = new Array();"; $javascriptDisplaySpecificPhoto =""; foreach($albums as $album){ $javascriptAlbumDefinition .= 'document.albums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.allAlbums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.photographers['.$albumIndex++.'] = "'.$album['nickname']."\";"; if (isset($targetImage)&& isset($targetPhotographer) && isset($targetAlbumTS)){ if (($targetPhotographer==$album['nickname']||$targetPhotographer=='all')&&intval($targetAlbumTS)==$album['timeStamp']) $javascriptDisplaySpecificPhoto = "gotoPhoto('".$targetPhotographer."',".$targetAlbumTS.",".$targetImage.");\n"; rsort($albums); doublons2D($albums); $photographersIconsLink = array(); foreach($photographers as $photographer){ $photographersIconLink[] = array($photographer[0],$photographer[1]); } function getIdPhoto ($photographer){ global $photographersIconLink; foreach ($photographersIconLink as $singleLink){ //echo'debug:'.$photographer.' '.$singleLink[0]; if($singleLink[0]==$photographer){ //echo "debug:".$singleLink[1]; return $singleLink[1]; } } } $phpGeneratedText = '<div class="Albums" id="Albums">Albums available:'; //$allAlbums[]=array(); $albumToCategory = array(); $javascriptDefinition = "document.categoryLink=new Array();\ndocument.categories = new Array();"; $cat2AlbumIndex = 0; $categoriesIndex=0; //for each different category, we display the link to display it foreach($categories as $category){ $numberOfGalleries = 0; $javascriptDefinition.="document.categories[".$categoriesIndex++."]=\"".$category."\";";//to give the javascript the categories $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\''.$category.'\')">'.$category.'</a>'.'<div class = "category" id="'.$category.'">'; // title of the current category foreach($allAlbums as $album){ if(ereg(strtolower(' '.$category),strtolower($album[1]))){//because without ' ' ball would be found in football $numberOfGalleries++; // increase the number of galleries in this category if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).': '.$album[2].'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $album[2]=false; // we mark the gallery as having been written, not to write it again in the 'others' tab $albumToCategory[] = array($category,$album[0]); $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('".$category."',".$album[0].");\n"; //save the link between a gallery TimeStamp and the associates category } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>'; //if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div></div>'; } $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\'others\')">Others</a>'.'<div class = "category" id="others">'; // if there is no category corresponding to the gallery $numberOfGalleries = 0; foreach($allAlbums as $album){ $found = false; foreach ($albumToCategory as $link){ if ($link[1]==$album[0]){ $found = true; break; } } if (!$found){ $numberOfGalleries++; $albumToCategory[] = array('all',$album[0]); if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.$album[2].': '.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('others',".$album[0].");\n"; } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>';//if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div>';// end of the others session, layout only $phpGeneratedText .= '</div>';// end of the others session, title $phpGeneratedText .= '</div>';//end of the galleries available $phpGeneratedText .= '<div class="Photographers" id="photographers">Who was your photographer?</br></br><div class="Photographer" id="all"><a href="javascript:;" onclick="updatePH(\'all\')">all</a></div></br>';// display an all photographers button foreach($allPhotographers as $photographer){ $photolink = getIdPhoto($photographer); //echo 'debug2:'.$photolink; $phpGeneratedText .= '<div class="Photographer" ><a href="javascript:;" onclick="updatePH(\''.$photographer.'\')"><div><img id="'.$photographer.'" src="photos/'.$photolink.'" alt = "'.$photographer.'" class = "displayPicture"/></div></br>'.$photographer.'</a></div></br>';// for each photographer, display name } $phpGeneratedText .= '</div>';// end of the photographers selection tab ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>UPS:CRU, [original Student Media Since 2007] | UPS:CRU, Your photos!</title> </head> <!--<link rel="stylesheet" type="text/css" href="allBrowsers.css"/>--> <style type="text/css">@import url(allBrowsers.css) all;</style> <!--[if IE]><style type="text/css">@import url(IE.css);</style><![endif]--> <script type="text/javascript" src="swfobject.js"></script> <script language="javascript" type="text/javascript"> function defineVariables(){ <?php echo $javascriptDefinition; echo $javascriptAlbumDefinition; ?> } function updateAlbums(){ document.getElementById('refreshAlbums').style.display='inline'; setTimeout(loadUpdatingPage,500); } function loadUpdatingPage(){ //alert("toto"); var xhr_object = null; if(window.XMLHttpRequest) // Firefox xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) // Internet Explorer xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); xhr_object.open("GET", './update.php', true); xhr_object.send(null); if(xhr_object.readyState == 4) window.location.reload(); } function getAssociatedCategory (timeStamp){ for (i=0;i<document.categoryLink.length;i++){ if (document.categoryLink[i][1]==timeStamp) return document.categoryLink[i][0]; } } function getNewestAlbum(){ value = 0; for (i=0;i<document.albums.length;i++){ if(document.albums[i][0]>value) value = document.albums[i][0]; } return value; } function simplifiedVersion(){ document.getElementById('flashcontent').style.height='500'; document.getElementById('flashcontent').style.zIndex='5'; document.getElementById('flashcontent').style.top='10%'; document.getElementById('flashcontent').style.left='0'; document.getElementById('flashcontent').style.width='100%'; document.getElementById('latestAlbum').style.display ='inline'; document.getElementById('bottom').style.fontSize="6pt"; document.getElementById('PhotoCount').style.fontSize="10pt"; document.getElementById('PhotoCount').style.top="10"; document.getElementById('PhotoCount').style.left="0%"; document.getElementById('links').style.fontSize="9pt"; document.getElementById('links').style.top="23px"; document.getElementById('links').style.zIndex="6"; document.getElementById('links').style.display="inline"; document.photographer ='all'; albumId = getNewestAlbum(); updateTS(albumId); } function fullVersion(){ document.getElementById('links').style.display ='inline'; document.getElementById('Albums').style.display ='inline'; document.getElementById('photographers').style.display ='inline'; document.getElementById('share').style.display ='inline'; } var loading = function(){ document.lastUpdated; document.photographer = 'all'; document.avoidWrite = false; defineVariables(); document.firstClick = true; document.albums.sort(); document.albums = doublons2D(document.albums); document.photographers = doublons(document.photographers); document.photographers.sort(); document.album = getNewestAlbum(); document.firstClick = true; document.thumbLoaded = 0; document.imgLoaded = 0; document.pictsNumb = 0; document.actualImage = 0; document.actualLink =""; document.targetPhotoNumber = -1; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL; //alert(window.parent==window); <?php echo $javascriptUpdateVars; echo $javascriptDisplaySpecificPhoto; ?> if (window.parent == window) fullVersion(); else simplifiedVersion(); } function resetCategoriesDisplay(){ document.getElementById('others').style.display ='none'; for (i=0;i<document.categories.length;i++){ document.getElementById(document.categories[i]).style.display ='none'; } } function displayCategory(category){ resetCategoriesDisplay(); document.getElementById(category).style.display ='inline'; } function resetSelection(){ unselectText('all'); unselectImage('all'); for (i=0;i<document.albums.length;i++){ unselectText(document.albums[i][0]); unselectImage(document.albums[i][0]); } for (i=0;i<document.photographers.length;i++){ unselectText(document.photographers[i]); unselectImage(document.photographers[i]); } } function getGoodAlbum (){ if(document.album=='' || document.photographer=='all') { return true; } for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer && document.allAlbums[i][0]==document.album){ document.albumDesc = document.allAlbums[i][1]; return true; } } return false; } function firstAlbumPhotographer(){ for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer) return document.allAlbums[i][0]; } } function selectText (id){ document.getElementById(id).style. backgroundColor="#0000FF"; } function selectImage(id){ document.getElementById(id).style.borderColor='#0000FF'; document.getElementById(id).style.borderWidth='thick'; document.getElementById(id).style.width='100%'; //document.getElementById(id).style.left='-5'; } function unselectText (id){ document.getElementById(id).style. backgroundColor=""; } function unselectImage(id){ document.getElementById(id).style.borderColor=''; document.getElementById(id).style.borderWidth=''; document.getElementById(id).style.width=''; document.getElementById(id).style.left=''; } function updateSelection(){ if (document.photographer=='all') selectText(document.photographer); else selectImage(document.photographer); selectText(document.album); category = getAssociatedCategory(document.album); displayCategory(category); } function updateFlash(){ url = 'get_all_album.php?id='+document.album+document.photographer; if (window.parent != window) url= url +'-true'; //alert(url); document.fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7",""); document.fo.addParam("wmode", "transparent"); document.fo.addParam("quality", "best"); document.fo.addVariable("preloaderColor", "0xffffff"); document.fo.addVariable("xmlDataPath", url); if (document.targetPhotoNumber!= -1) document.fo.addVariable("firstPicture", document.targetPhotoNumber); document.fo.write("flashcontent"); } function addZeros ( number){ if (number<10) return '00'+number; if (number<100) return '0'+number; return number; } function numberOfPictures(param){ document.pictsNumb = parseInt(param); document.getElementById('NumberOfPhotos').innerHTML=addZeros(document.pictsNumb); //document.getElementById('PhotoCount').style.display='inline'; } function loadNextThumbIndex(param){ document.thumbLoaded++; } function loadNextImageIndex(param){ document.imgLoaded++; } function showImageIndex(param){ //alert(param); document.actualImage = parseInt(param)+1; //alert(document.getElementById('actualPhoto').value); document.getElementById('actualPhoto').innerHTML=addZeros(document.actualImage); document.getElementById('PhotoCount').style.display='inline'; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL+"?photographer="+document.photographer+"&AlbumID="+document.album+"&pictureNumber="+document.actualImage; } function copyURL(){ window.clipboardData.setData("text",document.getElementById ('PageLink').value); } function showImageURL(param){ //alert(param); document.actualLink = param; } function getFlashMovieObject(movieName) { if (window.document[movieName]) { return window.document[movieName]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; } else { return document.getElementById(movieName); } } function displayVariables(){ //flashViewer = getFlashMovieObject("viewer"); //flashVariables = flashViewer.GetVariable("sm\title"); //alert(flashVariables); //for(key in flashVariables){alert((key+"="+flashVariables[key]))}; } function updatePH(ph){ window.status = "Updating your galleries..."; //if((ph!=document.photographer))|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.photographer=ph; if(getGoodAlbum()==true||ph=='all'){ updateSelection(); updateFlash(); } else updateTS(firstAlbumPhotographer()); window.status = ""; //} //else window.status = "You are already viewing photos from this photographer!"; } function updateTS(ts){ window.status = "Updating your galleries..."; //if((ts!=document.album)|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.album=ts; if (getGoodAlbum()==true){ updateSelection(); updateFlash(); window.status = ""; } else updatePH('all'); //} //else window.status = "You are already viewing photos of this event!"; } function gotoPhoto (photographer, albumTS, photonumber){ //document.fo.addVariable("firstPicture", photonumber); document.targetPhotoNumber = photonumber; updatePH(photographer); updateTS(albumTS); document.targetPhotoNumber = -1; } function displayPicture (){ monFlash = getFlashMovieObject('viewer'); //alert(monFlash); //monFlash.gotoThumb(document.targetPhotoNumber); //gotoImage(); } function doublons2D(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x][0]== TabInit[i][0] && x!=i) TabInit[i][0]='faux'; } if(TabInit[x][0]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function changeURLDisplayStatus(){ if (!document.URLDisplayed){ document.URLDisplayed = 1; element = document.getElementById("PageLink"); element.style.display = "inline"; element = document.getElementById("URLLink"); element.innerHTML = "Hide the link"; if(window.clipboardData){ element = document.getElementById("copyURL"); element.style.display = "inline"; } } else{ document.URLDisplayed = 0; element = document.getElementById("PageLink"); element.style.display = "none"; element = document.getElementById("URLLink"); element.innerHTML = "Show me the direct link to this photo"; element = document.getElementById("copyURL"); element.style.display = "none"; } } function doublons(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x]== TabInit[i] && x!=i) TabInit[i]='faux'; } if(TabInit[x]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function share (site){ //myLink = escape(window.location.href); myLink = escape("http://www.upsu.com/camcru"); newwindow=window.open("http://www.facebook.com/sharer.php?u="+myLink,'title','height=400,width=650,scrollbars=yes,'); if (window.focus) {newwindow.focus()} } </script> </head> <body onload="loading()"> <div class="links" id="links">Back to: <div class="link"><a href="http://www.upsu.com/">UPSU</a></div> <div class="link"><a href="http://www.upscru.co.uk/">ups:cru</a></div> <div class="link"><a href="javascript:history.go(-1);">cam:cru</a></div> </div> <?php echo $phpGeneratedText; ?> <div id="flashcontent"> <div class ='logo'> <img width="100%" src="camcru.png"></br> <div class="underLogo" id="underLogo">Please select the album you want to see. <div class="comment"></br>© Thibault JAMET 2008 - For any question or suggestion, please contact us </div> </div> </div> </div> <div class="bottom" id="bottom"> Last updated :<?php if (is_string($lastUpdated)) echo $lastUpdated; else echo date("D d M Y H:i",$lastUpdated); ?></br> © 2008 THJ Realisations for ups:cru, with help from Benoît QUENTIN. Scripts adapted from Ben Hughes, viewer from <a href ="http://www.airtightinteractive.com/simpleviewer/" style="color:#999999">AIRTIGHT Interactive</a>. </div> <div style="display" class="share" id="share"> <div><a href="javascript:;" onclick="share('facebook')"><img src="facebook.gif" alt='' border="0"/> Share me on facebook</a></div></br> <div><a href="javascript:changeURLDisplayStatus();" id="URLLink">Show me the direct link to this photo</a></div> <input type="text" name="PageLink" id="PageLink" value="toto" style="display:none" size="20" /> <div style="display:none"><a href="javascript:copyURL();" id="copyURL">Copy URL to Clipboard</a></div> </div> <div id="refreshAlbums" style="display:none"> <img id="refreshImage" src='updating.png' alt=""/> </div> <div id="PhotoCount" style="display:none" class="PhotoCount" > Picture # <span style="position:relative; text-align:right; width:50" id="actualPhoto">000</span> / <span style="text-align:left; position:relative width:50" id="NumberOfPhotos">000</span> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/141582-syntax-error-unexpected-end/ Share on other sites More sharing options...
gevans Posted January 20, 2009 Share Posted January 20, 2009 try this <?php //$targetTimeStamp=$_GET['timeStamp']; //$targetPhotographer = $_GET['photographer']; require ('parse_albums.php'); require('get_categories.php'); require ('parse_users.php'); $targetImage = $_GET['pictureNumber']; $targetPhotographer = $_GET['photographer']; $targetAlbumTS = $_GET['AlbumID']; getUser(); function doublons2D($TabInit){ global $allPhotographers,$allAlbums; $allPhotographers = array(); $allAlbums = array(); $allTimeStamps = array(); foreach($TabInit as $tabElt){ //echo '(timeStamp:'.$tabElt[1].')'.'resultat:'.(array_search($tabElt[1],$allTimeStamps).'<br>'); if (!is_int( array_search($tabElt['timeStamp'],$allTimeStamps))){ $allAlbums[]= array($tabElt['timeStamp'],$tabElt['albumName'],$tabElt['summary']); $allTimeStamps[]=$tabElt['timeStamp']; } if (!is_int(array_search($tabElt['nickname'],$allPhotographers))){ $allPhotographers[]= $tabElt['nickname']; } } } getAllAlbums(); $javascriptUpdateVars = ''; $now = time(); $hour = floor($now/60/60); $day = floor($now/60/60/24); $hour = $hour-$day*24; if ($lastUpdated<($now-6*60*60) and ($hour>9)) { //$javascriptUpdateVars .= 'updateAlbums();'; } $albumIndex = 1; $javascriptAlbumDefinition = "document.albums = new Array(); document.allAlbums = new Array();document.photographers = new Array();"; $javascriptDisplaySpecificPhoto =""; foreach($albums as $album){ $javascriptAlbumDefinition .= 'document.albums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.allAlbums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.photographers['.$albumIndex++.'] = "'.$album['nickname']."\";"; if (isset($targetImage)&& isset($targetPhotographer) && isset($targetAlbumTS)){ if (($targetPhotographer==$album['nickname']||$targetPhotographer=='all')&&intval($targetAlbumTS)==$album['timeStamp']) $javascriptDisplaySpecificPhoto = "gotoPhoto('".$targetPhotographer."',".$targetAlbumTS.",".$targetImage.");\n"; rsort($albums); doublons2D($albums); $photographersIconsLink = array(); foreach($photographers as $photographer){ $photographersIconLink[] = array($photographer[0],$photographer[1]); } function getIdPhoto ($photographer){ global $photographersIconLink; foreach ($photographersIconLink as $singleLink){ //echo'debug:'.$photographer.' '.$singleLink[0]; if($singleLink[0]==$photographer){ //echo "debug:".$singleLink[1]; return $singleLink[1]; } } } $phpGeneratedText = '<div class="Albums" id="Albums">Albums available:'; //$allAlbums[]=array(); $albumToCategory = array(); $javascriptDefinition = "document.categoryLink=new Array();\ndocument.categories = new Array();"; $cat2AlbumIndex = 0; $categoriesIndex=0; //for each different category, we display the link to display it foreach($categories as $category){ $numberOfGalleries = 0; $javascriptDefinition.="document.categories[".$categoriesIndex++."]=\"".$category."\";";//to give the javascript the categories $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\''.$category.'\')">'.$category.'</a>'.'<div class = "category" id="'.$category.'">'; // title of the current category foreach($allAlbums as $album){ if(ereg(strtolower(' '.$category),strtolower($album[1]))){//because without ' ' ball would be found in football $numberOfGalleries++; // increase the number of galleries in this category if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).': '.$album[2].'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $album[2]=false; // we mark the gallery as having been written, not to write it again in the 'others' tab $albumToCategory[] = array($category,$album[0]); $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('".$category."',".$album[0].");\n"; //save the link between a gallery TimeStamp and the associates category } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>'; //if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div></div>'; } $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\'others\')">Others</a>'.'<div class = "category" id="others">'; // if there is no category corresponding to the gallery $numberOfGalleries = 0; foreach($allAlbums as $album){ $found = false; foreach ($albumToCategory as $link){ if ($link[1]==$album[0]){ $found = true; break; } } if (!$found){ $numberOfGalleries++; $albumToCategory[] = array('all',$album[0]); if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.$album[2].': '.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('others',".$album[0].");\n"; } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>';//if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div>';// end of the others session, layout only $phpGeneratedText .= '</div>';// end of the others session, title $phpGeneratedText .= '</div>';//end of the galleries available $phpGeneratedText .= '<div class="Photographers" id="photographers">Who was your photographer?</br></br><div class="Photographer" id="all"><a href="javascript:;" onclick="updatePH(\'all\')">all</a></div></br>';// display an all photographers button foreach($allPhotographers as $photographer){ $photolink = getIdPhoto($photographer); //echo 'debug2:'.$photolink; $phpGeneratedText .= '<div class="Photographer" ><a href="javascript:;" onclick="updatePH(\''.$photographer.'\')"><div><img id="'.$photographer.'" src="photos/'.$photolink.'" alt = "'.$photographer.'" class = "displayPicture"/></div></br>'.$photographer.'</a></div></br>';// for each photographer, display name } $phpGeneratedText .= '</div>';// end of the photographers selection tab ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>UPS:CRU, [original Student Media Since 2007] | UPS:CRU, Your photos!</title> </head> <!--<link rel="stylesheet" type="text/css" href="allBrowsers.css"/>--> <style type="text/css">@import url(allBrowsers.css) all;</style> <!--[if IE]><style type="text/css">@import url(IE.css);</style><![endif]--> <script type="text/javascript" src="swfobject.js"></script> <script language="javascript" type="text/javascript"> function defineVariables(){ <?php echo $javascriptDefinition; echo $javascriptAlbumDefinition; ?> } function updateAlbums(){ document.getElementById('refreshAlbums').style.display='inline'; setTimeout(loadUpdatingPage,500); } function loadUpdatingPage(){ //alert("toto"); var xhr_object = null; if(window.XMLHttpRequest) // Firefox xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) // Internet Explorer xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); xhr_object.open("GET", './update.php', true); xhr_object.send(null); if(xhr_object.readyState == 4) window.location.reload(); } function getAssociatedCategory (timeStamp){ for (i=0;i<document.categoryLink.length;i++){ if (document.categoryLink[i][1]==timeStamp) return document.categoryLink[i][0]; } } function getNewestAlbum(){ value = 0; for (i=0;i<document.albums.length;i++){ if(document.albums[i][0]>value) value = document.albums[i][0]; } return value; } function simplifiedVersion(){ document.getElementById('flashcontent').style.height='500'; document.getElementById('flashcontent').style.zIndex='5'; document.getElementById('flashcontent').style.top='10%'; document.getElementById('flashcontent').style.left='0'; document.getElementById('flashcontent').style.width='100%'; document.getElementById('latestAlbum').style.display ='inline'; document.getElementById('bottom').style.fontSize="6pt"; document.getElementById('PhotoCount').style.fontSize="10pt"; document.getElementById('PhotoCount').style.top="10"; document.getElementById('PhotoCount').style.left="0%"; document.getElementById('links').style.fontSize="9pt"; document.getElementById('links').style.top="23px"; document.getElementById('links').style.zIndex="6"; document.getElementById('links').style.display="inline"; document.photographer ='all'; albumId = getNewestAlbum(); updateTS(albumId); } function fullVersion(){ document.getElementById('links').style.display ='inline'; document.getElementById('Albums').style.display ='inline'; document.getElementById('photographers').style.display ='inline'; document.getElementById('share').style.display ='inline'; } var loading = function(){ document.lastUpdated; document.photographer = 'all'; document.avoidWrite = false; defineVariables(); document.firstClick = true; document.albums.sort(); document.albums = doublons2D(document.albums); document.photographers = doublons(document.photographers); document.photographers.sort(); document.album = getNewestAlbum(); document.firstClick = true; document.thumbLoaded = 0; document.imgLoaded = 0; document.pictsNumb = 0; document.actualImage = 0; document.actualLink =""; document.targetPhotoNumber = -1; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL; //alert(window.parent==window); <?php echo $javascriptUpdateVars; echo $javascriptDisplaySpecificPhoto; ?> if (window.parent == window) fullVersion(); else simplifiedVersion(); } function resetCategoriesDisplay(){ document.getElementById('others').style.display ='none'; for (i=0;i<document.categories.length;i++){ document.getElementById(document.categories[i]).style.display ='none'; } } function displayCategory(category){ resetCategoriesDisplay(); document.getElementById(category).style.display ='inline'; } function resetSelection(){ unselectText('all'); unselectImage('all'); for (i=0;i<document.albums.length;i++){ unselectText(document.albums[i][0]); unselectImage(document.albums[i][0]); } for (i=0;i<document.photographers.length;i++){ unselectText(document.photographers[i]); unselectImage(document.photographers[i]); } } function getGoodAlbum (){ if(document.album=='' || document.photographer=='all') { return true; } for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer && document.allAlbums[i][0]==document.album){ document.albumDesc = document.allAlbums[i][1]; return true; } } return false; } function firstAlbumPhotographer(){ for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer) return document.allAlbums[i][0]; } } function selectText (id){ document.getElementById(id).style. backgroundColor="#0000FF"; } function selectImage(id){ document.getElementById(id).style.borderColor='#0000FF'; document.getElementById(id).style.borderWidth='thick'; document.getElementById(id).style.width='100%'; //document.getElementById(id).style.left='-5'; } function unselectText (id){ document.getElementById(id).style. backgroundColor=""; } function unselectImage(id){ document.getElementById(id).style.borderColor=''; document.getElementById(id).style.borderWidth=''; document.getElementById(id).style.width=''; document.getElementById(id).style.left=''; } function updateSelection(){ if (document.photographer=='all') selectText(document.photographer); else selectImage(document.photographer); selectText(document.album); category = getAssociatedCategory(document.album); displayCategory(category); } function updateFlash(){ url = 'get_all_album.php?id='+document.album+document.photographer; if (window.parent != window) url= url +'-true'; //alert(url); document.fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7",""); document.fo.addParam("wmode", "transparent"); document.fo.addParam("quality", "best"); document.fo.addVariable("preloaderColor", "0xffffff"); document.fo.addVariable("xmlDataPath", url); if (document.targetPhotoNumber!= -1) document.fo.addVariable("firstPicture", document.targetPhotoNumber); document.fo.write("flashcontent"); } function addZeros ( number){ if (number<10) return '00'+number; if (number<100) return '0'+number; return number; } function numberOfPictures(param){ document.pictsNumb = parseInt(param); document.getElementById('NumberOfPhotos').innerHTML=addZeros(document.pictsNumb); //document.getElementById('PhotoCount').style.display='inline'; } function loadNextThumbIndex(param){ document.thumbLoaded++; } function loadNextImageIndex(param){ document.imgLoaded++; } function showImageIndex(param){ //alert(param); document.actualImage = parseInt(param)+1; //alert(document.getElementById('actualPhoto').value); document.getElementById('actualPhoto').innerHTML=addZeros(document.actualImage); document.getElementById('PhotoCount').style.display='inline'; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL+"?photographer="+document.photographer+"&AlbumID="+document.album+"&pictureNumber="+document.actualImage; } function copyURL(){ window.clipboardData.setData("text",document.getElementById ('PageLink').value); } function showImageURL(param){ //alert(param); document.actualLink = param; } function getFlashMovieObject(movieName) { if (window.document[movieName]) { return window.document[movieName]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; } else { return document.getElementById(movieName); } } function displayVariables(){ //flashViewer = getFlashMovieObject("viewer"); //flashVariables = flashViewer.GetVariable("sm\title"); //alert(flashVariables); //for(key in flashVariables){alert((key+"="+flashVariables[key]))}; } function updatePH(ph){ window.status = "Updating your galleries..."; //if((ph!=document.photographer))|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.photographer=ph; if(getGoodAlbum()==true||ph=='all'){ updateSelection(); updateFlash(); } else updateTS(firstAlbumPhotographer()); window.status = ""; //} //else window.status = "You are already viewing photos from this photographer!"; } function updateTS(ts){ window.status = "Updating your galleries..."; //if((ts!=document.album)|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.album=ts; if (getGoodAlbum()==true){ updateSelection(); updateFlash(); window.status = ""; } else updatePH('all'); //} //else window.status = "You are already viewing photos of this event!"; } function gotoPhoto (photographer, albumTS, photonumber){ //document.fo.addVariable("firstPicture", photonumber); document.targetPhotoNumber = photonumber; updatePH(photographer); updateTS(albumTS); document.targetPhotoNumber = -1; } function displayPicture (){ monFlash = getFlashMovieObject('viewer'); //alert(monFlash); //monFlash.gotoThumb(document.targetPhotoNumber); //gotoImage(); } function doublons2D(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x][0]== TabInit[i][0] && x!=i) TabInit[i][0]='faux'; } if(TabInit[x][0]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function changeURLDisplayStatus(){ if (!document.URLDisplayed){ document.URLDisplayed = 1; element = document.getElementById("PageLink"); element.style.display = "inline"; element = document.getElementById("URLLink"); element.innerHTML = "Hide the link"; if(window.clipboardData){ element = document.getElementById("copyURL"); element.style.display = "inline"; } } else{ document.URLDisplayed = 0; element = document.getElementById("PageLink"); element.style.display = "none"; element = document.getElementById("URLLink"); element.innerHTML = "Show me the direct link to this photo"; element = document.getElementById("copyURL"); element.style.display = "none"; } } function doublons(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x]== TabInit[i] && x!=i) TabInit[i]='faux'; } if(TabInit[x]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function share (site){ //myLink = escape(window.location.href); myLink = escape("http://www.upsu.com/camcru"); newwindow=window.open("http://www.facebook.com/sharer.php?u="+myLink,'title','height=400,width=650,scrollbars=yes,'); if (window.focus) {newwindow.focus()} } </script> </head> <body onload="loading()"> <div class="links" id="links">Back to: <div class="link"><a href="http://www.upsu.com/">UPSU</a></div> <div class="link"><a href="http://www.upscru.co.uk/">ups:cru</a></div> <div class="link"><a href="javascript:history.go(-1);">cam:cru</a></div> </div> <?php echo $phpGeneratedText; ?> <div id="flashcontent"> <div class ='logo'> <img width="100%" src="camcru.png"></br> <div class="underLogo" id="underLogo">Please select the album you want to see. <div class="comment"></br>© Thibault JAMET 2008 - For any question or suggestion, please contact us </div> </div> </div> </div> <div class="bottom" id="bottom"> Last updated :<?php if (is_string($lastUpdated)) echo $lastUpdated; else echo date("D d M Y H:i",$lastUpdated); ?></br> © 2008 THJ Realisations for ups:cru, with help from Benoît QUENTIN. Scripts adapted from Ben Hughes, viewer from <a href ="http://www.airtightinteractive.com/simpleviewer/" style="color:#999999">AIRTIGHT Interactive</a>. </div> <div style="display" class="share" id="share"> <div><a href="javascript:;" onclick="share('facebook')"><img src="facebook.gif" alt='' border="0"/> Share me on facebook</a></div></br> <div><a href="javascript:changeURLDisplayStatus();" id="URLLink">Show me the direct link to this photo</a></div> <input type="text" name="PageLink" id="PageLink" value="toto" style="display:none" size="20" /> <div style="display:none"><a href="javascript:copyURL();" id="copyURL">Copy URL to Clipboard</a></div> </div> <div id="refreshAlbums" style="display:none"> <img id="refreshImage" src='updating.png' alt=""/> </div> <div id="PhotoCount" style="display:none" class="PhotoCount" > Picture # <span style="position:relative; text-align:right; width:50" id="actualPhoto">000</span> / <span style="text-align:left; position:relative width:50" id="NumberOfPhotos">000</span> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/141582-syntax-error-unexpected-end/#findComment-741066 Share on other sites More sharing options...
howie2293 Posted January 20, 2009 Author Share Posted January 20, 2009 Unfortunatly still coming up with the same Link to comment https://forums.phpfreaks.com/topic/141582-syntax-error-unexpected-end/#findComment-741067 Share on other sites More sharing options...
gevans Posted January 20, 2009 Share Posted January 20, 2009 ok, give this one a go <?php //$targetTimeStamp=$_GET['timeStamp']; //$targetPhotographer = $_GET['photographer']; require ('parse_albums.php'); require('get_categories.php'); require ('parse_users.php'); $targetImage = $_GET['pictureNumber']; $targetPhotographer = $_GET['photographer']; $targetAlbumTS = $_GET['AlbumID']; getUser(); function doublons2D($TabInit){ global $allPhotographers,$allAlbums; $allPhotographers = array(); $allAlbums = array(); $allTimeStamps = array(); foreach($TabInit as $tabElt){ //echo '(timeStamp:'.$tabElt[1].')'.'resultat:'.(array_search($tabElt[1],$allTimeStamps).'<br>'); if (!is_int( array_search($tabElt['timeStamp'],$allTimeStamps))){ $allAlbums[]= array($tabElt['timeStamp'],$tabElt['albumName'],$tabElt['summary']); $allTimeStamps[]=$tabElt['timeStamp']; } if (!is_int(array_search($tabElt['nickname'],$allPhotographers))){ $allPhotographers[]= $tabElt['nickname']; } } } getAllAlbums(); $javascriptUpdateVars = ''; $now = time(); $hour = floor($now/60/60); $day = floor($now/60/60/24); $hour = $hour-$day*24; if ($lastUpdated<($now-6*60*60) and ($hour>9)) { //$javascriptUpdateVars .= 'updateAlbums();'; } $albumIndex = 1; $javascriptAlbumDefinition = "document.albums = new Array(); document.allAlbums = new Array();document.photographers = new Array();"; $javascriptDisplaySpecificPhoto =""; foreach($albums as $album){ $javascriptAlbumDefinition .= 'document.albums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.allAlbums['.$albumIndex.'] = new Array('.$album['timeStamp'].',"'.$album['albumName'].'","'.$album['nickname'].'"); document.photographers['.$albumIndex++.'] = "'.$album['nickname']."\";"; if (isset($targetImage)&& isset($targetPhotographer) && isset($targetAlbumTS)){ if (($targetPhotographer==$album['nickname']||$targetPhotographer=='all')&&intval($targetAlbumTS)==$album['timeStamp']) $javascriptDisplaySpecificPhoto = "gotoPhoto('".$targetPhotographer."',".$targetAlbumTS.",".$targetImage.");\n"; } } rsort($albums); doublons2D($albums); $photographersIconsLink = array(); foreach($photographers as $photographer){ $photographersIconLink[] = array($photographer[0],$photographer[1]); } function getIdPhoto ($photographer){ global $photographersIconLink; foreach ($photographersIconLink as $singleLink){ //echo'debug:'.$photographer.' '.$singleLink[0]; if($singleLink[0]==$photographer){ //echo "debug:".$singleLink[1]; return $singleLink[1]; } } } $phpGeneratedText = '<div class="Albums" id="Albums">Albums available:'; //$allAlbums[]=array(); $albumToCategory = array(); $javascriptDefinition = "document.categoryLink=new Array();\ndocument.categories = new Array();"; $cat2AlbumIndex = 0; $categoriesIndex=0; //for each different category, we display the link to display it foreach($categories as $category){ $numberOfGalleries = 0; $javascriptDefinition.="document.categories[".$categoriesIndex++."]=\"".$category."\";";//to give the javascript the categories $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\''.$category.'\')">'.$category.'</a>'.'<div class = "category" id="'.$category.'">'; // title of the current category foreach($allAlbums as $album){ if(ereg(strtolower(' '.$category),strtolower($album[1]))){//because without ' ' ball would be found in football $numberOfGalleries++; // increase the number of galleries in this category if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).': '.$album[2].'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $album[2]=false; // we mark the gallery as having been written, not to write it again in the 'others' tab $albumToCategory[] = array($category,$album[0]); $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('".$category."',".$album[0].");\n"; //save the link between a gallery TimeStamp and the associates category } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>'; //if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div></div>'; } $phpGeneratedText .= '<div class="Categories" id="categories">'.'<a href="javascript:;" onclick = "displayCategory(\'others\')">Others</a>'.'<div class = "category" id="others">'; // if there is no category corresponding to the gallery $numberOfGalleries = 0; foreach($allAlbums as $album){ $found = false; foreach ($albumToCategory as $link){ if ($link[1]==$album[0]){ $found = true; break; } } if (!$found){ $numberOfGalleries++; $albumToCategory[] = array('all',$album[0]); if(ereg(strtolower('DESC'),strtolower($album[1]))){ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.$album[2].': '.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } else{ $phpGeneratedText .= '<div name="category" class="Album" id="'.$album[0].'"><a href="javascript:;" onclick="updateTS(\''.$album[0].'\')">'.date('M d Y',$album[0]).'</a></div>';// link to the gallery displaying } $javascriptDefinition .= "document.categoryLink[".$cat2AlbumIndex++."]=new Array('others',".$album[0].");\n"; } } if ($numberOfGalleries==0){ $phpGeneratedText .= '<div class="Album" id="noPhoto">No picture</div>';//if there is no picture in the gallery, display tthe information } $phpGeneratedText .= '</div>';// end of the others session, layout only $phpGeneratedText .= '</div>';// end of the others session, title $phpGeneratedText .= '</div>';//end of the galleries available $phpGeneratedText .= '<div class="Photographers" id="photographers">Who was your photographer?</br></br><div class="Photographer" id="all"><a href="javascript:;" onclick="updatePH(\'all\')">all</a></div></br>';// display an all photographers button foreach($allPhotographers as $photographer){ $photolink = getIdPhoto($photographer); //echo 'debug2:'.$photolink; $phpGeneratedText .= '<div class="Photographer" ><a href="javascript:;" onclick="updatePH(\''.$photographer.'\')"><div><img id="'.$photographer.'" src="photos/'.$photolink.'" alt = "'.$photographer.'" class = "displayPicture"/></div></br>'.$photographer.'</a></div></br>';// for each photographer, display name } $phpGeneratedText .= '</div>';// end of the photographers selection tab ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>UPS:CRU, [original Student Media Since 2007] | UPS:CRU, Your photos!</title> </head> <!--<link rel="stylesheet" type="text/css" href="allBrowsers.css"/>--> <style type="text/css">@import url(allBrowsers.css) all;</style> <!--[if IE]><style type="text/css">@import url(IE.css);</style><![endif]--> <script type="text/javascript" src="swfobject.js"></script> <script language="javascript" type="text/javascript"> function defineVariables(){ <?php echo $javascriptDefinition; echo $javascriptAlbumDefinition; ?> } function updateAlbums(){ document.getElementById('refreshAlbums').style.display='inline'; setTimeout(loadUpdatingPage,500); } function loadUpdatingPage(){ //alert("toto"); var xhr_object = null; if(window.XMLHttpRequest) // Firefox xhr_object = new XMLHttpRequest(); else if(window.ActiveXObject) // Internet Explorer xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); xhr_object.open("GET", './update.php', true); xhr_object.send(null); if(xhr_object.readyState == 4) window.location.reload(); } function getAssociatedCategory (timeStamp){ for (i=0;i<document.categoryLink.length;i++){ if (document.categoryLink[i][1]==timeStamp) return document.categoryLink[i][0]; } } function getNewestAlbum(){ value = 0; for (i=0;i<document.albums.length;i++){ if(document.albums[i][0]>value) value = document.albums[i][0]; } return value; } function simplifiedVersion(){ document.getElementById('flashcontent').style.height='500'; document.getElementById('flashcontent').style.zIndex='5'; document.getElementById('flashcontent').style.top='10%'; document.getElementById('flashcontent').style.left='0'; document.getElementById('flashcontent').style.width='100%'; document.getElementById('latestAlbum').style.display ='inline'; document.getElementById('bottom').style.fontSize="6pt"; document.getElementById('PhotoCount').style.fontSize="10pt"; document.getElementById('PhotoCount').style.top="10"; document.getElementById('PhotoCount').style.left="0%"; document.getElementById('links').style.fontSize="9pt"; document.getElementById('links').style.top="23px"; document.getElementById('links').style.zIndex="6"; document.getElementById('links').style.display="inline"; document.photographer ='all'; albumId = getNewestAlbum(); updateTS(albumId); } function fullVersion(){ document.getElementById('links').style.display ='inline'; document.getElementById('Albums').style.display ='inline'; document.getElementById('photographers').style.display ='inline'; document.getElementById('share').style.display ='inline'; } var loading = function(){ document.lastUpdated; document.photographer = 'all'; document.avoidWrite = false; defineVariables(); document.firstClick = true; document.albums.sort(); document.albums = doublons2D(document.albums); document.photographers = doublons(document.photographers); document.photographers.sort(); document.album = getNewestAlbum(); document.firstClick = true; document.thumbLoaded = 0; document.imgLoaded = 0; document.pictsNumb = 0; document.actualImage = 0; document.actualLink =""; document.targetPhotoNumber = -1; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL; //alert(window.parent==window); <?php echo $javascriptUpdateVars; echo $javascriptDisplaySpecificPhoto; ?> if (window.parent == window) fullVersion(); else simplifiedVersion(); } function resetCategoriesDisplay(){ document.getElementById('others').style.display ='none'; for (i=0;i<document.categories.length;i++){ document.getElementById(document.categories[i]).style.display ='none'; } } function displayCategory(category){ resetCategoriesDisplay(); document.getElementById(category).style.display ='inline'; } function resetSelection(){ unselectText('all'); unselectImage('all'); for (i=0;i<document.albums.length;i++){ unselectText(document.albums[i][0]); unselectImage(document.albums[i][0]); } for (i=0;i<document.photographers.length;i++){ unselectText(document.photographers[i]); unselectImage(document.photographers[i]); } } function getGoodAlbum (){ if(document.album=='' || document.photographer=='all') { return true; } for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer && document.allAlbums[i][0]==document.album){ document.albumDesc = document.allAlbums[i][1]; return true; } } return false; } function firstAlbumPhotographer(){ for (i=0;i<document.allAlbums.length;i++){ if(document.allAlbums[i][2]==document.photographer) return document.allAlbums[i][0]; } } function selectText (id){ document.getElementById(id).style. backgroundColor="#0000FF"; } function selectImage(id){ document.getElementById(id).style.borderColor='#0000FF'; document.getElementById(id).style.borderWidth='thick'; document.getElementById(id).style.width='100%'; //document.getElementById(id).style.left='-5'; } function unselectText (id){ document.getElementById(id).style. backgroundColor=""; } function unselectImage(id){ document.getElementById(id).style.borderColor=''; document.getElementById(id).style.borderWidth=''; document.getElementById(id).style.width=''; document.getElementById(id).style.left=''; } function updateSelection(){ if (document.photographer=='all') selectText(document.photographer); else selectImage(document.photographer); selectText(document.album); category = getAssociatedCategory(document.album); displayCategory(category); } function updateFlash(){ url = 'get_all_album.php?id='+document.album+document.photographer; if (window.parent != window) url= url +'-true'; //alert(url); document.fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7",""); document.fo.addParam("wmode", "transparent"); document.fo.addParam("quality", "best"); document.fo.addVariable("preloaderColor", "0xffffff"); document.fo.addVariable("xmlDataPath", url); if (document.targetPhotoNumber!= -1) document.fo.addVariable("firstPicture", document.targetPhotoNumber); document.fo.write("flashcontent"); } function addZeros ( number){ if (number<10) return '00'+number; if (number<100) return '0'+number; return number; } function numberOfPictures(param){ document.pictsNumb = parseInt(param); document.getElementById('NumberOfPhotos').innerHTML=addZeros(document.pictsNumb); //document.getElementById('PhotoCount').style.display='inline'; } function loadNextThumbIndex(param){ document.thumbLoaded++; } function loadNextImageIndex(param){ document.imgLoaded++; } function showImageIndex(param){ //alert(param); document.actualImage = parseInt(param)+1; //alert(document.getElementById('actualPhoto').value); document.getElementById('actualPhoto').innerHTML=addZeros(document.actualImage); document.getElementById('PhotoCount').style.display='inline'; element = document.getElementById ('PageLink'); var url=String(window.location); var pageURL=url; if (url.indexOf("?",7)>1) var pageURL=url.substring(0,url.indexOf("?",7)); //pageURL = String.substr(window.location,0,3); element.value =pageURL+"?photographer="+document.photographer+"&AlbumID="+document.album+"&pictureNumber="+document.actualImage; } function copyURL(){ window.clipboardData.setData("text",document.getElementById ('PageLink').value); } function showImageURL(param){ //alert(param); document.actualLink = param; } function getFlashMovieObject(movieName) { if (window.document[movieName]) { return window.document[movieName]; } if (navigator.appName.indexOf("Microsoft Internet")==-1) { if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; } else { return document.getElementById(movieName); } } function displayVariables(){ //flashViewer = getFlashMovieObject("viewer"); //flashVariables = flashViewer.GetVariable("sm\title"); //alert(flashVariables); //for(key in flashVariables){alert((key+"="+flashVariables[key]))}; } function updatePH(ph){ window.status = "Updating your galleries..."; //if((ph!=document.photographer))|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.photographer=ph; if(getGoodAlbum()==true||ph=='all'){ updateSelection(); updateFlash(); } else updateTS(firstAlbumPhotographer()); window.status = ""; //} //else window.status = "You are already viewing photos from this photographer!"; } function updateTS(ts){ window.status = "Updating your galleries..."; //if((ts!=document.album)|| (document.firstClick==true)){ document.getElementById('PhotoCount').style.display='none'; document.firstClick = false; resetSelection(); document.album=ts; if (getGoodAlbum()==true){ updateSelection(); updateFlash(); window.status = ""; } else updatePH('all'); //} //else window.status = "You are already viewing photos of this event!"; } function gotoPhoto (photographer, albumTS, photonumber){ //document.fo.addVariable("firstPicture", photonumber); document.targetPhotoNumber = photonumber; updatePH(photographer); updateTS(albumTS); document.targetPhotoNumber = -1; } function displayPicture (){ monFlash = getFlashMovieObject('viewer'); //alert(monFlash); //monFlash.gotoThumb(document.targetPhotoNumber); //gotoImage(); } function doublons2D(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x][0]== TabInit[i][0] && x!=i) TabInit[i][0]='faux'; } if(TabInit[x][0]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function changeURLDisplayStatus(){ if (!document.URLDisplayed){ document.URLDisplayed = 1; element = document.getElementById("PageLink"); element.style.display = "inline"; element = document.getElementById("URLLink"); element.innerHTML = "Hide the link"; if(window.clipboardData){ element = document.getElementById("copyURL"); element.style.display = "inline"; } } else{ document.URLDisplayed = 0; element = document.getElementById("PageLink"); element.style.display = "none"; element = document.getElementById("URLLink"); element.innerHTML = "Show me the direct link to this photo"; element = document.getElementById("copyURL"); element.style.display = "none"; } } function doublons(TabInit){ NvTab= new Array(); var q=0; var LnChaine= TabInit.length; for(x=0;x<LnChaine;x++) { for(i=0;i<LnChaine;i++) { if(TabInit[x]== TabInit[i] && x!=i) TabInit[i]='faux'; } if(TabInit[x]!='faux'){ NvTab[q] = TabInit[x]; q++} } return NvTab; } function share (site){ //myLink = escape(window.location.href); myLink = escape("http://www.upsu.com/camcru"); newwindow=window.open("http://www.facebook.com/sharer.php?u="+myLink,'title','height=400,width=650,scrollbars=yes,'); if (window.focus) {newwindow.focus()} } </script> </head> <body onload="loading()"> <div class="links" id="links">Back to: <div class="link"><a href="http://www.upsu.com/">UPSU</a></div> <div class="link"><a href="http://www.upscru.co.uk/">ups:cru</a></div> <div class="link"><a href="javascript:history.go(-1);">cam:cru</a></div> </div> <?php echo $phpGeneratedText; ?> <div id="flashcontent"> <div class ='logo'> <img width="100%" src="camcru.png"></br> <div class="underLogo" id="underLogo">Please select the album you want to see. <div class="comment"></br>© Thibault JAMET 2008 - For any question or suggestion, please contact us </div> </div> </div> </div> <div class="bottom" id="bottom"> Last updated :<?php if (is_string($lastUpdated)) echo $lastUpdated; else echo date("D d M Y H:i",$lastUpdated); ?></br> © 2008 THJ Realisations for ups:cru, with help from Benoît QUENTIN. Scripts adapted from Ben Hughes, viewer from <a href ="http://www.airtightinteractive.com/simpleviewer/" style="color:#999999">AIRTIGHT Interactive</a>. </div> <div style="display" class="share" id="share"> <div><a href="javascript:;" onclick="share('facebook')"><img src="facebook.gif" alt='' border="0"/> Share me on facebook</a></div></br> <div><a href="javascript:changeURLDisplayStatus();" id="URLLink">Show me the direct link to this photo</a></div> <input type="text" name="PageLink" id="PageLink" value="toto" style="display:none" size="20" /> <div style="display:none"><a href="javascript:copyURL();" id="copyURL">Copy URL to Clipboard</a></div> </div> <div id="refreshAlbums" style="display:none"> <img id="refreshImage" src='updating.png' alt=""/> </div> <div id="PhotoCount" style="display:none" class="PhotoCount" > Picture # <span style="position:relative; text-align:right; width:50" id="actualPhoto">000</span> / <span style="text-align:left; position:relative width:50" id="NumberOfPhotos">000</span> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/141582-syntax-error-unexpected-end/#findComment-741091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.