coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: hilophilo on November 19, 2003, 04:38:32 PM

Title: Invalid argument supplied for foreach() in..
Post by: hilophilo on November 19, 2003, 04:38:32 PM
Warning: Invalid argument supplied for foreach() in /.../gallery/themes/hardwired/theme.php on line 1131

i get this warning in the album page. how do i get rid of it?
Title: Invalid argument supplied for foreach() in..
Post by: hilophilo on November 24, 2003, 09:37:03 AM
i seem to get this problem again . Its when i made a album and made it private for only memebers to see it. And when i come back to the gallery front page and try to access my albums it says that line...
Warning: Invalid argument supplied ...
Title: Invalid argument supplied for foreach() in..
Post by: Oasis on November 24, 2003, 02:28:05 PM
in the theme.php of the theme you are using, find

foreach($alb_list as $album) {
$count ++;

$params = array('{COL_WIDTH}' =>
$column_width,
'{ALBUM_TITLE}' => $album['album_title'],
'{THUMB_CELL_WIDTH}' => $thumb_cell_width,
'{ALB_LINK_TGT}' => "thumbnails.php?album=
{$album['aid']}",
'{ALB_LINK_PIC}' => $album['thumb_pic'],
'{ADMIN_MENU}' => $album['album_adm_menu'],
'{ALB_DESC}' => $album['album_desc'],
'{ALB_INFOS}' => $album['album_info'],
);

echo template_eval($album_cell, $params);

if ($count % $columns == 0 && $count < count
($alb_list)) {
echo $rows_separator;
}
}

and add before it
if (is_array($alb_list)) {
and after it
}
Title: Invalid argument supplied for foreach() in..
Post by: hilophilo on November 24, 2003, 10:03:13 PM
the warnings is gone but now i cant view, edit my album, etc.
Title: Invalid argument supplied for foreach() in..
Post by: Joachim Müller on November 24, 2003, 10:17:08 PM
Oasis has taken a look into this - seems to be related to wrong coppermine setup, please check the tracker # 825373 (http://sourceforge.net/tracker/index.php?func=detail&aid=825373&group_id=89658&atid=590907)

GauGau
Title: Invalid argument supplied for foreach() in..
Post by: Oasis on November 25, 2003, 01:12:52 AM
OK, this is going to require some more work than I thought.... For the time being, if you want it to work correctly, go to the configuration screen of coppermine, and turn "Show private album Icon to unlogged user" to "Yes". This will solve the problems temporarily (until we find a fix for it)

Let me check this..
Is this what you did: You created an album with the admin accout, and set it so that only members of a certain group can see it, then you can't edit it anymore. Am I correct?

@gaugau: It doesn't seem to be a setup problem. It happens on a clean install too.
Title: Invalid argument supplied for foreach() in..
Post by: hilophilo on November 25, 2003, 02:01:38 AM
thats right.
Title: Invalid argument supplied for foreach() in..
Post by: Oasis on November 25, 2003, 02:23:18 AM
For now, set "Show private album Icon to unlogged user" to "Yes"

and you will be able to see/edit the album
Title: Invalid argument supplied for foreach() in..
Post by: Tarique Sani on November 25, 2003, 03:13:25 AM
The show_private part of the code looks different from the one I coded

@Oasis: Look at theme_display_album_list($alb_list, $nbAlb, $cat, $PAGE, $totalPages); and the code before Line 422 in index.php

@DJMaze: We are using CVS do not leave messy commented out code - delete code if you are commiting, Add comments of changes done in code as well as CVS comment
Title: Excellent
Post by: scharn on November 26, 2003, 06:33:54 AM
I too have been noticing this exact problem.  Adding a reply for my personal benefit in case the thread discussion continues.
Title: Invalid argument supplied for foreach() in..
Post by: Oasis on November 27, 2003, 06:42:04 PM
Sorry for the delay, here is the fix. Please tell me if it doesn't work (and if it does):

