HEX
Server: Apache
System: Linux 162-240-236-42.bluehost.com 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar 20 15:54:52 UTC 2024 x86_64
User: bt667 (1004)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //proc/self/cwd/wp-content/plugins/wp_mvplayer/init.php
<?php
require_once(ABSPATH.'wp-admin/includes/plugin.php');

function mvp_setting_page_table(){
    global $wpdb;
    require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
    $video_table = $wpdb->prefix . "mvplayer_video";
    $video_table_query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $video_table ) );

    if (!$wpdb->get_var( $video_table_query ) == $video_table ) {
        $sql = "CREATE TABLE {$video_table} (
            `id` int(9) NOT NULL AUTO_INCREMENT,
            Title text,VideoSource text,Video text,
            ImageLogo text,VideoWidth text,VideoHeight text,
            AutoPlay text,AllowPause text,VideoAlign text,
            VideoControls text,ShowContentLocation text,
            ShowContentDuration text,VideoContent text,
            SocialButtonLocation text,SocialLockDuration text,
            SocialEnable text,SocialTitle text,SocialText text,
            SocialLockAllowSkip text,DefaultTweet text,
            HeadlineMsg text,ShareUrl text,CustomUrl text,
            OptinBox text,OptinLocation text,OptinMidTime text,
            OptinHeadline text,OptinText text,OptinSubmitText text,
            ThankyouMessage text,OptinAllowSkip text,Popup text,
            PopupContent text,PopupLink text,PopupLocation text,
            PopupMidTime text,VideoMailingList text,custom_formcode text,
            MailChimpApiKey text,MailChimpListId text,GetResponseApiKey text,
            GetResponseCampaignId text,AWeberAccessTokens text,AWeberListID text,
            ConstCntctUserName text,ConstCntctAPIKey text,ConstCntctSecret text,
            ConstCntctListID text,SendlaneApiKey text,SendlaneApiHashKey text,
            SendlaneApiUrl text,SendlaneSubDomain text,SendlaneListID text,
            SessionConsumer text,PlayerSkin text,cta_enable text,
            ctabtn_location text,ctabtn_dur text,cta_bg_color text,
            cta_text_color text,cta_btn_text text,cta_btn_border text,
            cta_btn_radius text,cta_btn_border_color text,cta_btn_height text,
            cta_btn_width text,ctabtn_allow_skip text,cta_share_url text,
            cta_custom_url text,AllowScroll text,
            UNIQUE KEY id (id));";

        dbDelta($sql);
    }
    
    $playlist_table_name = $wpdb->prefix . "playlist_video";
    $playlist_table_query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $playlist_table_name ) );

    if (!$wpdb->get_var( $playlist_table_query ) == $playlist_table_name ) {
        $sql = "CREATE TABLE {$playlist_table_name} (
            `id` int(9) NOT NULL AUTO_INCREMENT,
            Title text,Playlist_Id int(9),VideoOption text,
            VideoSource text,Video text,ImageLogo text,
            VideoWidth text,VideoHeight text,AutoPlay text,
            AllowPause text,VideoAlign text,VideoControls text,
            ShowContentLocation text,ShowContentDuration text,
            VideoContent text,SocialButtonLocation text,
            SocialLockDuration text,SocialEnable text,SocialTitle text,
            SocialText text,SocialLockAllowSkip text,DefaultTweet text,
            HeadlineMsg text,ShareUrl text,CustomUrl text,
            OptinBox text,OptinLocation text,OptinMidTime text,
            OptinHeadline text,OptinText text,OptinSubmitText text,
            ThankyouMessage text,OptinAllowSkip text,Popup text,
            PopupContent text,PopupLink text,PopupLocation text,
            PopupMidTime text,VideoMailingList text,custom_formcode text,
            MailChimpApiKey text,MailChimpListId text,GetResponseApiKey text,
            GetResponseCampaignId text,AWeberAccessTokens text,AWeberListID text,
            ConstCntctUserName text,ConstCntctAPIKey text,ConstCntctSecret text,
            ConstCntctListID text,SendlaneApiKey text,SendlaneApiHashKey text,
            SendlaneApiUrl text,SendlaneSubDomain text,SendlaneListID text,
            SessionConsumer text,PlayerSkin text,
            UNIQUE KEY id (id));";
        dbDelta($sql); 
    }

    $mvp_videobuttons_table_name = $wpdb->prefix . "mvplayer_videobuttons";
    $videobuttons_table_query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $mvp_videobuttons_table_name ) );

    if (!$wpdb->get_var( $videobuttons_table_query ) == $mvp_videobuttons_table_name ) {
        $sql = "CREATE TABLE {$mvp_videobuttons_table_name} (
            `id` int(9) NOT NULL AUTO_INCREMENT,
            VideoId int(9),Label text,Icon text,
            Type text,MapLocation text,IframeUrl text,
            HtmlCode text,PostCategory text,PostNo text,
            Page text,RelatedVideoUrls text,
            RelatedVideoThumbs text,
            UNIQUE KEY id (id));";

        dbDelta($sql);
    }

    $users_table_name = $wpdb->prefix . "mvplayer_users";
    $users_table_query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $users_table_name ) );

    if (!$wpdb->get_var( $users_table_query ) == $users_table_name ) {
        $sql = "CREATE TABLE {$users_table_name} (
            `id` int(9) NOT NULL AUTO_INCREMENT,
            UserName text,UserMail text,Date datetime,
            UNIQUE KEY id (id));";

        dbDelta($sql);  
    }

    $plugin_data = get_plugin_data(MV_PLAYER_FILE);
    $installed_version = $plugin_data['Version'];
    
    if($installed_version > "1.08"){
        // $table_name = $wpdb->prefix . "mvplayer_videobuttons";
        // $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$table_name}' AND column_name = 'PlaylistId'"  );

        // if(empty($row)){
        //     $sql = "ALTER TABLE {$table_name} ADD PlaylistId INT(9) NOT NULL ";
        //     $wpdb->query($sql);
        // }

        // Add PlaylistId column to mvplayer_videobuttons table if not exists
        $table_name = $wpdb->prefix . "mvplayer_videobuttons";
        $column_name = "PlaylistId";
        $column_query = $wpdb->prepare( "SHOW COLUMNS FROM {$table_name} LIKE %s", $column_name );

        if ( !$wpdb->get_var( $column_query ) == $column_name ) {
            $sql = "ALTER TABLE {$table_name} ADD {$column_name} INT(9)";
            $wpdb->query($sql);
        }
    }

    if($installed_version > "1.19"){
        $table_name = $wpdb->prefix . "mvplayer_video";
        $row = $wpdb->get_results("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = '{$table_name}' AND column_name = 'AllowScroll'"  );

        if(empty($row)){
            $sql = "ALTER TABLE {$table_name} ADD AllowScroll text NOT NULL ";
            $wpdb->query($sql);
        }
    }
}

