WassUp Real Time Analytics - Version 1.6

Version Description

Download this release

Release Info

Developer michelem
Plugin Icon 128x128 WassUp Real Time Analytics
Version 1.6
Comparing to
See all releases

Code changes from version 1.5.1 to 1.6

Files changed (8) hide show
  1. img/flags/yu.png +0 -0
  2. js/jquery.js +23 -23
  3. lib/action.php +88 -60
  4. lib/main.php +22 -19
  5. lib/settings.php +12 -3
  6. lib/wassup.class.php +37 -33
  7. readme.txt +8 -10
  8. wassup.php +501 -222
img/flags/yu.png ADDED
Binary file
js/jquery.js CHANGED
@@ -1,32 +1,32 @@
1
  /*
2
- * jQuery 1.2.3 - New Wave Javascript
3
  *
4
  * Copyright (c) 2008 John Resig (jquery.com)
5
  * Dual licensed under the MIT (MIT-LICENSE.txt)
6
  * and GPL (GPL-LICENSE.txt) licenses.
7
  *
8
- * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $
9
- * $Rev: 4663 $
10
  */
11
- (function(){if(window.jQuery)var _jQuery=window.jQuery;var jQuery=window.jQuery=function(selector,context){return new jQuery.prototype.init(selector,context);};if(window.$)var _$=window.$;window.$=jQuery;var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/;var isSimple=/^.[^:#\[\.]*$/;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}else if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem)if(elem.id!=match[3])return jQuery().find(selector);else{this[0]=elem;this.length=1;return this;}else
12
- selector=[];}}else
13
- return new jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(selector.constructor==Array&&selector||(selector.jquery||selector.length&&selector!=window&&!selector.nodeType&&selector[0]!=undefined&&selector[0].nodeType)&&jQuery.makeArray(selector)||[selector]);},jquery:"1.2.3",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;this.each(function(i){if(this==elem)ret=i;});return ret;},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value==undefined)return this.length&&jQuery[type||"attr"](this[0],name)||undefined;else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
14
  return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
