Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 3:44 am (All times are UTC )

 




Post new topic Reply to topic  [ 16 posts ] 
Author Message
Posted: Tue Jun 06, 2006 5:31 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Offline

Joined: Sun Aug 21, 2005 2:25 pm
Posts: 4103
Location: Somewhere Near Here
Using the cafepress component (admittedly very old and outdated, but the only one of its kind)  there is an error reported. 

Quote:
Warning: Invalid argument supplied for foreach() in SITEPATH\includes\frontend.php line85


If you change the new outlined below with the old outlined below the error corrects itself.

How it is fixed was mentioned in this post: http://forum.joomla.org/index.php/topic,66935.0.html

Below is the relevant snippets including versioning.

Here is what is in the old 1.0.8 frontend.php:

Code:
* @version $Id: frontend.php 2456 2006-02-18 01:36:30Z stingrey $


/**
* Cache some modules information
* @return array
*/
function &initModules() {
   global $database, $my, $Itemid;

   if (!isset( $GLOBALS['_MOS_MODULES'] )) {
      $query = "SELECT id, title, module, position, content, showtitle, params"
      . "\n FROM #__modules AS m"
      . "\n INNER JOIN #__modules_menu AS mm ON mm.moduleid = m.id"
      . "\n WHERE m.published = 1"
      . "\n AND m.access <= '". $my->gid ."'"
      . "\n AND m.client_id != 1"
      . "\n AND ( mm.menuid = '". $Itemid ."' OR mm.menuid = 0 )"
      . "\n ORDER BY ordering";

      $database->setQuery( $query );
      $modules = $database->loadObjectList();
      foreach ($modules as $module) {
         $GLOBALS['_MOS_MODULES'][$module->position][] = $module;
      }
   }
   return $GLOBALS['_MOS_MODULES'];
}
/**


Here is the new frontend.php for 1.0.9:

Code:
* @version $Id: frontend.php 3830 2006-06-03 15:53:37Z stingrey $
/**
* Cache some modules information
* @return array
*/
function &initModules() {
   global $database, $my, $Itemid;

   if (!isset( $GLOBALS['_MOS_MODULES'] )) {
      $query = "SELECT id, title, module, position, content, showtitle, params"
      . "\n FROM #__modules AS m"
      . "\n INNER JOIN #__modules_menu AS mm ON mm.moduleid = m.id"
      . "\n WHERE m.published = 1"
      . "\n AND m.access <= $my->gid"
      . "\n AND m.client_id != 1"
      . "\n AND ( mm.menuid = $Itemid OR mm.menuid = 0 )"
      . "\n ORDER BY ordering";

      $database->setQuery( $query );
      $modules = $database->loadObjectList();
      
      foreach ($modules as $module) {
         $GLOBALS['_MOS_MODULES'][$module->position][] = $module;
      }
   }
   return $GLOBALS['_MOS_MODULES'];
}
/**


Are there consequences to changing this part of the frontend.php in terms of security or stability?

_________________
Love good music, especially the blues? http://www.jennifermarriott.com
Need a Joomla Consultant? http://www.marpomultimedia.com
JOOMLA ROCKS


Last edited by stingrey on Fri Jun 16, 2006 2:38 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Tue Jun 06, 2006 5:36 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
MMMedia wrote:
Are there consequences to changing this part of the frontend.php in terms of security or stability?

No there is not.


The change was made to correct the value check, to ensure the correct variable type of mm.menuid
mm.menuid is an integer variable, using quotes can slow the query very very slightly as the use of quotes changes the value to a string value rather than an integer value.

However, it seems some components are not correctly returning any Itemid value, thuis resulting in the check being
mm.menuid = OR mm.menuid = 0
which causes an error in the query

The query can however handle a case where the query is
mm.menuid = '' OR mm.menuid = 0

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Last edited by stingrey on Tue Jun 06, 2006 5:40 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Tue Jun 06, 2006 5:38 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Offline

Joined: Sun Aug 21, 2005 2:25 pm
Posts: 4103
Location: Somewhere Near Here
Thanks for the reply Rey.  Great job on 1.0.9 .. it is a work of beauty. :)

_________________
Love good music, especially the blues? http://www.jennifermarriott.com
Need a Joomla Consultant? http://www.marpomultimedia.com
JOOMLA ROCKS


Top
  E-mail  
 
Posted: Tue Jun 13, 2006 11:52 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Sat Aug 20, 2005 3:47 pm
Posts: 89
Location: Germany/ Berlin
it would be meaningfully to be referred the developers of addons to this change. there are some modules and components infacted.

_________________
Mach mit bei Day of Om
Investiere in Hyperlinks


Top
  E-mail  
 
Posted: Tue Jun 13, 2006 2:43 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
alphanostrum wrote:
it would be meaningfully to be referred the developers of addons to this change. there are some modules and components infacted.

Well actually it is probably a bug and we'll have to figure a more graceful way to handle it in next release.

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Top
  E-mail  
 
Posted: Fri Jun 16, 2006 2:39 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
Fixed in SVN

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Top
  E-mail  
 
Posted: Sun Jun 18, 2006 2:00 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Apr 06, 2006 3:42 pm
Posts: 90
Location: Leeuwarden
Hello Stingrey,

Great that this is fixed already. I'm new in Joomla and do not know what SVN means. Where can I find this update or fix?
If you save a new profile (adding a wrong avatar or making a sign) at Joomlaboard of two shoes you will get this error. That was after the Joomla 1.09 stabel upgrade  :P

I would like to fix this as soon as possible before upgrading all sites with Joomlaboard to 1.09.

So...where can I find this SVN?

Many thanks Stingrey...Without Joomla life will be empty!  ;D

_________________
Qua Patet Orbis http://www.coconutswebdesign.nl http://www.coconutshosting.nl


Top
   
 
Posted: Sun Jun 18, 2006 2:04 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
http://dev.joomla.org/content/view/17/60/#subversion
http://dev.joomla.org/component/option, ... ,33/p,110/

Use with caution - it is not for the faith hearted



Also note the fix proposed by MMMedia at the start of this thread is a valid temporary fix

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Top
  E-mail  
 
Posted: Sun Jun 18, 2006 2:10 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri May 12, 2006 8:37 am
Posts: 119
Location: Sofia
Thanks for this solution, guys! It is refreshing to know that back compatibility is in value here, at Joomla. Several days ago we've tried to install FlySpray and this was the first obstacle to overcome. The second was not Joomla-related, but the fact is that now this component works fine with 1.0.9.

stingrey,

I suppose this is the 1.5 version, isn't it?

_________________
Prof. Dr. Plamen Gradinarov - CEO and Founder, Eurasia Ltd


Top
  E-mail  
 
Posted: Sun Jun 18, 2006 2:19 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
Imago wrote:
I suppose this is the 1.5 version, isn't it?

Sorry not sure what you mean.

There will be a 1.0.10 release as part fo the 1.0.x stability series.


The link on the svn page gives info on how to pull svn of 1.0.x and 1.5.x

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Top
  E-mail  
 
Posted: Sun Jun 18, 2006 2:20 pm 
User avatar
Joomla! Hero
Joomla! Hero
Offline

Joined: Mon Aug 15, 2005 4:36 pm
Posts: 2399
Location: Marikina, Metro Manila, Philippines
Imago wrote:
Thanks for this solution, guys! It is refreshing to know that back compatibility is in value here, at Joomla.

Backward compatability in the 1.0.x series is one of the central tenets that guides the work done for it.

Unfortunately in this instance a change was not as fully tested as it shoudl have been.

_________________
God grant me the Serenity to Accept the things I cannot change, the Courage to change the things I can and the Wisdom to know the Difference.


Last edited by stingrey on Sun Jun 18, 2006 2:22 pm, edited 1 time in total.

Top
  E-mail  
 
Posted: Sun Jun 18, 2006 2:27 pm 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Apr 06, 2006 3:42 pm
Posts: 90
Location: Leeuwarden
stingrey wrote:
http://dev.joomla.org/content/view/17/60/#subversion
http://dev.joomla.org/component/option, ... ,33/p,110/

Use with caution - it is not for the faith hearted



Also note the fix proposed by MMMedia at the start of this thread is a valid temporary fix


Many thanks Stingrey!!
More to read and learn for me before I do understand the SVN. That will help me a lot.
In the meantime I have find this topic:
http://forum.joomla.org/index.php/topic,69719.0.html

This fixed for now the problem with Joomlaboard and frontend.php. When I have read all about SVN, I will look at it again, hoping this fix is not bad for the system and security :o

_________________
Qua Patet Orbis http://www.coconutswebdesign.nl http://www.coconutshosting.nl


Top
   
 
Posted: Thu Jun 22, 2006 1:21 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Fri Mar 24, 2006 12:25 am
Posts: 25
Hi the problem that I'm having is that I've got a php includes added to my template, when my includes is in there the modules don't work, when i remove the includes everything works fine.  I'm using Moset Tree and the problem is non of the featured items ect are loading when i have my menu system enabled threw a PHP includes.  This worked fine in 1.0.8 so I'm assuming it's related.  Does anyone have an idea?  Please Help I'm Lost


Top
  E-mail  
 
Posted: Wed Sep 06, 2006 11:13 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Sep 06, 2006 10:56 pm
Posts: 4
Hey all!

I am using Joomlaboard 1.1.2 stable (from Two Shoes M-Factory) on a couple sites and when users enter a signature file (among other profile edits) a error is being displayed multiple times (4x?).  The error is:

Warning: Invalid argument supplied for foreach() in /home/content/s/a/n/sanmarcos/html/includes/frontend.php on line 93

Any suggestions what this can be?  Is it related to this issue?  I am using Joomla! 1.0.11 stable.

I appreciate any help or suggestions!


Top
   
 
Posted: Thu Sep 07, 2006 6:39 am 
User avatar
Joomla! Intern
Joomla! Intern
Offline

Joined: Thu Apr 06, 2006 3:42 pm
Posts: 90
Location: Leeuwarden
Hello Yodajones,

I'm not sure if it is the same but it looks almost the same and I had also, on a other php line that error with Joomlaboard. I have Joomla 1.010 so that could be the differents.
Just have a look at http://forum.joomla.org/index.php/topic,69719.0.html
That fixt my error with the frontpage with Joomla 1.010 and Joomlaboard

_________________
Qua Patet Orbis http://www.coconutswebdesign.nl http://www.coconutshosting.nl


Top
   
 
Posted: Thu Sep 07, 2006 5:05 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Sep 06, 2006 10:56 pm
Posts: 4
Hi Schipperijn !

Thank you for the reply.  I found this post last night and it solved my problems.  The two files affected are:

post.php
userprofile.php

These two files are part of Joomlaboard.

I found the solution here:
http://forum.joomla.org/index.php/topic,83874.0.html

One file has a ">" too many, and the other file has a "$" too few.

After changing these files my Joomlaboard installations worked perfectly!

I hope this helps other too!

All the best!


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group