register_activation_hook(MV_PLAYER_FILE,'mvp_setting_page_table');

function mvp_load_admin_menu(){    
    $mvp_player_license_option = MVP_Importer_Helper::mvp_player_license_status_option();

    if(!empty($mvp_player_license_option)){
        $status  = (isset($mvp_player_license_option['status']))?$mvp_player_license_option['status']:'';

        if(isset($status) && $status=='Active'){
            add_menu_page('manage video', __('MVP Player','mvp' ), 'add_users','mv_player_manage_video','mvp_video_manage',MV_PLAYER_URL.'/image/menu.png');
            add_submenu_page('mv_player_manage_video','manage video', __('Manage Video','mvp' ), 'add_users','mv_player_manage_video', 'mvp_video_manage');
            add_submenu_page('mv_player_manage_video','mv player add video', __('Add Video','mvp' ), 'add_users','mv_player_add_video', 'mvp_video_add');
            add_submenu_page('mv_player_manage_video','mv player users', __('Users','mvp' ), 'add_users','mv_player_users', 'mvp_all_users');
            add_submenu_page('mv_player_manage_video','mv player manage playlist', __('Manage Playlist','mvp' ), 'add_users','mv_player_manage_playlist', 'mvp_manage_playlist');
            add_submenu_page('mv_player_manage_video','mv player create playlist', __('Add Playlist','mvp' ), 'add_users','mv_player_add_playlist', 'mvp_add_playlist');
            add_submenu_page('mv_player_manage_video','MVP Player License', __('MVP Player License','mvp' ), 'add_users','mv_player_license_required', 'mvp_admin_plugin_license_player');
        }elseif(isset($status) && $status=='Expired'){
            add_submenu_page('null','MVP Player License', __('MVP Player License','mvp' ), 'add_users','mv_player_license_required', 'mvp_admin_plugin_license_player');
        }
    }else{
        add_submenu_page('null','MVP Player License', __('MVP Player License','mvp' ), 'add_users','mv_player_license_required', 'mvp_admin_plugin_license_player');
    }
}

