function process_new_cache($notify) { global $debug, $debug_mailto, $rootpath; global $mailfrom, $new_cache_subject, $new_oconly_subject; //echo "process_new_cache(".$notify['id'].")\n"; $error = false; // mail-template lesen switch ($notify['type']) { case notify_new_cache: // Type: new cache $mailbody = read_file($rootpath . 'util/notification/notify_newcache.email'); $mailsubject = $new_cache_subject; break; case notify_new_oconly: // Type: new OConly flag $mailbody = read_file($rootpath . 'util/notification/notify_newoconly.email'); $mailsubject = $new_oconly_subject; break; default: $error = true; break; } if (!$error) { $mailbody = mb_ereg_replace('{username}', $notify['recpname'], $mailbody); $mailbody = mb_ereg_replace('{date}', date('d.m.Y', 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}', $notify['username'], $mailbody); $mailbody = mb_ereg_replace('{cachename}', $notify['cachename'], $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}', $notify['cachetype'], $mailbody); $mailbody = mb_ereg_replace('{cachesize}', $notify['cachesize'], $mailbody); $mailbody = mb_ereg_replace('{oconly}', $notify['oconly'] ? 'OConly-' : '', $mailbody); $subject = mb_ereg_replace('{cachename}', $notify['cachename'], $mailsubject); $subject = mb_ereg_replace('{oconly}', $notify['oconly'] ? 'OConly-' : '', $subject); /* begin send out everything that has to be sent */ $email_headers = 'From: "' . $mailfrom . '" <' . $mailfrom . '>'; // mail versenden if ($debug == true) { $mailadr = $debug_mailto; } else { $mailadr = $notify['email']; } if (is_existent_maildomain(getToMailDomain($mailadr))) { mb_send_mail($mailadr, $subject, $mailbody, $email_headers); } } else { echo "Unbekannter Notification-Typ: " . $notify['type'] . "<br />"; } // logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details) logentry('notify_newcache', 8, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, array()); return 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; }
function process_new_cache($notify) { global $mailfrom, $mailsubject, $debug, $debug_mailto, $rootpath, $octeamEmailsSignature, $absolute_server_URI, $site_name, $dateFormat, $cacheTypes, $cacheSizes, $cacheTypeIcons; $fehler = false; switch ($notify['type']) { case notify_new_cache: // Type: new cache //$emailFilePath = 'util.sec/notification/notify_newcache.email'; $emailFilePath = '/notifyNewcacheEmail.html'; //$mailbody = read_file($rootpath.$emailFilePath); $mailbody = file_get_contents(__DIR__ . $emailFilePath); break; default: $fehler = true; break; } if (!$fehler) { $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'], $mailsubject); /* begin send out everything that has to be sent */ $email_headers = "Content-Type: text/html; charset=utf-8\r\n"; $email_headers .= 'From: "' . $mailfrom . '" <' . $mailfrom . '>'; // mail versenden if ($debug == true) { $mailadr = $debug_mailto; } else { $mailadr = $notify['email']; } //header("Content-Type: text/html; charset=utf-8\r\n"); //echo $mailbody; $status = mb_send_mail($mailadr, $subject, $mailbody, $email_headers); // logentry($module, $eventid, $userid, $objectid1, $objectid2, $logtext, $details) logentry('notify_newcache', 5, $notify['recid'], $notify['cache_id'], 0, 'Sending mail to ' . $mailadr, array('status' => $status)); } else { echo "Unbekannter Notification-Typ: " . $notify['type'] . "<br />"; } return 0; }
$result = sql_slave($sql); if ($row = sql_fetch_array($result)) { $tmpline = mb_ereg_replace('{logimage1}', icon_log_type($row['icon_small'], "") . '<a href=\'viewlogs.php?cacheid=' . htmlspecialchars($caches_record['cache_id'], ENT_COMPAT, 'UTF-8') . '#' . htmlspecialchars($row['id'], ENT_COMPAT, 'UTF-8') . '\'>{gray_s}' . date($logdateformat, strtotime($row['date'])) . '{gray_e}</a>', $tmpline); $tmpline = mb_ereg_replace('{logdate1}', "", $tmpline); } else { $tmpline = mb_ereg_replace('{logimage1}', "<img src='images/trans.gif' border='0' width='16' height='16' />", $tmpline); $tmpline = mb_ereg_replace('{logdate1}', "--.--.----", $tmpline); } $lastlogs = ""; while ($row = sql_fetch_array($result)) { $lastlogs .= '<a href=\'viewlogs.php?cacheid=' . urlencode($caches_record['cache_id']) . '#' . htmlspecialchars($row['id'], ENT_COMPAT, 'UTF-8') . '\'>' . icon_log_type($row['icon_small'], '') . '</a> '; } $tmpline = mb_ereg_replace('{lastlogs}', $lastlogs, $tmpline); // und jetzt noch die Richtung ... if ($caches_record['distance'] > 0) { $tmpline = mb_ereg_replace('{direction}', Bearing2Text(calcBearing($lat_rad / 3.14159 * 180, $lon_rad / 3.14159 * 180, $caches_record['latitude'], $caches_record['longitude']), 1), $tmpline); } else { $tmpline = mb_ereg_replace('{direction}', '', $tmpline); } $desclangs = ''; $aLangs = mb_split(',', $caches_record['desc_languages']); foreach ($aLangs as $thislang) { $desclangs .= '<a href="viewcache.php?cacheid=' . urlencode($caches_record['cache_id']) . '&desclang=' . urlencode($thislang) . '" style="text-decoration:none;"><b><font color="blue">' . htmlspecialchars($thislang, ENT_COMPAT, 'UTF-8') . '</font></b></a> '; } $tmpline = mb_ereg_replace('{desclangs}', $desclangs, $tmpline); $tmpline = mb_ereg_replace('{cachename}', htmlspecialchars($caches_record['name'], ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{urlencode_cacheid}', htmlspecialchars(urlencode($caches_record['cache_id']), ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{urlencode_userid}', htmlspecialchars(urlencode($caches_record['user_id']), ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{username}', htmlspecialchars($caches_record['username'], ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{distance}', htmlspecialchars(sprintf("%01.1f", $caches_record['distance']), ENT_COMPAT, 'UTF-8'), $tmpline); $tmpline = mb_ereg_replace('{position}', $nRowIndex + $startat + 1, $tmpline);