Recovery data loss

parent 21595f77
......@@ -247,3 +247,6 @@ ul.products li.sexhack_thumbli {
opacity: 1;
}
.sexhack_thumb_hover {
height: 100%;
}
......@@ -72,6 +72,7 @@ if(!class_exists('SH_Admin')) {
add_settings_section('sexhackme-advert-settings', ' ', 'wp_SexHackMe\settings_advert_section', 'sexhackme-advert-settings');
register_setting('sexhackme-advert-settings', 'sexadv_video_top');
register_setting('sexhackme-advert-settings', 'sexadv_video_bot');
register_setting('sexhackme-advert-settings', 'sexadv_video_native');
}
// Gallery settings
......
......@@ -33,6 +33,15 @@ if(!class_exists('SH_PMS_Support')) {
$this->plans = false;
}
public static function remove_stripe_js()
{
// We remove it here to speedup the website, but we re-add in class-shortcodes in sh_register and in
// functions-core to add the account/subscription page
//add_action('wp_footer', '\pms_stripe_enqueue_front_end_scripts');
remove_action( 'wp_footer', 'pms_stripe_enqueue_front_end_scripts' );
//pms_stripe_enqueue_front_end_scripts();
}
private function set_pms_plans()
{
$plans = array(
......@@ -124,6 +133,8 @@ if(!class_exists('SH_PMS_Support')) {
// Create the sh_pms object
add_action('wp', 'wp_SexHackMe\instance_SH_PMS_Support');
add_action('wp_footer', 'wp_SexHackMe\SH_PMS_Support::remove_stripe_js', 1);
}
if(!class_exists('SexhackPmsPasswordDataLeak')) {
......
......@@ -192,6 +192,9 @@ if(!class_exists('SH_Query')) {
$sqlarr[] = "DELETE FROM {$wpdb->prefix}".SH_PREFIX."videocategory_assoc WHERE video_id IN (
SELECT id FROM {$wpdb->prefix}".SH_PREFIX."videos
WHERE {$idtype}=".intval($id)." );";
$sqlarr[] = "DELETE FROM {$wpdb->prefix}".SH_PREFIX."jobs WHERE jobtype='video' AND obj_id IN (
SELECT id FROM {$wpdb->prefix}".SH_PREFIX."videos
WHERE {$idtype}=".intval($id)." );";
$sqlarr[] = "DELETE FROM {$wpdb->prefix}".SH_PREFIX."videos WHERE {$idtype}=".intval($id);
foreach($sqlarr as $sql)
{
......@@ -325,6 +328,47 @@ if(!class_exists('SH_Query')) {
}
public static function get_Video_Jobs($vid=false)
{
global $wpdb;
$sql = "SELECT * FROM {$wpdb->prefix}".SH_PREFIX."jobs WHERE jobtype='video'";
if($vid && is_numeric($vid))
$sql .= " AND obj_id='".intval($vid)."'";
$dbres = $wpdb->get_results( $sql );
return $dbres;
}
public static function add_Video_job($vid, $command, $args)
{
global $wpdb;
if(is_array($args)) $arg="JSON_QUOTE($args)";
else $arg="'$args'";
$sql = "INSERT IGNORE INTO {$wpdb->prefix}".SH_PREFIX."jobs (jobtype, obj_id, command, arguments) VALUES ('video','$vid','$command',$arg)";
sexhack_log($sql);
$wpdb->query($sql);
return;
}
public static function del_Video_job($vid, $command=false)
{
global $wpdb;
$sql = "DELETE FROM {$wpdb->prefix}".SH_PREFIX."jobs WHERE obj_id='$vid'";
if($command) $sql.= " AND command='$command'";
$wpdb->query($sql);
return;
}
public static function del_job($id)
{
global $wpdb;
$sql = "DELETE FROM {$wpdb->prefix}".SH_PREFIX."jobs WHERE id='$id'";
$wpdb->query($sql);
return;
}
public static function get_Categories($id=false)
{
global $wpdb;
......
......@@ -42,6 +42,7 @@ if(!class_exists('SH_Shortcodes')) {
'sexgallery' => __CLASS__ . '::videogallery_shortcode',
'shvideomanager' => __CLASS__ . '::video_manager_shortcode',
'shincludepage' => __CLASS__ . '::include_page_shortcode',
'sh_register' => __CLASS__ . '::register',
);
foreach( $shortcodes as $shortcode_tag => $shortcode_func ) {
......@@ -50,6 +51,20 @@ if(!class_exists('SH_Shortcodes')) {
}
public static function register($attr, $cont)
{
pms_stripe_enqueue_front_end_scripts();
$before = "<style> .pms-pass1-field, .pms-pass2-field, .pms-first-name-field, .pms-last-name-field {display: none;} </style>";
$after = '<script>
$(".pms-pass1-field").remove();
$(".pms-pass2-field").remove();
$(".pms-first-name-field").remove();
$(".pms-last-name-field").remove();
</script>';
return $before.do_shortcode( '[pms-register]').$after;
}
public static function video_hls($attr, $cont)
{
extract( shortcode_atts(array(
......@@ -122,6 +137,7 @@ if(!class_exists('SH_Shortcodes')) {
global $sh_videogallery;
extract( shortcode_atts(array(
"category" => "all",
"adv" => "4,16"
), $attr));
$html = "<div class='sexhack_gallery'>"; //<h3>SexHack VideoGallery</h3>";
......@@ -129,8 +145,23 @@ if(!class_exists('SH_Shortcodes')) {
$html .= '<ul class="products columns-4">';
$videos = $sh_videogallery->get_videos_by_cat(filtering: "status='published' ORDER BY created DESC");
$sep=1;
$vcount=1;
if(isset($attr['adv'])) $adv=explode(",", $attr['adv']);
else $adv=array("4");
$advid=get_option('sexadv_video_native', false);
foreach($videos as $video)
{
if(in_array(strval($vcount), $adv)) // && !user_is_premium() && $advid && is_numeric($advid) && intval($advid)>0)
{
$html .= '<li class="product type-product sexhack_thumbli">';
$html .= do_shortcode("[sexadv adv=$advid]");
if($sep==4) $html .= '<li class="product type-product sexhack_thumbli" style="width:100% !important; margin-bottom: 1px !important;"> </li>';
$html .= '</li>';
$sep=$sep+1;
if($sep==5) $sep=1;
$vcount=$vcount+1;
}
//if($video->status == 'published')
//{
$post = $video->get_post();
......@@ -139,6 +170,7 @@ if(!class_exists('SH_Shortcodes')) {
if($sep==4) $html .= '<li class="product type-product sexhack_thumbli" style="width:100% !important; margin-bottom: 1px !important;"> </li>';
$sep=$sep+1;
if($sep==5) $sep=1;
$vcount=$vcount+1;
//}
}
wp_reset_postdata();
......
......@@ -111,7 +111,7 @@ if(!class_exists('SexhackAddUnlockLogin')) {
}
public function add_to_checkout(){
echo $this->unlock_button('', $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
echo $this->unlock_button('', '', get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
}
}
......
......@@ -307,6 +307,11 @@ if(!class_exists('SH_Video')) {
return $r;
}
public function new_view($level='public')
{
return;
}
}
$GLOBALS['sh_video'] = new SH_Video();
do_action('sh_video_ready');
......
......@@ -127,7 +127,7 @@ if(!class_exists('SH_VideoGallery')) {
$gif = $video->gif;
if(!$gif_preview) $gif_preview = $gif;
if($gif_preview) $image .= "<img src='$gif_preview' class='alignleft sexhack_thumb_hover' loading='lazy' />";
if($gif_preview) $image .= "<img src='".plugin_dir_url(__DIR__)."/img/loading.gif' onmouseover='shmChangeGif(this)' data-src='$gif_preview' class='alignleft sexhack_thumb_hover' loading='lazy' />";
$html = '<li class="product type-product sexhack_thumbli">';
......
......@@ -210,6 +210,65 @@ if(!class_exists("SH_VideoProducts")) {
}
/* Class woocommerce add-to-checkout management */
if(!class_exists('SexhackWoocommerceCheckout')) {
class SexhackWoocommerceCheckout
{
public function __construct()
{
//add_action( 'woocommerce_before_checkout_form', array($this, 'empty_cart'), 1);
add_action( 'woocommerce_add_to_cart_validation', array($this, 'empty_cart'), 1);
add_action( 'woocommerce_simple_add_to_cart', array($this, 'oneclick_checkout'));
add_action( 'woocommerce_after_shop_loop_item', array($this, 'product_loop_oneclick'), 9);
add_action( 'template_redirect', array($this, 'header_buffer_start'), 1);
add_action( 'wp_head', array($this, 'header_buffer_stop'), 1);
}
public function empty_cart() {
if(isset($_GET['shm_direct_checkout']) && is_numeric($_GET['shm_direct_checkout'])) {
global $woocommerce;
$woocommerce->cart->empty_cart();
//WC()->session->set('cart', array());
$woocommerce->cart->add_to_cart(intval($_GET['shm_direct_checkout']), 1);
}
}
public function header_buffer_start() { ob_start(array($this, "header_buffer_callback")); }
public function header_buffer_stop() { ob_end_flush(); }
public function header_buffer_callback($buffer) {
if(is_ssl()) $buffer = str_replace("http://", "https://", $buffer);
return $buffer;
}
public function product_loop_oneclick() {
global $product;
echo '<div class="custom-add-to-cart">';
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
//woocommerce_template_loop_add_to_cart();
echo '<a class="button" href="'.wc_get_checkout_url()."?add-to-cart=".$product->get_id()."&shm_direct_checkout=".$product->get_id().'">Buy now!</a>';
echo '</div>';
}
public function oneclick_checkout() {
global $product;
echo '<a class="button" href="'.wc_get_checkout_url()."?add-to-cart=".$product->get_id()."&shm_direct_checkout=".$product->get_id().'">Buy now!</a>';
remove_action('woocommerce_'.$product->get_type().'_add_to_cart', 'woocommerce_'.$product->get_type().'_add_to_cart', 30);
}
}
new SexhackWoocommerceCheckout;
}
/* Class to add Video to product page instead of image */
if(!class_exists('SexhackWoocommerceProductVideos')) {
class SexhackWoocommerceProductVideos
......@@ -435,7 +494,8 @@ if(!class_exists('SH_WooCommerce_Registration_Integration')) {
else $wcprods = get_wc_subscription_products_priced($subscription_plan->price, $subscription_plan->id);
if(count($wcprods) > 0)
{
return wc_get_checkout_url()."?add-to-cart=".$wcprods[0]->get_id()."&quantity=1";
//return wc_get_checkout_url()."?add-to-cart=".$wcprods[0]->get_id()."&quantity=1";
return wc_get_checkout_url()."?shm_direct_checkout=".$wcprods[0]->get_id();
}
return $url; //home_url('/payment-info');
}
......
......@@ -44,6 +44,9 @@ function sh_disclaimer()
function sh_account_subscription_content()
{
// Re-add scripts for stripe in PMS
pms_stripe_enqueue_front_end_scripts();
echo '<h3>Subscriptions</h3>';
echo do_shortcode( '[pms-account show_tabs="no"]' );
echo "<h3>Payment History:</h3>";
......@@ -155,4 +158,10 @@ function user_is_model($uid=false)
if(!$model) return false;
return user_has_role($uid, $model);
}
function sh_del_job($id)
{
return SH_Query::del_job($id);
}
?>
This diff is collapsed.
......@@ -165,5 +165,26 @@ function sh_delete_categories_from_video($v)
return false;
}
function sh_add_video_job($v, $command, $args)
{
if(is_numeric($v) and $v > 0) return SH_Query::add_Video_job($v, $command, $args);
else if(is_object($v)) return SH_Query::add_Video_job($v->id, $command, $args);
return false;
}
function sh_del_video_job($v, $command=false)
{
if(is_numeric($v) and $v > 0) return SH_Query::del_Video_job($v, $command);
else if(is_object($v)) return SH_Query::del_Video_job($v->id, $command);
return false;
}
function sh_get_video_jobs($v=false)
{
if(is_numeric($v) and $v > 0) return SH_Query::get_Video_Jobs($v);
else if(is_object($v)) return SH_Query::get_Video_Jobs($v->id);
else return SH_Query::get_Video_Jobs(false);
}
?>
function shmChangeGif(o){
//console.log(o);
o.src = o.getAttribute('data-src');
console.log("loading "+o.src);
}
//window.onload = function(){
//var thumbhovers = document.getElementsByClassName("sexhack_thumb_hover");
//for (var i = 0; i < thumbhovers.length; i++) {
// thumbhovers[i].src = thumbhovers[i].getAttribute('data-src'); //second console output
//}
//}
......@@ -273,6 +273,17 @@ if(!class_exists('SexHackMe_Plugin')) {
PRIMARY KEY (id),
KEY video_id (video_id),
KEY tag_id (tag_id)
) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}jobs (
id bigint(20) AUTO_INCREMENT NOT NULL,
jobtype ENUM('video', 'photo') NOT NULL DEFAULT 'video',
obj_id bigint(20) NOT NULL,
command VARCHAR(255) NOT NULL,
arguments TEXT NOT NULL,
PRIMARY KEY (id),
KEY jobtype (jobtype),
KEY command (command),
KEY obj_id (obj_id)
) {$charset_collate};";
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
......@@ -577,6 +588,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// Sexhack Video Gallery
wp_enqueue_style ('sexhackme_gallery', SH_PLUGIN_DIR_URL.'css/sexhackme_gallery.css', array(), SH_VERSION);
wp_enqueue_script('sexgallery', SH_PLUGIN_DIR_URL.'js/sexhackme_gallery.js', array(), SH_VERSION);
// Sexhack Fix Header
wp_enqueue_style ('sexhackme_header', SH_PLUGIN_DIR_URL.'css/sexhackme_header.css', array(), SH_VERSION);
......
......@@ -51,6 +51,18 @@ if ( ! defined( 'ABSPATH' ) ) exit;
} ?>
</select>
<p class="description">Select ADV for bottom Videogallery</p>
<select id="sexadv_video_native" name="sexadv_video_native" class="widefat">
<option value="-1">Choose...</option>
<?php
$opt=get_option("sexadv_video_native");
foreach( get_posts(array('post_type' => 'sexhackadv', 'parent' => 0)) as $page ) {
echo '<option value="' . esc_attr( $page->ID ) . '"';
if ($opt == $page->ID) { echo "selected";}
echo '>' . esc_html( $page->post_title ) . ' ( ID: ' . esc_attr( $page->ID ) . ')' . '</option>';
} ?>
</select>
<p class="description">Select ADV for native Videogallery thumbs</p>
</td>
</tr>
</table>
......
......@@ -21,10 +21,12 @@
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
$plans = wp_SexHackMe\sh_get_subscription_plans();
?>
<style>
.cozmolabs-banner { display:none; }
</style>
<div class="wrap">
<?php do_settings_sections( 'sexhackme-wcpms-settings' ); ?>
<form method="post" action="/wp-admin/options.php">
......
......@@ -119,6 +119,37 @@ foreach(array('public','members','premium') as $level) { ?>
<input type='radio' name='video_isdownload_<?php echo $level; ?>' value='Y' <?php if($video->has_downloads($level)) echo "checked"; ?>>Yes</input>
<input type='radio' name='video_isdownload_<?php echo $level; ?>' value='N' <?php if(!$video->has_downloads($level)) echo "checked"; ?>>No</input>
</p>
<?php if($level == 'premium') { ?>
<p>
<label> Create Members video HLS from this video? </label>
<input type='radio' name='video_createMembers_<?php echo $level; ?>' value='Y' >Yes</input>
<input type='radio' name='video_createMembers_<?php echo $level; ?>' value='N' checked>No</input>
</p>
<p>
<label> Members video starts at:</label>
<input type='time' step="1" name='video_createMembersStart_<?php echo $level; ?>' value='00:00:00' ></input>
<label> Duration:</label>
<input type='number' style="width:80px; height:40px;" name='video_createMembersDuration_<?php echo $level; ?>' value='180' ></input>
<label> Seconds</label>
</p>
<?php
}
if($level != 'public') { ?>
<p>
<label> Create public video HLS from this video? </label>
<input type='radio' name='video_createPublic_<?php echo $level; ?>' value='Y' >Yes</input>
<input type='radio' name='video_createPublic_<?php echo $level; ?>' value='N' checked>No</input>
</p>
<p>
<label> Public video starts at:</label>
<input type='time' step="1" name='video_createPublicStart_<?php echo $level; ?>' value='00:00:00' ></input>
<label> Duration:</label>
<input type='number' style="width:80px; height:40px;" name='video_createPublicDuration_<?php echo $level; ?>' value='60' ></input>
<label> Seconds</label>
</p>
<?php } ?>
</p>
<?php
}
......@@ -274,9 +305,21 @@ foreach(array('thumb','gif_small','gif','preview') as $imgt) {
<input type="hidden" name="filename_<?php echo $imgt; ?>" value="">
</form>
</p>
<?php } ?>
<?php
if(in_array($imgt, array('gif_small','gif')))
{
?>
<p>
<label> Autogeneration starts at:</label>
<input type='time' step="1" name='video_createStart_<?php echo $imgt; ?>' value='00:00:30' ></input>
<label> Duration (seconds):</label>
<input type='number' style="width:80px; height:40px;" name='video_createDuration_<?php echo $imgt; ?>' value='6' ></input>
<label> FPS:</label>
<input type='number' style="width:80px; height:40px;" name='video_createFPS_<?php echo $imgt; ?>' value='<?php if($imgt=='gif') {echo "2";} else { echo "1";}?>' ></input>
</p>
<?php
}
} ?>
<p>
<div style="align:center;text-align:center">
<input disabled type="button" id="send" value="Save Video">
......@@ -348,6 +391,22 @@ jQuery(function($) {
formdata.append('public_isdownload', $('input[name="video_isdownload_public"]:checked').val());
formdata.append('members_isdownload', $('input[name="video_isdownload_members"]:checked').val());
formdata.append('premium_isdownload', $('input[name="video_isdownload_premium"]:checked').val());
formdata.append('video_createMembers_premium', $('input[name="video_createMembers_premium"]:checked').val());
formdata.append('video_createMembersStart_premium', $('input[name="video_createMembersStart_premium"]').val());
formdata.append('video_createMembersDuration_premium', $('input[name="video_createMembersDuration_premium"]').val());
formdata.append('video_createPublic_premium ', $('input[name="video_createPublic_premium"]:checked').val());
formdata.append('video_createPublicStart_premium', $('input[name="video_createPublicStart_premium"]').val());
formdata.append('video_createPublicDuration_premium', $('input[name="video_createPublicDuration_premium"]').val());
formdata.append('video_createPublic_members', $('input[name="video_createPublic_members"]:checked').val());
formdata.append('video_createPublicStart_members', $('input[name="video_createPublicStart_members"]').val());
formdata.append('video_createPublicDuration_members', $('input[name="video_createPublicDuration_members"]').val());
formdata.append('video_createStart_gif', $('input[name="video_createStart_gif"]').val());
formdata.append('video_createDuration_gif', $('input[name="video_createDuration_gif"]').val());
formdata.append('video_createFPS_gif', $('input[name="video_createFPS_gif"]').val());
formdata.append('video_createStart_gif_small', $('input[name="video_createStart_gif_small"]').val());
formdata.append('video_createDuration_gif_small', $('input[name="video_createDuration_gif_small"]').val());
formdata.append('video_createFPS_gif_small', $('input[name="video_createFPS_gif_small"]').val());
//formdata.append('vcategory', $("#catstable input:checkbox:checked").map(function(){ return $(this).val();}).get());
var vcats = $("#catstable input:checkbox:checked").map(function(){ return $(this).val();}).get();
......
......@@ -167,8 +167,6 @@ get_header(); ?>
{
if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
echo "<h3 class='sexhack-videonotify'><a href='/login'>YOU NEED FREE MEMBER, PREMUM LOGIN or BUY DOWLOAD TO ACCESS THIS VIDEO</a></h3>";
echo "<div style='width: 80%; margin-left: 10%;' >".do_shortcode('[pms-login redirect_url="/account" ]')."</div>";
}
break;
......@@ -190,7 +188,6 @@ get_header(); ?>
{
if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
echo "<h3 class='sexhack-videonotify'><a href='/product-category/subscriptions/'>YOU NEED A SUBSCRIPTION OR BUY DOWNLOAD TO ACCESS THIS VIDEO</a></h3>";
}
break;
......@@ -222,17 +219,6 @@ get_header(); ?>
<h2 class='sexhack-videonotify' style="padding:5%;"><b>PUBLIC VIDEO NOT AVAILABLE</b></h2>
<?php
if($hls_members) {
?>
<h3 class='sexhack-videonotify' style="padding:1px;"><a href="/register/">Register for free and watch members version!</a></h3>
<?php
}
if($hls_premium) {
?>
<h3 class='sexhack-videonotify' style="padding:1px;"><a href="">Register to watch premium version!</a></h3>
<?php
}
}
?>
</div> <!-- video container -->
......@@ -261,10 +247,24 @@ get_header(); ?>
<?php
echo $htmltags;
?>
<?php if(!user_has_member_access()) { ?>
<div class='sexhack-videonotify' style="padding:1px; margin: 0 auto;">
<a href="/register/">
<img src="<?php echo plugin_dir_url(__FILE__)."/img/cropped-sexhack_members-300x99.jpg";?>" alt="Register for free and watch members version!" />
</a>
</div>
<?php } ?>
<?php if($video->has_downloads()) { ?>
<h3><a href="<?php echo get_permalink($video->product_id); ?>">Download the full lenght hi-res version of this video</a><h3>
<?php } ?>
<?php
if(!is_user_logged_in())
echo "<div style='width: 80%; margin-left: 10%;' >".do_shortcode('[pms-login redirect_url="/account" ]')."</div>";
?>
<hr>
<?php
echo do_shortcode("[sexadv adv=".get_option('sexadv_video_bot')."]");
endwhile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment