File "addskin.php"

Full path: /home/argothem/www/memo/site/site/CoolForum_0.8.4_beta/CoolForum_0.8.4_beta/admin/addskin.php
File size: 4.64 KB
MIME-type: text/x-php
Charset: 8 bit

<?
//*********************************************************************************
//*                                                                               *
//*                  CoolForum v.0.8 Beta : Forum de discussion                   *
//*              Copyright 2001-2002 SORIANO Denis alias Cool Coyote             *
//*                                                                               *
//*                                                                               *
//*       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.                                            *
//*                                                                               *
//*                                                                               *
//*       Forum Cr par SORIANO Denis (Cool Coyote)                              *
//*       contact : coyote@coolcoyote.net                                         *
//*       site web et tlchargement : http://www.coolforum.net                   *
//*                                                                               *
//*********************************************************************************

require("entete.php");
getlangage("adm_addskin");

$tpl->box['titlesection']=$tpl->attlang("titleaddskin");

if(isset($_REQUEST['act']))
	$_REQUEST['action'] = $_REQUEST['act'];
	
if($_REQUEST['action']=="saveskin")
{
	$error="";
	
	$_POST['skins']['skinname']=getformatmsg($_POST['skins']['skinname']);
	
	$query=$sql->query("SELECT * FROM ".$_PRE."skins WHERE propriete='skinname' AND valeur='".$_POST['skins']['skinname']."'");
	$nb=mysql_numrows($query);
	
	if($nb>0)
		$error=$tpl->attlang("errorname");

	if(strlen($_POST['skins']['skinname'])==0)
		$error=$tpl->attlang("errornoname");
				
	if(strlen($_POST['skins']['repimg'])==0)
		$error=$tpl->attlang("errornorepimg");
	
	if(strlen($_POST['skins']['reptpl'])==0)
		$error=$tpl->attlang("errornoreptpl");
		
	if(strlen($error)==0)
	{
		$query=$sql->query("SELECT id FROM ".$_PRE."skins GROUP BY id ORDER BY id DESC");
		list($id)=mysql_fetch_array($query);
		
		$id++;
		
		for($i=0;$i<count($_POST['skins']);$i++)
		{
			$valeur=each($_POST['skins']);
			$query=$sql->query("INSERT INTO ".$_PRE."skins (id,propriete,valeur) VALUES ('$id','".$valeur['key']."','".$valeur['value']."')");
		}
		$tpl->box['admcontent']=$tpl->gettemplate("adm_addskin","saveok");		
	}
	else
	{
		$skins = $_POST['skins'];
		$skins['skinname']=getformatrecup($skins['skinname']);
		$tpl->box['errorbox']=$tpl->gettemplate("adm_addskin","errorbox");
		
		$smallfont=array();
		$middlefont=array();
		$bigfont=array();
		$fonts=array();
		$degrad=array();
		
		$smallfont[$skins['smallfont']]=" SELECTED";
		$middlefont[$skins['middlefont']]=" SELECTED";
		$bigfont[$skins['bigfont']]=" SELECTED";
		$fonts[$skins['font']]=" SELECTED";

		if($skins['affdegrad']=="Y")	$degrad[1] = " SELECTED";
		else				$degrad[2] = " SELECTED";
		
		$_REQUEST['actions'] = NULLSTR;
	}
}

if(empty($_REQUEST['action']))
{
	$tpl->box['targetform']="addskin.php";
	
	$tpl->box['groupscols'] = "";
	$tpl->box['errorbox']=NULLSTR;
	
	$query = $sql->query("SELECT id_group,Nom_group FROM ".$_PRE."groups ORDER BY id_group");
	while(list($id_group,$Nom_group)=mysql_fetch_array($query))
	{
		if(strlen($error)>0)
			$valuecolor	=	$skins['grp'.$id_group];
		else
			$valuecolor	=	"";
		$Nom_group		=	getformatrecup($Nom_group);
		$tpl->box['groupscols']	.=	$tpl->gettemplate("adm_addskin","groupscols");		
	}
	
	$tpl->box['admcontent']=$tpl->gettemplate("adm_addskin","formulaire");
}

$cache.=$tpl->gettemplate("adm_addskin","content");
require("bas.php");
?>