<?php
require_once('config.inc.php');
if(isset($_GET['logout'])){
@session_destroy();
header("Location: ".$_SERVER['PHP_SELF']."?".time());
exit;
}
if(!isset($_SESSION['logged'])){
if(trim($_POST['pwd'])==ADMIN_PASSWD){
$_SESSION['logged'] = true;
} else {
if(trim($_POST['pwd'])!=""){
echo "Wrong pass phrase. Please log in";
}
?>
<form action="#" method="post" >
Admin password:
<input type="password" name="pwd" size="40"/>
<input type="submit" name="login" value="login"/>
</form>
<?php
die();
}
}
if(count($_POST) && !isset($_POST['pwd']))
include("adminwrite.php");
$sections = array();
class Section {
var $name;
var $comment;
var $properties;
function Section(){
$properties = array();
}
}
class Property {
var $name;
var $value;
var $comment;
}
$section=null;
$property=new Property();
$lines = file ('weXplorer.ini');
foreach ($lines as $line_num => $line) {
$tabbed = false;
if(trim($line[0])==""){
$tabbed = true;
}
$line = trim($line);
if($line[0]=='[') {
if($section!=null)
$sections[] = $section;
$section = new Section();
$section->name = substr(substr($line, 1),0,-1);
} else if($line==""){
if($property!=null && $property->name !=null)
$section->properties[] = $property;
$property = new Property();
} elseif ($line[0]==';') {
if( $line[1]=='*'){
$c = preg_replace ( "/http:\\/\\/.*( |\$)/Ui", " <a target='_blank' href='\$0'>\$0</a> ", substr($line, 2))."<br/>\n";
if($tabbed)
$property->comment .= $c;
else {
$section->comment .= $c;
}
}
} else {
$pos = strpos ($line, "=");
if ($pos !== false) {
list($property->name, $property->value) = explode ( "=", $line,2);
$property->value = trim(str_replace('"','',$property->value));
$property->name = trim($property->name);
$property->value = " <input name='".$property->name."' type='text' size='50' value='".$property->value."' />";
}
if($property!=null && $property->name !=null)
$section->properties[] = $property;
$property = new Property();
}
}
if($section!=null)
$sections[] = $section;
?>
<link href="css/inieditor.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript">
function overCmt(ent){
cent = document.getElementById("c"+ent.id);
if(cent!=null)
cent.className='commentOver';
}
function outCmt(ent){
cent = document.getElementById("c"+ent.id);
if(cent!=null)
cent.className='comment';
}
function overSec(ent){
ent.className='sectionOver';
overCmt(ent);
document.getElementById("n"+ent.id).className="sectionNameOver";
}
function outSec(ent){
ent.className='section';
outCmt(ent);
document.getElementById("n"+ent.id).className="sectionName";
}
</script>
<?php
$id=0;
foreach($sections as $section){
$id++;
?>
<br/>
<form action="#" method="post">
<table class="section" id="id<?php echo $id; ?>" onmouseover="overSec(this)" onmouseout="outSec(this)" width="80%" border="0">
<tr>
<td colspan="3" id="nid<?php echo $id; ?>" class="sectionName"><?php echo $section->name ?></td>
</tr>
<?php if(trim($section->comment)!=""){ ?>
<tr>
<td colspan="3" id="cid<?php echo $id; ?>" class="comment"><?php echo $section->comment ?></td>
</tr>
<?php } ?>
<?php
foreach($section->properties as $property){
$id++;
if(trim($property->comment)!=""){
?>
<tr class="comment" id="cid<?php echo $id; ?>" onmouseover="this.className='commentOver'" onmouseout="this.className='comment'">
<td width="9%"> </td>
<td colspan="2"><?php echo $property->comment ?></td>
</tr>
<?php } ?>
<tr id="id<?php echo $id; ?>" onmouseover='overCmt(this)' onmouseout='outCmt(this)'>
<td width="9%"> </td>
<td width="0"><?php echo $property->name ?></td>
<td width="100%"><?php echo $property->value ?></td>
</tr>
<?php } ?>
</table>
<?php } ?>
<table class="section" width="80%" border="0">
<tr><td align="right">
<input style="border-width:0px;" type="image" src="images/sendiniedit.jpg">
</td></tr>
</table>
</form>