Commit dec31de1b848ef80338d4f884bb762e25a9e3b4e

Authored by Edmar Moretti
1 parent 2f892e51

Inclusão de qrcode nos links da página inicial

Showing 2 changed files with 21 additions and 17 deletions   Show diff stats
init/index.php
@@ -233,7 +233,7 @@ include "head.php"; @@ -233,7 +233,7 @@ include "head.php";
233 placement: "auto", 233 placement: "auto",
234 trigger: "click focus", 234 trigger: "click focus",
235 content: function(){ 235 content: function(){
236 - var urlqr = "../pacotes/qrcode/php/qr_img.php?host=" + window.location.host + "&d=" + $(this).attr("data-url"); 236 + var urlqr = "../pacotes/qrcode/php/qr_img.php?host=" + window.location.host + "&u=" + $(this).attr("data-url");
237 return "<img style='width:200px; height: 200px;' src='" + urlqr + "' '>"; 237 return "<img style='width:200px; height: 200px;' src='" + urlqr + "' '>";
238 } 238 }
239 }); 239 });
pacotes/qrcode/php/qr_img.php
@@ -4,8 +4,8 @@ @@ -4,8 +4,8 @@
4 # QRcode image PHP scripts version 0.50g (C)2000-2005,Y.Swetake 4 # QRcode image PHP scripts version 0.50g (C)2000-2005,Y.Swetake
5 # 5 #
6 # 6 #
7 -# This program outputs a png image of "QRcode model 2".  
8 -# You cannot use a several functions of QRcode in this version. 7 +# This program outputs a png image of "QRcode model 2".
  8 +# You cannot use a several functions of QRcode in this version.
9 # See README.txt . 9 # See README.txt .
10 # 10 #
11 # This version supports QRcode model2 version 1-40. 11 # This version supports QRcode model2 version 1-40.
@@ -38,9 +38,9 @@ @@ -38,9 +38,9 @@
38 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 38 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 39 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
40 # IN NO EVENT SHALL Y.Swetake OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 40 # IN NO EVENT SHALL Y.Swetake OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
41 -# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 41 +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
42 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 42 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 43 +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
44 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 44 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 45 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
46 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 # USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -67,12 +67,16 @@ if($_GET[&quot;host&quot;] != $_SERVER[&quot;HTTP_HOST&quot;]){ @@ -67,12 +67,16 @@ if($_GET[&quot;host&quot;] != $_SERVER[&quot;HTTP_HOST&quot;]){
67 $path="./../data"; /* You must set path to data files. */ 67 $path="./../data"; /* You must set path to data files. */
68 $image_path="./../image"; /* You must set path to QRcode frame images. */ 68 $image_path="./../image"; /* You must set path to QRcode frame images. */
69 69
70 -$version_ul=40; /* upper limit for version */ 70 +$version_ul=40; /* upper limit for version */
71 /* ------ setting area end ------ */ 71 /* ------ setting area end ------ */
72 72
73 -  
74 -$qrcode_data_string=@$_GET["d"];  
75 -$qrcode_data_string .= "&temasa=".$_GET["temasa"]."&layers=".$_GET["layers"]; 73 +if($_GET["d"]){
  74 + $qrcode_data_string=@$_GET["d"];
  75 + $qrcode_data_string .= "&temasa=".$_GET["temasa"]."&layers=".$_GET["layers"];
  76 +}
  77 +if($_GET["u"]){
  78 + $qrcode_data_string=@$_GET["u"];
  79 +}
76 $qrcode_error_correct=@$_GET["e"]; 80 $qrcode_error_correct=@$_GET["e"];
77 $qrcode_module_size=@$_GET["s"]; 81 $qrcode_module_size=@$_GET["s"];
78 $qrcode_version=@$_GET["v"]; 82 $qrcode_version=@$_GET["v"];
@@ -251,7 +255,7 @@ $ecc_character_hash=array(&quot;L&quot;=&gt;&quot;1&quot;, @@ -251,7 +255,7 @@ $ecc_character_hash=array(&quot;L&quot;=&gt;&quot;1&quot;,
251 "H"=>"2", 255 "H"=>"2",
252 "h"=>"2"); 256 "h"=>"2");
253 257
254 - $ec=@$ecc_character_hash[$qrcode_error_correct]; 258 + $ec=@$ecc_character_hash[$qrcode_error_correct];
255 259
256 if (!$ec){$ec=0;} 260 if (!$ec){$ec=0;}
257 261
@@ -283,7 +287,7 @@ if (!$qrcode_version){ @@ -283,7 +287,7 @@ if (!$qrcode_version){
283 /* #--- auto version select */ 287 /* #--- auto version select */
284 $i=1+40*$ec; 288 $i=1+40*$ec;
285 $j=$i+39; 289 $j=$i+39;
286 - $qrcode_version=1; 290 + $qrcode_version=1;
287 while ($i<=$j){ 291 while ($i<=$j){
288 if (($max_data_bits_array[$i])>=$total_data_bits+$codeword_num_plus[$qrcode_version] ){ 292 if (($max_data_bits_array[$i])>=$total_data_bits+$codeword_num_plus[$qrcode_version] ){
289 $max_data_bits=$max_data_bits_array[$i]; 293 $max_data_bits=$max_data_bits_array[$i];
@@ -380,7 +384,7 @@ while ($i&lt;=$data_counter) { @@ -380,7 +384,7 @@ while ($i&lt;=$data_counter) {
380 384
381 $flag=1; 385 $flag=1;
382 while ($flag) { 386 while ($flag) {
383 - if ($remaining_bits>$buffer_bits){ 387 + if ($remaining_bits>$buffer_bits){
384 $codewords[$codewords_counter]=((@$codewords[$codewords_counter]<<$buffer_bits) | $buffer); 388 $codewords[$codewords_counter]=((@$codewords[$codewords_counter]<<$buffer_bits) | $buffer);
385 $remaining_bits-=$buffer_bits; 389 $remaining_bits-=$buffer_bits;
386 $flag=0; 390 $flag=0;
@@ -392,7 +396,7 @@ while ($i&lt;=$data_counter) { @@ -392,7 +396,7 @@ while ($i&lt;=$data_counter) {
392 $flag=0; 396 $flag=0;
393 } else { 397 } else {
394 $buffer= ($buffer & ((1 << $buffer_bits)-1) ); 398 $buffer= ($buffer & ((1 << $buffer_bits)-1) );
395 - $flag=1; 399 + $flag=1;
396 } 400 }
397 401
398 $codewords_counter++; 402 $codewords_counter++;
@@ -503,7 +507,7 @@ while ($i&lt;$max_codewords){ @@ -503,7 +507,7 @@ while ($i&lt;$max_codewords){
503 $j=8; 507 $j=8;
504 while ($j>=1){ 508 while ($j>=1){
505 $codeword_bits_number=($i << 3) + $j; 509 $codeword_bits_number=($i << 3) + $j;
506 - $matrix_content[ $matrix_x_array[$codeword_bits_number] ][ $matrix_y_array[$codeword_bits_number] ]=((255*($codeword_i & 1)) ^ $mask_array[$codeword_bits_number] ); 510 + $matrix_content[ $matrix_x_array[$codeword_bits_number] ][ $matrix_y_array[$codeword_bits_number] ]=((255*($codeword_i & 1)) ^ $mask_array[$codeword_bits_number] );
507 $codeword_i= $codeword_i >> 1; 511 $codeword_i= $codeword_i >> 1;
508 $j--; 512 $j--;
509 } 513 }
@@ -533,7 +537,7 @@ $min_demerit_score=0; @@ -533,7 +537,7 @@ $min_demerit_score=0;
533 $k++; 537 $k++;
534 } 538 }
535 $i=0; 539 $i=0;
536 -$all_matrix=$max_modules_1side * $max_modules_1side; 540 +$all_matrix=$max_modules_1side * $max_modules_1side;
537 while ($i<8){ 541 while ($i<8){
538 $demerit_n1=0; 542 $demerit_n1=0;
539 $ptn_temp=array(); 543 $ptn_temp=array();
@@ -574,7 +578,7 @@ while ($i&lt;8){ @@ -574,7 +578,7 @@ while ($i&lt;8){
574 $demerit_n2+=(strlen($str_temp)-1); 578 $demerit_n2+=(strlen($str_temp)-1);
575 } 579 }
576 $demerit_n2*=3; 580 $demerit_n2*=3;
577 - 581 +
578 $ptn_temp=array(); 582 $ptn_temp=array();
579 583
580 preg_match_all($n1_search,$hor,$ptn_temp); 584 preg_match_all($n1_search,$hor,$ptn_temp);
@@ -638,7 +642,7 @@ while ($i&lt;$mxe){ @@ -638,7 +642,7 @@ while ($i&lt;$mxe){
638 $jj=0; 642 $jj=0;
639 while ($j<$mxe){ 643 while ($j<$mxe){
640 if ($matrix_content[$ii][$jj] & $mask_content){ 644 if ($matrix_content[$ii][$jj] & $mask_content){
641 - ImageSetPixel($base_image,$i,$j,$col[1]); 645 + ImageSetPixel($base_image,$i,$j,$col[1]);
642 } 646 }
643 $j++; 647 $j++;
644 $jj++; 648 $jj++;