1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
|
<?php include("head.inc"); ?>
<a name="setup"> </a>
<h2>Setup</h2>
<ul>
<li style="list-style-image: url('images/star_02.gif');"><a href="#system">System Configuration</a></li>
<li style="list-style-image: url('images/star_02.gif');"><a href="#dompdf-config">DOMPDF Configuration</a></li>
</ul>
<h3 id="system">System Configuration</h3>
<?php
require_once("../dompdf_config.inc.php");
$server_configs = array(
"PHP Version" => array(
"required" => "5.0",
"value" => phpversion(),
"result" => version_compare(phpversion(), "5.0"),
),
"DOMDocument extension" => array(
"required" => true,
"value" => phpversion("DOM"),
"result" => class_exists("DOMDocument"),
),
"PCRE" => array(
"required" => true,
"value" => phpversion("pcre"),
"result" => function_exists("preg_match") && @preg_match("/./u", "a"),
"failure" => "PCRE is required with Unicode support (the \"u\" modifier)",
),
"Zlib" => array(
"required" => true,
"value" => phpversion("zlib"),
"result" => function_exists("gzcompress"),
"fallback" => "Recommended to compress PDF documents",
),
"MBString extension" => array(
"required" => true,
"value" => phpversion("mbstring"),
"result" => function_exists("mb_send_mail"), // Should never be reimplemented in dompdf
"fallback" => "Recommended, will use fallback functions",
),
"GD" => array(
"required" => true,
"value" => phpversion("gd"),
"result" => function_exists("imagecreate"),
"fallback" => "Required if you have images in your documents",
),
"opcache" => array(
"required" => "For better performances",
"value" => null,
"result" => false,
"fallback" => "Recommended for better performances",
),
"GMagick or IMagick" => array(
"required" => "Better with transparent PNG images",
"value" => null,
"result" => extension_loaded("gmagick") || extension_loaded("imagick"),
"fallback" => "Recommended for better performances",
),
);
if (($xc = extension_loaded("xcache")) || ($apc = extension_loaded("apc")) || ($zop = extension_loaded("Zend OPcache")) || ($op = extension_loaded("opcache"))) {
$server_configs["opcache"]["result"] = true;
$server_configs["opcache"]["value"] = (
$xc ? "XCache ".phpversion("xcache") : (
$apc ? "APC ".phpversion("apc") : (
$zop ? "Zend OPCache ".phpversion("Zend OPcache") : "PHP OPCache ".phpversion("opcache")
)
)
);
}
if (($gm = extension_loaded("gmagick")) || ($im = extension_loaded("imagick"))) {
$server_configs["GMagick or IMagick"]["value"] = ($im ? "IMagick ".phpversion("imagick") : "GMagick ".phpversion("gmagick"));
}
?>
<table class="setup">
<tr>
<th></th>
<th>Required</th>
<th>Present</th>
</tr>
<?php foreach($server_configs as $label => $server_config) { ?>
<tr>
<td class="title"><?php echo $label; ?></td>
<td><?php echo ($server_config["required"] === true ? "Yes" : $server_config["required"]); ?></td>
<td class="<?php echo ($server_config["result"] ? "ok" : (isset($server_config["fallback"]) ? "warning" : "failed")); ?>">
<?php
echo $server_config["value"];
if ($server_config["result"] && !$server_config["value"]) echo "Yes";
if (!$server_config["result"]) {
if (isset($server_config["fallback"])) {
echo "<div>No. ".$server_config["fallback"]."</div>";
}
if (isset($server_config["failure"])) {
echo "<div>".$server_config["failure"]."</div>";
}
}
?>
</td>
</tr>
<?php } ?>
</table>
<h3 id="dompdf-config">DOMPDF Configuration</h3>
<?php
$dompdf_constants = array();
$defined_constants = get_defined_constants(true);
$constants = array(
"DOMPDF_DIR" => array(
"desc" => "Root directory of DOMPDF",
"success" => "read",
),
"DOMPDF_INC_DIR" => array(
"desc" => "Include directory of DOMPDF",
"success" => "read",
),
"DOMPDF_LIB_DIR" => array(
"desc" => "Third-party libraries directory of DOMPDF",
"success" => "read",
),
"DOMPDF_FONT_DIR" => array(
"desc" => "Directory containing fonts loaded into DOMPDF",
"success" => "write",
),
"DOMPDF_FONT_CACHE" => array(
"desc" => "Font metrics cache (used mainly by CPDF)",
"success" => "write",
),
"DOMPDF_TEMP_DIR" => array(
"desc" => "Temporary folder",
"success" => "write",
),
"DOMPDF_CHROOT" => array(
"desc" => "Restricted path",
"success" => "read",
),
"DOMPDF_UNICODE_ENABLED" => array(
"desc" => "Unicode support (with supporting fonts)",
),
"DOMPDF_ENABLE_FONTSUBSETTING" => array(
"desc" => "Enable font subsetting, will make smaller documents when using Unicode fonts",
),
"DOMPDF_PDF_BACKEND" => array(
"desc" => "Backend library that renders the output (PDF, image)",
"success" => "backend",
),
"DOMPDF_DEFAULT_MEDIA_TYPE" => array(
"desc" => "Default media type (print, screen, ...)",
),
"DOMPDF_DEFAULT_PAPER_SIZE" => array(
"desc" => "Default paper size (A4, letter, ...)",
),
"DOMPDF_DEFAULT_FONT" => array(
"desc" => "Default font, used if the specified font in the CSS stylesheet was not found",
),
"DOMPDF_DPI" => array(
"desc" => "DPI scale of the document",
),
"DOMPDF_ENABLE_PHP" => array(
"desc" => "Inline PHP support",
),
"DOMPDF_ENABLE_JAVASCRIPT" => array(
"desc" => "Inline JavaScript support",
),
"DOMPDF_ENABLE_REMOTE" => array(
"desc" => "Allow remote stylesheets and images",
"success" => "remote",
),
"DOMPDF_ENABLE_CSS_FLOAT" => array(
"desc" => "Enable CSS float support (experimental)",
),
"DOMPDF_ENABLE_HTML5PARSER" => array(
"desc" => "Enable the HTML5 parser (experimental)",
),
"DEBUGPNG" => array(
"desc" => "Debug PNG images",
),
"DEBUGKEEPTEMP" => array(
"desc" => "Keep temporary image files",
),
"DEBUGCSS" => array(
"desc" => "Debug CSS",
),
"DEBUG_LAYOUT" => array(
"desc" => "Debug layout",
),
"DEBUG_LAYOUT_LINES" => array(
"desc" => "Debug text lines layout",
),
"DEBUG_LAYOUT_BLOCKS" => array(
"desc" => "Debug block elements layout",
),
"DEBUG_LAYOUT_INLINE" => array(
"desc" => "Debug inline elements layout",
),
"DEBUG_LAYOUT_PADDINGBOX" => array(
"desc" => "Debug padding boxes layout",
),
"DOMPDF_LOG_OUTPUT_FILE" => array(
"desc" => "The file in which dompdf will write warnings and messages",
"success" => "write",
),
"DOMPDF_FONT_HEIGHT_RATIO" => array(
"desc" => "The line height ratio to apply to get a render like web browsers",
),
"DOMPDF_ENABLE_AUTOLOAD" => array(
"desc" => "Enable the DOMPDF autoloader",
),
"DOMPDF_AUTOLOAD_PREPEND" => array(
"desc" => "Prepend the dompdf autoload function to the SPL autoload functions already registered instead of appending it",
),
"DOMPDF_ADMIN_USERNAME" => array(
"desc" => "The username required to access restricted sections",
"secret" => true,
),
"DOMPDF_ADMIN_PASSWORD" => array(
"desc" => "The password required to access restricted sections",
"secret" => true,
"success" => "auth",
),
);
?>
<table class="setup">
<tr>
<th>Config name</th>
<th>Value</th>
<th>Description</th>
<th>Status</th>
</tr>
<?php foreach($defined_constants["user"] as $const => $value) { ?>
<tr>
<td class="title"><?php echo $const; ?></td>
<td>
<?php
if (isset($constants[$const]["secret"])) {
echo "******";
}
else {
var_export($value);
}
?>
</td>
<td><?php if (isset($constants[$const]["desc"])) echo $constants[$const]["desc"]; ?></td>
<td <?php
$message = "";
if (isset($constants[$const]["success"])) {
switch($constants[$const]["success"]) {
case "read":
$success = is_readable($value);
$message = ($success ? "Readable" : "Not readable");
break;
case "write":
$success = is_writable($value);
$message = ($success ? "Writable" : "Not writable");
break;
case "remote":
$success = ini_get("allow_url_fopen");
$message = ($success ? "allow_url_fopen enabled" : "allow_url_fopen disabled");
break;
case "backend":
switch (strtolower($value)) {
case "cpdf":
$success = true;
break;
case "pdflib":
$success = function_exists("PDF_begin_document");
$message = "The PDFLib backend needs the PDF PECL extension";
break;
case "gd":
$success = function_exists("imagecreate");
$message = "The GD backend requires GD2";
break;
}
break;
case "auth":
$success = !in_array($value, array("admin", "password"));
$message = ($success ? "OK" : "Password should be changed");
break;
}
echo 'class="' . ($success ? "ok" : "failed") . '"';
}
?>><?php echo $message; ?></td>
</tr>
<?php } ?>
</table>
<?php include("foot.inc"); ?>
|