$error = 'not found'; } else { /* we have valid access to this book */ $selectableCategories = new SelectableCategories($id); if (isset($_POST['author'])) { /* update base book data */ $query = 'update books set author = "' . $_POST['author'] . '", title = "' . $_POST['title'] . '", year = "' . $_POST['year'] . '", isbn = "' . $_POST['isbn'] . '", price = "' . str_replace(',', '.', $_POST['price']) . '", description = "' . $_POST['desc'] . '" where id="' . $id . '" and auth_key="' . $key . '"'; mysql_query($query); /* update category relations */ $selectableCategories->update(); /* update expire date and look at the book */ require 'renew.php'; } $book = Book::fromMySql($result); require_once 'tools/Output.php'; require_once 'text/Template.php'; $tmpl = Template::fromFile('view/edit.html'); $book->assignHtmlToTemplate($tmpl); assignSelectableCategories($selectableCategories, $tmpl); $tmpl->assign('id', $_GET['id']); $tmpl->assign('key', $_GET['key']); $output = new Output(); $output->send($tmpl->result()); }
} if ($localServer->acceptSuggestedServers()) { $sub->addSubtemplate('acceptingSuggestedServers'); } else { $sub->addSubtemplate('notAcceptingSuggestedServers'); } $activeServers = ExternalServerPool::whiteServerPool(); $sub->assign('numOfActive', $activeServers->size()); foreach ($activeServers->toArray() as $server) { $a = $sub->addSubtemplate('activeListEntry'); $a->assign('url', $server->getUrl()); $a->assign('name', $server->getName()); $a->assign('group', $server->getDistanceGroup()); } $unknownServers = ExternalServerPool::unknownServerPool(); $sub->assign('numOfUnknown', $unknownServers->size()); foreach ($unknownServers->toArray() as $server) { $a = $sub->addSubtemplate('unknownListEntry'); $a->assign('url', $server->getUrl()); $a->assign('name', $server->getName()); } $blacklistServers = ExternalServerPool::blacklistServerPool(); $sub->assign('numOfBlacklisted', $blacklistServers->size()); foreach ($blacklistServers->toArray() as $server) { $a = $sub->addSubtemplate('blackListEntry'); $a->assign('url', $server->getUrl()); $a->assign('name', $server->getName()); } } $output->send($template->result());
<?php require 'lib/Output.php'; $Output = new Output(); /* Send a message to the screen. * Sample Output: [13/Jan/2011 16:48:38] Test Message */ $Output->send('Test Message'); /* Send a message to the screen and await input. * Sample Output: [13/Jan/2011 16:48:38] What is your name?: */ $Output->askForInput('What is your name?: ');
<?php /* * This file is part of uBook - a website to buy and sell books. * Copyright © 2010 Maikel Linke * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * 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 'tools/Output.php'; require_once 'text/Template.php'; $helpTpl = Template::fromFile('view/help.html'); $output = new Output(); $output->setExpires(43200); $output->unlinkMenuEntry('Tipps'); $output->send($helpTpl->result());
* This file is part of uBook - a website to buy and sell books. * Copyright © 2010 Maikel Linke * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * 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 'tools/Output.php'; require_once 'tools/Statistics.php'; require_once 'text/Template.php'; $stat = new Statistics(); $statTpl = Template::fromFile('view/statistics.html'); if (file_exists(Statistics::STATS_FILE)) { $statTpl->addSubtemplate('stats'); $stat->fillTemplate($statTpl); } else { $statTpl->addSubtemplate('noStats'); } $output = new Output(); $output->setExpires(43200); $output->send($statTpl->result());