From b7e85654ce5cdfd0549b1f1673477e637e782741 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 7 Feb 2017 17:49:55 +0000 Subject: [PATCH] #1124 --- inc/commons/class.common.tools.php | 11 +++++++++++ inc/prepend.php | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index a943a7d45..215a8df45 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -1134,4 +1134,15 @@ class commonTools { echo file_get_contents($_GET['url']); exit; } + + public static function phantomjs() { + $file = CubeIT_Files::tempnam(); + $exportformat = isset($_GET['exportformat']) ? $_GET['exportformat'] : 'pdf'; + $pageformat = isset($_GET['pageformat']) ? $_GET['pageformat'] : '210mm*297mm'; + $f = $file . '.' . $exportformat; + + CubeIT_CommandLine_Phantomjs::html2pdf($_GET['url'], $f, $pageformat); + cubeHTTP::relayFile($f); + exit; + } } diff --git a/inc/prepend.php b/inc/prepend.php index 319fa94c4..6d17a88dd 100644 --- a/inc/prepend.php +++ b/inc/prepend.php @@ -16,6 +16,11 @@ require_once(dirname(__FILE__) . '/postconfig.inc.php'); require_once(dirname(__FILE__) . '/commons/_common.php'); // Zend framework and associated frameworks set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/ZendFramework'); + +if (!defined('CACHE_PATH')) { + define('CACHE_PATH', ROOT . '/cache/'); +} + require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('CubeIT_'); -- 2.39.5