Location: PHPKode > projects > Openology PHP Application Integration > openology/backend/edit/_samples/php/createphp.php
<?php
/***************************************************************************
 *   copyright            : (C) 2006 The openology Group
 *   email                : hide@address.com
 *
 *   $Id: $
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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.
 *
 ***************************************************************************/

header('Content-Type: text/html; charset=UTF-8');
include ('config.php');
session_start();
$title=$_POST['title'];
$filename = $_POST['filename'];
$description = $_POST['description'];
$keyword = $_POST['keyword'];


define("CHANGLIANG","$");
$hidden = "<?php 
define('OOO_INCLUDE', 1);     
include_once 'config.php';
include_once OOO_ROOT.'/init.php';
include_once 'page.php';";

$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('page_title', '$title');
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('page_description', '$description');
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('page_keywords', '$keyword');
";

$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('contents', basename(__FILE__, '.php') . '.tpl');
";


$hidden .= 'if (';
$hidden .= CHANGLIANG;
$hidden .= "_SESSION['session_lang'] == 'en')
{
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('yy_header', 'en_header');
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('yy_footer', 'en_footer');
}
else 
{
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('yy_header', 'zh_header'); 
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->assign('yy_footer', 'zh_footer');
}
";
$hidden .= CHANGLIANG;
$hidden .= "smarty->display('template.tpl');
";
$hidden .= "?>";
		   
	   
$file = "../$filename.php";
$ppfile = fopen($file,"w+");
fwrite($ppfile,$hidden);
fclose($ppfile);

if ( isset( $_POST ) )
   $postArray = &$_POST ;		// 4.1.0 or later, use $_POST
else
   $postArray = &$HTTP_POST_VARS ;	// prior to 4.1.0, use HTTP_POST_VARS

foreach ( $postArray as $sForm => $value )
{
	$postedValue =  stripslashes( $value  ) ;
    
}

$file="../templates/$filename.tpl";
$open=fopen($file,"w+");
fwrite($open,$postedValue);
fclose($open);
ShowMsg("创建成功","../$filename.php");

?>
Return current item: Openology PHP Application Integration