function update() {
// $('#hello').html("Hello World");
$('#xellug').load('/engine.php?plugin=test');
$('#lemin').load('/engine.php?plugin=test2');
}
function display(data) {
alert(data);
}
function controller(id,instance,input,newhref) {
$.ajax({ scriptCharset: "utf-8" ,
contentType: "application/x-www-form-urlencoded;charset=utf-8",
type:"POST",
datatype:"json",
url:"/engine.php",
data:{ input:escape(input),
instance:escape(instance),
id:escape(id)
},
success:function(data){ if (trim(data)!='') {
//$(document.body).prepend('table onClick=\'$(this).remove();\' class=\'overlaytable\' width=\'100%\' height=\'100%\' border=1 style=\'position:absolute; z-index:2000\'>
| "+dumpObj(data)+" |
');\" />";
// $(document.body).prepend("");
$('').html(dumpObj(data)).dialog({
title:'Fulcrum Alert',
width:400,
height:400,
modal:true
});
// alert(dumpObj(data));
} else {
if (typeof(newhref)=="undefined") newhref='';
if (newhref=='' || newhref==document.location.href) {
if (document.getElementById('fulcrum_'+instance)) {
renderframe('fulcrum_'+instance);
} else {
newhref=document.location.href;
document.location.href=newhref;
}
} else {
document.location.href=newhref;
}
}
},
errorx:function(){ alert("Ajax Error")
},
error:function() {}
}
);
}
function selallpopup(id,parnt,input,newhref) {
var $o = $("");
$(document.body).append($o);
$o.css({'position':'absolute',
'width':'90px',
'color':'#fff',
'padding':'0px',
'border':'1px solid black',
'background-color':'#000',
'left':parnt.position().left+parnt.outerWidth(),
'top':parnt.position().top
});
$o.html('Add all
Clear all
This page
Add page
Next page
');
$o.find('div').css({'width':'86px',
'color':'#000',
'padding':'2px',
'background-color':'#ddd',
'cursor':'pointer'
}).mouseover(function() {
$(this).css({'background-color':'#fcc'});
}).mouseout(function() {
$(this).css({'background-color':'#ddd'});
}).click(function() {
controller(id,id,$(this).attr('data-fn'));
})
$o.mouseleave(function() { $(this).remove(); });
}
function oldcontroller(id,instance,input,newhref) {
$.ajax({type:"POST",datatype:"json",url:"/engine.php",data:{input:escape(input),instance:escape(instance),id:escape(id)},success:function(data){if (data!='') alert(dumpObj(data));if (typeof(newhref)=="undefined") newhref=document.location.href;if (newhref=='') newhref=document.location.href;document.location.href=newhref;},error:function(){alert("Ajax Error");}});
}
function prepareform_ajax(form_id,instance,enginefunc,newhref) {
$(document).ready(function() {
var options = {
enginefunc: enginefunc,
instance: instance,
beforeSubmit: postRequest,
newhref: newhref,
url: '/formtarget.php',
success: showResponse
};
$('#'+form_id).addClass('fulcrum_ajax');
$('#'+form_id).submit(function() {
$.Watermark.HideAll();
$(this).ajaxSubmit(options);
return false;
});
$('#'+form_id).bind('form-pre-serialize',function(e) {
tinyMCE.triggerSave();
});
});
}
function prepareform(form_id,instance,enginefunc,newhref) {
$(document).ready(function() {
var options = {
enginefunc: enginefunc,
instance: instance,
beforeSubmit: postRequest,
newhref: newhref,
url: '/formtarget.php',
success: showResponse
};
$('#'+form_id).addClass('fulcrum_ajax');
$('#'+form_id).submit(function() {
$.Watermark.HideAll();
$(this).ajaxSubmit(options);
return false;
});
$('#'+form_id).bind('form-pre-serialize',function(e) {
tinyMCE.triggerSave();
});
});
}
// ----- default showRequest and showResponse functions from ajaxForm page
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert('About to submit: \n\n' + queryString);
return true;
}
function showResponse(responseText, statusText) {
alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.');
}
// ----- ends -----------
function postRequest(formData,jqForm,option) {
var jsonString=JSON.stringify(formData,'');
if (typeof(option['newhref'])=="undefined") newhref=document.location.href; else newhref=option['newhref'];
if (newhref=='') newhref=document.location.href;
controller(jsonString,option['instance'],option['enginefunc'],newhref);
return false;
}
function getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=");
if (c_start!=-1)
{
c_start=c_start + c_name.length+1;
c_end=document.cookie.indexOf(";",c_start);
if (c_end==-1) c_end=document.cookie.length;
return unescape(document.cookie.substring(c_start,c_end));
}
}
return "";
}
function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function condPopup(targetUri,newFrameID,module,parentid,hook) {
if (document.getElementById('main')) {
makeNewFrame2(targetUri,newFrameID,module,parentid,hook);
} else {
makeNewFrame('test',targetUri);
}
}
function makeNewFrame(newFrameId,targetUri) {
var frameslist = top.frames;
var op = {};
for (var i=0;i0) {
$("#fulcrum_e_"+instance+"_"+id).remove();
updatemainwidth();
}
}
function showpopup(element) {
var ids='';
$('.fulcruminfo').each(function() {
if ($(this).parent().attr('id')!=$(element).attr('id')) $(this).remove();
});
if($(element).children('.fulcruminfo').size()==0) {
$(element).prepend("");
var position=$(element).position();
$(element).children('.fulcruminfo').css({'left':position.left+$(element).width()-100,'top':position.top-10});
$(element).children('.fulcruminfo').children('.expand').click(function() {expand($(element).attr('id'));});
$(element).children('.fulcruminfo').children('.contract').click(function() {contract($(element).attr('id'));});
$(element).children('.fulcruminfo').children('.hide').click(function() {togglevisible($(element).attr('id'));});
$(element).children('.fulcruminfo').children('.close').click(function() {close($(element).attr('id'));});
}
}
function expand(element) {
$('#'+element).each(function() {
$(this).css({'width':($(this).width()+200)+'px'});
var position=$(this).position();
$(this).children('.fulcruminfo').css({'left':position.left+$(this).width()-100,'top':position.top-10});
});
updatemainwidth();
}
function contract(element) {
$('#'+element).each(function() {
if ($(this).width()>400) {
$(this).css({'width':($(this).width()-200)+'px'});
var position=$(this).position();
$(this).children('.fulcruminfo').css({'left':position.left+$(this).width()-100,'top':position.top-10});
}
});
updatemainwidth();
}
function close(element) {
$('#'+element).remove();
updatemainwidth();
}
function popupeditor(id,instance,efunc) {
if ($("#fulcrum_e_"+instance+"_"+id).length>0) {
$("#fulcrum_e_"+instance+"_"+id).remove();
updatemainwidth();
} else {
$("#fulcrum_"+instance).after("Edit:"+instance+'/'+id+"
");
$(function(){
$('#fulcrum_e_'+instance+"_"+id).css({'height':(($('#main').height())-17)+'px'});
updatemainwidth();
$(window).resize(function(){
$('#fulcrum_e_'+instance+"_"+id).css({'height':(($('#main').height())-17)+'px'});
});
});
$.ajax({ contentType: "application/x-www-form-urlencoded;charset=utf-8",
type:"POST",
datatype:"json",
url:"/rendermodule_ajax.php",
data:{instance:escape(instance),
id:escape(id),
function:escape('rendereditor')},
success:function(data){ if (trim(data)!='') {
$("#fulcrum_e_"+instance+"_"+id).html(trim(data));
forms_to_ajax(instance,id);
initLightbox();
} else {
alert('No Data Received');
}
},
error:function() {}
});
}
}
function forms_to_ajax(instance,id) {
if (typeof(id)=='undefined') {
$("#fulcrum_"+instance+" form").each(function() {
if (!$(this).hasClass('fulcrum_ajax')) {
var options={
success:function(data) {
$("#fulcrum_"+instance).html(trim(data));
forms_to_ajax(instance)
}
};
$(this).attr('action',"/rendermodule_ajax.php?instance="+escape(instance));
$(this).ajaxForm(options);
}
});
} else {
$("#fulcrum_e_"+instance+"_"+id+" form").each(function() {
if (!$(this).hasClass('fulcrum_ajax')) {
var options={
success:function(data) {
$("#fulcrum_e_"+instance+"_"+id).html(trim(data));
forms_to_ajax(instance,id)
}
};
$(this).attr('action',"/rendermodule_ajax.php?function=rendereditor&instance="+escape(instance)+"&id="+escape(id));
$(this).ajaxForm(options);
}
});
}
}
function makeNewFrame2(newFrameID,module,parentid,hook) {
var parentname=parentid;
if (typeof(parentname)=='undefined') parentname='master';
$.ajax({ scriptCharset: "utf-8" ,
contentType: "application/x-www-form-urlencoded;charset=utf-8",
type:"POST",
datatype:"json",
async:false,
url:"/rendermodule_ajax.php?hint="+newFrameID,
data:{},
success:function(data){
if (trim(data)!='') {
$("#main").append(""+trim(data)+": Loading
");
$(function(){
updatemainwidth();
$('#fulcrum_'+trim(data)).css({'height':(($('#main').height())-17)+'px'});
$(window).resize(function(){
$('#fulcrum_'+trim(data)).css({'height':(($('#main').height())-17)+'px'});
});
});
renderframe("fulcrum_"+trim(data),module,parentid,hook);
} else {
alert('makeNewFrame2: No Data Received');
}
},
errorx:function(){ alert("Ajax Error")
},
error:function() {}
}
);
}
function renderframe(frameID,module,parentid,hook) {
var patt1=/^fulcrum_([0-9]+?)$/;
var matches=frameID.match(patt1);
if (matches==null) {
$("#"+frameID).remove();
alert('Renderframe : '+frameID+' - an error occurred');
} else if (matches[1]==null) {
$("#"+frameID).remove();
alert('Renderframe : '+frameID+' - an error occurred');
} else {
// alert(matches[1]+' '+module+' '+hook+' '+parentid);
$.ajax({ scriptCharset: "utf-8" ,
contentType: "application/x-www-form-urlencoded;charset=utf-8",
type:"POST",
datatype:"json",
url:"/rendermodule_ajax.php",
data:{ instance:escape(matches[1]),
module:escape(module),
hook:escape(hook),
parent:escape(parentid)
},
success:function(data){ if (trim(data)!='') {
$("#"+frameID).html(trim(data));
forms_to_ajax(matches[1]);
initLightbox();
} else {
alert('No Data Received');
}
},
errorx:function(){ alert("Ajax Error")
},
error:function() {}
}
);
}
}
function removeFrame(FrameId) {
// http://192.168.1.42/rendermodule.php?module=contacts&instance=1737&hook=8&parent=1736
var frameslist = top.frames;
var op = {};
for (var i=0;i9)
{
//if the key isn't the backspace key or tab key (which we
if (unicode<45||unicode>57||unicode==46||unicode==47) //if not a number
return false //disable key press
}
}
function numeric(e){
var unicode=e.charCode? e.charCode : e.keyCode
// alert(unicode);
if (unicode<8||unicode>9)
{
//if the key isn't the backspace key or tab key (which we
if (unicode<45||unicode>57||unicode==47) //if not a number
return false //disable key press
}
}
// alert(dumpObj({id:'hello'}));
function reloadindex(uri) {
top.location.href=uri;
}
function base64_encode(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc="",tmp_arr=[];if(!data){return data;}
if (false) data=utf8_encode(data+'');do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i 6) score++;
//if password has both lower and uppercase characters give 1 point
if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;
//if password has at least one number give 1 point
if (password.match(/\d+/)) score++;
//if password has at least one special caracther give 1 point
if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) ) score++;
//if password bigger than 12 give another 1 point
if (password.length > 12) score++;
document.getElementById(description).innerHTML = desc[score];
document.getElementById(strength).className = "strength" + score;
}
function addLoadEvent(func) {
var oldonload=window.onload;
if (typeof window.onload != 'function') {
window.onload=func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
function print_r(arr,level) {
var dumped_text = "";
if(!level) level = 0;
//The padding given at the beginning of the line.
var level_padding = "";
for(var j=0;j \"" + value + "\"\n";
}
}
} else { //Stings/Chars/Numbers etc.
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
}
return dumped_text;
}
function friendly_seo_string(orginal) {
var orginalString = orginal;
// this regex is saying "do not look at "a" to "z" and "0" to "9" and "-" and whitespace across the board.
var disallowedCharacters = /[^a-z0-9\-\s]+/gi;
// exactly as the variable says. this is just whitespace across the board. "\s" is white space in regex
var whitespace = /[\s]+/g;
// Filtering through illegal characters such as "&" symbol needs to be "and" and we need to lower the case of the characters too
var seoFriendlyString = orginalString.replace(/&/g, 'and').replace(disallowedCharacters, ' ').replace(whitespace, '-').toLowerCase();
// using the jQ trim regex filter method we are making sure there isn't white space in the front and back the end of the string.
seoFriendlyString = $.trim(seoFriendlyString);
// although not full proof it is dumb proof. if you enter in a "-" in the beginning it will remove it but for now if the user does a "--" then I can't prevent them from doing it with this solution.
if (seoFriendlyString.indexOf("-") == 0) {
seoFriendlyString = seoFriendlyString.slice(1, seoFriendlyString.length);
}
return seoFriendlyString;
}
function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}
function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function utf8_decode (str_data) {
// Converts a UTF-8 encoded string to ISO-8859-1
//
// version: 1109.2015
// discuss at: http://phpjs.org/functions/utf8_decode // + original by: Webtoolkit.info (http://www.webtoolkit.info/)
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Norman "zEh" Fuchs
// + bugfixed by: hitwork // + bugfixed by: Onno Marsman
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: utf8_decode('Kevin van Zonneveld');
// * returns 1: 'Kevin van Zonneveld'
var tmp_arr = [],
i = 0,
ac = 0,
c1 = 0,
c2 = 0, c3 = 0;
str_data += '';
while (i < str_data.length) { c1 = str_data.charCodeAt(i);
if (c1 < 128) {
tmp_arr[ac++] = String.fromCharCode(c1);
i++;
} else if (c1 > 191 && c1 < 224) { c2 = str_data.charCodeAt(i + 1);
tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = str_data.charCodeAt(i + 1); c3 = str_data.charCodeAt(i + 2);
tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return tmp_arr.join('');
}