当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsCore::mailText方法代码示例

本文整理汇总了PHP中cmsCore::mailText方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::mailText方法的具体用法?PHP cmsCore::mailText怎么用?PHP cmsCore::mailText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsCore的用法示例。


在下文中一共展示了cmsCore::mailText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: mod_invite

function mod_invite($mod, $cfg) {
    global $_LANG;

    $errors      = false;
    $is_redirect = false; // в модуле нельзя использовать cmsCore::redirectBack(), используем костыли ;)

    if (cmsCore::inRequest('send_invite_email')) {
        $is_redirect = true;

        $username = cmsCore::request('username', 'str', '');
        $email    = cmsCore::request('friend_email', 'email', '');

        if (!$username && !cmsCore::c('user')->id) {
            cmsCore::addSessionMessage($_LANG['ERR_NEED_NAME'], 'error'); $errors = true;
        }
        
        if (cmsCore::c('user')->id) {
            $username = cmsCore::c('user')->nickname;
        }

        if (!$email) {
            cmsCore::addSessionMessage($_LANG['ERR_NEED_MAIL'], 'error'); $errors = true;
        }

        if (!$errors) {
            if (!cmsUser::checkCsrfToken()) {
                cmsCore::error404();
            }

            $letter = cmsCore::getLanguageTextFile('mail_invite');
            $letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
            $letter = str_replace('{site_url}', HOST, $letter);
            $letter = str_replace('{username}', $username, $letter);

            cmsCore::mailText($email, sprintf($_LANG['INVITE_SUBJECT'], $username), $letter);
            cmsCore::addSessionMessage($_LANG['INVITE_SENDED'], 'success');
        }
    }

    cmsPage::initTemplate('modules', $cfg['tpl'])->
        assign('user_id', cmsCore::c('user')->id)->
        assign('is_redirect', $is_redirect)->
        display();

    return true;
}
开发者ID:Acsac,项目名称:CMS-RuDi,代码行数:46,代码来源:module.php

示例2: sendActivationNotice

 public function sendActivationNotice($send_pass, $user_id)
 {
     global $_LANG;
     $user = cmsUser::getShortUserData($user_id);
     if (!$user_id) {
         return false;
     }
     $user['password'] = $send_pass;
     $code = md5($user['email'] . uniqid() . '-' . microtime());
     $codelink = HOST . '/activate/' . $code;
     $sql = "INSERT cms_users_activate (pubdate, user_id, code)\r\n                VALUES (NOW(), '{$user['id']}', '{$code}')";
     $this->inDB->query($sql);
     $letter = cmsCore::getLanguageTextFile('activation');
     foreach ($user as $key => $value) {
         $letter = str_replace('{' . $key . '}', $value, $letter);
     }
     $letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
     $letter = str_replace('{codelink}', $codelink, $letter);
     return cmsCore::mailText($user['email'], $_LANG['ACTIVATION_ACCOUNT'] . ' - ' . cmsConfig::getConfig('sitename'), $letter);
 }
开发者ID:deltas1,项目名称:icms1,代码行数:20,代码来源:model.php

示例3: forms

