PsychoQuery Modification

Back to Main


SourceQuery download UPDATED 5/31/2009

For a newer PHP Query Script get SourceQuery by JTP10181 & Manip

Please contact me if you have questions or just to say you use this!
All my contact info is on the main page of this site.

See it in Action HERE


Original PsychoQuery Page

Big Thanks to Stormtrooper for writing the original code. Maybe someday my modifications will make it into the official product ;)

There a few different options for the images and download links, this only demonstrates the ones I use for my site.

FULL Version on Contribs page of PsychoStats

Backup Download Link



Download my Second Theme from KingPin
-Shows use of new variable $dllink
-Shows use of new variable$modversion
-Has GameLauncher Links
-Side-by-Side display for webpages with a wider space.


Download my Theme from KingPin
-Shows use of new variable $dllink
-Shows use of new variable$modversion


Download my Theme from DryDock
-Shows use of new variable $dllink)

 

You May need to edit the html file with a text editor and change the link to the CSS document if you use a different path than what I used.

These themes are designed ONLY to be included in a PHP page, here is an example of the code

<?php virtual("/pquery/pquery.pl?s=SERVER_IP:SERVER_PORT"); ?>

Of course you need to change the path and the server_ip and server_port to make it work for your server.


History:

v1.1 - 03/10/04

v1.0


Documented Changes for v1.0:

Edit pquery.cfg

Add the following to the END of the file

#JTP10181 - Extra Settings for NEW Features

# Image Settings.  Paths MUST have trailing "/"
# Image size is assumed to be 160x120, anything bigger will need adjustments to the template.
# imagemiss is what image to use if no other image is found
imagespath	= ../images/mappics/
imagesurl		= /images/mappics/
imageext		= gif
imagemiss		= cstrike_nopicture

#Map download settings. Paths MUST have trailing "/"
#If mappath is NOT set it will make a link to the mapurl + map name + extension for every map
#If mappath is set it will only make a link IF the map exists
mappath		= ../maps/
mapurl		= /maps/
mapext		= zip

#Download Link Text
#Set dllinktxt to "image" to use a map image for the link and "map" to use the mapname
#Any other setting will be used as plain text for the link
dllinktxt		= Download Map
dlnolinktxt	= No Download

#END JTP10181

Edit psquery.pl

FIND

if ($conffile and -e $conffile) {
  %conf = &loadconfig(filename => $conffile);
  while (my ($key,$val) = each(%parms)) {		# override config settings with paramaters
    $conf{$key} = $val if $parms{$key};
  }
} else {
  %conf = %parms;
}

ADD Directly AFTER

#JTP10181
#Adds a "." to the extensions if it is not there already
if ($conf{imageext}) {
	$conf{imageext} =~ s/(^[^\.].*)/\.$1/;
}
if ($conf{mapext}) {
	$conf{mapext} =~ s/(^[^\.].*)/\.$1/;
}
#END JTP10181

FIND

  while ($match =~ m/$mainpat/) {

ADD Directly ABOVE

  #JTP10181 - Pre processing
  my $imageurl;
  my $mapdlurl;
  
  if (-e ($conf{imagespath} . $info->{map} . $conf{imageext})) {
  	$imageurl = $conf{imagesurl} . $info->{map} . $conf{imageext};
  } else {
        $imageurl = $conf{imagesurl} . $conf{imagemiss} . $conf{imageext};
  }
  
  if ($conf{mappath} && (!-e ($conf{mappath} . $info->{map} . $conf{mapext}))) {
      	$mapdlurl = '';
  } else {
	$mapdlurl = $conf{mapurl} . $info->{map} . $conf{mapext};
  }
  #END JTP10181

FIND

    } elsif ($m eq "modname") {
      $html = $info->{gamename} || $conf{l_unknown};
      $line =~ s/$subpat/$html/e;

REPLACE WITH

    } elsif ($m eq "modname") {
      #JTP10181 - Some mods do not return thier name properly
      #With this addition any mod can have a custom name based on its directory
      #If no custom match is found it uses the old method for getting the mod name
      if ($info->{gamedir} eq 'cstrike') {
      	$html = 'Counter-Strike';
      }
      elsif ($info->{gamedir} eq 'ts') {
      	$html = 'The Specialists';
      }
      else {
      	$html = $info->{gamename} || $conf{l_unknown};
      }
      #END JTP10181
      $line =~ s/$subpat/$html/e;

FIND

    } elsif ($m eq "servername") {
      $html = $info->{name} || $conf{l_unknown};
      $line =~ s/$subpat/$html/e;

REPLACE WITH

    } elsif ($m eq "servername") {
      #JTP10181 - Some server names may have HTML in them
      #I added this to make it parse the server name through the html stripper if enablehtml is on
      #the template also needs ot be changed from $name to $servername
      if ($conf{vars}{enablehtml}) {
        $html = &safename($info->{name}) || $conf{l_unknown};
      } else {
        $html = $info->{name} || $conf{l_unknown};
      }
      #END JTP10181
      $line =~ s/$subpat/$html/e;

FIND

    } elsif ($m eq "mapname") {
      $line =~ s/$subpat/$info->{map} || $conf{l_unknown}/e;

ADD Directly AFTER

    
    #JTP10181 - Additional Template variables
    
    } elsif ($m eq "mapimg") {
      $html = $imageurl;
      $line =~ s/$subpat/$html/e;
    }
    elsif ($m eq "mapdlurl") {
      $html = $mapdlurl;
      $line =~ s/$subpat/$html/e;

    }
    elsif ($m eq "dllink") {
      my $linktxt;
      my $nolinktxt;
      if ($conf{dllinktxt} eq 'image') {
      	$linktxt = '<img src="' . $imageurl . '" border="0">';
      	$nolinktxt = $linktxt;
      }
      elsif ($conf{dllinktxt} eq 'map') {
      	$linktxt = $info->{map};
      	$nolinktxt = $linktxt;
      }
      else {
      	$linktxt = $conf{dllinktxt};
      	$nolinktxt = $conf{dlnolinktxt};
      }

      if ($mapdlurl) {
      	$html = '<a href="' . $mapdlurl . '">' . $linktxt . '</a>';
      }
      else {
      	$html = $nolinktxt;
      }
      
      $line =~ s/$subpat/$html/e;

    #END JTP10181

Thats it, enjoy