diff options
author | plegall <plg@piwigo.org> | 2005-09-14 21:57:05 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2005-09-14 21:57:05 +0000 |
commit | 3371c757424cef291be02a946e528983dece9543 (patch) | |
tree | 2ede9c21e065d766d8a3226309635c46b596d77d /include | |
parent | eac1724ee5e20967d989916b76fc9076411be758 (diff) |
- improvement: long localized messages are in HTML files instead of $lang
array. This is the case of admin/help and about pages.
- deletion: of unused functions (ts_to_mysqldt, is_image, TN_exists,
check_date_format, date_convert, get_category_directories,
get_used_metadata_list, array_remove, pwg_write_debug,
get_group_restrictions, get_all_group_restrictions, is_group_allowed,
style_select, deprecated_getAttribute).
- new: many new contextual help pages to replace descriptions previously
included in pages.
- modification: reorganisation of language files. Deletion of unused
language keys, alphabetical sort. No faq.lang.php anymore (replaced by
help.html). Only done for en_UK.iso-8859-1.
git-svn-id: http://piwigo.org/svn/trunk@862 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/common.inc.php | 2 | ||||
-rw-r--r-- | include/config_default.inc.php | 3 | ||||
-rw-r--r-- | include/functions.inc.php | 23 | ||||
-rw-r--r-- | include/functions_group.inc.php | 81 | ||||
-rw-r--r-- | include/functions_html.inc.php | 18 | ||||
-rw-r--r-- | include/functions_xml.inc.php | 22 |
6 files changed, 5 insertions, 144 deletions
diff --git a/include/common.inc.php b/include/common.inc.php index afed22c87..fa0a7f3db 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -181,7 +181,7 @@ else // The administration section requires 2 more language files if (defined('IN_ADMIN') and IN_ADMIN) { - foreach (array('admin', 'faq') as $section) + foreach (array('admin') as $section) { if (file_exists($user_langdir.'/'.$section.'.lang.php')) { diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 90d2cabf9..dbd5beb51 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -176,7 +176,8 @@ $conf['gallery_description'] = 'My photos web site'; // galery_url : URL given in RSS feed $conf['gallery_url'] = 'http://demo.phpwebgallery.net'; -// prefix_thumbnail : string before filename +// prefix_thumbnail : string before filename. Thumbnail's prefix must only +// contain characters among : a to z (case insensitive), "-" or "_". $conf['prefix_thumbnail'] = 'TN-'; // +-----------------------------------------------------------------------+ diff --git a/include/functions.inc.php b/include/functions.inc.php index a37623ca2..5fb2fc263 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -102,17 +102,6 @@ function boolean_to_string($var) } } -// array_remove removes a value from the given array if the value existed in -// this array. -function array_remove( $array, $value ) -{ - $output = array(); - foreach ( $array as $v ) { - if ( $v != $value ) array_push( $output, $v ); - } - return $output; -} - // The function get_moment returns a float value coresponding to the number // of seconds since the unix epoch (1st January 1970) and the microseconds // are precised : e.g. 1052343429.89276600 @@ -433,16 +422,6 @@ function format_date($date, $type = 'us', $show_time = false) return $formated_date; } -function pwg_write_debug() -{ - global $debug; - - $fp = @fopen( './log/debug.log', 'a+' ); - fwrite( $fp, "\n\n" ); - fwrite( $fp, $debug ); - fclose( $fp ); -} - function pwg_query($query) { global $conf,$page; @@ -734,7 +713,7 @@ function l10n($key) { global $lang, $conf; - if ($conf['debug_l10n']) + if ($conf['debug_l10n'] and !isset($lang[$key])) { echo '[l10n] language key "'.$key.'" is not defined<br />'; } diff --git a/include/functions_group.inc.php b/include/functions_group.inc.php index c45b8fcc3..919082a92 100644 --- a/include/functions_group.inc.php +++ b/include/functions_group.inc.php @@ -25,85 +25,6 @@ // | USA. | // +-----------------------------------------------------------------------+ -// get_group_restrictions returns an array containing all unaccessible -// category ids. -function get_group_restrictions( $group_id ) -{ - // 1. retrieving ids of private categories - $query = 'SELECT id FROM '.CATEGORIES_TABLE; - $query.= " WHERE status = 'private'"; - $query.= ';'; - $result = pwg_query( $query ); - $privates = array(); - while ( $row = mysql_fetch_array( $result ) ) - { - array_push( $privates, $row['id'] ); - } - // 2. retrieving all authorized categories for the group - $authorized = array(); - $query = 'SELECT cat_id FROM '.GROUP_ACCESS_TABLE; - $query.= ' WHERE group_id = '.$group_id; - $query.= ';'; - $result = pwg_query( $query ); - while ( $row = mysql_fetch_array( $result ) ) - { - array_push( $authorized, $row['cat_id'] ); - } +// with 1.5 preparation, no group dedicated function is used. - $forbidden = array(); - foreach ( $privates as $private ) { - if ( !in_array( $private, $authorized ) ) - { - array_push( $forbidden, $private ); - } - } - - return $forbidden; -} - -// get_all_group_restrictions returns an array with ALL unaccessible -// category ids, including sub-categories -function get_all_group_restrictions( $group_id ) -{ - $restricted_cats = get_group_restrictions( $group_id ); - foreach ( $restricted_cats as $restricted_cat ) { - $sub_restricted_cats = get_subcats_id( $restricted_cat ); - foreach ( $sub_restricted_cats as $sub_restricted_cat ) { - array_push( $restricted_cats, $sub_restricted_cat ); - } - } - return $restricted_cats; -} - -// The function is_group_allowed returns : -// - 0 : if the category is allowed with this $restrictions array -// - 1 : if this category is not allowed -// - 2 : if an uppercat category is not allowed -function is_group_allowed( $category_id, $restrictions ) -{ - $lowest_category_id = $category_id; - - $is_root = false; - while ( !$is_root and !in_array( $category_id, $restrictions ) ) - { - $query = 'SELECT id_uppercat FROM '.CATEGORIES_TABLE; - $query.= ' WHERE id = '.$category_id; - $query.= ';'; - $row = mysql_fetch_array( pwg_query( $query ) ); - if ( !isset( $row['id_uppercat'] ) ) $row['id_uppercat'] = ''; - if ( $row['id_uppercat'] == '' ) $is_root = true; - $category_id = $row['id_uppercat']; - } - - if ( in_array( $lowest_category_id, $restrictions ) ) - { - return 1; - } - if ( in_array( $category_id, $restrictions ) ) - { - return 2; - } - // this group is allowed to go in this category - return 0; -} ?> diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php index b3aacb70d..ae5d5ef47 100644 --- a/include/functions_html.inc.php +++ b/include/functions_html.inc.php @@ -203,24 +203,6 @@ function language_select($default, $select_name = "language") return $lang_select; } -// -// Pick a template/theme combo, -// -function style_select($default_style, $select_name = "style") -{ - $templates = get_templates(); - - $style_selected = '<select name="' . $select_name . '" >'; - foreach ($templates as $template) - { - $selected = ( $template == $default_style ) ? ' selected="selected"' : ''; - $style_selected.= '<option value="'.$template.'"'.$selected.'>'; - $style_selected.= $template.'</option>'; - } - $style_selected .= '</select>'; - return $style_selected; -} - /** * returns the list of categories as a HTML string * diff --git a/include/functions_xml.inc.php b/include/functions_xml.inc.php index 2afe7a23b..d37537fa1 100644 --- a/include/functions_xml.inc.php +++ b/include/functions_xml.inc.php @@ -56,28 +56,6 @@ function getAttribute( $element, $attribute ) if ( preg_match( $regex, $element, $out ) ) return $out[1]; else return ''; } - -function deprecated_getAttribute( $element, $attribute ) -{ - // Retrieving string with tag name and all attributes - $regex = '/^<\w+( '.ATT_REG.'="'.VAL_REG.'")*/'; - preg_match( $regex, $element, $out ); - - // Splitting string for retrieving separately attributes - // and corresponding values - $regex = '/('.ATT_REG.')="('.VAL_REG.')"/'; - preg_match_all( $regex, $out[0], $out ); - - // Searching and returning the value of the requested attribute - for ( $i = 0; $i < sizeof( $out[0] ); $i++ ) - { - if ( $out[1][$i] == $attribute ) - { - return $out[2][$i]; - } - } - return ''; -} // The function getChild returns the first child // exemple : getChild( "<table><tr>XXX</tr><tr>YYY</tr></table>", "tr" ) |