Exemplo n.º 1
0
 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';
         }
     }
 }
Exemplo n.º 2
0
 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);
 }
 protected function create()
 {
     parent::create();
     $this->section = 'password';
 }
 public function gethead()
 {
     $result = parent::gethead();
     $result .= tadminmenus::i()->heads;
     return $result;
 }