Merge branch 'master' into oc_error
This commit is contained in:
commit
9f82edc157
71 changed files with 6077 additions and 959 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -40,6 +40,9 @@ nbproject
|
|||
# Cloud9IDE
|
||||
.settings.xml
|
||||
|
||||
# vim ex mode
|
||||
.vimrc
|
||||
|
||||
# Mac OS
|
||||
.DS_Store
|
||||
|
||||
|
|
83
3rdparty/aws-sdk/config-sample.inc.php
vendored
83
3rdparty/aws-sdk/config-sample.inc.php
vendored
|
@ -1,83 +0,0 @@
|
|||
<?php if (!class_exists('CFRuntime')) die('No direct access allowed.');
|
||||
/**
|
||||
* Stores your AWS account information. Add your account information, and then rename this file
|
||||
* to 'config.inc.php'.
|
||||
*
|
||||
* @version 2011.12.14
|
||||
* @license See the included NOTICE.md file for more information.
|
||||
* @copyright See the included NOTICE.md file for more information.
|
||||
* @link http://aws.amazon.com/php/ PHP Developer Center
|
||||
* @link http://aws.amazon.com/security-credentials AWS Security Credentials
|
||||
*/
|
||||
|
||||
|
||||
/*###################################################################################################
|
||||
|
||||
As of version 1.5, the AWS SDK for PHP uses the CFCredentials class to handle credentials.
|
||||
This class has the advantage of being able to support multiple sets of credentials at a time,
|
||||
including the ability for credential sets to inherit settings from other credential sets.
|
||||
|
||||
Some example uses are noted at https://gist.github.com/1478912
|
||||
|
||||
Notes:
|
||||
|
||||
* You can define one or more credential sets.
|
||||
|
||||
* Credential sets can be named anything that PHP allows for an associative array key;
|
||||
"production", "staging", etc., are just sample values. Feel free to rename them.
|
||||
|
||||
* A credential set only has four required entries: key, secret, default_cache_config and
|
||||
certificate_authority. Aside from these, you can add any additional bits of information
|
||||
you'd like to keep easily accessible (e.g., multi-factor authentication device key, your
|
||||
AWS Account ID, your canonical identifiers).
|
||||
|
||||
* Additional credential sets can inherit the properties of another credential set using the
|
||||
@inherit keyword.
|
||||
|
||||
* If more than one credential set is provided, a default credential set must be specified
|
||||
using the @default keyword.
|
||||
|
||||
* If you only have one credential set, you can set it to the @default keyword.
|
||||
|
||||
* View the documentation for the CFCredentials::set() method to view usage examples.
|
||||
|
||||
###################################################################################################*/
|
||||
|
||||
|
||||
/**
|
||||
* Create a list of credential sets that can be used with the SDK.
|
||||
*/
|
||||
CFCredentials::set(array(
|
||||
|
||||
// Credentials for the development environment.
|
||||
'development' => array(
|
||||
|
||||
// Amazon Web Services Key. Found in the AWS Security Credentials. You can also pass
|
||||
// this value as the first parameter to a service constructor.
|
||||
'key' => 'development-key',
|
||||
|
||||
// Amazon Web Services Secret Key. Found in the AWS Security Credentials. You can also
|
||||
// pass this value as the second parameter to a service constructor.
|
||||
'secret' => 'development-secret',
|
||||
|
||||
// This option allows you to configure a preferred storage type to use for caching by
|
||||
// default. This can be changed later using the set_cache_config() method.
|
||||
//
|
||||
// Valid values are: `apc`, `xcache`, or a file system path such as `./cache` or
|
||||
// `/tmp/cache/`.
|
||||
'default_cache_config' => '',
|
||||
|
||||
// Determines which Cerificate Authority file to use.
|
||||
//
|
||||
// A value of boolean `false` will use the Certificate Authority file available on the
|
||||
// system. A value of boolean `true` will use the Certificate Authority provided by the
|
||||
// SDK. Passing a file system path to a Certificate Authority file (chmodded to `0755`)
|
||||
// will use that.
|
||||
//
|
||||
// Leave this set to `false` if you're not sure.
|
||||
'certificate_authority' => false
|
||||
),
|
||||
|
||||
// Specify a default credential set to use if there are more than one.
|
||||
'@default' => 'development'
|
||||
));
|
25
3rdparty/aws-sdk/lib/cachecore/LICENSE
vendored
Executable file
25
3rdparty/aws-sdk/lib/cachecore/LICENSE
vendored
Executable file
|
@ -0,0 +1,25 @@
|
|||
Copyright (c) 2006-2010 Ryan Parman, Foleeo Inc., and contributors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
* Neither the name of Ryan Parman, Foleeo Inc. nor the names of its contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior written
|
||||
permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
|
||||
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
|
||||
AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
1
3rdparty/aws-sdk/lib/cachecore/README
vendored
Executable file
1
3rdparty/aws-sdk/lib/cachecore/README
vendored
Executable file
|
@ -0,0 +1 @@
|
|||
A simple caching system for PHP5 that provides a single interface for a variety of storage types.
|
5
3rdparty/aws-sdk/lib/cachecore/_sql/README
vendored
Executable file
5
3rdparty/aws-sdk/lib/cachecore/_sql/README
vendored
Executable file
|
@ -0,0 +1,5 @@
|
|||
The .sql files in this directory contain the code to create the tables for database caching.
|
||||
|
||||
If you're not using database caching, you can safely ignore these.
|
||||
|
||||
If you ARE using database caching, simply load the correct *.sql file into your database to set up the required tables.
|
7
3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql
vendored
Executable file
7
3rdparty/aws-sdk/lib/cachecore/_sql/mysql.sql
vendored
Executable file
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE `cache` (
|
||||
`id` char(40) NOT NULL default '',
|
||||
`expires` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||
`data` longtext,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `id` (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
6
3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql
vendored
Executable file
6
3rdparty/aws-sdk/lib/cachecore/_sql/pgsql.sql
vendored
Executable file
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE "cache" (
|
||||
expires timestamp without time zone NOT NULL,
|
||||
id character(40) NOT NULL,
|
||||
data text NOT NULL
|
||||
)
|
||||
WITH (OIDS=TRUE);
|
2
3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql
vendored
Executable file
2
3rdparty/aws-sdk/lib/cachecore/_sql/sqlite3.sql
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
CREATE TABLE cache (id TEXT, expires NUMERIC, data BLOB);
|
||||
CREATE UNIQUE INDEX idx ON cache(id ASC);
|
126
3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php
vendored
Executable file
126
3rdparty/aws-sdk/lib/cachecore/cacheapc.class.php
vendored
Executable file
|
@ -0,0 +1,126 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all APC-based cache methods. Inherits additional methods from <CacheCore>. Adheres
|
||||
* to the ICacheCore interface.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
* @link http://php.net/apc APC
|
||||
*/
|
||||
class CacheAPC extends CacheCore implements ICacheCore
|
||||
{
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
parent::__construct($name, null, $expires, $gzip);
|
||||
$this->id = $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return apc_add($this->id, $data, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
if ($data = apc_fetch($this->id))
|
||||
{
|
||||
$data = $this->gzip ? gzuncompress($data) : $data;
|
||||
return unserialize($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return apc_store($this->id, $data, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
return apc_delete($this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. APC manages its own expirations.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. APC manages its own expirations.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. APC manages its own expirations.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CacheAPC_Exception extends CacheCore_Exception {}
|
160
3rdparty/aws-sdk/lib/cachecore/cachecore.class.php
vendored
Executable file
160
3rdparty/aws-sdk/lib/cachecore/cachecore.class.php
vendored
Executable file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all shared caching methods. This is not intended to be instantiated directly, but is
|
||||
* extended by the cache-specific classes.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
*/
|
||||
class CacheCore
|
||||
{
|
||||
/**
|
||||
* A name to uniquely identify the cache object by.
|
||||
*/
|
||||
var $name;
|
||||
|
||||
/**
|
||||
* Where to store the cache.
|
||||
*/
|
||||
var $location;
|
||||
|
||||
/**
|
||||
* The number of seconds before a cache object is considered stale.
|
||||
*/
|
||||
var $expires;
|
||||
|
||||
/**
|
||||
* Used internally to uniquely identify the location + name of the cache object.
|
||||
*/
|
||||
var $id;
|
||||
|
||||
/**
|
||||
* Stores the time when the cache object was created.
|
||||
*/
|
||||
var $timestamp;
|
||||
|
||||
/**
|
||||
* Stores whether or not the content should be gzipped when stored
|
||||
*/
|
||||
var $gzip;
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
if (!extension_loaded('zlib'))
|
||||
{
|
||||
$gzip = false;
|
||||
}
|
||||
|
||||
$this->name = $name;
|
||||
$this->location = $location;
|
||||
$this->expires = $expires;
|
||||
$this->gzip = $gzip;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for chaining from the constructor. Requires PHP 5.3 or newer.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public static function init($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<'))
|
||||
{
|
||||
throw new Exception('PHP 5.3 or newer is required to use CacheCore::init().');
|
||||
}
|
||||
|
||||
$self = get_called_class();
|
||||
return new $self($name, $location, $expires, $gzip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of seconds until a cache expires.
|
||||
*
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @return $this
|
||||
*/
|
||||
public function expire_in($seconds)
|
||||
{
|
||||
$this->expires = $seconds;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides a simple, straightforward cache-logic mechanism. Useful for non-complex response caches.
|
||||
*
|
||||
* @param string|function $callback (Required) The name of the function to fire when we need to fetch new data to cache.
|
||||
* @param array params (Optional) Parameters to pass into the callback function, as an array.
|
||||
* @return array The cached data being requested.
|
||||
*/
|
||||
public function response_manager($callback, $params = null)
|
||||
{
|
||||
// Automatically handle $params values.
|
||||
$params = is_array($params) ? $params : array($params);
|
||||
|
||||
if ($data = $this->read())
|
||||
{
|
||||
if ($this->is_expired())
|
||||
{
|
||||
if ($data = call_user_func_array($callback, $params))
|
||||
{
|
||||
$this->update($data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->reset();
|
||||
$data = $this->read();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($data = call_user_func_array($callback, $params))
|
||||
{
|
||||
$this->create($data);
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CORE DEPENDENCIES
|
||||
|
||||
// Include the ICacheCore interface.
|
||||
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php'))
|
||||
{
|
||||
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'icachecore.interface.php';
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CacheCore_Exception extends Exception {}
|
189
3rdparty/aws-sdk/lib/cachecore/cachefile.class.php
vendored
Executable file
189
3rdparty/aws-sdk/lib/cachecore/cachefile.class.php
vendored
Executable file
|
@ -0,0 +1,189 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all file-based cache methods. Inherits additional methods from <CacheCore>. Adheres
|
||||
* to the ICacheCore interface.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
*/
|
||||
class CacheFile extends CacheCore implements ICacheCore
|
||||
{
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
parent::__construct($name, $location, $expires, $gzip);
|
||||
$this->id = $this->location . '/' . $this->name . '.cache';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
if (file_exists($this->id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif (realpath($this->location) && file_exists($this->location) && is_writeable($this->location))
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return (bool) file_put_contents($this->id, $data);
|
||||
}
|
||||
elseif (realpath($this->location) && file_exists($this->location))
|
||||
{
|
||||
throw new CacheFile_Exception('The file system location "' . $this->location . '" is not writable. Check the file system permissions for this directory.');
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CacheFile_Exception('The file system location "' . $this->location . '" does not exist. Create the directory, or double-check any relative paths that may have been set.');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
if (file_exists($this->id) && is_readable($this->id))
|
||||
{
|
||||
$data = file_get_contents($this->id);
|
||||
$data = $this->gzip ? gzuncompress($data) : $data;
|
||||
$data = unserialize($data);
|
||||
|
||||
if ($data === false)
|
||||
{
|
||||
/*
|
||||
This should only happen when someone changes the gzip settings and there is
|
||||
existing data or someone has been mucking about in the cache folder manually.
|
||||
Delete the bad entry since the file cache doesn't clean up after itself and
|
||||
then return false so fresh data will be retrieved.
|
||||
*/
|
||||
$this->delete();
|
||||
return false;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
if (file_exists($this->id) && is_writeable($this->id))
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return (bool) file_put_contents($this->id, $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CacheFile_Exception('The file system location is not writeable. Check your file system permissions and ensure that the cache directory exists.');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if (file_exists($this->id))
|
||||
{
|
||||
return unlink($this->id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the cache object is expired or not.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired()
|
||||
{
|
||||
if ($this->timestamp() + $this->expires < time())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the timestamp of the cache.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
clearstatcache();
|
||||
|
||||
if (file_exists($this->id))
|
||||
{
|
||||
$this->timestamp = filemtime($this->id);
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the freshness of the cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
if (file_exists($this->id))
|
||||
{
|
||||
return touch($this->id);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CacheFile_Exception extends CacheCore_Exception {}
|
183
3rdparty/aws-sdk/lib/cachecore/cachemc.class.php
vendored
Executable file
183
3rdparty/aws-sdk/lib/cachecore/cachemc.class.php
vendored
Executable file
|
@ -0,0 +1,183 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all Memcache-based cache methods. Inherits additional methods from <CacheCore>. Adheres
|
||||
* to the ICacheCore interface.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
* @link http://php.net/memcache Memcache
|
||||
* @link http://php.net/memcached Memcached
|
||||
*/
|
||||
class CacheMC extends CacheCore implements ICacheCore
|
||||
{
|
||||
/**
|
||||
* Holds the Memcache object.
|
||||
*/
|
||||
var $memcache = null;
|
||||
|
||||
/**
|
||||
* Whether the Memcached extension is being used (as opposed to Memcache).
|
||||
*/
|
||||
var $is_memcached = false;
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
parent::__construct($name, null, $expires, $gzip);
|
||||
$this->id = $this->name;
|
||||
|
||||
// Prefer Memcached over Memcache.
|
||||
if (class_exists('Memcached'))
|
||||
{
|
||||
$this->memcache = new Memcached();
|
||||
$this->is_memcached = true;
|
||||
}
|
||||
elseif (class_exists('Memcache'))
|
||||
{
|
||||
$this->memcache = new Memcache();
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enable compression, if available
|
||||
if ($this->gzip)
|
||||
{
|
||||
if ($this->is_memcached)
|
||||
{
|
||||
$this->memcache->setOption(Memcached::OPT_COMPRESSION, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->gzip = MEMCACHE_COMPRESSED;
|
||||
}
|
||||
}
|
||||
|
||||
// Process Memcached servers.
|
||||
if (isset($location) && sizeof($location) > 0)
|
||||
{
|
||||
foreach ($location as $loc)
|
||||
{
|
||||
if (isset($loc['port']) && !empty($loc['port']))
|
||||
{
|
||||
$this->memcache->addServer($loc['host'], $loc['port']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->memcache->addServer($loc['host'], 11211);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
if ($this->is_memcached)
|
||||
{
|
||||
return $this->memcache->set($this->id, $data, $this->expires);
|
||||
}
|
||||
return $this->memcache->set($this->id, $data, $this->gzip, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
if ($this->is_memcached)
|
||||
{
|
||||
return $this->memcache->get($this->id);
|
||||
}
|
||||
return $this->memcache->get($this->id, $this->gzip);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
if ($this->is_memcached)
|
||||
{
|
||||
return $this->memcache->replace($this->id, $data, $this->expires);
|
||||
}
|
||||
return $this->memcache->replace($this->id, $data, $this->gzip, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
return $this->memcache->delete($this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. Memcache manages its own expirations.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. Memcache manages its own expirations.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. Memcache manages its own expirations.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CacheMC_Exception extends CacheCore_Exception {}
|
297
3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php
vendored
Executable file
297
3rdparty/aws-sdk/lib/cachecore/cachepdo.class.php
vendored
Executable file
|
@ -0,0 +1,297 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all PDO-based cache methods. Inherits additional methods from <CacheCore>. Adheres
|
||||
* to the ICacheCore interface.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
* @link http://php.net/pdo PDO
|
||||
*/
|
||||
class CachePDO extends CacheCore implements ICacheCore
|
||||
{
|
||||
/**
|
||||
* Reference to the PDO connection object.
|
||||
*/
|
||||
var $pdo = null;
|
||||
|
||||
/**
|
||||
* Holds the parsed URL components.
|
||||
*/
|
||||
var $dsn = null;
|
||||
|
||||
/**
|
||||
* Holds the PDO-friendly version of the connection string.
|
||||
*/
|
||||
var $dsn_string = null;
|
||||
|
||||
/**
|
||||
* Holds the prepared statement for creating an entry.
|
||||
*/
|
||||
var $create = null;
|
||||
|
||||
/**
|
||||
* Holds the prepared statement for reading an entry.
|
||||
*/
|
||||
var $read = null;
|
||||
|
||||
/**
|
||||
* Holds the prepared statement for updating an entry.
|
||||
*/
|
||||
var $update = null;
|
||||
|
||||
/**
|
||||
* Holds the prepared statement for resetting the expiry of an entry.
|
||||
*/
|
||||
var $reset = null;
|
||||
|
||||
/**
|
||||
* Holds the prepared statement for deleting an entry.
|
||||
*/
|
||||
var $delete = null;
|
||||
|
||||
/**
|
||||
* Holds the response of the read so we only need to fetch it once instead of doing
|
||||
* multiple queries.
|
||||
*/
|
||||
var $store_read = null;
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* Tested with [MySQL 5.0.x](http://mysql.com), [PostgreSQL](http://postgresql.com), and
|
||||
* [SQLite 3.x](http://sqlite.org). SQLite 2.x is assumed to work. No other PDO-supported databases have
|
||||
* been tested (e.g. Oracle, Microsoft SQL Server, IBM DB2, ODBC, Sybase, Firebird). Feel free to send
|
||||
* patches for additional database support.
|
||||
*
|
||||
* See <http://php.net/pdo> for more information.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
// Make sure the name is no longer than 40 characters.
|
||||
$name = sha1($name);
|
||||
|
||||
// Call parent constructor and set id.
|
||||
parent::__construct($name, $location, $expires, $gzip);
|
||||
$this->id = $this->name;
|
||||
$options = array();
|
||||
|
||||
// Check if the location contains :// (e.g. mysql://user:pass@hostname:port/table)
|
||||
if (stripos($location, '://') === false)
|
||||
{
|
||||
// No? Just pass it through.
|
||||
$this->dsn = parse_url($location);
|
||||
$this->dsn_string = $location;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Yes? Parse and set the DSN
|
||||
$this->dsn = parse_url($location);
|
||||
$this->dsn_string = $this->dsn['scheme'] . ':host=' . $this->dsn['host'] . ((isset($this->dsn['port'])) ? ';port=' . $this->dsn['port'] : '') . ';dbname=' . substr($this->dsn['path'], 1);
|
||||
}
|
||||
|
||||
// Make sure that user/pass are defined.
|
||||
$user = isset($this->dsn['user']) ? $this->dsn['user'] : null;
|
||||
$pass = isset($this->dsn['pass']) ? $this->dsn['pass'] : null;
|
||||
|
||||
// Set persistence for databases that support it.
|
||||
switch ($this->dsn['scheme'])
|
||||
{
|
||||
case 'mysql': // MySQL
|
||||
case 'pgsql': // PostgreSQL
|
||||
$options[PDO::ATTR_PERSISTENT] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// Instantiate a new PDO object with a persistent connection.
|
||||
$this->pdo = new PDO($this->dsn_string, $user, $pass, $options);
|
||||
|
||||
// Define prepared statements for improved performance.
|
||||
$this->create = $this->pdo->prepare("INSERT INTO cache (id, expires, data) VALUES (:id, :expires, :data)");
|
||||
$this->read = $this->pdo->prepare("SELECT id, expires, data FROM cache WHERE id = :id");
|
||||
$this->reset = $this->pdo->prepare("UPDATE cache SET expires = :expires WHERE id = :id");
|
||||
$this->delete = $this->pdo->prepare("DELETE FROM cache WHERE id = :id");
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
$this->create->bindParam(':id', $this->id);
|
||||
$this->create->bindParam(':data', $data);
|
||||
$this->create->bindParam(':expires', $this->generate_timestamp());
|
||||
|
||||
return (bool) $this->create->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
if (!$this->store_read)
|
||||
{
|
||||
$this->read->bindParam(':id', $this->id);
|
||||
$this->read->execute();
|
||||
$this->store_read = $this->read->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
if ($this->store_read)
|
||||
{
|
||||
$data = $this->store_read['data'];
|
||||
$data = $this->gzip ? gzuncompress($data) : $data;
|
||||
|
||||
return unserialize($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
$this->delete();
|
||||
return $this->create($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$this->delete->bindParam(':id', $this->id);
|
||||
return $this->delete->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the cache object is expired or not.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired()
|
||||
{
|
||||
if ($this->timestamp() + $this->expires < time())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the timestamp of the cache.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
if (!$this->store_read)
|
||||
{
|
||||
$this->read->bindParam(':id', $this->id);
|
||||
$this->read->execute();
|
||||
$this->store_read = $this->read->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
if ($this->store_read)
|
||||
{
|
||||
$value = $this->store_read['expires'];
|
||||
|
||||
// If 'expires' isn't yet an integer, convert it into one.
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
$value = strtotime($value);
|
||||
}
|
||||
|
||||
$this->timestamp = date('U', $value);
|
||||
return $this->timestamp;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the freshness of the cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
$this->reset->bindParam(':id', $this->id);
|
||||
$this->reset->bindParam(':expires', $this->generate_timestamp());
|
||||
return (bool) $this->reset->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of supported PDO database drivers. Identical to <PDO::getAvailableDrivers()>.
|
||||
*
|
||||
* @return array The list of supported database drivers.
|
||||
* @link http://php.net/pdo.getavailabledrivers PHP Method
|
||||
*/
|
||||
public function get_drivers()
|
||||
{
|
||||
return PDO::getAvailableDrivers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a timestamp value apropriate to the current database type.
|
||||
*
|
||||
* @return mixed Timestamp for MySQL and PostgreSQL, integer value for SQLite.
|
||||
*/
|
||||
protected function generate_timestamp()
|
||||
{
|
||||
// Define 'expires' settings differently.
|
||||
switch ($this->dsn['scheme'])
|
||||
{
|
||||
// These support timestamps.
|
||||
case 'mysql': // MySQL
|
||||
case 'pgsql': // PostgreSQL
|
||||
$expires = date(DATE_FORMAT_MYSQL, time());
|
||||
break;
|
||||
|
||||
// These support integers.
|
||||
case 'sqlite': // SQLite 3
|
||||
case 'sqlite2': // SQLite 2
|
||||
$expires = time();
|
||||
break;
|
||||
}
|
||||
|
||||
return $expires;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CachePDO_Exception extends CacheCore_Exception {}
|
129
3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php
vendored
Executable file
129
3rdparty/aws-sdk/lib/cachecore/cachexcache.class.php
vendored
Executable file
|
@ -0,0 +1,129 @@
|
|||
<?php
|
||||
/**
|
||||
* Container for all XCache-based cache methods. Inherits additional methods from <CacheCore>. Adheres
|
||||
* to the ICacheCore interface.
|
||||
*
|
||||
* @version 2012.04.17
|
||||
* @copyright 2006-2012 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2012 Amazon.com, Inc. or its affiliates.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
* @link http://xcache.lighttpd.net XCache
|
||||
*/
|
||||
class CacheXCache extends CacheCore implements ICacheCore
|
||||
{
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONSTRUCTOR
|
||||
|
||||
/**
|
||||
* Constructs a new instance of this class.
|
||||
*
|
||||
* @param string $name (Required) A name to uniquely identify the cache object.
|
||||
* @param string $location (Optional) The location to store the cache object in. This may vary by cache method. The default value is NULL.
|
||||
* @param integer $expires (Optional) The number of seconds until a cache object is considered stale. The default value is 0.
|
||||
* @param boolean $gzip (Optional) Whether data should be gzipped before being stored. The default value is true.
|
||||
* @return object Reference to the cache object.
|
||||
*/
|
||||
public function __construct($name, $location = null, $expires = 0, $gzip = true)
|
||||
{
|
||||
parent::__construct($name, null, $expires, $gzip);
|
||||
$this->id = $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data)
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return xcache_set($this->id, $data, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
if ($data = xcache_get($this->id))
|
||||
{
|
||||
$data = $this->gzip ? gzuncompress($data) : $data;
|
||||
return unserialize($data);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data)
|
||||
{
|
||||
$data = serialize($data);
|
||||
$data = $this->gzip ? gzcompress($data) : $data;
|
||||
|
||||
return xcache_set($this->id, $data, $this->expires);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
return xcache_unset($this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined here, but always returns false. XCache manages it's own expirations. It's worth
|
||||
* mentioning that if the server is configured for a long xcache.var_gc_interval then it IS
|
||||
* possible for expired data to remain in the var cache, though it is not possible to access
|
||||
* it.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. XCache manages its own expirations.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implemented here, but always returns `false`. XCache manages its own expirations.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// EXCEPTIONS
|
||||
|
||||
class CacheXCache_Exception extends CacheCore_Exception {}
|
66
3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php
vendored
Executable file
66
3rdparty/aws-sdk/lib/cachecore/icachecore.interface.php
vendored
Executable file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
/**
|
||||
* Defines the methods that all implementing classes MUST have. Covers CRUD (create, read, update,
|
||||
* delete) methods, as well as others that are used in the base <CacheCore> class.
|
||||
*
|
||||
* @version 2009.03.22
|
||||
* @copyright 2006-2010 Ryan Parman
|
||||
* @copyright 2006-2010 Foleeo, Inc.
|
||||
* @copyright 2008-2010 Contributors
|
||||
* @license http://opensource.org/licenses/bsd-license.php Simplified BSD License
|
||||
* @link http://github.com/skyzyx/cachecore CacheCore
|
||||
* @link http://getcloudfusion.com CloudFusion
|
||||
*/
|
||||
interface ICacheCore
|
||||
{
|
||||
/**
|
||||
* Creates a new cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function create($data);
|
||||
|
||||
/**
|
||||
* Reads a cache.
|
||||
*
|
||||
* @return mixed Either the content of the cache object, or boolean `false`.
|
||||
*/
|
||||
public function read();
|
||||
|
||||
/**
|
||||
* Updates an existing cache.
|
||||
*
|
||||
* @param mixed $data (Required) The data to cache.
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function update($data);
|
||||
|
||||
/**
|
||||
* Deletes a cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function delete();
|
||||
|
||||
/**
|
||||
* Checks whether the cache object is expired or not.
|
||||
*
|
||||
* @return boolean Whether the cache is expired or not.
|
||||
*/
|
||||
public function is_expired();
|
||||
|
||||
/**
|
||||
* Retrieves the timestamp of the cache.
|
||||
*
|
||||
* @return mixed Either the Unix time stamp of the cache creation, or boolean `false`.
|
||||
*/
|
||||
public function timestamp();
|
||||
|
||||
/**
|
||||
* Resets the freshness of the cache.
|
||||
*
|
||||
* @return boolean Whether the operation was successful.
|
||||
*/
|
||||
public function reset();
|
||||
}
|
89
3rdparty/aws-sdk/sdk.class.php
vendored
89
3rdparty/aws-sdk/sdk.class.php
vendored
|
@ -1387,48 +1387,49 @@ class CFLoader
|
|||
// Register the autoloader.
|
||||
spl_autoload_register(array('CFLoader', 'autoloader'));
|
||||
|
||||
// Don't look for any configuration files, the Amazon S3 storage backend handles configuration
|
||||
|
||||
/*%******************************************************************************************%*/
|
||||
// CONFIGURATION
|
||||
|
||||
// Look for include file in the same directory (e.g. `./config.inc.php`).
|
||||
if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php'))
|
||||
{
|
||||
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php';
|
||||
}
|
||||
// Fallback to `~/.aws/sdk/config.inc.php`
|
||||
else
|
||||
{
|
||||
if (!isset($_ENV['HOME']) && isset($_SERVER['HOME']))
|
||||
{
|
||||
$_ENV['HOME'] = $_SERVER['HOME'];
|
||||
}
|
||||
elseif (!isset($_ENV['HOME']) && !isset($_SERVER['HOME']))
|
||||
{
|
||||
$_ENV['HOME'] = `cd ~ && pwd`;
|
||||
if (!$_ENV['HOME'])
|
||||
{
|
||||
switch (strtolower(PHP_OS))
|
||||
{
|
||||
case 'darwin':
|
||||
$_ENV['HOME'] = '/Users/' . get_current_user();
|
||||
break;
|
||||
|
||||
case 'windows':
|
||||
case 'winnt':
|
||||
case 'win32':
|
||||
$_ENV['HOME'] = 'c:' . DIRECTORY_SEPARATOR . 'Documents and Settings' . DIRECTORY_SEPARATOR . get_current_user();
|
||||
break;
|
||||
|
||||
default:
|
||||
$_ENV['HOME'] = '/home/' . get_current_user();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (getenv('HOME') && file_exists(getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php'))
|
||||
{
|
||||
include_once getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php';
|
||||
}
|
||||
}
|
||||
// /*%******************************************************************************************%*/
|
||||
// // CONFIGURATION
|
||||
//
|
||||
// // Look for include file in the same directory (e.g. `./config.inc.php`).
|
||||
// if (file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php'))
|
||||
// {
|
||||
// include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.inc.php';
|
||||
// }
|
||||
// // Fallback to `~/.aws/sdk/config.inc.php`
|
||||
// else
|
||||
// {
|
||||
// if (!isset($_ENV['HOME']) && isset($_SERVER['HOME']))
|
||||
// {
|
||||
// $_ENV['HOME'] = $_SERVER['HOME'];
|
||||
// }
|
||||
// elseif (!isset($_ENV['HOME']) && !isset($_SERVER['HOME']))
|
||||
// {
|
||||
// $_ENV['HOME'] = `cd ~ && pwd`;
|
||||
// if (!$_ENV['HOME'])
|
||||
// {
|
||||
// switch (strtolower(PHP_OS))
|
||||
// {
|
||||
// case 'darwin':
|
||||
// $_ENV['HOME'] = '/Users/' . get_current_user();
|
||||
// break;
|
||||
//
|
||||
// case 'windows':
|
||||
// case 'winnt':
|
||||
// case 'win32':
|
||||
// $_ENV['HOME'] = 'c:' . DIRECTORY_SEPARATOR . 'Documents and Settings' . DIRECTORY_SEPARATOR . get_current_user();
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// $_ENV['HOME'] = '/home/' . get_current_user();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (getenv('HOME') && file_exists(getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php'))
|
||||
// {
|
||||
// include_once getenv('HOME') . DIRECTORY_SEPARATOR . '.aws' . DIRECTORY_SEPARATOR . 'sdk' . DIRECTORY_SEPARATOR . 'config.inc.php';
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -28,6 +28,6 @@ OCP\User::checkLoggedIn();
|
|||
OCP\App::checkAppEnabled('bookmarks');
|
||||
|
||||
require_once('bookmarksHelper.php');
|
||||
addBookmark($_GET['url'], '', 'Read-Later');
|
||||
addBookmark($_POST['url'], '', 'Read-Later');
|
||||
|
||||
include 'templates/addBm.php';
|
||||
|
|
|
@ -31,5 +31,5 @@ OCP\JSON::checkLoggedIn();
|
|||
OCP\JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
require_once(OC::$APPSROOT . '/apps/bookmarks/bookmarksHelper.php');
|
||||
$id = addBookmark($_GET['url'], $_GET['title'], $_GET['tags']);
|
||||
$id = addBookmark($_POST['url'], $_POST['title'], $_POST['tags']);
|
||||
OCP\JSON::success(array('data' => $id));
|
|
@ -30,7 +30,7 @@ $RUNTIME_NOSETUPFS=true;
|
|||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('bookmarks');
|
||||
|
||||
$id = $_GET['id'];
|
||||
$id = $_POST['id'];
|
||||
if (!OC_Bookmarks_Bookmarks::deleteUrl($id)){
|
||||
OC_JSON::error();
|
||||
exit();
|
||||
|
|
|
@ -39,7 +39,7 @@ if( $CONFIG_DBTYPE == 'sqlite' or $CONFIG_DBTYPE == 'sqlite3' ){
|
|||
$_ut = "UNIX_TIMESTAMP()";
|
||||
}
|
||||
|
||||
$bookmark_id = (int)$_GET["id"];
|
||||
$bookmark_id = (int)$_POST["id"];
|
||||
|
||||
$query = OCP\DB::prepare("
|
||||
UPDATE *PREFIX*bookmarks
|
||||
|
@ -48,8 +48,8 @@ $query = OCP\DB::prepare("
|
|||
");
|
||||
|
||||
$params=array(
|
||||
htmlspecialchars_decode($_GET["url"]),
|
||||
htmlspecialchars_decode($_GET["title"]),
|
||||
htmlspecialchars_decode($_POST["url"]),
|
||||
htmlspecialchars_decode($_POST["title"]),
|
||||
);
|
||||
$query->execute($params);
|
||||
|
||||
|
@ -67,7 +67,7 @@ $query = OCP\DB::prepare("
|
|||
VALUES (?, ?)
|
||||
");
|
||||
|
||||
$tags = explode(' ', urldecode($_GET["tags"]));
|
||||
$tags = explode(' ', urldecode($_POST["tags"]));
|
||||
foreach ($tags as $tag) {
|
||||
if(empty($tag)) {
|
||||
//avoid saving blankspaces
|
||||
|
|
|
@ -37,7 +37,7 @@ $query = OCP\DB::prepare("
|
|||
AND url LIKE ?
|
||||
");
|
||||
|
||||
$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_GET["url"]));
|
||||
$params=array(OCP\USER::getUser(), htmlspecialchars_decode($_POST["url"]));
|
||||
$bookmarks = $query->execute($params);
|
||||
|
||||
header( "HTTP/1.1 204 No Content" );
|
||||
|
|
|
@ -33,11 +33,11 @@ OCP\JSON::checkAppEnabled('bookmarks');
|
|||
|
||||
|
||||
//Filter for tag?
|
||||
$filterTag = isset($_GET['tag']) ? htmlspecialchars_decode($_GET['tag']) : false;
|
||||
$filterTag = isset($_POST['tag']) ? htmlspecialchars_decode($_POST['tag']) : false;
|
||||
|
||||
$offset = isset($_GET['page']) ? intval($_GET['page']) * 10 : 0;
|
||||
$offset = isset($_POST['page']) ? intval($_POST['page']) * 10 : 0;
|
||||
|
||||
$sort = isset($_GET['sort']) ? ($_GET['sort']) : 'bookmarks_sorting_recent';
|
||||
$sort = isset($_POST['sort']) ? ($_POST['sort']) : 'bookmarks_sorting_recent';
|
||||
if($sort == 'bookmarks_sorting_clicks') {
|
||||
$sqlSortColumn = 'clickcount';
|
||||
} else {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*bookmarks</name>
|
||||
<declaration>
|
||||
|
|
|
@ -6,6 +6,7 @@ function addBookmark(event) {
|
|||
var url = $('#bookmark_add_url').val();
|
||||
var tags = $('#bookmark_add_tags').val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'ajax/addBookmark.php',
|
||||
data: 'url=' + encodeURI(url) + '&tags=' + encodeURI(tags),
|
||||
success: function(data){
|
||||
|
|
|
@ -20,6 +20,7 @@ function getBookmarks() {
|
|||
}
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.filePath('bookmarks', 'ajax', 'updateList.php'),
|
||||
data: 'tag=' + encodeURIComponent($('#bookmarkFilterTag').val()) + '&page=' + bookmarks_page + '&sort=' + bookmarks_sorting,
|
||||
success: function(bookmarks){
|
||||
|
@ -70,6 +71,7 @@ function addOrEditBookmark(event) {
|
|||
}
|
||||
if (id == 0) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.filePath('bookmarks', 'ajax', 'addBookmark.php'),
|
||||
data: 'url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
||||
success: function(response){
|
||||
|
@ -82,6 +84,7 @@ function addOrEditBookmark(event) {
|
|||
}
|
||||
else {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.filePath('bookmarks', 'ajax', 'editBookmark.php'),
|
||||
data: 'id=' + id + '&url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(title) + '&tags=' + encodeURIComponent(tags),
|
||||
success: function(){
|
||||
|
@ -99,6 +102,7 @@ function addOrEditBookmark(event) {
|
|||
function delBookmark(event) {
|
||||
var record = $(this).parent().parent();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.filePath('bookmarks', 'ajax', 'delBookmark.php'),
|
||||
data: 'id=' + record.data('id'),
|
||||
success: function(data){
|
||||
|
@ -177,6 +181,7 @@ function updateOnBottom() {
|
|||
|
||||
function recordClick(event) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.filePath('bookmarks', 'ajax', 'recordClick.php'),
|
||||
data: 'url=' + encodeURIComponent($(this).attr('href')),
|
||||
});
|
||||
|
|
|
@ -16,6 +16,7 @@ function recordClick(event) {
|
|||
var jsFileLocation = $('script[src*=bookmarksearch]').attr('src');
|
||||
jsFileLocation = jsFileLocation.replace('js/bookmarksearch.js', '');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: jsFileLocation + 'ajax/recordClick.php',
|
||||
data: 'url=' + encodeURI($(this).attr('href')),
|
||||
});
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>100</length>
|
||||
<length>255</length>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
|
@ -133,7 +133,7 @@
|
|||
<type>text</type>
|
||||
<default></default>
|
||||
<notnull>false</notnull>
|
||||
<length>100</length>
|
||||
<length>255</length>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.4
|
||||
0.4.1
|
||||
|
|
|
@ -34,29 +34,21 @@
|
|||
});
|
||||
</script>
|
||||
<div id="controls">
|
||||
<div>
|
||||
<form>
|
||||
<div id="view">
|
||||
<input type="button" value="<?php echo $l->t('Week');?>" id="oneweekview_radio"/>
|
||||
<input type="button" value="<?php echo $l->t('Month');?>" id="onemonthview_radio"/>
|
||||
<input type="button" value="<?php echo $l->t('List');?>" id="listview_radio"/>
|
||||
<img id="loading" src="<?php echo OCP\Util::imagePath('core', 'loading.gif'); ?>" />
|
||||
</div>
|
||||
</form>
|
||||
<form>
|
||||
<div id="choosecalendar">
|
||||
<input type="button" id="today_input" value="<?php echo $l->t("Today");?>"/>
|
||||
<input type="button" id="choosecalendar_input" value="<?php echo $l->t("Calendars");?>" onclick="Calendar.UI.Calendar.overview();" />
|
||||
</div>
|
||||
</form>
|
||||
<form>
|
||||
<div id="datecontrol">
|
||||
<input type="button" value=" < " id="datecontrol_left"/>
|
||||
<span class="button" id="datecontrol_date"></span>
|
||||
<input type="button" value=" > " id="datecontrol_right"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<form id="view">
|
||||
<input type="button" value="<?php echo $l->t('Week');?>" id="oneweekview_radio"/>
|
||||
<input type="button" value="<?php echo $l->t('Month');?>" id="onemonthview_radio"/>
|
||||
<input type="button" value="<?php echo $l->t('List');?>" id="listview_radio"/>
|
||||
<img id="loading" src="<?php echo OCP\Util::imagePath('core', 'loading.gif'); ?>" />
|
||||
</form>
|
||||
<form id="choosecalendar">
|
||||
<input type="button" id="today_input" value="<?php echo $l->t("Today");?>"/>
|
||||
<input type="button" id="choosecalendar_input" value="<?php echo $l->t("Calendars");?>" onclick="Calendar.UI.Calendar.overview();" />
|
||||
</form>
|
||||
<form id="datecontrol">
|
||||
<input type="button" value=" < " id="datecontrol_left"/>
|
||||
<span class="button" id="datecontrol_date"></span>
|
||||
<input type="button" value=" > " id="datecontrol_right"/>
|
||||
</form>
|
||||
</div>
|
||||
<div id="notification" style="display:none;"></div>
|
||||
<div id="calendar_holder">
|
||||
|
|
|
@ -82,6 +82,7 @@ if(is_array($value)) {
|
|||
$value = strip_tags($value);
|
||||
}
|
||||
|
||||
/* preprocessing value */
|
||||
switch($name) {
|
||||
case 'BDAY':
|
||||
$date = New DateTime($value);
|
||||
|
@ -94,6 +95,8 @@ switch($name) {
|
|||
case 'N':
|
||||
case 'ORG':
|
||||
case 'NOTE':
|
||||
$value = str_replace('\n', ' \\n', $value);
|
||||
break;
|
||||
case 'NICKNAME':
|
||||
// TODO: Escape commas and semicolons.
|
||||
break;
|
||||
|
@ -105,8 +108,14 @@ switch($name) {
|
|||
break;
|
||||
}
|
||||
|
||||
|
||||
$property = $vcard->addProperty($name, $value); //, $parameters);
|
||||
switch($name) {
|
||||
case 'NOTE':
|
||||
$vcard->setString('NOTE', $value);
|
||||
break;
|
||||
default:
|
||||
$property = $vcard->addProperty($name, $value); //, $parameters);
|
||||
break;
|
||||
}
|
||||
|
||||
$line = count($vcard->children) - 1;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ session_write_close();
|
|||
$nl = "\n";
|
||||
|
||||
global $progresskey;
|
||||
$progresskey = 'contacts.import-' . $_GET['progresskey'];
|
||||
$progresskey = 'contacts.import-' . (isset($_GET['progresskey'])?$_GET['progresskey']:'');
|
||||
|
||||
if (isset($_GET['progress']) && $_GET['progress']) {
|
||||
echo OC_Cache::get($progresskey);
|
||||
|
|
|
@ -839,22 +839,22 @@ Contacts={
|
|||
$('#addressdisplay dl').last().data('checksum', this.data.ADR[adr]['checksum']);
|
||||
var adrarray = this.data.ADR[adr]['value'];
|
||||
var adrtxt = '';
|
||||
if(adrarray[0].length > 0) {
|
||||
if(adrarray[0] && adrarray[0].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[0].strip_tags() + '</li>';
|
||||
}
|
||||
if(adrarray[1].length > 0) {
|
||||
if(adrarray[1] && adrarray[1].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[1].strip_tags() + '</li>';
|
||||
}
|
||||
if(adrarray[2].length > 0) {
|
||||
if(adrarray[2] && adrarray[2].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[2].strip_tags() + '</li>';
|
||||
}
|
||||
if(adrarray[3].length > 0 || adrarray[5].length > 0) {
|
||||
if((adrarray[3] && adrarray[5]) && adrarray[3].length > 0 || adrarray[5].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[5].strip_tags() + ' ' + adrarray[3].strip_tags() + '</li>';
|
||||
}
|
||||
if(adrarray[4].length > 0) {
|
||||
if(adrarray[4] && adrarray[4].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[4].strip_tags() + '</li>';
|
||||
}
|
||||
if(adrarray[6].length > 0) {
|
||||
if(adrarray[6] && adrarray[6].length > 0) {
|
||||
adrtxt = adrtxt + '<li>' + adrarray[6].strip_tags() + '</li>';
|
||||
}
|
||||
$('#addressdisplay dl').last().find('.addresslist').html(adrtxt);
|
||||
|
|
|
@ -188,6 +188,7 @@ class OC_Contacts_VCard{
|
|||
if($upgrade && in_array($property->name, $stringprops)) {
|
||||
self::decodeProperty($property);
|
||||
}
|
||||
$property->value = str_replace("\r\n", "\n", iconv(mb_detect_encoding($property->value, 'UTF-8, ISO-8859-1'), 'utf-8', $property->value));
|
||||
if(in_array($property->name, $stringprops)) {
|
||||
$property->value = strip_tags($property->value);
|
||||
}
|
||||
|
@ -373,6 +374,10 @@ class OC_Contacts_VCard{
|
|||
public static function editFromDAVData($aid,$uri,$data){
|
||||
$oldcard = self::findWhereDAVDataIs($aid,$uri);
|
||||
$card = OC_VObject::parse($data);
|
||||
if(!$card) {
|
||||
OCP\Util::writeLog('contacts','OC_Contacts_VCard::editFromDAVData. Unable to parse VCARD, uri: '.$uri,OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
return self::edit($oldcard['id'], $card);
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ $id = isset($_['id']) ? $_['id'] : '';
|
|||
<dd class="propertycontainer hidden" id="org_value" data-element="ORG"><input id="org" required="required" name="value[ORG]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Organization'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dt class="hidden" id="nickname_label" data-element="NICKNAME"><label for="nickname"><?php echo $l->t('Nickname'); ?></label></dt>
|
||||
<dd class="propertycontainer hidden" id="nickname_value" data-element="NICKNAME"><input id="nickname" required="required" name="value[NICKNAME]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('Enter nickname'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dt class="hidden" id="url_label" data-element="URL"><label for="nickname"><?php echo $l->t('Web site'); ?></label></dt>
|
||||
<dt class="hidden" id="url_label" data-element="URL"><label for="url"><?php echo $l->t('Web site'); ?></label></dt>
|
||||
<dd class="propertycontainer hidden" id="url_value" data-element="URL"><input id="url" required="required" name="value[URL]" type="text" class="contacts_property big" name="value" value="" placeholder="<?php echo $l->t('http://www.somesite.com'); ?>" /><a role="button" class="action globe" title="<?php echo $l->t('Go to web site'); ?>"><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
<dt class="hidden" id="bday_label" data-element="BDAY"><label for="bday"><?php echo $l->t('Birthday'); ?></label></dt>
|
||||
<dd class="propertycontainer hidden" id="bday_value" data-element="BDAY"><input id="bday" required="required" name="value" type="text" class="contacts_property big" value="" placeholder="<?php echo $l->t('dd-mm-yyyy'); ?>" /><a role="button" class="action delete" title="<?php echo $l->t('Delete'); ?>"></a></dd>
|
||||
|
|
2
apps/external/ajax/setsites.php
vendored
2
apps/external/ajax/setsites.php
vendored
|
@ -12,7 +12,7 @@ OCP\User::checkAdminUser();
|
|||
$sites = array();
|
||||
for ($i = 0; $i < sizeof($_POST['site_name']); $i++) {
|
||||
if (!empty($_POST['site_name'][$i]) && !empty($_POST['site_url'][$i])) {
|
||||
array_push($sites, array($_POST['site_name'][$i], $_POST['site_url'][$i]));
|
||||
array_push($sites, array(strip_tags($_POST['site_name'][$i]), strip_tags($_POST['site_url'][$i])));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ FileActions={
|
|||
}
|
||||
var html='<a href="#" class="action" style="display:none">';
|
||||
if(img) { html+='<img src="'+img+'"/> '; }
|
||||
html += name+'</a>';
|
||||
html += t('files', name) +'</a>';
|
||||
var element=$(html);
|
||||
element.data('action',name);
|
||||
element.click(function(event){
|
||||
|
@ -91,7 +91,11 @@ FileActions={
|
|||
if(img.call){
|
||||
img=img(file);
|
||||
}
|
||||
var html='<a href="#" original-title="Delete" class="action delete" style="display:none" />';
|
||||
if ($('#dir').val().indexOf('Shared') != -1) {
|
||||
var html='<a href="#" original-title="' + t('files', 'Unshare') + '" class="action delete" style="display:none" />';
|
||||
} else {
|
||||
var html='<a href="#" original-title="' + t('files', 'Delete') + '" class="action delete" style="display:none" />';
|
||||
}
|
||||
var element=$(html);
|
||||
if(img){
|
||||
element.append($('<img src="'+img+'"/>'));
|
||||
|
|
|
@ -452,7 +452,7 @@ $(document).ready(function() {
|
|||
input.focus();
|
||||
input.change(function(){
|
||||
var name=$(this).val();
|
||||
if(name.indexOf('/')!=-1){
|
||||
if(type != 'web' && name.indexOf('/')!=-1){
|
||||
$('#notification').text(t('files','Invalid name, \'/\' is not allowed.'));
|
||||
$('#notification').fadeIn();
|
||||
return;
|
||||
|
|
41
apps/files_external/ajax/dropbox.php
Normal file
41
apps/files_external/ajax/dropbox.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
require_once 'Dropbox/autoload.php';
|
||||
|
||||
OCP\JSON::checkAppEnabled('files_external');
|
||||
OCP\JSON::checkLoggedIn();
|
||||
if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
|
||||
$oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']);
|
||||
if (isset($_POST['step'])) {
|
||||
switch ($_POST['step']) {
|
||||
case 1:
|
||||
try {
|
||||
if (isset($_POST['callback'])) {
|
||||
$callback = $_POST['callback'];
|
||||
} else {
|
||||
$callback = null;
|
||||
}
|
||||
$token = $oauth->getRequestToken();
|
||||
OCP\JSON::success(array('data' => array('url' => $oauth->getAuthorizeUrl($callback), 'request_token' => $token['token'], 'request_token_secret' => $token['token_secret'])));
|
||||
} catch (Exception $exception) {
|
||||
OCP\JSON::error(array('data' => array('message' => 'Fetching request tokens failed. Verify that your Dropbox app key and secret are correct.')));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (isset($_POST['request_token']) && isset($_POST['request_token_secret'])) {
|
||||
try {
|
||||
$oauth->setToken($_POST['request_token'], $_POST['request_token_secret']);
|
||||
$token = $oauth->getAccessToken();
|
||||
OCP\JSON::success(array('access_token' => $token['token'], 'access_token_secret' => $token['token_secret']));
|
||||
} catch (Exception $exception) {
|
||||
OCP\JSON::error(array('data' => array('message' => 'Fetching access tokens failed. Verify that your Dropbox app key and secret are correct.')));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
OCP\JSON::error(array('data' => array('message' => 'Please provide a valid Dropbox app key and secret.')));
|
||||
}
|
||||
|
||||
?>
|
53
apps/files_external/js/dropbox.js
Normal file
53
apps/files_external/js/dropbox.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
$(document).ready(function() {
|
||||
|
||||
$('#externalStorage tbody tr').each(function() {
|
||||
if ($(this).find('.backend').data('class') == 'OC_Filestorage_Dropbox') {
|
||||
var app_key = $(this).find('.configuration [data-parameter="app_key"]').val();
|
||||
var app_secret = $(this).find('.configuration [data-parameter="app_secret"]').val();
|
||||
if (app_key == '' && app_secret == '') {
|
||||
$(this).find('.configuration').append('<a class="button dropbox">Grant access</a>');
|
||||
} else {
|
||||
var pos = window.location.search.indexOf('oauth_token') + 12
|
||||
var token = $(this).find('.configuration [data-parameter="token"]');
|
||||
if (pos != -1 && window.location.search.substr(pos, $(token).val().length) == $(token).val()) {
|
||||
var token_secret = $(this).find('.configuration [data-parameter="token_secret"]');
|
||||
var tr = $(this);
|
||||
$.post(OC.filePath('files_external', 'ajax', 'dropbox.php'), { step: 2, app_key: app_key, app_secret: app_secret, request_token: $(token).val(), request_token_secret: $(token_secret).val() }, function(result) {
|
||||
if (result && result.status == 'success') {
|
||||
$(token).val(result.access_token);
|
||||
$(token_secret).val(result.access_token_secret);
|
||||
OC.MountConfig.saveStorage(tr);
|
||||
} else {
|
||||
OC.dialogs.alert(result.data.message, 'Error configuring Dropbox storage');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$('.dropbox').live('click', function(event) {
|
||||
event.preventDefault();
|
||||
var app_key = $(this).parent().find('[data-parameter="app_key"]').val();
|
||||
var app_secret = $(this).parent().find('[data-parameter="app_secret"]').val();
|
||||
if (app_key != '' && app_secret != '') {
|
||||
var tr = $(this).parent().parent();
|
||||
var token = $(this).parent().find('[data-parameter="token"]');
|
||||
var token_secret = $(this).parent().find('[data-parameter="token_secret"]');
|
||||
$.post(OC.filePath('files_external', 'ajax', 'dropbox.php'), { step: 1, app_key: app_key, app_secret: app_secret, callback: window.location.href }, function(result) {
|
||||
if (result && result.status == 'success') {
|
||||
$(token).val(result.data.request_token);
|
||||
$(token_secret).val(result.data.request_token_secret);
|
||||
OC.MountConfig.saveStorage(tr);
|
||||
window.location = result.data.url;
|
||||
} else {
|
||||
OC.dialogs.alert(result.data.message, 'Error configuring Dropbox storage');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
OC.dialogs.alert('Please provide a valid Dropbox app key and secret.', 'Error configuring Dropbox storage')
|
||||
}
|
||||
});
|
||||
|
||||
});
|
|
@ -1,40 +1,5 @@
|
|||
$(document).ready(function() {
|
||||
|
||||
$('.chzn-select').chosen();
|
||||
|
||||
$('#selectBackend').live('change', function() {
|
||||
var tr = $(this).parent().parent();
|
||||
$('#externalStorage tbody').last().append($(tr).clone());
|
||||
var selected = $(this).find('option:selected').text();
|
||||
var backendClass = $(this).val();
|
||||
$(this).parent().text(selected);
|
||||
$(tr).find('.backend').data('class', $(this).val());
|
||||
var configurations = $(this).data('configurations');
|
||||
var td = $(tr).find('td.configuration');
|
||||
$.each(configurations, function(backend, parameters) {
|
||||
if (backend == backendClass) {
|
||||
$.each(parameters['configuration'], function(parameter, placeholder) {
|
||||
if (placeholder.indexOf('*') != -1) {
|
||||
td.append('<input type="password" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
|
||||
} else if (placeholder.indexOf('!') != -1) {
|
||||
td.append('<label><input type="checkbox" data-parameter="'+parameter+'" />'+placeholder.substring(1)+'</label>');
|
||||
} else if (placeholder.indexOf('&') != -1) {
|
||||
td.append('<input type="text" class="optional" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
|
||||
} else {
|
||||
td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('.chz-select').chosen();
|
||||
$(tr).find('td').last().attr('class', 'remove');
|
||||
$(tr).removeAttr('id');
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$('#externalStorage td').live('change', function() {
|
||||
var tr = $(this).parent();
|
||||
OC.MountConfig={
|
||||
saveStorage:function(tr) {
|
||||
var mountPoint = $(tr).find('.mountPoint input').val();
|
||||
if (mountPoint == '') {
|
||||
return false;
|
||||
|
@ -99,6 +64,51 @@ $(document).ready(function() {
|
|||
$.post(OC.filePath('files_external', 'ajax', 'addMountPoint.php'), { mountPoint: mountPoint, class: backendClass, classOptions: classOptions, mountType: mountType, applicable: applicable, isPersonal: isPersonal });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('.chzn-select').chosen();
|
||||
|
||||
$('#selectBackend').live('change', function() {
|
||||
var tr = $(this).parent().parent();
|
||||
$('#externalStorage tbody').last().append($(tr).clone());
|
||||
var selected = $(this).find('option:selected').text();
|
||||
var backendClass = $(this).val();
|
||||
$(this).parent().text(selected);
|
||||
$(tr).find('.backend').data('class', backendClass);
|
||||
var configurations = $(this).data('configurations');
|
||||
var td = $(tr).find('td.configuration');
|
||||
$.each(configurations, function(backend, parameters) {
|
||||
if (backend == backendClass) {
|
||||
$.each(parameters['configuration'], function(parameter, placeholder) {
|
||||
if (placeholder.indexOf('*') != -1) {
|
||||
td.append('<input type="password" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
|
||||
} else if (placeholder.indexOf('!') != -1) {
|
||||
td.append('<label><input type="checkbox" data-parameter="'+parameter+'" />'+placeholder.substring(1)+'</label>');
|
||||
} else if (placeholder.indexOf('&') != -1) {
|
||||
td.append('<input type="text" class="optional" data-parameter="'+parameter+'" placeholder="'+placeholder.substring(1)+'" />');
|
||||
} else if (placeholder.indexOf('#') != -1) {
|
||||
td.append('<input type="hidden" data-parameter="'+parameter+'" />');
|
||||
} else {
|
||||
td.append('<input type="text" data-parameter="'+parameter+'" placeholder="'+placeholder+'" />');
|
||||
}
|
||||
});
|
||||
if (parameters['custom']) {
|
||||
OC.addScript('files_external', parameters['custom']);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
$('.chz-select').chosen();
|
||||
$(tr).find('td').last().attr('class', 'remove');
|
||||
$(tr).removeAttr('id');
|
||||
$(this).remove();
|
||||
});
|
||||
|
||||
$('#externalStorage td').live('change', function() {
|
||||
OC.MountConfig.saveStorage($(this).parent());
|
||||
});
|
||||
|
||||
$('td.remove>img').live('click', function() {
|
||||
|
@ -130,8 +140,6 @@ $(document).ready(function() {
|
|||
$(tr).remove();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#allowUserMounting').bind('change', function() {
|
||||
if (this.checked) {
|
||||
OC.AppConfig.setValue('files_external', 'allow_user_mounting', 'yes');
|
||||
|
|
|
@ -30,15 +30,18 @@ class OC_Mount_Config {
|
|||
|
||||
/**
|
||||
* Get details on each of the external storage backends, used for the mount config UI
|
||||
* If a custom UI is needed, add the key 'custom' and a javascript file with that name will be loaded
|
||||
* If the configuration parameter should be secret, add a '*' to the beginning of the value
|
||||
* If the configuration parameter is a boolean, add a '!' to the beginning of the value
|
||||
* If the configuration parameter is optional, add a '&' to the beginning of the value
|
||||
* If the configuration parameter is hidden, add a '#' to the begining of the value
|
||||
* @return array
|
||||
*/
|
||||
public static function getBackends() {
|
||||
return array(
|
||||
'OC_Filestorage_Local' => array('backend' => 'Local', 'configuration' => array('datadir' => 'Location')),
|
||||
'OC_Filestorage_AmazonS3' => array('backend' => 'Amazon S3', 'configuration' => array('key' => 'Key', 'secret' => '*Secret', 'bucket' => 'Bucket')),
|
||||
'OC_Filestorage_Dropbox' => array('backend' => 'Dropbox', 'configuration' => array('app_key' => 'App key', 'app_secret' => 'App secret', 'token' => '#token', 'token_secret' => '#token_secret' ), 'custom' => 'dropbox'),
|
||||
'OC_Filestorage_FTP' => array('backend' => 'FTP', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', 'secure' => '!Secure ftps://')),
|
||||
'OC_Filestorage_SWIFT' => array('backend' => 'OpenStack Swift', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'token' => '*Token', 'root' => '&Root', 'secure' => '!Secure ftps://')),
|
||||
'OC_Filestorage_SMB' => array('backend' => 'SMB', 'configuration' => array('host' => 'URL', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root')),
|
||||
|
@ -98,8 +101,8 @@ class OC_Mount_Config {
|
|||
$personal = array();
|
||||
if (isset($mountPoints[self::MOUNT_TYPE_USER][$uid])) {
|
||||
foreach ($mountPoints[self::MOUNT_TYPE_USER][$uid] as $mountPoint => $mount) {
|
||||
// Remove '/$user/files/' from mount point
|
||||
$personal[substr($mountPoint, 13)] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options']);
|
||||
// Remove '/uid/files/' from mount point
|
||||
$personal[substr($mountPoint, strlen($uid) + 8)] = array('class' => $mount['class'], 'backend' => $backends[$mount['class']]['backend'], 'configuration' => $mount['options']);
|
||||
}
|
||||
}
|
||||
return $personal;
|
||||
|
@ -123,8 +126,11 @@ class OC_Mount_Config {
|
|||
if ($applicable != OCP\User::getUser() || $class == 'OC_Filestorage_Local') {
|
||||
return false;
|
||||
}
|
||||
$mountPoint = '/'.$applicable.'/files/'.ltrim($mountPoint, '/');
|
||||
} else {
|
||||
$mountPoint = '/$user/files/'.ltrim($mountPoint, '/');
|
||||
}
|
||||
$mount = array($applicable => array('/$user/files/'.$mountPoint => array('class' => $class, 'options' => $classOptions)));
|
||||
$mount = array($applicable => array($mountPoint => array('class' => $class, 'options' => $classOptions)));
|
||||
$mountPoints = self::readData($isPersonal);
|
||||
// Merge the new mount point into the current mount points
|
||||
if (isset($mountPoints[$mountType])) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<?php $_['mounts'] = array_merge($_['mounts'], array('' => array())); ?>
|
||||
<?php foreach ($_['mounts'] as $mountPoint => $mount): ?>
|
||||
<tr <?php if ($mountPoint == '') echo 'id="addMountPoint"'; ?>>
|
||||
<td class="mountPoint"><input type="text" name="mountPoint" value="<?php echo $mountPoint; ?>" placeholder="<?php echo $l->t('Mount point'); ?>" /></td>
|
||||
<td class="mountPoint"><input type="text" name="mountPoint" value="<?php echo htmlentities($mountPoint); ?>" placeholder="<?php echo $l->t('Mount point'); ?>" /></td>
|
||||
<?php if ($mountPoint == ''): ?>
|
||||
<td class="backend">
|
||||
<select id="selectBackend" data-configurations='<?php echo json_encode($_['backends']); ?>'>
|
||||
|
@ -40,11 +40,14 @@
|
|||
<label><input type="checkbox" data-parameter="<?php echo $parameter; ?>" <?php if ($value == 'true') echo ' checked="checked"'; ?> /><?php echo substr($placeholder, 1); ?></label>
|
||||
<?php elseif (strpos($placeholder, '&') !== false): ?>
|
||||
<input type="text" class="optional" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo substr($placeholder, 1); ?>" />
|
||||
<?php elseif (strpos($placeholder, '#') !== false): ?>
|
||||
<input type="hidden" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" />
|
||||
<?php else: ?>
|
||||
<input type="text" data-parameter="<?php echo $parameter; ?>" value="<?php echo $value; ?>" placeholder="<?php echo $placeholder; ?>" />
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if (isset($_['backends'][$mount['class']]['custom'])) OCP\Util::addScript('files_external', $_['backends'][$mount['class']]['custom']); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<!--<td class="options">
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
OCP\Util::addscript( 'files_pdfviewer', 'viewer');
|
||||
OCP\Util::addStyle( 'files_pdfviewer', 'viewer');
|
||||
OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/build/pdf');
|
||||
OCP\Util::addscript( 'files_pdfviewer', 'pdfview');
|
||||
OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/compatibility');
|
||||
OCP\Util::addscript( 'files_pdfviewer', 'pdfjs/viewer');
|
||||
?>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<name>PDF Viewer</name>
|
||||
<description>Inline PDF viewer (pdfjs-based)</description>
|
||||
<licence>GPL</licence>
|
||||
<author>Joan Creus</author>
|
||||
<author>Joan Creus, Thomas Müller</author>
|
||||
<require>4</require>
|
||||
<shipped>true</shipped>
|
||||
<default_enable/>
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
/* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */
|
||||
|
||||
#viewer {
|
||||
background-color: #929292;
|
||||
font-family: 'Lucida Grande', 'Lucida Sans Unicode', Helvetica, Arial, Verdana, sans-serif;
|
||||
/*margin: 0px;*/
|
||||
padding: 0px;
|
||||
|
|
File diff suppressed because it is too large
Load diff
340
apps/files_pdfviewer/js/pdfjs/compatibility.js
Normal file
340
apps/files_pdfviewer/js/pdfjs/compatibility.js
Normal file
|
@ -0,0 +1,340 @@
|
|||
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
|
||||
|
||||
'use strict';
|
||||
|
||||
// Checking if the typed arrays are supported
|
||||
(function checkTypedArrayCompatibility() {
|
||||
if (typeof Uint8Array !== 'undefined') {
|
||||
// some mobile version might not support Float64Array
|
||||
if (typeof Float64Array === 'undefined')
|
||||
window.Float64Array = Float32Array;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function subarray(start, end) {
|
||||
return new TypedArray(this.slice(start, end));
|
||||
}
|
||||
|
||||
function setArrayOffset(array, offset) {
|
||||
if (arguments.length < 2)
|
||||
offset = 0;
|
||||
for (var i = 0, n = array.length; i < n; ++i, ++offset)
|
||||
this[offset] = array[i] & 0xFF;
|
||||
}
|
||||
|
||||
function TypedArray(arg1) {
|
||||
var result;
|
||||
if (typeof arg1 === 'number') {
|
||||
result = [];
|
||||
for (var i = 0; i < arg1; ++i)
|
||||
result[i] = 0;
|
||||
} else
|
||||
result = arg1.slice(0);
|
||||
|
||||
result.subarray = subarray;
|
||||
result.buffer = result;
|
||||
result.byteLength = result.length;
|
||||
result.set = setArrayOffset;
|
||||
|
||||
if (typeof arg1 === 'object' && arg1.buffer)
|
||||
result.buffer = arg1.buffer;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
window.Uint8Array = TypedArray;
|
||||
|
||||
// we don't need support for set, byteLength for 32-bit array
|
||||
// so we can use the TypedArray as well
|
||||
window.Uint32Array = TypedArray;
|
||||
window.Int32Array = TypedArray;
|
||||
window.Uint16Array = TypedArray;
|
||||
window.Float32Array = TypedArray;
|
||||
window.Float64Array = TypedArray;
|
||||
})();
|
||||
|
||||
// Object.create() ?
|
||||
(function checkObjectCreateCompatibility() {
|
||||
if (typeof Object.create !== 'undefined')
|
||||
return;
|
||||
|
||||
Object.create = function objectCreate(proto) {
|
||||
var constructor = function objectCreateConstructor() {};
|
||||
constructor.prototype = proto;
|
||||
return new constructor();
|
||||
};
|
||||
})();
|
||||
|
||||
// Object.defineProperty() ?
|
||||
(function checkObjectDefinePropertyCompatibility() {
|
||||
if (typeof Object.defineProperty !== 'undefined')
|
||||
return;
|
||||
|
||||
Object.defineProperty = function objectDefineProperty(obj, name, def) {
|
||||
delete obj[name];
|
||||
if ('get' in def)
|
||||
obj.__defineGetter__(name, def['get']);
|
||||
if ('set' in def)
|
||||
obj.__defineSetter__(name, def['set']);
|
||||
if ('value' in def) {
|
||||
obj.__defineSetter__(name, function objectDefinePropertySetter(value) {
|
||||
this.__defineGetter__(name, function objectDefinePropertyGetter() {
|
||||
return value;
|
||||
});
|
||||
return value;
|
||||
});
|
||||
obj[name] = def.value;
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
// Object.keys() ?
|
||||
(function checkObjectKeysCompatibility() {
|
||||
if (typeof Object.keys !== 'undefined')
|
||||
return;
|
||||
|
||||
Object.keys = function objectKeys(obj) {
|
||||
var result = [];
|
||||
for (var i in obj) {
|
||||
if (obj.hasOwnProperty(i))
|
||||
result.push(i);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
||||
// No XMLHttpRequest.response ?
|
||||
(function checkXMLHttpRequestResponseCompatibility() {
|
||||
var xhrPrototype = XMLHttpRequest.prototype;
|
||||
if ('response' in xhrPrototype ||
|
||||
'mozResponseArrayBuffer' in xhrPrototype ||
|
||||
'mozResponse' in xhrPrototype ||
|
||||
'responseArrayBuffer' in xhrPrototype)
|
||||
return;
|
||||
// IE ?
|
||||
if (typeof VBArray !== 'undefined') {
|
||||
Object.defineProperty(xhrPrototype, 'response', {
|
||||
get: function xmlHttpRequestResponseGet() {
|
||||
return new Uint8Array(new VBArray(this.responseBody).toArray());
|
||||
}
|
||||
});
|
||||
Object.defineProperty(xhrPrototype, 'overrideMimeType', {
|
||||
value: function xmlHttpRequestOverrideMimeType(mimeType) {}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// other browsers
|
||||
function responseTypeSetter() {
|
||||
// will be only called to set "arraybuffer"
|
||||
this.overrideMimeType('text/plain; charset=x-user-defined');
|
||||
}
|
||||
if (typeof xhrPrototype.overrideMimeType === 'function') {
|
||||
Object.defineProperty(xhrPrototype, 'responseType',
|
||||
{ set: responseTypeSetter });
|
||||
}
|
||||
function responseGetter() {
|
||||
var text = this.responseText;
|
||||
var i, n = text.length;
|
||||
var result = new Uint8Array(n);
|
||||
for (i = 0; i < n; ++i)
|
||||
result[i] = text.charCodeAt(i) & 0xFF;
|
||||
return result;
|
||||
}
|
||||
Object.defineProperty(xhrPrototype, 'response', { get: responseGetter });
|
||||
})();
|
||||
|
||||
// window.btoa (base64 encode function) ?
|
||||
(function checkWindowBtoaCompatibility() {
|
||||
if ('btoa' in window)
|
||||
return;
|
||||
|
||||
var digits =
|
||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
||||
|
||||
window.btoa = function windowBtoa(chars) {
|
||||
var buffer = '';
|
||||
var i, n;
|
||||
for (i = 0, n = chars.length; i < n; i += 3) {
|
||||
var b1 = chars.charCodeAt(i) & 0xFF;
|
||||
var b2 = chars.charCodeAt(i + 1) & 0xFF;
|
||||
var b3 = chars.charCodeAt(i + 2) & 0xFF;
|
||||
var d1 = b1 >> 2, d2 = ((b1 & 3) << 4) | (b2 >> 4);
|
||||
var d3 = i + 1 < n ? ((b2 & 0xF) << 2) | (b3 >> 6) : 64;
|
||||
var d4 = i + 2 < n ? (b3 & 0x3F) : 64;
|
||||
buffer += (digits.charAt(d1) + digits.charAt(d2) +
|
||||
digits.charAt(d3) + digits.charAt(d4));
|
||||
}
|
||||
return buffer;
|
||||
};
|
||||
})();
|
||||
|
||||
// Function.prototype.bind ?
|
||||
(function checkFunctionPrototypeBindCompatibility() {
|
||||
if (typeof Function.prototype.bind !== 'undefined')
|
||||
return;
|
||||
|
||||
Function.prototype.bind = function functionPrototypeBind(obj) {
|
||||
var fn = this, headArgs = Array.prototype.slice.call(arguments, 1);
|
||||
var bound = function functionPrototypeBindBound() {
|
||||
var args = Array.prototype.concat.apply(headArgs, arguments);
|
||||
return fn.apply(obj, args);
|
||||
};
|
||||
return bound;
|
||||
};
|
||||
})();
|
||||
|
||||
// IE9 text/html data URI
|
||||
(function checkDocumentDocumentModeCompatibility() {
|
||||
if (!('documentMode' in document) || document.documentMode !== 9)
|
||||
return;
|
||||
// overriding the src property
|
||||
var originalSrcDescriptor = Object.getOwnPropertyDescriptor(
|
||||
HTMLIFrameElement.prototype, 'src');
|
||||
Object.defineProperty(HTMLIFrameElement.prototype, 'src', {
|
||||
get: function htmlIFrameElementPrototypeSrcGet() { return this.$src; },
|
||||
set: function htmlIFrameElementPrototypeSrcSet(src) {
|
||||
this.$src = src;
|
||||
if (src.substr(0, 14) != 'data:text/html') {
|
||||
originalSrcDescriptor.set.call(this, src);
|
||||
return;
|
||||
}
|
||||
// for text/html, using blank document and then
|
||||
// document's open, write, and close operations
|
||||
originalSrcDescriptor.set.call(this, 'about:blank');
|
||||
setTimeout((function htmlIFrameElementPrototypeSrcOpenWriteClose() {
|
||||
var doc = this.contentDocument;
|
||||
doc.open('text/html');
|
||||
doc.write(src.substr(src.indexOf(',') + 1));
|
||||
doc.close();
|
||||
}).bind(this), 0);
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
||||
|
||||
// HTMLElement dataset property
|
||||
(function checkDatasetProperty() {
|
||||
var div = document.createElement('div');
|
||||
if ('dataset' in div)
|
||||
return; // dataset property exists
|
||||
|
||||
Object.defineProperty(HTMLElement.prototype, 'dataset', {
|
||||
get: function() {
|
||||
if (this._dataset)
|
||||
return this._dataset;
|
||||
|
||||
var dataset = {};
|
||||
for (var j = 0, jj = this.attributes.length; j < jj; j++) {
|
||||
var attribute = this.attributes[j];
|
||||
if (attribute.name.substring(0, 5) != 'data-')
|
||||
continue;
|
||||
var key = attribute.name.substring(5).replace(/\-([a-z])/g,
|
||||
function(all, ch) { return ch.toUpperCase(); });
|
||||
dataset[key] = attribute.value;
|
||||
}
|
||||
|
||||
Object.defineProperty(this, '_dataset', {
|
||||
value: dataset,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
return dataset;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
||||
|
||||
// HTMLElement classList property
|
||||
(function checkClassListProperty() {
|
||||
var div = document.createElement('div');
|
||||
if ('classList' in div)
|
||||
return; // classList property exists
|
||||
|
||||
function changeList(element, itemName, add, remove) {
|
||||
var s = element.className || '';
|
||||
var list = s.split(/\s+/g);
|
||||
if (list[0] == '') list.shift();
|
||||
var index = list.indexOf(itemName);
|
||||
if (index < 0 && add)
|
||||
list.push(itemName);
|
||||
if (index >= 0 && remove)
|
||||
list.splice(index, 1);
|
||||
element.className = list.join(' ');
|
||||
}
|
||||
|
||||
var classListPrototype = {
|
||||
add: function(name) {
|
||||
changeList(this.element, name, true, false);
|
||||
},
|
||||
remove: function(name) {
|
||||
changeList(this.element, name, false, true);
|
||||
},
|
||||
toggle: function(name) {
|
||||
changeList(this.element, name, true, true);
|
||||
}
|
||||
};
|
||||
|
||||
Object.defineProperty(HTMLElement.prototype, 'classList', {
|
||||
get: function() {
|
||||
if (this._classList)
|
||||
return this._classList;
|
||||
|
||||
var classList = Object.create(classListPrototype, {
|
||||
element: {
|
||||
value: this,
|
||||
writable: false,
|
||||
enumerable: true
|
||||
}
|
||||
});
|
||||
Object.defineProperty(this, '_classList', {
|
||||
value: classList,
|
||||
writable: false,
|
||||
enumerable: false
|
||||
});
|
||||
return classList;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
||||
|
||||
// Check console compatability
|
||||
(function checkConsoleCompatibility() {
|
||||
if (typeof console == 'undefined') {
|
||||
console = {log: function() {}};
|
||||
}
|
||||
})();
|
||||
|
||||
// Check onclick compatibility in Opera
|
||||
(function checkOnClickCompatibility() {
|
||||
// workaround for reported Opera bug DSK-354448:
|
||||
// onclick fires on disabled buttons with opaque content
|
||||
function ignoreIfTargetDisabled(event) {
|
||||
if (isDisabled(event.target)) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
function isDisabled(node) {
|
||||
return node.disabled || (node.parentNode && isDisabled(node.parentNode));
|
||||
}
|
||||
if (navigator.userAgent.indexOf('Opera') != -1) {
|
||||
// use browser detection since we cannot feature-check this bug
|
||||
document.addEventListener('click', ignoreIfTargetDisabled, true);
|
||||
}
|
||||
})();
|
||||
|
||||
// Checks if navigator.language is supported
|
||||
(function checkNavigatorLanguage() {
|
||||
if ('language' in navigator)
|
||||
return;
|
||||
Object.defineProperty(navigator, 'language', {
|
||||
get: function navigatorLanguage() {
|
||||
var language = navigator.userLanguage || 'en-US';
|
||||
return language.substring(0, 2).toLowerCase() +
|
||||
language.substring(2).toUpperCase();
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
})();
|
|
@ -1,3 +1,6 @@
|
|||
cd build
|
||||
rm pdf.js
|
||||
wget http://mozilla.github.com/pdf.js/build/pdf.js
|
||||
wget http://mozilla.github.com/pdf.js/web/compatibility.js
|
||||
wget http://mozilla.github.com/pdf.js/web/viewer.js
|
||||
|
||||
|
|
1936
apps/files_pdfviewer/js/pdfjs/viewer.js
Normal file
1936
apps/files_pdfviewer/js/pdfjs/viewer.js
Normal file
File diff suppressed because it is too large
Load diff
|
@ -24,21 +24,9 @@ function showPDFviewer(dir,filename){
|
|||
var oldcontent = $("#content").html();
|
||||
$("#content").html(oldcontent+'<div id="loading">Loading... 0%</div><div id="viewer"></div>');
|
||||
showPDFviewer.lastTitle = document.title;
|
||||
if(!showPDFviewer.loaded){
|
||||
OC.addScript( 'files_pdfviewer', 'pdfjs/build/pdf',function(){
|
||||
OC.addScript( 'files_pdfviewer', 'pdfview',function(){
|
||||
showPDFviewer.loaded=true;
|
||||
PDFJS.workerSrc = OC.filePath('files_pdfviewer','js','pdfjs/build/pdf.js');
|
||||
PDFView.Ptitle = filename;
|
||||
PDFView.open(url,1.00);
|
||||
PDFView.active=true;
|
||||
});
|
||||
});
|
||||
}else{
|
||||
PDFView.Ptitle = filename;
|
||||
PDFView.open(url,1.00);
|
||||
PDFView.active=true;
|
||||
}
|
||||
PDFView.Ptitle = filename;
|
||||
PDFView.open(url,1.00);
|
||||
PDFView.active=true;
|
||||
$("#pageWidthOption").attr("selected","selected");
|
||||
showPDFviewer.shown = true;
|
||||
}
|
||||
|
@ -46,7 +34,6 @@ function showPDFviewer(dir,filename){
|
|||
showPDFviewer.shown=false;
|
||||
showPDFviewer.oldCode='';
|
||||
showPDFviewer.lastTitle='';
|
||||
showPDFviewer.loaded=false;
|
||||
|
||||
$(document).ready(function(){
|
||||
if(!$.browser.msie){//doesnt work on IE
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*sharing</name>
|
||||
<declaration>
|
||||
|
|
|
@ -104,10 +104,6 @@ class OC_Share {
|
|||
$counter++;
|
||||
}
|
||||
}
|
||||
if (isset($gid)) {
|
||||
$uid = $uid."@".$gid;
|
||||
}
|
||||
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
|
||||
// Update mtime of shared folder to invoke a file cache rescan
|
||||
$rootView=new OC_FilesystemView('/');
|
||||
if (!$rootView->is_dir($sharedFolder)) {
|
||||
|
@ -119,6 +115,10 @@ class OC_Share {
|
|||
$rootView->mkdir($sharedFolder);
|
||||
}
|
||||
$rootView->touch($sharedFolder);
|
||||
if (isset($gid)) {
|
||||
$uid = $uid."@".$gid;
|
||||
}
|
||||
$query->execute(array($uid_owner, $uid, $source, $target, $permissions));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*pictures_images_cache</name>
|
||||
<declaration>
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace OC\Pictures;
|
||||
|
||||
require_once('lib/base.php');
|
||||
|
||||
class DatabaseManager {
|
||||
private static $instance = null;
|
||||
const TAG = 'DatabaseManager';
|
||||
|
|
|
@ -141,7 +141,7 @@ class TileStack extends TileBase {
|
|||
}
|
||||
|
||||
public function get() {
|
||||
$r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
|
||||
$r = '<div class="title gallery_div">'.htmlentities($this->stack_name).'</div>';
|
||||
for ($i = 0; $i < count($this->tiles_array); $i++) {
|
||||
$top = rand(-5, 5);
|
||||
$left = rand(-5, 5);
|
||||
|
@ -168,7 +168,7 @@ class TileStack extends TileBase {
|
|||
}
|
||||
|
||||
public function getOnClickAction() {
|
||||
return 'javascript:openNewGal(\''.$this->stack_name.'\');';
|
||||
return 'javascript:openNewGal(\''.htmlentities($this->stack_name).'\');';
|
||||
}
|
||||
|
||||
private $tiles_array;
|
||||
|
|
|
@ -14,7 +14,7 @@ div.visible { opacity: 0.8;}
|
|||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
var root = "<?php echo $root; ?>";
|
||||
var root = "<?php echo htmlentities($root); ?>";
|
||||
|
||||
function explode(element) {
|
||||
$('div', element).each(function(index, elem) {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
|
||||
<table>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<name>*dbname*</name>
|
||||
<create>true</create>
|
||||
<overwrite>false</overwrite>
|
||||
<charset>latin1</charset>
|
||||
<charset>utf8</charset>
|
||||
<table>
|
||||
<name>*dbprefix*authtoken</name>
|
||||
<declaration>
|
||||
|
|
|
@ -310,8 +310,11 @@ OC.Tasks = {
|
|||
};
|
||||
|
||||
$(document).ready(function(){
|
||||
fillHeight($('#tasks_lists'));
|
||||
fillWindow($('#tasks_list'));
|
||||
$(window).resize(function () {
|
||||
fillHeight($('#tasks_lists'));
|
||||
fillWindow($('#tasks_list'));
|
||||
});
|
||||
$(window).trigger('resize');
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Actions for startup
|
||||
|
|
|
@ -186,7 +186,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
|
|||
if(!$this->configured) {
|
||||
return array();
|
||||
}
|
||||
if(is_null($this->_groups)) {
|
||||
if(empty($this->_groups)) {
|
||||
$ldap_groups = OC_LDAP::fetchListOfGroups($this->ldapGroupFilter, array(OC_LDAP::conf('ldapGroupDisplayName'), 'dn'));
|
||||
$this->_groups = OC_LDAP::ownCloudGroupNames($ldap_groups);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_agent_password', 'ldap_base', 'ldap_base_users', 'ldap_base_groups', 'ldap_userlist_filter', 'ldap_login_filter', 'ldap_group_filter', 'ldap_display_name', 'ldap_tls', 'ldap_nocase', 'ldap_quota_def', 'ldap_quota_attr', 'ldap_email_attr', 'ldap_group_member_assoc_attribute');
|
||||
$params = array('ldap_host', 'ldap_port', 'ldap_dn', 'ldap_agent_password', 'ldap_base', 'ldap_base_users', 'ldap_base_groups', 'ldap_userlist_filter', 'ldap_login_filter', 'ldap_group_filter', 'ldap_display_name', 'ldap_group_display_name', 'ldap_tls', 'ldap_nocase', 'ldap_quota_def', 'ldap_quota_attr', 'ldap_email_attr', 'ldap_group_member_assoc_attribute');
|
||||
|
||||
OCP\Util::addscript('user_ldap', 'settings');
|
||||
|
||||
|
@ -47,13 +47,14 @@ if ($_POST) {
|
|||
// fill template
|
||||
$tmpl = new OCP\Template( 'user_ldap', 'settings');
|
||||
foreach($params as $param){
|
||||
$value = OCP\Config::getAppValue('user_ldap', $param,'');
|
||||
$value = htmlentities(OCP\Config::getAppValue('user_ldap', $param,''));
|
||||
$tmpl->assign($param, $value);
|
||||
}
|
||||
|
||||
// settings with default values
|
||||
$tmpl->assign( 'ldap_port', OCP\Config::getAppValue('user_ldap', 'ldap_port', '389'));
|
||||
$tmpl->assign( 'ldap_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_display_name', 'uid'));
|
||||
$tmpl->assign( 'ldap_group_display_name', OCP\Config::getAppValue('user_ldap', 'ldap_group_display_name', 'cn'));
|
||||
$tmpl->assign( 'ldap_group_member_assoc_attribute', OCP\Config::getAppValue('user_ldap', 'ldap_group_member_assoc_attribute', 'uniqueMember'));
|
||||
$tmpl->assign( 'ldap_agent_password', base64_decode(OCP\Config::getAppValue('user_ldap', 'ldap_agent_password')));
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
<p><input type="checkbox" id="ldap_nocase" name="ldap_nocase" value="1"<?php if (isset($_['ldap_nocase']) && ($_['ldap_nocase'])) echo ' checked'; ?>><label for="ldap_nocase"><?php echo $l->t('Case insensitve LDAP server (Windows)');?></label></p>
|
||||
<p><label for="ldap_display_name"><?php echo $l->t('Display Name Field');?></label><input type="text" id="ldap_display_name" name="ldap_display_name" value="<?php echo $_['ldap_display_name']; ?>" />
|
||||
<small><?php echo $l->t('Currently the display name field needs to be the same you matched %%uid against in the filter above, because ownCloud doesn\'t distinguish between user id and user name.');?></small></p>
|
||||
<p><label for="ldap_group_display_name"><?php echo $l->t('Group Display Name Field');?></label><input type="text" id="ldap_group_display_name" name="ldap_group_display_name" value="<?php echo $_['ldap_group_display_name']; ?>" /></p>
|
||||
<p><label for="ldap_quota_attr">Quota Attribute</label><input type="text" id="ldap_quota_attr" name="ldap_quota_attr" value="<?php echo $_['ldap_quota_attr']; ?>" />
|
||||
<label for="ldap_quota_def">Quota Default</label><input type="text" id="ldap_quota_def" name="ldap_quota_def" value="<?php if (isset($_['ldap_quota_def'])) echo $_['ldap_quota_def']; ?>" />bytes</p>
|
||||
<p><label for="ldap_email_attr">Email Attribute</label><input type="text" id="ldap_email_attr" name="ldap_email_attr" value="<?php echo $_['ldap_email_attr']; ?>" /></p>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
$tmpl = new OCP\Template( 'user_openid', 'settings');
|
||||
$identity=OCP\Config::getUserValue(OCP\USER::getUser(),'user_openid','identity','');
|
||||
$tmpl->assign('identity',$identity);
|
||||
$tmpl->assign('identity',htmlentities($identity));
|
||||
|
||||
OCP\Util::addscript('user_openid','settings');
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ elseif(OC_User::isLoggedIn()) {
|
|||
if (OC_User::login($_SERVER["PHP_AUTH_USER"],$_SERVER["PHP_AUTH_PW"])) {
|
||||
//OC_Log::write('core',"Logged in with HTTP Authentication",OC_Log::DEBUG);
|
||||
OC_User::unsetMagicInCookie();
|
||||
$_REQUEST['redirect_url'] = (isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'');
|
||||
OC_Util::redirectToDefaultPage();
|
||||
}else{
|
||||
$error = true;
|
||||
|
|
|
@ -170,14 +170,18 @@ class OC_Config{
|
|||
}
|
||||
$content .= ");\n?>\n";
|
||||
|
||||
$filename = OC::$SERVERROOT."/config/config.php";
|
||||
// Write the file
|
||||
$result=@file_put_contents( OC::$SERVERROOT."/config/config.php", $content );
|
||||
$result=@file_put_contents( $filename, $content );
|
||||
if(!$result) {
|
||||
$tmpl = new OC_Template( '', 'error', 'guest' );
|
||||
$tmpl->assign('errors',array(1=>array('error'=>"Can't write into config directory 'config'",'hint'=>"You can usually fix this by giving the webserver user write access to the config directory in owncloud")));
|
||||
$tmpl->printPage();
|
||||
exit;
|
||||
}
|
||||
// Prevent others not to read the config
|
||||
@chmod($filename, 0640);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -319,6 +319,9 @@ class OC_Filesystem{
|
|||
if(substr($mountpoint,-1)!=='/'){
|
||||
$mountpoint=$mountpoint.'/';
|
||||
}
|
||||
if (self::getView() != null && $mountpoint != '/' && !self::is_dir(basename($mountpoint))) {
|
||||
self::mkdir(basename($mountpoint));
|
||||
}
|
||||
self::$mounts[$mountpoint]=array('class'=>$class,'arguments'=>$arguments);
|
||||
}
|
||||
|
||||
|
|
30
lib/util.php
Normal file → Executable file
30
lib/util.php
Normal file → Executable file
|
@ -70,6 +70,15 @@ class OC_Util {
|
|||
$quotaProxy=new OC_FileProxy_Quota();
|
||||
OC_FileProxy::register($quotaProxy);
|
||||
self::$fsSetup=true;
|
||||
// Load personal mount config
|
||||
if (is_file($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php')) {
|
||||
$mountConfig = include($CONFIG_DATADIRECTORY_ROOT.'/'.$user.'/mount.php');
|
||||
if (isset($mountConfig['user'][$user])) {
|
||||
foreach ($mountConfig['user'][$user] as $mountPoint => $options) {
|
||||
OC_Filesystem::mount($options['class'], $options['options'], $mountPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,7 +332,8 @@ class OC_Util {
|
|||
* Redirect to the user default page
|
||||
*/
|
||||
public static function redirectToDefaultPage(){
|
||||
if(isset($_REQUEST['redirect_url']) && substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT) {
|
||||
OC_Log::write('core','redirectToDefaultPage',OC_Log::DEBUG);
|
||||
if(isset($_REQUEST['redirect_url']) && (substr($_REQUEST['redirect_url'], 0, strlen(OC::$WEBROOT)) == OC::$WEBROOT || $_REQUEST['redirect_url'][0] == '/')) {
|
||||
header( 'Location: '.$_REQUEST['redirect_url']);
|
||||
} else {
|
||||
header( 'Location: '.OC::$WEBROOT.'/'.OC_Appconfig::getValue('core', 'defaultpage', '?app=files'));
|
||||
|
@ -349,12 +359,30 @@ class OC_Util {
|
|||
* Todo: Write howto
|
||||
*/
|
||||
public static function callRegister(){
|
||||
//mamimum time before token exires
|
||||
$maxtime=(60*60); // 1 hour
|
||||
|
||||
// generate a random token.
|
||||
$token=mt_rand(1000,9000).mt_rand(1000,9000).mt_rand(1000,9000);
|
||||
|
||||
// store the token together with a timestamp in the session.
|
||||
$_SESSION['requesttoken-'.$token]=time();
|
||||
|
||||
// cleanup old tokens garbage collector
|
||||
// only run every 20th time so we don´t waste cpu cycles
|
||||
if(rand(0,20)==0) {
|
||||
foreach($_SESSION as $key=>$value) {
|
||||
// search all tokens in the session
|
||||
if(substr($key,0,12)=='requesttoken') {
|
||||
if($value+$maxtime<time()){
|
||||
// remove outdated tokens
|
||||
unset($_SESSION[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// return the token
|
||||
return($token);
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ class OC_VCategories {
|
|||
* @returns array containing the categories as strings.
|
||||
*/
|
||||
public function categories() {
|
||||
OC_Log::write('core','OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||
//OC_Log::write('core','OC_VCategories::categories: '.print_r($this->categories, true), OC_Log::DEBUG);
|
||||
usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
|
||||
return $this->categories;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ class OC_VCategories {
|
|||
foreach($names as $name) {
|
||||
OC_Log::write('core','OC_VCategories::delete: '.$name, OC_Log::DEBUG);
|
||||
if($this->hasCategory($name)) {
|
||||
OC_Log::write('core','OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
|
||||
//OC_Log::write('core','OC_VCategories::delete: '.$name.' got it', OC_Log::DEBUG);
|
||||
unset($this->categories[$this->array_searchi($name, $this->categories)]);
|
||||
}
|
||||
}
|
||||
|
@ -183,14 +183,14 @@ class OC_VCategories {
|
|||
//OC_Log::write('core','OC_VCategories::delete, before: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
||||
foreach($names as $name) {
|
||||
$idx = $this->array_searchi($name, $categories);
|
||||
OC_Log::write('core','OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
|
||||
//OC_Log::write('core','OC_VCategories::delete, loop: '.$name.', '.print_r($idx, true), OC_Log::DEBUG);
|
||||
if($idx !== false) {
|
||||
OC_Log::write('core','OC_VCategories::delete, unsetting: '.$categories[$this->array_searchi($name, $categories)], OC_Log::DEBUG);
|
||||
unset($categories[$this->array_searchi($name, $categories)]);
|
||||
//unset($categories[$idx]);
|
||||
}
|
||||
}
|
||||
OC_Log::write('core','OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
||||
//OC_Log::write('core','OC_VCategories::delete, after: '.$key.': '.print_r($categories, true), OC_Log::DEBUG);
|
||||
$vobject->setString('CATEGORIES', implode(',', $categories));
|
||||
$value[1] = $vobject->serialize();
|
||||
$objects[$key] = $value;
|
||||
|
|
|
@ -34,8 +34,8 @@ li.selected { background-color:#ddd; }
|
|||
#content>table:not(.nostyle) { margin-top:3em; }
|
||||
table:not(.nostyle) { width:100%; }
|
||||
#rightcontent { padding-left: 1em; }
|
||||
td.quota { position:relative; }
|
||||
div.quota { float:right; display:block; position:absolute; right:25em; top:0; }
|
||||
div.quota-select-wrapper { position: relative; }
|
||||
select.quota { position:absolute; left:0; top:0; width:10em; }
|
||||
select.quota-user { position:relative; left:0; top:0; width:10em; }
|
||||
input.quota-other { display:none; position:absolute; left:0.1em; top:0.1em; width:7em; border:none; -webkit-box-shadow: none -mox-box-shadow:none ; box-shadow:none; }
|
||||
|
|
|
@ -95,9 +95,9 @@ $(document).ready(function(){
|
|||
$(this).children('img').click();
|
||||
});
|
||||
|
||||
$('select.quota').live('change',function(){
|
||||
$('select.quota, select.quota-user').live('change',function(){
|
||||
var select=$(this);
|
||||
var uid=$(this).parent().parent().data('uid');
|
||||
var uid=$(this).parent().parent().parent().data('uid');
|
||||
var quota=$(this).val();
|
||||
var other=$(this).next();
|
||||
if(quota!='other'){
|
||||
|
@ -110,7 +110,7 @@ $(document).ready(function(){
|
|||
other.focus();
|
||||
}
|
||||
});
|
||||
$('select.quota').each(function(i,select){
|
||||
$('select.quota, select.quota-user').each(function(i,select){
|
||||
$(select).data('previous',$(select).val());
|
||||
})
|
||||
|
||||
|
@ -207,9 +207,9 @@ $(document).ready(function(){
|
|||
applyMultiplySelect(select);
|
||||
$('#content table tbody').last().append(tr);
|
||||
|
||||
tr.find('select.quota option').attr('selected',null);
|
||||
tr.find('select.quota option').first().attr('selected','selected');
|
||||
tr.find('select.quota').data('previous','default');
|
||||
tr.find('select.quota-user option').attr('selected',null);
|
||||
tr.find('select.quota-user option').first().attr('selected','selected');
|
||||
tr.find('select.quota-user').data('previous','default');
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -12,29 +12,43 @@ foreach($_["groups"] as $group) {
|
|||
|
||||
<div id="controls">
|
||||
<form id="newuser">
|
||||
<input id="newusername" placeholder="<?php echo $l->t('Name')?>" />
|
||||
<input type="password" id="newuserpassword" placeholder="<?php echo $l->t('Password')?>" />
|
||||
<select id="newusergroups" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
|
||||
<?php foreach($_["groups"] as $group): ?>
|
||||
<option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
<input type="submit" value="<?php echo $l->t('Create')?>" />
|
||||
<input id="newusername" placeholder="<?php echo $l->t('Name')?>" /> <input
|
||||
type="password" id="newuserpassword"
|
||||
placeholder="<?php echo $l->t('Password')?>" /> <select
|
||||
id="newusergroups" data-placeholder="groups"
|
||||
title="<?php echo $l->t('Groups')?>" multiple="multiple">
|
||||
<?php foreach($_["groups"] as $group): ?>
|
||||
<option value="<?php echo $group['name'];?>">
|
||||
<?php echo $group['name'];?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select> <input type="submit" value="<?php echo $l->t('Create')?>" />
|
||||
</form>
|
||||
<div class="quota">
|
||||
<span><?php echo $l->t('Default Quota');?>:</span>
|
||||
<select class='quota'>
|
||||
<?php foreach($_['quota_preset'] as $preset):?>
|
||||
<div class="quota-select-wrapper">
|
||||
<select class='quota'>
|
||||
<?php foreach($_['quota_preset'] as $preset):?>
|
||||
<?php if($preset!='default'):?>
|
||||
<option <?php if($_['default_quota']==$preset) echo 'selected="selected"';?> value='<?php echo $preset;?>'><?php echo $preset;?></option>
|
||||
<option
|
||||
<?php if($_['default_quota']==$preset) echo 'selected="selected"';?>
|
||||
value='<?php echo $preset;?>'>
|
||||
<?php echo $preset;?>
|
||||
</option>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($_['default_quota'],$_['quota_preset'])===false):?>
|
||||
<option selected="selected" value='<?php echo $_['default_quota'];?>'><?php echo $_['default_quota'];?></option>
|
||||
<?php endif;?>
|
||||
<option value='other'><?php echo $l->t('Other');?>...</option>
|
||||
</select>
|
||||
<input class='quota-other'></input>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($_['default_quota'],$_['quota_preset'])===false):?>
|
||||
<option selected="selected"
|
||||
value='<?php echo $_['default_quota'];?>'>
|
||||
<?php echo $_['default_quota'];?>
|
||||
</option>
|
||||
<?php endif;?>
|
||||
<option value='other'>
|
||||
<?php echo $l->t('Other');?>
|
||||
...
|
||||
</option>
|
||||
</select> <input class='quota-other'></input>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -49,38 +63,52 @@ foreach($_["groups"] as $group) {
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($_["users"] as $user): ?>
|
||||
<?php foreach($_["users"] as $user): ?>
|
||||
<tr data-uid="<?php echo $user["name"] ?>">
|
||||
<td class="name"><?php echo $user["name"]; ?></td>
|
||||
<td class="password">
|
||||
<span>●●●●●●●</span>
|
||||
<img class="svg action" src="<?php echo image_path('core','actions/rename.svg')?>" alt="set new password" title="set new password" />
|
||||
<td class="password"><span>●●●●●●●</span> <img class="svg action"
|
||||
src="<?php echo image_path('core','actions/rename.svg')?>"
|
||||
alt="set new password" title="set new password" />
|
||||
</td>
|
||||
<td class="groups">
|
||||
<select data-username="<?php echo $user['name'] ;?>" data-user-groups="<?php echo $user['groups'] ;?>" data-placeholder="groups" title="<?php echo $l->t('Groups')?>" multiple="multiple">
|
||||
<td class="groups"><select
|
||||
data-username="<?php echo $user['name'] ;?>"
|
||||
data-user-groups="<?php echo $user['groups'] ;?>"
|
||||
data-placeholder="groups" title="<?php echo $l->t('Groups')?>"
|
||||
multiple="multiple">
|
||||
<?php foreach($_["groups"] as $group): ?>
|
||||
<option value="<?php echo $group['name'];?>"><?php echo $group['name'];?></option>
|
||||
<option value="<?php echo $group['name'];?>">
|
||||
<?php echo $group['name'];?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</select>
|
||||
</td>
|
||||
<td class="quota">
|
||||
<select class='quota-user'>
|
||||
<?php foreach($_['quota_preset'] as $preset):?>
|
||||
<option <?php if($user['quota']==$preset) echo 'selected="selected"';?> value='<?php echo $preset;?>'><?php echo $preset;?></option>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($user['quota'],$_['quota_preset'])===false):?>
|
||||
<option selected="selected" value='<?php echo $user['quota'];?>'><?php echo $user['quota'];?></option>
|
||||
<?php endif;?>
|
||||
<option value='other'><?php echo $l->t('Other');?>...</option>
|
||||
</select>
|
||||
<input class='quota-other'></input>
|
||||
<div class="quota-select-wrapper">
|
||||
<select class='quota-user'>
|
||||
<?php foreach($_['quota_preset'] as $preset):?>
|
||||
<option
|
||||
<?php if($user['quota']==$preset) echo 'selected="selected"';?>
|
||||
value='<?php echo $preset;?>'>
|
||||
<?php echo $preset;?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($user['quota'],$_['quota_preset'])===false):?>
|
||||
<option selected="selected" value='<?php echo $user['quota'];?>'>
|
||||
<?php echo $user['quota'];?>
|
||||
</option>
|
||||
<?php endif;?>
|
||||
<option value='other'>
|
||||
<?php echo $l->t('Other');?>
|
||||
...
|
||||
</option>
|
||||
</select> <input class='quota-other'></input>
|
||||
</div>
|
||||
</td>
|
||||
<td class="remove">
|
||||
<?php if($user['name']!=OC_User::getUser()):?>
|
||||
<img alt="Delete" title="<?php echo $l->t('Delete')?>" class="svg action" src="<?php echo image_path('core','actions/delete.svg') ?>" />
|
||||
<?php endif;?>
|
||||
<td class="remove"><?php if($user['name']!=OC_User::getUser()):?> <img
|
||||
alt="Delete" title="<?php echo $l->t('Delete')?>" class="svg action"
|
||||
src="<?php echo image_path('core','actions/delete.svg') ?>" /> <?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue