Merge remote-tracking branch 'upstream/master' into sendcloud

This commit is contained in:
Andreas Palm
2023-01-29 23:37:48 +01:00
78 changed files with 126995 additions and 23607 deletions
+124 -5
View File
@@ -197,7 +197,7 @@ class Acl
break;
case 'dateien':
$sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s";
$sql = "SELECT objekt FROM datei_stichwoerter WHERE datei = %s LIMIT 1";
$dateiModul = strtolower($this->app->DB->Select(sprintf($sql,$id)));
//TODO datei_stichwoerter.objekt ist nicht zuverlässig für alle Datentypen. Deswegen nur zur Absicherung der bekannten Fälle #604706
@@ -570,10 +570,23 @@ class Acl
public function Login()
{
$this->app->Tpl->Set('LOGINWARNING', 'display:none;visibility:hidden;');
if($this->IsInLoginLockMode() === true){
$this->app->Tpl->Set('LOGINWARNING', '');
return;
$this->refresh_githash();
include dirname(__DIR__).'/../version.php';
$this->app->Tpl->Set('XENTRALVERSION',"V.".$version_revision);
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', 'hidden');
$result = $this->CheckHtaccess();
if ($result !== true) {
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', '');
$this->app->Tpl->Set('LOGINWARNING_TEXT', "Achtung: Zugriffskonfiguration (htaccess) fehlerhaft. Bitte wenden Sie sich an Ihren an Ihren Administrator. <br>($result)");
}
if($this->IsInLoginLockMode() === true)
{
$this->app->Tpl->Set('LOGINWARNING_VISIBLE', '');
$this->app->Tpl->Set('LOGINWARNING_TEXT', 'Achtung: Es werden gerade Wartungsarbeiten in Ihrem System (z.B. Update oder Backup) durch Ihre IT-Abteilung durchgeführt. Das System sollte in wenigen Minuten wieder erreichbar sein. Für Rückfragen wenden Sie sich bitte an Ihren Administrator.');
}
$multidbs = $this->app->getDbs();
@@ -1206,4 +1219,110 @@ class Acl
}
// HTACCESS SECURITY
// Check for correct .htaccess settings
// true if ok, else error text
protected function CheckHtaccess() {
$nominal = array('
# Generated file from class.acl.php
# For detection of htaccess functionality
SetEnv OPENXE_HTACCESS on
# Disable directory browsing
Options -Indexes
# Set default page to index.php
DirectoryIndex "index.php"
# Deny general access
Order deny,allow
<FilesMatch ".">
Order Allow,Deny
Deny from all
</FilesMatch>
# Allow index.php
<Files "index.php">
Order Allow,Deny
Allow from all
</Files>
# end
',
'
# Generated file from class.acl.php
# Disable directory browsing
Options -Indexes
# Deny access to all *.php
Order deny,allow
Allow from all
<FilesMatch "\.(css|jpg|jpeg|gif|png|svg|js)$">
Order Allow,Deny
Allow from all
</FilesMatch>
# Allow access to index.php
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
# Allow access to setup.php
<Files setup.php>
Order Allow,Deny
Allow from all
</Files>
# Allow access to inline PDF viewer
<Files viewer.html>
Order Allow,Deny
Allow from all
</Files>
# end
');
$script_file_name = $_SERVER['SCRIPT_FILENAME'];
$htaccess_path = array(
dirname(dirname($script_file_name))."/.htaccess", // root
dirname($script_file_name)."/.htaccess"); // www
for ($count = 0;$count < 2;$count++) {
$htaccess = file_get_contents($htaccess_path[$count]);
if ($htaccess === false) {
$missing = true;
} else {
$htaccess = trim($htaccess);
}
$htaccess_nominal = trim($nominal[$count]);
$result = strcmp($htaccess,$htaccess_nominal);
if ($htaccess === false) {
return($htaccess_path[$count]." nicht vorhanden.");
}
if ($result !== 0) {
return($htaccess_path[$count]." fehlerhaft.");
}
}
if (!isset($_SERVER['OPENXE_HTACCESS'])) {
return("htaccess nicht aktiv.");
}
return(true);
// HTACCESS SECURITY END
}
function refresh_githash() {
$path = '../.git/';
if (!is_dir($path)) {
return;
}
$head = trim(file_get_contents($path . 'HEAD'));
$refs = trim(substr($head,0,4));
if ($refs == 'ref:') {
$ref = substr($head,5);
$hash = trim(file_get_contents($path . $ref));
} else {
$hash = $head;
}
if (!empty($hash)) {
file_put_contents("../githash.txt", $hash);
}
}
}
-726
View File
@@ -1,726 +0,0 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
final class DatabaseUpgrade
{
/** @var Application $app */
private $app;
/** @var array $CheckColumnTableCache */
private $CheckColumnTableCache;
/** @var bool $check_column_missing_run */
private $check_column_missing_run=false;
/** @var array $check_column_missing */
private $check_column_missing=array();
/** @var array $check_index_missing */
private $check_index_missing=array();
/** @var array */
private $allTables = [];
/** @var array */
private $indexe = [];
/**
* @param Application $app
*/
public function __construct($app)
{
$this->app = $app;
}
public function emptyTableCache(){
$this->CheckColumnTableCache = [];
$this->allTables = [];
$this->indexe = [];
}
/**
* @var bool $force
*
* @return array
*/
public function getAllTables($force = false)
{
if($force || empty($this->allTables)) {
$this->allTables = $this->app->DB->SelectFirstCols('SHOW TABLES');
}
return $this->allTables;
}
/**
* @param string $table
* @param string $pk
*/
public function createTable($table, $pk = 'id')
{
$sql = "CREATE TABLE `$table` (`".$pk."` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`".$pk."`)) ENGINE = InnoDB DEFAULT CHARSET=utf8";
$this->app->DB->Query($sql);
$this->addPrimary($table, $pk);
}
/**
* @param string $table
* @param string $pk
*/
public function addPrimary($table, $pk = 'id')
{
$this->CheckAlterTable(
"ALTER TABLE `$table`
ADD PRIMARY KEY (`".$pk."`)",
true
);
$this->CheckAlterTable(
"ALTER TABLE `$table`
MODIFY `".$pk."` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1",
true
);
}
/**
* @param string $table
* @param bool $force
*
* @return array
*/
public function getIndexeCached($table, $force = false)
{
if($force || !isset($this->indexe[$table])){
$this->indexe[$table] = $this->app->DB->SelectArr(sprintf('SHOW INDEX FROM `%s`', $table));
if($this->indexe[$table] === null) {
$this->indexe[$table] = [];
}
}
return $this->indexe[$table];
}
/**
* @param string $table
*/
public function clearIndexCached($table)
{
if(!isset($this->indexe[$table])) {
return;
}
unset($this->indexe[$table]);
}
/**
* @param string $table
* @param string $pk
*/
public function hasPrimaryKey($table, $pk = 'id')
{
$indexe = $this->getIndexeCached($table);
if(empty($indexe)) {
return false;
}
foreach($indexe as $index) {
if($index['Column_name'] === $pk
&& $index['Key_name'] === 'PRIMARY'
&& (int)$index['Non_unique'] === 0
) {
return true;
}
}
return false;
}
/**
* @param string $table
* @param string $pk
*
* @return void
*/
function CheckTable($table, $pk = 'id')
{
if($pk === 'id') {
$tables = $this->getAllTables();
if(!empty($tables)){
if(!in_array($table, $tables)){
$this->createTable($table, $pk);
return;
}
if(!$this->hasPrimaryKey($table, $pk)) {
$this->addPrimary($table, $pk);
}
return;
}
}
$found = false;
$tables = $this->getAllTables(true);
if($tables) {
$found = in_array($table, $tables);
}
else{
$check = $this->app->DB->Select("SELECT $pk FROM `$table` LIMIT 1");
if($check) {
$found = true;
}
}
if($found==false)
{
$sql = "CREATE TABLE `$table` (`".$pk."` INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`".$pk."`)) ENGINE = InnoDB DEFAULT CHARSET=utf8";
$this->app->DB->Update($sql);
$this->CheckAlterTable("ALTER TABLE `$table`
ADD PRIMARY KEY (`".$pk."`)");
$this->CheckAlterTable("ALTER TABLE `$table`
MODIFY `".$pk."` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=1");
}
if($pk !== 'id') {
$this->CheckColumn('created_at','timestamp',$table,"DEFAULT CURRENT_TIMESTAMP NOT NULL");
}
}
/**
* @param string $column
* @param string $type
* @param string $table
* @param string $default
*
* @return void
*/
function UpdateColumn($column,$type,$table,$default="NOT NULL")
{
$fields = $this->app->DB->SelectArr("show columns from `".$table."`");
if($fields)
{
foreach($fields as $val)
{
$field_array[] = $val['Field'];
}
}
if (in_array($column, $field_array))
{
$this->app->DB->Query('ALTER TABLE `'.$table.'` CHANGE `'.$column.'` `'.$column.'` '.$type.' '.$default.';');
}
}
/**
* @param string $column
* @param string $table
*
* @return void
*/
public function DeleteColumn($column,$table)
{
$this->app->DB->Query('ALTER TABLE `'.$table.'` DROP `'.$column.'`;');
}
/**
* @param string $column
* @param string $type
* @param string $table
* @param string $default
*
* @return void
*/
public function CheckColumn($column,$type,$table,$default="")
{
if($table === 'firmendaten')
{
if($this->app->DB->Select("SELECT `id` FROM `firmendaten_werte` WHERE `name` = '$column' LIMIT 1"))return;
}
if(!isset($this->CheckColumnTableCache[$table]))
{
$tmp=$this->app->DB->SelectArr("show columns from `".$table."`");
if($tmp)
{
foreach($tmp as $val)
{
$this->CheckColumnTableCache[$table][] = $val['Field'];
//$types[$val['Field']] = strtolower($val['Type']);
}
}
}
if (isset($this->CheckColumnTableCache[$table]) && !in_array($column, $this->CheckColumnTableCache[$table]))
{
if($this->check_column_missing_run)
{
//$result = mysqli_query($this->app->DB->connection,'ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
$this->check_column_missing[$table][]=$column;
} else {
$result = $this->app->DB->Query('ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
if($table === 'firmendaten' && $this->app->DB->error())
{
if((method_exists($this->app->DB, 'errno2') && $this->app->DB->errno() == '1118')
|| strpos($this->app->DB->error(),'Row size too large') !== false
)
{
$this->ChangeFirmendatenToMyIsam();
$this->app->DB->Query('ALTER TABLE `'.$table.'` ADD `'.$column.'` '.$type.' '.$default.';');
}
}
}
}
}
/**
* @param array $indexe
*
* @return array
*/
protected function getGroupedIndexe($indexe)
{
if(empty($indexe)) {
return $indexe;
}
$return = [];
foreach($indexe as $index) {
$keyName = $index['Key_name'];
$isUnique = $index['Non_unique'] == '0';
$seq = $index['Seq_in_index'];
$columnName = $index['Column_name'];
$return[$isUnique?'unique':'index'][$keyName][(int)$seq - 1] = $columnName;
}
return $return;
}
/**
* @param array $indexe
*
* @return array
*/
protected function getDoubleIndexeFromGroupedIndexe($indexe)
{
if(empty($indexe)) {
return [];
}
$ret = [];
foreach($indexe as $type => $indexArrs) {
$columnStrings = [];
foreach($indexArrs as $indexKey => $columns) {
$columnString = implode('|', $columns);
if(in_array($columnString, $columnStrings)) {
$ret[$type][] = $indexKey;
continue;
}
$columnStrings[] = $columnString;
}
}
return $ret;
}
/**
* @param string $table
* @param array $indexe
* @param bool $noCache
*
* @return array|null
*/
public function CheckDoubleIndex($table, $indexe, $noCache = false)
{
$query = $noCache?null:$this->CheckAlterTable("SHOW INDEX FROM `$table`");
if(!$query) {
$indexeGrouped = $this->getGroupedIndexe($indexe);
$doubleIndexe = $this->getDoubleIndexeFromGroupedIndexe($indexeGrouped);
if(!empty($doubleIndexe)) {
$indexe = $this->getIndexeCached($table, true);
$indexeGrouped = $this->getGroupedIndexe($indexe);
$doubleIndexe = $this->getDoubleIndexeFromGroupedIndexe($indexeGrouped);
if(empty($doubleIndexe)) {
return $indexe;
}
foreach($doubleIndexe as $type => $doubleIndex) {
foreach($doubleIndex as $indexName) {
$this->app->DB->Query("ALTER TABLE `".$table."` DROP INDEX `".$indexName."`");
}
}
}
elseif($noCache) {
return $indexe;
}
$this->CheckAlterTable("SHOW INDEX FROM `$table`", true);
return $this->getIndexeCached($table, true);
}
if(empty($indexe) || count($indexe) == 1){
return $indexe;
}
$uniquearr = array();
$indexarr = array();
foreach($indexe as $index)
{
if($index['Key_name'] !== 'PRIMARY' && !empty($index['Column_name']))
{
if($index['Non_unique'])
{
$indexarr[$index['Key_name']][] = $index['Column_name'];
}else{
$uniquearr[$index['Key_name']][] = $index['Column_name'];
}
}
}
$cindex = count($indexarr);
$cuniqe = count($uniquearr);
$changed = false;
if($cindex > 1)
{
$check = array();
foreach($indexarr as $key => $value)
{
if(empty($value))
{
continue;
}
if(count($value) > 1){
sort($value);
}
$vstr = implode(',', $value);
if(in_array($vstr, $check))
{
$this->app->DB->Query("DROP INDEX `".$key."` ON `".$table."`");
$changed = true;
}else{
$check[] = $vstr;
}
}
}
if($cuniqe > 1)
{
$check = array();
foreach($uniquearr as $key => $value)
{
if(empty($value))
{
continue;
}
if(count($value) > 1){
sort($value);
}
$vstr = implode(',', $value);
if(in_array($vstr, $check))
{
$this->app->DB->Query("DROP UNIQUE `".$key."` ON `".$table."`");
$changed = true;
}else{
$check[] = $vstr;
}
}
}
if($changed) {
return $this->getIndexeCached($table, true);
}
return $indexe;
}
/**
* @param string $table
* @param string|array $column
*
* @return bool
*/
public function CheckFulltextIndex($table,$column)
{
if(empty($table) || empty($column))
{
return false;
}
if(!is_array($column))
{
$column = [$column];
}
$columnmasked = [];
foreach($column as $keyColumn => $valueColumn)
{
if(!empty($valueColumn))
{
$columnmasked[] = "`$valueColumn`";
}else{
unset($column[$keyColumn]);
}
}
if(empty($column))
{
return false;
}
$columnsFound = [];
$indexe = $this->getIndexeCached($table, true);
$indexeFound = [];
if(!empty($indexe))
{
foreach($indexe as $index)
{
if($index['Index_type'] === 'FULLTEXT')
{
$indexeFound[] = $index['Column_name'];
if(!in_array($index['Column_name'], $columnsFound))
{
$columnsFound[] = $index['Column_name'];
}
}
}
$cindexeFound = count($indexeFound);
$column = count($column);
if(($column === $cindexeFound) && (count($columnsFound) === $column))
{
return true;
}
if($cindexeFound > 0)
{
return false;
}
}
$this->app->DB->Query(
"ALTER TABLE `$table`
ADD FULLTEXT INDEX `FullText`
(".implode(',',$columnmasked).");"
);
$error = $this->app->DB->error();
return empty($error);
}
/**
* @param string $table
* @param string $column
* @param bool $unique
*
* @return void
*/
function CheckIndex($table, $column, $unique = false)
{
$indexex = null;
$indexexother = null;
$indexe = $this->getIndexeCached($table);
if($indexe)
{
$indexe = $this->CheckDoubleIndex($table, $indexe, true);
foreach($indexe as $index)
{
if(is_array($column) && $index['Key_name'] !== 'PRIMARY')
{
if($unique && !$index['Non_unique'])
{
if(in_array($index['Column_name'], $column))
{
$indexex[$index['Key_name']][$index['Column_name']] = true;
}else{
$indexexother[$index['Key_name']][$index['Column_name']] = true;
}
}
elseif(!$unique){
if(in_array($index['Column_name'], $column)) {
$indexex[$index['Key_name']][$index['Column_name']] = true;
}
}
}
elseif(!is_array($column)){
if($index['Column_name'] == $column)
{
return;
}
}
}
if($this->check_column_missing_run)
{
$this->check_index_missing[$table][] = $column;
}
if(!$unique)
{
if(is_array($column))
{
if($indexex)
{
foreach($indexex as $k => $v) {
if(count($v) === 1 && count($column) > 1) {
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
$this->clearIndexCached($table);
unset($indexex[$k]);
}
}
foreach($indexex as $k => $v)
{
if(count($v) == count($column)){
return;
}
}
foreach($indexex as $k => $v)
{
if(!isset($indexexother[$k]))
{
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
$cols = null;
foreach($column as $c) {
$cols[] = "`$c`";
}
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(".implode(', ',$cols)."); ",true);
$this->clearIndexCached($table);
return;
}
}
}
$cols = null;
foreach($column as $c) {
$cols[] = "`$c`";
}
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(".implode(', ',$cols)."); ", true);
$this->clearIndexCached($table);
}
else{
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(`$column`); ", true);
$this->clearIndexCached($table);
}
}
else{
if(is_array($column))
{
if($indexex)
{
foreach($indexex as $k => $v)
{
if(count($v) == count($column))
{
return;
}
}
foreach($indexex as $k => $v)
{
if(!isset($indexexother[$k]))
{
$this->app->DB->Query("DROP INDEX `".$k."` ON `".$table."`");
$cols = null;
foreach($column as $c) {
$cols[] = "`$c`";
}
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ", true);
$this->clearIndexCached($table);
return;
}
}
}
$cols = null;
foreach($column as $c) {
$cols[] = "`$c`";
}
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ", true);
$this->clearIndexCached($table);
}else{
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(`$column`); ", true);
$this->clearIndexCached($table);
}
}
}
elseif(!is_array($column))
{
if(!$unique)
{
$this->CheckAlterTable("ALTER TABLE `$table` ADD INDEX(`$column`); ");
}else{
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(`$column`); ");
}
$this->clearIndexCached($table);
}
elseif(is_array($column))
{
$cols = null;
foreach($column as $c) {
$cols[] = "`$c`";
}
$this->CheckAlterTable("ALTER TABLE `$table` ADD UNIQUE(".implode(', ',$cols)."); ");
$this->clearIndexCached($table);
}
}
/**
* @param string $sql
* @param bool $force
*
* @return mysqli_result|bool
*/
function CheckAlterTable($sql, $force = false)
{
$sqlmd5 = md5($sql);
$check = $this->app->DB->Select("SELECT id FROM checkaltertable WHERE checksum='$sqlmd5' LIMIT 1");
if($check > 0 && !$force) return;
$query = $this->app->DB->Query($sql);
if($query && empty($check) && !$this->app->DB->error()){
$this->app->DB->Insert("INSERT INTO checkaltertable (id,checksum) VALUES ('','$sqlmd5')");
}
return $query;
}
/**
* @return void
*/
public function ChangeFirmendatenToMyIsam()
{
$this->app->DB->Query("ALTER TABLE firmendaten ENGINE = MyISAM;");
}
/**
* @param string $table
*
* @return array
*/
public function getSortedIndexColumnsByIndexName($table): array
{
$indexesByName = [];
$indexes = $this->app->DB->SelectArr(sprintf('SHOW INDEX FROM `%s`', $table));
if(empty($indexes)) {
return $indexesByName;
}
foreach($indexes as $index) {
$indexesByName[$index['Key_name']][] = $index['Column_name'];
}
foreach($indexesByName as $indexName => $columns) {
$columns = array_unique($columns);
sort($columns);
$indexesByName[$indexName] = $columns;
}
return $indexesByName;
}
/**
* @deprecated will be removed in 21.4
*
* @param string $table
* @param array $columns
*/
public function dropIndex($table, $columns): void
{
if(empty($table) || empty($columns)) {
return;
}
$columns = array_unique($columns);
sort($columns);
$countColumns = count($columns);
$indexes = $this->getSortedIndexColumnsByIndexName($table);
if(empty($indexes)) {
return;
}
foreach($indexes as $indexName => $indexColumns) {
if(count($indexColumns) !== $countColumns) {
continue;
}
if(count(array_intersect($indexColumns, $columns)) === $countColumns) {
$this->app->DB->Query(sprintf('ALTER TABLE `%s` DROP INDEX `%s`', $table, $indexName));
}
}
}
}
+341 -337
View File
@@ -1,340 +1,344 @@
<?php
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
/*
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*
* Xentral (c) Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg, * Germany 2019
*
* This file is licensed under the Embedded Projects General Public License *Version 3.1.
*
* You should have received a copy of this license from your vendor and/or *along with this file; If not, please visit www.wawision.de/Lizenzhinweis
* to obtain the text of the corresponding license version.
*
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
*/
?>
<?php
/// Secure Layer, SQL Inject. Check, Syntax Check
class Secure
{
public $GET;
public $POST;
/**
* Secure constructor.
*
* @param ApplicationCore $app
*/
public function __construct($app){
$this->app = $app;
// clear global variables, that everybody have to go over secure layer
$this->GET = $_GET;
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
}
// $_GET="";
$this->POST = $_POST;
// $_POST="";
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
if(!class_exists('StringCleaner')) {
require_once __DIR__ . '/class.stringcleaner.php';
}
$this->app->stringcleaner = new StringCleaner($this->app);
}
$this->AddRule('notempty','reg','.'); // at least one sign
$this->AddRule('alpha','reg','[a-zA-Z]');
$this->AddRule('digit','reg','[0-9]');
$this->AddRule('space','reg','[ ]');
$this->AddRule('specialchars','reg','[_-]');
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
$this->AddRule('username','glue','alpha+digit');
$this->AddRule('password','glue','alpha+digit+specialchars');
}
/**
* @param string $name
* @param null $rule
* @param string $maxlength
* @param string $sqlcheckoff
*
* @return array|mixed|string
*/
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
{
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
$ret = $this->app->erp->base64_url_decode($ret);
if(strpos($ret,'"button"') === false){
$ret = $this->xss_clean($ret);
}
return $this->app->erp->base64_url_encode($ret);
}
if($rule === null) {
$rule = $this->NameToRule($name);
}
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
function NameToRule($name)
{
switch($name)
{
case 'id':
return 'doppelid';
break;
case 'sid':
return 'alphadigits';
break;
case 'module':
case 'smodule':
case 'action':
case 'saction':
return 'module';
break;
case 'cmd':
return 'moduleminus';
break;
}
return 'nothtml';
}
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
{
if($rule === null) {
$rule = $this->NameToRule($name);
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
$rule = 'nojs';
}
}
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
{
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
}
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
{
return $this->Syntax($string, $rule, '', $sqlcheckoff);
}
public function xss_clean($data)
{
return $this->app->stringcleaner->xss_clean($data);
}
public function GetPOSTArray()
{
if(!empty($this->POST) && count($this->POST)>0)
{
foreach($this->POST as $key=>$value)
{
$key = $this->GetPOST($key,"alpha+digit+specialchars",20);
$ret[$key]=$this->GetPOST($value);
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
public function GetGETArray()
{
if(!empty($this->GET) && count($this->GET)>0)
{
foreach($this->GET as $key=>$value)
{
$key = $this->GetGET($key,"alpha+digit+specialchars",20);
$ret[$key]=$this->GetGET($value);
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
function stripallslashes($string) {
while(strstr($string,'\\')) {
$string = stripslashes($string);
}
return $string;
}
public function smartstripslashes($str) {
$cd1 = substr_count($str, "\"");
$cd2 = substr_count($str, "\\\"");
$cs1 = substr_count($str, "'");
$cs2 = substr_count($str, "\\'");
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
$cb1 = substr_count($tmp, "\\");
$cb2 = substr_count($tmp, "\\\\");
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
}
return $str;
}
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
{
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
}
// check actual value with given rule
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
{
$striptags = false;
if(is_array($value))
{
if($sqlcheckoff != '')
{
return $value;
}
foreach($value as $k => $v)
{
if(is_array($v))
{
$value[$k] = $v;
}else{
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
if($striptags){
$v = $this->stripallslashes($v);
$v = $this->smartstripslashes($v);
$v = $this->app->erp->superentities($v);
}
$value[$k] = $this->app->DB->real_escape_string($v);
}
}
return $value;
}
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
if($striptags){
$value = $this->stripallslashes($value);
$value = $this->smartstripslashes($value);
$value = $this->app->erp->superentities($value);
}
if(!empty($this->app->stringcleaner)) {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
}
return $this->app->stringcleaner->CleanString($value, $rule);
}
if($rule === 'nohtml') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string(strip_tags($value));
}
return strip_tags($value);
}
if($rule === 'nojs') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->xss_clean($value));
}
return $this->xss_clean($value);
}
if($rule=='' && $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
if($rule=='' && $sqlcheckoff != '') {
return $value;
}
// build complete regexp
// check if rule exists
if($this->GetRegexp($rule)!=''){
//$v = '/^['.$this->GetRegexp($rule).']+$/';
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
if($sqlcheckoff==''){
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
return $value;
}
return '';
}
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
return '';
}
function RuleCheck($value,$rule)
{
$found = false;
if(!empty($this->app->stringcleaner)) {
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
if($found) {
if($value_) {
return true;
}
return false;
}
}
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
return true;
}
return false;
}
function AddRule($name,$type,$rule)
{
// type: reg = regular expression
// type: glue ( already exists rules copy to new e.g. number+digit)
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
}
// get complete regexp by rule name
function GetRegexp($rule)
{
$rules = explode('+',$rule);
$ret = '';
foreach($rules as $key) {
// check if rule is last in glue string
if($this->rules[$key]['type']==='glue') {
$subrules = explode('+',$this->rules[$key]['rule']);
if(count($subrules)>0) {
foreach($subrules as $subkey) {
$ret .= $this->GetRegexp($subkey);
}
}
}
elseif($this->rules[$key]['type']==='reg') {
$ret .= $this->rules[$key]['rule'];
}
}
if($ret==''){
$ret = 'none';
}
return $ret;
}
}
<?php
/// Secure Layer, SQL Inject. Check, Syntax Check
class Secure
{
public $GET;
public $POST;
/**
* Secure constructor.
*
* @param ApplicationCore $app
*/
public function __construct($app){
$this->app = $app;
// clear global variables, that everybody have to go over secure layer
$this->GET = $_GET;
if(isset($this->GET['msgs']) && isset($this->app->Location)) {
$this->GET['msg'] = $this->app->Location->getMessage($this->GET['msgs']);
}
// $_GET="";
$this->POST = $_POST;
// $_POST="";
if(!isset($this->app->stringcleaner) && file_exists(__DIR__. '/class.stringcleaner.php')) {
if(!class_exists('StringCleaner')) {
require_once __DIR__ . '/class.stringcleaner.php';
}
$this->app->stringcleaner = new StringCleaner($this->app);
}
$this->AddRule('notempty','reg','.'); // at least one sign
$this->AddRule('alpha','reg','[a-zA-Z]');
$this->AddRule('digit','reg','[0-9]');
$this->AddRule('space','reg','[ ]');
$this->AddRule('specialchars','reg','[_-]');
$this->AddRule('email','reg','^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$');
$this->AddRule('datum','reg','([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})');
$this->AddRule('username','glue','alpha+digit');
$this->AddRule('password','glue','alpha+digit+specialchars');
}
/**
* @param string $name
* @param null $rule
* @param string $maxlength
* @param string $sqlcheckoff
*
* @return array|mixed|string
*/
public function GetGET($name,$rule=null,$maxlength='',$sqlcheckoff='')
{
if($name === 'msg' && isset($this->app->erp) && method_exists($this, 'xss_clean')) {
$ret = $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'','',$maxlength,$sqlcheckoff);
$ret = $this->app->erp->base64_url_decode($ret);
if(strpos($ret,'"button"') === false){
$ret = $this->xss_clean($ret);
}
return $this->app->erp->base64_url_encode($ret);
}
if($rule === null) {
$rule = $this->NameToRule($name);
}
return $this->Syntax(isset($this->GET[$name])?$this->GET[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
function NameToRule($name)
{
switch($name)
{
case 'id':
return 'doppelid';
break;
case 'sid':
return 'alphadigits';
break;
case 'module':
case 'smodule':
case 'action':
case 'saction':
return 'module';
break;
case 'cmd':
return 'moduleminus';
break;
}
return 'nothtml';
}
public function GetPOST($name,$rule=null,$maxlength="",$sqlcheckoff="")
{
if($rule === null) {
$rule = $this->NameToRule($name);
if(isset($this->POST['ishtml_cke_'.$name]) && $this->POST['ishtml_cke_'.$name]) {
$rule = 'nojs';
}
}
return $this->Syntax(isset($this->POST[$name])?$this->POST[$name]:'',$rule,$maxlength,$sqlcheckoff);
}
public function GetPOSTForForms($name,$rule="",$maxlength="",$sqlcheckoff="")
{
return $this->SyntaxForForms($this->POST[$name],$rule,$maxlength,$sqlcheckoff);
}
public function CleanString($string, $rule='nohtml',$sqlcheckoff='')
{
return $this->Syntax($string, $rule, '', $sqlcheckoff);
}
public function xss_clean($data)
{
return $this->app->stringcleaner->xss_clean($data);
}
public function GetPOSTArray()
{
if(!empty($this->POST) && count($this->POST)>0)
{
foreach($this->POST as $key=>$value)
{
$value = $this->GetPOST($key);
if ($value !== null) {
$ret[$key] = $value;
}
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
public function GetGETArray()
{
if(!empty($this->GET) && count($this->GET)>0)
{
foreach($this->GET as $key=>$value)
{
$value = $this->GetGET($key);
if ($value !== null) {
$ret[$key] = $value;
}
}
}
if(!empty($ret))
{
return $ret;
}
return null;
}
function stripallslashes($string) {
while(strstr($string,'\\')) {
$string = stripslashes($string);
}
return $string;
}
public function smartstripslashes($str) {
$cd1 = substr_count($str, "\"");
$cd2 = substr_count($str, "\\\"");
$cs1 = substr_count($str, "'");
$cs2 = substr_count($str, "\\'");
$tmp = strtr($str, array("\\\"" => "", "\\'" => ""));
$cb1 = substr_count($tmp, "\\");
$cb2 = substr_count($tmp, "\\\\");
if ($cd1 == $cd2 && $cs1 == $cs2 && $cb1 == 2 * $cb2) {
return strtr($str, array("\\\"" => "\"", "\\'" => "'", "\\\\" => "\\"));
}
return $str;
}
public function SyntaxForForms($value,$rule,$maxlength="",$sqlcheckoff="")
{
return $value;//mysqli_real_escape_string($this->app->DB->connection,$value);//mysqli_real_escape_string($value);
}
// check actual value with given rule
public function Syntax($value,$rule,$maxlength='',$sqlcheckoff='')
{
$striptags = false;
if(is_array($value))
{
if($sqlcheckoff != '')
{
return $value;
}
foreach($value as $k => $v)
{
if(is_array($v))
{
$value[$k] = $v;
}else{
$v = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$v);
if($striptags){
$v = $this->stripallslashes($v);
$v = $this->smartstripslashes($v);
$v = $this->app->erp->superentities($v);
}
$value[$k] = $this->app->DB->real_escape_string($v);
}
}
return $value;
}
$value = str_replace("\xef\xbb\xbf","NONBLOCKINGZERO",$value);
if($striptags){
$value = $this->stripallslashes($value);
$value = $this->smartstripslashes($value);
$value = $this->app->erp->superentities($value);
}
if(!empty($this->app->stringcleaner)) {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->app->stringcleaner->CleanString($value, $rule));
}
return $this->app->stringcleaner->CleanString($value, $rule);
}
if($rule === 'nohtml') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string(strip_tags($value));
}
return strip_tags($value);
}
if($rule === 'nojs') {
if( $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($this->xss_clean($value));
}
return $this->xss_clean($value);
}
if($rule=='' && $sqlcheckoff == '') {
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
if($rule=='' && $sqlcheckoff != '') {
return $value;
}
// build complete regexp
// check if rule exists
if($this->GetRegexp($rule)!=''){
//$v = '/^['.$this->GetRegexp($rule).']+$/';
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ) {
if($sqlcheckoff==''){
return $this->app->DB->real_escape_string($value);//mysqli_real_escape_string($value);
}
return $value;
}
return '';
}
echo "<table border=\"1\" width=\"100%\" bgcolor=\"#FFB6C1\">
<tr><td>Rule <b>$rule</b> doesn't exists!</td></tr></table>";
return '';
}
function RuleCheck($value,$rule)
{
$found = false;
if(!empty($this->app->stringcleaner)) {
$value_ = $this->app->stringcleaner->RuleCheck($value, $rule, $found);
if($found) {
if($value_) {
return true;
}
return false;
}
}
$v = $this->GetRegexp($rule);
if (preg_match_all('/'.$v.'/i', $value, $teffer) ){
return true;
}
return false;
}
function AddRule($name,$type,$rule)
{
// type: reg = regular expression
// type: glue ( already exists rules copy to new e.g. number+digit)
$this->rules[$name]=array('type'=>$type,'rule'=>$rule);
}
// get complete regexp by rule name
function GetRegexp($rule)
{
$rules = explode('+',$rule);
$ret = '';
foreach($rules as $key) {
// check if rule is last in glue string
if($this->rules[$key]['type']==='glue') {
$subrules = explode('+',$this->rules[$key]['rule']);
if(count($subrules)>0) {
foreach($subrules as $subkey) {
$ret .= $this->GetRegexp($subkey);
}
}
}
elseif($this->rules[$key]['type']==='reg') {
$ret .= $this->rules[$key]['rule'];
}
}
if($ret==''){
$ret = 'none';
}
return $ret;
}
}
+51 -35
View File
@@ -3552,51 +3552,67 @@ class YUI {
'</td></tr></table>')";
}
function IconsSQL_produktion($tablename) {
$freigegeben = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_laeuft.png\" title=\"Produktion freigegeben\" border=\"0\" style=\"margin-right:1px\">";
$angelegt = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/blue.png\" title=\"Produktion angelegt\" border=\"0\" style=\"margin-right:1px\">";
$abgeschlossen = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/grey.png\" title=\"Produktion abgeschlossen\" border=\"0\" style=\"margin-right:1px\">";
$gestartet = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_green.png\" title=\"Produktion gestartet\" border=\"0\" style=\"margin-right:1px\">";
$storniert = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/storno.png\" title=\"Produktion storniert\" border=\"0\" style=\"margin-right:1px\">";
function IconsSQL_produktion($tablename) {
$freigegeben = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_laeuft.png\" title=\"Produktion freigegeben\" border=\"0\" style=\"margin-right:1px\">";
$angelegt = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/blue.png\" title=\"Produktion angelegt\" border=\"0\" style=\"margin-right:1px\">";
$abgeschlossen = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/grey.png\" title=\"Produktion abgeschlossen\" border=\"0\" style=\"margin-right:1px\">";
$gestartet = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/produkton_green.png\" title=\"Produktion gestartet\" border=\"0\" style=\"margin-right:1px\">";
$storniert = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/storno.png\" title=\"Produktion storniert\" border=\"0\" style=\"margin-right:1px\">";
$lager_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagergo.png\" style=\"margin-right:1px\" title=\"Artikel ist im Lager\" border=\"0\">";
$lager_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagerstop.png\" style=\"margin-right:1px\" title=\"Artikel fehlt im Lager\" border=\"0\">";
for ($z = 0;$z < 6;$z++) {
$angelegt_6 .= $angelegt;
$abgeschlossen_6 .= $abgeschlossen;
$storniert_6 .= $storniert;
}
$reserviert_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel reserviert\" border=\"0\">";
$reserviert_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_nicht_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel nicht reserviert\" border=\"0\">";
$lager_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagergo.png\" style=\"margin-right:1px\" title=\"Artikel ist im Lager\" border=\"0\">";
$lager_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/lagerstop.png\" style=\"margin-right:1px\" title=\"Artikel fehlt im Lager\" border=\"0\">";
$auslagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
$auslagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
$reserviert_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel reserviert\" border=\"0\">";
$reserviert_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ware_nicht_bestellt.png\" style=\"margin-right:1px\" title=\"Artikel nicht reserviert\" border=\"0\">";
$einlagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
$einlagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
$auslagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
$auslagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_ausgelagert.png\" title=\"Produktion ausgelagert\" border=\"0\" style=\"margin-right:1px\">";
$zeit_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/zeit_dreiviertel.png\" style=\"margin-right:1px\" title=\"Zeiten erfasst\" border=\"0\">";
$zeit_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/keine_zeiten.png\" style=\"margin-right:1px\" title=\"Zeiten nicht erfasst\" border=\"0\">";
$einlagern_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
$einlagern_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/nicht_eingelagert.png\" title=\"Produktion eingelagert\" border=\"0\" style=\"margin-right:1px\">";
$versand_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrego.png\" style=\"margin-right:1px\" title=\"Versand ok\" border=\"0\">";
$versand_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrestop.png\" style=\"margin-right:1px\" title=\"Versand nicht ok\" border=\"0\">";
$zeit_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/zeit_dreiviertel.png\" style=\"margin-right:1px\" title=\"Zeiten erfasst\" border=\"0\">";
$zeit_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/keine_zeiten.png\" style=\"margin-right:1px\" title=\"Zeiten nicht erfasst\" border=\"0\">";
$versand_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrego.png\" style=\"margin-right:1px\" title=\"Versand ok\" border=\"0\">";
$versand_nicht_ok = "<img src=\"./themes/{$this->app->Conf->WFconf['defaulttheme']}/images/liefersperrestop.png\" style=\"margin-right:1px\" title=\"Versand nicht ok\" border=\"0\">";
return "CONCAT('<table><tr><td nowrap>',
case
when $tablename.status = 'freigegeben' THEN '$freigegeben'
when $tablename.status = 'abgeschlossen' THEN '$abgeschlossen'
when $tablename.status = 'angelegt' THEN '$angelegt'
when $tablename.status = 'gestartet' THEN '$gestartet'
else '$storniert'
end,
if($tablename.lager_ok,'$lager_ok','$lager_nicht_ok'),
if($tablename.reserviert_ok,'$reserviert_ok','$reserviert_nicht_ok'),
if($tablename.auslagern_ok,'$auslagern_ok','$auslagern_nicht_ok'),
if($tablename.einlagern_ok,'$einlagern_ok','$einlagern_nicht_ok'),
if($tablename.zeit_ok,'$zeit_ok','$zeit_nicht_ok'),
if($tablename.versand_ok,'$versand_ok','$versand_nicht_ok'),
'</td></tr></table>')";
return "CONCAT('<table><tr><td nowrap>',
CASE
WHEN $tablename.status = 'freigegeben' THEN '$freigegeben'
WHEN $tablename.status = 'abgeschlossen' THEN '$abgeschlossen'
WHEN $tablename.status = 'angelegt' THEN '$angelegt'
WHEN $tablename.status = 'gestartet' THEN '$gestartet'
ELSE
'$storniert'
end,
CASE
WHEN FIND_IN_SET($tablename.status, 'freigegeben,gestartet') THEN
CONCAT (
if($tablename.lager_ok,'$lager_ok','$lager_nicht_ok'),
if($tablename.reserviert_ok,'$reserviert_ok','$reserviert_nicht_ok'),
if($tablename.auslagern_ok,'$auslagern_ok','$auslagern_nicht_ok'),
if($tablename.einlagern_ok,'$einlagern_ok','$einlagern_nicht_ok'),
if($tablename.zeit_ok,'$zeit_ok','$zeit_nicht_ok'),
if($tablename.versand_ok,'$versand_ok','$versand_nicht_ok')
)
ELSE
CASE
WHEN $tablename.status = 'angelegt' THEN '$angelegt_6'
WHEN $tablename.status = 'abgeschlossen' THEN '$abgeschlossen_6'
ELSE
'$storniert_6'
END
END,
'</td></tr></table>')";
}
function TablePositionSearch($parsetarget, $name, $callback = "show", $gener) {
$id = $this->app->Secure->GetGET("id");