Archives FluxBB.fr

Les archives de FluxBB.fr

Vous n'êtes pas identifié(e).

#1 25-04-2011 12:12:04

scorpion53000
Membre

probleme avec 2 mod en simultané ( topic icon & topic image )

bonjour voici mon probleme
je suis en train de faire une premod basé sur la version 1.22 de punbb

tous fonctionne parfaitement ( j'ai au moins rajouté 40 mod differente et j'ai aucun confli

par contre en se qui conserne met icone et mes topic mon probleme vien de l'envoi dans la base
quand je rentre les donnes manuellement dans la base mysql tous fonctionne ni quel sur le poste modifier

quelqu'un peut t'il me dire ou est le probleme ??

voici mon code

<?php
/***********************************************************************

 version maison 

************************************************************************/

define('PUN_GREYBOX', 1);

define('PUN_ROOT', './');

require PUN_ROOT.'include/common.php';


if ($pun_user['g_read_board'] == '0')
    message($lang_common['No view']);

$ptype = isset($_POST['ptype']) ? intval($_POST['ptype']) : 0;
$tid = isset($_GET['tid']) ? intval($_GET['tid']) : 0;
$fid = isset($_GET['fid']) ? intval($_GET['fid']) : 0;
if ($tid < 1 && $fid < 1 || $tid > 0 && $fid > 0)
    message($lang_common['Bad request']);

// Fetch some info about the topic and/or the forum
if ($tid)
    $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, fp.post_polls, t.subject, t.topicimage, t.closed, t.question FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Impossible de retrouver les informations forum', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, fp.post_polls FROM '.$db->prefix.'forums AS f LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND f.id='.$fid) or error('Impossible de retrouver les informations forum', __FILE__, __LINE__, $db->error());


if (!$db->num_rows($result))
    message($lang_common['Bad request']);

$cur_posting = $db->fetch_assoc($result);

// Is someone trying to post into a redirect forum?
if ($cur_posting['redirect_url'] != '')
    message($lang_common['Bad request']);

// Sort out who the moderators are and if we are currently a moderator (or an admin)
$mods_array = ($cur_posting['moderators'] != '') ? unserialize($cur_posting['moderators']) : array();
$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && array_key_exists($pun_user['username'], $mods_array))) ? true : false;

// Do we have permission to post?
if ((($tid && (($cur_posting['post_replies'] == '' && $pun_user['g_post_replies'] == '0') || $cur_posting['post_replies'] == '0')) ||
    ($fid && ((!isset($_GET['type']) && $ptype == '0')) && (($cur_posting['post_topics'] == '' && $pun_user['g_post_topics'] == '0') || $cur_posting['post_topics'] == '0')) ||
    ($fid && (isset($_GET['type']) || $ptype != '0') && (($cur_posting['post_polls'] == '' && $pun_user['g_post_polls'] == '0') || $cur_posting['post_polls'] == '0')) ||
    (isset($cur_posting['closed']) && $cur_posting['closed'] == '1')) &&
    !$is_admmod)
    message($lang_common['No permission']);

// Load the post.php language file
require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
require PUN_ROOT . 'lang/' . $pun_user['language'] . '/polls.php';
// Start with a clean slate
$errors = array();


// Did someone just hit "Submit" or "Preview"?
if (isset($_POST['form_sent']))
{
    
    // Make sure form_user is correct
    if (($pun_user['is_guest'] && $_POST['form_user'] != 'Invité') || (!$pun_user['is_guest'] && $_POST['form_user'] != $pun_user['username']))
        message($lang_common['Bad request']);

    // Flood protection
    if (!$pun_user['is_guest'] && !isset($_POST['preview']) && $pun_user['last_post'] != '' && (time() - $pun_user['last_post']) < $pun_user['g_post_flood'])
        $errors[] = $lang_post['Flood start'].' '.$pun_user['g_post_flood'].' '.$lang_post['flood end'];

    // If it's a new topic
    if ($fid)
    {
       
        $subject = pun_trim($_POST['req_subject']);
        $taille_up = pun_trim(isset($_POST['unreq_taille'])? $_POST['unreq_taille']: '');
                    
        if ($subject == '')
            $errors[] = $lang_post['No subject'];
        else if (pun_strlen($subject) > 70)
            $errors[] = $lang_post['Too long subject'];
        else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && $pun_user['g_id'] > PUN_MOD)
            $subject = ucwords(strtolower($subject));
            
            
        else if ($pun_config['o_sms'] == '1' && preg_match('#'.$pun_config['o_sms_mots'].'#i', $subject) && $pun_user['g_id'] > PUN_MOD)
            $errors[] = '<span style="color:'.$pun_config['o_sms_couleur'].'; font-weight:bold;">'.$pun_config['o_sms_texte'].'</span>';
            
            
            
        // Mod poll begin
        if(isset($ptype) && $ptype != '0')
        {
        // Get the question
            $question = pun_trim($_POST['req_question']);
            if ($question == '')
                $errors[] = $lang_polls['No question'];
            else if (pun_strlen($question) > 70)
                $errors[] = $lang_polls['Too long question'];
            else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($question) == $question && ($pun_user['g_id'] > PUN_MOD && !$pun_user['g_global_moderation']))
                $question = ucwords(strtolower($question)); 
            // If its a multislect yes/no poll then we need to make sure they have the right values
            if ($ptype == 3) 
            {
                $yesval = pun_trim($_POST['poll_yes']);

                if ($yesval == '')
                    $errors[] = $lang_polls['No yes'];
                else if (pun_strlen($yesval) > 35)
                    $errors[] = $lang_polls['Too long yes'];
                else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($yesval) == $yesval && ($pun_user['g_id'] > PUN_MOD && !$pun_user['g_global_moderation']))
                    $yesval = ucwords(strtolower($yesval));

                $noval = pun_trim($_POST['poll_no']);

                if ($noval == '')
                    $errors[] = $lang_polls['No no'];
                else if (pun_strlen($noval) > 35)
                    $errors[] = $lang_polls['Too long no'];
                else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($noval) == $noval && ($pun_user['g_id'] > PUN_MOD && !$pun_user['g_global_moderation']))
                    $noval = ucwords(strtolower($noval));
            } 
            // This isn't exactly a good way todo it, but it works. I may rethink this code later
            $option = array();
            $lastoption = "null";
            while (list($key, $value) = each($_POST['poll_option'])) 
            {
                $value = pun_trim($value);
                if ($value != "") 
                {
                    if ($lastoption == '')
                        $errors[] = $lang_polls['Empty option'];
                    else 
                    {
                        $option[$key] = pun_trim($value);
                        if (pun_strlen($option[$key]) > 55)
                            $errors[] = $lang_polls['Too long option'];
                        else if ($key > $pun_config['poll_max_fields'])
                            message($lang_common['Bad request']);
                        else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($option[$key]) == $option[$key] && ($pun_user['g_id'] > PUN_MOD && !$pun_user['g_global_moderation']))
                            $option[$key] = ucwords(strtolower($option[$key]));
                    } 
                } 
                $lastoption = pun_trim($value);
            } 

            // People are naughty
            if (empty($option))
                $errors[] = $lang_polls['No options'];

            if (!array_key_exists(2,$option))
                $errors[] = $lang_polls['Low options'];
        }
        // Mod poll end
            
            
    }

    // If the user is logged in we get the username and e-mail from $pun_user
    if (!$pun_user['is_guest'])
    {
        $username = $pun_user['username'];
        $email = $pun_user['email'];
    }
    // Otherwise it should be in $_POST
    else
    {
        $username = trim($_POST['req_username']);
        $email = strtolower(trim(($pun_config['p_force_guest_email'] == '1') ? $_POST['req_email'] : $_POST['email']));

        // Load the register.php/profile.php language files
        require PUN_ROOT.'lang/'.$pun_user['language'].'/prof_reg.php';
        require PUN_ROOT.'lang/'.$pun_user['language'].'/register.php';

        // It's a guest, so we have to validate the username
        if (strlen($username) < 2)
            $errors[] = $lang_prof_reg['Username too short'];
        else if (!strcasecmp($username, 'Guest') || !strcasecmp($username, 'invité') || !strcasecmp($username, $lang_common['Guest']))
            $errors[] = $lang_prof_reg['Username guest'];
        else if (preg_match('/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/', $username))
            $errors[] = $lang_prof_reg['Username IP'];

        if ((strpos($username, '[') !== false || strpos($username, ']') !== false) && strpos($username, '\'') !== false && strpos($username, '"') !== false)
            $errors[] = $lang_prof_reg['Username reserved chars'];
        if (preg_match('#\[b\]|\[/b\]|\[u\]|\[/u\]|\[i\]|\[/i\]|\[color|\[/color\]|\[quote\]|\[quote=|\[/quote\]|\[code\]|\[/code\]|\[img\]|\[/img\]|\[url|\[/url\]|\[email|\[/email\]|\[s\]|\[/s\]|\[nospam|\[/nospam\]|\[dm code=\]|\[yt code=\]|\[gg code=\]
|\[acronym|\[/acronym\]|\[left|\[/left\]|\[right|\[/right\]|\[center|\[/center\]|\[justify|\[/justify\]|\[small|\[/small\]|\[large|\[/large\]|\[sup|\[/sup\]|\[sub|\[/sub\]|\[---\]#i', $username))
            $errors[] = $lang_prof_reg['Username BBCode'];

        // Check username for any censored words
        $temp = censor_words($username);
        if ($temp != $username)
            $errors[] = $lang_register['Username censor'];

        // Check that the username (or a too similar username) is not already registered
        $result = $db->query('SELECT username FROM '.$db->prefix.'users WHERE (username=\''.$db->escape($username).'\' OR username=\''.$db->escape(preg_replace('/[^\w]/', '', $username)).'\') AND id>1') or error('Unable to fetch user info', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result))
        {
            $busy = $db->result($result);
            $errors[] = $lang_register['Username dupe 1'].' '.pun_htmlspecialchars($busy).'. '.$lang_register['Username dupe 2'];
        }

        if ($pun_config['p_force_guest_email'] == '1' || $email != '')
        {
            require PUN_ROOT.'include/email.php';
            if (!is_valid_email($email))
                $errors[] = $lang_common['Invalid e-mail'];
        }
    }

    // Clean up message from POST
    $message = pun_linebreaks(pun_trim($_POST['req_message']));

    if ($message == '')
        $errors[] = $lang_post['No message'];
    else if (strlen($message) > 65535)
        $errors[] = $lang_post['Too long message'];
    else if ($pun_config['p_message_all_caps'] == '0' && strtoupper($message) == $message && $pun_user['g_id'] > PUN_MOD)
        $message = ucwords(strtolower($message));
    else if ($pun_config['o_sms'] == '1' && preg_match('#'.$pun_config['o_sms_mots'].'#i', $message) && $pun_user['g_id'] > PUN_MOD)
        $errors[] = '<span style="color:'.$pun_config['o_sms_couleur'].'; font-weight:bold;">'.$pun_config['o_sms_texte'].'</span>';

    // Validate BBCode syntax
    if ($pun_config['p_message_bbcode'] == '1' && strpos($message, '[') !== false && strpos($message, ']') !== false)
    {
        require PUN_ROOT.'include/parser.php';
        $message = preparse_bbcode($message, $errors);
    }


    require PUN_ROOT.'include/search_idx.php';

    $hide_smilies = isset($_POST['hide_smilies']) ? 1 : 0;
    $subscribe = isset($_POST['subscribe']) ? 1 : 0;

    $now = time();

    // Did everything go according to plan?
    if (empty($errors) && !isset($_POST['preview']))
    {
        // If it's a reply
        if ($tid)
        {
            if (!$pun_user['is_guest'])
            {
                // Insert the new post
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id, user_agent) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.', \''.$db->escape($_SERVER['HTTP_USER_AGENT']).'\')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
$new_pid = $db->insert_id();

                // To subscribe or not to subscribe, that ...
                if ($pun_config['o_subscriptions'] == '1' && $subscribe)
                {
                    $result = $db->query('SELECT 1 FROM '.$db->prefix.'subscriptions WHERE user_id='.$pun_user['id'].' AND topic_id='.$tid) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
                    if (!$db->num_rows($result))
                        $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());
                }
            }
            else
            {
                // It's a guest. Insert the new post
                $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id, user_agent) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$tid.', \''.$db->escape($_SERVER['HTTP_USER_AGENT']).'\')') or error('Unable to create post', __FILE__, __LINE__, $db->error());

$new_pid = $db->insert_id();
            }

            // Count number of replies in the topic
            $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$tid) or error('Unable to fetch post count for topic', __FILE__, __LINE__, $db->error());
            $num_replies = $db->result($result, 0) - 1;

            // Update topic
            $db->query('UPDATE '.$db->prefix.'topics SET num_replies='.$num_replies.', last_post='.$now.', last_post_id='.$new_pid.', last_poster=\''.$db->escape($username).'\' WHERE id='.$tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

            update_search_index('post', $new_pid, $message);

            update_forum($cur_posting['id']);

            // Should we send out notifications?
            if ($pun_config['o_subscriptions'] == '1')
            {
                // Get the post time for the previous post in this topic
                $result = $db->query('SELECT posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT 1, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
                $previous_post_time = $db->result($result);

                // Get any subscribed users that should be notified (banned users are excluded)
                $result = $db->query('SELECT u.id, u.email, u.notify_with_post, u.language FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'subscriptions AS s ON u.id=s.user_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id='.$cur_posting['id'].' AND fp.group_id=u.group_id) LEFT JOIN '.$db->prefix.'online AS o ON u.id=o.user_id LEFT JOIN '.$db->prefix.'bans AS b ON u.username=b.username WHERE b.username IS NULL AND COALESCE(o.logged, u.last_visit)>'.$previous_post_time.' AND (fp.read_forum IS NULL OR fp.read_forum=1) AND s.topic_id='.$tid.' AND u.id!='.intval($pun_user['id'])) or error('Unable to fetch subscription info', __FILE__, __LINE__, $db->error());
                if ($db->num_rows($result))
                {
                    require_once PUN_ROOT.'include/email.php';

                    $notification_emails = array();

                    // Loop through subscribed users and send e-mails
                    while ($cur_subscriber = $db->fetch_assoc($result))
                    {
                        // Is the subscription e-mail for $cur_subscriber['language'] cached or not?
                        if (!isset($notification_emails[$cur_subscriber['language']]))
                        {
                            if (file_exists(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'))
                            {
                                // Load the "new reply" template
                                $mail_tpl = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply.tpl'));

                                // Load the "new reply full" template (with post included)
                                $mail_tpl_full = trim(file_get_contents(PUN_ROOT.'lang/'.$cur_subscriber['language'].'/mail_templates/new_reply_full.tpl'));

                                // The first row contains the subject (it also starts with "Subject:")
                                $first_crlf = strpos($mail_tpl, "\n");
                                $mail_subject = trim(substr($mail_tpl, 8, $first_crlf-8));
                                $mail_message = trim(substr($mail_tpl, $first_crlf));

                                $first_crlf = strpos($mail_tpl_full, "\n");
                                $mail_subject_full = trim(substr($mail_tpl_full, 8, $first_crlf-8));
                                $mail_message_full = trim(substr($mail_tpl_full, $first_crlf));

                                $mail_subject = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject);
                                $mail_message = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message);
                                $mail_message = str_replace('<replier>', $username, $mail_message);
                                $mail_message = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message);
                                $mail_message = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message);
                                $mail_message = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message);

                                $mail_subject_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_subject_full);
                                $mail_message_full = str_replace('<topic_subject>', '\''.$cur_posting['subject'].'\'', $mail_message_full);
                                $mail_message_full = str_replace('<replier>', $username, $mail_message_full);
                                $mail_message_full = str_replace('<message>', $message, $mail_message_full);
                                $mail_message_full = str_replace('<post_url>', $pun_config['o_base_url'].'/viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $mail_message_full);
                                $mail_message_full = str_replace('<unsubscribe_url>', $pun_config['o_base_url'].'/misc.php?unsubscribe='.$tid, $mail_message_full);
                                $mail_message_full = str_replace('<board_mailer>', $pun_config['o_board_title'].' '.$lang_common['Mailer'], $mail_message_full);

                                $notification_emails[$cur_subscriber['language']][0] = $mail_subject;
                                $notification_emails[$cur_subscriber['language']][1] = $mail_message;
                                $notification_emails[$cur_subscriber['language']][2] = $mail_subject_full;
                                $notification_emails[$cur_subscriber['language']][3] = $mail_message_full;

                                $mail_subject = $mail_message = $mail_subject_full = $mail_message_full = null;
                            }
                        }

                        // We have to double check here because the templates could be missing
                        if (isset($notification_emails[$cur_subscriber['language']]))
                        {
                            if ($cur_subscriber['notify_with_post'] == '0')
                                pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][0], $notification_emails[$cur_subscriber['language']][1]);
                            else
                                pun_mail($cur_subscriber['email'], $notification_emails[$cur_subscriber['language']][2], $notification_emails[$cur_subscriber['language']][3]);
                        }
                    }
                }
            }
        }
        // If it's a new topic
        else if ($fid)
        {
          $icon_topic = $_POST['icon_topic'];
          $topicimage = $_POST['topicimage'];
        
            if(isset($ptype)) // Si c'est un sondage
            {
                if ($ptype == 3) 
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question, yes, no, taille_up) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\', \'' . $db->escape($yesval) . '\', \'' . $db->escape($noval) . '\', \''.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
                else
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question, taille_up) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\', \''.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

                $new_tid = $db->insert_id();
                if ($ptype != 0) 
                    $db->query('INSERT INTO ' . $db->prefix . 'polls (pollid, options, ptype) VALUES(' . $new_tid . ', \'' . $db->escape(serialize($option)) . '\', ' . $ptype . ')') or error('Unable to create poll', __FILE__, __LINE__, $db->error());
            }
            else
            {
        
        
            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id, topicimage, icon_topic, taille_up) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.', '.$icon_topic.','.$db->escape($topicimage).','.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
            
            $new_tid = $db->insert_id();


            
        
            
            }

            if (!$pun_user['is_guest'])
            {
                // To subscribe or not to subscribe, that ...
                if ($pun_config['o_subscriptions'] == '1' && (isset($_POST['subscribe']) && $_POST['subscribe'] == '1'))
                    $db->query('INSERT INTO '.$db->prefix.'subscriptions (user_id, topic_id) VALUES('.$pun_user['id'].' ,'.$new_tid.')') or error('Unable to add subscription', __FILE__, __LINE__, $db->error());

                // Create the post ("topic post")
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_id, poster_ip, message, hide_smilies, posted, topic_id, user_agent) VALUES(\''.$db->escape($username).'\', '.$pun_user['id'].', \''.get_remote_address().'\', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.', \''.$db->escape($_SERVER['HTTP_USER_AGENT']).'\')') or error('Unable to create post', __FILE__, __LINE__, $db->error());
}
            else
            {
                // Create the post ("topic post")
                $email_sql = ($pun_config['p_force_guest_email'] == '1' || $email != '') ? '\''.$email.'\'' : 'NULL';
                $db->query('INSERT INTO '.$db->prefix.'posts (poster, poster_ip, poster_email, message, hide_smilies, posted, topic_id, user_agent) VALUES(\''.$db->escape($username).'\', \''.get_remote_address().'\', '.$email_sql.', \''.$db->escape($message).'\', \''.$hide_smilies.'\', '.$now.', '.$new_tid.', \''.$db->escape($_SERVER['HTTP_USER_AGENT']).'\')') or error('Unable to create post', __FILE__, __LINE__, $db->error());

}
            $new_pid = $db->insert_id();

            // Update the topic with last_post_id
            $db->query('UPDATE '.$db->prefix.'topics SET last_post_id='.$new_pid.' WHERE id='.$new_tid) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

            update_search_index('post', $new_pid, $message, $subject);

            update_forum($fid);
        }

        // If the posting user is logged in, increment his/her post count
        if (!$pun_user['is_guest'])
        {
            $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
            $db->query('UPDATE '.$low_prio.$db->prefix.'users SET num_posts=num_posts+1, last_post='.$now.' WHERE id='.$pun_user['id']) or error('Unable to update user', __FILE__, __LINE__, $db->error());
        }

        redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect']);
    }
}


// If a topic id was specified in the url (it's a reply).
if ($tid)
{
    $action = $lang_post['Post a reply'];
    $form = '<form id="post" method="post" action="post.php?action=post&amp;tid='.$tid.'" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">';

    // If a quote-id was specified in the url.
    if (isset($_GET['qid']))
    {
        $qid = intval($_GET['qid']);
        if ($qid < 1)
            message($lang_common['Bad request']);

        $result = $db->query('SELECT poster, message FROM '.$db->prefix.'posts WHERE id='.$qid.' AND topic_id='.$tid) or error('Unable to fetch quote info', __FILE__, __LINE__, $db->error());
        if (!$db->num_rows($result))
            message($lang_common['Bad request']);

        list($q_poster, $q_message) = $db->fetch_row($result);

        $q_message = str_replace('[img]', '[url]', $q_message);
        $q_message = str_replace('[/img]', '[/url]', $q_message);
        // Mod: FLV Player 1.0.0 (2 nouvelles lignes suivent)
        $q_message = preg_replace("/\[flv url=([^ ]+)\]/", "[url]$1[/url]", $q_message);
        $q_message = preg_replace("/\[flv url=([^ ]+) width=([0-9]*) height=([0-9]*)\]/", "[url]$1[/url]", $q_message);
        // Mod: Dailymotion Player (2 nouvelles lignes suivent)
        $q_message = preg_replace("/\[dm code=([^ ]+)\]/", "[url]$1[/url]", $q_message);
        $q_message = preg_replace("/\[dm code=([^ ]+) width=([0-9]*) height=([0-9]*)\]/", "[url]$1[/url]", $q_message);
        // MOD HIDE TAG begin
        $q_message = preg_replace("#\[hide](.+?)\[/hide\]#is", '[b][[i]'.$lang_topic['Hidden text'].'.[/i]][/b]', $q_message);
        // MOD HIDE TAG end
        $q_message = pun_htmlspecialchars($q_message);

        if ($pun_config['p_message_bbcode'] == '1')
        {
            // If username contains a square bracket, we add "" or '' around it (so we know when it starts and ends)
            if (strpos($q_poster, '[') !== false || strpos($q_poster, ']') !== false)
            {
                if (strpos($q_poster, '\'') !== false)
                    $q_poster = '"'.$q_poster.'"';
                else
                    $q_poster = '\''.$q_poster.'\'';
            }
            else
            {
                // Get the characters at the start and end of $q_poster
                $ends = substr($q_poster, 0, 1).substr($q_poster, -1, 1);

                // Deal with quoting "Username" or 'Username' (becomes '"Username"' or "'Username'")
                if ($ends == '\'\'')
                    $q_poster = '"'.$q_poster.'"';
                else if ($ends == '""')
                    $q_poster = '\''.$q_poster.'\'';
            }

            $quote = '[quote='.$q_poster.']'.$q_message.'[/quote]'."\n";
        }
        else
            $quote = '> '.$q_poster.' '.$lang_common['wrote'].':'."\n\n".'> '.$q_message."\n";
    }

    $forum_name = '<a href="viewforum.php?id='.$cur_posting['id'].'">'.pun_htmlspecialchars($cur_posting['forum_name']).'</a>';
}
// If a forum_id was specified in the url (new topic).
else if ($fid)
{
    $action = $lang_post['Post new topic'];
    $form = '<form id="post" method="post" action="post.php?action=post&amp;fid='.$fid.'" onsubmit="return process_form(this)">';

    $forum_name = pun_htmlspecialchars($cur_posting['forum_name']);
}
else
    message($lang_common['Bad request']);

// Mod poll begin
if((isset($_GET['type']) && $ptype == '0') || ($ptype == 1 || $ptype == 2 || $ptype == 3)) // Si c'est un sondage
{    
    $page_title = pun_htmlspecialchars($pun_config['o_board_title']) . ' / ' . $action;
    $cur_index = 1; 
    if ($fid)
    {
        if ($ptype == 0) 
        {
            $form = '<form id="post" method="post" action="post.php?&amp;fid=' . $fid . '">';
            
            $required_fields = array('req_email' => $lang_common['E-mail'], 'req_question' => $lang_polls['Question'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
            $focus_element = array('post');

            if (!$pun_user['is_guest'])
                $focus_element[] = 'req_question';
            else {
                $required_fields['req_username'] = $lang_post['Guest name'];
                $focus_element[] = 'req_question';
            } 
            require PUN_ROOT . 'header.php';
            ?>
            <div class="linkst">
                    <div class="inbox">
                        <ul>
                            <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&#160;&raquo;&#160;<?php echo $forum_name ?></li>
                        </ul>
                    </div>
            </div>

            <div class="blockform">
                <h2><span><?php echo $action ?></span></h2>
                <div class="box">
                    <?php echo $form . "\n" ?>
                        <div class="inform">
                            <fieldset>
                                <legend><?php echo $lang_polls['Poll select'] ?></legend>
                                <div class="infldset txtarea">
                                    <select tabindex="<?php echo $cur_index++ ?>" name="ptype">
                                        <option value="1"><?php echo $lang_polls['Regular'] ?></option>
                                        <option value="2"><?php echo $lang_polls['Multiselect'] ?></option>
                                        <option value="3"><?php echo $lang_polls['Yesno'] ?></option>
                                    </select>
                                </div>
                            </fieldset>
                        </div>
                        <p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" />&nbsp;<a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
                    </form>
                </div>
            </div>
            <?php
        }
        elseif ($ptype == 1 || $ptype == 2 || $ptype == 3) 
        {
            $required_fields = array('req_email' => $lang_common['E-mail'], 'req_question' => $lang_polls['Question'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
            $focus_element = array('post');

            if (!$pun_user['is_guest'])
                $focus_element[] = 'req_question';
            else {
                $required_fields['req_username'] = $lang_post['Guest name'];
                $focus_element[] = 'req_question';
            } 
            require PUN_ROOT . 'header.php';
            ?>
            <div class="linkst">
                    <div class="inbox">
                        <ul>
                            <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&#160;&raquo;&#160;<?php echo $forum_name ?></li>
                        </ul>
                    </div>
            </div>
            <?php 
            
            // If there are errors, we display them
            if (!empty($errors)) 
            {
            ?>
            <div id="posterror" class="block">
                    <h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
                    <div class="box">
                        <div class="inbox">
                            <p><?php echo $lang_post['Post errors info'] ?></p>
                            <ul>
                            <?php
                            while (list(, $cur_error) = each($errors))
                            echo "\t\t\t\t" . '<li><strong>' . $cur_error . '</strong></li>' . "\n";
                            ?>
                            </ul>
                        </div>
                    </div>
            </div>
            <?php
            } 
            else if (isset($_POST['preview'])) 
            {
                require_once PUN_ROOT . 'include/parser.php';
                $preview_message = parse_message(trim($_POST['req_message']), $hide_smilies);
                ?>
                <div id="postpreview" class="blockpost">
                <h2><span><?php echo $lang_polls['Poll preview'] ?></span></h2>
                <div class="box">
                    <div class="inbox">
                        <div class="postright">
                            <div class="postmsg">
                            <?php
                            if ($ptype == 1) 
                            {
                                ?>
                                <form action="" method="POST">
                                    <fieldset>
                                        <legend><?php echo pun_htmlspecialchars($question); ?></legend>
                                        <?php
                                        while (list($key, $value) = each($option)) 
                                        {
                                            if (!empty($value)) 
                                            {
                                                echo '<br /><input type="radio" /><span>' . pun_htmlspecialchars($value) . '</span><br />';
                                            } 
                                        } 
                                        ?><br />
                                    </fieldset>
                                </form>
                                <?php
                            }         
                            elseif ($ptype == 2) 
                            {
                                ?>
                                <form action="" method="POST">
                                    <fieldset>
                                        <legend><?php echo pun_htmlspecialchars($question); ?></legend>
                                        <?php
                                        while (list($key, $value) = each($option)) 
                                        {
                                            if (!empty($value)) 
                                            {
                                                echo '<br /><input type="checkbox" /><span>' . pun_htmlspecialchars($value) . '</span><br />';
                                            } 
                                        } 
                                        ?><br />
                                    </fieldset>
                                </form>
                                <?php    
                            } 
                            elseif ($ptype == 3) 
                            {
                                ?>
                                <form action="" method="POST">
                                    <fieldset>
                                        <legend><?php echo pun_htmlspecialchars($question); ?></legend>
                                        <?php
                                        while (list($key, $value) = each($option)) 
                                        {
                                            if (!empty($value)) 
                                            {
                                                echo '<br />' . pun_htmlspecialchars($value) . '<br />
                                                <input type="radio" /><span>' . pun_htmlspecialchars($yesval) . '</span><br />
                                                <input type="radio" /><span>' . pun_htmlspecialchars($noval) . '</span><br />';
                                            } 
                                        } 
                                        ?><br />
                                    </fieldset>
                                </form>
                                <?php
                            } 
                            ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="postpreview" class="blockpost">
                <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
                <div class="box">
                    <div class="inbox">
                        <div class="postright">
                            <div class="postmsg">
                                <?php echo $preview_message . "\n" ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <?php

            } 
            ?>
            <div class="blockform">
                <h2><span><?php echo $action ?></span></h2>
                <div class="box">
                    <?php echo $form . "\n" ?>
                        <div class="inform">
                            <fieldset>
                            <?php            
                            // Regular Poll Type
                            if ($ptype == 1) 
                            {
                            ?>
                                <legend><?php echo $lang_polls['New poll legend'] ?></legend>
                                <div class="infldset">
                                    <input type="hidden" name="ptype" value="1" />
                                        <label><strong><?php echo $lang_polls['Question'] ?></strong><br /><input type="text" name="req_question" value="<?php if (isset($_POST['req_question'])) echo pun_htmlspecialchars($question); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /><br /></label>
                                        <?php
                                        for ($x = 1; $x <= $pun_config['poll_max_fields'] ;$x++) 
                                        {
                                        ?>
                                            <label><strong><?php echo $lang_polls['Option'] ?></strong><br /> <input type="text" name="poll_option[<?php echo $x; ?>]" value="<?php if (isset($_POST['poll_option'][$x])) echo pun_htmlspecialchars($option[$x]); ?>" size="60" maxlength="55" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
                                        <?php
                                        } 
                                        ?></div></fieldset></div><?php   
                            } 
                            // Multiselect poll type
                            elseif ($ptype == 2) 
                            {
                            ?>
                                <legend><?php echo $lang_polls['New poll legend multiselect'] ?></legend>
                                <div class="infldset">
                                <input type="hidden" name="ptype" value="2" />
                                    <label><strong><?php echo $lang_polls['Question'] ?></strong><br /><input type="text" name="req_question" value="<?php if (isset($_POST['req_question'])) echo pun_htmlspecialchars($question); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /><br /></label>
                                    <?php
                                    for ($x = 1; $x <= $pun_config['poll_max_fields']; $x++) 
                                    {
                                        ?>
                                        <label><strong><?php echo $lang_polls['Option'] ?></strong><br /> <input type="text" name="poll_option[<?php echo $x; ?>]" value="<?php if (isset($_POST['poll_option'][$x])) echo pun_htmlspecialchars($option[$x]); ?>" size="60" maxlength="55" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
                                        <?php
                                    } 
                                    ?></div></fieldset></div><?php
                            } 
                            elseif ($ptype == 3) 
                            {
                            ?>
                                <legend><?php echo $lang_polls['New poll legend yesno'] ?></legend>
                                <div class="infldset">
                                <input type="hidden" name="ptype" value="3" />
                                    <label><strong><?php echo $lang_polls['Question'] ?></strong><br /><input type="text" name="req_question" value="<?php if (isset($_POST['req_question'])) echo pun_htmlspecialchars($question); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /><br /></label>
                                    <label><strong><?php echo $lang_polls['Yes'] ?></strong><br /> <input type="text" name="poll_yes" value="<?php if (isset($_POST['poll_yes'])) echo pun_htmlspecialchars($yesval); ?>" size="40" maxlength="35" tabindex="<?php echo $cur_index++ ?>" /></label>
                                    <label><strong><?php echo $lang_polls['No'] ?></strong><br /> <input type="text" name="poll_no" value="<?php if (isset($_POST['poll_no'])) echo pun_htmlspecialchars($noval); ?>" size="40" maxlength="35" tabindex="<?php echo $cur_index++ ?>" /><br /><br /></label>
                                    <?php
                                    for ($x = 1; $x <= $pun_config['poll_max_fields']; $x++) 
                                    {
                                        ?>
                                        <label><strong><?php echo $lang_polls['Option'] ?></strong><br /> <input type="text" name="poll_option[<?php echo $x; ?>]" value="<?php if (isset($_POST['poll_option'][$x])) echo pun_htmlspecialchars($option[$x]); ?>" size="60" maxlength="55" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
                                        <?php
                                    } 
                                    ?></div></fieldset></div><?php        
                            } 
                            else
                                message($lang_common['Bad request']);


        } else
            message($lang_common['Bad request']);
    } 
} 
else
{
// Mod poll end 
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / '.$action;
$required_fields = array('req_email' => $lang_common['E-mail'], 'req_subject' => $lang_common['Subject'], 'req_message' => $lang_common['Message']);
$focus_element = array('post');

if (!$pun_user['is_guest'])
    $focus_element[] = ($fid) ? 'req_subject' : 'req_message';
else
{
    $required_fields['req_username'] = $lang_post['Guest name'];
    $focus_element[] = 'req_username';
}

require PUN_ROOT.'header.php';

?>
<div class="linkst">
    <div class="inbox">
        <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&nbsp;&raquo;&nbsp;<?php echo $forum_name ?><?php if (isset($cur_posting['subject'])) echo '</li><li>&nbsp;&raquo;&nbsp;'.pun_htmlspecialchars($cur_posting['subject']) ?></li></ul>
    </div>
</div>

<?php

// If there are errors, we display them
if (!empty($errors))
{

?>
<div id="posterror" class="block">
    <h2><span><?php echo $lang_post['Post errors'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <p><?php echo $lang_post['Post errors info'] ?></p>
            <ul>
<?php

    while (list(, $cur_error) = each($errors))
        echo "\t\t\t\t".'<li><strong>'.$cur_error.'</strong></li>'."\n";
?>
            </ul>
        </div>
    </div>
</div>

<?php

}
else if (isset($_POST['preview']))
{
    require_once PUN_ROOT.'include/parser.php';
    $preview_message = parse_message($message, $hide_smilies);

?>
<div id="postpreview" class="blockpost">
    <h2><span><?php echo $lang_post['Post preview'] ?></span></h2>
    <div class="box">
        <div class="inbox">
            <div class="postright">
                <div class="postmsg">
                    <?php echo $preview_message."\n" ?>
                </div>
            </div>
        </div>
    </div>
</div>

<?php

}



}

if (!isset($_GET['type'])) 
{
    $cur_index = 100;

    if($ptype == '0')
    {
    ?>
    
    <!-- MOD AJAX post preview -->
<div id="ajaxpostpreview"></div>
<!--// MOD AJAX post preview -->
    <div class="blockform">
        <h2><span><?php echo $action ?></span></h2>
        <div class="box">
        
        
<style type="text/css">A#vbUL_xsihda{display:none}</style>
<table align="center">
<tr>
<td>

<img src="generateurup.JPG" />

</td>
</tr>
</table>
<table width="200" border="0" align="center"  cellspacing="0" id="vista-buttons_com_idxsihd">
  <tr><td style="padding-right:0px" title ="Jeux">
<a href="presentation/?page=jeu" rel="gb_page_center[850, 600]" onmouseover='xpe("xsihdo");' onmouseout='xpe("xsihdn");' onmousedown='xpe("xsihdc");'><img id="xpi_xsihd" src="prezup-files/btxsihd_0.jpg" name="vbxsihd" width="49" height="28" border="0" alt="Jeux" /></a></td><td style="padding-right:0px" title ="Films">
<a href="presentation/?page=film" rel="gb_page_center[850, 600]" onmouseover='xpe("lsihdo");' onmouseout='xpe("lsihdn");' onmousedown='xpe("lsihdc");'><img id="xpi_lsihd" src="prezup-files/btlsihd_0.jpg" name="vblsihd" width="50" height="28" border="0" alt="Films" /></a></td><td style="padding-right:0px" title ="Séries">
<a href="presentation/?page=serie" rel="gb_page_center[850, 600]" onmouseover='xpe("bsihdo");' onmouseout='xpe("bsihdn");' onmousedown='xpe("bsihdc");'><img id="xpi_bsihd" src="prezup-files/btbsihd_0.jpg" name="vbbsihd" width="60" height="28" border="0" alt="Séries" /></a></td><td style="padding-right:0px" title ="Spectacles">
<a href="presentation/?page=spectacle" rel="gb_page_center[850, 600]" onmouseover='xpe("fsihdo");' onmouseout='xpe("fsihdn");' onmousedown='xpe("fsihdc");'><img id="xpi_fsihd" src="prezup-files/btfsihd_0.jpg" name="vbfsihd" width="90" height="28" border="0" alt="Spectacles" /></a></td><td style="padding-right:0px" title ="Mangas">
<a href="presentation/?page=manga"  rel="gb_page_center[850, 600]" onmouseover='xpe("nsihdo");' onmouseout='xpe("nsihdn");' onmousedown='xpe("nsihdc");'><img id="xpi_nsihd" src="prezup-files/btnsihd_0.jpg" name="vbnsihd" width="70" height="28" border="0" alt="Mangas" /></a></td><td style="padding-right:0px" title ="Logiciels">
<a href="presentation/?page=log" rel="gb_page_center[850, 600]" onmouseover='xpe("hsihdo");' onmouseout='xpe("hsihdn");' onmousedown='xpe("hsihdc");'><img id="xpi_hsihd" src="prezup-files/bthsihd_0.jpg" name="vbhsihd" width="74" height="28" border="0" alt="Logiciels" /></a></td><td style="padding-right:0px" title ="Albums">
<a href="presentation/?page=album" rel="gb_page_center[850, 600]" onmouseover='xpe("jsihdo");' onmouseout='xpe("jsihdn");' onmousedown='xpe("jsihdc");'><img id="xpi_jsihd" src="prezup-files/btjsihd_0.jpg" name="vbjsihd" width="67" height="28" border="0" alt="Albums" /></a></td><td style="padding-right:0px" title ="Ebooks">
<a href="presentation/?page=ebook" rel="gb_page_center[850, 600]" onmouseover='xpe("ksihdo");' onmouseout='xpe("ksihdn");' onmousedown='xpe("ksihdc");'><img id="xpi_ksihd" src="prezup-files/btksihd_0.jpg" name="vbksihd" width="65" height="28" border="0" alt="Ebooks" /></a></td><td style="padding-right:0px" title ="Presentation Membres">
<a href="presentation/?page=membres" rel="gb_page_center[850, 600]" onmouseover='xpe("gsihdo");' onmouseout='xpe("gsihdn");' onmousedown='xpe("gsihdc");'><img id="xpi_gsihd" src="prezup-files/btgsihd_0.jpg" name="vbgsihd" width="167" height="28" border="0" alt="Presentation Membres" /></a></td></tr></table><script type="text/javascript"> var vbImgPath="prezup-files/"</script>
<script type="text/javascript" src="prezup-files/scxsihd.js"></script>

        
            <?php echo $form."\n" ?>
    <?php
    }
    ?>
    
          <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_common['Write message legend'] ?></legend>
                    <div class="infldset txtarea">
                        <input type="hidden" name="form_sent" value="1" />
                        <input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Invité'; ?>" />
<?php

if ($pun_user['is_guest'])
{
    $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['E-mail'].'</strong>' : $lang_common['E-mail'];
    $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';

?>                        <label class="conl"><strong><?php echo $lang_post['Guest name'] ?></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
                        <label class="conl"><?php echo $email_label ?><br /><input type="text" name="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="50" maxlength="50" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
                        <div class="clearer"></div>
<?php

}

if ($fid): 
$d = dir(PUN_ROOT.'img/icons');
        
        while (($entry = $d->read()) !== false)
        {
            if (substr($entry, strlen($entry)-4) == '.gif')
            {    
                $icons_topic[] = substr($entry, 0, strlen($entry)-4);
            }    
        }

        $d->close();
        if (count($icons_topic) > 1)
        {
            while (list(, $temp) = @each($icons_topic))
            {
             echo '<input type="radio" name="icon_topic" value="'.$temp.'" />&nbsp;<img src="./img/icons/'.$icons_topic[$temp-1].'.gif" alt="'.$temp.'" />&nbsp;';
            }
            echo '<input type="radio" name="icon_topic" value="0" checked="checked" />&nbsp;';
        }
?>
                        <label><strong><?php echo $lang_common['Subject'] ?></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<?php endif; ?>

<?php 
if ($fid AND $pun_user['g_id'] == 1): ?>
                        <label><strong><?php echo $lang_common['TopicImage'] ?></strong><br /><input class="longinput" type="text" name="topicimage" value="<?php if (isset($_POST['topicimage'])) echo pun_htmlspecialchars($topicimage); ?>" size="80" /><br /></label>
<?php endif; ?>    



                    <label for="req_message"><strong><?php echo $lang_common['Message'] ?></strong></label>
                        <textarea name="req_message" id="req_message" rows="20" cols="95" tabindex="<?php echo $cur_index++ ?>"><?php echo isset($_POST['req_message']) ? pun_htmlspecialchars($message) : (isset($quote) ? $quote : ''); ?></textarea>
<?php /* punToolBar */
if (file_exists(PUN_ROOT.'cache/cache_puntoolbar.php')) {
    include PUN_ROOT.'cache/cache_puntoolbar.php';
} else {
    require_once PUN_ROOT.'include/cache_puntoolbar.php';
    generate_ptb_cache();
    require PUN_ROOT.'cache/cache_puntoolbar.php';
}
?>    
                        
                        <ul class="bblinks">
                            <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                            <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                            <li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
                        </ul>
                    </div>
                </fieldset>
<?php

$checkboxes = array();
if (!$pun_user['is_guest'])
{
    if ($pun_config['o_smilies'] == '1')
        $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];

    if ($pun_config['o_subscriptions'] == '1')
        $checkboxes[] = '<label><input type="checkbox" name="subscribe" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['subscribe']) ? ' checked="checked"' : '').' />'.$lang_post['Subscribe'];
}
else if ($pun_config['o_smilies'] == '1')
    $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];

if (!empty($checkboxes))
{

?>
            </div>
            <div class="inform">
                <fieldset>
                    <legend><?php echo $lang_common['Options'] ?></legend>
                    <div class="infldset">
                        <div class="rbox">
                            <?php echo implode('<br /></label>'."\n\t\t\t\t", $checkboxes).'<br /></label>'."\n" ?>
                        </div>
                    </div>
                </fieldset>
<?php

}
?>
            </div>
            
            

<?php if ($quotat_config['mod_quotat_enabled'] == '1'): ?>                
<div class="inform">
    <fieldset>
        <legend><?php echo $lang_common['taille_up'] ?></legend>
        <div class="infldset">
            <div class="rbox">
                <label><br /><input class="input"  type="text" name="unreq_taille" value="<?php if (isset($_POST['unreq_taille'])) echo pun_htmlspecialchars($taille); ?>" size="30" maxlength="30" /><br /></label>
            </div>
        </div>
    </fieldset>
</div>            
<?php endif; ?>            
            
            
            
            
            <!-- MOD AJAX post preview -->
<p><input type="submit" name="submit" value="<?php echo $lang_common['Submit'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="s" /><input type="submit" onclick="xajax_getpreview(xajax.getFormValues('post')); document.location.href='#ajaxpostpreview'; return false;" name="preview" value="<?php echo $lang_post['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /><a href="javascript:history.go(-1)"><?php echo $lang_common['Go back'] ?></a></p>
<!--// MOD AJAX post preview -->
        </form>
    </div>
</div>

<?php
}
// Check to see if the topic review is to be displayed.
if ($tid && $pun_config['o_topic_review'] != '0')
{
    require_once PUN_ROOT.'include/parser.php';

    $result = $db->query('SELECT poster, message, hide_smilies, posted FROM '.$db->prefix.'posts WHERE topic_id='.$tid.' ORDER BY id DESC LIMIT '.$pun_config['o_topic_review']) or error('Unable to fetch topic review', __FILE__, __LINE__, $db->error());

?>

<div id="postreview" class="blockpost">
    <h2><span><?php echo $lang_post['Topic review'] ?></span></h2>
<?php

    //Set background switching on
    $bg_switch = true;
    $post_count = 0;

    while ($cur_post = $db->fetch_assoc($result))
    {
        // Switch the background color for every message.
        $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
        $vtbg = ($bg_switch) ? ' roweven' : ' rowodd';
        $post_count++;

        $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);

?>
    <div class="box<?php echo $vtbg ?>">
        <div class="inbox">
            <div class="postleft">
                <dl>
                    <dt><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong></dt>
                    <dd><?php echo format_time($cur_post['posted']) ?></dd>
                </dl>
            </div>
            <div class="postright">
                <div class="postmsg">
                    <?php echo $cur_post['message'] ?>
                </div>
            </div>
            <div class="clearer"></div>
        </div>
    </div>
<?php

    }

?>
</div>
<?php

}

require PUN_ROOT.'footer.php';

pour moi je probleme est ici mais je trouve pas la solution

        // If it's a new topic
        else if ($fid)
        {
          $icon_topic = $_POST['icon_topic'];
          $topicimage = $_POST['topicimage'];
        
            if(isset($ptype)) // Si c'est un sondage
            {
                if ($ptype == 3) 
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question, yes, no, taille_up) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\', \'' . $db->escape($yesval) . '\', \'' . $db->escape($noval) . '\', \''.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
                else
                    $db->query('INSERT INTO ' . $db->prefix . 'topics (poster, subject, posted, last_post, last_poster, forum_id, question, taille_up) VALUES(\'' . $db->escape($username) . '\', \'' . $db->escape($subject) . '\', ' . $now . ', ' . $now . ', \'' . $db->escape($username) . '\', ' . $fid . ', \'' . $db->escape($question) . '\', \''.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

                $new_tid = $db->insert_id();
                if ($ptype != 0) 
                    $db->query('INSERT INTO ' . $db->prefix . 'polls (pollid, options, ptype) VALUES(' . $new_tid . ', \'' . $db->escape(serialize($option)) . '\', ' . $ptype . ')') or error('Unable to create poll', __FILE__, __LINE__, $db->error());
            }
            else
            {
        
        
            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id, topicimage, icon_topic, taille_up) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.', '.$icon_topic.','.$db->escape($topicimage).','.$db->escape($taille_up).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());
            
            $new_tid = $db->insert_id();

            }

merci d'avance car c'est une premod que je partagerai par la suite volontier

Hors ligne

#2 25-04-2011 16:42:55

Mpok
Néo Admin

Re : probleme avec 2 mod en simultané ( topic icon & topic image )

Note @scorpion53000 : oublie tout de suite l'idée d'une prémod pour la 1.2.x
Nous sommes en 1.4.x.
Et les prémod en général sont peu utiles et/ou appréciées.

Hors ligne

#3 25-04-2011 18:55:26

scorpion53000
Membre

Re : probleme avec 2 mod en simultané ( topic icon & topic image )

merci de m'avoir repondu aussi vite ( mais j'utilise des mod qui n'existe plus sur les version 1.3 et 4

( du moin je les ai pas trouvé et puit franchement sa fait 3 semaine que j'y passe pour finir mon site je vais pas tous recommencer  happy ?? )
si quelqun pouvez au moin me donné une petite indication sur l'erreur à corriger happy
je vous dit tous s'affiche bien mais icone et image ne sont pas transmie dans ma base sql

par contre si je le fait manuellement depuit la base tous s'affiche correctement

merci d'avance pour votre aide

Hors ligne

Pied de page des forums