Permalink
Browse files

First commit

  • Loading branch information...
0 parents commit 5d9599a52d1d21acab8bd4efa5d66c6023dc6abd @waxpancake committed Jun 9, 2011
Showing with 40,355 additions and 0 deletions.
  1. +48 −0 README.md
  2. +66 −0 aws-sdk/config-sample.inc.php
  3. +66 −0 aws-sdk/config.inc.php
  4. +171 −0 aws-sdk/extensions/s3browserupload.class.php
  5. +25 −0 aws-sdk/lib/cachecore/LICENSE
  6. +1 −0 aws-sdk/lib/cachecore/README
  7. +5 −0 aws-sdk/lib/cachecore/_sql/README
  8. +7 −0 aws-sdk/lib/cachecore/_sql/mysql.sql
  9. +6 −0 aws-sdk/lib/cachecore/_sql/pgsql.sql
  10. +2 −0 aws-sdk/lib/cachecore/_sql/sqlite3.sql
  11. +119 −0 aws-sdk/lib/cachecore/cacheapc.class.php
  12. +141 −0 aws-sdk/lib/cachecore/cachecore.class.php
  13. +170 −0 aws-sdk/lib/cachecore/cachefile.class.php
  14. +176 −0 aws-sdk/lib/cachecore/cachemc.class.php
  15. +290 −0 aws-sdk/lib/cachecore/cachepdo.class.php
  16. +122 −0 aws-sdk/lib/cachecore/cachexcache.class.php
  17. +66 −0 aws-sdk/lib/cachecore/icachecore.interface.php
  18. +25 −0 aws-sdk/lib/requestcore/LICENSE
  19. +15 −0 aws-sdk/lib/requestcore/README.md
  20. +3,990 −0 aws-sdk/lib/requestcore/cacert.pem
  21. +1,002 −0 aws-sdk/lib/requestcore/requestcore.class.php
  22. +152 −0 aws-sdk/sdk-1.3.3/package.xml
  23. +131 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/README.md
  24. +24 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_compatibility_test/README.md
  25. +435 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_compatibility_test/sdk_compatibility_test.php
  26. +125 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_compatibility_test/sdk_compatibility_test_cli.php
  27. +758 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_docs/CHANGELOG.md
  28. +57 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_docs/CONTRIBUTORS.md
  29. +151 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_docs/LICENSE.md
  30. +389 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_docs/NOTICE.md
  31. +2 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_docs/WHERE_IS_THE_API_REFERENCE.md
  32. +9 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/README.md
  33. +97 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/cli-ec2_sorting_and_filtering.php
  34. +137 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/cli-s3_get_urls_for_uploads.php
  35. +157 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/cli-s3_progress_bar.php
  36. +270 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/html-sdb_create_domain_data.php
  37. +410 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/lib/ProgressBar.php
  38. BIN aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/test_files/audio.wav
  39. +1 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/test_files/plain.txt
  40. BIN aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/test_files/video.mp4
  41. BIN aws-sdk/sdk-1.3.3/sdk-1.3.3/_samples/test_files/word.doc
  42. +25 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/LICENSE
  43. +1 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/README
  44. +5 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/_sql/README
  45. +7 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/_sql/mysql.sql
  46. +6 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/_sql/pgsql.sql
  47. +2 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/_sql/sqlite3.sql
  48. +119 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cacheapc.class.php
  49. +141 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cachecore.class.php
  50. +170 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cachefile.class.php
  51. +176 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cachemc.class.php
  52. +290 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cachepdo.class.php
  53. +122 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/cachexcache.class.php
  54. +66 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/cachecore/icachecore.interface.php
  55. +25 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/requestcore/LICENSE
  56. +15 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/requestcore/README.md
  57. +3,990 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/requestcore/cacert.pem
  58. +1,002 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/requestcore/requestcore.class.php
  59. +19 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/LICENSE
  60. +15 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/README.markdown
  61. +135 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/lib/sfYaml.php
  62. +60 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/lib/sfYamlDumper.php
  63. +442 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/lib/sfYamlInline.php
  64. +612 −0 aws-sdk/sdk-1.3.3/sdk-1.3.3/lib/yaml/lib/sfYamlParser.php
  65. +1,444 −0 aws-sdk/sdk.class.php
  66. +927 −0 aws-sdk/services/as.class.php
  67. +329 −0 aws-sdk/services/cloudformation.class.php
  68. +1,420 −0 aws-sdk/services/cloudfront.class.php
  69. +607 −0 aws-sdk/services/cloudwatch.class.php
  70. +3,955 −0 aws-sdk/services/ec2.class.php
  71. +982 −0 aws-sdk/services/elasticbeanstalk.class.php
  72. +623 −0 aws-sdk/services/elb.class.php
  73. +422 −0 aws-sdk/services/emr.class.php
  74. +1,171 −0 aws-sdk/services/iam.class.php
  75. +197 −0 aws-sdk/services/importexport.class.php
  76. +855 −0 aws-sdk/services/rds.class.php
  77. +3,420 −0 aws-sdk/services/s3.class.php
  78. +670 −0 aws-sdk/services/sdb.class.php
  79. +334 −0 aws-sdk/services/ses.class.php
  80. +433 −0 aws-sdk/services/sns.class.php
  81. +485 −0 aws-sdk/services/sqs.class.php
  82. +289 −0 aws-sdk/utilities/array.class.php
  83. +98 −0 aws-sdk/utilities/batchrequest.class.php
  84. +123 −0 aws-sdk/utilities/complextype.class.php
  85. +377 −0 aws-sdk/utilities/gzipdecode.class.php
  86. +67 −0 aws-sdk/utilities/hadoopbase.class.php
  87. +98 −0 aws-sdk/utilities/hadoopstep.class.php
  88. +69 −0 aws-sdk/utilities/info.class.php
  89. +111 −0 aws-sdk/utilities/json.class.php
  90. +54 −0 aws-sdk/utilities/manifest.class.php
  91. +223 −0 aws-sdk/utilities/mimetypes.class.php
  92. +134 −0 aws-sdk/utilities/policy.class.php
  93. +63 −0 aws-sdk/utilities/request.class.php
  94. +29 −0 aws-sdk/utilities/response.class.php
  95. +215 −0 aws-sdk/utilities/simplexml.class.php
  96. +52 −0 aws-sdk/utilities/stacktemplate.class.php
  97. +91 −0 aws-sdk/utilities/stepconfig.class.php
  98. +394 −0 aws-sdk/utilities/utilities.class.php
  99. +19 −0 aws-sdk/yaml/LICENSE
  100. +15 −0 aws-sdk/yaml/README.markdown
  101. +135 −0 aws-sdk/yaml/lib/sfYaml.php
  102. +60 −0 aws-sdk/yaml/lib/sfYamlDumper.php
  103. +442 −0 aws-sdk/yaml/lib/sfYamlInline.php
  104. +612 −0 aws-sdk/yaml/lib/sfYamlParser.php
  105. +141 −0 base.php
  106. +4 −0 config.inc.php
  107. +12 −0 css/ios.css
  108. +66 −0 css/reveal.css
  109. +173 −0 css/styles.css
  110. +79 −0 css/ui.css
  111. +134 −0 css/ui.progress-bar.css
  112. +20 −0 ec2_status.php
  113. BIN img/modal-gloss.png
  114. BIN img/overlay.png
  115. +193 −0 index.php
  116. +160 −0 js/jquery.reveal.js
  117. +66 −0 js/progress.js
