2015-08-23 22:38:18 +02:00
< ? php
function pubsites_content ( & $a ) {
require_once ( 'include/dir_fns.php' );
$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 );
$url = $directory [ 'url' ] . '/dirsearch' ;
}
$url .= '/sites' ;
2015-11-15 19:51:39 +01:00
$o .= '<div class="generic-content-wrapper-styled">' ;
2015-08-23 22:38:18 +02:00
$o .= '<h1>' . t ( 'Public Sites' ) . '</h1>' ;
$o .= '<div class="descriptive-text">' .
t ( 'The listed sites allow public registration for the $Projectname network. All sites in the network are interlinked so membership on any of them conveys membership in the network as a whole. Some sites may require subscription or provide tiered service plans. The provider links <strong>may</strong> provide additional details.' ) . '</div>' . EOL ;
$ret = z_fetch_url ( $url );
if ( $ret [ 'success' ]) {
$j = json_decode ( $ret [ 'body' ], true );
if ( $j ) {
$rate_meta = (( local_channel ()) ? '<td>' . t ( 'Rate this hub' ) . '</td>' : '' );
2015-10-24 13:04:14 +02: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><td>' . t ( 'Project' ) . '</td><td>' . t ( 'View hub ratings' ) . '</td>' . $rate_meta . '</tr>' ;
2015-08-23 22:38:18 +02:00
if ( $j [ 'sites' ]) {
foreach ( $j [ 'sites' ] as $jj ) {
$host = strtolower ( substr ( $jj [ 'url' ], strpos ( $jj [ 'url' ], '://' ) + 3 ));
$rate_links = (( local_channel ()) ? '<td><a href="rate?f=&target=' . $host . '" class="btn-btn-default"><i class="icon-check"></i> ' . t ( 'Rate' ) . '</a></td>' : '' );
2015-10-24 13:04:14 +02:00
$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><td>' . $jj [ 'project' ] . '</td><td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="icon-eye-open"></i> ' . t ( 'View ratings' ) . '</a></td>' . $rate_links . '</tr>' ;
2015-08-23 22:38:18 +02:00
}
}
$o .= '</table>' ;
2015-11-15 19:51:39 +01:00
$o .= '</div>' ;
2015-08-23 22:38:18 +02:00
}
}
return $o ;
}