Пример #1
0
 public function toString()
 {
     if ($this->format === com_wiris_util_json_JSonIntegerFormat::$HEXADECIMAL) {
         return "0x" . StringTools::hex($this->n, 0);
     }
     return "" . _hx_string_rec($this->n, "");
 }
 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(", ")) . ")";
 }
 public function get_description()
 {
     $buf = new StringBuf();
     $buf->add($this->value);
     if ($this->expires !== null) {
         if (ufront_web_HttpCookie::$tzOffset === null) {
             ufront_web_HttpCookie::$tzOffset = intval(date('Z', $this->expires->__t));
         }
         $gmtExpires = Date::fromTime($this->expires->getTime() + ufront_web_HttpCookie::$tzOffset);
         $zeroPad = array(new _hx_lambda(array(&$buf, &$gmtExpires), "ufront_web_HttpCookie_0"), 'execute');
         $day = ufront_web_HttpCookie::$dayNames[$gmtExpires->getDay()];
         $date = call_user_func_array($zeroPad, array($gmtExpires->getDate()));
         $month = ufront_web_HttpCookie::$monthNames[$gmtExpires->getMonth()];
         $year = $gmtExpires->getFullYear();
         $hour = call_user_func_array($zeroPad, array($gmtExpires->getHours()));
         $minute = call_user_func_array($zeroPad, array($gmtExpires->getMinutes()));
         $second = call_user_func_array($zeroPad, array($gmtExpires->getSeconds()));
         $dateStr = "" . _hx_string_or_null($day) . ", " . _hx_string_or_null($date) . "-" . _hx_string_or_null($month) . "-" . _hx_string_rec($year, "") . " " . _hx_string_or_null($hour) . ":" . _hx_string_or_null($minute) . ":" . _hx_string_or_null($second) . " GMT";
         ufront_web_HttpCookie::addPair($buf, "expires", $dateStr, null);
     }
     ufront_web_HttpCookie::addPair($buf, "domain", $this->domain, null);
     ufront_web_HttpCookie::addPair($buf, "path", $this->path, null);
     if ($this->secure) {
         ufront_web_HttpCookie::addPair($buf, "secure", null, true);
     }
     return $buf->b;
 }
Пример #4
0
 public function setup()
 {
     $this->data1 = new _hx_array(array());
     $this->data2 = new _hx_array(array());
     $scale = 1000;
     $cols = 5;
     $this->data1[$scale - 1] = null;
     $this->data2[$scale - 1] = null;
     $_g = 0;
     while ($_g < 2) {
         $k = $_g++;
         $_g1 = 0;
         while ($_g1 < $scale) {
             $i = $_g1++;
             $row = new _hx_array(array());
             $row[$cols - 1] = null;
             $row[0] = "<supplier>";
             $row[1] = "<product_code>";
             $row[2] = "" . _hx_string_rec($i + $k * 7, "");
             $row[3] = "" . _hx_string_rec(_hx_mod($i + $k * 7, 10), "");
             $row[4] = "GBP";
             if ($k === 1) {
                 $this->data1[$i] = $row;
             } else {
                 $this->data2[$i] = $row;
             }
             unset($row, $i);
         }
         unset($_g1);
         unset($k);
     }
 }
 static function formatMessage($m)
 {
     $type = null;
     $_g = $m->type;
     switch ($_g->index) {
         case 0:
             $type = "log";
             break;
         case 1:
             $type = "info";
             break;
         case 2:
             $type = "warn";
             break;
         case 3:
             $type = "error";
             break;
     }
     $extras = null;
     if (_hx_field($m, "pos") !== null && $m->pos->customParams !== null) {
         $extras = ", " . _hx_string_or_null($m->pos->customParams->join(", "));
     } else {
         $extras = "";
     }
     $msg = "" . _hx_string_or_null($m->pos->className) . "." . _hx_string_or_null($m->pos->methodName) . "(" . _hx_string_rec($m->pos->lineNumber, "") . "): " . Std::string($m->msg) . _hx_string_or_null($extras);
     return "console." . _hx_string_or_null($type) . "(decodeURIComponent(\"" . _hx_string_or_null(rawurlencode($msg)) . "\"))";
 }
Пример #6
0
 public function get_description()
 {
     $msg = "Class : " . _hx_string_or_null($this->__info->className) . " - > ";
     $msg .= _hx_string_or_null($this->__info->methodName) . "()\nline ";
     $msg .= _hx_string_rec($this->__info->lineNumber, "") . " : " . _hx_string_or_null($this->__description);
     return $msg;
 }
Пример #7
0
 public function math2Img($str, $prop)
 {
     $img = "<img";
     $output = array();
     $prop["centerbaseline"] = "false";
     $prop["accessible"] = "true";
     $prop["metrics"] = "true";
     $src = $this->render->createImage($str, $prop, $output);
     $img .= " src=\"" . $src . "\"";
     $alt = com_wiris_system_PropertiesTools::getProperty($output, "alt", null);
     $width = com_wiris_system_PropertiesTools::getProperty($output, "width", null);
     $height = com_wiris_system_PropertiesTools::getProperty($output, "height", null);
     $baseline = com_wiris_system_PropertiesTools::getProperty($output, "baseline", null);
     $dpi = Std::parseFloat($this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$WIRIS_DPI, "96"));
     $mml = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$FILTER_OUTPUT_MATHML, "false") === "true";
     $f = 96 / $dpi;
     $dwidth = $f * Std::parseFloat($width);
     $dheight = $f * Std::parseFloat($height);
     $dbaseline = $f * Std::parseFloat($baseline);
     $alt = $this->html_entity_encode($alt);
     $img .= " class=\"Wirisformula\"";
     $img .= " alt=\"" . $alt . "\"";
     $img .= " width=\"" . _hx_string_rec($dwidth, "") . "\"";
     $img .= " height=\"" . _hx_string_rec($dheight, "") . "\"";
     $d = $dbaseline - $dheight;
     $img .= " style=\"vertical-align:" . _hx_string_rec($d, "") . "px\"";
     if ($mml) {
         $tag = $this->plugin->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_MATHML_ATTRIBUTE, "data-mathml");
         $img .= " " . $tag . "=\"" . $this->save_xml_encode($str) . "\"";
     }
     $img .= "/>";
     return $img;
 }
 static function string($s)
 {
     $GLOBALS['%s']->push("Std::string");
     $__hx__spos = $GLOBALS['%s']->length;
     $tmp = _hx_string_rec($s, "");
     $GLOBALS['%s']->pop();
     return $tmp;
     $GLOBALS['%s']->pop();
 }
Пример #9
0
 public function connect($host, $port)
 {
     $errs = null;
     $errn = null;
     $r = stream_socket_client($this->protocol . "://" . $host->hostName . ":" . _hx_string_rec($port, ""), $errn, $errs);
     sys_net_Socket::checkError($r, $errn, $errs);
     $this->__s = $r;
     $this->assignHandler();
 }
