public function log($ctx, $appMessages)
 {
     if (!php_Boot::$skip_constructor) {
         $messages = new _hx_array(array());
         $userDetails = $ctx->request->get_clientIP();
         if ((null !== $ctx->session ? $ctx->session->get_id() : null) !== null) {
             $userDetails .= " " . _hx_string_or_null(null !== $ctx->session ? $ctx->session->get_id() : null);
         }
         if (($ctx->auth !== null && $ctx->auth->get_currentUser() !== null ? $ctx->auth->get_currentUser()->get_userID() : null) !== null) {
             $userDetails .= " " . _hx_string_or_null($ctx->auth !== null && $ctx->auth->get_currentUser() !== null ? $ctx->auth->get_currentUser()->get_userID() : null);
         }
         $requestLog = "[" . _hx_string_or_null($ctx->request->get_httpMethod()) . " " . _hx_string_or_null($ctx->request->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($ctx->response->status, "") . " " . _hx_string_or_null($ctx->response->get_contentType()) . "]";
         $messages->push($requestLog);
         $_g = 0;
         $_g1 = $ctx->messages;
         while ($_g < $_g1->length) {
             $msg = $_g1[$_g];
             ++$_g;
             $messages->push(ufront_log_ServerConsoleLogger::formatMsg($msg));
             unset($msg);
         }
         if ($appMessages !== null) {
             $_g2 = 0;
             while ($_g2 < $appMessages->length) {
                 $msg1 = $appMessages[$_g2];
                 ++$_g2;
                 $messages->push(ufront_log_ServerConsoleLogger::formatMsg($msg1));
                 unset($msg1);
             }
         }
         ufront_log_ServerConsoleLogger::writeLog($messages->join("\n  "), null);
         return ufront_core_SurpriseTools::success();
     }
 }
	static function getPublicAndProtectedVars($fileData) {
		$results = (new _hx_array(array()));
		$searchIndex = 0;
		while($searchIndex < strlen($fileData)) {
			$searchIndex = _hx_index_of($fileData, "public \$", $searchIndex);
			if($searchIndex === -1) {
				break;
			}
			$semiColonIndex = _hx_index_of($fileData, ";", $searchIndex);
			$varName = _hx_substring($fileData, $searchIndex + 8, $semiColonIndex);
			$results->push(_hx_anonymous(array("varName" => $varName, "isPublic" => true)));
			$searchIndex = $semiColonIndex;
			unset($varName,$semiColonIndex);
		}
		$searchIndex = 0;
		while($searchIndex < strlen($fileData)) {
			$searchIndex = _hx_index_of($fileData, "protected \$", $searchIndex);
			if($searchIndex === -1) {
				break;
			}
			$semiColonIndex1 = _hx_index_of($fileData, ";", $searchIndex);
			$varName1 = _hx_substring($fileData, $searchIndex + 11, $semiColonIndex1);
			$results->push(_hx_anonymous(array("varName" => $varName1, "isPublic" => false)));
			$searchIndex = $semiColonIndex1;
			unset($varName1,$semiColonIndex1);
		}
		return $results;
	}
 public function render($format, $mml, $latex, $properties, $outProperties)
 {
     $servicesClass = Type::resolveClass("com.wiris.editor.services.PublicServices");
     $getInstance = Reflect::field($servicesClass, "getInstance");
     $publicServices = Reflect::callMethod($servicesClass, $getInstance, null);
     $args = new _hx_array(array());
     $args->push($mml);
     $args->push($latex);
     $args->push($properties);
     $args->push($outProperties);
     try {
         if (_hx_index_of($format, "png", null) !== -1) {
             $renderPngMethod = Reflect::field($publicServices, "renderPng");
             $pngObject = Reflect::callMethod($publicServices, $renderPngMethod, $args);
             $pngBytes = $pngObject;
             return haxe_io_Bytes::ofData($pngBytes);
         } else {
             if (_hx_index_of($format, "svg", null) !== -1) {
                 $renderSvgMethod = Reflect::field($publicServices, "renderSvg");
                 $svgObject = Reflect::callMethod($publicServices, $renderSvgMethod, $args);
                 $svgString = $svgObject;
                 return haxe_io_Bytes::ofString($svgString);
             } else {
                 throw new HException("Unexpected image format.");
             }
         }
     } catch (Exception $»e) {
         $_ex_ = $»e instanceof HException ? $»e->e : $»e;
         $e = $_ex_;
         throw new HException($e->getMessage());
     }
 }
 public function deleteCache()
 {
     $formulaFolder = $this->getAndCheckFolder(com_wiris_plugin_api_ConfigurationKeys::$FORMULA_FOLDER);
     $cacheFolder = $this->getAndCheckFolder(com_wiris_plugin_api_ConfigurationKeys::$CACHE_FOLDER);
     $includes = new _hx_array(array());
     $includes->push("png");
     $includes->push("csv");
     $includes->push("txt");
     if (!(com_wiris_system_PropertiesTools::getProperty($this->config, com_wiris_plugin_api_ConfigurationKeys::$SAVE_MODE, "xml") === "image")) {
         $includes->push("ini");
     }
     com_wiris_util_sys_Store::deleteDirectory($formulaFolder, $includes);
     com_wiris_util_sys_Store::deleteDirectory($cacheFolder, $includes);
 }
示例#5
0
 public function decodeArray()
 {
     $v = new _hx_array(array());
     $this->nextToken();
     $this->skipBlanks();
     if ($this->c === 93) {
         $this->nextToken();
         return $v;
     }
     while ($this->c !== 93) {
         $o = $this->localDecode();
         $v->push($o);
         $this->skipBlanks();
         if ($this->c === 44) {
             $this->nextToken();
             $this->skipBlanks();
         } else {
             if ($this->c !== 93) {
                 throw new HException("Expected ',' or ']'.");
             }
         }
         unset($o);
     }
     $this->nextToken();
     return $v;
 }
示例#6
0
 public function getGlobals($param)
 {
     $fieldNames = new haxe_ds_StringMap();
     $typeMap = new haxe_ds_StringMap();
     $optionsMap = new haxe_ds_StringMap();
     $eF = $this->getEditorFields(null);
     $keys = $eF->keys();
     $tableNames = new _hx_array(array());
     $tableFields = new haxe_ds_StringMap();
     haxe_Log::trace($param, _hx_anonymous(array("fileName" => "App.hx", "lineNumber" => 32, "className" => "model.App", "methodName" => "getGlobals")));
     while ($keys->hasNext()) {
         $k = $keys->next();
         $tableNames->push($k);
         $aFields = $eF->get($k);
         $cFields = $aFields->map(array(new _hx_lambda(array(&$aFields, &$eF, &$fieldNames, &$k, &$keys, &$optionsMap, &$param, &$tableFields, &$tableNames, &$typeMap), "model_App_0"), 'execute'));
         $tableFields->set($k, $cFields);
         $_g1 = 0;
         $_g = $cFields->length;
         while ($_g1 < $_g) {
             $f = $_g1++;
             $fieldNames->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_name"));
             if (_hx_array_get($aFields, $f)->get("field_options") !== null) {
                 $optionsMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_options"));
             }
             $typeMap->set($cFields[$f], _hx_array_get($aFields, $f)->get("field_type"));
             unset($f);
         }
         unset($_g1, $_g);
         unset($k, $cFields, $aFields);
     }
     $me = new model_Users($param);
     $me->get_info(null);
     $data = _hx_anonymous(array("fieldNames" => php_Lib::associativeArrayOfHash($fieldNames), "userMap" => $me->globals, "optionsMap" => $optionsMap, "typeMap" => $typeMap, "limit" => _hx_array_get(S::$conf->get("sql"), "LIMIT")));
     return $data;
 }
示例#7
0
 public function removeColumn($at)
 {
     $fate = new _hx_array(array());
     $_g1 = 0;
     $_g = $this->t->get_width();
     while ($_g1 < $_g) {
         $i = $_g1++;
         if ($i < $at) {
             $fate->push($i);
         } else {
             if ($i > $at) {
                 $fate->push($i - 1);
             } else {
                 $fate->push(-1);
             }
         }
         unset($i);
     }
     return $this->t->insertOrDeleteColumns($fate, $this->t->get_width() - 1);
 }
 static function toString($this1)
 {
     $years = $this1->getYears();
     $months = $this1->getMonths();
     $days = $this1->getDays();
     $hours = $this1->getHours();
     $minutes = $this1->getMinutes();
     $seconds = $this1->getSeconds();
     $parts = new _hx_array(array());
     if ($years !== 0) {
         $parts->push("" . _hx_string_rec($years, "") . "y");
     }
     if ($months !== 0) {
         $parts->push("" . _hx_string_rec($months, "") . "m");
     }
     if ($days !== 0) {
         $parts->push("" . _hx_string_rec($days, "") . "d");
     }
     if ($hours !== 0) {
         $parts->push("" . _hx_string_rec($hours, "") . "hrs");
     }
     if ($minutes !== 0) {
         $parts->push("" . _hx_string_rec($minutes, "") . "min");
     }
     if ($seconds !== 0) {
         $parts->push("" . _hx_string_rec($seconds, "") . "sec");
     }
     return _hx_string_or_null($this1->negative ? "-" : "") . "(" . _hx_string_or_null($parts->length === 0 ? "0sec" : $parts->join(", ")) . ")";
 }
示例#9
0
 public function isEditorLicensed()
 {
     $licenseClass = Type::resolveClass("com.wiris.util.sys.License");
     if ($licenseClass !== null) {
         $init = Reflect::field($licenseClass, "init");
         $initMethodParams = new _hx_array(array());
         $initMethodParams->push($this->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_KEY, ""));
         $initMethodParams->push("");
         $initMethodParams->push(new _hx_array(array(4, 5, 9, 10)));
         Reflect::callMethod($licenseClass, $init, $initMethodParams);
         $isLicensedMethod = Reflect::field($licenseClass, "isLicensed");
         $isLicensedObject = Reflect::callMethod($licenseClass, $isLicensedMethod, null);
         $isLicensed = null;
         if (_hx_index_of(Type::getClassName(Type::getClass($isLicensedObject)), "Boolean", null) !== -1) {
             $isLicensed = _hx_string_call($isLicensedObject, "toString", array());
         } else {
             $isLicensed = $isLicensedObject;
         }
         return $isLicensed;
     }
     return false;
 }
