Ma barre d'outils FCKeditor ne s'affiche pas - Programmation
TomsGuide.com : 700 000 inscrits répondent à toutes vos questions high-tech et informatique.
Pour obtenir de l'aide, inscrivez-vous gratuitement !
 




Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet : Ma barre d'outils FCKeditor ne s'affiche pas
 
Profil : IDNaute
Plus d'informations

Bonjou,

Voilà g installé en local FCK editor(php4.3), tous marche bien par contre sur mon serveur avec php 4.06, la barre d'outil d'apparait pas. voivi mon code<?php require_once('../../Connections/cnnews.php'); ?>
<? include("../FCKeditor/fckeditor.php" ) ;?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "" )
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "" ) ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "" ) ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "" ) ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "" ) ? "'" . date("d-m-y",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "" ) ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "" ) ? "'" . date("d-m-y H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "" ) ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($HTTP_SERVER_VARS['QUERY_STRING']);
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form2" )) {
$insertSQL = sprintf("INSERT INTO news (id_news, titre, contenu, url, date_saisie, visible, fin_date, photo, resume, title) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['id_news'], "int" ),
GetSQLValueString($HTTP_POST_VARS['titre'], "text" ),
GetSQLValueString($HTTP_POST_VARS['contenu'], "text" ),
GetSQLValueString($HTTP_POST_VARS['url'], "text" ),
GetSQLValueString($HTTP_POST_VARS['date_saisie'], "date" ),
GetSQLValueString($HTTP_POST_VARS['visible'], "int" ),
GetSQLValueString($HTTP_POST_VARS['fin_date'], "date" ),
GetSQLValueString($HTTP_POST_VARS['image'], "text" ),
GetSQLValueString($HTTP_POST_VARS['contenu'], "text" ),
GetSQLValueString($HTTP_POST_VARS['titre'], "text" ));

mysql_select_db($database_cnnews, $cnnews);
$Result1 = mysql_query($insertSQL, $cnnews) or die(mysql_error());

$insertGoTo = "administration_news.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_cnnews, $cnnews);
$query_Rsactu = "SELECT id_news, titre, contenu, DATE_FORMAT(date_saisie,'%d-%m-%y')date_saisie, url, DATE_FORMAT(fin_date,'%d-%m-%y')fin_date, news.visible, news.photo, news.title FROM news ORDER BY news.date_saisie DESC";
$Rsactu = mysql_query($query_Rsactu, $cnnews) or die(mysql_error());
$row_Rsactu = mysql_fetch_assoc($Rsactu);
$totalRows_Rsactu = mysql_num_rows($Rsactu);
?>
<? //include"../session.inc"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ajouter une actualit&eacute;</title>
<link href="news.css" rel="stylesheet" type="text/css">
<link href="../../css/index.css" rel="stylesheet" type="text/css">
</head>
<SCRIPT LANGUAGE="JavaScript">
/* On crée une fonction de verification */
function verifForm(formulaire)
{
if(formulaire.fin_date.value == "" ) /* on detecte si saisie33 est vide */
alert('Remplissez le champs alors !!');
/* dans ce cas on lance un message d'alerte */
else
formulaire.submit(); /* sinon on envoi le formulaire */
}
</SCRIPT>
<script type="text/javascript"><!--
function isDate(d) {
// Cette fonction permet de vérifier la validité d'une date au format jj/mm/aa ou jj/mm/aaaa
// Par Romuald

if (d == "" ) // si la variable est vide on retourne faux
return false;

e = new RegExp("^[0-9]{1,2}\/[0-9]{1,2}\/([0-9]{2}|[0-9]{4})$" );

if (!e.test(d)) // On teste l'expression régulière pour valider la forme de la date
return false; // Si pas bon, retourne faux

// On sépare la date en 3 variables pour vérification, parseInt() converti du texte en entier
j = parseInt(d.split("/" )[0], 10); // jour
m = parseInt(d.split("/" )[1], 10); // mois
a = parseInt(d.split("/" )[2], 10); // année

// Si l'année n'est composée que de 2 chiffres on complète automatiquement
if (a < 1000) {
if (a < 89) a+=2000; // Si a < 89 alors on ajoute 2000 sinon on ajoute 1900
else a+=1900;
}

// Définition du dernier jour de février
// Année bissextile si annnée divisible par 4 et que ce n'est pas un siècle, ou bien si divisible par 400
if (a%4 == 0 && a%100 !=0 || a%400 == 0) fev = 29;
else fev = 28;

// Nombre de jours pour chaque mois
nbJours = new Array(31,fev,31,30,31,30,31,31,30,31,30,31);

// Enfin, retourne vrai si le jour est bien entre 1 et le bon nombre de jours, idem pour les mois, sinon retourn faux
return ( m >= 1 && m <=12 && j >= 1 && j <= nbJours[m-1] );
}
//-->
</script>
<script>
function testDateValide(saisie) {
if (saisie == "" ) return false;
saisie = (saisie).split("/" );
if ((saisie.length != 3) || isNaN(parseInt(saisie[0])) || isNaN(parseInt(saisie[1])) || isNaN(parseInt(saisie[2]))) return false;
var laDate = new Date(eval(saisie[2]),eval(saisie[1])-1,eval(saisie[0]));
var annee = laDate.getYear();
if ((Math.abs(annee)+"" ).length < 4) annee = annee + 1900;
return ((laDate.getDate() == eval(saisie[0])) && (laDate.getMonth() == eval(saisie[1])-1) && (annee == eval(saisie[2])));
}
</script>


<body>
<fieldset class="champs-5">
<div align="center">
<legend class="txt2"></legend>
<legend class="txt2"></legend>
<p class="txt2"><a href="administration_news.php" target="_self">Page d'administration </a></p>
<legend class="txt2">Ajouter une actualit&eacute;</legend>
</div>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" onSubmit="testDateValide(form1.fin_date.value)?alert('date correcte !'):alert('date incorrecte !');">
<table width="606" align="center">
<tr valign="baseline" class="fdjaune">
<td width="69" align="right" nowrap class="txt2">Titre:</td>
<td width="525"><input name="titre" type="text" class="text" value="" size="72"></td>
</tr>
<tr valign="baseline" class="fdjaune">
<td nowrap align="right" valign="top"><span class="txt2">Description</span>:</td>
<td> <?php
$oFCKeditor = new FCKeditor('contenu') ;
$oFCKeditor->BasePath = '../admin_index2/FCKeditor/';
$oFCKeditor->Width = ' 100% ' ;
$oFCKeditor->Height = ' 200% ' ;
//$oFCKeditor->ToolbarSet = 'Basic' ;
$oFCKeditor->Value = 'Default text in editor';
$oFCKeditor->Create() ;
?> </td>
</tr>
<tr valign="baseline" class="fdjaune">
<td height="26" align="right" nowrap class="txt2">Nom du fichier :</td>
<td><input name="url" type="text" class="text" value="" size="72"></td>
</tr>
<tr valign="baseline" class="bordformtxt10">
<td align="right" nowrap class="txt2">Image </td>
<td><span class="txt2">
<input name="image" type="text" id="image" size="40">
Mettre le nom du fichier avec son extension </span> </td>
</tr>
<tr valign="baseline" class="bordformtxt10">
<td align="right" nowrap>Etiquette du lien</td>
<td><input name="etiquette" type="text" id="etiquette" size="40"></td>
</tr>
<tr valign="baseline" class="fdjaune">
<td align="right" nowrap><span class="txt2">Visible :</span></td>
<td><input name="visible" type="text" id="visible">
0 ou 1 </td>
</tr>
<tr valign="baseline" class="fdjaune">
<td align="right" nowrap>fin_date</td>
<td><input name="fin_date" type="text" id="fin_date" >
00-00-00</td>
</tr>
<tr valign="baseline" class="fdjaune">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="soumettre"></td>
</tr>
</table>
<input type="hidden" name="id_news" value="">
<input type="hidden" name="date_saisie" value="">
<input type="hidden" name="MM_insert" value="form2">
</form>
<p>&nbsp;</p>
</fieldset>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Rsactu);
?>


sur la page FCP editor.php :

<?php
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckeditor.php
* This is the integration file for PHP.
*
* It defines the FCKeditor class that can be used to create editor
* instances in PHP pages on server side.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/

class FCKeditor
{
var $InstanceName ;
var $BasePath ;
var $Width ;
var $Height ;
var $ToolbarSet ;
var $Value ;
var $Config ;

// PHP 5 Constructor (by Marcus Bointon <coolbru@users.sourceforge.net> )
function __construct( $instanceName )
{
$this->InstanceName = $instanceName ;
$this->BasePath = '../fckeditor/' ;
$this->Width = '100%' ;
$this->Height = '200' ;
$this->ToolbarSet = 'Default' ;
$this->Value = '' ;

$this->Config = array() ;
}

// PHP 4 Contructor
function FCKeditor( $instanceName )
{
$this->__construct( $instanceName ) ;
}

function Create()
{
echo $this->CreateHtml() ;
}

function CreateHtml()
{
$HtmlValue = htmlspecialchars( $this->Value ) ;

$Html = '<div>' ;

if ( $this->IsCompatible() )
{
if ( isset( $HTTP_GET_VARS['fcksource'] ) && $HTTP_GET_VARS['fcksource'] == "true" )
$File = 'fckeditor.original.html' ;
else
$File = 'fckeditor.html' ;

$Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ;

if ( $this->ToolbarSet != '' )
$Link .= "&amp;Toolbar={$this->ToolbarSet}" ;

// Render the linked hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ;

// Render the configurations hidden field.
$Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ;

// Render the editor IFRAME.
$Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ;
}
else
{
if ( strpos( $this->Width, '%' ) === false )
$WidthCSS = $this->Width . 'px' ;
else
$WidthCSS = $this->Width ;

if ( strpos( $this->Height, '%' ) === false )
$HeightCSS = $this->Height . 'px' ;
else
$HeightCSS = $this->Height ;

$Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ;
}

$Html .= '</div>' ;

return $Html ;
}

function IsCompatible()
{
global $HTTP_USER_AGENT ;

if ( isset( $HTTP_USER_AGENT ) )
$sAgent = $HTTP_USER_AGENT ;
else
$sAgent = $_SERVER['HTTP_USER_AGENT'] ;

if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false )
{
$iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ;
return ($iVersion >= 5.5) ;
}
else if ( strpos($sAgent, 'Gecko/') !== false )
{
$iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ;
return ($iVersion >= 20030210) ;
}
else
return false ;
}

function GetConfigFieldString()
{
$sParams = '' ;
$bFirst = true ;

foreach ( $this->Config as $sKey => $sValue )
{
if ( $bFirst == false )
$sParams .= '&amp;' ;
else
$bFirst = false ;

if ( $sValue === true )
$sParams .= $this->EncodeConfig( $sKey ) . '=true' ;
else if ( $sValue === false )
$sParams .= $this->EncodeConfig( $sKey ) . '=false' ;
else
$sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ;
}

return $sParams ;
}

function EncodeConfig( $valueToEncode )
{
$chars = array(
'&' => '%26',
'=' => '%3D',
'"' => '%22' ) ;

return strtr( $valueToEncode, $chars ) ;
}
}

?>
si quelqu'un peux me dire d'ou ça viens. merci


  FORUM Infos-du-Net » Programmation » Ma barre d'outils FCKeditor ne s'affiche pas

Aller à :
 

Liens