示例#1
0
文件: Page.php 项目: bitsoflove/Page
 public static function create(array $data = [])
 {
     if (is_module_enabled('Site')) {
         $siteId = Site::id();
         $data['site_id'] = $siteId;
     }
     return parent::create($data);
 }
 public function newQuery()
 {
     $query = parent::newQuery();
     if (is_module_enabled('Site')) {
         $this->appendWhereClause($query);
     }
     return $query;
 }
 public function create($data)
 {
     if (is_module_enabled('Site')) {
         $siteId = Site::id();
         $data['site_id'] = $siteId;
     }
     $menu = $this->model->create($data);
     event(new MenuWasCreated($menu));
     return $menu;
 }
示例#4
0
 public function edit(Menu $menu)
 {
     $menuItems = $this->menuItem->allRootsForMenu($menu->id);
     $menuStructure = $this->menuRenderer->renderForMenu($menu->id, $menuItems->nest());
     $data = compact('menu', 'menuStructure');
     if (is_module_enabled('Site')) {
         $data['supportedLocales'] = \Site::current()->siteLocales->lists('title', 'locale')->toArray();
     }
     return view('menu::admin.menus.edit', $data);
 }
 public function handle($request, Closure $next)
 {
     //check if multi site tenancy is on, and if not, execute the original logic
     if (!is_module_enabled('Site')) {
         $original = \App::make('Mcamara\\LaravelLocalization\\Middleware\\LaravelLocalizationRedirectFilter');
         return $original->handle($request, $next);
     }
     $this->setAdminOrSiteLocale();
     return $next($request);
 }
示例#6
0
 public function newQuery()
 {
     $query = parent::newQuery();
     if (is_module_enabled('Site')) {
         $this->appendSiteWhereClause($query);
     }
     if (empty($this->auth->check())) {
         $this->appendPublicWhereClause($query);
     }
     return $query;
 }
 /**
  * Create a file row from the given file
  * @param  UploadedFile $file
  * @return mixed
  */
 public function createFromFile(UploadedFile $file)
 {
     $fileName = FileHelper::slug($file->getClientOriginalName());
     $exists = $this->model->whereFilename($fileName)->first();
     if ($exists) {
         $fileName = $this->getNewUniqueFilename($fileName);
     }
     $data = ['filename' => $fileName, 'path' => config('asgard.media.config.files-path') . "{$fileName}", 'extension' => substr(strrchr($fileName, "."), 1), 'mimetype' => $file->getClientMimeType(), 'filesize' => $file->getFileInfo()->getSize(), 'folder_id' => 0];
     if (is_module_enabled('Site')) {
         $siteId = Site::id();
         $data['site_id'] = $siteId;
         $data['path'] = config('asgard.media.config.files-path') . '/' . Site::current()->slug . "/{$fileName}";
     }
     return $this->model->create($data);
 }
 /**
  * Set the active theme based on the settings
  */
 private function setActiveTheme()
 {
     if ($this->app->runningInConsole() || !app('asgard.isInstalled')) {
         return;
     }
     if ($this->inAdministration()) {
         $themeName = $this->app['config']->get('asgard.core.core.admin-theme');
         return $this->app['stylist']->activate($themeName, true);
     }
     //if multi site, then grab themeName from db
     if (is_module_enabled('Site')) {
         $currentLocale = \Site::currentLocale();
         //if(!empty($currentLocale)) {
         $themeName = $currentLocale->theme;
         //} else {
         //    \Log::warning('Invalid locale defined! ThemeServiceProvider@setActiveTeam');
         //    $themeName = $this->app['setting.settings']->get('core::template', null, 'Flatly');
         //}
     } else {
         $themeName = $this->app['setting.settings']->get('core::template', null, 'Flatly');
     }
     return $this->app['stylist']->activate($themeName, true);
 }
示例#9
0
function is_mib_poller_enabled($device)
{
    $val = get_dev_attrib($device, 'poll_mib');
    if ($val == null) {
        return is_module_enabled('poller', 'mib');
    }
    return $val;
}
示例#10
0
	@endforeach

    <!-- Mainly scripts -->
    {!! Theme::script('js/bootstrap.min.js') !!}
    {!! Theme::script('js/plugins/metisMenu/jquery.metisMenu.js') !!}
    {!! Theme::script('js/plugins/slimscroll/jquery.slimscroll.min.js') !!}

    {!! Theme::script('vendor/alertify/build/alertify.min.js') !!}
    {!! Theme::script('js/mousetrap.min.js') !!}
    {!! Theme::script('js/jquery.slug.js') !!}

    <!-- Custom and plugin javascript -->
    {!! Theme::script('js/inspinia.js') !!}
	
	<?php 
