Commit 4158c196 authored by Marco Nolletti's avatar Marco Nolletti

Merge branch 'DEVELOPMENT'

parents f5937f0e 9d4a7c9a
......@@ -21,5 +21,5 @@ $meta['panorama_width'] = array('numeric');
$meta['panorama_height'] = array('numeric');
$meta['sort'] = array('multichoice', '_choices' => array('file','mod','date','title','random'));
$meta['options'] = array('multicheckbox', '_choices' => array('fullsize','crop','reverse','recursive','showtitle','showinfo','showfname'));
$meta['options'] = array('multicheckbox', '_choices' => array('fullsize','crop','reverse','recursive','showtitle','showinfo','showdescription','showkeywords','showfname'));
......@@ -2,9 +2,10 @@
/**
* German language file for photogallery plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti / Felix Mhlbauer
*/
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti
* @contributors Felix Mühlbauer, Michael Große
*/
$lang['imagescnt'] = '%s Bilder';
$lang['videoocnt'] = '%s Videos';
......@@ -12,10 +13,10 @@ $lang['lnk_download'] = 'Herunterladen';
$lang['notauthorized'] = 'Du hast leider keine Berechtigungen das Fotoalbum <b>%s</b> anzusehen.';
$lang['nsnotexists'] = 'Achtung, das Verzeichnis zum Namensraum <b>%s</b> existiert nicht.';
$lang['pgnotexists'] = 'Achtung, die Seite <b>%s</b> existiert nicht.';
$lang['phpthumbexecerror'] = 'PhotoGallery Fehler: pgImg.php ist nicht ausfhrbar';
$lang['phpthumbexecpermset'] = 'Ausfhrberechtigung fr pgImg.php erfolgreich gesetzt';
$lang['phpthumbpermseterror'] = 'Kann nicht Ausfhrberechtigung fr pgImg.php setzen';
$lang['phpthumbdisabled'] = 'Warnung, phpThumb kann nicht verwendet werden; bitte deaktivieren Sie es in der Plugin-Konfiguration um die Fehlermeldungen zu unterdrcken';
$lang['phpthumbexecerror'] = 'PhotoGallery Fehler: pgImg.php ist nicht ausführbar';
$lang['phpthumbexecpermset'] = 'Ausführberechtigung für pgImg.php erfolgreich gesetzt';
$lang['phpthumbpermseterror'] = 'Kann nicht Ausführberechtigung für pgImg.php setzen';
$lang['phpthumbdisabled'] = 'Warnung, phpThumb kann nicht verwendet werden; bitte deaktivieren Sie es in der Plugin-Konfiguration um die Fehlermeldungen zu unterdrücken';
$lang['zipdisabled'] = 'Kann kein Archiv erstellen, da die ZIP-Erweiterung nicht geladen ist';
// menu entry for admin plugins
......
......@@ -2,8 +2,9 @@
/**
* German language file for photogallery plugin
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti / Felix Mühlbauer
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti
* @contributors Felix Mühlbauer
*/
$lang['use_phpThumb'] = 'phpThumb für Cache und Thumbnails generation Verwenden';
......@@ -33,6 +34,8 @@ $lang['options_o_crop'] = 'Zuschneiden';
$lang['options_o_reverse'] = 'Sortierung umdrehen';
$lang['options_o_recursive'] = 'Unterordner durchsuchen';
$lang['options_o_showtitle'] = 'Titel des Bildes anzeigen';
$lang['options_o_showdescription'] = 'Breschreibung des Bildes anzeigen';
$lang['options_o_showkeywords'] = 'Schlagwörter des Bildes anzeigen';
$lang['options_o_showinfo'] = 'EXIF Info anzeigen';
$lang['options_o_showfname'] = 'Dateiname anzeigen';
......@@ -4,6 +4,7 @@
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti
* @contributors Felix Mühlbauer
*/
$lang['imagescnt'] = '%s images';
......
......@@ -33,6 +33,8 @@ $lang['options_o_crop'] = 'Crop';
$lang['options_o_reverse'] = 'Invert sort order';
$lang['options_o_recursive'] = 'Recurse subfolders';
$lang['options_o_showtitle'] = 'Show the title of the image';
$lang['options_o_showdescription'] = 'Show the description of the image';
$lang['options_o_showkeywords'] = 'Show the keywords of the image';
$lang['options_o_showinfo'] = 'Show EXIF info';
$lang['options_o_showfname'] = 'Show the filename';
......@@ -33,6 +33,8 @@ $lang['options_o_crop'] = 'Ritaglia';
$lang['options_o_reverse'] = 'Inverti';
$lang['options_o_recursive'] = 'Ricerca ricorsiva';
$lang['options_o_showtitle'] = 'Mostra titolo';
$lang['options_o_showdescription'] = 'Mostra la descrizione';
$lang['options_o_showkeywords'] = 'Mostra le parole chiave';
$lang['options_o_showinfo'] = 'Mostra info EXIF';
$lang['options_o_showfname'] = 'Mostra nome file';
......
base photogallery
author Marco Nolletti
email mnolletti@gmail.com
date 2017-04-24
date 2017-06-17
name PhotoGallery Plugin
desc Creates a gallery of images from a namespace (PHP Version >= 5.4.45 required)
url http://www.dokuwiki.org/plugin:photogallery
......@@ -3,8 +3,9 @@
* DokuWiki Plugin photogallery (Syntax Component)
* Embed an image gallery
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Marco Nolletti
* @contributors Michael Große
*/
// must be run within Dokuwiki
......@@ -18,6 +19,8 @@ require_once('lib/array_column.php');
class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
protected $metaAliases = null;
/**
* What kind of syntax are we?
*/
......@@ -253,7 +256,9 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
function render($mode, Doku_Renderer $R, $data){
global $ID;
global $conf;
$this->metaAliases = $this->getMetaTagAliases();
$cmd = $data['command'];
if($mode == 'xhtml'){
......@@ -298,6 +303,8 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
global $conf;
global $lang;
global $ID;
global $auth;
global $USERINFO;
//dbg($data);
$cmd = $data['command'];
......@@ -324,7 +331,9 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
if (class_exists('ZipArchive')){
$zip = $data['ns'].":".$data['zipfile'];
$this->_createzipfile($files, mediaFN($zip));
$data['ziplink'] = $R->internalmedia($zip,$this->getLang('lnk_download'),null,null,null,null,'linkonly',true);
if($this->_zip_auth_check($data)){
$data['ziplink'] = $R->internalmedia($zip,$this->getLang('lnk_download'),null,null,null,null,'linkonly',true);
}
}
else
msg($this->getLang('zipdisabled'),2);
......@@ -819,21 +828,23 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
* Automatically checks if a JPEGMeta object is available or if all data is
* supplied in array
*/
function _meta(&$img,$opt){
function _meta($img,$opt){
if($img['meta']){
// map JPEGMeta calls to opt names
switch($opt){
case 'title':
return $img['meta']->getField('Simple.Title');
return $img['meta']->getField($this->metaAliases['img_title']);
case 'desc':
return $img['meta']->getField('Iptc.Caption');
return $img['meta']->getField($this->metaAliases['img_caption']);
case 'keywords':
return $img['meta']->getField($this->metaAliases['img_keywords']);
case 'cdate':
return $img['meta']->getField('Date.EarliestTime');
return $img['meta']->getField($this->metaAliases['img_date']);
case 'width':
return $img['meta']->getField('File.Width');
return $img['meta']->getField($this->metaAliases['img_width']);
case 'height':
return $img['meta']->getField('File.Height');
return $img['meta']->getField($this->metaAliases['img_height']);
default:
return '';
}
......@@ -843,6 +854,36 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
}
}
/**
* Use the existing DokuWiki-configuration to find all aliases for a given image meta-information
*
* This is based on @see tpl_get_img_meta()
*
* @return array
*/
protected function getMetaTagAliases() {
$config_files = getConfigFiles('mediameta');
foreach ($config_files as $config_file) {
if(file_exists($config_file)) {
include($config_file);
}
}
/** @var array $fields the included array with metadata */
$tagAliases = array();
foreach($fields as $tag){
$t = array();
if (!empty($tag[0])) {
$t = array($tag[0]);
}
if(is_array($tag[3])) {
$t = array_merge($t,$tag[3]);
}
$tagAliases[$tag[1]] = $t;
}
return $tagAliases;
}
/**
* Calculates the multiplier needed to resize the image to the given
* dimensions
......@@ -893,6 +934,18 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
$ret .= '<h4>'.hsc($title).'</h4>';
}
}
if ($data['showdescription']) {
$desc = $this->_meta($img,'desc');
if(!empty($desc)){
$ret .= '<p>'.nl2br(hsc($desc)).'</p>';
}
}
if ($data['showkeywords']) {
$keywords = $this->_meta($img,'keywords');
if(!empty($keywords)){
$ret .= '<p>'.hsc($keywords).'</p>';
}
}
if ($data['showinfo']){
$ret .= $this->_exif($img);
}
......@@ -961,7 +1014,7 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
}
/**
* Check ACLs
* Check ACLs on Gallery
*/
function _auth_check($data){
global $USERINFO;
......@@ -982,6 +1035,28 @@ class syntax_plugin_photogallery extends DokuWiki_Syntax_Plugin {
return true;
}
/**
* Check ACLs on Zip link
*/
function _zip_auth_check($data){
global $USERINFO;
global $auth;
global $conf;
if(!$auth) return false;
$user .= $_SERVER['REMOTE_USER'];
if(is_null($user)) return false;
$groups = (array) $USERINFO['grps'];
$authlist = $data['zipauthlist'];
if (isset($authlist)){
$authlist .= ','.$conf['superuser'];
return auth_isMember($authlist, $user, $groups);
}
else
return true;
}
/**
* Return if a namespace has exists as media folder
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment