Replace \r in content, only do extra JS if could FTP write OK
Get original content and check charCount and if finding different sizes,
log into to file
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.
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
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
Only use docRoot if not FTP (ie, local)
srcDir and tgtDir need prefixed slashes removed
Use JS isFileFolder function to establish dir/file type as short term
measure, to be replaced with FTP call to establish type so can all be
handled server side
Include FTP control lib and include/exclude items if we have ftpSite
If ftpSite, establish connection and if no errors, write the content to
the filepath before closing connection
Vars to determine if we have overwrite OK permission from user or
there's no conflict with filenames, so it's a new one and we can save
Don't check for DOM node to decide if we can save or not anymore,
instead run an XHR that ends up setting lastFileDirCheckStatusObj from
false to something
On spotting that, clear the interval and continue by asking user if they
want to overwrite, or if there's no conflict, set that value instead
If we have no newFileName or we have one but no permission to overwrite
yet, set the content for use in a moment under saveAsContent and we loop
back around