Remove whitespace [Gun.io WhitespaceBot]

This commit is contained in:
Gun.io Whitespace Robot 2011-10-29 09:45:46 -04:00
parent 80c1d9baf8
commit fd20014e82
77 changed files with 550 additions and 550 deletions

View file

@ -13,7 +13,7 @@
### How does OpenPhoto work? ### How does OpenPhoto work?
OpenPhoto works similarly to Flickr, Smugmug and other photo sharing services with one major difference: you retain ownership and give OpenPhoto access to use them. OpenPhoto works similarly to Flickr, Smugmug and other photo sharing services with one major difference: you retain ownership and give OpenPhoto access to use them.
All photos, tags and comments are stored in your personal cloud accounts with companies like Amazon, Rackspace or Google. All photos, tags and comments are stored in your personal cloud accounts with companies like Amazon, Rackspace or Google.
This means you can easily switch between OpenPhoto services, use more than one at a time or stop using them altogether while retaining all of your photos, tags and comments. This means you can easily switch between OpenPhoto services, use more than one at a time or stop using them altogether while retaining all of your photos, tags and comments.
---------------------------------------- ----------------------------------------
@ -22,15 +22,15 @@ This means you can easily switch between OpenPhoto services, use more than one a
While OpenPhoto functions like many existing services it's drastically different for several reasons. While OpenPhoto functions like many existing services it's drastically different for several reasons.
1. **Ownership** 1. **Ownership**
Users can specify where their photos are stored. By default they are seamlessly stored in your [Amazon S3][s3] bucket. Users can specify where their photos are stored. By default they are seamlessly stored in your [Amazon S3][s3] bucket.
1. **Built in backups** 1. **Built in backups**
Since you upload photos to your own [Amazon S3][s3] bucket it's like uploading and archiving your photos in one step. Since you upload photos to your own [Amazon S3][s3] bucket it's like uploading and archiving your photos in one step.
1. **Portability** 1. **Portability**
Easily start off by signing up for a hosted OpenPhoto account and later switch to hosting the software yourself. There's no need to transfer your photos somewhere else since it's federated. It's like plug and play. Easily start off by signing up for a hosted OpenPhoto account and later switch to hosting the software yourself. There's no need to transfer your photos somewhere else since it's federated. It's like plug and play.
1. **Durability** 1. **Durability**
Your photos are not tied to any particular photo service. Because everything is open you can write your own web interface for your photos, choose between OpenPhoto hosting providers or install the OpenPhoto software on your own server. Your photos are not tied to any particular photo service. Because everything is open you can write your own web interface for your photos, choose between OpenPhoto hosting providers or install the OpenPhoto software on your own server.
1. **Community** 1. **Community**
New features will be entirely community driven. Features with the most votes will get top priority in getting implemented. If you want a feature that doesn't have many votes you can implement it yourself and issue a pull request. New features will be entirely community driven. Features with the most votes will get top priority in getting implemented. If you want a feature that doesn't have many votes you can implement it yourself and issue a pull request.
---------------------------------------- ----------------------------------------

View file

@ -16,13 +16,13 @@ Every API returns a JSON response adhering to the following format.
#### Message #### Message
The _message_ is a string which describes the action taken. The _message_ is a string which describes the action taken.
It's purely for informational purposes and should never be used in your code or relied on. It's purely for informational purposes and should never be used in your code or relied on.
#### Code #### Code
The _code_ is an integer representing the status of the API call. The _code_ is an integer representing the status of the API call.
Typically the _code_ value should be _200_ but anything between _200_ and _299_ indicates a successful response. Typically the _code_ value should be _200_ but anything between _200_ and _299_ indicates a successful response.
The photo upload API, for example, will return a _202_ response indicating that the resource has been created. The photo upload API, for example, will return a _202_ response indicating that the resource has been created.
Below are some common codes: Below are some common codes:
@ -35,7 +35,7 @@ Below are some common codes:
#### Result #### Result
The _result_ can be any simple or complex value. The _result_ can be any simple or complex value.
Consult the documentation for the endpoint you're using for information on what the _result_ will be. Consult the documentation for the endpoint you're using for information on what the _result_ will be.
The purpose of the _result_ is to allow you to continue processing the request. The purpose of the _result_ is to allow you to continue processing the request.
We'll try to return the information you'll most likely need and aim to keep you from having to make a subsequent call to get it. We'll try to return the information you'll most likely need and aim to keep you from having to make a subsequent call to get it.

View file

@ -72,7 +72,7 @@ The response is in a standard [response envelope][Envelope].
"result" : { "result" : {
"previous" : { "previous" : {
"tags" : [ "tags" : [
], ],
"id" : "bo", "id" : "bo",
"appId" : "openphoto-frontend", "appId" : "openphoto-frontend",
@ -109,7 +109,7 @@ The response is in a standard [response envelope][Envelope].
}, },
"next" : { "next" : {
"tags" : [ "tags" : [
], ],
"id" : "63", "id" : "63",
"appId" : "current.openphoto.me", "appId" : "current.openphoto.me",

View file

@ -34,7 +34,7 @@ _Authentication: optional_
<a name="parameters"></a> <a name="parameters"></a>
### Parameters ### Parameters
1. returnSizes (optional), The photo sizes you'd like in the response. Specify every size you plan on using. [Docs for this parameter][ReturnSizes] 1. returnSizes (optional), The photo sizes you'd like in the response. Specify every size you plan on using. [Docs for this parameter][ReturnSizes]
1. pageSize (optional), Number of photos to return per request. 1. pageSize (optional), Number of photos to return per request.
1. page (optional), Page number when browsing through photos. Starts at 1. 1. page (optional), Page number when browsing through photos. Starts at 1.
1. tags (optional), _i.e. dog,cat_ - A comma delimited string of strings. 1. tags (optional), _i.e. dog,cat_ - A comma delimited string of strings.

View file

@ -86,7 +86,7 @@ The response is in a standard [response envelope][Envelope].
}, },
{ {
"id": "Sunnyvale", "id": "Sunnyvale",
"count":23 "count":23
"latitude": 13.579, "latitude": 13.579,
"longitude": 24.68 "longitude": 24.68
}, },

View file

@ -18,7 +18,7 @@ Open Photo API / Photo Upload
<a name="purpose"></a> <a name="purpose"></a>
### Purpose of the Photo update API ### Purpose of the Photo update API
This API is used to update an existing photo's metadata for a user. This API is used to update an existing photo's metadata for a user.
---------------------------------------- ----------------------------------------

View file

@ -18,7 +18,7 @@ Open Photo API / Photo Upload
<a name="purpose"></a> <a name="purpose"></a>
### Purpose of the Photo Upload API ### Purpose of the Photo Upload API
This API is used to upload a new photo for a user. This API is used to upload a new photo for a user.
---------------------------------------- ----------------------------------------

View file

@ -2,7 +2,7 @@ Documentation
======================= =======================
#### OpenPhoto, a photo service for the masses #### OpenPhoto, a photo service for the masses
This is a list of common questions that people have about OpenPhoto. This is a list of common questions that people have about OpenPhoto.
If you have one which is not on this list send us a message via <a href="http://twitter.com/openphoto">Twitter</a> or <a href="mailto:hello@openphoto.me">email</a>. If you have one which is not on this list send us a message via <a href="http://twitter.com/openphoto">Twitter</a> or <a href="mailto:hello@openphoto.me">email</a>.
### What exactly is OpenPhoto? ### What exactly is OpenPhoto?
@ -11,33 +11,33 @@ The short answer is that OpenPhoto is a way to store and share your photos witho
The long answer is that OpenPhoto consists of two parts: a specification and an implementation. The long answer is that OpenPhoto consists of two parts: a specification and an implementation.
The specification is a set of guidelines that define exactly how your photos are stored, how they are accessed and much more. The specification is a set of guidelines that define exactly how your photos are stored, how they are accessed and much more.
This helps make the entire system open and enables other developers to build functionality on top of your photos. This helps make the entire system open and enables other developers to build functionality on top of your photos.
The documentation makes up the majority of the specification. The documentation makes up the majority of the specification.
The implementation is code which adheres to the specification and provides functionality. The implementation is code which adheres to the specification and provides functionality.
The OpenPhoto.me website is an example where the funtionality provided is the ability to store and share photos. The OpenPhoto.me website is an example where the funtionality provided is the ability to store and share photos.
Another example would be if a developer created an Instagram like application adhering to the specification. Another example would be if a developer created an Instagram like application adhering to the specification.
That would be another implementation which provides the functionality of easily sharing photos from your phone with filters. That would be another implementation which provides the functionality of easily sharing photos from your phone with filters.
---------------------------------------- ----------------------------------------
### What makes OpenPhoto different from Flickr, Smugmug, iCloud or any other service? ### What makes OpenPhoto different from Flickr, Smugmug, iCloud or any other service?
Normally you pay one company to store your photos and to provide services to share them. Normally you pay one company to store your photos and to provide services to share them.
This means that you can't do much if they raise their prices, shut down their service or another site comes along. This means that you can't do much if they raise their prices, shut down their service or another site comes along.
These sites may offer APIs but they typically enable addon services and rarely competing services. These sites may offer APIs but they typically enable addon services and rarely competing services.
Your photos are still stored on the company's servers who provide the base service. Your photos are still stored on the company's servers who provide the base service.
With OpenPhoto you can switch between services, use more than one at a time or stop using the service and continue to have your photos stored. With OpenPhoto you can switch between services, use more than one at a time or stop using the service and continue to have your photos stored.
---------------------------------------- ----------------------------------------
### If OpenPhoto is open sourced then why isn't it free? ### If OpenPhoto is open sourced then why isn't it free?
For clarity, OpenPhoto is both free and open sourced (FOSS). For clarity, OpenPhoto is both free and open sourced (FOSS).
Typically what you end up paying for is storage from someone like Amazon or Rackspace. Typically what you end up paying for is storage from someone like Amazon or Rackspace.
Amazon offers 5GB of storage for free which means if you don't need any additional space then using OpenPhoto is entirely free. Amazon offers 5GB of storage for free which means if you don't need any additional space then using OpenPhoto is entirely free.

View file

@ -4,15 +4,15 @@ OpenPhoto / Glossary
The OpenPhoto stack consists of various components. Below is a glossary of all the terms you need to know so you can understand the overall system. The OpenPhoto stack consists of various components. Below is a glossary of all the terms you need to know so you can understand the overall system.
1. **Amazon S3** 1. **Amazon S3**
[Amazon S3][s3] stands for Simple Storage Service. [Amazon S3][s3] stands for Simple Storage Service.
1. **Amazon SimpleDb** 1. **Amazon SimpleDb**
[Amazon SimpleDb][simpledb] is a non-relational database system. [Amazon SimpleDb][simpledb] is a non-relational database system.
1. **Data Source** 1. **Data Source**
The Data Source stores all textual data for a given user. Each user's Data Source may be different. The default Data Source is data.openphoto.me as a CNAME to [Amazon SimpleDb][simpledb]. The Data Source stores all textual data for a given user. Each user's Data Source may be different. The default Data Source is data.openphoto.me as a CNAME to [Amazon SimpleDb][simpledb].
1. **File System** 1. **File System**
The File System stores all high and low resolution photos for a given user. Each user's File System may be different. The default File System is file.openphoto.me as a CNAME to [Amazon S3][s3]. The File System stores all high and low resolution photos for a given user. Each user's File System may be different. The default File System is file.openphoto.me as a CNAME to [Amazon S3][s3].
1. **Adapter** 1. **Adapter**
Adapters are middleware that allows the base system to communicate with various Data Sources and File Systems. Adapters exist for [Amazon S3][s3] and [Amazon SimpleDb][simpledb]. Adapters are middleware that allows the base system to communicate with various Data Sources and File Systems. Adapters exist for [Amazon S3][s3] and [Amazon SimpleDb][simpledb].
1. **Open Photo API** 1. **Open Photo API**
[The Open Photo API][openphotoapi] which this software is built on and also allows others to build applications on top of. [The Open Photo API][openphotoapi] which this software is built on and also allows others to build applications on top of.

View file

@ -17,7 +17,7 @@ This call returns the following response.
{ {
"code" : 200, "code" : 200,
"message" : "Photo 63", "message" : "Photo 63",
"result" : { "result" : {
"appId" : "current.openphoto.me", "appId" : "current.openphoto.me",
"creativeCommons" : "BY-NC", "creativeCommons" : "BY-NC",
"dateTaken" : "1313010850", "dateTaken" : "1313010850",
@ -57,10 +57,10 @@ The most important keys in the response are `path123x123` and `path200x200`. Eit
It's important to realize that the photo isn't generated and stored until this URL is called. This typically happens when the browser tries to display this photo. Once that has happened then the _123x123_ version exists both in the database and file system and calling the same API again returns a different URL for `path123x123`. It's important to realize that the photo isn't generated and stored until this URL is called. This typically happens when the browser tries to display this photo. Once that has happened then the _123x123_ version exists both in the database and file system and calling the same API again returns a different URL for `path123x123`.
{ {
"code" : 200, "code" : 200,
"message" : "Photo 63", "message" : "Photo 63",
"result" : { "result" : {
"appId" : "current.openphoto.me", "appId" : "current.openphoto.me",
"creativeCommons" : "BY-NC", "creativeCommons" : "BY-NC",
"dateTaken" : "1313010850", "dateTaken" : "1313010850",
@ -99,7 +99,7 @@ The URL for `path123x123` now points to a static resource.
You can specify multiple sizes for the `returnSizes` delimited by commas. You can specify multiple sizes for the `returnSizes` delimited by commas.
curl "http://current.openphoto.me/photo/63.json?returnSizes=123x123,300x300xBW" curl "http://current.openphoto.me/photo/63.json?returnSizes=123x123,300x300xBW"
### Understanding options for returnSizes ### Understanding options for returnSizes
The `returnSizes` parameter takes values in the form of _WxH[[xA]xB]_ which means it starts with a numeric _width_ and _height_. The most simple form is limited to specifying just a _width_ and _height_. This looks like `200x200` or `125x300`. The `returnSizes` parameter takes values in the form of _WxH[[xA]xB]_ which means it starts with a numeric _width_ and _height_. The most simple form is limited to specifying just a _width_ and _height_. This looks like `200x200` or `125x300`.

View file

@ -4,7 +4,7 @@
# Run with sudo for best results # Run with sudo for best results
####################################### #######################################
SECONDS=0 SECONDS=0
if [[ "$(/usr/bin/whoami)" != "root" ]]; then if [[ "$(/usr/bin/whoami)" != "root" ]]; then
echo "This script must be run as root or using sudo.Script aborted." echo "This script must be run as root or using sudo.Script aborted."
exit 1 exit 1
fi fi
@ -104,7 +104,7 @@ echo ""
# finding IP address and compensating for possible EC2 installation # finding IP address and compensating for possible EC2 installation
EC2=`curl --silent --connect-timeout 1 http://169.254.169.254/latest/meta-data/public-hostname` EC2=`curl --silent --connect-timeout 1 http://169.254.169.254/latest/meta-data/public-hostname`
if [[ $EC2 != "" ]]; if [[ $EC2 != "" ]];
then then
IP=`echo $EC2 | sed -rn 's/ec2-(.*?)\.compute.*/\1/p' | sed 's/-/./g'` IP=`echo $EC2 | sed -rn 's/ec2-(.*?)\.compute.*/\1/p' | sed 's/-/./g'`
else else

View file

@ -30,7 +30,7 @@ Before setting up your server you'll need to make sure you have your cloud accou
1. Click back to Instances and wait for new instance to finish starting. 1. Click back to Instances and wait for new instance to finish starting.
1. Once started, click on the new instance in the web interface, copy the public DNS information. 1. Once started, click on the new instance in the web interface, copy the public DNS information.
### Launching your OpenPhoto site ### Launching your OpenPhoto site
Now you're ready to launch your OpenPhoto site. Point your browser to your new EC2 host and you'll be taken to a setup screen. You'll need your cloud account credentiato continue. Now you're ready to launch your OpenPhoto site. Point your browser to your new EC2 host and you'll be taken to a setup screen. You'll need your cloud account credentiato continue.
@ -47,10 +47,10 @@ Once you complete the 3 steps your site will be up and running and you'll be red
Open a terminal or SSH client, using your amazon ec2 ssh public key, ssh into the instance as the ubuntu user using the public DNS information for your instance. Open a terminal or SSH client, using your amazon ec2 ssh public key, ssh into the instance as the ubuntu user using the public DNS information for your instance.
ssh -i amazon-key.pem ubuntu@new-instance.amazonaws.com ssh -i amazon-key.pem ubuntu@new-instance.amazonaws.com
Verify the apache user has write access to the /home/ubuntu/openphoto/src/configs directory. Verify the apache user has write access to the /home/ubuntu/openphoto/src/configs directory.
cd /home/ubuntu/openphoto/src/ cd /home/ubuntu/openphoto/src/
ls -ld ./configs ls -ld ./configs
drwxr-xr-x 3 www-data www-data 4096 2011-08-20 02:37 configs drwxr-xr-x 3 www-data www-data 4096 2011-08-20 02:37 configs

View file

@ -6,9 +6,9 @@ OpenPhoto
### What are schemas? ### What are schemas?
Schemas are the blueprint for various objects in the OpenPhoto platform. Schemas are the blueprint for various objects in the OpenPhoto platform.
The most logical example is the [Photo][Photo] object which represents a single photo in a user's photo collection. The most logical example is the [Photo][Photo] object which represents a single photo in a user's photo collection.
Their photo library consists of a collection of [Photo][Photo] objects. Their photo library consists of a collection of [Photo][Photo] objects.
Other examples are a [User][User] object and [Action][Action] object. Other examples are a [User][User] object and [Action][Action] object.
---------------------------------------- ----------------------------------------

View file

@ -6,7 +6,7 @@
Order deny,allow Order deny,allow
Allow from all Allow from all
Options FollowSymLinks Options FollowSymLinks
RewriteEngine on RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
@ -21,7 +21,7 @@
AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</Directory> </Directory>
# 404 Not Found for ini files # 404 Not Found for ini files
@ -36,7 +36,7 @@
ExpiresByType image/jpg "A604800" ExpiresByType image/jpg "A604800"
ExpiresByType image/jpeg "A604800" ExpiresByType image/jpeg "A604800"
ExpiresByType image/png "A604800" ExpiresByType image/png "A604800"
Header set Cache-Control "must-revalidate" Header set Cache-Control "must-revalidate"
FileETag MTime Size FileETag MTime Size
</VirtualHost> </VirtualHost>

View file

@ -20,7 +20,7 @@
AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</Directory> </Directory>
# 404 Not Found for ini files # 404 Not Found for ini files
@ -35,7 +35,7 @@
ExpiresByType image/jpg "A604800" ExpiresByType image/jpg "A604800"
ExpiresByType image/jpeg "A604800" ExpiresByType image/jpeg "A604800"
ExpiresByType image/png "A604800" ExpiresByType image/png "A604800"
Header set Cache-Control "must-revalidate" Header set Cache-Control "must-revalidate"
FileETag MTime Size FileETag MTime Size
</VirtualHost> </VirtualHost>

View file

@ -36,7 +36,7 @@
var scope = scope || window; var scope = scope || window;
lib( element ).live(etype, lib.proxy(callback, scope) ); lib( element ).live(etype, lib.proxy(callback, scope) );
//key events need to use bind, for some reason only gets triggered //key events need to use bind, for some reason only gets triggered
//when you input in textareas or inputs with jQuery //when you input in textareas or inputs with jQuery
if (etype === "keydown" || etype === "keypress" || etype === "keyup") { if (etype === "keydown" || etype === "keypress" || etype === "keyup") {
@ -58,8 +58,8 @@
lib( element ).die( type ); lib( element ).die( type );
} }
/** /**
* Makes an ajax post request * Makes an ajax post request
* @param {string} url to make request to * @param {string} url to make request to
@ -70,9 +70,9 @@
* @method makeRequest * @method makeRequest
*/ */
OU.makeRequest = function(url, data, callback, format) { OU.makeRequest = function(url, data, callback, format) {
lib.post(url, data, callback, format); lib.post(url, data, callback, format);
} }

View file

@ -14,8 +14,8 @@
var PLUGIN_FILE_PREFIX = 'openphoto-lib-', var PLUGIN_FILE_PREFIX = 'openphoto-lib-',
BROWSER_ID_SRC = 'https://browserid.org/include.js', BROWSER_ID_SRC = 'https://browserid.org/include.js',
log = function(msg) { if(typeof(console) !== 'undefined') { console.log(msg); } }; log = function(msg) { if(typeof(console) !== 'undefined') { console.log(msg); } };
/** /**
* Class that contains all utility functions for OpenPhoto * Class that contains all utility functions for OpenPhoto
* We can use a Constructor function in this case since we will * We can use a Constructor function in this case since we will
@ -26,7 +26,7 @@
function Util() { function Util() {
/** /**
* default configuration options * default configuration options
* user can optionally specify an onComplete attribute in the css/js * user can optionally specify an onComplete attribute in the css/js
* object which will execute when the assets are loaded. * object which will execute when the assets are loaded.
* @type {object} * @type {object}
@ -50,7 +50,7 @@
* @property eventMap * @property eventMap
*/ */
this.eventMap = { this.eventMap = {
'click': { 'click': {
'action-box-click':'click:action-box', 'action-box-click':'click:action-box',
'action-delete-click':'click:action-delete', 'action-delete-click':'click:action-delete',
@ -71,12 +71,12 @@
'settings-click':'click:settings', 'settings-click':'click:settings',
'webhook-delete-click':'click:webhook-delete' 'webhook-delete-click':'click:webhook-delete'
}, },
'keydown': { 'keydown': {
37: 'keydown:browse-previous', 37: 'keydown:browse-previous',
39: 'keydown:browse-next' 39: 'keydown:browse-next'
} }
}; };
/** /**
@ -85,20 +85,20 @@
* @property _customEvents * @property _customEvents
*/ */
this._customEvents = {}; this._customEvents = {};
/** /**
* Count of the number of scripts loaded * Count of the number of scripts loaded
* @type {Number} * @type {Number}
* @property _scriptLoadCount * @property _scriptLoadCount
*/ */
this._scriptLoadCount = 0; this._scriptLoadCount = 0;
/** /**
* Count of the number of css loaded * Count of the number of css loaded
* @type {Number} * @type {Number}
* @property _cssLoadCount * @property _cssLoadCount
*/ */
this._cssLoadCount = 0; this._cssLoadCount = 0;
/** /**
* initialization method * initialization method
@ -124,7 +124,7 @@
// we specify what library type in the .ini file // we specify what library type in the .ini file
// either jQuery or YUI - and then the user can load // either jQuery or YUI - and then the user can load
// additional css/js assets by specifying the files in the // additional css/js assets by specifying the files in the
// js config - as specified by the plugin file (that will be user generated). // js config - as specified by the plugin file (that will be user generated).
//the library is a requirement, by default jQuery will be loaded //the library is a requirement, by default jQuery will be loaded
@ -143,7 +143,7 @@
* @method _init * @method _init
*/ */
this._init = function() { this._init = function() {
log('[Util] _init:') log('[Util] _init:')
var js = this.config.js.assets, var js = this.config.js.assets,
@ -151,7 +151,7 @@
i, i,
length; length;
//attach events //attach events
this.attachEvent( 'body', 'click', this.onviewevent, this); this.attachEvent( 'body', 'click', this.onviewevent, this);
this.attachEvent( 'body', 'keydown', this.onkeydownevent, this); this.attachEvent( 'body', 'keydown', this.onkeydownevent, this);
@ -162,10 +162,10 @@
//load additional css in order specified //load additional css in order specified
for(i=0, j=css.length; i<j; i++) { for(i=0, j=css.length; i<j; i++) {
this.loadCss( css[i], this._handleCssLoad, this ); this.loadCss( css[i], this._handleCssLoad, this );
} }
}; };
/** /**
* handles events - delegates based on className * handles events - delegates based on className
@ -182,19 +182,19 @@
length = classes.length, length = classes.length,
map = this.eventMap[e.type], map = this.eventMap[e.type],
cls; cls;
while (length--) { while (length--) {
cls = classes[length]; cls = classes[length];
if (map[cls]) { if (map[cls]) {
//do not prevent the default action, let the callback //do not prevent the default action, let the callback
//function do it if it wants //function do it if it wants
this.fire( map[cls], e); this.fire( map[cls], e);
} }
} }
}; };
/** /**
* handles keydown events * handles keydown events
* @param {Event} e * @param {Event} e
@ -203,7 +203,7 @@
*/ */
this.onkeydownevent = function(e) { this.onkeydownevent = function(e) {
log('[Util] keydownevent: ' + e.target); log('[Util] keydownevent: ' + e.target);
var targ = e.target || e.srcElement, var targ = e.target || e.srcElement,
classes = targ.className.split(" "), classes = targ.className.split(" "),
length = classes.length, length = classes.length,
@ -211,38 +211,38 @@
nodeName = targ.nodeName.toLowerCase(), nodeName = targ.nodeName.toLowerCase(),
keyCode = e.keyCode, keyCode = e.keyCode,
cls; cls;
if (nodeName === "textarea" || nodeName === "input") { if (nodeName === "textarea" || nodeName === "input") {
//i don't think there is a case where the user needs to know //i don't think there is a case where the user needs to know
//if the user is inputing text, but just in case, lets fire //if the user is inputing text, but just in case, lets fire
//a custom event on user input //a custom event on user input
this.fire( 'keydown:user-input', e); this.fire( 'keydown:user-input', e);
} else { } else {
//the event map for key press can be two dimensional, it can be //the event map for key press can be two dimensional, it can be
//keycode, or className then keyCode, if keyCode, fire the custom event //keycode, or className then keyCode, if keyCode, fire the custom event
if (map[keyCode]) { if (map[keyCode]) {
this.fire( map[keyCode], e); this.fire( map[keyCode], e);
} }
//both className and keycode //both className and keycode
while (length--) { while (length--) {
cls = classes[length]; cls = classes[length];
if (map[cls] && map[cls][keyCode]) { if (map[cls] && map[cls][keyCode]) {
//do not prevent the default action, let the callback //do not prevent the default action, let the callback
//function do it if it wants //function do it if it wants
this.fire( map[cls][keyCode], e); this.fire( map[cls][keyCode], e);
} }
} }
} }
}; };
/* ------------------------------------------------- /* -------------------------------------------------
* Utilities * Utilities
* ------------------------------------------------- */ * ------------------------------------------------- */
@ -264,9 +264,9 @@
//load the script and attach the event handlers onload //load the script and attach the event handlers onload
this.loadScript(url, this._init, this); this.loadScript(url, this._init, this);
this.loadScript(BROWSER_ID_SRC); this.loadScript(BROWSER_ID_SRC);
}; };
/** /**
* Shallow merge of all objects passed into it in order of the objects passed in * Shallow merge of all objects passed into it in order of the objects passed in
* this is just needed to merge the config, but will probably be overwritten by * this is just needed to merge the config, but will probably be overwritten by
@ -295,7 +295,7 @@
return merged; return merged;
}; };
/** /**
* Utility function to dynamically load a script * Utility function to dynamically load a script
@ -306,7 +306,7 @@
* @method loadScript * @method loadScript
*/ */
this.loadScript = function(url, fn, scope) { this.loadScript = function(url, fn, scope) {
log('[Util] loadScript'); log('[Util] loadScript');
var head = document.getElementsByTagName('head')[0], var head = document.getElementsByTagName('head')[0],
@ -334,7 +334,7 @@
} }
head.appendChild(script); head.appendChild(script);
}; };
@ -347,7 +347,7 @@
* @method loadScript * @method loadScript
*/ */
this.loadCss = function(url, fn, scope) { this.loadCss = function(url, fn, scope) {
log('[Util] loadCss'); log('[Util] loadCss');
var head = document.getElementsByTagName('head')[0], var head = document.getElementsByTagName('head')[0],
@ -376,9 +376,9 @@
} }
head.appendChild(link); head.appendChild(link);
}; };
/** /**
* The user can specify a callback to execute when all of the javascript assets * The user can specify a callback to execute when all of the javascript assets
* have loaded. This helper method keeps track of the number of javascript assets * have loaded. This helper method keeps track of the number of javascript assets
@ -387,15 +387,15 @@
* @method _handleScriptLoad * @method _handleScriptLoad
*/ */
this._handleScriptLoad = function() { this._handleScriptLoad = function() {
this._scriptLoadCount++; this._scriptLoadCount++;
if ( (this._scriptLoadCount === this.config.js.assets.length) && (typeof(this.config.js.onComplete) !== 'undefined')) { if ( (this._scriptLoadCount === this.config.js.assets.length) && (typeof(this.config.js.onComplete) !== 'undefined')) {
this.config.js.onComplete(); this.config.js.onComplete();
} }
} }
/** /**
* The user can specify a callback to execute when all of the css assets * The user can specify a callback to execute when all of the css assets
* have loaded. This helper method keeps track of the number of css assets * have loaded. This helper method keeps track of the number of css assets
@ -404,13 +404,13 @@
* @method _handleCssLoad * @method _handleCssLoad
*/ */
this._handleCssLoad = function() { this._handleCssLoad = function() {
this._cssLoadCount++; this._cssLoadCount++;
if ( (this._cssLoadCount === this.config.css.assets.length) && (typeof(this.config.css.onComplete) !== 'undefined')) { if ( (this._cssLoadCount === this.config.css.assets.length) && (typeof(this.config.css.onComplete) !== 'undefined')) {
this.config.css.onComplete(); this.config.css.onComplete();
} }
} }
/** /**
@ -419,7 +419,7 @@
* @method detectLibrary * @method detectLibrary
*/ */
this.detectLibrary = function() { this.detectLibrary = function() {
//very simple for now, but we can extend it later //very simple for now, but we can extend it later
var lib = ''; var lib = '';
@ -438,16 +438,16 @@
} }
return lib; return lib;
}; };
/* ------------------------------------------------- /* -------------------------------------------------
* Custom Events * Custom Events
* ------------------------------------------------- */ * ------------------------------------------------- */
/** /**
* Subscribe to a custom event - the callback will be executed when the custom event is fired * Subscribe to a custom event - the callback will be executed when the custom event is fired
* @param {string} eventName - the name of the custom event to subscribe to * @param {string} eventName - the name of the custom event to subscribe to
* @param {Function} callback - the callback function that will be executed when the event is fired * @param {Function} callback - the callback function that will be executed when the event is fired
* @param {Object} scope - the scope of the callback function (what this will refer to) * @param {Object} scope - the scope of the callback function (what this will refer to)
@ -508,7 +508,7 @@
} }
} }
} }
}; };
/** /**
@ -532,8 +532,8 @@
} }
}; };
/** /**
* Object containing everything needed to upload photos * Object containing everything needed to upload photos
* *
@ -562,7 +562,7 @@
returnSizes : "25x25xCR", returnSizes : "25x25xCR",
crumb : null crumb : null
}, },
parent : this, parent : this,
droppedFiles : {}, droppedFiles : {},
simultaneousUploads : 0, simultaneousUploads : 0,
@ -570,8 +570,8 @@
uploadQueue : [], uploadQueue : [],
uploadQueueIndex : 0, uploadQueueIndex : 0,
xhrs : [], xhrs : [],
/** /**
* initialize upload area and functions * initialize upload area and functions
* @param {object} options - object defining options to override defaults * @param {object} options - object defining options to override defaults
@ -588,7 +588,7 @@
this._fallbackUploader(); this._fallbackUploader();
} }
}, },
/** /**
* enable or disable duplicate photo name checking * enable or disable duplicate photo name checking
* @param {bool} state should duplicates be allowed? * @param {bool} state should duplicates be allowed?
@ -602,10 +602,10 @@
this.options.allowDuplicates = false; this.options.allowDuplicates = false;
} }
}, },
_uploadEventHandlers : function() { _uploadEventHandlers : function() {
/* /*
TODO prevent page from leaving with confirmation if user drops photo in wrong TODO prevent page from leaving with confirmation if user drops photo in wrong
place or hits key to navigate before all uploads are done place or hits key to navigate before all uploads are done
*/ */
var that = this; var that = this;
@ -614,7 +614,7 @@
that._addListener(that.dropZone, 'dragleave', that._handleDragLeave, that); that._addListener(that.dropZone, 'dragleave', that._handleDragLeave, that);
that._addListener(that.dropZone, 'drop', that._handleFileDrop, that); that._addListener(that.dropZone, 'drop', that._handleFileDrop, that);
}, },
/** /**
* wrapper for addEventListener to enable passing along the 'that' context * wrapper for addEventListener to enable passing along the 'that' context
* @param target dom element to attach to * @param target dom element to attach to
@ -630,30 +630,30 @@
callback(e,context); callback(e,context);
}, false); }, false);
}, },
_handleDragEnter : function(e, that) { _handleDragEnter : function(e, that) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
that.options.dragEnterCallback() that.options.dragEnterCallback()
}, },
_handleDragLeave : function(e, that) { _handleDragLeave : function(e, that) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
that.options.dragLeaveCallback(); that.options.dragLeaveCallback();
}, },
/** /**
* when user's mouse moves over dropzone while draggin files * when user's mouse moves over dropzone while draggin files
* *
* if we don't prevent default, dropping the file * if we don't prevent default, dropping the file
* wil cause the browser to redirect to the file location * wil cause the browser to redirect to the file location
**/ **/
_handleDragOver : function(e, that) { _handleDragOver : function(e, that) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}, },
_handleFileDrop : function(e, that) { _handleFileDrop : function(e, that) {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
@ -661,7 +661,7 @@
var files = e.dataTransfer.files; var files = e.dataTransfer.files;
that._checkForDuplicates(files); that._checkForDuplicates(files);
}, },
_checkForDuplicates : function(files) { _checkForDuplicates : function(files) {
var that = this; var that = this;
if (!that.allowDuplicates) { if (!that.allowDuplicates) {
@ -678,7 +678,7 @@
} }
that._validateIsImage(files); that._validateIsImage(files);
}, },
_validateIsImage : function(files) { _validateIsImage : function(files) {
var that = this; var that = this;
/* /*
@ -687,7 +687,7 @@
// that.options.notImageCallback(); // that.options.notImageCallback();
that._indexAndStack(files); that._indexAndStack(files);
}, },
/** /**
* each file receives a reference number so that it can be correlated to * each file receives a reference number so that it can be correlated to
* its coresponding UI representation * its coresponding UI representation
@ -700,8 +700,8 @@
} }
that.options.pushToUICallback(files); that.options.pushToUICallback(files);
}, },
// theme must call this to start uploading files // theme must call this to start uploading files
kickOffUploads : function() { kickOffUploads : function() {
var that = this; var that = this;
@ -721,14 +721,14 @@
} }
} }
}, },
_ajaxToServer : function(file) { _ajaxToServer : function(file) {
var that = this; var that = this;
that.simultaneousUploads++; that.simultaneousUploads++;
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
that.xhrs.push(xhr); that.xhrs.push(xhr);
var formData = new FormData(); var formData = new FormData();
formData.append("crumb",that.options.crumb); formData.append("crumb",that.options.crumb);
formData.append("returnSizes",that.options.returnSizes); formData.append("returnSizes",that.options.returnSizes);
@ -736,8 +736,8 @@
formData.append("license", that.options.photoLicense(file.queueIndex)); formData.append("license", that.options.photoLicense(file.queueIndex));
formData.append("tags", that.options.photoTags(file.queueIndex)); formData.append("tags", that.options.photoTags(file.queueIndex));
formData.append("permission", that.options.permission(file.queueIndex)); formData.append("permission", that.options.permission(file.queueIndex));
xhr.open("POST", that.options.uploadPath, true); xhr.open("POST", that.options.uploadPath, true);
xhr.onload = function(e) { xhr.onload = function(e) {
that.simultaneousUploads--; that.simultaneousUploads--;
// tell theme we finished // tell theme we finished
@ -751,10 +751,10 @@
that.options.uploadProgressCallback(file.queueIndex, progress); that.options.uploadProgressCallback(file.queueIndex, progress);
} }
}; };
xhr.send(formData); xhr.send(formData);
}, },
_fallbackUploader : function() { _fallbackUploader : function() {
/* /*
TODO actually fallback to other uploader TODO actually fallback to other uploader

View file

@ -7,12 +7,12 @@ var opTheme = (function() {
init: { init: {
attach: function(PhotoSwipe) { attach: function(PhotoSwipe) {
$('div.gallery-page').live('pageshow', function(e){ $('div.gallery-page').live('pageshow', function(e){
var var
currentPage = $(e.target), currentPage = $(e.target),
photoSwipeInstanceId = parseInt(Math.random()*10000), photoSwipeInstanceId = parseInt(Math.random()*10000),
photoSwipeInstance = PhotoSwipe.getInstance(photoSwipeInstanceId) photoSwipeInstance = PhotoSwipe.getInstance(photoSwipeInstanceId)
options = {}; options = {};
if ($("ul.gallery a").length > 0 && (typeof photoSwipeInstance === "undefined" || photoSwipeInstance === null)) { if ($("ul.gallery a").length > 0 && (typeof photoSwipeInstance === "undefined" || photoSwipeInstance === null)) {
photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options, photoSwipeInstanceId); photoSwipeInstance = $("ul.gallery a", e.target).photoSwipe(options, photoSwipeInstanceId);
} }

View file

@ -10,22 +10,22 @@ var opTheme = (function() {
log("keyboard!!!!"); log("keyboard!!!!");
}, },
actionDelete: function(ev) { actionDelete: function(ev) {
ev.preventDefault(); ev.preventDefault();
var el = $(ev.target), var el = $(ev.target),
url = el.attr('href')+'.json' url = el.attr('href')+'.json'
id = el.attr('data-id'); id = el.attr('data-id');
OP.Util.makeRequest(url, el.parent().serializeArray(), function(response) { OP.Util.makeRequest(url, el.parent().serializeArray(), function(response) {
if(response.code === 200) if(response.code === 200)
$(".action-container-"+id).hide('medium', function(){ $(this).remove(); }); $(".action-container-"+id).hide('medium', function(){ $(this).remove(); });
else else
opTheme.message.error('Could not delete the photo.'); opTheme.message.error('Could not delete the photo.');
}, 'json'); }, 'json');
return false; return false;
}, },
commentJump: function(ev) { commentJump: function(ev) {
ev.preventDefault(); ev.preventDefault();
@ -75,11 +75,11 @@ var opTheme = (function() {
}); });
}, },
photoDelete: function(ev) { photoDelete: function(ev) {
ev.preventDefault(); ev.preventDefault();
var el = $(ev.target), var el = $(ev.target),
url = el.parent().attr('action')+'.json'; url = el.parent().attr('action')+'.json';
OP.Util.makeRequest(url, el.parent().serializeArray(), function(response) { OP.Util.makeRequest(url, el.parent().serializeArray(), function(response) {
if(response.code === 200) { if(response.code === 200) {
el.html('This photo has been deleted'); el.html('This photo has been deleted');
@ -315,7 +315,7 @@ var opTheme = (function() {
} }
} }
}, },
upload: { upload: {
init: function() { init: function() {
var that = this; // that references upload var that = this; // that references upload
@ -338,7 +338,7 @@ var opTheme = (function() {
that.licenseChange(); that.licenseChange();
} }
}, },
options : { options : {
simultaneousUploadLimit : 3, simultaneousUploadLimit : 3,
frameId : "uploader-frame", frameId : "uploader-frame",
@ -347,7 +347,7 @@ var opTheme = (function() {
returnSizes : "50x50xCR", returnSizes : "50x50xCR",
allowDuplicates : false allowDuplicates : false
}, },
licenseChange : function() { licenseChange : function() {
$("#uploader-frame .license").bind("change", function() { $("#uploader-frame .license").bind("change", function() {
if ($(this).val() == "_custom_") { if ($(this).val() == "_custom_") {
@ -359,33 +359,33 @@ var opTheme = (function() {
} }
}); });
}, },
/** /**
* !! REMINDER !! * !! REMINDER !!
* These functions are going to be called from within the * These functions are going to be called from within the
* opTheme.upload.options object so 'this' points back to * opTheme.upload.options object so 'this' points back to
* the options object * the options object
**/ **/
dragEnter : function() { dragEnter : function() {
this.$dropZone.removeClass("waiting active").addClass("hover"); this.$dropZone.removeClass("waiting active").addClass("hover");
}, },
dragLeave : function() { dragLeave : function() {
this.$dropZone.removeClass("hover").addClass("active"); this.$dropZone.removeClass("hover").addClass("active");
}, },
dragDrop : function() { dragDrop : function() {
this.$dropZone.removeClass("hover").addClass("active"); this.$dropZone.removeClass("hover").addClass("active");
}, },
duplicate : function() { duplicate : function() {
opTheme.message.error("duplicate image"); opTheme.message.error("duplicate image");
}, },
notImage : function() { notImage : function() {
opTheme.message.error("not an image file"); opTheme.message.error("not an image file");
}, },
pushToUI : function(files) { pushToUI : function(files) {
// get current tags and license data to apply to each photo // get current tags and license data to apply to each photo
var tags = $("#uploader-frame .tags").val(); var tags = $("#uploader-frame .tags").val();
@ -402,17 +402,17 @@ var opTheme = (function() {
this.$dropZone.append(html.join("")); this.$dropZone.append(html.join(""));
OP.Util.upload.kickOffUploads(); OP.Util.upload.kickOffUploads();
}, },
uploadStart : function(queueIndex) { uploadStart : function(queueIndex) {
$("#file-"+queueIndex).removeClass("waiting").addClass("uploading"); $("#file-"+queueIndex).removeClass("waiting").addClass("uploading");
}, },
uploadProgress : function(queueIndex, percent) { uploadProgress : function(queueIndex, percent) {
$("#file-"+queueIndex+" .progress").animate({ $("#file-"+queueIndex+" .progress").animate({
"width":percent+"%" "width":percent+"%"
}, 500); }, 500);
}, },
uploadFinished : function(queueIndex, status, response) { uploadFinished : function(queueIndex, status, response) {
var thisClass = response.code == 202 ? 'finished' : 'error'; var thisClass = response.code == 202 ? 'finished' : 'error';
$("#file-"+queueIndex+" .progress").addClass(thisClass); $("#file-"+queueIndex+" .progress").addClass(thisClass);
@ -420,15 +420,15 @@ var opTheme = (function() {
if(response.code == 202) if(response.code == 202)
$("#file-"+queueIndex).append("<img class='thumb' src='"+response.result.path50x50xCR+"'/>"); $("#file-"+queueIndex).append("<img class='thumb' src='"+response.result.path50x50xCR+"'/>");
}, },
permission : function(queueIndex) { permission : function(queueIndex) {
return $("#file-"+queueIndex).attr("permission"); return $("#file-"+queueIndex).attr("permission");
}, },
photoLicense : function(queueIndex) { photoLicense : function(queueIndex) {
return $("#file-"+queueIndex).attr("license"); return $("#file-"+queueIndex).attr("license");
}, },
photoTags : function(queueIndex) { photoTags : function(queueIndex) {
return $("#file-"+queueIndex).attr("tags"); return $("#file-"+queueIndex).attr("tags");
} }
@ -457,7 +457,7 @@ var opTheme = (function() {
$('form.validate').each(opTheme.formHandlers.init); $('form.validate').each(opTheme.formHandlers.init);
} }
}, },
message: { message: {
close: function() { close: function() {
if(timeoutId != undefined) { if(timeoutId != undefined) {

View file

@ -44,8 +44,8 @@ header>div{
height:48px; height:48px;
border-bottom:solid 1px #fff; border-bottom:solid 1px #fff;
} }
header ul{ header ul{
list-style-type:none; list-style-type:none;
display: inline-block; display: inline-block;
position:relative; position:relative;
left:200px; left:200px;
@ -74,7 +74,7 @@ header ul li a{
} }
div#searchbar{ div#searchbar{
display:none; display:none;
position:relative; position:relative;
width:226px; width:226px;
top:1px; top:1px;
padding:10px; padding:10px;
@ -110,12 +110,12 @@ div#photos ul.grid>li {
width:200px; width:200px;
height:225px; height:225px;
padding: 25px 40px 25px 0; padding: 25px 40px 25px 0;
} }
div#photos ul.grid>li>a>img{ div#photos ul.grid>li>a>img{
-moz-box-shadow: 2px 2px 2px #888; -moz-box-shadow: 2px 2px 2px #888;
-webkit-box-shadow: 2px 2px 2px #888; -webkit-box-shadow: 2px 2px 2px #888;
} }
div#photos ul.grid ul.options { div#photos ul.grid ul.options {
margin:0; margin:0;
padding:0; padding:0;
list-style:none; list-style:none;

View file

@ -52,7 +52,7 @@ div#upload ul#upload-queue div.progress{
-moz-border-radius-bottomright: 4px; -moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomleft: 4px;
-webkit-border-radius: 0px 0px 4px 4px; -webkit-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px; border-radius: 0px 0px 4px 4px;
} }
div#upload ul#upload-queue div.progress > div{ div#upload ul#upload-queue div.progress > div{
@ -61,7 +61,7 @@ div#upload ul#upload-queue div.progress > div{
-moz-border-radius-bottomright: 4px; -moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomleft: 4px;
-webkit-border-radius: 0px 0px 4px 4px; -webkit-border-radius: 0px 0px 4px 4px;
border-radius: 0px 0px 4px 4px; border-radius: 0px 0px 4px 4px;
background-image:url("../images/progress.gif"); background-image:url("../images/progress.gif");
} }
div#upload ul#upload-queue div.progress > div.complete{ div#upload ul#upload-queue div.progress > div.complete{
@ -103,9 +103,9 @@ div#upload ul#upload-queue div.progress > div.complete{
#drop-zone .photo { width: 100%; position: relative; height: 32px; z-index: 5; padding: 17px 0 6px 0;} #drop-zone .photo { width: 100%; position: relative; height: 32px; z-index: 5; padding: 17px 0 6px 0;}
#drop-zone .photo .name { margin-left: 60px; } #drop-zone .photo .name { margin-left: 60px; }
#drop-zone .photo .size { float: right; margin-right: 5px; } #drop-zone .photo .size { float: right; margin-right: 5px; }
#drop-zone .photo > span.progress { #drop-zone .photo > span.progress {
z-index: -1; z-index: -1;
display: block; display: block;
height: 100%; height: 100%;
background-color: #e5e88b; background-color: #e5e88b;
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e5e88b), color-stop(1, #f0f2ac)); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e5e88b), color-stop(1, #f0f2ac));
@ -119,7 +119,7 @@ div#upload ul#upload-queue div.progress > div.complete{
top: 0px; top: 0px;
overflow: hidden; overflow: hidden;
} }
#drop-zone .photo > span.progress.finished { #drop-zone .photo > span.progress.finished {
background-color: rgb(43,194,83); background-color: rgb(43,194,83);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(43,194,83)), color-stop(1, rgb(84,240,84)) ); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(43,194,83)), color-stop(1, rgb(84,240,84)) );
background-image: -webkit-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% ); background-image: -webkit-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
@ -127,7 +127,7 @@ div#upload ul#upload-queue div.progress > div.complete{
background-image: -ms-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% ); background-image: -ms-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
background-image: -o-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% ); background-image: -o-linear-gradient( center bottom, rgb(43,194,83) 37%, rgb(84,240,84) 69% );
} }
#drop-zone .photo > span.progress.error { #drop-zone .photo > span.progress.error {
background-color: rgb(214,105,163); background-color: rgb(214,105,163);
background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(214,105,163)), color-stop(1, rgb(235,113,178)) ); background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, rgb(214,105,163)), color-stop(1, rgb(235,113,178)) );
background-image: -webkit-linear-gradient( center bottom, rgb(214,105,163) 37%, rgb(235,113,178) 69% ); background-image: -webkit-linear-gradient( center bottom, rgb(214,105,163) 37%, rgb(235,113,178) 69% );

