Compare commits

..

No commits in common. "073fba5312a2b95fa9760921ad0bbb16ddc94359" and "63532c54ea10200749920e47b655e2efcdf2b509" have entirely different histories.

3 changed files with 6 additions and 6 deletions

View File

@ -38,13 +38,13 @@ To configure an apache server, add the following rewrite rules:
<Directory /where/ever/you/put/it> <Directory /where/ever/you/put/it>
RewriteEngine on RewriteEngine on
RewriteBase / RewriteBase /
RewriteRule ^api/federator/(.+)$ federator.php?_call=$1 [L] RewriteRule ^api/(.+)$ api.php?_call=$1 [L]
RewriteRule ^(\.well-known/.*)$ /federator.php?_call=$1 [L,END] RewriteRule ^(\.well-known/.*)$ /api.php?_call=$1 [L,END]
</Directory> </Directory>
With the dummy plugin and everything installed correctly a With the dummy plugin and everything installed correctly a
> curl -v http://localhost/api/federator/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone" > curl -v http://localhost/api/v1/dummy/moo -H "X-Session: somethingvalid" -H "X-Profile: ihaveone"
should return a piece of ascii art. should return a piece of ascii art.

View File

@ -32,8 +32,7 @@ class User
openssl_pkey_export($private_key, $private); openssl_pkey_export($private_key, $private);
try { try {
$sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)'; $sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)';
$sql .= ' values (?, ?, ?, ?, now() + interval 1 day)'; $sql .= ' values (?, ?, ?, ?, now() + interval 1 day) on duplicate key update validuntil=now() + interval 1 day';
$sql .= ' on duplicate key update validuntil=now() + interval 1 day';
$stmt = $dbh->prepare($sql); $stmt = $dbh->prepare($sql);
if ($stmt === false) { if ($stmt === false) {
throw new \Federator\Exceptions\ServerError(); throw new \Federator\Exceptions\ServerError();
@ -120,7 +119,8 @@ class User
} }
} }
if ($cache !== null) { if ($cache !== null) {
if ($user->id === null && $user->externalid !== null) { print_r($user);
if ($user->id === null) {
self::addLocalUser($dbh, $user, $_name); self::addLocalUser($dbh, $user, $_name);
} }
$cache->saveRemoteUserByName($_name, $user); $cache->saveRemoteUserByName($_name, $user);