add_action('admin_menu', 'mvp_load_admin_menu');

function mvp_add_playlist(){
    include_once(MV_PLAYER_PATH.'/settings/add_playlist.php');
}

function mvp_manage_playlist(){
    include_once(MV_PLAYER_PATH.'/settings/manage_playlist.php');
}

function mvp_admin_plugin_license_player(){
    require_once(MV_PLAYER_PATH.'/includes/CPT/admin_license_form.php');
}

function mvp_video_add(){
    require_once(MV_PLAYER_PATH.'/settings/admin_add_video.php');
}

function mvp_video_manage(){
    require_once(MV_PLAYER_PATH.'/settings/admin_manage_video.php');
}

function mvp_all_users(){
    include_once(MV_PLAYER_PATH.'/settings/users.php');
}

require_once (MV_PLAYER_PATH . 'includes/player.php');
require_once (MV_PLAYER_PATH . 'includes/playlist.php');
require_once (MV_PLAYER_PATH . 'includes/social-lock/social_share_scripts.php');
require_once (MV_PLAYER_PATH . 'includes/MCAPI.class.php');
require_once (MV_PLAYER_PATH . 'includes/GetResponseAPI.class.php');
require_once (MV_PLAYER_PATH . 'includes/aweber_api/aweber_api.php');
require_once (MV_PLAYER_PATH . 'includes/constant_contact_api/ConstantContact.php');

function mvp_player_frontend_script(){
    wp_enqueue_script('jquery');
    wp_enqueue_script('vimeo-video', MV_PLAYER_URL . 'includes/vimeo/froogaloop.min.js');
    wp_enqueue_script('flowplayer-html5', MV_PLAYER_URL . 'includes/flowplayer_html5/flowplayer.min.js');
    wp_enqueue_script('flowplayer-html51', MV_PLAYER_URL . 'includes/flowplayer_html5/flowplayer.js');
    wp_register_style(MV_PLAYER_SLUG."minimalist-css",MV_PLAYER_URL."includes/flowplayer_html5/skin/minimalist.css");  
    wp_enqueue_style(MV_PLAYER_SLUG."minimalist-css");
    wp_register_style(MV_PLAYER_SLUG."front-css",MV_PLAYER_URL."css/front.css?time=".time());
    wp_enqueue_style(MV_PLAYER_SLUG."front-css");
}

add_action( 'wp_enqueue_scripts', 'mvp_player_frontend_script' );

function mvp_plugin_ajaxurl(){
    echo '<script type="text/javascript">
       var ajaxurl = "' . admin_url('admin-ajax.php') . '";
    </script>';
}

add_action('wp_head', 'mvp_plugin_ajaxurl');

