Exemplo n.º 1
0
function getUser()
{
    global $user;
    $uid = isset($_SESSION['uid']) ? $_SESSION['uid'] : null;
    if ($uid) {
        $user_info = c2r_get_user_info($uid);
        $user->id = $user_info[0];
        $user->name = $user_info[1];
        $user->email = $user_info[2];
        $user->company_id = $user_info[3];
        $user->default_location_id = $user_info[4];
        $user->group_id = $user_info[5];
        $user->ui = c2r_get_user_info_object($uid);
        $user->gravatar_big = get_gravatar($user->email, 80);
        $user->gravatar_small = get_gravatar($user->email, 32);
    } else {
        $user = null;
    }
}
Exemplo n.º 2
0
    }
    if (isset($_GET['number_delete']) && ($del_unid = $_GET['number_delete'])) {
        addInfoMessage(t('Phone number deleted'));
        c2r_user_number_delete($del_unid);
    }
    if (isset($_POST['default']) && ($dnid = $_POST['default'])) {
        c2r_user_number_default($user->id, $dnid);
    }
    if (isset($_POST['dlid']) && ($dlid = $_POST['dlid']) && isset($_POST['language']) && ($lng = $_POST['language'])) {
        c2r_user_update_default_location($user->id, $dlid);
        c2r_user_update_language($user->id, $lng);
        $user->ui->language = $lng;
        addInfoMessage(t('Profile Data updated'));
    }
}
$ui = c2r_get_user_info_object($uid);
$uns = c2r_user_number_get($uid);
$companies = c2r_companies_get();
// if not super admin, only show locations for company
$cid_for_loc = 0;
if ($user->group_id < 3) {
    $cid_for_loc = $user->company_id;
}
$locations = c2r_locations_get(0, $cid_for_loc);
$bool_to_activate = false;
foreach ($uns as $key => $un) {
    if ($un->is_active) {
        continue;
    }
    $bool_to_activate = true;
}