Indentation - php-cs-fixer

This commit is contained in:
Simon Lieb 2016-12-13 13:16:35 +01:00
parent 43f4052d86
commit 7c99fdff86

View file

@ -1,8 +1,8 @@
<?php <?php
if(!empty($_GET['url'])) { if (!empty($_GET['url'])) {
$url = $_GET['url']; $url = $_GET['url'];
if(strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) {
$url = 'http://'.$url; $url = 'http://'.$url;
} }
@ -11,30 +11,31 @@ if(!empty($_GET['url'])) {
$hashfolder = substr($urlhash, 0, 2); $hashfolder = substr($urlhash, 0, 2);
$hashfile = substr($urlhash, 2); $hashfile = substr($urlhash, 2);
$hashfolderpath = './db/' . $hashfolder; $hashfolderpath = './db/'.$hashfolder;
$hashfilepath = $hashfolderpath . '/' . $hashfile; $hashfilepath = $hashfolderpath.'/'.$hashfile;
mkdir($hashfolderpath, 0700, true); mkdir($hashfolderpath, 0700, true);
file_put_contents($hashfilepath, $url); file_put_contents($hashfilepath, $url);
$content = '<a href="./?'.$urlhash.'">./?'.$urlhash.'</a><br /> $content = '<a href="./?'.$urlhash.'">./?'.$urlhash.'</a><br />
As long as there is not collision, you can shorten it down to 3 characters.'; As long as there is not collision, you can shorten it down to 3 characters.';
} else if(!empty($_GET)) { } elseif (!empty($_GET)) {
$urlhash = key($_GET); $urlhash = key($_GET);
$hashfolder = substr($urlhash, 0, 2); $hashfolder = substr($urlhash, 0, 2);
$hashfile = substr($urlhash, 2); $hashfile = substr($urlhash, 2);
$hashfolderpath = './db/' . $hashfolder; $hashfolderpath = './db/'.$hashfolder;
$hashfilepath = $hashfolderpath . '/' . $hashfile; $hashfilepath = $hashfolderpath.'/'.$hashfile;
$findfiles = glob($hashfilepath . '*'); $findfiles = glob($hashfilepath.'*');
if(empty($findfiles)) { if (empty($findfiles)) {
$content = 'No files.'; $content = 'No files.';
return 1; return 1;
} else if (count($findfiles) > 1) { } elseif (count($findfiles) > 1) {
foreach($findfiles as $file) { foreach ($findfiles as $file) {
$file = str_replace('/', '', substr($file, 5)); $file = str_replace('/', '', substr($file, 5));
$content = '<a href="./?'.$file.'">./?'.$file.'</a><br />'; $content = '<a href="./?'.$file.'">./?'.$file.'</a><br />';
} }
@ -42,7 +43,8 @@ if(!empty($_GET['url'])) {
$fullfilepath = current($findfiles); $fullfilepath = current($findfiles);
header('Location:' . file_get_contents($fullfilepath)); header('Location:'.file_get_contents($fullfilepath));
return 0; return 0;
} else { } else {
$content = '<form method="get"> $content = '<form method="get">