No need to replace \r\n also in stitchChanges (\n and then \r will do
that).
If FTP based file, get from fixed filepath, explode on new lines and add
lineEnding to end of each but last, to match what the local file($file)
process will do.
Establish number of Unix and Windows lines in 'changes' update process
only (no need to do on new file) and also str_replace based on their
counts under FTP usage also (to match what local file processes are
doing).
When `$file` is a folder, the commands `filesize` and `filemtime` would result in the following warnings :
PHP Warning: filemtime(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 921
PHP Warning: filesize(): stat failed for /var/www/html/css in /var/www/html/ice/lib/file-control-xhr.php on line 940
This patch corrects this.
Wrapped `$ftpSite` in `isset()` where $ftpSite was a part of a condition for existence testing and was using the simplified mode for the check. The simplified mode resulted in the following notice being produced when no data was present in the `$ftpSite` variable.
> PHP Notice: Undefined variable: ftpSite in /var/www/html/ice/lib/file-control-xhr.php on line 518
While the error pertains specifically to line 518, this adjustment was applied to all condition checks on this variable.
Corrects the following error :
scandir(/var/www/html/ice/lib/../backups/localhost): failed to open dir: No such file or directory in /var/www/html/ice/lib/settings-common.php on line 190
(possible review required for if this is something that should be created before this method is called, or if a simple check as this patch does is all that is required.)
globalized $context inside `GetVersionCount()` to eliminate `Notice: Undefined variable: context in /var/www/html/ice/lib/settings-common.php on line 203`
Added check if file is readable for `.version-index`'s inside the loop within `GetVersionCount()`
stitchContents added to stitch content changes together into version the
user is seeing in the browser.
Can action save on having changes or full content now
savedContents added to maintain last known version of saved file
changesToSave function added to output array of differences between
current and last known saved version stored in array
Establish any changes using this function in save events, pass changes
or content via XHR
Takes up more of the larger space now, scrollable list, fixed bad
version ref in URL, onclick highlight this elem and ID added as hook
plus added missing end anchor tag. Info container added, versions
available to JS and function added to highlight link.
Include settings instead, plus CodeMirror lib and CSS
Set some CSS classes, and CodeMirror CSS files
Display clickable list of backups
DIV container added for editor display and buttons
Display CodeMirror instance and setup 2 x functions to open backup in
new tab or diff pane
Establish and use version URL part
Add 1 to count on saving local or FTP and update version display after
doing this
All backed up files now have incremental numbers in parens postfixed on
filename
.versions-index file written to with new file line or if line exists
update count on it
On re-getting file due to save conflict, get the count and set in JS
array