Esempio n. 1
0
 private static function validateCaptcha($context, GWF_Form $form, $validator, $key)
 {
     if (GWF_Session::getOrDefault('php_captcha', false) !== strtoupper($form->getVar($key))) {
         $form->onNewCaptcha();
         return GWF_HTML::lang('ERR_WRONG_CAPTCHA');
     }
     //		GWF_Session::remove('php_captcha');
     $form->onSolvedCaptcha();
     return false;
 }
Esempio n. 2
0
function ttr2_request(WC_Challenge $chall, GWF_Form $form)
{
    if (false !== ($errors = $form->validate($chall))) {
        return $errors;
    }
    # Generate reset token
    $sid = GWF_Session::getSessSID();
    $email = $form->getVar('email');
    $token = ttr2_random(16);
    if (!TTR2_Tokens::insertToken($sid, $email, $token)) {
        return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
    }
    # If it's your own real mail, even send it for the lulz :)
    if ($email === GWF_User::getStaticOrGuest()->getValidMail()) {
        ttr2_mail_me($chall, $email, $token);
    }
    return GWF_HTML::message($chall->lang('title'), $chall->lang('msg_mail_sent'));
}
Esempio n. 3
0
 private function createNewPM(GWF_Form $form)
 {
     return GWF_PM::fakePM($this->user->getID(), $this->getReceiver()->getID(), $form->getVar('title'), $form->getVar('message'));
 }
Esempio n. 4
0
 private function uploadedFile(GWF_Form $form)
 {
     if (false === ($file = $form->getVar('file'))) {
         //			echo $this->module->error('err_file');
         return;
     }
     $tempname = 'dbimg/dl/' . basename($file['tmp_name']);
     if (false === ($file = GWF_Upload::moveTo($file, $tempname))) {
         echo GWF_HTML::err('ERR_WRITE_FILE', array($tempname));
     }
     GWF_Session::set(self::SESS_FILE, $file);
 }
Esempio n. 5
0
 private function getPageObject(GWF_Form $form)
 {
     $options = 0;
     $options |= GWF_Page::ENABLED;
     $options |= isset($_POST['noguests']) ? GWF_Page::LOGIN_REQUIRED : 0;
     $options |= isset($_POST['show_author']) ? GWF_Page::SHOW_AUTHOR : 0;
     $options |= isset($_POST['show_similar']) ? GWF_Page::SHOW_SIMILAR : 0;
     $options |= isset($_POST['show_modified']) ? GWF_Page::SHOW_MODIFIED : 0;
     $options |= isset($_POST['show_trans']) ? GWF_Page::SHOW_TRANS : 0;
     $options |= isset($_POST['show_comments']) ? GWF_Page::COMMENTS : 0;
     if ($this->is_author) {
         $options |= isset($_POST['index']) ? GWF_Page::INDEXED : 0;
         $options |= isset($_POST['follow']) ? GWF_Page::FOLLOW : 0;
         $options |= isset($_POST['sitemap']) ? GWF_Page::IN_SITEMAP : 0;
     }
     $options |= $this->locked_mode ? GWF_Page::LOCKED : 0;
     $options |= $form->getVar('type');
     $gstring = $this->buildGroupString();
     $tags = ',' . trim($form->getVar('tags'), ' ,') . ',';
     $page = new GWF_Page(array('page_id' => '0', 'page_otherid' => '0', 'page_lang' => $form->getVar('lang'), 'page_author' => GWF_Session::getUserID(), 'page_author_name' => GWF_User::getStaticOrGuest()->getVar('user_name'), 'page_groups' => $gstring, 'page_create_date' => GWF_Time::getDate(GWF_Time::LEN_SECOND), 'page_date' => GWF_Time::getDate(GWF_Time::LEN_SECOND), 'page_time' => time(), 'page_url' => $form->getVar('url'), 'page_title' => $form->getVar('title'), 'page_cat' => '0', 'page_meta_tags' => $tags, 'page_meta_desc' => $form->getVar('descr'), 'page_content' => $form->getVar('content'), 'page_views' => '0', 'page_options' => $options, 'page_inline_css' => $form->getVar('inline_css', NULL)));
     return $page;
 }
Esempio n. 6
0
 private function templatePreview(GWF_Form $form)
 {
     $tVars = array('pm' => GWF_PM::fakePM($this->pm->getSender()->getID(), $this->pm->getReceiver()->getID(), $form->getVar('title'), $form->getVar('message')), 'actions' => false, 'title' => $this->module->lang('ft_preview'), 'unread' => array());
     return $this->module->templatePHP('show.php', $tVars);
 }
Esempio n. 7
0
 /**
  * Return all values from the form except buttons.
  * @param GWF_Form $form
  * @return array
  */
 public static function getFormVars(GWF_Form $form)
 {
     $back = array();
     foreach ($form->getFormData() as $key => $d) {
         switch ($d[0]) {
             case GWF_Form::HIDDEN:
             case GWF_Form::SUBMIT:
             case GWF_Form::SUBMITS:
             case GWF_Form::SUBMIT_IMG:
             case GWF_Form::SUBMIT_IMGS:
                 break;
             default:
                 $back[$key] = $form->getVar($key, '');
         }
     }
     return $back;
 }