public function InsertAndSendMail() { $quotedAuthor = trim($_POST['mail']); $quotedTitle = trim($_POST['title']); $isbn = Isbn::stringFromPost(); $year = (int) trim($_POST['year']); $price = (double) str_replace(',', '.', $_POST['price']); $quotedDescription = $_POST['desc']; $key = KeyGenerator::genKey(); $query = 'insert into books' . ' (author, title, year, price, isbn, description, mail, auth_key' . ', created,expires)' . ' values (' . '"' . $quotedAuthor . '"' . ', "' . $quotedTitle . '"' . ', "' . $year . '"' . ', "' . $price . '"' . ', "' . $isbn . '"' . ', "' . $quotedDescription . '"' . ', "' . $this->getMail() . '"' . ', "' . $key . '"' . ', now()' . ', date_add(now(), interval 45 day)' . ')'; mysql_query($query); $book_id = mysql_insert_id(); $this->selectableCategories->setBookId($book_id); $this->selectableCategories->update(); $subject = ''; $message = 'Mit deiner E-Mailadresse wurde das unten stehende Buch angeboten. Hebe diese E-Mail auf, um das Angebot später ändern und löschen zu können.'; Mailer::send($book_id, $subject, $message); $searches = new Searches(); if ($searches->areActivated()) { $author = stripslashes($quotedAuthor); $title = stripslashes($quotedTitle); $description = stripslashes($quotedDescription); $searches->bookAdded($book_id, $author, $title, $description); } header('Location: book.php?id=' . $book_id . '&key=' . $key . '&new=1'); exit; }
function freshports_SideBar() { global $User; $ColumnWidth = 160; $OriginLocal = rawurlencode($_SERVER["REQUEST_URI"]); $HTML = ' <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Login</b></big></FONT></td> </tr> <tr> <td NOWRAP>'; if (isset($_COOKIE["visitor"])) { $visitor = $_COOKIE["visitor"]; } if (isset($visitor)) { global $User; $HTML .= '<FONT SIZE="-1">Logged in as ' . $User->name . "</FONT><br>"; if ($User->emailbouncecount > 0) { $HTML .= '<img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0"height="32" width="32"><br>'; $HTML .= '<FONT SIZE="-1">your email is <a href="/bouncing.php?origin=' . $OriginLocal . '">bouncing</a></FONT><br>'; $HTML .= '<img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0" height="32" width="32"><img src="/images/warning.gif" border="0" height="32" width="32"><br>'; } $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/customize.php', "?origin={$OriginLocal}", "Customize", "Customize your settings") . '</FONT><br>'; if (preg_match("/.*@FreeBSD.org/i", $User->email)) { $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/committer-opt-in.php', '', "Committer Opt-in", "Committers can receive reports of Sanity Test Failures") . '</FONT><br>'; } # for a logout, where we go depends on where we are now # switch ($_SERVER["PHP_SELF"]) { case "customize.php": case "watch-categories.php": case "watch.php": $args = "?origin={$OriginLocal}"; break; default: $args = ''; } $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/logout.php', $args, "Logout", "Logout of the website") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/my-flagged-commits.php', $args, "My Flagged Commits", "List of commits you have flagged") . '</FONT><br>'; } else { $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/login.php', "?origin={$OriginLocal}", "User Login", "Login to the website") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/new-user.php', "?origin={$OriginLocal}", "Create account", "Create an account") . '</FONT><br>'; } $HTML .= ' </td> </tr> </table> ' . '<div align="center">'; $HTML .= ' <p><small>' . SPONSORS . '</small></p> </div>'; $HTML .= ' <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>This site</b></big></FONT></td> </tr> <tr> <td valign="top"> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/about.php", "What is FreshPorts?", "A bit of background on FreshPorts") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/authors.php", "About the authors", "Who wrote this stuff?") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/faq.php", "FAQ", "Frequently Asked Questions") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/how-big-is-it.php", "How big is it?", "How many pages are in this website?") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/release-2004-10.php", "The latest upgrade!", "Details on the latest website upgrade") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/privacy.php", "Privacy", "Our privacy statement") . '</FONT><br> <FONT SIZE="-1"><a href="/phorum/" title="Discussion Forums">Forums</a></FONT><br> <FONT SIZE="-1"><a href="http://news.freshports.org/" title="All the latest FresHPorts news">Blog</a></FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/contact.php", "Contact", "Contact details") . '</FONT><br> </td> </tr> </table> <br> <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Search</b></big></FONT></td> </tr> <tr> <td>'; global $dbh; require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php'; $Searches = new Searches($dbh); $HTML .= $Searches->GetFormSimple(' '); $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/search.php', '', "more...", "Advanced Searching options") . '</FONT><br> </td> </tr> </table> '; if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/vuln-latest.html")) { $HTML .= '<br> <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Latest Vulnerabilities</b></big></FONT></td> </tr> <tr><td> ' . file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/vuln-latest.html") . "\n" . ' </td></tr> <tr><td align="center"><p><sup>*</sup> - modified, not new</p><p><a href="/vuxml.php?all">All vulnerabilities</a></p> </table> <br>'; } else { $HTML .= "<br>\n"; } $HTML .= ' <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Ports</b></big></FONT></td> </tr> <tr> <td valign="top"> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/", "Home", "FreshPorts Home page") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/categories.php", "Categories", "List of all Port categories") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/ports-deleted.php", "Deleted ports", "All deleted ports") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/sanity_test_failures.php", "Sanity Test Failures", "Things that didn't go quite right...") . '</FONT><br> <FONT SIZE="-1">' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/backend/newsfeeds.php", "Newsfeeds", "Newsfeeds for just about everything") . '</FONT><br> </td> </tr> </table>'; if (isset($visitor)) { $HTML .= '<br> <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Watch Lists</b></big></FONT></td> </tr> <tr> <td valign="top">'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/pkg_upload.php', '', "Upload", "Upoad a file containing a list of ports you want to add to your watch list") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch-categories.php', '', "Categories", "Search through categories for ports to add to your watch list") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch-list-maintenance.php', '', "Maintain", "Maintain your watch list[s]") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/watch.php', '', "Ports", "Your list of watched ports") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/backend/watch-list.php', '', "Personal Newsfeeds", "A list of news feeds for your watched lists") . '</FONT><br>'; $HTML .= '<FONT SIZE="-1">' . freshports_SideBarHTMLParm($_SERVER["PHP_SELF"], '/report-subscriptions.php', '', "Report Subscriptions", "Maintain your list of subscriptions") . '</FONT><br>'; $HTML .= ' </td> </tr> </table>'; } global $ShowAds; if ($ShowAds) { $HTML .= '<br><table border="0" cellpadding="5"> <tr><td align="center"> '; $HTML .= Ad_160x600(); $HTML .= '</td></tr> </table> '; } $HTML .= '<br> <table width="' . $ColumnWidth . '" border="1" cellspacing="0" cellpadding="5"> <tr> <td COLSPAN="2" bgcolor="' . BACKGROUND_COLOUR . '" height="30"><FONT COLOR="#FFFFFF"><big><b>Statistics</b></big></FONT></td> </tr> <tr> <td valign="top"> ' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/graphs.php", "Graphs", "Everyone loves statistics!") . '<br> ' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/graphs2.php", "NEW Graphs (Javascript)", "Everyone loves statistics!") . '<br> ' . freshports_SideBarHTML($_SERVER["PHP_SELF"], "/stats/", "Traffic", "Traffic to this website"); if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/stats.html")) { $HTML .= '<br> ' . file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/../dynamic/stats.html") . "\n"; } $HTML .= ' </td> </tr> </table> '; return $HTML; }
/** Display the index page. */ public function summariesAction() { $params = $this->getAllParams(); $search = new Pas_Solr_Handler(); $search->setCore('coinsummary'); $search->setFields('quantity,hoardID,broadperiod,ruler,mint,geography,denomination,hoard'); $context = $this->_helper->contextSwitch->getCurrentContext(); if ($context) { $params['format'] = $context; } $search->setParams($params); $search->execute(); $this->view->paginator = $search->createPagination(); $this->view->results = $search->processResults(); if (array_key_exists('submit', $params)) { $queries = new Searches(); $queries->insertResults(serialize($params)); } }
/** Display saved searches by logged in account */ public function savedAction() { $search = new Searches(); $this->view->searches = $search->getAllSavedSearches((int) $this->getIdentityForForms(), (int) $this->_getParam('page')); }
/** Email a search result */ public function emailAction() { $user = $this->getAccount(); $this->view->headTitle('Email this search to another person'); $searches = new Searches(); $lastsearch = $searches->fetchRow($searches->select()->where('userid = ?', $this->getIdentityForForms())->order('id DESC')); if (count($lastsearch)) { $querystring = unserialize($lastsearch->searchString); $params = array(); $query = ''; foreach ($querystring as $key => $value) { $query .= $key . '/' . $value . '/'; $params[$key] = $value; } $this->view->params = $params; $form = new EmailSearchForm(); $this->view->form = $form; if ($this->_request->isPost()) { $data = $this->_getAllParams(); if ($form->isValid($data)) { $sender = $user->fullname; $senderemail = $user->email; $recipient = $form->getValue('fullname'); $recipientemail = $form->getValue('email'); $message = $form->getValue('messageToUser'); $strippedmessage = strip_tags($message); $url = 'http://' . $_SERVER['SERVER_NAME'] . '/database/search/results/' . $query; $mail = new Zend_Mail(); $mail->addHeader('X-MailGenerator', 'The Portable Antiquities Scheme\'s awesome database'); $mail->setBodyHtml('<p>Dear ' . $recipient . '</p>' . $message . '<p>Located at this url: ' . $url . '</p><p>From ' . $sender . '</p>'); $mail->setFrom('*****@*****.**', 'The Portable Antiquities Scheme'); $mail->setBodyText('Dear ' . $recipient . ',' . $message . ' ' . $url . 'From,' . $sender); $mail->addTo($recipientemail, $recipient); $mail->addCC($senderemail, $sender); $mail->setSubject('I thought you might be interested in this search on the PAS Database.'); $mail->send(); $this->_flashMessenger->addMessage('Your email has been sent to ' . $recipient . '. Thank you for sending them some of our records.'); $this->_redirect('/database/search/results/' . $query); } else { $form->populate($data); } } } else { $this->_flashMessenger->addMessage('You haven\'t ever searched, so you have nothing to email!'); $this->_redirect('/database/search/'); } }
<?php /* * This file is part of uBook - a website to buy and sell books. * Copyright © 2009 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 'notification/Searches.php'; $searches = new Searches(); if (isset($_GET['activate']) && $_GET['activate']) { $searches->setUp(); } if (isset($_GET['deactivate']) && $_GET['deactivate']) { $searches->dropTable(); } header('Location: admin.php');
private function createSaveLink() { if (isset($_GET['searchSaved'])) { return; } $searches = new Searches(); if (!$searches->areActivated()) { return; } $this->tmpl->addSubtemplate('saveSearch'); }
# require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/common.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/freshports.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/databaselogin.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../include/getvalues.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php'; $Title = 'Search by package'; freshports_Start("{$Title}", "freshports - new ports, applications", "FreeBSD, index, applications, ports"); if (isset($_REQUEST['notfound'])) { $notfound = 1; } if (isset($_REQUEST['multiple'])) { $multiple = 1; } $package = pg_escape_string($_REQUEST['package']); $Searches = new Searches($dbh); ?> <?php echo freshports_MainTable(); ?> <tr><td valign="top" width="100%"> <?php echo freshports_MainContentTable(); ?> <TR> <?php echo freshports_PageBannerText($Title); ?>
/** Paginated list of searches made * @access public * @return void */ public function indexAction() { $search = new Searches(); $this->view->searches = $search->getAllSearchesAdmin($this->getParam('page')); }
if (isset($_REQUEST['package'])) { $package = pg_escape_string($_REQUEST['package']); if ($package != '') { require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/packages.php'; $Packages = new Packages($db); $CategoryPort = $Packages->GetCategoryPortFromPackageName($package); switch ($CategoryPort) { case "0": # no such port found header('Location: /package.php?package=' . $package . '¬found'); exit; case "-1": # multiple ports have that package name # search for them all and let the users decide which one they want require_once $_SERVER['DOCUMENT_ROOT'] . '/../classes/searches.php'; $Searches = new Searches($dbh); $Redirect = $Searches->GetLink($package, FRESHPORTS_SEARCH_METHOD_Exact, 1); header('Location: ' . $Redirect); exit; default: # one port found with that name, show that page. header('Location: /' . $CategoryPort . '/'); exit; } } } freshports_Start($FreshPortsSlogan, $FreshPortsName . ' - new ports, applications', 'FreeBSD, index, applications, ports'); $Debug = 1; if ($Debug) { echo "\$User->id='{$User->id}'"; }
/* * This file is part of uBook - a website to buy and sell books. * Copyright © 2009 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 'notification/Searches.php'; if (!isset($_GET['search'])) { header('Location: ./'); } if (!isset($_GET['mail'])) { header('Location: ./'); } if (!isset($_GET['auth_key'])) { header('Location: ./'); } $searches = new Searches(); $searches->deleteSearch($_GET['search'], $_GET['mail'], $_GET['auth_key']); header('Location: ./?search=' . urlencode($_GET['search']) . '&searchDeleted=1');
/** Display saved searches by logged in account * @access public * @return void */ public function savedAction() { $this->view->searches = $this->_searches->getAllSavedSearches($this->getIdentityForForms(), $this->getParam('page'), null); }
if (!$result) { return 0; } $countArr = mysql_fetch_row($result); if (!$countArr) { return 0; } return $countArr[0]; } require_once 'books/LocalBookList.php'; $numberOfBooks = LocalBookList::numberOfAllBooks(); require_once 'tools/Categories.php'; $categories = new Categories(); $numberOfCategories = sizeof($categories->getArray()); require_once 'notification/Searches.php'; $searches = new Searches(); $numberOfSearches = number_of_searches(); require_once 'net/LocalServer.php'; $serverName = new LocalServer(); $numberOfServers = number_of_servers(); /* * Optionen anbieten: * MySQL-Setup, Bücher betrachten, Kategorien verändern, Serveraustausch aktivieren, Mail verschicken. */ require 'header.php'; ?> <h2>uBook läuft</h2> <table align="center"> <tr><td>Buchangebote</td><td><?php echo $numberOfBooks; ?>
* (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 'books/SearchKey.php'; require_once 'notification/Searches.php'; require_once 'tools/Mailer.php'; $searchKey = new SearchKey(); if (!$searchKey->isGiven()) { header('Location: ./'); } $mail = Mailer::mailFromUser('mail'); if ($mail == null) { $mail = Mailer::mailFromUser('name'); } if ($mail) { $searches = new Searches(); $searches->addSearch($searchKey->asText(), $mail); header('Location: ./?search=' . urlencode($searchKey->asText()) . '&searchSaved=1'); } $tmpl = Template::fromFile("view/save_search.html"); $tmpl->assign('searchKey', $searchKey->asHtml()); $tmpl->assign('urlSearchKey', urlencode($searchKey->asHtml())); $output = new Output(); $output->send($tmpl->result());