1: <?php
2: 3: 4: 5: 6: 7: 8:
9: $plugin_is_filter = 1001 | FEATURE_PLUGIN;
10: $plugin_description = sprintf(gettext("Treats users as not logged in for gallery pages."), DATA_FOLDER);
11: $plugin_author = "Stephen Billard (sbillard)";
12:
13:
14: if (!OFFSET_PATH) {
15: zp_register_filter('guest_login_attempt', 'show_not_loggedin::adminLoginAttempt');
16: zp_register_filter('login_redirect_link', 'show_not_loggedin::loginRedirect');
17: show_not_loggedin::hideAdmin();
18: }
19:
20: class show_not_loggedin {
21:
22: static function hideAdmin() {
23: global $_zp_loggedin, $_zp_current_admin_obj, $_showNotLoggedin_real_auth;
24: if (!OFFSET_PATH && is_object($_zp_current_admin_obj)) {
25: $_showNotLoggedin_real_auth = $_zp_current_admin_obj;
26: if (isset($_SESSION)) {
27: unset($_SESSION['zp_user_auth']);
28: }
29: if (isset($_COOKIE)) {
30: unset($_COOKIE['zp_user_auth']);
31: }
32: $_zp_current_admin_obj = $_zp_loggedin = NULL;
33: }
34: }
35:
36: static function adminLoginAttempt($success, $user, $pass, $athority) {
37: if ($athority == 'zp_admin_auth' && $success) {
38: header('Location: ' . FULLWEBPATH . '/' . ZENFOLDER . '/admin.php');
39: exitZP();
40: }
41: return $success;
42: }
43:
44: static function loginRedirect($link) {
45: global $_showNotLoggedin_real_auth;
46: if (is_object($_showNotLoggedin_real_auth)) {
47: $link = WEBPATH . '/' . ZENFOLDER . '/admin.php';
48: ?>
49: <div class="error">
50: <?php echo gettext('show_not_logged-in is active.'); ?>
51: </div>
52: <?php
53: }
54: return $link;
55: }
56:
57: }
58: ?>