function checkUser($userId, $userKey, $pageVisited) { global $pagesRights; if (empty($userId) || empty($pageVisited) || empty($userKey)) { return false; } if (!is_array($pageVisited)) { $pageVisited = array($pageVisited); } include $_SESSION['settings']['cpassman_dir'] . '/includes/settings.php'; require_once $_SESSION['settings']['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; require_once $_SESSION['settings']['cpassman_dir'] . '/sources/SplClassLoader.php'; require_once 'main.functions.php'; // Connect to mysql server require_once $_SESSION['settings']['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; DB::$host = $server; DB::$user = $user; DB::$password = $pass; DB::$dbName = $database; DB::$port = $port; DB::$encoding = $encoding; DB::$error_handler = 'db_error_handler'; $link = mysqli_connect($server, $user, $pass, $database, $port); $link->set_charset($encoding); // load user's data $data = DB::queryfirstrow("SELECT login, key_tempo, admin, gestionnaire FROM " . prefix_table("users") . " WHERE id = %i", $userId); // check if user exists and tempo key is coherant if (empty($data['login']) || empty($data['key_tempo']) || $data['key_tempo'] != $userKey) { return false; } // check if user is allowed to see this page if (empty($data['admin']) && empty($data['gestionnaire']) && !IsInArray($pageVisited, $pagesRights['user'])) { return false; } else { if (empty($data['admin']) && !empty($data['gestionnaire']) && !IsInArray($pageVisited, $pagesRights['manager'])) { return false; } else { if (!empty($data['admin']) && !IsInArray($pageVisited, $pagesRights['admin'])) { return false; } } } return true; }
function unassigned_addy_pulldown() { global $table_prefix; $infrespbouncers = $table_prefix . 'InfResp_Bouncers'; $infresponders = $table_prefix . 'InfResp_responders'; # Make a hash of currently assigned bouncer addresses $assigned = array(); $query = "SELECT EmailAddy FROM " . $infrespbouncers; $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error()); while ($data = mysql_fetch_assoc($DB_result)) { $addy = strtolower(trim($data['EmailAddy'])); $assigned[$addy] = TRUE; } # Compare to the list of addresses in responders $unassigned = array(); $found_some = FALSE; $query = "SELECT OwnerEmail,ReplyToEmail FROM " . $infresponders; $DB_result = mysql_query($query) or die("Invalid query: " . mysql_error()); while ($data = mysql_fetch_assoc($DB_result)) { foreach ($data as $key => $value) { $addy = strtolower(trim($value)); if (!IsInArray($unassigned, $addy) && $assigned[$addy] != TRUE) { $found_some = TRUE; $unassigned[] = $addy; } } } # Make the pulldown if ($found_some == TRUE) { print "<select name=\"EmailAddy\" class=\"fields\">\n"; foreach ($unassigned as $key => $value) { print "<option value=\"{$value}\">{$value}</option>\n"; } print "<option value=\"other\">Other Address</option>\n"; print "</select>\n"; } else { print "<select name=\"EmailAddy\" class=\"fields\">\n"; print "<option value=\"\">No Unassigned</option>\n"; print "</select>\n"; } }
$matched = FALSE; foreach ($regexp as $regexp_id => $pattern) { if (preg_match("/" . $pattern . "/ims", $mail_body) == TRUE) { $matched = TRUE; } } if ($matched == TRUE) { # Got a match, grab the email address. if (preg_match("/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z0-9.-]+\$/i", $mail_body, $matches)) { $bounced_address = $matches[0]; $bounced_address = str_replace('(', "", $bounced_address); $bounced_address = str_replace(')', "", $bounced_address); $bounced_address = str_replace('<', "", $bounced_address); $bounced_address = str_replace('>', "", $bounced_address); # Add the email address into the array if it's not there. if (!IsInArray($bounced_addy_array, $bounced_address)) { # echo "bounced: $bounced_address <br>\n"; $bounced_addy_array[] = MakeSafe($bounced_address); } } # Delete just bounces? if ($bouncer['DeleteLevel'] == "1") { @imap_delete($conn, $i); } } # Delete all? if ($bouncer['DeleteLevel'] == "2") { @imap_delete($conn, $i); } } # Expunge and close.