jablonka.czprosek.czf

websvn

Subversion Repositories:
[/] [include/] [accessfile.php] - Diff between revs 1 and 3

Show entire file Ignore whitespace

Rev 1 Rev 3
Line 34... Line 34...
// }}} // }}}
   
// {{{ readIniFile // {{{ readIniFile
   
function readIniFile($name) { function readIniFile($name) {
  // does not use parse_ini_file function since php 5.3 does not support comment lines starting with #
$contents = file($name); $contents = file($name);
$cursection = ''; $cursection = '';
  $curkey = '';
$first = true; $first = true;
   
foreach ($contents as $str) { foreach ($contents as $line) {
$str = trim($str); $line = rtrim($line);
  $str = ltrim($line);
if (empty($str)) { if (empty($str)) {
continue; continue;
} }
   
  // @todo remove ' in the next major release to be in line with the svn book
if ($str{0} == '#' or $str{0} == "'") { if ($str{0} == '#' or $str{0} == "'") {
continue; continue;
} }
   
if ($str{0} == '[') { if ($str != $line && !empty($cursection) && !empty($curkey)) {
  // line starts with whitespace
  $this->sections[$cursection][$curkey] .= strtolower($str);
  } else if ($str{0} == '[') {
$cursection = strtolower(substr($str, 1, strlen($str) - 2)); $cursection = strtolower(substr($str, 1, strlen($str) - 2));
if (!($str{strlen($str) - 2} == '/' or $str == '[groups]')) { if (!($str{strlen($str) - 2} == '/' || $str == '[aliases]' || $str == '[groups]')) {
$cursection .= '/'; $cursection .= '/';
} }
$first = true; $first = true;
} else if (!empty($cursection)) { } else if (!empty($cursection)) {
if ($first === true) { if ($first) {
$this->sections[$cursection] = array(); if (($cursection != 'aliases' && $cursection != 'groups') || !isset($this->sections[$cursection])) {
  $this->sections[$cursection] = array();
  }
} }
list($key, $val) = split('=', $str); list($key, $val) = explode('=', $str, 2);
$this->sections[$cursection][strtolower(trim($key))] = strtolower(trim($val)); $key = strtolower(trim($key));
  $curkey = $key;
  $this->sections[$cursection][$key] = strtolower(trim($val));
$first = false; $first = false;
} }
} }
} }
   

Powered by WebSVN 2.2.1