function forms()
{
    cmsCore::loadClass('form');
    $do = cmsCore::getInstance()->do;
    global $_LANG;
    //========================================================================================================================//
    //========================================================================================================================//
    if ($do == 'view') {
        // Получаем форму
        $form = cmsForm::getFormData(cmsCore::request('form_id', 'int'));
        if (!$form) {
            cmsCore::error404();
        }
        // Получаем данные полей формы
        $form_fields = cmsForm::getFormFields($form['id']);
        // Если полей нет, 404
        if (!$form_fields) {
            cmsCore::error404();
        }
        $errors = array();
        $attachment = array();
        // Получаем данные формы
        // Если не переданы, назад
        $form_input = cmsForm::getFieldsInputValues($form['id']);
        if (!$form_input) {
            $errors[] = $_LANG['FORM_ERROR'];
        }
        // Проверяем значения формы
        foreach ($form_input['errors'] as $field_error) {
            if ($field_error) {
                $errors[] = $field_error;
            }
        }
        // проверяем каптчу
        if (!cmsPage::checkCaptchaCode()) {
            $errors[] = $_LANG['ERR_CAPTCHA'];
        }
        if ($errors) {
            if (cmsCore::isAjax()) {
                cmsCore::jsonOutput(array('error' => true, 'text' => end($errors)));
            } else {
                foreach ($errors as $error) {
                    cmsCore::addSessionMessage($error, 'error');
                }
                cmsCore::redirectBack();
            }
        }
        if (!cmsUser::checkCsrfToken()) {
            cmsCore::error404();
        }
        // Подготовим начало письма
        $mail_message = '<h3>' . $_LANG['FORM'] . ': ' . $form['title'] . '</h3>';
        // Добавляем заполненные поля в письмо
        foreach ($form_fields as $field) {
            // Значение поля
            $value = $form_input['values'][$field['id']];
            if (!$value) {
                continue;
            }
            if (is_string($value)) {
                $mail_message .= '<h5>' . $field['title'] . '</h5><p>' . $value . '</p>';
            } elseif (is_array($value)) {
                // если массив, значит к форме прикреплен файл
                if ($form['sendto'] == 'mail') {
                    $attachment[] = !empty($value['url']) ? PATH . $value['url'] : '';
                } elseif (!empty($value['url'])) {
                    $mail_message .= '<h5>' . $field['title'] . '</h5><p><a href="' . $value['url'] . '">' . $value['name'] . '</a></p>';
                }
            }
        }
        // Отправляем форму
        if ($form['sendto'] == 'mail') {
            $emails = explode(',', $form['email']);
            if ($emails) {
                foreach ($emails as $email) {
                    cmsCore::mailText(trim($email), cmsConfig::getConfig('sitename') . ': ' . $form['title'], $mail_message, $attachment);
                }
            }
            // удаляем прикрепленные файлы
            foreach ($attachment as $attach) {
                @unlink($attach);
            }
        } else {
            cmsUser::sendMessage(-2, $form['user_id'], $mail_message);
        }
        cmsUser::sessionClearAll();
        if (cmsCore::isAjax()) {
            cmsCore::jsonOutput(array('error' => false, 'text' => $_LANG['FORM_IS_SEND']));
        } else {
            cmsCore::addSessionMessage($_LANG['FORM_IS_SEND'], 'info');
            cmsCore::redirectBack();
        }
    }
    //========================================================================================================================//
}
开发者ID:vicktorwork,项目名称:cms1,代码行数:95,代码来源:frontend.php

示例4: users


