Autor Tópico: Stop Duplicar Poste  (Lida 2973 vezes)

0 Membros e 1 Visitante estão a ver este tópico.

Offline candidosa2

  • Suporte Tecnico
  • Fundador
  • *
  • Mensagens: 5072
  • Rank: 1658
  • Sexo: Masculino
  • Suporte
    • Hosting Moçambique
Stop Duplicar Poste
« em: 02 de Janeiro de 2009, 21:12 »
$sourcedir/Post.php
Pesquisar
Código: [Seleccione]
function Post()
{

Adicionar
Código: [Seleccione]
// Double Post Stopper change - Start
if(bumpAttempt())
fatal_lang_error('double_post_attempt');
// End

Pesquisar
Código: [Seleccione]
function Post2()
{

Adicionar
Código: [Seleccione]
// Double Post Stopper change - Start
if(bumpAttempt())
fatal_lang_error('double_post_attempt');
// End


Pesquisar
Código: [Seleccione]
?>
Adicionar
Código: [Seleccione]
function bumpAttempt() {
// This function here is for the Mod : Double Post Stopper, Made by Dragooon.
// It Checks weather the Poster is trying to bump the topic or not.
global $db_prefix, $ID_MEMBER, $topic, $modSettings;
if(isset($topic)) {
// Do the Query to grab the stuff for checking.
$result = db_query("SELECT
t.ID_TOPIC, t.ID_LAST_MSG, m.ID_MSG, m.ID_MEMBER, m.posterTime
FROM
{$db_prefix}topics AS t, {$db_prefix}messages AS m
WHERE
t.ID_LAST_MSG = m.ID_MSG
AND m.ID_TOPIC = $topic
AND m.ID_MEMBER = $ID_MEMBER
LIMIT 1"
,__FILE__,__LINE__);
$row = mysql_fetch_assoc($result);
// Check it if its a Bump Attempt
// The Poster Time assigned to the variable
$lpt = $row['posterTime'];
$timeTHold = $modSettings['doublePostThold'] * 60 * 60 * 24;
// Declare it false in begginning. If some conditions gets true, It turns into true, else it goes as false.
$bumpAttempt = false;
// Time Not set or it is 0? Declare it as true then
if(empty($modSettings['doublePostThold']))
$bumpAttempt = true;
// Is it set? Do some crazy stuff to check it :p
elseif ($lpt + $timeTHold > time())
$bumpAttempt = true;
 
// And finally go with the returning stuff.
if(mysql_num_rows($result) > 0 && !isset($_REQUEST['msg']) && $bumpAttempt && !allowedTo('doublePost'))
return true;
else
return false;
} else {
return false;
}
mysql_free_result($result);
}


$sourcedir/ManagePermissions.php

Pesquisar
Código: [Seleccione]
'report_any' => false,
Adicionar
Código: [Seleccione]
'doublePost' => false,
$sourcedir/ManagePosts.php
Pesquisar
Código: [Seleccione]
'enableAllMessages' => empty($_POST['enableAllMessages']) ? '0' : (int) $_POST['enableAllMessages'],
'enablePreviousNext' => empty($_POST['enablePreviousNext']) ? '0' : '1',

Adicionar
Código: [Seleccione]
'doublePostThold' => $_POST['doublePostThold'],


$themedir/Admin.template.php

Pesquisar
Código: [Seleccione]
<td valign="top">
<input type="checkbox" name="enablePreviousNext" id="enablePreviousNext_check"', empty($modSettings['enablePreviousNext']) ? '' : ' checked="checked"', ' class="check" />
</td>
</tr>

Adicionar
Código: [Seleccione]
<tr class="windowbg2">
<td colspan="2"><hr /></td>
</tr>
<tr class="windowbg2">
<th width="50%" align="right">
<label for="doublePostThold">', $txt['doublePostAdmin_main'] ,'</label> <span style="font-weight: normal;">(<a href="', $scripturl, '?action=helpadmin;help=doublePostHelp" onclick="return reqWin(this.href);">?</a>)</span>:
<div class="smalltext" style="font-weight: normal;">', $txt['doublePostAdmin_sub'] , '</div>
</th>
<td valign="top">
<input type="text" name="doublePostThold" id="doublePostThold" value="', $modSettings['doublePostThold'] ,'" size="5" /> ', $txt['manageposts_days'], '
</td>
</tr>


$languagedir/Modifications.portuguese_pt.php

Pesqusiar
Código: [Seleccione]
?>
Colocar antes
Código: [Seleccione]
// Double Post stopper strings Portuguese By Candidosa2
$txt['double_post_attempt'] = 'Desculpa, mas você não está autorizado a duplicar os postes. Por favor, volte e edite seu poste anterior.';
$txt['permissionname_doublePost'] = 'Permitir-lhes duplo poste';
$txt['permissionhelp_doublePost'] = 'Activar que permitir-lhes o duplo poste.';
$txt['doublePostAdmin_main'] = 'Tempo antes que o membro não é permitido a duplar poste';
$txt['doublePostHelp'] = 'Tempo (em dias) antes de postar dupla é considerada como uma tentativa. Um membro não é permitido postar um contínuo segundo a resposta no prazo limite.';
$txt['doublePostAdmin_sub'] = 'É definido como em dias. Clique sobre o "?" se você quiser mais informações. Deixe em branco para evitar a duplo poste sempre';

ou pode colocar

$languagedir/Modifications.portuguese_pt-utf8.php
Código: [Seleccione]
// Double Post stopper strings Portuguese By Candidosa2
$txt['double_post_attempt'] = 'Desculpa, mas voc&ecirc; n&atilde;o est&aacute; autorizado a duplicar os postes. Por favor, volte e edite seu poste anterior.';
$txt['permissionname_doublePost'] = 'Permitir-lhes duplo poste';
$txt['permissionhelp_doublePost'] = 'Activar que permitir-lhes o duplo poste.';
$txt['doublePostAdmin_main'] = 'Tempo antes que o membro n&atilde;o &eacute; permitido a duplar poste';
$txt['doublePostHelp'] = 'Tempo (em dias) antes de postar dupla &eacute; considerada como uma tentativa. Um membro n&atilde;o &eacute; permitido postar um cont&iacute;nuo segundo a resposta no prazo limite.';
$txt['doublePostAdmin_sub'] = '&Eacute; definido como em dias. Clique sobre o "?" se voc&ecirc; quiser mais informa&ccedil;&otilde;es. Deixe em branco para evitar a duplo poste sempre';