Search

Any one happen to have this extension working in 2.2? I am being sent to a 500 server error on form submission.

I'm the maintainer, but I haven't tried this on a 2.2 build yet. What is the error you're getting?

Yeah, sorry, that would have been better of me to include..

I got the 500 error resolved though, turns out I didn't have the asdc extension installed, which databasemanipulator requires.

I'm not exactly sure which of the two extensions is the culprit here, but would anyone have any recommendations on how to get this and the Unique Text Input Field extension to play nicely together with parse-redirect?

I have a front-end form set up to submit a discussion, which has a unique text input for the title.. Basically so each entry is guaranteed a unique url handle. Upon submission, I'm using parse-redirect to send the user to the discussion they just created. All works well, except that the redirection doesn't get/append the unique number from the handle, so on form submission, if the title is a duplicate, they're redirected to the existing entry, instead of the new one they just submitted.

I'm using this extension to upload some information and an image. The form works just fine, but when I add a <input name="terras[afbeelding]" type="file" size="30" id="file_afb"/> the following error appears.

htmlspecialchars() expects parameter 1 to be string, array given
/home/terras/domains/terraschecker.nl/public_html/symphony/lib/toolkit/class.general.php line 26

21       *  a string to operate on.
22       * @return string
23       *  the encoded version of the string.
24       */
25      public static function sanitize($source) {
26          $source = htmlspecialchars($source);
27
28          return $source;
29      }
30

Backtrace

* [:0] GenericErrorHandler::handler();
* [/home/terras/domains/terraschecker.nl/public_html/symphony/lib/toolkit/class.general.php:26] htmlspecialchars();
* [/home/terras/domains/terraschecker.nl/public_html/extensions/eventex/lib/class.eventex.php:559] General::sanitize();
* [/home/terras/domains/terraschecker.nl/public_html/extensions/eventex/lib/class.eventex.php:333] GenericSectionUpdate->updateSection();
* [/home/terras/domains/terraschecker.nl/public_html/extensions/eventex/lib/class.eventex.php:229] GenericSectionUpdate->updateSections();
* [/home/terras/domains/terraschecker.nl/public_html/extensions/eventex/lib/class.eventex.php:108] GenericSectionUpdater::updateNamedSections();
* [/home/terras/domains/terraschecker.nl/public_html/workspace/events/event.terras_aanmelden.php:28] EventEx->updateNamedSections();
* [/home/terras/domains/terraschecker.nl/public_html/extensions/eventex/lib/class.eventex.php:101] eventterras_aanmelden->__trigger();
* [/home/terras/domains/terraschecker.nl/public_html/symphony/lib/toolkit/class.frontendpage.php:705] EventEx->load();
* [/home/terras/domains/terraschecker.nl/public_html/symphony/lib/toolkit/class.frontendpage.php:384] FrontendPage->processEvents();
* [/home/terras/domains/terraschecker.nl/public_html/symphony/lib/toolkit/class.frontendpage.php:190] FrontendPage->__buildPage();
* [/home/terras/domains/terraschecker.nl/public_html/symphony/lib/core/class.frontend.php:110] FrontendPage->generate();
* [/home/terras/domains/terraschecker.nl/public_html/index.php:27] Frontend->display();

The form I'm using

    <form class="style" method="post" action="?debug" enctype="multipart/form-data">
        <input name="MAX_FILE_SIZE" type="hidden" value="5242880" />
        <input name="canofspam" value="{$canofspam}" type="hidden" />
        <input name="terras[datum-toegevoegd]" type="hidden" value="{$today} {$current-time}"/>
        <input name="terras[publiceren]" type="hidden" value="no"/>
        <input name="terras[stemmen]" type="hidden" value="0"/>
        <input name="terras[reacties]" type="hidden" value="0"/>
        <input name="terras[populairwaarde]" type="hidden" value="0"/>

        <fieldset class="left">
            <h3>Gegevens van het terras</h3>
            <div>
                <label>naam <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[naam]" type="text"/>
            </div>
            <div>               
                <label>straat <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[straat]" type="text"/>
            </div>
            <div>               
                <label>huisnummer <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[huisnummer]" type="text"/>
            </div>
            <div>               
                <label>postcode <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[postcode]" type="text"/>
            </div>
            <div>               
                <label>plaats <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[plaats]" type="text"/>
            </div>
            <div>               
                <label>provincie <small>(verplicht)</small></label>
                <input class="clear required memorize" name="terras[provincie]" type="text"/>
            </div>
            <div>               
                <label>telefoon</label>
                <input class="clear memorize" name="terras[telefoon]" type="text"/>
            </div>
            <div>               
                <label>e-mail adres</label>
                <input class="clear email memorize" name="terras[e-mail]" type="text"/>
            </div>
            <div>               
                <label>website</label>
                <input class="clear memorize" name="terras[website]" type="text"/>
            </div>
            <div>
                <input name="terras[afbeelding]" type="file" size="30" id="file_afb"/>
            </div>
        </fieldset>
        <fieldset class="left">
            <h3>Persoonlijke gegevens</h3>
            <div>
                <label>naam <small>(verplicht)</small></label>
                <input class="clear required memorize" name="nieuwsbrief[naam1]" type="text"/>
            </div>
            <div>
                <label>e-mail adres <small>(verplicht)</small></label>
                <input class="clear required email memorize" name="nieuwsbrief[e-mail-adres]" type="text"/>
            </div>
            <div>
                <label>Lid worden van de nieuwsbrief</label>
                <input name="nieuwsbrief[nieuwsbrief-ontvangen]" type="checkbox" checked="checked"/>
            </div>
        </fieldset>
        <input class="button aanmelden" name="action[terras-aanmelden]" type="submit" value="Verstuur" />
    </form>

