Added some formatting to merges.

This commit is contained in:
xevidos 2019-03-04 15:39:30 -05:00
parent cb1a27e17b
commit 1c92f2ce31
3 changed files with 20 additions and 14 deletions

View File

@ -196,11 +196,11 @@ class Filemanager extends Common {
if ( $data['type'] == 'directory' ) {
$folders[] = array( "name"=>htmlentities($data['name'], ENT_QUOTES), "type"=>$data['type'], "size"=>$data['size'] );
$folders[] = array( "name"=>htmlentities( $data['name'], ENT_QUOTES ), "type"=>$data['type'], "size"=>$data['size'] );
}
if ( $data['type'] == 'file' ) {
$files[] = array( "name"=>htmlentities($data['name'], ENT_QUOTES), "type"=>$data['type'], "size"=>$data['size'] );
$files[] = array( "name"=>htmlentities( $data['name'], ENT_QUOTES ), "type"=>$data['type'], "size"=>$data['size'] );
}
}

View File

@ -70,7 +70,7 @@ function cleanPath( $path ) {
// Verify no overwrites
//////////////////////////////////////////////////////////////////////
if ( ! ( defined( "DBHOST" ) && defined( "DBNAME" ) && defined( "DBUSER" ) && defined( "DBPASS" ) && defined( "DBTYPE" ) ) ) {
if ( ! ( defined( 'DBHOST' ) && defined( 'DBNAME' ) && defined( 'DBUSER' ) && defined( 'DBPASS' ) && defined( 'DBTYPE' ) ) ) {
//////////////////////////////////////////////////////////////////
// Get POST responses
@ -95,15 +95,16 @@ if ( ! ( defined( "DBHOST" ) && defined( "DBNAME" ) && defined( "DBUSER" ) && de
$dbpass = $_POST['dbpass'];
//Valid databases Codiad is able to use
$aValidDBType = [
'mysql'
,'postgresql'
//,'sqlite'
$db_types = [
'mysql',
'postgresql',
//'sqlite',
];
//Is selected database type valid?
if(!in_array($dbtype,$aValidDBType)){
die( "Invalid database. Please select one of ".implode(", ",$aValidDBType)."." );
if( ! in_array( $dbtype, $db_types ) ) {
die( "Invalid database. Please select one of " . implode( ", ", $db_types ) . "." );
}
try {
@ -116,16 +117,18 @@ if ( ! ( defined( "DBHOST" ) && defined( "DBNAME" ) && defined( "DBUSER" ) && de
}
$bind_vars = array();
$bind = "";
$database_sql_fullpath = $path.'/components/install/sql/'.$dbtype.".sql";
if(!is_file($database_sql_fullpath)){
$database_sql_fullpath = $path . '/components/install/sql/' . $dbtype . '.sql';
if( ! is_file( $database_sql_fullpath ) ) {
die("Could not find the sql of the database ".$dbtype." to execute");
}
$sql = file_get_contents($database_sql_fullpath);
$sql = file_get_contents( $database_sql_fullpath );
try {
//Create the database
$result = $connection->exec($sql);
$result = $connection->exec( $sql );
} catch( PDOException $e ) {
die($e->getMessage());

View File

@ -166,7 +166,10 @@ if ($newrelic) {
<label><?php i18n("Database Pass"); ?></label>
<input type="text" name="dbpass" value="<?php echo($autocomplete['dbpass']); ?>">
<label><?php i18n("Database Type"); ?></label>
<input type="text" name="dbtype" value="<?php echo($autocomplete['dbtype']); ?>">
<select name="dbtype">
<option value="mysql">MySQL</option>
<option value="postgresql">PostgreSQL</option>
</select>
<hr>
<?php
$location = array(