Members

Note: You can use your Sitellite.org account here and vice versa.

Username

Password

Remember Login

Forgot your password?

Not a member? Click here to register

Cgi Object

Home Page | All Pages | Recently Revised | Authors | Feeds |

The saf.CGI object is a global object named $cgi that at its essence is an OOP equivalent to the $_GET, $_POST, and $_FILES arrays. In this capacity it is the equivalent of calling:


<?php

$cgi = (object) array_merge ($_GET, $_POST, $_FILES);

?>

This was a large part of the inspiration for the CGI object, as it predates the "superglobals" by at least a year. The origins of it lie in the popular Perl CGI.pm package.

However, there are a few key differences even at this level, as well as some additional methods that make the CGI object a valuable addition to the Sitellite API.

The key differences include:

  • CGI normalizes the situation with magic quotes in PHP, so Sitellite programmers receive more predictable data input, regardless of the server setting.
  • CGI's equivalent to the $_FILES array is actually a list of saf.CGI.UploadedFile objects, which provide additional methods for managing uploaded files.

The additional methods provided by CGI include:

  • parseUri() - Parses the REQUEST_URI for additional variables in the format: /index/var1.value/var2.value2 and adds them to the list. Any unnamed values are returned as an array.
  • translateUri() - Takes an ordinary URL and turns it into a URL compatible with parseUri().
  • verify() - Provides input validation capabilities.
  • makeQuery() - Creates a query string for appending to a URL.
  • verifyRequestMethod() - Verifies the request method.
  • isHttps() - Determines whether the current request is being made through an SSL connection.

For more information about objects in Sitellite, see the Sitellite API reference at:

http://www.sitellite.org/docs/

Revised on April 11, 2005 12:59 AM by lux

Back in time (1 more) | Linked from: Libraries