What am I doing wrong?

Anyone got good results with 2.2 yet? Nick?

Just picking this up again now I've got a little time.. Am I to assume that the event.myevent.php file needs to be altered in order for this method to work? It's not clear on the git readme to me.. retrofitting symphony events just references the updateNamedSections() function.

Cheers.

The readme has a section titled "CREATING THE EVENT" which has six steps you need to follow to customise your events.

Done all that cheers.. Is there scope to only submmit to the other sections if certain criteria is met? or will it always subimt to all sections no matter if their populated fields or not? does that make sense?

There is a way to make it works with "email template manager" extension?

I've tried to write this:

    public $eParamFILTERS = array(
    'etm-template-name'
);

in my custom event-ex, but it doesn't works. Otherwise it fully works in a standard event.

I have also same problem on some cases but the entry(s) are updated/created :

# 21:          *    a string to operate on.
# 22:          * @return string
# 23:          *    the encoded version of the string.
# 24:          */
# 25:         public static function sanitize($source) {
# 26:             $source = htmlspecialchars($source);
# 27:
# 28:             return $source;
# 29:         }

Case 1 : simply uploading an image through an UniqueUploadField Case 2 : inserting/updating a Select box link with many values

For what is about inserting on associated sections optionally I get errors if the section is on the list and nothing has been inserted. So I am adding on the event section names depending if I have entries like the following :

    public static function getSource()
    {
        $section_names = array();
        $section_names[0] = 'players';

        if ($_POST['has_contactinfos'] == "Yes")
            $section_names[] = 'contact-infos';

        if ($_POST['has_screennames'] == "Yes")
            $section_names[] = 'screen-names';

        return $section_names;
    }

imo, this extension really needs to be part of symphony core. :)

I want to use evenEx to be able to submit multiple sections from the front end. One of these section is the main section, and I would like to link the others 'subsections' to it. I build my custom event and I am able to submit multiple sections from the same form. What I didn't manage is to link the sections.

