r4062 if no logs exist, display a generic message instead of an empty table
[racktables] / ajax.php
CommitLineData
11048491 1<?php
90a3d6d8
DY
2ob_start();
3try {
11048491 4
da111736 5require 'inc/init.php';
ef0503fc 6assertStringArg ('ac');
11048491 7
1dcdcc47 8switch ($_REQUEST['ac'])
11048491 9{
ef0503fc
DO
10case 'verifyCode':
11 $pageno = 'perms';
12 $tabno = 'edit';
13 fixContext();
14 if (!permitted())
15 {
16 echo "NAK\nPermission denied";
17 exit();
18 }
19 assertStringArg ('code');
20 $result = getRackCode (dos2unix ($_REQUEST['code']));
21 if ($result['result'] == 'ACK')
22 echo "ACK\n";
23 else
24 echo "NAK\n" . $result['load'];
11048491 25 break;
ef0503fc
DO
26default:
27 throw new InvalidRequestArgException ('ac', $_REQUEST['ac']);
11048491 28}
90a3d6d8
DY
29ob_end_flush();
30}
ef0503fc
DO
31catch (InvalidRequestArgException $e)
32{
33 ob_end_clean();
34 echo "NAK\nMalformed request";
35}
90a3d6d8
DY
36catch (Exception $e)
37{
38 ob_end_clean();
3a089a44 39 echo "NAK\nRuntime exception";
90a3d6d8 40}
11048491 41
11048491 42?>