PEEL Shopping
Open source ecommerce : PEEL Shopping
qrcode.php
Go to the documentation of this file.
1 <?php
2 // This file should be in UTF8 without BOM - Accents examples: éèê
3 // +----------------------------------------------------------------------+
4 // | Copyright (c) 2004-2015 Advisto SAS, service PEEL - contact@peel.fr |
5 // +----------------------------------------------------------------------+
6 // | This file is part of PEEL Shopping 8.0.0, which is subject to an |
7 // | opensource GPL license: you are allowed to customize the code |
8 // | for your own needs, but must keep your changes under GPL |
9 // | More information: https://www.peel.fr/lire/licence-gpl-70.html |
10 // +----------------------------------------------------------------------+
11 // | Author: Advisto SAS, RCS 479 205 452, France, https://www.peel.fr/ |
12 // +----------------------------------------------------------------------+
13 // $Id: qrcode.php 46935 2015-09-18 08:49:48Z gboussin $
14 if(!empty($_GET['path']) || !empty($_GET['barcode'])) {
15  define('LOAD_NO_OPTIONAL_MODULE', true);
16  define('SKIP_SET_LANG', true);
17  // On transmet uniquement un chemin local pour éviter que d'autres sites utilisent cette génération pour n'importe quel QR Code
18  include("configuration.inc.php");
19 
20  if (!empty($_GET['barcode'])) {
21  $data = $_GET['barcode'];
22  } else {
23  $data = $GLOBALS['wwwroot'].$_GET['path'];
24  }
25  $cache_id = md5($data);
26  $lifetime = 3600*24*30;
27  $this_cache_object = new Cache($cache_id, array('group' => 'qrcode'));
28  if ($this_cache_object->testTime($lifetime, true)) {
29  $output = $this_cache_object->get();
30  } else {
31  $output = '';
32  if (!empty($_GET['barcode'])) {
33  require_once($GLOBALS['dirroot'] . '/lib/class/pdf/barcodes.php');
34  $barcodeobj = new TCPDFBarcode($data, vb($GLOBALS['site_parameters']['type_of_barcode'], 'EAN13'));
35  ob_start();
36  $barcodeobj->getBarcodePNG(1.4, 60, array(0,0,0));
37  } else {
38  require_once($GLOBALS['dirroot'] . '/lib/class/pdf/2dbarcodes.php');
39  $barcodeobj = new TCPDF2DBarcode($data, 'QRCODE,M');
40  ob_start();
41  $barcodeobj->getBarcodePNG(3, 3, array(0,0,0));
42  }
43  $output .= ob_get_contents();
44  ob_end_clean();
45  $this_cache_object->save($output);
46  }
47  header('Content-Type: image/png');
48  $this_cache_object->echo_headers($lifetime);
49  unset($this_cache_object);
50  echo $output;
51 }
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
Definition: chart-data.php:29
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www...
Definition: barcodes.php:50
vb(&$var, $default=null)
Variable blanche if $var n'est pas défini, retourne $default, sinon retourne $var.
Definition: format.php:97
$GLOBALS['page_columns_count']
PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
Definition: 2dbarcodes.php:50
Definition: Cache.php:27

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:30:04 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.