示例#10
0
 static function harray($it)
 {
     $a = new _hx_array(array());
     if (null == $it) {
         throw new HException('null iterable');
     }
     $»it = $it->iterator();
     while ($»it->hasNext()) {
         $i = $»it->next();
         $a->push($i);
     }
     return $a;
 }
示例#11
0
 static function getElements($node)
 {
     $nodes = new _hx_array(array());
     $nodeList = $node->iterator();
     while ($nodeList->hasNext()) {
         $item = $nodeList->next();
         if ($item->nodeType == Xml::$Element) {
             $nodes->push($item);
         }
         unset($item);
     }
     return $nodes;
 }
示例#12
0
 static function main()
 {
     $files = sys_FileSystem::readDirectory("../images");
     $validimages = new _hx_array(array());
     $_g = 0;
     while ($_g < $files->length) {
         $it = $files[$_g];
         ++$_g;
         if (StringTools::endsWith($it, ".jpg") === true) {
             $validimages->push($it);
         } else {
             if (StringTools::endsWith($it, ".png") === true) {
                 $validimages->push($it);
             } else {
                 if (StringTools::endsWith($it, ".gif") === true) {
                     $validimages->push($it);
                 }
             }
         }
         unset($it);
     }
     php_Lib::println(haxe_Json::stringify($validimages, null));
 }
 public function parseMultipart($onPart = null, $onData = null, $onEndPart = null)
 {
     $_g = $this;
     if (!$this->isMultipart()) {
         return ufront_core_SurpriseTools::success();
     }
     if ($this->_parsed) {
         throw new HException(ufront_web_HttpError::internalServerError("parseMultipart() has been called more than once.", null, _hx_anonymous(array("fileName" => "HttpRequest.hx", "lineNumber" => 93, "className" => "sys.ufront.web.context.HttpRequest", "methodName" => "parseMultipart"))));
     }
     $this->_parsed = true;
     if ($onPart === null) {
         $onPart = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_0"), 'execute');
     }
     if ($onData === null) {
         $onData = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_1"), 'execute');
     }
     if ($onEndPart === null) {
         $onEndPart = array(new _hx_lambda(array(&$_g, &$onData, &$onEndPart, &$onPart), "sys_ufront_web_context_HttpRequest_2"), 'execute');
     }
     $this->post = new haxe_ds_StringMap();
     $noParts = true;
     $isFile = false;
     $partName = null;
     $fileName = null;
     $currentContent = null;
     $callbackFutures = new _hx_array(array());
     $errors = new _hx_array(array());
     $processCallbackResult = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName), "sys_ufront_web_context_HttpRequest_3"), 'execute');
     $doEndOfPart = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_4"), 'execute');
     $doPart = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doEndOfPart, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_5"), 'execute');
     $doData = array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doEndOfPart, &$doPart, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_6"), 'execute');
     try {
         sys_ufront_web_context__HttpRequest_WebOverride::parseMultipart($doPart, $doData);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $stack = haxe_CallStack::toString(haxe_CallStack::exceptionStack());
         $err1 = "Failed to parse multipart data: " . Std::string($e) . "\n" . _hx_string_or_null($stack);
         $errors->push($err1);
     }
     if ($noParts === false) {
         call_user_func($doEndOfPart);
     }
     if ($callbackFutures->length > 0) {
         return tink_core__Future_Future_Impl_::flatMap(tink_core__Future_Future_Impl_::ofMany($callbackFutures, null), array(new _hx_lambda(array(&$_g, &$callbackFutures, &$currentContent, &$doData, &$doEndOfPart, &$doPart, &$e, &$errors, &$fileName, &$isFile, &$noParts, &$onData, &$onEndPart, &$onPart, &$partName, &$processCallbackResult), "sys_ufront_web_context_HttpRequest_7"), 'execute'), null);
     } else {
         $data5 = tink_core_Outcome::Success(tink_core_Noise::$Noise);
         return tink_core__Future_Future_Impl_::sync($data5);
     }
 }
 public function gatherArgs($target, $injector)
 {
     $values = new _hx_array(array());
     $index = 0;
     while ($index < $this->args->length) {
         $type = $this->args[$index++];
         $argName = $this->args[$index++];
         $opt = $this->args[$index++] === "o";
         $response = $injector->getValueForType($type, $argName);
         $values->push($response);
         unset($type, $response, $opt, $argName);
     }
     return $values;
 }
