copy from interface/web/sites/mail_blacklist_edit.php
copy to interface/lib/classes/ini_parser.inc.php
File was copied from interface/web/sites/mail_blacklist_edit.php |
| | |
| | | <?php
|
| | | |
| | | /*
|
| | | Copyright (c) 2005, Till Brehm, projektfarm Gmbh
|
| | | Copyright (c) 2006, Till Brehm, projektfarm Gmbh |
| | | All rights reserved.
|
| | |
|
| | | Redistribution and use in source and binary forms, with or without modification,
|
| | |
| | | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| | | */
|
| | |
|
| | | class ini_parser { |
| | |
|
| | | /******************************************
|
| | | * Begin Form configuration
|
| | | ******************************************/
|
| | | var $config; |
| | |
|
| | | $tform_def_file = "form/mail_blacklist.tform.php";
|
| | | function parse_ini_string($ini) { |
| | | $ini = str_replace("\r\n","\n",$ini); |
| | | $lines = explode("\n",$ini); |
| | |
|
| | | /******************************************
|
| | | * End Form configuration
|
| | | ******************************************/
|
| | | foreach($lines as $line) { |
| | |
|
| | | require_once('../../lib/config.inc.php');
|
| | | require_once('../../lib/app.inc.php');
|
| | |
|
| | | // Checking module permissions
|
| | | if(!stristr($_SESSION["s"]["user"]["modules"],$_SESSION["s"]["module"]["name"])) {
|
| | | header("Location: ../index.php");
|
| | | exit;
|
| | | if($line != '') { |
| | | $line = trim($line); |
| | | if(preg_match("/^\[([\w\d_]+)\]$/", $line, $matches)) { |
| | | $section = strtolower($matches[1]); |
| | | } elseif(preg_match("/^([\w\d_]+)=(.*)$/", $line, $matches) && $section != null) { |
| | | $item = trim($matches[1]); |
| | | $this->config[$section][$item] = trim($matches[2]); |
| | | } |
| | | } |
| | | } |
| | | return $this->config; |
| | | }
|
| | |
|
| | | // Loading classes
|
| | | $app->uses('tpl,tform,tform_actions');
|
| | | $app->tform_actions->onLoad();
|
| | |
|
| | |
|
| | | function get_ini_string($file) { |
| | | $content = ''; |
| | | foreach($this->config as $section => $data) { |
| | | $content .= "[$section]\n"; |
| | | foreach($data as $item => $value) { |
| | | if($value != '') $content .= "$item=$value\n"; |
| | | } |
| | | } |
| | | return $content; |
| | | } |
| | | |
| | | } |
| | | |
| | | ?> |