Plugin Directory

Changeset 1076088


Ignore:
Timestamp:
01/26/2015 04:26:50 PM (11 years ago)
Author:
VanillaForums
Message:

Fix webroot parsing.

Location:
vanilla-forums/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vanilla-forums/trunk/functions.php

    r834602 r1076088  
    179179function vf_validate_url($url) {
    180180  $html = vf_rest($url);
    181   $wr_pos = strpos($html, 'WebRoot" value="');
    182   if ($wr_pos > 0) {
    183      $webroot = substr($html, $wr_pos + 16);
    184      $webroot = substr($webroot, 0, strpos($webroot, '"'));
    185      return $webroot;
    186   } else {
    187      return FALSE;
     181  $formats = array(
     182     '"WebRoot":"',     // 2.2
     183     '\'WebRoot\' : "', // 2.0.18.13+ and 2.1.1+
     184     'WebRoot" value="' // legacy
     185  );
     186
     187  foreach ($formats as $format) {
     188     if ($chars = strpos($html, $format)) {
     189       $offset = $chars + strlen(stripslashes($format));
     190        return vf_parse_webroot($html, $offset);
     191    }
    188192  }
     193
     194  return FALSE;
     195}
     196
     197/**
     198 * Parse URL at start of HTML.
     199 *
     200 * @param string $html
     201 * @param int $start
     202 * @return string URL.
     203 */
     204function vf_parse_webroot($html, $start) {
     205  $webroot = substr($html, $start);
     206  $webroot = substr($webroot, 0, strpos($webroot, '"'));
     207  $webroot = stripslashes($webroot);
     208  return $webroot;
    189209}
    190210
  • vanilla-forums/trunk/plugin.php

    r834602 r1076088  
    44Plugin URI: http://vanillaforums.org/addons/
    55Description: Integrates Vanilla Forums with Wordpress: embedded blog comments, embedded forum, single sign on, and Wordpress widgets.
    6 Version: 1.1.14
     6Version: 1.1.16
    77Author: Todd Burry
    88Author URI: http://www.vanillaforums.org/
     
    60601.1.15
    6161- Added the full role names to the list of roles sent on sso.
     621.1.16
     63- Fixed webroot parsing in url vaidation function
    6264
    6365Copyright 2010 Vanilla Forums Inc
Note: See TracChangeset for help on using the changeset viewer.