Creating and modifying plugins.
Post Reply
Posts: 5
Joined: Fri Sep 17, 2004 10:10 am

Post by Culky » Wed Mar 30, 2005 12:25 am

I've got a plugin that provides a variation of the "media" button on the new entry page, letting you use an external gallery as a source of images. The problem is the script includes "", which itself looks for "". But it looks for it in the directory my script is in, which means my script has to be in the serendipity root directory. I'd rather have it in the plugin directory, especially as having it anywhere else would probably break the spartacus compatibility as well as being messy.
Anyway, to get to the point, if I change line 15 of (0.8b4) from:

Code: Select all

define('IS_installed', file_exists(''));


Code: Select all

define('IS_installed', file_exists(S9Y_INCLUDE_PATH . ''));

then it works fine with my script in the plugin directory rather than root. Could this be changed or is there some subtle security implication? Is there another way to get the same result without editing any of the core files?

User avatar
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany


Post by garvinhicking » Thu Mar 31, 2005 2:01 pm

I propose to do a chdir() to the core directory first and let it there include the config file. After your plugin included the config file you can chdir() back to your original plugin location.

However I would suggest you to hook your external plugin in via the 'external_plugin' method, so you don't have to call like http://blog/plugin.php but can call http://blog/plugin/external/yourplugin instead. Then all path settings will be alright already and you don't have to manually include our config file.

Look at example for external event plugins like freetag, blogpdf, spamblock, ...

That will then work without security and different path implications.

# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy:
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby:

Posts: 43
Joined: Sat Mar 12, 2005 10:53 pm

Post by verbatim » Mon May 02, 2005 7:19 pm

culky, is this plugin avaible to the public?

Post Reply