예제 #1
0
파일: hooks.php 프로젝트: nijikokun/NinkoBB
/**
 * Turns a plugin on and creates the row to show loading
 * @global resource
 * @param string $name name of plugin
 * @return boolean|string
 */
function load_plugin($name)
{
    global $database;
    if ($name == "") {
        return 'error_plugin_no_name';
    } else {
        if (!alpha($name, 'alpha-underscore')) {
            return 'error_plugin_name';
        } else {
            if (!already_loaded($name)) {
                // Insert plugin
                $database->query("INSERT INTO `plugins` SET `name` = '{$name}'");
                // Include
                include BASEPATH . '../plugins/' . $name . '.php';
                // That plugin has been loaded.
                plugin_loaded($name);
                // Install plugin
                if (function_exists('install_' . $name)) {
                    // set it up
                    $function = 'install_' . $name;
                    // initiate it
                    $function();
                }
                // Return true
                return true;
            }
        }
    }
    return 'error_already_loaded';
}
예제 #2
0
function plugin_require($id)
{
    return !plugin_loaded($id);
    /*
    global $_FP_SMARTY;
    $_FP_SMARTY->trigger_error("A plugin required <strong>$id</strong> to be loaded to work properly, but $id ".
    "does not appear to be loaded. Maybe the plugins have been loaded in the wrong sequence. ".
    "Check your <a href=\"admin.php?p=plugins\">plugin config</a> in the control panel");
    */
}
예제 #3
0
파일: common.php 프로젝트: KR3W/NinkoBB
// Load plugins
if (mysql_num_rows($result) >= 1) {
    while ($loading = mysql_fetch_array($result)) {
        foreach ($plugins as $plugin) {
            // don't even think of loading error'd plugins
            if ($plugin['error']) {
                continue;
            }
            if (!isset($plugin['name'])) {
                continue;
            }
            if ($loading['name'] == $plugin['plugin']) {
                // Load the plugin
                include 'plugins/' . $plugin['file'];
                // That plugin has been loaded.
                plugin_loaded($plugin['plugin']);
            }
        }
    }
}
/**
 * Include Sessions
 */
include "include/sessions.php";
// Common hook
load_hook('common');
// Just incase
unset($user_data);
// Logged in?
if ($_SESSION['logged_in']) {
    /**
예제 #4
0
파일: admin.php 프로젝트: nijikokun/NinkoBB
     /**
      * Include posts
      */
     include $config['template_path'] . "admin/posts.php";
 } else {
     if ($action == "plugins") {
         if (isset($_GET['activate'])) {
             // set to load
             $result = load_plugin(urldecode($_GET['activate']));
             // User data
             if (is_string($result)) {
                 $error = lang($result);
             }
             if (!$error) {
                 // set as loaded
                 plugin_loaded($_GET['activate']);
                 // set as active
                 $success = lang('success_plugin_activate');
             }
         } else {
             if (isset($_GET['deactivate'])) {
                 // unset the load
                 $result = unload_plugin(urldecode($_GET['deactivate']));
                 // User data
                 if (is_string($result)) {
                     $error = lang($result);
                 }
                 if (!$error) {
                     // it has been done.
                     $success = lang('success_plugin_deactivate');
                 }