start();
$auth->acl($user->data);
$user->setup('admin');
// End session management
// Did user forget to login? Give 'em a chance to here ...
if ($user->data['user_id'] == ANONYMOUS)
{
login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true);
}
// Have they authenticated (again) as an admin for this session?
if (!$user->data['session_admin'])
{
login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false);
}
// Is user any type of admin? No, then stop here, each script needs to
// check specific permissions but this is a catchall
if (!$auth->acl_get('a_'))
{
trigger_error($user->lang['NO_ADMIN']);
}
// Some oft used variables
$safe_mode = (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') ? true : false;
$file_uploads = (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on') ? true : false;
// -----------------------------
// Functions
function adm_page_header($sub_title, $meta = '', $table_html = true)
{
global $config, $db, $user, $phpEx;
define('HEADER_INC', true);
// gzip_compression
if ($config['gzip_compress'])
{
if (extension_loaded('zlib') && !headers_sent())
{
ob_start('ob_gzhandler');
}
}
header("Content-type: text/html; charset=" . $user->lang['ENCODING']);
?>
unload();
}
// Close our DB connection.
$db->sql_close();
?>
">
lang['ADMIN_TITLE']; ?>
';
echo sprintf($user->lang['RETURN_PAGE'], '', ' ');
}
?>
$var)
{
if (empty($var))
{
continue;
}
if (is_array($var))
{
foreach ($var as $k => $v)
{
if (is_array($v))
{
foreach ($v as $_k => $_v)
{
set_var($var[$k][$_k], $_v, 'string');
$s_hidden_fields .= " ';
}
}
else
{
set_var($var[$k], $v, 'string');
$s_hidden_fields .= " ';
}
}
}
else
{
set_var($var, $var, 'string');
$s_hidden_fields .= ' ';
}
unset($var_ary[$key]);
}
?>
';
break;
case 'dimension':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
$tpl = ' x ';
break;
case 'textarea':
$rows = (int) $tpl_type[1];
$cols = (int) $tpl_type[2];
$tpl = '';
break;
case 'radio':
$key_yes = ($new[$config_key]) ? ' checked="checked"' : '';
$key_no = (!$new[$config_key]) ? ' checked="checked"' : '';
$tpl_type_cond = explode('_', $tpl_type[1]);
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
$tpl_no = ' ' . (($type_no) ? $user->lang['NO'] : $user->lang['DISABLED']);
$tpl_yes = ' ' . (($type_no) ? $user->lang['YES'] : $user->lang['ENABLED']);
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . ' ' . $tpl_no : $tpl_no . ' ' . $tpl_yes;
break;
case 'select':
eval('$s_options = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
$tpl = '' . $s_options . ' ';
break;
case 'custom':
eval('$tpl = ' . str_replace('{VALUE}', $new[$config_key], $options) . ';');
break;
default:
break;
}
return $tpl;
}
// General ACP module class
class module
{
var $id = 0;
var $type;
var $name;
var $mode;
// Private methods, should not be overwritten
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
{
global $template, $auth, $db, $user, $config;
$sql = 'SELECT module_id, module_title, module_filename, module_subs, module_acl
FROM ' . MODULES_TABLE . "
WHERE module_type = 'acp'
AND module_enabled = 1
ORDER BY module_order ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
// Authorisation is required for the basic module
if ($row['module_acl'])
{
$is_auth = false;
eval('$is_auth = (' . preg_replace(array('#acl_([a-z_]+)#e', '#cfg_([a-z_]+)#e'), array('$auth->acl_get("\\1")', '$config["\\1"]'), $row['module_acl']) . ');');
// The user is not authorised to use this module, skip it
if (!$is_auth)
{
continue;
}
}
$selected = ($row['module_filename'] == $selected_mod || $row['module_id'] == $selected_mod || (!$selected_mod && !$i)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars($module_type . '_section', array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . $row['module_title']])) ? $user->lang[strtoupper($module_type) . '_' . $row['module_title']] : ucfirst(str_replace('_', ' ', strtolower($row['module_title']))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&i=' . $row['module_id'])
);
*/
if ($selected)
{
$module_id = $row['module_id'];
$module_name = $row['module_filename'];
if ($row['module_subs'])
{
$j = 0;
$submodules_ary = explode("\n", $row['module_subs']);
foreach ($submodules_ary as $submodule)
{
$submodule = explode(',', trim($submodule));
$submodule_title = array_shift($submodule);
$is_auth = true;
foreach ($submodule as $auth_option)
{
if (!$auth->acl_get($auth_option))
{
$is_auth = false;
}
}
if (!$is_auth)
{
continue;
}
$selected = ($submodule_title == $selected_submod || (!$selected_submod && !$j)) ? true : false;
/*
// Get the localised lang string if available, or make up our own otherwise
$template->assign_block_vars("{$module_type}_section.{$module_type}_subsection", array(
'L_TITLE' => (isset($user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)])) ? $user->lang[strtoupper($module_type) . '_' . strtoupper($submodule_title)] : ucfirst(str_replace('_', ' ', strtolower($submodule_title))),
'S_SELECTED' => $selected,
'U_TITLE' => $module_url . '&i=' . $module_id . '&mode=' . $submodule_title
));
*/
if ($selected)
{
$this->mode = $submodule_title;
}
$j++;
}
}
}
$i++;
}
$db->sql_freeresult($result);
if (!$module_id)
{
trigger_error('MODULE_NOT_EXIST');
}
$this->type = $module_type;
$this->id = $module_id;
$this->name = $module_name;
}
// Public methods to be overwritten by modules
function module()
{
// Module name
// Module filename
// Module description
// Module version
// Module compatibility
return false;
}
function init()
{
return false;
}
function install()
{
return false;
}
function uninstall()
{
return false;
}
}
// End Functions
// -----------------------------
?>