Permalink
Browse files

Implement function to get htsrv url depending on collection base url

  • Loading branch information...
1 parent 81d3f10 commit 91fa69e8561a346a9a6e5138c73de849c32e7aa2 @yurabakhtin yurabakhtin committed Jul 19, 2016
Showing with 399 additions and 353 deletions.
  1. +1 −1 cron/cron_exec.php
  2. +3 −3 htsrv/anon_async.php
  3. +1 −1 htsrv/anon_unsubscribe.php
  4. +3 −3 htsrv/login.php
  5. +30 −28 inc/_core/_misc.funcs.php
  6. +12 −12 inc/_core/_template.funcs.php
  7. +1 −1 inc/antispam/views/_antispam_ipranges.view.php
  8. +1 −1 inc/chapters/views/_chapter_list.view.php
  9. +2 −2 inc/collections/_collections.init.php
  10. +73 −0 inc/collections/model/_blog.class.php
  11. +1 −1 inc/collections/model/_blog.funcs.php
  12. +2 −2 inc/collections/views/_coll_group_perm.form.php
  13. +2 −2 inc/collections/views/_coll_user_perm.form.php
  14. +8 −8 inc/comments/model/_comment_js.funcs.php
  15. +1 −1 inc/cron/jobs/_activate_account_reminder.job.php
  16. +1 −1 inc/cron/jobs/_unread_message_reminder.job.php
  17. +6 −7 inc/files/model/_file.class.php
  18. +3 −3 inc/files/model/_file.funcs.php
  19. +1 −1 inc/items/items.ctrl.php
  20. +2 −4 inc/items/model/_item.class.php
  21. +2 −2 inc/items/model/_item.funcs.php
  22. +5 −6 inc/items/views/_item_list_full.view.php
  23. +3 −3 inc/items/views/_item_list_track.view.php
  24. +1 −1 inc/links/model/_link.class.php
  25. +6 −8 inc/links/model/_link.funcs.php
  26. +3 −3 inc/messaging/_messaging.init.php
  27. +4 −4 inc/messaging/model/_messaging.funcs.php
  28. +1 −1 inc/messaging/views/_contact_list.view.php
  29. +2 −3 inc/plugins/_plugin.class.php
  30. +1 −2 inc/plugins/_plugin.funcs.php
  31. +3 −3 inc/regional/model/_regional.funcs.php
  32. +2 −2 inc/regional/views/_city.form.php
  33. +2 −2 inc/regional/views/_city_list.view.php
  34. +1 −1 inc/regional/views/_country_list.view.php
  35. +1 −1 inc/regional/views/_subregion.form.php
  36. +1 −1 inc/regional/views/_subregion_list.view.php
  37. +2 −2 inc/sessions/views/_stats_refdomains.view.php
  38. +2 −4 inc/skins/_skin.funcs.php
  39. +1 −1 inc/tools/views/_email_address.view.php
  40. +1 −1 inc/tools/views/_wpxml_file.form.php
  41. +4 −4 inc/users/model/_user.class.php
  42. +29 −31 inc/users/model/_user.funcs.php
  43. +2 −2 inc/users/model/_user_js.funcs.php
  44. +1 −1 inc/users/views/_group.view.php
  45. +1 −1 inc/users/views/_invitation.view.php
  46. +4 −4 inc/users/views/_user_avatar.form.php
  47. +6 −6 inc/users/views/_user_identity.form.php
  48. +1 −1 inc/users/views/_user_report.form.php
  49. +6 −6 inc/widgets/widgets/_coll_subscription.widget.php
  50. +1 −1 inc/widgets/widgets/_poll.widget.php
  51. +1 −1 inc/widgets/widgets/_user_register.widget.php
  52. +2 −2 skins/basic/_item_comment_form.inc.php
  53. +1 −1 skins/pureforums/_edit_comment.disp.php
  54. +2 −2 skins/pureforums/_item_comment_form.inc.php
  55. +2 −2 skins/touch/_html_header.inc.php
  56. +2 −2 skins/touch/_item_comment_form.inc.php
  57. +3 −3 skins/touch/_item_feedback.inc.php
  58. +1 −2 skins_adm/_access_denied.main.php
  59. +3 −4 skins_adm/_adminUI_general.class.php
  60. +2 −2 skins_adm/_html_header.inc.php
  61. +2 −2 skins_adm/bootstrap/_html_header.inc.php
  62. +1 −1 skins_adm/login/_login_form.main.php
  63. +1 −1 skins_adm/login/_reset_pwd_form.main.php
  64. +1 −1 skins_email/_email_footer.inc.html.php
  65. +4 −4 skins_email/account_activate.html.php
  66. +4 −4 skins_email/account_activate.txt.php
  67. +2 −2 skins_email/account_activated.html.php
  68. +2 −2 skins_email/account_activated.txt.php
  69. +2 −2 skins_email/account_changed.html.php
  70. +2 −2 skins_email/account_changed.txt.php
  71. +2 −2 skins_email/account_closed.html.php
  72. +2 −2 skins_email/account_closed.txt.php
  73. +2 −2 skins_email/account_new.html.php
  74. +2 −2 skins_email/account_new.txt.php
  75. +2 −2 skins_email/account_password_reset.html.php
  76. +2 −2 skins_email/account_password_reset.txt.php
  77. +2 −2 skins_email/account_reported.html.php
  78. +2 −2 skins_email/account_reported.txt.php
  79. +7 −7 skins_email/comment_new.html.php
  80. +7 −7 skins_email/comment_new.txt.php
  81. +2 −2 skins_email/comments_unmoderated_reminder.html.php
  82. +2 −2 skins_email/comments_unmoderated_reminder.txt.php
  83. +3 −3 skins_email/contact_message_new.html.php
  84. +2 −3 skins_email/contact_message_new.txt.php
  85. +1 −3 skins_email/newsletter.html.php
  86. +1 −3 skins_email/newsletter.txt.php
  87. +3 −3 skins_email/post_new.html.php
  88. +3 −3 skins_email/post_new.txt.php
  89. +2 −2 skins_email/posts_unmoderated_reminder.html.php
  90. +2 −2 skins_email/posts_unmoderated_reminder.txt.php
  91. +2 −2 skins_email/private_message_new.html.php
  92. +2 −2 skins_email/private_message_new.txt.php
  93. +1 −3 skins_email/private_messages_unread_reminder.html.php
  94. +1 −3 skins_email/private_messages_unread_reminder.txt.php
  95. +2 −2 skins_email/scheduled_task_error_report.html.php
  96. +2 −2 skins_email/scheduled_task_error_report.txt.php
  97. +2 −2 skins_fallback_v5/_activateinfo.disp.php
  98. +2 −2 skins_fallback_v5/_closeaccount.disp.php
  99. +2 −2 skins_fallback_v5/_contact_msg.form.php
  100. +1 −1 skins_fallback_v5/_edit_comment.disp.php
  101. +2 −2 skins_fallback_v5/_html_header.inc.php
  102. +2 −2 skins_fallback_v5/_item_comment_form.inc.php
  103. +3 −3 skins_fallback_v5/_item_feedback.inc.php
  104. +2 −2 skins_fallback_v5/_login.disp.php
  105. +1 −1 skins_fallback_v5/_lostpassword.disp.php
  106. +1 −1 skins_fallback_v5/_messages.disp.php
  107. +1 −1 skins_fallback_v5/_profile.disp.php
  108. +2 −5 skins_fallback_v5/_register.disp.php
  109. +1 −1 skins_fallback_v5/_terms.disp.php
  110. +1 −1 skins_fallback_v5/_threads.disp.php
  111. +1 −1 skins_fallback_v5/_user.disp.php
  112. +2 −2 skins_fallback_v6/_activateinfo.disp.php
  113. +2 −2 skins_fallback_v6/_contact_msg.form.php
  114. +1 −1 skins_fallback_v6/_edit_comment.disp.php
  115. +2 −2 skins_fallback_v6/_item_comment_form.inc.php
  116. +3 −3 skins_fallback_v6/_item_feedback.inc.php
  117. +1 −1 skins_fallback_v6/_item_workflow.inc.php
  118. +2 −2 skins_fallback_v6/_login.disp.php
  119. +1 −1 skins_fallback_v6/_lostpassword.disp.php
  120. +1 −1 skins_fallback_v6/_messages.disp.php
  121. +1 −1 skins_fallback_v6/_profile.disp.php
  122. +2 −5 skins_fallback_v6/_register.disp.php
  123. +1 −1 skins_fallback_v6/_terms.disp.php
  124. +1 −1 skins_fallback_v6/_threads.disp.php
  125. +1 −1 skins_fallback_v6/_user.disp.php