@@ -0,0 +1,48 @@
+# ThinkUp Launcher
+
+A one-click web page for simply booting your own private EC2 instance running ThinkUp.
+
+**THIS IS ALPHA SOFTWARE.**
+
+## Installation
+
+Requires PHP 5. Drop in a directory on your webserver, and edit config.php to point to your directory name. The rest should just work.
+
+## What It Does
+
+Nothing is saved or stored on the server. Your AWS keys are used only for the EC2 API requests.
+
+After submitting your keys, ThinkUp Launcher does the following:
+
+* Creates a new "thinkup" security group for the user, if it doesn't
+already exist.
+* Creates a new "thinkup" key pair for the user, if it doesn't exist.
+* Using a pre-built Ubuntu AMI with all of ThinkUp's prerequisites,
+starts an EC2 micro instance in the us-east availability zone.
+* Downloads and installs the latest ThinkUp beta from Github.
+* Creates the new MySQL user and tables with a randomly-generated password.
+* Gives the user the link to the new ThinkUp install with their MySQL credentials.
+
+## Thanks
+
+ThinkUp Launcher uses the following projects.
+
+jQuery and jQuery UI:
+http://jquery.com/
+
+Amazon SDK for PHP:
+http://aws.amazon.com/sdkforphp/
+
+Mark Dotto's 3D Text:
+http://www.markdotto.com/2011/01/05/3d-text-using-just-css/
+
+Ivan Vanderbyl's Pure CSS Progress Bar:
+http://skunkworks.ivanvanderbyl.com/
+
+Zurb's Reveal Modal Plugin for jQuery:
+http://www.zurb.com/playground/reveal-modal-plugin
+
+## Comments?
+
+All push requests and feedback appreciated.
+
@@ -0,0 +1,66 @@
+<?php if (!class_exists('CFRuntime')) die('No direct access allowed.');
+/**
+ * Stores your AWS account information. Add your account information, and then rename this file
+ * to 'config.inc.php'.
+ *
+ * @version 2011.01.20
+ * @license See the included NOTICE.md file for more information.
+ * @copyright See the included NOTICE.md file for more information.
+ * @link http://aws.amazon.com/php/ PHP Developer Center
+ * @link http://aws.amazon.com/security-credentials AWS Security Credentials
+ */
+
+
+/**
+ * Amazon Web Services Key. Found in the AWS Security Credentials. You can also pass this value as the first
+ * parameter to a service constructor.
+ */
+define('AWS_KEY', '');
+
+/**
+ * Amazon Web Services Secret Key. Found in the AWS Security Credentials. You can also pass this value as
+ * the second parameter to a service constructor.
+ */
+define('AWS_SECRET_KEY', '');
+
+/**
+ * Amazon Account ID without dashes. Used for identification with Amazon EC2. Found in the AWS Security
+ * Credentials.
+ */
+define('AWS_ACCOUNT_ID', '');
+
+/**
+ * Your CanonicalUser ID. Used for setting access control settings in AmazonS3. Found in the AWS Security
+ * Credentials.
+ */
+define('AWS_CANONICAL_ID', '');
+
+/**
+ * Your CanonicalUser DisplayName. Used for setting access control settings in AmazonS3. Found in the AWS
+ * Security Credentials (i.e. "Welcome, AWS_CANONICAL_NAME").
+ */
+define('AWS_CANONICAL_NAME', '');
+
+/**
+ * 12-digit serial number taken from the Gemalto device used for Multi-Factor Authentication. Ignore this
+ * if you're not using MFA.
+ */
+define('AWS_MFA_SERIAL', '');
+
+/**
+ * Amazon CloudFront key-pair to use for signing private URLs. Found in the AWS Security Credentials. This
+ * can be set programmatically with <AmazonCloudFront::set_keypair_id()>.
+ */
+define('AWS_CLOUDFRONT_KEYPAIR_ID', '');
+
+/**
+ * The contents of the *.pem private key that matches with the CloudFront key-pair ID. Found in the AWS
+ * Security Credentials. This can be set programmatically with <AmazonCloudFront::set_private_key()>.
+ */
+define('AWS_CLOUDFRONT_PRIVATE_KEY_PEM', '');
+
+/**
+ * Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF". If enabled,
+ * load `sdk.class.php` last to avoid clobbering any other autoloaders.
+ */
+define('AWS_ENABLE_EXTENSIONS', 'false');
@@ -0,0 +1,66 @@
+<?php if (!class_exists('CFRuntime')) die('No direct access allowed.');
+/**
+ * Stores your AWS account information. Add your account information, and then rename this file
+ * to 'config.inc.php'.
+ *
+ * @version 2011.01.20
+ * @license See the included NOTICE.md file for more information.
+ * @copyright See the included NOTICE.md file for more information.
+ * @link http://aws.amazon.com/php/ PHP Developer Center
+ * @link http://aws.amazon.com/security-credentials AWS Security Credentials
+ */
+
+
+/**
+ * Amazon Web Services Key. Found in the AWS Security Credentials. You can also pass this value as the first
+ * parameter to a service constructor.
+ */
+define('AWS_KEY', '');
+
+/**
+ * Amazon Web Services Secret Key. Found in the AWS Security Credentials. You can also pass this value as
+ * the second parameter to a service constructor.
+ */
+define('AWS_SECRET_KEY', '');
+
+/**
+ * Amazon Account ID without dashes. Used for identification with Amazon EC2. Found in the AWS Security
+ * Credentials.
+ */
+define('AWS_ACCOUNT_ID', '');
+
+/**
+ * Your CanonicalUser ID. Used for setting access control settings in AmazonS3. Found in the AWS Security
+ * Credentials.
+ */
+define('AWS_CANONICAL_ID', '');
+
+/**
+ * Your CanonicalUser DisplayName. Used for setting access control settings in AmazonS3. Found in the AWS
+ * Security Credentials (i.e. "Welcome, AWS_CANONICAL_NAME").
+ */
+define('AWS_CANONICAL_NAME', '');
+
+/**
+ * 12-digit serial number taken from the Gemalto device used for Multi-Factor Authentication. Ignore this
+ * if you're not using MFA.
+ */
+define('AWS_MFA_SERIAL', '');
+
+/**
+ * Amazon CloudFront key-pair to use for signing private URLs. Found in the AWS Security Credentials. This
+ * can be set programmatically with <AmazonCloudFront::set_keypair_id()>.
+ */
+define('AWS_CLOUDFRONT_KEYPAIR_ID', '');
+
+/**
+ * The contents of the *.pem private key that matches with the CloudFront key-pair ID. Found in the AWS
+ * Security Credentials. This can be set programmatically with <AmazonCloudFront::set_private_key()>.
+ */
+define('AWS_CLOUDFRONT_PRIVATE_KEY_PEM', '');
+
+/**
+ * Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF". If enabled,
+ * load `sdk.class.php` last to avoid clobbering any other autoloaders.
+ */
+define('AWS_ENABLE_EXTENSIONS', 'false');
@@ -0,0 +1,171 @@
+<?php
+/*
+ * Copyright 2010-2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file is distributed
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+
+class S3BrowserUpload extends AmazonS3
+{
+ /**
+ * The <code>POST</code> operation adds an object to a specified bucket using HTML forms. POST is an alternate
+ * form of <code>PUT</code> that enables browser-based uploads as a way of putting objects in buckets.
+ * Parameters that are passed to <code>PUT</code> via HTTP headers are instead passed as form fields to
+ * <code>POST</code> in the <code>multipart/form-data</code> encoded message body. You must have
+ * <code>WRITE</code> access on a bucket to add an object to it. Amazon S3 never stores partial objects: if
+ * you receive a successful response, you can be confident the entire object was stored.
+ *
+ * @param string $bucket (Required) The name of the bucket to use.
+ * @param string|integer $expires (Optional) The point in time when the upload form field should expire. The default value is <code>+1 hour</code>.
+ * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
+ * <li><code>acl</code> - <code>string</code> - Optional - The access control setting to apply to the uploaded file. Accepts any of the following constants: [Allowed values: <code>AmazonS3::ACL_PRIVATE</code>, <code>AmazonS3::ACL_PUBLIC</code>, <code>AmazonS3::ACL_OPEN</code>, <code>AmazonS3::ACL_AUTH_READ</code>, <code>AmazonS3::ACL_OWNER_READ</code>, <code>AmazonS3::ACL_OWNER_FULL_CONTROL</code>].</li>
+ * <li><code>Cache-Control</code> - <code>string</code> - Optional - The Cache-Control HTTP header value to apply to the uploaded file. To use a <code>starts-with</code> comparison instead of an <code>equals</code> comparison, prefix the value with a <code>^</code> (carat) character.</li>
+ * <li><code>Content-Disposition</code> - <code>string</code> - Optional - The Content-Disposition HTTP header value to apply to the uploaded file. To use a <code>starts-with</code> comparison instead of an <code>equals</code> comparison, prefix the value with a <code>^</code> (carat) character.</li>
+ * <li><code>Content-Encoding</code> - <code>string</code> - Optional - The Content-Encoding HTTP header value to apply to the uploaded file. To use a <code>starts-with</code> comparison instead of an <code>equals</code> comparison, prefix the value with a <code>^</code> (carat) character.</li>
+ * <li><code>Content-Type</code> - <code>string</code> - Optional - The Content-Type HTTP header value to apply to the uploaded file. The default value is <code>application/octet-stream</code>. To use a <code>starts-with</code> comparison instead of an <code>equals</code> comparison, prefix the value with a <code>^</code> (carat) character.</li>
+ * <li><code>Expires</code> - <code>string</code> - Optional - The Expires HTTP header value to apply to the uploaded file. To use a <code>starts-with</code> comparison instead of an <code>equals</code> comparison, prefix the value with a <code>^</code> (carat) character.</li>
+ * <li><code>key</code> - <code>string</code> - Optional - The location where the file should be uploaded to. The default value is <code>${filename}</code>.</li>
+ * <li><code>success_action_redirect</code> - <code>string</code> - Optional - The URI for Amazon S3 to redirect to upon successful upload.</li>
+ * <li><code>success_action_status</code> - <code>integer</code> - Optional - The status code for Amazon S3 to return upon successful upload.</li>
+ * <li><code>x-amz-storage-class</code> - <code>string</code> - Optional - The storage setting to apply to the object. [Allowed values: <code>AmazonS3::STORAGE_STANDARD</code>, <code>AmazonS3::STORAGE_REDUCED</code>]. The default value is <code>AmazonS3::STORAGE_STANDARD</code>.</li>
+ * <li>x-amz-meta-*</li>
+ * </ul>
+ * @return array An array of fields that can be converted into markup.
+ * @link http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPOST.html POST Object
+ */
+ public function generate_upload_parameters($bucket, $expires = '+1 hour', $opt = null)
+ {
+ if (!$opt) $opt = array();
+
+ // Policy document
+ $policy = array(
+ 'conditions' => array(
+ array('bucket' => $bucket),
+ )
+ );
+
+ // Basic form
+ $form = array();
+ $form['form'] = array(
+ 'action' => $bucket . '.s3.amazonaws.com',
+ 'method' => 'POST',
+ 'enctype' => 'multipart/form-data'
+ );
+
+ // Inputs
+ $form['inputs'] = array(
+ 'AWSAccessKeyId' => $this->key
+ );
+
+ // Expires
+ if ($expires)
+ {
+ if (is_numeric($expires))
+ {
+ $expires = gmdate('j M Y, g:i a Z', (integer) $expires);
+ }
+
+ $expires = $this->util->convert_date_to_iso8601($expires);
+ $policy['expiration'] = (string) $expires;
+ }
+
+ // Default values
+ if (!isset($opt['key']))
+ {
+ $opt['key'] = '${filename}';
+ }
+
+ // Success Action Status
+ if (isset($opt['success_action_status']) && !empty($opt['success_action_status']))
+ {
+ $form['inputs']['success_action_status'] = (string) $opt['success_action_status'];
+ $policy['conditions'][] = array(
+ 'success_action_status' => (string) $opt['success_action_status']
+ );
+ unset($opt['success_action_status']);
+ }
+
+ // Other parameters
+ foreach ($opt as $param_key => $param_value)
+ {
+ if ($param_value[0] === '^')
+ {
+ $form['inputs'][$param_key] = substr((string) $param_value, 1);
+ $param_value = preg_replace('/\$\{(\w*)\}/', '', (string) $param_value);
+ $policy['conditions'][] = array('starts-with', '$' . $param_key, (substr((string) $param_value, 1) ? substr((string) $param_value, 1) : ''));
+ }
+ else
+ {
+ $form['inputs'][$param_key] = (string) $param_value;
+ $policy['conditions'][] = array(
+ $param_key => (string) $param_value
+ );
+ }
+ }
+
+ // Add policy
+ $json_policy = json_encode($policy);
+ $json_policy_b64 = base64_encode($json_policy);
+ $form['inputs']['policy'] = $json_policy_b64;
+ $form['metadata']['json_policy'] = $json_policy;
+
+ // Add signature
+ $form['inputs']['signature'] = base64_encode(hash_hmac('sha1', $json_policy_b64, $this->secret_key, true));
+
+ return $form;
+ }
+
+
+ /*%******************************************************************************************%*/
+ // HELPERS
+
+ /**
+ * Returns the protocol of the web page that this script is currently running on. This method only works
+ * correctly when run from a publicly-accessible web page.
+ */
+ public static function protocol()
+ {
+ return (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) === 'on') ? 'https://' : 'http://';
+ }
+
+ /**
+ * Returns the domain (and port) of the web page that this script is currently running on. This method
+ * only works correctly when run from a publicly-accessible web page.
+ */
+ public static function domain()
+ {
+ if (isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']))
+ {
+ return $_SERVER['SERVER_NAME'] . ((integer) $_SERVER['SERVER_PORT'] === 80 ? '' : ':' . $_SERVER['SERVER_PORT']);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the URI of the web page that this script is currently running on. This method only works
+ * correctly when run from a publicly-accessible web page.
+ */
+ public static function current_uri()
+ {
+ if (isset($_SERVER['REQUEST_URI']))
+ {
+ $uri = self::protocol();
+ $uri .= self::domain();
+ $uri .= $_SERVER['REQUEST_URI'];
+ return $uri;
+ }
+
+ return null;
+ }
+}
@@ -0,0 +1,25 @@
+Copyright (c) 2006-2010 Ryan Parman, Foleeo Inc., and contributors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are
+permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ * Neither the name of Ryan Parman, Foleeo Inc. nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
+AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
+A simple caching system for PHP5 that provides a single interface for a variety of storage types.
@@ -0,0 +1,5 @@
+The .sql files in this directory contain the code to create the tables for database caching.
+
+If you're not using database caching, you can safely ignore these.
+
+If you ARE using database caching, simply load the correct *.sql file into your database to set up the required tables.
@@ -0,0 +1,7 @@
+CREATE TABLE `cache` (
+ `id` char(40) NOT NULL default '',
+ `expires` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
+ `data` longtext,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `id` (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8
Oops, something went wrong.

0 comments on commit 5d9599a

Please sign in to comment.