File "editDefaultFoot.php"

Full Path: /home/analogde/www/filetypes/editDefaultFoot.php
File size: 9.5 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!
***************************************************************/

if(isset($submit)){
  foreach($arrPages as $key => $page){
	  foreach($arrPages[$key]->parameter as $param)
			if(isset($HTTP_POST_VARS[$param->id]))
				$objValues[$param->id] = $HTTP_POST_VARS[$param->id];
	}

  $fileNameId = $arrPages[$fileNamePage]->parameter[$fileNameParameter]->id;

  #if($objValues[$fileNameId] != ""){
	  $strDefaultTemplate = implode("", file("./default.php"));
		
	  foreach($arrPages as $key => $page){
		  foreach($arrPages[$key]->parameter as $key => $param){	
				if($param->control == 3){
					$newValue = !isset($objValues[$param->id]) ? "false" : "true";
				  $strDefaultTemplate = str_replace("{@" . $param->id . "}", $newValue, $strDefaultTemplate);
				}else{
					$strDefaultTemplate = str_replace("{@" . $param->id . "}", str_replace(chr(92), "", $objValues[$param->id]), $strDefaultTemplate);
				}
			}
		}
		
		#if($fileName != ""){
		  if(($objValues[$fileNameId] . '.' . $acronym . "." . $fileExtension) != $fileName){
			  $sp = explode(".", $fileName);
			  @pxp_unlink($currentDir . '/' . $sp[0] . '.' . $acronym . "." . $fileExtension);
				@pxp_unlink($currentDir . '/' . $sp[0] . '.' . $acronym . '_dat.php');
			}
		#}
		
	  $file = fopen($currentDir . '/' . $objValues[$fileNameId] . '.' . $acronym . "." . $fileExtension, 'w');
		fwrite($file, $strDefaultTemplate);
		fclose($file);
	#}
	
	$packet = wddx_serialize_vars("objValues");

	$file = fopen($currentDir . '/' . $objValues[$fileNameId] . '.' . $acronym . '_dat.php', 'w');
	fwrite($file, '<?php ' . chr(13) . chr(10));
	fwrite($file, '$packet = wddx_deserialize("' . $packet . '");' . chr(13) . chr(10));
	fwrite($file, '$objValues = $packet["objValues"];' . chr(13) . chr(10));
	fwrite($file, ' ?>' . chr(13) . chr(10));
	fclose($file);
}else{
	if(!isset($objValues)){
	  $objValues = Array();
		foreach($arrPages as $key => $page){
  	  foreach($arrPages[$key]->parameter as $param){
			  if($param->default != NULL)$objValues[$param->id] = $param->default;
			}
		}
	}
}
?>
<html>
<head>
<title><?php echo $caption ?></title>
<style type="text/css">
<!--
button.tabOff{
  vertical-align:bottom;
  font-family:Verdana;
  font-size:11;
  font-weight:700;
  text-align:center;
  color: Navy;
  background-color:#c4e0f0;
  border-bottom:#c4e0f0 1px solid;
  height:20;
  cursor:pointer;
}
button.tabOn{
  vertical-align:bottom;
  font-family:Verdana;
  font-size:11;
  font-weight:700;
  text-align:center;
  color: Navy;
  background-color:#93BEE2;
  border-bottom:#93BEE2 1px solid;
  height:25;
  cursor:pointer;
}
div.tabOff{
  border:#93BEE2 5px solid;
  display:none;
}
div.tabOn{
  border:#93BEE2 5px solid;
}
-->
</style>
<link rel="stylesheet" type="text/css" href="<?php echo $PXP_url ?>/styles/<?php echo $PXP_style ?>/main.css"/>
<script language="JavaScript" type="text/javascript">
<!--

function resize_editor(){
  var newHeight
	var newWidth
  if(document.all){
    newHeight = document.body.offsetHeight - 90
		newWidth = document.body.offsetWidth - 51
    if(newHeight < 0)newHeight = 0
  }else{
    newHeight = window.innerHeight - 90
		newWidth = window.innerWidth - 27
  }

	var c = 0
	obj = document.getElementById("sizeObj" + c)
	while(obj){
	  obj.style.width = newWidth + "px"
	  obj.style.height = newHeight + "px"
		c++
		obj = document.getElementById("sizeObj" + c)
	}		
}

function tabClick(tabObj){
  var p = tabObj.parentNode
  var bts = p.childNodes
  var dvs = p.nextSibling.childNodes

  for(var t = 0; t < bts.length; t++){
    if(bts[t] == tabObj){
      bts[t].className = "tabOn"
      dvs[t].className = "tabOn"
    }else{
      if(bts[t].className == "tabOn"){
        bts[t].className = "tabOff"
        dvs[t].className = "tabOff"
      }
    }
  }
}
function init(){
  setTimeout(function(){window.onresize = resize_editor}, 333);
	resize_editor()
}
<?php
if($submit != ""){
  echo "opener.refreshDir()\r\n";
  echo "window.close()\r\n";
}
?>//javascript
//-->
</script>
</head>
<body onLoad="init()">
<form name="frm1" action="./edit.php" method="post">
<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 ?>">

<?php
$initFlag = true;
echo '<div>';
foreach($arrPages as $key => $page){
  if($initFlag){
    echo '<button type="button" class="tabOn" onClick="tabClick(this);' . $arrPages[$key]->onLabelClick . '">' . $arrPages[$key]->label . '</button>';
		$initFlag = false;
	}else{
	  echo '<button type="button" class="tabOff" onClick="tabClick(this);' . $arrPages[$key]->onLabelClick . '">' . $arrPages[$key]->label . '</button>';
	}
}
echo '</div>';

$initFlag = true;
echo '<div>';
foreach($arrPages as $key => $page){
  if($initFlag){
    echo '<div class="tabOn">';
		$initFlag = false;
	}else{
	  echo '<div class="tabOff">';
	}
	echo $arrPages[$key]->headHTML;
	if(sizeof($arrPages[$key]->parameter) > 0){
	  echo '<table id="sizeObj' . $arrPages[$key]->index . '" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top">';
	  echo '<table style="width:150px;height:50px">';
		
    foreach($arrPages[$key]->parameter as $key => $param){
		
      #$strDefaultTemplate = str_replace("{@" . $param->id . "}", htmlentities(str_replace(chr(92), "", $objValues[$param->id])), $strDefaultTemplate);
      
			echo '<tr>';
    	echo '<td style="width:10%"><nobr>&nbsp;' . $param->label . '&nbsp;</nobr></td>';
    	switch($param->control){
    	  case 0:
    			echo '<td><input type="text" name="' . $param->id . '" value="' . htmlentities(str_replace(chr(92), "", (isset($objValues[$param->id]) ? $objValues[$param->id] : "") )) . '"' . (($param->controlWidth != "") ? ' style="width:' . $param->controlWidth . '"' : '') . '></td>';
    		break;
    		case 1:
    			echo '<td><input type="password" name="' . $param->id . '" value="' . htmlentities(str_replace(chr(92), "", (isset($objValues[$param->id]) ? $objValues[$param->id] : "") )) . '"' . (($param->controlWidth != "") ? ' style="width:' . $param->controlWidth . '"' : '') . '></td>';
    		break;
    		case 2:
    			echo '<td>';
    			echo '<select size="1" name="' . $param->id . '"' . (($param->controlWidth != "") ? ' style="width:' . $param->controlWidth . '"' : '')  .'>';
    
    			if(is_array($param->options)){
    			  foreach($param->options as $option){
    				  echo '<option value="' . $option[0] . '"' . (((isset($objValues[$param->id]) ? $objValues[$param->id] : "") == $option[0]) ? ' selected="selected"' : '') . '>' . $option[1] . '</option>';
    				}
    			}else{
    						  
    			  $compColumn = "";
    			  if($param->optionGroupBy != ""){
    			    $arr = explode(":", $param->optionGroupBy);
    					$compColumn = $arr[0];
    					$labelColumn = $arr[1];
      				$compValue = $param->options->fields[$compColumn];
      				$bStartGroup = true;
    				}
    			
    			  for($i = 0; $i < $param->options->RecordCount(); $i++){
    				  
    					if($bStartGroup){
    					  echo '<optgroup label="' . $param->options->fields[$labelColumn] . '">';
    						$bStartGroup = false;
    					}
    
    				  echo '<option value="' . $param->options->fields[0] . '"' . (((isset($objValues[$param->id]) ? $objValues[$param->id] : "") == $param->options->fields[0]) ? ' selected="selected"' : '') . '>' . $param->options->fields[1] . '</option>';
    				  
    					$param->options->MoveNext();
    					
    					if($compValue != $param->options->fields[$compColumn]){
      					echo '</optgroup>';
    						$compValue = $param->options->fields[$compColumn];
    						$bStartGroup = true;
    					}
    				}
    			}
    			echo '</select></td>';
    		break;
    		case 3:
    		  echo '<td>';
    			echo '<input type="checkbox" name="' . $param->id . '" value="true"' . (((isset($objValues[$param->id]) ? $objValues[$param->id] : "") == true) ? ' checked="checked"' : '') . '>';
    			echo '</td>';
    		break;
    		case 4:
    		  echo '<td>&nbsp;' . (isset($objValues[$param->id]) ? $objValues[$param->id] : "") . '&nbsp;</td>';
    		break;
				case 5:
				break;
				case 6:
					echo '<td>&nbsp;' . (isset($objValues[$param->id]) ? $objValues[$param->id] : "") . '&nbsp;</td>';
				break;
    	}
    	echo '</tr>';
    }		
		
		echo '<tr><td>&nbsp;</td><td align="right"><input type="submit" name="submit" value="' . $PXP_languages[$PXP_language]['save'] . '">&nbsp;<input type="button" onClick="window.close()" value="' . $PXP_languages[$PXP_language]['cancel'] . '"></td></tr>';
		echo '</table>';
		echo '</td></tr></table>';
	}
	if(isset($arrPages[$key]))
		echo $arrPages[$key]->footHTML;
	
	echo '</div>';
}
echo '</div>';

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