//Turn off all error reporting, useless for users error_reporting(0); $t = new Template(translate('Message Processing')); $t->printHTMLHeader(); $t->printWelcome(); $t->startMain(); // Break table into 2 columns, put quick links on left side and all other tables on the right startQuickLinksCol(); showQuickLinks(); // Print out My Quick Links startDataDisplayCol(); $action = CmnFns::getGlobalVar('action', POST); $query_string = CmnFns::get_query_string(); if (isset($action)) { switch ($action) { case translate('Send report and go back'): $process_action = CmnFns::getGlobalVar('process_action', POST); $error_array = unserialize(urldecode(CmnFns::getGlobalVar('serialized_error_array', POST))); sendMailToAdmin($process_action, $error_array); CmnFns::redirect_js('messagesIndex.php?' . $query_string); break; case translate('Go back'): CmnFns::redirect_js('messagesIndex.php?' . $query_string); break; default: CmnFns::do_error_box(translate('Unknown action type'), '', false); } } endDataDisplayCol(); $t->endMain(); $t->printHTMLFooter();
function hideSameFlights() { // now is a good time to disable duplicate flights we have found from other servers // AND are from the same user (using pilot's mapping table to find that out) // addition: 2008/07/21 we search for all flight no only from same user/server global $db, $flightsTable; $query = "SELECT serverID,ID,externalFlightType, FROM {$flightsTable}\n\t\t\t\t\tWHERE hash='" . $this->hash . "' AND userID=" . $this->userID . " AND userServerID=" . $this->userServerID . " ORDER BY serverID ASC, ID ASC"; $query = "SELECT serverID,ID,externalFlightType,userID,userServerID FROM {$flightsTable}\n\t\t\tWHERE hash='" . $this->hash . "' ORDER BY serverID ASC, ID ASC"; // echo $query; $res = $db->sql_query($query); if ($res <= 0) { DEBUG("FLIGHT", 1, "flightData: Error in query: {$query}<br>"); return array(); // no duplicate found } // we must disable all flights BUT one // rules: // 1. locally submitted flights have priority // 2. between external flights , the full synced have priority over simple links // 3. between equal cases the first submitted has priority. $i = 0; while ($row = $db->sql_fetchrow($res)) { $fList[$i] = $row; $i++; } if ($i == 0) { return array(); // no duplicate found } usort($fList, "sameFlightsCmp"); $i = 0; $msg = ''; foreach ($fList as $i => $fEntry) { if (0) { echo "<pre>"; echo "-------------------------<BR>"; print_r($fEntry); echo "-------------------------<BR>"; echo "</pre>"; } if ($i == 0) { // enable $msg .= " Enabling "; $query = "UPDATE {$flightsTable} SET private = private & (~0x02 & 0xff ) WHERE ID=" . $fEntry['ID']; } else { // disable $msg .= " Disabling "; $query = "UPDATE {$flightsTable} SET private = private | 0x02 WHERE ID=" . $fEntry['ID']; } $msg .= " <a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'show_flight', 'flightID' => $fEntry['ID'])) . "'>Flight " . $fEntry['ID'] . "</a> from <a href='http://" . $_SERVER['SERVER_NAME'] . getLeonardoLink(array('op' => 'pilot_profile', 'pilotIDview' => $fEntry['userServerID'] . '_' . $fEntry['userID'])) . "'>PILOT " . $fEntry['userServerID'] . '_' . $fEntry['userID'] . "</a><BR>\n"; $res = $db->sql_query($query); # Error checking if ($res <= 0) { echo "<H3> Error in query: {$query}</H3>\n"; } $i++; } // now also make a test to see if all flights are from same user (alien mapped to local) // if not , send a mail to admin to warn him and suggest a new mapping $pList = array(); foreach ($fList as $i => $fEntry) { $pList[$fEntry['userServerID'] . '_' . $fEntry['userID']]++; } if (count($pList) > 1) { // more than one pilot involved in this sendMailToAdmin("Duplicate flights", $msg); //echo "Duplicate flights".$msg; } /* foreach ($disableFlightsList as $dFlightID=>$num) { $query="UPDATE $flightsTable SET private = private | 0x02 WHERE ID=$dFlightID "; $res= $db->sql_query($query); # Error checking if($res <= 0){ echo("<H3> Error in query: $query</H3>\n"); } } foreach ($enableFlightsList as $dFlightID=>$num) { $query="UPDATE $flightsTable SET private = private & (~0x02 & 0xff ) WHERE ID=$dFlightID "; $res= $db->sql_query($query); # Error checking if($res <= 0){ echo("<H3> Error in query: $query</H3>\n"); } }*/ }
/** * Release messages function * @param array $emailaddresses recipient email address(es) * @param array $mail_id_array containing mail_id of messages to be released * @result return array of messages whose release failed */ function releaseMessages($emailaddresses, $mail_id_array) { /*** Array pertaining to the release of messages ***/ // This is an array of array, the key being the $mail_id // and the value being an array containing all the messages info (time, subject, ...) and also the release status. // The reason for this is that we want to keep the ordering of the messages selected for release. $release_messages = array(); // This is an array of array, the key being the host // and the value being an array containing all the release info such as secret_id (one row per message) $hosts = array(); /*** Variables pertaining to the request of release ***/ // This array contains the messages that the logged in user wants the Admins to release $release_req_messages = array(); // Counter for the number of release requests $j = 0; $nb_failure = 0; $db = new DBEngine(); // Set autocommit to false to improve speed of 'RS' flag set up $result = $db->db->autoCommit(false); $db->check_for_error($result, 'PEAR DB autoCommit(false)'); // Fill the arrays foreach ($mail_id_array as $mail_id_recip) { // Get mail_id and recipient email address $temp = preg_split('/_/', $mail_id_recip, 2); $mail_id = $temp[0]; $recip_email = $temp[1]; // Check if logged in user is admin or logged in user is trying to release his own messages if (Auth::isMailAdmin() || in_array($recip_email, $emailaddresses)) { $result = $db->get_message($recip_email, $mail_id); } else { continue; } $rs = $result[0]; // if content type is 'B' or 'V' and the logged in user is not admin // add message to array of release request if (in_array($rs['content'], array('B', 'V')) && !Auth::isMailAdmin()) { $release_req_messages[$j] = array("mail_id" => $mail_id, "from_addr" => $rs['from_addr'], "subject" => $rs['subject'], "time_num" => $rs['time_num'], "spam_level" => $rs['spam_level'], "content" => $rs['content']); // Try to update the RS flag to 'p' for pending if (!$db->update_msgrcpt_rs($mail_id, $recip_email, 'p')) { $release_req_messages[$j]["status"] = "Error: " . $db->get_err(); } else { $release_req_messages[$j]["status"] = "Pending"; } $j++; // Other cases where: // - content type is 'B' or 'V' but the logged in user is admin, therefore allowed to release message // - content type is 'S' or 'H' } else { // add message to be released to $hosts array $release_messages[$mail_id_recip] = array("mail_id" => $mail_id, "time" => $rs['time_num'], "subject" => $rs['subject'], "from_addr" => $rs['from_addr'], "spam_level" => $rs['spam_level'], "content" => $rs['content']); $hosts[$rs['host']][$mail_id_recip] = array("secret_id" => $rs['secret_id'], "quar_type" => $rs['quar_type'], "quar_loc" => $rs['quar_loc'], "recip_email" => $rs['email']); } } global $conf; // If release request needs to be sent to Admins if (is_array($release_req_messages) && !empty($release_req_messages) && $conf['app']['notifyAdmin']) { sendMailToAdmin(translate('Request release'), $release_req_messages); } // If release needs to be done if (is_array($hosts) && !empty($hosts)) { // For each host create socket, connect and release all messages pertaining to that host foreach ($hosts as $host => $message_info) { // Create new TCP/IP socket and try to connect to $host using this socket $am = new AmavisdEngine($host); if (!$am->connected) { foreach ($message_info as $mail_id_recip => $release_info) { $release_messages[$mail_id_recip]['error_code'] = 1; $release_messages[$mail_id_recip]['status'] = $am->last_error; $nb_failure++; } } else { foreach ($message_info as $mail_id_recip => $release_info) { $socket_binding_result = $am->release_message($release_messages[$mail_id_recip]['mail_id'], $release_info['secret_id'], $release_info['recip_email'], $release_info['quar_type'], $release_info['quar_loc']); if (preg_match('/^setreply=250/', $socket_binding_result)) { if ($db->update_msgrcpt_rs($release_messages[$mail_id_recip]['mail_id'], $release_info['recip_email'], 'R')) { $release_messages[$mail_id_recip]['error_code'] = "0"; CmnFns::write_log('Message Released [' . $release_messages[$mail_id_recip]['content'] . ']: ' . $release_messages[$mail_id_recip]['mail_id'], $_SESSION['sessionID']); } else { $release_messages[$mail_id_recip]['error_code'] = 2; $release_messages[$mail_id_recip]['status'] = "Error: " . $db->get_err(); $nb_failure++; } } else { $release_messages[$mail_id_recip]['error_code'] = 3; $release_messages[$mail_id_recip]['status'] = $am->last_error; $nb_failure++; } } // Shuting down and closing socket $am->disconnect(); } } } // Commit, then set autocommit back to true $result = $db->db->commit(); $db->check_for_error($result, 'PEAR DB commit()'); $result = $db->db->autoCommit(true); $db->check_for_error($result, 'PEAR DB autoCommit(true)'); // Build array of messages whose release failed $failed_array = array(); $i = 0; if ($nb_failure > 0) { foreach ($mail_id_array as $mail_id_recip) { if ($release_messages[$mail_id_recip]['error_code'] != 0) { $failed_array[$i] = array("mail_id" => $release_messages[$mail_id_recip]['mail_id'], "from_addr" => $release_messages[$mail_id_recip]['from_addr'], "subject" => $release_messages[$mail_id_recip]['subject'], "time_num" => $release_messages[$mail_id_recip]['time'], "spam_level" => $release_messages[$mail_id_recip]['spam_level'], "content" => $release_messages[$mail_id_recip]['content'], "status" => $release_messages[$mail_id_recip]['status']); CmnFns::write_log($release_messages[$mail_id_recip]['status'], $_SESSION['sessionID']); $i++; } } } // Return array of messages whose release failed return $failed_array; }
} ob_start(); list($result, $extra) = $server->sync($chunkSize, 0); $outStr = ob_get_contents(); ob_end_clean(); if ($result == 0) { $logStr .= "<b>" . date("d/m/Y H:i:s") . "</b> No entries<BR>\n"; } else { $logStr .= "<hr><strong>" . date("d/m/Y H:i:s") . "</strong>"; if ($result == 1) { $logStr .= " <span class='ok'>OK</span> "; } else { if ($result < 0) { $logStr .= " <span class='error'>ERROR</span> "; $msg = "<pre>" . date("d/m/Y H:i:s") . "<br>\r\nServer: " . $serverName . " [" . $server->ID . "]<br>\r\nError code: {$result}<br>\r\nError: {$extra} <br></pre>\r\n "; sendMailToAdmin("Problem in syncing", $msg); // mail($CONF_admin_email,"Problem in sync of master ".$_SERVER['SERVER_NAME'],$msg); } } $logStr .= $outStr; } if (!($handle = fopen($logFilename, 'a'))) { echo "Cannot open file ({$logFilename})"; exit; } if (fwrite($handle, $logStr) === FALSE) { echo "Cannot write to file ({$logFilename})"; exit; } fclose($handle); } else {
$LOGINCONF->set("falselogincounttemp", $falselogincounttemp); // Zähler für die aktuelle Sperrzeit $falselogincount = $LOGINCONF->get("falselogincount") + 1; $LOGINCONF->set("falselogincount", $falselogincount); // Gesamtzähler // maximale Anzahl falscher Logins erreicht? if ($falselogincounttemp >= $FALSELOGINLIMIT) { // Sperrzeit starten $LOGINCONF->set("loginlockstarttime", time()); // Mail an Admin if (strlen($ADMIN_CONF->get("adminmail")) > 5 and ($falselogincounttemp == $FALSELOGINLIMIT or $falselogincounttemp % 100 == 0)) { $mailcontent = getLanguageValue("loginlocked_mailcontent") . "\r\n\r\n" . strftime(getLanguageValue("_dateformat"), time()) . "\r\n" . $_SERVER['REMOTE_ADDR'] . " / " . gethostbyaddr($_SERVER['REMOTE_ADDR']) . "\r\n" . getLanguageValue("username") . ": " . getRequestValue('username', 'post', false); require_once BASE_DIR_CMS . "Mail.php"; // Prüfen, ob die Mail-Funktion vorhanden ist if (function_exists("isMailAvailable")) { sendMailToAdmin(getLanguageValue("loginlocked_mailsubject"), $mailcontent); } } // Formular ausgrauen return login_formular(false, "warning_false_logins"); } else { // Formular nochmal normal anzeigen return login_formular(true, "incorrect_login"); } // Formular noch nicht abgeschickt? Dann wurde die Seite zum ersten Mal aufgerufen. } else { // Login noch gesperrt? if ($LOGINCONF->get("falselogincounttemp") > 0 and time() - $LOGINCONF->get("loginlockstarttime") <= $LOGINLOCKTIME * 60) { // gesperrtes Formular anzeigen return login_formular(false, "warning_false_logins"); } else {