function auth_ok_callback($config = array()) { $ok = FALSE; if (!$config) { $config = config_get(); } if (!config_error($config)) { $ok = auth_ok($config); } return $ok; }
function auth_require($target = false) { global $config; if (auth_ok()) { return; } if ($target) { redirect(uri($target)); } exit; }
if (!value) return; if (!value.match(pattern)) { alert("The font name specified for "+name+" is not a TrueType font"); ok = false; return false; } }); return ok; } </script> <?php if (auth_ok()) { $max_size = min(to_bytes(ini_get('post_max_size')), to_bytes(ini_get('upload_max_filesize'))); ?> <form name="upload-font" method="post" action="controller.php?cmd=install-font" target="upload-font" enctype="multipart/form-data" onsubmit="return checkFileName(this)"> <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size; ?> " /> <table class="setup"> <tr> <td class="title">Name</td> <td><input type="text" name="family" /></td> <td rowspan="6"><iframe name="upload-font" id="upload-font" style="border: 0; width: 500px;"></iframe></td> </tr>
<?php session_start(); $cmd = isset($_GET["cmd"]) ? $_GET["cmd"] : null; include "../dompdf_config.inc.php"; include "functions.inc.php"; switch ($cmd) { case "clear-font-cache": $files = glob(DOMPDF_FONT_DIR . "*.{UFM,AFM,ufm,afm}.php", GLOB_BRACE); foreach ($files as $file) { unlink($file); } break; case "install-font": if (!auth_ok()) { break; } $family = $_POST["family"]; $data = $_FILES["file"]; foreach ($data["error"] as $name => $error) { if ($error) { switch ($error) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: echo "The uploaded file exceeds the upload_max_filesize directive in php.ini."; break; case UPLOAD_ERR_PARTIAL: echo "The uploaded file was only partially uploaded."; break; case UPLOAD_ERR_NO_FILE: break;
$err = ''; $config = array(); if (!@(include_once dirname(__FILE__) . '/include/loadutils.php')) { $err = 'Problem loading utility script'; } if (!$err && !load_utils('auth', 'service')) { $err = 'Problem loading utility scripts'; } if (!$err) { // pull in configuration so we can log other errors $config = config_get(); $err = config_error($config); $log_responses = $config['log_response']; } // autheticate the user (will exit if not possible) if (!$err && !auth_ok()) { auth_challenge($config); } if (!$err) { // pull in other configuration and check for required input if (!($php_input = file_get_contents('php://input'))) { $err = 'JSON payload required'; } else { if (!($request = @json_decode($php_input, TRUE))) { $err = 'Could not parse JSON payload'; } } } if (!$err) { if ($config['log_request']) { log_file(print_r($request, 1), $config);
} $dompdf = new DOMPDF(); $dompdf->load_html($_POST["html"]); $dompdf->set_paper($_POST["paper"], $_POST["orientation"]); $dompdf->render(); $dompdf->stream("dompdf_out.pdf", array("Attachment" => false)); exit(0); } include "head.inc"; ?> <a name="demo"> </a> <h2>Demo</h2> <?php if (auth_ok() && $is_local) { ?> <p>Enter your html snippet in the text box below to see it rendered as a PDF: (Note by default, remote stylesheets, images & inline PHP are disabled.)</p> <form action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <p>Paper size and orientation: <select name="paper"> <?php foreach (array_keys(CPDF_Adapter::$PAPER_SIZES) as $size) { echo "<option " . ($size == "letter" ? "selected " : "") . "value=\"{$size}\">{$size}</option>\n"; }
$cmd = isset($_GET["cmd"]) ? $_GET["cmd"] : null; include "../dompdf_config.inc.php"; include "functions.inc.php"; switch ($cmd) { case "clear-font-cache": $files = glob(DOMPDF_FONT_CACHE."*.{UFM,AFM,ufm,afm}.php", GLOB_BRACE); foreach($files as $file) { unlink($file); } break; case "install-font": if (!auth_ok()) break; $family = $_POST["family"]; $data = $_FILES["file"]; foreach($data["error"] as $name => $error) { if ($error) { switch($error) { case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: echo "The uploaded file exceeds the upload_max_filesize directive in php.ini."; break; case UPLOAD_ERR_PARTIAL: echo "The uploaded file was only partially uploaded."; break; case UPLOAD_ERR_NO_FILE: break; case UPLOAD_ERR_NO_TMP_DIR:
<h2>Hello world!</h2> <p> If you're seeing this page, that means that RFX is properly installed. Hooray! </p> <p> You provided the following arguments: <ul> <? foreach (uri_args() as $k => $v): ?> <li><b><?php echo $k; ?> </b> = <?php echo htmlspecialchars($v); ?> </li> <? endforeach ?> </ul> </p> <p><? if (auth_ok()) { ?> You are authenticated <? } else { ?> You are not authenticated <? } ?></p>
<?php require_once "functions.inc.php"; $allowed_hosts = array("::1", "127.0.0.1"); if (!auth_ok() || !in_array($_SERVER['REMOTE_ADDR'], $allowed_hosts)) { die("Access denied to host at " . $_SERVER['REMOTE_ADDR']); } $files = glob("test/*.{html,htm,php}", GLOB_BRACE); ?> <!DOCTYPE html> <html lang="en"> <head> <title>dompdf debugger</title> <meta name="robots" content="noindex"> <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript"> function updateAddress(){ var addressbar = $('#addressbar'), preview = $('#preview'), preview_html = $('#preview_html'), address = encodeURI(addressbar.val()), addressHTML = address, addressPDF = address, basePath = ""; if ( !/[a-z]+:\/\//.test(address) ) { addressHTML = "test/"+address+"?"+(new Date).getTime(); basePath = "www/test/"; }