sql_query('SELECT * FROM `'.$prefix.'_modules` WHERE `title` = \'' . $name . '\'');
$row = $db->sql_fetchrow($result);
$mod_active = intval($row['active']);
$view = intval($row['view']);
$groups = $row['groups'];
$mod_group = intval($row['mod_group']);
if(($mod_active == 1) OR (isset($admin) AND is_admin($admin))) {
if(!isset($file)) { $file = 'index'; }
if(preg_match('/\.\./', $name) || preg_match('/\.\./', $file)) {
$pagetitle = '- '._SOCOOL;
include_once 'header.php';
OpenTable();
echo '
' , _SOCOOL , '
'
, _GOBACK , '
';
CloseTable();
include_once 'footer.php';
die();
} else {
$ThemeSel = get_theme();
if(file_exists('themes/' . $ThemeSel . '/modules/' . $name . '/' . $file . '.php')) {
$modpath = 'themes/' . $ThemeSel . '/';
} else {
$modpath = '';
}
$modpath .= 'modules/' . $name . '/' . $file . '.php';
if(file_exists($modpath)) {
// The module's $view describes the accessibility of the module:
// 0 - All Visitors
// 1 - Registered Users Only
// 2 - Administrators Only
// 3 - Paid Subscribers Only
// 4 - NSN Groups Only
// *Note: Admins can see all access levels.
// *Note for the Users Group/Points system: If a module is set to Registered Users Only, but has a non-zero
// mod_group value, then the module is only available to those users who have enough points to be in that
// Users Group.
$canView = ($view == 0) || // all visitors
($view == 1 && isset($user) && // registered user and
($mod_group <= 0 || is_group($user, $name))) || // (no points needed OR user has points)
(isset($admin) && is_admin($admin)) || // is admin
($view == 3 && paid()) || // paid subscriber
($view >= 4 && in_groups($groups)); // NSN Groups user
if ($canView) {
include_once($modpath);
} else {
$pagetitle = '- ' . _RESTRICTEDAREA;
include_once 'header.php';
OpenTable();
echo '' , _RESTRICTEDAREA , '
'
, _GOBACK , '
';
CloseTable();
include_once 'footer.php';
die();
}
} else {
$pagetitle = '- ' . _FILENOTFOUND;
include_once 'header.php';
OpenTable();
echo '' , _FILENOTFOUND , '
'
, _GOBACK , '
';
CloseTable();
include_once 'footer.php';
die ();
}
}
} else {
$pagetitle = '- ' . _MODULENOTACTIVE;
include_once 'header.php';
OpenTable();
echo '' , _MODULENOTACTIVE , '
'
, _GOBACK , '
';
CloseTable();
include_once 'footer.php';
die ();
}
} else {
$pagetitle = '- ' . _MODULENOTFOUND;
include_once 'header.php';
OpenTable();
echo '' , _MODULENOTFOUND , '
'
, _GOBACK , '
';
CloseTable();
include_once 'footer.php';
die ();
}
if(!function_exists('stripos_clone')) {
function stripos_clone($haystack, $needle, $offset=0) {
return strpos(strtoupper($haystack), strtoupper($needle), $offset);
}
}
?>