//.........这里部分代码省略.........
            }
            cmsCore::loadModel('registration');
            $modreg = new cms_model_registration();
            if (!$inUser->is_admin) {
                if ($modreg->getBadNickname($users['nickname'])) {
                    cmsCore::addSessionMessage($_LANG['ERR_NICK_EXISTS'], 'error');
                    $errors = true;
                }
            }
            $profiles['gender'] = cmsCore::request('gender', 'str');
            $profiles['city'] = cmsCore::request('city', 'str');
            if (mb_strlen($profiles['city']) > 50) {
                cmsCore::addSessionMessage($_LANG['LONG_CITY_NAME'], 'error');
                $errors = true;
            }
            $users['email'] = cmsCore::request('email', 'email');
            if (!$users['email']) {
                cmsCore::addSessionMessage($_LANG['REALY_ADRESS_EMAIL'], 'error');
                $errors = true;
            }
            if ($usr['email'] != $users['email']) {
                $is_set_email = $inDB->get_field('cms_users', "email='{$users['email']}'", 'id');
                if ($is_set_email) {
                    cmsCore::addSessionMessage($_LANG['ADRESS_EMAIL_IS_BUSY'], 'error');
                    $errors = true;
                } else {
                    // формируем токен
                    $token = md5($usr['email'] . uniqid() . microtime());
                    $inDB->insert('cms_users_activate', array('user_id' => $inUser->id, 'pubdate' => date("Y-m-d H:i:s"), 'code' => $token));
                    $codelink = HOST . '/users/change_email/' . $token . '/' . $users['email'];
                    // по старому адресу высылаем письмо с подтверждением
                    $letter = cmsCore::getLanguageTextFile('change_email');
                    $letter = str_replace(array('{nickname}', '{codelink}'), array($inUser->nickname, $codelink), $letter);
                    cmsCore::mailText($usr['email'], '', $letter);
                    cmsCore::addSessionMessage(sprintf($_LANG['YOU_CHANGE_EMAIL'], $usr['email']), 'info');
                    // email не меняем
                    $users['email'] = $usr['email'];
                }
            }
            $profiles['showphone'] = cmsCore::request('showphone', 'int', 0);
            $profiles['showmail'] = cmsCore::request('showmail', 'int');
            $profiles['email_newmsg'] = cmsCore::request('email_newmsg', 'int');
            $profiles['showbirth'] = cmsCore::request('showbirth', 'int');
            $profiles['description'] = cmsCore::request('description', 'str', '');
            $users['birthdate'] = (int) $_REQUEST['birthdate']['year'] . '-' . (int) $_REQUEST['birthdate']['month'] . '-' . (int) $_REQUEST['birthdate']['day'];
            $profiles['signature'] = $inDB->escape_string(cmsCore::badTagClear(cmsCore::request('signature', 'html', '')));
            $profiles['signature_html'] = $inDB->escape_string(cmsCore::parseSmiles(cmsCore::request('signature', 'html', ''), true));
            $profiles['allow_who'] = cmsCore::request('allow_who', 'str');
            if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['allow_who'])) {
                $errors = true;
            }
            $users['icq'] = cmsCore::request('icq', 'str', '');
            $profiles['showicq'] = cmsCore::request('showicq', 'int');
            $profiles['cm_subscribe'] = cmsCore::request('cm_subscribe', 'str');
            if (!preg_match('/^([a-zA-Z]+)$/ui', $profiles['cm_subscribe'])) {
                $errors = true;
            }
            $users['phone'] = cmsCore::request('phone', 'int', 0);
            // получаем данные форм
            $profiles['formsdata'] = '';
            if (isset($model->config['privforms'])) {
                if (is_array($model->config['privforms'])) {
                    foreach ($model->config['privforms'] as $form_id) {
                        $form_input = cmsForm::getFieldsInputValues($form_id);
                        $profiles['formsdata'] .= $inDB->escape_string(cmsCore::arrayToYaml($form_input['values']));
                        // Проверяем значения формы
开发者ID:deltas1,项目名称:icms1,代码行数:67,代码来源:frontend.php

示例5: sendUpdateNotify

 /**
  * Рассылает личные уведомления для подписанных на что-либо пользователей
  * @param string $target Назначение
  * @param int $target_id ID назначения
  * @param array $item Массив того, о чем уведомляем - ключи: array('link','title','author', 'letter_file');
  * @return bool
  */
 public static function sendUpdateNotify($target, $target_id, $item = array())
 {
     if (!$item) {
         return false;
     }
     global $_LANG;
     $inUser = self::getInstance();
     $inDB = cmsDatabase::getInstance();
     //получаем список подписанных пользователей
     $sql = "SELECT u.id, u.email, p.cm_subscribe as subscribe_type\n                FROM cms_subscribe s\n                INNER JOIN cms_users u ON u.id = s.user_id\n                INNER JOIN cms_user_profiles p ON p.user_id = u.id\n                WHERE s.target = '{$target}' AND s.target_id = '{$target_id}'";
     $r = $inDB->query($sql);
     if (!$inDB->num_rows($r)) {
         return false;
     }
     $letter = cmsCore::getLanguageTextFile($item['letter_file']);
     if (!$letter) {
         return false;
     }
     while ($user = $inDB->fetch_assoc($r)) {
         if ($user['id'] == $inUser->id) {
             continue;
         }
         if ($user['subscribe_type'] == 'priv' || $user['subscribe_type'] == 'both') {
             $message = $_LANG['WAS_UPDATED'] . ' <a href="' . $item['link'] . '">' . $item['title'] . '</a>';
             self::sendMessage(USER_UPDATER, $user['id'], $message);
         }
         if ($user['subscribe_type'] == 'mail' || $user['subscribe_type'] == 'both') {
             $user_letter = str_replace('{sitename}', cmsConfig::getConfig('sitename'), $letter);
             $user_letter = str_replace('{answerlink}', HOST . $item['link'], $user_letter);
             $user_letter = str_replace('{pagetitle}', $item['title'], $user_letter);
             $user_letter = str_replace('{date}', date('d/m/Y H:i:s'), $user_letter);
             $user_letter = str_replace('{author}', $item['author'], $user_letter);
             cmsCore::mailText($user['email'], '', $user_letter);
             unset($user_letter);
         }
     }
     return true;
 }
开发者ID:vicktorwork,项目名称:cms1,代码行数:45,代码来源:user.class.php

示例6: sendGreetsMessageAto

 public function sendGreetsMessageAto($email)
 {
     return cmsCore::mailText($email, $this->config['greetmsg_title'], $this->config['greetmsg_ato']);
 }
开发者ID:4uva4ek,项目名称:svato,代码行数:4,代码来源:model.php


注:本文中的cmsCore::mailText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。