Exemplo n.º 1
0
 public function xoadGetMeta()
 {
     $filter = create_function('$name', 'return (preg_match("@^(xoad|_)@", $name) == false);');
     $methods = array_filter(get_class_methods($this), $filter);
     XOAD_Client::mapMethods($this, $methods);
     XOAD_Client::publicMethods($this, $methods);
 }
Exemplo n.º 2
0
 public function xoadGetMeta()
 {
     XOAD_Client::privateMethods($this, array('getConnection', 'closeConnection', 'escapeString'));
     XOAD_Client::mapMethods($this, array('getUsers', 'renameUser', 'addUser'));
 }
Exemplo n.º 3
0
 /**
  * Imports an associative array to the corresponding form elements.
  *
  * <p>Example:</p>
  * <code>
  * XOAD_HTML::importForm('mainForm', array('firstName' => 'First', 'lastName' => 'Last'));
  * </code>
  *
  * @access	public
  *
  * @param	string	$id			The client ID of the form.
  *
  * @param	string	$formData	Associative array that contains the
  *								values to import.
  *
  * @return	void
  *
  * @static
  *
  */
 public static function importForm($id, $formData)
 {
     $script = 'xoad.html.importForm(';
     $script .= XOAD_Client::register($id);
     $script .= ', ';
     $script .= XOAD_Client::register($formData);
     $script .= ');';
     XOAD_HTML::addScriptBlock($script);
 }
Exemplo n.º 4
0
 function xoadGetMeta()
 {
     XOAD_Client::mapMethods($this, array('execute'));
     XOAD_Client::publicMethods($this, array('execute'));
     XOAD_Client::privateVariables($this, array('_common_obj', '_tree'));
 }
