function handle_error($errno, $errstr, $errfile, $errline, $errcontext) { global $__oocommon_version; if ($errno == 8) { return; } $bt = debug_backtrace(); for ($i = count($bt) - 1; $i > 1; $i--) { for ($k = 0; $k < count($error_stop_classes); $k++) { if ($bt[$i]["class"] == $error_stop_classes[$k]) { $flag = 1; } } } $bt = debug_backtrace(); echo "\n\t\t\t\t\t<div style=\"float:left;font-size:328px;color:rgb(255,0,0);font-family:Serif\t;\"><b>!</b></div>\n\t\t\t\t\t<div style=\"font-family:verdana;width:890px;border:outset 1px; 1px;padding:5px;\"><b style=\"letter-spacing:-4px;font-size:26px;color:rgb(255,70,10);font-family:Sans;\">\n\t\t\t\t\tOoops! An error has ocurred!</b><br />\n\t\t\t\t\t \n\t\t\t"; echo "<span style=\"font-family:verdana;\"><b>Guru meditation error :</b> " . $errstr . "<br /><br /></span>"; echo "<table border=\"1\" style=\"background:rgb(245,245,254);color:Rgb(25,25,25)\" cellspacing=\"3\"><tr><td>Current URL</td><td> " . getUrl() . "</td></tr>"; $r = new request(); echo "<tr><td >Request Variables</td><td>" . ret_arr($r) . "</td></tr>"; for ($i = count($bt) - 1; $i > 0; $i--) { for ($k = 0; $k < count($error_stop_classes); $k++) { if ($bt[$i]["class"] == $error_stop_classes[$k]) { $flag = 1; } } if ($bt[$i]["function"] != "handle_error" && $bt[$i]["function"] != "user_error") { if ($first == false) { echo "<tr><td colspan=\"2\"><span style=\"font-size:14px;font-weight:bold;\">Originated at " . $bt[$i]["file"] . ", line <b>" . $bt[$i]["line"] . "</b>, <u>" . ($bt[$i]["class"] ? $bt[$i]["class"] . "::" : "") . $bt[$i]["function"] . "()</u></span></td></tr>\n"; $first = true; } else { echo "<tr><td>Invoqued</td><td> " . $bt[$i]["file"] . ", line <b>" . $bt[$i]["line"] . "</b>, <u>" . ($bt[$i]["class"] ? $bt[$i]["class"] . "::" : "") . $bt[$i]["function"] . "()</u></td></tr>\n"; } } else { if (strpos($bt[$i]["function"], "error") != false) { echo "<tr><td colspan=\"2\" style=\"text-align:center;background:rgb(215,0,0);color:rgb(255,255,255);\"><b>Error Raised Here</b></td></tr>"; } } } echo "</table><br />"; echo "<hr>"; echo "<b>Webalianza ooCommon " . $__oocommon_version . " </b></div>"; die; }
$content = json_decode($content, true); curl_close($con); return $content; } function ret_arr($req) { $b = $req[rsp]; $c = $b[locations]; $arr = array(); $j = 0; $z = 0; for ($i = 0; $i < count($c) * 2; $i += 2) { $arr[$i] = $c[$z]["value"]; $j = $i + 1; $arr[$j] = $c[$z]["name"]; $z++; } return $arr; } $citi = request("http://emspost.ru/api/rest/?method=ems.get.locations&type=cities&plain=true"); $region = request("http://emspost.ru/api/rest/?method=ems.get.locations&type=regions"); $citi = ret_arr($citi); $region = ret_arr($region); $regions = array_merge($citi, $region); echo "var arr = ['" . $regions[1] . "'"; // ‘ормируем массив городов и регионов //дл¤ дальнейшей работы с ним в js for ($i = 3; $i < count($regions); $i += 2) { echo ", '" . $regions[$i] . "'"; } echo "]";
$arr[$c[$i]["value"]] = $c[$i]["name"]; } return $arr; } $cities = request("http://emspost.ru/api/rest/?method=ems.get.locations&type=cities&plain=true"); $maxWeight = request("http://emspost.ru/api/rest/?method=ems.get.max.weight"); $regions = request("http://emspost.ru/api/rest/?method=ems.get.locations&type=regions"); if ($cities[rsp][stat] == "fail" || $maxWeight[rsp][stat] == "fail" || $regions[rsp][stat] == "fail") { echo '<div class="er">Возникла ошибка, повторите пожалуйста Ваш запрос</div>'; } else { if ($cities == false || $maxWeight == false || $regions == false) { echo '<div class="er">Возникла ошибка, повторите пожалуйста Ваш запрос</div>'; } else { $maxWeight = $maxWeight[rsp][max_weight]; $cities = ret_arr($cities); $regions = ret_arr($regions); $all = array(); $all = $cities + $regions; if ($_POST['from'] != "" and $_POST['where'] != "" and $_POST['weight'] != "") { $from = trim($_POST['from']); $where = trim($_POST['where']); $weight = trim($_POST['weight']); $key1 = array_search($from, $all); $key2 = array_search($where, $all); if ($key1 == false) { echo "<div class='result'>Пожалуйста выберите отправителя из предложенного списка</div>"; } else { if ($key2 == false) { echo "<div class='result'>Пожалуйста выберите получателя из предложенного списка</div>"; } else { if (is_numeric($weight) == false) {
function ret_arr($arr) { $out .= "<table class=\"print_arr\">"; foreach ($arr as $k => $v) { $out .= "<tr>\n\t\t\t\t<td class=\"print_arr_field\">\n\t\t\t\t" . $k . "</td>\n\t\t\t\t<td class=\"print_arr_value\">\n\t\t\t\t"; if (is_array($v) || is_object($v)) { $out .= ret_arr($v); } else { $out .= "<b>" . $v . "</b>"; } $out .= "\n\t\t\t\t</td>\n\t\t\t\t</tr>"; } $out .= "</table>"; return $out; }