本文整理汇总了PHP中cmsCore::getLanguageTextFile方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsCore::getLanguageTextFile方法的具体用法?PHP cmsCore::getLanguageTextFile怎么用?PHP cmsCore::getLanguageTextFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsCore
的用法示例。
在下文中一共展示了cmsCore::getLanguageTextFile方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例3: users
//.........这里部分代码省略.........
cmsCore::addSessionMessage($_LANG['SHORT_NICKNAME'], 'error');
$errors = true;
}
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);
示例4: comments
//.........这里部分代码省略.........
if (!cmsUser::checkCsrfToken()) {
cmsCore::error404();
}
// 5. добавляем комментарий в базу
$comment_id = $model->addComment($comment);
// 6. Пересчитываем количество комментариев у цели если нужно
if (method_exists($target_model, 'updateCommentsCount')) {
$target_model->updateCommentsCount($comment['target'], $comment['target_id']);
}
if (!$comment['is_hidden'] && $comment['published']) {
//регистрируем событие
$content_short = strip_tags($comment['content']);
cmsActions::log('add_comment', array('object' => $_LANG['COMMENT'], 'object_url' => $comment['target_link'] . '#c' . $comment_id, 'object_id' => $comment_id, 'target' => $comment['target_title'], 'target_url' => $comment['target_link'], 'target_id' => $comment['target_id'], 'description' => mb_strlen($content_short) > 140 ? mb_substr($content_short, 0, 140) : $content_short));
}
////////////////////////////////////////////////////////////////
///////////////// Операции по уведомлениям /////////////////////
$inConf = cmsConfig::getInstance();
$from_nick = $inUser->id ? $inUser->nickname : $comment['guestname'];
$targetlink = HOST . $comment['target_link'] . '#c' . $comment_id;
//получаем ID и e-mail автора
$author = $inUser->id ? $model->getTargetAuthor($target['target_table'], $comment['target_id']) : '';
//подписываем пользователя на обновления, если нужно
if ($inUser->id && cmsCore::inRequest('subscribe')) {
cmsUser::subscribe($inUser->id, $comment['target'], $comment['target_id']);
}
if ($comment['published']) {
//рассылаем уведомления о новом комменте
cmsUser::sendUpdateNotify($comment['target'], $comment['target_id'], array('link' => $comment['target_link'] . '#c' . $comment_id, 'title' => stripslashes($comment['target_title']), 'letter_file' => 'newcomment', 'author' => $inUser->id ? $inUser->nickname : $comment['guestname']));
//проверяем и выдаем награду если нужно
cmsUser::checkAwards($inUser->id);
}
//отправляем админу уведомление о комментарии на e-mail, если нужно
if ($model->config['email']) {
$mailmsg = str_replace(array('{sitename}', '{date}', '{from}', '{subjtitle}', '{targetlink}', '{content}'), array($inConf->sitename, date('d/m/Y (H:i)'), $from_nick, stripslashes($comment['target_title']), $targetlink, strip_tags($comment['content'])), cmsCore::getLanguageTextFile('newcomment_admin'));
$inCore->mailText($model->config['email'], '', $mailmsg);
}
//отправляем автору уведомление на e-mail
if ($author && $comment['published']) {
if ($model->isAuthorNeedMail($author['id']) && $inUser->id != $author['id']) {
$letter = cmsCore::getLanguageTextFile('newpostcomment');
$letter = str_replace('{sitename}', $inConf->sitename, $letter);
$letter = str_replace('{subj}', $target['subj'], $letter);
$letter = str_replace('{subjtitle}', stripslashes($comment['target_title']), $letter);
$letter = str_replace('{targetlink}', $targetlink, $letter);
$letter = str_replace('{date}', date('d/m/Y H:i:s'), $letter);
$letter = str_replace('{from}', $from_nick, $letter);
$inCore->mailText($author['email'], '', $letter);
}
}
if (!$comment['published']) {
$message = str_replace(array('%user%', '%targetlink%'), array($from_nick, $targetlink), $_LANG['COMM_PREMODER_ADMIN_TEXT']);
cmsUser::sendMessage(USER_UPDATER, 1, $message);
}
cmsCore::jsonOutput(array('error' => false, 'target' => $comment['target'], 'target_id' => $comment['target_id'], 'is_premod' => $comment['published'] ? 0 : $_LANG['COMM_PREMODER_TEXT'], 'comment_id' => $comment_id));
}
//========================================================================================================================//
//========================================================================================================================//
if ($do == 'edit') {
if (!cmsCore::isAjax()) {
cmsCore::error404();
}
$comment = $model->getComment(cmsCore::request('comment_id', 'int', 0));
if (!$comment) {
die;
}
// редактировать могут авторы (если время редактирования есть)
示例5: sendEmail
public function sendEmail($to, $letter, $data = array())
{
if (is_array($to)) {
if (empty($to['email'])) {
return false;
}
if (empty($to['name'])) {
$to['name'] = false;
}
} else {
if (empty($to)) {
return false;
}
$to = array('email' => $to, 'name' => false);
}
if (is_array($letter)) {
if (empty($letter['text'])) {
$letter['text'] = cmsCore::getLanguageTextFile("letters/{$letter['name']}");
}
} else {
$letter = array('text' => cmsCore::getLanguageTextFile("letters/{$letter}"));
}
if (!$letter['text']) {
return false;
}
$config = cmsConfig::getInstance();
$data = array_merge(array('site' => $config->sitename, 'date' => html_date(time()), 'time' => html_time(time())), $data);
$letter['text'] = string_replace_keys_values($letter['text'], $data);
$mailer = new cmsMailer();
$mailer->addTo($to['email'], $to['name']);
$letter['text'] = $mailer->parseSubject($letter['text']);
$letter['text'] = $mailer->parseAttachments($letter['text']);
$mailer->setBodyHTML(nl2br($letter['text']));
$result = $mailer->send();
$mailer->clearTo()->clearAttachments();
return $result;
}
示例6: 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;
}
示例7: sendNotificationByEmail
public function sendNotificationByEmail($to_id=0, $from_id=0, $msg_id=0) {
if(!$from_id || !$to_id || !$msg_id) { return false; }
$inUser = cmsUser::getInstance();
$inCore = cmsCore::getInstance();
$inConf = cmsConfig::getInstance();
global $_LANG;
//проверяем подписку на уведомления
$needmail = $this->inDB->get_field('cms_user_profiles', "user_id='{$to_id}'", 'email_newmsg');
//если подписан и не онлайн, отправляем уведомление на email
if (!$inUser->isOnline($to_id) && $needmail){
$postdate = date('d/m/Y H:i:s');
$to_email = $this->inDB->get_field('cms_users', "id='{$to_id}'", 'email');
$from_nick = $inUser->nickname;
$answerlink = HOST.'/users/'.$to_id.'/messages.html';
$letter = cmsCore::getLanguageTextFile('newmessage');
$letter = str_replace('{sitename}', $inConf->sitename, $letter);
$letter = str_replace('{answerlink}', $answerlink, $letter);
$letter = str_replace('{date}', $postdate, $letter);
$letter = str_replace('{from}', $from_nick, $letter);
$inCore->mailText($to_email, $_LANG['YOU_HAVE_NEW_MESS'].'! - '.$inConf->sitename, $letter);
return true;
}
return false;
}
示例8: sendClubsEmail
public function sendClubsEmail($to_id = 0, $from_id = 1, $msg_id = 1)
{
$inUser = cmsUser::getInstance();
$inCore = cmsCore::getInstance();
$inConf = cmsConfig::getInstance();
global $_LANG;
if ($to_id) {
$postdate = date('d/m/Y H:i:s');
$to_email = $this->inDB->get_field('cms_users', "id='{$to_id}'", 'email');
$from_nick = $inUser->nickname;
$answerlink = HOST . '/users/' . $to_id . '/messages.html';
$letter = cmsCore::getLanguageTextFile('newmessage');
$letter = str_replace('{sitename}', $inConf->sitename, $letter);
$letter = str_replace('{answerlink}', $answerlink, $letter);
$letter = str_replace('{date}', $postdate, $letter);
$letter = str_replace('{from}', $from_nick, $letter);
$inCore->mailText($to_email, 'Новий учасник в спільноті! - ' . $inConf->sitename, $letter);
return true;
}
return false;
}