Exemplo n.º 1
0
        }
    }
    // Get the addon id for this basename
    $query = "SELECT `addon_id` FROM `" . $roster->db->table('plugin') . "` WHERE `basename` = '" . $dbname . "';";
    $addon_id = $roster->db->query_first($query);
    if ($addon_id !== false) {
        // Delete addon config entries
        $query = 'DELETE FROM `' . $roster->db->table('plugin_config') . '` WHERE `addon_id` = "' . $addon_id . '";';
        $roster->db->query($query) or $installer->seterrors('Error while deleting menu entries for ' . $dbname . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error'], __FILE__, __LINE__, $query);
    }
    // Delete addon table entry
    $query = 'DELETE FROM `' . $roster->db->table('plugin') . '` WHERE `basename` = "' . $dbname . '"';
    $roster->db->query($query) or $installer->seterrors('Error while deleting plugin table entry for ' . $dbname . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error'], __FILE__, __LINE__, $query);
    return true;
}
$plugins = getPluginList();
if (!empty($plugins)) {
    $roster->tpl->assign_vars(array('S_ADDON_LIST' => true, 'L_TIP_STATUS_ACTIVE' => makeOverlib($roster->locale->act['installer_turn_off'], $roster->locale->act['installer_activated']), 'L_TIP_STATUS_INACTIVE' => makeOverlib($roster->locale->act['installer_turn_on'], $roster->locale->act['installer_deactivated']), 'L_TIP_INSTALL_OLD' => makeOverlib($roster->locale->act['installer_replace_files'], $roster->locale->act['installer_overwrite']), 'L_TIP_INSTALL' => makeOverlib($roster->locale->act['installer_click_uninstall'], $roster->locale->act['installer_installed']), 'L_TIP_UNINSTALL' => makeOverlib($roster->locale->act['installer_click_install'], $roster->locale->act['installer_not_installed'])));
    foreach ($plugins as $addon) {
        if (!empty($addon['icon'])) {
            if (strpos($addon['icon'], '.') !== false) {
                $addon['icon'] = ROSTER_PATH . 'plugins/' . $addon['basename'] . '/images/' . $addon['icon'];
            } else {
                $addon['icon'] = $roster->config['interface_url'] . 'Interface/Icons/' . $addon['icon'] . '.' . $roster->config['img_suffix'];
            }
        } else {
            $addon['icon'] = $roster->config['interface_url'] . 'Interface/Icons/inv_misc_questionmark.' . $roster->config['img_suffix'];
        }
        $roster->tpl->assign_block_vars('addon_list', array('ROW_CLASS' => $roster->switch_row_class(), 'ID' => isset($addon['id']) ? $addon['id'] : '', 'ICON' => $addon['icon'], 'FULLNAME' => $addon['fullname'], 'BASENAME' => $addon['basename'], 'FILENAME' => $addon['filename'], 'PARENT' => $addon['parent'], 'VERSION' => $addon['version'], 'OLD_VERSION' => isset($addon['oldversion']) ? $addon['oldversion'] : '', 'DESCRIPTION' => $addon['description'], 'DEPENDENCY' => $addon['requires'], 'AUTHOR' => $addon['author'], 'ACTIVE' => isset($addon['active']) ? $addon['active'] : '', 'INSTALL' => $addon['install'], 'L_TIP_UPGRADE' => isset($addon['active']) ? makeOverlib(sprintf($roster->locale->act['installer_click_upgrade'], $addon['oldversion'], $addon['version']), $roster->locale->act['installer_upgrade_avail']) : '', 'ACCESS' => ''));
    }
} else {
function isPluginActive($filename)
{
    // load active plugin paths
    static $activePluginPaths;
    if (!isset($activePluginPaths)) {
        $activePluginPaths = array();
        foreach (getPluginList() as $relativePluginPath => $pluginDetails) {
            if (!$pluginDetails['isActive']) {
                continue;
            }
            // skip inactive plugins
            $activePluginPaths[] = $relativePluginPath;
        }
    }
    // check if filename or path is active
    $isActive = false;
    foreach (array_values($activePluginPaths) as $relativePluginPath) {
        if (!endsWith($filename, $relativePluginPath)) {
            continue;
        }
        $isActive = true;
        break;
    }
    return $isActive;
}
Exemplo n.º 3
0
}
if ($query != "") {
    dbConnect();
}
if ($query == 'get_plugin_name') {
    $plugin_id = $_GET['plugin_id'];
    $plugin_list = getPluginList('');
    foreach ($plugin_list as $plugin) {
        if ($plugin->get_id() == $plugin_id) {
            print $plugin->get_name();
            break;
        }
    }
} elseif ($query == 'get_plugin_type') {
    $plugin_id = $_GET['plugin_id'];
    $plugin_list = getPluginList('');
    foreach ($plugin_list as $plugin) {
        if ($plugin->get_id() == $plugin_id) {
            if ($plugin->get_type() == "1") {
                echo "detector";
            } elseif ($plugin->get_type() == "2") {
                echo "monitor";
            } else {
                echo "other";
            }
            break;
        }
    }
} elseif ($query == 'is_plugin_sid_list') {
    $plugin_id = $_GET['plugin_id'];
    $plugin_sid_list = $_GET['plugin_sid_list'];
Exemplo n.º 4
0
<?php

global $ALL_PLUGINS;
$ALL_PLUGINS = getPluginList();
uasort($ALL_PLUGINS, '_sortPluginsByName');
//
function _sortPluginsByName($arrayA, $arrayB)
{
    return strncasecmp($arrayA['name'], $arrayB['name'], 100);
}
//
function showPluginList($listType)
{
    global $ALL_PLUGINS;
    // get list name
    $listName = '';
    if ($listType == 'active') {
        $listName = 'Active Plugins';
    } elseif ($listType == 'inactive') {
        $listName = 'Inactive Plugins';
    } elseif ($listType == 'system') {
        $listName = 'System Plugins';
    } else {
        die("Unknown list type '" . htmlencode($listType) . "'");
    }
    // show plugin list
    ?>
    <table cellspacing="0" class="data" style="overflow: scroll">
     <thead>
      <tr>
       <th width="15%" style="white-space:nowrap;"><?php 
Exemplo n.º 5
0
            if (class_exists('Monolog\\Logger')) {
                // Be sure that Monolog is still register
                Monolog\ErrorHandler::register($c['loggerHandler']);
            }
            return $run;
        }
    }
};
// To parse serialized files in multiple formats
$app['fileParser'] = function () {
    $parsers = ['json' => new \Parvula\Parsers\Json(), 'yaml' => new \Parvula\Parsers\Yaml(), 'yml' => new \Parvula\Parsers\Yaml(), 'php' => new \Parvula\Parsers\Php()];
    return new Parvula\FileParser($parsers);
};
$app['plugins'] = function (Container $c) {
    $pluginMediator = new Parvula\PluginMediator();
    $pluginMediator->attach(getPluginList($c['config']->get('disabledPlugins')));
    return $pluginMediator;
};
$app['session'] = function (Container $c) {
    $session = new Parvula\Session($c['config']->get('sessionName'));
    $session->start();
    return $session;
};
$app['auth'] = function (Container $c) {
    return new Parvula\Authentication($c['session'], hash('sha1', '@TODO'));
    // return new Parvula\Authentication($c['session'], hash('sha1', $c['request']->ip . $c['request']->userAgent));
};
// Get current logged User if available
$app['usersession'] = function (Container $c) {
    $sess = $c['session'];
    if ($username = $sess->get('username')) {
Exemplo n.º 6
0
print ossim_db::get_order('name', $order) . '"';
print '   >' . gettext("Name") . '</a>';
print '  </th>';
print '  <th>';
print '   <a href="plugin_id?order=';
print ossim_db::get_order('type', $order) . '"';
print '   >' . gettext("Type") . '</a>';
print '  </th>';
print '  <th>';
print '   <a href="plugin_id?order=';
print ossim_db::get_order('type', $order) . '"';
print '   >' . gettext("Description") . '</a>';
print '  </th>';
print ' </tr>';
$none_checked = 'true';
$plugin_list = getPluginList('ORDER BY ' . $order);
foreach ($plugin_list as $plugin) {
    $plugin_type = $plugin->get_type();
    if ($plugin_type == '1') {
        $type_name = 'Detector (1)';
    } elseif ($plugin_type == '2') {
        $type_name = 'Monitor (2)';
    } else {
        $type_name = 'Other (' . $plugin_type . ')';
    }
    if ($plugin_id == $plugin->get_id()) {
        $checked = ' checked';
    } else {
        $checked = '';
    }
    if ($checked != '') {