diff --git a/.gitmodules b/.gitmodules index b069f43..8164817 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "blog/wp-content/plugins/wp-async-google-analytics"] path = blog/wp-content/plugins/wp-async-google-analytics url = git://github.com/kennethreitz/wp-async-google-analytics.git +[submodule "blog/wp-content/plugins/wp-s3"] + path = blog/wp-content/plugins/wp-s3 + url = git://github.com/kennethreitz/wp-s3.git diff --git a/blog/wp-content/plugins/tantan-s3/lib/curl.php b/blog/wp-content/plugins/tantan-s3/lib/curl.php deleted file mode 100755 index f2e0976..0000000 --- a/blog/wp-content/plugins/tantan-s3/lib/curl.php +++ /dev/null @@ -1,204 +0,0 @@ -curl = curl_init(); - $this->postData = array(); - $this->cookies = array(); - $this->headers = array(); - if (!empty($url)) { - $this->setURL($url); - } else { - $this->setURL(false); - } - foreach ($params as $key => $value) { - $this->{'_' . $key} = $value; - } - - $this->addHeader('Connection', 'close'); - - // We don't do keep-alives by default - $this->addHeader('Connection', 'close'); - - // Basic authentication - if (!empty($this->_user)) { - $this->addHeader('Authorization', 'Basic ' . base64_encode($this->_user . ':' . $this->_pass)); - } - - // Proxy authentication (see bug #5913) - if (!empty($this->_proxy_user)) { - $this->addHeader('Proxy-Authorization', 'Basic ' . base64_encode($this->_proxy_user . ':' . $this->_proxy_pass)); - } - - } - - function addHeader($header, $value) { - $this->headers[$header] = $value; - } - - function setMethod($method) { - switch ($method) { - case 'DELETE': - curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, 'DELETE'); - break; - case HTTP_REQUEST_METHOD_PUT: - case 'PUT': - curl_setopt($this->curl, CURLOPT_PUT, true); - //CURLOPT_INFILE CURLOPT_INFILESIZE - break; - case HTTP_REQUEST_METHOD_POST: - case 'POST': - curl_setopt($this->curl, CURLOPT_POST, true); - break; - default: - case 'GET': - curl_setopt($this->curl, CURLOPT_HTTPGET, true); - break; - case 'HEAD': - curl_setopt($this->curl, CURLOPT_CUSTOMREQUEST, 'HEAD'); - break; - } - } - function setURL($url) { - $this->url = $url; - } - function addPostData($name, $value) { - $this->postData[$name] = $value; - } - function addCookie($name, $value) { - $this->cookies[$name] = array('name' => $name, 'value' => $value); - } - function sendRequest() { - $headers = array( - "Accept: *.*", - ); - - foreach ($this->headers as $k=>$h) { - $headers[] = "$k: $h"; - } - - if (count($this->cookies) > 0) { - $cookieVars = ''; - foreach ($this->cookies as $cookie) { - //$headers[] = "Cookie: ".$cookie['name'].'='.$cookie['value']; - $cookieVars .= ''.$cookie['name'].'='.$cookie['value'].'; '; - } - curl_setopt($this->curl, CURLOPT_COOKIE, $cookieVars); - //print_r($cookieVars); - } - - if (count($this->postData) > 0) { // if a POST - $postVars = ''; - foreach ($this->postData as $key=>$value) { - $postVars .= $key.'='.urlencode($value).'&'; - } - // *** TODO *** - // weird, libcurl doesnt seem to POST correctly - curl_setopt($this->curl, CURLOPT_POST, true); - curl_setopt($this->curl, CURLOPT_POSTFIELDS, $postVars); - - //curl_setopt($this->curl, CURLOPT_HTTPGET, true); - //$this->url .= '?'.$postVars; - - - } else { - curl_setopt($this->curl, CURLOPT_HTTPGET, true); - } - curl_setopt($this->curl, CURLOPT_URL, $this->url); - curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, false); - curl_setopt($this->curl, CURLOPT_HEADER, true); - curl_setopt($this->curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($this->curl, CURLOPT_SSL_VERIFYPEER, false); - $this->raw = curl_exec($this->curl); - $this->response = $this->_parseResponse($this->raw); - return true; // hmm no error checking for now - } - - function getResponseHeader($header=false) { - if ($header) { - return $this->response['header'][$header]; - } else { - return $this->response['header']; - } - } - function getResponseCookies() { - $hdrCookies = array(); - foreach ($this->response['header'] as $key => $value) { - if (strtolower($key) == 'set-cookie') { - $hdrCookies = array_merge($hdrCookies, explode("\n", $value)); - } - } - //$hdrCookies = explode("\n", $this->response['header']['Set-Cookie']); - $cookies = array(); - - foreach ($hdrCookies as $cookie) { - if ($cookie) { - list($name, $value) = explode('=', $cookie, 2); - list($value, $domain, $path, $expires) = explode(';', $value); - $cookies[$name] = array('name' => $name, 'value' => $value); - } - } - return $cookies; - } - function getResponseBody() { - return $this->response['body']; - } - function getResponseCode() { - return $this->response['code']; - } - function getResponseRaw() { - return $this->raw; - } - function clearPostData($var=false) { - if (!$var) { - $this->postData = array(); - } else { - unset($this->postData[$var]); - } - } - - function _parseResponse($this_response) { - if (substr_count($this_response, 'HTTP/1.') > 1) { // yet another weird bug. CURL seems to be appending response bodies together - $chunks = preg_split('@(HTTP/[0-9]\.[0-9] [0-9]{3}.*\n)@', $this_response, -1, PREG_SPLIT_DELIM_CAPTURE); - $this_response = array_pop($chunks); - $this_response = array_pop($chunks) . $this_response; - - } - - list($response_headers, $response_body) = explode("\r\n\r\n", $this_response, 2); - $response_header_lines = explode("\r\n", $response_headers); - - $http_response_line = array_shift($response_header_lines); - if (preg_match('@^HTTP/[0-9]\.[0-9] 100@',$http_response_line, $matches)) { - return $this->_parseResponse($response_body); - } else if(preg_match('@^HTTP/[0-9]\.[0-9] ([0-9]{3})@',$http_response_line, $matches)) { - $response_code = $matches[1]; - } - $response_header_array = array(); - foreach($response_header_lines as $header_line) { - list($header,$value) = explode(': ', $header_line, 2); - $response_header_array[$header] .= $value."\n"; - } - return array("code" => $response_code, "header" => $response_header_array, "body" => $response_body); - } -} -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/readme.txt b/blog/wp-content/plugins/tantan-s3/readme.txt deleted file mode 100755 index f343345..0000000 --- a/blog/wp-content/plugins/tantan-s3/readme.txt +++ /dev/null @@ -1,30 +0,0 @@ -=== Plugin Name === -Contributors: joetan -Tags: uploads, amazon, s3, mirror, admin, media -Requires at least: 2.3 -Tested up to: 2.7 -Stable tag: 0.3.4 - -Allows you to mirror your WordPress media uploads over to Amazon S3 for storage and delivery. - -== Description == - -This WordPress plugin allows you to use Amazon's Simple Storage Service to host your media for your WordPress powered blog. - -Amazon S3 is a cheap and cost effective way to scale your site to easily handle large spikes in traffic (such as from Digg) without having to go through the expense of setting up the infrastructure for a content delivery network. - -Once setup, this plugin transparently integrates with your WordPress blog. File uploads are automatically saved into your Amazon S3 bucket without any extra steps. Once saved, these files will be delivered by Amazon S3, instead of your web host. Any image thumbnails that get created are saved to Amazon S3 too. You'll also find an "Amazon S3" tab next to your regular "Upload" tab, which allows you to easily browse and manage files that were not upload via WordPress. - -== Installation == - -1. Upload `tantan-s3` to the `/wp-content/plugins/` directory -1. Activate the plugin through the 'Plugins' menu in WordPress -1. Configure the plugin in the 'Options' (or 'Settings') screen by following the onscreen prompts. - -## Documentation -If you need more help installing and configuring the plugin, [see here for more information](http://code.google.com/p/wordpress-s3/wiki/Documentation). - -== Screenshots == - -1. The settings screen for the plugin -2. Browse files in a Amazon S3 bucket diff --git a/blog/wp-content/plugins/tantan-s3/screenshot-1.gif b/blog/wp-content/plugins/tantan-s3/screenshot-1.gif deleted file mode 100755 index 7e491f7..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/screenshot-1.gif and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/screenshot-2.jpg b/blog/wp-content/plugins/tantan-s3/screenshot-2.jpg deleted file mode 100755 index f777f03..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/screenshot-2.jpg and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3.php deleted file mode 100755 index 7070434..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3.php +++ /dev/null @@ -1,63 +0,0 @@ -= 0) { // just load in admin - $ver = get_bloginfo('version'); - if (version_compare(phpversion(), '5.0', '>=') && version_compare($ver, '2.1', '>=')) { - require_once(dirname(__FILE__).'/wordpress-s3/class-plugin.php'); - $TanTanWordPressS3Plugin = new TanTanWordPressS3Plugin(); - } elseif (ereg('wordpress-mu-', $ver)) { - require_once(dirname(__FILE__).'/wordpress-s3/class-plugin.php'); - $TanTanWordPressS3Plugin = new TanTanWordPressS3Plugin(); - } else { - class TanTanWordPressS3Error { - function TanTanWordPressS3Error() {add_action('admin_menu', array(&$this, 'addhooks'));} - function addhooks() {add_options_page('Amazon S3', 'Amazon S3', 10, __FILE__, array(&$this, 'admin'));} - function admin(){include(dirname(__FILE__).'/wordpress-s3/admin-version-error.html');} - } - $error = new TanTanWordPressS3Error(); - } -} else { - require_once(dirname(__FILE__).'/wordpress-s3/class-plugin-public.php'); - $TanTanWordPressS3Plugin = new TanTanWordPressS3PluginPublic(); -} -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-options.html b/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-options.html deleted file mode 100755 index dc463e1..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-options.html +++ /dev/null @@ -1,217 +0,0 @@ - -

