⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.php

📁 easycms to learn easy php and see how to code in php and use mysql database requetes
💻 PHP
字号:
<?PHP
	/*
		EasyCMS main editor page	
		(c) Christian Heilmann
	*/
?>
<?PHP include_once('functions_inc.php');include_once('head_inc.php')?>
	<div id="nav"><?echo include_once('navbox.php')?></div>
	
	<?if ($navlook=='tree'){?>
		<div id="tree">
			<?PHP if($navigation==""){echo '<p></p><p>'.d('nonavigationmessage').'</p>';}else{include_once('tree.php');}?>
		</div>
	<?}?>
	
	<?PHP
		// Setting the main block style according to settings.
		if ($navlook=='tree' && $help!='off'){echo '<div id="main">';}
		if ($navlook!='tree' && $help!='off'){echo '<div id="mainnotree">';}
		if ($navlook!='tree' && $help=='off'){echo '<div id="mainsolo">';}
		if ($navlook=='tree' && $help=='off'){echo '<div id="mainnohelp">';}
	?>
	<?if ($navlook!='tree'){?>
		<?PHP if ($navigation==""){ echo d('nonavigationmessage');}else{include_once('tree.php');}?>
	<?}?>
	
	
	<?PHP if ($_POST['save']==''){
		$data=load('../data/'.$page);
		preg_match('/\[pagetitle:(.*?)\]/si',$data,$title);
		preg_match('/\[pagedescription:(.*?)\]/si',$data,$description);
		preg_match('/\[pagekeywords:(.*?)\]/si',$data,$keywords);
		preg_match('/\[pagetemplate:(.*?)\]/si',$data,$template);
	?>
		<h1><?=str_replace('%%page%%',$page,d('editingmessage'))?></h1>
		<form method="post" name="codeform" action="<?=$_SERVER['PHP_SELF']?>">
		<table border="0">
		<tr>
			<td><label for="title"><?=d('titlelabel')?></label></td>
			<td><input type="text" id="title" name="title" size="<?=$formwidth==''?'40':$formwidth?>" value="<?=$title[1]?>" /></td>
		</tr>
		<tr>
			<td><label for="description"><?=d('descriptionlabel')?></label></td>
			<td><input type="text" id="description" name="description" size="<?=$formwidth==''?'40':$formwidth?>" value="<?=$description[1]?>" /></td>
		</tr>
		<tr>
			<td><label for="keywords"><?=d('keywordslabel')?></label></td>
			<td><input type="text" id="keywords" name="keywords" size="<?=$formwidth==''?'40':$formwidth?>" value="<?=$keywords[1]?>" /></td>
		</tr>
		<tr>
			<td><label for="template"><?=d('templatelabel')?></label></td>
			<td>
				<select name="template" id="template">
					<?PHP
					foreach ($templates as $i=>$t){
					echo '<option value="'.$t.'"';
					if($template[1]=='' and $i==0){echo ' selected="selected"';}
					if($template[1]==$t){echo ' selected="selected"';}
					echo '>'.$t.'</option>';
					}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td colspan="2"><label for="code"><?=d('contentlabel')?></label></td>
		</tr>
		<tr>
			<td colspan="2">
				<textarea name="code" id="code" cols="<?=$formwidth==''?'50':$formwidth+10;?>" rows="15"><?=preg_replace('/\[page.*?\]/si','',$data)?></textarea>
				<input type="hidden" name="save" value="yes" />
				<input type="hidden" name="page" value="<?=$page?>" />
			</td>
		</tr>
		<tr>
			<td colspan="2" align="right"><input type="submit" value="<?=d('savebuttoncaption')?>"></td>
		</tr>
		</table>
		
		</form>
	<?PHP }else{
		$data=stripslashes($_POST['code']);
		$data.='[pagetitle:'.stripslashes($_POST['title']).']';
		$data.='[pagekeywords:'.stripslashes($_POST['keywords']).']';
		$data.='[pagedescription:'.stripslashes($_POST['description']).']';
		$data.='[pagetemplate:'.stripslashes($_POST['template']).']';
		$trig=save('../data/'.$page,$data);
		if ($trig==''){?>
			<h2><?=str_replace('%%page%%',$page,d('savesuccessmessage'))?></h2>
			<form method="post" action="generatepage.php">
			<input type="hidden" name="page" value="<?=$page?>" />
			<p align="right"><input type="submit" value="<?=d('generatebuttoncaption')?>" /></p>
			</form>
		<?PHP }else{?>
			<h2><?=str_replace('%%page%%',$page,d('saveerrrormessage'))?></h2>
			<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
			<table border="0">
			<tr>
				<td><label for="title"><?=d('titlelabel')?></label></td>
				<td><input type="text" size="60" id="title" name="title" value="<?=stripslashes($_POST['title'])?>" /></td>
			</tr>
			<tr>
				<td><label for="description"><?=d('descriptionlabel')?></label></td>
				<td><input type="text" size="60" id="description" name="description" value="<?=stripslashes($_POST['description'])?>" /></td>
			</tr>
			<tr>
				<td><label for="keywords"><?=d('keywordslabel')?></label></td>
				<td><input type="text" size="60" id="keywords" name="keywords" value="<?=stripslashes($_POST['keywords'])?>" /></td>
			</tr>
			<tr>
				<td><label for="template"><?=d('templatelabel')?></label></td>
				<td>
					<select name="template" id="template">
						<?PHP
						foreach ($templates as $i=>$t){
						echo '<option value="'.$t.'"';
						if($_POST['template']==$t){echo ' selected="selected"';}
						echo '>'.$t.'</option>';
						}
						?>
					</select>
				</td>
			</tr>
			</table>
			<label for="code"><?=d('contentlabel')?>:</label><br />
			<textarea name="code" id="code" cols="60" rows="15"><?=stripslashes($_POST['code'])?></textarea>
			<input type="hidden" name="save" value="yes" />
			<input type="hidden" name="page" value="<?=$page?>" />
			<p align="right"><input type="submit" value="<?=d('savebuttoncaption')?>" /></p>
			</form>
		<?PHP }}?>
		</div>

		<?PHP if ($help!='off'){?>
			<div id="tools">
				<?PHP include_once('htmlhelp.php');?>
			</div>
		<?PHP }?>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -