]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'master' into 0.9.x
authorEvan Prodromou <evan@status.net>
Sun, 10 Jan 2010 22:18:19 +0000 (14:18 -0800)
committerEvan Prodromou <evan@status.net>
Sun, 10 Jan 2010 22:18:19 +0000 (14:18 -0800)
Conflicts:
classes/Memcached_DataObject.php

1  2 
classes/File.php
lib/util.php

diff --combined classes/File.php
index 6173f31d6e5025c5d8a4c56284f3b72d83598f37,03d9ca6f09147d779f016e417cd46d84e58e040e..c527c4ffe92012a2877b434bb83becfd44fc6891
@@@ -80,7 -80,14 +80,14 @@@ class File extends Memcached_DataObjec
          if (isset($redir_data['type'])
              && (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21)))
              && ($oembed_data = File_oembed::_getOembed($given_url))) {
+             $fo = File_oembed::staticGet('file_id', $file_id);
+             if (empty($fo)) {
                  File_oembed::saveNew($oembed_data, $file_id);
+             } else {
+                 common_log(LOG_WARNING, "Strangely, a File_oembed object exists for new file $file_id", __FILE__);
+             }
          }
          return $x;
      }
  
      static function url($filename)
      {
 -        $path = common_config('attachments', 'path');
 +        if(common_config('site','private')) {
  
 -        if ($path[strlen($path)-1] != '/') {
 -            $path .= '/';
 -        }
 +            return common_local_url('getfile',
 +                                array('filename' => $filename));
  
 -        if ($path[0] != '/') {
 -            $path = '/'.$path;
 -        }
 +        } else {
 +            $path = common_config('attachments', 'path');
  
 -        $server = common_config('attachments', 'server');
 +            if ($path[strlen($path)-1] != '/') {
 +                $path .= '/';
 +            }
  
 -        if (empty($server)) {
 -            $server = common_config('site', 'server');
 -        }
 +            if ($path[0] != '/') {
 +                $path = '/'.$path;
 +            }
 +
 +            $server = common_config('attachments', 'server');
  
 -        // XXX: protocol
 +            if (empty($server)) {
 +                $server = common_config('site', 'server');
 +            }
  
 -        return 'http://'.$server.$path.$filename;
 +            // XXX: protocol
 +
 +            return 'http://'.$server.$path.$filename;
 +        }
      }
  
      function getEnclosure(){
diff --combined lib/util.php
index 50bd0e2ac938de026a3d4b5187823773136a62d0,00d1ab55749e5494e843313228fff9d2721242a2..a4281121ebd4d05d936b273630f7ea590dd1933f
@@@ -119,6 -119,11 +119,11 @@@ function common_language(
  
  function common_munge_password($password, $id)
  {
+     if (is_object($id) || is_object($password)) {
+         $e = new Exception();
+         common_log(LOG_ERR, __METHOD__ . ' object in param to common_munge_password ' .
+                    str_replace("\n", " ", $e->getTraceAsString()));
+     }
      return md5($password . $id);
  }
  
@@@ -1404,17 -1409,41 +1409,17 @@@ function common_session_token(
  
  function common_cache_key($extra)
  {
 -    $base_key = common_config('memcached', 'base');
 -
 -    if (empty($base_key)) {
 -        $base_key = common_keyize(common_config('site', 'name'));
 -    }
 -
 -    return 'statusnet:' . $base_key . ':' . $extra;
 +    return Cache::key($extra);
  }
  
  function common_keyize($str)
  {
 -    $str = strtolower($str);
 -    $str = preg_replace('/\s/', '_', $str);
 -    return $str;
 +    return Cache::keyize($str);
  }
  
  function common_memcache()
  {
 -    static $cache = null;
 -    if (!common_config('memcached', 'enabled')) {
 -        return null;
 -    } else {
 -        if (!$cache) {
 -            $cache = new Memcache();
 -            $servers = common_config('memcached', 'server');
 -            if (is_array($servers)) {
 -                foreach($servers as $server) {
 -                    $cache->addServer($server);
 -                }
 -            } else {
 -                $cache->addServer($servers);
 -            }
 -        }
 -        return $cache;
 -    }
 +    return Cache::instance();
  }
  
  function common_license_terms($uri)