Community Support Forums — WordPress® ( Users Helping Users ) — 2011-12-20T09:50:24-05:00 http://www.primothemes.com/forums/feed.php?f=40&t=13074 2011-12-20T09:50:24-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=57810#p57810 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: December 20, 2011, 9:50 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 20th, 2011, 9:50 am


]]>
2011-12-07T01:03:32-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=55492#p55492 <![CDATA[s2Member v111206 / Source Code: s2member\i...]]>
s2Member v111206
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: December 7, 2011, 1:03 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — December 7th, 2011, 1:03 am


]]>
2011-11-05T19:26:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=51866#p51866 <![CDATA[s2Member v111105 / Source Code: s2member\i...]]>
s2Member v111105
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: November 5, 2011, 8:26 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — November 5th, 2011, 7:26 pm


]]>
2011-10-29T20:35:20-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=49961#p49961 <![CDATA[s2Member v111029 / Source Code: s2member\i...]]>
s2Member v111029
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: October 29, 2011, 9:35 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 29th, 2011, 8:35 pm


]]>
2011-10-17T15:39:26-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=47755#p47755 <![CDATA[s2Member v111017 / Source Code: s2member\i...]]>
s2Member v111017
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: October 17, 2011, 1:39 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 17th, 2011, 3:39 pm


]]>
2011-10-11T14:35:21-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=46156#p46156 <![CDATA[s2Member v111011 / Source Code: s2member\i...]]>
s2Member v111011
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: October 11, 2011, 12:35 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 11th, 2011, 2:35 pm


]]>
2011-10-03T15:47:45-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=44286#p44286 <![CDATA[s2Member v111003 / Source Code: s2member\i...]]>
s2Member v111003
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: October 3, 2011, 1:47 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:47 pm


]]>
2011-10-03T03:41:18-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=42993#p42993 <![CDATA[s2Member v111002 / Source Code: s2member\i...]]>
s2Member v111002
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: October 3, 2011, 1:41 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — October 3rd, 2011, 3:41 am


]]>
2011-09-27T05:26:34-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=41239#p41239 <![CDATA[s2Member v110927 / Source Code: s2member\i...]]>
s2Member v110927
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: September 27, 2011, 3:26 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 27th, 2011, 5:26 am


]]>
2011-09-26T21:03:22-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=39995#p39995 <![CDATA[s2Member v110926 / Source Code: s2member\i...]]>
s2Member v110926
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: September 26, 2011, 7:03 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 26th, 2011, 9:03 pm


]]>
2011-09-17T16:20:44-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=38137#p38137 <![CDATA[s2Member v110915 / Source Code: s2member\i...]]>
s2Member v110915
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: September 17, 2011, 2:20 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 17th, 2011, 4:20 pm


]]>
2011-09-14T01:27:58-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=36718#p36718 <![CDATA[s2Member v110913 / Source Code: s2member\i...]]>
s2Member v110913
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: September 13, 2011, 11:28 pm

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 14th, 2011, 1:27 am


]]>
2011-09-13T12:03:03-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=35446#p35446 <![CDATA[s2Member v110912 / Source Code: s2member\i...]]>
s2Member v110912
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: September 13, 2011, 10:03 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — September 13th, 2011, 12:03 pm


]]>
2011-08-15T15:14:05-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=31567#p31567 <![CDATA[s2Member v110815 / Source Code: s2member\i...]]>
s2Member v110815
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: August 15, 2011, 4:14 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\sp-access.inc.php ?php /** * Specific Post/Page Access routines. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\SP_Access * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_sp_access" ) ) { /** * Specific Post/Page Access routines. * * @package s2Member\SP_Access * @since 3.5 */ class c_ws_plugin__s2member_sp_access { /** * Generates Specific Post/Page Access links. * * @package s2Member\SP_Access * @since 3.5 * * @param str $sp_ids Comma-delimited list of Specific Post/Page IDs *( numerical )*. * @param int $hours Optional. An expiration time for this link, in hours. Defaults to `72`. * @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API. * @return str|bool A Specific Post/Page Access Link, or false on failure. */ public static function sp_access_link_gen ( $sp_ids = FALSE , $hours = 72 , $shrink = TRUE ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_sp_access_link_gen" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $sp_ids = preg_replace ( "/[^0-9;,]/" , "" , $sp_ids ) ) && ( $leading_id = preg_replace ( "/^([0-9]+)(.*?)$/" , "$1" , $sp_ids ) ) && $hours ) { $sp_access = c_ws_plugin__s2member_utils_encryption:: encrypt ( "sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ( "now" ) . ":.:|:.:" . $hours ) ; $sp_access_link = add_query_arg ( "s2member_sp_access" , urlencode ( $sp_access ) , get_permalink ( $leading_id ) ) ; /**/ if ( $shrink && ( $_alternative = apply_filters ( "ws_plugin__s2member_sp_access_link_gen_alternative" , $sp_access_link , get_defined_vars ( ) ) ) && strlen ( $_alternative ) strlen ( $sp_access_link ) ) return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $_alternative , get_defined_vars ( ) ) ; /**/ else if ( $shrink && ( $tinyurl = c_ws_plugin__s2member_utils_urls:: remote ( "http://tinyurl.com/api-create.php?url=" . rawurlencode ( $sp_access_link ) ) ) ) return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $tinyurl . "#" . $_SERVER [ "HTTP_HOST" ] , get_defined_vars ( ) ) ; /**/ else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */ return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $sp_access_link , get_defined_vars ( ) ) ; } /**/ return false ; } /** * Generates Specific Post/Page Access links via AJAX. * * @package s2Member\SP_Access * @since 3.5 * * @attaches-to: ``add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax");`` * * @return null Exits script execution after returning data for AJAX caller. */ public static function sp_access_link_via_ajax ( ) { do_action ( "ws_plugin__s2member_before_sp_access_link_via_ajax" , get_defined_vars ( ) ) ; /**/ if ( current_user_can ( "create_users" ) ) /* Check priveledges as well. */ if ( ! empty ( $_POST [ "ws_plugin__s2member_sp_access_link_via_ajax" ] ) && ( $nonce = $_POST [ "ws_plugin__s2member_sp_access_link_via_ajax" ] ) && wp_verify_nonce ( $nonce , "ws-plugin--s2member-sp-access-link-via-ajax" ) && ( $_p = c_ws_plugin__s2member_utils_strings:: trim_deep ( stripslashes_deep ( $_POST ) ) ) && isset ( $_p [ "s2member_sp_access_link_ids" ] , $_p [ "s2member_sp_access_link_hours" ] ) ) echo apply_filters ( "ws_plugin__s2member_sp_access_link_via_ajax" , c_ws_plugin__s2member_sp_access:: sp_access_link_gen ( $_p [ "s2member_sp_access_link_ids" ] , $_p [ "s2member_sp_access_link_hours" ] ) , get_defined_vars ( ) ) ; /**/ exit ( ) ; /* Clean exit. */ } /** * Handles Specific Post/Page Access authentication. * * @package s2Member\SP_Access * @since 3.5 * * @param int|str $sp_id Numeric Post/Page ID in WordPress®. * @param bool $read_only Optional. Defaults to false. If ``$read_only = true``, * no session cookies are set, no IP Restrictions are checked, and script execution is not exited on Link failure. * In other words, with ``$read_only = true``, this function will simply return true or false. * @return null|bool Always returns true if access is indeed allowed in one way or another. * If access is denied with ``$read_only = true`` simply return false. * If access is denied with ``$read_only = false``, return false; * but if a Specific Post/Page Access Link is currently being used, * we exit with a warning about Access Link expiration instead. */ public static function sp_access ( $sp_id = FALSE , $read_only = FALSE ) { do_action ( "ws_plugin__s2member_before_sp_access" , get_defined_vars ( ) ) ; /**/ $excluded = apply_filters ( "ws_plugin__s2member_sp_access_excluded" , false , get_defined_vars ( ) ) ; /**/ if ( $excluded || current_user_can ( apply_filters ( "ws_plugin__s2member_sp_access_excluded_cap" , "edit_posts" , get_defined_vars ( ) ) ) ) return apply_filters ( "ws_plugin__s2member_sp_access" , true , get_defined_vars ( ) ) ; /**/ else if ( $sp_id && ( ( ! empty ( $_GET [ "s2member_sp_access" ] ) && is_array ( $sp_access_values = ( array ) trim ( stripslashes ( $_GET [ "s2member_sp_access" ] ) ) ) ) || ( is_array ( $sp_access_values = c_ws_plugin__s2member_sp_access:: sp_access_session ( ) ) && ! empty ( $sp_access_values ) ) ) ) { foreach ( $sp_access_values as $sp_access_value ) /* Supports multiple access values in a session. */ { if ( is_array ( $sp_access = preg_split ( "/\:\.\:\|\:\.\:/" , c_ws_plugin__s2member_utils_encryption:: decrypt ( $sp_access_value ) ) ) ) { if ( count ( $sp_access ) === 4 && $sp_access [ 0 ] === "sp_time_hours" && in_array ( $sp_id , preg_split ( "/[\r \n \t\s;,]+/" , $sp_access [ 1 ] ) ) ) { if ( $sp_access [ 2 ] = strtotime ( "now" ) && ( $sp_access [ 2 ] + ( $sp_access [ 3 ] * 3600 ) ) = strtotime ( "now" ) ) { if ( ! $read_only && ! empty ( $_GET [ "s2member_sp_access" ] ) ) /* Cookie session. */ c_ws_plugin__s2member_sp_access:: sp_access_session ( $_GET [ "s2member_sp_access" ] ) ; /**/ if ( $read_only || c_ws_plugin__s2member_ip_restrictions:: ip_restrictions_ok ( $_SERVER [ "REMOTE_ADDR" ] , $sp_access_value ) ) return apply_filters ( "ws_plugin__s2member_sp_access" , true , get_defined_vars ( ) ) ; } } } } /**/ if ( ! $read_only && ! empty ( $_GET [ "s2member_sp_access" ] ) ) /* If this is a Specific Post/Page Link? */ { echo 'strongYour Link Expired:/strongbr /Please contact Support if you need assistance.' ; /**/ exit ( ) ; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */ } /**/ return apply_filters ( "ws_plugin__s2member_sp_access" , false , get_defined_vars ( ) ) ; } /**/ else return apply_filters ( "ws_plugin__s2member_sp_access" , false , get_defined_vars ( ) ) ; } /** * Handles Specific Post/Page sessions, by writing access values into a cookie. * * Can be used to add a new value to the session, and/or to return the current set of values in the session. * * @package s2Member\SP_Access * @since 3.5 * * @param str $add_sp_access_value Encrypted Specific Post/Page Access value. * @return array Array of Specific Post/Page Access values. */ public static function sp_access_session ( $add_sp_access_value = FALSE ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_sp_access_session" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $sp_access_values = ( ! empty ( $_COOKIE [ "s2member_sp_access" ] ) ) ? preg_split ( "/\:\.\:\|\:\.\:/" , $_COOKIE [ "s2member_sp_access" ] ) : array ( ) ; /**/ if ( $add_sp_access_value && ! in_array ( $add_sp_access_value , $sp_access_values ) ) /* If it's not in the session already. */ { $sp_access_values [ ] = $add_sp_access_value ; /* Add an access value, and update the delimited session cookie. */ $sp_access_values = array_unique ( $sp_access_values ) ; /* Keep this array unique; disallow double-stacking. */ /**/ $cookie = implode ( ":.:|:.:" , $sp_access_values ) ; /* Implode the access values into a delimited string. */ $cookie = ( strlen ( $cookie ) = 4096 ) ? $add_sp_access_value : $cookie ; /* Max cookie size is 4kbs. */ /**/ setcookie ( "s2member_sp_access" , $cookie , time ( ) + 31556926 , COOKIEPATH, COOKIE_DOMAIN) . setcookie ( "s2member_sp_access" , $cookie , time ( ) + 31556926 , SITECOOKIEPATH, COOKIE_DOMAIN) . ( $_COOKIE [ "s2member_sp_access" ] = $cookie ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_sp_access_session" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ return apply_filters ( "ws_plugin__s2member_sp_access_session" , $sp_access_values , get_defined_vars ( ) ) ; } } } ? [ full view ]s2member\includes\classes\sp-access.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — August 15th, 2011, 3:14 pm


]]>
2011-07-11T17:29:54-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=27737#p27737 <![CDATA[s2Member v110710 / Source Code: s2member\i...]]>
s2Member v110710
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: July 11, 2011, 6:29 pm

