From 7c99fdff8683f7cd65835ec63ef8ffb49c77f6f5 Mon Sep 17 00:00:00 2001 From: Simon Lieb Date: Tue, 13 Dec 2016 13:16:35 +0100 Subject: [PATCH] Indentation - php-cs-fixer --- index.php | 68 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/index.php b/index.php index 07c9fdd..b5ea46b 100644 --- a/index.php +++ b/index.php @@ -1,51 +1,53 @@ ./?'.$urlhash.'
+ file_put_contents($hashfilepath, $url); + $content = './?'.$urlhash.'
As long as there is not collision, you can shorten it down to 3 characters.'; -} else if(!empty($_GET)) { - $urlhash = key($_GET); +} elseif (!empty($_GET)) { + $urlhash = key($_GET); - $hashfolder = substr($urlhash, 0, 2); - $hashfile = substr($urlhash, 2); + $hashfolder = substr($urlhash, 0, 2); + $hashfile = substr($urlhash, 2); - $hashfolderpath = './db/' . $hashfolder; - $hashfilepath = $hashfolderpath . '/' . $hashfile; + $hashfolderpath = './db/'.$hashfolder; + $hashfilepath = $hashfolderpath.'/'.$hashfile; - $findfiles = glob($hashfilepath . '*'); + $findfiles = glob($hashfilepath.'*'); - if(empty($findfiles)) { - $content = 'No files.'; - return 1; - } else if (count($findfiles) > 1) { - foreach($findfiles as $file) { - $file = str_replace('/', '', substr($file, 5)); - $content = './?'.$file.'
'; - } - } + if (empty($findfiles)) { + $content = 'No files.'; - $fullfilepath = current($findfiles); + return 1; + } elseif (count($findfiles) > 1) { + foreach ($findfiles as $file) { + $file = str_replace('/', '', substr($file, 5)); + $content = './?'.$file.'
'; + } + } - header('Location:' . file_get_contents($fullfilepath)); - return 0; + $fullfilepath = current($findfiles); + + header('Location:'.file_get_contents($fullfilepath)); + + return 0; } else { - $content = '
+ $content = ' Enter your URL:
'; }