View
@@ -48,7 +48,7 @@
global $baseurl;
$ReqHost = $baseurl;
}
- $secure_htsrv_url = get_secure_htsrv_url();
+ $secure_htsrv_url = get_htsrv_url( true );
}
// Load required functions ( we need to load here, because in CLI mode it is not loaded )
@@ -1171,7 +1171,7 @@
$Skin = & $SkinCache->get_by_ID( $skin_ID );
$display_mode = 'js';
- $form_action = get_secure_htsrv_url().'profile_update.php';
+ $form_action = get_htsrv_url().'profile_update.php';
$window_width = param( 'window_width', 'integer' );
$window_height = param( 'window_height', 'integer' );
@@ -1213,7 +1213,7 @@
}
$display_mode = 'js';
- $form_action = get_secure_htsrv_url().'profile_update.php';
+ $form_action = get_htsrv_url().'profile_update.php';
require $inc_path.'users/views/_user_report.form.php';
break;
@@ -1254,7 +1254,7 @@
}
$display_mode = 'js';
- $form_action = get_secure_htsrv_url().'profile_update.php';
+ $form_action = get_htsrv_url().'profile_update.php';
require $inc_path.'users/views/_user_groups.form.php';
break;
@@ -53,7 +53,7 @@
$message = sprintf( T_("We have received a request that you do not want to receive emails through\na message form on your comments anymore.\n\nTo confirm that this request is from you, please click on the following link:") )
."\n\n"
- .$samedomain_htsrv_url.'anon_unsubscribe.php?type=comment&anon_email='.$anon_email.'&req_ID='.$req_ID
+ .get_htsrv_url().'anon_unsubscribe.php?type=comment&anon_email='.$anon_email.'&req_ID='.$req_ID
."\n\n"
.T_('Please note:')
.' '.T_('For security reasons the link is only valid for your current session (by means of your session cookie).')
View
@@ -574,7 +574,7 @@
if( strlen( $redirect_to ) )
{ // Make it relative to the form's target, in case it has been set absolute (and can be made relative).
- $redirect_to = url_rel_to_same_host( $redirect_to, $secure_htsrv_url );
+ $redirect_to = url_rel_to_same_host( $redirect_to, get_htsrv_url( true ) );
}
if( preg_match( '#/login.php([&?].*)?$#', $redirect_to ) )
{ // avoid "endless loops"
@@ -586,7 +586,7 @@
if( strlen( $return_to ) )
{ // Make it relative to the form's target, in case it has been set absolute (and can be made relative).
- $return_to = url_rel_to_same_host( $return_to, $secure_htsrv_url );
+ $return_to = url_rel_to_same_host( $return_to, get_htsrv_url( true ) );
}
if( preg_match( '#/login.php([&?].*)?$#', $return_to ) )
{ // avoid "endless loops"
@@ -650,7 +650,7 @@
case 'lostpassword':
// Lost password:
$page_title = T_('Lost your password?');
- $hidden_params = array( 'redirect_to' => url_rel_to_same_host( $redirect_to, $secure_htsrv_url ) );
+ $hidden_params = array( 'redirect_to' => url_rel_to_same_host( $redirect_to, get_htsrv_url( true ) ) );
$wrap_width = '480px';
// Use the links in the form title
@@ -6260,9 +6260,35 @@ function get_ReqURI()
/**
+ * Get URL to htsrv folder depending on current collection base url from front-office or site base url from back-office
+ *
+ * Note: For back-office or no collection page _init_hit.inc.php should be called before this call, because ReqHost and ReqPath must be initialized
+ *
+ * @param boolean TRUE to use https URL
+ * @return string URL to htsrv folder
+ */
+function get_htsrv_url( $force_https = false )
+{
+ global $Blog;
+
+ if( is_admin_page() || empty( $Blog ) )
+ { // For back-office or when no collection page:
+ return get_samedomain_htsrv_url( $force_https );
+ }
+ else
+ { // For current collection:
+ return $Blog->get_htsrv_url( $force_https );
+ }
+}
+
+
+/**
* Get htsrv url on the same domain as the http request came from
*
* Note: _init_hit.inc.php should be called before this call, because ReqHost and ReqPath must be initialized
+ *
+ * @param boolean TRUE to use https URL
+ * @return string URL to htsrv folder
*/
function get_samedomain_htsrv_url( $secure = false )
{
@@ -6280,44 +6306,20 @@ function get_samedomain_htsrv_url( $secure = false )
// Cut htsrv folder from end of the URL:
$req_htsrv_url = substr( $req_htsrv_url, 0, strlen( $req_htsrv_url ) - strlen( $htsrv_subdir ) );
- if( is_admin_page() || empty( $Blog ) )
- { // Get current host and path for back-office or when no collection page:
- global $ReqHost, $ReqPath;
- $current_path = $ReqHost.$ReqPath;
- $current_host = $ReqHost;
- }
- else
- { // Get host and path depending on current collection settings:
- $current_path = $Blog->get_basepath_url();
- $current_host = $Blog->get_basepath_url();
- }
-
- if( strpos( $current_path, $req_htsrv_url ) !== false )
+ if( strpos( $ReqHost.$ReqPath, $req_htsrv_url ) !== false )
{ // If current request path contains the required htsrv URL:
return $req_htsrv_url.$htsrv_subdir;
}
- $req_url_parts = @parse_url( $current_host );
+ $req_url_parts = @parse_url( $ReqHost );
$hsrv_url_parts = @parse_url( $req_htsrv_url );
if( ( !isset( $req_url_parts['host'] ) ) || ( !isset( $hsrv_url_parts['host'] ) ) )
{
debug_die( 'Invalid hosts!' );
}
- if( is_admin_page() || empty( $Blog ) )
- { // If no collection then replace only domain:
- $req_domain = $req_url_parts['host'];
- $htsrv_domain = $hsrv_url_parts['host'];
- }
- else
- { // If request is from collection then replace domain + path:
- $req_domain = $req_url_parts['host']
- .( empty( $req_url_parts['port'] ) ? '' : ':'.$req_url_parts['port'] )
- .( empty( $req_url_parts['path'] ) ? '' : $req_url_parts['path'] );
- $htsrv_domain = $hsrv_url_parts['host']
- .( empty( $hsrv_url_parts['port'] ) ? '' : ':'.$hsrv_url_parts['port'] )
- .( empty( $hsrv_url_parts['path'] ) ? '' : $hsrv_url_parts['path'] );
- }
+ $req_domain = $req_url_parts['host'];
+ $htsrv_domain = $hsrv_url_parts['host'];
// Replace domain + path of htsrv URL with current request:
$samedomain_htsrv_url = substr_replace( $req_htsrv_url, $req_domain, strpos( $req_htsrv_url, $htsrv_domain ), strlen( $htsrv_domain ) );
@@ -1212,7 +1212,7 @@ function require_js_helper( $helper = '', $relative_to = 'rsc_url' )
// Colorbox params to display a voting panel:
$colorbox_voting_params = '{'.$colorbox_strings_params.'
displayVoting: true,
- votingUrl: "'.get_secure_htsrv_url().'anon_async.php?action=voting&vote_type=link&b2evo_icons_type='.$b2evo_icons_type.$blog_param.'",
+ votingUrl: "'.get_htsrv_url().'anon_async.php?action=voting&vote_type=link&b2evo_icons_type='.$b2evo_icons_type.$blog_param.'",
minWidth: 305}';
// Colorbox params without voting panel:
$colorbox_no_voting_params = '{'.$colorbox_strings_params.'
@@ -1558,7 +1558,7 @@ function init_voting_comment_js( $relative_to = 'rsc_url' )
add_js_headline( '
jQuery( document ).ready( function()
{
- var comment_voting_url = "'.get_secure_htsrv_url().'anon_async.php?action=voting&vote_type=comment&b2evo_icons_type='.$b2evo_icons_type.'";
+ var comment_voting_url = "'.get_htsrv_url().'anon_async.php?action=voting&vote_type=comment&b2evo_icons_type='.$b2evo_icons_type.'";
jQuery( "span[id^=vote_helpful_]" ).each( function()
{
init_voting_bar( jQuery( this ), comment_voting_url, jQuery( this ).find( "#votingID" ).val(), false );
@@ -2207,7 +2207,7 @@ function display_ajax_form( $params )
function get_form_<?php echo $ajax_form_number; ?>()
{
jQuery.ajax({
- url: '<?php echo get_samedomain_htsrv_url(); ?>anon_async.php',
+ url: '<?php echo get_htsrv_url(); ?>anon_async.php',
type: 'POST',
data: <?php echo $json_params; ?>,
success: function(result)
@@ -2261,7 +2261,7 @@ function check_and_show_<?php echo $ajax_form_number; ?>()
function display_login_form( $params )
{
global $Settings, $Plugins, $Session, $Blog, $blog, $dummy_fields;
- global $secure_htsrv_url, $admin_url, $baseurl, $ReqHost, $redirect_to;
+ global $admin_url, $baseurl, $ReqHost, $redirect_to;
$params = array_merge( array(
'form_before' => '',
@@ -2510,7 +2510,7 @@ function processSubmit(e) {
jQuery.ajax({
type: 'POST',
- url: '<?php echo get_samedomain_htsrv_url(); ?>anon_async.php',
+ url: '<?php echo get_htsrv_url(); ?>anon_async.php',
data: {
'<?php echo $dummy_fields[ 'login' ]; ?>': username,
'action': 'get_user_salt',
@@ -2581,12 +2581,12 @@ function processSubmit(e) {
*/
function display_lostpassword_form( $login, $hidden_params, $params = array() )
{
- global $secure_htsrv_url, $dummy_fields, $redirect_to, $Session;
+ global $dummy_fields, $redirect_to, $Session;
$params = array_merge( array(
'form_before' => '',
'form_after' => '',
- 'form_action' => $secure_htsrv_url.'login.php',
+ 'form_action' => get_htsrv_url( true ).'login.php',
'form_name' => 'lostpass_form',
'form_class' => 'fform',
'form_template' => NULL,
@@ -2685,7 +2685,7 @@ function display_lostpassword_form( $login, $hidden_params, $params = array() )
function display_activateinfo( $params )
{
global $current_User, $Settings, $UserSettings, $Plugins;
- global $secure_htsrv_url, $rsc_path, $rsc_url, $dummy_fields;
+ global $rsc_path, $rsc_url, $dummy_fields;
if( !is_logged_in() )
{ // if this happens, it means the code is not correct somewhere before this
@@ -2696,7 +2696,7 @@ function display_activateinfo( $params )
'use_form_wrapper' => true,
'form_before' => '',
'form_after' => '',
- 'form_action' => $secure_htsrv_url.'login.php',
+ 'form_action' => get_htsrv_url( true ).'login.php',
'form_name' => 'form_validatemail',
'form_class' => 'fform',
'form_layout' => 'fieldset',
@@ -2825,7 +2825,7 @@ function display_activateinfo( $params )
echo $params['use_form_wrapper'] ? $params['form_before'] : '';
- $Form = new Form( $secure_htsrv_url.'login.php', 'form_validatemail', 'post', 'fieldset' );
+ $Form = new Form( get_htsrv_url( true ).'login.php', 'form_validatemail', 'post', 'fieldset' );
if( ! empty( $params['form_template'] ) )
{ // Switch layout to template from array
@@ -2836,7 +2836,7 @@ function display_activateinfo( $params )
$Form->add_crumb( 'validateform' );
$Form->hidden( 'action', 'validatemail' );
- $Form->hidden( 'redirect_to', url_rel_to_same_host( $redirect_to, $secure_htsrv_url ) );
+ $Form->hidden( 'redirect_to', url_rel_to_same_host( $redirect_to, get_htsrv_url( true ) ) );
$Form->hidden( 'reqID', 1 );
$Form->hidden( 'sessID', $Session->ID );
@@ -3033,7 +3033,7 @@ function display_login_validator( $params = array() )
jQuery( "#login_status" ).html( login_icon_load );
jQuery.ajax( {
type: "POST",
- url: "'.get_samedomain_htsrv_url().'anon_async.php",
+ url: "'.get_htsrv_url().'anon_async.php",
data: "action=validate_login&login=" + jQuery( this ).val(),
success: function( result )
{
@@ -164,7 +164,7 @@ function antispam_ipranges_actions( $aipr_ID, $tab_param )
// Print JS to edit status of IP range
echo_editable_column_js( array(
'column_selector' => '.iprange_status_edit',
- 'ajax_url' => get_secure_htsrv_url().'async.php?action=iprange_status_edit&'.url_crumb( 'iprange' ),
+ 'ajax_url' => get_htsrv_url().'async.php?action=iprange_status_edit&'.url_crumb( 'iprange' ),
'options' => aipr_status_titles(),
'new_field_name' => 'new_status',
'ID_value' => 'jQuery( ":first", jQuery( this ).parent() ).text()',
@@ -343,7 +343,7 @@ function cat_after_level( $level )
// Print JS to edit order of the chapters inline
echo_editable_column_js( array(
'column_selector' => '.cat_order_edit',
- 'ajax_url' => get_secure_htsrv_url().'async.php?action=cat_order_edit&blogid='.$Blog->ID.'&'.url_crumb( 'catorder' ),
+ 'ajax_url' => get_htsrv_url().'async.php?action=cat_order_edit&blogid='.$Blog->ID.'&'.url_crumb( 'catorder' ),
'new_field_name' => 'new_cat_order',
'ID_value' => 'jQuery( this ).attr( "rel" )',
'ID_name' => 'cat_ID',
@@ -1003,7 +1003,7 @@ function get_cron_jobs()
function handle_htsrv_action()
{
global $demo_mode, $current_User, $DB, $Session, $Messages;
- global $UserSettings, $samedomain_htsrv_url;
+ global $UserSettings;
if( !is_logged_in() )
{ // user must be logged in
@@ -1085,7 +1085,7 @@ function handle_htsrv_action()
}
else
{ // Display confirm unlink/delete message
- $delete_url = $samedomain_htsrv_url.'action.php?mname=collections&action=unlink&link_ID='.$edited_Link->ID.'&confirmed=1&crumb_collections_unlink='.get_crumb( 'collections_unlink' );
+ $delete_url = get_htsrv_url().'action.php?mname=collections&action=unlink&link_ID='.$edited_Link->ID.'&confirmed=1&crumb_collections_unlink='.get_crumb( 'collections_unlink' );
$ok_button = '<a href="'.$delete_url.'" class="btn btn-danger">'.T_('I am sure!').'</a>';
$cancel_button = '<a href="'.$redirect_to.'" class="btn btn-default">'.T_('CANCEL').'</a>';
if( isset( $links_count ) && $links_count == 1 )
@@ -106,6 +106,16 @@ class Blog extends DataObject
*/
var $basepath_url;
+
+ /**
+ * The htsrv URLs to the basepath of that collection.
+ *
+ * Lazy filled by get_htsrv_url()
+ *
+ * @var array: 0 - normal URL, 1 - secure URL
+ */
+ var $htsrv_urls;
+
/**
* Additional settings for the collection. lazy filled.
*
@@ -1554,6 +1564,69 @@ function get_local_htsrv_url()
/**
+ * Get URL to htsrv folder
+ *
+ * Note: For back-office or no collection page _init_hit.inc.php should be called before this call, because ReqHost and ReqPath must be initialized
+ *
+ * @param boolean TRUE to use https URL
+ * @return string URL to htsrv folder
+ */
+ function get_htsrv_url( $force_https = false )
+ {
+ $force_https = intval( $force_https );
+
+ if( ! isset( $this->htsrv_urls[ $force_https ] ) )
+ { // Initialize collection htsrv URL only first time and store in cache:
+ global $htsrv_url, $htsrv_url_sensitive, $htsrv_subdir;
+
+ if( ! is_array( $this->htsrv_urls ) )
+ {
+ $this->htsrv_urls = array();
+ }
+
+ if( $force_https )
+ { // If secure htsrv URL is required:
+ $required_htsrv_url = $htsrv_url_sensitive;
+ }
+ else
+ { // If normal htsrv URL is required:
+ $required_htsrv_url = $htsrv_url;
+ }
+
+ // Cut htsrv folder from end of the URL:
+ $required_htsrv_url = substr( $required_htsrv_url, 0, strlen( $required_htsrv_url ) - strlen( $htsrv_subdir ) );
+
+ if( strpos( $this->get_basepath_url(), $required_htsrv_url ) !== false )
+ { // If current request path contains the required htsrv URL:
+ return $required_htsrv_url.$htsrv_subdir;
+ }
+
+ $coll_url_parts = @parse_url( $this->get_basepath_url() );
+ $htsrv_url_parts = @parse_url( $required_htsrv_url );
+ if( ! isset( $coll_url_parts['host'] ) || ! isset( $htsrv_url_parts['host'] ) )
+ {
+ debug_die( 'Invalid hosts!' );
+ }
+
+ $coll_domain = $coll_url_parts['host']
+ .( empty( $coll_url_parts['port'] ) ? '' : ':'.$coll_url_parts['port'] )
+ .( empty( $coll_url_parts['path'] ) ? '' : $coll_url_parts['path'] );
+ $htsrv_domain = $htsrv_url_parts['host']
+ .( empty( $htsrv_url_parts['port'] ) ? '' : ':'.$htsrv_url_parts['port'] )
+ .( empty( $htsrv_url_parts['path'] ) ? '' : $htsrv_url_parts['path'] );
+
+ // Replace domain + path of htsrv URL with current request:
+ $this->htsrv_urls[ $force_https ] = substr_replace( $required_htsrv_url, $coll_domain, strpos( $required_htsrv_url, $htsrv_domain ), strlen( $htsrv_domain ) );
+
+ // Revert htsrv folder to end of the URL which has been cut above:
+ $this->htsrv_urls[ $force_https ] .= $htsrv_subdir;
+ }
+
+ return $this->htsrv_urls[ $force_https ];
+ }
+
+
+ /**
* Get the URL of the media folder, on the current blog's domain (which is NOT always the same as the $baseurl domain!).
*
* @param string NULL to use current media_assets_url_type setting. Use 'basic', 'relative' or 'absolute' to force.
@@ -702,7 +702,7 @@ function init_blog_widgets( $blog_id )
*/
function check_allow_disp( $disp )
{
- global $Blog, $Messages, $Settings, $current_User, $secure_htsrv_url;
+ global $Blog, $Messages, $Settings, $current_User;
if( !check_user_status( 'can_be_validated' ) )
{ // we don't have the case when user is logged in and the account is not active
Oops, something went wrong.

0 comments on commit 91fa69e

Please sign in to comment.