Пример #10
0
 static function _trace($v, $i = null)
 {
     $info = null;
     if ($i !== null) {
         $info = _hx_string_or_null($i->fileName) . ":" . _hx_string_or_null($i->methodName) . ":" . _hx_string_rec($i->lineNumber, "") . ":";
     } else {
         $info = "";
     }
     file_put_contents(me_cunity_php_Debug::$logFile, _hx_string_or_null($info) . ":" . _hx_string_or_null(Std::is($v, _hx_qtype("String")) || Std::is($v, _hx_qtype("Int")) || Std::is($v, _hx_qtype("Float")) ? $v : print_r($v, 1)) . "\n", FILE_APPEND);
 }
 static function formatMsg($m)
 {
     $extras = null;
     if (_hx_field($m, "pos") !== null && $m->pos->customParams !== null) {
         $extras = ", " . _hx_string_or_null($m->pos->customParams->join(", "));
     } else {
         $extras = "";
     }
     $type = _hx_substr(Type::enumConstructor($m->type), 1, null);
     return "" . _hx_string_or_null($type) . ": " . _hx_string_or_null($m->pos->className) . "." . _hx_string_or_null($m->pos->methodName) . "(" . _hx_string_rec($m->pos->lineNumber, "") . "): " . Std::string($m->msg) . _hx_string_or_null($extras);
 }
 static function toOutcome($option, $pos = null)
 {
     switch ($option->index) {
         case 0:
             $value = _hx_deref($option)->params[0];
             return tink_core_Outcome::Success($value);
             break;
         case 1:
             return tink_core_Outcome::Failure(new tink_core_TypedError(404, "Some value expected but none found in " . _hx_string_or_null($pos->fileName) . "@line " . _hx_string_rec($pos->lineNumber, ""), _hx_anonymous(array("fileName" => "Outcome.hx", "lineNumber" => 37, "className" => "tink.core.OutcomeTools", "methodName" => "toOutcome"))));
             break;
     }
 }
 static function remotingError($error, $pos = null)
 {
     switch ($error->index) {
         case 0:
             $responseData = _hx_deref($error)->params[2];
             $responseCode = _hx_deref($error)->params[1];
             $remotingCallString = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed($responseCode, "HTTP " . _hx_string_rec($responseCode, "") . " Error during " . _hx_string_or_null($remotingCallString), $error, $pos);
             break;
         case 1:
             $errorMessage = _hx_deref($error)->params[1];
             $remotingCallString1 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(404, "Remoting API " . _hx_string_or_null($remotingCallString1) . " not found: " . _hx_string_or_null($errorMessage), $error, $pos);
             break;
         case 2:
             $stack = _hx_deref($error)->params[2];
             $e = _hx_deref($error)->params[1];
             $remotingCallString2 = _hx_deref($error)->params[0];
             $errorObj = Std::instance($e, _hx_qtype("tink.core.TypedError"));
             if ($errorObj !== null) {
                 return tink_core_TypedError::typed($errorObj->code, $errorObj->message, $error, $pos);
             } else {
                 return tink_core_TypedError::typed(500, "Internal Server Error while executing " . _hx_string_or_null($remotingCallString2), $error, $pos);
             }
             break;
         case 3:
             $e1 = _hx_deref($error)->params[1];
             $remotingCallString3 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(500, "Error during callback after " . _hx_string_or_null($remotingCallString3) . ": " . Std::string($e1), $error, $pos);
             break;
         case 4:
             $err = _hx_deref($error)->params[2];
             $troubleLine = _hx_deref($error)->params[1];
             $remotingCallString4 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(422, "Remoting serialization failed for call " . _hx_string_or_null($remotingCallString4) . ": could not process " . _hx_string_or_null($troubleLine), $error, $pos);
             break;
         case 5:
             $responseData1 = _hx_deref($error)->params[1];
             $remotingCallString5 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(500, "Error with response for " . _hx_string_or_null($remotingCallString5) . ": no remoting response found", $error, $pos);
             break;
         case 6:
             $data = _hx_deref($error)->params[1];
             $remotingCallString6 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(500, "Call to " . _hx_string_or_null($remotingCallString6) . " failed: " . Std::string($data), $error, $pos);
             break;
         case 7:
             $e2 = _hx_deref($error)->params[0];
             return tink_core_TypedError::typed(500, "Unknown exception during remoting call", $error, $pos);
             break;
     }
 }
Пример #14
0
 static function connect($params)
 {
     $dsn = "mysql:";
     if ($params->socket !== null) {
         $dsn .= "unix_socket=" . _hx_string_or_null($params->socket) . ";";
     } else {
         $dsn .= "host=" . _hx_string_or_null($params->host) . ";";
         if ($params->port !== null) {
             $dsn .= "port=" . _hx_string_rec($params->port, "") . ";";
         }
     }
     $dsn .= "dbname=" . _hx_string_or_null($params->database);
     return php_db_PDO::open($dsn, $params->user, $params->pass, null);
 }
