new routes

This commit is contained in:
CHIEFSOFT\ameye
2025-01-04 11:42:28 -05:00
parent e9686ead4c
commit c424fbf72c
2 changed files with 108 additions and 3 deletions
+106 -3
View File
@@ -2,12 +2,12 @@
namespace App\Controllers;
//use CodeIgniter\API\ResponseTrait;
use CodeIgniter\API\ResponseTrait;
class BlogData extends BaseController
{
//use ResponseTrait;
use ResponseTrait;
protected $db;
public $con_name = 'wrench_dockerblog'; // 'wrench_blog';
@@ -124,7 +124,8 @@ class BlogData extends BaseController
{
log_message('critical', "anyBlogData DATA CALL ********* ".$blogName );
$blogsArray = ['chiefsoft',
$blogsArray =
['chiefsoft',
'blackfaces',
'mermsemr',
'myfit',
@@ -187,6 +188,7 @@ class BlogData extends BaseController
}
return $this->response->setJson($out);
// return $this->respond( $this->response->setJson($out), 200);
}
private function apiBlogData($dbConnection, $blog_id=0) {
@@ -237,4 +239,105 @@ class BlogData extends BaseController
return $query->getResult('array');
}
public function anyMermsBlogData($blogName)
{
log_message('critical', "0001");
header('Access-Control-Allow-Origin: *');
log_message('critical', "anyMermsBlogData Path GATE 001");
$call_backend = true;
/*
//header("Access-Control-Allow-Origin: http://localhost:9057 ");
header('Access-Control-Expose-Headers: Access-Control-Allow-Origin');
//header('Access-Control-Allow-Credentials: true ');
//header("Access-Control-Allow-Headers: Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With");
header('Access-Control-Allow-Headers :Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token');
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
header('Content-type: application/json');
*/
header("Access-Control-Allow-Headers: Origin, X-API-KEY, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method, Access-Control-Allow-Headers, Authorization, observe, enctype, Content-Length, X-Csrf-Token");
log_message('critical', "0003");
header("Access-Control-Allow-Methods: GET, PUT, POST, DELETE, PATCH, OPTIONS");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Max-Age: 3600");
header('content-type: application/json; charset=utf-8');
log_message('critical', "anyBlogData DATA CALL ********* ".$blogName );
$blogsArray =
['chiefsoft',
'blackfaces',
'mermsemr',
'myfit',
'dorcastore',
'sanyaameye',
'oluameye_www',
'automedsys',
'tokslaw',
'oluameye',
'coregrade',
'wrenchboard',
'tokslaw_blog',
'modupeameye'];
$custom = [
'DSN' => '',
'hostname' => '10.10.10.35',
'username' => 'bloguser',
'password' => 'bloguserF22!',
'database' => $blogName,
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => (ENVIRONMENT !== 'production'),
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3307,
];
$dbConnection = \Config\Database::connect($custom);
// var_dump( $general_blog );
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
log_message('critical', "anyBlogData DATA CALL ********* ".serialize($in) );
$out = $this->apiBlogData($dbConnection, 0);
//var_dump($out);
$out['blogconfig'] = [
"media_url" => "https://blog.wrenchboard.com/wp-content/uploads",
"site_url" => "https://blog.wrenchboard.com",
"other_cofig2" => "NONE",
];
switch( $blogName ){
case 'oluameye':
$out['blogconfig'] = [
"media_url" => "https://blog.oluameye.com/wp-content/uploads",
"site_url" => "https://blog.oluameye.com/",
"other_cofig2" => "NONE",
];
break;
case 'mermsemr':
$out['blogconfig'] = [
"media_url" => "https://blog.mermsemr.com/wp-content/uploads",
"site_url" => "https://blog.mermsemr.com/",
"other_cofig2" => "NONE",
];
break;
}
return $this->response->setJson($out);
// return $this->respond( $this->response->setJson($out), 200);
}
}