add_action( 'wp_ajax_mvp_optin_action', 'mvp_optin_action' );
add_action( 'wp_ajax_nopriv_mvp_optin_action', 'mvp_optin_action' );

function mvp_optin_action() {
    global $wpdb;
    $username        = $_POST['username'];
    $useremail       = $_POST['useremail'];
    $ip_address      = $_POST['ip_address'] ;
    $datetime        = $_POST['datetime'] ;
    $videoid         = $_POST['videoid'] ;   

    $video_table = $wpdb->prefix . "mvplayer_video";
    $video_detail =  $wpdb->get_row("SELECT * FROM $video_table where id= $videoid");

    if($video_detail==""){
        $video_detail =  $wpdb->get_row("SELECT * FROM wp_playlist_video where id= $videoid");
    }
    
    if($video_detail->VideoMailingList=='mailchimp'){
        $apiKey = $video_detail->MailChimpApiKey;
        $listId = $video_detail->MailChimpListId;

        if($video_detail->MailChimpApiKey && $video_detail->MailChimpListId){
            $mcapi  =  new MCAPI($data->MailChimpApiKey,$secure=false);
            $merge_vars = array('FNAME'=>$username);
            /* START :: Add New CURL Code for mailchimp AR*/

            //Create mailchimp API url
            $memberId = md5(strtolower($useremail));
            $dataCenter = substr($apiKey,strpos($apiKey,'-')+1);
            $url = 'https://'.$dataCenter.'.api.mailchimp.com/3.0/lists/'.$listId.'/members/'.$memberId;

            //Member info
            $data = array(
                'email_address'=>$useremail,
                'status' => 'subscribed',
                'merge_fields'  => [
                    'FNAME'     => $username
                ]
            );

            $jsonString = json_encode($data);            
            // send a HTTP POST request with curl

            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey);
            curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_TIMEOUT, 10);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonString);
            $result = curl_exec($ch);
            $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);        
            curl_close($ch);

            //Collecting the status
            switch ($httpCode) {
                case 200:
                   $msg = __('success','mvp');
                   break;
                case 214:
                    $msg = __('Already Subscribed','mvp');
                    break;
                default:
                    $msg = __('Oops, please try again.[msg_code='.$httpCode.']','mvp');
                    break;
            }

            echo $msg;
            /*END :: Add New CURL Code for mailchimp AR*/
        }
    }else if($video_detail->VideoMailingList=='getresponse'){

        if($video_detail->GetResponseApiKey && $video_detail->GetResponseCampaignId){
            $api = new GetResponse($video_detail->GetResponseApiKey);
            $campaign_id = $video_detail->GetResponseCampaignId;
            $params = array('campaign' => array('campaignId'=>$campaign_id), 'action' => 'standard', 'name' => $username,'email' => $useremail, 'cycle_day' => '0');
            $response  = $api->addContact($params);
            echo "success";
        }
    }else if($video_detail->VideoMailingList=='aweber'){
        $AWeberAccessTokens = unserialize($video_detail->AWeberAccessTokens);
        $AWeberListID = $video_detail->AWeberListID;
        $aweber = new AWeberAPI($AWeberAccessTokens['consumerKey'], $AWeberAccessTokens['consumerSecret']);

        try{
            $account = $aweber->getAccount($AWeberAccessTokens['accessKey'], $AWeberAccessTokens['accessSecret']);
            $params = array(
                'email' => $useremail,
                'ip_address' => $_SERVER['REMOTE_ADDR'],
                'name' => $username,
                'ad_tracking' => 'Wordpress',
            );

            $account_id = $account->id;
            $listURL = "/accounts/{$account_id}/lists/{$AWeberListID}/subscribers";
            $subscribers = $account->loadFromUrl($listURL);
            $new_subscriber = $subscribers->create($params);
            echo "success";
        }
        catch(Exception $e){
            print "$e->message";
        }
    }else if($video_detail->VideoMailingList=='constantcontact'){
        if($video_detail->ConstCntctUserName && $video_detail->ConstCntctAPIKey && $video_detail->ConstCntctSecret && $video_detail->ConstCntctListID){
            try{
                $user_name      = $data->ConstCntctUserName;
                $apiKey         = $data->ConstCntctAPIKey;
                $consumerSecret = $data->ConstCntctSecret;
                $Datastore = new CTCTDataStore();
                $DatastoreUser = $Datastore->lookupUser($user_name,$videoid);

                if($DatastoreUser){
                    $ConstantContact = new ConstantContact($videoid,'oauth', $apiKey, $DatastoreUser['username'], $consumerSecret);
                    $Contact = new Contact();
                    $Contact->emailAddress  = $useremail;
                    $Contact->firstName     = $username;
                    $Contact->lists         = array($video_detail->ConstCntctListID);
                    $NewContact = $ConstantContact->addContact($Contact);
                    echo "success";
                }
            }catch(Exception $e){
            }
        }
    }else if($video_detail->VideoMailingList=='sendlane'){
        $sendlane_api_key =$video_detail->SendlaneApiKey;
        $sendlane_hash_key =$video_detail->SendlaneApiHashKey;
        $list_id = $video_detail->SendlaneListID;
        $url = 'https://sendlane.com/api/v1/list-subscriber-add';

        $dataArr = array(
            'api' => $sendlane_api_key,'hash' => $sendlane_hash_key,
            'email'=> $useremail,'first_name'=>$username,
            'list_id' => $list_id
        );

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_TIMEOUT, 5);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$dataArr);
        $resdata = curl_exec($ch);
        $json = json_decode($resdata);
        curl_close($ch);

        if ($err) {
          echo "cURL Error #:" . $err;
        } else {
          echo $resdata;
        }
    }else{
        $users_table = $wpdb->prefix . "mvplayer_users";
        $useripaddress = $_SERVER["REMOTE_ADDR"];
        $wpdb->insert( $users_table, array('UserName' => $username,'UserMail' =>$useremail,'UserIPAddress'=>$useripaddress,'Date'=>date("Y-m-d h:i:s")));
        echo "success";
    }
    exit();
}

