1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-18 13:14:55 +01:00
2006-12-02 04:36:16 +00:00

34 lines
1.2 KiB
Scala

global $sql, $link_class, $page,$tp;
$sql -> db_Select('links', '*', "link_category = 1 and link_parent =0 and link_class IN (".USERCLASS_LIST.") ORDER BY link_order ASC");
$ulmenu = PRELINK."<ul>";
$r="1";
while($row = $sql -> db_Fetch()){
if($r <= "8"){
extract($row);
$link_url = $tp->replaceConstants($link_url,TRUE);
if(!preg_match("#(http:|mailto:|ftp:|https:)#",$link_url)){
$link_url = e_HTTP.$link_url;
}
if(strpos($link_url, e_PAGE) !== FALSE){ $ulclass = '_onpage'; } else { $ulclass = ''; }
switch ($link_open) {
case 1:
$link_append = " onclick=\"window.open('$link_url'); return false;\"";
break;
case 2:
$link_append = " target=\"_parent\"";
break;
case 3:
$link_append = " target=\"_top\"";
break;
default:
unset($link_append);
}
$lname = (defined(trim($link_name))) ? constant(trim($link_name)) : $link_name;
$ulmenu .= "<li class='nav".$r."$ulclass'><a class='$ulclass' ".($link_description ? " title = '$link_description' " : "title = 'add a text description to this link' ")." href='".$link_url."' accesskey='".$r."' ".$link_append.">".LINKSTART."$lname".LINKEND."</a></li>";
}
$r++;
}
$ulmenu .= "</ul>\n".POSTLINK;
return $ulmenu;