403Webshell
Server IP : 85.158.181.41  /  Your IP : 216.73.217.12
Web Server : Apache
System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64
User : moncbefd ( 1024)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/moncbefd/www.moneta.at/GXModules/Gambio/StyleEdit/Api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/moncbefd/www.moneta.at/GXModules/Gambio/StyleEdit/Api//api.php
<?php
/* --------------------------------------------------------------
   api.php 2019-08-14
   Gambio GmbH
   http://www.gambio.de
   Copyright (c) 2019 Gambio GmbH
   Released under the GNU General Public License (Version 2)
   [http://www.gnu.org/licenses/gpl-2.0.html]
   --------------------------------------------------------------
*/

namespace Gambio\StyleEdit\Api;

use Exception;
use Gambio\StyleEdit\Api\Controllers\StyleEditController;
use Gambio\StyleEdit\DependencyInjector;

$includePath = get_include_path();

set_include_path(dirname(__DIR__, 4) . '/');

include 'includes/application_top.php';

set_include_path($includePath);
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Expose-Headers: Content-Length, X-JSON');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token, X-Theme-Id, HTTP_AUTHORIZATION');
// ----------------------------------------------------------------------------
// INITIALIZE API - SLIM FRAMEWORK
// ----------------------------------------------------------------------------

/**
 * API Version
 *
 * The current API version will be included within every response in the "X-API-Version" header so that
 * clients know which exact version they are using.
 *
 * @var string
 */
DependencyInjector::inject();
$devEnvironmentFilePath = dirname(__DIR__, 4) . DIRECTORY_SEPARATOR . '.dev-environment';
$environment            = file_exists($devEnvironmentFilePath) ? 'development' : 'production';

switch ($environment) {
    case 'development': // Complete verbose (HTML) output when errors occur.
        $config = [
            'mode'  => 'development',
            'debug' => false
        ];
        break;
    case 'test': // Includes PHP errors in the response body (stack trace).
        $config = [
            'mode'  => 'test',
            'debug' => false
        ];
        break;
    
    case 'production': // Will display error info in JSON format but hide extra information.
        $config = [
            'mode'  => 'production',
            'debug' => false
        ];
        break;
    
    default:
        throw new Exception('Invalid APIv2 environment selected: ' . $environment);
}

$version                                   = '2.6.0';
$config['version']                         = $version;
$config['settings']['displayErrorDetails'] = true;

$app = new \Slim\Slim($config);

$app->map('/styleedit(/:uri+)',
    function ($uri = []) use ($app) {
        
        //first parameter must always be the language
        $language = array_shift($uri);
        array_unshift($uri, "styleedit");
        
        $controller = new StyleEditController($app, $uri, $language);
        $method     = strtolower($app->request->getMethod());
        
        if ($method !== 'options') {
            $controller->$method();
        }
    })->via('GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS');

$app->error(function (\Exception $ex) use ($app) {
    $responseErrorCode = 500; // The default value for exceptions on server.
    
    if ($ex instanceof
        \Gambio\StyleEdit\Core\TranslatedException) // An HttpApiException will contain a specific HTTP status code.
    {
        $responseErrorCode = $ex->httpStatusCode();
    }
    
    $app->response->setStatus($responseErrorCode);
    $app->response->headers->set('Content-Type', 'application/json');
    
    $response = [
        'code'    => $ex->getCode(),
        'status'  => 'error',
        'message' => $ex->getMessage(),
        'request' => [
            'method' => $app->request->getMethod(),
            'url'    => $app->request->getUrl(),
            'path'   => $app->request->getPath(),
            'uri'    => [
                'root'     => $app->request->getRootUri(),
                'resource' => $app->request->getResourceUri()
            ]
        ]
    ];
    
    // Provide error stack only in 'test' mode.
    if ($app->config('mode') === 'test') {
        $response['error'] = [
            'file'  => $ex->getFile(),
            'line'  => $ex->getLine(),
            'stack' => $ex->getTrace()
        ];
    }
    
    if (defined('JSON_PRETTY_PRINT') && defined('JSON_UNESCAPED_SLASHES')) {
        $responseJsonString = json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    } else {
        $responseJsonString = json_encode($response); // PHP v5.3
    }
    
    $app->response->write($responseJsonString);
});

$app->run();

Youez - 2016 - github.com/yon3zu
LinuXploit