71a72,103 > > > /** > * Generates a list of the latest $limit > * posts in phpwsbb. > * > * @author René C. Kiesler > */ > > > function genLatestThreadsSQL($limit) { > > $prefix=$GLOBALS['core']->tbl_prefix; > > $sql = 'SELECT DISTINCT t.id, p.editor, p.owner, '; > $sql.= 'p.label, count(q.tid)-1 pcount '; > $sql.= "FROM ${prefix}mod_phpwsbb_threads t, "; > $sql.= "${prefix}mod_phpwsbb_messages p, "; > $sql.= "${prefix}mod_phpwsbb_messages q "; > $sql.= 'WHERE p.id=t.lastpost_post_id AND '; > $sql.= 'q.tid=t.id AND t.hidden="0" '; > $sql.= 'GROUP BY q.tid '; > $sql.= 'ORDER BY t.lastpost DESC '; > $sql.= "LIMIT $limit"; > > > return($sql); > > } > > > 78,84d109 < // Set settings < $result = $GLOBALS['core']->sqlSelect('mod_phpwsbb_settings'); < $showlatestthreadsblock = $result[0]['showlatestthreadsblock']; < $latestthreadsblocktitle = $result[0]['latestthreadsblocktitle']; < $maxlatestthreads = $result[0]['maxlatestthreads']; < $allow_anon_view = $result[0]['allow_anon_view']; < $bboffline = $result[0]['bboffline']; 86,113c111,178 < if ($bboffline && !$_SESSION['OBJ_user']->isDeity()) { < return; < } else { < if(!$showlatestthreadsblock) < return; < < if(!$allow_anon_view && !$_SESSION['OBJ_user']->username) < return; < < $c=0; < $block = NULL; < $result = $GLOBALS['core']->sqlSelect('mod_phpwsbb_threads', 'hidden', 0, 'lastpost DESC', NULL, NULL, $maxlatestthreads); < if($result) { < $block .= ''; < $GLOBALS['CNT_phpwsbb_latestthreadsblock']['title'] = $latestthreadsblocktitle; < $GLOBALS['CNT_phpwsbb_latestthreadsblock']['content'] = $block; < } < } --- > // Get settings > > $settings = $GLOBALS['core']->sqlSelect('mod_phpwsbb_settings'); > $showblock = $settings[0]['showlatestthreadsblock']; > $blocktitle = $settings[0]['latestthreadsblocktitle']; > $limit = $settings[0]['maxlatestthreads']; > $allow_anon_view = $settings[0]['allow_anon_view']; > $bboffline = $settings[0]['bboffline']; > > > if ($bboffline && !$_SESSION['OBJ_user']->isDeity()) > return; > > if(!$showblock) > return; > > > if(!$allow_anon_view && !$_SESSION['OBJ_user']->username) > return; > > $block = NULL; > > // $sql = PHPWS_ genLatestThreadsSQL($limit); > $sql=PHPWSBB_Runtime::genLatestThreadsSQL($limit); > > $result = $GLOBALS['core']->getAllAssoc($sql); > $length=30; > > if($result) > foreach($result as $nr => $row) { > > $editor=$row['editor']; > $owner=$row['owner']; > $title=$row['label']; > $posts=$row['pcount']; > $id=$row['id']; > > if(strlen($title)>$length) > $lbl=substr($title, 0, $length).'...'; > else > $lbl=$title; > > $title="TITLE='$title'"; > > if(isset($editor)) > $poster=$editor; > else > if(isset($owner)) > $poster=$owner; > else > $poster=$_SESSION['translate']->it('Guest'); > > > $link=PHPWS_Text::moduleLink($lbl, 'phpwsbb', > array( 'PHPWSBB_MAN_OP'=>'view', > 'PHPWS_MAN_ITEMS'=>$id), > null, null, null, $title); > > $block .= "

$poster
". > "$link($posts)

"; > > } > > $GLOBALS['CNT_phpwsbb_latestthreadsblock']['title'] = > $blocktitle; > > $GLOBALS['CNT_phpwsbb_latestthreadsblock']['content'] = $block; > 117a183 > 166a233 >