Evolution 1.0.8 - MODX Community Forums https://forums.modx.com/board/?board=282 <![CDATA[ [Solved] RSS import Snippet and fsockopen problem]]> https://forums.modx.com/thread/87688/solved-rss-import-snippet-and-fsockopen-problem#dis-post-543608
I am using the RSS import snippet in MODx Evolution. It works very well indeed - provided my site is online and connected to the internet. If it is protected by a firewall or the site providing the RSS feed can otherwise not connect, I get the following error:

[quote]« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
  Error: 	fsockopen() [function.fsockopen]: unable to connect to www.bom.gov.au:80 (Connection refused)	 
  Error type/ Nr.: 	Warning - 2	 
  File: 	/Applications/MAMP/htdocs/ses/manager/media/rss/extlib/Snoopy.class.inc	 
  Line: 	1142	 
  Line 1142 source: 	)) 	 
Parser timing
  MySQL: 	0.0120 s	(13 Requests)
  PHP: 	0.0970 s	 
  Total: 	0.1090 s	 [/quote]

I am not bothered by the message - I get it, it can't connect. What I am bothered by is that this message is then all that is visible on my site - and as it is on the home page, that is a big issue.

I have done google searches looking for a better way to handle this error but could not find any advice - most people just wanted it to stop having the problem. I don't mind that sometimes it can't connect - I just want to display a message in place of the feed saying RSS feed unavailable or something like that rather than have the first page of my site just disappear until it can connect again.

Does anyone know if it is possible to add something to the snippet or Snoopy.class.inc that will allow my site to handle this message more elegantly?

Thank you very much,

Kathy smiley]]>
https://forums.modx.com/thread/87688/solved-rss-import-snippet-and-fsockopen-problem#dis-post-543608 Wed, 27 Jul 2016 04:29:09 +0000 https://forums.modx.com/thread/87688/solved-rss-import-snippet-and-fsockopen-problem#dis-post-543608
<![CDATA[eform email with attachment]]> https://forums.modx.com/thread/90741/eform-email-with-attachment#dis-post-497326
I hope someone can assist with this.

I am trying to set up a 'send to friend' function.
Basically the user clicks the 'send to friend' button, is taken to a new page and puts in the email address of a friend.
An email is then sent to the friend with a PDF attachment attached to the email.

Any help with how to set this up would be greatly appreciated.

