function rowsToHtmlTable($rows, $header = true) { //empty result if (!$rows || !is_array($rows) || !count($rows)) { return "<p>No Results</p>"; } $result = "<table>\n"; //header row if ($header) { $result .= "<tr>"; $headerRow = reset($rows); foreach ($headerRow as $key => $value) { $result .= "<th>" . makeTitle($key) . "</th>"; } $result .= "</tr>\n"; } // output data of each row foreach ($rows as $row) { $result .= "<tr>"; foreach ($row as $key => $value) { $result .= "<td>{$value}</td>"; } $result .= "</tr>\n"; } $result .= "</table>\n"; return $result; }
function makeHead($page) { echo ' <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> '; makeTitle($page); makeGeneralCss($page); makeCss($page); echo ' <script src="jquery-1.11.3.min.js"></script> </head> '; }
function Header($title = "", $active = 0, $cidfid = null, $onLoadAction = "", $options = HDR_NONE, $links = NULL) { _pf('Header() ctor'); $this->docTitle = $title; $this->active = $active; $this->cidfid = $cidfid; $this->onLoadAction = $onLoadAction; $this->options = $options; $this->rawTitle = $title; $this->extraHeaders = array(); $this->docTitle = makeTitle($title); if (getConfig("rss.output.titleunreadcnt") && is_array($cidfid) && ($uc = getUnreadCount($cidfid['cid'], $cidfid['fid']))) { $this->docTitle .= " ({$uc} " . __('unread') . ")"; } if ($active == 1 && MINUTE * getConfig('rss.config.refreshafter') >= 40 * MINUTE) { $this->redirectUrl = guessTransportProto() . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if (substr($this->redirectUrl, -1) != "/") { $this->redirectUrl .= "/"; } $this->redirectUrl .= "update.php"; $this->redirectTimeout = MINUTE * getConfig('rss.config.refreshafter'); } $this->links = array(); $this->links[] = array('start', 'Home', getPath()); $this->links[] = array('search', 'Search', getPath() . "search.php"); $this->links[] = array('tags', 'Tags', getPath() . (getConfig('rss.output.usemodrewrite') ? "tag/" : "tags.php?alltags")); if ($links != NULL) { //var_dump($links); foreach ($links as $rel => $link) { $this->links[] = array($rel, $link['title'], $link['href']); } } $this->javascriptFiles[] = getPath() . "ajax.php?js"; $this->javascriptFiles[] = getPath() . "extlib/md5.js"; if (getConfig('rss.output.channelcollapse')) { $this->javascriptFiles[] = getPath() . "extlib/fcollapse.js"; } $GLOBALS['rss']->sideMenu = new SideMenu(); $GLOBALS['rss']->sideMenu->addMenu(__('Feeds'), 'FeedList', "_side('FeedList')"); $GLOBALS['rss']->sideMenu->addMenu(__('Categories'), 'CatList', "_side('CatList')"); $GLOBALS['rss']->sideMenu->addMenu(__('Tags'), 'TagList', "_side('TagList')"); }
function makeEntry($thisBook, $thisCatalogue, $id) { $buffer = makeAuthors($thisBook->persons) . makeTitle($thisBook->titleBib, $thisBook->titleCat, $thisBook->work) . makeVolumes($thisBook->volumes) . makePublished(makePlaces($thisBook->places), $thisBook->publisher, $thisBook->year) . ' <a id="linkid' . $id . '" href="javascript:toggle(\'id' . $id . '\')">Mehr</a> <div id="id' . $id . '" style="display:none; padding-top:0px; padding-bottom:15px; padding-left:10px;">' . makeSourceLink($thisBook, $thisCatalogue->base) . makeOriginalLink($thisBook->originalItem) . makeWorkLink($thisBook->work) . makeDigiLink($thisBook->digitalCopy) . makeProof($thisBook) . makeComment($thisBook->comment) . '</div>'; return $buffer; }
function openevent($event_date, $time, $uid, $arr, $lines = 0, $length = 0, $link_class = '', $pre_text = '', $post_text = '') { global $cpath, $timeFormat, $dateFormat_week; # Strip all dollar signs from printable array entries; regex functions will mutilate them foreach ($arr as $key => $val) { $arr[$key] = str_replace('$', '$', $val); } $return = ''; $event_text = stripslashes(urldecode($arr['event_text'])); # build tooltip $title = makeTitle($arr, $time); # for iCal pseudo tag <http> comptability if (ereg('<([[:alpha:]]+://)([^<>[:space:]]+)>', $event_text, $matches)) { $full_event_text = $matches[1] . $matches[2]; $event_text = $matches[2]; } else { $full_event_text = $event_text; //$event_text = strip_tags($event_text, '<b><i><u><img>'); } if (!empty($link_class)) { $link_class = ' class="' . $link_class . '"'; } if (!empty($event_text)) { //$event_text=str_replace("\n","£",$event_text); $title = strip_tags(str_replace('<br />', "\n", $title)); if ($lines > 0) { $event_text = word_wrap($event_text, $length, $lines); } if (!ereg('([[:alpha:]]+://[^<>[:space:]]+)', $full_event_text, $res) || $arr['description']) { $escaped_date = addslashes($event_date); $escaped_time = addslashes($time); $escaped_uid = addslashes($uid); $event_data = addslashes(serialize($arr)); // fix for URL-length bug in IE: populate and submit a hidden form on click static $popup_data_index = 0; $return = "\n\t\t\t\t<script language='Javascript' type='text/javascript'><!--\n\t\t\t\tvar eventData = new EventData('{$escaped_date}', '{$escaped_time}', '{$escaped_uid}','{$cpath}','{$event_data}');\n\t\t\t\tdocument.popup_data[{$popup_data_index}] = eventData;\n\t\t\t\t// --></script>"; $return .= '<a' . $link_class . ' title="' . $title . '" href="#" onclick="openEventWindow(' . $popup_data_index . '); return false;">'; $popup_data_index++; } else { $return .= '<a' . $link_class . ' title="' . $title . '" href="' . $res[1] . '">'; } $return .= $pre_text . $event_text . $post_text . '</a>' . "\n"; //$return = str_replace("£","\n",$return); } return $return; }
function rss_main_title() { return makeTitle($GLOBALS['rss']->header->rawTitle); }
} } $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;
} } $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; }