Ignore:
Timestamp:
Feb 13, 2009, 2:01:03 PM (15 years ago)
Author:
rvelices
Message:
  • moved check upgrade feed code to admin/include/functions_upgrade.php
  • refactored some code (shorter and somehow faster - but nothing revolutionary)
  • decrease lost space in permalinks.tpl and hard coded column width (was illisible)
File:
1 edited

Legend:

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

    r3122 r3136  
    134134  // $start represents the position of the next '<' character
    135135  // $end   represents the position of the next '>' character
    136   $start = 0;
    137   $end = 0;
    138   $start = strpos ( $remaining, '<' ); // -> 0
     136  ; // -> 0
    139137  $end   = strpos ( $remaining, '>' ); // -> 16
    140138  // as long as a '<' and his friend '>' are found, we loop
    141   while ( is_numeric( $start ) and is_numeric( $end ) )
     139  while ( ($start=strpos( $remaining, '<' )) !==false
     140        and ($end=strpos( $remaining, '>' )) !== false )
    142141  {
    143142    // $treatment is the part of the string to treat
     
    154153    // loop
    155154    $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
    156     $start = strpos ( $remaining, '<' );
    157     $end   = strpos ( $remaining, '>' );
    158155  }
    159156  $treatment = str_replace( ' ', '&nbsp;', $remaining );
     
    243240  if ( !is_writable($dir) )
    244241  {
    245     if ( !is_writable($dir) )
    246     {
    247       !($flags&MKGETDIR_DIE_ON_ERROR) or fatal_error( "$dir ".l10n('no_write_access'));
    248       return false;
    249     }
     242    !($flags&MKGETDIR_DIE_ON_ERROR) or fatal_error( "$dir ".l10n('no_write_access'));
     243    return false;
    250244  }
    251245  return true;
     
    465459  {
    466460    $path = PHPWG_ROOT_PATH.'language/'.$file;
    467     if (is_dir($path) and !is_link($path) and file_exists($path.'/iso.txt'))
     461    if (!is_link($path) and file_exists($path.'/iso.txt'))
    468462    {
    469463      list($language_name) = @file($path.'/iso.txt');
     
    527521
    528522  $tags_string = null;
    529   if (isset($page['section']) and $page['section'] == 'tags')
    530   {
    531     $tag_ids = array();
    532     foreach ($page['tags'] as $tag)
    533     {
    534       array_push($tag_ids, $tag['id']);
    535     }
    536 
    537     $tags_string = implode(',', $tag_ids);
     523  if ('tags'==@$page['section'])
     524  {
     525    $tags_string = implode(',', $page['tag_ids']);
    538526  }
    539527
     
    912900  if (!empty($element_info['filesize']))
    913901  {
    914     $thumbnail_title .= ' : '.l10n_dec('%d Kb', '%d Kb', $element_info['filesize']);
     902    $thumbnail_title .= ' : '.sprintf(l10n('%d Kb'), $element_info['filesize']);
    915903  }
    916904
     
    11401128
    11411129/**
    1142  * which upgrades are available ?
    1143  *
    1144  * @return array
    1145  */
    1146 function get_available_upgrade_ids()
    1147 {
    1148   $upgrades_path = PHPWG_ROOT_PATH.'install/db';
    1149 
    1150   $available_upgrade_ids = array();
    1151 
    1152   if ($contents = opendir($upgrades_path))
    1153   {
    1154     while (($node = readdir($contents)) !== false)
    1155     {
    1156       if (is_file($upgrades_path.'/'.$node)
    1157           and preg_match('/^(.*?)-database\.php$/', $node, $match))
    1158       {
    1159         array_push($available_upgrade_ids, $match[1]);
    1160       }
    1161     }
    1162   }
    1163   natcasesort($available_upgrade_ids);
    1164 
    1165   return $available_upgrade_ids;
    1166 }
    1167 
    1168 /**
    11691130 * Add configuration parameters from database to global $conf array
    11701131 *
     
    12751236  foreach (array('SCRIPT_NAME', 'SCRIPT_FILENAME', 'PHP_SELF') as $value)
    12761237  {
    1277     $continue = !empty($_SERVER[$value]);
    1278     if ($continue)
     1238    if (!empty($_SERVER[$value]))
    12791239    {
    12801240      $filename = strtolower($_SERVER[$value]);
    1281 
    1282       if ($conf['php_extension_in_urls'])
    1283       {
    1284         $continue = get_extension($filename) ===  'php';
    1285       }
    1286 
    1287       if ($continue)
    1288       {
    1289         $basename = basename($filename, '.php');
    1290         $continue = !empty($basename);
    1291       }
    1292 
    1293       if ($continue)
     1241      if ($conf['php_extension_in_urls'] and get_extension($filename)!=='php')
     1242        continue;
     1243      $basename = basename($filename, '.php');
     1244      if (!empty($basename))
    12941245      {
    12951246        return $basename;
     
    12971248    }
    12981249  }
    1299 
    13001250  return '';
    13011251}
Note: See TracChangeset for help on using the changeset viewer.