if (isset($_GET['activate'])) {
        ExternalServer::activate($_GET['activate']);
    }
    if (isset($_GET['delete'])) {
        ExternalServer::delete($_GET['delete']);
    }
}
if (sizeof($_GET)) {
    AdminServers::reload();
}
if (sizeof($_POST)) {
    AdminServers::reload();
}
$output = new Output();
$template = Template::fromFile('view/admin_servers.html');
$template->assign('localServerName', $localServer->name());
if ($localServer->isEmpty() || AdminServers::$editName) {
    $template->addSubtemplate('defineName');
} else {
    $sub = $template->addSubtemplate('listServers');
    if ($localServer->rememberNewServers()) {
        $sub->addSubtemplate('rememberingServers');
    } else {
        $sub->addSubtemplate('notRememberingServers');
    }
    if ($localServer->acceptSuggestedServers()) {
        $sub->addSubtemplate('acceptingSuggestedServers');
    } else {
        $sub->addSubtemplate('notAcceptingSuggestedServers');
    }
    $activeServers = ExternalServerPool::whiteServerPool();
Beispiel #2
0
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'books/SearchKey.php';
require_once 'net/Message.php';
require_once 'net/LocalServer.php';
require_once 'books/LocalSearchExportBookList.php';
$searchKey = new SearchKey();
if (!$searchKey->isGiven()) {
    exit;
}
$localServer = new LocalServer();
if (isset($_GET['from']) && $localServer->rememberNewServers()) {
    require_once 'net/ExternalServer.php';
    $requestingServer = ExternalServer::newFromUrlString($_GET['from']);
    if ($requestingServer) {
        require_once 'mysql_conn.php';
        $query = 'insert into servers (url, next_try) values (' . '"' . $requestingServer->getUrl() . '", ' . '"9999-12-31");';
        mysql_query($query);
    }
}
$bookList = new LocalSearchExportBookList($searchKey);
$message = new Message($localServer->name());
if ($bookList->size() > 0) {
    $message->setBooks($bookList->getList());
} else {
    require_once 'net/ExternalServerPool.php';
    $serverPool = ExternalServerPool::activeServerPool();
    $message->setServers($serverPool->toArray());
}
header('Content-Type: text/xml; charset=utf-8');
echo $message->toXmlString();