Wacs Programming Guide

First Edition

for WACS 0.8.0

B "Beaky" King

July 7th, 2008

Abstract

WACS is a tool for building Adult Web Sites; it is equally suitable for managing a private collection or building a commercial web site. It has many best of breed features including dynamic filtering, model catalogs, automatic download and powerful search engine. It comes with a powerful API (application programming interface) implemented in both Perl and PHP5 languages to allow web developers to leverage it's facilities from their own programs.

This book describes the application programming interface provided by WACS, and how to utilise it from perl and Php languages. It provides an extensive introductory tutorial with a large number of worked example programs as well as a complete API reference manual. Additionally it provides a schema reference for the WACS database tables as understanding the fields available to you is central to writing programs that utilitise it. The intended audience is web developers and WACS site managers who wish to tailor an existing WACS installation to meet their precise requirements; people merely wishing to use or manage an existing WACS installation may well find the default configurations provided suffice.


Table of Contents

I. WACS API Programming Tutorial
1. Introduction
Overview
About This Book
About The Examples
2. Basics: Getting Started
Outline
A First WACS Program
Modules: Importing
Configuration And Security
Initialising Database Connection
Fetching Some Records
Showing The Results
Finishing Off
Putting It All Together
Running MySimple
Reviewing The First Program
3. Using More Database Fields
Adding Model Icons
More Model Information
Using HTML tables
Adding The Model Details
Adding Other Icons
4. Set Display Routines
About Set Display
Sets: The Basic Bones
Adding Icons
Making The Text More Readable
Connecting Sets And Models
Understanding The Data Architecture
Using Relationships With Assoc
An Example Using Assoc
5. The User Interface Toolkit
Introducing WacsUI
Including WacsUI support
WacsUI: DescribeHer
The addkeyicons function
WacsUI: Other Functions
Conclusions
II. WACS API Programming Reference
6. WACS API: Core Module
Core Module: Summary
Core Module: Reference
7. WACS API: User Interface Module
User Interface Module: Summary
User Interface Module: Reference
8. WACS API: Standard Components Module
Standard Components Module: Summary
Standard Components Module: Reference
9. WACS API: Identification Module
Identification Module: Summary
III. WACS Database Schema
10. Schema Reference: Sets
Sets: Schema SQL
Sets: Defined Values
11. Schema Reference: Assoc
Assoc: Schema SQL
Assoc: Defined Values
12. Schema Reference: Idmap
Idmap: Schema SQL
Idmap: Defined Values
13. Schema Reference: Models
Models: Schema SQL
Models: Defined Values
14. Schema Reference: Download
Download: Schema SQL
Download: Defined Values
15. Schema Reference: Photographer
Photographer: Schema SQL
Photographer: Defined Values
16. Schema Reference: Tag
Tag: Schema SQL
Tag: Defined Values
17. Schema Reference: Vendor
Vendor: Schema SQL
Vendor: Defined Values
18. Schema Reference: Conn
Conn: Schema SQL
Conn: Defined Values
19. Schema Reference: Keyword
Keyword: Schema SQL
Keyword: Defined Values
Index

List of Tables

1. The Key WACS Modules
6.1. Function Summary: Core Module
7.1. Function Summary: User Interface Module
8.1. Function Summary: Standard Components Module
9.1. Function Summary: Identification Module
10.1. stype: Type of Set: defined values
10.2. sstatus: Status of Set: defined values
10.3. sauto: Automatic Update of Set Allowed?: defined values
10.4. srating: Overall Rating For The Set: defined values
10.5. stechqual: Technical Quality Rating For The Set: defined values
10.6. svariety: Unusualness Rating For The Set: defined values
10.7. sformat: Format of the File(s) In The Set: defined values
10.8. sidlogo: Presence of Burnt-in Logo: defined values
10.9. serrors: Presence of Known Errors: defined values
10.10. scatflag: Generalised type of the set: defined values
10.11. slocation: generalised description of locations: recommended values
10.12. suscattr: how to generate the 18 USC 2257 declaration: defined values
11.1. astatus: association status: defined values
12.1. istatus: idmap status: defined values
12.2. iactive: model activity status as this identity: defined values
12.3. isite: Some recommended site abbrievations: recommended values
13.1. mstatus: model record status: defined values
13.2. mrating: model rating: defined values
13.3. mpussy: model's normal pubic hair style: defined values
13.4. mflag: special marking flag for models: defined values
13.5. model activites flags: defined values
13.6. mcstatus: accuracy of home country field: defined values
13.7. mrace: race of the model: defined values
13.8. mbuild: body type of the model: defined values
13.9. vital statistics: meanings
14.1. dstatus: download status: defined values
14.2. dtype: download set type: defined values
14.3. dsetflag: Suggested value for scatflag based on parsing result
15.1. pgender: gender of the photographer: defined values
15.2. pregion: geographical location of the photographer: defined values
15.3. prating: overall rating of photographer: defined values
15.4. phardness: rating of how explicit this photographer can be: defined values
15.5. photographer activites covered flags: defined values
15.6. photographer technologies used flags: defined values
16.1. tstatus: tag entry status: defined values
16.2. tflag: tag content type status: defined values
17.1. vcurrent: vendor existance status: defined values
17.2. vshow: vendor index inclusion status: defined values
17.3. vmdiruse et al: vendor URL auto-usuability status: defined values
18.1. cflag: connection type: defined values
18.2. cstatus: connection entry status: defined values
19.1. kflag: active entry status: defined values

List of Examples

2.1. WACS Module Import
2.2. Config and Security
2.3. Database Connection Initialisation
2.4. Database Query
2.5. Outputing The List
2.6. Php: Complete Simple Program
2.7. Perl: Complete Simple Program
3.1. Modified Output Loop with Icon Code
3.2. Modified SQL command for more Model Info
3.3. New version of the loop using tables
3.4. Adding Model Information
3.5. Adding A Rating Icon
4.1. The Basic SetDisp Program
4.2. Adding A Set Icon
4.3. Making Camel-Style Text Readable
4.4. Modified Icon Cell
4.5. getmodel Subroutine
4.6. Calling The getmodel Function
5.1. WacsUI initialisation
5.2. Using WacsUI: describeher
5.3. Using AddKeyIcons

Part I. WACS API Programming Tutorial

Chapter 1. Introduction

Overview

Welcome to WACS, Web-based Adult Content Server, a free software package for the management of material of an "Adult Nature" (or basically whatever euphermism for porn you prefer). It is web-based and can be used for the management of an existing collection, as a download manager, or as a back-end system for running a commercial adult web site. It is dramatically different from most other image gallery systems in that it understands photo sets and video clips as basic concepts, instead of single photographs. It also includes far more specialised tagging, source, relationship and attribute marking concepts than other more generalised systems. WACS' abilities in the areas of searching and dynamic filtering are really industry-leading in their power and flexibility.

About This Book

This electronic book, the WACS Programming Guide, is designed to act both as an introduction to programming with the WACS API in either perl or PHP, and as a reference volume for both the API itself and the database schema. This book assumes you already have a basic knowledge of programming in your choosen language (PHP5 or perl5) and have some understanding of databases and in particular SQL (Structure Query Language). Some familiarity with WACS at a user level would also be a distinct advantage, and I'd strongly recommend working through the companion user guide first - who knows it might give you some ideas about neat extra features you can add to your own site. All documentation for WACS is available both within the distribution and from the WACS Web Site at Sourceforge.net.

It is important to stress that ALL of the collection management tools are implemented in Perl and the PHP interface is an optional addition to, not an alternative to, the core Wacs system which is perl based. Given the relative youth of the WACS system, php5 has been selected for the implementation to save future porting efforts as it is expected that php5 or later will be the minimum common standard by the time Wacs reaches 1.0. There is no intention to support older dialects of php at this point.

As the WACS software package is Open Source, we're always looking for contributions; if you create a site design (or prototype for one) which you don't end up using, maybe you would consider donating it to the repository of sample WACS Skins. We can always substitute our own artwork into already written web application code.

About The Examples

For copyright/licensing reasons, the example images feature sets from photoshoots by the main developer of WACS (Beaky) and a friend of his. These sets will be available on our demonstration site when that goes live. Please understand that due to the bandwidth and storage costs in running such a server on the internet, and the need to verify (as best we can) that the applicant is an adult, there is a small charge for access to the site.

Chapter 2. Basics: Getting Started

Outline