Exemplo n.º 5
0
 /**
  * Registers a custom client control.
  *
  * <p>Each control includes a JS file that defines the class that
  * will handle the control. Additionally, you can attach a server class and
  * a HTML code.</p>
  *
  * @access	public
  *
  * @param	string	$tagPrefix	The tag prefix for the control, required.
  * @param	mixed	$tagName	The tag name for the control, required.
  * @param	string	$jsFile		The relative path to the JS file that
  * 								defines the class that will handle the
  * 								control, required.
  * @param	string	$phpFile	The relative/absolute path to the PHP file
  * 								that defines the server class that is
  * 								associated with the control, optional.
  * @param	string	$url		The callback URL for the server class,
  * 								optional.
  * @param	string	$htmlFile	The relative/absolute path to the HTML file
  * 								that defines the code that is associated
  * 								with the control, optional.
  *
  * @return	string	HTML code to register the custom control.
  *
  * @static
  *
  */
 public static function register($tagPrefix = 'xoad', $tagName = null, $jsFile = null, $phpFile = null, $url = null, $htmlFile = null)
 {
     if (empty($phpFile) && empty($jsFile)) {
         return null;
     }
     if (XOAD_Utilities::getType($tagName) == 's_array') {
         $returnValue = '';
         foreach ($tagName as $name) {
             $returnValue .= XOAD_Controls::register($tagPrefix, $name, $jsFile, $phpFile, $url, $htmlFile);
         }
         return $returnValue;
     }
     if (XOAD_Utilities::getType($tagName) == 'a_array') {
         $returnValue = '';
         foreach ($tagName as $prefix => $name) {
             $returnValue .= XOAD_Controls::register($prefix, $name, $jsFile, $phpFile, $url, $htmlFile);
         }
         return $returnValue;
     }
     if (empty($tagPrefix) || empty($tagName)) {
         return null;
     }
     $registerAttribute = $tagName == '@';
     $controlName = strtolower($tagPrefix) . ':' . strtolower($tagName);
     if (!$registerAttribute && in_array($controlName, $GLOBALS['_XOAD_CONTROLS_LIST'])) {
         return null;
     }
     $phpControlName = $tagPrefix . '_Controls_' . $tagName;
     $jsControlName = $tagPrefix . '.controls.' . $tagName;
     $includeScript = '';
     $returnValue = '';
     if (!empty($phpFile)) {
         require_once XOAD_Controls::getFileName($phpFile);
         if (empty($url)) {
             $url = XOAD_Utilities::getRequestUrl();
         }
         $phpObject = new $phpControlName();
         XOAD_Client::privateMethods($phpObject, array('getJSCode', 'getHtmlCode'));
         $returnValue .= XOAD_Client::register($phpControlName, $url) . ';';
     }
     if (!empty($jsFile)) {
         if (!in_array($jsFile, $GLOBALS['_XOAD_CONTROLS_SCRIPT'])) {
             $includeScript .= '<script type="text/javascript" src="' . htmlspecialchars($jsFile) . '"></script>';
             $GLOBALS['_XOAD_CONTROLS_SCRIPT'][] = $jsFile;
         }
     } else {
         if (isset($phpObject) && method_exists($phpObject, 'getJSCode')) {
             $returnValue .= $phpObject->getJSCode($jsControlName, $phpControlName);
         }
     }
     $controlHtml = null;
     if (!empty($htmlFile)) {
         $controlHtml = @join(null, @file(XOAD_Controls::getFileName($htmlFile)));
     } else {
         if (isset($phpObject) && method_exists($phpObject, 'getHtmlCode')) {
             $controlHtml = $phpObject->getHtmlCode($jsControlName, $phpControlName);
         }
     }
     if (!$registerAttribute) {
         $returnValue .= 'xoad.controls.list[' . sizeof($GLOBALS['_XOAD_CONTROLS_LIST']) . '] = {';
         $returnValue .= 'tagName:' . XOAD_Client::register($controlName);
         if (!empty($jsFile)) {
             $returnValue .= ',clientClass:' . XOAD_Client::register($jsControlName);
         }
         if (!empty($phpFile)) {
             $returnValue .= ',serverClass:' . XOAD_Client::register($phpControlName);
         }
         if (!empty($controlHtml)) {
             $returnValue .= ',html:' . XOAD_Client::register($controlHtml);
         }
         $returnValue .= '};';
     }
     if (!empty($returnValue)) {
         $returnValue = '<script type="text/javascript">' . $returnValue . '</script>';
     }
     $returnValue = $includeScript . $returnValue;
     $GLOBALS['_XOAD_CONTROLS_LIST'][] = $controlName;
     return $returnValue;
 }
