[support] druapl issue?

tom lee freemail168 at gmail.com
Sun Jul 13 14:12:17 UTC 2008


On Sat, Jul 12, 2008 at 10:37 PM, Cog Rusty <cog.rusty at gmail.com> wrote:

> Hmm... If you find where the
> file_get_contents(http://abc.mywebsite.com/?prt=test) statement. is,
> try to replace it with the URL of a real file to see what happens.

Here is the function call containing file_get_conents:
any suggestions about how to replace them with a URL?

function drupal_build_css_cache($types, $filename) {
  $data = '';

  // Create the css/ within the files folder.
  $csspath = file_create_path('css');
  file_check_directory($csspath, FILE_CREATE_DIRECTORY);

  if (!file_exists($csspath .'/'. $filename)) {
    // Build aggregate CSS file.
    foreach ($types as $type) {
      foreach ($type as $file => $cache) {
        if ($cache) {
          $contents = file_get_contents($file);
          // Remove multiple charset declarations for standards
compliance (and fixing Safari problems)
          $contents =
preg_replace('/^@charset\s+[\'"](\S*)\b[\'"];/i', '', $contents);
          // Return the path to where this CSS file originated from,
stripping off the name of the file at the end of the path.
          $path = base_path() . substr($file, 0, strrpos($file, '/')) .'/';
          // Wraps all @import arguments in url().
          $contents =
preg_replace('/@import\s+(?!url)[\'"]?(\S*)\b[\'"]?/i', '@import
url("\1")', $contents);
          // Fix all paths within this CSS file, ignoring absolute paths.
          $data .= preg_replace('/url\(([\'"]?)(?![a-z]+:)/i',
'url(\1'. $path . '\2', $contents);
        }
      }
    }

    // @import rules must proceed any other style, so we move those to the top.
    $regexp = '/@import[^;]+;/i';
    preg_match_all($regexp, $data, $matches);
    $data = preg_replace($regexp, '', $data);
    $data = implode('', $matches[0]) . $data;

    // Perform some safe CSS optimizations.
    $data = preg_replace('<
      \s*([@{}:;,]|\)\s|\s\()\s* |  # Remove whitespace around
separators, but keep space around parentheses.
      /\*([^*\\\\]|\*(?!/))+\*/ |   # Remove comments that are not CSS hacks.
      [\n\r]                        # Remove line breaks.
      >x', '\1', $data);

    // Create the CSS file.
    file_save_data($data, $csspath .'/'. $filename, FILE_EXISTS_REPLACE);
  }
  return $csspath .'/'. $filename;
}

there is another file containing:
  $data = file_get_contents('php://input');

I think it is not related to this problem.

Thanks.

tom


More information about the support mailing list