HEX
Server: LiteSpeed
System: Linux s917.lon1.mysecurecloudhost.com 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: assibfaf (3034)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/assibfaf/customassignment.us/api/index.php
<?php
/**
 * @package    Proxim
 * @author     Davison Pro <davisonpro.coder@gmail.com | https://davisonpro.dev>
 * @copyright  2019 Proxim
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'prox-bootstrap.php';

$app->add(new \Proxim\Slim\CorsMiddleware());
$app->add(new \Proxim\Slim\HttpCacheMiddleware());

// Catch all exceptions
$app->error(function ($exception) use ($app) {
    // Force the server status to be 500
    $app->response->status(500);
});

// Routes which do not need protection by the authentication and the request
// @TODO: Move this to a middleware
$authRouteWhitelist = [
    'get_config',
    'auth_login',
    'auth_logout',
    'dashboard',
    'get_discounts',
    'get_user_country',
    'account_register',
    'check_email',
    'create_order',
    'upload_files',
    'get_uploaded_files',
    'auth_forgot_password',
    'auth_check_password_hash',
    'get_calculator',
    'update_file_description',
    'get_pricing_block',
    'verify_new_password',
    'accept_change_password',
    'reject_password_change',
    'get_testimonials',
    'order_form',
    'coupon_exists',
    'checkout',
    'get_latest_orders',
    'get_testimonials',
    'fileDownload',
    'getUploadedFiles'
];

$app->hook('slim.before.dispatch', function () use ($app, $authRouteWhitelist, $user) {
	$routeName = $app->router()->getCurrentRoute()->getName();

	/** Skip routes which don't require these protections */
    if (!in_array($routeName, $authRouteWhitelist)) {
		/** Enforce required authentication. */
        if (!$user->isLogged()) {
            $app->response([
                'success' => false
            ])->status(401);
            return $app->stop();
        }
	}
    
    $app->container->user = $user;
});

/**
 * Request Payload
 */
$params = $app->request->get();
$requestPayload = $app->request->post();
 
$app->get('/get_calculator/?', '\Proxim\Api\Calculator:getCalculator')->name('get_calculator');
$app->get('/get_pricing_block/?', '\Proxim\Api\Calculator:getPricingBlock')->name('get_pricing_block');
$app->get('/last_completed_orders/?', '\Proxim\Api\LatestOrders:getOrders')->name('get_latest_orders');
$app->get('/testimonials?', '\Proxim\Api\Testimonials:listTestimonials')->name('get_testimonials');

$app->post('/payment/:paymentMethod?', '\Proxim\Api\Checkout:verifyPayment')->name('checkout');
$app->post('/payment/:paymentMethod/callback?', '\Proxim\Api\Checkout:verifyPayment')->name('checkout');

$app->get('/ifs/download/:fileId?', '\Proxim\Api\Files:downloadFile')->name('fileDownload');