示例#15
0
 public function getValues()
 {
     $values = new _hx_array(array());
     $_g = 0;
     $_g1 = $this->_columns;
     while ($_g < $_g1->length) {
         $column = $_g1[$_g];
         ++$_g;
         if ($column->get_value() !== null) {
             $values->push($column->get_value());
         }
         unset($column);
     }
     return $values;
 }
 static function formatMessage($m)
 {
     $m->msg = "" . Std::string($m->msg);
     if ($m->pos->customParams !== null) {
         $_g = new _hx_array(array());
         $_g1 = 0;
         $_g2 = $m->pos->customParams;
         while ($_g1 < $_g2->length) {
             $p = $_g2[$_g1];
             ++$_g1;
             $_g->push("" . Std::string($p));
             unset($p);
         }
         $m->pos->customParams = $_g;
     }
     return "hxt" . _hx_string_or_null(haxe_Serializer::run($m));
 }
示例#17
0
 public function getAllButPrimaryKey()
 {
     $this->getColumns();
     $result = new _hx_array(array());
     $_g = 0;
     $_g1 = $this->columns;
     while ($_g < $_g1->length) {
         $col = $_g1[$_g];
         ++$_g;
         if ($col->isPrimaryKey()) {
             continue;
         }
         $result->push($col->getName());
         unset($col);
     }
     return $result;
 }
 public function queryString()
 {
     $params = new _hx_array(array());
     $_g = 0;
     $_g1 = $this->query;
     while ($_g < $_g1->length) {
         $param = $_g1[$_g];
         ++$_g;
         $value = null;
         if ($param->encoded) {
             $value = $param->value;
         } else {
             $value = rawurlencode($param->value);
         }
         $params->push(_hx_string_or_null($param->name) . "=" . _hx_string_or_null($value));
         unset($value, $param);
     }
     return $params->join("&");
 }
 public function printMultiValueMap($map)
 {
     $lines = new _hx_array(array());
     if (null == $map) {
         throw new HException('null iterable');
     }
     $__hx__it = $map->keys();
     while ($__hx__it->hasNext()) {
         unset($key);
         $key = $__hx__it->next();
         $line = "" . _hx_string_or_null($key) . "=";
         $values = ufront_core__MultiValueMap_MultiValueMap_Impl_::getAll($map, $key);
         $values->sort(isset(Reflect::$compare) ? Reflect::$compare : array("Reflect", "compare"));
         $line .= _hx_string_or_null($values->join(","));
         $lines->push($line);
         unset($values, $line);
     }
     $lines->sort(isset(Reflect::$compare) ? Reflect::$compare : array("Reflect", "compare"));
     return $lines->join("\n");
 }
 static function getApisInContext($context)
 {
     if (!php_Boot::$skip_constructor) {
         $apis = new _hx_array(array());
         $meta = haxe_rtti_Meta::getType($context);
         if ($meta->apiList !== null) {
             $_g = 0;
             $_g1 = $meta->apiList;
             while ($_g < $_g1->length) {
                 $apiName = $_g1[$_g];
                 ++$_g;
                 $api = Type::resolveClass($apiName);
                 if ($api !== null) {
                     $apis->push($api);
                 }
                 unset($apiName, $api);
             }
         }
         return $apis;
     }
 }
 static function allValues($this1)
 {
     $_g = new _hx_array(array());
     if (null == $this1) {
         throw new HException('null iterable');
     }
     $__hx__it = $this1->iterator();
     while ($__hx__it->hasNext()) {
         unset($arr);
         $arr = $__hx__it->next();
         $_g1 = 0;
         while ($_g1 < $arr->length) {
             $v = $arr[$_g1];
             ++$_g1;
             $_g->push($v);
             unset($v);
         }
         unset($_g1);
     }
     return $_g;
 }
 public function getModulesThatRequireInit()
 {
     $moduleSets = new _hx_array(array($this->requestMiddleware, $this->requestHandlers, $this->responseMiddleware, $this->logHandlers, $this->errorHandlers));
     $modules = new _hx_array(array());
     $_g = 0;
     while ($_g < $moduleSets->length) {
         $set = $moduleSets[$_g];
         ++$_g;
         $_g1 = 0;
         while ($_g1 < $set->length) {
             $module = $set[$_g1];
             ++$_g1;
             if (Std::is($module, _hx_qtype("ufront.app.UFInitRequired"))) {
                 $modules->push($module);
             }
             unset($module);
         }
         unset($set, $_g1);
     }
     return $modules;
 }
