break; case 2: echo '<option value="2">Only requests that were allowed</option>'; echo '<option value="1">All Requests</option>'; echo '<option value="3">Only requests that were blocked</option>'; break; case 3: echo '<option value="3">Only requests that were blocked</option>'; echo '<option value="1">All Requests</option>'; echo '<option value="2">Only requests that were allowed</option>'; break; } echo '</select></label></form>' . "\n"; //Draw Time Dropdown list------------------------------------------ echo '<form action="?" method="get">'; echo '<input type="hidden" name="start" value="' . $StartPoint . '" />' . AddHiddenVar('C') . AddHiddenVar('Sort') . AddHiddenVar('Dir') . AddHiddenVar('V') . AddHiddenVar('DR'); echo '<Label>Time: <select name="e" onchange="submit()">'; switch ($StartStr) { //First item is unselectable case "today": case "": echo '<option value="today">Today</option>'; echo '<option value="-5minutes">5 Minutes</option>'; echo '<option value="-1hours">1 Hour</option>'; echo '<option value="-8hours">8 Hours</option>'; break; case "-5minutes": echo '<option value="-5minutes">5 Minutes</option>'; echo '<option value="today">Today</option>'; echo '<option value="-1hours">1 Hour</option>'; echo '<option value="-8hours">8 Hours</option>';
} } foreach ($TIMELIST as $key => $value) { //Output TimeList array as a select box if ($StartStr != $key) { //Ignore current setting echo '<option value="' . $key . '">' . $value . '</option>' . PHP_EOL; } } echo '</select></form></div>' . PHP_EOL; //Draw Calendar------------------------------------------------------ echo '<div class="col-half"><form action="?" method="get">' . PHP_EOL; AddHiddenVar('C'); AddHiddenVar('Sort'); AddHiddenVar('Dir'); AddHiddenVar('V'); echo '<span class="filter">Date: </span><input name="e" type="date" value="' . date('Y-m-d', $StartTime) . '" onchange="submit()"/><br />'; echo '<span class="filter">Range: </span><input name="dr" type="number" min="1" max="30" value="' . $DateRange . '" onchange="submit()"/><br /><br />' . PHP_EOL; echo '</form>' . PHP_EOL; echo '</div></div>' . PHP_EOL; //Draw Table Headers------------------------------------------------- echo '<div class="sys-group">' . PHP_EOL; echo '<table id="domain-table">'; //Table Start echo '<tr><th>#</th>'; if ($SortCol == 1) { if ($SortDir == 0) { WriteTH(1, 1, 'Domain▴'); } else { WriteTH(1, 0, 'Domain▾'); }
function DisplaySiteList() { global $List, $SearchStr, $StartPoint, $RowsPerPage; //1. Check if a Search has been made //2a. Loop through List doing a strpos check to see if search string exists in List[x][0] (site name) //2b. Copy items to a Temp Array //2c. Copy Temp array back to List //2d. Delete Temp array //3. Draw page if ($SearchStr != '') { //Is user searching? $TempArray = array(); foreach ($List as $Site) { //Go through array if (strpos($Site[0], $SearchStr) !== false) { $TempArray[] = $Site; //Copy matching string to temp array } } $List = $TempArray; //Copy temp array to List unset($TempArray); //Delete temp array } $ListSize = count($List); if ($List[$ListSize - 1][0] == '') { //Last line is sometimes blank array_splice($List, $ListSize - 1); //Cut last line out } if ($StartPoint >= $ListSize) { $StartPoint = 1; } //Start point can't be greater than the list size if ($RowsPerPage < $ListSize) { //Slice array if it's larger than RowsPerPage $List = array_slice($List, $StartPoint, $RowsPerPage); } echo '<div class="sys-group">'; echo '<h5>Sites Blocked</h5>' . PHP_EOL; echo '<div class="centered">' . PHP_EOL; echo '<form action="?" method="get">'; echo '<input type="hidden" name="v" value="sites">'; echo AddHiddenVar('C'); if ($SearchStr == '') { echo '<input type="text" name="s" id="search" placeholder="Search">'; } else { echo '<input type="text" name="s" id="search" value="' . $SearchStr . '">'; } echo '</form></div>' . PHP_EOL; if ($ListSize > $RowsPerPage) { //Is Pagination needed echo '<br /><div class="row">'; DisplayPagination($ListSize, 'sites'); echo '</div>' . PHP_EOL; } echo '</div>' . PHP_EOL; echo '<div class="sys-group">'; if ($ListSize == 0) { echo 'No sites found in Block List' . PHP_EOL; echo '</div>'; return; } echo '<table id="block-table">' . PHP_EOL; $i = $StartPoint; foreach ($List as $Site) { if ($Site[1] == 'Active') { echo '<tr><td>' . $i . '</td><td>' . $Site[0] . '</td><td>' . $Site[2] . '<td></td></tr>' . PHP_EOL; } else { echo '<tr class="dark"><td>' . $i . '</td><td><s>' . $Site[0] . '</s></td><td><s>' . $Site[2] . '</s><td></td></tr>' . PHP_EOL; } $i++; } echo '</table></div>' . PHP_EOL; if ($ListSize > $RowsPerPage) { //Is Pagination needed echo '<div class="sys-group">'; DisplayPagination($ListSize, 'sites'); echo '</div>' . PHP_EOL; } return null; }