Пример #1
0
 /**
  * Send newsletter via the Mlmmj mailing list
  *
  * @param string $email
  * @return bool
  */
 function send($email)
 {
     //send content to mailing list
     $mailer = getMailer();
     /* @var $mailer XoopsMailer */
     $mailer->useMail();
     $mailer->setBody($this->body);
     $mailer->setFromEmail($this->fromEmail);
     $mailer->setFromName($this->fromName);
     if (count($this->headers) > 0) {
         foreach ($this->headers as $header) {
             $mailer->addHeaders($header);
         }
     }
     $mailer->setSubject($this->subject);
     $mailer->multimailer->isHTML(true);
     //$this->addAttachments($mailer);
     //Send to specified email
     $mailer->setToEmails($email);
     if (!$mailer->send(true)) {
         echo $mailer->getErrors();
         return false;
     }
     return true;
 }
Пример #2
0
function sendComment()
{
    global $xoopsUser, $xoopsModule, $xoopsModuleConfig, $mc, $xoopsConfig;
    $util =& RMUtils::getInstance();
    if (!$util->validateToken()) {
        redirect_header('comment.php', 2, _MS_TC_ERRID);
        die;
    }
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if ($name == '' || $email == '' || $comment == '') {
        redirect_header('comment.php', 2, _MS_TC_ERRFIELDS);
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplate('mail.tpl');
    $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
    $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
    $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
    $xoopsMailer->assign('NAME', $name);
    $xoopsMailer->assign('EMAIL', $email);
    $xoopsMailer->assign('COMMENTS', $comment);
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/team/language/" . $xoopsConfig['language'] . "/");
    $xoopsMailer->setFromEmail($email);
    $xoopsMailer->setFromName($name);
    $xoopsMailer->setSubject(sprintf(_MS_TC_COMFROM, $xoopsConfig['sitename'] . ": " . $xoopsModule->name()));
    $xoopsMailer->setToEmails($xoopsModuleConfig['email']);
    if (!$xoopsMailer->send(true)) {
        redirect_header('comment.php', 2, $xoopsMailer->getErrors());
    } else {
        redirect_header('./', 1, _MS_TC_COMTHX);
    }
}
Пример #3
0
 /**
  * Send newsletter via the SmartMail Mail Sender Service Interface
  *
  * @param array $recipients
  * @return bool
  */
 function send($recipients)
 {
     $output = $this->getXML($recipients);
     // Debug data - will be removed
     $filename = XOOPS_UPLOAD_PATH . "/mailtest.xml";
     $fp = fopen($filename, "w");
     fwrite($fp, $output);
     //send content to mailing list
     $mailer = getMailer();
     /* @var $mailer XoopsMailer */
     $mailer->useMail();
     $mailer->setBody($output);
     $mailer->setFromEmail($this->fromEmail);
     $mailer->setFromName($this->fromName);
     if (count($this->headers) > 0) {
         foreach ($this->headers as $header) {
             $mailer->addHeaders($header);
         }
     }
     $mailer->setSubject($this->subject);
     $mailer->multimailer->isHTML(true);
     //Send to specified email
     $mailer->setToEmails($this->email);
     if (!$mailer->send(true)) {
         echo $mailer->getErrors();
         return false;
     }
     return true;
 }
Пример #4
0
 public function testServices()
 {
     $ins = getAuth();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Auth\IAuth::class, $ins);
     $ins = getView();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\IView::class, $ins);
     $ins = getLog();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Log\ILog::class, $ins);
     //        $ins = getDB();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\MedooDB::class, $ins);
     //        $ins = getRedis();
     //        $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Database\PRedis::class, $ins);
     //        $ins = getDataPool();
     //        $this->assertInstanceOf(\Wwtg99\DataPool\Common\IDataPool::class, $ins);
     $ins = getCache();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\Cache::class, $ins);
     $ins = getSession();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\SessionUtil::class, $ins);
     $ins = getCookie();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\CookieUtil::class, $ins);
     $ins = getOValue();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Storage\OldValue::class, $ins);
     $ins = getAssets();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\View\AssetsManager::class, $ins);
     $ins = getMailer();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Mail::class, $ins);
     $ins = Flight::Express();
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Utils\Express::class, $ins);
     $ins = getPlugin('php');
     $this->assertInstanceOf(\Wwtg99\Flight2wwu\Component\Plugin\IPlugin::class, $ins);
 }
