<?php
/***********************************************************
    [WaiKuCms] (C)2011 - 2013 waikucms.com
    
	@function 编辑器文件管理ajax重命名

    @Filename ajax_file_rename.php $

    @Author pengyong $

    @Date 2013-01-06 20:21:59 $
*************************************************************/
error_reporting(0);
session_start();
define('THINK_PATH', true);
$config = include('../../../Config/config.ini.php');
$uname = cookie('uname');
$uid = cookie('uid');
$cmsauth = $_SESSION['cmsauth'];
$nowauth = substr(md5(strrev($uname).'waikucms'.$uid),0,10);
if(strcmp($cmsauth,$nowauth) <> 0)
{
   echo '身份认证信息失败!请重新登陆!';die();
}
empty($_POST['path']) ? die('0') : $path = $_POST['path'];
	$rename = $_POST['rename'];
	$repath = rtrim($_SERVER['DOCUMENT_ROOT'],'/').$path;
	$newpath = rtrim($_SERVER['DOCUMENT_ROOT'],'/').dirname($path).'/'.$rename;
	//rename
	if(rename($repath,$newpath)) die('1');
	die('执行失败,请检查权限!');
	function cookie($name)
	{
		global $config;
		$prefix = $config['COOKIE_PREFIX'];
		return $_COOKIE[$prefix.$name];
	}