Exemplo n.º 1
0
 /**
  * Constructor
  *
  * Load all installed and enabled plugins
  */
 public function __construct()
 {
     global $cache, $config, $db, $phpbb_root_path, $phpEx, $blog_plugins_path, $table_prefix, $user;
     if (!isset($config['user_blog_enable_plugins']) || !$config['user_blog_enable_plugins']) {
         return false;
     }
     // Just in case it is not set we will use the default.
     if (!$blog_plugins_path) {
         $blog_plugins_path = $phpbb_root_path . 'blog/plugins/';
     }
     if (($cache_data = $cache->get('_blog_plugins')) === false) {
         if (!defined('BLOGS_PLUGINS_TABLE')) {
             include $phpbb_root_path . 'blog/includes/constants.' . $phpEx;
         }
         $sql = 'SELECT * FROM ' . BLOGS_PLUGINS_TABLE . ' ORDER BY plugin_id ASC';
         $result = $db->sql_query($sql);
         while ($row = $db->sql_fetchrow($result)) {
             self::$plugins[$row['plugin_name']] = $row;
         }
         $cache->put('_blog_plugins', self::$plugins);
     } else {
         self::$plugins = $cache_data;
     }
     unset($cache_data);
     foreach (self::$plugins as $row) {
         $name = $row['plugin_name'];
         // this is checked in the plugin file
         if ($row['plugin_enabled'] && file_exists($blog_plugins_path . 'info/info_' . $name . '.' . $phpEx)) {
             include $blog_plugins_path . 'info/info_' . $name . '.' . $phpEx;
         }
     }
     return true;
 }