<?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"]; }
$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); $last_updated_user = $content->last_updated_username; $last_updated_time = date('M d Y h:i:s A', (int) strtotime($content->updated)); $subtitle = $content->subtitle; $avg_ratings = $rr->getAverageRating($href); if ($username !== NULL && !empty($username)) { $user_ratings = $rr->getUserRating($href, $username); } else { $user_ratings = 0; } $tags_array = $rr->getTags($href);
$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; } $resources[$i] = array(); $resources[$i]["title"] = $extracted_title; $resources[$i]["path"] = $title; $resources[$i]["author"] = $content->author_username; $resources[$i]["subtitle"] = $content->subtitle; $ratings = $rr->getAverageRating($extracted_href); $resources[$i]["ratings"] = $ratings; $tags_array = $rr->getTags($extracted_href);