Skip to content

Commit 3df22e8

Browse files
committed
feat: update styling for Bootstrap 3 to 4
1 parent e79deb5 commit 3df22e8

File tree

7 files changed

+194
-262
lines changed

7 files changed

+194
-262
lines changed

phpboard/config.php

+86-83
Original file line numberDiff line numberDiff line change
@@ -33,95 +33,96 @@
3333

3434
<!-- Page Content -->
3535
<div class="container" ng-app="configApp" ng-controller="configCtrl">
36-
<h1 class="page-header" style="position: relative;">PHPConfig <br><span class="details">
37-
<?php
38-
print $phpIniPath . ' ';
39-
if (is_writable($phpIniPath)) {
40-
showLabel("Writable", "success");
41-
} else {
42-
showLabel("Not-Writable", "danger");
43-
}
44-
?>
45-
36+
<div class="container">
37+
<div class="row">
38+
<h1 class="page-header" style="position: relative;">PHPConfig</h1>
39+
</div>
40+
<div class="row align-items-center justify-content-between mb-3">
41+
<span class="details">
42+
<?php
43+
print $phpIniPath . ' ';
44+
if (is_writable($phpIniPath)) {
45+
showLabel("Writable", "success");
46+
} else {
47+
showLabel("Not-Writable", "danger");
48+
}
49+
?>
50+
</span>
4651
<button type="button" id="save-btn" style="float: right" ng-click="save()" class="btn btn-<?php print($isPhpIniWirtable ? 'primary' : 'default'); ?>" <?php print($isPhpIniWirtable ? '' : 'disabled'); ?>>
4752
<span id="msg-block-spinner" class="spinner-grow spinner-grow-sm spinner-hidden" style="margin:0 5px 0 -2px;" role="status" aria-hidden="true"></span>Save
4853
</button>
49-
</span>
50-
</h1>
51-
<div class="row">
52-
53-
<div class="col-lg-12">
54-
<form class="form-horizontal" method="post" id="form-config">
55-
<div class="form-group row">
56-
<input type="hidden" name="name" ng-model="data.name" value="config">
57-
<?php
58-
$isTypeChanged = false;
59-
$index = 0;
60-
$prefixHtml = '<div class="col-md-6">';
61-
$suffixHtml = '</div>';
62-
foreach ($specificKeys_ as $key => $value) {
63-
if ($value === null) {
64-
continue;
65-
}
66-
if ($index > 1 and $index % 2 == 0) {
67-
print '</div> <div class="form-group row">';
68-
}
69-
if (gettype($value) == "boolean") {
70-
if (!$isTypeChanged) {
71-
print '</div><br> <div class="form-group row">';
54+
</div>
55+
</div>
56+
<form class="form-horizontal" method="post" id="form-config">
57+
<div class="form-group row justify-content-between">
58+
<input type="hidden" name="name" ng-model="data.name" value="config">
59+
<?php
60+
$isTypeChanged = false;
61+
$index = 0;
62+
$prefixHtml = '<div class="col-6 row">';
63+
$suffixHtml = '</div>';
64+
foreach ($specificKeys_ as $key => $value) {
65+
if ($value === null) {
66+
continue;
67+
}
68+
if ($index > 1 and $index % 2 == 0) {
69+
print '</div> <div class="form-group row justify-content-between">';
70+
}
71+
if (gettype($value) == "boolean") {
72+
if (!$isTypeChanged) {
73+
print '</div><br> <div class="form-group row justify-content-between">';
7274

73-
$isTypeChanged = true;
74-
$index = 0;
75-
}
76-
if ($value == 1) {
77-
$value = "checked";
78-
} else {
79-
$value = "";
80-
}
81-
print $prefixHtml . '
82-
<label class="col-md-7 col-xs-8 col-form-label">' . $key . '</label>
83-
<div class="col-md-5 col-xs-4">
84-
<label class="switch">
85-
<input type="hidden" name="config[' . $key . ']" value="Off">
86-
<input type="checkbox" name="config[' . $key . ']" value="On" ' . $value . '>
87-
<span class="slider round"></span>
88-
</label>
89-
</div>
90-
' . $suffixHtml;
91-
} else if ($key == 'date.timezone') {
92-
$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
93-
$options = '';
94-
foreach ($tzlist as $item) {
95-
$selection = '';
96-
if ($value == $item) {
97-
$selection = 'selected';
98-
}
99-
$options .= '<option value="' . $item . '" ' . $selection . '>' . $item . '</option>';
100-
}
101-
print $prefixHtml . '
102-
<label class="col-md-7 col-form-label">' . $key . '</label>
103-
<div class="col-md-5">
104-
' . '<select class="form-control form-control-plaintext" name="config[' . $key . ']">'
105-
. $options .
106-
'<select>
107-
</div>
108-
' . $suffixHtml;
109-
} else {
110-
print $prefixHtml . '
111-
<label class="col-md-7 col-form-label">' . $key . '</label>
112-
<div class="col-md-5">
113-
<input type="text" class="form-control form-control-plaintext" name="config[' . $key . ']" value="' . $value . '">
114-
</div>
115-
' . $suffixHtml;
75+
$isTypeChanged = true;
76+
$index = 0;
77+
}
78+
if ($value == 1) {
79+
$value = "checked";
80+
} else {
81+
$value = "";
82+
}
83+
print $prefixHtml . '
84+
<label class="col-md-7 col-xs-8 col-form-label">' . $key . '</label>
85+
<div class="col-md-5 col-xs-4">
86+
<label class="switch">
87+
<input type="hidden" name="config[' . $key . ']" value="Off">
88+
<input type="checkbox" name="config[' . $key . ']" value="On" ' . $value . '>
89+
<span class="slider round"></span>
90+
</label>
91+
</div>
92+
' . $suffixHtml;
93+
} else if ($key == 'date.timezone') {
94+
$tzlist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
95+
$options = '';
96+
foreach ($tzlist as $item) {
97+
$selection = '';
98+
if ($value == $item) {
99+
$selection = 'selected';
116100
}
117-
$index += 1;
101+
$options .= '<option value="' . $item . '" ' . $selection . '>' . $item . '</option>';
118102
}
103+
print $prefixHtml . '
104+
<label class="col-md-7 col-form-label">' . $key . '</label>
105+
<div class="col-md-5">
106+
' . '<select class="form-control" name="config[' . $key . ']">'
107+
. $options .
108+
'<select>
109+
</div>
110+
' . $suffixHtml;
111+
} else {
112+
print $prefixHtml . '
113+
<label class="col-md-7 col-form-label">' . $key . '</label>
114+
<div class="col-md-5">
115+
<input type="text" class="form-control" name="config[' . $key . ']" value="' . $value . '">
116+
</div>
117+
' . $suffixHtml;
118+
}
119+
$index += 1;
120+
}
119121

120-
?>
121-
</div>
122+
?>
122123
</div>
123-
</form>
124-
</div>
124+
</form>
125+
125126
</div>
126127
</div>
127128
<script>
@@ -139,7 +140,9 @@
139140
$http({
140141
method: 'POST',
141142
url: "phpconfig.php",
142-
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
143+
headers: {
144+
'Content-Type': 'application/x-www-form-urlencoded'
145+
},
143146
data: form.serialize()
144147
}).then(function successCallback(response) {
145148
$timeout(function() {
@@ -160,4 +163,4 @@
160163
<!-- /.container -->
161164
<?php
162165
getFooter();
163-
?>
166+
?>

phpboard/include/functions.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ function getFooter($title = "", $jsList = "") {
3030
require_once "theme/footer.php";
3131
}
3232

33-
function showLabel($msg = "", $type = "default") {
33+
function showLabel($msg = "", $type = "secondary") {
3434
print makeLabel($msg, $type);
3535
}
3636

37-
function makeLabel($msg = "", $type = "default") {
38-
return '<span class="label label-' . $type . '">' . $msg . '</span>';
37+
function makeLabel($msg = "", $type = "secondary") {
38+
return '<span class="align-self-center badge badge-' . $type . '">' . $msg . '</span>';
3939
}
4040

4141
function showBreadCrumb($address = '') {
4242
$exp = explode('/', $address);
43-
$str = '<ul class="breadcrumb">';
43+
$str = '<ul class="breadcrumb py-2">';
4444
$str .= '<li><a href="http://' . URL_PROJECT . '">root</a></li>';
4545
$dir = '';
4646
foreach ($exp as $item) {
@@ -53,7 +53,7 @@ function showBreadCrumb($address = '') {
5353
$dir .= $item;
5454
$str .= '<li><a href="http://' . URL_PROJECT . '?d=' . $dir . '">' . $item . '</a></li> ';
5555
}
56-
56+
5757
$str .= ' '.(is_writable(PATH_ROOT.$address)?makeLabel("Writable", "success"):makeLabel("Not-Writable", "danger"));
5858

5959
$str .= '</ul>';
@@ -67,7 +67,7 @@ function getWebServerDetails() {
6767
$str = strpos($str, "PHP")!==false?$str:$str.' '.'PHP/' . PHP_VERSION;
6868
}
6969

70-
$str = str_replace(array('+', '~'),' ', $str); // it's space in XAMPP and +/~ in LEMP, so I need to consider all.
70+
$str = str_replace(array('+', '~'),' ', $str); // it's space in XAMPP and +/~ in LEMP, so I need to consider all.
7171
$exp = explode(' ', $str);
7272
$str = '';
7373
$count = 0;

phpboard/index.php

+30-24
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,22 @@
2626
$name = $pData->name ?? '';
2727
if (empty($name)) {
2828
ajaxDone(false, "File name is empty!");
29-
} if (file_exists(PATH_ROOT . $directory .$name)) {
29+
}
30+
if (file_exists(PATH_ROOT . $directory . $name)) {
3031
ajaxDone(false, "Duplicated file name!");
3132
} else {
32-
ajaxDone(fopen(PATH_ROOT . $directory .$name, "w")!==false);
33+
ajaxDone(fopen(PATH_ROOT . $directory . $name, "w") !== false);
3334
}
3435
} else if ($act == 'addFolder') {
3536
$directory = $pData->dir ?? '';
3637
$name = $pData->name ?? '';
3738
if (empty($name)) {
3839
ajaxDone(false, "Folder name is empty!");
39-
} if (file_exists(PATH_ROOT . $directory .$name)) {
40+
}
41+
if (file_exists(PATH_ROOT . $directory . $name)) {
4042
ajaxDone(false, "Duplicated folder name!");
4143
} else {
42-
ajaxDone(mkdir(PATH_ROOT . $directory .$name, 0777, true), "w");
44+
ajaxDone(mkdir(PATH_ROOT . $directory . $name, 0777, true), "w");
4345
}
4446
}
4547

@@ -104,14 +106,14 @@
104106
$dirs_list .= '
105107
<tr id="tr-' . $index . '" data-href="' . $directory . $entry . '">
106108
<td>
107-
<img class="dir" src="theme/assets/images/folder.png">
108-
<a href="http://' . URL_PROJECT . '?d=' . $directory . $entry . '" data-href="' . $entry . '"> ' . $entry . ' </a>
109+
<img class="dir" src="theme/assets/images/folder.png">
110+
<a href="http://' . URL_PROJECT . '?d=' . $directory . $entry . '" data-href="' . $entry . '"> ' . $entry . ' </a>
109111
</td>
110112
<td> --- </td>
111113
<td>' . date('M d, Y H:i', $stat['mtime']) . '</td>
112114
<td>' . getPermDescription($path) . '</td>
113115
<td>'
114-
. (true ? '<button type="button" class="btn btn-default btn-sm btn-dirtozip" ng-click="zipDir($event, ' . $index . ')">Create Zip File</button> ' : ' ')
116+
. (true ? '<button type="button" class="btn btn-outline-secondary btn-sm btn-dirtozip" ng-click="zipDir($event, ' . $index . ')">Create Zip File</button> ' : ' ')
115117
. makeDeleteButtonForDir($path, $entry, $index) .
116118
'</td>
117119
</tr>';
@@ -120,13 +122,13 @@
120122
<tr id="tr-' . $index . '" data-href="' . $directory . $entry . '" data-file="' . $entry . '">
121123
<td>
122124
<img class="file" src="theme/assets/images/file.png">
123-
<a href="http://' . URL_ROOT . $directory . $entry . '" data-href="' . $entry . '"> ' . $entry . ' </a>
125+
<a href="http://' . URL_ROOT . $directory . $entry . '" data-href="' . $entry . '"> ' . $entry . ' </a>
124126
</td>
125127
<td>' . getFileSizeFormatted($stat['size']) . '</td>
126128
<td>' . date('M d, Y H:i', $stat['mtime']) . '</td>
127129
<td>' . getPermDescription($path) . '</td>
128130
<td>'
129-
. (true ? '<input type="button" class="btn btn-default btn-sm" ng-click="downloadFile($event, ' . $index . ')" value="Download"> ' : ' ')
131+
. (true ? '<input type="button" class="btn btn-outline-secondary btn-sm" ng-click="downloadFile($event, ' . $index . ')" value="Download"> ' : ' ')
130132
. makeDeleteButtonForFile($path, $entry, $index) .
131133
'</td>
132134
</tr>';
@@ -145,7 +147,7 @@ function getPermDescription($path)
145147
$desc[] = 'write';
146148
if (is_executable($path))
147149
$desc[] = 'exec';
148-
return decoct(fileperms($path) & 0777).'<br>'.implode('+', $desc);
150+
return decoct(fileperms($path) & 0777) . '<br>' . implode('+', $desc);
149151
}
150152

151153
function makeDeleteButtonForDir($path, $entry, $index)
@@ -170,8 +172,6 @@ function makeDeleteButtonForFile($path, $entry, $index)
170172
return '<input type="button" class="btn btn-danger btn-sm" ng-click="deleteFileDir($event, ' . $index . ')" value="Delete" title="Delete without confirmation!"> ';
171173
}
172174

173-
174-
175175
getHeader();
176176
?>
177177
<!-- Page Content -->
@@ -184,21 +184,27 @@ function makeDeleteButtonForFile($path, $entry, $index)
184184
showBreadCrumb($directory);
185185
?>
186186
<div class="file-upload">
187-
<ul ng-controller="addNewCtl">
188-
<li ng-click="showUploadBox($event)"><span class="glyphicon glyphicon-upload"></span> Upload</li>
189-
<li ng-click="addNewFile($event)"><span class="glyphicon glyphicon-plus"></span> <span class="m-hidden-xs">New </span>File</li>
190-
<li ng-click="addNewFolder($event)"><span class="glyphicon glyphicon-plus"></span> <span class="m-hidden-xs">New </span>Folder</li>
191-
<li>
192-
<input style="display:none" type="text" ng-model="newfileName" id="newfileName" name="newfileName" placeholder="File/Folder Name">
193-
<input style="display:none" type="button" ng-click="addNewFileFolderHide($event)" class="btn btn-default btn-xs m-hidden-xs" value=" Cancel ">
194-
<input style="display:none" type="button" ng-click="addNewFileFolder($event)" class="btn btn-primary btn-xs" value=" Add ">
195-
</li>
187+
<ul class="row p-0 my-1" ng-controller="addNewCtl">
188+
<div class="col col-auto pr-0">
189+
<li type="button" class="btn btn-outline-primary btn-sm" ng-click="showUploadBox($event)">Upload</li>
190+
</div>
191+
<div class="col col-auto pr-0 btn-group">
192+
<button type="button" id="btn-newFile" class="btn btn-outline-primary btn-sm" ng-click="addNewFile($event)">New File</button>
193+
<button type="button" id="btn-newFolder" class="btn btn-outline-primary btn-sm" ng-click="addNewFolder($event)">New Folder</button>
194+
</div>
195+
<div id="upload-group" class="col input-group input-group-sm" style="display:none">
196+
<input type="text" ng-model="newfileName" id="newfileName" class="form-control" name="newfileName" placeholder="File/Folder Name">
197+
<div class="input-group-append">
198+
<button class="input-group-text btn btn-danger" type="button" ng-click="addNewFileFolderHide($event)">Cancel</button>
199+
<button class="input-group-text btn btn-success" type="button" ng-click="addNewFileFolder($event)">Add</button>
200+
</div>
201+
</div>
196202
</ul>
197203
<upload id="filedrop" to="index.php"></upload>
198204
</div>
199205
<div class="table-responsive" style="border: 1px solid #efefef;">
200-
<table class="table filestable">
201-
<thead>
206+
<table class="table table-hover">
207+
<thead class="thead-light">
202208
<tr>
203209
<th>Name</th>
204210
<th>Size</th>
@@ -213,7 +219,7 @@ function makeDeleteButtonForFile($path, $entry, $index)
213219
print '<tr>
214220
<td colspan="5" style="text-align: center;
215221
padding: 50px;">Directory is empty!</td>
216-
<tr>';
222+
<tr>';
217223
} else {
218224
print $dirs_list . $files_list;
219225
}

0 commit comments

Comments
 (0)