示例#23
0
 public function toHex()
 {
     $s = new StringBuf();
     $chars = new _hx_array(array());
     $str = "0123456789abcdef";
     $_g1 = 0;
     $_g = strlen($str);
     while ($_g1 < $_g) {
         $i = $_g1++;
         $chars->push(_hx_char_code_at($str, $i));
         unset($i);
     }
     $_g1 = 0;
     $_g = $this->length;
     while ($_g1 < $_g) {
         $i = $_g1++;
         $c = ord($this->b[$i]);
         $s->b .= chr($chars[$c >> 4]);
         $s->b .= chr($chars[$c & 15]);
         unset($i, $c);
     }
     return $s->b;
 }
 public function log($ctx, $appMessages)
 {
     if (!php_Boot::$skip_constructor) {
         if ($ctx->response->get_contentType() === "text/html" && !$ctx->response->isRedirect()) {
             $results = new _hx_array(array());
             $_g = 0;
             $_g1 = $ctx->messages;
             while ($_g < $_g1->length) {
                 $msg = $_g1[$_g];
                 ++$_g;
                 $results->push(ufront_log_BrowserConsoleLogger::formatMessage($msg));
                 unset($msg);
             }
             if ($results->length > 0) {
                 $script = "\n<script type=\"text/javascript\">\n" . _hx_string_or_null($results->join("\n")) . "\n</script>";
                 $newContent = ufront_web_result_CallJavascriptResult::insertScriptsBeforeBodyTag($ctx->response->getBuffer(), new _hx_array(array($script)));
                 $ctx->response->clearContent();
                 $ctx->response->write($newContent);
             }
         }
         return ufront_core_SurpriseTools::success();
     }
 }
示例#25
0
 public function save($q)
 {
     $lead_id = Std::parseInt($q->get("lead_id"));
     $user = S::$user;
     $log_id = false;
     if ($log_id = $this->saveLog($q, null)) {
         $cTable = "custom_" . Std::string($q->get("entry_list_id"));
         haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . Std::string($log_id), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 162, "className" => "model.QC", "methodName" => "save")));
         $primary_id = S::$my->real_escape_string($q->get("primary_id"));
         $sql = new StringBuf();
         $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET ");
         $cFields = S::tableFields("" . _hx_string_or_null($cTable), null);
         haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 177, "className" => "model.QC", "methodName" => "save")));
         $cFields->remove($primary_id);
         $bindTypes = "";
         $values2bind = null;
         $i = 0;
         $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
         $sets = new _hx_array(array());
         $_g = 0;
         while ($_g < $cFields->length) {
             $c = $cFields[$_g];
             ++$_g;
             $val = $q->get($c);
             if ($val !== null) {
                 if (Std::is($val, _hx_qtype("String"))) {
                     $values2bind[$i++] = $val;
                 } else {
                     $values2bind[$i++] = $val[0];
                 }
                 $type = $dbFieldTypes->get($c);
                 if (Util::any2bool($type)) {
                     $bindTypes .= _hx_string_or_null($type);
                 } else {
                     $bindTypes .= "s";
                 }
                 $sets->push(_hx_string_or_null($c) . "=?");
                 unset($type);
             }
             unset($val, $c);
         }
         $sql->add($sets->join(","));
         $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
         $stmt = S::$my->stmt_init();
         haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 199, "className" => "model.QC", "methodName" => "save")));
         $success = $stmt->prepare($sql->b);
         if (!$success) {
             haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 203, "className" => "model.QC", "methodName" => "save")));
             return false;
         }
         $success = myBindParam($stmt, $values2bind, $bindTypes);
         haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 207, "className" => "model.QC", "methodName" => "save")));
         if ($success) {
             $success = $stmt->execute();
             if (!$success) {
                 haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 213, "className" => "model.QC", "methodName" => "save")));
                 return false;
             }
             $sql = new StringBuf();
             $uFields = model_QC::$vicdial_list_fields;
             $uFields->remove($primary_id);
             $bindTypes = "";
             $values2bind = null;
             $i = 0;
             $sql->add("UPDATE vicidial_list SET ");
             $sets = new _hx_array(array());
             $_g1 = 0;
             while ($_g1 < $uFields->length) {
                 $c1 = $uFields[$_g1];
                 ++$_g1;
                 $val1 = $q->get($c1);
                 if ($val1 !== null) {
                     if (Std::is($val1, _hx_qtype("String"))) {
                         $values2bind[$i++] = $val1;
                     } else {
                         $values2bind[$i++] = $val1[0];
                     }
                     $type1 = $dbFieldTypes->get($c1);
                     if (Util::any2bool($type1)) {
                         $bindTypes .= _hx_string_or_null($type1);
                     } else {
                         $bindTypes .= "s";
                     }
                     $sets->push(_hx_string_or_null($c1) . "=?");
                     unset($type1);
                 }
                 unset($val1, $c1);
             }
             $values2bind[$i++] = S::$user;
             $bindTypes .= "s";
             $sets->push("security_phrase=?");
             $values2bind[$i++] = "XX";
             $bindTypes .= "s";
             $sets->push("state=?");
             if (_hx_equal($q->get("status"), "QCOK") || _hx_equal($q->get("status"), "QCBAD")) {
                 $list_id = 10000;
                 if (_hx_equal($q->get("status"), "QCOK")) {
                     $mID = Std::parseInt($q->get("vendor_lead_code"));
                     if ($mID === null) {
                         $mID = S::newMemberID();
                         $values2bind[$i++] = $mID;
                         $bindTypes .= "s";
                         $sets->push("vendor_lead_code=?");
                     }
                 } else {
                     $list_id = 1800;
                 }
                 $entry_list_id = $q->get("entry_list_id");
                 $values2bind[$i++] = $q->get("status");
                 $bindTypes .= "s";
                 $sets->push("`status`=?");
                 $values2bind[$i++] = $list_id;
                 $bindTypes .= "s";
                 $sets->push("list_id=?");
                 $values2bind[$i++] = $entry_list_id;
                 $bindTypes .= "s";
                 $sets->push("entry_list_id=?");
                 $values2bind[$i++] = $q->get("owner");
                 $bindTypes .= "s";
                 $sets->push("owner=?");
             }
             $sql->add($sets->join(","));
             $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
             $stmt1 = S::$my->stmt_init();
             haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 277, "className" => "model.QC", "methodName" => "save")));
             $success1 = $stmt1->prepare($sql->b);
             if (!$success1) {
                 haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 281, "className" => "model.QC", "methodName" => "save")));
                 return false;
             }
             $success1 = myBindParam($stmt1, $values2bind, $bindTypes);
             haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 287, "className" => "model.QC", "methodName" => "save")));
             if ($success1) {
                 $success1 = $stmt1->execute();
                 if (!$success1) {
                     haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 293, "className" => "model.QC", "methodName" => "save")));
                     return false;
                 } else {
                     return $this->saveLog($q, $log_id) !== false;
                 }
             }
             return false;
         }
     } else {
         haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 306, "className" => "model.QC", "methodName" => "save")));
     }
     return false;
 }
 public function serviceText($serviceName, $param)
 {
     $servicesClass = Type::resolveClass("com.wiris.editor.services.PublicServices");
     $getInstance = Reflect::field($servicesClass, "getInstance");
     $publicServices = Reflect::callMethod($servicesClass, $getInstance, null);
     $serviceMethod = Reflect::field($publicServices, $serviceName);
     $args = new _hx_array(array());
     try {
         if (_hx_index_of($serviceName, "mathml2accessible", null) !== -1) {
             $mml = com_wiris_system_PropertiesTools::getProperty($param, "mml", null);
             if ($mml === null) {
                 throw new HException("Missing mml");
             } else {
                 $args->push($mml);
             }
             $lang = com_wiris_system_PropertiesTools::getProperty($param, "lang", "en");
             $args->push($lang);
             $args->push($param);
             $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args);
             return $serviceText;
         } else {
             if (_hx_index_of($serviceName, "mathml2latex", null) !== -1) {
                 $mml = com_wiris_system_PropertiesTools::getProperty($param, "mml", null);
                 if ($mml === null) {
                     throw new HException("Missing mml");
                 } else {
                     $args->push($mml);
                 }
                 $keepMathml = com_wiris_system_PropertiesTools::getProperty($param, "keepMathml", "false");
                 if (_hx_index_of($keepMathml, "true", null) !== -1) {
                     $args->push(true);
                 } else {
                     $args->push(false);
                 }
                 $args->push($param);
                 $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args);
                 return $serviceText;
             } else {
                 if (_hx_index_of($serviceName, "latex2mathml", null) !== -1) {
                     $latex = com_wiris_system_PropertiesTools::getProperty($param, "latex", null);
                     if ($latex === null) {
                         throw new HException("Missing LaTeX");
                     } else {
                         $args->push($latex);
                     }
                     $keepLatex = com_wiris_system_PropertiesTools::getProperty($param, "saveLatex", "false");
                     if (_hx_index_of($keepLatex, "false", null) !== -1) {
                         $args->push(false);
                     } else {
                         $args->push(true);
                     }
                     $args->push($param);
                     $serviceText = Reflect::callMethod($publicServices, $serviceMethod, $args);
                     return $serviceText;
                 } else {
                     throw new HException("Unknow service " . $serviceName);
                 }
             }
         }
     } catch (Exception $»e) {
         $_ex_ = $»e instanceof HException ? $»e->e : $»e;
         $e = $_ex_;
         throw new HException($e->getMessage());
     }
 }
