Alors que les eleveurs et agriculteurs polluent toujours la Bretagne,
Post by docanskiBonjour
http://mycorance.free.fr/forum/viewtopic.php?pid=10#p10
...
Post by docanskiProblème de script, de serveur ou de navigateur ?
Après avoir vidé le cache, il semble bien que le problème vient du
script de post ou de celui de l'affichage de celui-ci.
Mais voilà ... je n'y entrave que dalle et le forum d'aide PunBB est
d'un silence assourdissant à ce sujet, après mon appel à l'aide sur
celui-ci :-(
Je fais donc appel aux cracks du coin ; ce serait sympa s'ils pouvaient
jeter un coup d'oeil sur les parties de ces scripts qui pourraient être
en cause. Les voici :
Partie du script "post.php" destiné à l'envoi du fichier attach :
-----------------------------------------------------------------------------
// 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());
}
// Attachment Mod Block Start
if
(isset($_FILES['attached_file'])&&$_FILES['attached_file']['size']!=0&&is_uploaded_file($_FILES['attached_file']['tmp_name'])){
//fetch the rules for this forum for this group
$attach_result = $db->query('SELECT rules,size,file_ext FROM
'.$db->prefix.'attach_2_rules WHERE
group_id=\''.$pun_user['g_id'].'\' AND
forum_id=\''.$cur_posting['id'].'\' LIMIT 1')or error('Unable to fetch
attachment rules',__FILE__,__LINE__,$db->error());
if($db->num_rows($attach_result)!=0||$pun_user['g_id']==PUN_ADMIN){
$attach_rules=0; $attach_size=0; $attach_file_ext=''; // just some
defaults to get the parser to stop nagging me if
it's an admin :D
if($db->num_rows($attach_result)!=0)
list($attach_rules,$attach_size,$attach_file_ext)=$db->fetch_row($attach_result);
//check so that the user is allowed to upload
if(attach_allow_upload($attach_rules,$attach_size,$attach_file_ext,$_FILES['attached_file']['size'],$_FILES['attached_file']['name'])){
// ok we're allowed to post ... time to fix everything...
if(!attach_create_attachment($_FILES['attached_file']['name'],$_FILES['attached_file']['type'],$_FILES['attached_file']['size'],$_FILES['attached_file']['tmp_na
me'],$new_pid,count_chars($message))){
error('Error creating attachment, inform the owner of this
bulletin board of this problem. (Most
likely something to do with rights on the filesystem)',__FILE__,__LINE__);
}
}else{
// no output ... but if you want, enable this error (you really
shouldn't need to as this will only happen if
someone try to go around the restrictions
// error($lang_attach['Not allowed to post attachments']);
}
}else{
// no output ... but if you want, enable this error (you really
shouldn't need to as this will only happen if someone try
to go around the restrictions
// error($lang_attach['Not allowed to post attachments']);
}
}
// Attachment Mod Block End
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post
redirect']);
}
}
Partie du script "viewtopic.php" destiné à l'affichage du message :
-----------------------------------------------------------------------------------
// Attachment Mod Block Start
$attach_allow_download = false;
$attach_output = '';
$attach_num = 0;
// Check if this post has any attachments
$result_attach = $db->query('SELECT af.id, af.filename, af.size,
af.downloads FROM '.$db->prefix.'attach_2_files AS af WHERE
af.post_id='.$cur_post['id']) or error('Unable to fetch if there were
any attachments to the post', __FILE__, __LINE__, $db->error());
$attach_num = $db->num_rows($result_attach);
if($attach_num > 0){
if($pun_user['g_id']==PUN_ADMIN)$attach_allow_download=true;
else{ //fetch the rules of the forum, and check so that the user is
allowed to download.
$result_attach_two = $db->query('SELECT ar.rules FROM
'.$db->prefix.'attach_2_rules AS ar WHERE
ar.group_id=\''.$pun_user['group_id'].'\' AND
ar.forum_id='.$cur_topic['forum_id'].' LIMIT 1')or error('Unable to
fetch rules for the attachments', __FILE__,
__LINE__, $db->error());
if($db->num_rows($result_attach_two)==1){
list($attach_rules)=$db->fetch_row($result_attach_two);
$attach_allow_download = attach_rules($attach_rules,ATTACH_DOWNLOAD);
}
}
if($attach_allow_download){//check if the user is allowed to download it.
$attach_output .= $lang_attach['Attachments:'].' ';
while(list($attachment_id, $attachment_filename, $attachment_size,
$attachment_downloads)=$db->fetch_row($result_attach)){
$attachment_extension=attach_get_extension($attachment_filename);
$attach_output .= '<br
/>'."\n\t\t\t\t\t\t".attach_icon($attachment_extension).' <a
href="./attachment.php?item='.$attachment_id.'">'.$attachment_filename.'</a>,
'.$lang_attach['Size:'].' '.number_format($attachment_size).'
'.$lang_attach['bytes'].', '.$lang_attach['Downloads:'].'
'.number_format($attachment_downloads);
}
}
}
// Attachment Mod Block End
?>
<div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo
$vtbg ?><?php if (($post_count + $start_from) == 1) echo ' firstpost'; ?>">
<h2><span><span class="conr">#<?php echo ($start_from + $post_count)
?> </span><a href="viewtopic.php?pid=<?php echo
$cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo
format_time($cur_post['posted']) ?></a></span></h2>
<div class="box">
<div class="inbox">
<div class="postleft">
<dl>
<dt><strong><?php echo $username ?></strong></dt>
<dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>
<dd class="postavatar"><?php echo $user_avatar ?></dd>
<?php if (count($user_info)) echo
"\t\t\t\t\t".implode('</dd>'."\n\t\t\t\t\t", $user_info).'</dd>'."\n"; ?>
<?php if (count($user_contacts)) echo "\t\t\t\t\t".'<dd
class="usercontacts">'.implode(' ',
$user_contacts).'</dd>'."\n"; ?>
</dl>
</div>
<div class="postright">
<h3><?php if (($post_count + $start_from) > 1) echo ' Re: '; ?><?php
echo
pun_htmlspecialchars($cur_topic['subject']) ?></h3>
<div class="postmsg">
<?php echo $cur_post['message']."\n" ?>
<?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t".'<p
class="postedit"><em>'.$lang_topic['Last edit'].'
'.pun_htmlspecialchars($cur_post['edited_by']).'
('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
<?php if ($attach_allow_download) echo "\t\t\t\t\t".'<div
class="postsignature"><hr />'.$attach_output.'</div>'."\n"; ##
Attachment Mod row ?>
</div>
<?php if ($signature != '') echo "\t\t\t\t".'<div
class="postsignature"><hr />'.$signature.'</div>'."\n"; ?>
</div>
<div class="clearer"></div>
<div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo
'<p>'.$is_online.'</p>'; ?></div>
<div class="postfootright"><?php echo (count($post_actions)) ?
'<ul>'.implode($lang_topic['Link separator'].'</li>',
$post_actions).'</li></ul></div>'."\n" : '<div> </div></div>'."\n" ?>
</div>
</div>
</div>
<?php
}
?>
<div class="postlinksb">
<div class="inbox">
<p class="postlink conr"><?php echo $post_link ?></p>
<p class="pagelink conl"><?php echo $paging_links ?></p>
<ul><li><a href="index.php"><?php echo $lang_common['Index']
?></a></li><li> » <a
href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo
pun_htmlspecialchars($cur_topic['forum_name'])
?></a></li><li> » <?php echo
pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
<?php echo $subscraction ?>
</div>
</div>
Merci d'avance pour toute aide apportée à la correction de ce(s) script(s)!
Cordialement,
--
docanski
Portail et annuaire du nord-Bretagne : http://armorance.free.fr/
Guide des champignons d'Europe : http://mycorance.free.fr/
La vallée de la Rance maritime : http://valderance.free.fr/
Les côtes du nord de la Bretagne : http://docarmor.free.fr/