PageRenderTime 44ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/dompdf/dompdf/www/setup.php

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