cvs: peardoc / manual.xml.in /en/packages authentication.xml packages.ent templates.xml /en/packages/authentication auth.xml auth_http.xml
/en/packages/templates it.xml itx.xml
| From: | Martin Jansen | Date: | Thu, 03 Jan 2002 18:46:38 +0000 |
| Subject: | cvs: peardoc / manual.xml.in /en/packages authentication.xml packages.ent templates.xml /en/packages/authentication auth.xml auth_http.xml /en/packages/templates it.xml itx.xml |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1812@lists.php.net to get a copy of this message | ||
mj Thu Jan 3 13:46:38 2002 EDT
Added files:
/peardoc/en/packages templates.xml packages.ent
/peardoc/en/packages/templates it.xml itx.xml
/peardoc/en/packages/authentication auth.xml auth_http.xml
Modified files:
/peardoc manual.xml.in
/peardoc/en/packages authentication.xml
Log:
* Split package documentation into more files.
# If there are still some errors, I'll correct them after
# lunch ;-).
Index: peardoc/manual.xml.in diff -u peardoc/manual.xml.in:1.7 peardoc/manual.xml.in:1.8 --- peardoc/manual.xml.in:1.7 Wed Jan 2 13:07:20 2002 +++ peardoc/manual.xml.in Thu Jan 3 13:46:38 2002 @@ -4,9 +4,11 @@ <!ENTITY % language-defs SYSTEM "@srcdir@/@LANGDIR@/language-defs.ent"> <!ENTITY % language-snippets SYSTEM "@srcdir@/@LANGDIR@/language-snippets.ent"> +<!ENTITY % global.packages SYSTEM "@srcdir@/@LANGDIR@/packages/packages.ent"> %language-defs; %language-snippets; +%global.packages; <!-- All global entities for the XML files --> <!ENTITY % global.entities SYSTEM "@srcdir@/global.ent"> @@ -45,7 +47,7 @@ <title>&Packages;</title> &packages.authentication; &packages.networking; - &packages.it; + &packages.templates; </part> <part id="pecl"> Index: peardoc/en/packages/authentication.xml diff -u peardoc/en/packages/authentication.xml:1.2 peardoc/en/packages/authentication.xml:1.3 --- peardoc/en/packages/authentication.xml:1.2 Thu Dec 20 12:15:42 2001 +++ peardoc/en/packages/authentication.xml Thu Jan 3 13:46:38 2002 @@ -7,182 +7,6 @@ </para> </partintro> - <refentry id="packages.Auth.Auth"> - <refnamediv> - <refname><classname>Auth</classname></refname> - <refpurpose> - PHP based authentication systems. - </refpurpose> - </refnamediv> - - <refsect1 id="packages.Auth.Auth.Auth"> - <title>Auth::Auth</title> - - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::Auth</function></funcdef> - <paramdef>string <parameter>storageDriver</parameter>, mixed <parameter>options</parameter>, string <parameter>loginFunction</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Constructor for the authencation system. The first parameter is - the name of the storage driver, that should be used. The second - parameter can either be a string containing some login information - or an array containing a bunch of options for the storage driver. - </para> - <para> - The third parameter is the name of user-defined function, that - prints the login screen. - </para> - - <example> - <title>Using PEAR::Auth with PEAR::DB container and a user-defined - login function</title> - <programlisting role="php"> -require_once "Auth/Auth.php"; - -function myOutput($username, $status) -{ - if ($status == AUTH_WRONG_LOGIN) { - echo "You entered wrong login data!<br / >"; - } - - echo "<form method=\"post\" action=\"" . $HTTP_SERVER_VARS['PHP_SELF'] . "\">\n"; - echo "Username: <input type=\"text\" name=\"username\" value=\"" . $username . "\"><br />\n"; - echo "Password: <input type=\"password\" name=\"password\"><br />\n"; - echo "<input type="submit"></form>\n"; -} - -$a = new Auth("DB", "mysql://martin:test@localhost/auth", "myOutput"); - -$a->start(); - -if ($a->getAuth()) { - echo "You have been authenticated successfully."; -} - </programlisting> - </example> - - <example> - <title>Using different DB parameters</title> - <programlisting role="php"> -require_once "Auth/Auth.php"; - -function myOutput($username, $status) -{ - ... /** See example 1 for the full listing */ -} - -$params = array( - "dsn" => "mysql://martin:test@localhost/auth", - "table" => "myAuth", - "usernamecol" => "myUserColumn", - "passwordcol" => "myPasswordColumn" - ); - -$a = new Auth("DB", $params, "myOutput"); - -$a->start(); - -if ($a->getAuth()) { - echo "You have been authenticated successfully."; -} - </programlisting> - </example> - - <para> - This example shows you, how you can specifiy alternative - names for the database table and the column names. In our - example, we use the table myAuth, select the username from - the field myUserColumn and the password from the field - myPasswordColumn. The Default values for this fields are - auth, username and password. - </para> - <para> - This feature is necessary if you want to use PEAR::Auth - with a database layout that is different from the one, - PEAR::Auth uses by default. - </para> - </refsect1> - - <refsect1 id="packages.Auth.Auth.start"> - <title>Auth::start</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::start</function></funcdef> - <paramdef></paramdef> - </funcprototype> - </funcsynopsis> - - <para> - Start the authentication process. - </para> - </refsect1> - - <refsect1 id="packages.Auth.Auth.getAuth"> - <title>Auth::getAuth</title> - - <funcsynopsis> - <funcprototype> - <funcdef>boolean <function>Auth::getAuth</function></funcdef> - <paramdef></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Check if the user has been authenticated. - </para> - <para> - If the user has already been authenticated, the function returns - true. Otherwise it returns false. - </para> - <para> - For usage example, see <function>Auth::Auth</function>. - </para> - </refsect1> - </refentry> - - <refentry id="packages.Auth.Auth_HTTP"> - <refnamediv> - <refname><classname>Auth_HTTP</classname></refname> - <refpurpose> - HTTP authentication with PHP. - </refpurpose> - </refnamediv> - - <refsect1 id="packages.Auth.Auth_HTTP.Auth_HTTP"> - <title>Auth_HTTP::Auth_HTTP</title> - - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::Auth</function></funcdef> - <paramdef>string <parameter>storageDriver</parameter>, mixed <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Constructor for the authencation system. The first parameter is - the name of the storage driver, that should be used. The second - parameter can either be a string containing some login - information or an array containing a bunch of options for the - storage driver. - </para> - <para> - For more information on usage of the constructor parameters, - please refer to the documentation of PEAR::Auth. - </para> - - <example> - <title>Simple usage example</title> - <programlisting role="php"> -require_once "Auth_HTTP/Auth_HTTP.php"; - -$a = new Auth_HTTP("DB", "mysql://test:test@localhost/test"); - -$a->start(); - </programlisting> - </example> - - </refsect1> - - </refentry> - + &authentication.auth; + &authentication.auth_http; </reference> Index: peardoc/en/packages/templates.xml +++ peardoc/en/packages/templates.xml <!-- $Id: templates.xml,v 1.1 2002/01/03 18:46:38 mj Exp $ --> <reference id="packages.templates"> <title>HTML Templates</title> <!-- Partintro --> <partintro> <para> There are a number of different template engines in PEAR, that are described in this chapter. </para> </partintro> <!-- Partintro --> &templates.it; &templates.itx; </reference> Index: peardoc/en/packages/packages.ent +++ peardoc/en/packages/packages.ent <!ENTITY authentication.auth SYSTEM "authentication/auth.xml"> <!ENTITY authentication.auth_http SYSTEM "authentication/auth_http.xml"> <!ENTITY templates.it SYSTEM "templates/it.xml"> <!ENTITY templates.itx SYSTEM "templates/itx.xml"> Index: peardoc/en/packages/templates/it.xml +++ peardoc/en/packages/templates/it.xml <!-- it.it {{{ --> <refentry id="packages.it.it"> <refnamediv> <refname><classname>IntegratedTemplate</classname></refname> <refpurpose> Light-weight template system </refpurpose> </refnamediv> <refsect1 id="packages.it.it.placeholder"> <title>Placeholder</title> <para> The format of placeholder is <programlisting> {[0-9A-Za-z_-]+} </programlisting> This means, the name of the placeholder can consist of upper- and lowercase letters, underscores and hypens. The name must be placed between curly brackets without any spaces. Valid names are i.e.: <simplelist> <member>{Placeholder}</member> <member>{place2_holder}</member> <member>{PLACEHOLDER1}</member> <member>{Place-Holder}</member> </simplelist> Non-valid names are i.e. <simplelist> <member>{ Placeholder 3 } (spaces)</member> <member>{place*holder} (char isn't permitted)</member> </simplelist> </para> </refsect1> <refsect1 id="packages.it.it.block"> <title>Blocks</title> <para> The format of a block is <programlisting> <![CDATA[ <!-- BEGIN [0-9A-Za-z_-]+ --> ... block content ... <!-- END [0-9A-Za-z_-]+ --> ]]> </programlisting> The rules for the block name are the same like for placeholders. In contrast to placeholders the spaces in the block markup are required. </para> <para> The nesting of blocks is permitted, but be careful while parsing. You have to set and parse the deepest inner block first and then set and parse from inner to outer. </para> </refsect1> <refsect1 id="packages.it.it.example"> <title>Usage Example</title> <example> <title>The template</title> <programlisting> <![CDATA[ <html> <table border> <!-- BEGIN row --> <tr> <!-- BEGIN cell --> <td> {DATA} </td> <!-- END cell --> </tr> <!-- END row --> </table> </html> ]]> </programlisting> </example> <example> <title>The script</title> <programlisting role="php"> <![CDATA[ <?php require_once "HTML/IT.php"; $data = array ( "0" => array("Stig", "Bakken"), "1" => array("Martin", "Jansen"), "2" => array("Alexander", "Merz") ); $tpl = new IntegratedTemplate("./templates"); $tpl->loadTemplatefile("main.tpl.htm", true, true); foreach($data as $name) { foreach($name as $cell) { // Assign data to the inner block $tpl->setCurrentBlock("cell") ; $tpl->setVariable("DATA", $cell) ; $tpl->parseCurrentBlock("cell") ; } // Assign data and the inner block to the // outer block $tpl->setCurrentBlock("row") ; $tpl->parseCurrentBlock("row") ; } // print the output $tpl->show(); ?> ]]> </programlisting> </example> <example> <title>The output</title> <programlisting> <![CDATA[ <html> <table border> <tr> <td> Stig </td> <td> Bakken </td> </tr> <tr> <td> Martin </td> <td> Jansen </td> </tr> <tr> <td> Alexander </td> <td> Merz </td> </tr> </table> </html> ]]> </programlisting> </example> </refsect1> <refsect1 id="packages.it.it.integratedtemplate"> <title>IntegratedTemplate::IntegratedTemplate</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::IntegratedTemplate</function></funcdef> <paramdef>string <parameter><optional>$root</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Builds some complex regular expressions and optinally sets the file root directory. Make sure that you call this constructor if you derive your templateclass from this one. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$root</parameter> - root directory, prefix for all filenames given to the object. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.get"> <title>IntegratedTemplate::get</title> <funcsynopsis> <funcprototype> <funcdef>string <function>IntegratedTemplate::get</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a block with all replacements done. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to return, when not set the complete template will returned. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.parse"> <title>IntegratedTemplate::parse</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::parse</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> <paramdef>boolean <parameter><optional>$flag_recursion</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Parses the given block. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to parse, when not set the complete template will be parsed. </para> </listitem> <listitem> <para> <parameter>$flag_recursion</parameter> - can be ignored </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.parsecurrentblock"> <title>IntegratedTemplate::parseCurrentBlock</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::parseCurrentBlock</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Parses the current block </para> </refsect1> <refsect1 id="packages.it.it.setvariable"> <title>IntegratedTemplate::setVariable</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setVariable</function></funcdef> <paramdef>mixed <parameter>$placeholder</parameter></paramdef> <paramdef>string <parameter><optional>$variable</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Sets a variable value. The function can be used eighter like setVariable( "varname", "value") or with one array $variables["varname"] = "value" given setVariable($variables). </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$placeholder</parameter> - Name of the placeholder to substitute or a array with the placeholder as key and the data to assign as value. </para> </listitem> <listitem> <para> <parameter>$variable</parameter> - when $placeholder isn't a array, the value to assign to the placeholder. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.setCurrentBlock"> <title>IntegratedTemplate::parse</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::setCurrentBlock</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Sets the name of the current block, that is the block where variables are added. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to set, when not given the complete template is set (shows on the placeholders outside of all block). </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on failure, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.touchblock"> <title>IntegratedTemplate::touchBlock</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::touchBlock</function></funcdef> <paramdef> string <parameter>$block</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Preserves an empty block even if removeEmptyBlocks is true </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to preserve </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on false, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.init"> <title>IntegratedTemplate::init</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::init</function></funcdef> <paramdef> </paramdef> </funcprototype> </funcsynopsis> <para> Clears all datafields of the object and rebuilds the internal blocklist. LoadTemplatefile() and setTemplate() automatically call this function when a new template is given. Don't use this function unless you know what you're doing. </para> </refsect1> <refsect1 id="packages.it.it.free"> <title>IntegratedTemplate::free</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::free</function></funcdef> <paramdef> </paramdef> </funcprototype> </funcsynopsis> <para> Clears all datafields of the object. Don't use this function unless you know what you're doing. </para> </refsect1> <refsect1 id="packages.it.it.setTemplate"> <title>IntegratedTemplate::setTemplate</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setTemplate</function></funcdef> <paramdef> string <parameter>$template</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Sets the template. You can eighter load a template file from disk with LoadTemplatefile() or set the template manually using this function. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$template</parameter> - content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.loadTemplatefile"> <title>IntegratedTemplate::loadTemplatefile</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::loadTemplatefile</function></funcdef> <paramdef>string <parameter>$filename</parameter></paramdef> <paramdef>boolean <parameter><optional>$removeUnknownVariables</optional></parameter></paramdef> <paramdef>boolean <parameter><optional>$removeEmptyBlocks</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Reads a template file from the disk. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$filename</parameter> - name of the template file </para> </listitem> <listitem> <para> <parameter>$removeUnknownVariables</parameter> - when true not assigned placeholders will be deleted </para> </listitem> <listitem> <para> <parameter>$removeEmptyBlocks</parameter> - when true unused blocks will be removed </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on false, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.setRoot"> <title>IntegratedTemplate::setRoot</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setRoot</function></funcdef> <paramdef> string <parameter>$root</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Sets the file root. The file root gets prefixed to all filenames passed to the object. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$root</parameter> - root directory for the templates </para> </listitem> <listitem> <para> <parameter>$removeUnknownVariables</parameter> - when true not assigned placeholders will be deleted </para> </listitem> <listitem> <para> <parameter>$removeEmptyBlocks</parameter> - when true unused blocks will be removed </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.show"> <title>IntegratedTemplate::show</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::show</function></funcdef> <paramdef> string <parameter><optional>$block</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Print a certain block with all replacements done. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - when not set the whole content will be printed. </para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- }}} it.it --> Index: peardoc/en/packages/templates/itx.xml +++ peardoc/en/packages/templates/itx.xml <!-- it.itx {{{ --> <refentry id="packages.it.itx"> <refnamediv> <refname><classname>IntegratedTemplateExtension</classname></refname> <refpurpose> Wrapper class around IntegratedTemplate, compatible to the PHPLIB template system </refpurpose> </refnamediv> <refsect1 id="packages.it.itx.desc"> <title>Description</title> <para> IntegratedTemplateExtension was created as a wrapper class for the <ulink url="&url.phplib">PHPLIB</ulink> template system. It helps you to migrate PHPLIB-based projects to PEAR-based ones. </para> <para> <acronym>ITX</acronym> is API-compatible, but based on <link linkend="packages.it.it">IntegratedTemplate</link>. Due to the different concepts of processing and organizing blocks in a template, the behaviour of itx can differ in some situations. </para> <para> it is not recommended to start a project based ITX. If you want a PHPLIB-styled template system, then you should use <classname>Template_PHPLIB</classname>, which is the PHPLIB template system following the PEAR coding standards. </para> </refsect1> </refentry> <!-- }}} it.itx --> Index: peardoc/en/packages/authentication/auth.xml +++ peardoc/en/packages/authentication/auth.xml <refentry id="packages.Auth.Auth"> <refnamediv> <refname><classname>Auth</classname></refname> <refpurpose> PHP based authentication systems. </refpurpose> </refnamediv> <refsect1 id="packages.Auth.Auth.tutorial"> <title>Usage example</title> <simpara> Our goal during this "mini tutorial" is to set up a system that secures your site with an easy to use authenticatin mechanism. </simpara> <para> At the top of the site that has to be secured, we place the following code snippet: </para> <example> <title>Typical usage example for <classname>PEAR::Auth</classname></title> <programlisting role="php"> <![CDATA[ require_once "Auth/Auth.php"; function loginFunction() { global $PHP_SELF; /** * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"" . $PHP_SELF . "\">"; echo "<input type=\"text\" name=\"username\">"; echo "<input type=\"password\" name=\"password\">"; echo "<input type=\"submit\">"; echo "</form>"; } $dsn = "mysql://user:password@localhost/database"; $a = new Auth("DB", $dsn, "loginFunction"); if ($a->getAuth()) { /** * The output of your site goes here. */ } ]]> </programlisting> </example> <para> This few lines of code instantiate the authentication system. In the following paragraph, we are going to explain every step of the above script: </para> <para> The first line includes the file from your PEAR directory, that contains all the necessary code to run PEAR::Auth. After that we define a function, that display the login formular which the visitor of your page has to use to enter his login data. You can change all the HTML formating in this function. </para> <warning> <simpara> You can change all the HTML formatting in the function, but you mustn't change the names of the input boxes in the function. They have to be "username" and "password". </simpara> </warning> <para> Since we want to use a database to verify the login data against, we now create the variable $dsn, that contains a valid DSN string that will be used to connect to the database via PEAR::DB. If you want to use a different storage container, please see below for more information. </para> <para> After that we create the authentication object: The first parameter defines the name of the storage container. Because we want to use a database driven storage container, we pass "DB" here. The second parameter is the connection parameter for the container driver. We use the previously defined DSN string. The third parameter is the name of our function, we defined at the beginning of the script, that prints the login formular. </para> <para> Now our authentication object is inititated and we simply need to check if the user is logged in. This is done via the function <function>getAuth</function>. If it returns true, we can pass the content of our page to the user. </para> <para> In the following passages you get to know some detailed information about the functions of PEAR::Auth. </para> </refsect1> <refsect1 id="packages.Auth.Auth.Auth"> <title>Auth::Auth</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::Auth</function></funcdef> <paramdef>string <parameter>storageDriver</parameter></paramdef> <paramdef>mixed <parameter>options</parameter></paramdef> <paramdef>string <parameter>loginFunction</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Constructor for the authencation system. The first parameter is the name of the storage driver, that should be used. The second parameter can either be a string containing some login information or an array containing a bunch of options for the storage driver. </para> <para> The third parameter is the name of user-defined function, that prints the login screen. </para> <example> <title>Using different DB parameters</title> <programlisting role="php"> require_once "Auth/Auth.php"; function myOutput($username, $status) { ... /** See example 1 for the full listing */ } $params = array( "dsn" => "mysql://martin:test@localhost/auth", "table" => "myAuth", "usernamecol" => "myUserColumn", "passwordcol" => "myPasswordColumn" ); $a = new Auth("DB", $params, "myOutput"); $a->start(); if ($a->getAuth()) { echo "You have been authenticated successfully."; } </programlisting> </example> <para> This example shows you, how you can specifiy alternative names for the database table and the column names. In our example, we use the table myAuth, select the username from the field myUserColumn and the password from the field myPasswordColumn. The Default values for this fields are auth, username and password. </para> <para> This feature is necessary if you want to use PEAR::Auth with a database layout that is different from the one, PEAR::Auth uses by default. </para> </refsect1> <refsect1 id="packages.Auth.Auth.start"> <title>Auth::start</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::start</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Start the authentication process. </para> </refsect1> <refsect1 id="packages.Auth.Auth.getAuth"> <title>Auth::getAuth</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>Auth::getAuth</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Check if the user has been authenticated. </para> <para> If the user has already been authenticated, the function returns true. Otherwise it returns false. </para> <para> For usage example, see <function>Auth::Auth</function>. </para> </refsect1> </refentry> Index: peardoc/en/packages/authentication/auth_http.xml +++ peardoc/en/packages/authentication/auth_http.xml <refentry id="packages.Auth.Auth_HTTP"> <refnamediv> <refname><classname>Auth_HTTP</classname></refname> <refpurpose> HTTP authentication with PHP. </refpurpose> </refnamediv> <refsect1 id="packages.Auth.Auth_HTTP.Auth_HTTP"> <title>Auth_HTTP::Auth_HTTP</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::Auth</function></funcdef> <paramdef>string <parameter>storageDriver</parameter></paramdef> <paramdef>mixed <parameter>options</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Constructor for the authencation system. The first parameter is the name of the storage driver, that should be used. The second parameter can either be a string containing some login information or an array containing a bunch of options for the storage driver. </para> <para> For more information on usage of the constructor parameters, please refer to the documentation of <link linkend="packages.Auth.Auth"> PEAR::Auth</link>. </para> <example> <title>Simple usage example</title> <programlisting role="php"> require_once "Auth_HTTP/Auth_HTTP.php"; $a = new Auth_HTTP("DB", "mysql://test:test@localhost/test"); $a->start(); </programlisting> </example> </refsect1> </refentry>
Index: peardoc/manual.xml.in diff -u peardoc/manual.xml.in:1.7 peardoc/manual.xml.in:1.8 --- peardoc/manual.xml.in:1.7 Wed Jan 2 13:07:20 2002 +++ peardoc/manual.xml.in Thu Jan 3 13:46:38 2002 @@ -4,9 +4,11 @@ <!ENTITY % language-defs SYSTEM "@srcdir@/@LANGDIR@/language-defs.ent"> <!ENTITY % language-snippets SYSTEM "@srcdir@/@LANGDIR@/language-snippets.ent"> +<!ENTITY % global.packages SYSTEM "@srcdir@/@LANGDIR@/packages/packages.ent"> %language-defs; %language-snippets; +%global.packages; <!-- All global entities for the XML files --> <!ENTITY % global.entities SYSTEM "@srcdir@/global.ent"> @@ -45,7 +47,7 @@ <title>&Packages;</title> &packages.authentication; &packages.networking; - &packages.it; + &packages.templates; </part> <part id="pecl"> Index: peardoc/en/packages/authentication.xml diff -u peardoc/en/packages/authentication.xml:1.2 peardoc/en/packages/authentication.xml:1.3 --- peardoc/en/packages/authentication.xml:1.2 Thu Dec 20 12:15:42 2001 +++ peardoc/en/packages/authentication.xml Thu Jan 3 13:46:38 2002 @@ -7,182 +7,6 @@ </para> </partintro> - <refentry id="packages.Auth.Auth"> - <refnamediv> - <refname><classname>Auth</classname></refname> - <refpurpose> - PHP based authentication systems. - </refpurpose> - </refnamediv> - - <refsect1 id="packages.Auth.Auth.Auth"> - <title>Auth::Auth</title> - - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::Auth</function></funcdef> - <paramdef>string <parameter>storageDriver</parameter>, mixed <parameter>options</parameter>, string <parameter>loginFunction</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Constructor for the authencation system. The first parameter is - the name of the storage driver, that should be used. The second - parameter can either be a string containing some login information - or an array containing a bunch of options for the storage driver. - </para> - <para> - The third parameter is the name of user-defined function, that - prints the login screen. - </para> - - <example> - <title>Using PEAR::Auth with PEAR::DB container and a user-defined - login function</title> - <programlisting role="php"> -require_once "Auth/Auth.php"; - -function myOutput($username, $status) -{ - if ($status == AUTH_WRONG_LOGIN) { - echo "You entered wrong login data!<br / >"; - } - - echo "<form method=\"post\" action=\"" . $HTTP_SERVER_VARS['PHP_SELF'] . "\">\n"; - echo "Username: <input type=\"text\" name=\"username\" value=\"" . $username . "\"><br />\n"; - echo "Password: <input type=\"password\" name=\"password\"><br />\n"; - echo "<input type="submit"></form>\n"; -} - -$a = new Auth("DB", "mysql://martin:test@localhost/auth", "myOutput"); - -$a->start(); - -if ($a->getAuth()) { - echo "You have been authenticated successfully."; -} - </programlisting> - </example> - - <example> - <title>Using different DB parameters</title> - <programlisting role="php"> -require_once "Auth/Auth.php"; - -function myOutput($username, $status) -{ - ... /** See example 1 for the full listing */ -} - -$params = array( - "dsn" => "mysql://martin:test@localhost/auth", - "table" => "myAuth", - "usernamecol" => "myUserColumn", - "passwordcol" => "myPasswordColumn" - ); - -$a = new Auth("DB", $params, "myOutput"); - -$a->start(); - -if ($a->getAuth()) { - echo "You have been authenticated successfully."; -} - </programlisting> - </example> - - <para> - This example shows you, how you can specifiy alternative - names for the database table and the column names. In our - example, we use the table myAuth, select the username from - the field myUserColumn and the password from the field - myPasswordColumn. The Default values for this fields are - auth, username and password. - </para> - <para> - This feature is necessary if you want to use PEAR::Auth - with a database layout that is different from the one, - PEAR::Auth uses by default. - </para> - </refsect1> - - <refsect1 id="packages.Auth.Auth.start"> - <title>Auth::start</title> - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::start</function></funcdef> - <paramdef></paramdef> - </funcprototype> - </funcsynopsis> - - <para> - Start the authentication process. - </para> - </refsect1> - - <refsect1 id="packages.Auth.Auth.getAuth"> - <title>Auth::getAuth</title> - - <funcsynopsis> - <funcprototype> - <funcdef>boolean <function>Auth::getAuth</function></funcdef> - <paramdef></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Check if the user has been authenticated. - </para> - <para> - If the user has already been authenticated, the function returns - true. Otherwise it returns false. - </para> - <para> - For usage example, see <function>Auth::Auth</function>. - </para> - </refsect1> - </refentry> - - <refentry id="packages.Auth.Auth_HTTP"> - <refnamediv> - <refname><classname>Auth_HTTP</classname></refname> - <refpurpose> - HTTP authentication with PHP. - </refpurpose> - </refnamediv> - - <refsect1 id="packages.Auth.Auth_HTTP.Auth_HTTP"> - <title>Auth_HTTP::Auth_HTTP</title> - - <funcsynopsis> - <funcprototype> - <funcdef><function>Auth::Auth</function></funcdef> - <paramdef>string <parameter>storageDriver</parameter>, mixed <parameter>options</parameter></paramdef> - </funcprototype> - </funcsynopsis> - <para> - Constructor for the authencation system. The first parameter is - the name of the storage driver, that should be used. The second - parameter can either be a string containing some login - information or an array containing a bunch of options for the - storage driver. - </para> - <para> - For more information on usage of the constructor parameters, - please refer to the documentation of PEAR::Auth. - </para> - - <example> - <title>Simple usage example</title> - <programlisting role="php"> -require_once "Auth_HTTP/Auth_HTTP.php"; - -$a = new Auth_HTTP("DB", "mysql://test:test@localhost/test"); - -$a->start(); - </programlisting> - </example> - - </refsect1> - - </refentry> - + &authentication.auth; + &authentication.auth_http; </reference> Index: peardoc/en/packages/templates.xml +++ peardoc/en/packages/templates.xml <!-- $Id: templates.xml,v 1.1 2002/01/03 18:46:38 mj Exp $ --> <reference id="packages.templates"> <title>HTML Templates</title> <!-- Partintro --> <partintro> <para> There are a number of different template engines in PEAR, that are described in this chapter. </para> </partintro> <!-- Partintro --> &templates.it; &templates.itx; </reference> Index: peardoc/en/packages/packages.ent +++ peardoc/en/packages/packages.ent <!ENTITY authentication.auth SYSTEM "authentication/auth.xml"> <!ENTITY authentication.auth_http SYSTEM "authentication/auth_http.xml"> <!ENTITY templates.it SYSTEM "templates/it.xml"> <!ENTITY templates.itx SYSTEM "templates/itx.xml"> Index: peardoc/en/packages/templates/it.xml +++ peardoc/en/packages/templates/it.xml <!-- it.it {{{ --> <refentry id="packages.it.it"> <refnamediv> <refname><classname>IntegratedTemplate</classname></refname> <refpurpose> Light-weight template system </refpurpose> </refnamediv> <refsect1 id="packages.it.it.placeholder"> <title>Placeholder</title> <para> The format of placeholder is <programlisting> {[0-9A-Za-z_-]+} </programlisting> This means, the name of the placeholder can consist of upper- and lowercase letters, underscores and hypens. The name must be placed between curly brackets without any spaces. Valid names are i.e.: <simplelist> <member>{Placeholder}</member> <member>{place2_holder}</member> <member>{PLACEHOLDER1}</member> <member>{Place-Holder}</member> </simplelist> Non-valid names are i.e. <simplelist> <member>{ Placeholder 3 } (spaces)</member> <member>{place*holder} (char isn't permitted)</member> </simplelist> </para> </refsect1> <refsect1 id="packages.it.it.block"> <title>Blocks</title> <para> The format of a block is <programlisting> <![CDATA[ <!-- BEGIN [0-9A-Za-z_-]+ --> ... block content ... <!-- END [0-9A-Za-z_-]+ --> ]]> </programlisting> The rules for the block name are the same like for placeholders. In contrast to placeholders the spaces in the block markup are required. </para> <para> The nesting of blocks is permitted, but be careful while parsing. You have to set and parse the deepest inner block first and then set and parse from inner to outer. </para> </refsect1> <refsect1 id="packages.it.it.example"> <title>Usage Example</title> <example> <title>The template</title> <programlisting> <![CDATA[ <html> <table border> <!-- BEGIN row --> <tr> <!-- BEGIN cell --> <td> {DATA} </td> <!-- END cell --> </tr> <!-- END row --> </table> </html> ]]> </programlisting> </example> <example> <title>The script</title> <programlisting role="php"> <![CDATA[ <?php require_once "HTML/IT.php"; $data = array ( "0" => array("Stig", "Bakken"), "1" => array("Martin", "Jansen"), "2" => array("Alexander", "Merz") ); $tpl = new IntegratedTemplate("./templates"); $tpl->loadTemplatefile("main.tpl.htm", true, true); foreach($data as $name) { foreach($name as $cell) { // Assign data to the inner block $tpl->setCurrentBlock("cell") ; $tpl->setVariable("DATA", $cell) ; $tpl->parseCurrentBlock("cell") ; } // Assign data and the inner block to the // outer block $tpl->setCurrentBlock("row") ; $tpl->parseCurrentBlock("row") ; } // print the output $tpl->show(); ?> ]]> </programlisting> </example> <example> <title>The output</title> <programlisting> <![CDATA[ <html> <table border> <tr> <td> Stig </td> <td> Bakken </td> </tr> <tr> <td> Martin </td> <td> Jansen </td> </tr> <tr> <td> Alexander </td> <td> Merz </td> </tr> </table> </html> ]]> </programlisting> </example> </refsect1> <refsect1 id="packages.it.it.integratedtemplate"> <title>IntegratedTemplate::IntegratedTemplate</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::IntegratedTemplate</function></funcdef> <paramdef>string <parameter><optional>$root</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Builds some complex regular expressions and optinally sets the file root directory. Make sure that you call this constructor if you derive your templateclass from this one. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$root</parameter> - root directory, prefix for all filenames given to the object. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.get"> <title>IntegratedTemplate::get</title> <funcsynopsis> <funcprototype> <funcdef>string <function>IntegratedTemplate::get</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Returns a block with all replacements done. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to return, when not set the complete template will returned. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.parse"> <title>IntegratedTemplate::parse</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::parse</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> <paramdef>boolean <parameter><optional>$flag_recursion</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Parses the given block. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to parse, when not set the complete template will be parsed. </para> </listitem> <listitem> <para> <parameter>$flag_recursion</parameter> - can be ignored </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.parsecurrentblock"> <title>IntegratedTemplate::parseCurrentBlock</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::parseCurrentBlock</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Parses the current block </para> </refsect1> <refsect1 id="packages.it.it.setvariable"> <title>IntegratedTemplate::setVariable</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setVariable</function></funcdef> <paramdef>mixed <parameter>$placeholder</parameter></paramdef> <paramdef>string <parameter><optional>$variable</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Sets a variable value. The function can be used eighter like setVariable( "varname", "value") or with one array $variables["varname"] = "value" given setVariable($variables). </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$placeholder</parameter> - Name of the placeholder to substitute or a array with the placeholder as key and the data to assign as value. </para> </listitem> <listitem> <para> <parameter>$variable</parameter> - when $placeholder isn't a array, the value to assign to the placeholder. </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.setCurrentBlock"> <title>IntegratedTemplate::parse</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::setCurrentBlock</function></funcdef> <paramdef>string <parameter><optional>$block</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Sets the name of the current block, that is the block where variables are added. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to set, when not given the complete template is set (shows on the placeholders outside of all block). </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on failure, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.touchblock"> <title>IntegratedTemplate::touchBlock</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::touchBlock</function></funcdef> <paramdef> string <parameter>$block</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Preserves an empty block even if removeEmptyBlocks is true </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - block to preserve </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on false, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.init"> <title>IntegratedTemplate::init</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::init</function></funcdef> <paramdef> </paramdef> </funcprototype> </funcsynopsis> <para> Clears all datafields of the object and rebuilds the internal blocklist. LoadTemplatefile() and setTemplate() automatically call this function when a new template is given. Don't use this function unless you know what you're doing. </para> </refsect1> <refsect1 id="packages.it.it.free"> <title>IntegratedTemplate::free</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::free</function></funcdef> <paramdef> </paramdef> </funcprototype> </funcsynopsis> <para> Clears all datafields of the object. Don't use this function unless you know what you're doing. </para> </refsect1> <refsect1 id="packages.it.it.setTemplate"> <title>IntegratedTemplate::setTemplate</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setTemplate</function></funcdef> <paramdef> string <parameter>$template</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Sets the template. You can eighter load a template file from disk with LoadTemplatefile() or set the template manually using this function. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$template</parameter> - content </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.loadTemplatefile"> <title>IntegratedTemplate::loadTemplatefile</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>IntegratedTemplate::loadTemplatefile</function></funcdef> <paramdef>string <parameter>$filename</parameter></paramdef> <paramdef>boolean <parameter><optional>$removeUnknownVariables</optional></parameter></paramdef> <paramdef>boolean <parameter><optional>$removeEmptyBlocks</optional></parameter></paramdef> </funcprototype> </funcsynopsis> <para> Reads a template file from the disk. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$filename</parameter> - name of the template file </para> </listitem> <listitem> <para> <parameter>$removeUnknownVariables</parameter> - when true not assigned placeholders will be deleted </para> </listitem> <listitem> <para> <parameter>$removeEmptyBlocks</parameter> - when true unused blocks will be removed </para> </listitem> </itemizedlist> </para> <para> Returns <itemizedlist> <listitem> <para> <parameter>Boolean</parameter> - false on false, otherwise true </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.setRoot"> <title>IntegratedTemplate::setRoot</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::setRoot</function></funcdef> <paramdef> string <parameter>$root</parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Sets the file root. The file root gets prefixed to all filenames passed to the object. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$root</parameter> - root directory for the templates </para> </listitem> <listitem> <para> <parameter>$removeUnknownVariables</parameter> - when true not assigned placeholders will be deleted </para> </listitem> <listitem> <para> <parameter>$removeEmptyBlocks</parameter> - when true unused blocks will be removed </para> </listitem> </itemizedlist> </para> </refsect1> <refsect1 id="packages.it.it.show"> <title>IntegratedTemplate::show</title> <funcsynopsis> <funcprototype> <funcdef>void <function>IntegratedTemplate::show</function></funcdef> <paramdef> string <parameter><optional>$block</optional></parameter> </paramdef> </funcprototype> </funcsynopsis> <para> Print a certain block with all replacements done. </para> <para> Parameter <itemizedlist> <listitem> <para> <parameter>$block</parameter> - when not set the whole content will be printed. </para> </listitem> </itemizedlist> </para> </refsect1> </refentry> <!-- }}} it.it --> Index: peardoc/en/packages/templates/itx.xml +++ peardoc/en/packages/templates/itx.xml <!-- it.itx {{{ --> <refentry id="packages.it.itx"> <refnamediv> <refname><classname>IntegratedTemplateExtension</classname></refname> <refpurpose> Wrapper class around IntegratedTemplate, compatible to the PHPLIB template system </refpurpose> </refnamediv> <refsect1 id="packages.it.itx.desc"> <title>Description</title> <para> IntegratedTemplateExtension was created as a wrapper class for the <ulink url="&url.phplib">PHPLIB</ulink> template system. It helps you to migrate PHPLIB-based projects to PEAR-based ones. </para> <para> <acronym>ITX</acronym> is API-compatible, but based on <link linkend="packages.it.it">IntegratedTemplate</link>. Due to the different concepts of processing and organizing blocks in a template, the behaviour of itx can differ in some situations. </para> <para> it is not recommended to start a project based ITX. If you want a PHPLIB-styled template system, then you should use <classname>Template_PHPLIB</classname>, which is the PHPLIB template system following the PEAR coding standards. </para> </refsect1> </refentry> <!-- }}} it.itx --> Index: peardoc/en/packages/authentication/auth.xml +++ peardoc/en/packages/authentication/auth.xml <refentry id="packages.Auth.Auth"> <refnamediv> <refname><classname>Auth</classname></refname> <refpurpose> PHP based authentication systems. </refpurpose> </refnamediv> <refsect1 id="packages.Auth.Auth.tutorial"> <title>Usage example</title> <simpara> Our goal during this "mini tutorial" is to set up a system that secures your site with an easy to use authenticatin mechanism. </simpara> <para> At the top of the site that has to be secured, we place the following code snippet: </para> <example> <title>Typical usage example for <classname>PEAR::Auth</classname></title> <programlisting role="php"> <![CDATA[ require_once "Auth/Auth.php"; function loginFunction() { global $PHP_SELF; /** * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"" . $PHP_SELF . "\">"; echo "<input type=\"text\" name=\"username\">"; echo "<input type=\"password\" name=\"password\">"; echo "<input type=\"submit\">"; echo "</form>"; } $dsn = "mysql://user:password@localhost/database"; $a = new Auth("DB", $dsn, "loginFunction"); if ($a->getAuth()) { /** * The output of your site goes here. */ } ]]> </programlisting> </example> <para> This few lines of code instantiate the authentication system. In the following paragraph, we are going to explain every step of the above script: </para> <para> The first line includes the file from your PEAR directory, that contains all the necessary code to run PEAR::Auth. After that we define a function, that display the login formular which the visitor of your page has to use to enter his login data. You can change all the HTML formating in this function. </para> <warning> <simpara> You can change all the HTML formatting in the function, but you mustn't change the names of the input boxes in the function. They have to be "username" and "password". </simpara> </warning> <para> Since we want to use a database to verify the login data against, we now create the variable $dsn, that contains a valid DSN string that will be used to connect to the database via PEAR::DB. If you want to use a different storage container, please see below for more information. </para> <para> After that we create the authentication object: The first parameter defines the name of the storage container. Because we want to use a database driven storage container, we pass "DB" here. The second parameter is the connection parameter for the container driver. We use the previously defined DSN string. The third parameter is the name of our function, we defined at the beginning of the script, that prints the login formular. </para> <para> Now our authentication object is inititated and we simply need to check if the user is logged in. This is done via the function <function>getAuth</function>. If it returns true, we can pass the content of our page to the user. </para> <para> In the following passages you get to know some detailed information about the functions of PEAR::Auth. </para> </refsect1> <refsect1 id="packages.Auth.Auth.Auth"> <title>Auth::Auth</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::Auth</function></funcdef> <paramdef>string <parameter>storageDriver</parameter></paramdef> <paramdef>mixed <parameter>options</parameter></paramdef> <paramdef>string <parameter>loginFunction</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Constructor for the authencation system. The first parameter is the name of the storage driver, that should be used. The second parameter can either be a string containing some login information or an array containing a bunch of options for the storage driver. </para> <para> The third parameter is the name of user-defined function, that prints the login screen. </para> <example> <title>Using different DB parameters</title> <programlisting role="php"> require_once "Auth/Auth.php"; function myOutput($username, $status) { ... /** See example 1 for the full listing */ } $params = array( "dsn" => "mysql://martin:test@localhost/auth", "table" => "myAuth", "usernamecol" => "myUserColumn", "passwordcol" => "myPasswordColumn" ); $a = new Auth("DB", $params, "myOutput"); $a->start(); if ($a->getAuth()) { echo "You have been authenticated successfully."; } </programlisting> </example> <para> This example shows you, how you can specifiy alternative names for the database table and the column names. In our example, we use the table myAuth, select the username from the field myUserColumn and the password from the field myPasswordColumn. The Default values for this fields are auth, username and password. </para> <para> This feature is necessary if you want to use PEAR::Auth with a database layout that is different from the one, PEAR::Auth uses by default. </para> </refsect1> <refsect1 id="packages.Auth.Auth.start"> <title>Auth::start</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::start</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Start the authentication process. </para> </refsect1> <refsect1 id="packages.Auth.Auth.getAuth"> <title>Auth::getAuth</title> <funcsynopsis> <funcprototype> <funcdef>boolean <function>Auth::getAuth</function></funcdef> <paramdef></paramdef> </funcprototype> </funcsynopsis> <para> Check if the user has been authenticated. </para> <para> If the user has already been authenticated, the function returns true. Otherwise it returns false. </para> <para> For usage example, see <function>Auth::Auth</function>. </para> </refsect1> </refentry> Index: peardoc/en/packages/authentication/auth_http.xml +++ peardoc/en/packages/authentication/auth_http.xml <refentry id="packages.Auth.Auth_HTTP"> <refnamediv> <refname><classname>Auth_HTTP</classname></refname> <refpurpose> HTTP authentication with PHP. </refpurpose> </refnamediv> <refsect1 id="packages.Auth.Auth_HTTP.Auth_HTTP"> <title>Auth_HTTP::Auth_HTTP</title> <funcsynopsis> <funcprototype> <funcdef><function>Auth::Auth</function></funcdef> <paramdef>string <parameter>storageDriver</parameter></paramdef> <paramdef>mixed <parameter>options</parameter></paramdef> </funcprototype> </funcsynopsis> <para> Constructor for the authencation system. The first parameter is the name of the storage driver, that should be used. The second parameter can either be a string containing some login information or an array containing a bunch of options for the storage driver. </para> <para> For more information on usage of the constructor parameters, please refer to the documentation of <link linkend="packages.Auth.Auth"> PEAR::Auth</link>. </para> <example> <title>Simple usage example</title> <programlisting role="php"> require_once "Auth_HTTP/Auth_HTTP.php"; $a = new Auth_HTTP("DB", "mysql://test:test@localhost/test"); $a->start(); </programlisting> </example> </refsect1> </refentry>