Merge branch 'development' into 'master'

v.2.9.5

See merge request xevidos/codiad!12
This commit is contained in:
xevidos 2019-06-27 12:43:19 +00:00
commit 9d718331e8
14 changed files with 4012 additions and 3828 deletions

View File

@ -22,22 +22,28 @@ Stick to the conventions defined in other components as closely as possible.
In order to maintain a consistant code structure to the code across the application please follow the wordpress standard, or run any changes through [JSBeautifier] (http://jsbeautifier.org/) with the settings below.
{
"indent_size": "1",
"brace_style": "collapse",
"break_chained_methods": false,
"comma_first": false,
"e4x": false,
"end_with_newline": true,
"indent_char": "\t",
"indent_empty_lines": true,
"indent_inner_html": true,
"indent_scripts": "normal",
"indent_size": "1",
"jslint_happy": false,
"keep_array_indentation": true,
"max_preserve_newlines": "5",
"preserve_newlines": true,
"keep_array_indentation": true,
"break_chained_methods": false,
"indent_scripts": "normal",
"brace_style": "collapse",
"space_after_anon_function": false,
"space_after_named_function": false,
"space_before_conditional": false,
"space_in_empty_paren": false,
"space_in_paren": true,
"unescape_strings": false,
"jslint_happy": false,
"end_with_newline": true,
"wrap_line_length": "0",
"indent_inner_html": true,
"comma_first": false,
"e4x": false
"unindent_chained_methods": true,
"wrap_line_length": "0"
}
If you have questions, please ask. Submit an issue or [contact us directly](mailto:support@telaaedifex.com).

View File

@ -9,11 +9,13 @@ Distributed under the MIT-Style License. See LICENSE.txt file for more informati
Repositories:
[GitLab](https://gitlab.com/xevidos/codiad)
[GitHub](https://github.com/xevidos/codiad)
Issues:
[GitLab](https://gitlab.com/xevidos/codiad/issues)
[GitHub](https://github.com/xevidos/codiad/issues)
Features:
@ -37,16 +39,19 @@ Task List:
* Add ability to login with LDAP
* Add custom market
* Add in new admin interface ( Check admin-portal branch for progress )
* \- Add in new admin interface ( Check admin-portal branch for progress )
- Group Management
- Permissions Management
- Plugin Management
- Project Management
- System Settings
- User Management
* Add Drag and Drop natively to filemanager
* Add folder / filestructure upload ability
* Add if file could not be saved 5 times close the open file
* Add multi level users. ( Projects for only certain groups, Permission levels )
* Add mobile compatibility
* Add permissions module ( more in depth permissions such as read/write, delete, etc )
* Add support for more database systems ( MSSQL, Oracle, SQLite, Filesystem storage, etc )
* Add in auto save timer that saves after the user stops typing instead of after every change
* Clean up update script
@ -70,7 +75,9 @@ Completed:
* Updated for PHP 7.2
Bugs:
Known Bugs:
* Auto save does not save the most recent changes every once in a while requiring more information to be typed ( E.G. A couple spaces ) in order to show up in saved file.
* Cursor is set to the wrong position if in split view.
* Auto save does not save the most recent changes every once in a while requiring more information to be typed ( E.G. A couple spaces ) in order to show up in saved file
* Cursor is set to the wrong position if in split view
* In certain enviroments the update script pulls the old version of the sql class causing the update to fail
* The Server has new version of file alert causes auto save to stop when the user presses okay

File diff suppressed because it is too large Load Diff

View File

@ -38,12 +38,13 @@
editor: null,
invalid_states: [ "", " ", null, undefined ],
path: curpath,
save_interval: null,
saving: false,
settings: {
autosave: true,
toggle: true,
},
verbose: false,
verbose: true,
init: async function() {
@ -109,6 +110,10 @@
* try to close it, the program will throw an exception and
* stop you from closing the file
*/
if( codiad.auto_save.verbose ) {
console.log( "Error removing event listener", e );
}
}
});
@ -128,6 +133,30 @@
});
},
auto_save: function() {
/**
* When saving after every change, we encounter an issue where every
* once in a while the last change or last few changes will not get
* saved. Due to this, I decided to instead only save after the user
* has finished typing their changes.
*
* On every change to the editor, we set a timeout of half a second
* to see if the user is still typing. If they are, we clear the
* timeout and set it again. If they have stopped typing then the
* timout is triggered after 500 miliseconds and the file is saved.
*/
let _this = codiad.auto_save;
if( _this.save_interval !== null ) {
clearTimeout( _this.save_interval );
_this.save_interval = null;
}
_this.save_interval = setTimeout( _this.save, 500 );
},
/**
*
* This is where the core functionality goes, any call, references,
@ -135,9 +164,15 @@
*
*/
auto_save: function() {
save: function() {
let _this = codiad.auto_save;
if( _this.saving ) {
return;
}
_this.saving = true;
let tabs = document.getElementsByClassName( "tab-item" );
let path = codiad.active.getPath();
@ -157,9 +192,9 @@
if( _this.verbose ) {
console.log( content, _this.content );
//console.log( content, _this.content );
}
/*
if( content == _this.content ) {
let session = codiad.active.sessions[path];
@ -180,7 +215,7 @@
return;
}
/*
this code caused issues even though it is the proper way to save something.
Whenever in collaboration, the server constantly gave a wrong file version error.
@ -210,13 +245,6 @@
}
}
_this.saving = false;
setTimeout(function() {
//Call the function again after one second so that if we missed the last change we resave the file.
let _this = codiad.auto_save;
_this.auto_save();
}, 1000);
},
reload_interval: async function() {
@ -226,7 +254,13 @@
window.clearInterval( codiad.autosave.auto_save_trigger );
window.clearInterval( this.auto_save_trigger );
} catch( error ) {}
} catch( error ) {
if( codiad.auto_save.verbose ) {
console.log( "Error clearing interval", error );
}
}
if( codiad.auto_save.settings.autosave == true || codiad.auto_save.settings.autosave == "true" ) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,5 @@
<?php
//ini_set('display_errors', 1);
//ini_set('display_startup_errors', 1);
//error_reporting(E_ALL);
require_once( __DIR__ . "/../sql/class.sql.php" );
require_once( __DIR__ . "/../settings/class.settings.php" );
@ -129,11 +125,11 @@ date_default_timezone_set("' . $_POST['timezone'] . '");
define("SITE_NAME", "' . $_POST['site_name'] . '");
// Database Information
define( "DBHOST", "' . $_POST['dbhost'] . '" );
define( "DBNAME", "' . $_POST['dbname'] . '" );
define( "DBUSER", "' . $_POST['dbuser'] . '" );
define( "DBPASS", "' . $_POST['dbpass'] . '" );
define( "DBTYPE", "' . $_POST['dbtype'] . '" );
define( "DBHOST", \'' . addslashes( urldecode( $_POST['dbhost'] ) ) . '\' );
define( "DBNAME", \'' . addslashes( urldecode( $_POST['dbname'] ) ) . '\' );
define( "DBUSER", \'' . addslashes( urldecode( $_POST['dbuser'] ) ) . '\' );
define( "DBPASS", \'' . addslashes( urldecode( $_POST['dbpass'] ) ) . '\' );
define( "DBTYPE", \'' . addslashes( urldecode( $_POST['dbtype'] ) ) . '\' );
//////////////////////////////////////////////////////////////////
// ** DO NOT EDIT CONFIG BELOW **

View File

@ -170,7 +170,7 @@ if ( ! empty( $query ) ) {
"MBString"=>"required",
"MySQL"=>"",
"PGSQL"=>"",
"SQLite3"=>""
//"SQLite3"=>""
] as $dep=>$status) {
if (extension_loaded(strtolower($dep))) { ?>
<div class="success"><span class="icon-check"></span> <?=$dep?></div>

View File

@ -107,6 +107,11 @@ switch( $_GET['action'] ) {
?>
<td width="70"><a onclick="codiad.message.error(i18n('Active Project Cannot Be Removed'));" class="icon-block bigger-icon"></a></td>
<?php
} elseif( $owner !== $_SESSION["user"] ) {
?>
<td width="70"><a onclick="codiad.message.error(i18n('Projects owned by others can not be deleted'));" class="icon-block bigger-icon"></a></td>
<?php
} else {
?>

View File

@ -1,201 +1,140 @@
<?php
require_once('../../common.php');
require_once('../../common.php');
?>
<label><span class="icon-home big-icon"></span><?php i18n("Editor Settings"); ?></label>
<label><span class="icon-home big-icon"></span><?php i18n("Editor Settings");?></label>
<hr>
<table class="settings">
<tr>
<td width="50%"><?php i18n("Theme"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.theme">
<option value="ambiance">Ambiance</option>
<option value="chaos">Chaos</option>
<option value="chrome">Chrome</option>
<option value="clouds">Clouds</option>
<option value="clouds_midnight">Clouds - Midnight</option>
<option value="cobalt">Cobalt</option>
<option value="crimson_editor">Crimson Editor</option>
<option value="dawn">Dawn</option>
<option value="dreamweaver">Dreamweaver</option>
<option value="eclipse">Eclipse</option>
<option value="github">GitHub</option>
<option value="idle_fingers">Idle Fingers</option>
<option value="iplastic">IPlastic</option>
<option value="katzenmilch">Katzenmilch</option>
<option value="kuroir">Kuroir</option>
<option value="kr_theme">krTheme</option>
<option value="merbivore">Merbivore</option>
<option value="merbivore_soft">Merbivore Soft</option>
<option value="mono_industrial">Mono Industrial</option>
<option value="monokai">Monokai</option>
<option value="pastel_on_dark">Pastel On Dark</option>
<option value="solarized_dark">Solarized Dark</option>
<option value="solarized_light">Solarized Light</option>
<option value="sqlserver">SQL Server</option>
<option value="terminal">Terminal</option>
<option value="textmate">Textmate</option>
<option value="tomorrow">Tomorrow</option>
<option value="tomorrow_night">Tomorrow Night</option>
<option value="tomorrow_night_blue">Tomorrow Night Blue</option>
<option value="tomorrow_night_bright">Tomorrow Night Bright</option>
<option value="tomorrow_night_eighties">Tomorrow Night Eighties</option>
<option value="twilight" selected>Twilight</option>
<option value="vibrant_ink">Vibrant Ink</option>
<option value="xcode">XCode</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Font Size"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.fontSize">
<option value="10px">10px</option>
<option value="11px">11px</option>
<option value="12px">12px</option>
<option value="13px" selected>13px</option>
<option value="14px">14px</option>
<option value="15px">15px</option>
<option value="16px">16px</option>
<option value="17px">17px</option>
<option value="18px">18px</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Highlight Active Line"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.highlightLine">
<option value="true" selected><?php i18n("Yes"); ?></option>
<option value="false"><?php i18n("No"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Indent Guides"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.indentGuides">
<option value="true" selected><?php i18n("On"); ?></option>
<option value="false"><?php i18n("Off"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Print Margin"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.printMargin">
<option value="true"><?php i18n("Show"); ?></option>
<option value="false" selected><?php i18n("Hide"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Print Margin Column"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.printMarginColumn">
<option value="80" selected>80</option>
<option value="85">85</option>
<option value="90">90</option>
<option value="95">95</option>
<option value="100">100</option>
<option value="105">105</option>
<option value="110">110</option>
<option value="115">115</option>
<option value="120">120</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Wrap Lines"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.wrapMode">
<option value="false" selected><?php i18n("No wrap"); ?></option>
<option value="true"><?php i18n("Wrap Lines"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Tab Size"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.tabSize">
<option value="2">2</option>
<option value="3">3</option>
<option value="4" selected>4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Soft Tabs"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.softTabs">
<option value="false" selected><?php i18n("No"); ?></option>
<option value="true"><?php i18n("Yes"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Over Scroll"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.overScroll">
<option value="0" selected><?php i18n("None"); ?></option>
<option value="0.5"><?php i18n("Half"); ?></option>
<option value="1"><?php i18n("Full"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Live Autocomplete"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.autocomplete">
<option value="false" selected><?php i18n("Off"); ?></option>
<option value="true"><?php i18n("On"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Font Size");?></td>
<td>
<select class="setting" data-setting="codiad.editor.fontSize">
<option value="10px">10px</option>
<option value="11px">11px</option>
<option value="12px">12px</option>
<option value="13px" selected>13px</option>
<option value="14px">14px</option>
<option value="15px">15px</option>
<option value="16px">16px</option>
<option value="17px">17px</option>
<option value="18px">18px</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Highlight Active Line");?></td>
<td>
<select class="setting" data-setting="codiad.editor.highlightLine">
<option value="true" selected><?php i18n("Yes");?></option>
<option value="false"><?php i18n("No");?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Indent Guides");?></td>
<td>
<select class="setting" data-setting="codiad.editor.indentGuides">
<option value="true" selected><?php i18n("On");?></option>
<option value="false"><?php i18n("Off");?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Live Autocomplete"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.autocomplete">
<option value="false" selected><?php i18n("Off");?></option>
<option value="true"><?php i18n("On"); ?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Over Scroll"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.overScroll">
<option value="0" selected><?php i18n("None");?></option>
<option value="0.5"><?php i18n("Half");?></option>
<option value="1"><?php i18n("Full");?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Print Margin"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.printMargin">
<option value="true"><?php i18n("Show");?></option>
<option value="false" selected><?php i18n("Hide");?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Print Margin Column");?></td>
<td>
<select class="setting" data-setting="codiad.editor.printMarginColumn">
<option value="80" selected>80</option>
<option value="85">85</option>
<option value="90">90</option>
<option value="95">95</option>
<option value="100">100</option>
<option value="105">105</option>
<option value="110">110</option>
<option value="115">115</option>
<option value="120">120</option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Soft Tabs");?></td>
<td>
<select class="setting" data-setting="codiad.editor.softTabs">
<option value="false" selected><?php i18n("No");?></option>
<option value="true"><?php i18n("Yes");?></option>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Tab Size");?></td>
<td>
<select class="setting" data-setting="codiad.editor.tabSize">
<option value="2">2</option>
<option value="3">3</option>
<option value="4" selected>4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>
</td>
</tr>
<tr>
<td width="50%"><?php i18n("Theme");?></td>
<td>
<select class="setting" data-setting="codiad.editor.theme">
<?php
$files = glob( COMPONENTS . "/editor/ace-editor/*.js" );
foreach( $files as $file ) {
$name = pathinfo( $file, PATHINFO_FILENAME );
if( strpos( strtolower( $name ), strtolower( "theme-" ) ) !== false ) {
$value = str_replace( "theme-", "", str_replace( ".js", "", $name ) );
$name = ucwords( str_replace( "_", " ", $value ) );
?><option value="<?php echo $value;?>"><?php echo $name;?></option><?php
}
}
?>
</select>
</td>
</tr>
<tr>
<td><?php i18n("Wrap Lines"); ?></td>
<td>
<select class="setting" data-setting="codiad.editor.wrapMode">
<option value="false" selected><?php i18n("No wrap");?></option>
<option value="true"><?php i18n("Wrap Lines");?></option>
</select>
</td>
</tr>
</table>

View File

@ -7,8 +7,8 @@ class sql {
const DB_TYPES = array(
"MySQL" => "mysql",
"PostgresSQL" => "pgsql",
"SQLite" => "sqlite",
"PostgreSQL" => "pgsql",
//"SQLite" => "sqlite",
);
public $connection = null;

View File

@ -12,7 +12,7 @@ class Update {
// CONSTANTS
//////////////////////////////////////////////////////////////////
CONST VERSION = "v.2.9.4.1";
CONST VERSION = "v.2.9.5";
//////////////////////////////////////////////////////////////////
// PROPERTIES

View File

@ -5,11 +5,14 @@
//error_reporting(E_ALL);
require_once('../../common.php');
require_once('../settings/class.settings.php');
require_once('./class.update.php');
$user_settings_file = DATA . "/settings.php";
$projects_file = DATA . "/projects.php";
$users_file = DATA . "/users.php";
$user_settings_file = BASE_PATH . "/data/settings.php";
$projects_file = BASE_PATH . "/data/projects.php";
$users_file = BASE_PATH . "/data/users.php";
//checkSession();
if ( ! checkAccess() ) {
echo "Error, you do not have access to update Codiad.";
@ -102,8 +105,6 @@ class updater {
mkdir( $backup, 00755 );
}
function copy_backup( $source, $dest ) {
// Check for symlinks
@ -173,8 +174,6 @@ class updater {
function check_sql() {
require_once('../../common.php');
require_once('../sql/class.sql.php');
$sql = new sql();
$connection = $sql->connect();
$result = $sql->create_default_tables();
@ -211,9 +210,6 @@ class updater {
function convert() {
require_once('../sql/class.sql.php');
require_once('../settings/class.settings.php');
$user_settings_file = DATA . "/settings.php";
$projects_file = DATA . "/projects.php";
$users_file = DATA . "/users.php";
@ -235,18 +231,22 @@ class updater {
if( file_exists( $projects_file ) ) {
$projects = getJSON( 'projects.php' );
foreach( $projects as $project => $data ) {
if( is_array( $projects ) ) {
$owner = 'nobody';
$query = "INSERT INTO projects( name, path, owner ) VALUES ( ?, ?, ? );";
$bind_variables = array( $data["name"], $data["path"], $owner );
$return = $sql->query( $query, $bind_variables, 0, "rowCount" );
if( $return > 0 ) {
} else {
foreach( $projects as $project => $data ) {
$this->restore();
exit(formatJSEND( "error", "There was an error adding projects to database." ));
$owner = 'nobody';
$query = "INSERT INTO projects( name, path, owner ) VALUES ( ?, ?, ? );";
$bind_variables = array( $data["name"], $data["path"], $owner );
$return = $sql->query( $query, $bind_variables, 0, "rowCount" );
if( $return > 0 ) {
} else {
$this->restore();
exit( formatJSEND( "error", "There was an error adding projects to database." ) );
}
}
}
unlink( $projects_file );
@ -255,28 +255,32 @@ class updater {
if( file_exists( $users_file ) ) {
$users = getJSON( 'users.php' );
foreach( $users as $user ) {
if( is_array( $users ) ) {
if( $user["username"] === $_SESSION["user"] ) {
foreach( $users as $user ) {
$access = "admin";
} else {
if( $user["username"] === $_SESSION["user"] ) {
$access = "admin";
} else {
$access = "user";
}
$query = "INSERT INTO users( username, password, access, project ) VALUES ( ?, ?, ?, ? );";
$bind_variables = array( $user["username"], $user["password"], $access, null );
$return = $sql->query( $query, $bind_variables, 0, "rowCount" );
$access = "user";
}
$query = "INSERT INTO users( username, password, access, project ) VALUES ( ?, ?, ?, ? );";
$bind_variables = array( $user["username"], $user["password"], $access, null );
$return = $sql->query( $query, $bind_variables, 0, "rowCount" );
if( $return > 0 ) {
$this->username = $user["username"];
$this->set_default_options();
//echo formatJSEND( "success", array( "username" => $user["username"] ) );
} else {
$this->restore();
exit(formatJSEND( "error", "The Username is Already Taken" ));
if( $return > 0 ) {
$this->username = $user["username"];
$this->set_default_options();
//echo formatJSEND( "success", array( "username" => $user["username"] ) );
} else {
$this->restore();
exit(formatJSEND( "error", "The Username is Already Taken" ));
}
}
}
unlink( $users_file );
@ -415,10 +419,10 @@ class updater {
function remove_directory( $path ) {
$files = glob($path . '/*');
foreach ($files as $file) {
is_dir($file) ? $this->remove_directory($file) : unlink($file);
$files = glob( $path . '{,.}[!.,!..]*', GLOB_MARK|GLOB_BRACE );
foreach( $files as $file ) {
is_dir( $file ) ? $this->remove_directory( $file ) : unlink( $file );
}
if( is_dir( $path ) ) {
@ -524,8 +528,6 @@ class updater {
$this->copyr( $src, $dest );
$this->remove_directory( $src );
$this->convert();
$this->check_sql();
return( "true" );
} catch( Exception $e ) {
@ -534,6 +536,21 @@ class updater {
}
}
public function update_database() {
try {
$this->convert();
} catch( Exception $e ) {
$this->restore();
return( $e );
}
$this->check_sql();
return( "true" );
}
public function update_option( $option, $value, $user_setting = null ) {
$sql = new sql();
@ -619,6 +636,11 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
echo $updater->update();
break;
case( "update_database" ):
echo $updater->update_database();
break;
}
exit();
@ -674,6 +696,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
const codiad = {};
codiad.update = {
base_url: `<?php echo BASE_URL;?>`,
progress: null,
init: function() {
@ -711,6 +734,35 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
});
},
apply_database: function() {
return jQuery.ajax({
url: "update.php",
type: "GET",
dataType: 'html',
data: {
action: 'update_database',
},
success: function( result ) {
return result;
},
error: function( jqXHR, textStatus, errorThrown ) {
console.log( 'jqXHR:' );
console.log( jqXHR );
console.log( 'textStatus:' );
console.log( textStatus);
console.log( 'errorThrown:' );
console.log( errorThrown );
return null;
}
});
},
check_update: function() {
this.progress.innerText = "Checking for update ... ";
@ -809,6 +861,33 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
update: async function() {
let GET = {};
let parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function( m, key, value) {
GET[key] = value;
});
if( Object.keys( GET ).includes( "step" ) && GET.step === "database_update" ) {
progress.innerText = "Applying database update.";
let apply = await this.apply_database();
if( apply !== "true" ) {
console.log( apply );
progress.innerText = "Error applying update.";
return;
}
progress.innerText = "Successfully completed update. Returning you to Codiad ...";
setTimeout( function() {
window.location.href = `${location.protocol}//${codiad.update.base_url}`;
}, 5000);
return;
}
let result = await this.check_update();
console.log( result );
@ -834,7 +913,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
return;
}
progress.innerText = "Applying update.";
progress.innerText = "Applying filesystem update.";
let apply = await this.apply();
if( apply !== "true" ) {
@ -844,7 +923,12 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
return;
}
progress.innerText = "Update Finished.";
progress.innerText = "Filesystem update finished. Please wait, your browser will now reload and start the datbase update.";
setTimeout( function() {
window.location.href = window.location.href + "?step=database_update"
}, 5000);
} else if( result === "false" ) {
progress.innerText = "No update was found ...";
@ -856,6 +940,28 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
update_development: async function() {
let GET = {};
let parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function( m, key, value) {
GET[key] = value;
});
if( Object.keys( GET ).includes( "step" ) && GET.step === "database_update" ) {
progress.innerText = "Applying database update.";
let apply = await this.apply_database();
if( apply !== "true" ) {
console.log( apply );
progress.innerText = "Error applying update.";
return;
}
progress.innerText = "Successfully completed update. You may now return to Codiad.";
return;
}
progress.innerText = "An update was found. Downloading update.";
let download = await this.download( true );
@ -876,7 +982,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
return;
}
progress.innerText = "Applying update.";
progress.innerText = "Applying filesystem update.";
let apply = await this.apply();
if( apply !== "true" ) {
@ -886,7 +992,12 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
return;
}
progress.innerText = "Update Finished.";
progress.innerText = "Filesystem update finished. Please wait, your browser will now reload and start the datbase update.";
setTimeout( function() {
window.location.href = window.location.href + "?step=database_update"
}, 5000);
},
};
</script>

View File

@ -41,7 +41,6 @@ class User {
public function __construct() {
$this->actives = getJSON( 'active.php' );
}
public function add_user() {