public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 10) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     if (false !== strpos($content, '<a href')) {
         return $this->errmesg;
     }
     foreach ($this->data['extra'] as $name => $title) {
         if (isset($_POST[$name])) {
             $content .= sprintf("\n\n%s:\n%s", $title, trim($_POST[$name]));
         }
     }
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
 public function processform()
 {
     if (!isset($_POST['contactvalue'])) {
         return '';
     }
     $time = substr($_POST['contactvalue'], strlen('_contactform'));
     if (time() > $time) {
         return $this->errmesg;
     }
     $email = trim($_POST['email']);
     if (!tcontentfilter::ValidateEmail($email)) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'invalidemail'));
     }
     $url = trim($_POST['site']);
     if (empty($url) || strbegin($url, litepublisher::$site->url)) {
         return $this->errmesg;
     }
     if ($s = http::get($url)) {
         if (!strpos($s, '<meta name="generator" content="Lite Publisher')) {
             return $this->errmesg;
         }
     } else {
         return $this->errmesg;
     }
     $content = trim($_POST['content']);
     if (strlen($content) <= 15) {
         return sprintf('<p><strong>%s</strong></p>', tlocal::get('comment', 'emptycontent'));
     }
     $content = "{$url}\n" . $_POST['sitetitle'] . "\n\n" . $content;
     tmailer::sendmail('', $email, '', litepublisher::$options->email, $this->subject, $content);
     return $this->success;
 }
 public function processcomuser(array &$values)
 {
     $lang = tlocal::i('comment');
     if (empty($values['name'])) {
         return $this->geterrorcontent($lang->emptyname);
     }
     $values['name'] = tcontentfilter::escape($values['name']);
     $values['email'] = isset($values['email']) ? strtolower(trim($values['email'])) : '';
     if (!tcontentfilter::ValidateEmail($values['email'])) {
         return $this->geterrorcontent($lang->invalidemail);
     }
     $values['url'] = isset($values['url']) ? tcontentfilter::escape(tcontentfilter::clean_website($values['url'])) : '';
     $values['subscribe'] = isset($values['subscribe']);
 }
 public function reguser($email, $name)
 {
     $email = strtolower(trim($email));
     if (!tcontentfilter::ValidateEmail($email)) {
         return $this->error(tlocal::get('comment', 'invalidemail'));
     }
     if (substr_count($email, '.', 0, strpos($email, '@')) > 2) {
         return $this->error(tlocal::get('comment', 'invalidemail'));
     }
     $users = tusers::i();
     if ($id = $users->emailexists($email)) {
         if ('comuser' != $users->getvalue($id, 'status')) {
             return $this->error(tlocal::i()->invalidregdata);
         }
     }
     tsession::start('reguser-' . md5(litepublisher::$options->hash($email)));
     $_SESSION['email'] = $email;
     $_SESSION['name'] = $name;
     $confirm = md5rand();
     $_SESSION['confirm'] = $confirm;
     $password = md5uniq();
     $_SESSION['password'] = $password;
     $_SESSION['backurl'] = isset($_GET['backurl']) ? $_GET['backurl'] : '';
     session_write_close();
     $args = new targs();
     $args->name = $name;
     $args->email = $email;
     $args->confirm = $confirm;
     $args->password = $password;
     $args->confirmurl = litepublisher::$site->url . '/admin/reguser/' . litepublisher::$site->q . 'email=' . urlencode($email);
     tlocal::usefile('mail');
     $lang = tlocal::i('mailusers');
     $theme = ttheme::i();
     $subject = $theme->parsearg($lang->subject, $args);
     $body = $theme->parsearg($lang->body, $args);
     tmailer::sendmail(litepublisher::$site->name, litepublisher::$options->fromemail, $name, $email, $subject, $body);
     return true;
 }