(etc.) or LIKE) $which check value (SPECIAL when LIKE, adds %-% to value) $debug externally assigned when online only */ /* globals */ $moment=Date("Y-m-d H:i:s"); /* date & time at this moment */ $today=Date("Y-m-d"); /* date at this moment */ $dates=strtoupper($dates); /* date format selected */ $format=strtoupper($format); /* required KERNEL */ $format_tpl = strtolower($format); if ($number=="") $number=10; /* display maximum */ /*AMA start*/ // Disabled because of the user-database which gives this values /* if ($font_size) { $font="> if ($font_size>1) $reduced=""; else $reduced=""; } else { $font=""; $reduced=""; } */ /*AMA end*/ Function date_af($arg) /* prepare date for display */ { /* $arg YYYY-MM-DD HH:MM:SS (this format is assumed) */ /* 0123456789012345678 */ /* hours, mins, seconds are ignored, so can call with just YYYY-MM-DD */ global $dates; /* form parameter */ if (Ord($dates)==Ord("L")) $year=substr($arg,0,4); else $year=substr($arg,2,2); /* resulting in 00 for year 2000 (OK) */ $month=substr($arg,5,2); $day=substr($arg,8,2); switch ($dates) { case "LUSA": /* year 4 digits */ case "USA": $str=substr("JanFebMarAprMayJunJulAugSepOctNovDec",($month-1)*3,3)." ".$day.", ".$year; break; case "LUSN": /* year 4 digits */ case "USN": $str=$month."/".$day."/".$year; break; case "LISO": /* year 4 digits */ case "ISO": $str=$year."-".$month."-".$day; break; case "LEUR": /* year 4 digits */ case "EUR": default: $str=$day.".".$month.".".$year; break; } return($str); /* in format selected */ }; Function normalise_date_element($arg) { $str=$arg; switch(strlen($str)) { case 0: return("01"); case 1: return("0"."$str"); default: return(substr($str,0,2)); } }; Function check_date($arg,$fromto) { /* inspect and validate partial or alternatively formatted date string */ /* $fromto=0 (checking from) =1 (checking to) */ global $today; global $debug; if (strlen($arg)==10) if (substr($arg,4,1)=="-") if (substr($arg,7,1)=="-") return($arg); /* OK no need to do any more */ if ($fromto==0) $mult=-1; else $mult=1; $str=strtolower($arg); switch($str) { case "today": case "now": case "heute": $str=$today; break; case "week": case "woche": $str=Date("Y-m-d",mktime(0,0,0,date("m"),date("d")+(7*$mult),date("Y"))); break; case "weekend": case "we": $weekend=5-Date("w")+($fromto*2); /* offset Friday/Sunday this week (can be negative) */ $str=Date("Y-m-d",mktime(0,0,0,date("m"),date("d")+$weekend,date("Y"))); break; case "month": case "monat": $str=Date("Y-m-d",mktime(0,0,0,date("m")+(1*$mult),date("d"),date("Y"))); break; case "year": case "jahr": $str=Date("Y-m-d",mktime(0,0,0,date("m"),date("d"),date("Y")+(1*$mult))); break; default: /* alternative date formats to consider: YY-MM-DD (abbreviated - assume 19YY if YY>80) DD.MM.YY (or using :+/ or space separators) MMM DD,YY (month name) */ if (strpos($str,"-")) /* string contains at least one "-" ? */ { $first=trim(strtok($str,"-")); $second=trim(strtok("-")); $third=trim(strtok("-")); if (strlen($first)==4) /* YYYY */ $str=$first; else if (strlen($first)<=2) /* YY */ { if ($first > 90) $str="19".normalise_date_element($first); else $str="20".normalise_date_element($first); } else $str="????"; /* 0, 3 or >4 digits date? */ /* no checking of 2nd and 3rd as yet */ $str.="-".normalise_date_element($second)."-".normalise_date_element($third); if ($debug) echo "\n"; break; /* return $str */ } $pattern=".,:;+/()_#!^°§$%\\*'[] "; $first=strtok($str,$pattern); if ($first!=$str) { if ($debug) echo "\n"; $first=trim($first); $second=trim(strtok($pattern)); $third=trim(strtok($pattern)); if ($third=="") $third=trim(strtok($pattern)); /* eliminate ", " forms */ $mth=strpos(" jan feb mar apr may jun jul aug sep oct nov dec",substr($first,0,3)); if (!$mth) $mth=strpos(" jan feb mär apr mai jun jul aug sep okt nov dez",substr($first,0,3)); if ($mth) /* MNAME DD, YYYY */ { $first=$second; $second=intval($mth/4)+1; if ($debug) echo "\n"; } /* assume DD.MM.YY or DD.MM.YYYY */ if (strlen($third)==4) /* YYYY */ $str=$third; else if (strlen($third)<=2) /* YY */ { if ($third >= 90) $str="19".normalise_date_element($third); else $str="20".normalise_date_element($third); } else { $str="????"; /* 0, 3 or >4 digits date? */ } /* no checking of 1st and 2nd as yet */ $str.="-".normalise_date_element($second)."-".normalise_date_element($first); if ($debug) echo "\n"; break; /* return $str */ } $str=""; /* unrecognisable (fetch default) */ } /* switch */ return($str); /* always YYYY-MM-DD or nul */ }; /* check_date */ Function date_value($arg) { /* extract just the date as an integer (for testing =0) */ return((substr($arg,2,2)*10000)+(substr($arg,5,2)*100)+substr($arg,8,2)); }; Function date_part($arg) { /* extract just the date part of a date/time string */ return(substr($arg,0,10)); /* assuming format YYYY-MM-DD */ }; /* date_part */ Function time_value($arg) { /* extract just the time as an integer */ return((substr($arg,11,2)*100)+substr($arg,14,2)); /* return int */ }; /* time_value */ Function time_part($arg) { /* extract the time as a string (HH:MM) */ return(substr($arg,11,5)); }; /* time_part */ Function ispunctuation($ch) { /* test $ch value, returns 1 if punctuation, otherwise 0 */ if ($ch<=" ") return(1); /* space, tab, or any control char */ switch($ch) { case ",": case ";": case ".": case ":": case "!": case "(": case ")": case "[": case "]": case "|": case "": case "<": case ">": case "@": case "&": case "%": case "\\": case "´": case "`": case "#": case "'": case "+": case "*": case "\n": case "\r": case "\t": case "_": case "-": case "°": case "~": return(1); } /* some punctuation */ return(0); }; /* ispunctuation */ Function pprocess($arg) /* logically post process the artist strings */ { /* returns 0 if found OK, else non zero */ global $artist; /* search string */ global $debug; $str=strtolower($arg); $wh=strtolower($artist); $found=strstr($str,$wh); if ($found) { $pos=strpos($str,$wh); if ($pos) { $prev=substr($str,$pos-1,1); /* char preceeding target */ if (!ispunctuation($prev)) { if ($debug) echo "\n"; return(pprocess(substr($found,strlen($artist)))); /* recurse */ } } $next=substr($str,$pos+strlen($wh),1); /* char following target */ if (ispunctuation($next)) return(0); /* OK */ if ($debug) echo "\n"; return(pprocess(substr($found,strlen($artist)))); /* recurse */ } return(1); /* not in (rest of) string */ }; /* pprocess */ if ($format) /* Javascript will go back if not assigned (for the present the only possible value) */ { include("inc/partyserver_database.inc.php3"); /* sets $ONLINE */ $db_id=mysql_select_db($svDatabase); $svIndex="partybase"; if ($date_any==0) /* not requesting "all" (default if unspecified) */ { $from=check_date($from,0); $to=check_date($to,1); if (strlen($from)==0) $from="1998-01-01"; /* default start date if unspecified */ if (strlen($to)==0) $to="1999-12-31"; /* temporary fix: amend when data in 2000 there or if a suitable variable is available! */ $temp_from=$from." 00:00:00"; /* allow all started, or to start then (Start times unreliable) */ $temp_to=$to." 23:59:59"; /* ensure all data on that day is offered */ $q_dates="((PartyDate BETWEEN '$temp_from' AND '$temp_to') OR (EndDate BETWEEN '$temp_from' AND '$temp_to'))"; } else $q_dates="(PartyDate != '')"; /* must be something here (all other tests are AND prefixed)! */ $q_type=trim($type); if ($q_type!="") { $q_type=" AND (lcase(InOut) LIKE '".strtolower($q_type)."%')"; } $q_party=trim($party); if ($q_party!="") { $q_party=" AND (lcase(PartyName) LIKE '".strtolower($q_party)."%')"; } $q_country=trim($country); if ($q_country!="") { if ($q_country=="UK" || $q_country=="GB") $q_country=" AND ((LocCountry = 'England') OR (LocCountry = 'Wales') OR (LocCountry = 'Scotland') OR (LocCountry = 'N.Ireland') OR (LocCountry = 'UK') OR (LocCountry = 'GB'))"; else if ($q_country=="Holland" || $q_country=="Netherlands") $q_country=" AND ((LocCountry = 'Holland') OR (LocCountry = 'Netherlands'))"; else $q_country=" AND (LocCountry = '".$q_country."')"; } $q_town=trim($town); if ($q_town!="") { $q_town=" AND (lcase(LocTown) LIKE '".strtolower($q_town)."%')"; } $q_artist=trim($artist); if ($q_artist!="") { $temp="%".strtolower($q_artist)."%"; $q_artist=" AND ((lcase(DJs) LIKE '$temp')"; $q_artist.=" OR (lcase(ChillOut) LIKE '$temp')"; $q_artist.=" OR (lcase(Deko) LIKE '$temp')"; $q_artist.=" OR (lcase(Live) LIKE '$temp'))"; } $q_club=trim($club); if ($q_club!="") { $q_club=" AND (lcase(Location) LIKE '".strtolower($q_club)."%')"; } $q_org=trim($org); if ($q_org!="") { $q_org=" AND (lcase(Organizer) = '".strtolower($q_org)."')"; } $q_submitter=trim($submitter); if ($q_submitter!="") { $q_submitter=" AND (lcase(Submitter) = '".strtolower($q_submitter)."')"; } if (strlen($Order)==0) $Order="PartyDate"; $q_which=trim($which); /* get rid of whitespace */ if ($q_which!="") /* if $which, $test and $field must be defined */ { if ($test=="LIKE") $q_which="%".$q_which."%"; $q_which=" AND (lcase(".$field.") ".$test." '".strtolower($q_which)."')"; } $fields="ID,PartyDate,Partyname,InOut,DJs,Live,ChillOut,Deko,LocCountry,LocTown,Location,Hotline,Organizer,Email,Url,Memo,Flyersmall,Flyerfull,Passw,EndDate,AddDate"; /* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 */ $q_sql="SELECT $fields FROM ".$svIndex." WHERE flag_display='1' and ".$q_dates.$q_type.$q_party.$q_country.$q_town.$q_club.$q_artist.$q_org.$q_which." ORDER BY ".$Order; if ($descending==1) $q_sql.=" DESC"; else $q_sql.=" ASC"; /* default */ if ($debug) echo "\n"; $result=mysql_query($q_sql,$connectID); if ($result==0) { if ($debug) echo "Error ".mysql_errno()." : ".mysql_error()."
\n"; echo "Database failure: this may be just a temporary glitch, please try again.
\n"; } if ($result!=0) { /*AF*/ /* AMA : This have to be in template, not in this file! echo "For a further search
\n"; echo "
\n"; echo "Party name contains: (blank for all)
\n"; if ($date_any) { $tmpd_a="checked"; $tmpd_b=""; } else { $tmpd_a=""; $tmpd_b="checked"; } echo "All parties: or by date from "; echo " to \n"; echo "
\n"; // need an array based country selector echo "Country: \n"; echo " Town: (blank for all)
\n"; $tmpt_a=""; $tmpt_b=""; $tmpt_c=""; $tmpt_d=""; switch($type) { case "Open Air": $tmpt_b="selected"; break; case "Indoor": $tmpt_c="selected"; break; default: $tmpt_a="selected"; break; } echo " Type of party: \n"; echo " Club location: \n"; echo " Organizer: (blank for all)
\n"; echo "Featuring a particular DJ or artist: (blank for all)
\n"; if ($Order) echo "\n"; if ($which) { echo "\n"; echo "\n"; echo "\n"; } if ($dates) echo "\n"; if ($descending) echo "\n"; if ($font_size) echo "\n"; if ($debug) echo "\n"; if ($ShowID) echo "\n"; if ($submitter) echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "
\n"; echo "
\n"; echo "Search results:

