WordPress.org

Plugin Directory

Changeset 555286


Ignore:
Timestamp:
06/09/12 12:55:59 (23 months ago)
Author:
ntm
Message:

8.8.10.14 beta 8

Location:
podpress/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • podpress/trunk/podpress.php

    r554430 r555286  
    11<?php 
    2 define('PODPRESS_VERSION', '8.8.10.14 beta 7'); 
     2define('PODPRESS_VERSION', '8.8.10.14 beta 8'); 
    33/* 
    44Info for WordPress: 
    55============================================================================== 
    66Plugin Name: podPress 
    7 Version: 8.8.10.14 beta 7 
     7Version: 8.8.10.14 beta 8 
    88Plugin URI: http://www.mightyseek.com/podpress/ 
    99Description: The podPress plugin gives you everything you need in one easy plugin to use WordPress for Podcasting. Set it up in <a href="admin.php?page=podpress/podpress_feed.php">'podPress'->Feed/iTunes Settings</a>. If this plugin works for you, send us a comment. 
     
    395395        require_once(ABSPATH.PLUGINDIR.'/podpress/podpress_premium_functions.php'); 
    396396        podPress_checkmem('premium functions included'); 
    397         add_action('wp_login', 'podpress_adddigestauth'); 
     397        #add_action('wp_login', 'podpress_adddigestauth'); 
     398        add_filter('wp_authenticate', 'podpress_adddigestauth', 10, 2); 
    398399    } 
    399400 
  • podpress/trunk/podpress_feed_functions.php

    r506455 r555286  
    949949        return podPress_getCategoryCastingFeedData('rss_image', $input); 
    950950    } 
    951 ?> 
  • podpress/trunk/podpress_premium_functions.php

    r499486 r555286  
    3636    } 
    3737 
    38     function podPress_addDigestAuth($user) { 
    39         GLOBAL $podPress, $user_pass; 
    40         //~ printphpnotices_var_dump('podPress_addDigestAuth'); 
    41         //~ printphpnotices_var_dump($user); 
    42         //~ printphpnotices_var_dump($user_pass); 
    43         if(!podPress_WPVersionCheck()) { 
    44             return; 
    45         } 
    46         $userdata = get_userdatabylogin($user); 
    47         $current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
    48         $correct_creds = md5($user . ':' . $podPress->realm . ':' . $user_pass); 
    49         if($current_creds == $correct_creds) { 
    50             return; 
    51         } 
    52         $x = update_usermeta($userdata->ID, 'premiumcast_creds', $correct_creds); 
    53         $current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
     38#   function podPress_addDigestAuth($user) { 
     39#       GLOBAL $podPress, $user_pass, $credentials; 
     40#       printphpnotices_var_dump('podPress_addDigestAuth'); 
     41#       printphpnotices_var_dump($user); 
     42#       printphpnotices_var_dump($user_pass); 
     43#       printphpnotices_var_dump($credentials['user_password']); 
     44#       if(!podPress_WPVersionCheck()) { 
     45#           return; 
     46#       } 
     47#       $userdata = get_userdatabylogin($user); 
     48#       $current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
     49#       $correct_creds = md5($user . ':' . $podPress->realm . ':' . $user_pass); 
     50#       if ($current_creds == $correct_creds) { 
     51#           return; 
     52#       } 
     53#       $x = update_usermeta($userdata->ID, 'premiumcast_creds', $correct_creds); 
     54#       $current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
     55#   } 
     56    function podPress_addDigestAuth($user, $password) { 
     57        GLOBAL $podPress; 
     58        printphpnotices_var_dump('podPress_addDigestAuth'); 
     59        if ( FALSE === empty($user) and FALSE === empty($password) ) { 
     60#           printphpnotices_var_dump('#### Log In ####'); 
     61#           printphpnotices_var_dump($user); 
     62#           printphpnotices_var_dump($podPress->realm); 
     63#           printphpnotices_var_dump($password); 
     64            if(!podPress_WPVersionCheck()) { 
     65                return; 
     66            } 
     67            $userdata = get_userdatabylogin($user); 
     68            #printphpnotices_var_dump($userdata); 
     69            $current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
     70            $correct_creds = md5($user . ':' . $podPress->realm . ':' . $password); 
     71#           printphpnotices_var_dump($current_creds); 
     72#           printphpnotices_var_dump($correct_creds); 
     73            if ($current_creds != $correct_creds) { 
     74                $result = update_usermeta($userdata->ID, 'premiumcast_creds', $correct_creds); 
     75#               printphpnotices_var_dump('update_usermeta'); 
     76#               printphpnotices_var_dump($result); 
     77            } 
     78            #$current_creds = get_usermeta($userdata->ID, 'premiumcast_creds'); 
     79#       } else { 
     80#           printphpnotices_var_dump('#### Log Out ####'); 
     81        } 
     82        return $user; 
    5483    } 
    5584 
     
    5786    function podPress_http_digest_parse($txt) 
    5887    { 
    59         //~ printphpnotices_var_dump('podPress_http_digest_parse'); 
    60         //~ printphpnotices_var_dump($txt); 
     88#       printphpnotices_var_dump('podPress_http_digest_parse'); 
     89#       printphpnotices_var_dump($txt); 
    6190        // protect against missing data 
    6291        $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1); 
     
    75104                unset($needed_parts[$name]); 
    76105                $data[$name] = $val; 
    77                 //echo $name.' = '.$val."<br/>\n"; 
    78106            } 
    79107        } 
     
    88116        $result = array(); 
    89117        list($result['username'], $result['passwd']) = explode(':', base64_decode(substr($txt, 6))); 
    90         //~ printphpnotices_var_dump('podPress_http_basic_parse'); 
    91         //~ printphpnotices_var_dump($txt); 
     118#       printphpnotices_var_dump('podPress_http_basic_parse'); 
     119#       printphpnotices_var_dump($txt); 
    92120        return $result; 
    93121    } 
     
    98126            die('Premium Content support is disabled in podPress.');             
    99127        } 
    100         header('HTTP/1.0 401 Unauthorized'); 
    101         switch (PODPRESS_PREMIUM_METHOD) { 
     128        $loginmethod = $podPress->settings['premiumMethod']; 
     129         
     130#       printphpnotices_var_dump('podPress_requestLogin'); 
     131#       printphpnotices_var_dump($loginmethod); 
     132#       printphpnotices_var_dump($_SERVER['PHP_AUTH_DIGEST']); 
     133         
     134        switch ($podPress->settings['premiumMethod']) { 
    102135            case 'Digest': 
    103                 header('WWW-Authenticate: Digest realm="'.$podPress->realm.'", qop="auth", nonce="'.uniqid(rand()).'", opaque="'.md5($podPress->realm).'", stale=false, algorithm=MD5'); 
     136                //if ( TRUE === empty($_SERVER['PHP_AUTH_DIGEST']) ) { 
     137                    status_header('401'); 
     138                    header('WWW-Authenticate: Digest realm="'.$podPress->realm.'", qop="auth", nonce="'.uniqid(rand()).'", opaque="'.md5($podPress->realm).'", stale=false, algorithm=MD5'); 
     139                    //header('HTTP/1.1 401 Unauthorized'); 
     140                    #printphpnotices_var_dump('WWW-Authenticate: Digest realm="'.$podPress->realm.'", qop="auth", nonce="'.uniqid(rand()).'", opaque="'.md5($podPress->realm).'", stale=false, algorithm=MD5'); 
     141                    die('401 Unauthorized'); 
     142                //} 
    104143                break; 
    105144            case 'Basic': 
    106145            default: 
    107                 header('WWW-Authenticate: Basic realm="'.$podPress->realm.'"'); 
     146                //if (!isset($_SERVER['PHP_AUTH_USER'])) { 
     147                    status_header('401'); 
     148                    header('WWW-Authenticate: Basic realm="'.$podPress->realm.'"'); 
     149                    die('401 Unauthorized'); 
     150                //} 
    108151                break; 
    109152        } 
    110         echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">'."\n"; 
    111         echo "<HTML>\n"; 
    112         echo "  <HEAD>\n"; 
    113         echo "    <TITLE>".__('Error', 'podpress')."</TITLE>\n"; 
    114         echo '    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">'."\n"; 
    115         echo "  </HEAD>\n"; 
    116         echo "  <BODY>\n"; 
    117         echo "  <H1>401 Unauthorized.</H1>\n"; 
    118         echo __('The contents of this feed are only available to paying subscribers.', 'podpress')."\n"; 
    119         echo "  </BODY>\n"; 
    120         die("</HTML>\n"); 
     153             
     154#       header('Date: ' . gmdate("D, d M Y H:i:s") . ' GMT'); 
     155#       header('Content-Type: application/rss+xml'); 
     156         
     157#       echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">'."\n"; 
     158#       echo "<HTML>\n"; 
     159#       echo "  <HEAD>\n"; 
     160#       echo "    <TITLE>".__('Error', 'podpress')."</TITLE>\n"; 
     161#       echo '    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">'."\n"; 
     162#       echo "  </HEAD>\n"; 
     163#       echo "  <BODY>\n"; 
     164#       echo "  <H1>401 Unauthorized.</H1>\n"; 
     165#       echo __('The contents of this feed are only available to paying subscribers.', 'podpress')."\n"; 
     166#       echo "  </BODY>\n"; 
     167#       die("</HTML>\n"); 
    121168    } 
    122169     
    123170    function podPress_reloadCurrentUser() { 
    124171        global $wp, $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; 
    125         //~ printphpnotices_var_dump('podPress_reloadCurrentUser'); 
    126         //~ printphpnotices_var_dump($user_ID); 
    127         //~ printphpnotices_var_dump(constant('PODPRESS_PREMIUMLOGIN')); 
    128         //~ printphpnotices_var_dump(constant('PODPRESS_PREMIUMID')); 
    129         //~ printphpnotices_var_dump($GLOBALS['current_user']->ID); 
     172#       printphpnotices_var_dump('podPress_reloadCurrentUser'); 
     173#       printphpnotices_var_dump($user_ID); 
     174#       printphpnotices_var_dump(defined('PODPRESS_PREMIUMLOGIN')); 
     175#       printphpnotices_var_dump(defined('PODPRESS_PREMIUMID')); 
     176#       printphpnotices_var_dump($GLOBALS['current_user']->ID); 
    130177        if(defined('PODPRESS_PREMIUMLOGIN') && $GLOBALS['current_user']->ID == 0) { 
    131178            $current_user = new WP_User(PODPRESS_PREMIUMID, PODPRESS_PREMIUMLOGIN); 
     
    149196 
    150197    function podPress_validateLogin() { 
    151         GLOBAL $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; 
     198        GLOBAL $wp_version, $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user, $podPress; 
    152199 
    153200        if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) { 
    154201            return false; 
    155202        } 
    156         //~ printphpnotices_var_dump('podPress_validateLogin'); 
    157  
    158      
     203#       printphpnotices_var_dump('podPress_validateLogin #####################################################'); 
     204 
    159205        $http_headers = getallheaders(); 
    160206        if (empty($http_headers['Authorization'])) { 
    161              
    162207            if (empty($http_headers['AUTHORIZATION'])) { 
    163208                podPress_requestLogin(); 
     209 
    164210                return false; 
    165211            } else { 
     
    167213            } 
    168214        } 
    169         switch (PODPRESS_PREMIUM_METHOD) { 
     215         
     216        switch ($podPress->settings['premiumMethod']) { 
    170217            case 'Digest': 
    171218                $data = podPress_http_digest_parse($http_headers['Authorization']); 
     
    174221                } 
    175222                $x = get_userdatabylogin($data['username']); 
     223#               printphpnotices_var_dump('$x'); 
     224#               printphpnotices_var_dump($x); 
    176225                $A1 = get_usermeta($x->ID, 'premiumcast_creds'); 
     226#               printphpnotices_var_dump('$A1'); 
     227#               printphpnotices_var_dump($x->ID); 
     228#               printphpnotices_var_dump($A1); 
     229#               printphpnotices_var_dump('podPress->realm: '.$podPress->realm); 
     230#               printphpnotices_var_dump('so soll es sein: '.md5('tim:' . $podPress->realm . ':ce7d1a.xT')); 
     231                     
    177232                $A2 = md5($_SERVER['REQUEST_METHOD'].':'.$data['uri']); 
     233#               printphpnotices_var_dump('$A2'); 
     234#               printphpnotices_var_dump($_SERVER['REQUEST_METHOD'].':'.$data['uri']); 
     235#               printphpnotices_var_dump($A2); 
     236                 
    178237                $valid_response = md5($A1.':'.$data['nonce'].':'.$data['nc'].':'.$data['cnonce'].':'.$data['qop'].':'.$A2); 
    179238 
     239#               printphpnotices_var_dump('$valid_response'); 
     240#               printphpnotices_var_dump($valid_response); 
     241#               printphpnotices_var_dump($data['response']); 
     242                 
     243#               printphpnotices_var_dump('############## $_SERVER ############'); 
     244#               printphpnotices_var_dump($_SERVER['PHP_AUTH_PW']);   
     245                             
    180246                if ($data['response'] == $valid_response) { 
    181247                    $user_login = $data['username']; 
    182                     $authresult = wp_login($user_login, md5($x->user_pass), true); 
     248                    $authresult = TRUE; 
    183249                } 
    184250                break; 
     
    187253                $authparts = podPress_http_basic_parse($http_headers['Authorization']); 
    188254                $user_login = $authparts['username']; 
    189                 $authresult = wp_login($user_login, $authparts['passwd']); 
     255                if (version_compare($wp_version ,'2.5', '<')) { 
     256                    $authresult = wp_login($user_login, $authparts['passwd']); 
     257                } else { 
     258                        $creds = array(); 
     259                        $creds['user_login'] = $user_login; 
     260                        $creds['user_password'] = $authparts['passwd']; 
     261                        $creds['remember'] = true; 
     262                        $authresult = wp_signon($creds, false); 
     263                } 
    190264                break; 
    191265        } 
    192266         
    193         //~ printphpnotices_var_dump($authparts); 
    194         //~ printphpnotices_var_dump($user_login); 
    195         //~ printphpnotices_var_dump($authresult); 
     267#       printphpnotices_var_dump($authparts); 
     268#       printphpnotices_var_dump($user_login); 
     269#       printphpnotices_var_dump($authresult); 
    196270 
    197271        $podPress_x = $GLOBALS['wp_object_cache']->cache['userlogins'][$user_login]; 
    198272         
    199         //~ printphpnotices_var_dump('podPress_x'); 
    200         //~ printphpnotices_var_dump($podPress_x); 
    201         //~ printphpnotices_var_dump(is_object($podPress_x)); 
    202         //~ printphpnotices_var_dump($GLOBALS['wp_object_cache']); 
    203         //~ printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['users'][$podPress_x]); 
    204         //~ printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities']); 
     273#       printphpnotices_var_dump('podPress_x'); 
     274#       printphpnotices_var_dump($podPress_x); 
     275#       printphpnotices_var_dump(is_object($podPress_x)); 
     276#       printphpnotices_var_dump($GLOBALS['wp_object_cache']); 
     277#       printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['users'][$podPress_x]); 
     278#       printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities']); 
     279         
     280         
     281#       printphpnotices_var_dump($podPress->settings['premiumMethod']); 
     282#       $role = get_role('premium_subscriber'); 
     283#       printphpnotices_var_dump($role); 
     284         
    205285         
    206286        if(is_object($GLOBALS['wp_object_cache']->cache['userlogins'][$user_login])) { 
     
    210290            } 
    211291        } elseif ( is_array($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]) AND is_array($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities']) ) { 
    212             //~ printphpnotices_var_dump('user_meta is object'); 
    213             //~ printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities']); 
     292#           printphpnotices_var_dump('user_meta is object'); 
     293#           printphpnotices_var_dump($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities']); 
    214294            $user_has_cap = FALSE; 
    215295            foreach ($GLOBALS['wp_object_cache']->cache['user_meta'][$podPress_x]['wp_capabilities'] as $capability_str) { 
     
    229309        } 
    230310        unset($podPress_x); 
    231  
    232         if(!$authresult) { 
     311         
     312#       printphpnotices_var_dump('$authresult'); 
     313#       printphpnotices_var_dump($authresult); 
     314#       printphpnotices_var_dump(isset($authresult->errors)); 
     315         
     316        if(FALSE === $authresult OR TRUE === isset($authresult->errors)) { 
     317#           printphpnotices_var_dump('Password ist nicht richtig - erneutes Login'); 
    233318            podPress_requestLogin(); 
    234             return false; 
     319            die('401 Unauthorized'); 
     320            //~ return false; 
    235321            //~ $current_user = new WP_User(0); 
    236322            //~ return false; 
    237         } 
    238  
     323#       } else { 
     324#           printphpnotices_var_dump('Password ist richtig - RSS Feed freigegeben'); 
     325        } 
     326         
    239327        $userdata    = get_userdatabylogin($user_login); 
    240328        $user_level  = $userdata->user_level; 
  • podpress/trunk/readme.txt

    r555092 r555286  
    3939Thank you to all who have reported bugs and have made improvement proposals. Special thanks to [Ray (raymer)](http://wordpress.org/support/profile/68146) who did extensive tests with the development versions since v8.8.5 and helped a lot!  
    4040 
    41 This plugin is currently maintained by [Tim Berger (ntm)](http://profiles.wordpress.org/ntm/).<br />Latest news and announcements regarding podPress on Twitter: [podpress2010](http://twitter.com/podPress2010)<br /> 
     41This plugin is currently maintained by [Tim Berger (ntm)](http://profiles.wordpress.org/ntm/).<br />Latest news and announcements regarding podPress on Twitter: [podpress2010](http://twitter.com/podPress2010) 
    4242 
    4343If somebody else is also interested in maintaining podPress while the main developers are out, please send an email to admin [at] laptoptips.ca. 
     
    5555* new: It is now possible to alter the default size for the video and enhanced audio player (preview). You may change it on the Player Settings page. 
    5656* beta 6: change of the last character of the Podtrac URL 
     57* beta 7: bug fix for a problem with the appearance of attached episodes in the podPress post editor box 
     58* beta 8: bug fixes for problems with the Premium Feed authentication method Digest 
    5759 
    5860= v8.8.10.13 = 
Note: See TracChangeset for help on using the changeset viewer.