Файловый менеджер - Редактировать - /var/www/html/pc_includes.zip
Ðазад
PK ! �c�+ �+ ajax_1.5.pack.jsnu �[��� function Jax(){var loadingTimeout=400;var iframe;this.loadingFunction=function(){};this.doneLoadingFunction=function(){};this.cacheData=new Array;this.stringify=function(arg){var c,i,l,o,u,v;switch(typeof arg){case"object":if(arg){if(arg.constructor==Array){o="";for(i=0;i<arg.length;++i){v=this.stringify(arg[i]);if(o&&v!==u){o+=","}if(v!==u){o+=v}}return"["+o+"]"}else if(typeof arg.toString!="undefined"){o="";for(i in arg){v=this.stringify(arg[i]);if(v!==u){if(o){o+=","}o+=this.stringify(i)+":"+v}}return"{"+o+"}"}else{return}}return"";case"unknown":case"undefined":case"function":return u;case"string":arg=arg.replace(/"/g,'\\"');l=arg.length;o='"';for(i=0;i<l;i+=1){c=arg.charAt(i);if(c>=" "){if(c=="\\"||c=='"'){o+="\\"}o+=c}else{switch(c){case'"':o+='\\"';break;case"\b":o+="\\b";break;case"\f":o+="\\f";break;case"\n":o+="\\n";break;case"\r":o+="\\r";break;case" ":o+="\\t";break;default:c=c.charCodeAt();o+="\\u00";o+=Math.floor(c/16).toString(16);o+=(c%16).toString(16)}}}return o+'"';default:return String(arg)}};this.getRequestObject=function(){if(window.XMLHttpRequest){http_request=new XMLHttpRequest}else if(window.ActiveXObject){var msxmlhttp=new Array("Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP","Microsoft.XMLHTTP");for(var i=0;i<msxmlhttp.length;i++){try{http_request=new ActiveXObject(msxmlhttp[i])}catch(e){http_request=null}}}if(!http_request){alert("Unfortunatelly you browser doesn't support this feature.");return false}return http_request};this.$=function(sId){if(!sId){return null}var returnObj=document.getElementById(sId);if(!returnObj&&document.all){returnObj=document.all[sId]}return returnObj};this.addEvent=function(obj,type,fn){if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event)};obj.attachEvent("on"+type,obj[type+fn])}else{obj.addEventListener(type,fn,false)}};this.removeEvent=function(obj,type,fn){if(obj.detachEvent){obj.detachEvent("on"+type,obj[type+fn]);obj[type+fn]=null}else{obj.removeEventListener(type,fn,false)}};this.submitITask=function(comName,func,postData,responseFunc){var xmlReq=this.buildXmlReq(comName,func,postData,responseFunc,true);this.loadingFunction();if(!this.iframe){this.iframe=document.createElement("iframe");this.iframe.setAttribute("id","ajaxIframe");this.iframe.setAttribute("height",0);this.iframe.setAttribute("width",0);this.iframe.setAttribute("border",0);this.iframe.style.visibility="hidden";document.body.appendChild(this.iframe);this.iframe.src=xmlReq}else{this.iframe.src=xmlReq}};this.extractIFrameBody=function(iFrameEl){var doc=null;if(iFrameEl.contentDocument){doc=iFrameEl.contentDocument}else if(iFrameEl.contentWindow){doc=iFrameEl.contentWindow.document}else if(iFrameEl.document){doc=iFrameEl.document}else{alert("Error: could not find sumiFrame document");return null}return doc.body};this.buildXmlReq=function(comName,func,postData,responseFunc,iframe){var xmlReq="";if(iframe){xmlReq+="?"}else{xmlReq+="&"}xmlReq+="option="+comName;xmlReq+="&no_html=1";xmlReq+="&task=azrul_ajax";xmlReq+="&func="+func;xmlReq+="&"+jax_token_var+"=1";if(postData){xmlReq+="&"+postData}return xmlReq};this.submitTask=function(comName,func,postData,responseFunc,cacheKey){var xmlhttp=this.getRequestObject();var targetUrl=jax_live_site;var responseLength=0;var lastResponseLength=0;var lastResponse="";if(cacheKey){xmlhttp.cachekey=cacheKey}xmlhttp.open("POST",targetUrl,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){jax.doneLoadingFunction();var text=xmlhttp.responseText;if(text!==undefined&&text!==null){if(text.length>0){text=text.substr(responseLength-lastResponseLength);responseLength=xmlhttp.responseText.length;if(lastResponse!=text){jax.processResponse(text)}lastResponse=text}}else{lastResponseLength=0}if(xmlhttp.cachekey){jax.cacheData[xmlhttp.cachekey]=text}}else{}}else if(xmlhttp.readyState==3){if(xmlhttp.status==200){var text=xmlhttp.responseText;var validresponse=true;try{if(text!==undefined&&text!==null){if(text.length>0){text=text.substr(responseLength,text.length-responseLength);eval(text);responseLength=xmlhttp.responseText.length;lastResponseLength=text.length;if(lastResponse!=text){jax.processResponse(text)}lastResponse=text}}}catch(e){}}}};var id=1;var xmlReq=this.buildXmlReq(comName,func,postData,responseFunc);this.loadingFunction();xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlhttp.send(xmlReq)};this.processIResponse=function(){jax.doneLoadingFunction();var resp=this.extractIFrameBody(this.iframe).innerHTML;resp=resp.replace(/</g,"<");resp=resp.replace(/>/g,">");resp=resp.replace(/&/g,"&");resp=resp.replace(/"/g,'"');resp=resp.replace(/'/g,"'");this.processResponse(resp)};this.BetterInnerHTML=function(o,p,q){function r(a){var b;if(typeof DOMParser!="undefined")b=(new DOMParser).parseFromString(a,"application/xml");else{var c=["MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(var i=0;i<c.length&&!b;i++){try{b=new ActiveXObject(c[i]);b.loadXML(a)}catch(e){}}}return b}function s(a,b,c){a[b]=function(){return eval(c)}}function t(b,c,d){if(typeof d=="undefined")d=1;if(d>1){if(c.nodeType==1){var e=document.createElement(c.nodeName);var f={};for(var a=0,g=c.attributes.length;a<g;a++){var h=c.attributes[a].name,k=c.attributes[a].value,l=h.substr(0,2)=="on";if(l)f[h]=k;else{switch(h){case"class":e.className=k;break;case"for":e.htmlFor=k;break;default:e.setAttribute(h,k)}}}b=b.appendChild(e);for(l in f)s(b,l,f[l])}else if(c.nodeType==3){var m=c.nodeValue?c.nodeValue:"";var n=m.replace(/^\s*|\s*$/g,"");if(n.length<7||n.indexOf("<!--")!=0&&n.indexOf("-->")!=n.length-3)b.appendChild(document.createTextNode(m))}}for(var i=0,j=c.childNodes.length;i<j;i++)t(b,c.childNodes[i],d+1)}p="<root>"+p+"</root>";var u=r(p);if(o&&u){if(q!=false)while(o.lastChild)o.removeChild(o.lastChild);t(o,u.documentElement)}};this.processResponse=function(responseTxt){var result=eval(responseTxt);for(var i=0;i<result.length;i++){var cmd=result[i][0];var id=result[i][1];var property=result[i][2];var data=result[i][3];var objElement=this.$(id);switch(cmd){case"as":if(objElement){eval("objElement."+property+"= data ; ")}break;case"al":if(data){alert(data)}break;case"ce":this.create(id,property,data);break;case"rm":this.remove(id);break;case"cs":var scr=id+"(";if(this.isArray(data)){scr+="(data[0])";for(var l=1;l<data.length;l++){scr+=",(data["+l+"])"}}else{scr+="data"}scr+=");";eval(scr);break;default:alert("Unknow command: "+cmd)}}};this.isArray=function(obj){if(obj){return obj.constructor==Array}return false};this.buildCall=function(comName,sFunction){};this.icall=function(comName,sFunction){var arg="";if(arguments.length>2){for(var i=2;i<arguments.length;i++){var a=arguments[i];if(this.isArray(a)){arg+="arg"+i+"="+this.stringify(a)+"&"}else if(typeof a=="string"){var t=new Array("_d_",encodeURIComponent(a));arg+="arg"+i+"="+this.stringify(t)+"&"}else{var t=new Array("_d_",encodeURIComponent(a));arg+="arg"+i+"="+this.stringify(t)+"&"}}}this.submitITask(comName,sFunction,arg)};this.universalHash=function(s,tableSize){var b=27183,h=0,a=31415;if(tableSize>1){for(i=0;i<s.length;i++){var t=s[i]?s[i]:s.charAt(i);h=(a*h+t.charCodeAt())%tableSize;a=a%tableSize*(b%tableSize)%tableSize}}return h};this.cacheCall=function(comName,sFunction){var arg=this.buildArgs(arguments);var key=this.universalHash(comName+"-"+sFunction+"-"+arg,8048);if(key in this.cacheData){this.processResponse(this.cacheData[key]);return}this.submitTask(comName,sFunction,arg,null,key)};this.call=function(comName,sFunction){var arg="";arg=this.buildArgs(arguments);this.submitTask(comName,sFunction,arg)};this.buildArgs=function(arguments){var arg="";if(arguments.length>2){for(var i=2;i<arguments.length;i++){var a=arguments[i];if(this.isArray(a)){arg+="arg"+i+"="+this.stringify(a)+"&"}else if(typeof a=="string"){a=a.replace(/"/g,""");var t=new Array("_d_",encodeURIComponent(a));arg+="arg"+i+"="+this.stringify(t)+"&"}else{var t=new Array("_d_",encodeURIComponent(a));arg+="arg"+i+"="+this.stringify(t)+"&"}}}return arg};this.create=function(sParentId,sTag,sId){var objParent=this.$(sParentId);objElement=document.createElement(sTag);objElement.setAttribute("id",sId);if(objParent){objParent.appendChild(objElement)}};this.remove=function(sId){objElement=this.$(sId);if(objElement&&objElement.parentNode&&objElement.parentNode.removeChild){objElement.parentNode.removeChild(objElement)}};this.getFormValues=function(frm){var objForm;objForm=this.$(frm);if(!Array.prototype.indexOf){Array.prototype.indexOf=function(elt){var len=this.length;var from=Number(arguments[1])||0;from=from<0?Math.ceil(from):Math.floor(from);if(from<0)from+=len;for(;from<len;from++){if(from in this&&this[from]===elt)return from}return-1}}var postData=new Array;if(objForm&&objForm.tagName=="FORM"){var formElements=objForm.elements;var assCheckbox=new Array;var assCntIdx=0;var arrayHiddenValues=new Array;var arrayHiddenCount=0;if(formElements.length>0){for(var i=0;i<formElements.length;i++){if(!formElements[i].name){continue}if(formElements[i].type&&(formElements[i].type=="radio"||formElements[i].type=="checkbox")&&formElements[i].checked==false){continue}var name=formElements[i].name;if(name){if(formElements[i].type=="select-multiple"){postData[i]=new Array;for(var j=0;j<formElements[i].length;j++){if(formElements[i].options[j].selected===true){var value=formElements[i].options[j].value;postData[i][j]=new Array(name,encodeURIComponent(value))}}}else if(formElements[i].type=="checkbox"){if(assCheckbox.indexOf(formElements[i].name)==-1){assCheckbox[assCntIdx]=formElements[i].name;assCntIdx++}}else if(formElements[i].type=="hidden"){if(arrayHiddenValues.indexOf(formElements[i].name)==-1){arrayHiddenValues[arrayHiddenCount]=formElements[i].name;arrayHiddenCount++}}else{var value=formElements[i].value;value=value.replace(/"/g,""");postData[i]=new Array(name,encodeURIComponent(value))}}}}if(arrayHiddenValues.length>0){for(var i=0;i<arrayHiddenValues.length;i++){var hiddenElement=document.getElementsByName(arrayHiddenValues[i]);if(hiddenElement){if(hiddenElement.length>1){var curLen=postData.length;postData[curLen]=new Array;for(var j=0;j<hiddenElement.length;j++){var value=hiddenElement[j].value;value=value.replace(/"/g,""");postData[curLen][j]=new Array(arrayHiddenValues[i],encodeURIComponent(value))}}else{var value=hiddenElement[0].value;value=value.replace(/"/g,""");postData[postData.length]=new Array(arrayHiddenValues[i],encodeURIComponent(value))}}}}if(assCheckbox.length>0){for(var i=0;i<assCheckbox.length;i++){var objCheckbox=document.getElementsByName(assCheckbox[i]);if(objCheckbox){if(objCheckbox.length>1){var tmpIdx=0;var curLen=postData.length;postData[curLen]=new Array;for(var j=0;j<objCheckbox.length;j++){if(objCheckbox[j].checked){var value=objCheckbox[j].value;value=value.replace(/"/g,""");postData[curLen][j]=new Array(assCheckbox[i],encodeURIComponent(value));tmpIdx++}}}else{if(objCheckbox[0].checked){var value=objCheckbox[0].value;value=value.replace(/"/g,""");postData[postData.length]=new Array(assCheckbox[i],encodeURIComponent(value))}}}}}}return postData}}function jax_iresponse(){jax.processIResponse()}var jax=new Jax;PK ! �X�e�Q �Q ajax.phpnu �[��� <?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ use Joomla\CMS\Factory; use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Plugin\PluginHelper; use Joomla\CMS\Session\Session; use Joomla\CMS\Uri\Uri; defined( '_JEXEC' ) or die( 'Restricted access' ); $jaxRoot = JPATH_ROOT; // In certain Joomla! 1.6 installation, tthe pc_includes will be inside // jomsocial.system/ folder. Need 1 more strip directory by 1 more level if(!file_exists($jaxRoot .'/components')) { $jaxRoot = dirname($jaxRoot); } define('JAX_SITE_ROOT', $jaxRoot); define('AZRUL_SYSTEM' , '1.5'); /** Define some constants that can be used by the system **/ if( !defined( 'AZRUL_SYSTEM_PATH' ) ) { // Get the real system path. $system = rtrim( dirname( dirname( __FILE__ ) ), '/' ); define( 'AZRUL_SYSTEM_PATH' , $system ); } $helper = AZRUL_SYSTEM_PATH . '/pc_includes/helper.php'; // Test if file exists before trying to include and generate errors on the entire site. if( file_exists( $helper ) ) { include_once( $helper ); } else { // If file doesn't exists, just quit it now. return; } global $jaxFuncNames; $jaxFuncNames = array(); if(!class_exists('JAXResponse')){ class JAXResponse { var $_response = null; function __construct(){ $this->_response = array(); //Add dummy response so we can easily track for errro $this->addClear('ajax_calls', 'd'); } function object_to_array($obj) { $_arr = is_object($obj) ? get_object_vars($obj) : $obj; $arr = array(); foreach ($_arr as $key => $val) { $val = (is_array($val) || is_object($val)) ? $this->object_to_array($val) : $val; $arr[$key] = $val; } return $arr; } /** * Assign new sData to the $sTarget's $sAttribute property */ function addAssign($sTarget,$sAttribute,$sData){ //$sData = $this->_hackString($sData); //$sData = preg_replace("((\r\n)+)", '', $sData); $this->_response[] = array('as', $sTarget, $sAttribute, $sData); } /** * Clear the given target property */ function addClear($sTarget,$sAttribute){ $this->_response[] = array('as', $sTarget, $sAttribute, ""); } function addCreate($sParent, $sTag, $sId, $sType=""){ $this->_response[] = array('ce', $sParent, $sTag, $sId); } function addRemove($sTarget){ $this->_response[] = array('rm', $sTarget); } /** * Assign new sData to the $sTarget's $sAttribute property */ function addAlert($sData){ $this->_response[] = array('al', "", "", $sData); } function _hackString($str){ # Convert '{' and '}' to 0x7B and 0x7D //$str = str_replace(array('{', '}'), array('{', '}'), $str); return $str; } /** * Add a script call */ function addScriptCall($func){ $size = func_num_args(); $response = ""; if($size > 1){ $response = array(); for ($i = 1; $i < $size; $i++) { $arg = func_get_arg($i); $response[] = $arg; } } $this->_response[] = array('cs', $func, "", $response); } function encodeString($contents){ $ascii = ''; $strlen_var = strlen($contents); /* * Iterate over every character in the string, * escaping with a slash or encoding to UTF-8 where necessary */ for ($c = 0; $c < $strlen_var; ++$c) { $ord_var_c = ord($contents[$c]); switch ($ord_var_c) { case 0x08: $ascii .= '\b'; break; case 0x09: $ascii .= '\t'; break; case 0x0A: $ascii .= '\n'; break; case 0x0C: $ascii .= '\f'; break; case 0x0D: $ascii .= '\r'; break; default: $ascii .= $contents[$c]; } } return $ascii; //return $this->_hackString($ascii); } /** * Flush the output back */ function sendResponse(){ $mainframe = Factory::getApplication(); $jinput = $mainframe->input; $obEnabled = ini_get('output_buffering'); if($obEnabled == "1" || $obEnabled == 'On') { $ob_active = ob_get_length () !== FALSE; if($ob_active) { while (@ ob_end_clean()); if(function_exists('ob_clean')) { @ob_clean(); } } ob_start(); } // Send text/html if we're using iframe if(isset($_GET['func'])) { header("Content-type: text/html; charset=utf-8"); }else{ header('Content-type: text/plain'); } if(!defined('SERVICES_JSON_SLICE')) { include_once(AZRUL_SYSTEM_PATH . '/system/pc_includes/JSON.php'); } // Encode response $output = json_encode($this->_response); if(isset($_GET['func'])) { $output = "<body onload=\"parent.jax_iresponse();\">" . htmlentities($output) . "</body>"; } // Replace all _QQQ_ to " // Language file now uses new _QQQ_ to maintain Joomla 1.6 compatibility $output = str_replace('_QQQ_','\"', $output); echo($output); exit; } } class JAX { var $_html = ""; var $_funct = null; var $_path = ""; var $livePath = ""; var $_reqURL = ""; var $_param = null; var $_livePath = ''; function __construct($livepath, $param= null){ $this->_funct = array(); $this->_path = dirname(__FILE__); $this->_livePath = $livepath; $this->_param = $param; } function registerFunction($mFunction){ $this->_funct[] = $mFunction; } function addAssign(){ } function setReqURI($reqURL){ $this->_reqURL = $this->_fixHTTPS($reqURL); } function _fixHTTPS($content){ $mainframe = Factory::getApplication(); $jinput = $mainframe->input; $reqURI = AZRUL_BASE_LIVE; //$reqURI = $mainframe->getCfg('live_site'); # if host have wwww, but mosConfig doesn't if(isset($_SERVER['HTTP_HOST'])) { if((substr_count($_SERVER['HTTP_HOST'], "www.") != 0) && (substr_count($reqURI, "www.") == 0)) { $reqURI = str_replace("://", "://www.", $reqURI); } else if((substr_count($_SERVER['HTTP_HOST'], "www.") == 0) && (substr_count($reqURI, "www.") != 0)) { // host do not have 'www' but mosConfig does $reqURI = str_replace("www.", "", $reqURI); } } /* Check for HTTPS */ if(isset($_SERVER)) { if(isset($_SERVER['HTTPS'])) { if(strtolower($_SERVER['HTTPS']) == "on" ) { $reqURI = str_replace("http://", "https://", $reqURI); } } } else if(isset($_SERVER['REQUEST_URI'])) { // use REQUEST_URI method if(strpos($_SERVER['REQUEST_URI'], 'https://') === FALSE) { // not a https } else { $reqURI = str_replace("http://", "https://", $reqURI); } } return str_replace( AZRUL_BASE_LIVE , $reqURI, $content); } function _fixLangSwitcher($reqURI){ $isLangFilter = PluginHelper::isEnabled("system","languagefilter"); if (!$isLangFilter){ return $reqURI; } $uri = Uri::getInstance(); $app = Factory::getApplication(); $router = $app->getRouter(); if ($app->isClient('site')) { // setup language data $config = Factory::getConfig(); $mode_sef = $config->get('sef') ? true : false; $default_lang = LanguageHelper::getLanguages('lang_code'); if ($mode_sef) { // Get the route path from the request. $path = JString::substr($uri->toString(), JString::strlen($uri->base())); // Apache mod_rewrite is Off //$path = Factory::getConfig()->get('sef_rewrite') ? $path : JString::substr($path, 10); $path = Factory::getConfig()->get('sef_rewrite') ? $path : JString::substr($path, 10); // Trim any spaces or slashes from the ends of the path and explode into segments. $path = JString::trim($path, '/ '); $parts = explode('/', $path); // The language segment is always at the beginning of the route path if it exists. $langcode = $uri->getVar('lang'); if (!empty($parts) && empty($langcode)) { $langcode = reset($parts); } //set to default language if(empty($langcode)){ //$langcode = $default_lang; // @since 4.0 we get default language from here $lang = Factory::getLanguage(); $langcode = $lang->getDefault(); } //append language code to the request $reqURI = $reqURI . '/'. $langcode . '/'; } else { $langcode= $uri->getVar('lang',$default_lang); //append language code to the request $tmpURI = new Uri($reqURI); $tmpURI->setVar('lang', $langcode); $reqURI = $tmpURI->toString(); } } return $reqURI; } /** * Return the script thatshould be added to the <head> section */ function getScript() { $mainframe = Factory::getApplication();; $reqURI = $this->_reqURL; $compress = $mainframe->getCfg('gzip'); # if host have wwww, but mosConfig doesn't //if (substr($_SERVER['HTTP_HOST'], 0, 4) == "www.") { if((substr_count(@$_SERVER['HTTP_HOST'], "www.") != 0) && (substr_count($reqURI, "www.") == 0)) { $reqURI = str_replace("://", "://www.", $reqURI); } else if((substr_count(@$_SERVER['HTTP_HOST'], "www.") == 0) && (substr_count($reqURI, "www.") != 0)) { // host do not have 'www' but mosConfig does $reqURI = str_replace("www.", "", $reqURI); } /* Check for HTTPS */ if(isset($HTTP_SERVER_VARS)) { if(isset($HTTP_SERVER_VARS['HTTPS'])) { if($HTTP_SERVER_VARS['HTTPS'] == "ON" ) { $reqURI = str_replace("http://", "https://", $reqURI); } } } $reqURI = $this->_fixLangSwitcher($reqURI); $session = Factory::getSession(); $tokenStr = $session->getFormToken(false); $html = "<script type='text/javascript'> /*<![CDATA[*/ var jax_live_site = '$reqURI'; var jax_token_var='$tokenStr'; /*]]>*/ </script>"; $html .= "<script type=\"text/javascript\" src=\"$this->_livePath/ajax_" . AZRUL_SYSTEM . ".pack.js\"></script>\n"; return $this->_fixHTTPS($html); } function nl2brStrict($text) { return preg_replace("/\r\n|\n|\r/", " <br />", $text); } function br2nl($text){ $text = str_replace(' <br />', "\n", $text); return $this->_fixQuote($text); } function _fixQuote($text){ return str_replace('"', '"', $text); } function singleLineIt($text){ return preg_replace("((\r\n)+)", '', $text); } /** * */ function process() { $mainframe = Factory::getApplication(); //backward compatible with Jomcomment component. //The Jomcomment component uses $my as global variable so we need to declare $my as global //The global declearation is only added if com_jomcomment folder is existing //@Todo: A standard fix should remove the $my global in Jomcomment. For now we use this fix solution to minimize the effort if(file_exists(JAX_SITE_ROOT .'/components/com_jomcomment')) { global $my; } $my = Factory::getUser(); if(!defined('SERVICES_JSON_SLICE')) { include_once( AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php'); } $json = new Services_JSON(); if(@isset($_REQUEST['task']) && ($_REQUEST['task'] == 'azrul_ajax')) { if(!isset($my)) $my = $mainframe->getUser(); $func = @$_REQUEST['func']; // Security fix. // 1. check if user are trying to run an eval # build an array of args $args = array(); $argCount = 0; # All POST data that are meant to be send to the function will # be appended by 'arg' keyword. Only pass this vars to the function foreach($_REQUEST as $key => $postData) { if(substr($key, 0, 3) == 'arg' ) { //if ( get_magic_quotes_gpc() ) { if(is_array($postData)){ foreach($postData as &$data){ $data = stripcslashes($data); } }else{ $postData = stripcslashes($postData); } //} $postData = ($this->nl2brStrict($postData)); if(!is_array($postData)){ $decoded = $json->decode($postData); }else{ //array input decode need to be implemented in the future $decoded = $postData; } $key = ""; $val = ""; # if the args is an array, we need to pass it as an array # todo@ we need to expand this array further. We now assume, # if an array is passed, it comes in a pair of (key/value) if(is_array($decoded)) { foreach($decoded as $index => $value) { $tempArray = array(); if( is_array($value) ) { foreach($value as $val) { // The value is an array so we need to chuck them in // a multidimensional array instead if( is_array($val) ) { // Since the values here are array, we will // always assume that the index 0 is always the key $key = $val[0]; $data = $this->br2nl( rawurldecode($val[1]) ); // We will also always assume that the index 1 will be the value $decoded[$key][] = $data; } else { // We always assume that the index 0 is the key of the array. $key = $value[0]; // We always assume that the index 1 is the data of the array. $data = $this->br2nl(rawurldecode($value[1])); if( substr($value[0], 0, 6) == '_d_' ) { $decoded = array($val); } else { $newArray = array( $key => $data ); $decoded = array_merge( $decoded, $newArray ); //$newA = array($key => $val); //$decoded = array_merge($decoded, $newA); } } } } else{ // If data passed is not array we treat if($value != '_d_' ){ $decoded = $this->br2nl(rawurldecode($value)); } } } $args[] = $decoded; } else { $args[] = $this->br2nl(rawurldecode($decoded)); } $argCount++; } } # Include the main component file $comName = $_REQUEST['option']; ob_start(); global $jaxFuncNames; //check if user is in the admin interface or not if(Factory::getApplication()->isClient('administrator')){ include_once(JAX_SITE_ROOT . "/administrator/components/com_$comName/$comName.php"); // Test, and make sure $my object is valid if(!$my->id){ echo "Invalid access"; exit; } } else { include_once(JAX_SITE_ROOT . "/components/com_$comName/$comName.php"); } @ob_end_clean(); $jaxFilename = JAX_SITE_ROOT . "/components/com_$comName/jax.$comName.php"; if(file_exists($jaxFilename)){ include_once($jaxFilename); } // check and make sure the fucntion name is actually registered if(!in_array($func, $jaxFuncNames)){ echo 'Invalid Function Calls'; exit; } $funcArray = explode(',', $func); // Joomla post session token checking if ( ! Session::checkToken('post') ) { $func = $_REQUEST['func']; $list = explode(',',$func); if( $list[0] !== 'register' && $list[0] !== 'connect' && $list[1] !== 'ajaxUpdate' && $list[1] !== 'ajaxGetLoginFormToken' && $list[1] !== 'ajaxFetchCard' && $func !== 'search,ajaxSearch' && $list[1] !== 'ajaxGetTotalNotifications') { require_once(JPATH_ROOT .'/components/com_community/controllers/controller.php'); $controller = new CommunityBaseController(); echo $controller->ajaxBlockUnregister(); } } // Object call if(count($funcArray) > 1){ //$response = call_user_func_array($funcArray, $args); $entryPoint = $comName.'AjaxEntry'; $arg = array(); $arg[] = $func; $arg[] = $args; $response = call_user_func_array($entryPoint, $arg); } else $response = call_user_func_array($func, $args); //header('Content-type: text/plain'); //echo $response; //exit; } } } } PK ! ��� � JSON.phpnu �[��� <?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * Converts to and from JSON format. * * JSON (JavaScript Object Notation) is a lightweight data-interchange * format. It is easy for humans to read and write. It is easy for machines * to parse and generate. It is based on a subset of the JavaScript * Programming Language, Standard ECMA-262 3rd Edition - December 1999. * This feature can also be found in Python. JSON is a text format that is * completely language independent but uses conventions that are familiar * to programmers of the C-family of languages, including C, C++, C#, Java, * JavaScript, Perl, TCL, and many others. These properties make JSON an * ideal data-interchange language. * * This package provides a simple encoder and decoder for JSON notation. It * is intended for use with client-side Javascript applications that make * use of HTTPRequest to perform server communication functions - data can * be encoded into JSON notation for use in a client-side javascript, or * decoded from incoming Javascript requests. JSON format is native to * Javascript, and can be directly eval()'ed with no further parsing * overhead * * All strings should be in ASCII or UTF-8 format! * * LICENSE: Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: Redistributions of source code must retain the * above copyright notice, this list of conditions and the following * disclaimer. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * * @category * @package Services_JSON * @author Michal Migurski <mike-json@teczno.com> * @author Matt Knapp <mdknapp[at]gmail[dot]com> * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com> * @copyright 2005 Michal Migurski * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $ * @license http://www.opensource.org/licenses/bsd-license.php * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198 */ defined('_JEXEC') or die('Restricted access'); if(!defined('SERVICES_JSON_SLICE')){ /** * Marker constant for Services_JSON::decode(), used to flag stack state */ define('SERVICES_JSON_SLICE', 1); /** * Marker constant for Services_JSON::decode(), used to flag stack state */ define('SERVICES_JSON_IN_STR', 2); /** * Marker constant for Services_JSON::decode(), used to flag stack state */ define('SERVICES_JSON_IN_ARR', 3); /** * Marker constant for Services_JSON::decode(), used to flag stack state */ define('SERVICES_JSON_IN_OBJ', 4); /** * Marker constant for Services_JSON::decode(), used to flag stack state */ define('SERVICES_JSON_IN_CMT', 5); /** * Behavior switch for Services_JSON::decode() */ define('SERVICES_JSON_LOOSE_TYPE', 16); /** * Behavior switch for Services_JSON::decode() */ define('SERVICES_JSON_SUPPRESS_ERRORS', 32); /** * Converts to and from JSON format. * * Brief example of use: * * <code> * // create a new instance of Services_JSON * $json = new Services_JSON(); * * // convert a complexe value to JSON notation, and send it to the browser * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4))); * $output = $json->encode($value); * * print($output); * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]] * * // accept incoming POST data, assumed to be in JSON notation * $input = file_get_contents('php://input', 1000000); * $value = $json->decode($input); * </code> */ class Services_JSON { public $use = 0; /** * constructs a new JSON instance * * @param int $use object behavior flags; combine with boolean-OR * * possible values: * - SERVICES_JSON_LOOSE_TYPE: loose typing. * "{...}" syntax creates associative arrays * instead of objects in decode(). * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. * Values which can't be encoded (e.g. resources) * appear as NULL instead of throwing errors. * By default, a deeply-nested resource will * bubble up with an error, so all return values * from encode() should be checked with isError() */ function __construct($use = 0) { $this->use = $use; } /** * convert a string from one UTF-16 char to one UTF-8 char * * Normally should be handled by mb_convert_encoding, but * provides a slower PHP-only method for installations * that lack the multibye string extension. * * @param string $utf16 UTF-16 character * @return string UTF-8 character * @access private */ function utf162utf8($utf16) { // oh please oh please oh please oh please oh please if(function_exists('mb_convert_encoding')) { return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16'); } $bytes = (ord($utf16[0]) << 8) | ord($utf16[1]); switch(true) { case ((0x7F & $bytes) == $bytes): // this case should never be reached, because we are in ASCII range // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0x7F & $bytes); case (0x07FF & $bytes) == $bytes: // return a 2-byte UTF-8 character // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xC0 | (($bytes >> 6) & 0x1F)) . chr(0x80 | ($bytes & 0x3F)); case (0xFFFF & $bytes) == $bytes: // return a 3-byte UTF-8 character // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0xE0 | (($bytes >> 12) & 0x0F)) . chr(0x80 | (($bytes >> 6) & 0x3F)) . chr(0x80 | ($bytes & 0x3F)); } // ignoring UTF-32 for now, sorry return ''; } /** * convert a string from one UTF-8 char to one UTF-16 char * * Normally should be handled by mb_convert_encoding, but * provides a slower PHP-only method for installations * that lack the multibye string extension. * * @param string $utf8 UTF-8 character * @return string UTF-16 character * @access private */ function utf82utf16($utf8) { // oh please oh please oh please oh please oh please if(function_exists('mb_convert_encoding')) { return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8'); } switch(strlen($utf8)) { case 1: // this case should never be reached, because we are in ASCII range // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return $utf8; case 2: // return a UTF-16 character from a 2-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr(0x07 & (ord($utf8[0]) >> 2)) . chr((0xC0 & (ord($utf8[0]) << 6)) | (0x3F & ord($utf8[1]))); case 3: // return a UTF-16 character from a 3-byte UTF-8 char // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 return chr((0xF0 & (ord($utf8[0]) << 4)) | (0x0F & (ord($utf8[1]) >> 2))) . chr((0xC0 & (ord($utf8[1]) << 6)) | (0x7F & ord($utf8[2]))); } // ignoring UTF-32 for now, sorry return ''; } /** * encodes an arbitrary variable into JSON format * * @param mixed $var any number, boolean, string, array, or object to be encoded. * see argument 1 to Services_JSON() above for array-parsing behavior. * if var is a strng, note that encode() always expects it * to be in ASCII or UTF-8 format! * * @return mixed JSON string representation of input var or an error if a problem occurs * @access public */ function encode($var) { switch (gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; case 'NULL': return 'null'; case 'integer': return (int) $var; case 'double': case 'float': return (float) $var; case 'string': // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT $ascii = ''; $strlen_var = strlen($var); /* * Iterate over every character in the string, * escaping with a slash or encoding to UTF-8 where necessary */ for ($c = 0; $c < $strlen_var; ++$c) { $ord_var_c = ord($var[$c]); switch (true) { case $ord_var_c == 0x08: $ascii .= '\b'; break; case $ord_var_c == 0x09: $ascii .= '\t'; break; case $ord_var_c == 0x0A: $ascii .= '\n'; break; case $ord_var_c == 0x0C: $ascii .= '\f'; break; case $ord_var_c == 0x0D: $ascii .= '\r'; break; case $ord_var_c == 0x22: case $ord_var_c == 0x2F: case $ord_var_c == 0x5C: // double quote, slash, slosh $ascii .= '\\'.$var[$c]; break; case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)): // characters U-00000000 - U-0000007F (same as ASCII) $ascii .= $var[$c]; break; case (($ord_var_c & 0xE0) == 0xC0): // characters U-00000080 - U-000007FF, mask 110XXXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, ord($var[$c + 1])); $c += 1; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF0) == 0xE0): // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2])); $c += 2; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xF8) == 0xF0): // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3])); $c += 3; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFC) == 0xF8): // characters U-00200000 - U-03FFFFFF, mask 111110XX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4])); $c += 4; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; case (($ord_var_c & 0xFE) == 0xFC): // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $char = pack('C*', $ord_var_c, ord($var[$c + 1]), ord($var[$c + 2]), ord($var[$c + 3]), ord($var[$c + 4]), ord($var[$c + 5])); $c += 5; $utf16 = $this->utf82utf16($char); $ascii .= sprintf('\u%04s', bin2hex($utf16)); break; } } return '"'.$ascii.'"'; case 'array': /* * As per JSON spec if any array key is not an integer * we must treat the the whole array as an object. We * also try to catch a sparsely populated associative * array with numeric keys here because some JS engines * will create an array with empty indexes up to * max_index which can cause memory issues and because * the keys, which may be relevant, will be remapped * otherwise. * * As per the ECMA and JSON specification an object may * have any string as a property. Unfortunately due to * a hole in the ECMA specification if the key is a * ECMA reserved word or starts with a digit the * parameter is only accessible using ECMAScript's * bracket notation. */ // treat as a JSON object if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) { $properties = array_map(array($this, 'name_value'), array_keys($var), array_values($var)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; } // treat it like a regular array $elements = array_map(array($this, 'encode'), $var); foreach($elements as $element) { if(Services_JSON::isError($element)) { return $element; } } return '[' . join(',', $elements) . ']'; case 'object': $vars = get_object_vars($var); $properties = array_map(array($this, 'name_value'), array_keys($vars), array_values($vars)); foreach($properties as $property) { if(Services_JSON::isError($property)) { return $property; } } return '{' . join(',', $properties) . '}'; default: return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS) ? 'null' : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string"); } } /** * array-walking function for use in generating JSON-formatted name-value pairs * * @param string $name name of key to use * @param mixed $value reference to an array element to be encoded * * @return string JSON-formatted name-value pair, like '"name":value' * @access private */ function name_value($name, $value) { $encoded_value = $this->encode($value); if(Services_JSON::isError($encoded_value)) { return $encoded_value; } return $this->encode(strval($name)) . ':' . $encoded_value; } /** * reduce a string by removing leading and trailing comments and whitespace * * @param $str string string value to strip of comments and whitespace * * @return string string value stripped of comments and whitespace * @access private */ function reduce_string($str) { $str = preg_replace(array( // eliminate single line comments in '// ...' form '#^\s*//(.+)$#m', // eliminate multi-line comments in '/* ... */' form, at start of string '#^\s*/\*(.+)\*/#Us', // eliminate multi-line comments in '/* ... */' form, at end of string '#/\*(.+)\*/\s*$#Us' ), '', $str); // eliminate extraneous space return trim($str); } /** * decodes a JSON string into appropriate variable * * @param string $str JSON-formatted string * * @return mixed number, boolean, string, array, or object * corresponding to given JSON input string. * See argument 1 to Services_JSON() above for object-output behavior. * Note that decode() always returns strings * in ASCII or UTF-8 format! * @access public */ function decode($str) { $str = $this->reduce_string($str); switch (strtolower($str)) { case 'true': return true; case 'false': return false; case 'null': return null; default: $m = array(); if (is_numeric($str)) { // Lookie-loo, it's a number // This would work on its own, but I'm trying to be // good about returning integers where appropriate: // return (float)$str; // Return float or int, as appropriate return ((float)$str == (integer)$str) ? (integer)$str : (float)$str; } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) { // STRINGS RETURNED IN UTF-8 FORMAT $delim = substr($str, 0, 1); $chrs = substr($str, 1, -1); $utf8 = ''; $strlen_chrs = strlen($chrs); for ($c = 0; $c < $strlen_chrs; ++$c) { $substr_chrs_c_2 = substr($chrs, $c, 2); $ord_chrs_c = ord($chrs[$c]); switch (true) { case $substr_chrs_c_2 == '\b': $utf8 .= chr(0x08); ++$c; break; case $substr_chrs_c_2 == '\t': $utf8 .= chr(0x09); ++$c; break; case $substr_chrs_c_2 == '\n': $utf8 .= chr(0x0A); ++$c; break; case $substr_chrs_c_2 == '\f': $utf8 .= chr(0x0C); ++$c; break; case $substr_chrs_c_2 == '\r': $utf8 .= chr(0x0D); ++$c; break; case $substr_chrs_c_2 == '\\"': case $substr_chrs_c_2 == '\\\'': case $substr_chrs_c_2 == '\\\\': case $substr_chrs_c_2 == '\\/': if (($delim == '"' && $substr_chrs_c_2 != '\\\'') || ($delim == "'" && $substr_chrs_c_2 != '\\"')) { $utf8 .= $chrs[++$c]; } break; case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)): // single, escaped unicode character $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2))) . chr(hexdec(substr($chrs, ($c + 4), 2))); $utf8 .= $this->utf162utf8($utf16); $c += 5; break; case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F): $utf8 .= $chrs[$c]; break; case ($ord_chrs_c & 0xE0) == 0xC0: // characters U-00000080 - U-000007FF, mask 110XXXXX //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $utf8 .= substr($chrs, $c, 2); ++$c; break; case ($ord_chrs_c & 0xF0) == 0xE0: // characters U-00000800 - U-0000FFFF, mask 1110XXXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $utf8 .= substr($chrs, $c, 3); $c += 2; break; case ($ord_chrs_c & 0xF8) == 0xF0: // characters U-00010000 - U-001FFFFF, mask 11110XXX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $utf8 .= substr($chrs, $c, 4); $c += 3; break; case ($ord_chrs_c & 0xFC) == 0xF8: // characters U-00200000 - U-03FFFFFF, mask 111110XX // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $utf8 .= substr($chrs, $c, 5); $c += 4; break; case ($ord_chrs_c & 0xFE) == 0xFC: // characters U-04000000 - U-7FFFFFFF, mask 1111110X // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 $utf8 .= substr($chrs, $c, 6); $c += 5; break; } } return $utf8; } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) { // array, or object notation if ($str[0] == '[') { $stk = array(SERVICES_JSON_IN_ARR); $arr = array(); } else { if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $stk = array(SERVICES_JSON_IN_OBJ); $obj = array(); } else { $stk = array(SERVICES_JSON_IN_OBJ); $obj = new stdClass(); } } array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => 0, 'delim' => false)); $chrs = substr($str, 1, -1); $chrs = $this->reduce_string($chrs); if ($chrs == '') { if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } else { return $obj; } } //print("\nparsing {$chrs}\n"); $strlen_chrs = strlen($chrs); for ($c = 0; $c <= $strlen_chrs; ++$c) { $top = end($stk); $substr_chrs_c_2 = substr($chrs, $c, 2); if (($c == $strlen_chrs) || (($chrs[$c] == ',') && ($top['what'] == SERVICES_JSON_SLICE))) { // found a comma that is not inside a string, array, etc., // OR we've reached the end of the character list $slice = substr($chrs, $top['where'], ($c - $top['where'])); array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false)); //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); if (reset($stk) == SERVICES_JSON_IN_ARR) { // we are in an array, so just push an element onto the stack array_push($arr, $this->decode($slice)); } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { // we are in an object, so figure // out the property name and set an // element in an associative array, // for now $parts = array(); if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { // "name":value pair $key = $this->decode($parts[1]); $val = $this->decode($parts[2]); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) { // name:value pair, where name is unquoted $key = $parts[1]; $val = $this->decode($parts[2]); if ($this->use & SERVICES_JSON_LOOSE_TYPE) { $obj[$key] = $val; } else { $obj->$key = $val; } } } } elseif ((($chrs[$c] == '"') || ($chrs[$c] == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) { // found a quote, and we are not inside a string array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs[$c])); //print("Found start of string at {$c}\n"); } elseif (($chrs[$c] == $top['delim']) && ($top['what'] == SERVICES_JSON_IN_STR) && ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) { // found a quote, we're in a string, and it's not escaped // we know that it's not escaped becase there is _not_ an // odd number of backslashes at the end of the string so far array_pop($stk); //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n"); } elseif (($chrs[$c] == '[') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { // found a left-bracket, and we are in an array, object, or slice array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false)); //print("Found start of array at {$c}\n"); } elseif (($chrs[$c] == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) { // found a right-bracket, and we're in an array array_pop($stk); //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); } elseif (($chrs[$c] == '{') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { // found a left-brace, and we are in an array, object, or slice array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false)); //print("Found start of object at {$c}\n"); } elseif (($chrs[$c] == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) { // found a right-brace, and we're in an object array_pop($stk); //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); } elseif (($substr_chrs_c_2 == '/*') && in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) { // found a comment start, and we are in an array, object, or slice array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false)); $c++; //print("Found start of comment at {$c}\n"); } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) { // found a comment end, and we're in one now array_pop($stk); $c++; for ($i = $top['where']; $i <= $c; ++$i) $chrs = substr_replace($chrs, ' ', $i, 1); //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n"); } } if (reset($stk) == SERVICES_JSON_IN_ARR) { return $arr; } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) { return $obj; } } } } /** * @todo Ultimately, this should just call PEAR::isError() */ function isError($data, $code = null) { if (class_exists('pear')) { return PEAR::isError($data, $code); } elseif (is_object($data) && (get_class($data) == 'services_json_error' || is_subclass_of($data, 'services_json_error'))) { return true; } return false; } } if (class_exists('PEAR_Error')) { class Services_JSON_Error extends PEAR_Error { function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { parent::PEAR_Error($message, $code, $mode, $options, $userinfo); } } } else { /** * @todo Ultimately, this class shall be descended from PEAR_Error */ class Services_JSON_Error { function __construct($message = 'unknown error', $code = null, $mode = null, $options = null, $userinfo = null) { } } } } PK ! ;A�Z4 4 helper.phpnu �[��� <?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ use Joomla\CMS\Uri\Uri; defined( '_JEXEC' ) or die( 'Restricted access' ); if( !defined( 'AZRUL_SYSTEM_LIVE' ) ) { if(basename(dirname(dirname(dirname(__FILE__)))) == 'plugins'){ //Joomla 1.5 and above define( 'AZRUL_SYSTEM_LIVE' , Uri::root(true) . '/plugins/system' ); } else { define( 'AZRUL_SYSTEM_LIVE' , Uri::root(true) . '/plugins/system/jomsocial.system' ); } } if( !defined( 'AZRUL_BASE_LIVE' ) ) { define( 'AZRUL_BASE_LIVE' , rtrim( Uri::base() , '/' ) ); }PK ! +φ�� � template.phpnu �[��� <?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <webmaster@ijoomla.com> * @url https://www.jomsocial.com/license-agreement * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 * More info at https://www.jomsocial.com/license-agreement */ (defined('_VALID_MOS') or defined('_JEXEC')) or die('Direct Access to this location is not allowed.'); // Include our custom cmslib if(!defined('AZ_CACHE_PATH')) define('AZ_CACHE_PATH',(dirname(dirname(dirname(dirname(__FILE__))))). '/components/libraries/cmslib/cache'); /** * Original code by Brian Lozier * http://www.massassi.com/php/articles/template_engines/ * Modified by Azrul (www.azrul.com) to run on Joomla */ class AzrulJXTemplate { var $vars; /// Holds all the template variables /** * Constructor * * @param $file string the file name you want to load */ function __construct($file = null) { $this->file = $file; @ini_set('short_open_tag', 'On'); } /** * Set a template variable. */ function set($name, $value) { $this->vars[$name] = is_object($value) ? $value->fetch() : $value; } /** * Open, parse, and return the template file. * * @param $file string the template file name */ function fetch($file = null) { if(!$file) $file = $this->file; if($this->vars) extract($this->vars); // Extract the vars to local namespace ob_start(); // Start output buffering include($file); // Include the file $contents = ob_get_contents(); // Get the contents of the buffer ob_end_clean(); // End buffering and discard return $contents; // Return the contents } function object_to_array($obj) { $_arr = is_object($obj) ? get_object_vars($obj) : $obj; $arr = array(); foreach ($_arr as $key => $val) { $val = (is_array($val) || is_object($val)) ? $this->object_to_array($val) : $val; $arr[$key] = $val; } return $arr; } } class AzrulJXCachedTemplate extends AzrulJXTemplate { var $cache_id; var $expire; var $cached; var $file; /** * Constructor. * * @param $cache_id string unique cache identifier * @param $expire int number of seconds the cache will live */ function __construct($cache_id = "", $cache_timeout = 10000) { $this->AzrulJXTemplate(); $this->cache_id = AZ_CACHE_PATH . "/cache__". md5($cache_id); $this->cached = false; $this->expire = $cache_timeout; } /** * Test to see whether the currently loaded cache_id has a valid * corrosponding cache file. */ function is_cached() { //return false; if($this->cached) return true; // Passed a cache_id? if(!$this->cache_id) return false; // Cache file exists? if(!file_exists($this->cache_id)) return false; // Can get the time of the file? if(!($mtime = filemtime($this->cache_id))) return false; // Cache expired? // Implemented as 'never-expires' cache, so, the data need to change // for the cache to be modified if(($mtime + $this->expire) < time()) { @unlink($this->cache_id); return false; } else { /** * Cache the results of this is_cached() call. Why? So * we don't have to double the overhead for each template. * If we didn't cache, it would be hitting the file system * twice as much (file_exists() & filemtime() [twice each]). */ $this->cached = true; return true; } } /** * This function returns a cached copy of a template (if it exists), * otherwise, it parses it as normal and caches the content. * * @param $file string the template file */ function fetch_cache($file, $processFunc = null) { $contents = ""; if($this->is_cached()) { $fp = @fopen($this->cache_id, 'r'); if($fp){ $filesize = filesize($this->cache_id); if($filesize > 0){ $contents = fread($fp, $filesize); } fclose($fp); } else { $contents = $this->fetch($file); } } else { $contents = $this->fetch($file); // Check if caller wants to process contents with another function if($processFunc && is_callable($processFunc)){ $contents = $processFunc($contents); } if(!empty($contents)){ // Write the cache, only if there is some data if($fp = @fopen($this->cache_id, 'w')) { fwrite($fp, $contents); fclose($fp); } else { //die('Unable to write cache.'); } } } return $contents; } } PK ! ��VV�O �O ajax_1.5.jsnu �[��� function Jax() { var loadingTimeout = 400; var iframe; this.loadingFunction = function(){}; this.doneLoadingFunction = function(){}; this.cacheData = new Array(); this.stringify = function(arg){ var c, i, l, o, u, v; switch (typeof arg) { case 'object': //alert('obj'); if (arg) { if (arg.constructor == Array) { o = ''; for (i = 0; i < arg.length; ++i) { v = this.stringify(arg[i]); if (o && (v !== u)) { o += ','; } if (v !== u) { o += v; } } return '[' + o + ']'; } else if (typeof arg.toString != 'undefined') { o = ''; for (i in arg) { v = this.stringify(arg[i]); if (v !== u) { if (o) { o += ','; } o += this.stringify(i) + ':' + v; } } return '{' + o + '}'; } else { return; } } //return 'null'; return ''; case 'unknown': case 'undefined': case 'function': return u; case 'string': arg = arg.replace(/"/g, "\\\""); l = arg.length; o = '"'; for (i = 0; i < l; i += 1) { c = arg.charAt(i); if (c >= ' ') { if (c == '\\' || c == '"') { o += '\\'; } o += c; } else { switch (c) { case '"': o += '\\"'; break; case '\b': o += '\\b'; break; case '\f': o += '\\f'; break; case '\n': o += '\\n'; break; case '\r': o += '\\r'; break; case '\t': o += '\\t'; break; default: c = c.charCodeAt(); o += '\\u00'; o += Math.floor(c / 16).toString(16); o += (c % 16).toString(16); } } } return o + '"'; default: return String(arg); } } /** * Get XMLHttpObject */ this.getRequestObject = function() { if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE var msxmlhttp = new Array( 'Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP'); for (var i = 0; i < msxmlhttp.length; i++) { try { http_request = new ActiveXObject(msxmlhttp[i]); } catch (e) { http_request = null; } } } if (!http_request) { alert('Unfortunatelly you browser doesn\'t support this feature.'); return false; } return http_request; } /** * xajax.$() is shorthand for document.getElementById() */ this.$ = function(sId) { if (!sId) { return null; } var returnObj = document.getElementById(sId); if (!returnObj && document.all) { returnObj = document.all[sId]; } return returnObj; } this.addEvent = function ( obj, type, fn ) { if ( obj.attachEvent ) { obj['e'+type+fn] = fn; obj[type+fn] = function(){obj['e'+type+fn]( window.event );} obj.attachEvent( 'on'+type, obj[type+fn] ); } else{ obj.addEventListener( type, fn, false );} } this.removeEvent = function ( obj, type, fn ) { if ( obj.detachEvent ) { obj.detachEvent( 'on'+type, obj[type+fn] ); obj[type+fn] = null; } else{ obj.removeEventListener( type, fn, false );} } this.submitITask = function(comName, func, postData, responseFunc){ var xmlReq = this.buildXmlReq(comName, func, postData, responseFunc, true); this.loadingFunction(); if(!this.iframe){ this.iframe = document.createElement('iframe'); this.iframe.setAttribute("id", 'ajaxIframe'); this.iframe.setAttribute("height", 0); this.iframe.setAttribute("width", 0); this.iframe.setAttribute("border", 0); this.iframe.style.visibility = 'hidden'; document.body.appendChild(this.iframe); this.iframe.src = xmlReq; } else { this.iframe.src = xmlReq; } } this.extractIFrameBody = function(iFrameEl) { var doc = null; if (iFrameEl.contentDocument) { // For NS6 doc = iFrameEl.contentDocument; } else if (iFrameEl.contentWindow) { // For IE5.5 and IE6 doc = iFrameEl.contentWindow.document; } else if (iFrameEl.document) { // For IE5 doc = iFrameEl.document; } else { alert("Error: could not find sumiFrame document"); return null; } return doc.body; } this.buildXmlReq = function(comName, func, postData, responseFunc, iframe){ var xmlReq = ''; if(iframe){ xmlReq += '?';} else{ xmlReq += '&';} xmlReq += 'option='+ comName; xmlReq += '&no_html=1'; xmlReq += '&task=azrul_ajax'; xmlReq += '&func=' + func; xmlReq += '&'+ jax_token_var + '=1'; if(postData){ xmlReq += "&" + postData; } return xmlReq; } /** * Sumbit ajax task */ this.submitTask = function(comName, func, postData, responseFunc, cacheKey){ var xmlhttp = this.getRequestObject(); var targetUrl = jax_live_site; var responseLength = 0; var lastResponseLength = 0; var lastResponse = ''; if( cacheKey ){ xmlhttp.cachekey = cacheKey; } xmlhttp.open('POST', targetUrl, true); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 200){ jax.doneLoadingFunction(); var text = xmlhttp.responseText; if(text !== undefined && text !== null){ if(text.length > 0){ text = text.substr(responseLength - lastResponseLength); responseLength = xmlhttp.responseText.length; if(lastResponse != text) { jax.processResponse(text); } lastResponse = text; /*jax.processResponse(xmlhttp.responseText); if( xmlhttp.cachekey ){ jax.cacheData[xmlhttp.cachekey] = xmlhttp.responseText; }*/ } }else{ lastResponseLength = 0; } if( xmlhttp.cachekey ){ jax.cacheData[xmlhttp.cachekey] = text; } }else { // warning ajax fails } // http://stackoverflow.com/questions/7287706/ie-9-javascript-error-c00c023f } else if (xmlhttp.readyState == 3) { if (xmlhttp.status == 200) { var text = xmlhttp.responseText; var validresponse = true; //make sure that the result text is a valid value try { if(text !== undefined && text !== null){ if(text.length > 0){ text = text.substr(responseLength, text.length-responseLength); eval( text ); responseLength = xmlhttp.responseText.length; lastResponseLength = text.length if(lastResponse != text) { jax.processResponse(text); } lastResponse = text; //console.log('TEXT:' + text); } } }catch (e) { //sometimes the response is chunked, this not a valid string to be eval()'ed. //lets just ignore this } } } } var id = 1; var xmlReq = this.buildXmlReq(comName, func, postData, responseFunc); this.loadingFunction(); xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xmlhttp.send(xmlReq); } this.processIResponse = function(){ jax.doneLoadingFunction(); var resp = (this.extractIFrameBody(this.iframe).innerHTML); resp = resp.replace(/</g, "<"); resp = resp.replace(/>/g, ">"); resp = resp.replace(/&/g, "&"); resp = resp.replace(/"/g, '"'); resp = resp.replace(/'/g, "'"); this.processResponse(resp); } // BetterInnerHTML v1.2, (C) OptimalWorks.net this.BetterInnerHTML = function(o,p,q){function r(a){var b;if(typeof DOMParser!="undefined")b=(new DOMParser()).parseFromString(a,"application/xml");else{var c=["MSXML2.DOMDocument","MSXML.DOMDocument","Microsoft.XMLDOM"];for(var i=0;i<c.length&&!b;i++){try{b=new ActiveXObject(c[i]);b.loadXML(a)}catch(e){}}}return b}function s(a,b,c){a[b]=function(){return eval(c)}}function t(b,c,d){if(typeof d=="undefined")d=1;if(d>1){if(c.nodeType==1){var e=document.createElement(c.nodeName);var f={};for(var a=0,g=c.attributes.length;a<g;a++){var h=c.attributes[a].name,k=c.attributes[a].value,l=(h.substr(0,2)=="on");if(l)f[h]=k;else{switch(h){case"class":e.className=k;break;case"for":e.htmlFor=k;break;default:e.setAttribute(h,k)}}}b=b.appendChild(e);for(l in f)s(b,l,f[l])}else if(c.nodeType==3){var m=(c.nodeValue?c.nodeValue:"");var n=m.replace(/^\s*|\s*$/g,"");if(n.length<7||(n.indexOf("<!--")!=0&&n.indexOf("-->")!=(n.length-3)))b.appendChild(document.createTextNode(m))}}for(var i=0,j=c.childNodes.length;i<j;i++)t(b,c.childNodes[i],d+1)}p="<root>"+p+"</root>";var u=r(p);if(o&&u){if(q!=false)while(o.lastChild)o.removeChild(o.lastChild);t(o,u.documentElement)}} /** * Process the json string */ this.processResponse = function(responseTxt){ // We try to get rid of any error within the return values //responses = responseTxt.split(/.*\[\["as","ajax_calls","d",""\],/); // The code below cannot be use since it causes massive slowdowns //if(responses.length > 1){ // responseTxt = '[' + responses[1]; //} // clean up any previous error var result = eval( responseTxt ); // we now have an array, that contains an array. for(var i=0; i<result.length;i++){ var cmd = result[i][0]; var id = result[i][1]; var property = result[i][2]; var data = result[i][3]; var objElement = this.$(id); switch(cmd){ case 'as': // assign or clear if(objElement){ // data = data.replace(/"/g, "\\\""); // data = data.replace(/{/g, "{"); // data = data.replace(/}/g, "}"); /* * BetterInnerHTML cannot be used since it * causes XML validation error */ //if(property == 'innerHTML'){ // this.BetterInnerHTML(objElement, data); //} //else //{ eval("objElement."+property+"= data \; "); //} } break; case 'al': // alert if(data){ alert(data);} break; case 'ce': this.create(id,property, data); break; case 'rm': this.remove(id); break; case 'cs': // call script var scr = id + '('; if(this.isArray(data)){ scr += '(data[0])'; for (var l=1; l<data.length; l++) { scr += ',(data['+l+'])'; } } else { scr += 'data'; } scr += ');'; eval(scr); break; default: alert("Unknow command: " + cmd); } } //delete responseTxt; } /** * */ this.isArray = function(obj) { // this works if(obj){ return obj.constructor == Array; } return false; } this.buildCall = function(comName, sFunction){ } this.icall = function(comName, sFunction){ var arg = ""; if(arguments.length > 2){ for(var i=2; i < arguments.length; i++){ var a = arguments[i]; if(this.isArray(a)){ arg += "arg" + i + "=" + this.stringify(a) + "&"; }else if(typeof a =="string"){ var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } else { var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } } } this.submitITask(comName, sFunction, arg); } /** * Universal Hash */ this.universalHash = function (s, tableSize) { var b = 27183, h = 0, a = 31415; if (tableSize > 1) { for (i = 0; i < s.length; i++) { var t = (s[i]) ? s[i] : s.charAt(i); h = (a * h + t.charCodeAt()) % tableSize; a = ((a % tableSize) * (b % tableSize)) % (tableSize); } } return h; } /** * Cache return data intenally */ this.cacheCall = function(comName, sFunction){ var arg = this.buildArgs(arguments); // 8048 = max number of cached calls it can handle var key = this.universalHash( comName + '-' + sFunction + '-' +arg, 8048 ); if( key in this.cacheData ){ // If this key is cache, just process the data // no need to do ajax call this.processResponse(this.cacheData[key] ); return; } this.submitTask(comName, sFunction, arg, null, key); } /** * Function call to PHP function */ this.call = function(comName, sFunction){ var arg = ""; /* if(arguments.length > 2){ for(var i=2; i < arguments.length; i++){ var a = arguments[i]; if(this.isArray(a)){ arg += "arg" + i + "=" + this.stringify(a) + "&"; }else if(typeof a =="string"){ a = a.replace(/"/g, """); var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } else { var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } } } */ arg = this.buildArgs(arguments); this.submitTask(comName, sFunction, arg); } /** * Buidl argument into string */ this.buildArgs = function(arguments){ var arg = ""; if(arguments.length > 2){ for(var i=2; i < arguments.length; i++){ var a = arguments[i]; if(this.isArray(a)){ arg += "arg" + i + "=" + this.stringify(a) + "&"; }else if(typeof a =="string"){ a = a.replace(/"/g, """); var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } else { var t = new Array('_d_', encodeURIComponent(a)); arg += "arg" + i + "=" + this.stringify(t) + "&"; } } } return arg; } this.create = function(sParentId, sTag, sId){ var objParent = this.$(sParentId); objElement = document.createElement(sTag); objElement.setAttribute('id',sId); if (objParent){ objParent.appendChild(objElement);} } this.remove = function(sId){ objElement = this.$(sId); if (objElement && objElement.parentNode && objElement.parentNode.removeChild) { objElement.parentNode.removeChild(objElement); } } /** * Return an array of data within the form object */ this.getFormValues = function(frm){ var objForm; objForm = this.$(frm); if (!Array.prototype.indexOf) { Array.prototype.indexOf = function(elt /*, from*/) { var len = this.length; var from = Number(arguments[1]) || 0; from = (from < 0) ? Math.ceil(from) : Math.floor(from); if (from < 0) from += len; for (; from < len; from++) { if (from in this && this[from] === elt) return from; } return -1; }; } var postData = new Array(); if (objForm && objForm.tagName == 'FORM'){ var formElements = objForm.elements; //uses for checkbox elements var assCheckbox = new Array(); var assCntIdx = 0; //var startIdx = 0; // Array values var arrayHiddenValues = new Array(); var arrayHiddenCount = 0; if(formElements.length > 0){ for( var i=0; i < formElements.length; i++) { if (!formElements[i].name) { continue; } if (formElements[i].type && (formElements[i].type == 'radio' || formElements[i].type == 'checkbox') && formElements[i].checked == false) { continue; } var name = formElements[i].name; if (name) { if(formElements[i].type=='select-multiple') { postData[i] = new Array(); for (var j = 0; j < formElements[i].length; j++) { if (formElements[i].options[j].selected === true) { var value = formElements[i].options[j].value; postData[i][j] = new Array(name, encodeURIComponent(value)); } } //startIdx++; } else if(formElements[i].type=='checkbox') { if(assCheckbox.indexOf(formElements[i].name) == -1) { assCheckbox[assCntIdx] = formElements[i].name assCntIdx++; } } else if( formElements[i].type == 'hidden' ) { if( arrayHiddenValues.indexOf( formElements[i].name ) == -1 ) { arrayHiddenValues[ arrayHiddenCount ] = formElements[ i ].name; arrayHiddenCount++; } } else { var value = formElements[i].value; //value.replace(/"/g, "\\\""); value = value.replace(/"/g, """); postData[i] = new Array(name, encodeURIComponent(value)); //startIdx++; } } } }//end if // Process hidden values if( arrayHiddenValues.length > 0 ) { for( var i =0 ;i < arrayHiddenValues.length; i++ ) { var hiddenElement = document.getElementsByName( arrayHiddenValues[ i ] ); if( hiddenElement ) { // Test if the hidden elements is array when same name is used. if( hiddenElement.length > 1 ) { var curLen = postData.length; postData[curLen] = new Array(); for(var j=0; j < hiddenElement.length; j++) { var value = hiddenElement[j].value; value = value.replace(/"/g, """); postData[curLen][j] = new Array(arrayHiddenValues[i], encodeURIComponent(value)); } } else { var value = hiddenElement[0].value; value = value.replace(/"/g, """); postData[postData.length] = new Array(arrayHiddenValues[i], encodeURIComponent(value)); } } } } /**** * Use postData.length to determine the current length of the array. Don't need to use startidx * since we only need to append the checkbox values. ***/ //process checkbox elements here. if(assCheckbox.length > 0) { for(var i=0 ; i < assCheckbox.length; i++) { var objCheckbox = document.getElementsByName(assCheckbox[i]); if(objCheckbox) { //multiple checkbox processing here if(objCheckbox.length > 1) { var tmpIdx = 0; //postData[i + startIdx] = new Array(); var curLen = postData.length; postData[curLen] = new Array(); for(var j=0; j < objCheckbox.length; j++) { if(objCheckbox[j].checked) { var value = objCheckbox[j].value; value = value.replace(/"/g, """); postData[curLen][j] = new Array(assCheckbox[i], encodeURIComponent(value)); //postData[i + startIdx][j] = new Array(assCheckbox[i], encodeURIComponent(value)); tmpIdx++; }//end if }//end for //if(tmpIdx > 0) {startIdx++;} } else { //single checkbox proccessing if(objCheckbox[0].checked) { var value = objCheckbox[0].value; value = value.replace(/"/g, """); postData[postData.length] = new Array(assCheckbox[i], encodeURIComponent(value)); //postData[i + startIdx] = new Array(assCheckbox[i], encodeURIComponent(value)); //startIdx++; }//end ff } }//end if }//end for }//end if } return postData; } } function jax_iresponse(){ jax.processIResponse(); } var jax = new Jax(); PK ! �c�+ �+ ajax_1.5.pack.jsnu �[��� PK ! �X�e�Q �Q 8, ajax.phpnu �[��� PK ! ��� � ~ JSON.phpnu �[��� PK ! ;A�Z4 4 m helper.phpnu �[��� PK ! +φ�� � � template.phpnu �[��� PK ! ��VV�O �O �" ajax_1.5.jsnu �[��� PK � �r
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0.06 |
proxy
|
phpinfo
|
ÐаÑтройка