Esempio n. 1
0
        $href = $_POST["url"];
    } else {
        $href = $_GET["url"];
    }
    $rate = $_POST["rate"];
    $comment_area = $_POST["comment_area"];
}
$href = LABS_PHP_HOME . "/" . $href;
$aschild = isset($_GET["aschild"]);
if ($aschild) {
    $js_parency = "parent.";
} else {
    $js_parency = "window.";
}
//extracting data from registry,
$rr = new RemoteRegistry(REGISTRY_ATOM_INTERFACE, $username, $password);
if (isset($rate) && !empty($rate)) {
    $rr->rateResource($href, $rate);
}
if (isset($comment_area) && !empty($comment_area)) {
    $comment = new Comment();
    $comment->text = $comment_area;
    $comment->user = $username;
    $rr->addComment($href, $comment);
}
$content = $rr->get($href);
$title = $content->title;
$parent_title = $content->parent_path;
$extracted_title = substr($title, strlen($parent_title) + 1);
$author = $content->author_username;
$created_time = date('M d Y h:i:s A', (int) $content->created_time);
Esempio n. 2
0
File: index.php Progetto: ztobs/wsf
<?php

require_once "defines.php";
require_once REGISTRY_PATH . "RemoteRegistry.php";
session_start();
$username = $password = NULL;
if (array_key_exists("wsf_php_demo_site_username", $_SESSION)) {
    $username = $_SESSION["wsf_php_demo_site_username"];
}
if (array_key_exists("wsf_php_demo_site_password", $_SESSION)) {
    $password = $_SESSION["wsf_php_demo_site_password"];
}
$rr = new RemoteRegistry(REGISTRY_ATOM_INTERFACE, $username, $password);
$contents = $rr->get(LABS_PHP_HOME);
$parent_title = $entries = NULL;
if ($contents) {
    $parent_title = $contents->title;
    $entries = $contents->entries;
}
$resources = array();
$i = 0;
if (is_array($entries)) {
    foreach ($entries as $title => $href) {
        $resources[$i] = array();
        $content = $rr->get($href);
        $properties = $content->properties;
        if (is_array($properties)) {
            $demo = $properties["demo"];
            $src = $properties["src"];
            $doc = $properties["doc"];
        }
Esempio n. 3
0
File: login.php Progetto: ztobs/wsf
<?php

require_once "defines.php";
require_once REGISTRY_PATH . "RemoteRegistry.php";
session_start();
$username = $_POST["username"];
$password = $_POST["password"];
$login_failed = FALSE;
if ($username !== NULL && !empty($username)) {
    $rr = new RemoteRegistry(REGISTRY_ATOM_INTERFACE, $username, $password);
    $response = $rr->rateResource(LABS_PHP_HOME, 5);
    if ($response == "200") {
        $_SESSION["wsf_php_demo_site_username"] = $username;
        $_SESSION["wsf_php_demo_site_password"] = $password;
        header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
    } else {
        $login_failed = true;
    }
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<?php 
if (WEB_VERSION == "php") {
    ?>
    <title>Login - PHP Web Services - Code, Samples, Demos and Tutorials</title>
<?php 
} else {
Esempio n. 4
0
<?php

require_once "defines.php";
require_once REGISTRY_PATH . "RemoteRegistry.php";
session_start();
$username = $_SESSION["wsf_php_demo_site_username"];
$password = $_SESSION["wsf_php_demo_site_password"];
if (FORM_METHOD == "GET") {
    $tag = $_GET["tag"];
} else {
    $tag = $_POST["tag"];
}
$rr = new RemoteRegistry(REGISTRY_ATOM_INTERFACE, $username, $password);
$contents = $rr->getResourcePathsWithTag($tag);
//$parent_title = $contents->title;
$parent_title = LABS_PHP_HOME;
$entries = $contents->entries;
$resources = array();
$i = 0;
//print_r($entries);
if (is_array($entries)) {
    foreach ($entries as $title => $href) {
        $extracted_href = substr($href, strlen(REGISTRY_ATOM_INTERFACE) - 1);
        $content = $rr->get($extracted_href);
        if (strstr($extracted_href, $parent_title) === FALSE) {
            continue;
        }
        $extracted_title = substr($title, strlen($parent_title) + 1);
        if (strlen($extracted_title) == 0) {
            continue;
        }
Esempio n. 5
0
        $registration_message = "Registration Failed, You should provide the Username!";
    } else {
        if (isset($password) && empty($password)) {
            $registration_failed = TRUE;
            $registration_message = "Registration Failed, Password should be provided!";
        } else {
            if ($password != $confirm_password) {
                $registration_failed = TRUE;
                $registration_message = "Registration Failed, Passoword doesn't match!";
            } else {
                if (isset($username) && $real_image_code != md5($image_code)) {
                    $registration_failed = TRUE;
                    $registration_message = "You Image code is incorrect, Please correct it!";
                } else {
                    if ($username !== NULL && !empty($username)) {
                        $rr = new RemoteRegistry(REGISTRY_ATOM_INTERFACE, ADMIN_USER, ADMIN_PASSWORD);
                        $response = $rr->addUser($username, $password, $confirm_password, USER_ROLE, $friendly_name);
                        if ($response == "200") {
                            header("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/thanks.php");
                        } else {
                            $registration_failed = TRUE;
                            $registration_message = "Registration Failed, Username already exist or entered fields are incorrect!";
                        }
                    }
                }
            }
        }
    }
}
/* to generate the image */
define("IMAGE_WIDTH", 200);
Esempio n. 6
0
<?php

require "RemoteRegistry.php";
$rr = new RemoteRegistry("http://localhost:9090/wso2registry/atom/", "admin", "admin");
//$response = $rr-> get("/test/test");
//$response = $rr->delete("/test/test/notes2");
//print_r($response);
//$response = $rr->get("/test/test/good_morning");
//print_r($response);
//$comment = new Comment();
//$comment->text = "comment from php";
//$comment->user = "******";
//
//$response = $rr->addComment("/test/test/mytest_file", $comment);
//$comments = $rr->getComments("/test/test/mytest_file");
//
//
//foreach($comments as $comment)
//{
//	echo "comment\n";
//	echo "user: "******"\n";
//	echo "text: ".$comment->text."\n";
//}
//$response = $rr->getAverageRating("/test/test/mytest_file");
//
//echo $response;
//$response = $rr->getUserRating("/test/test/mytest_file", "dimuthu");
//
//echo $response;
//$response = $rr->applyTag("/test/test/mytest_file", "php1, php2, php3");
//$tags = $rr->getTags("/test/test/mytest_file");