if (is_module_enabled('Notification')) {
    ?>
	    <script src="https://js.pusher.com/3.0/pusher.min.js"></script>
	    <script src="{{ Module::asset('notification:js/pusherNotifications.js') }}"></script>
	    <script>
	        $(".notifications-list").pusherNotifications({
	            pusherKey: '{{ env('PUSHER_KEY') }}',
	            loggedInUserId: {{ $currentUser->id }}
	        });
	    </script>
	<?php 
}
?>

	@section('scripts')
	@show
示例#11
0
 /**
  * Create all thumbnails for the given image path
  * @param string $path
  */
 public function createAll($path)
 {
     if (!$this->isImage($path)) {
         return;
     }
     foreach ($this->manager->all() as $thumbnail) {
         $image = $this->image->make($this->filesystem->disk($this->getConfiguredFilesystem())->get($this->getDestinationPath($path->getRelativeUrl())));
         if (is_module_enabled('Site')) {
             $filename = config('asgard.media.config.files-path') . Site::current()->slug . '/' . $this->newFilename($path, $thumbnail->name());
         } else {
             $filename = config('asgard.media.config.files-path') . $this->newFilename($path, $thumbnail->name());
         }
         foreach ($thumbnail->filters() as $manipulation => $options) {
             $image = $this->imageFactory->make($manipulation)->handle($image, $options);
         }
         $image = $image->stream(pathinfo($path, PATHINFO_EXTENSION));
         $this->writeImage($filename, $image);
     }
 }
示例#12
0
if (isAuthorized('viewServers')) {
    $menu['servers_child'] = array('id' => 'servers_child', 'name' => _('Servers'), 'page' => 'servers.php', 'parent' => array('servers'));
    $menu['servers_unregistered'] = array('id' => 'servers_unregistered', 'name' => _('Unregistered Servers'), 'page' => 'servers.php?view=unregistered', 'parent' => array('servers'));
    $menu['servers_groups'] = array('id' => 'servers_groups', 'name' => _('Server Groups'), 'page' => 'serversgroup.php', 'parent' => array('servers'));
}
if (isAuthorized('viewSharedFolders')) {
    if (is_module_enabled('SharedFolderDB')) {
        $menu['sharedfolders'] = array('id' => 'sharedfolders', 'name' => _('Shared Folders'), 'page' => 'sharedfolders.php', 'parent' => array('servers'));
    }
}
if (isAuthorized('viewScripts')) {
    $menu['script'] = array('id' => 'script', 'name' => _('Login Scripts'), 'page' => 'script.php', 'parent' => array('servers'));
}
if (isAuthorized('viewSharedFolders')) {
    // it should be viewProfile
    if (is_module_enabled('ProfileDB')) {
        $menu['profile'] = array('id' => 'profiles', 'name' => _('Profiles'), 'page' => 'profiles.php', 'parent' => array('servers'));
    }
}
if (isAuthorized('viewUsers')) {
    $menu['user_child'] = array('id' => 'user_child', 'name' => _('Users'), 'page' => 'users.php', 'parent' => array('users'));
}
if (isAuthorized('viewUsersGroups')) {
    $menu['users_groups'] = array('id' => 'users_groups', 'name' => _('User Groups'), 'page' => 'usersgroup.php', 'parent' => array('users'));
}
if (isAuthorized('viewApplications')) {
    $menu['applications_child'] = array('id' => 'applications_child', 'name' => _('Applications'), 'page' => 'applications.php', 'parent' => array('applications'));
    $menu['applications_webapp'] = array('id' => 'applications_webapp', 'name' => _('Web Applications'), 'page' => 'applications_webapp.php', 'parent' => array('applications'));
}
if (isAuthorized('viewApplicationsGroups')) {
    $menu['applications_groups'] = array('id' => 'applications_groups', 'name' => _('Application Groups'), 'page' => 'appsgroup.php', 'parent' => array('applications'));
示例#13
0
function show_manage($id)
{
    global $schedules;
    $group = $_SESSION['service']->users_group_info($id);
    if (!is_object($group)) {
        die_error(_('Failed to load User Group'));
    }
    $usergroupdb_rw = usergroupdb_is_writable();
    $policy = $group->getAttribute('policy');
    $policy_rule_enable = 0;
    $policy_rules_disable = 0;
    foreach ($policy as $key => $value) {
        if ($value === true) {
            $policy_rule_enable++;
        } else {
            $policy_rules_disable++;
        }
    }
    $default_policy = $group->getAttribute('default_policy');
    if ($group->published) {
        $status = '<span class="msg_ok">' . _('Enabled') . '</span>';
        $status_change = _('Block');
        $status_change_value = 0;
    } else {
        $status = '<span class="msg_error">' . _('Blocked') . '</span>';
        $status_change = _('Enable');
        $status_change_value = 1;
    }
    if ($group->isDefault() == false) {
        $users = array();
        if ($group->hasAttribute('users')) {
            $users = $group->getAttribute('users');
        }
        $users_partial_list = $group->getAttribute('users_partial_list');
        $usersList = new UsersList($_REQUEST);
        if ($users_partial_list) {
            if ($usersList->is_empty_filter()) {
                $usersList->set_external_result($users, true);
            } else {
                $users2 = $usersList->search($id);
                if (is_null($users2)) {
                    die_error(_('Error while requesting users'), __FILE__, __LINE__);
                }
                $users = array();
                foreach ($users2 as $user) {
                    $users[$user->getAttribute('login')] = $user->getAttribute('displayname');
                }
            }
        }
        asort($users);
        $has_users = count($users) > 0;
        if ($usergroupdb_rw) {
            $users_all = $usersList->search();
            if (is_null($users_all)) {
                $users_all = array();
            }
            $users_available = array();
            foreach ($users_all as $user) {
                if (!array_key_exists($user->getAttribute('login'), $users)) {
                    $users_available[] = $user->getAttribute('login');
                }
            }
        } else {
            $users_available = array();
            $users_all = $users;
            uasort($users_all, "user_cmp");
        }
        $search_form = $usersList->getForm();
    } else {
        $users = array();
        $users_available = array();
        $users_all = array();
        $search_form = null;
    }
    // Default usergroup
    $is_default_group = $group->isDefault();
    // Publications
    $groups_apps = array();
    if ($group->hasAttribute('applicationsgroups')) {
        $groups_apps = $group->getAttribute('applicationsgroups');
    }
    $groups_apps_all = $_SESSION['service']->applications_groups_list();
    $groups_apps_available = array();
    foreach ($groups_apps_all as $group_apps) {
        if (!array_key_exists($group_apps->id, $groups_apps)) {
            $groups_apps_available[] = $group_apps;
        }
    }
    // Scripts
    $groups_scripts_all = $_SESSION['service']->scripts_groups_list($id);
    $all_scripts = $_SESSION['service']->scripts_list();
    $scripts_available = array();
    foreach ($all_scripts as $script) {
        if (!array_key_exists($script->id, $groups_scripts_all)) {
            $scripts_available[] = $script;
        }
    }
    // Servers publications
    $servers_groups_list = $_SESSION['service']->servers_groups_list();
    $servers_groups_published = array();
    if ($group->hasAttribute('serversgroups')) {
        $servers_groups_published = $group->getAttribute('serversgroups');
    }
    $can_manage_scripts = isAuthorized('manageScripts');
    $can_manage_usersgroups = isAuthorized('manageUsersGroups');
    $can_manage_publications = isAuthorized('managePublications');
    $can_manage_sharedfolders = isAuthorized('manageServers');
    $prefs_of_a_group = array();
    $unuse_settings = array();
    $session_prefs = array();
    if ($group->hasAttribute('settings_default')) {
        $prefs = new Preferences_admin(null, false);
        $categs = $group->getAttribute('settings_default');
        $categs2 = array();
        if ($group->hasAttribute('settings')) {
            $categs2 = $group->getAttribute('settings');
        }
        foreach ($categs as $categ => $settings) {
            $session_prefs[$categ] = array();
            $prefs_of_a_group[$categ] = array();
            $unuse_settings[$categ] = array();
            foreach ($settings as $setting_id => $setting_attributes) {
                $p = $prefs->load_element($setting_attributes, 'general_' . $categ);
                $session_prefs[$categ][$setting_id] = $p;
                if (array_key_exists($categ, $categs2) && array_key_exists($setting_id, $categs2[$categ])) {
                    $p2 = clone $p;
                    $p2->content = $categs2[$categ][$setting_id];
                    $prefs_of_a_group[$categ][$setting_id] = $p2;
                } else {
                    $unuse_settings[$categ][$setting_id] = $p;
                }
            }
        }
    }
    page_header();
    echo '<div id="users_div">';
    echo '<h1><a href="?">' . _('User Group Management') . '</a> - ' . $group->name . '</h1>';
    echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="5">';
    echo '<tr class="title">';
    echo '<th>' . _('Description') . '</th>';
    echo '<th>' . _('Status') . '</th>';
    echo '</tr>';
    echo '<tr class="content1">';
    echo '<td>' . $group->description . '</td>';
    echo '<td>' . $status . '</td>';
    echo '</tr>';
    echo '</table>';
    if ($can_manage_usersgroups) {
        echo '<div>';
        echo '<h2>' . _('Settings') . '</h1>';
        if ($group->type == 'static' and $can_manage_usersgroups and $usergroupdb_rw) {
            echo '<form action="actions.php" method="post">';
            if ($is_default_group) {
                echo '<input type="submit" value="' . _('Remove from default') . '"/>';
                echo '<input type="hidden" name="action" value="unset_default" />';
            } else {
                echo '<input type="submit" value="' . _('Define as default') . '"/>';
                echo '<input type="hidden" name="action" value="set_default" />';
            }
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="id" value="' . $group->id . '" />';
            echo '</form>';
            echo '<br/>';
        }
        if ($usergroupdb_rw || $group->type != 'static') {
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this group?') . '\');">';
            echo '<input type="submit" value="' . _('Delete this group') . '"/>';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="checked_groups[]" value="' . $id . '" />';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="hidden" name="published" value="' . $status_change_value . '" />';
            echo '<input type="submit" value="' . $status_change . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="name_group"  value="' . $group->name . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the name') . '"/>';
            echo '</form>';
            echo '<br/>';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo '<input type="text" name="description"  value="' . $group->description . '" size="50" /> ';
            echo '<input type="submit" value="' . _('Update the description') . '"/>';
            echo '</form>';
        }
        if ($group->type == 'dynamiccached') {
            echo '<br />';
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
            echo ' <select name="schedule">';
            foreach ($schedules as $interval => $text) {
                echo '<option value="' . $interval . '"';
                if ($group->schedule == $interval) {
                    echo ' selected="selected"';
                }
                echo '>' . $text . '</option>';
            }
            echo '</select>';
            echo '<input type="submit" value="' . _('Update the schedule') . '"/>';
            echo '</form>';
        }
        echo '</div>';
        echo '<br/>';
    }
    if (str_startswith($group->type, 'dynamic')) {
        echo '<div>';
        echo '<h2>' . _('Rules') . '</h1>';
        if ($can_manage_usersgroups) {
            echo '<form action="actions.php" method="post">';
            echo '<input type="hidden" name="name" value="UserGroup" />';
            echo '<input type="hidden" name="action" value="modify_rules" />';
            echo '<input type="hidden" name="id" value="' . $id . '" />';
        }
        echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3">';
        echo '<tr class="content1">';
        echo '<th>' . _('Validation type') . '</th>';
        echo '<td><input type="radio" name="validation_type" value="and"';
        if ($group->validation_type == 'and') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('All') . ' <input type="radio" name="validation_type" value="or"';
        if ($group->validation_type == 'or') {
            echo ' checked="checked"';
        }
        echo ' /> ' . _('At least one') . '</td>';
        echo '</tr>';
        echo '<tr class="content2">';
        echo '<th>' . _('Filters') . '</th>';
        echo '<td>';
        $i = 0;
        $filter_attributes = $userDB->getAttributesList();
        foreach ($filter_attributes as $key1 => $value1) {
            if ($value1 == 'password') {
                unset($filter_attributes[$key1]);
            }
        }
        $filter_types = UserGroup_Rule::$types;
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        $i = 0;
        foreach ($group->rules as $rule) {
            echo '<tr>';
            echo '<td><select name="rules[' . $i . '][attribute]">';
            foreach ($filter_attributes as $filter_attribute) {
                echo '<option value="' . $filter_attribute . '"';
                if ($rule->attribute == $filter_attribute) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_attribute . '</option>';
            }
            echo '</select></td>';
            echo '<td><select name="rules[' . $i . '][type]">';
            foreach ($filter_types as $filter_type) {
                echo '<option value="' . $filter_type . '"';
                if ($rule->type == $filter_type) {
                    echo ' selected="selected"';
                }
                echo '>' . $filter_type . '</option>';
            }
            echo '</select></td>';
            echo '<td><input type="text" name="rules[' . $i . '][value]" value="' . $rule->value . '" /></td>';
            if ($can_manage_usersgroups) {
                echo '<td>';
                echo '<input';
                if ($i == 0 && count($group->rules) == 1 || $i == count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="del_field(this.parentNode.parentNode); return false;" value="-" />';
                echo '<input';
                if ($i + 1 != count($group->rules)) {
                    echo ' style="display: none;"';
                }
                echo ' type="button" onclick="add_field(this.parentNode.parentNode); return false;" value="+" />';
                echo '</td>';
            }
            echo '</tr>';
            $i++;
        }
        echo '</table>';
        echo '</td>';
        echo '</tr>';
        echo '</table>';
        echo '<br />';
        if ($can_manage_usersgroups) {
            echo '<input type="submit" value="' . _('Update rules') . '" />';
            echo '</form>';
        }
        echo '</div>';
        echo '<br />';
    }
    // User list
    if ($group->isDefault() || (count($users_all) > 0 || !$usersList->is_empty_filter() || count($users) > 0)) {
        echo '<div>';
        echo '<h2>' . _('List of users in this group') . '</h2>';
        if (!is_null($search_form)) {
            echo $search_form;
        }
        if ($group->isDefault()) {
            echo _('All available users are in this group.');
        } else {
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            if (count($users) > 0) {
                foreach ($users as $user_login => $user_displayname) {
                    echo '<tr>';
                    echo '<td><a href="users.php?action=manage&id=' . $user_login . '">' . $user_login . '</td>';
                    echo '<td>';
                    if ($usergroupdb_rw && $group->type == 'static' && !$group->isDefault() and $can_manage_usersgroups) {
                        echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user?') . '\');">';
                        echo '<input type="hidden" name="action" value="del" />';
                        echo '<input type="hidden" name="name" value="User_UserGroup" />';
                        echo '<input type="hidden" name="group" value="' . $id . '" />';
                        echo '<input type="hidden" name="element" value="' . $user_login . '" />';
                        echo '<input type="submit" value="' . _('Delete from this group') . '" />';
                        echo '</form>';
                        echo '</td>';
                    }
                    echo '</tr>';
                }
            }
            if (count($users_available) > 0 && $usergroupdb_rw && $group->type == 'static' and $can_manage_usersgroups) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="name" value="User_UserGroup" />';
                echo '<input type="hidden" name="group" value="' . $id . '" />';
                echo '<select name="element">';
                foreach ($users_available as $user) {
                    echo '<option value="' . $user . '" >' . $user . '</option>';
                }
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add to this group') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            echo '</div>';
            echo '<br/>';
        }
    }
    // Publications part
    if (count($groups_apps_all) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of publications for this group') . '</h1>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($groups_apps) > 0) {
            foreach ($groups_apps as $groups_app_id => $groups_app_name) {
                echo '<tr>';
                echo '<td><a href="appsgroup.php?action=manage&id=' . $groups_app_id . '">' . $groups_app_name . '</td>';
                if ($can_manage_publications) {
                    echo '<td>';
                    echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this publication?') . '\');">';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="name" value="Publication" />';
                    echo '<input type="hidden" name="group_u" value="' . $id . '" />';
                    echo '<input type="hidden" name="group_a" value="' . $groups_app_id . '" />';
                    echo '<input type="submit" value="' . _('Delete this publication') . '" />';
                    echo '</form>';
                    echo '</td>';
                }
                echo '</tr>';
            }
        }
        if (count($groups_apps_available) > 0 and $can_manage_publications) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="Publication" />';
            echo '<input type="hidden" name="group_u" value="' . $id . '" />';
            echo '<select name="group_a">';
            foreach ($groups_apps_available as $group_apps) {
                echo '<option value="' . $group_apps->id . '" >' . $group_apps->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this publication') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Scripts part
    if (count($groups_scripts_all) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of scripts for this group') . '</h2>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($groups_scripts_all) > 0) {
            foreach ($groups_scripts_all as $script) {
                echo '<tr>';
                echo '<td><a href="script.php?action=manage&amp;id=' . $script["id"] . '">' . $script["name"] . '</a></td>';
                if ($can_manage_scripts) {
                    echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this user from this group?') . '\');">';
                    echo '<input type="hidden" name="name" value="Script_UserGroup" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="group" value="' . $id . '" />';
                    echo '<input type="hidden" name="element" value="' . $script["id"] . '" />';
                    echo '<input type="submit" value="' . _('Delete from this group') . '" />';
                    echo '</form></td>';
                }
                echo '</tr>';
            }
        }
        if (count($scripts_available) > 0 and $can_manage_scripts) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="Script_UserGroup" />';
            echo '<input type="hidden" name="group" value="' . $id . '" />';
            echo '<select name="element">';
            foreach ($scripts_available as $script) {
                echo '<option value="' . $script->id . '" >' . $script->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this script') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Servers publications part
    if (count($servers_groups_list) > 0) {
        echo '<div>';
        echo '<h2>' . _('List of published Server Groups for this group') . '</h1>';
        echo '<table border="0" cellspacing="1" cellpadding="3">';
        if (count($servers_groups_published) > 0) {
            foreach ($servers_groups_published as $servers_group_id => $servers_group_name) {
                echo '<tr>';
                echo '<td><a href="serversgroup.php?action=manage&id=' . $servers_group_id . '">' . $servers_group_name . '</td>';
                if ($can_manage_publications) {
                    echo '<td>';
                    echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this publication?') . '\');">';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="name" value="UsersGroupServersGroup" />';
                    echo '<input type="hidden" name="users_group" value="' . $id . '" />';
                    echo '<input type="hidden" name="servers_group" value="' . $servers_group_id . '" />';
                    echo '<input type="submit" value="' . _('Delete this publication') . '" />';
                    echo '</form>';
                    echo '</td>';
                }
                echo '</tr>';
            }
        }
        if (count($servers_groups_list) > count($servers_groups_published) and $can_manage_publications) {
            echo '<tr><form action="actions.php" method="post"><td>';
            echo '<input type="hidden" name="action" value="add" />';
            echo '<input type="hidden" name="name" value="UsersGroupServersGroup" />';
            echo '<input type="hidden" name="users_group" value="' . $id . '" />';
            echo '<select name="servers_group">';
            foreach ($servers_groups_list as $servers_group) {
                if (array_key_exists($servers_group->id, $servers_groups_published)) {
                    continue;
                }
                echo '<option value="' . $servers_group->id . '" >' . $servers_group->name . '</option>';
            }
            echo '</select>';
            echo '</td><td><input type="submit" value="' . _('Add this publication') . '" /></td>';
            echo '</form></tr>';
        }
        echo '</table>';
        echo '</div>';
    }
    // Policy of this group
    echo '<div>';
    echo '<h2>' . _('Policy of this group') . '</h2>';
    echo '<table border="0" cellspacing="1" cellpadding="3">';
    foreach ($policy as $key => $value) {
        if ($value === false) {
            continue;
        }
        $extends_from_default = $default_policy[$key] === $value;
        $buffer = $extends_from_default === true ? ' (' . _('extend from default') . ')' : '';
        echo '<tr>';
        echo '<td>' . $key . ' ' . $buffer . '</td>';
        if ($can_manage_usersgroups && !$extends_from_default) {
            echo '<td>';
            echo '<form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this rule?') . '\');">';
            echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
            echo '<input type="hidden" name="action" value="del" />';
            echo '<input type="hidden" name="id" value="' . $group->id . '" />';
            echo '<input type="hidden" name="element" value="' . $key . '" />';
            echo '<input type="submit" value="' . _('Delete this rule') . '" />';
            echo '</form>';
            echo '</td>';
        }
        echo '</tr>';
    }
    if ($can_manage_usersgroups && count($policy_rules_disable) > 0 && array_search(false, $policy) !== false) {
        echo '<tr><form action="actions.php" method="post"><td>';
        echo '<input type="hidden" name="name" value="UserGroup_PolicyRule" />';
        echo '<input type="hidden" name="action" value="add" />';
        echo '<input type="hidden" name="id" value="' . $group->id . '" />';
        echo '<select name="element">';
        foreach ($policy as $key => $value) {
            if ($value === true) {
                continue;
            }
            echo '<option value="' . $key . '" >' . $key . '</option>';
        }
        echo '</select>';
        echo '</td><td><input type="submit" value="' . _('Add this rule') . '" /></td>';
        echo '</form></tr>';
    }
    echo '</table>';
    echo '</div>';
    echo '<br/>';
    if (is_module_enabled('SharedFolderDB')) {
        $all_sharedfolders = $_SESSION['service']->shared_folders_list();
        if (is_null($all_sharedfolders)) {
            $all_sharedfolders = array();
        }
        if (count($all_sharedfolders) > 0) {
            $available_sharedfolders = array();
            $used_sharedfolders = array();
            if ($group->hasAttribute('shared_folders')) {
                $data = $group->getAttribute('shared_folders');
                $mods_by_share = array();
                foreach ($data as $mode => $used_sharedfolders2) {
                    foreach ($used_sharedfolders2 as $share_id => $share_name) {
                        $used_sharedfolders[$share_id] = $share_name;
                        $mods_by_share[$share_id] = $mode;
                    }
                }
            }
            foreach ($all_sharedfolders as $sharedfolder) {
                if (array_key_exists($sharedfolder->id, $used_sharedfolders)) {
                    continue;
                }
                $available_sharedfolders[] = $sharedfolder;
            }
            echo '<br />';
            echo '<div>';
            echo '<h2>' . _('Shared Folders') . '</h1>';
            echo '<table border="0" cellspacing="1" cellpadding="3">';
            foreach ($used_sharedfolders as $sharedfolder_id => $sharedfolder_name) {
                echo '<tr>';
                echo '<td><a href="sharedfolders.php?action=manage&amp;id=' . $sharedfolder_id . '">' . $sharedfolder_name . '</a></td>';
                echo '<td>' . $mods_by_share[$sharedfolder_id] . '</td>';
                if ($can_manage_sharedfolders) {
                    echo '<td><form action="actions.php" method="post" onsubmit="return confirm(\'' . _('Are you sure you want to delete this shared folder access?') . '\');">';
                    echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                    echo '<input type="hidden" name="action" value="del" />';
                    echo '<input type="hidden" name="sharedfolder_id" value="' . $sharedfolder_id . '" />';
                    echo '<input type="hidden" name="usergroup_id" value="' . $group->id . '" />';
                    echo '<input type="submit" value="' . _('Delete access to this shared folder') . '" />';
                    echo '</form></td>';
                }
                echo '</tr>';
            }
            if (count($available_sharedfolders) > 0 && $can_manage_sharedfolders) {
                echo '<tr><form action="actions.php" method="post"><td>';
                echo '<input type="hidden" name="name" value="SharedFolder_ACL" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<input type="hidden" name="usergroup_id" value="' . $group->id . '" />';
                echo '<select name="sharedfolder_id">';
                foreach ($available_sharedfolders as $sharedfolder) {
                    echo '<option value="' . $sharedfolder->id . '" >' . $sharedfolder->name . '</option>';
                }
                echo '</select>';
                echo '</td><td>';
                echo '<select name="mode">';
                echo '<option value="rw" >' . _('Read-write') . '</option>';
                echo '<option value="ro" >' . _('Read only') . '</option>';
                echo '</select>';
                echo '</td><td><input type="submit" value="' . _('Add access to this shared folder') . '" /></td>';
                echo '</form></tr>';
            }
            echo '</table>';
            echo '</div>';
        }
        echo '<br />';
    }
    echo '<div>';
    // Session Settings configuration
    echo '<h2>';
    echo _('Session Settings configuration');
    echo '</h2>';
    if ($prefs_of_a_group != array()) {
        foreach ($prefs_of_a_group as $container => $prefs_of_a_group_value) {
            echo '<fieldset class="prefssessionusergroup">';
            echo '<legend>' . $prefs->getPrettyName('general_' . $container) . '</legend>';
            echo '<form action="actions.php" method="post">';
            $key_name = 'general';
            echo '<input type="hidden" name="container" value="' . $container . '" />';
            // from admin/functions.inc.php
            $color = 0;
            if (count($prefs_of_a_group_value) != 0) {
                echo '<table class="main_sub" border="0" cellspacing="1" cellpadding="3" style="margin-bottom: 10px;">';
                // TODO
                echo '<tr  class="title">';
                echo '<th>' . _('Name') . '</th>';
                echo '<th>' . _('Default value') . '</th>';
                echo '<th>' . _('Value') . '</th>';
                echo '<th>' . _('Action') . '</th>';
                echo '<tr>';
                foreach ($prefs_of_a_group_value as $element_key => $config_element) {
                    echo '<tr class="content' . ($color % 2 + 1) . '">';
                    echo '<td style="width: 250px;">';
                    echo '<span onmouseover="showInfoBulle(\'' . str_replace("'", "&rsquo;", $config_element->description_detailed) . '\'); return false;" onmouseout="hideInfoBulle(); return false;">' . $config_element->label . '</span>';
                    echo '<td>';
                    $default_element = $session_prefs[$container][$config_element->id];
                    $default_element->setFormSeparator('NaN');
                    // it must be different of ___
                    $default_element->setPath(array('key_name' => $key_name, 'container' => $container, 'element_id' => $config_element->id));
                    echo $default_element->toHTML(true);
                    echo '</td>';
                    echo '</td>';
                    echo '<td style="padding: 3px;">';
                    print_element($key_name, $container, $element_key, $config_element);
                    echo '</td>';
                    echo '<td>';
                    echo '<input type="button" value="' . _('Remove this overridden setting') . '" onclick="usergroup_settings_remove(\'' . $group->id . '\',\'' . $container . '\',\'' . $config_element->id . '\'); return false;"/>';
                    echo '</td>';
                    echo '</tr>';
                    $color++;
                }
                // end from
                echo '<tr class="content' . ($color % 2 + 1) . '">';
                echo '<td colspan="3"></td>';
                echo '<td>';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->id . '" />';
                echo '<input type="hidden" name="action" value="modify" />';
                echo '<input type="submit" value="' . _('Save settings') . '" />';
                echo '</td>';
                echo '</tr>';
                echo '</table>';
                echo '</form>';
            }
            if ($unuse_settings[$container] != array()) {
                echo '<form action="actions.php" method="post">';
                echo '<input type="hidden" name="name" value="UserGroup_settings" />';
                echo '<input type="hidden" name="container" value="' . $container . '" />';
                echo '<input type="hidden" name="unique_id" value="' . $group->id . '" />';
                echo '<input type="hidden" name="action" value="add" />';
                echo '<select name="element_id">';
                foreach ($unuse_settings[$container] as $setting_name => $setting_content) {
                    echo '<option value="' . $setting_name . '" >' . $setting_content->label . '</option>';
                }
                echo '</select>';
                echo ' ';
                echo '<input type="submit" value="' . _('Add this setting') . '" />';
                echo '</form>';
            }
            echo '</fieldset>';
        }
    }
    echo '</div>';
    // Session Settings configuration
    echo "\n\n\n";
    echo '</div>';
    page_footer();
    die;
}
示例#14
0
 /**
  * @param $userId
  * @param $data
  * @param $roles
  * @internal param $user
  * @return mixed
  */
 public function updateAndSyncRoles($userId, $data, $roles)
 {
     $user = $this->user->find($userId);
     $this->checkForNewPassword($data);
     $this->checkForManualActivation($user, $data);
     $user = $user->fill($data);
     $user->save();
     if (is_module_enabled('Site')) {
         $user->syncSites($data);
     }
     event(new UserWasUpdated($user));
     if (!empty($roles)) {
         $user->roles()->sync($roles);
     }
 }
示例#15
0
function is_mib_poller_enabled($device)
{
    if (!is_module_enabled('poller', 'mib')) {
        return false;
    }
    if (!is_dev_attrib_enabled($device, 'poll_mib')) {
        d_echo('MIB module disabled for ' . $device['hostname'] . "\n");
        return false;
    }
    return true;
}
示例#16
0
function applicationdb_is_writable()
{
    return is_module_enabled('ApplicationDB') && array_key_exists('writable', $_SESSION['configuration']['ApplicationDB']) && $_SESSION['configuration']['ApplicationDB']['writable'] === true;
}
示例#17
0
<?php

/*
 * LibreNMS global MIB viewer
 *
 * Copyright (c) 2015 Gear Consulting Pty Ltd <*****@*****.**>
 *
 * Author: Paul Gear
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.  Please see LICENSE.txt at the top level of
 * the source code distribution for details.
 */
if (is_module_enabled('poller', 'mib')) {
    ?>

<h4><i class="fa fa-file-text-o"></i> All MIB definitions</h4>
<div class="table-responsive">
    <table id="mibs" class="table table-hover table-condensed mibs">
        <thead>
            <tr>
                <th data-column-id="module">Module</th>
                <th data-column-id="mib">MIB</th>
                <th data-column-id="object_type">Object Type</th>
                <th data-column-id="oid">Object Id</th>
                <th data-column-id="syntax">Syntax</th>
                <th data-column-id="description">Description</th>
                <!-- th data-column-id="max_access">Maximum Access</th>
                <th data-column-id="status">Status</th -->
示例#18
0
                        <ul class="dropdown-menu language-menu">
                            @foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
                                <li class="{{ App::getLocale() == $localeCode ? 'active' : '' }}">
                                    <a rel="alternate" lang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">
                                        {!! $properties['native'] !!}
                                    </a>
                                </li>
                            @endforeach
                        </ul>

                    </li>
                @endif


            <?php 
if (is_module_enabled('Site')) {
    ?>
                @include('site::partials.dropdown')
            <?php 
}
?>



            <!-- User Account: style can be found in dropdown.less -->
            <li class="dropdown user user-menu">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    <i class="glyphicon glyphicon-user"></i>
                    <span>
                        <?php 
if ($user->present()->fullname() != ' ') {