mirror of
https://github.com/xevidos/codiad.git
synced 2024-12-22 13:52:16 +01:00
Merge branch 'development' into 'master'
Fixed install errors See merge request xevidos/codiad!20
This commit is contained in:
commit
1370580918
3 changed files with 36 additions and 45 deletions
|
@ -11,8 +11,8 @@ Features:
|
|||
* 100+ Native programming languages supported.
|
||||
* Auto Complete ( Trigger by CTRL + Space or Turn on Live Autocomplete ).
|
||||
* Auto Save.
|
||||
* Built in updter.
|
||||
* Collaborative Editing ( [via plugin](https://gitlab.com/xevidos/codiad-collaborative) ).
|
||||
* Built in updater.
|
||||
* Collaborative Editing ( [Via plugin](https://gitlab.com/xevidos/codiad-collaborative) ).
|
||||
* Multi Cursor.
|
||||
* Overscroll ( Ability to center bottom of code ).
|
||||
* PHP 7.2 Compatibility.
|
||||
|
@ -37,7 +37,6 @@ Task List:
|
|||
* 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.
|
||||
* Clean up Collaborative compatibility.
|
||||
* Clean up update script.
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ function cleanPath( $path ) {
|
|||
// Verify no overwrites
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
if ( ( file_exists( $user_settings_file ) || file_exists( $projects_file ) || file_exists( $users_file ) ) || ! ( defined( "DBHOST" ) && defined( "DBNAME" ) && defined( "DBUSER" ) && defined( "DBPASS" ) && defined( "DBTYPE" ) ) ) {
|
||||
if ( ! ( defined( "DBHOST" ) && defined( "DBNAME" ) && defined( "DBUSER" ) && defined( "DBPASS" ) && defined( "DBTYPE" ) ) ) {
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Get POST responses
|
||||
|
@ -88,12 +88,12 @@ if ( ( file_exists( $user_settings_file ) || file_exists( $projects_file ) || fi
|
|||
}
|
||||
$timezone = $_POST['timezone'];
|
||||
|
||||
$dbhost = $_POST['DBHOST'];
|
||||
$dbname = $_POST['DBNAME'];
|
||||
$dbuser = $_POST['DBUSER'];
|
||||
$dbpass = $_POST['DBPASS'];
|
||||
$dbhost = $_POST['dbhost'];
|
||||
$dbname = $_POST['dbname'];
|
||||
$dbuser = $_POST['dbuser'];
|
||||
$dbpass = $_POST['dbpass'];
|
||||
|
||||
$connection = mysqli_connect( $dbhost, $dbuser, $dbpass, $dbname ) or die ( formatJSEND( "error", 'Error connecting to mysql database. Please contact the website administrator.' ) );
|
||||
$connection = mysqli_connect( $dbhost, $dbuser, $dbpass, $dbname ) or die ( 'Error connecting to mysql database. Please contact the website administrator.' );
|
||||
$bind_vars = array();
|
||||
$bind = "";
|
||||
$sql = "
|
||||
|
@ -235,15 +235,9 @@ ALTER TABLE `user_options`
|
|||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
";
|
||||
$result = mysqli_prepare( $connection, $sql ) or die( $error );
|
||||
$result = mysqli_multi_query( $connection, $sql ) or die( "Error creating tables." );
|
||||
|
||||
$result->bind_param( $bind, ...$bind_variables );
|
||||
$result->execute();
|
||||
|
||||
if( $connection->error ) {
|
||||
|
||||
$return = formatJSEND( "error", $connection->error );
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Create Projects files
|
||||
|
@ -254,7 +248,10 @@ ALTER TABLE `user_options`
|
|||
if ( ! isAbsPath( $project_path ) ) {
|
||||
|
||||
$project_path = str_replace( " ", "_", preg_replace( '/[^\w-\.]/', '', $project_path ) );
|
||||
if( ! is_dir( $workspace . "/" . $project_path ) ) {
|
||||
|
||||
mkdir( $workspace . "/" . $project_path );
|
||||
}
|
||||
} else {
|
||||
|
||||
$project_path = cleanPath( $project_path );
|
||||
|
@ -277,22 +274,18 @@ ALTER TABLE `user_options`
|
|||
}
|
||||
}
|
||||
|
||||
$connection = mysqli_connect( $dbhost, $dbuser, $dbpass, $dbname ) or die ( 'Error connecting to mysql database. Please contact the website administrator.' );
|
||||
$bind_vars = array(
|
||||
$project_name,
|
||||
$project_path,
|
||||
$username
|
||||
);
|
||||
$bind = "sss";
|
||||
$sql = "INSERT INTO `projects`(`name`, `path`, `owner`) VALUES (?,?,?)";
|
||||
$result = mysqli_prepare( $connection, $sql ) or die( $error );
|
||||
$result->bind_param( $bind, ...$bind_variables );
|
||||
$sql = "INSERT INTO `projects`(`name`, `path`, `owner`) VALUES (?,?,?);";
|
||||
$result = mysqli_prepare( $connection, $sql ) or die( "Error inserting into projects." );
|
||||
$result->bind_param( $bind, ...$bind_vars );
|
||||
$result->execute();
|
||||
|
||||
if( $connection->error ) {
|
||||
|
||||
$return = formatJSEND( "error", $connection->error );
|
||||
}
|
||||
|
||||
$bind_vars = array(
|
||||
"",
|
||||
"",
|
||||
|
@ -306,14 +299,11 @@ ALTER TABLE `user_options`
|
|||
);
|
||||
$bind = "sssssssss";
|
||||
$sql = "INSERT INTO `users`(`first_name`, `last_name`, `username`, `password`, `email`, `project`, `access`, `groups`, `token`) VALUES (?,?,?,PASSWORD(?),?,?,?,?,?)";
|
||||
$result = mysqli_prepare( $connection, $sql ) or die( $error );
|
||||
$result->bind_param( $bind, ...$bind_variables );
|
||||
$result = mysqli_prepare( $connection, $sql ) or die( "Error inserting into users." );
|
||||
$result->bind_param( $bind, ...$bind_vars );
|
||||
$result->execute();
|
||||
|
||||
if( $connection->error ) {
|
||||
|
||||
$return = formatJSEND( "error", $connection->error );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sessions path.
|
||||
|
@ -369,7 +359,7 @@ date_default_timezone_set("' . $_POST['timezone'] . '");
|
|||
//define("AUTH_PATH", "/path/to/customauth.php");
|
||||
|
||||
// Site Name
|
||||
define("SITE_NAME", "' . $_POST['sitename'] . '");
|
||||
define("SITE_NAME", "' . $_POST['site_name'] . '");
|
||||
|
||||
// Database Information
|
||||
define( "DBHOST", "' . $_POST['dbhost'] . '" );
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
//ini_set('display_errors', 1);
|
||||
//ini_set('display_startup_errors', 1);
|
||||
//error_reporting(E_ALL);
|
||||
|
||||
require_once('../../common.php');
|
||||
require_once('./class.update.php');
|
||||
|
@ -118,14 +118,6 @@ class updater {
|
|||
"name" => "codiad.settings.autosave",
|
||||
"value" => "true",
|
||||
),
|
||||
array(
|
||||
"name" => "codiad.settings.plugin.sync",
|
||||
"value" => "true",
|
||||
),
|
||||
array(
|
||||
"name" => "codiad.settings.plugin.sync",
|
||||
"value" => "true",
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -182,11 +174,21 @@ class updater {
|
|||
mkdir($dest);
|
||||
}
|
||||
|
||||
$invalid_files = array(
|
||||
'.',
|
||||
'..',
|
||||
'backup',
|
||||
'codiad-master',
|
||||
'update.zip',
|
||||
'workspace',
|
||||
);
|
||||
|
||||
// Loop through the folder
|
||||
$dir = dir( $source );
|
||||
while (false !== $entry = $dir->read()) {
|
||||
// Skip pointers
|
||||
if ($entry == '.' || $entry == '..' || $entry == 'backup' || $entry == 'codiad-master' || $entry == 'workspace') {
|
||||
if( in_array( $entry, $invalid_files ) ) {
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue