while (sqlite_valid($setid)) { $rowid = sqlite_fetch_single($setid); } } else { $rowid = $estimate; } file_put_contents($last_id, $rowid); sqlite_close($db); } } /* ============================ PREVIEW ONLY ========================= */ if (isset($_POST['preview'])) { print "<br />\n<p>\nThis is what your entry will look like, roughly:\n</p>\n"; print "<table border='0' cellpadding='0' cellspacing='0' width='100%' align = 'center'>\n"; $temp = array('display' => $display, 'comment' => htmlentities($content), 'date' => time()); makeEntry($temp, false); print "</table>\n"; print "<br />\n"; print "<a href = '#notes'>Edit the form</a>\n"; } /* ========================= ADDING TO DATABASE ====================== */ if (isset($_POST['add'])) { /* If we have a blacklist running today, check whether the user's IP is in it */ if (file_exists($blockfile)) { $blocked = file_get_contents($blockfile); $blacklisted = strstr($blocked, $ip); if (strlen($blacklisted) > 0) { $btime = substr($blacklisted, strlen($ip) + 1, 11); if ($btime > strtotime("1 hour ago")) { /* Pretty darn sure this is a repeat attack. Fail silently */ $blocked = str_replace($ip, "{$ip}\n" . time() . " BANNED (GTK_666)", $blocked);
foreach ($xml->ListIdentifiers->header as $key => $value) { $pid = (string) $value->identifier; print "Processing PID {$pid}\n"; lookForThumbnail($pid); if (lookForPayload($pid)) { $title_url = $oai_base_url . "?verb=GetRecord&metadataPrefix=oai_dc&identifier=" . $pid; $title_xml = simplexml_load_file($title_url); $title = (string) $title_xml->GetRecord->record->metadata->children('oai_dc', true)->children('dc', true)->title; $author = (string) $title_xml->GetRecord->record->metadata->children('oai_dc', true)->children('dc', true)->creator; if (strlen($title) > 50) { $title = substr($title, 0, 50) . "..."; } if (strlen($author) > 35) { $author = substr($author, 0, 35) . "..."; } makeEntry($pid, $title, $author); } } } if ($xml->ListIdentifiers->resumptionToken) { $resumption_token = (string) $xml->ListIdentifiers->resumptionToken; } else { $resumption_token = FALSE; } } /** * Finish up the index.html. */ $fp = fopen($piratebox_directory . "/index.html", "a"); fwrite($fp, "</body>\n"); fclose($fp);
function makeList($structuredData, $thisCatalogue) { $folderName = fileNameTrans($thisCatalogue->heading); $count = 1; $content = ''; foreach ($structuredData as $section) { $info = ''; $anchor = ''; if ($section->authority['system'] == 'gnd') { $info = makeCollapseBeacon($section->authority['id'], $folderName, $thisCatalogue->key); $anchor = 'person' . $section->authority['id']; } $content .= makeHeadline($section->level, $section->label, $info, $anchor); foreach ($section->content as $item) { if (get_class($item) == 'item') { $content .= ' <div class="entry">' . makeEntry($item, $thisCatalogue, $count) . ' </div>'; } elseif (get_class($item) == 'volume') { $content .= ' <div class="entry">Sammelband <ul>'; foreach ($item->content as $itemInVol) { $content .= ' <li>' . makeEntry($itemInVol, $thisCatalogue, $count) . ' </li>'; $count++; } $content .= ' </ul> </div>'; } $count++; } } return $content; }
function manualUserNotes($title, $id) { // Don't want .html at the end of the ids if (substr($id, -5) == '.html') { $id = substr($id, 0, -5); } // Get user notes $notes = manualGetUserNotes($id); // If we have no notes, do not produce useless HTML if (count($notes) == 0) { return FALSE; } // start HTML output // RAQ : Wednesday, 16 March 2005 01:54 pm : Allow all note pages to have a global JavaScript file and use new notesLoading() function for body's onLoad. $notehtml = <<<END_OF_MULTI <html> <head> <title>N: {$title}</title> <link rel="stylesheet" href="_style.css"> <script language="JavaScript1.2" src="_notes_script.js"></script> </head> <body onLoad="if(parent.nbuff) {parent.displayNotes();} else {loadWithNotes();}"> <h3>User contributed notes:</h3> END_OF_MULTI; // Go through manual notes, and make entries foreach ($notes as $note) { $notehtml .= makeEntry($note['xwhen'], $note['user'], $note['note'], $note['id']); } // Be good guys, and end HTML code here $notehtml .= "\n</body></html>"; // Return with manual notes for this page return $notehtml; }
} } $jumpbar = "<table border='0' cellpadding='4' cellspacing='0' width='100%'>\n" . "<tr bgcolor='#d0d0d0' valign='top'>\n" . "<td align='right' colspan='2'><small>Jump to: " . implode(" <span style='color:#999999'>|</span> ", $links) . "<br /></small></td>\n" . "</tr>\n" . "</table><br />\n\n"; echo $jumpbar; echo '<table border="0" cellpadding="4" cellspacing="0" width="100%">'; if (!isset($used[$let]) && $order != 'date') { echo '<tr><td colspan="2">No entries for <b>' . $let . '</b><br /></td></tr>'; echo stretchPage(15); echo " </div>"; } else { $db = sqlite_open($notesfile); if ($order == 'date') { $query = sqlite_query($db, "SELECT * FROM notes WHERE strftime('%Y', date, 'unixepoch') = '{$y}' ORDER BY date DESC"); } else { $query = sqlite_query($db, "SELECT * FROM notes WHERE lower(substr({$order}, 1, 1)) = '{$let}' ORDER BY lower({$order})"); } while ($row = sqlite_fetch_array($query, SQLITE_ASSOC)) { if ($order == 'page') { if ($row['page'] != $last) { makeTitle($row['page']); $last = $row['page']; } } else { makeTitle($row['page']); } makeEntry($row, $admin); } sqlite_close($db); } echo '</table>'; echo $jumpbar;
function editEntriesSelect($name, $entries, $options = array()) { if (!is_array($options)) { $options = array(); } if (!isset($options['pagin'])) { $options['pagin'] = true; } if (!isset($options['paginLimit']) && $options['pagin']) { $options['paginLimit'] = 10; } if (!isset($options['paginSeparator'])) { $options['paginSeparator'] = ' - '; } $result_html = '<div' . (isset($options['class']) ? ' class="' . $options['class'] . '"' : '') . '>' . "\n"; $result_html .= ' <label>' . (isset($options['label']) ? $options['label'] : ucfirst($name)) . '</label>' . "\n"; $result_html .= ' <div id="entries_list">' . "\n"; $pagin = ''; if ($options['pagin']) { if (isset($options['paginCur'])) { $cur_page = $options['paginCur']; } else { $cur_page = 1; } if (isset($options['paginNb'])) { $nb_page = $options['paginNb']; } elseif (isset($options['paginLimit'])) { $nb_page = ceil(count($entries) / $options['paginLimit']); } else { $nb_page = 1; } $pagin .= '<div class="pagin">' . "\n"; $pagin .= ' '; for ($i = 1; $i <= $nb_page; $i++) { if ($i != 1) { $pagin .= $options['paginSeparator']; } $pagin .= '<span class="pagin_page' . ($i == $cur_page ? ' cur' : '') . '" page="' . $i . '">' . $i . '</span>'; } $pagin .= '</div>' . "\n"; } $i = 0; if (isset($this->newsletter_box["NewsletterBox"]["data"][$name])) { foreach ($this->newsletter_box["NewsletterBox"]["data"][$name] as $entry) { $result_html .= makeEntry($entry, $name, $options, true, $i, $this); } } $result_html .= $pagin; $j = 0; $page = 1; foreach ($entries as $entry) { if ($options['pagin'] && $j % $options['paginLimit'] == 0) { $result_html .= ' <div id="page' . $page . '" class="page' . ($page == $cur_page ? ' cur_page' : '') . '">' . "\n"; } $result_html .= makeEntry($entry, $name, $options, false, $i, $this); if ($options['pagin'] && $j % $options['paginLimit'] == $options['paginLimit'] - 1) { $result_html .= ' </div>' . "\n"; $page++; } $j++; } if ($options['pagin'] && $j % $options['paginLimit'] != 0) { $result_html .= ' </div>' . "\n"; } $result_html .= $pagin; $result_html .= ' </div>' . "\n"; $result_html .= '</div>' . "\n"; return $result_html; }
} } $jumpbar = '<table border="0" cellpadding="4" cellspacing="0" width="100%">' . '<tr bgcolor="#d0d0d0" valign="top">' . '<td align="right" colspan="2"><small>Jump to: ' . join(' <font color="#999999">|</font> ', $links) . '<br /></small></td>' . "</tr>\n" . "</table><br />\n\n"; echo $jumpbar; if (!$let) { $let = $fl; } echo '<table border="0" cellpadding="4" cellspacing="0" width="100%">'; $query = "SELECT *, UNIX_TIMESTAMP(ts) AS xwhen, IF(votes=0, 10, rating/votes) AS rate FROM note " . "WHERE sect LIKE '{$let}%' ORDER BY sect, rate DESC, id"; $result = mysql_query($query) or die(mysql_error()); $numrows = mysql_num_rows($result); if ($numrows > 0) { $last = ''; while ($row = mysql_fetch_array($result)) { if ($row['sect'] != $last) { makeTitle($row['sect']); $last = $row['sect']; } makeEntry($row); } } else { if (!$fl) { echo '<tr><td colspan="2">No entries for any section</b>.<br /></td></tr>'; } else { echo '<tr><td colspan="2">No entries for <b>' . $let . '</b>.<br /></td></tr>'; } } echo '</table>'; if ($numrows > 10) { echo $jumpbar; }