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(); $p =& FoF_Prefs::instance();
$dirlist = opendir(FOF_DIR . "/plugins"); $dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist)) while ($file = readdir($dirlist))
{ {
fof_log("considering " . $file); 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); fof_log("including " . $file);
include(FOF_DIR . "/plugins/" . $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 <?php
$plugins = array(); $plugins = array();
$dirlist = opendir(FOF_DIR . "/plugins"); $dirlist = opendir(FOF_DIR . "/plugins");
while($file=readdir($dirlist)) while($file = readdir($dirlist))
{ {
fof_log("considering " . $file); fof_log("considering " . $file);
if(ereg('\.php$',$file)) if(ereg('\.php$',$file) && is_readable(FOF_DIR . "/plugins/" . $file))
{ $plugins[] = substr($file, 0, -4);
$plugins[] = substr($file, 0, -4);
}
} }
closedir(); closedir();
?> ?>
<?php foreach($plugins as $plugin) { ?> <?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 } ?> <?php } ?>
<br> <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"> <input type="submit" name="plugins" value="Save Plugin Preferences">
</form> </form>
<br><h1>Feed on Feeds - Feeds, Tags and Filters</h1> <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;"> <div style="border: 1px solid black; margin: 10px; padding: 10px; font-size: 12px; font-family: verdana, arial;">
<form method="post" action="?tagfeeds=1"> <form method="post" action="?tagfeeds=1">
@ -308,7 +302,6 @@ foreach($feeds as $row)
</form> </form>
</div> </div>
<?php if(fof_is_admin()) { ?> <?php if(fof_is_admin()) { ?>
<br><h1>Feed on Feeds - Admin Options</h1> <br><h1>Feed on Feeds - Admin Options</h1>