Beispiel #1
0
// Update description
if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
{
	$error=0;

    $db->begin();

	$oldlabel=$ecmdir->label;
	$olddir=$ecmdir->getRelativePath(0);
	$olddir=$conf->ecm->dir_output.'/'.$olddir;

	// Fetch was already done
	$ecmdir->label = GETPOST("label");
	$ecmdir->description = GETPOST("description");
	$result=$ecmdir->update($user);
	if ($result > 0)
	{
		// Try to rename file if changed
		if ($oldlabel != $ecmdir->label
			&& file_exists($olddir))
		{
			$newdir=$ecmdir->getRelativePath(1);		// return "xxx/zzz/" from ecm directory
			$newdir=$conf->ecm->dir_output.'/'.$newdir;
			//print $olddir.'-'.$newdir;
			$result=@rename($olddir,$newdir);
			if (! $result)
			{
				$langs->load('errors');
				$mesg='<div class="error">'.$langs->trans('ErrorFailToRenameDir',$olddir,$newdir).'</div>';
				$error++;