You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

header.php 5.9 KiB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. if (!defined('IN_CB')) { die('You are not allowed to access to this page.'); }
  3. if (version_compare(phpversion(), '5.0.0', '>=') !== true) {
  4. exit('Sorry, but you have to run this script with PHP5... You currently have the version <b>' . phpversion() . '</b>.');
  5. }
  6. if (!function_exists('imagecreate')) {
  7. exit('Sorry, make sure you have the GD extension installed before running this script.');
  8. }
  9. include_once('function.php');
  10. // FileName & Extension
  11. $system_temp_array = explode('/', $_SERVER['PHP_SELF']);
  12. $filename = $system_temp_array[count($system_temp_array) - 1];
  13. $system_temp_array2 = explode('.', $filename);
  14. $availableBarcodes = listBarcodes();
  15. $barcodeName = findValueFromKey($availableBarcodes, $filename);
  16. $code = $system_temp_array2[0];
  17. // Check if the code is valid
  18. if (file_exists('config' . DIRECTORY_SEPARATOR . $code . '.php')) {
  19. include_once('config' . DIRECTORY_SEPARATOR . $code . '.php');
  20. }
  21. ?>
  22. <!DOCTYPE html>
  23. <html>
  24. <head>
  25. <title><?php echo $barcodeName; ?> - Barcode Generator</title>
  26. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  27. <link type="text/css" rel="stylesheet" href="style.css" />
  28. <link rel="shortcut icon" href="favicon.ico" />
  29. <script src="jquery-1.7.2.min.js"></script>
  30. <script src="barcode.js"></script>
  31. </head>
  32. <body class="<?php echo $code; ?>">
  33. <?php
  34. $default_value = array();
  35. $default_value['filetype'] = 'PNG';
  36. $default_value['dpi'] = 72;
  37. $default_value['scale'] = isset($defaultScale) ? $defaultScale : 1;
  38. $default_value['rotation'] = 0;
  39. $default_value['font_family'] = 'Arial.ttf';
  40. $default_value['font_size'] = 8;
  41. $default_value['text'] = '';
  42. $default_value['a1'] = '';
  43. $default_value['a2'] = '';
  44. $default_value['a3'] = '';
  45. $filetype = isset($_POST['filetype']) ? $_POST['filetype'] : $default_value['filetype'];
  46. $dpi = isset($_POST['dpi']) ? $_POST['dpi'] : $default_value['dpi'];
  47. $scale = intval(isset($_POST['scale']) ? $_POST['scale'] : $default_value['scale']);
  48. $rotation = intval(isset($_POST['rotation']) ? $_POST['rotation'] : $default_value['rotation']);
  49. $font_family = isset($_POST['font_family']) ? $_POST['font_family'] : $default_value['font_family'];
  50. $font_size = intval(isset($_POST['font_size']) ? $_POST['font_size'] : $default_value['font_size']);
  51. $text = isset($_POST['text']) ? $_POST['text'] : $default_value['text'];
  52. registerImageKey('filetype', $filetype);
  53. registerImageKey('dpi', $dpi);
  54. registerImageKey('scale', $scale);
  55. registerImageKey('rotation', $rotation);
  56. registerImageKey('font_family', $font_family);
  57. registerImageKey('font_size', $font_size);
  58. registerImageKey('text', stripslashes($text));
  59. // Text in form is different than text sent to the image
  60. $text = convertText($text);
  61. ?>
  62. <div class="header">
  63. <header>
  64. <img class="logo" src="logo.png" alt="Barcode Generator" />
  65. <nav>
  66. <label for="type">Symbology</label>
  67. <?php echo getSelectHtml('type', $filename, $availableBarcodes); ?>
  68. <a class="info explanation" href="#"><img src="info.gif" alt="Explanation" /></a>
  69. </nav>
  70. </header>
  71. </div>
  72. <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
  73. <h1>Barcode Generator</h1>
  74. <h2><?php echo $barcodeName; ?></h2>
  75. <div class="configurations">
  76. <section class="configurations">
  77. <h3>Configurations</h3>
  78. <table>
  79. <colgroup>
  80. <col class="col1" />
  81. <col class="col2" />
  82. </colgroup>
  83. <tbody>
  84. <tr>
  85. <td><label for="filetype">File type</label></td>
  86. <td><?php echo getSelectHtml('filetype', $filetype, array('PNG' => 'PNG - Portable Network Graphics', 'JPEG' => 'JPEG - Joint Photographic Experts Group', 'GIF' => 'GIF - Graphics Interchange Format')); ?></td>
  87. </tr>
  88. <tr>
  89. <td><label for="dpi">DPI</label></td>
  90. <td><?php echo getInputTextHtml('dpi', $dpi, array('type' => 'number', 'min' => 72, 'max' => 300, 'required' => 'required')); ?> <span id="dpiUnavailable">DPI is available only for PNG and JPEG.</span></td>
  91. </tr>
  92. <?php
  93. if (isset($baseClassFile) && file_exists('include' . DIRECTORY_SEPARATOR . $baseClassFile)) {
  94. include_once('include' . DIRECTORY_SEPARATOR . $baseClassFile);
  95. }
  96. ?>
  97. <tr>
  98. <td><label for="scale">Scale</label></td>
  99. <td><?php echo getInputTextHtml('scale', $scale, array('type' => 'number', 'min' => 1, 'max' => 4, 'required' => 'required')); ?></td>
  100. </tr>
  101. <tr>
  102. <td><label for="rotation">Rotation</label></td>
  103. <td><?php echo getSelectHtml('rotation', $rotation, array(0 => 'No rotation', 90 => '90&deg; clockwise', 180 => '180&deg; clockwise', 270 => '270&deg; clockwise')); ?></td>
  104. </tr>
  105. <tr>
  106. <td><label for="font_family">Font</label></td>
  107. <td><?php echo getSelectHtml('font_family', $font_family, listfonts('../font')); ?> <?php echo getInputTextHtml('font_size', $font_size, array('type' => 'number', 'min' => 1, 'max' => 30)); ?></td>
  108. </tr>
  109. <tr>
  110. <td><label for="text">Data</label></td>
  111. <td>
  112. <div class="generate" style="float: left"><?php echo getInputTextHtml('text', $text, array('type' => 'text', 'required' => 'required')); ?> <input type="submit" value="Generate" /></div>
  113. <div class="possiblechars" style="float: right; position: relative;"><a href="#" class="info characters"><img src="info.gif" alt="Help" /></a></div>
  114. </td>
  115. </tr>
  116. </tbody>
  117. </table>
  118. </section>
  119. </div>