From f68c29cc04b3064dc70365c966829073d84fc20a Mon Sep 17 00:00:00 2001 From: Wruczek Date: Mon, 31 Oct 2016 03:18:46 +0100 Subject: [PATCH] Using Bootstrap pull right class + code format --- api/status.php | 2 +- bans.php | 15 ++-- css/navbar.css | 4 +- css/style.css | 16 +--- css/theme.css | 163 ++++++++++++++++++++-------------------- include/adminlist.php | 27 ++++--- include/footer.php | 2 +- include/header.php | 4 +- include/language.php | 6 +- include/modulecheck.php | 4 +- include/tsutils.php | 4 +- index.php | 8 +- rules.php | 8 +- viewer.php | 4 +- 14 files changed, 129 insertions(+), 138 deletions(-) diff --git a/api/status.php b/api/status.php index c6c640d..85e6c65 100644 --- a/api/status.php +++ b/api/status.php @@ -55,7 +55,7 @@ function scriptFail($error) { ))); } -function exception_error_handler($errno, $errstr, $errfile, $errline ) { +function exception_error_handler($errno, $errstr, $errfile, $errline) { scriptFail("[$errfile @ $errline] " . $errstr); } diff --git a/bans.php b/bans.php index 7f62cde..2d7e0bd 100644 --- a/bans.php +++ b/bans.php @@ -5,7 +5,6 @@ require_once __DIR__ . "/include/tsutils.php"; require_once __DIR__ . "/lib/phpfastcache/autoload.php"; - use phpFastCache\Util; use phpFastCache\CacheManager; @@ -20,8 +19,6 @@ if (is_null($banlist)) { $banlist = array(getBanlist(), date('d-m-Y H:i:s')); $cache->set('banlist', $banlist, 600); } - - ?>
@@ -65,7 +62,7 @@ function getBanlist() { global $lang; try { - $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); + $tsAdmin = TeamSpeak3::factory(getTeamspeakURI() . "#no_query_clients"); $bany = $tsAdmin->banList(); @@ -73,7 +70,7 @@ function getBanlist() { foreach ($bany as $ban) { - if(!isset($ban['lastnickname'])) + if (!isset($ban['lastnickname'])) continue; $lastnickname = $ban['lastnickname']->toString(); @@ -82,10 +79,10 @@ function getBanlist() { $created = date('d-m-Y H:i:s', $ban['created']); $duration = $ban['duration']; - if(empty($reason)) + if (empty($reason)) $reason = "" . translate($lang["banlist"]["table"]["emptyreason"]) . ""; - if($duration == 0) + if ($duration == 0) $expires = translate($lang["banlist"]["table"]["permaban"]); else $expires = date('d-m-Y H:i:s', $ban['created'] + $duration); @@ -94,8 +91,8 @@ function getBanlist() { } return $output; - } catch(TeamSpeak3_Exception $e) { - if($e->getCode() == 1281) { + } catch (TeamSpeak3_Exception $e) { + if ($e->getCode() == 1281) { return ''; } else { return '

' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '

'; diff --git a/css/navbar.css b/css/navbar.css index 5665b52..61efa6c 100644 --- a/css/navbar.css +++ b/css/navbar.css @@ -30,7 +30,7 @@ } @media (min-width: 768px) { - .navbar-nav> li> a { + .navbar-nav > li > a { padding-top: 14.5px; padding-bottom: 14.5px; } @@ -61,6 +61,6 @@ margin-bottom: 14.5px; } -.navbar .dropdown-menu>li>a { +.navbar .dropdown-menu > li > a { font-size: 14px; } diff --git a/css/style.css b/css/style.css index aff6c61..bcd542c 100644 --- a/css/style.css +++ b/css/style.css @@ -23,11 +23,7 @@ a { text-align: right; } -.pullright { - float: right !important; -} - -.pullright .fa { +.pull-right .fa { margin-right: 0px } @@ -44,7 +40,6 @@ p, a { hyphens: auto; } - /* ****** */ /* STATUS */ /* ****** */ @@ -61,12 +56,11 @@ p, a { float: right } - /* ********* */ /* ADMINLIST */ /* ********* */ -.adminlist> .groupname~ .groupname { +.adminlist > .groupname ~ .groupname { margin-top: 15px; } @@ -93,7 +87,6 @@ p, a { margin-left: 19px } - /* ****** */ /* NAVBAR */ /* ****** */ @@ -106,7 +99,7 @@ body { font-size: 14px } -.nav> li> a { +.nav > li > a { padding-left: 10px; padding-right: 10px; } @@ -117,13 +110,12 @@ body { align-items: center; } -.navbar-brand> img { +.navbar-brand > img { height: 100%; padding: 5px 5px 5px 15px; width: auto; } - /* ****** */ /* FOOTER */ /* ****** */ diff --git a/css/theme.css b/css/theme.css index 082c95c..c63cd7e 100644 --- a/css/theme.css +++ b/css/theme.css @@ -40,15 +40,15 @@ caption { color: #00343f; } -.table>tfoot>tr>td { +.table > tfoot > tr > td { border-top: 1px solid #00343f } -.table>thead>tr>th { +.table > thead > tr > th { border-bottom: 2px solid #00343f } -.table>tbody+tbody { +.table > tbody + tbody { border-top: 2px solid #00343f } @@ -56,30 +56,30 @@ caption { border: 1px solid #00343f } -.table-bordered>tfoot>tr>td { +.table-bordered > tfoot > tr > td { border: 1px solid #00343f } -.table-striped>tbody>tr:nth-of-type(odd) { +.table-striped > tbody > tr:nth-of-type(odd) { background-color: #00343f } -.table-hover>tbody>tr:hover { +.table-hover > tbody > tr:hover { background-color: #004449 } -.table>thead>tr>td.active, -.table>tbody>tr>td.active, -.table>tfoot>tr>td.active, -.table>thead>tr>th.active, -.table>tbody>tr>th.active, -.table>tfoot>tr>th.active, -.table>thead>tr.active>td, -.table>tbody>tr.active>td, -.table>tfoot>tr.active>td, -.table>thead>tr.active>th, -.table>tbody>tr.active>th, -.table>tfoot>tr.active>th { +.table > thead > tr > td.active, +.table > tbody > tr > td.active, +.table > tfoot > tr > td.active, +.table > thead > tr > th.active, +.table > tbody > tr > th.active, +.table > tfoot > tr > th.active, +.table > thead > tr.active > td, +.table > tbody > tr.active > td, +.table > tfoot > tr.active > td, +.table > thead > tr.active > th, +.table > tbody > tr.active > th, +.table > tfoot > tr.active > th { background-color: #004449 } @@ -121,8 +121,8 @@ fieldset[disabled] .btn-link:focus { background-color: #00343f; } -.dropdown-menu>li>a:hover, -.dropdown-menu>li>a:focus { +.dropdown-menu > li > a:hover, +.dropdown-menu > li > a:focus { background-color: #004449 } @@ -130,63 +130,65 @@ fieldset[disabled] .btn-link:focus { background-color: #00343f; } -.nav>li>a:focus { +.nav > li > a:focus { background-color: #00343f } -.nav>li.disabled>a { +.nav > li.disabled > a { color: #00343f } -.nav>li.disabled>a:hover, -.nav>li.disabled>a:focus { +.nav > li.disabled > a:hover, +.nav > li.disabled > a:focus { color: #00343f; } -.nav .open>a, -.nav .open>a:hover, -.nav .open>a:focus { +.nav .open > a, +.nav .open > a:hover, +.nav .open > a:focus { background-color: #00343f; } -.nav-tabs>li>a:hover { +.nav-tabs > li > a:hover { border-color: #00343f #00343f transparent } -.nav-tabs>li.active>a:focus { +.nav-tabs > li.active > a:focus { border: 1px solid #00343f; } -.nav-tabs>li.active>a, -.nav-tabs>li.active>a:hover, -.nav-tabs>li.active>a:focus { +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:hover, +.nav-tabs > li.active > a:focus { border: 1px solid #00343f; } @media (min-width: 768px) { - .nav-tabs.nav-justified>li>a { + .nav-tabs.nav-justified > li > a { border-bottom: 1px solid #00343f; } - .nav-tabs.nav-justified>.active>a, - .nav-tabs.nav-justified>.active>a:hover, - .nav-tabs.nav-justified>.active>a:focus { + + .nav-tabs.nav-justified > .active > a, + .nav-tabs.nav-justified > .active > a:hover, + .nav-tabs.nav-justified > .active > a:focus { border-bottom-color: #00343f } } -.nav-tabs-justified>.active>a, -.nav-tabs-justified>.active>a:hover, -.nav-tabs-justified>.active>a:focus { +.nav-tabs-justified > .active > a, +.nav-tabs-justified > .active > a:hover, +.nav-tabs-justified > .active > a:focus { border: 1px solid #00343f } @media (min-width: 768px) { - .nav-tabs-justified>li>a { + .nav-tabs-justified > li > a { border-bottom: 1px solid #00343f; } - .nav-tabs-justified>.active>a, - .nav-tabs-justified>.active>a:hover, - .nav-tabs-justified>.active>a:focus { + + .nav-tabs-justified > .active > a, + .nav-tabs-justified > .active > a:hover, + .nav-tabs-justified > .active > a:focus { border-bottom-color: #00343f } } @@ -195,25 +197,26 @@ fieldset[disabled] .btn-link:focus { background-color: #00343f; } -.navbar-default .navbar-nav>li>a:hover, -.navbar-default .navbar-nav>li>a:focus { +.navbar-default .navbar-nav > li > a:hover, +.navbar-default .navbar-nav > li > a:focus { background-color: #083d48 } -.navbar-default .navbar-nav>.active>a, -.navbar-default .navbar-nav>.active>a:hover, -.navbar-default .navbar-nav>.active>a:focus { +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { background-color: #004449 } @media (max-width: 767px) { - .navbar-default .navbar-nav .open .dropdown-menu>li>a:hover, - .navbar-default .navbar-nav .open .dropdown-menu>li>a:focus { + .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus { background-color: #004449 } - .navbar-default .navbar-nav .open .dropdown-menu>.active>a, - .navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover, - .navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus { + + .navbar-default .navbar-nav .open .dropdown-menu > .active > a, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover, + .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus { background-color: #004449 } } @@ -222,36 +225,36 @@ fieldset[disabled] .btn-link:focus { background-color: #00343f; } -.pagination>li>a, -.pagination>li>span { +.pagination > li > a, +.pagination > li > span { background-color: #00343f; } -.pagination>li>a:hover, -.pagination>li>span:hover, -.pagination>li>a:focus, -.pagination>li>span:focus { +.pagination > li > a:hover, +.pagination > li > span:hover, +.pagination > li > a:focus, +.pagination > li > span:focus { background-color: #004449; } -.pagination>.disabled>a:focus { +.pagination > .disabled > a:focus { background-color: #00343f; } -.pager li>a, -.pager li>span { +.pager li > a, +.pager li > span { background-color: #00343f; } -.pager li>a:hover, -.pager li>a:focus { +.pager li > a:hover, +.pager li > a:focus { background-color: #004449 } -.pager .disabled>a, -.pager .disabled>a:hover, -.pager .disabled>a:focus, -.pager .disabled>span { +.pager .disabled > a, +.pager .disabled > a:hover, +.pager .disabled > a:focus, +.pager .disabled > span { background-color: #00343f; } @@ -302,22 +305,22 @@ button.list-group-item:focus { background-color: #004449; } -.panel>.panel-body+.table, -.panel>.panel-body+.table-responsive, -.panel>.table+.panel-body, -.panel>.table-responsive+.panel-body { +.panel > .panel-body + .table, +.panel > .panel-body + .table-responsive, +.panel > .table + .panel-body, +.panel > .table-responsive + .panel-body { border-top: 1px solid #00343f } -.panel-success>.panel-heading { +.panel-success > .panel-heading { color: #13ddcd; } -.panel-info>.panel-heading { +.panel-info > .panel-heading { color: #13ddcd; } -.panel-warning>.panel-heading { +.panel-warning > .panel-heading { color: #13ddcd; } @@ -337,19 +340,19 @@ button.list-group-item:focus { background-color: #004449; } -.popover.top>.arrow:after { +.popover.top > .arrow:after { border-top-color: #00343f } -.popover.right>.arrow:after { +.popover.right > .arrow:after { border-right-color: #00343f } -.popover.bottom>.arrow:after { +.popover.bottom > .arrow:after { border-bottom-color: #00343f } -.popover.left>.arrow:after { +.popover.left > .arrow:after { border-left-color: #00343f; } @@ -370,7 +373,7 @@ table .text-muted, color: #00343f } -.panel-default>.panel-heading { +.panel-default > .panel-heading { background-color: #004449; } diff --git a/include/adminlist.php b/include/adminlist.php index 672cef1..f2fe61a 100644 --- a/include/adminlist.php +++ b/include/adminlist.php @@ -3,7 +3,6 @@ require_once __DIR__ . "/tsutils.php"; require_once __DIR__ . "/../lib/phpfastcache/autoload.php"; - use phpFastCache\Util; use phpFastCache\CacheManager; @@ -30,27 +29,27 @@ function getAdminList() { $localIcons = array(100, 200, 300, 400, 500, 600); try { - $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); + $tsAdmin = TeamSpeak3::factory(getTeamspeakURI() . "#no_query_clients"); $output = ""; foreach ($admingroups as $group) { - if(!array_key_exists((string) $group, $tsAdmin->serverGroupList())) + if (!array_key_exists((string)$group, $tsAdmin->serverGroupList())) continue; $group = $tsAdmin->serverGroupGetById($group); $icon = ''; - if($group["iconid"]) { - if(!$group->iconIsLocal("iconid")) { + if ($group["iconid"]) { + if (!$group->iconIsLocal("iconid")) { $groupicon = getGroupIcon($tsAdmin, $group); - if($groupicon) { + if ($groupicon) { $icon = 'Ikona grupy '; } - } elseif(in_array($group["iconid"], $localIcons)) { + } elseif (in_array($group["iconid"], $localIcons)) { $icon = 'Ikona grupy '; } } @@ -59,7 +58,7 @@ function getAdminList() { $clients = $group->clientList(); - if(empty($clients)) { + if (empty($clients)) { $output .= '

' . translate($lang["adminlist"]["emptygroup"]) . '

'; continue; } @@ -67,17 +66,17 @@ function getAdminList() { foreach ($clients as $userInfo) { $user = getClientByDbid($tsAdmin, $userInfo['cldbid']); - if(!$user) { - $output .= '

' . $userInfo['client_nickname'] . '' . translate($lang["adminlist"]["status"]["offline"]) . '

'; + if (!$user) { + $output .= '

' . $userInfo['client_nickname'] . '' . translate($lang["adminlist"]["status"]["offline"]) . '

'; continue; } - $output .= '

Status użytkownika' . '' . $user . '' . ($user['client_away'] ? '' . translate($lang["adminlist"]["status"]["away"]) . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '

'; + $output .= '

Status użytkownika' . '' . $user . '' . ($user['client_away'] ? '' . translate($lang["adminlist"]["status"]["away"]) . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '

'; } } return $output; - } catch(TeamSpeak3_Exception $e) { + } catch (TeamSpeak3_Exception $e) { return '

' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '

'; } @@ -86,7 +85,7 @@ function getAdminList() { function getClientByDbid($tsAdmin, $cldbid) { try { return $tsAdmin->clientGetByDbid($cldbid); - } catch(TeamSpeak3_Exception $e) { + } catch (TeamSpeak3_Exception $e) { return false; } } @@ -94,7 +93,7 @@ function getClientByDbid($tsAdmin, $cldbid) { function getGroupIcon($tsAdmin, $group) { try { return $group->iconDownload(); - } catch(TeamSpeak3_Exception $e) { + } catch (TeamSpeak3_Exception $e) { return false; } } diff --git a/include/footer.php b/include/footer.php index 831ee0b..c848c49 100644 --- a/include/footer.php +++ b/include/footer.php @@ -29,7 +29,7 @@ - + diff --git a/include/header.php b/include/header.php index ac6bf49..141c4cf 100644 --- a/include/header.php +++ b/include/header.php @@ -131,7 +131,7 @@ $htalink = $config["general"]["enablehta"] ? "" : ".php";
-
+
@@ -146,7 +146,7 @@ $htalink = $config["general"]["enablehta"] ? "" : ".php"; $name = $item[0]; $linkdesc = $item[1]; $link = $item[2]; - echo '
  • ' . $name . ' ' . $linkdesc . '
  • '; + echo '
  • ' . $name . ' ' . $linkdesc . '
  • '; } ?>
    diff --git a/include/language.php b/include/language.php index 84920db..2c2d3ff 100644 --- a/include/language.php +++ b/include/language.php @@ -14,13 +14,13 @@ if (isset($_GET['lang'])) { $langcode = $_SESSION['lang']; } else if (isset($_COOKIE['lang'])) { $langcode = $_COOKIE['lang']; -} else if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { +} else if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $langcode = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); } else { $langcode = "en"; } -if(!file_exists(getLanguagePath($langcode))) +if (!file_exists(getLanguagePath($langcode))) $langcode = "en"; require_once getLanguagePath($langcode); @@ -35,7 +35,7 @@ function tl($pattern, $args = null) { function translate($pattern, $args = null) { - if(!$args) { + if (!$args) { return $pattern; } diff --git a/include/modulecheck.php b/include/modulecheck.php index a105734..daacbb8 100644 --- a/include/modulecheck.php +++ b/include/modulecheck.php @@ -29,7 +29,7 @@ if (!extension_loaded("mbstring")) { try { require_once __DIR__ . "/../lib/phpfastcache/autoload.php"; - \phpFastCache\CacheManager::Files(); + \phpFastCache\CacheManager::Files(); } catch (\phpFastCache\Exceptions\phpFastCacheDriverException $e) { $title = 'Directory is not writable'; @@ -38,7 +38,7 @@ try { die(showError($title, $text)); } -if(!file_exists(__DIR__ . "/../config/config.php")) { +if (!file_exists(__DIR__ . "/../config/config.php")) { $title = 'config.php does not exists'; $text = '

    Please go into the directory config and rename config.template.php to config.php.

    diff --git a/include/tsutils.php b/include/tsutils.php index 9a2d88a..07ffb23 100644 --- a/include/tsutils.php +++ b/include/tsutils.php @@ -11,11 +11,11 @@ function pingTeamspeakServer($uri) { try { $tsAdmin = TeamSpeak3::factory($uri); - if(!$tsAdmin->getProperty("virtualserver_status")) + if (!$tsAdmin->getProperty("virtualserver_status")) throw new Exception("Server is offline"); return $tsAdmin->getInfo(); - } catch(TeamSpeak3_Exception $e) { + } catch (TeamSpeak3_Exception $e) { return false; } diff --git a/index.php b/index.php index 2e94e63..3ed10d2 100644 --- a/index.php +++ b/index.php @@ -18,7 +18,7 @@ $parsedown = new Parsedown(); $path = __DIR__ . "/" . $config["general"]["newsDir"]; -if(file_exists($path)) +if (file_exists($path)) showNews($path); else echo '

    ' . translate($lang["index"]["errortitle"]) . '

    ' . translate($lang["index"]["errorsubtitle"]) . '

    '; @@ -33,7 +33,7 @@ function showNews($path) { $files = array_diff(scandir($path), array('..', '.')); foreach ($files as $newsFile) { - if(!endsWith($newsFile, ".md")) + if (!endsWith($newsFile, ".md")) continue; $file = readFileContent($path . "/" . $newsFile); @@ -60,8 +60,8 @@ function generateNewsBox($title, $author, $text) { ?> function readFileContent($file) { $fopen = @fopen($file, "r"); - if(!$fopen) return false; - $text = fread($fopen,filesize($file)); + if (!$fopen) return false; + $text = fread($fopen, filesize($file)); fclose($fopen); return $text; } diff --git a/rules.php b/rules.php index ce54157..e026b4f 100644 --- a/rules.php +++ b/rules.php @@ -6,12 +6,12 @@ $parsedown = new Parsedown(); $path = __DIR__ . "/config/rules.md"; -if(!file_exists($path)) { +if (!file_exists($path)) { echo '

    ' . translate($lang["rules"]["filenotfound"]) . '

    '; } else { $file = readFileContent($path); - if(!$file) { + if (!$file) { echo '

    ' . translate($lang["rules"]["readerror"]) . '

    '; } else { ?> @@ -32,8 +32,8 @@ if(!file_exists($path)) { function readFileContent($file) { $fopen = @fopen($file, "r"); - if(!$fopen) return false; - $text = fread($fopen,filesize($file)); + if (!$fopen) return false; + $text = fread($fopen, filesize($file)); fclose($fopen); return $text; } diff --git a/viewer.php b/viewer.php index 5d93dd7..a0e398f 100644 --- a/viewer.php +++ b/viewer.php @@ -25,9 +25,9 @@ function getViewer() { global $lang; try { - $tsAdmin = TeamSpeak3::factory(getTeamspeakURI(). "#no_query_clients"); + $tsAdmin = TeamSpeak3::factory(getTeamspeakURI() . "#no_query_clients"); return $tsAdmin->getViewer(new TeamSpeak3_Viewer_Html("lib/ts3phpframework/images/viewer/", "lib/ts3phpframework/images/flags/", "data:image")); - } catch(TeamSpeak3_Exception $e) { + } catch (TeamSpeak3_Exception $e) { return '

    ' . translate($lang["general"]["scripterror"], [$e->getCode(), $e->getMessage()]) . '

    '; } }