本文整理汇总了PHP中osc_sendMail函数的典型用法代码示例。如果您正苦于以下问题:PHP osc_sendMail函数的具体用法?PHP osc_sendMail怎么用?PHP osc_sendMail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osc_sendMail函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: new_pm_email
/**
* Send email to user when they get a new PM
*
* @param integer $item
* @param integer $offer_value
*
* @dynamic tags
*
* '{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}'
*/
function new_pm_email($pm_info)
{
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_PM_alert');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
if ($pm_info['sender_id'] == 0) {
$sender_name = pmAdmin();
} else {
$pm_senderData = User::newInstance()->findByPrimaryKey($pm_info['sender_id']);
$sender_name = $pm_senderData['s_name'];
}
if ($pm_info['recip_id'] == 0) {
$pm_url = osc_admin_base_url(true) . '?page=plugins&action=renderplugin&file=osclass_pm/admin-send.php?userId=' . $pm_info['sender_id'] . '&mType=adminQuote&messId=' . $pm_info['pm_id'];
$pm_name = pmAdmin();
$pm_recipData['s_email'] = osc_contact_email();
} else {
$pm_url = osc_base_url(true) . '?page=custom&file=osclass_pm/user-send.php?userId=' . $pm_info['sender_id'] . '&mType=quote&messId=' . $pm_info['pm_id'];
$pm_recipData = User::newInstance()->findByPrimaryKey($pm_info['recip_id']);
$pm_name = $pm_recipData['s_name'];
}
$pm_url = '<a href="' . $pm_url . '" >' . $pm_url . '</a>';
$words = array();
$words[] = array('{RECIP_NAME}', '{SENDER_NAME}', '{WEB_URL}', '{WEB_TITLE}', '{PM_URL}', '{PM_SUBJECT}', '{PM_MESSAGE}', '[quote]', '[/quote]', '[quoteAuthor]', '[/quoteAuthor]');
$words[] = array($pm_name, $sender_name, osc_base_url(), osc_page_title(), $pm_url, $pm_info['pm_subject'], nl2br($pm_info['pm_message']), '<div class="messQuote">', '</div>', '<div class="quoteAuthor">', '</div>');
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $pm_recipData['s_email'], 'to_name' => $pm_name, 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
示例2: doModel
function doModel()
{
switch ($this->action) {
case 'contact_post':
//contact_post
$yourName = Params::getParam('yourName');
$yourEmail = Params::getParam('yourEmail');
$subject = Params::getParam('subject');
$message = Params::getParam('message');
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
Session::newInstance()->_setForm("yourName", $yourName);
Session::newInstance()->_setForm("yourEmail", $yourEmail);
Session::newInstance()->_setForm("subject", $subject);
Session::newInstance()->_setForm("message_body", $message);
$this->redirectTo(osc_contact_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
if (!preg_match('|.*?@.{2,}\\..{2,}|', $yourEmail)) {
osc_add_flash_error_message(_m('Please enter a correct email'));
Session::newInstance()->_setForm("yourName", $yourName);
Session::newInstance()->_setForm("subject", $subject);
Session::newInstance()->_setForm("message_body", $message);
$this->redirectTo(osc_contact_url());
}
$message = sprintf(__("%s (%s) left this message : %s"), $yourName, $yourEmail, $message);
$params = array('reply_to' => $yourEmail, 'subject' => '[' . osc_page_title() . '] ' . __('Contact form') . ': ' . $subject, 'to' => osc_contact_email(), 'to_name' => __('Administrator'), 'body' => $message, 'alt_body' => $message);
if (osc_contact_attachment()) {
$attachment = Params::getFiles('attachment');
$resourceName = $attachment['name'];
$tmpName = $attachment['tmp_name'];
$resourceType = $attachment['type'];
$path = osc_content_path() . 'uploads/' . time() . '_' . $resourceName;
if (!is_writable(osc_content_path() . 'uploads/')) {
osc_add_flash_error_message(_m('There have been some errors sending the message'));
$this->redirectTo(osc_contact_url());
}
if (!move_uploaded_file($tmpName, $path)) {
unset($path);
}
}
if (isset($path)) {
$params['attachment'] = $path;
}
osc_sendMail($params);
osc_add_flash_ok_message(_m('Your email has been sent properly. Thank you for contacting us!'));
$this->redirectTo(osc_contact_url());
break;
default:
//contact
$this->doView('contact.php');
}
}
示例3: email_link_problem
function email_link_problem($url_from, $url_to, $contact)
{
$page = new Page();
$page = $page->findByInternalName('seo_link_problem');
if (empty($page)) {
exit;
}
$locale = osc_current_user_locale();
$content = array();
if (isset($page['locale'][$locale]['s_title'])) {
$content = $page['locale'][$locale];
} else {
$content = current($page['locale']);
}
$words = array();
$words[] = array('{LINK_FROM}', '{LINK_TO}');
$words[] = array($url_from, $url_to);
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$email_build = array('subject' => $title, 'to' => $contact, 'to_name' => 'Partner', 'body' => $body, 'alt_body' => $body);
osc_sendMail($email_build);
}
示例4: fn_email_new_comment_user
function fn_email_new_comment_user($aItem)
{
$authorName = trim($aItem['authorName']);
$authorName = strip_tags($authorName);
$authorEmail = trim($aItem['authorEmail']);
$authorEmail = strip_tags($authorEmail);
$body = trim($aItem['body']);
$body = strip_tags($body);
$title = $aItem['title'];
$itemId = $aItem['id'];
$userId = $aItem['userId'];
$admin_email = osc_contact_email();
$prefLocale = osc_language();
$item = Item::newInstance()->findByPrimaryKey($itemId);
View::newInstance()->_exportVariableToView('item', $item);
$itemURL = osc_item_url();
$itemURL = '<a href="' . $itemURL . '" >' . $itemURL . '</a>';
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_new_comment_user');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$words = array();
$words[] = array('{COMMENT_AUTHOR}', '{COMMENT_EMAIL}', '{COMMENT_TITLE}', '{COMMENT_TEXT}', '{ITEM_TITLE}', '{ITEM_ID}', '{ITEM_URL}', '{SELLER_NAME}', '{SELLER_EMAIL}');
$words[] = array($authorName, $authorEmail, $title, $body, $item['s_title'], $itemId, $itemURL, $item['s_contact_name'], $item['s_contact_email']);
$title_email = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_new_comment_user_title', $content['s_title'])), $words);
$body_email = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_new_comment_user_description', $content['s_text'])), $words);
$from = osc_contact_email();
$from_name = osc_page_title();
$emailParams = array('from' => $admin_email, 'from_name' => __('Admin mail system'), 'subject' => $title_email, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body_email, 'alt_body' => $body_email);
osc_sendMail($emailParams);
}
示例5: moreedit_moderate_edit
function moreedit_moderate_edit($item_)
{
$cat_id = $item_['fk_i_category_id'];
$item_id = $item_['pk_i_id'];
if (osc_get_preference('notify_edit', 'moreedit') == '1') {
$aPage = Page::newInstance()->findByInternalName('email_moreedit_notify_edit');
$content = array();
$locale = osc_current_user_locale();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$item = Item::newInstance()->findByPrimaryKey($item_id);
View::newInstance()->_exportVariableToView('item', $item);
$item_url = osc_item_url();
$item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
$admin_edit_url = osc_item_admin_edit_url($item['pk_i_id']);
$words = array();
$words[] = array('{EDIT_LINK}', '{EDIT_URL}', '{ITEM_DESCRIPTION}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}');
$words[] = array('<a href="' . $admin_edit_url . '" >' . $admin_edit_url . '</a>', $admin_edit_url, $item['s_description'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title());
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
if (osc_get_preference('moderate_edit', 'moreedit') == '1') {
Item::newInstance()->update(array('b_enabled' => 0), array('pk_i_id' => $item_id));
}
}
示例6: item_expired_email
/**
* Send email to users when their ad has expired
*
* @param array $item
* @param string $r_secret
* @param integer $permDeleted
*
* @dynamic tags
*
* '{CONTACT_NAME}', '{ITEM_TITLE}',
* '{WEB_TITLE}', '{REPUBLISH_URL}', '{PERM_DELETED}'
*/
function item_expired_email($itemId, $r_secret, $permDeleted)
{
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_ad_expired');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$item = Item::newInstance()->findByPrimaryKey($itemId);
$secret = '';
$secret = '&secret=' . $item['s_secret'];
$republish_url = osc_base_url() . 'oc-content/plugins/advanced_ad_management/item_republish.php?id=' . $item['pk_i_id'] . '&repub=republish&rSecret=' . $r_secret . $secret;
$republish_url = '<a href="' . $republish_url . '" >' . $republish_url . '</a>';
$words = array();
$words[] = array('{CONTACT_NAME}', '{ITEM_TITLE}', '{WEB_TITLE}', '{REPUBLISH_URL}', '{PERM_DELETED}');
$words[] = array($item['s_contact_name'], $item['s_title'], osc_page_title(), $republish_url, $permDeleted);
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
示例7: doModel
function doModel()
{
switch ($this->action) {
case 'login_post':
//post execution for the login
$admin = Admin::newInstance()->findByUsername(Params::getParam('user'));
if ($admin) {
if ($admin["s_password"] == sha1(Params::getParam('password'))) {
if (Params::getParam('remember')) {
//this include contains de osc_genRandomPassword function
require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
$secret = osc_genRandomPassword();
Admin::newInstance()->update(array('s_secret' => $secret), array('pk_i_id' => $admin['pk_i_id']));
Cookie::newInstance()->set_expires(osc_time_cookie());
Cookie::newInstance()->push('oc_adminId', $admin['pk_i_id']);
Cookie::newInstance()->push('oc_adminSecret', $secret);
Cookie::newInstance()->push('oc_adminLocale', Params::getParam('locale'));
Cookie::newInstance()->set();
}
//we are logged in... let's go!
Session::newInstance()->_set('adminId', $admin['pk_i_id']);
Session::newInstance()->_set('adminUserName', $admin['s_username']);
Session::newInstance()->_set('adminName', $admin['s_name']);
Session::newInstance()->_set('adminEmail', $admin['s_email']);
Session::newInstance()->_set('adminLocale', Params::getParam('locale'));
} else {
osc_add_flash_message(_m('The password is incorrect'), 'admin');
}
} else {
osc_add_flash_message(_m('That username does not exist'), 'admin');
}
//returning logged in to the main page...
$this->redirectTo(osc_admin_base_url());
break;
case 'recover':
//form to recover the password (in this case we have the form in /gui/)
//#dev.conquer: we cannot use the doView here and only here
$this->doView('gui/recover.php');
break;
case 'recover_post':
//post execution to recover the password
$admin = Admin::newInstance()->findByEmail(Params::getParam('email'));
if ($admin) {
if (osc_recaptcha_private_key() != '' && Params::existParam("recaptcha_challenge_field")) {
if (!osc_check_recaptcha()) {
osc_add_flash_message(_m('The Recaptcha code is wrong'), 'admin');
$this->redirectTo(osc_admin_base_url(true) . '?page=login&action=recover');
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
require_once osc_lib_path() . 'osclass/helpers/hSecurity.php';
$newPassword = osc_genRandomPassword(40);
Admin::newInstance()->update(array('s_secret' => $newPassword), array('pk_i_id' => $admin['pk_i_id']));
$password_link = osc_forgot_admin_password_confirm_url($admin['pk_i_id'], $newPassword);
$aPage = Page::newInstance()->findByInternalName('email_user_forgot_password');
$content = array();
$locale = osc_current_user_locale();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
if (!is_null($content)) {
$words = array();
$words[] = array('{USER_NAME}', '{USER_EMAIL}', '{WEB_TITLE}', '{IP_ADDRESS}', '{PASSWORD_LINK}', '{DATE_TIME}');
$words[] = array($admin['s_name'], $admin['s_email'], osc_page_title(), $_SERVER['REMOTE_ADDR'], $password_link, date(osc_time_format() . ' ' . osc_date_format()));
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $admin['s_email'], 'to_name' => $admin['s_name'], 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
}
osc_add_flash_message(_m('A new password has been sent to your e-mail'), 'admin');
$this->redirectTo(osc_admin_base_url());
break;
case 'forgot':
//form to recover the password (in this case we have the form in /gui/)
$admin = Admin::newInstance()->findByIdSecret(Params::getParam('adminId'), Params::getParam('code'));
if ($admin) {
$this->doView('gui/forgot_password.php');
} else {
osc_add_flash_message(_m('Sorry, the link is not valid'), 'admin');
$this->redirectTo(osc_admin_base_url());
}
break;
case 'forgot_post':
$admin = Admin::newInstance()->findByIdSecret(Params::getParam('adminId'), Params::getParam('code'));
if ($admin) {
if (Params::getParam('new_password') == Params::getParam('new_password2')) {
Admin::newInstance()->update(array('s_secret' => osc_genRandomPassword(), 's_password' => sha1(Params::getParam('new_password'))), array('pk_i_id' => $admin['pk_i_id']));
osc_add_flash_message(_m('The password has been changed'), 'admin');
$this->redirectTo(osc_admin_base_url());
} else {
osc_add_flash_message(_m('Error, the password don\'t match'), 'admin');
$this->redirectTo(osc_forgot_admin_password_confirm_url(Params::getParam('adminId'), Params::getParam('code')));
}
} else {
osc_add_flash_message(_m('Sorry, the link is not valid'), 'admin');
}
//.........这里部分代码省略.........
示例8: osc_show_flash_message
<?php
osc_show_flash_message('admin');
if (Params::getParam('nepcoders_action') == 'send_email') {
$subject = Params::getParam('subject');
$message = stripslashes($_REQUEST['message']);
$message = str_replace('src="../', 'src="' . osc_base_url() . '/', $message);
$recipients = array();
$recipients = array_merge($recipients, User::newInstance()->listAll());
foreach ($recipients as $user) {
$params = array('subject' => $subject, 'to' => $user['s_email'], 'to_name' => osc_page_title(), 'body' => $message, 'alt_body' => strip_tags($message), 'add_bcc' => '', 'from' => 'donotreply@' . osc_get_domain());
osc_sendMail($params);
osc_add_flash_ok_message(__('Your email has been sent', 'nepcoders'), 'admin');
}
}
?>
<script>
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "emotions,spellchecker,advhr,insertdatetime,preview,fullpage,save,table,template",
// Theme options - button# indicated the row# only
theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,fontselect,fontsizeselect,formatselect",
theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,|,code,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "insertdate,inserttime,|,spellchecker,advhr,,removeformat,|,sub,sup,|,charmap,emotions,|,table,fullpage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
示例9: fn_email_item_validation_non_register_user
function fn_email_item_validation_non_register_user($item)
{
View::newInstance()->_exportVariableToView('item', $item);
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_item_validation_non_register_user');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$item_url = osc_item_url();
$item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
$edit_url = osc_item_edit_url($item['s_secret'], $item['pk_i_id']);
$delete_url = osc_item_delete_url($item['s_secret'], $item['pk_i_id']);
$all = '';
if (isset($item['locale'])) {
foreach ($item['locale'] as $locale => $data) {
$locale_name = OSCLocale::newInstance()->listWhere("pk_c_code = '" . $locale . "'");
$all .= '<br/>';
if (isset($locale_name[0]) && isset($locale_name[0]['s_name'])) {
$all .= __('Language') . ': ' . $locale_name[0]['s_name'] . '<br/>';
} else {
$all .= __('Language') . ': ' . $locale . '<br/>';
}
$all .= __('Title') . ': ' . $data['s_title'] . '<br/>';
$all .= __('Description') . ': ' . $data['s_description'] . '<br/>';
$all .= '<br/>';
}
} else {
$all .= __('Title') . ': ' . $item['s_title'] . '<br/>';
$all .= __('Description') . ': ' . $item['s_description'] . '<br/>';
}
// Format activation URL
$validation_url = osc_item_activate_url($item['s_secret'], $item['pk_i_id']);
$words = array();
$words[] = array('{ITEM_DESCRIPTION_ALL_LANGUAGES}', '{ITEM_DESCRIPTION}', '{ITEM_COUNTRY}', '{ITEM_PRICE}', '{ITEM_REGION}', '{ITEM_CITY}', '{ITEM_ID}', '{USER_NAME}', '{USER_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{VALIDATION_LINK}', '{VALIDATION_URL}', '{EDIT_LINK}', '{EDIT_URL}', '{DELETE_LINK}', '{DELETE_URL}');
$words[] = array($all, $item['s_description'], $item['s_country'], osc_prepare_price($item['s_price']), $item['s_region'], $item['s_city'], $item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], '<a href="' . osc_base_url() . '" >' . osc_base_url() . '</a>', $item['s_title'], $item_url, osc_page_title(), '<a href="' . $validation_url . '" >' . $validation_url . '</a>', $validation_url, '<a href="' . $edit_url . '">' . $edit_url . '</a>', $edit_url, '<a href="' . $delete_url . '">' . $delete_url . '</a>', $delete_url);
$title = osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_item_validation_non_register_user_title', $content['s_title'])), $words);
$body = osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_item_validation_non_register_user_description', $content['s_text'])), $words);
$emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
示例10: doModel
function doModel()
{
switch ($this->action) {
case 'contact_post':
//contact_post
osc_csrf_check();
$yourName = Params::getParam('yourName');
$yourEmail = Params::getParam('yourEmail');
$subject = Params::getParam('subject');
$message = Params::getParam('message');
if (osc_recaptcha_private_key() != '') {
if (!osc_check_recaptcha()) {
osc_add_flash_error_message(_m('The Recaptcha code is wrong'));
Session::newInstance()->_setForm('yourName', $yourName);
Session::newInstance()->_setForm('yourEmail', $yourEmail);
Session::newInstance()->_setForm('subject', $subject);
Session::newInstance()->_setForm('message_body', $message);
$this->redirectTo(osc_contact_url());
return false;
// BREAK THE PROCESS, THE RECAPTCHA IS WRONG
}
}
if (!preg_match('|.*?@.{2,}\\..{2,}|', $yourEmail)) {
osc_add_flash_error_message(_m('Please enter a correct email'));
Session::newInstance()->_setForm('yourName', $yourName);
Session::newInstance()->_setForm('subject', $subject);
Session::newInstance()->_setForm('message_body', $message);
$this->redirectTo(osc_contact_url());
}
$message_name = sprintf(__('Name: %s'), $yourName);
$message_email = sprintf(__('Email: %s'), $yourEmail);
$message_subject = sprintf(__('Subject: %s'), $subject);
$message_body = sprintf(__('Message: %s'), $message);
$message_date = sprintf(__('Date: %s at %s'), date('l F d, Y'), date('g:i a'));
$message_IP = sprintf(__('IP Address: %s'), get_ip());
$message = <<<MESSAGE
{$message_name}
{$message_email}
{$message_subject}
{$message_body}
{$message_date}
{$message_IP}
MESSAGE;
$params = array('from' => osc_contact_email(), 'to' => osc_contact_email(), 'to_name' => osc_page_title(), 'reply_to' => $yourEmail, 'subject' => '[' . osc_page_title() . '] ' . __('Contact'), 'body' => nl2br($message));
if (osc_contact_attachment()) {
$attachment = Params::getFiles('attachment');
if (isset($attachment['tmp_name'])) {
$resourceName = $attachment['name'];
$tmpName = $attachment['tmp_name'];
$resourceType = $attachment['type'];
$path = osc_content_path() . 'uploads/' . time() . '_' . $resourceName;
if (!is_writable(osc_content_path() . 'uploads/')) {
osc_add_flash_error_message(_m('There have been some errors sending the message'));
$this->redirectTo(osc_contact_url());
}
if (!move_uploaded_file($tmpName, $path)) {
unset($path);
}
}
}
if (isset($path)) {
$params['attachment'] = $path;
}
osc_run_hook('pre_contact_post', $params);
osc_sendMail(osc_apply_filter('contact_params', $params));
osc_add_flash_ok_message(_m('Your email has been sent properly. Thank you for contacting us!'));
$this->redirectTo(osc_contact_url());
break;
default:
//contact
$this->doView('contact.php');
}
}
示例11: doModel
//.........这里部分代码省略.........
break;
case 'custom':
// Execute via AJAX custom file
if (Params::existParam('route')) {
$routes = Rewrite::newInstance()->getRoutes();
$rid = Params::getParam('route');
$file = '../';
if (isset($routes[$rid]) && isset($routes[$rid]['file'])) {
$file = $routes[$rid]['file'];
}
} else {
$file = Params::getParam("ajaxfile");
}
if ($file == '') {
echo json_encode(array('error' => 'no action defined'));
break;
}
// valid file?
if (stripos($file, '../') !== false || stripos($file, '..\\') !== false) {
echo json_encode(array('error' => 'no valid file'));
break;
}
if (!file_exists(osc_plugins_path() . $file)) {
echo json_encode(array('error' => "file doesn't exist"));
break;
}
require_once osc_plugins_path() . $file;
break;
case 'test_mail':
$title = sprintf(__('Test email, %s'), osc_page_title());
$body = __("Test email") . "<br><br>" . osc_page_title();
$emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
$array = array();
if (osc_sendMail($emailParams)) {
$array = array('status' => '1', 'html' => __('Email sent successfully'));
} else {
$array = array('status' => '0', 'html' => __('An error occurred while sending email'));
}
echo json_encode($array);
break;
case 'test_mail_template':
// replace por valores por defecto
$email = Params::getParam("email");
$title = Params::getParam("title");
$body = Params::getParam("body", false, false);
$emailParams = array('subject' => $title, 'to' => $email, 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
$array = array();
if (osc_sendMail($emailParams)) {
$array = array('status' => '1', 'html' => __('Email sent successfully'));
} else {
$array = array('status' => '0', 'html' => __('An error occurred while sending email'));
}
echo json_encode($array);
break;
case 'order_pages':
osc_csrf_check(false);
$order = Params::getParam("order");
$id = Params::getParam("id");
if ($order != '' && $id != '') {
$mPages = Page::newInstance();
$actual_page = $mPages->findByPrimaryKey($id);
$actual_order = $actual_page['i_order'];
$array = array();
$condition = array();
$new_order = $actual_order;
if ($order == 'up') {
示例12: doModel
//.........这里部分代码省略.........
try {
$categoryManager = Category::newInstance();
$categoryManager->updateByPrimaryKey($fields, $aFieldsDescription, $id);
} catch (Exception $e) {
$error = 1;
$message = __("Error while updating.");
}
}
$result = "{";
if ($error) {
$result .= '"error" : "';
$result .= $message;
$result .= '"';
} else {
$result .= '"ok" : "' . __("Saved") . '", "text" : "' . $aFieldsDescription[$l]['s_name'] . '"';
}
$result .= "}";
echo $result;
break;
case 'custom':
// Execute via AJAX custom file
$ajaxfile = Params::getParam("ajaxfile");
if ($ajaxfile != '') {
require_once osc_admin_base_path() . $ajaxfile;
} else {
echo json_encode(array('error' => __('no action defined')));
}
break;
case 'test_mail':
$title = __('Test email') . ", " . osc_page_title();
$body = __("Test email") . "<br><br>" . osc_page_title();
$emailParams = array('subject' => $title, 'to' => osc_contact_email(), 'to_name' => 'admin', 'body' => $body, 'alt_body' => $body);
$array = array();
if (osc_sendMail($emailParams)) {
$array = array('status' => '1', 'html' => __('Email sent successfully'));
} else {
$array = array('status' => '0', 'html' => __('An error has occurred while sending email'));
}
echo json_encode($array);
break;
case 'order_pages':
$order = Params::getParam("order");
$id = Params::getParam("id");
$count = osc_count_static_pages();
if ($order != '' && $id != '') {
$mPages = Page::newInstance();
$actual_page = $mPages->findByPrimaryKey($id);
$actual_order = $actual_page['i_order'];
$array = array();
$condition = array();
$new_order = $actual_order;
if ($order == 'up') {
if ($actual_order > 0) {
$new_order = $actual_order - 1;
}
} else {
if ($order == 'down') {
if ($actual_order != $count - 1) {
$new_order = $actual_order + 1;
}
}
}
if ($new_order != $actual_order) {
$auxpage = $mPages->findByOrder($new_order);
$array = array('i_order' => $actual_order);
$conditions = array('pk_i_id' => $auxpage['pk_i_id']);
示例13: payment_send_email
/**
* Send email to un-registered users with payment options
*
* @param integer $item
* @param float $category_fee
*/
function payment_send_email($item, $category_fee)
{
if (osc_is_web_user_logged_in()) {
return false;
}
$mPages = new Page();
$aPage = $mPages->findByInternalName('email_payment');
$locale = osc_current_user_locale();
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
$item_url = osc_item_url();
$item_url = '<a href="' . $item_url . '" >' . $item_url . '</a>';
$publish_url = osc_route_url('payment-publish', array('itemId' => $item['pk_i_id']));
$premium_url = osc_route_url('payment-premium', array('itemId' => $item['pk_i_id']));
$words = array();
$words[] = array('{ITEM_ID}', '{CONTACT_NAME}', '{CONTACT_EMAIL}', '{WEB_URL}', '{ITEM_TITLE}', '{ITEM_URL}', '{WEB_TITLE}', '{PUBLISH_LINK}', '{PUBLISH_URL}', '{PREMIUM_LINK}', '{PREMIUM_URL}', '{START_PUBLISH_FEE}', '{END_PUBLISH_FEE}', '{START_PREMIUM_FEE}', '{END_PREMIUM_FEE}');
$words[] = array($item['pk_i_id'], $item['s_contact_name'], $item['s_contact_email'], osc_base_url(), $item['s_title'], $item_url, osc_page_title(), '<a href="' . $publish_url . '">' . $publish_url . '</a>', $publish_url, '<a href="' . $premium_url . '">' . $premium_url . '</a>', $premium_url, '', '', '', '');
if ($category_fee == 0) {
$content['s_text'] = preg_replace('|{START_PUBLISH_FEE}(.*){END_PUBLISH_FEE}|', '', $content['s_text']);
}
$premium_fee = ModelPayment::newInstance()->getPremiumPrice($item['fk_i_category_id']);
if ($premium_fee == 0) {
$content['s_text'] = preg_replace('|{START_PREMIUM_FEE}(.*){END_PREMIUM_FEE}|', '', $content['s_text']);
}
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $item['s_contact_email'], 'to_name' => $item['s_contact_name'], 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
示例14: doModel
function doModel()
{
switch ($this->action) {
case 'register':
//register user
$this->doView('user-register.php');
break;
case 'register_post':
//register user
require_once LIB_PATH . 'osclass/UserActions.php';
$userActions = new UserActions(false);
$success = $userActions->add();
switch ($success) {
case 1:
osc_add_flash_message(_m('The user has been created. An activation email has been sent'));
$this->redirectTo(osc_base_url());
break;
case 2:
osc_add_flash_message(_m('Your account has been created successfully'));
$this->doView('user-login.php');
break;
case 3:
osc_add_flash_message(_m('The specified e-mail is already in use'));
$this->doView('user-register.php');
break;
case 4:
osc_add_flash_message(_m('The reCAPTCHA was not introduced correctly'));
$this->doView('user-register.php');
break;
}
break;
case 'validate':
//validate account
$id = intval(Params::getParam('id'));
$code = Params::getParam('code');
$userManager = new User();
$user = $userManager->findByIdSecret($id, $code);
if ($user) {
if (!$user['b_enabled']) {
$userManager = new User();
$userManager->update(array('b_enabled' => '1'), array('pk_i_id' => $id, 's_secret' => $code));
$pageManager = new Page();
$locale = osc_current_user_locale();
$aPage = $pageManager->findByInternalName('email_user_registration');
$content = array();
if (isset($aPage['locale'][$locale]['s_title'])) {
$content = $aPage['locale'][$locale];
} else {
$content = current($aPage['locale']);
}
if (!is_null($content)) {
$words = array();
$words[] = array('{USER_NAME}', '{USER_EMAIL}', '{WEB_TITLE}', '{WEB_URL}');
$words[] = array($user['s_name'], $user['s_email'], osc_page_title(), osc_base_url());
$title = osc_mailBeauty($content['s_title'], $words);
$body = osc_mailBeauty($content['s_text'], $words);
$emailParams = array('subject' => $title, 'to' => $user['s_email'], 'to_name' => $user['s_name'], 'body' => $body, 'alt_body' => $body);
osc_sendMail($emailParams);
}
osc_run_hook('validate_user', $user);
osc_add_flash_message(_m('Your account has been validated'));
// Auto-login
Session::newInstance()->_set('userId', $user['pk_i_id']);
Session::newInstance()->_set('userName', $user['s_name']);
Session::newInstance()->_set('userEmail', $user['s_email']);
$phone = $user['s_phone_mobile'] ? $user['s_phone_mobile'] : $user['s_phone_land'];
Session::newInstance()->_set('userPhone', $phone);
} else {
osc_add_flash_message(_m('Your account has already been activated'));
}
} else {
osc_add_flash_message(_m('The link is not valid anymore. Sorry for the inconvenience!'));
}
$this->redirectTo(osc_base_url());
break;
}
}
示例15: fn_email_auto_upgrade
function fn_email_auto_upgrade($result) {
$body = __('<p>Dear {WEB_TITLE} admin,</p>');
if($result['error']==0 || $result['error']==6) {
$title = __('{WEB_TITLE} - Your site has upgraded to Osclass {VERSION}');
$body .= __('<p>Your site at {WEB_LINK} has been updated automatically to Osclass {VERSION}</p>');
if($result['error']==6) {
$body .= __('<p>There were some minor errors removing temporary files. Please manually remove the "oc-content/downloads/oc-temp" folder</p>');
}
} else {
$title = __('{WEB_TITLE} - We failed trying to upgrade your site to Osclass {VERSION}');
$body .= '<p>We failed trying to upgrade your site to Osclass {VERSION}. Heres is the error message: {MESSAGE}</p>';
}
$body .= '<p>If you experience any issues or need support, we will be happy to help you at the Osclass support forums</p>';
$body .= '<p><a href="http://forums.osclass.org/">http://forums.osclass.org/</a></p>';
$body .= '<p>The Osclass team</p>';
$words = array();
$words[] = array(
'{MESSAGE}',
'{VERSION}'
);
$words[] = array(
$result['message'],
$result['version']
);
$title = osc_apply_filter('email_after_auto_upgrade_title_after', osc_mailBeauty(osc_apply_filter('email_title', osc_apply_filter('email_after_auto_upgrade_title', $title, $result)), $words), $result);
$body = osc_apply_filter('email_after_auto_upgrade_description_after', osc_mailBeauty(osc_apply_filter('email_description', osc_apply_filter('email_after_auto_upgrade_description', $body, $result)), $words), $result);
$emailParams = array(
'subject' => $title,
'from' => _osc_from_email_aux(),
'to' => osc_contact_email(),
'to_name' => osc_page_title(),
'body' => $body,
'alt_body' => $body,
);
osc_sendMail($emailParams);
}