In index.php, find:

        if ($count > 0) {
            $visibility = $alb_thumb['visibility'];

and replace with:
           $visibility = $alb_thumb['visibility'];
        if ($count > 0) {


Then, find:
       } else {
            $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
            $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/nopic.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
   }

and replace with:
       } else {
            if ($visibility == '0' || $visibility == (FIRST_USER_CAT + USER_ID) || strstr(USER_GROUP_SET, $visibility)) {
            $image_size = compute_img_size(100, 75, $CONFIG['alb_list_thumb_size']);
            $alb_list[$alb_idx]['thumb_pic'] = "<img src=\"images/nopic.jpg\" {$image_size['geom']} alt=\"\" border=\"0\" class=\"image\" />";
   }
}


Last, of course, if you haven't already done so, wrap the problematic foreach code (in you theme.php) in between the code as posted previously.

Please tell me if this fixes you problems.
Title: Invalid argument supplied for foreach() in..
Post by: hilophilo on December 08, 2003, 09:05:14 PM
works great now. thanks.  :lol:
Title: Dont work
Post by: Lovato on December 09, 2003, 03:47:37 PM
Hi... these changes does not work.. :/
Title: Re: Dont work
Post by: Joachim Müller on December 09, 2003, 05:36:59 PM
Quote from: "Lovato"Hi... these changes does not work.. :/
hmmm, others reported it works fine for them. Got a link so we can take a look for ourselves?

GauGau
Title: error out of the blue.
Post by: simplythi on December 12, 2003, 08:56:43 PM
Warning: Invalid argument supplied for foreach() in /home/noono/public_html/themes/noono/theme.php on line 1100

Can someone help me figure out what this error is, it just came on one day. I dont understand why.
Title: Warning: Invalid argument supplied for foreach() in /data/me
Post by: sjakie70 on December 18, 2003, 10:33:59 AM
I changed the album propeties and now i get dies strange error mesage

Warning: Invalid argument supplied for foreach() in /data/members/paid/w/e/wedano.com/htdocs/foto/themes/igames/theme.php on line 1159

whats wrong ??
url : foto.wedano.com

click on the mooie meisjes album, and there it is

resolved thnx
Title: Invalid argument supplied for foreach() in..
Post by: Joachim Müller on December 18, 2003, 02:06:46 PM
moved/merged your posting to the thread dealing with foreach-issue.

GauGau

