Giter Site home page Giter Site logo

email_template_manager's People

Contributors

animaux avatar brendo avatar chobohub avatar creativedutchmen avatar jonmifsud avatar makenosound avatar michael-e avatar michaelhay avatar nilshoerrmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

email_template_manager's Issues

Template preview broken in Symphony 2.3.2

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);

Create new template conflicts with 2.4 RC1 new XSRF filter

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?

Cannot include XSLT utilities in email XSLT

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 breaks when $context['event']->eParamFILTERS is NULL

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();

Event edit page: Example code injection is buggy

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.

Datasource parameter filtering is broken

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).

fields[fieldname] syntax breaks sending

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

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

Error when creating new event

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

Fatal error when creating new template

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 :)

Quotes are not escaped, so the backend breaks

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.

ETM missing "lang"-Folder in every extension

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.

New template: omitting the Subject breaks backend page

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.

Previewing email in 2.3.1 gives me an error....

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();

Cannot save HTML templates and cannot send HTML emails

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

API Integrations

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?

Headline and buttons not working on viewEditLayout page

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:

  • Edit Configuration
  • Edit [[other]] layout

Problem with XSLT and "explode" in "evalXPath" method

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);
        // …
    }
}

Typo when overriding parameters.

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?)

Sorting of Email Templates is not alphabetically

Shouldn't email templates be sorted alphabetically? I have three templates:

  • Members: Resend Activation Code
  • Members: Register
  • Members: Send Recovery Code

I would expect "Members: Register" to be on top.

Typo causes editLayout page to break

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.

viewEditLayout breaks when no utilities exist

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.

Symphony Fatal Error if Datasource is empty

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.)

[2.5] Symphony Fatal Error: Call to a member function getFullName() on a non-object

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.

Fails to delete template files and folder

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.

'Edit html layout' etc. not functional

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?

Programmatically using ETM.

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!

Template filters are not sorted alphabetically

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...)

Fatal error on save (2.4)

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.

Transliterating umlauts

When creating templates in the workspace, ETM should transliterate umlauts instead of just removing them.

  • input: Passwortzurücksetzung
  • given output: passwortzurcksetzung
  • expected output: passwortzuruecksetzung

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.