michael-e / email_template_manager Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
In S 2.3.2, previewing a template results in the following error:
Symphony Fatal Error: Argument `$value` is not of type `string`, given `NULL`.
An error occurred in /Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.general.php around line 1352
1347 throw new InvalidArgumentException(__('Enforced type `%1$s` for argument `$%2$s` does not match any known variable types.', array($param['type'], $name)));
1348 }
1349
1350 // validate variable type
1351 if( !call_user_func($validator, $param['var']) ){
1352 throw new InvalidArgumentException(__('Argument `$%1$s` is not of type `%2$s`, given `%3$s`.', array($name, $param['type'], gettype($param['var']))));
1353 }
1354
1355 }
1356 }
Backtrace
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.widget.php:157]
General::ensureType();
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.devkit.php:99]
Widget::Anchor();
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.devkit.php:273]
DevKit->buildHeader();
[/Users/me/Sites/dev/me/sym/extensions/debugdevkit/content/content.debug.php:45]
DevKit->build();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/lib/class.emailtemplate.php:213]
Content_DebugDevKit_Debug->build();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/content/content.templates.php:301]
EmailTemplate->preview();
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.administrationpage.php:630]
contentExtensionemail_template_managertemplates->__viewPreview();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/lib/class.extensionpage.php:20]
AdministrationPage->__switchboard();
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.administrationpage.php:587]
ExtensionPage->__switchboard();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/lib/class.extensionpage.php:26]
AdministrationPage->view();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/content/content.templates.php:313]
ExtensionPage->view();
[/Users/me/Sites/dev/me/sym/symphony/lib/toolkit/class.administrationpage.php:429]
contentExtensionemail_template_managertemplates->view();
[/Users/me/Sites/dev/me/sym/extensions/email_template_manager/content/content.templates.php:328]
AdministrationPage->build();
[/Users/me/Sites/dev/me/sym/symphony/lib/core/class.administration.php:254]
contentExtensionemail_template_managertemplates->build();
[/Users/me/Sites/dev/me/sym/symphony/lib/core/class.administration.php:442]
Administration->__buildPage();
[/Users/me/Sites/dev/me/sym/index.php:22]
Administration->display();
Database Query Log
[0.0003] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0008] SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled' ORDER BY t2.delegate, t1.name;
[0.0002] SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = '03baeef19942bd4802f3f21c021735d3' LIMIT 1;
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'michael-e' ORDER BY a.id ASC LIMIT 1;
[0.0002] UPDATE sym_authors SET `last_seen` = '2013-04-04 13:05:28' WHERE `id` = 1;
[0.0004] SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled';
[0.0003] SELECT SQL_CACHE * FROM `sym_extensions`;
[0.0004] SELECT SQL_CACHE `s`.* FROM `sym_sections` AS `s` ORDER BY `s`.`sortorder` asc;
[0.0002] SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8';
[0.0001] SET CHARACTER SET 'utf8';
[0.0003] SELECT SQL_CACHE a.* FROM `sym_authors` AS `a` WHERE `username` = 'michael-e' ORDER BY a.id ASC LIMIT 1;
[0.0002] UPDATE sym_authors SET `last_seen` = '2013-04-04 13:05:28' WHERE `id` = 1;
[0.0003] SELECT SQL_CACHE `e`.id, `e`.section_id, e.`author_id`, UNIX_TIMESTAMP(e.`creation_date`) AS `creation_date`, UNIX_TIMESTAMP(e.`modification_date`) AS `modification_date` FROM `sym_entries` AS `e` WHERE 1 AND `e`.`section_id` = '6' ORDER BY `e`.`id`DESC LIMIT 0, 1;
[0.0003] SELECT SQL_CACHE `id` FROM `sym_fields` WHERE 1 AND `parent_section` = 6 AND `element_name` IN ('name', 'email', 'subject', 'message') ORDER BY `sortorder` ASC;
[0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_19` WHERE `entry_id` IN (15) ORDER BY `id` ASC;
[0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_20` WHERE `entry_id` IN (15) ORDER BY `id` ASC;
[0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_21` WHERE `entry_id` IN (15) ORDER BY `id` ASC;
[0.0002] SELECT SQL_CACHE * FROM `sym_entries_data_22` WHERE `entry_id` IN (15) ORDER BY `id` ASC;
[0.0002] SELECT SQL_CACHE t1.* FROM sym_fields AS `t1` WHERE 1 AND t1.`id` IN(19,20,21,22);
[0.0002] SELECT SQL_CACHE * FROM `sym_fields_input` WHERE `field_id` IN (19,20,21);
[0.0002] SELECT SQL_CACHE * FROM `sym_fields_textarea` WHERE `field_id` IN (22);
At least i think this is the case
I get the following error when i want to create e new email template:
"Request was rejected for having an invalid cross-site request forgery token.
Please go back and try again."
I got this after upgrading to 2.4 RC1, so i guess it's not an ETM issue...
I think XSRF filter in the back-end is causing this?
Maybe there should be some kind of whitelist for some extensions?
Guess @brendo need to take a look into this as well?
To be consistent with Symphony, the template editor should be removed.
If your email layout XSLT uses the $etm-entry-id
, like so:
<xsl:value-of select="$etm-entry-id"/>
this will work upon sending, but the layout preview will break.
According to a forum thread, installation fails silently if the workspace folder is not writable.
The "Create new" button should be changed to "Create New" to be consistent with the rest of the Symphony admin UI.
I tried to include another XSLT file in my email template XSLT, but it killed the process. It seemed to resolve the path of my include file relative to the root of my Symphony build, whereas I had expected the internal paths between XSLT documents to honour the hierarchy inside /workspace
(i.e. in an email template I'd expect to use ../../utilities/my-utility.xsl
.)
ETM doesn't use XSRF tokens, so editing templates won't work if enable_xsrf
has been set to true
in Smphony's config file. Two solutions:
When no event template is chosen in the Members extension's preferences (e.g. for the Members: Activate Account event), the ETF extension breaks with the following backtrace:
[:0] GenericErrorHandler::handler();
[/var/www/maschine/extensions/email_template_manager/extension.driver.php:105] in_array();
[/var/www/maschine/symphony/lib/toolkit/class.extensionmanager.php:566] extension_email_template_manager->eventFinalSaveFilter();
[/var/www/maschine/extensions/members/events/event.members_activate_account.php:207] ExtensionManager->notifyMembers();
[/var/www/maschine/extensions/members/events/event.members_activate_account.php:26] eventMembers_Activate_Account->__trigger();
[/var/www/maschine/symphony/lib/toolkit/class.frontendpage.php:724] eventMembers_Activate_Account->load();
[/var/www/maschine/symphony/lib/toolkit/class.frontendpage.php:403] FrontendPage->processEvents();
[/var/www/maschine/symphony/lib/toolkit/class.frontendpage.php:202] FrontendPage->__buildPage();
[/var/www/maschine/symphony/lib/core/class.frontend.php:110] FrontendPage->generate();
[/var/www/maschine/index.php:25] Frontend->display();
Here's the error:
in_array() [function.in-array]: Wrong datatype for second argument
/var/www/maschine/extensions/email_template_manager/extension.driver.php line 105
100
101 public function eventFinalSaveFilter($context){
102 $templates = EmailTemplateManager::listAll();
103 foreach($templates as $template){
104 $handle = 'etm-' . $template->getHandle();
105 if(in_array($handle, $context['event']->eParamFILTERS)){
106 if(($response = $this->_sendEmail($template, $context)) !== false){
107 $context['errors'][] = Array('etm-' . $template->getHandle(), ($response['sent']>0), null, $response);
108 }
109 }
As a quick fix I added the following in line 105 of extension.driver.php—there might however be better ways to deal with this issue:
if(is_null($context['event']->eParamFILTERS)) $context['event']->eParamFILTERS = array();
ETM does not use Symphony's permission settings when writing files and folders.
If there is more than one email template filter in the filter selector of the event edit page, example code injection will only work if the first one of the email template filters is selected.
If you filter your datasource by ID using the ENM, there won't be any ID available for the layout preview. Unfortunately in this case a blank page is displayed.
Using the ENM, you can successfully pass three parameters to the email template:
$enm-newsletter-id
$etm-reply-to-name
$etm-reply-to-email-address
(I checked this this by outputting them to the email source via XSLT.)
But as soon as you fiter an attached Datasource by ID, using {$enm-newsletter-id}
, sending breaks.
I assume that the parameter is not passed successfully to the DS, and so the output is empty (breaking the XSLT transformation).
It would be rather cool if the PLAIN preview had a text/plain Content-Type HTTP header. This would improve the preview. (No need to look in the page source anymore.)
When I add the fields[fieldname] syntax to one of the ETM fields in a "save-comment" form, sending breaks silently. For example:
<input name="etm[][reply-to-email]" value="fields[email]" type="hidden" />
There is nothing in the Symphony log.
Parameters such as {$style} in the element <p style="{$style}"/> cause the following error:
Symphony Fatal Error: Error compiling xml with xslt: XSLTProcessor::transformToXml(): runtime error: file /var/www/workspace/email-templates/members-send-activation-code/template.html.xsl line 15 element p
See http://getsymphony.com/discuss/thread/64323/12/#238
Symphony version 2.2.3
ksort() expects parameter 1 to be array, null given
An error occurred in /home/symfony/public_html/extensions/email_template_manager/extension.driver.php around line 91
i've got the following message when i try to saving a new template from ENM:
(Blueprints -> Email Templates -> Create New.. ..Create Template)
Symphony Fatal Error: Call to undefined method Widget::wrapFormElementWithError()
extensions/email_newsletter_manager/fields/field.email_newsletter_manager.php around line 73
Fresh symphony install and extensions :)
If you use attribute values in XPath queries, e.g. like this (as recipient group):
{/data/people/entry[email='[email protected]']/name} <{/data/people/entry[email='[email protected]']/email}>
the backend pages of the ETM will break with a PHP error:
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /var/www/maschine/workspace/email-templates/members-send-recovery-code/class.members-send-recovery-code.php on line 16
This happens because the quotes are not escaped when saving to the template's php (config) file.
I tried to use the ETM-2.3-Branch in S2.3 and got the following error whenever i wanted to send or preview an email:
Symphony Fatal Error: Error including XML for rendering: DirectoryIterator::__construct(/www/htdocs/w009ba0f/psd-journal/extensions/profiledevkit/lang) [directoryiterator.--construct]: failed to open dir: No such file or directory
An error occurred in ***/extensions/email_template_manager/lib/class.emailtemplate.php around line 171
Adding a "lang"-folder to each installed and uninstalled extension resolved the problem.
Upon creation of a new template, leaving the Subject field empty will raise a Symphony error message on the top of the backend page like so:
Could not save, please correct errors below
However, the content part of the page is empty/blank/white/niente/nada.
When using the preview for plain layouts, Profile Devkit pages come with a text/plain content-type header.
I will fix this.
Whenever I try to preview an email in 2.3.1 using this extension, I get the following error..
Symphony Fatal Error: Error including XML for rendering: DirectoryIterator::__construct(/var/www/vhosts/holeinonepayout.sosclient.com/httpdocs/extensions/markdown/lang) [directoryiterator.--construct]: failed to open dir: No such file or directory
An error occurred in /var/www/vhosts/holeinonepayout.sosclient.com/httpdocs/extensions/email_template_manager/lib/class.emailtemplate.php around line 171
166 try{
167 $this->setXML($this->processDatasources()->generate(true, 0));
168 }
169 catch(Exception $e){
170 $error = $this->getError();
171 throw new EmailTemplateException('Error including XML for rendering: ' . $e->getMessage());
172 }
173 }
174
175 $this->parseProperties();
For consistency with the rest of the Symphony admin UI, when creating a new template, the submit button should have a value of "Create Template" instead of "Save Changes". The "Save Changes" button should be reserved for editing an existing template only.
As mentioned in #42, an Email Template without any Datasource throws an exception when parseProperties
is called.
I also cannot send HTML emails. I can said plaintext emails just fine. Whenever I select "HTML and Plain" or "HTML only" I get this error:
<filter total="1" sent="0" name="etm-new-report" status="failed" />
I cannot even save HTML templates in Symphony (I get a red border around the textarea, but no error messages). I need to edit the template in a texteditor.
Symphony 2.3.2, ETM 4.1
Either bump it to version 5 or remove the version number completely (I don't think that the README needs a version number).
Hello.
I need to discuss how I could integrate this into Campaign Monitor, and whether this is even achievable.
This is just a top level discussion for now, but I will need to pick your brains on getting something to work.
Would this be better working from the ENM?
On the viewEditLayout
page, the Headline should not be "Email Templates" but the name of the Layout which is currently edited. (Line 12 of viewEditLayout
.)
The buttons (line 13 ff.) don't work at all. Actually we should have different buttons here:
If you use XPath (e.g.) with concat
in the "Recipients" e-mail settings you get an error.
{concat(/data/foo/recipient, '@example.com')}
The problem is the explode
function in EmailTemplate::evalXPath()
:
public function evalXPath($xpath_string, $multiple = false){
// …
if($multiple == true){
$xpath_strings = explode(",", $xpath_string);
// …
}
}
I think this line should be unset($this->_parsedProperties[$var]);
, not unset($this->_parsedProperties[$val]);
(note $var
and $val
). This will allow you to override parameters after the parseProperties
function has run (which I'm assuming was the desired behaviour anyway?)
On the 2.3.x branch...
ACTUALLY, line 253
needs to be updated from Symphony::$Log
to Symphony::Log()
That fixes the error.
Shouldn't email templates be sorted alphabetically? I have three templates:
I would expect "Members: Register" to be on top.
Even if I choose just HTML or plain only, both template files are created. Not a massive problem, but it felt like a bug.
There is a template file called viewEditlayout.xsl
, but the extension defines viewEditLayout
in line 183 of content.templates.php
. This will cause this view to break on case sensitive UNIX/LINUX systems.
The viewEditLayout page breaks with an error if no utilities can be found:
Argument 2 passed to General::array_to_xml() must be an array, null given, called in /Users/me/Sites/dev/maschine/extensions/email_templates/content/content.templates.php on line 173 and defined
/Users/me/Sites/dev/maschine/symphony/lib/toolkit/class.general.php line 718
713 * the array to format and append to the XML fragment.
714 * @param boolean $validate
715 * true if the formatted array data should be validated as it is
716 * constructed, false otherwise.
717 */
718 public static function array_to_xml(XMLElement $parent, array $data, $validate=false) {
719 foreach ($data as $element_name => $value) {
720 if (empty($value)) continue;
721
722 if (is_int($element_name)) {
The fix is easy. I will send a pull request.
If a datasource (which is used in a template) returns no results, ETM breaks with a Symphony Fatal Error.
Error compiling xml with xslt:
/var/www/maschine/extensions/email_template_manager/lib/class.emailtemplate.php line 187
182 if($res){
183 $result[strtolower($type)] = $res;
184 }
185 else{
186 $error = $this->getError();
187 throw new EmailTemplateException('Error compiling xml with xslt: ' . $error[1]['message']);
188 }
189
190 }
191 }
Is this by design? (Symphony pages wouldn't throw such an error.)
I'm building a site using 2.5 RC1 and getting the following error when attempting to save a new template:
Symphony Fatal Error: Call to a member function getFullName() on a non-object
An error occurred in /Users/Nathan/httpdocs/XXXXXXXXXXXX/extensions/email_template_manager/lib/class.emailtemplatemanager.php around line 326
The folder is created but the template isn't.
When attempting to delete a template, one file (template.plain.xsl
) will get deleted, then an error will occur:
Could not delete: Directory /var/www/lalala/workspace/email-templates/test could not be removed. Please check permissions.
It's not a permissions problem. It looks like ETM attempts to delete the folder while it still contains files.
(Originally posted in the ENM tracker.)
Posted on the Symphony website (by Komb):
Root solves to "http://hostname/var/www/blah/blah/emailnewslettermanager/lib/" Workspace behaves the same, but with added workspace folder of course.
Very bad for building absolute image paths and such.
In 2.5 I'm getting the following error when selecting either the Edit html layout button in the template editor, or by clicking on either html or plain under the Layout column in the templates table:
Symphony Fatal Error: Undefined class constant 'CRLF'
An error occurred in /Users/Nathan/httpdocs/[redacted]/extensions/email_template_manager/lib/class.extensionpage.php around line 57
I forget but I'm assuming this is the old backend code editing feature that was removed a couple versions ago - should this just be removed from the extension?
Yo,
Using ETM for the first time programmatically and I'm up against some odd behaviour. My usage is fairly odd in this scenario, but I still think it should work.
My template is being loaded and my recipients set with (ignore $rule
).
$template = EmailTemplateManager::load($rule->get('template'));
$template->{'recipients'} = $recipients
$recipients
is an array of associative array's, with the key being my name, value the email address. The problem is that this seems to fail on rendering as setting the parameter directly on the $template
unset's the $this->_parsedProperties[key]
.
When the email is rendering, it triggers $this->parseProperties()
, which if $this->_parsedProperties['recipients']
is empty, it will try and look up the value using $this->evalXPath($this->recipients)
.
In my case, $this->recipients
is an already an array of the recipients, and what's more, I don't have any Datasources attached to the template (it's just a static message). This causes an Exception to be thrown while attempting this line
So, while I think the Exception could be prevented with a quick is_null
check, I'm more wondering how one should set the recipients!
On the event edit page email template filters are not sorted. Here is an example of the select element containing 4 filters:
<label>Filter Options
<select name="fields[filters][]" multiple="multiple">
<option value="admin-only">Admin Only</option>
<option value="send-email">Send Notification Email</option>
<option value="expect-multiple">Allow Multiple</option>
<option value="xss-fail">Filter XSS: Fail if malicious input is detected</option>
<option value="etm-hallo-test">Send Email Template: Hallo Test</option>
<option value="etm-members-register" selected="selected">Send Email Template: Members: Register</option>
<option value="etm-gfdsgfdsg" selected="selected">Send Email Template: gfdsgfdsg</option>
<option value="etm-test-2" selected="selected">Send Email Template: Test 2</option>
<option value="member-register">Members: Register</option>
<option value="member-activation">Members: Activation</option>
<option value="member-update-password">Members: Update Password</option>
</select>
</label>
It would be easier if the "Send Email Template" block of event filters was sorted alphabetically. (Symphony's overall sorting is something I don't understand as well, but that's another story...)
I can't filter my datasource, so I can't get the recipient and thus can't send emails. Symphony 2.3.2
In 2.5 I'm not able to delete any templates, I'm getting the following error:
Access Denied
Request was rejected for having an invalid cross-site request forgery token.
Please go back and try again.
This doesn't occur when/how you might expect, i.e. after leaving a tab open for an extended period.
Symphony Fatal Error: Call to undefined method DateTimeObj::getTimeAgo()
An error occurred in /Users/johnporter/Sites/whatsonthere.local.embarknow.net/htdocs/extensions/email_template_manager/content/content.templates.php around line 174
This happens when I save a new Email Template from the admin.
When creating templates in the workspace, ETM should transliterate umlauts instead of just removing them.
Passwortzurücksetzung
passwortzurcksetzung
passwortzuruecksetzung
Lewis' Message breaks public $subject = 'Lewis' Message';
Should be public $subject = 'Lewis\' Message';
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.