76        if (empty($a_ini_file_name)) {
 
   77            $this->
error(
"no_file_given");
 
   81        $this->INI_FILE_NAME = $a_ini_file_name;
 
   93        if (!file_exists($this->INI_FILE_NAME)) {
 
   94            $this->
error(
"file_does_not_exist");
 
   98            if ($this->
parse() == 
false) {
 
  113        $this->GROUPS = @parse_ini_file($this->INI_FILE_NAME, 
true);
 
  116        if ($this->GROUPS == 
false) {
 
  117            $this->
error(
"file_not_accessible");
 
  122        $temp = array_keys($this->GROUPS);
 
  123        $this->CURRENT_GROUP = $temp[count($temp) - 1];
 
  134        $fp = @fopen($this->INI_FILE_NAME, 
"w");
 
  137            $this->
error(
"Cannot create file $this->INI_FILE_NAME");
 
  142        $result = fwrite($fp, 
"; <?php exit; ?>\r\n");
 
  145        $group_cnt = count($groups);
 
  147        for (
$i = 0; 
$i < $group_cnt; 
$i++) {
 
  148            $group_name = $groups[
$i];
 
  151                $res = sprintf(
"[%s]\r\n", $group_name);
 
  153                $res = sprintf(
"\r\n[%s]\r\n", $group_name);
 
  159            for (reset($group); $key = key($group);next($group)) {
 
  160                $res = sprintf(
"%s = %s\r\n", $key, 
"\"" . $group[$key] . 
"\"");
 
  179        $group_cnt = count($groups);
 
  185        for (
$i = 0; 
$i < $group_cnt; 
$i++) {
 
  186            $group_name = $groups[
$i];
 
  189                $content = sprintf(
"[%s]\n", $group_name);
 
  191                $content .= sprintf(
"\n[%s]\n", $group_name);
 
  197            for (reset($group); $key = key($group);next($group)) {
 
  198                $content .= sprintf(
"%s = %s\n", $key, $group[$key]);
 
  212        return count($this->GROUPS);
 
  224        for (reset($this->GROUPS);$key = key($this->GROUPS);next($this->GROUPS)) {
 
  239        if (!isset($this->GROUPS[$a_group_name])) {
 
  255            $this->
error(
"Group '" . $a_group_name . 
"' does not exist");
 
  259        return $this->GROUPS[$a_group_name];
 
  271            $this->
error(
"Group '" . $a_group_name . 
"' exists");
 
  275        $this->GROUPS[$a_group_name] = array();
 
  288            $this->
error(
"Group '" . $a_group_name . 
"' does not exist");
 
  292        unset($this->GROUPS[$a_group_name]);
 
  305        return isset($this->GROUPS[$a_group][$a_var_name]);
 
  318        if (!isset($this->GROUPS[$a_group][$a_var_name])) {
 
  319            $this->
error(
"'" . $a_var_name . 
"' does not exist in '" . $a_group . 
"'");
 
  323        return trim($this->GROUPS[$a_group][$a_var_name]);
 
  334    public function setVariable($a_group_name, $a_var_name, $a_var_value)
 
  337            $this->
error(
"Group '" . $a_group_name . 
"' does not exist");
 
  341        $this->GROUPS[$a_group_name][$a_var_name] = $a_var_value;
 
  352        $this->ERROR = $a_errmsg;
 
An exception for terminatinating execution or to throw for unit testing.
getError()
returns error @access public
show()
returns the content of IniFile @access public
readGroups()
returns an array with the names of all the groups @access public
variableExists($a_group, $a_var_name)
returns if a variable exists or not @access public
getGroupCount()
returns number of groups @access public
removeGroup($a_group_name)
removes a group @access public
readGroup($a_group_name)
returns an associative array of the variables in one group @access public
addGroup($a_group_name)
adds a new group @access public
readVariable($a_group, $a_var_name)
reads a single variable from a group @access public
setVariable($a_group_name, $a_var_name, $a_var_value)
sets a variable in a group @access public
groupExists($a_group_name)
checks if a group exists @access public
error($a_errmsg)
set error message @access public
write()
save ini-file-data to filesystem @access private
parse()
load and parse an inifile @access private
__construct($a_ini_file_name)
Constructor @access public.
read()
read from ini file @access public
foreach($_POST as $key=> $value) $res