P.S. Above link may lead to partial nudity, be warned (at least that's what I think "meisjes" means...)
Title: Invalid argument supplied for foreach() in..
Post by: d3 on December 24, 2003, 02:57:03 PM
I tried the fix, but it's still not working:

http://d3.neopages.net/gallery
Title: Invalid argument supplied for foreach() in..
Post by: Sert Turk on January 15, 2004, 07:37:32 PM
OK,I did both code changes and it got rid of the error I was getting (Warning: Invalid argument supplied for foreach() in /home/apollo5/public_html/akgun/themes/hardwired/theme.php on line 1131)

But now ,I don't see any albums.It just says 1 Albums but no tubmnail or edit options at all.I only see Random Pictures and Last editions.

Any ideas?
Title: Invalid argument supplied for foreach() in..
Post by: Casper on January 15, 2004, 09:45:26 PM
have you set the 'show private icon to unlogged user' in config to YES.
Title: Invalid argument supplied for foreach() in..
Post by: Sert Turk on January 15, 2004, 10:41:49 PM
No ,but I fixed it by deleting the current folder and starting over.Now everything is showing.But I got a new error when I tried to change the language to Turkish:

Parse error: parse error, expecting `')'' in /home/apollo/public_html/akgunler/lang/turkish.php on line 328
Title: Invalid argument supplied for foreach() in..
Post by: Casper on January 15, 2004, 11:07:23 PM
Hi, this was reported a few days ago, and a new turkish language file is available from the download section, or see this thread which tells you how to do a very simple fix.
http://forum.coppermine-gallery.net/index.php?topic=3011
Title: Invalid argument supplied for foreach() in..
Post by: Sert Turk on January 15, 2004, 11:18:27 PM
Thanks a lot Casper! :P

Amazing how one small "," can make so much difference. :wink:

All fixed for now. :lol:
Title: Thanks
Post by: sarg on January 27, 2004, 08:47:10 PM
Thanks for the help lads after reading your posts I solved my foreach() problem in rainy days :wink: Keep up the good work and frendliness :D
Title: Error
Post by: Fly Fort on March 13, 2004, 09:38:55 PM
Hello,

I have adjusted the layout a bit move some parts
http://forum.coppermine-gallery.net/index.php?topic=4454

but now i'm receiving an error

Warning: Invalid argument supplied for foreach() in /home/military/public_html/visualdbase/themes/fiblue3d/theme.php on line 1476

and this is what is on that line :

 foreach ($info as $key => $value) $html .= sprintf($template, $key, $value);

Can someone help me???

Thanks in advance
Title: Is this fix final?
Post by: blfarris on March 13, 2004, 10:57:29 PM
I have applied the code patches as directed and it does work but only if the "show private icon to unlogged user" is yes.  Is there a fix that works with that checked no?

If I check no I can't edit the album or pictures when logged in as Administrator.

Thanks,

Brad
Title: Invalid argument supplied for foreach() in..
Post by: Casper on March 14, 2004, 08:48:19 AM
read this thread, http://forum.coppermine-gallery.net/index.php?topic=758
Title: Invalid argument supplied for foreach() in..
Post by: Casper on March 14, 2004, 08:51:32 AM
@ flyfort, Moved this to the topic dealing with this problem.  A simple search and reading the stickies would have saved you some time.
Title: Re: error out of the blue.
Post by: crazy_heart on May 16, 2004, 07:51:53 PM
Quote from: simplythi on December 12, 2003, 08:56:43 PM
Warning: Invalid argument supplied for foreach() in /home/noono/public_html/themes/noono/theme.php on line 1100

Can someone help me figure out what this error is, it just came on one day. I dont understand why.

I get this
Parse error: parse error in /usr/www/htdocs/larissacity/album/index.php on line 468

plz help!
Title: Re: Invalid argument supplied for foreach() in..
Post by: Casper on May 16, 2004, 08:34:23 PM
Are you getting the 'foreach' warning?
Title: Re: Invalid argument supplied for foreach() in..
Post by: mr_mustard on June 27, 2004, 11:34:48 PM
I had the same problem and this worked perfectly. I'm not sure if this is a related problem, but here goes:

As admin I don't seem to be able to add my account to any groups which will display private folders. The only way I seem to be able to view or edit those folders and their contents, is to set the "'show private icon to unlogged user' " option to equal yes, which I do not want to do.

Any help for this would be appreciated. Thanks again for the preceding fix!!
----
Quote from: Oasis on November 24, 2003, 02:28:05 PM
in the theme.php of the theme you are using, find

foreach($alb_list as $album) {
$count ++;

$params = array('{COL_WIDTH}' =>
$column_width,
'{ALBUM_TITLE}' => $album['album_title'],
'{THUMB_CELL_WIDTH}' => $thumb_cell_width,
'{ALB_LINK_TGT}' => "thumbnails.php?album=
{$album['aid']}",
'{ALB_LINK_PIC}' => $album['thumb_pic'],
'{ADMIN_MENU}' => $album['album_adm_menu'],
'{ALB_DESC}' => $album['album_desc'],
'{ALB_INFOS}' => $album['album_info'],
);

echo template_eval($album_cell, $params);

if ($count % $columns == 0 && $count < count
($alb_list)) {
echo $rows_separator;
}
}

and add before it
if (is_array($alb_list)) {
and after it
}