diff options
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r-- | include/functions.inc.php | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php index a9ae35baf..0f26fde77 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | Piwigo - a PHP based photo gallery | // +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | +// | Copyright(C) 2008-2016 Piwigo Team http://piwigo.org | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | // +-----------------------------------------------------------------------+ @@ -407,7 +407,7 @@ SELECT id, name * @param string $image_type * @return bool */ -function pwg_log($image_id = null, $image_type = null) +function pwg_log($image_id = null, $image_type = null, $format_id = null) { global $conf, $user, $page; @@ -445,6 +445,8 @@ INSERT INTO '.HISTORY_TABLE.' category_id, image_id, image_type, + format_id, + auth_key_id, tag_ids ) VALUES @@ -457,6 +459,8 @@ INSERT INTO '.HISTORY_TABLE.' '.(isset($page['category']['id']) ? $page['category']['id'] : 'NULL').', '.(isset($image_id) ? $image_id : 'NULL').', '.(isset($image_type) ? "'".$image_type."'" : 'NULL').', + '.(isset($format_id) ? $format_id : 'NULL').', + '.(isset($page['auth_key_id']) ? $page['auth_key_id'] : 'NULL').', '.(isset($tags_string) ? "'".$tags_string."'" : 'NULL').' ) ;'; @@ -953,6 +957,21 @@ function original_to_representative($path, $representative_ext) } /** + * Transforms an original path to its format + * + * @param string $path + * @param string $format_ext + * @return string + */ +function original_to_format($path, $format_ext) +{ + $pos = strrpos($path, '/'); + $path = substr_replace($path, 'pwg_format/', $pos+1, 0); + $pos = strrpos($path, '.'); + return substr_replace($path, $format_ext, $pos+1); +} + +/** * get the full path of an image * * @param array $element_info element information from db (at least 'path') @@ -1140,9 +1159,7 @@ function l10n_args($key_args, $sep = "\n") */ function get_themeconf($key) { - global $template; - - return $template->get_themeconf($key); + return $GLOBALS['template']->get_themeconf($key); } /** @@ -1278,6 +1295,27 @@ DELETE FROM '.CONFIG_TABLE.' } /** + * Return a default value for a configuration parameter. + * @since 2.8 + * + * @param string $param the configuration value to be extracted (if it exists) + * @param mixed $default_value the default value for the configuration value if it does not exist. + * + * @return mixed The configuration value if the variable exists, otherwise the default. + */ +function conf_get_param($param, $default_value=null) +{ + global $conf; + + if (isset($conf[$param])) + { + return $conf[$param]; + } + return $default_value; +} + + +/** * Apply *unserialize* on a value only if it is a string * @since 2.7 * @@ -1631,7 +1669,7 @@ function convert_charset($str, $source_charset, $dest_charset) } if (function_exists('iconv')) { - return iconv($source_charset, $dest_charset, $str); + return iconv($source_charset, $dest_charset.'//TRANSLIT', $str); } if (function_exists('mb_convert_encoding')) { @@ -2092,4 +2130,4 @@ function safe_version_compare($a, $b, $op=null) } } -?>
\ No newline at end of file +?> |