$app->group('/v1', function () use ($app) {
    /** Configs */
    $app->group('/config', function () use ($app) {
        $app->get('/?', '\Proxim\Api\Config:getConfig')->name('get_config');
        $app->get('/tipsForWriter?', '\Proxim\Api\Config:tipsForWriter')->name('get_tips');
        $app->get('/user-country?', '\Proxim\Api\Config:getUserCountry')->name('get_user_country');
    });

    $app->post('/login?', '\Proxim\Api\Auth:login')->name('auth_login');
    $app->post('/logout?', '\Proxim\Api\Auth:logout')->name('auth_logout');
    $app->post('/forgot-password?', '\Proxim\Api\Auth:forgotPassword')->name('auth_forgot_password');
    $app->post('/check-hash/:resetHash?', '\Proxim\Api\Auth:checkHash')->name('auth_check_password_hash');
    $app->post('/change-password/:resetHash?', '\Proxim\Api\Auth:changePassword')->name('accept_change_password');
    $app->post('/rejectPasswordChange/:resetHash?', '\Proxim\Api\Auth:rejectPasswordChange')->name('reject_password_change');
    $app->post('/verify_new_pass?', '\Proxim\Api\Auth:verifyNewPassword')->name('verify_new_password');

    $app->get('/auth/:customerId?', '\Proxim\Api\Auth:impersonateCustomer')->name('auth_login');

    $app->group('/registration', function () use ($app) {
        $app->post('/?', '\Proxim\Api\Profile:register')->name('account_register');
        $app->post('/validate-email?', '\Proxim\Api\Profile:validateEmail')->name('check_email');
    });

    $app->group('/profile', function () use ($app) {
        $app->get('/?', '\Proxim\Api\Profile:getProfile')->name('get_account');
        $app->get('/discounts?', '\Proxim\Api\Profile:getDiscounts')->name('get_discounts');
        $app->get('/writers?', '\Proxim\Api\Profile:getWriters')->name('get_writers');
        
        $app->get('/is-survey-complete?', '\Proxim\Api\Profile:isSurveyComplete')->name('get_writers');
        $app->patch('/subscribe?', '\Proxim\Api\Profile:subscribe')->name('subscribe');
        
        $app->patch('/push-notifications-enabled?', '\Proxim\Api\Profile:pushNotificationsEnabled')->name('push_notifications_enabled');
        $app->patch('/policy-confirmation?', '\Proxim\Api\Profile:policyConfirmation')->name('confirm_policy');

        $app->put('/restore?', '\Proxim\Api\Profile:updateContacts');
        $app->put('/contacts?', '\Proxim\Api\Profile:updateContacts');
        $app->put('/password?', '\Proxim\Api\Profile:updatePassword');

        $app->get('/wallet?', '\Proxim\Api\Profile:getWallet');
        $app->post('/wallet?', '\Proxim\Api\Profile:loadWallet');
    });

    $app->group('/orders', function () use ($app) {
        $app->post('/?', '\Proxim\Api\Orders:create')->name('create_order');
        $app->get('/?', '\Proxim\Api\Orders:getOrders');
        $app->get('/unpaid?', '\Proxim\Api\Orders:getUnpaidOrders');
        
        /** Get order */
        $app->get('/:orderId?', '\Proxim\Api\Orders:getOrder');
        $app->get('/:orderId/order_payment?', '\Proxim\Api\Orders:payOrder');
        $app->delete('/:orderId?', '\Proxim\Api\Orders:cancelOrder');
        
        /** Progressive delivery */
        $app->post('/:orderId/pd_schedule_confirm?', '\Proxim\Api\Orders:pdScheduleConfirm');
        $app->post('/:orderId/pd_schedule_reject?', '\Proxim\Api\Orders:pdScheduleReject');
        
        /** Services */
        $app->post('/:orderId/add_services?', '\Proxim\Api\Orders:addServices');

        /** Messages */
        $app->post('/:orderId/messages?', '\Proxim\Api\Messages:postOrderMessage');
        $app->get('/:orderId/messages?', '\Proxim\Api\Messages:getOrderMessages');

        /** Message Replies **/
        $app->get('/:orderId/messages/:messageId?', '\Proxim\Api\Messages:getMessageReplies');
        $app->post('/:orderId/messages/:messageId?', '\Proxim\Api\Messages:postMessageReply');
        
        // update message status
        $app->patch('/:orderId/messages/:messageId?', '\Proxim\Api\Messages:updateMessage');

        // Mark All as Read
        $app->post('/:orderId/messages/markAllMessagesAsRead?', '\Proxim\Api\Messages:markAllMessagesAsRead');

        // sendTipsForWriters
        $app->post('/:orderId/sendTipsForWriters?', '\Proxim\Api\Orders:sendTipsForWriters')->name('sendTipsForWriters');
        
        /** Files */
        $app->get('/:orderId/files?', '\Proxim\Api\Files:getOrderFiles')->name('get_order_files');
        $app->get('/:orderId/reorder_files?', '\Proxim\Api\Files:getOrderFiles')->name('get_reorder_files');
        
        /** Additional Payments */
        $app->get('/:addPaymentId/additional_payment?', '\Proxim\Api\Orders:getAdditionalPayments');
        $app->post('/:addPaymentId/additional_payment_pay?', '\Proxim\Api\Orders:payAdditionalPayment');
        
        /** Order Actions */
        $app->post('/:orderId/approve_order?', '\Proxim\Api\Orders:approveOrder');
        $app->post('/:orderId/request_revision?', '\Proxim\Api\Orders:requestRevision');
        $app->post('/:orderId/request_revision_paid?', '\Proxim\Api\Orders:requestPaidRevision');
        $app->post('/:orderId/revision_paid_update?', '\Proxim\Api\Orders:updatePaidRevision');
        $app->post('/:orderId/request_refund?', '\Proxim\Api\Orders:requestRefund');
    
        $app->get('/:orderId/files/samples?', '\Proxim\Api\Orders:getSamples');
        $app->get('/:orderId/files/sources?', '\Proxim\Api\Orders:getSources');
    });

    $app->get('/discounts/:couponCode?', '\Proxim\Api\Profile:couponExists')->name('coupon_exists');

    $app->post('/get_files_info?', '\Proxim\Api\Files:getUploadedFiles')->name('getUploadedFiles');

    $app->group('/order_files', function () use ($app) {
        $app->post('/customer_files_upload/:orderId?', '\Proxim\Api\Files:uploadOrderFiles')->name('upload_files');
    });

    $app->group('/files', function () use ($app) {
        $app->post('/?', '\Proxim\Api\Files:uploadFile')->name('upload_files');
        $app->post('/customer_files_descriptions?', '\Proxim\Api\Files:updateFileDescription')->name('updateFileDescription');
        
        $app->get('/:fileId/download?', '\Proxim\Api\Files:downloadFile')->name('fileDownload');
        $app->post('/deleteRequest/:fileId?', '\Proxim\Api\Files:deleteFile')->name('upload_files');
    });

    $app->get('/dl/:fileId?', '\Proxim\Api\Files:downloadFile')->name('fileDownload');

    $app->group('/questionnaire', function () use ($app) {
        $app->get('/call_questionnaire/:orderId?', '\Proxim\Api\Questionnaires:callQuestionnaire')->name('call_questionnaire');
    });

    $app->get('/trustpilot/navigate/:orderId/from/:status?', '\Proxim\Api\Orders:trustpilot')->name('trustpilot');
});

$app->notFound(function () use ($app) {
    $app->response->status(404);
    if ($app->request->isAjax()) {
        $app->response()->header('Content-Type', 'application/json; charset=utf-8');
    } else {
        $app->response()->header('Content-Type', 'text/html; charset=utf-8');
        $html = $app->container->smarty->fetch('404.tpl');
        echo trim($html);
    }
    return $app->stop();
});

// Run Slim
$app->response()->header('Content-Type', 'application/json; charset=utf-8');
$app->run();