Ejemplo n.º 1
0
/**
 * Return an array with available groups for user
 */
function sumo_get_user_available_group($username = '', $html = FALSE)
{
    global $SUMO;
    if (!$username) {
        $username = $SUMO['user']['user'];
    }
    if (sumo_validate_data(array(array('username', $username, 1)))) {
        $query = "SELECT usergroup FROM " . SUMO_TABLE_USERS . "\n\t\t\t\t  WHERE username='******'";
        $rs = $SUMO['DB']->Execute($query);
        $tab = $rs->FetchRow();
        $group_level = explode(";", $tab[0]);
        if ($html) {
            return sumo_get_user_grouplevel($group_level);
        } else {
            for ($g = 0; $g < count($group_level); $g++) {
                $group_data = explode(":", $group_level[$g]);
                $group_name = $group_data[0];
                $group_value = $group_data[1];
                if ($group_name == 'sumo') {
                    $query = "SELECT usergroup FROM " . SUMO_TABLE_GROUPS . "\n\t\t\t\t\t\t\t  ORDER BY usergroup";
                    $rs = $SUMO['DB']->CacheExecute(3600, $query);
                    $group_level = array();
                    $group_level[] = 'sumo:' . $group_value;
                    while ($tab = $rs->FetchRow()) {
                        $group_level[] = $tab[0] . ":7";
                    }
                    break;
                }
            }
            return $group_level;
        }
    } else {
        return FALSE;
    }
}
Ejemplo n.º 2
0
 */
$tab = sumo_get_user_info($_GET['id'], 'id', FALSE);
if (sumo_verify_permissions(3, $tab['group']) || sumo_verify_permissions(FALSE, FALSE, $SUMO['user']['user'])) {
    $datasource = sumo_get_datasource_info($tab['datasource_id'], FALSE);
    $tpl['GET:User'] = $tab['username'];
    $tpl['GET:Email'] = $tab['email'];
    $tpl['GET:DayLimit'] = !$tab['day_limit'] ? $language['Unlimited'] : $tab['day_limit'];
    $tpl['GET:FirstName'] = htmlspecialchars($tab['firstname'], ENT_QUOTES);
    $tpl['GET:LastName'] = htmlspecialchars($tab['lastname'], ENT_QUOTES);
    $tpl['GET:IP'] = implode("; ", $tab['ip']);
    $tpl['GET:Language'] = ucwords(sumo_get_string_languages($tab['language']));
    $tpl['GET:LastLogin'] = sumo_get_human_date($tab['last_login']);
    $tpl['GET:AccountCreated'] = sumo_get_human_date($tab['created']);
    $tpl['GET:Modified'] = sumo_get_human_date($tab['modified']);
    $tpl['GET:UserAccessPages'] = sumo_get_user_accesspoints($tab['id'], TRUE);
    $tpl['GET:GroupLevel'] = sumo_get_user_grouplevel($tab['group_level']);
    $tpl['GET:Expire'] = $tab['day_limit'] != NULL ? sumo_get_human_date($tab['day_limit'] * 86400 + $SUMO['server']['time'], FALSE) : $language['Never'];
    $tpl['GET:DataSourceType'] = $datasource['name'] ? "<a href='javascript:sumo_ajax_get(\"network\",\"?module=network&action=view_datasource&id=" . $datasource['id'] . "\");'>" . $datasource['name'] . "</a>" : '';
    $tpl['GET:Email'] = "<a href='mailto:" . $tab['email'] . "' title='Send e-mail'>" . $tab['email'] . "</a>";
    $tpl['LINK:AddUser'] = sumo_get_action_icon("", "new", "users.content", "?module=users&action=new&decoration=false");
    $tpl['LINK:EditUser'] = sumo_get_action_icon("", "edit", "users.content", "?module=users&action=edit&id=" . $tab['id'] . "&decoration=false");
    $tpl['IMG:User'] = "******" . $tab['id'] . "' alt='" . $tab['username'] . "' class='user'>";
    $tpl['IMG:Language'] = "<img src='themes/" . $SUMO['page']['theme'] . "/images/flags/" . $tab['language'] . ".png' alt='" . ucwords($tab['language']) . "' class='flag'>";
    // Verify image support for refection effects
    if (function_exists('imagecreatefromjpeg') && function_exists('imagecreatefrompng') && function_exists('imagecreatefromgif')) {
        $tpl['IMG:User'] . "<br><img src='services.php?module=users&service=image&cmd=GET_USER_REFLECTION&id=" . $tab['id'] . "&fade=6&height=30%'>";
    }
    // Create sub module (to hide or show only if necessary)
    $tpl['LINK:AccountDetails'] = sumo_get_action_link('users.view', 'AccountDetails');
    $tpl['LINK:SecurityOptions'] = sumo_get_action_link('users.view', 'SecurityOptions');
    // Owner