<?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');
 function groups_select($r = '', $s = '')
 {
     $existent_groups = $this->existent_groups();
     $selected = array();
     $return_string = '';
     if ($r != '' && $s == '') {
         $show_to = $this->navi[$r]['Show_to'];
         $groups = is_array($show_to) ? $show_to : array();
     } else {
         if ($r != '' && $s != '') {
             $show_to = $this->navi[$r]['Subnavi'][$s]['Show_to'];
             $groups = is_array($show_to) ? $show_to : array();
         } else {
             $groups = array();
         }
     }
     for ($i = 0; $i < count($existent_groups); $i++) {
         if (in_array($existent_groups[$i]['Name'], $groups)) {
             $selected = array('checked' => 'checked');
         } else {
             $selected = array();
         }
         $return_string .= Form::add_input('checkbox', 'Gruppen[]', $i, $selected) . ' ' . $existent_groups[$i]['Name'] . Html::br();
     }
     return Html::div(Html::bold('Zugang beschränken')) . $return_string . Html::div('Nichts gewählt = keine Beschränkung', array('class' => 'klein'));
 }
 function user_table()
 {
     $user_table = '';
     $img_edit_group = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit_group.png', 'Gruppe ändern', array('title' => 'Gruppe ändern'));
     $img_delete_user = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/delete_user.png', 'Benutzer löschen', array('title' => 'Benutzer löschen'));
     $img_new_user = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/add_user.png', 'Benutzer hinzufügen', array('title' => 'Benutzer hinzufügen'));
     $img_edit = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit.png', 'Eigenschaften bearbeiten', array('title' => 'Eigenschaften bearbeiten'));
     $img_apply = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png', 'Speichern');
     $img_apply_path = '/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/apply.png';
     $img_pass = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/password.png', 'Passwort');
     $img_user = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit_user.png', 'Benutzername');
     $img_group = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit_group.png', 'Gruppe');
     $img_mail = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/mail_generic.png', 'E-Mail');
     $img_show_pw = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/14_layer_visible.png', 'Passwörter zeigen');
     $img_hide_pw = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/14_layer_novisible.png', 'Passwörter verstecken');
     $form = new Form();
     $table = new Table(5, array('id' => 'user_table'));
     $table->add_caption('Registrierte Benutzer');
     if (!isset($_GET['showpw'])) {
         $pwshow = Html::a($_SERVER['REDIRECT_URL'] . '?showpw', $img_show_pw, array('title' => 'Passwörter zeigen'));
     } else {
         $pwshow = Html::a($_SERVER['REDIRECT_URL'], $img_hide_pw, array('title' => 'Passwörter verstecken'));
     }
     $table->add_th(array('Benutzer', 'E-Mail', 'Passwort ' . $pwshow, 'Gruppe'));
     for ($i = 0; $i < count($this->existent_users); $i++) {
         $select = new Select('gruppe');
         foreach ($this->existent_groups as $group) {
             if ($this->existent_users[$i]['Group'] == $group) {
                 $attr['selected'] = 'selected';
             } else {
                 unset($attr['selected']);
             }
             $select->add_option(rawurlencode($group), $group, $attr);
         }
         $groups_select = $select->flush_select();
         if (!isset($_GET['showpw'])) {
             $show_password = '******';
         } else {
             $show_password = $this->existent_users[$i]['Password'];
         }
         if (isset($_GET['editgroup'])) {
             $id = $_GET['editgroup'];
             if ($id == $this->existent_users[$i]['id']) {
                 $editgroup_submit = $form->add_input('image', 'submit_edit_group', '', array('src' => $img_apply_path, 'alt' => 'Speichern'));
                 $editgroup_submit_id = $form->add_input('hidden', 'id', $id);
                 $groupshow = $groups_select . $editgroup_submit_id . $editgroup_submit;
             } else {
                 $groupshow = $this->existent_users[$i]['Group'];
             }
         } else {
             $groupshow = $this->existent_users[$i]['Group'];
         }
         //$edit_group_button = Html::a($_SERVER['REDIRECT_URL'].'?editgroup='.$this->existent_users[$i]['id'],$img_edit_group);
         $edit_user_button = Html::a($_SERVER['REDIRECT_URL'] . '?edituser='******'id'], $img_edit);
         $delete_user_confirm = array('onclick' => 'return confirm(\'Wollen Sie ' . $this->existent_users[$i]['Name'] . ' wirklich löschen?\')');
         $delete_user_button = Html::a($_SERVER['REDIRECT_URL'] . '?deleteuser='******'id'], $img_delete_user, $delete_user_confirm);
         $user_row = array($this->existent_users[$i]['Name'], $this->existent_users[$i]['E-Mail'], $show_password, $groupshow, $edit_user_button . $edit_group_button . $delete_user_button);
         if (isset($_GET['edituser'])) {
             $id = $_GET['edituser'];
             if ($id == $this->existent_users[$i]['id']) {
                 $edit_user_form_name = $form->add_input('text', 'edit_user_name', $this->existent_users[$i]['Name'], array('size' => '12'));
                 $edit_user_form_pass = $form->add_input('text', 'edit_user_pass', $this->existent_users[$i]['Password'], array('size' => '12'));
                 $edit_user_form_mail = $form->add_input('text', 'edit_user_mail', $this->existent_users[$i]['E-Mail'], array('size' => '12'));
                 $edit_user_form_id = $form->add_input('hidden', 'edit_user_id', $id);
                 $edit_user_form_submit = $form->add_input('image', 'submit_edit_user', 'Speichern', array('src' => $img_apply_path, 'alt' => 'Speichern'));
                 $user_row = array($img_user . $edit_user_form_name, $img_mail . $edit_user_form_mail, $img_pass . $edit_user_form_pass, $img_group . $groups_select, $edit_user_form_submit . $edit_user_form_id);
             }
         }
         $table->add_td($user_row, array('class' => is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2'));
     }
     $new_user_link = Html::a($_SERVER['REDIRECT_URL'] . '?newuser', $img_new_user . ' Benutzer hinzufügen');
     if (isset($_GET['newuser'])) {
         $new_user_form_name = $form->add_input('text', 'new_user_name', '', array('size' => '12'));
         $new_user_form_pass = $form->add_input('text', 'new_user_pass', '', array('size' => '12'));
         $new_user_form_mail = $form->add_input('text', 'new_user_mail', '', array('size' => '12'));
         $new_user_form_submit = $form->add_input('image', 'submit_new_user', 'Speichern', array('src' => $img_apply_path, 'alt' => 'Speichern'));
         $table->add_td(array($img_user . $new_user_form_name, $img_mail . $new_user_form_mail, $img_pass . $new_user_form_pass, $img_group . $groups_select, $new_user_form_submit));
     } else {
         $table->add_td(array(array(2 => $new_user_link)));
     }
     return $form->form_tag('/Admin/User/') . $table->flush_table() . $form->close_form();
 }
         $dataCours['coursNom'] = $fh->get('cours_nom');
         $dataCours['coursIntro'] = $fh->get('cours_introduction');
         $dataCours['coursConclusion'] = $fh->get('cours_conclusion');
         $coursCateg = $fh->get('cours_categorie');
         $cours = new Cours();
         $cours->ajouter_element($coursCateg, $dataCours, $member);
         $error = new Error();
         $error->add_Error(translate('cours_create_okay'), ERROR_PAGE, __FILE__, __LINE__);
     }
     break;
 case 'modifierTutoriel':
     $idTutoriel = intval($_GET['idTutoriel']);
     $donneesTutoriel = $bdd->requete('SELECT cours_level, cours_id, cours_nom, cours_texte, cours_gauche, cours_droite FROM ' . TABLE_COURS . ' WHERE cours_id = ?', $idTutoriel);
     $form = new Form(translate('title_edit_form'));
     $form->add_fieldset();
     $form->add_input('cours_nom', 'cours_nom', translate('cours_name_form'))->setValue($donneesTutoriel['cours_nom']);
     $form->add_textarea('cours_introduction', 'cours_introduction', translate('cours_intro_form'))->setValue($donneesTutoriel['cours_texte']);
     $form->add_textarea('cours_conclusion', 'cours_conclusion', translate('cours_conclu_form'))->setValue($donneesTutoriel['cours_texte']);
     $form->add_button();
     $fh = new FormHandle($form);
     $fh->handle();
     if ($fh->okay()) {
         $dataCours['coursNom'] = $fh->get('cours_nom');
         $dataCours['coursIntro'] = $fh->get('cours_introduction');
         $dataCours['coursConclusion'] = $fh->get('cours_conclusion');
         $cours = new Cours();
         $cours->modifier_element($dataCours);
         $error = new Error();
         $error->add_error(translate('cours_edit_okay'), ERROR_PAGE, __FILE__, __LINE__);
     }
     break;
 function admin_module_reorder()
 {
     $array_to_reorder = $this->connection->db_assoc("SELECT `id`,`sysID`,`Name` FROM `RheinaufCMS>Module` WHERE `Backend` != '' ORDER BY `id` ASC");
     $array_name_to_reorder = 'admin_module';
     $form_tag = Form::form_tag(SELF, 'post', 'application/x-www-form-urlencoded', array('name' => 'draglist_form'));
     $draglist_scripts = Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Draglist/assets/dom-drag.js'));
     $draglist_scripts .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Draglist/assets/draglist.js'));
     $dragable_divs = '';
     for ($i = 0; $i < count($array_to_reorder); $i++) {
         $draglist_item = Form::add_input('hidden', "draglist_items[{$i}]", $i);
         $name = $array_to_reorder[$i]['Name'];
         $dragable_divs .= Html::div($name . $draglist_item, array('style' => 'margin-left:150px;padding:0 5px;position: relative; left: 0px; top: 0px;cursor:move;border:thin solid white;background:#eeeeee;width:200px;height:20px;'));
     }
     $draglist_container = Html::div($dragable_divs, array('id' => 'draglist_container'));
     $draglist_cmd = Form::add_input('hidden', 'reorder', '');
     $draglist_apply = Form::add_input('button', 'reorder', 'Speichern', array('title' => 'Speichern', 'onclick' => "draglist_manager.do_submit('draglist_form','draglist_container')"));
     $form_close = Form::close_form();
     $draglist_call = "var dragListIndex = new Array();\r\n\t\t\t\t\t\t\tdraglist_manager = new fv_dragList( 'draglist_container' );\r\n\t\t\t\t\t\t\tdraglist_manager.setup();\r\n\t\t\t\t\t\t\taddDragList( draglist_manager );";
     $draglist_call = Html::script($draglist_call);
     $this->return = '<p>Ordnen Sie die Einträge neu an, indem Sie sie mit der Maus ziehen.</p>' . $draglist_scripts . $form_tag . $draglist_container . $draglist_cmd . $draglist_apply . $form_close . $draglist_call;
 }
 function group_table()
 {
     $group_table = '';
     $this->images['edit'] = Html::img('/Libraries/Icons/16x16/edit.png', 'Eigenschaften bearbeiten', array('title' => 'Eigenschaften bearbeiten'));
     $this->images['apply'] = Html::img('/Libraries/Icons/16x16/apply.png', 'Speichern');
     $this->images['apply_path'] = '/Libraries/Icons/16x16/apply.png';
     $this->images['checkbox_disabled_unchecked'] = Html::img('/Libraries/Icons/16x16/checkbox_disabled_unchecked.png', 'Nicht erlaubt');
     $this->images['checkbox_disabled_checked'] = Html::img('/Libraries/Icons/16x16/checkbox_disabled_checked.png', 'Erlaubt');
     $this->images['new_group'] = Html::img('/Libraries/Icons/16x16/add_group.png', 'Gruppe hinzufügen', array('title' => 'Gruppe hinzufügen'));
     $this->images['delete_group'] = Html::img('/Libraries/Icons/16x16/delete_group.png', 'Gruppe löschen', array('title' => 'Gruppe löschen'));
     $img_group = Html::img('/Libraries/Icons/16x16/edit_group.png', 'Gruppe');
     $cols = count($this->rechte) + 3;
     $table = new Table($cols, array('id' => 'groups_table'));
     $form_tag = Form::form_tag('/Admin/Gruppen');
     $form_close = Form::close_form();
     $th = array(Html::bold('Gruppe'));
     foreach ($this->rechte as $recht) {
         $th[] = $recht['RechtName'];
     }
     $table->add_th($th);
     $i = 0;
     foreach ($this->existent_groups as $group) {
         if (isset($_GET['editgroup']) && $_GET['editgroup'] == $group['id']) {
             $td = array(Form::add_input('text', 'name', $group['Name']));
             for ($j = 0; $j < count($this->rechte); $j++) {
                 if (in_array($this->rechte[$j]['id'], $group['Rechte'])) {
                     $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id'], array('checked' => 'checked'));
                 } else {
                     $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']);
                 }
             }
             $id = Form::add_input('hidden', 'group_id', $group['id']);
             $old_name = Form::add_input('hidden', 'old_name', $group['Name']);
             $new_rechte_submit = Form::add_input('image', 'submit_rechte', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern'));
             $td[] = $id . $old_name . $new_rechte_submit;
         } else {
             $td = array(Html::bold($group['Name']));
             for ($j = 0; $j < count($this->rechte); $j++) {
                 $td[] = in_array($this->rechte[$j]['id'], $group['Rechte']) ? $this->images['checkbox_disabled_checked'] : $this->images['checkbox_disabled_unchecked'];
             }
             $edit_button = Html::a('/Admin/Gruppen?editgroup=' . $group['id'], $this->images['edit'], array('title' => 'Eigenschaften bearbeiten'));
             $delete_button = Html::a('/Admin/Gruppen?deletegroup=' . $group['id'], $this->images['delete_group'], array('title' => 'Gruppe löschen', 'onclick' => "return confirm('Gruppe " . addcslashes($group['Name'], "'") . " löschen?')"));
             $td[] = $edit_button;
             $td[] = $delete_button;
         }
         $class = is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2';
         $table->add_td($td, array('class' => is_int($i / 2) ? 'abwechselnde_flaechen_1' : 'abwechselnde_flaechen_2'));
         $i++;
     }
     $new_group_button = Html::a('/Admin/Gruppen?newgroup', $this->images['new_group'] . ' Gruppe hinzufügen');
     if (isset($_GET['newgroup'])) {
         $td = array(Form::add_input('text', 'name', ''));
         for ($j = 0; $j < count($this->rechte); $j++) {
             $td[] = Form::add_input('checkbox', 'Recht[]', $this->rechte[$j]['id']);
         }
         $new_group_submit = Form::add_input('image', 'submit_newgroup', 'Speichern', array('src' => $this->images['apply_path'], 'alt' => 'Speichern'));
         $td[] = $id . $new_group_submit;
         $table->add_td($td);
     } else {
         $table->add_td(array(array(2 => $new_group_button)));
     }
     return $form_tag . $table->flush_table() . $form_close;
 }
<?php

require_once '../../kernel/begin.php';
$lang->setModule('news', 'ajouter');
$xtcode = new XTCode();
$form = new Form(translate('title_add_form'));
$form->add_fieldset();
$form->add_input('news_title', 'news_title', translate('news_title'));
$form->add_textarea('news_content', 'news_content', translate('news_content'));
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
    $error = new Error();
    $error->add_error(translate('addition_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/news/index.php');
} else {
    tpl_begin();
    $form->build_all();
    tpl_end();
}
    function editor()
    {
        $rubrik = $this->I18n_get_real($this->navi[$_GET['edit']]['Rubrik']);
        $rubrik = $this->path_encode($rubrik);
        $seite = $this->I18n_get_real($this->navi[$_GET['edit']]['Subnavi'][$_GET['edit_page']]['Seite']);
        $seite = $this->path_encode($seite);
        $folder = INSTALL_PATH . "/Content/{$rubrik}/{$seite}";
        $wokingversion = isset($_GET['workingversion']) ? true : false;
        if ($wokingversion && RheinaufFile::is_file($folder . "/Arbeitsversion/content.html")) {
            $contents = RheinaufFile::get_file($folder . "/Arbeitsversion/content.html");
        } else {
            $contents = RheinaufFile::get_file($folder . "/content.html");
        }
        $_SESSION['rubrik'] = $this->path_encode($rubrik);
        $_SESSION['seite'] = $this->path_encode($seite);
        $_SESSION['docroot'] = DOCUMENT_ROOT;
        $editor_page = new Html();
        //$editor_page->body_attributes=array('onunload'=>'catchClose(xinha_editors.editor)');
        $title = 'Editor für ' . PROJECT_NAME . ' -> ' . $rubrik . ' -> ' . $seite;
        $title .= $wokingversion ? ' (Arbeitsversion)' : ' (Liveversion)';
        $editor_page->title = $title;
        $editor_page->script(' _editor_url  = "/' . INSTALL_PATH . '/Libraries/Xinha/";_editor_lang = "de";_document_root = "' . DOCUMENT_ROOT . '"');
        $editor_page->script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Xinha/XinhaLoader.js'));
        $editor_page->script('', array('src' => '/' . INSTALL_PATH . '/Libraries/XinhaConfig/editor.php'));
        $editor_page->script("var project_name = '" . addslashes(PROJECT_NAME) . "';");
        $styles = 'BODY 	{
						margin: 0;
						background-color:Menu;
						font-size:12px;
						padding:0;
						font-family: sans-serif;
					}

					#editor {
						width:100%;
						height:500px;
					}

					/*---DropDowns*/

					ul { /* all lists */
						padding: 0;
						margin: 0;
						list-style: none;
						position:absolute;
						top:2px;
						left:0px;
						z-index:999;
						cursor:default;


					}
					ul a {
						cursor:default;
						color:black;
						text-decoration:none;
						display:block;
					}

					li { /* all list items */
						float: left;
						position: relative;
						width: 10em;
						border:1px solid;
						border-color:Menu;
						padding-left:2px;
					}

					li:hover,li.over {
						border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
					}
					li ul { /* second-level lists */
						display: none;
						position: absolute;
						top: 15px;
						left: 0;
						-moz-opacity:1;
						filter:alpha(opacity = 100);
						padding-bottom:5px;
					}

					li>ul { /* to override top and left in browsers other than IE, which will position to the top right of the containing li, rather than bottom left */
						top: auto;
						left: auto;
					}

					li:hover ul, li.over ul { /* lists nested under hovered list items */
						display: block;
						background-color: Menu;
						border:1px solid;
						border-color:Menu ButtonShadow ButtonShadow ButtonHighlight;
					}
					li:hover ul a:hover, li.over ul a:hover {
						color:white;
						background-color:darkblue;

					}

					#content {
						clear: left;
						padding:20px 0 0 0 ;
					}

					';
        $editor_page->style($styles);
        $editor_page->div($this->menu());
        $form = new Form();
        if ($wokingversion) {
            $get_working_version = 'workingversion&';
        } else {
            $get_working_version = '';
        }
        $form->form_tag(SELF_URL . '?' . $get_working_version . 'edit=' . $_GET['edit'] . '&edit_page=' . $_GET['edit_page'], 'post', 'application/x-www-urlencoded', array('id' => 'editor_form'));
        $form->add_input('hidden', 'rubrik', $rubrik);
        $form->add_input('hidden', 'seite', $seite);
        $form->add_input('hidden', 'tmp_file', RheinaufFile::is_file($this->work_folder() . 'tmp.html') ? 'true' : 'false', array('id' => 'tmp_file'));
        $form->add_textarea('editor_text', $contents, array('id' => 'editor'));
        $form->close_form();
        $editor_page->div($form->flush_form(), array('id' => 'content'));
        return $editor_page->flush_page();
    }
        ?>