From what I understood from EventEX documentation (https://github.com/nickdunn/eventex), it's possible to do that using the following syntax in the form:

<input type="hidden" name="sub-section[link-field]" value="main-section[system:id]" />

( link-field is a Select Box Link field from the sub-section, that links to the main-section)

I thought the 'system:id' would be replaced with main-section new entry id, but when I submit the form, the link-field is not updated. The events result contains

<link-field>section[system:id]</link-field>

Maybe I miss understood something about this functionality. Or maybe it is a compatibility issue with symphony 2.2.5 ?

Thanks for help if you've got a clue on that issue.

I found the answer the previous issue.

It was coming from the preg-replace pattern used to split the name attribute (line 27 of class.eventex.php) :

const REGEX_PLACEHOLDER = '/([a-z-]+)[(([^[:]+)(?::([^[]*))*)]/';

This pattern split string that looks like

section-name[number][field-name]

I realized I was using numbers inside my sections name, and the above pattern doesn't allow them.

changing this pattern to the following solved the issue :

'/([a-z0-9-]+)[(([^[:]+)(?::([^[]*))*)]/'

Hi, me again

I've got another issue using multiple entries update in eventEx, in conjunction with form control to display the form.

I want to update (or create) different entries of the same section using mySection[0] , mySection[1]

Everything goes right, my section entries are updated or created as expected, but when I submit the form with an error on a field , the fields of the first entry are not autopopulated as they should be. This behavior is really strange because only the first entry ( mySection[0] ) is concerned, and other entries are well populated. Each time the form come back, the first entry fields are empty.

I've checked the event datasource, the post-values for the first entry are present.

I would really appreciate help on that, my knowledge of symphony is too limited to really understand what's going on.

I'm trying to upload an image, update it's section then add the newly created entry to a Members section (from the front end).

The file uploads and is entered into the Images section but I seem to have hit an impasse in getting the Members section to update.

Upload Form

<form action="" method="post" id="members-form" enctype="multipart/form-data">
    <input type="hidden" name="members[system:id]" value="{//events/member-login-info/@id}"/>
    <input type="hidden" name="images[title]" value="member_{//events/member-login-info/@id}"/>
    <input type="hidden" name="members[avatar]" value="images[system:id]" />

    <fieldset>
      <legend>Edit Profile Picture</legend>
      <label for="fields-image">Image</label>
      <input type="file" id="fields-image" name="images[image]"/>
      <input type="submit" name="action[members-upload-avatar]"/>
        </fieldset>
</form>

Error

strlen() expects parameter 1 to be string, array given
[...] /eventex/lib/class.eventex.php around line 558

Code around 558

if(is_array($fields) && !empty($fields))
{
    $post_values = new XMLElement('post-values');

    foreach($fields as $element_name => $value)
    {
        if(strlen($value) == 0) continue; // $value = {@system-id:images@}

        $post_values->appendChild(new XMLElement($element_name, General::sanitize($value)));
    }
    $result->appendChild($post_values);
}

var_dump($fields)

array(1) {
  ["avatar"]=>
  string(20) "{@system-id:images@}"
}

So I'm wondering if my form is incorrect?

If I comment out that block which adds to the XML (Code around 558), each section is updated correctly, so I guess the form is OK.

Whats the best course of action for dealing with this?

$value = {@system-id:images@}

Just returning to this today...

If i check for strings in the foreach

foreach($fields as $element_name => $value)
{
    if( is_string($value) ){
        if(strlen($value) == 0) continue;
        $post_values->appendChild(new XMLElement($element_name, General::sanitize($value)));
    }else{
        foreach($value as $value_name => $value_value){
            $post_values->appendChild(new XMLElement('x-'.$value_name, General::sanitize($value_value)));
         }
    }
 }

It seems to output the post values twice, presumably in this case because I have 2 fields. Is this likely to cause a problem?

Output

<events>
    <member-login-info logged-in="yes" id="7" result="success" />
    <members-upload-avatar>
        <entry id="7" result="success" type="edited" section-id="7" section-handle="members">
            <filter name="permission" status="passed" />
            <message>Entry edited successfully.</message>
            <post-values>
                <avatar>{@system-id:images@}</avatar>
            </post-values>
            <post-values>
                <avatar>{@system-id:images@}</avatar>
            </post-values>
        </entry>
        <entry id="23" result="success" type="created" section-id="5" section-handle="images">
            <filter name="permission" status="passed" />
            <message>Entry created successfully.</message>
            <post-values>
                <title>member_7</title>
                <image>
                    <name>0000125.jpg</name>
                    <type>image/jpeg</type>
                    <tmp-name>/Applications/MAMP/tmp/php/phpHK4n6w</tmp-name>
                    <size>48738</size>
                </image>
            </post-values>
            <post-values>
                <title>member_7</title>
                <x-name>0000125.jpg</x-name>
                <x-type>image/jpeg</x-type>
                <x-tmp_name>/Applications/MAMP/tmp/php/phpHK4n6w</x-tmp_name>
                <x-error>0</x-error>
                <x-size>48738</x-size>
            </post-values>
        </entry>
    </members-upload-avatar>
</events>

I found the answer for the issue submitted in comment #94.

Form control didn't display the first entry because the @index-key attribute is not available in the <events> node for the fisrt entry.

Looking into Event Ex code, line 533

if ($index_key)
    $result->setAttribute(EventEx::ATTRIBUTE_INDEX_KEY, $index_key);

This condition return false if $index_key is 0 Changing the condition to the following solved my problem

if ($index_key or $index_key==0){
        $result->setAttribute(EventEx::ATTRIBUTE_INDEX_KEY, $index_key);
    }

I don't know though if this is going to break something else, hope not.

Has anyone started updating this for 2.3? If yes, I wouldn't want to duplicate his / her work ...

Yep. I'm using it in a WIP project, updating it when I find something not working. https://github.com/klaftertief/eventex

I have to modify the getSource function to prevent errors in the event page

public static function getSource(){
    if (Symphony::Engine() instanceof Frontend) {
        return array('seftion-foo', 'section-bar');
    } else {
        return 'Sections Foo and Bar';
    }
}

And when time allows I'd like to use the new event providers (to be) introduced in Symphony 2.3.1 to have a UI for the EEx events.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details