function forgotten_password() { if (!isset($_REQUEST["Benutzername"]) || !isset($_REQUEST["EMail"]) || $_REQUEST["Benutzername"] == 'guest' || empty($_REQUEST["Benutzername"]) || empty($_REQUEST["EMail"]) || !(bool) trim($_REQUEST["Benutzername"]) || !(bool) trim($_REQUEST["EMail"])) { return -1; } if (!USE_PHP_MAILING) { return -4; } $administration = new administration(); define("USER_NAME", trim($_REQUEST["Benutzername"])); define("USER_EMAIL", trim($_REQUEST["EMail"])); if (!$administration->getUserIdByUserName(USER_NAME) || USER_EMAIL != $administration->getEmailByUserId($administration->getUserIdByUserName(USER_NAME))) { return -2; } $new_password = $administration->getRandomPassword(); $sql_update = "UPDATE mb_user SET mb_user_password = \$1, mb_user_digest = \$3 WHERE mb_user_id = \$2"; $v = array(md5($new_password), $administration->getUserIdByUserName(USER_NAME), md5(USER_NAME . ";" . USER_EMAIL . ":" . REALM . ":" . $new_password)); $t = array("s", "i"); if (!db_prep_query($sql_update, $v, $t)) { return -3; } $email_subject = "New GeoPortal.rlp Password"; $email_body = sprintf("Your new GeoPortal.rlp password is: %s", $new_password); if (!$administration->sendEmail(NULL, NULL, USER_EMAIL, USER_NAME, $email_subject, $email_body, $error_msg)) { return -4; } return 1; }
$mywms->createObjFromXML($myURL); $mywms->optimizeWMS(); echo "<br />"; if (!MD_OVERWRITE) { $mywms->overwrite = false; } $mywms->updateObjInDB($myWMS); $mywms->displayWMS(); // start (owners of the updated wms will be notified by email) if ($use_php_mailing) { $owner_ids = $admin->getOwnerByWms($myWMS); if ($owner_ids && count($owner_ids) > 0) { $owner_mail_addresses = array(); $j = 0; for ($i = 0; $i < count($owner_ids); $i++) { $adr_tmp = $admin->getEmailByUserId($owner_ids[$i]); if (!in_array($adr_tmp, $owner_mail_addresses) && $adr_tmp) { $owner_mail_addresses[$j] = $adr_tmp; $j++; } } $replyto = $admin->getEmailByUserId(Mapbender::session()->get("mb_user_id")); $from = $replyto; $pathArray = explode("http/php/", $_SERVER["PATH_TRANSLATED"]); $path = $pathArray[0]; $body = "WMS '" . $admin->getWmsTitleByWmsId($myWMS) . "' has been updated. \n\nServer name: " . $_SERVER["SERVER_NAME"] . "\nInstallation Path: " . $path . "\n\nYou may want to check the changes as you are an owner of this WMS."; $error_msg = ""; for ($i = 0; $i < count($owner_mail_addresses); $i++) { if (!$admin->sendEmail($replyto, $from, $owner_mail_addresses[$i], $owner_mail_addresses[$i], "[Mapbender] A user has updated one of your WMS", $body, $error)) { if ($error) { $error_msg .= $error . " ";
$status_comment = "Monitoring process timed out."; $status = '-1'; array_push($problemOWS, $wms_id_own[$k]); array_push($commentProblemOWS, $status_comment); } $v = array('0', intval($status), intval($image), $status_comment, (string) intval($timestamp_end), $map_url, (string) intval($timestamp_begin), $cap_diff, (string) $time, $wms_id_own[$k]); $t = array('s', 'i', 'i', 's', 's', 's', 's', 's', 's', 's'); $res = db_prep_query($sql, $v, $t); } $body = ""; echo "\nmonitoring info in db for user: "******"\n"; //loop for single monitor requests that has problems for ($i = 0; $i < count($problemOWS); $i++) { $body .= $br . $admin->getWmsTitleByWmsId($problemOWS[$i]) . " (" . $problemOWS[$i] . "): " . $commentProblemOWS[$i] . $br; } unset($problemOWS); unset($commentProblemOWS); //end of loop for single monitor requests // Send an email to the user if body string exists if ($body) { $error_msg = ""; if ($admin->getEmailByUserId($userid)) { $admin->sendEmail(MAILADMIN, MAILADMINNAME, $admin->getEmailByUserId($userid), $user, "Mapbender monitoring report " . date("F j, Y, G:i:s", $time), utf8_decode($body), &$error_msg); } else { $error_msg = "Email address of user '" . $admin->getUserNameByUserId($userid) . "' unknown!\n"; } if ($error_msg) { echo "\n ERROR: " . $error_msg; } } }
public function sendUserLoginMail() { $admin = new administration(); $userMessage = "Your Mapbender login data:\n"; $userMessage .= "Your login name is: " . $this->name . "\n"; $userMessage .= "Please set your password using the following link: \n"; $mbUrl = substr(LOGIN, 0, -9); $userMessage .= $mbUrl . "../javascripts/mod_confirmLogin.php?user_id=" . $this->id . "&user_name=" . $this->name . "&user_ticket=" . $this->passwordTicket . "\n"; $userMessage .= "Follow this link to login to Mapbender: \n"; $userMessage .= LOGIN . "\n"; $userMail = $admin->getEmailByUserId($this->id); if (!$admin->sendEmail("", "", $userMail, $this->name, utf8_decode("Your Mapbender account"), utf8_decode($userMessage), $error_msg)) { return "Registry data could not be send. Please check mail address."; } return "Registry data has been sent successfully."; }
} $body_urllist .= "\n" . $email_body_footer . "\n"; //get user email adresses of abo-user $sql = "select mb_user_email from mb_user, "; $sql .= "(select distinct fkey_mb_user_id from mb_user_abo_ows " . "where fkey_wms_id in (" . $_POST['wmslist'] . ")) as abo_user "; $sql .= "where abo_user.fkey_mb_user_id=mb_user.mb_user_id"; $res = db_query($sql); $cnt = 0; //Initialisieren des Arrays $user_email = array(); //Herauslesen der Ergebnisse //echo "wmslist ist gesetzt!\n<br>"; echo "<h3>" . htmlentities($wms_list_text, ENT_QUOTES, CHARSET) . ":</h3> " . $_POST['wmslist'] . "\n<br><br>"; //echo "wms_id_list: ".$wms_id_list."\n<br>"; //get email of wms owner $mail_wms_owner = $admin->getEmailByUserId($user->id); while ($row = db_fetch_array($res)) { //echo $cnt; $user_email[$cnt] = $row["mb_user_email"]; $admin->sendEmail($mail_wms_owner, $mail_wms_owner, $user_email[$cnt], $mail_user_recipient, $mail_user_topic . " " . date("F j, Y, G:i:s"), utf8_decode(strip_tags($_POST['emailtext']) . "\n\n" . $further_inquiry_text . ": " . $mail_wms_owner . "\n" . $body_urllist)); $cnt++; } //controll mail for wms_owner $admin->sendEmail(MAILADMIN, MAILADMINNAME, $mail_wms_owner, $mail_admin_recipient, $mail_admin_topic . " " . date("F j, Y, G:i:s"), utf8_decode(_mb($mail_admin_body, $cnt) . "\n\n" . strip_tags($_POST['emailtext']) . $body_urllist)); echo "<br>" . htmlentities($email_sent_text, ENT_QUOTES, CHARSET) . "<br>"; } } echo "</form>\n"; } else { // // monitoring results
<body> <?php if (!USE_PHP_MAILING) { echo "<script language='javascript'>"; echo "alert('PHP mailing is currently disabled. Please adjust the settings in mapbender.conf.');"; echo "window.close();"; echo "</script>"; } else { $logged_user_name = Mapbender::session()->get("mb_user_name"); $logged_user_id = Mapbender::session()->get("mb_user_id"); $admin = new administration(); $upd = false; if ($_POST["sendnew"]) { if ($_POST["username"] && $_POST["email"]) { $id = $admin->getUserIdByUserName($_POST["username"]); $mailAddressMatch = $admin->getEmailByUserId($id) == $_POST["email"] && $_POST["email"] != ''; $user_id = $id; if ($user_id && $mailAddressMatch) { $upd = true; } else { echo "Either your username could not be found or you have registered another or no mail address.<br><br>"; } } else { echo "Please fill in your username and mail address.<br><br>"; } } /*handle INSERT and DELETE************************************************************************************/ if ($upd) { $sql_password = $admin->getRandomPassword(); $mailToAddr = $admin->getEmailByUserId($user_id); $mailToName = $admin->getUsernameByUserId($user_id);