\n"; */ /*AF*/ if ($skip) echo "Continuing "; echo "Partyserver result ".date_af($moment)." at ".time_part($moment)." CET for "; if ($country=="") echo "all countries"; else echo "$country"; echo " $type $town: $party $club $artist $org $submitter $which"; if ($date_any==0) echo " from ".date_af($from)." thru ".date_af($to); echo "
\n"; $linecount=0; /* displayed rows */ $partycount=0; /* actual rows */ $skipcount=0; /* rows destined for subsequent pages */ while($row_array=mysql_fetch_row($result)) { $partycount++; if ($skip>$partycount) continue; if ($q_artist!="") { if (pprocess($row_array[4]) & pprocess($row_array[5]) & pprocess($row_array[6]) & pprocess($row_array[7]) ) continue; /* skip this party */ } if (date_value($row_array[1])==0) /* PartyDate */ continue; /* skip this party */ if (($date_any==0) && ($row_array[18]=="alanski") && ($from==date_part($today))) { /* check validity of dates -v- time of query */ if (date_part($row_array[19])==$today) /* EndDate==today? */ if (time_part($row_array[19])!=0) /* time specified? */ if ($row_array[19] < $moment) /* EndDate earlier than time now? */ { echo "\n"; continue; /* skip the party */ } } if ($linecount==$number) { $skipcount++; continue; /* just count the rest, no display */ } // Change all row_array to readable names // Set all valid values to readable $ID = $row_array[0 ]; $PartyDateTime = $row_array[1 ]; $PartyName = $row_array[2 ]; $InOut = $row_array[3 ]; $DJs = $row_array[4 ]; $Live = $row_array[5 ]; $ChillOut = $row_array[6 ]; $Deko = $row_array[7 ]; $Country = $row_array[8 ]; $Town = $row_array[9 ]; $Location = $row_array[10]; $Hotline = $row_array[11]; $Organizer = $row_array[12]; $Email = $row_array[13]; $Url = $row_array[14]; $Memo = $row_array[15]; $Flyersmall = $row_array[16]; $Flyerfull = $row_array[17]; $Passw = $row_array[18]; $EndDateTime = $row_array[19]; $AddDateTime = $row_array[20]; if ($Flyersmall) { $FlyersmallImg = "\"Flyer
"; } /*AF*/ else $FlyersmallImg=""; /* ensure re-initialised! */ if ($Url) { $Url = "LINK"; } if ($Email) { $Email = "$Email"; } // echo "hier: $format"; /* removed 31.3.99 (made things sick online!) */ /* OK, display the party */ include ("tpl/" . $format_tpl . ".tpl"); /* TEMPLATE FOR DISPLAY */ } include ("tpl/" . $format_tpl . "_bottom.tpl"); /* TEMPLATE AT END OF TABLE */ if ($_SERVER[HTTP_REFERER]) { $strSQL = " update ps_userconfig set referer='".$_SERVER[HTTP_REFERER]."' where id = $UID "; $update = @mysql_query($strSQL,$connectID); } } /* result OK */ } /* format */ mysql_close($connectID); $connectID=0; /* connection to database severed */ ?>
Powered by
Powered by www.goatrance.de