Now an HTML type file, had no doctype, header etc previously. Now does
and also loads in 2 x JS files for GitHub API control
Gets full list of files, considers .gitignore files and gets an excluded
list
Always has a GET location now, so no need to consider
If in GitHub diff mode, for each file in our list get file contents and
put the name, SHA and type into 3 arrays
Work out GitHub repo path and set up JS arrays the same as PHP arrays
Then start a github object and begin examining tree for differences
recursively, adding to arrays and removing DOM elems from branch DIV as
needed
With that done, we need to cover the dirs not yet opened and if they
contain no changes, remove them
Finally, remove .gitignore excluded filrs
showFile function set up mostly as per previous code, but now also adds
files that are deleted (ie, to make them show up in the tree)
Error catching and helpful messages and redirections added such as when
you have no diffs or used up your GitHub API rate limit
githubAuthTokenSet flag added, false to begin with
Refreshing file manager now just reloads, not loads hardcoded URL
New function added to ask for GitHub auth token
If set, it auth's with that token and also passes through the place to
go next. Clears token value too for security.
On attempting to show the GitHub manager pane, if we have a token set,
great, show it, if not ask for the token
On toggling the GitHub diff mode, if we don't have the token set, ask
for it
githubAuthTokenSet param passed in to update flasg
We can now call an auth action along with the token and it will set our
flag
As a follow up, it continues what we were previously doing - showing
manager pane or toggling file display
Note: 2 x JS files can probably be removed for now. Was going to look
into auth token validation here, but until I do, they're not needed.
If we fail to rmdir (perhaps a permission problem), don't die. This
silently continues and does leave empty folders behind, but stops things
from breaking until the solution is really found.
If we're installing and the plugin needs a reload, confirm that with the
user and reload on OK, else reload iFrame only
If a plugin needs a reload, display that text below the plugin name, so
user is aware before installing
A little more padding on the td that contains the name to look a little
nicer and accomodate the possible extra line
Detect if SSL capabilities are available and if not, inform user what
they need to do.
On cloning, establish local and remote paths and if our root is in the
local list, establish the target, zipURL and zipFile path & name
Get the zip file over file_get_contents if possible, otherwise cURL.
Then unpack the zip into our local folder. The first entry will be the
folder inside of the zip, so we get the $dirName of that only to use,
this is removed from subsequent file paths
When done, remove the zip file and refresh the file manager to show the
files
Establish local and remote paths plus get settings file contents
If we're choosing a path pair, get the number and the 2 chosen paths
(local and remote). Paths are not valid until checked if exist. Prior to
that, a mkdir is attempted if it doesn't with error reporting if that
doesn't happen.
If valid, set the new root path and reload the file manager
Adding and editing of local and remote array paths on postback also
handled
Page displays form & table so you can manage repo pairs along with
providing usage info
Now accessable from the file manager menu option
Clicking this sets the content of the mediaContainer popup display to be
an iFrame loading the GitHub manager and shows the blackMask
Added an else condition to work with empty folders, establishes local
and remote paths and works out of the $iceRoot is one of our local paths
If so, inform the user their folder is empty and ask the user if they'd
like to clone the repo
If so, show the loading mask and call our GitHub script to begin the
process