In this chapter we're going to talk about the basic first steps in making use of the WACS API from your own programs. We're going to assume that you've got a WACS server you can use up and running; that you know where things are on it and that you have appropriate write access to the web document tree (if you're working in PHP) or the cgi-bin directory (if you're working in Perl). Hopefully you'll have both some models and a few image sets known in the WACS system to work with. For these first code examples, you could merely load the sample model profiles we've provided in the samples directory of the WACS distribution.

While the finished code of the sample programs featured here is available in the samples directory of the WACS Core distribution (for the Perl verion) or the WACS-php distribution (for the PHP5 version), you may wish to type it in as you go along as an aid to learning how to use the interface. If you do, we'd recommend calling this file mysimple for perl, or mysimple.php for PHP. For consistency, we're going to put the PHP dialect first and then the Perl dialect in each of the examples.

The basic structure of your first WACS application will consist of five steps; these are:

  1. import the WACS API modules

  2. read configuration and check access rights

  3. initialise the database connection

  4. run an appropriate database query

  5. retrieve records and display them

A First WACS Program

Modules: Importing

The very first step is to import the WACS API modules into your program file along with those standard modules needed to access the database. These files should be in the right location already and should just be found without any additional specification of where they are.

Example 2.1. WACS Module Import

require_once "wacs.php";
require_once "DB.php";

$wacs = new Wacs;

The same code segment implemented in perl looks like:

use Wacs;
use DBI;
[Note]Note

The PHP interface requires an Object Handle to use when accessing the WACS module which we're simply calling $wacs. Perl doesn't need such a construct - there is simply the one instance.

Configuration And Security

The second step is to read the standard WACS configuration file to find out where everything is, and then check that this user is allowed to access the WACS system. This is a two step process, and the reading of the configuration file must be done first; otherwise WACS doesn't know where to look for the security files it needs to determine whether this user should be given access or not.

Example 2.2. Config and Security

// read the Wacs configuration files
$wacs->read_conf();

// check the auth(entication and authorisation) of this user
$wacs->check_auth( $_SERVER['REMOTE_ADDR'], 1 );

and here is the same thing again in the perl dialect:

# read the Wacs configuration files
read_conf;

# check the auth(entication and authorisation) of this user
check_auth( $ENV{"REMOTE_ADDR"}, 1 );

Initialising Database Connection

The third step is to initialise the database connection. Since some databases require an environment variable to determine where their configuration files have been stored, this needs to be set first. Wacs provides for this and this code will create that environment variable, if needed, and then proceed to establish the database connection itself.

Example 2.3. Database Connection Initialisation

// database initialisation
// - establish environment variable
$dbienv = $wacs->conf_get_attr("database","dbienvvar");
if( ! empty( $dbienv ))
{
        putenv($dbienv."=".$wacs->conf_get_attr("database","dbienvvalue"));
}
// - connect to the database
$dbhandle= DB::connect( $wacs->conf_get_attr("database","phpdbconnect") );
if( DB::iserror($dbhandle))
{
        die("Can't connect to database\nReason:".$dbhandle->getMessage."\n");
}
$dbhandle->setFetchMode(DB_FETCHMODE_ORDERED);

and here's how we do it in perl:

# database initialisation
# - establish environment variable
$dbienv = conf_get_attr( "database","dbienvvar" );
if( $dbienv ne "" )
{
        $ENV{$dbienv}= conf_get_attr( "database","dbienvvalue" );
}
# - connect to the database
$dbhandle=DBI->connect( conf_get_attr("database","dbiconnect"),
                        conf_get_attr("database","dbuser"),
                        conf_get_attr("database","dbpass") ) ||
die("Can't connect to database\nReason given was $DBI::errstr\n");

OK, let's just study this code for a moment. It first calls the WACS API function conf_get_attr with the section parameter of database as it wants database related configuration information, and an argument of dbienvvar. The WACS API function conf_get_attr is short for configuration get attribute and returns the value of the configuration file parameter of that name or it's default value. The dbienvvar means database interface environment variable. A typical value for this might be something like ORACLE_HOME which is the environment variable that Oracle 10g and 11i requires to be set in order to find it's current configuration.

The next line of the code checks to see if we got back an actual variable name (eg ORACLE_HOME) or an empty string (ie nothing). If we were given a valid variable name, then we're going to need to set it the value it should be, which again we can get from the configuration file, this time called dbienvvalue which is short for database interface environment value (as distinct from the variable name we just looked up). A likely value for this might be /usr/local/oracle. Obviously if we're given no variable name to set, there's no point looking for a value for it! Conversely we are assuming that having bothered to name the variable in the configuration file, also put in a valid value for it - this code could break if the variable name is specified but not it's value.

The second section of these code segments is to do with the establishment of a connection to the database and is a little different between the two versions. Both systems use a handle for the database connection, which we call $dbhandle - imaginative name huh? In both cases, the respective database APIs provide a connect function which takes an argument of how to connect to the database. The Php version takes a single argument, which is stored in our configuration files as phpdbconnect and includes the whole username, password and database specification in a single lump. The Perl version asks for three: the database specification, the username and finally the password. The configuration file knows these as dbiconnect, dbuser and dbpass respectively.

The final bit copes with putting out some kind of error message, at least showing the point of failure, if we are unable to establish a connection to the database. The methods are very slightly different, but the effect is very much the same between the two versions. We then just tell the PHP DB interface how we wish it to organise the returned data; the perl DBI default is pre-determined and is what we want.

[Tip]Tip

Note that you might wish to have completed the output of the HTML header section and started the body by this point so that should the database connection fail, the error message will be visible.

Fetching Some Records

The next step in the process is to use the database connection we've established to actually make a request of the database. For now don't worry about what that request is or how we've written it - we'll come back to that topic in detail later in this chapter. Look at the mechanics of how we're issuing the request and getting back the results. What we're going to ask the database for is a list of those girls who are marked as Favourite Solo models. We chose this because both the models in our current samples directory are marked as this and so even if you only have our sample records loaded, you should find some matches.

Example 2.4. Database Query

// do db select
//                0      1        2          3
$query = "select mname, modelno, mbigimage, mimage from ".
         $wacs->conf_get_attr("tables","models").
         " where mflag = 'S' order by mname";
$cursor = $dbhandle->query( $query );

The method is a little different in perl in that it is seperated into two steps; as a result it looks like this...

# do db select
#                 0      1        2          3
$query = "select mname, modelno, mbigimage, mimage from ".
          conf_get_attr("tables","models").
          " where mflag = 'S' order by mname";
$cursor = $dbhandle->prepare( $query );
$cursor->execute;
[Note]Note

The query structure is very similar between Php and perl apart for the two step process of validating and then seperately executing the query in perl. This is mostly down to different traditions that exist for database accesses in each language. The net result is similar in technical terms and identical in output terms

In both cases we're putting together an SQL query that reads:

select mname, modelno, mbigimage, mimage
from models
where mflag = 'S'
order by mname

This query asks the database to fetch the four named items: mname, modelno, mbigimage, and mimage from the database table called models where the field mflag has a value of the capital letter S and to sort the results it returns to us by the value in the field called mname. It may not surprise you to learn that mname is the model's name, modelno is our reference number for her, mbigimage is the (location of the) large size headshot of her and mimage is the (location of the) smaller size headshot of her.

You may have noticed that the only part of this that wasn't copied verbatim from the code is the from models bit and that there we've used the WACS API call conf_get_attr to get the actual name of the database table concerned from the main WACS configuration file. This is actually important and it's strongly recommended that you do use this form when creating SQL queries. If you really insist on knowing why, take a look at the section on the tables part of the wacs.cfg configuration file in the WACS configuration guide.

Once we've created the SQL query, we feed it to the database routines. The first step is to pass in the SQL query and have the database perform that search on the database. Once the query has been executed, we want to pull back the matching records (or rows in database parlence) for each model. In both Php and Perl we're calling a routine that returns to us a single row from the database (a single model's record in this case) each time it's called. When we run out of records, a null return is given and our while loop ends. In Php, the function to do this is called using fetchRow which returns the next row as an array of values, which we assign into the variable $results each time. In Perl, the function we're using is called fetchrow_array because perl offers us a choice in the type of data we are returned and in this case we want a numerically indexed array.

[Note]Note

There are other approaches to getting back the data, including having it returned in one big lump (such as with the Php call getAll()) - this has been avoided as some WACS installations might have tens of thousands of matching records for some queries.

Showing The Results

The final step is to actually generate some output from the data we've fetched from the database. We're going to do this as an unordered list in HTML, so we're going to be adding a little formating to the output as we retrieve each record.

Example 2.5. Outputing The List

print "<ul>\n";
while( $results = $cursor->fetchRow() )
{
        print "<li>";
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print $results[0]."</a></li>\n";
}
print "</ul>\n";

and here's the perl version...

print "<ul>\n";
while( @results = $cursor->fetchrow_array )
{
        print "<li>";
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print $results[0]."</a></li>\n";
}
print "<ul>\n";

We start off by printing out the HTML instruction to start an unordered list (<ul>) in a line on it's own. We then start a while loop which goes through each entry until it's done them all. Both versions use the database cursor object ($cursor) to fetch the next record (aka row) from the database using the fetchRow or fetchrow_array method and assigning it into the array $results (or in perl @results). The act of the assignment fails when there are no more records to fetch and the while loop will terminate. The construct here is based upon the fact that both languages have seperate operators for assignment (=) and comparison (== and eq) and so the code is unambiguous (at least to the php and perl interpreters it is!).

Once inside the body of the while loop we print out the start of list entry tag (<li>) and start in on making use of the data. In the quest to make this example a little bit more satisfying, we've tried to make sure this application does something vaguely useful. A simple list of names is all well and good, but we wanted it to actually do something! So what we've done here is to create a link around each models name that points to her model page as displayed by the standard WACS tools. The raw HTML to achieve this would look like:

<a href="http://www.mywacsserver.com/cgi-bin/wacsmpthumbs/123">
Sarah</a>

So we're left with a slight problem here in that we don't know in advance (trust me on this) what the WACS server is called, we don't know what the models are called and we don't know what their numbers are. We have no idea if we have a model number 123 or not and whether she's called Sarah; but the WACS system should be able to fill in all the blanks for us.

The first part of the code merely prints out the start of the HTML <a href="> and then we ask the WACS configuration system what it's externally visible URL for cgi-bin programs is. We do this using the conf_get_attr call again, telling it we want an answer in the section server of the URL for cgi scripts aka cgiurl. On the next line of the example we put the name of the WACS application we want to link to, in this case wacsmpthumbs. Since the way we tell wacsmpthumbs what we want it to look up is to add a slash and then the model number to the URL, we add a slash (/) on the end and then the number.

[Tip]Tip

You may have noticed that we added a comment on the line above the SQL select statement with 0,1,2,3 with each number above the field name in the query. This was a shorthand to ourselves to remind us what the index number in the array is for each of those database fields.

Since the order of the fields we asked for was mname, modelno, mbigimage and then mimage, the results in the array will be the same - element 0 will be the mname, element 1 will be the model number, and so on. In both cases we're dealing with a single-dimensional array. The first field we want to go into the URL for wacsmodelthumbs is the model number, so that will be element 1 (not zero) therefore we write $results[1]. We then finish off the URL reference by closing the quotes (") and the > tag.

We then want to print the model's name which will be element 0 in our arrays, put out the closing anchor tag (</a>) and then finish off the unordered line entry with the end line tag (</li>). We then print out a new line so the generated page is easier to read. The moving on to the next record will be done as a by-product of the test for the next iteration around the while loop. Once we exit the loop, we finish off the HTML unordered list.

Finishing Off

To just finally finish it off, we need to add a few more pieces just to make it work. For the Php version, we need to declare it as being a php program with <?php at the very start of the file, with a matching ?> at the very end. For perl, we need to declare it as a perl script with the very first line being just #!/usr/bin/perl. Additionally for perl, we need to output the mime content type declaration so that the web browser knows what kind of object it's being passed - this is done simply with:

print "Content-Type: text/html\n";
print "\n";

Next we need a couple of lines of HTML preamble near the beginning (as mentioned before, just before the database connection code so we could see any error message that appears):

<html>
<head>
<title>MySimple: Index Of Favourites</title>
</head>
<body>

Similarly at the end, we just need to finish the page off with the html tail piece:

</body>
</html>

Putting It All Together

With all the components in place, let's review the new MySimple WACS program in it's entirety. We include the modules, initialise the configuration system, check the authorisation, connect to the database, draft the query, submit it and then loop through the results. Not really that complex now we know what each part does. Anyway here's the finished code....

Example 2.6. Php: Complete Simple Program

<?php
// MySimple - sample WACS API program (PHP5)
require_once "wacs.php";
require_once "DB.php";
$wacs = new Wacs;
// read the Wacs configuration files
$wacs->read_conf();
// check the auth(entication and authorisation) of this user
$wacs->check_auth( $_SERVER['REMOTE_ADDR'], 1 );
// start the HTML document
print "<html>\n";
print "<head>\n";
print "<title>MySimple: Index Of Favourites</title>\n";
print "</head>\n";
print "<body>\n";
// database initialisation
// - establish environment variable
$dbienv = $wacs->conf_get_attr("database","dbienvvar");
if( ! empty( $dbienv ))
{
        putenv($dbienv."=".$wacs->conf_get_attr("database","dbienvvalue"));
}
// - connect to the database
$dbhandle= DB::connect( $wacs->conf_get_attr("database","phpdbconnect") );
if( DB::iserror($dbhandle))
{
        die("Can't connect to database\nReason:".$dbhandle->getMessage()."\n");
}
$dbhandle->setFetchMode(DB_FETCHMODE_ORDERED);
// do db select
//                0      1        2          3
$query = "select mname, modelno, mbigimage, mimage from ".
         $wacs->conf_get_attr("tables","models").
         " where mflag = 'S' order by mname";
$cursor = $dbhandle->query( $query );
// output the results
print "<ul>\n";
while( $results = $cursor->fetchRow() )
{
        print "<li>";
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print $results[0]."</a></li>\n";
}
print "</ul>\n";
// finish off
print "</body>\n";
print "</html>\n";
?>

Example 2.7. Perl: Complete Simple Program

#!/usr/bin/perl
#
# MySimple - Sample WACS Program (Perl)
#
use Wacs;
use DBI;
# read the Wacs configuration files
read_conf;
# check the auth(entication and authorisation) of this user
check_auth( $ENV{"REMOTE_ADDR"}, 1 );
# output the HTML headers
print "Content-Type: text/html\n";
print "\n";
print "<html>\n";
print "<head>\n";
print "<title>MySimple: Index Of Favourites</title>\n";
print "</head>\n";
print "<body>\n";
# database initialisation
# - establish environment variable
$dbienv = conf_get_attr( "database","dbienvvar" );
if( $dbienv ne "" )
{
	$ENV{$dbienv}= conf_get_attr( "database","dbienvvalue" );
}
# - connect to the database
$dbhandle=DBI->connect( conf_get_attr("database","dbiconnect"),
                        conf_get_attr("database","dbuser"),
                        conf_get_attr("database","dbpass") ) ||
die("Can't connect to database\nReason given was $DBI::errstr\n");
# do db select
#                 0      1        2          3
$query = "select mname, modelno, mbigimage, mimage from ".
          conf_get_attr("tables","models").
          " where mflag = 'S' order by mname";
$cursor = $dbhandle->prepare( $query );
$cursor->execute;
print "<ul>\n";
while( @results = $cursor->fetchrow_array )
{
        print "<li>";
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print $results[0]."</a></li>\n";
}
print "<ul>\n";
# finish off
print "</body>\n";
print "</html>\n";

Running MySimple

Our first WACS application is now complete, so copy the file into the either the web server document tree (for Php) or the web server cgi-bin directory (for perl). When you call up the URL, you should see something like this....

Granted it's fairly plain, but the names are in alphabetical order and there are links on each name to that girl's model page. If you didn't see any output, or got an error, you need to check the error log for the server you're using. With Apache on linux, the usual location of this is /var/log/httpd/www.mywacserver.com-errorlog or something similar to that.

Reviewing The First Program

This has been a fairly long and intense chapter, but we obviously had a lot of ground to cover and we really wanted to achieve a usable program before the end of it. This hopefully we've done. We've seen how to include the WACS module and the Database interface module. We've seen how to use read_conf and check_auth to read the configuration files and check the user's credentials. We've then made multiple uses of conf_get_attr to get all of the information together we need to make a connection to the database.

After all that setup procedure, which will become a very familiar template as you program with the WACS API, we looked at creating and sending a query to the database, retrieving the results and formating those results as a simple web page. In the next chapter, we'll look at how to make use of other information stored within the database.

Chapter 3. Using More Database Fields

Adding Model Icons

In the simple example in the last chapter, we saw how to create a list of model's names with hypertext links on each name to that model's standard WACS model page. Obviously that's not a particularly presentable page by itself, so the next step is to add a head shot for each model to the links.

We actually already paved the way for doing this by including the two headshot image fields in the results we asked for from the SQL query - if you remember, we put:

select mname, modelno, mbigimage, mimage 

Since we have the data already, all we need to do now is to add a few extra statements to the output section to output an appropriate image tag and we'll have included the model's headshot too. We have a configuration attribute in the server section of the configuration file called wacsurl that tells us where the WACS area can be found on the WACS server. Standard size model headshots are conventionally found in the icons/ directory directly below the top level. So all we need to do is add in a call to conf_get_attr to get it and build the apropriate HTML img tag. In PHP we'd write:

    print "<img src=\"".$wacs->conf_get_attr("server","wacsurl");
    print "icons/".$results[3]."\" alt=\"[".$results[0]."]\">";

and in perl we'd write:

    print "<img src=\"".conf_get_attr("server","wacsurl");
    print "icons/".$results[3]."\" alt=\"[".$results[0]."]\">";

this needs to be done just below the line that establishes the link to the model's WACS model page, but before her name (you could put it after if you prefer) and closing </a>.

Example 3.1. Modified Output Loop with Icon Code

while( $results = $cursor->fetchRow() )
{
        print "<li>";
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print "<img src=\"".$wacs->conf_get_attr("server","wacsurl");
        print "icons/".$results[3]."\" alt=\"[".$results[0]."]\">";
        print $results[0]."</a></li>\n";
}

and in perl this now looks like:

while( @results = $cursor->fetchrow_array )
{
        print "<li>";
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        print "<img src=\"".conf_get_attr("server","wacsurl");
        print "icons/".$results[3]."\" alt=\"[".$results[0]."]\">";
        print $results[0]."</a></li>\n";
}

We then copy up the modified version of the program and run it and we should see something like this:

More Model Information

The WACS database does of course carry far more information about the model thank just her name and icons, so for the next step we're going to look at adding a few basic pieces of information about her to each entry. The first step is to add some additional fields to the list of what we want returned by the SQL query. Initially we're going to add another five fields: they are mhair, mlength, mtitsize, mnsets and mnvideos. These database fields give us her hair colour, length, the size of her breasts and the number of images sets and videos we have by her respectively. The modified version of the query looks like:

Example 3.2. Modified SQL command for more Model Info

// do db select
//                0      1        2          3       4
$query = "select mname, modelno, mbigimage, mimage, mhair, ".
//                5        6         7       8
         "       mlength, mtitsize, mnsets, mnvideos from ".
         $wacs->conf_get_attr("tables","models").
         " where mflag = 'S' order by mname");
$cursor = $dbhandle->query( $query );

in php.

[Note]Note

We've added a second line of comments with the element numbers within the array that the returned database field will appear in; mlength will be index 5 for instance.

The same code in perl will look like:

# do db select
#                 0      1        2          3       4
$query = "select mname, modelno, mbigimage, mimage, mhair, ".
#                 5        6         7       8        
         "       mlength, mtitsize, mnsets, mnvideos from ".
          conf_get_attr("tables","models").
          " where mflag = 'S' order by mname";
$cursor = $dbhandle->prepare( $query );
$cursor->execute;

Using HTML tables

The next step is to modify the display loop to include the extra details and in this case it probably makes sense to switch to using an HTML table cell to contain and manage the entry. We'll start off by simply re-writing the existing display loop to build the results into an HTML table instead - once we have that working, we'll restyle the table to include the extra fields we just added to the query. There is no actual requirement to make use of all the fields we've requested.

Lets have a look at the structure of the HTML document we're outputing here: First we need to open the new table, then each model will have her own row as we go through with the headshot image on the left and her name on the right, and finally we'll finish off the table. The HTML (minus the links) to do this will look something like:

<table>
 <tr>
  <td><img src="icons/Roxanne-1.jpg" alt="[Roxanne]"></td>
  <th>Roxanne</th>
 </tr>
 <tr>
  <td><img src="icons/Sabrina-1.jpg" alt="[Sabrina]"></td>
  <th>Sabrina</th>
 </tr>
</table>

Of course the next step is to re-write the code to actually recreate the necessary HTML; the start and end of the table simply replace the unordered list (<ul> and </ul> ) tags outside the loop that iterates through the list of models returned by the database. The list element (<li> and </li>) tags get replaced by the row start and end tags (<tr> and </tr>. Since we're puting the headshot icon and the name in separate elements and want a link to the appropriate model page on both of them, we need to double up the code that creates the hypertext link to wacsmpthumbs. We then include the icon (with alignment attributes) in a standard table tag ( <td> and the name in a heading (<th>) table tag so it comes out in bold and is centred.

The mysimple example thus re-writen will look like:

Example 3.3. New version of the loop using tables

// output the results
print "<table>\n";
while( $results = $cursor->fetchRow() )
{
        // start the HTML table row
        print "<tr><td valign=top align=center>\n";
        // link around the headshot image
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        // head shot image
        print "<img src=\"".$wacs->conf_get_attr("server","wacsurl");
        print "icons/".$results[3]."\"[".$results[0]."]\"></a>\n";
        // end this cell and start the next
        print "</td><th>\n";
        // link around name
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        // the name
        print $results[0]."</a>\n";
        // end the HTML table row
        print "</th></tr>\n";
}
print "</table>\n";
// finish off

and re-writing the same function in perl gives us something like:
# output the results
print "<table>\n";
while( @results = $cursor->fetchrow_array )
{
        # start the HTML table row
        print "<tr><td valign=top align=center>\n";
        # link around the headshot image
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        # head shot image
        print "<img src=\"".conf_get_attr("server","wacsurl");
        print "icons/".$results[3]."\"[".$results[0]."]\"></a>\n";
        # end this cell and start the next
        print "</td><th>\n";
        # link around name
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsmpthumbs/".$results[1]."\">";
        # the name
        print $results[0]."</a>\n";
        # end the HTML table row
        print "</th></tr>\n";
}
print "</table>\n";
# finish off

When run, this modified version of the script should produce the following:

As you can see, this has improved the layout somewhat over the previous version using just unordered list elements. Now to add those extra fields....

Adding The Model Details

To display some more details about the model, we're going to span the headshot on the left hand side over several rows, and add the model details themselves as additional table rows on the right hand side. Our first change therefore is to add rowspan=4 to the options on the image container <td> tag. The resulting php code is:

        // start the HTML table row
        print "<tr><td rowspan=4 valign=top align=center>\n";
        // link around the headshot image

and in perl reads:

        # start the HTML table row
        print "<tr><td rowspan=4 valign=top align=center>\n";
        # link around the headshot image

Next we add the second row which will include her hair colour and length, then a third row which will describe her breast size and the fourth row that gives the number of image sets and the number of videos we have for her.

Example 3.4. Adding Model Information

        // end the HTML table row
        print "</th></tr>\n";
        // do the second row (her hair)
        print "<tr><td>hair: ";
        print $results[5]." ".$results[4];
        print "</td></tr>\n";
        // do the third row (her breasts)
        print "<tr><td>breasts: ";
        print $results[6]."\n";
        print "</td></tr>\n";
        // do the fourth row (her sets)
        print "<tr><td>sets: ";
        print $results[7];
        if( $results[8] > 0 )
        {
                print " videos: ".$results[8];
        }
        print "</td></tr>\n";

and the same implemented in perl would look like:

        # end the HTML table row
        print "</th></tr>\n";
        # do the second row (her hair)
        print "<tr><td>hair: ";
        print $results[5]." ".$results[4];
        print "</td></tr>\n";
        # do the third row (her breasts)
        print "<tr><td>breasts: ";
        print $results[6]."\n";
        print "</td></tr>\n";
        # do the fourth row (her sets)
        print "<tr><td>sets: ";
        print $results[7];
        if( $results[8] > 0 )
        {
                print " videos: ".$results[8];
        }
        print "</td></tr>\n";
}

With these changes made, if you now run this version of the program, which is called mysimple4 in the samples/programming directory, you should see something like this:

There's obviously a lot more room for using many more of the fields within the model schema for further improvement of our model index, and we'll return to this subject in a later chapter (Chapter 5, The User Interface Toolkit). Before we leave the topic of models and move on to sets, we will cover just one more topic, that of adding rating icons.

Adding Other Icons

One of the significant features of WACS is its ability to include various attribute icons within pages to make specific aspects and attributes easier to recognise. While many of them need some additional logic to handle their display, a few of them like the model's rating and country of origin are actually fairly simple to use. We're going to take a quick look at how we'd use the WACS API to include the rating icons before moving on to look at how we handle sets. We will return to the more complex cases later when we look at the User Interface toolkit API.

For the model's rating, we need the field called mrating so the first step is to add this to the list of fields that we select from the database:

// do db select
//                0      1        2          3       4
$query = "select mname, modelno, mbigimage, mimage, mhair, ".
//                5        6         7       8         9
         "       mlength, mtitsize, mnsets, mnvideos, mrating ".
         "from ".$wacs->conf_get_attr("tables","models").
         " where mflag = 'S' order by mname";
$cursor = $dbhandle->query( $query );

and in perl the change makes this section read:

# do db select
#                 0      1        2          3       4
$query = "select mname, modelno, mbigimage, mimage, mhair, ".
#                 5        6         7       8         9
         "       mlength, mtitsize, mnsets, mnvideos, mrating ".
         "from ".conf_get_attr("tables","models").
         " where mflag = 'S' order by mname";
$cursor = $dbhandle->prepare( $query );
$cursor->execute;

With the rating field now in the data returned to us by the database, we can move down and update the display section to make use of it. The first step needed is to change the rowspan setting from 4 to 5 to accomodate the extra line of output.

        // start the HTML table row
        print "<tr><td rowspan=5 valign=top align=center>\n";
        // link around the headshot image

and in perl...

        # start the HTML table row
        print "<tr><td rowspan=5 valign=top align=center>\n";
        # link around the headshot image

The final step is to add the processing of the mrating field. All WACS icons are typically stored in the glyphs/ directory which is within the web server document tree. To find its exact URL, you use the conf_get_attr function to retrieve the value iconurl in the section server. Within this directory, you will find five files called rating-1.png through rating-5.png which look like this:

To make use of this we need to first test our data to see if we have a valid ratings value at all, then merely concatinate a string to create the necessary icon reference. In php, this will look like this:

Example 3.5. Adding A Rating Icon

        print "</td></tr>\n";
        // add the rating icon (if we have a value)
        print "<tr><td align=center valign=top>";
        if( $results[9] > 0 )
        {
                print "<img src=\"";
                print $wacs->conf_get_attr("server","iconurl");
                print "rating-".$results[9].".png\">";
                print " alt=\"[".$results[9]." out of 5]\">";
        }
        else
        {
                print "no rating";
        }
        print "</td></tr>\n";

while the same example in perl, would look like this:

        print "</td></tr>\n";
        # add the rating icon (if we have a value)
        print "<tr><td align=center valign=top>";
        if( $results[9] > 0 )
        {
                print "<img src=\"".conf_get_attr("server","iconurl");
                print "rating-".$results[9].".png\"";
                print " alt=\"[".$results[9]." out of 5]\">";
        }
        else
        {
                print "no rating";
        }
        print "</td></tr>\n";
}