Exemplo n.º 6
0
xRegistry::set('TMS', $TMS = new tMultiSection());
xPDO::setSource(DB_HOST, DB_NAME, DB_USER, DB_PASS);
xRegistry::set('xPDO', xPDO::getInstance());
xNameSpaceHolder::addObjectToNS('E', new ENHANCE());
require_once xConfig::get('PATH', 'XOAD') . 'xoad.php';
require_once xConfig::get('PATH', 'ADM') . 'logger.class.php';
require_once xConfig::get('PATH', 'ADM') . 'adm.class.php';
if ($_REQUEST['xoadCall']) {
    ob_start();
    $adm = new adminPanel();
    $adm->startMapping();
    if (XOAD_Server::runServer()) {
        $all = ob_get_contents();
        ob_end_clean();
        if ($_COMMON_SITE_CONF['output_html_compress']) {
            Common::compress_output($all);
        }
        echo $all;
        exit;
    }
} elseif ($_REQUEST['action']) {
    $adm = new adminPanel();
    echo $adm->dispatchAction($_GET['action']);
} else {
    $tpl = xCore::moduleFactory('templates.back');
    $adm = new adminPanel();
    //$data['xObject']=XOAD_Client::register(new adminPanel());
    $data['xConnector'] = XOAD_Client::register(new Connector());
    echo $adm->buildMainPage($data);
}
die;
Exemplo n.º 7
0
Arquivo: _run.php Projeto: umaxfun/x4m
            } else {
                echo $all;
            }
        }
        exit;
    }
} else {
    xRegistry::set('TPA', $TPA = new tPageAgregator());
    if (isset($_GET['action'])) {
        $TPA->dispatch_action($_GET['action']);
    } elseif ($page = $TPA->execute_page(xConfig::get('PATH', 'baseUrl'))) {
        if ($TPA->FED_MODE) {
            $xConnector = new Connector();
            $xConnector_obj = XOAD_Client::register($xConnector, array('url' => '/admin.php'));
            $TMS->AddFileSection($_PATH['ADM'] . 'tpl/FED.html');
            $TMS->AddMassReplace('FED', array('front_obj' => XOAD_Client::register(new front_api()), 'xConnector' => $xConnector_obj, 'xoad_header' => XOAD_Utilities::header($_WEBPATH['XOAD'])));
            $page = preg_replace(array('#<script[^>]*>.*?</script>#is'), array(''), $page);
            $page .= $TMS->parseSection('FED');
        }
        $all = $page;
        if (xConfig::get('GLOBAL', 'enable_page_caching') && !$TPA->DisablePageCaching && !$TPA->FED_MODE) {
            $cache->toCache($all);
        }
        if (xConfig::get('GLOBAL', 'show_debug_info')) {
            $y = Common::getmicrotime() - $x;
            $all .= '<!-- ' . $y . ' -->';
        }
        if (xConfig::get('GLOBAL', 'output_html_compress')) {
            $all = Common::compress_output($all);
        }
        echo $all;
Exemplo n.º 8
0
    }
}
require_once '../../xoad.php';
XOAD_Cache::allowCaching(null, null, 10);
if (XOAD_Server::runServer()) {
    exit;
}
echo XOAD_Utilities::header('../..') . "\n";
?>
<script type="text/javascript">

var class1 = <?php 
echo XOAD_Client::register(new Class1()) . "\n";
?>
;
var class2 = <?php 
echo XOAD_Client::register(new Class2()) . "\n";
?>
;

class1.invoke(function() {

	alert('Class1.invoke...');

	class2.invoke(function() {

		alert('Class2.invoke...');
	});
});

</script>
Exemplo n.º 9
0
 function xoadGetMeta()
 {
     XOAD_Client::mapMethods($this, array('execute'));
     XOAD_Client::publicMethods($this, array('execute'));
 }
Exemplo n.º 10
0
		<title>XOAD Advanced Chat</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<?php 
echo XOAD_Utilities::header('../..');
?>

		<?php 
echo XOAD_Utilities::eventsHeader();
?>

		<script type="text/javascript">

		xoad.events.refreshInterval = 1000;

		var client = <?php 
echo XOAD_Client::register(new ChatClient(), array('class' => 'ChatClient'));
?>
;

		var users = [];

		var emoticons = [
		[':angry:', 'angry'],
		[':biggrin:', 'biggrin'],
		[':D', 'biggrin'],
		[':-D', 'biggrin'],
		[':blink:', 'blink'],
		[':blush:', 'blush'],
		[':bored:', 'bored'],
		[':closedeyes:', 'closedeyes'],
		[':confused:', 'confused'],
Exemplo n.º 11
0
    {
        if ($arg == null) {
            $arg = "null";
        }
        $this->serverEvents[] = $event . ' => ' . str_replace("\n", "\n" . str_repeat(' ', strlen($event) + 4), var_export($arg, true));
        if ($event == 'dispatchLeave') {
            $arg['response']['output'] = "<strong>Server Events:</strong>\n\n" . join('<hr />', $this->serverEvents);
        }
    }
}
XOAD_Server::addObserver(new ServerObserver());
if (XOAD_Server::runServer()) {
    exit;
}
echo XOAD_Utilities::header('../..');
?>

<script type="text/javascript">
<!--
var obj = <?php 
echo XOAD_Client::register(new TestEvents());
?>
;

obj.test();

document.write('<pre>');
document.write(obj.fetchOutput());
document.write('</pre>');
-->
</script>
Exemplo n.º 12
0
 public function xoadGetMeta()
 {
     XOAD_Client::mapMethods($this, array('getPage'));
 }
Exemplo n.º 13
0
?>
<html>
	<head>
		<title>Simple XOAD Explorer</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<?php 
echo XOAD_Utilities::header('../..');
?>

		<style type="text/css">@import url(style/explorer.css);</style>
	</head>
	<body>
		<script type="text/javascript">
		<!--
		<?php 
echo XOAD_Client::register('Explorer', 'index.php');
?>
;

		function js_escape(text)
		{
			if (text == null) {

				return null;
			}

			return text.replace(/\'/gi, '\\\'').replace(/\"/gi, '\\\"');
		}

		function exploreFolder(path)
		{
Exemplo n.º 14
0
 public function xoadGetMeta()
 {
     XOAD_Client::mapMethods($this, array('addMessage', 'getContents'));
 }
Exemplo n.º 15
0
							<option style="color: #EE82EE; background-color: #EE82EE;">Violet</option>
							<option style="color: #D02090; background-color: #D02090;">VioletRed</option>
							<option style="color: #F5DEB3; background-color: #F5DEB3;">Wheat</option>
							<option style="color: #FFFFFF; background-color: #FFFFFF;">White</option>
							<option style="color: #F5F5F5; background-color: #F5F5F5;">WhiteSmoke</option>
							<option style="color: #FFFF00; background-color: #FFFF00;">Yellow</option>
							<option style="color: #9ACD32; background-color: #9ACD32;">YellowGreen</option>
					</select>
				</td>
			</tr>
		</table>

		<script type="text/javascript">

		<?php 
echo XOAD_Client::register('Chat', 'index.php');
?>
;

		var chatCache = null;

		var chatRefresh = false;

		window.onload = function() {

			var userNick = document.getElementById('userNick');

			var userTime = new Date();

			userNick.value += userTime.getHours();
			userNick.value += userTime.getMinutes();
Exemplo n.º 16
0
<br />

<button onclick="add()" style="font: normal 1em tahoma, verdana, arial, serif; width: 2em;">+</button>
<button onclick="sub()" style="font: normal 1em tahoma, verdana, arial, serif; width: 2em;">-</button>
<button onclick="mul()" style="font: normal 1em tahoma, verdana, arial, serif; width: 2em;">*</button>
<button onclick="div()" style="font: normal 1em tahoma, verdana, arial, serif; width: 2em;">/</button>

<br />

<button onclick="clearResult()" style="font: normal 0.8em tahoma, verdana, arial, serif; width: 10em;">Clear</button>

<script type="text/javascript">
<!--
var calc = <?php 
echo XOAD_Client::register(new Calculator());
?>
;

var operationValue = document.getElementById('operationValue');

var operationResult = document.getElementById('operationResult');

function getValue() { return parseInt(operationValue.value); }

function update() { operationResult.innerHTML = 'Result: <strong>' + calc.result + '</strong>'; }

function add() { if (calc.add(getValue())) update(); }
function sub() { if (calc.sub(getValue())) update(); }
function mul() { if (calc.mul(getValue())) update(); }
function div() { if (calc.div(getValue())) update(); }
Exemplo n.º 17
0
 /**
  * Registers XOAD Events header data.
  *
  * <p>You should call this method after {@link XOAD_Utilities::header}.</p>
  * <p>XOAD Events header data includes server time and callback URL.</p>
  *
  * @access	public
  *
  * @param	string	$callbackUrl	XOAD Events callback URL.
  *
  * @return	string	HTML code to initialize XOAD Events.
  *
  * @static
  *
  */
 public static function eventsHeader($callbackUrl = null)
 {
     if ($callbackUrl == null) {
         $callbackUrl = XOAD_Utilities::getRequestUrl();
     }
     $returnValue = '<script type="text/javascript">';
     $returnValue .= 'xoad.events.callbackUrl = ' . XOAD_Client::register($callbackUrl) . ';';
     $returnValue .= 'xoad.events.lastRefresh = ' . XOAD_Client::register(XOAD_Utilities::getMicroTime()) . ';';
     $returnValue .= '</script>';
     return $returnValue;
 }
Exemplo n.º 18
0
 /**
  * Returns the JavaScript code of the DOM element.
  *
  * <p>You should not call this method directly.</p>
  *
  * @access	public
  *
  * @param	string	$element	The JavaScript element name.
  *
  * @return	string	JavaScript source code for the DOM element.
  *
  * @static
  *
  */
 public function process($element = null)
 {
     $returnValue = '';
     $objectVars = get_object_vars($this);
     foreach ($objectVars as $key => $value) {
         if (strcasecmp($key, 'skipKeys') == 0 || in_array($key, $this->skipKeys)) {
             continue;
         }
         if (strcasecmp($key, 'attributes') == 0) {
             foreach ($this->attributes as $key => $value) {
                 if ($value === null) {
                     $returnValue .= $element . '.removeAttribute("' . $key . '");';
                 } else {
                     $returnValue .= $element . '.setAttribute("' . $key . '", ' . XOAD_Client::register($value) . ');';
                 }
             }
         } else {
             if (strcasecmp($key, 'style') == 0) {
                 foreach ($this->style as $key => $value) {
                     $returnValue .= $element . '.style.' . $key . '=' . XOAD_Client::register($value) . ';';
                 }
             } else {
                 $assignField = $element . '.' . $key;
                 $assignOperation = $assignField . '=' . XOAD_Client::register($value) . ';';
                 if (strpos($assignOperation, XOAD_HTML_CURRENT_VALUE) !== false) {
                     $assignOperation = str_replace(XOAD_HTML_CURRENT_VALUE, '"+' . $assignField . '+"', $assignOperation);
                 }
                 $returnValue .= $assignOperation;
             }
         }
     }
     $returnValue .= $this->clientCode;
     return $returnValue;
 }
Exemplo n.º 19
0
 public function registerClass(XoadModel $instance, $var_name, $path)
 {
     $this->registerScripts();
     $script = "xoad.env.set('" . $var_name . "', " . XOAD_Client::register($instance, $path) . ");";
     Yii::app()->clientScript->registerScript($var_name, $script, CclientScript::POS_HEAD);
 }
Exemplo n.º 20
0
 /**
  * Registers a PHP variable/class in JavaScript.
  *
  * <p>Example:</p>
  * <code>
  * <script type="text/javascript">
  * <?php require_once('xoad.php'); ?>
  *
  * var arr = <?= XOAD_Client::register(array(1, 2, "string", array("Nested"))) ?>;
  *
  * alert(arr);
  *
  * </script>
  * </code>
  *
  * @access	public
  *
  * @param	mixed	$var	Variable/Class name to register.
  *
  * @param	mixed	$params	When registering a variable/class you can
  *							provide extended parameters, like class name
  *							and callback URL.
  *
  * @return	string	JavaString code that represents the variable/class.
  *
  * @static
  *
  */
 public static function register($var, $params = null)
 {
     $type = XOAD_Utilities::getType($var);
     if ($type == 'object') {
         $paramsType = XOAD_Utilities::getType($params);
         if ($paramsType != 'string') {
             $callbackUrl = XOAD_Utilities::getRequestUrl();
             if ($paramsType == 'a_array') {
                 if (!empty($params['class'])) {
                     $className = $params['class'];
                 }
                 if (!empty($params['url'])) {
                     $callbackUrl = $params['url'];
                 }
             }
         } else {
             $callbackUrl = $params;
         }
         if (method_exists($var, XOAD_CLIENT_METADATA_METHOD_NAME)) {
             call_user_func_array(array(&$var, XOAD_CLIENT_METADATA_METHOD_NAME), array());
         }
         $objectCode = array();
         if (empty($className)) {
             $className = XOAD_Utilities::caseConvert(get_class($var));
         }
         $meta = get_object_vars($var);
         $objectMeta = null;
         if (isset($meta['xoadMeta'])) {
             if (XOAD_Utilities::getType($meta['xoadMeta']) == 'object') {
                 if (strcasecmp(get_class($meta['xoadMeta']), 'XOAD_Meta') == 0) {
                     $objectMeta = $meta['xoadMeta'];
                     unset($meta['xoadMeta']);
                     unset($var->xoadMeta);
                 }
             }
         }
         if (sizeof($meta) > 0) {
             $attachMeta = array();
             foreach ($meta as $key => $value) {
                 if (!empty($objectMeta)) {
                     if (!$objectMeta->isPublicVariable($key)) {
                         unset($meta[$key]);
                         unset($var->{$key});
                         continue;
                     }
                 }
                 $valueType = XOAD_Utilities::getType($value);
                 if ($valueType == 'object' || $valueType == 's_array' || $valueType == 'a_array') {
                     $var->{$key} = XOAD_SERIALIZER_SKIP_STRING . XOAD_Client::register($var->{$key}, $callbackUrl);
                 }
                 $attachMeta[$key] = $valueType;
             }
             $var->__meta = $attachMeta;
             $var->__size = sizeof($attachMeta);
         } else {
             $var->__meta = null;
             $var->__size = 0;
         }
         $var->__class = $className;
         $var->__url = $callbackUrl;
         $var->__uid = md5(uniqid(rand(), true));
         $var->__output = null;
         $var->__timeout = null;
         $serialized = XOAD_Serializer::serialize($var);
         $objectCode[] = substr($serialized, 1, strlen($serialized) - 2);
         $objectCode[] = '"__clone":function(obj){xoad.clone(this,obj)}';
         $objectCode[] = '"__serialize":function(){return xoad.serialize(this)}';
         $objectCode[] = '"catchEvent":function(){return xoad.catchEvent(this,arguments)}';
         $objectCode[] = '"ignoreEvent":function(){return xoad.ignoreEvent(this,arguments)}';
         $objectCode[] = '"postEvent":function(){return xoad.postEvent(this,arguments)}';
         $objectCode[] = '"fetchOutput":function(){return this.__output}';
         $objectCode[] = '"setTimeout":function(miliseconds){this.__timeout=miliseconds}';
         $objectCode[] = '"getTimeout":function(){return this.__timeout}';
         $objectCode[] = '"clearTimeout":function(){this.__timeout=null}';
         $classMethods = get_class_methods($var);
         for ($iterator = sizeof($classMethods) - 1; $iterator >= 0; $iterator--) {
             if (strcasecmp($className, $classMethods[$iterator]) == 0) {
                 unset($classMethods[$iterator]);
                 continue;
             }
             if (strcasecmp($classMethods[$iterator], XOAD_CLIENT_METADATA_METHOD_NAME) == 0) {
                 unset($classMethods[$iterator]);
                 continue;
             }
             if (!empty($objectMeta)) {
                 if (!$objectMeta->isPublicMethod($classMethods[$iterator])) {
                     unset($classMethods[$iterator]);
                     continue;
                 }
             }
         }
         if (sizeof($classMethods) > 0) {
             $index = 0;
             $length = sizeof($classMethods);
             $returnValue = '';
             foreach ($classMethods as $method) {
                 $methodName = XOAD_Utilities::caseConvert($method);
                 if (!empty($objectMeta)) {
                     $mapMethodName = $objectMeta->findMethodName($methodName);
                     if (strcmp($mapMethodName, $methodName) != 0) {
                         $methodName = $mapMethodName;
                     }
                 }
                 $serialized = XOAD_Serializer::serialize($methodName);
                 $returnValue .= $serialized;
                 $returnValue .= ':';
                 $returnValue .= 'function(){return xoad.call(this,' . $serialized . ',arguments)}';
                 if ($index < $length - 1) {
                     $returnValue .= ',';
                 }
                 $index++;
             }
             $objectCode[] = $returnValue;
         }
         $returnValue = '{' . join(',', $objectCode) . '}';
         return $returnValue;
     } else {
         if ($type == 's_array' || $type == 'a_array') {
             foreach ($var as $key => $value) {
                 $valueType = XOAD_Utilities::getType($value);
                 if ($valueType == 'object' || $valueType == 's_array' || $valueType == 'a_array') {
                     $var[$key] = XOAD_SERIALIZER_SKIP_STRING . XOAD_Client::register($var[$key], $params);
                 }
             }
         } else {
             if ($type == 'string') {
                 $paramsType = XOAD_Utilities::getType($params);
                 if ($paramsType == 'string') {
                     if (class_exists($var)) {
                         $classObject = new $var();
                         $classCode = XOAD_Client::register($classObject, array('class' => $var, 'url' => $params));
                         $classCode = $var . '=function(){return ' . $classCode . '}';
                         return $classCode;
                     }
                 }
             }
         }
     }
     return XOAD_Serializer::serialize($var);
 }
Exemplo n.º 21
0
 /**
  * Throws a XOAD callback exception.
  *
  * @access	protected
  *
  * @param	string	$message	Exception message.
  *
  * @return	string	Outputs JavaString code that contains the
  *					exception message.
  *
  * @static
  *
  */
 public static function throwException($message)
 {
     if (!XOAD_Server::notifyObservers('throwExceptionEnter', array('message' => &$message))) {
         return false;
     }
     restore_error_handler();
     $callbackException = array();
     $callbackException['exception'] = $message;
     if (XOAD_Server::notifyObservers('throwExceptionLeave', array('message' => &$message))) {
         print XOAD_Client::register($callbackException);
     }
     return true;
 }
Exemplo n.º 22
0
 public function xoadGetMeta()
 {
     XOAD_Client::privateMethods($this, array('loadQuestions', 'cleanAnswers'));
     XOAD_Client::mapMethods($this, array('getAnswers', 'submitAnswer', 'fetchResults'));
 }
Exemplo n.º 23
0
 /**
  * This method is called when the request matches the configurated
  * criterias for caching, but there is no data in the cache.
  *
  * @access	public
  *
  * @param	array	$request	The data that is associated with the
  *								callback.
  *
  * @param	array	$response	The data that is associated with the
  *								response.
  *
  * @return	bool	True if the request is cached, false otherwise.
  *
  * @static
  *
  */
 public static function cacheRequest(&$request, &$response)
 {
     if (!array_key_exists('_XOAD_CACHE_ARGUMENTS', $GLOBALS)) {
         return false;
     }
     $storage =& XOAD_Cache::getStorage();
     $cacheId =& $GLOBALS['_XOAD_CACHE_ARGUMENTS']['id'];
     $cacheData =& $GLOBALS['_XOAD_CACHE_ARGUMENTS']['data'];
     $cacheResponse = XOAD_Client::register($response);
     return $storage->save($cacheId, $cacheData['expire'], $cacheResponse);
 }
Exemplo n.º 24
0
        return 'OK';
    }
    function Invoke2()
    {
        sleep(5);
        return 'OK';
    }
}
define('XOAD_AUTOHANDLE', true);
require_once '../xoad.php';
echo XOAD_Utilities::header('..') . "\n";
?>
<script type="text/javascript">

var obj = <?php 
echo XOAD_Client::register(new Timeout());
?>
;

function handleError(error) {

	if (error.code == XOAD_ERROR_TIMEOUT) {

		alert('Global: Timeout.');
	}
};

xoad.setErrorHandler(handleError);

obj.onInvokeError = function(error) {
Exemplo n.º 25
0
 public function xoadGetMeta()
 {
     XOAD_Client::mapMethods($this, array('Import', 'Dump'));
 }
Exemplo n.º 26
0
Arquivo: core.php Projeto: umaxfun/x4m
 function processMainTemplate()
 {
     $this->_TMS->MFFields = array();
     $this->_TMS->MFReplacement = array();
     $pages = xCore::moduleFactory('pages.front');
     jsCollector::pushJsDir('main', xConfig::get('PATH', 'TEMPLATES') . '_base/js', 1);
     $this->globalFields['HOST'] = HOST;
     $this->globalFields['PAGE'] = $pages->page;
     $this->globalFields['DOMAIN'] = $pages->domain;
     $this->globalFields['LANGVERSION'] = $pages->langVersion;
     $this->globalFields['JS'] = jsCollector::get('main');
     /**
      * Подключение шаблона страницы если она не является страницей на главном шаблоне
      */
     if (!strstr($this->mainTemplate['path'], '_index.html')) {
         $this->_TMS->AddFileSection(xConfig::get('PATH', 'COMMON_TEMPLATES') . $this->mainTemplate['path']);
     }
     if ($this->externalMeta['Title']) {
         $this->globalFields['Title'] = $this->externalMeta['Title'];
     }
     if ($this->externalMeta['Keywords']) {
         $this->globalFields['Keywords'] = $this->externalMeta['Keywords'];
     }
     if ($this->externalMeta['Description']) {
         $this->globalFields['Description'] = $this->externalMeta['Description'];
     }
     global $cache;
     //догружаем не объявленные секции
     /*  
                 if(!$_COMMON_SITE_CONF['disable_m_caching'])
                 {                            
                 //    $cache_name=md5($_SERVER['REQUEST_URI']).$_SESSION['currency']['id'].'titles.xtx';
                  //   $cache->setCacheFile($cache_name);
                    if($m_cache=$cache->getCache())
                     {
                                         $seodata=unserialize($m_cache);                    
                                         $this->globalFields['Title']=$seodata['Title'];
                                         $this->globalFields['Keywords']=$seodata['Keywords'];
                                         $this->globalFields['Description']=$seodata['Description'];
                         
                     }else{
                  
                    //     $cache->setCache(serialize(array('Title'=>$this->globalFields['Title'],'Keywords'=>$this->globalFields['Keywords'],'Description'=>$this->globalFields['Description'])));
                     }          
                 
                 }
     */
     /**
      * Подключение главного шаблона для домена
      */
     $this->_TMS->AddFileSection(xConfig::get('PATH', 'COMMON_TEMPLATES') . $pages->domain['basic'] . '/_index.html');
     /**
      * Подключение главного шаблона кроссдоменного
      */
     if (file_exists($mainTemplate = xConfig::get('PATH', 'TEMPLATES') . '/_index.html')) {
         $this->_TMS->AddFileSection($mainTemplate);
     }
     //компонуем модули
     $this->_TMS->AddMFMassReplace($this->modules_out);
     //данные ноды  в странице
     $this->globalFields['ARES'] = xConfig::get('PATH', 'WEB_ARES');
     $this->_TMS->AddFileSection(xConfig::get('PATH', 'TEMPLATES') . '_base/tpl/connector.html');
     $this->_TMS->AddMassReplace('connector', array('xConnector' => XOAD_Client::register(new connector()), 'xoadHeader' => XOAD_Utilities::header(xConfig::get('WEBPATH', 'XOAD'))));
     $this->globalFields['XFRONT_API'] = $this->_TMS->parseSection('connector');
     if ($this->_TMS->SectionNests['MAIN']) {
         foreach ($this->_TMS->SectionNests['MAIN'] as $section) {
             $this->_TMS->AddMassReplace($section, $this->globalFields);
         }
     }
     //   $this->_TMS->AddMFMassReplace($_COMMON_SITE_CONF);
     return $this->_TMS->ParseRecurs('MAIN');
 }
Exemplo n.º 27
0
			.answer
			{
				font-weight: bold;
			}

		</style>
	</head>
	<body>
		<h1 id="question">Welcome</h1>
		<div id="answers"></div>
		<div id="pager"></div>
		<div id="loading">Loading...</div>
		<script type="text/javascript">
		<!--
		var exam = <?php 
echo XOAD_Client::register($exam);
?>
;

		var pageState = 0;

		var timeout = 10000;

		var answeredQuestion = 0;

		var currentQuestion = null;

		function showLoading()
		{
			document.body.style.cursor = 'wait';