コード例 #1
0
ファイル: class_network.php プロジェクト: essa/sharetronix_ja
 public function send_notification_email($to_user_id, $notif_type, $subject, $message_txt, $message_html, $inD = FALSE)
 {
     global $C, $D, $page;
     if ($inD) {
         foreach ($inD as $k => $v) {
             $D->{$k} = $v;
         }
     }
     $to_user = $this->get_user_by_id($to_user_id);
     if (!$to_user || empty($subject) || empty($message_txt) || empty($message_html)) {
         return;
     }
     $D->page =& $page;
     $D->user = $to_user;
     $D->subject = $subject;
     $D->message_txt = $message_txt;
     $D->message_html = $message_html;
     $msgtxt = $page->load_template('email/notifications_txt.php', FALSE);
     $msghtml = $page->load_template('email/notifications_html.php', FALSE);
     if (empty($msgtxt) || empty($msghtml)) {
         return;
     }
     if ($C->SITE_URL != $C->DEF_SITE_URL) {
         $msgtxt = str_replace($C->SITE_URL, $C->DEF_SITE_URL, $msgtxt);
         $msghtml = str_replace($C->SITE_URL, $C->DEF_SITE_URL, $msghtml);
     }
     if (preg_match('/^(http(s)?\\:\\/\\/)m\\.(.*)$/iu', $C->DEF_SITE_URL, $m)) {
         $siteurl = $m[1] . $m[3];
         $msgtxt = str_replace($C->DEF_SITE_URL, $siteurl, $msgtxt);
         $msghtml = str_replace($C->DEF_SITE_URL, $siteurl, $msghtml);
     }
     do_send_mail_html($to_user->email, $subject, $msgtxt, $msghtml);
 }
