From 4beb3086fb5e96ddbd2ff24fd6e1135506a4ab07 Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 4 Feb 2015 14:37:34 -0800 Subject: [PATCH] Fixes #817 - error in gallery admin, and also fixes missing gallery images on fresh install when not logged in. --- e107_handlers/plugin_class.php | 30 +++++++++++++++++++++++++- e107_plugins/gallery/admin_gallery.php | 9 ++++---- e107_plugins/gallery/plugin.xml | 2 +- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index 5566e0338..10498c5a1 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -1957,6 +1957,34 @@ class e107plugin } } + + + + function getPerm($type, $default = 'member') + { + + if(empty($type)) + { + $type = $default; + } + + $plug_perm = array(); + $plug_perm['everyone'] = e_UC_PUBLIC; + $plug_perm['guest'] = e_UC_GUEST; + $plug_perm['member'] = e_UC_MEMBER; + $plug_perm['mainadmin'] = e_UC_MAINADMIN; + $plug_perm['admin'] = e_UC_ADMIN; + $plug_perm['nobody'] = e_UC_NOBODY; + + if(isset($plug_perm[$type])) + { + return $plug_perm[$type]; + } + + return $plug_perm[$default]; + } + + // Only 1 category per file-type allowed. ie. 1 for images, 1 for files. function XmlMediaCategories($function, $tag) { @@ -1995,7 +2023,7 @@ class e107plugin $data['title'] = $v['@value']; $data['sef'] = vartrue($v['@attributes']['sef']); // $data['type'] = $v['@attributes']['type']; //TODO - $data['class'] = 253; + $data['class'] = $this->getPerm($v['@attributes']['perm'], 'member'); $status = e107::getMedia()->createCategory($data) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR; $mes->add("Adding Media Category: {$data['category']}", $status); diff --git a/e107_plugins/gallery/admin_gallery.php b/e107_plugins/gallery/admin_gallery.php index 6f7d4c33a..02b7f7a78 100644 --- a/e107_plugins/gallery/admin_gallery.php +++ b/e107_plugins/gallery/admin_gallery.php @@ -158,7 +158,7 @@ class gallery_cat_admin_ui extends e_admin_ui // 'slideshow_circular' => array('title'=> 'Slide circular-mode', 'type' => 'boolean', 'data' => 'integer', 'help'=>'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.'), // 'slideshow_effect' => array('title'=> 'Slide effect', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of effect. '), // // 'slideshow_transition' => array('title'=> 'Slide transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') // - 'perpage' => array('title'=> 'Images per page', 'type' => 'number', 'data' => 'int', 'help'=>'Number of images to be shown per page', 'validate' => 'required'), // 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), + 'perpage' => array('title'=> 'Images per page', 'type' => 'number', 'data' => 'int', 'help'=>'Number of images to be shown per page'), // 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), ); @@ -180,10 +180,11 @@ class gallery_cat_admin_ui extends e_admin_ui $this->prefs['slideshow_effect']['writeParms'] = $effects; $this->prefs['slideshow_effect']['readParms'] = $effects; + // + // $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring'); - $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring'); - $this->prefs['slideshow_transition']['writeParms'] = $transitions; - $this->prefs['slideshow_transition']['readParms'] = $transitions; + // $this->prefs['slideshow_transition']['writeParms'] = $transitions; + // $this->prefs['slideshow_transition']['readParms'] = $transitions; $categories = e107::getMedia()->getCategories('gallery'); $cats = array(); diff --git a/e107_plugins/gallery/plugin.xml b/e107_plugins/gallery/plugin.xml index 3a3eae9a7..8b48c4c42 100644 --- a/e107_plugins/gallery/plugin.xml +++ b/e107_plugins/gallery/plugin.xml @@ -12,7 +12,7 @@ - Gallery 1 + Gallery 1 800