Documentation

Licence

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Overview

Vaco Web Library is an API for developing website applications and command line scripts. (1 From www.webopedia.com: API is "Abbreviation of application program interface, a set of routines, protocols, and tools for building software applications. A good API makes it easier to develop a program by providing all the building blocks. A programmer puts the blocks together.").

It may be easily extended and used as database connector, content generator or even simple content management system. Additional modules may be required and included into the installation at any time. This set of scripts gives you the root environment for your website or web application.

Main scripts are written to be as far as possible self-suficient, so you may try to use them separately if you wish. On the other hand, you should be able to use the whole engine in the most simple way it could be.

Documentation for this project is written in rather chaotic way, so not everything is described the valid way or mentioned at all. To make sure what is really going on you are welcome to read the source as said in galaxy far far away: "Use the source Luke." If you find it working bad for you, please note, that this project is expermiental and written by only one human being.

If was first developed as a Synapse project which was the basement of the browser based Galaxy Forces MMORPG game. The name was changed after about 2,5 year later after building a library for Delphi to avoid conflict with the other Synapse project.

Nevertheless that kind of change was needed, because previously library was used only for Web applications and then expanded.

Requirements

For running your website in a full featured environment you will probably need a web server (Apache preferably) with PHP scripting enabled, database server and at some disk space for local storage.

MySQL provide well testet SQL and most of the work is done for it. Currently, support for foreign SQL environment (i.e. Oracle, Firebird) is limited but you are welcome to make any kind of support to this project or if you are lazy, just try to use adodb as a database layer.

For the beginning of fun few megabytes of free disk storage should should be enough.

Making experience with Vaco using simple unix-like box is recommended.

If you are interested only in \textsl{CLI} mode, you should have PHP parser installed.

Installation

This part describes installation issues. Generally it would be sufficient to just unpack all the packages to some place where you can have HTTP access. Then jump to this address with your favorite browser. When configuration file does not exists, you will be redirected to the installation script. Please note that this behaviour may not work if you have only essential files installed. In most cases this kind of job is a problem for applications based on Vaco.

If you get an error: "Cannot connect to database" you should check if the driver is supported by your installation, and all data you entered (database username, password, name) are valid.

If somehow you cannot initiate database installation (or don't want to use database at all) you can omit this for now - you can set database connection later.

Reading database documentation may help in finding the proper solution.

Apache HTTP Server

If you put the site in its own directory (even somewhere outside server's documents root) you may want to create an alias to be able to execute site by using simple URL: http://localhost/synapse. To do this insert following lines to your server configuration file (httpd.conf probably):

Alias /synapse "c:/synapse"

<Directory "c:/synapse/*">
    AllowOverride FileInfo AuthConfig Limit
    Options Includes
    <Limit GET POST OPTIONS PROPFIND>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS PROPFIND>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

This should work fine with Apache 1.3.x for Windows.

MySQL Database Server

If you don't use tools like phpMyAdmin, MySQL Administrator, SQLyog or other software that allows you to create databases and users, you may use the following SQL example to do this from the command line.

CREATE DATABASE synapse;

GRANT USAGE ON *.* TO "synapse"@"localhost" IDENTIFIED BY "secret";

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX,
  ALTER, CREATE TEMPORARY TABLES ON synapse.*
  TO "synapse"@"localhost";

This will create database "synapse" in the local MySQL server and a special user "synapse" with password "secret" that will be its owner.

To undo you may want to delete all the database and remove user, which can be done with this SQL query:

REVOKE ALL PRIVILEGES ON synapse.* FROM "synapse"@"localhost";

REVOKE GRANT OPTION ON synapse.* FROM "synapse"@"localhost";

DROP DATABASE synapse;

Registry

Registry generally is a part of configuration stored in database. All the content of config table is read and available for scripts in $Config variable. You may edit registry using administration panel or your favourite database browser.

Below is short description of some important keys you may want to change. Notice that you don't have to use SQL database to store them as the are read from the global $Config array;

Key(s) Default Description
CLI This key is set automaticaly if script is executed from command line.
Internal false Controls if configuration should be loaded from external config.php and read from registry or not if set to true
MagicQuotes This setting controls if the values comes from outside (and read using request() should be quoted. This affects also on database queries using sql() function. If you set it to true then every requested value will be quoted but sql() will not try to quote string values, so by default it's not set (same as false) and every value inside your code will be stripped (if needed) and quoted again in SQL queries
Debug true If true error reporting setting is set to E ERROR | E PARSE and many failures such as including non existing file or using undefined values will make warnings. In productional use this value should be set to false
Verbose The higher value the more debug output will be
Protect If true, configuration changes ($Config array) are limited
Timeout Maximum amount of seconds script may be executed (affects the max_execution_time setting
Maintenance During the maintenance (in case {$WEBROOT}MAINTENANCE file exists) only pages that sets this key to true are allowed to be shown
Protect If true, configuration changes (made in $Config array) are limited.
Secure If set the passwords are cleared after use. This is used when your scripts are set to do the SQL connection automatically using the values stored in $Database to avoid security leaks
Style default This key controls which style should be used to generate output
Theme Used by some styles for selecting one of available theme variant.
BBParseLinks Controls whenever the BB code should translate [link] into HTML
Administrator Administrator's e-mail address used in Reply-To field
Robot E-mail address in From field. Should not be valid
IgnoreUserStyle Controls when user's style settings should be ignored
Logging Controls whether write log messages to file
LogPath Folder where log files are stored
TZ Etc/Universal Server's time zone setting. See php.net/timezones for more details. This is the obligatory setting in PHP 6. Notice that if you want to rely on the global date.timezone setting in PHP's configuration file, you should set this key to an empty string (or FALSE)