function mvp_admin_scripts(){
    wp_enqueue_script('media-upload');
    wp_enqueue_script('thickbox');
    wp_enqueue_script('my-upload');
    wp_enqueue_style( 'farbtastic' );
    wp_enqueue_script( 'farbtastic' );
    wp_enqueue_script('jquery-effects-slide');
	wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-repeater', MV_PLAYER_URL . 'js/repeater-data.js');
    wp_enqueue_script('jquery-imagebtn', MV_PLAYER_URL . 'includes/pixelmatrix-uniform/jquery.uniform.js');
    wp_enqueue_script('jquery-imagebtn', MV_PLAYER_URL . 'includes/pixelmatrix-uniform/jquery.uniform.min.js');
    wp_register_style(MV_PLAYER_SLUG.'jquery-imagebtn-css',MV_PLAYER_URL.'includes/pixelmatrix-uniform/themes/agent/css/uniform.agent.css');
    wp_enqueue_style(MV_PLAYER_SLUG.'jquery-imagebtn-css');
    wp_enqueue_script('jquery-ddslick', MV_PLAYER_URL . 'js/ddslick.js');
}

add_action('admin_print_scripts', 'mvp_admin_scripts');

function mvp_admin_styles(){
    wp_enqueue_style('thickbox');
}


add_action('admin_print_styles', 'mvp_admin_styles');

function MVPlayerStartSession(){
	if(!session_id()) {
        @session_start();
    }
}

function MVPlayerEndSession(){
	session_destroy();
}

add_action('wp_login', 'MVPlayerEndSession');
add_action('wp_logout', 'MVPlayerEndSession');
add_action('init', 'MVPlayerStartSession', 1);