コード例 #2
0
ファイル: invite.php プロジェクト: chaobj001/tt
         $db1->query('UPDATE unconfirmed_registrations SET fullname="' . $db1->e($tmp->name) . '", date="' . time() . '" WHERE id="' . $sdf->id . '" LIMIT 1');
     } else {
         $D->reg_key = md5(rand() . time() . rand());
         $db1->query('REPLACE INTO unconfirmed_registrations SET email="' . $db1->e($tmp->email) . '", fullname="' . $db1->e($tmp->name) . '", confirm_key="' . $db1->e($D->reg_key) . '", date="' . time() . '" ');
         $D->reg_id = intval($db1->insert_id());
     }
     $D->registration_link = $C->SITE_URL . 'signup/regid:' . $D->reg_id . '/regkey:' . $D->reg_key;
     $this->load_langfile('email/invite.php');
     $D->who = $this->user->info->fullname;
     $D->whom = $tmp->name;
     $D->lang_keys = array('#WHO#' => $D->who, '#WHOM#' => $D->whom, '#COMPANY#' => $C->COMPANY, '#SITE_TITLE#' => $C->SITE_TITLE, '#SITE_URL#' => $C->SITE_URL);
     $subject = $this->lang('os_invite_email_subject', $D->lang_keys);
     $msgtxt = $this->load_template('email/invite_txt.php', FALSE);
     $msghtml = $this->load_template('email/invite_html.php', FALSE);
     $from = $this->user->info->fullname . ' <' . $this->user->info->email . '>';
     do_send_mail_html($tmp->email, $subject, $msgtxt, $msghtml, $from);
 }
 $nm = count($D->do_send_invites);
 if (count($D->ok_but_uexists) == 0 && count($D->ok_but_alrdsent) == 0) {
     $D->status = 'okbox';
     $D->mtitle = $this->lang('inv_clg_ok_msg');
     $D->message = $this->lang('inv_clg_ok_sent_' . ($nm == 0 ? '0' : ($nm == 1 ? '1' : 'more')), array('#NUM#' => $nm));
 } else {
     $D->status = 'msgbox';
     $D->mtitle = $this->lang('inv_clg_ok_sent_' . ($nm == 0 ? '0' : ($nm == 1 ? '1' : 'more')), array('#NUM#' => $nm));
     $D->message = array();
     foreach ($D->ok_but_uexists as $tmp) {
         $D->message[] = $this->lang('inv_clg_ok_exists', array('#NAME#' => '<b>' . htmlspecialchars($tmp->name) . '</b>', '#USERLINK#' => '<a href="' . $C->SITE_URL . $tmp->username . '" title="' . htmlspecialchars($tmp->fullname) . '">@' . $tmp->username . '</a>'));
     }
     foreach ($D->ok_but_alrdsent as $tmp) {
         $D->message[] = $this->lang('inv_clg_ok_alrdsent', array('#EMAIL#' => '<b>' . $tmp->email . '</b>'));
コード例 #3
0
ファイル: signup.php プロジェクト: chaobj001/tt
        $db2->query('SELECT id, active FROM users WHERE email="' . $db2->e($email) . '" LIMIT 1');
        if ($obj = $db2->fetch_object()) {
            $D->error = TRUE;
            $D->errmsg = $obj->active == 1 ? 'signup_err_email_exists' : 'signup_err_email_disabled';
        }
    }
    if (!$D->error) {
        $invited_code = isset($_SESSION['invite_code']) ? trim($_SESSION['invite_code']) : '';
        $D->reg_key = md5(rand() . time() . rand());
        $db1->query('REPLACE INTO unconfirmed_registrations SET email="' . $db1->e($email) . '", confirm_key="' . $db1->e($D->reg_key) . '", invited_code="' . $db1->e($invited_code) . '", date="' . time() . '" ');
        $D->reg_id = intval($db1->insert_id());
        $D->activation_link = $C->SITE_URL . 'signup/regid:' . $D->reg_id . '/regkey:' . $D->reg_key;
        $subject = $this->lang('signup_email_subject', array('#SITE_TITLE#' => $C->SITE_TITLE));
        $msgtxt = $this->load_template('email/signup_txt.php', FALSE);
        $msghtml = $this->load_template('email/signup_html.php', FALSE);
        do_send_mail_html($email, $subject, $msgtxt, $msghtml);
    }
    $D->email = $email;
    $this->load_template('mobile_iphone/signup-step1.php');
} elseif ($C->USERS_EMAIL_CONFIRMATION && $this->param('regid') && $this->param('regkey') || !$C->USERS_EMAIL_CONFIRMATION) {
    $D->email = '';
    $D->username = '';
    $D->fullname = '';
    $D->password = '';
    $D->password2 = '';
    $invited_code = '';
    if ($C->USERS_EMAIL_CONFIRMATION) {
        $reg_id = intval($this->param('regid'));
        $reg_key = $db1->e($this->param('regkey'));
        $db1->query('SELECT email, fullname, invited_code FROM unconfirmed_registrations WHERE id="' . $reg_id . '" AND confirm_key="' . $reg_key . '" LIMIT 1');
        if (!($obj = $db1->fetch_object())) {
コード例 #4
0
ファイル: settings_email.php プロジェクト: chaobj001/tt
    } elseif (empty($D->user_pass) || md5($D->user_pass) != $this->user->info->password) {
        $D->error = TRUE;
        $D->errmsg = $this->lang('st_email_pass_error');
    } elseif ($this->network->get_user_by_email($D->new_email)) {
        $D->error = TRUE;
        $D->errmsg = $this->lang('st_email_name_repeat', array('#SITE_TITLE#' => $C->SITE_TITLE));
    }
    if (!$D->error) {
        if ($C->USERS_EMAIL_CONFIRMATION) {
            $D->confirmation_key = md5(rand() . time() . rand());
            $db2->query('INSERT INTO email_change_requests(user_id, new_email, confirm_key, confirm_valid) VALUES("' . $this->user->id . '", "' . $db2->e($D->new_email) . '", "' . $D->confirmation_key . '", "' . (time() + 7 * 24 * 60 * 60) . '")');
            $D->confirmation_link = $C->SITE_URL . 'settings/email/reqid:' . $db2->insert_id() . '/reqkey:' . $D->confirmation_key;
            $subject = $this->lang('prof_changemail_subject', array('#SITE_TITLE#' => $C->SITE_TITLE));
            $msgtxt = $this->load_template('email/changeemail_txt.php', FALSE);
            $msghtml = $this->load_template('email/changeemail_html.php', FALSE);
            do_send_mail_html($D->new_email, $subject, $msgtxt, $msghtml);
            $D->error = TRUE;
            $D->notif = TRUE;
            $D->errmsg = $this->lang('st_email_notif_send', array('#SITE_TITLE#' => $D->new_email));
        } else {
            $db2->query('UPDATE users SET email="' . $db2->e($D->new_email) . '" WHERE id="' . $this->user->id . '" LIMIT 1');
            $this->network->get_user_by_id($this->user->id, TRUE);
            $this->network->get_user_by_email($this->user->info->email, TRUE);
            $this->user->info->email = $D->new_email;
            $D->new_email = '';
            $D->new_email_confirm = '';
            $D->user_pass = '';
            $D->new_email_active = TRUE;
        }
    }
}