--- inc/conn.inc 2001/03/03 12:56:37 1.5 +++ inc/conn.inc 2001/12/26 21:15:00 1.10 @@ -3,18 +3,37 @@ $db="corp"; $dbh = new DBI("dbi:pg:$db","dpavlin",""); - if (!$WAP && ( strstr($accept,"text/vnd.wap.wml") || strstr($accept,"hdml;version=3.0") ) ) { + if (!$WAP && ( strstr($accept,"text/vnd.wap.wml") || strstr($accept,"hdml;version=3.0") || $GLOBALS["HTTP_HOST"] == "wap.pliva.hr" ) ) { Header("Location: wap.php"); header("Content-type: text/vnd.wap.wml"); exit; } - $url=basename($PHP_SELF)."?$QUERY_STRING"; - $sth = $dbh->prepare("select item from menu where url = '$url'"); + $sql_section=""; + + $url=basename($PHP_SELF); + if ($QUERY_STRING) $url.="?$QUERY_STRING"; + + if ($section) $sql_section=" and section='$section'"; + + $sth = $dbh->prepare("select item from menu where url = '$url' $sql_section limit 1"); $sth->execute(); global $menu_item; if ($row=$sth->fetchrow_hash()) { $menu_item=$row[0]; } + // parse /preview URL + + global $is_preview,$visible_is_true; + + $preview_url="/preview"; + if (substr($GLOBALS[REQUEST_URI],0,strlen($preview_url)) == $preview_url) { + $is_preview=1; + $visible_is_true = "true"; // visible can be true or false + } else { + $visible_is_true = "visible is true"; // limit output just to visible + } + + ?>