- -

- - - - - -
-

Amazon S3 Plugin for WordPress

- -
-Plugin Updates:
-Check for updates to this plugin > -
- - -

-This plugin allows you to easily upload, retrieve, and link to files stored on Amazon's S3 web service from within WordPress. - -

-

Amazon S3 Setup: If you don't have an Amazon S3 account yet, here's a quick video tutorial that'll show -you how to set one up. Sign up for Amazon S3 > -

- -

Plugin Installation and Usage: Just follow the onscreen prompts to link this plugin to your Amazon S3 account.

- - -
-If you find this plugin helpful, please consider donating a few dollars to support this plugin. Thanks! -

- -
- - - - - - - - - - - - - - -
-Amount: $
-
-
- -
- -
- -
- - -

-This plugin is provided by TanTanNoodles -and licensed free of charge for you to use under the GPL. -This plugin is unsupported and comes with no official technical support. -

-

-You can check the following pages for the latest updates to this plugin, along with any unofficial technical support:
-
-Release Page: tantannoodles.com/toolkit/wordpress-s3/
-Project Page: code.google.com/p/wordpress-s3/
-

-

-RSS Updates: Subscribe to the TanTanToolkit feed and get notified when there's an update to this plugin. -

- - - - -
-Amazon S3 Settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AWS Access Key ID:
Secret Key:
-Login to Amazon.com to retrieve your Secret Key >
-

- -

-
Use this bucket: -
-
Host name settings: - /> - (more info) -
File Uploads: - /> - -
Note: Uncheck this to revert back to using your own web host for storage at anytime. -
Expires Header: - /> - -
File Permissions: - /> - -
  -Uploading files directly to your Amazon S3 account is not currently supported by this plugin (uploads must temporarily pass through your blog). -But, there are a some free tools to help you upload and manage your files on directly on Amazon S3. See this page for some suggested tools. -
-

- -

-
- - - -
- - - - - - -
\ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab-head.html b/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab-head.html deleted file mode 100755 index 1eda8bd..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab-head.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.html b/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.html deleted file mode 100755 index 9d86c60..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.html +++ /dev/null @@ -1,98 +0,0 @@ - - -
- -
- - - -back -forward - -refresh -upload -new folder - - -home / '; -$path = ''; -$paths = preg_split('/\//', $prefix, 100, PREG_SPLIT_NO_EMPTY); -$numPaths = count($paths); -$i=0; -foreach ($paths as $name) if ($name) { - $path .= $name .'/'; - $isLast = (++$i) >= $numPaths; - echo ''.$name.' '.(!$isLast ? ' / ' : ' '); -} -?> - - - - -
-
- - - -
-
-
-
- - -
-
- -
-
-
-
    - -
  • - -
