From a3f7e375d4a79d718b9ce0624df49663ce7bd4bf Mon Sep 17 00:00:00 2001 From: Shikiryu Date: Fri, 7 Jan 2011 14:55:31 +0000 Subject: [PATCH] JS corrections --- add.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/add.php b/add.php index b410605..6d96993 100644 --- a/add.php +++ b/add.php @@ -28,6 +28,12 @@ elseif($ret === ShortURL::STATE_ALREADY_EXIST){ exit; } else{ - echo 'alert("Raccourci créé : http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($newname).'");'; + $URI = $_SERVER['REQUEST_URI']; + $folders = explode('/', $URI); + if(count($folders) > 2){ + $folder = '/'.$folders[1].'/'; + }else + $folder = '/'; + echo 'alert("'.ShortURL::STATE_CREATED.' : http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($s).'");window.clipboardData.setData("Text", "http://'.$_SERVER['SERVER_NAME'].$folder.rawurlencode($s).'");'; exit; } \ No newline at end of file