db_Select("pcontent", "content_id, content_heading", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){ while($rowm = $sqlm -> db_Fetch()){ //global var for this main parent $mainparent = $rowm['content_id']; $maincaption = $rowm['content_heading']; $text = ''; //prepare query paramaters $array = $aa -> getCategoryTree("", $mainparent, TRUE); $validparent = implode(",", array_keys($array)); $qry = " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' "; $datequery = " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") "; $content_pref = $aa -> getContentPref($mainparent); $content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]); $l = strlen($userid)+1; $userquery = " AND (p.content_author = '".$userid."' || LEFT(p.content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(p.content_author, '^', 1) = '".$userid."' ) "; $qry = " SELECT p.content_id, p.content_heading, p.content_subheading, p.content_icon, p.content_datestamp FROM #pcontent AS p WHERE LEFT(p.content_parent,1) != '0' AND ".$qry." ".$datequery." AND p.content_class REGEXP '".e_CLASS_REGEXP."' ".$userquery." ORDER BY p.content_heading "; $qry1 = $qry." LIMIT 0,3"; $found=false; $sqlc = new db; $total = $sqlc -> db_Select_gen($qry); if($sqlc -> db_Select_gen($qry1)){ while($rowc = $sqlc -> db_Fetch()){ $icon=''; if($rowc['content_icon'] && is_readable($content_icon_path.$rowc['content_icon'])){ $icon = ""; }else{ $icon = ""; } $date = strftime("%d %b %Y", $rowc['content_datestamp']); $subheading = ($row['content_subheading'] ? $row['content_subheading']."
" : ''); $text .= "
".$icon."
".$tp->toHTML($rowc['content_heading'], TRUE, "")."
".$subheading." ".$date."
"; $id = $rowc['content_id']; $found=true; } $lan0 = str_replace('{caption}',$maincaption, CONTENT_USERPROFILE_LAN_1); $text .= "
".$lan0."
"; } if($found){ $caption[] = str_replace(array('{caption}','{total}'),array($maincaption, $total), CONTENT_USERPROFILE_LAN_2); $data[] = $text; } } return array('caption'=>$caption, 'text'=>$data); } } } ?>