Geeklog
[ class tree: Geeklog ] [ index: Geeklog ] [ all elements ]

Procedural File: lib-webservices.php

Source Location: /system/lib-webservices.php



Page Details:

Implementation of the Webservices functions for the Atom Publishing Protocol (AtomPub).








WS_APP_NS [line 46]

WS_APP_NS = 'http://www.w3.org/2007/app'

[ Top ]



WS_APP_NS2 [line 47]

WS_APP_NS2 = 'http://purl.org/atom/app#'

[ Top ]



WS_ATOM_NS [line 45]

WS_ATOM_NS = 'http://www.w3.org/2005/Atom'
Namespaces


[ Top ]



WS_EXTN_NS [line 48]

WS_EXTN_NS = 'http://www.geeklog.net/xmlns/app/gl'

[ Top ]




WS_arrayToEntryXML [line 655]

void WS_arrayToEntryXML( array $arr, array $extn_elements, object &$entry_elem, DOMDocument &$atom_doc)

Converts an array into an XML entry node



Parameters

array   $arr   the array which is to be converted into XML
array   $extn_elements   Geeklog-specific extension elements
object   &$entry_elem   entry to append to
DOMDocument   &$atom_doc   the Atom document to which the entry should be appended
[ Top ]



WS_authenticate [line 778]

void WS_authenticate( )

Authenticates the user if authentication headers are present

Our handling of the speedlimit here requires some explanation ... Atompub clients will usually try to do everything without logging in first. Since that would mean that we can't provide feeds for drafts, items with special permissions, etc. we ask them to log in (PLG_RET_AUTH_FAILED). That, however, means that every request from an Atompub client will count as one failed login attempt. So doing a couple of requests in quick succession will surely get the client blocked. Therefore

  • a request without any login credentials counts as one failed login attempt
  • a request with wrong login credentials counts as two failed login attempts
  • if, after a successful login, we have only one failed attempt on record, we reset the speedlimit
This still ensures that
  • repeated failed logins (without or with invalid credentials) will cause the client to be blocked eventually
  • this can not be used for dictionary attacks




[ Top ]



WS_delete [line 427]

void WS_delete( )

Handles the DELETE request



[ Top ]



WS_dissectURI [line 116]

void WS_dissectURI( array &$args)

Dissects the URI and obtains parameters



Parameters

array   &$args   the array to store any input parameters
[ Top ]



WS_error [line 64]

void WS_error( string $error_code, [string $error_desc = ''])

Displays an error message with the appropriate HTTP error-code



Parameters

string   $error_code   the name of the error
string   $error_desc   a short description of the actual error (optional)
[ Top ]



WS_get [line 264]

void WS_get( )

Handles the GET request



[ Top ]



WS_getContent [line 461]

void WS_getContent( array &$args, object $atom_doc, object $node)

Get 'content', depending on the type



Tags:

todo:  I guess we could at least support 'text/plain', 'text/html', etc.


Parameters

array   &$args   the array to which the content is to be appended
object   $atom_doc   current DOMDocument
object   $node   the 'content' node
[ Top ]



WS_makeId [line 995]

string WS_makeId( [string $slug = ''], [int $max_length = 40])

Create a new ID, preferrably from a provided 'Slug:' header

For more information on the 'Slug:' header, see RFC 5023, section 9.7




Tags:



Parameters

string   $slug   Content of the 'Slug:' header
int   $max_length   max. length of the created ID
[ Top ]



WS_post [line 155]

void WS_post( )

Handles the POST request



[ Top ]



WS_put [line 224]

void WS_put( )

Handles the PUT request



[ Top ]



WS_write [line 967]

void WS_write( string $text)

Buffers text for output



Parameters

string   $text   the text to be written
[ Top ]



WS_writeSync [line 977]

void WS_writeSync( )

Writes buffered text to output



[ Top ]



WS_xmlToArgs [line 510]

void WS_xmlToArgs( array &$args)

Converts the input XML into an argument array



Parameters

array   &$args   the array to which the arguments are to be appended
[ Top ]



Documentation generated on Sun, 02 Oct 2016 07:51:48 +0000 by phpDocumentor 1.4.3