$t = $time - $t; } $human = ageSeconds2Human($t); $time = $time - $t; Print_Message('Notice', 'Only displaying files ' . ($filter === 2 ? 'newer' : 'older') . " than {$human}<br/>" . "Here is a fixed <a href=\"index.php?page={$PAGE}&filter={$filter}&t={$time}\">link</a> you can save.", 'center'); } else { $T2 = Get_Values('T2'); if (is_null($T2)) { $t2 = Get_Values('t2'); $t1 = Get_Values('t1'); } else { $t2 = $time - $T2; $t1 = $time - Get_Values('T1'); } $time = array($time - $t1, $time - $t2); Print_Message('Notice', 'Only displaying files newer than ' . ageSeconds2Human($t2) . '<br/>and older than ' . ageSeconds2Human($t1) . '<br/>' . 'Here is a fixed <a href="index.php?page=Scans&filter=3&T2=' . $time[1] . '&T1=' . $time[0] . '">link</a> you can save.', 'center'); } } for ($i = 0, $max = count($FILES); $i < $max; $i++) { $FILE = $FILES[$i]; if (isset($time)) { if ($filter === 2) { if (filemtime("scans/thumb/{$FILE}") < $time) { continue; } } else { if ($filter === 1) { if (filemtime("scans/thumb/{$FILE}") > $time) { continue; } } else {
<?php $preview = "Preview_" . substr($file, 0, -3) . "jpg"; if (isset($_POST['file-text'])) { // 1_Mar_8_2012~11-22-41.txt 1_Mar_8_2012~11-22-41-edit-42.txt $edit = strpos($file, '-edit-'); $name = is_bool($edit) ? substr($file, 0, -4) : substr($file, 0, $edit); $int = 1; while (file_exists("scans/thumb/Preview_{$name}-edit-{$int}.jpg")) { $int++; } copy("scans/thumb/{$preview}", "scans/Preview_{$name}-edit-{$int}.jpg"); if (SaveFile("scans/file/Scan_{$name}-edit-{$int}.txt", $_POST['file-text'])) { Print_Message("Saved", "You have successfully edited {$file}", 'center'); $file = "{$name}-edit-{$int}.txt"; } } echo "<div class=\"box box-full\" id=\"text-editor\"><div id=\"preview_links\"></div>" . "<img src=\"scans/thumb/{$preview}\"><br/>" . '<form action="index.php?page=Edit&file=' . $file . '" method="POST"><textarea name="file-text">' . html(file_get_contents("scans/file/Scan_{$file}")) . "</textarea><br/>" . '<input value="Save" type="submit"/><input type="button" value="Cancel" onclick="history.go(-1);"/></forum></div>'; Update_Links("Scan_{$file}", $PAGE);
Print_Message("Deleted:", "The paper size {$del} has been deleted.", "center"); } if ($add != null && $N_width != null && $N_height != null) { $add = html($add); if (!$message) { Print_Message("Added:", "The paper size {$add} has been created.", "center"); } else { if (!is_numeric($N_width) || !is_numeric($N_height)) { $N_width = html($N_width); $N_height = html($N_height); Print_Message("Error:", "One or more of these is not a number:<br/><code>{$N_width}</code><br/><code>{$N_height}</code>.", "center"); } else { if ($N_width <= 0 || $N_height <= 0) { Print_Message("Error:", "4<sup>th</sup> dimensional paper size detected, pics or it did not happen", "center"); } else { Print_Message("Error:", "The paper size {$add} already exists.", "center"); } } } } ?> </div> <script type="text/javascript"> // Also see scans.php line 95 if(typeof document.body.style.MozColumnGap=="string") getID("paper-list").className+=" columns";// At least someone knows how to do something right (Firefox > Edge/IE > Chrome) else enableColumns("paper-list",null,<?php echo isset($_COOKIE["columns"]) ? 'true' : 'false'; ?> ); </script>
SaveFile($file, $_POST['raw']); include 'res/printer.php'; unlink($file); } else { if ($_POST['format'] == 'raw') { Print_Message('Error', 'You forgot to include the text to print...', 'center'); } else { if ($_POST['format'] == 'pdf' && isset($_FILES['pdf'])) { if (strlen($_FILES['pdf']['name']) == 0) { Print_Message('Error', 'You forgot to include the PDF File to print...', 'center'); } else { if (mime_content_type($_FILES['pdf']['tmp_name']) == 'application/pdf') { $file = $_FILES['pdf']['tmp_name']; include 'res/printer.php'; } else { Print_Message('Error', html($_FILES['pdf']['name']) . ' does not look like a PDF', 'center'); } } } } } } $upLimit = getMaximumFileUploadSize(); ?> <form name="Printer" action="index.php?page=Printer" method="post" enctype="multipart/form-data" onsubmit="return submitPrint(this,<?php echo $upLimit; ?> ,false);"> <input type="hidden" name="format"/> <input type="hidden" name="options"/> <div id="sidebar" style="min-height:100px;">
function findLangs() { $tess = "/usr/share/tesseract-ocr/tessdata"; // This is where tesseract stores it language files $langs = "/usr/share/doc"; // This is where documentation is stored if (is_dir($tess)) { $langs = array(); $tess = scandir($tess); for ($i = 2, $max = count($tess); $i < $max; $i++) { $pos = strpos($tess[$i], '.'); if ($pos) { $tess[$i] = substr($tess[$i], 0, strpos($tess[$i], '.', $pos)); if (!in_array($tess[$i], $langs)) { array_push($langs, $tess[$i]); } } } } else { if (is_dir($langs)) { $langs = explode("\n", substr(exe("ls " . shell($langs) . " | grep 'tesseract-ocr-' | sed 's/tesseract-ocr-//'", true), 0, -1)); } else { Print_Message("Tesseract Error:", "Unable to find any installed language files or documentation.<br/>You can edit lines 145 and or 146 of <code>" . getcwd() . "/index.php</code> with the correct location for your system.", "center"); $langs = array(); } } return $langs; }
<?php # This file is used to handle all the print commands # This file runs all the print commands, ../download.php and inc/printer.php call this page via include # If your printer needs some special options used you want to edit lines 15 and 27, also note lines 12 and 24 # You will want to read up on the CUPS command line printing documentation @ http://www.cups.org/documentation.php/options.html $lpstat = 'lpstat -a | awk \'{print $1}\''; // command used to find printers if (function_exists('exe')) { // internal call via inc/printer.php if (isset($file)) { $_POST['quantity'] = intval($_POST['quantity']); $q = $_POST['quantity'] > 0 ? $_POST['quantity'] : 1; $o = escapeshellarg($_POST['options']); Print_Message($_POST['printer'], 'Your document is being processed:<br/><pre>' . html(exe('lp -d ' . shell($_POST['printer']) . " -n {$q} -o {$o} {$file}", true)) . '</pre>', 'center'); } else { $printers = array_filter(explode("\n", exe($lpstat, true))); } } else { if (isset($Printer)) { // internal call via include from ../download.php header('Content-type: application/json; charset=UTF-8'); $_GET['quantity'] = intval($_GET['quantity']); $q = $_GET['quantity'] > 0 ? $_GET['quantity'] : 1; $o = escapeshellarg($_GET['options']); echo json_encode((object) array('printer' => $_GET['printer'], 'message' => shell_exec('lp -d ' . escapeshellarg($_GET['printer']) . " -n {$q} -o {$o} {$file}"))); } else { $Printer = parse_ini_file(file_exists('res') ? 'config.ini' : '../config.ini'); $Printer = (int) $Printer['Printer']; if (!function_exists('ext2mime')) { // external call via browser