Esempio n. 1
0
 /**
  * Displays the server list
  */
 function rows($result)
 {
     global $fmdb;
     $num_rows = $fmdb->num_rows;
     $results = $fmdb->last_result;
     if (currentUserCan('build_server_configs', $_SESSION['module'])) {
         $bulk_actions_list = array(__('Upgrade'), __('Build Config'));
         $title_array[] = array('title' => '<input type="checkbox" class="tickall" onClick="toggle(this, \'server_list[]\')" />', 'class' => 'header-tiny');
     } else {
         $bulk_actions_list = null;
     }
     if (!$result) {
         printf('<p id="table_edits" class="noresult" name="servers">%s</p>', __('There are no firewall servers.'));
     } else {
         echo @buildBulkActionMenu($bulk_actions_list, 'server_id_list');
         $table_info = array('class' => 'display_results', 'id' => 'table_edits', 'name' => 'servers');
         $title_array[] = array('class' => 'header-tiny');
         $title_array = array_merge($title_array, array(__('Hostname'), __('Method'), __('Firewall Type'), __('Version'), __('Config File')));
         $title_array[] = array('title' => __('Actions'), 'class' => 'header-actions');
         echo displayTableHeader($table_info, $title_array);
         for ($x = 0; $x < $num_rows; $x++) {
             $this->displayRow($results[$x]);
         }
         echo "</tbody>\n</table>\n";
     }
 }
Esempio n. 2
0
 /**
  * Displays the zone list
  */
 function rows($result, $map, $reload_allowed, $page, $total_pages)
 {
     global $fmdb, $__FM_CONFIG;
     $all_num_rows = $num_rows = $fmdb->num_rows;
     $results = $fmdb->last_result;
     if (currentUserCan('reload_zones', $_SESSION['module'])) {
         $bulk_actions_list = array(__('Reload'));
         $checkbox[] = array('title' => '<input type="checkbox" class="tickall" onClick="toggle(this, \'domain_list[]\')" />', 'class' => 'header-tiny header-nosort');
     } else {
         $checkbox = $bulk_actions_list = null;
     }
     if (!$result) {
         printf('<p id="table_edits" class="noresult" name="domains">%s</p>', __('There are no zones.'));
     } else {
         if (array_key_exists('attention', $_GET)) {
             $num_rows = $GLOBALS['zone_badge_counts'][$map];
             $total_pages = ceil($num_rows / $_SESSION['user']['record_count']);
             if ($page > $total_pages) {
                 $page = $total_pages;
             }
         }
         $start = $_SESSION['user']['record_count'] * ($page - 1);
         $end = $_SESSION['user']['record_count'] * $page > $num_rows ? $num_rows : $_SESSION['user']['record_count'] * $page;
         $classes = array_key_exists('attention', $_GET) ? null : ' grey';
         $eye_attention = $GLOBALS['zone_badge_counts'][$map] ? '<i class="fa fa-eye fa-lg eye-attention' . $classes . '" title="' . __('Only view zones that need attention') . '"></i>' : null;
         $addl_blocks = array(@buildBulkActionMenu($bulk_actions_list, 'server_id_list'), $this->buildFilterMenu(), $eye_attention);
         $fmdb->num_rows = $num_rows;
         echo displayPagination($page, $total_pages, $addl_blocks);
         $table_info = array('class' => 'display_results sortable', 'id' => 'table_edits', 'name' => 'domains');
         $title_array = array(array('title' => __('ID'), 'class' => 'header-small header-nosort'), array('title' => __('Domain'), 'rel' => 'domain_name'), array('title' => __('Type'), 'rel' => 'domain_type'), array('title' => __('Views'), 'class' => 'header-nosort'), array('title' => __('Records'), 'class' => 'header-small  header-nosort'));
         $title_array[] = array('title' => __('Actions'), 'class' => 'header-actions header-nosort');
         if (is_array($checkbox)) {
             $title_array = array_merge($checkbox, $title_array);
         }
         echo displayTableHeader($table_info, $title_array, 'zones');
         $y = 0;
         for ($x = $start; $x < $all_num_rows; $x++) {
             if ($y == $_SESSION['user']['record_count']) {
                 break;
             }
             if (array_key_exists('attention', $_GET)) {
                 if (!$results[$x]->domain_clone_domain_id && $results[$x]->domain_type == 'master' && $results[$x]->domain_template == 'no' && (!getSOACount($results[$x]->domain_id) || !getNSCount($results[$x]->domain_id) || $results[$x]->domain_reload != 'no')) {
                     $this->displayRow($results[$x], $map, $reload_allowed);
                     $y++;
                 }
             } else {
                 $this->displayRow($results[$x], $map, $reload_allowed);
                 $y++;
             }
         }
         echo "</tbody>\n</table>\n";
     }
 }
