function UI()
 {
     if (!isset($_SESSION['wpdm_addon_store_data']) || !is_object(json_decode($_SESSION['wpdm_addon_store_data']))) {
         $data = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getPackageList');
         $cats = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getCategoryList');
         $_SESSION['wpdm_addon_store_data'] = $data;
         $_SESSION['wpdm_addon_store_cats'] = $cats;
     } else {
         $data = $_SESSION['wpdm_addon_store_data'];
         $cats = $_SESSION['wpdm_addon_store_cats'];
     }
     $data = json_decode($data);
     $cats = json_decode($cats);
     include WPDM_BASE_DIR . "/admin/tpls/addons-list.php";
 }
Example #2
0
function wpdm_addonslist()
{
    if (!isset($_SESSION['wpdm_addon_store_data'])) {
        $data = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getPackageList');
        $cats = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getCategoryList');
        $_SESSION['wpdm_addon_store_data'] = $data;
        $_SESSION['wpdm_addon_store_cats'] = $cats;
    } else {
        $data = $_SESSION['wpdm_addon_store_data'];
        $cats = $_SESSION['wpdm_addon_store_cats'];
    }
    include WPDM_BASE_DIR . "/tpls/wpdm-addons-list.php";
}
Example #3
0
function wpdm_check_update()
{
    if (get_option('wpdm_update_notice') == 'disabled') {
        return;
    }
    $tmpvar = explode("?", basename($_SERVER['REQUEST_URI']));
    $page = array_shift($tmpvar);
    $latest = get_option('wpdm_latest');
    $latest_check = get_option('wpdm_latest_check');
    $time = time() - intval($latest_check);
    if ($latest == '' || $time > 86400) {
        $latest = remote_get('http://www.wpdownloadmanager.com/wp-content/plugins/download-manager/version.txt');
        update_option('wpdm_latest', $latest);
        update_option('wpdm_latest_check', time());
    }
    $tmpdata = isset($_REQUEST['page']) ? explode('/', $_REQUEST['page']) : array();
    if (version_compare(WPDM_Version, $latest, '<') == true && ($page == 'plugins.php' || array_shift($tmpdata) == 'file-manager')) {
        if ($page == 'plugins.php') {
            echo <<<NOTICE
     <script type="text/javascript">
      jQuery(function(){       
        jQuery('tr#download-manager').addClass('update').after('<tr class="plugin-update-tr"><td colspan=3 class="plugin-update colspanchange"><div style="border-radius:3px;background:#BB4F06;margin:7px;border-top:0px;padding:5px 15px;color:#fff"><b>There is a new version of Download Manager available. <a href="http://www.wpdownloadmanager.com/wordpress-download-manager-change-log/#{$latest}" style="color:#fff" target=_blank>View Version {$latest} Details &#187;</a></b></div></td></tr>');
      });
      </script>
NOTICE;
        } else {
            echo <<<NOTICE
     
        <div class="updated" style="border:0px;border-radius:3px;background:#BB4F06;margin:5px 0px;padding:5px 15px;color:#fff"><b>There is a new version of Download Manager available. <a href="http://www.wpdownloadmanager.com/wordpress-download-manager-change-log/#{$latest}" style="color:#fff" target=_blank>View Version {$latest} Details &#187;</a></b></div>
      
NOTICE;
        }
    }
}
Example #4
0
function wpdm_check_update()
{
    if (!current_user_can('manage_options')) {
        return;
    }
    $latest = '';
    //get_option('wpdm_latest');
    $latest_check = get_option('wpdm_latest_check');
    $time = time() - intval($latest_check);
    $plugins = get_plugins();
    $latest_v_url = 'http://www.wpdownloadmanager.com/versions.php';
    if ($latest == '' || $time > 86400) {
        $latest = remote_get($latest_v_url);
        update_option('wpdm_latest', $latest);
        update_option('wpdm_latest_check', time());
    }
    $latest = maybe_unserialize($latest);
    $page = isset($_REQUEST['page']) ? esc_attr($_REQUEST['page']) : '';
    $plugin_info_url = isset($_REQUEST['plugin_url']) ? $_REQUEST['plugin_url'] : 'http://www.wpdownloadmanager.com/purchases/';
    foreach ($latest as $plugin_dir => $latestv) {
        $plugin_data = wpdm_plugin_data($plugin_dir);
        if (version_compare($plugin_data['Version'], $latestv, '<') == true) {
            $plugin_name = $plugin_data['Name'];
            $plugin_info_url = $plugin_data['PluginURI'];
            $trid = sanitize_title($plugin_name);
            if ($trid != '') {
                if ($page == 'plugins') {
                    echo <<<NOTICE
     <script type="text/javascript">
      jQuery(function(){
        jQuery('tr#{$trid}').addClass('update').after('<tr class="plugin-update-tr"><td colspan=3 class="plugin-update colspanchange"><div style="background:#D54E21;border-top:0px;padding:5px 15px;color:#fff">There is a new version of {$plugin_name} available. <b><a href="{$plugin_info_url}#{$latestv}" style="color:#fff;float: right;background: rgba(0,0,0,0.2);padding: 5px 15px;margin-top:-5px;margin-right: -15px" target=_blank>Download v{$latestv}  <i class="fa fa-long-arrow-right"></i></a></b></div></td></tr>');
      });
      </script>
NOTICE;
                } else {
                    echo <<<NOTICE
     <script type="text/javascript">
      jQuery(function(){
        jQuery('.wrap > h2').after('<div class="updated error" style="margin:10px 0px;padding:10px;border:2px solid #dd3d36;border-radius:4px;background: #ffffff"><div style="float:left;"><b style="color:#dd3d36;">Important!</b><br/>There is a new version of <u>{$plugin_name}</u> available.</div> <a style="border-radius:2px;float:right;display:inline-table;color:#ffffff;background:#D54E21;padding:10px 15px" href="{$plugin_info_url}#{$latestv}"  target=_blank>Download v{$latestv}  <i class="fa fa-long-arrow-right"></i></a><div style="clear:both"></div></div>');
         });
         </script>
NOTICE;
                }
            }
        }
    }
    if (wpdm_is_ajax()) {
        die;
    }
}
 function pluginUpdate()
 {
     if (isset($_REQUEST['logout']) && $_REQUEST['logout'] == 1) {
         delete_option('__wpdm_suname');
         delete_option('__wpdm_supass');
         delete_option('__wpdm_purchased_items');
         delete_option('__wpdm_freeaddons');
         die('<script>location.href="edit.php?post_type=wpdmpro&page=settings&tab=plugin-update";</script>Refreshing...');
     }
     if (isset($_POST['__wpdm_suname']) && $_POST['__wpdm_suname'] != '') {
         update_option('__wpdm_suname', $_POST['__wpdm_suname']);
         update_option('__wpdm_supass', $_POST['__wpdm_supass']);
         delete_option('__wpdm_purchased_items');
         delete_option('__wpdm_freeaddons');
         $purchased_items = remote_get('http://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&user='******'__wpdm_suname') . '&pass='******'__wpdm_supass')));
         $ret = json_decode($purchased_items);
         if (isset($ret->error) && $ret->error != '') {
             die('Login Failed! Please recheck your login info.');
         } else {
             update_option('__wpdm_purchased_items', $purchased_items);
             die('<script>location.href=location.href;</script>Login successful. Refreshing...');
         }
     }
     if (get_option('__wpdm_suname') != '') {
         $purchased_items = get_option('__wpdm_purchased_items', false);
         if (!$purchased_items || wpdm_query_var('newpurchase') != '') {
             $purchased_items = remote_get('http://www.wpdownloadmanager.com/?wpdmppaction=getpurchaseditems&user='******'__wpdm_suname') . '&pass='******'__wpdm_supass')));
             update_option('__wpdm_purchased_items', $purchased_items);
         }
         $purchased_items = json_decode($purchased_items);
         if (isset($purchased_items->error)) {
             delete_option('__wpdm_suname');
             delete_option('__wpdm_purchased_items');
         }
         if (isset($purchased_items->error)) {
             $purchased_items->error = str_replace("[redirect]", admin_url("edit.php?post_type=wpdmpro&page=settings&tab=plugin-update"), $purchased_items->error);
         }
     }
     if (get_option('__wpdm_freeaddons') == '' || wpdm_query_var('newpurchase') != '' || 1) {
         $freeaddons = remote_get('http://www.wpdownloadmanager.com/?wpdm_api_req=getPackageList&cat_id=1148');
         update_option('__wpdm_freeaddons', $freeaddons);
     }
     $freeaddons = json_decode(get_option('__wpdm_freeaddons'));
     include WPDM_BASE_DIR . 'admin/tpls/settings/addon-update.php';
 }
