trying to fix update

This commit is contained in:
Karl Hudgell 2016-02-07 11:54:38 +00:00
parent d85bde05e0
commit 144bb999b6
7 changed files with 57 additions and 30 deletions

2
KWorld.php Normal file
View File

@ -0,0 +1,2 @@
<p style="text-align: center;">
<?php echo "<a href=\"#test-popup2\" class=\"open-popup-link\"><img src=\"$myurl/Pic/KWorld.png\"/></a>"; ?>

View File

@ -1,18 +1,22 @@
<?php
if(isset($_POST['submit']))
{
//echo exec('Update.bat');
// DEBUG
echo exec('Update.bat', $output);
print_r($output);
//echo '<script>parent.window.location.reload(true);</script>';
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="GET IT!">
</form>
<?php
}
?>
<html>
<head>
<title>Manual Update</title>
</head>
<body>
<?php
if(isset($_POST['submit']))
{
exec('cmd /c Update.bat', $output);
print_r($output);
echo "Done!";
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="DO IT!">
</form>
<?php
}
?>
</body>
</html>

View File

@ -219,7 +219,25 @@ findstr "widgetbackgroud" config.php >nul 2>&1
echo Custom Widget Updated
goto END
:END
rem KWorld
findstr "KWorldEnabled" config.php >nul 2>&1
if errorlevel 1 goto ONE
if errorlevel 0 goto ZERO
goto END
:ZERO
echo KWorld Toggle Already Updated
goto END
:ONE
echo ^<?php >>config.php
echo //// KWorld Toggle Settings >> config.php
echo $KWorldEnabled = "1"; >> config.php
echo //// >> config.php
echo ^?^> >> config.php
echo KWorld Toggle Updated
goto END
:END
rem Update Version
findstr "localversion" config.php >nul 2>&1
if errorlevel 1 goto ONE

View File

@ -22,6 +22,8 @@
Custom Background Colour:<input class="color" name="backgroundcolor" value="<?php echo $custombackground ?>"</td>
<br />
<br />
KWorld Enabled: <input name="kworldenabled" id="id" type="checkbox" <?php if($KWorldEnabled > "0") echo "checked=checked; "; ?> /><br />
<br />
Services Widget Enabled: <input name="servicesvisible" id="id" type="checkbox" <?php if($servicesvisible > "0") echo "checked=checked; "; ?> /><br />
Clock Widget Enabled: <input name="clockvisible" id="id" type="checkbox" <?php if($clockvisible > "0") echo "checked=checked; "; ?> /><br />
KKnowledge Widget Enabled: <input name="kknowledgefeedvisible" id="id" type="checkbox" <?php if($kknowledgefeedvisible > "0") echo "checked=checked; "; ?> /><br />

View File

@ -1,9 +0,0 @@
<?php
$p = popen('Update.bat', 'r');
if ($p)
{
while (!feof($p))
echo gets($p); // get output line-by-line
pclose($p);
}
?>

View File

@ -15,6 +15,7 @@ $showversion1 = $_POST['showversion'];
$widgetbackgroud1 = $_POST['widgetvisible'];
$customwidgetbackgroud1 = $_POST['customwidget'];
$widgetbackgroudcolour1 = $_POST['widgetbackgroudcolour'];
$KWorldEnabled1 = $_POST['kworldenabled'];
//
$fl='../config.php';
@ -82,6 +83,12 @@ if (empty($widgetbackgroud1)) {
$content = preg_replace( '/\$customwidgetbackgroud = \"(.*?)\";/', '$customwidgetbackgroud = "1";', $content);
}
$content = preg_replace( '/\$widgetbackgroudcolour = \"(.*?)\";/', '$widgetbackgroudcolour = "#'.$widgetbackgroudcolour1.'";', $content);
// kworld Settings
if (empty($KWorldEnabled1)) {
$content = preg_replace( '/\$KWorldEnabled = \"(.*?)\";/', '$KWorldEnabled = "0";', $content);
} else {
$content = preg_replace( '/\$KWorldEnabled = \"(.*?)\";/', '$KWorldEnabled = "1";', $content);
}
/*write operation ->*/ $tmp =fopen($fl, "w"); fwrite($tmp, $content); fclose($tmp);
//sleep for 5 seconds

View File

@ -98,8 +98,11 @@ $('.window').hide();
<?php echo "<p style=\" text-align: center;\">$yourname's Server Access</p>";?>
</div>
<p style="text-align: center;">
<?php echo "<a href=\"#test-popup2\" class=\"open-popup-link\"><img src=\"$myurl/Pic/KWorld.png\"/></a>"; ?>
<?php
if ($KWorldEnabled > "0") {
require "KWorld.php";
}
?>
</p>
<div class="gridWrapper">