// generate a code, and store it someplace
 // but that means we gotta clean these things up
 // from time to time.
 $code = $this->GenerateRandomPrintableString();
 if (!$this->SetUserTempCode($uid, $code)) {
     $params['error'] = 1;
     $params['message'] = $this->Lang('error_resetalreadysent');
     $params['form'] = 'forgotpw';
     $this->myRedirect($id, 'default', $returnid, $params);
     return;
 }
 // send our funky email
 $page = $this->GetPreference('pageidforgotpasswd');
 $pid = $returnid;
 if ($page) {
     $tpid = ContentManager::GetPageIDFromAlias($page);
     if ($tpid != false) {
         $pid = $tpid;
     }
 }
 $this->smarty->assign('message_forgotpwemail', $this->Lang('message_forgotpwemail'));
 $this->smarty->assign('prompt_code', $this->Lang('message_code'));
 $this->smarty->assign('data_code', $code);
 $this->smarty->assign('prompt_link', $this->Lang('prompt_link'));
 $parms = array('input_uid' => $uid, 'input_code' => $code);
 $config =& $gCms->GetConfig();
 $prettyurl = "feu/verify/{$pid}/{$uid}/{$code}";
 $link = $this->CreateLink($id, 'verifycode', $pid, '', $parms, '', true, false, '', false, $prettyurl);
 $this->smarty->assign('data_link', $this->CreateLink($id, 'verifycode', $pid, $link, $parms));
 $this->smarty->assign('data_url', $link);
 $body = $this->ProcessTemplateFromDatabase('feusers_forgotpasswordemailform');
            // get everything into smarty.
            $params['nooutput'] = 1;
            include dirname(__FILE__) . '/action.detail.php';
            $cmsmailer->reset();
            $cmsmailer->SetSubject($subject);
            $cmsmailer->IsHTML(true);
            foreach ($addresses as $one) {
                $cmsmailer->AddAddress($one);
            }
            $body = $this->ProcessTemplateFromDatabase('upload_sendfilerpt');
            $cmsmailer->SetBody($body);
            $cmsmailer->Send();
            // now try to redirect to a different page
            $str = $this->GetPreference('redirect_on_sendfile');
            if ($str != '') {
                $tmp = ContentManager::GetPageIDFromAlias($str);
                if ($tmp) {
                    $this->RedirectContent($tmp);
                    return;
                }
            }
            // redirect isn't set... so display a nice message.
            $message = $this->Lang('msg_file_sent');
        }
    }
}
// give everything to smarty
if (!empty($error)) {
    $smarty->assign('error', $error);
}
if (!empty($message)) {
 function _ExportLoggedInUserVariables($id, &$params, $returnid)
 {
     // replace {$username} with the user name
     $uid = $this->LoggedInId();
     if (!$uid) {
         return;
     }
     $username = $this->LoggedInName();
     // replace {$groupname} with the first groupname we can find that matches
     $smarty = cmsms()->GetSmarty();
     $groups = $this->GetMemberGroupsArray($uid);
     $groupname = $this->GetGroupName($groups[0]['groupid']);
     $smarty->assign('userid', $uid);
     $smarty->assign('username', $username);
     $smarty->assign('link_logout', $this->CreateLink($id, "logout", $returnid, $this->Lang('logout')));
     $prettyurl_logout = 'feu/logout/' . $returnid;
     $logout_feu = $this->CreateLink($id, 'logout', $returnid, '', array(), '', true, false, '', false, $prettyurl_logout);
     $smarty->assign('url_logout', $logout_feu);
     $page = $this->ProcessTemplateFromData($this->GetPreference('pageid_changesettings'));
     if ($page) {
         $pageid = ContentManager::GetPageIDFromAlias($page);
         if ($pageid == false) {
             $smarty->assign('link_changesettings', '<!-- Error could not determine page from alias/id -->');
         } else {
             $smarty->assign('link_changesettings', $this->CreateLink($id, 'default', $pageid, $this->Lang('prompt_changesettings'), array('form' => 'changesettings')));
             //nuno-dev-Pretty Url's
             $prettyurl_changesettings = 'feu/edit/' . $pageid;
             $changesettings_feu = $this->CreateLink($id, 'default', $pageid, '', array('form' => 'changesettings'), '', true, false, '', false, $prettyurl_changesettings);
             $smarty->assign('url_changesettings', $changesettings_feu);
             //end
         }
     } else {
         $smarty->assign('link_changesettings', $this->CreateLink($id, 'default', $returnid, $this->Lang('prompt_changesettings'), array('form' => 'changesettings')));
         //nuno-dev-Pretty Url's
         $prettyurl_changesettings = 'feu/edit/' . $returnid;
         $changesettings_feu = $this->CreateLink($id, 'default', $returnid, '', array('form' => 'changesettings'), '', true, false, '', false, $prettyurl_changesettings);
         $smarty->assign('url_changesettings', $changesettings_feu);
         //end
     }
     $props = $this->GetUserProperties($this->LoggedInId());
     foreach ($props as $p) {
         $smarty->assign($p['title'], $p['data']);
     }
 }