Changeset 5200


Ignore:
Timestamp:
03/20/10 09:59:54 (10 years ago)
Author:
rvelices
Message:
  • added a js confirmation before deletign a theme
  • fix link to css
  • simplified language loading (a couple of years ago during utf8 migration I left the possibility to have languages defined in another charsets - this is useless)
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/themes/default/template/include/datepicker.inc.tpl

    r5123 r5200  
    1212 
    1313{html_head} 
    14 <link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/default/js/ui/themes/ui.datepicker.css"> 
     14<link rel="stylesheet" type="text/css" href="{$ROOT_URL}themes/default/js/ui/theme/ui.datepicker.css"> 
    1515{/html_head} 
    1616 
  • trunk/admin/themes/default/template/themes_installed.tpl

    r5153 r5200  
    3232    <div class="themeActions"> 
    3333      <a href="{$activate_baseurl}{$theme.id}" title="{'Make this theme available to users'|@translate}">{'Activate'|@translate}</a> 
    34       | <a href="{$delete_baseurl}{$theme.id}" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a> 
     34      | <a href="{$delete_baseurl}{$theme.id}" onclick="return confirm('{'Are you sure?'|@translate|@escape:javascript}');" title="{'Delete this theme'|@translate}">{'Delete'|@translate}</a> 
    3535    </div> 
    3636     
  • trunk/include/functions.inc.php

    r5196 r5200  
    3333 
    3434//----------------------------------------------------------- generic functions 
    35 function get_extra_fields($order_by_fields)  
    36 { 
    37   $fields = str_ireplace(array(' order by ', ' desc', ' asc'),  
     35function get_extra_fields($order_by_fields) 
     36{ 
     37  $fields = str_ireplace(array(' order by ', ' desc', ' asc'), 
    3838                         array('', '', ''), 
    3939                         $order_by_fields 
    4040                         ); 
    4141  if (!empty($fields)) 
    42   {  
     42  { 
    4343    $fields = ','.$fields; 
    4444  } 
     
    415415      list($language_name) = @file($path.'/iso.txt'); 
    416416 
    417       $langdef = explode('.',$file); 
    418       if (count($langdef)>1) // (langCode,encoding) 
    419       { 
    420         $langdef[1] = strtolower($langdef[1]); 
    421  
    422         if ( 
    423           $target_charset==$langdef[1] 
    424          or 
    425           ($target_charset=='utf-8' and $langdef[1]=='iso-8859-1') 
    426          or 
    427           ($target_charset=='iso-8859-1' and 
    428           in_array( substr($langdef[0],2), array('en','fr','de','es','it','nl'))) 
    429         ) 
    430         { 
    431           $language_name = convert_charset($language_name, 
    432               $langdef[1], $target_charset); 
    433           $languages[ $langdef[0] ] = $language_name; 
    434         } 
    435         else 
    436           continue; // the language encoding is not compatible with our charset 
    437       } 
    438       else 
    439       { // UTF-8 
    440         $language_name = convert_charset($language_name, 
    441               'utf-8', $target_charset); 
    442         $languages[$file] = $language_name; 
    443       } 
     417      $languages[$file] = convert_charset($language_name, $target_charset); 
    444418    } 
    445419  } 
     
    730704  // plugins want remove some themes based on user status maybe? 
    731705  $themes = trigger_event('get_pwg_themes', $themes); 
    732    
     706 
    733707  return $themes; 
    734708} 
     
    12411215  } 
    12421216  $target_charset = strtolower($target_charset); 
    1243   $source_charset = ''; 
    12441217  $source_file    = ''; 
    12451218  foreach ($languages as $language) 
    12461219  { 
    1247     $dir = $dirname.$language; 
    1248  
    1249     if ($target_charset!='utf-8') 
    1250     { 
    1251       // exact charset match - no conversion required 
    1252       $f = $dir.'.'.$target_charset.'/'.$filename; 
    1253       if (file_exists($f)) 
    1254       { 
    1255         $source_file = $f; 
    1256         break; 
    1257       } 
    1258     } 
    1259  
    1260     // UTF-8 ? 
    1261     $f = $dir.'/'.$filename; 
     1220    $f = $dirname.$language.'/'.$filename; 
    12621221    if (file_exists($f)) 
    12631222    { 
    1264       $source_charset = 'utf-8'; 
    12651223      $source_file = $f; 
    12661224      break; 
     
    12801238      if ( !isset($lang_info) ) $lang_info=array(); 
    12811239 
    1282       if ( !empty($source_charset) and $source_charset!=$target_charset) 
     1240      if ( 'utf-8'!=$target_charset) 
    12831241      { 
    12841242        if ( is_array($load_lang) ) 
     
    12881246            if ( is_array($v) ) 
    12891247            { 
    1290               $func = create_function('$v', 'return convert_charset($v, "'.$source_charset.'","'.$target_charset.'");' ); 
     1248              $func = create_function('$v', 'return convert_charset($v, "'.$target_charset.'");' ); 
    12911249              $lang[$k] = array_map($func, $v); 
    12921250            } 
    12931251            else 
    1294               $lang[$k] = convert_charset($v, $source_charset, $target_charset); 
     1252              $lang[$k] = convert_charset($v, $target_charset); 
    12951253          } 
    12961254        } 
     
    12991257          foreach ($load_lang_info as $k => $v) 
    13001258          { 
    1301             $lang_info[$k] = convert_charset($v, $source_charset, $target_charset); 
     1259            $lang_info[$k] = convert_charset($v, $target_charset); 
    13021260          } 
    13031261        } 
     
    13131271    { 
    13141272      $content = @file_get_contents($source_file); 
    1315       if ( !empty($source_charset) and $source_charset!=$target_charset) 
    1316       { 
    1317         $content = convert_charset($content, $source_charset, $target_charset); 
    1318       } 
     1273      $content = convert_charset($content, $target_charset); 
    13191274      return $content; 
    13201275    } 
     
    13241279 
    13251280/** 
    1326  * converts a string from a character set to another character set 
     1281 * converts a string from utf-8 character set to another character set 
    13271282 * @param string str the string to be converted 
    1328  * @param string source_charset the character set in which the string is encoded 
    13291283 * @param string dest_charset the destination character set 
    13301284 */ 
    1331 function convert_charset($str, $source_charset, $dest_charset) 
    1332 { 
    1333   if ($source_charset==$dest_charset) 
     1285function convert_charset($str, $dest_charset) 
     1286{ 
     1287  if ($dest_charset=='utf-8') 
     1288  { 
    13341289    return $str; 
    1335   if ($source_charset=='iso-8859-1' and $dest_charset=='utf-8') 
    1336   { 
    1337     return utf8_encode($str); 
    1338   } 
    1339   if ($source_charset=='utf-8' and $dest_charset=='iso-8859-1') 
     1290  } 
     1291  if ($dest_charset=='iso-8859-1') 
    13401292  { 
    13411293    return utf8_decode($str); 
     
    13431295  if (function_exists('iconv')) 
    13441296  { 
    1345     return iconv($source_charset, $dest_charset, $str); 
     1297    return iconv('utf-8', $dest_charset, $str); 
    13461298  } 
    13471299  if (function_exists('mb_convert_encoding')) 
    13481300  { 
    1349     return mb_convert_encoding( $str, $dest_charset, $source_charset ); 
     1301    return mb_convert_encoding( $str, $dest_charset, 'utf-8' ); 
    13501302  } 
    13511303  return $str; //??? 
Note: See TracChangeset for help on using the changeset viewer.