protected function request()
 {
     $f = new Form();
     $f->start($_POST);
     $f->radio('dest', 'Screen', 'screen');
     $f->hspace(2);
     $f->radio('dest', 'PDF', 'pdf', false);
     $f->button('action_report', 'Report');
     $f->end();
 }
Example #2
0
    function defaultAction()
    {
        $subjects = array(1 => array('id' => 1, 'title' => s('General question')), 2 => array('id' => 2, 'title' => s('Bug report')), 3 => array('id' => 3, 'title' => s('Collaboration or partership')), 4 => array('id' => 4, 'title' => s('Idea')), 5 => array('id' => 5, 'title' => s('Other')));
        $html = '';
        $errors = array();
        $is_posted = request_int('is_posted');
        $jump_to = 'feedback_name';
        if ($is_posted) {
            if (!count($errors) && !request_str('email')) {
                $errors[] = s('Please, enter your email');
                $jump_to = 'feedback_email';
            }
            if (!count($errors) && request_str('email') && !filter_var(request_str('email'), FILTER_VALIDATE_EMAIL)) {
                $errors[] = s('Please, provide correct email address. For example: john@gmail.com');
                $jump_to = 'feedback_email';
            }
            if (!count($errors) && !request_str('message')) {
                $errors[] = s('Enter the message.');
                $jump_to = 'feedback_password';
            }
            if (!count($errors)) {
                $data = array('{name}' => request_str('name'), '{email}' => request_str('email'), '{subject}' => $subjects[request_int('subject_id')]['title'], '{message}' => request_str('message'));
                $message = str_replace(array_keys($data), array_values($data), 'Name: {name}
Email: {email}

Subject: {subject}

{message}


' . $_SERVER['REMOTE_ADDR'] . ' ' . date('r'));
                core::$sql->insert(array('message' => core::$sql->s($message), 'insert_stamp' => core::$sql->i(time())), DB . 'feedback');
                require_once '../mod/lib.mail.php';
                foreach (array('*****@*****.**') as $email) {
                    mail_send(request_str('name'), request_str('email'), $email, 'Metro4all.org - ' . $subjects[request_int('subject_id')]['title'], $message, false);
                }
                go(Core::$config['http_home'] . 'feedback/?action=ok');
            }
        }
        $page = new PageCommon(s('Feedback'));
        $html .= $page->start();
        $html .= '<div class="row"><div class="col-md-offset-2 col-md-8"><h2>' . s('Feedback') . '</h2>';
        if (count($errors)) {
            $html .= '<div class="alert alert-danger"><p>' . escape($errors[0]) . '</p></div>';
        }
        $form = new Form('feedback', false, 'post');
        $html .= '<div class="well">' . $form->start() . $form->addVariable('is_posted', 1) . $form->addString('name', s('Name'), $is_posted ? request_str('name') : '') . $form->addString('email', s('E-mail'), $is_posted ? request_str('email') : '', array('is_required' => true)) . $form->addSelect('subject_id', s('Subject'), $is_posted ? request_int('subject_id') : 1, array('data' => $subjects)) . $form->addText('message', s('Message'), $is_posted ? request_str('message') : '', array('is_required' => true, 'style' => 'height:200px')) . $form->submit(s('Send')) . '</div>';
        $html .= '<script> $(document).ready(function() { $("#' . $jump_to . '").focus(); }); </script>';
        $html .= '</div></div>';
        $html .= $page->stop();
        return $html;
    }
 protected function request()
 {
     $f = new Form();
     $f->start($_POST);
     $f->radio('dest', 'Screen', 'screen');
     $f->hspace(2);
     $f->radio('dest', 'PDF', 'pdf', false);
     $f->hspace(2);
     $f->radio('dest', 'CSV', 'csv', false);
     $f->text('year', 'Year:', 30, 'YYYY');
     $f->button('action_report', 'Report', false);
     $f->end();
 }
 function defaultAction()
 {
     $html = '';
     $errors = array();
     $is_posted = request_int('is_posted');
     $jump_to = 'subscription_email';
     if ($is_posted) {
         // $captcha_code = request_str('captcha_code');
         if (!count($errors) && !request_str('email')) {
             $errors[] = s('Please, enter your email');
             $jump_to = 'register_email';
         }
         if (!count($errors) && request_str('email') && !filter_var(request_str('email'), FILTER_VALIDATE_EMAIL)) {
             $errors[] = s('Please, provide correct email address. For example: john@gmail.com');
             $jump_to = 'register_email';
         }
         // if(captcha_compare(request_str('captcha_code'))) {
         //	captcha_close();
         if (!count($errors)) {
             // file_put_contents('data/subscription.txt', "\r\n" . request_str('email'), FILE_APPEND | LOCK_EX);
             core::$sql->insert(array('email' => core::$sql->s(request_str('email')), 'insert_stamp' => core::$sql->i(time())), DB . 'subscription');
             /*
             			        switch (request_int('language_id')) {
             			        	case 1: mail('*****@*****.**', 'subscribe gisconf '.request_str('email'), '*password: Oov4eeph', 'From: news@gisconf.ru'); break;
             			        	case 2: mail('*****@*****.**', 'subscribe gisconf-en '.request_str('email'), '*password: Oov4eeph', 'From: news-en@gisconf.ru'); break;
             			        }
             */
             go(core::$config['http_home'] . 'subscription/?action=ok');
         }
         // }
         // else
         //	$errors []= 'Неверный код подтверждения';
     }
     $page = new PageCommon(s('Newsletter'));
     $html .= $page->start();
     $html .= '<div class="row"><div class="col-md-offset-1 col-md-6"><h1>' . s('Newsletter') . '</h1>';
     if (count($errors)) {
         $html .= '<div class="alert alert-danger"><p>' . escape($errors[0]) . '</p></div>';
     }
     $form = new Form('subscription', false, 'post');
     $html .= '<div class="well">' . $form->start() . $form->addVariable('is_posted', 1) . $form->addString('email', s('E-mail'), $is_posted ? request_str('email') : '', array('is_required' => true)) . $form->submit(s('Subscribe')) . '</div>';
     $html .= '<script> $(document).ready(function() { $("#' . $jump_to . '").focus(); }); </script>';
     $html .= '</div></div>';
     $html .= $page->stop();
     return $html;
 }
Example #5
0
<?php

include 'classes/Form.php';
$form = new Form();
echo $form->start("form-inline");
$form->setRadioName("mama");
echo @$form->getUrl();
echo $form->close();
Example #6
0
 function lostPasswordChangeAction()
 {
     if (($user = core::$sql->row('id, password', DB . 'user', 'id=' . core::$sql->i(request_int('id', true)) . ' and id<>' . core::$sql->i(User::ANONIMOUS) . ' and is_disabled=0')) === false) {
         out();
     }
     if (($hash = core::$user->getHash(core::$config['user']['lost_password_salt'], $user['password'])) != request_str('code', true)) {
         out();
     }
     $html = '';
     $errors = array();
     $is_posted = request_int('is_posted');
     $jump_to = 'lost_password_change_password';
     if ($is_posted) {
         // $captcha_code = request_str('captcha_code');
         if (!count($errors) && !request_str('password')) {
             $errors[] = s('Пожалуйста, укажите пароль.');
         }
         if (!count($errors) && request_str('password') != request_str('password2')) {
             $errors[] = s('Введенные пароли не совпадают. Пожалуйста, попробуйте еще раз.');
         }
         // if(captcha_compare(request_str('captcha_code'))) {
         //	captcha_close();
         if (!count($errors)) {
             $password_hash = core::$user->getHash(core::$config['user']['password_salt'], request_str('password'));
             core::$sql->update(array('password' => core::$sql->s($password_hash)), DB . 'user', 'id=' . core::$sql->i($user['id']));
             core::$user->logout();
             go(core::$config['http_home'] . 'lost_password/changed/');
         }
         // }
         // else
         //	$errors []= 'Неверный код подтверждения';
     }
     $page = new PageCommon(s('Смена пароля'));
     $html .= $page->start();
     $html .= '<div class="row"><div class="span4 offset4"><h2>' . s('Смена пароля') . '</h2>';
     if (count($errors)) {
         $html .= '<div class="alert alert-danger"><p>' . escape($errors[0]) . '</p></div>';
     }
     $form = new Form('lost_password_change', false, 'post');
     $html .= '<div class="well">' . $form->start() . $form->addVariable('is_posted', 1) . $form->addVariable('id', request_int('id')) . $form->addVariable('code', request_str('code')) . $form->addPassword('password', s('Пароль'), '', array('is_required' => true)) . $form->addPassword('password2', s('Подтверждение пароля'), '', array('is_required' => true)) . $form->submit(s('Сохранить')) . '</div>';
     /*
     $html .= '<ul>
     		<li><a href="'  .core::$config['http_home'] . 'login/">' . s('Вход для зарегистрированных') . '</a></li>
     	</ul>';
     */
     $html .= '<script> $(document).ready(function() { $("#' . $jump_to . '").focus(); }); </script>';
     $html .= '</div></div>';
     $html .= $page->stop();
     return $html;
 }
Example #7
0
<?php

$form = new Form();
$form->attributes = "name='userform' id='userform'";
?>

<div id="mainpage">
	<?php 
$form->start();
?>
	<h1>Edit User Account: <?php 
echo $currentuser->firstname . " " . $currentuser->lastname;
?>
</h1>
	<table border='0'>
		<tr>
			<td>
				<?php 
$form->element('id', 'hidden', $currentuser->id);
?>
				<?php 
$form->label('firstname', "First Name: ");
?>
			</td>
			<td>
				<?php 
$form->attributes = "maxlength='32' size='15'";
?>
				<?php 
$form->element('firstname', 'text', $currentuser->firstname);
?>
Example #8
0
<?php

$form = new Form();
$form->attributes = "name='registerform' id='registerform'";
?>

<div id="centerpage">
	<?php 
$form->start('login.php', 'post');
?>
	<table border='0'>
		<tr>
			<td colspan='2'>
				<img border="0" src="images/sipenlogo.gif" width="374" height="64"><br>
				<font size='+1' color='#0000cc'>
					<b>Sipen Account Login</b><br><br>
				</font>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
$form->label('username', "Username: "******"slabel");
?>
			</td>
			<td>
				<?php 
$form->attributes = "maxlength='32' size='25'";
$form->element('username', 'text', $username);
?>
			</td>
Example #9
0
}
?>
<html>
<head>
<?php 
echo admin_pagehead();
?>
</head>
<body>
<?php 
if (!isset($_SESSION["user"]) || !isset($_SESSION["pass"]) || isset($login_err)) {
    //管理ログイン
    if (isset($login_err)) {
        echo $login_err;
    }
    echo $form->start();
    echo $form->load_xml_file($form_login_xml);
    echo $form->close();
    ?>
管理者ユーザー名とパスワードを入力してください
</body>
</html>
<?php 
} else {
    //ログイン済
    $count = $data->select_all_l("*", $table, $page, $PAGESIZE, "id desc");
    ?>
<h3>* * Infomation List * *</h3>
<?php 
    echo $form->start();
    echo $form->submit("logout", "ログアウト");
Example #10
0
    function updateAction()
    {
        if (!$this->is_admin) {
            go(core::$config['http_home'] . 'faq/');
        }
        if (($item = $this->getQa(request_int('id'))) === false) {
            go(core::$config['http_home']);
        }
        $html = '';
        $errors = array();
        $is_posted = request_int('is_posted');
        $jump_to = 'update_qa_title';
        if ($is_posted) {
            if (!count($errors) && !request_str('title')) {
                $errors[] = s('Пожалуйста, укажите вопрос.');
                $jump_to = 'update_qa_title';
            }
            if (!count($errors) && !request_str('group_title')) {
                $errors[] = s('Пожалуйста, укажите группу.');
                $jump_to = 'insert_qa_group_title';
            }
            if (!count($errors)) {
                $fields = array();
                foreach (Core::$config['languages'] as $url => $languages) {
                    $fields['title_' . $url] = core::$sql->s(request_str('title_' . $url));
                    $fields['group_title_' . $url] = core::$sql->s(request_str('group_title_' . $url));
                    $fields['description_' . $url] = core::$sql->s(request_str('description_' . $url));
                }
                core::$sql->update($fields, DB . 'qa', 'id=' . core::$sql->i($item['id']));
                go(core::$config['http_home'] . 'faq/');
            }
        }
        $page = new PageCommon(s('Изменить вопрос'));
        $html .= $page->start();
        $html .= '<p><a href="./">' . s('Q&A') . '</a> &rarr;</p>
				<h2>' . s('Изменить вопрос') . '</h2>';
        if (count($errors)) {
            $html .= '<div class="alert alert-error"><p>' . escape($errors[0]) . '</p></div>';
        }
        $form = new Form('update_qa', false, 'post');
        $html .= '<div class="well">' . $form->start() . $form->addVariable('is_posted', 1) . $form->addVariable('action', 'update');
        foreach (Core::$config['languages'] as $url => $language) {
            $html .= $form->addString('title_' . $url, s('Вопрос') . ' ' . $language['title'], $is_posted ? request_str('title_' . $url) : $item['title_' . $url], array('class' => 'span7'));
        }
        foreach (Core::$config['languages'] as $url => $language) {
            $html .= $form->addString('group_title_' . $url, s('Группа') . ' ' . $language['title'], $is_posted ? request_str('group_title_' . $url) : $item['group_title_' . $url], array('class' => 'span7'));
        }
        foreach (Core::$config['languages'] as $url => $language) {
            $html .= $form->addString('description_' . $url, s('Ответ') . ' ' . $language['title'], $is_posted ? request_str('description_' . $url) : $item['description_' . $url], array('class' => 'span7', 'style' => 'height:250px;'));
        }
        $html .= $form->submit(s('Update')) . '</div>';
        $html .= '<script> $(document).ready(function() { $("#' . $jump_to . '").focus(); }); </script>';
        $html .= $page->stop();
        return $html;
    }
Example #11
0
<?php

$form = new Form();
$form->attributes = "name='searchform' id='searchform'";
?>

<div id="mainpage">
	<?php 
$form->start('customersearch.php', 'POST');
?>
	<table border='0'>
		<tr>
			<td colspan='2'>
				<font size='+1' color='#0000cc'>
					<b>Customer Search</b><br><br>
				</font>
			</td>
		</tr>
		<tr>
			<td>
				<?php 
$form->label('searchtext', "Search: ");
?>
				<?php 
$form->attributes = "maxlength='64' size='20'";
?>
				<?php 
$form->element('searchtext', 'text', $searchText);
?>
				<?php 
$form->startSelect('searchtype');
Example #12
0
 protected function show_form($data = null, $run = false)
 {
     if (empty($data['category'])) {
         $data['category'] = 'General';
     }
     $f = new Form();
     $f->start($data);
     if (isset($data['query_id'])) {
         $f->hidden('query_id', $data['query_id']);
     }
     $f->text('title', 'Query Title:', 70, 'query title');
     $f->textarea('query', 'Query:', 80, 3);
     $f->text('category', 'Category:', 30, 'category');
     $f->menu('permission', 'Permission:', $this->ac->get_permissions(), false, 'query');
     $f->button('action_save', 'Save');
     $f->button('action_save_run', 'Save & Run', false);
     $f->hspace(30);
     $f->button('action_new', 'New', false);
     $f->end();
     if ($run && isset($data['query'])) {
         if (stripos($data['query'], 'file ') === 0) {
             $this->message("Can't run file reports here");
         } else {
             $this->run($data['title'], $data['query']);
         }
     }
     echo "<p style='margin-top:20px;'>";
     $this->query_list();
 }