diff --git a/lib/github-manager.php b/lib/github-manager.php new file mode 100644 index 0000000..76abeb3 --- /dev/null +++ b/lib/github-manager.php @@ -0,0 +1,245 @@ +top.ICEcoder.message('Sorry, cannot create folder at\\n".$chosenLocal."');"; + } + } + + 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($settingsFile)) { + $fh = fopen($settingsFile, 'w'); + fwrite($fh, $settingsContents); + fclose($fh); + // Hide this popup and reload file manager + echo ""; + } else { + echo ""; + } + + } + + } + + // ====== + // 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 .= '"'.$_POST['githubLocalPathNEW'].'",'; + } + + // Then set all the old local paths + for ($i=0; $iwindow.location='github-manager.php?updatedGithubPaths&csrf='+top.ICEcoder.csrf;"; + die('saving github paths...'); + } else { + echo ""; + } + } +} +?> + + + + +ICEcoder <?php echo $ICEcoder["versionNo"];?> GitHub manager + + + + + + + +

github paths

+ +
+ 0) { + ?> +
+

Choose existing path


+ +
+ + + + + + '; + echo ''; + echo ''; + echo ''; + echo ''; + } + echo ''; + echo ''; + echo ''; + echo ''; + ?> +
Local pathRemote GitHub path
Choose
Set local and remote path to blanks to remove
Update
+ "> +
+
+ + +
+

Add new path


+ +
+ + + + + + + + + + + + +
Local pathRemote GitHub path
Add
+ "> +
+
+ +

Usage Info:

+ +

Enter relative local paths (eg /server/myfiles) and absolute GitHub paths (eg https://github.com/user/repo or https://github.com/user/repo/tree/branch for branches), as per the examples. With this done you have established the source paths at both locations, as a pair.

+

You can then choose a path pair and this then becomes your new root path in ICEcoder.

+

The file manager then displays a new GitHub icon, which you can click on to perform and show a diff check between the 2 sources. These diffs can then be committed and pushed to the remote path at GitHub or cloned to your local path, to sync your files.

+

If you want to set another root path, this can be done in the Help > Settings screen.

+ +
+ + + +