Once you've put in these three changes, you can run the resulting script and expect to get an output something like this:

At this point we're hopefully beginning to get a rather more satisfying display of model details. Obviously there are many other tweaks we might like to add, and we'll return to some of those later on when we look at the User Interface Toolkit and the routines that provides. However, for now, we'll take a look at displaying sets rather than models....

Chapter 4. Set Display Routines

About Set Display

So far we've looked at displaying the information in the models table in the database, but of course there is also the small matter of sets without which whole thing wouldn't have much point. In this chapter we're going to look at displaying details of the sets, and then towards the end of the chapter, how to tie models and sets together.

In most of these examples, we're going to use the standard WACS tools to actually display the details of the sets themselves, but you can of course write your own web apps to do this should you wish to. In most cases we'll throttle the examples to only show a first few sets from the databases and assume you'll develop your own strategies for paginating and sub-dividing the sets in real world applications.

Sets: The Basic Bones

Since we're starting a new application, we'll start from scratch with the basic bones which we'll call setdisp. Much of the basic structure of this program should be getting quite familiar by now. The same five basic steps are to be found here - bring in the modules, initialise them, set up the database connection, submit the query and loop through the results outputting them.

What we're setting out to do in this script is to display a list of the latest additions of image sets marked as being of category flag type T which means they're solo sets involving toy usage. This we achieve by requesting only sets of type I which means image sets and of category flag type T.

[Tip]Tip

The full lists of recommended values for the type and category flag can be found in the schema reference section at the back of this book in Chapter 10, Schema Reference: Sets.

The basic format is that we once again create an HTML table with a row for each record. There's a link on the name of the set that leads to the standard WACS page display program wacsindex. This takes a number of URL arguments but the one we're using here is to prefix the set number with page which puts it into paged display mode and appended with a .html so that it saves correctly and in some cases will get cached. We're shrinking the font in which it's displayed as it can be quite a long line of text in it's stored form (but more on that topic later).

[Note]Note

The SQL query itself looks after the ordering of the output; the order by sadded desc retrieves the entries in the reverse order in which they were added - the database field sadded being the date the set was added to the database, and the desc (meaning descending) puts the biggest value first. In this case that is the most recent date...

Example 4.1. The Basic SetDisp Program

<?php
// setdisp - set display program
require_once "wacs.php";
require_once "DB.php";
$wacs = new Wacs;
$wacs->read_conf();
$wacs->check_auth( $_SERVER['REMOTE_ADDR'],1 );
// start the document
print "<html>\n";
print "<head>\n";
print "<title>SetDisp - List of Sets</title>\n";
print "</head>\n";
print "<body>\n";
// connect to the database
$dbienv = $wacs->conf_get_attr("database","dbienvvar");
if( ! empty( $dbienv ) )
{
        putenv($dbienv."=".$wacs->conf_get_attr("database","dbienvvalue"));
}
$dbhandle = DB::connect( $wacs->conf_get_attr("database","phpdbconnect"));
if( DB::iserror($dbhandle) )
{
        die("Can't connect to database\nReason:".$dbhandle->getMessage()."\n");
}
$dbhandle->setFetchMode(DB_FETCHMODE_ORDERED);
//                0      1       2      3         4        5
$query = "select setno, stitle, stype, scatflag, simages, scodec ".
         "from ".$wacs->conf_get_attr("tables","sets")." ".
         "where stype = 'I' and scatflag = 'T' ".
         "order by sadded desc ";
$cursor = $dbhandle->query( $query );
print "<table>\n";
$setcount=0;
while( (($results = $cursor->fetchRow()) &&
        ($setcount < 25 )) )
{
        // start the row
        print "<tr><td align=center>\n";
        // create the link
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsindex/page".$results[0].".html\">";
        // print out the set name
        print "<font size=-2 face=\"arial,helv,helvetica,sans\">";
        print $results[1]."</font></a>\n";
        // end the row
        print "</td></tr>\n";
        $setcount++;
}
print "</table>\n";
print "</body>\n";
print "</html>\n";
?>

and implementing the same code in perl gives us:

#!/usr/bin/perl 
# setdisp - set display program
use Wacs; 
use DBI;
read_conf();
check_auth( $ENV{'REMOTE_ADDR'},1 );
# output the HTML headers
print "Content-Type: text/html\n";
print "\n";
print "<html>\n";
print "<head>\n";
print "<title>SetDisp - List of Sets</title>\n";
print "</head>\n";
print "<body>\n";
# connect to the database
$dbienv = conf_get_attr("database","dbienvvar");
if( $dbienv ne "" )
{
        $ENV{$dbienv}= conf_get_attr( "database","dbienvvalue" );
}
$dbhandle=DBI->connect( conf_get_attr("database","dbiconnect"),
                        conf_get_attr("database","dbuser"),
                        conf_get_attr("database","dbpass") ) ||
die("Can't connect to database\nReason given was $DBI::errstr\n");
#                 0      1       2      3         4        5
$query = "select setno, stitle, stype, scatflag, simages, scodec ".
         "from ".conf_get_attr("tables","sets")." ".
         "where stype = 'I' and scatflag = 'T' ".
         "order by sadded desc ";
$cursor = $dbhandle->prepare( $query );
$cursor->execute;
print "<table>\n";
$setcount=0;
while( (($results = $cursor->fetchrow_array ) &&
        ($setcount < 25 )) )
{
        # start the row
        print "<tr><td align=center>\n";
        # create the link
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsindex/page".$results[0].".html\">";
        # print out the set name
        print "<font size=-2 face=\"arial,helv,helvetica,sans\">";
        print $results[1]."</font></a>\n";
        # end the row
        print "</td></tr>\n";
        $setcount++;
}
print "</table>\n";
print "</body>\n";
print "</html>\n";

When we run this set against our demonstration web server, we get the following output which is a list of the sets containing dildo use in most-recent first order.

Adding Icons

While it works and is usable, it's not exactly the greatest web page ever, so let's try and brighten it up a little. It'd be quite nice to be able to include an icon, and of course wacs has the infrastructure to do this for us. In fact, it offers us three different options of what size of icons we'd like: set, std and mini. In this case since we're trying to get a fair number of entries shown, we'll opt for the mini version. We get this by calling the wacsimg command and specifying that we'd like the mini version.

To make this happen we need to add another cell to the table with the HTML img tag pointing at wacsimg. As before we'll specify both align and valign properties for this table cell. So if we modify the code, much as we did before for the model icons, we get the following in php:

Example 4.2. Adding A Set Icon

        // start the row
        print "<tr><td valign=top align=center>\n";
        // create the link for the icon
        print "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsindex/page".$results[0].".html\">";
        // add the icon itself
        print "<img src=\"".$wacs->conf_get_attr("server","cgiurl");
        print "wacsimg/mini".$results[0].".jpg\" alt=\"[icon for ";
        print $results[0]."]\">";
        // end cell, next cell
        print "</td><td align=center>\n";
        // create the link

and of course the same example in perl looks like:

        # start the row
        print "<tr><td valign=top align=center>\n";
        # create the link for the icon
        print "<a href=\"".conf_get_attr("server","cgiurl");
        print "wacsindex/page".$results[0].".html\">";
        # add the icon itself
        print "<img src=\"".conf_get_attr("server","cgiurl");
        print "wacsimg/mini".$results[0].".jpg\" alt=\"[icon for ";
        print $results[0]."]\">";
        # end cell, next cell
        print "</td><td align=center>\n";
        # create the link

and if we run the resulting program, we get something like this:

Making The Text More Readable

One of the design decisions taken when designing WACS was to encourage directory names to be the same as the set names, and to make those more usable outside of the WACS system, to make them not include spaces. Instead the so-called Camel Technique, so named because of all the humps in it, where an upper case letter signifies the start of each new word. This is used along with a technique where underscores (_) act as the transitions between the three sections of the set name: these are:

  1. Model or Models name(s)

  2. Her Clothing

  3. Location and Action

However the underscore aspect is only used in the directory name and not in the set title (field stitle) as stored in the database which has spaces instead. Amongst our tasks, we will need to replace the spaces with the appropriate HTML table tags.

Fortunately we can use a regular expression to convert the Camel-Style text back into something a little bit more readable. This next group of changes to the code are to do exactly that. We're going to take a slightly different approach from before as we're not going to make the split off parts into seperate HTML table cells. This is because that makes both the font setting and HTML link creation much more complex - we're merely going to insert a forced line break <br> tag into the places where we want a new line to start. Then we're going to break up the Camel-Style text into seperate words. We do this with:

Our first substitution is going to be to replace the spaces (the section dividers in the stitle field) with the appropriate HTML directives. The second and third ones actually break up the words at the points the case changes:

Example 4.3. Making Camel-Style Text Readable

        // print out the set name
        print "<font size=-2 face=\"arial,helv,helvetica,sans\">";
        $prettytext = $results[1];
        $prettytext = preg_replace('/\s/','<br>', $prettytext );
        $prettytext = preg_replace('/(\w)([A-Z][a-z])/','$1 $2', $prettytext );
        $prettytext = preg_replace('/([a-z])([A-Z])','$1 $2', $prettytext );
        print $prettytext."</font></a>\n";
        // end the row

To implement the same functionality in perl actually uses exactly the same regular expressions (aka regexp) but looks very different as it's all done in assignment operations without any explicit function call. There's no preg_replace used here. Anyway here is exactly the same functionality in perl:

        # print out the set name
        print "<font size=-2 face=\"arial,helv,helvetica,sans\">";
        $prettytext = $results[1];
        $prettytext =~ s/\s/<br>/g;
        $prettytext =~ s,(\w)([A-Z][a-z]),$1 $2,g;
        $prettytext =~ s,([a-z])([A-Z]),$1 $2,g;
        print $prettytext."</font></a>\n";
        # end the row

With these changes in place, we can once again copy over the code and we have a much more presentable output from the program; here's an example:

Hopefully with this we've got the output presentation of the sets list looking a whole lot better than it was in the first example. There are of course many more fields within the set database that we could also make use of in our pages. We will return to them when we look at the WACS User Interface Toolkit in Chapter 5, The User Interface Toolkit. For now, before we finish our look at sets, we're just going to look at how we find the model or models featured in a given set.

Connecting Sets And Models

Understanding The Data Architecture

One of the things that often confuses people about true relational databases is that they are unable to do a one-to-many or many-to-many relationship directly. While many so called easy-to-use databases do offer field types that purport to offer such linking, they are problematic and do not fit into any sensible logical model for how things should be structured. Worse, each vendor's implementation (those who do implement it at all) is different and incompatible. However with a sensible schema design, this limitation really isn't a problem at all.

One such instance of this need to link one-to-many is the concept of linking a set with a model within WACS. In the easy case, you'd have thought that you'd simply put the model number into one of the fields in the set schema and the job would be done. But what do you then do when you have two models featuring in a set; easy you might say - one is the main model, the other is a secondary model, so just add a second field for the additional model and put the second number there. Of course that then makes the SQL query more complex each time as you've got to check both fields before you know if a model is in a set or not. It still might work, but it's already getting cumbersome. You might discover a set first by virtue of the additional model and only afterwards identify the official primary model.

Just about every adult site we've encountered does feature at least a few sets with three models, so suddenly we're looking at a second additional model field and having to check that as well. And believe me, there are a few sites of which Sapphic Erotica comes to mind in particular where sets with three, four, five or even six models in a single set are relatively common. Simply put, adding models to the sets table just doesn't scale. So we take the proper relational database approach and add an additional schema called assoc for associations which gives us these relationships. It's a very simple schema, basically containing a primary key, a model number and a set number.

Using Relationships With Assoc

The process of finding out who is in a set becomes very simple and straight forward - you simply search the assoc table for the set number you're looking at. If we're looking for who is in set no 123, we simply use the following SQL query:

select amodelno from assoc
where asetno = 123

We then merely loop through the results of the above query and each record we find is another model involved in this set. If we don't get any results returned, then there aren't any models associated with this particular set. Of course we probably want more than just the model number(s), but that too is relatively simple. Consider the following query:

select modelno, mname, mimage, mbigimage
from models, assoc
where modelno = amodelno
  and asetno = 123

This query simply retrieves the model details for each model who is involved with this particular set, one record at a time. Due to the way relational databases are engineered, this is actually a very quick and efficent process. The first line of the where clause does what is known as a relational join and establishes the necessary connection between the assoc and models tables necessary for what we're trying to do. Additionally it's a very logical and elegant solution that will cope with none, one, two, three, four or as many models as you like within a single simple action.

[Note]Note

Although we make use of the assoc table, we don't actually use any results from it - we don't need to - it has silently taken care of handling the connection we needed to make.

An Example Using Assoc

If we go back to our example program displaying sets, we can modify it to include this activity as a sub-routine. What we're going to do is to divide the right hand side of the output into the two cells, one with the title, and the other with the model(s) featuring in the set. The icon will remain on the left. First step is to add the rowspan attribute to the left hand side cell so the icon spans it.

Example 4.4. Modified Icon Cell

        // start the row
        print "<tr><td rowspan=2 valign=top align=center>\n";
        // create the link for the icon

and in perl, it'll look very similar:

        # start the row
        print "<tr><td rowspan=2 valign=top align=center>\n";
        # create the link for the icon

The next step is to create a new function to handle the query to look up the entries in the assoc table. We're going to call this function simply getmodel and it'll take just one argument, the set number for which we want the model(s) details. It will return to us a potentially quite long string variable containing all the model names that matched surrounded by a link to each model's WACS model page.

[Note]Note

So long as we use a different cursor variable to the database routines we can quite happily run another query and loop through it's results while inside an outer loop looking at the results of a completely different query. This is where the whole concept of a cursor becomes really useful.

Example 4.5. getmodel Subroutine

function getmodel ( $setno ) {
        global $dbhandle;
        global $wacs;
        $gmresult='';
        //                   0        1      2       3
        $modelquery="select modelno, mname, mimage, mbigimage ".
                    "from ".$wacs->conf_get_attr("tables","models").
                    ", ".$wacs->conf_get_attr("tables","assoc")." ".
                    "where modelno = amodelno ".
                    "  and asetno = ".$setno." ".
                    "order by mname ";
        $modelcursor=$dbhandle->query( $modelquery );
        // loop through the results
        while( $modelresults = $modelcursor->fetchRow() )
        {
                // do we need a divider?
                if( ! empty( $gmresult ))
                {
                        $gmresult.="<br>";
                }
                // add the model link
                $gmresult.="<a href=\"".$wacs->conf_get_attr(
                                "server","cgiurl")."wacsmpthumbs/".
                                $modelresults[0]."\">";
                // add her name and close link
                $gmresult.=$modelresults[1]."</a>";
        }
        // return the complete string
        return( $gmresult );
}

and the same code implemented in perl looks like this:

sub getmodel( $ )
{
        my( $setno )=@_;
        my( $gmresult, $modelquery, $modelcursor, @modelresults );
        $gmresult='';
        #
        $modelquery="select modelno, mname, mimage, mbigimage ".
                    "from ".conf_get_attr("tables","models").
                    ", ".conf_get_attr("tables","assoc")." ".
                    "where modelno = amodelno ".
                    "  and asetno = ".$setno." ".
                    "order by mname ";
        $modelcursor=$dbhandle->prepare( $modelquery );
        $modelcursor->execute;
        # loop through the results
        while( @modelresults = $modelcursor->fetchrow_array )
        {
                # do we need a divider
                if( $gmresult ne "" )
                {
                        $gmresult.="<br>";
                }
                # add the model link
                $gmresult.="<a href=\"".conf_get_attr("server","cgiurl").
                        "wacsmpthumbs/".$modelresults[0]."\">";
                # add her name and close link
                $gmresult.=$modelresults[1]."</a>";
        }
        # return the complete string
        return( $gmresult );
}

The final step of this process is to add into our main loop going through the retrieved set records a call to the getmodel function. This looks like:

Example 4.6. Calling The getmodel Function

        // next right hand cell
        print "<tr><td align=center><font size=-1>\n";
        print getmodel( $results[0] );
        print "</font></td></tr>\n";
        // increment set count 

and in perl this looks like

        # next right hand cell
        print "<tr><td align=center><font size=-1>\n";
        print getmodel( $results[0] );
        print "</font></td></tr>\n";
        # increment set count 