Open for public discussion.
(!-- s-words :: --)Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code jQuery(window).load(function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli'+location.hash).addClass('hilite'); }); jQuery(window).bind('hashchange', function(){ if(typeof location.hash === 'string' && location.hash.match(/^#/)) jQuery('olli').removeClass('hilite'); jQuery('olli'+location.hash).addClass('hilite'); }); [ full view ]s2member\includes\classes\sp-access.inc.php ?php /** * Specific Post/Page Access routines. * * Copyright: © 2009-2011 * {@link http://www.websharks-inc.com/ WebSharks, Inc.} * ( coded in the USA ) * * Released under the terms of the GNU General Public License. * You should have received a copy of the GNU General Public License, * along with this software. In the main directory, see: /licensing/ * If not, see: {@link http://www.gnu.org/licenses/}. * * @package s2Member\SP_Access * @since 3.5 */ if ( realpath ( __FILE__ ) === realpath ( $_SERVER [ "SCRIPT_FILENAME" ] ) ) exit ( "Do not access this file directly." ) ; /**/ if ( ! class_exists ( "c_ws_plugin__s2member_sp_access" ) ) { /** * Specific Post/Page Access routines. * * @package s2Member\SP_Access * @since 3.5 */ class c_ws_plugin__s2member_sp_access { /** * Generates Specific Post/Page Access links. * * @package s2Member\SP_Access * @since 3.5 * * @param str $sp_ids Comma-delimited list of Specific Post/Page IDs *( numerical )*. * @param int $hours Optional. An expiration time for this link, in hours. Defaults to `72`. * @param bool $shrink Optional. Defaults to true. If false, the raw link will NOT be processed by the tinyURL API. * @return str|bool A Specific Post/Page Access Link, or false on failure. */ public static function sp_access_link_gen ( $sp_ids = FALSE , $hours = 72 , $shrink = TRUE ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_sp_access_link_gen" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ if ( ( $sp_ids = preg_replace ( "/[^0-9;,]/" , "" , $sp_ids ) ) && ( $leading_id = preg_replace ( "/^([0-9]+)(.*?)$/" , "$1" , $sp_ids ) ) && $hours ) { $sp_access = c_ws_plugin__s2member_utils_encryption:: encrypt ( "sp_time_hours:.:|:.:" . $sp_ids . ":.:|:.:" . strtotime ( "now" ) . ":.:|:.:" . $hours ) ; $sp_access_link = add_query_arg ( "s2member_sp_access" , urlencode ( $sp_access ) , get_permalink ( $leading_id ) ) ; /**/ if ( $shrink && ( $_alternative = apply_filters ( "ws_plugin__s2member_sp_access_link_gen_alternative" , $sp_access_link , get_defined_vars ( ) ) ) && strlen ( $_alternative ) strlen ( $sp_access_link ) ) return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $_alternative , get_defined_vars ( ) ) ; /**/ else if ( $shrink && ( $tinyurl = c_ws_plugin__s2member_utils_urls:: remote ( "http://tinyurl.com/api-create.php?url=" . rawurlencode ( $sp_access_link ) ) ) ) return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $tinyurl . "#" . $_SERVER [ "HTTP_HOST" ] , get_defined_vars ( ) ) ; /**/ else /* Else use the long one; tinyURL will fail when/if their server is down periodically. */ return apply_filters ( "ws_plugin__s2member_sp_access_link_gen" , $sp_access_link , get_defined_vars ( ) ) ; } /**/ return false ; } /** * Generates Specific Post/Page Access links via AJAX. * * @package s2Member\SP_Access * @since 3.5 * * @attaches-to: ``add_action("wp_ajax_ws_plugin__s2member_sp_access_link_via_ajax");`` * * @return null Exits script execution after returning data for AJAX caller. */ public static function sp_access_link_via_ajax ( ) { do_action ( "ws_plugin__s2member_before_sp_access_link_via_ajax" , get_defined_vars ( ) ) ; /**/ if ( current_user_can ( "create_users" ) ) /* Check priveledges as well. */ if ( ! empty ( $_POST [ "ws_plugin__s2member_sp_access_link_via_ajax" ] ) && ( $nonce = $_POST [ "ws_plugin__s2member_sp_access_link_via_ajax" ] ) && wp_verify_nonce ( $nonce , "ws-plugin--s2member-sp-access-link-via-ajax" ) && ( $_p = c_ws_plugin__s2member_utils_strings:: trim_deep ( stripslashes_deep ( $_POST ) ) ) && isset ( $_p [ "s2member_sp_access_link_ids" ] , $_p [ "s2member_sp_access_link_hours" ] ) ) echo apply_filters ( "ws_plugin__s2member_sp_access_link_via_ajax" , c_ws_plugin__s2member_sp_access:: sp_access_link_gen ( $_p [ "s2member_sp_access_link_ids" ] , $_p [ "s2member_sp_access_link_hours" ] ) , get_defined_vars ( ) ) ; /**/ exit ( ) ; /* Clean exit. */ } /** * Handles Specific Post/Page Access authentication. * * @package s2Member\SP_Access * @since 3.5 * * @param int|str $sp_id Numeric Post/Page ID in WordPress®. * @param bool $read_only Optional. Defaults to false. If ``$read_only = true``, * no session cookies are set, no IP Restrictions are checked, and script execution is not exited on Link failure. * In other words, with ``$read_only = true``, this function will simply return true or false. * @return null|bool Always returns true if access is indeed allowed in one way or another. * If access is denied with ``$read_only = true`` simply return false. * If access is denied with ``$read_only = false``, return false; * but if a Specific Post/Page Access Link is currently being used, * we exit with a warning about Access Link expiration instead. */ public static function sp_access ( $sp_id = FALSE , $read_only = FALSE ) { do_action ( "ws_plugin__s2member_before_sp_access" , get_defined_vars ( ) ) ; /**/ $excluded = apply_filters ( "ws_plugin__s2member_sp_access_excluded" , false , get_defined_vars ( ) ) ; /**/ if ( $excluded || current_user_can ( apply_filters ( "ws_plugin__s2member_sp_access_excluded_cap" , "edit_posts" , get_defined_vars ( ) ) ) ) return apply_filters ( "ws_plugin__s2member_sp_access" , true , get_defined_vars ( ) ) ; /**/ else if ( $sp_id && ( ( ! empty ( $_GET [ "s2member_sp_access" ] ) && is_array ( $sp_access_values = ( array ) trim ( stripslashes ( $_GET [ "s2member_sp_access" ] ) ) ) ) || ( is_array ( $sp_access_values = c_ws_plugin__s2member_sp_access:: sp_access_session ( ) ) && ! empty ( $sp_access_values ) ) ) ) { foreach ( $sp_access_values as $sp_access_value ) /* Supports multiple access values in a session. */ { if ( is_array ( $sp_access = preg_split ( "/\:\.\:\|\:\.\:/" , c_ws_plugin__s2member_utils_encryption:: decrypt ( $sp_access_value ) ) ) ) { if ( count ( $sp_access ) === 4 && $sp_access [ 0 ] === "sp_time_hours" && in_array ( $sp_id , preg_split ( "/[\r \n \t\s;,]+/" , $sp_access [ 1 ] ) ) ) { if ( $sp_access [ 2 ] = strtotime ( "now" ) && ( $sp_access [ 2 ] + ( $sp_access [ 3 ] * 3600 ) ) = strtotime ( "now" ) ) { if ( ! $read_only && ! empty ( $_GET [ "s2member_sp_access" ] ) ) /* Cookie session. */ c_ws_plugin__s2member_sp_access:: sp_access_session ( $_GET [ "s2member_sp_access" ] ) ; /**/ if ( $read_only || c_ws_plugin__s2member_ip_restrictions:: ip_restrictions_ok ( $_SERVER [ "REMOTE_ADDR" ] , $sp_access_value ) ) return apply_filters ( "ws_plugin__s2member_sp_access" , true , get_defined_vars ( ) ) ; } } } } /**/ if ( ! $read_only && ! empty ( $_GET [ "s2member_sp_access" ] ) ) /* If this is a Specific Post/Page Link? */ { echo 'strongYour Link Expired:/strongbr /Please contact Support if you need assistance.' ; /**/ exit ( ) ; /* $_GET["s2member_sp_access"] has expired. Or it is simply invalid. */ } /**/ return apply_filters ( "ws_plugin__s2member_sp_access" , false , get_defined_vars ( ) ) ; } /**/ else return apply_filters ( "ws_plugin__s2member_sp_access" , false , get_defined_vars ( ) ) ; } /** * Handles Specific Post/Page sessions, by writing access values into a cookie. * * Can be used to add a new value to the session, and/or to return the current set of values in the session. * * @package s2Member\SP_Access * @since 3.5 * * @param str $add_sp_access_value Encrypted Specific Post/Page Access value. * @return array Array of Specific Post/Page Access values. */ public static function sp_access_session ( $add_sp_access_value = FALSE ) { eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_before_sp_access_session" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ /**/ $sp_access_values = ( ! empty ( $_COOKIE [ "s2member_sp_access" ] ) ) ? preg_split ( "/\:\.\:\|\:\.\:/" , $_COOKIE [ "s2member_sp_access" ] ) : array ( ) ; /**/ if ( $add_sp_access_value && ! in_array ( $add_sp_access_value , $sp_access_values ) ) /* If it's not in the session already. */ { $sp_access_values [ ] = $add_sp_access_value ; /* Add an access value, and update the delimited session cookie. */ $sp_access_values = array_unique ( $sp_access_values ) ; /* Keep this array unique; disallow double-stacking. */ /**/ $cookie = implode ( ":.:|:.:" , $sp_access_values ) ; /* Implode the access values into a delimited string. */ $cookie = ( strlen ( $cookie ) = 4096 ) ? $add_sp_access_value : $cookie ; /* Max cookie size is 4kbs. */ /**/ setcookie ( "s2member_sp_access" , $cookie , time ( ) + 31556926 , "/" ) ; /**/ eval ( 'foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;' ) ; do_action ( "ws_plugin__s2member_during_sp_access_session" , get_defined_vars ( ) ) ; unset ( $__refs , $__v ) ; /* Unset defined __refs, __v. */ } /**/ return apply_filters ( "ws_plugin__s2member_sp_access_session" , $sp_access_values , get_defined_vars ( ) ) ; } } } ? [ full view ]s2member\includes\classes\sp-access.inc.php Source Code Documentation Packages ( Overview ) Classes Deprecated Todo Index Source Code(!-- :: s-words --)

Statistics: Posted by System Robot — July 11th, 2011, 5:29 pm


]]>
2011-07-09T06:09:47-05:00 http://www.primothemes.com/forums/viewtopic.php?t=13074&p=25369#p25369 <![CDATA[s2Member v111220 / Source Code: s2member\i...]]>
s2Member v111220
Source Code: s2member\includes\classes\sp-access.inc.php
Docs updated: December 20, 2011, 9:50 am

Open for public discussion.
(!-- s-words :: --)n/a(!-- :: s-words --)

Statistics: Posted by System Robot — July 9th, 2011, 6:09 am


]]>