get('enable_photo_module') === 0) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); // => EXIT } elseif ((int) $gSettingsManager->get('enable_photo_module') === 2) { // nur eingeloggte Benutzer duerfen auf das Modul zugreifen require(__DIR__ . '/../../system/login_valid.php'); } // Initialize and check the parameters $getPhotoId = admFuncVariableIsValid($_GET, 'pho_id', 'int'); $getHeadline = admFuncVariableIsValid($_GET, 'headline', 'string', array('defaultValue' => $gL10n->get('PHO_PHOTO_ALBUMS'))); $getStart = admFuncVariableIsValid($_GET, 'start', 'int'); $getStartThumbnail = admFuncVariableIsValid($_GET, 'start_thumbnail', 'int', array('defaultValue' => 1)); $getPhotoNr = admFuncVariableIsValid($_GET, 'photo_nr', 'int'); unset($_SESSION['photo_album_request'], $_SESSION['ecard_request']); // Fotoalbums-Objekt erzeugen oder aus Session lesen if (isset($_SESSION['photo_album']) && (int) $_SESSION['photo_album']->getValue('pho_id') === $getPhotoId) { $photoAlbum =& $_SESSION['photo_album']; } else { // einlesen des Albums falls noch nicht in Session gespeichert $photoAlbum = new TablePhotos($gDb); if ($getPhotoId > 0) { $photoAlbum->readDataById($getPhotoId); } $_SESSION['photo_album'] = $photoAlbum; } // set headline of module if ($getPhotoId > 0) { // check if the current user could view this photo album if(!$photoAlbum->isVisible()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); // => EXIT } $headline = $photoAlbum->getValue('pho_name'); } else { $headline = $getHeadline; } // Wurde keine Album uebergeben kann das Navigationsstack zurueckgesetzt werden if ($getPhotoId === 0) { $gNavigation->clear(); } // URL auf Navigationstack ablegen $gNavigation->addUrl(CURRENT_URL, $headline); // create html page object $page = new HtmlPage($headline); $page->enableModal(); // add rss feed to photos if ($gSettingsManager->getBool('enable_rss')) { $page->addRssFile( safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/rss_photos.php', array('headline' => $getHeadline)), $gL10n->get('SYS_RSS_FEED_FOR_VAR', array($gCurrentOrganization->getValue('org_longname'). ' - '.$getHeadline)) ); } if ($photoAlbum->isEditable()) { $page->addJavascript(' /** * rotate image * @param {int} img * @param {string} direction */ function imgrotate(img, direction) { $.get("'.ADMIDIO_URL.FOLDER_MODULES.'/photos/photo_function.php", {pho_id: '.$getPhotoId.', photo_nr: img, job: "rotate", direction: direction}, function(data) { // Anhängen der Zufallszahl ist nötig um den Browsercache zu überlisten $("#img_" + img).attr("src", "'.safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/photo_show.php', array('pho_id' => $getPhotoId, 'thumb' => 1)).'&photo_nr=" + img + "&rand=" + Math.random()); return false; }); }' ); } // integrate bootstrap ekko lightbox addon if ((int) $gSettingsManager->get('photo_show_mode') === 1) { $page->addCssFile(ADMIDIO_URL . FOLDER_LIBS_CLIENT . '/lightbox/dist/ekko-lightbox.css'); $page->addJavascriptFile(ADMIDIO_URL . FOLDER_LIBS_CLIENT . '/lightbox/dist/ekko-lightbox.js'); $page->addJavascript(' $(document).delegate("*[data-toggle=\"lightbox\"]", "click", function(event) { event.preventDefault(); $(this).ekkoLightbox(); });', true ); } $page->addJavascript(' $("body").on("hidden.bs.modal", ".modal", function() { $(this).removeData("bs.modal"); location.reload(); }); $("#menu_item_upload_photo").attr("data-toggle", "modal"); $("#menu_item_upload_photo").attr("data-target", "#admidio_modal"); $(".admidio-btn-album-upload").click(function(event) { $.get("'.safeUrl(ADMIDIO_URL.'/adm_program/system/file_upload.php', array('module' => 'photos')).'&id=" + $(this).attr("data-pho-id"), function(response) { $(".modal-content").html(response); $("#admidio_modal").modal(); }); });', true ); // if a photo number was committed then simulate a left mouse click if ($getPhotoNr > 0) { $page->addJavascript('$("#img_'.$getPhotoNr.'").trigger("click");', true); } // get module menu $photosMenu = $page->getMenu(); if ($photoAlbum->getValue('pho_id') > 0) { $photosMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png'); } if ($gCurrentUser->editPhotoRight()) { // show link to create new album $photosMenu->addItem( 'menu_item_new_album', safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/photo_album_new.php', array('mode' => 'new', 'pho_id' => $getPhotoId)), $gL10n->get('PHO_CREATE_ALBUM'), 'add.png' ); if ($getPhotoId > 0) { // show link to upload photos $photosMenu->addItem( 'menu_item_upload_photo', safeUrl(ADMIDIO_URL.'/adm_program/system/file_upload.php', array('module' => 'photos', 'id' => $getPhotoId)), $gL10n->get('PHO_UPLOAD_PHOTOS'), 'photo_upload.png' ); } } // show link to download photos if enabled if ($gSettingsManager->getBool('photo_download_enabled') && $photoAlbum->getValue('pho_quantity') > 0) { // show link to download photos $photosMenu->addItem( 'menu_item_download_photos', safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/photo_download.php', array('pho_id' => $getPhotoId)), $gL10n->get('SYS_DOWNLOAD_ALBUM'), 'page_white_compressed.png' ); } if ($gCurrentUser->isAdministrator()) { // show link to system preferences of photos $photosMenu->addItem( 'menu_item_preferences_photos', safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/preferences/preferences.php', array('show_option' => 'photos')), $gL10n->get('SYS_MODULE_PREFERENCES'), 'options.png', 'right' ); } // Breadcrump bauen $navilink = ''; $phoParentId = $photoAlbum->getValue('pho_pho_id_parent'); $photoAlbumParent = new TablePhotos($gDb); while ($phoParentId > 0) { // Einlesen des Eltern Albums $photoAlbumParent->readDataById($phoParentId); // Link zusammensetzen $navilink = '
  • '. $photoAlbumParent->getValue('pho_name').'
  • '.$navilink; // Elternveranst $phoParentId = $photoAlbumParent->getValue('pho_pho_id_parent'); } if ($getPhotoId > 0) { // Ausgabe des Linkpfads $page->addHtml(' '); } /*************************THUMBNAILS**********************************/ // Nur wenn uebergebenes Album Bilder enthaelt if ($photoAlbum->getValue('pho_quantity') > 0) { $photoThumbnailTable = ''; $firstPhotoNr = 1; $lastPhotoNr = $gSettingsManager->getInt('photo_thumbs_page'); // Wenn Bild übergeben wurde richtige Albenseite öffnen if ($getPhotoNr > 0) { $firstPhotoNr = (round(($getPhotoNr - 1) / $gSettingsManager->getInt('photo_thumbs_page')) * $gSettingsManager->getInt('photo_thumbs_page')) + 1; $lastPhotoNr = $firstPhotoNr + $gSettingsManager->getInt('photo_thumbs_page') - 1; } // create thumbnail container $page->addHtml('
    '); for ($actThumbnail = $firstPhotoNr; $actThumbnail <= $lastPhotoNr && $actThumbnail <= $photoAlbum->getValue('pho_quantity'); ++$actThumbnail) { if ($actThumbnail <= $photoAlbum->getValue('pho_quantity')) { $photoThumbnailTable .= '
    '; // Popup window if ((int) $gSettingsManager->get('photo_show_mode') === 0) { $photoThumbnailTable .= ' '.$actThumbnail.''; } // Bootstrap modal with lightbox elseif ((int) $gSettingsManager->get('photo_show_mode') === 1) { $photoThumbnailTable .= ' '.$actThumbnail.''; } // Same window elseif ((int) $gSettingsManager->get('photo_show_mode') === 2) { $photoThumbnailTable .= ' '; } if ($gCurrentUser->editPhotoRight() || ($gValidLogin && $gSettingsManager->getBool('enable_ecard_module')) || $gSettingsManager->getBool('photo_download_enabled')) { $photoThumbnailTable .= '
    '; } // Buttons fuer Moderatoren if ($gCurrentUser->editPhotoRight()) { $photoThumbnailTable .= ' '.$gL10n->get('PHO_PHOTO_ROTATE_LEFT').' '.$gL10n->get('PHO_PHOTO_ROTATE_RIGHT').' '.$gL10n->get('SYS_DELETE').''; } if ($gValidLogin && $gSettingsManager->getBool('enable_ecard_module')) { $photoThumbnailTable .= ' '.$gL10n->get('PHO_PHOTO_SEND_ECARD').''; } if ($gSettingsManager->getBool('photo_download_enabled')) { // show link to download photo $photoThumbnailTable .= ' '.$gL10n->get('SYS_DOWNLOAD_PHOTO').''; } if ($gCurrentUser->editPhotoRight() || ($gValidLogin && $gSettingsManager->getBool('enable_ecard_module')) || $gSettingsManager->getBool('photo_download_enabled')) { $photoThumbnailTable .= '
    '; } $photoThumbnailTable .= '
    '; } } // the lightbox should be able to go through the whole album, therefore we must // integrate links to the photos of the album pages to this page and container but hidden if ((int) $gSettingsManager->get('photo_show_mode') === 1) { $photoThumbnailTableShown = false; for ($hiddenPhotoNr = 1; $hiddenPhotoNr <= $photoAlbum->getValue('pho_quantity'); ++$hiddenPhotoNr) { if ($hiddenPhotoNr >= $firstPhotoNr && $hiddenPhotoNr <= $actThumbnail) { if (!$photoThumbnailTableShown) { $page->addHtml($photoThumbnailTable); $photoThumbnailTableShown = true; } } else { $page->addHtml(' '); } } $page->addHtml('
    '); // close album-container } else { // show photos if lightbox is not used $photoThumbnailTable .= ''; // close album-container $page->addHtml($photoThumbnailTable); } // show additional album information $datePeriod = $photoAlbum->getValue('pho_begin', $gSettingsManager->getString('system_date')); if ($photoAlbum->getValue('pho_end') !== $photoAlbum->getValue('pho_begin') && strlen($photoAlbum->getValue('pho_end')) > 0) { $datePeriod .= ' '.$gL10n->get('SYS_DATE_TO').' '.$photoAlbum->getValue('pho_end', $gSettingsManager->getString('system_date')); } $page->addHtml('
    '.$gL10n->get('SYS_DATE').'
    '.$datePeriod.'
    '.$gL10n->get('PHO_PHOTOGRAPHER').'
    '.$photoAlbum->getValue('pho_photographers').'
    '); // show information about user who creates the recordset and changed it $page->addHtml(admFuncShowCreateChangeInfoById( (int) $photoAlbum->getValue('pho_usr_id_create'), $photoAlbum->getValue('pho_timestamp_create'), (int) $photoAlbum->getValue('pho_usr_id_change'), $photoAlbum->getValue('pho_timestamp_change') )); // show page navigations through thumbnails $page->addHtml(admFuncGeneratePagination( safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/photos.php', array('pho_id' => $photoAlbum->getValue('pho_id'))), (int) $photoAlbum->getValue('pho_quantity'), $gSettingsManager->getInt('photo_thumbs_page'), $getPhotoNr, true, 'photo_nr' )); } /************************Albumliste*************************************/ // erfassen der Alben die in der Albentabelle ausgegeben werden sollen $sql = 'SELECT * FROM '.TBL_PHOTOS.' WHERE pho_org_id = ? -- $gCurrentOrganization->getValue(\'org_id\')'; $queryParams = array($gCurrentOrganization->getValue('org_id')); if ($getPhotoId === 0) { $sql .= ' AND (pho_pho_id_parent IS NULL) '; } if ($getPhotoId > 0) { $sql .= ' AND pho_pho_id_parent = ? -- $getPhotoId'; $queryParams[] = $getPhotoId; } if (!$gCurrentUser->editPhotoRight()) { $sql .= ' AND pho_locked = 0 '; } $sql .= ' ORDER BY pho_begin DESC'; $albumStatement = $gDb->queryPrepared($sql, $queryParams); $albumList = $albumStatement->fetchAll(); // Gesamtzahl der auszugebenden Alben $albumsCount = $albumStatement->rowCount(); // falls zum aktuellen Album Fotos und Unteralben existieren, // dann einen Trennstrich zeichnen if ($albumsCount > 0 && $photoAlbum->getValue('pho_quantity') > 0) { $page->addHtml('
    '); } $childPhotoAlbum = new TablePhotos($gDb); $page->addHtml('
    '); for ($x = $getStart; $x <= $getStart + $gSettingsManager->getInt('photo_albums_per_page') - 1 && $x < $albumsCount; ++$x) { // Daten in ein Photo-Objekt uebertragen $childPhotoAlbum->clear(); $childPhotoAlbum->setArray($albumList[$x]); // folder of the album $ordner = ADMIDIO_PATH . FOLDER_DATA . '/photos/' . $childPhotoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $childPhotoAlbum->getValue('pho_id'); // show album if album is not locked or it has child albums or the user has the photo module edit right if ((is_dir($ordner) && $childPhotoAlbum->getValue('pho_locked') == 0) || $childPhotoAlbum->hasChildAlbums() || $gCurrentUser->editPhotoRight()) { // Zufallsbild fuer die Vorschau ermitteln $shuffleImage = $childPhotoAlbum->shuffleImage(); // Album angaben if (is_dir($ordner) || $childPhotoAlbum->hasChildAlbums()) { $albumTitle = ''.$childPhotoAlbum->getValue('pho_name').'
    '; } else { $albumTitle = $childPhotoAlbum->getValue('pho_name'); } $albumDate = $childPhotoAlbum->getValue('pho_begin', $gSettingsManager->getString('system_date')); if ($childPhotoAlbum->getValue('pho_end') !== $childPhotoAlbum->getValue('pho_begin')) { $albumDate .= ' '.$gL10n->get('SYS_DATE_TO').' '.$childPhotoAlbum->getValue('pho_end', $gSettingsManager->getString('system_date')); } $page->addHtml('

    '.$albumTitle.'

    '); // check if download option is enabled if ($gSettingsManager->getBool('photo_download_enabled') && $childPhotoAlbum->getValue('pho_quantity') > 0) { $page->addHtml(' '.$gL10n->get('SYS_DOWNLOAD_ALBUM').' '); } // if user has admin rights for photo module then show some functions if ($gCurrentUser->editPhotoRight()) { $page->addHtml(' '.$gL10n->get('SYS_EDIT').' '.$gL10n->get('SYS_DELETE').' '); } $page->addHtml('
    '.$gL10n->get('PHO_PHOTOS').'
    '); $form = new HtmlForm('form_album_'.$childPhotoAlbum->getValue('pho_id'), null, $page, array('type' => 'vertical')); $form->addStaticControl('pho_date', $gL10n->get('SYS_DATE'), $albumDate); $form->addStaticControl('pho_count', $gL10n->get('SYS_PHOTOS'), $childPhotoAlbum->countImages()); if (strlen($childPhotoAlbum->getValue('pho_photographers')) > 0) { $form->addStaticControl('pho_photographer', $gL10n->get('PHO_PHOTOGRAPHER'), $childPhotoAlbum->getValue('pho_photographers')); } $page->addHtml($form->show(false)); $page->addHtml('
    '); // Notice for users with foto edit rights that the folder of the album doesn't exists if (!is_dir($ordner) && !$childPhotoAlbum->hasChildAlbums() && $gCurrentUser->editPhotoRight()) { $page->addHtml(''); } // Notice for users with foto edit right that this album is locked if ($childPhotoAlbum->getValue('pho_locked') == 1 && is_dir($ordner)) { $page->addHtml(''); } // if user has admin rights for photo module then show some functions if ($gCurrentUser->editPhotoRight()) { if ($childPhotoAlbum->getValue('pho_locked') == 1) { $lockBtnName = $gL10n->get('PHO_ALBUM_UNLOCK'); $lockMode = 'unlock'; } else { $lockBtnName = $gL10n->get('PHO_ALBUM_LOCK'); $lockMode = 'lock'; } $page->addHtml('
    '); } $page->addHtml('
    '); }//Ende wenn Ordner existiert }//for $page->addHtml('
    '); /****************************Leeres Album****************/ // Falls das Album weder Fotos noch Unterordner enthaelt if ($albumsCount === 0 && ($photoAlbum->getValue('pho_quantity') == 0 || strlen($photoAlbum->getValue('pho_quantity')) === 0)) // alle vorhandenen Albumen werden ignoriert { $page->addHtml($gL10n->get('PHO_NO_ALBUM_CONTENT')); } // If necessary show links to navigate to next and previous albums of the query $baseUrl = safeUrl(ADMIDIO_URL.FOLDER_MODULES.'/photos/photos.php', array('pho_id' => $getPhotoId)); $page->addHtml(admFuncGeneratePagination($baseUrl, $albumsCount, $gSettingsManager->getInt('photo_albums_per_page'), $getStart)); // show html of complete page $page->show();