-
Notifications
You must be signed in to change notification settings - Fork 2
/
pdf.php
109 lines (93 loc) · 3.09 KB
/
pdf.php
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
<!DOCTYPE html>
<html>
<?php
include_once 'config.inc.php';
include_once 'lang.php';
$resolution=$_GET['resolution'];
$image=$_GET['image'];
$autocrop=$_GET['autocrop'];
$print=$_GET['print'];
$mode=$_GET['mode'];
// $pdffile= substr($image, 0, -4).$deskew.'.jpg';
// $previewimage = $filepath.$image;
$printscaleheight=$_GET['printscaleheight'];
$printscalewidth=$_GET['printscalewidth'];
$pdfname=$_GET['pdfname'];
session_start();
$now=time();
if ((isset($_SESSION['username'])) && ($_SESSION['loggedin']=='yes') && (isset($_SESSION['password'])) && (isset($_SESSION['expire'])) && ($_SESSION['expire'] >= $now))
{
if (($_SESSION['expire'] - $now) <= $addtime)
{
$_SESSION['expire']=($_SESSION['expire'] + $buytime);
}
else
{
echo '';
}
}
else
{
echo '';
}
if (($requireauth=='yes') && ($_SESSION['loggedin']=='yes'))
{
$previewimage = $_SESSION['userpath'].$image;
$pdfcmd=$imagemagicklocation.' -density '.$resolution.'x'.$resolution.' '.$_SESSION['userpath'].'PDF/'.$pdfname.'/* '.$_SESSION['userpath'].'PDF/'.$pdfname.'.pdf';
// $pdfcmd=$imagemagicklocation.' '.$previewimage.' -background black -fuzz 75% -deskew 50% -trim +repage '.$_SESSION["userpath"].$pdffile;
$userpath=$_SESSION['userpath'];
$rmdircmd='rm -r '.$_SESSION['userpath'].'PDF/'.$pdfname;
}
elseif ($requireauth !='yes')
{
$previewimage = $filepath.$image;
$pdfcmd=$imagemagicklocation.' -density '.$resolution.'x'.$resolution.' '.$filepath.'PDf/'.$pdfname.'/* '.$filepath.'PDf/'.$pdfname.'.pdf';
//$pdfcmd=$imagemagicklocation.' '.$previewimage.' -background black -fuzz 75% -deskew 50% -trim +repage '.$filepath.$pdffile;
$userpath=$filepath;
$rmdircmd='rm -r '.$filepath.'PDF/'.$pdfname;
}
else
{
$pdfcmd="";
}
if ($_SESSION['fromfilelister']=='yes')
{
$refreshurl=$userpath.'index.php#'.$pdffile;
}
else
$refreshurl="airscan.php?image=$pdffile&resolution=$resolution&print=$print&mode=$mode&printscalewidth=$printscalewidth&printscaleheight=$printscaleheight&autocrop=$autocrop";
?>
<head>
<meta HTTP-EQUIV="REFRESH" content='<?php echo $autocroprefresh; ?>; url=<?php echo $refreshurl;?>'>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="root">
<meta name="robots" content="noindex">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title><?php echo $pagetitle; ?></title>
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<table id='page_header'><tr><td>
<a href='airscan.php'>
<img id='logo' src='images/AirScan.png' alt='AirScan'>
</a></td>
</tr>
<tr><td class='ruler'></td></tr>
</table>
<?php
// echo ($_SESSION['expire'] - $now);
echo '<center><p>'.$waitpdfingtxt.'... '.$pdffile.'</p></center>';
echo '<center><img src="images/spinner.gif"></center>';
// $output =
shell_exec("$pdfcmd");
shell_exec("$rmdircmd");
//echo $pdfcmd;
//echo '<br/>';
//echo $rmdircmd;
?>
</body>
</html>