View Full Version : snippets not working in EE2.0?
gillyworld
4th of October 2006 (Wed), 08:40
I use snippets in my home page which now doesn't work. I cant even get the snippetdemo.php to work. Heres what I get from snippetdemo
Exhibit Engine SNIPPETS demo
IMPORTANT SECURITY NOTE ABOUT SNIPPETS:
Depending on how your PHP was installed, snippets can be called from external sites, too. If you want to prohibit that, or restrict snippets to specific site(s), insert the line
if (trim($_SERVER["REMOTE_ADDR"]) != "127.0.0.1") { print "ip "; print $_SERVER["REMOTE_ADDR"] . " not allowed."; exit; }
(where 127.0.0.1 is the IP you want to allow, e.g. your server's real IP) to the beginning of the snippets.php after first <?php line . To allow several IP's, reuse that line of code.
NOTE that this method is not a foolproof because experienced hackers can forge IPs. If you need to ensure that snippets can not be called at all (for sake of resource usage and bandwidth), delete snippets.php from EE folder. If you want to ensure that only you can call the snippets, rename snippets.php to something that you know, e.g. HSJdkkdsk877823987321237871.php (it's an example, please don't use that!) and use that file.
Snippets work in EE 2.0 with public view only (no user login). 10 LATEST GALLERIES
$get = "latest_galleries";
$amount = "10";
$exhibition = "";
$thumbsize = "";
$viewas = "";
$includecategory = "";
$excludecategory = "";
$thumbclass = "";
$linkclass = "";
include("./snippets.php");
ip 86.129.220.185 not allowed.
Alan
Pekka
4th of October 2006 (Wed), 08:46
It's the IP filter. In snippets.php remove lines
if (trim(@$_SERVER["REMOTE_ADDR"]) != "127.0.0.1") {
print "<br />ip ";
print @$_SERVER["REMOTE_ADDR"] . " not allowed.";
exit;
}
Does this help?
gillyworld
4th of October 2006 (Wed), 09:00
It's the IP filter. In snippets.php remove lines
if (trim(@$_SERVER["REMOTE_ADDR"]) != "127.0.0.1") {
print "<br />ip ";
print @$_SERVER["REMOTE_ADDR"] . " not allowed.";
exit;
}
Does this help?
Yes, works fine now thanks Pekka. Hope your concert goes well!
Alan
gillyworld
4th of October 2006 (Wed), 09:35
I may have been a bit hasty, snippets produces the thumbnails ok, but the links are wrong when you click on the thumbs. Can't quite figure out why.
A couple of other minor issues
1. IF you opt not to use a Photo frame around a picture, then the options to select small, medium or large images are hidden from view
2. My default picture size is medium, but the default displayed is always small. Where do I say what is the default? I thought it was in the Paths?
Alan
Pekka
4th of October 2006 (Wed), 19:55
I may have been a bit hasty, snippets produces the thumbnails ok, but the links are wrong when you click on the thumbs. Can't quite figure out why.
I'll look into that.
A couple of other minor issues
1. IF you opt not to use a Photo frame around a picture, then the options to select small, medium or large images are hidden from view
This is purely a default template design choice. The size list by name ($sizemenu_text_html) is placed inside (or rather over) the frame DIV in default template. I like it that way it is not obtrusive, and I use passepartout frames. You can move it out from there, or use variable $sizemenu_html to print the old style dropdown menu anywhere.
2. My default picture size is medium, but the default displayed is always small. Where do I say what is the default? I thought it was in the Paths?
Path editor default size selection is gone in EE 2. The default size is now chosen by pixels in basecode/SETUP_settings.php, and also explained there
// default photo size served. Value is in pixels.
// "800" means the default size is a photo where all sides are smaller than or equal to 800 pixels.
// "0" means smallest available
// "99999" means largest available
// THIS SETTING HAS NO EFFECT (RANDOM RESULT) UNLESS PHOTO SIZES ARE STORED IN DATABASE.
$s_default_size = "0";
wkitty42
4th of October 2006 (Wed), 22:24
I use snippets in my home page which now doesn't work. I cant even get the snippetdemo.php to work. Heres what I get from snippetdemo
Exhibit Engine SNIPPETS demo
IMPORTANT SECURITY NOTE ABOUT SNIPPETS:
Depending on how your PHP was installed, snippets can be called from external sites, too. If you want to prohibit that, or restrict snippets to specific site(s), insert the line
if (trim($_SERVER["REMOTE_ADDR"]) != "127.0.0.1") { print "ip "; print $_SERVER["REMOTE_ADDR"] . " not allowed."; exit; }
(where 127.0.0.1 is the IP you want to allow, e.g. your server's real IP) to the beginning of the snippets.php after first <?php line . To allow several IP's, reuse that line of code.
eeewwwooo... is snippets not set up for "simple inclusion" as i did before with the v1.5 snippets stuff? i don't really like to have my server using up bandwidth back to itself for functions that can be better "served" internally...
[time passes]
in looking back at what i did here, i see that i took the ee_print_thumbs function and placed it into an include file and did a @require_once on it and there was a rather "large" mod/bugfix to handle a couple of special cases where $exhibition wasn't set properly plus a few other seemingly minor fixes... however, at this point, i'm not sure what, exactly, it was that i did to switch from "url_fopen" (is that right?) usage to simple local include usage...
in any case, since i've not yet gotten ee2 installed and i don't currently use snippets anywhere other than some demo and playing around stuff, i guess i won't worry about it too much until after i get things in place and have a working ee2 gallery :wink:
gillyworld
5th of October 2006 (Thu), 03:05
[quote=Pekka;2077710]
Originally Posted by gillyworld http://photography-on-the.net/forum/images/buttons/viewpost.gif (http://photography-on-the.net/forum/showthread.php?p=2075328#post2075328)
I may have been a bit hasty, snippets produces the thumbnails ok, but the links are wrong when you click on the thumbs. Can't quite figure out why.
I'll look into that.
quote]
The problem occurs when the page using snippets is not in the same directory as the snippets code. I think in 1.5 this used a parm set in misc settings.
Thanks
Alan
wkitty42
5th of October 2006 (Thu), 21:17
The problem occurs when the page using snippets is not in the same directory as the snippets code. I think in 1.5 this used a parm set in misc settings.
actually, the way i did it was to place it in the php shared libraries directory...
[time passes]
in my .htaccess file, i have something similar to the following
php_value include_path ".;\shared\includes;\www\exhibits"
the above line tells php to look in the current directory (the .), \shared\includes, and \www\exhibits on the current drive... i have the snippets code php files located in the "includes" directory...
this allows me to call that code from anywhere... of course, with exhibit engine, i also include the "prerequesite" (?) include paths so that the snippets libraries can also locate the ee data and code that they need to work properly...
vBulletin® v3.6.12, Copyright ©2000-2012, Jelsoft Enterprises Ltd.