diff --git a/plugins/Galerie/index.php b/plugins/Galerie/index.php index 0ce7431..92d260b 100644 --- a/plugins/Galerie/index.php +++ b/plugins/Galerie/index.php @@ -1,430 +1,445 @@ get("cmslanguage").".conf"); - - $embedded = $this->settings->get("target"); - - $linkprefix = "index.php?cat=".CAT_REQUEST."&page=".PAGE_REQUEST."&"; - if ($embedded == "_blank") { - $linkprefix = "index.php?galtemplate=true&"; - } - if($CMS_CONF->get("modrewrite") == "true") { - $linkprefix = URL_BASE.CAT_REQUEST."/".PAGE_REQUEST.".html?"; - if ($embedded == "_blank") { - $linkprefix = "index.php.html?galtemplate=true&"; - } - } - - $index = NULL; - if (getRequestParam('index', false)) - $index = getRequestParam('index', false); - - - $cat_activ = ""; - if(CAT_REQUEST == basename(dirname($_SERVER['REQUEST_URI'])) and $embedded == "_self") { - $cat_activ = "../"; - } - - if ($this->settings->get("usethumbs") == "true") - $usethumbs = true; - else - $usethumbs = false; - - // Übergebene Parameter überprüfen - $gal_request = $specialchars->replacespecialchars($specialchars->getHtmlEntityDecode($values[0]),false); - if (getRequestParam("gal", false)) - $gal_request = $specialchars->replacespecialchars(getRequestParam("gal", false),false); - - $GALERIE_DIR = BASE_DIR.GALLERIES_DIR_NAME."/".$gal_request."/"; - $GALERIE_DIR_SRC = str_replace("%","%25",URL_BASE.GALLERIES_DIR_NAME."/".$gal_request."/"); - - # keine Galerie angegeben oder Galerie gibts nicht - if (($gal_request == "") || (!file_exists($GALERIE_DIR))) { - global $syntax; - if($gal_request == "") { - return $syntax->createDeadlink($lang_gallery_cms->getLanguageValue0("message_gallerydir_error_0"),$lang_gallery_cms->getLanguageValue0("message_gallerydir_error_0")); - } else { - return $syntax->createDeadlink($specialchars->rebuildSpecialChars($gal_request, false, true), $lang_gallery_cms->getLanguageValue1("message_gallerydir_error_1", $specialchars->rebuildSpecialChars($gal_request, false, true))); - } - } - - # Galerie erzeugen - if (($embedded == "_self") or (getRequestParam('gal', false))) { - - $alldescriptions = false; - if(is_file($GALERIE_DIR."texte.conf")) - $alldescriptions = new Properties($GALERIE_DIR."texte.conf"); - - // Galerieverzeichnis einlesen - $picarray = $this->getPicsAsArray($GALERIE_DIR, array("jpg", "jpeg", "jpe", "gif", "png", "svg")); - $allindexes = array(); - for ($i=1; $i<=count($picarray); $i++) { - array_push($allindexes, $i); - } - // globaler Index - if ((!isset($index)) || (!in_array($index, $allindexes))) - $index = 1; - else - $index = $index; - - // Bestimmung der Positionen - $first = 1; - $last = count($allindexes); - if (!in_array($index-1, $allindexes)) - $previous = $last; - else - $previous = $index-1; - if (!in_array($index+1, $allindexes)) - $next = 1; - else - $next = $index+1; - $template = NULL; - if($this->settings->get("gallerytemplate")) { - if ($embedded == "_self") { - $template = '
'.$this->settings->get("gallerytemplate").'
'; - } else { - $template = $this->settings->get("gallerytemplate"); - if(strrpos("tmp".$value,'{NUMBERMENU}') > 0) { - $template = $value; - } - } - } else { - $template = "{GALLERYMENU}{NUMBERMENU}\n{CURRENTPIC}\n{CURRENTDESCRIPTION}"; - if(strrpos("tmp".$value,'{NUMBERMENU}') > 0) { - $template = $value; - } - } - $html = $template; - - if (count($picarray) == 0) { - $html = preg_replace('/{NUMBERMENU}/', $lang_gallery_cms->getLanguageValue0("message_galleryempty_0"), $html); - } - # Titel der Galerie - $html = preg_replace('/{CURRENTGALLERY}/', $specialchars->rebuildSpecialChars($gal_request,false,true), $html); - if ($usethumbs) { - $html = preg_replace('/{GALLERYMENU}/', " ", $html); - $html = preg_replace('/{NUMBERMENU}/', $this->getThumbnails($picarray,$alldescriptions,$GALERIE_DIR,$GALERIE_DIR_SRC), $html); - $html = preg_replace('/{CURRENTPIC}/', " ", $html); - $html = preg_replace('/{CURRENTDESCRIPTION}/', " ", $html); - $html = preg_replace('/{XOUTOFY}/', " ", $html); - } else { - $html = preg_replace('/{GALLERYMENU}/', $this->getGalleryMenu($picarray,$linkprefix,$gal_request,$index,$first,$previous,$next,$last), $html); - $html = preg_replace('/{NUMBERMENU}/', $this->getNumberMenu($picarray,$linkprefix,$index,$gal_request,$first,$last), $html); - $html = preg_replace('/{CURRENTPIC}/', $this->getCurrentPic($picarray,$index,$GALERIE_DIR_SRC), $html); - if (count($picarray) > 0) { - $html = preg_replace('/{CURRENTDESCRIPTION}/', $this->getCurrentDescription($picarray[$index-1],$picarray,$alldescriptions), $html); - } else { - $html = preg_replace('/{CURRENTDESCRIPTION}/', "", $html); - } - $html = preg_replace('/{XOUTOFY}/', $this->getXoutofY($picarray,$index,$last), $html); - $html = preg_replace('/{CURRENT_INDEX}/', $index, $html); - $html = preg_replace('/{PREVIOUS_INDEX}/', $previous, $html); - $html = preg_replace('/{NEXT_INDEX}/', $next, $html); - } - return $html; - # Galerie Link erzeugen - } else { - $j=0; - if(file_exists($GALERIE_DIR)) { - $handle = opendir($GALERIE_DIR); - while ($file = readdir($handle)) { - if (is_file($GALERIE_DIR.$file) and ($file <> "texte.conf")) { - $j++; - } - } - closedir($handle); - } else { - global $syntax; - // Galerie nicht vorhanden - return $syntax->createDeadlink($specialchars->rebuildSpecialChars($values[0], false, true), $lang_gallery_cms->getLanguageValue1("tooltip_link_gallery_error_1", $specialchars->rebuildSpecialChars($values[0], false, true))); - } - $gal_name = NULL; - if(isset($values[0])) { - $gal_name = $specialchars->rebuildSpecialChars($values[0], false, false); - } - if(isset($values[1])) { - $gal_name = $specialchars->rebuildSpecialChars($values[1], false, false); - } - return "getLanguageValue2("tooltip_link_gallery_2", $specialchars->rebuildSpecialChars($values[0], false, true), $j))."target=\"".$this->settings->get("target")."\">".$gal_name.""; - } - } // function getContent - - - // ------------------------------------------------------------------------------ - // Galeriemenü erzeugen - // ------------------------------------------------------------------------------ - function getGalleryMenu($picarray,$linkprefix,$gal_request,$index,$first,$previous,$next,$last) { - global $lang_gallery_cms; - - // Keine Bilder im Galerieverzeichnis? - if (count($picarray) == 0) - return " "; - - $gallerymenu = ""; - } - - // ------------------------------------------------------------------------------ - // Nummernmenü erzeugen - // ------------------------------------------------------------------------------ - function getNumberMenu($picarray,$linkprefix,$index,$gal_request,$first,$last) { - - // Keine Bilder im Galerieverzeichnis? - if (count($picarray) == 0) - return " "; - - $numbermenu = ""; - return $numbermenu; - } - - // ------------------------------------------------------------------------------ - // Nummernmenü erzeugen - // ------------------------------------------------------------------------------ - function getThumbnails($picarray,$alldescriptions,$GALERIE_DIR,$GALERIE_DIR_SRC) { - global $specialchars; - global $lang_gallery_cms; - - $picsperrow = $this->settings->get("picsperrow"); - if (empty($picsperrow)) $picsperrow = 4; - $thumbs = ""; - $i = 0; - for ($i=0; $igetCurrentDescription($picarray[$i],$picarray,$alldescriptions); - if ($description == "") - $description = " "; - // Neue Tabellenzeile aller picsperrow Zeichen - if (($i > 0) && ($i % $picsperrow == 0)) - $thumbs .= ""; - $thumbs .= ""; - } - while ($i % $picsperrow > 0) { - $thumbs .= ""; - $i++; - } - $thumbs .= "
"; - - if (file_exists($GALERIE_DIR.PREVIEW_DIR_NAME."/".$specialchars->replaceSpecialChars($picarray[$i],false))) { - $thumbs .= "replaceSpecialChars($picarray[$i],true)."\" target=\"_blank\" title=\"".$lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray[$i],true,true))."\">replaceSpecialChars($picarray[$i],true)."\" alt=\"".$specialchars->rebuildSpecialChars($picarray[$i],true,true)."\" class=\"thumbnail\" />
"; - } else { - $thumbs .= '
replaceSpecialChars($picarray[$i],true).'" target="_blank" title="'.$lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray[$i],true,true)).'">'.$lang_gallery_cms->getLanguageValue0('message_gallery_no_preview').'
'; - } - $thumbs .= $description - ."
 
