aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2004-09-03 15:01:05 +0000
committerz0rglub <z0rglub@piwigo.org>2004-09-03 15:01:05 +0000
commit1f71a31084add9a8fbf2947eff85ee50c5913f5b (patch)
treed591861cbd3bdffffed5748fee6bdd8c41ab788f /include/functions.inc.php
parentfb5b21cbde40a80d5f36c6dad51dc76bbbe88069 (diff)
- in admin/configuration, add new step with "sections" (general, comments,
default, upload, metadata, sessions) - admin/configuration.php and its template have been higly simplificated by making things more generic : for example, for each configuration parameter, its name must correspond to the name we find in the config table and belongs to a section, in the lang array we find : - $lang['conf_<section>_<param>'] - $lang['conf_<section>_<param>_info'] - $lang['conf_<section>_<param>_error'] optionnaly - more described message when connection to database server is impossible - redefinitions of get_languages and get_templates functions - deletion of configuration parameters : webmaster, session_keyword - rename of configuration parameters : - default_lang => default_language - default_style => default_template git-svn-id: http://piwigo.org/svn/trunk@512 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php51
1 files changed, 34 insertions, 17 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index df5b39e40..afd4f87b0 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -179,22 +179,25 @@ function get_filename_wo_extension( $filename )
}
/**
- * returns an array contening sub-directories
+ * returns an array contening sub-directories, excluding "CVS"
*
* @param string $dir
* @return array
*/
-function get_dirs( $directory )
+function get_dirs($directory)
{
$sub_dirs = array();
- if ( $opendir = opendir( $directory ) )
+ if ($opendir = opendir($directory))
{
- while ( $file = readdir ( $opendir ) )
+ while ($file = readdir($opendir))
{
- if ( $file != '.' and $file != '..' and is_dir ( $directory.'/'.$file ) )
+ if ($file != '.'
+ and $file != '..'
+ and is_dir($directory.'/'.$file)
+ and $file != 'CVS')
{
- array_push( $sub_dirs, $file );
+ array_push($sub_dirs, $file);
}
}
}
@@ -258,23 +261,29 @@ function get_picture_size( $original_width, $original_height,
}
//-------------------------------------------- PhpWebGallery specific functions
-// get_languages retourne un tableau contenant tous les languages
-// disponibles pour PhpWebGallery
-function get_languages( $rep_language )
+/**
+ * returns an array with a list of {language_code => language_name}
+ *
+ * @returns array
+ */
+function get_languages()
{
- global $lang;
+ $dir = opendir(PHPWG_ROOT_PATH.'language');
$languages = array();
- $i = 0;
- if ( $opendir = opendir ( $rep_language ) )
+
+ while ($file = readdir($dir))
{
- while ( $file = readdir ( $opendir ) )
+ $path = realpath(PHPWG_ROOT_PATH.'language/'.$file);
+ if (is_dir($path) and !is_link($path) and file_exists($path.'/iso.txt'))
{
- if ( is_dir ( $rep_language.$file )&& !substr_count($file,'.') && isset($lang['lang'][$file]))
- {
- $languages[$i++] =$lang['lang'][$file];
- }
+ list($language_name) = @file($path.'/iso.txt');
+ $languages[$file] = $language_name;
}
}
+ closedir($dir);
+ @asort($languages);
+ @reset($languages);
+
return $languages;
}
@@ -539,4 +548,12 @@ function get_query_string_diff($rejects = array())
return $query_string;
}
+
+/**
+ * returns available templates
+ */
+function get_templates()
+{
+ return get_dirs(PHPWG_ROOT_PATH.'template');
+}
?> \ No newline at end of file