diff --git a/.env b/.env index ccbed2b..5445d97 100644 --- a/.env +++ b/.env @@ -1,71 +1,6 @@ -CONTAINER_PORT=62100 +APP_PORT=62100 UID=1000 -#-------------------------------------------------------------------- -# Example Environment Configuration file -# -# This file can be used as a starting point for your own -# custom .env files, and contains most of the possible settings -# available in a default install. -# -# By default, all of the settings are commented out. If you want -# to override the setting, you must un-comment it by removing the '#' -# at the beginning of the line. -#-------------------------------------------------------------------- - -#-------------------------------------------------------------------- -# ENVIRONMENT -#-------------------------------------------------------------------- - -# CI_ENVIRONMENT = production - -#-------------------------------------------------------------------- -# APP -#-------------------------------------------------------------------- - -# app.baseURL = '' -# If you have trouble with `.`, you could also use `_`. -# app_baseURL = '' -# app.forceGlobalSecureRequests = false -# app.CSPEnabled = false - -#-------------------------------------------------------------------- -# DATABASE -#-------------------------------------------------------------------- - -# database.default.hostname = localhost -# database.default.database = ci4 -# database.default.username = root -# database.default.password = root -# database.default.DBDriver = MySQLi -# database.default.DBPrefix = -# database.default.port = 3306 - -# If you use MySQLi as tests, first update the values of Config\Database::$tests. -# database.tests.hostname = localhost -# database.tests.database = ci4_test -# database.tests.username = root -# database.tests.password = root -# database.tests.DBDriver = MySQLi -# database.tests.DBPrefix = -# database.tests.charset = utf8mb4 -# database.tests.DBCollat = utf8mb4_general_ci -# database.tests.port = 3306 - -#-------------------------------------------------------------------- -# ENCRYPTION -#-------------------------------------------------------------------- - -# encryption.key = - -#-------------------------------------------------------------------- -# SESSION -#-------------------------------------------------------------------- - -# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' -# session.savePath = null - -#-------------------------------------------------------------------- -# LOGGER -#-------------------------------------------------------------------- - -# logger.threshold = 4 +PROVISION_UID=3cc24fd6-e6c7-4c08-8a64-f06e3f790f38 +CONTENTS_SERVER="https://devapi.mermsemr.com/web/contents" +CONTENTS_SERVER2="http://10.10.10.101:14700/web/contents" +SITE_CONTACT_URL="https://devapi.mermsemr.com/web/contacts" diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index 8b435da..fe8bcf1 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -55,4 +55,65 @@ abstract class BaseController extends Controller // E.g.: $this->session = \Config\Services::session(); } + + public function getenv_docker($env, $default) + { + if ($fileEnv = getenv($env . '_FILE')) { + return rtrim(file_get_contents($fileEnv), "\r\n"); + } else if (($val = getenv($env)) !== false) { + return $val; + } else { + return $default; + } + } + + public function ExternalAPICall($method, $url, $data) + { + // $curl = curl_init(); + $curl = curl_init($url); + switch ($method) { + case "GET": + $params2 = ''; + foreach ($data as $key2 => $value2) + $params2 .= $key2 . '=' . $value2 . '&'; + + $params2 = trim($params2, '&'); + $url = $url . '?' . $params2;// add param to URL + log_message('critical', "API URL FINAL =>" . $url); + //curl_setopt($curl, CURLOPT_FRESH_CONNECT, true); + //curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + //curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); + break; + case "POST": + curl_setopt($curl, CURLOPT_POST, 1); + if ($data) + // curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data)); + // curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data)); + break; + case "PUT": + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT"); + if ($data) + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + break; + } + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_HTTPHEADER, array( + 'APIKEY: RegisteredAPIkey', + 'Content-Type: application/json', + )); + + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); + $result = curl_exec($curl); + + if (!$result) { + //echo("Connection failure!"); + log_message('critical', "API Connection failure! =>" . $url); + + } + curl_close($curl); + return json_decode($result, true); + } } diff --git a/app/Controllers/Home.php b/app/Controllers/Home.php index c2f40c7..7a8f0d8 100644 --- a/app/Controllers/Home.php +++ b/app/Controllers/Home.php @@ -16,6 +16,9 @@ class Home extends BaseController public function contacts(): string { + if($_POST){ + // var_dump( $_POST ); + } return view('contacts'); } diff --git a/app/Views/errors/html/error_404.php b/app/Views/errors/html/error_404.php index e506f08..004d84e 100644 --- a/app/Views/errors/html/error_404.php +++ b/app/Views/errors/html/error_404.php @@ -15,6 +15,7 @@ left: 50%; margin-left: -73px; } + body { height: 100%; background: #fafafa; @@ -22,6 +23,7 @@ color: #777; font-weight: 300; } + h1 { font-weight: lighter; letter-spacing: normal; @@ -30,6 +32,7 @@ margin-bottom: 0; color: #222; } + .wrap { max-width: 1024px; margin: 5rem auto; @@ -40,10 +43,12 @@ border-radius: 0.5rem; position: relative; } + pre { white-space: normal; margin-top: 1.5rem; } + code { background: #fafafa; border: 1px solid #efefef; @@ -51,9 +56,11 @@ border-radius: 5px; display: block; } + p { margin-top: 1.5rem; } + .footer { margin-top: 2rem; border-top: 1px solid #efefef; @@ -61,24 +68,37 @@ font-size: 85%; color: #999; } + a:active, a:link, a:visited { color: #dd4814; } + + +
-