예제 #1
0
                 if (strlen($login_email)) {
                     $extra_hdrs = "From: {$login_email}\r\nX-Mailer: " . translate($application_name);
                 } else {
                     $extra_hdrs = "From: {$email_fallback_from}\r\nX-Mailer: " . translate($application_name);
                 }
                 mail($tempemail, translate($application_name) . " " . translate("Notification") . ": " . $name, utf8_decode(html_to_8bits($msg)), $extra_hdrs);
                 activity_log($id, $login, $old_participant, $LOG_NOTIFICATION, "User removed from participants list");
             }
         }
     }
 }
 // now add participants and send out notifications
 for ($i = 0; $i < count($participants); $i++) {
     $my_cat_id = "";
     // Is the person adding the nonuser calendar admin
     $is_nonuser_admin = user_is_nonuser_admin($login, $participants[$i]);
     // if public access, require approval unless
     // $public_access_add_needs_approval is set to "N"
     if ($login == "__public__") {
         if (!empty($public_access_add_needs_approval) && $public_access_add_needs_approval == "N") {
             $status = "A";
             // no approval needed
         } else {
             // Approval required
             $status = "W";
             // approval required
         }
         $my_cat_id = $cat_id;
     } else {
         if (!$newevent) {
             // keep the old status if no email will be sent
예제 #2
0
function load_user_preferences()
{
    global $login, $browser, $views, $prefarray, $is_assistant, $has_boss, $user, $is_nonuser_admin, $allow_color_customization;
    $lang_found = false;
    $colors = array("BGCOLOR" => 1, "H2COLOR" => 1, "THBG" => 1, "THFG" => 1, "CELLBG" => 1, "TODAYCELLBG" => 1, "WEEKENDBG" => 1, "POPUP_BG" => 1, "POPUP_FG" => 1);
    $browser = get_web_browser();
    $browser_lang = get_browser_language();
    $prefarray = array();
    // Note: default values are set in config.php
    $res = dbi_query("SELECT cal_setting, cal_value FROM webcal_user_pref " . "WHERE cal_login = '******'");
    if ($res) {
        while ($row = dbi_fetch_row($res)) {
            $setting = $row[0];
            $value = $row[1];
            if ($allow_color_customization == 'N') {
                if (isset($colors[$setting])) {
                    continue;
                }
            }
            $sys_setting = "sys_" . $setting;
            // save system defaults
            if (!empty($GLOBALS[$setting])) {
                $GLOBALS["sys_" . $setting] = $GLOBALS[$setting];
            }
            $GLOBALS[$setting] = $value;
            $prefarray[$setting] = $value;
            if ($setting == "LANGUAGE") {
                $lang_found = true;
            }
        }
        dbi_free_result($res);
    }
    // get views for this user
    $res = dbi_query("SELECT cal_view_id, cal_name, cal_view_type FROM webcal_view " . "WHERE cal_owner = '{$login}'");
    if ($res) {
        $views = array();
        while ($row = dbi_fetch_row($res)) {
            $v = array("cal_view_id" => $row[0], "cal_name" => $row[1], "cal_view_type" => $row[2]);
            $views[] = $v;
        }
        dbi_free_result($res);
    }
    // If user has not set a language preference, then use their browser
    // settings to figure it out, and save it in the database for future
    // use (email reminders).
    if (!$lang_found && strlen($login) && $login != "__public__") {
        $LANGUAGE = $browser_lang;
        dbi_query("INSERT INTO webcal_user_pref " . "( cal_login, cal_setting, cal_value ) VALUES " . "( '{$login}', 'LANGUAGE', '{$LANGUAGE}' )");
    }
    if (empty($GLOBALS["DATE_FORMAT_MY"])) {
        $GLOBALS["DATE_FORMAT_MY"] = "__month__ __yyyy__";
    }
    if (empty($GLOBALS["DATE_FORMAT_MD"])) {
        $GLOBALS["DATE_FORMAT_MD"] = "__month__ __dd__";
    }
    $is_assistant = user_is_assistant($login, $user);
    $has_boss = user_has_boss($login);
    $is_nonuser_admin = $user ? user_is_nonuser_admin($login, $user) : false;
    if ($is_nonuser_admin) {
        load_nonuser_preferences($user);
    }
}
예제 #3
0
        $noret .= '
      <tr>
        <td colspan="5" class="nounapproved">' . str_replace('XXX', $temp_fullname, translate('No unapproved entries for XXX.')) . '&nbsp;' . $rssLink . '</td>
      </tr>';
    }
    return $ret;
}
//end list_unapproved ()
print_header(array('js/popups.php/true'), generate_refresh_meta());
ob_start();
echo '
    <h2>' . translate('Unapproved Entries') . '</h2>';
$app_user_hash = $app_users = $my_non_users = array();
$non_users = get_nonuser_cals();
foreach ($non_users as $nonuser) {
    if (user_is_nonuser_admin($login, $nonuser['cal_login'])) {
        $my_non_users[]['cal_login'] = $nonuser['cal_login'];
    }
}
// If a user is specified, we list just that user.
if (($is_assistant || $is_nonuser_admin || $is_admin || access_is_enabled()) && !empty($user) && $user != $login) {
    if (!access_is_enabled() || access_user_calendar('approve', $user)) {
        $app_user_hash[$user] = 1;
        $app_users[] = $user;
    } else {
        // Not authorized to approve for specified user.
        echo translate('Not authorized');
    }
} else {
    // First, we list ourself.
    $app_user_hash[$login] = 1;
function load_user_preferences($guest = '')
{
    global $ALLOW_COLOR_CUSTOMIZATION, $browser, $DATE_FORMAT, $DATE_FORMAT_MD, $DATE_FORMAT_MY, $DATE_FORMAT_TASK, $has_boss, $is_assistant, $is_nonuser, $is_nonuser_admin, $lang_file, $LANGUAGE, $login, $prefarray, $user, $views;
    $browser = get_web_browser();
    $browser_lang = get_browser_language();
    $colors = array('BGCOLOR' => 1, 'CELLBG' => 1, 'H2COLOR' => 1, 'HASEVENTSBG' => 1, 'MYEVENTS' => 1, 'OTHERMONTHBG' => 1, 'POPUP_BG' => 1, 'POPUP_FG' => 1, 'TABLEBG' => 1, 'TEXTCOLOR' => 1, 'THBG' => 1, 'THFG' => 1, 'TODAYCELLBG' => 1, 'WEEKENDBG' => 1, 'WEEKNUMBER' => 1);
    $lang_found = false;
    $prefarray = array();
    // Allow __public__ pref to be used if logging in or user not validated.
    $tmp_login = empty($guest) ? $login : ($guest == 'guest' ? '__public__' : $guest);
    $rows = dbi_get_cached_rows('SELECT cal_setting, cal_value
    FROM webcal_user_pref WHERE cal_login = ?', array($tmp_login));
    if ($rows) {
        for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) {
            $row = $rows[$i];
            $setting = $row[0];
            $value = $row[1];
            if ($setting == 'LANGUAGE') {
                $lang_found = true;
            }
            if ($ALLOW_COLOR_CUSTOMIZATION == 'N' && isset($colors[$setting])) {
                continue;
            }
            // $sys_setting = 'sys_' . $setting;
            // Save system defaults.
            if (!empty($GLOBALS[$setting])) {
                $GLOBALS['sys_' . $setting] = $GLOBALS[$setting];
            }
            $GLOBALS[$setting] = $prefarray[$setting] = $value;
        }
    }
    // Set users timezone.
    if (isset($GLOBALS['TIMEZONE'])) {
        set_env('TZ', $GLOBALS['TIMEZONE']);
    }
    // Get views for this user and global views.
    // If NUC and not authorized by UAC, disallow global views.
    $rows = dbi_get_cached_rows('SELECT cal_view_id, cal_name, cal_view_type,
    cal_is_global, cal_owner FROM webcal_view WHERE cal_owner = ? ' . ($is_nonuser && (!access_is_enabled() || access_is_enabled() && !access_can_access_function(ACCESS_VIEW, $guest)) ? '' : ' OR cal_is_global = \'Y\' ') . 'ORDER BY cal_name', array($tmp_login));
    if ($rows) {
        $views = array();
        for ($i = 0, $cnt = count($rows); $i < $cnt; $i++) {
            $row = $rows[$i];
            $url = 'view_';
            if ($row[2] == 'E') {
                $url .= 'r.php?';
            } elseif ($row[2] == 'S') {
                $url .= 't.php?';
            } elseif ($row[2] == 'T') {
                $url .= 't.php?';
            } else {
                $url .= strtolower($row[2]) . '.php?';
            }
            $v = array('cal_view_id' => $row[0], 'cal_name' => $row[1], 'cal_view_type' => $row[2], 'cal_is_global' => $row[3], 'cal_owner' => $row[4], 'url' => $url . 'id=' . $row[0]);
            $views[] = $v;
        }
    }
    // If user has not set a language preference and admin has not specified a
    // language, then use their browser settings to figure it out
    // and save it in the database for future use (email reminders).
    $lang = 'none';
    if (!$lang_found && strlen($tmp_login) && $tmp_login != '__public__') {
        if ($LANGUAGE == 'none') {
            $lang = $browser_lang;
        }
        dbi_execute('INSERT INTO webcal_user_pref ( cal_login, cal_setting,
     cal_value ) VALUES ( ?, ?, ? )', array($tmp_login, 'LANGUAGE', $lang));
    }
    reset_language(!empty($LANGUAGE) && $LANGUAGE != 'none' ? $LANGUAGE : $browser_lang);
    if (empty($DATE_FORMAT) || $DATE_FORMAT == 'LANGUAGE_DEFINED') {
        $DATE_FORMAT = translate('__month__ __dd__, __yyyy__');
    }
    if (empty($DATE_FORMAT_MY) || $DATE_FORMAT_MY == 'LANGUAGE_DEFINED') {
        $DATE_FORMAT_MY = translate('__month__ __yyyy__');
    }
    if (empty($DATE_FORMAT_MD) || $DATE_FORMAT_MD == 'LANGUAGE_DEFINED') {
        $DATE_FORMAT_MD = translate('__month__ __dd__');
    }
    if (empty($DATE_FORMAT_TASK) || $DATE_FORMAT_TASK == 'LANGUAGE_DEFINED') {
        $DATE_FORMAT_TASK = translate('__mm__/__dd__/__yyyy__');
    }
    $has_boss = user_has_boss($tmp_login);
    $is_assistant = empty($user) ? false : user_is_assistant($tmp_login, $user);
    $is_nonuser_admin = $user ? user_is_nonuser_admin($tmp_login, $user) : false;
    // if ( $is_nonuser_admin ) load_nonuser_preferences ($user);
}
예제 #5
0
function get_users_to_approve()
{
    global $is_admin, $login, $NONUSER_ENABLED, $PUBLIC_ACCESS, $user;
    $app_user_hash = $app_users = $my_non_users = array();
    $non_users = get_nonuser_cals();
    foreach ($non_users as $nonuser) {
        if (user_is_nonuser_admin($login, $nonuser['cal_login'])) {
            $my_non_users[]['cal_login'] = $nonuser['cal_login'];
            // echo $nonuser['cal_login'] . "<br />";
        }
    }
    // First, we list ourself.
    $app_users[] = $login;
    $app_user_hash[$login] = 1;
    if (access_is_enabled()) {
        $all = !empty($NONUSER_ENABLED) && $NONUSER_ENABLED == 'Y' ? array_merge(get_my_users(), $my_non_users) : get_my_users();
        for ($j = 0, $cnt = count($all); $j < $cnt; $j++) {
            $x = $all[$j]['cal_login'];
            if (access_user_calendar('approve', $x)) {
                if (empty($app_user_hash[$x])) {
                    $app_users[] = $x;
                    $app_user_hash[$x] = 1;
                }
            }
        }
    } else {
        if ($is_admin && $PUBLIC_ACCESS == 'Y' && (empty($user) || $user != '__public__')) {
            $app_users[] = '__public__';
            $app_users_hash['__public__'] = 1;
        }
        $all = $my_non_users;
        for ($j = 0, $cnt = count($all); $j < $cnt; $j++) {
            $x = $all[$j]['cal_login'];
            if (empty($app_user_hash[$x])) {
                $app_users[] = $x;
                $app_user_hash[$x] = 1;
            }
        }
    }
    return $app_users;
}