-
-
-
- -
-
-
\ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.js b/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.js deleted file mode 100755 index 7da8539..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-tab.js +++ /dev/null @@ -1,59 +0,0 @@ - -function s3_insertImage(imgURL, title) { - if (!title) title = ''; - return s3_insert(''+title+' '); -} - -function s3_insertLink(label, url) { - var useBittorrent = document.getElementById('useBittorrent').checked - return s3_insert('' + label + ' '); -} -function s3_insert(h) { - var win = window.dialogArguments || opener || parent || top; - - if (typeof win.send_to_editor == 'function') { - win.send_to_editor(h); - if (typeof win.tb_remove == 'function') - win.tb_remove(); - return false; - } - tinyMCE = win.tinyMCE; - if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) { - tinyMCE.selectedInstance.getWin().focus(); - tinyMCE.execCommand('mceInsertContent', false, h); - } else win.edInsertContent(win.edCanvas, h); - - return false; -} -function s3_toggleUpload() { - document.getElementById('create-form').style.display='none'; - - var div = document.getElementById('upload-form'); - if (div.style.display == 'block') { - div.style.display = 'none'; - } else { - div.style.display = 'block'; - } - return false; -} -function s3_toggleCreateFolder() { - document.getElementById('upload-form').style.display='none'; - - var div = document.getElementById('create-form'); - if (div.style.display == 'block') { - div.style.display = 'none'; - } else { - div.style.display = 'block'; - document.getElementById('newfolder').focus(); - } - return false; - - - var div = document.getElementById('createFolder'); - if (div.className != 'create') { - div.className = 'create'; - document.getElementById('newfolder').focus(); - } else { - div.className = ''; - } -} diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-version-error.html b/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-version-error.html deleted file mode 100755 index c3c1cff..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/admin-version-error.html +++ /dev/null @@ -1,58 +0,0 @@ - -

- -

- - - - - -
-

Amazon S3 Plugin for WordPress

-
- Switch to a better web host!
- Use the coupon code - TANTAN50COUPON - when you signup to get a $50 discount, and you'll - help support this plugin in the process. - That works out to be less than $6.00 per month for the first year. - -
-

Error

-

-Sorry, this plugin requires at least PHP 5.0 and WordPress 2.1 in order to work correctly. -Please contact your systems administrator about getting your version of PHP and/or WordPress upgraded. -

-

-Your PHP version:
-Your WordPress version: -
-

- -

-Download PHP
-Download WordPress
-

-
\ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin-public.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin-public.php deleted file mode 100755 index 32ec445..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin-public.php +++ /dev/null @@ -1,29 +0,0 @@ -options = array(); - if (file_exists(dirname(__FILE__).'/config.php')) { - require_once(dirname(__FILE__).'/config.php'); - if ($TanTanWordPressS3Config) $this->options = $TanTanWordPressS3Config; - } - add_action('plugins_loaded', array(&$this, 'addhooks')); - } - function addhooks() { - add_filter('wp_get_attachment_url', array(&$this, 'wp_get_attachment_url'), 9, 2); - } - function wp_get_attachment_url($url, $postID) { - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - - if ($this->options['wp-uploads'] && ($amazon = get_post_meta($postID, 'amazonS3_info', true))) { - $accessDomain = $this->options['virtual-host'] ? $amazon['bucket'] : $amazon['bucket'].'.s3.amazonaws.com'; - return 'http://'.$accessDomain.'/'.$amazon['key']; - } else { - return $url; - } - } -} -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin.php deleted file mode 100755 index 6c76166..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/class-plugin.php +++ /dev/null @@ -1,464 +0,0 @@ -options['hideAmazonS3UploadTab']) { - add_action('load-upload.php', array(&$this, 'addPhotosTab')); // WP < 2.5 - - // WP >= 2.5 - add_action('media_buttons_context', array(&$this, 'media_buttons')); - add_action('media_upload_tantan-wordpress-s3', array(&$this, 'media_upload_content')); - } - add_action('activate_tantan/wordpress-s3.php', array(&$this, 'activate')); - if ($_GET['tantanActivate'] == 'wordpress-s3') { - $this->showConfigNotice(); - } - $this->photos = array(); - $this->albums = array(); - $this->perPage = 1000; - - - } - - // this should install the javascripts onto the user's s3.amazonaws.com account - - function installAjax() { - $js = array('S3Ajax.js'); - } - - function activate() { - wp_redirect('plugins.php?tantanActivate=wordpress-s3'); - exit; - } - function deactivate() {} - - function showConfigNotice() { - add_action('admin_notices', create_function('', 'echo \'

Amazon S3 Plugin for WordPress activated. Configure the plugin >

\';')); - } - - function settings() { - add_options_page('Amazon S3', 'Amazon S3', 10, __FILE__, array(&$this, 'admin')); - $this->version_check(); - } - function addhooks() { - parent::addhooks(); - if (!$_POST['disable_amazonS3']) { - add_filter('wp_update_attachment_metadata', array(&$this, 'wp_update_attachment_metadata'), 9, 2); - //can't delete mirrored files just yet - //add_filter('wp_get_attachment_metadata', array(&$this, 'wp_get_attachment_metadata')); - //add_filter('wp_delete_file', array(&$this, 'wp_delete_file')); - } - } - function version_check() { - global $TanTanVersionCheck; - if (is_object($TanTanVersionCheck)) { - $data = get_plugin_data(dirname(__FILE__).'/../wordpress-s3.php'); - $TanTanVersionCheck->versionCheck(668, $data['Version']); - } - } - function admin() { - if ($_POST['action'] == 'save') { - if (!is_array($_POST['options'])) $_POST['options'] = array(); - $options = get_option('tantan_wordpress_s3'); - - $_POST['options']['key'] = trim($_POST['options']['key']); - $_POST['options']['secret'] = trim($_POST['options']['secret']); - - if (!$_POST['options']['secret'] || ereg('not shown', $_POST['options']['secret'])) { - $_POST['options']['secret'] = $options['secret']; - } - - update_option('tantan_wordpress_s3', $_POST['options']); - - if ($_POST['options']['bucket']) { - $options = get_option('tantan_wordpress_s3'); - require_once(dirname(__FILE__).'/lib.s3.php'); - $s3 = new TanTanS3($options['key'], $options['secret']); - - if (!in_array($_POST['options']['bucket'], $s3->listBuckets())) { - if ($s3->createBucket($_POST['options']['bucket'],'public-read')) { - $message = "Saved settings and created a new bucket: ".$_POST['options']['bucket']; - } else { - $error = "There was an error creating the bucket: ".$_POST['options']['bucket']; - } - } else { - $message = "Saved settings."; - } - } else { - $message = "Saved Amazon S3 authentication information. "; - } - if (function_exists('dns_get_record') && $_POST['options']['virtual-host']) { - $record = dns_get_record($_POST['options']['bucket']); - if (($record[0]['type'] != 'CNAME') || ($record[0]['target'] != $_POST['options']['bucket'].'s3.amazonaws.com')) { - $error = "Warning: Your DNS doesn't seem to be setup correctly to virtually host the domain ".$_POST['options']['bucket'].". ". - "Double check and make sure the following entry is added to your DNS. ". - "More info >". - "

". - "".$_POST['options']['bucket']." CNAME ".$_POST['options']['bucket'].".s3.amazonaws.com.". - "

". - "You can ignore this message if you're sure everything is setup correctly."; - } - } - } - $options = get_option('tantan_wordpress_s3'); - if ($options['key'] && $options['secret']) { - require_once(dirname(__FILE__).'/lib.s3.php'); - $s3 = new TanTanS3($options['key'], $options['secret']); - if (!($buckets = $s3->listBuckets())) { - $error = $this->getErrorMessage($s3->parsed_xml, $s3->responseCode); - } - - $s3->initCacheTables(); - - } elseif ($options['key']) { - $error = "Please enter your Secret Access Key."; - } elseif ($options['secret']) { - $error = "Please enter your Access Key ID."; - } - - - include(dirname(__FILE__).'/admin-options.html'); - } - - - /* - Delete corresponding file from Amazon S3 - */ - function wp_delete_file($file) { - return $file; - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - - if (!$this->options['wp-uploads'] || !$this->options['bucket'] || !$this->options['secret']) { - return $file; - } - - if (is_array($this->meta)) { - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - $this->s3->setOptions($this->options); - if (deleteObject($this->meta['bucket'], $this->meta['key'])) { - - } - $accessDomain = $this->options['virtual-host'] ? $this->meta['bucket'] : $this->meta['bucket'].'.s3.amazonaws.com'; - return $file; - //return 'http://'.$accessDomain.'/'.$amazon['key']; - - } - return $file; - } - function wp_get_attachment_metadata($data=false, $postID=false) { - if (is_numeric($postID)) $this->meta = get_post_meta($postID, 'amazonS3_info', true); - return $data; - } - /* - Handle uploads through default WordPress upload handler - */ - function wp_update_attachment_metadata($data, $postID) { - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - - if (!$this->options['wp-uploads'] || !$this->options['bucket'] || !$this->options['secret']) { - return $data; - } - - add_filter('option_siteurl', array(&$this, 'upload_path')); - $uploadDir = wp_upload_dir(); - remove_filter('option_siteurl', array(&$this, 'upload_path')); - $parts = parse_url($uploadDir['url']); - - $prefix = substr($parts['path'], 1) .'/'; - $type = get_post_mime_type($postID); - - $data['file'] = get_attached_file($postID, true); - - if (file_exists($data['file'])) { - $file = array( - 'name' => basename($data['file']), - 'type' => $type, - 'tmp_name' => $data['file'], - 'error' => 0, - 'size' => filesize($data['file']), - ); - - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - $this->s3->setOptions($this->options); - - if ($this->s3->putObjectStream($this->options['bucket'], $prefix.$file['name'], $file)) { - - if ($data['thumb']) { - $thumbpath = str_replace( basename( $data['file'] ), $data['thumb'], $data['file'] ); - $filethumb = array( - 'name' => $data['thumb'], - 'type' => $type, - 'tmp_name' => $thumbpath, - 'size' => filesize($thumbpath), - ); - - $this->s3->putObjectStream($this->options['bucket'], $prefix.$filethumb['name'], $filethumb); - } elseif (count($data['sizes'])) foreach ($data['sizes'] as $altName => $altSize) { - $altPath = str_replace( basename( $data['file'] ), $altSize['file'], $data['file'] ); - $altMeta = array( - 'name' => $altSize['file'], - 'type' => $type, - 'tmp_name' => $altPath, - 'size' => filesize($altPath), - ); - $this->s3->putObjectStream($this->options['bucket'], $prefix.$altMeta['name'], $altMeta); - - } - - - delete_post_meta($postID, 'amazonS3_info'); - add_post_meta($postID, 'amazonS3_info', array( - 'bucket' => $this->options['bucket'], - 'key' => $prefix.$file['name'] - )); - } else { - - } - } - return $data; - } - function wp_handle_upload($info) { - return $info; - } - - // figure out the correct path to upload to, for wordpress mu installs - function upload_path($path='') { - global $current_blog; - if (!$current_blog) return $path; - if ($current_blog->path == '/' && ($current_blog->blog_id != 1)) { - $dir = substr($current_blog->domain, 0, strpos($current_blog->domain, '.')); - } else { - // prepend a directory onto the path for vhosted blogs - if (constant("VHOST") != 'yes') { - $dir = ''; - } else { - $dir = $current_blog->path; - } - } - //echo trim($path.'/'.$dir, '/'); - if ($path == '') { - $path = $current_blog->path; - } - return trim($path.'/'.$dir, '/'); - } - function media_buttons($context) { - global $post_ID, $temp_ID; - $dir = dirname(__FILE__); - $pluginRootURL = get_option('siteurl').substr($dir, strpos($dir, '/wp-content')); - $image_btn = $pluginRootURL.'/database.png'; - $image_title = 'Amazon S3'; - - $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); - - $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID"; - $out = ' '.$image_title.''; - return $context.$out; - } - function media_upload_content() { - $this->upload_files_tantan_amazons3(); // process any uploaded files or new folders - - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - //if (!is_object($this->s3)) { - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - $this->s3->setOptions($this->options); - //} - - add_action('admin_print_scripts', array(&$this, 'upload_tabs_scripts')); - wp_iframe(array(&$this, 'tab')); - } - /* - Display tabs - */ - function addPhotosTab() { - add_filter('wp_upload_tabs', array(&$this, 'wp_upload_tabs')); - add_action('upload_files_tantan_amazons3', array(&$this, 'upload_files_tantan_amazons3')); - add_action('upload_files_upload', array(&$this, 'upload_files_upload')); - add_action('admin_print_scripts', array(&$this, 'upload_tabs_scripts')); - } - function wp_upload_tabs ($array) { - /* - 0 => tab display name, - 1 => required cap, - 2 => function that produces tab content, - 3 => total number objects OR array(total, objects per page), - 4 => add_query_args - */ - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - - - if ($this->options['key'] && $this->options['secret'] && $this->options['bucket']) { - $paged = array(); - $args = array('prefix' => ''); // this doesn't do anything in WP 2.1.2 - $tab = array( - 'tantan_amazons3' => array('Amazon S3', 'upload_files', array(&$this, 'tab'), $paged, $args), - //'tantan_amazons3_upload' => array('Upload S3', 'upload_files', array(&$this, 'upload'), $paged, $args), - ); - - return array_merge($array, $tab); - } else { - return $array; - } - } - - function upload_tabs_scripts() { - //wp_enqueue_script('prototype'); - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - - $accessDomain = $this->options['virtual-host'] ? $this->options['bucket'] : $this->options['bucket'].'.s3.amazonaws.com'; - - include(dirname(__FILE__).'/admin-tab-head.html'); - } - function upload_files_upload() { - // javascript here to inject javascript and allow the upload from to post to amazon s3 instead - } - function upload_files_tantan_amazons3() { - global $current_blog; - $restrictPrefix = ''; // restrict to a selected prefix in current bucket - if ($current_blog) { // if wordpress mu - $restrictPrefix = ltrim($this->upload_path().'/files/', '/'); - } - - if (is_array($_FILES['newfile'])) { - $file = $_FILES['newfile']; - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - $this->s3->setOptions($this->options); - $this->s3->putObjectStream($this->options['bucket'], $restrictPrefix.$_GET['prefix'].$file['name'], $file); - } - if ($_POST['newfolder']) { - if (!$this->options) $this->options = get_option('tantan_wordpress_s3'); - require_once(dirname(__FILE__).'/lib.s3.php'); - $this->s3 = new TanTanS3($this->options['key'], $this->options['secret']); - - $this->s3->putPrefix($this->options['bucket'], $restrictPrefix.$_POST['prefix'].$_POST['newfolder']); - } - } - function tab() { - global $current_blog; - $restrictPrefix = ''; // restrict to a selected prefix in current bucket - if ($current_blog) { // if wordpress mu - $restrictPrefix = ltrim($this->upload_path().'/files/', '/'); - } - - $offsetpage = (int) $_GET['paged']; - if (!$offsetpage) $offsetpage = 1; - - if (!$this->options['key'] || !$this->options['secret']) { - return; - } - $bucket = $this->options['bucket']; - $accessDomain = $this->options['virtual-host'] ? $this->options['bucket'] : $this->options['bucket'].'.s3.amazonaws.com'; - - $prefix = $_GET['prefix'] ? $_GET['prefix'] : ''; - list($prefixes, $keys, $meta, $privateKeys) = $this->getKeys($restrictPrefix.$prefix); - if ($restrictPrefix) { - foreach ($prefixes as $k=>$v) { - $prefixes[$k] = str_replace($restrictPrefix, '', $v); - } - } - include(dirname(__FILE__).'/admin-tab.html'); - } - - function getErrorMessage($parsed_xml, $responseCode){ - $message = 'Error '.$responseCode.': ' . $parsed_xml->Message; - if(isset($parsed_xml->StringToSignBytes)) $message .= "
Hex-endcoded string to sign: " . $parsed_xml->StringToSignBytes; - return $message; - } - - // turns array('a', 'b', 'c') into $array['a']['b']['c'] - function mapKey($keys, $path) { - $k =& $keys; - $size = count($path) - 1; - $workingPath = '/'; - foreach ($path as $i => $p) { - if ($i === $size) { - $k['_size'] = isset($k['_size']) ? $k['_size'] + 1 : 1; - $k['_path'] = $workingPath; - $k['_objects'][$k['_size']] = $p; - } else { - $k =& $k[$p]; // traverse the tree - $workingPath .= $p . '/'; - } - } - return $keys; - } - - // should probably figgure out a way to cache these results to make things more speedy - function getKeys($prefix) { - $ret = $this->s3->listKeys($this->options['bucket'], false, urlencode($prefix), '/');//, false, 's3/', '/'); - - if ($this->s3->responseCode >= 400) { - return array(); - } - $keys = array(); - $privateKeys = array(); - $prefixes = array(); - $meta = array(); - if ($this->s3->parsed_xml->CommonPrefixes) foreach ($this->s3->parsed_xml->CommonPrefixes as $content) { - $prefixes[] = (string) $content->Prefix; - } - - if ($this->s3->parsed_xml->Contents) foreach ($this->s3->parsed_xml->Contents as $content) { - $key = (string) $content->Key; - if ($this->isPublic($key)) $keys[] = $key; - else { - if (!($p1 = ereg('^\.', $key)) && - !($p2 = ereg('_\$folder\$$', $key)) && - !($p3 = ereg('placeholder.ns3', $key))) { - $privateKeys[] = $key; - } elseif ($p2) { - $prefix = ereg_replace('(_\$folder\$$)', '/', $key); - if (!in_array($prefix, $prefixes)) $prefixes[] = $prefix; - } else { - - } - } - } - if ($this->options['permissions'] == 'public') { - foreach ($privateKeys as $key) { - $this->s3->setObjectACL($this->options['bucket'], $key, 'public-read'); - $keys[] = $key; - } - } - - foreach ($keys as $i => $key) { - $meta[$i] = $this->s3->getMetadata($this->options['bucket'], $key); - } - natcasesort($keys); - natcasesort($prefixes); - - return array($prefixes, $keys, $meta, $privateKeys); - } - - function isPublic($key) { - $everyone = 'http://acs.amazonaws.com/groups/global/AllUsers'; - $this->s3->getObjectACL($this->options['bucket'], $key); - $acl = (array) $this->s3->parsed_xml->AccessControlList; - if (is_array($acl['Grant'])) foreach ($acl['Grant'] as $grant) { - $grant = (array) $grant; - if ($grant['Grantee'] && (ereg('AllUsers', (string) $grant['Grantee']->URI))) { - $perm = (string) $grant['Permission']; - if ($perm == 'READ' || $perm == 'FULL_CONTROL') return true; - } - } - - - } -} -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/config-sample.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3/config-sample.php deleted file mode 100755 index 523665f..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/config-sample.php +++ /dev/null @@ -1,20 +0,0 @@ - '', // AWS Access Key ID - 'secret' => '', // AWS Secret Key - 'bucket' => '', // S3 Bucket - 'virtual-host' => false, // Bucket is configured for virtual hosting - 'wp-uploads' => true, // mirror all WordPress uploads into Amazon S3 bucket - 'permissions' => '', // set to "public" to have the plugin force all files in the specified bucket to "public" (sometimes third party upload utilities don't do this) - 'hideAmazonS3UploadTab' => false, // hide the Amazon S3 tab in the WordPress upload widget - 'expires' => 315360000, // set http expires header 10 years into the future - ); -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/database.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/database.png deleted file mode 100755 index 3d09261..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/database.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/index.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3/index.php deleted file mode 100755 index 559d87b..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/index.php +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/lib.s3.php b/blog/wp-content/plugins/tantan-s3/wordpress-s3/lib.s3.php deleted file mode 100755 index 5815c1e..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/lib.s3.php +++ /dev/null @@ -1,397 +0,0 @@ -setFunction($func);$this->setKey($key);} -function setFunction($func){if (!$this->_pack = $this->_getPackFormat($func)) { die('Unsupported hash function'); }$this->_func = $func;} -function setKey($key){$func = $this->_func;if (strlen($key) > 64) {$key = pack($this->_pack, $func($key));}if (strlen($key) < 64) {$key = str_pad($key, 64, chr(0));}$this->_ipad = (substr($key, 0, 64) ^ str_repeat(chr(0x36), 64));$this->_opad = (substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64));} -function _getPackFormat($func){$packs = array('md5' => 'H32', 'sha1' => 'H40');return isset($packs[$func]) ? $packs[$func] : false;} -function hash($data){$func = $this->_func;return $func($this->_opad . pack($this->_pack, $func($this->_ipad . $data)));} -} -/* -class Stream{ -var $data; -function stream_function($handle, $fd, $length){return fread($this->data, $length);} -} -*/ -if (!class_exists('TanTanHTTPRequestCurl')) require_once (dirname(__FILE__).'/../lib/curl.php'); - -/* - based on code provided by Amazon -*/ -// This software code is made available "AS IS" without warranties of any -// kind. You may copy, display, modify and redistribute the software -// code either by itself or as incorporated into your code; provided that -// you do not remove any proprietary notices. Your use of this software -// code is at your own risk and you waive any claim against Amazon -// Digital Services, Inc. or its affiliates with respect to your use of -// this software code. (c) 2006 Amazon Digital Services, Inc. or its -// affiliates. - -class TanTanS3 { - - var $serviceUrl; - var $accessKeyId; - var $secretKey; - var $responseString; - var $responseCode; - var $parsed_xml; - var $req; - var $fp; - var $options; - - /** - * Constructor - * - * Takes ($accessKeyId, $secretKey, $serviceUrl) - * - * - [str] $accessKeyId: Your AWS Access Key Id - * - [str] $secretKey: Your AWS Secret Access Key - * - [str] $serviceUrl: OPTIONAL: defaults: http://s3.amazonaws.com/ - * - */ - function TanTanS3($accessKeyId, $secretKey, $serviceUrl="http://s3.amazonaws.com/") { - global $wpdb; - $this->serviceUrl=$serviceUrl; - $this->accessKeyId=$accessKeyId; - $this->secretKey=$secretKey; - $this->req =& new TanTanHTTPRequestCurl($this->serviceUrl); - $this->options = array(); - $this->options['cache_table'] = $wpdb->prefix . 'tantan_wordpress_s3_cache'; - //$this->req = new HTTP_Request($this->serviceUrl); - } - - function setOptions($options) { - if (is_array($options)) { - $this->options = array_merge($this->options, $options); - } - } - /** - * listBuckets -- Lists all buckets. - */ - function listBuckets() { - $ret = $this->send('', ''); - if($ret == 200){ - $return = array(); - if(count($this->parsed_xml->Buckets->Bucket) > 0){ - foreach ($this->parsed_xml->Buckets->Bucket as $bucket) { - $return[] = (string) $bucket->Name; - } - } - return $return; - - } - else{ - return false; - } - } - /** - * listKeys -- Lists keys in a bucket. - * - * Takes ($bucket [,$marker][,$prefix][,$delimiter][,$maxKeys]) -- $marker, $prefix, $delimeter, $maxKeys are independently optional - * - * - [str] $bucket: the bucket whose keys are to be listed - * - [str] $marker: keys returned will occur lexicographically after $marker (OPTIONAL: defaults to false) - * - [str] $prefix: keys returned will start with $prefix (OPTIONAL: defaults to false) - * - [str] $delimiter: keys returned will be of the form "$prefix[some string]$delimeter" (OPTIONAL: defaults to false) - * - [str] $maxKeys: number of keys to be returned (OPTIONAL: defaults to 1000 - maximum allowed by service) - */ - function listKeys($bucket, $marker=FALSE, $prefix=FALSE, $delimiter=FALSE, $maxKeys='1000') { - $ret = $this->send($bucket, '/', "max-keys={$maxKeys}&marker={$marker}&prefix={$prefix}&delimiter={$delimiter}"); - if($ret == 200){ - return true; - } else { - return false; - } - } - function createBucket($bucket, $acl = 'private') { - $httpDate = gmdate("D, d M Y G:i:s T"); - $stringToSign = "PUT\n\n\n$httpDate\nx-amz-acl:$acl\n/$bucket"; - $signature = $this->constructSig($stringToSign); - //$req =& new HTTP_Request($this->serviceUrl . $bucket); - $this->req->setURL($this->serviceUrl . $bucket); - $this->req->setMethod("PUT"); - $this->req->addHeader("Date", $httpDate); - $this->req->addHeader("Authorization", "AWS " . $this->accessKeyId . ":" . $signature); - $this->req->addHeader("x-amz-acl", $acl); - $this->req->sendRequest(); - $this->responseCode=$this->req->getResponseCode(); - $this->responseString = $this->req->getResponseBody(); - $this->parsed_xml = simplexml_load_string($this->responseString); - if ($this->responseCode == 200) { - return true; - } else { - return false; - } - } - /** - * getBucketACL -- Gets bucket access control policy. - * - * Takes ($bucket) - * - * - [str] $bucket: the bucket whose acl you want - */ - function getBucketACL($bucket){ - $ret = $this->send($bucket, '/?acl'); - if ($ret == 200) { - return true; - } else { - return false; - } - } - - /** - * getObjectACL -- gets an objects access control policy. - * - * Takes ($bucket, $key) - * - * - [str] $bucket - * - [str] $key - */ - function getObjectACL($bucket, $key){ - $ret = $this->send($bucket, "/".urlencode($key).'?acl'); - if ($ret == 200) { - return true; - } else { - return false; - } - } - /** - * setObjectACL -- sets objects access control policy to one of Amazon S3 canned policies. - * - * Takes ($bucket, $key, $acl) - * - * - [str] $bucket - * - [str] $key - * - [str] $acl -- One of canned access control policies. - */ - function setObjectACL($bucket, $key, $acl){ - $serviceUrl = 'http://'.$bucket.'.s3.amazonaws.com/'; - - $httpDate = gmdate("D, d M Y G:i:s T"); - $resource = urlencode($key); - $stringToSign = "PUT\n\n\n$httpDate\nx-amz-acl:$acl\n/$bucket/$resource?acl"; - $signature = $this->constructSig($stringToSign); - //$req =& new HTTP_Request($this->serviceUrl.$resource.'?acl'); - $this->req->setURL($serviceUrl.$resource.'?acl'); - $this->req->setMethod("PUT"); - $this->req->addHeader("Date", $httpDate); - $this->req->addHeader("Authorization", "AWS " . $this->accessKeyId . ":" . $signature); - $this->req->addHeader("x-amz-acl", $acl); - $this->req->sendRequest(); - if ($this->req->getResponseCode() == 200) { - return true; - } else { - return false; - } - } - - /** - * getMetadata -- Gets the metadata associated with an object. - * - * Takes ($bucket, $key) - * - * - [str] $bucket - * - [str] $key - */ - function getMetadata($bucket, $key){ - if ($data = $this->getCache($bucket."/".$key)) { - return $data; - } - $ret = $this->send($bucket, "/".urlencode($key), '', 'HEAD'); - if ($ret == 200) { - $data = $this->req->getResponseHeader(); - foreach ($data as $k => $d) $data[strtolower($k)] = trim($d); - $this->setCache($bucket."/".$key, $data); - return $data; - } else { - return array(); - } - } - - - /** - * putObjectStream -- Streams data to a bucket. - * - * Takes ($bucket, $key, $streamFunction, $contentType, $contentLength [,$acl, $metadataArray, $md5]) - * http://www.missiondata.com/blog/linux/49/s3-streaming-with-php/ - * - * - [str] $bucket: the bucket into which file will be written - * - [str] $key: key of written file - * - [str] $fileName: path to file - * - [str] $contentType: file content type - * - [str] $contentLength: file content length - * - [str] $acl: access control policy of file (OPTIONAL: defaults to 'private') - * - [str] $metadataArray: associative array containing user-defined metadata (name=>value) (OPTIONAL) - * - [bool] $md5: the MD5 hash of the object (OPTIONAL) - */ - function putObjectStream($bucket, $key, $fileInfo, $acl='public-read', $metadataArray=array(), $md5=false){ - $serviceUrl = 'http://'.$bucket.'.s3.amazonaws.com/'; - - sort($metadataArray); - $fileName = $fileInfo['tmp_name']; - $contentLength = $fileInfo['size']; - $contentType = $fileInfo['type']; - if (!file_exists($fileName)) { - return false; - } - $this->fp = fopen($fileName, 'r'); - $resource = urlencode($key); - $httpDate = gmdate("D, d M Y G:i:s T"); - - $curl_inst = curl_init(); - - curl_setopt ($curl_inst, CURLOPT_CONNECTTIMEOUT, 30); - curl_setopt ($curl_inst, CURLOPT_LOW_SPEED_LIMIT, 1); - curl_setopt ($curl_inst, CURLOPT_LOW_SPEED_TIME, 180); - curl_setopt ($curl_inst, CURLOPT_NOSIGNAL, 1); - curl_setopt ($curl_inst, CURLOPT_READFUNCTION, array(&$this, 'stream_function')); - curl_setopt ($curl_inst, CURLOPT_URL, $serviceUrl . $resource); - curl_setopt ($curl_inst, CURLOPT_UPLOAD, true); - curl_setopt ($curl_inst, CURLINFO_CONTENT_LENGTH_UPLOAD, $contentLength); - - $header[] = "Date: $httpDate"; - $header[] = "Content-Type: $contentType"; - $header[] = "Content-Length: $contentLength"; - $header[] = "Expect: "; - if (is_numeric($this->options['expires'])) { - $header[] = "Expires: ".date('D, d M Y H:i:s O', time()+$this->options['expires']); - } - $header[] = "Transfer-Encoding: "; - $header[] = "x-amz-acl: $acl"; - - $MD5 = ""; - if($md5){ - $MD5 = $this->hex2b64(md5_file($filePath)); - $header[] = "Content-MD5: $MD5"; - } - - $stringToSign="PUT\n$MD5\n$contentType\n$httpDate\nx-amz-acl:$acl\n"; - foreach($metadataArray as $current){ - if($current!=""){ - $stringToSign.="x-amz-meta-$currentn"; - $header = substr($current,0,strpos($current,':')); - $meta = substr($current,strpos($current,':')+1,strlen($current)); - $header[] = "x-amz-meta-$header: $meta"; - } - } - - $stringToSign.="/$bucket/$resource"; - - $signature = $this->constructSig($stringToSign); - - $header[] = "Authorization: AWS $this->accessKeyId:$signature"; - - curl_setopt($curl_inst, CURLOPT_HTTPHEADER, $header); - curl_setopt($curl_inst, CURLOPT_RETURNTRANSFER, 1); - - $result = curl_exec ($curl_inst); - - $this->responseString = $result; - $this->responseCode = curl_getinfo($curl_inst, CURLINFO_HTTP_CODE); - - fclose($this->fp); - curl_close($curl_inst); - return true; - } - function stream_function($handle, $fd, $length){return fread($this->fp, $length);} - - function putPrefix($bucket, $prefix){ - $ret = $this->send($bucket, "/".urlencode($prefix.'_$folder$'), '', 'PUT', array('Content-Type' => '', 'Content-Length' => 0)); - if ($ret == 200) { - return true; - } else { - return false; - } - } - - function deleteObject($bucket, $key) { - $ret = $this->send($bucket, "/".urlencode($key), '', 'DELETE'); - if ($ret == 204) { - return true; - } else { - return false; - } - } - - function send($bucket, $resource, $args='', $method='GET', $headers=false) { - if ($bucket != '') { - $serviceUrl = 'http://'.$bucket.'.s3.amazonaws.com'; - } else { - $serviceUrl = 'http://s3.amazonaws.com/'; - } - - $method=strtoupper($method); - $httpDate = gmdate("D, d M Y G:i:s T"); - $signature = $this->constructSig("$method\n\n\n$httpDate\n/".($bucket ? ($bucket.$resource) : $resource)); - - $this->req->setURL($serviceUrl.$resource.($args ? '?'.$args : '')); - $this->req->setMethod($method); - $this->req->addHeader("Date", $httpDate); - $this->req->addHeader("Authorization", "AWS " . $this->accessKeyId . ":" . $signature); - if (is_array($headers)) foreach ($headers as $key => $header) $this->req->addHeader($key, $header); - $this->req->sendRequest(); - if ($method=='GET') { - $this->parsed_xml = simplexml_load_string($this->req->getResponseBody()); - } - - return $this->req->getResponseCode(); - } - function hex2b64($str) { - $raw = ''; - for ($i=0; $i < strlen($str); $i+=2) { - $raw .= chr(hexdec(substr($str, $i, 2))); - } - return base64_encode($raw); - } - - function constructSig($str) { - $hasher =& new TanTanCrypt_HMAC($this->secretKey, "sha1"); - $signature = $this->hex2b64($hasher->hash($str)); - return($signature); - } - - function initCacheTables() { - global $wpdb; - if (!is_object($wpdb)) return; - - $wpdb->query("CREATE TABLE IF NOT EXISTS `".$this->options['cache_table']."` ( - `request` VARCHAR( 255 ) NOT NULL , - `response` TEXT NOT NULL , - `timestamp` DATETIME NOT NULL , - PRIMARY KEY ( `request` ) - ) TYPE = MYISAM"); - } - function setCache($key, $data) { - global $wpdb; - if (!is_object($wpdb)) return false; - $key = addslashes(trim($key)); - if ($wpdb->query("DELETE FROM ".$this->options['cache_table']." WHERE request = '".$key."'") !== false) { - $sql = "INSERT INTO ".$this->options['cache_table']." (request, response, timestamp) VALUES ('".$key."', '" . addslashes(serialize($data)) . "', '" . strftime("%Y-%m-%d %H:%M:%S") . "')"; - $wpdb->query($sql); - } else { // tables might not be setup, so just try to do that - $this->initCacheTables(); - } - return $data; - } - function getCache($key) { - global $wpdb; - if (!is_object($wpdb)) return false; - $key = trim($key); - $result = @$wpdb->get_var("SELECT response FROM ".$this->options['cache_table']." WHERE request = '" . $key . "' LIMIT 1"); - - if (!empty($result)) { - return unserialize($result); - } - return false; - } - function clearCache() { - global $wpdb; - if (!is_object($wpdb)) return false; - $result = @$wpdb->query("DELETE FROM ".$this->options['cache_table'].";"); - } -} -?> \ No newline at end of file diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/add.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/add.png deleted file mode 100755 index 6332fef..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/add.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_left.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_left.png deleted file mode 100755 index 5dc6967..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_left.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_refresh.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_refresh.png deleted file mode 100755 index 0de2656..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_refresh.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_right.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_right.png deleted file mode 100755 index b1a1819..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/arrow_right.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/cancel.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/cancel.png deleted file mode 100755 index c149c2b..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/cancel.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/compress.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/compress.png deleted file mode 100755 index 8606ff0..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/compress.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/film.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/film.png deleted file mode 100755 index b0ce7bb..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/film.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder.gif b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder.gif deleted file mode 100755 index 8dc04c4..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder.gif and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder_add.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder_add.png deleted file mode 100755 index 529fe8f..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/folder_add.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page.png deleted file mode 100755 index 03ddd79..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_code.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_code.png deleted file mode 100755 index f7ea904..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_code.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_excel.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_excel.png deleted file mode 100755 index eb6158e..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_excel.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white.png deleted file mode 100755 index 8b8b1ca..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_acrobat.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_acrobat.png deleted file mode 100755 index 8f8095e..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_acrobat.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_excel.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_excel.png deleted file mode 100755 index b977d7e..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_excel.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_php.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_php.png deleted file mode 100755 index 7868a25..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_php.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_powerpoint.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_powerpoint.png deleted file mode 100755 index c4eff03..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_powerpoint.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_text.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_text.png deleted file mode 100755 index 813f712..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_text.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_word.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_word.png deleted file mode 100755 index ae8ecbf..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_word.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_zip.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_zip.png deleted file mode 100755 index fd4bbcc..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_white_zip.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_word.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_word.png deleted file mode 100755 index 834cdfa..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/page_word.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/photo.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/photo.png deleted file mode 100755 index 6c2aaaa..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/photo.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/picture.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/picture.png deleted file mode 100755 index 4a158fe..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/picture.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/sound.png b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/sound.png deleted file mode 100755 index 6056d23..0000000 Binary files a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/sound.png and /dev/null differ diff --git a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/styles.css b/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/styles.css deleted file mode 100755 index fb7641d..0000000 --- a/blog/wp-content/plugins/tantan-s3/wordpress-s3/styles/styles.css +++ /dev/null @@ -1,189 +0,0 @@ -#disable_amazonS3_span { - -} -form#upload-file #disable_amazonS3_span input { - width:auto !important; -} -#amazon-s3-wrap { - padding:10px; -} -.infobar { - position:relative; - padding:0 0 6px 0; - margin:0 0 5px 0; - font-size:0.9em; - border-bottom:1px solid #ddd; -} -.infobar a { - border:0; - color:black; - text-decoration:none; -} -.infobar a:hover { - text-decoration:underline; -} - -.infobar .nav-controls { - position:absolute; - top:0px; - left:0px; -} -.infobar .nav-controls a { - display:block; - float:left; - margin-right:10px; - height:18px; - line-height:18px; - padding-left:20px; - background:url(arrow_left.png) no-repeat left; - border:0; - color:#888; -} -.infobar .nav-controls a#btn-upload, -.infobar .nav-controls a#btn-folder, -.infobar .nav-controls a#btn-forward, -.infobar .nav-controls a#btn-refresh { - padding-left:0px; - padding-right:20px; - text-indent:-10000px; - background:url(arrow_right.png) no-repeat left; -} -.infobar .nav-controls a#btn-refresh { - background-image:url(arrow_refresh.png); -} -.infobar .nav-controls a#btn-upload { - background-image:url(add.png); -} -.infobar .nav-controls a#btn-folder { - background-image:url(folder_add.png); -} -.infobar .path { - margin-left:195px; - line-height:18px; -} -.infobar .path, -.infobar .path a{ - color:#888; -} -.infobar .path a.last { - font-weight:bold; - color:#000; -} -.infobar .options { - position:absolute; - top:0px; - right:10px; -} -.infobar #upload-form, .infobar #create-form { - display:none; - padding:5px; -} -.folders { - position:relative; - margin:10px 0 0 0; -} -.folders form { - padding:0; -} -.folders ul { - list-style:none; - margin:0; - padding:0 0 0 0px; -} -.folders li { - display:block; - float:left; - width:100px; - height:18px; - overflow:hidden; - margin:0 10px 5px 0; - font-size:11px; - line-height:16px; -} -.folders li a { - border:0; - color:#555; - text-decoration:none; - background:white url(folder.gif) no-repeat 0px -3px; - padding:0 0 0 20px; -} -.folders li a:hover { - text-decoration:underline; -} -.folders li a.add { - background-image:url(folder_add.png); -} -.folders li#createFolder div.form { - display:none; -} -.folders li#createFolder.create div.form { - display:inline; -} -.folders li#createFolder.create a.add { - display:none; -} -.folders li#createFolder input { - font-size:9px; - padding:0; -} -.files { - clear:both; -} -.files ul { - list-style:none; - margin:0; - padding:0; -} -.files ul li { - display:block; - float:left; - width:175px; - height:18px; - overflow:hidden; - margin:0 10px 5px 0; - font-size:11px; - line-height:16px; - - padding-left:20px; - background:url(page_white.png) no-repeat left; -} -.files ul li a { - border:0; - color:#555; - text-decoration:none; -} -.files ul li a:hover { - text-decoration:underline; -} -.files ul li.empty { - color:#888; - letter-spacing:1px; - font-style:italic; - background-image:none; - padding-left:0; -} -.files ul li.image { background-image:url(photo.png);} - -.files ul li.text { background-image:url(page_white_text.png);} - -.files ul li.video { background-image:url(film.png);} -.files ul li.audio, -.files ul li.ogg { background-image:url(sound.png);} - -.files ul li.pdf { background-image:url(page_white_acrobat.png);} -.files ul li.msword, -.files ul li.doc { background-image:url(page_white_word.png);} -.files ul li.ms-excel, -.files ul li.xls { background-image:url(page_white_excel.png);} -.files ul li.ms-powerpoint, -.files ul li.ppt { background-image:url(page_white_powerpoint.png);} - - -.files ul li.javascript, -.files ul li.js, -.files ul li.html, -.files ul li.php, -.files ul li.css { background-image:url(page_code.png);} - -.files ul li.zip { background-image:url(page_white_zip.png);} - diff --git a/blog/wp-content/plugins/wp-s3 b/blog/wp-content/plugins/wp-s3 new file mode 160000 index 0000000..b988340 --- /dev/null +++ b/blog/wp-content/plugins/wp-s3 @@ -0,0 +1 @@ +Subproject commit b988340a5a39d0e3ce275e62203c00b5f09f06e6