par
bob56@ » 09 déc. 2012, 16:22
Bonjour benv8nam ,
voilà la page php ou est la partie du script :
j'ai mis la partie du code RANGS dans mon serveur Easy PHP pour voir le Code interprété par le serveur et envoyée au navigateur, car je cherche dans toutes les directions ?
<?php
/*-----------------------------------------------------------------+
| +----------------- FOG Forum - PHP Board Engine ---------------+ |
| |------------- Copyleft 2004 Gilles "TitD" Daviet -----------| |
| |------------ Downloaded on http://fog-forum.sf.net -----------| |
| +--------------------------------------------------------------+ |
| |- php/admin/aff.php
| |- Configuration de l'affichage du forum
| +--------------------------------------------------------------
+----------------------------------------------------------------
| 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 2
| 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, write to the Free Software
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--------------------------------------------------------------------------*/
if(!defined('FOG_INCLUDED'))die('Hello world');
if($fog_smarty->AdminRequis(5)){
$fog_q = isset($_GET['fog_q'])?$_GET['fog_q']:0;
$fog_action = isset($_GET['fog_action'])?$_GET['fog_action']:0;
///////////////////
/////GENERAL
///////////////////
if(!$fog_q){
if(isset($_POST['fog_posted'])){
$fog_config['skin'] = $_POST['fog_skin'];
$fog_config['lang'] = $_POST['fog_lang'];
$fog_config['fuseau'] = $_POST['fog_fuseau'];
$fog_config['dateformat'] = htmlentities($_POST['fog_dateformat']);
$fog_config['heureformat'] = htmlentities($_POST['fog_heureformat']);
if(!preg_match('`[^0-9]`',$_POST['fog_nbrep']))
$fog_config['maxs4aff'][0] = $_POST['fog_nbrep'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbtopics']))
$fog_config['maxs4aff'][1] = $_POST['fog_nbtopics'];
if(!preg_match('`[^0-9]`',$_POST['fog_depuis']))
$fog_config['maxs4aff'][2] = $_POST['fog_depuis'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbpop']))
$fog_config['maxs4aff'][3] = $_POST['fog_nbpop'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbrepmess']))
$fog_config['maxs4aff'][4] = $_POST['fog_nbrepmess'];
$fog_config['maxs4aff'][5] = isset($_POST['fog_hideforums'])?1:0;
$fog_config['fenetres'][0] = isset($_POST['fog_fenetres0'])?1:0;
$fog_config['fenetres'][1] = isset($_POST['fog_fenetres1'])?1:0;
$fog_config['fenetres'][2] = isset($_POST['fog_fenetres2'])?1:0;
$fog_config['fenetres'][3] = isset($_POST['fog_fenetres3'])?1:0;
$fog_maxs4aff = implode('|',$fog_config['maxs4aff']);
$fog_fenetres = implode('|',$fog_config['fenetres']);
$fog_db->query('UPDATE '.FOG_TABLES_PREF."config SET skin='".$fog_config['skin']."',lang='".$fog_config['lang']."',fuseau='".$fog_config['fuseau']."',heureformat='".$fog_config['heureformat']."',dateformat='".$fog_config['dateformat']."',maxs4aff='$fog_maxs4aff',fenetres='$fog_fenetres'");
$fog_config['dateformat'] = stripslashes($fog_config['dateformat']);
$fog_config['heureformat'] = stripslashes($fog_config['heureformat']);
}
for($fog_i=0,$fog_j=-12;$fog_i<25;$fog_i++,$fog_j++){
$fog_fuseaux['value'][$fog_i] = $fog_i-12;
$fog_fuseaux['txt'][$fog_i] = "GMT".(($fog_j<0)?"$fog_j":(($fog_j)?"+$fog_j":""))." (".gmstrftime($fog_config['heureformat'],$fog_time+3600*$fog_j).")";
}
$fog_smarty->assign('fuseaux',$fog_fuseaux);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."skins/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_dir($fog_dirpath.$fog_file) && FOGIsSkinValid($fog_file))
$fog_array[$fog_i++] = $fog_file;
closedir($fog_dir);
}
$fog_smarty->assign('skins',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."lang/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_dir($fog_dirpath.$fog_file) && FOGIsLangValid($fog_file))
$fog_array[$fog_i++] = $fog_file;
closedir($fog_dir);
}
$fog_smarty->assign('langs',$fog_array);
unset($fog_fuseaux,$fog_array,$fog_result,$fog_i);
}
///////////////////
//// TEXTES MAILS
///////////////////
elseif($fog_q == 1){
$fog_config['mailstexts'] = explode('|FOGSPLIT|',htmlentities(stripslashes($fog_config['mailstexts'])));
$fog_action = $_POST['fog_switch'];
if($fog_action == 1){
$fog_config['rangs'][0] = htmlentities(trim($_POST['fog_lvl0']));
$fog_config['rangs'][1] = htmlentities(trim($_POST['fog_lvl1']));
$fog_config['rangs'][2] = htmlentities(trim($_POST['fog_lvl2']));
$fog_config['rangs'][3] = htmlentities(trim($_POST['fog_lvl3']));
$fog_config['rangs'][4] = htmlentities(trim($_POST['fog_lvl4']));
if($fog_user->row['rang'] > 4){
$fog_config['rangs'][5] = htmlentities(trim($_POST['fog_lvl5']));
$fog_config['rangs'][6] = htmlentities(trim($_POST['fog_lvl6']));
}
$fog_rangs = implode('|',$fog_config['rangs']);
$fog_db->query("UPDATE ".FOG_TABLES_PREF."config SET rangs='$fog_rangs'");
for($fog_i=0;$fog_i<count($fog_config['rangs']);$fog_i++)
$fog_config['rangs'][$fog_i] = stripslashes($fog_config['rangs'][$fog_i]);
}elseif($fog_action == 2){
$fog_config['mailstexts'][0] = trim($_POST['fog_mail0']);
$fog_config['mailstexts'][1] = trim($_POST['fog_mail1']);
$fog_mailstexts = implode('|FOGSPLIT|',$fog_config['mailstexts']);
$fog_config['mailstexts'] = explode('|FOGSPLIT|',htmlentities($fog_mailstexts));
$fog_db->query("UPDATE ".FOG_TABLES_PREF."config SET mailstexts='$fog_mailstexts'");
for($fog_i=0;$fog_i<count($fog_config['mailstexts']);$fog_i++)
$fog_config['mailstexts'][$fog_i] = stripslashes($fog_config['mailstexts'][$fog_i]);
}
}
////////////////
// SMILIES
///////////////
elseif($fog_q == 2){
if($fog_action == 1){
$fog_smiley = FOGGetElt($_GET['fog_smiley'],'smileys','issmiley,isicon,code,id');
if(!empty($fog_smiley) && isset($_POST['fog_posted'])){
$fog_smiley['issmiley'] = isset($_POST['fog_issmiley'])?1:0;
$fog_smiley['isicon'] = isset($_POST['fog_isicon'])?1:0;
$fog_smiley['code'] = htmlentities($_POST['fog_code']);
if($fog_smiley['code'] != "" || !($fog_smiley['isicon'] || $fog_smiley['issmiley']))
$fog_db->query("UPDATE ".FOG_TABLES_PREF."smileys set issmiley='".$fog_smiley['issmiley']."',isicon='".$fog_smiley['isicon']."',code='".$fog_smiley['code']."' where id='".$fog_smiley['id']."'");
}
$fog_smiley['code'] = stripslashes($fog_smiley['code']);
$fog_smarty->assign('smiley',$fog_smiley);
}elseif($fog_action == 2 || $fog_action == 3){
$fog_smiley = FOGGetElt($_GET['fog_smiley'],'smileys','ordre');
if(!empty($fog_smiley)){
$fog_qsigne = ($fog_action == 3)?'>':'<';
$fog_qsens = ($fog_action == 3)?'asc':'desc';
$fog_smileybis = $fog_db->fetch_row($fog_db->query("SELECT ordre,id from ".FOG_TABLES_PREF."smileys where ordre $fog_qsigne '".$fog_smiley['ordre']."' order by ordre $fog_qsens limit 1"));
if(!empty($fog_smileybis)){
$fog_db->query('UPDATE '.FOG_TABLES_PREF."smileys set ordre='".$fog_smileybis[0]."' where id='".$_GET['fog_smiley']."'");
$fog_db->query('UPDATE '.FOG_TABLES_PREF."smileys set ordre='".$fog_smiley['ordre']."' where id='".$fog_smileybis[1]."'");
}
unset($fog_smiley,$fog_smileybis,$fog_qsigne,$fog_qsens);
}
}
$fog_icons = FOGChopeSmileys('isicon');
$fog_tablesmileys = FOGTableKeysToVals(FOGChopeSmileys('issmiley'));
$fog_action = isset($_POST['fog_switch'])?$_POST['fog_switch']:0;
if($fog_action == 1 && !empty($_POST['fog_dispo'])){
$fog_row = $fog_db->fetch_assoc($fog_db->query("SELECT ordre from ".FOG_TABLES_PREF."smileys order by ordre desc limit 1"));
$fog_db->query("INSERT into ".FOG_TABLES_PREF."smileys (id,ordre) VALUES('".$_POST['fog_dispo']."','".($fog_row['ordre']+1)."')");
}elseif($fog_action == 2){
$fog_query = "('".(is_array($_POST['fog_selectedsmileys'])?implode("','",$_POST['fog_selectedsmileys']):$_POST['fog_selectedsmileys'])."')";
$fog_db->query("DELETE from ".FOG_TABLES_PREF."smileys where id IN $fog_query");
}
$fog_existent = array();
$fog_array = array();
$fog_i = 0;
$fog_db->query("SELECT issmiley,isicon,code,id,ordre from ".FOG_TABLES_PREF."smileys order by ordre");
while($fog_row = $fog_db->fetch_assoc()){
$fog_array[$fog_i++] = $fog_row;
$fog_existent[$fog_row['id']] = 1;
}
$fog_smarty->assign('smileys',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."img/smileys/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_file($fog_dirpath.$fog_file) && !isset($fog_existent[$fog_file])){
$fog_file_info = getimagesize($fog_dirpath.$fog_file);
if ((strPos($fog_file,".jpg") && $fog_file_info[2] == 2)||(strPos($fog_file, ".gif") && $fog_file_info[2] == 1)||(strPos($fog_file, ".png") && $fog_file_info[2] == 3))
$fog_array[$fog_i++] = $fog_file;
}
closedir($fog_dir);
}
$fog_smarty->assign('dispos',$fog_array);
unset($fog_array,$fog_existent,$fog_row,$fog_i);
}
///////////////////////
//// CENSURE
///////////////////////
elseif($fog_q == 3){
if($fog_action == 1){
$fog_avant = trim($_POST['fog_avant']);
$fog_apres = trim($_POST['fog_apres']);
$fog_regexp = isset($_POST['fog_regexp'])?1:0;
if($fog_avant != "")
$fog_db->query("INSERT into ".FOG_TABLES_PREF."censor (avant,apres,reg_exp) VALUES('$fog_avant','$fog_apres','$fog_regexp')") or die(mysql_error());
}elseif($fog_action == 2){
$fog_avant = $_GET['fog_avant'];
if(isset($_POST['fog_posted'])){
$fog_avans = $fog_avant;
$fog_avant = trim($_POST['fog_avant']);
$fog_apres = trim($_POST['fog_apres']);
$fog_regexp = isset($_POST['fog_regexp'])?1:0;
if($fog_avant != "")
$fog_db->query("UPDATE ".FOG_TABLES_PREF."censor SET avant='$fog_avant',apres='$fog_apres',reg_exp='$fog_regexp' where avant='$fog_avans'");
}
$fog_word = $fog_db->fetch_assoc($fog_db->query("SELECT avant,apres,reg_exp from ".FOG_TABLES_PREF."censor where avant='$fog_avant' limit 1 "));
$fog_smarty->assign('word',$fog_word);
}elseif($_POST['fog_selectedwords']){
$fog_query = "('".implode("','",(array) $_POST['fog_selectedwords'])."')";
$fog_db->query("DELETE from ".FOG_TABLES_PREF."censor where avant IN $fog_query");
}
$fog_array = array();
$fog_db->query("SELECT avant,apres from ".FOG_TABLES_PREF."censor");
while($fog_row = $fog_db->fetch_assoc())
$fog_array[] = $fog_row;
$fog_smarty->assign('words',$fog_array);
unset($fog_array,$fog_row,$fog_i);
}
//////////////////
///// RANGS
//////////////////
elseif($fog_q == 4){
$fog_array_users = array();
$fog_i = 0;
$fog_result = $fog_db->query('SELECT pseudo,id from '.FOG_TABLES_PREF.'users where rang<'.$fog_user->row['rang'].(($fog_user->row['rang'] == 6)?(' or id='.$fog_user->row['id']):''));
while($fog_row = $fog_db->fetch_row($fog_result)){
$fog_array_users['pseudo'][$fog_row[1]] = $fog_row[0];
$fog_array_users['id'][$fog_row[1]] = $fog_row[1];
}
$fog_smarty->assign('users',$fog_array_users);
if($fog_action == 1){
$fog_mod = $_POST['fog_mod']?1:0;
$fog_nb = $fog_mod?$_POST['fog_uid']:intval(trim($_POST['fog_nb']));
$fog_txt = htmlentities(trim($_POST['fog_txt']));
$fog_img = $_POST['fog_img'];
if(!$fog_mod || in_array($fog_nb,$fog_array_users['id']))
$fog_db->query('INSERT into '.FOG_TABLES_PREF.'ranks (nb,txt,img,mod) VALUES('.$fog_nb.',\''.$fog_txt.'\',\''.$fog_img.'\',\''.$fog_mod.'\')');
}elseif($fog_action == 2){
$fog_rankid = $_GET['fog_rankid'];
if(isset($_POST['fog_posted'])){
$fog_rank = $fog_db->fetch_assoc($fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks where id='.$fog_rankid.' limit 1 '));
$fog_mod = $_POST['fog_mod']?1:0;
$fog_nb = $fog_mod?$_POST['fog_uid']:intval(trim($_POST['fog_nb']));
$fog_txt = htmlentities(trim($_POST['fog_txt']));
$fog_img = $_POST['fog_img'];
if((!$fog_rank['mod'] || in_array($fog_rank['nb'],$fog_array_users['id'])) && (!$fog_mod || in_array($fog_nb,$fog_array_users['id'])))
$fog_db->query('UPDATE '.FOG_TABLES_PREF.'ranks SET nb='.$fog_nb.',txt=\''.$fog_txt.'\',img=\''.$fog_img.'\',mod=\''.$fog_mod.'\' where id='.$fog_rankid);
}
$fog_rank = $fog_db->fetch_assoc($fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks where id='.$fog_rankid.' limit 1 '));
$fog_smarty->assign('rank',$fog_rank);
}elseif($_POST['fog_selectedranks']){
$fog_query = '('.implode(',',(array) $_POST['fog_selectedranks']).')';
$fog_db->query('DELETE from '.FOG_TABLES_PREF.'ranks where id IN '.$fog_query);
}
$fog_i = 0;
$fog_array = array();
$result = $fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks order by nb');
while($fog_row = $fog_db->fetch_assoc($result)){
if(!$fog_row['mod'])
$fog_array['nb'][$fog_i++] = $fog_row;
elseif($fog_row['mod'] == 1){
$fog_array['user'][$fog_i] = $fog_row;
$fog_array['user'][$fog_i++]['user'] = $fog_ub->Get($fog_row['nb'],'pseudo');
}
}
$fog_smarty->assign('ranks',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR.'img/ranks/';
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_file($fog_dirpath.$fog_file)){
$fog_file_info = getimagesize($fog_dirpath.$fog_file);
if ((strPos($fog_file,'.jpg') && $fog_file_info[2] === 2)||(strPos($fog_file, '.gif') && $fog_file_info[2] === 1)||(strPos($fog_file, '.png') && $fog_file_info[2] === 3))
$fog_array[$fog_i++] = $fog_file;
}
closedir($fog_dir);
}
$fog_smarty->assign('dispos',$fog_array);
unset($$fog_array,$fog_existent,$fog_row,$fog_i);
}
////////////////////////
///// SKINS
////////////////////////
elseif($fog_q == 5){
$fog_array = array_keys($fog_custom);
switch($fog_action){
case 1:
$fog_config['_custom'] = array();
$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='' where id='0'");
break;
case 3:
$fog_smarty->display = false;
header('Content-disposition: filename=fog_skin_template.fst');
header('Content-type: text/fog-forum-skin-template');
header('Pragma: no-cache');
header('Expires: 0');
echo 'Content-type=text/fog-forum-skin-template&';
echo 'Content-version='.urlencode(FOG_MAJOUR_VERSION).'&';
foreach($fog_config['_custom'] as $fog_key=>$fog_val)
echo $fog_key.'='.urlencode($fog_val).'&';
break;
case 4:
$fog_fsp = $_FILES['fog_imported_fsp']['tmp_name'];
if(!empty($fog_fsp)){
$fog_fsp_name = FOGUniqueID($_FILES['fog_imported_fsp']['name']);
$fog_fsp_dest = FOG_DIR.'tmp/'.$fog_fsp_name;
move_uploaded_file($fog_fsp,$fog_fsp_dest);
$fog_file = fopen($fog_fsp_dest,'r');
$fog_fcontent = trim(fgets($fog_file,filesize($fog_fsp_dest)));
$fog_props = array();
parse_str($fog_fcontent,$fog_props);
fclose($fog_file);
unlink($fog_fsp_dest);
if($fog_props['Content-type'] == 'text/fog-forum-skin-template'){
$fog_config['_custom'] = array();
while(list($fog_key,$fog_val) = each($fog_props)){
if(!in_array($fog_key,$fog_array)) continue;
$fog_config['_custom'][$fog_key] = $fog_val;
$fog_query[] = $fog_key.'='.urlencode($fog_val);
}
$fog_query = implode('&', (array)$fog_query);
//$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
}
}
break;
case 5:
$fog_fsp = FOGGetElt($_POST['fog_load_stpl'],'perso_templates','val');
if(!empty($fog_fsp)){
parse_str($fog_fsp['val'],$fog_props);
$fog_config['_custom'] = array();
while(list($fog_key,$fog_val) = each($fog_props)){
if(!in_array($fog_key,$fog_array)) continue;
$fog_config['_custom'][$fog_key] = $fog_val;
$fog_query[] = $fog_key."=".urlencode($fog_val);
}
$fog_query = implode('&', (array)$fog_query);
//$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
}
break;
case 6:
$fog_db->query("DELETE from ".FOG_TABLES_PREF."perso_templates where id='".$_POST['fog_load_stpl']."'");
break;
}
if(isset($_POST['fog_posted'])){
$fog_query = array();
foreach($fog_array as $fog_val){
if(isset($_POST['fog_custom_'.$fog_val]) && !empty($_POST['fog_custom_'.$fog_val])){
$fog_config['_custom'][$fog_val] = $_POST['fog_custom_'.$fog_val];
$fog_query[] = $fog_val."=".urlencode($fog_config['_custom'][$fog_val]);
}elseif(isset($fog_config['_custom'][$fog_val]))
unset($fog_config['_custom'][$fog_val]);
}
$fog_query = implode('&', $fog_query);
if(isset($_POST['fog_savecurrent']))
$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
if(isset($_POST['fog_savetpl']))
if($_POST['fog_tpl_mod'])
$fog_db->query("UPDATE ".FOG_TABLES_PREF."perso_templates SET val='$fog_query' where id='".$_POST['fog_ow_tpl']."'");
elseif(($fog_nom = trim(htmlentities($_POST['fog_tpl_name']))) != "")
$fog_db->query("INSERT into ".FOG_TABLES_PREF."perso_templates (nom,val,skin) VALUES ('$fog_nom','$fog_query','$fog_skin')");
if(isset($_POST['fog_savetpl']))
$fog_smarty->assign('savetpl',$_POST['fog_savetpl']);
if(isset($_POST['fog_savecurrent']))
$fog_smarty->assign('savecurrent',!$_POST['fog_savecurrent']);
$fog_smarty->assign('tpl_mod',$_POST['fog_tpl_mod']);
if(isset($_POST['fog_ow_tpl']))
$fog_smarty->assign('ow_tpl',$_POST['fog_ow_tpl']);
}
if(isset($fog_array)){
$fog_db->query("SELECT nom,id from ".FOG_TABLES_PREF."perso_templates WHERE skin='$fog_skin'");
$fog_stpls = array();
while($fog_row = $fog_db->fetch_assoc())
$fog_stpls[] = $fog_row;
$fog_smarty->assign('stpls',$fog_stpls);
$fog_smarty->assign('array',$fog_array);
}
$fog_smarty->assign('enabled',!empty($fog_array));
unset($fog_result,$fog_array,$fog_row,$fog_i);
}
$fog_smarty->assign('q',$fog_q);
$fog_smarty->assign('action',$fog_action);
unset($fog_q,$fog_action);
}
?>
Bonjour benv8nam ,
voilà la page php ou est la partie du script :
j'ai mis la partie du code RANGS dans mon serveur Easy PHP pour voir le Code interprété par le serveur et envoyée au navigateur, car je cherche dans toutes les directions ?
[php]<?php
/*-----------------------------------------------------------------+
| +----------------- FOG Forum - PHP Board Engine ---------------+ |
| |------------- Copyleft 2004 Gilles "TitD" Daviet -----------| |
| |------------ Downloaded on http://fog-forum.sf.net -----------| |
| +--------------------------------------------------------------+ |
| |- php/admin/aff.php
| |- Configuration de l'affichage du forum
| +--------------------------------------------------------------
+----------------------------------------------------------------
| 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 2
| 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, write to the Free Software
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+--------------------------------------------------------------------------*/
if(!defined('FOG_INCLUDED'))die('Hello world');
if($fog_smarty->AdminRequis(5)){
$fog_q = isset($_GET['fog_q'])?$_GET['fog_q']:0;
$fog_action = isset($_GET['fog_action'])?$_GET['fog_action']:0;
///////////////////
/////GENERAL
///////////////////
if(!$fog_q){
if(isset($_POST['fog_posted'])){
$fog_config['skin'] = $_POST['fog_skin'];
$fog_config['lang'] = $_POST['fog_lang'];
$fog_config['fuseau'] = $_POST['fog_fuseau'];
$fog_config['dateformat'] = htmlentities($_POST['fog_dateformat']);
$fog_config['heureformat'] = htmlentities($_POST['fog_heureformat']);
if(!preg_match('`[^0-9]`',$_POST['fog_nbrep']))
$fog_config['maxs4aff'][0] = $_POST['fog_nbrep'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbtopics']))
$fog_config['maxs4aff'][1] = $_POST['fog_nbtopics'];
if(!preg_match('`[^0-9]`',$_POST['fog_depuis']))
$fog_config['maxs4aff'][2] = $_POST['fog_depuis'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbpop']))
$fog_config['maxs4aff'][3] = $_POST['fog_nbpop'];
if(!preg_match('`[^0-9]`',$_POST['fog_nbrepmess']))
$fog_config['maxs4aff'][4] = $_POST['fog_nbrepmess'];
$fog_config['maxs4aff'][5] = isset($_POST['fog_hideforums'])?1:0;
$fog_config['fenetres'][0] = isset($_POST['fog_fenetres0'])?1:0;
$fog_config['fenetres'][1] = isset($_POST['fog_fenetres1'])?1:0;
$fog_config['fenetres'][2] = isset($_POST['fog_fenetres2'])?1:0;
$fog_config['fenetres'][3] = isset($_POST['fog_fenetres3'])?1:0;
$fog_maxs4aff = implode('|',$fog_config['maxs4aff']);
$fog_fenetres = implode('|',$fog_config['fenetres']);
$fog_db->query('UPDATE '.FOG_TABLES_PREF."config SET skin='".$fog_config['skin']."',lang='".$fog_config['lang']."',fuseau='".$fog_config['fuseau']."',heureformat='".$fog_config['heureformat']."',dateformat='".$fog_config['dateformat']."',maxs4aff='$fog_maxs4aff',fenetres='$fog_fenetres'");
$fog_config['dateformat'] = stripslashes($fog_config['dateformat']);
$fog_config['heureformat'] = stripslashes($fog_config['heureformat']);
}
for($fog_i=0,$fog_j=-12;$fog_i<25;$fog_i++,$fog_j++){
$fog_fuseaux['value'][$fog_i] = $fog_i-12;
$fog_fuseaux['txt'][$fog_i] = "GMT".(($fog_j<0)?"$fog_j":(($fog_j)?"+$fog_j":""))." (".gmstrftime($fog_config['heureformat'],$fog_time+3600*$fog_j).")";
}
$fog_smarty->assign('fuseaux',$fog_fuseaux);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."skins/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_dir($fog_dirpath.$fog_file) && FOGIsSkinValid($fog_file))
$fog_array[$fog_i++] = $fog_file;
closedir($fog_dir);
}
$fog_smarty->assign('skins',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."lang/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_dir($fog_dirpath.$fog_file) && FOGIsLangValid($fog_file))
$fog_array[$fog_i++] = $fog_file;
closedir($fog_dir);
}
$fog_smarty->assign('langs',$fog_array);
unset($fog_fuseaux,$fog_array,$fog_result,$fog_i);
}
///////////////////
//// TEXTES MAILS
///////////////////
elseif($fog_q == 1){
$fog_config['mailstexts'] = explode('|FOGSPLIT|',htmlentities(stripslashes($fog_config['mailstexts'])));
$fog_action = $_POST['fog_switch'];
if($fog_action == 1){
$fog_config['rangs'][0] = htmlentities(trim($_POST['fog_lvl0']));
$fog_config['rangs'][1] = htmlentities(trim($_POST['fog_lvl1']));
$fog_config['rangs'][2] = htmlentities(trim($_POST['fog_lvl2']));
$fog_config['rangs'][3] = htmlentities(trim($_POST['fog_lvl3']));
$fog_config['rangs'][4] = htmlentities(trim($_POST['fog_lvl4']));
if($fog_user->row['rang'] > 4){
$fog_config['rangs'][5] = htmlentities(trim($_POST['fog_lvl5']));
$fog_config['rangs'][6] = htmlentities(trim($_POST['fog_lvl6']));
}
$fog_rangs = implode('|',$fog_config['rangs']);
$fog_db->query("UPDATE ".FOG_TABLES_PREF."config SET rangs='$fog_rangs'");
for($fog_i=0;$fog_i<count($fog_config['rangs']);$fog_i++)
$fog_config['rangs'][$fog_i] = stripslashes($fog_config['rangs'][$fog_i]);
}elseif($fog_action == 2){
$fog_config['mailstexts'][0] = trim($_POST['fog_mail0']);
$fog_config['mailstexts'][1] = trim($_POST['fog_mail1']);
$fog_mailstexts = implode('|FOGSPLIT|',$fog_config['mailstexts']);
$fog_config['mailstexts'] = explode('|FOGSPLIT|',htmlentities($fog_mailstexts));
$fog_db->query("UPDATE ".FOG_TABLES_PREF."config SET mailstexts='$fog_mailstexts'");
for($fog_i=0;$fog_i<count($fog_config['mailstexts']);$fog_i++)
$fog_config['mailstexts'][$fog_i] = stripslashes($fog_config['mailstexts'][$fog_i]);
}
}
////////////////
// SMILIES
///////////////
elseif($fog_q == 2){
if($fog_action == 1){
$fog_smiley = FOGGetElt($_GET['fog_smiley'],'smileys','issmiley,isicon,code,id');
if(!empty($fog_smiley) && isset($_POST['fog_posted'])){
$fog_smiley['issmiley'] = isset($_POST['fog_issmiley'])?1:0;
$fog_smiley['isicon'] = isset($_POST['fog_isicon'])?1:0;
$fog_smiley['code'] = htmlentities($_POST['fog_code']);
if($fog_smiley['code'] != "" || !($fog_smiley['isicon'] || $fog_smiley['issmiley']))
$fog_db->query("UPDATE ".FOG_TABLES_PREF."smileys set issmiley='".$fog_smiley['issmiley']."',isicon='".$fog_smiley['isicon']."',code='".$fog_smiley['code']."' where id='".$fog_smiley['id']."'");
}
$fog_smiley['code'] = stripslashes($fog_smiley['code']);
$fog_smarty->assign('smiley',$fog_smiley);
}elseif($fog_action == 2 || $fog_action == 3){
$fog_smiley = FOGGetElt($_GET['fog_smiley'],'smileys','ordre');
if(!empty($fog_smiley)){
$fog_qsigne = ($fog_action == 3)?'>':'<';
$fog_qsens = ($fog_action == 3)?'asc':'desc';
$fog_smileybis = $fog_db->fetch_row($fog_db->query("SELECT ordre,id from ".FOG_TABLES_PREF."smileys where ordre $fog_qsigne '".$fog_smiley['ordre']."' order by ordre $fog_qsens limit 1"));
if(!empty($fog_smileybis)){
$fog_db->query('UPDATE '.FOG_TABLES_PREF."smileys set ordre='".$fog_smileybis[0]."' where id='".$_GET['fog_smiley']."'");
$fog_db->query('UPDATE '.FOG_TABLES_PREF."smileys set ordre='".$fog_smiley['ordre']."' where id='".$fog_smileybis[1]."'");
}
unset($fog_smiley,$fog_smileybis,$fog_qsigne,$fog_qsens);
}
}
$fog_icons = FOGChopeSmileys('isicon');
$fog_tablesmileys = FOGTableKeysToVals(FOGChopeSmileys('issmiley'));
$fog_action = isset($_POST['fog_switch'])?$_POST['fog_switch']:0;
if($fog_action == 1 && !empty($_POST['fog_dispo'])){
$fog_row = $fog_db->fetch_assoc($fog_db->query("SELECT ordre from ".FOG_TABLES_PREF."smileys order by ordre desc limit 1"));
$fog_db->query("INSERT into ".FOG_TABLES_PREF."smileys (id,ordre) VALUES('".$_POST['fog_dispo']."','".($fog_row['ordre']+1)."')");
}elseif($fog_action == 2){
$fog_query = "('".(is_array($_POST['fog_selectedsmileys'])?implode("','",$_POST['fog_selectedsmileys']):$_POST['fog_selectedsmileys'])."')";
$fog_db->query("DELETE from ".FOG_TABLES_PREF."smileys where id IN $fog_query");
}
$fog_existent = array();
$fog_array = array();
$fog_i = 0;
$fog_db->query("SELECT issmiley,isicon,code,id,ordre from ".FOG_TABLES_PREF."smileys order by ordre");
while($fog_row = $fog_db->fetch_assoc()){
$fog_array[$fog_i++] = $fog_row;
$fog_existent[$fog_row['id']] = 1;
}
$fog_smarty->assign('smileys',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR."img/smileys/";
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_file($fog_dirpath.$fog_file) && !isset($fog_existent[$fog_file])){
$fog_file_info = getimagesize($fog_dirpath.$fog_file);
if ((strPos($fog_file,".jpg") && $fog_file_info[2] == 2)||(strPos($fog_file, ".gif") && $fog_file_info[2] == 1)||(strPos($fog_file, ".png") && $fog_file_info[2] == 3))
$fog_array[$fog_i++] = $fog_file;
}
closedir($fog_dir);
}
$fog_smarty->assign('dispos',$fog_array);
unset($fog_array,$fog_existent,$fog_row,$fog_i);
}
///////////////////////
//// CENSURE
///////////////////////
elseif($fog_q == 3){
if($fog_action == 1){
$fog_avant = trim($_POST['fog_avant']);
$fog_apres = trim($_POST['fog_apres']);
$fog_regexp = isset($_POST['fog_regexp'])?1:0;
if($fog_avant != "")
$fog_db->query("INSERT into ".FOG_TABLES_PREF."censor (avant,apres,reg_exp) VALUES('$fog_avant','$fog_apres','$fog_regexp')") or die(mysql_error());
}elseif($fog_action == 2){
$fog_avant = $_GET['fog_avant'];
if(isset($_POST['fog_posted'])){
$fog_avans = $fog_avant;
$fog_avant = trim($_POST['fog_avant']);
$fog_apres = trim($_POST['fog_apres']);
$fog_regexp = isset($_POST['fog_regexp'])?1:0;
if($fog_avant != "")
$fog_db->query("UPDATE ".FOG_TABLES_PREF."censor SET avant='$fog_avant',apres='$fog_apres',reg_exp='$fog_regexp' where avant='$fog_avans'");
}
$fog_word = $fog_db->fetch_assoc($fog_db->query("SELECT avant,apres,reg_exp from ".FOG_TABLES_PREF."censor where avant='$fog_avant' limit 1 "));
$fog_smarty->assign('word',$fog_word);
}elseif($_POST['fog_selectedwords']){
$fog_query = "('".implode("','",(array) $_POST['fog_selectedwords'])."')";
$fog_db->query("DELETE from ".FOG_TABLES_PREF."censor where avant IN $fog_query");
}
$fog_array = array();
$fog_db->query("SELECT avant,apres from ".FOG_TABLES_PREF."censor");
while($fog_row = $fog_db->fetch_assoc())
$fog_array[] = $fog_row;
$fog_smarty->assign('words',$fog_array);
unset($fog_array,$fog_row,$fog_i);
}
//////////////////
///// RANGS
//////////////////
elseif($fog_q == 4){
$fog_array_users = array();
$fog_i = 0;
$fog_result = $fog_db->query('SELECT pseudo,id from '.FOG_TABLES_PREF.'users where rang<'.$fog_user->row['rang'].(($fog_user->row['rang'] == 6)?(' or id='.$fog_user->row['id']):''));
while($fog_row = $fog_db->fetch_row($fog_result)){
$fog_array_users['pseudo'][$fog_row[1]] = $fog_row[0];
$fog_array_users['id'][$fog_row[1]] = $fog_row[1];
}
$fog_smarty->assign('users',$fog_array_users);
if($fog_action == 1){
$fog_mod = $_POST['fog_mod']?1:0;
$fog_nb = $fog_mod?$_POST['fog_uid']:intval(trim($_POST['fog_nb']));
$fog_txt = htmlentities(trim($_POST['fog_txt']));
$fog_img = $_POST['fog_img'];
if(!$fog_mod || in_array($fog_nb,$fog_array_users['id']))
$fog_db->query('INSERT into '.FOG_TABLES_PREF.'ranks (nb,txt,img,mod) VALUES('.$fog_nb.',\''.$fog_txt.'\',\''.$fog_img.'\',\''.$fog_mod.'\')');
}elseif($fog_action == 2){
$fog_rankid = $_GET['fog_rankid'];
if(isset($_POST['fog_posted'])){
$fog_rank = $fog_db->fetch_assoc($fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks where id='.$fog_rankid.' limit 1 '));
$fog_mod = $_POST['fog_mod']?1:0;
$fog_nb = $fog_mod?$_POST['fog_uid']:intval(trim($_POST['fog_nb']));
$fog_txt = htmlentities(trim($_POST['fog_txt']));
$fog_img = $_POST['fog_img'];
if((!$fog_rank['mod'] || in_array($fog_rank['nb'],$fog_array_users['id'])) && (!$fog_mod || in_array($fog_nb,$fog_array_users['id'])))
$fog_db->query('UPDATE '.FOG_TABLES_PREF.'ranks SET nb='.$fog_nb.',txt=\''.$fog_txt.'\',img=\''.$fog_img.'\',mod=\''.$fog_mod.'\' where id='.$fog_rankid);
}
$fog_rank = $fog_db->fetch_assoc($fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks where id='.$fog_rankid.' limit 1 '));
$fog_smarty->assign('rank',$fog_rank);
}elseif($_POST['fog_selectedranks']){
$fog_query = '('.implode(',',(array) $_POST['fog_selectedranks']).')';
$fog_db->query('DELETE from '.FOG_TABLES_PREF.'ranks where id IN '.$fog_query);
}
$fog_i = 0;
$fog_array = array();
$result = $fog_db->query('SELECT mod,nb,txt,img,id from '.FOG_TABLES_PREF.'ranks order by nb');
while($fog_row = $fog_db->fetch_assoc($result)){
if(!$fog_row['mod'])
$fog_array['nb'][$fog_i++] = $fog_row;
elseif($fog_row['mod'] == 1){
$fog_array['user'][$fog_i] = $fog_row;
$fog_array['user'][$fog_i++]['user'] = $fog_ub->Get($fog_row['nb'],'pseudo');
}
}
$fog_smarty->assign('ranks',$fog_array);
$fog_array = array();
$fog_i=0;
$fog_dirpath = FOG_DIR.'img/ranks/';
if ($fog_dir = opendir($fog_dirpath)){
while ($fog_file = readdir($fog_dir))
if(is_file($fog_dirpath.$fog_file)){
$fog_file_info = getimagesize($fog_dirpath.$fog_file);
if ((strPos($fog_file,'.jpg') && $fog_file_info[2] === 2)||(strPos($fog_file, '.gif') && $fog_file_info[2] === 1)||(strPos($fog_file, '.png') && $fog_file_info[2] === 3))
$fog_array[$fog_i++] = $fog_file;
}
closedir($fog_dir);
}
$fog_smarty->assign('dispos',$fog_array);
unset($$fog_array,$fog_existent,$fog_row,$fog_i);
}
////////////////////////
///// SKINS
////////////////////////
elseif($fog_q == 5){
$fog_array = array_keys($fog_custom);
switch($fog_action){
case 1:
$fog_config['_custom'] = array();
$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='' where id='0'");
break;
case 3:
$fog_smarty->display = false;
header('Content-disposition: filename=fog_skin_template.fst');
header('Content-type: text/fog-forum-skin-template');
header('Pragma: no-cache');
header('Expires: 0');
echo 'Content-type=text/fog-forum-skin-template&';
echo 'Content-version='.urlencode(FOG_MAJOUR_VERSION).'&';
foreach($fog_config['_custom'] as $fog_key=>$fog_val)
echo $fog_key.'='.urlencode($fog_val).'&';
break;
case 4:
$fog_fsp = $_FILES['fog_imported_fsp']['tmp_name'];
if(!empty($fog_fsp)){
$fog_fsp_name = FOGUniqueID($_FILES['fog_imported_fsp']['name']);
$fog_fsp_dest = FOG_DIR.'tmp/'.$fog_fsp_name;
move_uploaded_file($fog_fsp,$fog_fsp_dest);
$fog_file = fopen($fog_fsp_dest,'r');
$fog_fcontent = trim(fgets($fog_file,filesize($fog_fsp_dest)));
$fog_props = array();
parse_str($fog_fcontent,$fog_props);
fclose($fog_file);
unlink($fog_fsp_dest);
if($fog_props['Content-type'] == 'text/fog-forum-skin-template'){
$fog_config['_custom'] = array();
while(list($fog_key,$fog_val) = each($fog_props)){
if(!in_array($fog_key,$fog_array)) continue;
$fog_config['_custom'][$fog_key] = $fog_val;
$fog_query[] = $fog_key.'='.urlencode($fog_val);
}
$fog_query = implode('&', (array)$fog_query);
//$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
}
}
break;
case 5:
$fog_fsp = FOGGetElt($_POST['fog_load_stpl'],'perso_templates','val');
if(!empty($fog_fsp)){
parse_str($fog_fsp['val'],$fog_props);
$fog_config['_custom'] = array();
while(list($fog_key,$fog_val) = each($fog_props)){
if(!in_array($fog_key,$fog_array)) continue;
$fog_config['_custom'][$fog_key] = $fog_val;
$fog_query[] = $fog_key."=".urlencode($fog_val);
}
$fog_query = implode('&', (array)$fog_query);
//$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
}
break;
case 6:
$fog_db->query("DELETE from ".FOG_TABLES_PREF."perso_templates where id='".$_POST['fog_load_stpl']."'");
break;
}
if(isset($_POST['fog_posted'])){
$fog_query = array();
foreach($fog_array as $fog_val){
if(isset($_POST['fog_custom_'.$fog_val]) && !empty($_POST['fog_custom_'.$fog_val])){
$fog_config['_custom'][$fog_val] = $_POST['fog_custom_'.$fog_val];
$fog_query[] = $fog_val."=".urlencode($fog_config['_custom'][$fog_val]);
}elseif(isset($fog_config['_custom'][$fog_val]))
unset($fog_config['_custom'][$fog_val]);
}
$fog_query = implode('&', $fog_query);
if(isset($_POST['fog_savecurrent']))
$fog_db->query("UPDATE ".FOG_TABLES_PREF."persos SET val='$fog_query' where id='0'");
if(isset($_POST['fog_savetpl']))
if($_POST['fog_tpl_mod'])
$fog_db->query("UPDATE ".FOG_TABLES_PREF."perso_templates SET val='$fog_query' where id='".$_POST['fog_ow_tpl']."'");
elseif(($fog_nom = trim(htmlentities($_POST['fog_tpl_name']))) != "")
$fog_db->query("INSERT into ".FOG_TABLES_PREF."perso_templates (nom,val,skin) VALUES ('$fog_nom','$fog_query','$fog_skin')");
if(isset($_POST['fog_savetpl']))
$fog_smarty->assign('savetpl',$_POST['fog_savetpl']);
if(isset($_POST['fog_savecurrent']))
$fog_smarty->assign('savecurrent',!$_POST['fog_savecurrent']);
$fog_smarty->assign('tpl_mod',$_POST['fog_tpl_mod']);
if(isset($_POST['fog_ow_tpl']))
$fog_smarty->assign('ow_tpl',$_POST['fog_ow_tpl']);
}
if(isset($fog_array)){
$fog_db->query("SELECT nom,id from ".FOG_TABLES_PREF."perso_templates WHERE skin='$fog_skin'");
$fog_stpls = array();
while($fog_row = $fog_db->fetch_assoc())
$fog_stpls[] = $fog_row;
$fog_smarty->assign('stpls',$fog_stpls);
$fog_smarty->assign('array',$fog_array);
}
$fog_smarty->assign('enabled',!empty($fog_array));
unset($fog_result,$fog_array,$fog_row,$fog_i);
}
$fog_smarty->assign('q',$fog_q);
$fog_smarty->assign('action',$fog_action);
unset($fog_q,$fog_action);
}
?>
[/php]