Les archives de FluxBB.fr
Vous n'êtes pas identifié(e).
Pages : 1
Bonjour,
Dans les deux mods, on modifie post.php au même endroit et je ne parvient pas à mettre ce qu'il faut pour que tout fonctionne correctement. La plupart du temps, c'est le attach mod qui ne fonctionne plus.
Voici que que l'on nous dit de changer pour le cash mod:
#---------[ 13. FIND (line:317) ]---------------------------------------------------
#
// 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']);
#
#---------[ 14. REPLACE WITH ]---------------------------------------------------
#
// 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());
// Update the user's cash..
if ($tid)
{
$db->query('UPDATE '.$low_prio.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpp'].' 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'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpp'].' '.$pun_config['cm_cur_name'].'.');
}
else if($fid)
{
$db->query('UPDATE '.$low_prio.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpt'].' 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'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpt'].' '.$pun_config['cm_cur_name'].'.');
}
}
else
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect']);
#
#Le problème est que attach mod a déjà modifié avant cette partie comme ceci:
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_name'],$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']);Pourriez vous m'aider à résoudre ce petit problème. Merci d'avance!
Vincent.
Hors ligne
En mettant ceci j'ai bien le cash mod qui ajoute des points pour le nouveau post mais la pièce attachée n'est pas incluse:
// 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());
// Update the user's cash..
if ($tid)
{
$db->query('UPDATE '.$low_prio.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpp'].' 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'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpp'].' '.$pun_config['cm_cur_name'].'.');
}
else if($fid)
{
$db->query('UPDATE '.$low_prio.$db->prefix.'users SET cm_cash=cm_cash+'.$cur_posting['cm_cpt'].' 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'].'<br />'.$lang_cash['You_won'].' '.$cur_posting['cm_cpt'].' '.$pun_config['cm_cur_name'].'.');
}
}
else
// 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_name'],$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__);
}
}
}
}
// Attachment Mod Block End
redirect('viewtopic.php?pid='.$new_pid.'#p'.$new_pid, $lang_post['Post redirect']);Pourriez vous me dire ce qui cloche svp?
Hors ligne
Pages : 1