Skip to content

Commit

Permalink
Bug Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
causefx committed May 5, 2016
1 parent 9b87b4f commit 851c6ba
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 160 deletions.
2 changes: 1 addition & 1 deletion css/tabs.min.css

Large diffs are not rendered by default.

Binary file added fonts/glyphicons-halflings-regular.eot
Binary file not shown.
229 changes: 229 additions & 0 deletions fonts/glyphicons-halflings-regular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/glyphicons-halflings-regular.ttf
Binary file not shown.
Binary file added fonts/glyphicons-halflings-regular.woff
Binary file not shown.
299 changes: 148 additions & 151 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function write_ini_file($content, $path) {
//ini_set('display_errors',1); error_reporting(E_ALL);

$configfile = 'settings.ini.php';
$examplefile = 'example.ini.php';

try {
$config = parse_ini_file('settings.ini.php', true);
Expand All @@ -49,106 +48,105 @@ function write_ini_file($content, $path) {
<link rel="stylesheet" href="css/bootstrap-iconpicker.min.css"/>

<style>
body {
margin: 50px;
}
body {
margin: 50px;
}

.fa {
min-width: 14px;
}
.fa {
min-width: 14px;
}

.form-inline .form-control,
.form-inline .btn {
margin-bottom: 8px;
}
.form-inline .form-control,
.form-inline .btn {
margin-bottom: 8px;
}

.form-group {
width: 100%;
}

input[type=checkbox].css-checkbox {
position:absolute; z-index:-1000; left:-1000px; overflow: hidden; clip: rect(0 0 0 0); height:1px; width:1px; margin:-1px; padding:0; border:0;
}

input[type=checkbox].css-checkbox + label.css-label {
padding-left:55px;
height:30px;
display:inline-block;
line-height:30px;
background-repeat:no-repeat;
background-position: 0 0;
font-size:30px;
vertical-align:middle;
cursor:pointer;

}

input[type=checkbox].css-checkbox:checked + label.css-label {
background-position: 0 -30px;
}
label.css-label {
background-image:url(img/check.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0 auto;
padding: 0;
}
</style>
.form-group {
width: 100%;
}

<body>


<?
input[type=checkbox].css-checkbox {
position:absolute; z-index:-1000; left:-1000px; overflow: hidden; clip: rect(0 0 0 0); height:1px; width:1px; margin:-1px; padding:0; border:0;
}

input[type=checkbox].css-checkbox + label.css-label {
padding-left:55px;
height:30px;
display:inline-block;
line-height:30px;
background-repeat:no-repeat;
background-position: 0 0;
font-size:30px;
vertical-align:middle;
cursor:pointer;
}

input[type=checkbox].css-checkbox:checked + label.css-label {
background-position: 0 -30px;
}
label.css-label {
background-image:url(img/check.png);
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0 auto;
padding: 0;
}
</style>

//Password crap
foreach ($config as $keyname => $section) { if(($keyname == "general")) { $nopass = $section["password"]; } }
$salt = substr(str_replace('+','.',base64_encode(md5(mt_rand(), true))),0,16);
$rounds = 10000;
if(empty($_POST["password-0"])){ $_POST["password-0"] = $nopass;}
if(strlen($_POST["password-0"]) < 50){ $_POST["password-0"] = crypt($_POST["password-0"], sprintf('$5$rounds=%d$%s$', $rounds, $salt)); }
//password crap
<body>

$sampleData .= '; <?php die("Access denied"); ?>' . "\r\n";

foreach ($_POST as $parameter => $value) {
$splitParameter = explode('-', $parameter);
if ($value == "on")
$value = "true";
<?
//Password crap
if(array_key_exists('category-0', $_POST) == true){
foreach ($config as $keyname => $section) { if(($keyname == "general")) { $nopass = $section["password"]; } }
$salt = substr(str_replace('+','.',base64_encode(md5(mt_rand(), true))),0,16);
$rounds = 10000;
if(empty($_POST["password-0"])){ $_POST["password-0"] = $nopass;}
if(strlen($_POST["password-0"]) < 50){ $_POST["password-0"] = crypt($_POST["password-0"], sprintf('$5$rounds=%d$%s$', $rounds, $salt)); }
setcookie("test1", "test", time() + (86400 * 1), "/");
setcookie("test2", $_POST["password-0"], time() + (86400 * 7), "/");
//password crap


if($splitParameter[0] == "category"){ $sampleData .= "[" . $value . "]\r\n"; }else{ $sampleData .= $splitParameter[0] . " = \"" . $value . "\"\r\n"; }
//Gather Config Write Info
$sampleData .= '; <?php die("Access denied"); ?>' . "\r\n";

foreach ($_POST as $parameter => $value) {
$splitParameter = explode('-', $parameter);
if ($value == "on")
$value = "true";

}
if($action == "write"){
write_ini_file($sampleData, $configfile);
if($splitParameter[0] == "category"){ $sampleData .= "[" . $value . "]\r\n"; }else{ $sampleData .= $splitParameter[0] . " = \"" . $value . "\"\r\n"; }

sleep(.5);
echo "<!DOCTYPE html>";
echo "<head>";
echo "<title>Form submitted</title>";
echo "<script type='text/javascript'>window.location.replace('settings.php');</script>";
echo "</head>";
echo "<body></body></html>";
}

}
?>


if($action == "write"){
write_ini_file($sampleData, $configfile);
sleep(.5);
echo "<!DOCTYPE html>";
echo "<head>";
echo "<title>Form submitted</title>";
echo "<script type='text/javascript'>window.location.replace('settings.php');</script>";
echo "</head>";
echo "<body></body></html>";
}

}
?>

<form action="?action=write" method="post" name="adminForm" class="form-inline">
<?foreach ($config as $keyname => $section) {
setcookie("test3", "test", time() + (86400 * 1), "/");
setcookie("test4", $_POST["password-0"], time() + (86400 * 7), "/");
if(($keyname == "general")) {
echo '<div class="form-group clearfix">';
echo '<input type="hidden" name="category-0" class="form-control" value="general">';
Expand All @@ -157,84 +155,83 @@ function write_ini_file($content, $path) {
echo '<input type="text" name="password-0" class="form-control" placeholder="Leave Blank if no change" value=""> ';
if($section['useicons'] == "true"){echo '<input type="checkbox" name="useicons-0" id="useicons-0" class="css-checkbox" checked> ';}else {echo '<input type="checkbox" name="useicons-0" id="useicons-0" class="css-checkbox"> ';}
echo '<label for="useicons-0" class="css-label">Icons</label></div><br/><hr/><br/> ';
}}?>

}
}?>

<div id="tagsForm" class="sortable">

<?$i = 0;
foreach ($config as $keyname => $section) {

if(($keyname !== "general")) {?>

<div class="form-group clearfix">
<span class="btn btn-default move" type="button"><span class="fa fa-arrows"></span></span>
<input type="text" name="category-<?=$i;?>" class="form-control" value="<?=$keyname;?>">
<input type="text" name="url-<?=$i;?>" class="form-control" placeholder="url" value="<?=$section['url']?>">
<button data-placement="left" data-cols="5" data-rows="5" class="btn btn-default" name="icon-<?=$i;?>" role="iconpicker" data-iconset="fontawesome" data-icon="<?=$section['icon']?>"></button>
<?if($section['enabled'] == "true"){echo '<input type="checkbox" name="enabled-' . $i .'" id="enabled-' . $keyname . '" class="css-checkbox" checked>';}else {echo '<input type="checkbox" name="enabled-' . $i .'" id="enabled-' . $keyname . '" class="css-checkbox">';}?>
<label for="enabled-<?=$keyname;?>" class="css-label">Enabled</label>
<?if($section['guest'] == "true"){echo '<input type="checkbox" name="guest-' . $i .'" id="guest-' . $keyname . '" class="css-checkbox" checked>';}else {echo '<input type="checkbox" name="guest-' . $i .'" id="guest-' . $keyname . '" class="css-checkbox">';}?>
<label for="guest-<?=$keyname;?>" class="css-label">Guest</label> <button class="btn btn-danger deleteGroup" id="remScnt" type="button"><span class="fa fa-trash"></span></button>
</div>

<?}
$i++;
}?>

</div>

<div class="form-group clearfix">
<button class="btn btn-primary" id="addScnt" type="button"><span class="fa fa-plus"></span></button>
<button class="btn btn-success" type="submit"> Save Settings </button>
</div>

</form>

<script type="text/javascript" src="https://code.jquery.com/jquery-1.4.3.min.js"></script>

<script type='text/javascript'>

<div id="tagsForm" class="sortable">


<?
$i = 0;
foreach ($config as $keyname => $section) {

if(($keyname !== "general")) {

?>
<div class="form-group clearfix">
<span class="btn btn-default move" type="button"><span class="fa fa-arrows"></span></span>
<input type="text" name="category-<?=$i;?>" class="form-control" value="<?=$keyname;?>">
<input type="text" name="url-<?=$i;?>" class="form-control" placeholder="url" value="<?=$section['url']?>">
<button data-placement="left" data-cols="5" data-rows="5" class="btn btn-default" name="icon-<?=$i;?>" role="iconpicker" data-iconset="fontawesome" data-icon="<?=$section['icon']?>"></button>
<? if($section['enabled'] == "true"){echo '<input type="checkbox" name="enabled-' . $i .'" id="enabled-' . $keyname . '" class="css-checkbox" checked>';}else {echo '<input type="checkbox" name="enabled-' . $i .'" id="enabled-' . $keyname . '" class="css-checkbox">';}?>
<label for="enabled-<?=$keyname;?>" class="css-label">Enabled</label> <? if($section['guest'] == "true"){echo '<input type="checkbox" name="guest-' . $i .'" id="guest-' . $keyname . '" class="css-checkbox" checked>';}else {echo '<input type="checkbox" name="guest-' . $i .'" id="guest-' . $keyname . '" class="css-checkbox">';}?> <label for="guest-<?=$keyname;?>"" class="css-label">Guest</label> <button class="btn btn-danger deleteGroup" id="remScnt" type="button"><span class="fa fa-trash"></span></button>

</div>

<?

}
$i++;
}?>

</div>
<div class="form-group clearfix">
<button class="btn btn-primary" id="addScnt" type="button"><span class="fa fa-plus"></span></button>
<button class="btn btn-success" type="submit"> Save Settings </button>
</div>
</form>

<script type="text/javascript" src="https://code.jquery.com/jquery-1.4.3.min.js"></script>

<script type='text/javascript'>
$(function() {
var scntDiv = $('#tagsForm');
var i = <?=$i?>;

$('#addScnt').on('click', function() {
$('<div class="form-group clearfix ui-sortable-handle"> <span class="btn btn-default move" type="button"><span class="fa fa-arrows"></span></span> <input type="text" name="category-' + i +'" class="form-control" placeholder="Tag" value="New Tab"> <input type="text" name="url-' + i +'" class="form-control" placeholder="url" value="Add URL"> <button class="btn btn-default" name="icon-' + i +'" role="iconpicker" data-iconset="fontawesome" data-icon="fa-question"></button> <input type="checkbox" name="enabled-' + i +'" id="enabled-' + i +'" class="css-checkbox"> <label for="enabled-' + i +'" class="css-label">Enabled</label> <input type="checkbox" name="guest-' + i +'" id="guest-' + i +'" class="css-checkbox"> <label for="guest-' + i +'" class="css-label">Guest</label> <button class="btn btn-danger deleteGroup" id="remScnt" type="button"><span class="fa fa-trash"></span></button></div>').appendTo(scntDiv);
$('<div class="form-group clearfix ui-sortable-handle"> <span class="btn btn-default move" type="button"><span class="fa fa-arrows"></span></span> <input type="text" name="category-' + i +'" class="form-control" placeholder="Tag" value="New Tab"> <input type="text" name="url-' + i +'" class="form-control" placeholder="url" value="Add URL"> <button class="btn btn-default" name="icon-' + i +'" role="iconpicker" data-iconset="fontawesome" data-icon="fa-question"></button> <input type="checkbox" name="enabled-' + i +'" id="enabled-' + i +'" class="css-checkbox"> <label for="enabled-' + i +'" class="css-label">Enabled</label> <input type="checkbox" name="guest-' + i +'" id="guest-' + i +'" class="css-checkbox"> <label for="guest-' + i +'" class="css-label">Guest</label> <button class="btn btn-danger deleteGroup" id="remScnt" type="button"><span class="fa fa-trash"></span></button></div>').appendTo(scntDiv);
i++;
return false;

});

$(document).on('click','#remScnt', function() {
$(this).closest('div').remove();
i--;
return false;

$(this).closest('div').remove();
i--;

return false;
});
});

</script>

<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://code.jquery.com/ui/1.11.2/jquery-ui.min.js'></script>

<script>$( "#tagsForm" ).sortable({connectWith: ".sortable"});</script>
});

<!-- jQuery -->
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<!-- Bootstrap -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- Bootstrap-Iconpicker Iconset for Font Awesome -->
<script type="text/javascript" src="js/iconset-fontawesome-4.2.0.min.js"></script>
<!-- Bootstrap-Iconpicker -->
<script type="text/javascript" src="js/bootstrap-iconpicker.min.js"></script>


</script>

<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

<script src='https://code.jquery.com/ui/1.11.2/jquery-ui.min.js'></script>

<script>$( "#tagsForm" ).sortable({connectWith: ".sortable"});</script>

<!-- jQuery -->
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>

<!-- Bootstrap -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<!-- Bootstrap-Iconpicker Iconset for Font Awesome -->
<script type="text/javascript" src="js/iconset-fontawesome-4.2.0.min.js"></script>

<!-- Bootstrap-Iconpicker -->
<script type="text/javascript" src="js/bootstrap-iconpicker.min.js"></script>

</body>
10 changes: 2 additions & 8 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@

}