With these changes incorporated into the code, we now have the finished version of the setdisp program (setdisp4.php or setdisp4 in the samples directory. If we now copy this script up to the web server and run it, we should see something like this:

Once again we've gradually developed a program up to the point where it is now offering quite reasonable functionality and layout making use of the WACS programmers toolkit API. Hopefully this has given you an insight into what WACS is capable of and the basics of how to make use of it's API. In due course, we hope to have a respository of WACS skins, or mini-site scripts, which you can download and tailor to your own needs. If in the course of learning the WACS API you write some programs you'd be happy to share with others, please send them to us and we'll include them in the respository.

Chapter 5. The User Interface Toolkit

Introducing WacsUI

In this chapter, we're going to take a slightly different tack, we're going to just look at code segments you could choose to include within your application, primarily user interface components taken from the User Interface toolkit, WacsUI. This is not going to be an exhaustive review of what is available as that is covered in detail in the reference section, Chapter 7, WACS API: User Interface Module. Instead this is just a quick taster of just a few of the calls provided by the WacsUI toolkit.

So far we've been dealing with the various routines that are provided by the Core Wacs module - and these relate primarily to configuration parameters and security. There is a second module available for you to use called WacsUI, the WACS User Interface Toolkit. This concerns itself primarily with providing utility functions to ease the tasks of formatting and preparing data from the database into a form more suitable for use in web pages.

Including WacsUI support

To include support for the WACS User Interface (WacsUI) toolkit within your application, you need to add the following extra lines to your code, ideally just after the Wacs core module.

Example 5.1. WacsUI initialisation

require_once "wacsui.php";

$wacsui = new WacsUI;

and here's the perl dialect of the same activity...

use WacsUI;

WacsUI: DescribeHer

Example 5.2. Using WacsUI: describeher

print $wacsui->describeher( 
       array( 'hair'=>$results[4],
         'length'=>>results[5],
         'titsize'=>>results[6],
         'pussy'=>>results[7],
         'race'=>>results[8],
         'build'=>>results[9],
         'height'=>>results[10],
         'weight'=>>results[11],
         'occupation'=>>results[12]))."\n";

[Note]Note

We have to package up our parameter list as an array in order to pass it in Php; perl is somewhat simpler with a simple sequence of named parameters.

print describeher(
        hair=>$results[4],
        length=>$results[5],
        titsize=>$results[6],
        pussy=>$results[7],
        race=>$results[8],
        build=>$results[9],
        height=>$results[10],
        weight=>$results[11],
        occupation=>$results[12] )."\n";

The above example is based upon modifying the MySimple example program from in the second chapter to add the following extra fields into the query: mhair, mlength, mtitsize, mpussy, mrace, mbuild, mheight, mweight, moccupation after the mimage (with a comma of course) and before the from clause.

The addkeyicons function

Both the models and sets schemas feature fields that contain a space seperated list of keywords that mark certain attributes found within that set. These can be quickly turned into a small HTML table of icons using the routine addkeyicons. The fields suitable for use with this are scatinfo from the sets table and mattributes from the models table. These are passed as the first attribute; the second being the displayed size of the icons which for the default icons would be a maximum of 48 x 48 pixels. The function is called simply with:

Example 5.3. Using AddKeyIcons

	addkeyicons( $results[16], 24 );

WacsUI: Other Functions

Another example of using the wacsui module can be found in the newsets.php application in the samples directory. This is a more "real world" worked example showing a new releases index page; it makes use of both the iconlink and addkeyicons functions.

Detailed documentation on each call available and how it works can be found in the API reference section Chapter 7, WACS API: User Interface Module.

Conclusions

We've now come to the end of the basic WACS API tutorial, at least for this edition of the WACS Programmers Guide. It is our intention to expand this section in future editions. Still, it has hopefully introduced you to the key concepts in making use of the WACS Programming API and given you some useful simple programs to build on when creating your own applications. The rest of this book consists of the WACS API reference manual and the WACS Database Schema Reference. If these do not provide sufficient information, please contact us via the methods listed on the WACS web site at SourceForge .

Part II. WACS API Programming Reference

This is the API (Application Programming Interface) reference manual for the WACS environment. It documents the main API calls in both Perl and PHP dialects. There are now six operational modules available as part of the WACS system, plus a utility module used by the installers.

Table 1. The Key WACS Modules

WACS Module List
namepart ofdescription
Wacs.pmCorethe main Wacs module
WacsUI.pmCorethe Wacs User Interface module
WacsStd.pmCorethe Wacs Standardised Components module
WacsID.pmCorethe Wacs Identification module
wacs.phpwacs-phpthe main Wacs module, Php dialect
wacsui.phpwacs-phpthe Wacs user interface module, Php dialect

Chapter 6. WACS API: Core Module

Core Module: Summary

Table 6.1. Function Summary: Core Module

functiondescription
read_conflocate and read the XML based configuration file
check_authcheck that this is an authorised access
auth_errorreport an authentication error and suggest remedies
auth_userreturn the registered username for this IP
add_authadd a new authentication token to access control system
find_config_locationtry to locate the specified XML config file
conf_get_attrget the requested configuration attribute
auth_get_attrget the requested access control list attribute
gettodayget today's date as a string suitable for the current DB
timecompsbreak a date down into component parts
vendlinkprovide a link to the vendors site
getvaluenametakes a single character flag and converts to string
geticonlistgets the icon array for the specified object type
gettypecolourget the prevailing colour scheme for the set type
divideupmake a directory name more readable
alsofeaturingfind and list any other models featured in this set
checkexcludecheck for this file name being one to ignore/hide
checkindexcheck for what might be an index file
addheadercssadd standard preamble to enable javascript menus
setgrouppermsset the appropriate group permissions for co-operative updating

Core Module: Reference

Core Module: Reference

The following pages contain the *nix style reference pages for each function call in the WACS core module. These detail what the function does, what parameters it takes, what it returns and which versions of the core library it is available in.

Name

read_conf — read Wacs core config modules

Synopsis

use Wacs;
read_conf(

Summary

The read_conf causes the standard WACS XML configuration file, wacs.cfg to be parsed and the contents read into internal memory structures in the WACS module for later use by other WACS routines. The main interface to accessing this information is the call conf_get_attr.

read_conf is sensitive to the environment variable WACS_CONFIG which specifies a directory containing an alternative wacs.cfg configuration file.

Availability

read_conf is available in both perl and php.


Name

check_auth — check if this IP address is authorised for access

Synopsis

use Wacs;
check_auth(ip_address,  
 vocal_error); 
scalar  ip_address;
scalar  vocal_error;

Summary

check_auth checks whether the passed IP address is authorised for access to this Wacs server at this time. This authorisation may be by either permanent or lease permission based upon the calling IP address. This IP address is specified by the first parameter to the function. The second parameter controls what will be done about it: if the value is 0 (zero), the call will merely terminate the session by exiting the program; if the value is 1 (one), an authorisation error HTML page will be displayed offering the user the option to log in. In the Perl version, an additional option of 2 (two) is available which outputs a failure icon in the case of an expired lease and a request for an image file - this is not possible in PHP as the content type of text/html has already been determined.

Availability

check_auth is available in both perl and php.


Name

auth_error — create a reasonable HTML error page with reason and link to remedy

Synopsis

use Wacs;
auth_error(message); 
scalar  message;

Summary

auth_error creates a reasonable HTML error page with reason and link to remedy if applicable (ie login page). The message parameter will be placed in a bordered box near the bottom of the message and can be used to convey additional information. check_auth sets this to Sorry, your lease has expired. when that is the case.

Availability

auth_error is available in both perl and php.


Name

auth_user — return the account name of the user associated with IP address

Synopsis

use Wacs;
scalar auth_user(ip_address); 
scalar  ip_address;

Summary

auth_user returns the account name of the user associated with the specified IP address.

Availability

auth_user is available in both perl and php.


Name

add_auth — add a new authentication token to the access control list

Synopsis

use Wacs;
add_auth(...); 

Parameters

parameterdescription
ipaddrThe IP Address of the host being authorised.
useraccount name of the user being registered
typetype of registration being undertaken - currently lease
roleleval of access granted currently: viewer, power or admin
datedate at which this lease should expire
prefexclpreference exclusions: the scatflag values not to be shown by default
usedirectwhether to use the usedirect function if supported by the server - can be yes or no
imagepagewhether to create links to framed page or raw ones - should be frame or raw
scalingwhen to use image scaling - can be none, slide, slide+page and all
sizesize of scaled images when applicable in the format 1024x768
qualityjpeg quality setting used when scaling images
delaydesired delay before next image in slideshow

Summary

add_auth adds a new authentication token to the access control list, ie the leases file. This is the action taken by the wacslogin command after it has authenticated the user. It can also be used to update the user preferences - it is used by wacslogin, wacspref and wacslogout.

Availability

add_auth is currently available only in perl. A php implementation is possible in a future release if required.


Name

find_config_location — return the location of the requested config file

Synopsis

use Wacs;
scalar find_config_location(configuration_filename); 
scalar  configuration_filename;

Summary

find_config_location returns the location of the requested config file. It first checks the directory specified by the WACS_CONFIG environment variable, and then tries the built-in list of possible WACS configuration file locations. This list is normally: /etc/wacs.d, then /usr/local/etc/wacs.d and finally /opt/wacs/etc/wacs.d . If the specified file is not found in any of these locations, a null string is returned.

[Note]Note

The location specified by the environment variable WACS_CONFIG takes precidence, if and only if the requested file is present there. The normal directories are searched afterwards if the file is not found in the directory specified.

Availability

find_config_location is available in both perl and php.


Name

conf_get_attr — get the specified attribute from the config file values

Synopsis

use Wacs;
scalar conf_get_attr(configuration_section,  
 configuration_attribute); 
scalar  configuration_section;
scalar  configuration_attribute;

Summary

conf_get_attr returns the specified attribute from the config file or it's default value if not specified there. The WACS configuration files are divided into a number of logical sections; the first parameter specifies which of these is required: amongst those defined are database, tables, fsloc, server, security, download, colours, layout, precedence and debug. Please see the WACS configuration guide and sample wacs.cfg files for more information on what information is available.

Availability

conf_get_attr is available in both perl and php.


Name

auth_get_attr — get the specified attribute from the authorisation file values

Synopsis

use Wacs;
scalar auth_get_attr(ip_address,  
 authorisation_attribute); 
scalar  ip_address;
scalar  authorisation_attribute;

Summary

auth_get_attr returns the specified attribute from the authorisation file or it's default value if not specified there. These look ups are based on the IP address of the host - typical attributes include the user name, the preference exclusions, the role, and the various preference settings - see add_auth for more info.

Availability

auth_get_attr is available in both perl and php.


Name

gettoday — get todays date and various relations thereof

Synopsis

use Wacs;
scalar gettoday(...); 

Parameters

parameterdescription
formatwhich format to return date in (DD-MON-YYYYY or YYYY-MM-DD) - default is native format for the current database
epochthe actual date to convert in Unix seconds since 1970 format.
offsetnumber of days different from today - assumed to be historial if postive, future if negative - thus yesterday will be 1, a week ago will be 7, tomorrow will be -1.

Summary

The gettoday function returns either todays date or various deviations thereform - yesterday, a week ago, two weeks ago, etc.

Availability

gettoday is available in both perl and php.


Name

timecomps — return seperated time components

Synopsis

use Wacs;
array timecomps(date_in_db_format,  
scalar  date_in_db_format;

Summary

The timecomps breaks a database format date up into year, month and day components. The optional format parameter can specify a non-native date format for conversion purposes.

Availability

timecomps is available in both perl and php.


Name

vendlink — provide (if possible) a link to the vendor's site for this model

Synopsis

use Wacs;
scalar vendlink(...); 

Parameters

parameterdescription
vendorthe vendor's reference (ie their vsite id)
pagewhich page to get: valid options are directory, modelpage, bio, vidindex, vidpage, imgpage, altpage, or signup .
namethe model's name
keythe model's key for this site
altkeythe model's alternative key for this site
setkeythe setkey if this request needs it (depends on the value of page above
sessionkeythe session key (if required and known).
modelnothe WACS model number for this request (believe me we occasionally need this)
setnothe WACS set number for this request (see above - this too)
dbhandlecurrent handle to the database connection

Summary

The vendlink provides (if possible) a link to a page on the vendor's site for this model or set. Specify the page you require using the page parameter - can link to any one of the many pages the vendor database knows about.

Availability

vendlink is available in only in perl at present. If you need it in PHP, please put in a request for it on the sourceforge tracker.


Name

getvaluename — provide the long name for the specified value of specified type

Synopsis

use Wacs;
scalar getvaluename(...); 

Parameters

parameterdescription
objectThe object you want the mapping for - see geticonlist below
valueThe value you want mapped to it's long format (often a single character.

Summary

The getvaluename function returns the long (readable) name for the specified short value of specified fixed values attribute type. For instance, if you want to get the long name for type "M", you call getvaluename with object=>"types" and value=>M and getvaluename will return Masturbation.

Availability

getvaluename is available in both perl and php.


Name

geticonlist — return the array of attributes to filename/long name mappings.

Synopsis

use Wacs;
hashref geticonlist(requested_object); 
scalar  requested_object;

Summary

The geticonlist function returns an array/ hashref of the legal values for the requested type object. In some cases this will be the filenames of the icon for the attributes; in other cases it'll be the single character legal values and their long form names. Valid requests include: models, sets, types, media, dstatus, regions, flags and pussy.

Availability

geticonlist is available in both perl and php.


Name

gettypecolour — return the background colour for this type of set

Synopsis

use Wacs;
scalar gettypecolour(set_type); 
scalar  set_type;

Summary

The gettypecolour returns the HTML colour specification for the background of the current set type. Pass it the set stype value I, V, etc.

Availability

gettypecolour is available in both perl and php.


Name

divideup — make Camel-style text more readable and add HTML markup

Synopsis

use Wacs;
scalar divideup(original_text,  
 divider,  
 already_small_font); 
scalar  original_text;
scalar  divider;
scalar  already_small_font;

Summary

The divideup function returns a more readable version of the so-called Camel Style wording used in creating WACS directories. It also embeds HTML directives to try and ensure that even long entries don't take up too much space. The first argument is the original text (typically the field stitle from the sets database), the second (divider) is typically the HTML break tag <br> but could be other things like a table divider sequence </td><td> . The third parameter signifies whether the font in use is already small - if set to 0 (zero), HTML tags to reduce the font size be based on using size is -1 for long lines; if it's set to 1 (one) it'll be assumed they were already using size is -2, and will therefore use size = -3.

Availability

divideup is available in both perl and php.


Name

alsofeaturing — look for any other models also featuring in this set

Synopsis

use Wacs;
scalar alsofeaturing(...); 

Parameters

parameterdescription
setnoThe set number of this set
primaryThe model number we already know about for this set; exclude this model from the results. Leave blank if you want all models listed.
staysmallstay in a small font - if this is set to Y font change specifications will not cause a size change.
linktowhich wacs application to link to (assumed to be in cgi-bin)
dbhandlecurrent handle to the database connection

Summary

The alsofeaturing function returns a list of models featured in this set along with links to an appropriate WACS application.

Availability

alsofeaturing is currently available only in perl. It is likely to be moved to WacsUI and also be implemented in php in the near future.


Name

checkexclude — test for being a directory file or other reserved purpose name

Synopsis

use Wacs;
scalar checkexclude(filename); 
scalar  filename;

Summary

The checkexclude returns 1 if the file is one of those that should be excluded from consideration (ie . or .. or one of ours like .info or .unpack). If the file looks genuine, returns 0.

Availability

checkexclude is available only in perl as it is just used for collection management tasks.


Name

checkindex — try to guess if this is an index image file

Synopsis

use Wacs;
scalar checkindex(filename); 
scalar  filename;

Summary

The checkindex tries to guess if a given file name is likely to be an index file or a regular image file based upon it's name. If it's a name associated with index files, it returns 1; if it isn't checkindex returns 0.

Availability

checkindex is available in only perl as it is really only appropriate to collection management tools.


Name

addheadercss — prints out the header cascading style sheet preamble

Synopsis

use Wacs;
addheadercss(css_preamble_type); 
scalar  css_preamble_type;

Summary

The addheadercss prints out the required css preamble to support the appropriate pull down menu system. At present only one type, "csshoriz" is recognised, but additional options can be added.

Availability

addheadercss is available in both perl and php.


Name

setgroupperms — set group permissions to allow both command line and web management of sets.

Synopsis

use Wacs;
setgroupperms(...); 

Parameters

parameterdescription
targetpathname of the file or directory to update
groupthe unix group to set permissions to (usually wacs, can be obtained with conf_get_attr on security -> admingroup.
modeaccess mode that should be set - typically ug+rwX.

Summary

The setgroupperms function sets the group permissions on the specified file to allow updating by both command line tools and the web interface. This is typically done by making all files group-writeable to the wacs group of which both apache and the approved WACS administrative users should be members.

Availability

setgroupperms is available only in perl as it is used only for collection management tasks.

Chapter 7. WACS API: User Interface Module

User Interface Module: Summary

Table 7.1. Function Summary: User Interface Module

functiondescription
describehertries to make a sensible sentance out of model data
whatshedoesdescribes the kind of sets this model appears in
addkeyiconsmakes a little HTML table with the attribute icons
iconlinkbuild a link around the icon for this set
addlinksadd standard top-of-the-page menus
read_menuread the XML menu files and create menu record structure
menu_get_defaultget the default link for the menu title
menu_get_titleget the menu title itself
menu_get_bodyget the body of the menu
menu_get_entryget a single entry from the menu

User Interface Module: Reference

Name

describeher — tries to make a sensible sentance out of model data

Synopsis

use Wacs;
use WacsUI;
scalar describeher(...); 

Parameters

parameterdescription
hairThe colour of her hair
lengthThe length of her hair
titsizeThe size of her breasts
cupsizeThe cupsize of her breasts if known
pussyThe usual style of her pubic hair
raceHer race (in broad terms)
eyesThe colour of her eyes
distmarksdistingishing marks - easy ways to recognise her
buildher phyiscal build/body type
heighther height in centimetres (NB: field not suitable for imperial values)
weighther weight in kilograms (NB: field not suitable for imperial values)
vitbusther bust measurement in centimetres
vitwaisther waist measurement in centimetres
vithipsher hips measurement in centimetres
occupationher occupation (if stated)

Summary

The describeher tries to make a readable biography entry out of the various model attribute parameters in the model table. The result is returned as a string.

Availability

describeher is available in both perl and php.


Name

whatshedoes — describes the kind of sets this model appears in

Synopsis

use Wacs;
use WacsUI;
scalar whatshedoes(...); 

Parameters

parameterdescription
solodoes she feature in solo sets (Y, N)
straightdoes she feature in straight sets (Y, N)
lesbiandoes she feature in lesbian sets (Y, N)
fetishdoes she feature in any sets flagged as fetish
toysdoes she use toys in any of her sets
masturbationdoes she masturbate in any of her sets
otherdoes she do any activites marked as other

Summary

The whatshedoes function takes the truth values for doing certain kinds of activities and makes it into a descriptive sentence which is returned as a string.

Availability

whatshedoes is available in both perl and php.


Name

addkeyicons — makes a little HTML table with the attribute icons in

Synopsis

use Wacs;
use WacsUI;
addkeyicons(list_of_attribute_keywords,  
 icon_size); 
scalar  list_of_attribute_keywords;
scalar  icon_size;

Summary

The addkeyicons function takes a space seperated list of attribute keywords such as the sets table scatinfo field or the models table mattributes field and prints out the associated icons in a small HTML table. It scales the icons to the specified size in doing so.

Availability

addkeyicons is available in both perl and php.


Name

iconlink — build a link around the icon for this set

Synopsis

use Wacs;
use WacsUI;
iconlink(...); 

Parameters

parameterdescription
typeset type value (I, V, etc)
setnoThe set number
sareaThe toplevel area of the set
scategoryThe middle level area of the set
sdirectoryThe lower level area of the set
modelThe model's name - used in the alt tag in the images
resizeWhether to resize or not - 0 is actual size, 1 is rescaled to standard size, 2 is rescaled to mini size

Summary

The iconlink function displays the icon for a set at the requested size surrounded by an appropriate link to the set concerned.

Availability

iconlink is available in both perl and php.


Name

addlinks — add standard top-of-the-page menus

Synopsis

use Wacs;
use WacsUI;
addlinks(...); 

Parameters

parameterdescription
mynamename of the calling program
contextgeneral area of the current page: possible values are modelindex, models, search, tags, newimage or newvideo
titleTitle of the menu (not currently used)
excludename of link to exclude (normally this apps name so it doesn't link to itself
modemenu mode: either normal for old-style simple top line menu or csshoriz to use javascript pull down menus
optionsoptional parameter list (array)
optdescmatching descriptions for the above

Summary

The addlinks function is a generalised interface to adding a top of the page menu - you specify a general category into which the page you're writing falls, and it adds an appropriate selection of the standard menus.

Availability

addlinks is currently only available in perl. It is assumed php programmers will want more fine-grained control over their menus and so it has not been implemented.


Name

read_menu — read the XML menu files and create menu record structure

Synopsis

use Wacs;
use WacsUI;
read_menu(menu_filename); 
scalar  menu_filename;

Summary

The read_menu reads the specified menu XML file into the internal data structures of the wacsui object. It should be called before using any of the other menu routines. For the standard system menus, the collection management tools use the file menu.cfg in the wacs config directory (usually /etc/wacs.d). You can edit the standard menu file to add your own additional menu definitions for use in specific applications. If your application wishes to use an alternate namespace, you could specify an alternate menu config name, something like mysite.cfg and also place it in the wacs config directory.

Availability

read_menu is available in both perl and php.


Name

menu_get_default — get the default link for the menu title

Synopsis

use Wacs;
use WacsUI;
scalar menu_get_default(...); 

Parameters

parameterdescription
namethe menus name; typically in lower case (eg navigation )
callername of the calling application
excludeapplications to exclude from menus; typically the calling application itself
optionsan array of options to be substituted.
optdesca matching array of descriptions

Summary

The menu_get_default returns the default link for the top-of-the-page menu title before the menu pull-down is activated. Normal substitutions are applied to this option if specified.

Availability

menu_get_default is available in both perl and php.


Name

menu_get_title — get the menu title itself

Synopsis

use Wacs;
use WacsUI;
scalar menu_get_title(...); 

Parameters

parameterdescription
nameName of the menu whose title you want

Summary

The menu_get_title function returns the readable title for the specified menu. This is typically what the link address returned by menu_get_default will surround.

Availability

menu_get_title is available in both perl and php.


Name

menu_get_body — get the body of the menu

Synopsis

use Wacs;
use WacsUI;
scalar menu_get_body(...); 

Parameters

parameterdescription
namename of the menu concerned
callername of the program calling it
excludename of program to exclude from menus
optionsarray of options to use
optdescarray of matching descriptions for the options above
isareahashref/array of image-based sarea values
vsareahashref/array of video-based sarea values
mflagshashref/array of model flags
vsiteshashref/array of vendor codes and names
preprefix for generated entries (eg <li><a href=\" )
intramiddle section for generated entries (eg \">)
postpostfix for generated entries (eg </a></li> )

Summary

The menu_get_body function returns a big string containing the HTML formatted body of the requested menu. Using the pre, intra and post parameters you can include the correct entry pre-amble, mid-section and tail-section for your desired menu layout.

Availability

menu_get_body is available in both perl and php.


Name

menu_get_entry — get a single entry from the menu

Synopsis

use Wacs;
use WacsUI;
scalar menu_get_entry(...); 

Parameters

parameterdescription
namename of the menu concerned
callername of the program calling it
entryhashref/array of the current entry object from menu tree
optionsarray of options to use
optdescarray of matching descriptions for the options above
isareahashref/array of image-based sarea values
vsareahashref/array of video-based sarea values
mflagshashref/array of model flags
vsiteshashref/array of vendor codes and names
preprefix for generated entries (eg <li><a href=\" )
intramiddle section for generated entries (eg \">)
postpostfix for generated entries (eg </a></li> )

Summary

The menu_get_entry takes an individual menu entry (which may result in multiple menu entry lines) and processes it into a string that is returned. It is available seperately as it can be called with custom parameters via options and optdesc to do specific non-standard parameters.

Availability

menu_get_entry is available in both perl and php.

Chapter 8. WACS API: Standard Components Module

Standard Components Module: Summary

Table 8.1. Function Summary: Standard Components Module

functiondescription
mastheadcreates a top-of-the-page summary for any page handling set

Standard Components Module: Reference

The WacsStd module contains standard components for building the standard WACS collection management tool interface. Since all these tools are written in perl, this module is only implemented in perl.

Name

masthead — top of page banner for set-based apps

Synopsis

use WacsStd;
masthead(...); 

Parameters

paramterdescription
setnoThe set number
stypeThe set type (single letter database format)
scatinfoThe attributes for the set
scatflagThe set type flag (single letter database format)
stitleThe assigned set title, aka standard description
sofftitleThe official title (usually from original site)
sareaToplevel directory entry
scategoryMiddle level directory entry
sdirectorylowest level - actual holding directory (filename for videos)
simagesNumber of images in the set
sindexesNumber of index images for the set
saspectaspect ratio (mainly for videos)
sformatfile format for this set (.jpg, .png, .mov, .wmv etc)
sdurhrsvideo or DVD scene duration - hours value
sdurminvideo or DVD scene duration - minutes value
sdursecvideo or DVD scene duration - seconds valus
sphotogphotographer reference code (references pref in photographer)
sfoundryorganisation where the set came from
modelnoassociated model number
downloadnoassociated download record number
dbhandlethe current database handle object

Summary

masthead generates a standard top-of-the-page banner heading for any page that is intended to document or amend a standard set record. It does a best efforts with whatever fields it has passed to it.

Availability

masthead is only available in Perl.

Chapter 9. WACS API: Identification Module

Identification Module: Summary

[Warning]Warning

The existing identification module has many flaws and it is intended to massively overhaul it in the near future. We would not recommand utilising functions from this module at the present time. If you need a particular routine listed here, please contact us and we'll consider moving it to one of the more stable modules if appropriate

Table 9.1. Function Summary: Identification Module

functiondescription
ident_imgIdentify characteristics of an image set from download info
ident_vidIdentify characteristics of a video clip from download info
reset_attrreset the global attribute table
id_get_flagget previously determined flag (run ident_* first)
id_get_infoget previously determined catinfo (run ident_* first)
id_get_photogget previously determined photographer (run ident_* first)
id_get_dnldnoget download record number
id_get_modelnoget the model number
id_get_modelnameget the model's name
id_get_vendorget the vendor reference
id_get_dbhandleget the current DB handle
id_get_keyget the current models id at the current vendor
id_get_setkeyget the set key at the current vendor
id_get_setnameget the name of the most recent set
id_get_statusget the status of the most recent set
id_get_notesget the current value of the notes field
addassocAdd a new model/set association
dnld_imgretrieve a download record based upon the namestem
dnld_markdonemark the download as having been done
dnld_checkaddtake a download specification and if not existing, add it
dnld_updateupdate an attribute in the download record
vend_dnldreturn the download location for this vendor
alloc_nextkeyallocate the next free primary key for named table
find_cookiesfind the current web browser cookies file (firefox only)
vid_getsizeget the size of a video clip
removedupsclean up a catinfo string, removing duplicate entries
extractphotogfind the photographer name (only works on ATK at present)
find_namestemfind the common stem of a file name
id_mpageprocess a modelpage looking for links to suitable sets
chk_vid_typecheck to see if this url is a video file type

Part III. WACS Database Schema

This is the Database Schema Reference Manual, or data dictionary, for the WACS environment. This documents the database tables in use, their contents, structure, relationships and assigned values.

The WACS database schemas are built with the convention that the first letter of the schema name is prefixed to all fields within that schema. Thus a field from the sets schema will start with the letter s, a field from the assoc schema will start with the letter a and so on. Generally relationed fields will have fundamentally the same name, such that the set number is setno in the sets schema, asetno in the assoc schema, tsetno in the tags schema, dsetno in the download schema, and so on. This makes performing relational joins much easier and more portable since one can do the likes of where amodelno = modelno without any ambiguity and without having to specify the table name explicity.

Where possible fields with a limited set of possible values will be single character fields with a reasonably neumonic value for each possible value. Thus the media type (stype, dtype, etc) is V for Video Clip, I for Image Set, D for DVD scene, and so on. A lookup hash of the legal values will typically be available for programmers to use from the core Wacs module (see the Part II, “WACS API Programming Reference” for more details).

Chapter 10. Schema Reference: Sets

Sets: Schema SQL

create table sets
( setno                 number(9) primary key,
  stype                 char(1) not null,
  sstatus               char(1) not null,
  sauto                 char(1),
  srating               char(1),
  sflag                 char(1),
  stechqual             number(2),
  svariety              number(2),
  svisits               number(2),
  sformat               varchar2(10),
  scodec                varchar2(40),
  stitle                varchar2(240),
  sofftitle             varchar2(240),
  sofficon              varchar2(160),
  saddicon              varchar2(160),
  sname                 varchar2(80),
  shair                 varchar2(80),
  smodelno              varchar2(40),
  slocation             varchar2(20),
  slocdetail            varchar2(40),
  sphotog               varchar2(6) references photographer,
  ssource               varchar2(80),
  sfoundry              varchar2(80),
  sproddate             date,
  sreldate              date,
  suscattr              char(1),
  snotes                varchar2(240),
  sdesc                 varchar2(2048),
  sindexes              number(6),
  simages               number(6),
  sdurhrs               number(2),
  sdurmin               number(2),
  sdursec               number(2),
  slandx                number(6),
  slandy                number(6),
  sportx                number(6),
  sporty                number(6),
  saspect               varchar(10),
  sbytes                number(12),
  sdvdno                number(6),
  sdvddisc              number(2),
  sdvdtitle             number(3),
  sdvdstartch           number(3),
  sdvdendch             number(3),
  sidlogo               char(1),
  serrors               char(1),
  sduplicates           number(9),
  scatinfo              varchar2(160),
  scatflag              char(1),
  snamestem             varchar2(80),
  sdownload             varchar2(160),
  sarea                 varchar2(160),
  scategory             varchar2(160),
  sdirectory            varchar2(240),
  scomments             varchar2(240),
  sadded                date,
  samended              date
);

Sets: Defined Values

Table 10.1. stype: Type of Set: defined values

stype
IImage Set
VVideo Clip
AAudio File
SDVD Scene

Table 10.2. sstatus: Status of Set: defined values

sstatus
MManually Added, Details Not Checked
AAutomatically Added, Details Not Checked
NNormal - Checked
GGood - Thoroughly Checked
UUnknown

Table 10.3. sauto: Automatic Update of Set Allowed?: defined values

sauto
NNone (no auto updates)
L(on-disk) Location only - all attributes manual
AAppend only - all existing entries stay
FFully auto-generated - all values can change

Table 10.4. srating: Overall Rating For The Set: defined values

srating
5Finest
4Very Good
3Good
2Reasonable
1Mediocre
0None Specified

Table 10.5. stechqual: Technical Quality Rating For The Set: defined values

srating
5Finest - HD Video done well, Multi-megapixel stills
4Very Good - Well lit SD or good HD Video, good megapixel + stills
3Good - Well done low-res SD, good sub-megapixel stills; not quite so good but higher res
2Reasonable - either very small, or bad equipment (flash on camera) used moderately well
1Mediocre - lack of skill, bad equipment, poor composition
0None Specified

Table 10.6. svariety: Unusualness Rating For The Set: defined values

svariety
5Very Unusual - look at the set scenario and think "What the F***!"
4Unusual - unusual and very interesting - "Wow"
3Neat - interesting and impressive but not quite "Wow"
2Cute Twist - a slightly unusual twist, unusual pose etc
1Ordinary - can still score very highly in overall and tech
0None Specified

Table 10.7. sformat: Format of the File(s) In The Set: defined values

sformat
JPEGJPEG image
GIFGIF image
PNGPNG image
PNMPNM,PBM,PGM,PPM image
WMVWindows Media Player Video
AVIAVI Video (codec specified separately)
QTQuickTime .mov Video (codec specified separately)
MPEGMPEG Video (MPEG-1 or 2)

Table 10.8. sidlogo: Presence of Burnt-in Logo: defined values

sidlogo
UUnknown
YYes - image/video has burnt-in logo
NNo - image/video is clean of bugs

Table 10.9. serrors: Presence of Known Errors: defined values

serrors
NNone detected
FFixed - faulty images/video have been fixed - Quality may have been compromised - sizes/signatures no indicative of original
EEncoding Only - causes message but renders OK
CSome Corrupt Images/Segments of video

Table 10.10. scatflag: Generalised type of the set: defined values

scatflag
FFuck - straight sex
LLesbian - lesbian sex
GGroup - more than two people having sex, mixed-gender
TToy - Solo but uses toys such as dildo, vibrator, etc
SSolo - Model on her own (possibly with a non-participatory audience)
MMasturbation - Solo but includes masturbation activities
NNone - not determined yet
BBackstage - Behind The Scenes set featuring this model
CClothed - non-nude set featuring this model
DDuplicate - duplicate set - maybe from a different site

Table 10.11. slocation: generalised description of locations: recommended values

slocation (recommended values)
[Note]Note

This is a Recommended Values list only; additional values can be added as appropriate

BalconyBalcony or Terrace; outdoors but not part of Garden
BathroomBathroom, Toilet or Shower Cubicle
BedroomBedroom or other sleeping area
CountryCountry - including Beach, Forest, and Fields
Dining RoomDining Room or Eating Area
GardenGarden or other private outdoor area
HallwayHallway, Staircase or Entrance
KitchenKitchen or Kitchen area of apartment
LaundryLaundry, Cleaning or Utility Area
LoungeLounge, Sitting Room or Other Seating Area
OfficeOffice, including Home PC desk
Other RoomAny other room - (Domestic) Library, Junk Room, Garage, etc
SpecialisedSpecialised Location: Swimming Pool, Shop, Recording or TV Studio, Factory, Railway Station, etc; additional details can be placed in slocdetail.
SportsLocation associated with Sports and Exercise: Gym, Locker Room, etc.
StudioWhite or other plain background Photographic Studio - but NOT Television or Audio recording studios as a feature of the set theme

Table 10.12. suscattr: how to generate the 18 USC 2257 declaration: defined values

suscattr
VVendor based - use vendor's USC declaration address
PPhotographer based - use photographer's address for USC declaration
NSuppress declaration - NOT RECOMMENDED FOR US RESIDENTS
GGeneric - include generic text with all vendor addresses

Chapter 11. Schema Reference: Assoc

Assoc: Schema SQL

create table assoc 
( assocno                       number(9) primary key,
  amodelno                      number(6) references models,
  asetno                        number(9) references sets,
  astatus                       char(1),
  aadded                        date,
  aamended                      date
);

Assoc: Defined Values

Table 11.1. astatus: association status: defined values

astatus
MManually Added
GGenerated Automatically
RRelationship entry - not the primary model for this set.

Chapter 12. Schema Reference: Idmap

Idmap: Schema SQL

[Note]Note

A possible future direction is for this table to be relationally linked to the vendors table such that idmap.isite = vendor.vsite

create table idmap
( identryno                     number(7) primary key,
  imodelno                      number(6) references models,
  istatus                       char(1),
  isite                         varchar2(20) not null,
  ikey                          varchar2(30),
  ialtkey                       varchar2(30),
  iname                         varchar2(30),
  inotes                        varchar2(80), 
  iactive                       char(1),
  ichanged                      date,
  ichecked                      date,
  iadded                        date,
  iamended                      date
);

Idmap: Defined Values

Table 12.1. istatus: idmap status: defined values

istatus
MManually Added
AGenerated Automatically
IImported From Another WACS site

Table 12.2. iactive: model activity status as this identity: defined values

iactive
YYes - active model (refresh list with auto tools)
DDormant - no new sets for a while (don't bother checking)
NNo - inactive (id not known)
OObsolete - old reference (no longer there)

Table 12.3. isite: Some recommended site abbrievations: recommended values

isite (recommended values)
[Note]Note

This is a Recommended Values list only; additional values can be added as appropriate

ALSALSScan.com
AMKAMKingdom.com (aka ATK Galeria)
ATEATKExotics.com
ATKPATKPremium.com
AWAbbyWinters.com
FJFemJoy.com
IFGinfocusgirls.com
JAFNjennyandfriends.net
KPCkarupspc.com (aka Karup's Private Collection)
KHAkarupsha.com (aka Karup's Hometown Amateurs)
SEsapphicerotica.com
TFteenflood.com
WACSDWACS Demo site (coming soon)

Chapter 13. Schema Reference: Models

Models: Schema SQL

[Note]Note

Please notice that the use of metric in the vital statistics is not intended to be a dig at the imperial measurements, merely that it reliably and consistantly conveys the necessary information as sensible, manageable integers. Utility functions are planned to make it easier to convert and update in a future release of WACS. You try writing an SQL query to find models between 5ft 3ins and 5ft 6ins in height, as compared to between 160 and 168 cms in height. See what I mean?

create table models 
( modelno           number(6) primary key,
  mname             varchar2(40),
  mhair             varchar2(15),
  mlength           varchar2(20),
  mtitsize          varchar2(10),
  mcupsize          char(1),
  meyes             varchar2(15),
  mrace             varchar2(15),
  mattributes       varchar2(60),
  maliases          varchar2(60),
  mdisting          varchar2(80),
  musual            varchar2(60),
  mimage            varchar2(80),
  mbigimage         varchar2(80),
  mstatus           char(1),
  mrating           char(1),
  mpussy            char(1),
  mflag             char(1),
  mvideos           char(1),
  msolo             char(1),
  mstraight         char(1),
  mlesbian          char(1),
  mfetish           char(1),
  mmast             char(1),
  mtoys             char(1),
  mother            char(1),
  mnsets            number(4),
  mnimages          number(7),
  mnvideos          number(4),
  mcountry          varchar2(30),
  mhometown         varchar2(80),
  mage              number(3),
  mageyear          number(4),
  mcstatus          char(1),
  mvitbust          number(4),
  mvitwaist         number(4),
  mvithips          number(4),
  mbuild            char(1),
  mheight           number(3),
  mweight           number(3),
  moccupation       varchar2(30),
  mcontact          varchar2(80),
  mnotes            varchar2(240),
  mbio              varchar2(240),
  madded            date,
  mamended          date
);

Models: Defined Values

Table 13.1. mstatus: model record status: defined values

mstatus
AAutomatically Added, Details Not Checked
MManually Added, Details Not Checked
NNormal - Checked
GGood - Thoroughly Checked
PPlaceholder - Not Real Person

Table 13.2. mrating: model rating: defined values

mrating
5Finest (included in Q= searches and front page)
4Very Good (included in Q= searches and front page)
3Good (not included in Q= searches, included in front page)
2Reasonable (not included in Q= searches or front page)
1Mediocre (not included in Q= searches or front page)
0None Specified (listed in U= searches)

Table 13.3. mpussy: model's normal pubic hair style: defined values

mpussy
HHairy
TTrimmed
BBrazilian style shaved - very little hair above clit area
SShaven - completely
VVaries (best avoided, try and pick one of above - her usual style)
NNot Specified

Table 13.4. mflag: special marking flag for models: defined values

mflag
SFavourite Solo
LFavourite Lesbian
CFavourite Cutie
FFavourite Straight
MCurrent Featured Model
PPlaceholder (not a real person)

Table 13.5. model activites flags: defined values

model activities flags
fieldnamepossible values
[Note]Note

Automatically updated by updatestats

mvideos

Y - Yes, does this; N - No, doesn't do this

msolo
mstraight
mlesbian
mfetish
mmast
mtoys
mother

Table 13.6. mcstatus: accuracy of home country field: defined values

mcstatus
CCertain - country of origin stated in bio
IInferred - from location or other models seen with
GGuess - based on photographer or building style
NNone

Table 13.7. mrace: race of the model: defined values

mrace
CaucasianCaucasian - European Descent aka White
OrientalOriental - Chinese, Japanese, SE Asian
AsianIndian Sub-Continent - India, Pakistan, etc
NegroidNegroid - of African Descent aka Black
AboriginalAboriginal - indigenous peoples - First Nation, Polynesian, etc
LatinaLatin American - aka Hispanic
MixedMixed race and others

Table 13.8. mbuild: body type of the model: defined values

mbuild
VVery Slim
SSlim
MMedium
HHeavy

Table 13.9. vital statistics: meanings

vital statistics
mweightWeight in Kilos
mheightHeight in centimetres
mvitbustBust measurement in centimetres (vital stats part 1)
mvitwaistWaist measurement in centimetres (vital stats part 2)
mvithipsHips measurement in centimetres (vital stats part 3)

Chapter 14. Schema Reference: Download

Download: Schema SQL

create table download
( downloadno                            number(7) primary key,
  dmodelno                              number(6) references models,
  dsetno                                number(9) references sets,
  dstatus                               char(1),
  dtype                                 char(1),
  dsite                                 varchar2(20) not null,
  dkey                                  varchar2(30),
  dsetkey                               varchar2(40),
  dsetname                              varchar2(240),
  dsetflag                              char(1),
  dnotes                                varchar2(240),
  durl                                  varchar2(240),
  darchive                              varchar2(240),
  dsignature                            varchar2(82),
  dsize                                 number(9),
  dpulled                               date,
  dadded                                date,
  damended                              date
);

Download: Defined Values

Table 14.1. dstatus: download status: defined values

dstatus
UNot Yet Attempted
FFailed - Retry when possible
SSuccessful - set registered in database, available
PPending - downloaded, awaiting unpacking
AAborted - don't download for some reason
DDeferred - held back from being downloaded
RRelationship Entry - a second model for a set
LLiasion - a proto-Relationship Entry not yet linked
EError - not the right model, etc
IIn Progress - download currently in progress
XIncomplete - record of it's existance but too little info to download it

Table 14.2. dtype: download set type: defined values

dtype
IImage Set
VVideo Clip
AAudio File

Table 14.3. dsetflag: Suggested value for scatflag based on parsing result

dsetflag
[Note]Note

Any valid value for scatflag from the sets table. This is a hint on the set type based upon the parsing process picking out keywords


Chapter 15. Schema Reference: Photographer

Photographer: Schema SQL

create table photographer
( pref             varchar2(6) primary key,
  pname            varchar2(40),
  paliases         varchar2(80),
  pgender          char(1),
  paddress         varchar2(120),
  pemail           varchar2(80),
  pwebsite         varchar2(80),
  pusual           varchar2(40),
  pregion          varchar2(20),
  pcountry         varchar2(50),
  plocation        varchar2(50),
  pstyledesc       varchar2(80),
  prating          number(2),
  phardness        number(2),
  psolo            char(1),
  ptoys            char(1),
  plesbian         char(1),
  pstraight        char(1),
  pgroup           char(1),
  pfetish          char(1),
  pdigital         char(1),
  pfilm            char(1),
  pvideo           char(1),
  phdvideo         char(1),
  pcamera          varchar2(40),
  pcamnotes        varchar2(80),
  pcomments        varchar2(240),
  pnotes           varchar2(240),
  pbiography       varchar2(1024),
  padded           date,
  pamended         date
);

Photographer: Defined Values

Table 15.1. pgender: gender of the photographer: defined values

pgender
MMale
FFemale
UUnknown

Table 15.2. pregion: geographical location of the photographer: defined values

pregion
EuropeEurope
North AmericaUSA and Canada
South AmericaSouth and Central America
Middle EastMiddle East (brave photographer!)
AsiaAsia (India and the Indian Sub-continent ONLY)
OrientOrient (Asia excluding Indian Sub-continent)
AustralasiaAustralia and New Zealand
AfricaAfrica
OtherOther

Table 15.3. prating: overall rating of photographer: defined values

prating
0None
1Awful - poor equipment and technique
2Poor - uninteresting and badly composed/exposed work
3Reasonable - technically OK, but very unenterprising
4Good - good technique, interesting compositions and direction
5Excellent - Excellent technique, interesting and challenging compositions and direction

Table 15.4. phardness: rating of how explicit this photographer can be: defined values

phardness
0None - Not Rated
1Soft-focus (very arty)
2Glamour - sharp but no open leg, genital detail, etc
3Normal - wide range of shots but not particularly strong
4Hard (close-ups)
5Fetish - pretty extreme, gaping, etc

Table 15.5. photographer activites covered flags: defined values

photographer activities covered flags
fieldnamepossible values
psolo

Y - Yes, does this; N - No, doesn't do this; O - Occasionally does this

ptoys
plesbian
pstraight
pgroup
pfetish

Table 15.6. photographer technologies used flags: defined values

photographer technologies used flags
fieldnamepossible values
pdigital

Y - Yes, uses this technology; N - No, doesn't use this technology.

pfilm
pvideo
phdvideo

Chapter 16. Schema Reference: Tag

Tag: Schema SQL

create table tag
( tagno                         number(9) primary key,
  tmodelno                      number(6) references models,
  tsetno                        number(9) references sets,
  tstatus                       char(1),
  tflag                         char(1),
  tgroup                        number(6),
  tdesc                         varchar2(40),
  towner                        varchar2(20),
  texpiry                       date,
  tadded                        date,
  tamended                      date 
);

Tag: Defined Values

Table 16.1. tstatus: tag entry status: defined values

tstatus
TTemporary - expire as per expiry rules
VViewed, Temporary - expire as per expiry rules, hide from index
PPermanent - don't expire, show in index
AArchived - don't expire, don't show in normal indexes

Table 16.2. tflag: tag content type status: defined values

tflag
MModel-based tag entry
SSet-based tag entry

Chapter 17. Schema Reference: Vendor

Vendor: Schema SQL

create table vendor
( vsite            varchar2(20) primary key,
  vname            varchar2(45),
  vshortname       varchar2(20) not null,
  vregion          varchar2(20),
  vcountry         varchar2(50),
  vweburl          varchar2(120),
  vsignup          varchar2(120),
  vrating          number(2),
  vtechrate        number(2),
  vuscdecl         varchar2(240),
  vcurrent         char(1),
  vshow            char(1),
  vsubscribed      char(1),
  vuntil           date,
  vusername        varchar2(80),
  vpassword        varchar2(30),
  vidtimg          number(2),
  vidtvid          number(2),
  vcomexcl         varchar2(240),
  vmdirectory      varchar2(240),
  vmdiruse         char(1),
  vmdirpages       number(3),
  vmpage           varchar2(240),
  vmpaguse         char(1),
  vmbio            varchar2(240),
  vmbiouse         char(1),
  vmvideos         varchar2(240),
  vmviduse         char(1),
  vvidpage         varchar2(240),
  vviduse          char(1),
  vimgpage         varchar2(240),
  vimguse          char(1),
  valtpage         varchar2(240),
  valtuse          char(1),
  vsrvimg          varchar2(240),
  vsrvvid          varchar2(240),
  vmultimg         char(1),
  vmultvid         char(1),
  vnotes           varchar2(240),
  vadded           date,
  vamended         date
);

Vendor: Defined Values

Table 17.1. vcurrent: vendor existance status: defined values

vcurrent
YYes - still an active site
NNo - no longer trading at that web address

Table 17.2. vshow: vendor index inclusion status: defined values

vshow
[Note]Note

This option only really affects vendormode and vendor-based lists of models; if you don't use vendor mode, it's not likely to be relevant.

YYes - show in indices
NNo - hide from indices

Table 17.3. vmdiruse et al: vendor URL auto-usuability status: defined values

vmdiruse et al
fieldnamepage purposepossible values
vmdiruseModel Directory
Ylink is (auto)usable
Nlink is not (auto)usable
Slink usable only with session key
vmpaguseModel Page
vmbiouseModel Biography
vmviduseModel's Videos Page
vviduseVideo Set Page
vimguseImage Set Page
valtuseAlternate Image Set Page

Chapter 18. Schema Reference: Conn

Conn: Schema SQL

create table conn
( centryno                      number(9) primary key,
  cgroup                        number(6),
  corder                        number(3),
  cflag                         char(1),
  cstatus                       char(1),
  cmodelno                      number(6) references models,
  csetno                        number(9) references sets,
  cphotog                       varchar2(6) references photographer,
  ctype                         varchar2(20) not null,
  cdesc                         varchar2(80),
  ccomments                     varchar2(240),
  cpath                         varchar2(160)
  cadded                        date,
  camended                      date
);

Conn: Defined Values

[Warning]Warning

Conn (connections) is a recent addition and not all parts of the toolchain are in place yet. As the management tools are added, it is expected that at least the legal values for fields will change and be expanded.

Table 18.1. cflag: connection type: defined values

cflag
AAd-Hoc - A casual index of some random theme
GGallery - A slightly more focused collection with a specific concept behind it.

Table 18.2. cstatus: connection entry status: defined values

cstatus
MManually Added
TImported from a Tag set

Chapter 19. Schema Reference: Keyword

Keyword: Schema SQL

create table keyword
( kentryno              number(9) primary key,
  kflag                 char(1),
  kword                 varchar(30) not null,
  kexclusions           varchar(120),
  kiloc                 varchar(20),
  kiscore               number(1),
  kicat                 char(1),
  kicscore              number(1),
  kidet                 varchar(40),
  kidscore              number(1),
  kiattr                varchar(30),
  kiascore              number(1),
  kiother               varchar(40),
  kioscore              number(1),
  knotes                varchar(80),
  kadded                date,
  kamended              date
);

Keyword: Defined Values

Table 19.1. kflag: active entry status: defined values

kflag
AApplies to All Added
NNot Active (Ignore)

Index

C

cflag, Conn: Defined Values
checkexclude, Core Module: Reference
checkindex, Core Module: Reference
check_auth, Core Module: Reference
Configuration
Reading The..., A First WACS Program
Configuration Values
Getting..., Initialising Database Connection
conf_get_attr, Initialising Database Connection, Core Module: Reference
conn
cflag values, Conn: Defined Values
cstatus values, Conn: Defined Values
Field Listing, Conn: Schema SQL
Connection
Database, Initialising..., A First WACS Program
cstatus, Conn: Defined Values

D

Data Architecture, Connecting Sets And Models
Database
Environment Variables, Initialising Database Connection
Fetching Records..., A First WACS Program
Initialising Connection To..., A First WACS Program
describeher, User Interface Module: Reference
WacsUI: Introducing, Introducing WacsUI
divideup, Core Module: Reference
download
dsetflag values, Download: Defined Values
dstatus values, Download: Defined Values
dtype values, Download: Defined Values
Field Listing, Download: Schema SQL
dsetflag, Download: Defined Values
dstatus, Download: Defined Values
dtype, Download: Defined Values

F

find_config_location, Core Module: Reference

I

iactive, Idmap: Defined Values
iconlink, User Interface Module: Reference
icons
adding set ..., About Set Display
idmap
Field Listing, Idmap: Schema SQL
iactive values, Idmap: Defined Values
isite recommended values, Idmap: Defined Values
istatus values, Idmap: Defined Values
isite, Idmap: Defined Values
istatus, Idmap: Defined Values

K

keyword
Field Listing, Keyword: Schema SQL
kflag values, Keyword: Defined Values
kflag, Keyword: Defined Values

M

masthead, Standard Components Module: Reference
mbuild, Models: Defined Values
mcstatus, Models: Defined Values
menu_get_body, User Interface Module: Reference
menu_get_default, User Interface Module: Reference
menu_get_entry, User Interface Module: Reference
menu_get_title, User Interface Module: Reference
mfetish, Models: Defined Values
mflag, Models: Defined Values
mheight, Models: Defined Values
mlesbian, Models: Defined Values
mmast, Models: Defined Values
models
activities values, Models: Defined Values
connection to sets, Connecting Sets And Models
Field Listing, Models: Schema SQL
mbuild values, Models: Defined Values
mcstatus values, Models: Defined Values
mflag values, Models: Defined Values
mpussy values, Models: Defined Values
mrace values, Models: Defined Values
mrating values, Models: Defined Values
mstatus values, Models: Defined Values
vital statistics fields, Models: Defined Values
Modules
Importing WACS API, A First WACS Program
mother, Models: Defined Values
mpussy, Models: Defined Values
mrace, Models: Defined Values
mrating, Models: Defined Values
msolo, Models: Defined Values
mstatus, Models: Defined Values
mstraight, Models: Defined Values
mtoys, Models: Defined Values
mvideos, Models: Defined Values
mvitbust, Models: Defined Values
mvithips, Models: Defined Values
mvitwaist, Models: Defined Values
mweight, Models: Defined Values
MySimple (Sample Program)
Perl Version Source Code, Putting It All Together
Php Version Source Code, Putting It All Together
Sample Run Output, Running MySimple
MySimple2 (Sample Program)
Sample Run Output, Adding Model Icons
MySimple3 (Sample Program)
Sample Run Output, Using HTML tables
MySimple4 (Sample Program)
Sample Run Output, Adding The Model Details
MySimple5 (Sample Program)
Sample Run Output, Adding Other Icons

R

readable
making Camel-Style ..., About Set Display
read_conf, Core Module: Reference
read_menu, User Interface Module: Reference
Relational Database Model, Connecting Sets And Models

S

sauto, Sets: Defined Values
scatflag, Sets: Defined Values
serrors, Sets: Defined Values
SetDisp (Sample Program)
Sample Run Output, Sets: The Basic Bones
setdisp program, Sets: The Basic Bones
SetDisp2 (Sample Program)
Sample Run Output, Adding Icons
SetDisp3 (Sample Program)
Sample Run Output, Making The Text More Readable
SetDisp4 (Sample Program)
Sample Run Output, An Example Using Assoc
setgroupperms, Core Module: Reference
sets
connecting to models, Connecting Sets And Models
Field Listing, Sets: Schema SQL
introduction to displaying, About Set Display
sauto values, Sets: Defined Values
scatflag values, Sets: Defined Values
serrors values, Sets: Defined Values
sformat values, Sets: Defined Values
sidlogo values, Sets: Defined Values
slocation recommended values, Sets: Defined Values
srating values, Sets: Defined Values
sstatus values, Sets: Defined Values
stechqual values, Sets: Defined Values
stype values, Sets: Defined Values
suscattr values, Sets: Defined Values
svariety values, Sets: Defined Values
sformat, Sets: Defined Values
sidlogo, Sets: Defined Values
slocation, Sets: Defined Values
SQL
Simple Example, A First WACS Program
srating, Sets: Defined Values
sstatus, Sets: Defined Values
stechqual, Sets: Defined Values
Structure of a WACS app, Outline
stype, Sets: Defined Values
suscattr, Sets: Defined Values
svariety, Sets: Defined Values

T

tag
Field Listing, Tag: Schema SQL
tflag values, Tag: Defined Values
tstatus values, Tag: Defined Values
text
Camel-Style, About Set Display
tflag, Tag: Defined Values
timecomps, Core Module: Reference
tstatus, Tag: Defined Values

U

Using relationships, Connecting Sets And Models