Example #1
0
 function index()
 {
     $options = array("a" => 1, "b" => 2);
     $this->load_library("Form", "form");
     $this->form->init_form(URL . "ajax.php/form/save/", "get");
     $this->form->open_table("Table title");
     $this->form->add_hidden('a', 1);
     $this->form->add_item('text', 'name', 'text', 'description', null, 'required');
     $this->form->add_item('text', 'email', 'email', 'insert your email', null, 'required,email');
     $this->form->add_item('password', 'pw', 'password', 'insert your pw');
     $this->form->add_item('select', 'sel', 'select', 'make your choice', null, null, array('options' => $options));
     $this->form->add_item('checkbox', 'check', 'select', 'make your choice', null, null, array('options' => $options));
     $this->form->add_item('textarea', 'textarea', 'textarea', 'description');
     $this->form->add_item('word', 'word', 'textarea', 'description');
     $this->form->add_item('file', 'file', 'filename', 'upload a file');
     $this->form->add_item('yes', 'yes', 'enable', 'do you want to enable?');
     $this->form->add_html('this is plain html');
     $this->form->add_button();
     $this->form->close_table();
     $this->form->draw($use_ajax = true, $return_string = false);
 }
Example #2
0
$Base->header();
print "<div class=\"box clear\">\n";
$Form = new Form();
$Form->values(array_merge($member, $prefs));
$Form->header(url(), "post", FORM_SALT);
$Form->fieldset_open("Account Management");
$Form->add_text("name", "Name:");
$Form->add_text("postalcode", "Postal Code:");
$Form->fieldset_close();
$Form->fieldset_open("Password Management");
print "<div id=\"password\" style=\"display:none\">\n";
$Form->add_password("_current", "Current:");
$Form->add_password("_pass", "New:");
$Form->add_password("_pass_confirm", "Confirm:");
print "</div>\n";
$Form->add_button("_change", "Change Password", "change_password()", "style=\"margin:5px\"");
$Form->fieldset_close();
$Form->fieldset_open("Details");
$DB->query("SELECT\r\n              p.display,\r\n              p.name as field,\r\n              pt.name as type,\r\n              p.width\r\n            FROM\r\n              pref p\r\n            LEFT JOIN\r\n              pref_type pt\r\n            ON\r\n              pt.id = p.pref_type_id\r\n            WHERE\r\n              p.editable IS true\r\n            ORDER BY\r\n              p.ordering");
while ($pref = $DB->load_array()) {
    switch ($pref['type']) {
        case "input":
            $Form->add_text($pref['field'], "{$pref['display']}:", $pref['width']);
            break;
        case "textarea":
            $Form->add_textarea($pref['field'], "{$pref['display']}:");
            break;
        case "checkbox":
            $Form->add_checkbox($pref['field'], "{$pref['display']}:");
            break;
    }
Example #3
0
<?php

if ($DB->value("SELECT locked FROM thread WHERE id=\$1", array(id())) == 't') {
    return;
}
$Form = new Form();
$Form->header(url(0, 1) . "reply", "post", FORM_SALT);
$Form->values(array("thread_id" => id(true)));
$Form->add_hidden("thread_id");
$Form->account_login();
$Form->fieldset_open("Reply");
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "id=\"submit\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','thread'," . id() . ");");
if (id() == 362137) {
    print "&nbsp;";
    $Form->add_button("_load", "load bradyism", "\$(this).val('loading...');\$.post('/thread/view/bradyism/',{},function(data){ \$('#body').val(\$.trim(data));\$('#_load').val('load bradyism')});");
}
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
print BBCODE_GUIDE;
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "")
  {
<?php

require_once '../../kernel/begin.php';
$lang->setModule('membres', 'inscription');
$form = new Form(translate('title_form'), 'post');
$form->add_fieldset();
$form->add_input('login', 'login', translate('login_form'));
$form->add_input('password', 'password', translate('password_form'), 'password');
$form->add_input('password_confirm', 'password_confirm', translate('password_confirm'), 'password');
$form->add_input('email', 'email', translate('email_form'));
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
    $login = $fh->get('login');
    $password = _hash($fh->get('password'));
    $password_confirm = _hash($fh->get('password_confirm'));
    $email = $fh->get('email');
    if ($password != $password_confirm) {
        $error = new Error();
        $error->add_error(translate('two_passwords_not'), ERROR_PAGE, __FILE__, __LINE__);
    } else {
        $params = array($login, $email, $password, time(), time());
        $bdd->query('INSERT INTO ' . TABLE_MEMBERS . ' ( membre_login, membre_email, membre_password, membre_register, membre_last_up ) VALUES( ?, ?, ?, ?, ? )', $params);
        $error = new Error();
        $error->add_error(translate('inscription_ok'), ERROR_PAGE, __FILE__, __LINE__);
        tpl_begin();
        echo '<p>' . translate('welcome') . '</p>';
        tpl_end();
        exit;
    }
Example #5
0
    $theme['hover'] = "none";
}
$Form->values(array_merge($theme, get('theme') ? array("theme" => get('theme')) : array()));
$Form->header(url(), "post", FORM_SALT);
$Form->fieldset_open("Theme Options");
$Form->add_text("font", "Font Family:", 250);
$Form->add_select("fontsize", "Font Size:", "Select Size", $fontsizes);
$Form->add_text("body", "Background #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"body\" checked=\"true\"/>");
$Form->add_text("even", "Even #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"even\"/>");
$Form->add_text("odd", "Odd #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"odd\"/>");
$Form->add_text("me", "My Posts #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"me\"/>");
$Form->add_text("hover", "Hover Bar #:<br/><span class=\"small\">(or 'none')</span>", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"hover\"/>");
$Form->add_text("readbar", "Read Bars #:", 50, 6, "/> <input type=\"radio\" id=\"type\" name=\"type\" value=\"readbar\"/>");
$Form->fieldset_close();
$Form->add_submit("Save");
$Form->add_button("preview", "Preview", "preview_theme()");
$Form->labels(false);
$Form->fieldset_open("Preset Themes");
$DB->query("SELECT name as id,name FROM theme");
$Form->add_select("theme", "Themes:", "Select Theme", $DB->load_all_key());
$Form->add_button("preview", "Preview", "if(jQuery('#theme')[0].selectedIndex) location.href='/member/editcolors/&theme='+jQuery('#theme')[0][jQuery('#theme')[0].selectedIndex].value;");
$Form->fieldset_close();
$Form->footer();
?>
</div>
<div class="clear"><br/></div>
<div class="hr"><hr/></div><br/>
<?php 
$list = array();
$list[0][LIST_ID] = 0;
$list[0][LIST_DATE_LAST_POST] = time();
Example #6
0
<?php

