本文整理汇总了PHP中COM_isEmail函数的典型用法代码示例。如果您正苦于以下问题:PHP COM_isEmail函数的具体用法?PHP COM_isEmail怎么用?PHP COM_isEmail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了COM_isEmail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deliver_backup
/**
* Deliver a backup file.
* Originally had the option of "http" or "smtp", but for glFusion
* only "smtp" is needed. Files can be downloaded at any time via
* the backup admin interface.
*/
private function deliver_backup($filename = '')
{
global $_VARS, $_CONF;
if ($filename == '' || !filename) {
return false;
}
$diskfile = $this->backup_dir . $filename;
$recipient = $_VARS['_dbback_sendto'];
if (!file_exists($diskfile)) {
COM_errorLog("dbBackup: File {$diskfile} does not exist");
return false;
}
if (!COM_isEmail($recipient)) {
COM_errorLog("{$recipient} is not a valid email address");
return false;
}
$message = sprintf("Attached to this email is\n %s\n Size:%s kilobytes\n", $filename, round(filesize($diskfile) / 1024));
$status = $this->SendMail($recipient, $_CONF['site_name'] . ' ' . 'Database Backup', $message, '', false, 0, '', '', array($diskfile));
return $status;
}
示例2: prj_sendEmail
function prj_sendEmail($user, $subject, $message)
{
global $_USER, $_CONF, $_TABLES, $_PRJCONF;
$target_uid = DB_getItem($_TABLES['users'], "uid", "username='{$user}'");
$emailaddress = DB_getItem($_TABLES['users'], "email", "username = '{$user}'");
$emailtest = COM_isEmail($emailaddress);
if ($_PRJCONF['notifications_enabled'] && $emailtest) {
COM_mail($emailaddress, $subject, $message, $_CONF['site_mail'], false);
// Log notification for admin viewing and tracking
$type = "projects";
$logentry = $type . "," . $user . "," . $subject;
prj_logNotification($logentry);
}
return true;
}
示例3: createuser
function createuser()
{
global $_CONF, $_TABLES, $LANG01, $LANG04, $MESSAGE, $REMOTE_ADDR;
$retval = '';
$retval = '';
$passwd = '';
$passwd_conf = '';
if ($_CONF['disable_new_user_registration']) {
COM_setMsg($LANG04[122], 'error');
echo COM_refresh($_CONF['site_url']);
}
$email = isset($_POST['email']) ? COM_applyFilter($_POST['email']) : '';
$email_conf = isset($_POST['email_conf']) ? COM_applyFilter($_POST['email_conf']) : '';
$username = isset($_POST['username']) ? $_POST['username'] : '';
if (isset($_POST['passwd'])) {
$passwd = trim($_POST['passwd']);
}
if (isset($_POST['passwd_conf'])) {
$passwd_conf = trim($_POST['passwd_conf']);
}
$username = COM_truncate(trim($username), 48);
if (!USER_validateUsername($username)) {
$retval .= newuserform($LANG04[162]);
return $retval;
}
$email = COM_truncate(trim($email), 96);
$email_conf = trim($email_conf);
if ($_CONF['registration_type'] == 1) {
if (empty($passwd) || $passwd != $passwd_conf) {
$retval .= newuserform($MESSAGE[67]);
return $retval;
}
}
$fullname = '';
if (!empty($_POST['fullname'])) {
$fullname = COM_truncate(trim(USER_sanitizeName($_POST['fullname'])), 80);
}
if (!isset($_CONF['disallow_domains'])) {
$_CONF['disallow_domains'] = '';
}
if (COM_isEmail($email) && !empty($username) && $email === $email_conf && !USER_emailMatches($email, $_CONF['disallow_domains']) && strlen($username) <= 48) {
$ucount = DB_count($_TABLES['users'], 'username', DB_escapeString($username));
$ecount = DB_count($_TABLES['users'], 'email', DB_escapeString($email));
if ($ucount == 0 and $ecount == 0) {
// For glFusion, it would be okay to create this user now. But check
// with a custom userform first, if one exists.
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userCheck')) {
$msg = CUSTOM_userCheck($username, $email);
if (!empty($msg)) {
// no, it's not okay with the custom userform
$retval = CUSTOM_userForm($msg);
return $retval;
}
}
// Let plugins have a chance to decide what to do before creating the user, return errors.
$spamCheckData = array('username' => $username, 'email' => $email, 'ip' => $REMOTE_ADDR);
$msg = PLG_itemPreSave('registration', $spamCheckData);
if (!empty($msg)) {
$retval .= newuserform($msg);
return $retval;
}
if ($_CONF['registration_type'] == 1 && !empty($passwd)) {
$encryptedPasswd = SEC_encryptPassword($passwd);
} else {
$encryptedPasswd = '';
}
$uid = USER_createAccount($username, $email, $encryptedPasswd, $fullname);
if ($_CONF['usersubmission'] == 1) {
if (DB_getItem($_TABLES['users'], 'status', "uid = " . (int) $uid) == USER_ACCOUNT_AWAITING_APPROVAL) {
echo COM_refresh($_CONF['site_url'] . '/index.php?msg=48');
} else {
$retval = emailpassword($username, $passwd, 1);
}
} else {
$retval = emailpassword($username, $passwd);
}
return $retval;
} else {
$retval .= newuserform($LANG04[19]);
}
} else {
if ($email !== $email_conf) {
$msg = $LANG04[125];
$retval .= newuserform($msg);
} else {
// invalid username or email address
if (empty($username) || strlen($username) > 48) {
$msg = $LANG01[32];
// invalid username
} else {
$msg = $LANG04[18];
// invalid email address
}
$retval .= newuserform($msg);
}
}
return $retval;
}
示例4: testIsEmailReturnFalseForInvalidEmails
public function testIsEmailReturnFalseForInvalidEmails()
{
// Line 3075
// Commented emails should be invalid,
// but pass PEAR isValidInetAddress validation.
$invalidemails = array("abc@def@example.com", "abc\\\\@def@example.com", "abc\\@example.com", "@example.com", "doug@", "\"qu@example.com", "ote\"@example.com", "\"Doug \"Ace\" L.\"@example.com", "Doug\\ \\\"Ace\\\"\\ L\\.@example.com", "hello world@example.com", "gatsby@f.sc.ot.t.f.i.tzg.era.l.d.");
foreach ($invalidemails as $k => $invalid) {
$this->assertFalse(COM_isEmail($invalid), 'Error asserting ' . $invalid . ' is an invalid email');
}
}
示例5: saveuser
//.........这里部分代码省略.........
if (!empty($photo)) {
$newphoto = preg_replace('/' . $_USER['username'] . '/', $A['new_username'], $photo, 1);
$imgpath = $_CONF['path_images'] . 'userphotos/';
if (rename($imgpath . $photo, $imgpath . $newphoto) === false) {
$display = COM_siteHeader('menu', $LANG04[21]);
$display .= COM_errorLog('Could not rename userphoto "' . $photo . '" to "' . $newphoto . '".');
$display .= COM_siteFooter();
return $display;
}
DB_change($_TABLES['users'], 'photo', addslashes($newphoto), "uid", $_USER['uid']);
}
}
DB_change($_TABLES['users'], 'username', $A['new_username'], "uid", $_USER['uid']);
} else {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=51');
}
}
}
// a quick spam check with the unfiltered field contents
$profile = '<h1>' . $LANG04[1] . ' ' . $_USER['username'] . '</h1>' . '<p>' . COM_createLink($A['homepage'], $A['homepage']) . '<br' . XHTML . '>' . $A['location'] . '<br' . XHTML . '>' . $A['sig'] . '<br' . XHTML . '>' . $A['about'] . '<br' . XHTML . '>' . $A['pgpkey'] . '</p>';
$result = PLG_checkforSpam($profile, $_CONF['spamx']);
if ($result > 0) {
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
$A['email'] = COM_applyFilter($A['email']);
$A['email_conf'] = COM_applyFilter($A['email_conf']);
$A['homepage'] = COM_applyFilter($A['homepage']);
// basic filtering only
$A['fullname'] = strip_tags(COM_stripslashes($A['fullname']));
$A['location'] = strip_tags(COM_stripslashes($A['location']));
$A['sig'] = strip_tags(COM_stripslashes($A['sig']));
$A['about'] = strip_tags(COM_stripslashes($A['about']));
$A['pgpkey'] = strip_tags(COM_stripslashes($A['pgpkey']));
if (!COM_isEmail($A['email'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=52');
} else {
if ($A['email'] !== $A['email_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=78');
} else {
if (emailAddressExists($A['email'], $_USER['uid'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=56');
} else {
if (!empty($A['passwd'])) {
if ($A['passwd'] == $A['passwd_conf'] && SEC_encryptPassword($A['old_passwd']) == $current_password) {
$passwd = SEC_encryptPassword($A['passwd']);
DB_change($_TABLES['users'], 'passwd', "{$passwd}", "uid", $_USER['uid']);
if ($A['cooktime'] > 0) {
$cooktime = $A['cooktime'];
} else {
$cooktime = -1000;
}
SEC_setCookie($_CONF['cookie_password'], $passwd, time() + $cooktime);
} elseif (SEC_encryptPassword($A['old_passwd']) != $current_password) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=68');
} elseif ($A['passwd'] != $A['passwd_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=67');
}
}
if ($_US_VERBOSE) {
COM_errorLog('cooktime = ' . $A['cooktime'], 1);
}
if ($A['cooktime'] <= 0) {
$cooktime = 1000;
SEC_setCookie($_CONF['cookie_name'], $_USER['uid'], time() - $cooktime);
} else {
SEC_setCookie($_CONF['cookie_name'], $_USER['uid'], time() + $A['cooktime']);
示例6: send_messages
//.........这里部分代码省略.........
if (!empty($curfile['name'])) {
$pos = strrpos($curfile['name'], '.') + 1;
$fextension = substr($curfile['name'], $pos);
$filename = 'import_hello_' . COM_makesid() . '.' . $fextension;
}
if ($filename == '') {
$output = COM_siteHeader('menu', $LANG24[30]);
$output .= COM_startBlock($LANG24[30], '', COM_getBlockTemplate('_msg_block', 'header'));
$output .= 'Upload error: csv file name is empty. Please try again...';
$output .= COM_endBlock(COM_getBlockTemplate('_msg_block', 'footer'));
$output .= COM_siteFooter();
echo $output;
exit;
}
$upload->setFileNames($filename);
reset($_FILES);
$upload->uploadFiles();
if ($upload->areErrors()) {
$msg = $upload->printErrors(false);
return $LANG24[30];
}
//email group
$email_group = $LANG_HELLO01['csv_file'];
$destinataires = array();
$separator = $vars['separator'];
if (!in_array($separator, array(',', 'tab', ';'))) {
$separator = ',';
}
if ($separator == 'tab') {
$separator = "\t";
}
if (($handle = fopen($_CONF['path_data'] . $filename, "r")) !== FALSE) {
$quantity = 0;
while (($data = fgetcsv($handle, 0, $separator)) !== FALSE) {
//todo check if email is valid
if ($data[0] != '' and COM_isEmail($data[0])) {
$quantity++;
$destinataires[] = $data[0];
}
}
fclose($handle);
}
}
$retval .= COM_startBlock($LANG31[1]);
// register hello
$creation = date('YmdHi', time());
$subject = addslashes($vars['subject']);
$content = addslashes($vars['content']);
$from = COM_formatEmailAddress($vars['fra'], $vars['fraepost']);
$sql_ajout_hello = "INSERT INTO {$_TABLES['hello']} (subject, creation, email_group, quantity, content) VALUES ('{$subject}', '{$creation}', '{$email_group}', '{$quantity}','{$content}')";
DB_query($sql_ajout_hello);
$new_hello_id = DB_insertId();
// Loop through and send the messages in the DB!
$successes = 0;
$failures = 0;
if (!empty($vars['to_group'])) {
for ($i = 0; $i < $quantity; $i++) {
$A = DB_fetchArray($result);
$destinataire = $A['email'];
$expediteur = $from;
$date = date('YmdHi', time());
$sql_ajout_hello = "INSERT INTO {$_TABLES['hello_queue']} (expediteur, destinataire, date, hello_id, subject, content, priority) VALUES ('{$expediteur}', '{$destinataire}', '{$date}', '{$new_hello_id}', '{$subject}', '{$content}', '{$priority}')";
if ($destinataire != '') {
if (DB_query($sql_ajout_hello)) {
$successes = $successes + 1;
} else {
$failures = $failures + 1;
}
} else {
$failures = $failures + 1;
}
}
} else {
//csv file
for ($i = 0; $i < $quantity; $i++) {
$destinataire = $destinataires[$i];
$expediteur = $from;
$date = date('YmdHi', time());
$sql_ajout_hello = "INSERT INTO {$_TABLES['hello_queue']} (expediteur, destinataire, date, hello_id, subject, content, priority) VALUES ('{$expediteur}', '{$destinataire}', '{$date}', '{$new_hello_id}', '{$subject}', '{$content}', '{$priority}')";
if (DB_query($sql_ajout_hello)) {
$successes = $successes + 1;
} else {
$failures = $failures + 1;
}
}
}
if ($successes >= 0) {
$retval .= $i . ' ' . $LANG_HELLO01['email_schedule'] . '<br />' . $vars['priority'];
}
if ($failures > 0) {
$retval .= 'Oups... There was ' . $failures . ' failure(s)';
}
if (empty($vars['to_group'])) {
//list emails from csv
reset($destinataires);
$retval .= COM_makeList($destinataires);
}
$retval .= COM_endBlock();
return $retval;
}
示例7: saveuser
//.........这里部分代码省略.........
$display = COM_errorLog('Could not rename userphoto "' . $photo . '" to "' . $newphoto . '".');
$display = COM_createHTMLDocument($display, array('pagetitle' => $LANG04[21]));
return $display;
}
DB_change($_TABLES['users'], 'photo', DB_escapeString($newphoto), "uid", $_USER['uid']);
}
}
DB_change($_TABLES['users'], 'username', $A['new_username'], "uid", $_USER['uid']);
} else {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=51');
}
}
}
// a quick spam check with the unfiltered field contents
$profile = '<h1>' . $LANG04[1] . ' ' . $_USER['username'] . '</h1><p>';
// this is a hack, for some reason remoteservice links made SPAMX SLV check barf
if (empty($service)) {
$profile .= COM_createLink($A['homepage'], $A['homepage']) . '<br' . XHTML . '>';
}
$profile .= $A['location'] . '<br' . XHTML . '>' . $A['sig'] . '<br' . XHTML . '>' . $A['about'] . '<br' . XHTML . '>' . $A['pgpkey'] . '</p>';
$result = PLG_checkforSpam($profile, $_CONF['spamx']);
if ($result > 0) {
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
$A['email'] = COM_applyFilter($A['email']);
$A['email_conf'] = COM_applyFilter($A['email_conf']);
$A['homepage'] = COM_applyFilter($A['homepage']);
// basic filtering only
$A['fullname'] = strip_tags(COM_stripslashes($A['fullname']));
$A['location'] = strip_tags(COM_stripslashes($A['location']));
$A['sig'] = strip_tags(COM_stripslashes($A['sig']));
$A['about'] = strip_tags(COM_stripslashes($A['about']));
$A['pgpkey'] = strip_tags(COM_stripslashes($A['pgpkey']));
if (!COM_isEmail($A['email'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=52');
} else {
if ($A['email'] !== $A['email_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=78');
} else {
if (emailAddressExists($A['email'], $_USER['uid'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=56');
} else {
$passwd = '';
if ($service == '') {
if (!empty($A['passwd'])) {
if ($A['passwd'] == $A['passwd_conf'] && SEC_encryptUserPassword($A['old_passwd'], $_USER['uid']) == 0) {
SEC_updateUserPassword($A['passwd'], $_USER['uid']);
if ($A['cooktime'] > 0) {
$cooktime = $A['cooktime'];
} else {
$cooktime = -1000;
}
SEC_setCookie($_CONF['cookie_password'], $passwd, time() + $cooktime);
} elseif (SEC_encryptUserPassword($A['old_passwd'], $_USER['uid']) < 0) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=68');
} elseif ($A['passwd'] != $A['passwd_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=67');
}
}
} else {
// Cookie
if ($A['cooktime'] > 0) {
$cooktime = $A['cooktime'];
} else {
$cooktime = -1000;
}
示例8: createuser
/**
* Creates a user
* Creates a user with the give username and email address
*
* @param string $username username to create user for
* @param string $email email address to assign to user
* @param string $email_conf confirmation email address check
* @return string HTML for the form again if error occurs, otherwise nothing.
*/
function createuser($username, $email, $email_conf)
{
global $_CONF, $_TABLES, $LANG01, $LANG04;
$retval = '';
$username = trim($username);
$email = trim($email);
$email_conf = trim($email_conf);
if (!isset($_CONF['disallow_domains'])) {
$_CONF['disallow_domains'] = '';
}
if (COM_isEmail($email) && !empty($username) && $email === $email_conf && !USER_emailMatches($email, $_CONF['disallow_domains']) && strlen($username) <= 16) {
$ucount = DB_count($_TABLES['users'], 'username', DB_escapeString($username));
$ecount = DB_count($_TABLES['users'], 'email', DB_escapeString($email));
if ($ucount == 0 && $ecount == 0) {
// For Geeklog, it would be okay to create this user now. But check
// with a custom userform first, if one exists.
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userCheck')) {
$ret = CUSTOM_userCheck($username, $email);
if (!empty($ret)) {
// no, it's not okay with the custom userform
$retval = COM_createHTMLDocument(CUSTOM_userForm($ret['string']));
return $retval;
}
}
// Let plugins have a chance to decide what to do before creating the user, return errors.
$msg = PLG_itemPreSave('registration', $username);
if (!empty($msg)) {
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userForm')) {
$retval .= CUSTOM_userForm($msg);
} else {
$retval .= newuserform($msg);
}
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG04[22]));
return $retval;
}
$uid = USER_createAccount($username, $email);
if ($_CONF['usersubmission'] == 1) {
if (DB_getItem($_TABLES['users'], 'status', "uid = {$uid}") == USER_ACCOUNT_AWAITING_APPROVAL) {
COM_redirect($_CONF['site_url'] . '/index.php?msg=48');
} else {
$retval = emailpassword($username, 1);
}
} else {
$retval = emailpassword($username, 1);
}
return $retval;
} else {
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userForm')) {
$retval .= CUSTOM_userForm($LANG04[19]);
} else {
$retval .= newuserform($LANG04[19]);
}
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG04[22]));
}
} elseif ($email !== $email_conf) {
$msg = $LANG04[125];
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userForm')) {
$retval .= CUSTOM_userForm($msg);
} else {
$retval .= newuserform($msg);
}
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG04[22]));
} else {
// invalid username or email address
if (empty($username) || strlen($username) > 16) {
$msg = $LANG01[32];
// invalid username
} else {
$msg = $LANG04[18];
// invalid email address
}
if ($_CONF['custom_registration'] && function_exists('CUSTOM_userForm')) {
$retval .= CUSTOM_userForm($msg);
} else {
$retval .= newuserform($msg);
}
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG04[22]));
}
return $retval;
}
示例9: COM_siteHeader
} else {
$display .= COM_siteHeader('menu', $LANG08[17]) . mailstoryform($sid) . COM_siteFooter();
}
}
break;
case 'sendstory':
$sid = COM_sanitizeID(COM_applyFilter($_POST['sid']));
if (empty($sid)) {
$display = COM_refresh($_CONF['site_url'] . '/index.php');
} else {
$html = 0;
if ($postmode == 'html') {
$html = 1;
}
$shortmessage = $_POST['shortmsg'];
if (empty($_POST['toemail']) || empty($_POST['fromemail']) || !COM_isEmail($_POST['toemail']) || !COM_isEmail($_POST['fromemail'])) {
$display .= COM_siteHeader('menu', $LANG08[17]) . mailstoryform($sid, COM_applyFilter($_POST['to']), COM_applyFilter($_POST['toemail']), COM_applyFilter($_POST['from']), COM_applyFilter($_POST['fromemail']), $shortmessage, 52) . COM_siteFooter();
} else {
if (empty($_POST['to']) || empty($_POST['from']) || empty($shortmessage)) {
$display .= COM_siteHeader('menu', $LANG08[17]) . mailstoryform($sid, COM_applyFilter($_POST['to']), COM_applyFilter($_POST['toemail']), COM_applyFilter($_POST['from']), COM_applyFilter($_POST['fromemail']), $shortmessage) . COM_siteFooter();
} else {
$msg = PLG_itemPreSave('emailstory', $shortmessage);
if (!empty($msg)) {
$display .= COM_siteHeader('menu', '') . COM_errorLog($msg, 2) . mailstoryform($sid, COM_applyFilter($_POST['to']), COM_applyFilter($_POST['toemail']), COM_applyFilter($_POST['from']), COM_applyFilter($_POST['fromemail']), $shortmessage) . COM_siteFooter();
} else {
$display .= mailstory($sid, $_POST['to'], $_POST['toemail'], $_POST['from'], $_POST['fromemail'], $shortmessage, $html);
}
}
}
}
break;
示例10: COM_emailNotification
function COM_emailNotification($msgData = array())
{
global $_CONF;
// define the maximum number of emails allowed per bcc
$maxEmailsPerSend = 10;
// ensure we have something to send...
if (!isset($msgData['htmlmessage']) && !isset($msgData['textmessage'])) {
COM_errorLog("COM_emailNotification() - No message data provided");
return false;
// no message defined
}
if (empty($msgData['htmlmessage']) && empty($msgData['textmessage'])) {
COM_errorLog("COM_emailNotification() - Empty message data provided");
return false;
// no text in either...
}
if (!isset($msgData['subject']) || empty($msgData['subject'])) {
COM_errorLog("COM_emailNotification() - No subject provided");
return false;
// must have a subject
}
$queued = 0;
$subject = substr($msgData['subject'], 0, strcspn($msgData['subject'], "\r\n"));
$subject = COM_emailEscape($subject);
require_once $_CONF['path'] . 'lib/phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->SetLanguage('en', $_CONF['path'] . 'lib/phpmailer/language/');
$mail->CharSet = COM_getCharset();
if ($_CONF['mail_backend'] == 'smtp') {
$mail->IsSMTP();
$mail->Host = $_CONF['mail_smtp_host'];
$mail->Port = $_CONF['mail_smtp_port'];
if ($_CONF['mail_smtp_secure'] != 'none') {
$mail->SMTPSecure = $_CONF['mail_smtp_secure'];
}
if ($_CONF['mail_smtp_auth']) {
$mail->SMTPAuth = true;
$mail->Username = $_CONF['mail_smtp_username'];
$mail->Password = $_CONF['mail_smtp_password'];
}
$mail->Mailer = "smtp";
} elseif ($_CONF['mail_backend'] == 'sendmail') {
$mail->Mailer = "sendmail";
$mail->Sendmail = $_CONF['mail_sendmail_path'];
} else {
$mail->Mailer = "mail";
}
$mail->WordWrap = 76;
if (isset($msgData['htmlmessage']) && !empty($msgData['htmlmessage'])) {
$mail->IsHTML(true);
$mail->Body = $msgData['htmlmessage'];
if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
$mail->AltBody = $msgData['textmessage'];
}
} else {
$mail->IsHTML(false);
if (isset($msgData['textmessage']) && !empty($msgData['textmessage'])) {
$mail->Body = $msgData['textmessage'];
}
}
$mail->Subject = $subject;
if (isset($msgData['embeddedImage']) && is_array($msgData['embeddedImage'])) {
foreach ($msgData['embeddedImage'] as $embeddedImage) {
$mail->AddEmbeddedImage($embeddedImage['file'], $embeddedImage['name'], $embeddedImage['filename'], $embeddedImage['encoding'], $embeddedImage['mime']);
}
}
if (is_array($msgData['from'])) {
$mail->From = $msgData['from']['email'];
$mail->FromName = $msgData['from']['name'];
} else {
$mail->From = $msgData['from'];
$mail->FromName = $_CONF['site_name'];
}
$queued = 0;
if (is_array($msgData['to'])) {
foreach ($msgData['to'] as $to) {
if (is_array($to)) {
$mail->AddBCC($to['email'], $to['name']);
} else {
if (COM_isEmail($to)) {
$mail->AddBCC($to);
}
}
$queued++;
if ($queued >= $maxEmailsPerSend) {
if (!$mail->Send()) {
COM_errorLog("Email Error: " . $mail->ErrorInfo);
}
$queued = 0;
$mail->ClearBCCs();
}
}
}
if ($queued > 0) {
if (!@$mail->Send()) {
COM_errorLog("Email Error: " . $mail->ErrorInfo);
}
}
}
示例11: saveuser
//.........这里部分代码省略.........
if (!empty($photo) && strstr($photo, $_USER['username']) !== false) {
$newphoto = preg_replace('/' . $_USER['username'] . '/', $_USER['uid'], $photo, 1);
$imgpath = $_CONF['path_images'] . 'userphotos/';
@rename($imgpath . $photo, $imgpath . $newphoto);
DB_change($_TABLES['users'], 'photo', DB_escapeString($newphoto), "uid", (int) $_USER['uid']);
}
}
DB_change($_TABLES['users'], 'username', $A['new_username'], "uid", (int) $_USER['uid']);
} else {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=51');
}
}
}
// a quick spam check with the unfiltered field contents
$profile = '<h1>' . $LANG04[1] . ' ' . $_USER['username'] . '</h1><p>';
// this is a hack, for some reason remoteservice links made SPAMX SLV check barf
if (empty($service)) {
$profile .= COM_createLink($A['homepage'], $A['homepage']) . '<br />';
}
$profile .= $A['location'] . '<br />' . $A['sig'] . '<br />' . $A['about'] . '<br />' . $A['pgpkey'] . '</p>';
$result = PLG_checkforSpam($profile, $_CONF['spamx']);
if ($result > 0) {
COM_displayMessageAndAbort($result, 'spamx', 403, 'Forbidden');
}
$A['email'] = COM_applyFilter($A['email']);
$A['email_conf'] = COM_applyFilter($A['email_conf']);
$A['homepage'] = COM_applyFilter($A['homepage']);
// basic filtering only
$A['fullname'] = COM_truncate(trim(USER_sanitizeName($A['fullname'])), 80);
$A['location'] = strip_tags($A['location']);
$A['sig'] = strip_tags($A['sig']);
$A['about'] = strip_tags($A['about']);
$A['pgpkey'] = strip_tags($A['pgpkey']);
if (!COM_isEmail($A['email'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=52');
} else {
if ($A['email'] !== $A['email_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=78');
} else {
if (emailAddressExists($A['email'], $_USER['uid'])) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=56');
} else {
if ($service == '') {
if (!empty($A['newp'])) {
$A['newp'] = trim($A['newp']);
$A['newp_conf'] = trim($A['newp_conf']);
if ($A['newp'] == $A['newp_conf'] && SEC_check_hash($A['passwd'], $current_password)) {
$passwd = SEC_encryptPassword($A['newp']);
DB_change($_TABLES['users'], 'passwd', DB_escapeString($passwd), "uid", (int) $_USER['uid']);
if ($A['cooktime'] > 0) {
$cooktime = $A['cooktime'];
$token_ttl = $A['cooktime'];
} else {
$cooktime = 0;
$token_ttl = 14400;
}
$ltToken = SEC_createTokenGeneral('ltc', $token_ttl);
SEC_setCookie($_CONF['cookie_password'], $ltToken, time() + $cooktime);
} elseif (!SEC_check_hash($A['passwd'], $current_password)) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=68');
} elseif ($A['newp'] != $A['newp_conf']) {
return COM_refresh($_CONF['site_url'] . '/usersettings.php?msg=67');
}
}
} else {
// Cookie
示例12: DB_query
DB_query("INSERT INTO {$_TABLES['forum_watch']} (forum_id,topic_id,uid,date_added) VALUES ('{$forum}','{$pid}','{$_USER['uid']}',now() )");
}
if ($_USER['email'] != '' and COM_isEmail($_USER['email'])) {
$display = COM_refresh($_CONF['site_url'] . "/forum/viewtopic.php?msg=2&showtopic={$id}");
} else {
// Invalid or no email address remind user to add one
$display = COM_refresh($_CONF['site_url'] . "/forum/viewtopic.php?msg=12&showtopic={$id}");
}
} else {
$display = COM_refresh($_CONF['site_url'] . "/forum/viewtopic.php?msg=3&showtopic={$id}");
}
} else {
DB_query("INSERT INTO {$_TABLES['forum_watch']} (forum_id,topic_id,uid,date_added) VALUES ('{$forum}','{$pid}','{$_USER['uid']}',now() )");
$nid = -$id;
DB_query("DELETE FROM {$_TABLES['forum_watch']} WHERE uid='{$_USER['uid']}' AND forum_id='{$forum}' AND topic_id = '{$nid}'");
if ($_USER['email'] != '' and COM_isEmail($_USER['email'])) {
$display = COM_refresh($_CONF['site_url'] . "/forum/viewtopic.php?msg=2&showtopic={$id}");
} else {
// Invalid or no email address remind user to add one
$display = COM_refresh($_CONF['site_url'] . "/forum/viewtopic.php?msg=12&showtopic={$id}");
}
}
COM_output($display);
exit;
} elseif ($_REQUEST['submit'] == 'delete' and $id != 0) {
DB_query("DELETE FROM {$_TABLES['forum_watch']} WHERE (id='{$id}')");
$display = COM_refresh($_CONF['site_url'] . "/forum/notify.php?msg=1&filter={$notifytype}");
COM_output($display);
exit;
} elseif ($_REQUEST['submit'] == 'delete2' and $id != '') {
// Check and see if subscribed to complete forum and if so - unsubscribe to just this topic
示例13: gf_chknotifications
function gf_chknotifications($forumid, $topicid, $userid, $type = 'topic')
{
global $_TABLES, $LANG_GF01, $LANG_GF02, $_CONF, $CONF_FORUM;
$pid = DB_getItem($_TABLES['forum_topic'], 'pid', "id='{$topicid}'");
if ($pid == 0) {
$pid = $topicid;
}
$sql = "SELECT * FROM {$_TABLES['forum_watch']} WHERE ((topic_id='{$pid}') OR ((forum_id='{$forumid}') AND (topic_id='0') )) GROUP BY uid";
$sqlresult = DB_query($sql);
$postername = COM_getDisplayName($userid);
$nrows = DB_numRows($sqlresult);
$site_language = unserialize(DB_getItem($_TABLES['conf_values'], 'value', "group_name='Core' AND name='language'"));
// Retrieve original language of site
$mail_language = $_CONF['language'];
$last_mail_language = $mail_language;
$plugin_path = $_CONF['path'] . 'plugins/forum/';
for ($i = 1; $i <= $nrows; $i++) {
$N = DB_fetchArray($sqlresult);
// Don't need to send a notification to the user that posted this message and users with NOTIFY disabled
if ($N['uid'] > 1 and $N['uid'] != $userid and $CONF_FORUM['allow_notification'] == '1') {
// if the topic_id is 0 for this record - user has subscribed to complete forum. Check if they have opted out of this forum topic.
if (DB_count($_TABLES['forum_watch'], array('uid', 'forum_id', 'topic_id'), array($N['uid'], $forumid, -$topicid)) == 0) {
// Check if user does not want to receive multiple notifications for same topic and already has been notified
$userNotifyOnceOption = DB_getItem($_TABLES['forum_userprefs'], 'notify_once', "uid='{$N['uid']}'");
// Retrieve the log record for this user if it exists then check if user has viewed this topic yet
// The logtime value may be 0 which indicates the user has not yet viewed the topic
$lsql = DB_query("SELECT time FROM {$_TABLES['forum_log']} WHERE uid='{$N['uid']}' AND forum='{$forumid}' AND topic='{$topicid}'");
if (DB_numRows($lsql) == 1) {
$nologRecord = false;
list($logtime) = DB_fetchArray($lsql);
} else {
$nologRecord = true;
$logtime = 0;
}
if ($userNotifyOnceOption == 0 or $userNotifyOnceOption == 1 and ($nologRecord or $logtime != 0)) {
$topicrec = DB_query("SELECT subject,name,forum FROM {$_TABLES['forum_topic']} WHERE id='{$pid}'");
$A = DB_fetchArray($topicrec);
$userrec = DB_query("SELECT username,email,language,status FROM {$_TABLES['users']} WHERE uid='{$N['uid']}'");
$B = DB_fetchArray($userrec);
if ($B['status'] == USER_ACCOUNT_ACTIVE) {
// Need to send email in user own language if set, else site default
// Should not use current user language if does not match
if (empty($B['language'])) {
$mail_language = $site_language;
} else {
$mail_language = $B['language'];
}
if ($mail_language != $last_mail_language) {
$langfile = $plugin_path . 'language/' . $mail_language . '.php';
if (file_exists($langfile)) {
require $langfile;
$last_mail_language = $mail_language;
} else {
// Use site default language as backup
$langfile = $plugin_path . 'language/' . $site_language . '.php';
if (file_exists($langfile)) {
require $langfile;
$last_mail_language = $site_language;
} else {
require $plugin_path . 'language/english.php';
$last_mail_language = 'english';
}
}
}
$subjectline = "{$_CONF['site_name']} {$LANG_GF02['msg22']}";
$message = "{$LANG_GF01['HELLO']} {$B['username']},\n\n";
if ($type == 'forum') {
$forum_name = DB_getItem($_TABLES['forum_forums'], forum_name, "forum_id='{$forumid}'");
$message .= sprintf($LANG_GF02['msg23b'], $A['subject'], $A['name'], $forum_name, $_CONF['site_name'], $_CONF['site_url'], $pid);
} else {
$message .= sprintf($LANG_GF02['msg23a'], $A['subject'], $postername, $A['name'], $_CONF['site_name']);
$message .= sprintf($LANG_GF02['msg23c'], $_CONF['site_url'], $pid);
}
$message .= $LANG_GF02['msg26'];
$message .= sprintf($LANG_GF02['msg27'], "{$_CONF['site_url']}/forum/notify.php");
$message .= "{$LANG_GF02['msg25']}{$_CONF['site_name']} {$LANG_GF01['ADMIN']}\n";
// Check and see if Site admin has enabled email notifications
if ($CONF_FORUM['allow_notification']) {
if ($nologRecord and $userNotifyOnceOption == 1) {
DB_query("INSERT INTO {$_TABLES['forum_log']} (uid,forum,topic,time) VALUES ('{$N['uid']}', '{$forumid}', '{$topicid}','0') ");
}
if ($B['email'] != '' and COM_isEmail($B['email'])) {
COM_mail($B['email'], $subjectline, $message);
}
}
}
}
}
}
}
}
示例14: fncSave
function fncSave($mode)
{
global $_CONF;
global $LANG_ASSIST_ADMIN;
global $_TABLES;
$retval = '';
//------------------
$fary = array();
$fary[] = array('name' => 'fromname', 'reserv' => 'fn');
//@@
$fary[] = array('name' => 'replyto', 'reserv' => 'rt');
$fary[] = array('name' => 'sprefix', 'reserv' => 'sp');
$fary[] = array('name' => 'sid', 'reserv' => 'si');
$fary[] = array('name' => 'testto');
$fary[] = array('name' => 'uidfrom', 'reserv' => 'uf');
$fary[] = array('name' => 'uidto', 'reserv' => 'ut');
///@@@@@ 20111220 delete $fary[]=array('name' =>'last_schedule' );
$fary[] = array('name' => 'introbody', 'reserv' => 'ib');
//@@
$fary[] = array('name' => 'overstyr', 'reserv' => 'os');
//@@
$fary[] = array('name' => 'toenv', 'reserv' => 'te');
//@@
$fary[] = array('name' => 'selectgroup', 'reserv' => 'sg');
//@@
$fary[] = array('name' => 'bulkmm', 'reserv' => 'bm');
//@@
$fary[] = array('name' => 'bulkcnt', 'reserv' => 'bc');
//@@
//------------------
// clean 'em up
$fromname = COM_applyFilter($_POST['fromname']);
$fromname = addslashes(COM_checkHTML(COM_checkWords($fromname)));
$replyto = COM_applyFilter($_POST['replyto']);
$replyto = addslashes(COM_checkHTML(COM_checkWords($replyto)));
//--
$sprefix = COM_applyFilter($_POST['sprefix']);
$sprefix = addslashes(COM_checkHTML(COM_checkWords($sprefix)));
$sid = COM_applyFilter($_POST['sid']);
$sid = addslashes(COM_checkHTML(COM_checkWords($sid)));
$testto = COM_applyFilter($_POST['testto']);
$testto = addslashes(COM_checkHTML(COM_checkWords($testto)));
$uidfrom = COM_applyFilter($_POST['uidfrom'], true);
$uidfrom = addslashes(COM_checkHTML(COM_checkWords($uidfrom)));
$uidto = COM_applyFilter($_POST['uidto'], true);
$uidto = addslashes(COM_checkHTML(COM_checkWords($uidto)));
// hiroron start 2010/07/13
$dt_year = COM_applyFilter($_POST['datetime_year'], true);
$dt_month = COM_applyFilter($_POST['datetime_month'], true);
$dt_day = COM_applyFilter($_POST['datetime_day'], true);
$dt_hour = COM_applyFilter($_POST['datetime_hour'], true);
$dt_minute = COM_applyFilter($_POST['datetime_minute'], true);
// hiroron end 2010/07/13
$dt = COM_convertDate2Timestamp($dt_year . '-' . $dt_month . '-' . $dt_day, $dt_hour . ':' . $dt_minute . ':00');
$uidto = COM_applyFilter($_POST['uidto'], true);
$uidto = addslashes(COM_checkHTML(COM_checkWords($uidto)));
// 冒頭文 本文 introbody
$introbody = COM_applyFilter($_POST['introbody'], true);
$introbody = addslashes(COM_checkHTML(COM_checkWords($introbody)));
// ユーザの受信許可設定を無視して送る
$overstyr = COM_applyFilter($_POST['overstyr'], true);
$overstyr = addslashes(COM_checkHTML(COM_checkWords($overstyr)));
//送信先環境
$toenv = COM_applyFilter($_POST['toenv'], true);
$toenv = addslashes(COM_checkHTML(COM_checkWords($toenv)));
//送信先グループ
$selectgroup = COM_applyFilter($_POST['selectgroup'], true);
$selectgroup = addslashes(COM_checkHTML(COM_checkWords($selectgroup)));
//一括予約
$bulkmm = COM_applyFilter($_POST['bulkmm'], true);
$bulkmm = addslashes(COM_checkHTML(COM_checkWords($bulkmm)));
$bulkcnt = COM_applyFilter($_POST['bulkcnt'], true);
$bulkcnt = addslashes(COM_checkHTML(COM_checkWords($bulkcnt)));
// CHECK はじめ
$err = "";
//差出人必須
if (empty($fromname)) {
$err .= $LANG_ASSIST_ADMIN['err_fromname'] . "<br/>" . LB;
}
if (COM_isEmail($replyto) == false) {
$err .= $LANG_ASSIST_ADMIN['err_replyto'] . "<br/>" . LB;
}
//差出人必須
// hiroron start 2010/07/13
// if ($mode==="test" OR $mode==="send"){
if ($mode === "test" or $mode === "send" or $mode === "reserv") {
// hiroron end 2010/07/13
if ($sid == "") {
$err .= $LANG_ASSIST_ADMIN['err_sid'] . "<br/>" . LB;
}
}
//test 送信先
if ($mode === "test") {
if ($test === "") {
$err .= $LANG_ASSIST_ADMIN['err_testto'] . "<br/>" . LB;
}
}
if ($testto != "") {
if (COM_isEmail($testto) == false) {
$err .= $LANG_ASSIST_ADMIN['err_testto'] . "<br/>" . LB;
//.........这里部分代码省略.........
示例15: importusers
/**
* This function allows the administrator to import batches of users
*
* TODO: This function should first display the users that are to be imported,
* together with the invalid users and the reason of invalidity. Each valid line
* should have a checkbox that allows selection of final to be imported users.
* After clicking an extra button, the actual import should take place. This will
* prevent problems in case the list formatting is incorrect.
*
* @return string HTML with success or error message
*
*/
function importusers()
{
global $_CONF, $_TABLES, $LANG04, $LANG28;
// Setting this to true will cause import to print processing status to
// webpage and to the error.log file
$verbose_import = true;
$retval = '';
// Bulk import implies admin authorisation:
$_CONF['usersubmission'] = 0;
// First, upload the file
require_once $_CONF['path_system'] . 'classes/upload.class.php';
$upload = new upload();
$upload->setPath($_CONF['path_data']);
$upload->setAllowedMimeTypes(array('text/plain' => '.txt'));
$upload->setFileNames('user_import_file.txt');
if ($upload->uploadFiles()) {
// Good, file got uploaded, now install everything
$thefile = current($_FILES);
$filename = $_CONF['path_data'] . 'user_import_file.txt';
if (!file_exists($filename)) {
// empty upload form
$retval = COM_refresh($_CONF['site_admin_url'] . '/user.php?mode=importform');
return $retval;
}
} else {
// A problem occurred, print debug information
$retval = COM_showMessageText($upload->printErrors(false), $LANG28[24]);
$retval = COM_createHTMLDocument($retval, array('pagetitle' => $LANG28[22]));
return $retval;
}
$users = file($filename);
$retval .= COM_startBlock($LANG28[31], '', COM_getBlockTemplate('_admin_block', 'header'));
// Following variables track import processing statistics
$successes = 0;
$failures = 0;
foreach ($users as $line) {
$line = rtrim($line);
if (empty($line)) {
continue;
}
list($full_name, $u_name, $email) = explode("\t", $line);
$full_name = strip_tags($full_name);
$u_name = COM_applyFilter($u_name);
$email = COM_applyFilter($email);
if ($verbose_import) {
$retval .= "<br" . XHTML . "><b>Working on username={$u_name}, fullname={$full_name}, and email={$email}</b><br" . XHTML . ">\n";
COM_errorLog("Working on username={$u_name}, fullname={$full_name}, and email={$email}", 1);
}
// prepare for database
$userName = trim($u_name);
$fullName = trim($full_name);
$emailAddr = trim($email);
if (COM_isEmail($email)) {
// email is valid form
$ucount = DB_count($_TABLES['users'], 'username', DB_escapeString($userName));
$ecount = DB_count($_TABLES['users'], 'email', DB_escapeString($emailAddr));
if ($ucount == 0 && $ecount == 0) {
// user doesn't already exist - pass in optional true for $batchimport parm
$uid = USER_createAccount($userName, $emailAddr, '', $fullName, '', '', '', true);
$result = USER_createAndSendPassword($userName, $emailAddr, $uid);
if ($result) {
$successes++;
if ($verbose_import) {
$retval .= "<br" . XHTML . "> Account for <b>{$u_name}</b> created successfully.<br" . XHTML . ">\n";
COM_errorLog("Account for {$u_name} created successfully", 1);
}
} else {
// user creation failed
$retval .= "<br" . XHTML . ">ERROR: There was a problem creating the account for <b>{$u_name}</b>.<br" . XHTML . ">\n";
COM_errorLog("ERROR: here was a problem creating the account for {$u_name}.", 1);
}
} else {
if ($verbose_import) {
$retval .= "<br" . XHTML . "><b>{$u_name}</b> or <b>{$email}</b> already exists, account not created.<br" . XHTML . ">\n";
// user already exists
COM_errorLog("{$u_name},{$email}: username or email already exists, account not created", 1);
}
$failures++;
}
// end if $ucount == 0 && ecount == 0
} else {
if ($verbose_import) {
$retval .= "<br" . XHTML . "><b>{$email}</b> is not a valid email address, account not created<br" . XHTML . ">\n";
// malformed email
COM_errorLog("{$email} is not a valid email address, account not created", 1);
}
$failures++;
}
//.........这里部分代码省略.........