dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxDesignService_contract_test.php File Reference

Go to the source code of this file.

Classes

class  dbxDesignServiceTestApi

Functions

 dbx ()

Variables

 $remove
 $tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'dbx-design-service-test-' . bin2hex(random_bytes(5))
 $source = $tmp . DIRECTORY_SEPARATOR . 'dbx' . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'source'
 $service = new \dbx\dbxDesign_admin\dbxDesignService()
 $result
 $target = $tmp . '/dbx/design/customer-design'
 $defaultHtml = (string)file_get_contents($target . '/htm/default.htm')
 $metadata = json_decode((string)file_get_contents($target . '/design.json'), true)
 $fail
if(($result['name'] ?? '') !=='customer-design'||!is_dir($target)) if(substr_count( $defaultHtml, '[dbx:content]') !==1) foreach(array('[dbx:logo]', '[dbx:branding]', '[dbx:footer]') as $slot) if(( $metadata[ 'contract'] ?? '') !==\dbx\dbxDesign_admin\dbxDesignService::CONTRACT) if((dbx() ->config['dbx']['default_design_user'] ?? '') !=='customer-design') $validation = $service->validateDesignDirectory($target, true)
if(!empty( $validation[ 'errors'])) if($service->isAllowedDesignFile('../escape.php')|| $service->isAllowedDesignFile('htm/evil.php')) $delta = $tmp . '/result/design'
 $evil = $delta . '/htm/evil.htm'
 $updated = $service->applyResult('source', 'customer-design', $delta, 'update')

Function Documentation

◆ dbx()

dbx ( )

Definition at line 34 of file dbxDesignService_contract_test.php.

References $api.

Variable Documentation

◆ $defaultHtml

$defaultHtml = (string)file_get_contents($target . '/htm/default.htm')

Definition at line 77 of file dbxDesignService_contract_test.php.

◆ $delta

if(!empty($validation['errors'])) if ( $service->isAllowedDesignFile('../escape.php')||$service->isAllowedDesignFile( 'htm/evil.php')) $delta = $tmp . '/result/design'

Definition at line 111 of file dbxDesignService_contract_test.php.

Referenced by dbxDB\update().

◆ $evil

$evil = $delta . '/htm/evil.htm'

Definition at line 114 of file dbxDesignService_contract_test.php.

◆ $fail

$fail
Initial value:
= static function(string $message, int $code) use ($remove, $tmp): void {
fwrite(STDERR, "FAIL: $message\n");
exit($code);
}
exit
Definition index.php:146

Definition at line 80 of file dbxDesignService_contract_test.php.

◆ $metadata

$metadata = json_decode((string)file_get_contents($target . '/design.json'), true)

Definition at line 78 of file dbxDesignService_contract_test.php.

◆ $remove

$remove
Initial value:
= static function(string $dir) use (&$remove): void {
if (!is_dir($dir)) return;
foreach (new FilesystemIterator($dir, FilesystemIterator::SKIP_DOTS) as $file) {
if ($file->isDir()) $remove($file->getPathname());
else unlink($file->getPathname());
}
rmdir($dir);
}

Definition at line 42 of file dbxDesignService_contract_test.php.

Referenced by dbxWebApp\strip_unwanted_route_params().

◆ $result

Initial value:
= $service->createFromWizard(array_merge($service->defaults('source'), array(
'source_design' => 'source',
'target_design' => 'customer-design',
'title' => 'Customer Design',
'brand_name' => 'Customer',
'tagline' => 'Einfach gut',
'layout' => 'sidebar',
'set_default' => 1,
)))

Definition at line 66 of file dbxDesignService_contract_test.php.

◆ $service

Definition at line 64 of file dbxDesignService_contract_test.php.

◆ $source

$source = $tmp . DIRECTORY_SEPARATOR . 'dbx' . DIRECTORY_SEPARATOR . 'design' . DIRECTORY_SEPARATOR . 'source'

Definition at line 54 of file dbxDesignService_contract_test.php.

◆ $target

◆ $tmp

$tmp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'dbx-design-service-test-' . bin2hex(random_bytes(5))

Definition at line 51 of file dbxDesignService_contract_test.php.

◆ $updated

$updated = $service->applyResult('source', 'customer-design', $delta, 'update')

Definition at line 120 of file dbxDesignService_contract_test.php.

◆ $validation

if(( $result[ 'name'] ?? '') !=='customer-design'||!is_dir( $target)) if(substr_count($defaultHtml, '[dbx:content]') !==1) foreach(array('[dbx:logo]', '[dbx:branding]', '[dbx:footer]') as $slot) if(($metadata['contract'] ?? '') !==\dbx\dbxDesign_admin\dbxDesignService::CONTRACT) if ((dbx() ->config[ 'dbx'][ 'default_design_user'] ?? '') !=='customer-design') $validation = $service->validateDesignDirectory($target, true)