Istruzioni dettagliate ancora da fare
Created
August 9, 2015 13:58
-
-
Save Dyrr/fc7e6df65822ed6fdbac to your computer and use it in GitHub Desktop.
Prigioni utente per gdrcd 5.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//aggiungere al config.inc.php il seguente parametro sostituendo l'id della chat che si vuole usare come chat prigione | |
$PARAMETERS['settings']['chat_prigione'] = 3; ///< ID della chat da usare come prigione. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//aggiungere la funzione in qualsiasi punto si vuole del functions.inc.php, meglio se sotto il controllo esilio per mantenere ordine nel file. | |
/** | |
* @brief Funzione di controllo prigione pg | |
* @details Controlla se lo status del pg è di confinato nelle prigioni della land o meno. | |
* | |
* @param [in] $pg <b>(string)</b> Nome del pg da controllare | |
* | |
* @return [out] <b>(int)</b> 1 se confinato nelle prigioni 0 se libero | |
*/ | |
function gdrcd_controllo_prigioni($pg) | |
{ | |
$query = "SELECT prigioni FROM personaggio WHERE nome='".gdrcd_filter('in', $pg)."' AND prigioni = 1 LIMIT 1"; | |
$result = gdrcd_query($query,'result'); | |
$prigioni = gdrcd_query($result,'num_rows'); | |
return $prigioni; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Fare le seguenti due modifiche al file: | |
//1 - spostare subito sotto il session_start() questo pezzo di codice: | |
//INCLUDO I PARAMETRI, LA CONFIGURAZIONE, LA LINGUA E LE FUNZIONI | |
require 'includes/required.php'; | |
//2 -inserire dentro l'if sottostante la riga indicata: | |
if (isset($_REQUEST['dir']) && is_numeric($_REQUEST['dir'])) | |
{ | |
//riga da aggiungere dentro l'if per fare il redirect alle prigioni | |
$_REQUEST['dir'] = (gdrcd_controllo_prigioni($_SESSION['login']) == 0) ? $_REQUEST['dir'] : $PARAMETERS['settings']['chat_prigione']; | |
$_SESSION['luogo']=$_REQUEST['dir']; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE `personaggio` ADD `prigioni` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Fare le seguenti 2 modifiche al file: | |
//1 - Nell'if a riga 91 dove c'è il commento /** * Da implementare */ inserire: | |
gdrcd_query("UPDATE personaggio SET prigioni = '".gdrcd_filter('num',$_POST['prigioni'])."' WHERE nome = '".gdrcd_filter('in',$_REQUEST['pg'])."' AND permessi <=".$_SESSION['permessi'].""); | |
echo '<div class="warning">'.gdrcd_filter('out',$MESSAGE['warning']['done']).'</div>'; | |
//2 - a riga 304 dopo la fine del form esilio inserire il codice: | |
<!-- Form master prigioni --> | |
<form action="main.php?page=scheda_modifica" method="post"> | |
<input type="hidden" name="op" value="arrest" /> | |
<div class='form_label'> | |
Arresta | |
</div> | |
<div class='form_field'> | |
<?php | |
$pg_prigioni = gdrcd_controllo_prigioni($_REQUEST['pg']); | |
?> | |
<select name="prigioni" class="year"> | |
<option value="0" <?php if ($pg_prigioni == 0){ echo ' selected="selected"';} ?>>Libera</option> | |
<option value="1" <?php if ($pg_prigioni == 1){ echo ' selected="selected"';} ?>>Prigione</option> | |
</select> | |
</div> | |
<div class='form_submit'> | |
<input type="submit" value="<?php echo $MESSAGE['interface']['forms']['submit']; ?>" /> | |
<input type="hidden" | |
value="<?php echo gdrcd_filter('get',$_REQUEST['pg']); ?>" | |
name="pg" /> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment