예제 #1
0
        $localServer->setAccepting((bool) $_GET['add_suggested']);
    }
    if (isset($_POST['new_url'])) {
        AdminServers::addUrl($_POST['new_url']);
    }
    if (isset($_POST['group'])) {
        ExternalServer::changeGroup($_POST['url'], $_POST['group']);
    }
    if (isset($_GET['blacklist'])) {
        ExternalServer::blacklist($_GET['blacklist']);
    }
    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');
 private function createServerQuery(ExternalServer $server)
 {
     $url = new HttpUrl($server->getUrl() . $this->scriptRequest);
     new ServerQuery($server, $url, $this);
 }
 private function loadFromDb($query)
 {
     $result = mysql_query($query);
     if (!$result) {
         return;
     }
     while ($serverArray = mysql_fetch_array($result)) {
         $this->servers[] = ExternalServer::newFromDbArray($serverArray);
     }
 }
예제 #4
0
 *
 * You should have received a copy of the GNU General Public License
 * 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());
}
예제 #5
0
 private function parseServerList(DomElement $elem)
 {
     foreach ($elem->getElementsByTagName('server') as $s) {
         $url = $s->getAttribute('url');
         $server = ExternalServer::newFromUrlString($url);
         if ($server == null) {
             return;
         }
         $this->servers[] = $server;
     }
 }