Skip to content

Commit

Permalink
code beautified
Browse files Browse the repository at this point in the history
  • Loading branch information
G Balraj committed Mar 20, 2019
1 parent 57adc91 commit 1a4cbee
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
24 changes: 12 additions & 12 deletions server/php/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@
define('OAUTH_CLIENT_SECRET', '4g7C4l1Y2b0S6a7L8c1E7B3K0e');
}
if (getenv('PLATFORM_RELATIONSHIPS')) {
$relationships = json_decode(base64_decode(getenv('PLATFORM_RELATIONSHIPS')), true);
$relationships = json_decode(base64_decode(getenv('PLATFORM_RELATIONSHIPS')) , true);
if (!empty($relationships['database'])) {
foreach ($relationships['database'] as $endpoint) {
define('R_DB_HOST', $endpoint['host']);
define('R_DB_USER', $endpoint['username']);
define('R_DB_PASSWORD', $endpoint['password']);
define('R_DB_NAME', $endpoint['path']);
define('R_DB_PORT', $endpoint['port']);
break;
}
foreach ($relationships['database'] as $endpoint) {
define('R_DB_HOST', $endpoint['host']);
define('R_DB_USER', $endpoint['username']);
define('R_DB_PASSWORD', $endpoint['password']);
define('R_DB_NAME', $endpoint['path']);
define('R_DB_PORT', $endpoint['port']);
break;
}
}
} else {
} else {
define('R_DB_HOST', 'localhost');
define('R_DB_USER', 'restya');
define('R_DB_PASSWORD', 'hjVl2!rGd');
define('R_DB_NAME', 'restyaboard');
define('R_DB_PORT', 5432);
}
}
define('SECURITYSALT', 'e9a556134534545ab47c6c81c14f06c0b8sdfsdf');
define('SITE_LICENSE_KEY', 'REPLACE YOUR LICENCE HERE');
if (!defined('STDIN') && !file_exists(SITE_URL_FOR_SHELL) && !empty($_server_domain_url)) {
Expand Down Expand Up @@ -99,4 +99,4 @@
'large_thumb' => '202x151'
)
);
$aspect['CardAttachment']['large_thumb'] = 1;
$aspect['CardAttachment']['large_thumb'] = 1;
8 changes: 4 additions & 4 deletions server/php/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ function preserveImageTransparency($fileExt, $sourceImg, &$targetImg)
$fullPath = $row['path'];
}
//Todo default image
if(explode('/',$fullPath)[0] == 'client' && explode('/',$fullPath)[1] == 'img'){
$fullPath = APP_PATH. DS .$fullPath;
}else{
if (explode('/', $fullPath) [0] == 'client' && explode('/', $fullPath) [1] == 'img') {
$fullPath = APP_PATH . DS . $fullPath;
} else {
$fullPath = MEDIA_PATH . DS . $fullPath;
}
$is_aspect = false;
Expand Down Expand Up @@ -190,4 +190,4 @@ function preserveImageTransparency($fileExt, $sourceImg, &$targetImg)
header('Location:' . $_SERVER['REQUEST_URI'] . '?chrome-3xx-fix');
} else {
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
}
}
23 changes: 11 additions & 12 deletions server/php/platformsh_install.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
exec('echo "sql file executed" > /tmp/.sql.installed');
exec('mkdir -p /tmp/pgpass');
exec('chmod -R go-rwx /tmp/pgpass');
$relationships = json_decode(base64_decode(getenv('PLATFORM_RELATIONSHIPS')), true);
$relationships = json_decode(base64_decode(getenv('PLATFORM_RELATIONSHIPS')) , true);
if (!empty($relationships['database'])) {
foreach ($relationships['database'] as $endpoint) {
define('R_DB_HOST', $endpoint['host']);
define('R_DB_USER', $endpoint['username']);
define('R_DB_PASSWORD', $endpoint['password']);
define('R_DB_NAME', $endpoint['path']);
define('R_DB_PORT', $endpoint['port']);
break;
define('R_DB_HOST', $endpoint['host']);
define('R_DB_USER', $endpoint['username']);
define('R_DB_PASSWORD', $endpoint['password']);
define('R_DB_NAME', $endpoint['path']);
define('R_DB_PORT', $endpoint['port']);
break;
}
}

exec('echo "'.R_DB_HOST.':'.R_DB_PORT.':'.R_DB_NAME.':'.R_DB_USER.':'.R_DB_PASSWORD.'" > /tmp/pgpass/.pgpass');
}
exec('echo "' . R_DB_HOST . ':' . R_DB_PORT . ':' . R_DB_NAME . ':' . R_DB_USER . ':' . R_DB_PASSWORD . '" > /tmp/pgpass/.pgpass');
exec('chmod 0600 /tmp/pgpass/.pgpass');
putenv('PGPASSFILE=/tmp/pgpass/.pgpass');
exec('psql --host='.R_DB_HOST. ' --port='.R_DB_PORT.' --dbname='.R_DB_NAME.' --username='.R_DB_USER.' --no-password --file=' . $current_dir . '/../../sql/restyaboard_with_empty_data.sql');
exec('rm -rf /tmp/pgpass');
exec('psql --host=' . R_DB_HOST . ' --port=' . R_DB_PORT . ' --dbname=' . R_DB_NAME . ' --username=' . R_DB_USER . ' --no-password --file=' . $current_dir . '/../../sql/restyaboard_with_empty_data.sql');
exec('rm -rf /tmp/pgpass');

0 comments on commit 1a4cbee

Please sign in to comment.