示例#27
0
 public function alterColumns($db, $name, $columns)
 {
     $notBlank = array(new _hx_lambda(array(&$columns, &$db, &$name), "coopy_SqliteHelper_0"), 'execute');
     $sql = $this->fetchSchema($db, $name);
     $schema = $this->splitSchema($db, $name, $sql);
     $parts = $schema->parts;
     $nparts = new _hx_array(array());
     $new_column_list = new _hx_array(array());
     $ins_column_list = new _hx_array(array());
     $sel_column_list = new _hx_array(array());
     $meta = $schema->columns;
     $_g1 = 0;
     $_g = $columns->length;
     while ($_g1 < $_g) {
         $i = $_g1++;
         $c = $columns[$i];
         if ($c->name !== null) {
             if ($c->prevName !== null) {
                 $sel_column_list->push($c->prevName);
                 $ins_column_list->push($c->name);
             }
             $orig_type = "";
             $orig_primary = false;
             if ($schema->name2column->exists($c->name)) {
                 $m = $schema->name2column->get($c->name);
                 $orig_type = $m->type_value;
                 $orig_primary = $m->primary;
                 unset($m);
             }
             $next_type = $orig_type;
             $next_primary = $orig_primary;
             if ($c->props !== null) {
                 $_g2 = 0;
                 $_g3 = $c->props;
                 while ($_g2 < $_g3->length) {
                     $p = $_g3[$_g2];
                     ++$_g2;
                     if ($p->name === "type") {
                         $next_type = $p->val;
                     }
                     if ($p->name === "key") {
                         $next_primary = "" . Std::string($p->val) === "primary";
                     }
                     unset($p);
                 }
                 unset($_g3, $_g2);
             }
             $part = "" . _hx_string_or_null($c->name);
             if (call_user_func_array($notBlank, array($next_type))) {
                 $part .= " " . _hx_string_or_null($next_type);
             }
             if ($next_primary) {
                 $part .= " PRIMARY KEY";
             }
             $nparts->push($part);
             $new_column_list->push($c->name);
             unset($part, $orig_type, $orig_primary, $next_type, $next_primary);
         }
         unset($i, $c);
     }
     if (!$this->exec($db, "BEGIN TRANSACTION")) {
         return false;
     }
     $c1 = $this->columnListSql($ins_column_list);
     $tname = $db->getQuotedTableName($name);
     if (!$this->exec($db, "CREATE TEMPORARY TABLE __coopy_backup(" . _hx_string_or_null($c1) . ")")) {
         return false;
     }
     if (!$this->exec($db, "INSERT INTO __coopy_backup (" . _hx_string_or_null($c1) . ") SELECT " . _hx_string_or_null($c1) . " FROM " . _hx_string_or_null($tname))) {
         return false;
     }
     if (!$this->exec($db, "DROP TABLE " . _hx_string_or_null($tname))) {
         return false;
     }
     if (!$this->exec($db, _hx_string_or_null($schema->preamble) . "(" . _hx_string_or_null($nparts->join(", ")) . ")")) {
         return false;
     }
     if (!$this->exec($db, "INSERT INTO " . _hx_string_or_null($tname) . " (" . _hx_string_or_null($c1) . ") SELECT " . _hx_string_or_null($c1) . " FROM __coopy_backup")) {
         return false;
     }
     if (!$this->exec($db, "DROP TABLE __coopy_backup")) {
         return false;
     }
     if (!$this->exec($db, "COMMIT")) {
         return false;
     }
     return true;
 }
