From b0687c328fcaa4d891b31c2146694654cd4707c9 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 00:43:33 -0400 Subject: Organize files into directories --- data/templates/base.htm | 6 +-- data/templates/exception.htm | 2 +- www/css/phorkie.css | 110 +++++++++++++++++++++++++++++++++++++++++++ www/jquery-1.7.2.min.js | 4 -- www/js/jquery-1.7.2.min.js | 4 ++ www/js/phorkie.js | 53 +++++++++++++++++++++ www/phorkie.css | 110 ------------------------------------------- www/phorkie.js | 53 --------------------- 8 files changed, 171 insertions(+), 171 deletions(-) create mode 100644 www/css/phorkie.css delete mode 100644 www/jquery-1.7.2.min.js create mode 100644 www/js/jquery-1.7.2.min.js create mode 100644 www/js/phorkie.js delete mode 100644 www/phorkie.css delete mode 100644 www/phorkie.js diff --git a/data/templates/base.htm b/data/templates/base.htm index b9c9608..2b8544b 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -4,10 +4,10 @@ - + {% block title %}{% endblock %} - {{title}} - - + + {% block meta %}{% endblock %} diff --git a/data/templates/exception.htm b/data/templates/exception.htm index dc07fc5..7a96da0 100644 --- a/data/templates/exception.htm +++ b/data/templates/exception.htm @@ -1,7 +1,7 @@ - + Error - phorkie diff --git a/www/css/phorkie.css b/www/css/phorkie.css new file mode 100644 index 0000000..c8d8dce --- /dev/null +++ b/www/css/phorkie.css @@ -0,0 +1,110 @@ +/* show IDs for anchors */ +a.anchorlink:before { + font-size: smaller; + content: '_'; + color: transparent; +} +h1[id]:hover a.anchorlink:before, +h2[id]:hover a.anchorlink:before, +h3[id]:hover a.anchorlink:before, +h4[id]:hover a.anchorlink:before, +h5[id]:hover a.anchorlink:before, +h6[id]:hover a.anchorlink:before { + content: "\00B6";/* pilcrow */ + color: #888; + font-size: smaller; +} +a.anchorlink { + text-decoration: none; + margin-left: 0.5em; + font-size: smaller; +} +.navbar .brand { + /*float: right;*/ + color: #DDA; + text-shadow: 0 0 30px rgba(255, 255, 255, .9); +} +.navbar .brand:hover { + color: #FFA; +} + +.navbar .container { + width: 940px; +} +.footer { + margin-top: 36px; + margin-bottom: 0px; + border-top: 1px solid #DDD; + color: #999; + text-align: center; +} + +h1 { + margin-bottom: 0.5ex; +} + +.repo-info { + margin-bottom: 2em; +} +.file .header { + padding: 1.0ex; + margin-bottom: 1em; + background-color: whiteSmoke; + border: 1px solid #EEE; + border: 1px solid rgba(0, 0, 0, 0.05); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.file .header .btn-mini { + margin-left: 2px; +} +.file .code { + margin-left: 2em; +} +.file .image { + margin-bottom: 2ex; +} + +div.annotations div.alert { + margin-bottom: 1ex; +} + +ul.history li { + padding-left: 2px; + padding-bottom: 1px; +} +ul.history li.active { + background-color: #EEE; + border-radius: 3px; +} +ul.history a.hash { + font-family: monospace; +} + + +ul.pager { + margin-top: 2ex; +} + +form textarea.content { + width: 100%; + box-sizing: border-box; + font-family: monospace; +} +form .allwidth { + box-sizing: border-box; +} +form .allwidth label { + width: 20%; + float: left; +} +form input#description { + box-sizing: border-box; + height: 2em; + width: 100%; +} + +form label.inline { + display: inline; +} \ No newline at end of file diff --git a/www/jquery-1.7.2.min.js b/www/jquery-1.7.2.min.js deleted file mode 100644 index 16ad06c..0000000 --- a/www/jquery-1.7.2.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v1.7.2 jquery.com | jquery.org/license */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( -a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f -.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/www/js/jquery-1.7.2.min.js b/www/js/jquery-1.7.2.min.js new file mode 100644 index 0000000..16ad06c --- /dev/null +++ b/www/js/jquery-1.7.2.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.2 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/www/js/phorkie.js b/www/js/phorkie.js new file mode 100644 index 0000000..1171b1a --- /dev/null +++ b/www/js/phorkie.js @@ -0,0 +1,53 @@ +function filenameChange(elem, id) { + var filename = elem.value; + var hasExt = filename.indexOf(".") != -1; + if (hasExt) { + $('#typeselect_' + id).hide(); + $('#typetext_' + id).show(); + } else { + $('#typeselect_' + id).show(); + $('#typetext_' + id).hide(); + } +} + +function initEdit() +{ + initFilenames(); + initAdditionals(); + $('.filegroup:visible:last textarea').focus(); +} +function initFilenames() +{ + $('input.filename').each( + function(num, elem) { + var id = elem.id; + var pos = id.indexOf('_'); + if (pos != -1) { + var elemNum = id.substr(pos + 1); + if (elemNum != 'new') { + filenameChange(elem, elemNum); + } + } + } + ); +} +function initAdditionals() +{ + $('a.additional-btn').each( + function(num, elem) { + toggleAdditional(elem, 0); + $(elem).show(); + } + ); +} + +function toggleAdditional(elem, time) +{ + if (undefined == time) { + time = 'fast'; + } + var jt = jQuery(elem); + jt.children('i').toggleClass('icon-chevron-down') + .toggleClass('icon-chevron-up'); + jt.parents('.row-fluid').children('.additional').toggle(time); +} \ No newline at end of file diff --git a/www/phorkie.css b/www/phorkie.css deleted file mode 100644 index c8d8dce..0000000 --- a/www/phorkie.css +++ /dev/null @@ -1,110 +0,0 @@ -/* show IDs for anchors */ -a.anchorlink:before { - font-size: smaller; - content: '_'; - color: transparent; -} -h1[id]:hover a.anchorlink:before, -h2[id]:hover a.anchorlink:before, -h3[id]:hover a.anchorlink:before, -h4[id]:hover a.anchorlink:before, -h5[id]:hover a.anchorlink:before, -h6[id]:hover a.anchorlink:before { - content: "\00B6";/* pilcrow */ - color: #888; - font-size: smaller; -} -a.anchorlink { - text-decoration: none; - margin-left: 0.5em; - font-size: smaller; -} -.navbar .brand { - /*float: right;*/ - color: #DDA; - text-shadow: 0 0 30px rgba(255, 255, 255, .9); -} -.navbar .brand:hover { - color: #FFA; -} - -.navbar .container { - width: 940px; -} -.footer { - margin-top: 36px; - margin-bottom: 0px; - border-top: 1px solid #DDD; - color: #999; - text-align: center; -} - -h1 { - margin-bottom: 0.5ex; -} - -.repo-info { - margin-bottom: 2em; -} -.file .header { - padding: 1.0ex; - margin-bottom: 1em; - background-color: whiteSmoke; - border: 1px solid #EEE; - border: 1px solid rgba(0, 0, 0, 0.05); - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.file .header .btn-mini { - margin-left: 2px; -} -.file .code { - margin-left: 2em; -} -.file .image { - margin-bottom: 2ex; -} - -div.annotations div.alert { - margin-bottom: 1ex; -} - -ul.history li { - padding-left: 2px; - padding-bottom: 1px; -} -ul.history li.active { - background-color: #EEE; - border-radius: 3px; -} -ul.history a.hash { - font-family: monospace; -} - - -ul.pager { - margin-top: 2ex; -} - -form textarea.content { - width: 100%; - box-sizing: border-box; - font-family: monospace; -} -form .allwidth { - box-sizing: border-box; -} -form .allwidth label { - width: 20%; - float: left; -} -form input#description { - box-sizing: border-box; - height: 2em; - width: 100%; -} - -form label.inline { - display: inline; -} \ No newline at end of file diff --git a/www/phorkie.js b/www/phorkie.js deleted file mode 100644 index 1171b1a..0000000 --- a/www/phorkie.js +++ /dev/null @@ -1,53 +0,0 @@ -function filenameChange(elem, id) { - var filename = elem.value; - var hasExt = filename.indexOf(".") != -1; - if (hasExt) { - $('#typeselect_' + id).hide(); - $('#typetext_' + id).show(); - } else { - $('#typeselect_' + id).show(); - $('#typetext_' + id).hide(); - } -} - -function initEdit() -{ - initFilenames(); - initAdditionals(); - $('.filegroup:visible:last textarea').focus(); -} -function initFilenames() -{ - $('input.filename').each( - function(num, elem) { - var id = elem.id; - var pos = id.indexOf('_'); - if (pos != -1) { - var elemNum = id.substr(pos + 1); - if (elemNum != 'new') { - filenameChange(elem, elemNum); - } - } - } - ); -} -function initAdditionals() -{ - $('a.additional-btn').each( - function(num, elem) { - toggleAdditional(elem, 0); - $(elem).show(); - } - ); -} - -function toggleAdditional(elem, time) -{ - if (undefined == time) { - time = 'fast'; - } - var jt = jQuery(elem); - jt.children('i').toggleClass('icon-chevron-down') - .toggleClass('icon-chevron-up'); - jt.parents('.row-fluid').children('.additional').toggle(time); -} \ No newline at end of file -- cgit v1.2.3 From a73791f16d10ea0e2c477f29d9049d75516aa774 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 01:17:46 -0400 Subject: Added OpenID Authentication --- data/config.default.php | 5 + data/config.php.dist | 4 + data/templates/base.htm | 8 ++ data/templates/forbidden.htm | 21 ++++ data/templates/login.htm | 44 +++++++ src/openid/config.php | 55 +++++++++ src/openid/wrapper.php | 27 +++++ www/.htaccess | 4 + www/auth.php | 258 ++++++++++++++++++++++++++++++++++++++++ www/css/debug.css | 85 +++++++++++++ www/css/openid.css | 64 ++++++++++ www/delete.php | 3 + www/display.php | 3 + www/edit.php | 3 + www/forbidden.php | 11 ++ www/fork.php | 3 + www/images/access_denied.png | Bin 0 -> 15610 bytes www/images/google.gif | Bin 0 -> 1596 bytes www/images/openid-inputicon.gif | Bin 0 -> 237 bytes www/images/yahoo.gif | Bin 0 -> 1682 bytes www/index.php | 3 + www/list.php | 5 +- www/login.php | 11 ++ www/new.php | 3 + www/raw.php | 3 + www/revision.php | 3 + www/secure.php | 11 ++ www/www-header.php | 4 + 28 files changed, 640 insertions(+), 1 deletion(-) create mode 100644 data/templates/forbidden.htm create mode 100644 data/templates/login.htm create mode 100644 src/openid/config.php create mode 100644 src/openid/wrapper.php create mode 100644 www/auth.php create mode 100644 www/css/debug.css create mode 100644 www/css/openid.css create mode 100644 www/forbidden.php create mode 100644 www/images/access_denied.png create mode 100644 www/images/google.gif create mode 100644 www/images/openid-inputicon.gif create mode 100644 www/images/yahoo.gif create mode 100644 www/login.php create mode 100644 www/secure.php diff --git a/data/config.default.php b/data/config.default.php index 88c9ae5..7ecbda3 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -12,6 +12,11 @@ $GLOBALS['phorkie']['cfg'] = array( 'geshi' => 'MediaWiki/geshi/geshi/geshi.php', 'index' => 'new'//"new" or "list" ); +$GLOBALS['phorkie']['auth'] = array( + 'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication + 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate + 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits +); $GLOBALS['phorkie']['tools'] = array( '\\phorkie\\Tool_Xmllint' => true, '\\phorkie\\Tool_PHPlint' => true, diff --git a/data/config.php.dist b/data/config.php.dist index 1e814bd..e90f704 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -5,4 +5,8 @@ //$GLOBALS['phorkie']['cfg']['git']['private'] = 'ssh://git@bogo:paste/'; //$GLOBALS['phorkie']['cfg']['elasticsearch'] = 'http://localhost:9200/phorkie/'; //$GLOBALS['phorkie']['cfg']['setupcheck'] = false; +//$GLOBALS['phorkie']['users'] = array( +// 'https://www.google.com/accounts/o8/id?id=ABCDEFGHIJKLMNOPQRSTUVWXYZ', +// 'http://anonymous.phorkie.openid' +//); ?> diff --git a/data/templates/base.htm b/data/templates/base.htm index 2b8544b..8192b6b 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -25,6 +25,14 @@
  • List all
  • + {% if identity %} +
  • + {{name}} ({{email}}) +
  • +
  • + Logout +
  • + {% endif %} {% if db.adapter %}
  • diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm new file mode 100644 index 0000000..ad40a9f --- /dev/null +++ b/data/templates/forbidden.htm @@ -0,0 +1,21 @@ +{% extends "base.htm" %} +{% block title %}Access Denied{% endblock %} + +{% block content %} + +
    + Access Denied + +
    +{% endblock %} + +{% block sidebar %} + {% if recents.results %} +

    Recently created

    +
      + {% for repo in recents.repos %} + {% include 'repo-sidebar-list.htm' %} + {% endfor %} +
    + {% endif %} +{% endblock %} diff --git a/data/templates/login.htm b/data/templates/login.htm new file mode 100644 index 0000000..13d86be --- /dev/null +++ b/data/templates/login.htm @@ -0,0 +1,44 @@ +{% extends "base.htm" %} +{% block title %}Login{% endblock %} + +{% block content %} + + + + + + + + + + + +
    + Sign-in +
    +

    Please choose your account provider

    +
    + + +
    +
    +

    or enter your OpenID URL.

    + + +
    +
    +
    +{% endblock %} + +{% block sidebar %} + {% if recents.results %} +

    Recently created

    +
      + {% for repo in recents.repos %} + {% include 'repo-sidebar-list.htm' %} + {% endfor %} +
    + {% endif %} +{% endblock %} diff --git a/src/openid/config.php b/src/openid/config.php new file mode 100644 index 0000000..fdec5e1 --- /dev/null +++ b/src/openid/config.php @@ -0,0 +1,55 @@ + + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ + +set_include_path(dirname(__FILE__) . '/../../:' . get_include_path()); + +/** + * Required files + */ +require_once 'OpenID/RelyingParty.php'; +require_once 'OpenID/Discover.php'; +require_once 'OpenID/Store.php'; +require_once 'OpenID/Extension/SREG10.php'; +require_once 'OpenID/Extension/SREG11.php'; +require_once 'OpenID/Extension/AX.php'; +require_once 'OpenID/Extension/UI.php'; +require_once 'OpenID/Extension/OAuth.php'; +require_once 'OpenID/Message.php'; +require_once 'OpenID/Observer/Log.php'; +require_once 'Net/URL2.php'; + +// Determine realm and return_to +$base = 'http'; +if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { + $base .= 's'; +} +$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']; + +$realm = $base . '/'; +$returnTo = $base . dirname($_SERVER['PHP_SELF']); +if ($returnTo[strlen($returnTo) - 1] != '/') { + $returnTo .= '/'; +} +$returnTo .= 'auth'; + +// SQL storage example +// $storeOptions = array( +// 'dsn' => 'mysql://user:pass@db.example.com/openid' +// ); +// OpenID::setStore(OpenID_Store::factory('MDB2', $storeOptions)); +// +// // The first time you run it, you'll also need to create the tables: +// OpenID::getStore()->createTables(); + +?> diff --git a/src/openid/wrapper.php b/src/openid/wrapper.php new file mode 100644 index 0000000..cb57f4e --- /dev/null +++ b/src/openid/wrapper.php @@ -0,0 +1,27 @@ + + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ +?> + + + PEAR OpenID Debug + + + + + + diff --git a/www/.htaccess b/www/.htaccess index a8f2eed..fd2963b 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -19,3 +19,7 @@ RewriteRule ^list/([0-9]+)$ /list.php?page=$1 RewriteRule ^search$ /search.php RewriteRule ^search/([0-9]+)$ /search.php?page=$1 + +RewriteRule ^auth$ /auth.php +RewriteRule ^login$ /login.php +RewriteRule ^forbidden$ /forbidden.php diff --git a/www/auth.php b/www/auth.php new file mode 100644 index 0000000..8fe38e0 --- /dev/null +++ b/www/auth.php @@ -0,0 +1,258 @@ + + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid + */ + +// A tool for testing Relying Party functionality +set_include_path( + __DIR__ . '/../../src/' + . PATH_SEPARATOR . get_include_path() +); + +require_once 'www-header.php'; +require_once 'openid/config.php'; + + +if (isset($_REQUEST['logout'])) { + unset($_SESSION); + session_destroy(); + $redirect = 'http://' . $_SERVER['HTTP_HOST']; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; +} + +if (!count($_GET) && !count($_POST)) { + $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/login"; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; +} + +// Hackaround Non-Javascript Login Page +if (!count($_POST) && isset($_GET['start'])) { + $_POST = $_GET; +} + +if (isset($_POST['identifier'])) { + $identifier = $_POST['identifier']; +} else if (isset($_SESSION['identifier'])) { + $identifier = $_SESSION['identifier']; +} else { + $identifier = null; +} + +try { + $o = new OpenID_RelyingParty($returnTo, $realm, $identifier); +} catch (OpenID_Exception $e) { + $contents = "
    \n"; + $contents .= "
    " . $e->getMessage() . "
    \n"; + $contents .= "
    "; + include_once 'openid/wrapper.php'; + exit; +} + +if (!empty($_POST['disable_associations']) + || !empty($_SESSION['disable_associations'])) { + + $o->disableAssociations(); + $_SESSION['disable_associations'] = true; +} + +$log = new OpenID_Observer_Log; +OpenID::attach($log); + +if (isset($_POST['start'])) { + + $_SESSION['identifier'] = $identifier; + try { + $authRequest = $o->prepare(); + } catch (OpenID_Exception $e) { + $contents = "
    \n"; + $contents .= "
    " . $e->getMessage() . "
    \n"; + $contents .= "
    "; + include_once 'openid/wrapper.php'; + exit; + } + + // checkid_immediate + if (!empty($_POST['checkid_immediate'])) { + $authRequest->setMode('checkid_immediate'); + } + + // SREG + if (!empty($_POST['sreg'])) { + $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); + $sreg->set('required', 'email,firstname,lastname,nickname'); + $sreg->set('optional', 'gender,dob'); + $authRequest->addExtension($sreg); + } + + // AX + if (!empty($_POST['ax'])) { + $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); + $ax->set('type.email', 'http://axschema.org/contact/email'); + $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); + $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); + $ax->set('mode', 'fetch_request'); + $ax->set('required', 'email,firstname,lastname'); + $authRequest->addExtension($ax); + } + + // UI + if (!empty($_POST['ui'])) { + $ui = new OpenID_Extension_UI(OpenID_Extension::REQUEST); + $ui->set('mode', 'popup'); + $ui->set('language', 'en-US'); + $authRequest->addExtension($ui); + } + + // OAuth + if (!empty($_POST['oauth'])) { + $oauth = new OpenID_Extension_OAuth(OpenID_Extension::REQUEST); + $oauth->set('consumer', $_POST['oauth_consumer_key']); + $_SESSION['OAuth_consumer_key'] = $_POST['oauth_consumer_key']; + $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret']; + + $oauth->set('scope', $_POST['oauth_scope']); + $_SESSION['OAuth_scope'] = $_POST['oauth_scope']; + + $_SESSION['OAuth_access_token_url'] = $_POST['oauth_access_token_url']; + $_SESSION['OAuth_access_token_method'] = $_POST['oauth_access_token_method']; + + $authRequest->addExtension($oauth); + } + + $url = $authRequest->getAuthorizeURL(); + + if (empty($_POST['debug'])) { + header("Location: $url"); + exit; + } + +} else { + if (isset($_SESSION['identifier'])) { + $usid = $_SESSION['identifier']; + unset($_SESSION['identifier']); + } else { + $usid = null; + } + + unset($_SESSION['disable_associations']); + + if (!count($_POST)) { + list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); + } else { + // I hate php sometimes + $queryString = file_get_contents('php://input'); + } + + $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); + $id = $message->get('openid.claimed_id'); + $mode = $message->get('openid.mode'); + + try { + $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), + $message); + + if ($result->success()) { + $status = "
  • "; + } else { + $status = ""; + } + } catch (OpenID_Exception $e) { + $status = ""; + } + + // OAuth hyprid fetching access token + if (isset($_SESSION['OAuth_consumer_key'], + $_SESSION['OAuth_consumer_secret'], + $_SESSION['OAuth_access_token_url'], + $_SESSION['OAuth_access_token_method'])) { + + try { + $oauth = new OpenID_Extension_OAuth(OpenID_Extension::RESPONSE, + $message); + + // Fix line lengths. + $consumerKey = $_SESSION['OAuth_consumer_key']; + $consumerSecret = $_SESSION['OAuth_consumer_key']; + $tokenURL = $_SESSION['OAuth_access_token_url']; + $tokenMethod = $_SESSION['OAuth_access_token_method']; + + $oauthData = $oauth->getAccessToken($consumerKey, + $consumerSecret, + $tokenURL, + array(), + $tokenMethod); + + } catch (Exception $e) { + } + } + + $contents = "
    +

    +

    Status:SUCCESS!"; + $status .= " ({$result->getAssertionMethod()})
    Status:FAIL!"; + $status .= " ({$result->getAssertionMethod()})
    Status:EXCEPTION!"; + $status .= " ({$e->getMessage()} : {$e->getCode()})
    + + + + + $status\n + "; + + foreach ($message->getArrayFormat() as $key => $value) { + $contents .= "\n"; + } + + if (isset($oauthData) && count($oauthData)) { + $contents .= ""; + $contents .= " "; + $contents .= ""; + + foreach ($oauthData as $key => $value) { + $contents .= "\n"; + } + } + + $contents .= "
    Results
    User Supplied Identifier:$usid
    Claimed Identifier:$id
    Mode:$mode


    Message Contents

    $key$value


    OAuth Access token/secret

    $key$value
    "; + $contents .= ""; + + $openid = $message->getArrayFormat(); + if ($GLOBALS['phorkie']['auth']['secure'] > 0 && + $GLOBALS['phorkie']['auth']['userlist']) { + if (!in_array($openid['openid.identity'], $GLOBALS['phorkie']['users'])) { + $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/forbidden"; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; + } + } + // include_once 'openid/wrapper.php'; + + $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; + $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; + $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email; + $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email; + $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail']; + + $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null; + $name = (isset($openid['openid.sreg.firstname']) && isset($openid['openid.sreg.lastname']) && !isset($name)) ? $openid['openid.sreg.firstname']." ".$openid['openid.sreg.lastname'] : $name; + $name = (isset($openid['openid.sreg.nickname']) && !isset($name)) ? $openid['openid.sreg.nickname'] : $name; + $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR']; + + $_SESSION['identity'] = $openid['openid.identity']; + + $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); +} + +?> diff --git a/www/css/debug.css b/www/css/debug.css new file mode 100644 index 0000000..634243a --- /dev/null +++ b/www/css/debug.css @@ -0,0 +1,85 @@ +html, body { + background: #ededed; + font: 82.5% Helvetica Neue, HelveticaNeue, Helvetica, sans-serif; + margin: 30px 0 0; padding: 0px; } + +h3 { + color: #aaa; + margin: 0; padding: 0; + font-size: 1.3em; + + position: absolute; + top: 30px; + width: 100%; + text-align: center; + left: 0; +} + +h3 a { + color: #111; + text-decoration: none; +} + +h3 a:hover { + text-decoration: underline; + +} + +form { + padding: 30px; + background: #fff; + -moz-border-radius: 6px; + -webkit-border-radius: 6px; + width: 400px; + margin: 50px auto 0; + } + +table { + font-size: 1.1em !important; + font-weight: bold; +} + +td { + width: 200px; +} +.discover_results { + margin: 60px 0 ; + padding: 30px; + background: #111; + text-align: center; +} + + +.discover_results b { + color: #fff; + font-size: 2.4em; +} + +.relyingparty_results { + width: 100%; +} + +.relyingparty_results table b { + display: block; + width: 300px; + font-size: 1.7em; + color: #fff; +} + + +pre, .relyingparty_results p table { + font-size: 1.2em; + width: 900px !important; + text-align: left; + margin: 0 auto; + + color: #ddd; + padding: 30px; + +} + +.relyingparty_results { + background: #111; + padding: 30px; + margin: 60px 0; +} diff --git a/www/css/openid.css b/www/css/openid.css new file mode 100644 index 0000000..38988a7 --- /dev/null +++ b/www/css/openid.css @@ -0,0 +1,64 @@ +body { + font-family:"Helvetica Neue", Helvetica, Arial, sans-serif; +} +#openid_form { + width: 470px; +} +#openid_form legend { + font-weight: bold; +} +#openid_choice { + display: none; +} +#openid_input_area { + clear: both; +} +#openid_btns { + height: 66px; + margin-bottom: 10px; +} +#openid_btns br { + clear: both; +} +#openid_highlight { + padding: 3px; + background-color: #FFFCC9; + float: left; +} +#identifier { + margin: 0px !important; + width: 250px; + background: #FFF url(/images/openid-inputicon.gif) no-repeat scroll 0 50%; + padding-left:18px; +} +.openid_large_btn { + width: 100px; + height: 60px; + border: 1px solid #DDD; + margin: 3px; + float: left; +} +.openid_small_btn { + width: 24px; + height: 24px; + border: 1px solid #DDD; + margin: 3px; + float: left; +} +.google { + background: #FFF url(/images/google.gif) no-repeat center center; +} +.yahoo { + background: #FFF url(/images/yahoo.gif) no-repeat center center; +} + +a.openid_large_btn:hover { + outline: none; + border: 1px solid #030303; +} +a.openid_large_btn:focus { + -moz-outline-style: none; +} +.openid_selected { + border: 4px solid #DDD; +} diff --git a/www/delete.php b/www/delete.php index 6d68ae4..f332028 100644 --- a/www/delete.php +++ b/www/delete.php @@ -4,6 +4,9 @@ namespace phorkie; * Delete paste or ask for deletion */ require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] > 0) { + require_once 'secure.php'; +} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/display.php b/www/display.php index c8df8a9..2376d30 100644 --- a/www/display.php +++ b/www/display.php @@ -4,6 +4,9 @@ namespace phorkie; * Display paste contents */ require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] == 2) { + require_once 'secure.php'; +} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/edit.php b/www/edit.php index 562c97c..226b774 100644 --- a/www/edit.php +++ b/www/edit.php @@ -4,6 +4,9 @@ namespace phorkie; * Edit paste contents */ require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] > 0) { + require_once 'secure.php'; +} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/forbidden.php b/www/forbidden.php new file mode 100644 index 0000000..e8fb7ec --- /dev/null +++ b/www/forbidden.php @@ -0,0 +1,11 @@ + diff --git a/www/fork.php b/www/fork.php index 7997632..cc2ed33 100644 --- a/www/fork.php +++ b/www/fork.php @@ -4,6 +4,9 @@ */ namespace phorkie; require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] > 0) { + require_once 'secure.php'; +} if ($_SERVER['REQUEST_METHOD'] !== 'POST') { throw new Exception_Input('Forking only possible via POST'); diff --git a/www/images/access_denied.png b/www/images/access_denied.png new file mode 100644 index 0000000..c13d7b9 Binary files /dev/null and b/www/images/access_denied.png differ diff --git a/www/images/google.gif b/www/images/google.gif new file mode 100644 index 0000000..1b6cd07 Binary files /dev/null and b/www/images/google.gif differ diff --git a/www/images/openid-inputicon.gif b/www/images/openid-inputicon.gif new file mode 100644 index 0000000..cde836c Binary files /dev/null and b/www/images/openid-inputicon.gif differ diff --git a/www/images/yahoo.gif b/www/images/yahoo.gif new file mode 100644 index 0000000..42adbfa Binary files /dev/null and b/www/images/yahoo.gif differ diff --git a/www/index.php b/www/index.php index 9a05add..7ac6fcf 100644 --- a/www/index.php +++ b/www/index.php @@ -1,4 +1,7 @@ diff --git a/www/new.php b/www/new.php index ef9daec..fc6d5f3 100644 --- a/www/new.php +++ b/www/new.php @@ -11,6 +11,9 @@ namespace phorkie; * Creates and redirects to display page */ require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] > 0) { + require_once 'secure.php'; +} $repopo = new Repository_Post(); if ($repopo->process($_POST)) { diff --git a/www/raw.php b/www/raw.php index 8bda11e..67a21ee 100644 --- a/www/raw.php +++ b/www/raw.php @@ -4,6 +4,9 @@ */ namespace phorkie; require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] == 2) { + require_once 'secure.php'; +} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/revision.php b/www/revision.php index 53ac458..06462af 100644 --- a/www/revision.php +++ b/www/revision.php @@ -4,6 +4,9 @@ namespace phorkie; * Display paste contents */ require_once 'www-header.php'; +if ($GLOBALS['phorkie']['auth']['secure'] == 2) { + require_once 'secure.php'; +} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/secure.php b/www/secure.php new file mode 100644 index 0000000..5893033 --- /dev/null +++ b/www/secure.php @@ -0,0 +1,11 @@ + diff --git a/www/www-header.php b/www/www-header.php index 72a2e67..3bb7e89 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -1,5 +1,6 @@ loadTemplate($tplname . '.htm'); -- cgit v1.2.3 From c94d0557180a41557eb85908423fa614567506f0 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 11:27:56 -0400 Subject: www/www-header.php - FIX: non-set _SESSION variables causing 'undefined index' in logs --- www/www-header.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/www-header.php b/www/www-header.php index 3bb7e89..74863e1 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -64,9 +64,11 @@ function render($tplname, $vars) $vars['css'] = $GLOBALS['phorkie']['cfg']['css']; $vars['title'] = $GLOBALS['phorkie']['cfg']['title']; $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar']; - $vars['identity'] = $_SESSION['identity']; - $vars['name'] = $_SESSION['name']; - $vars['email'] = $_SESSION['email']; + if (isset($_SESSION['identity'])) { + $vars['identity'] = $_SESSION['identity']; + $vars['name'] = $_SESSION['name']; + $vars['email'] = $_SESSION['email']; + } $vars['db'] = new Database(); $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm'); @@ -77,4 +79,4 @@ function redirect($target) header('Location: ' . $target); exit(); } -?> \ No newline at end of file +?> -- cgit v1.2.3 From e89b9ef6bc1d93736bfa0f0a4a4ab88690ab900e Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 11:39:13 -0400 Subject: data/templates/login.htm - CLEAN: removed extraneous formatting and unneeded sidebar --- data/templates/login.htm | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/data/templates/login.htm b/data/templates/login.htm index 13d86be..154994a 100644 --- a/data/templates/login.htm +++ b/data/templates/login.htm @@ -3,13 +3,8 @@ {% block content %} - - - @@ -30,15 +25,6 @@ -{% endblock %} -{% block sidebar %} - {% if recents.results %} -

    Recently created

    -
      - {% for repo in recents.repos %} - {% include 'repo-sidebar-list.htm' %} - {% endfor %} -
    - {% endif %} + {% endblock %} -- cgit v1.2.3 From 5119a5d74428296166658ff746010b8c32abd67f Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 11:41:58 -0400 Subject: www/forbidden.php - FIX: added variables for sidebar search --- www/forbidden.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/www/forbidden.php b/www/forbidden.php index e8fb7ec..1f587a2 100644 --- a/www/forbidden.php +++ b/www/forbidden.php @@ -4,8 +4,12 @@ */ namespace phorkie; require_once 'www-header.php'; + +$db = new Database(); render( 'forbidden', - null + array( + 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'), + ) ); ?> -- cgit v1.2.3 From fbaebb7485cfab4948b8fe000ef2a5279b376f04 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 11:53:48 -0400 Subject: FIX: add exit() after header('Location') --- www/auth.php | 5 +++-- www/secure.php | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/www/auth.php b/www/auth.php index 8fe38e0..6d13f7e 100644 --- a/www/auth.php +++ b/www/auth.php @@ -230,10 +230,10 @@ if (isset($_POST['start'])) { $openid = $message->getArrayFormat(); if ($GLOBALS['phorkie']['auth']['secure'] > 0 && $GLOBALS['phorkie']['auth']['userlist']) { - if (!in_array($openid['openid.identity'], $GLOBALS['phorkie']['users'])) { + if (!in_array($openid['openid.identity'], $GLOBALS['phorkie']['users'])) { $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/forbidden"; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; + exit; } } // include_once 'openid/wrapper.php'; @@ -253,6 +253,7 @@ if (isset($_POST['start'])) { $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; } ?> diff --git a/www/secure.php b/www/secure.php index 5893033..07cdfb6 100644 --- a/www/secure.php +++ b/www/secure.php @@ -7,5 +7,6 @@ require_once 'www-header.php'; $_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI']; if (!isset($_SESSION['identity'])) { header("Location: /login"); + exit; } ?> -- cgit v1.2.3 From 57ec8736424dfa1637ea01228b87fbbf458b213f Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 11:58:51 -0400 Subject: ADD: Allow editing of user session data --- data/templates/base.htm | 4 ++-- data/templates/user.htm | 15 +++++++++++++++ www/.htaccess | 1 + www/user.php | 27 +++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 data/templates/user.htm create mode 100644 www/user.php diff --git a/data/templates/base.htm b/data/templates/base.htm index 8192b6b..ec2b746 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -27,7 +27,7 @@ {% if identity %}
  • - {{name}} ({{email}}) + {{name}} ({{email}})
  • Logout @@ -65,4 +65,4 @@ - \ No newline at end of file + diff --git a/data/templates/user.htm b/data/templates/user.htm new file mode 100644 index 0000000..c8ef387 --- /dev/null +++ b/data/templates/user.htm @@ -0,0 +1,15 @@ +{% extends "base.htm" %} +{% block title %}User Preferences{% endblock %} + +{% block content %} + +
    +
    + User Profile +

    Please update your git preferences for {{ identity }}

    +
    +
    + +
    +
    +{% endblock %} diff --git a/www/.htaccess b/www/.htaccess index fd2963b..c1d339d 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -23,3 +23,4 @@ RewriteRule ^search/([0-9]+)$ /search.php?page=$1 RewriteRule ^auth$ /auth.php RewriteRule ^login$ /login.php RewriteRule ^forbidden$ /forbidden.php +RewriteRule ^user$ /user.php diff --git a/www/user.php b/www/user.php new file mode 100644 index 0000000..1cc8aeb --- /dev/null +++ b/www/user.php @@ -0,0 +1,27 @@ + $_SESSION['identity'], + 'name' => $_SESSION['name'], + 'email' => $_SESSION['email'] + ) +); +?> -- cgit v1.2.3 From 7d7fab92064cfb09b152651fc9cb1fe55516fca1 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 13:10:08 -0400 Subject: www/auth.php - CLEAN: removed debugging remnants --- www/auth.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/www/auth.php b/www/auth.php index 6d13f7e..bb4fcb2 100644 --- a/www/auth.php +++ b/www/auth.php @@ -200,33 +200,6 @@ if (isset($_POST['start'])) { } } - $contents = "
    -

    - - - - - - $status\n - "; - - foreach ($message->getArrayFormat() as $key => $value) { - $contents .= "\n"; - } - - if (isset($oauthData) && count($oauthData)) { - $contents .= ""; - $contents .= " "; - $contents .= ""; - - foreach ($oauthData as $key => $value) { - $contents .= "\n"; - } - } - - $contents .= "
    Results
    User Supplied Identifier:$usid
    Claimed Identifier:$id
    Mode:$mode


    Message Contents

    $key$value


    OAuth Access token/secret

    $key$value
    "; - $contents .= "

    "; - $openid = $message->getArrayFormat(); if ($GLOBALS['phorkie']['auth']['secure'] > 0 && $GLOBALS['phorkie']['auth']['userlist']) { -- cgit v1.2.3 From 5935a357efd7be14481b21560347f70116891e16 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 13:52:17 -0400 Subject: ADD: Commit as logged in user --- data/config.default.php | 1 + src/phorkie/Repository/Post.php | 14 ++++++++++---- www/edit.php | 2 +- www/new.php | 2 +- www/www-header.php | 6 ++++++ 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index 7ecbda3..da16241 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -15,6 +15,7 @@ $GLOBALS['phorkie']['cfg'] = array( $GLOBALS['phorkie']['auth'] = array( 'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate + 'anonymousName' => 'Anonymous', // Email for non-authenticated commits 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits ); $GLOBALS['phorkie']['tools'] = array( diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index de987e0..ed44cf1 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -15,7 +15,7 @@ class Repository_Post * * @return boolean True if the post was successful */ - public function process($postData) + public function process($postData, $sessionData) { if (!isset($postData['files'])) { return false; @@ -117,11 +117,17 @@ class Repository_Post } } + $commitmsg = "phorkie commit"; + if (isset($sessionData['identity'])) { + $commitmsg .= " from ".$sessionData['identity']; + } else { + $commitmsg .= " by ".$sessionData['ipaddr']; + } + if ($bCommit) { $vc->getCommand('commit') - ->setOption('message', '') - ->setOption('allow-empty-message') - ->setOption('author', 'Anonymous ') + ->setOption('message', $commitmsg) + ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>') ->execute(); $bChanged = true; } diff --git a/www/edit.php b/www/edit.php index 226b774..db4428b 100644 --- a/www/edit.php +++ b/www/edit.php @@ -12,7 +12,7 @@ $repo = new Repository(); $repo->loadFromRequest(); $repopo = new Repository_Post($repo); -if ($repopo->process($_POST)) { +if ($repopo->process($_POST, $_SESSION)) { redirect($repo->getLink('display')); } diff --git a/www/new.php b/www/new.php index fc6d5f3..8d1a231 100644 --- a/www/new.php +++ b/www/new.php @@ -16,7 +16,7 @@ if ($GLOBALS['phorkie']['auth']['secure'] > 0) { } $repopo = new Repository_Post(); -if ($repopo->process($_POST)) { +if ($repopo->process($_POST, $_SESSION)) { redirect($repopo->repo->getLink('display')); } diff --git a/www/www-header.php b/www/www-header.php index 74863e1..5785a3e 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -47,6 +47,12 @@ if (file_exists(__DIR__ . '/../data/config.php')) { if ($GLOBALS['phorkie']['cfg']['setupcheck']) { SetupCheck::run(); } + +// Set/Get git commit session variables +$_SESSION['ipaddr'] = $_SERVER['REMOTE_ADDR']; +if (!isset($_SESSION['name'])) { $_SESSION['name'] = $GLOBALS['phorkie']['auth']['anonymousName']; } +if (!isset($_SESSION['email'])) { $_SESSION['email'] = $GLOBALS['phorkie']['auth']['anonymousEmail']; } + \Twig_Autoloader::register(); $loader = new \Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']); -- cgit v1.2.3 From 0845bf175dc416cdf107209fc34f7b37bf42b6e6 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 15:17:28 -0400 Subject: data/templates/revision-head.htm - ADD: display commit message --- data/templates/revision-head.htm | 1 + src/phorkie/Repository.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/data/templates/revision-head.htm b/data/templates/revision-head.htm index 132a68f..a5f7e88 100644 --- a/data/templates/revision-head.htm +++ b/data/templates/revision-head.htm @@ -10,6 +10,7 @@ revision {{repo.hash}}

    + message {{repo.message}}

    diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 448982b..6ed3807 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -32,6 +32,12 @@ class Repository */ public $hash; + /** + * Commit message of the last (or current) revision + * + * @var string + */ + public $message; /** @@ -56,6 +62,7 @@ class Repository $this->id = (int)$_GET['id']; $this->loadDirs(); $this->loadHash(); + $this->loadMessage(); } protected function loadDirs() @@ -97,6 +104,23 @@ class Repository $this->hash = $output; } + public function loadMessage() + { + $rev = (isset($this->hash)) ? $this->hash : 'HEAD'; + $output = $this->getVc()->getCommand('log') + ->setOption('oneline') + ->addArgument('-1') + ->addArgument($rev) + ->execute(); + $output = trim($output); + if (strpos($output, ' ') > 0) { + $output = substr($output, strpos($output, ' '), strlen($output)); + $this->message = trim($output); + } else { + $this->message = "This commit message intentionally left blank."; + } + } + public function loadById($id) { if (!is_numeric($id)) { -- cgit v1.2.3 From 2935763e253c3616d951bc18c7d21a56349531fa Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Sun, 16 Sep 2012 15:37:49 -0400 Subject: Updated ChangeLog and README.rst --- ChangeLog | 4 ++++ README.rst | 14 ++++++++++++++ src/phorkie/Repository.php | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7e45b7d..35e7456 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-09-16 Justin J. Novack + + * Add OpenID authentication + 2012-09-08 Christian Weiske * Fix bug #11: do not index edit, delete and tool pages diff --git a/README.rst b/README.rst index c94f29e..56bef95 100644 --- a/README.rst +++ b/README.rst @@ -190,6 +190,15 @@ URLs List all pastes, with optional page ``/new`` Shows form for new paste +``/login`` + Login page for protecting site +``/auth`` + Authentication callback url +``/forbidden`` + Access denied page +``/user`` + Edit logged-in user information + Internal directory layout ========================= @@ -227,4 +236,9 @@ If you use nginx, place the following lines into your ``server`` block: rewrite ^/search$ /search.php; rewrite ^/search/([0-9]+)$ /search.php?page=$1; + + rewrite ^/login$ /login.php; + rewrite ^/auth$ /auth.php; + rewrite ^/forbidden$ /forbidden.php; + rewrite ^/user$ /user.php; } diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 6ed3807..9f8f264 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -118,7 +118,7 @@ class Repository $this->message = trim($output); } else { $this->message = "This commit message intentionally left blank."; - } + } } public function loadById($id) -- cgit v1.2.3 From 76aa2ab76d8f2305db7a2bb7cdbe461cca0146a3 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 09:53:19 -0400 Subject: ADD: Add identity to /forbidden page for easy administration --- data/templates/forbidden.htm | 6 +++++- www/auth.php | 9 --------- www/secure.php | 8 ++++++++ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm index ad40a9f..e6965dd 100644 --- a/data/templates/forbidden.htm +++ b/data/templates/forbidden.htm @@ -5,7 +5,11 @@
    Access Denied - + +

    We're sorry, your identity is not authorized:

    +

    {{ identity }}

    +

    If you feel this message is in error, please notify the site admin + and include your identity.

    {% endblock %} diff --git a/www/auth.php b/www/auth.php index bb4fcb2..b8d08ff 100644 --- a/www/auth.php +++ b/www/auth.php @@ -201,15 +201,6 @@ if (isset($_POST['start'])) { } $openid = $message->getArrayFormat(); - if ($GLOBALS['phorkie']['auth']['secure'] > 0 && - $GLOBALS['phorkie']['auth']['userlist']) { - if (!in_array($openid['openid.identity'], $GLOBALS['phorkie']['users'])) { - $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/forbidden"; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; - } - } - // include_once 'openid/wrapper.php'; $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; diff --git a/www/secure.php b/www/secure.php index 07cdfb6..4b81d59 100644 --- a/www/secure.php +++ b/www/secure.php @@ -9,4 +9,12 @@ if (!isset($_SESSION['identity'])) { header("Location: /login"); exit; } +if ($GLOBALS['phorkie']['auth']['secure'] > 0 && + $GLOBALS['phorkie']['auth']['userlist']) { + if (!in_array($_SESSION['identity'], $GLOBALS['phorkie']['users'])) { + $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/forbidden"; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; + } +} ?> -- cgit v1.2.3 From f9ade082ba49cf487af31339afa7aeeb0653af57 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 13:42:49 -0400 Subject: PEAR Coding Standards intermediate update for files changed --- src/phorkie/Repository.php | 5 +++++ www/auth.php | 11 ++++------- www/delete.php | 2 +- www/display.php | 2 +- www/edit.php | 2 +- www/forbidden.php | 2 +- www/fork.php | 4 ++-- www/list.php | 2 +- www/new.php | 2 +- www/raw.php | 2 +- www/user.php | 2 +- www/www-header.php | 8 ++++++-- 12 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/phorkie/Repository.php b/src/phorkie/Repository.php index 995a16d..43f2b23 100644 --- a/src/phorkie/Repository.php +++ b/src/phorkie/Repository.php @@ -104,6 +104,11 @@ class Repository $this->hash = $output; } + /** + * Populates $this->message + * + * @return void + */ public function loadMessage() { $rev = (isset($this->hash)) ? $this->hash : 'HEAD'; diff --git a/www/auth.php b/www/auth.php index b8d08ff..1cafd59 100644 --- a/www/auth.php +++ b/www/auth.php @@ -27,7 +27,7 @@ if (isset($_REQUEST['logout'])) { session_destroy(); $redirect = 'http://' . $_SERVER['HTTP_HOST']; header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; + exit; } if (!count($_GET) && !count($_POST)) { @@ -59,9 +59,7 @@ try { exit; } -if (!empty($_POST['disable_associations']) - || !empty($_SESSION['disable_associations'])) { - +if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associations'])) { $o->disableAssociations(); $_SESSION['disable_associations'] = true; } @@ -159,8 +157,7 @@ if (isset($_POST['start'])) { $mode = $message->get('openid.mode'); try { - $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), - $message); + $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), $message); if ($result->success()) { $status = "Status:SUCCESS!"; @@ -202,7 +199,7 @@ if (isset($_POST['start'])) { $openid = $message->getArrayFormat(); - $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; + $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email; $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email; diff --git a/www/delete.php b/www/delete.php index f332028..85f6258 100644 --- a/www/delete.php +++ b/www/delete.php @@ -5,7 +5,7 @@ namespace phorkie; */ require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - require_once 'secure.php'; + include_once 'secure.php'; } $repo = new Repository(); diff --git a/www/display.php b/www/display.php index 2376d30..6f754d9 100644 --- a/www/display.php +++ b/www/display.php @@ -5,7 +5,7 @@ namespace phorkie; */ require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] == 2) { - require_once 'secure.php'; + include_once 'secure.php'; } $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index db4428b..20e7793 100644 --- a/www/edit.php +++ b/www/edit.php @@ -5,7 +5,7 @@ namespace phorkie; */ require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - require_once 'secure.php'; + include_once 'secure.php'; } $repo = new Repository(); diff --git a/www/forbidden.php b/www/forbidden.php index 1f587a2..3646b0a 100644 --- a/www/forbidden.php +++ b/www/forbidden.php @@ -1,6 +1,6 @@ 0) { - require_once 'secure.php'; + include_once 'secure.php'; } if ($_SERVER['REQUEST_METHOD'] !== 'POST') { @@ -33,4 +33,4 @@ foreach (\glob($new->gitDir . '/hooks/*') as $hookfile) { //FIXME: where to put fork source link? redirect($new->getLink('display')); -?> \ No newline at end of file +?> diff --git a/www/list.php b/www/list.php index 17f46b1..5a394eb 100644 --- a/www/list.php +++ b/www/list.php @@ -5,7 +5,7 @@ namespace phorkie; require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] == 2) { - require_once 'secure.php'; + include_once 'secure.php'; } $rs = new Repositories(); diff --git a/www/new.php b/www/new.php index 8d1a231..0675b4d 100644 --- a/www/new.php +++ b/www/new.php @@ -12,7 +12,7 @@ namespace phorkie; */ require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - require_once 'secure.php'; + include_once 'secure.php'; } $repopo = new Repository_Post(); diff --git a/www/raw.php b/www/raw.php index 67a21ee..6b20633 100644 --- a/www/raw.php +++ b/www/raw.php @@ -5,7 +5,7 @@ namespace phorkie; require_once 'www-header.php'; if ($GLOBALS['phorkie']['auth']['secure'] == 2) { - require_once 'secure.php'; + include_once 'secure.php'; } $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/user.php b/www/user.php index 1cc8aeb..fd851c4 100644 --- a/www/user.php +++ b/www/user.php @@ -5,7 +5,7 @@ namespace phorkie; require_once 'www-header.php'; if (!isset($_SESSION['identity'])) { - require_once 'secure.php'; + include_once 'secure.php'; } if (isset($_POST['name'])) { diff --git a/www/www-header.php b/www/www-header.php index 5785a3e..64dca11 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -50,8 +50,12 @@ if ($GLOBALS['phorkie']['cfg']['setupcheck']) { // Set/Get git commit session variables $_SESSION['ipaddr'] = $_SERVER['REMOTE_ADDR']; -if (!isset($_SESSION['name'])) { $_SESSION['name'] = $GLOBALS['phorkie']['auth']['anonymousName']; } -if (!isset($_SESSION['email'])) { $_SESSION['email'] = $GLOBALS['phorkie']['auth']['anonymousEmail']; } +if (!isset($_SESSION['name'])) { + $_SESSION['name'] = $GLOBALS['phorkie']['auth']['anonymousName']; +} +if (!isset($_SESSION['email'])) { + $_SESSION['email'] = $GLOBALS['phorkie']['auth']['anonymousEmail']; +} \Twig_Autoloader::register(); -- cgit v1.2.3 From b8b5759174c0734d6682502b4e1830334dd0df13 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 15:20:48 -0400 Subject: FIX: Removed forbidden page, added to secure.php --- README.rst | 3 --- www/.htaccess | 1 - www/forbidden.php | 15 --------------- www/secure.php | 10 ++++++++-- 4 files changed, 8 insertions(+), 21 deletions(-) delete mode 100644 www/forbidden.php diff --git a/README.rst b/README.rst index 56bef95..0b40b39 100644 --- a/README.rst +++ b/README.rst @@ -194,8 +194,6 @@ URLs Login page for protecting site ``/auth`` Authentication callback url -``/forbidden`` - Access denied page ``/user`` Edit logged-in user information @@ -239,6 +237,5 @@ If you use nginx, place the following lines into your ``server`` block: rewrite ^/login$ /login.php; rewrite ^/auth$ /auth.php; - rewrite ^/forbidden$ /forbidden.php; rewrite ^/user$ /user.php; } diff --git a/www/.htaccess b/www/.htaccess index 4c52627..f6c3720 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -23,5 +23,4 @@ RewriteRule ^search/([0-9]+)$ /search.php?page=$1 RewriteRule ^auth$ /auth.php RewriteRule ^login$ /login.php -RewriteRule ^forbidden$ /forbidden.php RewriteRule ^user$ /user.php diff --git a/www/forbidden.php b/www/forbidden.php deleted file mode 100644 index 3646b0a..0000000 --- a/www/forbidden.php +++ /dev/null @@ -1,15 +0,0 @@ - $db->getSearch()->listAll(0, 5, 'crdate', 'desc'), - ) -); -?> diff --git a/www/secure.php b/www/secure.php index 4b81d59..e614087 100644 --- a/www/secure.php +++ b/www/secure.php @@ -12,8 +12,14 @@ if (!isset($_SESSION['identity'])) { if ($GLOBALS['phorkie']['auth']['secure'] > 0 && $GLOBALS['phorkie']['auth']['userlist']) { if (!in_array($_SESSION['identity'], $GLOBALS['phorkie']['users'])) { - $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/forbidden"; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + header('HTTP/1.1 403 Forbidden'); + $db = new Database(); + render( + 'forbidden', + array( + 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'), + ) + ); exit; } } -- cgit v1.2.3 From 13989a4e7cb4453225762dab6b5e5a7565b43df8 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 15:30:15 -0400 Subject: FIX: login - sreg/ax default, identifier renamed to openid_url --- data/templates/login.htm | 6 +++--- www/auth.php | 46 +++++++++++++++++++++------------------------- www/css/openid.css | 2 +- www/www-header.php | 5 ++++- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/data/templates/login.htm b/data/templates/login.htm index 154994a..7e724b0 100644 --- a/data/templates/login.htm +++ b/data/templates/login.htm @@ -15,12 +15,12 @@

    Please choose your account provider

    - - + +

    or enter your OpenID URL.

    - +
    diff --git a/www/auth.php b/www/auth.php index 1cafd59..29d7b37 100644 --- a/www/auth.php +++ b/www/auth.php @@ -41,16 +41,16 @@ if (!count($_POST) && isset($_GET['start'])) { $_POST = $_GET; } -if (isset($_POST['identifier'])) { - $identifier = $_POST['identifier']; -} else if (isset($_SESSION['identifier'])) { - $identifier = $_SESSION['identifier']; +if (isset($_POST['openid_url'])) { + $openid_url = $_POST['openid_url']; +} else if (isset($_SESSION['openid_url'])) { + $openid_url = $_SESSION['openid_url']; } else { - $identifier = null; + $openid_url = null; } try { - $o = new OpenID_RelyingParty($returnTo, $realm, $identifier); + $o = new OpenID_RelyingParty($returnTo, $realm, $openid_url); } catch (OpenID_Exception $e) { $contents = "
    \n"; $contents .= "
    " . $e->getMessage() . "
    \n"; @@ -69,7 +69,7 @@ OpenID::attach($log); if (isset($_POST['start'])) { - $_SESSION['identifier'] = $identifier; + $_SESSION['openid_url'] = $openid_url; try { $authRequest = $o->prepare(); } catch (OpenID_Exception $e) { @@ -86,23 +86,19 @@ if (isset($_POST['start'])) { } // SREG - if (!empty($_POST['sreg'])) { - $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); - $sreg->set('required', 'email,firstname,lastname,nickname'); - $sreg->set('optional', 'gender,dob'); - $authRequest->addExtension($sreg); - } + $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); + $sreg->set('required', 'email,firstname,lastname,nickname'); + $sreg->set('optional', 'gender,dob'); + $authRequest->addExtension($sreg); // AX - if (!empty($_POST['ax'])) { - $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); - $ax->set('type.email', 'http://axschema.org/contact/email'); - $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); - $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); - $ax->set('mode', 'fetch_request'); - $ax->set('required', 'email,firstname,lastname'); - $authRequest->addExtension($ax); - } + $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); + $ax->set('type.email', 'http://axschema.org/contact/email'); + $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); + $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); + $ax->set('mode', 'fetch_request'); + $ax->set('required', 'email,firstname,lastname'); + $authRequest->addExtension($ax); // UI if (!empty($_POST['ui'])) { @@ -136,9 +132,9 @@ if (isset($_POST['start'])) { } } else { - if (isset($_SESSION['identifier'])) { - $usid = $_SESSION['identifier']; - unset($_SESSION['identifier']); + if (isset($_SESSION['openid_url'])) { + $usid = $_SESSION['openid_url']; + unset($_SESSION['openid_url']); } else { $usid = null; } diff --git a/www/css/openid.css b/www/css/openid.css index 38988a7..296618b 100644 --- a/www/css/openid.css +++ b/www/css/openid.css @@ -25,7 +25,7 @@ body { background-color: #FFFCC9; float: left; } -#identifier { +#openid_url { margin: 0px !important; width: 250px; background: #FFF url(/images/openid-inputicon.gif) no-repeat scroll 0 50%; diff --git a/www/www-header.php b/www/www-header.php index 64dca11..96cd481 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -1,6 +1,9 @@ Date: Mon, 17 Sep 2012 15:50:56 -0400 Subject: FIX: Combine auth.php to login.php --- README.rst | 3 - data/templates/login.htm | 6 +- src/openid/config.php | 2 +- www/.htaccess | 1 - www/auth.php | 216 ---------------------------------------------- www/login.php | 217 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 216 insertions(+), 229 deletions(-) delete mode 100644 www/auth.php diff --git a/README.rst b/README.rst index 0b40b39..b92804a 100644 --- a/README.rst +++ b/README.rst @@ -192,8 +192,6 @@ URLs Shows form for new paste ``/login`` Login page for protecting site -``/auth`` - Authentication callback url ``/user`` Edit logged-in user information @@ -236,6 +234,5 @@ If you use nginx, place the following lines into your ``server`` block: rewrite ^/search/([0-9]+)$ /search.php?page=$1; rewrite ^/login$ /login.php; - rewrite ^/auth$ /auth.php; rewrite ^/user$ /user.php; } diff --git a/data/templates/login.htm b/data/templates/login.htm index 7e724b0..418432e 100644 --- a/data/templates/login.htm +++ b/data/templates/login.htm @@ -5,7 +5,7 @@ -
    + @@ -15,8 +15,8 @@

    Please choose your account provider

    - - + +

    or enter your OpenID URL.

    diff --git a/src/openid/config.php b/src/openid/config.php index fdec5e1..76ebc6a 100644 --- a/src/openid/config.php +++ b/src/openid/config.php @@ -41,7 +41,7 @@ $returnTo = $base . dirname($_SERVER['PHP_SELF']); if ($returnTo[strlen($returnTo) - 1] != '/') { $returnTo .= '/'; } -$returnTo .= 'auth'; +$returnTo .= 'login'; // SQL storage example // $storeOptions = array( diff --git a/www/.htaccess b/www/.htaccess index f6c3720..1f03fac 100644 --- a/www/.htaccess +++ b/www/.htaccess @@ -21,6 +21,5 @@ RewriteRule ^list/([0-9]+)$ /list.php?page=$1 RewriteRule ^search$ /search.php RewriteRule ^search/([0-9]+)$ /search.php?page=$1 -RewriteRule ^auth$ /auth.php RewriteRule ^login$ /login.php RewriteRule ^user$ /user.php diff --git a/www/auth.php b/www/auth.php deleted file mode 100644 index 29d7b37..0000000 --- a/www/auth.php +++ /dev/null @@ -1,216 +0,0 @@ - - * @copyright 2009 Bill Shupp - * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD - * @link http://github.com/shupp/openid - */ - -// A tool for testing Relying Party functionality -set_include_path( - __DIR__ . '/../../src/' - . PATH_SEPARATOR . get_include_path() -); - -require_once 'www-header.php'; -require_once 'openid/config.php'; - - -if (isset($_REQUEST['logout'])) { - unset($_SESSION); - session_destroy(); - $redirect = 'http://' . $_SERVER['HTTP_HOST']; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; -} - -if (!count($_GET) && !count($_POST)) { - $redirect = 'http://' . $_SERVER['HTTP_HOST'] . "/login"; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; -} - -// Hackaround Non-Javascript Login Page -if (!count($_POST) && isset($_GET['start'])) { - $_POST = $_GET; -} - -if (isset($_POST['openid_url'])) { - $openid_url = $_POST['openid_url']; -} else if (isset($_SESSION['openid_url'])) { - $openid_url = $_SESSION['openid_url']; -} else { - $openid_url = null; -} - -try { - $o = new OpenID_RelyingParty($returnTo, $realm, $openid_url); -} catch (OpenID_Exception $e) { - $contents = "
    \n"; - $contents .= "
    " . $e->getMessage() . "
    \n"; - $contents .= "
    "; - include_once 'openid/wrapper.php'; - exit; -} - -if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associations'])) { - $o->disableAssociations(); - $_SESSION['disable_associations'] = true; -} - -$log = new OpenID_Observer_Log; -OpenID::attach($log); - -if (isset($_POST['start'])) { - - $_SESSION['openid_url'] = $openid_url; - try { - $authRequest = $o->prepare(); - } catch (OpenID_Exception $e) { - $contents = "
    \n"; - $contents .= "
    " . $e->getMessage() . "
    \n"; - $contents .= "
    "; - include_once 'openid/wrapper.php'; - exit; - } - - // checkid_immediate - if (!empty($_POST['checkid_immediate'])) { - $authRequest->setMode('checkid_immediate'); - } - - // SREG - $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); - $sreg->set('required', 'email,firstname,lastname,nickname'); - $sreg->set('optional', 'gender,dob'); - $authRequest->addExtension($sreg); - - // AX - $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); - $ax->set('type.email', 'http://axschema.org/contact/email'); - $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); - $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); - $ax->set('mode', 'fetch_request'); - $ax->set('required', 'email,firstname,lastname'); - $authRequest->addExtension($ax); - - // UI - if (!empty($_POST['ui'])) { - $ui = new OpenID_Extension_UI(OpenID_Extension::REQUEST); - $ui->set('mode', 'popup'); - $ui->set('language', 'en-US'); - $authRequest->addExtension($ui); - } - - // OAuth - if (!empty($_POST['oauth'])) { - $oauth = new OpenID_Extension_OAuth(OpenID_Extension::REQUEST); - $oauth->set('consumer', $_POST['oauth_consumer_key']); - $_SESSION['OAuth_consumer_key'] = $_POST['oauth_consumer_key']; - $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret']; - - $oauth->set('scope', $_POST['oauth_scope']); - $_SESSION['OAuth_scope'] = $_POST['oauth_scope']; - - $_SESSION['OAuth_access_token_url'] = $_POST['oauth_access_token_url']; - $_SESSION['OAuth_access_token_method'] = $_POST['oauth_access_token_method']; - - $authRequest->addExtension($oauth); - } - - $url = $authRequest->getAuthorizeURL(); - - if (empty($_POST['debug'])) { - header("Location: $url"); - exit; - } - -} else { - if (isset($_SESSION['openid_url'])) { - $usid = $_SESSION['openid_url']; - unset($_SESSION['openid_url']); - } else { - $usid = null; - } - - unset($_SESSION['disable_associations']); - - if (!count($_POST)) { - list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); - } else { - // I hate php sometimes - $queryString = file_get_contents('php://input'); - } - - $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); - $id = $message->get('openid.claimed_id'); - $mode = $message->get('openid.mode'); - - try { - $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), $message); - - if ($result->success()) { - $status = "Status:SUCCESS!"; - $status .= " ({$result->getAssertionMethod()})"; - } else { - $status = "Status:FAIL!"; - $status .= " ({$result->getAssertionMethod()})"; - } - } catch (OpenID_Exception $e) { - $status = "Status:EXCEPTION!"; - $status .= " ({$e->getMessage()} : {$e->getCode()})"; - } - - // OAuth hyprid fetching access token - if (isset($_SESSION['OAuth_consumer_key'], - $_SESSION['OAuth_consumer_secret'], - $_SESSION['OAuth_access_token_url'], - $_SESSION['OAuth_access_token_method'])) { - - try { - $oauth = new OpenID_Extension_OAuth(OpenID_Extension::RESPONSE, - $message); - - // Fix line lengths. - $consumerKey = $_SESSION['OAuth_consumer_key']; - $consumerSecret = $_SESSION['OAuth_consumer_key']; - $tokenURL = $_SESSION['OAuth_access_token_url']; - $tokenMethod = $_SESSION['OAuth_access_token_method']; - - $oauthData = $oauth->getAccessToken($consumerKey, - $consumerSecret, - $tokenURL, - array(), - $tokenMethod); - - } catch (Exception $e) { - } - } - - $openid = $message->getArrayFormat(); - - $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; - $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; - $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email; - $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email; - $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail']; - - $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null; - $name = (isset($openid['openid.sreg.firstname']) && isset($openid['openid.sreg.lastname']) && !isset($name)) ? $openid['openid.sreg.firstname']." ".$openid['openid.sreg.lastname'] : $name; - $name = (isset($openid['openid.sreg.nickname']) && !isset($name)) ? $openid['openid.sreg.nickname'] : $name; - $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR']; - - $_SESSION['identity'] = $openid['openid.identity']; - - $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; -} - -?> diff --git a/www/login.php b/www/login.php index 87c34f4..00d1877 100644 --- a/www/login.php +++ b/www/login.php @@ -1,11 +1,218 @@ + * @copyright 2009 Bill Shupp + * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD + * @link http://github.com/shupp/openid */ namespace phorkie; -require_once 'www-header.php'; -render( - 'login', - null +// A tool for testing Relying Party functionality +set_include_path( + __DIR__ . '/../../src/' + . PATH_SEPARATOR . get_include_path() ); + +require_once 'www-header.php'; +require_once 'openid/config.php'; + + +if (isset($_REQUEST['logout'])) { + unset($_SESSION); + session_destroy(); + $redirect = 'http://' . $_SERVER['HTTP_HOST']; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; +} + +if (!count($_GET) && !count($_POST)) { + render( + 'login', + null + ); + exit; +} + +// Hackaround Non-Javascript Login Page +if (!count($_POST) && isset($_GET['start'])) { + $_POST = $_GET; +} + +if (isset($_POST['openid_url'])) { + $openid_url = $_POST['openid_url']; +} else if (isset($_SESSION['openid_url'])) { + $openid_url = $_SESSION['openid_url']; +} else { + $openid_url = null; +} + +try { + $o = new OpenID_RelyingParty($returnTo, $realm, $openid_url); +} catch (OpenID_Exception $e) { + $contents = "
    \n"; + $contents .= "
    " . $e->getMessage() . "
    \n"; + $contents .= "
    "; + include_once 'openid/wrapper.php'; + exit; +} + +if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associations'])) { + $o->disableAssociations(); + $_SESSION['disable_associations'] = true; +} + +$log = new OpenID_Observer_Log; +OpenID::attach($log); + +if (isset($_POST['start'])) { + + $_SESSION['openid_url'] = $openid_url; + try { + $authRequest = $o->prepare(); + } catch (OpenID_Exception $e) { + $contents = "
    \n"; + $contents .= "
    " . $e->getMessage() . "
    \n"; + $contents .= "
    "; + include_once 'openid/wrapper.php'; + exit; + } + + // checkid_immediate + if (!empty($_POST['checkid_immediate'])) { + $authRequest->setMode('checkid_immediate'); + } + + // SREG + $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); + $sreg->set('required', 'email,firstname,lastname,nickname'); + $sreg->set('optional', 'gender,dob'); + $authRequest->addExtension($sreg); + + // AX + $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); + $ax->set('type.email', 'http://axschema.org/contact/email'); + $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); + $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); + $ax->set('mode', 'fetch_request'); + $ax->set('required', 'email,firstname,lastname'); + $authRequest->addExtension($ax); + + // UI + if (!empty($_POST['ui'])) { + $ui = new OpenID_Extension_UI(OpenID_Extension::REQUEST); + $ui->set('mode', 'popup'); + $ui->set('language', 'en-US'); + $authRequest->addExtension($ui); + } + + // OAuth + if (!empty($_POST['oauth'])) { + $oauth = new OpenID_Extension_OAuth(OpenID_Extension::REQUEST); + $oauth->set('consumer', $_POST['oauth_consumer_key']); + $_SESSION['OAuth_consumer_key'] = $_POST['oauth_consumer_key']; + $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret']; + + $oauth->set('scope', $_POST['oauth_scope']); + $_SESSION['OAuth_scope'] = $_POST['oauth_scope']; + + $_SESSION['OAuth_access_token_url'] = $_POST['oauth_access_token_url']; + $_SESSION['OAuth_access_token_method'] = $_POST['oauth_access_token_method']; + + $authRequest->addExtension($oauth); + } + + $url = $authRequest->getAuthorizeURL(); + + if (empty($_POST['debug'])) { + header("Location: $url"); + exit; + } + +} else { + if (isset($_SESSION['openid_url'])) { + $usid = $_SESSION['openid_url']; + unset($_SESSION['openid_url']); + } else { + $usid = null; + } + + unset($_SESSION['disable_associations']); + + if (!count($_POST)) { + list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); + } else { + // I hate php sometimes + $queryString = file_get_contents('php://input'); + } + + $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); + $id = $message->get('openid.claimed_id'); + $mode = $message->get('openid.mode'); + + try { + $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), $message); + + if ($result->success()) { + $status = "Status:SUCCESS!"; + $status .= " ({$result->getAssertionMethod()})"; + } else { + $status = "Status:FAIL!"; + $status .= " ({$result->getAssertionMethod()})"; + } + } catch (OpenID_Exception $e) { + $status = "Status:EXCEPTION!"; + $status .= " ({$e->getMessage()} : {$e->getCode()})"; + } + + // OAuth hyprid fetching access token + if (isset($_SESSION['OAuth_consumer_key'], + $_SESSION['OAuth_consumer_secret'], + $_SESSION['OAuth_access_token_url'], + $_SESSION['OAuth_access_token_method'])) { + + try { + $oauth = new OpenID_Extension_OAuth(OpenID_Extension::RESPONSE, + $message); + + // Fix line lengths. + $consumerKey = $_SESSION['OAuth_consumer_key']; + $consumerSecret = $_SESSION['OAuth_consumer_key']; + $tokenURL = $_SESSION['OAuth_access_token_url']; + $tokenMethod = $_SESSION['OAuth_access_token_method']; + + $oauthData = $oauth->getAccessToken($consumerKey, + $consumerSecret, + $tokenURL, + array(), + $tokenMethod); + + } catch (Exception $e) { + } + } + + $openid = $message->getArrayFormat(); + + $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; + $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; + $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email; + $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email; + $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail']; + + $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null; + $name = (isset($openid['openid.sreg.firstname']) && isset($openid['openid.sreg.lastname']) && !isset($name)) ? $openid['openid.sreg.firstname']." ".$openid['openid.sreg.lastname'] : $name; + $name = (isset($openid['openid.sreg.nickname']) && !isset($name)) ? $openid['openid.sreg.nickname'] : $name; + $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR']; + + $_SESSION['identity'] = $openid['openid.identity']; + + $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; + header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); + exit; +} + ?> -- cgit v1.2.3 From 740ce67c8db40367f83248653309e69f1866b288 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 15:51:20 -0400 Subject: FIX: URL for access_denied image --- data/templates/forbidden.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm index e6965dd..d7d3b61 100644 --- a/data/templates/forbidden.htm +++ b/data/templates/forbidden.htm @@ -5,7 +5,7 @@
    Access Denied - +

    We're sorry, your identity is not authorized:

    {{ identity }}

    If you feel this message is in error, please notify the site admin -- cgit v1.2.3 From ac41dd93568256fe5f2cd75530e30bc9b7e1668d Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 16:09:48 -0400 Subject: FIX: logout url --- data/templates/base.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/templates/base.htm b/data/templates/base.htm index ec2b746..5681f80 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -30,7 +30,7 @@ {{name}} ({{email}})

  • - Logout + Logout
  • {% endif %} {% if db.adapter %} -- cgit v1.2.3 From 54288571946a819e2b42f92583b0fb36ff57fa43 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 22:54:52 +0200 Subject: use proper namespace in www/login.php --- www/login.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/www/login.php b/www/login.php index 00d1877..f05f980 100644 --- a/www/login.php +++ b/www/login.php @@ -52,7 +52,7 @@ if (isset($_POST['openid_url'])) { } try { - $o = new OpenID_RelyingParty($returnTo, $realm, $openid_url); + $o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url); } catch (OpenID_Exception $e) { $contents = "
    \n"; $contents .= "
    " . $e->getMessage() . "
    \n"; @@ -66,8 +66,8 @@ if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associat $_SESSION['disable_associations'] = true; } -$log = new OpenID_Observer_Log; -OpenID::attach($log); +$log = new \OpenID_Observer_Log; +\OpenID::attach($log); if (isset($_POST['start'])) { @@ -88,13 +88,13 @@ if (isset($_POST['start'])) { } // SREG - $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST); + $sreg = new \OpenID_Extension_SREG11(\OpenID_Extension::REQUEST); $sreg->set('required', 'email,firstname,lastname,nickname'); $sreg->set('optional', 'gender,dob'); $authRequest->addExtension($sreg); // AX - $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST); + $ax = new \OpenID_Extension_AX(\OpenID_Extension::REQUEST); $ax->set('type.email', 'http://axschema.org/contact/email'); $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); @@ -104,7 +104,7 @@ if (isset($_POST['start'])) { // UI if (!empty($_POST['ui'])) { - $ui = new OpenID_Extension_UI(OpenID_Extension::REQUEST); + $ui = new \OpenID_Extension_UI(\OpenID_Extension::REQUEST); $ui->set('mode', 'popup'); $ui->set('language', 'en-US'); $authRequest->addExtension($ui); @@ -112,7 +112,7 @@ if (isset($_POST['start'])) { // OAuth if (!empty($_POST['oauth'])) { - $oauth = new OpenID_Extension_OAuth(OpenID_Extension::REQUEST); + $oauth = new \OpenID_Extension_OAuth(\OpenID_Extension::REQUEST); $oauth->set('consumer', $_POST['oauth_consumer_key']); $_SESSION['OAuth_consumer_key'] = $_POST['oauth_consumer_key']; $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret']; @@ -150,12 +150,12 @@ if (isset($_POST['start'])) { $queryString = file_get_contents('php://input'); } - $message = new OpenID_Message($queryString, OpenID_Message::FORMAT_HTTP); + $message = new \OpenID_Message($queryString, \OpenID_Message::FORMAT_HTTP); $id = $message->get('openid.claimed_id'); $mode = $message->get('openid.mode'); try { - $result = $o->verify(new Net_URL2($returnTo . '?' . $queryString), $message); + $result = $o->verify(new \Net_URL2($returnTo . '?' . $queryString), $message); if ($result->success()) { $status = "Status:SUCCESS!"; @@ -176,7 +176,7 @@ if (isset($_POST['start'])) { $_SESSION['OAuth_access_token_method'])) { try { - $oauth = new OpenID_Extension_OAuth(OpenID_Extension::RESPONSE, + $oauth = new \OpenID_Extension_OAuth(\OpenID_Extension::RESPONSE, $message); // Fix line lengths. -- cgit v1.2.3 From 9abfb5687cdbc08b60cb50fc15daab929a0f8f87 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 22:56:17 +0200 Subject: do not make it mandatory to pass template variables --- www/www-header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/www-header.php b/www/www-header.php index 96cd481..c840315 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -72,7 +72,7 @@ $twig = new \Twig_Environment( ); //$twig->addExtension(new \Twig_Extension_Debug()); -function render($tplname, $vars) +function render($tplname, $vars = array()) { $vars['css'] = $GLOBALS['phorkie']['cfg']['css']; $vars['title'] = $GLOBALS['phorkie']['cfg']['title']; -- cgit v1.2.3 From dff68e21ac958ebfb8164bca4cb2143c427f4330 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:01:07 +0200 Subject: use deny-by-default security --- data/templates/forbidden.htm | 26 ++++++++------------------ www/delete.php | 3 --- www/display.php | 4 +--- www/doap.php | 1 + www/edit.php | 3 --- www/forbidden.php | 11 +++++++++++ www/fork.php | 3 --- www/index.php | 7 ++++++- www/list.php | 4 +--- www/login.php | 1 + www/new.php | 4 +--- www/raw.php | 7 +++---- www/revision.php | 6 ++---- www/search.php | 1 + www/user.php | 3 --- www/www-header.php | 2 ++ www/www-security.php | 40 ++++++++++++++++++++++++++++++++++++++++ 17 files changed, 78 insertions(+), 48 deletions(-) create mode 100644 www/forbidden.php create mode 100644 www/www-security.php diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm index d7d3b61..04b8fb6 100644 --- a/data/templates/forbidden.htm +++ b/data/templates/forbidden.htm @@ -3,23 +3,13 @@ {% block content %} -
    - Access Denied - -

    We're sorry, your identity is not authorized:

    -

    {{ identity }}

    -

    If you feel this message is in error, please notify the site admin - and include your identity.

    -
    +acces denied +

    Access Denied

    +

    + We're sorry; but you are not allowed to access this page. +

    +

    + You may log in if you want. +

    {% endblock %} -{% block sidebar %} - {% if recents.results %} -

    Recently created

    -
      - {% for repo in recents.repos %} - {% include 'repo-sidebar-list.htm' %} - {% endfor %} -
    - {% endif %} -{% endblock %} diff --git a/www/delete.php b/www/delete.php index 85f6258..6d68ae4 100644 --- a/www/delete.php +++ b/www/delete.php @@ -4,9 +4,6 @@ namespace phorkie; * Delete paste or ask for deletion */ require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - include_once 'secure.php'; -} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/display.php b/www/display.php index 6f754d9..534a119 100644 --- a/www/display.php +++ b/www/display.php @@ -3,10 +3,8 @@ namespace phorkie; /** * Display paste contents */ +$pageRequiresLogin = false; require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] == 2) { - include_once 'secure.php'; -} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/doap.php b/www/doap.php index db00df4..f374dba 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,6 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ +$pageRequiresLogin = false; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index 20e7793..897aada 100644 --- a/www/edit.php +++ b/www/edit.php @@ -4,9 +4,6 @@ namespace phorkie; * Edit paste contents */ require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - include_once 'secure.php'; -} $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/forbidden.php b/www/forbidden.php new file mode 100644 index 0000000..fc166eb --- /dev/null +++ b/www/forbidden.php @@ -0,0 +1,11 @@ + diff --git a/www/fork.php b/www/fork.php index 64dceb9..3d1c4b7 100644 --- a/www/fork.php +++ b/www/fork.php @@ -4,9 +4,6 @@ */ namespace phorkie; require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - include_once 'secure.php'; -} if ($_SERVER['REQUEST_METHOD'] !== 'POST') { throw new Exception_Input('Forking only possible via POST'); diff --git a/www/index.php b/www/index.php index 7ac6fcf..1801831 100644 --- a/www/index.php +++ b/www/index.php @@ -3,6 +3,11 @@ * Jump to the index as per the configuration */ namespace phorkie; +$pageRequiresLogin = false; require_once 'www-header.php'; -require_once $GLOBALS['phorkie']['cfg']['index'].".php"; + +header( + 'Location: ' + . Tools::fullUrl('/' . $GLOBALS['phorkie']['cfg']['index']) +); ?> diff --git a/www/list.php b/www/list.php index 5a394eb..721d20c 100644 --- a/www/list.php +++ b/www/list.php @@ -3,10 +3,8 @@ * List a repository */ namespace phorkie; +$pageRequiresLogin = false; require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] == 2) { - include_once 'secure.php'; -} $rs = new Repositories(); $page = 0; diff --git a/www/login.php b/www/login.php index f05f980..b8cb512 100644 --- a/www/login.php +++ b/www/login.php @@ -18,6 +18,7 @@ set_include_path( . PATH_SEPARATOR . get_include_path() ); +$pageRequiresLogin = false; require_once 'www-header.php'; require_once 'openid/config.php'; diff --git a/www/new.php b/www/new.php index 0675b4d..5d370f5 100644 --- a/www/new.php +++ b/www/new.php @@ -10,10 +10,8 @@ namespace phorkie; * * Creates and redirects to display page */ +$pageRequiresLogin = true; require_once 'www-header.php'; -if ($GLOBALS['phorkie']['auth']['secure'] > 0) { - include_once 'secure.php'; -} $repopo = new Repository_Post(); if ($repopo->process($_POST, $_SESSION)) { diff --git a/www/raw.php b/www/raw.php index 6b20633..634576d 100644 --- a/www/raw.php +++ b/www/raw.php @@ -1,12 +1,11 @@ loadFromRequest(); diff --git a/www/revision.php b/www/revision.php index 06462af..c4ce9e8 100644 --- a/www/revision.php +++ b/www/revision.php @@ -1,12 +1,10 @@ loadFromRequest(); diff --git a/www/search.php b/www/search.php index cb72c6a..8701911 100644 --- a/www/search.php +++ b/www/search.php @@ -3,6 +3,7 @@ namespace phorkie; /** * Search for a search term */ +$pageRequiresLogin = false; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { diff --git a/www/user.php b/www/user.php index fd851c4..8f305da 100644 --- a/www/user.php +++ b/www/user.php @@ -4,9 +4,6 @@ */ namespace phorkie; require_once 'www-header.php'; -if (!isset($_SESSION['identity'])) { - include_once 'secure.php'; -} if (isset($_POST['name'])) { $_SESSION['name'] = substr(filter_var($_POST['name'], FILTER_SANITIZE_STRING), 0, 35); diff --git a/www/www-header.php b/www/www-header.php index c840315..290e680 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -72,6 +72,8 @@ $twig = new \Twig_Environment( ); //$twig->addExtension(new \Twig_Extension_Debug()); +require __DIR__ . '/www-security.php'; + function render($tplname, $vars = array()) { $vars['css'] = $GLOBALS['phorkie']['cfg']['css']; diff --git a/www/www-security.php b/www/www-security.php new file mode 100644 index 0000000..241f866 --- /dev/null +++ b/www/www-security.php @@ -0,0 +1,40 @@ + error + require 'forbidden.php'; +} else if (isset($pageRequiresLogin) && !$pageRequiresLogin) { + return; +} + +require 'forbidden.php'; +?> \ No newline at end of file -- cgit v1.2.3 From 7fc0b4b6f2f6dd25cc16316b02c2d24006acf3fe Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:05:41 +0200 Subject: request full name from OpenID provider (sreg) --- www/login.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/www/login.php b/www/login.php index b8cb512..1feb3ce 100644 --- a/www/login.php +++ b/www/login.php @@ -90,8 +90,7 @@ if (isset($_POST['start'])) { // SREG $sreg = new \OpenID_Extension_SREG11(\OpenID_Extension::REQUEST); - $sreg->set('required', 'email,firstname,lastname,nickname'); - $sreg->set('optional', 'gender,dob'); + $sreg->set('required', 'email,fullname'); $authRequest->addExtension($sreg); // AX @@ -205,8 +204,7 @@ if (isset($_POST['start'])) { $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail']; $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null; - $name = (isset($openid['openid.sreg.firstname']) && isset($openid['openid.sreg.lastname']) && !isset($name)) ? $openid['openid.sreg.firstname']." ".$openid['openid.sreg.lastname'] : $name; - $name = (isset($openid['openid.sreg.nickname']) && !isset($name)) ? $openid['openid.sreg.nickname'] : $name; + $name = (isset($openid['openid.sreg.fullname']) && !isset($name)) ? $openid['openid.sreg.fullname'] : $name; $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR']; $_SESSION['identity'] = $openid['openid.identity']; -- cgit v1.2.3 From 2017065c9b89d4f435e86d03d28c219edcdf5bf9 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:13:38 +0200 Subject: reformat attribute reading --- www/login.php | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/www/login.php b/www/login.php index 1feb3ce..e4438a4 100644 --- a/www/login.php +++ b/www/login.php @@ -197,16 +197,32 @@ if (isset($_POST['start'])) { $openid = $message->getArrayFormat(); - $email = (isset($openid['openid.ext1.value.email'])) ? $openid['openid.ext1.value.email'] : null; - $email = (isset($openid['openid.ext2.value.email']) && !isset($email)) ? $openid['openid.ext2.value.email'] : $email; - $email = (isset($openid['openid.sreg.email']) && !isset($email)) ? $openid['openid.sreg.email'] : $email; - $email = (isset($openid['openid.ax.value.email']) && !isset($email)) ? $openid['openid.ax.value.email'] : $email; - $_SESSION['email'] = (isset($email)) ? $email : $GLOBALS['phorkie']['auth']['anonymousEmail']; - - $name = (isset($openid['openid.ext1.value.firstname']) && isset($openid['openid.ext1.value.lastname'])) ? $openid['openid.ext1.value.firstname']." ".$openid['openid.ext1.value.lastname'] : null; - $name = (isset($openid['openid.sreg.fullname']) && !isset($name)) ? $openid['openid.sreg.fullname'] : $name; - $_SESSION['name'] = (isset($name)) ? $name : $_SERVER['REMOTE_ADDR']; - + $email = isset($openid['openid.ext1.value.email']) + ? $openid['openid.ext1.value.email'] + : null; + $email = isset($openid['openid.ext2.value.email']) && !isset($email) + ? $openid['openid.ext2.value.email'] + : $email; + $email = isset($openid['openid.sreg.email']) && !isset($email) + ? $openid['openid.sreg.email'] + : $email; + $email = isset($openid['openid.ax.value.email']) && !isset($email) + ? $openid['openid.ax.value.email'] + : $email; + $_SESSION['email'] = isset($email) + ? $email + : $GLOBALS['phorkie']['auth']['anonymousEmail']; + + $name = isset($openid['openid.ext1.value.firstname']) + && isset($openid['openid.ext1.value.lastname']) + ? $openid['openid.ext1.value.firstname'] . ' ' + . $openid['openid.ext1.value.lastname'] + : null; + $name = isset($openid['openid.sreg.fullname']) && !isset($name) + ? $openid['openid.sreg.fullname'] + : $name; + + $_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR']; $_SESSION['identity'] = $openid['openid.identity']; $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; -- cgit v1.2.3 From ec100647ebe4c913ec261fddcab5004114fb5a66 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:15:35 +0200 Subject: fix html validation problems --- data/templates/login.htm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/templates/login.htm b/data/templates/login.htm index 418432e..b02503f 100644 --- a/data/templates/login.htm +++ b/data/templates/login.htm @@ -15,13 +15,13 @@

    Please choose your account provider

    - - + +

    or enter your OpenID URL.

    - - + +
    -- cgit v1.2.3 From d7f8ad629a9090c2a0380f44a04049a0804cbf61 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:17:03 +0200 Subject: fix another validation error --- data/templates/base.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/templates/base.htm b/data/templates/base.htm index 5681f80..e503369 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -61,7 +61,7 @@ phorkie, the self-hosted, git-based pastebin software is available under the - AGPL. + AGPL.
    -- cgit v1.2.3 From 6d4435572a933e53ee8ad184f1eb1898d68b3b08 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:26:20 +0200 Subject: remove openid thingies we do not need --- www/login.php | 35 ++--------------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/www/login.php b/www/login.php index e4438a4..5d2caa3 100644 --- a/www/login.php +++ b/www/login.php @@ -83,11 +83,6 @@ if (isset($_POST['start'])) { exit; } - // checkid_immediate - if (!empty($_POST['checkid_immediate'])) { - $authRequest->setMode('checkid_immediate'); - } - // SREG $sreg = new \OpenID_Extension_SREG11(\OpenID_Extension::REQUEST); $sreg->set('required', 'email,fullname'); @@ -102,36 +97,10 @@ if (isset($_POST['start'])) { $ax->set('required', 'email,firstname,lastname'); $authRequest->addExtension($ax); - // UI - if (!empty($_POST['ui'])) { - $ui = new \OpenID_Extension_UI(\OpenID_Extension::REQUEST); - $ui->set('mode', 'popup'); - $ui->set('language', 'en-US'); - $authRequest->addExtension($ui); - } - - // OAuth - if (!empty($_POST['oauth'])) { - $oauth = new \OpenID_Extension_OAuth(\OpenID_Extension::REQUEST); - $oauth->set('consumer', $_POST['oauth_consumer_key']); - $_SESSION['OAuth_consumer_key'] = $_POST['oauth_consumer_key']; - $_SESSION['OAuth_consumer_secret'] = $_POST['oauth_consumer_secret']; - - $oauth->set('scope', $_POST['oauth_scope']); - $_SESSION['OAuth_scope'] = $_POST['oauth_scope']; - - $_SESSION['OAuth_access_token_url'] = $_POST['oauth_access_token_url']; - $_SESSION['OAuth_access_token_method'] = $_POST['oauth_access_token_method']; - - $authRequest->addExtension($oauth); - } - $url = $authRequest->getAuthorizeURL(); - if (empty($_POST['debug'])) { - header("Location: $url"); - exit; - } + header("Location: $url"); + exit; } else { if (isset($_SESSION['openid_url'])) { -- cgit v1.2.3 From a3087ce500d0ef3c2b6c6f67f0eeedc622074d08 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:30:08 +0200 Subject: remove unneeded indent --- www/login.php | 154 ++++++++++++++++++++++++---------------------------------- 1 file changed, 64 insertions(+), 90 deletions(-) diff --git a/www/login.php b/www/login.php index 5d2caa3..790a73a 100644 --- a/www/login.php +++ b/www/login.php @@ -102,101 +102,75 @@ if (isset($_POST['start'])) { header("Location: $url"); exit; +} + +if (isset($_SESSION['openid_url'])) { + $usid = $_SESSION['openid_url']; + unset($_SESSION['openid_url']); } else { - if (isset($_SESSION['openid_url'])) { - $usid = $_SESSION['openid_url']; - unset($_SESSION['openid_url']); - } else { - $usid = null; - } + $usid = null; +} - unset($_SESSION['disable_associations']); +unset($_SESSION['disable_associations']); - if (!count($_POST)) { - list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); - } else { - // I hate php sometimes - $queryString = file_get_contents('php://input'); - } +if (!count($_POST)) { + list(, $queryString) = explode('?', $_SERVER['REQUEST_URI']); +} else { + // I hate php sometimes + $queryString = file_get_contents('php://input'); +} - $message = new \OpenID_Message($queryString, \OpenID_Message::FORMAT_HTTP); - $id = $message->get('openid.claimed_id'); - $mode = $message->get('openid.mode'); +$message = new \OpenID_Message($queryString, \OpenID_Message::FORMAT_HTTP); +$id = $message->get('openid.claimed_id'); +$mode = $message->get('openid.mode'); - try { - $result = $o->verify(new \Net_URL2($returnTo . '?' . $queryString), $message); - - if ($result->success()) { - $status = "Status:SUCCESS!"; - $status .= " ({$result->getAssertionMethod()})"; - } else { - $status = "Status:FAIL!"; - $status .= " ({$result->getAssertionMethod()})"; - } - } catch (OpenID_Exception $e) { - $status = "Status:EXCEPTION!"; - $status .= " ({$e->getMessage()} : {$e->getCode()})"; - } +try { + $result = $o->verify(new \Net_URL2($returnTo . '?' . $queryString), $message); - // OAuth hyprid fetching access token - if (isset($_SESSION['OAuth_consumer_key'], - $_SESSION['OAuth_consumer_secret'], - $_SESSION['OAuth_access_token_url'], - $_SESSION['OAuth_access_token_method'])) { - - try { - $oauth = new \OpenID_Extension_OAuth(\OpenID_Extension::RESPONSE, - $message); - - // Fix line lengths. - $consumerKey = $_SESSION['OAuth_consumer_key']; - $consumerSecret = $_SESSION['OAuth_consumer_key']; - $tokenURL = $_SESSION['OAuth_access_token_url']; - $tokenMethod = $_SESSION['OAuth_access_token_method']; - - $oauthData = $oauth->getAccessToken($consumerKey, - $consumerSecret, - $tokenURL, - array(), - $tokenMethod); - - } catch (Exception $e) { - } + if ($result->success()) { + $status = "Status:SUCCESS!"; + $status .= " ({$result->getAssertionMethod()})"; + } else { + $status = "Status:FAIL!"; + $status .= " ({$result->getAssertionMethod()})"; } - - $openid = $message->getArrayFormat(); - - $email = isset($openid['openid.ext1.value.email']) - ? $openid['openid.ext1.value.email'] - : null; - $email = isset($openid['openid.ext2.value.email']) && !isset($email) - ? $openid['openid.ext2.value.email'] - : $email; - $email = isset($openid['openid.sreg.email']) && !isset($email) - ? $openid['openid.sreg.email'] - : $email; - $email = isset($openid['openid.ax.value.email']) && !isset($email) - ? $openid['openid.ax.value.email'] - : $email; - $_SESSION['email'] = isset($email) - ? $email - : $GLOBALS['phorkie']['auth']['anonymousEmail']; - - $name = isset($openid['openid.ext1.value.firstname']) - && isset($openid['openid.ext1.value.lastname']) - ? $openid['openid.ext1.value.firstname'] . ' ' - . $openid['openid.ext1.value.lastname'] - : null; - $name = isset($openid['openid.sreg.fullname']) && !isset($name) - ? $openid['openid.sreg.fullname'] - : $name; - - $_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR']; - $_SESSION['identity'] = $openid['openid.identity']; - - $redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; -} - +} catch (OpenID_Exception $e) { + $status = "Status:EXCEPTION!"; + $status .= " ({$e->getMessage()} : {$e->getCode()})"; + } + + +$openid = $message->getArrayFormat(); + +$email = isset($openid['openid.ext1.value.email']) + ? $openid['openid.ext1.value.email'] + : null; +$email = isset($openid['openid.ext2.value.email']) && !isset($email) + ? $openid['openid.ext2.value.email'] + : $email; +$email = isset($openid['openid.sreg.email']) && !isset($email) + ? $openid['openid.sreg.email'] + : $email; +$email = isset($openid['openid.ax.value.email']) && !isset($email) + ? $openid['openid.ax.value.email'] + : $email; +$_SESSION['email'] = isset($email) + ? $email + : $GLOBALS['phorkie']['auth']['anonymousEmail']; + +$name = isset($openid['openid.ext1.value.firstname']) + && isset($openid['openid.ext1.value.lastname']) + ? $openid['openid.ext1.value.firstname'] . ' ' + . $openid['openid.ext1.value.lastname'] + : null; +$name = isset($openid['openid.sreg.fullname']) && !isset($name) + ? $openid['openid.sreg.fullname'] + : $name; + +$_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR']; +$_SESSION['identity'] = $openid['openid.identity']; + +$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; +header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); +exit; ?> -- cgit v1.2.3 From e380a7f6aaefb1bbd16a595b6f855ce036501981 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:33:20 +0200 Subject: get rid of start variable in form --- data/templates/login.htm | 7 ++----- www/login.php | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/data/templates/login.htm b/data/templates/login.htm index b02503f..084b438 100644 --- a/data/templates/login.htm +++ b/data/templates/login.htm @@ -6,17 +6,14 @@ - - -
    Sign-in

    Please choose your account provider

    - - + +

    or enter your OpenID URL.

    diff --git a/www/login.php b/www/login.php index 790a73a..e3d165d 100644 --- a/www/login.php +++ b/www/login.php @@ -40,7 +40,7 @@ if (!count($_GET) && !count($_POST)) { } // Hackaround Non-Javascript Login Page -if (!count($_POST) && isset($_GET['start'])) { +if (!count($_POST) && isset($_GET['openid_url'])) { $_POST = $_GET; } @@ -70,7 +70,7 @@ if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associat $log = new \OpenID_Observer_Log; \OpenID::attach($log); -if (isset($_POST['start'])) { +if (isset($_POST['openid_url'])) { $_SESSION['openid_url'] = $openid_url; try { -- cgit v1.2.3 From f662a50e02abe50321766c84a23b977a455d401c Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:38:47 +0200 Subject: get rid of openid config file --- src/openid/config.php | 55 --------------------------------------------------- www/login.php | 35 +++++++------------------------- 2 files changed, 7 insertions(+), 83 deletions(-) delete mode 100644 src/openid/config.php diff --git a/src/openid/config.php b/src/openid/config.php deleted file mode 100644 index 76ebc6a..0000000 --- a/src/openid/config.php +++ /dev/null @@ -1,55 +0,0 @@ - - * @copyright 2009 Bill Shupp - * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD - * @link http://github.com/shupp/openid - */ - -set_include_path(dirname(__FILE__) . '/../../:' . get_include_path()); - -/** - * Required files - */ -require_once 'OpenID/RelyingParty.php'; -require_once 'OpenID/Discover.php'; -require_once 'OpenID/Store.php'; -require_once 'OpenID/Extension/SREG10.php'; -require_once 'OpenID/Extension/SREG11.php'; -require_once 'OpenID/Extension/AX.php'; -require_once 'OpenID/Extension/UI.php'; -require_once 'OpenID/Extension/OAuth.php'; -require_once 'OpenID/Message.php'; -require_once 'OpenID/Observer/Log.php'; -require_once 'Net/URL2.php'; - -// Determine realm and return_to -$base = 'http'; -if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { - $base .= 's'; -} -$base .= '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']; - -$realm = $base . '/'; -$returnTo = $base . dirname($_SERVER['PHP_SELF']); -if ($returnTo[strlen($returnTo) - 1] != '/') { - $returnTo .= '/'; -} -$returnTo .= 'login'; - -// SQL storage example -// $storeOptions = array( -// 'dsn' => 'mysql://user:pass@db.example.com/openid' -// ); -// OpenID::setStore(OpenID_Store::factory('MDB2', $storeOptions)); -// -// // The first time you run it, you'll also need to create the tables: -// OpenID::getStore()->createTables(); - -?> diff --git a/www/login.php b/www/login.php index e3d165d..6a13fa2 100644 --- a/www/login.php +++ b/www/login.php @@ -1,42 +1,18 @@ - * @copyright 2009 Bill Shupp - * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD - * @link http://github.com/shupp/openid - */ namespace phorkie; -// A tool for testing Relying Party functionality -set_include_path( - __DIR__ . '/../../src/' - . PATH_SEPARATOR . get_include_path() -); - $pageRequiresLogin = false; require_once 'www-header.php'; -require_once 'openid/config.php'; - if (isset($_REQUEST['logout'])) { unset($_SESSION); session_destroy(); - $redirect = 'http://' . $_SERVER['HTTP_HOST']; - header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); - exit; + header('Location: ' . Tools::fullUrl('/')); + exit(); } if (!count($_GET) && !count($_POST)) { - render( - 'login', - null - ); - exit; + render('login'); + exit(); } // Hackaround Non-Javascript Login Page @@ -52,6 +28,9 @@ if (isset($_POST['openid_url'])) { $openid_url = null; } +$realm = Tools::fullUrl('/'); +$returnTo = Tools::fullUrl('/login'); + try { $o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url); } catch (OpenID_Exception $e) { -- cgit v1.2.3 From d6d44a3855f93afebd962843cfdfb9952912443e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:48:04 +0200 Subject: show openid of user in forbidden page --- data/templates/forbidden.htm | 14 ++++++++++++-- www/forbidden.php | 5 ++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm index 04b8fb6..585c2fe 100644 --- a/data/templates/forbidden.htm +++ b/data/templates/forbidden.htm @@ -5,11 +5,21 @@ acces denied

    Access Denied

    +{% if identity %}

    - We're sorry; but you are not allowed to access this page. + You are logged in with the following OpenID:

    - You may log in if you want. + {{identity}}

    +

    + Unfortunately, your OpenID is not unlocked. + Contact the site administrator to get access. +

    +{% else %} +

    + We're sorry; but you have to log in to access this page. +

    +{% endif %} {% endblock %} diff --git a/www/forbidden.php b/www/forbidden.php index fc166eb..6c44099 100644 --- a/www/forbidden.php +++ b/www/forbidden.php @@ -5,7 +5,10 @@ namespace phorkie; */ render( - 'forbidden' + 'forbidden', + array( + 'identity' => isset($_SESSION['identity']) ? $_SESSION['identity'] : null + ) ); exit(); ?> -- cgit v1.2.3 From 44a673a5864e2f2b9d14d7c67d9f5baf41f957c9 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:48:19 +0200 Subject: allow people to logout and login in secure mode --- www/login.php | 1 + www/www-header.php | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/www/login.php b/www/login.php index 6a13fa2..150cf25 100644 --- a/www/login.php +++ b/www/login.php @@ -1,6 +1,7 @@ addExtension(new \Twig_Extension_Debug()); -require __DIR__ . '/www-security.php'; +if (!isset($noSecurityCheck) || $noSecurityCheck !== true) { + require __DIR__ . '/www-security.php'; +} function render($tplname, $vars = array()) { -- cgit v1.2.3 From e280bcc8d00257607f2626f85afd01eec50831b3 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:53:33 +0200 Subject: send 403 header on forbidden page --- www/forbidden.php | 1 + 1 file changed, 1 insertion(+) diff --git a/www/forbidden.php b/www/forbidden.php index 6c44099..f55c4ba 100644 --- a/www/forbidden.php +++ b/www/forbidden.php @@ -4,6 +4,7 @@ namespace phorkie; * Show an access denied error */ +header('HTTP/1.0 403 Forbidden'); render( 'forbidden', array( -- cgit v1.2.3 From 82d22f5e2176392ca2389df0e47a29092cf38089 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Sep 2012 23:57:14 +0200 Subject: remove session id check, it was not working the way I hoped for --- www/www-header.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/www/www-header.php b/www/www-header.php index ed41503..9aa8732 100644 --- a/www/www-header.php +++ b/www/www-header.php @@ -1,8 +1,6 @@ Date: Mon, 17 Sep 2012 21:11:58 -0400 Subject: FIX: Revamped security measures --- www/delete.php | 1 + www/display.php | 2 +- www/doap.php | 2 +- www/edit.php | 2 +- www/fork.php | 1 + www/list.php | 2 +- www/login.php | 1 - www/new.php | 2 +- www/raw.php | 2 +- www/revision.php | 2 +- www/search.php | 2 +- www/www-security.php | 24 ++++++++++++++++-------- 12 files changed, 26 insertions(+), 17 deletions(-) diff --git a/www/delete.php b/www/delete.php index 6d68ae4..e4ee5e7 100644 --- a/www/delete.php +++ b/www/delete.php @@ -3,6 +3,7 @@ namespace phorkie; /** * Delete paste or ask for deletion */ +$pageRequiresLogin = '1'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/display.php b/www/display.php index 534a119..94b2ef9 100644 --- a/www/display.php +++ b/www/display.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display paste contents */ -$pageRequiresLogin = false; +$pageRequiresLogin = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/doap.php b/www/doap.php index f374dba..cc61845 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,7 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ -$pageRequiresLogin = false; +$pageRequiresLogin = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index 897aada..b925f0b 100644 --- a/www/edit.php +++ b/www/edit.php @@ -3,8 +3,8 @@ namespace phorkie; /** * Edit paste contents */ +$pageRequiresLogin = '1'; require_once 'www-header.php'; - $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/fork.php b/www/fork.php index 3d1c4b7..2832fe4 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,6 +3,7 @@ * Fork a repository */ namespace phorkie; +$pageRequiresLogin = '1'; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/list.php b/www/list.php index 721d20c..cc8aa87 100644 --- a/www/list.php +++ b/www/list.php @@ -3,7 +3,7 @@ * List a repository */ namespace phorkie; -$pageRequiresLogin = false; +$pageRequiresLogin = '0'; require_once 'www-header.php'; $rs = new Repositories(); diff --git a/www/login.php b/www/login.php index 150cf25..a2cf97c 100644 --- a/www/login.php +++ b/www/login.php @@ -1,6 +1,5 @@ error - require 'forbidden.php'; -} else if (isset($pageRequiresLogin) && !$pageRequiresLogin) { +if ($pageRequiresLogin >= $GLOBALS['phorkie']['auth']['secure']) { + if ($logged_in) { + return; + } +} else { return; } +// p / G / log_in = disp +// 0 / 1 / true = return +// 0 / 1 / false = block +// 0 / 2 / true = return +// 0 / 2 / false = return +// 1 / 1 / true = return +// 1 / 1 / false = block +// 1 / 2 / true = return +// 1 / 2 / false = block + require 'forbidden.php'; -?> \ No newline at end of file +?> -- cgit v1.2.3 From 29abc10fb620c14f0ccfcd4ca220e0186274e93c Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 21:20:41 -0400 Subject: ADD: Login button when logged out --- data/templates/base.htm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/data/templates/base.htm b/data/templates/base.htm index e503369..7722105 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -32,6 +32,10 @@
  • Logout
  • + {% else %} +
  • + Login +
  • {% endif %} {% if db.adapter %}
  • -- cgit v1.2.3 From e7c60768692aef84b7d35809eb6cb533d04a651b Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 21:21:18 -0400 Subject: FIX: Removed commit message from display --- data/templates/revision-head.htm | 3 --- 1 file changed, 3 deletions(-) diff --git a/data/templates/revision-head.htm b/data/templates/revision-head.htm index a5f7e88..9a60b05 100644 --- a/data/templates/revision-head.htm +++ b/data/templates/revision-head.htm @@ -9,9 +9,6 @@

    revision {{repo.hash}}

    -

    - message {{repo.message}} -

  • -- cgit v1.2.3 From 47341ded2eba15c6d109ba166242e6e557080388 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 21:29:57 -0400 Subject: ADD: protect user.php --- www/user.php | 1 + 1 file changed, 1 insertion(+) diff --git a/www/user.php b/www/user.php index 8f305da..5bb2352 100644 --- a/www/user.php +++ b/www/user.php @@ -3,6 +3,7 @@ * Edit user information */ namespace phorkie; +$pageRequiresLogin = '1'; require_once 'www-header.php'; if (isset($_POST['name'])) { -- cgit v1.2.3 From 89f8c33e5a87e3c6c8d814493dfdab761c24cc46 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 21:30:43 -0400 Subject: FIX: Set REQUEST_URI to go back to page requested before logging in --- www/www-security.php | 1 + 1 file changed, 1 insertion(+) diff --git a/www/www-security.php b/www/www-security.php index 47e9a9e..2f5f30b 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -44,5 +44,6 @@ if ($pageRequiresLogin >= $GLOBALS['phorkie']['auth']['secure']) { // 1 / 2 / true = return // 1 / 2 / false = block +$_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI']; require 'forbidden.php'; ?> -- cgit v1.2.3 From 802794fcc585bbb6533c52b6a4c646829bd07b4d Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 21:47:23 -0400 Subject: FIX: Files without eol --- data/templates/display-sidebar-history.htm | 2 +- data/templates/new.htm | 2 +- data/templates/pager.htm | 2 +- src/phorkie/File.php | 2 +- src/phorkie/GitCommandBinary.php | 2 +- src/phorkie/HtmlHelper.php | 2 +- src/phorkie/Repository/Commit.php | 2 +- src/phorkie/Tool/Manager.php | 2 +- src/phorkie/Tool/Result.php | 2 +- src/phorkie/Tool/Result/Line.php | 2 +- src/phorkie/Tools.php | 2 +- www/js/phorkie.js | 2 +- www/tool.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/data/templates/display-sidebar-history.htm b/data/templates/display-sidebar-history.htm index b3ef9df..bf38884 100644 --- a/data/templates/display-sidebar-history.htm +++ b/data/templates/display-sidebar-history.htm @@ -15,4 +15,4 @@ {% else %}

    No commits yet

    {% endfor %} - \ No newline at end of file + diff --git a/data/templates/new.htm b/data/templates/new.htm index 5b75bba..89c2fe0 100644 --- a/data/templates/new.htm +++ b/data/templates/new.htm @@ -37,4 +37,4 @@ $(document).ready(function() { {% endfor %} {% endif %} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/data/templates/pager.htm b/data/templates/pager.htm index 085a281..9be2b9f 100644 --- a/data/templates/pager.htm +++ b/data/templates/pager.htm @@ -45,4 +45,4 @@ {% endif %}
    -{% endif %} \ No newline at end of file +{% endif %} diff --git a/src/phorkie/File.php b/src/phorkie/File.php index 331f2e5..f378f60 100644 --- a/src/phorkie/File.php +++ b/src/phorkie/File.php @@ -165,4 +165,4 @@ class File } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/GitCommandBinary.php b/src/phorkie/GitCommandBinary.php index 13a31db..a005349 100644 --- a/src/phorkie/GitCommandBinary.php +++ b/src/phorkie/GitCommandBinary.php @@ -12,4 +12,4 @@ class GitCommandBinary extends \VersionControl_Git_Util_Command } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/HtmlHelper.php b/src/phorkie/HtmlHelper.php index af046cf..ea21ab5 100644 --- a/src/phorkie/HtmlHelper.php +++ b/src/phorkie/HtmlHelper.php @@ -25,4 +25,4 @@ class HtmlHelper } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/Repository/Commit.php b/src/phorkie/Repository/Commit.php index 05c988b..62f1d40 100644 --- a/src/phorkie/Repository/Commit.php +++ b/src/phorkie/Repository/Commit.php @@ -70,4 +70,4 @@ class Repository_Commit } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/Tool/Manager.php b/src/phorkie/Tool/Manager.php index 8e18199..ca93b4a 100644 --- a/src/phorkie/Tool/Manager.php +++ b/src/phorkie/Tool/Manager.php @@ -43,4 +43,4 @@ class Tool_Manager } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/Tool/Result.php b/src/phorkie/Tool/Result.php index 22ea273..94dfe5e 100644 --- a/src/phorkie/Tool/Result.php +++ b/src/phorkie/Tool/Result.php @@ -6,4 +6,4 @@ class Tool_Result public $annotations; } -?> \ No newline at end of file +?> diff --git a/src/phorkie/Tool/Result/Line.php b/src/phorkie/Tool/Result/Line.php index a788db6..1fa8bcb 100644 --- a/src/phorkie/Tool/Result/Line.php +++ b/src/phorkie/Tool/Result/Line.php @@ -31,4 +31,4 @@ class Tool_Result_Line } } -?> \ No newline at end of file +?> diff --git a/src/phorkie/Tools.php b/src/phorkie/Tools.php index 843b2df..e4aab63 100644 --- a/src/phorkie/Tools.php +++ b/src/phorkie/Tools.php @@ -62,4 +62,4 @@ class Tools } -?> \ No newline at end of file +?> diff --git a/www/js/phorkie.js b/www/js/phorkie.js index 1171b1a..7078e8f 100644 --- a/www/js/phorkie.js +++ b/www/js/phorkie.js @@ -50,4 +50,4 @@ function toggleAdditional(elem, time) jt.children('i').toggleClass('icon-chevron-down') .toggleClass('icon-chevron-up'); jt.parents('.row-fluid').children('.additional').toggle(time); -} \ No newline at end of file +} diff --git a/www/tool.php b/www/tool.php index d42954c..647d6a7 100644 --- a/www/tool.php +++ b/www/tool.php @@ -30,4 +30,4 @@ render( ) ); -?> \ No newline at end of file +?> -- cgit v1.2.3 From c630697fa2d4679eed006ae37aa594cbf7b99ae8 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Mon, 17 Sep 2012 22:00:37 -0400 Subject: CLEAN: changed pageRequiresLogin variable to secureAtLevel to more adequately self-describe --- www/delete.php | 2 +- www/display.php | 2 +- www/doap.php | 2 +- www/edit.php | 2 +- www/fork.php | 2 +- www/index.php | 2 +- www/list.php | 2 +- www/new.php | 2 +- www/raw.php | 2 +- www/revision.php | 2 +- www/search.php | 2 +- www/user.php | 2 +- www/www-security.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/www/delete.php b/www/delete.php index e4ee5e7..d9ee251 100644 --- a/www/delete.php +++ b/www/delete.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Delete paste or ask for deletion */ -$pageRequiresLogin = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/display.php b/www/display.php index 94b2ef9..fc93b0d 100644 --- a/www/display.php +++ b/www/display.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display paste contents */ -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/doap.php b/www/doap.php index cc61845..377030b 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,7 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index b925f0b..f83dfb3 100644 --- a/www/edit.php +++ b/www/edit.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Edit paste contents */ -$pageRequiresLogin = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/fork.php b/www/fork.php index 2832fe4..10bd1e2 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,7 +3,7 @@ * Fork a repository */ namespace phorkie; -$pageRequiresLogin = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/index.php b/www/index.php index 1801831..7ff1814 100644 --- a/www/index.php +++ b/www/index.php @@ -3,7 +3,7 @@ * Jump to the index as per the configuration */ namespace phorkie; -$pageRequiresLogin = false; +$secureAtLevel = false; require_once 'www-header.php'; header( diff --git a/www/list.php b/www/list.php index cc8aa87..8252f37 100644 --- a/www/list.php +++ b/www/list.php @@ -3,7 +3,7 @@ * List a repository */ namespace phorkie; -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $rs = new Repositories(); diff --git a/www/new.php b/www/new.php index 505ca50..e2611c0 100644 --- a/www/new.php +++ b/www/new.php @@ -10,7 +10,7 @@ namespace phorkie; * * Creates and redirects to display page */ -$pageRequiresLogin = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repopo = new Repository_Post(); diff --git a/www/raw.php b/www/raw.php index bedaa1b..612a6b8 100644 --- a/www/raw.php +++ b/www/raw.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Displays a file */ -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/revision.php b/www/revision.php index 9c2735d..513ca67 100644 --- a/www/revision.php +++ b/www/revision.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display historic paste contents */ -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/search.php b/www/search.php index 2621382..82d5f76 100644 --- a/www/search.php +++ b/www/search.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Search for a search term */ -$pageRequiresLogin = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { diff --git a/www/user.php b/www/user.php index 5bb2352..9e20f6a 100644 --- a/www/user.php +++ b/www/user.php @@ -3,7 +3,7 @@ * Edit user information */ namespace phorkie; -$pageRequiresLogin = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; if (isset($_POST['name'])) { diff --git a/www/www-security.php b/www/www-security.php index 2f5f30b..9fae87b 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -26,7 +26,7 @@ if (!isset($_SESSION['identity'])) { $logged_in = true; } -if ($pageRequiresLogin >= $GLOBALS['phorkie']['auth']['secure']) { +if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['secure']) { if ($logged_in) { return; } -- cgit v1.2.3 From 46e5ed5df53911bd2ae3584ef35f86e5d3094fb3 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 07:29:48 +0200 Subject: Removing access_denied image that was originally from http://wiki.songbirdnest.com/Docs/Songbird_Illustration_Compendium because the songbird people don't let us use the image: > Date: Mon, 17 Sep 2012 16:36:20 -0700 > kristina, an employee of Songbird, replied to license of > "access denied" image from the wiki, a question about Songbird. > Hi cweiske, > Thank you for your inquiry but we would like to keep the right > for all our images be associated with Songbird only. Sorry about that! http://getsatisfaction.com/songbird/topics/license_of_access_denied_image_from_the_wiki --- data/templates/forbidden.htm | 1 - www/images/access_denied.png | Bin 15610 -> 0 bytes 2 files changed, 1 deletion(-) delete mode 100644 www/images/access_denied.png diff --git a/data/templates/forbidden.htm b/data/templates/forbidden.htm index 585c2fe..a39bcf7 100644 --- a/data/templates/forbidden.htm +++ b/data/templates/forbidden.htm @@ -3,7 +3,6 @@ {% block content %} -acces denied

    Access Denied

    {% if identity %}

    diff --git a/www/images/access_denied.png b/www/images/access_denied.png deleted file mode 100644 index c13d7b9..0000000 Binary files a/www/images/access_denied.png and /dev/null differ -- cgit v1.2.3 From 3367fca1c9cdeb70c95154f20011b268d4d080a4 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 07:41:31 +0200 Subject: rename "secure" config setting to "securityLevel" --- data/config.default.php | 2 +- www/www-security.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index da16241..0c9ec69 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -13,7 +13,7 @@ $GLOBALS['phorkie']['cfg'] = array( 'index' => 'new'//"new" or "list" ); $GLOBALS['phorkie']['auth'] = array( - 'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication + 'securityLevel' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = require authentication 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate 'anonymousName' => 'Anonymous', // Email for non-authenticated commits 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits diff --git a/www/www-security.php b/www/www-security.php index 9fae87b..e9fdab7 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -4,12 +4,12 @@ namespace phorkie; * security levels + login requirement: */ -if (!isset($GLOBALS['phorkie']['auth']['secure'])) { +if (!isset($GLOBALS['phorkie']['auth']['securityLevel'])) { //not set? highest level of security - $GLOBALS['phorkie']['auth']['secure'] = 2; + $GLOBALS['phorkie']['auth']['securityLevel'] = 2; } -if ($GLOBALS['phorkie']['auth']['secure'] == 0) { +if ($GLOBALS['phorkie']['auth']['securityLevel'] == 0) { //everyone may do everything return; } @@ -26,7 +26,7 @@ if (!isset($_SESSION['identity'])) { $logged_in = true; } -if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['secure']) { +if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { if ($logged_in) { return; } -- cgit v1.2.3 From 8aa0b9bda25f570e591e554bdbece99d5f6458c8 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 07:46:49 +0200 Subject: rename auth configuration variables to make them more readable --- data/config.default.php | 9 ++++++--- data/config.php.dist | 5 ++++- www/www-security.php | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index 0c9ec69..a0270b5 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -13,10 +13,13 @@ $GLOBALS['phorkie']['cfg'] = array( 'index' => 'new'//"new" or "list" ); $GLOBALS['phorkie']['auth'] = array( - 'securityLevel' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = require authentication - 'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate + // 0 = public, no authentication, 1 = protect adds/edits/deletes, + // 2 = require authentication + 'securityLevel' => 0, + 'listedUsersOnly' => false, + 'users' => array(), // Array of OpenIDs that may login 'anonymousName' => 'Anonymous', // Email for non-authenticated commits - 'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits + 'anonymousEmail' => 'anonymous@phorkie', // Email for non-authenticated commits ); $GLOBALS['phorkie']['tools'] = array( '\\phorkie\\Tool_Xmllint' => true, diff --git a/data/config.php.dist b/data/config.php.dist index e90f704..ced993f 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -5,7 +5,10 @@ //$GLOBALS['phorkie']['cfg']['git']['private'] = 'ssh://git@bogo:paste/'; //$GLOBALS['phorkie']['cfg']['elasticsearch'] = 'http://localhost:9200/phorkie/'; //$GLOBALS['phorkie']['cfg']['setupcheck'] = false; -//$GLOBALS['phorkie']['users'] = array( + +//$GLOBALS['phorkie']['auth']['securityLevel'] = 0; +//$GLOBALS['phorkie']['auth']['listedUsersOnly'] = false; +//$GLOBALS['phorkie']['auth']['users'] = array( // 'https://www.google.com/accounts/o8/id?id=ABCDEFGHIJKLMNOPQRSTUVWXYZ', // 'http://anonymous.phorkie.openid' //); diff --git a/www/www-security.php b/www/www-security.php index e9fdab7..ccbdb97 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -17,8 +17,8 @@ if ($GLOBALS['phorkie']['auth']['securityLevel'] == 0) { $logged_in = false; if (!isset($_SESSION['identity'])) { //not logged in -} else if ($GLOBALS['phorkie']['auth']['userlist']) { - if (in_array($_SESSION['identity'], $GLOBALS['phorkie']['users'])) { +} else if ($GLOBALS['phorkie']['auth']['listedUsersOnly']) { + if (in_array($_SESSION['identity'], $GLOBALS['phorkie']['auth']['users'])) { $logged_in = true; } } else { -- cgit v1.2.3 From 5b589f6213337eb1c88ed983f54552f2bafefd80 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 06:43:46 -0400 Subject: CLEAN: How about changing the rest of the files with your variable? :p --- www/delete.php | 2 +- www/display.php | 2 +- www/doap.php | 2 +- www/edit.php | 2 +- www/fork.php | 2 +- www/index.php | 2 +- www/list.php | 2 +- www/new.php | 2 +- www/raw.php | 2 +- www/revision.php | 2 +- www/search.php | 2 +- www/user.php | 2 +- www/www-security.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/www/delete.php b/www/delete.php index d9ee251..2271b21 100644 --- a/www/delete.php +++ b/www/delete.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Delete paste or ask for deletion */ -$secureAtLevel = '1'; +$securityLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/display.php b/www/display.php index fc93b0d..91a7321 100644 --- a/www/display.php +++ b/www/display.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display paste contents */ -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/doap.php b/www/doap.php index 377030b..e605f15 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,7 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index f83dfb3..2525056 100644 --- a/www/edit.php +++ b/www/edit.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Edit paste contents */ -$secureAtLevel = '1'; +$securityLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/fork.php b/www/fork.php index 10bd1e2..0366938 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,7 +3,7 @@ * Fork a repository */ namespace phorkie; -$secureAtLevel = '1'; +$securityLevel = '1'; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/index.php b/www/index.php index 7ff1814..9bbb29f 100644 --- a/www/index.php +++ b/www/index.php @@ -3,7 +3,7 @@ * Jump to the index as per the configuration */ namespace phorkie; -$secureAtLevel = false; +$securityLevel = false; require_once 'www-header.php'; header( diff --git a/www/list.php b/www/list.php index 8252f37..c9cd81a 100644 --- a/www/list.php +++ b/www/list.php @@ -3,7 +3,7 @@ * List a repository */ namespace phorkie; -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; $rs = new Repositories(); diff --git a/www/new.php b/www/new.php index e2611c0..10c5ab3 100644 --- a/www/new.php +++ b/www/new.php @@ -10,7 +10,7 @@ namespace phorkie; * * Creates and redirects to display page */ -$secureAtLevel = '1'; +$securityLevel = '1'; require_once 'www-header.php'; $repopo = new Repository_Post(); diff --git a/www/raw.php b/www/raw.php index 612a6b8..8e60241 100644 --- a/www/raw.php +++ b/www/raw.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Displays a file */ -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/revision.php b/www/revision.php index 513ca67..8c0bf6b 100644 --- a/www/revision.php +++ b/www/revision.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display historic paste contents */ -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/search.php b/www/search.php index 82d5f76..d7fb669 100644 --- a/www/search.php +++ b/www/search.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Search for a search term */ -$secureAtLevel = '0'; +$securityLevel = '0'; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { diff --git a/www/user.php b/www/user.php index 9e20f6a..dc79459 100644 --- a/www/user.php +++ b/www/user.php @@ -3,7 +3,7 @@ * Edit user information */ namespace phorkie; -$secureAtLevel = '1'; +$securityLevel = '1'; require_once 'www-header.php'; if (isset($_POST['name'])) { diff --git a/www/www-security.php b/www/www-security.php index ccbdb97..3fe6f20 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -26,7 +26,7 @@ if (!isset($_SESSION['identity'])) { $logged_in = true; } -if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { +if ($securityLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { if ($logged_in) { return; } -- cgit v1.2.3 From a1bceaf02f8f8a3fdbb8042ffcfab4b3a35f14f7 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 06:51:56 -0400 Subject: CLEAN: Corrected spacing --- data/config.default.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index a0270b5..a087767 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -17,9 +17,9 @@ $GLOBALS['phorkie']['auth'] = array( // 2 = require authentication 'securityLevel' => 0, 'listedUsersOnly' => false, - 'users' => array(), // Array of OpenIDs that may login - 'anonymousName' => 'Anonymous', // Email for non-authenticated commits - 'anonymousEmail' => 'anonymous@phorkie', // Email for non-authenticated commits + 'users' => array(), // Array of OpenIDs that may login + 'anonymousName' => 'Anonymous', // Email for non-authenticated commits + 'anonymousEmail' => 'anonymous@phorkie', // Email for non-authenticated commits ); $GLOBALS['phorkie']['tools'] = array( '\\phorkie\\Tool_Xmllint' => true, -- cgit v1.2.3 From 92d6cf1f537c2126baf324cbdadbef1067e156b6 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 07:43:52 -0400 Subject: REVERT: variable name change --- www/delete.php | 2 +- www/display.php | 2 +- www/doap.php | 2 +- www/edit.php | 2 +- www/fork.php | 2 +- www/index.php | 2 +- www/list.php | 2 +- www/new.php | 2 +- www/raw.php | 2 +- www/revision.php | 2 +- www/search.php | 2 +- www/user.php | 2 +- www/www-security.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/www/delete.php b/www/delete.php index 2271b21..d9ee251 100644 --- a/www/delete.php +++ b/www/delete.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Delete paste or ask for deletion */ -$securityLevel = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/display.php b/www/display.php index 91a7321..fc93b0d 100644 --- a/www/display.php +++ b/www/display.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display paste contents */ -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/doap.php b/www/doap.php index e605f15..377030b 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,7 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index 2525056..f83dfb3 100644 --- a/www/edit.php +++ b/www/edit.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Edit paste contents */ -$securityLevel = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/fork.php b/www/fork.php index 0366938..10bd1e2 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,7 +3,7 @@ * Fork a repository */ namespace phorkie; -$securityLevel = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/index.php b/www/index.php index 9bbb29f..7ff1814 100644 --- a/www/index.php +++ b/www/index.php @@ -3,7 +3,7 @@ * Jump to the index as per the configuration */ namespace phorkie; -$securityLevel = false; +$secureAtLevel = false; require_once 'www-header.php'; header( diff --git a/www/list.php b/www/list.php index c9cd81a..8252f37 100644 --- a/www/list.php +++ b/www/list.php @@ -3,7 +3,7 @@ * List a repository */ namespace phorkie; -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $rs = new Repositories(); diff --git a/www/new.php b/www/new.php index 10c5ab3..e2611c0 100644 --- a/www/new.php +++ b/www/new.php @@ -10,7 +10,7 @@ namespace phorkie; * * Creates and redirects to display page */ -$securityLevel = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; $repopo = new Repository_Post(); diff --git a/www/raw.php b/www/raw.php index 8e60241..612a6b8 100644 --- a/www/raw.php +++ b/www/raw.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Displays a file */ -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/revision.php b/www/revision.php index 8c0bf6b..513ca67 100644 --- a/www/revision.php +++ b/www/revision.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display historic paste contents */ -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/search.php b/www/search.php index d7fb669..82d5f76 100644 --- a/www/search.php +++ b/www/search.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Search for a search term */ -$securityLevel = '0'; +$secureAtLevel = '0'; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { diff --git a/www/user.php b/www/user.php index dc79459..9e20f6a 100644 --- a/www/user.php +++ b/www/user.php @@ -3,7 +3,7 @@ * Edit user information */ namespace phorkie; -$securityLevel = '1'; +$secureAtLevel = '1'; require_once 'www-header.php'; if (isset($_POST['name'])) { diff --git a/www/www-security.php b/www/www-security.php index 3fe6f20..ccbdb97 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -26,7 +26,7 @@ if (!isset($_SESSION['identity'])) { $logged_in = true; } -if ($securityLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { +if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { if ($logged_in) { return; } -- cgit v1.2.3 From 4293cbe275bec99763c9fd4bd5df347bd359599f Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 08:09:00 -0400 Subject: FIX: Add identity to notes rather than commit --- src/phorkie/Repository/Post.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/phorkie/Repository/Post.php b/src/phorkie/Repository/Post.php index ed44cf1..9119e06 100644 --- a/src/phorkie/Repository/Post.php +++ b/src/phorkie/Repository/Post.php @@ -118,10 +118,11 @@ class Repository_Post } $commitmsg = "phorkie commit"; + if (isset($sessionData['identity'])) { - $commitmsg .= " from ".$sessionData['identity']; + $notes = $sessionData['identity']; } else { - $commitmsg .= " by ".$sessionData['ipaddr']; + $notes = $sessionData['ipaddr']; } if ($bCommit) { @@ -129,6 +130,11 @@ class Repository_Post ->setOption('message', $commitmsg) ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>') ->execute(); + //FIXME: git needs ref BEFORE add. ideally VersionControl_Git needs to be updated + $vc->getCommand('notes --ref=identity add') + ->setOption('force') + ->setOption('message', "$notes") + ->execute(); $bChanged = true; } -- cgit v1.2.3 From ffa9d514d3a14c76170e26047f09009b4a6de07c Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 10:08:33 -0400 Subject: CLEAN: use fullUrl when possible --- www/login.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/www/login.php b/www/login.php index a2cf97c..9c1b136 100644 --- a/www/login.php +++ b/www/login.php @@ -77,7 +77,7 @@ if (isset($_POST['openid_url'])) { $authRequest->addExtension($ax); $url = $authRequest->getAuthorizeURL(); - + header("Location: $url"); exit; @@ -116,7 +116,7 @@ try { } catch (OpenID_Exception $e) { $status = "Status:EXCEPTION!"; $status .= " ({$e->getMessage()} : {$e->getCode()})"; - } +} $openid = $message->getArrayFormat(); @@ -149,7 +149,11 @@ $name = isset($openid['openid.sreg.fullname']) && !isset($name) $_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR']; $_SESSION['identity'] = $openid['openid.identity']; -$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI']; +if (isset($_SESSION['REQUEST_URI'])) { + $redirect = Tools::fullUrl($_SESSION['REQUEST_URI']); +} else { + $redirect = Tools::fullUrl('/'); +} header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL)); exit; ?> -- cgit v1.2.3 From 91e9d451126b1165a564f5f211082dce3b0348d9 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 10:10:19 -0400 Subject: CLEAN: use fullUrl when possible --- www/secure.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/secure.php b/www/secure.php index e614087..9506614 100644 --- a/www/secure.php +++ b/www/secure.php @@ -6,7 +6,7 @@ namespace phorkie; require_once 'www-header.php'; $_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI']; if (!isset($_SESSION['identity'])) { - header("Location: /login"); + header("Location: " . Tools::fullUrl('/login')); exit; } if ($GLOBALS['phorkie']['auth']['secure'] > 0 && -- cgit v1.2.3 From 6dbf5501308792a7ab375a8be5562e8c85a48628 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 10:15:30 -0400 Subject: CLEAN: reformatted to look consistent --- data/templates/user.htm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/templates/user.htm b/data/templates/user.htm index c8ef387..eb032bd 100644 --- a/data/templates/user.htm +++ b/data/templates/user.htm @@ -6,7 +6,8 @@

    User Profile -

    Please update your git preferences for {{ identity }}

    +

    Please update your git preferences.

    +

    {{ identity }}



    -- cgit v1.2.3 From bd7506015c1976511ccd333417da2aec8e5e18f6 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 18:21:40 +0200 Subject: add vcs-git links to html head, to support autodiscovery apart from DOAP - http://joeyh.name/rfc/rel-vcs/ --- data/templates/display.htm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/templates/display.htm b/data/templates/display.htm index 5bcb016..799f94d 100644 --- a/data/templates/display.htm +++ b/data/templates/display.htm @@ -5,6 +5,12 @@ {% block meta %} +{% if repo.getCloneURL(true) %} + +{% endif %} +{% if repo.getCloneURL(false) %} + +{% endif %} {% endblock %} {% block content %} -- cgit v1.2.3 From b81d2ab65f8fafce3b818eeb96c1cdcecd3e675f Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 13:53:14 -0400 Subject: CLEAN: Removed openid debugging information --- src/openid/wrapper.php | 27 ---------------- www/css/debug.css | 85 -------------------------------------------------- www/login.php | 12 ++----- 3 files changed, 2 insertions(+), 122 deletions(-) delete mode 100644 src/openid/wrapper.php delete mode 100644 www/css/debug.css diff --git a/src/openid/wrapper.php b/src/openid/wrapper.php deleted file mode 100644 index cb57f4e..0000000 --- a/src/openid/wrapper.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @copyright 2009 Bill Shupp - * @license http://www.opensource.org/licenses/bsd-license.php FreeBSD - * @link http://github.com/shupp/openid - */ -?> - - - PEAR OpenID Debug - - - - - - diff --git a/www/css/debug.css b/www/css/debug.css deleted file mode 100644 index 634243a..0000000 --- a/www/css/debug.css +++ /dev/null @@ -1,85 +0,0 @@ -html, body { - background: #ededed; - font: 82.5% Helvetica Neue, HelveticaNeue, Helvetica, sans-serif; - margin: 30px 0 0; padding: 0px; } - -h3 { - color: #aaa; - margin: 0; padding: 0; - font-size: 1.3em; - - position: absolute; - top: 30px; - width: 100%; - text-align: center; - left: 0; -} - -h3 a { - color: #111; - text-decoration: none; -} - -h3 a:hover { - text-decoration: underline; - -} - -form { - padding: 30px; - background: #fff; - -moz-border-radius: 6px; - -webkit-border-radius: 6px; - width: 400px; - margin: 50px auto 0; - } - -table { - font-size: 1.1em !important; - font-weight: bold; -} - -td { - width: 200px; -} -.discover_results { - margin: 60px 0 ; - padding: 30px; - background: #111; - text-align: center; -} - - -.discover_results b { - color: #fff; - font-size: 2.4em; -} - -.relyingparty_results { - width: 100%; -} - -.relyingparty_results table b { - display: block; - width: 300px; - font-size: 1.7em; - color: #fff; -} - - -pre, .relyingparty_results p table { - font-size: 1.2em; - width: 900px !important; - text-align: left; - margin: 0 auto; - - color: #ddd; - padding: 30px; - -} - -.relyingparty_results { - background: #111; - padding: 30px; - margin: 60px 0; -} diff --git a/www/login.php b/www/login.php index 9c1b136..a97246f 100644 --- a/www/login.php +++ b/www/login.php @@ -34,11 +34,7 @@ $returnTo = Tools::fullUrl('/login'); try { $o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url); } catch (OpenID_Exception $e) { - $contents = "
    \n"; - $contents .= "
    " . $e->getMessage() . "
    \n"; - $contents .= "
    "; - include_once 'openid/wrapper.php'; - exit; + throw new Exception($e->getMessage()); } if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associations'])) { @@ -55,11 +51,7 @@ if (isset($_POST['openid_url'])) { try { $authRequest = $o->prepare(); } catch (OpenID_Exception $e) { - $contents = "
    \n"; - $contents .= "
    " . $e->getMessage() . "
    \n"; - $contents .= "
    "; - include_once 'openid/wrapper.php'; - exit; + throw new Exception($e->getMessage()); } // SREG -- cgit v1.2.3 From 6eef15cdc3bef5971d8ffe95bcbcaff368c87e69 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 23:28:11 +0200 Subject: rename "secureAtLevel" variable since it does not define a level at all --- www/delete.php | 2 +- www/display.php | 2 +- www/doap.php | 2 +- www/edit.php | 3 ++- www/fork.php | 2 +- www/index.php | 2 +- www/list.php | 2 +- www/new.php | 2 +- www/raw.php | 2 +- www/revision.php | 2 +- www/search.php | 2 +- www/user.php | 2 +- www/www-security.php | 24 ++++++++++-------------- 13 files changed, 23 insertions(+), 26 deletions(-) diff --git a/www/delete.php b/www/delete.php index d9ee251..43ec9d5 100644 --- a/www/delete.php +++ b/www/delete.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Delete paste or ask for deletion */ -$secureAtLevel = '1'; +$reqWritePermissions = true; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/display.php b/www/display.php index fc93b0d..ffc9786 100644 --- a/www/display.php +++ b/www/display.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display paste contents */ -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/doap.php b/www/doap.php index 377030b..63a66e6 100644 --- a/www/doap.php +++ b/www/doap.php @@ -4,7 +4,7 @@ namespace phorkie; * Display DOAP of the paste. * Contains a machine-readable project description with Git URL. */ -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/edit.php b/www/edit.php index f83dfb3..4de3d47 100644 --- a/www/edit.php +++ b/www/edit.php @@ -3,8 +3,9 @@ namespace phorkie; /** * Edit paste contents */ -$secureAtLevel = '1'; +$reqWritePermissions = true; require_once 'www-header.php'; + $repo = new Repository(); $repo->loadFromRequest(); diff --git a/www/fork.php b/www/fork.php index 10bd1e2..6c96a6a 100644 --- a/www/fork.php +++ b/www/fork.php @@ -3,7 +3,7 @@ * Fork a repository */ namespace phorkie; -$secureAtLevel = '1'; +$reqWritePermissions = true; require_once 'www-header.php'; if ($_SERVER['REQUEST_METHOD'] !== 'POST') { diff --git a/www/index.php b/www/index.php index 7ff1814..0ee9211 100644 --- a/www/index.php +++ b/www/index.php @@ -3,7 +3,7 @@ * Jump to the index as per the configuration */ namespace phorkie; -$secureAtLevel = false; +$reqWritePermissions = false; require_once 'www-header.php'; header( diff --git a/www/list.php b/www/list.php index 8252f37..750e811 100644 --- a/www/list.php +++ b/www/list.php @@ -3,7 +3,7 @@ * List a repository */ namespace phorkie; -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; $rs = new Repositories(); diff --git a/www/new.php b/www/new.php index e2611c0..7a70891 100644 --- a/www/new.php +++ b/www/new.php @@ -10,7 +10,7 @@ namespace phorkie; * * Creates and redirects to display page */ -$secureAtLevel = '1'; +$reqWritePermissions = true; require_once 'www-header.php'; $repopo = new Repository_Post(); diff --git a/www/raw.php b/www/raw.php index 612a6b8..605462d 100644 --- a/www/raw.php +++ b/www/raw.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Displays a file */ -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/revision.php b/www/revision.php index 513ca67..4d4f97c 100644 --- a/www/revision.php +++ b/www/revision.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Display historic paste contents */ -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; $repo = new Repository(); diff --git a/www/search.php b/www/search.php index 82d5f76..9c7ff6e 100644 --- a/www/search.php +++ b/www/search.php @@ -3,7 +3,7 @@ namespace phorkie; /** * Search for a search term */ -$secureAtLevel = '0'; +$reqWritePermissions = false; require_once 'www-header.php'; if (!isset($_GET['q']) || $_GET['q'] == '') { diff --git a/www/user.php b/www/user.php index 9e20f6a..8b86a50 100644 --- a/www/user.php +++ b/www/user.php @@ -3,7 +3,7 @@ * Edit user information */ namespace phorkie; -$secureAtLevel = '1'; +$reqWritePermissions = true; require_once 'www-header.php'; if (isset($_POST['name'])) { diff --git a/www/www-security.php b/www/www-security.php index ccbdb97..5051b0f 100644 --- a/www/www-security.php +++ b/www/www-security.php @@ -26,23 +26,19 @@ if (!isset($_SESSION['identity'])) { $logged_in = true; } -if ($secureAtLevel >= $GLOBALS['phorkie']['auth']['securityLevel']) { - if ($logged_in) { - return; - } -} else { +if ($logged_in) { + //you may do everything if you're logged in return; } -// p / G / log_in = disp -// 0 / 1 / true = return -// 0 / 1 / false = block -// 0 / 2 / true = return -// 0 / 2 / false = return -// 1 / 1 / true = return -// 1 / 1 / false = block -// 1 / 2 / true = return -// 1 / 2 / false = block +if (!isset($reqWritePermissions)) { + $reqWritePermissions = true; +} +if ($GLOBALS['phorkie']['auth']['securityLevel'] == 1 + && !$reqWritePermissions +) { + return; +} $_SESSION['REQUEST_URI'] = $_SERVER['REQUEST_URI']; require 'forbidden.php'; -- cgit v1.2.3 From 4dec3c5aa93e77ed29ade646c6db3a9ea39d7896 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 23:29:58 +0200 Subject: secure.php is not used anymore --- www/secure.php | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 www/secure.php diff --git a/www/secure.php b/www/secure.php deleted file mode 100644 index 9506614..0000000 --- a/www/secure.php +++ /dev/null @@ -1,26 +0,0 @@ - 0 && - $GLOBALS['phorkie']['auth']['userlist']) { - if (!in_array($_SESSION['identity'], $GLOBALS['phorkie']['users'])) { - header('HTTP/1.1 403 Forbidden'); - $db = new Database(); - render( - 'forbidden', - array( - 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'), - ) - ); - exit; - } -} -?> -- cgit v1.2.3 From eaf0573ebdcca11a984f4f98577ca77a6c63654e Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 23:51:29 +0200 Subject: verify openid AX email type --- www/login.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/www/login.php b/www/login.php index a97246f..bba7c99 100644 --- a/www/login.php +++ b/www/login.php @@ -122,7 +122,10 @@ $email = isset($openid['openid.ext2.value.email']) && !isset($email) $email = isset($openid['openid.sreg.email']) && !isset($email) ? $openid['openid.sreg.email'] : $email; -$email = isset($openid['openid.ax.value.email']) && !isset($email) +$email = isset($openid['openid.ax.value.email']) + && isset($openid['openid.ax.type.email']) + && $openid['openid.ax.type.email'] == 'http://axschema.org/contact/email' + && !isset($email) ? $openid['openid.ax.value.email'] : $email; $_SESSION['email'] = isset($email) -- cgit v1.2.3 From b255e81e31bf7925c37352bf608c48f3a897a4ef Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 18 Sep 2012 23:51:45 +0200 Subject: read full name from Yahoo! OpenID --- www/login.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/www/login.php b/www/login.php index bba7c99..77e3953 100644 --- a/www/login.php +++ b/www/login.php @@ -59,13 +59,14 @@ if (isset($_POST['openid_url'])) { $sreg->set('required', 'email,fullname'); $authRequest->addExtension($sreg); - // AX + // AX, http://stackoverflow.com/a/7657061/282601 $ax = new \OpenID_Extension_AX(\OpenID_Extension::REQUEST); $ax->set('type.email', 'http://axschema.org/contact/email'); $ax->set('type.firstname', 'http://axschema.org/namePerson/first'); $ax->set('type.lastname', 'http://axschema.org/namePerson/last'); + $ax->set('type.fullname', 'http://axschema.org/namePerson'); $ax->set('mode', 'fetch_request'); - $ax->set('required', 'email,firstname,lastname'); + $ax->set('required', 'email,firstname,lastname,fullname'); $authRequest->addExtension($ax); $url = $authRequest->getAuthorizeURL(); @@ -140,6 +141,12 @@ $name = isset($openid['openid.ext1.value.firstname']) $name = isset($openid['openid.sreg.fullname']) && !isset($name) ? $openid['openid.sreg.fullname'] : $name; +$name = isset($openid['openid.ax.value.fullname']) + && isset($openid['openid.ax.type.fullname']) + && $openid['openid.ax.type.fullname'] == 'http://axschema.org/namePerson' + && !isset($name) + ? $openid['openid.ax.value.fullname'] + : $name; $_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR']; $_SESSION['identity'] = $openid['openid.identity']; -- cgit v1.2.3 From d316adab970b993504ba38736a0f8753ef4bb052 Mon Sep 17 00:00:00 2001 From: "Justin J. Novack" Date: Tue, 18 Sep 2012 15:25:47 -0400 Subject: Feature: Add Markdown parsing --- ChangeLog | 4 ++++ README.rst | 3 +++ data/config.default.php | 5 +++++ src/phorkie/Renderer/Markdown.php | 27 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 src/phorkie/Renderer/Markdown.php diff --git a/ChangeLog b/ChangeLog index afefa9a..8557be7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-09-18 Justin J. Novack + + * Add Markdown as a known file-type. + 2012-09-16 Christian Weiske * Implement request #12: DOAP documents for all pastes diff --git a/README.rst b/README.rst index d1c6491..4a157bf 100644 --- a/README.rst +++ b/README.rst @@ -84,6 +84,9 @@ phorkie stands on the shoulders of giants. $ pear channel-discover zustellzentrum.cweiske.de $ pear install zz/mime_type_plaindetect-alpha + $ pear channel-discover pear.michelf.ca + $ pear install michelf/Markdown + Note that this version of GeSHi is a bit outdated, but it's the fastest way to install it. diff --git a/data/config.default.php b/data/config.default.php index 88c9ae5..3fc48f6 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -57,6 +57,11 @@ $GLOBALS['phorkie']['languages'] = array( 'mime' => 'application/javascript', 'geshi' => 'javascript' ), + 'md' => array( + 'title' => 'Markdown', + 'mime' => 'text/x-markdown', + 'renderer' => '\\phorkie\\Renderer_Markdown' + ), 'pl' => array( 'title' => 'Perl', 'mime' => 'application/x-perl', diff --git a/src/phorkie/Renderer/Markdown.php b/src/phorkie/Renderer/Markdown.php new file mode 100644 index 0000000..628d87f --- /dev/null +++ b/src/phorkie/Renderer/Markdown.php @@ -0,0 +1,27 @@ +getContent()); + + return '
    ' + . $markdown + . '
    '; + } +} + +?> -- cgit v1.2.3 From 29035e26e880fcbc3027d5b6bd283959cb869534 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 19 Sep 2012 00:05:11 +0200 Subject: move login link and user name+email to the right on the navigation bar --- data/templates/base.htm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/data/templates/base.htm b/data/templates/base.htm index 7722105..dc06566 100644 --- a/data/templates/base.htm +++ b/data/templates/base.htm @@ -25,6 +25,15 @@
  • List all
  • + {% if db.adapter %} +
  • + + + +
  • + {% endif %} + + -- cgit v1.2.3 From 149e039741f94f9e22bd2c8d7dcf33158a110e79 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Wed, 19 Sep 2012 00:12:51 +0200 Subject: talk about vcs-git in changelog --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1dc1447..51548c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-09-19 Christian Weiske + + * Implement request #12: add link rel="vcs-git" + 2012-09-18 Justin J. Novack * Add Markdown as a known file-type. -- cgit v1.2.3