93 if (empty($a_ini_file_name))
95 $this->
error(
"no_file_given");
99 $this->INI_FILE_NAME = $a_ini_file_name;
111 if (!file_exists($this->INI_FILE_NAME))
113 $this->
error(
"file_does_not_exist");
119 if ($this->
parse() ==
false)
136 $this->GROUPS = parse_ini_file($this->INI_FILE_NAME,
true);
139 if ($this->GROUPS ==
false)
141 $this->
error(
"file_not_accessible");
145 $temp = array_keys($this->GROUPS);
146 $this->CURRENT_GROUP = $temp[count($temp)-1];
157 if (ereg(
"\[([[:alnum:]]+)\]",$a_data,
$out))
159 $this->CURRENT_GROUP= trim(
$out[1]);
161 elseif (!empty($a_data))
163 $split_data = split(
"=", $a_data);
176 $this->GROUPS = $a_data;
187 $fp = @fopen($this->INI_FILE_NAME,
"w");
191 $this->
error(
"Cannot create file $this->INI_FILE_NAME");
196 $result = fwrite($fp,
"; <?php exit; ?>\r\n");
199 $group_cnt = count($groups);
201 for ($i=0; $i<$group_cnt; $i++)
203 $group_name = $groups[$i];
207 $res = sprintf(
"[%s]\r\n",$group_name);
211 $res = sprintf(
"\r\n[%s]\r\n",$group_name);
217 for (reset($group); $key=key($group);next($group))
219 $res = sprintf(
"%s = %s\r\n",$key,
"\"".$group[$key].
"\"");
238 $group_cnt = count($groups);
244 for ($i=0; $i<$group_cnt; $i++)
246 $group_name = $groups[$i];
250 $content = sprintf(
"[%s]\n",$group_name);
254 $content .= sprintf(
"\n[%s]\n",$group_name);
260 for (reset($group); $key=key($group);next($group))
262 $content .= sprintf(
"%s = %s\n",$key,$group[$key]);
276 return count($this->GROUPS);
288 for (reset($this->GROUPS);$key=key($this->GROUPS);next($this->GROUPS))
304 if (!isset($this->GROUPS[$a_group_name]))
322 $this->
error(
"Group '".$a_group_name.
"' does not exist");
326 return $this->GROUPS[$a_group_name];
339 $this->
error(
"Group '".$a_group_name.
"' exists");
343 $this->GROUPS[$a_group_name] = array();
357 $this->
error(
"Group '".$a_group_name.
"' does not exist");
361 unset($this->GROUPS[$a_group_name]);
374 return isset($this->GROUPS[$a_group][$a_var_name]);
387 if (!isset($this->GROUPS[$a_group][$a_var_name]))
389 $this->
error(
"'".$a_var_name.
"' does not exist in '".$a_group.
"'");
393 return trim($this->GROUPS[$a_group][$a_var_name]);
408 $this->
error(
"Group '".$a_group_name.
"' does not exist");
412 $this->GROUPS[$a_group_name][$a_var_name] = $a_var_value;
423 $this->ERROR = $a_errmsg;