/** * Ok, so $meta_only doesn't mean anything in this class. So sue * me. You can use it, but nothing will happen. */ public function getData($max_tags = 0, $meta_only = false) { $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'tag.php', 'GET'); $fc->set_getfields(array('folksotag' => $this->url, 'folksofancy' => 1, 'folksodatatype' => 'xml')); $result = $fc->execute(); $status = $fc->query_resultcode(); $this->store_new_xml($result, $status); }
/** * Retrieves an xml list of tags and sets the $this->ptags object. * * @param A resource, either an id or a URL. Default is to use $this->url. * @returns folksoPagetags with only the xml part ($rm->xml). */ public function getData($url = '', $max = 0) { $fc = new folksoClient($this->loc->db_server, $this->loc->get_path . 'resource.php', 'GET'); $fc->set_getfields(array('folksores' => $url ? $url : $this->url, 'folksodatatype' => 'xml')); if (is_numeric($max) && $max > 0) { $fc->add_getfield('limit', $max); } $result = $fc->execute(); $status = $fc->query_resultcode(); $this->store_new_xml($result, $status); return $this; }
/** * Note: $this->tag must be set for getData to work. * * @param $max_tags * @param $meta_only Here just to preserve the interface. Does nothing. * @param $cloud_type Unused, though maybe could be used some day for something. */ public function getData($max_tags = 0, $meta_only = false, $cloud_type = '') { $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'tag.php', 'GET'); $fc->set_getfields(array('folksorelated' => 1, 'folksotag' => $this->tag)); /** will eventually need a datatype here **/ $result = $fc->execute(); $status = $fc->query_resultcode(); if (!$status) { trigger_error('Internal request failed.', E_USER_ERROR); } $this->store_new_xml($result, $status); return $this; }
/** * None of the parameters are used. Everything is based on the * current url instead. */ public function getData($max_tags = 0, $meta_only = false, $cloudtype = '') { $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'resource.php', 'GET'); /** we do not set the datatype because right now this request automatically returns an XML doc **/ $fc->set_getfields(array('folksores' => $this->url, 'folksoean13list' => 1)); $result = $fc->execute(); $status = $fc->query_resultcode(); if (!$status) { trigger_error('no valid status here.', E_USER_ERROR); } $this->store_new_xml($result, $status); return $this; }
function testGetfields() { $fields = array('folksoStuff' => 'bob', 'folksoThing' => 'blender'); $this->cl->set_getfields($fields); $this->assertTrue(is_string($this->cl->getfields)); $this->assertEqual($this->cl->getfields, 'folksoStuff=bob&folksoThing=blender'); $this->assertEqual($this->cl->build_req(), 'localhost/tag.php?folksoStuff=bob&folksoThing=blender'); $this->cl->datastyle = 'b'; $this->assertEqual($this->cl->build_req(), 'localhost/tag.php?folksoStuff=bob&folksoThing=blender&folksodatastyle=b'); $this->assertEqual($this->cl->content_length, 0); $this->cl->add_getfield('splurg', 'blorp'); $this->assertPattern('/blorp/', $this->cl->build_req()); $this->assertPattern('/splurg/', $this->cl->build_req()); print $this->cl->build_req(); $bb = new folksoClient('localhost', '/tag.php', 'GET'); $bb->set_getfields(array('folksoB' => 'bébé')); $this->assertEqual($bb->getfields, 'folksoB=' . urlencode('bébé')); $bb->add_getfield('bebop', 'areebob'); $this->assertPattern('/bebop=/', $bb->build_req()); $this->assertPattern('/=areebob/', $bb->build_req()); $this->cl->execute(); $this->assertEqual($this->cl->query_resultcode(), 200); }
/** * Get the raw cloud information from the server. This data is * stored in $this->pdata->cloud. * * @returns folksoCloud object. */ public function getData($max_tags = 0, $meta_only = false, $cloudtype = '') { $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'resource.php', 'GET'); $fc->set_getfields(array('folksoclouduri' => 1, 'folksores' => $this->url, 'folksodatatype' => 'xml', 'folksolimit' => $max_tags)); if ($cloudtype == 'bypop') { $fc->add_getfield('bypop', 1); } elseif ($cloudtype == 'bydate') { $fc->add_getfield('bydate', 1); } $result = $fc->execute(); $status = $fc->query_resultcode(); if (!$status) { trigger_error('no valid status here.', E_USER_ERROR); } $this->store_new_xml($result, $status); return $this; }
<?php require_once 'folksoClient.php'; $cl = new folksoClient('localhost', '/commun3/folksonomie/resource.php', 'GET'); $cl->set_getfields(array('folksores' => curPageURL())); $result = $cl->execute(); print $cl->query_resultcode(); function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") { $pageURL .= "s"; } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; } return $pageURL; }
//$dbc = $loc->locDBC(); $test_dbc = new folksoDBconnect('localhost', 'tester_dude', 'testy', 'testostonomie'); $fks = new folksoSession($test_dbc); if ($_COOKIE['folksosess']) { $fks->setSid($_COOKIE['folksosess']); } else { // warning, dev only!!!!! $fks->startSession('gustav-2009-001'); } $u = $fks->userSession(); if (!$u instanceof folksoUser) { print "Error not a logged user"; // header('Location: ' . $loc->loginPage()); exit; } $cl = new folksoClient('localhost', $loc->server_web_path . 'user.php', 'GET'); print $cl->method; $cl->set_getfields(array('folksouid' => $u->userid, 'folksogetmytags' => 1)); $cl->set_datastyle('json'); print_r($cl->build_req()); $result = $cl->execute(); if ($cl->query_resultcode() == 200) { $message = 'w00t ' . $result; } elseif ($cl->query_resultcode() == 204) { $message = "L'utilisateur n'a pas encore de tags"; } else { $message = "Erreur rescode" . $cl->query_resultcode() . ':: ' . $result . 'how bout that'; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
</style> </head> <body> <div id="superscreen"> <!-- screen that appears with dialogue boxes --> <div id="superinfobox"> <a id="closess" href="#">Fermer</a> </div> </div> <!-- end of superscreen --> <div id="container"> <?php if ($_GET['tag']) { $tagthing = strip_tags(substr($_GET['tag'], 0, 255)); $fc = new folksoClient('localhost', $loc->server_web_path . 'tag.php', 'get'); $fc->set_getfields(array('folksotag' => $tagthing, 'folksofancy' => '1')); $reslist = $fc->execute(); if ($fc->query_resultcode() == 200) { $resources = new DOMDocument(); $resources->loadXML($reslist); $xsl = new DOMDocument(); $xsl->load($loc->xsl_dir . "resourcelist.xsl"); $proc = new XsltProcessor(); $xsl = $proc->importStylesheet($xsl); $form = $proc->transformToDoc($resources); print $form->saveXML(); } else { print $fc->query_resultcode(); } }
<?php require_once '/var/www/dom/fabula/commun3/folksonomie/folksoClient.php'; $cl = new folksoClient('localhost', '/commun3/folksonomie/resource.php', 'GET'); $cl->set_getfields(array('folksoclouduri' => 'http://www.fabula.org')); $result = $cl->execute(); print $cl->query_resultcode(); /*$fc->set_postfields(array('folksovisituri' => curPageURL(), 'folksourititle' => $page_titre ? $page_titre : ''));*/ #print $fc->build_req(); #print $fc->query_resultcode();
/** * Backend to public_tag_resource_list() */ private function resource_list($tag) { $fc = new folksoClient($this->loc->web_url, $this->loc->server_web_path . 'tag.php', 'GET'); $fc->set_getfields(array('folksotag' => $tag, 'folksofancy' => 1, 'folksodatatype' => 'xml')); $result = $fc->execute(); $r = new folksoPageData($fc->query_resultcode()); $r->xml = $result; return $r; }