[cvs] [Wiki] changed: Doc/Dev/LegacyApps

Jan Schneider jan at horde.org
Tue Sep 4 20:03:02 UTC 2007


jan  Tue, 04 Sep 2007 13:03:02 -0700

Modified page: http://wiki.horde.org/Doc/Dev/LegacyApps
New Revision:  1.4
Change log:  Set AUTH_HANDLER

@@ -19,9 +19,8 @@
 $registry = &Registry::singleton();

 // Call a Registry method.
 $calendars = $registry->call('calendar/listCalendars');
-
 </code>

 That's it. Assuming that you configured Horde's permissions to allow guest
access to Kronolith, the calendar application, you will get an array with
calendar names back. If there are no calendars that allow guest access, the
array will be empty.

@@ -31,8 +30,11 @@
 <?php

 // Define path to Horde.
 define('HORDE_BASE', '/path/to/horde');
+
+// Tell the registry that we are doing authentication ourselves.
+define('AUTH_HANDLER', true);

 // Load the Horde Framework core, and set up inclusion paths.
 require_once HORDE_BASE . '/lib/core.php';

@@ -44,16 +46,17 @@
 $auth->setAuth('username', array('password' => 'foo'));

 // Call a Registry method.
 $calendars = $registry->call('calendar/listCalendars');
-
 </code>

-We only added two lines, one to create an Auth object, and one to set the
current active user. Note that these calls don't really authenticate the
user, they only make Horde think that the specified user is authenticated.
The {{'password'}} argument can have any value, as long as it isn't needed
later, for example to //really// authenticate to a IMAP server.
+We only added three lines, one to tell the Registry object to not care
about authentication, one to create an Auth object, and one to set the
current active user. Note that these calls don't really authenticate the
user, they only make Horde think that the specified user is authenticated.
The {{'password'}} argument can have any value, as long as it isn't needed
later, for example to //really// authenticate to a IMAP server.

 If you want to check authentication, or need to access a backend that
requires a valid login, use the following calls to the Auth library instead:

 <code type="php">
+<?php
+
 $auth = &Auth::singleton($conf['auth']['driver']);
 $authenticated = $auth->authenticate('username', array('password' =>
'realpassword'));
 </code>

@@ -67,8 +70,10 @@

 To embed a simple month calender for example, all you have to do is:

 <code type="php">
+<?php
+
 echo $registry->call('horde/blockContent',
                      array('kronolith', 'month', array('calendar' =>
'jan')));
 </code>

@@ -77,8 +82,10 @@
 As Horde is using CSS for all styling and the CSS rules are not included in
the HTML, the local CSS need to tweaked to give the block a nice look.
 One could also use Horde's CSS files, but these would be applied to the
complete page:

 <code type="php">
+<?php
+
 echo Horde::stylesheetLink('kronolith', 'mozilla');
 </code>

 Such a call would have to happen after the Registry has been initialized,
and so that the output is echoed in the page's HTML HEAD.


More information about the cvs mailing list