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);
}
?>
......@@ -71,6 +71,10 @@ function save_sexhack_video_forms( $post_id)
}
/* OK, it's safe for us to save the data now. */
// **** VIDEO OBJECT CREACTION **** //
// Make sure that it is set.
if ( ! isset( $_POST['video_description'] ) ) {
return;
......@@ -78,13 +82,17 @@ function save_sexhack_video_forms( $post_id)
// Get $video object
$setslug = false;
$newvideo = true;
$video = sh_get_video_from_post($post_id);
if(!$video) sexhack_log("Video object not initialized, new video?? (form passed \"$post_id\" \$post_id");
if(!$video) sexhack_log($video);
if(!$video) $setslug = true;
if(!$video) $newvideo = true;
if(!$video) $video = new SH_Video();
// **** VIDEO OBJECT BASIC SETTINGS **** //
// Set post_id
$video->post_id = $post_id;
......@@ -97,13 +105,6 @@ function save_sexhack_video_forms( $post_id)
$video->title = $post->post_title;
if(!$video->slug || $setslug) $video->slug = uniqidReal()."-".$post->post_name;
// TODO Remove debug
//sexhack_log("SAVE post object:");
// sexhack_log($post);
// sexhack_log(' - $POST:');
// sexhack_log($_POST);
// Model
if($admin) {
if(array_key_exists('video_model', $_POST) && is_numeric($_POST['video_model']) && intval($_POST['video_model']) > 0)
......@@ -115,23 +116,13 @@ function save_sexhack_video_forms( $post_id)
// Video description
$video->description = sanitize_text_field( $_POST['video_description'] );
// Video thumbnail
if($admin) {
if(array_key_exists('video_thumbnail', $_POST) && sanitize_text_field($_POST['video_thumbnail']))
$video->thumbnail = sanitize_text_field( $_POST['video_thumbnail'] );
else if(array_key_exists('_thumbnail_id', $_POST)
&& is_numeric($_POST['_thumbnail_id'])
&& intval($_POST['_thumbnail_id']) > 0)
// Save video status as "creating" to get video id
if($newvideo)
{
$video->thumbnail = intval($_POST['_thumbnail_id']);
}
else
$video->thumbnail = false;
} else {
// Shoudn't we move it somewhere?
if(isset($_POST['video_thumb'])
&& !empty($_POST['video_thumb'])) $video->thumbnail = get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_thumb']);
else $video->thumbnail = false;
$video->status = "creating";
$video = sh_save_video($video, 'FORM');
}
// Video status
......@@ -161,37 +152,76 @@ function save_sexhack_video_forms( $post_id)
if(array_key_exists('video_vr_projection', $_POST) && in_array($_POST['video_vr_projection'], array('VR180_LR','VR360_LR')))
$video->vr_projection = $_POST['video_vr_projection'];
// Preview video
if($admin && array_key_exists('video_preview', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_preview'])))
$video->preview = sanitize_text_field($_POST['video_preview']);
elseif(!$admin && array_key_exists('video_preview', $_POST) &&
sanitize_text_field($_POST['video_preview']))
$video->preview = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_preview']);
else
$video->preview = false;
// **** VIDEO ASSOCIATIVE ARRAYS **** //
// Animated gif path
if($admin && array_key_exists('video_gif', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_gif'])))
$video->gif = sanitize_text_field($_POST['video_gif']);
elseif(!$admin && array_key_exists('video_gif', $_POST) &&
sanitize_text_field($_POST['video_gif']))
$video->gif = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_gif']);
else
$video->gif = false;
// Small Animated gif path
if($admin && array_key_exists('video_gif_small', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_gif_small'])))
$video->gif_small = sanitize_text_field($_POST['video_gif_small']);
elseif(!$admin && array_key_exists('video_gif_small', $_POST) &&
sanitize_text_field($_POST['video_gif_small']))
$video->gif_small = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_gif_small']);
else
$video->gif_small = false;
// Video Guests
if(array_key_exists('vguests', $_POST) && is_array($_POST['vguests']))
{
foreach($_POST['vguests'] as $guest_id)
{
if(is_numeric($guest_id) && intval($guest_id) > 0)
{
if($admin || (!$admin && intval($guest_id) != get_current_user_id())) {
$guest = get_userdata(intval($guest_id));
if($guest) $video->add_guest($guest);
}
}
}
}
// Make sure the guestss array is initialized
$video->get_guests(false);
// Video Categories
if(array_key_exists('vcategory', $_POST) && is_array($_POST['vcategory']))
{
foreach($_POST['vcategory'] as $cat_id)
{
if(is_numeric($cat_id) && intval($cat_id) > 0)
{
$cat = sh_get_categories(intval($cat_id));
if($cat) $video->add_category($cat);
}
}
}
// Make sure the categories array is initialized
$video->get_categories(false);
// Video Tags
if(array_key_exists('video_tags', $_POST) && is_array($_POST['video_tags']))
{
foreach($_POST['video_tags'] as $tag_name)
{
$tag_name = str_replace("#", "", $tag_name);
$vtags = $video->get_tags(false);
if(sanitize_text_field(strtolower($tag_name)))
{
$tag_name = sanitize_text_field(strtolower($tag_name));
$tag = sh_get_tag_by_name($tag_name, true);
if($tag) $video->add_tag($tag);
}
}
}
// Make sure the tags array is initialized
$video->get_tags(false);
// **** HLS AND DOWNLOAD VIDEO PROCESSING **** //
// Differenciated content for access levels
$public_exist=false;
$members_exists=false;
$selectedv=false;
foreach(array('public','members','premium') as $vt)
{
if(!$admin && array_key_exists('video_'.$vt, $_POST) &&
sanitize_text_field($_POST['video_'.$vt]) && !$selectedv)
{
$selectedv = get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]);
}
// HLS playlist
if($admin &&array_key_exists('video_hls_'.$vt, $_POST) &&
check_url_or_path(sanitize_text_field($_POST['video_hls_'.$vt])) &&
......@@ -202,7 +232,57 @@ function save_sexhack_video_forms( $post_id)
else if(!$admin && array_key_exists('video_'.$vt, $_POST) &&
sanitize_text_field($_POST['video_'.$vt]))
{
$video->__set('hls_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
//$video->__set('hls_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
sh_add_video_job($video->id, 'process_hls_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
if($vt=='public') $public_exists=true;
if($vt=='members')
{
$members_exists=true;
if(array_key_exists('video_createPublic_'.$vt, $_POST) &&
array_key_exists('video_createPublicStart_'.$vt, $_POST) &&
\DateTime::createFromFormat('H:i:s',$_POST['video_createPublicStart_'.$vt]) &&
array_key_exists('video_createPublicDuration_'.$vt, $_POST) &&
is_numeric($_POST['video_createPublicDuration_'.$vt]) && intval($_POST['video_createPublicDuration_'.$vt]) > 0 &&
in_array($_POST['video_createPublic_'.$vt], array('Y','N')) && !$public_exists)
{
$file=get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]);
$start=$_POST['video_createPublicStart_'.$vt];
$duration=$_POST['video_createPublicDuration_'.$vt];
sh_add_video_job($video->id, 'create_hls_public', json_encode(array('file' => $file, 'start' => $start, 'duration' => $duration )));
$public_exists=true;
}
}
if($vt=='premium')
{
if(array_key_exists('video_createPublic_'.$vt, $_POST) &&
array_key_exists('video_createPublicStart_'.$vt, $_POST) &&
\DateTime::createFromFormat('H:i:s',$_POST['video_createPublicStart_'.$vt]) &&
array_key_exists('video_createPublicDuration_'.$vt, $_POST) &&
is_numeric($_POST['video_createPublicDuration_'.$vt]) && intval($_POST['video_createPublicDuration_'.$vt]) > 0 &&
in_array($_POST['video_createPublic_'.$vt], array('Y','N')) && !$public_exists)
{
$file=get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]);
$start=$_POST['video_createPublicStart_'.$vt];
$duration=$_POST['video_createPublicDuration_'.$vt];
sh_add_video_job($video->id, 'create_hls_public', json_encode(array('file' => $file, 'start' => $start, 'duration' => $duration )));
$public_exists=true;
}
if(array_key_exists('video_createMembers_'.$vt, $_POST) &&
array_key_exists('video_createMembersStart_'.$vt, $_POST) &&
\DateTime::createFromFormat('H:i:s',$_POST['video_createMembersStart_'.$vt]) &&
array_key_exists('video_createMembersDuration_'.$vt, $_POST) &&
is_numeric($_POST['video_createMembersDuration_'.$vt]) && intval($_POST['video_createPublicDuration_'.$vt]) > 0 &&
in_array($_POST['video_createMembers_'.$vt], array('Y','N')) && !$public_exists)
{
$file=get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]);
$start=$_POST['video_createMembersStart_'.$vt];
$duration=$_POST['video_createMembersDuration_'.$vt];
sh_add_video_job($video->id, 'create_hls_members', json_encode(array('file' => $file, 'start' => $start, 'duration' => $duration )));
$public_exists=true;
}
}
$video->__set('hls_'.$vt, false);
}
else $video->__set('hls_'.$vt, false);
......@@ -215,7 +295,10 @@ function save_sexhack_video_forms( $post_id)
else if(!$admin && array_key_exists($vt.'_isdownload', $_POST) &&
in_array($_POST[$vt.'_isdownload'], array('Y','N')) && array_key_exists('video_'.$vt, $_POST) &&
sanitize_text_field($_POST['video_'.$vt]))
$video->__set('download_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
{
//$video->__set('download_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
sh_add_video_job($video->id, 'process_download_'.$vt, get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_'.$vt]));
}
else $video->__set('download_'.$vt, false);
// Text only data
......@@ -232,58 +315,104 @@ function save_sexhack_video_forms( $post_id)
}
// Video Guests
if(array_key_exists('vguests', $_POST) && is_array($_POST['vguests']))
{
foreach($_POST['vguests'] as $guest_id)
{
if(is_numeric($guest_id) && intval($guest_id) > 0)
// **** VIDEO EXTRACTIONS PROPERTIES (XXX those NEEDS to be AFTER video processing) **** //
// Video thumbnail
if($admin) {
if(array_key_exists('video_thumbnail', $_POST) && sanitize_text_field($_POST['video_thumbnail']))
$video->thumbnail = sanitize_text_field( $_POST['video_thumbnail'] );
else if(array_key_exists('_thumbnail_id', $_POST)
&& is_numeric($_POST['_thumbnail_id'])
&& intval($_POST['_thumbnail_id']) > 0)
{
if($admin || (!$admin && intval($guest_id) != get_current_user_id())) {
$guest = get_userdata(intval($guest_id));
if($guest) $video->add_guest($guest);
$video->thumbnail = intval($_POST['_thumbnail_id']);
}
else
$video->thumbnail = false;
} else {
// Shoudn't we move it somewhere?
if(isset($_POST['video_thumb'])
&& !empty($_POST['video_thumb']))
{
//$video->thumbnail = get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_thumb']);
sh_add_video_job($video->id, 'process_thumb', get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_thumb']));
$video->thumbnail = false;
}
else
{
if($selectedv) sh_add_video_job($video->id, 'create_thumb', $selectedv);
$video->thumbnail = false;
}
}
// Make sure the guestss array is initialized
$video->get_guests(false);
// Video Categories
if(array_key_exists('vcategory', $_POST) && is_array($_POST['vcategory']))
{
foreach($_POST['vcategory'] as $cat_id)
{
if(is_numeric($cat_id) && intval($cat_id) > 0)
// Animated gif path
if($admin && array_key_exists('video_gif', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_gif'])))
$video->gif = sanitize_text_field($_POST['video_gif']);
elseif(!$admin && array_key_exists('video_gif', $_POST) &&
sanitize_text_field($_POST['video_gif']))
{
$cat = sh_get_categories(intval($cat_id));
if($cat) $video->add_category($cat);
}
//$video->gif = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_gif']);
sh_add_video_job($video->id, 'process_gif', get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_gif']));
$video->gif = false;
}
elseif(!$admin &&
array_key_exists('video_createStart_gif', $_POST) &&
\DateTime::createFromFormat('H:i:s',$_POST['video_createStart_gif']) &&
array_key_exists('video_createDuration_gif', $_POST) &&
is_numeric($_POST['video_createDuration_gif']) && intval($_POST['video_createDuration_gif']) > 0 &&
array_key_exists('video_createFPS_gif', $_POST) &&
is_numeric($_POST['video_createFPS_gif']) && intval($_POST['video_createFPS_gif']) > 0 )
{
$duration=$_POST['video_createDuration_gif'];
$start=$_POST['video_createStart_gif'];
$fps=$_POST['video_createFPS_gif'];
sh_add_video_job($video->id, 'create_gif', json_encode(array('start' => $start, 'fps' => $fps, 'duration' => $duration )));
$video->gif = false;
}
// Make sure the categories array is initialized
$video->get_categories(false);
else
$video->gif = false;
// Video Tags
if(array_key_exists('video_tags', $_POST) && is_array($_POST['video_tags']))
{
foreach($_POST['video_tags'] as $tag_name)
// Small Animated gif path
if($admin && array_key_exists('video_gif_small', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_gif_small'])))
$video->gif_small = sanitize_text_field($_POST['video_gif_small']);
elseif(!$admin && array_key_exists('video_gif_small', $_POST) &&
sanitize_text_field($_POST['video_gif_small']))
{
$tag_name = str_replace("#", "", $tag_name);
$vtags = $video->get_tags(false);
if(sanitize_text_field(strtolower($tag_name)))
//$video->gif_small = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_gif_small']);
sh_add_video_job($video->id, 'process_gif_small', get_option('sexhack_video_tmp_path', '/tmp')."/".sanitize_text_field($_POST['video_gif_small']));
$video->gif_small = false;
}
elseif(!$admin &&
array_key_exists('video_createStart_gif_small', $_POST) &&
\DateTime::createFromFormat('H:i:s',$_POST['video_createStart_gif_small']) &&
array_key_exists('video_createDuration_gif_small', $_POST) &&
is_numeric($_POST['video_createDuration_gif_small']) && intval($_POST['video_createDuration_gif_small']) > 0 &&
array_key_exists('video_createFPS_gif_small', $_POST) &&
is_numeric($_POST['video_createFPS_gif_small']) && intval($_POST['video_createFPS_gif_small']) > 0 )
{
$tag_name = sanitize_text_field(strtolower($tag_name));
$tag = sh_get_tag_by_name($tag_name, true);
if($tag) $video->add_tag($tag);
$duration=$_POST['video_createDuration_gif_small'];
$start=$_POST['video_createStart_gif_small'];
$fps=$_POST['video_createFPS_gif_small'];
sh_add_video_job($video->id, 'create_gif_small', json_encode(array('start' => $start, 'fps' => $fps, 'duration' => $duration )));
$video->gif_small = false;
}
else
$video->gif_small = false;
// Preview video
if($admin && array_key_exists('video_preview', $_POST) && check_url_or_path(sanitize_text_field($_POST['video_preview'])))
$video->preview = sanitize_text_field($_POST['video_preview']);
elseif(!$admin && array_key_exists('video_preview', $_POST) &&
sanitize_text_field($_POST['video_preview']))
{
//$video->preview = sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_preview']);
sh_add_video_job($video->id, 'process_preview', sanitize_text_field(get_option('sexhack_video_tmp_path', '/tmp')."/".$_POST['video_preview']));
}
}
// Make sure the tags array is initialized
$video->get_tags(false);
else
$video->preview = false;
// Save the video data in the database.
......
......@@ -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