403Webshell
Server IP : 14.225.204.176  /  Your IP : 216.73.216.6
Web Server : nginx/1.24.0
System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64
User : root ( 0)
PHP Version : 8.1.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/html/php/wit-crm/application/hooks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/php/wit-crm/application/hooks//EloquentHook.php
<?php

defined('BASEPATH') or exit('No direct script access allowed');

use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
use Illuminate\Pagination\Paginator;

class EloquentHook
{
    public function bootEloquent()
    {
        $this->configurePagination();

        $capsule = new Capsule;

        $capsule->addConnection([
            'driver'    => defined('ELOQUENT_DRIVER') ? ELOQUENT_DRIVER : 'mysql',
            'host'      => APP_DB_HOSTNAME,
            'database'  => APP_DB_NAME,
            'username'  => APP_DB_USERNAME,
            'password'  => APP_DB_PASSWORD,
            'charset'   => defined('APP_DB_CHARSET') ? APP_DB_CHARSET : 'utf8',
            'collation' => defined('APP_DB_COLLATION') ? APP_DB_COLLATION : 'utf8_general_ci',
            'prefix'    => db_prefix(),
        ]);

        $events = new Dispatcher(new Container);

        if (ENVIRONMENT != 'production') {
            $events->listen('Illuminate\Database\Events\QueryExecuted', function ($query) {
                $bindings = $query->bindings;
                // Format binding data for sql insertion
                foreach ($bindings as $i => $binding) {
                    if ($binding instanceof \DateTime) {
                        $bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
                    } elseif (is_string($binding)) {
                        $bindings[$i] = "'$binding'";
                    }
                }

                // Insert bindings into query
                $q = str_replace(['%', '?'], ['%%', '%s'], $query->sql);
                $q = vsprintf($q, $bindings);
                // Add it into CodeIgniter
                $db = & get_instance()->db;

                $db->query_times[] = $query->time;
                $db->queries[] = $q;
            });
        }

        $capsule->setEventDispatcher($events);

        $capsule->setAsGlobal();

        $capsule->bootEloquent();
    }

    private function configurePagination()
    {
        Paginator::currentPageResolver(function ($pageName = 'page') {
            $page = get_instance()->input->get_post($pageName);

            if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
                return $page;
            }

            return 1;
        });
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit