Changeset 862 for trunk/admin/include


Ignore:
Timestamp:
Sep 14, 2005, 11:57:05 PM (19 years ago)
Author:
plg
Message:
  • 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.
Location:
trunk/admin/include
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r858 r862  
    2828include(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php');
    2929
    30 $tab_ext_create_TN = array ( 'jpg', 'png', 'JPG', 'PNG' );
    31 
    32 // is_image returns true if the given $filename (including the path) is a
    33 // picture according to its format and its extension.
    34 // As GD library can only generate pictures from jpeg and png files, if you
    35 // ask if the filename is an image for thumbnail creation (second parameter
    36 // set to true), the only authorized formats are jpeg and png.
    37 function is_image( $filename, $create_thumbnail = false )
    38 {
    39   global $conf, $tab_ext_create_TN;
    40 
    41   if (is_file($filename)
    42       and in_array(get_extension($filename), $conf['picture_ext']))
    43   {
    44     $size = getimagesize( $filename );
    45     // $size[2] == 1 means GIF
    46     // $size[2] == 2 means JPG
    47     // $size[2] == 3 means PNG
    48     if ( !$create_thumbnail )
    49     {
    50       if ( in_array( get_extension( $filename ), $conf['picture_ext'] )
    51            and ( $size[2] == 1 or $size[2] == 2 or $size[2] == 3 ) )
    52       {
    53         return true;
    54       }
    55     }
    56     else
    57     {
    58       if ( in_array( get_extension( $filename ), $tab_ext_create_TN )
    59            and ( $size[2] == 2 or $size[2] == 3 ) )
    60       {
    61         return true;
    62       }
    63     }
    64   }
    65   return false;
    66 }
    67 
    6830/**
    6931 * returns an array with all picture files according to $conf['file_ext']
     
    142104  return $pictures;
    143105}
    144 
    145 function TN_exists( $dir, $file )
    146 {
    147   global $conf;
    148 
    149   $filename = get_filename_wo_extension( $file );
    150   foreach ( $conf['picture_ext'] as $ext ) {
    151     $test = $dir.'/thumbnail/'.$conf['prefix_thumbnail'].$filename.'.'.$ext;
    152     if ( is_file ( $test ) )
    153     {
    154       return $ext;
    155     }
    156   }
    157   return false;
    158 }
    159        
    160106
    161107// The function delete_site deletes a site and call the function
     
    553499}
    554500
    555 function check_date_format( $date )
    556 {
    557   // date arrives at this format : DD/MM/YYYY
    558   @list($day,$month,$year) = explode( '/', $date );
    559   return @checkdate( $month, $day, $year );
    560 }
    561 
    562 function date_convert( $date )
    563 {
    564   // date arrives at this format : DD/MM/YYYY
    565   // It must be transformed in YYYY-MM-DD
    566   list($day,$month,$year) = explode( '/', $date );
    567   return $year.'-'.$month.'-'.$day;
    568 }
    569 
    570501function date_convert_back( $date )
    571502{
     
    600531        )
    601532      );
    602 }
    603 
    604 /**
    605  * returns an array containing sub-directories which can be a category
    606  *
    607  * directories nammed "thumbnail", "pwg_high" or "pwg_representative" are
    608  * omitted
    609  *
    610  * @param string $basedir
    611  * @return array
    612  */
    613 function get_category_directories( $basedir )
    614 {
    615   $sub_dirs = array();
    616  
    617   if ( $opendir = opendir( $basedir ) )
    618   {
    619     while ( $file = readdir( $opendir ) )
    620     {
    621       if ($file != '.'
    622           and $file != '..'
    623           and $file != 'thumbnail'
    624           and $file != 'pwg_high'
    625           and $file != 'pwg_representative'
    626           and is_dir($basedir.'/'.$file))
    627       {
    628         array_push( $sub_dirs, $file );
    629       }
    630     }
    631   }
    632   return $sub_dirs;
    633533}
    634534
  • trunk/admin/include/functions_metadata.php

    r858 r862  
    222222  return $files;
    223223}
    224 
    225 // used_metadata string is displayed to inform admin which metadata will be
    226 // used from files for synchronization
    227 function get_used_metadata_list()
    228 {
    229   global $conf;
    230  
    231   $used_metadata = array('filesize', 'width', 'height');
    232 
    233   if ($conf['use_exif'])
    234   {
    235     array_push($used_metadata, 'date_creation');
    236   }
    237 
    238   if ($conf['use_iptc'])
    239   {
    240     foreach (array_keys($conf['use_iptc_mapping']) as $key)
    241     {
    242       array_push($used_metadata, $key);
    243     }
    244   }
    245 
    246   return array_unique($used_metadata);
    247 }
    248224?>
Note: See TracChangeset for help on using the changeset viewer.