"; - // Rückgabe der Thumbnails - return $thumbs; - } - - // ------------------------------------------------------------------------------ - // Aktuelles Bild anzeigen - // ------------------------------------------------------------------------------ - function getCurrentPic($picarray,$index,$GALERIE_DIR_SRC) { - global $specialchars; - global $lang_gallery_cms; - - // Keine Bilder im Galerieverzeichnis? - if (count($picarray) == 0) - return " "; - // Link zur Vollbildansicht öffnen - $currentpic = "replaceSpecialChars($picarray[$index-1],true)."\" target=\"_blank\" title=\"".$lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray[$index-1],true,true))."\">"; - $currentpic .= "replaceSpecialChars($picarray[$index-1],true)."\" alt=\"".$lang_gallery_cms->getLanguageValue1("alttext_galleryimage_1", $specialchars->rebuildSpecialChars($picarray[$index-1],true,true))."\" />"; - // Link zur Vollbildansicht schliessen - $currentpic .= ""; - // Rückgabe des Bildes - return $currentpic; - } - - // ------------------------------------------------------------------------------ - // Beschreibung zum aktuellen Bild anzeigen - // ------------------------------------------------------------------------------ - function getCurrentDescription($picname,$picarray,$alldescriptions) { - global $specialchars; - - if(!$alldescriptions) - return " "; - // Keine Bilder im Galerieverzeichnis? - if (count($picarray) == 0) - return " "; - // Bildbeschreibung einlesen - $description = $alldescriptions->get($picname); - if(strlen($description) > 0) { - return $specialchars->rebuildSpecialChars($description,false,true); - } else { - return " "; - } - } - - // ------------------------------------------------------------------------------ - // Position in der Galerie anzeigen - // ------------------------------------------------------------------------------ - function getXoutofY($picarray,$index,$last) { - global $lang_gallery_cms; - - // Keine Bilder im Galerieverzeichnis? - if (count($picarray) == 0) - return " "; - return $lang_gallery_cms->getLanguageValue2("message_gallery_xoutofy_2", $index, $last); - } - - // ------------------------------------------------------------------------------ - // Auslesen des übergebenen Galerieverzeichnisses, Rückgabe als Array - // ------------------------------------------------------------------------------ - function getPicsAsArray($dir, $filetypes) { - $picarray = array(); - $currentdir = opendir($dir); - // Alle Dateien des übergebenen Verzeichnisses einlesen... - while ($file = readdir($currentdir)){ - if(isValidDirOrFile($file) and (in_array(strtolower(substr(strrchr($file, "."), 1, strlen(strrchr($file, "."))-1)), $filetypes))) { - // ...wenn alles passt, ans Bilder-Array anhängen - $picarray[] = $file; - } - } - closedir($currentdir); - sort($picarray); - return $picarray; - } - - // ------------------------------------------------------------------------------ - // Hilfsfunktion: "title"-Attribut zusammenbauen (oder nicht, wenn nicht konfiguriert) - // ------------------------------------------------------------------------------ - /* - function getTitleAttribute($value) { - global $CMS_CONF; - if ($CMS_CONF->get("showsyntaxtooltips") == "true") { - return " title=\"".$value."\""; - } - return ""; - }*/ - - /*************************************************************** - * - * Gibt die Konfigurationsoptionen als Array zurück. - * - ***************************************************************/ - function getConfig() { - global $lang_gallery_admin; - - // Rückgabe-Array initialisieren - // Das muß auf jeden Fall geschehen! - $config = array(); - - $config['picsperrow'] = array( - "type" => "text", - "maxlength" => "2", - "size" => "3", - "description" => $lang_gallery_admin->get("config_gallery_picsperrow"), - "regex" => "/^[1-9][0-9]?/", - "regex_error" => $lang_gallery_admin->get("config_gallery_picsperrow_regex_error") - ); - $config['usethumbs'] = array( - "type" => "checkbox", - "description" => $lang_gallery_admin->get("config_gallery_usethumbs") - ); - $config['target'] = array( - "type" => "radio", - "description" => $lang_gallery_admin->get("config_gallery_target"), - "descriptions" => array( - "_self" => $lang_gallery_admin->get("config_gallery_target_self"), - "_blank" => $lang_gallery_admin->get("config_gallery_target_blank"), - ) - ); - $config['gallerytemplate'] = array( - "type" => "textarea", - "cols" => "50", - "rows" => "7", - "description" => $lang_gallery_admin->get("gallery_placeholders"), - ); - - // Nicht vergessen: Das gesamte Array zurückgeben - return $config; - } // function getConfig - - - /*************************************************************** - * - * Gibt die Plugin-Infos als Array zurück - * - ***************************************************************/ - - - function getInfo() { - - global $ADMIN_CONF; - global $lang_gallery_admin; - - $dir = PLUGIN_DIR_REL."Galerie/"; - $language = $ADMIN_CONF->get("language"); - $lang_gallery_admin = new Properties($dir."sprachen/admin_language_".$language.".conf",false); - if(!isset($lang_gallery_admin->properties['readonly'])) { - die($lang_gallery_admin->properties['error']); - } - - $info = array( - // Plugin-Name - "".$lang_gallery_admin->get("config_gallery_plugin_name")." \$Revision: 149 $", - // CMS-Version - "1.12", - // Kurzbeschreibung - $lang_gallery_admin->get("config_gallery_plugin_desc"), - // Name des Autors - "mozilo", - // Download-URL - "http://mozilo.de", - # Platzhalter => Kurzbeschreibung - array('{Galerie|}' => $lang_gallery_admin->get("config_gallery_plugin_name")) - ); - return $info; - } // function getInfo + /** + * ************************************************************* + * + * Gibt den HTML-Code zurück, mit dem die Plugin-Variable ersetzt + * wird. + * + * ************************************************************* + */ + function getContent($value) { + $values = explode(",", $value); + global $CMS_CONF; + global $specialchars; + global $GALLERY_CONF; + global $LAYOUT_DIR; + global $lang_gallery_cms; + + $dir = PLUGIN_DIR_REL . "Galerie/"; + $lang_gallery_cms = new Language($dir . "sprachen/cms_language_" . $CMS_CONF->get("cmslanguage") . ".conf"); + + $embedded = $this->settings->get("target"); + + $linkprefix = "index.php?cat=" . CAT_REQUEST . "&page=" . PAGE_REQUEST . "&"; + if ($embedded == "_blank") { + $linkprefix = "index.php?galtemplate=true&"; + } + if ($CMS_CONF->get("modrewrite") == "true") { + $linkprefix = URL_BASE . CAT_REQUEST . "/" . PAGE_REQUEST . ".html?"; + if ($embedded == "_blank") { + $linkprefix = "index.php.html?galtemplate=true&"; + } + } + + $index = NULL; + if (getRequestParam('index', false)) + $index = getRequestParam('index', false); + + $cat_activ = ""; + if (CAT_REQUEST == basename(dirname($_SERVER ['REQUEST_URI'])) and $embedded == "_self") { + $cat_activ = "../"; + } + + if ($this->settings->get("usethumbs") == "true") + $usethumbs = true; + else + $usethumbs = false; + + // Übergebene Parameter überprüfen + $gal_request = $specialchars->replacespecialchars($specialchars->getHtmlEntityDecode($values [0]), false); + if (getRequestParam("gal", false)) + $gal_request = $specialchars->replacespecialchars(getRequestParam("gal", false), false); + + $GALERIE_DIR = BASE_DIR . GALLERIES_DIR_NAME . "/" . $gal_request . "/"; + $GALERIE_DIR_SRC = str_replace("%", "%25", URL_BASE . GALLERIES_DIR_NAME . "/" . $gal_request . "/"); + + // keine Galerie angegeben oder Galerie gibts nicht + if (($gal_request == "") || (!file_exists($GALERIE_DIR))) { + global $syntax; + if ($gal_request == "") { + return $syntax->createDeadlink($lang_gallery_cms->getLanguageValue0("message_gallerydir_error_0"), $lang_gallery_cms->getLanguageValue0("message_gallerydir_error_0")); + } else { + return $syntax->createDeadlink($specialchars->rebuildSpecialChars($gal_request, false, true), $lang_gallery_cms->getLanguageValue1("message_gallerydir_error_1", $specialchars->rebuildSpecialChars($gal_request, false, true))); + } + } + + // Galerie erzeugen + if (($embedded == "_self") or (getRequestParam('gal', false))) { + + $alldescriptions = false; + if (is_file($GALERIE_DIR . "texte.conf")) + $alldescriptions = new Properties($GALERIE_DIR . "texte.conf"); + + // Galerieverzeichnis einlesen + $picarray = $this->getPicsAsArray($GALERIE_DIR, array( + "jpg", + "jpeg", + "jpe", + "gif", + "png", + "svg" + )); + $allindexes = array(); + for($i = 1; $i <= count($picarray); $i++) { + array_push($allindexes, $i); + } + // globaler Index + if ((!isset($index)) || (!in_array($index, $allindexes))) + $index = 1; + else + $index = $index; + + // Bestimmung der Positionen + $first = 1; + $last = count($allindexes); + if (!in_array($index - 1, $allindexes)) + $previous = $last; + else + $previous = $index - 1; + if (!in_array($index + 1, $allindexes)) + $next = 1; + else + $next = $index + 1; + $template = NULL; + if ($this->settings->get("gallerytemplate")) { + if ($embedded == "_self") { + $template = '
' . $this->settings->get("gallerytemplate") . '
'; + } else { + $template = $this->settings->get("gallerytemplate"); + if (strrpos("tmp" . $value, '{NUMBERMENU}') > 0) { + $template = $value; + } + } + } else { + $template = "{GALLERYMENU}{NUMBERMENU}\n{CURRENTPIC}\n{CURRENTDESCRIPTION}"; + if (strrpos("tmp" . $value, '{NUMBERMENU}') > 0) { + $template = $value; + } + } + $html = $template; + + if (count($picarray) == 0) { + $html = preg_replace('/{NUMBERMENU}/', $lang_gallery_cms->getLanguageValue0("message_galleryempty_0"), $html); + } + // Titel der Galerie + $html = preg_replace('/{CURRENTGALLERY}/', $specialchars->rebuildSpecialChars($gal_request, false, true), $html); + if ($usethumbs) { + $html = preg_replace('/{GALLERYMENU}/', " ", $html); + $html = preg_replace('/{NUMBERMENU}/', $this->getThumbnails($picarray, $alldescriptions, $GALERIE_DIR, $GALERIE_DIR_SRC), $html); + $html = preg_replace('/{CURRENTPIC}/', " ", $html); + $html = preg_replace('/{CURRENTDESCRIPTION}/', " ", $html); + $html = preg_replace('/{XOUTOFY}/', " ", $html); + } else { + $html = preg_replace('/{GALLERYMENU}/', $this->getGalleryMenu($picarray, $linkprefix, $gal_request, $index, $first, $previous, $next, $last), $html); + $html = preg_replace('/{NUMBERMENU}/', $this->getNumberMenu($picarray, $linkprefix, $index, $gal_request, $first, $last), $html); + $html = preg_replace('/{CURRENTPIC}/', $this->getCurrentPic($picarray, $index, $GALERIE_DIR_SRC), $html); + if (count($picarray) > 0) { + $html = preg_replace('/{CURRENTDESCRIPTION}/', $this->getCurrentDescription($picarray [$index - 1], $picarray, $alldescriptions), $html); + } else { + $html = preg_replace('/{CURRENTDESCRIPTION}/', "", $html); + } + $html = preg_replace('/{XOUTOFY}/', $this->getXoutofY($picarray, $index, $last), $html); + $html = preg_replace('/{CURRENT_INDEX}/', $index, $html); + $html = preg_replace('/{PREVIOUS_INDEX}/', $previous, $html); + $html = preg_replace('/{NEXT_INDEX}/', $next, $html); + } + return $html; + // Galerie Link erzeugen + } else { + $j = 0; + if (file_exists($GALERIE_DIR)) { + $handle = opendir($GALERIE_DIR); + while ($file = readdir($handle)) { + if (is_file($GALERIE_DIR . $file) and ($file != "texte.conf")) { + $j++; + } + } + closedir($handle); + } else { + global $syntax; + // Galerie nicht vorhanden + return $syntax->createDeadlink($specialchars->rebuildSpecialChars($values [0], false, true), $lang_gallery_cms->getLanguageValue1("tooltip_link_gallery_error_1", $specialchars->rebuildSpecialChars($values [0], false, true))); + } + $gal_name = NULL; + if (isset($values [0])) { + $gal_name = $specialchars->rebuildSpecialChars($values [0], false, false); + } + if (isset($values [1])) { + $gal_name = $specialchars->rebuildSpecialChars($values [1], false, false); + } + return "getLanguageValue2("tooltip_link_gallery_2", $specialchars->rebuildSpecialChars($values [0], false, true), $j)) . "target=\"" . $this->settings->get("target") . "\">" . $gal_name . ""; + } + } + + // function getContent + + // ------------------------------------------------------------------------------ + // Galeriemenü erzeugen + // ------------------------------------------------------------------------------ + function getGalleryMenu($picarray, $linkprefix, $gal_request, $index, $first, $previous, $next, $last) { + global $lang_gallery_cms; + + // Keine Bilder im Galerieverzeichnis? + if (count($picarray) == 0) + return " "; + + $gallerymenu = ""; + } + + // ------------------------------------------------------------------------------ + // Nummernmenü erzeugen + // ------------------------------------------------------------------------------ + function getNumberMenu($picarray, $linkprefix, $index, $gal_request, $first, $last) { + + // Keine Bilder im Galerieverzeichnis? + if (count($picarray) == 0) + return " "; + + $numbermenu = ""; + return $numbermenu; + } + + // ------------------------------------------------------------------------------ + // Nummernmenü erzeugen + // ------------------------------------------------------------------------------ + function getThumbnails($picarray, $alldescriptions, $GALERIE_DIR, $GALERIE_DIR_SRC) { + global $specialchars; + global $lang_gallery_cms; + + $picsperrow = $this->settings->get("picsperrow"); + if (empty($picsperrow)) + $picsperrow = 4; + $thumbs = ""; + $i = 0; + for($i = 0; $i < count($picarray); $i++) { + // Bildbeschreibung holen + $description = $this->getCurrentDescription($picarray [$i], $picarray, $alldescriptions); + if ($description == "") + $description = " "; + // Neue Tabellenzeile aller picsperrow Zeichen + if (($i > 0) && ($i % $picsperrow == 0)) + $thumbs .= ""; + $thumbs .= ""; + } + while ($i % $picsperrow > 0) { + $thumbs .= ""; + $i++; + } + $thumbs .= "
"; + + if (file_exists($GALERIE_DIR . PREVIEW_DIR_NAME . "/" . $specialchars->replaceSpecialChars($picarray [$i], false))) { + $thumbs .= "replaceSpecialChars($picarray [$i], true) . "\" target=\"_blank\" title=\"" . $lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray [$i], true, true)) . "\">replaceSpecialChars($picarray [$i], true) . "\" alt=\"" . $specialchars->rebuildSpecialChars($picarray [$i], true, true) . "\" class=\"thumbnail\" />
"; + } else { + $thumbs .= '
replaceSpecialChars($picarray [$i], true) . '" target="_blank" title="' . $lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray [$i], true, true)) . '">' . $lang_gallery_cms->getLanguageValue0('message_gallery_no_preview') . '
'; + } + $thumbs .= $description . "
 
