public function request($arg)
 {
     if (!litepublisher::$options->usersenabled || !litepublisher::$options->reguser) {
         return 403;
     }
     parent::request($arg);
     if (!empty($_GET['confirm'])) {
         $confirm = $_GET['confirm'];
         $email = $_GET['email'];
         tsession::start('reguser-' . md5(litepublisher::$options->hash($email)));
         if (!isset($_SESSION['email']) || $email != $_SESSION['email'] || $confirm != $_SESSION['confirm']) {
             if (!isset($_SESSION['email'])) {
                 session_destroy();
             }
             $this->regstatus = 'error';
             return;
         }
         $this->backurl = $_SESSION['backurl'];
         $users = tusers::i();
         $id = $users->add(array('password' => $_SESSION['password'], 'name' => $_SESSION['name'], 'email' => $_SESSION['email']));
         session_destroy();
         if ($id) {
             $this->regstatus = 'ok';
             $expired = time() + 31536000;
             $cookie = md5uniq();
             litepublisher::$options->user = $id;
             litepublisher::$options->updategroup();
             litepublisher::$options->setcookies($cookie, $expired);
         } else {
             $this->regstatus = 'error';
         }
     }
 }
 public function request($arg)
 {
     $this->cache = false;
     if (!($this->iduser = litepublisher::$options->user)) {
         //trick - hidden registration of comuser. Auth by get
         $users = tusers::i();
         if (isset($_GET['auth']) && ($cookie = trim($_GET['auth']))) {
             if (($this->iduser = $users->findcookie($cookie)) && litepublisher::$options->reguser) {
                 if ('comuser' == $users->getvalue($this->iduser, 'status')) {
                     // bingo!
                     $this->newreg = true;
                     $item = $users->getitem($this->iduser);
                     $item['status'] = 'approved';
                     $item['password'] = '';
                     $item['idgroups'] = 'commentator';
                     $cookie = md5uniq();
                     $expired = time() + 31536000;
                     $item['cookie'] = litepublisher::$options->hash($cookie);
                     $item['expired'] = sqldate($expired);
                     $users->edit($this->iduser, $item);
                     litepublisher::$options->user = $this->iduser;
                     litepublisher::$options->updategroup();
                     litepublisher::$options->setcookie('litepubl_user_id', $this->iduser, $expired);
                     litepublisher::$options->setcookie('litepubl_user', $cookie, $expired);
                 } else {
                     $this->iduser = false;
                 }
             }
         }
     }
     if (!$this->iduser) {
         $url = litepublisher::$site->url . '/admin/login/' . litepublisher::$site->q . 'backurl=' . rawurlencode('/admin/subscribers/');
         return litepublisher::$urlmap->redir($url);
     }
     if ('hold' == tusers::i()->getvalue($this->iduser, 'status')) {
         return 403;
     }
     return parent::request($arg);
 }
 public function request($arg)
 {
     if ($arg == 'out') {
         return $this->logout($arg);
     }
     parent::request($arg);
     $this->section = 'login';
     if (!isset($_POST['email']) || !isset($_POST['password'])) {
         return turlmap::nocache();
     }
     $email = trim($_POST['email']);
     $password = trim($_POST['password']);
     if ($mesg = self::autherror($email, $password)) {
         $this->formresult = $this->html->h4red($mesg);
         return turlmap::nocache();
     }
     $expired = isset($_POST['remember']) ? time() + 31536000 : time() + 8 * 3600;
     $cookie = md5uniq();
     litepublisher::$options->setcookies($cookie, $expired);
     litepublisher::$options->setcookie('litepubl_regservice', 'email', $expired);
     $url = !empty($_GET['backurl']) ? $_GET['backurl'] : (!empty($_GET['amp;backurl']) ? $_GET['amp;backurl'] : (isset($_COOKIE['backurl']) ? $_COOKIE['backurl'] : ''));
     if ($url && strbegin($url, litepublisher::$site->url)) {
         $url = substr($url, strlen(litepublisher::$site->url));
     }
     if ($url && (strbegin($url, '/admin/login/') || strbegin($url, '/admin/password/'))) {
         $url = false;
     }
     if (!$url) {
         $url = '/admin/';
         if (litepublisher::$options->group != 'admin') {
             $groups = tusergroups::i();
             $url = $groups->gethome(litepublisher::$options->group);
         }
     }
     litepublisher::$options->setcookie('backurl', '', 0);
     turlmap::nocache();
     return litepublisher::$urlmap->redir($url);
 }