From 03f4c7f3d592add2b4e10eb9f9020ff1f3346ace Mon Sep 17 00:00:00 2001 From: Mitsukarenai Date: Wed, 20 Feb 2013 20:14:12 +0100 Subject: [PATCH] =?UTF-8?q?=09modified:=20=20=200.3/functions.php=20Prise?= =?UTF-8?q?=20en=20compte=20trailing=20slash=20pour=20la=20d=C3=A9tection?= =?UTF-8?q?=20d'autoblogs=20existants.=20-comportement=20par=20d=C3=A9faut?= =?UTF-8?q?:=20d'abord=20contr=C3=B4le=20SANS,=20puis=20contr=C3=B4le=20AV?= =?UTF-8?q?EC=20et=20utilisation=20pour=20la=20cr=C3=A9ation=20dossier.=20?= =?UTF-8?q?=20(fix=20minimal,=20=C3=A0=20v=C3=A9rifier=20en=20prod)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 0.3/functions.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/0.3/functions.php b/0.3/functions.php index 0be8f2e..ad2bcb9 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -30,6 +30,10 @@ function urlToFolder($url) { return sha1(NoProtocolSiteURL($url)); } +function urlToFolderWithTrailingSlash($url) { + return sha1(NoProtocolSiteURL($url).'/'); +} + function escape($str) { return htmlspecialchars($str, ENT_COMPAT, 'UTF-8', false); } @@ -47,6 +51,12 @@ function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) { $error[] = 'Erreur: l\'autoblog '. $sitename .' existe déjà.'; return $error; } + + $foldername = urlToFolderWithTrailingSlash($siteurl); + if(file_exists($foldername)) { + $error[] = 'Erreur: l\'autoblog '. $sitename .' existe déjà.'; + return $error; + } if ( mkdir('./'. $foldername, 0755, false) ) { $fp = fopen('./'. $foldername .'/index.php', 'w+'); @@ -97,4 +107,4 @@ function updateType($siteurl) { else return array('type' => 'generic', 'name' => ''); } -?> \ No newline at end of file +?>