15
- selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return!selector?this:this.pushStack(jQuery.merge(this.get(),selector.constructor==String?jQuery(selector).get():selector.length!=undefined&&(!selector.nodeName||jQuery.nodeName(selector,"form"))?selector:[selector]));},is:function(selector){return selector?jQuery.multiFilter(selector,this).length>0:false;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
16
- return(this[0].value||"").replace(/\r/g,"");}return undefined;}return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=value.constructor==Array?value:[value];jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
17
- this.value=value;});},html:function(value){return value==undefined?(this.length?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value==null){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data==undefined&&this.length)data=jQuery.data(this[0],key);return data==null&&parts[1]?this.data(parts[0]):data;}else
18
- return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script")){scripts=scripts.add(elem);}else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.prototype.init.prototype=jQuery.prototype;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
19
- jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==1){target=this;i=0;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){if(target===options[name])continue;if(deep&&options[name]&&typeof options[name]=="object"&&target[name]&&!options[name].nodeType)target[name]=jQuery.extend(target[name],options[name]);else if(options[name]!=undefined)target[name]=options[name];}return target;};var expando="jQuery"+(new Date()).getTime(),uuid=0,windowData={};var exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i;jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/function/i.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
20
- script.appendChild(document.createTextNode(data));head.appendChild(script);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!=undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){if(args){if(object.length==undefined){for(var name in object)if(callback.apply(object[name],args)===false)break;}else
21
- for(var i=0,length=object.length;i<length;i++)if(callback.apply(object[i],args)===false)break;}else{if(object.length==undefined){for(var name in object)if(callback.call(object[name],name,object[name])===false)break;}else
22
- for(var i=0,length=object.length,value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
23
- jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret;function color(elem){if(!jQuery.browser.safari)return false;var ret=document.defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(elem.style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=elem.style.outline;elem.style.outline="0 solid black";elem.style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&elem.style&&elem.style[name])ret=elem.style[name];else if(document.defaultView&&document.defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var getComputedStyle=document.defaultView.getComputedStyle(elem,null);if(getComputedStyle&&!color(elem))ret=getComputedStyle.getPropertyValue(name);else{var swap=[],stack=[];for(var a=elem;a&&color(a);a=a.parentNode)stack.unshift(a);for(var i=0;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(getComputedStyle&&getComputedStyle.getPropertyValue(name))||"";for(var i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var style=elem.style.left,runtimeStyle=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;elem.style.left=ret||0;ret=elem.style.pixelLeft+"px";elem.style.left=style;elem.runtimeStyle.left=runtimeStyle;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem=elem.toString();if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
24
- ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var fix=jQuery.isXMLDoc(elem)?{}:jQuery.props;if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(fix[name]){if(value!=undefined)elem[fix[name]]=value;return elem[fix[name]];}else if(jQuery.browser.msie&&name=="style")return jQuery.attr(elem.style,"cssText",value);else if(value==undefined&&jQuery.browser.msie&&jQuery.nodeName(elem,"form")&&(name=="action"||name=="method"))return elem.getAttributeNode(name).nodeValue;else if(elem.tagName){if(value!=undefined){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem.setAttribute(name,""+value);}if(jQuery.browser.msie&&/href|src/.test(name)&&!jQuery.isXMLDoc(elem))return elem.getAttribute(name,2);return elem.getAttribute(name);}else{if(name=="opacity"&&jQuery.browser.msie){if(value!=undefined){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseFloat(value).toString()=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100).toString():"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(value!=undefined)elem[name]=value;return elem[name];}},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(typeof array!="array")for(var i=0,length=array.length;i<length;i++)ret.push(array[i]);else
25
- ret=array.slice(0);return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]==elem)return i;return-1;},merge:function(first,second){if(jQuery.browser.msie){for(var i=0;second[i];i++)if(second[i].nodeType!=8)first.push(second[i]);}else
26
- for(var i=0;second[i];i++)first.push(second[i]);return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv&&callback(elems[i],i)||inv&&!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!==null&&value!=undefined){if(value.constructor!=Array)value=[value];ret=ret.concat(value);}}return ret;}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected",maxlength:"maxLength",selectedIndex:"selectedIndex",defaultValue:"defaultValue",tagName:"tagName",nodeName:"nodeName"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false;var re=quickChild;var m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[];var cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&(!elem||n!=elem))r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval!=undefined)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=function(){return fn.apply(this,arguments);};handler.data=data;handler.guid=fn.guid;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){var val;if(typeof jQuery=="undefined"||jQuery.event.triggered)return val;val=jQuery.event.handle.apply(arguments.callee.elem,arguments);return val;});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
27
- for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data||[]);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event)data.unshift(this.fix({type:type,target:elem}));data[0].type=type;if(exclusive)data[0].exclusive=true;if(jQuery.isFunction(jQuery.data(elem,"handle")))val=jQuery.data(elem,"handle").apply(elem,data);if(!fn&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val;event=jQuery.event.fix(event||window.event||{});var parts=event.type.split(".");event.type=parts[0];var handlers=jQuery.data(this,"events")&&jQuery.data(this,"events")[event.type],args=Array.prototype.slice.call(arguments,1);args.unshift(event);for(var j in handlers){var handler=handlers[j];args[0].handler=handler;args[0].data=handler.data;if(!parts[1]&&!event.exclusive||handler.type==parts[1]){var ret=handler.apply(this,args);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}if(jQuery.browser.msie)event.target=event.preventDefault=event.stopPropagation=event.handler=event.data=null;return val;},fix:function(event){var originalEvent=event;event=jQuery.extend({},originalEvent);event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=originalEvent.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;arguments[0].type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){return this.each(function(){jQuery.event.add(this,type,function(event){jQuery(this).unbind(event);return(fn||data).apply(this,arguments);},fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){if(this[0])return jQuery.event.trigger(type,data,this[0],false,fn);return undefined;},toggle:function(){var args=arguments;return this.click(function(event){this.lastToggle=0==this.lastToggle?1:0;event.preventDefault();return args[this.lastToggle].apply(this,arguments)||false;});},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
28
- jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({load:function(url,params,callback){if(jQuery.isFunction(url))return this.bind("load",url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=(new Date).getTime();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){var jsonp,jsre=/=\?(&|$)/g,status,data;s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(s.type.toLowerCase()=="get"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&s.type.toLowerCase()=="get"){var ts=(new Date()).getTime();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&s.type.toLowerCase()=="get"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");if((!s.url.indexOf("http")||!s.url.indexOf("//"))&&s.dataType=="script"&&s.type.toLowerCase()=="get"){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xml=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();xml.open(s.type,s.url,s.async,s.username,s.password);try{if(s.data)xml.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xml.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xml.setRequestHeader("X-Requested-With","XMLHttpRequest");xml.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend)s.beforeSend(xml);if(s.global)jQuery.event.trigger("ajaxSend",[xml,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xml&&(xml.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xml)&&"error"||s.ifModified&&jQuery.httpNotModified(xml,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xml,s.dataType);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xml.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
29
- jQuery.handleError(s,xml,status);complete();if(s.async)xml=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xml){xml.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xml.send(s.data);}catch(e){jQuery.handleError(s,xml,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xml,s]);}function complete(){if(s.complete)s.complete(xml,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xml,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xml;},handleError:function(s,xml,status,e){if(s.error)s.error(xml,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xml,s,e]);},active:0,httpSuccess:function(r){try{return!r.status&&location.protocol=="file:"||(r.status>=200&&r.status<300)||r.status==304||r.status==1223||jQuery.browser.safari&&r.status==undefined;}catch(e){}return false;},httpNotModified:function(xml,url){try{var xmlRes=xml.getResponseHeader("Last-Modified");return xml.status==304||xmlRes==jQuery.lastModified[url]||jQuery.browser.safari&&xml.status==undefined;}catch(e){}return false;},httpData:function(r,type){var ct=r.getResponseHeader("content-type");var xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0;var data=xml?r.responseXML:r.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
 
30
  for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
31
- s.push(encodeURIComponent(j)+"="+encodeURIComponent(a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle(fn,fn2):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall);var hidden=jQuery(this).is(":hidden"),self=this;for(var p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return jQuery.isFunction(opt.complete)&&opt.complete.apply(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
32
- e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.apply(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(!elem)return undefined;type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",array?jQuery.makeArray(array):[]);return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].apply(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:{slow:600,fast:200}[opt.duration])||400;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.apply(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.apply(this.elem,[this.now,this]);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=(new Date()).getTime();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=(new Date()).getTime();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done&&jQuery.isFunction(this.options.complete))this.options.complete.apply(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.fx.step={scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}};jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),fixed=jQuery.css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&jQuery.css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(jQuery.css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&jQuery.css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||jQuery.css(offsetChild,"position")=="absolute"))||(mozilla&&jQuery.css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l)||0;top+=parseInt(t)||0;}return results;};})();
1
  /*
2
+ * jQuery 1.2.6 - New Wave Javascript
3
  *
4
  * Copyright (c) 2008 John Resig (jquery.com)
5
  * Dual licensed under the MIT (MIT-LICENSE.txt)
6
  * and GPL (GPL-LICENSE.txt) licenses.
7
  *
8
+ * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
9
+ * $Rev: 5685 $
10
  */
11
+ (function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
12
+ return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
 
13
  return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
14
+ selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
15
+ return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
16
+ this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
17
+ return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
18
+ jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
19
+ script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
20
+ for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
21
+ for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
22
+ jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
23
+ ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
24
+ while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
25
+ while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.type;},radio:function(a){return"radio"==a.type;},checkbox:function(a){return"checkbox"==a.type;},file:function(a){return"file"==a.type;},password:function(a){return"password"==a.type;},submit:function(a){return"submit"==a.type;},image:function(a){return"image"==a.type;},reset:function(a){return"reset"==a.type;},button:function(a){return"button"==a.type||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
26
+ for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
27
+ jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
28
+ xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
29
+ jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
30
  for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
31
+ s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
32
+ e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();
lib/action.php CHANGED
@@ -6,23 +6,23 @@
6
  header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
7
  // HTTP/1.1
8
  header('Cache-Control: no-store, no-cache, must-revalidate');
9
- header('Cache-Control: post-check=0, pre-check=0', false);
10
  */
11
- echo "\n";
12
  //#debug...
13
  //error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only
14
  //ini_set('display_errors','On'); //debug
15
 
16
  //#check for required files and include them
17
- if (!defined('ABSPATH')) {
18
- $wpabspath=substr(__FILE__,0,strpos(__FILE__,'/wp-content/')+1);
19
- if (file_exists($wpabspath. 'wp-blog-header.php')) {
20
- include_once($wpabspath. 'wp-blog-header.php');
21
- }
22
- } else {
23
- $wpabspath=ABSPATH;
24
- }
25
  if (!function_exists('get_bloginfo')) {
 
 
 
 
 
 
 
 
 
 
26
  if (file_exists($wpabspath. 'wp-config.php')) {
27
  include_once($wpabspath.'wp-config.php');
28
  } else {
@@ -41,7 +41,8 @@ if (!function_exists('stringShortener')) {
41
  exit();
42
  }
43
  }
44
- //echo "Debug: Starting action.php from directory ".dirname(__FILE__).". ABSPATH=".ABSPATH.".<br />\n"; //debug
 
45
 
46
  //#set required variables
47
  $siteurl = get_bloginfo('siteurl');
@@ -57,9 +58,28 @@ $hashfail = true;
57
  if (isset($_GET['whash']) && $_GET['whash'] == $wassup_settings['whash']) {
58
  $hashfail = false;
59
  }
60
- //#perform the "action" and display the result
 
61
  if (!$hashfail) {
62
- //#retrieve command-line arguments
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  if (isset($_GET['to_date'])) $to_date = urlencode(attribute_escape($_GET['to_date']));
64
  else $to_date = wassup_get_time();
65
  if (isset($_GET['from_date'])) $from_date = urlencode(attribute_escape($_GET['from_date']));
@@ -80,22 +100,10 @@ if (!$hashfail) {
80
 
81
  //#perform action and display output
82
  //
83
- // ACTION: DELETE ON THE FLY FROM VISITOR DETAILS VIEW
84
- //-- This doesn't belong in "action.php" because there is no output.
85
- // It would be better as a function call/post action in
86
- // wassup.php, instead.
87
- if ($_GET['action'] == "delete") {
88
- if (method_exists($wpdb,'prepare')) {
89
- $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE wassup_id='%s'", urlencode(attribute_escape($_GET['id']))));
90
- } else {
91
- $wpdb->query("DELETE FROM $table_name WHERE wassup_id='".urlencode(attribute_escape($_GET['id']))."'");
92
- }
93
-
94
  // ACTION: RUN SPY VIEW
95
- } elseif ($_GET['action'] == "spy") {
96
  if (empty($rows)) { $rows = 999; }
97
  spyview($from_date,$to_date,$rows);
98
- exit; //for immediate browser rendering
99
 
100
  // ACTION: SUMMARY PIE CHART
101
  } elseif ($_GET['action'] == "piechart") {
@@ -109,6 +117,7 @@ if (!$hashfail) {
109
  $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0", "DISTINCT");
110
  $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0", "DISTINCT"); ?>
111
  <div align="center"><img src="http://chart.apis.google.com/chart?cht=p3&chco=0000ff&chs=600x300&chl=Spam|Search%20Engine|Referrer|Direct&chd=<?php chart_data($items_pie, null, null, null, 'pie'); ?>" /></div>
 
112
  <?php
113
  // ACTION: DISPLAY RAW RECORDS
114
  } elseif ($_GET['action'] == "displayraw") {
@@ -135,12 +144,15 @@ if (!$hashfail) {
135
  } //end foreach ?>
136
  <ul>
137
  </div>
 
138
  <?php
139
  // ACTION: RUN TOP TEN
140
  } elseif ($_GET['action'] == "topten") {
141
  $top_ten = unserialize($wassup_settings['wassup_top10']);
142
  $sitedomain = parse_url($siteurl);
143
- $sitedomain = $sitedomain['host'];
 
 
144
  if (empty($max_char_len)) {
145
  $max_char_len = ($wassup_settings['wassup_screen_res'])/10;
146
  }
@@ -154,6 +166,12 @@ if (!$hashfail) {
154
  } else {
155
  $widthoffset = 0;
156
  }
 
 
 
 
 
 
157
  //only exclude spam if it is being recorded
158
  if ($wassup_settings['wassup_spamcheck'] == 1) {
159
  $spamselect = "AND spam=0";
@@ -162,8 +180,8 @@ if (!$hashfail) {
162
  }
163
  ?>
164
  <style type="text/css">.top10 { color: #542; }</style>
165
- <div id="toptenchart">
166
- <table width="100%" border=0>
167
  <tr valign="top">
168
  <?php
169
  //#output top 10 searches
@@ -171,7 +189,7 @@ if (!$hashfail) {
171
  $top_results = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND search!='' $spamselect GROUP BY search ORDER BY top_search DESC LIMIT 10");
172
  $char_len = round(($max_char_len*.30)+$widthoffset,0);
173
  ?>
174
- <td style="min-width:<?php echo $char_len; ?>px;">
175
  <ul class="charts">
176
  <li class="chartsT"><?php _e("TOP QUERY", "wassup"); ?></li>
177
  <?php
@@ -184,37 +202,46 @@ if (!$hashfail) {
184
  } // end if topsearch
185
 
186
  //#output top 10 referrers
187
- //# select top 200 referrers: will be narrowed down to 10
188
- //# with exclusion of wpurl referrals...
189
  if ($top_ten['topreferrer'] == 1) {
190
- $top_results = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND referrer!='' AND referrer NOT LIKE '%".$sitedomain."%' AND searchengine='' $spamselect GROUP BY referrer ORDER BY top_referrer DESC LIMIT 200");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  $char_len = round(($max_char_len*.22)+$widthoffset,0);
192
  ?>
193
- <td style="min-width:<?php echo $char_len; ?>px;">
194
  <ul class="charts">
195
  <li class="chartsT"><?php _e("TOP REFERRER", "wassup"); ?></li>
196
  <?php
197
- $rec_count=0; //# of referrer records output...
198
- foreach ($top_results as $top10) {
199
- if ($rec_count < 10) { //limits output to 10...
200
- //# exclude $wpurl from search results...
201
- //# ...$siteurl already excluded in db query.
202
- //if ($wpurl == $siteurl || !eregi($wpurl,$top10->referrer)) {
203
- if (!eregi($siteurl,$top10->referrer)) { ?>
204
  <li class="charts"><?php echo $top10->top_referrer.': ';
205
- print '<a href="'.$top10->referrer.'" title="'.$top10->referrer.'" target="_BLANK">';
206
- //#cut http:// from displayed url, then truncate
207
- //# instead of using stringShortener...
208
- print substr(eregi_replace("http://", "", attribute_escape($top10->referrer)),0,$char_len);
209
- if (strlen($top10->referrer) > ($char_len + 7)) {
210
  print '...';
211
- }
212
- print '</a>'; ?></li>
213
- <?php
214
- $rec_count=$rec_count+1;
215
- } //end if !wpurl
216
- } //end if rec_count
217
- } //end foreach ?>
218
  </ul>
219
  </td>
220
  <?php
@@ -225,7 +252,7 @@ if (!$hashfail) {
225
  $top_results = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND urlrequested!='' $spamselect GROUP BY REPLACE(urlrequested, '/', '') ORDER BY top_urlrequested DESC LIMIT 10");
226
  $char_len = round(($max_char_len*.28)+$widthoffset,0);
227
  ?>
228
- <td style="min-width:<?php echo $char_len; ?>px;">
229
  <ul class="charts">
230
  <li class="chartsT"><?php _e("TOP REQUEST", "wassup"); ?></li>
231
  <?php
@@ -244,7 +271,7 @@ if (!$hashfail) {
244
  $top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE '%N/A%' $spamselect GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
245
  $char_len = round(($max_char_len*.17)+$widthoffset,0);
246
  ?>
247
- <td style="min-width:<?php echo $char_len; ?>px;">
248
  <ul class="charts">
249
  <li class="chartsT"><?php _e("TOP BROWSER", "wassup") ?></li>
250
  <?php
@@ -263,7 +290,7 @@ if (!$hashfail) {
263
  $char_len = round(($max_char_len*.15)+$widthoffset,0);
264
 
265
  ?>
266
- <td style="min-width:<?php echo $char_len; ?>px;">
267
  <ul class="charts">
268
  <li class="chartsT"><?php _e("TOP OS", "wassup") ?></li>
269
  <?php
@@ -282,7 +309,7 @@ if (!$hashfail) {
282
  $char_len = round(($max_char_len*.15)+$widthoffset,0);
283
 
284
  ?>
285
- <td style="min-width:<?php echo $char_len; ?>px;">
286
  <ul class="charts">
287
  <li class="chartsT"><?php _e("TOP LOCALE", "wassup"); ?></li>
288
  <?php
@@ -303,11 +330,12 @@ if (!$hashfail) {
303
  <?php } ?>
304
  </div>
305
  <?php
306
- exit; //for immediate browser rendering
307
  } else {
308
  echo '<span style="font-color:red;">Action.php '.__("ERROR: Missing or unknown parameters","wassup").', action='.attribute_escape($_GET["action"]).'</span>';
309
- }
310
- exit; //for browser rendering
 
 
311
  } else {
312
  echo '<span style="font-color:red;">Action.php '.__("ERROR: Nothing to do here","wassup").'</span>';
313
  } //end if !$hashfail
6
  header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
7
  // HTTP/1.1
8
  header('Cache-Control: no-store, no-cache, must-revalidate');
 
9
  */
 
10
  //#debug...
11
  //error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only
12
  //ini_set('display_errors','On'); //debug
13
 
14
  //#check for required files and include them
 
 
 
 
 
 
 
 
15
  if (!function_exists('get_bloginfo')) {
16
+ if (!defined('ABSPATH')) {
17
+ $wpabspath=substr(__FILE__,0,strpos(__FILE__,'/wp-content/')+1);
18
+ //don't call wp-blog-header.php as it will insert headers from plugins that we don't want here.
19
+ //if (file_exists($wpabspath. 'wp-blog-header.php')) {
20
+ // include_once($wpabspath. 'wp-blog-header.php');
21
+ //}
22
+ } else {
23
+ $wpabspath=ABSPATH;
24
+ }
25
+
26
  if (file_exists($wpabspath. 'wp-config.php')) {
27
  include_once($wpabspath.'wp-config.php');
28
  } else {
41
  exit();
42
  }
43
  }
44
+ //echo "\n"; //send headers
45
+ //echo "Debug: Starting action.php from directory ".dirname(__FILE__).". ABSPATH=".$wpabspath.".<br />\n"; //debug
46
 
47
  //#set required variables
48
  $siteurl = get_bloginfo('siteurl');
58
  if (isset($_GET['whash']) && $_GET['whash'] == $wassup_settings['whash']) {
59
  $hashfail = false;
60
  }
61
+
62
+ //#perform an "action" and display the results
63
  if (!$hashfail) {
64
+ //
65
+ // ### Separate "delete" action because it has no output
66
+ // ACTION: DELETE ON THE FLY FROM VISITOR DETAILS VIEW
67
+ if ($_GET['action'] == "delete" && $_GET['id'] != "" ) {
68
+ if (method_exists($wpdb,'prepare')) {
69
+ $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE wassup_id='%s'", urlencode(attribute_escape($_GET['id']))));
70
+ } else {
71
+ $wpdb->query("DELETE FROM $table_name WHERE wassup_id='".urlencode(attribute_escape($_GET['id']))."'");
72
+ }
73
+ } else {
74
+ //
75
+ // ### Begin actions that have output...
76
+ ?>
77
+ <html>
78
+ <head>
79
+ <link rel="stylesheet" href="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER; ?>/wassup.css" type="text/css" />
80
+ </head>
81
+ <body>
82
+ <?php //#retrieve command-line arguments
83
  if (isset($_GET['to_date'])) $to_date = urlencode(attribute_escape($_GET['to_date']));
84
  else $to_date = wassup_get_time();
85
  if (isset($_GET['from_date'])) $from_date = urlencode(attribute_escape($_GET['from_date']));
100
 
101
  //#perform action and display output
102
  //
 
 
 
 
 
 
 
 
 
 
 
103
  // ACTION: RUN SPY VIEW
104
+ if ($_GET['action'] == "spy") {
105
  if (empty($rows)) { $rows = 999; }
106
  spyview($from_date,$to_date,$rows);
 
107
 
108
  // ACTION: SUMMARY PIE CHART
109
  } elseif ($_GET['action'] == "piechart") {
117
  $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0", "DISTINCT");
118
  $items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0", "DISTINCT"); ?>
119
  <div align="center"><img src="http://chart.apis.google.com/chart?cht=p3&chco=0000ff&chs=600x300&chl=Spam|Search%20Engine|Referrer|Direct&chd=<?php chart_data($items_pie, null, null, null, 'pie'); ?>" /></div>
120
+
121
  <?php
122
  // ACTION: DISPLAY RAW RECORDS
123
  } elseif ($_GET['action'] == "displayraw") {
144
  } //end foreach ?>
145
  <ul>
146
  </div>
147
+
148
  <?php
149
  // ACTION: RUN TOP TEN
150
  } elseif ($_GET['action'] == "topten") {
151
  $top_ten = unserialize($wassup_settings['wassup_top10']);
152
  $sitedomain = parse_url($siteurl);
153
+ //$sitedomain = $sitedomain['host'];
154
+ $sitedomain = preg_replace('/^www\./i','',$sitedomain['host']);
155
+
156
  if (empty($max_char_len)) {
157
  $max_char_len = ($wassup_settings['wassup_screen_res'])/10;
158
  }
166
  } else {
167
  $widthoffset = 0;
168
  }
169
+ //extend page width to make room for more than 5 columns
170
+ $pagewidth = $wassup_settings['wassup_screen_res'];
171
+ if ($col_count > 5) {
172
+ $pagewidth = $pagewidth+17*($col_count-5);
173
+ }
174
+
175
  //only exclude spam if it is being recorded
176
  if ($wassup_settings['wassup_spamcheck'] == 1) {
177
  $spamselect = "AND spam=0";
180
  }
181
  ?>
182
  <style type="text/css">.top10 { color: #542; }</style>
183
+ <div id="toptenchart" style="width:<?php echo $pagewidth; ?>px;">
184
+ <table width="100%" border=0>
185
  <tr valign="top">
186
  <?php
187
  //#output top 10 searches
189
  $top_results = $wpdb->get_results("SELECT count(search) as top_search, search, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND search!='' $spamselect GROUP BY search ORDER BY top_search DESC LIMIT 10");
190
  $char_len = round(($max_char_len*.30)+$widthoffset,0);
191
  ?>
192
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
193
  <ul class="charts">
194
  <li class="chartsT"><?php _e("TOP QUERY", "wassup"); ?></li>
195
  <?php
202
  } // end if topsearch
203
 
204
  //#output top 10 referrers
 
 
205
  if ($top_ten['topreferrer'] == 1) {
206
+ //domains to exclude from top ten referrers:
207
+ //exclude siteurl, wpurl, and user-specified domains
208
+ $exclude_list = $sitedomain;
209
+ $wpdomain = parse_url($wpurl);
210
+ $wpdomain = preg_replace('/^www\./i','',$wpdomain['host']);
211
+ if ($wpdomain != $sitedomain) {
212
+ $exclude_list .= ",".$wpdomain;
213
+ }
214
+ if (!empty($top_ten['topreferrer_exclude'])) {
215
+ $exclude_list .= ",".$top_ten['topreferrer_exclude'];
216
+ }
217
+ //create mysql query to exclude referrer domains
218
+ $exclude_referrers = "";
219
+ $exclude_array = array_unique(explode(",", $exclude_list));
220
+ foreach ($exclude_array as $exclude_domain) {
221
+ $exclude_domain = trim($exclude_domain);
222
+ if ($exclude_domain != "" ) {
223
+ $exclude_referrers .= " AND referrer NOT LIKE '%".$exclude_domain."%'";
224
+ }
225
+ }
226
+ //$top_results = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND referrer!='' AND referrer NOT LIKE '%".$sitedomain."%' AND searchengine='' $spamselect GROUP BY referrer ORDER BY top_referrer DESC LIMIT 200");
227
+ $top_results = $wpdb->get_results("SELECT count(referrer) as top_referrer, referrer FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND referrer!='' $exclude_referrers AND searchengine='' $spamselect GROUP BY referrer ORDER BY top_referrer DESC LIMIT 10");
228
  $char_len = round(($max_char_len*.22)+$widthoffset,0);
229
  ?>
230
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
231
  <ul class="charts">
232
  <li class="chartsT"><?php _e("TOP REFERRER", "wassup"); ?></li>
233
  <?php
234
+ foreach ($top_results as $top10) { ?>
 
 
 
 
 
 
235
  <li class="charts"><?php echo $top10->top_referrer.': ';
236
+ print '<a href="'.$top10->referrer.'" title="'.$top10->referrer.'" target="_BLANK">';
237
+ //#cut http:// from displayed url, then truncate
238
+ //# instead of using stringShortener...
239
+ print substr(str_replace("http://", "", attribute_escape($top10->referrer)),0,$char_len);
240
+ if (strlen($top10->referrer) > ($char_len + 7)) {
241
  print '...';
242
+ }
243
+ print '</a>'; ?></li>
244
+ <?php } ?>
 
 
 
 
245
  </ul>
246
  </td>
247
  <?php
252
  $top_results = $wpdb->get_results("SELECT count(urlrequested) as top_urlrequested, urlrequested FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND urlrequested!='' $spamselect GROUP BY REPLACE(urlrequested, '/', '') ORDER BY top_urlrequested DESC LIMIT 10");
253
  $char_len = round(($max_char_len*.28)+$widthoffset,0);
254
  ?>
255
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
256
  <ul class="charts">
257
  <li class="chartsT"><?php _e("TOP REQUEST", "wassup"); ?></li>
258
  <?php
271
  $top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE '%N/A%' $spamselect GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
272
  $char_len = round(($max_char_len*.17)+$widthoffset,0);
273
  ?>
274
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
275
  <ul class="charts">
276
  <li class="chartsT"><?php _e("TOP BROWSER", "wassup") ?></li>
277
  <?php
290
  $char_len = round(($max_char_len*.15)+$widthoffset,0);
291
 
292
  ?>
293
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
294
  <ul class="charts">
295
  <li class="chartsT"><?php _e("TOP OS", "wassup") ?></li>
296
  <?php
309
  $char_len = round(($max_char_len*.15)+$widthoffset,0);
310
 
311
  ?>
312
+ <td style="min-width:<?php echo ($char_len-5); ?>px;">
313
  <ul class="charts">
314
  <li class="chartsT"><?php _e("TOP LOCALE", "wassup"); ?></li>
315
  <?php
330
  <?php } ?>
331
  </div>
332
  <?php
 
333
  } else {
334
  echo '<span style="font-color:red;">Action.php '.__("ERROR: Missing or unknown parameters","wassup").', action='.attribute_escape($_GET["action"]).'</span>';
335
+ } ?>
336
+ </body></html>
337
+ <?php
338
+ } //end else action=DELETE
339
  } else {
340
  echo '<span style="font-color:red;">Action.php '.__("ERROR: Nothing to do here","wassup").'</span>';
341
  } //end if !$hashfail
lib/main.php CHANGED
@@ -285,30 +285,30 @@ class Detector {
285
 
286
  function check_os($useragent) {
287
 
288
- $os = "N/A"; $version = "N/A";
289
 
290
  if (preg_match("/Windows NT 5.1/",$useragent,$match)) {
291
- $os = "Windows"; $version = "XP";
292
  } elseif (preg_match("/Windows NT 5.2/",$useragent,$match)) {
293
- $os = "Windows"; $version = "Server 2003";
294
  } elseif (preg_match("/Windows NT 6.0/",$useragent,$match)) {
295
- $os = "Windows"; $version = "Vista";
296
  } elseif (preg_match("/(?:Windows NT 5.0|Windows 2000)/",$useragent,$match)) {
297
- $os = "Windows"; $version = "2000";
298
  } elseif (preg_match("/Windows ME/",$useragent,$match)) {
299
- $os = "Windows"; $version = "ME";
300
  } elseif (preg_match("/(?:WinNT|Windows\s?NT)\s?([0-9\.]+)?/",$useragent,$match)) {
301
- $os = "Windows"; $version = "NT ".$match[1];
302
  } elseif (preg_match("/Mac OS X/",$useragent,$match)) {
303
- $os = "Mac OS"; $version = "X";
304
  } elseif (preg_match("/(Mac_PowerPC|Macintosh)/",$useragent,$match)) {
305
- $os = "Mac OS"; $version = "";
306
  } elseif (preg_match("/(?:Windows95|Windows 95|Win95|Win 95)/",$useragent,$match)) {
307
- $os = "Windows"; $version = "95";
308
  } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98|Win 9x)/",$useragent,$match)) {
309
- $os = "Windows"; $version = "98";
310
  } elseif (preg_match("/(?:WindowsCE|Windows CE|WinCE|Win CE)/",$useragent,$match)) {
311
- $os = "Windows"; $version = "CE";
312
  } elseif (preg_match("/PalmOS/",$useragent,$match)) {
313
  $os = "PalmOS";
314
  } elseif (preg_match("/\(PDA(?:.*)\)(.*)Zaurus/",$useragent,$match)) {
@@ -341,7 +341,7 @@ class Detector {
341
 
342
  function check_browser($useragent) {
343
 
344
- $browser = "N/A";
345
 
346
  if (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s(?:.*)Opera\s([0-9\.]+)/",$useragent,$match)) {
347
  $browser = "Opera";
@@ -352,9 +352,9 @@ class Detector {
352
  } elseif (preg_match("/^iCab\/([0-9\.]+)/",$useragent,$match)) {
353
  $browser = "iCab";
354
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
355
- $browser = "MSIE";
356
  } elseif (preg_match("/^(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
357
- $browser = "MSIE";
358
  } elseif (preg_match("/^Mozilla(?:.*)(?:.*)Safari/",$useragent,$match)) {
359
  $browser = "Safari";
360
  //} elseif (preg_match("/^Mozilla(?:.*)\(Windows(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) {
@@ -365,10 +365,12 @@ class Detector {
365
  $browser = "Google Desktop";
366
  } elseif (preg_match("/^Mozilla(?:.*)\(compatible;\sOmniWeb\/([0-9\.v-]+)/",$useragent,$match)) {
367
  $browser = "Omniweb";
 
 
368
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Netscape\/([0-9\.]+)/",$useragent,$match)) {
369
  $browser = "Netscape";
370
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)(?:Fire(?:fox|bird)|Phoenix)\/([0-9\.]+)/",$useragent,$match)) {
371
- $browser = "Mozilla Firefox";
372
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Minefield\/([0-9\.]+)/",$useragent,$match)) {
373
  $browser = "Minefield";
374
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Epiphany\/([0-9\.]+)/",$useragent,$match)) {
@@ -377,8 +379,6 @@ class Detector {
377
  $browser = "Galeon";
378
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)K-Meleon\/([0-9\.]+)/",$useragent,$match)) {
379
  $browser = "K-Meleon";
380
- } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)(?:Camino|Chimera)\/([0-9\.]+)/",$useragent,$match)) {
381
- $browser = "Camino";
382
  } elseif (preg_match("/^Mozilla(?:.*)rv:([0-9\.]+)\)\sGecko/",$useragent,$match)) {
383
  $browser = "Mozilla";
384
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sKonqueror\/([0-9\.]+);/",$useragent,$match)) {
@@ -421,7 +421,10 @@ class Detector {
421
  $browser="SonyEricsson";
422
  }
423
 
424
- $version = $match[1];
 
 
 
425
 
426
  $this->browser = $browser;
427
  $this->browser_version = $version;
285
 
286
  function check_os($useragent) {
287
 
288
+ $os = "N/A"; $version = "";
289
 
290
  if (preg_match("/Windows NT 5.1/",$useragent,$match)) {
291
+ $os = "WinXP"; $version = "";
292
  } elseif (preg_match("/Windows NT 5.2/",$useragent,$match)) {
293
+ $os = "Win2003"; $version = "";
294
  } elseif (preg_match("/Windows NT 6.0/",$useragent,$match)) {
295
+ $os = "WinVista"; $version = "";
296
  } elseif (preg_match("/(?:Windows NT 5.0|Windows 2000)/",$useragent,$match)) {
297
+ $os = "Win2000"; $version = "";
298
  } elseif (preg_match("/Windows ME/",$useragent,$match)) {
299
+ $os = "WinME"; $version = "";
300
  } elseif (preg_match("/(?:WinNT|Windows\s?NT)\s?([0-9\.]+)?/",$useragent,$match)) {
301
+ $os = "WinNT"; $version = $match[1];
302
  } elseif (preg_match("/Mac OS X/",$useragent,$match)) {
303
+ $os = "MacOSX"; $version = "";
304
  } elseif (preg_match("/(Mac_PowerPC|Macintosh)/",$useragent,$match)) {
305
+ $os = "MacPPC"; $version = "";
306
  } elseif (preg_match("/(?:Windows95|Windows 95|Win95|Win 95)/",$useragent,$match)) {
307
+ $os = "Win95"; $version = "";
308
  } elseif (preg_match("/(?:Windows98|Windows 98|Win98|Win 98|Win 9x)/",$useragent,$match)) {
309
+ $os = "Win98"; $version = "";
310
  } elseif (preg_match("/(?:WindowsCE|Windows CE|WinCE|Win CE)/",$useragent,$match)) {
311
+ $os = "WinCE"; $version = "";
312
  } elseif (preg_match("/PalmOS/",$useragent,$match)) {
313
  $os = "PalmOS";
314
  } elseif (preg_match("/\(PDA(?:.*)\)(.*)Zaurus/",$useragent,$match)) {
341
 
342
  function check_browser($useragent) {
343
 
344
+ $browser = "";
345
 
346
  if (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s(?:.*)Opera\s([0-9\.]+)/",$useragent,$match)) {
347
  $browser = "Opera";
352
  } elseif (preg_match("/^iCab\/([0-9\.]+)/",$useragent,$match)) {
353
  $browser = "iCab";
354
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
355
+ $browser = "IE";
356
  } elseif (preg_match("/^(?:.*)compatible;\sMSIE\s([0-9\.]+)/",$useragent,$match)) {
357
+ $browser = "IE";
358
  } elseif (preg_match("/^Mozilla(?:.*)(?:.*)Safari/",$useragent,$match)) {
359
  $browser = "Safari";
360
  //} elseif (preg_match("/^Mozilla(?:.*)\(Windows(?:.*)Safari\/([0-9\.]+)/",$useragent,$match)) {
365
  $browser = "Google Desktop";
366
  } elseif (preg_match("/^Mozilla(?:.*)\(compatible;\sOmniWeb\/([0-9\.v-]+)/",$useragent,$match)) {
367
  $browser = "Omniweb";
368
+ } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)(?:Camino|Chimera)\/([0-9\.]+)/",$useragent,$match)) {
369
+ $browser = "Camino";
370
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Netscape\/([0-9\.]+)/",$useragent,$match)) {
371
  $browser = "Netscape";
372
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)(?:Fire(?:fox|bird)|Phoenix)\/([0-9\.]+)/",$useragent,$match)) {
373
+ $browser = "Firefox";
374
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Minefield\/([0-9\.]+)/",$useragent,$match)) {
375
  $browser = "Minefield";
376
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)Epiphany\/([0-9\.]+)/",$useragent,$match)) {
379
  $browser = "Galeon";
380
  } elseif (preg_match("/^Mozilla(?:.*)Gecko(?:.*?)K-Meleon\/([0-9\.]+)/",$useragent,$match)) {
381
  $browser = "K-Meleon";
 
 
382
  } elseif (preg_match("/^Mozilla(?:.*)rv:([0-9\.]+)\)\sGecko/",$useragent,$match)) {
383
  $browser = "Mozilla";
384
  } elseif (preg_match("/^Mozilla(?:.*)compatible;\sKonqueror\/([0-9\.]+);/",$useragent,$match)) {
421
  $browser="SonyEricsson";
422
  }
423
 
424
+ //$version = $match[1];
425
+ //restrict version to major and minor version #'s
426
+ preg_match("/^\d+(\.\d+)?/",$match[1],$majorvers);
427
+ $version = $majorvers[0];
428
 
429
  $this->browser = $browser;
430
  $this->browser_version = $version;
lib/settings.php CHANGED
@@ -126,13 +126,19 @@
126
  <input type="checkbox" name="topos" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top OS", "wassup"); ?> <br />
127
  <input type="checkbox" name="toplocale" value="1" <?php if($top_ten['toplocale'] == 1) print "CHECKED"; ?> /><?php _e("Top Locales", "wassup"); ?></span><br />
128
  </div>
129
- <div style="display:block; vertical-align:top; float:left; width:225px; color:#555;">
130
  <input type="checkbox" name="topfeed" value="1" DISABLED /><?php _e("Top Feeds", "wassup"); ?><br />
131
  <input type="checkbox" name="topcrawler" value="1" DISABLED /><?php _e("Top Crawlers", "wassup"); ?> <br />
132
  <input type="checkbox" name="topvisitor" value="1" DISABLED /><?php _e("Top Visitors", "wassup"); ?> (<?php _e("users only","wassup"); ?>)<br />
133
  </div>
134
  </div>
135
  </p>
 
 
 
 
 
 
136
  <br /><br />
137
  <p style="clear:both;padding-left:0;padding-top:15px;"><input type="submit" name="submit-options" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
138
  </div>
@@ -167,11 +173,14 @@
167
  <div id="wassup_opt_frag-3">
168
  <h3><?php _e('Temporary files location folder','wassup'); ?></h3>
169
  <p><?php echo '<strong>'.__('Current "Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:<br />';
170
- $sessionpath = $wassup_options->getSavepath();
 
 
 
171
  //$sessionpath = "/fakefolder/temp"; //#debug
172
  $sessionstyle = '';
173
  //# check that session_save_path exists and is writable...
174
- if ($wassup_options->isWritableFolder($sessionpath) == false) {
175
  $sessionwarn = '<span style="font-size:95%; padding-left:5px;'.$alertstyle.'"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please enter a different path above or change "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</span>';
176
  $sessionstyle = $alertstyle;
177
  } else {
126
  <input type="checkbox" name="topos" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top OS", "wassup"); ?> <br />
127
  <input type="checkbox" name="toplocale" value="1" <?php if($top_ten['toplocale'] == 1) print "CHECKED"; ?> /><?php _e("Top Locales", "wassup"); ?></span><br />
128
  </div>
129
+ <div style="display:none; vertical-align:top; float:left; width:225px; color:#555;">
130
  <input type="checkbox" name="topfeed" value="1" DISABLED /><?php _e("Top Feeds", "wassup"); ?><br />
131
  <input type="checkbox" name="topcrawler" value="1" DISABLED /><?php _e("Top Crawlers", "wassup"); ?> <br />
132
  <input type="checkbox" name="topvisitor" value="1" DISABLED /><?php _e("Top Visitors", "wassup"); ?> (<?php _e("users only","wassup"); ?>)<br />
133
  </div>
134
  </div>
135
  </p>
136
+ <p style="margin-top:5px; clear:left;"> <strong><?php _e("Additional website domains to exclude from Top Referrers", "wassup"); ?></strong> :<br />
137
+ <span style="padding-left:10px;display:block;clear:left;">
138
+ <textarea name="topreferrer_exclude" rows="1" cols="66"><?php echo $top_ten['topreferrer_exclude']; ?></textarea><br />
139
+ <?php _e("Comma separated value","wassup"); ?> (ex: mydomain2.net, mydomain2.info,...).
140
+ <?php _e("Don't list your website domain defined in WordPress","wassup"); ?>.
141
+ </span></p>
142
  <br /><br />
143
  <p style="clear:both;padding-left:0;padding-top:15px;"><input type="submit" name="submit-options" value="<?php _e('Save Settings','wassup'); ?>" />&nbsp;<input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
144
  </div>
173
  <div id="wassup_opt_frag-3">
174
  <h3><?php _e('Temporary files location folder','wassup'); ?></h3>
175
  <p><?php echo '<strong>'.__('Current "Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:<br />';
176
+ $sessionpath = $wassup_options->wassup_savepath;
177
+ if (empty($sessionpath)) {
178
+ $sessionpath = getSessionpath();
179
+ }
180
  //$sessionpath = "/fakefolder/temp"; //#debug
181
  $sessionstyle = '';
182
  //# check that session_save_path exists and is writable...
183
+ if ($sessionpath == "" || $wassup_options->isWritableFolder($sessionpath) == false) {
184
  $sessionwarn = '<span style="font-size:95%; padding-left:5px;'.$alertstyle.'"><span style="text-decoration:blink;">'.__('WARNING','wassup').'!</span> '.__('Directory does not exist or is not writable. Please enter a different path above or change "session.save_path" in "php.ini" to point to a valid, writable folder','wassup').'.</span>';
185
  $sessionstyle = $alertstyle;
186
  } else {
lib/wassup.class.php CHANGED
@@ -14,7 +14,7 @@ class wassupOptions {
14
  var $wassup_default_type = "";
15
  var $wassup_default_limit = "10";
16
  var $wassup_top10 ;
17
- var $wassup_dashboard_chart;
18
 
19
  /* recording settings */
20
  var $wassup_active = "1";
@@ -61,7 +61,7 @@ class wassupOptions {
61
  var $wassup_alert_message; //used to display alerts
62
  var $wmark;
63
  var $wip;
64
- var $whash = ""; //new - wp_hash value used by action.php
65
 
66
  /* Constructor */
67
  function wassupoptions() {
@@ -118,7 +118,8 @@ class wassupOptions {
118
  "toplocale"=>"0",
119
  "topfeed"=>"0",
120
  "topcrawler"=>"0",
121
- "topvisitor"=>"0"));
 
122
  $this->whash = $this->get_wp_hash();
123
  }
124
 
@@ -248,47 +249,50 @@ class wassupOptions {
248
  }
249
  } //end showFormOptions
250
 
251
- //#Return current PHP session.save_path value (pathname portion)
252
- function getSessionpath() {
253
- $sessionpath = trim(session_save_path());
254
- if (strpos($sessionpath, ";") !== FALSE) {
255
- $sessionpath = substr($sessionpath, strpos($sessionpath, ";")+1);
256
- }
257
- //use a default "/tmp" path if none
258
- if (empty($sessionpath)) { $sessionpath = "/tmp"; }
259
-
260
- return rtrim($sessionpath,"/");
261
- }
262
-
263
- //#Return the value of class variable, wassup_savepath, if not null
264
- //# or return PHP session.save_path (pathname portion)
265
- function getSavepath() {
266
- if (empty($this->wassup_savepath)) {
267
- return $this->getSessionpath();
268
- } else {
269
- return $this->wassup_savepath;
270
- }
271
- }
272
 
273
  //#Sets the class variable, wassup_savepath, with the given
274
  //# value $savepath
275
  function setSavepath($savepath="") {
276
  $savepath = rtrim($savepath,"/");
277
- if (empty($savepath) || $savepath == $this->getSessionpath()) {
278
- $this->wassup_savepath = NULL;
279
- } else {
280
- $this->wassup_savepath = $savepath;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
 
282
  }
283
 
284
  //#Return true if the given directory path exists and is writable
285
  function isWritableFolder($folderpath="") {
286
  $folderpath=trim($folderpath); //remove white spaces
287
- if (!empty($folderpath) && file_exists($folderpath)) {
288
- $testfile = rtrim($folderpath,"/")."/temp".time().'.txt';
289
- //#check that the directory is writable...
290
- if (@touch($testfile)) { unlink($testfile); }
291
- else { return false; }
 
 
 
 
292
  } else {
293
  return false;
294
  }
14
  var $wassup_default_type = "";
15
  var $wassup_default_limit = "10";
16
  var $wassup_top10 ;
17
+ var $wassup_dashboard_chart; //new
18
 
19
  /* recording settings */
20
  var $wassup_active = "1";
61
  var $wassup_alert_message; //used to display alerts
62
  var $wmark;
63
  var $wip;
64
+ var $whash = ""; //wp_hash value used by action.php
65
 
66
  /* Constructor */
67
  function wassupoptions() {
118
  "toplocale"=>"0",
119
  "topfeed"=>"0",
120
  "topcrawler"=>"0",
121
+ "topvisitor"=>"0",
122
+ "topreferrer_exclude"=>""));
123
  $this->whash = $this->get_wp_hash();
124
  }
125
 
249
  }
250
  } //end showFormOptions
251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
 
253
  //#Sets the class variable, wassup_savepath, with the given
254
  //# value $savepath
255
  function setSavepath($savepath="") {
256
  $savepath = rtrim($savepath,"/");
257
+ $siteurl = rtrim(get_bloginfo('siteurl'),"/");
258
+ if (!empty($savepath)) {
259
+ //remove site URL from path in case user entered it
260
+ if (strpos($savepath, $siteurl) === 0) {
261
+ $tmppath=substr($savepath,strlen($siteurl)+1);
262
+ } elseif (strpos($savepath,'/') === 0 && !$this->isWritableFolder($savepath)) {
263
+ $tmppath=substr($savepath,1);
264
+ } elseif (strpos($savepath,'./') === 0 ) {
265
+ $tmppath=substr($savepath,2);
266
+ } else {
267
+ $tmppath = $savepath;
268
+ }
269
+ //append website root or home directory to relative paths...
270
+ if (preg_match('/^[a-zA-Z]/',$tmppath) > 0 || strpos($tmppath,'../') === 0) {
271
+ if (!empty($_ENV['DOCUMENT_ROOT'])) {
272
+ $tmppath = rtrim($_ENV['DOCUMENT_ROOT'],'/').'/'.$tmppath;
273
+ } elseif (!empty($_ENV['HOME'])) {
274
+ $tmppath = rtrim($_ENV['HOME'],'/').'/'.$tmppath;
275
+ }
276
+ if ($this->isWritableFolder($tmppath)) {
277
+ $savepath = $tmppath;
278
+ }
279
+ }
280
  }
281
+ $this->wassup_savepath = $savepath;
282
  }
283
 
284
  //#Return true if the given directory path exists and is writable
285
  function isWritableFolder($folderpath="") {
286
  $folderpath=trim($folderpath); //remove white spaces
287
+ if (!empty($folderpath) && strpos($folderpath,'http://') !== 0 ) {
288
+ if (file_exists($folderpath)) {
289
+ $testfile = rtrim($folderpath,"/")."/temp".time().'.txt';
290
+ //#check that the directory is writable...
291
+ if (@touch($testfile)) { unlink($testfile); }
292
+ else { return false; }
293
+ } else {
294
+ return false;
295
+ }
296
  } else {
297
  return false;
298
  }
readme.txt CHANGED
@@ -4,9 +4,9 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
5
  Requires at least: 2.2
6
  Tested up to: 2.5 - 2.3.2 - 2.3.1 - 2.3 - 2.2
7
- Stable tag: 1.5.1
8
 
9
- Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
10
 
11
  == Description ==
12
 
@@ -14,11 +14,11 @@ WassUp is a new Wordpress plugin to track your visitors in real time. It has a v
14
  It has a "current visitors online" view and a more detailed "visitors details" view where you can know almost everything your users are doing on your blog, it's very useful for SEO or statistics maniacs. Now it comes with a new "Spy" view in Ajax like the Digg Spy.
15
  The aim of WassUp is the knowledge of what your visitors do when they surf your blog, it is not intended to show grouped statistics for periods like visitors per day, pageviews per months and so on (there are many others tools to better gain that, like Google Analytics). With WassUp you'll get a cronology of your blog's visits with a lot of details for each single user session.
16
 
17
- Now WassUp works with two anti-spam function to detect and skip (if you want) referers spammers and akismet spammers.
18
 
19
- For people with database space problem, now WassUp has some options to manage his database table, you can empty it or delete old records to prevent reaching the size limit.
20
 
21
- Now it comes with a nice sidebar Widget which shows current visitors online, last searched terms and last external referers. The widget is fully customizable.
22
 
23
  WassUp shows a lot of data from who is visiting your blog like:
24
 
@@ -60,10 +60,6 @@ Many options are customizable:
60
  - Record or not exploit attempts (libwww-perl user agent)
61
  - IPs to exclude from recording
62
  - Alert admin for table growth
63
- - Empty/Reset the database table
64
- - Export current table in SQL format
65
- - Automatically deletes records older then selected period (day, week, months, year)
66
- - Manually deletes records older then selected period (day, week, months, year)
67
 
68
  == Frequently Asked Questions ==
69
 
@@ -73,7 +69,7 @@ Coming soon
73
 
74
  You could find some screenshots at http://www.wpwp.org
75
 
76
- == Usage ==
77
 
78
  Installation:
79
 
@@ -89,6 +85,8 @@ Upgrading:
89
  - Download and unzip the new WassUp file into the plugins dir
90
  - Enable the WassUp plugin
91
 
 
 
92
  Usage:
93
 
94
  When you activate (as described in "Installation") the plugin, it works "as is". You don't have anything to do. Wait your visitors hit your blog and start seeing details (click the dashboard and go to WassUp page)
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
5
  Requires at least: 2.2
6
  Tested up to: 2.5 - 2.3.2 - 2.3.1 - 2.3 - 2.2
7
+ Stable tag: 1.6
8
 
9
+ Analyze your visitors traffic with real time statistics, chart, a lot of chronological information and a sidebar Widget.
10
 
11
  == Description ==
12
 
14
  It has a "current visitors online" view and a more detailed "visitors details" view where you can know almost everything your users are doing on your blog, it's very useful for SEO or statistics maniacs. Now it comes with a new "Spy" view in Ajax like the Digg Spy.
15
  The aim of WassUp is the knowledge of what your visitors do when they surf your blog, it is not intended to show grouped statistics for periods like visitors per day, pageviews per months and so on (there are many others tools to better gain that, like Google Analytics). With WassUp you'll get a cronology of your blog's visits with a lot of details for each single user session.
16
 
17
+ WassUp works with two anti-spam function to detect and skip (if you want) referers spammers and akismet spammers.
18
 
19
+ For people with database space problem, WassUp has some options to manage his database table, you can empty it or delete old records to prevent reaching the size limit.
20
 
21
+ It comes with a nice sidebar Widget which shows current visitors online, last searched terms and last external referers. The widget is fully customizable.
22
 
23
  WassUp shows a lot of data from who is visiting your blog like:
24
 
60
  - Record or not exploit attempts (libwww-perl user agent)
61
  - IPs to exclude from recording
62
  - Alert admin for table growth
 
 
 
 
63
 
64
  == Frequently Asked Questions ==
65
 
69
 
70
  You could find some screenshots at http://www.wpwp.org
71
 
72
+ == Installation ==
73
 
74
  Installation:
75
 
85
  - Download and unzip the new WassUp file into the plugins dir
86
  - Enable the WassUp plugin
87
 
88
+ == Usage ==
89
+
90
  Usage:
91
 
92
  When you activate (as described in "Installation") the plugin, it works "as is". You don't have anything to do. Wait your visitors hit your blog and start seeing details (click the dashboard and go to WassUp page)
wassup.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WassUp
4
  Plugin URI: http://www.wpwp.org
5
  Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
6
- Version: 1.5.1
7
  Author: Michele Marcucci
8
  Author URI: http://www.michelem.org/
9
 
@@ -16,7 +16,7 @@ http://www.gnu.org/licenses/gpl.txt
16
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
17
  die('Permission Denied! You are not allowed to call this page directly.');
18
  }
19
- $version = "1.5.1";
20
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
21
  require_once(dirname(__FILE__).'/lib/wassup.class.php');
22
  require_once(dirname(__FILE__).'/lib/main.php');
@@ -31,18 +31,10 @@ global $wp_version;
31
  //#This works only in WP2.2 or higher
32
  if (version_compare($wp_version, '2.2', '<')) {
33
  wp_die( '<strong style="color:#c00;background-color:#dff;padding:5px;">'.__("Sorry, Wassup requires WordPress 2.2 or higher to work","wassup").'.</strong>');
34
- } else {
35
- register_activation_hook(__FILE__, 'wassup_install');
36
- register_deactivation_hook(__FILE__, 'wassup_uninstall');
37
- add_action('admin_head', 'add_wassup_css');
38
- add_action('wp_head', 'add_wassup_meta_info');
39
- add_action('init', 'wassup_init');
40
- add_action("widgets_init", "wassup_widget_init");
41
- add_action('admin_menu', 'wassup_add_pages');
42
- add_action('send_headers', 'wassupAppend');
43
- add_action('activity_box_end', 'wassupDashChart');
44
  }
45
-
46
  //#add initial options and create table when Wassup activated
47
  // -Helene D. 2/26/08.
48
  function wassup_install() {
@@ -75,6 +67,7 @@ function wassup_install() {
75
  $wassup_options->wassup_spamcheck = "0";
76
  }
77
  }
 
78
  //# update wassup settings for 'savepath' (default is null)
79
  //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug
80
  if (!isset($wassup_options->wassup_savepath)) {
@@ -94,7 +87,8 @@ function wassup_install() {
94
  "toplocale"=>"0",
95
  "topfeed"=>"0",
96
  "topcrawler"=>"0",
97
- "topvisitor"=>"0"));
 
98
  }
99
  $wassup_options->saveSettings();
100
 
@@ -102,16 +96,22 @@ function wassup_install() {
102
  //#
103
  //#Check for problems with 'session_savepath' and disable
104
  //# recording, if found. -Helene D. 2/24/08
105
- $sessionpath = $wassup_options->getSavepath();
106
- if ($wassup_options->isWritableFolder($sessionpath) == false) {
 
 
 
 
 
 
107
  if ($wassup_options->wassup_active == "1") {
108
  $wassup_options->wassup_active = "0";
109
  $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
110
  } else {
111
  $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
112
  }
113
- $wassup_options->saveSettings();
114
- }
115
  unset($sessionpath); //because "install" works in global scope
116
 
117
  //# TODO:
@@ -126,6 +126,14 @@ function wassup_install() {
126
  } else {
127
  UpdateTable(); //<== wassup_tmp is added here, if missing
128
  }
 
 
 
 
 
 
 
 
129
  } //#end function wassup_install
130
 
131
  //set global variables that are dependent on Wassup's wp_options values
@@ -153,28 +161,31 @@ function add_wassup_meta_info() {
153
  print '<meta name="wassup-version" content="'.$version.'" />';
154
  }
155
 
156
- //# Load jquery AJAX library and dependent javascripts plus the
157
- //# language/localization files for Wassup admin menus...
 
 
158
  function wassup_init() {
159
  global $wpurl;
160
 
161
- //### Add wassup scripts...
162
  if (stristr($_GET['page'],'wassup') !== FALSE) {
163
- if ( function_exists('wp_deregister_script')) {
164
- wp_deregister_script('jquery'); //removes old jquery vers.
165
- }
166
- // the safe way to load jquery into WP...
167
- wp_register_script('jquery', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/jquery.js',FALSE,'1.2.3');
168
- if ($_GET['page'] == "wassup-spy") {
169
- //the safe way to load a jquery dependent script into WP...
170
- wp_enqueue_script('spy', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/spy.js', array('jquery'), '1.4');
171
- } elseif($_GET['page'] == "wassup-options") {
172
- wp_enqueue_script('ui.base', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.base.js', array('jquery'), '3');
173
- wp_enqueue_script('ui.tabs', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.tabs.js', array('jquery'), '3');
174
- } else {
175
- //the safe way to load a jquery dependent script into WP...
176
- wp_enqueue_script('thickbox', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.js', array('jquery'), '3');
177
- }
 
178
  }
179
 
180
  //Loading language file...
@@ -185,6 +196,12 @@ function wassup_init() {
185
  $moFile = dirname(__FILE__) . "/language/" . $currentLocale . ".mo";
186
  if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wassup', $moFile);
187
  }
 
 
 
 
 
 
188
  } // end function wassup_init
189
 
190
  //Add the wassup stylesheet and other javascripts...
@@ -453,10 +470,11 @@ function WassUp() {
453
  "toplocale" => $_POST['toplocale'],
454
  "topfeed" => "0",
455
  "topcrawler" => "0",
456
- "topvisitor" => "0");
 
457
  $wassup_options->wassup_top10 = serialize($top_ten);
458
  if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
459
- if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == $wassup_options->getSessionpath()) {
460
  $wassup_options->wassup_savepath = NULL;
461
  } else {
462
  $wassup_options->setSavepath($_POST['wassup_savepath']);
@@ -531,15 +549,21 @@ function WassUp() {
531
  <?php
532
  $to_date = wassup_get_time();
533
  $from_date = strtotime('-3 minutes', $to_date);
534
- $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_tmp_name WHERE timestamp BETWEEN $from_date AND $to_date");
535
  $currenttot = $currenttot+0; //set to integer
536
  print "<p class='legend'>".__("Visitors online", "wassup").": <strong>".$currenttot."</strong></p><br />";
537
  if ($currenttot > 0) {
538
- $qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE timestamp BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
539
  foreach ($qryC as $cv) {
540
  //$timestamp = $cv->max_timestamp; //redundant
541
  $timed = gmdate("H:i:s", $cv->max_timestamp);
542
- $ip = @explode(",", $cv->ip);
 
 
 
 
 
 
543
  if ($cv->referrer != '') {
544
  if (!eregi($wpurl, $cv->referrer) OR $cv->searchengine != "") {
545
  if (!eregi($wpurl, $cv->referrer) AND $cv->searchengine == "") {
@@ -556,7 +580,7 @@ function WassUp() {
556
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."'");
557
  ?>
558
  <div class="sum">
559
- <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $cv->id ?>"><?php print $ip[0]; ?></a><?php } else { ?><?php print $ip[0]; ?><?php } ?></span>
560
  <div class="sum-det"><span class="det1">
561
  <?php
562
  //# html_entity_decode() links that were already
@@ -585,7 +609,7 @@ function WassUp() {
585
  <div style="display: none;" class="togglenavi navi<?php echo $cv->id ?>">
586
  <ul class="url">
587
  <?php
588
- $qryCD = $wpdb->get_results("SELECT timestamp, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY timestamp ASC");
589
  $i=0;
590
  foreach ($qryCD as $cd) {
591
  //$timestamp2 = $cd->timestamp; //redundant
@@ -739,11 +763,11 @@ function WassUp() {
739
  //# Moved and limited delete to selected date range only.
740
  //# -Helene D. 3/4/08.
741
  if (!empty($_GET['deleteMARKED']) && $wassup_options->wmark == "1" ) {
742
- $rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND timestamp BETWEEN $from_date AND $to_date");
743
  if (method_exists($wpdb,'prepare')) {
744
- $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE ip='%s' AND timestamp BETWEEN %s AND %s", urlencode(attribute_escape($_GET['dip'])), $from_date, $to_date));
745
  } else {
746
- $wpdb->query("DELETE FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND timestamp BETWEEN $from_date AND $to_date");
747
  }
748
  echo '<p><strong>'.$rec_deleted.' '.__('records deleted','wassup').'</strong></p>';
749
  //reset wmark/deleteMarked after delete and
@@ -917,19 +941,45 @@ function WassUp() {
917
  $dateF = gmdate("d M Y", $timestampF);
918
  $timeF = gmdate("H:i:s", $timestampF);
919
  $datetimeF = gmdate('Y-m-d H:i:s', $timestampF);
920
- $ip = @explode(",", $rk->ip);
 
 
 
 
 
 
 
921
 
922
- // Visitor Record - raw data (hidden) ?>
923
- <div id="raw-<?php echo $rk->wassup_id; ?>" style="display:none; padding-top:7px;" >
 
 
924
  <h2><?php _e("Raw data","wassup"); ?>:</h2>
925
  <style type="text/css">.raw { color: #542; padding-left:5px; }</style>
926
  <ul style="list-style-type:none;padding:20px 0 0 30px;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
927
  <li><?php echo __("IP","wassup").': <span class="raw">'.$rk->ip.'</span>'; ?></li>
928
  <li><?php echo __("Hostname","wassup").': <span class="raw">'.$rk->hostname.'</span>'; ?></li>
 
929
  <li><?php echo __("User Agent","wassup").': <span class="raw">'.$rk->agent.'</span>'; ?></li>
930
  <li><?php echo __("Referrer","wassup").': <span class="raw">'.urldecode($rk->referrer).'</span>'; ?></li>
931
  <?php if ($rk->search != "") { ?>
932
- <li><?php echo __("Search","wassup").': <span class="raw">'.$rk->search.'</span>'; ?></li>
 
933
  <?php }
934
  if ($rk->os != "") { ?>
935
  <li><?php echo __("OS","wassup").': <span class="raw">'.$rk->os.'</span>'; ?></li>
@@ -938,10 +988,10 @@ function WassUp() {
938
  <li><?php echo __("Browser","wassup").': <span class="raw">'.$rk->browser.'</span>'; ?></li>
939
  <?php }
940
  if ($rk->language != "") { ?>
941
- <li><?php echo __("Language","wassup").': <span class="raw">'.$rk->language.'</span>'; ?></li>
942
  <?php } ?>
943
- <li><?php echo __("Url Requested","wassup").': <span class="raw">'.htmlspecialchars(html_entity_decode(clean_url($rk->urlrequested))).'</span>'; ?></li>
944
- <li><?php echo __("End Timestamp","wassup").': <span class="raw">'.$datetimeF.' ( '.$rk->max_timestamp.' )</span>'; ?></li>
945
  </ul>
946
  </div> <!-- raw-wassup_id -->
947
 
@@ -964,26 +1014,26 @@ function WassUp() {
964
  ?>
965
 
966
  <div class="delID<?php echo $rk->wassup_id ?>">
967
- <div class="<?php if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip[0]) echo "sum-nav-mark"; else echo "sum-nav"; ?>">
968
 
969
  <p class="delbut">
970
  <?php // Mark/Unmark IP
971
- if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip[0]) { ?>
972
- <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&deleteMARKED=1&dip=<?php print $ip[0]; ?>" style="text-decoration:none;">
973
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete ALL marked records with this IP','wassup'); ?>" /></a>
974
  <a href="?page=<?php echo WASSUPFOLDER; ?>&wmark=0" style="text-decoration:none;">
975
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_delete.png" alt="'.__('unmark','wassup').'" title="'.__('UnMark IP','wassup'); ?>" /></a>
976
  <?php } else { ?>
977
  <a href="#" class="deleteID" id="<?php echo $rk->wassup_id ?>" style="text-decoration:none;">
978
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete this record','wassup'); ?>" /></a>
979
- <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&wmark=1&wip=<?php print $ip[0]; ?>" style="text-decoration:none;">
980
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_add.png" alt="'.__('mark','wassup').'" title="'.__('Mark IP','wassup'); ?>" /></a>
981
  <?php } ?>
982
- <a href="#TB_inline?height=400&width=<?php echo $res.'&inlineId=raw-'.$rk->wassup_id; ?>" class="thickbox">
983
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/database_table.png" alt="'.__('show raw table','wassup').'" title="'.__('Show the items as raw table','wassup'); ?>" /></a>
984
  </p>
985
 
986
- <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $rk->id ?>"><?php print $ip[0]; ?></a><?php } else { ?><?php print $ip[0]; ?><?php } ?></span>
987
  <span class="sum-date"><?php print $datetimeF; ?></span>
988
  <div class="sum-det"><span class="det1">
989
  <?php
@@ -1040,7 +1090,9 @@ function WassUp() {
1040
  if ($rk->feed != "") { ?>
1041
  <ul style="background:#fdeec8;" class="spider">
1042
  <li class="feed"><span class="indent-li-agent"><?php _e('FEEDREADER','wassup'); ?>: <strong><?php print $rk->spider; ?></strong></span></li>
1043
- <li class="feed"><span class="indent-li-agent"><?php _e('SUBSCRIBER(S)','wassup'); ?>: <strong><?php print $rk->feed; ?></strong></span></li>
 
 
1044
  </ul>
1045
  <?php } else { ?>
1046
  <ul class="spider">
@@ -1077,7 +1129,7 @@ function WassUp() {
1077
  <div style="display: visible;" class="togglecrono navi<?php echo $rk->id ?>">
1078
  <ul class="url">
1079
  <?php
1080
- $qryCD = $wpdb->get_results("SELECT timestamp, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY timestamp ASC");
1081
  $i=0;
1082
  foreach ($qryCD as $cd) {
1083
  //$timestamp2 = $cd->timestamp; //redundant
@@ -1116,19 +1168,19 @@ function WassUp() {
1116
  <?php
1117
  } //end function Wassup
1118
 
1119
- function CreateTable($tablename="wassup") {
1120
- global $wpdb;
1121
- $charset_collate = '';
1122
- if ( $wpdb->supports_collation() ) {
1123
- if ( ! empty($wpdb->charset) )
1124
- $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
1125
- if ( ! empty($wpdb->collate) )
1126
- $charset_collate .= " COLLATE $wpdb->collate";
1127
- }
1128
- $table_name = $wpdb->prefix . $tablename;
1129
  $sql_createtable = "CREATE TABLE " . $table_name . " (
1130
  id mediumint(9) NOT NULL auto_increment,
1131
- wassup_id varchar(50) NOT NULL,
1132
  timestamp varchar(20) NOT NULL,
1133
  ip varchar(35) default NULL,
1134
  hostname varchar(255) default NULL,
@@ -1146,7 +1198,7 @@ function CreateTable($tablename="wassup") {
1146
  feed varchar(30) default NULL,
1147
  username VARCHAR( 50 ) default NULL,
1148
  comment_author VARCHAR( 50 ) default NULL,
1149
- spam VARCHAR( 50 ) default 0,
1150
  UNIQUE KEY id (id),
1151
  KEY wassup_id (wassup_id),
1152
  INDEX (timestamp)
@@ -1188,20 +1240,91 @@ function UpdateTable() {
1188
  CreateTable("wassup_tmp");
1189
  }
1190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1191
  //lastly, optimize the existing wp_wassup table..
1192
  $wpdb->query("OPTIMIZE TABLE $table_name");
1193
  } //end function UpdateTable()
1194
 
1195
- //Track visitors and save record in wassup table
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1196
  function wassupAppend() {
1197
  global $wpdb, $wpurl, $wassup_options; //removed unused globals
1198
- /*
1199
- // don't do anything if SECRET_KEY is missing
1200
- if (defined('SECRET_KEY')) {
1201
- */
1202
  $siteurl = get_bloginfo('siteurl');
1203
- $table_name = $wpdb->prefix . "wassup"; //moved;
1204
- $table_tmp_name = $wpdb->prefix . "wassup_tmp"; //moved;
1205
  $wassup_settings = get_option('wassup_settings');
1206
 
1207
  if (!is_admin()) { //exclude wordpress admin page visits
@@ -1209,16 +1332,23 @@ function wassupAppend() {
1209
  //#### Get the visitor's details from http header...
1210
  if (isset($_SERVER["REMOTE_ADDR"])) {
1211
  if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
1212
- $IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
 
1213
  $proxy = $_SERVER["REMOTE_ADDR"];
1214
- $hostname = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]);
 
 
 
1215
  $ipAddress = $proxy.",".$IP;
1216
  }else{
1217
- $IP = $_SERVER["REMOTE_ADDR"];
1218
- $hostname = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
1219
- $ipAddress = $IP;
1220
  }
1221
  }
 
 
 
1222
  // Get the visitor's resolution, TODO
1223
  /*
1224
  if(isset($HTTP_COOKIE_VARS["users_resolution"])) {
@@ -1280,118 +1410,146 @@ function wassupAppend() {
1280
  if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE ) { //moved and modified to allow forum requests
1281
  if (stristr($urlRequested,"/wp-content/themes") === FALSE || stristr($urlRequested,"comment") !== FALSE ) { //moved and modified to allow comment requests
1282
 
1283
- //##### Extract useful visit information from http header..
1284
- $dip = &new Detector("", $userAgent);
1285
- $browser = $dip->browser." ".$dip->browser_version;
1286
- $os = $dip->os." ".$dip->os_version;
1287
- if ($os != "" OR $browser != "") {
1288
- $bot=wGetSpider($userAgent);
1289
- if (is_array($bot)) {
1290
- $spider = $bot[0];
1291
- $feed = $bot[1];
1292
- } else {
1293
- $spider = trim($bot);
1294
- }
1295
- }
1296
- //#I prefer to see os/browser info. for spiders/bots.
1297
- //if ($spider != '') { $os=''; $browser=''; }
1298
 
1299
- //# More recording exclusion controls (moved to avoid unneeded spam testing)
1300
  if ($wassup_options->wassup_loggedin == 1 || !is_user_logged_in() ) {
1301
- if ($wassup_options->wassup_spider == 1 || $spider == '') {
1302
  if ($wassup_options->wassup_attack == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
1303
-
 
 
 
 
 
 
1304
  //#===================================================
1305
- //###Start visitor tracking with "session"...
1306
- //
1307
- //#create a temporary id for this visit from a combination of
1308
- //# date/hour/min/ip/spider/browser/os. It is not unique so
1309
- //# that multiple visits from the same ip/userAgent within a
1310
- //# 10 minute-period, can be tracked as such, even when
1311
- //# session/cookies is disabled. An md5 encoded version of
1312
- //# this id is saved in a session/cookie as "wassup_id".
1313
- $temp_id = sprintf("%-032.32s",str_replace(array(" ","/",".","\"","'","\\","\$","-","&","+","_","\;","\,","\>","\<",":","#","*","%","http","\)","\(",), '', date('YmdH').intval(date('i')/30).$ipAddress.$spider.$browser.$os.$userAgent));
1314
  $wassup_id = "";
 
 
 
 
 
 
1315
  $session_timeout = 1;
1316
- $dup_urlrequest=0;
1317
- //
1318
  //### Check if this is an ongoing visit or a new hit...
1319
- //# Test for valid savepath directory before session_start()
1320
- $sessionpath = $wassup_options->getSavepath();
1321
- if ($wassup_options->isWritableFolder($sessionpath)) {
1322
- if ( $sessionpath != $wassup_options->getSessionpath() ) {
1323
- session_save_path($sessionpath);
1324
- }
1325
- session_start(); //required to use/update $_SESSION
 
1326
 
1327
- // Prevent Session Fixation attack (http://shiflett.org/articles/session-fixation)
1328
- if (!isset($_SESSION['initiated'])) {
1329
- session_regenerate_id();
1330
- $_SESSION['initiated'] = true;
1331
- }
1332
-
1333
- //#confirm that session is started...
1334
- if (isset($_SESSION)) {
1335
- if (isset($_SESSION['wassup_id'])) {
1336
- $wassup_id = $_SESSION['wassup_id'];
1337
- $session_timeout = ((int)$_SESSION['wassup_timer'] - (int)time());
1338
- if (isset($_SESSION['spamresult'])) {
1339
- $spamresult = $_SESSION['spamresult'];
 
 
 
1340
  }
1341
- if ( $_SESSION['urlrequest'] == $urlRequested && (($timestamp - (int)$_SESSION['visittime']) < 5)) {
1342
- $dup_urlrequest=1;
1343
- }
1344
- }
1345
- //#reset wassup_id for new visitors or when timer is 0...
1346
- if (empty($wassup_id) or $session_timeout < 1) {
1347
- //# don't "destroy" old session in case it is
1348
- //# in use elsewhere in wordpress ??..
1349
- //if (!empty($wassup_id)) {
1350
- // session_destroy();
1351
- // session_start();
1352
- //}
1353
- $_SESSION['wassup_id'] = md5($temp_id);
1354
- //$_SESSION['wassup_id'] = md5(uniqid(rand(), true));
1355
- //#timeout session after 24 minutes
1356
- $_SESSION['wassup_timer'] = ((int)time() + 1440);
1357
- $dup_urlrequest=0;
1358
- }
1359
- $wassup_id = $_SESSION['wassup_id'];
1360
- if ($dup_urlrequest == 0) { //for dup checks
1361
- $_SESSION['visittime'] = $timestamp; //for dup checks
1362
- $_SESSION['urlrequest'] = $urlRequested;
1363
- }
1364
- //#SID is empty when session uses cookies...
1365
- //if (defined('SID') && !empty(SID)) {
1366
- // //#manually add SID to url_rewriter when trans-sid
1367
- // //# is disabled (how to test for this???)...
1368
- // output_add_rewrite_var(session_name(), htmlspecialchars(session_id()));
1369
- //}
1370
- @session_write_close(); /* close session and commit changes*/
1371
-
1372
- } elseif (isset($_COOKIE['wassup_id'])) {
1373
- $wassup_id = $_COOKIE['wassup_id'];
1374
- }
1375
- } elseif (isset($_COOKIE['wassup_id'])) {
1376
- $wassup_id = $_COOKIE['wassup_id'];
1377
- $sessionpath = ""; //bad sessionpath
1378
- } else {
1379
- $sessionpath = ""; //bad sessionpath
1380
- }
1381
- //#create cookie when bad session_savepath or when "session" is not available
 
 
 
 
 
 
1382
  if (empty($wassup_id)) {
1383
- //$wassup_id = md5(uniqid(rand(), true));
1384
  $wassup_id = md5($temp_id);
1385
- $url = parse_url(get_option('home'));
1386
- setcookie('wassup_id', $wassup_id, wassup_get_time()+1440, $url['path'] . '/');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1387
  }
1388
- //#End session/cookie section
 
1389
  //#===================================================
1390
 
1391
  //### Exclude duplicates...
1392
- if ($dup_urlrequest == 0) { //#dup checked only with sessions
 
 
 
 
 
 
1393
 
1394
- //### Extract useful visit information from http header...
 
 
1395
  //
1396
  //#use country code for language, if it exists in hostname
1397
  if (!empty($hostname) && preg_match("/\.[a-zA-Z]{2}$/", $hostname) > 0) {
@@ -1442,8 +1600,13 @@ function wassupAppend() {
1442
  }
1443
  }
1444
  if ( $wassup_options->wassup_spam == 1 && $spam == 0 ) {
1445
- //# some useragents to exclude from spam checking...
1446
- $goodbots = array('Google','Yahoo!', 'SummizeFeedReader');
 
 
 
 
 
1447
 
1448
  //# No duplicate spam testing in same session unless there
1449
  //# is a forum page request or comment...
@@ -1452,7 +1615,7 @@ function wassupAppend() {
1452
 
1453
  //# No spam check on known bots (google, yahoo,...) unless
1454
  //# there is a comment or forum page request...
1455
- } elseif ( empty($spider) || array_search($spider,$goodbots) === FALSE || stristr($urlRequested,"comment") !== FALSE || stristr($urlRequested,"forum") !== FALSE || !empty($comment_user) ) {
1456
 
1457
  // Try to search for previous spammer detected by akismet with same IP
1458
  if (!empty($ipAddress)) {
@@ -1505,7 +1668,7 @@ function wassupAppend() {
1505
  }
1506
  // test for errors
1507
  if($akismet->errorsExist()) {
1508
- //#error means don't save result in session
1509
  unset($spamresult);
1510
  }
1511
  } //end if file_exists(akismet_class)
@@ -1521,28 +1684,31 @@ function wassupAppend() {
1521
  }
1522
 
1523
  //## Final exclusion control is spam...
1524
- if ($spam == 0 OR ($wassup_options->wassup_spam == 1 AND $spam == 1) OR ($wassup_options->wassup_refspam == 1 AND $spam == 2)) {
1525
- // #save spam results in session...
1526
- if (isset($spamresult) && !empty($sessionpath)) {
1527
  @session_start(); //required to access $_SESSION
1528
  $_SESSION['spamresult'] = $spamresult;
1529
  @session_write_close();
1530
- }
 
1531
 
1532
  // #Record visit in wassup tables...
1533
  // Insert the record into the db
1534
  insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language[0], $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
1535
  // Insert the record into the wassup_tmp table too
1536
  insert_into_wp($table_tmp_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language[0], $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
 
1537
  // Delete records older then 3 minutes
1538
- $wpdb->query("DELETE FROM $table_tmp_name WHERE timestamp<'".strtotime("-3 minutes", $timestamp)."'");
1539
 
1540
  } //end if $spam == 0
1541
 
1542
- } //end if dup_urlrequest == 0
 
1543
 
 
1544
  } //end if wassup_attack
1545
- } //end if wassup_spider
1546
  } //end if wassup_loggedin
1547
 
1548
  } //end if !themes
@@ -1559,8 +1725,8 @@ function wassupAppend() {
1559
  //$to_date = wassup_get_time();
1560
  $from_date = strtotime($wassup_options->delete_auto, $timestamp);
1561
  //#check before doing delete as it could lock the table...
1562
- if ((int)$wpdb->get_var("SELECT COUNT(id) FROM $table_name WHERE timestamp<'$from_date'") > 0) {
1563
- $wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
1564
  }
1565
  // Optimize table once a day
1566
  if ($timestamp > strtotime("24 hours", $wassup_options->wassup_optimize)) {
@@ -1607,7 +1773,7 @@ function insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostna
1607
  if (!empty($table_name) && !empty($wassup_id) && !empty($timestamp)) {
1608
 
1609
  if (method_exists($wpdb,'prepare')) {
1610
- $insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, timestamp, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
1611
  VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
1612
  attribute_escape($wassup_id),
1613
  attribute_escape($timestamp),
@@ -1631,7 +1797,7 @@ function insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostna
1631
  ));
1632
  } else {
1633
  $insert = $wpdb->query("INSERT INTO " . $table_name .
1634
- " (wassup_id, timestamp, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam) " .
1635
  "VALUES (
1636
  '".attribute_escape($wassup_id)."',
1637
  '".attribute_escape($timestamp)."',
@@ -1672,6 +1838,16 @@ function wassupDashChart() {
1672
  }
1673
  } //end function wassupDashChart
1674
 
 
 
 
 
 
 
 
 
 
 
1675
  function wGetQueryPairs($url){
1676
  $parsed_url = parse_url($url);
1677
  $tab=parse_url($url);
@@ -1751,7 +1927,8 @@ function wGetSE($referrer = null){
1751
  "Overture|overture.com|Keywords|","Supereva|supereva.it|q|","Teoma|teoma.com|q|","Tiscali|search-dyn.tiscali.|key|","Voil|voila.fr|kw|",
1752
  "Web|web.de|su|","Clarence|search.clarence.com|q|","Gazzetta|search.gazzetta.it|q|","PagineGialle|paginegialle.it|qs|",
1753
  "Jumpy|servizi.mediaset.it|searchWord|","ItaliaPuntoNet|italiapuntonet.net|search|","StartNow|search.startnow.|q|","Search|search.it|srctxt|",
1754
- "Search|search.com|q|", "Good Search|goodsearch.com|Keywords|", "ABC Sok|verden.abcsok.no|q|", "Kvasir|kvasir.no|searchExpr|", "Start.no|start.no|q|");
 
1755
  foreach($lines as $line_num => $se) {
1756
  list($nome,$url,$key,$lang)=explode("|",$se);
1757
  if(@strpos($referrer,$url)===FALSE) continue;
@@ -1775,9 +1952,82 @@ function wGetSE($referrer = null){
1775
  return null;
1776
  }
1777
 
1778
- function wGetSpider($agent = null){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1779
  $agent=str_replace(" ","",$agent);
1780
- $key = null;
 
1781
  $lines = array("Wordpress Pingback/Trackback|Wordpress|", "Alexa|ia_archiver|","Ask.com/Teoma|AskJeeves/Teoma)|","Biz360|Biz360|","Naver|NaverBot|","Naver|Cowbot|","cURL|curl/|","Google|Googlebot/|",
1782
  "Google|googlebot/|","Google Images|Googlebot-Image|","LookSmart|grub-client|","Yahoo!|slurp@inktomi|","Yahoo!|Yahoo!Slurp|",
1783
  "Yahoo!|MMCrawler|","MSN|msnbot|","AltaVista|Scooter-|","Wget|Wget/1.|","Technorati|Technoratibot|","Moreover|Moreoverbot|",
@@ -1837,22 +2087,38 @@ function wGetSpider($agent = null){
1837
  "Feed::Find|Feed::Find|", "eZ publish Link Validator|eZ publish Link Validator|", "R6_CommentReade|R6_CommentReade|",
1838
  "Strategic Board Bot|Strategic Board Bot|", "OSSE Scanner|OSSE Scanner|", "PECL::HTTP|PECL::HTTP|", "GetRight|GetRight|", "yacybot|yacybot|",
1839
  "GurujiBot|GurujiBot|", "Missigua Locator|Missigua Locator|", "ISC Systems iRc Search|ISC Systems iRc Search|", "whiteiexpres/Nutch|whiteiexpres/Nutch|",
1840
- "kalooga/kalooga|kalooga/kalooga|", "Bookdog|Bookdog|", "webLyzard|webLyzard", "EnaBot|EnaBot|");
1841
- foreach($lines as $line_num => $spider) {
1842
- list($nome,$key)=explode("|",$spider);
1843
- if(@strpos(strtolower($agent),strtolower($key))===FALSE) continue;
1844
- if (@strpos(strtolower($agent), "subscriber")!== FALSE) {
1845
- preg_match("/([0-9]{1,10})(subscriber)/i", $agent, $subscriber);
1846
- $feed[] = $nome;
1847
- $feed[] = $subscriber[1];
1848
- // It's a feedreader with some subscribers
1849
- return $feed;
 
 
 
 
 
 
 
 
 
1850
  } else {
1851
- // find it!
1852
- return $nome;
1853
  }
1854
- }
1855
- return null;
 
 
 
 
 
 
 
 
1856
  }
1857
 
1858
  //# Check input, $referrer against a list of known spammers and
@@ -1863,7 +2129,6 @@ function wGetSpamRef($referrer) {
1863
  $referrer=htmlentities(strip_tags(str_replace(" ","",html_entity_decode($referrer))));
1864
  $badhostfile= dirname(__FILE__).'/badhosts.txt';
1865
  $key = null;
1866
-
1867
  if (empty($referrer)) { return null; } //nothing to check...
1868
 
1869
  //#Assume any referrer name similar to "viagra/zanax/.."
@@ -1874,7 +2139,6 @@ function wGetSpamRef($referrer) {
1874
  return 1;
1875
  }
1876
  }
1877
-
1878
  $lines = array("1clickholdem.com", "1ps.biz", "24h.to", "4all-credit.com", "4all-prescription.com", "4u-money.com", "6q.org", "88.to", "always-casino.com",
1879
  "always-credit.com", "andipink.com", "antiquemarketplace.net", "artmedia.com.ru", "asstraffic.com", "at.cx", "available-casino.com", "available-credit.com",
1880
  "available-prescription.com", "base-poker.com", "bayfronthomes.net", "bitlocker.net", "black-poker.com", "blest-money.com", "budgethawaii.net", "bwdow.com",
@@ -1904,9 +2168,6 @@ function wGetSpamRef($referrer) {
1904
  //#check for a customized spammer list...
1905
  if (file_exists($badhostfile)) {
1906
  $lines = file($badhostfile,FILE_IGNORE_NEW_LINES);
1907
- //$lines2 = file($badhostfile,FILE_IGNORE_NEW_LINES);
1908
- //$lines = array_merge($lines, $lines2);
1909
-
1910
  foreach($lines as $line_num => $spammer) {
1911
  if(stristr($referrer,trim($spammer)) !== FALSE) {
1912
  // find it!
@@ -2090,7 +2351,7 @@ function wassup_widget($wargs) {
2090
 
2091
  // Widget Latest Searches
2092
  if ($wassup_settings['wassup_widget_search'] == 1) {
2093
- $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_tmp_name WHERE search!='' GROUP BY search ORDER BY timestamp DESC LIMIT ".attribute_escape($searchlimit)."");
2094
  if (count($query_det) > 0) {
2095
  print "$before_title ".__('Last searched terms','wassup')." $after_title";
2096
  print "<ul class='$ulclass'>";
@@ -2103,7 +2364,7 @@ function wassup_widget($wargs) {
2103
 
2104
  // Widget Latest Referers
2105
  if ($wassup_settings['wassup_widget_ref'] == 1) {
2106
- $query_ref = $wpdb->get_results("SELECT referrer FROM $table_tmp_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY timestamp DESC LIMIT ".attribute_escape($reflimit)."");
2107
  if (count($query_ref) > 0) {
2108
  print "$before_title ".__('Last referers','wassup')." $after_title";
2109
  print "<ul class='$ulclass'>";
@@ -2246,7 +2507,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
2246
 
2247
  print $before_widget;
2248
  if ($wsearch == 1) {
2249
- $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_tmp_name WHERE search!='' GROUP BY search ORDER BY timestamp DESC LIMIT $searchlimit");
2250
  if (count($query_det) > 0) {
2251
  print "$before_title Last searched terms $after_title";
2252
  print "<ul class='$ulclass'>";
@@ -2258,7 +2519,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
2258
  }
2259
 
2260
  if ($wref == 1) {
2261
- $query_ref = $wpdb->get_results("SELECT referrer FROM $table_tmp_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY timestamp DESC LIMIT $reflimit");
2262
  if (count($query_ref) > 0) {
2263
  print "$before_title Last referers $after_title";
2264
  print "<ul class='$ulclass'>";
@@ -2320,4 +2581,22 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
2320
  print $after_widget;
2321
  } //end function wassup_sidebar
2322
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2323
  ?>
3
  Plugin Name: WassUp
4
  Plugin URI: http://www.wpwp.org
5
  Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
6
+ Version: 1.6
7
  Author: Michele Marcucci
8
  Author URI: http://www.michelem.org/
9
 
16
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
17
  die('Permission Denied! You are not allowed to call this page directly.');
18
  }
19
+ $version = "1.6";
20
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
21
  require_once(dirname(__FILE__).'/lib/wassup.class.php');
22
  require_once(dirname(__FILE__).'/lib/main.php');
31
  //#This works only in WP2.2 or higher
32
  if (version_compare($wp_version, '2.2', '<')) {
33
  wp_die( '<strong style="color:#c00;background-color:#dff;padding:5px;">'.__("Sorry, Wassup requires WordPress 2.2 or higher to work","wassup").'.</strong>');
34
+ } elseif (function_exists('wp_cache_flush')) {
35
+ //clear the WP cache
36
+ wp_cache_flush(); //to prevent "cannot redeclare" errors???
 
 
 
 
 
 
 
37
  }
 
38
  //#add initial options and create table when Wassup activated
39
  // -Helene D. 2/26/08.
40
  function wassup_install() {
67
  $wassup_options->wassup_spamcheck = "0";
68
  }
69
  }
70
+
71
  //# update wassup settings for 'savepath' (default is null)
72
  //$wassup_options->wassup_savepath = "/fakedirectory"; //#debug
73
  if (!isset($wassup_options->wassup_savepath)) {
87
  "toplocale"=>"0",
88
  "topfeed"=>"0",
89
  "topcrawler"=>"0",
90
+ "topvisitor"=>"0",
91
+ "topreferrer_exclude"=>""));
92
  }
93
  $wassup_options->saveSettings();
94
 
96
  //#
97
  //#Check for problems with 'session_savepath' and disable
98
  //# recording, if found. -Helene D. 2/24/08
99
+ $sessionpath = $wassup_options->wassup_savepath;
100
+ if (empty($sessionpath)) { $sessionpath = getSessionpath(); }
101
+ //default to "/tmp" if no sessionpath value
102
+ if (empty($sessionpath)) {
103
+ $sessionpath = "/tmp";
104
+ $wassup_options->wassup_savepath = $sessionpath;
105
+ }
106
+ /* if ($wassup_options->isWritableFolder($sessionpath) == false) {
107
  if ($wassup_options->wassup_active == "1") {
108
  $wassup_options->wassup_active = "0";
109
  $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
110
  } else {
111
  $wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
112
  }
113
+ } */
114
+ $wassup_options->saveSettings();
115
  unset($sessionpath); //because "install" works in global scope
116
 
117
  //# TODO:
126
  } else {
127
  UpdateTable(); //<== wassup_tmp is added here, if missing
128
  }
129
+ //Double-check that wassup tables were created, then create table
130
+ // without charset, if needed
131
+ if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
132
+ CreateTable("wassup",false);
133
+ CreateTable("wassup_tmp",false);
134
+ } elseif ($wpdb->get_var("SHOW TABLES LIKE '$table_tmp_name'") != $table_tmp_name) {
135
+ CreateTable("wassup_tmp",false);
136
+ }
137
  } //#end function wassup_install
138
 
139
  //set global variables that are dependent on Wassup's wp_options values
161
  print '<meta name="wassup-version" content="'.$version.'" />';
162
  }
163
 
164
+ //# Wassup init hook actions performed before headers are sent:
165
+ //# -Load jquery AJAX library and dependent javascripts for admin menus
166
+ //# -Load language/localization files for admin menus and widget
167
+ //# -Set 'wassup' cookie for new visitor hits
168
  function wassup_init() {
169
  global $wpurl;
170
 
171
+ //### Add wassup scripts to Wassup Admin pages...
172
  if (stristr($_GET['page'],'wassup') !== FALSE) {
173
+ if ( function_exists('wp_deregister_script')) {
174
+ //removes old jquery vers.
175
+ wp_deregister_script('jquery');
176
+ }
177
+ // the safe way to load jquery into WP
178
+ wp_register_script('jquery', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/jquery.js',FALSE,'1.2.6');
179
+ if ($_GET['page'] == "wassup-spy") {
180
+ //the safe way to load a jquery dependent script
181
+ wp_enqueue_script('spy', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/spy.js', array('jquery'), '1.4');
182
+ } elseif($_GET['page'] == "wassup-options") {
183
+ wp_enqueue_script('ui.base', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.base.js', array('jquery'), '3');
184
+ wp_enqueue_script('ui.tabs', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/js/ui.tabs.js', array('jquery'), '3');
185
+ } else {
186
+ //the safe way to load a jquery dependent script
187
+ wp_enqueue_script('thickbox', $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.js', array('jquery'), '3');
188
+ }
189
  }
190
 
191
  //Loading language file...
196
  $moFile = dirname(__FILE__) . "/language/" . $currentLocale . ".mo";
197
  if(@file_exists($moFile) && is_readable($moFile)) load_textdomain('wassup', $moFile);
198
  }
199
+
200
+ //Set Wassup cookie for visitor hits before headers are sent
201
+ //add_action('init', 'wassupPrepend');
202
+ if (!is_admin()) { //exclude wordpress admin page visits
203
+ wassupPrepend();
204
+ }
205
  } // end function wassup_init
206
 
207
  //Add the wassup stylesheet and other javascripts...
470
  "toplocale" => $_POST['toplocale'],
471
  "topfeed" => "0",
472
  "topcrawler" => "0",
473
+ "topvisitor" => "0",
474
+ "topreferrer_exclude" => $_POST['topreferrer_exclude']);
475
  $wassup_options->wassup_top10 = serialize($top_ten);
476
  if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
477
+ if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == getSessionpath()) {
478
  $wassup_options->wassup_savepath = NULL;
479
  } else {
480
  $wassup_options->setSavepath($_POST['wassup_savepath']);
549
  <?php
550
  $to_date = wassup_get_time();
551
  $from_date = strtotime('-3 minutes', $to_date);
552
+ $currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date");
553
  $currenttot = $currenttot+0; //set to integer
554
  print "<p class='legend'>".__("Visitors online", "wassup").": <strong>".$currenttot."</strong></p><br />";
555
  if ($currenttot > 0) {
556
+ $qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
557
  foreach ($qryC as $cv) {
558
  //$timestamp = $cv->max_timestamp; //redundant
559
  $timed = gmdate("H:i:s", $cv->max_timestamp);
560
+ $ip_proxy = strpos($cv->ip,",");
561
+ //if proxy, get 2nd ip...
562
+ if ($ip_proxy !== false) {
563
+ $ip = substr($cv->ip,(int)$ip_proxy+1);
564
+ } else {
565
+ $ip = $cv->ip;
566
+ }
567
  if ($cv->referrer != '') {
568
  if (!eregi($wpurl, $cv->referrer) OR $cv->searchengine != "") {
569
  if (!eregi($wpurl, $cv->referrer) AND $cv->searchengine == "") {
580
  $numurl = $wpdb->get_var("SELECT COUNT(DISTINCT id) as numurl FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."'");
581
  ?>
582
  <div class="sum">
583
+ <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $cv->id ?>"><?php print $ip; ?></a><?php } else { ?><?php print $ip; ?><?php } ?></span>
584
  <div class="sum-det"><span class="det1">
585
  <?php
586
  //# html_entity_decode() links that were already
609
  <div style="display: none;" class="togglenavi navi<?php echo $cv->id ?>">
610
  <ul class="url">
611
  <?php
612
+ $qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY `timestamp` ASC");
613
  $i=0;
614
  foreach ($qryCD as $cd) {
615
  //$timestamp2 = $cd->timestamp; //redundant
763
  //# Moved and limited delete to selected date range only.
764
  //# -Helene D. 3/4/08.
765
  if (!empty($_GET['deleteMARKED']) && $wassup_options->wmark == "1" ) {
766
+ $rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
767
  if (method_exists($wpdb,'prepare')) {
768
+ $wpdb->query($wpdb->prepare("DELETE FROM $table_name WHERE ip='%s' AND `timestamp` BETWEEN %s AND %s", urlencode(attribute_escape($_GET['dip'])), $from_date, $to_date));
769
  } else {
770
+ $wpdb->query("DELETE FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
771
  }
772
  echo '<p><strong>'.$rec_deleted.' '.__('records deleted','wassup').'</strong></p>';
773
  //reset wmark/deleteMarked after delete and
941
  $dateF = gmdate("d M Y", $timestampF);
942
  $timeF = gmdate("H:i:s", $timestampF);
943
  $datetimeF = gmdate('Y-m-d H:i:s', $timestampF);
944
+ //$ip = @explode(",", $rk->ip);
945
+ $ip_proxy = strpos($rk->ip,",");
946
+ //if proxy, get 2nd ip...
947
+ if ($ip_proxy !== false) {
948
+ $ip = substr($rk->ip,(int)$ip_proxy+1);
949
+ } else {
950
+ $ip = $rk->ip;
951
+ }
952
 
953
+ // Visitor Record - raw data (hidden)
954
+ $raw_div="raw-".substr($rk->wassup_id,0,25).rand(0,99);
955
+ echo "\n"; ?>
956
+ <div id="<?php echo $raw_div; ?>" style="display:none; padding-top:7px;" >
957
  <h2><?php _e("Raw data","wassup"); ?>:</h2>
958
  <style type="text/css">.raw { color: #542; padding-left:5px; }</style>
959
  <ul style="list-style-type:none;padding:20px 0 0 30px;">
960
+ <li><?php echo __("Visit type","wassup").': <span class="raw">';
961
+ if ($rk->username != "") {
962
+ echo __("Logged-in user","wassup").' - '.$rk->username;
963
+ } elseif ($rk->spam == "1" || $rk->spam == "2" ) {
964
+ _e("Spammer","wassup");
965
+ } elseif ($rk->comment_author != "") {
966
+ echo __("Comment author","wassup").' - '.$rk->comment_author;
967
+ } elseif ($rk->feed != "") {
968
+ echo __("Feed","wassup").' - '.$rk->feed;
969
+ } elseif ($rk->spider != "") {
970
+ echo __("Spider","wassup").' - '.$rk->spider;
971
+ } else {
972
+ _e("Regular visitor","wassup");
973
+ }
974
+ echo '</span>'; ?></li>
975
  <li><?php echo __("IP","wassup").': <span class="raw">'.$rk->ip.'</span>'; ?></li>
976
  <li><?php echo __("Hostname","wassup").': <span class="raw">'.$rk->hostname.'</span>'; ?></li>
977
+ <li><?php echo __("Url Requested","wassup").': <span class="raw">'.htmlspecialchars(html_entity_decode(clean_url($rk->urlrequested))).'</span>'; ?></li>
978
  <li><?php echo __("User Agent","wassup").': <span class="raw">'.$rk->agent.'</span>'; ?></li>
979
  <li><?php echo __("Referrer","wassup").': <span class="raw">'.urldecode($rk->referrer).'</span>'; ?></li>
980
  <?php if ($rk->search != "") { ?>
981
+ <li><?php echo __("Search Engine","wassup").': <span class="raw">'.$rk->searchengine.'</span> &nbsp; &nbsp; ';
982
+ echo __("Search","wassup").': <span class="raw">'.$rk->search.'</span>'; ?></li>
983
  <?php }
984
  if ($rk->os != "") { ?>
985
  <li><?php echo __("OS","wassup").': <span class="raw">'.$rk->os.'</span>'; ?></li>
988
  <li><?php echo __("Browser","wassup").': <span class="raw">'.$rk->browser.'</span>'; ?></li>
989
  <?php }
990
  if ($rk->language != "") { ?>
991
+ <li><?php echo __("Locale/Language","wassup").': <span class="raw">'.$rk->language.'</span>'; ?></li>
992
  <?php } ?>
993
+ <li><?php echo 'Wassup ID'.': <span class="raw">'.$rk->wassup_id.'</span>'; ?></li>
994
+ <li><?php echo __("End timestamp","wassup").': <span class="raw">'.$datetimeF.' ( '.$rk->max_timestamp.' )</span>'; ?></li>
995
  </ul>
996
  </div> <!-- raw-wassup_id -->
997
 
1014
  ?>
1015
 
1016
  <div class="delID<?php echo $rk->wassup_id ?>">
1017
+ <div class="<?php if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip) echo "sum-nav-mark"; else echo "sum-nav"; ?>">
1018
 
1019
  <p class="delbut">
1020
  <?php // Mark/Unmark IP
1021
+ if ($wassup_options->wmark == 1 AND $wassup_options->wip == $ip) { ?>
1022
+ <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&deleteMARKED=1&dip=<?php print $ip; ?>" style="text-decoration:none;">
1023
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete ALL marked records with this IP','wassup'); ?>" /></a>
1024
  <a href="?page=<?php echo WASSUPFOLDER; ?>&wmark=0" style="text-decoration:none;">
1025
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_delete.png" alt="'.__('unmark','wassup').'" title="'.__('UnMark IP','wassup'); ?>" /></a>
1026
  <?php } else { ?>
1027
  <a href="#" class="deleteID" id="<?php echo $rk->wassup_id ?>" style="text-decoration:none;">
1028
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/cross.png" alt="'.__('delete','wassup').'" title="'.__('Delete this record','wassup'); ?>" /></a>
1029
+ <a href="?<?php echo $_SERVER['QUERY_STRING']; ?>&wmark=1&wip=<?php print $ip; ?>" style="text-decoration:none;">
1030
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/error_add.png" alt="'.__('mark','wassup').'" title="'.__('Mark IP','wassup'); ?>" /></a>
1031
  <?php } ?>
1032
+ <a href="#TB_inline?height=400&width=<?php echo $res.'&inlineId='.$raw_div; ?>" class="thickbox">
1033
  <img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/database_table.png" alt="'.__('show raw table','wassup').'" title="'.__('Show the items as raw table','wassup'); ?>" /></a>
1034
  </p>
1035
 
1036
+ <span class="sum-box"><?php if ($numurl >= 2) { ?><a href="#" class="showhide" id="<?php echo $rk->id ?>"><?php print $ip; ?></a><?php } else { ?><?php print $ip; ?><?php } ?></span>
1037
  <span class="sum-date"><?php print $datetimeF; ?></span>
1038
  <div class="sum-det"><span class="det1">
1039
  <?php
1090
  if ($rk->feed != "") { ?>
1091
  <ul style="background:#fdeec8;" class="spider">
1092
  <li class="feed"><span class="indent-li-agent"><?php _e('FEEDREADER','wassup'); ?>: <strong><?php print $rk->spider; ?></strong></span></li>
1093
+ <?php if (is_numeric($rk->feed)) { ?>
1094
+ <li class="feed"><span class="indent-li-agent"><?php _e('SUBSCRIBER(S)','wassup'); ?>: <strong><?php print (int)$rk->feed; ?></strong></span></li>
1095
+ <?php } ?>
1096
  </ul>
1097
  <?php } else { ?>
1098
  <ul class="spider">
1129
  <div style="display: visible;" class="togglecrono navi<?php echo $rk->id ?>">
1130
  <ul class="url">
1131
  <?php
1132
+ $qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp` ASC");
1133
  $i=0;
1134
  foreach ($qryCD as $cd) {
1135
  //$timestamp2 = $cd->timestamp; //redundant
1168
  <?php
1169
  } //end function Wassup
1170
 
1171
+ function CreateTable($newtable="wassup",$withcharset=true) {
1172
+ global $wpdb;
1173
+ $charset_collate = '';
1174
+ if ($withcharset && $wpdb->supports_collation() ) {
1175
+ if ( ! empty($wpdb->charset) )
1176
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
1177
+ if ( ! empty($wpdb->collate) )
1178
+ $charset_collate .= " COLLATE $wpdb->collate";
1179
+ }
1180
+ $table_name = $wpdb->prefix . $newtable;
1181
  $sql_createtable = "CREATE TABLE " . $table_name . " (
1182
  id mediumint(9) NOT NULL auto_increment,
1183
+ wassup_id varchar(100) NOT NULL,
1184
  timestamp varchar(20) NOT NULL,
1185
  ip varchar(35) default NULL,
1186
  hostname varchar(255) default NULL,
1198
  feed varchar(30) default NULL,
1199
  username VARCHAR( 50 ) default NULL,
1200
  comment_author VARCHAR( 50 ) default NULL,
1201
+ spam VARCHAR(5) default 0,
1202
  UNIQUE KEY id (id),
1203
  KEY wassup_id (wassup_id),
1204
  INDEX (timestamp)
1240
  CreateTable("wassup_tmp");
1241
  }
1242
 
1243
+ // Upgrade from version <= 1.5.1 - increase size of wassup_id
1244
+ $wassup_col = $wpdb->get_results("SHOW COLUMNS FROM $table_name LIKE 'wassup_id'");
1245
+ foreach ($wassup_col as $wID) {
1246
+ if ($wID->Type != "varchar(100)") {
1247
+ $wpdb->query("ALTER TABLE {$table_name} CHANGE wassup_id wassup_id varchar(100) NULL");
1248
+ }
1249
+ }
1250
+ $wassup_tmp_col = $wpdb->get_results("SHOW COLUMNS FROM $table_tmp_name LIKE 'wassup_id'");
1251
+ foreach ($wassup_tmp_col as $wID) {
1252
+ if ($wID->Type != "varchar(100)") {
1253
+ $wpdb->query("ALTER TABLE {$table_tmp_name} CHANGE wassup_id wassup_id varchar(100) NULL");
1254
+ }
1255
+ }
1256
+
1257
  //lastly, optimize the existing wp_wassup table..
1258
  $wpdb->query("OPTIMIZE TABLE $table_name");
1259
  } //end function UpdateTable()
1260
 
1261
+ //Set Wassup_id and cookie (before headers sent)
1262
+ function wassupPrepend() {
1263
+ $wassup_id = "";
1264
+ $session_timeout = 1;
1265
+ //### Check if this is an ongoing visit or a new hit...
1266
+ //#visitor tracking with "cookie"...
1267
+ if (isset($_COOKIE['wassup'])) {
1268
+ $wassup_cookie = explode('::',$_COOKIE['wassup']);
1269
+ $wassup_id = $wassup_cookie[0];
1270
+ if (!empty($wassup_cookie[1])) {
1271
+ $wassup_timer = $wassup_cookie[1];
1272
+ $session_timeout = ((int)$wassup_timer - (int)time());
1273
+ }
1274
+ }
1275
+ if (empty($wassup_id) || $session_timeout < 1) {
1276
+ $ipAddress = "";
1277
+ $hostname = "";
1278
+ //#### Get the visitor's details from http header...
1279
+ if (isset($_SERVER["REMOTE_ADDR"])) {
1280
+ if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
1281
+ //in case of multiple forwarding
1282
+ list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
1283
+ $proxy = $_SERVER["REMOTE_ADDR"];
1284
+ $hostname = @gethostbyaddr($IP);
1285
+ if (empty($hostname) || $hostname == "unknown") {
1286
+ $hostname = @gethostbyaddr($proxy);
1287
+ }
1288
+ $ipAddress = $proxy.",".$IP;
1289
+ }else{
1290
+ list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
1291
+ $hostname = @gethostbyaddr($IP);
1292
+ $ipAddress = $_SERVER["REMOTE_ADDR"];
1293
+ }
1294
+ }
1295
+ if (empty($IP)) { $IP = $ipAddress; }
1296
+ if (empty($hostname)) { $hostname = "unknown"; }
1297
+ $userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
1298
+ //# Create a new wassup id for this visit from a
1299
+ //# combination of date/hour/min/ip/hostname/useragent/.
1300
+ //# It is not unique so that multiple visits from the
1301
+ //# same ip/userAgent within a 30 minute-period, can be
1302
+ //# tracked, even when session/cookies is disabled.
1303
+ $temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
1304
+
1305
+ //Work-around for cookie rejection:
1306
+ //#assign new wassup id from "temp_id"
1307
+ //$wassup_id = $temp_id; //debug
1308
+ $wassup_id = md5($temp_id);
1309
+ $wassup_timer=((int)time() + 2700); //use 45 minutes timer
1310
+
1311
+ //put the cookie in the oven and set the timer...
1312
+ //#this must be done before headers sent
1313
+ $cookieurl = parse_url(get_option('home'));
1314
+ $cookiedomain = preg_replace('/^www\./','',$cookieurl['host']);
1315
+ $cookiepath = $cookieurl['path'];
1316
+ $expire = time()+3000; //expire based on unix time, not on Wordpress time
1317
+ $cookievalue = implode('::',array("$wassup_id", "$wassup_timer"));
1318
+ setcookie("wassup", "$cookievalue", $expire, $cookiepath, $cookiedomain);
1319
+ }
1320
+ } //end function wassupPrepend
1321
+
1322
+ //Track visitors and save record in wassup table, after page is displayed
1323
  function wassupAppend() {
1324
  global $wpdb, $wpurl, $wassup_options; //removed unused globals
 
 
 
 
1325
  $siteurl = get_bloginfo('siteurl');
1326
+ $table_name = $wpdb->prefix . "wassup";
1327
+ $table_tmp_name = $wpdb->prefix . "wassup_tmp";
1328
  $wassup_settings = get_option('wassup_settings');
1329
 
1330
  if (!is_admin()) { //exclude wordpress admin page visits
1332
  //#### Get the visitor's details from http header...
1333
  if (isset($_SERVER["REMOTE_ADDR"])) {
1334
  if ($_SERVER["HTTP_X_FORWARDED_FOR"] != ""){
1335
+ //in case of multiple forwarding
1336
+ list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
1337
  $proxy = $_SERVER["REMOTE_ADDR"];
1338
+ $hostname = @gethostbyaddr($IP);
1339
+ if (empty($hostname) || $hostname == "unknown") {
1340
+ $hostname = @gethostbyaddr($proxy);
1341
+ }
1342
  $ipAddress = $proxy.",".$IP;
1343
  }else{
1344
+ list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
1345
+ $hostname = @gethostbyaddr($IP);
1346
+ $ipAddress = $_SERVER["REMOTE_ADDR"];
1347
  }
1348
  }
1349
+ if (empty($IP)) { $IP = $ipAddress; }
1350
+ if (empty($hostname)) { $hostname = "unknown"; }
1351
+
1352
  // Get the visitor's resolution, TODO
1353
  /*
1354
  if(isset($HTTP_COOKIE_VARS["users_resolution"])) {
1410
  if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE ) { //moved and modified to allow forum requests
1411
  if (stristr($urlRequested,"/wp-content/themes") === FALSE || stristr($urlRequested,"comment") !== FALSE ) { //moved and modified to allow comment requests
1412
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1413
 
1414
+ //# More recording exclusion controls
1415
  if ($wassup_options->wassup_loggedin == 1 || !is_user_logged_in() ) {
 
1416
  if ($wassup_options->wassup_attack == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
1417
+ if (!is_404()) { //don't record 404 pages...
1418
+
1419
+ //##### Extract useful visit information from http header..
1420
+ $browser = "";
1421
+ $os = "";
1422
+ list($browser,$os) = wGetBrowser($userAgent);
1423
+
1424
  //#===================================================
1425
+ //###Start visitor tracking...
1426
+ //Work-around for cookie rejection:
1427
+ //# Create a temporary id for this visit from a combination of
1428
+ //# date/hour/min/ip/hostname/useragent/os/browser.
1429
+ //# It is not unique so that multiple visits from the same
1430
+ //# ip/userAgent within a 30 minute-period, can be tracked as
1431
+ //# such, even when session/cookies is disabled.
1432
+ //# An md5 encoded version of temp_id is saved as "wassup_id".
1433
+ $temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
1434
  $wassup_id = "";
1435
+ //Read the cookie for wassup_id
1436
+ if (isset($_COOKIE['wassup'])) {
1437
+ $wassup_cookie = explode('::',$_COOKIE['wassup']);
1438
+ $wassup_id = $wassup_cookie[0];
1439
+ }
1440
+ /*
1441
  $session_timeout = 1;
 
 
1442
  //### Check if this is an ongoing visit or a new hit...
1443
+ //#visitor tracking with "session"...
1444
+ //# Set savepath directory before session_start()
1445
+ $sessionpath = $wassup_options->wassup_savepath;
1446
+ if (empty($sessionpath)) { $sessionpath = getSessionpath(); }
1447
+ if ($sessionpath != "" && $wassup_options->isWritableFolder($sessionpath)) {
1448
+ session_save_path($sessionpath);
1449
+ }
1450
+ session_start(); //required to use/update $_SESSION
1451
 
1452
+ //#confirm that session is started...
1453
+ if (isset($_SESSION)) {
1454
+ // Prevent Session Fixation attack (http://shiflett.org/articles/session-fixation)
1455
+ if (!isset($_SESSION['initiated'])) {
1456
+ session_regenerate_id();
1457
+ $_SESSION['initiated'] = true;
1458
+ }
1459
+ //Get session variables...
1460
+ if (isset($_SESSION['wassup_id'])) {
1461
+ $wassup_id = $_SESSION['wassup_id'];
1462
+ $session_timeout = ((int)$_SESSION['wassup_timer'] - (int)time());
1463
+ if (isset($_SESSION['spamresult'])) {
1464
+ $spamresult = $_SESSION['spamresult'];
1465
+ }
1466
+ if ( $_SESSION['urlrequest'] == $urlRequested && (($timestamp - (int)$_SESSION['visittime']) < 5)) {
1467
+ $dup_urlrequest=1;
1468
  }
1469
+ }
1470
+ //#reset wassup_id for new visitors or when timer is 0...
1471
+ if (empty($wassup_id) or $session_timeout < 1) {
1472
+ //# don't "destroy" old session in case it is
1473
+ //# in use elsewhere in wordpress ??..
1474
+ //if (!empty($wassup_id)) {
1475
+ // session_destroy();
1476
+ // session_start();
1477
+ //}
1478
+ $_SESSION['wassup_id'] = md5($temp_id);
1479
+ //$_SESSION['wassup_id'] = md5(uniqid(rand(), true));
1480
+ //#timeout session after 24 minutes
1481
+ $_SESSION['wassup_timer'] = ((int)time() + 1440);
1482
+ $dup_urlrequest=0;
1483
+ }
1484
+ $wassup_id = $_SESSION['wassup_id'];
1485
+ if ($dup_urlrequest == 0) { //for dup checks
1486
+ $_SESSION['visittime'] = $timestamp; //for dup checks
1487
+ $_SESSION['urlrequest'] = $urlRequested;
1488
+ }
1489
+ //#SID is empty when session uses cookies...
1490
+ //if (defined('SID') && !empty(SID)) {
1491
+ // //#manually add SID to url_rewriter when trans-sid
1492
+ // //# is disabled (how to test for this???)...
1493
+ // output_add_rewrite_var(session_name(), htmlspecialchars(session_id()));
1494
+ //}
1495
+ @session_write_close();
1496
+
1497
+ } */
1498
+ //### Check if this is an ongoing visit or a new hit...
1499
+ /* //#visitor tracking with "cookie"...
1500
+ if (isset($_COOKIE['wassup'])) {
1501
+ $wassup_cookie = unserialize($_COOKIE['wassup']);
1502
+ //$wassup_id = $wassup_cookie['wassup_id'];
1503
+ $wassup_timer = $wassup_cookie['timer'];
1504
+ if (isset($wassup_cookie['spamresult'])) {
1505
+ $spamresult = $wassup_cookie['spamresult'];
1506
+ }
1507
+ $session_timeout = ((int)$wassup_timer - (int)time());
1508
+ if ( $session_timeout < 1) {
1509
+ //#reset cookie values when timer is 0
1510
+ unset($wassup_cookie);
1511
+ $wassup_id = ""; //a new id will be assigned
1512
+ }
1513
+ } */
1514
+ //Work-around for cookie rejection:
1515
+ //#assign new wassup id from "temp_id" and include it in dup check
1516
  if (empty($wassup_id)) {
 
1517
  $wassup_id = md5($temp_id);
1518
+ //$wassup_id = $temp_id; //debug
1519
+ }
1520
+ //### Check for duplicates.
1521
+ $dup_urlrequest=0;
1522
+ // Dup: Hit recorded, ==wassup_id, last visit, <45 secs old, ==URL
1523
+ $dups = $wpdb->get_results("SELECT wassup_id, urlrequested, spam, `timestamp` AS hit_timestamp FROM ".$table_tmp_name." WHERE wassup_id='".$wassup_id."' AND `timestamp` >".($timestamp-45)." GROUP BY wassup_id ORDER BY hit_timestamp DESC");
1524
+ if (!empty($dups)) {
1525
+ $i=0;
1526
+ foreach ($dups as $dup) { //check first record only
1527
+ if ($i == 0) {
1528
+ if ($dup->urlrequested == $urlRequested) {
1529
+ $dup_urlrequest=1;
1530
+ }
1531
+ //retrieve spam check results
1532
+ $spamresult = $dup->spam;
1533
+ }
1534
+ $i=$i+1;
1535
+ }
1536
  }
1537
+ //
1538
+ //#End visitor tracking with cookie/session
1539
  //#===================================================
1540
 
1541
  //### Exclude duplicates...
1542
+ if ($dup_urlrequest == 0) {
1543
+ //##### Extract useful visit information from http header..
1544
+ if (empty($browser) || stristr($browser,"N/A")) {
1545
+ list($spider,$feed) = wGetSpider($userAgent,$hostname);
1546
+ }
1547
+
1548
+ //#I prefer to see os/browser info. for spiders/bots.
1549
 
1550
+ //spider exclusion control
1551
+ //# Spider exclusion control moved to avoid unneeded tests if dup. excluded
1552
+ if ($wassup_options->wassup_spider == 1 || $spider == '') {
1553
  //
1554
  //#use country code for language, if it exists in hostname
1555
  if (!empty($hostname) && preg_match("/\.[a-zA-Z]{2}$/", $hostname) > 0) {
1600
  }
1601
  }
1602
  if ( $wassup_options->wassup_spam == 1 && $spam == 0 ) {
1603
+ //# some valid spiders to exclude from spam checking
1604
+ $goodbot = false;
1605
+ if ($hostname!="" && !empty($spider)) {
1606
+ if (preg_match('/^(googlebot|msnbot|yahoo\!\ slurp|technorati)/i',$spider)>0 && preg_match('/(googlebot|live|msn|yahoo|technorati)\.(com|net)$/i',$hostname)>0){
1607
+ $goodbot = true;
1608
+ }
1609
+ }
1610
 
1611
  //# No duplicate spam testing in same session unless there
1612
  //# is a forum page request or comment...
1615
 
1616
  //# No spam check on known bots (google, yahoo,...) unless
1617
  //# there is a comment or forum page request...
1618
+ } elseif (empty($spider) || !$goodbot || stristr($urlRequested,"comment") !== FALSE || stristr($urlRequested,"forum") !== FALSE || !empty($comment_user) ) {
1619
 
1620
  // Try to search for previous spammer detected by akismet with same IP
1621
  if (!empty($ipAddress)) {
1668
  }
1669
  // test for errors
1670
  if($akismet->errorsExist()) {
1671
+ //#error means don't save result in cookie
1672
  unset($spamresult);
1673
  }
1674
  } //end if file_exists(akismet_class)
1684
  }
1685
 
1686
  //## Final exclusion control is spam...
1687
+ if ($spam == 0 OR ($wassup_options->wassup_spam == 1 AND $spam == 1) OR ($wassup_options->wassup_refspam == 1 AND $spam == 2)) {
1688
+ /* // #save spam results in session...
1689
+ if (isset($spamresult)) {
1690
  @session_start(); //required to access $_SESSION
1691
  $_SESSION['spamresult'] = $spamresult;
1692
  @session_write_close();
1693
+ }
1694
+ */
1695
 
1696
  // #Record visit in wassup tables...
1697
  // Insert the record into the db
1698
  insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language[0], $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
1699
  // Insert the record into the wassup_tmp table too
1700
  insert_into_wp($table_tmp_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language[0], $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
1701
+ $recorded = true;
1702
  // Delete records older then 3 minutes
1703
+ $wpdb->query("DELETE FROM $table_tmp_name WHERE `timestamp`<'".strtotime("-3 minutes", $timestamp)."'");
1704
 
1705
  } //end if $spam == 0
1706
 
1707
+ } //end if wassup_spider
1708
+ } //end if dup_urlrequest == 0
1709
 
1710
+ } //end if !is_404
1711
  } //end if wassup_attack
 
1712
  } //end if wassup_loggedin
1713
 
1714
  } //end if !themes
1725
  //$to_date = wassup_get_time();
1726
  $from_date = strtotime($wassup_options->delete_auto, $timestamp);
1727
  //#check before doing delete as it could lock the table...
1728
+ if ((int)$wpdb->get_var("SELECT COUNT(id) FROM $table_name WHERE `timestamp`<'$from_date'") > 0) {
1729
+ $wpdb->query("DELETE FROM $table_name WHERE `timestamp`<'$from_date'");
1730
  }
1731
  // Optimize table once a day
1732
  if ($timestamp > strtotime("24 hours", $wassup_options->wassup_optimize)) {
1773
  if (!empty($table_name) && !empty($wassup_id) && !empty($timestamp)) {
1774
 
1775
  if (method_exists($wpdb,'prepare')) {
1776
+ $insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, `timestamp`, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
1777
  VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
1778
  attribute_escape($wassup_id),
1779
  attribute_escape($timestamp),
1797
  ));
1798
  } else {
1799
  $insert = $wpdb->query("INSERT INTO " . $table_name .
1800
+ " (wassup_id, `timestamp`, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam) " .
1801
  "VALUES (
1802
  '".attribute_escape($wassup_id)."',
1803
  '".attribute_escape($timestamp)."',
1838
  }
1839
  } //end function wassupDashChart
1840
 
1841
+ //#Return current PHP session.save_path value (pathname portion)
1842
+ function getSessionpath() {
1843
+ $sessionpath = session_save_path();
1844
+ if (strpos($sessionpath, ";") !== FALSE) {
1845
+ $sessionpath = substr($sessionpath, strpos($sessionpath, ";")+1);
1846
+ }
1847
+ $sessionpath = rtrim($sessionpath,"/");
1848
+ return $sessionpath;
1849
+ }
1850
+
1851
  function wGetQueryPairs($url){
1852
  $parsed_url = parse_url($url);
1853
  $tab=parse_url($url);
1927
  "Overture|overture.com|Keywords|","Supereva|supereva.it|q|","Teoma|teoma.com|q|","Tiscali|search-dyn.tiscali.|key|","Voil|voila.fr|kw|",
1928
  "Web|web.de|su|","Clarence|search.clarence.com|q|","Gazzetta|search.gazzetta.it|q|","PagineGialle|paginegialle.it|qs|",
1929
  "Jumpy|servizi.mediaset.it|searchWord|","ItaliaPuntoNet|italiapuntonet.net|search|","StartNow|search.startnow.|q|","Search|search.it|srctxt|",
1930
+ "Search|search.com|q|", "Good Search|goodsearch.com|Keywords|", "ABC Sok|verden.abcsok.no|q|", "Kvasir|kvasir.no|searchExpr|",
1931
+ "Start.no|start.no|q|", "bluewin.ch|bluewin.ch|query|", "Google Translate|translate.google.|u|");
1932
  foreach($lines as $line_num => $se) {
1933
  list($nome,$url,$key,$lang)=explode("|",$se);
1934
  if(@strpos($referrer,$url)===FALSE) continue;
1952
  return null;
1953
  }
1954
 
1955
+ //extract browser and platform info from a user agent string and
1956
+ // return the values in an array: 0->browser 1->os. -Helene D. 6/7/08.
1957
+ function wGetBrowser($agent="") {
1958
+ if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
1959
+ $browsercap = array();
1960
+ $browser = "";
1961
+ $os = "";
1962
+ //check PHP browscap data for browser and platform, when available
1963
+ if (ini_get("browscap") != "" ) {
1964
+ $browsercap = get_browser($agent,true);
1965
+ if (!empty($browsercap['platform'])) {
1966
+ if (stristr($browsercap['platform'],"unknown") === false) {
1967
+ $os = $browsercap['platform'];
1968
+ if (!empty($browsercap['browser'])) {
1969
+ $browser = $browsercap['browser'];
1970
+ } else {
1971
+ $browser = $browsercap['parent'];
1972
+ }
1973
+ if (!empty($browsercap['version'])) {
1974
+ $browser = $browser." ".$browsercap['version'];
1975
+ }
1976
+ } }
1977
+ //reject generic browscap browsers (ex: mozilla, default)
1978
+ if (preg_match('/^(mozilla|default|unknown)/i',$browser) > 0) {
1979
+ $browser = "";
1980
+ }
1981
+ }
1982
+ $os = trim($os);
1983
+ $browser = trim($browser);
1984
+
1985
+ //use Detector class when browscap is missing or browser is unknown
1986
+ if ( $os == "" || $browser == "") {
1987
+ $dip = &new Detector("", $agent);
1988
+ $browser = $dip->browser." ".$dip->browser_version;
1989
+ $os = $dip->os." ".$dip->os_version;
1990
+ }
1991
+ return array(trim($browser),trim($os));
1992
+ } //end function wGetBrowser
1993
+
1994
+ //extract spider and feed info from a user agent string and
1995
+ // return the values in an array: 0->spider 1->feed
1996
+ function wGetSpider($agent="",$hostname=""){
1997
+ if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
1998
+ $crawler = "";
1999
+ $feed = "";
2000
+ $os = "";
2001
+ //check browscap data for crawler info., when available
2002
+ if (ini_get("browscap") != "" ) {
2003
+ $browsercap = get_browser($agent,true);
2004
+ //if no platform(os), assume crawler...
2005
+ if (!empty($browsercap['platform'])) {
2006
+ if ( $browsercap['platform'] != "unknown") {
2007
+ $os = $browsercap['platform'];
2008
+ }
2009
+ }
2010
+ if (!empty($browsercap['crawler']) || !empty($browsercap['stripper']) || $os == "") {
2011
+ if (!empty($browsercap['browser'])) {
2012
+ $crawler = $browsercap['browser'];
2013
+ } else {
2014
+ $crawler = $browsercap['parent'];
2015
+ }
2016
+ if (!empty($browsercap['version'])) {
2017
+ $crawler = $crawler." ".$browsercap['version'];
2018
+ }
2019
+ }
2020
+ //reject unknown browscap crawlers (ex: default)
2021
+ if (preg_match('/^(default|unknown)/i',$crawler) > 0) {
2022
+ $crawler = "";
2023
+ }
2024
+ }
2025
+
2026
+ //get crawler info. from a known list
2027
+ $crawler = trim($crawler);
2028
  $agent=str_replace(" ","",$agent);
2029
+ if (empty($crawler)) {
2030
+ $key = null;
2031
  $lines = array("Wordpress Pingback/Trackback|Wordpress|", "Alexa|ia_archiver|","Ask.com/Teoma|AskJeeves/Teoma)|","Biz360|Biz360|","Naver|NaverBot|","Naver|Cowbot|","cURL|curl/|","Google|Googlebot/|",
2032
  "Google|googlebot/|","Google Images|Googlebot-Image|","LookSmart|grub-client|","Yahoo!|slurp@inktomi|","Yahoo!|Yahoo!Slurp|",
2033
  "Yahoo!|MMCrawler|","MSN|msnbot|","AltaVista|Scooter-|","Wget|Wget/1.|","Technorati|Technoratibot|","Moreover|Moreoverbot|",
2087
  "Feed::Find|Feed::Find|", "eZ publish Link Validator|eZ publish Link Validator|", "R6_CommentReade|R6_CommentReade|",
2088
  "Strategic Board Bot|Strategic Board Bot|", "OSSE Scanner|OSSE Scanner|", "PECL::HTTP|PECL::HTTP|", "GetRight|GetRight|", "yacybot|yacybot|",
2089
  "GurujiBot|GurujiBot|", "Missigua Locator|Missigua Locator|", "ISC Systems iRc Search|ISC Systems iRc Search|", "whiteiexpres/Nutch|whiteiexpres/Nutch|",
2090
+ "kalooga/kalooga|kalooga/kalooga|", "Bookdog|Bookdog|", "webLyzard|webLyzard|", "EnaBot|EnaBot|", "AboutUsBot|AboutUsBot|");
2091
+ foreach($lines as $line_num => $spider) {
2092
+ list($nome,$key)=explode("|",$spider);
2093
+ if(stristr($agent,$key)===FALSE) { continue; }
2094
+ else { $crawler = trim($nome); }
2095
+ }
2096
+ } // end if crawler
2097
+
2098
+ //determine if this is a feed reader...
2099
+ if (preg_match("/([0-9]{1,10})(subscriber)/i",$agent,$subscriber) > 0) {
2100
+ // It's a feedreader with some subscribers
2101
+ $feed = $subscriber[1];
2102
+ if (empty($crawler)) {
2103
+ $crawler = "Feed Reader";
2104
+ }
2105
+ } elseif (@strpos(strtolower($agent),"feed")!== FALSE) {
2106
+ if (empty($crawler)) {
2107
+ $crawler = "Feed Reader";
2108
+ $feed = "feed reader";
2109
  } else {
2110
+ $feed = $crawler;
 
2111
  }
2112
+ } //end if preg_match subscriber
2113
+
2114
+ //check for spoofers of Google/Msn/Yahoo crawlers...
2115
+ if ($hostname!="") {
2116
+ if (preg_match('/^(googlebot|msnbot|yahoo\!\ slurp)/i',$crawler)>0 && preg_match('/(googlebot|live|msn|yahoo)\./i',$hostname)==0){
2117
+ $crawler = "Spoofer bot";
2118
+ }
2119
+ } //end if hostname
2120
+
2121
+ return array($crawler,trim($feed));
2122
  }
2123
 
2124
  //# Check input, $referrer against a list of known spammers and
2129
  $referrer=htmlentities(strip_tags(str_replace(" ","",html_entity_decode($referrer))));
2130
  $badhostfile= dirname(__FILE__).'/badhosts.txt';
2131
  $key = null;
 
2132
  if (empty($referrer)) { return null; } //nothing to check...
2133
 
2134
  //#Assume any referrer name similar to "viagra/zanax/.."
2139
  return 1;
2140
  }
2141
  }
 
2142
  $lines = array("1clickholdem.com", "1ps.biz", "24h.to", "4all-credit.com", "4all-prescription.com", "4u-money.com", "6q.org", "88.to", "always-casino.com",
2143
  "always-credit.com", "andipink.com", "antiquemarketplace.net", "artmedia.com.ru", "asstraffic.com", "at.cx", "available-casino.com", "available-credit.com",
2144
  "available-prescription.com", "base-poker.com", "bayfronthomes.net", "bitlocker.net", "black-poker.com", "blest-money.com", "budgethawaii.net", "bwdow.com",
2168
  //#check for a customized spammer list...
2169
  if (file_exists($badhostfile)) {
2170
  $lines = file($badhostfile,FILE_IGNORE_NEW_LINES);
 
 
 
2171
  foreach($lines as $line_num => $spammer) {
2172
  if(stristr($referrer,trim($spammer)) !== FALSE) {
2173
  // find it!
2351
 
2352
  // Widget Latest Searches
2353
  if ($wassup_settings['wassup_widget_search'] == 1) {
2354
+ $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_tmp_name WHERE search!='' GROUP BY search ORDER BY `timestamp` DESC LIMIT ".attribute_escape($searchlimit)."");
2355
  if (count($query_det) > 0) {
2356
  print "$before_title ".__('Last searched terms','wassup')." $after_title";
2357
  print "<ul class='$ulclass'>";
2364
 
2365
  // Widget Latest Referers
2366
  if ($wassup_settings['wassup_widget_ref'] == 1) {
2367
+ $query_ref = $wpdb->get_results("SELECT referrer FROM $table_tmp_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY `timestamp` DESC LIMIT ".attribute_escape($reflimit)."");
2368
  if (count($query_ref) > 0) {
2369
  print "$before_title ".__('Last referers','wassup')." $after_title";
2370
  print "<ul class='$ulclass'>";
2507
 
2508
  print $before_widget;
2509
  if ($wsearch == 1) {
2510
+ $query_det = $wpdb->get_results("SELECT search, referrer FROM $table_tmp_name WHERE search!='' GROUP BY search ORDER BY `timestamp` DESC LIMIT $searchlimit");
2511
  if (count($query_det) > 0) {
2512
  print "$before_title Last searched terms $after_title";
2513
  print "<ul class='$ulclass'>";
2519
  }
2520
 
2521
  if ($wref == 1) {
2522
+ $query_ref = $wpdb->get_results("SELECT referrer FROM $table_tmp_name WHERE searchengine='' AND referrer!='' AND referrer NOT LIKE '$wpurl%' GROUP BY referrer ORDER BY `timestamp` DESC LIMIT $reflimit");
2523
  if (count($query_ref) > 0) {
2524
  print "$before_title Last referers $after_title";
2525
  print "<ul class='$ulclass'>";
2581
  print $after_widget;
2582
  } //end function wassup_sidebar
2583
 
2584
+ //### Add hooks after functions have been defined
2585
+ //## General hooks
2586
+ add_action('init', 'wassup_init');
2587
+ add_action("widgets_init", "wassup_widget_init");
2588
+
2589
+ //## Wassup Admin filters
2590
+ register_activation_hook(__FILE__, 'wassup_install');
2591
+ register_deactivation_hook(__FILE__, 'wassup_uninstall');
2592
+ //add hooks for wassup admin header functions
2593
+ add_action('admin_head', 'add_wassup_css');
2594
+ add_action('admin_menu', 'wassup_add_pages');
2595
+ add_action('activity_box_end', 'wassupDashChart');
2596
+
2597
+ //## Wassup visitor tracking hooks
2598
+ //Wassup record added after page is displayed to keep page load fast
2599
+ add_action('shutdown', 'wassupAppend');
2600
+ //add_action('send_headers', 'wassupAppend'); //slows down page load
2601
+ add_action('wp_head', 'add_wassup_meta_info');
2602
  ?>