From 3e5c217350e66caa1def9942f20b9356bf0b751e Mon Sep 17 00:00:00 2001 From: Default Gituser Date: Mon, 13 May 2013 15:22:36 +0200 Subject: [PATCH 01/17] init devel --- devel.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 devel.md diff --git a/devel.md b/devel.md new file mode 100644 index 0000000..731fec8 --- /dev/null +++ b/devel.md @@ -0,0 +1 @@ + devel branch From c8ecabeb75759e3aec63a0edb0c5603cd113dcf2 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 13 May 2013 18:13:01 +0200 Subject: [PATCH 02/17] add create.sql --- sql/create/createDB-20130513.sql | Bin 0 -> 19274 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 sql/create/createDB-20130513.sql diff --git a/sql/create/createDB-20130513.sql b/sql/create/createDB-20130513.sql new file mode 100644 index 0000000000000000000000000000000000000000..a7b22ac2545ffb3a496eef18f764baf75796036b GIT binary patch literal 19274 zcmezWFO(se!IeRQA)3LRA(bJY!G*zzA(nxcfs4VN!5>UJGWalrFt{=VF(@#EFgP+e zG5A1rq%b5g7=joa89W*M7(&4IyD@k(#N#ywS+*F>hQaS*%0tzYA&()AA)ld$ zA(tVMp@bomA)g_Sf&9?LZXR+dV^=X0eL|U=QPZ;vLq0eLGRY2o+~y&NJ~h)gZX3x< zKe)|{XFv@fN^&Ol^oMFbIb{oBbCKf#yK2f(6m~P|<1xrAgDEUc#9K-(LxB!i*`7#7BghJy4Rj((5J2(_U zu?Fg$hcW~(#KT>Wsuncb=fmL75Y7+}9ty($|9JufdZWQT>jYHYv}K zB@C4e1q`X+939P&#E=Qi-MDjb3PUPGF;Y(#F`^mGP{EMPkOMXgR*oTZemS^rTml_! z&Spr3j>KUv13;st6?jSkP^nbJkjjwAkOCgPrqnz_r3z|HjFu~)`icJK3aI9CWr$z^ zm8qaI9a4JXE2XGa3L)l7sMTs6DrFF|&uLKt6@X`abvBq1#i%EowyUYj_n+4%+hzzJU8SMo?`cm}m1t7{~Tw`*O{0ZuHQ8EiN^l~V!@Id5N z>h<11ef1oMQh0v>xxJ6Ah9*8Qw`QFLOAaZhL$$=G=bg|gXH^> zRxcA1HpnFaEH5CB7~rn2Q)p6O6XRye@;l6zkQ|Sw#}WR4$c)zGh%r&ZWdSI(Ko~X- zP045;q8>+|gN5Ydkyn4ChXZo1rPioBIlW}i2wO3@7Y-WnKpoqotgc7*F=crk5=Nu> zdT7@1_*SHh)Di(-m>^1rViM|TP+msVfrQ%t#JAh=xs{T9jqn{LXOGt9u-QdF@T>^F zF>iX!%pvM>(Eb7JtvgWN0m;WBt%Z&+Oc1#kG4@0_SAueJCJDKo_*{(7t(4?qgzwOE zF~T1Z8BqIjbYyK{N7g{80JS_H*|`@zEXdEbh}w*BE+;M5qPvkcxfS95(cDUUI~!EC zfiSH93|fN&S$6~)Wh1;h4|SeH0cjPIGlK_%D+6eqj{aGa| z1~&%C8YRdoB-pAc4Tfk2*o=rKctsRwb&?x+#TjS?nlpndc)d|H1M=Ppge{=b1Y`ze zlm=n~b;1NW96;-;h}o-%a2KlY2YXB*T3w*<#2r(xx)&18#KaV;$%8Ydkljd0Okr=W zVva2%R{SBSG0@6C(()Q%`#`JwQ1>X}j$2q?j`+Am_ZhWfm$1J;sT4Wvh|QmbO-2u~ z;g%i{X&rl5fI=2`8iBR2iBBWM*f%`V4Pl>Bl9o{0Wav4Mdi6JMd(d+Rz8Zb-lqI&Yo2FzumM*?>FNXps(Zha4qo0@RnrU20RW z48Uy<>h5fOCBR^5DdP4Ex$%zMMAXn3J~53u&EYNu26syVcO23-Rp1IqO4ABz=?3xx zbxQ+O^HJ0JP$>ma{QwFha%z82%0V>=H8h59Ok&o(xO4a5tm84`hBmQ`9#Y704gleJ B>Tv)7 literal 0 HcmV?d00001 From 5096b240a4bdbeb780a4793026afb8ada34e2651 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 16 May 2013 13:42:39 +0200 Subject: [PATCH 03/17] inint api --- geoapi/.htaccess | 2 + geoapi/Slim/Environment.php | 237 ++++ geoapi/Slim/Exception/Pass.php | 50 + geoapi/Slim/Exception/Stop.php | 48 + geoapi/Slim/Http/Headers.php | 181 +++ geoapi/Slim/Http/Request.php | 585 +++++++++ geoapi/Slim/Http/Response.php | 459 +++++++ geoapi/Slim/Http/Util.php | 389 ++++++ geoapi/Slim/Log.php | 237 ++++ geoapi/Slim/LogWriter.php | 75 ++ geoapi/Slim/Middleware.php | 114 ++ geoapi/Slim/Middleware/ContentTypes.php | 170 +++ geoapi/Slim/Middleware/Flash.php | 202 +++ geoapi/Slim/Middleware/MethodOverride.php | 96 ++ geoapi/Slim/Middleware/PrettyExceptions.php | 114 ++ geoapi/Slim/Middleware/SessionCookie.php | 203 +++ geoapi/Slim/Route.php | 416 ++++++ geoapi/Slim/Router.php | 235 ++++ geoapi/Slim/Slim.php | 1309 +++++++++++++++++++ geoapi/Slim/View.php | 216 +++ geoapi/index.php | 14 + geoapi/nbproject/project.properties | 7 + geoapi/nbproject/project.xml | 9 + 23 files changed, 5368 insertions(+) create mode 100644 geoapi/.htaccess create mode 100644 geoapi/Slim/Environment.php create mode 100644 geoapi/Slim/Exception/Pass.php create mode 100644 geoapi/Slim/Exception/Stop.php create mode 100644 geoapi/Slim/Http/Headers.php create mode 100644 geoapi/Slim/Http/Request.php create mode 100644 geoapi/Slim/Http/Response.php create mode 100644 geoapi/Slim/Http/Util.php create mode 100644 geoapi/Slim/Log.php create mode 100644 geoapi/Slim/LogWriter.php create mode 100644 geoapi/Slim/Middleware.php create mode 100644 geoapi/Slim/Middleware/ContentTypes.php create mode 100644 geoapi/Slim/Middleware/Flash.php create mode 100644 geoapi/Slim/Middleware/MethodOverride.php create mode 100644 geoapi/Slim/Middleware/PrettyExceptions.php create mode 100644 geoapi/Slim/Middleware/SessionCookie.php create mode 100644 geoapi/Slim/Route.php create mode 100644 geoapi/Slim/Router.php create mode 100644 geoapi/Slim/Slim.php create mode 100644 geoapi/Slim/View.php create mode 100644 geoapi/index.php create mode 100644 geoapi/nbproject/project.properties create mode 100644 geoapi/nbproject/project.xml diff --git a/geoapi/.htaccess b/geoapi/.htaccess new file mode 100644 index 0000000..450c0d1 --- /dev/null +++ b/geoapi/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine on +RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/geoapi/Slim/Environment.php b/geoapi/Slim/Environment.php new file mode 100644 index 0000000..147d00f --- /dev/null +++ b/geoapi/Slim/Environment.php @@ -0,0 +1,237 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Environment + * + * This class creates and returns a key/value array of common + * environment variables for the current HTTP request. + * + * This is a singleton class; derived environment variables will + * be common across multiple Slim applications. + * + * This class matches the Rack (Ruby) specification as closely + * as possible. More information available below. + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class Environment implements \ArrayAccess, \IteratorAggregate +{ + /** + * @var array + */ + protected $properties; + + /** + * @var \Slim\Environment + */ + protected static $environment; + + /** + * Get environment instance (singleton) + * + * This creates and/or returns an environment instance (singleton) + * derived from $_SERVER variables. You may override the global server + * variables by using `\Slim\Environment::mock()` instead. + * + * @param bool $refresh Refresh properties using global server variables? + * @return \Slim\Environment + */ + public static function getInstance($refresh = false) + { + if (is_null(self::$environment) || $refresh) { + self::$environment = new self(); + } + + return self::$environment; + } + + /** + * Get mock environment instance + * + * @param array $userSettings + * @return \Slim\Environment + */ + public static function mock($userSettings = array()) + { + self::$environment = new self(array_merge(array( + 'REQUEST_METHOD' => 'GET', + 'SCRIPT_NAME' => '', + 'PATH_INFO' => '', + 'QUERY_STRING' => '', + 'SERVER_NAME' => 'localhost', + 'SERVER_PORT' => 80, + 'ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + 'ACCEPT_LANGUAGE' => 'en-US,en;q=0.8', + 'ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', + 'USER_AGENT' => 'Slim Framework', + 'REMOTE_ADDR' => '127.0.0.1', + 'slim.url_scheme' => 'http', + 'slim.input' => '', + 'slim.errors' => @fopen('php://stderr', 'w') + ), $userSettings)); + + return self::$environment; + } + + /** + * Constructor (private access) + * + * @param array|null $settings If present, these are used instead of global server variables + */ + private function __construct($settings = null) + { + if ($settings) { + $this->properties = $settings; + } else { + $env = array(); + + //The HTTP request method + $env['REQUEST_METHOD'] = $_SERVER['REQUEST_METHOD']; + + //The IP + $env['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR']; + + /** + * Application paths + * + * This derives two paths: SCRIPT_NAME and PATH_INFO. The SCRIPT_NAME + * is the real, physical path to the application, be it in the root + * directory or a subdirectory of the public document root. The PATH_INFO is the + * virtual path to the requested resource within the application context. + * + * With htaccess, the SCRIPT_NAME will be an absolute path (without file name); + * if not using htaccess, it will also include the file name. If it is "/", + * it is set to an empty string (since it cannot have a trailing slash). + * + * The PATH_INFO will be an absolute path with a leading slash; this will be + * used for application routing. + */ + if (strpos($_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME']) === 0) { + $env['SCRIPT_NAME'] = $_SERVER['SCRIPT_NAME']; //Without URL rewrite + } else { + $env['SCRIPT_NAME'] = str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME']) ); //With URL rewrite + } + $env['PATH_INFO'] = substr_replace($_SERVER['REQUEST_URI'], '', 0, strlen($env['SCRIPT_NAME'])); + if (strpos($env['PATH_INFO'], '?') !== false) { + $env['PATH_INFO'] = substr_replace($env['PATH_INFO'], '', strpos($env['PATH_INFO'], '?')); //query string is not removed automatically + } + $env['SCRIPT_NAME'] = rtrim($env['SCRIPT_NAME'], '/'); + $env['PATH_INFO'] = '/' . ltrim($env['PATH_INFO'], '/'); + + //The portion of the request URI following the '?' + $env['QUERY_STRING'] = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; + + //Name of server host that is running the script + $env['SERVER_NAME'] = $_SERVER['SERVER_NAME']; + + //Number of server port that is running the script + $env['SERVER_PORT'] = $_SERVER['SERVER_PORT']; + + //HTTP request headers + $specialHeaders = array('CONTENT_TYPE', 'CONTENT_LENGTH', 'PHP_AUTH_USER', 'PHP_AUTH_PW', 'PHP_AUTH_DIGEST', 'AUTH_TYPE'); + foreach ($_SERVER as $key => $value) { + $value = is_string($value) ? trim($value) : $value; + if (strpos($key, 'HTTP_') === 0) { + $env[substr($key, 5)] = $value; + } elseif (strpos($key, 'X_') === 0 || in_array($key, $specialHeaders)) { + $env[$key] = $value; + } + } + + //Is the application running under HTTPS or HTTP protocol? + $env['slim.url_scheme'] = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http' : 'https'; + + //Input stream (readable one time only; not available for mutipart/form-data requests) + $rawInput = @file_get_contents('php://input'); + if (!$rawInput) { + $rawInput = ''; + } + $env['slim.input'] = $rawInput; + + //Error stream + $env['slim.errors'] = fopen('php://stderr', 'w'); + + $this->properties = $env; + } + } + + /** + * Array Access: Offset Exists + */ + public function offsetExists($offset) + { + return isset($this->properties[$offset]); + } + + /** + * Array Access: Offset Get + */ + public function offsetGet($offset) + { + if (isset($this->properties[$offset])) { + return $this->properties[$offset]; + } else { + return null; + } + } + + /** + * Array Access: Offset Set + */ + public function offsetSet($offset, $value) + { + $this->properties[$offset] = $value; + } + + /** + * Array Access: Offset Unset + */ + public function offsetUnset($offset) + { + unset($this->properties[$offset]); + } + + /** + * IteratorAggregate + * + * @return \ArrayIterator + */ + public function getIterator() + { + return new \ArrayIterator($this->properties); + } +} diff --git a/geoapi/Slim/Exception/Pass.php b/geoapi/Slim/Exception/Pass.php new file mode 100644 index 0000000..f4f25fa --- /dev/null +++ b/geoapi/Slim/Exception/Pass.php @@ -0,0 +1,50 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Exception; + +/** + * Pass Exception + * + * This Exception will cause the Router::dispatch method + * to skip the current matching route and continue to the next + * matching route. If no subsequent routes are found, a + * HTTP 404 Not Found response will be sent to the client. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Pass extends \Exception +{ + +} diff --git a/geoapi/Slim/Exception/Stop.php b/geoapi/Slim/Exception/Stop.php new file mode 100644 index 0000000..f008959 --- /dev/null +++ b/geoapi/Slim/Exception/Stop.php @@ -0,0 +1,48 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Exception; + +/** + * Stop Exception + * + * This Exception is thrown when the Slim application needs to abort + * processing and return control flow to the outer PHP script. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Stop extends \Exception +{ + +} diff --git a/geoapi/Slim/Http/Headers.php b/geoapi/Slim/Http/Headers.php new file mode 100644 index 0000000..0185f08 --- /dev/null +++ b/geoapi/Slim/Http/Headers.php @@ -0,0 +1,181 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Http; + + /** + * HTTP Headers + * + * This class is an abstraction of the HTTP response headers and + * provides array access to the header list while automatically + * stores and retrieves headers with lowercase canonical keys regardless + * of the input format. + * + * This class also implements the `Iterator` and `Countable` + * interfaces for even more convenient usage. + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class Headers implements \ArrayAccess, \Iterator, \Countable +{ + /** + * @var array HTTP headers + */ + protected $headers; + + /** + * @var array Map canonical header name to original header name + */ + protected $map; + + /** + * Constructor + * @param array $headers + */ + public function __construct($headers = array()) + { + $this->merge($headers); + } + + /** + * Merge Headers + * @param array $headers + */ + public function merge($headers) + { + foreach ($headers as $name => $value) { + $this[$name] = $value; + } + } + + /** + * Transform header name into canonical form + * @param string $name + * @return string + */ + protected function canonical($name) + { + return strtolower(trim($name)); + } + + /** + * Array Access: Offset Exists + */ + public function offsetExists($offset) + { + return isset($this->headers[$this->canonical($offset)]); + } + + /** + * Array Access: Offset Get + */ + public function offsetGet($offset) + { + $canonical = $this->canonical($offset); + if (isset($this->headers[$canonical])) { + return $this->headers[$canonical]; + } else { + return null; + } + } + + /** + * Array Access: Offset Set + */ + public function offsetSet($offset, $value) + { + $canonical = $this->canonical($offset); + $this->headers[$canonical] = $value; + $this->map[$canonical] = $offset; + } + + /** + * Array Access: Offset Unset + */ + public function offsetUnset($offset) + { + $canonical = $this->canonical($offset); + unset($this->headers[$canonical], $this->map[$canonical]); + } + + /** + * Countable: Count + */ + public function count() + { + return count($this->headers); + } + + /** + * Iterator: Rewind + */ + public function rewind() + { + reset($this->headers); + } + + /** + * Iterator: Current + */ + public function current() + { + return current($this->headers); + } + + /** + * Iterator: Key + */ + public function key() + { + $key = key($this->headers); + + return $this->map[$key]; + } + + /** + * Iterator: Next + */ + public function next() + { + return next($this->headers); + } + + /** + * Iterator: Valid + */ + public function valid() + { + return current($this->headers) !== false; + } +} diff --git a/geoapi/Slim/Http/Request.php b/geoapi/Slim/Http/Request.php new file mode 100644 index 0000000..e508394 --- /dev/null +++ b/geoapi/Slim/Http/Request.php @@ -0,0 +1,585 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Http; + +/** + * Slim HTTP Request + * + * This class provides a human-friendly interface to the Slim environment variables; + * environment variables are passed by reference and will be modified directly. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Request +{ + const METHOD_HEAD = 'HEAD'; + const METHOD_GET = 'GET'; + const METHOD_POST = 'POST'; + const METHOD_PUT = 'PUT'; + const METHOD_DELETE = 'DELETE'; + const METHOD_OPTIONS = 'OPTIONS'; + const METHOD_OVERRIDE = '_METHOD'; + + /** + * @var array + */ + protected static $formDataMediaTypes = array('application/x-www-form-urlencoded'); + + /** + * @var array + */ + protected $env; + + /** + * Constructor + * @param array $env + * @see \Slim\Environment + */ + public function __construct($env) + { + $this->env = $env; + } + + /** + * Get HTTP method + * @return string + */ + public function getMethod() + { + return $this->env['REQUEST_METHOD']; + } + + /** + * Is this a GET request? + * @return bool + */ + public function isGet() + { + return $this->getMethod() === self::METHOD_GET; + } + + /** + * Is this a POST request? + * @return bool + */ + public function isPost() + { + return $this->getMethod() === self::METHOD_POST; + } + + /** + * Is this a PUT request? + * @return bool + */ + public function isPut() + { + return $this->getMethod() === self::METHOD_PUT; + } + + /** + * Is this a DELETE request? + * @return bool + */ + public function isDelete() + { + return $this->getMethod() === self::METHOD_DELETE; + } + + /** + * Is this a HEAD request? + * @return bool + */ + public function isHead() + { + return $this->getMethod() === self::METHOD_HEAD; + } + + /** + * Is this a OPTIONS request? + * @return bool + */ + public function isOptions() + { + return $this->getMethod() === self::METHOD_OPTIONS; + } + + /** + * Is this an AJAX request? + * @return bool + */ + public function isAjax() + { + if ($this->params('isajax')) { + return true; + } elseif (isset($this->env['X_REQUESTED_WITH']) && $this->env['X_REQUESTED_WITH'] === 'XMLHttpRequest') { + return true; + } else { + return false; + } + } + + /** + * Is this an XHR request? (alias of Slim_Http_Request::isAjax) + * @return bool + */ + public function isXhr() + { + return $this->isAjax(); + } + + /** + * Fetch GET and POST data + * + * This method returns a union of GET and POST data as a key-value array, or the value + * of the array key if requested; if the array key does not exist, NULL is returned. + * + * @param string $key + * @return array|mixed|null + */ + public function params($key = null) + { + $union = array_merge($this->get(), $this->post()); + if ($key) { + if (isset($union[$key])) { + return $union[$key]; + } else { + return null; + } + } else { + return $union; + } + } + + /** + * Fetch GET data + * + * This method returns a key-value array of data sent in the HTTP request query string, or + * the value of the array key if requested; if the array key does not exist, NULL is returned. + * + * @param string $key + * @return array|mixed|null + */ + public function get($key = null) + { + if (!isset($this->env['slim.request.query_hash'])) { + $output = array(); + if (function_exists('mb_parse_str') && !isset($this->env['slim.tests.ignore_multibyte'])) { + mb_parse_str($this->env['QUERY_STRING'], $output); + } else { + parse_str($this->env['QUERY_STRING'], $output); + } + $this->env['slim.request.query_hash'] = Util::stripSlashesIfMagicQuotes($output); + } + if ($key) { + if (isset($this->env['slim.request.query_hash'][$key])) { + return $this->env['slim.request.query_hash'][$key]; + } else { + return null; + } + } else { + return $this->env['slim.request.query_hash']; + } + } + + /** + * Fetch POST data + * + * This method returns a key-value array of data sent in the HTTP request body, or + * the value of a hash key if requested; if the array key does not exist, NULL is returned. + * + * @param string $key + * @return array|mixed|null + * @throws \RuntimeException If environment input is not available + */ + public function post($key = null) + { + if (!isset($this->env['slim.input'])) { + throw new \RuntimeException('Missing slim.input in environment variables'); + } + if (!isset($this->env['slim.request.form_hash'])) { + $this->env['slim.request.form_hash'] = array(); + if ($this->isFormData() && is_string($this->env['slim.input'])) { + $output = array(); + if (function_exists('mb_parse_str') && !isset($this->env['slim.tests.ignore_multibyte'])) { + mb_parse_str($this->env['slim.input'], $output); + } else { + parse_str($this->env['slim.input'], $output); + } + $this->env['slim.request.form_hash'] = Util::stripSlashesIfMagicQuotes($output); + } else { + $this->env['slim.request.form_hash'] = Util::stripSlashesIfMagicQuotes($_POST); + } + } + if ($key) { + if (isset($this->env['slim.request.form_hash'][$key])) { + return $this->env['slim.request.form_hash'][$key]; + } else { + return null; + } + } else { + return $this->env['slim.request.form_hash']; + } + } + + /** + * Fetch PUT data (alias for \Slim\Http\Request::post) + * @param string $key + * @return array|mixed|null + */ + public function put($key = null) + { + return $this->post($key); + } + + /** + * Fetch DELETE data (alias for \Slim\Http\Request::post) + * @param string $key + * @return array|mixed|null + */ + public function delete($key = null) + { + return $this->post($key); + } + + /** + * Fetch COOKIE data + * + * This method returns a key-value array of Cookie data sent in the HTTP request, or + * the value of a array key if requested; if the array key does not exist, NULL is returned. + * + * @param string $key + * @return array|string|null + */ + public function cookies($key = null) + { + if (!isset($this->env['slim.request.cookie_hash'])) { + $cookieHeader = isset($this->env['COOKIE']) ? $this->env['COOKIE'] : ''; + $this->env['slim.request.cookie_hash'] = Util::parseCookieHeader($cookieHeader); + } + if ($key) { + if (isset($this->env['slim.request.cookie_hash'][$key])) { + return $this->env['slim.request.cookie_hash'][$key]; + } else { + return null; + } + } else { + return $this->env['slim.request.cookie_hash']; + } + } + + /** + * Does the Request body contain parseable form data? + * @return bool + */ + public function isFormData() + { + $method = isset($this->env['slim.method_override.original_method']) ? $this->env['slim.method_override.original_method'] : $this->getMethod(); + + return ($method === self::METHOD_POST && is_null($this->getContentType())) || in_array($this->getMediaType(), self::$formDataMediaTypes); + } + + /** + * Get Headers + * + * This method returns a key-value array of headers sent in the HTTP request, or + * the value of a hash key if requested; if the array key does not exist, NULL is returned. + * + * @param string $key + * @param mixed $default The default value returned if the requested header is not available + * @return mixed + */ + public function headers($key = null, $default = null) + { + if ($key) { + $key = strtoupper($key); + $key = str_replace('-', '_', $key); + $key = preg_replace('@^HTTP_@', '', $key); + if (isset($this->env[$key])) { + return $this->env[$key]; + } else { + return $default; + } + } else { + $headers = array(); + foreach ($this->env as $key => $value) { + if (strpos($key, 'slim.') !== 0) { + $headers[$key] = $value; + } + } + + return $headers; + } + } + + /** + * Get Body + * @return string + */ + public function getBody() + { + return $this->env['slim.input']; + } + + /** + * Get Content Type + * @return string + */ + public function getContentType() + { + if (isset($this->env['CONTENT_TYPE'])) { + return $this->env['CONTENT_TYPE']; + } else { + return null; + } + } + + /** + * Get Media Type (type/subtype within Content Type header) + * @return string|null + */ + public function getMediaType() + { + $contentType = $this->getContentType(); + if ($contentType) { + $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType); + + return strtolower($contentTypeParts[0]); + } else { + return null; + } + } + + /** + * Get Media Type Params + * @return array + */ + public function getMediaTypeParams() + { + $contentType = $this->getContentType(); + $contentTypeParams = array(); + if ($contentType) { + $contentTypeParts = preg_split('/\s*[;,]\s*/', $contentType); + $contentTypePartsLength = count($contentTypeParts); + for ($i = 1; $i < $contentTypePartsLength; $i++) { + $paramParts = explode('=', $contentTypeParts[$i]); + $contentTypeParams[strtolower($paramParts[0])] = $paramParts[1]; + } + } + + return $contentTypeParams; + } + + /** + * Get Content Charset + * @return string|null + */ + public function getContentCharset() + { + $mediaTypeParams = $this->getMediaTypeParams(); + if (isset($mediaTypeParams['charset'])) { + return $mediaTypeParams['charset']; + } else { + return null; + } + } + + /** + * Get Content-Length + * @return int + */ + public function getContentLength() + { + if (isset($this->env['CONTENT_LENGTH'])) { + return (int) $this->env['CONTENT_LENGTH']; + } else { + return 0; + } + } + + /** + * Get Host + * @return string + */ + public function getHost() + { + if (isset($this->env['HOST'])) { + if (strpos($this->env['HOST'], ':') !== false) { + $hostParts = explode(':', $this->env['HOST']); + + return $hostParts[0]; + } + + return $this->env['HOST']; + } else { + return $this->env['SERVER_NAME']; + } + } + + /** + * Get Host with Port + * @return string + */ + public function getHostWithPort() + { + return sprintf('%s:%s', $this->getHost(), $this->getPort()); + } + + /** + * Get Port + * @return int + */ + public function getPort() + { + return (int) $this->env['SERVER_PORT']; + } + + /** + * Get Scheme (https or http) + * @return string + */ + public function getScheme() + { + return $this->env['slim.url_scheme']; + } + + /** + * Get Script Name (physical path) + * @return string + */ + public function getScriptName() + { + return $this->env['SCRIPT_NAME']; + } + + /** + * LEGACY: Get Root URI (alias for Slim_Http_Request::getScriptName) + * @return string + */ + public function getRootUri() + { + return $this->getScriptName(); + } + + /** + * Get Path (physical path + virtual path) + * @return string + */ + public function getPath() + { + return $this->getScriptName() . $this->getPathInfo(); + } + + /** + * Get Path Info (virtual path) + * @return string + */ + public function getPathInfo() + { + return $this->env['PATH_INFO']; + } + + /** + * LEGACY: Get Resource URI (alias for Slim_Http_Request::getPathInfo) + * @return string + */ + public function getResourceUri() + { + return $this->getPathInfo(); + } + + /** + * Get URL (scheme + host [ + port if non-standard ]) + * @return string + */ + public function getUrl() + { + $url = $this->getScheme() . '://' . $this->getHost(); + if (($this->getScheme() === 'https' && $this->getPort() !== 443) || ($this->getScheme() === 'http' && $this->getPort() !== 80)) { + $url .= sprintf(':%s', $this->getPort()); + } + + return $url; + } + + /** + * Get IP + * @return string + */ + public function getIp() + { + if (isset($this->env['X_FORWARDED_FOR'])) { + return $this->env['X_FORWARDED_FOR']; + } elseif (isset($this->env['CLIENT_IP'])) { + return $this->env['CLIENT_IP']; + } + + return $this->env['REMOTE_ADDR']; + } + + /** + * Get Referrer + * @return string|null + */ + public function getReferrer() + { + if (isset($this->env['REFERER'])) { + return $this->env['REFERER']; + } else { + return null; + } + } + + /** + * Get Referer (for those who can't spell) + * @return string|null + */ + public function getReferer() + { + return $this->getReferrer(); + } + + /** + * Get User Agent + * @return string|null + */ + public function getUserAgent() + { + if (isset($this->env['USER_AGENT'])) { + return $this->env['USER_AGENT']; + } else { + return null; + } + } +} diff --git a/geoapi/Slim/Http/Response.php b/geoapi/Slim/Http/Response.php new file mode 100644 index 0000000..8e95b37 --- /dev/null +++ b/geoapi/Slim/Http/Response.php @@ -0,0 +1,459 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Http; + +/** + * Response + * + * This is a simple abstraction over top an HTTP response. This + * provides methods to set the HTTP status, the HTTP headers, + * and the HTTP body. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Response implements \ArrayAccess, \Countable, \IteratorAggregate +{ + /** + * @var int HTTP status code + */ + protected $status; + + /** + * @var \Slim\Http\Headers List of HTTP response headers + */ + protected $header; + + /** + * @var string HTTP response body + */ + protected $body; + + /** + * @var int Length of HTTP response body + */ + protected $length; + + /** + * @var array HTTP response codes and messages + */ + protected static $messages = array( + //Informational 1xx + 100 => '100 Continue', + 101 => '101 Switching Protocols', + //Successful 2xx + 200 => '200 OK', + 201 => '201 Created', + 202 => '202 Accepted', + 203 => '203 Non-Authoritative Information', + 204 => '204 No Content', + 205 => '205 Reset Content', + 206 => '206 Partial Content', + //Redirection 3xx + 300 => '300 Multiple Choices', + 301 => '301 Moved Permanently', + 302 => '302 Found', + 303 => '303 See Other', + 304 => '304 Not Modified', + 305 => '305 Use Proxy', + 306 => '306 (Unused)', + 307 => '307 Temporary Redirect', + //Client Error 4xx + 400 => '400 Bad Request', + 401 => '401 Unauthorized', + 402 => '402 Payment Required', + 403 => '403 Forbidden', + 404 => '404 Not Found', + 405 => '405 Method Not Allowed', + 406 => '406 Not Acceptable', + 407 => '407 Proxy Authentication Required', + 408 => '408 Request Timeout', + 409 => '409 Conflict', + 410 => '410 Gone', + 411 => '411 Length Required', + 412 => '412 Precondition Failed', + 413 => '413 Request Entity Too Large', + 414 => '414 Request-URI Too Long', + 415 => '415 Unsupported Media Type', + 416 => '416 Requested Range Not Satisfiable', + 417 => '417 Expectation Failed', + 422 => '422 Unprocessable Entity', + 423 => '423 Locked', + //Server Error 5xx + 500 => '500 Internal Server Error', + 501 => '501 Not Implemented', + 502 => '502 Bad Gateway', + 503 => '503 Service Unavailable', + 504 => '504 Gateway Timeout', + 505 => '505 HTTP Version Not Supported' + ); + + /** + * Constructor + * @param string $body The HTTP response body + * @param int $status The HTTP response status + * @param \Slim\Http\Headers|array $header The HTTP response headers + */ + public function __construct($body = '', $status = 200, $header = array()) + { + $this->status = (int) $status; + $headers = array(); + foreach ($header as $key => $value) { + $headers[$key] = $value; + } + $this->header = new Headers(array_merge(array('Content-Type' => 'text/html'), $headers)); + $this->body = ''; + $this->write($body); + } + + /** + * Get and set status + * @param int|null $status + * @return int + */ + public function status($status = null) + { + if (!is_null($status)) { + $this->status = (int) $status; + } + + return $this->status; + } + + /** + * Get and set header + * @param string $name Header name + * @param string|null $value Header value + * @return string Header value + */ + public function header($name, $value = null) + { + if (!is_null($value)) { + $this[$name] = $value; + } + + return $this[$name]; + } + + /** + * Get headers + * @return \Slim\Http\Headers + */ + public function headers() + { + return $this->header; + } + + /** + * Get and set body + * @param string|null $body Content of HTTP response body + * @return string + */ + public function body($body = null) + { + if (!is_null($body)) { + $this->write($body, true); + } + + return $this->body; + } + + /** + * Get and set length + * @param int|null $length + * @return int + */ + public function length($length = null) + { + if (!is_null($length)) { + $this->length = (int) $length; + } + + return $this->length; + } + + /** + * Append HTTP response body + * @param string $body Content to append to the current HTTP response body + * @param bool $replace Overwrite existing response body? + * @return string The updated HTTP response body + */ + public function write($body, $replace = false) + { + if ($replace) { + $this->body = $body; + } else { + $this->body .= (string) $body; + } + $this->length = strlen($this->body); + + return $this->body; + } + + /** + * Finalize + * + * This prepares this response and returns an array + * of [status, headers, body]. This array is passed to outer middleware + * if available or directly to the Slim run method. + * + * @return array[int status, array headers, string body] + */ + public function finalize() + { + if (in_array($this->status, array(204, 304))) { + unset($this['Content-Type'], $this['Content-Length']); + + return array($this->status, $this->header, ''); + } else { + return array($this->status, $this->header, $this->body); + } + } + + /** + * Set cookie + * + * Instead of using PHP's `setcookie()` function, Slim manually constructs the HTTP `Set-Cookie` + * header on its own and delegates this responsibility to the `Slim_Http_Util` class. This + * response's header is passed by reference to the utility class and is directly modified. By not + * relying on PHP's native implementation, Slim allows middleware the opportunity to massage or + * analyze the raw header before the response is ultimately delivered to the HTTP client. + * + * @param string $name The name of the cookie + * @param string|array $value If string, the value of cookie; if array, properties for + * cookie including: value, expire, path, domain, secure, httponly + */ + public function setCookie($name, $value) + { + Util::setCookieHeader($this->header, $name, $value); + } + + /** + * Delete cookie + * + * Instead of using PHP's `setcookie()` function, Slim manually constructs the HTTP `Set-Cookie` + * header on its own and delegates this responsibility to the `Slim_Http_Util` class. This + * response's header is passed by reference to the utility class and is directly modified. By not + * relying on PHP's native implementation, Slim allows middleware the opportunity to massage or + * analyze the raw header before the response is ultimately delivered to the HTTP client. + * + * This method will set a cookie with the given name that has an expiration time in the past; this will + * prompt the HTTP client to invalidate and remove the client-side cookie. Optionally, you may + * also pass a key/value array as the second argument. If the "domain" key is present in this + * array, only the Cookie with the given name AND domain will be removed. The invalidating cookie + * sent with this response will adopt all properties of the second argument. + * + * @param string $name The name of the cookie + * @param array $value Properties for cookie including: value, expire, path, domain, secure, httponly + */ + public function deleteCookie($name, $value = array()) + { + Util::deleteCookieHeader($this->header, $name, $value); + } + + /** + * Redirect + * + * This method prepares this response to return an HTTP Redirect response + * to the HTTP client. + * + * @param string $url The redirect destination + * @param int $status The redirect HTTP status code + */ + public function redirect ($url, $status = 302) + { + $this->status = $status; + $this['Location'] = $url; + } + + /** + * Helpers: Empty? + * @return bool + */ + public function isEmpty() + { + return in_array($this->status, array(201, 204, 304)); + } + + /** + * Helpers: Informational? + * @return bool + */ + public function isInformational() + { + return $this->status >= 100 && $this->status < 200; + } + + /** + * Helpers: OK? + * @return bool + */ + public function isOk() + { + return $this->status === 200; + } + + /** + * Helpers: Successful? + * @return bool + */ + public function isSuccessful() + { + return $this->status >= 200 && $this->status < 300; + } + + /** + * Helpers: Redirect? + * @return bool + */ + public function isRedirect() + { + return in_array($this->status, array(301, 302, 303, 307)); + } + + /** + * Helpers: Redirection? + * @return bool + */ + public function isRedirection() + { + return $this->status >= 300 && $this->status < 400; + } + + /** + * Helpers: Forbidden? + * @return bool + */ + public function isForbidden() + { + return $this->status === 403; + } + + /** + * Helpers: Not Found? + * @return bool + */ + public function isNotFound() + { + return $this->status === 404; + } + + /** + * Helpers: Client error? + * @return bool + */ + public function isClientError() + { + return $this->status >= 400 && $this->status < 500; + } + + /** + * Helpers: Server Error? + * @return bool + */ + public function isServerError() + { + return $this->status >= 500 && $this->status < 600; + } + + /** + * Array Access: Offset Exists + */ + public function offsetExists( $offset ) + { + return isset($this->header[$offset]); + } + + /** + * Array Access: Offset Get + */ + public function offsetGet( $offset ) + { + if (isset($this->header[$offset])) { + return $this->header[$offset]; + } else { + return null; + } + } + + /** + * Array Access: Offset Set + */ + public function offsetSet($offset, $value) + { + $this->header[$offset] = $value; + } + + /** + * Array Access: Offset Unset + */ + public function offsetUnset($offset) + { + unset($this->header[$offset]); + } + + /** + * Countable: Count + */ + public function count() + { + return count($this->header); + } + + /** + * Get Iterator + * + * This returns the contained `\Slim\Http\Headers` instance which + * is itself iterable. + * + * @return \Slim\Http\Headers + */ + public function getIterator() + { + return $this->header; + } + + /** + * Get message for HTTP status code + * @return string|null + */ + public static function getMessageForCode($status) + { + if (isset(self::$messages[$status])) { + return self::$messages[$status]; + } else { + return null; + } + } +} diff --git a/geoapi/Slim/Http/Util.php b/geoapi/Slim/Http/Util.php new file mode 100644 index 0000000..f7e99a9 --- /dev/null +++ b/geoapi/Slim/Http/Util.php @@ -0,0 +1,389 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Http; + +/** + * Slim HTTP Utilities + * + * This class provides useful methods for handling HTTP requests. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Util +{ + /** + * Strip slashes from string or array + * + * This method strips slashes from its input. By default, this method will only + * strip slashes from its input if magic quotes are enabled. Otherwise, you may + * override the magic quotes setting with either TRUE or FALSE as the send argument + * to force this method to strip or not strip slashes from its input. + * + * @var array|string $rawData + * @return array|string + */ + public static function stripSlashesIfMagicQuotes($rawData, $overrideStripSlashes = null) + { + $strip = is_null($overrideStripSlashes) ? get_magic_quotes_gpc() : $overrideStripSlashes; + if ($strip) { + return self::_stripSlashes($rawData); + } else { + return $rawData; + } + } + + /** + * Strip slashes from string or array + * @param array|string $rawData + * @return array|string + */ + protected static function _stripSlashes($rawData) + { + return is_array($rawData) ? array_map(array('self', '_stripSlashes'), $rawData) : stripslashes($rawData); + } + + /** + * Encrypt data + * + * This method will encrypt data using a given key, vector, and cipher. + * By default, this will encrypt data using the RIJNDAEL/AES 256 bit cipher. You + * may override the default cipher and cipher mode by passing your own desired + * cipher and cipher mode as the final key-value array argument. + * + * @param string $data The unencrypted data + * @param string $key The encryption key + * @param string $iv The encryption initialization vector + * @param array $settings Optional key-value array with custom algorithm and mode + * @return string + */ + public static function encrypt($data, $key, $iv, $settings = array()) + { + if ($data === '' || !extension_loaded('mcrypt')) { + return $data; + } + + //Merge settings with defaults + $settings = array_merge(array( + 'algorithm' => MCRYPT_RIJNDAEL_256, + 'mode' => MCRYPT_MODE_CBC + ), $settings); + + //Get module + $module = mcrypt_module_open($settings['algorithm'], '', $settings['mode'], ''); + + //Validate IV + $ivSize = mcrypt_enc_get_iv_size($module); + if (strlen($iv) > $ivSize) { + $iv = substr($iv, 0, $ivSize); + } + + //Validate key + $keySize = mcrypt_enc_get_key_size($module); + if (strlen($key) > $keySize) { + $key = substr($key, 0, $keySize); + } + + //Encrypt value + mcrypt_generic_init($module, $key, $iv); + $res = @mcrypt_generic($module, $data); + mcrypt_generic_deinit($module); + + return $res; + } + + /** + * Decrypt data + * + * This method will decrypt data using a given key, vector, and cipher. + * By default, this will decrypt data using the RIJNDAEL/AES 256 bit cipher. You + * may override the default cipher and cipher mode by passing your own desired + * cipher and cipher mode as the final key-value array argument. + * + * @param string $data The encrypted data + * @param string $key The encryption key + * @param string $iv The encryption initialization vector + * @param array $settings Optional key-value array with custom algorithm and mode + * @return string + */ + public static function decrypt($data, $key, $iv, $settings = array()) + { + if ($data === '' || !extension_loaded('mcrypt')) { + return $data; + } + + //Merge settings with defaults + $settings = array_merge(array( + 'algorithm' => MCRYPT_RIJNDAEL_256, + 'mode' => MCRYPT_MODE_CBC + ), $settings); + + //Get module + $module = mcrypt_module_open($settings['algorithm'], '', $settings['mode'], ''); + + //Validate IV + $ivSize = mcrypt_enc_get_iv_size($module); + if (strlen($iv) > $ivSize) { + $iv = substr($iv, 0, $ivSize); + } + + //Validate key + $keySize = mcrypt_enc_get_key_size($module); + if (strlen($key) > $keySize) { + $key = substr($key, 0, $keySize); + } + + //Decrypt value + mcrypt_generic_init($module, $key, $iv); + $decryptedData = @mdecrypt_generic($module, $data); + $res = str_replace("\x0", '', $decryptedData); + mcrypt_generic_deinit($module); + + return $res; + } + + /** + * Encode secure cookie value + * + * This method will create the secure value of an HTTP cookie. The + * cookie value is encrypted and hashed so that its value is + * secure and checked for integrity when read in subsequent requests. + * + * @param string $value The unsecure HTTP cookie value + * @param int $expires The UNIX timestamp at which this cookie will expire + * @param string $secret The secret key used to hash the cookie value + * @param int $algorithm The algorithm to use for encryption + * @param int $mode The algorithm mode to use for encryption + * @param string + */ + public static function encodeSecureCookie($value, $expires, $secret, $algorithm, $mode) + { + $key = hash_hmac('sha1', $expires, $secret); + $iv = self::get_iv($expires, $secret); + $secureString = base64_encode(self::encrypt($value, $key, $iv, array( + 'algorithm' => $algorithm, + 'mode' => $mode + ))); + $verificationString = hash_hmac('sha1', $expires . $value, $key); + + return implode('|', array($expires, $secureString, $verificationString)); + } + + /** + * Decode secure cookie value + * + * This method will decode the secure value of an HTTP cookie. The + * cookie value is encrypted and hashed so that its value is + * secure and checked for integrity when read in subsequent requests. + * + * @param string $value The secure HTTP cookie value + * @param int $expires The UNIX timestamp at which this cookie will expire + * @param string $secret The secret key used to hash the cookie value + * @param int $algorithm The algorithm to use for encryption + * @param int $mode The algorithm mode to use for encryption + * @param string + */ + public static function decodeSecureCookie($value, $secret, $algorithm, $mode) + { + if ($value) { + $value = explode('|', $value); + if (count($value) === 3 && ((int) $value[0] === 0 || (int) $value[0] > time())) { + $key = hash_hmac('sha1', $value[0], $secret); + $iv = self::get_iv($value[0], $secret); + $data = self::decrypt(base64_decode($value[1]), $key, $iv, array( + 'algorithm' => $algorithm, + 'mode' => $mode + )); + $verificationString = hash_hmac('sha1', $value[0] . $data, $key); + if ($verificationString === $value[2]) { + return $data; + } + } + } + + return false; + } + + /** + * Set HTTP cookie header + * + * This method will construct and set the HTTP `Set-Cookie` header. Slim + * uses this method instead of PHP's native `setcookie` method. This allows + * more control of the HTTP header irrespective of the native implementation's + * dependency on PHP versions. + * + * This method accepts the Slim_Http_Headers object by reference as its + * first argument; this method directly modifies this object instead of + * returning a value. + * + * @param array $header + * @param string $name + * @param string $value + */ + public static function setCookieHeader(&$header, $name, $value) + { + //Build cookie header + if (is_array($value)) { + $domain = ''; + $path = ''; + $expires = ''; + $secure = ''; + $httponly = ''; + if (isset($value['domain']) && $value['domain']) { + $domain = '; domain=' . $value['domain']; + } + if (isset($value['path']) && $value['path']) { + $path = '; path=' . $value['path']; + } + if (isset($value['expires'])) { + if (is_string($value['expires'])) { + $timestamp = strtotime($value['expires']); + } else { + $timestamp = (int) $value['expires']; + } + if ($timestamp !== 0) { + $expires = '; expires=' . gmdate('D, d-M-Y H:i:s e', $timestamp); + } + } + if (isset($value['secure']) && $value['secure']) { + $secure = '; secure'; + } + if (isset($value['httponly']) && $value['httponly']) { + $httponly = '; HttpOnly'; + } + $cookie = sprintf('%s=%s%s', urlencode($name), urlencode((string) $value['value']), $domain . $path . $expires . $secure . $httponly); + } else { + $cookie = sprintf('%s=%s', urlencode($name), urlencode((string) $value)); + } + + //Set cookie header + if (!isset($header['Set-Cookie']) || $header['Set-Cookie'] === '') { + $header['Set-Cookie'] = $cookie; + } else { + $header['Set-Cookie'] = implode("\n", array($header['Set-Cookie'], $cookie)); + } + } + + /** + * Delete HTTP cookie header + * + * This method will construct and set the HTTP `Set-Cookie` header to invalidate + * a client-side HTTP cookie. If a cookie with the same name (and, optionally, domain) + * is already set in the HTTP response, it will also be removed. Slim uses this method + * instead of PHP's native `setcookie` method. This allows more control of the HTTP header + * irrespective of PHP's native implementation's dependency on PHP versions. + * + * This method accepts the Slim_Http_Headers object by reference as its + * first argument; this method directly modifies this object instead of + * returning a value. + * + * @param array $header + * @param string $name + * @param string $value + */ + public static function deleteCookieHeader(&$header, $name, $value = array()) + { + //Remove affected cookies from current response header + $cookiesOld = array(); + $cookiesNew = array(); + if (isset($header['Set-Cookie'])) { + $cookiesOld = explode("\n", $header['Set-Cookie']); + } + foreach ($cookiesOld as $c) { + if (isset($value['domain']) && $value['domain']) { + $regex = sprintf('@%s=.*domain=%s@', urlencode($name), preg_quote($value['domain'])); + } else { + $regex = sprintf('@%s=@', urlencode($name)); + } + if (preg_match($regex, $c) === 0) { + $cookiesNew[] = $c; + } + } + if ($cookiesNew) { + $header['Set-Cookie'] = implode("\n", $cookiesNew); + } else { + unset($header['Set-Cookie']); + } + + //Set invalidating cookie to clear client-side cookie + self::setCookieHeader($header, $name, array_merge(array('value' => '', 'path' => null, 'domain' => null, 'expires' => time() - 100), $value)); + } + + /** + * Parse cookie header + * + * This method will parse the HTTP requst's `Cookie` header + * and extract cookies into an associative array. + * + * @param string + * @return array + */ + public static function parseCookieHeader($header) + { + $cookies = array(); + $header = rtrim($header, "\r\n"); + $headerPieces = preg_split('@\s*[;,]\s*@', $header); + foreach ($headerPieces as $c) { + $cParts = explode('=', $c); + if (count($cParts) === 2) { + $key = urldecode($cParts[0]); + $value = urldecode($cParts[1]); + if (!isset($cookies[$key])) { + $cookies[$key] = $value; + } + } + } + + return $cookies; + } + + /** + * Generate a random IV + * + * This method will generate a non-predictable IV for use with + * the cookie encryption + * + * @param int $expires The UNIX timestamp at which this cookie will expire + * @param string $secret The secret key used to hash the cookie value + * @return binary string with length 40 + */ + private static function get_iv($expires, $secret) + { + $data1 = hash_hmac('sha1', 'a'.$expires.'b', $secret); + $data2 = hash_hmac('sha1', 'z'.$expires.'y', $secret); + + return pack("h*", $data1.$data2); + } + +} diff --git a/geoapi/Slim/Log.php b/geoapi/Slim/Log.php new file mode 100644 index 0000000..7706b2f --- /dev/null +++ b/geoapi/Slim/Log.php @@ -0,0 +1,237 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Log + * + * This is the primary logger for a Slim application. You may provide + * a Log Writer in conjunction with this Log to write to various output + * destinations (e.g. a file). This class provides this interface: + * + * debug( mixed $object ) + * info( mixed $object ) + * warn( mixed $object ) + * error( mixed $object ) + * fatal( mixed $object ) + * + * This class assumes only that your Log Writer has a public `write()` method + * that accepts any object as its one and only argument. The Log Writer + * class may write or send its argument anywhere: a file, STDERR, + * a remote web API, etc. The possibilities are endless. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Log +{ + const FATAL = 0; + const ERROR = 1; + const WARN = 2; + const INFO = 3; + const DEBUG = 4; + + /** + * @var array + */ + protected static $levels = array( + self::FATAL => 'FATAL', + self::ERROR => 'ERROR', + self::WARN => 'WARN', + self::INFO => 'INFO', + self::DEBUG => 'DEBUG' + ); + + /** + * @var mixed + */ + protected $writer; + + /** + * @var bool + */ + protected $enabled; + + /** + * @var int + */ + protected $level; + + /** + * Constructor + * @param mixed $writer + */ + public function __construct($writer) + { + $this->writer = $writer; + $this->enabled = true; + $this->level = self::DEBUG; + } + + /** + * Is logging enabled? + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Enable or disable logging + * @param bool $enabled + */ + public function setEnabled($enabled) + { + if ($enabled) { + $this->enabled = true; + } else { + $this->enabled = false; + } + } + + /** + * Set level + * @param int $level + * @throws \InvalidArgumentException If invalid log level specified + */ + public function setLevel($level) + { + if (!isset(self::$levels[$level])) { + throw new \InvalidArgumentException('Invalid log level'); + } + $this->level = $level; + } + + /** + * Get level + * @return int + */ + public function getLevel() + { + return $this->level; + } + + /** + * Set writer + * @param mixed $writer + */ + public function setWriter($writer) + { + $this->writer = $writer; + } + + /** + * Get writer + * @return mixed + */ + public function getWriter() + { + return $this->writer; + } + + /** + * Is logging enabled? + * @return bool + */ + public function isEnabled() + { + return $this->enabled; + } + + /** + * Log debug message + * @param mixed $object + * @return mixed|false What the Logger returns, or false if Logger not set or not enabled + */ + public function debug($object) + { + return $this->write($object, self::DEBUG); + } + + /** + * Log info message + * @param mixed $object + * @return mixed|false What the Logger returns, or false if Logger not set or not enabled + */ + public function info($object) + { + return $this->write($object, self::INFO); + } + + /** + * Log warn message + * @param mixed $object + * @return mixed|false What the Logger returns, or false if Logger not set or not enabled + */ + public function warn($object) + { + return $this->write($object, self::WARN); + } + + /** + * Log error message + * @param mixed $object + * @return mixed|false What the Logger returns, or false if Logger not set or not enabled + */ + public function error($object) + { + return $this->write($object, self::ERROR); + } + + /** + * Log fatal message + * @param mixed $object + * @return mixed|false What the Logger returns, or false if Logger not set or not enabled + */ + public function fatal($object) + { + return $this->write($object, self::FATAL); + } + + /** + * Log message + * @param mixed The object to log + * @param int The message level + * @return int|false + */ + protected function write($object, $level) + { + if ($this->enabled && $this->writer && $level <= $this->level) { + return $this->writer->write($object, $level); + } else { + return false; + } + } +} diff --git a/geoapi/Slim/LogWriter.php b/geoapi/Slim/LogWriter.php new file mode 100644 index 0000000..f26eb0f --- /dev/null +++ b/geoapi/Slim/LogWriter.php @@ -0,0 +1,75 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Log Writer + * + * This class is used by Slim_Log to write log messages to a valid, writable + * resource handle (e.g. a file or STDERR). + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class LogWriter +{ + /** + * @var resource + */ + protected $resource; + + /** + * Constructor + * @param resource $resource + * @throws \InvalidArgumentException If invalid resource + */ + public function __construct($resource) + { + if (!is_resource($resource)) { + throw new \InvalidArgumentException('Cannot create LogWriter. Invalid resource handle.'); + } + $this->resource = $resource; + } + + /** + * Write message + * @param mixed $message + * @param int $level + * @return int|false + */ + public function write($message, $level = null) + { + return fwrite($this->resource, (string) $message . PHP_EOL); + } +} diff --git a/geoapi/Slim/Middleware.php b/geoapi/Slim/Middleware.php new file mode 100644 index 0000000..641226a --- /dev/null +++ b/geoapi/Slim/Middleware.php @@ -0,0 +1,114 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Middleware + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +abstract class Middleware +{ + /** + * @var \Slim Reference to the primary application instance + */ + protected $app; + + /** + * @var mixed Reference to the next downstream middleware + */ + protected $next; + + /** + * Set application + * + * This method injects the primary Slim application instance into + * this middleware. + * + * @param \Slim $application + */ + final public function setApplication($application) + { + $this->app = $application; + } + + /** + * Get application + * + * This method retrieves the application previously injected + * into this middleware. + * + * @return \Slim + */ + final public function getApplication() + { + return $this->app; + } + + /** + * Set next middleware + * + * This method injects the next downstream middleware into + * this middleware so that it may optionally be called + * when appropriate. + * + * @param \Slim|\Slim\Middleware + */ + final public function setNextMiddleware($nextMiddleware) + { + $this->next = $nextMiddleware; + } + + /** + * Get next middleware + * + * This method retrieves the next downstream middleware + * previously injected into this middleware. + * + * @return \Slim|\Slim\Middleware + */ + final public function getNextMiddleware() + { + return $this->next; + } + + /** + * Call + * + * Perform actions specific to this middleware and optionally + * call the next downstream middleware. + */ + abstract public function call(); +} diff --git a/geoapi/Slim/Middleware/ContentTypes.php b/geoapi/Slim/Middleware/ContentTypes.php new file mode 100644 index 0000000..b11e460 --- /dev/null +++ b/geoapi/Slim/Middleware/ContentTypes.php @@ -0,0 +1,170 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Middleware; + + /** + * Content Types + * + * This is middleware for a Slim application that intercepts + * the HTTP request body and parses it into the appropriate + * PHP data structure if possible; else it returns the HTTP + * request body unchanged. This is particularly useful + * for preparing the HTTP request body for an XML or JSON API. + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class ContentTypes extends \Slim\Middleware +{ + /** + * @var array + */ + protected $contentTypes; + + /** + * Constructor + * @param array $settings + */ + public function __construct($settings = array()) + { + $this->contentTypes = array_merge(array( + 'application/json' => array($this, 'parseJson'), + 'application/xml' => array($this, 'parseXml'), + 'text/xml' => array($this, 'parseXml'), + 'text/csv' => array($this, 'parseCsv') + ), $settings); + } + + /** + * Call + */ + public function call() + { + $mediaType = $this->app->request()->getMediaType(); + if ($mediaType) { + $env = $this->app->environment(); + $env['slim.input_original'] = $env['slim.input']; + $env['slim.input'] = $this->parse($env['slim.input'], $mediaType); + } + $this->next->call(); + } + + /** + * Parse input + * + * This method will attempt to parse the request body + * based on its content type if available. + * + * @param string $input + * @param string $contentType + * @return mixed + */ + protected function parse ($input, $contentType) + { + if (isset($this->contentTypes[$contentType]) && is_callable($this->contentTypes[$contentType])) { + $result = call_user_func($this->contentTypes[$contentType], $input); + if ($result) { + return $result; + } + } + + return $input; + } + + /** + * Parse JSON + * + * This method converts the raw JSON input + * into an associative array. + * + * @param string $input + * @return array|string + */ + protected function parseJson($input) + { + if (function_exists('json_decode')) { + $result = json_decode($input, true); + if ($result) { + return $result; + } + } + } + + /** + * Parse XML + * + * This method creates a SimpleXMLElement + * based upon the XML input. If the SimpleXML + * extension is not available, the raw input + * will be returned unchanged. + * + * @param string $input + * @return \SimpleXMLElement|string + */ + protected function parseXml($input) + { + if (class_exists('SimpleXMLElement')) { + try { + return new \SimpleXMLElement($input); + } catch (\Exception $e) { + // Do nothing + } + } + + return $input; + } + + /** + * Parse CSV + * + * This method parses CSV content into a numeric array + * containing an array of data for each CSV line. + * + * @param string $input + * @return array + */ + protected function parseCsv($input) + { + $temp = fopen('php://memory', 'rw'); + fwrite($temp, $input); + fseek($temp, 0); + $res = array(); + while (($data = fgetcsv($temp)) !== false) { + $res[] = $data; + } + fclose($temp); + + return $res; + } +} diff --git a/geoapi/Slim/Middleware/Flash.php b/geoapi/Slim/Middleware/Flash.php new file mode 100644 index 0000000..510bca3 --- /dev/null +++ b/geoapi/Slim/Middleware/Flash.php @@ -0,0 +1,202 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Middleware; + + /** + * Flash + * + * This is middleware for a Slim application that enables + * Flash messaging between HTTP requests. This allows you + * set Flash messages for the current request, for the next request, + * or to retain messages from the previous request through to + * the next request. + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class Flash extends \Slim\Middleware implements \ArrayAccess, \IteratorAggregate +{ + /** + * @var array + */ + protected $settings; + + /** + * @var array + */ + protected $messages; + + /** + * Constructor + * @param \Slim $app + * @param array $settings + */ + public function __construct($settings = array()) + { + $this->settings = array_merge(array('key' => 'slim.flash'), $settings); + $this->messages = array( + 'prev' => array(), //flash messages from prev request (loaded when middleware called) + 'next' => array(), //flash messages for next request + 'now' => array() //flash messages for current request + ); + } + + /** + * Call + */ + public function call() + { + //Read flash messaging from previous request if available + $this->loadMessages(); + + //Prepare flash messaging for current request + $env = $this->app->environment(); + $env['slim.flash'] = $this; + $this->next->call(); + $this->save(); + } + + /** + * Now + * + * Specify a flash message for a given key to be shown for the current request + * + * @param string $key + * @param string $value + */ + public function now($key, $value) + { + $this->messages['now'][(string) $key] = $value; + } + + /** + * Set + * + * Specify a flash message for a given key to be shown for the next request + * + * @param string $key + * @param string $value + */ + public function set($key, $value) + { + $this->messages['next'][(string) $key] = $value; + } + + /** + * Keep + * + * Retain flash messages from the previous request for the next request + */ + public function keep() + { + foreach ($this->messages['prev'] as $key => $val) { + $this->messages['next'][$key] = $val; + } + } + + /** + * Save + */ + public function save() + { + $_SESSION[$this->settings['key']] = $this->messages['next']; + } + + /** + * Load messages from previous request if available + */ + public function loadMessages() + { + if (isset($_SESSION[$this->settings['key']])) { + $this->messages['prev'] = $_SESSION[$this->settings['key']]; + } + } + + /** + * Return array of flash messages to be shown for the current request + * + * @return array + */ + public function getMessages() + { + return array_merge($this->messages['prev'], $this->messages['now']); + } + + /** + * Array Access: Offset Exists + */ + public function offsetExists($offset) + { + $messages = $this->getMessages(); + + return isset($messages[$offset]); + } + + /** + * Array Access: Offset Get + */ + public function offsetGet($offset) + { + $messages = $this->getMessages(); + + return isset($messages[$offset]) ? $messages[$offset] : null; + } + + /** + * Array Access: Offset Set + */ + public function offsetSet($offset, $value) + { + $this->now($offset, $value); + } + + /** + * Array Access: Offset Unset + */ + public function offsetUnset($offset) + { + unset($this->messages['prev'][$offset], $this->messages['now'][$offset]); + } + + /** + * Iterator Aggregate: Get Iterator + * @return \ArrayIterator + */ + public function getIterator() + { + $messages = $this->getMessages(); + + return new \ArrayIterator($messages); + } +} diff --git a/geoapi/Slim/Middleware/MethodOverride.php b/geoapi/Slim/Middleware/MethodOverride.php new file mode 100644 index 0000000..6f5fffb --- /dev/null +++ b/geoapi/Slim/Middleware/MethodOverride.php @@ -0,0 +1,96 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Middleware; + + /** + * HTTP Method Override + * + * This is middleware for a Slim application that allows traditional + * desktop browsers to submit psuedo PUT and DELETE requests by relying + * on a pre-determined request parameter. Without this middleware, + * desktop browsers are only able to submit GET and POST requests. + * + * This middleware is included automatically! + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class MethodOverride extends \Slim\Middleware +{ + /** + * @var array + */ + protected $settings; + + /** + * Constructor + * @param \Slim $app + * @param array $settings + */ + public function __construct($settings = array()) + { + $this->settings = array_merge(array('key' => '_METHOD'), $settings); + } + + /** + * Call + * + * Implements Slim middleware interface. This method is invoked and passed + * an array of environment variables. This middleware inspects the environment + * variables for the HTTP method override parameter; if found, this middleware + * modifies the environment settings so downstream middleware and/or the Slim + * application will treat the request with the desired HTTP method. + * + * @param array $env + * @return array[status, header, body] + */ + public function call() + { + $env = $this->app->environment(); + if (isset($env['X_HTTP_METHOD_OVERRIDE'])) { + // Header commonly used by Backbone.js and others + $env['slim.method_override.original_method'] = $env['REQUEST_METHOD']; + $env['REQUEST_METHOD'] = strtoupper($env['X_HTTP_METHOD_OVERRIDE']); + } elseif (isset($env['REQUEST_METHOD']) && $env['REQUEST_METHOD'] === 'POST') { + // HTML Form Override + $req = new \Slim\Http\Request($env); + $method = $req->post($this->settings['key']); + if ($method) { + $env['slim.method_override.original_method'] = $env['REQUEST_METHOD']; + $env['REQUEST_METHOD'] = strtoupper($method); + } + } + $this->next->call(); + } +} diff --git a/geoapi/Slim/Middleware/PrettyExceptions.php b/geoapi/Slim/Middleware/PrettyExceptions.php new file mode 100644 index 0000000..e079e30 --- /dev/null +++ b/geoapi/Slim/Middleware/PrettyExceptions.php @@ -0,0 +1,114 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Middleware; + +/** + * Pretty Exceptions + * + * This middleware catches any Exception thrown by the surrounded + * application and displays a developer-friendly diagnostic screen. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class PrettyExceptions extends \Slim\Middleware +{ + /** + * @var array + */ + protected $settings; + + /** + * Constructor + * @param array $settings + */ + public function __construct($settings = array()) + { + $this->settings = $settings; + } + + /** + * Call + */ + public function call() + { + try { + $this->next->call(); + } catch (\Exception $e) { + $env = $this->app->environment(); + $env['slim.log']->error($e); + $this->app->contentType('text/html'); + $this->app->response()->status(500); + $this->app->response()->body($this->renderBody($env, $e)); + } + } + + /** + * Render response body + * @param array $env + * @param \Exception $exception + * @return string + */ + protected function renderBody(&$env, $exception) + { + $title = 'Slim Application Error'; + $code = $exception->getCode(); + $message = $exception->getMessage(); + $file = $exception->getFile(); + $line = $exception->getLine(); + $trace = $exception->getTraceAsString(); + $html = sprintf('

%s

', $title); + $html .= '

The application could not run because of the following error:

'; + $html .= '

Details

'; + $html .= sprintf('
Type: %s
', get_class($exception)); + if ($code) { + $html .= sprintf('
Code: %s
', $code); + } + if ($message) { + $html .= sprintf('
Message: %s
', $message); + } + if ($file) { + $html .= sprintf('
File: %s
', $file); + } + if ($line) { + $html .= sprintf('
Line: %s
', $line); + } + if ($trace) { + $html .= '

Trace

'; + $html .= sprintf('
%s
', $trace); + } + + return sprintf("%s%s", $title, $html); + } +} diff --git a/geoapi/Slim/Middleware/SessionCookie.php b/geoapi/Slim/Middleware/SessionCookie.php new file mode 100644 index 0000000..1747a86 --- /dev/null +++ b/geoapi/Slim/Middleware/SessionCookie.php @@ -0,0 +1,203 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim\Middleware; + +/** + * Session Cookie + * + * This class provides an HTTP cookie storage mechanism + * for session data. This class avoids using a PHP session + * and instead serializes/unserializes the $_SESSION global + * variable to/from an HTTP cookie. + * + * If a secret key is provided with this middleware, the HTTP + * cookie will be checked for integrity to ensure the client-side + * cookie is not changed. + * + * You should NEVER store sensitive data in a client-side cookie + * in any format, encrypted or not. If you need to store sensitive + * user information in a session, you should rely on PHP's native + * session implementation, or use other middleware to store + * session data in a database or alternative server-side cache. + * + * Because this class stores serialized session data in an HTTP cookie, + * you are inherently limtied to 4 Kb. If you attempt to store + * more than this amount, serialization will fail. + * + * @package Slim + * @author Josh Lockhart + * @since 1.6.0 + */ +class SessionCookie extends \Slim\Middleware +{ + /** + * @var array + */ + protected $settings; + + /** + * Constructor + * + * @param array $settings + */ + public function __construct($settings = array()) + { + $this->settings = array_merge(array( + 'expires' => '20 minutes', + 'path' => '/', + 'domain' => null, + 'secure' => false, + 'httponly' => false, + 'name' => 'slim_session', + 'secret' => 'CHANGE_ME', + 'cipher' => MCRYPT_RIJNDAEL_256, + 'cipher_mode' => MCRYPT_MODE_CBC + ), $settings); + if (is_string($this->settings['expires'])) { + $this->settings['expires'] = strtotime($this->settings['expires']); + } + + /** + * Session + * + * We must start a native PHP session to initialize the $_SESSION superglobal. + * However, we won't be using the native session store for persistence, so we + * disable the session cookie and cache limiter. We also set the session + * handler to this class instance to avoid PHP's native session file locking. + */ + ini_set('session.use_cookies', 0); + session_cache_limiter(false); + session_set_save_handler( + array($this, 'open'), + array($this, 'close'), + array($this, 'read'), + array($this, 'write'), + array($this, 'destroy'), + array($this, 'gc') + ); + } + + /** + * Call + */ + public function call() + { + $this->loadSession(); + $this->next->call(); + $this->saveSession(); + } + + /** + * Load session + * @param array $env + */ + protected function loadSession() + { + if (session_id() === '') { + session_start(); + } + + $value = \Slim\Http\Util::decodeSecureCookie( + $this->app->request()->cookies($this->settings['name']), + $this->settings['secret'], + $this->settings['cipher'], + $this->settings['cipher_mode'] + ); + if ($value) { + $_SESSION = unserialize($value); + } else { + $_SESSION = array(); + } + } + + /** + * Save session + */ + protected function saveSession() + { + $value = \Slim\Http\Util::encodeSecureCookie( + serialize($_SESSION), + $this->settings['expires'], + $this->settings['secret'], + $this->settings['cipher'], + $this->settings['cipher_mode'] + ); + if (strlen($value) > 4096) { + $this->app->getLog()->error('WARNING! Slim\Middleware\SessionCookie data size is larger than 4KB. Content save failed.'); + } else { + $this->app->response()->setCookie($this->settings['name'], array( + 'value' => $value, + 'domain' => $this->settings['domain'], + 'path' => $this->settings['path'], + 'expires' => $this->settings['expires'], + 'secure' => $this->settings['secure'], + 'httponly' => $this->settings['httponly'] + )); + } + session_destroy(); + } + + /******************************************************************************** + * Session Handler + *******************************************************************************/ + + public function open($savePath, $sessionName) + { + return true; + } + + public function close() + { + return true; + } + + public function read($id) + { + return ''; + } + + public function write($id, $data) + { + return true; + } + + public function destroy($id) + { + return true; + } + + public function gc($maxlifetime) + { + return true; + } +} diff --git a/geoapi/Slim/Route.php b/geoapi/Slim/Route.php new file mode 100644 index 0000000..445fbe9 --- /dev/null +++ b/geoapi/Slim/Route.php @@ -0,0 +1,416 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.0.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Route + * @package Slim + * @author Josh Lockhart, Thomas Bley + * @since 1.0.0 + */ +class Route +{ + /** + * @var string The route pattern (e.g. "/books/:id") + */ + protected $pattern; + + /** + * @var mixed The route callable + */ + protected $callable; + + /** + * @var array Conditions for this route's URL parameters + */ + protected $conditions = array(); + + /** + * @var array Default conditions applied to all route instances + */ + protected static $defaultConditions = array(); + + /** + * @var string The name of this route (optional) + */ + protected $name; + + /** + * @var array Key-value array of URL parameters + */ + protected $params = array(); + + /** + * @var array value array of URL parameter names + */ + protected $paramNames = array(); + + /** + * @var array key array of URL parameter names with + at the end + */ + protected $paramNamesPath = array(); + + /** + * @var array HTTP methods supported by this Route + */ + protected $methods = array(); + + /** + * @var array[Callable] Middleware to be run before only this route instance + */ + protected $middleware = array(); + + /** + * Constructor + * @param string $pattern The URL pattern (e.g. "/books/:id") + * @param mixed $callable Anything that returns TRUE for is_callable() + */ + public function __construct($pattern, $callable) + { + $this->setPattern($pattern); + $this->setCallable($callable); + $this->setConditions(self::getDefaultConditions()); + } + + /** + * Set default route conditions for all instances + * @param array $defaultConditions + */ + public static function setDefaultConditions(array $defaultConditions) + { + self::$defaultConditions = $defaultConditions; + } + + /** + * Get default route conditions for all instances + * @return array + */ + public static function getDefaultConditions() + { + return self::$defaultConditions; + } + + /** + * Get route pattern + * @return string + */ + public function getPattern() + { + return $this->pattern; + } + + /** + * Set route pattern + * @param string $pattern + */ + public function setPattern($pattern) + { + $this->pattern = $pattern; + } + + /** + * Get route callable + * @return mixed + */ + public function getCallable() + { + return $this->callable; + } + + /** + * Set route callable + * @param mixed $callable + * @throws \InvalidArgumentException If argument is not callable + */ + public function setCallable($callable) + { + if (!is_callable($callable)) { + throw new \InvalidArgumentException('Route callable must be callable'); + } + + $this->callable = $callable; + } + + /** + * Get route conditions + * @return array + */ + public function getConditions() + { + return $this->conditions; + } + + /** + * Set route conditions + * @param array $conditions + */ + public function setConditions(array $conditions) + { + $this->conditions = $conditions; + } + + /** + * Get route name + * @return string|null + */ + public function getName() + { + return $this->name; + } + + /** + * Set route name + * @param string $name + */ + public function setName($name) + { + $this->name = (string) $name; + } + + /** + * Get route parameters + * @return array + */ + public function getParams() + { + return $this->params; + } + + /** + * Set route parameters + * @param array $params + */ + public function setParams($params) + { + $this->params = $params; + } + + /** + * Get route parameter value + * @param string $index Name of URL parameter + * @return string + * @throws \InvalidArgumentException If route parameter does not exist at index + */ + public function getParam($index) + { + if (!isset($this->params[$index])) { + throw new \InvalidArgumentException('Route parameter does not exist at specified index'); + } + + return $this->params[$index]; + } + + /** + * Set route parameter value + * @param string $index Name of URL parameter + * @param mixed $value The new parameter value + * @throws \InvalidArgumentException If route parameter does not exist at index + */ + public function setParam($index, $value) + { + if (!isset($this->params[$index])) { + throw new \InvalidArgumentException('Route parameter does not exist at specified index'); + } + $this->params[$index] = $value; + } + + /** + * Add supported HTTP method(s) + */ + public function setHttpMethods() + { + $args = func_get_args(); + $this->methods = $args; + } + + /** + * Get supported HTTP methods + * @return array + */ + public function getHttpMethods() + { + return $this->methods; + } + + /** + * Append supported HTTP methods + */ + public function appendHttpMethods() + { + $args = func_get_args(); + $this->methods = array_merge($this->methods, $args); + } + + /** + * Append supported HTTP methods (alias for Route::appendHttpMethods) + * @return \Slim\Route + */ + public function via() + { + $args = func_get_args(); + $this->methods = array_merge($this->methods, $args); + + return $this; + } + + /** + * Detect support for an HTTP method + * @return bool + */ + public function supportsHttpMethod($method) + { + return in_array($method, $this->methods); + } + + /** + * Get middleware + * @return array[Callable] + */ + public function getMiddleware() + { + return $this->middleware; + } + + /** + * Set middleware + * + * This method allows middleware to be assigned to a specific Route. + * If the method argument `is_callable` (including callable arrays!), + * we directly append the argument to `$this->middleware`. Else, we + * assume the argument is an array of callables and merge the array + * with `$this->middleware`. Each middleware is checked for is_callable() + * and an InvalidArgumentException is thrown immediately if it isn't. + * + * @param Callable|array[Callable] + * @return \Slim\Route + * @throws \InvalidArgumentException If argument is not callable or not an array of callables. + */ + public function setMiddleware($middleware) + { + if (is_callable($middleware)) { + $this->middleware[] = $middleware; + } elseif (is_array($middleware)) { + foreach($middleware as $callable) { + if (!is_callable($callable)) { + throw new \InvalidArgumentException('All Route middleware must be callable'); + } + } + $this->middleware = array_merge($this->middleware, $middleware); + } else { + throw new \InvalidArgumentException('Route middleware must be callable or an array of callables'); + } + + return $this; + } + + /** + * Matches URI? + * + * Parse this route's pattern, and then compare it to an HTTP resource URI + * This method was modeled after the techniques demonstrated by Dan Sosedoff at: + * + * http://blog.sosedoff.com/2009/09/20/rails-like-php-url-router/ + * + * @param string $resourceUri A Request URI + * @return bool + */ + public function matches($resourceUri) + { + //Convert URL params into regex patterns, construct a regex for this route, init params + $patternAsRegex = preg_replace_callback('#:([\w]+)\+?#', array($this, 'matchesCallback'), + str_replace(')', ')?', (string) $this->pattern)); + if (substr($this->pattern, -1) === '/') { + $patternAsRegex .= '?'; + } + + //Cache URL params' names and values if this route matches the current HTTP request + if (!preg_match('#^' . $patternAsRegex . '$#', $resourceUri, $paramValues)) { + return false; + } + foreach ($this->paramNames as $name) { + if (isset($paramValues[$name])) { + if (isset($this->paramNamesPath[ $name ])) { + $this->params[$name] = explode('/', urldecode($paramValues[$name])); + } else { + $this->params[$name] = urldecode($paramValues[$name]); + } + } + } + + return true; + } + + /** + * Convert a URL parameter (e.g. ":id", ":id+") into a regular expression + * @param array URL parameters + * @return string Regular expression for URL parameter + */ + protected function matchesCallback($m) + { + $this->paramNames[] = $m[1]; + if (isset($this->conditions[ $m[1] ])) { + return '(?P<' . $m[1] . '>' . $this->conditions[ $m[1] ] . ')'; + } + if (substr($m[0], -1) === '+') { + $this->paramNamesPath[ $m[1] ] = 1; + + return '(?P<' . $m[1] . '>.+)'; + } + + return '(?P<' . $m[1] . '>[^/]+)'; + } + + /** + * Set route name + * @param string $name The name of the route + * @return \Slim\Route + */ + public function name($name) + { + $this->setName($name); + + return $this; + } + + /** + * Merge route conditions + * @param array $conditions Key-value array of URL parameter conditions + * @return \Slim\Route + */ + public function conditions(array $conditions) + { + $this->conditions = array_merge($this->conditions, $conditions); + + return $this; + } +} diff --git a/geoapi/Slim/Router.php b/geoapi/Slim/Router.php new file mode 100644 index 0000000..44979ea --- /dev/null +++ b/geoapi/Slim/Router.php @@ -0,0 +1,235 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * Router + * + * This class organizes, iterates, and dispatches \Slim\Route objects. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Router +{ + /** + * @var Route The current route (most recently dispatched) + */ + protected $currentRoute; + + /** + * @var array Lookup hash of all route objects + */ + protected $routes; + + /** + * @var array Lookup hash of named route objects, keyed by route name (lazy-loaded) + */ + protected $namedRoutes; + + /** + * @var array Array of route objects that match the request URI (lazy-loaded) + */ + protected $matchedRoutes; + + /** + * Constructor + */ + public function __construct() + { + $this->routes = array(); + } + + /** + * Get Current Route object or the first matched one if matching has been performed + * @return \Slim\Route|null + */ + public function getCurrentRoute() + { + if ($this->currentRoute !== null) { + return $this->currentRoute; + } + + if (is_array($this->matchedRoutes) && count($this->matchedRoutes) > 0) { + return $this->matchedRoutes[0]; + } + + return null; + } + + /** + * Return route objects that match the given HTTP method and URI + * @param string $httpMethod The HTTP method to match against + * @param string $resourceUri The resource URI to match against + * @param bool $reload Should matching routes be re-parsed? + * @return array[\Slim\Route] + */ + public function getMatchedRoutes($httpMethod, $resourceUri, $reload = false) + { + if ($reload || is_null($this->matchedRoutes)) { + $this->matchedRoutes = array(); + foreach ($this->routes as $route) { + if (!$route->supportsHttpMethod($httpMethod)) { + continue; + } + + if ($route->matches($resourceUri)) { + $this->matchedRoutes[] = $route; + } + } + } + + return $this->matchedRoutes; + } + + /** + * Map a route object to a callback function + * @param string $pattern The URL pattern (ie. "/books/:id") + * @param mixed $callable Anything that returns TRUE for is_callable() + * @return \Slim\Route + */ + public function map($pattern, $callable) + { + $route = new \Slim\Route($pattern, $callable); + $this->routes[] = $route; + + return $route; + } + + /** + * Get URL for named route + * @param string $name The name of the route + * @param array Associative array of URL parameter names and replacement values + * @throws RuntimeException If named route not found + * @return string The URL for the given route populated with provided replacement values + */ + public function urlFor($name, $params = array()) + { + if (!$this->hasNamedRoute($name)) { + throw new \RuntimeException('Named route not found for name: ' . $name); + } + $search = array(); + foreach (array_keys($params) as $key) { + $search[] = '#:' . $key . '\+?(?!\w)#'; + } + $pattern = preg_replace($search, $params, $this->getNamedRoute($name)->getPattern()); + + //Remove remnants of unpopulated, trailing optional pattern segments + return preg_replace('#\(/?:.+\)|\(|\)#', '', $pattern); + } + + /** + * Dispatch route + * + * This method invokes the route object's callable. If middleware is + * registered for the route, each callable middleware is invoked in + * the order specified. + * + * @param \Slim\Route $route The route object + * @return bool Was route callable invoked successfully? + */ + public function dispatch(\Slim\Route $route) + { + $this->currentRoute = $route; + + //Invoke middleware + foreach ($route->getMiddleware() as $mw) { + call_user_func_array($mw, array($route)); + } + + //Invoke callable + call_user_func_array($route->getCallable(), array_values($route->getParams())); + + return true; + } + + /** + * Add named route + * @param string $name The route name + * @param \Slim\Route $route The route object + * @throws \RuntimeException If a named route already exists with the same name + */ + public function addNamedRoute($name, \Slim\Route $route) + { + if ($this->hasNamedRoute($name)) { + throw new \RuntimeException('Named route already exists with name: ' . $name); + } + $this->namedRoutes[(string) $name] = $route; + } + + /** + * Has named route + * @param string $name The route name + * @return bool + */ + public function hasNamedRoute($name) + { + $this->getNamedRoutes(); + + return isset($this->namedRoutes[(string) $name]); + } + + /** + * Get named route + * @param string $name + * @return \Slim\Route|null + */ + public function getNamedRoute($name) + { + $this->getNamedRoutes(); + if ($this->hasNamedRoute($name)) { + return $this->namedRoutes[(string) $name]; + } else { + return null; + } + } + + /** + * Get named routes + * @return \ArrayIterator + */ + public function getNamedRoutes() + { + if (is_null($this->namedRoutes)) { + $this->namedRoutes = array(); + foreach ($this->routes as $route) { + if ($route->getName() !== null) { + $this->addNamedRoute($route->getName(), $route); + } + } + } + + return new \ArrayIterator($this->namedRoutes); + } +} diff --git a/geoapi/Slim/Slim.php b/geoapi/Slim/Slim.php new file mode 100644 index 0000000..5e10c60 --- /dev/null +++ b/geoapi/Slim/Slim.php @@ -0,0 +1,1309 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +// Ensure mcrypt constants are defined even if mcrypt extension is not loaded +if (!extension_loaded('mcrypt')) { + define('MCRYPT_MODE_CBC', 0); + define('MCRYPT_RIJNDAEL_256', 0); +} + +/** + * Slim + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class Slim +{ + /** + * @const string + */ + const VERSION = '2.2.0'; + + /** + * @var array[\Slim] + */ + protected static $apps = array(); + + /** + * @var string + */ + protected $name; + + /** + * @var array + */ + protected $environment; + + /** + * @var \Slim\Http\Request + */ + protected $request; + + /** + * @var \Slim\Http\Response + */ + protected $response; + + /** + * @var \Slim\Router + */ + protected $router; + + /** + * @var \Slim\View + */ + protected $view; + + /** + * @var array + */ + protected $settings; + + /** + * @var string + */ + protected $mode; + + /** + * @var array + */ + protected $middleware; + + /** + * @var mixed Callable to be invoked if application error + */ + protected $error; + + /** + * @var mixed Callable to be invoked if no matching routes are found + */ + protected $notFound; + + /** + * @var array + */ + protected $hooks = array( + 'slim.before' => array(array()), + 'slim.before.router' => array(array()), + 'slim.before.dispatch' => array(array()), + 'slim.after.dispatch' => array(array()), + 'slim.after.router' => array(array()), + 'slim.after' => array(array()) + ); + + /******************************************************************************** + * PSR-0 Autoloader + * + * Do not use if you are using Composer to autoload dependencies. + *******************************************************************************/ + + /** + * Slim PSR-0 autoloader + */ + public static function autoload($className) + { + $thisClass = str_replace(__NAMESPACE__.'\\', '', __CLASS__); + + $baseDir = __DIR__; + + if (substr($baseDir, -strlen($thisClass)) === $thisClass) { + $baseDir = substr($baseDir, 0, -strlen($thisClass)); + } + + $className = ltrim($className, '\\'); + $fileName = $baseDir; + $namespace = ''; + if ($lastNsPos = strripos($className, '\\')) { + $namespace = substr($className, 0, $lastNsPos); + $className = substr($className, $lastNsPos + 1); + $fileName .= str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; + } + $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; + + if (file_exists($fileName)) { + require $fileName; + } + } + + /** + * Register Slim's PSR-0 autoloader + */ + public static function registerAutoloader() + { + spl_autoload_register(__NAMESPACE__ . "\\Slim::autoload"); + } + + /******************************************************************************** + * Instantiation and Configuration + *******************************************************************************/ + + /** + * Constructor + * @param array $userSettings Associative array of application settings + */ + public function __construct($userSettings = array()) + { + // Setup Slim application + $this->settings = array_merge(static::getDefaultSettings(), $userSettings); + $this->environment = \Slim\Environment::getInstance(); + $this->request = new \Slim\Http\Request($this->environment); + $this->response = new \Slim\Http\Response(); + $this->router = new \Slim\Router(); + $this->middleware = array($this); + $this->add(new \Slim\Middleware\Flash()); + $this->add(new \Slim\Middleware\MethodOverride()); + + // Determine application mode + $this->getMode(); + + // Setup view + $this->view($this->config('view')); + + // Make default if first instance + if (is_null(static::getInstance())) { + $this->setName('default'); + } + + // Set default logger that writes to stderr (may be overridden with middleware) + $logWriter = $this->config('log.writer'); + if (!$logWriter) { + $logWriter = new \Slim\LogWriter($this->environment['slim.errors']); + } + $log = new \Slim\Log($logWriter); + $log->setEnabled($this->config('log.enabled')); + $log->setLevel($this->config('log.level')); + $this->environment['slim.log'] = $log; + } + + /** + * Get application instance by name + * @param string $name The name of the Slim application + * @return \Slim|null + */ + public static function getInstance($name = 'default') + { + return isset(static::$apps[$name]) ? static::$apps[$name] : null; + } + + /** + * Set Slim application name + * @param string $name The name of this Slim application + */ + public function setName($name) + { + $this->name = $name; + static::$apps[$name] = $this; + } + + /** + * Get Slim application name + * @return string|null + */ + public function getName() + { + return $this->name; + } + + /** + * Get default application settings + * @return array + */ + public static function getDefaultSettings() + { + return array( + // Application + 'mode' => 'development', + // Debugging + 'debug' => true, + // Logging + 'log.writer' => null, + 'log.level' => \Slim\Log::DEBUG, + 'log.enabled' => true, + // View + 'templates.path' => './templates', + 'view' => '\Slim\View', + // Cookies + 'cookies.lifetime' => '20 minutes', + 'cookies.path' => '/', + 'cookies.domain' => null, + 'cookies.secure' => false, + 'cookies.httponly' => false, + // Encryption + 'cookies.secret_key' => 'CHANGE_ME', + 'cookies.cipher' => MCRYPT_RIJNDAEL_256, + 'cookies.cipher_mode' => MCRYPT_MODE_CBC, + // HTTP + 'http.version' => '1.1' + ); + } + + /** + * Configure Slim Settings + * + * This method defines application settings and acts as a setter and a getter. + * + * If only one argument is specified and that argument is a string, the value + * of the setting identified by the first argument will be returned, or NULL if + * that setting does not exist. + * + * If only one argument is specified and that argument is an associative array, + * the array will be merged into the existing application settings. + * + * If two arguments are provided, the first argument is the name of the setting + * to be created or updated, and the second argument is the setting value. + * + * @param string|array $name If a string, the name of the setting to set or retrieve. Else an associated array of setting names and values + * @param mixed $value If name is a string, the value of the setting identified by $name + * @return mixed The value of a setting if only one argument is a string + */ + public function config($name, $value = null) + { + if (func_num_args() === 1) { + if (is_array($name)) { + $this->settings = array_merge($this->settings, $name); + } else { + return isset($this->settings[$name]) ? $this->settings[$name] : null; + } + } else { + $this->settings[$name] = $value; + } + } + + /******************************************************************************** + * Application Modes + *******************************************************************************/ + + /** + * Get application mode + * + * This method determines the application mode. It first inspects the $_ENV + * superglobal for key `SLIM_MODE`. If that is not found, it queries + * the `getenv` function. Else, it uses the application `mode` setting. + * + * @return string + */ + public function getMode() + { + if (!isset($this->mode)) { + if (isset($_ENV['SLIM_MODE'])) { + $this->mode = $_ENV['SLIM_MODE']; + } else { + $envMode = getenv('SLIM_MODE'); + if ($envMode !== false) { + $this->mode = $envMode; + } else { + $this->mode = $this->config('mode'); + } + } + } + + return $this->mode; + } + + /** + * Configure Slim for a given mode + * + * This method will immediately invoke the callable if + * the specified mode matches the current application mode. + * Otherwise, the callable is ignored. This should be called + * only _after_ you initialize your Slim app. + * + * @param string $mode + * @param mixed $callable + * @return void + */ + public function configureMode($mode, $callable) + { + if ($mode === $this->getMode() && is_callable($callable)) { + call_user_func($callable); + } + } + + /******************************************************************************** + * Logging + *******************************************************************************/ + + /** + * Get application log + * @return \Slim\Log + */ + public function getLog() + { + return $this->environment['slim.log']; + } + + /******************************************************************************** + * Routing + *******************************************************************************/ + + /** + * Add GET|POST|PUT|DELETE route + * + * Adds a new route to the router with associated callable. This + * route will only be invoked when the HTTP request's method matches + * this route's method. + * + * ARGUMENTS: + * + * First: string The URL pattern (REQUIRED) + * In-Between: mixed Anything that returns TRUE for `is_callable` (OPTIONAL) + * Last: mixed Anything that returns TRUE for `is_callable` (REQUIRED) + * + * The first argument is required and must always be the + * route pattern (ie. '/books/:id'). + * + * The last argument is required and must always be the callable object + * to be invoked when the route matches an HTTP request. + * + * You may also provide an unlimited number of in-between arguments; + * each interior argument must be callable and will be invoked in the + * order specified before the route's callable is invoked. + * + * USAGE: + * + * Slim::get('/foo'[, middleware, middleware, ...], callable); + * + * @param array (See notes above) + * @return \Slim\Route + */ + protected function mapRoute($args) + { + $pattern = array_shift($args); + $callable = array_pop($args); + $route = $this->router->map($pattern, $callable); + if (count($args) > 0) { + $route->setMiddleware($args); + } + + return $route; + } + + /** + * Add generic route without associated HTTP method + * @see mapRoute() + * @return \Slim\Route + */ + public function map() + { + $args = func_get_args(); + + return $this->mapRoute($args); + } + + /** + * Add GET route + * @see mapRoute() + * @return \Slim\Route + */ + public function get() + { + $args = func_get_args(); + + return $this->mapRoute($args)->via(\Slim\Http\Request::METHOD_GET, \Slim\Http\Request::METHOD_HEAD); + } + + /** + * Add POST route + * @see mapRoute() + * @return \Slim\Route + */ + public function post() + { + $args = func_get_args(); + + return $this->mapRoute($args)->via(\Slim\Http\Request::METHOD_POST); + } + + /** + * Add PUT route + * @see mapRoute() + * @return \Slim\Route + */ + public function put() + { + $args = func_get_args(); + + return $this->mapRoute($args)->via(\Slim\Http\Request::METHOD_PUT); + } + + /** + * Add DELETE route + * @see mapRoute() + * @return \Slim\Route + */ + public function delete() + { + $args = func_get_args(); + + return $this->mapRoute($args)->via(\Slim\Http\Request::METHOD_DELETE); + } + + /** + * Add OPTIONS route + * @see mapRoute() + * @return \Slim\Route + */ + public function options() + { + $args = func_get_args(); + + return $this->mapRoute($args)->via(\Slim\Http\Request::METHOD_OPTIONS); + } + + /** + * Not Found Handler + * + * This method defines or invokes the application-wide Not Found handler. + * There are two contexts in which this method may be invoked: + * + * 1. When declaring the handler: + * + * If the $callable parameter is not null and is callable, this + * method will register the callable to be invoked when no + * routes match the current HTTP request. It WILL NOT invoke the callable. + * + * 2. When invoking the handler: + * + * If the $callable parameter is null, Slim assumes you want + * to invoke an already-registered handler. If the handler has been + * registered and is callable, it is invoked and sends a 404 HTTP Response + * whose body is the output of the Not Found handler. + * + * @param mixed $callable Anything that returns true for is_callable() + */ + public function notFound( $callable = null ) { + if ( is_callable($callable) ) { + $this->notFound = $callable; + } else { + ob_start(); + if ( is_callable($this->notFound) ) { + call_user_func($this->notFound); + } else { + call_user_func(array($this, 'defaultNotFound')); + } + $this->halt(404, ob_get_clean()); + } + } + + /** + * Error Handler + * + * This method defines or invokes the application-wide Error handler. + * There are two contexts in which this method may be invoked: + * + * 1. When declaring the handler: + * + * If the $argument parameter is callable, this + * method will register the callable to be invoked when an uncaught + * Exception is detected, or when otherwise explicitly invoked. + * The handler WILL NOT be invoked in this context. + * + * 2. When invoking the handler: + * + * If the $argument parameter is not callable, Slim assumes you want + * to invoke an already-registered handler. If the handler has been + * registered and is callable, it is invoked and passed the caught Exception + * as its one and only argument. The error handler's output is captured + * into an output buffer and sent as the body of a 500 HTTP Response. + * + * @param mixed $argument Callable|\Exception + */ + public function error($argument = null) + { + if (is_callable($argument)) { + //Register error handler + $this->error = $argument; + } else { + //Invoke error handler + $this->response->status(500); + $this->response->body(''); + $this->response->write($this->callErrorHandler($argument)); + $this->stop(); + } + } + + /** + * Call error handler + * + * This will invoke the custom or default error handler + * and RETURN its output. + * + * @param \Exception|null $argument + * @return string + */ + protected function callErrorHandler($argument = null) + { + ob_start(); + if ( is_callable($this->error) ) { + call_user_func_array($this->error, array($argument)); + } else { + call_user_func_array(array($this, 'defaultError'), array($argument)); + } + + return ob_get_clean(); + } + + /******************************************************************************** + * Application Accessors + *******************************************************************************/ + + /** + * Get a reference to the Environment object + * @return \Slim\Environment + */ + public function environment() + { + return $this->environment; + } + + /** + * Get the Request object + * @return \Slim\Http\Request + */ + public function request() + { + return $this->request; + } + + /** + * Get the Response object + * @return \Slim\Http\Response + */ + public function response() + { + return $this->response; + } + + /** + * Get the Router object + * @return \Slim\Router + */ + public function router() + { + return $this->router; + } + + /** + * Get and/or set the View + * + * This method declares the View to be used by the Slim application. + * If the argument is a string, Slim will instantiate a new object + * of the same class. If the argument is an instance of View or a subclass + * of View, Slim will use the argument as the View. + * + * If a View already exists and this method is called to create a + * new View, data already set in the existing View will be + * transferred to the new View. + * + * @param string|\Slim\View $viewClass The name or instance of a \Slim\View subclass + * @return \Slim\View + */ + public function view($viewClass = null) + { + if (!is_null($viewClass)) { + $existingData = is_null($this->view) ? array() : $this->view->getData(); + if ($viewClass instanceOf \Slim\View) { + $this->view = $viewClass; + } else { + $this->view = new $viewClass(); + } + $this->view->appendData($existingData); + $this->view->setTemplatesDirectory($this->config('templates.path')); + } + + return $this->view; + } + + /******************************************************************************** + * Rendering + *******************************************************************************/ + + /** + * Render a template + * + * Call this method within a GET, POST, PUT, DELETE, NOT FOUND, or ERROR + * callable to render a template whose output is appended to the + * current HTTP response body. How the template is rendered is + * delegated to the current View. + * + * @param string $template The name of the template passed into the view's render() method + * @param array $data Associative array of data made available to the view + * @param int $status The HTTP response status code to use (optional) + */ + public function render($template, $data = array(), $status = null) + { + if (!is_null($status)) { + $this->response->status($status); + } + $this->view->setTemplatesDirectory($this->config('templates.path')); + $this->view->appendData($data); + $this->view->display($template); + } + + /******************************************************************************** + * HTTP Caching + *******************************************************************************/ + + /** + * Set Last-Modified HTTP Response Header + * + * Set the HTTP 'Last-Modified' header and stop if a conditional + * GET request's `If-Modified-Since` header matches the last modified time + * of the resource. The `time` argument is a UNIX timestamp integer value. + * When the current request includes an 'If-Modified-Since' header that + * matches the specified last modified time, the application will stop + * and send a '304 Not Modified' response to the client. + * + * @param int $time The last modified UNIX timestamp + * @throws \InvalidArgumentException If provided timestamp is not an integer + */ + public function lastModified($time) + { + if (is_integer($time)) { + $this->response['Last-Modified'] = date(DATE_RFC1123, $time); + if ($time === strtotime($this->request->headers('IF_MODIFIED_SINCE'))) { + $this->halt(304); + } + } else { + throw new \InvalidArgumentException('Slim::lastModified only accepts an integer UNIX timestamp value.'); + } + } + + /** + * Set ETag HTTP Response Header + * + * Set the etag header and stop if the conditional GET request matches. + * The `value` argument is a unique identifier for the current resource. + * The `type` argument indicates whether the etag should be used as a strong or + * weak cache validator. + * + * When the current request includes an 'If-None-Match' header with + * a matching etag, execution is immediately stopped. If the request + * method is GET or HEAD, a '304 Not Modified' response is sent. + * + * @param string $value The etag value + * @param string $type The type of etag to create; either "strong" or "weak" + * @throws \InvalidArgumentException If provided type is invalid + */ + public function etag($value, $type = 'strong') + { + //Ensure type is correct + if (!in_array($type, array('strong', 'weak'))) { + throw new \InvalidArgumentException('Invalid Slim::etag type. Expected "strong" or "weak".'); + } + + //Set etag value + $value = '"' . $value . '"'; + if ($type === 'weak') $value = 'W/'.$value; + $this->response['ETag'] = $value; + + //Check conditional GET + if ($etagsHeader = $this->request->headers('IF_NONE_MATCH')) { + $etags = preg_split('@\s*,\s*@', $etagsHeader); + if (in_array($value, $etags) || in_array('*', $etags)) { + $this->halt(304); + } + } + } + + /** + * Set Expires HTTP response header + * + * The `Expires` header tells the HTTP client the time at which + * the current resource should be considered stale. At that time the HTTP + * client will send a conditional GET request to the server; the server + * may return a 200 OK if the resource has changed, else a 304 Not Modified + * if the resource has not changed. The `Expires` header should be used in + * conjunction with the `etag()` or `lastModified()` methods above. + * + * @param string|int $time If string, a time to be parsed by `strtotime()`; + * If int, a UNIX timestamp; + */ + public function expires($time) + { + if (is_string($time)) { + $time = strtotime($time); + } + $this->response['Expires'] = gmdate(DATE_RFC1123, $time); + } + + /******************************************************************************** + * HTTP Cookies + *******************************************************************************/ + + /** + * Set unencrypted HTTP cookie + * + * @param string $name The cookie name + * @param string $value The cookie value + * @param int|string $time The duration of the cookie; + * If integer, should be UNIX timestamp; + * If string, converted to UNIX timestamp with `strtotime`; + * @param string $path The path on the server in which the cookie will be available on + * @param string $domain The domain that the cookie is available to + * @param bool $secure Indicates that the cookie should only be transmitted over a secure + * HTTPS connection to/from the client + * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol + */ + public function setCookie($name, $value, $time = null, $path = null, $domain = null, $secure = null, $httponly = null) + { + $this->response->setCookie($name, array( + 'value' => $value, + 'expires' => is_null($time) ? $this->config('cookies.lifetime') : $time, + 'path' => is_null($path) ? $this->config('cookies.path') : $path, + 'domain' => is_null($domain) ? $this->config('cookies.domain') : $domain, + 'secure' => is_null($secure) ? $this->config('cookies.secure') : $secure, + 'httponly' => is_null($httponly) ? $this->config('cookies.httponly') : $httponly + )); + } + + /** + * Get value of unencrypted HTTP cookie + * + * Return the value of a cookie from the current HTTP request, + * or return NULL if cookie does not exist. Cookies created during + * the current request will not be available until the next request. + * + * @param string $name + * @return string|null + */ + public function getCookie($name) + { + return $this->request->cookies($name); + } + + /** + * Set encrypted HTTP cookie + * + * @param string $name The cookie name + * @param mixed $value The cookie value + * @param mixed $expires The duration of the cookie; + * If integer, should be UNIX timestamp; + * If string, converted to UNIX timestamp with `strtotime`; + * @param string $path The path on the server in which the cookie will be available on + * @param string $domain The domain that the cookie is available to + * @param bool $secure Indicates that the cookie should only be transmitted over a secure + * HTTPS connection from the client + * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol + */ + public function setEncryptedCookie($name, $value, $expires = null, $path = null, $domain = null, $secure = null, $httponly = null) + { + $expires = is_null($expires) ? $this->config('cookies.lifetime') : $expires; + if (is_string($expires)) { + $expires = strtotime($expires); + } + $secureValue = \Slim\Http\Util::encodeSecureCookie( + $value, + $expires, + $this->config('cookies.secret_key'), + $this->config('cookies.cipher'), + $this->config('cookies.cipher_mode') + ); + $this->setCookie($name, $secureValue, $expires, $path, $domain, $secure, $httponly); + } + + /** + * Get value of encrypted HTTP cookie + * + * Return the value of an encrypted cookie from the current HTTP request, + * or return NULL if cookie does not exist. Encrypted cookies created during + * the current request will not be available until the next request. + * + * @param string $name + * @return string|false + */ + public function getEncryptedCookie($name, $deleteIfInvalid = true) + { + $value = \Slim\Http\Util::decodeSecureCookie( + $this->request->cookies($name), + $this->config('cookies.secret_key'), + $this->config('cookies.cipher'), + $this->config('cookies.cipher_mode') + ); + if ($value === false && $deleteIfInvalid) { + $this->deleteCookie($name); + } + + return $value; + } + + /** + * Delete HTTP cookie (encrypted or unencrypted) + * + * Remove a Cookie from the client. This method will overwrite an existing Cookie + * with a new, empty, auto-expiring Cookie. This method's arguments must match + * the original Cookie's respective arguments for the original Cookie to be + * removed. If any of this method's arguments are omitted or set to NULL, the + * default Cookie setting values (set during Slim::init) will be used instead. + * + * @param string $name The cookie name + * @param string $path The path on the server in which the cookie will be available on + * @param string $domain The domain that the cookie is available to + * @param bool $secure Indicates that the cookie should only be transmitted over a secure + * HTTPS connection from the client + * @param bool $httponly When TRUE the cookie will be made accessible only through the HTTP protocol + */ + public function deleteCookie($name, $path = null, $domain = null, $secure = null, $httponly = null) + { + $this->response->deleteCookie($name, array( + 'domain' => is_null($domain) ? $this->config('cookies.domain') : $domain, + 'path' => is_null($path) ? $this->config('cookies.path') : $path, + 'secure' => is_null($secure) ? $this->config('cookies.secure') : $secure, + 'httponly' => is_null($httponly) ? $this->config('cookies.httponly') : $httponly + )); + } + + /******************************************************************************** + * Helper Methods + *******************************************************************************/ + + /** + * Get the absolute path to this Slim application's root directory + * + * This method returns the absolute path to the Slim application's + * directory. If the Slim application is installed in a public-accessible + * sub-directory, the sub-directory path will be included. This method + * will always return an absolute path WITH a trailing slash. + * + * @return string + */ + public function root() + { + return rtrim($_SERVER['DOCUMENT_ROOT'], '/') . rtrim($this->request->getRootUri(), '/') . '/'; + } + + /** + * Clean current output buffer + */ + protected function cleanBuffer() + { + if (ob_get_level() !== 0) { + ob_clean(); + } + } + + /** + * Stop + * + * The thrown exception will be caught in application's `call()` method + * and the response will be sent as is to the HTTP client. + * + * @throws \Slim\Exception\Stop + */ + public function stop() + { + throw new \Slim\Exception\Stop(); + } + + /** + * Halt + * + * Stop the application and immediately send the response with a + * specific status and body to the HTTP client. This may send any + * type of response: info, success, redirect, client error, or server error. + * If you need to render a template AND customize the response status, + * use the application's `render()` method instead. + * + * @param int $status The HTTP response status + * @param string $message The HTTP response body + */ + public function halt($status, $message = '') + { + $this->cleanBuffer(); + $this->response->status($status); + $this->response->body($message); + $this->stop(); + } + + /** + * Pass + * + * The thrown exception is caught in the application's `call()` method causing + * the router's current iteration to stop and continue to the subsequent route if available. + * If no subsequent matching routes are found, a 404 response will be sent to the client. + * + * @throws \Slim\Exception\Pass + */ + public function pass() + { + $this->cleanBuffer(); + throw new \Slim\Exception\Pass(); + } + + /** + * Set the HTTP response Content-Type + * @param string $type The Content-Type for the Response (ie. text/html) + */ + public function contentType($type) + { + $this->response['Content-Type'] = $type; + } + + /** + * Set the HTTP response status code + * @param int $status The HTTP response status code + */ + public function status($code) + { + $this->response->status($code); + } + + /** + * Get the URL for a named route + * @param string $name The route name + * @param array $params Associative array of URL parameters and replacement values + * @throws \RuntimeException If named route does not exist + * @return string + */ + public function urlFor($name, $params = array()) + { + return $this->request->getRootUri() . $this->router->urlFor($name, $params); + } + + /** + * Redirect + * + * This method immediately redirects to a new URL. By default, + * this issues a 302 Found response; this is considered the default + * generic redirect response. You may also specify another valid + * 3xx status code if you want. This method will automatically set the + * HTTP Location header for you using the URL parameter. + * + * @param string $url The destination URL + * @param int $status The HTTP redirect status code (optional) + */ + public function redirect($url, $status = 302) + { + $this->response->redirect($url, $status); + $this->halt($status); + } + + /******************************************************************************** + * Flash Messages + *******************************************************************************/ + + /** + * Set flash message for subsequent request + * @param string $key + * @param mixed $value + */ + public function flash($key, $value) + { + if (isset($this->environment['slim.flash'])) { + $this->environment['slim.flash']->set($key, $value); + } + } + + /** + * Set flash message for current request + * @param string $key + * @param mixed $value + */ + public function flashNow($key, $value) + { + if (isset($this->environment['slim.flash'])) { + $this->environment['slim.flash']->now($key, $value); + } + } + + /** + * Keep flash messages from previous request for subsequent request + */ + public function flashKeep() + { + if (isset($this->environment['slim.flash'])) { + $this->environment['slim.flash']->keep(); + } + } + + /******************************************************************************** + * Hooks + *******************************************************************************/ + + /** + * Assign hook + * @param string $name The hook name + * @param mixed $callable A callable object + * @param int $priority The hook priority; 0 = high, 10 = low + */ + public function hook($name, $callable, $priority = 10) + { + if (!isset($this->hooks[$name])) { + $this->hooks[$name] = array(array()); + } + if (is_callable($callable)) { + $this->hooks[$name][(int) $priority][] = $callable; + } + } + + /** + * Invoke hook + * @param string $name The hook name + * @param mixed $hookArgs (Optional) Argument for hooked functions + */ + public function applyHook($name, $hookArg = null) + { + if (!isset($this->hooks[$name])) { + $this->hooks[$name] = array(array()); + } + if (!empty($this->hooks[$name])) { + // Sort by priority, low to high, if there's more than one priority + if (count($this->hooks[$name]) > 1) { + ksort($this->hooks[$name]); + } + foreach ($this->hooks[$name] as $priority) { + if (!empty($priority)) { + foreach ($priority as $callable) { + call_user_func($callable, $hookArg); + } + } + } + } + } + + /** + * Get hook listeners + * + * Return an array of registered hooks. If `$name` is a valid + * hook name, only the listeners attached to that hook are returned. + * Else, all listeners are returned as an associative array whose + * keys are hook names and whose values are arrays of listeners. + * + * @param string $name A hook name (Optional) + * @return array|null + */ + public function getHooks($name = null) + { + if (!is_null($name)) { + return isset($this->hooks[(string) $name]) ? $this->hooks[(string) $name] : null; + } else { + return $this->hooks; + } + } + + /** + * Clear hook listeners + * + * Clear all listeners for all hooks. If `$name` is + * a valid hook name, only the listeners attached + * to that hook will be cleared. + * + * @param string $name A hook name (Optional) + */ + public function clearHooks($name = null) + { + if (!is_null($name) && isset($this->hooks[(string) $name])) { + $this->hooks[(string) $name] = array(array()); + } else { + foreach ($this->hooks as $key => $value) { + $this->hooks[$key] = array(array()); + } + } + } + + /******************************************************************************** + * Middleware + *******************************************************************************/ + + /** + * Add middleware + * + * This method prepends new middleware to the application middleware stack. + * The argument must be an instance that subclasses Slim_Middleware. + * + * @param \Slim\Middleware + */ + public function add(\Slim\Middleware $newMiddleware) + { + $newMiddleware->setApplication($this); + $newMiddleware->setNextMiddleware($this->middleware[0]); + array_unshift($this->middleware, $newMiddleware); + } + + /******************************************************************************** + * Runner + *******************************************************************************/ + + /** + * Run + * + * This method invokes the middleware stack, including the core Slim application; + * the result is an array of HTTP status, header, and body. These three items + * are returned to the HTTP client. + */ + public function run() + { + set_error_handler(array('\Slim\Slim', 'handleErrors')); + + //Apply final outer middleware layers + $this->add(new \Slim\Middleware\PrettyExceptions()); + + //Invoke middleware and application stack + $this->middleware[0]->call(); + + //Fetch status, header, and body + list($status, $header, $body) = $this->response->finalize(); + + //Send headers + if (headers_sent() === false) { + //Send status + if (strpos(PHP_SAPI, 'cgi') === 0) { + header(sprintf('Status: %s', \Slim\Http\Response::getMessageForCode($status))); + } else { + header(sprintf('HTTP/%s %s', $this->config('http.version'), \Slim\Http\Response::getMessageForCode($status))); + } + + //Send headers + foreach ($header as $name => $value) { + $hValues = explode("\n", $value); + foreach ($hValues as $hVal) { + header("$name: $hVal", false); + } + } + } + + //Send body + echo $body; + + restore_error_handler(); + } + + /** + * Call + * + * This method finds and iterates all route objects that match the current request URI. + */ + public function call() + { + try { + if (isset($this->environment['slim.flash'])) { + $this->view()->setData('flash', $this->environment['slim.flash']); + } + $this->applyHook('slim.before'); + ob_start(); + $this->applyHook('slim.before.router'); + $dispatched = false; + $matchedRoutes = $this->router->getMatchedRoutes($this->request->getMethod(), $this->request->getResourceUri()); + foreach ($matchedRoutes as $route) { + try { + $this->applyHook('slim.before.dispatch'); + $dispatched = $this->router->dispatch($route); + $this->applyHook('slim.after.dispatch'); + if ($dispatched) { + break; + } + } catch (\Slim\Exception\Pass $e) { + continue; + } + } + if (!$dispatched) { + $this->notFound(); + } + $this->applyHook('slim.after.router'); + $this->stop(); + } catch (\Slim\Exception\Stop $e) { + $this->response()->write(ob_get_clean()); + $this->applyHook('slim.after'); + } catch (\Exception $e) { + if ($this->config('debug')) { + throw $e; + } else { + try { + $this->error($e); + } catch (\Slim\Exception\Stop $e) { + // Do nothing + } + } + } + } + + /******************************************************************************** + * Error Handling and Debugging + *******************************************************************************/ + + /** + * Convert errors into ErrorException objects + * + * This method catches PHP errors and converts them into \ErrorException objects; + * these \ErrorException objects are then thrown and caught by Slim's + * built-in or custom error handlers. + * + * @param int $errno The numeric type of the Error + * @param string $errstr The error message + * @param string $errfile The absolute path to the affected file + * @param int $errline The line number of the error in the affected file + * @return true + * @throws \ErrorException + */ + public static function handleErrors($errno, $errstr = '', $errfile = '', $errline = '') + { + if (error_reporting() & $errno) { + throw new \ErrorException($errstr, $errno, 0, $errfile, $errline); + } + + return true; + } + + /** + * Generate diagnostic template markup + * + * This method accepts a title and body content to generate an HTML document layout. + * + * @param string $title The title of the HTML template + * @param string $body The body content of the HTML template + * @return string + */ + protected static function generateTemplateMarkup($title, $body) + { + return sprintf("%s

%s

%s", $title, $title, $body); + } + + /** + * Default Not Found handler + */ + protected function defaultNotFound() + { + echo static::generateTemplateMarkup('404 Page Not Found', '

The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.

Visit the Home Page'); + } + + /** + * Default Error handler + */ + protected function defaultError($e) + { + $this->getLog()->error($e); + echo self::generateTemplateMarkup('Error', '

A website error has occured. The website administrator has been notified of the issue. Sorry for the temporary inconvenience.

'); + } +} diff --git a/geoapi/Slim/View.php b/geoapi/Slim/View.php new file mode 100644 index 0000000..0ce9568 --- /dev/null +++ b/geoapi/Slim/View.php @@ -0,0 +1,216 @@ + + * @copyright 2011 Josh Lockhart + * @link http://www.slimframework.com + * @license http://www.slimframework.com/license + * @version 2.2.0 + * @package Slim + * + * MIT LICENSE + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +namespace Slim; + +/** + * View + * + * The view is responsible for rendering a template. The view + * should subclass \Slim\View and implement this interface: + * + * public render(string $template); + * + * This method should render the specified template and return + * the resultant string. + * + * @package Slim + * @author Josh Lockhart + * @since 1.0.0 + */ +class View +{ + /** + * @var string Absolute or relative filesystem path to a specific template + * + * DEPRECATION WARNING! + * This variable will be removed in the near future + */ + protected $templatePath = ''; + + /** + * @var array Associative array of template variables + */ + protected $data = array(); + + /** + * @var string Absolute or relative path to the application's templates directory + */ + protected $templatesDirectory; + + /** + * Constructor + * + * This is empty but may be implemented in a subclass + */ + public function __construct() + { + + } + + /** + * Get data + * @param string|null $key + * @return mixed If key is null, array of template data; + * If key exists, value of datum with key; + * If key does not exist, null; + */ + public function getData($key = null) + { + if (!is_null($key)) { + return isset($this->data[$key]) ? $this->data[$key] : null; + } else { + return $this->data; + } + } + + /** + * Set data + * + * If two arguments: + * A single datum with key is assigned value; + * + * $view->setData('color', 'red'); + * + * If one argument: + * Replace all data with provided array keys and values; + * + * $view->setData(array('color' => 'red', 'number' => 1)); + * + * @param mixed + * @param mixed + * @throws InvalidArgumentException If incorrect method signature + */ + public function setData() + { + $args = func_get_args(); + if (count($args) === 1 && is_array($args[0])) { + $this->data = $args[0]; + } elseif (count($args) === 2) { + $this->data[(string) $args[0]] = $args[1]; + } else { + throw new \InvalidArgumentException('Cannot set View data with provided arguments. Usage: `View::setData( $key, $value );` or `View::setData([ key => value, ... ]);`'); + } + } + + /** + * Append new data to existing template data + * @param array + * @throws InvalidArgumentException If not given an array argument + */ + public function appendData($data) + { + if (!is_array($data)) { + throw new \InvalidArgumentException('Cannot append view data. Expected array argument.'); + } + $this->data = array_merge($this->data, $data); + } + + /** + * Get templates directory + * @return string|null Path to templates directory without trailing slash; + * Returns null if templates directory not set; + */ + public function getTemplatesDirectory() + { + return $this->templatesDirectory; + } + + /** + * Set templates directory + * @param string $dir + */ + public function setTemplatesDirectory($dir) + { + $this->templatesDirectory = rtrim($dir, '/'); + } + + /** + * Set template + * @param string $template + * @throws RuntimeException If template file does not exist + * + * DEPRECATION WARNING! + * This method will be removed in the near future. + */ + public function setTemplate($template) + { + $this->templatePath = $this->getTemplatesDirectory() . '/' . ltrim($template, '/'); + if (!file_exists($this->templatePath)) { + throw new \RuntimeException('View cannot render template `' . $this->templatePath . '`. Template does not exist.'); + } + } + + /** + * Display template + * + * This method echoes the rendered template to the current output buffer + * + * @param string $template Pathname of template file relative to templates directoy + */ + public function display($template) + { + echo $this->fetch($template); + } + + /** + * Fetch rendered template + * + * This method returns the rendered template + * + * @param string $template Pathname of template file relative to templates directory + * @return string + */ + public function fetch($template) + { + return $this->render($template); + } + + /** + * Render template + * + * @param string $template Pathname of template file relative to templates directory + * @return string + * + * DEPRECATION WARNING! + * Use `\Slim\View::fetch` to return a rendered template instead of `\Slim\View::render`. + */ + public function render($template) + { + $this->setTemplate($template); + extract($this->data); + ob_start(); + require $this->templatePath; + + return ob_get_clean(); + } +} diff --git a/geoapi/index.php b/geoapi/index.php new file mode 100644 index 0000000..25022eb --- /dev/null +++ b/geoapi/index.php @@ -0,0 +1,14 @@ + +get('/hello/:name', function ($name) { + echo "Hello, $name"; +}); + +$app->run(); +?> diff --git a/geoapi/nbproject/project.properties b/geoapi/nbproject/project.properties new file mode 100644 index 0000000..67f3fcd --- /dev/null +++ b/geoapi/nbproject/project.properties @@ -0,0 +1,7 @@ +include.path=${php.global.include.path} +php.version=PHP_54 +source.encoding=UTF-8 +src.dir=. +tags.asp=false +tags.short=true +web.root=. diff --git a/geoapi/nbproject/project.xml b/geoapi/nbproject/project.xml new file mode 100644 index 0000000..60d3060 --- /dev/null +++ b/geoapi/nbproject/project.xml @@ -0,0 +1,9 @@ + + + org.netbeans.modules.php.project + + + PhpProject1 + + + From 12bc82710ba1b9eb399f1b5240dfc3aa77527a21 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 20 May 2013 14:46:49 +0200 Subject: [PATCH 04/17] update api --- geoapi/api/api.php | 10 ++++++++++ geoapi/config/config.db.php | 7 +++++++ geoapi/config/config.php | 7 +++++++ geoapi/database/mysql.php | 7 +++++++ geoapi/global.inc.php | 7 +++++++ geoapi/index.php | 12 +----------- geoapi/nbproject/project.properties | 4 +++- geoapi/nbproject/project.xml | 2 +- geoapi/service/helloservice/index.php | 13 +++++++++++++ geoapi/{ => thirdparty}/Slim/Environment.php | 0 geoapi/{ => thirdparty}/Slim/Exception/Pass.php | 0 geoapi/{ => thirdparty}/Slim/Exception/Stop.php | 0 geoapi/{ => thirdparty}/Slim/Http/Headers.php | 0 geoapi/{ => thirdparty}/Slim/Http/Request.php | 0 geoapi/{ => thirdparty}/Slim/Http/Response.php | 0 geoapi/{ => thirdparty}/Slim/Http/Util.php | 0 geoapi/{ => thirdparty}/Slim/Log.php | 0 geoapi/{ => thirdparty}/Slim/LogWriter.php | 0 geoapi/{ => thirdparty}/Slim/Middleware.php | 0 .../Slim/Middleware/ContentTypes.php | 0 geoapi/{ => thirdparty}/Slim/Middleware/Flash.php | 0 .../Slim/Middleware/MethodOverride.php | 0 .../Slim/Middleware/PrettyExceptions.php | 0 .../Slim/Middleware/SessionCookie.php | 0 geoapi/{ => thirdparty}/Slim/Route.php | 0 geoapi/{ => thirdparty}/Slim/Router.php | 0 geoapi/{ => thirdparty}/Slim/Slim.php | 0 geoapi/{ => thirdparty}/Slim/View.php | 0 28 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 geoapi/api/api.php create mode 100644 geoapi/config/config.db.php create mode 100644 geoapi/config/config.php create mode 100644 geoapi/database/mysql.php create mode 100644 geoapi/global.inc.php create mode 100644 geoapi/service/helloservice/index.php rename geoapi/{ => thirdparty}/Slim/Environment.php (100%) rename geoapi/{ => thirdparty}/Slim/Exception/Pass.php (100%) rename geoapi/{ => thirdparty}/Slim/Exception/Stop.php (100%) rename geoapi/{ => thirdparty}/Slim/Http/Headers.php (100%) rename geoapi/{ => thirdparty}/Slim/Http/Request.php (100%) rename geoapi/{ => thirdparty}/Slim/Http/Response.php (100%) rename geoapi/{ => thirdparty}/Slim/Http/Util.php (100%) rename geoapi/{ => thirdparty}/Slim/Log.php (100%) rename geoapi/{ => thirdparty}/Slim/LogWriter.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware/ContentTypes.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware/Flash.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware/MethodOverride.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware/PrettyExceptions.php (100%) rename geoapi/{ => thirdparty}/Slim/Middleware/SessionCookie.php (100%) rename geoapi/{ => thirdparty}/Slim/Route.php (100%) rename geoapi/{ => thirdparty}/Slim/Router.php (100%) rename geoapi/{ => thirdparty}/Slim/Slim.php (100%) rename geoapi/{ => thirdparty}/Slim/View.php (100%) diff --git a/geoapi/api/api.php b/geoapi/api/api.php new file mode 100644 index 0000000..408e5d6 --- /dev/null +++ b/geoapi/api/api.php @@ -0,0 +1,10 @@ + diff --git a/geoapi/config/config.db.php b/geoapi/config/config.db.php new file mode 100644 index 0000000..3e558ca --- /dev/null +++ b/geoapi/config/config.db.php @@ -0,0 +1,7 @@ + diff --git a/geoapi/config/config.php b/geoapi/config/config.php new file mode 100644 index 0000000..3e558ca --- /dev/null +++ b/geoapi/config/config.php @@ -0,0 +1,7 @@ + diff --git a/geoapi/database/mysql.php b/geoapi/database/mysql.php new file mode 100644 index 0000000..3e558ca --- /dev/null +++ b/geoapi/database/mysql.php @@ -0,0 +1,7 @@ + diff --git a/geoapi/global.inc.php b/geoapi/global.inc.php new file mode 100644 index 0000000..16ce1c5 --- /dev/null +++ b/geoapi/global.inc.php @@ -0,0 +1,7 @@ + diff --git a/geoapi/index.php b/geoapi/index.php index 25022eb..349f774 100644 --- a/geoapi/index.php +++ b/geoapi/index.php @@ -1,14 +1,4 @@ get('/hello/:name', function ($name) { - echo "Hello, $name"; -}); - -$app->run(); + echo "Welcome to GeoApi"; ?> diff --git a/geoapi/nbproject/project.properties b/geoapi/nbproject/project.properties index 67f3fcd..9e1ed20 100644 --- a/geoapi/nbproject/project.properties +++ b/geoapi/nbproject/project.properties @@ -1,4 +1,6 @@ -include.path=${php.global.include.path} +ignore.path= +include.path=\ + ${php.global.include.path} php.version=PHP_54 source.encoding=UTF-8 src.dir=. diff --git a/geoapi/nbproject/project.xml b/geoapi/nbproject/project.xml index 60d3060..07c45ed 100644 --- a/geoapi/nbproject/project.xml +++ b/geoapi/nbproject/project.xml @@ -3,7 +3,7 @@ org.netbeans.modules.php.project - PhpProject1 + GeoApi diff --git a/geoapi/service/helloservice/index.php b/geoapi/service/helloservice/index.php new file mode 100644 index 0000000..42aaa2d --- /dev/null +++ b/geoapi/service/helloservice/index.php @@ -0,0 +1,13 @@ + +get('/hello/:name', function ($name) { + echo "Hello, $name"; +}); + +$app->run(); +?> diff --git a/geoapi/Slim/Environment.php b/geoapi/thirdparty/Slim/Environment.php similarity index 100% rename from geoapi/Slim/Environment.php rename to geoapi/thirdparty/Slim/Environment.php diff --git a/geoapi/Slim/Exception/Pass.php b/geoapi/thirdparty/Slim/Exception/Pass.php similarity index 100% rename from geoapi/Slim/Exception/Pass.php rename to geoapi/thirdparty/Slim/Exception/Pass.php diff --git a/geoapi/Slim/Exception/Stop.php b/geoapi/thirdparty/Slim/Exception/Stop.php similarity index 100% rename from geoapi/Slim/Exception/Stop.php rename to geoapi/thirdparty/Slim/Exception/Stop.php diff --git a/geoapi/Slim/Http/Headers.php b/geoapi/thirdparty/Slim/Http/Headers.php similarity index 100% rename from geoapi/Slim/Http/Headers.php rename to geoapi/thirdparty/Slim/Http/Headers.php diff --git a/geoapi/Slim/Http/Request.php b/geoapi/thirdparty/Slim/Http/Request.php similarity index 100% rename from geoapi/Slim/Http/Request.php rename to geoapi/thirdparty/Slim/Http/Request.php diff --git a/geoapi/Slim/Http/Response.php b/geoapi/thirdparty/Slim/Http/Response.php similarity index 100% rename from geoapi/Slim/Http/Response.php rename to geoapi/thirdparty/Slim/Http/Response.php diff --git a/geoapi/Slim/Http/Util.php b/geoapi/thirdparty/Slim/Http/Util.php similarity index 100% rename from geoapi/Slim/Http/Util.php rename to geoapi/thirdparty/Slim/Http/Util.php diff --git a/geoapi/Slim/Log.php b/geoapi/thirdparty/Slim/Log.php similarity index 100% rename from geoapi/Slim/Log.php rename to geoapi/thirdparty/Slim/Log.php diff --git a/geoapi/Slim/LogWriter.php b/geoapi/thirdparty/Slim/LogWriter.php similarity index 100% rename from geoapi/Slim/LogWriter.php rename to geoapi/thirdparty/Slim/LogWriter.php diff --git a/geoapi/Slim/Middleware.php b/geoapi/thirdparty/Slim/Middleware.php similarity index 100% rename from geoapi/Slim/Middleware.php rename to geoapi/thirdparty/Slim/Middleware.php diff --git a/geoapi/Slim/Middleware/ContentTypes.php b/geoapi/thirdparty/Slim/Middleware/ContentTypes.php similarity index 100% rename from geoapi/Slim/Middleware/ContentTypes.php rename to geoapi/thirdparty/Slim/Middleware/ContentTypes.php diff --git a/geoapi/Slim/Middleware/Flash.php b/geoapi/thirdparty/Slim/Middleware/Flash.php similarity index 100% rename from geoapi/Slim/Middleware/Flash.php rename to geoapi/thirdparty/Slim/Middleware/Flash.php diff --git a/geoapi/Slim/Middleware/MethodOverride.php b/geoapi/thirdparty/Slim/Middleware/MethodOverride.php similarity index 100% rename from geoapi/Slim/Middleware/MethodOverride.php rename to geoapi/thirdparty/Slim/Middleware/MethodOverride.php diff --git a/geoapi/Slim/Middleware/PrettyExceptions.php b/geoapi/thirdparty/Slim/Middleware/PrettyExceptions.php similarity index 100% rename from geoapi/Slim/Middleware/PrettyExceptions.php rename to geoapi/thirdparty/Slim/Middleware/PrettyExceptions.php diff --git a/geoapi/Slim/Middleware/SessionCookie.php b/geoapi/thirdparty/Slim/Middleware/SessionCookie.php similarity index 100% rename from geoapi/Slim/Middleware/SessionCookie.php rename to geoapi/thirdparty/Slim/Middleware/SessionCookie.php diff --git a/geoapi/Slim/Route.php b/geoapi/thirdparty/Slim/Route.php similarity index 100% rename from geoapi/Slim/Route.php rename to geoapi/thirdparty/Slim/Route.php diff --git a/geoapi/Slim/Router.php b/geoapi/thirdparty/Slim/Router.php similarity index 100% rename from geoapi/Slim/Router.php rename to geoapi/thirdparty/Slim/Router.php diff --git a/geoapi/Slim/Slim.php b/geoapi/thirdparty/Slim/Slim.php similarity index 100% rename from geoapi/Slim/Slim.php rename to geoapi/thirdparty/Slim/Slim.php diff --git a/geoapi/Slim/View.php b/geoapi/thirdparty/Slim/View.php similarity index 100% rename from geoapi/Slim/View.php rename to geoapi/thirdparty/Slim/View.php From 0c684a47e60d0d0e4e1ec33a874d40a254185227 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 23 May 2013 11:36:03 +0200 Subject: [PATCH 05/17] new db create , mysql --- sql/create/createDB-20130523.sql | 197 +++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 sql/create/createDB-20130523.sql diff --git a/sql/create/createDB-20130523.sql b/sql/create/createDB-20130523.sql new file mode 100644 index 0000000..e98415e --- /dev/null +++ b/sql/create/createDB-20130523.sql @@ -0,0 +1,197 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 23. Mai 2013 um 11:30 +-- Server Version: 5.5.27 +-- PHP-Version: 5.4.7 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `geodb` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `domain` +-- + +CREATE TABLE IF NOT EXISTS `domain` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `information` +-- + +CREATE TABLE IF NOT EXISTS `information` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `place` +-- + +CREATE TABLE IF NOT EXISTS `place` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `plan` geometry NOT NULL, + `parent` int(32) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- RELATIONEN DER TABELLE `place`: +-- `parent` +-- `place` -> `id` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placealias` +-- + +CREATE TABLE IF NOT EXISTS `placealias` ( + `aid` int(32) NOT NULL AUTO_INCREMENT, + `pid` int(32) NOT NULL, + `alias` varchar(250) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`aid`,`pid`), + KEY `pid` (`pid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=1 ; + +-- +-- RELATIONEN DER TABELLE `placealias`: +-- `pid` +-- `place` -> `id` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placedomain` +-- + +CREATE TABLE IF NOT EXISTS `placedomain` ( + `pid` int(32) NOT NULL, + `did` int(32) NOT NULL, + PRIMARY KEY (`pid`,`did`), + KEY `did` (`did`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- RELATIONEN DER TABELLE `placedomain`: +-- `did` +-- `domain` -> `id` +-- `pid` +-- `place` -> `id` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placeinformation` +-- + +CREATE TABLE IF NOT EXISTS `placeinformation` ( + `pid` int(32) NOT NULL, + `iid` int(32) NOT NULL, + `value` varchar(500) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`pid`,`iid`), + KEY `iid` (`iid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- RELATIONEN DER TABELLE `placeinformation`: +-- `iid` +-- `information` -> `id` +-- `pid` +-- `place` -> `id` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placeservice` +-- + +CREATE TABLE IF NOT EXISTS `placeservice` ( + `pid` int(32) NOT NULL, + `sid` int(32) NOT NULL, + `request` varchar(250) COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`pid`,`sid`), + KEY `sid` (`sid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- +-- RELATIONEN DER TABELLE `placeservice`: +-- `sid` +-- `service` -> `id` +-- `pid` +-- `place` -> `id` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `service` +-- + +CREATE TABLE IF NOT EXISTS `service` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + `sap` varchar(250) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- +-- Constraints der exportierten Tabellen +-- + +-- +-- Constraints der Tabelle `placealias` +-- +ALTER TABLE `placealias` + ADD CONSTRAINT `placealias_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placedomain` +-- +ALTER TABLE `placedomain` + ADD CONSTRAINT `placedomain_ibfk_2` FOREIGN KEY (`did`) REFERENCES `domain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placedomain_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placeinformation` +-- +ALTER TABLE `placeinformation` + ADD CONSTRAINT `placeinformation_ibfk_2` FOREIGN KEY (`iid`) REFERENCES `information` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placeinformation_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placeservice` +-- +ALTER TABLE `placeservice` + ADD CONSTRAINT `placeservice_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placeservice_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 54e65d9f600d124f3fbf972faa8ae90e481d793c Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 5 Jun 2013 14:11:39 +0200 Subject: [PATCH 06/17] add new create srkript --- sql/create/createDB-20130605.sql | 305 +++++++++++++++++++++++++++++++ 1 file changed, 305 insertions(+) create mode 100644 sql/create/createDB-20130605.sql diff --git a/sql/create/createDB-20130605.sql b/sql/create/createDB-20130605.sql new file mode 100644 index 0000000..43f1e31 --- /dev/null +++ b/sql/create/createDB-20130605.sql @@ -0,0 +1,305 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 05. Jun 2013 um 14:09 +-- Server Version: 5.5.27 +-- PHP-Version: 5.4.7 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `geodb` +-- + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `domain` +-- + +CREATE TABLE IF NOT EXISTS `domain` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `information` +-- + +CREATE TABLE IF NOT EXISTS `information` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=2 ; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `pis` +-- +CREATE TABLE IF NOT EXISTS `pis` ( +`pid` int(32) +,`iid` int(32) +,`name` varchar(50) +,`value` varchar(500) +); +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `place` +-- + +CREATE TABLE IF NOT EXISTS `place` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `plan` geometry NOT NULL, + `parent` int(32) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=7 ; + +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placealias` +-- + +CREATE TABLE IF NOT EXISTS `placealias` ( + `aid` int(32) NOT NULL AUTO_INCREMENT, + `pid` int(32) NOT NULL, + `alias` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`aid`,`pid`), + KEY `pid` (`pid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `placealiasview` +-- +CREATE TABLE IF NOT EXISTS `placealiasview` ( +`alias` varchar(250) +,`plan` geometry +,`aid` int(32) +,`pid` int(32) +,`parent` int(32) +); +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placedomain` +-- + +CREATE TABLE IF NOT EXISTS `placedomain` ( + `pid` int(32) NOT NULL, + `did` int(32) NOT NULL, + PRIMARY KEY (`pid`,`did`), + KEY `did` (`did`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `placedomainview` +-- +CREATE TABLE IF NOT EXISTS `placedomainview` ( +`pid` int(32) +,`did` int(32) +,`name` varchar(50) +); +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placeinformation` +-- + +CREATE TABLE IF NOT EXISTS `placeinformation` ( + `pid` int(32) NOT NULL, + `iid` int(32) NOT NULL, + `value` varchar(500) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`pid`,`iid`), + KEY `iid` (`iid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `placeinformationview` +-- +CREATE TABLE IF NOT EXISTS `placeinformationview` ( +`pid` int(32) +,`iid` int(32) +,`name` varchar(50) +,`value` varchar(500) +); +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `placeservice` +-- + +CREATE TABLE IF NOT EXISTS `placeservice` ( + `pid` int(32) NOT NULL, + `sid` int(32) NOT NULL, + `request` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`pid`,`sid`), + KEY `sid` (`sid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `placeserviceview` +-- +CREATE TABLE IF NOT EXISTS `placeserviceview` ( +`pid` int(32) +,`sid` int(32) +,`name` varchar(50) +,`sap` varchar(250) +,`request` varchar(250) +); +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `pss` +-- +CREATE TABLE IF NOT EXISTS `pss` ( +`pid` int(32) +,`sid` int(32) +,`name` varchar(50) +,`sap` varchar(250) +,`request` varchar(250) +); +-- -------------------------------------------------------- + +-- +-- Tabellenstruktur für Tabelle `service` +-- + +CREATE TABLE IF NOT EXISTS `service` ( + `id` int(32) NOT NULL AUTO_INCREMENT, + `name` varchar(50) COLLATE utf8_unicode_ci NOT NULL, + `sap` varchar(250) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ; + +-- -------------------------------------------------------- + +-- +-- Stellvertreter-Struktur des Views `sps` +-- +CREATE TABLE IF NOT EXISTS `sps` ( +`id` int(32) +,`plan` geometry +,`did` int(32) +,`name` varchar(50) +,`aid` int(32) +,`alias` varchar(250) +); +-- -------------------------------------------------------- + +-- +-- Struktur des Views `pis` +-- +DROP TABLE IF EXISTS `pis`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pis` AS select `placeinformation`.`pid` AS `pid`,`placeinformation`.`iid` AS `iid`,`information`.`name` AS `name`,`placeinformation`.`value` AS `value` from ((`placeinformation` left join `place` on((`place`.`id` = `placeinformation`.`pid`))) left join `information` on((`information`.`id` = `placeinformation`.`iid`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `placealiasview` +-- +DROP TABLE IF EXISTS `placealiasview`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placealiasview` AS select `placealias`.`alias` AS `alias`,`place`.`plan` AS `plan`,`placealias`.`aid` AS `aid`,`placealias`.`pid` AS `pid`,`place`.`parent` AS `parent` from (`place` left join `placealias` on((`place`.`id` = `placealias`.`pid`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `placedomainview` +-- +DROP TABLE IF EXISTS `placedomainview`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placedomainview` AS select `placedomain`.`pid` AS `pid`,`placedomain`.`did` AS `did`,`domain`.`name` AS `name` from ((`placedomain` left join `place` on((`place`.`id` = `placedomain`.`pid`))) left join `domain` on((`domain`.`id` = `placedomain`.`did`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `placeinformationview` +-- +DROP TABLE IF EXISTS `placeinformationview`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placeinformationview` AS select `placeinformation`.`pid` AS `pid`,`placeinformation`.`iid` AS `iid`,`information`.`name` AS `name`,`placeinformation`.`value` AS `value` from ((`placeinformation` left join `place` on((`place`.`id` = `placeinformation`.`pid`))) left join `information` on((`information`.`id` = `placeinformation`.`iid`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `placeserviceview` +-- +DROP TABLE IF EXISTS `placeserviceview`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `placeserviceview` AS select `placeservice`.`pid` AS `pid`,`placeservice`.`sid` AS `sid`,`service`.`name` AS `name`,`service`.`sap` AS `sap`,`placeservice`.`request` AS `request` from ((`placeservice` left join `service` on((`service`.`id` = `placeservice`.`sid`))) left join `place` on((`place`.`id` = `placeservice`.`pid`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `pss` +-- +DROP TABLE IF EXISTS `pss`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `pss` AS select `placeservice`.`pid` AS `pid`,`placeservice`.`sid` AS `sid`,`service`.`name` AS `name`,`service`.`sap` AS `sap`,`placeservice`.`request` AS `request` from ((`placeservice` left join `service` on((`service`.`id` = `placeservice`.`sid`))) left join `place` on((`place`.`id` = `placeservice`.`pid`))); + +-- -------------------------------------------------------- + +-- +-- Struktur des Views `sps` +-- +DROP TABLE IF EXISTS `sps`; + +CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `sps` AS select `place`.`id` AS `id`,`place`.`plan` AS `plan`,`placedomain`.`did` AS `did`,`domain`.`name` AS `name`,`placealias`.`aid` AS `aid`,`placealias`.`alias` AS `alias` from (((`place` left join `placedomain` on((`place`.`id` = `placedomain`.`pid`))) left join `domain` on((`domain`.`id` = `placedomain`.`did`))) left join `placealias` on((`place`.`id` = `placealias`.`pid`))); + +-- +-- Constraints der exportierten Tabellen +-- + +-- +-- Constraints der Tabelle `placealias` +-- +ALTER TABLE `placealias` + ADD CONSTRAINT `placealias_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placedomain` +-- +ALTER TABLE `placedomain` + ADD CONSTRAINT `placedomain_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placedomain_ibfk_2` FOREIGN KEY (`did`) REFERENCES `domain` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placeinformation` +-- +ALTER TABLE `placeinformation` + ADD CONSTRAINT `placeinformation_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placeinformation_ibfk_2` FOREIGN KEY (`iid`) REFERENCES `information` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Constraints der Tabelle `placeservice` +-- +ALTER TABLE `placeservice` + ADD CONSTRAINT `placeservice_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `place` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, + ADD CONSTRAINT `placeservice_ibfk_2` FOREIGN KEY (`sid`) REFERENCES `service` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 031f8e8f19cbc6fbf33208f0604cad142bd53212 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 5 Jun 2013 14:13:30 +0200 Subject: [PATCH 07/17] add new insert skript (example) --- sql/insert/example/insert-20130605.sql | 97 ++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sql/insert/example/insert-20130605.sql diff --git a/sql/insert/example/insert-20130605.sql b/sql/insert/example/insert-20130605.sql new file mode 100644 index 0000000..62f61c5 --- /dev/null +++ b/sql/insert/example/insert-20130605.sql @@ -0,0 +1,97 @@ +-- phpMyAdmin SQL Dump +-- version 3.5.2.2 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Erstellungszeit: 05. Jun 2013 um 14:11 +-- Server Version: 5.5.27 +-- PHP-Version: 5.4.7 + +SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Datenbank: `geodb` +-- + +-- +-- Daten für Tabelle `domain` +-- + +INSERT INTO `domain` (`id`, `name`) VALUES +(1, 'public'), +(2, 'private'); + +-- +-- Daten für Tabelle `information` +-- + +INSERT INTO `information` (`id`, `name`) VALUES +(1, 'address'); + +-- +-- Daten für Tabelle `place` +-- + +INSERT INTO `place` (`id`, `plan`, `parent`) VALUES +(1, 0x00000000010300000001000000050000000000000000000000000000000000000000000000000059400000000000000000000000000000594000000000000059400000000000000000000000000000594000000000000000000000000000000000, NULL), +(2, 0x00000000010100000000000000000049400000000000004940, 1), +(5, 0x00000000010300000001000000050000000000000000000000000000000000000000000000000024400000000000000000000000000000244000000000000024400000000000000000000000000000244000000000000000000000000000000000, 1), +(6, 0x00000000010100000000000000000014400000000000001440, 5); + +-- +-- Daten für Tabelle `placealias` +-- + +INSERT INTO `placealias` (`aid`, `pid`, `alias`) VALUES +(1, 1, 'Campus'), +(2, 2, 'Mitte'), +(3, 5, 'MyHome'), +(4, 6, 'MyRoom'); + +-- +-- Daten für Tabelle `placedomain` +-- + +INSERT INTO `placedomain` (`pid`, `did`) VALUES +(1, 1), +(2, 1), +(5, 1), +(5, 2), +(6, 2); + +-- +-- Daten für Tabelle `placeinformation` +-- + +INSERT INTO `placeinformation` (`pid`, `iid`, `value`) VALUES +(1, 1, 'Unistraße'), +(2, 1, 'mitte straße'), +(5, 1, 'myStreet 3'), +(6, 1, 'room5'); + +-- +-- Daten für Tabelle `placeservice` +-- + +INSERT INTO `placeservice` (`pid`, `sid`, `request`) VALUES +(2, 2, '$center'), +(6, 1, '$temp1'); + +-- +-- Daten für Tabelle `service` +-- + +INSERT INTO `service` (`id`, `name`, `sap`) VALUES +(1, 'testService', 'https://myService//'), +(2, 'pService', 'https://publicService//'); + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 0d529ba7cba304c38c4053b678e4040b03d7d34d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 19 Jun 2013 11:09:00 +0200 Subject: [PATCH 08/17] update --- .gitignore | 1 + geoapi/service/helloservice/.htaccess | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 .gitignore create mode 100644 geoapi/service/helloservice/.htaccess diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1068b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/geoapi/nbproject/private/ \ No newline at end of file diff --git a/geoapi/service/helloservice/.htaccess b/geoapi/service/helloservice/.htaccess new file mode 100644 index 0000000..450c0d1 --- /dev/null +++ b/geoapi/service/helloservice/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine on +RewriteRule ^ index.php [QSA,L] \ No newline at end of file From 5ba6ca83877b7502473f12aaead0ec57cf76171f Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 19 Jun 2013 14:59:42 +0200 Subject: [PATCH 09/17] add SQCManager --- geoapi/api/Api.php | 31 ++++++++++++ geoapi/api/SpsApi.php | 27 +++++++++++ geoapi/database/HelloApiSQLManager.php | 26 ++++++++++ geoapi/database/SQLManager.php | 60 ++++++++++++++++++++++++ geoapi/database/SpsSqlManager.php | 14 ++++++ geoapi/database/mysql.php | 9 ++-- geoapi/global.inc.php | 2 +- geoapi/service/helloservice/HelloApi.php | 34 ++++++++++++++ geoapi/service/helloservice/index.php | 11 +++-- 9 files changed, 205 insertions(+), 9 deletions(-) create mode 100644 geoapi/api/Api.php create mode 100644 geoapi/api/SpsApi.php create mode 100644 geoapi/database/HelloApiSQLManager.php create mode 100644 geoapi/database/SQLManager.php create mode 100644 geoapi/database/SpsSqlManager.php create mode 100644 geoapi/service/helloservice/HelloApi.php diff --git a/geoapi/api/Api.php b/geoapi/api/Api.php new file mode 100644 index 0000000..fd49962 --- /dev/null +++ b/geoapi/api/Api.php @@ -0,0 +1,31 @@ +sqlManager) { + echo "bla"; + $this->sqlManager = new SQLManager(); + } + parent::__construct(); + } + + public function __destruct() { + $this->sqlManager = null; + //parent::__destruct(); + } + + public function connect() { + $this->sqlManager->connect(); + } + +} + +?> diff --git a/geoapi/api/SpsApi.php b/geoapi/api/SpsApi.php new file mode 100644 index 0000000..11c9701 --- /dev/null +++ b/geoapi/api/SpsApi.php @@ -0,0 +1,27 @@ + diff --git a/geoapi/database/HelloApiSQLManager.php b/geoapi/database/HelloApiSQLManager.php new file mode 100644 index 0000000..27914e3 --- /dev/null +++ b/geoapi/database/HelloApiSQLManager.php @@ -0,0 +1,26 @@ +query("SELECT * FROM sps"); + } + +} + +?> diff --git a/geoapi/database/SQLManager.php b/geoapi/database/SQLManager.php new file mode 100644 index 0000000..6cafa0d --- /dev/null +++ b/geoapi/database/SQLManager.php @@ -0,0 +1,60 @@ +serverAddress = $sqlServer; + $this->dbName = $sqlDBName; + $this->userName = $sqlDBUser; + $this->userPw = $sqlDBUserPW; + } + + public function __destruct() { + $this->close(); + $this->serverAddress = null; + $this->dbName = null; + $this->userName = null; + $this->userPW = null; + } + + public function connect() { + $this->link = mysql_connect($this->serverAddress, $this->userName, $this->userPw) or die("No Connection: " . mysql_error()); + mysql_select_db($this->dbName, $this->link) or die("No DB: " . mysql_error()); + } + + public function close() { + if ($this->link) { + mysql_close($this->link); + } + } + + protected function query($query) { + $mysqlResult = mysql_query($query, $this->link) or die("Query error: " . mysql_error()); + + $rowNums = mysql_num_rows($mysqlResult); + $result = array(); + for ($i = 0; $i < $rowNums; $i++) { + $row = mysql_fetch_assoc($mysqlResult); + $result[$i] = $row; + } + mysql_free_result($mysqlResult); + return $result; + } + +} + +?> diff --git a/geoapi/database/SpsSqlManager.php b/geoapi/database/SpsSqlManager.php new file mode 100644 index 0000000..52e317e --- /dev/null +++ b/geoapi/database/SpsSqlManager.php @@ -0,0 +1,14 @@ + diff --git a/geoapi/database/mysql.php b/geoapi/database/mysql.php index 3e558ca..4dcf117 100644 --- a/geoapi/database/mysql.php +++ b/geoapi/database/mysql.php @@ -1,7 +1,8 @@ diff --git a/geoapi/global.inc.php b/geoapi/global.inc.php index 16ce1c5..018a756 100644 --- a/geoapi/global.inc.php +++ b/geoapi/global.inc.php @@ -3,5 +3,5 @@ define("PATH_ROOT", dirname(__FILE__)); define("PATH_SERVICES", PATH_ROOT. "/service"); define("PATH_3PARTY", PATH_ROOT . "/thirdparty"); define("PATH_API", PATH_ROOT . "/api"); -define("PATH_DATABASE", PATH_ROOT. "/datebase"); +define("PATH_DATABASE", PATH_ROOT. "/database"); ?> diff --git a/geoapi/service/helloservice/HelloApi.php b/geoapi/service/helloservice/HelloApi.php new file mode 100644 index 0000000..4e8965a --- /dev/null +++ b/geoapi/service/helloservice/HelloApi.php @@ -0,0 +1,34 @@ +sqlManager = new HelloApiSQLManager(); + parent::__construct(); + } + + public function __destruct() { + parent::__destruct(); + } + + public function sendHelloQuery() { + return $this->sqlManager->sendHelloQuery(); + } + +} + +?> diff --git a/geoapi/service/helloservice/index.php b/geoapi/service/helloservice/index.php index 42aaa2d..f7d29d3 100644 --- a/geoapi/service/helloservice/index.php +++ b/geoapi/service/helloservice/index.php @@ -1,11 +1,14 @@ - get('/hello/:name', function ($name) { +$app->get('/hello/:name', function ($name) use ($app) { + $app->connect(); + print_r($app->sendHelloQuery()); + // print echo "Hello, $name"; }); From 765101e878cc9c61d5ceec3bd77b9e42d117f314 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 19 Jun 2013 15:00:25 +0200 Subject: [PATCH 10/17] rm api.php --- geoapi/api/api.php | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 geoapi/api/api.php diff --git a/geoapi/api/api.php b/geoapi/api/api.php deleted file mode 100644 index 408e5d6..0000000 --- a/geoapi/api/api.php +++ /dev/null @@ -1,10 +0,0 @@ - From e483304ac8170869ea9c0300b2169aae395a39c5 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Wed, 19 Jun 2013 15:31:09 +0200 Subject: [PATCH 11/17] add sps service --- geoapi/api/Api.php | 14 +++++++------ geoapi/api/SpsApi.php | 17 +++++++++++----- geoapi/database/HelloApiSQLManager.php | 4 ++-- geoapi/database/SpsSqlManager.php | 20 ++++++++++++++++--- .../{SQLManager.php => SqlManager.php} | 3 ++- geoapi/service/sps/.htaccess | 2 ++ geoapi/service/sps/index.php | 15 ++++++++++++++ 7 files changed, 58 insertions(+), 17 deletions(-) rename geoapi/database/{SQLManager.php => SqlManager.php} (96%) create mode 100644 geoapi/service/sps/.htaccess create mode 100644 geoapi/service/sps/index.php diff --git a/geoapi/api/Api.php b/geoapi/api/Api.php index fd49962..ab8bb63 100644 --- a/geoapi/api/Api.php +++ b/geoapi/api/Api.php @@ -1,7 +1,7 @@ sqlManager) { - echo "bla"; - $this->sqlManager = new SQLManager(); - } + $this->connect(); parent::__construct(); } public function __destruct() { + $this->close(); $this->sqlManager = null; //parent::__destruct(); } - public function connect() { + private function connect() { $this->sqlManager->connect(); } + private function close() { + $this->sqlManager->close(); + } + } ?> diff --git a/geoapi/api/SpsApi.php b/geoapi/api/SpsApi.php index 11c9701..3e7e431 100644 --- a/geoapi/api/SpsApi.php +++ b/geoapi/api/SpsApi.php @@ -1,7 +1,8 @@ sqlManager = new SpsSqlManager(); parent::__construct(); } - + public function __destruct() { parent::__destruct(); } + + public function sendSpsQuery($queryArgs = array()) { + return $this->sqlManager->sendSpsQuery($queryArgs); + } + } ?> diff --git a/geoapi/database/HelloApiSQLManager.php b/geoapi/database/HelloApiSQLManager.php index 27914e3..b0333d8 100644 --- a/geoapi/database/HelloApiSQLManager.php +++ b/geoapi/database/HelloApiSQLManager.php @@ -1,13 +1,13 @@ query("SELECT * FROM sps Where alias = \"$alias\""); + } } ?> diff --git a/geoapi/database/SQLManager.php b/geoapi/database/SqlManager.php similarity index 96% rename from geoapi/database/SQLManager.php rename to geoapi/database/SqlManager.php index 6cafa0d..0e9115b 100644 --- a/geoapi/database/SQLManager.php +++ b/geoapi/database/SqlManager.php @@ -7,7 +7,7 @@ include_once "../../global.inc.php"; * * @author stubbfel */ -class SQLManager { +abstract class SqlManager { private $serverAddress; private $userName; @@ -39,6 +39,7 @@ class SQLManager { public function close() { if ($this->link) { mysql_close($this->link); + $this->link =null; } } diff --git a/geoapi/service/sps/.htaccess b/geoapi/service/sps/.htaccess new file mode 100644 index 0000000..450c0d1 --- /dev/null +++ b/geoapi/service/sps/.htaccess @@ -0,0 +1,2 @@ +RewriteEngine on +RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/geoapi/service/sps/index.php b/geoapi/service/sps/index.php new file mode 100644 index 0000000..5dbe497 --- /dev/null +++ b/geoapi/service/sps/index.php @@ -0,0 +1,15 @@ +get('/alias/:alias', function ($alias) use ($app) { + $args =array(); + $args["alias"] = $alias; + print_r($app->sendSpsQuery($args)); +}); + +$app->run(); +?> From 0f21ccfe259bd1e73fffa972f60dcbba047604ae Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 20 Jun 2013 11:25:28 +0200 Subject: [PATCH 12/17] add doku --- geoapi/database/mysql.php | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 geoapi/database/mysql.php diff --git a/geoapi/database/mysql.php b/geoapi/database/mysql.php deleted file mode 100644 index 4dcf117..0000000 --- a/geoapi/database/mysql.php +++ /dev/null @@ -1,8 +0,0 @@ - From 61f8cbbf4f5f50c9c7490c8d5b2573f651e1be22 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 20 Jun 2013 11:26:10 +0200 Subject: [PATCH 13/17] add doku --- doc/404.html | 145 + doc/class-Api.html | 385 +++ doc/class-ArrayAccess.html | 284 ++ doc/class-ArrayIterator.html | 944 ++++++ doc/class-Countable.html | 195 ++ doc/class-ErrorException.html | 286 ++ doc/class-Exception.html | 528 +++ doc/class-HelloApi.html | 377 +++ doc/class-HelloApiSQLManager.html | 268 ++ doc/class-InvalidArgumentException.html | 205 ++ doc/class-Iterator.html | 320 ++ doc/class-IteratorAggregate.html | 204 ++ doc/class-LogicException.html | 202 ++ doc/class-RuntimeException.html | 198 ++ doc/class-SQLManager.html | 302 ++ doc/class-SeekableIterator.html | 216 ++ doc/class-Serializable.html | 222 ++ doc/class-SimpleXMLElement.html | 575 ++++ doc/class-Slim.Environment.html | 493 +++ doc/class-Slim.Exception.Pass.html | 193 ++ doc/class-Slim.Exception.Stop.html | 192 ++ doc/class-Slim.Http.Headers.html | 698 ++++ doc/class-Slim.Http.Request.html | 1821 ++++++++++ doc/class-Slim.Http.Response.html | 1462 ++++++++ doc/class-Slim.Http.Util.html | 596 ++++ doc/class-Slim.Log.html | 931 +++++ doc/class-Slim.LogWriter.html | 272 ++ doc/class-Slim.Middleware.ContentTypes.html | 472 +++ doc/class-Slim.Middleware.Flash.html | 719 ++++ doc/class-Slim.Middleware.MethodOverride.html | 302 ++ ...lass-Slim.Middleware.PrettyExceptions.html | 332 ++ doc/class-Slim.Middleware.SessionCookie.html | 541 +++ doc/class-Slim.Middleware.html | 420 +++ doc/class-Slim.Route.html | 1455 ++++++++ doc/class-Slim.Router.html | 690 ++++ doc/class-Slim.Slim.html | 2999 +++++++++++++++++ doc/class-Slim.View.html | 662 ++++ doc/class-SpsApi.html | 348 ++ doc/class-SpsSqlManager.html | 150 + doc/class-Traversable.html | 172 + doc/elementlist.js | 3 + doc/index.html | 164 + doc/namespace-None.html | 138 + doc/namespace-PHP.html | 189 ++ doc/namespace-Slim.Exception.html | 117 + doc/namespace-Slim.Http.html | 127 + doc/namespace-Slim.Middleware.html | 132 + doc/namespace-Slim.html | 159 + doc/resources/collapsed.png | Bin 0 -> 238 bytes doc/resources/combined.js | 1264 +++++++ doc/resources/footer.png | Bin 0 -> 8232 bytes doc/resources/inherit.png | Bin 0 -> 152 bytes doc/resources/resize.png | Bin 0 -> 216 bytes doc/resources/sort.png | Bin 0 -> 171 bytes doc/resources/style.css | 608 ++++ doc/resources/tree-cleaner.png | Bin 0 -> 126 bytes doc/resources/tree-hasnext.png | Bin 0 -> 128 bytes doc/resources/tree-last.png | Bin 0 -> 172 bytes doc/resources/tree-vertical.png | Bin 0 -> 127 bytes doc/source-class-Api.html | 134 + doc/source-class-HelloApi.html | 137 + doc/source-class-HelloApiSQLManager.html | 129 + doc/source-class-SQLManager.html | 163 + doc/source-class-Slim.Environment.html | 342 ++ doc/source-class-Slim.Exception.Pass.html | 149 + doc/source-class-Slim.Exception.Stop.html | 147 + doc/source-class-Slim.Http.Headers.html | 282 ++ doc/source-class-Slim.Http.Request.html | 686 ++++ doc/source-class-Slim.Http.Response.html | 560 +++ doc/source-class-Slim.Http.Util.html | 490 +++ doc/source-class-Slim.Log.html | 342 ++ doc/source-class-Slim.LogWriter.html | 180 + ...ce-class-Slim.Middleware.ContentTypes.html | 272 ++ doc/source-class-Slim.Middleware.Flash.html | 304 ++ ...-class-Slim.Middleware.MethodOverride.html | 198 ++ ...lass-Slim.Middleware.PrettyExceptions.html | 216 ++ ...e-class-Slim.Middleware.SessionCookie.html | 305 ++ doc/source-class-Slim.Middleware.html | 219 ++ doc/source-class-Slim.Route.html | 521 +++ doc/source-class-Slim.Router.html | 340 ++ doc/source-class-Slim.Slim.html | 1414 ++++++++ doc/source-class-Slim.View.html | 321 ++ doc/source-class-SpsApi.html | 130 + doc/source-class-SpsSqlManager.html | 117 + doc/tree.html | 477 +++ geoapi/api/Api.php | 23 +- geoapi/api/SpsApi.php | 28 +- geoapi/config/config.db.php | 23 +- geoapi/database/HelloApiSQLManager.php | 2 +- geoapi/database/SQLManager.php | 69 +- geoapi/database/SpsSqlManager.php | 5 +- geoapi/global.inc.php | 29 +- 92 files changed, 33401 insertions(+), 30 deletions(-) create mode 100644 doc/404.html create mode 100644 doc/class-Api.html create mode 100644 doc/class-ArrayAccess.html create mode 100644 doc/class-ArrayIterator.html create mode 100644 doc/class-Countable.html create mode 100644 doc/class-ErrorException.html create mode 100644 doc/class-Exception.html create mode 100644 doc/class-HelloApi.html create mode 100644 doc/class-HelloApiSQLManager.html create mode 100644 doc/class-InvalidArgumentException.html create mode 100644 doc/class-Iterator.html create mode 100644 doc/class-IteratorAggregate.html create mode 100644 doc/class-LogicException.html create mode 100644 doc/class-RuntimeException.html create mode 100644 doc/class-SQLManager.html create mode 100644 doc/class-SeekableIterator.html create mode 100644 doc/class-Serializable.html create mode 100644 doc/class-SimpleXMLElement.html create mode 100644 doc/class-Slim.Environment.html create mode 100644 doc/class-Slim.Exception.Pass.html create mode 100644 doc/class-Slim.Exception.Stop.html create mode 100644 doc/class-Slim.Http.Headers.html create mode 100644 doc/class-Slim.Http.Request.html create mode 100644 doc/class-Slim.Http.Response.html create mode 100644 doc/class-Slim.Http.Util.html create mode 100644 doc/class-Slim.Log.html create mode 100644 doc/class-Slim.LogWriter.html create mode 100644 doc/class-Slim.Middleware.ContentTypes.html create mode 100644 doc/class-Slim.Middleware.Flash.html create mode 100644 doc/class-Slim.Middleware.MethodOverride.html create mode 100644 doc/class-Slim.Middleware.PrettyExceptions.html create mode 100644 doc/class-Slim.Middleware.SessionCookie.html create mode 100644 doc/class-Slim.Middleware.html create mode 100644 doc/class-Slim.Route.html create mode 100644 doc/class-Slim.Router.html create mode 100644 doc/class-Slim.Slim.html create mode 100644 doc/class-Slim.View.html create mode 100644 doc/class-SpsApi.html create mode 100644 doc/class-SpsSqlManager.html create mode 100644 doc/class-Traversable.html create mode 100644 doc/elementlist.js create mode 100644 doc/index.html create mode 100644 doc/namespace-None.html create mode 100644 doc/namespace-PHP.html create mode 100644 doc/namespace-Slim.Exception.html create mode 100644 doc/namespace-Slim.Http.html create mode 100644 doc/namespace-Slim.Middleware.html create mode 100644 doc/namespace-Slim.html create mode 100644 doc/resources/collapsed.png create mode 100644 doc/resources/combined.js create mode 100644 doc/resources/footer.png create mode 100644 doc/resources/inherit.png create mode 100644 doc/resources/resize.png create mode 100644 doc/resources/sort.png create mode 100644 doc/resources/style.css create mode 100644 doc/resources/tree-cleaner.png create mode 100644 doc/resources/tree-hasnext.png create mode 100644 doc/resources/tree-last.png create mode 100644 doc/resources/tree-vertical.png create mode 100644 doc/source-class-Api.html create mode 100644 doc/source-class-HelloApi.html create mode 100644 doc/source-class-HelloApiSQLManager.html create mode 100644 doc/source-class-SQLManager.html create mode 100644 doc/source-class-Slim.Environment.html create mode 100644 doc/source-class-Slim.Exception.Pass.html create mode 100644 doc/source-class-Slim.Exception.Stop.html create mode 100644 doc/source-class-Slim.Http.Headers.html create mode 100644 doc/source-class-Slim.Http.Request.html create mode 100644 doc/source-class-Slim.Http.Response.html create mode 100644 doc/source-class-Slim.Http.Util.html create mode 100644 doc/source-class-Slim.Log.html create mode 100644 doc/source-class-Slim.LogWriter.html create mode 100644 doc/source-class-Slim.Middleware.ContentTypes.html create mode 100644 doc/source-class-Slim.Middleware.Flash.html create mode 100644 doc/source-class-Slim.Middleware.MethodOverride.html create mode 100644 doc/source-class-Slim.Middleware.PrettyExceptions.html create mode 100644 doc/source-class-Slim.Middleware.SessionCookie.html create mode 100644 doc/source-class-Slim.Middleware.html create mode 100644 doc/source-class-Slim.Route.html create mode 100644 doc/source-class-Slim.Router.html create mode 100644 doc/source-class-Slim.Slim.html create mode 100644 doc/source-class-Slim.View.html create mode 100644 doc/source-class-SpsApi.html create mode 100644 doc/source-class-SpsSqlManager.html create mode 100644 doc/tree.html diff --git a/doc/404.html b/doc/404.html new file mode 100644 index 0000000..0eb94e5 --- /dev/null +++ b/doc/404.html @@ -0,0 +1,145 @@ + + + + + + + + Page not found | GeoApi + + + + + + + + + + +
+ + + + diff --git a/doc/class-Api.html b/doc/class-Api.html new file mode 100644 index 0000000..7a58903 --- /dev/null +++ b/doc/class-Api.html @@ -0,0 +1,385 @@ + + + + + + + Class Api | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-ArrayAccess.html b/doc/class-ArrayAccess.html new file mode 100644 index 0000000..0ae94e1 --- /dev/null +++ b/doc/class-ArrayAccess.html @@ -0,0 +1,284 @@ + + + + + + + Interface ArrayAccess | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-ArrayIterator.html b/doc/class-ArrayIterator.html new file mode 100644 index 0000000..d003ad3 --- /dev/null +++ b/doc/class-ArrayIterator.html @@ -0,0 +1,944 @@ + + + + + + + Class ArrayIterator | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Countable.html b/doc/class-Countable.html new file mode 100644 index 0000000..d7a9527 --- /dev/null +++ b/doc/class-Countable.html @@ -0,0 +1,195 @@ + + + + + + + Interface Countable | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-ErrorException.html b/doc/class-ErrorException.html new file mode 100644 index 0000000..9171f50 --- /dev/null +++ b/doc/class-ErrorException.html @@ -0,0 +1,286 @@ + + + + + + + Class ErrorException | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Exception.html b/doc/class-Exception.html new file mode 100644 index 0000000..bd27169 --- /dev/null +++ b/doc/class-Exception.html @@ -0,0 +1,528 @@ + + + + + + + Class Exception | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-HelloApi.html b/doc/class-HelloApi.html new file mode 100644 index 0000000..828abf1 --- /dev/null +++ b/doc/class-HelloApi.html @@ -0,0 +1,377 @@ + + + + + + + Class HelloApi | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-HelloApiSQLManager.html b/doc/class-HelloApiSQLManager.html new file mode 100644 index 0000000..27bc873 --- /dev/null +++ b/doc/class-HelloApiSQLManager.html @@ -0,0 +1,268 @@ + + + + + + + Class HelloApiSQLManager | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-InvalidArgumentException.html b/doc/class-InvalidArgumentException.html new file mode 100644 index 0000000..0745522 --- /dev/null +++ b/doc/class-InvalidArgumentException.html @@ -0,0 +1,205 @@ + + + + + + + Class InvalidArgumentException | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Iterator.html b/doc/class-Iterator.html new file mode 100644 index 0000000..941b241 --- /dev/null +++ b/doc/class-Iterator.html @@ -0,0 +1,320 @@ + + + + + + + Interface Iterator | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-IteratorAggregate.html b/doc/class-IteratorAggregate.html new file mode 100644 index 0000000..c6b7815 --- /dev/null +++ b/doc/class-IteratorAggregate.html @@ -0,0 +1,204 @@ + + + + + + + Interface IteratorAggregate | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-LogicException.html b/doc/class-LogicException.html new file mode 100644 index 0000000..5218d0a --- /dev/null +++ b/doc/class-LogicException.html @@ -0,0 +1,202 @@ + + + + + + + Class LogicException | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-RuntimeException.html b/doc/class-RuntimeException.html new file mode 100644 index 0000000..107e414 --- /dev/null +++ b/doc/class-RuntimeException.html @@ -0,0 +1,198 @@ + + + + + + + Class RuntimeException | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-SQLManager.html b/doc/class-SQLManager.html new file mode 100644 index 0000000..17c3668 --- /dev/null +++ b/doc/class-SQLManager.html @@ -0,0 +1,302 @@ + + + + + + + Class SQLManager | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-SeekableIterator.html b/doc/class-SeekableIterator.html new file mode 100644 index 0000000..7cb3318 --- /dev/null +++ b/doc/class-SeekableIterator.html @@ -0,0 +1,216 @@ + + + + + + + Interface SeekableIterator | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Serializable.html b/doc/class-Serializable.html new file mode 100644 index 0000000..6d1ffc1 --- /dev/null +++ b/doc/class-Serializable.html @@ -0,0 +1,222 @@ + + + + + + + Interface Serializable | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-SimpleXMLElement.html b/doc/class-SimpleXMLElement.html new file mode 100644 index 0000000..cb8f42d --- /dev/null +++ b/doc/class-SimpleXMLElement.html @@ -0,0 +1,575 @@ + + + + + + + Class SimpleXMLElement | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Environment.html b/doc/class-Slim.Environment.html new file mode 100644 index 0000000..b9db4a8 --- /dev/null +++ b/doc/class-Slim.Environment.html @@ -0,0 +1,493 @@ + + + + + + + Class Slim\Environment | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Exception.Pass.html b/doc/class-Slim.Exception.Pass.html new file mode 100644 index 0000000..d7703c5 --- /dev/null +++ b/doc/class-Slim.Exception.Pass.html @@ -0,0 +1,193 @@ + + + + + + + Class Slim\Exception\Pass | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Exception.Stop.html b/doc/class-Slim.Exception.Stop.html new file mode 100644 index 0000000..96c351d --- /dev/null +++ b/doc/class-Slim.Exception.Stop.html @@ -0,0 +1,192 @@ + + + + + + + Class Slim\Exception\Stop | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Http.Headers.html b/doc/class-Slim.Http.Headers.html new file mode 100644 index 0000000..2d4c2b9 --- /dev/null +++ b/doc/class-Slim.Http.Headers.html @@ -0,0 +1,698 @@ + + + + + + + Class Slim\Http\Headers | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Http.Request.html b/doc/class-Slim.Http.Request.html new file mode 100644 index 0000000..4720641 --- /dev/null +++ b/doc/class-Slim.Http.Request.html @@ -0,0 +1,1821 @@ + + + + + + + Class Slim\Http\Request | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Http.Response.html b/doc/class-Slim.Http.Response.html new file mode 100644 index 0000000..199a326 --- /dev/null +++ b/doc/class-Slim.Http.Response.html @@ -0,0 +1,1462 @@ + + + + + + + Class Slim\Http\Response | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Http.Util.html b/doc/class-Slim.Http.Util.html new file mode 100644 index 0000000..25ca14a --- /dev/null +++ b/doc/class-Slim.Http.Util.html @@ -0,0 +1,596 @@ + + + + + + + Class Slim\Http\Util | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Log.html b/doc/class-Slim.Log.html new file mode 100644 index 0000000..8aa14ba --- /dev/null +++ b/doc/class-Slim.Log.html @@ -0,0 +1,931 @@ + + + + + + + Class Slim\Log | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.LogWriter.html b/doc/class-Slim.LogWriter.html new file mode 100644 index 0000000..dfca8c4 --- /dev/null +++ b/doc/class-Slim.LogWriter.html @@ -0,0 +1,272 @@ + + + + + + + Class Slim\LogWriter | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.ContentTypes.html b/doc/class-Slim.Middleware.ContentTypes.html new file mode 100644 index 0000000..13e72b9 --- /dev/null +++ b/doc/class-Slim.Middleware.ContentTypes.html @@ -0,0 +1,472 @@ + + + + + + + Class Slim\Middleware\ContentTypes | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.Flash.html b/doc/class-Slim.Middleware.Flash.html new file mode 100644 index 0000000..18ec0ec --- /dev/null +++ b/doc/class-Slim.Middleware.Flash.html @@ -0,0 +1,719 @@ + + + + + + + Class Slim\Middleware\Flash | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.MethodOverride.html b/doc/class-Slim.Middleware.MethodOverride.html new file mode 100644 index 0000000..7aeb860 --- /dev/null +++ b/doc/class-Slim.Middleware.MethodOverride.html @@ -0,0 +1,302 @@ + + + + + + + Class Slim\Middleware\MethodOverride | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.PrettyExceptions.html b/doc/class-Slim.Middleware.PrettyExceptions.html new file mode 100644 index 0000000..ffd9efa --- /dev/null +++ b/doc/class-Slim.Middleware.PrettyExceptions.html @@ -0,0 +1,332 @@ + + + + + + + Class Slim\Middleware\PrettyExceptions | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.SessionCookie.html b/doc/class-Slim.Middleware.SessionCookie.html new file mode 100644 index 0000000..ff03cdf --- /dev/null +++ b/doc/class-Slim.Middleware.SessionCookie.html @@ -0,0 +1,541 @@ + + + + + + + Class Slim\Middleware\SessionCookie | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Middleware.html b/doc/class-Slim.Middleware.html new file mode 100644 index 0000000..fbf5b5f --- /dev/null +++ b/doc/class-Slim.Middleware.html @@ -0,0 +1,420 @@ + + + + + + + Class Slim\Middleware | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Route.html b/doc/class-Slim.Route.html new file mode 100644 index 0000000..94573e5 --- /dev/null +++ b/doc/class-Slim.Route.html @@ -0,0 +1,1455 @@ + + + + + + + Class Slim\Route | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Router.html b/doc/class-Slim.Router.html new file mode 100644 index 0000000..d2b8839 --- /dev/null +++ b/doc/class-Slim.Router.html @@ -0,0 +1,690 @@ + + + + + + + Class Slim\Router | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.Slim.html b/doc/class-Slim.Slim.html new file mode 100644 index 0000000..30a4873 --- /dev/null +++ b/doc/class-Slim.Slim.html @@ -0,0 +1,2999 @@ + + + + + + + Class Slim\Slim | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Slim.View.html b/doc/class-Slim.View.html new file mode 100644 index 0000000..58d1298 --- /dev/null +++ b/doc/class-Slim.View.html @@ -0,0 +1,662 @@ + + + + + + + Class Slim\View | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-SpsApi.html b/doc/class-SpsApi.html new file mode 100644 index 0000000..fe4c1ee --- /dev/null +++ b/doc/class-SpsApi.html @@ -0,0 +1,348 @@ + + + + + + + Class SpsApi | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-SpsSqlManager.html b/doc/class-SpsSqlManager.html new file mode 100644 index 0000000..2d67b31 --- /dev/null +++ b/doc/class-SpsSqlManager.html @@ -0,0 +1,150 @@ + + + + + + + Class SpsSqlManager | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-Traversable.html b/doc/class-Traversable.html new file mode 100644 index 0000000..43abd96 --- /dev/null +++ b/doc/class-Traversable.html @@ -0,0 +1,172 @@ + + + + + + + Interface Traversable | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/elementlist.js b/doc/elementlist.js new file mode 100644 index 0000000..1759822 --- /dev/null +++ b/doc/elementlist.js @@ -0,0 +1,3 @@ + +var ApiGen = ApiGen || {}; +ApiGen.elements = [["c","Api"],["c","ArrayAccess"],["c","ArrayIterator"],["c","Countable"],["c","ErrorException"],["c","Exception"],["c","HelloApi"],["c","HelloApiSQLManager"],["c","InvalidArgumentException"],["c","Iterator"],["c","IteratorAggregate"],["c","LogicException"],["c","RuntimeException"],["c","SeekableIterator"],["c","Serializable"],["c","SimpleXMLElement"],["c","Slim\\Environment"],["c","Slim\\Exception\\Pass"],["c","Slim\\Exception\\Stop"],["c","Slim\\Http\\Headers"],["c","Slim\\Http\\Request"],["c","Slim\\Http\\Response"],["c","Slim\\Http\\Util"],["c","Slim\\Log"],["c","Slim\\LogWriter"],["c","Slim\\Middleware"],["c","Slim\\Middleware\\ContentTypes"],["c","Slim\\Middleware\\Flash"],["c","Slim\\Middleware\\MethodOverride"],["c","Slim\\Middleware\\PrettyExceptions"],["c","Slim\\Middleware\\SessionCookie"],["c","Slim\\Route"],["c","Slim\\Router"],["c","Slim\\Slim"],["c","Slim\\View"],["c","SpsApi"],["c","SpsSqlManager"],["c","SQLManager"],["c","Traversable"]]; diff --git a/doc/index.html b/doc/index.html new file mode 100644 index 0000000..64fd73a --- /dev/null +++ b/doc/index.html @@ -0,0 +1,164 @@ + + + + + + + GeoApi + + + + + + + + + + +
+ + + + diff --git a/doc/namespace-None.html b/doc/namespace-None.html new file mode 100644 index 0000000..f1eef6d --- /dev/null +++ b/doc/namespace-None.html @@ -0,0 +1,138 @@ + + + + + + + No namespace | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/namespace-PHP.html b/doc/namespace-PHP.html new file mode 100644 index 0000000..f8acea4 --- /dev/null +++ b/doc/namespace-PHP.html @@ -0,0 +1,189 @@ + + + + + + + Namespace PHP | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/namespace-Slim.Exception.html b/doc/namespace-Slim.Exception.html new file mode 100644 index 0000000..8c82cd2 --- /dev/null +++ b/doc/namespace-Slim.Exception.html @@ -0,0 +1,117 @@ + + + + + + + Namespace Slim\Exception | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/namespace-Slim.Http.html b/doc/namespace-Slim.Http.html new file mode 100644 index 0000000..31c2f0f --- /dev/null +++ b/doc/namespace-Slim.Http.html @@ -0,0 +1,127 @@ + + + + + + + Namespace Slim\Http | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/namespace-Slim.Middleware.html b/doc/namespace-Slim.Middleware.html new file mode 100644 index 0000000..8a7dbda --- /dev/null +++ b/doc/namespace-Slim.Middleware.html @@ -0,0 +1,132 @@ + + + + + + + Namespace Slim\Middleware | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/namespace-Slim.html b/doc/namespace-Slim.html new file mode 100644 index 0000000..4fb2cb3 --- /dev/null +++ b/doc/namespace-Slim.html @@ -0,0 +1,159 @@ + + + + + + + Namespace Slim | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/resources/collapsed.png b/doc/resources/collapsed.png new file mode 100644 index 0000000000000000000000000000000000000000..56e7323931a3ca5774e2e85ba622c6282c122f5f GIT binary patch literal 238 zcmeAS@N?(olHy`uVBq!ia0y~yV2}V|4mJh`h6m-gKNuJoBuiW)N`mv#O3D+9QW+dm z@{>{(JaZG%Q-e|yQz{EjrrIztFih}taSW-rmGtNTe|zV{*Yf{Mb};bXi|Gka3w+hs zFmYqu>FfU;dR").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cn||(cn=c.createElement("iframe"),cn.frameBorder=cn.width=cn.height=0),b.appendChild(cn);if(!co||!cn.createElement)co=(cn.contentWindow||cn.contentDocument).document,co.write((c.compatMode==="CSS1Compat"?"":"")+""),co.close();d=co.createElement(a),co.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cn)}cm[a]=e}return cm[a]}function cw(a,b){var c={};f.each(cs.concat.apply([],cs.slice(0,b)),function(){c[this]=a});return c}function cv(){ct=b}function cu(){setTimeout(cv,0);return ct=f.now()}function cl(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ck(){try{return new a.XMLHttpRequest}catch(b){}}function ce(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bB(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function br(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bi,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bq(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bp(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bp)}function bp(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bo(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bn(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bm(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(){return!0}function M(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.add(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;B.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return a!=null&&m.test(a)&&!isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,unknownElems:!!a.getElementsByTagName("nav").length,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",enctype:!!c.createElement("form").enctype,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.lastChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-999px",top:"-999px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
t
",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;f(function(){var a,b,d,e,g,h,i=1,j="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",l="visibility:hidden;border:0;",n="style='"+j+"border:5px solid #000;padding:0;'",p="
"+""+"
";m=c.getElementsByTagName("body")[0];!m||(a=c.createElement("div"),a.style.cssText=l+"width:0;height:0;position:static;top:0;margin-top:"+i+"px",m.insertBefore(a,m.firstChild),o=c.createElement("div"),o.style.cssText=j+l,o.innerHTML=p,a.appendChild(o),b=o.firstChild,d=b.firstChild,g=b.nextSibling.firstChild.firstChild,h={doesNotAddBorder:d.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},d.style.position="fixed",d.style.top="20px",h.fixedPosition=d.offsetTop===20||d.offsetTop===15,d.style.position=d.style.top="",b.style.overflow="hidden",b.style.position="relative",h.subtractsBorderForOverflowNotVisible=d.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=m.offsetTop!==i,m.removeChild(a),o=a=null,f.extend(k,h))}),o.innerHTML="",n.removeChild(o),o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[f.expando]:a[f.expando]&&f.expando,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[f.expando]=n=++f.uuid:n=f.expando),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[f.expando]:f.expando;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)?b=b:b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" "));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];if(!arguments.length){if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}return b}e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!a||j===3||j===8||j===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g},removeAttr:function(a,b){var c,d,e,g,h=0;if(a.nodeType===1){d=(b||"").split(p),g=d.length;for(;h=0}})});var z=/\.(.*)$/,A=/^(?:textarea|input|select)$/i,B=/\./g,C=/ /g,D=/[^\w\s.|`]/g,E=/^([^\.]*)?(?:\.(.+))?$/,F=/\bhover(\.\S+)?/,G=/^key/,H=/^(?:mouse|contextmenu)|click/,I=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,J=function(a){var b=I.exec(a);b&& +(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},K=function(a,b){return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||a.id===b[2])&&(!b[3]||b[3].test(a.className))},L=function(a){return f.event.special.hover?a:a.replace(F,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=L(c).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"",(g||!e)&&c.preventDefault();if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,n=null;for(m=e.parentNode;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l=0:t===b&&(t=o[s]=r.quick?K(m,r.quick):f(m).is(s)),t&&q.push(r);q.length&&j.push({elem:m,matches:q})}d.length>e&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),G.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),H.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y="abbr article aside audio canvas datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",Z=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,_=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,ba=/<([\w:]+)/,bb=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bk=X(c);bj.optgroup=bj.option,bj.tbody=bj.tfoot=bj.colgroup=bj.caption=bj.thead,bj.th=bj.td,f.support.htmlSerialize||(bj._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after" +,arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Z,""):null;if(typeof a=="string"&&!bd.test(a)&&(f.support.leadingWhitespace||!$.test(a))&&!bj[(ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(_,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bn(a,d),e=bo(a),g=bo(d);for(h=0;e[h];++h)g[h]&&bn(e[h],g[h])}if(b){bm(a,d);if(c){e=bo(a),g=bo(d);for(h=0;e[h];++h)bm(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bc.test(k))k=b.createTextNode(k);else{k=k.replace(_,"<$1>");var l=(ba.exec(k)||["",""])[1].toLowerCase(),m=bj[l]||bj._default,n=m[0],o=b.createElement("div");b===c?bk.appendChild(o):X(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=bb.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&$.test(k)&&o.insertBefore(b.createTextNode($.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bt.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bs,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bs.test(g)?g.replace(bs,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bB(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bC=function(a,c){var d,e,g;c=c.replace(bu,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bD=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bv.test(f)&&bw.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bB=bC||bD,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bF=/%20/g,bG=/\[\]$/,bH=/\r?\n/g,bI=/#.*$/,bJ=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bK=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bL=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bM=/^(?:GET|HEAD)$/,bN=/^\/\//,bO=/\?/,bP=/)<[^<]*)*<\/script>/gi,bQ=/^(?:select|textarea)/i,bR=/\s+/,bS=/([?&])_=[^&]*/,bT=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bU=f.fn.load,bV={},bW={},bX,bY,bZ=["*/"]+["*"];try{bX=e.href}catch(b$){bX=c.createElement("a"),bX.href="",bX=bX.href}bY=bT.exec(bX.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bU)return bU.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bP,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bQ.test(this.nodeName)||bK.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bH,"\r\n")}}):{name:b.name,value:c.replace(bH,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?cb(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),cb(a,b);return a},ajaxSettings:{url:bX,isLocal:bL.test(bY[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bZ},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:b_(bV),ajaxTransport:b_(bW),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cd(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=ce(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bJ.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bI,"").replace(bN,bY[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bR),d.crossDomain==null&&(r=bT.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bY[1]&&r[2]==bY[2]&&(r[3]||(r[1]==="http:"?80:443))==(bY[3]||(bY[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),ca(bV,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bM.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bO.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bS,"$1_="+x);d.url=y+(y===d.url?(bO.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bZ+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=ca(bW,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)cc(g,a[g],c,e);return d.join("&").replace(bF,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cf=f.now(),cg=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cf++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cg.test(b.url)||e&&cg.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cg,l),b.url===j&&(e&&(k=k.replace(cg,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ch=a.ActiveXObject?function(){for(var a in cj)cj[a](0,1)}:!1,ci=0,cj;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ck()||cl()}:ck,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ch&&delete cj[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++ci,ch&&(cj||(cj={},f(a).unload(ch)),cj[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cm={},cn,co,cp=/^(?:toggle|show|hide)$/,cq=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cr,cs=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],ct;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cw("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cz.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cz.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cA(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cA(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); +/** + * Cookie plugin + * + * Copyright (c) 2006 Klaus Hartl (stilbuero.de) + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + */ + +/** + * Create a cookie with the given name and value and other optional parameters. + * + * @example $.cookie('the_cookie', 'the_value'); + * @desc Set the value of a cookie. + * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); + * @desc Create a cookie with all available options. + * @example $.cookie('the_cookie', 'the_value'); + * @desc Create a session cookie. + * @example $.cookie('the_cookie', null); + * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain + * used when the cookie was set. + * + * @param String name The name of the cookie. + * @param String value The value of the cookie. + * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. + * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. + * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. + * If set to null or omitted, the cookie will be a session cookie and will not be retained + * when the the browser exits. + * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). + * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). + * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will + * require a secure protocol (like HTTPS). + * @type undefined + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ + +/** + * Get the value of a cookie with the given name. + * + * @example $.cookie('the_cookie'); + * @desc Get the value of a cookie. + * + * @param String name The name of the cookie. + * @return The value of the cookie. + * @type String + * + * @name $.cookie + * @cat Plugins/Cookie + * @author Klaus Hartl/klaus.hartl@stilbuero.de + */ +jQuery.cookie = function(name, value, options) { + if (typeof value != 'undefined') { // name and value given, set cookie + options = options || {}; + if (value === null) { + value = ''; + options.expires = -1; + } + var expires = ''; + if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { + var date; + if (typeof options.expires == 'number') { + date = new Date(); + date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); + } else { + date = options.expires; + } + expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE + } + // CAUTION: Needed to parenthesize options.path and options.domain + // in the following expressions, otherwise they evaluate to undefined + // in the packed version for some reason... + var path = options.path ? '; path=' + (options.path) : ''; + var domain = options.domain ? '; domain=' + (options.domain) : ''; + var secure = options.secure ? '; secure' : ''; + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); + } else { // only name given, get cookie + var cookieValue = null; + if (document.cookie && document.cookie != '') { + var cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + var cookie = jQuery.trim(cookies[i]); + // Does this cookie string begin with the name we want? + if (cookie.substring(0, name.length + 1) == (name + '=')) { + cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); + break; + } + } + } + return cookieValue; + } +}; +/*! + * sprintf and vsprintf for jQuery + * somewhat based on http://jan.moesen.nu/code/javascript/sprintf-and-printf-in-javascript/ + * Copyright (c) 2008 Sabin Iacob (m0n5t3r) + * @license http://www.gnu.org/licenses/gpl.html + * @project jquery.sprintf + */ +(function(d){var a={b:function(e){return parseInt(e,10).toString(2)},c:function(e){return String.fromCharCode(parseInt(e,10))},d:function(e){return parseInt(e,10)},u:function(e){return Math.abs(e)},f:function(f,e){e=parseInt(e,10);f=parseFloat(f);if(isNaN(e&&f)){return NaN}return e&&f.toFixed(e)||f},o:function(e){return parseInt(e,10).toString(8)},s:function(e){return e},x:function(e){return(""+parseInt(e,10).toString(16)).toLowerCase()},X:function(e){return(""+parseInt(e,10).toString(16)).toUpperCase()}};var c=/%(?:(\d+)?(?:\.(\d+))?|\(([^)]+)\))([%bcdufosxX])/g;var b=function(f){if(f.length==1&&typeof f[0]=="object"){f=f[0];return function(i,h,k,j,g,m,l){return a[g](f[j])}}else{var e=0;return function(i,h,k,j,g,m,l){if(g=="%"){return"%"}return a[g](f[e++],k)}}};d.extend({sprintf:function(f){var e=Array.apply(null,arguments).slice(1);return f.replace(c,b(e))},vsprintf:function(f,e){return f.replace(c,b(e))}})})(jQuery); + +/*! + * jQuery Autocomplete plugin 1.1 + * + * Copyright (c) 2009 Jörn Zaefferer + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + * + * Revision: $Id: jquery.autocomplete.js 15 2009-08-22 10:30:27Z joern.zaefferer $ + */ + +;(function($) { + +$.fn.extend({ + autocomplete: function(urlOrData, options) { + var isUrl = typeof urlOrData == "string"; + options = $.extend({}, $.Autocompleter.defaults, { + url: isUrl ? urlOrData : null, + data: isUrl ? null : urlOrData, + delay: isUrl ? $.Autocompleter.defaults.delay : 10, + max: options && !options.scroll ? 10 : 150 + }, options); + + // if highlight is set to false, replace it with a do-nothing function + options.highlight = options.highlight || function(value) { return value; }; + + // if the formatMatch option is not specified, then use formatItem for backwards compatibility + options.formatMatch = options.formatMatch || options.formatItem; + + options.show = options.show || function(list) {}; + + return this.each(function() { + new $.Autocompleter(this, options); + }); + }, + result: function(handler) { + return this.bind("result", handler); + }, + search: function(handler) { + return this.trigger("search", [handler]); + }, + flushCache: function() { + return this.trigger("flushCache"); + }, + setOptions: function(options){ + return this.trigger("setOptions", [options]); + }, + unautocomplete: function() { + return this.trigger("unautocomplete"); + } +}); + +$.Autocompleter = function(input, options) { + + var KEY = { + UP: 38, + DOWN: 40, + DEL: 46, + TAB: 9, + RETURN: 13, + ESC: 27, + COMMA: 188, + PAGEUP: 33, + PAGEDOWN: 34, + BACKSPACE: 8 + }; + + // Create $ object for input element + var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); + + var timeout; + var previousValue = ""; + var cache = $.Autocompleter.Cache(options); + var hasFocus = 0; + var lastKeyPressCode; + var config = { + mouseDownOnSelect: false + }; + var select = $.Autocompleter.Select(options, input, selectCurrent, config); + + // only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all + $input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) { + // a keypress means the input has focus + // avoids issue where input had focus before the autocomplete was applied + hasFocus = 1; + // track last key pressed + lastKeyPressCode = event.keyCode; + switch(event.keyCode) { + + case KEY.UP: + event.preventDefault(); + if ( select.visible() ) { + select.prev(); + } else { + onChange(0, true); + } + break; + + case KEY.DOWN: + event.preventDefault(); + if ( select.visible() ) { + select.next(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEUP: + event.preventDefault(); + if ( select.visible() ) { + select.pageUp(); + } else { + onChange(0, true); + } + break; + + case KEY.PAGEDOWN: + event.preventDefault(); + if ( select.visible() ) { + select.pageDown(); + } else { + onChange(0, true); + } + break; + + // matches also semicolon + case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: + case KEY.TAB: + case KEY.RETURN: + if( selectCurrent() ) { + //event.preventDefault(); + //return false; + } + break; + + case KEY.ESC: + select.hide(); + break; + + default: + clearTimeout(timeout); + timeout = setTimeout(onChange, options.delay); + break; + } + }).focus(function(){ + // track whether the field has focus, we shouldn't process any + // results if the field no longer has focus + hasFocus++; + }).blur(function() { + hasFocus = 0; + if (!config.mouseDownOnSelect) { + hideResults(); + } + }).click(function() { + // show select when clicking in a focused field + if ( hasFocus++ > 1 && !select.visible() ) { + onChange(0, true); + } + }).bind("search", function() { + // TODO why not just specifying both arguments? + var fn = (arguments.length > 1) ? arguments[1] : null; + function findValueCallback(q, data) { + var result; + if( data && data.length ) { + for (var i=0; i < data.length; i++) { + if( data[i].result.toLowerCase() == q.toLowerCase() ) { + result = data[i]; + break; + } + } + } + if( typeof fn == "function" ) fn(result); + else $input.trigger("result", result && [result.data, result.value]); + } + $.each(trimWords($input.val()), function(i, value) { + request(value, findValueCallback, findValueCallback); + }); + }).bind("flushCache", function() { + cache.flush(); + }).bind("setOptions", function() { + $.extend(options, arguments[1]); + // if we've updated the data, repopulate + if ( "data" in arguments[1] ) + cache.populate(); + }).bind("unautocomplete", function() { + select.unbind(); + $input.unbind(); + $(input.form).unbind(".autocomplete"); + }); + + + function selectCurrent() { + var selected = select.selected(); + if( !selected ) + return false; + + var v = selected.result; + previousValue = v; + + if ( options.multiple ) { + var words = trimWords($input.val()); + if ( words.length > 1 ) { + var seperator = options.multipleSeparator.length; + var cursorAt = $(input).selection().start; + var wordAt, progress = 0; + $.each(words, function(i, word) { + progress += word.length; + if (cursorAt <= progress) { + wordAt = i; + return false; + } + progress += seperator; + }); + words[wordAt] = v; + // TODO this should set the cursor to the right position, but it gets overriden somewhere + //$.Autocompleter.Selection(input, progress + seperator, progress + seperator); + v = words.join( options.multipleSeparator ); + } + v += options.multipleSeparator; + } + + $input.val(v); + hideResultsNow(); + $input.trigger("result", [selected.data, selected.value]); + return true; + } + + function onChange(crap, skipPrevCheck) { + if( lastKeyPressCode == KEY.DEL ) { + select.hide(); + return; + } + + var currentValue = $input.val(); + + if ( !skipPrevCheck && currentValue == previousValue ) + return; + + previousValue = currentValue; + + currentValue = lastWord(currentValue); + if ( currentValue.length >= options.minChars) { + $input.addClass(options.loadingClass); + if (!options.matchCase) + currentValue = currentValue.toLowerCase(); + request(currentValue, receiveData, hideResultsNow); + } else { + stopLoading(); + select.hide(); + } + }; + + function trimWords(value) { + if (!value) + return [""]; + if (!options.multiple) + return [$.trim(value)]; + return $.map(value.split(options.multipleSeparator), function(word) { + return $.trim(value).length ? $.trim(word) : null; + }); + } + + function lastWord(value) { + if ( !options.multiple ) + return value; + var words = trimWords(value); + if (words.length == 1) + return words[0]; + var cursorAt = $(input).selection().start; + if (cursorAt == value.length) { + words = trimWords(value) + } else { + words = trimWords(value.replace(value.substring(cursorAt), "")); + } + return words[words.length - 1]; + } + + // fills in the input box w/the first match (assumed to be the best match) + // q: the term entered + // sValue: the first matching result + function autoFill(q, sValue){ + // autofill in the complete box w/the first match as long as the user hasn't entered in more data + // if the last user key pressed was backspace, don't autofill + if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) { + // fill in the value (keep the case the user has typed) + $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); + // select the portion of the value not typed by the user (so the next character will erase) + $(input).selection(previousValue.length, previousValue.length + sValue.length); + } + }; + + function hideResults() { + clearTimeout(timeout); + timeout = setTimeout(hideResultsNow, 200); + }; + + function hideResultsNow() { + var wasVisible = select.visible(); + select.hide(); + clearTimeout(timeout); + stopLoading(); + if (options.mustMatch) { + // call search and run callback + $input.search( + function (result){ + // if no value found, clear the input box + if( !result ) { + if (options.multiple) { + var words = trimWords($input.val()).slice(0, -1); + $input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") ); + } + else { + $input.val( "" ); + $input.trigger("result", null); + } + } + } + ); + } + }; + + function receiveData(q, data) { + if ( data && data.length && hasFocus ) { + stopLoading(); + select.display(data, q); + autoFill(q, data[0].value); + select.show(); + } else { + hideResultsNow(); + } + }; + + function request(term, success, failure) { + if (!options.matchCase) + term = term.toLowerCase(); + var data = cache.load(term); + // recieve the cached data + if (data && data.length) { + success(term, data); + // if an AJAX url has been supplied, try loading the data now + } else if( (typeof options.url == "string") && (options.url.length > 0) ){ + + var extraParams = { + timestamp: +new Date() + }; + $.each(options.extraParams, function(key, param) { + extraParams[key] = typeof param == "function" ? param() : param; + }); + + $.ajax({ + // try to leverage ajaxQueue plugin to abort previous requests + mode: "abort", + // limit abortion to this input + port: "autocomplete" + input.name, + dataType: options.dataType, + url: options.url, + data: $.extend({ + q: lastWord(term), + limit: options.max + }, extraParams), + success: function(data) { + var parsed = options.parse && options.parse(data) || parse(data); + cache.add(term, parsed); + success(term, parsed); + } + }); + } else { + // if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match + select.emptyList(); + failure(term); + } + }; + + function parse(data) { + var parsed = []; + var rows = data.split("\n"); + for (var i=0; i < rows.length; i++) { + var row = $.trim(rows[i]); + if (row) { + row = row.split("|"); + parsed[parsed.length] = { + data: row, + value: row[0], + result: options.formatResult && options.formatResult(row, row[0]) || row[0] + }; + } + } + return parsed; + }; + + function stopLoading() { + $input.removeClass(options.loadingClass); + }; + +}; + +$.Autocompleter.defaults = { + inputClass: "ac_input", + resultsClass: "ac_results", + loadingClass: "ac_loading", + minChars: 1, + delay: 400, + matchCase: false, + matchSubset: true, + matchContains: false, + cacheLength: 10, + max: 100, + mustMatch: false, + extraParams: {}, + selectFirst: true, + formatItem: function(row) { return row[0]; }, + formatMatch: null, + autoFill: false, + width: 0, + multiple: false, + multipleSeparator: ", ", + highlight: function(value, term) { + return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1"); + }, + scroll: true, + scrollHeight: 180 +}; + +$.Autocompleter.Cache = function(options) { + + var data = {}; + var length = 0; + + function matchSubset(s, sub) { + if (!options.matchCase) + s = s.toLowerCase(); + var i = s.indexOf(sub); + if (options.matchContains == "word"){ + i = s.toLowerCase().search("\\b" + sub.toLowerCase()); + } + if (i == -1) return false; + return i == 0 || options.matchContains; + }; + + function add(q, value) { + if (length > options.cacheLength){ + flush(); + } + if (!data[q]){ + length++; + } + data[q] = value; + } + + function populate(){ + if( !options.data ) return false; + // track the matches + var stMatchSets = {}, + nullData = 0; + + // no url was specified, we need to adjust the cache length to make sure it fits the local data store + if( !options.url ) options.cacheLength = 1; + + // track all options for minChars = 0 + stMatchSets[""] = []; + + // loop through the array and create a lookup structure + for ( var i = 0, ol = options.data.length; i < ol; i++ ) { + var rawValue = options.data[i]; + // if rawValue is a string, make an array otherwise just reference the array + rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; + + var value = options.formatMatch(rawValue, i+1, options.data.length); + if ( value === false ) + continue; + + var firstChar = value.charAt(0).toLowerCase(); + // if no lookup array for this character exists, look it up now + if( !stMatchSets[firstChar] ) + stMatchSets[firstChar] = []; + + // if the match is a string + var row = { + value: value, + data: rawValue, + result: options.formatResult && options.formatResult(rawValue) || value + }; + + // push the current match into the set list + stMatchSets[firstChar].push(row); + + // keep track of minChars zero items + if ( nullData++ < options.max ) { + stMatchSets[""].push(row); + } + }; + + // add the data items to the cache + $.each(stMatchSets, function(i, value) { + // increase the cache size + options.cacheLength++; + // add to the cache + add(i, value); + }); + } + + // populate any existing data + setTimeout(populate, 25); + + function flush(){ + data = {}; + length = 0; + } + + return { + flush: flush, + add: add, + populate: populate, + load: function(q) { + if (!options.cacheLength || !length) + return null; + /* + * if dealing w/local data and matchContains than we must make sure + * to loop through all the data collections looking for matches + */ + if( !options.url && options.matchContains ){ + // track all matches + var csub = []; + // loop through all the data grids for matches + for( var k in data ){ + // don't search through the stMatchSets[""] (minChars: 0) cache + // this prevents duplicates + if( k.length > 0 ){ + var c = data[k]; + $.each(c, function(i, x) { + // if we've got a match, add it to the array + if (matchSubset(x.value, q)) { + csub.push(x); + } + }); + } + } + return csub; + } else + // if the exact item exists, use it + if (data[q]){ + return data[q]; + } else + if (options.matchSubset) { + for (var i = q.length - 1; i >= options.minChars; i--) { + var c = data[q.substr(0, i)]; + if (c) { + var csub = []; + $.each(c, function(i, x) { + if (matchSubset(x.value, q)) { + csub[csub.length] = x; + } + }); + return csub; + } + } + } + return null; + } + }; +}; + +$.Autocompleter.Select = function (options, input, select, config) { + var CLASSES = { + ACTIVE: "ac_over" + }; + + var listItems, + active = -1, + data, + term = "", + needsInit = true, + element, + list; + + // Create results + function init() { + if (!needsInit) + return; + element = $("
") + .hide() + .addClass(options.resultsClass) + .css("position", "absolute") + .appendTo(document.body); + + list = $("
    ").appendTo(element).mouseover( function(event) { + if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { + active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); + $(target(event)).addClass(CLASSES.ACTIVE); + } + }).click(function(event) { + $(target(event)).addClass(CLASSES.ACTIVE); + select(); + // TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus + input.focus(); + return false; + }).mousedown(function() { + config.mouseDownOnSelect = true; + }).mouseup(function() { + config.mouseDownOnSelect = false; + }); + + if( options.width > 0 ) + element.css("width", options.width); + + needsInit = false; + } + + function target(event) { + var element = event.target; + while(element && element.tagName != "LI") + element = element.parentNode; + // more fun with IE, sometimes event.target is empty, just ignore it then + if(!element) + return []; + return element; + } + + function moveSelect(step) { + listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE); + movePosition(step); + var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); + if(options.scroll) { + var offset = 0; + listItems.slice(0, active).each(function() { + offset += this.offsetHeight; + }); + if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { + list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); + } else if(offset < list.scrollTop()) { + list.scrollTop(offset); + } + } + }; + + function movePosition(step) { + active += step; + if (active < 0) { + active = listItems.size() - 1; + } else if (active >= listItems.size()) { + active = 0; + } + } + + function limitNumberOfItems(available) { + return options.max && options.max < available + ? options.max + : available; + } + + function fillList() { + list.empty(); + var max = limitNumberOfItems(data.length); + for (var i=0; i < max; i++) { + if (!data[i]) + continue; + var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); + if ( formatted === false ) + continue; + var li = $("
  • ").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0]; + $.data(li, "ac_data", data[i]); + } + listItems = list.find("li"); + if ( options.selectFirst ) { + listItems.slice(0, 1).addClass(CLASSES.ACTIVE); + active = 0; + } + // apply bgiframe if available + if ( $.fn.bgiframe ) + list.bgiframe(); + } + + return { + display: function(d, q) { + init(); + data = d; + term = q; + fillList(); + }, + next: function() { + moveSelect(1); + }, + prev: function() { + moveSelect(-1); + }, + pageUp: function() { + if (active != 0 && active - 8 < 0) { + moveSelect( -active ); + } else { + moveSelect(-8); + } + }, + pageDown: function() { + if (active != listItems.size() - 1 && active + 8 > listItems.size()) { + moveSelect( listItems.size() - 1 - active ); + } else { + moveSelect(8); + } + }, + hide: function() { + element && element.hide(); + listItems && listItems.removeClass(CLASSES.ACTIVE); + active = -1; + }, + visible : function() { + return element && element.is(":visible"); + }, + current: function() { + return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); + }, + show: function() { + var offset = $(input).offset(); + element.css({ + width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).innerWidth(), + top: offset.top + input.offsetHeight, + left: offset.left + }).show(); + options.show(element); + if(options.scroll) { + list.scrollTop(0); + list.css({ + maxHeight: options.scrollHeight, + overflow: 'auto' + }); + + if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { + var listHeight = 0; + listItems.each(function() { + listHeight += this.offsetHeight; + }); + var scrollbarsVisible = listHeight > options.scrollHeight; + list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); + if (!scrollbarsVisible) { + // IE doesn't recalculate width when scrollbar disappears + listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); + } + } + + } + }, + selected: function() { + var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); + return selected && selected.length && $.data(selected[0], "ac_data"); + }, + emptyList: function (){ + list && list.empty(); + }, + unbind: function() { + element && element.remove(); + } + }; +}; + +$.fn.selection = function(start, end) { + if (start !== undefined) { + return this.each(function() { + if( this.createTextRange ){ + var selRange = this.createTextRange(); + if (end === undefined || start == end) { + selRange.move("character", start); + selRange.select(); + } else { + selRange.collapse(true); + selRange.moveStart("character", start); + selRange.moveEnd("character", end); + selRange.select(); + } + } else if( this.setSelectionRange ){ + this.setSelectionRange(start, end); + } else if( this.selectionStart ){ + this.selectionStart = start; + this.selectionEnd = end; + } + }); + } + var field = this[0]; + if ( field.createTextRange ) { + var range = document.selection.createRange(), + orig = field.value, + teststring = "<->", + textLength = range.text.length; + range.text = teststring; + var caretAt = field.value.indexOf(teststring); + field.value = orig; + this.selection(caretAt, caretAt + textLength); + return { + start: caretAt, + end: caretAt + textLength + } + } else if( field.selectionStart !== undefined ){ + return { + start: field.selectionStart, + end: field.selectionEnd + } + } +}; + +})(jQuery); +/** + * jQuery.fn.sortElements + * -------------- + * @author James Padolsey (http://james.padolsey.com) + * @version 0.11 + * @updated 18-MAR-2010 + * -------------- + * @param Function comparator: + * Exactly the same behaviour as [1,2,3].sort(comparator) + * + * @param Function getSortable + * A function that should return the element that is + * to be sorted. The comparator will run on the + * current collection, but you may want the actual + * resulting sort to occur on a parent or another + * associated element. + * + * E.g. $('td').sortElements(comparator, function(){ + * return this.parentNode; + * }) + * + * The
) will be sorted instead + * of the diff --git a/doc/class-HelloApi.html b/doc/class-api.SpsApi.html similarity index 78% rename from doc/class-HelloApi.html rename to doc/class-api.SpsApi.html index 828abf1..a548592 100644 --- a/doc/class-HelloApi.html +++ b/doc/class-api.SpsApi.html @@ -4,10 +4,10 @@ - Class HelloApi | GeoApi + Class api\SpsApi | GeoApi - + @@ -21,7 +21,11 @@

Namespaces

@@ -190,14 +192,18 @@ - +
's parent (
itself. + */ +jQuery.fn.sortElements = (function(){ + + var sort = [].sort; + + return function(comparator, getSortable) { + + getSortable = getSortable || function(){return this;}; + + var placements = this.map(function(){ + + var sortElement = getSortable.call(this), + parentNode = sortElement.parentNode, + + // Since the element itself will change position, we have + // to have some way of storing it's original position in + // the DOM. The easiest way is to have a 'flag' node: + nextSibling = parentNode.insertBefore( + document.createTextNode(''), + sortElement.nextSibling + ); + + return function() { + + if (parentNode === this) { + throw new Error( + "You can't sort elements if any one is a descendant of another." + ); + } + + // Insert before flag: + parentNode.insertBefore(this, nextSibling); + // Remove flag: + parentNode.removeChild(nextSibling); + + }; + + }); + + return sort.call(this, comparator).each(function(i){ + placements[i].call(getSortable.call(this)); + }); + + }; + +})(); +/*! + * ApiGen 2.8.0 - API documentation generator for PHP 5.3+ + * + * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) + * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) + * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) + * + * For the full copyright and license information, please view + * the file LICENSE.md that was distributed with this source code. + */ + +$(function() { + var $document = $(document); + var $left = $('#left'); + var $right = $('#right'); + var $rightInner = $('#rightInner'); + var $splitter = $('#splitter'); + var $groups = $('#groups'); + var $content = $('#content'); + + // Menu + + // Hide deep packages and namespaces + $('ul span', $groups).click(function(event) { + event.preventDefault(); + event.stopPropagation(); + $(this) + .toggleClass('collapsed') + .parent() + .next('ul') + .toggleClass('collapsed'); + }).click(); + + $active = $('ul li.active', $groups); + if ($active.length > 0) { + // Open active + $('> a > span', $active).click(); + } else { + $main = $('> ul > li.main', $groups); + if ($main.length > 0) { + // Open first level of the main project + $('> a > span', $main).click(); + } else { + // Open first level of all + $('> ul > li > a > span', $groups).click(); + } + } + + // Content + + // Search autocompletion + var autocompleteFound = false; + var autocompleteFiles = {'c': 'class', 'co': 'constant', 'f': 'function', 'm': 'class', 'mm': 'class', 'p': 'class', 'mp': 'class', 'cc': 'class'}; + var $search = $('#search input[name=q]'); + $search + .autocomplete(ApiGen.elements, { + matchContains: true, + scrollHeight: 200, + max: 20, + formatItem: function(data) { + return data[1].replace(/^(.+\\)(.+)$/, '$1$2'); + }, + formatMatch: function(data) { + return data[1]; + }, + formatResult: function(data) { + return data[1]; + }, + show: function($list) { + var $items = $('li span', $list); + var maxWidth = Math.max.apply(null, $items.map(function() { + return $(this).width(); + })); + // 10px padding + $list + .width(Math.max(maxWidth + 10, $search.innerWidth())) + .css('left', $search.offset().left + $search.outerWidth() - $list.outerWidth()); + } + }).result(function(event, data) { + autocompleteFound = true; + var location = window.location.href.split('/'); + location.pop(); + var parts = data[1].split(/::|$/); + var file = $.sprintf(ApiGen.config.templates.main[autocompleteFiles[data[0]]].filename, parts[0].replace(/[^\w]/g, '.')); + if (parts[1]) { + file += '#' + ('mm' === data[0] || 'mp' === data[0] ? 'm' : '') + parts[1].replace(/([\w]+)\(\)/, '_$1'); + } + location.push(file); + window.location = location.join('/'); + + // Workaround for Opera bug + $(this).closest('form').attr('action', location.join('/')); + }).closest('form') + .submit(function() { + var query = $search.val(); + if ('' === query) { + return false; + } + + var label = $('#search input[name=more]').val(); + if (!autocompleteFound && label && -1 === query.indexOf('more:')) { + $search.val(query + ' more:' + label); + } + + return !autocompleteFound && '' !== $('#search input[name=cx]').val(); + }); + + // Save natural order + $('table.summary tr[data-order]', $content).each(function(index) { + do { + index = '0' + index; + } while (index.length < 3); + $(this).attr('data-order-natural', index); + }); + + // Switch between natural and alphabetical order + var $caption = $('table.summary', $content) + .filter(':has(tr[data-order])') + .find('caption'); + $caption + .click(function() { + var $this = $(this); + var order = $this.data('order') || 'natural'; + order = 'natural' === order ? 'alphabetical' : 'natural'; + $this.data('order', order); + $.cookie('order', order, {expires: 365}); + var attr = 'alphabetical' === order ? 'data-order' : 'data-order-natural'; + $this + .closest('table') + .find('tr').sortElements(function(a, b) { + return $(a).attr(attr) > $(b).attr(attr) ? 1 : -1; + }); + return false; + }) + .addClass('switchable') + .attr('title', 'Switch between natural and alphabetical order'); + if ((null === $.cookie('order') && 'alphabetical' === ApiGen.config.options.elementsOrder) || 'alphabetical' === $.cookie('order')) { + $caption.click(); + } + + // Open details + if (ApiGen.config.options.elementDetailsCollapsed) { + $('tr', $content).filter(':has(.detailed)') + .click(function() { + var $this = $(this); + $('.short', $this).hide(); + $('.detailed', $this).show(); + }); + } + + // Splitter + var splitterWidth = $splitter.width(); + function setSplitterPosition(position) + { + $left.width(position); + $right.css('margin-left', position + splitterWidth); + $splitter.css('left', position); + } + function setNavigationPosition() + { + var width = $rightInner.width(); + $rightInner + .toggleClass('medium', width <= 960) + .toggleClass('small', width <= 650); + } + $splitter.mousedown(function() { + $splitter.addClass('active'); + + $document.mousemove(function(event) { + if (event.pageX >= 230 && $document.width() - event.pageX >= 600 + splitterWidth) { + setSplitterPosition(event.pageX); + setNavigationPosition(); + } + }); + + $() + .add($splitter) + .add($document) + .mouseup(function() { + $splitter + .removeClass('active') + .unbind('mouseup'); + $document + .unbind('mousemove') + .unbind('mouseup'); + + $.cookie('splitter', parseInt($splitter.css('left')), {expires: 365}); + }); + + return false; + }); + var splitterPosition = $.cookie('splitter'); + if (null !== splitterPosition) { + setSplitterPosition(parseInt(splitterPosition)); + } + setNavigationPosition(); + $(window).resize(setNavigationPosition); + + // Select selected lines + var matches = window.location.hash.substr(1).match(/^\d+(?:-\d+)?(?:,\d+(?:-\d+)?)*$/); + if (null !== matches) { + var lists = matches[0].split(','); + for (var i = 0; i < lists.length; i++) { + var lines = lists[i].split('-'); + lines[1] = lines[1] || lines[0]; + for (var j = lines[0]; j <= lines[1]; j++) { + $('#' + j).addClass('selected'); + } + } + + var $firstLine = $('#' + parseInt(matches[0])); + if ($firstLine.length > 0) { + $right.scrollTop($firstLine.offset().top); + } + } + + // Save selected lines + var lastLine; + $('a.l').click(function(event) { + event.preventDefault(); + + var $selectedLine = $(this).parent(); + var selectedLine = parseInt($selectedLine.attr('id')); + + if (event.shiftKey) { + if (lastLine) { + for (var i = Math.min(selectedLine, lastLine); i <= Math.max(selectedLine, lastLine); i++) { + $('#' + i).addClass('selected'); + } + } else { + $selectedLine.addClass('selected'); + } + } else if (event.ctrlKey) { + $selectedLine.toggleClass('selected'); + } else { + var $selected = $('.l.selected') + .not($selectedLine) + .removeClass('selected'); + if ($selected.length > 0) { + $selectedLine.addClass('selected'); + } else { + $selectedLine.toggleClass('selected'); + } + } + + lastLine = $selectedLine.hasClass('selected') ? selectedLine : null; + + // Update hash + var lines = $('.l.selected') + .map(function() { + return parseInt($(this).attr('id')); + }) + .get() + .sort(function(a, b) { + return a - b; + }); + + var hash = []; + var list = []; + for (var j = 0; j < lines.length; j++) { + if (0 === j && j + 1 === lines.length) { + hash.push(lines[j]); + } else if (0 === j) { + list[0] = lines[j]; + } else if (lines[j - 1] + 1 !== lines[j] && j + 1 === lines.length) { + hash.push(list.join('-')); + hash.push(lines[j]); + } else if (lines[j - 1] + 1 !== lines[j]) { + hash.push(list.join('-')); + list = [lines[j]]; + } else if (j + 1 === lines.length) { + list[1] = lines[j]; + hash.push(list.join('-')); + } else { + list[1] = lines[j]; + } + } + + window.location.hash = hash.join(','); + }); +}); + diff --git a/doc/resources/footer.png b/doc/resources/footer.png new file mode 100644 index 0000000000000000000000000000000000000000..51f4a7fa9abb5e46e607d349d1a814811bf4f2e9 GIT binary patch literal 8232 zcmeAS@N?(olHy`uVBq!ia0y~yU_Qyfz|hCR%)r24x_s9o1_lPn64!{5;QX|b^2DN4 z2FH~Aq*MjZ+{Er<{r&pw z^SAF`e*OOW^XK>PKfe9^_2b8n@4tTk`ug?r_wV1negFF9>!+vB9z1{k@Wso=U%q^L z^XA3JPwzf`{_y_8n|JSCy?Xuh>(@{3-@pF+<>SYX?>>Ec|M~NWx9?tl`SS6@$G30Z zzIgTe*}M0zpTBtY`pxqXAKtup`Q+`}m#`&z5B~rE_vg=_A3wf*|Niyg zzrR0!{`mFl=ik47{{H>@=g;rozkmJv_wPR#T=LOe&A`CmR}$nG3>Kgk!LY{n_c;az zxhhW=$B>F!Z{~J4KRFh7tT#SgM%udNMgw!_N5_u&iWU+{J>Ne#IlcS#|9`o}*0{eb zj)z~pI_X;9yRz_C>$EaM?&q)ConH2BX?weP=I-jayzk$?uiyLami(n}zjLdD2IhRj=3n_q#nif8Wp8TlZ=|Jvljl>D#Z@{ZR>xZoYVI7x30aW|L5(|ua@yFTd%or`x8G) zzxe&$k@NTaW_iS$=lTf!{PlXh`rbP&pHJ(naV}l&8EBq)*Tn4a{4Zs~_nuE?xO{!d z@!1CIwaeDeuQTcVmTo^!q-OG`FZDrReeX>^bNRaOm&xBQU!T8RxA5cQ>G5@z3ytc% zInLe}3je%aI*W7X&)Y2zdyh*`HJ*3#`^)2p4|{h$+5Kf|`Lg+wqq_|1qn-THBhG!j zRP^iT@uJA>-G45g{>Vye|at_Zl6Ave^PwOe20h`Gk!z_R$4P>{M$Kc zsz!8Y^bc>FcO_}n`eBpQd*07`ZhP~eR2sMS{1oe_b%Nfhe$!{HE8qLg<#WuO<;TCC z`xPNR@A+|iVk@@v%>-#UBF4LEcDB6^!k(zz>&ZOg(%d?yEU*0pS zUu>NWp=(&QUjJAIpidn1?b6x`GC z{jU1#72z%6ZQ>p2LS+tWQATBPw-o<9cDmtr=UBqw7eyPcKY3nWem;7N@r>&pkzd}N z`6;?o`;1;iy+C%QpNW2ddHtW?zL7KLE%e)-FI{%Nykz(B-?8_NHZDzLulBubGVRvq zU8z-P|LC=<^!TW2KVIFmX>Vxk@AI|lw@;UM|NXSUY8C(N$J-h+7S1|hwrgVM(^)sm z_BFqsIWPXRjZSOX>C4l0+0Kk?+I%KI>BiHI+G@cU*R6@omE2>zceS1I(RW7oIObiQ zx6(d+5kp#AMe@t5;qhlRPv1~xIO`dgcFOwf)J(U}a-YgJeeGPlqvI2o_Pp)wTWn77 zzT$bl)hGXZ#_rnRysr`2QpLdqsRPra>t zQu>7V^Mt4VJZfX7pFC~(YQ5!8cQRO2*H~Y+z9M;5`@|nXAD6RQ@EV)ThJRYeaE>!htMHsJYpAOX<1&X&cZ+8|o%_tFqBf7|Wv1?% zw^=*(o?X=KZhL<+&#Q8+b>3H0UgJ;Jw>G*h!6xPw<~G+|t)B04tg7!iy|eE5?pbeS-%fg~ zWM2AgTTj@Mbj$dJ^(>n{&wGzM#uUGB#Lmyx|MR50-p{KubKd4P=kg@;isG{uE1J7+ z7q}mkUQ{Ao=3U`kbzLgPXb<0V?*`#C)?+MP+?%-%ik!4O71Hq2MCH8h1>K9hmsl@< z=8iDEZh7P9*|i7izMm|&yu*6;wvp@P(`L6#AGOA2Z;yY#nx*@_h-OP>F z#u(o|SI%J@H2p&O{bzG7%Un?_&#lXjGVV2bBKGQ3se9Az^$BNR?^(OYye_*Tyh*!- zb4>)_=8dM#MU6(X$@Tjd`0b5(W|y&G;yU>f@2_SY`4`T;FRcBay-)Z-+-kp=QrmUk#Pqj>H|2lK1ZhPp6G1obMN@crOP;q!Y#KQ-5&UfufX}k zAvVU3K}yEkSQyNcv?rZD`AK$T*W9Bk!nbfvdHKud;+=afPhYNmTD9`J?$uN-sSWpk zu9KX0|B~kxfk`J6&X;>S7WVpRUq7?$v#eA971eJi=X$Nbw)Tto_FXm$il)q4wX$Z} znduLnJqg>j@PRJ3{=ov%mU9Ams|^_SefvG`$7Ni%Eb=aDHj>w^f0VE;t@@j0wsEKN zL1V{HT}B6s=86bCH@m!4l7N)D88$ zH`i=GYO($h@1ZGa#S=UyX->(k68U#3a#PskqaLECzdQ{QxGXYx`;sc7JMT4}jT(z) z+pAsXJ-NgyYDVE*$=uvyZrQ7M-n{oN;oA!1W2)O$9d~ui6Lr2Eqx~_r$j+vF8rzNq z4aX{_BgI2j@;ow)?A$zezWUAz0h=>AXMJOzd8i2;K5#~5Zy>vONw3L8)B;5Di$`qI z{5zW8H+|oKR%Cui6!Vg(iV3%?&NTZ>iU~S!z$akMgX8_{G^cD$uskbr?(1TKjAw;v zm1$m|jq;L$Ed1xToDnv9sJb*W@cngO2JRy)n-2CkXkX#kDtswmz2o(*J9Li89FsZD za$-qHWafKeU$La7q^Wzv-6maa;5m3^mH6j~)CrlBZU%lkX2flL-jLHsUooa#%)5K# z$!lpjTei)LetYsx$H^4Y1DDS{^7$CEzP!+Mr_0R5nN5++=M8op^GFL+ixf+kmXTKQ z%-eXfi{UeL*=Ra5 zF_K5U(5G2vqRyf-8_yipxuE0S$Qq>-_4ewnt95r7HaPewNT1=@a_G#z(#oBVXXWSr zE;<48s?PV=4#a~7Z3taBjdg3hBgpL0ZKpFaHf(Wj4=mV0aR?rh*V6!B;WOQgz7 z$C)xAn^GP$7S)PbhB>CCKE0ONpWL3_pFKUl z-`HeY-m_z0pG3@%J#A5JbJ^ju%V`ng=GO-4(vuQw-iL)0?CA=-uzwx|gf z(;n5n(>a_P=I0+6?G5teyO0txVSz?qV$-99)zM1FCJC9W*z7sa#xpEJEb$rFru?^2 zk0h98s_k@)Opk1hT(a}f&RM$IS0mV>l&rjVES#w1+c_DFlQX*yhT$z;?+mlUeBVzkjADy+PxTm3K(weogt2IvR za2tF!d2O+LBd>2!^QJ>Z%*GCz+dlsaYb8*XD}Gs!V!U$6$I#_RgIv?RjSd*G82fDA z@@VPeGxOZoA{8VZDwAh6?OYmpc;{0|MyZe~M=vB~8k*j`)zf<|ta!0)`+B1}$0DXB zJj)C#oOXY9XRyuWSL;tIowPZ1WR*Bef!QuSH>+FPfdPeXFSdG}e)_Pm@aK;?bK>I6 zm&eHLTx1Zh?zx(p8IRALmnHy4?CyY+%oW62N&t%oJ@b#?QjH@^&G4@$bI66zG ze}mzw$Vr}41gAO9uvQflR8Vko>6joP==fve*03(cY1299?mDN+Def{OU80V+Yu!nX zQ#z-W&ZH!=Nyfd`;Wzd*ZZSSp+`;ttP|MLyZV|D}pDr9ly|Y{;5+xdT%sKJWfY~`q zAnWmuS?ZEaGZyctIzQ8GD{In|wMvin%#=wJTx`gEW#KH|tMwTh9%O8M*s;@aZsvr9 z+K{vSs~s0@&D@kaZ_U+|3D4gY7w!DW$h5ijS<#_0Q=a9@GV7c$Id5^{;4K-!0*50% zCPWLWt=?cTN$t|{$2=eR^!{%s;<=c;@`TtF(@B9-xTjgp*!pv0=M%2fzNbuSJ!wJw zY735MRPz`lFY4o5z5g+@bVxGKcIIr+)SlFzhYKRBQnppQUq8eUz5dXbn41Sa|7+3Q z$fMkI;(*hau&8fybM$dHxR*(Fb4OqKtRFscvwB6K)yzW*lM<&)<=?igcTM;A)-9%z zZjnimtutd*nSauGuH-MpXS$q6_~aQWUU09Zru~9)X=iQG@=L2rv;P_$iCGuX$L;I! zNzjgE`;U~WDG8TvSY^%YnXI#jXTzC;IZGoC?L0HLF++LRDiuLQ`M#~0H??o!LJ_-V zY}0l<*{U}qYk|>Y1Mkl%%%_Y_bDYsRn>NRFo-W5{|F3Sl-abpK-ral{TzXl2{Cb^j zqu0i!jjhSDPdFy&%4jP%s~BrMuYbu`#puO)(_vG~Chy!j^X>ERZ#=yD_}0VW%OsD@ zjCjSAc0#R%v8~tm>55q~x^bUh=fC>3bt9Yb>Kj(4*=B597(M^ruD#WFcmMs(T;d*} zVV2-i(9@8kEa~{OrP3&1+QwaHM4zoPQeGHG6vRBTuKy{hQ5n|{HJw_0a>Q{4j0HujuS4>(lV$fWGr z#?_;`Y;w*2b=xv{Lz9v<+p;#!O!*k9p?xGPkj+qR-t||fc&4UtWJq81s_hF&uh{aU z;Niy=Og(n3MKe<@r#T+;*tV!=V@{i8Udi2%l+;aY&P=ln-Kl$8;#gRp=!C~dZ51AM zOkhsZ`W`h~Ci>X5Cx0YbZu%H^6#vf;Xqf+$^??u1#*2^MJhH40=Ih%uHFb|yM$nbt zrOXGI3>$L{lrM0Z7~jd&-h1Ot#5|eZ9&Ukbk$N|BJoAH2TtSt;Pv@Q+M=GbQxd1V^qj_DG?{Dd zwXovNd+#26_^=?b{j%Gvmx`uV%f1=(IKTPhtI?Dqew5`{N~GC>w`|Gu{xnBLs^MOC+Kre;~<9iEN6 zEX7QL_iG-A=T6U_o?>J?g#1NsNHi0*dC2C>X2HBc8L-l!urlx6|dDhNVnC-zgOT9WUEyC=O&Ly9R zJ)d%zqJsJz+sxo~^X=K|-90-)x;94jOn&2f^OzCKXN^ggQ`YL7HkfR3*y47@w5yK= zmYhHO^l@=fRps3|byxLQcgZv>C?C!;KkU}g>~`H&W3$d|?#w#0Jt#*4SI^0sZa zwy-&)_bDQ(`lzRxq(kKFKa%zTPc|3+77ve}@z z@4USG`rh;LD^EyW<2u1}GFIbu8#FX1NN8ZT0RkTb~pr1C$pu9pIq^Xr;QEX5M|qbCCO;}FNxXFFJ2wLdEA)I zBxdsOMz&W);urUNT&^q+&YimA@WF@BT6MXRXmYYC--GL%8**!GtB$^wTYa*Y{W5^TgMz3miTUoB}@9W=W%OGe}8A^=nxQ8Qepex zw9%^NnD{E^jIzf$|7|scpo*j$|C>A64r z{^Fa=>t1iwnD9hn0^_9JfqaRPTIUk2y8A?>bu6MvEG{?PvRO3EaM`~n+n@fu`l~7M zyUxtDC-om`8GkTPs_0{iQm~4d^O2F=MMlubPA#PGXO)ccoOc?hZRbbwPmpOfI6 z%5T3usP&{JZn1S}e7vZS%UWlhm3W$QbD>Uyj7t&!DckwS%*&3x{wF6J&o1&rqs>=7 z#K7+ovvNO=t=_g1222}W3Pp~^%9QUroc+S)=Rdi5+U*BqJT|jFZ~P=HUt98HD;8J3JU1&s^ki?Smuu~f+I~%cdO}Z}WPEBT z_ryr^-TUs(U-AFeDz74ig93*fOD(4)avxb`fm(<0-l!5=^Y~Pu{^h%(k}FOw^how$ zZk4P&#q<0Y)3%V%BX&E3U&1>B2GYVOKHRpuQpK}Un;||wu&yv&$#POc%|4mn8O@yA zPMl21Ha3fjK700C8GC#CO;^d#)e^<}a?)|OY}{e&XXee4;WGInF>zCmZ86`2TZ($? zCtp7O`q{V7)@2n|ZI`W%uUMnxwQ0ASv`635>j9IRvx+SC*fza}w6aRye|yivu&Mh{ z_L?&VH@Pa>#eF|1ObMK}IH7O(&hT(YMW>`AESz0JLT=Jw?CbJbrzF?gs->T_IjPTf zA*W&z*ON+y3yz1nc|;^MjY2YX&Sywzoh_X1DACa$N zDrJ;9pYY;@71wjWc{9JqoL1>?zTs3TbL^RVa&wNz-%Ql3oi;7!MsP3hFQ&$K3b%Yd zJ(!jA*is;4vP#ae4O)fH%}bA7fksxZ0X?@$g?~9!T^m57?>V!dWMA+mv6A6T zZ4gKJvk48%N_`xXd*yofM#yj#bDZU^kyVjDu#x+Tpvw2fHZE6_oA|n{RC3DG3T7l{ z_8qirzTo<)@Nl;N8Rv|5VrLC3`FU*&K5e+bxRcA>yd(DY4JoCc5>w{tT&}G6##8@W zHb-LN>=_bW{M*@8_^GQ$L{iHn zEN8=wjCI><_k3&r{qlZoRp85?pTb4w>N~hPyi@&IG3~B__fpB_H`8QvxBjRAmr4Sc zW*lc+YPrVj`IF8SuTTEn8^7zj;}08c`|XK`!Tb0^*H&3Cetl$U*Byq>3pJO!_1|YHnC+V z4TAHwVbn3qH$EFU@oxMP_UBZO?U%_l3WphvoJ;&RqtI-D!wJ~f2dJZ{DEs5rv~4>s zJqV6Ac>gH9b%Bb#jE_;vruXmo7T;WLJ|C9#t8Ck^B&@%&DDj%bRZqKlsoy^Cp0DWH z#XRZG;$3m~?VkI+kNciif1cYbSw$ee&Ue3gqUz6tDH{*naoqYtsAT^cCMA~^j!r>g z6%8+s852F&jdkk}ZJqh#ardSY=U-f(SE#hD)G-N2SaKquaO1J3#&W0Ub@2C3Phowk zH?3XOK5WTHXjZo{y2|V!ZqTjtQ)b%L-&dmNx<9LI&|z2Y~1H+v^+I5V6H!Z*7uX+{H>J|XOnX6 ze7uj(dv&2$wtAEEd9w)#Oa@c@=R7IC*Jvw~G4Vw*Ytf;fefAF@ruS&>U3?-mvP#11 zQ=|reQe@lDikEXs&K3Jror+}NRQY4JiLA=}j|Z9AH_Ck2Q#(z~-{yU!`n35~%0-rw zO1N#s%w$#OyL~k1Q7)=qwBfw%*UsmCo_7LrUdLOntLKh9mML@c`Cb{*Sx+T=HLg0n z4MS;Kcb~e#_@~Uxyy>Ol&pU@~gq~|mJ+R3{LP|$>nOgMhjTdia$W32!FhICe;!wKD z$>r0ZE;P3dkXyLWDfuWHcb}L{-i`#exd;4~PJU7xC^vgnfgvx41*p02oW#dj)v(6r zij4Co)>EH8?9Th4`_k}~lvr8Boy11|)8BtgPPnsU!k5W4c4ye{{CH#X?EC{cjkgOI zwjYy|`r{GUV{?9@O8jCy`RUsp`;|PH*=KWg;d85RDI3#^AK!5Q^ixBA&X&dgY#ZvV9Q9dCbod|G;>Xl?h-8&_lA7V+($=RK*$ago0Il-IEr zSl7SEn(p$K%Vqr$`A6H|o1eTca#U6S)uQmyqo=t7ek@k_=`{b(SC1QYg>Sicf0!Ek z_0paCWp59u#CJSAz3lHV@$!$WcYk_1^Z&FXuAcjZPE0@d{qc?i?gg#l`;Hv<{Ti%gk|j6$0dI`)voLHn`^JXPkGYazyH0( zww-C)=DruGTB5fRbqwj5i>>XPy?;BO^rZOcE)dOPyZsQUtvE}5!De}jll|F0e?LjD zeOI-v+);ebBJO=tAG5oEVht@knZ4_oYwVX*XQr3dPWm6;z{n7-q4ZIi_ z7^FO1978H@B_+79@;F$W_{qWWZ1HY+Q3e(XhR}ly`(6i^F@iLEy85}Sb4q9e07wg&N^LqLZq^2auFPOpjzp}hvGDuBtkSGVDNPHb6Mw<&;$TYT|w0V literal 0 HcmV?d00001 diff --git a/doc/resources/sort.png b/doc/resources/sort.png new file mode 100644 index 0000000000000000000000000000000000000000..0d0fea14dbdfb76546dbee3d912f44d3bbe4c5e3 GIT binary patch literal 171 zcmeAS@N?(olHy`uVBq!ia0y~yU=U?sVBq9nW?*1=b$7Z80|SF(iEBhjaDG}zd16s2 zgJVj5QmTSyZen_BP-ZUGnxU1_lNOPgg&ebxsLQ0Gb~#2><{9 literal 0 HcmV?d00001 diff --git a/doc/resources/style.css b/doc/resources/style.css new file mode 100644 index 0000000..f361474 --- /dev/null +++ b/doc/resources/style.css @@ -0,0 +1,608 @@ +/*! + * ApiGen 2.8.0 - API documentation generator for PHP 5.3+ + * + * Copyright (c) 2010-2011 David Grudl (http://davidgrudl.com) + * Copyright (c) 2011-2012 Jaroslav Hanslík (https://github.com/kukulich) + * Copyright (c) 2011-2012 Ondřej Nešpor (https://github.com/Andrewsville) + * + * For the full copyright and license information, please view + * the file LICENSE.md that was distributed with this source code. + */ + +body { + font: 13px/1.5 Verdana, 'Geneva CE', lucida, sans-serif; + margin: 0; + padding: 0; + background: #ffffff; + color: #333333; +} + +h1, h2, h3, h4, caption { + font-family: 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; + color: #053368; +} + +h1 { + color: #1e5eb6; + font-size: 230%; + font-weight: normal; + margin: .3em 0; +} + +h2 { + color: #1e5eb6; + font-size: 150%; + font-weight: normal; + margin: -.3em 0 .3em 0; +} + +h3 { + font-size: 1.6em; + font-weight: normal; + margin-bottom: 2px; +} + +h4 { + font-size: 100%; + font-weight: bold; + padding: 0; + margin: 0; +} + +caption { + border: 1px solid #cccccc; + background: #ecede5; + font-weight: bold; + font-size: 1.2em; + padding: 3px 5px; + text-align: left; + margin-bottom: 0; +} + +p { + margin: .7em 0 1em; + padding: 0; +} + +hr { + margin: 2em 0 1em; + border: none; + border-top: 1px solid #cccccc; + height: 0; +} + +a { + color: #006aeb; + padding: 3px 1px; + text-decoration: none; +} + +h1 a { + color: #1e5eb6; +} + +a:hover, a:active, a:focus, a:hover b, a:hover var { + background-color: #006aeb; + color: #ffffff !important; +} + +code, var, pre { + font-family: monospace; +} + +var { + font-weight: bold; + font-style: normal; + color: #ca8a04; +} + +pre { + margin: 0; +} + +code a b { + color: #000000; +} + +.deprecated { + text-decoration: line-through; +} + +.invalid { + color: #e71818; +} + +.hidden { + display: none; +} + +/* Left side */ +#left { + overflow: auto; + width: 270px; + height: 100%; + position: fixed; +} + +/* Menu */ +#menu { + padding: 10px; +} + +#menu ul { + list-style: none; + padding: 0; + margin: 0; +} + +#menu ul ul { + padding-left: 10px; +} + +#menu li { + white-space: nowrap; + position: relative; +} + +#menu a { + display: block; + padding: 0 2px; +} + +#menu .active > a, #menu > span { + color: #333333; + background: none; + font-weight: bold; +} + +#menu .active > a.invalid { + color: #e71818; +} + +#menu .active > a:hover, #menu .active > a:active, #menu .active > a:focus { + background-color: #006aeb; +} + +#menu #groups span { + position: absolute; + top: 4px; + right: 2px; + cursor: pointer; + display: block; + width: 12px; + height: 12px; + background: url('collapsed.png') transparent 0 0 no-repeat; +} + +#menu #groups span:hover { + background-position: -12px 0; +} + +#menu #groups span.collapsed { + background-position: 0 -12px; +} + +#menu #groups span.collapsed:hover { + background-position: -12px -12px; +} + +#menu #groups ul.collapsed { + display: none; +} + +/* Right side */ +#right { + overflow: auto; + margin-left: 275px; + height: 100%; + position: fixed; + left: 0; + right: 0; +} + +#rightInner { + max-width: 1000px; + min-width: 350px; +} + +/* Search */ +#search { + float: right; + margin: 3px 8px; +} + +#search input.text { + padding: 3px 5px; + width: 250px; +} + +/* Autocomplete */ +.ac_results { + padding: 0; + border: 1px solid #cccccc; + background-color: #ffffff; + overflow: hidden; + z-index: 99999; +} + +.ac_results ul { + width: 100%; + list-style-position: outside; + list-style: none; + padding: 0; + margin: 0; +} + +.ac_results li { + margin: 0; + padding: 2px 5px; + cursor: default; + display: block; + font: 12px 'Trebuchet MS', 'Geneva CE', lucida, sans-serif; + line-height: 16px; + overflow: hidden; + white-space: nowrap; +} + +.ac_results li strong { + color: #000000; +} + +.ac_odd { + background-color: #eeeeee; +} + +.ac_over { + background-color: #006aeb; + color: #ffffff; +} + +.ac_results li.ac_over strong { + color: #ffffff; +} + +/* Navigation */ +#navigation { + padding: 3px 8px; + background-color: #f6f6f4; + height: 26px; +} + +#navigation ul { + list-style: none; + margin: 0 8px 4px 0; + padding: 0; + overflow: hidden; + float: left; +} + +#navigation ul + ul { + border-left: 1px solid #000000; + padding-left: 8px; +} + +#navigation ul li { + float: left; + margin: 2px; + padding: 0 3px; + font-family: Verdana, 'Geneva CE', lucida, sans-serif; + color: #808080; +} + +#navigation ul li.active { + background-color: #053368; + color: #ffffff; + font-weight: bold; +} + +#navigation ul li a { + color: #000000; + font-weight: bold; + padding: 0; +} + +#navigation ul li span { + float: left; + padding: 0 3px; +} + +#navigation ul li a:hover span, #navigation ul li a:active span, #navigation ul li a:focus span { + background-color: #006aeb; +} + +/* Content */ +#content { + clear: both; + padding: 5px 15px; +} + +.description pre { + padding: .6em; + background: #fcfcf7; +} + +#content > .description { + background: #ecede5; + padding: 1px 8px; + margin: 1.2em 0; +} + +#content > .description pre { + margin: .5em 0; +} + +dl.tree { + margin: 1.2em 0; +} + +dl.tree dd { + margin: 0; + padding: 0; +} + +.info { + margin: 1.2em 0; +} + +.summary { + border: 1px solid #cccccc; + border-collapse: collapse; + font-size: 1em; + width: 100%; + margin: 1.2em 0 2.4em; +} + +.summary caption { + border-width: 1px 1px 0; +} + +.summary caption.switchable { + background: #ecede5 url('sort.png') no-repeat center right; + cursor: pointer; +} + +.summary td { + border: 1px solid #cccccc; + margin: 0; + padding: 3px 10px; + font-size: 1em; + vertical-align: top; +} + +.summary td:first-child { + text-align: right; +} + +#packages.summary td:first-child, #namespaces.summary td:first-child, .inherited.summary td:first-child, .used.summary td:first-child { + text-align: left; +} + +.summary tr:hover td { + background: #f6f6f4; +} + +.summary .description pre { + border: .5em solid #ecede5; +} + +.summary .description p { + margin: 0; +} + +.summary .description p + p, .summary .description ul { + margin: 3px 0 0 0; +} + +.summary .description.detailed h4 { + margin-top: 3px; +} + +.summary dl { + margin: 0; +} + +.summary dd { + margin: 0 0 0 25px; +} + +.name, .attributes { + white-space: nowrap; +} + +.value { + white-space: pre-wrap; +} + +td.name, td.attributes { + width: 1%; +} + +.class #methods .name { + width: auto; + white-space: normal; +} + +.class #methods .name > div > code { + white-space: pre-wrap; +} + +.class #methods .name > div > code span, .function .value > code { + white-space: nowrap; +} + +.class #methods td.name > div, .class td.description > div { + position: relative; + padding-right: 1em; +} + +.anchor { + position: absolute; + top: 0; + right: 0; + line-height: 1; + font-size: 85%; + margin: 0; + color: #006aeb !important; +} + +.list { + margin: 0 0 5px 25px; +} + +div.invalid { + background-color: #fae4e0; + padding: 10px; +} + +/* Splitter */ +#splitter { + position: fixed; + height: 100%; + width: 5px; + left: 270px; + background: #1e5eb6 url('resize.png') left center no-repeat; + cursor: e-resize; +} + +#splitter.active { + opacity: .5; +} + +/* Footer */ +#footer { + border-top: 1px solid #e9eeef; + clear: both; + color: #a7a7a7; + font-size: 8pt; + text-align: center; + padding: 20px 0 0; + margin: 3em 0 0; + height: 90px; + background: #ffffff url('footer.png') no-repeat center top; +} + +/* Tree */ +div.tree ul { + list-style: none; + background: url('tree-vertical.png') left repeat-y; + padding: 0; + margin-left: 20px; +} + +div.tree li { + margin: 0; + padding: 0; +} + +div.tree div { + padding-left: 30px; +} + +div.tree div.notlast { + background: url('tree-hasnext.png') left 10px no-repeat; +} + +div.tree div.last { + background: url('tree-last.png') left -240px no-repeat; +} + +div.tree li.last { + background: url('tree-cleaner.png') left center repeat-y; +} + +div.tree span.padding { + padding-left: 15px; +} + +/* Source code */ +.php-keyword1 { + color: #e71818; + font-weight: bold; +} + +.php-keyword2 { + font-weight: bold; +} + +.php-var { + color: #d59401; + font-weight: bold; +} + +.php-num { + color: #cd0673; +} + +.php-quote { + color: #008000; +} + +.php-comment { + color: #929292; +} + +.xlang { + color: #ff0000; + font-weight: bold; +} + +span.l { + display: block; +} + +span.l.selected { + background: #f6f6f4; +} + +span.l a { + color: #333333; +} + +span.l a:hover, div.l a:active, div.l a:focus { + background: transparent; + color: #333333 !important; +} + +span.l .php-var a { + color: #d59401; +} + +span.l .php-var a:hover, span.l .php-var a:active, span.l .php-var a:focus { + color: #d59401 !important; +} + +span.l a.l { + padding-left: 2px; + color: #c0c0c0; +} + +span.l a.l:hover, span.l a.l:active, span.l a.l:focus { + background: transparent; + color: #c0c0c0 !important; +} + +#rightInner.medium #navigation { + height: 52px; +} + +#rightInner.medium #navigation ul:first-child + ul { + clear: left; + border: none; + padding: 0; +} + +#rightInner.medium .name, #rightInner.medium .attributes { + white-space: normal; +} + +#rightInner.small #search { + float: left; +} + +#rightInner.small #navigation { + height: 78px; +} + +#rightInner.small #navigation ul:first-child { + clear: both; +} diff --git a/doc/resources/tree-cleaner.png b/doc/resources/tree-cleaner.png new file mode 100644 index 0000000000000000000000000000000000000000..2eb9085be54558b89d461883c440f5f46f9736c1 GIT binary patch literal 126 zcmeAS@N?(olHy`uVBq!ia0y~yU=U$oU|{56W?*1==~E}pz`!6`;u=vBoS#-wo>-L1 z;Fyx1l&avFo0y&&l$w}QS$HzlhJk^BEx;$l_5c6>3=9mRhc4GKFfj0Wx;TbZ+)7F~ ez{J4B!@wZQz}WRjLY0Amfx*+&&t;ucLK6UOO(4Vo literal 0 HcmV?d00001 diff --git a/doc/resources/tree-hasnext.png b/doc/resources/tree-hasnext.png new file mode 100644 index 0000000000000000000000000000000000000000..91d6b79ab4c4d479f1bbd2d035aacf682d6b6b24 GIT binary patch literal 128 zcmeAS@N?(olHy`uVBq!ia0y~yV31>AU|{56W?*3Wm-p@-0|SF(iEBhjaDG}zd16s2 zgJVj5QmTSyZen_BP-=bI=FfcGMc)I$ztaD0e0svaUBo+Vw literal 0 HcmV?d00001 diff --git a/doc/resources/tree-last.png b/doc/resources/tree-last.png new file mode 100644 index 0000000000000000000000000000000000000000..7f319f8f950bf32e5932d6d37e424806edb248a4 GIT binary patch literal 172 zcmeAS@N?(olHy`uVBq!ia0y~yV31>AVEn?t%)r1P>y~?ffq_A?#5JNMI6tkVJh3R1 z!7(L2DOJHUH!(dmC^a#qvhZZ84FdxMTYyi9>;M1%85kHs4_&TfU|_KEba4!+xb^1b zMqUO64(0{F{$K9nQ?pZ8qZ0je$<}L8*=v!BU*Y`>5b(j1+koM|Gb7uNy>~c3LY}UE JF6*2UngB)SIlBM= literal 0 HcmV?d00001 diff --git a/doc/resources/tree-vertical.png b/doc/resources/tree-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..384908b28e9958c9842f258350799221e3fa2020 GIT binary patch literal 127 zcmeAS@N?(olHy`uVBq!ia0y~yU=U$oU|{56W?*1==~E}pz`!6`;u=vBoS#-wo>-L1 z;Fyx1l&avFo0y&&l$w}QS$HzlhJk^BEx;$l_5c6>3=9mRhc4GKFfj0Yx;TbZ+)7F~ fz|zCO$i~1R#=w-R_&tY#fq}u()z4*}Q$iB}nN1;* literal 0 HcmV?d00001 diff --git a/doc/source-class-Api.html b/doc/source-class-Api.html new file mode 100644 index 0000000..b5578c0 --- /dev/null +++ b/doc/source-class-Api.html @@ -0,0 +1,134 @@ + + + + + + + + File api/Api.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-HelloApi.html b/doc/source-class-HelloApi.html new file mode 100644 index 0000000..47008d4 --- /dev/null +++ b/doc/source-class-HelloApi.html @@ -0,0 +1,137 @@ + + + + + + + + File service/helloservice/HelloApi.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-HelloApiSQLManager.html b/doc/source-class-HelloApiSQLManager.html new file mode 100644 index 0000000..ff44a71 --- /dev/null +++ b/doc/source-class-HelloApiSQLManager.html @@ -0,0 +1,129 @@ + + + + + + + + File database/HelloApiSQLManager.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-SQLManager.html b/doc/source-class-SQLManager.html new file mode 100644 index 0000000..c2e7733 --- /dev/null +++ b/doc/source-class-SQLManager.html @@ -0,0 +1,163 @@ + + + + + + + + File database/SQLManager.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Environment.html b/doc/source-class-Slim.Environment.html new file mode 100644 index 0000000..814d977 --- /dev/null +++ b/doc/source-class-Slim.Environment.html @@ -0,0 +1,342 @@ + + + + + + + + File thirdparty/Slim/Environment.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Exception.Pass.html b/doc/source-class-Slim.Exception.Pass.html new file mode 100644 index 0000000..0fcfb66 --- /dev/null +++ b/doc/source-class-Slim.Exception.Pass.html @@ -0,0 +1,149 @@ + + + + + + + + File thirdparty/Slim/Exception/Pass.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Exception.Stop.html b/doc/source-class-Slim.Exception.Stop.html new file mode 100644 index 0000000..319c0ea --- /dev/null +++ b/doc/source-class-Slim.Exception.Stop.html @@ -0,0 +1,147 @@ + + + + + + + + File thirdparty/Slim/Exception/Stop.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Http.Headers.html b/doc/source-class-Slim.Http.Headers.html new file mode 100644 index 0000000..095e260 --- /dev/null +++ b/doc/source-class-Slim.Http.Headers.html @@ -0,0 +1,282 @@ + + + + + + + + File thirdparty/Slim/Http/Headers.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Http.Request.html b/doc/source-class-Slim.Http.Request.html new file mode 100644 index 0000000..8679030 --- /dev/null +++ b/doc/source-class-Slim.Http.Request.html @@ -0,0 +1,686 @@ + + + + + + + + File thirdparty/Slim/Http/Request.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Http.Response.html b/doc/source-class-Slim.Http.Response.html new file mode 100644 index 0000000..6918a14 --- /dev/null +++ b/doc/source-class-Slim.Http.Response.html @@ -0,0 +1,560 @@ + + + + + + + + File thirdparty/Slim/Http/Response.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Http.Util.html b/doc/source-class-Slim.Http.Util.html new file mode 100644 index 0000000..5592f6b --- /dev/null +++ b/doc/source-class-Slim.Http.Util.html @@ -0,0 +1,490 @@ + + + + + + + + File thirdparty/Slim/Http/Util.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Log.html b/doc/source-class-Slim.Log.html new file mode 100644 index 0000000..1fc87fc --- /dev/null +++ b/doc/source-class-Slim.Log.html @@ -0,0 +1,342 @@ + + + + + + + + File thirdparty/Slim/Log.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.LogWriter.html b/doc/source-class-Slim.LogWriter.html new file mode 100644 index 0000000..a784932 --- /dev/null +++ b/doc/source-class-Slim.LogWriter.html @@ -0,0 +1,180 @@ + + + + + + + + File thirdparty/Slim/LogWriter.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.ContentTypes.html b/doc/source-class-Slim.Middleware.ContentTypes.html new file mode 100644 index 0000000..ad580f0 --- /dev/null +++ b/doc/source-class-Slim.Middleware.ContentTypes.html @@ -0,0 +1,272 @@ + + + + + + + + File thirdparty/Slim/Middleware/ContentTypes.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.Flash.html b/doc/source-class-Slim.Middleware.Flash.html new file mode 100644 index 0000000..3b0c78d --- /dev/null +++ b/doc/source-class-Slim.Middleware.Flash.html @@ -0,0 +1,304 @@ + + + + + + + + File thirdparty/Slim/Middleware/Flash.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.MethodOverride.html b/doc/source-class-Slim.Middleware.MethodOverride.html new file mode 100644 index 0000000..078373f --- /dev/null +++ b/doc/source-class-Slim.Middleware.MethodOverride.html @@ -0,0 +1,198 @@ + + + + + + + + File thirdparty/Slim/Middleware/MethodOverride.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.PrettyExceptions.html b/doc/source-class-Slim.Middleware.PrettyExceptions.html new file mode 100644 index 0000000..f213c01 --- /dev/null +++ b/doc/source-class-Slim.Middleware.PrettyExceptions.html @@ -0,0 +1,216 @@ + + + + + + + + File thirdparty/Slim/Middleware/PrettyExceptions.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.SessionCookie.html b/doc/source-class-Slim.Middleware.SessionCookie.html new file mode 100644 index 0000000..528b2ef --- /dev/null +++ b/doc/source-class-Slim.Middleware.SessionCookie.html @@ -0,0 +1,305 @@ + + + + + + + + File thirdparty/Slim/Middleware/SessionCookie.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Middleware.html b/doc/source-class-Slim.Middleware.html new file mode 100644 index 0000000..14eb430 --- /dev/null +++ b/doc/source-class-Slim.Middleware.html @@ -0,0 +1,219 @@ + + + + + + + + File thirdparty/Slim/Middleware.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Route.html b/doc/source-class-Slim.Route.html new file mode 100644 index 0000000..7bf74ed --- /dev/null +++ b/doc/source-class-Slim.Route.html @@ -0,0 +1,521 @@ + + + + + + + + File thirdparty/Slim/Route.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Router.html b/doc/source-class-Slim.Router.html new file mode 100644 index 0000000..891aba5 --- /dev/null +++ b/doc/source-class-Slim.Router.html @@ -0,0 +1,340 @@ + + + + + + + + File thirdparty/Slim/Router.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.Slim.html b/doc/source-class-Slim.Slim.html new file mode 100644 index 0000000..6d169ab --- /dev/null +++ b/doc/source-class-Slim.Slim.html @@ -0,0 +1,1414 @@ + + + + + + + + File thirdparty/Slim/Slim.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-Slim.View.html b/doc/source-class-Slim.View.html new file mode 100644 index 0000000..1cac012 --- /dev/null +++ b/doc/source-class-Slim.View.html @@ -0,0 +1,321 @@ + + + + + + + + File thirdparty/Slim/View.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-SpsApi.html b/doc/source-class-SpsApi.html new file mode 100644 index 0000000..864c2ad --- /dev/null +++ b/doc/source-class-SpsApi.html @@ -0,0 +1,130 @@ + + + + + + + + File api/SpsApi.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/source-class-SpsSqlManager.html b/doc/source-class-SpsSqlManager.html new file mode 100644 index 0000000..052ae96 --- /dev/null +++ b/doc/source-class-SpsSqlManager.html @@ -0,0 +1,117 @@ + + + + + + + + File database/SpsSqlManager.php | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/tree.html b/doc/tree.html new file mode 100644 index 0000000..41c58eb --- /dev/null +++ b/doc/tree.html @@ -0,0 +1,477 @@ + + + + + + + Tree | GeoApi + + + + + + + + + + +
+ + + + diff --git a/geoapi/api/Api.php b/geoapi/api/Api.php index fd49962..f11b630 100644 --- a/geoapi/api/Api.php +++ b/geoapi/api/Api.php @@ -5,11 +5,25 @@ include_once PATH_DATABASE . "/SQLManager.php"; require_once PATH_3PARTY . "/Slim/Slim.php"; \Slim\Slim::registerAutoloader(); +namespace api; + +/** + * This class provides some general API methods + * @author stubbfel + * @since 20.06.2013 + */ abstract class Api extends \Slim\Slim { + /** + * Variable for the sql manager of the api + * @var :SqlManager + */ protected $sqlManager; - public function __construct() { + /** + * Default-Constructor + */ + public function Api() { if (!$this->sqlManager) { echo "bla"; $this->sqlManager = new SQLManager(); @@ -17,11 +31,16 @@ abstract class Api extends \Slim\Slim { parent::__construct(); } + /** + * Default-DeConstructor + */ public function __destruct() { $this->sqlManager = null; - //parent::__destruct(); } + /** + * Method start a connection to the database + */ public function connect() { $this->sqlManager->connect(); } diff --git a/geoapi/api/SpsApi.php b/geoapi/api/SpsApi.php index 11c9701..4b5b191 100644 --- a/geoapi/api/SpsApi.php +++ b/geoapi/api/SpsApi.php @@ -1,27 +1,31 @@ diff --git a/geoapi/config/config.db.php b/geoapi/config/config.db.php index 3e558ca..03f3286 100644 --- a/geoapi/config/config.db.php +++ b/geoapi/config/config.db.php @@ -1,7 +1,24 @@ diff --git a/geoapi/database/HelloApiSQLManager.php b/geoapi/database/HelloApiSQLManager.php index 27914e3..cab9eaf 100644 --- a/geoapi/database/HelloApiSQLManager.php +++ b/geoapi/database/HelloApiSQLManager.php @@ -7,7 +7,7 @@ include_once PATH_DATABASE . "/SQLManager.php"; * * @author stubbfel */ -class HelloApiSQLManager extends SQLManager{ +class HelloApiSQLManager extends \database\SQLManager{ public function __construct() { parent::__construct(); diff --git a/geoapi/database/SQLManager.php b/geoapi/database/SQLManager.php index 6cafa0d..c906836 100644 --- a/geoapi/database/SQLManager.php +++ b/geoapi/database/SQLManager.php @@ -2,49 +2,100 @@ include_once "../../global.inc.php"; +namespace database; + /** * The SQLManager manage the SQL-Connection for an API - * * @author stubbfel + * @since 20.06.2013 */ class SQLManager { + /** + * Variable for address of the server + * @var string + */ private $serverAddress; + + /** + * Variable for name of the databaseuser + * @var string + */ private $userName; + + /** + * Variable for name of the database + * @var string + */ private $dbName; + + /** + * Variable for password of the user + * @var string + */ private $userPw; + + /** + * Variable for link of the connection to the server + * @var connection + */ private $link; - public function __construct() { - include_once PATH_DATABASE . "/mysql.php"; + /** + * Default-Constructor + */ + public function SQLManager() { + include_once PATH_CONFIG . "/config.db.php"; $this->serverAddress = $sqlServer; $this->dbName = $sqlDBName; $this->userName = $sqlDBUser; $this->userPw = $sqlDBUserPW; } + /** + * Default-DEConstructor + */ public function __destruct() { - $this->close(); + $this->closeConnection(); $this->serverAddress = null; $this->dbName = null; $this->userName = null; $this->userPW = null; } + /** + * Method setup the connection to the Database + */ public function connect() { - $this->link = mysql_connect($this->serverAddress, $this->userName, $this->userPw) or die("No Connection: " . mysql_error()); - mysql_select_db($this->dbName, $this->link) or die("No DB: " . mysql_error()); + $this->link = mysql_connect($this->serverAddress, $this->userName, $this->userPw); + if (!$this->link) { + exit("No Connection: " . mysql_error()); + } + $selected = mysql_select_db($this->dbName, $this->link); + if (!$selected) { + exit("No DB: " . mysql_error()); + } } - public function close() { + /** + * Method close the connection + */ + public function closeConnection() { if ($this->link) { mysql_close($this->link); } } + /** + * Method send a query to the Datebase and return the result + * @param string $query + * @return result[num][assoc] + */ protected function query($query) { - $mysqlResult = mysql_query($query, $this->link) or die("Query error: " . mysql_error()); - + $mysqlResult = mysql_query($query, $this->link); + if (!$mysqlResult) { + exit("Query error: " . mysql_error()); + } $rowNums = mysql_num_rows($mysqlResult); $result = array(); for ($i = 0; $i < $rowNums; $i++) { diff --git a/geoapi/database/SpsSqlManager.php b/geoapi/database/SpsSqlManager.php index 52e317e..70c4e6c 100644 --- a/geoapi/database/SpsSqlManager.php +++ b/geoapi/database/SpsSqlManager.php @@ -2,10 +2,13 @@ include_once "../../global.inc.php"; include_once PATH_DATABASE . "/SQLManager.php"; +namespace database; + /** * Description of SpsSqlManager - * + * * @author stubbfel + * @since 20.06.2013 */ class SpsSqlManager { //put your code here diff --git a/geoapi/global.inc.php b/geoapi/global.inc.php index 018a756..38d4a6a 100644 --- a/geoapi/global.inc.php +++ b/geoapi/global.inc.php @@ -1,7 +1,32 @@ From 1045724798624359915eff9fc7fbaad9f4488658 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 20 Jun 2013 11:57:59 +0200 Subject: [PATCH 14/17] refactor --- geoapi/api/Api.php | 10 +++---- geoapi/api/SpsApi.php | 19 ++++++++++--- geoapi/database/HelloApiSQLManager.php | 26 ------------------ geoapi/database/SpsSqlManager.php | 25 ++++++++++++----- geoapi/database/SqlManager.php | 8 +++--- geoapi/service/helloservice/.htaccess | 2 -- geoapi/service/helloservice/HelloApi.php | 34 ------------------------ geoapi/service/helloservice/index.php | 16 ----------- geoapi/service/sps/index.php | 2 +- 9 files changed, 44 insertions(+), 98 deletions(-) delete mode 100644 geoapi/database/HelloApiSQLManager.php delete mode 100644 geoapi/service/helloservice/.htaccess delete mode 100644 geoapi/service/helloservice/HelloApi.php delete mode 100644 geoapi/service/helloservice/index.php diff --git a/geoapi/api/Api.php b/geoapi/api/Api.php index f11b630..efcceed 100644 --- a/geoapi/api/Api.php +++ b/geoapi/api/Api.php @@ -1,12 +1,12 @@ sqlManager) { - echo "bla"; - $this->sqlManager = new SQLManager(); + $this->sqlManager = new \database\SQLManager(); } + $this->connect(); parent::__construct(); } diff --git a/geoapi/api/SpsApi.php b/geoapi/api/SpsApi.php index 4b5b191..70890f8 100644 --- a/geoapi/api/SpsApi.php +++ b/geoapi/api/SpsApi.php @@ -1,10 +1,11 @@ sqlManager = new \database\SpsSqlManager(); parent::__construct(); } @@ -26,6 +28,15 @@ class SpsApi extends Api { parent::__destruct(); } + /** + * Method stert a sps-query + * @param array $queryArgs + * @return array[num] [assoc] + */ + public function sendSpsQuery($queryArgs = array()) { + return $this->sqlManager->sendSpsQuery($queryArgs); + } + } ?> diff --git a/geoapi/database/HelloApiSQLManager.php b/geoapi/database/HelloApiSQLManager.php deleted file mode 100644 index cab9eaf..0000000 --- a/geoapi/database/HelloApiSQLManager.php +++ /dev/null @@ -1,26 +0,0 @@ -query("SELECT * FROM sps"); - } - -} - -?> diff --git a/geoapi/database/SpsSqlManager.php b/geoapi/database/SpsSqlManager.php index df18854..f7dc7d2 100644 --- a/geoapi/database/SpsSqlManager.php +++ b/geoapi/database/SpsSqlManager.php @@ -1,31 +1,44 @@ query("SELECT * FROM sps Where alias = \"$alias\""); } + } ?> diff --git a/geoapi/database/SqlManager.php b/geoapi/database/SqlManager.php index 67d98f7..a805592 100644 --- a/geoapi/database/SqlManager.php +++ b/geoapi/database/SqlManager.php @@ -1,9 +1,9 @@ serverAddress = $sqlServer; $this->dbName = $sqlDBName; @@ -83,7 +83,7 @@ abstract class SqlManager { public function closeConnection() { if ($this->link) { mysql_close($this->link); - $this->link =null; + $this->link = null; } } diff --git a/geoapi/service/helloservice/.htaccess b/geoapi/service/helloservice/.htaccess deleted file mode 100644 index 450c0d1..0000000 --- a/geoapi/service/helloservice/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -RewriteEngine on -RewriteRule ^ index.php [QSA,L] \ No newline at end of file diff --git a/geoapi/service/helloservice/HelloApi.php b/geoapi/service/helloservice/HelloApi.php deleted file mode 100644 index 4e8965a..0000000 --- a/geoapi/service/helloservice/HelloApi.php +++ /dev/null @@ -1,34 +0,0 @@ -sqlManager = new HelloApiSQLManager(); - parent::__construct(); - } - - public function __destruct() { - parent::__destruct(); - } - - public function sendHelloQuery() { - return $this->sqlManager->sendHelloQuery(); - } - -} - -?> diff --git a/geoapi/service/helloservice/index.php b/geoapi/service/helloservice/index.php deleted file mode 100644 index f7d29d3..0000000 --- a/geoapi/service/helloservice/index.php +++ /dev/null @@ -1,16 +0,0 @@ -get('/hello/:name', function ($name) use ($app) { - $app->connect(); - print_r($app->sendHelloQuery()); - // print - echo "Hello, $name"; -}); - -$app->run(); -?> diff --git a/geoapi/service/sps/index.php b/geoapi/service/sps/index.php index 5dbe497..6f18ae0 100644 --- a/geoapi/service/sps/index.php +++ b/geoapi/service/sps/index.php @@ -3,7 +3,7 @@ include_once "../../global.inc.php"; require_once PATH_API . "/SpsApi.php"; -$app = new SpsApi(); +$app = new \api\SpsApi(); $app->get('/alias/:alias', function ($alias) use ($app) { $args =array(); From b857c4386badfe922d8fd90bebdce2f128dbf156 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Thu, 20 Jun 2013 12:05:04 +0200 Subject: [PATCH 15/17] resolved #50 --- doc/404.html | 19 +- doc/class-ArrayAccess.html | 8 +- doc/class-ArrayIterator.html | 8 +- doc/class-Countable.html | 8 +- doc/class-ErrorException.html | 8 +- doc/class-Exception.html | 8 +- doc/class-InvalidArgumentException.html | 8 +- doc/class-Iterator.html | 8 +- doc/class-IteratorAggregate.html | 8 +- doc/class-LogicException.html | 8 +- doc/class-RuntimeException.html | 8 +- doc/class-SeekableIterator.html | 8 +- doc/class-Serializable.html | 8 +- doc/class-SimpleXMLElement.html | 8 +- doc/class-Slim.Environment.html | 8 +- doc/class-Slim.Exception.Pass.html | 8 +- doc/class-Slim.Exception.Stop.html | 8 +- doc/class-Slim.Http.Headers.html | 8 +- doc/class-Slim.Http.Request.html | 8 +- doc/class-Slim.Http.Response.html | 8 +- doc/class-Slim.Http.Util.html | 8 +- doc/class-Slim.Log.html | 8 +- doc/class-Slim.LogWriter.html | 8 +- doc/class-Slim.Middleware.ContentTypes.html | 8 +- doc/class-Slim.Middleware.Flash.html | 8 +- doc/class-Slim.Middleware.MethodOverride.html | 8 +- ...lass-Slim.Middleware.PrettyExceptions.html | 8 +- doc/class-Slim.Middleware.SessionCookie.html | 8 +- doc/class-Slim.Middleware.html | 8 +- doc/class-Slim.Route.html | 8 +- doc/class-Slim.Router.html | 8 +- doc/class-Slim.Slim.html | 13 +- doc/class-Slim.View.html | 8 +- doc/class-SpsApi.html | 348 ------------------ doc/class-Traversable.html | 8 +- doc/{class-Api.html => class-api.Api.html} | 61 +-- ...ss-HelloApi.html => class-api.SpsApi.html} | 79 ++-- doc/class-config.DBConfig.html | 258 +++++++++++++ ...html => class-database.SpsSqlManager.html} | 82 +++-- ...er.html => class-database.SqlManager.html} | 79 ++-- doc/elementlist.js | 2 +- doc/index.html | 25 +- doc/namespace-PHP.html | 8 +- doc/namespace-Slim.Exception.html | 8 +- doc/namespace-Slim.Http.html | 8 +- doc/namespace-Slim.Middleware.html | 8 +- doc/namespace-Slim.html | 8 +- ...-SpsSqlManager.html => namespace-api.html} | 78 ++-- doc/namespace-config.html | 116 ++++++ ...pace-None.html => namespace-database.html} | 41 +-- doc/source-class-Api.html | 134 ------- doc/source-class-HelloApiSQLManager.html | 129 ------- doc/source-class-SQLManager.html | 163 -------- doc/source-class-Slim.Environment.html | 8 +- doc/source-class-Slim.Exception.Pass.html | 8 +- doc/source-class-Slim.Exception.Stop.html | 8 +- doc/source-class-Slim.Http.Headers.html | 8 +- doc/source-class-Slim.Http.Request.html | 8 +- doc/source-class-Slim.Http.Response.html | 8 +- doc/source-class-Slim.Http.Util.html | 8 +- doc/source-class-Slim.Log.html | 8 +- doc/source-class-Slim.LogWriter.html | 8 +- ...ce-class-Slim.Middleware.ContentTypes.html | 8 +- doc/source-class-Slim.Middleware.Flash.html | 8 +- ...-class-Slim.Middleware.MethodOverride.html | 8 +- ...lass-Slim.Middleware.PrettyExceptions.html | 8 +- ...e-class-Slim.Middleware.SessionCookie.html | 8 +- doc/source-class-Slim.Middleware.html | 8 +- doc/source-class-Slim.Route.html | 8 +- doc/source-class-Slim.Router.html | 8 +- doc/source-class-Slim.Slim.html | 8 +- doc/source-class-Slim.View.html | 8 +- doc/source-class-SpsApi.html | 130 ------- doc/source-class-SpsSqlManager.html | 117 ------ doc/source-class-api.Api.html | 153 ++++++++ ...oApi.html => source-class-api.SpsApi.html} | 88 +++-- doc/source-class-config.DBConfig.html | 134 +++++++ doc/source-class-database.SpsSqlManager.html | 147 ++++++++ doc/source-class-database.SqlManager.html | 216 +++++++++++ doc/tree.html | 66 ++-- geoapi/config/config.db.php | 36 +- geoapi/database/SqlManager.php | 11 +- 82 files changed, 1727 insertions(+), 1446 deletions(-) delete mode 100644 doc/class-SpsApi.html rename doc/{class-Api.html => class-api.Api.html} (85%) rename doc/{class-HelloApi.html => class-api.SpsApi.html} (78%) create mode 100644 doc/class-config.DBConfig.html rename doc/{class-HelloApiSQLManager.html => class-database.SpsSqlManager.html} (60%) rename doc/{class-SQLManager.html => class-database.SqlManager.html} (61%) rename doc/{class-SpsSqlManager.html => namespace-api.html} (63%) create mode 100644 doc/namespace-config.html rename doc/{namespace-None.html => namespace-database.html} (63%) delete mode 100644 doc/source-class-Api.html delete mode 100644 doc/source-class-HelloApiSQLManager.html delete mode 100644 doc/source-class-SQLManager.html delete mode 100644 doc/source-class-SpsApi.html delete mode 100644 doc/source-class-SpsSqlManager.html create mode 100644 doc/source-class-api.Api.html rename doc/{source-class-HelloApi.html => source-class-api.SpsApi.html} (50%) create mode 100644 doc/source-class-config.DBConfig.html create mode 100644 doc/source-class-database.SpsSqlManager.html create mode 100644 doc/source-class-database.SqlManager.html diff --git a/doc/404.html b/doc/404.html index 0eb94e5..b4fe02e 100644 --- a/doc/404.html +++ b/doc/404.html @@ -8,7 +8,7 @@ Page not found | GeoApi - + @@ -22,7 +22,11 @@

Namespaces

    -
  • None +
  • api +
  • +
  • config +
  • +
  • database
  • PHP
  • @@ -44,10 +48,12 @@

    Classes

    Interfaces

    diff --git a/doc/class-ArrayAccess.html b/doc/class-ArrayAccess.html index 0ae94e1..9d56c97 100644 --- a/doc/class-ArrayAccess.html +++ b/doc/class-ArrayAccess.html @@ -7,7 +7,7 @@ Interface ArrayAccess | GeoApi - + @@ -21,7 +21,11 @@

    Namespaces

      -
    • None +
    • api +
    • +
    • config +
    • +
    • database
    • PHP
    • diff --git a/doc/class-ArrayIterator.html b/doc/class-ArrayIterator.html index d003ad3..b66ee96 100644 --- a/doc/class-ArrayIterator.html +++ b/doc/class-ArrayIterator.html @@ -7,7 +7,7 @@ Class ArrayIterator | GeoApi - + @@ -21,7 +21,11 @@

      Namespaces

        -
      • None +
      • api +
      • +
      • config +
      • +
      • database
      • PHP
      • diff --git a/doc/class-Countable.html b/doc/class-Countable.html index d7a9527..4713732 100644 --- a/doc/class-Countable.html +++ b/doc/class-Countable.html @@ -7,7 +7,7 @@ Interface Countable | GeoApi - + @@ -21,7 +21,11 @@

        Namespaces

          -
        • None +
        • api +
        • +
        • config +
        • +
        • database
        • PHP
        • diff --git a/doc/class-ErrorException.html b/doc/class-ErrorException.html index 9171f50..bae1efe 100644 --- a/doc/class-ErrorException.html +++ b/doc/class-ErrorException.html @@ -7,7 +7,7 @@ Class ErrorException | GeoApi - + @@ -21,7 +21,11 @@

          Namespaces

            -
          • None +
          • api +
          • +
          • config +
          • +
          • database
          • PHP
          • diff --git a/doc/class-Exception.html b/doc/class-Exception.html index bd27169..b120e26 100644 --- a/doc/class-Exception.html +++ b/doc/class-Exception.html @@ -7,7 +7,7 @@ Class Exception | GeoApi - + @@ -21,7 +21,11 @@

            Namespaces

              -
            • None +
            • api +
            • +
            • config +
            • +
            • database
            • PHP
            • diff --git a/doc/class-InvalidArgumentException.html b/doc/class-InvalidArgumentException.html index 0745522..c066aba 100644 --- a/doc/class-InvalidArgumentException.html +++ b/doc/class-InvalidArgumentException.html @@ -7,7 +7,7 @@ Class InvalidArgumentException | GeoApi - + @@ -21,7 +21,11 @@

              Namespaces

                -
              • None +
              • api +
              • +
              • config +
              • +
              • database
              • PHP
              • diff --git a/doc/class-Iterator.html b/doc/class-Iterator.html index 941b241..d42b50c 100644 --- a/doc/class-Iterator.html +++ b/doc/class-Iterator.html @@ -7,7 +7,7 @@ Interface Iterator | GeoApi - + @@ -21,7 +21,11 @@

                Namespaces

                  -
                • None +
                • api +
                • +
                • config +
                • +
                • database
                • PHP
                • diff --git a/doc/class-IteratorAggregate.html b/doc/class-IteratorAggregate.html index c6b7815..4da8bdc 100644 --- a/doc/class-IteratorAggregate.html +++ b/doc/class-IteratorAggregate.html @@ -7,7 +7,7 @@ Interface IteratorAggregate | GeoApi - + @@ -21,7 +21,11 @@

                  Namespaces

                    -
                  • None +
                  • api +
                  • +
                  • config +
                  • +
                  • database
                  • PHP
                  • diff --git a/doc/class-LogicException.html b/doc/class-LogicException.html index 5218d0a..bf96155 100644 --- a/doc/class-LogicException.html +++ b/doc/class-LogicException.html @@ -7,7 +7,7 @@ Class LogicException | GeoApi - + @@ -21,7 +21,11 @@

                    Namespaces

                      -
                    • None +
                    • api +
                    • +
                    • config +
                    • +
                    • database
                    • PHP
                    • diff --git a/doc/class-RuntimeException.html b/doc/class-RuntimeException.html index 107e414..2216a33 100644 --- a/doc/class-RuntimeException.html +++ b/doc/class-RuntimeException.html @@ -7,7 +7,7 @@ Class RuntimeException | GeoApi - + @@ -21,7 +21,11 @@

                      Namespaces

                        -
                      • None +
                      • api +
                      • +
                      • config +
                      • +
                      • database
                      • PHP
                      • diff --git a/doc/class-SeekableIterator.html b/doc/class-SeekableIterator.html index 7cb3318..ada9274 100644 --- a/doc/class-SeekableIterator.html +++ b/doc/class-SeekableIterator.html @@ -7,7 +7,7 @@ Interface SeekableIterator | GeoApi - + @@ -21,7 +21,11 @@

                        Namespaces

                          -
                        • None +
                        • api +
                        • +
                        • config +
                        • +
                        • database
                        • PHP
                        • diff --git a/doc/class-Serializable.html b/doc/class-Serializable.html index 6d1ffc1..742739b 100644 --- a/doc/class-Serializable.html +++ b/doc/class-Serializable.html @@ -7,7 +7,7 @@ Interface Serializable | GeoApi - + @@ -21,7 +21,11 @@

                          Namespaces

                            -
                          • None +
                          • api +
                          • +
                          • config +
                          • +
                          • database
                          • PHP
                          • diff --git a/doc/class-SimpleXMLElement.html b/doc/class-SimpleXMLElement.html index cb8f42d..50cc576 100644 --- a/doc/class-SimpleXMLElement.html +++ b/doc/class-SimpleXMLElement.html @@ -7,7 +7,7 @@ Class SimpleXMLElement | GeoApi - + @@ -21,7 +21,11 @@

                            Namespaces

                              -
                            • None +
                            • api +
                            • +
                            • config +
                            • +
                            • database
                            • PHP
                            • diff --git a/doc/class-Slim.Environment.html b/doc/class-Slim.Environment.html index b9db4a8..336402e 100644 --- a/doc/class-Slim.Environment.html +++ b/doc/class-Slim.Environment.html @@ -7,7 +7,7 @@ Class Slim\Environment | GeoApi - + @@ -21,7 +21,11 @@

                              Namespaces

                                -
                              • None +
                              • api +
                              • +
                              • config +
                              • +
                              • database
                              • PHP
                              • diff --git a/doc/class-Slim.Exception.Pass.html b/doc/class-Slim.Exception.Pass.html index d7703c5..b798957 100644 --- a/doc/class-Slim.Exception.Pass.html +++ b/doc/class-Slim.Exception.Pass.html @@ -7,7 +7,7 @@ Class Slim\Exception\Pass | GeoApi - + @@ -21,7 +21,11 @@

                                Namespaces

                                  -
                                • None +
                                • api +
                                • +
                                • config +
                                • +
                                • database
                                • PHP
                                • diff --git a/doc/class-Slim.Exception.Stop.html b/doc/class-Slim.Exception.Stop.html index 96c351d..35f53de 100644 --- a/doc/class-Slim.Exception.Stop.html +++ b/doc/class-Slim.Exception.Stop.html @@ -7,7 +7,7 @@ Class Slim\Exception\Stop | GeoApi - + @@ -21,7 +21,11 @@

                                  Namespaces

                                    -
                                  • None +
                                  • api +
                                  • +
                                  • config +
                                  • +
                                  • database
                                  • PHP
                                  • diff --git a/doc/class-Slim.Http.Headers.html b/doc/class-Slim.Http.Headers.html index 2d4c2b9..9138fbb 100644 --- a/doc/class-Slim.Http.Headers.html +++ b/doc/class-Slim.Http.Headers.html @@ -7,7 +7,7 @@ Class Slim\Http\Headers | GeoApi - + @@ -21,7 +21,11 @@

                                    Namespaces

                                      -
                                    • None +
                                    • api +
                                    • +
                                    • config +
                                    • +
                                    • database
                                    • PHP
                                    • diff --git a/doc/class-Slim.Http.Request.html b/doc/class-Slim.Http.Request.html index 4720641..983c841 100644 --- a/doc/class-Slim.Http.Request.html +++ b/doc/class-Slim.Http.Request.html @@ -7,7 +7,7 @@ Class Slim\Http\Request | GeoApi - + @@ -21,7 +21,11 @@

                                      Namespaces

                                        -
                                      • None +
                                      • api +
                                      • +
                                      • config +
                                      • +
                                      • database
                                      • PHP
                                      • diff --git a/doc/class-Slim.Http.Response.html b/doc/class-Slim.Http.Response.html index 199a326..552c269 100644 --- a/doc/class-Slim.Http.Response.html +++ b/doc/class-Slim.Http.Response.html @@ -7,7 +7,7 @@ Class Slim\Http\Response | GeoApi - + @@ -21,7 +21,11 @@

                                        Namespaces

                                          -
                                        • None +
                                        • api +
                                        • +
                                        • config +
                                        • +
                                        • database
                                        • PHP
                                        • diff --git a/doc/class-Slim.Http.Util.html b/doc/class-Slim.Http.Util.html index 25ca14a..e75c21d 100644 --- a/doc/class-Slim.Http.Util.html +++ b/doc/class-Slim.Http.Util.html @@ -7,7 +7,7 @@ Class Slim\Http\Util | GeoApi - + @@ -21,7 +21,11 @@

                                          Namespaces

                                            -
                                          • None +
                                          • api +
                                          • +
                                          • config +
                                          • +
                                          • database
                                          • PHP
                                          • diff --git a/doc/class-Slim.Log.html b/doc/class-Slim.Log.html index 8aa14ba..24d6227 100644 --- a/doc/class-Slim.Log.html +++ b/doc/class-Slim.Log.html @@ -7,7 +7,7 @@ Class Slim\Log | GeoApi - + @@ -21,7 +21,11 @@

                                            Namespaces

# - __construct( ) + __construct( )
-

Constructor

+

Default-Constructor

# - __destruct( ) + __destruct( )
+

Default-DeConstructor

+
# - connect( ) + connect( )
+

Method start a connection to the database

+
protected - mixed + <T>:SqlManager - $sqlManager + $sqlManager
@@ -339,10 +346,14 @@
+

Variable for the sql manager of the api

+
# - __construct( ) + __construct( )
-

Constructor

+

Default-Constructor

# - __destruct( ) + __destruct( )
+

Default-DeConstructor

+
public - + array[num]
- # - sendHelloQuery( ) + # + sendSpsQuery( array $queryArgs = array() )
+

Method stert a sps-query

+
- +
Methods inherited from ApiMethods inherited from api\Api
- connect() + connect()
@@ -334,10 +353,10 @@ - +
Properties inherited from ApiProperties inherited from api\Api
- $sqlManager + $sqlManager
diff --git a/doc/class-config.DBConfig.html b/doc/class-config.DBConfig.html new file mode 100644 index 0000000..8ec94fa --- /dev/null +++ b/doc/class-config.DBConfig.html @@ -0,0 +1,258 @@ + + + + + + + Class config\DBConfig | GeoApi + + + + + + + + +
+ +
+ +
+ + + + diff --git a/doc/class-HelloApiSQLManager.html b/doc/class-database.SpsSqlManager.html similarity index 60% rename from doc/class-HelloApiSQLManager.html rename to doc/class-database.SpsSqlManager.html index 27bc873..45e281a 100644 --- a/doc/class-HelloApiSQLManager.html +++ b/doc/class-database.SpsSqlManager.html @@ -4,10 +4,10 @@ - Class HelloApiSQLManager | GeoApi + Class database\SpsSqlManager | GeoApi - + @@ -21,7 +21,11 @@

Namespaces

    -
  • None +
  • api +
  • +
  • config +
  • +
  • database
  • PHP
  • @@ -43,12 +47,8 @@

    Classes

    @@ -76,7 +76,7 @@ Overview
  • - Namespace + Namespace
  • Class
  • @@ -91,25 +91,24 @@
    -

    Class HelloApiSQLManager

    +

    Class SpsSqlManager

    -

    The SQLManager manage the SQL-Connection for an API

    +

    Description of SpsSqlManager

    - SQLManager - +database\SQLManager
    Extended by -HelloApiSQLManager +database\SpsSqlManager
    @@ -125,12 +124,14 @@
    - + Namespace: database
    Author: stubbfel
    - Located at database/HelloApiSQLManager.php
    + Since: + 20.06.2013
    + Located at database/SpsSqlManager.php
    @@ -148,22 +149,24 @@
    # - __construct( ) + __construct( )
    +

    Default-Constructor

    +
    @@ -179,48 +182,63 @@
    # - __destruct( ) + __destruct( )
    +

    Default-DEConstructor

    +
    - + public - + array
    - # - sendHelloQuery( ) + # + sendSpsQuery( array $queryArgs = array() )
    +

    Methods send an query for the sps-service

    +