コード例 #1
0
ファイル: avatars.php プロジェクト: Arnaud-Burn/phpTournois
function avatar_upload($avatar_mode, &$current_avatar, &$current_type, $avatar_filename, $avatar_realname, $avatar_filesize, $avatar_filetype, &$avatar_error)
{
    global $config, $db;
    global $strAvatarErreurUrl, $strAvatarErreurConnexion, $strAvatarErreurData, $strAvatarErreurWrite, $strAvatarErreurFileSize, $strAvatarErreurXYSize, $strAvatarErreurFileType;
    /*** si c'est un upload remote ***/
    if ($avatar_mode == 'remote' && preg_match('/^(http:\\/\\/)?([\\w\\-\\.]+)\\:?([0-9]*)\\/(.*)$/', $avatar_filename, $url_ary)) {
        if (empty($url_ary[4])) {
            $avatar_error = true;
            show_erreur($strAvatarErreurUrl);
            return;
        }
        $base_get = '/' . $url_ary[4];
        $port = !empty($url_ary[3]) ? $url_ary[3] : 80;
        if (!($fsock = @fsockopen($url_ary[2], $port, $errno, $errstr))) {
            $avatar_error = true;
            show_erreur($strAvatarErreurConnexion);
            return;
        }
        @fputs($fsock, "GET {$base_get} HTTP/1.1\r\n");
        @fputs($fsock, "HOST: " . $url_ary[2] . "\r\n");
        @fputs($fsock, "Connection: close\r\n\r\n");
        unset($avatar_data);
        while (!@feof($fsock)) {
            $avatar_data .= @fread($fsock, $config['avatar_filesize_max']);
        }
        @fclose($fsock);
        if (!preg_match('#Content-Length\\: ([0-9]+)[^ /][\\s]+#i', $avatar_data, $file_data1) || !preg_match('#Content-Type\\: image/[x\\-]*([a-z]+)[\\s]+#i', $avatar_data, $file_data2)) {
            $avatar_error = true;
            show_erreur($strAvatarErreurData);
            return;
        }
        $avatar_filesize = $file_data1[1];
        $avatar_filetype = $file_data2[1];
        if ($avatar_filesize > 0 && $avatar_filesize < $config['avatar_filesize_max']) {
            $avatar_data = substr($avatar_data, strlen($avatar_data) - $avatar_filesize, $avatar_filesize);
            $tmp_path = $config['avatars_path'] . '/tmp';
            $tmp_filename = tempnam($tmp_path, uniqid(rand()) . '-');
            $fptr = @fopen($tmp_filename, 'wb');
            $bytes_written = @fwrite($fptr, $avatar_data, $avatar_filesize);
            @fclose($fptr);
            if ($bytes_written != $avatar_filesize) {
                @unlink($tmp_filename);
                $avatar_error = true;
                show_erreur($strAvatarErreurWrite);
                return;
            }
            list($width, $height) = @getimagesize($tmp_filename);
        } else {
            $avatar_error = true;
            show_erreur("{$strAvatarErreurFileSize} (" . CoolSize($config['avatar_filesize_max']) . ")");
            return;
        }
    } elseif ($avatar_mode == 'local' && file_exists($avatar_filename)) {
        if ($avatar_filesize <= $config['avatar_filesize_max'] && $avatar_filesize > 0) {
            preg_match('#image\\/[x\\-]*([a-z]+)#', $avatar_filetype, $avatar_filetype);
            $avatar_filetype = $avatar_filetype[1];
        } else {
            $avatar_error = true;
            show_erreur("{$strAvatarErreurFileSize} (" . CoolSize($config['avatar_filesize_max']) . ")");
            return;
        }
        list($width, $height) = @getimagesize($avatar_filename);
    }
    if (!($imgtype = check_image_type($avatar_filetype))) {
        $avatar_error = true;
        show_erreur("{$strAvatarErreurFileType} ({$avatar_filetype})");
        return;
    }
    if ($width <= $config['avatar_x_max'] && $height <= $config['avatar_y_max']) {
        $new_filename = uniqid(rand()) . $imgtype;
        /*** si un avatar upload&eacute; existe deja pour l'entit&eacute;, on l'efface ***/
        if ($current_type == 'U' && $current_avatar != '') {
            if (file_exists($config['avatars_path'] . "/{$current_avatar}")) {
                @unlink($config['avatars_path'] . "/{$current_avatar}");
            }
        }
        if ($avatar_mode == 'remote') {
            @copy($tmp_filename, $config['avatars_path'] . "/{$new_filename}");
            @unlink($tmp_filename);
        } elseif ($avatar_mode == 'local') {
            @move_uploaded_file($avatar_filename, $config['avatars_path'] . "/{$new_filename}");
        }
        @chmod($config['avatars_path'] . "/{$new_filename}", 0777);
        $avatar_sql = "avatar = '{$new_filename}', avatar_type = 'U'";
    } else {
        $avatar_error = true;
        show_erreur("{$strAvatarErreurXYSize} (" . $config['avatar_x_max'] . "x" . $config['avatar_y_max'] . ")");
    }
    return $avatar_sql;
}
コード例 #2
0
ファイル: ladder.php プロジェクト: Arnaud-Burn/phpTournois
                     $body = $rapport_end;
                     $mail = new phpTMailer();
                     $mail->From = $from;
                     $mail->FromName = "";
                     $mail->AddAddress($to);
                     $mail->Subject = $subject;
                     $mail->Body = $body;
                     $to = $email2;
                     $mail = new phpTMailer();
                     $mail->From = $from;
                     $mail->FromName = "";
                     $mail->AddAddress($to);
                     $mail->Subject = $subject;
                     $mail->Body = $body;
                     if (!$mail->Send()) {
                         show_erreur("{$strErreurMessageEnvoi}<br><br>{$mail->ErrorInfo}");
                     }
                 }
             }
         }
         /*** redirection ***/
         js_goto("?page=ladder&op=match_lad&lad_id={$lad_id}&m_id={$m_id}");
     }
 } else {
     if ($op == "maps" && is_numeric($lad_id)) {
         if ($grade['a'] != 'a' || $grade['b'] != 'b' || $grade['u'] != 'u') {
             js_goto('?page=login');
         }
         echo '<br>' . $strAdminMaps . '<br>' . $strLADAdminMaps;
         $db->select("{$dbprefix}jeux.id");
         $db->from("{$dbprefix}jeux LEFT JOIN {$dbprefix}ladder_data on ({$dbprefix}ladder_data.jeux = {$dbprefix}jeux.icone)");
コード例 #3
0
ファイル: galerie.php プロジェクト: Arnaud-Burn/phpTournois
function display_gal($galid, $start = 1)
{
    global $s_joueur, $config;
    global $strGalerieInconnue, $strUploaderFichier, $strFichier, $strEnvoyer, $strUploadFichierConsignes, $strRetour, $grade;
    if (!is_gallery($galid)) {
        show_erreur($strGalerieInconnue);
    } else {
        display_gallery_dir($galid);
        display_thumbnails($galid, "", $start);
        if (($grade['a'] == 'a' || $grade['b'] == 'b' || $grade['q'] == 'q') && $galid != "") {
            echo "<form name=input action=\"?page=galerie&op=upload&g={$galid}\" method=post enctype=\"multipart/form-data\">";
            echo "<table border=0 cellpadding=0 cellspacing=0 class=bordure2><tr><td>";
            echo "<table cellspacing=1 cellpadding=0 border=0>";
            echo "<tr><td class=headerfiche>{$strUploaderFichier} {$galid}</td></tr>";
            echo "<tr><td>";
            echo "<table cellspacing=0 cellpadding=3 border=0 width=100%>";
            echo "<tr>";
            echo "<td class=titlefiche>{$strFichier} <font color=red><b>*</b></font> :</td>";
            echo "<td class=textfiche><input type=file name=userfile size=40 maxlength=80></td>";
            echo "</tr>";
            echo "<tr><td class=footerfiche align=center colspan=2><input type=submit value=\"{$strEnvoyer}\"></td></tr>";
            echo "</table>";
            echo "</td></tr></table>";
            echo "</td></tr></table>";
            echo "</form>";
            show_consignes($strUploadFichierConsignes . coolsize($config['gallery_max_filesize']));
        }
        $arraygal = explode("/", $galid);
        $linkgal = "{$arraygal['0']}";
        // to avoid the first "/"
        if ($galid) {
            for ($i = 1; $i < count($arraygal) - 1; $i++) {
                $linkgal .= "/" . $arraygal[$i];
            }
            if (count($arraygal) == 1) {
                $linkgal = "";
            }
            echo "<br><img src=\"images/back.gif\" border=0 align=align=absmiddle> <a href=\"?page=galerie&g={$linkgal}\" class=action>{$strRetour}</a><br>";
        } else {
            echo "<br><img src=\"images/back.gif\" border=0 align=align=absmiddle> <a href=\"javascript:back()\" class=action>{$strRetour}</a><br>";
        }
    }
}
コード例 #4
0
ファイル: 404.php プロジェクト: Arnaud-Burn/phpTournois
   +---------------------------------------------------------------------+
  | phpTournoisG4 ©2005 by Gectou4 <Gectou4 Gectou4@hotmail.com>        |
   +---------------------------------------------------------------------+
         This version is based on phpTournois 3.5 realased by :
   | Copyright(c) 2001-2004 Li0n, RV, Gougou (http://www.phptournois.net)|
   +---------------------------------------------------------------------+
   | This file is part of phpTournois.                                   |
   |                                                                     |
   | phpTournois 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 2 of the License, or   |
   | (at your option) any later version.                                 |
   |                                                                     |
   | phpTournois 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 AdminBot; if not, write to the Free Software Foundation, |
   | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA       |
   |                                                                     |
   +---------------------------------------------------------------------+
   | Authors: Li0n  <*****@*****.**>                               |
   |          RV <*****@*****.**>                                    |
   |          Gougou                                                     |
   +---------------------------------------------------------------------+
*/
echo "<h1>{$strErreur404}</h1>";
show_erreur($strErreur404Explain);
コード例 #5
0
ファイル: update.php プロジェクト: Arnaud-Burn/phpTournois
 $db->update("{$dbprefix}joueurs");
 $db->set("grade='nz'");
 $db->where("newseur = 'O'");
 $db->exec();
 /* update des admins */
 $db->update("{$dbprefix}joueurs");
 $db->set("grade='abcdefghijklmnopqrstuvwxyz'");
 $db->where("admin = 'O'");
 $db->exec();
 /* update du fichier de conf */
 if (!($fd = @fopen($filename, "a+"))) {
     $erreur = 1;
     show_erreur("{$strOuvertureInvalideConfigFile} : {$filename}");
 } elseif (!fputs($fd, "<?php define('PHPTOURNOIS_INSTALLED',true);?>")) {
     $erreur = 1;
     show_erreur("{$strEcritureInvalideConfigFile} : {$filename}");
 } else {
     fclose($fd);
 }
 echo "<h3>{$strInstallStage3}</h3>";
 echo "{$strInstallStage3Consignes}<br>";
 echo "Support ? : http://forum.phptournois.net/ !<br>";
 echo "Don't forgot to go on your configuration pag for define new configuration tool !<br>";
 echo "N'oubliez pas d'aller sur votre page configuration pour définir les nouvelles options de configurations !<br>";
 /** tentative d'effacage **/
 @unlink('install.php');
 if (is_file('install.php')) {
     show_warning("{$strInstallStage3DelInstall}<br>");
 }
 @unlink('update.php');
 if (is_file('update.php')) {
コード例 #6
0
ファイル: news.php プロジェクト: Arnaud-Burn/phpTournois
            $body = $strNewsEnvoiMessage;
            $body = str_replace($array1, $array2, $body);
            $mail = new phpTMailer();
            $mail->From = $from;
            $mail->FromName = "";
            $mail->AddAddress($to);
            $mail->Subject = $subject;
            $mail->Body = $body;
            if (!$mail->Send()) {
                show_erreur("{$strErreurMessageEnvoi}<br><br>{$mail->ErrorInfo}");
            } else {
                show_notice(str_replace($array1, $array2, $strNewsEnvoiConfirm));
                echo "<br><form method=post action='?page=news'><input type=submit class=action value=\"{$strOK}\"></form>";
            }
        } else {
            show_erreur($strPasDeFonctionMail);
        }
    }
} else {
    if ($ad == 'wr') {
        /*** Ajout de news ***/
        if ($grade['a'] == 'a' || $grade['b'] == 'b' || $grade['n'] == 'n') {
            echo "<form method=post name=\"formulaire\" action=?page=news&op=add_news>";
            echo "<table border=0 cellpadding=0 cellspacing=0 class=bordure2><tr><td>";
            echo "<table cellspacing=1 cellpadding=0 border=0>";
            echo "<tr><td class=headerfiche>{$strAjouterNews}</td></tr>";
            echo "<tr><td>";
            echo "<table cellspacing=0 cellpadding=3 border=0 width=100%>";
            echo "<tr>";
            echo "<td class=titlefiche>{$strIcone} :</td>";
            echo "<td class=textfiche style=\"white-space:normal\">";
コード例 #7
0
ファイル: finales.php プロジェクト: Arnaud-Burn/phpTournois
 //verif_admin_tournois($s_joueur,$s_tournois);
 verif_admin_tournois($s_joueur, $s_tournois, $grade['a'], $grade['b'], $grade['t']);
 $finale = $nb_finales_winner_tournois;
 $str = '';
 $erreur = 0;
 if (!$finale) {
     $erreur = 1;
     $str .= "- " . $strElementsFinalesInvalides . "<br>";
 }
 if ($modeelimination_tournois == 'D' && !$nb_finales_looser_tournois) {
     $erreur = 1;
     $str .= "- " . $strElementsFinalesLooserInvalides;
 }
 if ($erreur == 1) {
     $str .= "<br><form method=post action='?page=tournois&op=modify&id={$s_tournois}'><input type=submit class=action value=\"{$strModifier}\"></form>";
     show_erreur($str);
 } else {
     echo "<p class=title>.:: {$strAdminFinales} ::.</p>";
     echo "<table cellspacing=2 cellpadding=2 border=0 class=liste>";
     if ($type_tournois == 'T') {
         echo "<tr align=center><td class=title colspan=3>{$strAssignerPoules} :</td></tr>";
         echo "<tr align=center>";
         echo "<td><form method=post action='?page=finales&op=poules&type=seed'><input type=submit class=action value=\"{$strMethodeSeed}\"></td></form>";
         echo "<td><form method=post action='?page=finales&op=poules&type=croise'><input type=submit class=action value=\"{$strMethodeCroise}\"></td></form>";
         echo "<td><form method=post action='?page=finales&op=poules&type=random'><input type=submit class=action value=\"{$strMethodeRandom}\"></td></form>";
         echo "</tr>";
     } elseif ($type_tournois == 'E') {
         echo "<tr align=center>";
         echo "<td><form method=post action='?page=finales&op=random'><input type=submit class=action value=\"{$strAssignerAleatoirement}\"'></td></form>";
         echo "<td><form method=post action='?page=finales&op=seed'><input type=submit class=action value=\"{$strAssignerInscriptionSeed}\"></td></form>";
         echo "</tr>";
コード例 #8
0
ファイル: contact.php プロジェクト: Arnaud-Burn/phpTournois
                }
                show_erreur($strPMED);
            } else {
                if ($mail_id1 != null and $mail_id2 != null) {
                    $db->select("DISTINCT id");
                    $db->from("{$dbprefix}joueurs");
                    $db->where("email = '{$mail_id1}' or email = '{$mail_id2}' ");
                    $res = $db->exec();
                    while ($destinatire = $db->fetch($res)) {
                        $db->insert("{$dbprefix}messages (emetteur,destinataire,titre,message,date)");
                        $db->values("'-2','{$destinatire->id}','Contact : {$titre}','{$message}','{$date}'");
                        $db->exec();
                    }
                    show_erreur($strPMED);
                } else {
                    show_erreur($strPMED_no);
                }
            }
        }
    }
} else {
    echo "<p class=title>.:: {$strContact} ::.</p>";
    $array1 = array("%email%");
    $array2 = array($config['emailcontact']);
    $strContactUp = str_replace($array1, $array2, $strContactUp);
    echo "<table cellspacing=0 cellpadding=0 border=0 width=500 align=center>";
    echo "<tr><td class=title><div align=center>{$strContactUp}</div></td></tr>";
    echo "</table><br>";
    echo "<form method=post name=\"formulaire\" action=?page=contact&op=envoi>";
    echo "<table border=0 cellpadding=0 cellspacing=0 class=bordure2><tr><td>";
    echo "<table cellspacing=1 cellpadding=0 border=0>";
コード例 #9
0
ファイル: livredor.php プロジェクト: Arnaud-Burn/phpTournois
if ($op == "add") {
    $str = '';
    $erreur = 0;
    if (!$auteur) {
        $erreur = 1;
        $str .= "- {$strElementsAuteurInvalide}<br>";
    }
    if (!$contenu) {
        $erreur = 1;
        $str .= "- {$strElementsContenuInvalide}<br>";
    }
    if ($erreur == 1) {
        show_erreur_saisie($str);
    } else {
        if (is_flood('livredor')) {
            show_erreur($strFloodDetect);
        } else {
            $date = time();
            $auteur = remove_XSS($auteur);
            $contenu = remove_XSS($contenu);
            $db->insert("{$dbprefix}livredor (auteur,contenu,date)");
            $db->values("'{$auteur}','{$contenu}','{$date}'");
            $db->exec();
            /*** redirection ***/
            js_goto("?page=livredor&id={$id}");
        }
    }
} elseif ($op == "delete") {
    /*** verification securite ***/
    if ($op == 'admin') {
        if ($grade['a'] != 'a' && $grade['b'] != 'b' && $grade['i'] != 'i') {
コード例 #10
0
function load_data_lang_plus($nom, $chemin)
{
    global $datas_lang;
    global $thisSite;
    $datas = pre_load_data_lang_plus($chemin);
    if (!is_array($datas)) {
        return false;
    }
    foreach ($datas as $code => $valeur) {
        if ($thisSite->SERVER == "local") {
            if (isset($datas_lang[$code])) {
                // on vérfie si l'élément n'existe pas déjà
                show_erreur("load_data_lang_plus", "element LANG existe déjà : " . $nom . " > " . $code);
            }
        }
        $datas_lang[$code] = $valeur;
    }
}