Your IP : 216.73.216.240
<?php
/**
* @package mod_artsexylightbox_lite - Art Sexy Lightbox Lite
* @author Artetics.com
* @license GNU GPL v2 or later
* @copyright Artetics.com (c) 2017
* @version 1.9.2
**/
defined("_JEXEC") or die("Restricted access");
function getPathData($path,$singleImage,$thumbnailPath,$pattern,$imageCaptions){
$contentArray = array();
$imageDetails = array();
/** Get Thumbnails **/
if (isset($thumbnailPath)) {
$thumbs = array();
$thumb_directory_stream = @ opendir (JPATH_SITE.ASLDS . $thumbnailPath . ASLDS);
if (isset($thumb_directory_stream)) {
while ($entry = readdir ($thumb_directory_stream)) {
if ($entry != '.' && $entry != '..' && modArtSexyLightboxHelper::aslMisImage($thumbnailPath . $entry)) {
$thumbs[$entry] = $entry;
}
}
}
else{
$contentArray["error"] = "Could not open a directory stream for <i>" . JPATH_SITE . ASLDS . $thumbnailPath . ASLDS . "</i>";
return $contentArray;
}
}
/** Read image descriptions **/
if (isset($lang2) && file_exists(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . $lang2 . '.txt')) {
$file_handle = @fopen(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . $lang2 . '.txt', "rb");
} else if (JRequest::getString('lang') && file_exists(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . JRequest::getString('lang') . '.txt')) {
$file_handle = @fopen(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . JRequest::getString('lang') . '.txt', "rb");
} else if (isset($this) && $this->language && file_exists(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . $this->language . '.txt')) {
$file_handle = @fopen(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox_' . $this->language . '.txt', "rb");
} else {
$file_handle = @fopen(JPATH_SITE . ASLDS . $path . ASLDS . 'artsexylightbox.txt', 'rb');
}
$descriptionArray = array();
if (!$file_handle && $imageCaptions) {
$imageCaptionsArray = explode ("\n", $imageCaptions);
foreach ($imageCaptionsArray as $iCI) {
$icArray = explode('=', $iCI);
$descriptionArray[$icArray[0]] = $icArray[1];
}
}
else if($file_handle){
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$parts = explode('=', htmlspecialchars($line_of_text, ENT_QUOTES), 2);
$descriptionArray[$parts[0]] = html_entity_decode($parts[1]);
}
fclose($file_handle);
}
/** Get Large Images **/
$directory_stream = @ opendir (JPATH_SITE.ASLDS . $path . ASLDS);
$filelist = array();
if (isset($directory_stream)) {
while ($entry = readdir ($directory_stream)) {
if ($entry != '.' && $entry != '..' && modArtSexyLightboxHelper::aslMisImage($path . $entry)) {
if (!$pattern || $pattern && preg_match("/" . $pattern . "/i", $entry)) {
$filelist[] = $entry;
}
}
}
}
else{
$contentArray["error"] = "Could not open a directory stream for <i>" . JPATH_SITE . ASLDS . $path . ASLDS . "</i>";
return $contentArray;
}
/** Build Image Array **/
foreach($filelist as $key => $entry){
if ($entry != '.' && $entry != '..' && modArtSexyLightboxHelper::aslMisImage($path . $entry)) {
$imageDetails["sortDate"] = filemtime(JPATH_SITE . ASLDS . str_replace('/', ASLDS, $path) . ASLDS . $entry);
if(isset($thumbs) && isset($thumbs[$entry])){
$imageDetails["previewImage"] = JURI::root() . $thumbnailPath . '/' . $entry;
}
$imageDetails["path"] = JURI::root() . $path . '/' . $entry;
$imageDetails["localPath"] = JPATH_SITE . ASLDS . str_replace('/', ASLDS, $path) . ASLDS . $entry;
if(isset($descriptionArray[$entry])){
$imageDetails["title"] = $descriptionArray[$entry];
if(!$singleImage){
$imageDetails["alt"] = $descriptionArray[$entry];
}
}
elseif(!isset($singleImage)){
$ind = strrpos($path, '/');
$imageDetails["alt"] = substr($path, $ind);
}
$contentArray[] = $imageDetails;
unset($imageDetails);
}
}
return $contentArray;
}
?>