We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Part of what made it confusing to me was that I couldn’t accomplish anything in the tab. There’s no way to turn on the "save" button in IE7 or FF3.

    Could you say more about how MODx handles the "default properties" set here? Are they available automatically in the snippet, or does the snippet have to go and get them?
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: BobRay at Oct 06, 2008, 05:59 PM

      Could you say more about how MODx handles the "default properties" set here? Are they available automatically in the snippet, or does the snippet have to go and get them?
      Automatically available, as they always have been, in the script. The properties are extract()’d before eval() is called in the legacy code, and in Revolution, they are extract()’d inside the function that is generated from the script, as well as being available from the $scriptProperties parameter used by every modScript object (of which modSnippet, modPlugin, and modModule are all derivatives).

      Here is a sample Revolution cache file representing a simple plugin, which is generated by modCacheManager::generateScriptFile():
      <?php 
      function web_elements_modPlugin_1($scriptProperties= array()) {
      global $modx;
      if (is_array($scriptProperties)) {
      extract($scriptProperties, EXTR_SKIP);
      }
      switch ($modx->config['http_host']) {
          case '127.0.0.1:80':
          case '127.0.0.1':
              // if the http_host is of a specific domain, switch the context
              $modx->switchContext('test');
              break;
          default:
              // by default, don't do anything
              break;
      }
      }
      

      All it does is wrap the source of your script within a simple global function which is include_once()’d when needed:
      <?php
      function [context]_elements_[class]_[id]($scriptProperties= array()) {
      global $modx;
      if (is_array($scriptProperties)) {
      extract($scriptProperties, EXTR_SKIP);
      }
      // Your script will be here
      }
      


      See modElement::process() for how those properties are handled by every single Element (chunks, tv’s, snippets, plugins, modules, etc.) in MODx Revolution.
        • 3749
        • 24,544 Posts
        Ok, I get it now. I would guess it’s not something that will be used by most snippet developers and may not deserve to be that prominent, but I can see where it might be difficult to put it anywhere else.





          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 3749
          • 24,544 Posts
          Quote from: OpenGeek at Oct 06, 2008, 10:32 AM

          Resource ID’s should probably not be used in Settings for such purposes, though I do not understand the problem this solution attempts to solve clearly and want to reserve full judgment until I do.

          I wanted to get some more feedback on this. My goal with SPForm is to try to get the user as close as I can to having a working contact form on the site when the package is installed.

          It (SPForm) unique in that it’s really three snippets that each go in separate documents. The first forwards to the second and the second forwards to the third. No form forwards to its own URL which makes things a little harder for bots and hardens it slightly in other ways.

          To do the forwarding, the pages need to know the ID of the pages they’re forwarding to, which will be different on each site, although they are fixed values rather than default settings.

          I can make the user set them, but SPForm is aimed at less tech-savvy users who just want to throw up a quick, spam-proof contact form (the rest are more likely to use eForm). So I thought I’d try to make life easy for them by automating it. If I set the two page IDs, SPForm could be completely functional on installation (sending to the site’s default email address).

          I could put them in a file or in a custom table in the DB, but I’m thinking that would cause a significantly bigger performance hit than just making two extra system settings which, once they’re cached, wouldn’t be too much of a burden.

          I also considered setting one more system setting called spf_key that would be different for each site and would be used for authentification between the two main pages but can’t decide if it’s really necessary (and there may already be a system setting or $_SESSION variable that I could use for this instead).
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 22303 MODX Staff
            • 10,725 Posts
            Quote from: BobRay at Oct 07, 2008, 12:23 AM

            It (SPForm) unique in that it’s really three snippets that each go in separate documents. The first forwards to the second and the second forwards to the third. No form forwards to its own URL which makes things a little harder for bots and hardens it slightly in other ways.

            To do the forwarding, the pages need to know the ID of the pages they’re forwarding to, which will be different on each site, although they are fixed values rather than default settings.

            I can make the user set them, but SPForm is aimed at less tech-savvy users who just want to throw up a quick, spam-proof contact form (the rest are more likely to use eForm). So I thought I’d try to make life easy for them by automating it. If I set the two page IDs, SPForm could be completely functional on installation (sending to the site’s default email address).
            This is still what default snippet properties are for IMHO; you just have a tricky situation. Package up the Snippets, and then the Resources (aka documents). With each Resource (in it’s own vehicle, or in a single vehicle if one is a parent to the others) simply attach php resolver scripts to the Resource( s ) that will use the id property after it’s inserted, found, and/or updated to set the default properties of the appropriate Snippet( s ).

            My rule of thumb is not to burden the global variable scope (as system settings kind of represent in the MODx configuration) with things that are only used in a few specific requests.
              • 3749
              • 24,544 Posts
              Thanks. I’ve found a good way of doing it without using any custom System Settings at all (though you still might not approve). wink

              I’ve put all the default settings in a chunk as

              $spfconfig[’key’] = ’Value’;

              The ones I previously used System Settings for have unique placeholders and I set them by modifying the chunk’s contents the first time the main snippet executes.

              I get the chunk’s contents and run it through eval() to set the values at the beginning of the each snippet.

              The user can override some of the the options (I could make it all of them) with parameters in the snippet call. They can also change the defaults by editing the spfconfig chunk.

              This way, I don’t need to do anything exotic during the build.

              As a bonus, the add-on produces a published, working contact page that sends mail to the admin as soon as the package is installed.

              I know there are potential dangers with eval() and a malicious user could cause a lot of trouble by editing the chunk, but if that user can edit chunks (or has access to the DB), they can cause plenty of trouble already.

                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 22303 MODX Staff
                • 10,725 Posts
                Hmm, you are right, I think this is still not the proper approach. I really don’t see why this can’t be default properties for the snippets. Otherwise, I would use a simple php include file to include these values.
                  • 3749
                  • 24,544 Posts
                  Quote from: OpenGeek at Oct 13, 2008, 10:13 AM

                  Hmm, you are right, I think this is still not the proper approach. I really don’t see why this can’t be default properties for the snippets. Otherwise, I would use a simple php include file to include these values.

                  I’m not surprised. wink

                  I may ultimately give up and just do it the old-fashioned way with parameters and default values, but this was an interesting challenge to implement.

                  I didn’t want to burden the user with having to find and edit the include file (it’s much easier to find and edit the spfconfig chunk) or to have to find and type (or mistype) the parameters in all three snippet calls (and make sure they all match). There are so many parameters and the user might want to change them often to help throw off spammers.

                  The attraction of doing it this way is that the user now sees a complete comment describing exactly what the parameter does, why they’d want to use it, and what the side effects are (instead of a brief, cryptic comment in a parameter table), in the same place they set the parameter. They get there just by clicking on the congif chunk in the tree -- no need to choose among the various web sites that might or might not give them good information about the parameters.

                  It also makes it possible to set the config values that must be customized for each site (email, host, ect.) just once when the snippet first runs but still have them editable by the user.

                  I know it’s not the traditional way of doing things, but it appears to work really really, well and is mucho convenient for the user (as well as for me with respect to documentation). I’d need more convincing that there’s anything truly wrong or dangerous in the approach (and I could always parse the config chunk manually to avoid eval() if necessary).

                  I would almost go so far as to say that if more snippets behaved this way, it would be a better world. wink

                  Although it doesn’t seem so for a programmer, controlling a snippet’s behavior by carefully typing in a list of case-sensitive parameters that all have to be precisely formatted with ampersands and back-ticks isn’t an easy task for a lot of MODx users. It’s pretty daunting for users who typically control apps by selecting options in a GUI. People who are used to MODx take it for granted, but you can see on the forums that it’s a significant hurdle for new users.

                  This approach is less useful for snippets that will be use in different ways on different pages, but I do have it set so you can specify the config chunk name in the snippet call so it’s easy to duplicate the chunk and have a different set of values for another call to the snippet.

                  I could also easily make the parameters in the snippet call override the ones in the chunk, but I’m not sure that would improve the experience for the user in any way.



                  PS: @Jason -- I’m guessing this isn’t how you planned to spend your afternoon. wink

                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 22303 MODX Staff
                    • 10,725 Posts
                    Quote from: BobRay at Oct 13, 2008, 03:28 PM

                    I didn’t want to burden the user with having to find and edit the include file (it’s much easier to find and edit the spfconfig chunk) or to have to find and type (or mistype) the parameters in all three snippet calls (and make sure they all match). There are so many parameters and the user might want to change them often to help throw off spammers.
                    ...

                    I know it’s not the traditional way of doing things, but it appears to work really really, well and is mucho convenient for the user (as well as for me with respect to documentation). I’d need more convincing that there’s anything truly wrong or dangerous in the approach (and I could always parse the config chunk manually to avoid eval() if necessary).
                    Ok, we’re still misunderstanding each other clearly so let’s step back. I still insist using a chunk is a critical mistake that will mislead other developers into doing things this way right out of the gate.  Use another snippet if you are going to do this and process it in the intended way.  We’re still missing the point I think with this back and forth over configuration settings and element properties...

                    Quote from: BobRay at Oct 13, 2008, 03:28 PM

                    I could also easily make the parameters in the snippet call override the ones in the chunk, but I’m not sure that would improve the experience for the user in any way.
                    The intention was for configuration settings (system, context, and user) to provide exactly the kinds of default values you are talking about, for multi-element components to share settings that could be overridden implicitly in the configuration, as well as explicitly through the element properties (or parameters).  So I would say the snippet properties need to override the configuration settings which you can deliver from the package as system settings and/or context settings for each context it would apply to.  This is the best practice I want to present to the developers, so please continue to help me get there, as you are doing.

                    Specifically, what, besides making the default properties for a snippet an editable grid, do they need to be able to do?  I think I have an idea how, without changing the format for them in the database, we can make them be editable the way we want, and even use lexicon keys as the short description to render in the interface.  Would that convince you to use the combination of context settings and snippet properties to handle these configurations from system to element?

                    Quote from: BobRay at Oct 13, 2008, 03:28 PM

                    PS: @Jason -- I’m guessing this isn’t how you planned to spend your afternoon.  wink
                    These conversations (and writing developer documentation) are exactly how I should be spending my afternoons!  wink

                    You’ve convinced me to expand how default element properties work for beta.
                      • 3749
                      • 24,544 Posts
                      Quote from: OpenGeek at Oct 13, 2008, 03:57 PM

                      Ok, we’re still misunderstanding each other clearly so let’s step back. I still insist using a chunk is a critical mistake that will mislead other developers into doing things this way right out of the gate. Use another snippet if you are going to do this and process it in the intended way. We’re still missing the point I think with this back and forth over configuration settings and element properties...

                      Ok (stepping back), I get your point that what I’m doing is a perversion of what chunks are for and I’ve come to agree that it would serve as a bad example and I shouldn’t do it. As an interim solution, what if I put the code in a snippet instead? I could use runSnippet() instead of eval() if you think that would be a better option. Would the variables set in that snippet be available following the runSnippet() call?

                      Quote from: BobRay at Oct 13, 2008, 03:28 PM

                      I could also easily make the parameters in the snippet call override the ones in the chunk, but I’m not sure that would improve the experience for the user in any way.

                      The intention was for configuration settings (system, context, and user) to provide exactly the kinds of default values you are talking about, for multi-element components to share settings that could be overridden implicitly in the configuration, as well as explicitly through the element properties (or parameters). So I would say the snippet properties need to override the configuration settings which you can deliver from the package as system settings and/or context settings for each context it would apply to. This is the best practice I want to present to the developers, so please continue to help me get there, as you are doing.

                      Well, we’ve established that the default System Settings are generally read-only values for system-wide settings that will be available everywhere, so they’re no use to me -- we presumably don’t want every default parameter for every snippet crapping up the system settings table. It also seems like overkill to have every package operate in its own context and create System settings for its own use, though that would be a solution if it was easy to understand and do. At present, I don’t really understand what "context settings" actually are or how they work (unless they’re regular System Settings that only apply in that context). And, if I’m correct that they don’t apply across requests to files in another context, they don’t solve the problem in this particular case. Nor do $_SESSION variables help, for security reasons, in this case.

                      Specifically, what, besides making the default properties for a snippet an editable grid, do they need to be able to do? I think I have an idea how, without changing the format for them in the database, we can make them be editable the way we want, and even use lexicon keys as the short description to render in the interface. Would that convince you to use the combination of context settings and snippet properties to handle these configurations from system to element?

                      To answer that, I’d have to understand "context settings," which I don’t. There’s no "context" field in the System Settings grid and I don’t see any place in the Manager to set "context settings."

                      Actually, I’m not sure exactly what you mean when you say "snippet properties" either. I’ve been assuming that you mean those things that are often set with the ternary operator in snippets;

                      $setting = isset($param1)? $param1 : 'default value';


                      But it’s not clear to me if you consider the things set via parameters in the snippet call to be "snippet properties" or not, so this may be part of our miscommunication.

                      My primary goal, in this particular case, is to let the snippet user control the behavior of the snippet without using any parameters in the snippet call. In the case of SPForm, having them in a grid might be fine, since the package is likely to be used just once per web site. With things like Ditto or Wayfinder, though, the user would need to control each instance of the snippet and I’m not sure how that would be accomplished unless the parameters in the snippet call would override those in the grid.

                      Let me include the code I currently have in the config chunk so you can have a clearer picture of what I’m doing. The variables that start with an underscore, [email protected], and [email protected] are replaced the first time the snippet runs with the appropriate values.

                        /* SPForm Config File
                      
                      Snippet:       SPForm
                      Version: 3.0.2
                      $Revision: 162 $
                      $Author: Bob Ray $
                      $Date: 2008-10-12 16:59:02 -0500 (Sun, 12 Oct 2008) $
                      Adapted from:  Many sources but particularly scform by James Seymour and CFFormProtect by Jake Munson
                      Compatibility: MODX Revolution
                      */
                      
                      /* Note to users:
                       *
                       * You control the behavior of SPForm by editing this
                       * file. The comments in the file will tell you what
                       * each option does.
                       *
                       * Even a minor error in this config will keep SPForm
                       * from working. Edit carefully.
                       *
                       * Any line that starts with a
                       * variable name ($variable) should have one of the
                       * following forms:
                       *
                       *      $spfconfig['variable'] = true;
                       *      $spfconfig['variable'] = false;
                       *      $spfconfig['variable'] = "value";
                       *      $spfconfig['variable'] = 'value';
                       *
                       * When editing, be careful to match quote types,
                       * have an even number of quotes, and finish the line
                       * with a semicolon.
                       *
                       * When you change other lines, be sure to leave things
                       * in exactly the same format you found them.
                      */
                      
                      /* this array holds all config data  */
                      
                        $spfconfig = array();
                      
                        $spfconfig['spformPath'] = MODX_ASSETS_PATH . "snippets/spform/";
                        $spfconfig['spformURL'] = MODX_ASSETS_URL . "snippets/spform/";
                      
                        $spfconfig['test_mode'] = false;
                        $spfconfig['spfDebug'] = false;
                      
                      /* Contact Form configuration
                      
                        ***********************************************************
                        Things you should check before using the snippet
                        ***********************************************************/
                      
                       /* SPForm will try to set these variables automatically
                        * when the form is first visited. Preview the form in your
                        * browser and, if the from doesn't work properly, look here */
                      
                      /* $formProAllowedReferers
                       * This is used by the form processor, not the form. Allowed referers are
                       * domains/IPs you will allow this processor to be "called" from. You
                       * probably want this to be, for example, the hostname of the host your
                       * form page is on. If this is empty, *any* host can post to this script.
                       * Then again: The HTTP REFERER is easily faked, and some firewalls and
                       * HTTP proxies delete it, anyway. (See $formProcBlankRefOkay, above.) To
                       * allow any referer, use $spfconfig['formProcAllowedReferers'] = array(); If you use
                       * $spfconfig['chkFormRefOwnServer'] = true; (set below), be sure you have all possible
                       * variants here (e.g. domain.com, www.domain.com).
                       */
                      
                      $spfconfig['formProcAllowedReferers'] = array(
                          'mysite.com'
                      );
                      
                      /* The $recipientArray holds all the possible titles and email addresses
                       * of people who can receive email through the form. Each line needs
                       * three entries, the first is used in error messages if the email
                       * address is poorly formed, the second appears in a drop-down list
                       * on the form if there are multiple recipients, the third is the
                       * email address (can be multiple addresses separated by commas).
                       * here is an example of a multiple list. Notice that the first line
                       * has no email address so selecting it is an error (and spammers will
                       * often select it by default):
                      
                      $spfconfig['recipientArray'] = array (
                      
                      "Please choose a recipient: Please choose a recipient:",
                      "Webmaster: Webmaster: [email protected]",
                      "Sales: Sales: [email protected]",
                      "Support: Support: [email protected]"
                      );
                      
                      * Be careful to make sure that each line has two colons (:),
                      * there are three entries for each actual recipient, there are
                      * exactly two quotation marks surrounding the line, and each line
                      * except the last is followed by a comma.
                      *
                      * The following single-line version is the default.
                      * replace it with the multiple-line version above if desired
                      * (edited to match your needs).
                      */
                      
                      $spfconfig['recipientArray'] = array (
                      "Webmaster: Webmaster: [email protected]"
                      );
                      
                      /* The next two variables are the MODx resource IDs of the spformproc
                       *  and spfresonse resources */
                      
                      $spfconfig['spformProcID'] = "_spformprocid";
                      $spfconfig['spfResponseID'] = "_spfresponseid";
                      
                      /* Where to email error reports */
                      
                      $spfconfig['errorsTo'] = "[email protected]";
                      
                      /*
                       * **************************************
                       * Settings you can change or leave alone
                       * ***************************************  */
                       /*
                       By default, SPForm uses mail() to send mail. If you change the following
                       parameter to true, SPForm will use SMTP to send mail. To use SMTP, you must
                       set the port, host, username and password. The email account doesn't need
                       to be on the same host. You can use any account you have at any host.
                       */
                      
                       $spfconfig['spfUseSMTP'] = false;
                      
                       if ($spfUseSMTP) {
                           $spfconfig['spfSMTP_Port'] = 587;  /* default port for authenticated e-mail - many hosts now block port 25. */
                           $spfconfig['spfSMTP_Host'] = "yourhost.com";
                           $spfconfig['spfSMTP_UserName'] = "yourUserName";
                           $spfconfig['spfSMTP_Password'] = "yourPassword";
                       }
                      
                      
                       /*
                       * Use hidden form field (idea suggested by RThrash) If this is true, a
                       * "Last__Name" field will be added to your form and then hidden by the CSS
                       * styling, automatically injected by SPForm. If it's filled in (presumably
                       * by spammer autobots), nothing is sent. The "hidden" content is not really
                       * hidden, just not visible, so no worries about being penalized by Google.
                       * Visually challenged users of text-only browsers or audio browsers MAY see
                       * the input field and fill it (although the text warns them not to).
                       * It works like a charm.
                       */
                      
                       $spfconfig['useHiddenField'] = true;
                      
                      /*
                       * If $spfconfig['useHiddenField'] = true and $spfconfig['warnHiddenField'] = true,
                       * the user will be told that they shouldn't have filled the field.
                       * If $spfconfig['useHiddenField'] = true and $spfconfig['warnHiddenField'] = false,
                       * the script will exit with no warning if the field is filled.
                       */
                      
                      $spfconfig['warnHiddenField'] = false;
                      
                      /* log users who fill in the hidden field
                       * only applies if warn is false */
                      
                      $spfconfig['logOnHidden'] = false;
                      
                       /*
                       * The following three variables require javascript to be on. There is no
                       * warning here, the program just dies on the assumption that a form
                       * without keyboard or mouse use is submitted directly by a spammer. The
                       * first choice is recommended since some disabled users may be restricted
                       * to either a mouse or keyboard. Presumably, voice- or muscle-operated
                       * systems would simulate one or the other.
                       *
                       * For accessibility, it's recommended to use only the the combined
                       * $requireMouseOrKeyboard option. The other two settings are
                       * best used just for testing.
                       */
                      
                      $spfconfig['requireMouseOrKeyboard'] = false;
                      
                      /* If the above is true, the next two are ignored */
                      
                      $spfconfig['requireKeyboard'] = false;
                      $spfconfig['requireMouse'] = false;
                      
                      /* Inform User of mouse and kb errors */
                      
                      $spfconfig['warnMouseAndKeyboard'] = false;
                      
                      
                      /* Log attemps to submit with no mouse or kb (only if one of the above is true)*/
                      
                      $spfconfig['logMouseAndKeyboardErrors'] = true;
                      
                      
                      /*
                       * if $spfconfig['useTimer'] = true, the user will be timed filling out the
                       * contact form. taking too much or too little time will be an error. max and
                       * min variables are in seconds. Note: A user who violates time or any other
                       * check will press back to get to the form but their time won't be reset
                       * unless they reload the form page. They are warned to do this on a timer
                       * violation if $warnTimer=true, but if they make enough errors to get over
                       * the time limit they'll have to re-load the page and lose their work.
                       * That's why the default max is 30 minutes.
                       */
                      
                      $spfconfig['useTimer'] = false;
                      $spfconfig['useTimerMin'] = 10;
                      $spfconfig['useTimerMax'] = 30 * 60;
                      
                      /* Warn users of timer violations.  If on, the user is warned to go back
                       * and reload the form page to reset the timer (otherwise, the elapsed
                       * time will keep getting longer and longer). If you set this to false,
                       * you might want to raise $useTimerMax.  */
                      
                      $spfconfig['warnTimer'] = true;
                      
                      /* Obfuscate timer value */
                      
                      $spfconfig['timerOffset'] = 14543;
                      
                      /* Log timer violations if $spfconfig['useTimer'] = true */
                      
                      $spfconfig['logOnTimer'] = true;
                      
                      /*
                       * Add distinctive prefix to "Subject:" in "[]" field? The "distinctive
                       * prefix" will be the sole contents of the "Subject:" line, less the "[]",
                       * if $requireSubj is false and there's no Subject. */
                      
                      $spfconfig['addSubjSig'] = true;
                      
                      /*
                       * Default "Subject:" line or "distinctive prefix" if $addSubjSig is true
                       * and there's a subject provided, the subject line will have [your prefix]
                       * followed by user's subject.
                       * Example: $spfconfig['dfltSubj'] = "Sent from My Web Site";
                       */
                      
                      $spfconfig['dfltSubj'] = $_SERVER['SERVER_NAME'] . " contact";
                      
                      /*
                       * Keep spammers from pasting too many links into your form and sending it
                       * (counts "http" instances); If people normally send you lots of links
                       * in one message, you'll want to change this.
                       */
                      
                      $spfconfig['maxLinks'] = 3;
                      
                      /* Maximum length of recipient (make sure it's long enough for all your recipient's email addresses) */
                      
                      $spfconfig['maxRecipientLen'] = 65;
                      
                      /* Maximum subject field length */
                      
                      $spfconfig['maxSubjectLen'] = 100;
                      
                      /* All emails sent will be cc'd to this email address */
                      
                      $spfconfig['mailAlso'] = "";
                      
                      /*
                       * Which form fields are optional. It is assumed that nobody would want
                       * comments to be optional.
                       */
                      
                      $spfconfig['requireName'] = true;
                      $spfconfig['requireSubj'] = true;
                      $spfconfig['requireEmail'] = true;
                      
                      /* size of the message window  */
                      
                      $spfconfig['spTextRows'] = 10;
                      $spfconfig['spTextCols'] = 50;
                      
                      /* Include a button that empties all fields in the form so the user
                       *  can start over (the sottwell option) */
                      
                      $spfconfig['spfIncludeResetButton'] = false;
                      
                      /* Show To: message in the form if there's only one recipient */
                      
                      $spfconfig['spShowSingleRecipientTo'] = false;
                      
                      /*
                       * $requireVerify is set to false, by default, for maximum portability.
                       * Servers need the GD library and Freetype enabled for this to
                       * work. Also, it's cumbersome for users and sometimes impossible for users
                       * with disabilities. With so many other protections in SPForm, it may not
                       * be necessary.
                       *
                       * NOTE: If $spfconfig['requireVerify'] = true, and the modx system setting
                       * captcha_use_mathsting is set, the user will be asked to solve
                       * a simple math equation. Useful now since regular CAPTCHA can be read by bots.
                       */
                      
                      $spfconfig['requireVerify'] = false;
                      
                      
                      /* Warn violators that they've entered the wrong code */
                      
                      $spfconfig['warnVerify'] = true;
                      
                      /*
                       * Info to optionally add to emailed form. Set to true for each you want.
                       * Will be stashed in X-Headers.
                       */
                      
                      $spfconfig['reportRemoteHost'] = true;
                      $spfconfig['reportRemoteUser'] = true;
                      $spfconfig['reportRemoteAddr'] = true;
                      $spfconfig['reportRemoteIdent'] = true;
                      $spfconfig['reportOrigReferer'] = true;
                      
                      
                      /*
                       * The following are used by the form processor, not the form Some
                       * firewalls and HTTP proxy servers delete the HTTP REFERER. By setting the
                       * following to "true," victims behind such misguided systems will still be
                       * able to use your form.
                       */
                      
                      $spfconfig['formProcBlankRefOkay'] = true;
                      
                      /*  Tell $errorsTo recipient about invalid referer hits? */
                      
                      $spfconfig['adviseOnReferer'] = false;
                      
                      /* Log them */
                      
                      $spfconfig['logOnReferer'] = false;
                      
                      /* Tell 'em they're banned, or silently discard?
                        * You might want to change this after you have
                        * things working well for a while. */
                      
                      $spfconfig['warnBanned'] = true;
                      
                      
                      /* Tell errorTo recipient about bad referer attempts */
                      
                      $spfconfig['adviseOnBan'] = false;
                      
                      /* Log them */
                      
                      $spfconfig['logOnBan'] = false;
                      
                      /* Tell errorsTo recipient about bad CAPTCHA attempts */
                      
                      $spfconfig['adviseOnVerify'] = false;
                      
                      /* Log them */
                      
                      $spfconfig['logOnVerify'] = false;
                      
                      
                      /*
                       * The following variables are used by the form, not the form processor
                       * Check HTTP_REFERER for sanity before even offering the form? Web form
                       * spammers often have HTTP_REFERERS that are blank, the URL of the form
                       * itself, or something entirely made up. Note: Even with the next two set
                       * to false, spformproc will still check the referrer against the list of
                       * allowed referrers as long as $spfconfig['chkFormRefNotBlank'] = true;
                       */
                      
                      $spfconfig['chkFormRefNotSelf'] = false;
                      
                      /*
                       * Insist that, if there's a referer, it's our own server? Note: This can
                       * cause trouble if you (or your host) rewrite the incoming URL by
                       * prepending www or stripping it, or through rewrites or redirection. The
                       * php REFERRER variable may not agree with MODx's idea of the referer.
                       * Some users may get an "invalid referrer" message when submitting. The
                       * problem will be intermittent because users can reach your site with
                       * various URLs.*/
                      
                      $spfconfig['chkFormRefOwnServer'] = false;
                      
                      /*
                       * Make sure not blank? Use $chkFormRefNotBlank with care, as some
                       * firewalls and HTTP proxies delete the REFERER
                       */
                      
                      $spfconfig['chkFormRefNotBlank'] = false;
                      
                      /* The $banList contains a list of banned senders.
                       * These are compared to the email address specified in the
                       * form, the REMOTE_HOST and REMOTE_ADDR, depending on the format.
                       *
                       * Note that each line must be enclosed by exactly two quotation marks and
                       * all lines except the last must be followed by a comma.
                      
                       * Here are some examples -- showing how it's done.
                      
                       '.example.com'       bans any REMOTE_HOST ending in ".example.com"
                       'host.example.com'   bans Any REMOTE_HOST ending in "host.example.com"
                       '10.0.0.0'           bans Exact REMOTE_ADDR IP address
                       '192.168'            bans Any REMOTE_ADDR starting with "192.168"
                       '[email protected]'   bans Specifically "[email protected]" in email address
                       '@example.com'       bans Any user "@example.com" in email address (kind of)
                      *
                      */
                      
                      /* This is the real banList but it is commented out to speed up SPForm slightly
                       * If you need to ban someone, remove the comment tags and edit the list  */
                      
                      /*  ***** remove these lines to activate banlist
                       $spfconfig['banList'] = array (
                      '0.0.0.0',
                      '[email protected]'
                      );
                       ***** remove these lines to activate banlist */


                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting