Ejemplo n.º 1
0
function afficher_form_prefs($erreurs = '')
{
    afficher_html_head($GLOBALS['lang']['preferences']);
    echo '<div id="top">';
    afficher_msg();
    afficher_topnav(basename($_SERVER['PHP_SELF']), $GLOBALS['lang']['preferences']);
    echo '</div>';
    echo '<div id="axe">' . "\n";
    echo '<div id="page">' . "\n";
    echo erreurs($erreurs);
    echo '<form id="preferences" class="bordered-formbloc" method="post" action="' . basename($_SERVER['PHP_SELF']) . '" >';
    $fld_user = '******';
    /* no fieldset because browset can’t style them correctly */
    $fld_user .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_utilisateur'], 'legend-user') . '</div>' . "\n";
    $fld_user .= '<div class="form-lines">' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="auteur">' . $GLOBALS['lang']['pref_auteur'] . '</label>' . "\n";
    $fld_user .= "\t" . '<input type="text" id="auteur" name="auteur" size="30" value="' . (empty($GLOBALS['auteur']) ? $GLOBALS['identifiant'] : $GLOBALS['auteur']) . '" class="text" />' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="email">' . $GLOBALS['lang']['pref_email'] . '</label>' . "\n";
    $fld_user .= "\t" . '<input type="text" id="email" name="email" size="30" value="' . $GLOBALS['email'] . '" class="text" />' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="nomsite">' . $GLOBALS['lang']['pref_nom_site'] . '</label>' . "\n";
    $fld_user .= "\t" . '<input type="text" id="nomsite" name="nomsite" size="30" value="' . $GLOBALS['nom_du_site'] . '" class="text" />' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="racine">' . $GLOBALS['lang']['pref_racine'] . '</label>' . "\n";
    $fld_user .= "\t" . '<input type="text" id="racine" name="racine" size="30" value="' . $GLOBALS['racine'] . '" class="text" />' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="description">' . $GLOBALS['lang']['label_dp_description'] . '</label>' . "\n";
    $fld_user .= "\t" . '<textarea id="description" name="description" cols="35" rows="2" class="text" >' . $GLOBALS['description'] . '</textarea>' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '<p>' . "\n";
    $fld_user .= "\t" . '<label for="keywords">' . $GLOBALS['lang']['pref_keywords'] . '</label>';
    $fld_user .= "\t" . '<textarea id="keywords" name="keywords" cols="35" rows="2" class="text" >' . $GLOBALS['keywords'] . '</textarea>' . "\n";
    $fld_user .= '</p>' . "\n";
    $fld_user .= '</div>' . "\n";
    $fld_user .= '</div>';
    echo $fld_user;
    $fld_securite = '<div role="group" class="pref">';
    $fld_securite .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_securite'], 'legend-securite') . '</div>' . "\n";
    $fld_securite .= '<div class="form-lines">' . "\n";
    $fld_securite .= '<p>' . "\n";
    $fld_securite .= "\t" . '<label for="identifiant">' . $GLOBALS['lang']['pref_identifiant'] . '</label>' . "\n";
    $fld_securite .= "\t" . '<input type="text" id="identifiant" name="identifiant" size="30" value="' . $GLOBALS['identifiant'] . '" class="text" />' . "\n";
    $fld_securite .= '</p>' . "\n";
    $fld_securite .= '<p>' . "\n";
    $fld_securite .= "\t" . '<label for="mdp">' . $GLOBALS['lang']['pref_mdp'] . '</label>';
    $fld_securite .= "\t" . '<input type="password" id="mdp" name="mdp" size="30" value="" class="text" autocomplete="off" />' . "\n";
    $fld_securite .= '</p>' . "\n";
    $fld_securite .= '<p>' . "\n";
    $fld_securite .= "\t" . '<label for="mdp_rep">' . $GLOBALS['lang']['pref_mdp_nouv'] . '</label>';
    $fld_securite .= "\t" . '<input type="password" id="mdp_rep" name="mdp_rep" size="30" value="" class="text" autocomplete="off" />' . "\n";
    $fld_securite .= '</p>' . "\n";
    if (in_array('gd', get_loaded_extensions())) {
        // captcha only possible if GD library is installed.
        $fld_securite .= '<p>' . "\n";
        $fld_securite .= select_yes_no('connexion_captcha', $GLOBALS['connexion_captcha'], $GLOBALS['lang']['pref_connexion_captcha']);
        $fld_securite .= '</p>' . "\n";
    } else {
        $fld_securite .= hidden_input('connexion_captcha', '0');
    }
    $fld_securite .= '</div>';
    $fld_securite .= '</div>';
    echo $fld_securite;
    $fld_apparence = '<div role="group" class="pref">';
    $fld_apparence .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_apparence'], 'legend-apparence') . '</div>' . "\n";
    $fld_apparence .= '<div class="form-lines">' . "\n";
    $fld_apparence .= '<p>' . "\n";
    $fld_apparence .= form_select('theme', liste_themes($GLOBALS['BT_ROOT_PATH'] . $GLOBALS['dossier_themes']), $GLOBALS['theme_choisi'], $GLOBALS['lang']['pref_theme']);
    $fld_apparence .= '</p>' . "\n";
    $fld_apparence .= '<p>' . "\n";
    $fld_apparence .= form_select('nb_maxi', array('5' => '5', '10' => '10', '15' => '15', '20' => '20', '25' => '25', '50' => '50'), $GLOBALS['max_bill_acceuil'], $GLOBALS['lang']['pref_nb_maxi']);
    $fld_apparence .= '</p>' . "\n";
    $fld_apparence .= '<p>' . "\n";
    $fld_apparence .= select_yes_no('aff_onglet_rss', $GLOBALS['onglet_rss'], $GLOBALS['lang']['pref_afficher_rss']);
    $fld_apparence .= '</p>' . "\n";
    $fld_apparence .= '<p>' . "\n";
    $fld_apparence .= select_yes_no('aff_onglet_liens', $GLOBALS['onglet_liens'], $GLOBALS['lang']['pref_afficher_liens']);
    $fld_apparence .= '</p>' . "\n";
    $fld_apparence .= '</div>' . "\n";
    $fld_apparence .= '</div>';
    echo $fld_apparence;
    $fld_dateheure = '<div role="group" class="pref">';
    $fld_dateheure .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_langdateheure'], 'legend-dateheure') . '</div>' . "\n";
    $fld_dateheure .= '<div class="form-lines">' . "\n";
    $fld_dateheure .= '<p>' . "\n";
    $fld_dateheure .= form_langue($GLOBALS['lang']['id']);
    $fld_dateheure .= '</p>' . "\n";
    $fld_dateheure .= '<p>' . "\n";
    $fld_dateheure .= form_format_date($GLOBALS['format_date']);
    $fld_dateheure .= '</p>' . "\n";
    $fld_dateheure .= '<p>' . "\n";
    $fld_dateheure .= form_format_heure($GLOBALS['format_heure']);
    $fld_dateheure .= '</p>' . "\n";
    $fld_dateheure .= '<p>' . "\n";
    $fld_dateheure .= form_fuseau_horaire($GLOBALS['fuseau_horaire']);
    $fld_dateheure .= '</p>' . "\n";
    $fld_dateheure .= '</div>' . "\n";
    $fld_dateheure .= '</div>';
    echo $fld_dateheure;
    $fld_cfg_blog = '<div role="group" class="pref">';
    $fld_cfg_blog .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_configblog'], 'legend-config') . '</div>' . "\n";
    $fld_cfg_blog .= '<div class="form-lines">' . "\n";
    $nbs = array('10' => '10', '25' => '25', '50' => '50', '100' => '100', '300' => '300', '-1' => $GLOBALS['lang']['pref_all']);
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= form_select('nb_list', $nbs, $GLOBALS['max_bill_admin'], $GLOBALS['lang']['pref_nb_list']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= form_select('nb_list_com', $nbs, $GLOBALS['max_comm_admin'], $GLOBALS['lang']['pref_nb_list_com']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= select_yes_no('activer_categories', $GLOBALS['activer_categories'], $GLOBALS['lang']['pref_categories']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= select_yes_no('auto_keywords', $GLOBALS['automatic_keywords'], $GLOBALS['lang']['pref_automatic_keywords']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= select_yes_no('global_comments', $GLOBALS['global_com_rule'], $GLOBALS['lang']['pref_allow_global_coms']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= select_yes_no('require_email', $GLOBALS['require_email'], $GLOBALS['lang']['pref_force_email']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '<p>' . "\n";
    $fld_cfg_blog .= form_select('comm_defaut_status', array('1' => $GLOBALS['lang']['pref_comm_black_list'], '0' => $GLOBALS['lang']['pref_comm_white_list']), $GLOBALS['comm_defaut_status'], $GLOBALS['lang']['pref_comm_BoW_list']);
    $fld_cfg_blog .= '</p>' . "\n";
    $fld_cfg_blog .= '</div>' . "\n";
    $fld_cfg_blog .= '</div>';
    echo $fld_cfg_blog;
    $fld_cfg_linx = '<div role="group" class="pref">';
    $fld_cfg_linx .= '<div class="form-legend">' . legend($GLOBALS['lang']['prefs_legend_configlinx'], 'legend-config') . '</div>' . "\n";
    $fld_cfg_linx .= '<div class="form-lines">' . "\n";
    // nb liens côté admin
    $nbs = array('50' => '50', '100' => '100', '200' => '200', '300' => '300', '500' => '500', '-1' => $GLOBALS['lang']['pref_all']);
    $fld_cfg_linx .= '<p>' . "\n";
    $fld_cfg_linx .= form_select('nb_list_linx', $nbs, $GLOBALS['max_linx_admin'], $GLOBALS['lang']['pref_nb_list_linx']);
    $fld_cfg_linx .= '</p>' . "\n";
    // partage de fichiers !pages : télécharger dans fichiers automatiquement ?
    $nbs = array('0' => $GLOBALS['lang']['non'], '1' => $GLOBALS['lang']['oui'], '2' => $GLOBALS['lang']['pref_ask_everytime']);
    $fld_cfg_linx .= '<p>' . "\n";
    $fld_cfg_linx .= form_select('dl_link_to_files', $nbs, $GLOBALS['dl_link_to_files'], $GLOBALS['lang']['pref_linx_dl_auto']);
    $fld_cfg_linx .= '</p>' . "\n";
    // lien à glisser sur la barre des favoris
    $a = explode('/', dirname($_SERVER['PHP_SELF']));
    $fld_cfg_linx .= '<p>';
    $fld_cfg_linx .= '<label>' . $GLOBALS['lang']['pref_label_bookmark_lien'] . '</label>' . "\n";
    $fld_cfg_linx .= '<a class="dnd-to-favs" onclick="alert(\'' . $GLOBALS['lang']['pref_alert_bookmark_link'] . '\');return false;" href="javascript:javascript:(function(){window.open(\'' . $GLOBALS['racine'] . $a[count($a) - 1] . '/links.php?url=\'+encodeURIComponent(location.href));})();"><b>Save link</b></a>';
    $fld_cfg_linx .= '</p>' . "\n";
    $fld_cfg_linx .= '</div>' . "\n";
    $fld_cfg_linx .= '</div>';
    echo $fld_cfg_linx;
    $fld_maintenance = '<div role="group" class="pref">';
    $fld_maintenance .= '<div class="form-legend">' . legend($GLOBALS['lang']['titre_maintenance'], 'legend-sweep') . '</div>' . "\n";
    $fld_maintenance .= '<div class="form-lines">' . "\n";
    $fld_maintenance .= '<p>' . "\n";
    $fld_maintenance .= select_yes_no('check_update', $GLOBALS['check_update'], $GLOBALS['lang']['pref_check_update']);
    $fld_maintenance .= '</p>' . "\n";
    $fld_maintenance .= '<p>' . "\n";
    $fld_maintenance .= "\t" . '<label>' . $GLOBALS['lang']['pref_go_to_maintenance'] . '</label>' . "\n";
    $fld_maintenance .= "\t" . '<a href="maintenance.php">Maintenance</a>' . "\n";
    $fld_maintenance .= '</p>' . "\n";
    $fld_maintenance .= '</div>' . "\n";
    $fld_maintenance .= '</div>';
    echo $fld_maintenance;
    // check if a new Blogotext version is available (code from Shaarli, by Sebsauvage).
    // Get latest version number at most once a day.
    if ($GLOBALS['check_update'] == 1) {
        if (!is_file($GLOBALS['last-online-file']) or filemtime($GLOBALS['last-online-file']) < time() - 24 * 60 * 60) {
            $last_version = get_external_file('http://lehollandaisvolant.net/blogotext/version.php', 6);
            if (empty($last_version['body'])) {
                $last_version = $GLOBALS['version'];
            }
            // If failed, nevermind. We don't want to bother the user with that.
            file_put_contents($GLOBALS['last-online-file'], $last_version['body']);
            // touch file date
        }
        // Compare versions:
        $newestversion = file_get_contents($GLOBALS['last-online-file']);
        if (version_compare($newestversion, $GLOBALS['version']) == 1) {
            $fld_update = '<div role="group" class="pref">';
            $fld_update .= '<div class="form-legend">' . legend($GLOBALS['lang']['maint_chk_update'], 'legend-update') . '</div>' . "\n";
            $fld_update .= '<div class="form-lines">' . "\n";
            $fld_update .= '<p>' . "\n";
            $fld_update .= "\t" . '<label>' . $GLOBALS['lang']['maint_update_youisbad'] . ' (' . $newestversion . '). ' . $GLOBALS['lang']['maint_update_go_dl_it'] . '</label>' . "\n";
            $fld_update .= "\t" . '<a href="http://lehollandaisvolant.net/blogotext/">lehollandaisvolant.net/blogotext</a>.';
            $fld_update .= '</p>' . "\n";
            $fld_update .= '</div>' . "\n";
            $fld_update .= '</div>' . "\n";
            echo $fld_update;
        }
    }
    echo '<div class="submit-bttns">';
    echo hidden_input('_verif_envoi', '1');
    echo hidden_input('token', new_token());
    echo '<button class="submit white-square" type="button" onclick="annuler(\'preferences.php\');" >' . $GLOBALS['lang']['annuler'] . '</button>' . "\n";
    echo '<input class="submit blue-square" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['enregistrer'] . '" />' . "\n";
    echo '</div>';
    echo '</form>';
}
Ejemplo n.º 2
0
    $out_html .= "\t\t" . '</div>' . "\n";
    $out_html .= "\t" . '<ul id="feed-list">' . "\n";
    $out_html .= feed_list_html();
    $out_html .= "\t" . '</ul>' . "\n";
    $out_html .= "\t" . '<div id="posts-content">' . "\n";
    $out_html .= "\t\t" . '<ul id="post-list">' . "\n";
    if (empty($GLOBALS['liste_flux'])) {
        $out_html .= $GLOBALS['lang']['rss_nothing_here_note'] . '<a href="maintenance.php#form_import">import OPML</a>.';
    }
    $out_html .= '</ul>' . "\n";
    $out_html .= "\t" . '</div>' . "\n";
    $out_html .= "\t" . '<div class="keyshortcut">' . $GLOBALS['lang']['rss_raccourcis_clavier'] . '</div>' . "\n";
    $out_html .= '</div>' . "\n";
    echo $out_html;
    echo "\n" . '<script type="text/javascript">' . "\n";
    echo 'var token = \'' . new_token() . '\';';
    echo 'var openAllSwich = \'open\';';
    echo js_rss_loading_animation(0);
    echo js_rss_json_list(0);
    echo js_rss_sort_from_site(0);
    echo js_rss_refresh(0);
    echo js_rss_openitem(0);
    echo js_rss_add_feed(0);
    echo js_rss_mark_as_read(0);
    echo js_rss_show_unread_only(0);
    echo js_rss_clean_db(0);
    echo js_rss_open_folder(0);
    echo js_rss_use_keyboard_shortcuts(0);
    echo "\n" . '</script>' . "\n";
}
/*
Ejemplo n.º 3
0
function traiter_form_commentaire($commentaire, $admin)
{
    $msg_param_to_trim = isset($_GET['msg']) ? '&msg=' . $_GET['msg'] : '';
    $query_string = str_replace($msg_param_to_trim, '', $_SERVER['QUERY_STRING']);
    // add new comment (admin + public)
    if (isset($_POST['enregistrer']) and empty($_POST['is_it_edit'])) {
        $result = bdd_commentaire($commentaire, 'enregistrer-nouveau');
        if ($result === TRUE) {
            send_emails($commentaire['bt_id']);
            // send emails new comment posted to people that are subscriben
            $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_ajout';
        } else {
            die($result);
        }
    } elseif (isset($_POST['enregistrer']) and $admin == 'admin' and isset($_POST['is_it_edit']) and $_POST['is_it_edit'] == 'yes' and isset($commentaire['ID'])) {
        $result = bdd_commentaire($commentaire, 'editer-existant');
        $redir = basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=confirm_comment_edit';
    } elseif (isset($_POST['com_supprimer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_supprimer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'supprimer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } elseif (isset($_POST['com_activer']) and $admin == 'admin') {
        $comm = array('ID' => htmlspecialchars($_POST['com_activer']), 'bt_article_id' => htmlspecialchars($_POST['com_article_id']));
        $result = bdd_commentaire($comm, 'activer-existant');
        // Ajax response
        if ($result === TRUE) {
            rafraichir_cache();
            //echo var_dump($comm);
            echo 'Success' . new_token();
        } else {
            echo 'Error' . new_token();
        }
        exit;
    } else {
        redirection(basename($_SERVER['PHP_SELF']) . '?' . $query_string . '&msg=nothing_happend_oO');
    }
    if ($result === TRUE) {
        rafraichir_cache();
        redirection($redir);
    } else {
        die($result);
    }
}
Ejemplo n.º 4
0
function afficher_form_rssconf($errors = '')
{
    if (!empty($errors)) {
        echo erreurs($errors);
    }
    $out = '';
    // Form edit + list feeds.
    $out .= '<form id="form-rss-config" method="post" class="bordered-formbloc" action="feed.php?config">' . "\n";
    $out .= '<fieldset class="pref">' . "\n";
    $out .= '<legend class="legend-link">' . 'Your feeds :' . '</legend>' . "\n";
    $out .= '<ul>' . "\n";
    foreach ($GLOBALS['liste_flux'] as $i => $flux) {
        $out .= "\t" . '<li>' . "\n";
        $out .= "\t\t" . '<p ' . ($flux['iserror'] > 2 ? 'class="feed-error" ' : '') . '>' . $flux['title'] . ' ' . ($flux['iserror'] > 2 ? '(' . $flux['iserror'] . ' last requests were errors.)' : '') . '</p>' . "\n";
        $out .= "\t\t" . '<div>' . "\n";
        $out .= "\t\t" . '<p>' . "\n";
        $out .= "\t\t\t" . '<label for="i_' . $flux['checksum'] . '">' . $GLOBALS['lang']['rss_label_titre_flux'] . '</label>' . "\n";
        $out .= "\t\t\t" . '<input id="i_' . $flux['checksum'] . '" name="i_' . $flux['checksum'] . '" type="text" class="text" value="' . htmlspecialchars($flux['title']) . '">' . "\n";
        $out .= "\t\t" . '</p><p>' . "\n";
        $out .= "\t\t\t" . '<label for="j_' . $flux['checksum'] . '">' . $GLOBALS['lang']['rss_label_url_flux'] . '</label>' . "\n";
        $out .= "\t\t\t" . '<input id="j_' . $flux['checksum'] . '" name="j_' . $flux['checksum'] . '" type="text" class="text" value="' . htmlspecialchars($flux['link']) . '">' . "\n";
        $out .= "\t\t\t" . '<button type="button" class="red-square text" onclick="markAsRemove(this)">' . $GLOBALS['lang']['supprimer'] . '</button>' . "\n";
        $out .= "\t\t" . '</p><p>' . "\n";
        $out .= "\t\t\t" . '<label for="l_' . $flux['checksum'] . '">' . $GLOBALS['lang']['rss_label_dossier'] . '</label>' . "\n";
        $out .= "\t\t\t" . '<input id="l_' . $flux['checksum'] . '" name="l_' . $flux['checksum'] . '" type="text" class="text" value="' . htmlspecialchars($flux['folder']) . '">' . "\n";
        $out .= "\t\t" . '<input class="remove-feed nodisplay" name="k_' . $flux['checksum'] . '" type="hidden" value="1">' . "\n";
        $out .= "\t\t" . '</div>' . "\n";
        $out .= "\t" . '</li>' . "\n";
    }
    $out .= '</ul>' . "\n";
    $out .= '<p class="centrer">' . "\n";
    $out .= "\t" . '<input class="submit blue-square" type="submit" name="send" value="' . $GLOBALS['lang']['envoyer'] . '" />' . "\n";
    $out .= '</p>' . "\n";
    $out .= hidden_input('token', new_token());
    $out .= hidden_input('verif_envoi', 1);
    $out .= '</fieldset>' . "\n";
    $out .= '</form>' . "\n";
    // form add new feed.
    $out .= '<form id="form-rss-add" method="post" class="bordered-formbloc" action="feed.php?config">' . "\n";
    $out .= '<fieldset class="pref">' . "\n";
    $out .= '<legend class="legend-link">' . 'Add a feed:' . '</legend>' . "\n";
    $out .= "\t\t\t" . '<label for="new-feed">' . 'New Feed :' . '</label>' . "\n";
    $out .= "\t\t\t" . '<input id="new-feed" name="new-feed" type="text" class="text" value="" placeholder="http://www.example.org/rss">' . "\n";
    $out .= '<p class="centrer">' . "\n";
    $out .= "\t" . '<input class="submit blue-square" type="submit" name="send" value="' . $GLOBALS['lang']['envoyer'] . '" />' . "\n";
    $out .= '</p>' . "\n";
    $out .= hidden_input('token', new_token());
    $out .= hidden_input('verif_envoi', 1);
    $out .= '</fieldset>' . "\n";
    $out .= '</form>' . "\n";
    return $out;
}
Ejemplo n.º 5
0
                    // converts date to YmdHis format
                    $out_array[] = $link;
                }
            }
        }
    }
    return $out_array;
}
/*
 * Affiches les formulaires qui demandent quoi faire. (!isset($do))
 * Font le traitement dans les autres cas.
*/
// no $do nor $file : ask what to do
echo '<div id="maintenance-form">' . "\n";
if (!isset($_GET['do']) and !isset($_FILES['file'])) {
    $token = new_token();
    $nbs = array('10' => '10', '20' => '20', '50' => '50', '100' => '100', '200' => '200', '500' => '500', '-1' => $GLOBALS['lang']['pref_all']);
    echo '<form action="maintenance.php" method="get" class="bordered-formbloc" id="form_todo">' . "\n";
    echo '<label for="select_todo">Que voulez-vous faire&thinsp;?</label>' . "\n";
    echo '<select id="select_todo" name="select_todo" onchange="switch_form(this.value)">' . "\n";
    echo "\t" . '<option selected disabled hidden value=""></option>' . "\n";
    echo "\t" . '<option value="form_export">' . $GLOBALS['lang']['maintenance_export'] . '</option>' . "\n";
    echo "\t" . '<option value="form_import">' . $GLOBALS['lang']['maintenance_import'] . '</option>' . "\n";
    echo "\t" . '<option value="form_optimi">' . $GLOBALS['lang']['maintenance_optim'] . '</option>' . "\n";
    echo '</select>' . "\n";
    echo '</form>' . "\n";
    // Form export
    echo '<form action="maintenance.php" onsubmit="hide_forms(\'exp-format\')" method="get" class="bordered-formbloc" id="form_export">' . "\n";
    // choose export what ?
    echo '<fieldset>' . "\n";
    echo legend($GLOBALS['lang']['maintenance_export'], 'legend-backup');
Ejemplo n.º 6
0
    // on success
    if (empty($erreurs)) {
        $new_fichier = bdd_fichier($fichier, 'ajout-nouveau', 'upload', $_FILES['fichier']);
        $fichier = is_null($new_fichier) ? $fichier : $new_fichier;
        echo '{';
        echo '"url": "fichiers.php?file_id=' . $fichier['bt_id'] . '&amp;edit",';
        echo '"status": "success",';
        echo '"token": "' . new_token() . '"';
        echo '}';
        exit;
    } else {
        echo '{';
        echo '"url": "0",';
        echo '"status": "failure",';
        echo '"token": "0"';
        echo '}';
        exit;
    }
} elseif (isset($_POST['token']) and check_token($_POST['token'])) {
    echo '{';
    echo '"url": "0",';
    echo '"status": "failure",';
    echo '"token": "' . new_token() . '"';
    echo '}';
} else {
    echo '{';
    echo '"url": "0",';
    echo '"status": "failure",';
    echo '"token": "0"';
    echo '}';
}
Ejemplo n.º 7
0
function afficher_form_commentaire($article_id, $mode, $erreurs = '', $comm_id = '')
{
    $GLOBALS['form_commentaire'] = '';
    $p_auteur = isset($_POST['auteur']) ? protect($_POST['auteur']) : '';
    $p_email = isset($_POST['email']) ? protect($_POST['email']) : '';
    $p_webpage = isset($_POST['webpage']) ? protect($_POST['webpage']) : '';
    $p_comm = isset($_POST['commentaire']) ? protect($_POST['commentaire']) : '';
    if (isset($_POST['_verif_envoi']) and !empty($erreurs)) {
        $GLOBALS['form_commentaire'] = '<div id="erreurs"><strong>' . $GLOBALS['lang']['erreurs'] . '</strong> :' . "\n";
        $GLOBALS['form_commentaire'] .= '<ul><li>' . "\n";
        $GLOBALS['form_commentaire'] .= implode('</li><li>', $erreurs);
        $GLOBALS['form_commentaire'] .= '</li></ul></div>' . "\n";
        $defaut = array('auteur' => $p_auteur, 'email' => $p_email, 'webpage' => $p_webpage, 'commentaire' => $p_comm);
    } elseif (isset($mode) and $mode == 'admin') {
        if (empty($comm_id)) {
            $defaut = array('auteur' => $GLOBALS['auteur'], 'email' => $GLOBALS['email'], 'webpage' => $GLOBALS['racine'], 'commentaire' => '');
        } else {
            $actual_comment = $comm_id;
            $defaut = array('auteur' => protect($actual_comment['bt_author']), 'email' => protect($actual_comment['bt_email']), 'webpage' => protect($actual_comment['bt_webpage']), 'commentaire' => htmlspecialchars($actual_comment['bt_wiki_content']), 'status' => protect($actual_comment['bt_statut']));
        }
    } elseif (isset($_POST['previsualiser'])) {
        // parses the comment, but does not save it in a file
        $defaut = array('auteur' => $p_auteur, 'email' => $p_email, 'webpage' => $p_webpage, 'commentaire' => $p_comm);
        $comm['bt_content'] = formatage_commentaires($p_comm);
        $comm['bt_id'] = date('YmdHis');
        $comm['bt_author'] = $p_auteur;
        $comm['bt_email'] = $p_email;
        $comm['bt_webpage'] = $p_webpage;
        $comm['anchor'] = article_anchor($comm['bt_id']);
        $comm['bt_link'] = '';
        $comm['auteur_lien'] = $comm['bt_webpage'] != '' ? '<a href="' . $comm['bt_webpage'] . '" class="webpage">' . $comm['bt_author'] . '</a>' : $comm['bt_author'];
        $GLOBALS['form_commentaire'] .= '<div id="erreurs"><ul><li>Prévisualisation&nbsp;:</li></ul></div>' . "\n";
        $GLOBALS['form_commentaire'] .= '<div id="previsualisation">' . "\n";
        $GLOBALS['form_commentaire'] .= conversions_theme_commentaire(file_get_contents($GLOBALS['theme_post_comm']), $comm);
        $GLOBALS['form_commentaire'] .= '</div>' . "\n";
    } else {
        if (isset($_POST['_verif_envoi'])) {
            header('Location: ' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#top');
            // redirection anti repostage;
        }
        $auteur_c = isset($_COOKIE['auteur_c']) ? protect($_COOKIE['auteur_c']) : '';
        $email_c = isset($_COOKIE['email_c']) ? protect($_COOKIE['email_c']) : '';
        $webpage_c = isset($_COOKIE['webpage_c']) ? protect($_COOKIE['webpage_c']) : '';
        $defaut = array('auteur' => $auteur_c, 'email' => $email_c, 'webpage' => $webpage_c, 'commentaire' => '', 'captcha' => '');
    }
    // prelim vars for Generation of comment Form
    $required = $GLOBALS['require_email'] == 1 ? 'required=""' : '';
    $cookie_checked = (isset($_COOKIE['cookie_c']) and $_COOKIE['cookie_c'] == 1) ? ' checked="checked"' : '';
    $subscribe_checked = (isset($_COOKIE['subscribe_c']) and $_COOKIE['subscribe_c'] == 1) ? ' checked="checked"' : '';
    // COMMENT FORM ON ADMIN SIDE : +always_open –captcha –previsualisation –verif
    if ($mode == 'admin') {
        $rand = substr(md5(rand(100, 999)), 0, 5);
        // begin with some additional stuff on comment "edit".
        if (isset($actual_comment)) {
            // edit
            $form = "\n" . '<form id="form-commentaire-' . $actual_comment['bt_id'] . '" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs">' . "\n";
            $form .= "\t" . '<div class="comm-edit-hidden-bloc">' . "\n";
            $form .= "\t" . '<fieldset class="syst">' . "\n";
            $form .= "\t\t" . hidden_input('is_it_edit', 'yes');
            $form .= "\t\t" . hidden_input('comment_id', $actual_comment['bt_id']);
            $form .= "\t\t" . hidden_input('status', $actual_comment['bt_statut']);
            $form .= "\t\t" . hidden_input('ID', $actual_comment['ID']);
            $form .= "\t\t" . hidden_input('token', $actual_comment['comm-token']);
            $form .= "\t" . '</fieldset><!--end syst-->' . "\n";
        } else {
            $form = "\n" . '<form id="form-commentaire" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs" >' . "\n";
        }
        $form .= "\t" . '<fieldset class="field">' . "\n";
        $form .= "\t\t" . hidden_input('comment_article_id', $article_id);
        $form .= "\t" . '<p class="formatbut">' . "\n";
        $form .= "\t\t" . '<button id="button01" class="but" type="button" title="' . $GLOBALS['lang']['bouton-gras'] . '" onclick="insertTag(\'[b]\',\'[/b]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button02" class="but" type="button" title="' . $GLOBALS['lang']['bouton-ital'] . '" onclick="insertTag(\'[i]\',\'[/i]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button03" class="but" type="button" title="' . $GLOBALS['lang']['bouton-soul'] . '" onclick="insertTag(\'[u]\',\'[/u]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button04" class="but" type="button" title="' . $GLOBALS['lang']['bouton-barr'] . '" onclick="insertTag(\'[s]\',\'[/s]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<span class="spacer"></span>' . "\n";
        $form .= "\t\t" . '<button id="button09" class="but" type="button" title="' . $GLOBALS['lang']['bouton-lien'] . '" onclick="insertTag(\'[\',\'|http://]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button10" class="but" type="button" title="' . $GLOBALS['lang']['bouton-cita'] . '" onclick="insertTag(\'[quote]\',\'[/quote]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button12" class="but" type="button" title="' . $GLOBALS['lang']['bouton-code'] . '" onclick="insertTag(\'[code]\',\'[/code]\',\'commentaire' . $rand . '\');"><span></span></button>' . "\n";
        $form .= "\t" . '</p><!--end formatbut-->' . "\n";
        $form .= "\t\t" . '<textarea class="commentaire text" name="commentaire" required="" placeholder="Lorem Ipsum" id="commentaire' . $rand . '" cols="50" rows="10">' . $defaut['commentaire'] . '</textarea>' . "\n";
        $form .= "\t" . '</fieldset>' . "\n";
        $form .= "\t" . '<fieldset class="infos">' . "\n";
        $form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_pseudo'] . '<input type="text" name="auteur" placeholder="John Doe" required="" value="' . $defaut['auteur'] . '" size="25" class="text" /></label>' . "\n";
        $form .= "\t\t" . '<label>' . ($GLOBALS['require_email'] == 1 ? $GLOBALS['lang']['label_dp_email_required'] : $GLOBALS['lang']['label_dp_email']) . '<input type="email" name="email" placeholder="*****@*****.**" ' . $required . ' value="' . $defaut['email'] . '" size="25" class="text" /></label>' . "\n";
        $form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_webpage'] . '<input type="url" name="webpage" placeholder="http://www.example.com" value="' . $defaut['webpage'] . '" size="25" class="text" /></label>' . "\n";
        $form .= "\t\t" . hidden_input('_verif_envoi', '1');
        $form .= "\t\t" . hidden_input('token', new_token());
        if (isset($actual_comment)) {
            // edit
            $checked = $actual_comment['bt_statut'] == '0' ? 'checked ' : '';
            $form .= "\t" . '<label>' . $GLOBALS['lang']['label_comm_priv'] . '<input type="checkbox" name="activer_comm" ' . $checked . '/></label>' . "\n";
            $form .= "\t" . '</fieldset><!--end info-->' . "\n";
            $form .= "\t" . '<fieldset class="buttons">' . "\n";
            $form .= "\t\t" . hidden_input('ID', $actual_comment['ID']);
            $form .= "\t\t" . '<p class="centrer"><input class="submit blue-square" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" /></p>' . "\n";
        } else {
            $form .= "\t" . '</fieldset><!--end info-->' . "\n";
            $form .= "\t" . '<fieldset class="buttons">' . "\n";
            $form .= "\t\t" . '<p class="centrer"><input class="submit blue-square" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" /></p>' . "\n";
        }
        $form .= "\t" . '</fieldset><!--end buttons-->' . "\n";
        $GLOBALS['form_commentaire'] .= $form;
        $GLOBALS['form_commentaire'] .= (isset($actual_comment) ? "\t" . '</div>' . "\n" : '') . '</form>' . "\n";
        // COMMENT ON PUBLIC SIDE
    } else {
        // Formulaire commun
        $form = "\n" . '<form id="form-commentaire" class="form-commentaire" method="post" action="' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'] . '#erreurs" >' . "\n";
        $form .= "\t" . '<fieldset class="field">' . "\n";
        $form .= "\t" . '<p class="formatbut">' . "\n";
        $form .= "\t\t" . '<button id="button01" type="button" title="' . $GLOBALS['lang']['bouton-gras'] . '" onclick="insertTag(\'[b]\',\'[/b]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button02" type="button" title="' . $GLOBALS['lang']['bouton-ital'] . '" onclick="insertTag(\'[i]\',\'[/i]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button03" type="button" title="' . $GLOBALS['lang']['bouton-soul'] . '" onclick="insertTag(\'[u]\',\'[/u]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button04" type="button" title="' . $GLOBALS['lang']['bouton-barr'] . '" onclick="insertTag(\'[s]\',\'[/s]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<span class="spacer"></span>' . "\n";
        $form .= "\t\t" . '<button id="button09" type="button" title="' . $GLOBALS['lang']['bouton-lien'] . '" onclick="insertTag(\'[\',\'|http://]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button10" type="button" title="' . $GLOBALS['lang']['bouton-cita'] . '" onclick="insertTag(\'[quote]\',\'[/quote]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t\t" . '<button id="button12" type="button" title="' . $GLOBALS['lang']['bouton-code'] . '" onclick="insertTag(\'[code]\',\'[/code]\',\'commentaire\');"><span></span></button>' . "\n";
        $form .= "\t" . '</p><!--end formatbut-->' . "\n";
        $form .= "\t\t" . '<textarea class="commentaire" name="commentaire" required="" placeholder="' . $GLOBALS['lang']['label_commentaire'] . '" id="commentaire" cols="50" rows="10">' . $defaut['commentaire'] . '</textarea>' . "\n";
        $form .= "\t" . '</fieldset>' . "\n";
        $form .= "\t" . '<fieldset class="infos">' . "\n";
        $form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_pseudo'] . '<input type="text" name="auteur" placeholder="John Doe" required="" value="' . $defaut['auteur'] . '" size="25" class="text" /></label>' . "\n";
        $form .= "\t\t" . '<label>' . ($GLOBALS['require_email'] == 1 ? $GLOBALS['lang']['label_dp_email_required'] : $GLOBALS['lang']['label_dp_email']) . '<input type="email" name="email" placeholder="*****@*****.**" ' . $required . ' value="' . $defaut['email'] . '" size="25" /></label>' . "\n";
        $form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_webpage'] . '<input type="url" name="webpage" placeholder="http://www.example.com" value="' . $defaut['webpage'] . '" size="25" /></label>' . "\n";
        $form .= "\t\t" . '<label>' . $GLOBALS['lang']['label_dp_captcha'] . '<b>' . en_lettres($GLOBALS['captcha']['x']) . '</b> &#x0002B; <b>' . en_lettres($GLOBALS['captcha']['y']) . '</b> <input type="number" name="captcha" autocomplete="off" value="" class="text" /></label>' . "\n";
        $form .= "\t\t" . hidden_input('_token', $GLOBALS['captcha']['hash']);
        $form .= "\t\t" . hidden_input('_verif_envoi', '1');
        $form .= "\t" . '</fieldset><!--end info-->' . "\n";
        $form .= "\t" . '<fieldset class="cookie"><!--begin cookie asking -->' . "\n";
        $form .= "\t\t" . '<input class="check" type="checkbox" id="allowcookie" name="allowcookie"' . $cookie_checked . ' />' . label('allowcookie', $GLOBALS['lang']['comment_cookie']) . '<br/>' . "\n";
        $form .= "\t\t" . '<input class="check" type="checkbox" id="subscribe" name="subscribe"' . $subscribe_checked . ' />' . label('subscribe', $GLOBALS['lang']['comment_subscribe']) . "\n";
        $form .= "\t" . '</fieldset><!--end cookie asking-->' . "\n";
        $form .= "\t" . '<fieldset class="buttons">' . "\n";
        $form .= "\t\t" . '<input class="submit" type="submit" name="enregistrer" value="' . $GLOBALS['lang']['envoyer'] . '" />' . "\n";
        $form .= "\t\t" . '<input class="submit" type="submit" name="previsualiser" value="' . $GLOBALS['lang']['preview'] . '" />' . "\n";
        $form .= "\t" . '</fieldset><!--end buttons-->' . "\n";
        // ALLOW COMMENTS : ON
        if (get_entry($GLOBALS['db_handle'], 'articles', 'bt_allow_comments', $article_id, 'return') == '1' and $GLOBALS['global_com_rule'] == '0') {
            $GLOBALS['form_commentaire'] .= $form;
            if ($GLOBALS['comm_defaut_status'] == '0') {
                // petit message en cas de moderation a-priori
                $GLOBALS['form_commentaire'] .= "\t\t" . '<div class="need-validation">' . $GLOBALS['lang']['remarque'] . ' :' . "\n";
                $GLOBALS['form_commentaire'] .= "\t\t\t" . $GLOBALS['lang']['comment_need_validation'] . "\n";
                $GLOBALS['form_commentaire'] .= "\t\t" . '</div>' . "\n";
            }
            $GLOBALS['form_commentaire'] .= '</form>' . "\n";
        } else {
            $GLOBALS['form_commentaire'] .= '<p>' . $GLOBALS['lang']['comment_not_allowed'] . '</p>' . "\n";
        }
    }
}
Ejemplo n.º 8
0
    if ($what == 'all') {
        $query = 'UPDATE rss SET bt_statut=0';
        $array = array();
    } elseif ($what == 'site' and !empty($_POST['url'])) {
        $feedurl = $_POST['url'];
        $query = 'UPDATE rss SET bt_statut=0 WHERE bt_feed=?';
        $array = array($feedurl);
    } elseif ($what == 'post' and !empty($_POST['url'])) {
        $postid = $_POST['url'];
        $query = 'UPDATE rss SET bt_statut=0 WHERE bt_id=?';
        $array = array($postid);
    } elseif ($what == 'folder' and !empty($_POST['url'])) {
        $folder = $_POST['url'];
        $query = 'UPDATE rss SET bt_statut=0 WHERE bt_folder=?';
        $array = array($folder);
    } elseif ($what == 'postlist' and !empty($_POST['url'])) {
        $list = json_decode($_POST['url']);
        $questionmarks = str_repeat("?,", count($list) - 1) . "?";
        $query = 'UPDATE rss SET bt_statut=0 WHERE bt_id IN (' . $questionmarks . ')';
        $array = $list;
    }
    try {
        $req = $GLOBALS['db_handle']->prepare($query);
        $req->execute($array);
        echo 'Success';
        echo new_token();
    } catch (Exception $e) {
        die('Error : Rss mark as read: ' . $e->getMessage());
    }
}
exit;
Ejemplo n.º 9
0
function afficher_form_fichier($erreurs, $fichiers, $what)
{
    // ajout d’un fichier
    $max_file_size = taille_formate(min(return_bytes(ini_get('upload_max_filesize')), return_bytes(ini_get('post_max_size'))));
    $max_file_nb = ini_get('max_file_uploads');
    if ($erreurs) {
        echo erreurs($erreurs);
    }
    $form = '<form id="form-image" class="bordered-formbloc" enctype="multipart/form-data" method="post" action="' . basename($_SERVER['PHP_SELF']) . '" onsubmit="submitdnd(event);">' . "\n";
    if (empty($fichiers)) {
        // si PAS fichier donnée : formulaire nouvel envoi.
        $form .= '<fieldset class="pref" >' . "\n";
        $form .= '<div id="form-dragndrop">' . "\n";
        $form .= '<div id="dragndrop-area" ondragover="event.preventDefault();" ondrop="handleDrop(event);" >' . "\n";
        $form .= "\t" . '<div id="dragndrop-title">' . "\n";
        $form .= "\t\t" . $GLOBALS['lang']['img_drop_files_here'] . "\n";
        $form .= "\t\t" . '<div class="upload-info">(' . $GLOBALS['lang']['label_jusqua'] . $max_file_size . $GLOBALS['lang']['label_parfichier'] . ')</div>' . "\n";
        $form .= "\t" . '</div>' . "\n";
        $form .= "\t" . '<div id="file-input-wrapper"><input name="fichier" id="fichier" type="file" required="" /></div>' . "\n";
        $form .= "\t" . '<button type="button" class="specify-link white-square" id="click-change-form" onclick="return switchUploadForm();" data-lang-url="' . $GLOBALS['lang']['img_specifier_url'] . '" data-lang-file="' . $GLOBALS['lang']['img_upload_un_fichier'] . '">' . $GLOBALS['lang']['img_specifier_url'] . '</button>' . "\n";
        $form .= '</div>' . "\n";
        $form .= '<div id="count"></div>' . "\n";
        $form .= '<div id="result"></div>' . "\n";
        $form .= '</div>' . "\n";
        $form .= '<div id="img-others-infos">' . "\n";
        $form .= "\t" . '<p><label for="nom_entree">' . $GLOBALS['lang']['label_dp_nom'] . '</label><input type="text" id="nom_entree" name="nom_entree" placeholder="' . $GLOBALS['lang']['placeholder_nom_fichier'] . '" value="" size="60" class="text" /></p>' . "\n";
        $form .= "\t" . '<p><label for="description">' . $GLOBALS['lang']['label_dp_description'] . '</label><textarea class="text" id="description" name="description" cols="60" rows="5" placeholder="' . $GLOBALS['lang']['placeholder_description'] . '" ></textarea></p>' . "\n";
        $form .= "\t" . '<p><label for="dossier">' . $GLOBALS['lang']['label_dp_dossier'] . '</label><input type="text" id="dossier" name="dossier" placeholder="' . $GLOBALS['lang']['placeholder_folder'] . '" value="" size="60" class="text" /></p>' . "\n";
        $form .= "\t" . '<p><label for="statut">' . $GLOBALS['lang']['label_file_priv'] . '<input type="checkbox" id="statut" name="statut"/></label></p>';
        $form .= hidden_input('token', new_token(), 'id');
        $form .= hidden_input('_verif_envoi', '1');
        $form .= "\t" . '<p class="submit-bttns"><input class="submit blue-square" type="submit" name="upload" value="' . $GLOBALS['lang']['img_upload'] . '" /></p>' . "\n";
        $form .= '</div>' . "\n";
        $form .= '</fieldset>' . "\n";
    } elseif (!empty($fichiers) and isset($_GET['file_id']) and preg_match('/\\d{14}/', $_GET['file_id'])) {
        $myfile = $fichiers[0];
        if ($myfile['bt_type'] == 'image') {
            $dossier = $GLOBALS['racine'] . $GLOBALS['dossier_images'] . $myfile['bt_path'];
        } else {
            $dossier = $GLOBALS['racine'] . $GLOBALS['dossier_fichiers'];
        }
        $form .= '<div class="edit-fichier">' . "\n";
        // codes d’intégrations pour les médias
        // Video
        if ($myfile['bt_type'] == 'video') {
            $form .= '<div class="display-media"><video class="media" src="' . $dossier . '/' . $myfile['bt_filename'] . '" type="video/' . $myfile['bt_fileext'] . '" load controls="controls"></video></div>' . "\n";
        }
        // image
        if ($myfile['bt_type'] == 'image') {
            $form .= '<div class="display-media"><a href="' . $dossier . '/' . $myfile['bt_filename'] . '"><img class="media" src="' . $dossier . '/' . $myfile['bt_filename'] . '" alt="' . $myfile['bt_filename'] . '" width="' . $myfile['bt_dim_w'] . '" height="' . $myfile['bt_dim_h'] . '" /></a></div>' . "\n";
        }
        // audio
        if ($myfile['bt_type'] == 'music') {
            $form .= '<div class="display-media"><audio class="media" src="' . $dossier . '/' . $myfile['bt_filename'] . '" type="audio/' . $myfile['bt_fileext'] . '" load controls="controls"></audio></div>' . "\n";
        }
        // la partie listant les infos du fichier.
        $form .= '<ul id="fichier-meta-info">' . "\n";
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_nom'] . '</b> ' . $myfile['bt_filename'] . '</li>' . "\n";
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_type'] . '</b> ' . $myfile['bt_type'] . ' (.' . $myfile['bt_fileext'] . ')</li>' . "\n";
        if ($myfile['bt_type'] == 'image') {
            // si le fichier est une image, on ajout ses dimensions en pixels
            $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_dimensions'] . '</b> ' . $myfile['bt_dim_w'] . 'px × ' . $myfile['bt_dim_h'] . 'px' . '</li>' . "\n";
        }
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_date'] . '</b>' . date_formate($myfile['bt_id']) . ', ' . heure_formate($myfile['bt_id']) . '</li>' . "\n";
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_poids'] . '</b>' . taille_formate($myfile['bt_filesize']) . '</li>' . "\n";
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_checksum'] . '</b>' . $myfile['bt_checksum'] . '</li>' . "\n";
        $form .= "\t" . '<li><b>' . $GLOBALS['lang']['label_dp_visibilite'] . '</b>' . ($myfile['bt_statut'] == 1 ? 'Publique' : 'Privée') . '</li>' . "\n";
        $form .= '</ul>' . "\n";
        // la partie des codes d’intégration (bbcode, etc.)
        $form .= '<div id="interg-codes">' . "\n";
        $form .= '<p><strong>' . ucfirst('codes d’intégration :') . '</strong></p>' . "\n";
        $form .= '<input onfocus="this.select()" class="text" type="text" value=\'' . $dossier . '/' . $myfile['bt_filename'] . '\' />' . "\n";
        if ($myfile['bt_type'] == 'image') {
            // si le fichier est une image, on ajout BBCode pour [IMG] et le code en <img/>
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'<img src="' . $dossier . '/' . $myfile['bt_filename'] . '" alt="i" width="' . $myfile['bt_dim_w'] . '" height="' . $myfile['bt_dim_h'] . '" style="max-width: 100%; height: auto;" />\' />' . "\n";
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'<img src="/' . $GLOBALS['dossier_images'] . $myfile['bt_path'] . '/' . $myfile['bt_filename'] . '" alt="i" width="' . $myfile['bt_dim_w'] . '" height="' . $myfile['bt_dim_h'] . '" style="max-width: 100%; height: auto;" />\' />' . "\n";
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'<img src="' . $GLOBALS['dossier_images'] . $myfile['bt_path'] . '/' . $myfile['bt_filename'] . '" alt="i" width="' . $myfile['bt_dim_w'] . '" height="' . $myfile['bt_dim_h'] . '" style="max-width: 100%; height: auto;" />\' />' . "\n";
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'[img]' . $dossier . '/' . $myfile['bt_filename'] . '[/img]\' />' . "\n";
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'[spoiler][img]' . $dossier . '/' . $myfile['bt_filename'] . '[/img][/spoiler]\' />' . "\n";
        } else {
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'<a href="' . $dossier . '/' . $myfile['bt_filename'] . '" />' . $myfile['bt_filename'] . '</a>\' />' . "\n";
            $form .= '<input onfocus="this.select()" class="text" type="text" value=\'[url]' . $dossier . '/' . $myfile['bt_filename'] . '[/url]\' />' . "\n";
        }
        $form .= '</div>' . "\n";
        // la partie avec l’édition du contenu.
        $form .= '<div id="img-others-infos">' . "\n";
        $form .= "\t" . '<p><label for="nom_entree">' . ucfirst($GLOBALS['lang']['label_dp_nom']) . '</label><input type="text" id="nom_entree" name="nom_entree" placeholder="" value="' . pathinfo($myfile['bt_filename'], PATHINFO_FILENAME) . '" size="60" class="text" /></p>' . "\n";
        $form .= "\t" . '<p><label for="description">' . $GLOBALS['lang']['label_dp_description'] . '</label><textarea class="text" name="description" id="description" cols="60" rows="5" placeholder="' . $GLOBALS['lang']['placeholder_description'] . '" >' . $myfile['bt_wiki_content'] . '</textarea></p>' . "\n";
        $form .= "\t" . '<p><label for="dossier">' . $GLOBALS['lang']['label_dp_dossier'] . '</label><input type="text" name="dossier" placeholder="' . $GLOBALS['lang']['placeholder_folder'] . '" value="' . (!empty($myfile['bt_dossier']) ? $myfile['bt_dossier'] : '') . '" size="60" class="text" /></p>' . "\n";
        $checked = $myfile['bt_statut'] == 0 ? 'checked ' : '';
        $form .= "\t" . '<p><label for="statut">' . $GLOBALS['lang']['label_file_priv'] . '<input type="checkbox" id="statut" name="statut" ' . $checked . '/></label></p>';
        $form .= "\t" . '<p class="submit-bttns">' . "\n";
        $form .= "\t\t" . '<input class="submit red-square" type="button" name="supprimer" value="' . $GLOBALS['lang']['supprimer'] . '" onclick="rmFichier(this)" />' . "\n";
        $form .= "\t\t" . '<button class="submit white-square" type="button" onclick="annuler(\'fichiers.php\');">' . $GLOBALS['lang']['annuler'] . '</button>' . "\n";
        $form .= "\t\t" . '<input class="submit blue-square" type="submit" name="editer" value="' . $GLOBALS['lang']['envoyer'] . '" />' . "\n";
        $form .= "\t" . '</p>' . "\n";
        $form .= '</div>' . "\n";
        $form .= hidden_input('_verif_envoi', '1');
        $form .= hidden_input('is_it_edit', 'yes');
        $form .= hidden_input('file_id', $myfile['bt_id']);
        $form .= hidden_input('filename', $myfile['bt_filename']);
        $form .= hidden_input('sha1_file', $myfile['bt_checksum']);
        $form .= hidden_input('path', $myfile['bt_path']);
        $form .= hidden_input('filesize', $myfile['bt_filesize']);
        $form .= hidden_input('token', new_token());
        $form .= '</div>';
    }
    $form .= '</form>' . "\n";
    echo $form;
}
Ejemplo n.º 10
0
        session_set_cookie_params(365 * 24 * 60 * 60);
        // set expiration time to the browser
    } else {
        $_SESSION['stay_logged_mode'] = 0;
        session_regenerate_id(true);
    }
    fichier_ip();
    // Handle saved data/URL redirect if POST request made
    $location = 'index.php';
    if (isset($_SESSION['BT-saved-url'])) {
        $location = $_SESSION['BT-saved-url'];
        unset($_SESSION['BT-saved-url']);
    }
    if (isset($_SESSION['BT-post-token'])) {
        // The login was right, so we give a token because the previous one expired with the session
        $_SESSION['BT-post-token'] = new_token();
    }
    header('Location: ' . $location);
} else {
    // On sort…
    // …et affiche la page d'auth
    afficher_html_head('Identification');
    echo '<div id="axe">' . "\n";
    echo '<div id="pageauth">' . "\n";
    echo '<h1>' . $GLOBALS['nom_application'] . '</h1>' . "\n";
    echo '<form method="post" action="auth.php">' . "\n";
    echo '<div id="auth">' . "\n";
    echo '<p><label for="user">' . ucfirst($GLOBALS['lang']['label_dp_identifiant']) . '</label><input class="text" type="text"  autocomplete="off" id="user" name="nom_utilisateur" placeholder="John Doe" value="" /></p>' . "\n";
    echo '<p><label for="password">' . ucfirst($GLOBALS['lang']['label_dp_motdepasse']) . '</label><input class="text" id="password" type="password" placeholder="••••••••••••" name="mot_de_passe" value="" /></p>' . "\n";
    if (isset($GLOBALS['connexion_captcha']) and $GLOBALS['connexion_captcha'] == "1") {
        echo '<p><label for="word">' . ucfirst($GLOBALS['lang']['label_dp_word_captcha']) . '</label><input class="text" type="text" id="word" name="word" value="" /></p>' . "\n";
Ejemplo n.º 11
0
$liste_fileid = array();
$GLOBALS['liste_fichiers'] = open_serialzd_file($GLOBALS['fichier_liste_fichiers']);
foreach ($GLOBALS['liste_fichiers'] as $key => $file) {
    $liste_fileid[] = $file['bt_id'];
}
if (isset($_FILES['fichier'])) {
    $time = time();
    $fichier = init_post_fichier();
    // avoid ID collisions
    while (in_array($fichier['bt_id'], $liste_fileid)) {
        $time--;
        $fichier['bt_id'] = date('YmdHis', $time);
    }
    $erreurs = valider_form_fichier($fichier);
    if (empty($erreurs)) {
        $new_fichier = bdd_fichier($fichier, 'ajout-nouveau', 'upload', $_FILES['fichier']);
        $fichier = is_null($new_fichier) ? $fichier : $new_fichier;
        echo '
		<div class="success">
			<p>
				Your file: <a class="lien lien-edit" href="fichiers.php?file_id=' . $fichier['bt_id'] . '&amp;edit">' . $fichier['bt_filename'] . '</a> (' . $fichier['bt_type'] . ', ' . taille_formate($fichier['bt_filesize']) . ') has been successfully received.
				<button class="nodisplay" id="token" value="' . new_token() . '"></button>
			</p>
		</div>';
    } else {
        echo '<div class="failure">' . erreurs($erreurs) . '</div>' . "\n";
    }
    exit;
} else {
    echo '<div class="failure">No file</div>' . "\n";
}
Ejemplo n.º 12
0
echo '</div>' . "\n";
echo '</div>' . "\n";
//echo erreurs($erreurs_form);
echo '<div id="page">' . "\n";
// COMMENTAIRES
echo '<div id="liste-commentaires">' . "\n";
if (count($commentaires) > 0) {
    $token = new_token();
    foreach ($commentaires as $content) {
        $content['comm-token'] = $token;
        afficher_commentaire($content, $param_makeup['show_links']);
    }
} else {
    echo info($GLOBALS['lang']['note_no_commentaire']);
}
echo '</div>' . "\n";
if ($param_makeup['menu_theme'] == 'for_article') {
    echo '<div id="post-nv-commentaire">' . "\n";
    afficher_form_commentaire($article_id, 'admin', $erreurs_form);
    echo '<h2 class="poster-comment">' . $GLOBALS['lang']['comment_ajout'] . '</h2>' . "\n";
    echo $GLOBALS['form_commentaire'];
    echo '</div>' . "\n";
}
echo "\n" . '<script src="style/javascript.js" type="text/javascript"></script>' . "\n";
echo '<script type="text/javascript">';
echo js_comm_delete(0);
echo js_comm_activate(0);
echo js_red_button_event(0);
echo 'var csrf_token = \'' . new_token() . '\'';
echo '</script>';
footer('', $begin);