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();
     }
 }
Example #2
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;
 }
Example #3
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;
 }
	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 log($context, $appMessages)
 {
     $logFile = _hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path);
     $req = $context->request;
     $res = $context->response;
     $userDetails = $req->get_clientIP();
     if ((null !== $context->session ? $context->session->get_id() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null(null !== $context->session ? $context->session->get_id() : null);
     }
     if (($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null) !== null) {
         $userDetails .= " " . _hx_string_or_null($context->auth !== null && $context->auth->get_currentUser() !== null ? $context->auth->get_currentUser()->get_userID() : null);
     }
     $content = "" . Std::string(Date::now()) . " [" . _hx_string_or_null($req->get_httpMethod()) . "] [" . _hx_string_or_null($req->get_uri()) . "] from [" . _hx_string_or_null($userDetails) . "], response: [" . _hx_string_rec($res->status, "") . " " . _hx_string_or_null($res->get_contentType()) . "]\n";
     $_g = 0;
     $_g1 = $context->messages;
     while ($_g < $_g1->length) {
         $msg = $_g1[$_g];
         ++$_g;
         $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg)) . "\n";
         unset($msg);
     }
     if ($appMessages !== null) {
         $_g2 = 0;
         while ($_g2 < $appMessages->length) {
             $msg1 = $appMessages[$_g2];
             ++$_g2;
             $content .= "\t" . _hx_string_or_null(ufront_log_FileLogger::format($msg1)) . "\n";
             unset($msg1);
         }
     }
     $path = haxe_io_Path::directory($logFile);
     $path1 = haxe_io_Path::addTrailingSlash($path);
     $_p = null;
     $parts = new _hx_array(array());
     while ($path1 !== ($_p = haxe_io_Path::directory($path1))) {
         $parts->unshift($path1);
         $path1 = $_p;
     }
     $_g3 = 0;
     while ($_g3 < $parts->length) {
         $part = $parts[$_g3];
         ++$_g3;
         if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
             @mkdir($part, 493);
         }
         unset($part);
     }
     $file = sys_io_File::append(_hx_string_or_null($context->get_contentDirectory()) . _hx_string_or_null($this->path), null);
     $file->writeString($content);
     $file->close();
     return ufront_core_SurpriseTools::success();
 }
Example #6
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;
 }
Example #7
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;
 }
 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;
 }
 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(", ")) . ")";
 }
Example #10
0
 static function makeStack($s)
 {
     $a = $GLOBALS[$s];
     $m = new _hx_array(array());
     $_g1 = 0;
     $_g = $a->length - ($s == "%s" ? 2 : 0);
     while ($_g1 < $_g) {
         $i = $_g1++;
         $d = _hx_explode("::", $a[$i]);
         $m->unshift(haxe_StackItem::Method($d[0], $d[1]));
         unset($i, $d);
     }
     return $m;
 }
 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);
     }
 }
Example #12
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;
 }
Example #13
0
 public function getCustomFields($list_id)
 {
     $sb = new StringBuf();
     $phValues = new _hx_array(array());
     $param = new haxe_ds_StringMap();
     $param->set("table", "vicidial_lists_fields");
     $param->set("where", "list_id|" . _hx_string_or_null(S::$my->real_escape_string($list_id)));
     $param->set("fields", "field_name,field_label,field_type,field_options");
     $param->set("order", "field_rank,field_order");
     $param->set("limit", "100");
     haxe_Log::trace($param, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 128, "className" => "model.Clients", "methodName" => "getCustomFields")));
     $cFields = null;
     $a = $this->doSelect($param, $sb, $phValues);
     $cFields = new _hx_array($a);
     haxe_Log::trace($cFields->length, _hx_anonymous(array("fileName" => "Clients.hx", "lineNumber" => 130, "className" => "model.Clients", "methodName" => "getCustomFields")));
     $ret = new _hx_array(array());
     $_g = 0;
     while ($_g < $cFields->length) {
         $cf = $cFields[$_g];
         ++$_g;
         $field = php_Lib::hashOfAssociativeArray($cf);
         $ret->push($field);
         unset($field, $cf);
     }
     return $ret;
 }
 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));
 }
Example #15
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("&");
 }
Example #17
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);
 }
 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 create()
 {
     $s = new _hx_array(array());
     $_g = 0;
     while ($_g < 8) {
         $i = $_g++;
         $s[$i] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i);
     }
     $s[8] = "-";
     $_g1 = 9;
     while ($_g1 < 13) {
         $i1 = $_g1++;
         $s[$i1] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i1);
     }
     $s[13] = "-";
     $s[14] = "4";
     $_g2 = 15;
     while ($_g2 < 18) {
         $i2 = $_g2++;
         $s[$i2] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i2);
     }
     $s[18] = "-";
     $s[19] = "" . _hx_string_or_null(_hx_char_at("89AB", Math::floor(Math::random() * 4)));
     $_g3 = 20;
     while ($_g3 < 23) {
         $i3 = $_g3++;
         $s[$i3] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i3);
     }
     $s[23] = "-";
     $_g4 = 24;
     while ($_g4 < 36) {
         $i4 = $_g4++;
         $s[$i4] = _hx_char_at("0123456789ABCDEF", Math::floor(Math::random() * 16));
         unset($i4);
     }
     return $s->join("");
 }
 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;
 }
 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;
 }
 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;
     }
 }
 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());
     }
 }
Example #24
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;
 }
Example #25
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;
 }
Example #26
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 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();
     }
 }
 public function requestIn($ctx)
 {
     $_g = $this;
     if (strtolower($ctx->request->get_httpMethod()) === "post" && $ctx->request->isMultipart()) {
         $file = null;
         $postName = null;
         $origFileName = null;
         $size = 0;
         $tmpFilePath = null;
         $dateStr = DateTools::format(Date::now(), "%Y%m%d-%H%M");
         $dir = _hx_string_or_null($ctx->get_contentDirectory()) . _hx_string_or_null(haxe_io_Path::addTrailingSlash(ufront_web_upload_TmpFileUploadMiddleware::$subDir));
         $path = haxe_io_Path::removeTrailingSlashes($dir);
         $path1 = haxe_io_Path::addTrailingSlash($path);
         $_p = null;
         $parts = new _hx_array(array());
         while ($path1 !== ($_p = haxe_io_Path::directory($path1))) {
             $parts->unshift($path1);
             $path1 = $_p;
         }
         $_g1 = 0;
         while ($_g1 < $parts->length) {
             $part = $parts[$_g1];
             ++$_g1;
             if (_hx_char_code_at($part, strlen($part) - 1) !== 58 && !file_exists($part)) {
                 @mkdir($part, 493);
             }
             unset($part);
         }
         $onPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_0"), 'execute');
         $onData = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_1"), 'execute');
         $onEndPart = array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_2"), 'execute');
         return tink_core__Future_Future_Impl_::map($ctx->request->parseMultipart($onPart, $onData, $onEndPart), array(new _hx_lambda(array(&$_g, &$ctx, &$dateStr, &$dir, &$file, &$onData, &$onEndPart, &$onPart, &$origFileName, &$postName, &$size, &$tmpFilePath), "ufront_web_upload_TmpFileUploadMiddleware_3"), 'execute'), null);
     } else {
         return ufront_core_SurpriseTools::success();
     }
 }
 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);
 }
Example #30
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;
 }