Third pass at adding key files
0
forum.slowtwitch.com/.htaccess
Normal file
0
forum.slowtwitch.com/.htpasswd
Normal file
0
forum.slowtwitch.com/.keep
Normal file
0
forum.slowtwitch.com/.service-lock
Normal file
7
forum.slowtwitch.com/.svn/dir-prop-base
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
K 10
|
||||||
|
svn:ignore
|
||||||
|
V 12
|
||||||
|
*.bak
|
||||||
|
*.bck
|
||||||
|
|
||||||
|
END
|
34
forum.slowtwitch.com/.svn/entries
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
9
|
||||||
|
|
||||||
|
dir
|
||||||
|
79
|
||||||
|
https://projects.gossamer-threads.com/svn/slowtwitch/tags/released/gforum
|
||||||
|
https://projects.gossamer-threads.com/svn/slowtwitch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
2010-04-14T21:25:45.287710Z
|
||||||
|
79
|
||||||
|
vivian
|
||||||
|
has-props
|
||||||
|
|
||||||
|
svn:special svn:externals svn:needs-lock
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
9372ece4-6914-43d3-834c-a59b432a6956
|
||||||
|
|
||||||
|
www
|
||||||
|
dir
|
||||||
|
|
||||||
|
cgi-bin
|
||||||
|
dir
|
||||||
|
|
1
forum.slowtwitch.com/.svn/format
Normal file
@ -0,0 +1 @@
|
|||||||
|
9
|
1
forum.slowtwitch.com/advertprotestcode
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
<SCRIPT language="JavaScript" type="text/javascript">
<!--
document.write('<SCR'+'IPT src="http://208.70.246.167/servlet/view/banner/javascript/zone?zid=1&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
//-->
</SCRIPT>
<NOSCRIPT>
<A href="http://208.70.246.167/servlet/click/zone?zid=1&pid=0&lookup=true&position=1" target="_top">
<IMG src="http://208.70.246.167/servlet/view/banner/image/zone?zid=1&pid=0&position=1" height="90" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
</A>
</NOSCRIPT>
<!-- END ADVERTPRO CODE BLOCK -->
|
1
forum.slowtwitch.com/www
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
/var/home/slowtwitch/site/forum.slowtwitch.com/www
|
69
site/common/static/js/base.min.js
vendored
Normal file
98
site/common/static/js/core.js
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
$(document).ready(function () {
|
||||||
|
/* magnify icon for mobile and tablet */
|
||||||
|
$('a[rel=main-search]').click(function() {
|
||||||
|
var form = $('#main-search');
|
||||||
|
if (form.is(':visible')) {
|
||||||
|
form.slideUp();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
form.slideDown();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
/* site main search: desktop*/
|
||||||
|
$('.search-widget select').change(function() {
|
||||||
|
var href = $(this).val();
|
||||||
|
var text = $(this).parent().find('option:selected').text();
|
||||||
|
var form = $('.search-widget form');
|
||||||
|
if (text.search(/advanced/i) != -1) {
|
||||||
|
window.location = href;
|
||||||
|
}
|
||||||
|
else if (text.search(/knowledge/i) != -1) {
|
||||||
|
form.attr('action', href);
|
||||||
|
form.find('.article_keyword').attr("name", "query").focus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
form.find('.article_keyword').attr("name", "search_string").focus();
|
||||||
|
form.find('[name=search_forum]').val(href);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.social-sm .sprite-magnify').click(function() {
|
||||||
|
if ($(this).siblings('.main-search').find('form').is(':hidden')) {
|
||||||
|
$(this).siblings('.main-search').find('form').fadeIn().find('.txt').focus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).siblings('.main-search').find('form').fadeOut();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
|
||||||
|
/* menu icon */
|
||||||
|
$('.header .controller .sprite-menu').click(function() {
|
||||||
|
/* copy navbar menu */
|
||||||
|
if ($(this).siblings('.menu-b').find('.nav').length == 0) {
|
||||||
|
/* submenu */
|
||||||
|
$('.header .controller .navbar').html($('#menu').html()).find('.nav > li .expand').each(function() {
|
||||||
|
$(this).click(function() {
|
||||||
|
var id = $(this).siblings('a[rel]').attr('rel');
|
||||||
|
|
||||||
|
if ($(this).siblings('.subnav').is(':hidden')) {
|
||||||
|
$('.header .controller .navbar li.open').removeClass('open');
|
||||||
|
$('.header .controller .navbar .subnav').slideUp();
|
||||||
|
$(this).parent().addClass('open').find('.subnav').slideDown('fast');
|
||||||
|
}
|
||||||
|
else { $(this).parent().removeClass('open').find('.subnav').slideUp('fast'); }
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($(this).hasClass('open')) {
|
||||||
|
$(this).siblings('.menu-b').slideUp('fast');
|
||||||
|
$(this).removeClass('open');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).siblings('.menu-b').slideDown('fast');
|
||||||
|
$(this).addClass('open');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.brand-b .user-profile .subnav').html($('#user_profile_menu').html());
|
||||||
|
|
||||||
|
/* subscribe form */
|
||||||
|
$('.utility .subscribe a').click(function() {
|
||||||
|
if ($(this).parent().hasClass('open')) {
|
||||||
|
$(this).siblings('.subscribe-form').slideUp();
|
||||||
|
$(this).parent().removeClass('open');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).siblings('.subscribe-form').slideDown();
|
||||||
|
$(this).parent().addClass('open');
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
/* dialog */
|
||||||
|
$('a.dialog-lnk[rel]').each(function() {
|
||||||
|
$(this).click(function() {
|
||||||
|
$('#' + $(this).attr('rel')).dialog({
|
||||||
|
modal: true
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
})
|
||||||
|
});
|
||||||
|
})
|
89
site/common/static/js/fit_calculator.js
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
var _650bbdropdefault;
|
||||||
|
var _700bbdropdefault;
|
||||||
|
var _650forkoffsetdefault;
|
||||||
|
var _700forkoffsetdefault;
|
||||||
|
var _headangledefault;
|
||||||
|
|
||||||
|
function set700Defaults(){
|
||||||
|
document.calcForm.fork_length.value = '372';
|
||||||
|
document.calcForm.bb_drop.value = _700bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _700forkoffsetdefault;
|
||||||
|
document.calcForm.chain_stay.value = '395';
|
||||||
|
document.calcForm.rear_wheel.value = '334';
|
||||||
|
}
|
||||||
|
|
||||||
|
function set650Defaults(){
|
||||||
|
document.calcForm.fork_length.value = '322';
|
||||||
|
document.calcForm.bb_drop.value = _650bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _650forkoffsetdefault;
|
||||||
|
document.calcForm.chain_stay.value = '385';
|
||||||
|
document.calcForm.rear_wheel.value = '284';
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAllDefaults(){
|
||||||
|
document.calcForm.stack.value = '0';
|
||||||
|
document.calcForm.reach.value = '0';
|
||||||
|
document.calcForm.seat_angle.value = '78';
|
||||||
|
document.calcForm.hs_lower_stack.value = '1.5';
|
||||||
|
document.calcForm.head_angle.value = _headangledefault;
|
||||||
|
setStandardLeggedDefaultValues();
|
||||||
|
set700Defaults();
|
||||||
|
document.calcForm.wheel_size[0].checked = true;
|
||||||
|
document.calcForm.morphology[0].checked = true;
|
||||||
|
if (document.calcForm.coordinates.value == 'serotta_xy') {
|
||||||
|
document.calcForm.serottaX.value = '0';
|
||||||
|
document.calcForm.serottaY.value = '0';
|
||||||
|
document.calcForm.stem_angle.value = '6';
|
||||||
|
document.calcForm.clamp.value = '0';
|
||||||
|
document.calcForm.spacer.value = '0';
|
||||||
|
document.calcForm.headset.value = '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLongLeggedDefaultValues(){
|
||||||
|
_650bbdropdefault = '55';
|
||||||
|
_700bbdropdefault = '80';
|
||||||
|
_650forkoffsetdefault = '43';
|
||||||
|
_700forkoffsetdefault = '48';
|
||||||
|
_headangledefault = '71.5';
|
||||||
|
document.calcForm.head_angle.value = _headangledefault;
|
||||||
|
|
||||||
|
if(document.calcForm.wheel_size[0].checked == true){
|
||||||
|
document.calcForm.bb_drop.value = _700bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _700forkoffsetdefault;
|
||||||
|
}else{
|
||||||
|
document.calcForm.bb_drop.value = _650bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _650forkoffsetdefault;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setStandardLeggedDefaultValues(){
|
||||||
|
_650bbdropdefault = '45';
|
||||||
|
_700bbdropdefault = '70';
|
||||||
|
_650forkoffsetdefault = '40';
|
||||||
|
_700forkoffsetdefault = '45';
|
||||||
|
_headangledefault = '72';
|
||||||
|
document.calcForm.head_angle.value = _headangledefault;
|
||||||
|
|
||||||
|
if(document.calcForm.wheel_size[0].checked == true){
|
||||||
|
document.calcForm.bb_drop.value = _700bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _700forkoffsetdefault;
|
||||||
|
}else{
|
||||||
|
document.calcForm.bb_drop.value = _650bbdropdefault;
|
||||||
|
document.calcForm.fork_offset.value = _650forkoffsetdefault;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initDefaults(){
|
||||||
|
setStandardLeggedDefaultValues();
|
||||||
|
setAllDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkAgreeToTerms(){
|
||||||
|
if(document.calcForm.terms.checked == true)
|
||||||
|
document.calcForm.submit();
|
||||||
|
else
|
||||||
|
alert('You must accept our terms first.');
|
||||||
|
}
|
||||||
|
|
||||||
|
//window.onload = initDefaults;
|
1018
site/common/static/js/gforum.js
Normal file
13
site/common/static/js/jquery-ui.min.js
vendored
Normal file
39
site/common/static/js/jquery.autocomplete.min.js
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
jQuery.autocomplete=function(input,options){var me=this;var $input=$(input).attr("autocomplete","off");if(options.inputClass){$input.addClass(options.inputClass);}
|
||||||
|
var results=document.createElement("div");var $results=$(results).hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0){$results.css("width",options.width);}
|
||||||
|
$("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;var mouseDownOnSelect=false;var hidingResults=false;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string"){options.cacheLength=1;}
|
||||||
|
for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
|
||||||
|
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
|
||||||
|
$input
|
||||||
|
.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
|
||||||
|
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}})
|
||||||
|
.focus(function(){hasFocus=true;})
|
||||||
|
.blur(function(){hasFocus=false;if(!mouseDownOnSelect){hideResults();}});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=$("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
|
||||||
|
lis.removeClass("ac_over");$(lis[active]).addClass("ac_over");};function selectCurrent(){var li=$("li.ac_over",results)[0];if(!li){var $li=$("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
|
||||||
|
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
|
||||||
|
var v=$.trim(li.selectValue?li.selectValue:li.innerHTML);input.lastSelected=v;prev=v;$results.html("");$input.val(v);hideResultsNow();if(options.onItemSelect){setTimeout(function(){options.onItemSelect(li)},1);}};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
|
||||||
|
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(hidingResults){return;}
|
||||||
|
hidingResults=true;if(timeout){clearTimeout(timeout);}
|
||||||
|
var v=$input.removeClass(options.loadingClass).val();if($results.is(":visible")){$results.hide();}
|
||||||
|
if(options.mustMatch){if(!input.lastSelected||input.lastSelected!=v){selectItem(null);}}
|
||||||
|
hidingResults=false;};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if($.browser.msie){$results.append(document.createElement('iframe'));}
|
||||||
|
results.appendChild(dataToDom(data));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0][0]);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];var rows=data.data.split(options.lineSeparator);for(var i=0;i<rows.length;i++){var row=$.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator);}}
|
||||||
|
return parsed;};function dataToDom(data){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{var autoResult=row[0];autoResult=autoResult.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');li.innerHTML=autoResult;li.selectValue=row[0];}
|
||||||
|
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
|
||||||
|
li.extra=extra;ul.appendChild(li);$(li).hover(function(){$("li",ul).removeClass("ac_over");$(this).addClass("ac_over");active=$("li",ul).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)});}
|
||||||
|
$(ul).mousedown(function(){mouseDownOnSelect=true;}).mouseup(function(){mouseDownOnSelect=false;});return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data);addToCache(q,data);receiveData(q,data);},null,'json');}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var sep=options.url.indexOf('?')==-1?'?':'&';var url=options.url+sep+"q="+encodeURI(q);for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i]);}
|
||||||
|
return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x;}}
|
||||||
|
return csub;}}}
|
||||||
|
return null;};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data)
|
||||||
|
addToCache(q,data);findValueCallback(q,data);},null,'json');}else{findValueCallback(q,null);}}
|
||||||
|
function findValueCallback(q,data){if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[0];}else{li.innerHTML=row[0];li.selectValue=row[0];}
|
||||||
|
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
|
||||||
|
li.extra=extra;}}
|
||||||
|
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
|
||||||
|
function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++;}else if(!cache[q]){cache.length++;}
|
||||||
|
cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
|
||||||
|
curtop+=obj.offsetTop}
|
||||||
|
return{x:curleft,y:curtop};}}
|
||||||
|
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options=$.extend({inputClass:"ac_input",resultsClass:"ac_results",lineSeparator:"\n",cellSeparator:"|",minChars:1,delay:400,matchCase:0,matchSubset:1,matchContains:0,cacheLength:1,mustMatch:0,extraParams:{},loadingClass:"ac_loading",selectFirst:false,selectOnly:false,maxItemsToShow:-1,autoFill:false,width:0},options);options.width=parseInt(options.width,10);this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
|
||||||
|
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
|
||||||
|
jQuery.fn.indexOf=function(e){for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
|
||||||
|
return-1;};
|
11
site/common/static/js/jquery.form.min.js
vendored
Normal file
1
site/common/static/js/jquery.jcarousellite.min.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var running=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var div=$(this),ul=$("ul",div),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(-v).clone(true)).append(tLi.slice(0,v).clone(true));o.start+=v;}var li=$("li",ul),itemLength=li.size(),curr=o.start;div.css("visibility","visible");li.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});div.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var liSize=o.vertical?height(li):width(li);var ulSize=liSize*itemLength;var divSize=liSize*v;li.css({width:li.width(),height:li.height()});ul.css(sizeCss,ulSize+"px");div.css(sizeCss,divSize+"px");go(curr);if(o.btnPrev){$(o.btnPrev).click(function(){return go(curr-o.scroll);});}if(o.btnNext){$(o.btnNext).click(function(){return go(curr+o.scroll);});}if(o.btnGo){$.each(o.btnGo,function(i,val){$(val).click(function(){return go(o.circular?v+i:i);});});}if(o.mouseWheel&&div.mousewheel){div.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll);});}if(o.auto){setInterval(function(){go(curr+o.scroll);},o.auto+o.speed);}function vis(){return li.slice(curr).slice(0,v);}function go(to){if(!running){if(o.beforeStart){o.beforeStart.call(this,vis());}if(o.circular){if(to<1){ul.css(animCss,-((itemLength-v*2+curr)*liSize)+"px");curr=(to!=0?(to-Math.floor(to/itemLength)*itemLength):itemLength)-v*2;}else if(to>=itemLength-v){ul.css(animCss,-((curr+v*2-itemLength)*liSize)+"px");curr=v*2-(itemLength%to);}else{curr=to;}}else{if(to<0){curr=0;}else if(to>itemLength-v){curr=itemLength-v;}else{curr=to;}}running=true;ul.animate(animCss=="left"?{left:-(curr*liSize)}:{top:-(curr*liSize)},o.speed,o.easing,function(){if(o.afterEnd){o.afterEnd.call(this,vis());}running=false;});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");if(curr===0){$(o.btnPrev).addClass("disabled");}else if(curr==itemLength-v){$(o.btnNext).addClass("disabled");}}}return false;}});};function css(el,prop){return parseInt($.css(el[0],prop))||0;}function width(el){return el[0].offsetWidth+css(el,'marginLeft')+css(el,'marginRight');}function height(el){return el[0].offsetHeight+css(el,'marginTop')+css(el,'marginBottom');}})(jQuery);
|
4
site/common/static/js/jquery.min.js
vendored
Normal file
12
site/common/static/js/lightbox.min.js
vendored
Normal file
203
site/common/static/js/main.js
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
/* IE Hacks */
|
||||||
|
/**
|
||||||
|
* documentMode is an IE-only property
|
||||||
|
* http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
|
||||||
|
*/
|
||||||
|
|
||||||
|
var msie = document.documentMode;
|
||||||
|
if (msie < 9) { /* code for IE < 9 */
|
||||||
|
$('body').addClass('ie8');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gallery */
|
||||||
|
if ( $('.swiper-content .swiper-slide').length > 0 ) {
|
||||||
|
/* Swiper Content */
|
||||||
|
|
||||||
|
var doLoop = true;
|
||||||
|
|
||||||
|
if ( $('.swiper-content .swiper-slide').length == 1 ) {
|
||||||
|
doLoop = false;
|
||||||
|
$('.slideshow-controller .btn').addClass('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
var contentSwiper = $('.swiper-content').swiper({
|
||||||
|
loop: doLoop,
|
||||||
|
visibilityFullFit: false,
|
||||||
|
watchActiveIndex: true,
|
||||||
|
keyboardControl: true,
|
||||||
|
/* Auto Height */
|
||||||
|
calculateHeight: true,
|
||||||
|
/* Apply CSS for width and/or height */
|
||||||
|
initialized: function() {
|
||||||
|
setContentSize();
|
||||||
|
sliderButtonPosition();
|
||||||
|
},
|
||||||
|
onSlideChangeStart: function(){
|
||||||
|
updateNavPosition();
|
||||||
|
navSwiper.swipeTo( contentSwiper.activeLoopIndex );
|
||||||
|
sliderIndexUpdate( contentSwiper.activeLoopIndex );
|
||||||
|
},
|
||||||
|
onSlideChangeEnd: function(){
|
||||||
|
setContentSize();
|
||||||
|
sliderButtonPosition();
|
||||||
|
/* sliderButtonPosition(); */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var navSwiper = $('.swiper-nav').swiper({
|
||||||
|
slidesPerView: 'auto',
|
||||||
|
loop: doLoop,
|
||||||
|
visibilityFullFit: false,
|
||||||
|
watchActiveIndex: true,
|
||||||
|
keyboardControl: true,
|
||||||
|
centeredSlides: true,
|
||||||
|
/*Auto Height*/
|
||||||
|
calculateHeight: true,
|
||||||
|
/*Thumbnails Clicks*/
|
||||||
|
onSlideClick: function(){
|
||||||
|
navSwiper.swipeTo( navSwiper.clickedSlideLoopIndex );
|
||||||
|
contentSwiper.swipeTo( navSwiper.clickedSlideLoopIndex );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.swiper-button-next').click( function() {
|
||||||
|
navSwiper.swipeNext();
|
||||||
|
contentSwiper.swipeNext();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.swiper-button-prev').click( function() {
|
||||||
|
navSwiper.swipePrev();
|
||||||
|
contentSwiper.swipePrev();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-next').click(function(){
|
||||||
|
$('.swiper-button-next').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.btn-prev').click(function(){
|
||||||
|
$('.swiper-button-prev').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
setContentSize();
|
||||||
|
sliderButtonPosition();
|
||||||
|
$(window).resize(function(){
|
||||||
|
setContentSize();
|
||||||
|
sliderButtonPosition();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function setContentSize() {
|
||||||
|
var captionHeight = $('.swiper-content .swiper-slide-active .caption').height();
|
||||||
|
|
||||||
|
var newHeight = $('.swiper-content .swiper-slide-active img').height() + captionHeight + 21;
|
||||||
|
$('.swiper-content, .swiper-content .swiper-wrapper, .swiper-content .swiper-slide-active').css({
|
||||||
|
height: newHeight
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateNavPosition(){
|
||||||
|
$('.swiper-nav .active-nav').removeClass('active-nav');
|
||||||
|
var activeNav = $('.swiper-nav .swiper-slide').eq(contentSwiper.activeIndex).addClass('active-nav');
|
||||||
|
if (!activeNav.hasClass('swiper-slide-visible')) {
|
||||||
|
if (activeNav.index()>navSwiper.activeIndex) {
|
||||||
|
var thumbsPerNav = Math.floor(navSwiper.width/activeNav.width())-1;
|
||||||
|
navSwiper.swipeTo(activeNav.index()-thumbsPerNav);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
navSwiper.swipeTo(activeNav.index());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sliderIndexUpdate( index ) {
|
||||||
|
$('.slideshow-controller .index span').text( index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sliderButtonPosition() {
|
||||||
|
if ( $(window).width() > 500 ) {
|
||||||
|
var caption = $('.swiper-content .swiper-slide-active .caption');
|
||||||
|
if ( caption.length > 0 && caption.text().length > 0 ) {
|
||||||
|
var captionHeight = $('.swiper-content').find('.swiper-slide-active .caption').height();
|
||||||
|
var btnHeight = $('.slideshow-controller').height();
|
||||||
|
var diff = captionHeight - btnHeight;
|
||||||
|
|
||||||
|
if ( captionHeight > 0 ) {
|
||||||
|
var margin = ( captionHeight + 10 ) * -1 + 'px';
|
||||||
|
var height = captionHeight + 45 + 'px';
|
||||||
|
$('.slideshow-controller').css({ 'margin-top' : margin, 'height' : height }, 300);
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.slideshow-controller').removeAttr('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.slideshow-controller').removeAttr('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.slideshow-controller').removeAttr('style');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $('.widget .region-list').length > 0 ) {
|
||||||
|
regionSublist();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set selected menu */
|
||||||
|
var oMenu = {
|
||||||
|
articles: 'news|features|lifestyle|opinion|interviews|tech|articles',
|
||||||
|
photos: 'photos',
|
||||||
|
videos: 'videos',
|
||||||
|
races: 'calendar|races|rd_aids',
|
||||||
|
coaching: 'coaching|coaches',
|
||||||
|
gravel: 'gravel',
|
||||||
|
podcast: 'podcast',
|
||||||
|
training: 'training',
|
||||||
|
bikefit: 'bike_fit|fit_calculator',
|
||||||
|
products: 'products',
|
||||||
|
local: 'local-listings|runshops|triclubs|retailers|fitters'
|
||||||
|
};
|
||||||
|
var uri = window.location.href.replace(/(.*).com\//, '');
|
||||||
|
var prefix = uri.substring(0, uri.search(/\//)).toLowerCase();
|
||||||
|
|
||||||
|
if (prefix == '') { prefix = uri.replace(/.html/, ''); }
|
||||||
|
if (prefix != '') {
|
||||||
|
var selected;
|
||||||
|
for (var i in oMenu) {
|
||||||
|
if (oMenu[i].search(prefix) != -1) {
|
||||||
|
selected = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected) $('#menu a[rel=' + selected + ']').parent().addClass('selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* trigger subcategory */
|
||||||
|
$('select[name=subcat]').change(function() {
|
||||||
|
window.location = $(this).val();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function regionSublist() {
|
||||||
|
$('.widget .list-item').click(function(){
|
||||||
|
$('.widget .list-item span').text('+');
|
||||||
|
if ( $(this).find('.sublist').css('display') !== 'none' ) {
|
||||||
|
$('.widget .sublist').hide();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('.widget .sublist').hide();
|
||||||
|
$(this).find('.sublist').show();
|
||||||
|
$(this).find('span').text('-');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyFromTemplate() {
|
||||||
|
$('.copytpl').each( function(){
|
||||||
|
var template = $(this).attr('data-tpl');
|
||||||
|
$( '.' + template + ':eq(0)' ).clone().insertAfter( $(this) );
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
}
|
1002
site/common/static/js/map.js
Normal file
21
site/common/static/js/markerclusterer_compiled.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
(function(){var d=null;function e(a){return function(b){this[a]=b}}function h(a){return function(){return this[a]}}var j;
|
||||||
|
function k(a,b,c){this.extend(k,google.maps.OverlayView);this.c=a;this.a=[];this.f=[];this.ca=[53,56,66,78,90];this.j=[];this.A=!1;c=c||{};this.g=c.gridSize||60;this.l=c.minimumClusterSize||2;this.J=c.maxZoom||d;this.j=c.styles||[];this.X=c.imagePath||this.Q;this.W=c.imageExtension||this.P;this.O=!0;if(c.zoomOnClick!=void 0)this.O=c.zoomOnClick;this.r=!1;if(c.averageCenter!=void 0)this.r=c.averageCenter;l(this);this.setMap(a);this.K=this.c.getZoom();var f=this;google.maps.event.addListener(this.c,
|
||||||
|
"zoom_changed",function(){var a=f.c.getZoom();if(f.K!=a)f.K=a,f.m()});google.maps.event.addListener(this.c,"idle",function(){f.i()});b&&b.length&&this.C(b,!1)}j=k.prototype;j.Q="/articles/static/css/images/m";j.P="png";j.extend=function(a,b){return function(a){for(var b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])};j.onAdd=function(){if(!this.A)this.A=!0,n(this)};j.draw=function(){};
|
||||||
|
function l(a){if(!a.j.length)for(var b=0,c;c=a.ca[b];b++)a.j.push({url:a.X+(b+1)+"."+a.W,height:c,width:c})}j.S=function(){for(var a=this.o(),b=new google.maps.LatLngBounds,c=0,f;f=a[c];c++)b.extend(f.getPosition());this.c.fitBounds(b)};j.z=h("j");j.o=h("a");j.V=function(){return this.a.length};j.ba=e("J");j.I=h("J");j.G=function(a,b){for(var c=0,f=a.length,g=f;g!==0;)g=parseInt(g/10,10),c++;c=Math.min(c,b);return{text:f,index:c}};j.$=e("G");j.H=h("G");
|
||||||
|
j.C=function(a,b){for(var c=0,f;f=a[c];c++)q(this,f);b||this.i()};function q(a,b){b.s=!1;b.draggable&&google.maps.event.addListener(b,"dragend",function(){b.s=!1;a.L()});a.a.push(b)}j.q=function(a,b){q(this,a);b||this.i()};function r(a,b){var c=-1;if(a.a.indexOf)c=a.a.indexOf(b);else for(var f=0,g;g=a.a[f];f++)if(g==b){c=f;break}if(c==-1)return!1;b.setMap(d);a.a.splice(c,1);return!0}j.Y=function(a,b){var c=r(this,a);return!b&&c?(this.m(),this.i(),!0):!1};
|
||||||
|
j.Z=function(a,b){for(var c=!1,f=0,g;g=a[f];f++)g=r(this,g),c=c||g;if(!b&&c)return this.m(),this.i(),!0};j.U=function(){return this.f.length};j.getMap=h("c");j.setMap=e("c");j.w=h("g");j.aa=e("g");
|
||||||
|
j.v=function(a){var b=this.getProjection(),c=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),f=new google.maps.LatLng(a.getSouthWest().lat(),a.getSouthWest().lng()),c=b.fromLatLngToDivPixel(c);c.x+=this.g;c.y-=this.g;f=b.fromLatLngToDivPixel(f);f.x-=this.g;f.y+=this.g;c=b.fromDivPixelToLatLng(c);b=b.fromDivPixelToLatLng(f);a.extend(c);a.extend(b);return a};j.R=function(){this.m(!0);this.a=[]};
|
||||||
|
j.m=function(a){for(var b=0,c;c=this.f[b];b++)c.remove();for(b=0;c=this.a[b];b++)c.s=!1,a&&c.setMap(d);this.f=[]};j.L=function(){var a=this.f.slice();this.f.length=0;this.m();this.i();window.setTimeout(function(){for(var b=0,c;c=a[b];b++)c.remove()},0)};j.i=function(){n(this)};
|
||||||
|
function n(a){if(a.A)for(var b=a.v(new google.maps.LatLngBounds(a.c.getBounds().getSouthWest(),a.c.getBounds().getNorthEast())),c=0,f;f=a.a[c];c++)if(!f.s&&b.contains(f.getPosition())){for(var g=a,u=4E4,o=d,v=0,m=void 0;m=g.f[v];v++){var i=m.getCenter();if(i){var p=f.getPosition();if(!i||!p)i=0;else var w=(p.lat()-i.lat())*Math.PI/180,x=(p.lng()-i.lng())*Math.PI/180,i=Math.sin(w/2)*Math.sin(w/2)+Math.cos(i.lat()*Math.PI/180)*Math.cos(p.lat()*Math.PI/180)*Math.sin(x/2)*Math.sin(x/2),i=6371*2*Math.atan2(Math.sqrt(i),
|
||||||
|
Math.sqrt(1-i));i<u&&(u=i,o=m)}}o&&o.F.contains(f.getPosition())?o.q(f):(m=new s(g),m.q(f),g.f.push(m))}}function s(a){this.k=a;this.c=a.getMap();this.g=a.w();this.l=a.l;this.r=a.r;this.d=d;this.a=[];this.F=d;this.n=new t(this,a.z(),a.w())}j=s.prototype;
|
||||||
|
j.q=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var c;c=this.a[b];b++)if(c==a){b=!0;break a}b=!1}if(b)return!1;if(this.d){if(this.r)c=this.a.length+1,b=(this.d.lat()*(c-1)+a.getPosition().lat())/c,c=(this.d.lng()*(c-1)+a.getPosition().lng())/c,this.d=new google.maps.LatLng(b,c),y(this)}else this.d=a.getPosition(),y(this);a.s=!0;this.a.push(a);b=this.a.length;b<this.l&&a.getMap()!=this.c&&a.setMap(this.c);if(b==this.l)for(c=0;c<b;c++)this.a[c].setMap(d);b>=this.l&&a.setMap(d);
|
||||||
|
a=this.c.getZoom();if((b=this.k.I())&&a>b)for(a=0;b=this.a[a];a++)b.setMap(this.c);else if(this.a.length<this.l)z(this.n);else{b=this.k.H()(this.a,this.k.z().length);this.n.setCenter(this.d);a=this.n;a.B=b;a.ga=b.text;a.ea=b.index;if(a.b)a.b.innerHTML=b.text;b=Math.max(0,a.B.index-1);b=Math.min(a.j.length-1,b);b=a.j[b];a.da=b.url;a.h=b.height;a.p=b.width;a.M=b.textColor;a.e=b.anchor;a.N=b.textSize;a.D=b.backgroundPosition;this.n.show()}return!0};
|
||||||
|
j.getBounds=function(){for(var a=new google.maps.LatLngBounds(this.d,this.d),b=this.o(),c=0,f;f=b[c];c++)a.extend(f.getPosition());return a};j.remove=function(){this.n.remove();this.a.length=0;delete this.a};j.T=function(){return this.a.length};j.o=h("a");j.getCenter=h("d");function y(a){a.F=a.k.v(new google.maps.LatLngBounds(a.d,a.d))}j.getMap=h("c");
|
||||||
|
function t(a,b,c){a.k.extend(t,google.maps.OverlayView);this.j=b;this.fa=c||0;this.u=a;this.d=d;this.c=a.getMap();this.B=this.b=d;this.t=!1;this.setMap(this.c)}j=t.prototype;
|
||||||
|
j.onAdd=function(){this.b=document.createElement("DIV");if(this.t)this.b.style.cssText=A(this,B(this,this.d)),this.b.innerHTML=this.B.text;this.getPanes().overlayMouseTarget.appendChild(this.b);var a=this;google.maps.event.addDomListener(this.b,"click",function(){var b=a.u.k;google.maps.event.trigger(b,"clusterclick",a.u);b.O&&a.c.fitBounds(a.u.getBounds())})};function B(a,b){var c=a.getProjection().fromLatLngToDivPixel(b);c.x-=parseInt(a.p/2,10);c.y-=parseInt(a.h/2,10);return c}
|
||||||
|
j.draw=function(){if(this.t){var a=B(this,this.d);this.b.style.top=a.y+"px";this.b.style.left=a.x+"px"}};function z(a){if(a.b)a.b.style.display="none";a.t=!1}j.show=function(){if(this.b)this.b.style.cssText=A(this,B(this,this.d)),this.b.style.display="";this.t=!0};j.remove=function(){this.setMap(d)};j.onRemove=function(){if(this.b&&this.b.parentNode)z(this),this.b.parentNode.removeChild(this.b),this.b=d};j.setCenter=e("d");
|
||||||
|
function A(a,b){var c=[];c.push("background-image:url("+a.da+");");c.push("background-position:"+(a.D?a.D:"0 0")+";");typeof a.e==="object"?(typeof a.e[0]==="number"&&a.e[0]>0&&a.e[0]<a.h?c.push("height:"+(a.h-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):c.push("height:"+a.h+"px; line-height:"+a.h+"px;"),typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.p?c.push("width:"+(a.p-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):c.push("width:"+a.p+"px; text-align:center;")):c.push("height:"+a.h+"px; line-height:"+a.h+
|
||||||
|
"px; width:"+a.p+"px; text-align:center;");c.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.M?a.M:"black")+"; position:absolute; font-size:"+(a.N?a.N:11)+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")}window.MarkerClusterer=k;k.prototype.addMarker=k.prototype.q;k.prototype.addMarkers=k.prototype.C;k.prototype.clearMarkers=k.prototype.R;k.prototype.fitMapToMarkers=k.prototype.S;k.prototype.getCalculator=k.prototype.H;k.prototype.getGridSize=k.prototype.w;
|
||||||
|
k.prototype.getExtendedBounds=k.prototype.v;k.prototype.getMap=k.prototype.getMap;k.prototype.getMarkers=k.prototype.o;k.prototype.getMaxZoom=k.prototype.I;k.prototype.getStyles=k.prototype.z;k.prototype.getTotalClusters=k.prototype.U;k.prototype.getTotalMarkers=k.prototype.V;k.prototype.redraw=k.prototype.i;k.prototype.removeMarker=k.prototype.Y;k.prototype.removeMarkers=k.prototype.Z;k.prototype.resetViewport=k.prototype.m;k.prototype.repaint=k.prototype.L;k.prototype.setCalculator=k.prototype.$;
|
||||||
|
k.prototype.setGridSize=k.prototype.aa;k.prototype.setMaxZoom=k.prototype.ba;k.prototype.onAdd=k.prototype.onAdd;k.prototype.draw=k.prototype.draw;s.prototype.getCenter=s.prototype.getCenter;s.prototype.getSize=s.prototype.T;s.prototype.getMarkers=s.prototype.o;t.prototype.onAdd=t.prototype.onAdd;t.prototype.draw=t.prototype.draw;t.prototype.onRemove=t.prototype.onRemove;
|
||||||
|
})();
|
3271
site/common/static/js/prototype.js
vendored
Normal file
53
site/common/static/js/rating.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
function RateItem(varParentId, varItemId, varRating)
|
||||||
|
{
|
||||||
|
var elementId = varParentId+"_"+varItemId;
|
||||||
|
var varOrigClassName = document.getElementById(elementId).className;
|
||||||
|
|
||||||
|
// Retrieve Ajax Feeds
|
||||||
|
$.ajax({
|
||||||
|
url: 'ajax.rate.item.php',
|
||||||
|
method: 'post',
|
||||||
|
data: { parent: varParentId, item: varItemId, rating: varRating, classes: varOrigClassName },
|
||||||
|
success: ReloadRating,
|
||||||
|
error: RatingError
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function ReadNameValuePairs(nameValuePair)
|
||||||
|
{
|
||||||
|
var trimspaces = /(\s)+/;
|
||||||
|
var returnData = new Array();
|
||||||
|
var pairs = nameValuePair.split('&');
|
||||||
|
|
||||||
|
for (var i = 0; i < pairs.length; i++) {
|
||||||
|
var pair = pairs[i].split('=');
|
||||||
|
returnData[pair[0].replace(trimspaces, "")] = pair[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ReloadRating(requestObj, jsonObj)
|
||||||
|
{
|
||||||
|
var newlines = /(\r\n|\r|\n)/;
|
||||||
|
var returntext = typeof(requestObj) == 'object' ? requestObj.responseText : requestObj;
|
||||||
|
var returnData = ReadNameValuePairs(returntext.replace(newlines, ""));
|
||||||
|
var elementId = returnData['parent']+"_"+returnData['item'];
|
||||||
|
|
||||||
|
document.getElementById(elementId).className = returnData['classes'];
|
||||||
|
var liObj = document.getElementById(elementId).getElementsByTagName('a');
|
||||||
|
|
||||||
|
for (var i = 0; i < liObj.length; i++)
|
||||||
|
{
|
||||||
|
liObj[i].onclick = function(){};
|
||||||
|
}
|
||||||
|
document.getElementById(returnData['parent']).className = returnData['parentClass'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function RatingError()
|
||||||
|
{
|
||||||
|
|
||||||
|
//alert ("Error");
|
||||||
|
|
||||||
|
}
|
560
site/common/static/js/spellcheck.js
Normal file
@ -0,0 +1,560 @@
|
|||||||
|
/*
|
||||||
|
* =================================================================
|
||||||
|
* Gossamer Mail - enhanced email management system
|
||||||
|
*
|
||||||
|
* Website : http://gossamer-threads.com/
|
||||||
|
* Support : http://gossamer-threads.com/scripts/support/
|
||||||
|
* Revision : $Id: spellcheck.js,v 1.5 2006/11/18 14:22:58 brewt Exp $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2004 Gossamer Threads Inc. All Rights Reserved.
|
||||||
|
* Redistribution in part or in whole strictly prohibited. Please
|
||||||
|
* see LICENSE file for full details.
|
||||||
|
* =================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
function spellCheck(objName) {
|
||||||
|
this.config = {
|
||||||
|
// FIXME remove this?
|
||||||
|
menuWidth : 110, // The width of the misspelled words menu
|
||||||
|
menuMaxRows : 10, // The maximum number of suggestions (maximum is 10)
|
||||||
|
disableElements : [], // An array of html elements which should be disabled in spell check mode
|
||||||
|
addPermission : true, // Whether or not words can be added to the dictionary
|
||||||
|
textCheckButton : '', // Text of the button when in regular mode (uses original value)
|
||||||
|
editorObj : null // The advanced HTML editor object
|
||||||
|
};
|
||||||
|
|
||||||
|
this.lang = {
|
||||||
|
'add' : 'Add...',
|
||||||
|
'edit' : 'Edit...',
|
||||||
|
'delete' : 'Delete',
|
||||||
|
'replaceAll' : 'Replace All',
|
||||||
|
'resume' : 'Resume Compose',
|
||||||
|
'title' : 'Suggested Spellings',
|
||||||
|
'noMisspelled' : 'No words were misspelled.'
|
||||||
|
};
|
||||||
|
|
||||||
|
this.id = {
|
||||||
|
checkContent : 'compose_body',
|
||||||
|
checkFrame : 'spellcheck_frame',
|
||||||
|
checkButton : 'button_spellcheck',
|
||||||
|
checkResult : 'spellcheck_result',
|
||||||
|
menuSuggest : 'spellcheck_suggestions',
|
||||||
|
htmlCompose : 'compose_is_html',
|
||||||
|
extra : [] // Extra input values to pass through (these elements must exist both on the page and spellcheck-inline form)
|
||||||
|
};
|
||||||
|
|
||||||
|
this.name = objName;
|
||||||
|
this.words = [];
|
||||||
|
this.corrections = {};
|
||||||
|
this.selectedIndex = -1;
|
||||||
|
this.loaded = false;
|
||||||
|
this.formLoaded = false;
|
||||||
|
this.misspelled = false;
|
||||||
|
this.replaceAll = false;
|
||||||
|
this.loadingInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.load = function () {
|
||||||
|
if (this.config.editorObj) {
|
||||||
|
var self = this;
|
||||||
|
this.loadingInterval = setInterval(function () { self.init(); }, 250);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.init = function () {
|
||||||
|
if (this.config.editorObj) {
|
||||||
|
if (this.config.editorObj.loaded)
|
||||||
|
clearInterval(this.loadingInterval);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.objects = {
|
||||||
|
checkForm : null,
|
||||||
|
checkContent : document.getElementById(this.id.checkContent),
|
||||||
|
checkFrame : document.getElementById(this.id.checkFrame),
|
||||||
|
checkButton : [],
|
||||||
|
checkResult : document.getElementById(this.id.checkResult),
|
||||||
|
menuSuggest : document.getElementById(this.id.menuSuggest)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (typeof this.id.checkButton == 'string')
|
||||||
|
this.objects.checkButton.push(document.getElementById(this.id.checkButton));
|
||||||
|
else
|
||||||
|
for (var i = 0; i < this.id.checkButton.length; i++)
|
||||||
|
this.objects.checkButton.push(document.getElementById(this.id.checkButton[i]));
|
||||||
|
|
||||||
|
if (!this.objects.menuSuggest) {
|
||||||
|
this.objects.menuSuggest = document.createElement('div');
|
||||||
|
this.objects.menuSuggest.id = this.id.menuSuggest;
|
||||||
|
this.objects.menuSuggest.style.display = 'none';
|
||||||
|
document.body.appendChild(this.objects.menuSuggest);
|
||||||
|
}
|
||||||
|
if (!this.objects.checkResult) {
|
||||||
|
this.objects.checkResult = document.createElement('div');
|
||||||
|
this.objects.checkResult.id = this.id.checkResult;
|
||||||
|
this.objects.checkResult.style.display = 'none';
|
||||||
|
document.body.appendChild(this.objects.checkResult);
|
||||||
|
}
|
||||||
|
if (!this.objects.checkContent) return;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
for (var i = 0; i < this.objects.checkButton.length; i++)
|
||||||
|
registerEvent(this.objects.checkButton[i], 'click', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
|
||||||
|
if (self.formLoaded) {
|
||||||
|
if (self.objects.checkResult.style.display == 'none')
|
||||||
|
self.prepareCheck();
|
||||||
|
else
|
||||||
|
self.resumeCompose();
|
||||||
|
}
|
||||||
|
|
||||||
|
cancelEvent(e);
|
||||||
|
stopPropagation(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
// This handler should only be called on a click on everything but the misspelled
|
||||||
|
// words, edit_word input, and the menu.
|
||||||
|
registerEvent(document, 'click', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
|
||||||
|
// FIXME this should call dMenuObj.hide();
|
||||||
|
if (self.objects.menuSuggest.style.display != 'none')
|
||||||
|
self.objects.menuSuggest.style.display = 'none';
|
||||||
|
|
||||||
|
self.checkEditWord();
|
||||||
|
});
|
||||||
|
|
||||||
|
registerEvent(window, 'resize', function () {
|
||||||
|
if (self.objects.checkResult.style.display != 'none')
|
||||||
|
self.showCheckResult();
|
||||||
|
});
|
||||||
|
|
||||||
|
this.loaded = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
spellCheck.prototype.prepareCheck = function () {
|
||||||
|
this.objects.checkForm.elements.content.value = this.config.editorObj ? this.config.editorObj.getContent(true) : this.objects.checkContent.value;
|
||||||
|
if (this.objects.checkForm.elements.content.value == '') {
|
||||||
|
alert(this.lang.noMisspelled);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var html = document.getElementById(this.id.htmlCompose);
|
||||||
|
if (this.objects.checkForm.elements[this.id.htmlCompose])
|
||||||
|
this.objects.checkForm.elements[this.id.htmlCompose].value = html ? html.value : 0;
|
||||||
|
|
||||||
|
for (var i = 0; i < this.id.extra.length; i++) {
|
||||||
|
var sourceObj = document.getElementById(this.id.extra[i]);
|
||||||
|
var destObj = this.objects.checkForm[this.id.extra[i]];
|
||||||
|
if (sourceObj && destObj) destObj.value = sourceObj.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.objects.checkForm.submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.resumeCompose = function () {
|
||||||
|
var content = '';
|
||||||
|
for (var i = 0; i < this.words.length; i++)
|
||||||
|
content += this.words[i].word;
|
||||||
|
if (this.config.editorObj)
|
||||||
|
content = content.replace(/<a dhref=/g, '<a href=');
|
||||||
|
|
||||||
|
if (this.config.editorObj)
|
||||||
|
this.config.editorObj.setContent(content);
|
||||||
|
else
|
||||||
|
this.objects.checkContent.value = content;
|
||||||
|
|
||||||
|
this.objects.menuSuggest.style.display = 'none';
|
||||||
|
this.hideCheckResult();
|
||||||
|
|
||||||
|
if (this.config.editorObj) {
|
||||||
|
this.config.editorObj.enable();
|
||||||
|
this.config.editorObj.focus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this.objects.checkContent.focus();
|
||||||
|
|
||||||
|
for (var i = 0; i < this.objects.checkButton.length; i++)
|
||||||
|
this.objects.checkButton[i].value = this.config.textCheckButton;
|
||||||
|
this.disableElementsEnable(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.processCheck = function () {
|
||||||
|
var self = this;
|
||||||
|
if (this.words.length == 0 || !this.misspelled) {
|
||||||
|
alert(this.lang.noMisspelled);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.config.editorObj)
|
||||||
|
this.config.editorObj.disable();
|
||||||
|
|
||||||
|
var content = '';
|
||||||
|
for (var i = 0; i < this.words.length; i++) {
|
||||||
|
if (!this.words[i].misspelled)
|
||||||
|
content += this.config.editorObj ? this.words[i].word : htmlEscape(this.words[i].word).replace(/\n/g, '<br>').replace(/ /g, ' ');
|
||||||
|
else
|
||||||
|
content += '<span id="msw_' + i + '">' + this.words[i].word + '</span>';
|
||||||
|
}
|
||||||
|
if (this.config.editorObj)
|
||||||
|
cmntent = content.replace(/<a href=/gi, '<a dhref=');
|
||||||
|
else
|
||||||
|
content = '<span class="pre">' + content + '</span>';
|
||||||
|
this.objects.checkResult.innerHTML = content;
|
||||||
|
for (var i = 0; i < this.words.length; i++) {
|
||||||
|
if (!this.words[i].misspelled)
|
||||||
|
continue;
|
||||||
|
var msw = document.getElementById('msw_' + i);
|
||||||
|
msw.title = this.lang.title;
|
||||||
|
msw.className = 'misspelled';
|
||||||
|
registerEvent(msw, 'click', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
var targ = e.target ? e.target : e.srcElement;
|
||||||
|
if (targ.nodeType == 3) // defeat Safari bug
|
||||||
|
targ = targ.parentNode;
|
||||||
|
|
||||||
|
self.checkEditWord();
|
||||||
|
|
||||||
|
self.selectedIndex = parseInt(targ.id.replace(/^msw_/, ''));
|
||||||
|
var suggest = new dMenu(self, self.corrections[self.words[self.selectedIndex].oword.toLowerCase()]);
|
||||||
|
var selected = document.getElementById('msw_' + self.selectedIndex);
|
||||||
|
|
||||||
|
var posY = findPosY(selected) + selected.offsetHeight + 1 - self.objects.checkResult.scrollTop;
|
||||||
|
var posX = findPosX(selected);
|
||||||
|
suggest.show(posX, posY);
|
||||||
|
|
||||||
|
stopPropagation(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.showCheckResult();
|
||||||
|
|
||||||
|
if (!this.config.textCheckButton)
|
||||||
|
this.config.textCheckButton = this.objects.checkButton[0].value;
|
||||||
|
for (var i = 0; i < this.objects.checkButton.length; i++)
|
||||||
|
this.objects.checkButton[i].value = this.lang.resume;
|
||||||
|
this.disableElementsEnable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.disableElementsEnable = function (flag) {
|
||||||
|
for (var i = 0; i < this.config.disableElements.length; i++) {
|
||||||
|
var element = document.getElementById(this.config.disableElements[i]);
|
||||||
|
if (!element)
|
||||||
|
continue;
|
||||||
|
if (element.tagName == 'INPUT')
|
||||||
|
element.disabled = !flag;
|
||||||
|
else
|
||||||
|
element.style.visibility = flag ? 'visible' : 'hidden';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.showCheckResult = function () {
|
||||||
|
var width, height, left, top;
|
||||||
|
if (this.config.editorObj) {
|
||||||
|
width = this.config.editorObj.objects.editableFrame.offsetWidth -
|
||||||
|
getStyleLength(this.config.editorObj.objects.editableFrame, 'border-left-width') -
|
||||||
|
getStyleLength(this.config.editorObj.objects.editableFrame, 'border-right-width');
|
||||||
|
height = this.config.editorObj.objects.editableFrame.offsetHeight -
|
||||||
|
getStyleLength(this.config.editorObj.objects.editableFrame, 'border-top-width') -
|
||||||
|
getStyleLength(this.config.editorObj.objects.editableFrame, 'border-bottom-width');
|
||||||
|
left = findPosX(this.config.editorObj.objects.editorFrame) + findPosX(this.config.editorObj.objects.editableFrame) +
|
||||||
|
getStyleLength(this.config.editorObj.objects.editorFrame, 'border-left-width');
|
||||||
|
top = findPosY(this.config.editorObj.objects.editorFrame) + findPosY(this.config.editorObj.objects.editableFrame) +
|
||||||
|
getStyleLength(this.config.editorObj.objects.editorFrame, 'border-top-width');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
width = this.objects.checkContent.offsetWidth -
|
||||||
|
getStyleLength(this.objects.checkContent, 'border-left-width') -
|
||||||
|
getStyleLength(this.objects.checkContent, 'border-right-width');
|
||||||
|
height = this.objects.checkContent.offsetHeight -
|
||||||
|
getStyleLength(this.objects.checkContent, 'border-top-width') -
|
||||||
|
getStyleLength(this.objects.checkContent, 'border-bottom-width');
|
||||||
|
left = findPosX(this.objects.checkContent) + getStyleLength(this.objects.checkContent, 'border-left-width');
|
||||||
|
top = findPosY(this.objects.checkContent) + getStyleLength(this.objects.checkContent, 'border-top-width');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.objects.checkResult.style.top = top + 'px';
|
||||||
|
this.objects.checkResult.style.left = left + 'px';
|
||||||
|
// set display: block before width and height because in Safari, you can't get current styles of hidden elements
|
||||||
|
this.objects.checkResult.style.display = '';
|
||||||
|
|
||||||
|
this.objects.checkResult.style.width = calcCSSWidth(this.objects.checkResult, width);
|
||||||
|
this.objects.checkResult.style.height = calcCSSHeight(this.objects.checkResult, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.hideCheckResult = function () {
|
||||||
|
this.objects.checkResult.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
spellCheck.prototype.checkEditWord = function () {
|
||||||
|
var edit_word = document.getElementById('edit_word');
|
||||||
|
if (edit_word) {
|
||||||
|
var suggest = new dMenu(this, this.corrections[this.words[edit_word.name].oword.toLowerCase()]);
|
||||||
|
suggest.updateWord(13);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function dMenu(spellcheck, corrections) {
|
||||||
|
var oMenu = spellcheck.objects.menuSuggest;
|
||||||
|
while (oMenu.hasChildNodes())
|
||||||
|
oMenu.removeChild(oMenu.firstChild);
|
||||||
|
|
||||||
|
this.object = oMenu;
|
||||||
|
this.corrections = corrections;
|
||||||
|
this.spellcheck = spellcheck;
|
||||||
|
if (corrections.length < 0) return;
|
||||||
|
|
||||||
|
var menu_rows = corrections.length > spellcheck.config.menuMaxRows ? spellcheck.config.menuMaxRows : corrections.length;
|
||||||
|
for (var i = 0; i < menu_rows; i++)
|
||||||
|
this.addNode('menu_' + i, corrections[i]);
|
||||||
|
var actions = [['hr', '', '<hr />'], ['add', 'wordAdd', spellcheck.lang.add], ['edit', 'wordEdit', spellcheck.lang.edit], ['delete', 'wordEdit', spellcheck.lang['delete']], ['option', 'wordOption', '<span id="replace_all">' + spellcheck.lang.replaceAll + '</span>']];
|
||||||
|
menu_rows += actions.length;
|
||||||
|
|
||||||
|
var new_word = this.newWord();
|
||||||
|
for (var i = 0; i < actions.length; i++) {
|
||||||
|
if (actions[i][0] == 'add' && (this.spellcheck.config.addPermission == false || !new_word)) {
|
||||||
|
menu_rows--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
this.addNode(actions[i][0], actions[i][2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
oMenu.style.width = spellcheck.config.menuWidth + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.show = function (posX, posY) {
|
||||||
|
this.object.style.left = posX + 'px';
|
||||||
|
this.object.style.top = posY + 'px';
|
||||||
|
|
||||||
|
if (this.spellcheck.replaceAll && document.getElementById('replace_all'))
|
||||||
|
document.getElementById('replace_all').className = 'replace_all';
|
||||||
|
this.object.style.display = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.hide = function () {
|
||||||
|
this.object.style.display = 'none';
|
||||||
|
|
||||||
|
if (document.getElementById('replace_all'))
|
||||||
|
document.getElementById('replace_all').className = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.addNode = function (name, text) {
|
||||||
|
var oNode = document.createElement('div');
|
||||||
|
// FIXME text may contain html
|
||||||
|
oNode.innerHTML = text;
|
||||||
|
if (name != 'hr') {
|
||||||
|
oNode.id = name;
|
||||||
|
oNode.className = 'menu-item';
|
||||||
|
oNode.setAttribute('unselectable', 'on');
|
||||||
|
if (oNode.offsetWidth > this.spellcheck.config.menuWidth)
|
||||||
|
this.spellcheck.config.menuWidth = oNode.offsetWidth + 'px';
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
registerEvent(oNode, 'mouseover', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
var targ = e.target ? e.target : e.srcElement;
|
||||||
|
if (targ.nodeType == 3) // defeat Safari bug
|
||||||
|
targ = targ.parentNode;
|
||||||
|
// The target when clicking on "Replace All" will be the span
|
||||||
|
if (targ.tagName == 'SPAN')
|
||||||
|
targ = targ.parentNode;
|
||||||
|
targ.className = 'menu-item mouseover';
|
||||||
|
});
|
||||||
|
registerEvent(oNode, 'mouseout', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
var targ = e.target ? e.target : e.srcElement;
|
||||||
|
if (targ.nodeType == 3)
|
||||||
|
targ = targ.parentNode;
|
||||||
|
if (targ.tagName == 'SPAN')
|
||||||
|
targ = targ.parentNode;
|
||||||
|
targ.className = 'menu-item';
|
||||||
|
});
|
||||||
|
registerEvent(oNode, 'click', function (e) {
|
||||||
|
if (!e) e = window.event;
|
||||||
|
var targ = e.target ? e.target : e.srcElement;
|
||||||
|
if (targ.nodeType == 3)
|
||||||
|
targ = targ.parentNode;
|
||||||
|
if (targ.tagName == 'SPAN')
|
||||||
|
targ = targ.parentNode;
|
||||||
|
|
||||||
|
if (targ.id == 'add')
|
||||||
|
self.addWord();
|
||||||
|
else if (targ.id == 'edit')
|
||||||
|
self.editWord();
|
||||||
|
else if (targ.id == 'delete')
|
||||||
|
self.deleteWord();
|
||||||
|
else if (targ.id == 'option')
|
||||||
|
self.setOption();
|
||||||
|
else
|
||||||
|
self.replaceWord(targ.firstChild.nodeValue);
|
||||||
|
stopPropagation(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.object.appendChild(oNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.addWord = function () {
|
||||||
|
this.hide();
|
||||||
|
if (!this.spellcheck.words[this.spellcheck.selectedIndex].misspelled) return;
|
||||||
|
if (!this.spellcheck.config.addPermission) {
|
||||||
|
alert("You cannot add words to the dictionary.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var selected = document.getElementById('msw_' + this.spellcheck.selectedIndex);
|
||||||
|
if (!selected) return;
|
||||||
|
|
||||||
|
var word = this.spellcheck.words[this.spellcheck.selectedIndex].word;
|
||||||
|
if (confirm("Are you sure you want to add '" + word + "' to the dictionary?")) {
|
||||||
|
this.spellcheck.objects.checkForm.elements['do'].value = 'add_word';
|
||||||
|
this.spellcheck.objects.checkForm.elements.content.value = word;
|
||||||
|
this.spellcheck.objects.checkForm.submit();
|
||||||
|
selected.className = 'misspelled updated';
|
||||||
|
for (var i = 0; i < this.spellcheck.words.length; i++) {
|
||||||
|
if (i != this.spellcheck.selectedIndex && this.spellcheck.words[i].misspelled && this.spellcheck.words[i].word.toLowerCase() == word.toLowerCase()) {
|
||||||
|
var w = document.getElementById('msw_' + i);
|
||||||
|
w.className = 'misspelled updated';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var new_words = [word];
|
||||||
|
this.spellcheck.corrections[this.spellcheck.words[this.spellcheck.selectedIndex].oword.toLowerCase()] = new_words.concat(this.spellcheck.corrections[this.spellcheck.words[this.spellcheck.selectedIndex].oword.toLowerCase()]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.editWord = function () {
|
||||||
|
this.hide();
|
||||||
|
var selected = document.getElementById('msw_' + this.spellcheck.selectedIndex);
|
||||||
|
if (!selected) return;
|
||||||
|
|
||||||
|
var word = selected.firstChild.nodeValue;
|
||||||
|
|
||||||
|
var edit_word = document.createElement('input');
|
||||||
|
edit_word.id = 'edit_word';
|
||||||
|
edit_word.name = this.spellcheck.selectedIndex;
|
||||||
|
edit_word.value = word;
|
||||||
|
edit_word.size = word.length + 5;
|
||||||
|
edit_word.className = 'text';
|
||||||
|
|
||||||
|
selected.replaceChild(edit_word, selected.firstChild);
|
||||||
|
|
||||||
|
var self = this;
|
||||||
|
registerEvent(edit_word, 'keyup', function (e) {
|
||||||
|
if (!e) e = window.e;
|
||||||
|
self.updateWord(e.keyCode);
|
||||||
|
});
|
||||||
|
// Prevent the click event from propagating to the msw_* span (which shows the suggestions)
|
||||||
|
registerEvent(edit_word, 'click', function (e) {
|
||||||
|
if (!e) e = window.e;
|
||||||
|
stopPropagation(e);
|
||||||
|
});
|
||||||
|
edit_word.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.updateWord = function (code) {
|
||||||
|
var selected = document.getElementById('msw_' + this.spellcheck.selectedIndex);
|
||||||
|
var edit_word = document.getElementById('edit_word');
|
||||||
|
if (!edit_word) return;
|
||||||
|
|
||||||
|
if (code == 27) // esc
|
||||||
|
selected.replaceChild(document.createTextNode(this.spellcheck.words[this.spellcheck.selectedIndex].word), selected.firstChild);
|
||||||
|
else if (code == 13) { // enter
|
||||||
|
if (this.spellcheck.words[this.spellcheck.selectedIndex].word != edit_word.value) {
|
||||||
|
this.spellcheck.words[this.spellcheck.selectedIndex].word = edit_word.value;
|
||||||
|
selected.className = 'misspelled updated';
|
||||||
|
}
|
||||||
|
selected.replaceChild(document.createTextNode(edit_word.value), selected.firstChild);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.replaceWord = function (new_word) {
|
||||||
|
this.hide();
|
||||||
|
|
||||||
|
if (typeof(this.spellcheck.selectedIndex) == 'undefined' || typeof(new_word) == 'undefined') return;
|
||||||
|
if (this.corrections.length == 0) return;
|
||||||
|
|
||||||
|
var selected = document.getElementById('msw_' + this.spellcheck.selectedIndex);
|
||||||
|
if (!selected) return;
|
||||||
|
|
||||||
|
var format = this.getFormat(this.spellcheck.words[this.spellcheck.selectedIndex].word);
|
||||||
|
new_word = this.setFormat(format, new_word);
|
||||||
|
if (new_word) {
|
||||||
|
var old_word = this.spellcheck.words[this.spellcheck.selectedIndex].word;
|
||||||
|
this.spellcheck.words[this.spellcheck.selectedIndex].word = new_word;
|
||||||
|
selected.replaceChild(document.createTextNode(new_word), selected.firstChild);
|
||||||
|
selected.className = 'misspelled updated';
|
||||||
|
if (this.spellcheck.replaceAll) {
|
||||||
|
// Update all other words that match with added word
|
||||||
|
for (var i = 0; i < this.spellcheck.words.length; i++) {
|
||||||
|
if (i != this.spellcheck.selectedIndex && this.spellcheck.words[i].misspelled && this.spellcheck.words[i].word.toLowerCase() == old_word.toLowerCase()) {
|
||||||
|
var w = document.getElementById('msw_' + i);
|
||||||
|
var f = this.getFormat(this.spellcheck.words[i].word);
|
||||||
|
var n = this.setFormat(f, new_word);
|
||||||
|
this.spellcheck.words[i].word = n;
|
||||||
|
w.replaceChild(document.createTextNode(n), w.firstChild);
|
||||||
|
w.className = 'misspelled updated';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.deleteWord = function () {
|
||||||
|
this.hide();
|
||||||
|
var selected = document.getElementById('msw_' + this.spellcheck.selectedIndex);
|
||||||
|
if (!selected) return;
|
||||||
|
|
||||||
|
if (confirm("Are you sure you want to delete '" + this.spellcheck.words[this.spellcheck.selectedIndex].word + "'?")) {
|
||||||
|
this.spellcheck.words[this.spellcheck.selectedIndex].word = '';
|
||||||
|
selected.parentNode.removeChild(selected);
|
||||||
|
// Delete the next 'word' if it's a single space
|
||||||
|
var next_word = this.spellcheck.selectedIndex + 1;
|
||||||
|
if (this.spellcheck.words.length > next_word && this.spellcheck.words[next_word].word == ' ')
|
||||||
|
this.spellcheck.words[next_word].word = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.getFormat = function (word) {
|
||||||
|
if (word == '') return 3;
|
||||||
|
|
||||||
|
if (word == word.toUpperCase()) return 1;
|
||||||
|
else if (word.substr(0, 1) == word.substr(0, 1).toUpperCase()) return 2;
|
||||||
|
else return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.setFormat = function (format, word) {
|
||||||
|
if (format == 1) return word.toUpperCase();
|
||||||
|
else if (format == 2) return word.substr(0, 1).toUpperCase() + word.substr(1).toLowerCase();
|
||||||
|
else return word.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.setOption = function () {
|
||||||
|
if (this.spellcheck.replaceAll) {
|
||||||
|
this.spellcheck.replaceAll = false;
|
||||||
|
document.getElementById('replace_all').className = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.spellcheck.replaceAll = true;
|
||||||
|
document.getElementById('replace_all').className = 'replace_all';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dMenu.prototype.newWord = function () {
|
||||||
|
var spellcheck = this.spellcheck;
|
||||||
|
if (spellcheck.config.selectedIndex == -1 || spellcheck.config.selectedIndex > spellcheck.words.length || !spellcheck.words[spellcheck.selectedIndex].misspelled) return false;
|
||||||
|
|
||||||
|
var words = spellcheck.corrections[spellcheck.words[spellcheck.selectedIndex].oword.toLowerCase()];
|
||||||
|
var current = document.getElementById('msw_' + spellcheck.selectedIndex);
|
||||||
|
if (!current || words.length == 0) return false;
|
||||||
|
|
||||||
|
var word = spellcheck.words[spellcheck.selectedIndex].word;
|
||||||
|
if (word == '') return false;
|
||||||
|
|
||||||
|
for (var i = 0; i < words.length; i++)
|
||||||
|
if (words[i].toLowerCase() == word.toLowerCase())
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
16
site/common/static/js/swiper.min.js
vendored
Normal file
340
site/common/static/js/utils.js
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
/*
|
||||||
|
* =================================================================
|
||||||
|
* Gossamer Forum - Advanced web community
|
||||||
|
*
|
||||||
|
* Website : http://gossamer-threads.com/
|
||||||
|
* Support : http://gossamer-threads.com/scripts/support/
|
||||||
|
* Revision : $Id: utils.js,v 1.14 2009/04/23 23:12:10 brewt Exp $
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 Gossamer Threads Inc. All Rights Reserved.
|
||||||
|
* Redistribution in part or in whole strictly prohibited. Please
|
||||||
|
* see LICENSE file for full details.
|
||||||
|
* =================================================================
|
||||||
|
*
|
||||||
|
* NOTE: Please do not use the functions contained in this file. Use jQuery
|
||||||
|
* equivalents instead. This should only be used by the spellchecker and
|
||||||
|
* advanced editor.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Event Handler
|
||||||
|
=============
|
||||||
|
Description:
|
||||||
|
A cross-browser event handler.
|
||||||
|
Usage:
|
||||||
|
registerEvent(<html_object>, <event>, <handler>);
|
||||||
|
unregisterEvent(<html_object>, <event>, <handler>);
|
||||||
|
Example:
|
||||||
|
registerEvent(window, 'load', myhandler);
|
||||||
|
Notes:
|
||||||
|
html_object is a html object that you wish to register the event on.
|
||||||
|
event is a string containing the event you wish to register, eg. 'load'.
|
||||||
|
handler is a function reference for the code you wish to run when the
|
||||||
|
event is fired.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function registerEvent(obj, evt, handler) {
|
||||||
|
if (!(obj && evt && handler))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (obj.addEventListener)
|
||||||
|
obj.addEventListener(evt, handler, false);
|
||||||
|
else if (obj.attachEvent)
|
||||||
|
obj.attachEvent('on' + evt, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unregisterEvent(obj, evt, handler) {
|
||||||
|
if (!(obj && evt && handler))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (obj.removeEventListener) {
|
||||||
|
try { obj.removeEventListener(evt, handler, false); } catch (e) {};
|
||||||
|
}
|
||||||
|
else if (obj.detachEvent) {
|
||||||
|
try { obj.detachEvent('on' + evt, handler); } catch (e) {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopPropagation(evt) {
|
||||||
|
if (!evt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (evt.stopPropagation)
|
||||||
|
evt.stopPropagation();
|
||||||
|
else
|
||||||
|
evt.cancelBubble = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function cancelEvent(evt) {
|
||||||
|
if (!evt)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (evt.preventDefault && evt.cancelable)
|
||||||
|
evt.preventDefault();
|
||||||
|
else
|
||||||
|
evt.returnValue = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Find Element Position
|
||||||
|
=====================
|
||||||
|
Description:
|
||||||
|
Find the position of an element.
|
||||||
|
http://www.quirksmode.org/js/findpos.html
|
||||||
|
Usage:
|
||||||
|
findPosX(<element>);
|
||||||
|
findPosY(<element>);
|
||||||
|
*/
|
||||||
|
|
||||||
|
function findPosX(obj) {
|
||||||
|
var curleft = 0;
|
||||||
|
if (obj.offsetParent)
|
||||||
|
while (obj.offsetParent) {
|
||||||
|
curleft += obj.offsetLeft
|
||||||
|
obj = obj.offsetParent;
|
||||||
|
}
|
||||||
|
else if (obj.x)
|
||||||
|
curleft += obj.x;
|
||||||
|
return curleft;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findPosY(obj) {
|
||||||
|
var curtop = 0;
|
||||||
|
if (obj.offsetParent)
|
||||||
|
while (obj.offsetParent) {
|
||||||
|
curtop += obj.offsetTop
|
||||||
|
obj = obj.offsetParent;
|
||||||
|
}
|
||||||
|
else if (obj.y)
|
||||||
|
curtop += obj.y;
|
||||||
|
return curtop;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStyle(obj, property) {
|
||||||
|
if (document.defaultView && document.defaultView.getComputedStyle) {
|
||||||
|
// Safari can return undefined if the element is display: none
|
||||||
|
var style = document.defaultView.getComputedStyle(obj, null);
|
||||||
|
if (style)
|
||||||
|
return style.getPropertyValue(property);
|
||||||
|
}
|
||||||
|
else if (obj.currentStyle) {
|
||||||
|
property = property.replace(/-(.)/g, function (str, p1) { return p1.toUpperCase() });
|
||||||
|
return obj.currentStyle[property];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note that this will only return pixel lengths. Only Mozilla and Opera always return pixel units for lengths.
|
||||||
|
function getStyleLength(obj, property) {
|
||||||
|
var length = getStyle(obj, property);
|
||||||
|
if (length.match(/^\d+(?:\.\d+)?px$/))
|
||||||
|
return parseFloat(length);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function calcCSSWidth(obj, width) {
|
||||||
|
if (isIE && ieVersion <= 5.5)
|
||||||
|
return width + 'px';
|
||||||
|
return width -
|
||||||
|
getStyleLength(obj, 'padding-left') -
|
||||||
|
getStyleLength(obj, 'padding-right') -
|
||||||
|
getStyleLength(obj, 'border-left-width') -
|
||||||
|
getStyleLength(obj, 'border-right-width') + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
function calcCSSHeight(obj, height) {
|
||||||
|
if (isIE && ieVersion <= 5.5)
|
||||||
|
return height + 'px';
|
||||||
|
return height -
|
||||||
|
getStyleLength(obj, 'padding-top') -
|
||||||
|
getStyleLength(obj, 'padding-bottom') -
|
||||||
|
getStyleLength(obj, 'border-bottom-width') -
|
||||||
|
getStyleLength(obj, 'border-bottom-width') + 'px';
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
HTML Escape/Unescape
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
|
||||||
|
function htmlEscape(text) {
|
||||||
|
return text.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
||||||
|
}
|
||||||
|
|
||||||
|
function htmlUnEscape(text) {
|
||||||
|
return text.replace(/"/gi, '"').replace(/>/gi, '>').replace(/</gi, '<').replace(/&/gi, '&');
|
||||||
|
}
|
||||||
|
|
||||||
|
var isOpera = false;
|
||||||
|
var operaVersion;
|
||||||
|
var isIE = false;
|
||||||
|
var ieVersion;
|
||||||
|
var isMozilla = false;
|
||||||
|
var mozillaVersion;
|
||||||
|
var isWebkit = false;
|
||||||
|
var webkitVersion;
|
||||||
|
var isChrome = false;
|
||||||
|
var chromeVersion;
|
||||||
|
var isSafari = false;
|
||||||
|
var safariVersion;
|
||||||
|
|
||||||
|
var ua = navigator.userAgent;
|
||||||
|
// http://opera.com/support/search/supsearch.dml?index=570
|
||||||
|
if (ua.match(/Opera(?:\s+|\/)([0-9.]+)/i)) {
|
||||||
|
isOpera = true;
|
||||||
|
operaVersion = RegExp.$1;
|
||||||
|
}
|
||||||
|
else if (ua.match(/MSIE\s+([0-9.]+)/i)) {
|
||||||
|
isIE = true;
|
||||||
|
ieVersion = RegExp.$1;
|
||||||
|
}
|
||||||
|
else if (ua.match(/Mozilla\/([0-9.]+)\s+\(.*\s+rv:([0-9.]+)/i)) {
|
||||||
|
isMozilla = true;
|
||||||
|
mozillaVersion = RegExp.$2;
|
||||||
|
}
|
||||||
|
// http://developer.apple.com/internet/safari/uamatrix.html
|
||||||
|
else if (ua.match(/AppleWebKit\/([0-9.]+)/i)) {
|
||||||
|
isWebkit = true;
|
||||||
|
webkitVersion = RegExp.$1;
|
||||||
|
if (ua.match(/Chrome\/([0-9.]+)/i)) {
|
||||||
|
isChrome = true;
|
||||||
|
chromeVersion = RegExp.$1;
|
||||||
|
}
|
||||||
|
else if (ua.match(/Version\/([0-9.]+)/i)) {
|
||||||
|
isSafari = true;
|
||||||
|
safariVersion = RegExp.$1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Appends various hidden values to and submits a form. Takes the form element
|
||||||
|
* and an array of param => value pairs, and submits the form.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var _submitForm_Div;
|
||||||
|
function submitForm (form, params) {
|
||||||
|
if (_submitForm_Div)
|
||||||
|
_submitForm_Div.parentNode.removeChild(_submitForm_Div);
|
||||||
|
_submitForm_Div = document.createElement('div');
|
||||||
|
_submitForm_Div.id = '_submitForm_Div';
|
||||||
|
_submitForm_Div.style.display = 'none';
|
||||||
|
form.appendChild(_submitForm_Div);
|
||||||
|
var i, hidden;
|
||||||
|
for (i = 0; i < params.length; i += 2) {
|
||||||
|
hidden = document.createElement('input');
|
||||||
|
hidden.type = 'hidden';
|
||||||
|
hidden.name = params[i];
|
||||||
|
hidden.value = params[i+1];
|
||||||
|
_submitForm_Div.appendChild(hidden);
|
||||||
|
}
|
||||||
|
var submit = document.createElement('input');
|
||||||
|
submit.type = 'submit';
|
||||||
|
_submitForm_Div.appendChild(submit);
|
||||||
|
submit.click();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* XMLHttpRequest wrapper - takes a url, method (e.g. 'GET'), body (i.e. for a
|
||||||
|
* POST request), success function and failure function. The functions will be
|
||||||
|
* called with the XMLHttpRequest object as argument.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function xmlReqSend (url, method, content, onsuccess, onfailure) {
|
||||||
|
var req;
|
||||||
|
if (!method) method = "GET";
|
||||||
|
else method = method.toUpperCase();
|
||||||
|
if (method != "GET" && method != "POST" && method != "HEAD") method = "GET";
|
||||||
|
|
||||||
|
if (window.XMLHttpRequest)
|
||||||
|
req = new XMLHttpRequest();
|
||||||
|
else if (window.ActiveXObject) {
|
||||||
|
try {
|
||||||
|
req = new ActiveXObject('Msxml2.XMLHTTP');
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
try {
|
||||||
|
req = new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
req = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (req) {
|
||||||
|
req.onreadystatechange = function () { _xmlReqChange(req, onsuccess, onfailure); };
|
||||||
|
url = url.replace(/^https?:\/\/[^\/]+\//, '/');
|
||||||
|
req.open(method, url, true);
|
||||||
|
req.send(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _xmlReqChange (req, success, failure) {
|
||||||
|
if (req.readyState == 4) {
|
||||||
|
if (req.status == 200) {
|
||||||
|
if (success) success(req);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (failure) failure(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function insertText(element, text) {
|
||||||
|
if (element.setSelectionRange) {
|
||||||
|
var start = element.selectionStart;
|
||||||
|
var end = element.selectionEnd;
|
||||||
|
element.value = element.value.substr(0, start) + text + element.value.substr(end, element.value.length);
|
||||||
|
// Set the caret to be right after the text that was just inserted.
|
||||||
|
start += text.length;
|
||||||
|
setSelectionRange(element, start, start);
|
||||||
|
}
|
||||||
|
else if (document.selection) {
|
||||||
|
element.focus();
|
||||||
|
var range = document.selection.createRange();
|
||||||
|
if (range.parentElement() != element)
|
||||||
|
return;
|
||||||
|
range.text = text;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
element.value += text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapText(element, pre_text, post_text) {
|
||||||
|
if (element.setSelectionRange) {
|
||||||
|
var start = element.selectionStart;
|
||||||
|
var end = element.selectionEnd;
|
||||||
|
element.value = element.value.substr(0, start) + pre_text + element.value.substr(start, end - start) + post_text + element.value.substr(end, element.value.length);
|
||||||
|
setSelectionRange(element, start + pre_text.length, end + pre_text.length);
|
||||||
|
}
|
||||||
|
else if (document.selection) {
|
||||||
|
element.focus();
|
||||||
|
var range = document.selection.createRange();
|
||||||
|
if (range.parentElement() != element)
|
||||||
|
return;
|
||||||
|
var len = range.text.length;
|
||||||
|
range.text = pre_text + range.text + post_text;
|
||||||
|
range.moveEnd('character', -post_text.length);
|
||||||
|
range.moveStart('character', -len);
|
||||||
|
range.select();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
element.value += pre_text + post_text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setSelectionRange(element, start, end) {
|
||||||
|
if (element.setSelectionRange) {
|
||||||
|
element.focus();
|
||||||
|
element.setSelectionRange(start, end);
|
||||||
|
}
|
||||||
|
else if (element.createTextRange) {
|
||||||
|
var range = element.createTextRange();
|
||||||
|
range.collapse(true);
|
||||||
|
range.moveEnd('character', end);
|
||||||
|
range.moveStart('character', start);
|
||||||
|
range.select();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
11
site/common/static/js/utils.min.js
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
function registerEvent(a,b,c){if(a&&b&&c)if(a.addEventListener)a.addEventListener(b,c,false);else a.attachEvent&&a.attachEvent("on"+b,c)}function unregisterEvent(a,b,c){if(a&&b&&c)if(a.removeEventListener)try{a.removeEventListener(b,c,false)}catch(d){}else if(a.detachEvent)try{a.detachEvent("on"+b,c)}catch(f){}}function stopPropagation(a){if(a)if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true}
|
||||||
|
function cancelEvent(a){if(a)if(a.preventDefault&&a.cancelable)a.preventDefault();else a.returnValue=false}function findPosX(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetLeft;a=a.offsetParent}else if(a.x)b+=a.x;return b}function findPosY(a){var b=0;if(a.offsetParent)for(;a.offsetParent;){b+=a.offsetTop;a=a.offsetParent}else if(a.y)b+=a.y;return b}
|
||||||
|
function getStyle(a,b){if(document.defaultView&&document.defaultView.getComputedStyle){if(a=document.defaultView.getComputedStyle(a,null))return a.getPropertyValue(b)}else if(a.currentStyle){b=b.replace(/-(.)/g,function(c,d){return d.toUpperCase()});return a.currentStyle[b]}}function getStyleLength(a,b){a=getStyle(a,b);if(a.match(/^\d+(?:\.\d+)?px$/))return parseFloat(a);return 0}
|
||||||
|
function calcCSSWidth(a,b){if(isIE&&ieVersion<=5.5)return b+"px";return b-getStyleLength(a,"padding-left")-getStyleLength(a,"padding-right")-getStyleLength(a,"border-left-width")-getStyleLength(a,"border-right-width")+"px"}function calcCSSHeight(a,b){if(isIE&&ieVersion<=5.5)return b+"px";return b-getStyleLength(a,"padding-top")-getStyleLength(a,"padding-bottom")-getStyleLength(a,"border-bottom-width")-getStyleLength(a,"border-bottom-width")+"px"}
|
||||||
|
function htmlEscape(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function htmlUnEscape(a){return a.replace(/"/gi,'"').replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&")}var isOpera=false,operaVersion,isIE=false,ieVersion,isMozilla=false,mozillaVersion,isWebkit=false,webkitVersion,isChrome=false,chromeVersion,isSafari=false,safariVersion,ua=navigator.userAgent;
|
||||||
|
if(ua.match(/Opera(?:\s+|\/)([0-9.]+)/i)){isOpera=true;operaVersion=RegExp.$1}else if(ua.match(/MSIE\s+([0-9.]+)/i)){isIE=true;ieVersion=RegExp.$1}else if(ua.match(/Mozilla\/([0-9.]+)\s+\(.*\s+rv:([0-9.]+)/i)){isMozilla=true;mozillaVersion=RegExp.$2}else if(ua.match(/AppleWebKit\/([0-9.]+)/i)){isWebkit=true;webkitVersion=RegExp.$1;if(ua.match(/Chrome\/([0-9.]+)/i)){isChrome=true;chromeVersion=RegExp.$1}else if(ua.match(/Version\/([0-9.]+)/i)){isSafari=true;safariVersion=RegExp.$1}}var _submitForm_Div;
|
||||||
|
function submitForm(a,b){_submitForm_Div&&_submitForm_Div.parentNode.removeChild(_submitForm_Div);_submitForm_Div=document.createElement("div");_submitForm_Div.id="_submitForm_Div";_submitForm_Div.style.display="none";a.appendChild(_submitForm_Div);var c;for(a=0;a<b.length;a+=2){c=document.createElement("input");c.type="hidden";c.name=b[a];c.value=b[a+1];_submitForm_Div.appendChild(c)}b=document.createElement("input");b.type="submit";_submitForm_Div.appendChild(b);b.click();return false}
|
||||||
|
function xmlReqSend(a,b,c,d,f){var e;b=b?b.toUpperCase():"GET";if(b!="GET"&&b!="POST"&&b!="HEAD")b="GET";if(window.XMLHttpRequest)e=new XMLHttpRequest;else if(window.ActiveXObject)try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{e=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){e=false}}if(e){e.onreadystatechange=function(){_xmlReqChange(e,d,f)};a=a.replace(/^https?:\/\/[^\/]+\//,"/");e.open(b,a,true);e.send(c)}}
|
||||||
|
function _xmlReqChange(a,b,c){if(a.readyState==4)if(a.status==200)b&&b(a);else c&&c(a)}function insertText(a,b){if(a.setSelectionRange){var c=a.selectionStart,d=a.selectionEnd;a.value=a.value.substr(0,c)+b+a.value.substr(d,a.value.length);c+=b.length;setSelectionRange(a,c,c)}else if(document.selection){a.focus();c=document.selection.createRange();if(c.parentElement()==a)c.text=b}else a.value+=b}
|
||||||
|
function wrapText(a,b,c){if(a.setSelectionRange){var d=a.selectionStart,f=a.selectionEnd;a.value=a.value.substr(0,d)+b+a.value.substr(d,f-d)+c+a.value.substr(f,a.value.length);setSelectionRange(a,d+b.length,f+b.length)}else if(document.selection){a.focus();d=document.selection.createRange();if(d.parentElement()==a){a=d.text.length;d.text=b+d.text+c;d.moveEnd("character",-c.length);d.moveStart("character",-a);d.select()}}else a.value+=b+c}
|
||||||
|
function setSelectionRange(a,b,c){if(a.setSelectionRange){a.focus();a.setSelectionRange(b,c)}else if(a.createTextRange){a=a.createTextRange();a.collapse(true);a.moveEnd("character",c);a.moveStart("character",b);a.select()}};
|
2
site/forum.slowtwitch.com/www/.htaccess
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Header add X-Frame-Options "SAMEORIGIN"
|
||||||
|
Header add Content-Security-Policy "frame-ancestors 'self'"
|
10
site/forum.slowtwitch.com/www/.htaccess.main
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#Header add X-Frame-Options "DENY"
|
||||||
|
#Header add Content-Security-Policy "frame-ancestors 'none';"
|
||||||
|
#Header set Content-Security-Policy "default-src 'self';"
|
||||||
|
|
||||||
|
Options +FollowSymlinks
|
||||||
|
RewriteEngine on
|
||||||
|
RewriteCond %{REQUEST_URI} !/maintenance.html$
|
||||||
|
RewriteCond %{REMOTE_ADDR} !^208\.70\.245\.120
|
||||||
|
|
||||||
|
RewriteRule $ /maintenance.html [R=302,L]
|
84
site/forum.slowtwitch.com/www/adblock/adBlockJS.php
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
On completion of window load test cycle through all the adzones and
|
||||||
|
test each element for the display = none style. If found update database.
|
||||||
|
*/
|
||||||
|
|
||||||
|
window.addEvent('domready', function() {
|
||||||
|
$$('div.advertPro').each(function(curBlock) {
|
||||||
|
var adzone = curBlock.id;
|
||||||
|
var userID = '<?=$_GET["userID"]?>';
|
||||||
|
|
||||||
|
if (adzone == 'z_20') {
|
||||||
|
var scripts = curBlock.getElementsByTagName("script");
|
||||||
|
// alert(scripts.length + ' script tags.');
|
||||||
|
if (scripts.length > 99) {
|
||||||
|
// dcImage = scripts['3'].getElementsByTagName("img");
|
||||||
|
// scripts['3'].setStyle('display') = '';
|
||||||
|
// if (scripts['3'].getStyle('display') == 'none') {
|
||||||
|
// alert(adzone + ': ' + scripts['3'].getStyle('display'));
|
||||||
|
// updateDB(adzone, userID);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var images = curBlock.getElementsByTagName("img");
|
||||||
|
if (images.length > 0) {
|
||||||
|
for (y=0; y < images.length; y++) {
|
||||||
|
if (images[y].getStyle('display') == 'none') {
|
||||||
|
// alert(adzone + ' image blocked.');
|
||||||
|
updateDB(adzone, userID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var flash = curBlock.getElementsByTagName("embed");
|
||||||
|
if (flash.length > 0) {
|
||||||
|
for (y=0; y < flash.length; y++) {
|
||||||
|
if (flash[y].getStyle('display') == 'none') {
|
||||||
|
// alert(adzone + ' flash blocked.');
|
||||||
|
updateDB(adzone, userID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Database update function
|
||||||
|
//
|
||||||
|
|
||||||
|
function updateDB(adzone, userID) {
|
||||||
|
var http = getHTTPObject();
|
||||||
|
if (http) {
|
||||||
|
http.open("GET", "/adblock/dbWrite.php?ipaddr=<?=$_SERVER['REMOTE_ADDR']?>&userID=" + userID + "&adzone=" + adzone, true);
|
||||||
|
http.onreadystatechange = function() {
|
||||||
|
if (http.readyState == 4) {
|
||||||
|
var results = http.responseText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
http.send(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic AJAX style request object
|
||||||
|
//
|
||||||
|
|
||||||
|
function getHTTPObject() {
|
||||||
|
var xhr = false;
|
||||||
|
if(window.XMLHttpRequest) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
} else if(window.ActiveXObject) {
|
||||||
|
try {
|
||||||
|
var xhr = new ActiveXObject("Msxml2.XMLHTTP");
|
||||||
|
} catch(e) {
|
||||||
|
try {
|
||||||
|
var xhr = new ActiveXObject("Microsoft.XMLHTTP");
|
||||||
|
} catch(e) {
|
||||||
|
alert("Your browser does not support AJAX!");
|
||||||
|
xhr = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return xhr;
|
||||||
|
}
|
||||||
|
|
49
site/forum.slowtwitch.com/www/adblock/dbWrite.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?
|
||||||
|
// Insert passed information into database to log ad delivery failure
|
||||||
|
//
|
||||||
|
// Mike Apted (mike@devsol.ca) - 2008.12.14
|
||||||
|
|
||||||
|
// Configuration
|
||||||
|
//
|
||||||
|
|
||||||
|
$db_host = '192.168.1.10';
|
||||||
|
$db_user = 'slowtwitch';
|
||||||
|
$db_pass = 'k9volqlAcpq';
|
||||||
|
$db_name = 'slowtwitch';
|
||||||
|
|
||||||
|
// Accept and validate parameters
|
||||||
|
//
|
||||||
|
|
||||||
|
if (isset($_GET["ipaddr"]))
|
||||||
|
if (preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $_GET["ipaddr"]))
|
||||||
|
$ipaddr = $_GET["ipaddr"];
|
||||||
|
else
|
||||||
|
$ipaddr = "";
|
||||||
|
else
|
||||||
|
$ipaddr = "";
|
||||||
|
|
||||||
|
if (isset($_GET["userID"]))
|
||||||
|
if (preg_match("/^[a-z\d_]{0,30}$/i", $_GET["userID"]))
|
||||||
|
$userID = $_GET["userID"];
|
||||||
|
else
|
||||||
|
$userID = "";
|
||||||
|
else
|
||||||
|
$userID = "";
|
||||||
|
|
||||||
|
if (isset($_GET["adzone"]))
|
||||||
|
if (preg_match("/\d{1,3}/", $_GET["adzone"]))
|
||||||
|
$adzone = $_GET["adzone"];
|
||||||
|
else
|
||||||
|
$adzone = "";
|
||||||
|
else
|
||||||
|
$adzone = "";
|
||||||
|
|
||||||
|
// Log entry into database
|
||||||
|
//
|
||||||
|
|
||||||
|
$db = mysql_connect($db_host, $db_user,$db_pass) or die("Error: Could not connect to server.");
|
||||||
|
mysql_select_db($db_name) or die("Error: Could not select database.");
|
||||||
|
$query = "INSERT into adblock_iplog (ipaddr, user, adzone) values('" . mysql_real_escape_string($ipaddr) . "', '" . mysql_real_escape_string($userID) . "', '" . mysql_real_escape_string($adzone) . "')";
|
||||||
|
$result = mysql_query($query) or die("Error: Query failed - " . mysql_error());
|
||||||
|
|
||||||
|
?>
|
1
site/forum.slowtwitch.com/www/adblock/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
adblock dir
|
3949
site/forum.slowtwitch.com/www/adblock/mootools.js
Normal file
176
site/forum.slowtwitch.com/www/adblock/test.php
Normal file
@ -0,0 +1,176 @@
|
|||||||
|
<script type="text/javascript" src="/overlib.js"></script>
|
||||||
|
<script language="javascript">AC_FL_RunContent = 0;</script>
|
||||||
|
<script src="/flash/AC_RunActiveContent.js" language="javascript"></script>
|
||||||
|
|
||||||
|
<script src="/adblock/mootools.js" type="text/javascript"></script>
|
||||||
|
<script src="/adblock/adBlockJS.php?userID=userName" type="text/javascript"></script>
|
||||||
|
|
||||||
|
<script language="Javascript">
|
||||||
|
<!--
|
||||||
|
sgi_ord=Math.random()*10000000000000000;
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
|
||||||
|
z_20:
|
||||||
|
<div class="advertPro" id="z_20">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=20&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=20&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=20&pid=0&position=1" height="90" width="728" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_8:
|
||||||
|
<div class="advertPro" id="z_8">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=8&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=8&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=8&pid=0&position=1" height="90" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_9:
|
||||||
|
<div class="advertPro" id="z_9">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=9&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=9&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=9&pid=0&position=1" height="90" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_4:
|
||||||
|
<div class="advertPro" id="z_4">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=4&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=4&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=4&pid=0&position=1" height="60" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_1:
|
||||||
|
<div class="advertPro" id="z_1">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=1&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=1&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=1&pid=0&position=1" height="90" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_21:
|
||||||
|
<div class="advertPro" id="z_21">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=21&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=21&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=21&pid=0&position=1" height="240" width="120" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_18:
|
||||||
|
<div class="advertPro" id="z_18">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=18&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=18&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=18&pid=0&position=1" height="600" width="120" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_21:
|
||||||
|
<div class="advertPro" id="z_21">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=21&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=21&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=21&pid=0&position=1" height="240" width="120" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
|
||||||
|
z_1:
|
||||||
|
<div class="advertPro" id="z_1">
|
||||||
|
<!-- BEGIN ADVERTPRO CODE BLOCK -->
|
||||||
|
|
||||||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
||||||
|
<!--
|
||||||
|
document.write('<SCR'+'IPT src="http://reach.slowtwitch.com/servlet/view/banner/javascript/zone?zid=1&pid=0&random='+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'" language="JavaScript" type="text/javascript"></SCR'+'IPT>');
|
||||||
|
//-->
|
||||||
|
</SCRIPT>
|
||||||
|
<NOSCRIPT>
|
||||||
|
<A href="http://reach.slowtwitch.com/servlet/click/zone?zid=1&pid=0&lookup=true&position=1" target="_top">
|
||||||
|
<IMG src="http://reach.slowtwitch.com/servlet/view/banner/image/zone?zid=1&pid=0&position=1" height="90" width="120" hspace="0" vspace="0" border="0" alt="Click Here!">
|
||||||
|
</A>
|
||||||
|
</NOSCRIPT>
|
||||||
|
<!-- END ADVERTPRO CODE BLOCK -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
6
site/forum.slowtwitch.com/www/admin/.htaccess
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
AuthUserFile /home/slowtwitch/forum.slowtwitch.com/cgi-bin/admin/.htpasswd
|
||||||
|
AuthGroupFile /dev/null
|
||||||
|
AuthType Basic
|
||||||
|
AuthName "Gossamer Forum Administration"
|
||||||
|
|
||||||
|
require valid-user
|
45
site/forum.slowtwitch.com/www/admin/config.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?
|
||||||
|
###########################################
|
||||||
|
#-----------Forum stats config------------#
|
||||||
|
###########################################
|
||||||
|
/*=========================================\
|
||||||
|
Author : Jordan Rapped \\
|
||||||
|
Version : 1.0 \\
|
||||||
|
Date Created: Feb 2 2008 \\
|
||||||
|
---------------------------- \\
|
||||||
|
Last Update: Feb 2 2008 \\
|
||||||
|
---------------------------- \\
|
||||||
|
\\
|
||||||
|
===========================================\
|
||||||
|
------------------------------------------*/
|
||||||
|
//skip the config file if somebody call it from the browser.
|
||||||
|
if (eregi("config.php", $_SERVER['SCRIPT_NAME'])) {
|
||||||
|
Header("Location: index.php"); die();
|
||||||
|
}
|
||||||
|
|
||||||
|
//your database hostname.
|
||||||
|
$dbhost = "192.168.1.10";
|
||||||
|
//your database username.
|
||||||
|
$dbuname = "slowtwitch";
|
||||||
|
//your db password
|
||||||
|
$dbpass = "k9volqlAcpq";
|
||||||
|
$dbname = "slowtwitch";
|
||||||
|
$prefix = "gforum_";
|
||||||
|
|
||||||
|
//change this
|
||||||
|
$site_name = "Slowtwitch.com";
|
||||||
|
$site_email = "aaron@gossamer-threads.com";
|
||||||
|
$site_url = "http://test.slowtwitch.com/stackreach/";
|
||||||
|
|
||||||
|
include("mysql.class.php");
|
||||||
|
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
|
||||||
|
if(!$db->db_connect_id) {
|
||||||
|
echo "<br><font color=red><h3><br><center>Error:</b><br><hr><br>
|
||||||
|
<b>Connection to database failed</b><br>
|
||||||
|
<br><br><br><br><br><br><br><br><br></b></center>";
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
65
site/forum.slowtwitch.com/www/admin/dbase_to_validate.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?PHP
|
||||||
|
|
||||||
|
require_once ("config.php");
|
||||||
|
|
||||||
|
echo ("<font face=\"Tahoma,Arial,Helvetica\" size=\"2\">");
|
||||||
|
|
||||||
|
$main_table = "Triathlons";
|
||||||
|
$field_lead = "";
|
||||||
|
$year_part = date( "Y", strtotime("-6 months") );
|
||||||
|
$min_date = ""+$year_part+"-01-01"; // start date for races that display
|
||||||
|
$base_url = "https://www.slowtwitch.com/calendar/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0 AND ".$field_lead."date >= '".$min_date."'"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
$main_table = "Retailers";
|
||||||
|
$field_lead = "retailer_";
|
||||||
|
$base_url = "https://www.slowtwitch.com/retailers/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
$main_table = "Triclubs";
|
||||||
|
$field_lead = "triclub_";
|
||||||
|
$base_url = "https://www.slowtwitch.com/triclubs/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
$main_table = "Runshops";
|
||||||
|
$field_lead = "runshop_";
|
||||||
|
$base_url = "https://www.slowtwitch.com/runshops/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
$main_table = "Fitters";
|
||||||
|
$field_lead = "fitter_";
|
||||||
|
$base_url = "https://www.slowtwitch.com/fitters/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
$main_table = "Coaches";
|
||||||
|
$field_lead = "coach_";
|
||||||
|
$base_url = "https://www.slowtwitch.com/coaches/";
|
||||||
|
echo("<br /><br /><strong style=\"text-decoration: underline;\">".$main_table." Admin:</strong>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table." WHERE ".$field_lead."valid = 0"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."validate.php'><strong>Validate Entries (".$unvalid_count.")</strong></a>");
|
||||||
|
$unvalid_count = mysql_num_rows(mysql_query("SELECT * FROM ".$prefix.$main_table."Edits"));
|
||||||
|
echo("<br /><a target='_blank' href='".$base_url."wiki_validate.php'><strong>Validate Edits (".$unvalid_count.")</strong></a>");
|
||||||
|
|
||||||
|
echo ("</font>");
|
||||||
|
|
||||||
|
?>
|
48
site/forum.slowtwitch.com/www/admin/delete_spam_comments.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?PHP
|
||||||
|
|
||||||
|
require_once ("config.php");
|
||||||
|
|
||||||
|
// GLINKS COMMENTS SQL
|
||||||
|
/** Fetch comments matching %<a href=%[url=% **/
|
||||||
|
|
||||||
|
$count_spam_glinks_comments_sql = "SELECT COUNT(ReviewID) AS amount_spam FROM glinks_Reviews WHERE Review_Contents LIKE '%a href=%[url=%'";
|
||||||
|
|
||||||
|
$remove_spam_glinks_comments_sql = "DELETE FROM glinks_Reviews WHERE Review_Contents LIKE '%a href=%[url=%'";
|
||||||
|
|
||||||
|
echo ("<font face=\"Tahoma,Arial,Helvetica\" size=\"2\">");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? echo ("<strong>**Deleting Spam Comments**</strong><br /><br />"); ?>
|
||||||
|
|
||||||
|
<? // Delete Comments
|
||||||
|
|
||||||
|
// count the spam comments
|
||||||
|
|
||||||
|
echo ("<strong>Counting Spam Comments...</strong><br />");
|
||||||
|
$sql = $count_spam_glinks_comments_sql;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ("Number of spam comments: ".$row[amount_spam]);
|
||||||
|
if ($row[amount_spam] > 0) $spam_count = $row[amount_spam];
|
||||||
|
echo ("<br />\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
|
||||||
|
// end count
|
||||||
|
|
||||||
|
// delete the spam comments
|
||||||
|
|
||||||
|
//echo ("Comments to be deleted: ".$spam_count);
|
||||||
|
|
||||||
|
if ($spam_count > 0) {
|
||||||
|
echo ("Deleting spam comments...");
|
||||||
|
$sql = $remove_spam_glinks_comments_sql;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
// end delete comments
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? echo ("</font>"); ?>
|
174
site/forum.slowtwitch.com/www/admin/forum_stats.php
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
<?PHP
|
||||||
|
|
||||||
|
require_once ("config.php");
|
||||||
|
|
||||||
|
// FORUM USERS SQL
|
||||||
|
/** Users online now?
|
||||||
|
Unique users posting over the last 1 day?
|
||||||
|
Unique users posting over the last 7 days?
|
||||||
|
Unique users posting over the last 30 days?
|
||||||
|
Versus same 30 days one year ago?
|
||||||
|
Unique users posting over the last 6 months? **/
|
||||||
|
|
||||||
|
$user_date_limit = array("1", "7", "30", "183");
|
||||||
|
$user_date_append = "WHERE post_time > UNIX_TIMESTAMP(NOW()) - (24*60*60)";
|
||||||
|
$online_now_sql = "SELECT COUNT(user_id) AS online_now FROM gforum_User WHERE user_last_seen > UNIX_TIMESTAMP(NOW()) - (15*60)";
|
||||||
|
$unique_posters_sql = "SELECT COUNT(DISTINCT(user_id_fk)) AS uniques FROM gforum_Post";
|
||||||
|
|
||||||
|
// ADBLOCK STATS SQL
|
||||||
|
|
||||||
|
$date_limit = array("2", "30");
|
||||||
|
$date_append = "WHERE UNIX_TIMESTAMP(ai.timestamp) > UNIX_TIMESTAMP(NOW()) - (24*60*60)";
|
||||||
|
|
||||||
|
$adblock_users_sql = "SELECT DISTINCT(ai.user) AS uid, gu.user_username, gu.user_enabled FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user";
|
||||||
|
|
||||||
|
$adblock_email_all_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user";
|
||||||
|
|
||||||
|
$adblock_email_enabled_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user AND gu.user_enabled = 1";
|
||||||
|
|
||||||
|
$adblock_email_disabled_sql = "SELECT DISTINCT(ai.user), gu.user_email FROM adblock_iplog AS ai RIGHT JOIN gforum_User AS gu ON gu.user_id = ai.user AND gu.user_enabled = 0";
|
||||||
|
|
||||||
|
$adblock_ip_sql = "SELECT DISTINCT(ai.ipaddr) FROM adblock_iplog AS ai";
|
||||||
|
|
||||||
|
echo ("<font face=\"Tahoma,Arial,Helvetica\" size=\"2\">");
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? echo ("<strong>**Forum Stats**</strong><br /><br />"); ?>
|
||||||
|
|
||||||
|
<? // Fetch the users online now
|
||||||
|
|
||||||
|
echo ("<strong>ONLINE NOW (Last 15 Minutes)</strong><br />");
|
||||||
|
$sql = $online_now_sql;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ($row[online_now]);
|
||||||
|
echo ("<br />\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
|
||||||
|
// end online now
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? // Fetch the unique posters
|
||||||
|
|
||||||
|
echo ("<strong>UNIQUE POSTERS</strong><br />");
|
||||||
|
foreach ($user_date_limit AS $limit) {
|
||||||
|
echo ("<strong>Last ".$limit." day(s)</strong>: ");
|
||||||
|
$sql = $unique_posters_sql." ".$user_date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ($row[uniques]);
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
}
|
||||||
|
|
||||||
|
// end unique loop
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? // Fetch the unique posters
|
||||||
|
|
||||||
|
echo ("<br /><strong>ONE YEAR AGO</strong><br />");
|
||||||
|
foreach ($user_date_limit AS $limit) {
|
||||||
|
echo ("<strong>Last ".$limit." day(s)</strong>: ");
|
||||||
|
$user_year_append = "WHERE post_time > UNIX_TIMESTAMP(NOW()) - (24*60*60)*(365+".$limit.") AND post_time < UNIX_TIMESTAMP(NOW()) - (24*60*60)*(365)";
|
||||||
|
$sql = $unique_posters_sql." ".$user_year_append;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ($row[uniques]);
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
}
|
||||||
|
|
||||||
|
// end unique loop
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<? echo ("<br /><br /><strong>**AdBlock Stats**</strong><br /><br />"); ?>
|
||||||
|
|
||||||
|
<? // Fetch the users
|
||||||
|
|
||||||
|
echo ("<strong>USERS</strong><br />");
|
||||||
|
foreach ($date_limit AS $limit) {
|
||||||
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
||||||
|
$sql = $adblock_users_sql." ".$date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ("<a href='http://forum.slowtwitch.com/cgi-bin/admin/db.cgi?db=User;do=modify_search_results;user_id=".$row[uid].";user_id-opt=%3D'>".$row[user_username]."</a>");
|
||||||
|
if ($row[user_enabled] == 1) {
|
||||||
|
echo (" (enabled)");
|
||||||
|
} else {
|
||||||
|
echo (" (disabled)");
|
||||||
|
}
|
||||||
|
echo ("<br />\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
}
|
||||||
|
|
||||||
|
// end user loop
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? // Fetch the email
|
||||||
|
|
||||||
|
echo ("<strong>EMAIL</strong><br />");
|
||||||
|
foreach ($date_limit AS $limit) {
|
||||||
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
||||||
|
$sql = $adblock_email_all_sql." ".$date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
echo ("ALL users: \n\r");
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
||||||
|
echo ("\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br /><br />");
|
||||||
|
|
||||||
|
$sql = $adblock_email_enabled_sql." ".$date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
echo ("ENABLED users: \n\r");
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
||||||
|
echo ("\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br /><br />");
|
||||||
|
|
||||||
|
$sql = $adblock_email_disabled_sql." ".$date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
echo ("DISABLED users: \n\r");
|
||||||
|
if (mysql_num_rows($results) == 0) {
|
||||||
|
echo ("none");
|
||||||
|
} else {
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ("<a href='mailto:".$row[user_email]."'>".$row[user_email]."</a>, ");
|
||||||
|
echo ("\n\r");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo ("<br /><br />");
|
||||||
|
}
|
||||||
|
|
||||||
|
// end email loop
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? // Fetch the ips
|
||||||
|
|
||||||
|
echo ("<strong>IPs</strong><br />");
|
||||||
|
foreach ($date_limit AS $limit) {
|
||||||
|
echo ("<strong>Last ".$limit." days</strong><br />");
|
||||||
|
$sql = $adblock_ip_sql." ".$date_append."*".$limit;
|
||||||
|
$results = mysql_query($sql);
|
||||||
|
while ($row = mysql_fetch_array($results)) {
|
||||||
|
echo ($row[ipaddr]);
|
||||||
|
echo ("<br />\n\r");
|
||||||
|
}
|
||||||
|
echo ("<br />");
|
||||||
|
}
|
||||||
|
|
||||||
|
// end ip loop
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<? echo ("</font>"); ?>
|
6
site/forum.slowtwitch.com/www/admin/index.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?PHP
|
||||||
|
|
||||||
|
header('Location:http://forum.slowtwitch.com/');
|
||||||
|
exit();
|
||||||
|
|
||||||
|
?>
|
339
site/forum.slowtwitch.com/www/admin/mysql.class.php
Normal file
@ -0,0 +1,339 @@
|
|||||||
|
<?PHP
|
||||||
|
###########################################
|
||||||
|
#-----------Users login system------------#
|
||||||
|
###########################################
|
||||||
|
/*=========================================\
|
||||||
|
Author : Mohammed Ahmed(M@@king) \\
|
||||||
|
Version : 1.0 \\
|
||||||
|
Date Created: Aug 20 2005 \\
|
||||||
|
---------------------------- \\
|
||||||
|
Last Update: August 22 2005 \\
|
||||||
|
---------------------------- \\
|
||||||
|
Country : Palestine \\
|
||||||
|
City : Gaza \\
|
||||||
|
E-mail : m@maaking.com \\
|
||||||
|
MSN : m@maaking.com \\
|
||||||
|
AOL-IM : maa2pal \\
|
||||||
|
WWW : http://www.maaking.com \\
|
||||||
|
Mobile/SMS : 00972-599-622235 \\
|
||||||
|
\\
|
||||||
|
===========================================\
|
||||||
|
------------------------------------------*/
|
||||||
|
if (eregi("mysql.class.php", $_SERVER['SCRIPT_NAME'])) {
|
||||||
|
Header("Location: index.php"); die();
|
||||||
|
}
|
||||||
|
//db class
|
||||||
|
if(!defined("SQL_LAYER"))
|
||||||
|
{
|
||||||
|
|
||||||
|
define("SQL_LAYER","mysql");
|
||||||
|
|
||||||
|
class sql_db
|
||||||
|
{
|
||||||
|
|
||||||
|
var $db_connect_id;
|
||||||
|
var $query_result;
|
||||||
|
var $row = array();
|
||||||
|
var $rowset = array();
|
||||||
|
var $num_queries = 0;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Constructor
|
||||||
|
//
|
||||||
|
function sql_db($sqlserver, $sqluser, $sqlpassword, $database, $persistency = true)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->persistency = $persistency;
|
||||||
|
$this->user = $sqluser;
|
||||||
|
$this->password = $sqlpassword;
|
||||||
|
$this->server = $sqlserver;
|
||||||
|
$this->dbname = $database;
|
||||||
|
|
||||||
|
if($this->persistency)
|
||||||
|
{
|
||||||
|
$this->db_connect_id = @mysql_pconnect($this->server, $this->user, $this->password);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->db_connect_id = @mysql_connect($this->server, $this->user, $this->password);
|
||||||
|
}
|
||||||
|
if($this->db_connect_id)
|
||||||
|
{
|
||||||
|
if($database != "")
|
||||||
|
{
|
||||||
|
$this->dbname = $database;
|
||||||
|
$dbselect = @mysql_select_db($this->dbname);
|
||||||
|
if(!$dbselect)
|
||||||
|
{
|
||||||
|
@mysql_close($this->db_connect_id);
|
||||||
|
$this->db_connect_id = $dbselect;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->db_connect_id;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Other base methods
|
||||||
|
//
|
||||||
|
function sql_close()
|
||||||
|
{
|
||||||
|
if($this->db_connect_id)
|
||||||
|
{
|
||||||
|
if($this->query_result)
|
||||||
|
{
|
||||||
|
@mysql_free_result($this->query_result);
|
||||||
|
}
|
||||||
|
$result = @mysql_close($this->db_connect_id);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Base query method
|
||||||
|
//
|
||||||
|
function sql_query($query = "", $transaction = FALSE)
|
||||||
|
{
|
||||||
|
// Remove any pre-existing queries
|
||||||
|
unset($this->query_result);
|
||||||
|
if($query != "")
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->query_result = @mysql_query($query, $this->db_connect_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
if($this->query_result)
|
||||||
|
{
|
||||||
|
unset($this->row[$this->query_result]);
|
||||||
|
unset($this->rowset[$this->query_result]);
|
||||||
|
return $this->query_result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return ( $transaction == END_TRANSACTION ) ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Other query methods
|
||||||
|
//
|
||||||
|
function sql_numrows($query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_num_rows($query_id);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_affectedrows()
|
||||||
|
{
|
||||||
|
if($this->db_connect_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_affected_rows($this->db_connect_id);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_numfields($query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_num_fields($query_id);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_fieldname($offset, $query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_field_name($query_id, $offset);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_fieldtype($offset, $query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_field_type($query_id, $offset);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_fetchrow($query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$this->row[$query_id] = @mysql_fetch_array($query_id);
|
||||||
|
return $this->row[$query_id];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_fetchrowset($query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
unset($this->rowset[$query_id]);
|
||||||
|
unset($this->row[$query_id]);
|
||||||
|
while($this->rowset[$query_id] = @mysql_fetch_array($query_id))
|
||||||
|
{
|
||||||
|
$result[] = $this->rowset[$query_id];
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_fetchfield($field, $rownum = -1, $query_id = 0)
|
||||||
|
{
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
if($rownum > -1)
|
||||||
|
{
|
||||||
|
$result = @mysql_result($query_id, $rownum, $field);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(empty($this->row[$query_id]) && empty($this->rowset[$query_id]))
|
||||||
|
{
|
||||||
|
if($this->sql_fetchrow())
|
||||||
|
{
|
||||||
|
$result = $this->row[$query_id][$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if($this->rowset[$query_id])
|
||||||
|
{
|
||||||
|
$result = $this->rowset[$query_id][$field];
|
||||||
|
}
|
||||||
|
else if($this->row[$query_id])
|
||||||
|
{
|
||||||
|
$result = $this->row[$query_id][$field];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_rowseek($rownum, $query_id = 0){
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
if($query_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_data_seek($query_id, $rownum);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_nextid(){
|
||||||
|
if($this->db_connect_id)
|
||||||
|
{
|
||||||
|
$result = @mysql_insert_id($this->db_connect_id);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_freeresult($query_id = 0){
|
||||||
|
if(!$query_id)
|
||||||
|
{
|
||||||
|
$query_id = $this->query_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $query_id )
|
||||||
|
{
|
||||||
|
unset($this->row[$query_id]);
|
||||||
|
unset($this->rowset[$query_id]);
|
||||||
|
|
||||||
|
@mysql_free_result($query_id);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function sql_error($query_id = 0)
|
||||||
|
{
|
||||||
|
$result["message"] = @mysql_error($this->db_connect_id);
|
||||||
|
$result["code"] = @mysql_errno($this->db_connect_id);
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // class sql_db
|
||||||
|
|
||||||
|
} // if ... define
|
||||||
|
|
||||||
|
?>
|
BIN
site/forum.slowtwitch.com/www/favicon.ico
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
site/forum.slowtwitch.com/www/images/GForum_logo.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
site/forum.slowtwitch.com/www/images/angelic.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
site/forum.slowtwitch.com/www/images/announcement.gif
Normal file
After Width: | Height: | Size: 93 B |
BIN
site/forum.slowtwitch.com/www/images/arg.gif
Normal file
After Width: | Height: | Size: 614 B |
BIN
site/forum.slowtwitch.com/www/images/big_grin.gif
Normal file
After Width: | Height: | Size: 603 B |
BIN
site/forum.slowtwitch.com/www/images/blush.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/bottom_ad_1.gif
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
site/forum.slowtwitch.com/www/images/bottom_ad_2.gif
Normal file
After Width: | Height: | Size: 229 B |
BIN
site/forum.slowtwitch.com/www/images/bug.gif
Normal file
After Width: | Height: | Size: 152 B |
BIN
site/forum.slowtwitch.com/www/images/cash.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/cerveload.gif
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
site/forum.slowtwitch.com/www/images/cerveload2.gif
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
site/forum.slowtwitch.com/www/images/cerveload4.gif
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
site/forum.slowtwitch.com/www/images/chit_chat.gif
Normal file
After Width: | Height: | Size: 604 B |
BIN
site/forum.slowtwitch.com/www/images/clear_shim.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
site/forum.slowtwitch.com/www/images/close.gif
Normal file
After Width: | Height: | Size: 145 B |
BIN
site/forum.slowtwitch.com/www/images/collapse.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
site/forum.slowtwitch.com/www/images/cool.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/crazy.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/display_profile.gif
Normal file
After Width: | Height: | Size: 736 B |
BIN
site/forum.slowtwitch.com/www/images/door.gif
Normal file
After Width: | Height: | Size: 320 B |
BIN
site/forum.slowtwitch.com/www/images/down.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
site/forum.slowtwitch.com/www/images/downarrow.gif
Normal file
After Width: | Height: | Size: 79 B |
BIN
site/forum.slowtwitch.com/www/images/email_subscriptions.gif
Normal file
After Width: | Height: | Size: 690 B |
BIN
site/forum.slowtwitch.com/www/images/expand.gif
Normal file
After Width: | Height: | Size: 65 B |
BIN
site/forum.slowtwitch.com/www/images/expand_all.gif
Normal file
After Width: | Height: | Size: 76 B |
BIN
site/forum.slowtwitch.com/www/images/faq.gif
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
site/forum.slowtwitch.com/www/images/fire.gif
Normal file
After Width: | Height: | Size: 131 B |
BIN
site/forum.slowtwitch.com/www/images/first.gif
Normal file
After Width: | Height: | Size: 199 B |
BIN
site/forum.slowtwitch.com/www/images/first_grey.gif
Normal file
After Width: | Height: | Size: 72 B |
BIN
site/forum.slowtwitch.com/www/images/forum_bottom_left.gif
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
site/forum.slowtwitch.com/www/images/frown.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
site/forum.slowtwitch.com/www/images/home.gif
Normal file
After Width: | Height: | Size: 359 B |
BIN
site/forum.slowtwitch.com/www/images/hot_new_no_replies.gif
Normal file
After Width: | Height: | Size: 151 B |
After Width: | Height: | Size: 157 B |
BIN
site/forum.slowtwitch.com/www/images/hot_new_with_replies.gif
Normal file
After Width: | Height: | Size: 160 B |
BIN
site/forum.slowtwitch.com/www/images/hot_no_replies.gif
Normal file
After Width: | Height: | Size: 123 B |
BIN
site/forum.slowtwitch.com/www/images/hot_with_new_replies.gif
Normal file
After Width: | Height: | Size: 159 B |
BIN
site/forum.slowtwitch.com/www/images/hot_with_replies.gif
Normal file
After Width: | Height: | Size: 132 B |
BIN
site/forum.slowtwitch.com/www/images/idea.gif
Normal file
After Width: | Height: | Size: 572 B |
BIN
site/forum.slowtwitch.com/www/images/important.gif
Normal file
After Width: | Height: | Size: 336 B |
BIN
site/forum.slowtwitch.com/www/images/jump_last.gif
Normal file
After Width: | Height: | Size: 97 B |
BIN
site/forum.slowtwitch.com/www/images/last.gif
Normal file
After Width: | Height: | Size: 207 B |
BIN
site/forum.slowtwitch.com/www/images/last_grey.gif
Normal file
After Width: | Height: | Size: 71 B |
BIN
site/forum.slowtwitch.com/www/images/laugh.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/leftbar.gif
Normal file
After Width: | Height: | Size: 501 B |
BIN
site/forum.slowtwitch.com/www/images/legend.gif
Normal file
After Width: | Height: | Size: 368 B |
BIN
site/forum.slowtwitch.com/www/images/locked.gif
Normal file
After Width: | Height: | Size: 134 B |
BIN
site/forum.slowtwitch.com/www/images/mad.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
site/forum.slowtwitch.com/www/images/mail.gif
Normal file
After Width: | Height: | Size: 396 B |
BIN
site/forum.slowtwitch.com/www/images/mainbar.gif
Normal file
After Width: | Height: | Size: 147 B |
BIN
site/forum.slowtwitch.com/www/images/message.gif
Normal file
After Width: | Height: | Size: 64 B |
BIN
site/forum.slowtwitch.com/www/images/new_no_replies.gif
Normal file
After Width: | Height: | Size: 85 B |
BIN
site/forum.slowtwitch.com/www/images/new_with_new_replies.gif
Normal file
After Width: | Height: | Size: 85 B |
BIN
site/forum.slowtwitch.com/www/images/new_with_replies.gif
Normal file
After Width: | Height: | Size: 91 B |
BIN
site/forum.slowtwitch.com/www/images/news.gif
Normal file
After Width: | Height: | Size: 137 B |
BIN
site/forum.slowtwitch.com/www/images/next.gif
Normal file
After Width: | Height: | Size: 178 B |