/*$salt = substr(str_replace('+','.',base64_encode(md5(mt_rand(), true))),0,16);
$rounds = 10000;
$given_hash = crypt($realpass, sprintf('$5$rounds=%d$%s$', $rounds, $salt));
*/

$pass = isset( $_POST["pass"] ) ? $_POST["pass"] : "none" ;

if(isset( $_POST["pass"] ) && $pass !== "none"){ $error = "Wrong Password!";}
Expand All @@ -50,8 +45,7 @@
$test_hash = crypt($pass, sprintf('$%s$%s$%s$', $parts[1], $parts[2], $parts[3]));

if(($hash_pass == $test_hash)){
setcookie("logged", "Dashboard", time() + (86400 * 7), "/");
//echo "<meta http-equiv='refresh' content='0'>";
setcookie("logged", $hash_pass, time() + (86400 * 7), "/");
echo "<!DOCTYPE html>";
echo "<head>";
echo "<title>Form submitted</title>";
Expand All @@ -73,7 +67,7 @@

}else{

echo "<!DOCTYPE html>";
echo "<!DOCTYPE html>";
echo "<head>";
echo "<title>Form submitted</title>";
echo "<script type='text/javascript'>window.location.replace('settings.php');</script>";
Expand Down

0 comments on commit 851c6ba

Please sign in to comment.