2013-09-06 05:00:06 +00:00
< ? php
function pubsites_content ( & $a ) {
2013-09-29 18:44:57 +00:00
require_once ( 'include/dir_fns.php' );
2013-09-06 05:00:06 +00:00
$dirmode = intval ( get_config ( 'system' , 'directory_mode' ));
if (( $dirmode == DIRECTORY_MODE_PRIMARY ) || ( $dirmode == DIRECTORY_MODE_STANDALONE )) {
$url = z_root () . '/dirsearch' ;
}
if ( ! $url ) {
$directory = find_upstream_directory ( $dirmode );
2014-04-26 01:10:23 +00:00
$url = $directory [ 'url' ] . '/dirsearch' ;
2013-09-06 05:00:06 +00:00
}
$url .= '/sites' ;
$o .= '<h1>' . t ( 'Public Sites' ) . '</h1>' ;
2013-10-30 08:58:45 +00:00
$o .= '<div class="descriptive-text">' .
2013-11-15 02:36:09 +00:00
t ( 'The listed sites allow public registration into the Red Matrix. All sites in the matrix are interlinked so membership on any of them conveys membership in the matrix as a whole. Some sites may require subscription or provide tiered service plans. The provider links <strong>may</strong> provide additional details.' ) . '</div>' . EOL ;
2013-10-30 08:58:45 +00:00
2013-09-06 05:00:06 +00:00
$ret = z_fetch_url ( $url );
if ( $ret [ 'success' ]) {
$j = json_decode ( $ret [ 'body' ], true );
if ( $j ) {
2013-10-30 08:58:45 +00:00
$o .= '<table border="1"><tr><td>' . t ( 'Site URL' ) . '</td><td>' . t ( 'Access Type' ) . '</td><td>' . t ( 'Registration Policy' ) . '</td><td>' . t ( 'Location' ) . '</td></tr>' ;
2014-01-15 11:12:47 +00:00
if ( $j [ 'sites' ]) {
foreach ( $j [ 'sites' ] as $jj ) {
$o .= '<tr><td>' . '<a href="' . (( $jj [ 'sellpage' ]) ? $jj [ 'sellpage' ] : $jj [ 'url' ] . '/register' ) . '" >' . $jj [ 'url' ] . '</a>' . '</td><td>' . $jj [ 'access' ] . '</td><td>' . $jj [ 'register' ] . '</td><td>' . $jj [ 'location' ] . '</td></tr>' ;
}
2013-09-06 05:00:06 +00:00
}
$o .= '</table>' ;
}
}
return $o ;
}