function wpdm_check_update()
{
    if (!current_user_can(WPDM_ADMIN_CAP)) {
        return;
    }
    $latest = '';
    //get_option('wpdm_latest');
    $latest_check = get_option('wpdm_latest_check');
    $time = time() - intval($latest_check);
    $plugins = get_plugins();
    $latest_v_url = 'http://www.wpdownloadmanager.com/versions.php';
    if ($latest == '' || $time > 86400) {
        $latest = remote_get($latest_v_url);
        update_option('wpdm_latest', $latest);
        update_option('wpdm_latest_check', time());
    }
    $latest = maybe_unserialize($latest);
    $page = isset($_REQUEST['page']) ? esc_attr($_REQUEST['page']) : '';
    $plugin_info_url = isset($_REQUEST['plugin_url']) ? $_REQUEST['plugin_url'] : 'http://www.wpdownloadmanager.com/purchases/';
    if (is_array($latest)) {
        foreach ($latest as $plugin_dir => $latestv) {
            $plugin_data = wpdm_plugin_data($plugin_dir);
            $wpdmfree = $plugin_dir == 'download-manager' && version_compare($plugin_data['Version'], '3.0.0', '<');
            if (version_compare($plugin_data['Version'], $latestv, '<') == true && !$wpdmfree) {
                $plugin_name = $plugin_data['Name'];
                $plugin_info_url = $plugin_data['PluginURI'];
                $trid = sanitize_title($plugin_name);
                $plugin_update_url = admin_url('/edit.php?post_type=wpdmpro&page=settings&tab=plugin-update&plugin=' . $plugin_dir);
                //'http://www.wpdownloadmanager.com/purchases/?'; //
                if ($trid != '') {
                    if ($page == 'plugins') {
                        echo <<<NOTICE
     <script type="text/javascript">
      jQuery(function(){
        jQuery('tr#{$trid}').addClass('update').after('<tr class="plugin-update-tr"><td colspan=3 class="plugin-update colspanchange"><div class="update-message">There is a new version of <strong>{$plugin_name}</strong> available. <b><a href="{$plugin_update_url}&v={$latestv}" style="color: #D54E21;margin-left:10px" target=_blank>[ Update v{$latestv} ]</a></b></div></td></tr>');
      });
      </script>
NOTICE;
                    } else {
                        echo <<<NOTICE
     <script type="text/javascript">
      jQuery(function(){
        jQuery('.wrap > h2').after('<div class="updated error" style="margin:10px 0px;padding:10px;border:2px solid #dd3d36;border-radius:4px;background: #ffffff"><div style="float:left;"><b style="color:#dd3d36;">Important!</b><br/>There is a new version of <u>{$plugin_name}</u> available.</div> <a style="border-radius:2px; float:right;;color:#ffffff; background: #D54E21;padding:10px 15px" href="{$plugin_update_url}&v={$latestv}"  target=_blank>Update v{$latestv}  <i class="fa fa-long-arrow-right"></i></a><div style="clear:both"></div></div>');
         });
         </script>
NOTICE;
                    }
                }
            }
        }
    }
    if (wpdm_is_ajax()) {
        die;
    }
}