<?php
/*
+------------------------------------------------------
| Write2Left
| (c) timdorr
| http://www.write2left.com
| hide@address.com
| See License.txt for license info
|------------------------------------------------------
| Script: Plugins.php
| Description:
| Mangages plugins and the configuration of their options
| Created Aug-8-2002
+------------------------------------------------------
*/
/* Class: Plugins
* Description:
* Driver for plugins
*/
class Plugins
{
var $skin = '';
var $menu = true;
var $message = '';
var $error = '';
function run()
{
global $W2L, $userinfo, $output, $db;
// Do various skin thingys
require( "./Skin/Plugins.php" );
$this->skin = new Skin_Plugins();
$output->page_title = "Manage Plugins";
$output->loc_add( "Plugins" );
$output->add( $this->skin->body_top() );
// Check for a method
if( array_key_exists( 'M', $W2L->input ) )
{
if( $W2L->input['M'] == 'Config' )
$this->config_plugin( $W2L->input['plugin_id'] );
}
// Show whatever result we get, if any
if( $this->error != "" )
$output->add( "<div class=\"error\">\n" . $this->error . "\n</div><br />\n" );
if( $this->message != "" )
$output->add( "<div class=\"message\">\n" . $this->message . "\n</div><br />\n" );
// Get the currently installed plugins
$db->query( "SELECT * FROM w2l_plugins" );
// Display the table of plugins
$output->add( $this->skin->plugin_head() );
while( $plugin = $db->fetch_array() )
{
$output->add( $this->skin->plugin_row( $plugin['plugin_id'], $plugin['name'] ) );
}
$output->add( $this->skin->plugin_foot() );
$output->add( $this->skin->body_bottom() );
}
//================
// Runs a plugin's log configuration method
//================
function config_plugin( $id )
{
global $db;
$p = $db->query_fetch( "SELECT * FROM w2l_plugins WHERE plugin_id = $id" );
include( './Plugins/' . $p['filename'] );
$cp_plugins[$p['name']]->log_config();
}
}
$driver = new Plugins();
?>