Changeset 2132


Ignore:
Timestamp:
Oct 10, 2007, 12:43:09 AM (17 years ago)
Author:
rvelices
Message:
  • RSS feed is PWG charset
  • iptc are now converted from iso-8859-1 or utf-8 (automatic detection) to pwg charset
  • remove function get_language_filepath
  • load_language also checks for the default language
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/feed.php

    r2029 r2132  
    108108
    109109$rss = new UniversalFeedCreator();
    110 
     110$rss->encoding=get_pwg_charset();
    111111$rss->title = $conf['gallery_title'];
    112112$rss->title.= ' (as '.$user['username'].')';
  • trunk/include/feedcreator.class.php

    r1900 r2132  
    392392                foreach ($vars as $key => $value) {
    393393                        // prevent overwriting of properties "contentType", "encoding"; do not copy "_feed" itself
    394                         if (!in_array($key, array("_feed", "contentType", "encoding"))) {
     394                        if (!in_array($key, array("_feed", "contentType"/*PWG, "encoding"*/))) {
    395395                                $this->_feed->{$key} = $this->{$key};
    396396                        }
  • trunk/include/functions.inc.php

    r2127 r2132  
    15001500    $languages[] = $language;
    15011501  }
    1502 
    15031502  if ( !empty($user['language']) )
    15041503  {
    15051504    $languages[] = $user['language'];
     1505  }
     1506  if ( defined('PHPWG_INSTALLED') )
     1507  {
     1508    $languages[] = get_default_language();
    15061509  }
    15071510  $languages[] = PHPWG_DEFAULT_LANGUAGE;
  • trunk/include/functions_metadata.inc.php

    r1900 r2132  
    9090  $value = str_replace(chr(0x00), ' ', $value);
    9191
     92  if ( preg_match('/[\x80-\xff]/', $value) )
     93  {
     94    // apparently mac uses some MacRoman crap encoding. I don't know
     95    // how to detect it so a plugin should do the trick.
     96    $value = trigger_event('clean_iptc_value', $value);
     97    $is_utf8 = seems_utf8($value);
     98    $value = convert_charset( $value,
     99      $is_utf8 ? 'utf-8' : 'iso-8859-1',
     100      get_pwg_charset() );
     101  }
    92102  return $value;
    93103}
  • trunk/include/functions_user.inc.php

    r2127 r2132  
    930930}
    931931
    932 /**
    933  * return the file path of the given language filename, depending on the
    934  * availability of the file
    935  *
    936  * in descending order of preference:
    937  *   param language, user language, default language
    938  * PhpWebGallery default language.
    939  *
    940  * @param string filename
    941  * @param string dirname
    942  * @param string language
    943  * @return string filepath
    944  */
    945 function get_language_filepath($filename, $dirname = '', $language = '')
    946 {
    947   global $user, $conf;
    948 
    949   if (empty($dirname))
    950   {
    951     $dirname = PHPWG_ROOT_PATH;
    952   }
    953   $dirname .= 'language'.'/';
    954 
    955   $dir_methods = array();
    956 
    957   if (!empty($language))
    958   {
    959     $dir_methods[] = 1;
    960   }
    961 
    962   $dir_methods[] = 2;
    963   $dir_methods[] = 3;
    964   $dir_methods[] = 4;
    965 
    966   foreach ($dir_methods as $dir_method)
    967   {
    968     switch ($dir_method)
    969     {
    970       case '1':
    971       {
    972         $directory = $dirname.$language;
    973         break;
    974       }
    975       case '2':
    976       {
    977         $directory = $dirname.$user['language'];
    978         break;
    979       }
    980       case '3':
    981       {
    982         $directory = $dirname.get_default_language();
    983         break;
    984       }
    985       case '4':
    986       default:
    987       {
    988         $directory = $dirname.PHPWG_DEFAULT_LANGUAGE;
    989         break;
    990       }
    991       {
    992         $directory = '.';
    993       }
    994     }
    995 
    996     $filepath = $directory.'/'.$filename;
    997 
    998     if (file_exists($filepath))
    999     {
    1000       return $filepath;
    1001     }
    1002   }
    1003 
    1004   return false;
    1005 }
    1006932
    1007933/**
Note: See TracChangeset for help on using the changeset viewer.