示例#28
0
 public function elideColumns($output, $admin_w)
 {
     if ($this->active_column !== null) {
         $all_active = true;
         $_g1 = 0;
         $_g = $this->active_column->length;
         while ($_g1 < $_g) {
             $i = $_g1++;
             if ($this->active_column[$i] === 0) {
                 $all_active = false;
                 break;
             }
             unset($i);
         }
         if (!$all_active) {
             $fate = new _hx_array(array());
             $_g2 = 0;
             while ($_g2 < $admin_w) {
                 $i1 = $_g2++;
                 $fate->push($i1);
                 unset($i1);
             }
             $at = $admin_w;
             $ct = 0;
             $dots = new _hx_array(array());
             $_g11 = 0;
             $_g3 = $this->active_column->length;
             while ($_g11 < $_g3) {
                 $i2 = $_g11++;
                 $off = $this->active_column[$i2] === 0;
                 if ($off) {
                     $ct = $ct + 1;
                 } else {
                     $ct = 0;
                 }
                 if ($off && $ct > 1) {
                     $fate->push(-1);
                 } else {
                     if ($off) {
                         $dots->push($at);
                     }
                     $fate->push($at);
                     $at++;
                 }
                 unset($off, $i2);
             }
             $output->insertOrDeleteColumns($fate, $at);
             $_g4 = 0;
             while ($_g4 < $dots->length) {
                 $d = $dots[$_g4];
                 ++$_g4;
                 $_g21 = 0;
                 $_g12 = $output->get_height();
                 while ($_g21 < $_g12) {
                     $j = $_g21++;
                     $output->setCell($d, $j, $this->builder->marker("..."));
                     unset($j);
                 }
                 unset($_g21, $_g12);
                 unset($d);
             }
         }
     }
 }
示例#29
0
 public function fieldFormat($fields)
 {
     $fieldsWithFormat = new _hx_array(array());
     $sF = _hx_explode(",", $fields);
     $dbQueryFormats = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbQueryFormats")));
     $qKeys = new _hx_array(array());
     $it = $dbQueryFormats->keys();
     while ($it->hasNext()) {
         $qKeys->push($it->next());
     }
     $_g = 0;
     while ($_g < $sF->length) {
         $f = $sF[$_g];
         ++$_g;
         if (Lambda::has($qKeys, $f)) {
             $format = $dbQueryFormats->get($f);
             $fieldsWithFormat->push(_hx_string_or_null($format[0]) . "(" . _hx_string_or_null(S::$my->real_escape_string($f)) . ", \"" . _hx_string_or_null($format[1]) . "\") AS `" . _hx_string_or_null($f) . "`");
             unset($format);
         } else {
             $fieldsWithFormat->push(S::$my->real_escape_string($f));
         }
         unset($f);
     }
     return $fieldsWithFormat->join(",");
 }
