本文整理汇总了PHP中cot_mail函数的典型用法代码示例。如果您正苦于以下问题:PHP cot_mail函数的具体用法?PHP cot_mail怎么用?PHP cot_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cot_mail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cot_send_translated_mail
/**
* Send an email in the recipient's language
*
* @param string $rlang Recipient language
* @param string $remail Recipient email
* @param string $rusername Recipient name
*/
function cot_send_translated_mail($rlang, $remail, $rusername)
{
global $cfg, $usr;
require_once cot_langfile('pm', 'module', $cfg['defaultlang'], $rlang);
if (!$L || !isset($L['pm_notify'])) {
global $L;
}
$rsubject = $L['pm_notifytitle'];
$rbody = sprintf($L['pm_notify'], $rusername, htmlspecialchars($usr['name']), $cfg['mainurl'] . '/' . cot_url('pm', '', '', true));
cot_mail($remail, $rsubject, $rbody);
}
示例2: send
public function send($data)
{
if (empty($data['fromName'])) {
$data['fromName'] = cot::$cfg['maintitle'];
}
if (empty($data['fromEmail'])) {
$data['fromEmail'] = cot::$cfg['adminemail'];
}
$fromName = mb_encode_mimeheader($data['fromName'], 'UTF-8', 'B', "\n");
$headers = "From: \"" . $fromName . "\" <" . $data['fromEmail'] . ">\n" . "Reply-To: <" . cot::$cfg['adminemail'] . ">\n";
$ret = cot_mail($data['toEmail'], $data['subject'], $data['body'], $headers, false, null, true);
return $ret;
}
示例3: sprintf
$rtransfer['trn_status'] = 'canceled';
if ($db->update($db_payments_transfers, $rtransfer, "trn_id=" . $id)) {
$payinfo['pay_userid'] = $transfer['trn_from'];
$payinfo['pay_area'] = 'balance';
$payinfo['pay_code'] = $id;
$payinfo['pay_summ'] = $transfer['pay_summ'];
$payinfo['pay_cdate'] = $sys['now'];
$payinfo['pay_pdate'] = $sys['now'];
$payinfo['pay_adate'] = $sys['now'];
$payinfo['pay_status'] = 'done';
$payinfo['pay_desc'] = sprintf($L['payments_balance_transfer_cancel_desc'], $id);
$db->insert($db_payments, $payinfo);
// Отправка уведомления об отмене перевода
$subject = $L['payments_balance_transfer_cancel_subject'];
$body = sprintf($L['payments_balance_transfer_cancel_body'], $transfer['user_name'], $id);
cot_mail($transfer['user_email'], $subject, $body);
}
cot_redirect(cot_url('admin', 'm=payments&p=payouts'));
}
$where = array();
if (!empty($sq)) {
$where['search'] = "(u.user_name LIKE '%" . $db->prep($sq) . "%' OR u.user_email LIKE '%" . $db->prep($sq) . "%')";
}
$where = array_filter($where);
$where = $where ? 'WHERE ' . implode(' AND ', $where) : '';
$transfers = $db->query("SELECT * FROM {$db_payments_transfers} AS t\n\t\tLEFT JOIN {$db_users} AS u ON u.user_id=t.trn_from\n\t\tLEFT JOIN {$db_payments} AS p ON p.pay_code=t.trn_id AND p.pay_area='transfer'\n\t\t{$where}\n\t\tORDER BY pay_cdate DESC")->fetchAll();
if (count($transfers) > 0) {
foreach ($transfers as $transfer) {
$t->assign(array('TRANSFER_ROW_ID' => $transfer['trn_id'], 'TRANSFER_ROW_SUMM' => $transfer['trn_summ'], 'TRANSFER_ROW_COMMENT' => $transfer['trn_comment'], 'TRANSFER_ROW_DATE' => $transfer['trn_date'], 'TRANSFER_ROW_DONE' => $transfer['trn_done'], 'TRANSFER_ROW_STATUS' => $transfer['trn_status'], 'TRANSFER_ROW_LOCALSTATUS' => $L['payments_balance_payout_status_' . $transfer['trn_status']], 'TRANSFER_ROW_DONE_URL' => cot_url('admin', 'm=payments&p=transfers&a=done&id=' . $transfer['trn_id']), 'TRANSFER_ROW_CANCEL_URL' => cot_url('admin', 'm=payments&p=transfers&a=cancel&id=' . $transfer['trn_id'])));
$t->assign(cot_generate_usertags($transfer['trn_from'], 'TRANSFER_ROW_FROM_'));
$t->assign(cot_generate_usertags($transfer['trn_to'], 'TRANSFER_ROW_FOR_'));
示例4: cot_sbr_sendpost
function cot_sbr_sendpost($id, $text, $to, $from = 0, $type = '', $mail = false, $rfiles = array())
{
global $db, $db_sbr_posts, $db_sbr, $db_sbr_files, $db_users, $sys, $cfg, $L, $R;
$rpost['post_sid'] = $id;
$rpost['post_text'] = $text;
$rpost['post_date'] = $sys['now'];
$rpost['post_from'] = $from;
$rpost['post_to'] = $to;
$rpost['post_type'] = $type;
/* === Hook === */
foreach (cot_getextplugins('sbr.post.add.query') as $pl) {
include $pl;
}
/* ===== */
if ($db->insert($db_sbr_posts, $rpost)) {
$postid = $db->lastInsertId();
$sbr_path = $cfg['plugin']['sbr']['filepath'] . '/' . $id . '/';
if (!file_exists($sbr_path)) {
mkdir($sbr_path);
@chmod($sbr_path, $cfg['dir_perms']);
}
for ($j = 0; $j < 10; $j++) {
if ($rfiles['size'][$j] > 0 && $rfiles['error'][$j] == 0) {
$u_tmp_name_file = $rfiles['tmp_name'][$j];
$u_type_file = $rfiles['type'][$j];
$u_name_file = $rfiles['name'][$j];
$u_size_file = $rfiles['size'][$j];
$u_name_file = str_replace("\\'", '', $u_name_file);
$u_name_file = trim(str_replace("\"", '', $u_name_file));
$dotpos = strrpos($u_name_file, ".") + 1;
$f_extension = substr($u_name_file, $dotpos, 5);
if (!empty($u_tmp_name_file)) {
$fcheck = cot_file_check($u_tmp_name_file, $u_name_file, $f_extension);
if ($fcheck == 1) {
if (in_array($f_extension, explode(',', $cfg['plugin']['sbr']['extensions']))) {
$u_newname_file = $postid . "_" . md5(uniqid(rand(), true)) . "." . $f_extension;
$file = $sbr_path . $u_newname_file;
move_uploaded_file($u_tmp_name_file, $file);
@chmod($file, 0766);
$rfile['file_sid'] = $id;
$rfile['file_url'] = $file;
$rfile['file_title'] = $u_name_file;
$rfile['file_area'] = 'post';
$rfile['file_code'] = $postid;
$rfile['file_ext'] = $f_extension;
$rfile['file_size'] = floor($u_size_file / 1024);
$db->insert($db_sbr_files, $rfile);
}
}
}
}
}
// Отправка сообщения на почту!
if ($mail) {
$sbr = $db->query("SELECT * FROM {$db_sbr} WHERE sbr_id=" . $id)->fetch();
if (!empty($to)) {
$recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $to)->fetch();
} else {
$recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_performer'])->fetch();
$recipients[] = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $sbr['sbr_employer'])->fetch();
}
if (!empty($from)) {
$sender = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $from)->fetch();
}
foreach ($recipients as $recipient) {
if (!empty($from)) {
$rsubject = cot_rc($L['sbr_mail_posts_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
$rbody = cot_rc($L['sbr_mail_posts_body'], array('user_name' => $recipient['user_name'], 'sender_name' => $sender['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
} else {
$rsubject = cot_rc($L['sbr_mail_notification_header'], array('sbr_id' => $id, 'sbr_title' => $sbr['sbr_title']));
$rbody = cot_rc($L['sbr_mail_notification_body'], array('user_name' => $recipient['user_name'], 'post_text' => $text, 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
}
cot_mail($recipient['user_email'], $rsubject, $rbody, '', false, null, true);
}
}
/* === Hook === */
foreach (cot_getextplugins('sbr.post.add.done') as $pl) {
include $pl;
}
/* ===== */
return $db->lastInsertId();
}
return false;
}
示例5: array
}
/* ===== */
$prj = array();
if ($cfg['projects']['prevalidate'] && !$usr['isadmin']) {
$prj['item_state'] = 2;
$r_url = empty($ritem['item_alias']) ? cot_url('projects', 'c=' . $ritem['item_cat'] . '&id=' . $id, '', true) : cot_url('projects', 'c=' . $ritem['item_cat'] . '&al=' . $ritem['item_alias'], '', true);
if (!$usr['isadmin']) {
$rbody = cot_rc($L['project_senttovalidation_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
cot_mail($item['user_email'], $L['project_senttovalidation_mail_subj'], $rbody);
}
} else {
$prj['item_state'] = 0;
$r_url = empty($item['item_alias']) ? cot_url('projects', 'c=' . $item['item_cat'] . '&id=' . $id, '', true) : cot_url('projects', 'c=' . $item['item_cat'] . '&al=' . $item['item_alias'], '', true);
if (!$usr['isadmin']) {
$rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $item['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', 'id=' . $id, '', true)));
cot_mail($item['user_email'], $L['project_added_mail_subj'], $rbody);
}
}
$db->update($db_projects, $prj, "item_id=" . (int) $id);
cot_projects_sync($item['item_cat']);
/* === Hook === */
foreach (cot_getextplugins('projects.preview.save.done') as $pl) {
include $pl;
}
/* ===== */
cot_redirect($r_url);
exit;
}
$out['subtitle'] = $L['projects'];
$mskin = cot_tplfile(array('projects', 'preview', $structure['projects'][$item['item_cat']]['tpl']));
/* === Hook === */
示例6: foreach
foreach (cot_getextplugins('projects.offers.addpost.error') as $pl) {
include $pl;
}
/* ===== */
if (!empty($offer_post['post_text']) && (in_array($usr['id'], array($offer['offer_userid'], $item['item_userid'])) || $usr['isadmin']) && !cot_error_found()) {
$db->insert($db_projects_posts, $offer_post);
if ($usr['id'] == $offer['offer_userid']) {
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
$rbody = cot_rc($L['project_added_post_body'], array('user_name' => $item['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
cot_mail($item['user_email'], $rsubject, $rbody);
} else {
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $item['item_id']) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$rsubject = cot_rc($L['project_added_post_header'], array('prtitle' => $item['item_title']));
$rbody = cot_rc($L['project_added_post_body'], array('user_name' => $offer['user_name'], 'postuser_name' => $usr['profile']['user_name'], 'prj_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', $urlparams, '', true)));
cot_mail($offer['user_email'], $rsubject, $rbody);
}
cot_message($L['offers_add_post'], 'ok');
/* === Hook === */
foreach (cot_getextplugins('projects.offers.addpost.done') as $pl) {
include $pl;
}
/* ===== */
}
cot_redirect(cot_url('projects', 'id=' . $id, '', true));
exit;
}
$t_o = new XTemplate(cot_tplfile(array('projects', 'offers', $structure['projects'][$item['item_cat']]['tpl'])));
// Вычисление выбранного исполнителя по проекту
if ($item['item_performer']) {
$t_o->assign(cot_generate_usertags($item['item_performer'], 'PRJ_PERFORMER_'));
示例7: cot_user_full_name
$advCommenterName = cot::$L['Anonymous'];
$advCommenterUrl = '';
if (cot::$usr['id'] > 0) {
$advCommenterName = cot_user_full_name(cot::$usr['profile']);
$advCommenterUrl = cot_url('users', array('m' => 'details', 'id' => cot::$usr['id'], 'u' => htmlspecialchars(cot::$usr['name'])));
if (!cot_url_check($advCommenterUrl)) {
$advCommenterUrl = COT_ABSOLUTE_URL . $advCommenterUrl;
}
} elseif ($comarray['com_author'] != '') {
$advCommenterName = $comarray['com_author'];
}
// /Автор комментария
$mailView = new View();
$mailView->advert = $advert;
$mailView->owner = $owner;
$mailView->commentText = $advComText;
$mailView->commentUrl = $advertUrl . "#c" . $id;
$mailView->commenter = cot::$usr['id'] > 0 ? cot::$usr['profile'] : array();
$mailView->commenterName = $advCommenterName;
$mailView->commenterUrl = $advCommenterUrl;
$mailView->advertUrl = $advertUrl;
$mailView->advertEditUrl = $advertEditUrl;
$mailView->myAdvsUrl = $myAdvsUrl;
$mailView->advertText = $text;
$mailSubject = cot::$L['advboard_new_comment'];
$mailBody = $mailView->render('advboard.notify_comment.' . $userLang . '.' . $advert->category);
cot_mail($advert->getEmail(false, true), $mailSubject, $mailBody, '', false, null, true);
// Вернем язык на место
cot::$L = $tmpL;
}
}
示例8: array
if ($a == 'public') {
$ritem = array();
if ($cfg['folio']['prevalidate']) {
$ritem['item_state'] = $usr['isadmin'] ? 0 : 2;
} else {
$ritem['item_state'] = 0;
}
$urlparams = empty($item['item_alias']) ? array('c' => $item['item_cat'], 'id' => $id) : array('c' => $item['item_cat'], 'al' => $item['item_alias']);
$r_url = cot_url('folio', $urlparams, '', true);
if (!$usr['isadmin']) {
if ($ritem['item_state'] == 2) {
$rbody = cot_rc($L['folio_senttovalidation_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prd_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
cot_mail($usr['profile']['user_email'], $L['folio_senttovalidation_mail_subj'], $rbody);
} else {
$rbody = cot_rc($L['folio_added_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prd_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
cot_mail($usr['profile']['user_email'], $L['folio_added_mail_subj'], $rbody);
}
}
$db->update($db_folio, $ritem, 'item_id = ?', $id);
cot_folio_sync($item['item_cat']);
/* === Hook === */
foreach (cot_getextplugins('folio.edit.public') as $pl) {
include $pl;
}
/* ===== */
cot_redirect($r_url);
exit;
}
if ($a == 'hide') {
$ritem = array();
$ritem['item_state'] = 1;
示例9: sprintf
$payinfo['pay_summ'] = $recipientsumm;
$payinfo['pay_cdate'] = $sys['now'];
$payinfo['pay_pdate'] = $sys['now'];
$payinfo['pay_adate'] = $sys['now'];
$payinfo['pay_status'] = 'done';
$payinfo['pay_desc'] = sprintf($L['payments_balance_transfer_desc'], $usr['name'], $recipient['user_name'], $comment);
$db->insert($db_payments, $payinfo);
$pid = $db->lastInsertId();
// Отправка уведомления админу о переводе между пользователями
$subject = $L['payments_balance_transfer_admin_subject'];
$body = sprintf($L['payments_balance_transfer_admin_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment);
cot_mail($cfg['adminemail'], $subject, $body);
// Отправка уведомления админу о переводе между пользователями
$subject = $L['payments_balance_transfer_recipient_subject'];
$body = sprintf($L['payments_balance_transfer_recipient_body'], $usr['name'], $recipient['user_name'], $summ, $taxsumm, $sendersumm, $recipientsumm, $cfg['payments']['valuta'], cot_date('d.m.Y в H:i', $sys['now']), $comment);
cot_mail($recipient['user_email'], $subject, $body);
cot_redirect(cot_url('payments', 'm=balance&n=history', '', true));
}
cot_redirect(cot_url('payments', 'm=balance&n=transfer', '', true));
}
cot_display_messages($t, 'MAIN.TRANSFERFORM');
$t->assign(array('TRANSFER_FORM_ACTION_URL' => cot_url('payments', 'm=balance&n=transfer&a=add'), 'TRANSFER_FORM_SUMM' => cot_inputbox('text', 'summ', $summ), 'TRANSFER_FORM_TAX' => $taxsumm, 'TRANSFER_FORM_TOTAL' => !empty($sendersumm) ? $sendersumm : 0, 'TRANSFER_FORM_COMMENT' => $comment, 'TRANSFER_FORM_USERNAME' => $username));
$t->parse('MAIN.TRANSFERFORM');
}
if ($n == 'history') {
$pays = $db->query("SELECT * FROM {$db_payments} \n\t\tWHERE pay_userid=" . $usr['id'] . " AND pay_status='done' AND pay_summ>0\n\t\tORDER BY pay_pdate DESC")->fetchAll();
foreach ($pays as $pay) {
$t->assign(cot_generate_paytags($pay, 'HIST_ROW_'));
$t->parse('MAIN.HISTORY.HIST_ROW');
}
$t->parse('MAIN.HISTORY');
示例10: foreach
// Выплаты продавцам по завершению гарантийного срока по оформленным заказам
$warranty = $cfg['plugin']['marketorders']['warranty'] * 60 * 60 * 24;
$marketorders = $db->query("SELECT * FROM {$db_market_orders} AS o\n\tLEFT JOIN {$db_market} AS m ON m.item_id=o.order_pid\n\tWHERE order_status='paid' AND order_paid+" . $warranty . "<" . $sys['now'])->fetchAll();
foreach ($marketorders as $marketorder) {
// Выплата продавцу на счет
$seller = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $marketorder['order_seller'])->fetch();
$summ = $marketorder['order_cost'] - $marketorder['order_cost'] * $cfg['plugin']['marketorders']['tax'] / 100;
$payinfo['pay_userid'] = $marketorder['order_seller'];
$payinfo['pay_area'] = 'balance';
$payinfo['pay_code'] = 'marketorders:' . $marketorder['order_id'];
$payinfo['pay_summ'] = $summ;
$payinfo['pay_cdate'] = $sys['now'];
$payinfo['pay_pdate'] = $sys['now'];
$payinfo['pay_adate'] = $sys['now'];
$payinfo['pay_status'] = 'done';
$payinfo['pay_desc'] = cot_rc($L['marketorders_done_payments_desc'], array('product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id']));
if ($db->insert($db_payments, $payinfo)) {
// Уведомляем продавца о поступлении оплаты на его счет
$rsubject = cot_rc($L['marketorders_done_mail_toseller_header'], array('order_id' => $marketorder['order_id'], 'product_title' => $marketorder['item_title']));
$rbody = cot_rc($L['marketorders_done_mail_toseller_body'], array('product_id' => $marketorder['item_id'], 'product_title' => $marketorder['item_title'], 'order_id' => $marketorder['order_id'], 'summ' => $summ . ' ' . $cfg['payments']['valuta'], 'tax' => $cfg['plugin']['marketorders']['tax'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('marketorders', "id=" . $marketorder['order_id'], '', true)));
cot_mail($seller['user_email'], $rsubject, $rbody);
$rorder['order_done'] = $sys['now'];
$rorder['order_status'] = 'done';
$db->update($db_market_orders, $rorder, "order_id=" . $marketorder['order_id']);
/* === Hook === */
foreach (cot_getextplugins('marketorders.order.done') as $pl) {
include $pl;
}
/* ===== */
}
}
示例11: floor
$rfile['file_title'] = $u_name_file;
$rfile['file_area'] = 'stage';
$rfile['file_code'] = $i;
$rfile['file_ext'] = $f_extension;
$rfile['file_size'] = floor($u_size_file / 1024);
$db->insert($db_sbr_files, $rfile);
}
}
}
}
}
}
$performer = $db->query("SELECT * FROM {$db_users} WHERE user_id=" . $rsbr['sbr_performer'])->fetch();
$rsubject = cot_rc($L['sbr_mail_toperformer_new_header'], array('sbr_title' => $rsbr['sbr_title']));
$rbody = cot_rc($L['sbr_mail_toperformer_new_body'], array('performer_name' => $performer['user_name'], 'employer_name' => $usr['profile']['user_name'], 'sbr_title' => $rsbr['sbr_title'], 'sbr_cost' => $rsbr['sbr_cost'] . ' ' . $cfg['payments']['valuta'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('sbr', "id=" . $id, '', true)));
cot_mail($performer['user_email'], $rsubject, $rbody);
cot_sbr_sendpost($id, $L['sbr_posts_performer_new'], $rsbr['sbr_performer'], 0, 'info');
cot_sbr_sendpost($id, $L['sbr_posts_employer_new'], $usr['id'], 0, 'info');
/* === Hook === */
foreach (cot_getextplugins('sbr.add.add.done') as $pl) {
include $pl;
}
/* ===== */
cot_redirect(cot_url('sbr', 'id=' . $id, '', true));
}
}
$out['subtitle'] = $L['sbr_addtitle'];
$out['head'] .= $R['code_noindex'];
$mskin = cot_tplfile(array('sbr', 'add'), 'plug');
/* === Hook === */
foreach (cot_getextplugins('sbr.add.main') as $pl) {
示例12: switch
switch ($ritem['item_state']) {
case 0:
if (!$usr['isadmin']) {
$rbody = cot_rc($L['project_added_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('projects', 'id=' . $id, '', true)));
cot_mail($usr['profile']['user_email'], $L['project_added_mail_subj'], $rbody);
}
$urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
$r_url = cot_url('projects', $urlparams, '', true);
break;
case 1:
$r_url = cot_url('projects', 'm=preview&id=' . $id, '', true);
break;
case 2:
if (!$usr['isadmin']) {
$rbody = cot_rc($L['project_senttovalidation_mail_body'], array('user_name' => $usr['profile']['user_name'], 'prj_name' => $ritem['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . $r_url));
cot_mail($usr['profile']['user_email'], $L['project_senttovalidation_mail_subj'], $rbody);
}
$urlparams = empty($ritem['item_alias']) ? array('c' => $ritem['item_cat'], 'id' => $id) : array('c' => $ritem['item_cat'], 'al' => $ritem['item_alias']);
$r_url = cot_url('projects', $urlparams, '', true);
break;
}
cot_redirect($r_url);
exit;
} else {
cot_redirect(cot_url('projects', 'm=add&c=' . $c . '&type=' . $type, '', true));
}
}
if (empty($ritem['item_cat']) && !empty($c)) {
$ritem['item_cat'] = $c;
$usr['isadmin'] = cot_auth('projects', $ritem['item_cat'], 'A');
}
示例13: cot_redirect
cot_redirect(cot_url('admin', 'm=market&p=default', '', true));
break;
case 'validate':
foreach ($prd_arr as $prd_id) {
/* === Hook: Part 1 === */
foreach ($extpl as $pl) {
include $pl;
}
/* ===== */
$sql = $db->query("SELECT * FROM {$db_market} AS m LEFT JOIN {$db_users} AS u ON u.user_id=m.item_userid WHERE item_id='{$prd_id}' LIMIT 1");
cot_die($sql->rowCount() == 0);
$item = $sql->fetch();
$db->update($db_market, array('item_state' => 0), "item_id=?", array($prd_id));
cot_market_sync($item['item_cat']);
$rbody = cot_rc($L['market_added_mail_body'], array('user_name' => $item['user_name'], 'prd_name' => $item['item_title'], 'sitename' => $cfg['maintitle'], 'link' => COT_ABSOLUTE_URL . cot_url('market', 'id=' . $prd_id, '', true)));
cot_mail($item['user_email'], $L['market_added_mail_subj'], $rbody);
/* === Hook: Part 2 === */
foreach ($extpl1 as $pl) {
include $pl;
}
/* ===== */
}
cot_redirect(cot_url('admin', 'm=market&p=default', '', true));
break;
default:
cot_redirect(cot_url('admin', 'm=market&p=default', '', true));
break;
}
}
$t = new XTemplate(cot_tplfile('market.admin.default', 'module'));
$where = array();
示例14: ajxSubscribeAction
/**
* Обработка Ajax запроса на подписку на рассылку
* Используется виджетом
* Принимает email пользователя
* Допускается подписка неавторизованными пользователями (они должны подтвердить email)
*/
public function ajxSubscribeAction()
{
global $db_users;
$ret = array('error' => '', 'message' => '');
$id = cot_import('id', 'P', 'INT');
$email = cot_import('email', 'P', 'TXT');
if (!$id) {
$ret['error'] = cot::$L['subscribe_err_not_found'];
echo json_encode($ret);
exit;
}
$subscribe = subscribe_model_Subscribe::getById($id);
if (!$subscribe) {
$ret['error'] = cot::$L['subscribe_err_not_found'];
echo json_encode($ret);
exit;
}
if (!$subscribe->active) {
$ret['error'] = cot::$L['subscribe_err_disabled'];
echo json_encode($ret);
exit;
}
if (empty($email)) {
$ret['error'] = cot::$L['field_required'] . ': ' . cot::$L['Email'];
echo json_encode($ret);
exit;
}
$tmp = subscribe_checkEmail($email);
if ($tmp !== true) {
$ret['error'] = $tmp;
echo json_encode($ret);
exit;
}
$email = mb_strtolower($email);
$subscriber = subscribe_model_Subscriber::fetchOne(array(array('subscribe', $id), array('email', $email)));
if ($subscriber) {
if ($subscriber->active) {
$ret['error'] = sprintf(cot::$L['subscribe_err_user_subscribed'], $email, $subscribe->title);
echo json_encode($ret);
exit;
}
} else {
$subscriber = new subscribe_model_Subscriber();
}
$sql = cot::$db->query("SELECT * FROM {$db_users} WHERE user_email = ? LIMIT 1", $email);
$user = $sql->fetch();
$subscriber->subscribe = $id;
$subscriber->email = $email;
if (!empty($user)) {
$subscriber->user = $user['user_id'];
$subscriber->name = cot_user_full_name($user);
}
$needConfirm = cot::$cfg['subscribe']['guestConfirmMail'];
if (cot::$usr['id'] > 0) {
if (cot::$usr['id'] == $user['user_id'] || cot::$usr['isadmin']) {
$needConfirm = false;
}
}
if ($needConfirm) {
// Возможно пользователь уже подтверждал свой email
$tmp = subscribe_model_Subscriber::count(array(array('email', $email), array('email_valid', 1)));
if ($tmp > 0) {
$needConfirm = false;
}
}
if (!$needConfirm) {
$subscriber->email_valid = 1;
$subscriber->email_valid_date = date('Y-m-d H:i:s', cot::$sys['now']);
$subscriber->active = 1;
}
// Сохранение
$subscriber->save();
$ret['message'] = sprintf(cot::$L['subscribe_msg_you_subscribed'], $subscribe->title);
// Письмо для поджтверждения e-mail адреса
if ($needConfirm) {
$confirmUrl = cot_url('subscribe', array('m' => 'user', 'a' => 'confirm', 'code' => $subscriber->unsubscr_code));
if (!cot_url_check($confirmUrl)) {
$confirmUrl = cot::$cfg['mainurl'] . '/' . $confirmUrl;
}
$mailView = new View();
$mailView->subscriber = $subscriber;
$mailView->subscribe = $subscribe;
$mailView->confirmUrl = $confirmUrl;
$mailTpl = array('subscribe', 'mail_confirm', cot::$usr['lang']);
$mailBody = $mailView->render($mailTpl);
cot_mail($email, cot::$L['subscribe_confirm'], $mailBody, '', false, null, true);
$ret['message'] .= cot::$L['subscribe_wait_confirm'];
}
echo json_encode($ret);
exit;
}
示例15: str_replace
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$url_params['c']]['path']));
}
if ($cfg['cache_index']) {
$cache->page->clear('index');
}
}
$cfg['cache_page'] = $cfg['cache_index'] = false;
cot_extrafield_movefiles();
$_SESSION['cot_comments_edit'][$id] = $sys['now'];
if ($cfg['plugin']['comments']['mail']) {
$sql = $db->query("SELECT * FROM {$db_users} WHERE user_maingrp=5");
$email_title = $L['plu_comlive'];
$email_body = $L['User'] . ' ' . preg_replace('#[^\\w\\p{L}]#u', '', $usr['id'] == 0 ? $rname : $usr['name']) . ' ' . $L['plu_comlive2'];
$email_body .= COT_ABSOLUTE_URL . cot_url($url_area, $url_params, '#c' . $id, true) . "\n\n";
while ($adm = $sql->fetch()) {
cot_mail($adm['user_email'], $email_title, $email_body);
}
$sql->closeCursor();
}
/* == Hook == */
foreach (cot_getextplugins('comments.send.new') as $pl) {
include $pl;
}
/* ===== */
cot_message($L['com_commentadded']);
cot_shield_update(20, 'New comment');
cot_redirect(cot_url($url_area, $url_params, '#c' . $id, true));
}
if ($usr['id'] == 0 && $area == 'page' && $cache) {
if ($cfg['cache_page']) {
$cache->page->clear('page/' . str_replace('.', '/', $structure['page'][$url_params['c']]['path']));