#0 | PDO->__construct(mysql:host=localhost;dbname=storefi1_v2;charset=utf8, storefi1_de, !XyAZh9kHENLRya7TTyQxJqhXQxg#, Array([3] => 2)) |
#1 | Phalcon\Db\Adapter\Pdo->connect(Array([host] => localhost, [username] => storefi1_de, [password] => !XyAZh9kHENLRya7TTyQxJqhXQxg#, [dbname] => storefi1_v2, [charset] => utf8)) |
#2 | Phalcon\Db\Adapter\Pdo->__construct(Array([host] => localhost, [username] => storefi1_de, [password] => !XyAZh9kHENLRya7TTyQxJqhXQxg#, [dbname] => storefi1_v2, [charset] => utf8))
/home/storefi1/public_html/app/_config/services.php (119) <?php
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
*/
$di = new \Phalcon\DI\FactoryDefault();
$di->set('config', $config);
/**
* The URL component is used to generate all kind of urls in the application
*/
$di->set('url', function () use ($config) {
$url = new Phalcon\Mvc\Url();
$url->setBaseUri($config->application->baseUri);
return $url;
}, true);
/**
* Router
*/
$di->set('router',function () use ($config) {
return include ("routes.php");
}, true);
/**
* Start the session the first time some component request the session service
*/
$di->set('session', function () {
$session = new Phalcon\Session\Adapter\Files();
$session->start();
return $session;
});
$di->set('dispatcher', function() use ($di) {
$dispatcher = new Dispatcher;
$dispatcher->setEventsManager($eventsManager);
return $dispatcher;
});
//Register the flash service with custom CSS classes
$di->set('flash', function() {
$flash = new \Phalcon\Flash\Session([
'error' => 'alert alert-danger w-100 text-center',
'success' => 'alert alert-success w-100 text-center',
'notice' => 'alert alert-warning w-100 text-center',
]);
return $flash;
});
/**
* Crypt service
*/
$di->set('crypt', function () use ($config) {
$crypt = new \Phalcon\Crypt();
$crypt->setKey($config->application->cryptSalt);
return $crypt;
});
$di->set('modelsManager', function() {
return new Phalcon\Mvc\Model\Manager();
});
$di->set('collectionManager', function(){
return new Phalcon\Mvc\Collection\Manager();
}, true);
/**
* Translation Service
*/
// $di->set('lang', function() {
// $request = $di->get('request');
// $config = $this->getConfig();
// $dispatcher = $this->getDispatcher();
// // Get language code
// if( $dispatcher->getParam("lang") !== NULL ) {
// $language = $dispatcher->getParam("lang");
// } else {
// // Ask browser what is the best language
// $language = $request->getBestLanguage();
// }
// $lang_file = __DIR__ . "/../../app/_translations/" . $language . ".php";
// // Check if we have a translation file for that language
// if(file_exists( $lang_file)) {
// require $lang_file;
// } else {
// // Fallback to default language
// require __DIR__ . "/../../app/_translations/".$config->application->frontend->default_language_url_key.".php";;
// }
// // Return a translation object
// return new \Phalcon\Translate\Adapter\NativeArray(array(
// "content" => $t
// ));
// });
/**
* Database connection is created based in the parameters defined in the configuration file
*/
$di->setShared('db', function () {
$config = $this->getConfig();
$class = 'Phalcon\Db\Adapter\Pdo\\' . $config->database->adapter;
$params = [
'host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname,
'charset' => $config->database->charset
];
if ($config->database->adapter == 'Postgresql') {
unset($params['charset']);
}
$connection = new $class($params);
return $connection;
}); |
#3 | Closure->{closure}() |
#4 | Phalcon\Di\Service->resolve(null, Object(Phalcon\Di\FactoryDefault)) |
#5 | Phalcon\Di->get(db, null) |
#6 | Phalcon\Di->getShared(db) |
#7 | Phalcon\Mvc\Model\Manager->_getConnection(Object(Multiple\Backend\Models\GlobalCountries: 20), null) |
#8 | Phalcon\Mvc\Model\Manager->getReadConnection(Object(Multiple\Backend\Models\GlobalCountries: 20)) |
#9 | Phalcon\Mvc\Model->getReadConnection() |
#10 | Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Multiple\Backend\Models\GlobalCountries: 20), Object(Phalcon\Di\FactoryDefault)) |
#11 | Phalcon\Mvc\Model\MetaData->_initialize(Object(Multiple\Backend\Models\GlobalCountries: 20), multiple\backend\models\globalcountries-global_countries, global_countries, ) |
#12 | Phalcon\Mvc\Model\MetaData->readMetaData(Object(Multiple\Backend\Models\GlobalCountries: 20)) |
#13 | Phalcon\Mvc\Model\MetaData->hasAttribute(Object(Multiple\Backend\Models\GlobalCountries: 20), url_key) |
#14 | Phalcon\Mvc\Model\Query->_getQualified(Array([type] => 355, [name] => url_key)) |
#15 | Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 355, [name] => url_key), true) |
#16 | Phalcon\Mvc\Model\Query->_getExpression(Array([type] => 61, [left] => Array([type] => 355, [name] => url_key), [right] => Array([type] => 260, [value] => de))) |
#17 | Phalcon\Mvc\Model\Query->_prepareSelect() |
#18 | Phalcon\Mvc\Model\Query->parse() |
#19 | Phalcon\Mvc\Model\Query->execute() |
#20 | Phalcon\Mvc\Model::findFirst(url_key = 'de')
/home/storefi1/public_html/app/backend/models/GlobalCountries.php (57) <?php
namespace Multiple\Backend\Models;
use Phalcon\Validation;
use Phalcon\Validation\Validator\Email as EmailValidator;
class GlobalCountries extends \Phalcon\Mvc\Model
{
public $id;
public $url_key;
public $hreflang;
public $language_name;
public $country_name;
public $active;
/**
* Validations and business logic
*
* @return boolean
*/
public function validation()
{
}
/**
* Initialize method for model.
*/
public function initialize()
{
//$this->setSchema("db_storefitting");
$this->setSource("global_countries");
$this->hasMany('id', 'Multiple\Backend\Models\ServiceProviderCountries', 'global_country_id', ['alias' => 'ServiceProviderCountries']);
$this->hasMany('id', 'Multiple\Backend\Models\ServiceProviders', 'global_country_id', ['alias' => 'ServiceProviders']);
$this->hasMany('id', 'Multiple\Backend\Models\ReferenceTranslations', 'global_country_id', ['alias' => 'ReferenceTranslations']);
$this->hasMany('id', 'Multiple\Backend\Models\ProductCategoryTranslations', 'global_country_id', ['alias' => 'ProductCategoryTranslations']);
$this->hasMany('id', 'Multiple\Backend\Models\SpecialisationTranslations', 'global_country_id', ['alias' => 'SpecialisationTranslations']);
$this->hasMany('id', 'Multiple\Backend\Models\SectionTranslations', 'global_country_id', ['alias' => 'SectionTranslations']);
$this->hasMany('id', 'Multiple\Backend\Models\NewsCategoryTranslations', 'global_country_id', ['alias' => 'NewsCategoryTranslations']);
}
public function getSource()
{
return 'global_countries';
}
public static function find($parameters = null)
{
return parent::find($parameters);
}
public static function findFirst($parameters = null)
{
return parent::findFirst($parameters);
}
/**
*
* returns all active countries:
*
*/
public function getActiveCountries(){
return \Multiple\Backend\Models\GlobalCountries::find( "active = 1 ORDER BY country_name ASC" );
}
public function getCountryNameById( $global_country_id ){
$instance = \Multiple\Backend\Models\GlobalCountries::findFirst( 'id = ' . $global_country_id );
return $instance->country_name;
}
}
|
#21 | Multiple\Backend\Models\GlobalCountries::findFirst(url_key = 'de')
/home/storefi1/public_html/app/frontend/controllers/BaseController.php (169) <?php
namespace Multiple\Frontend\Controllers;
use Phalcon\Mvc\Controller;
use Phalcon\Mvc\Dispatcher;
class BaseController extends Controller {
protected $trans = [];
public function initialize(){
//$this->assets->collection('headerCdn');
//->addJs($this->config->application->baseUri .'assets/js/jquery-3.3.1.min.js');
// ->addJs('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js');
##JS:
$minifyJSFileName = 'assets/js/cancarevic.js';
$this->assets->collection('footerCdnMinifiedBaseController')
->addJs('assets/plugins/jquery.lazy-master/jquery.lazy.min.js')
->addJs('assets/plugins/webslidemenu/webslidemenu.js')
->addJs('assets/plugins/cookieconsent/cookieconsent.js')
->addJs('assets/plugins/cookieconsent/cookieconsent-init.js');
#->setTargetPath($minifyJSFileName)
#->setTargetUri($minifyJSFileName)
#->addJs('assets/plugins/jquery.lazy-master/jquery.lazy.min.js')
#->setAttributes(array('defer' => 'defer'))
#->join(true)
#->addFilter(new \Phalcon\Assets\Filters\Jsmin());
## CSS:
## is directly included in header.phtml
// $minifyCSSFileName = 'assets/css/cancarevic.css';
//
// $this->assets->collection('cacnarevicCSS')
// ->setTargetPath($minifyCSSFileName)
// ->setTargetUri($minifyCSSFileName)
// ->addCss('assets/css/bootstrap.min.css')
// ->addCss('assets/css/mdb.min.css')
// ->addCss('assets/css/style.min.css')
// ->join(true)
// ->addFilter(new \Phalcon\Assets\Filters\Cssmin());
//echo $this->router->getControllerName() . ' ---- '.$this->router->getActionName();die;
##########################################
## Navigationslogik:
// Erstelle eine Instanz der CacheSqlQuery-Klasse
$modelsManager = $this->getDI()->getShared('modelsManager');
$queryCache = new \Multiple\Library\CacheSqlQuery($modelsManager);
// sELECT Jobs
$query = "SELECT *"
. " FROM \Multiple\Backend\Models\Jobs jobs "
. " LEFT JOIN \Multiple\Backend\Models\JobTranslations job_translations "
. " ON jobs.id = job_translations.job_id "
. " WHERE jobs.published = '1' "
. " AND jobs.published_date <= NOW() "
. " AND jobs.ended_date >= NOW() "
. " ORDER BY jobs.published_date DESC LIMIT 8";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$navigation_jobs = $queryCache->getQueryResult($query);
// Select latest posts
$query = "SELECT *"
. " FROM \Multiple\Backend\Models\News news "
. " LEFT JOIN \Multiple\Backend\Models\NewsTranslations news_translations "
. " ON news.id = news_translations.news_id "
. " WHERE news.active = '1' "
. " ORDER BY news.published_date DESC LIMIT 6";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$navigation_magazin_posts = $queryCache->getQueryResult($query);
// Select latest references
$query = "SELECT *"
. " FROM \Multiple\Backend\Models\References references "
. " LEFT JOIN \Multiple\Backend\Models\ReferenceTranslations reference_translations "
. " ON references.id = reference_translations.reference_id "
. " LEFT JOIN \Multiple\Backend\Models\ServiceProviders service_providers"
. " ON references.service_provider_id = service_providers.id "
. " WHERE references.active = '1' "
. " AND service_providers.active = '1' "
. " AND service_providers.deleted = '0' "
. " ORDER BY references.published_date DESC LIMIT 6";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$navigation_latest_references = $queryCache->getQueryResult($query);
$this->view->setVars(
[
'navigation_jobs' => $navigation_jobs,
'navigation_magazin_posts' => $navigation_magazin_posts,
'navigation_latest_references' => $navigation_latest_references,
]
);
#########################################
}
public function beforeExecuteRoute(Dispatcher $dispatcher){
/**
* Check Language
* language == $url_key in DB
*/
$language_url_key = $this->dispatcher->getParam("lang");
$default_language = $this->config->application->frontend->default_language_url_key;
$error = FALSE;
// Get language code
if( $language_url_key !== NULL ) {
$language_url_key = $this->dispatcher->getParam("lang");
} else {
$error = TRUE;
}
switch ($language_url_key) {
case 'de':
$language = 'de';
break;
case 'at':
$language = 'at';
break;
case 'chde':
$language = 'chde';
break;
default:
$language = 'de';
break;
}
$lang_file = $this->config->application->translationsDir . $language . ".php";
// Check if we have a translation file for that language
if(file_exists( $lang_file)) {
require $lang_file;
} else {
$error = TRUE;
}
if( $error ){
#print_r($lang_file);die;
$this->response->redirect($this->config->application->baseUri . $default_language);
//Change HTTP response code as per standards
$this->response->setStatusCode(301); //This is really optional
//Make sure that code below does not get executed when we redirect, the other way we get SLOW redirects
exit($this->response->send());
}
if (!$this->session->global_country['url_key'] || $this->session->global_country['url_key'] != $language ) {
$global_country = \Multiple\Backend\Models\GlobalCountries::findFirst("url_key = '".$language."'");
$this->session->set(
'global_country',
[
'id' => $global_country->id,
'url_key' => $global_country->url_key,
'hreflang' => $global_country->hreflang,
'language_name' => $global_country->language_name,
'country_name' => $global_country->country_name
]
);
}
// Return a translation object
$this->trans = new \Phalcon\Translate\Adapter\NativeArray(array(
"content" => $trans
));
$this->view->setVars(
[
'trans' => $this->trans
]
);
/**
* INIT global Sessions
* */
$this->_checkAndSetGlobalSession();
}
/**
*
* Saves all global needed information in session & locally in file
* */
private function _checkAndSetGlobalSession(){
$global_country_id = $this->session->get('global_country')['id'];
$global_country_url_key = $this->session->get('global_country')['url_key'];
##############################
## Sections: Gets all used sections in references:
#
# Define session name:
$session_global_sections= 'global_'.$global_country_url_key .'_sections';
# if Session not exist, create it
if ( !$this->session->has( $session_global_sections ) ) {
// Erstelle eine Instanz der CacheSqlQuery-Klasse
$modelsManager = $this->getDI()->getShared('modelsManager');
$queryCache = new \Multiple\Library\CacheSqlQuery($modelsManager);
// Definiere die SQL-Abfrage, die du cachen möchtest
$query = " SELECT references.section_id as section_id, sections.specialisation_id as specialisation_id, section_translations.name as name, section_translations.url_slug as url_slug "
. " FROM \Multiple\Backend\Models\References references "
. " LEFT JOIN \Multiple\Backend\Models\SectionTranslations section_translations "
. " ON references.section_id = section_translations.section_id "
. " LEFT JOIN \Multiple\Backend\Models\Sections sections"
. " on sections.id = references.section_id "
. " WHERE section_translations.global_country_id = '" . $global_country_id . "'"
. " Group by references.section_id order by section_translations.name ASC";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$result = $queryCache->getQueryResult($query)->toArray();
$this->session->set($session_global_sections, $result);
} # endif
##################################
##############################
## Specialisations:
# Show only specialisations with references
# Define session name:
$session_global_specialisations= 'global_'.$global_country_url_key .'_specialisations';
# if Session not exist, create it
if ( !$this->session->has( $session_global_specialisations ) ) {
// Erstelle eine Instanz der CacheSqlQuery-Klasse
$modelsManager = $this->getDI()->getShared('modelsManager');
$queryCache = new \Multiple\Library\CacheSqlQuery($modelsManager);
// Definiere die SQL-Abfrage, die du cachen möchtest
## Alle Sections auswählen, auch wenn es keine Referenzen gibt!
/* $query = " SELECT specialisation_id, name, url_slug "
. " FROM \Multiple\Backend\Models\SpecialisationTranslations specialisation_translations "
. " WHERE specialisation_translations.global_country_id = '" . $global_country_id . "'";
*/
## nur die SECTIONS auswählen, die Referenzne haben:
$query = " SELECT specialisation_translations.specialisation_id as specialisation_id, specialisation_translations.name as name, specialisation_translations.url_slug as url_slug "
. " FROM \Multiple\Backend\Models\References references "
. " LEFT JOIN \Multiple\Backend\Models\SpecialisationTranslations specialisation_translations "
. " ON references.specialisation_id = specialisation_translations.specialisation_id "
. " WHERE specialisation_translations.global_country_id = '" . $global_country_id . "'"
." GROUP BY specialisation_id";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$result = $queryCache->getQueryResult($query)->toArray();
$this->session->set( $session_global_specialisations,$result );
} # endif
##################################
##############################
## Services:
# Define session name:
$session_global_services= 'global_'.$global_country_url_key .'_services';
# if Session not exist, create it
if ( !$this->session->has( $session_global_services ) ) {
// Erstelle eine Instanz der CacheSqlQuery-Klasse
$modelsManager = $this->getDI()->getShared('modelsManager');
$queryCache = new \Multiple\Library\CacheSqlQuery($modelsManager);
// Definiere die SQL-Abfrage, die du cachen möchtest
$query = " SELECT reference_services.service_id as service_id, service_translations.url_slug as url_slug, service_translations.name as name , references.specialisation_id as specialisation_id "
. " FROM \Multiple\Backend\Models\ReferenceServices reference_services "
. " LEFT JOIN \Multiple\Backend\Models\ServiceTranslations service_translations "
. " ON service_translations.service_id = reference_services.service_id "
. " LEFT JOIN \Multiple\Backend\Models\References references "
. " ON references.id = reference_services.reference_id "
. " WHERE service_translations.global_country_id = '" . $global_country_id . "'"
. " GROUP by service_id order by name ASC ";
// Rufe das Ergebnis der Abfrage über den Query Cache ab
$result = $queryCache->getQueryResult($query)->toArray();
$this->session->set( $session_global_services ,$result );
} # endif
##################################
}
}
|
#22 | Multiple\Frontend\Controllers\BaseController->beforeExecuteRoute(Object(Phalcon\Mvc\Dispatcher)) |
#23 | Phalcon\Dispatcher->dispatch() |
#24 | Phalcon\Mvc\Application->handle()
/home/storefi1/public_html/public/index.php (54) <?php
//define('WP_USE_THEMES', false);
//require('../magazin/wp-load.php');
//require('../magazin/wp-blog-header.php');
?>
<?php
#phpinfo();die;
#print_r($_SERVER);die;
// report all errors
error_reporting(E_ALL);
ini_set('display_errors',TRUE);
ini_set('display_startup_errors', TRUE);
// convert warnings/notices to exceptions
set_error_handler(function($errno, $errstr, $errfile, $errline) {
throw new \Exception($errstr.PHP_EOL.$errfile.":".$errline, $errno);
});
try {
/**
* Read the configuration
*/
$config = include __DIR__ . "/../app/_config/config.php";
/**
* Read auto-loader
*/
include __DIR__ . "/../app/_config/loader.php";
/**
* Read services
*/
include __DIR__ . "/../app/_config/services.php";
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application($di);
// Register the installed modules
$application->registerModules([
'frontend' => [
'className' => 'Multiple\Frontend\Module',
'path' => '../app/frontend/Module.php'
],
'backend' => [
'className' => 'Multiple\Backend\Module',
'path' => '../app/backend/Module.php'
]
]);
echo $content_output = $application->handle()->getContent();
#echo minifier( $content_output );
} catch (\Exception $e) {
$message = get_class($e). ": ".$e->getMessage(). "\n"
. " File=". $e->getFile(). "\n"
. " Line=". $e->getLine(). "\n"
. $e->getTraceAsString() . "\n";
/* $logger = new \Phalcon\Logger\Adapter\File($config->application->logDir.'error.log');
$logger->error($message);*/
echo $message;
##########################
##### Debug deaktivieren on live:
$debug = new \Phalcon\Debug();
die($debug->listen()->onUncaughtException($e));
}
function minifier($code) {
// Definiert reguläre Ausdrücke zum Entfernen von Leerzeichen und Kommentaren im HTML-Code
$html_search = [
'/>\s+/', // Whitespace nach Schließ-Tags entfernen
'/\s+</', // Whitespace vor Öffnungs-Tags entfernen
'/(\s)+/s', // Aufeinanderfolgende Whitespace-Sequenzen durch ein Leerzeichen ersetzen
'/<!--(.|\s)*?-->/' // HTML-Kommentare entfernen
];
// Ersetzungen für den HTML-Code
$html_replace = [
'>',
'<',
' ',
''
];
// Führt die Minifizierung für den HTML-Code durch
$code = preg_replace($html_search, $html_replace, $code);
return $code;
} |