Changeset 18629 for trunk/include
- Timestamp:
- Oct 12, 2012, 10:00:16 PM (12 years ago)
- Location:
- trunk/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r18165 r18629 124 124 $pos = strrpos( $filename, '.' ); 125 125 return ($pos===false) ? $filename : substr( $filename, 0, $pos); 126 }127 128 /**129 * returns an array contening sub-directories, excluding ".svn"130 *131 * @param string $dir132 * @return array133 */134 function get_dirs($directory)135 {136 $sub_dirs = array();137 if ($opendir = opendir($directory))138 {139 while ($file = readdir($opendir))140 {141 if ($file != '.'142 and $file != '..'143 and is_dir($directory.'/'.$file)144 and $file != '.svn')145 {146 array_push($sub_dirs, $file);147 }148 }149 closedir($opendir);150 }151 return $sub_dirs;152 126 } 153 127 … … 1275 1249 $languages = array_unique($languages); 1276 1250 1251 /*Note: target charset is always utf-8 1277 1252 if ( empty($options['target_charset']) ) 1278 1253 { … … 1283 1258 $target_charset = $options['target_charset']; 1284 1259 } 1285 $target_charset = strtolower($target_charset); 1260 $target_charset = strtolower($target_charset);*/ 1286 1261 $source_file = ''; 1287 1262 foreach ($languages as $language) … … 1310 1285 if ( !isset($lang_info) ) $lang_info=array(); 1311 1286 1287 /* Note: target charset is always utf-8 1312 1288 if ( 'utf-8'!=$target_charset) 1313 1289 { … … 1334 1310 } 1335 1311 else 1336 { 1312 {*/ 1337 1313 $lang = array_merge( $lang, (array)$load_lang ); 1338 1314 $lang_info = array_merge( $lang_info, (array)$load_lang_info ); 1339 }1315 //} 1340 1316 return true; 1341 1317 } … … 1343 1319 { 1344 1320 $content = @file_get_contents($source_file); 1345 $content = convert_charset($content, 'utf-8', $target_charset);1321 //Note: target charset is always utf-8 $content = convert_charset($content, 'utf-8', $target_charset); 1346 1322 return $content; 1347 1323 } … … 1605 1581 1606 1582 $options = array(); 1583 $label = ''; 1607 1584 foreach (array_reverse($conf['available_permission_levels']) as $level) 1608 1585 { 1609 $label = null;1610 1611 1586 if (0 == $level) 1612 1587 { … … 1615 1590 else 1616 1591 { 1617 $labels = array(); 1618 $sub_levels = array_reverse($conf['available_permission_levels']); 1619 foreach ($sub_levels as $sub_level) 1592 if (strlen($label)) 1620 1593 { 1621 if ($sub_level == 0 or $sub_level < $level) 1622 { 1623 break; 1624 } 1625 array_push( 1626 $labels, 1627 l10n( 1628 sprintf( 1629 'Level %d', 1630 $sub_level 1631 ) 1632 ) 1633 ); 1594 $label .= ', '; 1634 1595 } 1635 1636 $label = implode(', ', $labels); 1596 $label .= l10n( sprintf('Level %d',$level) ); 1637 1597 } 1638 1598 $options[$level] = $label; -
trunk/include/functions_user.inc.php
r18164 r18629 288 288 global $conf; 289 289 290 $userdata = array();291 292 290 // retrieve basic user data 293 291 $query = ' … … 348 346 349 347 // then merge basic + additional user data 350 $row = array_merge($row, $user_infos_row); 351 352 foreach ($row as $key => $value) 353 { 354 if (!is_numeric($key)) 355 { 356 // If the field is true or false, the variable is transformed into a 357 // boolean value. 358 if ($value == 'true' or $value == 'false') 359 { 360 $userdata[$key] = get_boolean($value); 361 } 362 else 363 { 364 $userdata[$key] = $value; 365 } 366 } 367 } 348 $userdata = array_merge($row, $user_infos_row); 349 350 foreach ($userdata as &$value) 351 { 352 // If the field is true or false, the variable is transformed into a boolean value. 353 if ($value == 'true') 354 { 355 $value = true; 356 } 357 elseif ($value == 'false') 358 { 359 $value = false; 360 } 361 } 362 unset($value); 368 363 369 364 if ($use_cache) … … 644 639 if ($ref_level <> 0) 645 640 { 646 array_push($list_cat_id, $cat_id);641 $list_cat_id[] = $cat_id; 647 642 } 648 643 } … … 663 658 if ($level > $ref_level) 664 659 { 665 array_push($list_cat_id, $id);660 $list_cat_id[] = $id; 666 661 } 667 662 else 668 663 { 669 664 compute_branch_cat_data($cats, $list_cat_id, $level, $ref_level); 670 array_push($list_cat_id, $id);665 $list_cat_id[] = $id; 671 666 } 672 667 $ref_level = $level; … … 830 825 if (is_array($cache['default_user']) and $convert_str) 831 826 { 832 $default_user = array(); 833 foreach ($cache['default_user'] as $name => $value) 834 { 835 // If the field is true or false, the variable is transformed into a 836 // boolean value. 837 if ($value == 'true' or $value == 'false') 838 { 839 $default_user[$name] = get_boolean($value); 840 } 841 else 842 { 843 $default_user[$name] = $value; 827 $default_user = $cache['default_user']; 828 foreach ($default_user as &$value) 829 { 830 // If the field is true or false, the variable is transformed into a boolean value. 831 if ($value == 'true') 832 { 833 $value = true; 834 } 835 elseif ($value == 'false') 836 { 837 $value = false; 844 838 } 845 839 } … … 985 979 )); 986 980 987 array_push($inserts, $insert);981 $inserts[] = $insert; 988 982 } 989 983
Note: See TracChangeset
for help on using the changeset viewer.