</p>
<p>Citation : <?php 
        echo htmlentities($data['membre_citation']);
        ?>
</p>
<p>Biographie : <?php 
        echo XTCode_decode($data['membre_biographie']);
        ?>
</p>
<?php 
        break;
    case 'modifier':
        $form = new Form(translate('edit_profile'), 'post');
        $form->add_fieldset();
        $form->add_input('login', 'login', translate('login_form'), 'text', 'disabled')->setValue(htmlentities($data['membre_login']));
        $form->add_input('email', 'email', translate('email_form'))->setValue(htmlentities($data['membre_email']));
        $form->add_input('citation', 'citation', translate('citation_form'))->setValue(htmlentities($data['membre_citation']));
        $form->add_textarea('biographie', 'biographie', translate('biographie_form'))->setValue($data['membre_biographie']);
        $form->add_button();
        $fh = new FormHandle($form);
        $fh->handle();
        if ($fh->okay()) {
            $newEmail = $fh->get('email');
            $newCitation = $fh->get('citation');
            $newBiographie = $fh->get('biographie');
            $bdd->query('UPDATE ' . TABLE_MEMBERS . ' SET membre_email = ?, membre_citation = ?, membre_biographie = ? WHERE membre_id = ?', array($newEmail, $newCitation, $newBiographie));
            $error = new Error();
            $error->add_error(translate('edit_ok'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/membres/connexion.php');
            goto voirAction;
        }
<?php

require_once '../../kernel/begin.php';
$lang->setModule('membres', 'connexion');
if ($member->is_connected()) {
    $error = new Error();
    $error->add_error(translate('already_online'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/accueil/index.php');
} else {
    $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_button();
    $fh = new FormHandle($form);
    $fh->handle();
    if ($fh->okay()) {
        $login = $fh->get('login');
        $password = _hash($fh->get('password'));
        $params = array($login, $password);
        $cSql = $bdd->count_sql(TABLE_MEMBERS, 'WHERE membre_login = ? AND membre_password = ?', $params);
        if ($cSql == 0) {
            $error = new Error();
            $error->add_error(translate('inexistant_member'), ERROR_PAGE, __FILE__, __LINE__);
        } else {
            $requete = $bdd->query('SELECT * FROM ' . TABLE_MEMBERS . ' WHERE membre_login = ? AND membre_password = ?', $params);
            $resultats = $bdd->fetch($requete);
            $hashKey = _hash($resultats['membre_id'] . $login, 'XTC_CMS');
            $sessions->add_session('pseudo', $login, '__member')->add_session('id', $resultats['membre_id'], '__member')->add_session('key', $hashKey, '__member')->add_session('isConnected', true, '__member');
            $member->log_in($resultats['membre_id']);
            $error = new Error();
            $error->add_error(translate('connexion_ok'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/accueil/index.php');
</th>
			<th>-</th>
		</tr>
	<?php 
    $form = new Form(translate('form_edit'), 'post');
    $form->add_fieldset();
    $form->display_top();
    while ($data = $bdd->fetch($requestEdit)) {
        ?>
		<tr>
			<td><?php 
        echo $data['menu_id'];
        ?>
</td>
			<td><?php 
        $form->add_input('title_' . $data['menu_id'], 'title_' . $data['menu_id'], false)->setValue($data['menu_title'])->setSize(30)->display();
        ?>
</td>
			<td><?php 
        $form->add_input('link_' . $data['menu_id'], 'link_' . $data['menu_id'], false)->setValue($data['menu_link'])->setSize(30)->display();
        ?>
</td>
			<td><?php 
        $form->add_input('order_' . $data['menu_id'], 'order_' . $data['menu_id'], false, 'text', 'int')->setValue($data['menu_order'])->setSize(4)->setNotNull(0)->display();
        ?>
</td>
			<td><?php 
        $form->add_input('type_' . $data['menu_id'], 'type_' . $data['menu_id'], false, 'text', 'int')->setValue($data['menu_type'])->setSize(4)->setNotNull(0)->display();
        ?>
</td>
			<td><?php 
<?php

require_once '../../kernel/begin.php';
require_once 'panel_admin.inc.php';
$form = new Form(translate('maj_upload'), 'post', '', true);
$form->add_fieldset();
$form->add_input('file', 'file', translate('file_form'), 'file', 'file');
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
load('core/zip');
if ($fh->okay()) {
    $file = $fh->get('file');
    $zip = new zip($file);
    $zipFiles = $zip->list_files();
    $existingFiles = array();
    $newFiles = array();
    $nameFileToMove = md5(mt_rand());
    $toDeleteFiles = array();
    foreach ($zipFiles as $filePath) {
        if (file_exists(ROOT . $filePath)) {
            $existingFiles[] = $filePath;
        } elseif ($filePath == '_files_to_delete.txt') {
            $toDeleteFiles = explode("\n", $zip->extract_file('_files_to_delete.txt'));
        } elseif ($filePath == '_maj_infos.txt') {
            $nameFileToMove = $zip->extract_file('_maj_infos.txt');
        } else {
            $newFiles[] = $filePath;
        }
    }
    move_uploaded_file($file, ROOT . 'uploads/' . url_transform($nameFileToMove) . '.zip');
<?php

require_once '../../kernel/begin.php';
$lang->setModule('accueil', 'contact');
$form = new Form(translate('contact_form'));
$form->add_fieldset();
$form->add_input('message_objet', 'message_objet', translate('message_objet_form'));
$form->add_input('message_email', 'message_email', translate('message_email_form'))->setRequired(false);
$form->add_textarea('message_contenu', 'message_contenu', translate('message_contenu_form'));
$form->add_button();
$fh = new FormHandle($form);
$fh->handle();
if ($fh->okay()) {
    $messageObjet = $fh->get('message_objet');
    $messageEmail = $fh->get('message_email');
    $messageContenu = $fh->get('message_contenu');
    $bdd->query('INSERT INTO ' . TABLE_CONTACT . ' ( contact_objet, contact_message, contact_email, contact_date, contact_ip ) VALUES( ?, ?, ?, ?, ? )', array($messageObjet, $messageContenu, $messageEmail, time(), get_ip()));
    $error = new Error();
    $error->add_error(translate('message_send_okay'), ERROR_PAGE, __FILE__, __LINE__);
}
tpl_begin();
$form->build_all();
tpl_end();
 function install()
 {
     if (isset($_POST['cat_submit'])) {
         $create_categorytable_sql = "CREATE TABLE `RheinaufCMS>Kalender>Kategorien` (\n\t\t\t\t\t\t\t\t\t\t\t`id` INT NOT NULL ,\n\t\t\t\t\t\t\t\t\t\t\t`Name` TEXT NOT NULL ,\n\t\t\t\t\t\t\t\t\t\t\t`Gruppen` TEXT NOT NULL ,\n\t\t\t\t\t\t\t\t\t\t\t`event` TINYINT DEFAULT '0' NOT NULL,\n\t\t\t\t\t\t\t\t\t\t\tPRIMARY KEY ( `id` )\n\t\t\t\t\t\t\t\t\t\t\t)";
         $this->connection->db_query($create_categorytable_sql);
         $cat_array = unserialize(urldecode($_POST['categories']));
         for ($i = 0; $i < count($cat_array); $i++) {
             $id = $i;
             $name = $cat_array[$i]['Name'];
             $event = $cat_array[$i]['event'];
             $gruppen = '';
             $insert_cat_sql = "INSERT INTO `RheinaufCMS>Kalender>Kategorien`\n\t\t\t\t\t\t\t\t\t\t\t\t( `id` , `Name` , `Gruppen` , `event` )\n\t\t\t\t\t\t\t\t\t\tVALUES \t('{$id}', '{$name}', '{$gruppen}', '{$event}')";
             $this->connection->db_query($insert_cat_sql);
         }
         $create_datatable_sql = "CREATE TABLE `RheinaufCMS>Kalender>Termine` (\n\t\t\t\t\t\t\t\t\t  `id` int(10) NOT NULL auto_increment,\n\t\t\t\t\t\t\t\t\t  `wann` timestamp(14) NOT NULL,\n\t\t\t\t\t\t\t\t\t  `wer_ueber` varchar(100) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `wer_text` longtext NOT NULL,\n\t\t\t\t\t\t\t\t\t  `presse` text,\n\t\t\t\t\t\t\t\t\t  `cafe_logo` varchar(100) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `bild` varchar(100) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `was` varchar(200) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `kostet` varchar(10) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `verantwortlich` text NOT NULL,\n\t\t\t\t\t\t\t\t\t  `pass` varchar(30) NOT NULL default '',\n\t\t\t\t\t\t\t\t\t  `event` tinyint(1) default '0',\n\t\t\t\t\t\t\t\t\t  PRIMARY KEY  (`id`),\n\t\t\t\t\t\t\t\t\t  UNIQUE KEY `pass` (`pass`),\n\t\t\t\t\t\t\t\t\t  KEY `wann` (`wann`),\n\t\t\t\t\t\t\t\t\t  KEY `event` (`event`),\n\t\t\t\t\t\t\t\t\t  KEY `was` (`was`)\n\t\t\t\t\t\t\t\t\t) TYPE=MyISAM ";
         $this->connection->db_query($create_datatable_sql);
         Module::install('KalenderAdmin', true);
     } else {
         $img_apply = Html::img('/' . INSTALL_PATH . '/Libraries/Icons/16x16/apply.png', 'Speichern');
         $img_apply_path = '/' . INSTALL_PATH . '/Libraries/Icons/16x16/apply.png';
         $img_add = Html::img('/' . INSTALL_PATH . '/Libraries/Icons/16x16/edit_add.png', 'Neu');
         $img_add_path = '/' . INSTALL_PATH . '/Libraries/Icons/16x16/edit_add.png';
         $return_string = '';
         $form = new Form();
         $return_string .= $form->form_tag('/Admin/Module?new=KalenderAdmin');
         $table = new Table(2);
         $table->add_caption('Kalender einrichten');
         if (isset($_POST['categories'])) {
             $cat_array = unserialize(urldecode($_POST['categories']));
         }
         if (isset($_POST['new_category'])) {
             $new = array('Name' => $_POST['new_category']['Name'], 'event' => $_POST['new_category']['event'] ? 1 : 0);
             $cat_array[] = $new;
         }
         for ($i = 0; $i < count($cat_array); $i++) {
             $table->add_td(array($cat_array[$i]['Name'], $cat_array[$i]['event']));
         }
         if (isset($_POST['newcategory'])) {
             $new_cat_name = Form::add_input('text', "new_category[Name]");
             $new_cat_event = Form::add_input('checkbox', "new_category[event]", 1);
             $newcategory_submit = Form::add_input('image', 'newcategory_submit', 'Speichern', array('src' => $img_apply_path));
             $table->add_td(array($new_cat_name, $new_cat_event . $newcategory_submit));
         }
         $cat_input = Form::add_input('hidden', 'categories', urlencode(serialize($cat_array)));
         $add_button = Form::add_input('image', 'newcategory', 'Kategorie hinzufügen', array('src' => $img_add_path));
         $table->add_td(array(array(2 => $add_button . 'Neue Kategorie' . $cat_input)));
         $all_submit = Form::add_input('image', 'cat_submit', 'Speichern', array('src' => $img_apply_path));
         $table->add_td(array(array(2 => $all_submit . 'Speichern')));
         $return_string .= $table->flush_table() . $form->close_form();
         print $return_string;
     }
 }
 function GET_2_input($skip = '')
 {
     $return = array();
     if (!is_array($skip)) {
         $skip = array($skip);
     }
     $skip = array_merge($skip, $this->custom_parameter_filter);
     foreach ($_GET as $key => $value) {
         if ($key == 'r' || $key == 's' || $key == 'noframe' || in_array($key, $skip)) {
             continue;
         }
         $value = $value;
         $return[] = Form::add_input('hidden', $key, $value);
     }
     return implode("\n", $return);
 }
    function make_form($edit = '')
    {
        if ($edit) {
            $values = $this->get_entry($edit);
            $edit = is_array($edit) ? current($edit) : $edit;
        }
        $return = '';
        $return .= Form::form_tag($this->action ? $this->action : SELF, 'post', 'multipart/form-data', array('onsubmit' => 'return checkform()'));
        $table = new Table(2);
        foreach ($this->cols_array as $key => $col) {
            $name = $key;
            $show_name = $col['name'];
            $id = 'input_' . $GLOBALS['input_id'];
            $encoded_name = rawurlencode($name);
            $attr_array = $col['attributes'];
            if (isset($values[$key])) {
                $value = $values[$key];
            } elseif ($col['value']) {
                $value = $col['value'];
            } elseif ($this->re_entry && $_POST[$name]) {
                $value = $_POST[$name];
            } else {
                $value = '';
            }
            if ($name != 'id') {
                switch ($col['type']) {
                    case 'text':
                        $attr_array['id'] = $id;
                        if (isset($col['length'])) {
                            $attr_array['size'] = $field['length'];
                            $attr_array['maxlength'] = $field['length'];
                        } else {
                            $attr_array['size'] = 40;
                        }
                        $input = Form::add_input('text', $encoded_name, $value, $attr_array);
                        break;
                    case 'select':
                        $attr_array['id'] = $id;
                        $select = new Select($encoded_name, $attr_array);
                        $select->add_option('', '--Bitte auswählen--');
                        $attr_array = array();
                        foreach ($col['options'] as $option => $name) {
                            if ($value == $option) {
                                $attr_array['selected'] = 'selected';
                            } else {
                                unset($attr_array['selected']);
                            }
                            $select->add_option(rawurlencode($option), $name, $attr_array);
                        }
                        if ($col['sonstiges']) {
                            $select->add_option('', 'Sonstige:');
                        }
                        //,array('onclick'=>'sonstig_input(this,\''.rawurlencode($encoded_name).'\')'));
                        $input = $select->flush_select();
                        break;
                    case 'check':
                        $input = '';
                        foreach ($col['options'] as $option => $name) {
                            if (is_array($value) && in_array($option, $value)) {
                                $attr_array['checked'] = 'checked';
                            } else {
                                unset($attr_array['checked']);
                            }
                            $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br();
                        }
                        break;
                    case 'textarea':
                        $attr_array['id'] = $id;
                        $attr_array['cols'] = $col['attributes']['cols'] ? $col['attributes']['cols'] : 30;
                        $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10;
                        $input = Form::add_textarea($encoded_name, $value, $attr_array);
                        //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')'));
                        if ($col['html']) {
                            if (!$xinha_loaded) {
                                $GLOBALS['scripts'] .= Html::script(' _editor_url  = "/' . INSTALL_PATH . '/Libraries/Xinha/";_editor_lang = "de";_document_root = "' . DOCUMENT_ROOT . '"');
                                $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Xinha/htmlarea.js'));
                                $GLOBALS['scripts'] .= Html::script('
									xinha_editors = [];
									xinha_init    = null;
									xinha_config  = null;
									xinha_plugins = null;

									// This contains the names of textareas we will make into Xinha editors
									xinha_init = xinha_init ? xinha_init : function()
									{

										xinha_plugins = xinha_plugins ? xinha_plugins :
										[
										"SuperClean",

										"ImageManager",
										//"GetHtml",
										//"Linker",
										"DoubleClick"
										];
									    if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;


										xinha_editors.push("' . $id . '");

										xinha_config = xinha_config ? xinha_config : new HTMLArea.Config();


										xinha_config.statusBar = false;
										xinha_config.toolbar =
										 [
										    ["bold","italic"],
										    ["separator","createlink","insertimage"],
										    ["separator","undo","redo","selectall"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste","overwrite"]),
										    ["separator","killword","separator","htmlmode","about","showhelp"]
									 	 ];

										//xinha_config.flowToolbars = false;
										xinha_config.showLoading = true;
										//xinha_config.only7BitPrintablesInURLs = false;


										xinha_config.SuperClean.show_dialog = true;
									    xinha_config.SuperClean.filters = {
									               "tidy": HTMLArea._lc("General tidy up and correction of some problems.", "SuperClean"),
									               "word": "Word"
									    }

									    xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);

										HTMLArea.startEditors(xinha_editors);

									}
								window.onload = xinha_init;
							');
                                $xinha_loaded = true;
                            } else {
                                $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")');
                            }
                        }
                        break;
                    case 'upload':
                        $attr_array['id'] = $id;
                        $input = $value ? $value . Form::add_input('hidden', $encoded_name, $value, $attr_array) . Html::br() . Html::span('Neue Datei verknüpfen:', array('class' => 'klein')) . Html::br() : '';
                        $input .= Form::add_input('file', $encoded_name . '_upload');
                        break;
                    case 'custom':
                        $input = $col['custom_input'];
                        break;
                    case 'timestamp':
                        $this->calendar_script();
                        $attr_array['id'] = 'tag_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.';
                        $attr_array['id'] = 'monat_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.';
                        $attr_array['id'] = 'jahr_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . '&emsp;';
                        $attr_array['id'] = 'stunde_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':';
                        $attr_array['id'] = 'minute_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array);
                        $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id));
                        $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id']));
                        $script = '
						Calendar.setup(
							{
								inputField : "' . $id . '", // ID of the input field
								ifFormat : "%Y/%m/%d", // the date format
								button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button
								showsTime : false,
								timeFormat : "24",
								showOthers : true,
								onSelect : onSelect,
								onUpdate : onUpd,
								inputId : ' . $GLOBALS['input_id'] . ',
								prevInput : "test"

							}
						);
						timefields.push("' . $id . '");
				';
                        $input .= Html::script($script);
                        break;
                    case 'email':
                        preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches);
                        $name_value = trim($matches[1]);
                        $mail_value = $matches[2];
                        $attr_array['id'] = 'name_' . $GLOBALS['input_id'];
                        $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array);
                        $attr_array['id'] = 'mail_' . $GLOBALS['input_id'];
                        $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array);
                        break;
                    case 'info':
                        $input = $col['value'];
                        $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array);
                        break;
                    case 'hidden':
                        $attr_array['id'] = $id;
                        $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array);
                        $input = '';
                        break;
                    case 'ignore':
                        unset($input);
                        break;
                }
                if ($col['required'] && $input) {
                    if ($col['type'] == 'timestamp') {
                        $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');");
                        $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');");
                        $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');");
                    } else {
                        $input .= Html::script("\nrequired_fields.push('{$id}');");
                    }
                }
                if ($input) {
                    $table->add_td(array(Form::add_label($id, $show_name), $input));
                }
                $GLOBALS['input_id']++;
            }
        }
        $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button'));
        if ($edit) {
            $input .= Form::add_input('hidden', 'edit_id', $edit);
        }
        $input .= Form::add_input('hidden', 'submit', 'submit');
        $input .= $hidden_inputs;
        $table->add_td(array('', $input));
        $return .= $table->flush_table();
        $return .= Form::close_form();
        return $return;
    }
 function admin_module_reorder()
 {
     $array_to_reorder = $this->admin_installed;
     $array_name_to_reorder = 'admin_module';
     $form_tag = Form::form_tag($_SERVER['REDIRECT_URL'], 'post', 'application/x-www-form-urlencoded', array('name' => 'draglist_form'));
     $draglist_scripts = Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Draglist/assets/dom-drag.js'));
     $draglist_scripts .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Draglist/assets/draglist.js'));
     $dragable_divs = '';
     for ($i = 0; $i < count($array_to_reorder); $i++) {
         $draglist_item = Form::add_input('hidden', "draglist_items[{$i}]", $i);
         $name = $array_to_reorder[$i]['Name'];
         $dragable_divs .= Html::div($name . $draglist_item, array('style' => 'position: relative; left: 0px; top: 0px;cursor:move;'));
     }
     $draglist_container = Html::div($dragable_divs, array('id' => 'draglist_container'));
     $draglist_cmd = Form::add_input('hidden', 'rubrik_reorder', '');
     $draglist_apply = Form::add_input('image', $array_name_to_reorder . '_reorder', 'Speichern', array('src' => $this->images['img_apply_path'], 'alt' => 'Speichern', 'title' => 'Speichern', 'onclick' => "draglist_manager.do_submit('draglist_form','draglist_container')"));
     $form_close = Form::close_form();
     $draglist_call = "var dragListIndex = new Array();\r\n\t\t\t\t\t\t\tdraglist_manager = new fv_dragList( 'draglist_container' );\r\n\t\t\t\t\t\t\tdraglist_manager.setup();\r\n\t\t\t\t\t\t\taddDragList( draglist_manager );";
     $draglist_call = Html::script($draglist_call);
     $this->return = '<p>Ordnen Sie die Einträge neu an, indem Sie sie mit der Maus ziehen.</p>' . $draglist_scripts . $form_tag . $draglist_container . $draglist_cmd . $draglist_apply . $form_close . $draglist_call;
 }
 function neu_form()
 {
     $this->form_scripts();
     $required = array();
     for ($i = 0; $i < count($this->fields); $i++) {
         if ($this->fields[$i]['required']) {
             $required[] = preg_replace('#[^\\w\\.]#', '_', $this->fields[$i]['name']);
         }
     }
     $required = General::array2js('required', $required);
     $form_tag = Form::form_tag(SELF . '?input', 'post', 'multipart/form-data', array('onsubmit' => 'return checkform()'));
     $form_close = Form::close_form();
     $this->scripts .= Html::script($required);
     //$this->scripts .= Html::script('',array('src'=>'/'.INSTALL_PATH.'/Module/BuddyListe/BuddyListe.js'));
     $spalten = 2;
     $table = new Table($spalten, array('id' => 'formtable'));
     $table->id_tbody('form_tbody');
     foreach ($this->fields as $field) {
         $show_name = $field['show_name'] != '' ? $field['show_name'] : $field['name'];
         $show_name = $field['required'] ? $show_name . Html::span('*', array('style' => 'color:red;cursor:help', 'title' => 'Dieses Feld muss ausgefüllt werden.')) : $show_name;
         $encoded_name = rawurlencode($field['name']);
         $id = Html::html_legal_id($field['name']);
         switch ($field['input_type']) {
             case 'text':
                 $parameters = array();
                 $parameters['id'] = $id;
                 if (isset($field['length'])) {
                     $parameters['size'] = $field['length'];
                     $parameters['maxlength'] = $field['length'];
                 } else {
                     $parameters['size'] = 40;
                 }
                 $input = Form::add_input('text', $encoded_name, '', $parameters);
                 break;
             case 'select':
                 $select = new Select($encoded_name, array('id' => $id));
                 $select->add_option('--Bitte auswählen--');
                 foreach ($field['options'] as $option) {
                     $select->add_option(rawurlencode($option), $option);
                 }
                 if ($field['sonstiges']) {
                     $select->add_option('', 'Sonstige:', array('onclick' => 'sonstig_input(this,\'' . rawurlencode($encoded_name) . '\')'));
                 }
                 $input = $select->flush_select();
                 break;
             case 'check':
                 $input = '';
                 foreach ($field['options'] as $option) {
                     $input .= Form::add_input('checkbox', $encoded_name . '[]', rawurlencode($option)) . ' ' . $option . '<br />';
                 }
                 break;
             case 'textarea':
                 $input = Form::add_textarea($encoded_name, '', array('id' => $id, 'cols' => '35', 'rows' => '2', 'onfocus' => 'textarea_grow(\'' . $id . '\')', 'onblur' => 'textarea_shrink(\'' . $id . '\')'));
                 break;
         }
         $table->add_td(array($show_name, $input));
     }
     $fileinput = Form::add_input('file', 'bild[0]');
     $table->add_td(array('Bild 1', $fileinput . Html::a('javascript:;', Html::img('/RheinaufCMS/Module/BuddyListe/edit_add.png', 'Plus', array('title' => 'Noch ein Bild', 'onclick' => 'add_file_upload()')))));
     $table->add_td(array(Form::add_input('submit', 'submit_new_buddyentry', 'Eintragen')), array('style' => 'border-top:1px solid #33466B'));
     $page = new Template(INSTALL_PATH . '/Module/BuddyListe/Templates/Form.template.html');
     $vars['form'] = $form_tag . $table->flush_table() . $form_close;
     return $page->parse_template('TEMPLATE', $vars);
 }
 function order_rooms()
 {
     $rooms_sql = "SELECT rooms.*, indices.Exhibition_id,indices.Exhibition_id,indices.index\n\t\tFROM `{$this->rooms_db_table}` `rooms`\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\n\t\t     ON rooms.RoomId = indices.Raum_id\n\t\tWHERE indices.Exhibition_id = " . $_GET['order'] . "\n\t\tORDER BY indices.index ASC, indices.id ASC";
     $rooms = $this->connection->db_assoc($rooms_sql);
     $script = $this->order_script();
     $return = Html::h(2, $this->get_exhibition_name('order') . ': Reihenfolge bearbeiten');
     $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform'));
     $GLOBALS['scripts'] .= Html::script($script);
     $select = new Select('select[]', array('size' => 24, 'id' => 'select'));
     foreach ($rooms as $room) {
         $select->add_option($room['RoomId'], $room['Roomname']);
     }
     $return .= $select->flush_select() . Html::br();
     $return .= Html::a('javascript:up();', 'Hoch', array('class' => 'button'));
     $return .= Html::a('javascript:down();', 'Runter', array('class' => 'button'));
     $return .= Html::a('javascript:del();', 'Löschen', array('class' => 'button'));
     $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button'));
     $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()'));
     $return .= Form::close_form();
     return $return;
 }
    function make_form($edit = '')
    {
        if ($edit) {
            $values = $this->get_entry($edit);
            $edit = is_array($edit) ? current($edit) : $edit;
        }
        $return = '';
        $return .= Form::form_tag($this->action ? $this->action : SELF, 'post', 'multipart/form-data', array('onsubmit' => 'return checkform()'));
        $table = new Table(2);
        foreach ($this->cols_array as $key => $col) {
            $name = $key;
            $show_name = $col['name'];
            $id = 'input_' . $GLOBALS['input_id'];
            $encoded_name = rawurlencode($name);
            $attr_array = $col['attributes'];
            if (isset($values[$key])) {
                $value = $values[$key];
            } elseif ($col['value']) {
                $value = $col['value'];
            } elseif ($this->re_entry && $_POST[$name]) {
                $value = $_POST[$name];
            } else {
                $value = '';
            }
            if ($name != 'id') {
                switch ($col['type']) {
                    case 'text':
                        $attr_array['id'] = $id;
                        if (isset($col['length'])) {
                            $attr_array['size'] = $field['length'];
                            $attr_array['maxlength'] = $field['length'];
                        } else {
                            $attr_array['size'] = 40;
                        }
                        $input = Form::add_input('text', $encoded_name, $value, $attr_array);
                        break;
                    case 'select':
                        $attr_array['id'] = $id;
                        $select = new Select($encoded_name, $attr_array);
                        $select->add_option('', '--Bitte auswählen--');
                        $attr_array = array();
                        foreach ($col['options'] as $option => $name) {
                            if ($value == $option) {
                                $attr_array['selected'] = 'selected';
                            } else {
                                unset($attr_array['selected']);
                            }
                            $select->add_option(rawurlencode($option), $name, $attr_array);
                        }
                        if ($col['sonstiges']) {
                            $select->add_option('', 'Sonstige:');
                        }
                        //,array('onclick'=>'sonstig_input(this,\''.rawurlencode($encoded_name).'\')'));
                        $input = $select->flush_select();
                        break;
                    case 'check':
                        $input = '';
                        foreach ($col['options'] as $option => $name) {
                            if (is_array($value) && in_array($option, $value)) {
                                $attr_array['checked'] = 'checked';
                            } else {
                                unset($attr_array['checked']);
                            }
                            $input .= Form::add_input('checkbox', $encoded_name . '[]', $option, $attr_array) . ' ' . $name . Html::br();
                        }
                        break;
                    case 'textarea':
                        $attr_array['id'] = $id;
                        $attr_array['cols'] = $col['attributes']['cols'] ? $col['attributes']['cols'] : 30;
                        $attr_array['rows'] = $col['attributes']['rows'] ? $col['attributes']['rows'] : 10;
                        $input = Form::add_textarea($encoded_name, $value, $attr_array);
                        //,'cols'=>'35','rows'=>'2','onfocus'=>'textarea_grow(\''.$id.'\')','onblur'=>'textarea_shrink(\''.$id.'\')'));
                        if ($col['html']) {
                            if (!$xinha_loaded) {
                                $GLOBALS['scripts'] .= Html::script(' _editor_url  = "/' . INSTALL_PATH . '/Libraries/Xinha/";_editor_lang = "de";_document_root = "' . DOCUMENT_ROOT . '";project_name = "' . PROJECT_NAME . '";');
                                $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Libraries/Xinha/XinhaLoader.js'));
                                $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/System/Scaffold/XinhaConfig.php'));
                                $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")');
                                $xinha_loaded = true;
                            } else {
                                $GLOBALS['scripts'] .= Html::script('xinha_editors.push("' . $id . '")');
                            }
                        }
                        break;
                    case 'upload':
                        $attr_array['id'] = $id;
                        $input = $value ? $value . Form::add_input('hidden', $encoded_name, $value, $attr_array) . Html::br() . Html::span('Neue Datei verknüpfen:', array('class' => 'klein')) . Html::br() : '';
                        $input .= Form::add_input('file', $encoded_name . '_upload');
                        break;
                    case 'custom':
                        $input = $col['custom_input'];
                        break;
                    case 'timestamp':
                        $this->calendar_script();
                        $attr_array['id'] = 'tag_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input = Form::add_input('text', $encoded_name . '_tag', ($tag = Date::tag($value)) != 0 && $value != '' ? $tag : '', $attr_array) . '.';
                        $attr_array['id'] = 'monat_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_monat', ($monat = Date::monat($value)) != 0 && $value != '' ? $monat : '', $attr_array) . '.';
                        $attr_array['id'] = 'jahr_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_jahr', ($jahr = Date::jahr($value)) != 0 && $value != '' ? $jahr : '', $attr_array) . '&emsp;';
                        $attr_array['id'] = 'stunde_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_stunde', ($stunde = Date::stunde($value)) != 0 && $value != '' ? $stunde : '', $attr_array) . ':';
                        $attr_array['id'] = 'minute_' . $GLOBALS['input_id'];
                        $attr_array['size'] = '2';
                        $input .= Form::add_input('text', $encoded_name . '_minute', ($minute = Date::minute($value)) != 0 && $value != '' ? $minute : '', $attr_array);
                        $input .= Form::add_input('hidden', $encoded_name, $value, array('id' => $id));
                        $input .= Form::add_input('button', '', 'Kalender', array('id' => 'trigger_' . $GLOBALS['input_id']));
                        $script = '
						Calendar.setup(
							{
								inputField : "' . $id . '", // ID of the input field
								ifFormat : "%Y/%m/%d", // the date format
								button : "trigger_"+' . $GLOBALS['input_id'] . ', // ID of the button
								showsTime : false,
								timeFormat : "24",
								showOthers : true,
								onSelect : onSelect,
								onUpdate : onUpd,
								inputId : ' . $GLOBALS['input_id'] . ',
								prevInput : "test"

							}
						);
						timefields.push("' . $id . '");
				';
                        $input .= Html::script($script);
                        break;
                    case 'email':
                        preg_match('/(.*?)<?([0-9a-z.+-]{2,}\\@[0-9a-z.-]{2,}\\.[a-z]{2,6})>?/', $value, $matches);
                        $name_value = trim($matches[1]);
                        $mail_value = $matches[2];
                        $attr_array['id'] = 'name_' . $GLOBALS['input_id'];
                        $input = 'Name ' . Form::add_input('text', $encoded_name . '_name', $name_value, $attr_array);
                        $attr_array['id'] = 'mail_' . $GLOBALS['input_id'];
                        $input .= 'E-Mail ' . Form::add_input('text', $encoded_name . '_mail', $mail_value, $attr_array);
                        break;
                    case 'info':
                        $input = $col['value'];
                        $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array);
                        break;
                    case 'hidden':
                        $attr_array['id'] = $id;
                        $hidden_inputs .= Form::add_input('hidden', $encoded_name, $value, $attr_array);
                        $input = '';
                        break;
                    case 'ignore':
                        unset($input);
                        break;
                }
                if ($col['required'] && $input) {
                    if ($col['type'] == 'timestamp') {
                        $input .= Html::script("\nrequired_fields.push('" . 'tag_' . $GLOBALS['input_id'] . "');");
                        $input .= Html::script("\nrequired_fields.push('" . 'monat_' . $GLOBALS['input_id'] . "');");
                        $input .= Html::script("\nrequired_fields.push('" . 'jahr_' . $GLOBALS['input_id'] . "');");
                    } else {
                        $input .= Html::script("\nrequired_fields.push('{$id}');");
                    }
                }
                if ($input) {
                    $table->add_td(array(Form::add_label($id, $show_name), $input));
                }
                $GLOBALS['input_id']++;
            }
        }
        $input = $this->submit_button ? $this->submit_button : Form::add_input('submit', 'submit', 'Eintragen', array('class' => 'button'));
        if ($edit) {
            $input .= Form::add_input('hidden', 'edit_id', $edit);
        }
        $input .= Form::add_input('hidden', 'submit', 'submit');
        $input .= $hidden_inputs;
        $table->add_td(array('', $input));
        $return .= $table->flush_table();
        $return .= Form::close_form();
        return $return;
    }
 function order_images()
 {
     $images_sql = "SELECT bilder.*, indices.Bild_id,indices.Raum_id,indices.index\n\t\tFROM `{$this->pics_db_table}` `bilder`\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\n\t\t     ON bilder.id = indices.Bild_id\n\t\tWHERE indices.Raum_id = " . $_GET['order'] . "\n\t\tORDER BY indices.index, indices.id ASC, bilder.Name ASC";
     $images = $this->connection->db_assoc($images_sql);
     $room_info = $this->get_room_info($_GET['order']);
     $return = Html::h(2, $room_info['Roomname'] . ': Reihenfolge bearbeiten');
     $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform', 'style' => 'float:left;margin-right:20px;'));
     $GLOBALS['scripts'] .= Html::script('', array('src' => '/' . INSTALL_PATH . '/Module/RheinaufExhibition/Backend/order.js'));
     $select = new Select('select[]', array('size' => 24, 'id' => 'select', 'onclick' => "preview(this)", 'style' => 'min-width:220px;'));
     foreach ($images as $img) {
         $dateiname = $img['Dateiname'];
         $select->add_option($img['id'], $dateiname . '  ' . $img['Name'], array('filename' => $dateiname));
     }
     $return .= $select->flush_select() . Html::br();
     $return .= Html::a('javascript:void(0);', 'Hoch', array('class' => 'button', 'onclick' => 'up()'));
     $return .= Html::a('javascript:void(0);', 'Runter', array('class' => 'button', 'onclick' => 'down()'));
     $return .= Html::a('javascript:void(0);', 'Löschen', array('class' => 'button', 'onclick' => 'del()'));
     $return .= Html::a('javascript:void(0);', 'Titelbild', array('class' => 'button', 'onclick' => 'coverpic()'));
     if (!$room_info['Titelbild']) {
         $room_info['Titelbild'] = $images[0]['Dateiname'];
     }
     $return .= Form::add_input('hidden', 'coverpic', $room_info['Titelbild'], array('id' => 'coverpic'));
     $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button'));
     $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()'));
     $return .= Form::close_form();
     $return .= Html::div('Ausgewähltes Bild' . Html::br() . Html::img('', '', array('id' => 'selected_preview')), array('style' => 'display:none'));
     $return .= Html::br();
     $return .= 'Titelbild' . Html::br();
     $return .= Html::img('/' . $this->filepath . $this->landscape_thumb_dir . $room_info['Titelbild'], 'Noch nicht festgelegt', array('id' => 'coverpic_preview'));
     return $return;
 }
<?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;
    }
