Example #1
0
 protected function _register()
 {
     if (!Config::get("enable_registration")) {
         $this->_smarty->assign('page_title', "Rejestracja chwilowo niedost�na.");
         $this->_template = "reg-disabled.tpl";
         return;
     }
     $register_ok = false;
     if (!empty($_POST['submit'])) {
         $user = new User(0);
         $pid = $user->register($_POST);
         $user = new User($pid);
         if (Config::get("account_activation", 0)) {
             $user->sendActivation($this->url('activate'));
         } else {
             $user->activate($user->dbdata('user_activation'), $this->url('login'));
         }
         $register_ok = true;
     }
     $user_login = Utils::p('user_login');
     $user_email = Utils::p('user_email');
     $this->_smarty->assign('login', $user_login);
     $this->_smarty->assign('email', $user_email);
     $this->_smarty->assign('register_action', $this->url('register'));
     $this->_smarty->assign('page_title', "Rejestracja");
     $this->_smarty->assign('need_activation', Config::get("account_activation"));
     if ($register_ok) {
         $this->_template = "registered.tpl";
     } else {
         $this->_template = "register-form.tpl";
     }
 }
Example #2
0
function action_register()
{
    global $smarty, $url, $ref, $template, $db, $page, $count;
    if (!Config::get("enable_registration")) {
        $smarty->assign('page_title', "Rejestracja chwilowo niedostêpna.");
        $template = "reg-disabled";
        return;
    }
    $register_ok = false;
    if (!empty($_POST['submit'])) {
        $user = new User(0);
        try {
            $pid = $user->register($_POST);
            $user = new User($pid);
            if (Config::get("account_activation", 0)) {
                $user->sendActivation(url('activate'));
            } else {
                $user->activate($user->_dbo->user_activation, url('login'));
            }
            $register_ok = true;
        } catch (Exception2 $e) {
            $smarty->assign('error', 1);
            $smarty->assign('error_title', $e->getMessage());
            $smarty->assign('error_description', $e->getDescription());
        }
    }
    $user_login = Utils::p('user_login');
    $user_email = Utils::p('user_email');
    $smarty->assign('login', $user_login);
    $smarty->assign('email', $user_email);
    $smarty->assign('register_action', url('register'));
    $smarty->assign('page_title', "Rejestracja");
    $smarty->assign('need_activation', Config::get("account_activation"));
    if ($register_ok) {
        $template = "registered";
    } else {
        $template = "register";
    }
}