コード例 #1
0
 function performAction()
 {
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         foreach ($this->request as $k => $v) {
             if (isset($v)) {
                 $this->preferencesHandler->setValue($k, $v, 'xoops_http_HttpHandler', $this->domainUser, $this->domainHost, false);
             }
         }
         $this->preferencesHandler->synchronize('xoops_http_HttpHandler', $this->domainUser, $this->domainHost);
         $this->currentView = '';
         $this->responseCode = array(303, XO_("Preferences successfully updated"), $_SERVER['REQUEST_URI']);
     }
 }
コード例 #2
0
ファイル: login.php プロジェクト: BackupTheBerlios/xoops4-svn
require_once '../../../mainfile.php';
global $xoops;
$app =& $xoops->currentModule;
// Read the request params defined in xo-info.php (use default if the var isnt found)
// sanitize them, and create corresponding global vars
extract($app->requestParameters(), EXTR_OVERWRITE);
if (empty($xoops_redirect)) {
    $xoops_redirect = $xoops->path('/www/', true);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    // Check request parameters: if something is wrong, send an HTTP 'bad request' response
    if (empty($login)) {
        return $xoops->services['http']->sendResponse(400, XO_('You must supply a login name'), $_SERVER['REQUEST_URI']);
    } else {
        $auth =& $xoops->loadService('auth');
        if ($login = $auth->checkCredentials($login, $password, '')) {
            $xoops->acceptUser($login, true);
            // Perform some maintenance of notification records
            $notification_handler =& xoops_gethandler('notification');
            $notification_handler->doLoginMaintenance($GLOBALS['xoopsUser']->getVar('uid'));
            return $xoops->services['http']->sendResponse(303, sprintf(XO_('Thank you for logging in, %s'), $login), $xoops_redirect);
        } else {
            return $xoops->services['http']->sendResponse(403, XO_('Incorrect login'), $_SERVER['REQUEST_URI']);
        }
    }
}
$theme =& $xoops->loadService('theme');
$outputVars = array('login' => $login, 'password' => '');
$theme->addStylesheet('mod_xoops_Identification#style.css');
$theme->render(null, null, 'mod_xoops_Identification#templates/page-login.xotpl', $outputVars);
コード例 #3
0
<?php

require_once '../../../mainfile.php';
global $xoops;
if (!$xoops->currentUser) {
    return $xoops->services['http']->sendResponse(303, '', $xoops->url('mod_xoops_Identification#login'));
}
$xoops->services['session']->destroy();
// clear entry from online users table
global $xoopsUser;
$online_handler =& xoops_gethandler('online');
$online_handler->destroy($xoopsUser->getVar('uid'));
return $xoops->services['http']->sendResponse(200, XO_('You are now logged out. Thanks for your visit'), $xoops->url('/www/'));