Beispiel #1
0
/**
 * Web interface for updating basic information about a resource by
 * repolling that resource.
 *
 * These functions are separated from resource.php because they use
 * the Curl libraries that do not usually need to be called.
 *
 * @package Folkso
 * @author Joseph Fahey
 * @copyright 2008 Gnu Public Licence (GPL)
 * @subpackage Tagserv
 */
require_once 'folksoUrl.php';
require_once 'folksoQuery.php';
$srv = new folksoServer(array('methods' => array('POST'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponse('post', array('required' => array('res')), 'reload'));
$srv->Respond();
/**
 * Given a resource, this function fetches that resource and updates
 * its status in the database if anything has changed, in particular
 * the title field.
 *
 * If the resource is no longer available (returns 404), the resource
 * is removed. Is this too radical?
 *
 */
function reload(folksoQuery $q, folksoWsseCreds $cred, folksoDBconnect $dbc)
{
    $i = new folksoDBinteract($dbc);
    if ($i->db_error()) {
Beispiel #2
0
<?php

/**
 * Interface for responding to autocomplete tag requests from the
 * jquery.autocomplete plugin.
 *
 * @package Folkso
 * @author Joseph Fahey
 * @copyright 2008 Gnu Public Licence (GPL)
 * @subpackage Tagserv
 */
require_once 'folksoTags.php';
require_once 'folksoResponse.php';
require_once 'folksoResponder.php';
$srv = new folksoServer(array('methods' => array('GET'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('q')), 'autocomplete'));
$srv->Respond();
function autocomplete(folksoQuery $q, folksoDBconnect $dbc, folksoSession $fks)
{
    $i = new folksoDBinteract($dbc);
    $r = new folksoResponse();
    if ($i->db_error()) {
        $r->dbConnectionError($i->error_info());
        return $r;
    }
    $sql = "SELECT tagdisplay " . "FROM tag " . "WHERE tagnorm like '" . $i->dbescape(strtolower($q->get_param('q'))) . "%'";
    $i->query($sql);
    switch ($i->result_status) {
        case 'DBERR':
            $r->dbQueryError($i->error_info());
            return $r;
Beispiel #3
0
<?php

require_once 'folksoTags.php';
/**
 *
 * @package Folkso
 * @author Joseph Fahey
 * @copyright 2008 Gnu Public Licence (GPL)
 */
$srv = new folksoServer(array('methods' => array('GET', 'POST'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponse('get', array('required_single' => array('all')), 'getAllMetas'));
$srv->addResponseObj(new folksoResponse('get', array('required_single' => array('q')), 'metacomplete'));
$srv->Respond();
function getAllMetas(folksoQuery $q, folksoWsseCreds $cred, folksoDBconnect $dbc)
{
    $i = new folksoDBinteract($dbc);
    if ($i->db_error()) {
        header('HTTP/1.1 501 Database error');
        die($i->error_info());
    }
    $sql = 'SELECT id, tagdisplay FROM metatag WHERE id <> 1';
    $i->query($sql);
    switch ($i->result_status) {
        case 'DBERR':
            header('HTTP/1.1 501 Database error');
            die($i->error_info());
            break;
        case 'NOROWS':
            header('HTTP/1.1 204 There is a problem with the metatag list');
            return;
            break;
Beispiel #4
0
 * @subpackage Tagserv
 */
require_once 'folksoTags.php';
require_once 'folksoAlpha.php';
require_once 'folksoTagQuery.php';
require_once 'folksoSession.php';
/** 
 * When the tag's name or id is known, the field name "tag"
 * ("folksotag" if we maintain that system) will always be used. It
 * can be a multiple field (that is: "tag001, tag002, tag003...").
 *
 * The "tag" field should be able to accept either a numerical id or a
 * tag name. In this case the tag name is not necessarily normalized.
 *
 */
$srv = new folksoServer(array('methods' => array('POST', 'GET', 'HEAD', 'DELETE'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('fancy'), 'required_single' => array('tag')), 'fancyResource'));
$srv->addResponseObj(new folksoResponder('get', array('required_single' => array('tag', 'resources')), 'getTagResources'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('tag'), 'exclude' => array('related')), 'getTag'));
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('newtag')), 'singlePostTag'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('autotag')), 'autoCompleteTags'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('related')), 'relatedTags'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('byalpha')), 'byalpha'));
$srv->addResponseObj(new folksoResponder('head', array('required' => array('tag')), 'headCheckTag'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('alltags')), 'allTags'));
/**
 * Note that the "tag" field here refers to the resource that will be
 * deleted during the merge.
 */
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('tag', 'target')), 'tagMerge'));
$srv->addResponseObj(new folksoResponder('delete', array('required_single' => array('tag')), 'deleteTag'));
Beispiel #5
0
/**
 * Web service for accessing, creating and modifying tag information
 * about resources (URLs).
 *
 * @package Folkso
 * @author Joseph Fahey
 * @copyright 2008 Gnu Public Licence (GPL)
 * @subpackage Tagserv
 */
