Exemple #1
0
function new_channel_content(&$a)
{
    if (!get_account_id()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $name = x($_REQUEST, 'name') ? $_REQUEST['name'] : "";
    $nickname = x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : "";
    $privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
    $o = replace_macros(get_markup_template('new_channel.tpl'), array('$title' => t('Add a Channel'), '$desc' => t('A channel is your own collection of related web pages. A channel can be used to hold social network profiles, blogs, conversation groups and forums, celebrity pages, and much more. You may create as many channels as your service provider allows.'), '$label_name' => t('Channel Name'), '$help_name' => t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group" '), '$label_nick' => t('Choose a short nickname'), '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$label_import' => t('Or <a href="import">import an existing channel</a> from another location'), '$name' => $name, '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), '$role' => array('permissions_role', t('Channel Type'), $privacy_role ? $privacy_role : 'social', '<a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', get_roles()), '$nickname' => $nickname, '$submit' => t('Create')));
    return $o;
}
Exemple #2
0
function settings_content(&$a)
{
    $o = '';
    nav_set_selected('settings');
    if (!local_channel() || $_SESSION['delegate']) {
        notice(t('Permission denied.') . EOL);
        return login();
    }
    $channel = $a->get_channel();
    if ($channel) {
        head_set_icon($channel['xchan_photo_s']);
    }
    $yes_no = array(t('No'), t('Yes'));
    if (argc() > 1 && argv(1) === 'oauth') {
        if (argc() > 2 && argv(2) === 'add') {
            $tpl = get_markup_template("settings_oauth_edit.tpl");
            $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Submit'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), '', t('Name of application')), '$key' => array('key', t('Consumer Key'), random_string(16), t('Automatically generated - change if desired. Max length 20')), '$secret' => array('secret', t('Consumer Secret'), random_string(16), t('Automatically generated - change if desired. Max length 20')), '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')), '$icon' => array('icon', t('Icon url'), '', t('Optional'))));
            return $o;
        }
        if (argc() > 3 && argv(2) === 'edit') {
            $r = q("SELECT * FROM clients WHERE client_id='%s' AND uid=%d", dbesc(argv(3)), local_channel());
            if (!count($r)) {
                notice(t("You can't edit this application."));
                return;
            }
            $app = $r[0];
            $tpl = get_markup_template("settings_oauth_edit.tpl");
            $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$title' => t('Add application'), '$submit' => t('Update'), '$cancel' => t('Cancel'), '$name' => array('name', t('Name'), $app['name'], ''), '$key' => array('key', t('Consumer Key'), $app['client_id'], ''), '$secret' => array('secret', t('Consumer Secret'), $app['pw'], ''), '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], ''), '$icon' => array('icon', t('Icon url'), $app['icon'], '')));
            return $o;
        }
        if (argc() > 3 && argv(2) === 'delete') {
            check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth', 't');
            $r = q("DELETE FROM clients WHERE client_id='%s' AND uid=%d", dbesc(argv(3)), local_channel());
            goaway($a->get_baseurl(true) . "/settings/oauth/");
            return;
        }
        $r = q("SELECT clients.*, tokens.id as oauth_token, (clients.uid=%d) AS my \n\t\t\t\tFROM clients\n\t\t\t\tLEFT JOIN tokens ON clients.client_id=tokens.client_id\n\t\t\t\tWHERE clients.uid IN (%d,0)", local_channel(), local_channel());
        $tpl = get_markup_template("settings_oauth.tpl");
        $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_oauth"), '$baseurl' => $a->get_baseurl(true), '$title' => t('Connected Apps'), '$add' => t('Add application'), '$edit' => t('Edit'), '$delete' => t('Delete'), '$consumerkey' => t('Client key starts with'), '$noname' => t('No name'), '$remove' => t('Remove authorization'), '$apps' => $r));
        return $o;
    }
    if (argc() > 1 && argv(1) === 'featured') {
        $settings_addons = "";
        $o = '';
        $r = q("SELECT * FROM `hook` WHERE `hook` = 'feature_settings' ");
        if (!$r) {
            $settings_addons = t('No feature settings configured');
        }
        call_hooks('feature_settings', $settings_addons);
        $tpl = get_markup_template("settings_addons.tpl");
        $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_featured"), '$title' => t('Feature/Addon Settings'), '$settings_addons' => $settings_addons));
        return $o;
    }
    /*
     * ACCOUNT SETTINGS
     */
    if (argc() > 1 && argv(1) === 'account') {
        $account_settings = "";
        call_hooks('account_settings', $account_settings);
        $email = $a->account['account_email'];
        $tpl = get_markup_template("settings_account.tpl");
        $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_account"), '$title' => t('Account Settings'), '$password1' => array('npassword', t('Enter New Password:'******'', ''), '$password2' => array('confirm', t('Confirm New Password:'******'', t('Leave password fields blank unless changing')), '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), '$removeme' => t('Remove Account'), '$removeaccount' => t('Remove this account including all its channels'), '$account_settings' => $account_settings));
        return $o;
    }
    if (argc() > 1 && argv(1) === 'features') {
        $arr = array();
        $features = get_features();
        foreach ($features as $fname => $fdata) {
            $arr[$fname] = array();
            $arr[$fname][0] = $fdata[0];
            foreach (array_slice($fdata, 1) as $f) {
                $arr[$fname][1][] = array('feature_' . $f[0], $f[1], intval(feature_enabled(local_channel(), $f[0])) ? "1" : '', $f[2], array(t('Off'), t('On')));
            }
        }
        $tpl = get_markup_template("settings_features.tpl");
        $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_features"), '$title' => t('Additional Features'), '$features' => $arr, '$submit' => t('Submit')));
        return $o;
    }
    if (argc() > 1 && argv(1) === 'connectors') {
        $settings_connectors = "";
        call_hooks('connector_settings', $settings_connectors);
        $r = null;
        $tpl = get_markup_template("settings_connectors.tpl");
        $o .= replace_macros($tpl, array('$form_security_token' => get_form_security_token("settings_connectors"), '$title' => t('Connector Settings'), '$submit' => t('Submit'), '$settings_connectors' => $settings_connectors));
        call_hooks('display_settings', $o);
        return $o;
    }
    /*
     * DISPLAY SETTINGS
     */
    if (argc() > 1 && argv(1) === 'display') {
        $default_theme = get_config('system', 'theme');
        if (!$default_theme) {
            $default_theme = 'default';
        }
        $default_mobile_theme = get_config('system', 'mobile_theme');
        if (!$mobile_default_theme) {
            $mobile_default_theme = 'none';
        }
        $allowed_themes_str = get_config('system', 'allowed_themes');
        $allowed_themes_raw = explode(',', $allowed_themes_str);
        $allowed_themes = array();
        if (count($allowed_themes_raw)) {
            foreach ($allowed_themes_raw as $x) {
                if (strlen(trim($x)) && is_dir("view/theme/{$x}")) {
                    $allowed_themes[] = trim($x);
                }
            }
        }
        $themes = array();
        $files = glob('view/theme/*');
        if ($allowed_themes) {
            foreach ($allowed_themes as $th) {
                $f = $th;
                $is_experimental = file_exists('view/theme/' . $th . '/experimental');
                $unsupported = file_exists('view/theme/' . $th . '/unsupported');
                $is_mobile = file_exists('view/theme/' . $th . '/mobile');
                $is_library = file_exists('view/theme/' . $th . '/library');
                $mobile_themes["---"] = t("No special theme for mobile devices");
                if (!$is_experimental or $is_experimental && (get_config('experimentals', 'exp_themes') == 1 or get_config('experimentals', 'exp_themes') === false)) {
                    $theme_name = $is_experimental ? sprintf(t('%s - (Experimental)'), $f) : $f;
                    if (!$is_library) {
                        if ($is_mobile) {
                            $mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')';
                        } else {
                            $mobile_themes[$f] = $themes[$f] = $theme_name;
                        }
                    }
                }
            }
        }
        $theme_selected = !x($_SESSION, 'theme') ? $default_theme : $_SESSION['theme'];
        $mobile_theme_selected = !x($_SESSION, 'mobile_theme') ? $default_mobile_theme : $_SESSION['mobile_theme'];
        $user_scalable = get_pconfig(local_channel(), 'system', 'user_scalable');
        $user_scalable = $user_scalable === false ? '1' : $user_scalable;
        // default if not set: 1
        $browser_update = intval(get_pconfig(local_channel(), 'system', 'update_interval'));
        $browser_update = $browser_update == 0 ? 80 : $browser_update / 1000;
        // default if not set: 40 seconds
        $itemspage = intval(get_pconfig(local_channel(), 'system', 'itemspage'));
        $itemspage = $itemspage > 0 && $itemspage < 101 ? $itemspage : 20;
        // default if not set: 20 items
        $nosmile = get_pconfig(local_channel(), 'system', 'no_smilies');
        $nosmile = $nosmile === false ? '0' : $nosmile;
        // default if not set: 0
        $title_tosource = get_pconfig(local_channel(), 'system', 'title_tosource');
        $title_tosource = $title_tosource === false ? '0' : $title_tosource;
        // default if not set: 0
        $theme_config = "";
        if (($themeconfigfile = get_theme_config_file($theme_selected)) != null) {
            require_once $themeconfigfile;
            $theme_config = theme_content($a);
        }
        $tpl = get_markup_template("settings_display.tpl");
        $o = replace_macros($tpl, array('$ptitle' => t('Display Settings'), '$d_tset' => t('Theme Settings'), '$d_ctset' => t('Custom Theme Settings'), '$d_cset' => t('Content Settings'), '$form_security_token' => get_form_security_token("settings_display"), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$uid' => local_channel(), '$theme' => $themes ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false, '$mobile_theme' => $mobile_themes ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false, '$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1 - intval($nosmile), '', $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, '$expert' => feature_enabled(local_channel(), 'expert'), '$channel_list_mode' => array('channel_list_mode', t('Use blog/list mode on channel page'), get_pconfig(local_channel(), 'system', 'channel_list_mode'), t('(comments displayed separately)'), $yes_no), '$network_list_mode' => array('network_list_mode', t('Use blog/list mode on grid page'), get_pconfig(local_channel(), 'system', 'network_list_mode'), t('(comments displayed separately)'), $yes_no), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'channel_divmore_height') ? get_pconfig(local_channel(), 'system', 'channel_divmore_height') : 400, t('click to expand content exceeding this height')), '$network_divmore_height' => array('network_divmore_height', t('Grid page max height of content (in pixels)'), get_pconfig(local_channel(), 'system', 'network_divmore_height') ? get_pconfig(local_channel(), 'system', 'network_divmore_height') : 400, t('click to expand content exceeding this height'))));
        return $o;
    }
    if (argv(1) === 'channel') {
        require_once 'include/acl_selectors.php';
        require_once 'include/permissions.php';
        $p = q("SELECT * FROM `profile` WHERE `is_default` = 1 AND `uid` = %d LIMIT 1", intval(local_channel()));
        if (count($p)) {
            $profile = $p[0];
        }
        load_pconfig(local_channel(), 'expire');
        $channel = $a->get_channel();
        $global_perms = get_perms();
        $permiss = array();
        $perm_opts = array(array(t('Nobody except yourself'), 0), array(t('Only those you specifically allow'), PERMS_SPECIFIC), array(t('Approved connections'), PERMS_CONTACTS), array(t('Any connections'), PERMS_PENDING), array(t('Anybody on this website'), PERMS_SITE), array(t('Anybody in this network'), PERMS_NETWORK), array(t('Anybody authenticated'), PERMS_AUTHED), array(t('Anybody on the internet'), PERMS_PUBLIC));
        foreach ($global_perms as $k => $perm) {
            $options = array();
            foreach ($perm_opts as $opt) {
                if (!$perm[2] && $opt[1] == PERMS_PUBLIC) {
                    continue;
                }
                $options[$opt[1]] = $opt[0];
            }
            $permiss[] = array($k, $perm[3], $channel[$perm[0]], $perm[4], $options);
        }
        //		logger('permiss: ' . print_r($permiss,true));
        $username = $channel['channel_name'];
        $nickname = $channel['channel_address'];
        $timezone = $channel['channel_timezone'];
        $notify = $channel['channel_notifyflags'];
        $defloc = $channel['channel_location'];
        $maxreq = $channel['channel_max_friend_req'];
        $expire = $channel['channel_expire_days'];
        $adult_flag = intval($channel['channel_pageflags'] & PAGE_ADULT);
        $sys_expire = get_config('system', 'default_expire_days');
        //		$unkmail    = $a->user['unkmail'];
        //		$cntunkmail = $a->user['cntunkmail'];
        $hide_presence = intval(get_pconfig(local_channel(), 'system', 'hide_online_status'));
        $expire_items = get_pconfig(local_channel(), 'expire', 'items');
        $expire_items = $expire_items === false ? '1' : $expire_items;
        // default if not set: 1
        $expire_notes = get_pconfig(local_channel(), 'expire', 'notes');
        $expire_notes = $expire_notes === false ? '1' : $expire_notes;
        // default if not set: 1
        $expire_starred = get_pconfig(local_channel(), 'expire', 'starred');
        $expire_starred = $expire_starred === false ? '1' : $expire_starred;
        // default if not set: 1
        $expire_photos = get_pconfig(local_channel(), 'expire', 'photos');
        $expire_photos = $expire_photos === false ? '0' : $expire_photos;
        // default if not set: 0
        $expire_network_only = get_pconfig(local_channel(), 'expire', 'network_only');
        $expire_network_only = $expire_network_only === false ? '0' : $expire_network_only;
        // default if not set: 0
        $suggestme = get_pconfig(local_channel(), 'system', 'suggestme');
        $suggestme = $suggestme === false ? '0' : $suggestme;
        // default if not set: 0
        $post_newfriend = get_pconfig(local_channel(), 'system', 'post_newfriend');
        $post_newfriend = $post_newfriend === false ? '0' : $post_newfriend;
        // default if not set: 0
        $post_joingroup = get_pconfig(local_channel(), 'system', 'post_joingroup');
        $post_joingroup = $post_joingroup === false ? '0' : $post_joingroup;
        // default if not set: 0
        $post_profilechange = get_pconfig(local_channel(), 'system', 'post_profilechange');
        $post_profilechange = $post_profilechange === false ? '0' : $post_profilechange;
        // default if not set: 0
        $blocktags = get_pconfig(local_channel(), 'system', 'blocktags');
        $blocktags = $blocktags === false ? '0' : $blocktags;
        $timezone = date_default_timezone_get();
        $opt_tpl = get_markup_template("field_checkbox.tpl");
        if (get_config('system', 'publish_all')) {
            $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
        } else {
            $profile_in_dir = replace_macros($opt_tpl, array('$field' => array('profile_in_directory', t('Publish your default profile in the network directory'), $profile['publish'], '', $yes_no)));
        }
        $suggestme = replace_macros($opt_tpl, array('$field' => array('suggestme', t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', $yes_no)));
        $subdir = strlen($a->get_path()) ? '<br />' . t('or') . ' ' . $a->get_baseurl(true) . '/channel/' . $nickname : '';
        $tpl_addr = get_markup_template("settings_nick_set.tpl");
        $prof_addr = replace_macros($tpl_addr, array('$desc' => t('Your channel address is'), '$nickname' => $nickname, '$subdir' => $subdir, '$basepath' => $a->get_hostname()));
        $stpl = get_markup_template('settings.tpl');
        $acl = new AccessList($channel);
        $perm_defaults = $acl->get();
        require_once 'include/group.php';
        $group_select = mini_group_select(local_channel(), $channel['channel_default_group']);
        require_once 'include/menu.php';
        $m1 = menu_list(local_channel());
        $menu = false;
        if ($m1) {
            $menu = array();
            $current = get_pconfig(local_channel(), 'system', 'channel_menu');
            $menu[] = array('name' => '', 'selected' => !$current ? true : false);
            foreach ($m1 as $m) {
                $menu[] = array('name' => htmlspecialchars($m['menu_name'], ENT_COMPAT, 'UTF-8'), 'selected' => $m['menu_name'] === $current ? ' selected="selected" ' : false);
            }
        }
        $evdays = get_pconfig(local_channel(), 'system', 'evdays');
        if (!$evdays) {
            $evdays = 3;
        }
        $permissions_role = get_pconfig(local_channel(), 'system', 'permissions_role');
        if (!$permissions_role) {
            $permissions_role = 'custom';
        }
        $permissions_set = $permissions_role != 'custom' ? true : false;
        $vnotify = get_pconfig(local_channel(), 'system', 'vnotify');
        $always_show_in_notices = get_pconfig(local_channel(), 'system', 'always_show_in_notices');
        if ($vnotify === false) {
            $vnotify = -1;
        }
        $o .= replace_macros($stpl, array('$ptitle' => t('Channel Settings'), '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(true), '$uid' => local_channel(), '$form_security_token' => get_form_security_token("settings"), '$nickname_block' => $prof_addr, '$h_basic' => t('Basic Settings'), '$username' => array('username', t('Full Name:'), $username, ''), '$email' => array('email', t('Email Address:'), $email, ''), '$timezone' => array('timezone_select', t('Your Timezone:'), $timezone, '', get_timezones()), '$defloc' => array('defloc', t('Default Post Location:'), $defloc, t('Geographical location to display on your posts')), '$allowloc' => array('allow_location', t('Use Browser Location:'), get_pconfig(local_channel(), 'system', 'use_browser_location') ? 1 : '', '', $yes_no), '$adult' => array('adult', t('Adult Content'), $adult_flag, t('This channel frequently or regularly publishes adult content. (Please tag any adult material and/or nudity with #NSFW)'), $yes_no), '$h_prv' => t('Security and Privacy Settings'), '$permissions_set' => $permissions_set, '$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'), '$hide_presence' => array('hide_presence', t('Hide my online presence'), $hide_presence, t('Prevents displaying in your profile that you are online'), $yes_no), '$lbl_pmacro' => t('Simple Privacy Settings:'), '$pmacro3' => t('Very Public - <em>extremely permissive (should be used with caution)</em>'), '$pmacro2' => t('Typical - <em>default public, privacy when desired (similar to social network permissions but with improved privacy)</em>'), '$pmacro1' => t('Private - <em>default private, never open or public</em>'), '$pmacro0' => t('Blocked - <em>default blocked to/from everybody</em>'), '$permiss_arr' => $permiss, '$blocktags' => array('blocktags', t('Allow others to tag your posts'), 1 - $blocktags, t('Often used by the community to retro-actively flag inappropriate content'), $yes_no), '$lbl_p2macro' => t('Advanced Privacy Settings'), '$expire' => array('expire', t('Expire other channel content after this many days'), $expire, sprintf(t('0 or blank to use the website limit. The website expires after %d days.'), intval($sys_expire))), '$maxreq' => array('maxreq', t('Maximum Friend Requests/Day:'), intval($channel['channel_max_friend_req']), t('May reduce spam activity')), '$permissions' => t('Default Post Permissions'), '$permdesc' => t("(click to open/close)"), '$aclselect' => populate_acl($perm_defaults, false), '$suggestme' => $suggestme, '$group_select' => $group_select, '$role' => array('permissions_role', t('Channel permissions category:'), $permissions_role, '', get_roles()), '$profile_in_dir' => $profile_in_dir, '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, '$unkmail' => $unkmail, '$cntunkmail' => array('cntunkmail', t('Maximum private messages per day from unknown people:'), intval($channel['channel_max_anon_mail']), t("Useful to reduce spamming")), '$h_not' => t('Notification Settings'), '$activity_options' => t('By default post a status message when:'), '$post_newfriend' => array('post_newfriend', t('accepting a friend request'), $post_newfriend, '', $yes_no), '$post_joingroup' => array('post_joingroup', t('joining a forum/community'), $post_joingroup, '', $yes_no), '$post_profilechange' => array('post_profilechange', t('making an <em>interesting</em> profile change'), $post_profilechange, '', $yes_no), '$lbl_not' => t('Send a notification email when:'), '$notify1' => array('notify1', t('You receive a connection request'), $notify & NOTIFY_INTRO, NOTIFY_INTRO, '', $yes_no), '$notify2' => array('notify2', t('Your connections are confirmed'), $notify & NOTIFY_CONFIRM, NOTIFY_CONFIRM, '', $yes_no), '$notify3' => array('notify3', t('Someone writes on your profile wall'), $notify & NOTIFY_WALL, NOTIFY_WALL, '', $yes_no), '$notify4' => array('notify4', t('Someone writes a followup comment'), $notify & NOTIFY_COMMENT, NOTIFY_COMMENT, '', $yes_no), '$notify5' => array('notify5', t('You receive a private message'), $notify & NOTIFY_MAIL, NOTIFY_MAIL, '', $yes_no), '$notify6' => array('notify6', t('You receive a friend suggestion'), $notify & NOTIFY_SUGGEST, NOTIFY_SUGGEST, '', $yes_no), '$notify7' => array('notify7', t('You are tagged in a post'), $notify & NOTIFY_TAGSELF, NOTIFY_TAGSELF, '', $yes_no), '$notify8' => array('notify8', t('You are poked/prodded/etc. in a post'), $notify & NOTIFY_POKE, NOTIFY_POKE, '', $yes_no), '$lbl_vnot' => t('Show visual notifications including:'), '$vnotify1' => array('vnotify1', t('Unseen grid activity'), $vnotify & VNOTIFY_NETWORK, VNOTIFY_NETWORK, '', $yes_no), '$vnotify2' => array('vnotify2', t('Unseen channel activity'), $vnotify & VNOTIFY_CHANNEL, VNOTIFY_CHANNEL, '', $yes_no), '$vnotify3' => array('vnotify3', t('Unseen private messages'), $vnotify & VNOTIFY_MAIL, VNOTIFY_MAIL, t('Recommended'), $yes_no), '$vnotify4' => array('vnotify4', t('Upcoming events'), $vnotify & VNOTIFY_EVENT, VNOTIFY_EVENT, '', $yes_no), '$vnotify5' => array('vnotify5', t('Events today'), $vnotify & VNOTIFY_EVENTTODAY, VNOTIFY_EVENTTODAY, '', $yes_no), '$vnotify6' => array('vnotify6', t('Upcoming birthdays'), $vnotify & VNOTIFY_BIRTHDAY, VNOTIFY_BIRTHDAY, t('Not available in all themes'), $yes_no), '$vnotify7' => array('vnotify7', t('System (personal) notifications'), $vnotify & VNOTIFY_SYSTEM, VNOTIFY_SYSTEM, '', $yes_no), '$vnotify8' => array('vnotify8', t('System info messages'), $vnotify & VNOTIFY_INFO, VNOTIFY_INFO, t('Recommended'), $yes_no), '$vnotify9' => array('vnotify9', t('System critical alerts'), $vnotify & VNOTIFY_ALERT, VNOTIFY_ALERT, t('Recommended'), $yes_no), '$vnotify10' => array('vnotify10', t('New connections'), $vnotify & VNOTIFY_INTRO, VNOTIFY_INTRO, t('Recommended'), $yes_no), '$vnotify11' => array('vnotify11', t('System Registrations'), $vnotify & VNOTIFY_REGISTER, VNOTIFY_REGISTER, '', $yes_no), '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no), '$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')), '$h_advn' => t('Advanced Account/Page Type Settings'), '$h_descadvn' => t('Change the behaviour of this account for special situations'), '$pagetype' => $pagetype, '$expert' => feature_enabled(local_channel(), 'expert'), '$hint' => t('Please enable expert mode (in <a href="settings/features">Settings > Additional features</a>) to adjust!'), '$lbl_misc' => t('Miscellaneous Settings'), '$photo_path' => array('photo_path', t('Default photo upload folder'), get_pconfig(local_channel(), 'system', 'photo_path'), t('%Y - current year, %m -  current month')), '$attach_path' => array('attach_path', t('Default file upload folder'), get_pconfig(local_channel(), 'system', 'attach_path'), t('%Y - current year, %m -  current month')), '$menus' => $menu, '$menu_desc' => t('Personal menu to display in your channel pages'), '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), '$firefoxshare' => t('Firefox Share $Projectname provider'), '$cal_first_day' => array('first_day', t('Start calendar week on monday'), get_pconfig(local_channel(), 'system', 'cal_first_day') ? 1 : '', '', $yes_no)));
        call_hooks('settings_form', $o);
        $o .= '</form>' . "\r\n";
        return $o;
    }
}
$inherited_permissions = limited_or_full($inherited_permissions);
if (api_get_setting('permissions') == 'limited') {
    $header_array = $rights_limited;
}
if (api_get_setting('permissions') == 'full') {
    $header_array = $rights_full;
}
echo "<form method=\"post\" action=\"" . str_replace('&', '&amp;', $_SERVER['REQUEST_URI']) . "\">";
// ---------------------------------------------------
// 		DISPLAYING THE ROLES LIST
// ---------------------------------------------------
if (api_get_setting('group_roles') == 'true') {
    // the list of the roles for the user
    echo '<strong>' . get_lang('GroupRoles') . '</strong><br />';
    $current_group_course_roles = get_roles('group', $group_id);
    $current_group_platform_roles = get_roles('group', $group_id, 'platform');
    display_role_list($current_group_course_roles, $current_group_platform_roles);
    echo '<br />';
}
// ---------------------------------------------------
// 		DISPLAYING THE MATRIX (group permissions)
// ---------------------------------------------------
echo "<table class=\"data_table\">\n";
// the header
echo "\t<tr>\n";
echo "\t\t<th>" . get_lang('Module') . "</th>\n";
foreach ($header_array as $header_key => $header_value) {
    echo "\t\t<th>" . get_lang($header_value) . "</th>\n";
}
echo "\t</tr>\n";
// the main area with the checkboxes or images
include '../standard_header.inc.php';
# Dateiname und evtl. Pfad des Templates für die Webseite
$webseite = "role_show.dwt";
include "au_header.inc.php";
###############################################################################
#$mnr = $_GET['mnr'];
$mnr = 3;
$sbmnr = $_GET['sbmnr'];
# Menuleiste erstellen
createMainMenu($rollen, $mainnr);
createAUMenu($rollen, $mnr, $auDN, $sbmnr);
###############################################################################
# Admins anzeigen und loeschen
$role = $_GET['role'];
$roles_array = get_roles($auDN);
# print_r($roles_array);
# jeder Rolle entsprechend Members holen und Überschrift setzen
switch ($role) {
    case 'MainAdmin':
        $template->assign(array("ROLE" => "MainAdmin", "ROLE_DESC" => "Haupt Administratoren", "MENR" => $sbmnr));
        $members = $roles_array['MainAdmin'];
        break;
    case 'HostAdmin':
        $template->assign(array("ROLE" => "HostAdmin", "ROLE_DESC" => "Administratoren &nbsp;- &nbsp;Rechner", "MENR" => $sbmnr));
        $members = $roles_array['HostAdmin'];
        break;
    case 'DhcpAdmin':
        $template->assign(array("ROLE" => "DhcpAdmin", "ROLE_DESC" => "Administratoren &nbsp;- &nbsp;DHCP", "MENR" => $sbmnr));
        $members = $roles_array['DhcpAdmin'];
        break;
Exemple #5
0
 function get()
 {
     $registration_is = '';
     $other_sites = '';
     if (get_config('system', 'register_policy') == REGISTER_CLOSED) {
         if (get_config('system', 'directory_mode') == DIRECTORY_MODE_STANDALONE) {
             notice(t('Registration on this hub is disabled.') . EOL);
             return;
         }
         $mod = new Pubsites();
         return $mod->get();
     }
     if (get_config('system', 'register_policy') == REGISTER_APPROVE) {
         $registration_is = t('Registration on this hub is by approval only.');
         $other_sites = t('<a href="pubsites">Register at another affiliated hub.</a>');
     }
     $max_dailies = intval(get_config('system', 'max_daily_registrations'));
     if ($max_dailies) {
         $r = q("select count(account_id) as total from account where account_created > %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 day'));
         if ($r && $r[0]['total'] >= $max_dailies) {
             logger('max daily registrations exceeded.');
             notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
             return;
         }
     }
     // Configurable terms of service link
     $tosurl = get_config('system', 'tos_url');
     if (!$tosurl) {
         $tosurl = z_root() . '/help/TermsOfService';
     }
     $toslink = '<a href="' . $tosurl . '" target="_blank">' . t('Terms of Service') . '</a>';
     // Configurable whether to restrict age or not - default is based on international legal requirements
     // This can be relaxed if you are on a restricted server that does not share with public servers
     if (get_config('system', 'no_age_restriction')) {
         $label_tos = sprintf(t('I accept the %s for this website'), $toslink);
     } else {
         $label_tos = sprintf(t('I am over 13 years of age and accept the %s for this website'), $toslink);
     }
     $enable_tos = 1 - intval(get_config('system', 'no_termsofservice'));
     $email = array('email', t('Your email address'), x($_REQUEST, 'email') ? strip_tags(trim($_REQUEST['email'])) : "");
     $password = array('password', t('Choose a password'), x($_REQUEST, 'password') ? trim($_REQUEST['password']) : "");
     $password2 = array('password2', t('Please re-enter your password'), x($_REQUEST, 'password2') ? trim($_REQUEST['password2']) : "");
     $invite_code = array('invite_code', t('Please enter your invitation code'), x($_REQUEST, 'invite_code') ? strip_tags(trim($_REQUEST['invite_code'])) : "");
     $name = array('name', t('Name or caption'), x($_REQUEST, 'name') ? $_REQUEST['name'] : '', t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'));
     $nickhub = '@' . str_replace(array('http://', 'https://', '/'), '', get_config('system', 'baseurl'));
     $nickname = array('nickname', t('Choose a short nickname'), x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : '', sprintf(t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub));
     $privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
     $role = array('permissions_role', t('Channel role and privacy'), $privacy_role ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', get_roles());
     $tos = array('tos', $label_tos, '', '', array(t('no'), t('yes')));
     $auto_create = UNO || get_config('system', 'auto_channel_create') ? true : false;
     $default_role = UNO ? 'social' : get_config('system', 'default_permissions_role');
     require_once 'include/bbcode.php';
     $o = replace_macros(get_markup_template('register.tpl'), array('$title' => t('Registration'), '$reg_is' => $registration_is, '$registertext' => bbcode(get_config('system', 'register_text')), '$other_sites' => $other_sites, '$invitations' => get_config('system', 'invitation_only'), '$invite_desc' => t('Membership on this site is by invitation only.'), '$invite_code' => $invite_code, '$auto_create' => $auto_create, '$name' => $name, '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, '$enable_tos' => $enable_tos, '$tos' => $tos, '$email' => $email, '$pass1' => $password, '$pass2' => $password2, '$submit' => t('Register'), '$verify_note' => t('This site may require email verification after submitting this form. If you are returned to a login page, please check your email for instructions.')));
     return $o;
 }
    if($_REQUEST['option']=="URSRC_tree_view"){
        $menunameradiovalues = $_GET['radio_value'];
        $URSRC_basic_roleval=str_replace("_"," ",$menunameradiovalues);
        $URSRC_getmenu_folder_values=URSRC_getmenu_folder($URSRC_basic_roleval);
        echo JSON_ENCODE($URSRC_getmenu_folder_values);
    }
    //FUNCTION to get basic menus
    if($_REQUEST['option']=="URSRC_tree_view_basic"){
        $menunameradiovalues = $_GET['radio_value'];
        $URSRC_basic_roleval=str_replace("_"," ",$menunameradiovalues);
        $URSRC_getmenu_folder_values=URSRC_getmenubasic_folder1();
        echo JSON_ENCODE($URSRC_getmenu_folder_values);
    }
    //FUNCTION TO LOAD INITIAL VALUES ROLE LST bX
    if($_REQUEST['option']=="ACCESS_RIGHTS_SEARCH_UPDATE_BASICROLE"){
        $URSRC_role_array=get_roles();
        echo JSON_ENCODE($URSRC_role_array);
    }
}
//
////function URSRC_unshare_document($loggin,$fileId){
////
////    global $con,$ClientId,$ClientSecret,$RedirectUri,$DriveScopes,$CalenderScopes,$Refresh_Token;
////    $drive = new Google_Client();
////    $drive->setClientId($ClientId);
////    $drive->setClientSecret($ClientSecret);
////    $drive->setRedirectUri($RedirectUri);
////    $drive->setScopes(array($DriveScopes,$CalenderScopes));
////    $drive->setAccessType('online');
////    $authUrl = $drive->createAuthUrl();
////    $refresh_token= $Refresh_Token;
Exemple #7
0
        $emp_folderid = $folderData->id;
    }
    if ($formname == "login_fetch") {
        if ($emp_folderid == "") {
            echo "Error:Folder id Not present";
            exit;
        }
        $emp_uploadfiles = array($emp_uploadfileidlist, $emp_uploadfilenamelist, $emp_uploadfilelinklist);
        return $emp_uploadfiles;
    }
    return $emp_folderid;
}
if ($_REQUEST["option"] == "ACCESS_RIGHTS_SEARCH_UPDATE") {
    $str = '40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,1,2,69,70,71,72,95,113,114,132,133,136,137,138,146';
    $URSRC_errmsg = get_error_msg($str);
    $get_rolecreation_array = get_roles();
    $project_result = mysqli_query($con, "SELECT * FROM USER_RIGHTS_CONFIGURATION where URC_ID in (1,2,3) ");
    $get_project_array = array();
    while ($row = mysqli_fetch_array($project_result)) {
        $get_project_array[] = $row["URC_DATA"];
    }
    $emp_type = mysqli_query($con, "SELECT * FROM USER_RIGHTS_CONFIGURATION where CGN_ID =10 ");
    $get_emptype_array = array();
    while ($row = mysqli_fetch_array($emp_type)) {
        $get_emptype_array[] = $row["URC_DATA"];
    }
    $menuname_result = mysqli_query($con, "SELECT DISTINCT MP_MNAME FROM MENU_PROFILE MP,USER_RIGHTS_CONFIGURATION URC");
    $get_menuname_array = array();
    while ($row = mysqli_fetch_array($menuname_result)) {
        $get_menuname_array[] = $row["MP_MNAME"];
    }
Exemple #8
0
 public function add($edit_id = 0)
 {
     $form = $this->input->post();
     $form = $this->security->xss_clean($form);
     if (isset($form['edit_id'])) {
         $edit_id = $form['edit_id'];
     }
     $this->form_validation->set_rules($this->_validation_rules($edit_id));
     if ($this->form_validation->run()) {
         $this->ins_data['first_name'] = $form['first_name'];
         $this->ins_data['last_name'] = $form['last_name'];
         $this->ins_data['about'] = $form['about'];
         $this->ins_data['profile_name'] = $form['profile_name'];
         $this->ins_data['user_name'] = $form['user_name'];
         $this->ins_data['location'] = $form['location'];
         $this->ins_data['email'] = $form['email'];
         $this->ins_data['phone'] = $form['phone'];
         $this->ins_data['gender'] = $form['gender'];
         $this->ins_data['updated_time'] = date("Y-m-d H:i:s");
         $this->ins_data['dob'] = $form['dob'];
         $this->ins_data['updated_id'] = get_current_user_id();
         $this->ins_data['created_id'] = get_current_user_id();
         $this->ins_data['role'] = $form['role'];
         if (trim($form['password'])) {
             $this->ins_data['password'] = md5($form['password']);
         }
         if ($edit_id) {
             $this->user_model->update(array('id' => $edit_id), $this->ins_data);
             $this->service_message->set_flash_message("record_update_success");
             //log
             actionLogAdd('user', $edit_id, "User#{$edit_id} ({$form['user_name']}) record has been updated.");
         } else {
             $user_id = $this->user_model->insert($this->ins_data);
             $this->service_message->set_flash_message("record_insert_success");
             //log
             actionLogAdd('user', $user_id, "User#{$user_id} ({$form['user_name']}) record has been created.");
         }
         redirect("admin/user");
     }
     if ($edit_id) {
         $edit_data = $this->user_model->get_where(array('id' => $edit_id))->row_array();
         if (!$edit_data) {
             $this->service_message->set_flash_message("record_not_found_error");
             redirect("admin/user");
         }
         //unset password
         $edit_data['password'] = '';
         $this->data['form_data'] = $edit_data;
     } else {
         if ($form) {
             $this->data['form_data'] = $form;
             $this->data['form_data']['id'] = $edit_id ? $edit_id : 0;
         } else {
             $this->data['form_data'] = array("id" => '', 'first_name' => '', "last_name" => '', "email" => '', "phone" => '', "profile_name" => '', "role" => '', 'user_name' => '', 'password' => '', 'about' => '', 'location' => '', 'dob' => '', 'gender' => '');
         }
     }
     //Get roles
     $this->data['roles'] = get_roles();
     $this->layout->view("admin/user/add");
 }
function new_channel_content(&$a)
{
    $acc = App::get_account();
    if (!$acc || $acc['account_id'] != get_account_id()) {
        notice(t('Permission denied.') . EOL);
        return;
    }
    $default_role = '';
    $aid = get_account_id();
    if ($aid) {
        $r = q("select count(channel_id) as total from channel where channel_account_id = %d", intval($aid));
        if ($r && !intval($r[0]['total'])) {
            $default_role = get_config('system', 'default_permissions_role');
        }
        $limit = account_service_class_fetch(get_account_id(), 'total_identities');
        if ($r && $limit !== false) {
            $channel_usage_message = sprintf(t("You have created %1\$.0f of %2\$.0f allowed channels."), $r[0]['total'], $limit);
        } else {
            $channel_usage_message = '';
        }
    }
    $name = array('name', t('Name or caption'), x($_REQUEST, 'name') ? $_REQUEST['name'] : '', t('Examples: "Bob Jameson", "Lisa and her Horses", "Soccer", "Aviation Group"'));
    $nickhub = '@' . App::get_hostname();
    $nickname = array('nickname', t('Choose a short nickname'), x($_REQUEST, 'nickname') ? $_REQUEST['nickname'] : '', sprintf(t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub));
    $privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
    $role = array('permissions_role', t('Channel role and privacy'), $privacy_role ? $privacy_role : 'social', t('Select a channel role with your privacy requirements.') . ' <a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', get_roles());
    $o = replace_macros(get_markup_template('new_channel.tpl'), array('$title' => t('Create Channel'), '$desc' => t('A channel is your identity on this network. It can represent a person, a blog, or a forum to name a few. Channels can make connections with other channels to share information with highly detailed permissions.'), '$label_import' => t('or <a href="import">import an existing channel</a> from another location.'), '$name' => $name, '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create'), '$channel_usage_message' => $channel_usage_message));
    return $o;
}
function delete_role_member($userDN, $role, $auDN, $domDN)
{
    global $ds, $suffix, $ldapError;
    $actroles = get_roles($auDN);
    #print_r($actroles);echo "<br>";
    #print(count($actroles['MainAdmin']));echo "<br>";
    $entry['member'] = $userDN;
    if ($domDN != "") {
        $actdnsroles = get_roles_dns($domDN);
        switch ($role) {
            case 'MainAdmin':
                $roleDN1 = "cn=" . $role . ",cn=roles," . $auDN;
                #$roleDN2 = "cn=".$role.",cn=roles,".$domDN;
                if (count($actroles['MainAdmin']) == 1) {
                    # || count($actdnsroles['MainAdmin']) == 1 ){
                    echo "Rolle <b>MainAdmin</b> muss mindestens ein Mitglied haben!<br>\n\t\t\t\t\t\t<b>{$userDN}</b> wird nicht gel&ouml;scht.<br><br>";
                } else {
                    $results1 = ldap_mod_del($ds, $roleDN1, $entry);
                    #$results2 = ldap_mod_del($ds,$roleDN2,$entry);
                }
                if ($results1) {
                    #&& $results2){
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'HostAdmin':
                $roleDN1 = "cn=" . $role . ",cn=roles," . $auDN;
                #$roleDN2 = "cn=".$role.",cn=roles,".$domDN;
                if (count($actroles['HostAdmin']) == 1) {
                    $results1 = ldap_delete($ds, $roleDN1);
                } else {
                    $results1 = ldap_mod_del($ds, $roleDN1, $entry);
                }
                #$results2 = ldap_mod_del($ds,$roleDN2,$entry);
                if ($results1) {
                    #&& $results2){
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'DhcpAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['DhcpAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'RbsAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['RbsAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'ZoneAdmin':
                $roleDN1 = "cn=" . $role . ",cn=roles," . $auDN;
                #$roleDN2 = "cn=".$role.",cn=roles,".$domDN;
                if (count($actroles['ZoneAdmin']) == 1) {
                    $results1 = ldap_delete($ds, $roleDN1);
                } else {
                    $results1 = ldap_mod_del($ds, $roleDN1, $entry);
                }
                #$results2 = ldap_mod_del($ds,$roleDN2,$entry);
                if ($results1) {
                    #&& $results2){
                    return 1;
                } else {
                    return 0;
                }
                break;
        }
    } else {
        switch ($role) {
            case 'MainAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['MainAdmin']) == 1) {
                    echo "Rolle <b>MainAdmin</b> muss mindestens ein Mitglied haben!<br>\n\t\t\t\t\t\t<b>{$userDN}</b> wird nicht gel&oumlscht.<br><br>";
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'HostAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['HostAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'DhcpAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['DhcpAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'RbsAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['RbsAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
            case 'ZoneAdmin':
                $roleDN = "cn=" . $role . ",cn=roles," . $auDN;
                if (count($actroles['ZoneAdmin']) == 1) {
                    $results = ldap_delete($ds, $roleDN);
                } else {
                    $results = ldap_mod_del($ds, $roleDN, $entry);
                }
                if ($results) {
                    return 1;
                } else {
                    return 0;
                }
                break;
        }
    }
}
 /**
  * Get Role of a user
  *
  * @param $id
  * @return mixed
  */
 function get_role($id)
 {
     return get_roles()[\App\User::find($id)->roles()->first()->role_id];
 }
Exemple #12
0
// ----------------------------------------------------------------------------
// Initialize return value.
// ----------------------------------------------------------------------------
$return_value = json_decode('{"debug": null, "data": {"success": false, "groups": null} }');
// Change debug member of return value, then get string rep of return value.
// Usage: die(bake_with_debug($return_value, 'Info about error...'));
//TODO: move to a utilities file.
function bake_with_debug($mutable_return_value, $debug_string)
{
    $mutable_return_value->debug = $debug_string;
    return json_encode($mutable_return_value);
}
// ----------------------------------------------------------------------------
// Get Role response data.
// ----------------------------------------------------------------------------
$student_list = get_roles('survey_1');
// ----------------------------------------------------------------------------
// Prepare input by mapping question numbers to role numbers.
// ----------------------------------------------------------------------------
// Bijective map.
$map_ques_to_role = array(15 => 1, 16 => 2, 17 => 3, 18 => 4);
// Modify $student_list, applying the map to question numbers.
foreach ($student_list as &$role_response_list) {
    foreach ($role_response_list as &$ques_resp_pair) {
        $question_num = $ques_resp_pair[0];
        $ques_resp_pair[0] = $map_ques_to_role[$question_num];
    }
}
// ----------------------------------------------------------------------------
// Invoke suggestion algorithm.
// ----------------------------------------------------------------------------
$sbmnr = -1;
createMainMenu($rollen, $mainnr);
createAUMenu($rollen, $mnr, $auDN, $sbmnr);
###############################################################################
# MainpageData
# Parent AU, Email MainAdmin
$parentMA = 0;
$exp = explode(',', $auDN);
$parentau = array_slice($exp, 1, 1);
$parentau = substr($parentau[0], 3);
if ($parentau != "RIPM") {
    $length = count($exp);
    $out = array_slice($exp, 1, $length - 1);
    $parentauDN = implode(',', $out);
    if ($parentauDN == $rootAU) {
        $rol = get_roles($parentauDN);
        #print_r($rol); echo "<br>";
        if (in_array($userDN, $rol['MainAdmin'])) {
            #echo "PARENT AU MAINADMIN<br><br>";
            $parentMA = 1;
        }
        #$mainadminDN = $rol['MainAdmin'][0];
        #$emailMA = get_user_data($mainadminDN, array("mail"));
        #$emailCODE = "<a href'mailto:".$emailMA['mail']."' class='maillink' 	style='text-decoration:none'>".$emailMA['mail']."</a>";
    }
}
$template->assign(array("OU" => $au_ou, "CN" => $au_cn, "DSC" => $au_desc, "AUDN" => $auDN, "PARENTAU" => $parentau, "EMAILMA" => $emailCODE));
# MaxIPBlocks
$mipb = $au_mipb;
#print_r($mipb);echo "<br>";
$mipbs .= "";
Exemple #14
0
        include __DIR__ . "/view.php";
        break;
    case 'modify_admin':
        $choice = filter_input(INPUT_POST, 'choice');
        if ($choice == "Back") {
            header("Location: ..");
        }
        if ($choice == "Add Admin") {
            $usr_id = filter_input(INPUT_POST, 'user_drop');
            $usr_role_cde = filter_input(INPUT_POST, 'role_drop');
            add_admin($usr_id, $app_cde, $usr_role_cde);
        }
        $assigned_roles = get_assigned_roles();
        $users = get_users();
        $roles = get_roles();
        include __DIR__ . "/view.php";
        break;
    case 'delete_admin':
        $usr_id = filter_input(INPUT_GET, 'usrID');
        $usr_role_cde = filter_input(INPUT_GET, 'roleID');
        delete_admin($usr_id, $usr_role_cde);
        $assigned_roles = get_assigned_roles();
        $users = get_users();
        $roles = get_roles();
        include __DIR__ . "/view.php";
        break;
    default:
        display_error('Unknown account action: ' . $action);
        exit;
        break;
}
Exemple #15
0
function register_content(&$a)
{
    $registration_is = '';
    $other_sites = '';
    if (get_config('system', 'register_policy') == REGISTER_CLOSED) {
        if (get_config('system', 'directory_mode') == DIRECTORY_MODE_STANDALONE) {
            notice(t('Registration on this site is disabled.') . EOL);
            return;
        }
        require_once 'mod/pubsites.php';
        return pubsites_content($a);
    }
    if (get_config('system', 'register_policy') == REGISTER_APPROVE) {
        $registration_is = t('Registration on this site/hub is by approval only.');
        $other_sites = t('<a href="pubsites">Register at another affiliated site/hub</a>');
    }
    $max_dailies = intval(get_config('system', 'max_daily_registrations'));
    if ($max_dailies) {
        $r = q("select count(account_id) as total from account where account_created > %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 day'));
        if ($r && $r[0]['total'] >= $max_dailies) {
            logger('max daily registrations exceeded.');
            notice(t('This site has exceeded the number of allowed daily account registrations. Please try again tomorrow.') . EOL);
            return;
        }
    }
    // Configurable terms of service link
    $tosurl = get_config('system', 'tos_url');
    if (!$tosurl) {
        $tosurl = $a->get_baseurl() . '/help/TermsOfService';
    }
    $toslink = '<a href="' . $tosurl . '" >' . t('Terms of Service') . '</a>';
    // Configurable whether to restrict age or not - default is based on international legal requirements
    // This can be relaxed if you are on a restricted server that does not share with public servers
    if (get_config('system', 'no_age_restriction')) {
        $label_tos = sprintf(t('I accept the %s for this website'), $toslink);
    } else {
        $label_tos = sprintf(t('I am over 13 years of age and accept the %s for this website'), $toslink);
    }
    $enable_tos = 1 - intval(get_config('system', 'no_termsofservice'));
    $email = x($_REQUEST, 'email') ? strip_tags(trim($_REQUEST['email'])) : "";
    $password = x($_REQUEST, 'password') ? trim($_REQUEST['password']) : "";
    $password2 = x($_REQUEST, 'password2') ? trim($_REQUEST['password2']) : "";
    $invite_code = x($_REQUEST, 'invite_code') ? strip_tags(trim($_REQUEST['invite_code'])) : "";
    $name = x($_REQUEST, 'name') ? escape_tags(trim($_REQUEST['name'])) : "";
    $nickname = x($_REQUEST, 'nickname') ? strip_tags(trim($_REQUEST['nickname'])) : "";
    $privacy_role = x($_REQUEST, 'permissions_role') ? $_REQUEST['permissions_role'] : "";
    $auto_create = get_config('system', 'auto_channel_create');
    $default_role = get_config('system', 'default_permissions_role');
    require_once 'include/bbcode.php';
    $o = replace_macros(get_markup_template('register.tpl'), array('$title' => t('Registration'), '$reg_is' => $registration_is, '$registertext' => bbcode(get_config('system', 'register_text')), '$other_sites' => $other_sites, '$invitations' => get_config('system', 'invitation_only'), '$invite_desc' => t('Membership on this site is by invitation only.'), '$label_invite' => t('Please enter your invitation code'), '$invite_code' => $invite_code, '$auto_create' => $auto_create, '$label_name' => t('Channel Name'), '$help_name' => t('Enter your name'), '$label_nick' => t('Choose a short nickname'), '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$name' => $name, '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), '$role' => array('permissions_role', t('Channel Type'), $privacy_role ? $privacy_role : 'social', '<a href="help/roles" target="_blank">' . t('Read more about roles') . '</a>', get_roles()), '$default_role' => $default_role, '$nickname' => $nickname, '$submit' => t('Create'), '$label_email' => t('Your email address'), '$label_pass1' => t('Choose a password'), '$label_pass2' => t('Please re-enter your password'), '$label_tos' => $label_tos, '$enable_tos' => $enable_tos, '$email' => $email, '$pass1' => $password, '$pass2' => $password2, '$submit' => t('Register')));
    return $o;
}
if (api_get_setting('group_roles') == 'true') {
    // NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN
    foreach ($groups_of_user as $group) {
        $this_current_group_role_permissions_of_user = get_roles_permissions('user', $user_id);
        //$inherited_permissions[$tool][]=$permission;
    }
}
echo "<form method=\"post\" action=\"" . str_replace('&', '&amp;', $_SERVER['REQUEST_URI']) . "\">";
// ---------------------------------------------------
// 		DISPLAYING THE ROLES LIST
// ---------------------------------------------------
if (api_get_setting('user_roles') == 'true') {
    // the list of the roles for the user
    echo '<strong>' . get_lang('UserRoles') . '</strong><br />';
    $current_user_course_roles = get_roles('user', $user_id);
    $current_user_platform_roles = get_roles('user', $user_id, 'platform');
    display_role_list($current_user_course_roles, $current_user_platform_roles);
    echo '<br />';
}
// ---------------------------------------------------
// 			DISPLAYING THE MATRIX (user permissions)
// ---------------------------------------------------
echo "<table class=\"data_table\">\n";
// the header
echo "\t<tr>\n";
echo "\t\t<th rowspan=\"2\">" . get_lang('Module') . "</th>\n";
echo "\t\t<th colspan=\"4\">" . get_lang('ArticleManager') . "</th>\n";
echo "\t\t<th colspan=\"3\">" . get_lang('CommentManager') . "</th>\n";
echo "\t\t<th colspan=\"3\">" . get_lang('BlogManager') . "</th>\n";
echo "\t</tr>\n";
// Subheader
function get_roles_keys()
{
    $Roles = get_roles();
    $RoleKeys = array_keys($Roles);
    return $RoleKeys;
}