"; + // Rückgabe der Thumbnails + return $thumbs; + } + + // ------------------------------------------------------------------------------ + // Aktuelles Bild anzeigen + // ------------------------------------------------------------------------------ + function getCurrentPic($picarray, $index, $GALERIE_DIR_SRC) { + global $specialchars; + global $lang_gallery_cms; + + // Keine Bilder im Galerieverzeichnis? + if (count($picarray) == 0) + return " "; + // Link zur Vollbildansicht öffnen + $currentpic = "replaceSpecialChars($picarray [$index - 1], true) . "\" target=\"_blank\" title=\"" . $lang_gallery_cms->getLanguageValue1("tooltip_gallery_fullscreen_1", $specialchars->rebuildSpecialChars($picarray [$index - 1], true, true)) . "\">"; + $currentpic .= "replaceSpecialChars($picarray [$index - 1], true) . "\" alt=\"" . $lang_gallery_cms->getLanguageValue1("alttext_galleryimage_1", $specialchars->rebuildSpecialChars($picarray [$index - 1], true, true)) . "\" />"; + // Link zur Vollbildansicht schliessen + $currentpic .= ""; + // Rückgabe des Bildes + return $currentpic; + } + + // ------------------------------------------------------------------------------ + // Beschreibung zum aktuellen Bild anzeigen + // ------------------------------------------------------------------------------ + function getCurrentDescription($picname, $picarray, $alldescriptions) { + global $specialchars; + + if (!$alldescriptions) + return " "; + // Keine Bilder im Galerieverzeichnis? + if (count($picarray) == 0) + return " "; + // Bildbeschreibung einlesen + $description = $alldescriptions->get($picname); + if (isset($description) && strlen($description) > 0) { + return $specialchars->rebuildSpecialChars($description, false, true); + } else { + return " "; + } + } + + // ------------------------------------------------------------------------------ + // Position in der Galerie anzeigen + // ------------------------------------------------------------------------------ + function getXoutofY($picarray, $index, $last) { + global $lang_gallery_cms; + + // Keine Bilder im Galerieverzeichnis? + if (count($picarray) == 0) + return " "; + return $lang_gallery_cms->getLanguageValue2("message_gallery_xoutofy_2", $index, $last); + } + + // ------------------------------------------------------------------------------ + // Auslesen des übergebenen Galerieverzeichnisses, Rückgabe als Array + // ------------------------------------------------------------------------------ + function getPicsAsArray($dir, $filetypes) { + $picarray = array(); + $currentdir = opendir($dir); + // Alle Dateien des übergebenen Verzeichnisses einlesen... + while ($file = readdir($currentdir)) { + if (isValidDirOrFile($file) and (in_array(strtolower(substr(strrchr($file, "."), 1, strlen(strrchr($file, ".")) - 1)), $filetypes))) { + // ...wenn alles passt, ans Bilder-Array anhängen + $picarray [] = $file; + } + } + closedir($currentdir); + sort($picarray); + return $picarray; + } + + // ------------------------------------------------------------------------------ + // Hilfsfunktion: "title"-Attribut zusammenbauen (oder nicht, wenn nicht konfiguriert) + // ------------------------------------------------------------------------------ + /* + * function getTitleAttribute($value) { + * global $CMS_CONF; + * if ($CMS_CONF->get("showsyntaxtooltips") == "true") { + * return " title=\"".$value."\""; + * } + * return ""; + * } + */ + + /** + * ************************************************************* + * + * Gibt die Konfigurationsoptionen als Array zurück. + * + * ************************************************************* + */ + function getConfig() { + global $lang_gallery_admin; + + // Rückgabe-Array initialisieren + // Das muß auf jeden Fall geschehen! + $config = array(); + + $config ['picsperrow'] = array( + "type" => "text", + "maxlength" => "2", + "size" => "3", + "description" => $lang_gallery_admin->get("config_gallery_picsperrow"), + "regex" => "/^[1-9][0-9]?/", + "regex_error" => $lang_gallery_admin->get("config_gallery_picsperrow_regex_error") + ); + $config ['usethumbs'] = array( + "type" => "checkbox", + "description" => $lang_gallery_admin->get("config_gallery_usethumbs") + ); + $config ['target'] = array( + "type" => "radio", + "description" => $lang_gallery_admin->get("config_gallery_target"), + "descriptions" => array( + "_self" => $lang_gallery_admin->get("config_gallery_target_self"), + "_blank" => $lang_gallery_admin->get("config_gallery_target_blank") + ) + ); + $config ['gallerytemplate'] = array( + "type" => "textarea", + "cols" => "50", + "rows" => "7", + "description" => $lang_gallery_admin->get("gallery_placeholders") + ); + + // Nicht vergessen: Das gesamte Array zurückgeben + return $config; + } + + // function getConfig + + /** + * ************************************************************* + * + * Gibt die Plugin-Infos als Array zurück + * + * ************************************************************* + */ + function getInfo() { + global $ADMIN_CONF; + global $lang_gallery_admin; + + $dir = PLUGIN_DIR_REL . "Galerie/"; + $language = $ADMIN_CONF->get("language"); + $lang_gallery_admin = new Properties($dir . "sprachen/admin_language_" . $language . ".conf", false); + if (!isset($lang_gallery_admin->properties ['readonly'])) { + die($lang_gallery_admin->properties ['error']); + } + + $info = array( + // Plugin-Name + "" . $lang_gallery_admin->get("config_gallery_plugin_name") . " \$Revision: 149 $", + // CMS-Version + "1.12", + // Kurzbeschreibung + $lang_gallery_admin->get("config_gallery_plugin_desc"), + // Name des Autors + "mozilo", + // Download-URL + "http://mozilo.de", + // Platzhalter => Kurzbeschreibung + array( + '{Galerie|}' => $lang_gallery_admin->get("config_gallery_plugin_name") + ) + ); + return $info; + } + + // function getInfo } // class plugin ?> \ No newline at end of file