merm compatible

This commit is contained in:
CHIEFSOFT\ameye
2025-10-05 15:46:15 -04:00
parent 03f40bb77f
commit 7dd9e23a04
7 changed files with 169 additions and 86 deletions
+61
View File
@@ -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);
}
}
+3
View File
@@ -16,6 +16,9 @@ class Home extends BaseController
public function contacts(): string
{
if($_POST){
// var_dump( $_POST );
}
return view('contacts');
}
+29 -9
View File
@@ -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;
}
</style>
<link rel="shortcut" href="/images/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="stylesheets/style.css"/>
</head>
<body>
<div class="wrap">
<h1>404</h1>
<div class="wrap">
<div class="logo"><a href="/"><img src="/images/logo.png" alt=""/></a></div>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
<h1>Page not found</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
<p>
<div>
<span><a href="/">Home</a> |</span> <span><a href="/about-us">About us</a> |</span> <span> <a
href="/contacts">Contacts</a> </span>
<!-- <div class="clear"></div>-->
</div>
</p>
</div>
</body>
</html>
+2 -2
View File
@@ -47,11 +47,11 @@
<li class="current-menu-item"><a href="/">Home</a>
</li>
<li><a href="about-us">About us</a>
<li><a href="/about-us">About us</a>
</li>
<li><a href="contacts">Contacts</a></li>
<li><a href="/contacts">Contacts</a></li>
</ul>