2 // plugin needs to work on Nucleus versions <=2.0 as well
3 if (!function_exists('sql_table')){
4 function sql_table($name) {
5 return 'nucleus_' . $name;
9 class NP_OtherblogEX extends NucleusPlugin {
10 function getEventList() { return array(); }
11 function getName() { return 'OtherblogEX'; }
12 function getAuthor() { return 'nakahara21'; }
13 function getURL() { return 'http://xx.nakahara21.net/'; }
14 function getVersion() { return '0.3'; }
15 function getDescription() {
19 function supportsFeature($what) {
21 case 'SqlTablePrefix':
27 function doSkinVar($skinType, $blogname, $template, $amount = 10, $catname = '', $sort) {
29 list($limit, $offset) = sscanf($amount, '%d(%d)');
35 $this->readLogAmountex($blogname,$template,$catname,$limit,'','',1,1,$offset, $startpos, $sort);
38 function readLogAmountex($blogname, $template, $catname, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0, $sort) {
41 $b =& $manager->getBlog(getBlogIDFromName($blogname));
43 $b->setSelectedCategoryByName($catname);
45 $b->setSelectedCategory($catid);
47 $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author, m.mrealname as authorname, UNIX_TIMESTAMP(i.itime) as timestamp, i.imore as more, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed'
48 . ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
49 . ' WHERE i.iblog='.$b->getID()
50 . ' and i.iauthor=m.mnumber'
51 . ' and i.icat=c.catid'
52 . ' and i.idraft=0' // exclude drafts
53 // don't show future items
54 . ' and i.itime<=' . mysqldate($b->getCorrectTime());
56 if ($b->getSelectedCategory())
57 $query .= ' and i.icat=' . $b->getSelectedCategory() . ' ';
60 . ' ORDER BY i.itime '.$sort;
62 if ($amountEntries > 0) {
63 // $offset zou moeten worden:
64 // (($startpos / $amountentries) + 1) * $offset ... later testen ...
65 $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);
68 return $b->showUsingQuery($template, $query, $highlight, $comments, $dateheads);