Esempio n. 1
0
 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);
 }
Esempio n. 2
0
    $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">
  <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Language" content="fr-FR"/>
  <title>Mon (ma) Fabula</title>