home *** CD-ROM | disk | FTP | other *** search
- <?php
- ////////////////////////////////////////////////////////////////////////////////
- // <!--Copyright (c) 2005 Pure Networks Inc. All rights reserved.-->
- ////////////////////////////////////////////////////////////////////////////////
- //
- // Build: 3.0.6121.0 (Stable)
- // $Revision: #3 $
- //
-
- $sNavLocation = "folders";
- $sNavPage = "folders";
- $sLocation = ""; // later defined after we connect to the share
- $bReadOnly = true;
- $bUploadsEnabled = false;
- require '_session_common.php';
-
- ///////////////////////////////////////////////////
- // Has to be here so that the cookies are first header wise...
- // Let's see if the view_mode cookie (thumbnail versus file list) is set and pull the value
- // if it's not set, we set it here, this determines which UI we will show
- ///////////////////////////////////////////////////
- $sViewMode = "photo";
- if (!isset($_COOKIE['view_mode']))
- {
- // not set, likely first time here on this machine, give them file view
- setcookie("view_mode", "photo", time()+(60*60*24*365*5),"/"); // 60 seconds * 60 minutes * 24 hours * 365 days * 5 years
- }
- else
- {
- // let's get the cookie value first and assign it to our global
- $sViewMode = $_COOKIE['view_mode'];
- // now let's see if our QS has a value
- if (isset($_GET['mode']))
- {
- // We have a QS value - is it valid?
- switch($_GET['mode'])
- {
- case "file":
- case "photo":
- $sGetVarMode = $_GET['mode'];
- break;
- default:
- $sGetVarMode = "photo";
- }
- // does it differ from the cookie? - If so, rewrite the cookie and change our global to the QS value
- if ($sViewMode != $sGetVarMode)
- {
- setcookie("view_mode", $sGetVarMode, time()+(60*60*24*365*5),"/"); // 60 seconds * 60 minutes * 24 hours * 365 days * 5 years
- $sViewMode = $sGetVarMode;
- }
- }
- }
- ///////////////////////////////////////////////////
- // Import the folderutil functions,
- // DEPENDS: needs access to $sGetVarMode
- ///////////////////////////////////////////////////
- require '_folderutils.php';
- ///////////////////////////////////////////////////
- // Make sure that we have a valid share passed in.
- ///////////////////////////////////////////////////
- if (!isset($_GET['share']) or $_GET['share'] == "")
- {
- log_activity("QS check", "failure", return_error_text(200, "", $arErrors));
- gotoAbs('/error/200&return=/folders/');
- exit();
- }
- else
- {
- $sShare = $_GET['share'];
- log_activity("view folder share", "info", $sShare);
- }
- ///////////////////////////////////////////////////
- // Make sure that we have a valid page passed in.
- ///////////////////////////////////////////////////
- if (!isset($_GET['page']) or $_GET['page'] == "")
- {
- $iPage = 0;
- }
- else
- {
- $iPage = $_GET['page'];
- }
-
- ///////////////////////////////////////////////////
- // Make sure that we have a valid path passed in.
- ///////////////////////////////////////////////////
- if (!isset($_GET['path']) or $_GET['path'] == "")
- {
- log_activity("QS check", "failure", return_error_text(201, "", $arErrors));
- gotoAbs('/error/201/return');
- exit();
- }
- else
- {
- $sPath = urlDecodeString($_GET['path']);
- log_activity("view folder path", "info", $sPath);
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
- // NOTE: we do several try catch blocks so we know exactly which function threw the exception. //
- /////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////
-
- ///////////////////////////////////////////////////
- // Let's try to see if we can open the share
- ///////////////////////////////////////////////////
- try
- {
- $nmSharedPlace = $nmNetworkLib->OpenShare($sShare);
- }
- catch(Exception $ex)
- {
- log_activity("Attempting nmNetworkLib->OpenShare($sShare)", "exception", $ex->getMessage());
- gotoAbs('/error/305/return');
- exit();
- }
- ///////////////////////////////////////////////////
- // double check the access level and react
- ///////////////////////////////////////////////////
- try
- {
- $sAccessLevel = $nmSharedPlace->AccessLevel;
- }
- catch(Exception $ex)
- {
- log_activity("Attempting nmSharedPlace->AccessLevel", "exception", $ex->getMessage());
- gotoAbs('/error/305/return');
- exit();
- }
-
- switch ($sAccessLevel)
- {
- case 0:
- ///////////////////////////////////////////////////
- // Public share, show away.
- ///////////////////////////////////////////////////
- break;
- case 1:
- if (!$bLoggedIn)
- {
- ///////////////////////////////////////////////////
- // Private share and user is not logged in, go away.
- ///////////////////////////////////////////////////
- log_activity("private folder request without session", "error", return_error_text(308, "", $arErrors));
- gotoAbs('/login/308');
- exit();
- }
- break;
- case 2:
- ///////////////////////////////////////////////////
- // Restricted share, go away.
- ///////////////////////////////////////////////////
- log_activity("restricted share request", "error", return_error_text(310, "", $arErrors));
- gotoAbs('/login/310');
- exit();
- break;
- default:
- log_activity("Undefined share access level", "error", return_error_text(311, "", $arErrors));
- gotoAbs('/login/311');
- exit();
- }
-
- ///////////////////////////////////////////////////
- // Increment the share viewings counter
- ///////////////////////////////////////////////////
- try
- {
- $nmNetworkLib->IncrementViewingCount($nmSharedPlace);
- }
- catch (exception $ex)
- {
- log_activity("share view counter", "exception", $ex->getMessage());
- }
-
- ///////////////////////////////////////////////////
- // 1) see if it is offline and shuttle to error with proper code.
- // 2) see if we can get the share information off the filesystem
- // 3) validate that the path is contained within the filesystem.
- // 4) Get a pointer to a folder - don't read it into arrays yet.
- ///////////////////////////////////////////////////
- try
- {
- if (!$nmSharedPlace->IsOnline)
- {
- log_activity("folder view", "error", return_error_text(303, "", $arErrors));
- gotoAbs('/error/303/return');
- exit();
- }
- $sContainer = getShareTitle($nmSharedPlace);
- $sLocation = $nmSharedPlace->Location; // we now have the info needed to define this
- $sUnc = $nmSharedPlace->Unc;
- $sFolderPath = $sPath;
- $sFolderShortPath = basename($sFolderPath);
- }
- catch(Exception $ex)
- {
- log_activity("folder view", "exception", $ex->getMessage());
- gotoAbs('/error/306/return');
- exit();
- }
- ///////////////////////////////////////////////////
- // the path does not match up to the share path
- // NOTE - Possible security attack. - error page
- ///////////////////////////////////////////////////
-
- if (strncasecmp($sFolderPath, $sUnc, strlen($sUnc)) != 0)
- {
- log_activity("folder view", "error", return_error_text(301, "", $arErrors));
- gotoAbs('/error/301');
- exit();
- }
-
- ///////////////////////////////////////////////////
- // Need to verify that the folder still exists
- // This only works if this is a real folder path - not the root UNC path
- ///////////////////////////////////////////////////
- if ((strcmp($sFolderPath, $sUnc) != 0) && !file_exists($sFolderPath))
- {
- $return = "";
- if (isset($_SERVER['HTTP_REFERER']))
- {
- $return = $_SERVER['HTTP_REFERER'];
- }
-
- // folder couldn't be found, so we wipe the folder session vars, and ship them to error page
- unset($_SESSION['currentFolderInfo']);
- unset($_SESSION['currentFolderFiles']);
- log_activity("folder view", "failure", return_error_text(302, "", $arErrors));
- gotoAbs('/error/302/return');
- exit();
- }
-
- createSessionFileArrays($sShare, $sPath, $sFolderPath, $nmSharedPlace, true, $iPage);
-
- $count = count($arFiles);
- $pageNumber = returnPageNumber($count, $ObjectsPerPage, $iPage);
- $sPagination = returnPaginationString($count, $ObjectsPerPage, $iPaginationBuffer, $pageNumber);
-
- ///////////////////////////////////////////////////
- // 1) see if uploads are enabled
- // 2) see if the folder is read only
- ///////////////////////////////////////////////////
- try
- {
- $bUploadEnabled = $nmRaManager->UploadsEnabled;
- $bReadOnly = $nmSharedPlace->ReadOnly;
- }
- catch (exception $ex)
- {
- log_activity("RO & Uploads enabled check", "exception", $ex->getMessage());
- gotoAbs('/error/307/return');
- exit();
- }
- //set up variables needed by the header file.
- if (file_exists($sFolderPath . "\folderheader.n2g"))
- {
- $filename = $sFolderPath . "\folderheader.n2g";
- $handle = fopen($filename, "rb");
- $sIntroText = str_replace("\r\n","<br/>",fread($handle, filesize($filename)));
- fclose($handle);
- // if we're in public view, let's display welcome text and/or message.
- $sIntroRow = "<tr><td colspan=\"4\">";
- $sIntroRow .= "<div class=\"WelcomeMessage\">";
- $sIntroRow .= $sIntroText;
- $sIntroRow .= "</div>";
- $sIntroRow .= "</td></tr>";
- }
- ///////////////////////////////////////////////////
- // start printing out the HTML to the browser
- ///////////////////////////////////////////////////
- require "_header.php";
- ?>
- <table cellspacing="0" cellpadding="0" border="0" width="100%">
- <tr>
- <td valign="top" width="100%">
- <?php require "_public_error_states.php"; ?>
- <!-- Start Folder view table -->
- <table cellspacing="0" cellpadding="0" border="0" class="ContentTable">
- <?php echo ($sIntroRow); ?>
- <tr>
- <td class="ContentTableTL"><div><img src="/images/pixel.trans.gif" width="1" height="1" alt=""></div></td>
- <?php printBreadcrumbs($sShare, $sUnc, $sFolderPath, $sContainer, $iBreadCrumbTruncateLength, $count, $ObjectsPerPage, $iPage, false); ?>
- <?php
- if (count($arFiles) > 0)
- {
- ?>
- <form method="get" name="viewform" id="viewform" action="shareview.php">
- <td class="ContentTableTM3">
- <nobr>
- <div class="ContentTableHeadRight">
- View:
- <select id="mode" name="mode" onchange="submitFolderViewForm();">
- <option value="file" <?php if ($sViewMode == "file") { echo (" selected"); } ?>> List
- <option value="photo" <?php if ($sViewMode == "photo") { echo (" selected"); } ?>> Thumbnails
- </select>
- <input type="hidden" id="page" name="page" value="<?php echo($pageNumber);?>">
- <input type="hidden" id="share" name="share" value="<?php echo($sShare);?>">
- <input type="hidden" id="path" name="path" value="<?php echo(urlEncodeString($sFolderPath));?>">
- </div>
- </nobr>
- </td>
- </form>
- <script type="text/javascript" language="JavaScript">
- function submitFolderViewForm()
- {
- sShare = document.getElementById('share').value;
- sPath = document.getElementById('path').value;
- sUrl = "/folderview/" + sShare + "/" + sPath
- sUrl += "?mode=" + document.getElementById('mode').value +
- "&page=" + document.getElementById('page').value;
- location.href = sUrl;
- }
- </script>
- <?php
- }
- else
- {
- ?>
- <td class="ContentTableTM3"> </td>
- <?php
- }
- ?>
- </div>
- </td>
- <td class="ContentTableTR"><div> </div></td>
- </tr>
- <tr>
- <td class="ContentTableML"><div> </div></td>
- <td class="ContentTableMM" colspan="3">
- <!--<hr align=left style="border: solid gray 0.5px; width: 400px; margin-left: 60px">-->
- <div class="ShareContents">
- <?php
- if ($bPagination)
- {
- echo $sPagination;
- echo (" <br/><div class=\"FolderHR\"> </div>");
- }
-
- // MAC OSX IE requires a different style for the thumbnail contain that does not have a clear in it since
- // it wronlgy inherits this to child elements
- $sNoClear = "";
- if ($btBrowserType == "macosxie")
- {
- $sNoClear = "NoClear";
- }
-
- ?>
- <div class="ThumbnailContain<?php echo($sNoClear);?>">
- <?php
- // since we're in fileview mode, we start the table that we use to display the info in nice fixed width columns
- if ($sViewMode == "file")
- {
- ?>
- <table border="0" cellspacing="0" cellpadding="0" id="FileList" name="FileList" class="FileViewTable">
- <?php
- }
- else
- {
- ?>
- <table width="0" height="0" border="0" cellspacing="0" cellpadding="0" id="FileList" name="FileList"><tr><td></td></tr></table>
- <?php
- }
-
- // we have a file array, let's display the folder/files information
- if (count($arFiles) > 0)
- {
- // Display the current page of files $arFolder) - $iSubFolderCount
- $pageArray = array_slice($arFiles, (($pageNumber-1) * $ObjectsPerPage), $ObjectsPerPage);
-
- $j = 0;
-
- //display the header row for file view mode
- if ($sViewMode == "file")
- {
- ?>
- <tr id="FileListHeader" name="FileListHeader">
- <th class="FileViewFilename FileViewHeader ThumbnailTextfile">Name</th>
- <?php
- if (!$bForceFileAction)
- {
- ?>
- <th class="FileViewAction FileViewHeader ThumbnailTextfile">Action</th>
- <?php
- }
- ?>
- <th class="FileViewSize FileViewHeader ThumbnailTextfile">Size</th>
- <th class="FileViewType FileViewHeader ThumbnailTextfile">Type</th>
- </tr>
- <?php
- }
- // setup the filetype of teh first item.
- $sLastFileType = $pageArray[0][1];
- $iCount = 0;
- foreach($pageArray as $fileName)
- {
- $iCount++;
- $sFile = $fileName[0];
- // we use the info that if the file is a photo or file multiple times, let's only check once.
- $sCurrentFileType = $fileName[1];
- $bFileIsDirectory = false;
- if ($fileName[1] == "0") // per (file types) legend 0 = folder
- {
- $bFileIsDirectory = true;
- }
- $sFileExtension = strrchr($sFile, ".");
- $bSupportedExtension = true;
- if (isValidString($sFileExtension))
- {
- $bSupportedExtension = isSupportedDownloadExtension($sDownloadUnsupportedExtensions, $sFileExtension);
- }
- $sFilenameForDisplay = urlDecodeString($fileName[0]);
- $sFullFilePath = $sFolderPath . "\\" . $sFile;
- // file view file size column. Files (photo and non photo) get their true size, while
- // directories display the text "(Directory)"
- if (!$bFileIsDirectory)
- {
- $sFileSize = str_replace(" ", " ", bytesToHumanReadableUsage(filesize(urlDecodeString($sFullFilePath)),1));
- }
- else
- {
- $sFileSize = ("--");
- }
- $detailslink = "/filedetails/" . $sShare . "/" . urlEncodeString($sFullFilePath);
- // now we have to scramble the format a bit and pop the filename on teh end of the URL.
- $iFileNamePos = strpos($sFullFilePath, strrchr($sFullFilePath, "\\"));
- //$sFile = substr($sFullFilePath, $iFileNamePos+1);
- $sPathNoFile = substr($sFullFilePath, 0, (strlen($sFullFilePath) - strlen($sFile) - 1));
- $downloadlink = "/filesave/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
- $folderlink = "/folderview/" . $sShare . "/" . urlEncodeString($sFolderPath . "\\" . $sFile);
- $thumbnaillink = "/thumbnail/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
- if ($bSupportedExtension)
- {
- $viewlink = "/fileview/" . $sShare . "/" . urlEncodeString($sFullFilePath)
- . "/" . urlEncodeString($fileName[0]) . "?fileNum="
- . ((($pageNumber - 1)*$ObjectsPerPage) + $iCount) . "&page=" . $pageNumber;
- if ($bForceFileAction)
- {
- $openlink = $downloadlink;
- }
- else
- {
- $openlink = "/fileopen/" . $sShare . "/" . urlEncodeString($sPathNoFile) . "/" . urlEncodeString($sFile);
- }
-
- }
- else
- {
- $viewlink = "javascript:alertFileNotAvailable();";
- $openlink = "javascript:alertFileNotAvailable();";
- }
- // we'll target new if this is an internet shortcut, so it opens the link in a new browser
- $sTarget = " target=\"_new\" ";
-
- if ($sViewMode == "photo")
- {
- // check to see current vs last file type
- if ($sLastFileType <> $sCurrentFileType)
- {
- // last file is of different type, let's end the current thumbnail div container and start a new one
- // so that the differnt types appear separated instead of on the same line/.
- echo ("</div><br/><div class=\"FolderHR\"> </div><div class=\"ThumbnailContain" . $sNoClear . "\"><!--xxc-->");
- }
- $sLastFileType = $sCurrentFileType;
-
- if ($bFileIsDirectory)
- {
- // thumbnail view, folder thumbnails
- ?>
- <div class="Folder">
- <div class="FolderImage" onclick="location.href='<?php echo ($folderlink); ?>'"> </div>
- <?php
- }
- else if ($sCurrentFileType == "1") // 1 is a photo per the (file types) legend
- {
- // thumbnail view, photo file thumbnails
- $sTextType = "";
- ?>
- <div class="Thumbnail<?php echo($sViewMode . $sTextType);?>"> <!-- Start of div xx -->
- <div id="TN<?php echo ($iCount); ?>" class="ThumbnailImage<?php echo($imgMode);?>" onmouseover="javascript:(mouseoverSelection('TN<?php echo ($iCount); ?>', 'ThumbnailImage<?php echo($imgMode);?>Hover'));" onmouseout="javascript:(mouseoutSelection('TN<?php echo ($iCount); ?>', 'ThumbnailImage<?php echo($imgMode);?>'));" onclick="javascript:(changeSelection('TN<?php echo ($iCount); ?>', 'ThumbnailImage<?php echo($imgMode);?>Select', '<?php echo ($viewlink);?>', false, '<?php echo ($bSupportedExtension); ?>'));" title="View details for file '<?php echo($sFilenameForDisplay);?>'.">
- <a class=link href="<?php echo ($viewlink);?>" title="View details for file '<?php echo($sFilenameForDisplay);?>'.">
- <img src="<?php echo $thumbnaillink;?>" border="0" alt="<?php echo ($sFilenameForDisplay);?>"/></a>
- </div>
- <?php
- }
- else
- {
- // thumbnail view, non photo file thumbnails
- // icon text is wider and appears to the right in thumbnail view
- $sTextType = "Icon";
- ?>
- <div id="TN<?php echo ($iCount); ?>" class="Thumbnail<?php echo($sViewMode . $sTextType);?>" onmouseover="javascript:(mouseoverSelection('TN<?php echo ($iCount); ?>', 'Thumbnail<?php echo($sViewMode . $sTextType);?>Hover'));" onmouseout="javascript:(mouseoutSelection('TN<?php echo ($iCount); ?>', 'Thumbnail<?php echo($sViewMode . $sTextType);?>'));" onclick="javascript:(changeSelection('TN<?php echo ($iCount); ?>', 'Thumbnail<?php echo($sViewMode . $sTextType);?>Select', '<?php echo ($openlink);?>', true, '<?php echo ($bSupportedExtension); ?>'));" title="Open file '<?php echo($sFilenameForDisplay);?>'."> <!-- Start of div xx -->
- <div class="ThumbnailIcon"><img src="<?php echo $thumbnaillink;?>" border="0" alt="<?php echo ($sFilenameForDisplay);?>" border="0" /></div>
- <?php
- }
- // Different truncation widths for thumbnail view versus file view
- $iFileNameTruncateLength = $iFileNameThumbnailTruncateLength;
- if ($bFileIsDirectory)
- {
- // thumbnail view folder text info and links
- ?>
- <div class="FolderText Clip">
- <a class=link href="<?php echo ($folderlink); ?>" title="Open folder '<?php echo($sFilenameForDisplay);?>'."><?php echo htmlentities(truncate_string($sFilenameForDisplay, $iFolderNameTruncateLength, "...", "right",true)); ?></a>
- </div>
- <?php
- }
- else
- {
- if ($sCurrentFileType == "1") // 1 is a photo per the (file types) legend
- {
- $iFileNameTruncateLength = $iFileNameThumbnailTruncateLength;
- $sFileDetailsLine1 = "<span><a class=\"ThumbnailTextfile\" href=\"" . $viewlink . "\">" . htmlspecialchars(truncate_string($sFilenameForDisplay, $iFileNameTruncateLength, "...", "right", true)) . "</a></span>";
- $sFileDetailsLine2 = "<a class=link href=\"" . htmlentities($downloadlink) . "\" title=\"Save file '" . $sFilenameForDisplay . "'.\">Save</a>";
- $sViewFileLink = $viewlink;
- }
- else
- {
- $iFileNameTruncateLength = $iFileNameThumbIconTruncateLength;
- $sFileDetailsLine1 = "<span style=\"color:#0A2966; font-weight:bold;\">" . htmlspecialchars(truncate_string($sFilenameForDisplay, $iFileNameTruncateLength, "...", "right", true)) . "</span>";
- $sFileDetailsLine2 = $sFileSize;
- $sViewFileLink = $openlink;
- }
- // thumbnail view photo file and non photo file text info and links
- ?>
- <div class="ThumbnailText<?php echo($sViewMode . $sTextType);?>"> <!-- $iFileNameTruncateLength -->
- <?php echo($sFileDetailsLine1);?>
- <br/>
- <?php echo($sFileDetailsLine2);?>
- </div>
- <?php
- }
- echo ("</div> <!-- end of thumnbail div -->");
- }
- else
- {
- // file view file (photo and non photo) text info and links
- $iFileNameTruncateLength = $iFileNameFileViewTruncateLength;
- if ($bFileIsDirectory)
- {
- $sViewLink = $folderlink;
- $sViewTitle = "Open folder ";
- $sViewTarget= "";
- $sViewJscriptLaunch = "javascript:location.href='" . $sViewLink . "';";
- }
- else
- {
- if ($sCurrentFileType == "1") // 1 is a photo per the (file types) legend
- {
- $sViewLink = $viewlink;
- $sViewTitle = "View";
- $sViewTarget= "";
- $sViewJscriptLaunch = "javascript:location.href='" . $sViewLink . "';";
- }
- else
- {
- $sViewLink = $openlink;
- $sViewTitle = "Open";
- $sViewTarget= "_new";
- if (!$bSupportedExtension)
- {
- $sViewJscriptLaunch = "javascript:alertFileNotAvailable();";
- }
- else
- {
- $sViewJscriptLaunch = "javascript:openContentWindow('" . $sViewLink . "');";
- }
- }
-
-
- }
- ?>
- <tr class="FileViewRow">
- <td class="FileViewFilename ThumbnailTextfile" onclick="<?php echo ($sViewJscriptLaunch);?>" title="<?php echo($sViewTitle); ?> '<?php echo($sFilenameForDisplay);?>'.">
- <?php echo(htmlspecialchars(truncate_string($sFilenameForDisplay, $iFileNameFileViewTruncateLength, "...", "right", true)));?>
- </td>
- <?php
- if (!$bForceFileAction)
- {
- ?>
- <td class="FileViewAction ThumbnailTextfile">
- <?php
- if ($bFileIsDirectory)
- {
- // file view directory link information
- ?>
- <a class=link href="<?php echo ($folderlink); ?>" title="Open folder '<?php echo($sFilenameForDisplay);?>'">Open Folder</a>
- <?php
- }
- else
- {
- if ($bSupportedExtension)
- {
- ?>
- <a class=link href="<?php echo (htmlentities($sViewLink));?>" target="<?php echo $sViewTarget;?>" title="<?php echo $sViewTitle;?> '<?php echo($sFilenameForDisplay);?>'."><?php echo $sViewTitle;?></a> |
- <a class=link href="<?php echo (htmlentities($downloadlink));?>" target="<?php echo $sViewTarget;?>" title="Download file '<?php echo($sFilenameForDisplay);?>'.">Download</a>
- <?php
- }
- else
- {
- ?>
- not available
- <?php
- }
- }
- ?>
- </td>
- <?php
- }
- ?>
- <td class="FileViewSize ThumbnailTextfile" onclick="<?php echo ($sViewJscriptLaunch);?>" title="<?php echo($sViewTitle); ?> '<?php echo($sFilenameForDisplay);?>'.">
- <?php
- echo $sFileSize;
- ?>
- </td>
- <td class="FileViewType ThumbnailTextfile" onclick="<?php echo ($sViewJscriptLaunch);?>" title="<?php echo($sViewTitle); ?> '<?php echo($sFilenameForDisplay);?>'.">
- <?php
- $sFileTypeDescription = "";
- try
- {
- $sFileTypeDescription = str_replace(" ", " ", truncate_string($nmSharedPlace->GetFileTypeDescription($sFullFilePath), $iFileTypeFileViewTruncateLength, "...", "right", true));
- }
- catch (exception $ex)
- {
- // log here?
- }
- if (!$bFileIsDirectory)
- {
- echo($sFileTypeDescription);
- }
- else
- {
- echo ("Folder");
- }
- ?>
- </td>
- </tr>
- <?php
- }
- }
- if ($sViewMode == "file")
- {
- echo ("</table>"); // end the table we started for fileview mode
- }
- }
- else
- {
- writeNoContentMessage($bUploadEnabled, $bReadOnly, $sAccessLevel);
- }
- ?>
- </div> <!-- ThumbnailContain -->
- <?php
- if ($bPagination)
- {
- echo (" <div class=\"FolderHR\"> </div>");
- echo $sPagination;
- }
- ?>
- <div class="ClearNbsp"> </div>
- </div> <!--ShareContents-->
- </td>
- <td class="ContentTableMR"> </td>
- </tr>
- <tr>
- <td class="ContentTableBL"> </td>
- <td class="ContentTableBM" colspan="3"> </td>
- <td class="ContentTableBR"> </td>
- </tr>
- </table> <!-- End Folder View Table -->
- </td>
- <td valign="top">
- <?php
- ///////////////////////////////////////////////////
- // Define the tasks for this page
- ///////////////////////////////////////////////////
- $iTaskCount = 0;
- if ($arSharePath[3]) // this is the slideshow true or false information
- {
- $arTasks[$iTaskCount][0] = "View slideshow";
- $arTasks[$iTaskCount][1] = "javascript:openSlideshow('/slideshow/" . $sShare . "/" . urlEncodeString($sFolderPath) . "/');";
- $arTasks[$iTaskCount][2] = "SlideshowLink";
- $arTasks[$iTaskCount][3] = "";
- $iTaskCount++;
- }
- if ($bUploadEnabled && !$bReadOnly && $bLoggedIn)
- {
- $arTasks[$iTaskCount][0] = "Upload a file";
- $arTasks[$iTaskCount][1] = "javascript:openUploadWindow();";
- $arTasks[$iTaskCount][2] = "UploadLink";
- $arTasks[$iTaskCount][3] = "";
- $iTaskCount++;
- }
-
- $bLimitLocations = true;
- require "panels.php";
- ?>
- </td>
- </tr>
- </table>
- <script type="text/javascript">
- var childOpen = false;
- function openUploadWindow()
- {
- childOpen = true;
- openWindow('/uploadform.php?share=<?php echo ($sShare); ?>&path=<?php echo (urlEncodeString($sPath)); ?>&page=');
- }
- var sSelectedId = '';
- var sSelectedClass = '';
-
- writePrepCookie();
-
- startHighlight = function()
- {
- if (document.all && document.getElementById)
- {
- navRoot = document.getElementById('FileList');
-
- // Get a reference to the TBODY element
- tbody = navRoot.childNodes[0];
-
- for (i = 1; i < tbody.childNodes.length; i++)
- {
- node = tbody.childNodes[i];
- if (node.nodeName == "TR")
- {
- node.onmouseover=function()
- {
- if (node.id != 'FileListHeader')
- {
- this.className = "FileViewRowOver";
- }
- }
-
- node.onmouseout=function()
- {
- this.className = this.className.replace("FileViewRowOver", "");
- }
- }
- }
- }
- }
-
- function changeSelection(sId, sClass, sHref, bNewWindow, bSupported)
- {
- if (sSelectedId != '')
- {
- switch (sSelectedClass)
- {
- case 'ThumbnailImageSelect':
- document.getElementById(sSelectedId).className = 'ThumbnailImage';
- break;
- case 'ThumbnailImageBadSelect':
- document.getElementById(sSelectedId).className = 'ThumbnailImageBad';
- break;
- case 'ThumbnailphotoIconSelect':
- document.getElementById(sSelectedId).className = 'ThumbnailphotoIcon';
- break;
- }
- }
- sSelectedId = sId;
- sSelectedClass = sClass;
- document.getElementById(sId).className = sClass;
- if (bSupported)
- {
- if (bNewWindow)
- {
- openContentWindow(sHref);
- }
- else
- {
- location.href = sHref;
- }
- }
- else
- {
- alertFileNotAvailable();
- }
- }
-
- function mouseoverSelection(sId, sClass)
- {
- if (sSelectedId !=sId)
- {
- document.getElementById(sId).className = sClass;
- }
- }
-
- function mouseoutSelection(sId, sClass)
- {
- if (sSelectedId !=sId)
- {
- document.getElementById(sId).className = sClass;
- }
- }
-
- function alertFileNotAvailable()
- {
- alert ("Files with this extension are not available via <?php echo ($sProductNameInformal); ?>");
- }
-
- window.onload = startHighlight;
- </script>
-
- <?php
- ///////////////////////////////////////////////////
- // Finish printing out the HTML to the browser
- ///////////////////////////////////////////////////
- require "_footer.php";
-
- ///////////////////////////////////////////////////
- // Get the next page of thumbnails if one exists
- ///////////////////////////////////////////////////
- if ($pageNumber <= $iMaxPage && $sViewMode == "photo")
- {
- $pageArray = array_slice($arFiles, (($pageNumber) * $ObjectsPerPage), $ObjectsPerPage);
- foreach($pageArray as $fileName)
- {
- $sFullFilePath = $sFolderPath . "\\" . $fileName[0];
- try
- {
- $imgLocation = $nmRaManager->GetThumbnailForFile($sFullFilePath, $iThumbnailWidth,
- $iThumbnailHeight, $sContentBackground);
- }
- catch(com_exception $ex)
- {
- log_activity("get thumbnail for " . $sFullFilePath, "exception", $ex->getMessage());
- }
- }
- log_activity("get thumbnails ahead", "info", "");
- }
- ?>