function ccenter_com_approve(&$comment)
{
    global $xoopsDB, $xoopsUser, $xoopsModule, $xoopsConfig;
    $msgid = $comment->getVar('com_itemid');
    $res = $xoopsDB->query("SELECT uid, touid, email, onepass, fidref, title, status FROM " . CCMES . ", " . FORMS . " WHERE msgid={$msgid} AND formid=fidref");
    $comid = $comment->getVar('com_id');
    if ($res && $xoopsDB->getRowsNum($res)) {
        $data = $xoopsDB->fetchArray($res);
        $email = $data['email'];
        $s = $data['status'];
        $uid = is_object($xoopsUser) ? $xoopsUser->getVar('uid') : 0;
        $msg = _CC_LOG_COMMENT;
        $status = '';
        // new status
        $now = time();
        $values = array('mtime=' . $now);
        if ($uid && $uid == $data['touid']) {
            // comment by charge
            // status to replyed
            if ($s == _STATUS_ACCEPT) {
                $status = _STATUS_REPLY;
            }
            $msg .= _CC_LOG_BYCHARGE;
        } elseif ($uid == 0 || $uid == $data['uid']) {
            // comment by order person
            // status back to contacting
            if ($s == _STATUS_REPLY || $s == _STATUS_CLOSE) {
                $status = _STATUS_ACCEPT;
            }
            $values[] = 'atime=' . $now;
        }
        if ($status && $status != $s) {
            global $msg_status;
            $msg .= "\n" . sprintf(_CC_LOG_STATUS, $msg_status[$s], $msg_status[$status]);
            $values[] = 'status=' . $xoopsDB->quoteString($status);
        }
        $xoopsDB->query("UPDATE " . CCMES . " SET " . join(',', $values) . " WHERE msgid={$msgid}");
        cc_log_message($data['fidref'], $msg . " (comid={$comid})", $msgid);
        // notification for guest contact
        if (is_object($xoopsUser) && $data['uid'] == 0 && $email) {
            $subj = $data['title'];
            $url = XOOPS_URL . "/modules/" . basename(dirname(__FILE__)) . "/message.php?id={$msgid}&p=" . urlencode($data['onepass']) . "#comment{$comid}";
            $tags = array('X_MODULE' => $xoopsModule->getVar('name'), 'X_ITEM_TYPE' => '', 'X_ITEM_NAME' => $subj, 'X_COMMENT_URL' => $url, 'FROM_EMAIL' => $email, 'SUBJECT' => $subj);
            $xoopsMailer =& getMailer();
            $xoopsMailer->useMail();
            $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
            $xoopsMailer->setFromName($xoopsModule->getVar('name'));
            $xoopsMailer->setSubject(_MD_NOTIFY_SUBJ);
            $xoopsMailer->assign($tags);
            $tpl = 'guest_notify.tpl';
            $xoopsMailer->setTemplateDir(template_dir($tpl));
            $xoopsMailer->setTemplate($tpl);
            $xoopsMailer->setToEmails($email);
            $xoopsMailer->send();
        }
    }
}
Пример #6
0
function addEmail($email)
{
    if ($email != "") {
        // Add Mailerspecific link
        $result = "<a href=" . '"' . getMailer() . $email . '"' . ">" . $email . "</a>";
        // Add a link to the guess homepage
        $homepage = guessOneHomepage($email);
        if (!isset($_GET["print"]) && $homepage != "") {
            $result .= " (<a href=" . '"http://' . $homepage . '" target="_new"' . ">" . $homepage . "</a>)";
        }
        return add($result);
    } else {
        return "";
    }
}
Пример #7
0
function send_mail($s, $valid)
{
    global $tpl;
    $tpl->assign('user', $s);
    if (isset($_POST["send"])) {
        $mail = getMailer();
        $mail->AddAddress($s->user_email);
        $mail->Subject = '[intra LATEB] ' . $_POST['title'];
        $mail->Body = $tpl->fetch('mail_send.tpl');
        if ($mail->Send() == false) {
            $valid[] = $s->user_email;
        }
    }
    return $valid;
}
Пример #8
0
function main()
{
    global $session;
    global $db_connect_info;
    global $http_user_email;
    if ($session->started()) {
        navigateTo(HREF_MAIN);
    }
    $http_user_email = trim($_POST['user-email']);
    // 입력 값의 유효성을 검증한다.
    if (empty($http_user_email)) {
        return array('result' => true, 'message' => '');
    }
    // 이메일 포멧의 유효성을 검증한다.
    if (!filter_var($http_user_email, FILTER_VALIDATE_EMAIL)) {
        return array('result' => false, 'message' => '이메일 주소가 올바르지 않습니다');
    }
    // reCAPTCHA를 검증한다.
    if (!getReCaptcha()) {
        return array('result' => false, 'message' => 'reCAPTCHA가 올바르게 입력되지 않았습니다');
    }
    $db = new YwDatabase($db_connect_info);
    // 데이터베이스 연결을 체크한다.
    if (!$db->connect()) {
        return array('result' => false, 'message' => '서버와의 연결에 실패했습니다');
    }
    // 아이디와 이메일 유효성을 검증한다.
    if (!$db->query("SELECT `name` FROM " . USER_TABLE . " WHERE `email`='" . $db->purify($http_user_email) . "';")) {
        return array('result' => false, 'message' => '이메일 주소를 조회하는데 실패했습니다');
    }
    if ($db->total_results() < 1) {
        return array('result' => false, 'message' => '존재하지 않는 이메일 주소입니다');
    }
    $result = $db->get_result();
    $user_name = $result['name'];
    // 새로운 비밀번호를 생성한다.
    $generated_password = bin2hex(openssl_random_pseudo_bytes(6));
    if (!$db->query("UPDATE " . USER_TABLE . " SET `password`='" . passwordHash($generated_password) . "' WHERE `email`='" . $db->purify($http_user_email) . "';")) {
        return array('result' => false, 'message' => '비밀번호를 업데이트하는데 실패했습니다');
    }
    $email_content = "<b>" . $user_name . "</b> 회원님의 새 비밀번호는 <b>" . $generated_password . "</b>입니다.";
    if (!getMailer($http_user_email, "연세위키 비밀번호를 알려드립니다", $email_content)) {
        return array('result' => false, 'message' => '이메일 발송에 실패했습니다');
    }
    $db->log($user_name, LOG_RESET, '1');
    $db->close();
    return array('result' => true, 'message' => '이메일로 아이디와 새로운 비밀번호를 전송했습니다');
}
Пример #9
0
function send_message()
{
    global $xoopsModule, $xoopsModuleConfig, $xoopsUser;
    $name = rmc_server_var($_POST, 'name', '');
    $email = rmc_server_var($_POST, 'email', '');
    $company = rmc_server_var($_POST, 'company', '');
    $phone = rmc_server_var($_POST, 'phone', '');
    $subject = rmc_server_var($_POST, 'subject', '');
    $message = rmc_server_var($_POST, 'message', '');
    if ($name == '' || $email == '' || !checkEmail($email) || $subject == '' || $message == '') {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please fill all required fileds before to send this message!', 'contact'));
        die;
    }
    // Recaptcha check
    if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Please check the security words and write it correctly!', 'contact'));
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setBody($message . "\n--------------\n" . __('Message sent with ContactMe!', 'contact') . "\n" . $xoopsModuleConfig['url']);
    $xoopsMailer->setToEmails($xoopsModuleConfig['mail']);
    $xoopsMailer->setFromEmail($email);
    $xoopsMailer->setFromName($name);
    $xoopsMailer->setSubject($subject);
    if (!$xoopsMailer->send(true)) {
        redirect_header($xoopsModuleConfig['url'], 1, __('Message could not be delivered. Please try again.', 'contact'));
        die;
    }
    // Save message on database for further use
    $msg = new CTMessage();
    $msg->setVar('subject', $subject);
    $msg->setVar('ip', $_SERVER['REMOTE_ADDR']);
    $msg->setVar('email', $email);
    $msg->setVar('name', $name);
    $msg->setVar('org', $company);
    $msg->setVar('body', $message);
    $msg->setVar('phone', $phone);
    $msg->setVar('register', $xoopsUser ? 1 : 0);
    if ($xoopsUser) {
        $msg->setVar('xuid', $xoopsUser->uid());
    }
    $msg->setVar('date', time());
    $msg->save();
    redirect_header(XOOPS_URL, 1, __('Your message has been sent successfully!', 'contact'));
}
Пример #10
0
 function execute(&$controller, &$xoopsUser)
 {
     $this->mActionForm->fetch();
     $this->mActionForm->validate();
     if ($this->mActionForm->hasError()) {
         return LEGACY_FRAME_VIEW_INPUT;
     }
     $root =& XCube_Root::getSingleton();
     $this->mMailer =& getMailer();
     $this->mMailer->setTemplate("tellfriend.tpl");
     $this->mMailer->assign("SITENAME", $root->mContext->getXoopsConfig('sitename'));
     $this->mMailer->assign("ADMINMAIL", $root->mContext->getXoopsConfig('adminmail'));
     $this->mMailer->assign("SITEURL", XOOPS_URL . '/');
     $this->mActionForm->update($this->mMailer);
     $root->mLanguageManager->loadPageTypeMessageCatalog("misc");
     $this->mMailer->setSubject(sprintf(_MSC_INTSITE, $root->mContext->getXoopsConfig('sitename')));
     return $this->mMailer->send() ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
 }
