1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

fixed #160 - temporary fix, user_model renderModel method needs update

(most recent email template and rendering engine)
This commit is contained in:
SecretR
2013-04-30 17:01:02 +03:00
parent cc3f597b85
commit 30a2e10ff1
2 changed files with 22 additions and 21 deletions

View File

@@ -1113,7 +1113,8 @@ class users_admin_ui extends e_admin_ui
$userMethods->addNonDefaulted($user_data);
validatorClass::addFieldTypes($userMethods->userVettingInfo, $allData);
if (($userid = $sql->db_Insert('user', $allData)))
$userid = $sql->db_Insert('user', $allData);
if ($userid)
{
$sysuser = e107::getSystemUser(false, false);
$sysuser->setData($allData['data']);
@@ -1144,7 +1145,7 @@ class users_admin_ui extends e_admin_ui
// activate and send password
$check = $sysuser->email('quickadd', array(
'user_password' => $savePassword,
'mail_subject' => USRLAN_187.SITENAME,
'email_subject' => USRLAN_187.SITENAME,
// TODO lan
'activation_url' => 'Your current status is <strong>Active</strong>',
));
@@ -1158,13 +1159,12 @@ class users_admin_ui extends e_admin_ui
$check = $sysuser->email('quickadd', array(
'user_password' => $savePassword,
'mail_subject' => USRLAN_187.SITENAME,
'email_subject' => USRLAN_187.SITENAME,
'activation_url' => SITEURL."signup.php?activate.".$sysuser->getId().".".$sysuser->getValue('sess'),
));
break;
}
if($check && $check !== -1)
{
$mes->addSuccess(USRLAN_188);

View File

@@ -1104,6 +1104,7 @@ class e_system_user extends e_user_model
include(e107::coreTemplatePath('email'));
}
// FIXME by SecretR - email template mess - there are changes to emails and templates that need to be implemented here
$template = '';
switch ($type)
{
@@ -1114,7 +1115,7 @@ class e_system_user extends e_user_model
break;
case 'quickadd':
$template = $QUICKADDUSER_TEMPLATE;
$template = $QUICKADDUSER_TEMPLATE['email_body']; // XXX quick fix - add the email templating engine
$ret['template'] = 'email'; // Don't allow additional headers (mailer)
break;
@@ -1136,11 +1137,11 @@ class e_system_user extends e_user_model
// signup email only
if($type == 'signup')
{
$ret['mail_recipient_id'] = $userInfo['user_id'];
if (vartrue($SIGNUPEMAIL_CC)) { $ret['mail_copy_to'] = $SIGNUPEMAIL_CC; }
if (vartrue($SIGNUPEMAIL_BCC)) { $ret['mail_bcopy_to'] = $SIGNUPEMAIL_BCC; }
if (vartrue($userInfo['mail_attach'])) { $ret['mail_attach'] = $userInfo['mail_attach']; }
elseif (vartrue($SIGNUPEMAIL_ATTACHMENTS)) { $ret['mail_attach'] = $SIGNUPEMAIL_ATTACHMENTS; }
$ret['e107_header'] = $userInfo['user_id'];
if (vartrue($SIGNUPEMAIL_CC)) { $ret['email_copy_to'] = $SIGNUPEMAIL_CC; }
if (vartrue($SIGNUPEMAIL_BCC)) { $ret['email_bcopy_to'] = $SIGNUPEMAIL_BCC; }
if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['mail_attach']; }
elseif (vartrue($SIGNUPEMAIL_ATTACHMENTS)) { $ret['email_attach'] = $SIGNUPEMAIL_ATTACHMENTS; }
$style = vartrue($SIGNUPEMAIL_LINKSTYLE) ? "style='{$SIGNUPEMAIL_LINKSTYLE}'" : "";
@@ -1172,7 +1173,7 @@ class e_system_user extends e_user_model
$replace[8] = $userInfo['user_email'];
$subject = str_replace($search, $replace, $SIGNUPEMAIL_SUBJECT);
$ret['mail_subject'] = $subject;
$ret['email_subject'] = $subject;
$ret['send_html'] = TRUE;
$HEAD = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
@@ -1198,20 +1199,20 @@ class e_system_user extends e_user_model
}
$FOOT = "\n</body>\n</html>\n";
$ret['mail_body'] = e107::getParser()->parseTemplate(str_replace($search,$replace,$HEAD.$template.$FOOT), true);
$ret['preview'] = $ret['mail_body'];// Non-standard field
$ret['email_body'] = e107::getParser()->parseTemplate(str_replace($search,$replace,$HEAD.$template.$FOOT), true);
$ret['preview'] = $ret['email_body'];// Non-standard field
return $ret;
}
// all other email types
$subject = $userInfo['mail_subject'];
$subject = $userInfo['email_subject'];
if(!$subject) return array();
$ret['mail_recipient_id'] = $userInfo['user_id'];
if (vartrue($userInfo['mail_copy_to'])) { $ret['mail_copy_to'] = $userInfo['mail_copy_to']; }
if (vartrue($userInfo['mail_bcopy_to'])) { $ret['mail_bcopy_to'] = $userInfo['mail_bcopy_to']; }
if (vartrue($userInfo['mail_attach'])) { $ret['mail_attach'] = $userInfo['mail_attach']; }
$ret['e107_header'] = $userInfo['user_id'];
if (vartrue($userInfo['email_copy_to'])) { $ret['email_copy_to'] = $userInfo['email_copy_to']; }
if (vartrue($userInfo['email_bcopy_to'])) { $ret['email_bcopy_to'] = $userInfo['email_bcopy_to']; }
if (vartrue($userInfo['email_attach'])) { $ret['email_attach'] = $userInfo['email_attach']; }
$search[0] = '{LOGINNAME}';
$replace[0] = intval($pref['allowEmailLogin']) === 0 ? $userInfo['user_loginname'] : $userInfo['user_email'];
@@ -1234,7 +1235,7 @@ class e_system_user extends e_user_model
$search[6] = '{USERURL}';
$replace[6] = vartrue($userInfo['user_website']) ? $userInfo['user_website'] : "";
$ret['mail_subject'] = str_replace($search, $replace, $subject);
$ret['email_subject'] = str_replace($search, $replace, $subject);
$search[7] = '{PASSWORD}';
$replace[7] = $pass_show ? $pass_show : '******';
@@ -1249,7 +1250,7 @@ class e_system_user extends e_user_model
}
$ret['send_html'] = TRUE;
$ret['mail_body'] = e107::getParser()->parseTemplate(str_replace($search, $replace, $template));
$ret['email_body'] = e107::getParser()->parseTemplate(str_replace($search, $replace, $template));
$ret['preview'] = $ret['mail_body']; // Non-standard field
return $ret;