aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2008-02-27 20:25:18 +0000
committerrub <rub@piwigo.org>2008-02-27 20:25:18 +0000
commitbf4012291a878c3f22fa318595e2ca7881c2978a (patch)
tree52d142b93c7c224e281b44a7530a30b77aaba348 /include
parent98d4b284e047f1fcb991935e689192c47fca457c (diff)
Resolved issue 0000807: New slideshow features
git-svn-id: http://piwigo.org/svn/trunk@2218 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/category_default.inc.php18
-rw-r--r--include/config_default.inc.php20
-rw-r--r--include/functions.inc.php4
-rw-r--r--include/functions_picture.inc.php108
4 files changed, 141 insertions, 9 deletions
diff --git a/include/category_default.inc.php b/include/category_default.inc.php
index ef029eee6..402df757b 100644
--- a/include/category_default.inc.php
+++ b/include/category_default.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -66,6 +66,22 @@ if (count($pictures) > 0)
$template->assign_block_vars('thumbnails.line', array());
// current row displayed
$row_number = 0;
+
+ // define category slideshow url
+ $row = reset($pictures);
+ $page['cat_slideshow_url'] =
+ add_url_params(
+ duplicate_picture_url(
+ array(
+ 'image_id' => $row['id'],
+ 'image_file' => $row['file']
+ ),
+ array('start')
+ ),
+ array('slideshow' =>
+ (isset($_GET['slideshow']) ? $_GET['slideshow']
+ : '' ))
+ );
}
trigger_action('loc_begin_index_thumbnails', $pictures);
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 6a294236c..67369119e 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -66,10 +66,6 @@
// the date_available
$conf['order_by'] = ' ORDER BY date_available DESC, file ASC, id ASC';
-// slideshow_period : waiting time in seconds before loading a new page
-// during automated slideshow
-$conf['slideshow_period'] = 4;
-
// file_ext : file extensions (case sensitive) authorized
$conf['file_ext'] = array('jpg','JPG','jpeg','JPEG',
'png','PNG','gif','GIF','mpg','zip',
@@ -692,8 +688,20 @@ $conf['filter_pages'] = array
);
// +-----------------------------------------------------------------------+
-// | Light slideshow |
+// | Slideshow |
// +-----------------------------------------------------------------------+
+// slideshow_period : waiting time in seconds before loading a new page
+// during automated slideshow
+// slideshow_period_min, slideshow_period_max are bounds of slideshow_period
+// slideshow_period_step is the step of navigation between min and max
+$conf['slideshow_period_min'] = 1;
+$conf['slideshow_period_max'] = 10;
+$conf['slideshow_period_step'] = 1;
+$conf['slideshow_period'] = 4;
+
+// slideshow_repeat : slideshow loops on pictures
+$conf['slideshow_repeat'] = true;
+
// $conf['light_slideshow'] indicates to use slideshow.tpl in state of
// picture.tpl for slideshow
// Take care to have slideshow.tpl in all available templates
diff --git a/include/functions.inc.php b/include/functions.inc.php
index afc91c9c2..243f2481b 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -2,7 +2,7 @@
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -749,6 +749,8 @@ function redirect_http( $url )
{
ob_clean();
}
+ // default url is on html format
+ $url = html_entity_decode($url);
header('Request-URI: '.$url);
header('Content-Location: '.$url);
header('Location: '.$url);
diff --git a/include/functions_picture.inc.php b/include/functions_picture.inc.php
index d11574b57..13a09834d 100644
--- a/include/functions_picture.inc.php
+++ b/include/functions_picture.inc.php
@@ -1,7 +1,7 @@
<?php
// +-----------------------------------------------------------------------+
// | PhpWebGallery - a PHP based picture gallery |
-// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
+// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
// | file : $Id$
// | last update : $Date$
@@ -223,4 +223,110 @@ function get_download_url($what_part, $element_info)
return trigger_event( 'get_download_url', $url, $element_info);
}
+/*
+ * get slideshow default params into array
+ *
+ * @param void
+ *
+ * @return slideshow default values into array
+ */
+function get_default_slideshow_params()
+{
+ global $conf;
+
+ return array(
+ 'period' => $conf['slideshow_period'],
+ 'repeat' => $conf['slideshow_repeat'],
+ 'play' => true,
+ );
+}
+
+/*
+ * check and correct slideshow params from array
+ *
+ * @param array of params
+ *
+ * @return slideshow corrected values into array
+ */
+function correct_slideshow_params($params = array())
+{
+ global $conf;
+
+ if ($params['period'] < $conf['slideshow_period_min'])
+ {
+ $params['period'] = $conf['slideshow_period_min'];
+ }
+ else if ($params['period'] > $conf['slideshow_period_max'])
+ {
+ $params['period'] = $conf['slideshow_period_max'];
+ }
+
+ return $params;
+}
+
+/*
+ * Decode slideshow string params into array
+ *
+ * @param string params like ""
+ *
+ * @return slideshow values into array
+ */
+function decode_slideshow_params($encode_params = null)
+{
+ global $conf;
+
+ $result = get_default_slideshow_params();
+
+ if (is_numeric($encode_params))
+ {
+ $result['period'] = $encode_params;
+ }
+ else
+ {
+ $matches = array();
+ if (preg_match_all('/([a-z]+)-(\d+)/', $encode_params, $matches))
+ {
+ $matchcount = count($matches[1]);
+ for ($i = 0; $i < $matchcount; $i++)
+ {
+ $result[$matches[1][$i]] = $matches[2][$i];
+ }
+ }
+
+ if (preg_match_all('/([a-z]+)-(true|false)/', $encode_params, $matches))
+ {
+ $matchcount = count($matches[1]);
+ for ($i = 0; $i < $matchcount; $i++)
+ {
+ $result[$matches[1][$i]] = get_boolean($matches[2][$i]);
+ }
+ }
+ }
+
+ return correct_slideshow_params($result);
+}
+
+/*
+ * Encode slideshow array params into array
+ *
+ * @param array params
+ *
+ * @return slideshow values into string
+ */
+function encode_slideshow_params($decode_params = array())
+{
+ global $conf;
+
+ $params = array_diff_assoc(correct_slideshow_params($decode_params), get_default_slideshow_params());
+ $result = '';
+
+ foreach ($params as $name => $value)
+ {
+ // boolean_to_string return $value, if it's not a bool
+ $result .= '+'.$name.'-'.boolean_to_string($value);
+ }
+
+ return $result;
+}
+
?>