示例#30
0
 public function save($q)
 {
     $lead_id = Std::parseInt($q->get("lead_id"));
     $res = S::$my->query("INSERT INTO vicidial_lead_log SELECT * FROM (SELECT NULL AS log_id," . _hx_string_rec($lead_id, "") . " AS lead_id,NOW() AS entry_date) AS ll JOIN (SELECT modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM `vicidial_list`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS vl", null);
     $log_id = S::$my->insert_id;
     if ($log_id > 0) {
         $cTable = "custom_" . Std::string($q->get("entry_list_id"));
         haxe_Log::trace(_hx_string_or_null($cTable) . " log_id:" . _hx_string_rec($log_id, ""), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 110, "className" => "model.QC", "methodName" => "save")));
         if ($this->checkOrCreateCustomTable($cTable, null)) {
             $cLogTable = _hx_string_or_null($cTable) . "_log";
             $res = S::$my->query("INSERT INTO " . _hx_string_or_null($cLogTable) . " SELECT * FROM (SELECT " . _hx_string_rec($log_id, "") . " AS log_id) AS ll JOIN (SELECT * FROM `" . _hx_string_or_null($cTable) . "`WHERE `lead_id`=" . _hx_string_rec($lead_id, "") . ")AS cl", null);
             haxe_Log::trace("INSERT INTO " . _hx_string_or_null($cLogTable) . " ..." . _hx_string_or_null(S::$my->error) . "<", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 117, "className" => "model.QC", "methodName" => "save")));
             if (S::$my->error === "") {
                 $primary_id = S::$my->real_escape_string($q->get("primary_id"));
                 $sql = new StringBuf();
                 $sql->add("UPDATE " . _hx_string_or_null($cTable) . " SET ");
                 $cFields = S::tableFields("" . _hx_string_or_null($cTable), null);
                 haxe_Log::trace("" . _hx_string_or_null($cTable) . " fields:" . _hx_string_or_null($cFields->toString()), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 125, "className" => "model.QC", "methodName" => "save")));
                 $cFields->remove($primary_id);
                 $bindTypes = "";
                 $values2bind = null;
                 $i = 0;
                 $dbFieldTypes = php_Lib::hashOfAssociativeArray(php_Lib::associativeArrayOfObject(S::$conf->get("dbFieldTypes")));
                 $sets = new _hx_array(array());
                 $_g = 0;
                 while ($_g < $cFields->length) {
                     $c = $cFields[$_g];
                     ++$_g;
                     $val = $q->get($c);
                     if ($val !== null) {
                         if (Std::is($val, _hx_qtype("String"))) {
                             $values2bind[$i++] = $val;
                         } else {
                             $values2bind[$i++] = $val[0];
                         }
                         $type = $dbFieldTypes->get($c);
                         if (Util::any2bool($type)) {
                             $bindTypes .= _hx_string_or_null($type);
                         } else {
                             $bindTypes .= "s";
                         }
                         $sets->push(_hx_string_or_null($c) . "=?");
                         unset($type);
                     }
                     unset($val, $c);
                 }
                 $sql->add($sets->join(","));
                 $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
                 $stmt = S::$my->stmt_init();
                 haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 147, "className" => "model.QC", "methodName" => "save")));
                 $success = $stmt->prepare($sql->b);
                 if (!$success) {
                     haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 151, "className" => "model.QC", "methodName" => "save")));
                     return false;
                 }
                 $success = myBindParam($stmt, $values2bind, $bindTypes);
                 haxe_Log::trace("success:" . Std::string($success), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 155, "className" => "model.QC", "methodName" => "save")));
                 if ($success) {
                     $success = $stmt->execute();
                     if (!$success) {
                         haxe_Log::trace($stmt->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 161, "className" => "model.QC", "methodName" => "save")));
                         return false;
                     }
                     $sql = new StringBuf();
                     $uFields = model_QC::$vicdial_list_fields;
                     $uFields->remove($primary_id);
                     $bindTypes = "";
                     $values2bind = null;
                     $i = 0;
                     $sql->add("UPDATE vicidial_list SET ");
                     $sets = new _hx_array(array());
                     $_g1 = 0;
                     while ($_g1 < $uFields->length) {
                         $c1 = $uFields[$_g1];
                         ++$_g1;
                         $val1 = $q->get($c1);
                         if ($val1 !== null) {
                             if (Std::is($val1, _hx_qtype("String"))) {
                                 $values2bind[$i++] = $val1;
                             } else {
                                 $values2bind[$i++] = $val1[0];
                             }
                             $type1 = $dbFieldTypes->get($c1);
                             if (Util::any2bool($type1)) {
                                 $bindTypes .= _hx_string_or_null($type1);
                             } else {
                                 $bindTypes .= "s";
                             }
                             $sets->push(_hx_string_or_null($c1) . "=?");
                             unset($type1);
                         }
                         unset($val1, $c1);
                     }
                     $values2bind[$i++] = S::$user;
                     $bindTypes .= "s";
                     $sets->push("security_phrase=?");
                     if (_hx_equal($q->get("status"), "MITGL")) {
                         $list_id = 10000;
                         $mID = Std::parseInt($q->get("vendor_lead_code"));
                         if ($mID === null) {
                             $mID = S::newMemberID();
                             $values2bind[$i++] = $mID;
                             $bindTypes .= "s";
                             $sets->push("vendor_lead_code=?");
                         }
                         $entry_list_id = $q->get("entry_list_id");
                         $values2bind[$i++] = $q->get("status");
                         $bindTypes .= "s";
                         $sets->push("`status`=?");
                         $values2bind[$i++] = $list_id;
                         $bindTypes .= "s";
                         $sets->push("list_id=?");
                         $values2bind[$i++] = $entry_list_id;
                         $bindTypes .= "s";
                         $sets->push("entry_list_id=?");
                         $values2bind[$i++] = $q->get("user");
                         $bindTypes .= "s";
                         $sets->push("owner=?");
                     }
                     $sql->add($sets->join(","));
                     $sql->add(" WHERE lead_id=" . _hx_string_rec($lead_id, ""));
                     $stmt1 = S::$my->stmt_init();
                     haxe_Log::trace($sql->b, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 216, "className" => "model.QC", "methodName" => "save")));
                     $success1 = $stmt1->prepare($sql->b);
                     if (!$success1) {
                         haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 220, "className" => "model.QC", "methodName" => "save")));
                         return false;
                     }
                     $success1 = myBindParam($stmt1, $values2bind, $bindTypes);
                     haxe_Log::trace("success:" . Std::string($success1), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 224, "className" => "model.QC", "methodName" => "save")));
                     if ($success1) {
                         $success1 = $stmt1->execute();
                         if (!$success1) {
                             haxe_Log::trace($stmt1->error, _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 230, "className" => "model.QC", "methodName" => "save")));
                             return false;
                         }
                         return true;
                     }
                     return false;
                 }
             } else {
                 haxe_Log::trace("oops", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 240, "className" => "model.QC", "methodName" => "save")));
             }
         }
     }
     return false;
 }