Minor addition to message center help file (#1745)
[openemr.git] / portal / sign / lib / show-signature.php
blob734ab99d706239a09c95821b651c8406bc63eff9
1 <?php
2 /**
4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
6 * LICENSE: This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 * @package OpenEMR
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
27 $ignoreAuth = true;
28 require_once("../../../interface/globals.php");
30 $errors = array ();
31 // @TODO sanatize these
32 $pid = $_GET ['pid'];
33 $user = $_GET ['user'];
34 $type = $_GET ['type'];
35 $signer = $_GET ['signer'];
37 if ($pid == 0 || empty($user)) {
38 if ($type != 'admin-signature' || empty($user)) {
39 echo ('error');
40 return;
44 $sig_hash = sha1($output);
45 $created = time();
46 $ip = $_SERVER ['REMOTE_ADDR'];
47 $status = 'filed';
48 $lastmod = date('Y-m-d H:i:s');
49 if ($type == 'admin-signature') {
50 $pid = 0;
51 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE user=? && type=?", array($user,$type));
52 } else {
53 $row = sqlQuery("SELECT pid,status,sig_image,type,user FROM onsite_signatures WHERE pid=?", array($pid));
56 if (!$row ['pid'] && !$row ['user']) {
57 $status = 'waiting';
58 $qstr = "INSERT INTO onsite_signatures (pid,lastmod,status,type,user,signator,created) VALUES (?,?,?,?,?,?,?) ";
59 sqlStatement($qstr, array($pid,$lastmod, $status,$type,$user,$signer,$created));
62 if ($row ['status'] == 'filed') {
63 header("Content-Type: image/png");
64 echo $row ['sig_image'];
65 return;
66 } else if ($row ['status'] == 'waiting' || $status == 'waiting') {
67 echo 'waiting';
68 return;