Warning: chmod(): Operation not permitted in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [0] in function chmod in /var/www/hopeinstoughton_www/wp-content/plugins/simple-universal-google-analytics/main.php on line 8 [1] in function include_once in /var/www/hopeinstoughton_www/wp-settings.php on line 560 [2] in function require_once in /var/www/hopeinstoughton_www/wp-config.php on line 85 [3] in function require_once in /var/www/hopeinstoughton_www/wp-load.php on line 50 [4] in function require_once in /var/www/hopeinstoughton_www/wp-blog-header.php on line 13 [5] in function require in /var/www/hopeinstoughton_www/index.php on line 17
| Server IP : 94.177.8.99 / Your IP : 216.73.217.165 Web Server : Apache/2.4.58 (Ubuntu) System : Linux aries 6.8.0-134-generic #134-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 26 18:43:11 UTC 2026 x86_64 User : www-data ( 33) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/hopeinstoughton_www/wp-content/plugins/member-menu/ |
Upload File : |
<?php
/*
Plugin Name: Member Menu
Plugin URI: http://hostz.org/
Description: When in a member page, change the menu to show an alternative menu. Use '*' for Post Password
Version: 2.5.9
Author: Phil Young
Author URI: http://hostz.org/
License: Whatever
*/
define('GUEST_PASSWORD', '1coRin13');
define('WIFI_PASSWORD', 'hebRews10');
define('MEMBER_PASSWORD', 'joHn3:16');
/*
spiffy-calendar\includes\views.php
change draw_grid_events to:
function draw_grid_events($events)
{
// We need to sort arrays of objects by time
usort($events, array($this, 'time_cmp'));
$output = '';
// Now process the events
foreach($events as $event) {
$result = $this->draw_event_popup($event, 'grid');
$result = apply_filters( 'spiffy_event', $result, $event, NULL, $this);
$output .= $result.'
';
}
return $output;
}
*/
class member_menu_class {
protected $isAdmin;
protected $adminUrl;
public function __construct() {
$this->isAdmin = NULL;
add_filter('wp_nav_menu_args', array($this, 'modify_nav_menu_args') );
add_action('the_post', array($this, 'standardized_password'));
add_filter('private_title_format', array($this, 'remove_protected' ));
add_filter('protected_title_format', array($this, 'remove_protected' ));
add_shortcode('listenlink', array($this, '_shortcode_hander' ));
add_action('wp_dashboard_setup', array($this, 'dashboard_widgets'));
add_filter('get_member_level', [$this, '__memberlevel'], 50, 1); // 0 = guest, 1 = community, 2 = stoughtonmember
add_filter( 'spiffy_event', [$this, '__spiffy_event'], 50, 4 );
}
function remove_protected( $format ) {
return '%s';
}
function dashboard_widgets() {
wp_add_dashboard_widget('widget_stoughton', 'Important Notes', array($this, 'widget_dashboard'));
}
public function widget_dashboard() {
echo "<a href=\"/passwords\">Passwords</a><br>";
}
function _shortcode_hander($atts) {
$agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if (strpos($agent, 'iPhone') !== FALSE || strpos($agent, 'iPad') !== FALSE || strpos($agent, 'iPod') !== FALSE) {
//return 'http://media.hostz.org:8000/video.ogg.m3u'; // this opens built-in player - does not work
return 'vlc://media.hostz.org:8000/video.ogg';
}
if (strpos($agent, 'Android') !== FALSE) {
return 'http://media.hostz.org:8000/video.ogg';
}
return 'http://media.hostz.org:8000/video.ogg.m3u';
}
// if the post is password protected, and have the correct password, change the menu
function modify_nav_menu_args($args) {
global $post;
if ($post->post_password != '') {
$this->standardized_password($post);
if (!post_password_required( $post )) { // the correct password has been provided - use the alternative menu
if ($this->hasMemberPassword()) {
$args['menu'] = 'Member Only';
} else {
$args['menu'] = 'Guest Password';
}
}
}
return $args;
}
function standardized_password($post_object) {
if ($post_object->post_password == '#') {
$post_object->post_password = MEMBER_PASSWORD;
}
if ($post_object->post_password == '*') {
if ($this->hasMemberPassword()) {
$post_object->post_password = MEMBER_PASSWORD;
} else {
$post_object->post_password = GUEST_PASSWORD;
}
}
}
// Are we wanting the Guest Password, but have a valid member password?
function hasMemberPassword() {
if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) )
return false;
require_once ABSPATH . 'wp-includes/class-phpass.php';
$hasher = new PasswordHash( 8, true );
$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
if ( 0 !== strpos( $hash, '$P$B' ) )
return false;
return $hasher->CheckPassword( MEMBER_PASSWORD, $hash );
}
public function __memberlevel($level) {
if ( ! isset( $_COOKIE['wp-postpass_' . COOKIEHASH] ) ) return 0;
require_once ABSPATH . 'wp-includes/class-phpass.php';
$hasher = new PasswordHash( 8, true );
$hash = wp_unslash( $_COOKIE[ 'wp-postpass_' . COOKIEHASH ] );
if ( 0 !== strpos( $hash, '$P$B' ) )
return 0;
if ($hasher->CheckPassword( MEMBER_PASSWORD, $hash ) ) return 2;
if ($hasher->CheckPassword( GUEST_PASSWORD, $hash ) ) return 1;
if ($hasher->CheckPassword( WIFI_PASSWORD, $hash ) ) return 1;
return 0;
}
public function __spiffy_event($body, $event, $style, $parent) {
if (is_null($this->isAdmin)) {
$this->isAdmin = current_user_can('editor') || current_user_can('administrator');
$this->adminUrl = admin_url('admin.php');
}
if ($this->isAdmin && $_SERVER['REMOTE_ADDR'] == '173.48.93.56') { // $this->isAdmin &&
$event_id = $event->event_id;
// https://hopeinstoughton.org/wp-admin/admin.php?page=spiffy-calendar&tab=event_edit&action=edit&event=1246&_wpnonce=2da7941b98
$url = $this->adminUrl . "?page=spiffy-calendar&tab=event_edit&action=edit&event={$event_id}";
$url = wp_nonce_url( $url, 'spiffy-edit-security'.$event_id );
$url2 = $this->adminUrl . "?page=spiffy-calendar&tab=events&action=delete&event={$event_id}";
$url2 = wp_nonce_url( $url2, 'spiffy-delete-security'.$event_id, '_spfdelnonce' );
$body = preg_replace_callback('~<span class="event-title"(.*?)>(.*?)</span>~', function($m) use ($url, $url2) {
$title = $m[2] . " <span class=\"bind-spiffy-click\" href=\"{$url}\" target=\"calendar\"><span style=\"vertical-align:middle\" class=\"dashicons dashicons-edit\"></span></span>"
. " <span class=\"bind-spiffy-click\" href=\"{$url2}\" target=\"calendar\" style=\"color:#900\"><span style=\"vertical-align:middle\" class=\"dashicons dashicons-trash\"></span></span>";
$newtext = "<span class=\"event-title\"{$m[1]}>{$title}</span>";
return $newtext;
}, $body);
}
return $body;
}
}
new member_menu_class();