/** * die Albenstruktur fuer eine Auswahlbox darstellen und das aktuelle Album vorauswählen * @param int $parentId * @param string $vorschub * @param $photoAlbum * @param $phoId */ function subfolder($parentId, $vorschub, $photoAlbum, $phoId) { global $gDb, $gCurrentOrganization, $photoAlbumsArray; $vorschub = $vorschub . ' '; $sqlConditionParentId = ''; $parentPhotoAlbum = new TablePhotos($gDb); // Erfassen des auszugebenden Albums if ($parentId > 0) { $sqlConditionParentId .= ' AND pho_pho_id_parent = \'' . $parentId . '\' '; } else { $sqlConditionParentId .= ' AND pho_pho_id_parent IS NULL '; } $sql = 'SELECT * FROM ' . TBL_PHOTOS . ' WHERE pho_id <> ' . $photoAlbum->getValue('pho_id') . $sqlConditionParentId . ' AND pho_org_id = ' . $gCurrentOrganization->getValue('org_id'); $childStatement = $gDb->query($sql); while ($adm_photo_child = $childStatement->fetch()) { $parentPhotoAlbum->clear(); $parentPhotoAlbum->setArray($adm_photo_child); // add entry to array of all photo albums $photoAlbumsArray[$parentPhotoAlbum->getValue('pho_id')] = $vorschub . '— ' . $parentPhotoAlbum->getValue('pho_name') . ' (' . $parentPhotoAlbum->getValue('pho_begin', 'Y') . ')'; subfolder($parentPhotoAlbum->getValue('pho_id'), $vorschub, $photoAlbum, $phoId); } //while }
function deletePhoto($pho_id, $pic_nr) { global $gDb; // nur bei gueltigen Uebergaben weiterarbeiten if (is_numeric($pho_id) && is_numeric($pic_nr)) { // einlesen des Albums $photo_album = new TablePhotos($gDb, $pho_id); //Speicherort $album_path = SERVER_PATH . '/adm_my_files/photos/' . $photo_album->getValue('pho_begin', 'Y-m-d') . '_' . $photo_album->getValue('pho_id'); // delete photos tryDelete($album_path . '/' . $pic_nr . '.jpg'); tryDelete($album_path . '/originals/' . $pic_nr . '.jpg'); tryDelete($album_path . '/originals/' . $pic_nr . '.png'); // Umbenennen der Restbilder und Thumbnails loeschen $new_pic_nr = $pic_nr; $thumbnail_delete = false; for ($act_pic_nr = 1; $act_pic_nr <= $photo_album->getValue('pho_quantity'); $act_pic_nr++) { if (file_exists($album_path . '/' . $act_pic_nr . '.jpg')) { if ($act_pic_nr > $new_pic_nr) { tryRename($album_path . '/' . $act_pic_nr . '.jpg', $album_path . '/' . $new_pic_nr . '.jpg'); tryRename($album_path . '/originals/' . $act_pic_nr . '.jpg', $album_path . '/originals/' . $new_pic_nr . '.jpg'); tryRename($album_path . '/originals/' . $act_pic_nr . '.png', $album_path . '/originals/' . $new_pic_nr . '.png'); $new_pic_nr++; } } else { $thumbnail_delete = true; } if ($thumbnail_delete) { // Alle Thumbnails ab dem geloeschten Bild loeschen deleteThumbnail($photo_album, $act_pic_nr); } } //for // Aendern der Datenbankeintaege $photo_album->setValue('pho_quantity', $photo_album->getValue('pho_quantity') - 1); $photo_album->save(); } }
* * Copyright : (c) 2004 - 2015 The Admidio Team * Homepage : http://www.admidio.org * License : GNU Public License 2 http://www.gnu.org/licenses/gpl-2.0.html * *****************************************************************************/ require_once '../../system/common.php'; require_once 'ecard_function.php'; // Initialize and check the parameters $postTemplateName = admFuncVariableIsValid($_POST, 'ecard_template', 'file', array('requireValue' => true)); $postPhotoId = admFuncVariableIsValid($_POST, 'photo_id', 'numeric', array('requireValue' => true)); $postPhotoNr = admFuncVariableIsValid($_POST, 'photo_nr', 'numeric', array('requireValue' => true)); $funcClass = new FunctionClass($gL10n); $photoAlbum = new TablePhotos($gDb, $postPhotoId); $imageUrl = $g_root_path . '/adm_program/modules/photos/photo_show.php?pho_id=' . $postPhotoId . '&photo_nr=' . $postPhotoNr . '&max_width=' . $gPreferences['ecard_card_picture_width'] . '&max_height=' . $gPreferences['ecard_card_picture_height']; $imageServerPath = SERVER_PATH . '/adm_my_files/photos/' . $photoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $postPhotoId . '/' . $postPhotoNr . '.jpg'; $template = THEME_SERVER_PATH . '/ecard_templates/'; $_SESSION['ecard_request'] = $_POST; // pruefen ob das Modul ueberhaupt aktiviert ist if ($gPreferences['enable_ecard_module'] != 1) { // das Modul ist deaktiviert $gMessage($gL10n->get('SYS_MODULE_DISABLED')); } // pruefen ob User eingeloggt ist if (!$gValidLogin) { $gMessage($gL10n->get('SYS_INVALID_PAGE_VIEW')); } $senderName = $gCurrentUser->getValue('FIRST_NAME') . ' ' . $gCurrentUser->getValue('LAST_NAME'); $senderEmail = $gCurrentUser->getValue('EMAIL'); if (isset($_POST['ecard_recipients']) == false || is_array($_POST['ecard_recipients'] == false)) { $_SESSION['ecard_request']['ecard_recipients'] = '';
} //Kontrolle ob Server Dateiuploads zulaesst if (ini_get('file_uploads') != 1) { $gMessage->show($gL10n->get('SYS_SERVER_NO_UPLOAD')); } $headline = $gL10n->get('PHO_UPLOAD_PHOTOS'); // create photo object or read it from session if (isset($_SESSION['photo_album']) && $_SESSION['photo_album']->getValue('pho_id') == $getPhotoId) { $photoAlbum =& $_SESSION['photo_album']; $photoAlbum->db =& $gDb; } else { $photoAlbum = new TablePhotos($gDb, $getPhotoId); $_SESSION['photo_album'] =& $photoAlbum; } // check if album belongs to current organization if ($photoAlbum->getValue('pho_org_shortname') != $gCurrentOrganization->getValue('org_shortname')) { $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW')); } if ($getMode == 'choose_files') { // delete old stuff in upload folder $uploadFolder = new Folder(SERVER_PATH . '/adm_my_files/photos/upload'); $uploadFolder->delete('', true); // create html page object $page = new HtmlPage(); $page->hideThemeHtml(); $page->hideMenu(); $page->addCssFile($g_root_path . '/adm_program/libs/jquery-file-upload/css/jquery.fileupload.css'); $page->addJavascriptFile($g_root_path . '/adm_program/libs/jquery-file-upload/js/vendor/jquery.ui.widget.js'); $page->addJavascriptFile($g_root_path . '/adm_program/libs/jquery-file-upload/js/jquery.iframe-transport.js'); $page->addJavascriptFile($g_root_path . '/adm_program/libs/jquery-file-upload/js/jquery.fileupload.js'); $page->addJavascript('
// URL auf Navigationstack ablegen $gNavigation->addUrl(CURRENT_URL, $headline); // Fotoveranstaltungs-Objekt erzeugen oder aus Session lesen if (isset($_SESSION['photo_album']) && $_SESSION['photo_album']->getValue('pho_id') == $getPhotoId) { $photo_album =& $_SESSION['photo_album']; $photo_album->setDatabase($gDb); } else { // einlesen des Albums falls noch nicht in Session gespeichert $photo_album = new TablePhotos($gDb); if ($getPhotoId > 0) { $photo_album->readDataById($getPhotoId); } $_SESSION['photo_album'] = $photo_album; } // pruefen, ob Album zur aktuellen Organisation gehoert if ($getPhotoId > 0 && $photo_album->getValue('pho_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW')); } if ($gValidLogin && strlen($gCurrentUser->getValue('EMAIL')) === 0) { // der eingeloggte Benutzer hat in seinem Profil keine gueltige Mailadresse hinterlegt, // die als Absender genutzt werden kann... $gMessage->show($gL10n->get('SYS_CURRENT_USER_NO_EMAIL', '<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php">', '</a>')); } if ($getUserId > 0) { // usr_id wurde uebergeben, dann Kontaktdaten des Users aus der DB fischen $user = new User($gDb, $gProfileFields, $getUserId); // darf auf die User-Id zugegriffen werden if (!$gCurrentUser->editUsers() && !isMember($user->getValue('usr_id')) || strlen($user->getValue('usr_id')) === 0) { $gMessage->show($gL10n->get('SYS_USER_ID_NOT_FOUND')); } // besitzt der User eine gueltige E-Mail-Adresse
if ($gPreferences['enable_photo_module'] == 0) { // das Modul ist deaktiviert $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } // erst pruefen, ob der User Fotoberarbeitungsrechte hat if (!$gCurrentUser->editPhotoRight()) { $gMessage->show($gL10n->get('PHO_NO_RIGHTS')); } // Gepostete Variablen in Session speichern $_SESSION['photo_album_request'] = $_POST; // Fotoalbumobjekt anlegen $photo_album = new TablePhotos($gDb); if ($getMode !== 'new' && $getPhotoId > 0) { $photo_album->readDataById($getPhotoId); // Pruefung, ob das Fotoalbum zur aktuellen Organisation gehoert if ($photo_album->getValue('pho_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } // Speicherort mit dem Pfad aus der Datenbank $ordner = SERVER_PATH . '/adm_my_files/photos/' . $photo_album->getValue('pho_begin', 'Y-m-d') . '_' . $photo_album->getValue('pho_id'); /********************Aenderungen oder Neueintraege kontrollieren***********************************/ if ($getMode === 'new' || $getMode === 'change') { // Gesendete Variablen Uebernehmen und kontollieren // Freigabe(muss zuerst gemacht werden da diese nicht gesetzt sein koennte) if (!isset($_POST['pho_locked'])) { $_POST['pho_locked'] = 0; } // Album if (strlen($_POST['pho_name']) === 0) { $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('PHO_ALBUM')));
// das Modul ist deaktiviert $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } elseif ($gPreferences['enable_photo_module'] == 2) { // nur eingeloggte Benutzer duerfen auf das Modul zugreifen require_once '../../system/login_valid.php'; } // erfassen des Albums falls noch nicht in Session gespeichert if (isset($_SESSION['photo_album']) && $_SESSION['photo_album']->getValue('pho_id') == $getPhotoId) { $photoAlbum =& $_SESSION['photo_album']; $photoAlbum->setDatabase($gDb); } else { $photoAlbum = new TablePhotos($gDb, $getPhotoId); $_SESSION['photo_album'] = $photoAlbum; } // Ordnerpfad zusammensetzen $ordner_foto = '/adm_my_files/photos/' . $photoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $photoAlbum->getValue('pho_id'); $ordner = SERVER_PATH . $ordner_foto; $ordner_url = $g_root_path . $ordner_foto; // Naechstes und Letztes Bild $previousImage = $getPhotoNr - 1; $nextImage = $getPhotoNr + 1; $urlPreviousImage = '#'; $urlNextImage = '#'; $urlCurrentImage = $g_root_path . '/adm_program/modules/photos/photo_show.php?pho_id=' . $getPhotoId . '&photo_nr=' . $getPhotoNr . '&max_width=' . $gPreferences['photo_show_width'] . '&max_height=' . $gPreferences['photo_show_height']; if ($previousImage > 0) { $urlPreviousImage = $g_root_path . '/adm_program/modules/photos/photo_presenter.php?photo_nr=' . $previousImage . '&pho_id=' . $getPhotoId; } if ($nextImage <= $photoAlbum->getValue('pho_quantity')) { $urlNextImage = $g_root_path . '/adm_program/modules/photos/photo_presenter.php?photo_nr=' . $nextImage . '&pho_id=' . $getPhotoId; } // create html page object
$albumList = $albumStatement->fetchAll(); // Gesamtzahl der auszugebenden Alben $albumsCount = $albumStatement->rowCount(); // falls zum aktuellen Album Fotos und Unteralben existieren, // dann einen Trennstrich zeichnen if ($photoAlbum->getValue('pho_quantity') > 0 && $albumsCount > 0) { $page->addHtml('<hr />'); } $childPhotoAlbum = new TablePhotos($gDb); $page->addHtml('<div class="row">'); for ($x = $getStart; $x <= $getStart + $gPreferences['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 = SERVER_PATH . '/adm_my_files/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 (file_exists($ordner) && $childPhotoAlbum->getValue('pho_locked') == 0 || $childPhotoAlbum->hasChildAlbums() || $gCurrentUser->editPhotoRight()) { // Zufallsbild fuer die Vorschau ermitteln $shuffle_image = $childPhotoAlbum->shuffleImage(); // Album angaben if (file_exists($ordner) || $childPhotoAlbum->hasChildAlbums()) { $albumTitle = '<a href="' . $g_root_path . '/adm_program/modules/photos/photos.php?pho_id=' . $childPhotoAlbum->getValue('pho_id') . '">' . $childPhotoAlbum->getValue('pho_name') . '</a><br />'; } else { $albumTitle = $childPhotoAlbum->getValue('pho_name'); } $albumDate = $childPhotoAlbum->getValue('pho_begin', $gPreferences['system_date']); if ($childPhotoAlbum->getValue('pho_end') != $childPhotoAlbum->getValue('pho_begin')) { $albumDate .= ' ' . $gL10n->get('SYS_DATE_TO') . ' ' . $childPhotoAlbum->getValue('pho_end', $gPreferences['system_date']); } // @ptabaden: komplettumbau (Order, added counter-value to col-sm-6)
} elseif ($gPreferences['enable_photo_module'] == 2) { // nur eingeloggte Benutzer duerfen auf das Modul zugreifen require '../../system/login_valid.php'; } // lokale Variablen initialisieren $image = null; // read album data out of session or database if (isset($_SESSION['photo_album']) && $_SESSION['photo_album']->getValue('pho_id') == $getPhotoId) { $photoAlbum =& $_SESSION['photo_album']; $photoAlbum->setDatabase($gDb); } else { $photoAlbum = new TablePhotos($gDb, $getPhotoId); $_SESSION['photo_album'] = $photoAlbum; } // Bildpfad zusammensetzten $ordner = SERVER_PATH . '/adm_my_files/photos/' . $photoAlbum->getValue('pho_begin', 'Y-m-d') . '_' . $getPhotoId; $picpath = $ordner . '/' . $getPhotoNr . '.jpg'; // im Debug-Modus den ermittelten Bildpfad ausgeben if ($gDebug == 1) { error_log($picpath); } // Wenn Thumbnail existiert laengere Seite ermitteln if ($getThumbnail) { if ($getPhotoNr > 0) { $thumb_length = 1; if (file_exists($ordner . '/thumbnails/' . $getPhotoNr . '.jpg')) { // Ermittlung der Original Bildgroesse $bildgroesse = getimagesize($ordner . '/thumbnails/' . $getPhotoNr . '.jpg'); $thumb_length = $bildgroesse[1]; if ($bildgroesse[0] > $bildgroesse[1]) { $thumb_length = $bildgroesse[0];
} $albumStatement = $gDb->query($sql); $albumList = $albumStatement->fetchAll(); // Variablen initialisieren $i = 0; $picnr = 0; $picpath = ''; $link_text = ''; $album = new TablePhotos($gDb); // Schleife, falls nicht direkt ein Bild gefunden wird, aber auf 20 Durchlaeufe begrenzen while (!file_exists($picpath) && $i < 20 && $albumStatement->rowCount() > 0) { // Ausgewähltendatendatz holen $album->setArray($albumList[mt_rand(0, $albumStatement->rowCount() - 1)]); // Falls gewuensch Bild per Zufall auswaehlen if ($plg_photos_picnr == 0) { $picnr = mt_rand(1, $album->getValue('pho_quantity')); } else { $picnr = $plg_photos_picnr; } // Bilpfad zusammensetzen $picpath = PLUGIN_PATH . '/../adm_my_files/photos/' . $album->getValue('pho_begin', 'Y-m-d') . '_' . $album->getValue('pho_id') . '/' . $picnr . '.jpg'; ++$i; } if (!file_exists($picpath)) { $picpath = THEME_SERVER_PATH . '/images/nopix.jpg'; } // Ermittlung der Original Bildgroesse $bildgroesse = getimagesize($picpath); // Popupfenstergröße $popup_height = $gPreferences['photo_show_height'] + 210; $popup_width = $gPreferences['photo_show_width'] + 70;
if ($photoAlbum->getValue('pho_quantity') > 0 && $albumsCount > 0) { $page->addHtml('<hr />'); } //Dateizeiger auf erstes auszugebendes Element setzen if ($albumsCount > 0) { $gDb->data_seek($result_list, $getStart); } $childPhotoAlbum = new TablePhotos($gDb); $page->addHtml('<div class="row">'); for ($x = $getStart; $x <= $getStart + $gPreferences['photo_albums_per_page'] - 1 && $x < $albumsCount; $x++) { $adm_photo_list = $gDb->fetch_array($result_list); // Daten in ein Photo-Objekt uebertragen $childPhotoAlbum->clear(); $childPhotoAlbum->setArray($adm_photo_list); // folder of the album $ordner = SERVER_PATH . '/adm_my_files/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 (file_exists($ordner) && $childPhotoAlbum->getValue('pho_locked') == 0 || $childPhotoAlbum->hasChildAlbums() || $gCurrentUser->editPhotoRight()) { // Zufallsbild fuer die Vorschau ermitteln $shuffle_image = $childPhotoAlbum->shuffleImage(); //Album angaben if (file_exists($ordner) || $childPhotoAlbum->hasChildAlbums()) { $albumTitle = '<a href="' . $g_root_path . '/adm_program/modules/photos/photos.php?pho_id=' . $childPhotoAlbum->getValue('pho_id') . '">' . $childPhotoAlbum->getValue('pho_name') . '</a><br />'; } else { $albumTitle = $childPhotoAlbum->getValue('pho_name'); } $albumDate = $childPhotoAlbum->getValue('pho_begin', $gPreferences['system_date']); if ($childPhotoAlbum->getValue('pho_end') != $childPhotoAlbum->getValue('pho_begin')) { $albumDate .= ' ' . $gL10n->get('SYS_DATE_TO') . ' ' . $childPhotoAlbum->getValue('pho_end', $gPreferences['system_date']); } $page->addHtml('
$gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } // check if current user has right to upload photos if (!$gCurrentUser->editPhotoRight()) { $gMessage->show($gL10n->get('PHO_NO_RIGHTS')); } // create photo object or read it from session if (isset($_SESSION['photo_album']) && $_SESSION['photo_album']->getValue('pho_id') == $getId) { $photoAlbum =& $_SESSION['photo_album']; $photoAlbum->setDatabase($gDb); } else { $photoAlbum = new TablePhotos($gDb, $getId); $_SESSION['photo_album'] = $photoAlbum; } // check if album belongs to current organization if ($photoAlbum->getValue('pho_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_INVALID_PAGE_VIEW')); } $uploadDir = SERVER_PATH . '/adm_my_files/photos/upload/'; $uploadUrl = $g_root_path . '/adm_my_files/photos/upload/'; $headline = $gL10n->get('PHO_UPLOAD_PHOTOS'); $textFileUploaded = $gL10n->get('PHO_FILE_UPLOADED'); $textUploadSuccessful = $gL10n->get('PHO_PHOTO_UPLOAD_SUCCESSFUL'); $textUploadNotSuccessful = $gL10n->get('PHO_PHOTO_UPLOAD_NOT_SUCCESSFUL'); $textUploadDescription = $gL10n->get('PHO_PHOTO_UPLOAD_DESC', $photoAlbum->getValue('pho_name')); $textSelectFiles = $gL10n->get('PHO_SELECT_FOTOS'); $iconUploadPath = THEME_PATH . '/icons/photo_upload.png'; } elseif ($getModule === 'downloads') { if ($gPreferences['enable_download_module'] != 1) { $gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); }
ORDER BY pho_timestamp_create DESC LIMIT 10'; $statement = $gDb->query($sql); $photo_album = new TablePhotos($gDb); // ab hier wird der RSS-Feed zusammengestellt // create RSS feed object with channel information $rss = new RSSfeed($gCurrentOrganization->getValue('org_longname') . ' - ' . $getHeadline, $gCurrentOrganization->getValue('org_homepage'), $gL10n->get('PHO_RECENT_ALBUMS_OF_ORGA', $gCurrentOrganization->getValue('org_longname')), $gCurrentOrganization->getValue('org_longname')); // Dem RSSfeed-Objekt jetzt die RSSitems zusammenstellen und hinzufuegen while ($row = $statement->fetch()) { // Daten in ein Photo-Objekt uebertragen $photo_album->clear(); $photo_album->setArray($row); // set data for attributes of this entry // read folder structure to put them together and write to title $parents = ''; $pho_parent_id = $photo_album->getValue('pho_pho_id_parent'); while ($pho_parent_id > 0) { // Erfassen des Eltern Albums $sql = ' SELECT * FROM ' . TBL_PHOTOS . ' WHERE pho_id = ' . $pho_parent_id; $parentsStatement = $gDb->query($sql); $adm_photo_parent = $parentsStatement->fetch(); // Link zusammensetzen $parents = $adm_photo_parent['pho_name'] . ' > ' . $parents; // Elternveranst $pho_parent_id = $adm_photo_parent['pho_pho_id_parent']; } $title = $parents . $photo_album->getValue('pho_name'); $link = $g_root_path . '/adm_program/modules/photos/photos.php?pho_id=' . $photo_album->getValue('pho_id'); $author = $row['create_name'];
$gMessage->show($gL10n->get('SYS_MODULE_DISABLED')); } elseif ($gPreferences['enable_photo_module'] == 2) { // nur eingeloggte Benutzer duerfen auf das Modul zugreifen require_once '../../system/login_valid.php'; } // check if download function is enabled if ($gPreferences['photo_download_enabled'] == 0) { // das Modul ist deaktiviert $gMessage->show($gL10n->get('PHO_DOWNLOAD_DISABLED')); } // Fotoalbumobjekt anlegen $photo_album = new TablePhotos($gDb); // get id of album $photo_album->readDataById($getPhotoId); // check whether album belongs to the current organization if ($photo_album->getValue('pho_org_id') != $gCurrentOrganization->getValue('org_id')) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } // check whether album is locked if ($photo_album->getValue('pho_locked') == 1 && !$gCurrentUser->editPhotoRight()) { $gMessage->show($gL10n->get('PHO_ALBUM_NOT_APPROVED')); } $albumFolder = SERVER_PATH . '/adm_my_files/photos/' . $photo_album->getValue('pho_begin', 'Y-m-d') . '_' . $photo_album->getValue('pho_id'); if ($photo_album->getValue('pho_quantity') == 0) { $gMessage->show($gL10n->get('PHO_NO_ALBUM_CONTENT')); } // check whether to take original version instead of scaled one $takeOriginalsIfAvailable = false; if ($gPreferences['photo_keep_original'] == 1) { $takeOriginalsIfAvailable = true; }