Fixed bugs
This commit is contained in:
@@ -75,8 +75,8 @@ class ClassRepository {
|
||||
public function getCustomFilesCachePath(Node $object) {
|
||||
$path = $this->options['cache_dir'].DIRECTORY_SEPARATOR
|
||||
.strtoupper(md5($object->getId())).DIRECTORY_SEPARATOR
|
||||
.($object->getProperty(ObjectRetriever::REVISION_PROPERTY)
|
||||
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue()
|
||||
.($object->getProperty(Constants::PROPERTY_REVISION)
|
||||
? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
|
||||
: 'LocalConfig');
|
||||
if (!is_dir($path)) mkdir($path, 0777, true);
|
||||
return $path;
|
||||
@@ -87,8 +87,8 @@ class ClassRepository {
|
||||
$vars = $this->getURIVars($uri);
|
||||
|
||||
// Fetch class description
|
||||
$revision = $object->getProperty(ObjectRetriever::REVISION_PROPERTY)
|
||||
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue()
|
||||
$revision = $object->getProperty(Constants::PROPERTY_REVISION)
|
||||
? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
|
||||
: 'LocalConfig';
|
||||
|
||||
// Clear cache if cached version exists
|
||||
@@ -243,8 +243,8 @@ class ClassRepository {
|
||||
$objectRetriever = $this->container->get(ObjectRetriever::class);
|
||||
|
||||
// Get revision
|
||||
$revision = $object->getProperty(ObjectRetriever::REVISION_PROPERTY)
|
||||
? $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue()
|
||||
$revision = $object->getProperty(Constants::PROPERTY_REVISION)
|
||||
? $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
|
||||
: 'LocalConfig';
|
||||
|
||||
// Build filename where cached version should exist
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace CloudObjects\PhpMAE;
|
||||
use Slim\Psr7\Response;
|
||||
use Slim\ResponseEmitter;
|
||||
use ML\JsonLD\Node;
|
||||
use CloudObjects\SDK\ObjectRetriever;
|
||||
use CloudObjects\SDK\ObjectRetriever, CloudObjects\SDK\Constants;
|
||||
|
||||
class ErrorHandler {
|
||||
|
||||
@@ -22,7 +22,7 @@ class ErrorHandler {
|
||||
$message = substr($error['message'], 0, strpos($error['message'], ' in /'));
|
||||
$response = (new Response(500))->withHeader('Content-Type', 'text/plain');
|
||||
$response->getBody()->write("Error in implementation of <".$object->getId()."> at revision "
|
||||
. $object->getProperty(ObjectRetriever::REVISION_PROPERTY)->getValue()
|
||||
. $object->getProperty(Constants::PROPERTY_REVISION)->getValue()
|
||||
. ":\n".$message);
|
||||
return $response;
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ class CustomizedValidatorVisitor extends NodeVisitorAbstract {
|
||||
*/
|
||||
public function leaveNode(Node $node){
|
||||
if($node instanceof Node\Arg && $this->sandbox->sandbox_strings){
|
||||
return new Node\Expr\FuncCall(new Node\Name\FullyQualified(($node->value instanceof Node\Expr\Variable) ? 'PHPSandbox\\wrapByRef' : 'PHPSandbox\\wrap'), [$node, new Node\Expr\StaticCall(new Node\Name\FullyQualified("PHPSandbox\\PHPSandbox"), 'getSandbox', [new Node\Arg(new Node\Scalar\String_($this->sandbox->name))])], $node->getAttributes());
|
||||
return new Node\Expr\FuncCall(new Node\Name\FullyQualified(($node->value instanceof Node\Expr\Variable) ? 'PHPSandbox\\wrapByRef' : 'PHPSandbox\\wrap'), [$node, new Node\Expr\StaticCall(new Node\Name\FullyQualified("CloudObjects\\PhpMAE\\Sandbox\\CustomizedSandbox"), 'getGlobalSandbox')], $node->getAttributes());
|
||||
} else if($node instanceof Node\Stmt\InlineHTML){
|
||||
if(!$this->sandbox->allow_escaping){
|
||||
$this->sandbox->validationError("Sandboxed code attempted to escape to HTML!", Error::ESCAPE_ERROR, $node);
|
||||
|
||||
Reference in New Issue
Block a user