db page */ // Require login. //require('inc/auth.inc.php'); // The database needs to be loaded. require('inc/common.inc.php'); ?> AltSci Concepts Tag List Tag Cloud

AltSci Network

Tag Cloud, Article List, articles by date

RSS Feed RSS feed

« First
\n"; print "$page_str"; } else { print "

« Home "; if (!empty($showTag)) { print "« All"; } print "

\n"; } print "

"; // Get a list of popular tags: $limit_top = 'limit 50'; $limit_tags = 50; //$tag_list = query("SELECT t.tag, count(p2t.id) as pages from tag t left outer join page2tag p2t on (t.id = p2t.tag_id or p2t.id is null) group by t.id order by pages desc $limit_top;"); if(!file_exists('/tmp/awesomecache1.txt')) { $sql = $db3->prepare("SELECT t.tag, count(p2t.id) as pages from tag t left outer join page2tag p2t on (t.id = p2t.tag_id or p2t.id is null) group by t.id order by pages desc limit %d;", $limit_tags); $tags = $db3->get_results($sql); #$stmt->bind_result($tag, $pages); $top_tags = array(); $top_tags_str = ''; foreach ($tags as $tag) { //while ($tag = mysql_fetch_assoc($tag_list)) { $top_tags[] = $tag->tag; #$top_tags_str .= "$tag[tag] "; $top_tags_str .= "tag\" class=\"t$tag->pages\" title=\"$tag->pages\">$tag->tag "; } file_put_contents('/tmp/awesomecache1.txt', $top_tags_str); } else { $top_tags_str = file_get_contents('/tmp/awesomecache1.txt'); } if (!empty($showTag)) { //$tag_id = query('SELECT t.id from tag t where t.tag="' . sql_validate($showTag) . '" limit 1'); $limitx = 1; $sql = $db3->prepare("SELECT t.id from tag t where t.tag = %s limit %d;", $showTag, $limitx); #print '[' . htmlentities($sql) . ',' . htmlentities(print_r($showTag, true)) . ',' . $disp_tag . ',' . $url_tag . ']'; $tag_id = $db3->get_var($sql); if (empty($tag_id)) { die("Fail."); } if ($showSite == '') { $sql = $db3->prepare("SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t, page2tag p2t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id AND p2t.page_id = p.id AND p2t.tag_id = %d AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT %d, %d;", $tag_id, $limit_start, $perpage); } else { $sql = $db3->prepare("SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t, page2tag p2t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id AND p2t.page_id = p.id AND s.site = %d AND p2t.tag_id = %d AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT %d, %d;", $site, $tag_id, $limit, $perpage); } /*$sql = "SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t, page2tag p2t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id AND p2t.page_id = p.id $siteQuery AND p2t.tag_id = '$tag_id' AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT $limit;";*/ } else { if ($showSite == '') { $sql = $db3->prepare("SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT %d, %d;", $limit_start, $perpage); } else { $sql = $db3->prepare("SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id AND s.site = %d AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT %d, %d;", $site, $limit_start, $perpage); } /*$sql = "SELECT p.pagenum, s.shortname, p.id as pid, p.rant, s.name as section, p.title, m.name as author, p.PDate, t.name as site_name, t.url as site_url, SUBSTRING(p.rant, 1, 256) as content FROM page p, scene s, account m, site t WHERE p.member = m.id AND p.scene=s.id AND s.site = t.id $siteQuery AND p.OmitEnd = 'N' GROUP BY p.id ORDER BY p.PDate DESC LIMIT $limit;";*/ } #$stmt->bind_result($pagenum, $shortname, $pid, $rant, $section, $title, $author, $date, $site_name, $site_url, $content); $pages = $db3->get_results($sql); print "
$top_tags_str

\n"; $delurl = ''; if (!empty($showTag)) { $delurl = '/' . $disp_tag; print '
Delicious ' . $disp_tag . ' on Delicious
' . "\n"; } print '
Delicious ' . $disp_tag . ' Delicious Bookmarks from the author
' . "\n"; print '
'; $shown = 0; //$articles = query($sql); //while ($article = mysql_fetch_assoc($articles)) { foreach ($pages as $page_row) { //$date = $article['PDate']; #date('Y-m-d', $article['PDate']); //$title = $article['title']; if ($page_row->title == '') { $page_row->title = "Untitled"; } $sql = $db3->prepare("SELECT t.tag from page2tag p2t join tag t on t.id = p2t.tag_id where p2t.page_id = %d group by t.id", $pid); //$tag_list = query("SELECT t.tag from page2tag p2t join tag t on t.id = p2t.tag_id where p2t.page_id = '" . sql_validate($article['pid']) . "' group by t.id;"); $tags = array(); $tag_list = $db3->get_results($sql); foreach ($tag_list as $tag) { $tags[] = $tag->tag; } $tags = '' . join(' ', $tags) . ''; print <<<_DOC
$page_row->title
In $page_row->site_name:$page_row->section, by $page_row->author on $page_row->PDate.
$tags
_DOC; $shown++; } print <<<_DOC
_DOC; print "
\n"; if ($shown == $perpage) { $end = $page + 5; } else { $end = $page; } #if ($end < 9) $end = 9; if (empty($page)) { print "1"; } else { print "1 \n"; } for ($i = 1; $i < $end; $i++) { $j = $i+1; if ($page == $i) { print "$j \n"; } else { print "$j \n"; } } ?>

© 2000-2008 AltSci Concepts