* * See the enclosed file COPYING for license information (GPL). If you * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. */ @define('CUPID_BASE', dirname(__FILE__)); require_once CUPID_BASE . '/lib/base.php'; $friends = Cupid_Friends::singleton(); require_once 'Horde/Form.php'; require_once 'Horde/Form/Renderer.php'; require_once 'Horde/Variables.php'; $vars = &Variables::getDefaultVariables(); $title = _("Add Friend"); /* Get the form object. */ $form = &Horde_Form::singleton('', $vars, $title); /* Set up the form. */ $form->setButtons(_("Send Request"), true); $form->addVariable(_("Friend's Name"), 'friend', 'text', true); $form->addVariable(_("Comment"), 'comment', 'text', false); if ($form->validate($vars)) { $form->getInfo($vars, $info); /* Store this forum object and get back a new forum_id. */ $friendship_id = $friends->requestFriendship($info['friend'], $info['comment']); if (is_a($friendship_id, 'PEAR_Error')) { $notification->push($friendship_id); } else { $notification->push(_("Your friendship request has been sent to ${info['friend']}."), 'horde.success'); // Empty out the old form data. $vars = new Variables; } } require CUPID_TEMPLATES . '/common-header.inc'; require CUPID_TEMPLATES . '/menu.inc'; $notification->notify(); $renderer = &new Horde_Form_Renderer(); $form->open($renderer, $vars, 'friends.php', 'post'); $renderer->beginActive($form->getTitle()); $renderer->renderFormActive($form, $vars); $renderer->submit(); $renderer->end(); print_r($friends->getFriends());