Exemplo n.º 1
0
function process_new_cache($notify)
{
    global $emailaddr, $octeamEmailsSignature, $absolute_server_URI, $site_name, $dateFormat, $cacheTypes, $cacheSizes, $cacheTypeIcons;
    switch ($notify['type']) {
        case NOTIFY_NEW_CACHES:
            // Type: new cache
            $mailbody = file_get_contents(__DIR__ . '/notifyNewcacheEmail.html');
            break;
        default:
            echo "Unknown Notification Typ: " . $notify['type'] . "<br />";
            return 0;
    }
    $thunderSection = ' (<img src="' . $absolute_server_URI . 'tpl/stdstyle/images/blue/thunder_ico.png" alt="user activity" width="9" height="9" border="0" title="' . tr('viewlog_aktywnosc') . ' [' . $notify['found'] . '+' . $notify['dnf'] . '+' . $notify['hidden'] . ']"/>' . ($notify['hidden'] + $notify['found'] + $notify['dnf']) . ') ';
    $mailbody = mb_ereg_replace('{username}', htmlspecialchars($notify['recpname'], ENT_COMPAT, 'UTF-8'), $mailbody);
    $mailbody = mb_ereg_replace('{date}', date($dateFormat, strtotime($notify['date_hidden'])), $mailbody);
    $mailbody = mb_ereg_replace('{cacheid}', $notify['cache_id'], $mailbody);
    $mailbody = mb_ereg_replace('{wp_oc}', $notify['wp_oc'], $mailbody);
    $mailbody = mb_ereg_replace('{user}', htmlspecialchars($notify['username'], ENT_COMPAT, 'UTF-8'), $mailbody);
    $mailbody = mb_ereg_replace('{cachename}', htmlspecialchars($notify['cachename'], ENT_COMPAT, 'UTF-8'), $mailbody);
    $mailbody = mb_ereg_replace('{distance}', round(calcDistance($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2'], 1), 1), $mailbody);
    $mailbody = mb_ereg_replace('{unit}', 'km', $mailbody);
    $mailbody = mb_ereg_replace('{bearing}', Bearing2Text(calcBearing($notify['lat1'], $notify['lon1'], $notify['lat2'], $notify['lon2'])), $mailbody);
    $mailbody = mb_ereg_replace('{cachetype}', tr($cacheTypes[$notify['cachetype']]['translation']), $mailbody);
    $mailbody = mb_ereg_replace('{cachesize}', tr($cacheSizes[$notify['cachesize']]['translation']), $mailbody);
    $mailbody = mb_ereg_replace('{server}', $absolute_server_URI, $mailbody);
    $mailbody = mb_ereg_replace('{sitename}', $site_name, $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_01}', tr('notify_newCache_01'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_02}', tr('notify_newCache_02'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_03}', tr('notify_newCache_03'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_04}', tr('notify_newCache_04'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_05}', tr('notify_newCache_05'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_06}', tr('notify_newCache_06'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_07}', tr('notify_newCache_07'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_08}', tr('notify_newCache_08'), $mailbody);
    $mailbody = mb_ereg_replace('{notify_newCache_09}', tr('notify_newCache_09'), $mailbody);
    $mailbody = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $mailbody);
    $mailbody = mb_ereg_replace('{runwatch04}', tr('runwatch04'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch08}', tr('runwatch08'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch09}', tr('runwatch09'), $mailbody);
    $mailbody = mb_ereg_replace('{wp_oc}', $notify['wp_oc'], $mailbody);
    $mailbody = mb_ereg_replace('{cache_owner_id}', $notify['cache_owner_id'], $mailbody);
    $mailbody = mb_ereg_replace('{caheIcon}', $cacheTypeIcons[$notify['cachetype']]['iconSet'][1]['iconSmall'], $mailbody);
    $mailbody = mb_ereg_replace('{thunderSection}', $thunderSection, $mailbody);
    $subject = mb_ereg_replace('{cachename}', $notify['cachename'], tr('notify_newCache_13'));
    /* begin send out everything that has to be sent */
    $email_headers = "Content-Type: text/html; charset=utf-8\r\n";
    $email_headers .= 'From: "' . $emailaddr . '" <' . $emailaddr . '>';
    $mailadr = $notify['email'];
    $status = mb_send_mail($mailadr, $subject, $mailbody, $email_headers);
    Log::logentry('notify_newcache', 5, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, array('status' => $status));
    return 0;
}
Exemplo n.º 2
0
 private function sendEmail($step, $cacheid)
 {
     $octeamEmailAddress = $this->ocConfig->getOcteamEmailAddress();
     $siteName = $this->ocConfig->getSiteName();
     $cache = new \lib\Objects\GeoCache\GeoCache(array('cacheId' => (int) $cacheid));
     switch ($step) {
         case $this->step["START"]:
             $email_content = file_get_contents($this->stylepath . '/email/arch1.email');
             break;
         case $this->step["AFTER_FIRST_MAIL_SENT"]:
             $email_content = file_get_contents($this->stylepath . '/email/arch2.email');
             break;
         case $this->step["AFTER_SECOND_MAIL_SENT"]:
             $email_content = file_get_contents($this->stylepath . '/email/arch3.email');
             break;
     }
     $email_content = mb_ereg_replace('{server}', $this->ocConfig->getAbsolute_server_URI(), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_01}', tr('autoArchive_01'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_02}', tr('autoArchive_02'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_03}', tr('autoArchive_03'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_04}', tr('autoArchive_04'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_05}', tr('autoArchive_05'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_06}', tr('autoArchive_06'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_07}', tr('autoArchive_07'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_08}', tr('autoArchive_08'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_09}', tr('autoArchive_09'), $email_content);
     $email_content = mb_ereg_replace('{autoArchive_10}', tr('autoArchive_10'), $email_content);
     $email_content = mb_ereg_replace('{cachename}', $cache->getCacheName(), $email_content);
     $email_content = mb_ereg_replace('{cache_wp}', $cache->getWaypointId(), $email_content);
     $email_content = mb_ereg_replace('{cacheid}', $cacheid, $email_content);
     $email_content = mb_ereg_replace('{octeamEmailsSignature}', $this->ocConfig->getOcteamEmailsSignature(), $email_content);
     $emailheaders = "Content-Type: text/plain; charset=utf-8\r\n";
     $emailheaders .= "From: {$siteName} <{$octeamEmailAddress}>\r\n";
     $emailheaders .= "Reply-To: {$siteName} <{$octeamEmailAddress}>";
     $status = mb_send_mail($cache->getOwner()->getEmail(), tr('autoArchive_11'), $email_content, $emailheaders);
     Log::logentry('autoarchive', 6, $cache->getOwner()->getUserId(), $cache->getCacheId(), 0, 'Sending mail to ' . $cache->getOwner()->getEmail(), array('status' => $status));
 }
Exemplo n.º 3
0
    tpl_set_var('username', '');
    tpl_set_var('username_message', '');
    tpl_set_var('message', '');
    if (isset($_REQUEST['submit'])) {
        $username = isset($_REQUEST['username']) ? $_REQUEST['username'] : '';
        $rs = XDb::xSql("SELECT `user_id`, `email`, `username` FROM `user` WHERE `username`= ? LIMIT 1", $username);
        if (!($r = XDb::xFetchArray($rs))) {
            tpl_set_var('username', htmlspecialchars($username, ENT_COMPAT, 'UTF-8'));
            tpl_set_var('username_message', $wrong_username);
        } else {
            $email_content = file_get_contents($stylepath . '/email/remindemail.email');
            $email_content = mb_ereg_replace('{server}', $absolute_server_URI, $email_content);
            $email_content = mb_ereg_replace('{ForgottenEmail_07}', tr('ForgottenEmail_07'), $email_content);
            $email_content = mb_ereg_replace('{ForgottenEmail_08}', tr('ForgottenEmail_08'), $email_content);
            $email_content = mb_ereg_replace('{ForgottenEmail_09}', tr('ForgottenEmail_09'), $email_content);
            $email_content = mb_ereg_replace('{ForgottenEmail_10}', tr('ForgottenEmail_10'), $email_content);
            $email_content = mb_ereg_replace('{ForgottenEmail_11}', tr('ForgottenEmail_11'), $email_content);
            $email_content = mb_ereg_replace('{user}', $r['username'], $email_content);
            $email_content = mb_ereg_replace('{date}', strftime($datetimeformat), $email_content);
            $email_content = mb_ereg_replace('{email}', $r['email'], $email_content);
            $email_content = mb_ereg_replace('{octeamEmailsSignature}', $octeamEmailsSignature, $email_content);
            // ok, mail verschicken
            mb_send_mail($r['email'], $mail_subject, $email_content, $emailheaders);
            Log::logentry('remindemail', 3, $r['user_id'], 0, 0, 'Remind-E-Mail-Adress an ' . $r['username'] . ' / ' . $r['email'], array());
            tpl_set_var('username', htmlspecialchars($username, ENT_COMPAT, 'UTF-8'));
            tpl_set_var('message', $mail_send);
        }
    }
}
//make the template and send it out
tpl_BuildTemplate();
Exemplo n.º 4
0
function send_mail_and_clean_watches_waiting($currUserID, $currUserName, $currUserEMail, $currUserOwnerLogs, $currUserWatchLogs)
{
    global $nologs, $watchlistMailfrom, $mailsubject, $absolute_server_URI, $octeamEmailsSignature;
    if ($currUserID == '') {
        return;
    }
    $email_headers = 'MIME-Version: 1.0' . "\r\n";
    $email_headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    $email_headers .= 'From: "' . $watchlistMailfrom . '" <' . $watchlistMailfrom . '>';
    $mailbody = file_get_contents(dirname(__FILE__) . '/watchlist.email.html');
    $mailbody = mb_ereg_replace('{username}', $currUserName, $mailbody);
    $mailbody = mb_ereg_replace('{absolute_server_URI}', $absolute_server_URI, $mailbody);
    if ($currUserOwnerLogs != '') {
        $logtexts = $currUserOwnerLogs;
        while (mb_substr($logtexts, -1) == "\n" || mb_substr($logtexts, -1) == "\r") {
            $logtexts = mb_substr($logtexts, 0, mb_strlen($logtexts) - 1);
        }
        $mailbody = mb_ereg_replace('{ownerlogs}', $logtexts, $mailbody);
        $mailbody = mb_ereg_replace('{cachesOwnedDisplay}', 'block', $mailbody);
    } else {
        $mailbody = mb_ereg_replace('{ownerlogs}', $nologs, $mailbody);
        $mailbody = mb_ereg_replace('{cachesOwnedDisplay}', 'none', $mailbody);
    }
    if ($currUserWatchLogs != '') {
        $logtexts = $currUserWatchLogs;
        while (mb_substr($logtexts, -1) == "\n" || mb_substr($logtexts, -1) == "\r") {
            $logtexts = mb_substr($logtexts, 0, mb_strlen($logtexts) - 1);
        }
        $mailbody = mb_ereg_replace('{watchlogs}', $logtexts, $mailbody);
        $mailbody = mb_ereg_replace('{cachesWatchedDisplay}', 'block', $mailbody);
    } else {
        $mailbody = mb_ereg_replace('{watchlogs}', $nologs, $mailbody);
        $mailbody = mb_ereg_replace('{cachesWatchedDisplay}', 'none', $mailbody);
    }
    $mailbody = mb_ereg_replace('{runwatch01}', tr('runwatch01'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch02}', tr('runwatch02'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch03}', tr('runwatch03'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch04}', tr('runwatch04'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch05}', tr('runwatch05'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch06}', tr('runwatch06'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch07}', tr('runwatch07'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch08}', tr('runwatch08'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch09}', tr('runwatch09'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch10}', tr('runwatch10'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch11}', tr('runwatch11'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch12}', tr('runwatch12'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch13}', tr('runwatch13'), $mailbody);
    $mailbody = mb_ereg_replace('{runwatch14}', tr('runwatch14'), $mailbody);
    $mailbody = mb_ereg_replace('{emailSign}', $octeamEmailsSignature, $mailbody);
    $mailadr = $currUserEMail;
    // $mailbody;
    $status = mb_send_mail($mailadr, $mailsubject, $mailbody, $email_headers);
    Log::logentry('watchlist', 2, $currUserID, 0, 0, 'Sending mail to ' . $mailadr, array('status' => $status));
    XDb::xSql("DELETE FROM watches_waiting WHERE user_id= ? AND watchtype IN (1, 2)", $currUserID);
}