Пример #11
0
function tellafriend_sendMail($tMail, $bSenMail = true, $numError = 0)
{
    global $xoopsDB, $xoopsModuleConfig;
    $formatDate = 'Y-m-d H:i:s';
    $tMail['new_date'] = date($formatDate);
    //---------------------------------------------------
    if ($bSenMail) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($tMail['users_to']);
        $xoopsMailer->setFromEmail($tMail['users_email']);
        $xoopsMailer->setFromName($tMail['users_name']);
        $xoopsMailer->setSubject($tMail['users_subject']);
        $xoopsMailer->setBody($tMail['message_body']);
        $send_result = $xoopsMailer->send();
        if ($send_result) {
            $tMail['result'] = _MI_TAF_MESSAGESENT;
        } else {
            $tMail['result'] = _MI_TAF_SENDERROR;
        }
    } else {
        switch ($numError) {
            case 1:
                $tMail['result'] = _MI_TAF_INVALIDMAILFROM;
                break;
            case 2:
                $tMail['result'] = _MI_TAF_INVALIDMAILTO;
                break;
            case 3:
                $tMail['result'] = _MI_TAF_TOOMANY;
                break;
            default:
                break;
        }
    }
    //---------------------------------------------------
    if ($send_result || $xoopsModuleConfig['log_send_in_echec']) {
        $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix("tellafriend_log") . " SET " . "uid='{$tMail['uid']}'," . "ip='{$tMail['REMOTE_ADDR']}'," . "mail_fromname='" . addslashes($tMail['users_name']) . "'," . "mail_fromemail='" . addslashes($tMail['users_email']) . "'," . "mail_to='" . addslashes($tMail['users_to']) . "'," . "mail_subject='" . addslashes($tMail['users_subject']) . "'," . "mail_body='" . addslashes($tMail['message_body']) . "'," . "agent='" . addslashes($tMail['HTTP_USER_AGENT']) . "'," . "result='" . addslashes($tMail['result']) . "'," . "date_send='{$tMail['new_date']}'");
    }
    //---------------------------------------------------
    return $tMail['result'];
}
Пример #12
0
function user_notify($eid)
{
    global $xoopsDB, $xoopsConfig;
    $result = $xoopsDB->query("SELECT title,edate,expire,status,topicid FROM " . EGTBL . " WHERE eid={$eid}");
    if (!$result || $xoopsDB->getRowsNum($result) == 0) {
        echo "<div class='error'>Not found Event(eid='{$eid}')</div>\n";
        return;
    }
    $data = $xoopsDB->fetchArray($result);
    $title = $data['title'];
    $edate = $data['edate'];
    $expire = $data['expire'];
    // using XOOPS2 notification system
    if (!$GLOBALS['xoopsModuleConfig']['user_notify'] || ($expire > $edate ? $expire < time() : $edate + $expire < time()) || $data['status'] != STAT_NORMAL) {
        return false;
    }
    $tags = array('EVENT_TITLE' => $title, 'EVENT_DATE' => eventdate($edate, _MD_TIME_FMT), 'EVENT_NOTE' => '', 'EVENT_URL' => EGUIDE_URL . "/event.php?eid={$eid}");
    $notification_handler =& xoops_gethandler('notification');
    $notification_handler->triggerEvent('global', 0, 'new', $tags);
    $notification_handler->triggerEvent('category', $data['topicid'], 'new', $tags);
    $result = $xoopsDB->query("SELECT rvid, email, confirm FROM " . RVTBL . " WHERE eid=0");
    while ($data = $xoopsDB->fetchArray($result)) {
        $xoopsMailer =& getMailer();
        $xoopsMailer->useMail();
        $xoopsMailer->setSubject(_MD_NEWSUB);
        $tpl = 'notify_user_new.tpl';
        $xoopsMailer->setTemplateDir(template_dir($tpl));
        $xoopsMailer->setTemplate($tpl);
        $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
        $xoopsMailer->setFromName(eguide_from_name());
        $xoopsMailer->assign($tags);
        $xoopsMailer->assign("CANCEL_URL", EGUIDE_URL . "/reserv.php?op=cancel&rvid=" . $data['rvid'] . "&key=" . $data['confirm']);
        $xoopsMailer->setToEmails($data['email']);
        if (!$xoopsMailer->send()) {
            echo "<div class='error'>" . $xoopsMailer->getErrors() . "</div>\n";
        }
    }
}
Пример #13
0
 /**
  * Send a notification message to the user
  *
  * @param  string  $template_dir  Template directory
  * @param  string  $template      Template name
  * @param  string  $subject       Subject line for notification message
  * @param  array   $tags Array of substitutions for template variables
  *
  * @return  bool	true if success, false if error
  **/
 function notifyUser($template_dir, $template, $subject, $tags)
 {
     // Check the user's notification preference.
     $member_handler = xoops_gethandler('member');
     $user =& $member_handler->getUser($this->getVar('not_uid'));
     if (!is_object($user)) {
         return true;
     }
     $method = $user->getVar('notify_method');
     $xoopsMailer =& getMailer();
     include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
     switch ($method) {
         case XOOPS_NOTIFICATION_METHOD_PM:
             $xoopsMailer->usePM();
             $config_handler = xoops_gethandler('config');
             $xoopsMailerConfig =& $config_handler->getConfigsByCat(XOOPS_CONF_MAILER);
             $xoopsMailer->setFromUser($member_handler->getUser($xoopsMailerConfig['fromuid']));
             foreach ($tags as $k => $v) {
                 $xoopsMailer->assign($k, $v);
             }
             break;
         case XOOPS_NOTIFICATION_METHOD_EMAIL:
             $xoopsMailer->useMail();
             foreach ($tags as $k => $v) {
                 $xoopsMailer->assign($k, preg_replace("/&amp;/i", '&', $v));
             }
             break;
         default:
             return true;
             // report error in user's profile??
             break;
     }
     // Set up the mailer
     $xoopsMailer->setTemplateDir($template_dir);
     $xoopsMailer->setTemplate($template);
     $xoopsMailer->setToUsers($user);
     //global $xoopsConfig;
     //$xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     //$xoopsMailer->setFromName($xoopsConfig['sitename']);
     $xoopsMailer->setSubject($subject);
     $success = $xoopsMailer->send();
     // If send-once-then-delete, delete notification
     // If send-once-then-wait, disable notification
     include_once XOOPS_ROOT_PATH . '/include/notification_constants.php';
     $notification_handler = xoops_gethandler('notification');
     if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENDELETE) {
         $notification_handler->delete($this);
         return $success;
     }
     if ($this->getVar('not_mode') == XOOPS_NOTIFICATION_MODE_SENDONCETHENWAIT) {
         $this->setVar('not_mode', XOOPS_NOTIFICATION_MODE_WAITFORLOGIN);
         $notification_handler->insert($this);
     }
     return $success;
 }
 function sendMail()
 {
     $mail_body = $this->makeMailBody();
     $cc_mail_body = $this->makeCCMailBody();
     $subject = $this->makeMailSubject();
     $cc_subject = $this->makeCCMailSubject();
     // easiestml
     if (function_exists('easiestml')) {
         $mail_body = easiestml($mail_body);
         $cc_mail_body = easiestml($cc_mail_body);
         $subject = easiestml($subject);
         $cc_subject = easiestml($cc_subject);
     }
     // send main mail (server to admin/poster)
     if (!empty($this->toEmails)) {
         // initialize
         $toMailer =& getMailer();
         $toMailer->useMail();
         $toMailer->setFromEmail($this->fromEmail);
         $toMailer->setFromName($this->fromName);
         // "from" overridden by form data
         if (!empty($this->from_field_name) && $this->isValidEmail($this->form_processor->fields[$this->from_field_name]['value'])) {
             $toMailer->setFromEmail($this->form_processor->fields[$this->from_field_name]['value']);
             if (!empty($this->fromname_field_name) && !empty($this->form_processor->fields[$this->fromname_field_name]['value'])) {
                 // remove cr, lf, null
                 $toMailer->setFromName(str_replace(array("\n", "\r", ""), '', $this->form_processor->fields[$this->fromname_field_name]['value']));
             }
         }
         // "Reply-To" header
         if (!empty($this->replyto_field_name) && $this->isValidEmail($this->form_processor->fields[$this->replyto_field_name]['value'])) {
             $toMailer->addHeaders('Reply-To: ' . $this->form_processor->fields[$this->replyto_field_name]['value']);
         }
         $toMailer->setToEmails(array_unique($this->toEmails));
         $toMailer->setSubject($subject);
         $toMailer->setBody($mail_body);
         $toMailer->send();
     }
     // send confirming mail (server to visitor)
     if (!empty($this->cc_field_name) && !empty($this->form_processor->fields[$this->cc_field_name]['value'])) {
         // initialize
         $ccMailer =& getMailer();
         $ccMailer->useMail();
         $ccMailer->setFromEmail($this->fromEmail);
         $ccMailer->setFromName($this->fromName);
         $ccMailer->setToEmails($this->form_processor->fields[$this->cc_field_name]['value']);
         $ccMailer->setSubject($cc_subject);
         $ccMailer->setBody($cc_mail_body);
         $ccMailer->send();
     }
 }
