#1 | Phalcon\Mvc\Model::findFirst
/var/www/stat.sellvia.com/www/apps/auth/controllers/IndexController.php (58) <?php
namespace App\Auth\Controllers;
use App\Backend\Models\Options;
use Auth\Auth;
use Phalcon\Mvc\Controller;
class IndexController extends Controller {
private $auth;
public function onConstruct() {
$this->auth = Auth::isAuth();
}
public function initialize() {
$this->initCss();
$this->initJs();
$this->view->setVar('domain', DOMAIN);
$this->view->setVar('api_url', API_URL);
}
protected function initCss(){
$this->assets
->collection('headerCSS')
->addCss('//fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons', false, true, ['rel' => 'stylesheet'] );
$this->assets
->collection('headerCSS')
->addCss('https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css', false, true, ['rel' => 'stylesheet'] );
$this->assets
->collection('headerCSS')
->addCss('/assets/auth/css/app.css', true, true, ['rel' => 'stylesheet'], RT_VERSION );
$this->assets
->collection('footerCSS');
}
protected function initJs(){
$this->assets
->collection('headerJS');
$this->assets
->collection('footerJS')
->addJs('/assets/auth/js/app.js', true, true, [], RT_VERSION);
}
public function indexAction() {
$option = Options::findFirst( "option_name = 'recaptcha_settings'" );
$recaptcha = Options::prepareCaptcha(
$option ? maybe_unserialize( $option->option_value ) : []
);
$this->view->setVar('recaptcha_status', $recaptcha['status'] ? $recaptcha['status'] : 0 );
$this->view->setVar('recaptcha_site_key', $recaptcha['site_key'] );
}
public function loginAction() {
if( ! $this->isAuth() ) {
header("Location: " . HOME_URL . "/login");
} else {
header("Location: " . HOME_URL . "/admin");
}
exit();
}
/**
* @return false|object
*/
protected function isAuth() {
return $this->auth ? $this->auth: false;
}
} |
#5 | Phalcon\Mvc\Application->handle
/var/www/stat.sellvia.com/www/public/index.php (71) <?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('UTC');
const RT_VERSION = '1.0.0';
const RT_CURRENCY = 'USD';
define( 'DOMAIN', $_SERVER['SERVER_NAME'] );
define( 'HOME_URL', 'https://' . DOMAIN );
define( 'API_URL', HOME_URL . '/rest/v1' );
define( 'BASE_PATH', dirname( __DIR__ ) );
const APP_PATH = BASE_PATH . '/apps';
const UPLOAD_PATH = BASE_PATH . '/public';
const UPLOAD_FOLDER = '/uploads';
//REST API
const API_PUBLIC = 'T59KYJ5SCU0RC1Y6H5TCSP92FFY87EK';
const API_SECRET = 'EMMT5J69LMEASE61G380F0VLIKXBSUC';
//AUTH
const SECRET_KEY = 'R3Q82U82T4JZBOCVN9RAREI72T25ZSI';
include APP_PATH . '/filters.php';
include APP_PATH . '/core.php';
if( file_exists(APP_PATH . '/library/vendor/autoload.php') ){
require_once(APP_PATH . '/library/vendor/autoload.php');
}
use Phalcon\Autoload\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
$debug = new Phalcon\Support\Debug();
$debug->listenExceptions()
->listenLowSeverity()
->listen();
class Application extends BaseApplication {
public function main() {
$this->registerServices();
// Зарегистрация установленных модулей
$this->registerModules( [
'auth' => [
'className' => 'App\Auth\Module',
'path' => APP_PATH . '/auth/Module.php'
],
'frontend' => [
'className' => 'App\Frontend\Module',
'path' => APP_PATH . '/frontend/Module.php'
],
'backend' => [
'className' => 'App\Backend\Module',
'path' => APP_PATH . '/backend/Module.php'
],
'admin' => [
'className' => 'App\Admin\Module',
'path' => APP_PATH . '/admin/Module.php'
]
] );
try {
$response = $this->handle( $_SERVER["REQUEST_URI"] );
$response->send();
} catch ( \Exception $e ) {
echo $e->getMessage();
echo $e->getCode();
echo $e->getFile();
echo $e->getLine();
// echo $e->getTrace();
echo $e->getTraceAsString();
}
}
/**
* Зарегистрация сервисов, чтобы сделать их общими, или в ModuleDefinition, чтобы сделать их специфичными для модуля.
*/
protected function registerServices() {
$di = new FactoryDefault();
$loader = new Loader();
$loader
->setDirectories( [
APP_PATH . '/vendor/'
] )
->register();
// Registering a router
$di->set( 'router', function () {
$router = new Router(false);
$router->setDefaultModule("frontend");
$router->add('/', [
'module' => 'admin',
'controller' => 'index',
'action' => 'checkAuth',
])->setName('admin');
$router->add('/login[/]{0,1}', [
'module' => 'auth',
'controller' => 'index',
'action' => 'index',
])->setName('auth');
$router->add('/admin/:params', [
'module' => 'admin',
'controller' => 'index',
'action' => 'index',
'params' => 1
])->setName('admin');
$router->add('/rest/v1/:controller/:action', [
'module' => 'backend',
'controller' => 1,
'action' => 2,
])->setName('backend-rest');
$router->notFound( [
'module' => 'auth',
'controller' => 'index',
'action' => 'login'
] );
return $router;
} );
$this->setDI($di);
}
}
$application = new Application();
$application->main(); |
#6 | Application->main
/var/www/stat.sellvia.com/www/public/index.php (147) <?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('UTC');
const RT_VERSION = '1.0.0';
const RT_CURRENCY = 'USD';
define( 'DOMAIN', $_SERVER['SERVER_NAME'] );
define( 'HOME_URL', 'https://' . DOMAIN );
define( 'API_URL', HOME_URL . '/rest/v1' );
define( 'BASE_PATH', dirname( __DIR__ ) );
const APP_PATH = BASE_PATH . '/apps';
const UPLOAD_PATH = BASE_PATH . '/public';
const UPLOAD_FOLDER = '/uploads';
//REST API
const API_PUBLIC = 'T59KYJ5SCU0RC1Y6H5TCSP92FFY87EK';
const API_SECRET = 'EMMT5J69LMEASE61G380F0VLIKXBSUC';
//AUTH
const SECRET_KEY = 'R3Q82U82T4JZBOCVN9RAREI72T25ZSI';
include APP_PATH . '/filters.php';
include APP_PATH . '/core.php';
if( file_exists(APP_PATH . '/library/vendor/autoload.php') ){
require_once(APP_PATH . '/library/vendor/autoload.php');
}
use Phalcon\Autoload\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
$debug = new Phalcon\Support\Debug();
$debug->listenExceptions()
->listenLowSeverity()
->listen();
class Application extends BaseApplication {
public function main() {
$this->registerServices();
// Зарегистрация установленных модулей
$this->registerModules( [
'auth' => [
'className' => 'App\Auth\Module',
'path' => APP_PATH . '/auth/Module.php'
],
'frontend' => [
'className' => 'App\Frontend\Module',
'path' => APP_PATH . '/frontend/Module.php'
],
'backend' => [
'className' => 'App\Backend\Module',
'path' => APP_PATH . '/backend/Module.php'
],
'admin' => [
'className' => 'App\Admin\Module',
'path' => APP_PATH . '/admin/Module.php'
]
] );
try {
$response = $this->handle( $_SERVER["REQUEST_URI"] );
$response->send();
} catch ( \Exception $e ) {
echo $e->getMessage();
echo $e->getCode();
echo $e->getFile();
echo $e->getLine();
// echo $e->getTrace();
echo $e->getTraceAsString();
}
}
/**
* Зарегистрация сервисов, чтобы сделать их общими, или в ModuleDefinition, чтобы сделать их специфичными для модуля.
*/
protected function registerServices() {
$di = new FactoryDefault();
$loader = new Loader();
$loader
->setDirectories( [
APP_PATH . '/vendor/'
] )
->register();
// Registering a router
$di->set( 'router', function () {
$router = new Router(false);
$router->setDefaultModule("frontend");
$router->add('/', [
'module' => 'admin',
'controller' => 'index',
'action' => 'checkAuth',
])->setName('admin');
$router->add('/login[/]{0,1}', [
'module' => 'auth',
'controller' => 'index',
'action' => 'index',
])->setName('auth');
$router->add('/admin/:params', [
'module' => 'admin',
'controller' => 'index',
'action' => 'index',
'params' => 1
])->setName('admin');
$router->add('/rest/v1/:controller/:action', [
'module' => 'backend',
'controller' => 1,
'action' => 2,
])->setName('backend-rest');
$router->notFound( [
'module' => 'auth',
'controller' => 'index',
'action' => 'login'
] );
return $router;
} );
$this->setDI($di);
}
}
$application = new Application();
$application->main(); |