Fixes
All checks were successful
Gitea Actions / Run-Tests-On-Amd64 (push) Successful in 13m11s
Gitea Actions / Run-Tests-On-Arm64 (push) Successful in 5m10s

This commit is contained in:
Thomas 2025-03-05 18:56:27 +01:00
parent 0715914ac4
commit 15a0c5cadb
4 changed files with 120 additions and 120 deletions

View File

@ -12,10 +12,12 @@ services:
volumes:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
web:
environment:
- APP_ENV=dev
volumes:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
php-fpm:
environment:
- APP_ENV=dev
volumes:
- ${APP_CODE_PATH_HOST?}:${APP_CODE_PATH_CONTAINER?}
environment:
- APP_ENV=test

Binary file not shown.

View File

@ -1500,7 +1500,7 @@ CREATE TABLE `credit_system` (
LOCK TABLES `credit_system` WRITE;
/*!40000 ALTER TABLE `credit_system` DISABLE KEYS */;
INSERT INTO `credit_system` VALUES (1,1,1,'2015-03-18 11:30:30','2015-03-18 14:33:45','Sonderaktion - Neueröffnung unseres Shops',100,NULL,'2015-03-01','2015-05-31',0,5.45,0,'0','','0',1,1,1,1,1),(2,3,NULL,'2023-10-11 14:41:44','2024-05-31 17:32:44','100euro',1,1,'2023-10-11','2024-10-11',0,100,1,NULL,'hddecal-1',NULL,1,1,1,0,0),(4,3,NULL,'2024-03-26 10:24:14','2024-04-02 09:42:16','earlybird24',1,1,'2024-02-26','2024-04-26',1,10,1,NULL,'earlybird24',NULL,1,0,0,1,1),(5,3,NULL,'2024-05-31 17:14:03','2024-05-31 17:14:03','Neuer Gutschein',1,1,'2024-05-27','2024-06-26',1,100,1,NULL,'dashboard_quick_press_last_post_id',NULL,1,1,1,1,1),(6,3,NULL,'2024-05-31 18:07:08','2024-05-31 18:07:24','Göhre 15% Backup',1,1,'2024-05-31','2024-08-31',1,15,1,NULL,'goehre15-2',NULL,1,0,0,0,0);
INSERT INTO `credit_system` VALUES (1,1,1,'2015-03-18 11:30:30','2015-03-18 14:33:45','Sonderaktion - Neueröffnung unseres Shops',100,NULL,'2015-03-01','2015-05-31',0,5.45,0,'0','','0',1,1,1,1,1,0),(2,3,NULL,'2023-10-11 14:41:44','2024-05-31 17:32:44','100euro',1,1,'2023-10-11','2024-10-11',0,100,1,NULL,'hddecal-1',NULL,1,1,1,0,0,0),(4,3,NULL,'2024-03-26 10:24:14','2024-04-02 09:42:16','earlybird24',1,1,'2024-02-26','2024-04-26',1,10,1,NULL,'earlybird24',NULL,1,0,0,1,1,0),(5,3,NULL,'2024-05-31 17:14:03','2024-05-31 17:14:03','Neuer Gutschein',1,1,'2024-05-27','2024-06-26',1,100,1,NULL,'dashboard_quick_press_last_post_id',NULL,1,1,1,1,1,0),(6,3,NULL,'2024-05-31 18:07:08','2024-05-31 18:07:24','Göhre 15% Backup',1,1,'2024-05-31','2024-08-31',1,15,1,NULL,'goehre15-2',NULL,1,0,0,0,0,0);
/*!40000 ALTER TABLE `credit_system` ENABLE KEYS */;
UNLOCK TABLES;

View File

@ -1,7 +1,7 @@
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected $shop_id = 0;
protected Shop $shop;
@ -21,12 +21,13 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$autoloader->registerNamespace('EasyBib_');
include_once 'Doctrine.php';
$autoloader->pushAutoloader(
array (
array(
'Doctrine',
'autoload'), 'Doctrine'
'autoload'),
'Doctrine'
);
$autoloaderModule = new Zend_Application_Module_Autoloader(
array (
array(
'namespace' => 'Admin',
'basePath' => APPLICATION_PATH . '/modules/admin')
);
@ -38,13 +39,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initDb()
{
try
{
try {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/database.ini', APPLICATION_ENV);
/**
* @see Zend_Db
*/
$servers = array (
$servers = array(
'host' => 'localhost',
'port' => 11211,
'persistent' => true);
@ -54,12 +54,22 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
)
);*/
$cacheDriver = new Doctrine_Cache_Array();
if (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'test') {
$dsn = 'mysql:dbname=psc_test;host=mysql';
$user = 'psc';
$password = 'psc';
} elseif (isset($_ENV['APP_ENV']) && $_ENV['APP_ENV'] == 'dev') {
$dsn = 'mysql:dbname=psc;host=mysql';
$user = 'psc';
$password = 'psc';
} else {
$dsn = 'mysql:dbname=psc;host=mysql';
$user = 'root';
$password = 'Wichtig1';
}
if ((isset($_REQUEST['ARTID']) || isset($_REQUEST['artid']) || isset($_POST['ARTID'])) && (strpos($_SERVER['REQUEST_URI'], 'upload') !== false || strpos($_SERVER['REQUEST_URI'], 'template') !== false || strpos($_SERVER['REQUEST_URI'], 'basket') !== false || strpos($_SERVER['REQUEST_URI'], 'article') !== false) ) {
if(strlen($_REQUEST['ARTID']) > 100) {
if ((isset($_REQUEST['ARTID']) || isset($_REQUEST['artid']) || isset($_POST['ARTID'])) && (strpos($_SERVER['REQUEST_URI'], 'upload') !== false || strpos($_SERVER['REQUEST_URI'], 'template') !== false || strpos($_SERVER['REQUEST_URI'], 'basket') !== false || strpos($_SERVER['REQUEST_URI'], 'article') !== false)) {
if (strlen($_REQUEST['ARTID']) > 100) {
$values = TP_Crypt::decrypt($_REQUEST['ARTID']);
$_SERVER["SERVER_NAME"] = str_replace(array("http://", "https://"), array("", ""), $values['SERVER']);
@ -80,16 +90,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
* Configure Doctrine
*/
Zend_Registry::set(
'doctrine_config', array (
'doctrine_config',
array(
'data_fixtures_path' => dirname(__FILE__) . '/doctrine/data/fixtures',
'models_path' => dirname(__FILE__) . '/models',
'migrations_path' => dirname(__FILE__) . '/doctrine/migrations',
'sql_path' => dirname(__FILE__) . '/doctrine/data/sql',
'yaml_schema_path' => dirname(__FILE__) . '/doctrine/schema')
);
}
catch ( Exception $e )
{
} catch (Exception $e) {
die($e->getMessage());
}
}
@ -101,25 +110,20 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$logger->addPriority('TABLE', 8);
Zend_Registry::set('log', $logger);
ini_set('error_log', APPLICATION_PATH . '/../logs/php.error.log');
if ((isset($_REQUEST['ARTID']) || isset($_REQUEST['artid']) || isset($_POST['ARTID'])) && (strpos($_SERVER['REQUEST_URI'], 'upload') !== false || strpos($_SERVER['REQUEST_URI'], 'template') !== false || strpos($_SERVER['REQUEST_URI'], 'basket') !== false || strpos($_SERVER['REQUEST_URI'], 'overview') !== false || strpos($_SERVER['REQUEST_URI'], 'steplayouter') !== false || strpos($_SERVER['REQUEST_URI'], 'article') !== false) ) {
if(strlen($_REQUEST['ARTID']) > 100) {
if ((isset($_REQUEST['ARTID']) || isset($_REQUEST['artid']) || isset($_POST['ARTID'])) && (strpos($_SERVER['REQUEST_URI'], 'upload') !== false || strpos($_SERVER['REQUEST_URI'], 'template') !== false || strpos($_SERVER['REQUEST_URI'], 'basket') !== false || strpos($_SERVER['REQUEST_URI'], 'overview') !== false || strpos($_SERVER['REQUEST_URI'], 'steplayouter') !== false || strpos($_SERVER['REQUEST_URI'], 'article') !== false)) {
if (strlen($_REQUEST['ARTID']) > 100) {
$values = TP_Crypt::decrypt($_REQUEST['ARTID']);
Zend_Session::setId($values['ARTID']);
}else{
if (isset($_POST['ARTID']) ) {
} else {
if (isset($_POST['ARTID'])) {
Zend_Registry::get('log')->debug($_POST['ARTID']);
try
{
try {
Zend_Session::setId($_POST['ARTID']);
}
catch ( Exception $e )
{
} catch (Exception $e) {
Zend_Registry::get('log')->debug($e->getMessage());
}
}
else
{
} else {
Zend_Session::setId($_REQUEST['ARTID']);
}
}
@ -133,23 +137,22 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
}
protected function _initCli()
{
if (strrpos(strtolower(PHP_SAPI), 'cli') !== false && APPLICATION_ENV != 'testing' ) {
if (strrpos(strtolower(PHP_SAPI), 'cli') !== false && APPLICATION_ENV != 'testing') {
$this->bootstrap('frontController');
$this->frontController->setRouter(new TP_Controller_Router_Cli())->setRequest(new TP_Controller_Request_Cli())->setResponse(new TP_Controller_Response_Cli());
}
}
protected function _initLayout()
{
try
{
if($_SERVER["SERVER_NAME"] == "" && isset($_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != "") {
try {
if ($_SERVER["SERVER_NAME"] == "" && isset($_SERVER["HTTP_HOST"]) && $_SERVER["HTTP_HOST"] != "") {
$_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"];
}
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/layout.ini', APPLICATION_ENV, true);
$row = Doctrine_Query::create()->from('Domain m')->where('m.name = ?', $_SERVER["SERVER_NAME"])->fetchOne();
if ($row === false ) {
if ($row === false) {
$shop = Doctrine_Query::create()->from('Shop s')->fetchOne();
}else{
} else {
$shop = $row->Shop;
}
$this->shop = $shop;
@ -159,7 +162,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
die();
}
if($shop->deleted == true) {
if ($shop->deleted == true) {
die(
'<html>
<head><title>' . $shop->name . ' ist geschlossen</title></head>
@ -176,22 +179,23 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$config->shopPath = APPLICATION_PATH . '/' . str_replace('%SHOPID%', $shop->uid, $config->shopPath);
$this->shop_id = $shop->uid;
if ($shop->customtemplates == 1 ) {
if ($shop->customtemplates == 1) {
$config->layoutPath = APPLICATION_PATH . '/design/vorlagen/' . $shop->layout;
}elseif($shop->template_switch && Zend_Auth::getInstance()->hasIdentity()) {
} elseif ($shop->template_switch && Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
$accountPath = $this->getAccountTemplatePath($user['account_id']);
if($accountPath != "") {
if ($accountPath != "") {
$config->layoutPath = APPLICATION_PATH . '/' . str_replace('%LAYOUT%', $accountPath, $config->layoutPath);
}else{
} else {
$config->layoutPath = APPLICATION_PATH . '/' . str_replace('%LAYOUT%', $shop->layout, $config->layoutPath);
}
} else {
if(!file_exists(APPLICATION_PATH . str_replace('%LAYOUT%', "", $config->layoutPath))) { mkdir(APPLICATION_PATH . str_replace('%LAYOUT%', "", $config->layoutPath));
if (!file_exists(APPLICATION_PATH . str_replace('%LAYOUT%', "", $config->layoutPath))) {
mkdir(APPLICATION_PATH . str_replace('%LAYOUT%', "", $config->layoutPath));
}
if(strpos('_'.$shop->layout, "/")) {
if (strpos('_'.$shop->layout, "/")) {
$config->layoutPath = APPLICATION_PATH . str_replace('%LAYOUT%', "", $config->layoutPath) . $shop->layout;
}else{
} else {
$config->layoutPath = APPLICATION_PATH . '/' . str_replace('%LAYOUT%', $shop->layout, $config->layoutPath);
}
}
@ -205,57 +209,52 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
include_once 'Zend/Layout.php';
Zend_Layout::startMvc($config);
if (isset($_GET['no_cache']) ) {
if (isset($_GET['no_cache'])) {
TP_Util::clearCache(TP_Util::CLEAR_ALL);
}
}
catch ( Exception $e )
{
} catch (Exception $e) {
var_dump($e->getTraceAsString());
die(var_dump($e));
}
}
protected function _initLanguage()
{
try
{
try {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/printshopcreator.ini', APPLICATION_ENV, true);
Zend_Registry::set('marketid', $config->marketid);
if (isset($_REQUEST['ticketid']) && strpos($_SERVER['REQUEST_URI'], 'service/upload') !== false ) {
if (isset($_REQUEST['ticketid']) && strpos($_SERVER['REQUEST_URI'], 'service/upload') !== false) {
Zend_Session::setId($_REQUEST['ticketid']);
}
if (isset($_REQUEST['chunkid']) && strpos($_SERVER['REQUEST_URI'], 'service/upload') !== false ) {
if (isset($_REQUEST['chunkid']) && strpos($_SERVER['REQUEST_URI'], 'service/upload') !== false) {
Zend_Session::setId($_REQUEST['chunkid']);
}
include_once 'Zend/Locale.php';
if (isset($_REQUEST['speak']) ) {
if (isset($_REQUEST['speak'])) {
$langsess = new Zend_Session_Namespace('lang');
$langsess->code = $_REQUEST['speak'];
}
if (Zend_Auth::getInstance()->hasIdentity() && ! Zend_Session::namespaceIsset('lang') ) {
if (Zend_Auth::getInstance()->hasIdentity() && ! Zend_Session::namespaceIsset('lang')) {
$user = Zend_Auth::getInstance()->getIdentity();
if($user['language']) {
if ($user['language']) {
$locale = new Zend_Locale($user['language']);
}else{
} else {
$locale = new Zend_Locale('de_DE');
}
}
elseif (Zend_Session::namespaceIsset('lang') ) {
} elseif (Zend_Session::namespaceIsset('lang')) {
$lang = new Zend_Session_Namespace('lang');
$locale = new Zend_Locale($lang->code);
}
else
{
} else {
$locale = new Zend_Locale($this->shop->getDefaultLocale());
}
if(!file_exists(APPLICATION_PATH . '/../cache/'.$this->shop_id.'/')) { mkdir(APPLICATION_PATH . '/../cache/'.$this->shop_id.'/');
if (!file_exists(APPLICATION_PATH . '/../cache/'.$this->shop_id.'/')) {
mkdir(APPLICATION_PATH . '/../cache/'.$this->shop_id.'/');
}
$frontendOptions = array (
$frontendOptions = array(
'lifetime' => 14000, // Lebensdauer des Caches 2 Stunden
'automatic_serialization' => true);
$backendOptions = array (
$backendOptions = array(
'cache_dir' => APPLICATION_PATH . '/../cache/'.$this->shop_id.'/')// Verzeichnis, in welches die Cache Dateien kommen
;
/*$backendOptions = array('host' => 'localhost',
@ -267,14 +266,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
'status' => true,
'failure_callback' => '');*/
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, array ());
$cache = Zend_Cache::factory('Core', 'File', $frontendOptions, array());
$fcache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions);
$locale->setCache($cache);
Zend_Registry::set('locale', $locale);
Zend_Translate::setCache($fcache);
$translate = new Zend_Translate(
'TP_Translate_Adapter_Frontend_Db', APPLICATION_PATH . '/locale', $locale, array (
'TP_Translate_Adapter_Frontend_Db',
APPLICATION_PATH . '/locale',
$locale,
array(
'scan' => Zend_Translate::LOCALE_DIRECTORY)
);
@ -287,18 +289,15 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
Zend_Registry::set('cache', $cache);
Zend_Registry::set('filecache', $fcache);
Zend_Form::setDefaultTranslator($translate);
}
catch ( Exception $e )
{
} catch (Exception $e) {
die($e->getMessage());
}
}
protected function _initArticleQueues()
{
$articles = array ();
foreach ( new DirectoryIterator(APPLICATION_PATH . '/articles') as $file )
{
if ($file == '.' || $file == '..' || $file == '.svn' || $file == '.DS_Store' ) {
$articles = array();
foreach (new DirectoryIterator(APPLICATION_PATH . '/articles') as $file) {
if ($file == '.' || $file == '..' || $file == '.svn' || $file == '.DS_Store') {
continue;
}
include_once APPLICATION_PATH . '/articles/' . $file->getFilename() . '/Article.php';
@ -306,10 +305,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$articles[$article->id] = $file->getFilename() . '_Article';
}
Zend_Registry::set('articles', $articles);
$queues = array ();
foreach ( new DirectoryIterator(APPLICATION_PATH . '/queues') as $file )
{
if ($file == '.' || $file == '..' || $file == '.svn' || $file == '.DS_Store' ) {
$queues = array();
foreach (new DirectoryIterator(APPLICATION_PATH . '/queues') as $file) {
if ($file == '.' || $file == '..' || $file == '.svn' || $file == '.DS_Store') {
continue;
}
include_once APPLICATION_PATH . '/queues/' . $file->getFilename() . '/Queues.php';
@ -325,7 +323,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$front = $this->getResource('FrontController');
$auth = Zend_Auth::getInstance();
$cache = Zend_Registry::get('cache');
if (! ($acl = $cache->load('acl')) ) {
if (! ($acl = $cache->load('acl'))) {
$acl = new TP_Plugin_Acl($auth);
$cache->save($acl);
}
@ -333,7 +331,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$cache->save($acl);
$front->registerPlugin(
new Zend_Controller_Plugin_ErrorHandler(
array (
array(
'module' => 'default',
'controller' => 'error',
'action' => 'error')
@ -346,10 +344,10 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function getAccountTemplatePath($account_id)
{
$account = Doctrine_Query::create()->from('Account c')->where('c.id = ?', array($account_id))->fetchOne();
if($account['template_switch'] != "") {
if ($account['template_switch'] != "") {
return $account['template_switch'];
}
if($account['filiale_id'] != "" && $account['filiale_id'] != 0) {
if ($account['filiale_id'] != "" && $account['filiale_id'] != 0) {
return $this->getAccountTemplatePath($account['filiale_id']);
}
return "";
@ -365,9 +363,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$dbMongo = TP_Mongo::getInstance();
$objs = $dbMongo->Route->find(array('shop' => (string)$shop['uid']));
foreach($objs as $obj) {
foreach ($objs as $obj) {
if($obj->controller == 2) {
if ($obj->controller == 2) {
$route = new Zend_Controller_Router_Route(
$obj->url,
array_merge(
@ -382,7 +380,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$router->addRoute((string)$obj->_id, $route);
}
if($obj->controller == 1) {
if ($obj->controller == 1) {
$route = new Zend_Controller_Router_Route(
$obj->url,
array_merge(
@ -397,7 +395,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$router->addRoute((string)$obj->_id, $route);
}
if($obj->controller == 3) {
if ($obj->controller == 3) {
$route = new Zend_Controller_Router_Route(
$obj->url,
array_merge(
@ -412,8 +410,8 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$router->addRoute((string)$obj->_id, $route);
}
if($obj->controller == 4) {
if(strpos($obj->url, 'basket') !== false) {
if ($obj->controller == 4) {
if (strpos($obj->url, 'basket') !== false) {
$basketUrl = explode("/", $obj->url);
@ -423,12 +421,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
[
'module' => 'default',
'controller' => 'basket',
'action' => $basketUrl[2]?$basketUrl[2]:'index',
'action' => $basketUrl[2] ? $basketUrl[2] : 'index',
]
)
);
$router->addRoute((string)$obj->_id, $route);
}elseif(strpos($obj->url, 'user') !== false) {
} elseif (strpos($obj->url, 'user') !== false) {
$basketUrl = explode("/", $obj->url);
$route = new Zend_Controller_Router_Route(
$obj->parameter->getArrayCopy()['target'],
@ -436,7 +434,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
[
'module' => 'default',
'controller' => 'user',
'action' => $basketUrl[2]?$basketUrl[2]:'index',
'action' => $basketUrl[2] ? $basketUrl[2] : 'index',
]
)
);
@ -453,7 +451,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
)
);
$router->addRoute((string)$obj->_id.'_route', $route);
}elseif(strpos($obj->url, 'impress') !== false) {
} elseif (strpos($obj->url, 'impress') !== false) {
$route = new Zend_Controller_Router_Route(
$obj->parameter->getArrayCopy()['target'],
array_merge(
@ -465,7 +463,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
)
);
$router->addRoute((string)$obj->_id, $route);
}elseif(strpos($obj->url, 'privacy') !== false) {
} elseif (strpos($obj->url, 'privacy') !== false) {
$route = new Zend_Controller_Router_Route(
$obj->parameter->getArrayCopy()['target'],
array_merge(
@ -477,7 +475,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
)
);
$router->addRoute((string)$obj->_id, $route);
}elseif(strpos($obj->url, 'agb') !== false) {
} elseif (strpos($obj->url, 'agb') !== false) {
$route = new Zend_Controller_Router_Route(
$obj->parameter->getArrayCopy()['target'],
array_merge(
@ -489,7 +487,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
)
);
$router->addRoute((string)$obj->_id, $route);
}else{
} else {
$route = new Zend_Controller_Router_Route(
$obj->url,
array_merge(