serendipity_config.inc.php

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

serendipity_config.inc.php

Post by Culky »

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 "serendipity_config.inc.php", which itself looks for "serendipity_config_local.inc.php". 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 serendipity_config.inc.php (0.8b4) from:

Code: Select all

define('IS_installed', file_exists('serendipity_config_local.inc.php'));
to:

Code: Select all

define('IS_installed', file_exists(S9Y_INCLUDE_PATH . 'serendipity_config_local.inc.php'));
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?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_config.inc.php

Post by garvinhicking »

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.

HTH,
Garvin.
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
verbatim
Regular
Posts: 43
Joined: Sat Mar 12, 2005 10:53 pm

Post by verbatim »

culky, is this plugin avaible to the public?
Post Reply