https://forums.modx.com/thread/90741/eform-email-with-attachment#dis-post-497326 Thu, 08 May 2014 03:09:33 +0000 https://forums.modx.com/thread/90741/eform-email-with-attachment#dis-post-497326
<![CDATA[eForm email from javascript]]> https://forums.modx.com/thread/89179/eform-email-from-javascript#dis-post-490815
Is it possible? If so, does anybody have any pointers? Can I dynamically fill a hidden input field or something?
https://forums.modx.com/thread/89179/eform-email-from-javascript#dis-post-490815 Fri, 21 Feb 2014 11:49:18 +0000 https://forums.modx.com/thread/89179/eform-email-from-javascript#dis-post-490815
<![CDATA[Can't get redirect 301 working with freidnly URLs]]> https://forums.modx.com/thread/89124/can-t-get-redirect-301-working-with-freidnly-urls#dis-post-490184 Description of Problem:
I changed the homepage alias and now I can't get redirect 301 working for the old alias. After the redirect rule is met it moves further to the www.sitename.ru/newailias?q=oldalias URL and reports about page loading problem. Questions:


  1. Why the redirect to the new alias doesn't work
  2. Why 'www' prefix is added
  3. I don't understand why friendly URLs are case sensitive while I have [L,QSA,NC] in the appropriate section.

Any help is appreciated. I am attaching my htaccess file.

P.S. Old alias is 'nachalo', new alias is 'uslugi'.

https://forums.modx.com/thread/89124/can-t-get-redirect-301-working-with-freidnly-urls#dis-post-490184 Sun, 16 Feb 2014 10:43:48 +0000 https://forums.modx.com/thread/89124/can-t-get-redirect-301-working-with-freidnly-urls#dis-post-490184
<![CDATA[problem with www.sitename versus sitename - Modx parse error]]> https://forums.modx.com/thread/87824/problem-with-www-sitename-versus-sitename---modx-parse-error#dis-post-483586 The site works ok when it is caled with www.sitename (www.trueself.hr), but when called with sitename (trueself.hr) it displays following error message:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 »
Please help!

[*]MODX Version:1.0.8
[*]PHP Version:
[*]Database (MySQL, SQL Server, etc) Version:Server: Localhost via UNIX socket
Server type: MySQL
Server version: 5.5.32-cll - MySQL Community Server (GPL)
Protocol version: 10

https://forums.modx.com/thread/87824/problem-with-www-sitename-versus-sitename---modx-parse-error#dis-post-483586 Wed, 20 Nov 2013 07:17:28 +0000 https://forums.modx.com/thread/87824/problem-with-www-sitename-versus-sitename---modx-parse-error#dis-post-483586
<![CDATA[custom db tables access and sql injection / prepared statements]]> https://forums.modx.com/thread/87521/custom-db-tables-access-and-sql-injection-prepared-statements#dis-post-482152
I'm building a website in MODX EVO 1.0.8 that needs to create/update some custom db tables, based on user input and I wish to be extra cautious to avoid any security issues. I'm not an expert in security measures and after some research I got a bit concerned about how I should proceed.

- Example code follows:

1. Retrieving user input
$parameters = $_GET['p'];
$parametersArray = explode("!",$parameters);

2. Inserting new rows I use something like the following:

$queryCreateRecord = $modx->db->insert( $documentArray,'modx_record' );

3. Updating an existing row I use something like the following:

$documentArray['id']= $modx->getLoginUserID();
$documentArray['status']= $parametersArray[1];

$table = $modx->getFullTableName( 'record' );
$queryUpdateRecord= $modx->db->update( 'status= "' .$documentArray['status']. '"', $table, 'id = "' .$documentArray['id']. '"' );

4. Selecting the rows from the db I use something like the following:

$table = $modx->getFullTableName("record");
$db_query = $modx->db->select("*", $table, "status='".$documentArray['status']."'");
if ($modx->db->getRecordCount($db_query) > 0) {
while ($rowC = $modx->db->getRow($db_queryC)) {

- Questions follow:

Is all the above safe or

1. should I use some user input sanitization function?
2. should I use prepared statements to avoid sql injection?
3. is there anything that I'm missing and poses a security threat in the way I handle the input and the db?
4. is there a chance that modx does the above security tasks in the background so I shouldn't worry?

Thank you all in advance, any contribution is deeply appreciated.]]>
https://forums.modx.com/thread/87521/custom-db-tables-access-and-sql-injection-prepared-statements#dis-post-482152 Thu, 07 Nov 2013 09:02:30 +0000 https://forums.modx.com/thread/87521/custom-db-tables-access-and-sql-injection-prepared-statements#dis-post-482152
<![CDATA[Dead resource-link in resource-tree]]> https://forums.modx.com/thread/86502/dead-resource-link-in-resource-tree#dis-post-476842 I searched the forum but came out empty handed.

I client og mine called and he has a weird problem.
In the resource-tree, when i left-click the resource, nothing happens. And when i right-click it i just get the normal browser options (Back, forward, print, source code, etc.).
I tried "Remove Locks" and clear cache - The document is still 'dead'.
System log shows no errors.
He's running Evo 1.0.8, mysql, on a linux setup.

I'm no server-expert so i can't answer too many in-depth questions about that.

I'd very much appreciate if anyone could help me out here - Any suggestions at all.
https://forums.modx.com/thread/86502/dead-resource-link-in-resource-tree#dis-post-476842 Thu, 05 Sep 2013 01:24:53 +0000 https://forums.modx.com/thread/86502/dead-resource-link-in-resource-tree#dis-post-476842
<![CDATA[Using Eval (or similar) to decide whether to render a chunk or not on screen]]> https://forums.modx.com/thread/84955/using-eval-or-similar-to-decide-whether-to-render-a-chunk-or-not-on-screen#dis-post-468890
I have am Evo 1.0.8 site that I am working on, and I have a list of chunks to render within a page, for example {{chunk1}} , {{chunk2}}, {{chunk3}} and {{chunk4}}. Now, the contents of these chunks are template variables, and not all of the template variables are completed in some instances - in these instances I need to be able to evaluate to see if the TVs are complete and if so render the corresponding chunk, if they are empty then I do not want the chunk rendered. I have a checkbox TV to state whether the {{chunk}} should be rendered - but not sure on how to get it to render logically...


If Chunk1Checkbox = "ON" > then render {{chunk1}} on screen
If Chunk2Checkbox = "ON" > then render {{chunk2}} on screen
If Chunk3Checkbox = "" > then do not render {{chunk3}} on screen
If Chunk4Checkbox = "" > then do not render {{chunk4}} on screen

Is this possible? If so how? I can't get my head around it...

Appreciate any insight / tips!

https://forums.modx.com/thread/84955/using-eval-or-similar-to-decide-whether-to-render-a-chunk-or-not-on-screen#dis-post-468890 Wed, 12 Jun 2013 08:30:05 +0000 https://forums.modx.com/thread/84955/using-eval-or-similar-to-decide-whether-to-render-a-chunk-or-not-on-screen#dis-post-468890
<![CDATA[Advise needed]]> https://forums.modx.com/thread/83773/advise-needed#dis-post-465935 https://forums.modx.com/thread/83773/advise-needed#dis-post-465935 Fri, 10 May 2013 07:35:51 +0000 https://forums.modx.com/thread/83773/advise-needed#dis-post-465935 <![CDATA[Retrieving items from a database table and adding them to an existing session array]]> https://forums.modx.com/thread/84113/retrieving-items-from-a-database-table-and-adding-them-to-an-existing-session-array#dis-post-464411 In the code block below, between lines 32 to 44, I am trying to retrieve the 4 items from a row in a table in the database and add them to the session array created at lines 22 to 28. Without the added code (32 to 44) the file works fine, however with the code added nothing is returned and the cart is empty.
Any help to show me where my error is would be appreciated.

// [[orderDetailsInToSESSION]]

if ( empty($_GET['customer']) ) return "no customer account specified";
else {
    // sanitize and validate the input type to make sure it's what you are expecting;
    $customer = $modx->db->escape($_GET['customer']);
    $orderId = $modx->db->escape($_GET['orderId']);
    // get the details from the orderId
    $db_query = $modx->db->select("productId, quantity", $modx->getFullTableName('customer_order_details'), "orderId='" . $orderId . "'");
    if ($modx->db->getRecordCount($db_query) > 0) {
        while ($row = $modx->db->getRow($db_query)) {
            // get the current prices and names of the products previously ordered
            $document_tvs = $modx->getTemplateVars(array("pagetitle", "price", "specialPrice"), "name", $row['productId']);

         // to put the returned array into a simpler/easier to use array use the following
               if (is_array($document_tvs)) {  
               foreach( $document_tvs as $document_TV) {
                $docTVArray[$document_TV['name']] = $document_TV['value'];

          // put these details into the session
         $_SESSION['shoppingCartContents'][] = Array (
              'productId' => $row['productId'],
             'productTitle' => $docTVArray['pagetitle'],
              'price' => ( !empty( $docTVArray['specialPrice']) ) ?  $docTVArray['specialPrice'] :  $docTVArray['price'],
              'quantity' => $row['quantity']
	// if the productId is 219 get the 4 items in the row and add to session array
		if ($_SESSION['shoppingCartContents']['productId'] == 219) {
		$db_query = $modx->db->SELECT("hummusOne, hummusTwo, mayo, jam", $modx->getFullTableName('customer_order_giftpack_details'), "orderId='" . $orderId . "'");
		if ($modx->db->getRecordCount($db_query) > 0) {
                  while ($row = $modx->db->getRow($db_query)) {
		    $_SESSION['shoppingCartContents']['hummusOne'] => $row['hummusOne'],
		    $_SESSION['shoppingCartContents']['hummusTwo'] => $row['hummusTwo'],
		    $_SESSION['shoppingCartContents']['mayo'] => $row['mayo'],
		    $_SESSION['shoppingCartContents']['jam'] => $row['jam']
    } // end of product219 if
https://forums.modx.com/thread/84113/retrieving-items-from-a-database-table-and-adding-them-to-an-existing-session-array#dis-post-464411 Thu, 25 Apr 2013 11:41:17 +0000 https://forums.modx.com/thread/84113/retrieving-items-from-a-database-table-and-adding-them-to-an-existing-session-array#dis-post-464411
<![CDATA[Template Variables breaking site]]> https://forums.modx.com/thread/83934/template-variables-breaking-site#dis-post-463431
When I assign a template variable to a template and select that template for a page, it essentially breaks the page. I get a white bar that covers part of "Edit Resource" and my settings tab disappears. When I select "Preview Resource" I get a blank page that loads instantly. If I remove the template variable from being linked to the template I'm using, it works fine. I also get this issue when using the MODxHost demo template, so I know it isn't my template. I'm almost positive it's not a problem with php, mySQL, or anything like that because this isn't the first site using Modx 1.0.8 on this server and I haven't seen this issue before. However, this isn't the first time I've had issues uploading the Modx files to the server to install. I've never had a problem using Windows 7, but the first time I tried uploading them using my new computer, running Windows 8, it took me a couple tries to get everything uploaded correctly. Could it possibly be an issue with the install? I looked at the database and the records looked fine, but I don't know explicitly what to look for.

Server: Linux version 2.6.32-220.17.1.el6.x86_64
Modx: 1.0.8
PHP: 5.3.23
MySQL: 5.5.30
Browser: Firefox 26.0.1

Also, I included a screenshot of my Edit Resource page when a template variable is assigned to the template I'm using.

I really appreciate any help I can get. I'm pulling my hair out over this.]]>
https://forums.modx.com/thread/83934/template-variables-breaking-site#dis-post-463431 Thu, 18 Apr 2013 08:20:52 +0000 https://forums.modx.com/thread/83934/template-variables-breaking-site#dis-post-463431
<![CDATA[Can't get phpthumb to work in Evo]]> https://forums.modx.com/thread/83669/can-t-get-phpthumb-to-work-in-evo#dis-post-461818 I haven't worked with EVO since 2010, but I have an old project that I need to dust off and I wanted to use phpthumb. I use phpthumbof in every REVO project, so I know how to use it... but for some reason in my EVO project it does not work. The GD Library is installed and working on the server.
I have installed the following version of phpthumbof

Version 0.3.2

I have the images.php in my root website folder, and I am using Ditto to loop through a group of resources to print to the page a set of items.

In my chunk I have a placeholder to my image TV like this:

The placeholder myimage comes from an image TV and processes properly when I do not use the phpthumb of output filter.

I am using the default phpthumb config file and have installed the px:phpthumb snippet. I can't see what is going wrong. The path that is written by the above chunk is:


Not sure why it is calling the page cache here in the path?

Anyone have a clue?

https://forums.modx.com/thread/83669/can-t-get-phpthumb-to-work-in-evo#dis-post-461818 Fri, 05 Apr 2013 06:48:49 +0000 https://forums.modx.com/thread/83669/can-t-get-phpthumb-to-work-in-evo#dis-post-461818
<![CDATA[Evo 1.0.8 - Web group/user access issues]]> https://forums.modx.com/thread/83396/evo-1-0-8---web-group-user-access-issues#dis-post-461194
I am having problems with web groups, web users and access. It seems that if a web user belongs to more than one web group, there can be access permissions difficulties for resources.

So, I set up webuser1 and webgroups 1 and 2 (wg1 & wg2) and set up resource group 1 and 2 (rg1 & rg2) and link rg1 with wg1 and rg2 with wg2.

I then associate webuser1 with wg1 and then with wg2.

webuser1 has access to all resources in rg1, but though they can see the title of rg2 resources in menus and lists, selecting the resource leads to an access denied issue. When I remove wg1 from webuser1, they see wg2 resources perfectly. It is almost as though a web user can only be associated with one web group or resource group.

Can anyone explain why I am having these issues in an area that really should simply be working - it seems to be set up so that web users can belong to more than one web group, but the permissions of each group seem to be confusing each other.

Thanks very much to anyone who can explain this issue to me.

Kathy smiley]]>
https://forums.modx.com/thread/83396/evo-1-0-8---web-group-user-access-issues#dis-post-461194 Mon, 01 Apr 2013 10:43:53 +0000 https://forums.modx.com/thread/83396/evo-1-0-8---web-group-user-access-issues#dis-post-461194