&1 ", "r")) { $diff .= fread($f, 16<<10); pclose($f); $diff_failed = !strlen($diff) || (strpos($diff, "Files ") === 0); #-- do not [notify:] if changes were minimal if ((!$diff_failed) && (strlen($diff) < EWIKI_NOTIFY_WITH_DIFF)) { #echo("WikiNotice: no notify, because too few changes (" .strlen($diff)." byte)\n"); $ret_err = 1; } $diff = "\n\n-----------------------------------------------------------------------------\n\n" . $diff; } else { $diff = ""; #echo("WikiWarning: diff failed in notify module\n"); } unlink($fn1); unlink($fn2); if ($ret_err) { return(false); } } #-- separate addresses into (TLD) groups $mailto_lang = array( ); foreach ($mailto as $m) { $lang = ""; #-- remove lang selection trailer $m = strtok($m, ","); if ($uu = strtok(",")) { $lang = $uu; } $m = strtok($m, ";"); if ($uu = strtok(";")) { $lang = $uu; } #-- else use TLD as language code if (empty($lang)) { $r = strrpos($m, "."); $lang = substr($m, $r+1); } $lang = trim($lang); #-- address mangling $m = trim($m); if (substr($m, 0, 4) == "icq:") { $m = substr($m, 4) . "@pager.icq.com"; } $mailto_lang[$lang][] = $m; } #-- go thru email address groups foreach ($mailto_lang as $lang=>$a_mailto) { $pref_langs = array_merge(array( "$lang", "en" ), $ewiki_t["languages"]); ($server = $_SERVER["HTTP_HOST"]) or ($server = $_SERVER["SERVER_NAME"]); $s_4 = "http".($_SERVER['HTTPS'] == "on" ? 's':'')."://" . $server . $_SERVER["REQUEST_URI"]; $link = str_replace("edit/$id", "$id", $s_4); $m_text = ewiki_t("NOTIFY_BODY", array( "id" => $id, "link" => $link, "edit_link" => $s_4, "server_admin" => $_SERVER["SERVER_ADMIN"], "server" => $server, "wiki_title" => EWIKI_PAGE_INDEX, ), $pref_langs); $m_text .= $diff; $m_from = EWIKI_NOTIFY_SENDER."@$server"; $m_subject = ewiki_t("NOTIFY_SUBJECT", array( "id" => $id, ), $pref_langs); $m_to = implode(", ", $a_mailto); mail($m_to, $m_subject, $m_text, "From: \"$s_2\" <$m_from>\nX-Mailer: ErfurtWiki/".EWIKI_VERSION); } } function ewiki_notify_links(&$source, $strip=1) { $links = array(); $l = 0; if (strlen($source) > 10) while (($l = @strpos($source, "[notify:", $l)) !== false) { $r = strpos($source, "]", $l); $str = substr($source, $l, $r + 1 - $l); if (!strpos("\n", $str)) { $links[] = trim(substr($str, 8, -1)); if ($strip) { $source = substr($source, 0, $l) . substr($source, $r + 1); } } $l++; } return($links); } function ewiki_format_remove_notify(&$source) { ewiki_notify_links($source, 1); } ?>