<?
/**
* Copyright (C) 2004 Tony Bierman
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/*
see README.html for complete documentation
*/
$strCfgFile = phpgiggle_wordsfile;
?>
<script language="JavaScript">
<!--
function GetVarValue(field){
selected=false;
for (Count = 0; Count < document.selectform.strCfgVar.length; Count++){
if(document.selectform.strCfgVar[Count].selected){
selected=true;
var string = document.selectform.strCfgVar[Count].value;
var stringArray = string.split("-||-");
strCfgVarValue = stringArray[1];
strCfgCommentValue = stringArray[2];
}
}
if ((navigator.appName.indexOf("Microsoft") != -1) && (parseInt(navigator.appVersion) >= 4)){
document.selectform.currVal.style.backgroundColor="yellow";
}
document.selectform.currVal.value=strCfgVarValue;
document.selectform.strCfgValNew.value=strCfgVarValue;
document.selectform.comment.value=strCfgCommentValue;
document.selectform.strCfgValNew.focus();
return true;
}
//-->
</script>
<? if(!$DoChanges){ ?>
<div id="content" width="80%">
<form method="POST" name="selectform" action="<? echo $PHP_SELF ?>">
<input type="hidden" name="strCfgFile" size="20" value="<? echo $strCfgFile ?>">
<h2>Update phpGiggle keyword or phrase</h2>
<br/>Keyword:<br/>
<select name="strCfgVar" onChange="GetVarValue(this)">
<option value=""></option>
<?
//include($strCfgFile);
$strContent = file ($strCfgFile);
natcasesort($strContent);
reset($strContent);
while (list ($intLineNum, $strLine) = each ($strContent))
{
if(eregi("^".$valid_key_regexp, $strLine))
{ // show any line beginning with a $
$strLineParts=explode(" = ",$strLine);
$var = ereg_replace("[$\t ]","",($strLineParts[0]));
$val = trim($strLineParts[1]);
if(!eregi("\[",$var))
{
echo '<option value="'.$var.'-||-'.$val.'">'.str_replace("_"," ",$var).'</option>'."\n";
}
}
}
?>
</select><br/>
Current Value:<br/><input disabled type="text" name="currVal" size="50%"><br/>
New Value: <br/><input type="text" name="strCfgValNew" size="50%"><br/><br/>
<input align="right" type="submit" value="Update Keyword" name="DoChanges">
</form>
</div>
<? } ?>
<? if($DoChanges){
//while(list($key, $val) = each ($_POST)) print $key . " = " . $val . "<br>";
$strCfgVars=preg_split("/\-\|\|\-/",$strCfgVar);
ReplaceConfValue($strCfgFile,$strCfgVars[0],preg_replace("/[\\\'\"]/", "", $strCfgValNew));
?>
<form method="POST" name="selectform" action="<? echo $PHP_SELF ?>">
<input type="hidden" name="strCfgFile" value="<? echo $strCfgFile ?>"><br/>
<input type="hidden" name="admin_option" value="update"><br/>
<input type="submit" name="done" value="Update another keyword..">
</form></div>
<? } ?>