Michael Morris
11-09-2004, 10:45 AM
One weakness of VbaCMPS is the difficultly of module install / administration. I'm going to try the following on the next version of my pet module. Note, this is an open frame that could be used for all modules.
// Module Credits area
// Author
if (!is_object($DB_site))
// If this is true then the page is being accessed directly
// We'll therefore conduct the page as an admin interface if the user has the
// right permissions. First we'll need to initialize a new page.
{
chdir("./forums"); // Perhaps chdir to admincp and use it's global.php??
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'modulename');
$globaltemplates = array(
'adv_portal_modadmin_modulename'
);
require_once("./global.php");
if (!can_admin) // Check for admin permissions
{
print_no_permission();
}
//sanity check
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'admin';
}
if ($_REQUEST['do']=='admin')
{
//Do whatever the administration interface requires.
}
if ($_REQUEST['do']=='changes')
{
//Do the changes.
}
}
// If we get this far we are a module and should perform the actions of one.
else
{
//Module Actions
}
Anybody see any potential problems with this setup??
// Module Credits area
// Author
if (!is_object($DB_site))
// If this is true then the page is being accessed directly
// We'll therefore conduct the page as an admin interface if the user has the
// right permissions. First we'll need to initialize a new page.
{
chdir("./forums"); // Perhaps chdir to admincp and use it's global.php??
error_reporting(E_ALL & ~E_NOTICE);
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'modulename');
$globaltemplates = array(
'adv_portal_modadmin_modulename'
);
require_once("./global.php");
if (!can_admin) // Check for admin permissions
{
print_no_permission();
}
//sanity check
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'admin';
}
if ($_REQUEST['do']=='admin')
{
//Do whatever the administration interface requires.
}
if ($_REQUEST['do']=='changes')
{
//Do the changes.
}
}
// If we get this far we are a module and should perform the actions of one.
else
{
//Module Actions
}
Anybody see any potential problems with this setup??