View file

@ -1,20 +1,20 @@
<div data-role="page" data-add-back-btn="true" id="Gallery1" class="gallery-page" data-theme="c"> <div data-role="page" data-add-back-btn="true" id="Gallery1" class="gallery-page" data-theme="c">
<div data-role="header" class="photoheader" data-theme="c"></div> <div data-role="header" class="photoheader" data-theme="c"></div>
<div data-role="content"> <div data-role="content">
<form id="search-photo-form" action="/photos/list" method="get"> <form id="search-photo-form" action="/photos/list" method="get">
<div data-role="fieldcontain" class="center-wrapper"> <div data-role="fieldcontain" class="center-wrapper">
<input type="search" name="tags" id="tags" placeholder="search your photos ..."/> <input type="search" name="tags" id="tags" placeholder="search your photos ..."/>
</div> </div>
</form> </form>
<ul data-role="listview" data-inset="true"> <ul data-role="listview" data-inset="true">
<li><a href="/photos/list"><img <li><a href="/photos/list"><img
src="<?php getTheme()->asset('image', 'header-navigation-photos.png'); ?>" alt="my photos" src="<?php getTheme()->asset('image', 'header-navigation-photos.png'); ?>" alt="my photos"
class="ui-li-icon">Photos</a></li> class="ui-li-icon">Photos</a></li>
<li><a href="/tags/list"><img <li><a href="/tags/list"><img
src="<?php getTheme()->asset('image', 'header-navigation-tags.png'); ?>" alt="tags" src="<?php getTheme()->asset('image', 'header-navigation-tags.png'); ?>" alt="tags"
class="ui-li-icon">Tags</a></li> class="ui-li-icon">Tags</a></li>
</ul> </ul>
</div> </div>
<div data-role="footer" data-theme="c"> <div data-role="footer" data-theme="c">
<h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4> <h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4>

