1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_MODULE_PATH . "/legacy/class/AbstractListAction.class.php";
14: require_once XOOPS_MODULE_PATH . "/legacy/forms/MiscFriendForm.class.php";
15:
16: class Legacy_MiscFriendAction extends Legacy_Action
17: {
18: var $mActionForm = null;
19: var $mMailer = null;
20:
21: function hasPermission(&$controller, &$xoopsUser)
22: {
23: return is_object($xoopsUser);
24: }
25:
26: function prepare(&$controller, &$xoopsUser)
27: {
28: $this->mActionForm =new Legacy_MiscFriendForm();
29: $this->mActionForm->prepare();
30: }
31:
32: function getDefaultView(&$controller, &$xoopsUser)
33: {
34: $this->mActionForm->load($xoopsUser);
35: return LEGACY_FRAME_VIEW_INPUT;
36: }
37:
38: function execute(&$controller, &$xoopsUser)
39: {
40: $this->mActionForm->fetch();
41: $this->mActionForm->validate();
42:
43: if ($this->mActionForm->hasError()) {
44: return LEGACY_FRAME_VIEW_INPUT;
45: }
46:
47: $root =& XCube_Root::getSingleton();
48:
49: $this->mMailer =& getMailer();
50: $this->mMailer->setTemplate("tellfriend.tpl");
51: $this->mMailer->assign("SITENAME", $root->mContext->getXoopsConfig('sitename'));
52: $this->mMailer->assign("ADMINMAIL", $root->mContext->getXoopsConfig('adminmail'));
53: $this->mMailer->assign("SITEURL", XOOPS_URL . '/');
54:
55: $this->mActionForm->update($this->mMailer);
56:
57: $root->mLanguageManager->loadPageTypeMessageCatalog("misc");
58:
59: $this->mMailer->setSubject(sprintf(_MSC_INTSITE, $root->mContext->getXoopsConfig('sitename')));
60:
61: return $this->mMailer->send() ? LEGACY_FRAME_VIEW_SUCCESS : LEGACY_FRAME_VIEW_ERROR;
62: }
63:
64: function executeViewInput(&$controller, &$xoopsUser, &$render)
65: {
66: $render->setTemplateName("legacy_misc_friend.html");
67: $render->setAttribute('actionForm', $this->mActionForm);
68: }
69:
70: function executeViewSuccess(&$controller, &$xoopsUser, &$render)
71: {
72: $render->setTemplateName("legacy_misc_friend_success.html");
73: }
74:
75: function executeViewError(&$controller, &$xoopsUser, &$render)
76: {
77: $render->setTemplateName("legacy_misc_friend_error.html");
78: $render->setAttribute('xoopsMailer', $this->mMailer);
79: }
80: }
81:
82: ?>
83: