ona  18.1.1
About: OpenNetAdmin provides a database managed inventory of your IP network (with Web and CLI interface).
  Fossies Dox: ona-18.1.1.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

xajax.inc.php
Go to the documentation of this file.
1 <?php
37 /*
38  ----------------------------------------------------------------------------
39  | Online documentation for this class is available on the xajax wiki at: |
40  | http://wiki.xajaxproject.org/Documentation:xajax.inc.php |
41  ----------------------------------------------------------------------------
42 */
43 
48 if (!defined ('XAJAX_DEFAULT_CHAR_ENCODING'))
49 {
50  define ('XAJAX_DEFAULT_CHAR_ENCODING', 'utf-8' );
51 }
52 
53 require_once(dirname(__FILE__)."/xajaxResponse.inc.php");
54 
58 if (!defined ('XAJAX_GET'))
59 {
60  define ('XAJAX_GET', 0);
61 }
62 if (!defined ('XAJAX_POST'))
63 {
64  define ('XAJAX_POST', 1);
65 }
66 
75 class xajax
76 {
87  var $aObjects;
115  var $bDebug;
159  var $iPos;
160 
172  function xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding=XAJAX_DEFAULT_CHAR_ENCODING,$bDebug=false)
173  {
174  $this->aFunctions = array();
175  $this->aObjects = array();
176  $this->aFunctionIncludeFiles = array();
177  $this->sRequestURI = $sRequestURI;
178  if ($this->sRequestURI == "")
179  $this->sRequestURI = $this->_detectURI();
180  $this->sWrapperPrefix = $sWrapperPrefix;
181  $this->bDebug = $bDebug;
182  $this->bStatusMessages = false;
183  $this->bWaitCursor = true;
184  $this->bExitAllowed = true;
185  $this->bErrorHandler = false;
186  $this->sLogFile = "";
187  $this->bCleanBuffer = false;
188  $this->setCharEncoding($sEncoding);
189  $this->bDecodeUTF8Input = false;
190  $this->bOutputEntities = false;
191  }
192 
201  {
202  $this->sRequestURI = $sRequestURI;
203  }
204 
211  //
212  function setWrapperPrefix($sPrefix)
213  {
214  $this->sWrapperPrefix = $sPrefix;
215  }
216 
220  function debugOn()
221  {
222  $this->bDebug = true;
223  }
224 
228  function debugOff()
229  {
230  $this->bDebug = false;
231  }
232 
236  function statusMessagesOn()
237  {
238  $this->bStatusMessages = true;
239  }
240 
244  function statusMessagesOff()
245  {
246  $this->bStatusMessages = false;
247  }
248 
252  function waitCursorOn()
253  {
254  $this->bWaitCursor = true;
255  }
256 
260  function waitCursorOff()
261  {
262  $this->bWaitCursor = false;
263  }
264 
269  function exitAllowedOn()
270  {
271  $this->bExitAllowed = true;
272  }
273 
278  function exitAllowedOff()
279  {
280  $this->bExitAllowed = false;
281  }
282 
288  function errorHandlerOn()
289  {
290  $this->bErrorHandler = true;
291  }
292 
296  function errorHandlerOff()
297  {
298  $this->bErrorHandler = false;
299  }
300 
307  function setLogFile($sFilename)
308  {
309  $this->sLogFile = $sFilename;
310  }
311 
316  function cleanBufferOn()
317  {
318  $this->bCleanBuffer = true;
319  }
323  function cleanBufferOff()
324  {
325  $this->bCleanBuffer = false;
326  }
327 
339  {
340  $this->sEncoding = $sEncoding;
341  }
342 
348  function decodeUTF8InputOn()
349  {
350  $this->bDecodeUTF8Input = true;
351  }
352 
357  {
358  $this->bDecodeUTF8Input = false;
359  }
360 
365  function outputEntitiesOn()
366  {
367  $this->bOutputEntities = true;
368  }
369 
374  function outputEntitiesOff()
375  {
376  $this->bOutputEntities = false;
377  }
378 
398  function registerFunction($mFunction,$sRequestType=XAJAX_POST)
399  {
400  if (is_array($mFunction)) {
401  $this->aFunctions[$mFunction[0]] = 1;
402  $this->aFunctionRequestTypes[$mFunction[0]] = $sRequestType;
403  $this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
404  }
405  else {
406  $this->aFunctions[$mFunction] = 1;
407  $this->aFunctionRequestTypes[$mFunction] = $sRequestType;
408  }
409  }
410 
425  function registerExternalFunction($mFunction,$sIncludeFile,$sRequestType=XAJAX_POST)
426  {
427  $this->registerFunction($mFunction, $sRequestType);
428 
429  if (is_array($mFunction)) {
430  $this->aFunctionIncludeFiles[$mFunction[0]] = $sIncludeFile;
431  }
432  else {
433  $this->aFunctionIncludeFiles[$mFunction] = $sIncludeFile;
434  }
435  }
436 
451  function registerCatchAllFunction($mFunction)
452  {
453  if (is_array($mFunction)) {
454  $this->sCatchAllFunction = $mFunction[0];
455  $this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
456  }
457  else {
458  $this->sCatchAllFunction = $mFunction;
459  }
460  }
461 
477  function registerPreFunction($mFunction)
478  {
479  if (is_array($mFunction)) {
480  $this->sPreFunction = $mFunction[0];
481  $this->aObjects[$mFunction[0]] = array_slice($mFunction, 1);
482  }
483  else {
484  $this->sPreFunction = $mFunction;
485  }
486  }
487 
496  {
497  if ($this->getRequestMode() != -1) return true;
498  return false;
499  }
500 
507  function getRequestMode()
508  {
509  if (!empty($_GET["xajax"]))
510  return XAJAX_GET;
511 
512  if (!empty($_POST["xajax"]))
513  return XAJAX_POST;
514 
515  return -1;
516  }
517 
526  function processRequests()
527  {
528 
529  $requestMode = -1;
530  $sFunctionName = "";
531  $bFoundFunction = true;
532  $bFunctionIsCatchAll = false;
533  $sFunctionNameForSpecial = "";
534  $aArgs = array();
535  $sPreResponse = "";
536  $bEndRequest = false;
537  $sResponse = "";
538 
539  $requestMode = $this->getRequestMode();
540  if ($requestMode == -1) return;
541 
542  if ($requestMode == XAJAX_POST)
543  {
544  $sFunctionName = $_POST["xajax"];
545 
546  if (!empty($_POST["xajaxargs"]))
547  $aArgs = $_POST["xajaxargs"];
548  }
549  else
550  {
551  header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
552  header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
553  header ("Cache-Control: no-cache, must-revalidate");
554  header ("Pragma: no-cache");
555 
556  $sFunctionName = $_GET["xajax"];
557 
558  if (!empty($_GET["xajaxargs"]))
559  $aArgs = $_GET["xajaxargs"];
560  }
561 
562  // Use xajax error handler if necessary
563  if ($this->bErrorHandler) {
564  $GLOBALS['xajaxErrorHandlerText'] = "";
565  set_error_handler("xajaxErrorHandler");
566  }
567 
568  if ($this->sPreFunction) {
569  if (!$this->_isFunctionCallable($this->sPreFunction)) {
570  $bFoundFunction = false;
571  $objResponse = new xajaxResponse();
572  $objResponse->addAlert("Unknown Pre-Function ". $this->sPreFunction);
573  $sResponse = $objResponse->getXML();
574  }
575  }
576  //include any external dependencies associated with this function name
577  if (array_key_exists($sFunctionName,$this->aFunctionIncludeFiles))
578  {
579  ob_start();
580  include_once($this->aFunctionIncludeFiles[$sFunctionName]);
581  ob_end_clean();
582  }
583 
584  if ($bFoundFunction) {
585  $sFunctionNameForSpecial = $sFunctionName;
586  if (!array_key_exists($sFunctionName, $this->aFunctions))
587  {
588  if ($this->sCatchAllFunction) {
589  $sFunctionName = $this->sCatchAllFunction;
590  $bFunctionIsCatchAll = true;
591  }
592  else {
593  $bFoundFunction = false;
594  $objResponse = new xajaxResponse();
595  $objResponse->addAlert("Unknown Function $sFunctionName.");
596  $sResponse = $objResponse->getXML();
597  }
598  }
599  else if ($this->aFunctionRequestTypes[$sFunctionName] != $requestMode)
600  {
601  $bFoundFunction = false;
602  $objResponse = new xajaxResponse();
603  $objResponse->addAlert("Incorrect Request Type.");
604  $sResponse = $objResponse->getXML();
605  }
606  }
607 
608  if ($bFoundFunction)
609  {
610  for ($i = 0; $i < sizeof($aArgs); $i++)
611  {
612  // If magic quotes is on, then we need to strip the slashes from the args
613  if (get_magic_quotes_gpc() == 1 && is_string($aArgs[$i])) {
614 
615  $aArgs[$i] = stripslashes($aArgs[$i]);
616  }
617  if (stristr($aArgs[$i],"<xjxobj>") != false)
618  {
619  $aArgs[$i] = $this->_xmlToArray("xjxobj",$aArgs[$i]);
620  }
621  else if (stristr($aArgs[$i],"<xjxquery>") != false)
622  {
623  $aArgs[$i] = $this->_xmlToArray("xjxquery",$aArgs[$i]);
624  }
625  else if ($this->bDecodeUTF8Input)
626  {
627  $aArgs[$i] = $this->_decodeUTF8Data($aArgs[$i]);
628  }
629  }
630 
631  if ($this->sPreFunction) {
632  $mPreResponse = $this->_callFunction($this->sPreFunction, array($sFunctionNameForSpecial, $aArgs));
633  if (is_array($mPreResponse) && $mPreResponse[0] === false) {
634  $bEndRequest = true;
635  $sPreResponse = $mPreResponse[1];
636  }
637  else {
638  $sPreResponse = $mPreResponse;
639  }
640  if (is_a($sPreResponse, "xajaxResponse")) {
641  $sPreResponse = $sPreResponse->getXML();
642  }
643  if ($bEndRequest) $sResponse = $sPreResponse;
644  }
645 
646  if (!$bEndRequest) {
647  if (!$this->_isFunctionCallable($sFunctionName)) {
648  $objResponse = new xajaxResponse();
649  $objResponse->addAlert("The Registered Function $sFunctionName Could Not Be Found.");
650  $sResponse = $objResponse->getXML();
651  }
652  else {
653  if ($bFunctionIsCatchAll) {
654  $aArgs = array($sFunctionNameForSpecial, $aArgs);
655  }
656  $sResponse = $this->_callFunction($sFunctionName, $aArgs);
657  }
658  if (is_a($sResponse, "xajaxResponse")) {
659  $sResponse = $sResponse->getXML();
660  }
661  if (!is_string($sResponse) || strpos($sResponse, "<xjx>") === FALSE) {
662  $objResponse = new xajaxResponse();
663  $objResponse->addAlert("No XML Response Was Returned By Function $sFunctionName.");
664  $sResponse = $objResponse->getXML();
665  }
666  else if ($sPreResponse != "") {
667  $sNewResponse = new xajaxResponse($this->sEncoding, $this->bOutputEntities);
668  $sNewResponse->loadXML($sPreResponse);
669  $sNewResponse->loadXML($sResponse);
670  $sResponse = $sNewResponse->getXML();
671  }
672  }
673  }
674 
675  $sContentHeader = "Content-type: text/xml;";
676  if ($this->sEncoding && strlen(trim($this->sEncoding)) > 0)
677  $sContentHeader .= " charset=".$this->sEncoding;
678  header($sContentHeader);
679  if ($this->bErrorHandler && !empty( $GLOBALS['xajaxErrorHandlerText'] )) {
680  $sErrorResponse = new xajaxResponse();
681  $sErrorResponse->addAlert("** PHP Error Messages: **" . $GLOBALS['xajaxErrorHandlerText']);
682  if ($this->sLogFile) {
683  $fH = @fopen($this->sLogFile, "a");
684  if (!$fH) {
685  $sErrorResponse->addAlert("** Logging Error **\n\nxajax was unable to write to the error log file:\n" . $this->sLogFile);
686  }
687  else {
688  fwrite($fH, "** xajax Error Log - " . strftime("%b %e %Y %I:%M:%S %p") . " **" . $GLOBALS['xajaxErrorHandlerText'] . "\n\n\n");
689  fclose($fH);
690  }
691  }
692 
693  $sErrorResponse->loadXML($sResponse);
694  $sResponse = $sErrorResponse->getXML();
695 
696  }
697  if ($this->bCleanBuffer) while (@ob_end_clean());
698  print $sResponse;
699  if ($this->bErrorHandler) restore_error_handler();
700 
701  if ($this->bExitAllowed)
702  exit();
703  }
704 
730  function printJavascript($sJsURI="", $sJsFile=NULL)
731  {
732  print $this->getJavascript($sJsURI, $sJsFile);
733  }
734 
759  function getJavascript($sJsURI="", $sJsFile=NULL)
760  {
761  $html = $this->getJavascriptConfig();
762  $html .= $this->getJavascriptInclude($sJsURI, $sJsFile);
763 
764  return $html;
765  }
766 
774  {
775  $html = "\t<script type=\"text/javascript\">\n";
776  $html .= "var xajaxRequestUri=\"".$this->sRequestURI."\";\n";
777  $html .= "var xajaxDebug=".($this->bDebug?"true":"false").";\n";
778  $html .= "var xajaxStatusMessages=".($this->bStatusMessages?"true":"false").";\n";
779  $html .= "var xajaxWaitCursor=".($this->bWaitCursor?"true":"false").";\n";
780  $html .= "var xajaxDefinedGet=".XAJAX_GET.";\n";
781  $html .= "var xajaxDefinedPost=".XAJAX_POST.";\n";
782  $html .= "var xajaxLoaded=false;\n";
783 
784  foreach($this->aFunctions as $sFunction => $bExists) {
785  $html .= $this->_wrap($sFunction,$this->aFunctionRequestTypes[$sFunction]);
786  }
787 
788  $html .= "\t</script>\n";
789  return $html;
790  }
791 
809  function getJavascriptInclude($sJsURI="", $sJsFile=NULL)
810  {
811  if ($sJsFile == NULL) $sJsFile = "xajax_js/xajax.js";
812 
813  if ($sJsURI != "" && substr($sJsURI, -1) != "/") $sJsURI .= "/";
814 
815  $html = "\t<script type=\"text/javascript\" src=\"" . $sJsURI . $sJsFile . "\"></script>\n";
816  $html .= "\t<script type=\"text/javascript\">\n";
817  $html .= "window.setTimeout(function () { if (!xajaxLoaded) { alert('Error: the xajax Javascript file could not be included. Perhaps the URL is incorrect?\\nURL: {$sJsURI}{$sJsFile}'); } }, 6000);\n";
818  $html .= "\t</script>\n";
819  return $html;
820  }
821 
830  function autoCompressJavascript($sJsFullFilename=NULL)
831  {
832  $sJsFile = "xajax_js/xajax.js";
833 
834  if ($sJsFullFilename) {
835  $realJsFile = $sJsFullFilename;
836  }
837  else {
838  $realPath = realpath(dirname(__FILE__));
839  $realJsFile = $realPath . "/". $sJsFile;
840  }
841 
842  // Create a compressed file if necessary
843  if (!file_exists($realJsFile)) {
844  $srcFile = str_replace(".js", "_uncompressed.js", $realJsFile);
845  if (!file_exists($srcFile)) {
846  trigger_error("The xajax uncompressed Javascript file could not be found in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
847  }
848  require(dirname(__FILE__)."/xajaxCompress.php");
849  $javaScript = implode('', file($srcFile));
850  $compressedScript = xajaxCompressJavascript($javaScript);
851  $fH = @fopen($realJsFile, "w");
852  if (!$fH) {
853  trigger_error("The xajax compressed javascript file could not be written in the <b>" . dirname($realJsFile) . "</b> folder. Error ", E_USER_ERROR);
854  }
855  else {
856  fwrite($fH, $compressedScript);
857  fclose($fH);
858  }
859  }
860  }
861 
868  function _detectURI() {
869  $aURL = array();
870 
871  // Try to get the request URL
872  if (!empty($_SERVER['REQUEST_URI'])) {
873  $aURL = parse_url($_SERVER['REQUEST_URI']);
874  }
875 
876  // Fill in the empty values
877  if (empty($aURL['scheme'])) {
878  if (!empty($_SERVER['HTTP_SCHEME'])) {
879  $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
880  } else {
881  $aURL['scheme'] = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http';
882  }
883  }
884 
885  if (empty($aURL['host'])) {
886  if (!empty($_SERVER['HTTP_HOST'])) {
887  if (strpos($_SERVER['HTTP_HOST'], ':') > 0) {
888  list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
889  } else {
890  $aURL['host'] = $_SERVER['HTTP_HOST'];
891  }
892  } else if (!empty($_SERVER['SERVER_NAME'])) {
893  $aURL['host'] = $_SERVER['SERVER_NAME'];
894  } else {
895  print "xajax Error: xajax failed to automatically identify your Request URI.";
896  print "Please set the Request URI explicitly when you instantiate the xajax object.";
897  exit();
898  }
899  }
900 
901  if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT'])) {
902  $aURL['port'] = $_SERVER['SERVER_PORT'];
903  }
904 
905  if (empty($aURL['path'])) {
906  if (!empty($_SERVER['PATH_INFO'])) {
907  $sPath = parse_url($_SERVER['PATH_INFO']);
908  } else {
909  $sPath = parse_url($_SERVER['PHP_SELF']);
910  }
911  $aURL['path'] = $sPath['path'];
912  unset($sPath);
913  }
914 
915  if (!empty($aURL['query'])) {
916  $aURL['query'] = '?'.$aURL['query'];
917  }
918 
919  // Build the URL: Start with scheme, user and pass
920  $sURL = $aURL['scheme'].'://';
921  if (!empty($aURL['user'])) {
922  $sURL.= $aURL['user'];
923  if (!empty($aURL['pass'])) {
924  $sURL.= ':'.$aURL['pass'];
925  }
926  $sURL.= '@';
927  }
928 
929  // Add the host
930  $sURL.= $aURL['host'];
931 
932  // Add the port if needed
933  if (!empty($aURL['port']) && (($aURL['scheme'] == 'http' && $aURL['port'] != 80) || ($aURL['scheme'] == 'https' && $aURL['port'] != 443))) {
934  $sURL.= ':'.$aURL['port'];
935  }
936 
937  // Add the path and the query string
938  $sURL.= $aURL['path'].@$aURL['query'];
939 
940  // Clean up
941  unset($aURL);
942  return $sURL;
943  }
944 
953  function _isObjectCallback($sFunction)
954  {
955  if (array_key_exists($sFunction, $this->aObjects)) return true;
956  return false;
957  }
958 
967  function _isFunctionCallable($sFunction)
968  {
969  if ($this->_isObjectCallback($sFunction)) {
970  if (is_object($this->aObjects[$sFunction][0])) {
971  return method_exists($this->aObjects[$sFunction][0], $this->aObjects[$sFunction][1]);
972  }
973  else {
974  return is_callable($this->aObjects[$sFunction]);
975  }
976  }
977  else {
978  return function_exists($sFunction);
979  }
980  }
981 
991  function _callFunction($sFunction, $aArgs)
992  {
993  if ($this->_isObjectCallback($sFunction)) {
994  $mReturn = call_user_func_array($this->aObjects[$sFunction], $aArgs);
995  }
996  else {
997  $mReturn = call_user_func_array($sFunction, $aArgs);
998  }
999  return $mReturn;
1000  }
1001 
1010  function _wrap($sFunction,$sRequestType=XAJAX_POST)
1011  {
1012  $js = "function ".$this->sWrapperPrefix."$sFunction(){return xajax.call(\"$sFunction\", arguments, ".$sRequestType.");}\n";
1013  return $js;
1014  }
1015 
1026  function _xmlToArray($rootTag, $sXml)
1027  {
1028  $aArray = array();
1029  $sXml = str_replace("<$rootTag>","<$rootTag>|~|",$sXml);
1030  $sXml = str_replace("</$rootTag>","</$rootTag>|~|",$sXml);
1031  $sXml = str_replace("<e>","<e>|~|",$sXml);
1032  $sXml = str_replace("</e>","</e>|~|",$sXml);
1033  $sXml = str_replace("<k>","<k>|~|",$sXml);
1034  $sXml = str_replace("</k>","|~|</k>|~|",$sXml);
1035  $sXml = str_replace("<v>","<v>|~|",$sXml);
1036  $sXml = str_replace("</v>","|~|</v>|~|",$sXml);
1037  $sXml = str_replace("<q>","<q>|~|",$sXml);
1038  $sXml = str_replace("</q>","|~|</q>|~|",$sXml);
1039 
1040  $this->aObjArray = explode("|~|",$sXml);
1041 
1042  $this->iPos = 0;
1043  $aArray = $this->_parseObjXml($rootTag);
1044 
1045  return $aArray;
1046  }
1047 
1056  function _parseObjXml($rootTag)
1057  {
1058  $aArray = array();
1059 
1060  if ($rootTag == "xjxobj")
1061  {
1062  while(!stristr($this->aObjArray[$this->iPos],"</xjxobj>"))
1063  {
1064  $this->iPos++;
1065  if(stristr($this->aObjArray[$this->iPos],"<e>"))
1066  {
1067  $key = "";
1068  $value = null;
1069 
1070  $this->iPos++;
1071  while(!stristr($this->aObjArray[$this->iPos],"</e>"))
1072  {
1073  if(stristr($this->aObjArray[$this->iPos],"<k>"))
1074  {
1075  $this->iPos++;
1076  while(!stristr($this->aObjArray[$this->iPos],"</k>"))
1077  {
1078  $key .= $this->aObjArray[$this->iPos];
1079  $this->iPos++;
1080  }
1081  }
1082  if(stristr($this->aObjArray[$this->iPos],"<v>"))
1083  {
1084  $this->iPos++;
1085  while(!stristr($this->aObjArray[$this->iPos],"</v>"))
1086  {
1087  if(stristr($this->aObjArray[$this->iPos],"<xjxobj>"))
1088  {
1089  $value = $this->_parseObjXml("xjxobj");
1090  $this->iPos++;
1091  }
1092  else
1093  {
1094  $value .= $this->aObjArray[$this->iPos];
1095  if ($this->bDecodeUTF8Input)
1096  {
1097  $value = $this->_decodeUTF8Data($value);
1098  }
1099  }
1100  $this->iPos++;
1101  }
1102  }
1103  $this->iPos++;
1104  }
1105 
1106  $aArray[$key]=$value;
1107  }
1108  }
1109  }
1110 
1111  if ($rootTag == "xjxquery")
1112  {
1113  $sQuery = "";
1114  $this->iPos++;
1115  while(!stristr($this->aObjArray[$this->iPos],"</xjxquery>"))
1116  {
1117  if (stristr($this->aObjArray[$this->iPos],"<q>") || stristr($this->aObjArray[$this->iPos],"</q>"))
1118  {
1119  $this->iPos++;
1120  continue;
1121  }
1122  $sQuery .= $this->aObjArray[$this->iPos];
1123  $this->iPos++;
1124  }
1125 
1126  parse_str($sQuery, $aArray);
1127  if ($this->bDecodeUTF8Input)
1128  {
1129  foreach($aArray as $key => $value)
1130  {
1131  $aArray[$key] = $this->_decodeUTF8Data($value);
1132  }
1133  }
1134  // If magic quotes is on, then we need to strip the slashes from the
1135  // array values because of the parse_str pass which adds slashes
1136  if (get_magic_quotes_gpc() == 1) {
1137  $newArray = array();
1138  foreach ($aArray as $sKey => $sValue) {
1139  if (is_string($sValue))
1140  $newArray[$sKey] = stripslashes($sValue);
1141  else
1142  $newArray[$sKey] = $sValue;
1143  }
1144  $aArray = $newArray;
1145  }
1146  }
1147 
1148  return $aArray;
1149  }
1150 
1158  function _decodeUTF8Data($sData)
1159  {
1160  $sValue = $sData;
1161  if ($this->bDecodeUTF8Input)
1162  {
1163  $sFuncToUse = NULL;
1164 
1165  if (function_exists('iconv'))
1166  {
1167  $sFuncToUse = "iconv";
1168  }
1169  else if (function_exists('mb_convert_encoding'))
1170  {
1171  $sFuncToUse = "mb_convert_encoding";
1172  }
1173  else if ($this->sEncoding == "ISO-8859-1")
1174  {
1175  $sFuncToUse = "utf8_decode";
1176  }
1177  else
1178  {
1179  trigger_error("The incoming xajax data could not be converted from UTF-8", E_USER_NOTICE);
1180  }
1181 
1182  if ($sFuncToUse)
1183  {
1184  if (is_string($sValue))
1185  {
1186  if ($sFuncToUse == "iconv")
1187  {
1188  $sValue = iconv("UTF-8", $this->sEncoding.'//TRANSLIT', $sValue);
1189  }
1190  else if ($sFuncToUse == "mb_convert_encoding")
1191  {
1192  $sValue = mb_convert_encoding($sValue, $this->sEncoding, "UTF-8");
1193  }
1194  else
1195  {
1196  $sValue = utf8_decode($sValue);
1197  }
1198  }
1199  }
1200  }
1201  return $sValue;
1202  }
1203 
1204 }// end class xajax
1205 
1210 function xajaxErrorHandler($errno, $errstr, $errfile, $errline)
1211 {
1212  $errorReporting = error_reporting();
1213  if (($errno & $errorReporting) == 0) return;
1214 
1215  if ($errno == E_NOTICE) {
1216  $errTypeStr = "NOTICE";
1217  }
1218  else if ($errno == E_WARNING) {
1219  $errTypeStr = "WARNING";
1220  }
1221  else if ($errno == E_USER_NOTICE) {
1222  $errTypeStr = "USER NOTICE";
1223  }
1224  else if ($errno == E_USER_WARNING) {
1225  $errTypeStr = "USER WARNING";
1226  }
1227  else if ($errno == E_USER_ERROR) {
1228  $errTypeStr = "USER FATAL ERROR";
1229  }
1230  else if ($errno == E_STRICT) {
1231  return;
1232  }
1233  else {
1234  $errTypeStr = "UNKNOWN: $errno";
1235  }
1236  $GLOBALS['xajaxErrorHandlerText'] .= "\n----\n[$errTypeStr] $errstr\nerror in line $errline of file $errfile";
1237 }
1238 
1239 ?>
xajax\setCharEncoding
setCharEncoding($sEncoding)
Definition: xajax.inc.php:338
xajax\errorHandlerOff
errorHandlerOff()
Definition: xajax.inc.php:296
xajax\$aFunctionRequestTypes
$aFunctionRequestTypes
Definition: xajax.inc.php:91
xajax\printJavascript
printJavascript($sJsURI="", $sJsFile=NULL)
Definition: xajax.inc.php:730
xajax\$aFunctionIncludeFiles
$aFunctionIncludeFiles
Definition: xajax.inc.php:95
xajax\$bCleanBuffer
$bCleanBuffer
Definition: xajax.inc.php:139
xajax\$aFunctions
$aFunctions
Definition: xajax.inc.php:83
xajax\$bDebug
$bDebug
Definition: xajax.inc.php:115
xajax\registerFunction
registerFunction($mFunction, $sRequestType=XAJAX_POST)
Definition: xajax.inc.php:398
xajax\$bErrorHandler
$bErrorHandler
Definition: xajax.inc.php:131
xajax\cleanBufferOn
cleanBufferOn()
Definition: xajax.inc.php:316
xajax\_isFunctionCallable
_isFunctionCallable($sFunction)
Definition: xajax.inc.php:967
xajax\outputEntitiesOff
outputEntitiesOff()
Definition: xajax.inc.php:374
exit
exit
Definition: config.inc.php:186
xajax\$aObjArray
$aObjArray
Definition: xajax.inc.php:155
xajax
xajax\_detectURI
_detectURI()
Definition: xajax.inc.php:868
xajax\_decodeUTF8Data
_decodeUTF8Data($sData)
Definition: xajax.inc.php:1158
xajax\debugOff
debugOff()
Definition: xajax.inc.php:228
xajax\getJavascriptInclude
getJavascriptInclude($sJsURI="", $sJsFile=NULL)
Definition: xajax.inc.php:809
xajax\decodeUTF8InputOn
decodeUTF8InputOn()
Definition: xajax.inc.php:348
xajax\$bOutputEntities
$bOutputEntities
Definition: xajax.inc.php:151
xajax\canProcessRequests
canProcessRequests()
Definition: xajax.inc.php:495
xajax\$sLogFile
$sLogFile
Definition: xajax.inc.php:135
xajax\setLogFile
setLogFile($sFilename)
Definition: xajax.inc.php:307
xajax\registerPreFunction
registerPreFunction($mFunction)
Definition: xajax.inc.php:477
xajax\$aObjects
$aObjects
Definition: xajax.inc.php:87
xajax\setRequestURI
setRequestURI($sRequestURI)
Definition: xajax.inc.php:200
xajax\_xmlToArray
_xmlToArray($rootTag, $sXml)
Definition: xajax.inc.php:1026
xajax\$sWrapperPrefix
$sWrapperPrefix
Definition: xajax.inc.php:111
xajaxCompressJavascript
xajaxCompressJavascript($sJS)
Definition: xajaxCompress.php:43
xajax\$sCatchAllFunction
$sCatchAllFunction
Definition: xajax.inc.php:99
xajax\$bStatusMessages
$bStatusMessages
Definition: xajax.inc.php:119
xajax\$iPos
$iPos
Definition: xajax.inc.php:159
xajax\decodeUTF8InputOff
decodeUTF8InputOff()
Definition: xajax.inc.php:356
xajax\cleanBufferOff
cleanBufferOff()
Definition: xajax.inc.php:323
xajax\$bWaitCursor
$bWaitCursor
Definition: xajax.inc.php:127
xajaxResponse
Definition: xajaxResponse.inc.php:68
xajax\registerCatchAllFunction
registerCatchAllFunction($mFunction)
Definition: xajax.inc.php:451
xajax\setWrapperPrefix
setWrapperPrefix($sPrefix)
Definition: xajax.inc.php:212
xajax\xajax
xajax($sRequestURI="", $sWrapperPrefix="xajax_", $sEncoding=XAJAX_DEFAULT_CHAR_ENCODING, $bDebug=false)
Definition: xajax.inc.php:172
xajax\debugOn
debugOn()
Definition: xajax.inc.php:220
xajax\registerExternalFunction
registerExternalFunction($mFunction, $sIncludeFile, $sRequestType=XAJAX_POST)
Definition: xajax.inc.php:425
xajax\waitCursorOn
waitCursorOn()
Definition: xajax.inc.php:252
xajax\_callFunction
_callFunction($sFunction, $aArgs)
Definition: xajax.inc.php:991
xajax\$sRequestURI
$sRequestURI
Definition: xajax.inc.php:107
xajax\getJavascript
getJavascript($sJsURI="", $sJsFile=NULL)
Definition: xajax.inc.php:759
xajax\exitAllowedOn
exitAllowedOn()
Definition: xajax.inc.php:269
xajax\getRequestMode
getRequestMode()
Definition: xajax.inc.php:507
xajax\outputEntitiesOn
outputEntitiesOn()
Definition: xajax.inc.php:365
xajax\$sEncoding
$sEncoding
Definition: xajax.inc.php:143
xajax\exitAllowedOff
exitAllowedOff()
Definition: xajax.inc.php:278
xajax\statusMessagesOn
statusMessagesOn()
Definition: xajax.inc.php:236
xajax\$sPreFunction
$sPreFunction
Definition: xajax.inc.php:103
xajax\$bExitAllowed
$bExitAllowed
Definition: xajax.inc.php:123
xajax\processRequests
processRequests()
Definition: xajax.inc.php:526
E_USER_ERROR
if(!defined('ADODB_ERROR_HANDLER_TYPE')) define('ADODB_ERROR_HANDLER_TYPE' E_USER_ERROR
Definition: adodb-errorhandler.inc.php:18
xajax\errorHandlerOn
errorHandlerOn()
Definition: xajax.inc.php:288
xajax\waitCursorOff
waitCursorOff()
Definition: xajax.inc.php:260
xajax\statusMessagesOff
statusMessagesOff()
Definition: xajax.inc.php:244
xajax\_parseObjXml
_parseObjXml($rootTag)
Definition: xajax.inc.php:1056
xajax\getJavascriptConfig
getJavascriptConfig()
Definition: xajax.inc.php:773
xajaxErrorHandler
xajaxErrorHandler($errno, $errstr, $errfile, $errline)
Definition: xajax.inc.php:1210
xajax\autoCompressJavascript
autoCompressJavascript($sJsFullFilename=NULL)
Definition: xajax.inc.php:830
xajax\_isObjectCallback
_isObjectCallback($sFunction)
Definition: xajax.inc.php:953
xajax\_wrap
_wrap($sFunction, $sRequestType=XAJAX_POST)
Definition: xajax.inc.php:1010
xajax\$bDecodeUTF8Input
$bDecodeUTF8Input
Definition: xajax.inc.php:147