* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing XNova.
*
*/
define('INSIDE' , true);
define('INSTALL' , false);
require_once dirname(__FILE__) .'/common.php';
includeLang('buddy');
$a = $_GET['a'];
$e = $_GET['e'];
$s = $_GET['s'];
$u = intval( $_GET['u'] );
if ( $s == 1 && isset( $_GET['bid'] ) ) {
// Effacer une entree de la liste d'amis
$bid = intval( $_GET['bid'] );
$buddy = doquery( "SELECT * FROM {{table}} WHERE `id` = '".$bid."';", 'buddy', true );
if ( $buddy['owner'] == $user['id'] ) {
if ( $buddy['active'] == 0 && $a == 1 ) {
doquery( "DELETE FROM {{table}} WHERE `id` = '".$bid."';", 'buddy' );
} elseif ( $buddy['active'] == 1 ) {
doquery( "DELETE FROM {{table}} WHERE `id` = '".$bid."';", 'buddy' );
} elseif ( $buddy['active'] == 0 ) {
doquery( "UPDATE {{table}} SET `active` = '1' WHERE `id` = '".$bid."';", 'buddy' );
}
} elseif ( $buddy['sender'] == $user['id'] ) {
doquery( "DELETE FROM {{table}} WHERE `id` = '".$bid."';", 'buddy' );
}
} elseif ( $_POST["s"] == 3 && $_POST["a"] == 1 && $_POST["e"] == 1 && isset( $_POST["u"] ) ) {
// Traitement de l'enregistrement de la demande d'entree dans la liste d'amis
$uid = $user["id"];
$u = intval( $_POST["u"] );
$buddy = doquery( "SELECT * FROM {{table}} WHERE sender={$uid} AND owner={$u} OR sender={$u} AND owner={$uid}", 'buddy', true );
if ( !$buddy ) {
if ( strlen( $_POST['text'] ) > 5000 ) {
message( "Le texte ne doit pas faire plus de 5000 caractères !", "Erreur" );
}
$text = mysql_escape_string( strip_tags( $_POST['text'] ) );
doquery( "INSERT INTO {{table}} SET sender={$uid}, owner={$u}, active=0, text='{$text}'", 'buddy' );
message( $lang['Request_sent'], $lang['Buddy_request'], 'buddy.php' );
} else {
message( $lang['A_request_exists_already_for_this_user'], $lang['Buddy_request'] );
}
}
$page = "
";
if ( $a == 2 && isset( $u ) ) {
// Saisie texte de demande d'entree dans la liste d'amis
$u = doquery( "SELECT * FROM {{table}} WHERE id='$u'", "users", true );
if ( isset( $u ) && $u["id"] != $user["id"] ) {
$page .= "