Location: PHPKode > projects > PhpGiggle > phpGiggle/includes/phpgiggle-add.inc.php
<?
/**
    * 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>Add a new phpGiggle keyword or phrase</h2>
    <br/>Keyword or phrase:<br/>
    <input type="text" name="strCfgVarNew" size="50%"><br/>
    Value: <br/><input type="text" name="strCfgValNew" size="50%"><br/><br/>
    <input align="right" type="submit" value="Add Keyword" name="DoChanges">
</form>
</div>
<? } ?>

<? if($DoChanges){
        //while(list($key, $val) = each ($_POST)) print $key . " = " . $val . "<br>";
	//echo "DEBUG: \$strCfgVarNew = $strCfgVarNew<br/>\n";
	//echo "DEBUG: \$strCfgValNew = $strCfgValNew<br/>\n";	
 	AddConfValue($strCfgFile, preg_replace("/[^\w|\s|\.|\_|\:]/i", "", $strCfgVarNew), 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="add"><br/>
	<input type="submit" name="done" value="Add another keyword..">
	</form></div>	
<? } ?>
Return current item: PhpGiggle