<?php

require_once '../../kernel/begin.php';
require_once 'panel_admin.inc.php';
$requeteConfiguration = $bdd->query('SELECT * FROM ' . TABLE_CONFIG);
$listeForms = array();
while ($configurations = $bdd->fetch($requeteConfiguration)) {
    $form = new Form(translate('edit_config_title'));
    $form->add_fieldset();
    $form->add_input($configurations['config_name'] . '_config_name', $configurations['config_name'] . '_config_name', translate('config_name'))->setValue($configurations['config_name']);
    $configsDatas = unserialize($configurations['config_value']);
    $i = 0;
    foreach ($configsDatas as $k => $config) {
        $i++;
        $form->add_input($configurations['config_name'] . '_config_entry_name_' . $i, $configurations['config_name'] . '_config_entry_name_' . $i, translate('config_entry_name'))->setValue(htmlspecialchars($k));
        $form->add_textarea($configurations['config_name'] . '_config_entry_value_' . $i, $configurations['config_name'] . '_config_entry_value_' . $i, translate('config_entry_value'))->setValue(stripslashes(htmlspecialchars($config)));
    }
    $form->add_input($configurations['config_name'] . '_config_lang', 'config_lang', translate('config_lang'))->setValue($configurations['config_lang']);
    $form->add_button();
    $listeForms[$configurations['config_name']] = $form;
    unset($form);
}
foreach ($listeForms as $nomConfig => $formulaire) {
    $traitement = new FormHandle($formulaire);
    $traitement->handle();
    if ($traitement->okay()) {
        $langSite = $traitement->get($nomConfig . '_config_lang');
        $configValues = array();
        for ($i = 1; ($nomEntree = $traitement->get($nomConfig . '_config_entry_name_' . $i)) != NULL && ($valeurEntree = $traitement->get($nomConfig . '_config_entry_value_' . $i)) != NULL; $i++) {
            $configValues[$nomEntree] = addslashes($valeurEntree);
        }
 function cat_select()
 {
     $return_string = Form::form_tag(SELF, 'get');
     $attr = array();
     $table = new Table(2, array('id' => 'cat_select'));
     foreach ($this->categories as $cat) {
         if (isset($_GET['Kategorie'])) {
             if (in_array(rawurlencode($cat['Name']), $_GET['Kategorie'])) {
                 $attr['checked'] = 'checked';
             } else {
                 unset($attr['checked']);
             }
         }
         if ($cat['Access'] == 'PUBLIC' || $this->check_right('KalenderExtern') || $this->check_right('KalenderIntern')) {
             $inputs[] = Form::add_input('checkbox', 'Kategorie[]', rawurlencode($cat['Name']), $attr);
             $labels[] = $cat['Name'];
         }
     }
     $submit = Form::add_input('submit', 'filter', 'Auswählen', array('class' => 'button'));
     //$table->add_td(array(array(2=>'Ansicht')));
     $table->add_caption('Ansicht');
     for ($i = 0; $i < count($inputs); $i++) {
         $table->add_td(array($labels[$i], $inputs[$i]));
     }
     $table->add_td(array(array(2 => $submit)), array('style' => 'text-align:center'));
     $return_string .= $table->flush_table() . Form::close_form();
     return $return_string;
 }
 function order_images()
 {
     $images_sql = "SELECT bilder.*, indices.Bild_id,indices.Raum_id,indices.index\r\n\t\tFROM `{$this->pics_db_table}` `bilder`\r\n\t\tLEFT JOIN `{$this->indices_db_table}` `indices`\r\n\t\t     ON bilder.id = indices.Bild_id\r\n\t\tWHERE indices.Raum_id = " . $_GET['order'] . "\r\n\t\tORDER BY indices.index,bilder.Name ASC";
     $images = $this->connection->db_assoc($images_sql);
     $script = $this->order_script();
     $room_info = $this->get_room_info($_GET['order']);
     $return = Html::h(2, $room_info['Roomname'] . ': Reihenfolge bearbeiten');
     $return .= Form::form_tag(SELF . '?order=' . $_GET['order'], '', '', array('onsubmit' => 'updateOrder()', 'id' => 'orderform', 'style' => 'float:left;margin-right:20px;'));
     $GLOBALS['scripts'] .= Html::script($script);
     $select = new Select('select[]', array('size' => 24, 'id' => 'select'));
     foreach ($images as $img) {
         $select->add_option($img['id'], $img['Dateiname']);
     }
     $return .= $select->flush_select() . Html::br();
     $return .= Html::a('javascript:up();', 'Hoch', array('class' => 'button'));
     $return .= Html::a('javascript:down();', 'Runter', array('class' => 'button'));
     $return .= Html::a('javascript:del();', 'Löschen', array('class' => 'button'));
     $return .= Html::a('javascript:coverpic();', 'Titelbild', array('class' => 'button'));
     if (!$room_info['Titelbild']) {
         $room_info['Titelbild'] = $images[0]['Dateiname'];
     }
     $return .= Form::add_input('hidden', 'coverpic', $room_info['Titelbild'], array('id' => 'coverpic'));
     $return .= Form::add_input('submit', 'submit', 'Speichern', array('class' => 'button'));
     $return .= Html::a(SELF, 'Zurück', array('class' => 'button', 'onclick' => 'return getChanged()'));
     $return .= Form::close_form();
     $return .= 'Titelbild' . Html::br();
     $return .= Html::img('/Images/Galerie/180/' . $room_info['Titelbild'], 'Noch nicht festgelegt', array('id' => 'coverpic_preview'));
     return $return;
 }