public static function renderDescription($description, $debug) { $html = ''; foreach ($description as $desc) { $text = ''; if (isset($desc['u'])) { $text .= $desc['u'] . ' '; } if (!is_array($desc['t'])) { $text .= Util\Lang::lang($desc['t']); } else { foreach ($desc['t'] as $subDesc) { if (!is_array($subDesc)) { $text .= Util\Lang::locale($subDesc); } else { foreach ($subDesc as $key => $value) { if ($key == 'shot') { if (is_array($value)) { foreach ($value as $shotType) { $text .= strtolower(\Own\Bus\ShotType::value($shotType)) . ' '; } } else { $text .= strtolower(\Own\Bus\ShotType::value($value)); } } else { if ($key == 'speed') { $text .= ' at ' . $value . ' km/h'; } else { if ($key == 'value') { $text .= '<i>(' . $value[0] . 'p, ' . $value[1] . '%)</i>'; } else { if ($key == 'placement') { $text .= \Own\Bus\Placement::value($value); } else { if ($key == 'shotWinner') { $temp = ''; if (is_array($value)) { foreach ($value as $shotType) { $temp .= \Own\Bus\ShotType::value($shotType) . ' '; } } else { $temp .= \Own\Bus\ShotType::value($value); } $text .= Util\Lang::lang('shotWinner', [trim($temp)]); } else { if ($key == 'tossWinner') { $text .= Util\Lang::lang('tossWinner', [$value]); } } } } } } } } $text .= ' '; } } if (isset($desc['isResult'])) { $text = '<strong>' . $text . '</strong>'; } if ($debug && isset($desc['d'])) { $text .= '<br><span class="hit-debug">' . $desc['d'] . '</span>'; } $html .= $text . '<br>'; } return $html; }
public static function kill($code, $error, $file, $line) { $app = \Rebond\App::instance(); $redirect = (int) Session::get('redirect'); if ($redirect > 5) { $app->setStep(\Rebond\Config::STEP_REDIRECT); } else { Session::set('redirect', $redirect + 1); } $logId = Log::log($code, $error, $file, $line); $json = []; $json['result'] = ResultType::ERROR; if ($app->step() != \Rebond\Config::STEP_RUNNING) { if ($app->ajax()) { $json['message'] = Lang::locale('configurationError'); echo json_encode($json); exit; } else { $controller = new \Rebond\Controller\Admin\Error($app); echo $controller->config(); session_write_close(); exit; } } else { // update log level if user isDev $app->user(); if ($app->logLevel() == 0) { if ($app->ajax()) { $json['message'] = Lang::lang('serviceNotAvailable') . ': ' . $error . ' [<a href="http://' . \Rebond\Config::getPath('adminUrl') . '/tools/log" target="_blank">' . Lang::lang('logsView') . '</a>]'; echo json_encode($json, JSON_UNESCAPED_SLASHES); exit; } else { if (in_array($code, [self::PAGE_NOT_FOUND, self::ADMIN_PAGE_NOT_FOUND])) { header('Location: /error/generic?404=' . $error); } else { header('Location: /error/detail?id=' . $logId); } session_write_close(); exit; } } else { if ($app->ajax()) { $json['message'] = Lang::lang('errorUnknown'); echo json_encode($json); exit; } else { if (in_array($code, [self::PAGE_NOT_FOUND, self::ADMIN_PAGE_NOT_FOUND])) { header('Location: /error/generic?404=' . $error); } else { header('Location: /error/generic'); } session_write_close(); exit; } } } }