mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 07:13:59 +01:00
Remove GitHub manager
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
/* First, reset everything to a standard */
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, font, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
b, u, i, center,
|
||||
dl, dt, dd, ol, ul, li,
|
||||
fieldset, form, label, legend,
|
||||
table, caption, tbody, tfoot, thead, tr, th, td {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
outline: 0;
|
||||
font-size: 12px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
body {overflow: hidden;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
h1 {font-size: 36px; font-weight: normal; color: #888; margin-bottom: 20px}
|
||||
a {color: #fff; text-decoration: none}
|
||||
input {padding: 4px; border: 1px solid #555; background-color: #444; color: #fff}
|
||||
input:focus {
|
||||
outline: none;
|
||||
-webkit-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7);
|
||||
-moz-box-shadow: 0 0 10px 1px rgba(0,198,255,0.7);
|
||||
box-shadow: 0 0 10px 1px rgba(0,198,255,0.7);
|
||||
}
|
||||
|
||||
.githubManager {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px}
|
||||
.githubManager .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help}
|
||||
@@ -1,250 +0,0 @@
|
||||
<?php
|
||||
include("headers.php");
|
||||
include("settings.php");
|
||||
$t = $text['github-manager'];
|
||||
|
||||
// If we have an action to perform
|
||||
if (!$demoMode && isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] && isset($_GET['action'])) {
|
||||
|
||||
// Get our old paths & user settings
|
||||
$oldLocal = $ICEcoder["githubLocalPaths"];
|
||||
$oldRemote = $ICEcoder["githubRemotePaths"];
|
||||
$settingsContents = getData($settingsFile);
|
||||
|
||||
// ========
|
||||
// CHOOSING
|
||||
// ========
|
||||
if ($_GET['action']=="choose") {
|
||||
|
||||
$pathPair = numClean($_GET['pathPair']);
|
||||
|
||||
$chosenLocal = $oldLocal[$pathPair];
|
||||
$chosenRemote = $oldRemote[$pathPair];
|
||||
|
||||
$pathValid = false;
|
||||
|
||||
if (!is_dir($docRoot.$chosenLocal)) {
|
||||
if (is_writable($docRoot)) {
|
||||
mkdir($docRoot.$chosenLocal, octdec($ICEcoder['newDirPerms']));
|
||||
} else {
|
||||
echo "<script>ICEcoder.message('".$t['Sorry, cannot create...']."\\n".$chosenLocal."');</script>";
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($docRoot.$chosenLocal)) {
|
||||
$pathValid = true;
|
||||
}
|
||||
|
||||
if ($pathValid) {
|
||||
|
||||
// New setting for the root path
|
||||
$settingsNew = '"root" => "'.$chosenLocal.'",'.PHP_EOL;
|
||||
|
||||
// Identify the bit to replace
|
||||
$repPosStart = strpos($settingsContents,'"root"');
|
||||
$repPosEnd = strpos($settingsContents,'"checkUpdates"');
|
||||
|
||||
// Compile our new settings
|
||||
$settingsContents = substr($settingsContents,0,$repPosStart).$settingsNew.substr($settingsContents,$repPosEnd,strlen($settingsContents));
|
||||
|
||||
// Now update the config file
|
||||
if (is_writeable("../data/".$settingsFile)) {
|
||||
$fh = fopen("../data/".$settingsFile, 'w');
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
|
||||
// Clear any FTP session we may have
|
||||
$_SESSION['ftpSiteRef'] = false;
|
||||
|
||||
// Hide this popup and reload file manager
|
||||
echo "<script>ICEcoder.showHide('hide',document.getElementById('blackMask'));ICEcoder.refreshFileManager();</script>";
|
||||
} else {
|
||||
echo "<script>ICEcoder.message('".$t['Cannot update config...']." data/".$settingsFile." ".$t['and try again']."');</script>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ======
|
||||
// ADDING
|
||||
// ======
|
||||
|
||||
if ($_GET['action']=="add") {
|
||||
|
||||
// Start creating a new chunk for the github paths
|
||||
$settingsNew = '"githubLocalPaths" => array(';
|
||||
|
||||
// Add the new one
|
||||
if ($_POST['githubLocalPathNEW'] != "" && $_POST['githubRemotePathNEW'] != "") {
|
||||
$settingsNew .= '"'.injClean(xssClean($_POST['githubLocalPathNEW'],"html")).'",';
|
||||
}
|
||||
|
||||
// Then set all the old local paths
|
||||
for ($i=0; $i<count($oldLocal); $i++) {
|
||||
$settingsNew .= '"'.$oldLocal[$i].'",';
|
||||
}
|
||||
// Rtrim off the last comma
|
||||
$settingsNew = rtrim($settingsNew,',');
|
||||
$settingsNew .= '),'.PHP_EOL;
|
||||
|
||||
// Now do the same for the remote paths
|
||||
$settingsNew .= '"githubRemotePaths" => array(';
|
||||
|
||||
// Add the new one
|
||||
if ($_POST['githubLocalPathNEW'] != "" && $_POST['githubRemotePathNEW'] != "") {
|
||||
$settingsNew .= '"'.injClean(xssClean($_POST['githubRemotePathNEW'],"html")).'",';
|
||||
}
|
||||
|
||||
// Then set all the old remote paths
|
||||
for ($i=0; $i<count($oldRemote); $i++) {
|
||||
$settingsNew .= '"'.$oldRemote[$i].'",';
|
||||
}
|
||||
// Rtrim off the last comma
|
||||
$settingsNew = rtrim($settingsNew,',');
|
||||
$settingsNew .= '),'.PHP_EOL;
|
||||
|
||||
}
|
||||
|
||||
// ===================
|
||||
// UPDATING & REMOVING
|
||||
// ===================
|
||||
|
||||
if ($_GET['action']=="update") {
|
||||
|
||||
// Start creating a new chunk for the github paths
|
||||
$settingsNew = '"githubLocalPaths" => array(';
|
||||
|
||||
// Redo the arrays using the form data
|
||||
for ($i=0; $i<count($oldLocal); $i++) {
|
||||
if ($_POST['githubLocalPath'.$i] != "") {
|
||||
$settingsNew .= '"'.injClean(xssClean($_POST['githubLocalPath'.$i],"html")).'",';
|
||||
}
|
||||
}
|
||||
// Rtrim off the last comma
|
||||
$settingsNew = rtrim($settingsNew,',');
|
||||
$settingsNew .= '),'.PHP_EOL;
|
||||
|
||||
// Now do the same for the remote paths
|
||||
$settingsNew .= '"githubRemotePaths" => array(';
|
||||
|
||||
// Redo the arrays using the form data
|
||||
for ($i=0; $i<count($oldRemote); $i++) {
|
||||
if ($_POST['githubRemotePath'.$i] != "") {
|
||||
$settingsNew .= '"'.injClean(xssClean($_POST['githubRemotePath'.$i],"html")).'",';
|
||||
}
|
||||
}
|
||||
// Rtrim off the last comma
|
||||
$settingsNew = rtrim($settingsNew,',');
|
||||
$settingsNew .= '),'.PHP_EOL;
|
||||
}
|
||||
|
||||
if ($_GET['action']!="choose") {
|
||||
// Now we have a new settingsNew string to use
|
||||
// we can update the path arrays in the settings file
|
||||
|
||||
// Identify the bit to replace
|
||||
$repPosStart = strpos($settingsContents,'"githubLocalPaths"');
|
||||
$repPosEnd = strpos($settingsContents,'"previousFiles"');
|
||||
|
||||
// Compile our new settings
|
||||
$settingsContents = substr($settingsContents,0,$repPosStart).$settingsNew.substr($settingsContents,$repPosEnd,strlen($settingsContents));
|
||||
|
||||
// Now update the config file
|
||||
if (is_writeable("../data/".$settingsFile)) {
|
||||
$fh = fopen("../data/".$settingsFile, 'w');
|
||||
fwrite($fh, $settingsContents);
|
||||
fclose($fh);
|
||||
// Finally, reload the iFrame screen for the user
|
||||
header("Location: github-manager.php?updatedGithubPaths&csrf=".$_SESSION["csrf"]);
|
||||
echo "<script>window.location='github-manager.php?updatedGithubPaths&csrf='+ICEcoder.csrf;</script>";
|
||||
die($t['saving github paths']);
|
||||
} else {
|
||||
echo "<script>ICEcoder.message('".$t['Cannot update config...']." data/".$settingsFile." ".$t['and try again']."');</script>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>ICEcoder <?php echo $ICEcoder["versionNo"];?> GitHub manager</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<link rel="stylesheet" type="text/css" href="github-manager.css?microtime=<?php echo microtime(true);?>">
|
||||
</head>
|
||||
|
||||
<body class="githubManager">
|
||||
|
||||
<h1><?php echo $t['github paths'];?></h1>
|
||||
|
||||
<div style="display: inline-block; width: 620px; height: 340px; overflow-y: auto">
|
||||
<?php
|
||||
$pathsLocal = $ICEcoder['githubLocalPaths'];
|
||||
$pathsRemote = $ICEcoder['githubRemotePaths'];
|
||||
if (count($pathsLocal) > 0) {
|
||||
?>
|
||||
<div style="display: inline-block; width: 600px; margin-bottom: 30px">
|
||||
<h2><?php echo $t['Choose existing path'];?></h2><br>
|
||||
|
||||
<form id="githubUpdateForm" action="github-manager.php?action=update" method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-left: 5px"><?php echo $t['Local path'];?> <span class="info" title="<?php echo $t['Slash prefixed'];?>">[?]</span></td>
|
||||
<td style="padding-left: 5px"><?php echo $t['Remote GitHub path'];?> <span class="info" title="<?php echo $t['Absolute URL beginning...'];?>">[?]</span></td>
|
||||
</tr>
|
||||
<?php
|
||||
for ($i=0; $i<count($pathsLocal); $i++) {
|
||||
echo '<tr>';
|
||||
echo '<td style="padding: 0 10px 8px 0"><input type="text" name="githubLocalPath'.$i.'" value="'.$pathsLocal[$i].'" style="width: 250px"></td>';
|
||||
echo '<td style="padding: 0 10px 8px 0"><input type="text" name="githubRemotePath'.$i.'" value="'.$pathsRemote[$i].'" style="width: 250px"></td>';
|
||||
echo '<td style="padding: 2px 0 8px 0"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="window.location=\'github-manager.php?action=choose&pathPair='.$i.'&csrf='.$_SESSION["csrf"].'\'">'.$t['Choose'].'</div></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '<tr>';
|
||||
echo '<td style="padding-top: 7px; color: #444">'.$t['Set local and...'].'</td>';
|
||||
echo '<td style="padding: 3px 10px 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById(\'githubUpdateForm\').submit()">'.$t['Update'].'</div></td>';
|
||||
echo '</tr>';
|
||||
?>
|
||||
</table>
|
||||
<input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?>">
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
;};
|
||||
?>
|
||||
|
||||
<div style="display: inline-block; width: 600px">
|
||||
<h2><?php echo $t['Add new path'];?></h2><br>
|
||||
|
||||
<form id="githubAddForm" action="github-manager.php?action=add" method="POST">
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-left: 5px"><?php echo $t['Local path'];?> <span class="info" title="<?php echo $t['Slash prefixed'];?>">[?]</span></td>
|
||||
<td style="padding-left: 5px"><?php echo $t['Remote GitHub path'];?> <span class="info" title="<?php echo $t['Absolute URL beginning...'];?>">[?]</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 0 10px 8px 0"><input type="text" name="githubLocalPathNEW" value="" style="width: 250px"></td>
|
||||
<td style="padding: 0 0 8px 0"><input type="text" name="githubRemotePathNEW" value="" style="width: 250px"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="padding: 3px 0 8px 0; text-align: right"><div style="display: inline-block; padding: 5px; background: #2187e7; color: #fff; font-size: 12px; cursor: pointer" onclick="document.getElementById('githubAddForm').submit()"><?php echo $t['Add'];?></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" name="csrf" value="<?php echo $_SESSION["csrf"]; ?>">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<h2 style="margin-bottom: 10px"><?php echo $t['Usage Info'];?></h2>
|
||||
|
||||
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['Enter relative local...'];?></p>
|
||||
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['You can then...'];?></p>
|
||||
<p style="color: #888; margin: 0 10px 10px 0"><?php echo $t['The file manager...'];?></p>
|
||||
<p style="color: #888; margin: 0 10px 0 0"><?php echo $t['If you want...'];?></p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user