diff --git a/lib/ftp-manager.css b/lib/ftp-manager.css new file mode 100644 index 0000000..1cbae57 --- /dev/null +++ b/lib/ftp-manager.css @@ -0,0 +1,37 @@ +/* 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: #2187e7; 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); +} + +.ftpManager {font-family: arial, verdana, helvetica, sans-serif; background-color: #1c1c19; color: #fff; padding: 20px} +.ftpManager .info {font-size: 10px; color: rgba(0,198,255,0.7); cursor: help} \ No newline at end of file diff --git a/lib/ftp-manager.php b/lib/ftp-manager.php new file mode 100644 index 0000000..014a870 --- /dev/null +++ b/lib/ftp-manager.php @@ -0,0 +1,212 @@ +top.ICEcoder.showHide('hide',top.document.getElementById('blackMask'));top.ICEcoder.refreshFileManager();"; + } else { + // Start creating a new chunk for the FTP sites + $settingsNew = '"ftpSites" => array( +'; + } + + // ====== + // ADDING + // ====== + + if ($_GET['action']=="add") { + + // Add the new FTP site + if ($_POST['ftpSiteNEW'] != "") { + $settingsNew .= ' array( + "site" => "'.$_POST['ftpSiteNEW'].'", + "host" => "'.$_POST['ftpHostNEW'].'", + "user" => "'.$_POST['ftpUserNEW'].'", + "pass" => "'.$_POST['ftpPassNEW'].'", + "pasv" => '.$_POST['ftpPASVNEW'].', + "mode" => "'.$_POST['ftpModeNEW'].'", + "root" => "'.$_POST['ftpRootNEW'].'" + ), +'; + } + + } + + // =============================================== + // UPDATING & REMOVING PLUS UPDATE CONFIG SETTINGS + // =============================================== + + if ($_GET['action']!="choose" && $_GET['action']!="edit") { + + // Look at each of the existing FTP sites + for ($i=0; $i "'.$_POST['ftpHostNEW'].'", + "user" => "'.$_POST['ftpUserNEW'].'", + "pass" => "'.$_POST['ftpPassNEW'].'", + "pasv" => '.$_POST['ftpPASVNEW'].', + "mode" => "'.$_POST['ftpModeNEW'].'", + "root" => "'.$_POST['ftpRootNEW'].'" + ), +'; + // Deleting + } elseif ($_GET['action']=="remove" && $i == $_GET['ftpSiteRef']) { + // Do nothing, so we ignore this entry now + + // Entry is as before + } else { + $settingsNew .= ' array( + "site" => "'.$oldFTPSites[$i]['site'].'", + "host" => "'.$oldFTPSites[$i]['host'].'", + "user" => "'.$oldFTPSites[$i]['user'].'", + "pass" => "'.$oldFTPSites[$i]['pass'].'", + "pasv" => '.($oldFTPSites[$i]['pasv'] ? 'true' : 'false').', + "mode" => "'.($oldFTPSites[$i]['mode'] == 'FTP_ASCII' ? 'FTP_ASCII' : 'FTP_BINARY').'", + "root" => "'.$oldFTPSites[$i]['root'].'" + ), +'; + } + } + // Rtrim off the last comma + $settingsNew = rtrim($settingsNew,', +'); + $settingsNew .= ' +),'.PHP_EOL; + + // Now we have a new settingsNew string to use + // we can update the FTP sites in the settings file + + // Identify the bit to replace + $repPosStart = strpos($settingsContents,'"ftpSites"'); + $repPosEnd = strpos($settingsContents,'"githubLocalPaths"'); + + // Compile our new settings + $settingsContents = substr($settingsContents,0,$repPosStart).$settingsNew.substr($settingsContents,$repPosEnd,strlen($settingsContents)); + + // Now update the config file + if (is_writeable($settingsFile)) { + $fh = fopen($settingsFile, 'w'); + fwrite($fh, $settingsContents); + fclose($fh); + // Finally, reload the iFrame screen for the user + header("Location: ftp-manager.php?updatedFTPSites&csrf=".$_SESSION["csrf"]); + echo ""; + die($t['Saving FTP sites']); + } else { + echo ""; + } + } +} +?> + + + + +ICEcoder <?php echo $ICEcoder["versionNo"];?> FTP manager + + + + + + + +

+ +
+ 0) { + ?> +
+


+ +
+ + '; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + ?> +
'.$ftpSites[$i]['site'].''.$ftpSites[$i]['host'].'EditDelete
'.$t['Choose'].'
+ "> +
+
+ + +
+


+ +
" method="POST"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
[?] [?]
" style="width: 272px">" style="width: 272px">
[?] [?]
" style="width: 272px">" style="width: 272px">
[?] [?]
+ + + " style="width: 272px">
+ "> +
+
+
+ + + + \ No newline at end of file