Detect only readable plugins

master
vitalif 2009-11-09 11:30:36 +00:00
parent c618f7a644
commit b21fa04357
2 changed files with 10 additions and 16 deletions

View File

@ -1027,14 +1027,15 @@ function fof_init_plugins()
$p =& FoF_Prefs::instance();
$dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist))
while ($file = readdir($dirlist))
{
fof_log("considering " . $file);
if(ereg('\.php$',$file) && !$p->get('plugin_' . substr($file, 0, -4)))
if (ereg('\.php$',$file) &&
is_readable(FOF_DIR . "/plugins/" . $file) &&
!$p->get('plugin_' . substr($file, 0, -4)))
{
fof_log("including " . $file);
include(FOF_DIR . "/plugins/" . $file);
fof_log("including " . $file);
include(FOF_DIR . "/plugins/" . $file);
}
}

View File

@ -214,21 +214,17 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
<?php
$plugins = array();
$dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist))
while($file = readdir($dirlist))
{
fof_log("considering " . $file);
if(ereg('\.php$',$file))
{
$plugins[] = substr($file, 0, -4);
}
if(ereg('\.php$',$file) && is_readable(FOF_DIR . "/plugins/" . $file))
$plugins[] = substr($file, 0, -4);
}
closedir();
?>
<?php foreach($plugins as $plugin) { ?>
<input type=checkbox name=<?php echo $plugin ?> <?php if(!$prefs->get("plugin_" . $plugin)) echo "checked"; ?>> Enable plugin <tt><?php echo $plugin?></tt>?<br>
<input type=checkbox name="<?php echo $plugin ?>" <?php if(!$prefs->get("plugin_" . $plugin)) echo "checked"; ?>> Enable plugin <tt><?php echo $plugin?></tt>?<br>
<?php } ?>
<br>
@ -244,8 +240,6 @@ URL to be linked on shared page: <input type=string name=sharedurl value="<?php
<input type="submit" name="plugins" value="Save Plugin Preferences">
</form>
<br><h1>Feed on Feeds - Feeds, Tags and Filters</h1>
<div style="border: 1px solid black; margin: 10px; padding: 10px; font-size: 12px; font-family: verdana, arial;">
<form method="post" action="?tagfeeds=1">
@ -308,7 +302,6 @@ foreach($feeds as $row)
</form>
</div>
<?php if(fof_is_admin()) { ?>
<br><h1>Feed on Feeds - Admin Options</h1>