diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php
index 655d823639..67904d31fb 100644
--- a/app/contacts/contact_edit.php
+++ b/app/contacts/contact_edit.php
@@ -205,6 +205,57 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$document['title'] = $text['title-contact-add'];
}
+ $_GET['type'] = "text";
+ $qr_vcard = true;
+ include "contacts_vcard.php";
+ echo "";
+ echo "";
+ echo "";
+ echo "";
+ echo "
";
//show the content
echo "
";
@@ -226,7 +277,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "
\n";
echo " \n";
if ($action == "update") {
- echo " \n";
+ echo " \n";
echo " \n";
}
if ($action == "update" && is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/invoices')) {
diff --git a/app/contacts/contacts_vcard.php b/app/contacts/contacts_vcard.php
index c8bd3ef289..9ec26b4fb7 100644
--- a/app/contacts/contacts_vcard.php
+++ b/app/contacts/contacts_vcard.php
@@ -69,8 +69,8 @@ if (count($_GET)>0) {
$vcard->data['company'] = $contact_organization;
$vcard->data['first_name'] = $contact_name_given;
$vcard->data['last_name'] = $contact_name_family;
- $vcard->data['contact_email1'] = $contact_email;
- $vcard->data['contact_url'] = $contact_url;
+ $vcard->data['email1'] = $contact_email;
+ $vcard->data['url'] = $contact_url;
if ($_GET['type'] == "image" || $_GET['type'] == "html") {
//don't add this to the QR code at this time
@@ -142,7 +142,12 @@ if (count($_GET)>0) {
if ($_GET['type'] == "text") {
$vcard->build();
$content = $vcard->card;
- echo $content;
+ if ($qr_vcard) {
+ $qr_vcard = $content;
+ }
+ else {
+ echo $content;
+ }
}
//show the vcard in an image qr code
@@ -150,6 +155,13 @@ if (count($_GET)>0) {
$vcard->build();
$content = $vcard->card;
+ if (isset($_GET['debug'])) {
+ echo "";
+ print_r($vcard->data);
+ echo " ";
+ exit;
+ }
+
//include
require_once PROJECT_PATH."resources/qr/qrcode.php";
diff --git a/app/contacts/qr_code_logo.png b/app/contacts/qr_code_logo.png
new file mode 100644
index 0000000000..7742e72fe4
Binary files /dev/null and b/app/contacts/qr_code_logo.png differ
diff --git a/resources/classes/vcard.php b/resources/classes/vcard.php
index 6e211218e7..95dfb3ddcd 100644
--- a/resources/classes/vcard.php
+++ b/resources/classes/vcard.php
@@ -44,7 +44,8 @@ class vcard {
,"home_state"=>null
,"home_postal_code"=>null
,"home_country"=>null
- ,"office_tel"=>null
+ ,"voice_tel"=>null
+ ,"work_tel"=>null
,"home_tel"=>null
,"cell_tel"=>null
,"fax_tel"=>null
@@ -64,7 +65,7 @@ class vcard {
/*
build() method checks all the values, builds appropriate defaults for
missing values, generates the vcard data string.
- */
+ */
function build() {
$this->log .= "vcard build() called ";
/*
@@ -84,20 +85,21 @@ class vcard {
$this->card .= "VERSION:3.0\r\n";
//$this->card .= "CLASS:".$this->class."\r\n";
//$this->card .= "PRODID:-//class_vcard from TroyWolf.com//NONSGML Version 1//EN\r\n";
- $this->card .= "REV:".$this->revision_date."\r\n";
+// $this->card .= "REV:".$this->revision_date."\r\n";
$this->card .= "FN:".$this->data['display_name']."\r\n";
$this->card .= "N:";
$this->card .= $this->data['last_name'].";";
- $this->card .= $this->data['first_name'].";";
+ $this->card .= $this->data['first_name'];
if (strlen($this->data['additional_name']) > 0) {
- $this->card .= $this->data['additional_name'].";";
+ $this->card .= ";".$this->data['additional_name'];
}
if (strlen($this->data['name_prefix']) > 0) {
- $this->card .= $this->data['name_prefix'].";";
+ $this->card .= ";".$this->data['name_prefix'];
}
if (strlen($this->data['name_suffix']) > 0) {
- $this->card .= $this->data['name_suffix']."\r\n";
+ $this->card .= ";".$this->data['name_suffix'];
}
+ $this->card .= "\r\n";
if ($this->data['nickname']) { $this->card .= "NICKNAME:".$this->data['contact_nickname']."\r\n"; }
if ($this->data['title']) { $this->card .= "TITLE:".$this->data['title']."\r\n"; }
if ($this->data['company']) { $this->card .= "ORG:".$this->data['company']; }
@@ -156,7 +158,7 @@ class vcard {
$this->card .= $this->data['home_city'].";";
}
if (strlen($this->data['home_state']) > 0) {
- $this->card .= $this->data['home_state']."";
+ $this->card .= $this->data['home_state'].";";
}
if (strlen($this->data['home_postal_code']) > 0) {
$this->card .= $this->data['home_postal_code'].";";
@@ -166,19 +168,20 @@ class vcard {
}
$this->card .= "\r\n";
}
- if ($this->data['email1']) { $this->card .= "EMAIL;TYPE=internet,pref:".$this->data['email1']."\r\n"; }
- if ($this->data['email2']) { $this->card .= "EMAIL;TYPE=internet:".$this->data['email2']."\r\n"; }
- if ($this->data['office_tel']) { $this->card .= "TEL;TYPE=work,voice:".$this->data['office_tel']."\r\n"; }
- if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home,voice:".$this->data['home_tel']."\r\n"; }
- if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell,voice:".$this->data['cell_tel']."\r\n"; }
- if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=work,fax:".$this->data['fax_tel']."\r\n"; }
- if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=work,pager:".$this->data['pager_tel']."\r\n"; }
- if ($this->data['url']) { $this->card .= "URL;TYPE=work:".$this->data['url']."\r\n"; }
+ if ($this->data['email1']) { $this->card .= "EMAIL;PREF=1:".$this->data['email1']."\r\n"; }
+ if ($this->data['email2']) { $this->card .= "EMAIL;PREF=2:".$this->data['email2']."\r\n"; }
+ if ($this->data['voice_tel']) { $this->card .= "TEL;TYPE=voice:".$this->data['voice_tel']."\r\n"; }
+ if ($this->data['work_tel']) { $this->card .= "TEL;TYPE=work:".$this->data['work_tel']."\r\n"; }
+ if ($this->data['home_tel']) { $this->card .= "TEL;TYPE=home:".$this->data['home_tel']."\r\n"; }
+ if ($this->data['cell_tel']) { $this->card .= "TEL;TYPE=cell:".$this->data['cell_tel']."\r\n"; }
+ if ($this->data['fax_tel']) { $this->card .= "TEL;TYPE=fax:".$this->data['fax_tel']."\r\n"; }
+ if ($this->data['pager_tel']) { $this->card .= "TEL;TYPE=pager:".$this->data['pager_tel']."\r\n"; }
+ if ($this->data['url']) { $this->card .= "URL:".$this->data['url']."\r\n"; }
if ($this->data['birthday']) { $this->card .= "BDAY:".$this->data['birthday']."\r\n"; }
if ($this->data['role']) { $this->card .= "ROLE:".$this->data['role']."\r\n"; }
if ($this->data['note']) { $this->card .= "NOTE:".$this->data['note']."\r\n"; }
$this->card .= "TZ:".$this->data['timezone']."\r\n";
- $this->card .= "END:VCARD\r\n";
+ $this->card .= "END:VCARD";
}
/*
diff --git a/resources/jquery/jquery.qrcode-0.8.0.min.js b/resources/jquery/jquery.qrcode-0.8.0.min.js
new file mode 100644
index 0000000000..73e011e93d
--- /dev/null
+++ b/resources/jquery/jquery.qrcode-0.8.0.min.js
@@ -0,0 +1,2 @@
+/*! jQuery.qrcode 0.8.0 - //larsjung.de/qrcode - MIT License */
+!function(r){"use strict";var t=function(r,t,e,n){var o=y(e,t);o.addData(r),o.make(),n=n||0;var i=o.getModuleCount(),a=o.getModuleCount()+2*n,u=function(r,t){return r-=n,t-=n,0>r||r>=i||0>t||t>=i?!1:o.isDark(r,t)},f=function(r,t,e,n){var o=this.isDark,i=1/a;this.isDark=function(a,u){var f=u*i,l=a*i,c=f+i,g=l+i;return o(a,u)&&(r>c||f>e||t>g||l>n)}};this.text=r,this.level=t,this.version=e,this.moduleCount=a,this.isDark=u,this.addBlank=f},e=function(){var r=document.createElement("canvas");return!(!r.getContext||!r.getContext("2d"))}(),n="[object Opera]"!==Object.prototype.toString.call(window.opera),o=function(r,e,n,o,i){n=Math.max(1,n||1),o=Math.min(40,o||40);for(var a=n;o>=a;a+=1)try{return new t(r,e,a,i)}catch(u){}},i=function(t,e,n){var o=n.size,i="bold "+n.mSize*o+"px "+n.fontname,a=r("")[0].getContext("2d");a.font=i;var u=a.measureText(n.label).width,f=n.mSize,l=u/o,c=(1-l)*n.mPosX,g=(1-f)*n.mPosY,s=c+l,h=g+f,v=.01;1===n.mode?t.addBlank(0,g-v,o,h+v):t.addBlank(c-v,g-v,s+v,h+v),e.fillStyle=n.fontcolor,e.font=i,e.fillText(n.label,c*o,g*o+.75*n.mSize*o)},a=function(r,t,e){var n=e.size,o=e.image.naturalWidth||1,i=e.image.naturalHeight||1,a=e.mSize,u=a*o/i,f=(1-u)*e.mPosX,l=(1-a)*e.mPosY,c=f+u,g=l+a,s=.01;3===e.mode?r.addBlank(0,l-s,n,g+s):r.addBlank(f-s,l-s,c+s,g+s),t.drawImage(e.image,f*n,l*n,u*n,a*n)},u=function(t,e,n){r(n.background).is("img")?e.drawImage(n.background,0,0,n.size,n.size):n.background&&(e.fillStyle=n.background,e.fillRect(n.left,n.top,n.size,n.size));var o=n.mode;1===o||2===o?i(t,e,n):(3===o||4===o)&&a(t,e,n)},f=function(r,t,e,n,o,i,a,u){r.isDark(a,u)&&t.rect(n,o,i,i)},l=function(r,t,e,n,o,i,a,u,f,l){a?r.moveTo(t+i,e):r.moveTo(t,e),u?(r.lineTo(n-i,e),r.arcTo(n,e,n,o,i)):r.lineTo(n,e),f?(r.lineTo(n,o-i),r.arcTo(n,o,t,o,i)):r.lineTo(n,o),l?(r.lineTo(t+i,o),r.arcTo(t,o,t,e,i)):r.lineTo(t,o),a?(r.lineTo(t,e+i),r.arcTo(t,e,n,e,i)):r.lineTo(t,e)},c=function(r,t,e,n,o,i,a,u,f,l){a&&(r.moveTo(t+i,e),r.lineTo(t,e),r.lineTo(t,e+i),r.arcTo(t,e,t+i,e,i)),u&&(r.moveTo(n-i,e),r.lineTo(n,e),r.lineTo(n,e+i),r.arcTo(n,e,n-i,e,i)),f&&(r.moveTo(n-i,o),r.lineTo(n,o),r.lineTo(n,o-i),r.arcTo(n,o,n-i,o,i)),l&&(r.moveTo(t+i,o),r.lineTo(t,o),r.lineTo(t,o-i),r.arcTo(t,o,t+i,o,i))},g=function(r,t,e,n,o,i,a,u){var f=r.isDark,g=n+i,s=o+i,h=e.radius*i,v=a-1,d=a+1,w=u-1,m=u+1,T=f(a,u),y=f(v,w),p=f(v,u),B=f(v,m),E=f(a,m),k=f(d,m),A=f(d,u),M=f(d,w),D=f(a,w);T?l(t,n,o,g,s,h,!p&&!D,!p&&!E,!A&&!E,!A&&!D):c(t,n,o,g,s,h,p&&D&&y,p&&E&&B,A&&E&&k,A&&D&&M)},s=function(t,e,o){var i,a,u=t.moduleCount,l=o.size/u,c=f;for(n&&o.radius>0&&o.radius<=.5&&(c=g),e.beginPath(),i=0;u>i;i+=1)for(a=0;u>a;a+=1){var s=o.left+a*l,h=o.top+i*l,v=l;c(t,e,o,s,h,v,i,a)}if(r(o.fill).is("img")){e.strokeStyle="rgba(0,0,0,0.5)",e.lineWidth=2,e.stroke();var d=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",e.fill(),e.globalCompositeOperation=d,e.clip(),e.drawImage(o.fill,0,0,o.size,o.size),e.restore()}else e.fillStyle=o.fill,e.fill()},h=function(t,e){var n=o(e.text,e.ecLevel,e.minVersion,e.maxVersion,e.quiet);if(!n)return null;var i=r(t).data("qrcode",n),a=i[0].getContext("2d");return u(n,a,e),s(n,a,e),i},v=function(t){var e=r("").attr("width",t.size).attr("height",t.size);return h(e,t)},d=function(t){return r(" ").attr("src",v(t)[0].toDataURL("image/png"))},w=function(t){var e=o(t.text,t.ecLevel,t.minVersion,t.maxVersion,t.quiet);if(!e)return null;var n,i,a=t.size,u=t.background,f=Math.floor,l=e.moduleCount,c=f(a/l),g=f(.5*(a-c*l)),s={position:"relative",left:0,top:0,padding:0,margin:0,width:a,height:a},h={position:"absolute",padding:0,margin:0,width:c,height:c,"background-color":t.fill},v=r("").data("qrcode",e).css(s);for(u&&v.css("background-color",u),n=0;l>n;n+=1)for(i=0;l>i;i+=1)e.isDark(n,i)&&r("").css(h).css({left:g+i*c,top:g+n*c}).appendTo(v);return v},m=function(r){return e&&"canvas"===r.render?v(r):e&&"image"===r.render?d(r):w(r)},T={render:"canvas",minVersion:1,maxVersion:40,ecLevel:"L",left:0,top:0,size:200,fill:"#000",background:null,text:"no text",radius:0,quiet:0,mode:0,mSize:.1,mPosX:.5,mPosY:.5,label:"no label",fontname:"sans",fontcolor:"#000",image:null};r.fn.qrcode=function(t){var e=r.extend({},T,t);return this.each(function(){"canvas"===this.nodeName.toLowerCase()?h(this,e):r(this).append(m(e))})};var y=function(){function r(t,e){if("undefined"==typeof t.length)throw new Error(t.length+"/"+e);var n=function(){for(var r=0;re;e+=1){t[e]=new Array(r);for(var n=0;r>n;n+=1)t[e][n]=null}return t}(h),y(0,0),y(h-7,0),y(0,h-7),E(),B(),A(r,t),c>=7&&k(r),null==d&&(d=C(c,g,w)),M(d,t)},y=function(r,t){for(var e=-1;7>=e;e+=1)if(!(-1>=r+e||r+e>=h))for(var n=-1;7>=n;n+=1)-1>=t+n||t+n>=h||(s[r+e][t+n]=e>=0&&6>=e&&(0==n||6==n)||n>=0&&6>=n&&(0==e||6==e)||e>=2&&4>=e&&n>=2&&4>=n?!0:!1)},p=function(){for(var r=0,t=0,e=0;8>e;e+=1){T(!0,e);var n=i.getLostPoint(m);(0==e||r>n)&&(r=n,t=e)}return t},B=function(){for(var r=8;h-8>r;r+=1)null==s[r][6]&&(s[r][6]=0==r%2);for(var t=8;h-8>t;t+=1)null==s[6][t]&&(s[6][t]=0==t%2)},E=function(){for(var r=i.getPatternPosition(c),t=0;t=a;a+=1)for(var u=-2;2>=u;u+=1)s[n+a][o+u]=-2==a||2==a||-2==u||2==u||0==a&&0==u?!0:!1}},k=function(r){for(var t=i.getBCHTypeNumber(c),e=0;18>e;e+=1){var n=!r&&1==(1&t>>e);s[Math.floor(e/3)][e%3+h-8-3]=n}for(var e=0;18>e;e+=1){var n=!r&&1==(1&t>>e);s[e%3+h-8-3][Math.floor(e/3)]=n}},A=function(r,t){for(var e=g<<3|t,n=i.getBCHTypeInfo(e),o=0;15>o;o+=1){var a=!r&&1==(1&n>>o);6>o?s[o][8]=a:8>o?s[o+1][8]=a:s[h-15+o][8]=a}for(var o=0;15>o;o+=1){var a=!r&&1==(1&n>>o);8>o?s[8][h-o-1]=a:9>o?s[8][15-o-1+1]=a:s[8][15-o-1]=a}s[h-8][8]=!r},M=function(r,t){for(var e=-1,n=h-1,o=7,a=0,u=i.getMaskFunction(t),f=h-1;f>0;f-=2)for(6==f&&(f-=1);;){for(var l=0;2>l;l+=1)if(null==s[n][f-l]){var c=!1;a>>o));var g=u(n,f-l);g&&(c=!c),s[n][f-l]=c,o-=1,-1==o&&(a+=1,o=7)}if(n+=e,0>n||n>=h){n-=e,e=-e;break}}},D=function(t,e){for(var n=0,o=0,a=0,u=new Array(e.length),f=new Array(e.length),l=0;l=0?d.get(w):0}}for(var m=0,s=0;ss;s+=1)for(var l=0;ls;s+=1)for(var l=0;l8*s)throw new Error("code length overflow. ("+l.getLengthInBits()+">"+8*s+")");for(l.getLengthInBits()+4<=8*s&&l.put(0,4);0!=l.getLengthInBits()%8;)l.putBit(!1);for(;;){if(l.getLengthInBits()>=8*s)break;if(l.put(o,8),l.getLengthInBits()>=8*s)break;l.put(a,8)}return D(l,n)};return m.addData=function(r){var t=l(r);w.push(t),d=null},m.isDark=function(r,t){if(0>r||r>=h||0>t||t>=h)throw new Error(r+","+t);return s[r][t]},m.getModuleCount=function(){return h},m.make=function(){T(!1,p())},m.createTableTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e="";e+='',e+="";for(var n=0;n";for(var o=0;o';e+=""}return e+="",e+=" "},m.createImgTag=function(r,t){r=r||2,t="undefined"==typeof t?4*r:t;var e=m.getModuleCount()*r+2*t,n=t,o=e-t;return v(e,e,function(t,e){if(t>=n&&o>t&&e>=n&&o>e){var i=Math.floor((t-n)/r),a=Math.floor((e-n)/r);return m.isDark(a,i)?0:1}return 1})},m};t.stringToBytes=function(r){for(var t=new Array,e=0;ei)t.push(i);else{var a=e[r.charAt(o)];"number"==typeof a?(255&a)==a?t.push(a):(t.push(a>>>8),t.push(255&a)):t.push(n)}}return t}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},o={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},i=function(){var t=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],n=1335,i=7973,u=21522,f={},l=function(r){for(var t=0;0!=r;)t+=1,r>>>=1;return t};return f.getBCHTypeInfo=function(r){for(var t=r<<10;l(t)-l(n)>=0;)t^=n<=0;)t^=i<n;n+=1)e=e.multiply(r([1,a.gexp(n)],0));return e},f.getLengthInBits=function(r,t){if(t>=1&&10>t)switch(r){case e.MODE_NUMBER:return 10;case e.MODE_ALPHA_NUM:return 9;case e.MODE_8BIT_BYTE:return 8;case e.MODE_KANJI:return 8;default:throw new Error("mode:"+r)}else if(27>t)switch(r){case e.MODE_NUMBER:return 12;case e.MODE_ALPHA_NUM:return 11;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 10;default:throw new Error("mode:"+r)}else{if(!(41>t))throw new Error("type:"+t);switch(r){case e.MODE_NUMBER:return 14;case e.MODE_ALPHA_NUM:return 13;case e.MODE_8BIT_BYTE:return 16;case e.MODE_KANJI:return 12;default:throw new Error("mode:"+r)}}},f.getLostPoint=function(r){for(var t=r.getModuleCount(),e=0,n=0;t>n;n+=1)for(var o=0;t>o;o+=1){for(var i=0,a=r.isDark(n,o),u=-1;1>=u;u+=1)if(!(0>n+u||n+u>=t))for(var f=-1;1>=f;f+=1)0>o+f||o+f>=t||(0!=u||0!=f)&&a==r.isDark(n+u,o+f)&&(i+=1);i>5&&(e+=3+i-5)}for(var n=0;t-1>n;n+=1)for(var o=0;t-1>o;o+=1){var l=0;r.isDark(n,o)&&(l+=1),r.isDark(n+1,o)&&(l+=1),r.isDark(n,o+1)&&(l+=1),r.isDark(n+1,o+1)&&(l+=1),(0==l||4==l)&&(e+=3)}for(var n=0;t>n;n+=1)for(var o=0;t-6>o;o+=1)r.isDark(n,o)&&!r.isDark(n,o+1)&&r.isDark(n,o+2)&&r.isDark(n,o+3)&&r.isDark(n,o+4)&&!r.isDark(n,o+5)&&r.isDark(n,o+6)&&(e+=40);for(var o=0;t>o;o+=1)for(var n=0;t-6>n;n+=1)r.isDark(n,o)&&!r.isDark(n+1,o)&&r.isDark(n+2,o)&&r.isDark(n+3,o)&&r.isDark(n+4,o)&&!r.isDark(n+5,o)&&r.isDark(n+6,o)&&(e+=40);for(var c=0,o=0;t>o;o+=1)for(var n=0;t>n;n+=1)r.isDark(n,o)&&(c+=1);var g=Math.abs(100*c/t/t-50)/5;return e+=10*g},f}(),a=function(){for(var r=new Array(256),t=new Array(256),e=0;8>e;e+=1)r[e]=1<e;e+=1)r[e]=r[e-4]^r[e-5]^r[e-6]^r[e-8];for(var e=0;255>e;e+=1)t[r[e]]=e;var n={};return n.glog=function(r){if(1>r)throw new Error("glog("+r+")");return t[r]},n.gexp=function(t){for(;0>t;)t+=255;for(;t>=256;)t-=255;return r[t]},n}(),u=function(){var r=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],t=function(r,t){var e={};return e.totalCount=r,e.dataCount=t,e},e={},o=function(t,e){switch(e){case n.L:return r[4*(t-1)+0];case n.M:return r[4*(t-1)+1];case n.Q:return r[4*(t-1)+2];case n.H:return r[4*(t-1)+3];default:return void 0}};return e.getRSBlocks=function(r,e){var n=o(r,e);if("undefined"==typeof n)throw new Error("bad rs block @ typeNumber:"+r+"/errorCorrectLevel:"+e);for(var i=n.length/3,a=new Array,u=0;i>u;u+=1)for(var f=n[3*u+0],l=n[3*u+1],c=n[3*u+2],g=0;f>g;g+=1)a.push(t(l,c));return a},e}(),f=function(){var r=new Array,t=0,e={};return e.getBuffer=function(){return r},e.get=function(t){var e=Math.floor(t/8);return 1==(1&r[e]>>>7-t%8)},e.put=function(r,t){for(var n=0;t>n;n+=1)e.putBit(1==(1&r>>>t-n-1))},e.getLengthInBits=function(){return t},e.putBit=function(e){var n=Math.floor(t/8);r.length<=n&&r.push(0),e&&(r[n]|=128>>>t%8),t+=1},e},l=function(r){var n=e.MODE_8BIT_BYTE,o=t.stringToBytes(r),i={};return i.getMode=function(){return n},i.getLength=function(){return o.length},i.write=function(r){for(var t=0;t>>8)},t.writeBytes=function(r,e,n){e=e||0,n=n||r.length;for(var o=0;n>o;o+=1)t.writeByte(r[o+e])},t.writeString=function(r){for(var e=0;e0&&(t+=","),t+=r[e];return t+="]"},t},g=function(){var r=0,t=0,e=0,n="",o={},i=function(r){n+=String.fromCharCode(a(63&r))},a=function(r){if(0>r);else{if(26>r)return 65+r;if(52>r)return 97+(r-26);if(62>r)return 48+(r-52);if(62==r)return 43;if(63==r)return 47}throw new Error("n:"+r)};return o.writeByte=function(n){for(r=r<<8|255&n,t+=8,e+=1;t>=6;)i(r>>>t-6),t-=6},o.flush=function(){if(t>0&&(i(r<<6-t),r=0,t=0),0!=e%3)for(var o=3-e%3,a=0;o>a;a+=1)n+="="},o.toString=function(){return n},o},s=function(r){var t=r,e=0,n=0,o=0,i={};i.read=function(){for(;8>o;){if(e>=t.length){if(0==o)return-1;throw new Error("unexpected end of file./"+o)}var r=t.charAt(e);if(e+=1,"="==r)return o=0,-1;r.match(/^\s$/)||(n=n<<6|a(r.charCodeAt(0)),o+=6)}var i=255&n>>>o-8;return o-=8,i};var a=function(r){if(r>=65&&90>=r)return r-65;if(r>=97&&122>=r)return r-97+26;if(r>=48&&57>=r)return r-48+52;if(43==r)return 62;if(47==r)return 63;throw new Error("c:"+r)};return i},h=function(r,t){var e=r,n=t,o=new Array(r*t),i={};i.setPixel=function(r,t,n){o[t*e+r]=n},i.write=function(r){r.writeString("GIF87a"),r.writeShort(e),r.writeShort(n),r.writeByte(128),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(0),r.writeByte(255),r.writeByte(255),r.writeByte(255),r.writeString(","),r.writeShort(0),r.writeShort(0),r.writeShort(e),r.writeShort(n),r.writeByte(0);var t=2,o=u(t);r.writeByte(t);for(var i=0;o.length-i>255;)r.writeByte(255),r.writeBytes(o,i,255),i+=255;r.writeByte(o.length-i),r.writeBytes(o,i,o.length-i),r.writeByte(0),r.writeString(";")};var a=function(r){var t=r,e=0,n=0,o={};return o.write=function(r,o){if(0!=r>>>o)throw new Error("length over");for(;e+o>=8;)t.writeByte(255&(r<>>=8-e,n=0,e=0;n=r<0&&t.writeByte(n)},o},u=function(r){for(var t=1<u;u+=1)i.add(String.fromCharCode(u));i.add(String.fromCharCode(t)),i.add(String.fromCharCode(e));var l=c(),g=a(l);g.write(t,n);var s=0,h=String.fromCharCode(o[s]);for(s+=1;si;i+=1)for(var a=0;r>a;a+=1)o.setPixel(a,i,e(a,i));var u=c();o.write(u);for(var f=g(),l=u.toByteArray(),s=0;s"};return t}()}(jQuery);
\ No newline at end of file
diff --git a/resources/qr/qrcode.php b/resources/qr/qrcode.php
deleted file mode 100644
index e36e6aa2e3..0000000000
--- a/resources/qr/qrcode.php
+++ /dev/null
@@ -1,1470 +0,0 @@
-typeNumber = 1;
- $this->errorCorrectLevel = QR_ERROR_CORRECT_LEVEL_H;
- $this->qrDataList = array();
- }
-
- function getTypeNumber() {
- return $this->typeNumber;
- }
-
- function setTypeNumber($typeNumber) {
- $this->typeNumber = $typeNumber;
- }
-
- function getErrorCorrectLevel() {
- return $this->errorCorrectLevel;
- }
-
- function setErrorCorrectLevel($errorCorrectLevel) {
- $this->errorCorrectLevel = $errorCorrectLevel;
- }
-
- function addData($data, $mode = 0) {
-
- if ($mode == 0) {
- $mode = QRUtil::getMode($data);
- }
-
- switch($mode) {
- case QR_MODE_NUMBER :
- $this->addDataImpl(new QRNumber($data) );
- break;
-
- case QR_MODE_ALPHA_NUM :
- $this->addDataImpl(new QRAlphaNum($data) );
- break;
-
- case QR_MODE_8BIT_BYTE :
- $this->addDataImpl(new QR8BitByte($data) );
- break;
-
- case QR_MODE_KANJI :
- $this->addDataImpl(new QRKanji($data) );
- break;
-
- default :
- trigger_error("mode:$mode", E_USER_ERROR);
- }
- }
-
- function clearData() {
- $qrDataList = array();
- }
-
- function addDataImpl(&$qrData) {
- $this->qrDataList[] = $qrData;
- }
-
- function getDataCount() {
- return count($this->qrDataList);
- }
-
- function getData($index) {
- return $this->qrDataList[$index];
- }
-
- function isDark($row, $col) {
- if ($this->modules[$row][$col] !== null) {
- return $this->modules[$row][$col];
- } else {
- return false;
- }
- }
-
- function getModuleCount() {
- return $this->moduleCount;
- }
-
- function make() {
- $this->makeImpl(false, $this->getBestMaskPattern() );
- }
-
- function getBestMaskPattern() {
- $minLostPoint = 0;
- $pattern = 0;
- for ($i = 0; $i < 8; $i++) {
- $this->makeImpl(true, $i);
- $lostPoint = QRUtil::getLostPoint($this);
- if ($i == 0 || $minLostPoint > $lostPoint) {
- $minLostPoint = $lostPoint;
- $pattern = $i;
- }
- }
- return $pattern;
- }
-
- function createNullArray($length) {
- $nullArray = array();
- for ($i = 0; $i < $length; $i++) {
- $nullArray[] = null;
- }
- return $nullArray;
- }
-
- function makeImpl($test, $maskPattern) {
- $this->moduleCount = $this->typeNumber * 4 + 17;
-
- $this->modules = array();
- for ($i = 0; $i < $this->moduleCount; $i++) {
- $this->modules[] = QRCode::createNullArray($this->moduleCount);
- }
-
- $this->setupPositionProbePattern(0, 0);
- $this->setupPositionProbePattern($this->moduleCount - 7, 0);
- $this->setupPositionProbePattern(0, $this->moduleCount - 7);
- $this->setupPositionAdjustPattern();
- $this->setupTimingPattern();
- $this->setupTypeInfo($test, $maskPattern);
- if ($this->typeNumber >= 7) {
- $this->setupTypeNumber($test);
- }
- $dataArray = $this->qrDataList;
-
- $data = QRCode::createData($this->typeNumber, $this->errorCorrectLevel, $dataArray);
-
- $this->mapData($data, $maskPattern);
- }
-
- function mapData(&$data, $maskPattern) {
-
- $inc = -1;
- $row = $this->moduleCount - 1;
- $bitIndex = 7;
- $byteIndex = 0;
-
- for ($col = $this->moduleCount - 1; $col > 0; $col -= 2) {
- if ($col == 6) $col--;
- while (true) {
- for ($c = 0; $c < 2; $c++) {
- if ($this->modules[$row][$col - $c] === null) {
- $dark = false;
- if ($byteIndex < count($data) ) {
- $dark = ( ( ($data[$byteIndex] >> $bitIndex) & 1) == 1);
- }
-
- $mask = QRUtil::getMask($maskPattern, $row, $col - $c);
-
- if ($mask) {
- $dark = !$dark;
- }
-
- $this->modules[$row][$col - $c] = $dark;
- $bitIndex--;
-
- if ($bitIndex == -1) {
- $byteIndex++;
- $bitIndex = 7;
- }
- }
- }
- $row += $inc;
-
- if ($row < 0 || $this->moduleCount <= $row) {
- $row -= $inc;
- $inc = -$inc;
- break;
- }
- }
- }
- }
-
- function setupPositionAdjustPattern() {
- $pos = QRUtil::getPatternPosition($this->typeNumber);
- for ($i = 0; $i < count($pos); $i++) {
- for ($j = 0; $j < count($pos); $j++) {
- $row = $pos[$i];
- $col = $pos[$j];
-
- if ($this->modules[$row][$col] !== null) {
- continue;
- }
-
- for ($r = -2; $r <= 2; $r++) {
- for ($c = -2; $c <= 2; $c++) {
- if ($r == -2 || $r == 2 || $c == -2 || $c == 2
- || ($r == 0 && $c == 0) ) {
- $this->modules[$row + $r][$col + $c] = true;
- } else {
- $this->modules[$row + $r][$col + $c] = false;
- }
- }
- }
- }
- }
- }
-
- function setupPositionProbePattern($row, $col) {
-
- for ($r = -1; $r <= 7; $r++) {
-
- for ($c = -1; $c <= 7; $c++) {
-
- if ($row + $r <= -1 || $this->moduleCount <= $row + $r
- || $col + $c <= -1 || $this->moduleCount <= $col + $c) {
- continue;
- }
-
- if ( (0 <= $r && $r <= 6 && ($c == 0 || $c == 6) )
- || (0 <= $c && $c <= 6 && ($r == 0 || $r == 6) )
- || (2 <= $r && $r <= 4 && 2 <= $c && $c <= 4) ) {
- $this->modules[$row + $r][$col + $c] = true;
- } else {
- $this->modules[$row + $r][$col + $c] = false;
- }
- }
- }
- }
-
- function setupTimingPattern() {
-
- for ($r = 8; $r < $this->moduleCount - 8; $r++) {
- if ($this->modules[$r][6] !== null) {
- continue;
- }
- $this->modules[$r][6] = ($r % 2 == 0);
- }
-
- for ($c = 8; $c < $this->moduleCount - 8; $c++) {
- if ($this->modules[6][$c] !== null) {
- continue;
- }
- $this->modules[6][$c] = ($c % 2 == 0);
- }
- }
-
- function setupTypeNumber($test) {
-
- $bits = QRUtil::getBCHTypeNumber($this->typeNumber);
-
- for ($i = 0; $i < 18; $i++) {
- $mod = (!$test && ( ($bits >> $i) & 1) == 1);
- $this->modules[floor($i / 3)][$i % 3 + $this->moduleCount - 8 - 3] = $mod;
- }
-
- for ($i = 0; $i < 18; $i++) {
- $mod = (!$test && ( ($bits >> $i) & 1) == 1);
- $this->modules[$i % 3 + $this->moduleCount - 8 - 3][floor($i / 3)] = $mod;
- }
- }
-
- function setupTypeInfo($test, $maskPattern) {
-
- $data = ($this->errorCorrectLevel << 3) | $maskPattern;
- $bits = QRUtil::getBCHTypeInfo($data);
-
- for ($i = 0; $i < 15; $i++) {
-
- $mod = (!$test && ( ($bits >> $i) & 1) == 1);
-
- if ($i < 6) {
- $this->modules[$i][8] = $mod;
- } else if ($i < 8) {
- $this->modules[$i + 1][8] = $mod;
- } else {
- $this->modules[$this->moduleCount - 15 + $i][8] = $mod;
- }
- }
-
- for ($i = 0; $i < 15; $i++) {
-
- $mod = (!$test && ( ($bits >> $i) & 1) == 1);
-
- if ($i < 8) {
- $this->modules[8][$this->moduleCount - $i - 1] = $mod;
- } else if ($i < 9) {
- $this->modules[8][15 - $i - 1 + 1] = $mod;
- } else {
- $this->modules[8][15 - $i - 1] = $mod;
- }
- }
-
- $this->modules[$this->moduleCount - 8][8] = !$test;
- }
-
- function createData($typeNumber, $errorCorrectLevel, $dataArray) {
-
- $rsBlocks = QRRSBlock::getRSBlocks($typeNumber, $errorCorrectLevel);
-
- $buffer = new QRBitBuffer();
-
- for ($i = 0; $i < count($dataArray); $i++) {
- $data = $dataArray[$i];
- $buffer->put($data->getMode(), 4);
- $buffer->put($data->getLength(), $data->getLengthInBits($typeNumber) );
- $data->write($buffer);
- }
-
- $totalDataCount = 0;
- for ($i = 0; $i < count($rsBlocks); $i++) {
- $totalDataCount += $rsBlocks[$i]->getDataCount();
- }
-/*
- if ($buffer->getLengthInBits() > $totalDataCount * 8) {
- trigger_error("code length overflow. ("
- . $buffer->getLengthInBits()
- . ">"
- . $totalDataCount * 8
- . ")", E_USER_ERROR);
- }
-*/
- // end code.
- if ($buffer->getLengthInBits() + 4 <= $totalDataCount * 8) {
- $buffer->put(0, 4);
- }
-
- // padding
- while ($buffer->getLengthInBits() % 8 != 0) {
- $buffer->putBit(false);
- }
-
- // padding
- while (true) {
-
- if ($buffer->getLengthInBits() >= $totalDataCount * 8) {
- break;
- }
- $buffer->put(QR_PAD0, 8);
-
- if ($buffer->getLengthInBits() >= $totalDataCount * 8) {
- break;
- }
- $buffer->put(QR_PAD1, 8);
- }
-
- return QRCode::createBytes($buffer, $rsBlocks);
- }
-
- function createBytes(&$buffer, &$rsBlocks) {
-
- $offset = 0;
-
- $maxDcCount = 0;
- $maxEcCount = 0;
-
- $dcdata = QRCode::createNullArray(count($rsBlocks) );
- $ecdata = QRCode::createNullArray(count($rsBlocks) );
-
- for ($r = 0; $r < count($rsBlocks); $r++) {
-
- $dcCount = $rsBlocks[$r]->getDataCount();
- $ecCount = $rsBlocks[$r]->getTotalCount() - $dcCount;
-
- $maxDcCount = max($maxDcCount, $dcCount);
- $maxEcCount = max($maxEcCount, $ecCount);
-
- $dcdata[$r] = QRCode::createNullArray($dcCount);
- for ($i = 0; $i < count($dcdata[$r]); $i++) {
- $bdata = $buffer->getBuffer();
- $dcdata[$r][$i] = 0xff & $bdata[$i + $offset];
- }
- $offset += $dcCount;
-
- $rsPoly = QRUtil::getErrorCorrectPolynomial($ecCount);
- $rawPoly = new QRPolynomial($dcdata[$r], $rsPoly->getLength() - 1);
-
- $modPoly = $rawPoly->mod($rsPoly);
- $ecdata[$r] = QRCode::createNullArray($rsPoly->getLength() - 1);
- for ($i = 0; $i < count($ecdata[$r]); $i++) {
- $modIndex = $i + $modPoly->getLength() - count($ecdata[$r]);
- $ecdata[$r][$i] = ($modIndex >= 0)? $modPoly->get($modIndex) : 0;
- }
- }
-
- $totalCodeCount = 0;
- for ($i = 0; $i < count($rsBlocks); $i++) {
- $totalCodeCount += $rsBlocks[$i]->getTotalCount();
- }
-
- $data = QRCode::createNullArray($totalCodeCount);
-
- $index = 0;
-
- for ($i = 0; $i < $maxDcCount; $i++) {
- for ($r = 0; $r < count($rsBlocks); $r++) {
- if ($i < count($dcdata[$r]) ) {
- $data[$index++] = $dcdata[$r][$i];
- }
- }
- }
-
- for ($i = 0; $i < $maxEcCount; $i++) {
- for ($r = 0; $r < count($rsBlocks); $r++) {
- if ($i < count($ecdata[$r]) ) {
- $data[$index++] = $ecdata[$r][$i];
- }
- }
- }
-
- return $data;
- }
-
- function getMinimumQRCode($data, $errorCorrectLevel) {
-
- $mode = QRUtil::getMode($data);
-
- $qr = new QRCode();
- $qr->setErrorCorrectLevel($errorCorrectLevel);
- $qr->addData($data, $mode);
-
- $qrData = $qr->getData(0);
- $length = $qrData->getLength();
-
- for ($typeNumber = 1; $typeNumber <= 10; $typeNumber++) {
- if ($length <= QRUtil::getMaxLength($typeNumber, $mode, $errorCorrectLevel) ) {
- $qr->setTypeNumber($typeNumber);
- break;
- }
- }
-
- $qr->make();
-
- return $qr;
- }
-
- function createImage($size = 2, $margin = 2) {
-
- $image_size = $this->getModuleCount() * $size + $margin * 2;
-
- $image = imagecreatetruecolor($image_size, $image_size);
-
- $black = imagecolorallocate($image, 0, 0, 0);
- $white = imagecolorallocate($image, 255, 255, 255);
-
- imagefilledrectangle($image, 0, 0, $image_size, $image_size, $white);
-
- for ($r = 0; $r < $this->getModuleCount(); $r++) {
- for ($c = 0; $c < $this->getModuleCount(); $c++) {
- if ($this->isDark($r, $c) ) {
-
- imagefilledrectangle($image,
- $margin + $c * $size,
- $margin + $r * $size,
- $margin + ($c + 1) * $size - 1,
- $margin + ($r + 1) * $size - 1,
- $black);
- }
- }
- }
-
- return $image;
- }
-
-
- function printHTML($size = "2px") {
-
- $style = "border-style:none;border-collapse:collapse;margin:0px;padding:0px;";
-
- print("");
-
- for ($r = 0; $r < $this->getModuleCount(); $r++) {
-
- print("");
-
- for ($c = 0; $c < $this->getModuleCount(); $c++) {
- $color = $this->isDark($r, $c)? "#000000" : "#ffffff";
- print(" | ");
- }
-
- print(" ");
- }
-
- print(" ");
- }
-}
-
-//---------------------------------------------------------------
-// QRUtil
-//---------------------------------------------------------------
-
-$QR_PATTERN_POSITION_TABLE = array(
- array(),
- array(6, 18),
- array(6, 22),
- array(6, 26),
- array(6, 30),
- array(6, 34),
- array(6, 22, 38),
- array(6, 24, 42),
- array(6, 26, 46),
- array(6, 28, 50),
- array(6, 30, 54),
- array(6, 32, 58),
- array(6, 34, 62),
- array(6, 26, 46, 66),
- array(6, 26, 48, 70),
- array(6, 26, 50, 74),
- array(6, 30, 54, 78),
- array(6, 30, 56, 82),
- array(6, 30, 58, 86),
- array(6, 34, 62, 90),
- array(6, 28, 50, 72, 94),
- array(6, 26, 50, 74, 98),
- array(6, 30, 54, 78, 102),
- array(6, 28, 54, 80, 106),
- array(6, 32, 58, 84, 110),
- array(6, 30, 58, 86, 114),
- array(6, 34, 62, 90, 118),
- array(6, 26, 50, 74, 98, 122),
- array(6, 30, 54, 78, 102, 126),
- array(6, 26, 52, 78, 104, 130),
- array(6, 30, 56, 82, 108, 134),
- array(6, 34, 60, 86, 112, 138),
- array(6, 30, 58, 86, 114, 142),
- array(6, 34, 62, 90, 118, 146),
- array(6, 30, 54, 78, 102, 126, 150),
- array(6, 24, 50, 76, 102, 128, 154),
- array(6, 28, 54, 80, 106, 132, 158),
- array(6, 32, 58, 84, 110, 136, 162),
- array(6, 26, 54, 82, 110, 138, 166),
- array(6, 30, 58, 86, 114, 142, 170)
-);
-
-$QR_MAX_LENGTH = array(
- array( array(41, 25, 17, 10), array(34, 20, 14, 8), array(27, 16, 11, 7), array(17, 10, 7, 4) ),
- array( array(77, 47, 32, 20), array(63, 38, 26, 16), array(48, 29, 20, 12), array(34, 20, 14, 8) ),
- array( array(127, 77, 53, 32), array(101, 61, 42, 26), array(77, 47, 32, 20), array(58, 35, 24, 15) ),
- array( array(187, 114, 78, 48), array(149, 90, 62, 38), array(111, 67, 46, 28), array(82, 50, 34, 21) ),
- array( array(255, 154, 106, 65), array(202, 122, 84, 52), array(144, 87, 60, 37), array(106, 64, 44, 27) ),
- array( array(322, 195, 134, 82), array(255, 154, 106, 65), array(178, 108, 74, 45), array(139, 84, 58, 36) ),
- array( array(370, 224, 154, 95), array(293, 178, 122, 75), array(207, 125, 86, 53), array(154, 93, 64, 39) ),
- array( array(461, 279, 192, 118), array(365, 221, 152, 93), array(259, 157, 108, 66), array(202, 122, 84, 52) ),
- array( array(552, 335, 230, 141), array(432, 262, 180, 111), array(312, 189, 130, 80), array(235, 143, 98, 60) ),
- array( array(652, 395, 271, 167), array(513, 311, 213, 131), array(364, 221, 151, 93), array(288, 174, 119, 74) )
-);
-
-
-define("QR_G15", (1 << 10) | (1 << 8) | (1 << 5)
- | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0) );
-
-define("QR_G18", (1 << 12) | (1 << 11) | (1 << 10)
- | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0) );
-
-define("QR_G15_MASK", (1 << 14) | (1 << 12) | (1 << 10)
- | (1 << 4) | (1 << 1) );
-
-class QRUtil {
-
- function getPatternPosition($typeNumber) {
- global $QR_PATTERN_POSITION_TABLE;
- return $QR_PATTERN_POSITION_TABLE[$typeNumber - 1];
- }
-
- function getMaxLength($typeNumber, $mode, $errorCorrectLevel) {
-
- global $QR_MAX_LENGTH;
-
- $t = $typeNumber - 1;
- $e = 0;
- $m = 0;
-
- switch($errorCorrectLevel) {
- case QR_ERROR_CORRECT_LEVEL_L : $e = 0; break;
- case QR_ERROR_CORRECT_LEVEL_M : $e = 1; break;
- case QR_ERROR_CORRECT_LEVEL_Q : $e = 2; break;
- case QR_ERROR_CORRECT_LEVEL_H : $e = 3; break;
- default :
- trigger_error("e:$errorCorrectLevel", E_USER_ERROR);
- }
-
- switch($mode) {
- case QR_MODE_NUMBER : $m = 0; break;
- case QR_MODE_ALPHA_NUM : $m = 1; break;
- case QR_MODE_8BIT_BYTE : $m = 2; break;
- case QR_MODE_KANJI : $m = 3; break;
- default :
- trigger_error("m:$mode", E_USER_ERROR);
- }
-
- return $QR_MAX_LENGTH[$t][$e][$m];
- }
-
- function getErrorCorrectPolynomial($errorCorrectLength) {
-
- $a = new QRPolynomial(array(1) );
-
- for ($i = 0; $i < $errorCorrectLength; $i++) {
- $a = $a->multiply(new QRPolynomial(array(1, QRMath::gexp($i) ) ) );
- }
-
- return $a;
- }
-
- function getMask($maskPattern, $i, $j) {
-
- switch ($maskPattern) {
-
- case QR_MASK_PATTERN000 : return ($i + $j) % 2 == 0;
- case QR_MASK_PATTERN001 : return $i % 2 == 0;
- case QR_MASK_PATTERN010 : return $j % 3 == 0;
- case QR_MASK_PATTERN011 : return ($i + $j) % 3 == 0;
- case QR_MASK_PATTERN100 : return (floor($i / 2) + floor($j / 3) ) % 2 == 0;
- case QR_MASK_PATTERN101 : return ($i * $j) % 2 + ($i * $j) % 3 == 0;
- case QR_MASK_PATTERN110 : return ( ($i * $j) % 2 + ($i * $j) % 3) % 2 == 0;
- case QR_MASK_PATTERN111 : return ( ($i * $j) % 3 + ($i + $j) % 2) % 2 == 0;
-
- default :
- trigger_error("mask:$maskPattern", E_USER_ERROR);
- }
- }
-
- function getLostPoint($qrCode) {
-
- $moduleCount = $qrCode->getModuleCount();
-
- $lostPoint = 0;
-
-
- // LEVEL1
-
- for ($row = 0; $row < $moduleCount; $row++) {
-
- for ($col = 0; $col < $moduleCount; $col++) {
-
- $sameCount = 0;
- $dark = $qrCode->isDark($row, $col);
-
- for ($r = -1; $r <= 1; $r++) {
-
- if ($row + $r < 0 || $moduleCount <= $row + $r) {
- continue;
- }
-
- for ($c = -1; $c <= 1; $c++) {
-
- if ($col + $c < 0 || $moduleCount <= $col + $c) {
- continue;
- }
-
- if ($r == 0 && $c == 0) {
- continue;
- }
-
- if ($dark == $qrCode->isDark($row + $r, $col + $c) ) {
- $sameCount++;
- }
- }
- }
-
- if ($sameCount > 5) {
- $lostPoint += (3 + $sameCount - 5);
- }
- }
- }
-
- // LEVEL2
-
- for ($row = 0; $row < $moduleCount - 1; $row++) {
- for ($col = 0; $col < $moduleCount - 1; $col++) {
- $count = 0;
- if ($qrCode->isDark($row, $col ) ) $count++;
- if ($qrCode->isDark($row + 1, $col ) ) $count++;
- if ($qrCode->isDark($row, $col + 1) ) $count++;
- if ($qrCode->isDark($row + 1, $col + 1) ) $count++;
- if ($count == 0 || $count == 4) {
- $lostPoint += 3;
- }
- }
- }
-
- // LEVEL3
-
- for ($row = 0; $row < $moduleCount; $row++) {
- for ($col = 0; $col < $moduleCount - 6; $col++) {
- if ($qrCode->isDark($row, $col)
- && !$qrCode->isDark($row, $col + 1)
- && $qrCode->isDark($row, $col + 2)
- && $qrCode->isDark($row, $col + 3)
- && $qrCode->isDark($row, $col + 4)
- && !$qrCode->isDark($row, $col + 5)
- && $qrCode->isDark($row, $col + 6) ) {
- $lostPoint += 40;
- }
- }
- }
-
- for ($col = 0; $col < $moduleCount; $col++) {
- for ($row = 0; $row < $moduleCount - 6; $row++) {
- if ($qrCode->isDark($row, $col)
- && !$qrCode->isDark($row + 1, $col)
- && $qrCode->isDark($row + 2, $col)
- && $qrCode->isDark($row + 3, $col)
- && $qrCode->isDark($row + 4, $col)
- && !$qrCode->isDark($row + 5, $col)
- && $qrCode->isDark($row + 6, $col) ) {
- $lostPoint += 40;
- }
- }
- }
-
- // LEVEL4
-
- $darkCount = 0;
-
- for ($col = 0; $col < $moduleCount; $col++) {
- for ($row = 0; $row < $moduleCount; $row++) {
- if ($qrCode->isDark($row, $col) ) {
- $darkCount++;
- }
- }
- }
-
- $ratio = abs(100 * $darkCount / $moduleCount / $moduleCount - 50) / 5;
- $lostPoint += $ratio * 10;
-
- return $lostPoint;
- }
-
- function getMode($s) {
- if (QRUtil::isAlphaNum($s) ) {
- if (QRUtil::isNumber($s) ) {
- return QR_MODE_NUMBER;
- }
- return QR_MODE_ALPHA_NUM;
- } else if (QRUtil::isKanji($s) ) {
- return QR_MODE_KANJI;
- } else {
- return QR_MODE_8BIT_BYTE;
- }
- }
-
- function isNumber($s) {
- for ($i = 0; $i < strlen($s); $i++) {
- $c = ord($s[$i]);
- if (!(QRUtil::toCharCode('0') <= $c && $c <= QRUtil::toCharCode('9') ) ) {
- return false;
- }
- }
- return true;
- }
-
- function isAlphaNum($s) {
- for ($i = 0; $i < strlen($s); $i++) {
- $c = ord($s[$i]);
- if (!(QRUtil::toCharCode('0') <= $c && $c <= QRUtil::toCharCode('9') )
- && !(QRUtil::toCharCode('A') <= $c && $c <= QRUtil::toCharCode('Z') )
- && strpos(" $%*+-./:", $s[$i]) === false) {
- return false;
- }
- }
- return true;
- }
-
- function isKanji($s) {
-
- $data = $s;
-
- $i = 0;
-
- while ($i + 1 < strlen($data) ) {
-
- $c = ( (0xff & ord($data[$i]) ) << 8) | (0xff & ord($data[$i + 1]) );
-
- if (!(0x8140 <= $c && $c <= 0x9FFC) && !(0xE040 <= $c && $c <= 0xEBBF) ) {
- return false;
- }
-
- $i += 2;
- }
-
- if ($i < strlen($data) ) {
- return false;
- }
-
- return true;
- }
-
- function toCharCode($s) {
- return ord($s[0]);
- }
-
- function getBCHTypeInfo($data) {
- $d = $data << 10;
- while (QRUtil::getBCHDigit($d) - QRUtil::getBCHDigit(QR_G15) >= 0) {
- $d ^= (QR_G15 << (QRUtil::getBCHDigit($d) - QRUtil::getBCHDigit(QR_G15) ) );
- }
- return ( ($data << 10) | $d) ^ QR_G15_MASK;
- }
-
- function getBCHTypeNumber($data) {
- $d = $data << 12;
- while (QRUtil::getBCHDigit($d) - QRUtil::getBCHDigit(QR_G18) >= 0) {
- $d ^= (QR_G18 << (QRUtil::getBCHDigit($d) - QRUtil::getBCHDigit(QR_G18) ) );
- }
- return ($data << 12) | $d;
- }
-
- function getBCHDigit($data) {
-
- $digit = 0;
-
- while ($data != 0) {
- $digit++;
- $data >>= 1;
- }
-
- return $digit;
- }
-}
-
-//---------------------------------------------------------------
-// QRRSBlock
-//---------------------------------------------------------------
-
-$QR_RS_BLOCK_TABLE = array(
-
- // L
- // M
- // Q
- // H
-
- // 1
- array(1, 26, 19),
- array(1, 26, 16),
- array(1, 26, 13),
- array(1, 26, 9),
-
- // 2
- array(1, 44, 34),
- array(1, 44, 28),
- array(1, 44, 22),
- array(1, 44, 16),
-
- // 3
- array(1, 70, 55),
- array(1, 70, 44),
- array(2, 35, 17),
- array(2, 35, 13),
-
- // 4
- array(1, 100, 80),
- array(2, 50, 32),
- array(2, 50, 24),
- array(4, 25, 9),
-
- // 5
- array(1, 134, 108),
- array(2, 67, 43),
- array(2, 33, 15, 2, 34, 16),
- array(2, 33, 11, 2, 34, 12),
-
- // 6
- array(2, 86, 68),
- array(4, 43, 27),
- array(4, 43, 19),
- array(4, 43, 15),
-
- // 7
- array(2, 98, 78),
- array(4, 49, 31),
- array(2, 32, 14, 4, 33, 15),
- array(4, 39, 13, 1, 40, 14),
-
- // 8
- array(2, 121, 97),
- array(2, 60, 38, 2, 61, 39),
- array(4, 40, 18, 2, 41, 19),
- array(4, 40, 14, 2, 41, 15),
-
- // 9
- array(2, 146, 116),
- array(3, 58, 36, 2, 59, 37),
- array(4, 36, 16, 4, 37, 17),
- array(4, 36, 12, 4, 37, 13),
-
- // 10
- array(2, 86, 68, 2, 87, 69),
- array(4, 69, 43, 1, 70, 44),
- array(6, 43, 19, 2, 44, 20),
- array(6, 43, 15, 2, 44, 16)
-
-);
-
-class QRRSBlock {
-
- var $totalCount;
- var $dataCount;
-
- function QRRSBlock($totalCount, $dataCount) {
- $this->totalCount = $totalCount;
- $this->dataCount = $dataCount;
- }
-
- function getDataCount() {
- return $this->dataCount;
- }
-
- function getTotalCount() {
- return $this->totalCount;
- }
-
- function getRSBlocks($typeNumber, $errorCorrectLevel) {
-
- $rsBlock = QRRSBlock::getRsBlockTable($typeNumber, $errorCorrectLevel);
- $length = count($rsBlock) / 3;
-
- $list = array();
-
- for ($i = 0; $i < $length; $i++) {
-
- $count = $rsBlock[$i * 3 + 0];
- $totalCount = $rsBlock[$i * 3 + 1];
- $dataCount = $rsBlock[$i * 3 + 2];
-
- for ($j = 0; $j < $count; $j++) {
- $list[] = new QRRSBlock($totalCount, $dataCount);
- }
- }
-
- return $list;
- }
-
- function getRsBlockTable($typeNumber, $errorCorrectLevel) {
-
- global $QR_RS_BLOCK_TABLE;
-
- switch($errorCorrectLevel) {
- case QR_ERROR_CORRECT_LEVEL_L :
- return $QR_RS_BLOCK_TABLE[($typeNumber - 1) * 4 + 0];
- case QR_ERROR_CORRECT_LEVEL_M :
- return $QR_RS_BLOCK_TABLE[($typeNumber - 1) * 4 + 1];
- case QR_ERROR_CORRECT_LEVEL_Q :
- return $QR_RS_BLOCK_TABLE[($typeNumber - 1) * 4 + 2];
- case QR_ERROR_CORRECT_LEVEL_H :
- return $QR_RS_BLOCK_TABLE[($typeNumber - 1) * 4 + 3];
- default :
- trigger_error("tn:$typeNumber/ecl:$errorCorrectLevel", E_USER_ERROR);
- }
- }
-}
-
-//---------------------------------------------------------------
-// QRNumber
-//---------------------------------------------------------------
-
-class QRNumber extends QRData {
-
- function QRNumber($data) {
- QRData::QRData(QR_MODE_NUMBER, $data);
- }
-
- function write(&$buffer) {
-
- $data = $this->getData();
-
- $i = 0;
-
- while ($i + 2 < strlen($data) ) {
- $num = QRNumber::parseInt(substr($data, $i, 3) );
- $buffer->put($num, 10);
- $i += 3;
- }
-
- if ($i < strlen($data) ) {
-
- if (strlen($data) - $i == 1) {
- $num = QRNumber::parseInt(substr($data, $i, $i + 1) );
- $buffer->put($num, 4);
- } else if (strlen($data) - $i == 2) {
- $num = QRNumber::parseInt(substr($data, $i, $i + 2) );
- $buffer->put($num, 7);
- }
- }
- }
-
- function getLength() {
- return strlen($this->getData() );
- }
-
- function parseInt($s) {
-
- $num = 0;
- for ($i = 0; $i < strlen($s); $i++) {
- $num = $num * 10 + QRNumber::parseIntAt(ord($s[$i]) );
- }
- return $num;
- }
-
- function parseIntAt($c) {
-
- if (QRUtil::toCharCode('0') <= $c && $c <= QRUtil::toCharCode('9') ) {
- return $c - QRUtil::toCharCode('0');
- }
-
- trigger_error("illegal char : $c", E_USER_ERROR);
- }
-}
-
-//---------------------------------------------------------------
-// QRKanji
-//---------------------------------------------------------------
-
-class QRKanji extends QRData {
-
- function QRKanji($data) {
- QRData::QRData(QR_MODE_KANJI, $data);
- }
-
- function write(&$buffer) {
-
- $data = $this->getData();
-
- $i = 0;
-
- while ($i + 1 < strlen($data) ) {
-
- $c = ( (0xff & ord($data[$i]) ) << 8) | (0xff & ord($data[$i + 1]) );
-
- if (0x8140 <= $c && $c <= 0x9FFC) {
- $c -= 0x8140;
- } else if (0xE040 <= $c && $c <= 0xEBBF) {
- $c -= 0xC140;
- } else {
- trigger_error("illegal char at " . ($i + 1) . "/$c", E_USER_ERROR);
- }
-
- $c = ( ($c >> 8) & 0xff) * 0xC0 + ($c & 0xff);
-
- $buffer->put($c, 13);
-
- $i += 2;
- }
-
- if ($i < strlen($data) ) {
- trigger_error("illegal char at " . ($i + 1), E_USER_ERROR);
- }
- }
-
- function getLength() {
- return floor(strlen($this->getData() ) / 2);
- }
-}
-
-//---------------------------------------------------------------
-// QRAlphaNum
-//---------------------------------------------------------------
-
-class QRAlphaNum extends QRData {
-
- function QRAlphaNum($data) {
- QRData::QRData(QR_MODE_ALPHA_NUM, $data);
- }
-
- function write(&$buffer) {
-
- $i = 0;
- $c = $this->getData();
-
- while ($i + 1 < strlen($c) ) {
- $buffer->put(QRAlphaNum::getCode(ord($c[$i]) ) * 45
- + QRAlphaNum::getCode(ord($c[$i + 1]) ), 11);
- $i += 2;
- }
-
- if ($i < strlen($c) ) {
- $buffer->put(QRAlphaNum::getCode(ord($c[$i])), 6);
- }
- }
-
- function getLength() {
- return strlen($this->getData() );
- }
-
- function getCode($c) {
-
- if (QRUtil::toCharCode('0') <= $c
- && $c <= QRUtil::toCharCode('9') ) {
- return $c - QRUtil::toCharCode('0');
- } else if (QRUtil::toCharCode('A') <= $c
- && $c <= QRUtil::toCharCode('Z') ) {
- return $c - QRUtil::toCharCode('A') + 10;
- } else {
- switch ($c) {
- case QRUtil::toCharCode(' ') : return 36;
- case QRUtil::toCharCode('$') : return 37;
- case QRUtil::toCharCode('%') : return 38;
- case QRUtil::toCharCode('*') : return 39;
- case QRUtil::toCharCode('+') : return 40;
- case QRUtil::toCharCode('-') : return 41;
- case QRUtil::toCharCode('.') : return 42;
- case QRUtil::toCharCode('/') : return 43;
- case QRUtil::toCharCode(':') : return 44;
- default :
- trigger_error("illegal char : $c", E_USER_ERROR);
- }
- }
-
- }
-}
-
-//---------------------------------------------------------------
-// QR8BitByte
-//---------------------------------------------------------------
-
-class QR8BitByte extends QRData {
-
- function QR8BitByte($data) {
- QRData::QRData(QR_MODE_8BIT_BYTE, $data);
- }
-
- function write(&$buffer) {
-
- $data = $this->getData();
- for ($i = 0; $i < strlen($data); $i++) {
- $buffer->put(ord($data[$i]), 8);
- }
- }
-
- function getLength() {
- return strlen($this->getData() );
- }
-}
-
-//---------------------------------------------------------------
-// QRData
-//---------------------------------------------------------------
-
-class QRData {
-
- var $mode;
-
- var $data;
-
- function QRData($mode, $data) {
- $this->mode = $mode;
- $this->data = $data;
- }
-
- function getMode() {
- return $this->mode;
- }
-
- function getData() {
- return $this->data;
- }
-
- function getLength() {
- trigger_error("not implemented.", E_USER_ERROR);
- }
-
- function write(&$buffer) {
- trigger_error("not implemented.", E_USER_ERROR);
- }
-
- function getLengthInBits($type) {
-
- if (1 <= $type && $type < 10) {
-
- // 1 - 9
-
- switch($this->mode) {
- case QR_MODE_NUMBER : return 10;
- case QR_MODE_ALPHA_NUM : return 9;
- case QR_MODE_8BIT_BYTE : return 8;
- case QR_MODE_KANJI : return 8;
- default :
- trigger_error("mode:$this->mode", E_USER_ERROR);
- }
-
- } else if ($type < 27) {
-
- // 10 - 26
-
- switch($this->mode) {
- case QR_MODE_NUMBER : return 12;
- case QR_MODE_ALPHA_NUM : return 11;
- case QR_MODE_8BIT_BYTE : return 16;
- case QR_MODE_KANJI : return 10;
- default :
- trigger_error("mode:$this->mode", E_USER_ERROR);
- }
-
- } else if ($type < 41) {
-
- // 27 - 40
-
- switch($this->mode) {
- case QR_MODE_NUMBER : return 14;
- case QR_MODE_ALPHA_NUM : return 13;
- case QR_MODE_8BIT_BYTE : return 16;
- case QR_MODE_KANJI : return 12;
- default :
- trigger_error("mode:$this->mode", E_USER_ERROR);
- }
-
- } else {
- trigger_error("mode:$this->mode", E_USER_ERROR);
- }
- }
-
-}
-
-//---------------------------------------------------------------
-// QRMath
-//---------------------------------------------------------------
-
-$QR_MATH_EXP_TABLE = null;
-$QR_MATH_LOG_TABLE = null;
-
-class QRMath {
-
- function init() {
-
- global $QR_MATH_EXP_TABLE;
- global $QR_MATH_LOG_TABLE;
-
- $QR_MATH_EXP_TABLE = QRMath::createNumArray(256);
-
- for ($i = 0; $i < 8; $i++) {
- $QR_MATH_EXP_TABLE[$i] = 1 << $i;
- }
-
- for ($i = 8; $i < 256; $i++) {
- $QR_MATH_EXP_TABLE[$i] = $QR_MATH_EXP_TABLE[$i - 4]
- ^ $QR_MATH_EXP_TABLE[$i - 5]
- ^ $QR_MATH_EXP_TABLE[$i - 6]
- ^ $QR_MATH_EXP_TABLE[$i - 8];
- }
-
- $QR_MATH_LOG_TABLE = QRMath::createNumArray(256);
-
- for ($i = 0; $i < 255; $i++) {
- $QR_MATH_LOG_TABLE[$QR_MATH_EXP_TABLE[$i] ] = $i;
- }
- }
-
- function createNumArray($length) {
- $num_array = array();
- for ($i = 0; $i < $length; $i++) {
- $num_array[] = 0;
- }
- return $num_array;
- }
-
- function glog($n) {
- global $QR_MATH_LOG_TABLE;
- if ($n < 1) {
- trigger_error("log($n)", E_USER_ERROR);
- }
- return $QR_MATH_LOG_TABLE[$n];
- }
-
- function gexp($n) {
- global $QR_MATH_EXP_TABLE;
- while ($n < 0) {
- $n += 255;
- }
- while ($n >= 256) {
- $n -= 255;
- }
- return $QR_MATH_EXP_TABLE[$n];
- }
-}
-
-// init static table
-QRMath::init();
-
-//---------------------------------------------------------------
-// QRPolynomial
-//---------------------------------------------------------------
-
-class QRPolynomial {
-
- var $num;
-
- function QRPolynomial($num, $shift = 0) {
- $offset = 0;
-
- while ($offset < count($num) && $num[$offset] == 0) {
- $offset++;
- }
-
- $this->num = QRMath::createNumArray(count($num) - $offset + $shift);
- for ($i = 0; $i < count($num) - $offset; $i++) {
- $this->num[$i] = $num[$i + $offset];
- }
- }
-
- function get($index) {
- return $this->num[$index];
- }
-
- function getLength() {
- return count($this->num);
- }
-
- // PHP5
- function __toString() {
- return $this->toString();
- }
-
- function toString() {
- $buffer = "";
- for ($i = 0; $i < $this->getLength(); $i++) {
- if ($i > 0) {
- $buffer .= ",";
- }
- $buffer .= $this->get($i);
- }
- return $buffer;
- }
-
- function toLogString() {
- $buffer = "";
- for ($i = 0; $i < $this->getLength(); $i++) {
- if ($i > 0) {
- $buffer .= ",";
- }
- $buffer .= QRMath::glog($this->get(i) );
- }
- return $buffer;
- }
-
- function multiply($e) {
- $num = QRMath::createNumArray($this->getLength() + $e->getLength() - 1);
- for ($i = 0; $i < $this->getLength(); $i++) {
- for ($j = 0; $j < $e->getLength(); $j++) {
- $num[$i + $j] ^= QRMath::gexp(QRMath::glog($this->get($i) ) + QRMath::glog($e->get($j) ) );
- }
- }
- return new QRPolynomial($num);
- }
-
- function mod($e) {
- if ($this->getLength() - $e->getLength() < 0) {
- return $this;
- }
- $ratio = QRMath::glog($this->get(0) ) - QRMath::glog($e->get(0) );
- $num = QRMath::createNumArray($this->getLength() );
- for ($i = 0; $i < $this->getLength(); $i++) {
- $num[$i] = $this->get($i);
- }
- for ($i = 0; $i < $e->getLength(); $i++) {
- $num[$i] ^= QRMath::gexp(QRMath::glog($e->get($i) ) + $ratio);
- }
- $newPolynomial = new QRPolynomial($num);
- return $newPolynomial->mod($e);
- }
-}
-
-//---------------------------------------------------------------
-// Mode
-//---------------------------------------------------------------
-
-define("QR_MODE_NUMBER", 1 << 0);
-define("QR_MODE_ALPHA_NUM", 1 << 1);
-define("QR_MODE_8BIT_BYTE", 1 << 2);
-define("QR_MODE_KANJI", 1 << 3);
-
-//---------------------------------------------------------------
-// MaskPattern
-//---------------------------------------------------------------
-
-define("QR_MASK_PATTERN000", 0);
-define("QR_MASK_PATTERN001", 1);
-define("QR_MASK_PATTERN010", 2);
-define("QR_MASK_PATTERN011", 3);
-define("QR_MASK_PATTERN100", 4);
-define("QR_MASK_PATTERN101", 5);
-define("QR_MASK_PATTERN110", 6);
-define("QR_MASK_PATTERN111", 7);
-
-//---------------------------------------------------------------
-// ErrorCorrectLevel
-
-// 7%.
-define("QR_ERROR_CORRECT_LEVEL_L", 1);
-// 15%.
-define("QR_ERROR_CORRECT_LEVEL_M", 0);
-// 25%.
-define("QR_ERROR_CORRECT_LEVEL_Q", 3);
-// 30%.
-define("QR_ERROR_CORRECT_LEVEL_H", 2);
-
-
-//---------------------------------------------------------------
-// QRBitBuffer
-//---------------------------------------------------------------
-
-class QRBitBuffer {
- var $buffer;
- var $length;
-
- function QRBitBuffer() {
- $this->buffer = array();
- $this->length = 0;
- }
-
- function getBuffer() {
- return $this->buffer;
- }
-
- function getLengthInBits() {
- return $this->length;
- }
-
- function __toString() {
- $buffer = "";
- for ($i = 0; $i < $this->getLengthInBits(); $i++) {
- $buffer .= $this->get($i)? '1' : '0';
- }
- return $buffer;
- }
-
- function get($index) {
- $bufIndex = floor($index / 8);
- return ( ($this->buffer[$bufIndex] >> (7 - $index % 8) ) & 1) == 1;
- }
-
- function put($num, $length) {
- for ($i = 0; $i < $length; $i++) {
- $this->putBit( ( ($num >> ($length - $i - 1) ) & 1) == 1);
- }
- }
-
- function putBit($bit) {
- $bufIndex = floor($this->length / 8);
- if (count($this->buffer) <= $bufIndex) {
- $this->buffer[] = 0;
- }
- if ($bit) {
- $this->buffer[$bufIndex] |= (0x80 >> ($this->length % 8) );
- }
- $this->length++;
- }
-}
-
-?>
\ No newline at end of file
diff --git a/themes/accessible/template.php b/themes/accessible/template.php
index 1d3f38ed6f..ea57381529 100644
--- a/themes/accessible/template.php
+++ b/themes/accessible/template.php
@@ -493,6 +493,15 @@ function confirmdelete(url) {
}
?>
+ ";
+ echo " ";
+ echo "";
+ ?>
+
diff --git a/themes/classic/template.php b/themes/classic/template.php
index f3e491b3c9..8742a70910 100644
--- a/themes/classic/template.php
+++ b/themes/classic/template.php
@@ -591,6 +591,15 @@ function confirmdelete(url) {
}
?>
+ ";
+ echo " ";
+ echo "";
+ ?>
+
diff --git a/themes/default/template.php b/themes/default/template.php
index e053df5e9f..7c0894ca31 100644
--- a/themes/default/template.php
+++ b/themes/default/template.php
@@ -736,39 +736,46 @@ function confirmdelete(url) {
}
?>
- 1000) { break; };
+ $x++;
}
- elseif (substr($new_path, -3) == ".db") {
- //ignore .db files
- }
- else {
- $new_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $new_path);
- $v_background_array[] = $new_path;
- }
- if ($x > 1000) { break; };
- $x++;
}
- }
- if (strlen($_SESSION['background_image'])== 0) {
- $_SESSION['background_image'] = $v_background_array[array_rand($v_background_array, 1)];
- }
+ if (strlen($_SESSION['background_image'])== 0) {
+ $_SESSION['background_image'] = $v_background_array[array_rand($v_background_array, 1)];
+ }
- //show the background
- echo "\n";
-?>
+ //show the background
+ echo "\n";
+ ?>
+ ";
+ echo " ";
+ echo "";
+ ?>
diff --git a/themes/enhanced/template.php b/themes/enhanced/template.php
index facd16d4c0..ff2d7abc8d 100644
--- a/themes/enhanced/template.php
+++ b/themes/enhanced/template.php
@@ -1098,6 +1098,15 @@ legend {
}
?>
+ ";
+ echo " ";
+ echo "";
+ ?>
+
|