$Form = new Form();
$Form->header(url(0, 1) . "reply", "post", FORM_SALT);
$Form->values(array("message_id" => id(true)));
$Form->add_hidden("message_id");
$Form->account_login();
$Form->fieldset_open("Reply");
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "id=\"submit\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','message'," . id() . ");");
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
print BBCODE_GUIDE;
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "")
  {
    loadposts('message',false);
    e('<?php 
print $Form->name;
?>
').reset();
  }
  $('.submit').attr('disabled',false);
Example #7
0
<?php

$Base = new Base();
$Base->type(CREATE);
$Base->title("Create New Thread");
$Base->header();
$Form = new Form();
$Form->header(url(), "post", FORM_SALT);
$Form->account_login();
$Form->fieldset_open("Thread Details");
$Form->add_text("subject", "Subject:", 400, 200);
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "class=\"nodisable\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','thread',99999999);");
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("subject", "Please enter a subject.");
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
$Base->footer();
print BBCODE_GUIDE;
?>
<script type="text/javascript">
function completed(data)
{
  if(jQuery.trim(data) == "") window.location = '/';
  $('.submit').attr('disabled',false);
}
</script>
Example #8
0
$Base = new Base();
$Base->type(MISC);
$Base->title(TITLE_CHAT);
$Base->header();
?>
<div id="data" class="box clear" style="overflow:scroll;overflow-x:hidden;height:375px;">
Loading chat history...
</div>
<?php 
$Form = new Form();
$Form->labels(false);
$Form->header("/chat/speak/", "post", FORM_SALT);
$Form->fieldset_open("Chat Panel");
$Form->add_text("chat", false, 400, false, "onkeydown=\"return catch_enter(event)\"/>");
$Form->add_button("add", "say that shit", "speak();");
print "<br/>\n";
$Form->add_checkbox("stop", "pause scroll", "onclick=\"pause=pause?false:true\"/> pause scrolling");
$Form->fieldset_close();
$Form->footer();
$Base->footer();
?>
<script type="text/javascript">
var lasthash;
var pause = false;
function speak()
{
  var text = $('#chat').val();
  $('#add')[0].disabled = true;
  $.post("/chat/speak/",{msg:text},function(data)
  {
<?php

require_once '../../kernel/begin.php';
require_once 'parser.class.php';
$lang->setModule('xtc_builder', 'index');
$form = new Form('Formulaire', 'post');
$form->add_fieldset();
$form->add_button('button', 'input_insert', 'Input')->setonClick('insert( \'texForm\', \'Input <nom,id,label>\' );')->setInline(true);
$form->add_button('button', 'textarea_insert', 'Textarea')->setonClick('insert( \'texForm\', \'Textarea <nom,id,label>\' );')->setInline(true);
$form->add_button('button', 'fieldset_insert', 'Fieldset')->setonClick('insert( \'texForm\', \'Fieldset <nom>\' );')->setInline(true);
$form->add_button('button', 'button_insert', 'Button')->setonClick('insert( \'texForm\', \'Button <type,nom,valeur>\' );')->setInline(true);
$form->add_button('button', 'liste_insert', 'Liste (avec valeurs)')->setonClick('insert( \'texForm\', \'Liste <type,nom,id,valeur>\', \'avec\' );')->setInline(true);
$form->add_button('button', 'liste_insert', 'Liste (sans valeurs)')->setonClick('insert( \'texForm\', \'Liste <type,nom,id,valeur>\', \'sans\' );')->setInline(true);
$form->add_button('button', 'liste_insert', 'Choix (avec valeurs)')->setonClick('insert( \'texForm\', \'Choix <type,nom>\', \'avec\' );')->setInline(true);
$form->add_button('button', 'liste_insert', 'Choix (sans valeurs)')->setonClick('insert( \'texForm\', \'Choix <type,nom>\', \'sans\' );')->setInline(true);
$form->add_textarea('texForm', 'texForm', 'Contenu à parser');
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
tpl_begin();
if ($fh->okay()) {
    $contenuAParser = $fh->get('texForm');
    $parserPage = new xtc_builder_formulaire($contenuAParser);
    $r = $parserPage->parse_content();
    $md5 = md5($r);
    file_put_contents(ROOT . 'modules/xtc_builder/cache/formulaires/' . $md5 . '.php', $r);
    echo '<p>À insérer dans la zone de texte.</p>';
    echo '<input type="text" value="Form <#' . $md5 . '>" />';
} else {
    $form->buildAll();
}
<?php

require_once '../../kernel/begin.php';
require_once 'parser.class.php';
$lang->setModule('xtc_builder', 'index');
$form = new Form('Titre', 'post');
$form->add_fieldset();
$form->add_input('nom_page', 'nom_page', translate('page_name'));
$form->add_button('button', 'include_insert', translate('include_insert'))->setonClick('insert( \'texTop\', \'Include <page.php>\' );')->setInline(true);
$form->add_button('button', 'load_insert', translate('load_insert'))->setonClick('insert( \'texTop\', \'Load <page>\' );')->setInline(true);
$form->add_button('button', 'requetesql_insert', translate('requetesql_insert'))->setonClick('insert( \'texTop\', \'Requete <table,type,champs,conditions,order,limit>\' );')->setInline(true);
$form->add_button('button', 'debut_insert', translate('debut_insert'))->setonClick('insert( \'texTop\', \'AfficDebut\' );')->setInline(true);
$form->add_button('button', 'fin_insert', translate('fin_insert'))->setonClick('insert( \'texTop\', \'AfficFin\' );')->setInline(true);
$form->add_button('button', 'html_insert', translate('html_insert'))->setonClick('insert( \'texTop\', \'Html\\n{\\n}\' );')->setInline(true);
$form->add_textarea('texTop', 'texTop', 'Contenu à parser');
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
    $contenuAParser = $fh->get('texTop');
    $parserPage = new xtc_builder_page($contenuAParser);
    $md5Page = md5($contenuAParser);
    $bdd->query('INSERT INTO ' . TABLE_PAGES_PHP . ' VALUES( ?, ? )', array($md5Page, $fh->get('nom_page')));
    file_put_contents('cache/pagesOriginales/' . $md5Page . '.php', $parserPage);
    file_put_contents('cache/pagesPHP/' . $md5Page . '.php', $parserPage->parse_content());
    $error = new Error();
    $error->add_error(translate('page_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/accueil/index.php');
}
tpl_begin();
echo '<p><a href="formulaire.php" target="_blank">Créer un formulaire.</a></p>';
echo translate('presentation');
Example #11
0
$Base->title("Create New Message");
$Base->header();
$Form = new Form();
$Form->header(url(), "post", FORM_SALT);
$Form->account_login();
$Form->fieldset_open("Message Details");
$Form->labels(false);
print "<li>\n";
print "  <label>Recipients:</label>\n";
print "  <div id=\"m\" style=\"width:500px;float:left;line-height:1.8em;\"><span id=\"notice\" class=\"small\">(invalid names will be discarded)</span></div>\n";
print "</li>\n";
print "<li>\n";
print "  <label for=\"recipients\">Add Members:</label>\n";
$Form->add_hidden("message_members");
$Form->add_text("_recipients", false, 200, false, "onkeydown=\"return catch_enter(event)\"/>");
$Form->add_button("add", "Add", "check_member();", "tabindex=\"10\"/>");
print " <sup id=\"names\">add multiples with: name, name, name</sup>";
print "</li>\n";
$Form->labels(true);
$Form->add_text("subject", "Subject:", 400, 200);
$Form->add_textarea("body", "Body:");
$Form->fieldset_close();
$Form->add_submit(SAY_BUTTON, "class=\"nodisable\"/>");
$Form->add_button("preview", PREVIEW_BUTTON, "preview_post('{$Form->name}','message',99999999);");
print "&nbsp;<sup><a href=\"javascript:;\" onclick=\"\$('#bbcode').slideToggle()\">[help]</a></sup>\n";
$Form->footer();
$Form->header_validate();
$Form->add_notnull("message_members", "Please enter at least one recipient.");
$Form->add_notnull("subject", "Please enter a subject.");
$Form->add_notnull("body", "Please enter a post body.");
$Form->footer_validate();
        ?>
img/delete.png" title="<?php 
        echo translate('delete_menu');
        ?>
" alt="<?php 
        echo translate('delete_menu');
        ?>
" /></a></td>
		</tr>
	<?php 
    }
    unset($data);
    ?>
	</table>
	<?php 
    $form->add_button()->display();
    $form->display_footer();
    $toAffic = ob_get_contents();
    ob_end_clean();
    $fh = new FormHandle($form);
    $fh->handle();
    if ($fh->okay()) {
        $requestEdit = $bdd->query('SELECT * FROM ' . TABLE_MENUS . ' ORDER BY menu_type, menu_position, menu_id');
        while ($data = $bdd->fetch($requestEdit)) {
            $requestUpdate = NULL;
            $params = array();
            $change = false;
            foreach ($data as $k => $d) {
                if ($k != 'menu_id' && ($v = $fh->get(str_replace('menu_', '', $k) . '_' . $data['menu_id'])) != $d) {
                    $requestUpdate .= ' `' . $k . '` = ? ,';
                    $params[] = $v;