mirror of
https://github.com/e107inc/e107.git
synced 2025-01-16 20:28:28 +01:00
Fix for members-only areas
This commit is contained in:
parent
154d6bdf49
commit
b8280cdddb
@ -621,8 +621,8 @@ echo "</head>\n";
|
||||
|
||||
if(deftrue('e_IFRAME'))
|
||||
{
|
||||
$HEADER = "";
|
||||
$FOOTER = "";
|
||||
$HEADER = deftrue('e_IFRAME_HEADER',"");
|
||||
$FOOTER = deftrue('e_IFRAME_HEADER',"");
|
||||
$body_onload .= " class='e-iframe'";
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* e107 website system
|
||||
*
|
||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
||||
* Released under the terms and conditions of the
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||
*
|
||||
*
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_themes/templates/membersonly_template.php,v $
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
/*
|
||||
$MEMBERSONLY_BEGIN = "<div style='width:75%;margin-right:auto;margin-left:auto'><br /><br />";
|
||||
|
||||
$MEMBERSONLY_CAPTION = "<div style='text-align:center'>".LAN_MEMBERS_0."</div>";
|
||||
@ -37,4 +23,26 @@ $MEMBERSONLY_TABLE = "
|
||||
";
|
||||
|
||||
$MEMBERSONLY_END = "<div>";
|
||||
*/
|
||||
|
||||
// e107 v2.x
|
||||
|
||||
$MEMBERSONLY_TEMPLATE['default']['caption'] = LAN_MEMBERS_0;
|
||||
$MEMBERSONLY_TEMPLATE['default']['header'] = "<div class='container text-center' style='margin-right:auto;margin-left:auto'><br /><br />";
|
||||
$MEMBERSONLY_TEMPLATE['default']['body'] = "<div class='alert alert-block alert-danger'>
|
||||
{MEMBERSONLY_RESTRICTED_AREA} {MEMBERSONLY_LOGIN}
|
||||
{MEMBERSONLY_SIGNUP}<br /><br />{MEMBERSONLY_RETURNTOHOME}
|
||||
|
||||
</div>
|
||||
";
|
||||
|
||||
$MEMBERSONLY_TEMPLATE['default']['footer'] = "</div";
|
||||
|
||||
|
||||
|
||||
$MEMBERSONLY_TEMPLATE['signup']['header'] = "<div class='container'><div class='text-center'>{LOGO=login}</div>";
|
||||
$MEMBERSONLY_TEMPLATE['signup']['footer'] = "</div>";
|
||||
|
||||
|
||||
|
||||
?>
|
@ -13,9 +13,9 @@ define("PAGE_NAME", "Members Only");
|
||||
|
||||
define("LAN_MEMBERS_0", "restricted area");
|
||||
define("LAN_MEMBERS_1", "This is a restricted area.");
|
||||
define("LAN_MEMBERS_2","For access please <a href='".e_LOGIN."'>log in</a>");
|
||||
define("LAN_MEMBERS_3","or <a href='".e_SIGNUP."'>register</a> as a member");
|
||||
define("LAN_MEMBERS_4","Click here to return to front page");
|
||||
define("LAN_MEMBERS_2","For access please [log in]");
|
||||
define("LAN_MEMBERS_3","or [register] as a member.");
|
||||
define("LAN_MEMBERS_4","Click here to return to front page.");
|
||||
|
||||
|
||||
?>
|
@ -18,24 +18,75 @@
|
||||
*/
|
||||
require_once("class2.php");
|
||||
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
||||
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
|
||||
|
||||
if(is_readable(THEME."membersonly_template.php"))
|
||||
if(deftrue('BOOTSTRAP')) //v2.x
|
||||
{
|
||||
$MEMBERSONLY_TEMPLATE = e107::getCoretemplate('membersonly');
|
||||
}
|
||||
else // Legacy
|
||||
{
|
||||
if(is_readable(THEME."membersonly_template.php"))
|
||||
{
|
||||
require_once(THEME."membersonly_template.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_CORE."templates/membersonly_template.php");
|
||||
}
|
||||
|
||||
$MEMBERSONLY_TEMPLATE['default']['caption'] = $MEMBERSONLY_CAPTION;
|
||||
$MEMBERSONLY_TEMPLATE['default']['header'] = $MEMBERSONLY_BEGIN;
|
||||
$MEMBERSONLY_TEMPLATE['default']['body'] = $MEMBERSONLY_TABLE;
|
||||
$MEMBERSONLY_TEMPLATE['default']['footer'] = $MEMBERSONLY_END;
|
||||
}
|
||||
|
||||
define('e_IFRAME',true);
|
||||
|
||||
class membersonly
|
||||
{
|
||||
require_once(THEME."membersonly_template.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(e_CORE."templates/membersonly_template.php");
|
||||
|
||||
function sc_membersonly_signup()
|
||||
{
|
||||
$pref = e107::pref('core');
|
||||
|
||||
if (intval($pref['user_reg'])===1)
|
||||
{
|
||||
$srch = array("[","]");
|
||||
$repl = array("<a href='".e_SIGNUP."'>","</a>");
|
||||
return str_replace($srch,$repl, LAN_MEMBERS_3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sc_membersonly_returntohome()
|
||||
{
|
||||
return "<a href='".e_HTTP."index.php'>".LAN_MEMBERS_4."</a>";
|
||||
}
|
||||
|
||||
function sc_membersonly_restricted_area()
|
||||
{
|
||||
return LAN_MEMBERS_1;
|
||||
}
|
||||
|
||||
function sc_membersonly_login()
|
||||
{
|
||||
$srch = array("[","]");
|
||||
$repl = array("<a href='".e_LOGIN."'>","</a>");
|
||||
return str_replace($srch,$repl, LAN_MEMBERS_2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
require_once(HEADERF);
|
||||
|
||||
define('e_IFRAME',true);
|
||||
$mem = new membersonly;
|
||||
|
||||
include_once(HEADERF);
|
||||
$BODY = e107::getParser()->parseTemplate( $MEMBERSONLY_TEMPLATE['default']['body'],true,$mem);
|
||||
|
||||
echo $MEMBERSONLY_BEGIN;
|
||||
$ns->tablerender($MEMBERSONLY_CAPTION, $MEMBERSONLY_TABLE, 'membersonly');
|
||||
echo $MEMBERSONLY_END;
|
||||
echo $MEMBERSONLY_TEMPLATE['default']['header'];
|
||||
e107::getRender()->tablerender($MEMBERSONLY_TEMPLATE['default']['caption'], $BODY, 'membersonly');
|
||||
echo $MEMBERSONLY_TEMPLATE['default']['footer'];
|
||||
|
||||
?>
|
||||
require_once(FOOTERF);
|
||||
?>
|
21
signup.php
21
signup.php
@ -241,20 +241,15 @@ if(ADMIN && (e_QUERY == 'preview' || e_QUERY == 'test' || e_QUERY == 'preview.a
|
||||
exit;
|
||||
}
|
||||
|
||||
// FIXME - strange HTML output in browser
|
||||
if ($pref['membersonly_enabled'])
|
||||
|
||||
if (!empty($pref['membersonly_enabled']))
|
||||
{
|
||||
$HEADER = "<div style='text-align:center; width:100%;margin-left:auto;margin-right:auto;text-align:center'><div style='width:70%;text-align:center;margin-left:auto;margin-right:auto'><br />";
|
||||
if (file_exists(THEME."images/login_logo.png"))
|
||||
{
|
||||
$HEADER .= "<img src='".THEME_ABS."images/login_logo.png' alt='' />\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$HEADER .= "<img src='".e_IMAGE_ABS."logo.png' alt='' />\n";
|
||||
}
|
||||
$HEADER .= '<br />';
|
||||
$FOOTER = '</div></div>';
|
||||
$template = e107::getCoreTemplate('membersonly','signup');
|
||||
define('e_IFRAME',true);
|
||||
define('e_IFRAME_HEADER', $template['header'] );
|
||||
define('e_IFRAME_FOOTER', $template['footer'] );
|
||||
unset($template);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user