<?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;
    }
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');
$form->build_all();
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();
}
tpl_end();
<?php

require_once '../../kernel/begin.php';
require_once 'panel_admin.inc.php';
tpl_begin();
$listeFichiers = glob(ROOT . 'kernel/templates/*.tpl');
if (isset($_GET['fichier'])) {
    $fichier = $_GET['fichier'];
    $verif = ROOT . 'kernel/templates/' . $fichier . '.tpl';
    if (in_array($verif, $listeFichiers)) {
        $contenu = file_get_contents($verif);
        $form = new Form(translate('file_form'), 'post');
        $form->add_fieldset();
        $form->add_textarea('contenu', 'contenu', translate('content_file'))->setValue($contenu);
        $form->add_button();
        $fh = new FormHandle($form);
        $fh->handle();
        if ($fh->okay()) {
            $contenu = $fh->get('contenu');
            file_put_contents($verif, $contenu);
            $error = new Error();
            $error->add_error(translate('modification_ok'), ERROR_PAGE, __FILE__, __LINE__);
        } else {
            $form->build_all();
        }
    }
}
?>
<p><?php 
echo translate('help_message');
?>
    $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);
        }
        $configValues = serialize($configValues);
        $bdd->query('UPDATE ' . TABLE_CONFIG . ' SET config_lang = ?, config_value = ? WHERE config_name = ?', array($langSite, $configValues, $nomConfig));
        $error = new Error();
        $error->add_error(translate('modification_success'), ERROR_GLOBAL, __FILE__, __LINE__, ROOTU . 'modules/admin/config.php');
    }
}
tpl_begin();
foreach ($listeForms as $form) {
<?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');
<?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();
}
        ?>
</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;
        }
        $form->build_all();
        break;
}
tpl_end();
" 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;
                }
            }
            $params[] = $data['menu_id'];
            if ($requestUpdate !== NULL) {
示例#10
0
<?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();
     $requeteCategories = $bdd->query('SELECT cours_level, cours_id, cours_nom, cours_gauche, cours_droite FROM ' . TABLE_COURS . ' WHERE cours_type = 0 ORDER BY cours_gauche');
     $categorieDuTutoriel = 0;
     while ($donneesCategories = $bdd->fetch($requeteCategories)) {
         $suffixe = NULL;
         for ($i = 0; $i < $donneesCategories['cours_level']; $i++) {
             $suffixe .= '--';
         }
         $suffixe .= '>';
         $selected = $donneesCategories['cours_level'] == $donneesTutoriel['cours_level'] - 1 && $donneesCategories['cours_gauche'] < $donneesTutoriel['cours_gauche'] && $donneesCategories['cours_droite'] > $donneesTutoriel['cours_droite'] ? true : false;
         if ($selected == true) {
             $categorieDuTutoriel = $donneesCategories['cours_id'];
         }
         $listeCategories->add($suffixe . ' ' . htmlspecialchars($donneesCategories['cours_nom']), $donneesCategories['cours_id'], $selected);
     }
     $form->add_button();
     $fh = new FormHandle($form);
     $fh->handle();
     if ($fh->okay()) {
         $coursCateg = $fh->get('cours_categorie');
         $cours = new Cours();
         $dataCours['cours_id'] = $idTutoriel;
         if ($coursCateg != $categorieDuTutoriel) {
             $cours->deplacer_element($coursCateg, $dataCours, $member);
         }
         $error = new error();
         $error->add_error(translate('cours_move_okay'), ERROR_PAGE, __FILE__, __LINE__);
     }
     break;
 case 'afficherTutoriel':
     $idTutoriel = intval($_GET['idTutoriel']);
     $cours = new Cours($idTutoriel);