Пример #15
0
 public function toString()
 {
     $s = "{";
     $it = $this->keys();
     $__hx__it = $it;
     while ($__hx__it->hasNext()) {
         unset($i);
         $i = $__hx__it->next();
         $s .= _hx_string_rec($i, "");
         $s .= " => ";
         $s .= Std::string($this->get($i));
         if ($it->hasNext()) {
             $s .= ", ";
         }
     }
     return _hx_string_or_null($s) . "}";
 }
Пример #16
0
 public function loadPropertiesLine($line, $count)
 {
     $line = trim($line);
     if (strlen($line) === 0) {
         return;
     }
     if (StringTools::startsWith($line, ";") || StringTools::startsWith($line, "#")) {
         return;
     }
     $equals = _hx_index_of($line, "=", null);
     if ($equals === -1) {
         throw new HException("Malformed INI file " . $this->filename . " in line " . _hx_string_rec($count, "") . " no equal sign found.");
     }
     $key = _hx_substr($line, 0, $equals);
     $key = trim($key);
     $value = _hx_substr($line, $equals + 1, null);
     $value = trim($value);
     if (StringTools::startsWith($value, "\"") && StringTools::endsWith($value, "\"")) {
         $value = _hx_substr($value, 1, strlen($value) - 2);
     }
     $backslash = 0;
     while (($backslash = _hx_index_of($value, "\\", $backslash)) !== -1) {
         if (strlen($value) <= $backslash + 1) {
             continue;
         }
         $letter = _hx_substr($value, $backslash + 1, 1);
         if ($letter === "n") {
             $letter = "\n";
         } else {
             if ($letter === "r") {
                 $letter = "\r";
             } else {
                 if ($letter === "t") {
                     $letter = "\t";
                 }
             }
         }
         $value = _hx_substr($value, 0, $backslash) . $letter . _hx_substr($value, $backslash + 2, null);
         $backslash++;
         unset($letter);
     }
     $this->props->set($key, $value);
 }
Пример #17
0
 public function checkDiff($e1, $e2, $verbose = null)
 {
     if ($verbose === null) {
         $verbose = false;
     }
     $table1 = harness_Native::table($e1);
     $table2 = harness_Native::table($e2);
     $data_diff = new _hx_array(array());
     $table_diff = harness_Native::table($data_diff);
     $flags = new coopy_CompareFlags();
     $alignment = coopy_Coopy::compareTables($table1, $table2, $flags)->align();
     if ($verbose) {
         haxe_Log::trace("Alignment: " . Std::string($alignment), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 18, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $highlighter = new coopy_TableDiff($alignment, $flags);
     $highlighter->hilite($table_diff);
     if ($verbose) {
         haxe_Log::trace("Diff: " . Std::string($table_diff), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 21, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $o = coopy_Coopy::diff($table1, $table2, null);
     $this->assertTrue(coopy_SimpleTable::tableIsSimilar($table_diff, $o), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 25, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     $table3 = $table1->hclone();
     $patcher = new coopy_HighlightPatch($table3, $table_diff, null);
     $patcher->apply();
     if ($verbose) {
         haxe_Log::trace("Desired " . _hx_string_rec($table2->get_height(), "") . "x" . _hx_string_rec($table2->get_width(), "") . ": " . Std::string($table2), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 30, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     if ($verbose) {
         haxe_Log::trace("Got " . _hx_string_rec($table3->get_height(), "") . "x" . _hx_string_rec($table3->get_width(), "") . ": " . Std::string($table3), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 31, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     if ($verbose) {
         haxe_Log::trace("Base " . _hx_string_rec($table1->get_height(), "") . "x" . _hx_string_rec($table1->get_width(), "") . ": " . Std::string($table1), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 32, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $this->assertTrue(coopy_SimpleTable::tableIsSimilar($table3, $table2), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 33, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     return $table_diff;
 }
Пример #18
0
 public function toString()
 {
     if ($this->high === 0 && $this->low === 0) {
         return "0";
     }
     $str = "";
     $neg = false;
     $i = $this;
     if ($i->high < 0) {
         $neg = true;
         $i = haxe_Int64_0($this, $i, $neg, $str);
     }
     $ten = new haxe_Int64(0 | 0, 10 | 0);
     while (!(($i->high | $i->low) === 0)) {
         $r = haxe_Int64::divMod($i, $ten);
         $str = _hx_string_rec(haxe_Int64_1($this, $i, $neg, $r, $str, $ten), "") . $str;
         $i = $r->quotient;
         unset($r);
     }
     if ($neg) {
         $str = "-" . $str;
     }
     return $str;
 }
Пример #19
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;
 }
Пример #20
0
 public function customRequest($post, $api, $sock = null, $method = null)
 {
     $url_regexp = new EReg("^(https?://)?([a-zA-Z\\.0-9-]+)(:[0-9]+)?(.*)\$", "");
     if (!$url_regexp->match($this->url)) {
         $this->onError("Invalid URL");
         return;
     }
     $secure = $url_regexp->matched(1) === "https://";
     if ($sock === null) {
         if ($secure) {
             $sock = new php_net_SslSocket();
         } else {
             $sock = new sys_net_Socket();
         }
     }
     $host = $url_regexp->matched(2);
     $portString = $url_regexp->matched(3);
     $request = $url_regexp->matched(4);
     if ($request === "") {
         $request = "/";
     }
     $port = $portString === null || $portString === "" ? $secure ? 443 : 80 : Std::parseInt(_hx_substr($portString, 1, strlen($portString) - 1));
     $data = null;
     $multipart = _hx_field($this, "file") !== null;
     $boundary = null;
     $uri = null;
     if ($multipart) {
         $post = true;
         $boundary = Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000));
         while (strlen($boundary) < 38) {
             $boundary = "-" . $boundary;
         }
         $b = new StringBuf();
         if (null == $this->params) {
             throw new HException('null iterable');
         }
         $»it = $this->params->keys();
         while ($»it->hasNext()) {
             $p = $»it->next();
             $b->add("--");
             $b->add($boundary);
             $b->add("\r\n");
             $b->add("Content-Disposition: form-data; name=\"");
             $b->add($p);
             $b->add("\"");
             $b->add("\r\n");
             $b->add("\r\n");
             $b->add($this->params->get($p));
             $b->add("\r\n");
         }
         $b->add("--");
         $b->add($boundary);
         $b->add("\r\n");
         $b->add("Content-Disposition: form-data; name=\"");
         $b->add($this->file->param);
         $b->add("\"; filename=\"");
         $b->add($this->file->filename);
         $b->add("\"");
         $b->add("\r\n");
         $b->add("Content-Type: " . "application/octet-stream" . "\r\n" . "\r\n");
         $uri = $b->b;
     } else {
         if (null == $this->params) {
             throw new HException('null iterable');
         }
         $»it = $this->params->keys();
         while ($»it->hasNext()) {
             $p = $»it->next();
             if ($uri === null) {
                 $uri = "";
             } else {
                 $uri .= "&";
             }
             $uri .= rawurlencode($p) . "=" . rawurlencode($this->params->get($p));
         }
     }
     $b = new StringBuf();
     if ($method !== null) {
         $b->add($method);
         $b->add(" ");
     } else {
         if ($post) {
             $b->add("POST ");
         } else {
             $b->add("GET ");
         }
     }
     if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) {
         $b->add("http://");
         $b->add($host);
         if ($port !== 80) {
             $b->add(":");
             $b->add($port);
         }
     }
     $b->add($request);
     if (!$post && $uri !== null) {
         if (_hx_index_of($request, "?", 0) >= 0) {
             $b->add("&");
         } else {
             $b->add("?");
         }
         $b->add($uri);
     }
     $b->add(" HTTP/1.1\r\nHost: " . $host . "\r\n");
     if ($this->postData !== null) {
         $b->add("Content-Length: " . _hx_string_rec(strlen($this->postData), "") . "\r\n");
     } else {
         if ($post && $uri !== null) {
             if ($multipart || $this->headers->get("Content-Type") === null) {
                 $b->add("Content-Type: ");
                 if ($multipart) {
                     $b->add("multipart/form-data");
                     $b->add("; boundary=");
                     $b->add($boundary);
                 } else {
                     $b->add("application/x-www-form-urlencoded");
                 }
                 $b->add("\r\n");
             }
             if ($multipart) {
                 $b->add("Content-Length: " . _hx_string_rec(strlen($uri) + $this->file->size + strlen($boundary) + 6, "") . "\r\n");
             } else {
                 $b->add("Content-Length: " . _hx_string_rec(strlen($uri), "") . "\r\n");
             }
         }
     }
     if (null == $this->headers) {
         throw new HException('null iterable');
     }
     $»it = $this->headers->keys();
     while ($»it->hasNext()) {
         $h = $»it->next();
         $b->add($h);
         $b->add(": ");
         $b->add($this->headers->get($h));
         $b->add("\r\n");
     }
     $b->add("\r\n");
     if ($this->postData !== null) {
         $b->add($this->postData);
     } else {
         if ($post && $uri !== null) {
             $b->add($uri);
         }
     }
     try {
         if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) {
             $sock->connect(new sys_net_Host(haxe_Http::$PROXY->host), haxe_Http::$PROXY->port);
         } else {
             $sock->connect(new sys_net_Host($host), $port);
         }
         $sock->write($b->b);
         if ($multipart) {
             $bufsize = 4096;
             $buf = haxe_io_Bytes::alloc($bufsize);
             while ($this->file->size > 0) {
                 $size = haxe_Http_4($this, $api, $b, $boundary, $buf, $bufsize, $data, $host, $method, $multipart, $port, $portString, $post, $request, $secure, $sock, $uri, $url_regexp);
                 $len = 0;
                 try {
                     $len = $this->file->io->readBytes($buf, 0, $size);
                 } catch (Exception $»e) {
                     $_ex_ = $»e instanceof HException ? $»e->e : $»e;
                     if (($e = $_ex_) instanceof haxe_io_Eof) {
                         break;
                     } else {
                         throw $»e;
                     }
                 }
                 $sock->output->writeFullBytes($buf, 0, $len);
                 $this->file->size -= $len;
                 unset($size, $len, $e);
             }
             $sock->write("\r\n");
             $sock->write("--");
             $sock->write($boundary);
             $sock->write("--");
         }
         $this->readHttpResponse($api, $sock);
         $sock->close();
     } catch (Exception $»e) {
         $_ex_ = $»e instanceof HException ? $»e->e : $»e;
         $e = $_ex_;
         try {
             $sock->close();
         } catch (Exception $»e) {
             $_ex_ = $»e instanceof HException ? $»e->e : $»e;
             $e1 = $_ex_;
         }
         $this->onError(Std::string($e));
     }
 }
Пример #21
0
 public function __construct($e, $message = null, $code = null, $p = null)
 {
     $message = _hx_string_rec($e, '') . $message;
     parent::__construct($message, $code);
     $this->e = $e;
     $this->p = $p;
 }
Пример #22
0
 public function getMetricsFromBytes($bs, &$output)
 {
     $output = $output;
     $width = 0;
     $height = 0;
     $dpi = 0;
     $baseline = 0;
     $bys = haxe_io_Bytes::ofData($bs);
     $bi = new haxe_io_BytesInput($bys, null, null);
     $n = $bys->length;
     $alloc = 10;
     $b = haxe_io_Bytes::alloc($alloc);
     $bi->readBytes($b, 0, 8);
     $n -= 8;
     while ($n > 0) {
         $len = com_wiris_system_InputEx::readInt32_($bi);
         $typ = com_wiris_system_InputEx::readInt32_($bi);
         if ($typ === 1229472850) {
             $width = com_wiris_system_InputEx::readInt32_($bi);
             $height = com_wiris_system_InputEx::readInt32_($bi);
             com_wiris_system_InputEx::readInt32_($bi);
             $bi->readByte();
         } else {
             if ($typ === 1650545477) {
                 $baseline = com_wiris_system_InputEx::readInt32_($bi);
             } else {
                 if ($typ === 1883789683) {
                     $dpi = com_wiris_system_InputEx::readInt32_($bi);
                     $dpi = Math::round($dpi / 39.37);
                     com_wiris_system_InputEx::readInt32_($bi);
                     $bi->readByte();
                 } else {
                     if ($len > $alloc) {
                         $alloc = $len;
                         $b = haxe_io_Bytes::alloc($alloc);
                     }
                     $bi->readBytes($b, 0, $len);
                 }
             }
         }
         com_wiris_system_InputEx::readInt32_($bi);
         $n -= $len + 12;
         unset($typ, $len);
     }
     $r = null;
     if ($output !== null) {
         $output["width"] = "" . _hx_string_rec($width, "");
         $output["height"] = "" . _hx_string_rec($height, "");
         $output["baseline"] = "" . _hx_string_rec($baseline, "");
         if ($dpi !== 96) {
             $output["dpi"] = "" . _hx_string_rec($dpi, "");
         }
         $r = "";
     } else {
         $r = "&cw=" . _hx_string_rec($width, "") . "&ch=" . _hx_string_rec($height, "") . "&cb=" . _hx_string_rec($baseline, "");
         if ($dpi !== 96) {
             $r = $r . "&dpi=" . _hx_string_rec($dpi, "");
         }
     }
     return $r;
 }
 public function toString()
 {
     return "" . _hx_string_or_null($this->browser) . " v." . _hx_string_rec($this->majorVersion, "") . "." . _hx_string_rec($this->minorVersion, "") . " (" . _hx_string_or_null($this->version) . ") on " . _hx_string_or_null($this->platform);
 }
Пример #24
0
 public function find($param)
 {
     $sb = new StringBuf();
     $phValues = new _hx_array(array());
     $count = $this->countJoin($param, $sb, $phValues);
     $sb = new StringBuf();
     $phValues = new _hx_array(array());
     haxe_Log::trace("count:" . _hx_string_rec($count, "") . " page:" . _hx_string_or_null($param->get("page")) . ": " . _hx_string_or_null($param->exists("page") ? "Y" : "N"), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 268, "className" => "Model", "methodName" => "find")));
     $this->data = _hx_anonymous(array("count" => $count, "page" => $param->exists("page") ? Std::parseInt($param->get("page")) : 1, "rows" => $this->doSelect($param, $sb, $phValues)));
     return $this->json_encode();
 }
Пример #25
0
 static function indentXml($xml, $space)
 {
     $depth = 0;
     $opentag = new EReg("^<([\\w-_]+)[^>]*>\$", "");
     $autotag = new EReg("^<([\\w-_]+)[^>]*/>\$", "");
     $closetag = new EReg("^</([\\w-_]+)>\$", "");
     $cdata = new EReg("^<!\\[CDATA\\[[^\\]]*\\]\\]>\$", "");
     $res = new StringBuf();
     $end = 0;
     $start = null;
     $text = null;
     while ($end < strlen($xml) && ($start = _hx_index_of($xml, "<", $end)) !== -1) {
         $text = $start > $end;
         if ($text) {
             $res->add(_hx_substr($xml, $end, $start - $end));
         }
         $end = _hx_index_of($xml, ">", $start) + 1;
         $aux = _hx_substr($xml, $start, $end - $start);
         if ($autotag->match($aux)) {
             $res->add("\n");
             $i = null;
             $_g = 0;
             while ($_g < $depth) {
                 $i1 = $_g++;
                 $res->add($space);
                 unset($i1);
             }
             unset($_g);
             $res->add($aux);
             unset($i);
         } else {
             if ($opentag->match($aux)) {
                 $res->add("\n");
                 $i = null;
                 $_g = 0;
                 while ($_g < $depth) {
                     $i1 = $_g++;
                     $res->add($space);
                     unset($i1);
                 }
                 unset($_g);
                 $res->add($aux);
                 $depth++;
                 unset($i);
             } else {
                 if ($closetag->match($aux)) {
                     $depth--;
                     if (!$text) {
                         $res->add("\n");
                         $i = null;
                         $_g = 0;
                         while ($_g < $depth) {
                             $i1 = $_g++;
                             $res->add($space);
                             unset($i1);
                         }
                         unset($_g);
                         unset($i);
                     }
                     $res->add($aux);
                 } else {
                     if ($cdata->match($aux)) {
                         $res->add($aux);
                     } else {
                         haxe_Log::trace("WARNING! malformed XML at character " . _hx_string_rec($end, "") . ":" . $xml, _hx_anonymous(array("fileName" => "WXmlUtils.hx", "lineNumber" => 583, "className" => "com.wiris.util.xml.WXmlUtils", "methodName" => "indentXml")));
                         $res->add($aux);
                     }
                 }
             }
         }
         unset($aux);
     }
     return trim($res->b);
 }
Пример #26
0
 public function toString()
 {
     $this->calculatePath();
     $txt = "";
     $_g1 = 0;
     $_g = $this->index;
     while ($_g1 < $_g) {
         $i = $_g1++;
         if ($this->path->get(0, $i) === -1) {
             $txt .= "*";
         } else {
             $txt .= _hx_string_rec($this->path->get(0, $i), "");
         }
         if ($this->K >= 10) {
             $txt .= " ";
         }
         unset($i);
     }
     $txt .= " costs " . _hx_string_rec($this->getCost(), "");
     return $txt;
 }
Пример #27
0
 static function greek2Latin($g)
 {
     $index = -1;
     if ($g < 100) {
         $index = _hx_index_of(com_wiris_util_xml_WCharacterBase::$greekLetters, "@00" . _hx_string_rec($g, "") . "@", null);
     } else {
         if ($g < 1000) {
             $index = _hx_index_of(com_wiris_util_xml_WCharacterBase::$greekLetters, "@0" . _hx_string_rec($g, "") . "@", null);
         } else {
             $index = _hx_index_of(com_wiris_util_xml_WCharacterBase::$greekLetters, "@" . _hx_string_rec($g, "") . "@", null);
         }
     }
     if ($index !== -1) {
         $s = _hx_substr(com_wiris_util_xml_WCharacterBase::$latinLetters, $index + 1, 4);
         return Std::parseInt($s);
     }
     return $g;
 }
Пример #28
0
 static function floatToString($value)
 {
     return "" . _hx_string_rec($value, "");
 }
Пример #29
0
 static function string($s)
 {
     return _hx_string_rec($s, "");
 }
Пример #30
0
 public function checkOrCreateCustomTable($srcTable, $suffix = null)
 {
     if ($suffix === null) {
         $suffix = "log";
     }
     $newTable = S::$my->real_escape_string(_hx_string_or_null($srcTable) . "_" . _hx_string_or_null($suffix));
     $res = S::$my->query("SHOW TABLES LIKE  \"" . _hx_string_or_null($newTable) . "\"", null);
     if (Util::any2bool($res) && $res->num_rows === 0) {
         haxe_Log::trace("CREATE TABLE `" . _hx_string_or_null($newTable) . "` like `" . _hx_string_or_null($srcTable) . "`", _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 254, "className" => "model.QC", "methodName" => "checkOrCreateCustomTable")));
         $res1 = S::$my->query("CREATE TABLE `" . _hx_string_or_null($newTable) . "` like `" . _hx_string_or_null($srcTable) . "`", null);
         if (S::$my->error === "") {
             $res1 = S::$my->query("ALTER TABLE " . _hx_string_or_null($newTable) . " DROP PRIMARY KEY, ADD `log_id` INT(9) NOT NULL  FIRST,  ADD  PRIMARY KEY (`log_id`)", null);
             if (S::$my->error !== "") {
                 S::hexit(S::$my->error);
             }
             return true;
         } else {
             S::hexit(S::$my->error);
         }
     } else {
         haxe_Log::trace("num_rows:" . _hx_string_rec($res->num_rows, ""), _hx_anonymous(array("fileName" => "QC.hx", "lineNumber" => 265, "className" => "model.QC", "methodName" => "checkOrCreateCustomTable")));
     }
     return true;
 }