File "edit.php"

Full Path: /home/analogde/www/filetypes/pxlf/edit.php
File size: 7.07 KB
MIME-type: text/x-php
Charset: utf-8

<?php
/***************************************************************
*  Copyright notice
*
*  (c) 2003-2004 Tobias Bender (tobias@phpXplorer.org)
*  All rights reserved
*
*  This script is part of the phpXplorer project. The phpXplorer project 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.
*
*  The GNU General Public License can be found at
*  http://www.gnu.org/copyleft/gpl.html.
*  A copy is found in the textfile GPL.txt distributed with these scripts.
*
*  This script 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.
*
*  This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/

$acronym = basename(dirname(__FILE__));

require(dirname(__FILE__) . "/../defaultActionHead.php");

$fileName = getRequestVar("fileName");

if(!(strpos($fileName, "..") === FALSE))
	die($PXP_languages[$PXP_language]['accessDenied'] . " (804)");


$pInfo = checkFilePermissions($fileName, false);
if(!$pInfo["allowOpen"] or !$pInfo["allowEdit"])
	die($PXP_languages[$PXP_language]["accessDenied"] . " (809)");


$pxlf = $currentDir . "/" . $fileName;

# write permission files for each share
if(isset($HTTP_POST_VARS["keywords"])){

	$rowActions = explode("<|>", $HTTP_POST_VARS["rowActions"]);

	$keyword_groups = explode("<|>", $HTTP_POST_VARS["keyword_groups"]);
	$keywords = explode("<|>", $HTTP_POST_VARS["keywords"]);
	$descriptions = explode("<|>", $HTTP_POST_VARS["descriptions"]);
	
	$keywordsDefaultFileText = implode("", file($PXP_dir . "/filetypes/pxl/keywords.default.php"));
	
	$strKeywordList = "";
	
	foreach($keywords as $index => $value)
		if($rowActions[$index] != "d")
			$strKeywordList .= "addLngItem('" . $keyword_groups[$index] . "', '" . $keywords[$index] . "', '" . addSlashes($descriptions[$index]) . "');\r\n";

	$keywordsDefaultFileText = str_replace("{@addKeywords}", $strKeywordList, $keywordsDefaultFileText);

	$handle = fopen($pxlf . "/keywords.php", "w");
	fwrite($handle, $keywordsDefaultFileText);
	fclose($handle);
	
	exit;
}

if(file_exists($pxlf . "/keywords.php")){
	require($pxlf . "/keywords.php");
	asort($PXP_languageKeywords);
}else{
	$PXP_languageKeywords = Array();
}

			
$strGroups = "";
$strKeywords = "";
$strDescriptions = "";

foreach($PXP_languageKeywords as $key => $item){
	$strGroups .= $item->group . "','";
	$strKeywords .= $item->keyword . "','";
	$strDescriptions .= $item->description . "','";
}

function comleteString($strIn){
	return $strIn != "" ? "'" . substr($strIn, 0, strlen($strIn) - 1) . "null" : "null";
}

$strGroups = comleteString($strGroups);
$strKeywords = comleteString($strKeywords);
$strDescriptions = comleteString($strDescriptions);

?>
<html>
<head><title><?php echo $PXP_languages[$PXP_language]['editProperties'] ?>: <?php echo $fileName ?> (<?php echo $PXP_languages[$PXP_language]['filetype.' . $pInfo["extKey"]] ?>)</title>
<script src="<?php echo $GC_webGridClient_URL ?>/webGrid.js" type="text/javascript" language="JavaScript"></script>
<script language="JavaScript" type="text/javascript">
//<![CDATA[
httpParameter=new Array()
httpParameter['http_user']=''

wGB26897418379e65b47c9 = new gridBox("wGB26897418379e65b47c9")
var b=wGB26897418379e65b47c9

b.wgURL="<?php echo $GC_webGridClient_URL ?>"

//]]>
</script>
<script src="<?php echo $GC_webGridClient_URL ?>/cache/columnTemplates.js" type="text/javascript" language="JavaScript"></script>
<script src="<?php echo $GC_webGridClient_URL ?>/cache/validations.js" type="text/javascript" language="JavaScript"></script>
<script src="<?php echo $GC_webGridClient_URL ?>/getJSDefinition.php?id=wGB26897418379e65b47c9" type="text/javascript" language="JavaScript"></script>
<style type="text/css">
/*<![CDATA[*/
	body{margin:0px}
