mirror of
https://github.com/xevidos/codiad.git
synced 2024-11-14 07:41:14 +01:00
Merge branch 'development' into 'master'
v.2.9.5 See merge request xevidos/codiad!12
This commit is contained in:
commit
9d718331e8
14 changed files with 4012 additions and 3828 deletions
|
@ -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.
|
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_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",
|
"max_preserve_newlines": "5",
|
||||||
"preserve_newlines": true,
|
"preserve_newlines": true,
|
||||||
"keep_array_indentation": true,
|
"space_after_anon_function": false,
|
||||||
"break_chained_methods": false,
|
"space_after_named_function": false,
|
||||||
"indent_scripts": "normal",
|
|
||||||
"brace_style": "collapse",
|
|
||||||
"space_before_conditional": false,
|
"space_before_conditional": false,
|
||||||
|
"space_in_empty_paren": false,
|
||||||
|
"space_in_paren": true,
|
||||||
"unescape_strings": false,
|
"unescape_strings": false,
|
||||||
"jslint_happy": false,
|
"unindent_chained_methods": true,
|
||||||
"end_with_newline": true,
|
"wrap_line_length": "0"
|
||||||
"wrap_line_length": "0",
|
|
||||||
"indent_inner_html": true,
|
|
||||||
"comma_first": false,
|
|
||||||
"e4x": false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
If you have questions, please ask. Submit an issue or [contact us directly](mailto:support@telaaedifex.com).
|
If you have questions, please ask. Submit an issue or [contact us directly](mailto:support@telaaedifex.com).
|
||||||
|
|
15
README.md
15
README.md
|
@ -9,11 +9,13 @@ Distributed under the MIT-Style License. See LICENSE.txt file for more informati
|
||||||
Repositories:
|
Repositories:
|
||||||
|
|
||||||
[GitLab](https://gitlab.com/xevidos/codiad)
|
[GitLab](https://gitlab.com/xevidos/codiad)
|
||||||
|
|
||||||
[GitHub](https://github.com/xevidos/codiad)
|
[GitHub](https://github.com/xevidos/codiad)
|
||||||
|
|
||||||
Issues:
|
Issues:
|
||||||
|
|
||||||
[GitLab](https://gitlab.com/xevidos/codiad/issues)
|
[GitLab](https://gitlab.com/xevidos/codiad/issues)
|
||||||
|
|
||||||
[GitHub](https://github.com/xevidos/codiad/issues)
|
[GitHub](https://github.com/xevidos/codiad/issues)
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
@ -37,16 +39,19 @@ Task List:
|
||||||
|
|
||||||
* Add ability to login with LDAP
|
* Add ability to login with LDAP
|
||||||
* Add custom market
|
* 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
|
- Group Management
|
||||||
- Permissions Management
|
- Permissions Management
|
||||||
- Plugin Management
|
- Plugin Management
|
||||||
- Project Management
|
- Project Management
|
||||||
- System Settings
|
- System Settings
|
||||||
- User Management
|
- 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 if file could not be saved 5 times close the open file
|
||||||
* Add multi level users. ( Projects for only certain groups, Permission levels )
|
* Add multi level users. ( Projects for only certain groups, Permission levels )
|
||||||
* Add mobile compatibility
|
* 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 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
|
* Add in auto save timer that saves after the user stops typing instead of after every change
|
||||||
* Clean up update script
|
* Clean up update script
|
||||||
|
@ -70,7 +75,9 @@ Completed:
|
||||||
* Updated for PHP 7.2
|
* 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.
|
* 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.
|
* 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
|
@ -38,12 +38,13 @@
|
||||||
editor: null,
|
editor: null,
|
||||||
invalid_states: [ "", " ", null, undefined ],
|
invalid_states: [ "", " ", null, undefined ],
|
||||||
path: curpath,
|
path: curpath,
|
||||||
|
save_interval: null,
|
||||||
saving: false,
|
saving: false,
|
||||||
settings: {
|
settings: {
|
||||||
autosave: true,
|
autosave: true,
|
||||||
toggle: true,
|
toggle: true,
|
||||||
},
|
},
|
||||||
verbose: false,
|
verbose: true,
|
||||||
|
|
||||||
init: async function() {
|
init: async function() {
|
||||||
|
|
||||||
|
@ -109,6 +110,10 @@
|
||||||
* try to close it, the program will throw an exception and
|
* try to close it, the program will throw an exception and
|
||||||
* stop you from closing the file
|
* 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,
|
* This is where the core functionality goes, any call, references,
|
||||||
|
@ -135,9 +164,15 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
auto_save: function() {
|
save: function() {
|
||||||
|
|
||||||
let _this = codiad.auto_save;
|
let _this = codiad.auto_save;
|
||||||
|
|
||||||
|
if( _this.saving ) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_this.saving = true;
|
_this.saving = true;
|
||||||
let tabs = document.getElementsByClassName( "tab-item" );
|
let tabs = document.getElementsByClassName( "tab-item" );
|
||||||
let path = codiad.active.getPath();
|
let path = codiad.active.getPath();
|
||||||
|
@ -157,9 +192,9 @@
|
||||||
|
|
||||||
if( _this.verbose ) {
|
if( _this.verbose ) {
|
||||||
|
|
||||||
console.log( content, _this.content );
|
//console.log( content, _this.content );
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if( content == _this.content ) {
|
if( content == _this.content ) {
|
||||||
|
|
||||||
let session = codiad.active.sessions[path];
|
let session = codiad.active.sessions[path];
|
||||||
|
@ -180,7 +215,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
this code caused issues even though it is the proper way to save something.
|
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.
|
Whenever in collaboration, the server constantly gave a wrong file version error.
|
||||||
|
@ -210,13 +245,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_this.saving = false;
|
_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() {
|
reload_interval: async function() {
|
||||||
|
@ -226,7 +254,13 @@
|
||||||
|
|
||||||
window.clearInterval( codiad.autosave.auto_save_trigger );
|
window.clearInterval( codiad.autosave.auto_save_trigger );
|
||||||
window.clearInterval( this.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" ) {
|
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
|
@ -1,9 +1,5 @@
|
||||||
<?php
|
<?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__ . "/../sql/class.sql.php" );
|
||||||
require_once( __DIR__ . "/../settings/class.settings.php" );
|
require_once( __DIR__ . "/../settings/class.settings.php" );
|
||||||
|
|
||||||
|
@ -129,11 +125,11 @@ date_default_timezone_set("' . $_POST['timezone'] . '");
|
||||||
define("SITE_NAME", "' . $_POST['site_name'] . '");
|
define("SITE_NAME", "' . $_POST['site_name'] . '");
|
||||||
|
|
||||||
// Database Information
|
// Database Information
|
||||||
define( "DBHOST", "' . $_POST['dbhost'] . '" );
|
define( "DBHOST", \'' . addslashes( urldecode( $_POST['dbhost'] ) ) . '\' );
|
||||||
define( "DBNAME", "' . $_POST['dbname'] . '" );
|
define( "DBNAME", \'' . addslashes( urldecode( $_POST['dbname'] ) ) . '\' );
|
||||||
define( "DBUSER", "' . $_POST['dbuser'] . '" );
|
define( "DBUSER", \'' . addslashes( urldecode( $_POST['dbuser'] ) ) . '\' );
|
||||||
define( "DBPASS", "' . $_POST['dbpass'] . '" );
|
define( "DBPASS", \'' . addslashes( urldecode( $_POST['dbpass'] ) ) . '\' );
|
||||||
define( "DBTYPE", "' . $_POST['dbtype'] . '" );
|
define( "DBTYPE", \'' . addslashes( urldecode( $_POST['dbtype'] ) ) . '\' );
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// ** DO NOT EDIT CONFIG BELOW **
|
// ** DO NOT EDIT CONFIG BELOW **
|
||||||
|
|
|
@ -170,7 +170,7 @@ if ( ! empty( $query ) ) {
|
||||||
"MBString"=>"required",
|
"MBString"=>"required",
|
||||||
"MySQL"=>"",
|
"MySQL"=>"",
|
||||||
"PGSQL"=>"",
|
"PGSQL"=>"",
|
||||||
"SQLite3"=>""
|
//"SQLite3"=>""
|
||||||
] as $dep=>$status) {
|
] as $dep=>$status) {
|
||||||
if (extension_loaded(strtolower($dep))) { ?>
|
if (extension_loaded(strtolower($dep))) { ?>
|
||||||
<div class="success"><span class="icon-check"></span> <?=$dep?></div>
|
<div class="success"><span class="icon-check"></span> <?=$dep?></div>
|
||||||
|
|
|
@ -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>
|
<td width="70"><a onclick="codiad.message.error(i18n('Active Project Cannot Be Removed'));" class="icon-block bigger-icon"></a></td>
|
||||||
<?php
|
<?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 {
|
} else {
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,201 +1,140 @@
|
||||||
<?php
|
<?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>
|
<hr>
|
||||||
<table class="settings">
|
<table class="settings">
|
||||||
|
<tr>
|
||||||
<tr>
|
<td><?php i18n("Font Size");?></td>
|
||||||
|
<td>
|
||||||
<td width="50%"><?php i18n("Theme"); ?></td>
|
<select class="setting" data-setting="codiad.editor.fontSize">
|
||||||
<td>
|
<option value="10px">10px</option>
|
||||||
|
<option value="11px">11px</option>
|
||||||
<select class="setting" data-setting="codiad.editor.theme">
|
<option value="12px">12px</option>
|
||||||
<option value="ambiance">Ambiance</option>
|
<option value="13px" selected>13px</option>
|
||||||
<option value="chaos">Chaos</option>
|
<option value="14px">14px</option>
|
||||||
<option value="chrome">Chrome</option>
|
<option value="15px">15px</option>
|
||||||
<option value="clouds">Clouds</option>
|
<option value="16px">16px</option>
|
||||||
<option value="clouds_midnight">Clouds - Midnight</option>
|
<option value="17px">17px</option>
|
||||||
<option value="cobalt">Cobalt</option>
|
<option value="18px">18px</option>
|
||||||
<option value="crimson_editor">Crimson Editor</option>
|
</select>
|
||||||
<option value="dawn">Dawn</option>
|
</td>
|
||||||
<option value="dreamweaver">Dreamweaver</option>
|
</tr>
|
||||||
<option value="eclipse">Eclipse</option>
|
<tr>
|
||||||
<option value="github">GitHub</option>
|
<td><?php i18n("Highlight Active Line");?></td>
|
||||||
<option value="idle_fingers">Idle Fingers</option>
|
<td>
|
||||||
<option value="iplastic">IPlastic</option>
|
<select class="setting" data-setting="codiad.editor.highlightLine">
|
||||||
<option value="katzenmilch">Katzenmilch</option>
|
<option value="true" selected><?php i18n("Yes");?></option>
|
||||||
<option value="kuroir">Kuroir</option>
|
<option value="false"><?php i18n("No");?></option>
|
||||||
<option value="kr_theme">krTheme</option>
|
</select>
|
||||||
<option value="merbivore">Merbivore</option>
|
</td>
|
||||||
<option value="merbivore_soft">Merbivore Soft</option>
|
</tr>
|
||||||
<option value="mono_industrial">Mono Industrial</option>
|
<tr>
|
||||||
<option value="monokai">Monokai</option>
|
<td><?php i18n("Indent Guides");?></td>
|
||||||
<option value="pastel_on_dark">Pastel On Dark</option>
|
<td>
|
||||||
<option value="solarized_dark">Solarized Dark</option>
|
<select class="setting" data-setting="codiad.editor.indentGuides">
|
||||||
<option value="solarized_light">Solarized Light</option>
|
<option value="true" selected><?php i18n("On");?></option>
|
||||||
<option value="sqlserver">SQL Server</option>
|
<option value="false"><?php i18n("Off");?></option>
|
||||||
<option value="terminal">Terminal</option>
|
</select>
|
||||||
<option value="textmate">Textmate</option>
|
</td>
|
||||||
<option value="tomorrow">Tomorrow</option>
|
</tr>
|
||||||
<option value="tomorrow_night">Tomorrow Night</option>
|
<tr>
|
||||||
<option value="tomorrow_night_blue">Tomorrow Night Blue</option>
|
<td><?php i18n("Live Autocomplete"); ?></td>
|
||||||
<option value="tomorrow_night_bright">Tomorrow Night Bright</option>
|
<td>
|
||||||
<option value="tomorrow_night_eighties">Tomorrow Night Eighties</option>
|
<select class="setting" data-setting="codiad.editor.autocomplete">
|
||||||
<option value="twilight" selected>Twilight</option>
|
<option value="false" selected><?php i18n("Off");?></option>
|
||||||
<option value="vibrant_ink">Vibrant Ink</option>
|
<option value="true"><?php i18n("On"); ?></option>
|
||||||
<option value="xcode">XCode</option>
|
</select>
|
||||||
</select>
|
</td>
|
||||||
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
|
<td><?php i18n("Over Scroll"); ?></td>
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
<select class="setting" data-setting="codiad.editor.overScroll">
|
||||||
|
<option value="0" selected><?php i18n("None");?></option>
|
||||||
<td><?php i18n("Font Size"); ?></td>
|
<option value="0.5"><?php i18n("Half");?></option>
|
||||||
<td>
|
<option value="1"><?php i18n("Full");?></option>
|
||||||
|
</select>
|
||||||
<select class="setting" data-setting="codiad.editor.fontSize">
|
</td>
|
||||||
<option value="10px">10px</option>
|
</tr>
|
||||||
<option value="11px">11px</option>
|
<tr>
|
||||||
<option value="12px">12px</option>
|
<td><?php i18n("Print Margin"); ?></td>
|
||||||
<option value="13px" selected>13px</option>
|
<td>
|
||||||
<option value="14px">14px</option>
|
<select class="setting" data-setting="codiad.editor.printMargin">
|
||||||
<option value="15px">15px</option>
|
<option value="true"><?php i18n("Show");?></option>
|
||||||
<option value="16px">16px</option>
|
<option value="false" selected><?php i18n("Hide");?></option>
|
||||||
<option value="17px">17px</option>
|
</select>
|
||||||
<option value="18px">18px</option>
|
</td>
|
||||||
</select>
|
</tr>
|
||||||
|
<tr>
|
||||||
</td>
|
<td><?php i18n("Print Margin Column");?></td>
|
||||||
|
<td>
|
||||||
</tr>
|
<select class="setting" data-setting="codiad.editor.printMarginColumn">
|
||||||
<tr>
|
<option value="80" selected>80</option>
|
||||||
|
<option value="85">85</option>
|
||||||
<td><?php i18n("Highlight Active Line"); ?></td>
|
<option value="90">90</option>
|
||||||
<td>
|
<option value="95">95</option>
|
||||||
|
<option value="100">100</option>
|
||||||
<select class="setting" data-setting="codiad.editor.highlightLine">
|
<option value="105">105</option>
|
||||||
<option value="true" selected><?php i18n("Yes"); ?></option>
|
<option value="110">110</option>
|
||||||
<option value="false"><?php i18n("No"); ?></option>
|
<option value="115">115</option>
|
||||||
</select>
|
<option value="120">120</option>
|
||||||
|
</select>
|
||||||
</td>
|
</td>
|
||||||
|
</tr>
|
||||||
</tr>
|
<tr>
|
||||||
<tr>
|
<td><?php i18n("Soft Tabs");?></td>
|
||||||
|
<td>
|
||||||
<td><?php i18n("Indent Guides"); ?></td>
|
<select class="setting" data-setting="codiad.editor.softTabs">
|
||||||
<td>
|
<option value="false" selected><?php i18n("No");?></option>
|
||||||
|
<option value="true"><?php i18n("Yes");?></option>
|
||||||
<select class="setting" data-setting="codiad.editor.indentGuides">
|
</select>
|
||||||
<option value="true" selected><?php i18n("On"); ?></option>
|
</td>
|
||||||
<option value="false"><?php i18n("Off"); ?></option>
|
</tr>
|
||||||
</select>
|
<tr>
|
||||||
|
<td><?php i18n("Tab Size");?></td>
|
||||||
</td>
|
<td>
|
||||||
|
<select class="setting" data-setting="codiad.editor.tabSize">
|
||||||
</tr>
|
<option value="2">2</option>
|
||||||
<tr>
|
<option value="3">3</option>
|
||||||
|
<option value="4" selected>4</option>
|
||||||
<td><?php i18n("Print Margin"); ?></td>
|
<option value="5">5</option>
|
||||||
<td>
|
<option value="6">6</option>
|
||||||
|
<option value="7">7</option>
|
||||||
<select class="setting" data-setting="codiad.editor.printMargin">
|
<option value="8">8</option>
|
||||||
<option value="true"><?php i18n("Show"); ?></option>
|
</select>
|
||||||
<option value="false" selected><?php i18n("Hide"); ?></option>
|
</td>
|
||||||
</select>
|
</tr>
|
||||||
|
<tr>
|
||||||
</td>
|
<td width="50%"><?php i18n("Theme");?></td>
|
||||||
|
<td>
|
||||||
</tr>
|
<select class="setting" data-setting="codiad.editor.theme">
|
||||||
<tr>
|
<?php
|
||||||
|
|
||||||
<td><?php i18n("Print Margin Column"); ?></td>
|
$files = glob( COMPONENTS . "/editor/ace-editor/*.js" );
|
||||||
<td>
|
foreach( $files as $file ) {
|
||||||
|
|
||||||
<select class="setting" data-setting="codiad.editor.printMarginColumn">
|
$name = pathinfo( $file, PATHINFO_FILENAME );
|
||||||
<option value="80" selected>80</option>
|
if( strpos( strtolower( $name ), strtolower( "theme-" ) ) !== false ) {
|
||||||
<option value="85">85</option>
|
|
||||||
<option value="90">90</option>
|
$value = str_replace( "theme-", "", str_replace( ".js", "", $name ) );
|
||||||
<option value="95">95</option>
|
$name = ucwords( str_replace( "_", " ", $value ) );
|
||||||
<option value="100">100</option>
|
?><option value="<?php echo $value;?>"><?php echo $name;?></option><?php
|
||||||
<option value="105">105</option>
|
}
|
||||||
<option value="110">110</option>
|
}
|
||||||
<option value="115">115</option>
|
?>
|
||||||
<option value="120">120</option>
|
</select>
|
||||||
</select>
|
</td>
|
||||||
|
</tr>
|
||||||
</td>
|
<tr>
|
||||||
|
<td><?php i18n("Wrap Lines"); ?></td>
|
||||||
</tr>
|
<td>
|
||||||
<tr>
|
<select class="setting" data-setting="codiad.editor.wrapMode">
|
||||||
|
<option value="false" selected><?php i18n("No wrap");?></option>
|
||||||
<td><?php i18n("Wrap Lines"); ?></td>
|
<option value="true"><?php i18n("Wrap Lines");?></option>
|
||||||
<td>
|
</select>
|
||||||
|
</td>
|
||||||
<select class="setting" data-setting="codiad.editor.wrapMode">
|
</tr>
|
||||||
<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>
|
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -7,8 +7,8 @@ class sql {
|
||||||
const DB_TYPES = array(
|
const DB_TYPES = array(
|
||||||
|
|
||||||
"MySQL" => "mysql",
|
"MySQL" => "mysql",
|
||||||
"PostgresSQL" => "pgsql",
|
"PostgreSQL" => "pgsql",
|
||||||
"SQLite" => "sqlite",
|
//"SQLite" => "sqlite",
|
||||||
);
|
);
|
||||||
|
|
||||||
public $connection = null;
|
public $connection = null;
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Update {
|
||||||
// CONSTANTS
|
// CONSTANTS
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
CONST VERSION = "v.2.9.4.1";
|
CONST VERSION = "v.2.9.5";
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////
|
||||||
// PROPERTIES
|
// PROPERTIES
|
||||||
|
|
|
@ -5,11 +5,14 @@
|
||||||
//error_reporting(E_ALL);
|
//error_reporting(E_ALL);
|
||||||
|
|
||||||
require_once('../../common.php');
|
require_once('../../common.php');
|
||||||
|
require_once('../settings/class.settings.php');
|
||||||
require_once('./class.update.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();
|
//checkSession();
|
||||||
if ( ! checkAccess() ) {
|
if ( ! checkAccess() ) {
|
||||||
echo "Error, you do not have access to update Codiad.";
|
echo "Error, you do not have access to update Codiad.";
|
||||||
|
@ -102,8 +105,6 @@ class updater {
|
||||||
mkdir( $backup, 00755 );
|
mkdir( $backup, 00755 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function copy_backup( $source, $dest ) {
|
function copy_backup( $source, $dest ) {
|
||||||
|
|
||||||
// Check for symlinks
|
// Check for symlinks
|
||||||
|
@ -173,8 +174,6 @@ class updater {
|
||||||
|
|
||||||
function check_sql() {
|
function check_sql() {
|
||||||
|
|
||||||
require_once('../../common.php');
|
|
||||||
require_once('../sql/class.sql.php');
|
|
||||||
$sql = new sql();
|
$sql = new sql();
|
||||||
$connection = $sql->connect();
|
$connection = $sql->connect();
|
||||||
$result = $sql->create_default_tables();
|
$result = $sql->create_default_tables();
|
||||||
|
@ -211,9 +210,6 @@ class updater {
|
||||||
|
|
||||||
function convert() {
|
function convert() {
|
||||||
|
|
||||||
require_once('../sql/class.sql.php');
|
|
||||||
require_once('../settings/class.settings.php');
|
|
||||||
|
|
||||||
$user_settings_file = DATA . "/settings.php";
|
$user_settings_file = DATA . "/settings.php";
|
||||||
$projects_file = DATA . "/projects.php";
|
$projects_file = DATA . "/projects.php";
|
||||||
$users_file = DATA . "/users.php";
|
$users_file = DATA . "/users.php";
|
||||||
|
@ -235,18 +231,22 @@ class updater {
|
||||||
if( file_exists( $projects_file ) ) {
|
if( file_exists( $projects_file ) ) {
|
||||||
|
|
||||||
$projects = getJSON( 'projects.php' );
|
$projects = getJSON( 'projects.php' );
|
||||||
foreach( $projects as $project => $data ) {
|
|
||||||
|
if( is_array( $projects ) ) {
|
||||||
|
|
||||||
$owner = 'nobody';
|
foreach( $projects as $project => $data ) {
|
||||||
$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();
|
$owner = 'nobody';
|
||||||
exit(formatJSEND( "error", "There was an error adding projects to database." ));
|
$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 );
|
unlink( $projects_file );
|
||||||
|
@ -255,28 +255,32 @@ class updater {
|
||||||
if( file_exists( $users_file ) ) {
|
if( file_exists( $users_file ) ) {
|
||||||
|
|
||||||
$users = getJSON( 'users.php' );
|
$users = getJSON( 'users.php' );
|
||||||
foreach( $users as $user ) {
|
|
||||||
|
if( is_array( $users ) ) {
|
||||||
|
|
||||||
if( $user["username"] === $_SESSION["user"] ) {
|
foreach( $users as $user ) {
|
||||||
|
|
||||||
$access = "admin";
|
if( $user["username"] === $_SESSION["user"] ) {
|
||||||
} else {
|
|
||||||
|
$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";
|
if( $return > 0 ) {
|
||||||
}
|
|
||||||
$query = "INSERT INTO users( username, password, access, project ) VALUES ( ?, ?, ?, ? );";
|
$this->username = $user["username"];
|
||||||
$bind_variables = array( $user["username"], $user["password"], $access, null );
|
$this->set_default_options();
|
||||||
$return = $sql->query( $query, $bind_variables, 0, "rowCount" );
|
//echo formatJSEND( "success", array( "username" => $user["username"] ) );
|
||||||
|
} else {
|
||||||
if( $return > 0 ) {
|
|
||||||
|
$this->restore();
|
||||||
$this->username = $user["username"];
|
exit(formatJSEND( "error", "The Username is Already Taken" ));
|
||||||
$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 );
|
unlink( $users_file );
|
||||||
|
@ -415,10 +419,10 @@ class updater {
|
||||||
|
|
||||||
function remove_directory( $path ) {
|
function remove_directory( $path ) {
|
||||||
|
|
||||||
$files = glob($path . '/*');
|
$files = glob( $path . '{,.}[!.,!..]*', GLOB_MARK|GLOB_BRACE );
|
||||||
foreach ($files as $file) {
|
foreach( $files as $file ) {
|
||||||
|
|
||||||
is_dir($file) ? $this->remove_directory($file) : unlink($file);
|
is_dir( $file ) ? $this->remove_directory( $file ) : unlink( $file );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( is_dir( $path ) ) {
|
if( is_dir( $path ) ) {
|
||||||
|
@ -524,8 +528,6 @@ class updater {
|
||||||
|
|
||||||
$this->copyr( $src, $dest );
|
$this->copyr( $src, $dest );
|
||||||
$this->remove_directory( $src );
|
$this->remove_directory( $src );
|
||||||
$this->convert();
|
|
||||||
$this->check_sql();
|
|
||||||
return( "true" );
|
return( "true" );
|
||||||
} catch( Exception $e ) {
|
} 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 ) {
|
public function update_option( $option, $value, $user_setting = null ) {
|
||||||
|
|
||||||
$sql = new sql();
|
$sql = new sql();
|
||||||
|
@ -619,6 +636,11 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
|
|
||||||
echo $updater->update();
|
echo $updater->update();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case( "update_database" ):
|
||||||
|
|
||||||
|
echo $updater->update_database();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
|
@ -674,6 +696,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
const codiad = {};
|
const codiad = {};
|
||||||
codiad.update = {
|
codiad.update = {
|
||||||
|
|
||||||
|
base_url: `<?php echo BASE_URL;?>`,
|
||||||
progress: null,
|
progress: null,
|
||||||
|
|
||||||
init: function() {
|
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() {
|
check_update: function() {
|
||||||
|
|
||||||
this.progress.innerText = "Checking for update ... ";
|
this.progress.innerText = "Checking for update ... ";
|
||||||
|
@ -809,6 +861,33 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
|
|
||||||
update: async function() {
|
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();
|
let result = await this.check_update();
|
||||||
|
|
||||||
console.log( result );
|
console.log( result );
|
||||||
|
@ -834,7 +913,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.innerText = "Applying update.";
|
progress.innerText = "Applying filesystem update.";
|
||||||
let apply = await this.apply();
|
let apply = await this.apply();
|
||||||
|
|
||||||
if( apply !== "true" ) {
|
if( apply !== "true" ) {
|
||||||
|
@ -844,7 +923,12 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
return;
|
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" ) {
|
} else if( result === "false" ) {
|
||||||
|
|
||||||
progress.innerText = "No update was found ...";
|
progress.innerText = "No update was found ...";
|
||||||
|
@ -856,6 +940,28 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
|
|
||||||
update_development: async function() {
|
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.";
|
progress.innerText = "An update was found. Downloading update.";
|
||||||
let download = await this.download( true );
|
let download = await this.download( true );
|
||||||
|
|
||||||
|
@ -876,7 +982,7 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
progress.innerText = "Applying update.";
|
progress.innerText = "Applying filesystem update.";
|
||||||
let apply = await this.apply();
|
let apply = await this.apply();
|
||||||
|
|
||||||
if( apply !== "true" ) {
|
if( apply !== "true" ) {
|
||||||
|
@ -886,7 +992,12 @@ if( isset( $_GET["action"] ) && $_GET["action"] !== '' ) {
|
||||||
return;
|
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>
|
</script>
|
||||||
|
|
|
@ -41,7 +41,6 @@ class User {
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
|
|
||||||
$this->actives = getJSON( 'active.php' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_user() {
|
public function add_user() {
|
||||||
|
|
Loading…
Reference in a new issue