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

📄 adm_tpl.php

📁 这个版本只是修正了一些BUG
💻 PHP
字号:
<?php
/*************************************************
	adm_tpl.php  

	Version  : 1.2
	Author   : Tracemouse (tracemouse@msn.com)
	Copyright: www.vitci.com
	Writed   : 2003/10/20
	Modified : 2004/04/19
**************************************************/
require "./common.php";
require "../include/dir.php";
$file_name='./adm_tpl.php';
$tpl_root_dir='../templates';

if ((!$editsubmit)&&(!$listsubmit))              //未发送表单
{
	if ($action == 'add')
    	{                //添加页面
 		$display = 'edit';
 	}
    	elseif ($action == 'del')
    	{
    		if (!is_dir($tpl_path.'/'.$dfile))
        	{
       			if(!@unlink($tpl_path.'/'.$dfile))
       				gotourl($language['alt_file_del_fail']);
            		else
            			gotourl('File/Dir delete success!',$file_name.'?tpl_path='.$tpl_path);
        	}
    		else
    		{
       			if(!rmdir($tpl_path.'/'.$dfile))
       				gotourl($language['alt_dir_del_fail']);
            		else
            			gotourl('File/dir delete success!',$file_name.'?tpl_path='.$tpl_path);
        	}
    	}
    	else                                //列表页面
	{
 		if (!$tpl_path)
 		{
  			$tpl_path = $tpl_root_dir;
  			$filelist = get_dir($tpl_path);
  			$display = 'list';
 		}
 		else
 		{
  			if (is_dir($tpl_path.'/'.$filename))
  			{
   				if (isset($filename))  $tpl_path = $tpl_path.'/'.$filename;
   				$filelist = get_dir($tpl_path);
   				$display = 'list';
  			}
  			else
  			{
    			$fp = fopen($tpl_path.'/'.$filename, 'r');
    			$filetext = fread($fp, filesize($tpl_path.'/'.$filename));
    			fclose($fp);
   				$filetext = str_replace("\\'", "'", htmlspecialchars($filetext));
    			$display = 'edit';
  			}
 		}
	}                                //列表页面  end
}                                   //未发送表单  end
elseif ($editsubmit)                //发送表单处理
{
	//if (file_exists($tpl_path.'/'.$filename))
  	$fp = fopen($tpl_path.'/'.$filename, 'w');
    	$filetext=stripslashes($filetext);  //去除 '\'
    	fwrite($fp,$filetext);
  	fclose($fp);
  	gotourl('File write success!',$file_name.'?tpl_path='.$tpl_path);
}
elseif ($listsubmit)            //删除记录
{
 	/*
    	if(is_array($delete))
    	{
    	foreach($delete as $dfile)
        {
     		if (!is_dir($tpl_path.'/'.$dfile))
            	{
       			if(!@unlink($tpl_path.'/'.$dfile))
       			gotourl($file_name.'?tpl_path='.$tpl_path,3,'删除文件不成功-请检查你的模板目录是否设置了正确的权限');
     		}
    		else
    		{
       			if(!rmdir($tpl_path.'/'.$dfile))
       				gotourl($file_name.'?tpl_path='.$tpl_path,3,'删除目录不成功-权限不够或者目录不为空');
  		}
	}
    	}
    */
	if (!empty($n_tpldir))
    	{
    		if(file_exists($tpl_root_dir.'/'.$n_tpldir))
        		gotourl($language['alt_dir_cre_exist']);
    		if(!mkdir($tpl_root_dir.'/'.$n_tpldir,0777))
     			gotourl($language['alt_dir_cre_fail']);
        	gotourl('Loading...',$file_name);
  	}
    	else
    		gotourl('Loading....',$file_name);
}

include template('tpl');
?>

⌨️ 快捷键说明

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