Пример #15
0
function order_notify($data, $email, $value)
{
    global $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $poster = new XoopsUser($data['uid']);
    $eid = $data['eid'];
    $exid = $data['exid'];
    $url = EGUIDE_URL . '/event.php?eid=' . $eid . ($exid ? "&sub={$exid}" : '');
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $tplname = $data['autoaccept'] ? "accept%s.tpl" : "order%s.tpl";
    $extra = eguide_form_options('reply_extension');
    $tplfile = sprintf($tplname, '');
    // default template name
    $tmpdir = template_dir($tplfile);
    if ($extra) {
        $vals = unserialize_text($value);
        if (isset($vals[$extra])) {
            $extpl = sprintf($tplname, $vals[$extra]);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    } else {
        $extra = eguide_form_options('reply_tpl_suffix');
        if ($extra) {
            $extpl = sprintf($tplname, $extra);
            if (file_exists("{$tmpdir}{$extpl}")) {
                $tplfile = $extpl;
            }
        }
    }
    $xoopsMailer->setTemplateDir($tmpdir);
    $xoopsMailer->setTemplate($tplfile);
    if ($xoopsModuleConfig['member_only'] && is_object($xoopsUser)) {
        $user = $xoopsUser;
        if (isset($data['reserv_uid'])) {
            $ruid = $data['reserv_uid'];
            $user = new XoopsUser($ruid);
        } else {
            $xoopsMailer->setToUsers($user);
        }
        $uinfo = sprintf("%s: %s (%s)\n", _MD_UNAME, $user->getVar('uname'), $user->getVar('name'));
    } else {
        if (!empty($email)) {
            $xoopsMailer->setToEmails($email);
        }
        $uinfo = "";
    }
    if ($email) {
        $uinfo .= sprintf("%s: %s\n", _MD_EMAIL, $email);
    }
    $rvid = $data['rvid'];
    $conf = $data['confirm'];
    $edate = eventdate($data['edate']);
    $tags = array("EVENT_URL" => $url, "RVID" => $rvid, "CANCEL_KEY" => $conf, "CANCEL_URL" => EGUIDE_URL . "/reserv.php?op=cancel&rvid={$rvid}&key={$conf}", "INFO" => $uinfo . $value, "TITLE" => $edate . " " . $data['title'], "EVENT_DATE" => $edate, "EVENT_TITLE" => $data['title'], "SUMMARY" => strip_tags($data['summary']));
    $subj = eguide_form_options('reply_subject', _MD_SUBJECT);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    $ret = $xoopsMailer->send();
    // send to order person
    if (!$ret) {
        return $ret;
    }
    $xoopsMailer->reset();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplateDir(template_dir($tplfile));
    $xoopsMailer->setTemplate($tplfile);
    $xoopsMailer->assign($tags);
    $xoopsMailer->setSubject($subj);
    $xoopsMailer->setFromEmail($poster->getVar('email'));
    $xoopsMailer->setFromName(eguide_from_name());
    if ($data['notify']) {
        if (!in_array($xoopsModuleConfig['notify_group'], $poster->groups())) {
            $xoopsMailer->setToUsers($poster);
        }
        $member_handler =& xoops_gethandler('member');
        $notify_group = $member_handler->getGroup($xoopsModuleConfig['notify_group']);
        $xoopsMailer->setToGroups($notify_group);
        $xoopsMailer->send();
    }
    return $ret;
}
Пример #16
0
         $sql = "SELECT email, userid FROM users WHERE userid = (SELECT userid FROM experiments WHERE id = :id)";
         $req = $pdo->prepare($sql);
         $req->bindParam(':id', $id);
         $req->execute();
         $users = $req->fetch();
         // don't send an email if we are commenting on our own XP
         if ($users['userid'] === $_SESSION['userid']) {
             exit;
         }
         // Create the message
         $url = 'https://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['PHP_SELF'];
         $url = str_replace('app/editinplace.php', 'experiments.php', $url);
         $full_url = $url . "?mode=view&id=" . $id;
         $footer = "\n\n~~~\nSent from eLabFTW http://www.elabftw.net\n";
         $message = Swift_Message::newInstance()->setSubject(_('[eLabFTW] New comment posted'))->setFrom(array(get_config('mail_from') => 'eLabFTW'))->setTo(array($users['email'] => 'Admin eLabFTW'))->setBody(sprintf(_('Hi. %s %s left a comment on your experiment. Have a look: %s'), $commenter['firstname'], $commenter['lastname'], $full_url) . $footer);
         $mailer = getMailer();
         // SEND EMAIL
         try {
             $mailer->send($message);
         } catch (Exception $e) {
             dblog('Error', 'smtp', $e->getMessage());
             exit;
         }
     }
 } else {
     // UPDATE OF EXISTING COMMENT
     if ($id_arr[0] === 'expcomment' && is_pos_int($id_arr[1])) {
         $id = $id_arr[1];
         // Update comment
         if ($_POST['expcomment'] != '' && $_POST['expcomment'] != ' ') {
             // we must first check
Пример #17
0
function index_password()
{
    global $tpl, $config;
    $cfg = $config['recaptcha'];
    $tpl->assign('siteKey', $cfg['siteKey']);
    if (isset($_POST['valider'])) {
        if (isset($_POST['g-recaptcha-response'])) {
            $captcha = $_POST['g-recaptcha-response'];
        }
        $cfg = $config['recaptcha'];
        $secretKey = $cfg['secretKey'];
        if ($secretKey) {
            if (!$captcha) {
                $tpl->assign('msg', 'Erreur de captcha, veuillez resaisir les informations.');
                $tpl->assign('error_captcha', true);
                display();
                return;
            }
            $ip = $_SERVER['REMOTE_ADDR'];
            $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $captcha . "&remoteip=" . $ip);
            $responseKeys = json_decode($response, true);
            if (intval($responseKeys["success"]) !== 1) {
                $tpl->assign('msg', 'Erreur de captcha, veuillez resaisir les informations.');
                $tpl->assign('error_captcha', true);
                display();
                return;
            }
        }
        // Recherche du membre
        $mdl = new Modele('users');
        $mdl->find(array('user_email' => $_POST['mail']));
        if (!$mdl->next()) {
            $tpl->assign('msg', 'L\'adresse email est introuvable');
            $tpl->assign('error_mail', true);
            // Membre existe
        } else {
            $_SESSION['index_password_code'] = uniqid();
            $_SESSION['index_password_email'] = $_POST['mail'];
            $schema = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http';
            $tpl->assign('url', $schema . '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . mkurl('index', 'password_change', array(session_name() => session_id(), 'valid' => $_SESSION['index_password_code'])));
            $mail = getMailer();
            $mail->AddAddress($_SESSION['index_password_email']);
            $mail->Subject = '[intra LATEB] mot de passe perdu';
            $mail->Body = $tpl->fetch('mail_password.tpl');
            $tpl->assign('msuccess', $mail->Send());
        }
    }
    display();
}
Пример #18
0
 function sendMail($spamlev)
 {
     global $xoopsUser;
     $info = array();
     $info['TIME'] = date('r', time());
     if (is_object($xoopsUser)) {
         $info['UID'] = (int) $xoopsUser->uid();
         $info['UNAME'] = $xoopsUser->uname();
     } else {
         $info['UID'] = 0;
         $info['UNAME'] = 'Guest';
     }
     $info['REQUEST_URI'] = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
     $info['HTTP_REFERER'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
     $info['HTTP_USER_AGENT'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $info['REMOTE_ADDR'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
     $info['SPAM LEVEL'] = $spamlev;
     $_info = '';
     foreach ($info as $key => $value) {
         $_info .= $key . ': ' . $value . "\n";
     }
     $_info .= str_repeat('-', 30) . "\n";
     $post = $_POST;
     // Key:excerpt があればトラックかも->文字コード変換
     if (isset($post['excerpt']) && function_exists('mb_convert_variables')) {
         if (isset($post['charset']) && $post['charset'] != '') {
             // TrackBack Ping で指定されていることがある
             // うまくいかない場合は自動検出に切り替え
             if (mb_convert_variables($this->encode, $post['charset'], $post) !== $post['charset']) {
                 mb_convert_variables($this->encode, 'auto', $post);
             }
         } else {
             if (!empty($post)) {
                 // 全部まとめて、自動検出/変換
                 mb_convert_variables($this->encode, 'auto', $post);
             }
         }
     }
     $message = $_info . '$_POST :' . "\n" . print_r($post, TRUE);
     $message .= "\n" . str_repeat('=', 30) . "\n\n";
     if ($this->send_mail_interval) {
         $mail_tmp = XOOPS_TRUST_PATH . '/uploads/hyp_common/' . str_replace('/', '_', preg_replace('#https?://#i', '', XOOPS_URL)) . '.SPAM.hyp';
         if (!file_exists($mail_tmp)) {
             HypCommonFunc::flock_put_contents($mail_tmp, $message);
             return;
         } else {
             $mtime = filemtime($mail_tmp);
             if ($mtime + $this->send_mail_interval * 60 > time()) {
                 if (HypCommonFunc::flock_put_contents($mail_tmp, $message, 'ab')) {
                     HypCommonFunc::touch($mail_tmp, $mtime);
                 }
                 return;
             } else {
                 $message = HypCommonFunc::flock_get_contents($mail_tmp) . $message;
                 unlink($mail_tmp);
             }
         }
     }
     $config_handler =& xoops_gethandler('config');
     $xoopsConfig =& $config_handler->getConfigsByCat(XOOPS_CONF);
     $subject = '[' . $xoopsConfig['sitename'] . '] POST Spam Report';
     $xoopsMailer =& getMailer();
     $xoopsMailer->useMail();
     $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     $xoopsMailer->setFromName($xoopsConfig['sitename']);
     $xoopsMailer->setSubject($subject);
     $xoopsMailer->setBody($message);
     $xoopsMailer->setToEmails($xoopsConfig['adminmail']);
     $xoopsMailer->send();
     $xoopsMailer->reset();
 }
Пример #19
0
/**
* @desc Envia la postal
*/
function sendPostcard()
{
    global $tpl, $xoopsModule, $xoopsModuleConfig, $rmc_config, $mc, $xoopsUser, $xoopsConfig, $util;
    foreach ($_POST as $k => $v) {
        ${$k} = $v;
    }
    if (!$xoopsUser) {
        redirect_header(XOOPS_URL . '/user.php#register', 1, _MS_GS_ERRUSR);
        die;
    }
    $img = new GSImage($img);
    if ($img->isNew()) {
        redirect_header(XOOPS_URL . '/modules/galleries/', 1, _MS_GS_ERRIMG);
        die;
    }
    // Recaptcha check
    if (!RMEvents::get()->run_event('rmcommon.captcha.check', true)) {
        redirect_header(GSFunctions::get_url() . ($xoopsModuleConfig['urlmode'] ? 'postcard/new/img/' . $img->id() . '/' : '?postcard=new&amp;img=' . $img->id()), 1, __('Please check the security words and write it correctly!', 'contact'));
        die;
    }
    $post = new GSPostcard();
    $post->setTitle($title);
    $post->setMessage($msg);
    $post->setDate(time());
    $post->setToName($tname);
    $post->setToEmail($tmail);
    $post->setImage($img->id());
    $post->setName($fname);
    $post->setEmail($fmail);
    $post->setUid($uid);
    $post->setIp($_SERVER['REMOTE_ADDR']);
    $post->setViewed(0);
    //Generamos el código de la postal
    $post->setCode(RMUtilities::randomString(10, 1, false, 1, 1));
    if (!$post->save()) {
        redirect_header(base64_decode($return), 2, __('Unable to send e-card. Please try again!', 'galleries'));
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $ectpl = is_file(XOOPS_ROOT_PATH . '/modules/galleries/lang/' . 'postcard-' . $rmc_config['language'] . '.tpl') ? $rmc_config['language'] . '.tpl' : 'postcard-en_US.tpl';
    $xoopsMailer->setTemplate($ectpl);
    $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
    $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
    $xoopsMailer->assign('FNAME', $fname);
    $xoopsMailer->assign('FMAIL', $fmail);
    $xoopsMailer->assign('TNAME', $tname);
    $xoopsMailer->assign('MODULE_LINK', GSfunctions::get_url());
    $xoopsMailer->assign('POSTAL_LINK', GSfunctions::get_url() . ($mc['urlmode'] ? 'postcard/view/id/' . $post->code() . '/' : '?postcard=view&amp;id=' . $post->code()));
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/galleries/lang/");
    $xoopsMailer->setFromEmail($fmail);
    $xoopsMailer->setFromName($fname);
    $xoopsMailer->setToEmails($tmail);
    $xoopsMailer->setSubject(sprintf(_MS_GS_SUBJECT, $tname));
    if (!$xoopsMailer->send(true)) {
        redirect_header(base64_decode($return), 2, $xoopsMailer->getErrors());
    } else {
        redirect_header($user->userURL() . 'img/' . $img->id() . '/', 1, __('E-card sent successfully!', 'galleries'));
    }
}
Пример #20
0
 /**
  * @desc Notifica al grupo de administradores la creación de un nuevo tema no aprobado
  * @param {@link } Objetos de Foro, Tema y mensaje
  * @param int edit indica si es la edición de un mensaje o un nuevo tema no aprobado
  **/
 public function notifyAdmin($moderators, BBForum &$forum, BBTopic &$topic, BBPost &$post, $edit = 0)
 {
     global $db, $xoopsModule, $rmc_config;
     $bxf = bXFunctions::get();
     $mhand = new XoopsMemberHandler($db);
     $configCat = new XoopsConfigCategory('mailer', 'mailer');
     $config =& $configCat->getConfigs(3);
     $users = $moderators;
     if (!$edit) {
         if (file_exists(XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG . '/admin_notify.tpl')) {
             $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG;
         } else {
             $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/en';
         }
     } else {
         if (file_exists(XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG . '/admin_notify_post.tpl')) {
             $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/' . RMCLANG;
         } else {
             $tpldir = XOOPS_ROOT_PATH . '/modules/bxpress/lang/en';
         }
     }
     foreach ($users as $k) {
         $xoopsMailer =& getMailer();
         $xoopsMailer->setFromEmail($config['from']);
         $xoopsMailer->setFromName($config['fromname']);
         $xoopsMailer->setTemplateDir($tpldir);
         if (!$edit) {
             $xoopsMailer->setSubject(sprintf(__('New topic created', 'bxpress'), $forum->name()));
             $xoopsMailer->setTemplate('admin_notify.tpl');
         } else {
             $xoopsMailer->setSubject(sprintf(__('A unapproved message has been edited', 'dtransport'), $topic->title()));
             $xoopsMailer->setTemplate('admin_notify_post.tpl');
         }
         $xoopsMailer->assign('FORUM_NAME', $forum->name());
         $xoopsMailer->assign('FORUM_MODNAME', $xoopsModule->name());
         $xoopsMailer->assign('TOPIC_UNAME', $topic->posterName());
         $xoopsMailer->assign('TOPIC_NAME', $topic->title());
         $xoopsMailer->assign('TOPIC_APPROVED', $topic->approved() ? _YES : _NO);
         $xoopsMailer->assign('TOPIC_LINK', $bxf->url() . '/moderate.php?id=' . $forum->id());
         $xoopsMailer->assign('POST_UNAME', $post->uname());
         $xoopsMailer->assign('POST_LINK', $post->permalink());
         $user = new XoopsUser($k);
         $xoopsMailer->setToUsers($user);
         $xoopsMailer->isMail = $user->getVar('notify_method') == 2;
         $xoopsMailer->isPM = $user->getVar('notify_method') == 1;
         $xoopsMailer->send(true);
         $xoopsMailer->clearAddresses();
     }
     echo $xoopsMailer->getErrors();
 }
Пример #21
0
function cc_notify_mail($tpl, $tags, $users, $from = "")
{
    // return: error count
    global $xoopsConfig, $xoopsModuleConfig, $xoopsUser, $xoopsModule;
    $xoopsMailer =& getMailer();
    if (is_array($users)) {
        $err = 0;
        foreach ($users as $u) {
            $err += cc_notify_mail($tpl, $tags, $u, $from);
        }
        return $err;
    }
    if (is_object($users)) {
        switch ($users->getVar('notify_method')) {
            case XOOPS_NOTIFICATION_METHOD_PM:
                $xoopsMailer->usePM();
                $sender = is_object($xoopsUser) ? $xoopsUser : new XoopsUser();
                $xoopsMailer->setFromUser($sender);
                break;
            case XOOPS_NOTIFICATION_METHOD_EMAIL:
                $xoopsMailer->useMail();
                break;
            case XOOPS_NOTIFICATION_METHOD_DISABLE:
                return 0;
            default:
                return 1;
        }
        $xoopsMailer->setToUsers($users);
    } else {
        if (empty($users)) {
            return 0;
        }
        $xoopsMailer->useMail();
        $xoopsMailer->setToEmails($users);
    }
    $xoopsMailer->setFromEmail($from ? $from : $xoopsConfig['adminmail']);
    $xoopsMailer->setFromName($xoopsModule->getVar('name'));
    $xoopsMailer->setSubject(_CC_NOTIFY_SUBJ);
    $comment = get_attr_value(null, 'reply_comment', '');
    if (get_attr_value(null, 'reply_use_comtpl')) {
        $xoopsMailer->setBody($comment);
    } else {
        $xoopsMailer->assign('REPLY_COMMENT', $comment);
        $xoopsMailer->setTemplateDir(template_dir($tpl));
        $xoopsMailer->setTemplate($tpl);
    }
    $xoopsMailer->assign($tags);
    return $xoopsMailer->send() ? 0 : 1;
}
Пример #22
0
/**
* Sends a reply made from reply form
*/
function cm_send_reply()
{
    global $xoopsSecurity, $xoopsModuleConfig, $xoopsConfig;
    $id = rmc_server_var($_POST, 'id', 0);
    $page = rmc_server_var($_POST, 'page', 1);
    if ($id <= 0) {
        redirectMsg('index.php?page=' . $page, __('You must specify a message ID', 'contact'), 1);
        die;
    }
    if (!$xoopsSecurity->check()) {
        redirectMsg('index.php?page=' . $page, __('Session token expired!', 'contact'), 1);
        die;
    }
    $msg = new CTMessage($id);
    if ($msg->isNew()) {
        redirectMsg('index.php?page=' . $page, __('Sorry, specified message does not exists!', 'contact'), 1);
        die;
    }
    $subject = rmc_server_var($_POST, 'subject', '');
    $message = rmc_server_var($_POST, 'message', 1);
    if ($subject == '' || $message == '') {
        redirectMsg('index.php?action=reply&id=' . $id . '&page=' . $page, __('Please fill al required fields!', 'contact'), 1);
        die;
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setBody($message . '\\n--------------\\n' . __('Message sent with ContactMe!', 'contact') . '\\nFrom ' . $xoopsModuleConfig['url']);
    $xoopsMailer->setToEmails($msg->getVar('email'));
    $xoopsMailer->setFromEmail($xoopsConfig['from']);
    $xoopsMailer->setFromName($xoopsConfig['fromname']);
    $xoopsMailer->setSubject($subject);
    if (!$xoopsMailer->send(true)) {
        redirectMsg('index.php?action=reply&id=' . $id . '&page=' . $page, __('Message could not be delivered. Please try again.', 'contact') . '<br />' . $xoopsMailer->getErrors(), 1);
        die;
    }
    redirectMsg('index.php?page=' . $page, __('Message sent successfully!', 'contact'), 0);
}
Пример #23
0
    $form->addElement(new XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
    $form->display();
} else {
    $myts =& MyTextSanitizer::getInstance();
    $member_handler =& xoops_gethandler('member');
    $getuser =& $member_handler->getUsers(new Criteria('email', $myts->addSlashes(trim($_REQUEST['email']))));
    if (count($getuser) == 0) {
        redirect_header(XOOPS_URL, 2, _PROFILE_MA_SORRYNOTFOUND);
    }
    if ($getuser[0]->isActive()) {
        redirect_header(XOOPS_URL, 2, sprintf(_PROFILE_MA_USERALREADYACTIVE, $getuser[0]->getVar('email')));
    }
    if ($getuser[0]->isDisabled()) {
        redirect_header(XOOPS_URL, 2, sprintf(_PROFILE_MA_USERDISABLED, $getuser[0]->getVar('email')));
    }
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setTemplate('register.tpl');
    $xoopsMailer->setTemplateDir(XOOPS_ROOT_PATH . "/modules/" . $xoopsModule->getVar('dirname') . "/language/" . $xoopsConfig['language'] . "/mail_template/");
    $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
    $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
    $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
    $xoopsMailer->setToUsers($getuser[0]);
    $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
    $xoopsMailer->setFromName($xoopsConfig['sitename']);
    $xoopsMailer->setSubject($xoopsMailer->setSubject(sprintf(_PROFILE_MA_USERKEYFOR, $getuser[0]->getVar('uname'))));
    if (!$xoopsMailer->send()) {
        echo _PROFILE_MA_YOURREGMAILNG;
    } else {
        echo _PROFILE_MA_YOURREGISTERED;
    }
 function wp_notify_moderator($comment_id)
 {
     $commentHandler =& wp_handler('Comment');
     if (!($commentObject =& $commentHandler->get($comment_id))) {
         return false;
     }
     $comment =& $commentObject->exportWpObject();
     $postHandler =& wp_handler('Post');
     if (!($postObject =& $postHandler->get($comment->comment_post_ID))) {
         return false;
     }
     $post =& $postObject->exportWpObject();
     $userHandler =& wp_handler('User');
     if (!($userObject =& $userHandler->get($post->post_author))) {
         return false;
     }
     $user = $userObject->exportWpObject();
     $comment_author_domain = gethostbyaddr($comment->comment_author_IP);
     $comments_waiting = $commentHandler->getCount(new Criteria('comment_approved', '0 '));
     $notify_message = _LANG_F_COMMENT_POST . " #{$comment->comment_post_ID} " . $post->post_title . _LANG_F_WAITING_APPROVAL . "\r\n\r\n";
     $notify_message .= "Author : {$comment->comment_author} (IP: {$comment->comment_author_IP} , {$comment_author_domain})\r\n";
     $notify_message .= "E-mail : {$comment->comment_author_email}\r\n";
     $notify_message .= "URL\t   : {$comment->comment_author_url}\r\n";
     $notify_message .= "Whois  : http://ws.arin.net/cgi-bin/whois.pl?queryinput={$comment->comment_author_IP}\r\n";
     $notify_message .= "Comment:\r\n" . $comment->comment_content . "\r\n\r\n";
     $notify_message .= _LANG_F_APPROVAL_VISIT . " " . wp_siteurl() . " /wp-admin/post.php?action=mailapprovecomment&p=" . $comment->comment_post_ID . "&comment={$comment_id}\r\n";
     $notify_message .= _LANG_F_DELETE_VISIT . " " . wp_siteurl() . "/wp-admin/post.php?action=confirmdeletecomment&p=" . $comment->comment_post_ID . "&comment={$comment_id}\r\n";
     $notify_message .= "\"{$comments_waiting}\"" . _LANG_F_PLEASE_VISIT . "\r\n";
     $notify_message .= wp_siteurl() . "/wp-admin/moderation.php\r\n";
     $subject = '[' . get_settings('blogname') . '] Please approve: "' . $post->post_title . '"';
     $from = "From: " . get_settings('admin_email');
     if (defined('XOOPS_URL')) {
         $xoopsMailer =& getMailer();
         $xoopsMailer->useMail();
         $xoopsMailer->setToEmails(get_settings('admin_email'));
         $xoopsMailer->setFromEmail(get_settings('admin_email'));
         $xoopsMailer->setSubject($subject);
         $xoopsMailer->setBody($notify_message);
         $xoopsMailer->send();
     } else {
         if (function_exists('mb_send_mail')) {
             mb_send_mail(get_settings('admin_email'), $subject, $notify_message, $from);
         } else {
             @mail(get_settings('admin_email'), $subject, $notify_message, $from);
         }
     }
     return true;
 }
Пример #25
0
function EmailStats($login, $cid, $bid, $pass)
{
    global $xoopsDB, $xoopsConfig;
    if ($login != "" && $pass != "") {
        $cid = intval($cid);
        $bid = intval($bid);
        if ($result2 = $xoopsDB->query(sprintf("select name, email, passwd from %s where cid=%u AND login=%s", $xoopsDB->prefix("bannerclient"), $cid, $xoopsDB->quoteString($login)))) {
            list($name, $email, $passwd) = $xoopsDB->fetchRow($result2);
            if ($pass == $passwd) {
                if ($email == "") {
                    redirect_header("banners.php", 3, "There isn't an email associated with client " . $name . ".<br />Please contact the Administrator");
                    exit;
                } else {
                    if ($result = $xoopsDB->query("select bid, imptotal, impmade, clicks, imageurl, clickurl, date from " . $xoopsDB->prefix("banner") . " where bid={$bid} and cid={$cid}")) {
                        list($bid, $imptotal, $impmade, $clicks, $imageurl, $clickurl, $date) = $xoopsDB->fetchRow($result);
                        if ($impmade == 0) {
                            $percent = 0;
                        } else {
                            $percent = substr(100 * $clicks / $impmade, 0, 5);
                        }
                        if ($imptotal == 0) {
                            $left = "Unlimited";
                            $imptotal = "Unlimited";
                        } else {
                            $left = $imptotal - $impmade;
                        }
                        $fecha = date("F jS Y, h:iA.");
                        $subject = "Your Banner Statistics at " . $xoopsConfig['sitename'];
                        $message = "Following are the complete stats for your advertising investment at " . $xoopsConfig['sitename'] . " :\n\n\nClient Name: {$name}\nBanner ID: {$bid}\nBanner Image: {$imageurl}\nBanner URL: {$clickurl}\n\nImpressions Purchased: {$imptotal}\nImpressions Made: {$impmade}\nImpressions Left: {$left}\nClicks Received: {$clicks}\nClicks Percent: {$percent}%\n\n\nReport Generated on: {$fecha}";
                        $xoopsMailer =& getMailer();
                        $xoopsMailer->useMail();
                        $xoopsMailer->setToEmails($email);
                        $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
                        $xoopsMailer->setFromName($xoopsConfig['sitename']);
                        $xoopsMailer->setSubject($subject);
                        $xoopsMailer->setBody($message);
                        $xoopsMailer->send();
                        redirect_header("banners.php?op=Ok&amp;login={$login}&amp;pass={$pass}&amp;t=" . $GLOBALS['xoopsSecurity']->createToken(), 3, "Statistics for your banner has been sent to your email address.");
                        exit;
                    }
                }
            }
        }
    }
    redirect_header("banners.php", 2);
    exit;
}
Пример #26
0
function Save()
{
    global $xoopsDB, $xoopsUser, $member_handler, $xoopsConfig, $xoopsModuleConfig;
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    if ($ids <= 0) {
        header('location: modified.php');
        die;
    }
    if ($id_soft <= 0) {
        header('location: modified.php');
        die;
    }
    if ($nombre == '') {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERRNAME);
        die;
    }
    if ($version == '') {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERRVERSION);
        die;
    }
    if ($archivo == '') {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERRFILE);
        die;
    }
    if ($idc <= 0) {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERRCATEGO);
        die;
    }
    if ($longdesc == '') {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERRDESC);
        die;
    }
    if ($size == '') {
        $size = 0;
    }
    $tbl = $xoopsDB->prefix("rmdp_software");
    list($num) = $xoopsDB->query("SELECT COUNT(*) FROM {$tbl} WHERE nombre='{$nombre}' AND id_soft<>'{$id_soft}'");
    if ($num > 0) {
        redirect_header('sended.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_ERREXIST);
        die;
    }
    $xoopsDB->query("UPDATE {$tbl} SET `nombre`='{$nombre}',`version`='{$version}',\n\t\t\t`licencia`='{$licencia}',`archivo`='{$archivo}',`img`='{$img}',`id_cat`='{$idc}',\n\t\t\t`longdesc`='{$longdesc}',`size`='{$size}',`favorito`='{$favorito}',\n\t\t\t`calificacion`='{$rating}',`anonimo`='{$anonimo}',`resaltar`='{$resaltar}',\n\t\t\t`update`='" . time() . "',`url`='{$url}',`submitter`='{$idu}',`urltitle`='{$urltitle}'\n\t\t\tWHERE id_soft='{$id_soft}'");
    $err = $xoopsDB->error();
    if ($err != '') {
        redirect_header('modified.php?op=acept&amp;ids=' . $ids, 2, _AM_RMDP_CATEGOFAIL . $err);
    }
    $xoopsDB->query("DELETE FROM " . $xoopsDB->prefix('rmdp_softos') . " WHERE id_soft='{$id_soft}'");
    foreach ($os as $value) {
        $xoopsDB->query("INSERT INTO " . $xoopsDB->prefix('rmdp_softos') . " (`id_os`,`id_soft`) VALUES ('{$value}','{$id_soft}')");
    }
    $xoopsDB->query("DELETE FROM " . $xoopsDB->prefix('rmdp_sended') . " WHERE id_send='{$ids}'");
    $user = $member_handler->getUser($idu);
    $xoopsMailer =& getMailer();
    $xoopsMailer->useMail();
    $xoopsMailer->setToEmails($user->getVar('email'));
    $xoopsMailer->setFromEmail($xoopsConfig['from']);
    $xoopsMailer->setFromName($xoopsConfig['sitename'] . " - " . $xoopsModuleConfig['rmdptitle']);
    $xoopsMailer->setSubject(_RMDP_MAIL_SUBJECT);
    $body = $xoopsModuleConfig['bodymail'];
    $body = str_replace('{USER}', $user->getVar('uname'), $body);
    $body = str_replace('{DOWN}', $nombre, $body);
    $body = str_replace('{LINK}', XOOPS_URL . "/modules/rmdp/mysends.php", $body);
    $body = str_replace('{URL}', XOOPS_URL, $body);
    $xoopsMailer->setBody($body);
    $xoopsMailer->send();
    redirect_header('modified.php', 2, _AM_RMDP_SENDOK);
}
Пример #27
0
	function User_RegistUserActivateMailBuilder()
	{
		$this->mMailer =& getMailer();
		$this->mMailer->useMail();
	}
Пример #28
0
 function sendMail(&$link, &$mailjob, $to_user, $from_user)
 {
     $xoopsMailer =& getMailer();
     $xoopsMailer->useMail();
     //
     // Set To
     //
     $xoopsMailer->setToUsers($to_user);
     //
     // Set From
     //
     $xoopsMailer->setFromEmail($mailjob->get('from_email'));
     $xoopsMailer->setFromName($mailjob->get('from_name'));
     $xoopsMailer->setSubject($mailjob->getReplaceTitle($to_user, $from_user));
     $xoopsMailer->setBody($mailjob->getReplaceBody($to_user, $from_user));
     if (!$xoopsMailer->send(true)) {
         if ($link->get('message') == "" && $xoopsMailer->multimailer->ErrorInfo == "") {
             $link->set('message', "Could not send mail. ");
         } else {
             $link->set('message', $link->get('message') . " / " . $xoopsMailer->multimailer->ErrorInfo);
         }
     }
 }
Пример #29
0
 /**
  * Send a message to user's email
  * @param 	object 	$pm 	{@link XoopsPrivmessage} object
  * @param 	object 	$user
  * @return 	bool
  **/
 function sendEmail(&$pm, &$user)
 {
     global $xoopsConfig;
     if (!is_object($user)) {
         $user =& $GLOBALS["xoopsUser"];
     }
     $msg = sprintf(_PM_EMAIL_DESC, $user->getVar("uname"));
     $msg .= "\n\n";
     $msg .= formatTimestamp($pm->getVar("msg_time"));
     $msg .= "\n";
     $from = new XoopsUser($pm->getVar("from_userid"));
     $to = new XoopsUser($pm->getVar("to_userid"));
     $msg .= sprintf(_PM_EMAIL_FROM, $from->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("from_userid") . ")");
     $msg .= "\n";
     $msg .= sprintf(_PM_EMAIL_TO, $to->getVar("uname") . " (" . XOOPS_URL . "/userinfo.php?uid=" . $pm->getVar("to_userid") . ")");
     $msg .= "\n";
     $msg .= _PM_EMAIL_MESSAGE . ":\n";
     $msg .= "\n" . $pm->getVar("subject") . "\n";
     $msg .= "\n" . strip_tags(str_replace("<p>", "\n", str_replace("</p>", "\n", str_replace("<br>", "\n", str_replace("<br />", "\n", $pm->getVar("msg_text")))))) . "\n\n";
     $msg .= "--------------\n";
     $msg .= $xoopsConfig['sitename'] . ": " . XOOPS_URL . "\n";
     $xoopsMailer =& getMailer();
     $xoopsMailer->useMail();
     $xoopsMailer->setToEmails($user->getVar("email"));
     $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
     $xoopsMailer->setFromName($xoopsConfig['sitename']);
     $xoopsMailer->setSubject(sprintf(_PM_EMAIL_SUBJECT, $pm->getVar("subject")));
     $xoopsMailer->setBody($msg);
     return $xoopsMailer->send();
 }
Пример #30
0
 function addAndActivateUser(&$userObj, $groups = false, $notifyUser = true, &$password = false)
 {
     $email = $userObj->getVar('email');
     if (!$userObj->getVar('email') || $email == '') {
         $userObj->setErrors(_CO_SOBJECT_USER_NEED_EMAIL);
         return false;
     }
     $password = $userObj->getVar('pass');
     // randomly generating the password if not already set
     if (strlen($password) == 0) {
         $password = substr(md5(uniqid(mt_rand(), 1)), 0, 6);
     }
     $userObj->setVar('pass', md5($password));
     // if no username is set, let's generate one
     $unamecount = 20;
     $uname = $userObj->getVar('uname');
     if (!$uname || $uname == '') {
         $usernames = $this->genUserNames($email, $unamecount);
         $newuser = false;
         $i = 0;
         while ($newuser == false) {
             $crit = new Criteria('uname', $usernames[$i]);
             $count = $this->getUserCount($crit);
             if ($count == 0) {
                 $newuser = true;
             } else {
                 //Move to next username
                 $i++;
                 if ($i == $unamecount) {
                     //Get next batch of usernames to try, reset counter
                     $usernames = $this->genUserNames($email, $unamecount);
                     $i = 0;
                 }
             }
         }
     }
     global $xoopsConfig;
     $config_handler =& xoops_gethandler('config');
     $xoopsConfigUser =& $config_handler->getConfigsByCat(XOOPS_CONF_USER);
     switch ($xoopsConfigUser['activation_type']) {
         case 0:
             $level = 0;
             $mailtemplate = 'smartmail_activate_user.tpl';
             $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_NEED_ACT, $user_email);
             break;
         case 1:
             $level = 1;
             $mailtemplate = 'smartmail_auto_activate_user.tpl';
             $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_AUTO_ACT, $user_email);
             break;
         case 2:
         default:
             $level = 0;
             $mailtemplate = 'smartmail_admin_activate_user.tpl';
             $aInfoMessages[] = sprintf(_NL_MA_NEW_USER_ADMIN_ACT, $user_email);
     }
     $userObj->setVar('uname', $usernames[$i]);
     $userObj->setVar('user_avatar', 'blank.gif');
     $userObj->setVar('user_regdate', time());
     $userObj->setVar('timezone_offset', $xoopsConfig['default_TZ']);
     $actkey = substr(md5(uniqid(mt_rand(), 1)), 0, 8);
     $userObj->setVar('actkey', $actkey);
     $userObj->setVar('email', $email);
     $userObj->setVar('notify_method', 2);
     $userObj->setVar('level', $userObj);
     if ($this->insertUser($userObj)) {
         // if $groups=false, Add the user to Registered Users group
         if (!$groups) {
             $this->addUserToGroup(XOOPS_GROUP_USERS, $userObj->getVar('uid'));
         } else {
             foreach ($groups as $groupid) {
                 $this->addUserToGroup($groupid, $userObj->getVar('uid'));
             }
         }
     } else {
         return false;
     }
     if ($notifyUser) {
         // send some notifications
         $xoopsMailer =& getMailer();
         $xoopsMailer->useMail();
         $xoopsMailer->setTemplateDir(SMARTOBJECT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/mail_template');
         $xoopsMailer->setTemplate('smartobject_notify_user_added_by_admin.tpl');
         $xoopsMailer->assign('XOOPS_USER_PASSWORD', $password);
         $xoopsMailer->assign('SITENAME', $xoopsConfig['sitename']);
         $xoopsMailer->assign('ADMINMAIL', $xoopsConfig['adminmail']);
         $xoopsMailer->assign('SITEURL', XOOPS_URL . "/");
         $xoopsMailer->assign('NAME', $userObj->getVar('name'));
         $xoopsMailer->assign('UNAME', $userObj->getVar('uname'));
         $xoopsMailer->setToUsers($userObj);
         $xoopsMailer->setFromEmail($xoopsConfig['adminmail']);
         $xoopsMailer->setFromName($xoopsConfig['sitename']);
         $xoopsMailer->setSubject(sprintf(_CO_SOBJECT_NEW_USER_NOTIFICATION_SUBJECT, $xoopsConfig['sitename']));
         if (!$xoopsMailer->send(true)) {
             /**
              * @todo trap error if email was not sent
              */
             $xoopsMailer->getErrors(true);
         }
     }
     return true;
 }