require_once 'folksoTags.php';
require_once 'folksoIndexCache.php';
require_once 'folksoUrl.php';
require_once 'folksoResQuery.php';
require_once 'folksoSession.php';
$srv = new folksoServer(array('methods' => array('POST', 'GET', 'HEAD'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponder('head', array('required' => array('res')), 'isHead'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('clouduri', 'res')), 'tagCloudLocalPop'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('res'), 'exclude' => array('clouduri', 'visit', 'note', 'ean13list')), 'getTagsIds'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('res', 'ean13list'), 'exclude' => array('delete', 'clouduri', 'note')), 'resEans'));
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('res', 'tag'), 'required' => array('delete'), 'exclude' => array('meta', 'newresource', 'ean13')), 'unTag'));
$srv->addResponseObj(new folksoResponder('post', array('required' => array('res', 'tag'), 'exclude' => array('delete', 'newresource')), 'tagResource'));
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('res'), 'required' => array('visit'), 'exclude' => array('tag', 'note')), 'visitPage'));
$srv->addResponseObj(new folksoResponder('post', array('required' => array('res', 'newtitle'), 'exclude' => array('note', 'delete')), 'addResource'));
$srv->addResponseObj(new folksoResponder('post', array('required' => array('res', 'ean13'), 'exclude' => array('newean13', 'oldean13', 'note', 'meta', 'tag', 'delete')), 'assocEan13'));
$srv->addResponseObj(new folksoResponder('post', array('required' => array('res', 'newean13', 'oldean13'), 'exclude' => array('ean13', 'tag', 'delete')), 'modifyEan13'));
$srv->addResponseObj(new folksoResponder('post', array('required' => array('delete', 'res', 'ean13'), 'exclude' => array('tag', 'note')), 'deleteEan13'));
$srv->addResponseObj(new folksoResponder('delete', array('required' => array('res', 'tag')), 'unTag'));
$srv->addResponseObj(new folksoResponder('delete', array('required_single' => array('res'), 'exclude' => array('tag')), 'rmRes'));
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('res', 'delete'), 'exclude' => array('tag')), 'rmRes'));
$srv->addResponseObj(new folksoResponder('post', array('required_single' => array('res', 'note'), 'exclude' => array('tag', 'delete')), 'addNote'));
Beispiel #6
0
/**
 * Web service for accessing users tags.
 *
 * @package Folkso
 * @author Joseph Fahey
 * @copyright 2008 Gnu Public Licence (GPL)
 * @subpackage Tagserv
 */
require_once 'folksoTags.php';
require_once 'folksoIndexCache.php';
require_once 'folksoUrl.php';
require_once 'folksoSession.php';
require_once 'folksoUser.php';
require_once 'folksoUserQuery.php';
$srv = new folksoServer(array('methods' => array('POST', 'GET', 'HEAD'), 'access_mode' => 'ALL'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('getmytags')), 'getMyTags'));
$srv->addResponseObj(new folksoResponder('get', array('required' => array('tag')), 'getUserResByTag'));
$srv->Respond();
/**
 * Just a list of tags
 */
function getMyTags(folksoQuery $q, folksoDBconnect $dbc, folksoSession $fks)
{
    $r = new folksoResponse();
    $u = $fks->userSession();
    if (!$u instanceof folksoUser) {
        if (!$q->is_param('uid')) {
            return $r->unAuthorized($u);
            // add message about logging in?
        } else {