/*]]>*/
</style>
<script language="JavaScript" type="text/javascript">
//<![CDATA[

function save(){
	var f = document.frm1

	var arrRA = new Array()
	for(var y in pxlfmodell.rows)
		arrRA[arrRA.length] = pxlfmodell.gRS(pxlfmodell.rows[y])
		
	f.rowActions.value = arrRA.join("<|>")
	
	f.keyword_groups.value = pxlfmodell.aCols['keyword_group'].vs.join("<|>");
	f.keywords.value = pxlfmodell.aCols['keyword'].vs.join("<|>");
	f.descriptions.value = pxlfmodell.aCols['description'].vs.join("<|>");

	f.submit()
}

function init(){

	var g = pxlfmodell;
	g.rC = <?php echo sizeof($PXP_languageKeywords) ?>

	g.aCols['keyword_group'].vs = Array(<?php echo $strGroups ?>)
	g.aCols['keyword'].vs = Array(<?php echo $strKeywords ?>)
	g.aCols['description'].vs = Array(<?php echo $strDescriptions ?>)
	
	g.title = "<?php echo $PXP_languages[$PXP_language]['keywords'] ?>"
	g.aCols['keyword_group'].title = "<?php echo $PXP_languages[$PXP_language]['group'] ?>"
	g.aCols['keyword'].title = "<?php echo $PXP_languages[$PXP_language]['keyword'] ?>"
	g.aCols['description'].title = "<?php echo $PXP_languages[$PXP_language]['description'] ?>"


	b.render(window.frames['wGB26897418379e65b47c9Content'])
	b.resize()
	window.setInterval('wGB26897418379e65b47c9.resize()', 444)
}
//]]>
</script>
</head>
<body onLoad="init()">
<form name="frm1" action="./edit.php" method="post" target="frmSave">

<input type="hidden" name="rowActions" value="">

<input type="hidden" name="keyword_groups" value="">
<input type="hidden" name="keywords" value="">
<input type="hidden" name="descriptions" value="">

<input type="hidden" name="currentDir" value="<?php echo $currentDir ?>">
<input type="hidden" name="shareId" value="<?php echo $shareId ?>">
<input type="hidden" name="fileName" value="<?php echo $fileName ?>">

<input type="hidden" name="actionType" value="">
<input type="hidden" name="keyGenList" value="">


<table style="background-color:#DDDDDD" cellspacing="0" cellpadding="1" width="100%">
<tr>
	<td>

		<iframe scrolling="auto" id="wGB26897418379e65b47c9Content" name="wGB26897418379e65b47c9Content" width="100%" height="480px" frameborder="0"></iframe>

		<table border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td style="height:1px" colspan="4"></td>
		</tr>
		<tr>
			<td height="28">
				<input type="button" value="<?php echo $PXP_languages[$PXP_language]['add'] ?>" onClick="wGB26897418379e65b47c9.addRow()">
			</td>
			<td height="28">
				<input type="button" value="<?php echo $PXP_languages[$PXP_language]['insert'] ?>" onClick="wGB26897418379e65b47c9.insRow()">
			</td>
			<td height="28">
				<input type="button" value="<?php echo $PXP_languages[$PXP_language]['delete'] ?>" onClick="wGB26897418379e65b47c9.delRow()">
			</td>
			<td height="28">
				<input type="button" value="<?php echo $PXP_languages[$PXP_language]['save'] ?>" onClick="save()">
			</td>
			<td height="28">
				<input type="button" value="<?php echo $PXP_languages[$PXP_language]['cancel'] ?>" onClick="window.close()">
			</td>
		</tr>
		</table>
	</td>
</tr>
</table>

<iframe name="frmSave" style="display:none"></iframe>

</form>
</body>
</html>