function code_main() { // check if a session (w/ login) exists if (!isset($_SESSION['logged_in']) || $_SESSION['logged_in'] != "yes") { code_login_page(); } // check if we're trying to get metadata details. if so, chop up the request if (isset($_REQUEST['details_for']) && !empty($_REQUEST['details_for'])) { list($details_for_resource, $details_for_class) = explode("|", $_REQUEST['details_for']); } else { $details_for_resource = ""; $details_for_class = ""; } // set things up $rets = new phRETS(); $rets->AddHeader("Accept", "*/*"); $rets->AddHeader("RETS-Version", "RETS/{$_SESSION['rets_version']}"); $rets->AddHeader("User-Agent", $_SESSION['user_agent']); $rets->SetParam("cookie_file", $GLOBALS['cookie_file_name']); $rets->SetParam("compression_enabled", true); if ($_SESSION['force_basic'] == "true") { $rets->SetParam("force_basic_authentication", true); } // make first connection $connect = $rets->Connect($_SESSION['login_url'], $_SESSION['username'], $_SESSION['password'], $_SESSION['ua_pwd']); if (!$connect) { $error_details = $rets->Error(); $error_text = strip_tags($error_details['text']); $error_type = strtoupper($error_details['type']); show_error_page("<center><span style='color:red;font-weight:bold;'>{$error_type} ({$error_details['code']}) {$error_text}</span></center>"); } $resource_info = $rets->GetMetadataInfo(); page_header("Server Information"); echo "<div class='box'>\n\t<div class='box_heading dark-bg'>Server Information</div>\n\t<div class='box_content light-bg'>\n\t\t<table border='0' cellpadding='1' cellspacing='1' width='100%'>\n\t\t"; // read back information from connection request $rets_server_information = $rets->GetServerInformation(); echo "<tr><td width='25%' valign='top'><b>RETS Server:</b></td><td width='75%' class='detail'>{$rets_server_information['SystemDescription']}</td></tr>\n"; echo "<tr><td valign='top'><b>RETS System ID:</b></td><td class='detail'>{$rets_server_information['SystemID']}</td></tr>\n"; if (array_key_exists('TimeZoneOffset', $rets_server_information) && !empty($rets_server_information['TimeZoneOffset'])) { echo "<tr><td valign='top'><b>Server Timezone:</b></td><td class='detail'>{$rets_server_information['TimeZoneOffset']}</td></tr>\n"; } // read back information from connection request $full_login_url = $rets->GetLoginURL(); echo "<tr><td valign='top'><b>Login URL:</b></td><td class='detail'>{$full_login_url}</td></tr>\n"; // read back information from connection request $server_version = preg_replace('/RETS\\//', '', $rets->GetServerVersion()); echo "<tr><td valign='top'><b>RETS Version:</b></td><td class='detail'>{$server_version}</td></tr>\n"; // read back information from connection request $server_software = $rets->GetServerSoftware(); if (empty($server_software)) { $server_software = "(unknown)"; } echo "<tr><td valign='top'><b>Server Software:</b></td><td class='detail'>{$server_software}</td></tr>\n"; // read back information from connection request $auth_support = ""; if ($rets->CheckAuthSupport("digest") == true) { $auth_support .= "Digest, "; } if ($rets->CheckAuthSupport("basic") == true) { $auth_support .= "Basic, "; } $auth_support = preg_replace('/\\, $/', '', $auth_support); if (empty($auth_support)) { $auth_support = "(unknown - assuming Basic)"; // cURL blindly sends the login information if Basic so it doesn't give us a chance to auto-detect } echo "<tr><td valign='top'><b>Authen. Supported:</b></td><td class='detail'>{$auth_support}</td></tr>\n"; // read back information from login response $transactions = $rets->GetAllTransactions(); $transactions_list = ""; foreach ($transactions as $transaction) { $transactions_list .= "<acronym title='{$rets->capability_url[$transaction]}'>{$transaction}</acronym>, "; } $transactions_list = preg_replace('/\\, $/', '', $transactions_list); echo "<tr><td valign='top'><b>Transactions Supported:</b></td><td class='detail'>{$transactions_list}</td></tr>\n"; // make first general GetMetadata request to see what's there $rets_metadata_types = $rets->GetMetadataTypes(); $resources_avail = ""; foreach ($rets_metadata_types as $resource) { $resources_avail .= "<a href='#md-{$resource['Resource']}'>{$resource['Resource']}</a>, "; } $resources_avail = preg_replace('/\\, $/', '', $resources_avail); echo "<tr><td valign='top'><b>Metadata Resources:</b></td><td class='detail'>{$resources_avail}</td></tr>\n"; echo "\t\t</table>\n\t</div>\n\t</div>\n\t"; echo "\n<div class='box'>\n\t<div class='box_heading dark-bg'>Metadata Information</div>\n\t<div class='box_content light-bg'>\n\n"; $metadata_keyfield = array(); $metadata_details_pulldown = ""; foreach ($rets_metadata_types as $resource) { echo "<a name='md-{$resource['Resource']}'></a>"; $metadata_details_pulldown .= "<optgroup label='{$resource['Resource']}'>"; echo "<div class='box-inner white-bg'>"; echo "<b>{$resource['Resource']}</b><br/><br/>\n"; echo "<span style='font-size: 8pt;'>"; foreach ($resource['Data'] as $class) { $this_selected = $details_for_resource == $resource['Resource'] && $details_for_class == $class['ClassName'] ? " selected='selected'" : ""; $metadata_details_pulldown .= "<option value='{$resource['Resource']}|{$class['ClassName']}'{$this_selected}>{$class['ClassName']} - {$class['VisibleName']} - {$class['Description']}</option>"; echo " · <b><a href='' class='resource-class-link' data-resource='{$resource['Resource']}' data-class='{$class['ClassName']}' title='SystemName: {$class['ClassName']} StandardName: {$class['StandardName']}'>{$class['ClassName']}</a></b> - {$class['VisibleName']} - {$class['Description']}<br/>"; echo " StandardName: {$class['StandardName']} Last Updated: {$class['TableDate']} Version: {$class['TableVersion']}<br/>"; echo "<br/>\n"; } $metadata_details_pulldown .= "</optgroup>"; echo "</span>\n"; echo "</div>\n\n"; } echo "\n\n\t</div>\n</div>\n"; echo "\n<div class='box'>\n\t<a name='md-details' id='md-details'></a>\n\t<div class='box_heading dark-bg'>Metadata Details</div>\n\t<div class='box_content light-bg'>\n\n"; echo "<center><select name='details_for' id='resource-class-selector' ><option value=''></option>{$metadata_details_pulldown}</select></center><br/>"; echo "\n\n\t\t<div id='md-details-content'>\n\n\t\t</div>\n\n\t</div>\n</div>\n"; echo "\n<div style='text-align: center;'>\n<p><img src='{$GLOBALS['media_url']}search-icon-grey.gif' alt='Searchable Field'/> Searchable Field <img src='{$GLOBALS['media_url']}skey.png' alt='Key Field'/> Key Field <img src='{$GLOBALS['media_url']}star.png' alt='Required'/> Required <img src='{$GLOBALS['media_url']}heart.png' alt='InKeyIndex'/> InKeyIndex</p>\n</div>\n"; // disconnect from RETS server $rets->Disconnect(); page_footer(); }
if ($debugging) { echo "+ Resource {$type['Resource']}<br />\n"; } foreach ($type['Data'] as $class) { if ($debugging) { echo " + Class {$class['ClassName']}<br />\n"; } } } } /* Get some more RETS server info */ $rets_version = $rets->GetServerVersion(); if ($debugging) { echo "+ RETS version: {$rets_version}<br />\n"; } $server_software = $rets->GetServerSoftware(); if ($debugging) { echo "+ Server Technology: {$server_software}<br />\n"; } $last_url = $rets->LastRequestURL(); if ($debugging) { echo "+ Last URL: {$last_url}<br />\n"; } $server = $rets->GetServerInformation(); if ($debugging) { echo "+ System ID: {$server['SystemID']}<br />\n"; } if ($debugging) { echo "+ System Description: {$server['SystemDescription']}<br />\n"; } if ($debugging) {