From 401a60c7a7f42d76a90a65b978f1b182d4d06667 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 30 Mar 2015 20:13:07 -0400 Subject: [PATCH] Improve remember me + update vendor --- models/remember_me.php | 12 +++--- vendor/autoload.php | 2 +- vendor/composer/autoload_real.php | 10 ++--- vendor/composer/installed.json | 16 ++++---- vendor/fguillot/json-rpc/README.markdown | 9 +++-- .../fguillot/json-rpc/src/JsonRPC/Server.php | 6 ++- .../picofeed/docs/feed-parsing.markdown | 38 +++++++++++++++++++ .../picofeed/lib/PicoFeed/Reader/Reader.php | 14 +++++-- .../lib/PicoFeed/Rules/.phoronix.com.php | 2 +- .../PicoFeed/Rules/monwindowsphone.com.php | 4 +- 10 files changed, 81 insertions(+), 32 deletions(-) diff --git a/models/remember_me.php b/models/remember_me.php index 430acca..f90ced0 100644 --- a/models/remember_me.php +++ b/models/remember_me.php @@ -60,7 +60,7 @@ function authenticate() // Update the sequence write_cookie( $record['token'], - update($record['token'], $record['sequence']), + update($record['token']), $record['expiration'] ); @@ -92,7 +92,7 @@ function refresh() // Update the sequence write_cookie( $record['token'], - update($record['token'], $record['sequence']), + update($record['token']), $record['expiration'] ); } @@ -191,17 +191,15 @@ function cleanup() * * @access public * @param string $token Session token - * @param string $sequence Sequence token * @return string */ -function update($token, $sequence) +function update($token) { $new_sequence = Config\generate_token(); Database::get('db') ->table(TABLE) ->eq('token', $token) - ->eq('sequence', $sequence) ->update(array('sequence' => $new_sequence)); return $new_sequence; @@ -268,7 +266,7 @@ function write_cookie($token, $sequence, $expiration) $expiration, BASE_URL_DIRECTORY, null, - ! empty($_SERVER['HTTPS']), + \Helper\isSecureConnection(), true ); } @@ -301,7 +299,7 @@ function delete_cookie() time() - 3600, BASE_URL_DIRECTORY, null, - ! empty($_SERVER['HTTPS']), + \Helper\isSecureConnection(), true ); } diff --git a/vendor/autoload.php b/vendor/autoload.php index fd5712e..4e05002 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a::getLoader(); +return ComposerAutoloaderInit177dcd3c68ed52652977fcc464bd77bd::getLoader(); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index d6458f8..8c64f6e 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a +class ComposerAutoloaderInit177dcd3c68ed52652977fcc464bd77bd { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit177dcd3c68ed52652977fcc464bd77bd', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit177dcd3c68ed52652977fcc464bd77bd', 'loadClassLoader')); $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -42,14 +42,14 @@ class ComposerAutoloaderInit8ccf24e95a95febb275803014c1c9a9a $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequire8ccf24e95a95febb275803014c1c9a9a($file); + composerRequire177dcd3c68ed52652977fcc464bd77bd($file); } return $loader; } } -function composerRequire8ccf24e95a95febb275803014c1c9a9a($file) +function composerRequire177dcd3c68ed52652977fcc464bd77bd($file) { require $file; } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 68acbff..8a9e066 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -123,18 +123,18 @@ "source": { "type": "git", "url": "https://github.com/fguillot/JsonRPC.git", - "reference": "d64090706507dccab53e35ad5fcf00ae2502c647" + "reference": "d0feab084422fa937da10e3551196b1c6fdf6918" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/JsonRPC/zipball/d64090706507dccab53e35ad5fcf00ae2502c647", - "reference": "d64090706507dccab53e35ad5fcf00ae2502c647", + "url": "https://api.github.com/repos/fguillot/JsonRPC/zipball/d0feab084422fa937da10e3551196b1c6fdf6918", + "reference": "d0feab084422fa937da10e3551196b1c6fdf6918", "shasum": "" }, "require": { "php": ">=5.3.0" }, - "time": "2015-02-13 03:20:58", + "time": "2015-03-25 23:55:18", "type": "library", "installation-source": "dist", "autoload": { @@ -162,12 +162,12 @@ "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "8973f403ff6c16fb5200cfac44a58111c564b60d" + "reference": "7c28753d5936ba635435a8e0e941dcabee67b243" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/8973f403ff6c16fb5200cfac44a58111c564b60d", - "reference": "8973f403ff6c16fb5200cfac44a58111c564b60d", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/7c28753d5936ba635435a8e0e941dcabee67b243", + "reference": "7c28753d5936ba635435a8e0e941dcabee67b243", "shasum": "" }, "require": { @@ -181,7 +181,7 @@ "suggest": { "ext-curl": "PicoFeed will use cURL if present" }, - "time": "2015-03-25 18:09:25", + "time": "2015-03-30 23:34:59", "bin": [ "picofeed" ], diff --git a/vendor/fguillot/json-rpc/README.markdown b/vendor/fguillot/json-rpc/README.markdown index dd3e28e..7a5f5f1 100644 --- a/vendor/fguillot/json-rpc/README.markdown +++ b/vendor/fguillot/json-rpc/README.markdown @@ -82,6 +82,9 @@ $server->bind('myProcedure', 'Api', 'doSomething'); // Use a class instance instead of the class name $server->bind('mySecondProcedure', new Api, 'doSomething'); +// The procedure and the method are the same +$server->bind('doSomething', 'Api'); + echo $server->execute(); ``` @@ -147,10 +150,10 @@ use JsonRPC\Client; $client = new Client('http://localhost/server.php'); -$results = $client->batch(); +$results = $client->batch() ->foo(['arg1' => 'bar']) - ->random(1, 100); - ->add(4, 3); + ->random(1, 100) + ->add(4, 3) ->execute('add', [2, 5]) ->send(); diff --git a/vendor/fguillot/json-rpc/src/JsonRPC/Server.php b/vendor/fguillot/json-rpc/src/JsonRPC/Server.php index 0bd3b02..0213fd2 100644 --- a/vendor/fguillot/json-rpc/src/JsonRPC/Server.php +++ b/vendor/fguillot/json-rpc/src/JsonRPC/Server.php @@ -133,8 +133,12 @@ class Server * @param mixed $class Class name or instance * @param string $method Procedure name */ - public function bind($procedure, $class, $method) + public function bind($procedure, $class, $method = '') { + if ($method === '') { + $method = $procedure; + } + $this->classes[$procedure] = array($class, $method); } diff --git a/vendor/fguillot/picofeed/docs/feed-parsing.markdown b/vendor/fguillot/picofeed/docs/feed-parsing.markdown index 363156c..1ee2145 100644 --- a/vendor/fguillot/picofeed/docs/feed-parsing.markdown +++ b/vendor/fguillot/picofeed/docs/feed-parsing.markdown @@ -176,6 +176,44 @@ catch (PicoFeedException $e) { } ``` +HTTP basic auth +--------------- +If a feed requires basic auth headers, you can pass them as parameters to the **download** method, e.g.: + +```php +try { + $reader = new Reader; + + $user = 'john'; + $password = 'doe'; + + // Provide those values to the download method + $resource = $reader->download('http://linuxfr.org/news.atom', '', '', $user, $password); + + // Return true if the remote content has changed + if ($resource->isModified()) { + + $parser = $reader->getParser( + $resource->getUrl(), + $resource->getContent(), + $resource->getEncoding() + ); + + $feed = $parser->execute(); + + // Save your feed in your database + // ... + + } + else { + + echo 'Not modified, nothing to do!'; + } +} +catch (PicoFeedException $e) { + // Do something... +} +``` Feed and item properties ------------------------ diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Reader.php b/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Reader.php index fd629f0..ea3c4f2 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Reader.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Reader.php @@ -58,9 +58,11 @@ class Reader * @param string $url Feed url * @param string $last_modified Last modified HTTP header * @param string $etag Etag HTTP header + * @param string $username HTTP basic auth username + * @param string $password HTTP basic auth password * @return \PicoFeed\Client\Client */ - public function download($url, $last_modified = '', $etag = '') + public function download($url, $last_modified = '', $etag = '', $username = '', $password = '') { $url = $this->prependScheme($url); @@ -68,6 +70,8 @@ class Reader ->setConfig($this->config) ->setLastModified($last_modified) ->setEtag($etag) + ->setUsername($username) + ->setPassword($password) ->execute($url); } @@ -78,11 +82,13 @@ class Reader * @param string $url Feed or website url * @param string $last_modified Last modified HTTP header * @param string $etag Etag HTTP header + * @param string $username HTTP basic auth username + * @param string $password HTTP basic auth password * @return \PicoFeed\Client\Client */ - public function discover($url, $last_modified = '', $etag = '') + public function discover($url, $last_modified = '', $etag = '', $username = '', $password = '') { - $client = $this->download($url, $last_modified, $etag); + $client = $this->download($url, $last_modified, $etag, $username, $password); // It's already a feed or the feed was not modified if (! $client->isModified() || $this->detectFormat($client->getContent())) { @@ -96,7 +102,7 @@ class Reader throw new SubscriptionNotFoundException('Unable to find a subscription'); } - return $this->download($links[0], $last_modified, $etag); + return $this->download($links[0], $last_modified, $etag, $username, $password); } /** diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.phoronix.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.phoronix.com.php index 0d10eff..0fd99f7 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.phoronix.com.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/.phoronix.com.php @@ -2,7 +2,7 @@ return array( 'test_url' => 'http://www.phoronix.com/scan.php?page=article&item=amazon_ec2_bare&num=1', 'body' => array( - '//article[@class="KonaBody"]', + '//div[@class="KonaBody"]', ), 'strip' => array( ) diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/monwindowsphone.com.php b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/monwindowsphone.com.php index be7f208..cfc4b2d 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Rules/monwindowsphone.com.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Rules/monwindowsphone.com.php @@ -2,8 +2,8 @@ return array( 'test_url' => 'http://www.monwindowsphone.com/tout-savoir-sur-le-centre-d-action-de-windows-phone-8-1-t40574.html', 'body' => array( - '//div[@class="postmessage"]' + '//div[@class="blog-post-body"]' ), 'strip' => array( ), -); \ No newline at end of file +);