View file

@ -2,7 +2,7 @@
<div data-role="header" class="photoheader" data-theme="c"> <div data-role="header" class="photoheader" data-theme="c">
<a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a> <a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<div class="photo-details"> <div class="photo-details">
<div class="image-pagination"> <div class="image-pagination">
<?php if(!empty($photo['previous'])) { ?> <?php if(!empty($photo['previous'])) { ?>
@ -53,9 +53,9 @@
</ul> </ul>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<div data-role="footer" data-theme="c"> <div data-role="footer" data-theme="c">
<h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4> <h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4>
</div> </div>

View file

@ -2,7 +2,7 @@
<div data-role="header" class="photoheader" data-theme="c"> <div data-role="header" class="photoheader" data-theme="c">
<a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a> <a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<?php if(!empty($photos)) { ?> <?php if(!empty($photos)) { ?>
<ul class="gallery"> <ul class="gallery">
<?php foreach($photos as $photo) { ?> <?php foreach($photos as $photo) { ?>
@ -14,7 +14,7 @@
<h2>Sorry, no photos to see.</h2> <h2>Sorry, no photos to see.</h2>
<?php } ?> <?php } ?>
</div> </div>
<div data-role="footer" data-theme="c"> <div data-role="footer" data-theme="c">
<h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4> <h4>The OpenPhoto Project &#169; <?php echo date('Y'); ?></h4>
</div> </div>

View file

@ -2,7 +2,7 @@
<div data-role="header" class="photoheader" data-theme="c"> <div data-role="header" class="photoheader" data-theme="c">
<a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a> <a href="/" data-icon="home" class="ui-btn-right" rel="external">Home</a>
</div> </div>
<div data-role="content"> <div data-role="content">
<?php if(empty($tags)) { ?> <?php if(empty($tags)) { ?>
Sorry, no photos have been tagged. Sorry, no photos have been tagged.
<?php } else { ?> <?php } else { ?>

View file

@ -55,8 +55,8 @@
js: { js: {
assets: [ assets: [
'<?php getTheme()->asset('javascript', 'jquery.scrollTo-1.4.2-min.js'); ?>', '<?php getTheme()->asset('javascript', 'jquery.scrollTo-1.4.2-min.js'); ?>',
'<?php getTheme()->asset('javascript', 'jquery.fileupload.min.js'); ?>', '<?php getTheme()->asset('javascript', 'jquery.fileupload.min.js'); ?>',
'<?php getTheme()->asset('javascript', 'jquery.cycle.min.js '); ?>', '<?php getTheme()->asset('javascript', 'jquery.cycle.min.js '); ?>',
'<?php getTheme()->asset('javascript', 'openphoto-theme.js'); ?>' '<?php getTheme()->asset('javascript', 'openphoto-theme.js'); ?>'
], ],
onComplete: function(){ opTheme.init.attach(); } onComplete: function(){ opTheme.init.attach(); }

View file

@ -23,7 +23,7 @@ class DatabaseMySql implements DatabaseInterface
public function __construct() public function __construct()
{ {
$mysql = getConfig()->get('mysql'); $mysql = getConfig()->get('mysql');
EpiDatabase::employ('mysql', $mysql->mySqlDb, EpiDatabase::employ('mysql', $mysql->mySqlDb,
$mysql->mySqlHost, $mysql->mySqlUser, Utility::decrypt($mysql->mySqlPassword)); $mysql->mySqlHost, $mysql->mySqlUser, Utility::decrypt($mysql->mySqlPassword));
foreach($mysql as $key => $value) { foreach($mysql as $key => $value) {
$this->{$key} = $value; $this->{$key} = $value;
@ -189,7 +189,7 @@ class DatabaseMySql implements DatabaseInterface
* Retrieve group from the database specified by $id * Retrieve group from the database specified by $id
* *
* @param string $id id of the group to return * @param string $id id of the group to return
* @return mixed Array on success, FALSE on failure * @return mixed Array on success, FALSE on failure
*/ */
public function getGroup($id = null) public function getGroup($id = null)
{ {
@ -206,7 +206,7 @@ class DatabaseMySql implements DatabaseInterface
* Retrieve groups from the database optionally filter by member (email) * Retrieve groups from the database optionally filter by member (email)
* *
* @param string $email email address to filter by * @param string $email email address to filter by
* @return mixed Array on success, NULL on empty, FALSE on failure * @return mixed Array on success, NULL on empty, FALSE on failure
*/ */
public function getGroups($email = null) public function getGroups($email = null)
{ {
@ -900,9 +900,9 @@ class DatabaseMySql implements DatabaseInterface
$photo['appId'] = getConfig()->get('application')->appId; $photo['appId'] = getConfig()->get('application')->appId;
$versions = $this->getPhotoVersions($photo['id']); $versions = $this->getPhotoVersions($photo['id']);
if($versions && !empty($versions)) if($versions && !empty($versions))
{ {
foreach($versions as $version) foreach($versions as $version)
{ {
$photo[$version['key']] = $version['path']; $photo[$version['key']] = $version['path'];
} }
@ -1054,7 +1054,7 @@ class DatabaseMySql implements DatabaseInterface
{ {
$params['::bindings'] = $bindings; $params['::bindings'] = $bindings;
} }
return $params; return $params;
} }
/** Prepare credential to store in the database /** Prepare credential to store in the database
*/ */
@ -1105,7 +1105,7 @@ class DatabaseMySql implements DatabaseInterface
/** /**
* Check the Db Version. * Check the Db Version.
* *
* This shouldn't fail unless you don't have database access * This shouldn't fail unless you don't have database access
* But if the DB is empty (ie don't have the tables), it returns 0 * But if the DB is empty (ie don't have the tables), it returns 0
* @return the numeric version. 0 means no DB * @return the numeric version. 0 means no DB
@ -1134,7 +1134,7 @@ class DatabaseMySql implements DatabaseInterface
{ {
if($version < 1) if($version < 1)
return false; return false;
switch($version) { switch($version) {
case 1: case 1:
// after version 1 we added credential // after version 1 we added credential
// //

View file

@ -11,7 +11,7 @@ class DatabaseSimpleDb implements DatabaseInterface
* Member variables holding the names to the SimpleDb domains needed and the database object itself. * Member variables holding the names to the SimpleDb domains needed and the database object itself.
* @access private * @access private
*/ */
private $db, $domainAction, $domainCredential, $domainPhoto, private $db, $domainAction, $domainCredential, $domainPhoto,
$domainTag, $domainUser, $domainWebhook, $errors = array(); $domainTag, $domainUser, $domainWebhook, $errors = array();
/** /**
@ -213,7 +213,7 @@ class DatabaseSimpleDb implements DatabaseInterface
* Retrieve group from the database specified by $id * Retrieve group from the database specified by $id
* *
* @param string $id id of the group to return * @param string $id id of the group to return
* @return mixed Array on success, FALSE on failure * @return mixed Array on success, FALSE on failure
*/ */
public function getGroup($id = null) public function getGroup($id = null)
{ {
@ -229,7 +229,7 @@ class DatabaseSimpleDb implements DatabaseInterface
* Retrieve groups from the database optionally filter by member (email) * Retrieve groups from the database optionally filter by member (email)
* *
* @param string $email email address to filter by * @param string $email email address to filter by
* @return mixed Array on success, NULL on empty, FALSE on failure * @return mixed Array on success, NULL on empty, FALSE on failure
*/ */
public function getGroups($email = null) public function getGroups($email = null)
{ {
@ -450,7 +450,7 @@ class DatabaseSimpleDb implements DatabaseInterface
$this->logErrors($res); $this->logErrors($res);
if(!$res->isOK()) if(!$res->isOK())
return false; return false;
if(isset($res->body->SelectResult)) if(isset($res->body->SelectResult))
{ {
@ -480,7 +480,7 @@ class DatabaseSimpleDb implements DatabaseInterface
if(count($domains) == 7) if(count($domains) == 7)
return true; return true;
$domainsToCreate = array($this->domainAction, $this->domainCredential, $this->domainGroup, $domainsToCreate = array($this->domainAction, $this->domainCredential, $this->domainGroup,
$this->domainPhoto, $this->domainTag, $this->domainUser, $this->domainWebhook); $this->domainPhoto, $this->domainTag, $this->domainUser, $this->domainWebhook);
$queue = new CFBatchRequest(); $queue = new CFBatchRequest();

View file

@ -6,7 +6,7 @@
* @author Hub Figuiere <hub@figuiere.net> * @author Hub Figuiere <hub@figuiere.net>
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class FileSystemDropboxBase class FileSystemDropboxBase
{ {
private $parent; private $parent;
public function __construct($parent) public function __construct($parent)

View file

@ -9,7 +9,7 @@ class ApiController extends BaseController
/** /**
* A diagnostics endpoint used to verify backends are working. * A diagnostics endpoint used to verify backends are working.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function diagnostics() public static function diagnostics()
{ {
@ -32,7 +32,7 @@ class ApiController extends BaseController
/** /**
* A diagnostics endpoint used to verify calls are working. * A diagnostics endpoint used to verify calls are working.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function hello() public static function hello()
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Group controller for API endpoints. * Group controller for API endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class ApiGroupController extends BaseController class ApiGroupController extends BaseController
@ -10,7 +10,7 @@ class ApiGroupController extends BaseController
* Create a new group * Create a new group
* Returns the newly created group or false as the response data * Returns the newly created group or false as the response data
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function create() public static function create()
{ {
@ -31,7 +31,7 @@ class ApiGroupController extends BaseController
/** /**
* Delete a group * Delete a group
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function delete($id) public static function delete($id)
{ {
@ -48,7 +48,7 @@ class ApiGroupController extends BaseController
* Update an existing group * Update an existing group
* Returns the newly created group or false as the response data * Returns the newly created group or false as the response data
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function update($id) public static function update($id)
{ {
@ -70,7 +70,7 @@ class ApiGroupController extends BaseController
/** /**
* Get the owner's groups * Get the owner's groups
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function list_() public static function list_()
{ {
@ -87,7 +87,7 @@ class ApiGroupController extends BaseController
* Get the owner's group as specified by the groupId * Get the owner's group as specified by the groupId
* *
* @param string $id The id of the group * @param string $id The id of the group
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function view($id) public static function view($id)
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* OAuth controller for API endpoints. * OAuth controller for API endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class ApiOAuthController extends BaseController class ApiOAuthController extends BaseController

View file

@ -427,7 +427,7 @@ class ApiPhotoController extends BaseController
$filters['permission'] = $permission; $filters['permission'] = $permission;
elseif($permission == -1) elseif($permission == -1)
$filters['groups'] = $groupIds; $filters['groups'] = $groupIds;
return array('filters' => $filters, 'pageSize' => $pageSize, 'protocol' => $protocol, 'page' => $page); return array('filters' => $filters, 'pageSize' => $pageSize, 'protocol' => $protocol, 'page' => $page);
} }
} }

View file

@ -10,7 +10,7 @@ class ApiTagController extends BaseController
/** /**
* Delete a tag in the tag database. * Delete a tag in the tag database.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function delete($tag) public static function delete($tag)
{ {
@ -25,7 +25,7 @@ class ApiTagController extends BaseController
/** /**
* Create a tag in the tag database. * Create a tag in the tag database.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function create() public static function create()
{ {
@ -38,7 +38,7 @@ class ApiTagController extends BaseController
/** /**
* Update a tag in the tag database. * Update a tag in the tag database.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function update($tag) public static function update($tag)
{ {
@ -60,7 +60,7 @@ class ApiTagController extends BaseController
/** /**
* Return all tags. * Return all tags.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function view() public static function view()
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* User controller for API endpoints. * User controller for API endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class ApiUserController extends BaseController class ApiUserController extends BaseController
@ -9,7 +9,7 @@ class ApiUserController extends BaseController
/** /**
* Log a user in via BrowserID * Log a user in via BrowserID
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function login() public static function login()
{ {
@ -23,7 +23,7 @@ class ApiUserController extends BaseController
/** /**
* Log a user in via mobilePassphrase * Log a user in via mobilePassphrase
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function loginMobile() public static function loginMobile()
{ {
@ -41,7 +41,7 @@ class ApiUserController extends BaseController
/** /**
* Log a user out. * Log a user out.
* *
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function logout() public static function logout()
{ {
@ -53,7 +53,7 @@ class ApiUserController extends BaseController
* Update a group * Update a group
* *
* @param string $id id of the group to update * @param string $id id of the group to update
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function postGroup($id = null) public static function postGroup($id = null)
{ {

View file

@ -21,7 +21,7 @@ class ApiWebhookController extends BaseController
return self::success("Webhook {$id} created", array_merge(array('id' => $id), $params)); return self::success("Webhook {$id} created", array_merge(array('id' => $id), $params));
else else
return self::error("Error creating webhook {$id}", false); return self::error("Error creating webhook {$id}", false);
} }
/** /**
* Delete a webhook specified by the ID. * Delete a webhook specified by the ID.
@ -32,7 +32,7 @@ class ApiWebhookController extends BaseController
public static function delete($id) public static function delete($id)
{ {
//getAuthentication()->requireAuthentication(); //getAuthentication()->requireAuthentication();
$status = Webhook::delete($id); $status = Webhook::delete($id);
if($status) if($status)
return self::success('Webhook deleted successfully', true); return self::success('Webhook deleted successfully', true);
else else

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Base controller extended by all other controllers. * Base controller extended by all other controllers.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class BaseController class BaseController
@ -20,7 +20,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function created($message, $result = null) public static function created($message, $result = null)
{ {
@ -32,7 +32,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function error($message, $result = null) public static function error($message, $result = null)
{ {
@ -44,7 +44,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function success($message, $result = null) public static function success($message, $result = null)
{ {
@ -56,7 +56,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function forbidden($message, $result = null) public static function forbidden($message, $result = null)
{ {
@ -68,7 +68,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
public static function notFound($message, $result = null) public static function notFound($message, $result = null)
{ {
@ -80,7 +80,7 @@ class BaseController
* *
* @param string $message A friendly message to describe the operation * @param string $message A friendly message to describe the operation
* @param mixed $result The result with values needed by the caller to take action. * @param mixed $result The result with values needed by the caller to take action.
* @return string Standard JSON envelope * @return string Standard JSON envelope
*/ */
private static function json($message, $code, $result = null) private static function json($message, $code, $result = null)
{ {

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Group controller for HTML endpoints. * Group controller for HTML endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class GroupController extends BaseController class GroupController extends BaseController

View file

@ -60,7 +60,7 @@ class SetupController
$qs = '?edit'; $qs = '?edit';
$template = sprintf('%s/setup.php', getConfig()->get('paths')->templates); $template = sprintf('%s/setup.php', getConfig()->get('paths')->templates);
$body = getTemplate()->get($template, array('filesystem' => $filesystem, 'database' => $database, 'themes' => $themes, 'theme' => $theme, $body = getTemplate()->get($template, array('filesystem' => $filesystem, 'database' => $database, 'themes' => $themes, 'theme' => $theme,
'imageLibs' => $imageLibs, 'imageLibrary' => $imageLibrary, 'appId' => $appId, 'step' => $step, 'email' => $email, 'qs' => $qs, 'errors' => $errors)); 'imageLibs' => $imageLibs, 'imageLibrary' => $imageLibrary, 'appId' => $appId, 'step' => $step, 'email' => $email, 'qs' => $qs, 'errors' => $errors));
getTheme()->display('template.php', array('body' => $body, 'page' => 'setup')); getTheme()->display('template.php', array('body' => $body, 'page' => 'setup'));
} }
@ -348,12 +348,12 @@ class SetupController
$template = sprintf('%s/setup.php', getConfig()->get('paths')->templates); $template = sprintf('%s/setup.php', getConfig()->get('paths')->templates);
// copied to/from setup3Post() // copied to/from setup3Post()
$body = getTemplate()->get($template, array('step' => $step, 'themes' => $themes, 'usesAws' => $usesAws, 'usesMySql' => $usesMySql, $body = getTemplate()->get($template, array('step' => $step, 'themes' => $themes, 'usesAws' => $usesAws, 'usesMySql' => $usesMySql,
'database' => $database, 'filesystem' => $filesystem, 'usesLocalFs' => $usesLocalFs, 'usesS3' => $usesS3, 'database' => $database, 'filesystem' => $filesystem, 'usesLocalFs' => $usesLocalFs, 'usesS3' => $usesS3,
'usesSimpleDb' => $usesSimpleDb, 'awsKey' => $awsKey, 'awsSecret' => $awsSecret, 's3Bucket' => $s3Bucket, 'usesSimpleDb' => $usesSimpleDb, 'awsKey' => $awsKey, 'awsSecret' => $awsSecret, 's3Bucket' => $s3Bucket,
'simpleDbDomain' => $simpleDbDomain, 'mySqlHost' => $mySqlHost, 'mySqlUser' => $mySqlUser, 'mySqlDb' => $mySqlDb, 'simpleDbDomain' => $simpleDbDomain, 'mySqlHost' => $mySqlHost, 'mySqlUser' => $mySqlUser, 'mySqlDb' => $mySqlDb,
'mySqlPassword' => $mySqlPassword, 'mySqlTablePrefix' => $mySqlTablePrefix, 'fsRoot' => $fsRoot, 'fsHost' => $fsHost, 'mySqlPassword' => $mySqlPassword, 'mySqlTablePrefix' => $mySqlTablePrefix, 'fsRoot' => $fsRoot, 'fsHost' => $fsHost,
'usesDropbox' => $usesDropbox, 'dropboxKey' => $dropboxKey, 'dropboxSecret' => $dropboxSecret, 'dropboxToken' => $dropboxToken, 'usesDropbox' => $usesDropbox, 'dropboxKey' => $dropboxKey, 'dropboxSecret' => $dropboxSecret, 'dropboxToken' => $dropboxToken,
'dropboxTokenSecret' => $dropboxTokenSecret, 'dropboxFolder' => $dropboxFolder, 'qs' => $qs, 'appId' => $appId, 'errors' => $errors)); 'dropboxTokenSecret' => $dropboxTokenSecret, 'dropboxFolder' => $dropboxFolder, 'qs' => $qs, 'appId' => $appId, 'errors' => $errors));
getTheme()->display('template.php', array('body' => $body, 'page' => 'setup')); getTheme()->display('template.php', array('body' => $body, 'page' => 'setup'));
@ -585,12 +585,12 @@ class SetupController
$template = sprintf('%s/setup.php', getConfig()->get('paths')->templates); $template = sprintf('%s/setup.php', getConfig()->get('paths')->templates);
// copied to/from setup3() // copied to/from setup3()
$body = getTemplate()->get($template, array('step' => $step, 'themes' => $themes, 'usesAws' => $usesAws, 'usesMySql' => $usesMySql, $body = getTemplate()->get($template, array('step' => $step, 'themes' => $themes, 'usesAws' => $usesAws, 'usesMySql' => $usesMySql,
'database' => $database, 'filesystem' => $filesystem, 'usesLocalFs' => $usesLocalFs, 'usesS3' => $usesS3, 'database' => $database, 'filesystem' => $filesystem, 'usesLocalFs' => $usesLocalFs, 'usesS3' => $usesS3,
'usesSimpleDb' => $usesSimpleDb, 'awsKey' => $awsKey, 'awsSecret' => $awsSecret, 's3Bucket' => $s3Bucket, 'usesSimpleDb' => $usesSimpleDb, 'awsKey' => $awsKey, 'awsSecret' => $awsSecret, 's3Bucket' => $s3Bucket,
'simpleDbDomain' => $simpleDbDomain, 'mySqlHost' => $mySqlHost, 'mySqlUser' => $mySqlUser, 'mySqlDb' => $mySqlDb, 'simpleDbDomain' => $simpleDbDomain, 'mySqlHost' => $mySqlHost, 'mySqlUser' => $mySqlUser, 'mySqlDb' => $mySqlDb,
'mySqlPassword' => $mySqlPassword, 'mySqlTablePrefix' => $mySqlTablePrefix, 'fsRoot' => $fsRoot, 'fsHost' => $fsHost, 'mySqlPassword' => $mySqlPassword, 'mySqlTablePrefix' => $mySqlTablePrefix, 'fsRoot' => $fsRoot, 'fsHost' => $fsHost,
'usesDropbox' => $usesDropbox, 'dropboxKey' => $dropboxKey, 'dropboxSecret' => $dropboxSecret, 'dropboxToken' => $dropboxToken, 'usesDropbox' => $usesDropbox, 'dropboxKey' => $dropboxKey, 'dropboxSecret' => $dropboxSecret, 'dropboxToken' => $dropboxToken,
'dropboxTokenSecret' => $dropboxTokenSecret, 'dropboxFolder' => $dropboxFolder, 'qs' => $qs, 'appId' => $appId, 'errors' => $errors)); 'dropboxTokenSecret' => $dropboxTokenSecret, 'dropboxFolder' => $dropboxFolder, 'qs' => $qs, 'appId' => $appId, 'errors' => $errors));
getTheme()->display('template.php', array('body' => $body, 'page' => 'setup')); getTheme()->display('template.php', array('body' => $body, 'page' => 'setup'));
} }
@ -627,9 +627,9 @@ class SetupController
private static function getDefaultConfigParams() private static function getDefaultConfigParams()
{ {
return array('themes' => array(), 'awsKey' => '', 'awsSecret' => '', 's3Bucket' => '', 'simpleDbDomain' => '', 'mySqlHost' => '', return array('themes' => array(), 'awsKey' => '', 'awsSecret' => '', 's3Bucket' => '', 'simpleDbDomain' => '', 'mySqlHost' => '',
'mySqlUser' => '', 'mySqlPassword' => '', 'mySqlDb' => '', 'mySqlTablePrefix' => '', 'mySqlUser' => '', 'mySqlPassword' => '', 'mySqlDb' => '', 'mySqlTablePrefix' => '',
'fsRoot' => '', 'fsHost' => '', 'dropboxFolder' => '', 'dropboxKey' => '', 'dropboxSecret' => '', 'fsRoot' => '', 'fsHost' => '', 'dropboxFolder' => '', 'dropboxKey' => '', 'dropboxSecret' => '',
'dropboxKey' => '', 'dropboxToken' => '', 'dropboxTokenSecret' => '', 'errors' => ''); 'dropboxKey' => '', 'dropboxToken' => '', 'dropboxTokenSecret' => '', 'errors' => '');
} }

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* Tag controller for HTML endpoints. * Tag controller for HTML endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class TagController extends BaseController class TagController extends BaseController

View file

@ -1,7 +1,7 @@
<?php <?php
/** /**
* User controller for HTML endpoints. * User controller for HTML endpoints.
* *
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
*/ */
class UserController extends BaseController class UserController extends BaseController

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* Dropbox API class * Dropbox API class
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
class Dropbox_API { class Dropbox_API {
@ -19,45 +19,45 @@ class Dropbox_API {
* Dropbox root-path * Dropbox root-path
*/ */
const ROOT_DROPBOX = 'dropbox'; const ROOT_DROPBOX = 'dropbox';
/** /**
* API URl * API URl
*/ */
protected $api_url = 'api.dropbox.com/1/'; protected $api_url = 'api.dropbox.com/1/';
/** /**
* Content API URl * Content API URl
*/ */
protected $api_content_url = 'api-content.dropbox.com/0/'; protected $api_content_url = 'api-content.dropbox.com/0/';
/** /**
* OAuth object * OAuth object
* *
* @var Dropbox_OAuth * @var Dropbox_OAuth
*/ */
protected $oauth; protected $oauth;
/** /**
* Default root-path, this will most likely be 'sandbox' or 'dropbox' * Default root-path, this will most likely be 'sandbox' or 'dropbox'
* *
* @var string * @var string
*/ */
protected $root; protected $root;
/** /**
* Determines if connections should use SSL or not. * Determines if connections should use SSL or not.
* Defaults to true in construtor * Defaults to true in construtor
* *
* @deprecated New Dropbox rest calls require SSL. * @deprecated New Dropbox rest calls require SSL.
* @var boolean * @var boolean
*/ */
protected $useSSL; protected $useSSL;
/** /**
* Constructor * Constructor
* *
* @param Dropbox_OAuth Dropbox_Auth object * @param Dropbox_OAuth Dropbox_Auth object
* @param string $root default root path (sandbox or dropbox) * @param string $root default root path (sandbox or dropbox)
*/ */
public function __construct(Dropbox_OAuth $oauth, $root = self::ROOT_DROPBOX, $useSSL = true) { public function __construct(Dropbox_OAuth $oauth, $root = self::ROOT_DROPBOX, $useSSL = true) {
@ -85,18 +85,18 @@ class Dropbox_API {
* * token * * token
* * secret * * secret
* *
* @param string $email * @param string $email
* @param string $password * @param string $password
* @return array * @return array
*/ */
public function getToken($email, $password) { public function getToken($email, $password) {
$data = $this->oauth->fetch($this->api_url . 'token', array( $data = $this->oauth->fetch($this->api_url . 'token', array(
'email' => $email, 'email' => $email,
'password' => $password 'password' => $password
),'POST'); ),'POST');
$data = json_decode($data['body']); $data = json_decode($data['body']);
return array( return array(
'token' => $data->token, 'token' => $data->token,
'token_secret' => $data->secret, 'token_secret' => $data->secret,
@ -105,9 +105,9 @@ class Dropbox_API {
} }
/** /**
* Returns information about the current dropbox account * Returns information about the current dropbox account
* *
* @return stdclass * @return stdclass
*/ */
public function getAccountInfo() { public function getAccountInfo() {
@ -119,11 +119,11 @@ class Dropbox_API {
/** /**
* Creates a new Dropbox account * Creates a new Dropbox account
* *
* @param string $email * @param string $email
* @param string $first_name * @param string $first_name
* @param string $last_name * @param string $last_name
* @param string $password * @param string $password
* @return bool * @return bool
*/ */
public function createAccount($email, $first_name, $last_name, $password) { public function createAccount($email, $first_name, $last_name, $password) {
@ -134,17 +134,17 @@ class Dropbox_API {
'password' => $password, 'password' => $password,
), 'POST'); ), 'POST');
return $result['body']==='OK'; return $result['body']==='OK';
} }
/** /**
* Returns a file's contents * Returns a file's contents
* *
* @param string $path path * @param string $path path
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return string * @return string
*/ */
public function getFile($path = '', $root = null) { public function getFile($path = '', $root = null) {
@ -158,10 +158,10 @@ class Dropbox_API {
/** /**
* Uploads a new file * Uploads a new file
* *
* @param string $path Target path (including filename) * @param string $path Target path (including filename)
* @param string $file Either a path to a file or a stream resource * @param string $file Either a path to a file or a stream resource
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return bool * @return bool
*/ */
public function putFile($path, $file, $root = null) { public function putFile($path, $file, $root = null) {
@ -178,10 +178,10 @@ class Dropbox_API {
} elseif (!is_resource($file)) { } elseif (!is_resource($file)) {
throw new Dropbox_Exception('File must be a file-resource or a string'); throw new Dropbox_Exception('File must be a file-resource or a string');
} }
$result=$this->multipartFetch($this->api_content_url . 'files/' . $result=$this->multipartFetch($this->api_content_url . 'files/' .
$root . '/' . trim($directory,'/'), $file, $filename); $root . '/' . trim($directory,'/'), $file, $filename);
if(!isset($result["httpStatus"]) || $result["httpStatus"] != 200) if(!isset($result["httpStatus"]) || $result["httpStatus"] != 200)
throw new Dropbox_Exception("Uploading file to Dropbox failed"); throw new Dropbox_Exception("Uploading file to Dropbox failed");
return true; return true;
@ -189,14 +189,14 @@ class Dropbox_API {
/** /**
* Copies a file or directory from one location to another * Copies a file or directory from one location to another
* *
* This method returns the file information of the newly created file. * This method returns the file information of the newly created file.
* *
* @param string $from source path * @param string $from source path
* @param string $to destination path * @param string $to destination path
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return stdclass * @return stdclass
*/ */
public function copy($from, $to, $root = null) { public function copy($from, $to, $root = null) {
@ -208,13 +208,13 @@ class Dropbox_API {
} }
/** /**
* Creates a new folder * Creates a new folder
* *
* This method returns the information from the newly created directory * This method returns the information from the newly created directory
* *
* @param string $path * @param string $path
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return stdclass * @return stdclass
*/ */
public function createFolder($path, $root = null) { public function createFolder($path, $root = null) {
@ -232,10 +232,10 @@ class Dropbox_API {
* Deletes a file or folder. * Deletes a file or folder.
* *
* This method will return the metadata information from the deleted file or folder, if successful. * This method will return the metadata information from the deleted file or folder, if successful.
* *
* @param string $path Path to new folder * @param string $path Path to new folder
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return array * @return array
*/ */
public function delete($path, $root = null) { public function delete($path, $root = null) {
if (is_null($root)) $root = $this->root; if (is_null($root)) $root = $this->root;
@ -245,14 +245,14 @@ class Dropbox_API {
} }
/** /**
* Moves a file or directory to a new location * Moves a file or directory to a new location
* *
* This method returns the information from the newly created directory * This method returns the information from the newly created directory
* *
* @param mixed $from Source path * @param mixed $from Source path
* @param mixed $to destination path * @param mixed $to destination path
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return stdclass * @return stdclass
*/ */
public function move($from, $to, $root = null) { public function move($from, $to, $root = null) {
@ -272,7 +272,7 @@ class Dropbox_API {
* @param string $path Path to directory or file * @param string $path Path to directory or file
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @deprecated This method is no longer supported * @deprecated This method is no longer supported
* @return array * @return array
*/ */
public function getLinks($path, $root = null) { public function getLinks($path, $root = null) {
@ -280,22 +280,22 @@ class Dropbox_API {
/* /*
if (is_null($root)) $root = $this->root; if (is_null($root)) $root = $this->root;
$response = $this->oauth->fetch($this->api_url . 'links/' . $root . '/' . ltrim($path,'/')); $response = $this->oauth->fetch($this->api_url . 'links/' . $root . '/' . ltrim($path,'/'));
return json_decode($response,true); return json_decode($response,true);
*/ */
} }
/** /**
* Returns file and directory information * Returns file and directory information
* *
* @param string $path Path to receive information from * @param string $path Path to receive information from
* @param bool $list When set to true, this method returns information from all files in a directory. When set to false it will only return infromation from the specified directory. * @param bool $list When set to true, this method returns information from all files in a directory. When set to false it will only return infromation from the specified directory.
* @param string $hash If a hash is supplied, this method simply returns true if nothing has changed since the last request. Good for caching. * @param string $hash If a hash is supplied, this method simply returns true if nothing has changed since the last request. Good for caching.
* @param int $fileLimit Maximum number of file-information to receive * @param int $fileLimit Maximum number of file-information to receive
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return array|true * @return array|true
*/ */
public function getMetaData($path, $list = true, $hash = null, $fileLimit = null, $root = null) { public function getMetaData($path, $list = true, $hash = null, $fileLimit = null, $root = null) {
@ -305,28 +305,28 @@ class Dropbox_API {
'list' => $list, 'list' => $list,
); );
if (!is_null($hash)) $args['hash'] = $hash; if (!is_null($hash)) $args['hash'] = $hash;
if (!is_null($fileLimit)) $args['file_limit'] = $fileLimit; if (!is_null($fileLimit)) $args['file_limit'] = $fileLimit;
$path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path)); $path = str_replace(array('%2F','~'), array('/','%7E'), rawurlencode($path));
$response = $this->oauth->fetch($this->api_url . 'metadata/' . $root . '/' . ltrim($path,'/'), $args); $response = $this->oauth->fetch($this->api_url . 'metadata/' . $root . '/' . ltrim($path,'/'), $args);
/* 304 is not modified */ /* 304 is not modified */
if ($response['httpStatus']==304) { if ($response['httpStatus']==304) {
return true; return true;
} else { } else {
return json_decode($response['body'],true); return json_decode($response['body'],true);
} }
} }
/** /**
* Returns a thumbnail (as a string) for a file path. * Returns a thumbnail (as a string) for a file path.
* *
* @param string $path Path to file * @param string $path Path to file
* @param string $size small, medium or large * @param string $size small, medium or large
* @param string $root Use this to override the default root path (sandbox/dropbox) * @param string $root Use this to override the default root path (sandbox/dropbox)
* @return string * @return string
*/ */
public function getThumbnail($path, $size = 'small', $root = null) { public function getThumbnail($path, $size = 'small', $root = null) {
@ -338,11 +338,11 @@ class Dropbox_API {
} }
/** /**
* This method is used to generate multipart POST requests for file upload * This method is used to generate multipart POST requests for file upload
* *
* @param string $uri * @param string $uri
* @param array $arguments * @param array $arguments
* @return bool * @return bool
*/ */
protected function multipartFetch($uri, $file, $filename) { protected function multipartFetch($uri, $file, $filename) {
@ -362,7 +362,7 @@ class Dropbox_API {
$body.="--" . $boundary . "--"; $body.="--" . $boundary . "--";
// Dropbox requires the filename to also be part of the regular arguments, so it becomes // Dropbox requires the filename to also be part of the regular arguments, so it becomes
// part of the signature. // part of the signature.
$uri.='?file=' . $filename; $uri.='?file=' . $filename;
return $this->oauth->fetch($uri, $body, 'POST', $headers); return $this->oauth->fetch($uri, $body, 'POST', $headers);

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* Dropbox base exception * Dropbox base exception
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */

View file

@ -2,10 +2,10 @@
/** /**
* Dropbox Forbidden exception * Dropbox Forbidden exception
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */

View file

@ -2,16 +2,16 @@
/** /**
* Dropbox Not Found exception * Dropbox Not Found exception
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
/** /**
* This exception is thrown when a non-existant uri is accessed. * This exception is thrown when a non-existant uri is accessed.
* *
* Basically, this exception is used when we get back a 404. * Basically, this exception is used when we get back a 404.
*/ */
class Dropbox_Exception_NotFound extends Dropbox_Exception { class Dropbox_Exception_NotFound extends Dropbox_Exception {

View file

@ -2,16 +2,16 @@
/** /**
* Dropbox Over Quota exception * Dropbox Over Quota exception
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
/** /**
* This exception is thrown when the operation required more space than the available quota. * This exception is thrown when the operation required more space than the available quota.
* *
* Basically, this exception is used when we get back a 507. * Basically, this exception is used when we get back a 507.
*/ */
class Dropbox_Exception_OverQuota extends Dropbox_Exception { class Dropbox_Exception_OverQuota extends Dropbox_Exception {

View file

@ -2,10 +2,10 @@
/** /**
* Dropbox RequestToken exception * Dropbox RequestToken exception
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */

View file

@ -2,10 +2,10 @@
/** /**
* Dropbox OAuth * Dropbox OAuth
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
@ -21,52 +21,52 @@ abstract class Dropbox_OAuth {
/** /**
* After a user has authorized access, dropbox can redirect the user back * After a user has authorized access, dropbox can redirect the user back
* to this url. * to this url.
* *
* @var string * @var string
*/ */
public $authorizeCallbackUrl = null; public $authorizeCallbackUrl = null;
/** /**
* Uri used to fetch request tokens * Uri used to fetch request tokens
* *
* @var string * @var string
*/ */
const URI_REQUEST_TOKEN = 'http://api.dropbox.com/0/oauth/request_token'; const URI_REQUEST_TOKEN = 'http://api.dropbox.com/0/oauth/request_token';
/** /**
* Uri used to redirect the user to for authorization. * Uri used to redirect the user to for authorization.
* *
* @var string * @var string
*/ */
const URI_AUTHORIZE = 'http://www.dropbox.com/0/oauth/authorize'; const URI_AUTHORIZE = 'http://www.dropbox.com/0/oauth/authorize';
/** /**
* Uri used to * Uri used to
* *
* @var string * @var string
*/ */
const URI_ACCESS_TOKEN = 'http://api.dropbox.com/0/oauth/access_token'; const URI_ACCESS_TOKEN = 'http://api.dropbox.com/0/oauth/access_token';
/** /**
* An OAuth request token. * An OAuth request token.
* *
* @var string * @var string
*/ */
protected $oauth_token = null; protected $oauth_token = null;
/** /**
* OAuth token secret * OAuth token secret
* *
* @var string * @var string
*/ */
protected $oauth_token_secret = null; protected $oauth_token_secret = null;
/** /**
* Constructor * Constructor
* *
* @param string $consumerKey * @param string $consumerKey
* @param string $consumerSecret * @param string $consumerSecret
*/ */
abstract public function __construct($consumerKey, $consumerSecret); abstract public function __construct($consumerKey, $consumerSecret);
@ -75,9 +75,9 @@ abstract class Dropbox_OAuth {
* *
* The tokens can also be passed as an array into the first argument. * The tokens can also be passed as an array into the first argument.
* The array must have the elements token and token_secret. * The array must have the elements token and token_secret.
* *
* @param string|array $token * @param string|array $token
* @param string $token_secret * @param string $token_secret
* @return void * @return void
*/ */
public function setToken($token, $token_secret = null) { public function setToken($token, $token_secret = null) {
@ -96,8 +96,8 @@ abstract class Dropbox_OAuth {
* Returns the oauth request tokens as an associative array. * Returns the oauth request tokens as an associative array.
* *
* The array will contain the elements 'token' and 'token_secret'. * The array will contain the elements 'token' and 'token_secret'.
* *
* @return array * @return array
*/ */
public function getToken() { public function getToken() {
@ -110,12 +110,12 @@ abstract class Dropbox_OAuth {
/** /**
* Returns the authorization url * Returns the authorization url
* *
* @param string $callBack Specify a callback url to automatically redirect the user back * @param string $callBack Specify a callback url to automatically redirect the user back
* @return string * @return string
*/ */
public function getAuthorizeUrl($callBack = null) { public function getAuthorizeUrl($callBack = null) {
// Building the redirect uri // Building the redirect uri
$token = $this->getToken(); $token = $this->getToken();
$uri = self::URI_AUTHORIZE . '?oauth_token=' . $token['token']; $uri = self::URI_AUTHORIZE . '?oauth_token=' . $token['token'];
@ -124,28 +124,28 @@ abstract class Dropbox_OAuth {
} }
/** /**
* Fetches a secured oauth url and returns the response body. * Fetches a secured oauth url and returns the response body.
* *
* @param string $uri * @param string $uri
* @param mixed $arguments * @param mixed $arguments
* @param string $method * @param string $method
* @param array $httpHeaders * @param array $httpHeaders
* @return string * @return string
*/ */
public abstract function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()); public abstract function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array());
/** /**
* Requests the OAuth request token. * Requests the OAuth request token.
* *
* @return array * @return array
*/ */
abstract public function getRequestToken(); abstract public function getRequestToken();
/** /**
* Requests the OAuth access tokens. * Requests the OAuth access tokens.
* *
* @return array * @return array
*/ */
abstract public function getAccessToken(); abstract public function getAccessToken();
} }

View file

@ -2,17 +2,17 @@
/** /**
* Dropbox OAuth * Dropbox OAuth
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
/** /**
* This class is used to sign all requests to dropbox * This class is used to sign all requests to dropbox
* *
* This classes use the PEAR HTTP_OAuth package. Make sure this is installed. * This classes use the PEAR HTTP_OAuth package. Make sure this is installed.
*/ */
class Dropbox_OAuth_PEAR extends Dropbox_OAuth { class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
@ -26,18 +26,18 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
/** /**
* OAuth consumer key * OAuth consumer key
* *
* We need to keep this around for later. * We need to keep this around for later.
* *
* @var string * @var string
*/ */
protected $consumerKey; protected $consumerKey;
/** /**
* Constructor * Constructor
* *
* @param string $consumerKey * @param string $consumerKey
* @param string $consumerSecret * @param string $consumerSecret
*/ */
public function __construct($consumerKey, $consumerSecret) { public function __construct($consumerKey, $consumerSecret) {
@ -47,7 +47,7 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
include 'HTTP/OAuth/Consumer.php'; include 'HTTP/OAuth/Consumer.php';
} }
if (!class_exists('HTTP_OAuth_Consumer')) if (!class_exists('HTTP_OAuth_Consumer'))
throw new Dropbox_Exception('The HTTP_OAuth_Consumer class could not be found! Did you install the pear HTTP_OAUTH class?'); throw new Dropbox_Exception('The HTTP_OAuth_Consumer class could not be found! Did you install the pear HTTP_OAUTH class?');
$this->OAuth = new HTTP_OAuth_Consumer($consumerKey, $consumerSecret); $this->OAuth = new HTTP_OAuth_Consumer($consumerKey, $consumerSecret);
@ -60,9 +60,9 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
* *
* The tokens can also be passed as an array into the first argument. * The tokens can also be passed as an array into the first argument.
* The array must have the elements token and token_secret. * The array must have the elements token and token_secret.
* *
* @param string|array $token * @param string|array $token
* @param string $token_secret * @param string $token_secret
* @return void * @return void
*/ */
public function setToken($token, $token_secret = null) { public function setToken($token, $token_secret = null) {
@ -74,20 +74,20 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
} }
/** /**
* Fetches a secured oauth url and returns the response body. * Fetches a secured oauth url and returns the response body.
* *
* @param string $uri * @param string $uri
* @param mixed $arguments * @param mixed $arguments
* @param string $method * @param string $method
* @param array $httpHeaders * @param array $httpHeaders
* @return string * @return string
*/ */
public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array())
{ {
$httpRequest = new HTTP_Request2(null, $httpRequest = new HTTP_Request2(null,
HTTP_Request2::METHOD_GET, HTTP_Request2::METHOD_GET,
array( array(
'ssl_verify_peer' => false, 'ssl_verify_peer' => false,
'ssl_verify_host' => false 'ssl_verify_host' => false
) )
); );
@ -97,7 +97,7 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
$consumerRequest->setUrl($uri); $consumerRequest->setUrl($uri);
$consumerRequest->setMethod($method); $consumerRequest->setMethod($method);
$consumerRequest->setSecrets($this->OAuth->getSecrets()); $consumerRequest->setSecrets($this->OAuth->getSecrets());
$parameters = array( $parameters = array(
'oauth_consumer_key' => $this->consumerKey, 'oauth_consumer_key' => $this->consumerKey,
'oauth_signature_method' => 'HMAC-SHA1', 'oauth_signature_method' => 'HMAC-SHA1',
@ -132,9 +132,9 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
break; break;
case 403 : case 403 :
throw new Dropbox_Exception_Forbidden('Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.'); throw new Dropbox_Exception_Forbidden('Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.');
case 404 : case 404 :
throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found'); throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found');
case 507 : case 507 :
throw new Dropbox_Exception_OverQuota('This dropbox is full'); throw new Dropbox_Exception_OverQuota('This dropbox is full');
} }
@ -148,11 +148,11 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
/** /**
* Requests the OAuth request token. * Requests the OAuth request token.
* *
* @return void * @return void
*/ */
public function getRequestToken() { public function getRequestToken() {
$this->OAuth->getRequestToken(self::URI_REQUEST_TOKEN); $this->OAuth->getRequestToken(self::URI_REQUEST_TOKEN);
$this->setToken($this->OAuth->getToken(), $this->OAuth->getTokenSecret()); $this->setToken($this->OAuth->getToken(), $this->OAuth->getTokenSecret());
return $this->getToken(); return $this->getToken();
@ -164,8 +164,8 @@ class Dropbox_OAuth_PEAR extends Dropbox_OAuth {
* *
* This method requires the 'unauthorized' request tokens * This method requires the 'unauthorized' request tokens
* and, if successful will set the authorized request tokens. * and, if successful will set the authorized request tokens.
* *
* @return void * @return void
*/ */
public function getAccessToken() { public function getAccessToken() {

View file

@ -2,10 +2,10 @@
/** /**
* Dropbox OAuth * Dropbox OAuth
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */
@ -26,13 +26,13 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
/** /**
* Constructor * Constructor
* *
* @param string $consumerKey * @param string $consumerKey
* @param string $consumerSecret * @param string $consumerSecret
*/ */
public function __construct($consumerKey, $consumerSecret) { public function __construct($consumerKey, $consumerSecret) {
if (!class_exists('OAuth')) if (!class_exists('OAuth'))
throw new Dropbox_Exception('The OAuth class could not be found! Did you install and enable the oauth extension?'); throw new Dropbox_Exception('The OAuth class could not be found! Did you install and enable the oauth extension?');
$this->OAuth = new OAuth($consumerKey, $consumerSecret,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI); $this->OAuth = new OAuth($consumerKey, $consumerSecret,OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);
@ -45,9 +45,9 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
* *
* The tokens can also be passed as an array into the first argument. * The tokens can also be passed as an array into the first argument.
* The array must have the elements token and token_secret. * The array must have the elements token and token_secret.
* *
* @param string|array $token * @param string|array $token
* @param string $token_secret * @param string $token_secret
* @return void * @return void
*/ */
public function setToken($token, $token_secret = null) { public function setToken($token, $token_secret = null) {
@ -59,17 +59,17 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
/** /**
* Fetches a secured oauth url and returns the response body. * Fetches a secured oauth url and returns the response body.
* *
* @param string $uri * @param string $uri
* @param mixed $arguments * @param mixed $arguments
* @param string $method * @param string $method
* @param array $httpHeaders * @param array $httpHeaders
* @return string * @return string
*/ */
public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) { public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) {
try { try {
$this->OAuth->fetch($uri, $arguments, $method, $httpHeaders); $this->OAuth->fetch($uri, $arguments, $method, $httpHeaders);
$result = $this->OAuth->getLastResponse(); $result = $this->OAuth->getLastResponse();
$lastResponseInfo = $this->OAuth->getLastResponseInfo(); $lastResponseInfo = $this->OAuth->getLastResponseInfo();
@ -91,9 +91,9 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
break; break;
case 403 : case 403 :
throw new Dropbox_Exception_Forbidden('Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.'); throw new Dropbox_Exception_Forbidden('Forbidden. This could mean a bad OAuth request, or a file or folder already existing at the target location.');
case 404 : case 404 :
throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found'); throw new Dropbox_Exception_NotFound('Resource at uri: ' . $uri . ' could not be found');
case 507 : case 507 :
throw new Dropbox_Exception_OverQuota('This dropbox is full'); throw new Dropbox_Exception_OverQuota('This dropbox is full');
default: default:
// rethrowing // rethrowing
@ -107,10 +107,10 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
/** /**
* Requests the OAuth request token. * Requests the OAuth request token.
* *
* @return void * @return void
*/ */
public function getRequestToken() { public function getRequestToken() {
try { try {
$tokens = $this->OAuth->getRequestToken(self::URI_REQUEST_TOKEN); $tokens = $this->OAuth->getRequestToken(self::URI_REQUEST_TOKEN);
@ -131,8 +131,8 @@ class Dropbox_OAuth_PHP extends Dropbox_OAuth {
* *
* This method requires the 'unauthorized' request tokens * This method requires the 'unauthorized' request tokens
* and, if successful will set the authorized request tokens. * and, if successful will set the authorized request tokens.
* *
* @return void * @return void
*/ */
public function getAccessToken() { public function getAccessToken() {

View file

@ -2,8 +2,8 @@
/** /**
* Dropbox OAuth * Dropbox OAuth
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Stefan Motz * @copyright Copyright (C) 2010 Stefan Motz
* @author Stefan Motz (http://www.multimediamotz.de/) * @author Stefan Motz (http://www.multimediamotz.de/)
* @license MIT * @license MIT
@ -29,9 +29,9 @@ class Dropbox_OAuth_Wordpress extends Dropbox_OAuth {
/** /**
* Constructor * Constructor
* *
* @param string $consumerKey * @param string $consumerKey
* @param string $consumerSecret * @param string $consumerSecret
*/ */
public function __construct($consumerKey, $consumerSecret) { public function __construct($consumerKey, $consumerSecret) {
if (!(defined('ABSPATH') && defined('WPINC'))) if (!(defined('ABSPATH') && defined('WPINC')))
@ -45,13 +45,13 @@ class Dropbox_OAuth_Wordpress extends Dropbox_OAuth {
} }
/** /**
* Fetches a secured oauth url and returns the response body. * Fetches a secured oauth url and returns the response body.
* *
* @param string $uri * @param string $uri
* @param mixed $arguments * @param mixed $arguments
* @param string $method * @param string $method
* @param array $httpHeaders * @param array $httpHeaders
* @return string * @return string
*/ */
public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) { public function fetch($uri, $arguments = array(), $method = 'GET', $httpHeaders = array()) {
@ -149,7 +149,7 @@ class Dropbox_OAuth_Wordpress extends Dropbox_OAuth {
/** /**
* Requests the OAuth request token. * Requests the OAuth request token.
* *
* @return void * @return void
*/ */
public function getRequestToken() { public function getRequestToken() {
$result = $this->fetch(self::URI_REQUEST_TOKEN, array(), 'POST'); $result = $this->fetch(self::URI_REQUEST_TOKEN, array(), 'POST');
@ -168,8 +168,8 @@ class Dropbox_OAuth_Wordpress extends Dropbox_OAuth {
* *
* This method requires the 'unauthorized' request tokens * This method requires the 'unauthorized' request tokens
* and, if successful will set the authorized request tokens. * and, if successful will set the authorized request tokens.
* *
* @return void * @return void
*/ */
public function getAccessToken() { public function getAccessToken() {
$result = $this->fetch(self::URI_ACCESS_TOKEN, array(), 'POST'); $result = $this->fetch(self::URI_ACCESS_TOKEN, array(), 'POST');

View file

@ -1,11 +1,11 @@
<?php <?php
/** /**
* This file registers a new autoload function using spl_autoload_register. * This file registers a new autoload function using spl_autoload_register.
* *
* @package Dropbox * @package Dropbox
* @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved. * @copyright Copyright (C) 2010 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/) * @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/dropbox-php/wiki/License MIT * @license http://code.google.com/p/dropbox-php/wiki/License MIT
*/ */

View file

@ -45,13 +45,13 @@ class EpiApi
// restore sanity // restore sanity
foreach($tmps as $type => $value) foreach($tmps as $type => $value)
$GLOBALS[$type] = $value; $GLOBALS[$type] = $value;
return $retval; return $retval;
} }
/** /**
* EpiApi::getRoute($route); * EpiApi::getRoute($route);
* @name getRoute * @name getRoute
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @param string $route * @param string $route

View file

@ -6,7 +6,7 @@ class EpiCache
private static $instances, $employ; private static $instances, $employ;
private $cached, $hash; private $cached, $hash;
private function __construct(){} private function __construct(){}
/* /*
* @param type required * @param type required
* @params optional * @params optional
@ -46,7 +46,7 @@ class EpiCache
$params = func_get_args(); $params = func_get_args();
return $this->get(implode('.', $params)); return $this->get(implode('.', $params));
} }
protected function setByKey() protected function setByKey()
{ {
$params = func_get_args(); $params = func_get_args();

View file

@ -60,7 +60,7 @@ class EpiCache_Memcached extends EpiCache
if(class_exists('Memcached')) if(class_exists('Memcached'))
{ {
$this->memcached = new Memcached; $this->memcached = new Memcached;
if($this->memcached->addServer($this->host, $this->port)) if($this->memcached->addServer($this->host, $this->port))
return self::$connected = true; return self::$connected = true;
else else

View file

@ -64,7 +64,7 @@ class EpiConfig
self::$instance = new EpiConfig; self::$instance = new EpiConfig;
return self::$instance; return self::$instance;
} }
} }
function getConfig() function getConfig()

View file

@ -51,7 +51,7 @@ class EpiCurl
$code = curl_multi_add_handle($this->mc, $ch); $code = curl_multi_add_handle($this->mc, $ch);
$this->startTimer($key); $this->startTimer($key);
// (1) // (1)
if($code === CURLM_OK || $code === CURLM_CALL_MULTI_PERFORM) if($code === CURLM_OK || $code === CURLM_CALL_MULTI_PERFORM)
{ {

View file

@ -6,7 +6,7 @@ class EpiDatabase
private $_type, $_name, $_host, $_user, $_pass; private $_type, $_name, $_host, $_user, $_pass;
public $dbh; public $dbh;
private function __construct(){} private function __construct(){}
public static function getInstance($type, $name, $host = 'localhost', $user = 'root', $pass = '') public static function getInstance($type, $name, $host = 'localhost', $user = 'root', $pass = '')
{ {
$args = func_get_args(); $args = func_get_args();
@ -22,8 +22,8 @@ class EpiDatabase
self::$instances[$hash]->_pass = $pass; self::$instances[$hash]->_pass = $pass;
return self::$instances[$hash]; return self::$instances[$hash];
} }
/** /**
* @return false in case of error * @return false in case of error
*/ */
public function execute($sql = false, $params = array()) public function execute($sql = false, $params = array())
@ -45,7 +45,7 @@ class EpiDatabase
return false; return false;
} }
} }
public function insertId() public function insertId()
{ {
$this->init(); $this->init();
@ -55,7 +55,7 @@ class EpiDatabase
} }
return false; return false;
} }
public function all($sql = false, $params = array()) public function all($sql = false, $params = array())
{ {
$this->init(); $this->init();
@ -70,7 +70,7 @@ class EpiDatabase
return false; return false;
} }
} }
public function one($sql = false, $params = array()) public function one($sql = false, $params = array())
{ {
$this->init(); $this->init();

View file

@ -19,7 +19,7 @@ class EpiLogger
} }
} }
} }
public function crit($message, $exception = null) public function crit($message, $exception = null)
{ {
if(!isset($this->levels[self::Crit])) if(!isset($this->levels[self::Crit]))
@ -27,7 +27,7 @@ class EpiLogger
$this->log($message, self::Crit, $exception); $this->log($message, self::Crit, $exception);
} }
public function info($message, $exception = null) public function info($message, $exception = null)
{ {
if(!isset($this->levels[self::Info])) if(!isset($this->levels[self::Info]))
@ -35,7 +35,7 @@ class EpiLogger
$this->log($message, self::Info, $exception); $this->log($message, self::Info, $exception);
} }
public function warn($message, $exception = null) public function warn($message, $exception = null)
{ {
if(!isset($this->levels[self::Warn])) if(!isset($this->levels[self::Warn]))

View file

@ -4,7 +4,7 @@
* *
* This contains the EpiRoute class as wel as the EpiException abstract class * This contains the EpiRoute class as wel as the EpiException abstract class
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @version 1.0 * @version 1.0
* @package EpiRoute * @package EpiRoute
*/ */
@ -47,7 +47,7 @@ class EpiRoute
{ {
$this->addRoute($route, $callback, self::httpPost, $isApi); $this->addRoute($route, $callback, self::httpPost, $isApi);
} }
/** /**
* NOT YET IMPLEMENTED * NOT YET IMPLEMENTED
* request('/', 'function', array(EpiRoute::httpGet, EpiRoute::httpPost)); * request('/', 'function', array(EpiRoute::httpGet, EpiRoute::httpPost));
@ -85,9 +85,9 @@ class EpiRoute
$this->$method($route['path'], $route['function']); $this->$method($route['path'], $route['function']);
} }
} }
/** /**
* EpiRoute::run($_GET['__route__'], $_['routes']); * EpiRoute::run($_GET['__route__'], $_['routes']);
* @name run * @name run
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @param string $route * @param string $route
@ -116,7 +116,7 @@ class EpiRoute
/** /**
* EpiRoute::getRoute($route); * EpiRoute::getRoute($route);
* @name getRoute * @name getRoute
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @param string $route * @param string $route
@ -163,7 +163,7 @@ class EpiRoute
} }
/** /**
* EpiRoute::redirect($url); * EpiRoute::redirect($url);
* @name redirect * @name redirect
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @param string $url * @param string $url

View file

@ -27,7 +27,7 @@ class EpiSession_Apc implements EpiSessionInterface
{ {
if(empty($key)) if(empty($key))
return false; return false;
$this->store[$key] = $value; $this->store[$key] = $value;
apc_store($this->key, $this->store); apc_store($this->key, $this->store);
return $value; return $value;

View file

@ -49,7 +49,7 @@ class EpiSession_Memcached implements EpiSessionInterface
{ {
if(!$this->connect() || empty($key)) if(!$this->connect() || empty($key))
return false; return false;
$this->store[$key] = $value; $this->store[$key] = $value;
$this->memcached->set($this->key, $this->store); $this->memcached->set($this->key, $this->store);
return $value; return $value;

View file

@ -19,7 +19,7 @@ class EpiTemplate
{ {
extract($vars); extract($vars);
} }
include $templateInclude; include $templateInclude;
} }
else else
@ -27,7 +27,7 @@ class EpiTemplate
EpiException::raise(new EpiException("Could not load template: {$templateInclude}", 404)); EpiException::raise(new EpiException("Could not load template: {$templateInclude}", 404));
} }
} }
/** /**
* EpiRoute::get('/path/to/template.php', $array); * EpiRoute::get('/path/to/template.php', $array);
* @name get * @name get
@ -57,9 +57,9 @@ class EpiTemplate
EpiException::raise(new EpiException("Could not load template: {$templateInclude}", 404)); EpiException::raise(new EpiException("Could not load template: {$templateInclude}", 404));
} }
} }
/** /**
* EpiRoute::json($variable); * EpiRoute::json($variable);
* @name json * @name json
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>
* @param mixed $data * @param mixed $data
@ -79,9 +79,9 @@ class EpiTemplate
EpiException::raise(new EpiException("json_encode failed for {$dataDump}", 404)); EpiException::raise(new EpiException("json_encode failed for {$dataDump}", 404));
} }
} }
/** /**
* EpiRoute::jsonResponse($variable); * EpiRoute::jsonResponse($variable);
* This method echo's JSON data in the header and to the screen and returns. * This method echo's JSON data in the header and to the screen and returns.
* @name jsonResponse * @name jsonResponse
* @author Jaisen Mathai <jaisen@jmathai.com> * @author Jaisen Mathai <jaisen@jmathai.com>

View file

@ -37,7 +37,7 @@ else
// if we're running setup and the config file exists, load it to prepopulate the form // if we're running setup and the config file exists, load it to prepopulate the form
if(file_exists($configFile)) if(file_exists($configFile))
getConfig()->load(sprintf('generated/%s.ini', getenv('HTTP_HOST'))); getConfig()->load(sprintf('generated/%s.ini', getenv('HTTP_HOST')));
// setup and enable routes for setup // setup and enable routes for setup
$baseDir = dirname(dirname(__FILE__)); $baseDir = dirname(dirname(__FILE__));
$paths = new stdClass; $paths = new stdClass;

View file

@ -12,7 +12,7 @@ class Action
* Accepts a set of params that must include a type and targetType * Accepts a set of params that must include a type and targetType
* *
* @param array $params Params describing the action to be added * @param array $params Params describing the action to be added
* @return mixed Action ID on success, false on failure * @return mixed Action ID on success, false on failure
*/ */
public static function add($params) public static function add($params)
{ {

View file

@ -41,7 +41,7 @@ class Credential
$res = getDb()->putCredential($id, $params); $res = getDb()->putCredential($id, $params);
if($res) if($res)
return $id; return $id;
return false; return false;
} }
@ -67,7 +67,7 @@ class Credential
try try
{ {
$this->provider->consumerHandler(array($this,'checkConsumer')); $this->provider->consumerHandler(array($this,'checkConsumer'));
$this->provider->timestampNonceHandler(array($this,'checkTimestampAndNonce')); $this->provider->timestampNonceHandler(array($this,'checkTimestampAndNonce'));
$this->provider->tokenHandler(array($this,'checkToken')); $this->provider->tokenHandler(array($this,'checkToken'));
$this->provider->setParam('__route__', null); $this->provider->setParam('__route__', null);
@ -121,7 +121,7 @@ class Credential
if(!$cache) if(!$cache)
$cache = array(); $cache = array();
list($lastTimestamp, $nonces) = each($cache); list($lastTimestamp, $nonces) = each($cache);
if($provider->timestamp > (time()+300) || $provider->timestamp < $lastTimestamp) if($provider->timestamp > (time()+300) || $provider->timestamp < $lastTimestamp)
{ {
// timestamp can't be more then 30 seconds into the future // timestamp can't be more then 30 seconds into the future
// or prior to the last timestamp // or prior to the last timestamp

View file

@ -44,7 +44,7 @@ class Group
/** /**
* Get the next ID to be used for a action, group or photo. * Get the next ID to be used for a action, group or photo.
* The ID is a base 32 string that represents an autoincrementing integer. * The ID is a base 32 string that represents an autoincrementing integer.
* @return string * @return string
*/ */
public static function getGroups($email = null) public static function getGroups($email = null)
{ {

View file

@ -20,7 +20,7 @@ class ImageGraphicsMagick implements ImageInterface
* Constructor which initializes the Gmagick object. * Constructor which initializes the Gmagick object.
* *
* @param string $filename Full path to the file which will be manipulated * @param string $filename Full path to the file which will be manipulated
* @return void * @return void
*/ */
public function __construct($filename) public function __construct($filename)
{ {
@ -41,7 +41,7 @@ class ImageGraphicsMagick implements ImageInterface
* @param int $width Width of the resulting image * @param int $width Width of the resulting image
* @param int $height Height of the resulting image * @param int $height Height of the resulting image
* @param boolean $maintainAspectRatio When false it will crop to exact $width and $height else it will scale using "best fit" * @param boolean $maintainAspectRatio When false it will crop to exact $width and $height else it will scale using "best fit"
* @return void * @return void
*/ */
public function scale($width, $height, $maintainAspectRatio = true) public function scale($width, $height, $maintainAspectRatio = true)
{ {
@ -54,7 +54,7 @@ class ImageGraphicsMagick implements ImageInterface
/** /**
* Greyscale an image * Greyscale an image
* *
* @return void * @return void
*/ */
public function greyscale() public function greyscale()
{ {
@ -65,7 +65,7 @@ class ImageGraphicsMagick implements ImageInterface
* Save modifications to the image to the file system * Save modifications to the image to the file system
* *
* @param string $outputFile The file to write the modifications to. * @param string $outputFile The file to write the modifications to.
* @return void * @return void
*/ */
public function write($outputFile) public function write($outputFile)
{ {

View file

@ -20,7 +20,7 @@ class ImageImageMagick implements ImageInterface
* Constructor which initializes the Imagick object. * Constructor which initializes the Imagick object.
* *
* @param string $filename Full path to the file which will be manipulated * @param string $filename Full path to the file which will be manipulated
* @return void * @return void
*/ */
public function __construct($filename) public function __construct($filename)
{ {
@ -43,7 +43,7 @@ class ImageImageMagick implements ImageInterface
* @param int $width Width of the resulting image * @param int $width Width of the resulting image
* @param int $height Height of the resulting image * @param int $height Height of the resulting image
* @param boolean $maintainAspectRatio When false it will crop to exact $width and $height else it will scale using "best fit" * @param boolean $maintainAspectRatio When false it will crop to exact $width and $height else it will scale using "best fit"
* @return void * @return void
*/ */
public function scale($width, $height, $maintainAspectRatio = true) public function scale($width, $height, $maintainAspectRatio = true)
{ {
@ -56,7 +56,7 @@ class ImageImageMagick implements ImageInterface
/** /**
* Greyscale an image * Greyscale an image
* *
* @return void * @return void
*/ */
public function greyscale() public function greyscale()
{ {
@ -67,7 +67,7 @@ class ImageImageMagick implements ImageInterface
* Save modifications to the image to the file system * Save modifications to the image to the file system
* *
* @param string $outputFile The file to write the modifications to. * @param string $outputFile The file to write the modifications to.
* @return void * @return void
*/ */
public function write($outputFile) public function write($outputFile)
{ {

View file

@ -13,7 +13,7 @@ class Photo
* This deletes the original photo and all versions. * This deletes the original photo and all versions.
* *
* @param string $id ID of the photo * @param string $id ID of the photo
* @return boolean * @return boolean
*/ */
public static function delete($id) public static function delete($id)
{ {
@ -33,7 +33,7 @@ class Photo
* @param int $width Width of the photo to generate * @param int $width Width of the photo to generate
* @param int $height Height of the photo to generate * @param int $height Height of the photo to generate
* @param string $options Options for the photo such as crop (CR) and greyscale (BW) * @param string $options Options for the photo such as crop (CR) and greyscale (BW)
* @return string * @return string
*/ */
public static function generateCustomKey($width, $height, $options = null) public static function generateCustomKey($width, $height, $options = null)
{ {
@ -47,7 +47,7 @@ class Photo
* @param int $width Width of the photo to generate * @param int $width Width of the photo to generate
* @param int $height Height of the photo to generate * @param int $height Height of the photo to generate
* @param string $options Options for the photo such as crop (CR) and greyscale (BW) * @param string $options Options for the photo such as crop (CR) and greyscale (BW)
* @return string * @return string
*/ */
public static function generateFragment($width, $height, $options) public static function generateFragment($width, $height, $options)
{ {
@ -63,7 +63,7 @@ class Photo
* The $options must start with a width and height (i.e. 800x600) * The $options must start with a width and height (i.e. 800x600)
* *
* @param string $options Options for the photo such as crop (CR) and greyscale (BW) * @param string $options Options for the photo such as crop (CR) and greyscale (BW)
* @return array * @return array
*/ */
public static function generateFragmentReverse($options) public static function generateFragmentReverse($options)
{ {
@ -82,7 +82,7 @@ class Photo
* @param string $param1 any parameter value * @param string $param1 any parameter value
* ... * ...
* @param string $paramN any parameter value * @param string $paramN any parameter value
* @return string * @return string
*/ */
public static function generateHash(/*$args1, $args2, ...*/) public static function generateHash(/*$args1, $args2, ...*/)
{ {
@ -101,7 +101,7 @@ class Photo
* These paths will also be the initial versions of the photo that are stored in the file system and database. * These paths will also be the initial versions of the photo that are stored in the file system and database.
* *
* @param string $photoName File name of the photo * @param string $photoName File name of the photo
* @return array * @return array
*/ */
public static function generatePaths($photoName) public static function generatePaths($photoName)
{ {
@ -142,7 +142,7 @@ class Photo
* @param int $width The width of the requested photo. * @param int $width The width of the requested photo.
* @param int $height The height of the requested photo. * @param int $height The height of the requested photo.
* @param string $options Optional options to be applied on the photo * @param string $options Optional options to be applied on the photo
* @return string * @return string
*/ */
// TODO make private and called via an API in the photo controller // TODO make private and called via an API in the photo controller
public static function generateUrlInternal($id, $width, $height, $options = null) public static function generateUrlInternal($id, $width, $height, $options = null)
@ -209,7 +209,7 @@ class Photo
* Reads exif data from a photo. * Reads exif data from a photo.
* *
* @param $photo Path to the photo. * @param $photo Path to the photo.
* @return array * @return array
*/ */
public static function readExif($photo) public static function readExif($photo)
{ {
@ -226,8 +226,8 @@ class Photo
$dateTaken = @mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]); $dateTaken = @mktime($time[0], $time[1], $time[2], $date[1], $date[2], $date[0]);
} }
$exif_array = array('dateTaken' => $dateTaken, 'width' => $size[0], $exif_array = array('dateTaken' => $dateTaken, 'width' => $size[0],
'height' => $size[1], 'cameraModel' => @$exif['Model'], 'height' => $size[1], 'cameraModel' => @$exif['Model'],
'cameraMake' => @$exif['Make'], 'cameraMake' => @$exif['Make'],
'ISO' => @$exif['ISOSpeedRatings'], 'ISO' => @$exif['ISOSpeedRatings'],
'exposureTime' => @$exif['ExposureTime']); 'exposureTime' => @$exif['ExposureTime']);
@ -386,7 +386,7 @@ class Photo
getLogger()->info("Photo ({$id}) successfully stored to the database"); getLogger()->info("Photo ({$id}) successfully stored to the database");
return $id; return $id;
} }
else else
{ {
getLogger()->warn("Photo ({$id}) could NOT be stored to the database"); getLogger()->warn("Photo ({$id}) could NOT be stored to the database");
return false; return false;
@ -424,7 +424,7 @@ class Photo
{ {
return array( return array(
'appId' => getConfig()->get('application')->appId, 'appId' => getConfig()->get('application')->appId,
'host' => getFs()->getHost(), 'host' => getFs()->getHost(),
'views' => 0, 'views' => 0,
'status' => 1, 'status' => 1,
'permission' => 0, // TODO 'permission' => 0, // TODO
@ -439,7 +439,7 @@ class Photo
* @param $param2 One of the options * @param $param2 One of the options
* ... * ...
* @param $paramN One of the options * @param $paramN One of the options
* @return boolean * @return boolean
*/ */
private static function isValidateHash(/*$hash, $args1, $args2, ...*/) private static function isValidateHash(/*$hash, $args1, $args2, ...*/)
{ {
@ -454,7 +454,7 @@ class Photo
return (substr(sha1(implode('.', $args)), 0, 5) == $hash); return (substr(sha1(implode('.', $args)), 0, 5) == $hash);
} }
private static function frac2Num($frac) private static function frac2Num($frac)
{ {
$parts = explode('/', $frac); $parts = explode('/', $frac);
@ -470,10 +470,10 @@ class Photo
return floatval($parts[0]) / floatval($parts[1]); return floatval($parts[0]) / floatval($parts[1]);
} }
/*** GPS Utils /*** GPS Utils
* from http://stackoverflow.com/questions/2526304/php-extract-gps-exif-data * from http://stackoverflow.com/questions/2526304/php-extract-gps-exif-data
**/ **/
private static function getGps($exifCoord, $hemi) private static function getGps($exifCoord, $hemi)
{ {
$degrees = count($exifCoord) > 0 ? self::frac2Num($exifCoord[0]) : 0; $degrees = count($exifCoord) > 0 ? self::frac2Num($exifCoord[0]) : 0;
$minutes = count($exifCoord) > 1 ? self::frac2Num($exifCoord[1]) : 0; $minutes = count($exifCoord) > 1 ? self::frac2Num($exifCoord[1]) : 0;
@ -489,7 +489,7 @@ class Photo
* Reads IPTC data from a photo. * Reads IPTC data from a photo.
* *
* @param $photo Path to the photo. * @param $photo Path to the photo.
* @return array * @return array
*/ */
private static function readIptc($photo) private static function readIptc($photo)
{ {
@ -511,7 +511,7 @@ class Photo
$iptc_array['title'] = $iptc['2#105'][0]; $iptc_array['title'] = $iptc['2#105'][0];
else if(isset($iptc['2#005'])) else if(isset($iptc['2#005']))
$iptc_array['title'] = $iptc['2#005'][0]; $iptc_array['title'] = $iptc['2#005'][0];
if(isset($iptc['2#120'])) if(isset($iptc['2#120']))
$iptc_array['description'] = $iptc['2#120'][0]; $iptc_array['description'] = $iptc['2#120'][0];
if(isset($iptc['2#025'])) if(isset($iptc['2#025']))

View file

@ -47,12 +47,12 @@ class Url
else else
return Utility::returnValue(sprintf('/photos/%s/list', $options), $write); return Utility::returnValue(sprintf('/photos/%s/list', $options), $write);
} }
public static function photoUpload($write = true) public static function photoUpload($write = true)
{ {
return Utility::returnValue('/photos/upload', $write); return Utility::returnValue('/photos/upload', $write);
} }
public static function photosUpload($write = true) public static function photosUpload($write = true)
{ {
return Utility::returnValue('/photos/upload', $write); return Utility::returnValue('/photos/upload', $write);

View file

@ -37,7 +37,7 @@ class User
/** /**
* Get the email address of the logged in user. * Get the email address of the logged in user.
* *
* @return string * @return string
*/ */
public static function getEmailAddress() public static function getEmailAddress()
{ {
@ -80,7 +80,7 @@ class User
{ {
$type = ucwords($type); $type = ucwords($type);
$key = "last{$type}Id"; $key = "last{$type}Id";
$user = self::getUserRecord(); $user = self::getUserRecord();
if($user === false) if($user === false)
return false; return false;

View file

@ -12,7 +12,7 @@ class Webhook
* Accepts a set of params that must include a type and targetType * Accepts a set of params that must include a type and targetType
* *
* @param array $params Params describing the action to be added * @param array $params Params describing the action to be added
* @return mixed Action ID on success, false on failure * @return mixed Action ID on success, false on failure
*/ */
public static function add($params) public static function add($params)
{ {

View file

@ -2,7 +2,7 @@
<form method="post"> <form method="post">
<label>App Name</label> <label>App Name</label>
<input type="text" name="name" placeholder="Enter a name"> <input type="text" name="name" placeholder="Enter a name">
<!--<label>Permission</label> <!--<label>Permission</label>
<ul> <ul>
<li><input type="checkbox" name="permissions[]" value="read" class="checkbox" checked="true"> Read</li> <li><input type="checkbox" name="permissions[]" value="read" class="checkbox" checked="true"> Read</li>

View file

@ -65,7 +65,7 @@
<label>Members</label> <label>Members</label>
<input type="text" placeholder="Email addresses of members (separate with commas)" value="" name="members"> <input type="text" placeholder="Email addresses of members (separate with commas)" value="" name="members">
<button type="submit" class="group-update-click">Create a new group</button> <button type="submit" class="group-update-click">Create a new group</button>
</form> </form>
@ -81,7 +81,7 @@
<label>Members</label> <label>Members</label>
<input type="text" value="<?php Utility::safe(implode(',', $group['members'])); ?>" name="members"> <input type="text" value="<?php Utility::safe(implode(',', $group['members'])); ?>" name="members">
<button type="submit" class="group-update-click">Update</button> <button type="submit" class="group-update-click">Update</button>
</form><!--(<a href="/group/<?php echo $group['id']; ?>/delete" class="group-delete-click">delete</a>)--> </form><!--(<a href="/group/<?php echo $group['id']; ?>/delete" class="group-delete-click">delete</a>)-->
</li> </li>

View file

@ -332,7 +332,7 @@ class DatabaseSimpleDbTest extends PHPUnit_Framework_TestCase
->will($this->returnValue(new AWSBatchSuccessResponse)); ->will($this->returnValue(new AWSBatchSuccessResponse));
$db = getDb(); $db = getDb();
$db->inject('db', $this->sdbStub); $db->inject('db', $this->sdbStub);
$res = $db->postTags(array(array('id' => 'foo'))); $res = $db->postTags(array(array('id' => 'foo')));
$this->assertTrue($res, 'The SimpleDb adapter did not return TRUE for postTags'); $this->assertTrue($res, 'The SimpleDb adapter did not return TRUE for postTags');
} }
@ -343,7 +343,7 @@ class DatabaseSimpleDbTest extends PHPUnit_Framework_TestCase
->will($this->returnValue(new AWSBatchFailureResponse)); ->will($this->returnValue(new AWSBatchFailureResponse));
$db = getDb(); $db = getDb();
$db->inject('db', $this->sdbStub); $db->inject('db', $this->sdbStub);
$res = $db->postTags(array(array('id' => 'foo'))); $res = $db->postTags(array(array('id' => 'foo')));
$this->assertFalse($res, 'The SimpleDb adapter did not return FALSE for postTags'); $this->assertFalse($res, 'The SimpleDb adapter did not return FALSE for postTags');
} }
@ -357,7 +357,7 @@ class DatabaseSimpleDbTest extends PHPUnit_Framework_TestCase
->will($this->returnValue(new AWSBatchSuccessResponse)); ->will($this->returnValue(new AWSBatchSuccessResponse));
$db = getDb(); $db = getDb();
$db->inject('db', $this->sdbStub); $db->inject('db', $this->sdbStub);
$res = $db->postTagsCounter(array('foo0' => 1, 'foo1' => 2)); $res = $db->postTagsCounter(array('foo0' => 1, 'foo1' => 2));
$this->assertTrue($res, 'The SimpleDb adapter did not return TRUE for postTags'); $this->assertTrue($res, 'The SimpleDb adapter did not return TRUE for postTags');
} }
@ -368,7 +368,7 @@ class DatabaseSimpleDbTest extends PHPUnit_Framework_TestCase
->will($this->returnValue(new AWSBatchFailureResponse)); ->will($this->returnValue(new AWSBatchFailureResponse));
$db = getDb(); $db = getDb();
$db->inject('db', $this->sdbStub); $db->inject('db', $this->sdbStub);
$res = $db->postTags(array('tag' => array('id' => 'foo'))); $res = $db->postTags(array('tag' => array('id' => 'foo')));
$this->assertFalse($res, 'The SimpleDb adapter did not return FALSE for postTags'); $this->assertFalse($res, 'The SimpleDb adapter did not return FALSE for postTags');
} }

View file

@ -52,12 +52,12 @@ class AWSBatchSuccessResponse extends AWSSuccessResponse
public function create_domain() public function create_domain()
{ {
return new AWSSuccessResponse; return new AWSSuccessResponse;
} }
public function create_object() public function create_object()
{ {
return new AWSSuccessResponse; return new AWSSuccessResponse;
} }
public function put_attributes() public function put_attributes()
@ -79,7 +79,7 @@ class AWSBatchSuccessResponse extends AWSSuccessResponse
$retval = array(new AWSPhotoMockSdb($this->count)); $retval = array(new AWSPhotoMockSdb($this->count));
break; break;
default: default:
$retval = new AWSSuccessResponse; $retval = new AWSSuccessResponse;
break; break;
} }
return $retval; return $retval;
@ -100,7 +100,7 @@ class AWSBatchFailureResponse extends AWSFailureResponse
public function send() public function send()
{ {
return new AWSFailureResponse; return new AWSFailureResponse;
} }
public function put_attributes() public function put_attributes()
@ -110,7 +110,7 @@ class AWSBatchFailureResponse extends AWSFailureResponse
public function create_object() public function create_object()
{ {
return new AWSFailureResponse; return new AWSFailureResponse;
} }
} }