Esempio n. 3
0
 /**
  * Displays the server list
  */
 function rows($result, $type)
 {
     global $fmdb;
     $num_rows = $fmdb->num_rows;
     $results = $fmdb->last_result;
     $bulk_actions_list = null;
     //		if (currentUserCan('manage_servers', $_SESSION['module'])) $bulk_actions_list = array('Enable', 'Disable', 'Delete', 'Upgrade');
     if (currentUserCan('manage_servers', $_SESSION['module'])) {
         $bulk_actions_list[] = __('Upgrade');
     }
     if (currentUserCan('build_server_configs', $_SESSION['module'])) {
         $bulk_actions_list[] = __('Build Config');
     }
     if (is_array($bulk_actions_list)) {
         $title_array[] = array('title' => '<input type="checkbox" class="tickall" onClick="toggle(this, \'' . rtrim($type, 's') . '_list[]\')" />', 'class' => 'header-tiny header-nosort');
     }
     if (!$result) {
         $message = $type == 'servers' ? __('There are no servers.') : __('There are no groups.');
         printf('<p id="table_edits" class="noresult" name="servers">%s</p>', $message);
     } else {
         echo @buildBulkActionMenu($bulk_actions_list, 'server_id_list');
         $table_info = array('class' => 'display_results sortable', 'id' => 'table_edits', 'name' => 'servers');
         if ($type == 'servers') {
             $title_array[] = array('class' => 'header-tiny header-nosort');
             $title_array = array_merge($title_array, array(array('title' => __('Hostname'), 'rel' => 'server_name'), array('title' => __('Method'), 'rel' => 'server_update_method'), array('title' => __('Key'), 'class' => 'header-nosort'), array('title' => __('Server Type'), 'class' => 'header-nosort'), array('title' => __('Version'), 'class' => 'header-nosort'), array('title' => __('Run-as'), 'rel' => 'server_run_as_predefined'), array('title' => __('Config File'), 'rel' => 'server_config_file'), array('title' => __('Server Root'), 'rel' => 'server_root_dir'), array('title' => __('Zones Directory'), 'rel' => 'server_zones_dir')));
         } elseif ($type == 'groups') {
             $title_array = array_merge((array) $title_array, array(array('title' => __('Group Name'), 'rel' => 'group_name'), array('title' => __('Master Servers'), 'class' => 'header-nosort'), array('title' => __('Slave Servers'), 'class' => 'header-nosort')));
         }
         $title_array[] = array('title' => __('Actions'), 'class' => 'header-actions header-nosort');
         echo displayTableHeader($table_info, $title_array);
         for ($x = 0; $x < $num_rows; $x++) {
             $this->displayRow($results[$x], $type);
         }
         echo "</tbody>\n</table>\n";
     }
 }
Esempio n. 4
0
if (!empty($response) || !empty($fm_new_version_available)) {
    echo '<div id="response">' . $fm_new_version_available . '<p>' . $response . '</p></div>';
}
$table_info = array('class' => 'display_results modules', 'id' => 'table_edits', 'name' => 'modules');
if (currentUserCan('manage_modules')) {
    $bulk_actions_list = array(_('Activate'), _('Deactivate'));
}
if (count((array) $bulk_actions_list)) {
    $title_array[] = array('title' => '<input type="checkbox" class="tickall" onClick="toggle(this, \'module_list[]\')" />', 'class' => 'header-tiny header-nosort');
}
$title_array[] = _('Module');
$title_array[] = _('Description');
$header = displayTableHeader($table_info, $title_array);
$modules = getAvailableModules();
if (count($modules)) {
    $module_display = sprintf('<p>%s</p>', _('The following modules have been detected:')) . @buildBulkActionMenu($bulk_actions_list, 'module_list') . $header;
    foreach ($modules as $module_name) {
        /** Include module variables */
        @(include ABSPATH . 'fm-modules/' . $module_name . '/variables.inc.php');
        $activate_link = $upgrade_link = $status_options = null;
        $class = array();
        $uninstall_link = sprintf('<a href="?action=uninstall&module=%s"><span class="not_installed" onClick="return del(\'%s\');">%s</span></a>' . "\n", $module_name, _('Are you sure you want to delete this module?'), _('Uninstall'));
        /** Get module status */
        $module_version = getOption('version', 0, $module_name);
        if ($module_version !== false) {
            if (in_array($module_name, getActiveModules())) {
                $activate_link = sprintf('<a href="?action=deactivate&module=%s">%s</a>' . "\n", $module_name, _('Deactivate'));
                $class[] = 'active';
            }
            if (version_compare($module_version, $__FM_CONFIG[$module_name]['version'], '>=')) {
                if (!in_array($module_name, getActiveModules())) {