Пример #1
0
/**
 * Cache remote file to local directory and return local file path
 * @param mixed $url
 * @param mixed $filename
 * @return string $path
 */
function wpdm_cache_remote_file($url, $filename = '')
{
    $filename = $filename ? $filename : end($tmp = explode('/', $url));
    $path = WPDM_CACHE_DIR . $filename;
    $fp = fopen($path, 'w');
    if (!function_exists('curl_init')) {
        WPDM_Messages::Error('<b>cURL</b> is not active or installed or not functioning properly in your server', 1);
    }
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_FILE, $fp);
    $data = curl_exec($ch);
    curl_close($ch);
    fclose($fp);
    return $path;
}
Пример #2
0
 /**
  * @usage Edit profile
  * @return string
  */
 public function EditProfile()
 {
     global $wpdb, $current_user, $wp_query;
     wp_reset_query();
     $currentAccess = maybe_unserialize(get_option('__wpdm_front_end_access', array()));
     if (!array_intersect($currentAccess, $current_user->roles) && is_user_logged_in()) {
         return WPDM_Messages::Error(wpautop(stripslashes(get_option('__wpdm_front_end_access_blocked'))), -1);
     }
     $id = wpdm_query_var('ID');
     ob_start();
     if (is_user_logged_in()) {
         include wpdm_tpl_path('wpdm-edit-user-profile.php');
     } else {
         include wpdm_tpl_path('wpdm-be-member.php');
     }
     $data = ob_get_clean();
     return $data;
 }
Пример #3
0
/**
 * @usage Get with cURL
 * @param $url
 * @return bool|mixed|string
 */
function remote_get($url)
{
    $options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HEADER => false, CURLOPT_ENCODING => "", CURLOPT_USERAGENT => "spider", CURLOPT_AUTOREFERER => true, CURLOPT_CONNECTTIMEOUT => 120, CURLOPT_TIMEOUT => 120, CURLOPT_MAXREDIRS => 10);
    if (!function_exists('curl_init')) {
        return WPDM_Messages::Error('<b>cURL</b> is not active or installed or not functioning properly in your server', -1);
    }
    $ch = curl_init($url);
    curl_setopt_array($ch, $options);
    $content = curl_exec($ch);
    $err = curl_errno($ch);
    $errmsg = curl_error($ch);
    $header = curl_getinfo($ch);
    curl_close($ch);
    return $content;
}
Пример #4
0
function wpdm_licnese()
{
    if (isset($_POST['task']) && $_POST['task'] == 'wdm_save_settings') {
        /*if($_POST['registerme']==1){
          $res = unserialize(remote_post('http://www.wpdownloadmanager.com/',array('action'=>'wpdm_pp_ajax_call','execute'=>'wpdm_register','domain'=>$domain,'email'=>$_POST['email'],'username'=>$_POST['username'])));                
          if($res['res']==='registered'){
              
              echo "       
                   
                      Your registration completed.<br/>
                      Please login to get your license key.<br/>
                      Login url: <a href='http://www.wpdownloadmanager.com/'>http://www.wpdownloadmanager.com/</a> <br/>
                      Username: {$_POST[username]}<br/>
                      Password: {$res[password]}
                  
                  ";
          }    
          }*/
        if (!function_exists('curl_init')) {
            WPDM_Messages::Error('<b>cURL</b> is not active or installed or not functioning properly in your server', 1);
        }
        if (is_valid_license_key()) {
            update_option('_wpdm_license_key', $_POST['_wpdm_license_key']);
            die('Congratulation! Your <b>Download Manager</b> copy registered successfully!');
        } else {
            delete_option('_wpdm_license_key');
            die('Invalid License Key!');
        }
    }
    ?>
    <div class="panel panel-default">

            <div class="panel-heading"><b>License Key&nbsp;</b></div>
            <div class="panel-body"><input type="text" placeholder="Enter License Key" class="form-control" value="<?php 
    echo get_option('_wpdm_license_key');
    ?>
"
                       name="_wpdm_license_key"/></div>

        <?php 
    if (!get_option('_wpdm_license_key')) {
        ?>
            <!--
            <tr><td colspan="2">
            <br/><br/><a target="_blank" href='http://www.wpdownloadmanager.com/?task=buynow&package=3'>Buy Now / only 19.5 usd</a>
            <br>
            <br>
            <b>Register Your `Download Manager` Copy:</b> <br>
            <br>
            <div id="regc">
            <table cellpadding="5">
            <tr><td>Username: </td><td><input style="width: 300px;" type="text" name="username" id="uname"></td></tr>
            <tr><td>Email: </td><td><input type="text" style="width: 300px;" name="email" id="email"></td></tr>
            <tr><td>Password: </td><td><input type="password" style="width: 300px;" name="password" id="password"></td></tr>
            <tr><td>Confirm Password: </td><td><input type="password" style="width: 300px;" name="cpassword" id="cpassword"></td></tr>
            <tr><td></td><td><input class="button-secondary" style="padding: 7px 10px;" type="button" name="register" value="Register" id="cpassword"></td></tr>
            </table>
            </div>

            </td></tr>
            -->
        <?php 
    }
    ?>
    </div>
<?php 
}
Пример #5
0
    function License()
    {
        if (isset($_POST['task']) && $_POST['task'] == 'wdm_save_settings') {
            if (!function_exists('curl_init')) {
                \WPDM_Messages::Error('<b>cURL</b> is not active or installed or not functioning properly in your server', 1);
            }
            if (is_valid_license_key()) {
                update_option('_wpdm_license_key', $_POST['_wpdm_license_key']);
                die('Congratulation! Your <b>Download Manager</b> copy registered successfully!');
            } else {
                delete_option('_wpdm_license_key');
                die('Invalid License Key!');
            }
        }
        ?>
        <div class="panel panel-default">

            <div class="panel-heading"><b>License Key&nbsp;</b></div>
            <div class="panel-body"><input type="text" placeholder="Enter License Key" class="form-control" value="<?php 
        echo get_option('_wpdm_license_key');
        ?>
"
                                           name="_wpdm_license_key"/></div>

        </div>
        <?php 
    }