| version 1.54, 2007/02/24 19:27:03 |
version 1.55, 2007/02/24 21:11:02 |
|
|
| * http://platon.sk/projects/Metafox/ |
* http://platon.sk/projects/Metafox/ |
| */ |
*/ |
| |
|
| /* $Platon: Metafox/functions.inc.php,v 1.53 2007-02-18 21:30:29 nepto Exp $ */ |
/* $Platon: Metafox/functions.inc.php,v 1.54 2007-02-24 19:27:03 nepto Exp $ */ |
| |
|
| function ezin_eval($evalcode) /* {{{ */ |
function ezin_eval($evalcode) /* {{{ */ |
| { |
{ |
| Line 723 function ezin_message_process($full, $me |
|
| Line 723 function ezin_message_process($full, $me |
|
| } /* }}} */ |
} /* }}} */ |
| |
|
| /* |
/* |
| * Feedback e-mail sending |
* E-mail sending |
| */ |
*/ |
| function ezin_feedback_send_notify_email($data) /* {{{ */ |
|
| |
function ezin_core_send_notify_email($data, $type = 'feedback') /* {{{ */ |
| { |
{ |
| global $ezin_sys, $ezin_cfg; |
global $ezin_sys, $ezin_cfg; |
| $from = ''; |
$from = ''; |
| Line 733 function ezin_feedback_send_notify_email |
|
| Line 734 function ezin_feedback_send_notify_email |
|
| $subject = ''; |
$subject = ''; |
| $encoding = ''; |
$encoding = ''; |
| $message = ''; |
$message = ''; |
| $tmpl = ezin_load_template($ezin_sys['tmpl']['e-mail']['feedback'], 1); |
$tmpl = ezin_load_template($ezin_sys['tmpl']['e-mail'][$type], 1); |
| if ($tmpl != false) { |
if ($tmpl != false) { |
| $tmpl = new HTML_Template_Platon($ezin_sys['tmpl']['e-mail']['feedback']); |
$tmpl = new HTML_Template_Platon($ezin_sys['tmpl']['e-mail'][$type]); |
| } |
} |
| if ($tmpl == false || $tmpl->isVar('content')) { |
if ($tmpl == false || $tmpl->isVar('content')) { |
| |
if ($type == 'feedback') { |
| |
$custom_part = 'Feedback form was submited on your portal at server time '; |
| |
$custom_part .= date($ezin_cfg['format_datetime']) . '.'; |
| |
} else if ($type == 'author') { |
| |
$custom_part = 'New user/author has joined your portal at server time '; |
| |
$custom_part .= date($ezin_cfg['format_datetime']) . '.'; |
| |
} |
| $message .= 'Dear administrator of '; |
$message .= 'Dear administrator of '; |
| $message .= $ezin_sys['software']['name']." on $ezin_cfg[name]\n\n"; |
$message .= $ezin_sys['software']['name']." on $ezin_cfg[name]\n\n"; |
| $message .= 'Feedback form was submited on your portal at server time '; |
$message .= "$custom_part\n"; |
| $message .= date($ezin_cfg['format_datetime']) . '.'; |
$message .= "Full information follows on the next lines.\n\n"; |
| $message .= "\nFull information follows on the next lines.\n\n"; |
|
| foreach ($data as $key => $val) { |
foreach ($data as $key => $val) { |
| $val = trim($val); |
$val = trim($val); |
| if (strpos($val, "\n") === false) { |
if (strpos($val, "\n") === false) { |
| Line 760 function ezin_feedback_send_notify_email |
|
| Line 767 function ezin_feedback_send_notify_email |
|
| } |
} |
| if ($tmpl != false) { |
if ($tmpl != false) { |
| foreach ($data as $key => $val) { |
foreach ($data as $key => $val) { |
| $tmpl->set("feedback_$key", $val); |
$tmpl->set($type.'_'.$key, $val); |
| } |
} |
| ezin_substitute_basic_properties($tmpl); |
ezin_substitute_basic_properties($tmpl); |
| ob_start(); |
ob_start(); |
| Line 771 function ezin_feedback_send_notify_email |
|
| Line 778 function ezin_feedback_send_notify_email |
|
| } |
} |
| empty($subject) && $subject = sprintf('%s: feedback', $ezin_cfg['name']); |
empty($subject) && $subject = sprintf('%s: feedback', $ezin_cfg['name']); |
| if (strlen($to) <= 0) { |
if (strlen($to) <= 0) { |
| $to = $ezin_cfg['feedback_email']; |
$to = $ezin_cfg[$type.'_email']; |
| } |
} |
| return ezin_email_send($to, $from, $subject, $encoding, $message); |
return ezin_email_send($to, $from, $subject, $encoding, $message); |
| } /* }}} */ |
} /* }}} */ |
| |
|
| |
function ezin_feedback_send_notify_email($data) /* {{{ */ |
| |
{ |
| |
ezin_core_send_notify_email($data, 'feedback'); |
| |
} /* }}} */ |
| |
|
| |
function ezin_author_send_notify_email($data) /* {{{ */ |
| |
{ |
| |
ezin_core_send_notify_email($data, 'author'); |
| |
} /* }}} */ |
| |
|
| /* |
/* |
| * Template load function |
* Template load function |
| */ |
*/ |
| Line 868 function ezin_email_send($emails, $from, |
|
| Line 885 function ezin_email_send($emails, $from, |
|
| { |
{ |
| global $ezin_cfg, $ezin_sys; |
global $ezin_cfg, $ezin_sys; |
| |
|
| include_once 'Mail.php'; |
if (! is_array($emails)) { |
| include_once 'Mail/mime.php'; |
$emails = preg_split('|\s+|', $emails); |
| |
} |
| |
foreach (array_keys($emails) as $key) { |
| |
$emails[$key] = trim($emails[$key]); |
| |
if (empty($emails[$key]) || strpos($emails[$key], '@') === false) { |
| |
unset($emails[$key]); |
| |
} |
| |
} |
| |
if (count($emails) <= 0) { |
| |
return true; // no e-mails, nothing to do more |
| |
} |
| |
$emails = array_unique($emails); |
| |
|
| $message .= "\n\n--\n"; |
$message .= "\n\n--\n"; |
| $message .= $ezin_sys['software']['name'].' - '.$ezin_sys['software']['description']; |
$message .= $ezin_sys['software']['name'].' - '.$ezin_sys['software']['description']; |
| Line 881 function ezin_email_send($emails, $from, |
|
| Line 909 function ezin_email_send($emails, $from, |
|
| empty($encoding) && $encoding = 'iso-8859-1'; |
empty($encoding) && $encoding = 'iso-8859-1'; |
| empty($from) && $from = sprintf('"%s on %s" <webmaster@%s>', |
empty($from) && $from = sprintf('"%s on %s" <webmaster@%s>', |
| $ezin_sys['software']['name'], $ezin_cfg['name'], $_SERVER['SERVER_NAME']); |
$ezin_sys['software']['name'], $ezin_cfg['name'], $_SERVER['SERVER_NAME']); |
| if (! is_array($emails)) { |
|
| $emails = preg_split('|\s+|', $emails); |
include_once 'Mail.php'; |
| } |
include_once 'Mail/mime.php'; |
| foreach (array_keys($emails) as $key) { |
|
| $emails[$key] = trim($emails[$key]); |
|
| if (empty($emails[$key]) || strpos($emails[$key], '@') === false) { |
|
| unset($emails[$key]); |
|
| } |
|
| } |
|
| |
|
| $mime = new Mail_mime(); |
$mime = new Mail_mime(); |
| $mime->setTXTBody($message); |
$mime->setTXTBody($message); |
| |
|
| Line 908 function ezin_email_send($emails, $from, |
|
| Line 930 function ezin_email_send($emails, $from, |
|
| 'html_charset' => $encoding, |
'html_charset' => $encoding, |
| 'head_charset' => $encoding |
'head_charset' => $encoding |
| )); |
)); |
| $site_key = 'Metafox.'.@$ezin_cfg['abbreviation'].'.'.md5(@$ezin_cfg['name']); |
$site_key = $ezin_sys['software']['name'].'.'.@$ezin_cfg['abbreviation'].'.'.md5(@$ezin_cfg['name']); |
| if (strlen($_SERVER['HTTP_HOST']) > 0) { |
if (strlen($_SERVER['HTTP_HOST']) > 0) { |
| $site_key .= '@'.$_SERVER['HTTP_HOST']; |
$site_key .= '@'.$_SERVER['HTTP_HOST']; |
| } |
} |
| Line 1394 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1416 function ezin_cgi_parse() /* {{{ */ |
|
| } |
} |
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| if (! empty($ezin_save_author)) { /* {{{ */ |
if (! empty($ezin_save_author) && $ezin_cfg['user_create_role_id'] > 0) { /* {{{ */ |
| if (stristr($ezin_cfg['antispam_flags'], 'A') != false |
if (stristr($ezin_cfg['antispam_flags'], 'A') != false |
| && strlen(trim($ezin_cfg['antispam_answer'])) > 0 |
&& strlen(trim($ezin_cfg['antispam_answer'])) > 0 |
| && strcasecmp(trim($ezin_cfg['antispam_answer']), trim($_REQUEST['ezin_antispam']))) { |
&& strcasecmp(trim($ezin_cfg['antispam_answer']), trim($_REQUEST['ezin_antispam']))) { |
| Line 1410 function ezin_cgi_parse() /* {{{ */ |
|
| Line 1432 function ezin_cgi_parse() /* {{{ */ |
|
| $data[$matches[1]] = stripslashes($val); |
$data[$matches[1]] = stripslashes($val); |
| } |
} |
| } |
} |
| //ezin_feedback_send_notify_email($data); |
ezin_author_send_notify_email($data); |
| if (ezin_save_author($data)) { |
if (ezin_save_author($data)) { |
| $ezin_cgi['author_save_ok'] = 1; |
$ezin_cgi['author_save_ok'] = 1; |
| if ($ezin_cfg['author_save_redirect']) { |
if ($ezin_cfg['author_save_redirect']) { |