Regarde ce code d'une page d'administration du cms que j'ai fais.
Tu peux le télécharger gratuitement et sans pub ! sur
titlweb.fr la page se trouve dans /reg/home_news.php
Tu verras que j'ai 2 instances de Ckeditor et ça ne pose aucun problème.
<?php require_once('../Connections/articles.php'); ?>
<?php
// Load the tNG classes
require_once('../includes/tng/tNG.inc.php');
// Make unified connection variable
$conn_articles = new KT_connection($articles, $database_articles);
//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_articles, "../");
//Grand Levels: Level
$restrict->addLevel("admin");
$restrict->Execute();
//End Restrict Access To Page
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE accordion_news SET link=%s, articleText=%s, articleName=%s, on_off_line=%s WHERE articleId=%s",
GetSQLValueString($_POST['link'], "text"),
GetSQLValueString($_POST['articleText'], "text"),
GetSQLValueString($_POST['articleName'], "text"),
GetSQLValueString($_POST['on_off_line'], "text"),
GetSQLValueString($_POST['articleId'], "int"));
mysql_select_db($database_articles, $articles);
$Result1 = mysql_query($updateSQL, $articles) or die(mysql_error());
$updateGoTo = "home_news.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form4")) {
$updateSQL = sprintf("UPDATE articles_middlediv SET article_name=%s, article_text=%s, on_off_line=%s WHERE article_id=%s",
GetSQLValueString($_POST['article_name'], "text"),
GetSQLValueString($_POST['articleText2'], "text"),
GetSQLValueString($_POST['on_off_line'], "text"),
GetSQLValueString($_POST['article_id'], "int"));
mysql_select_db($database_articles, $articles);
$Result1 = mysql_query($updateSQL, $articles) or die(mysql_error());
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
$insertSQL = sprintf("INSERT INTO articles_middlediv (article_name) VALUES (%s)",
GetSQLValueString($_POST['article_name'], "text"));
mysql_select_db($database_articles, $articles);
$Result1 = mysql_query($insertSQL, $articles) or die(mysql_error());
$insertGoTo = "home_news.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form2")) {
$insertSQL = sprintf("INSERT INTO accordion_news (articleName) VALUES (%s)",
GetSQLValueString($_POST['articleName'], "text"));
mysql_select_db($database_articles, $articles);
$Result1 = mysql_query($insertSQL, $articles) or die(mysql_error());
$insertGoTo = "home_news.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_articles, $articles);
$query_rs_design = "SELECT menubackcolor FROM design";
$rs_design = mysql_query($query_rs_design, $articles) or die(mysql_error());
$row_rs_design = mysql_fetch_assoc($rs_design);
$totalRows_rs_design = mysql_num_rows($rs_design);
$colname_home_news = "-1";
if (isset($_GET['articleId'])) {
$colname_home_news = $_GET['articleId'];
}
mysql_select_db($database_articles, $articles);
$query_home_news = sprintf("SELECT * FROM accordion_news WHERE articleId = %s ORDER BY articleOrder ASC", GetSQLValueString($colname_home_news, "int"));
$home_news = mysql_query($query_home_news, $articles) or die(mysql_error());
$row_home_news = mysql_fetch_assoc($home_news);
$totalRows_home_news = mysql_num_rows($home_news);
mysql_select_db($database_articles, $articles);
$query_homeAccordion_news_total = "SELECT * FROM accordion_news ORDER BY articleOrder ASC";
$homeAccordion_news_total = mysql_query($query_homeAccordion_news_total, $articles) or die(mysql_error());
$row_homeAccordion_news_total = mysql_fetch_assoc($homeAccordion_news_total);
$totalRows_homeAccordion_news_total = mysql_num_rows($homeAccordion_news_total);
mysql_select_db($database_articles, $articles);
$query_accordion_design = "SELECT * FROM accordion_design";
$accordion_design = mysql_query($query_accordion_design, $articles) or die(mysql_error());
$row_accordion_design = mysql_fetch_assoc($accordion_design);
$totalRows_accordion_design = mysql_num_rows($accordion_design);
mysql_select_db($database_articles, $articles);
$query_accordion_news_sort = "SELECT * FROM accordion_news WHERE on_off_line = 'Y' ORDER BY articleOrder ASC";
$accordion_news_sort = mysql_query($query_accordion_news_sort, $articles) or die(mysql_error());
$row_accordion_news_sort = mysql_fetch_assoc($accordion_news_sort);
$totalRows_accordion_news_sort = mysql_num_rows($accordion_news_sort);
mysql_select_db($database_articles, $articles);
$query_middlediv_article = "SELECT * FROM articles_middlediv";
$middlediv_article = mysql_query($query_middlediv_article, $articles) or die(mysql_error());
$row_middlediv_article = mysql_fetch_assoc($middlediv_article);
$totalRows_middlediv_article = mysql_num_rows($middlediv_article);
$colname_middle_div_article_modif = "-1";
if (isset($_GET['middlediv_article'])) {
$colname_middle_div_article_modif = $_GET['middlediv_article'];
}
mysql_select_db($database_articles, $articles);
$query_middle_div_article_modif = sprintf("SELECT * FROM articles_middlediv WHERE article_id = %s", GetSQLValueString($colname_middle_div_article_modif, "int"));
$middle_div_article_modif = mysql_query($query_middle_div_article_modif, $articles) or die(mysql_error());
$row_middle_div_article_modif = mysql_fetch_assoc($middle_div_article_modif);
$totalRows_middle_div_article_modif = mysql_num_rows($middle_div_article_modif);
mysql_select_db($database_articles, $articles);
$query_online_middle_div_article = "SELECT * FROM articles_middlediv WHERE on_off_line = 'Y'";
$online_middle_div_article = mysql_query($query_online_middle_div_article, $articles) or die(mysql_error());
$row_online_middle_div_article = mysql_fetch_assoc($online_middle_div_article);
$totalRows_online_middle_div_article = mysql_num_rows($online_middle_div_article);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>news accordéon</title>
<link href="../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<link href="SpryAssets/SpryAccordion.php" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="../includes/common/js/base.js" type="text/javascript"></script>
<script src="../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../includes/skins/style.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/jquery-18-19/jquery-1.8.2.js"></script>
<script type="text/javascript" src="../ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../Scripts/jquery-18-19/jquery-ui-1.9.1.custom.min.js"></script>
<script type="text/javascript" src="../Scripts/webkitresizer/jquery.webkitresize.min.js"></script>
<style>
ul {
padding:0px;
margin: 0px;
width: 175px;
}
.cellulemenu
{ width: 150px;
height: 30px;
background-color: <?php echo $row_accordion_design['accordion_bar_color']; ?>;
text-align:center;
color: <?php echo $row_accordion_design['title_color']; ?>;
font-size: <?php echo $row_accordion_design['title_size']; ?>px;
font-style: <?php echo $row_accordion_design['title_style']; ?>;
font-weight: <?php echo $row_accordion_design['tiltle_bold']; ?>;
}
#response {
padding:0px;
background-color:#9F9;
border:2px solid #396;
margin-bottom:20px;
}
#list li {
margin-right:0px;
margin-left:0px;
margin-bottom:0px;
margin-top:0px;
padding-top: 1px;
padding-right: 0px;
padding-bottom: 1px;
padding-left: 15px;
padding-right:0px;
list-style: none;
}
body {
background-color: #66CCFF;
}
.Style1 {
color: #FF0000;
font-size: 14;
}
.rubriques {
color: <?php echo $row_rsdesign['fontcolor']; ?>;
<?php echo $row_rsdesign['bold']; ?>;
font-size: <?php echo $row_rsdesign['fontsize']; ?>px;
font-style: <?php echo $row_rsdesign['font_style']; ?>;
font-family: <?php echo $row_rsdesign['font']; ?>;
padding-top: <?php echo $row_rsdesign['tablesize']; ?>px;
padding-right: 0px;
padding-bottom: <?php echo $row_rsdesign['tablesize']; ?>px;
padding-left: 5px;
}
ul {
margin: 0;
}
#contentWrap {
width: 700px;
margin: 0 auto;
height: auto;
overflow: hidden;
}
#contentTop {
width: 600px;
padding: 10px;
margin-left: 30px;
}
#contentLeft {
float: left;
width: 210px;
}
#contentLeft li {
list-style: none;
margin: 0 0 4px 0;
padding: 10px;
background-color: #000000;
border: #CCCCCC solid 1px;
color:#000;
cursor: move;
}
#contentRight {
float: right;
width: 260px;
padding:10px;
background-color: #000000;;
color:#FFFFFF;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
function slideout(){
setTimeout(function(){
$("#response").slideUp("slow", function () {
});
}, 2000);}
$("#response").hide();
$(function() {
$("#list ul").sortable({ opacity: 0.8, cursor: 'move', update: function() {
var order = $(this).sortable("serialize") + '&update=update';
$.post("accordion_newssort/updateList.php", order, function(theResponse){
$("#response").html(theResponse);
$("#response").slideDown('slow');
slideout();
});
}
});
});
});
</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form action="rubriquelist.php" method="post" name="Retour" target="_parent" id="Retour">
<input type="submit" name="Submit222" value="Retour" class="modif_bouton_2"/>
</form></td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1">
<table align="left" class="ligne_normal_colone2">
<tr valign="baseline" class="table_style_first_lign">
<td colspan="2" align="center" nowrap="nowrap">Ajouter un nouvel article accordéon :</td>
</tr>
<tr valign="baseline" class="table_style">
<td nowrap="nowrap" align="right" class="table_style">Nom de l'article :</td>
<td><input type="text" name="articleName" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Ajouter" class="modif_bouton_2"/></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form2" />
</form></td>
<td valign="top"></td>
<td></td>
</tr>
<tr>
<td><form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="left" class="ligne_normal_colone2">
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap" class="table_style">Nom de l'article :</td>
<td class="table_style"><input type="text" name="articleName" value="<?php echo $row_home_news['articleName']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap" class="table_style">Texte :</td>
<td>
<textarea cols="200" id="articleText" name="articleText" rows="10"><?php echo $row_home_news['articleText']; ?></textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'articleText',{
filebrowserBrowseUrl: '../fckeditor/editor/plugins/kfm/', width : '440px',
height: '160px'
});
CKEDITOR.on('instanceReady', function () {
$(".cke_editor iframe").webkitimageresize().webkittableresize().webkittdresize();
});
//]]>
</script>
</td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap" class="table_style">Lien :</td>
<td class="table_style"><input type="text" name="link" value="<?php echo $row_home_news['link']; ?>" size="60" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap"> </td>
<td valign="baseline"><table>
<tr>
<td valign="top"><input type="radio" name="on_off_line" value="Y" <?php if (!(strcmp($row_home_news['on_off_line'],"Y"))) {echo "checked=\"checked\"";} ?> />
En ligne</td>
<td valign="top"><input type="radio" name="on_off_line" value="N" <?php if (!(strcmp($row_home_news['on_off_line'],"N"))) {echo "checked=\"checked\"";} ?> />
Hors ligne
<input type="submit" value="Modifier" class="modif_bouton_2"/></td>
</tr>
</table></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1" />
<input type="hidden" name="articleId" value="<?php echo $row_home_news['articleId']; ?>" />
</form></td>
<td valign="top"><table border="1">
<tr class="table_style_first_lign">
<td>Nom :</td>
<td>Status :</td>
<td colspan="2"> </td>
</tr>
<?php do { ?>
<tr class="table_style">
<td class="table_style"><?php echo $row_homeAccordion_news_total['articleName']; ?></td>
<td><?php
// Show IF Conditional region2
if (@$row_homeAccordion_news_total['on_off_line'] == "Y") {
?>
<span class="deuxieme_ligne_tableau">En ligne</span>
<?php
// else Conditional region2
} else { ?>
<span class="colone_modif">Hors ligne</span>
<?php }
// endif Conditional region2
?></td>
<td class="table_style"><a href="home_news.php?articleId=<?php echo $row_homeAccordion_news_total['articleId']; ?>">Modifier</a></td>
<td class="table_style"><a href="del/home_news_del.php?articleId=<?php echo $row_homeAccordion_news_total['articleId']; ?>" onclick="return confirm('<?php echo NXT_getResource("Are you sure?"); ?>');">Supprimer</a></td>
</tr>
<?php } while ($row_homeAccordion_news_total = mysql_fetch_assoc($homeAccordion_news_total)); ?>
</table><br />
<div id="container">
<div id="list">
<ul>
<?php
$query = "SELECT * FROM accordion_news WHERE on_off_line = 'Y' ORDER BY articleOrder ASC";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
$id = stripslashes($row['articleId']);
$text = stripslashes($row['articleName']);
?>
<li id="arrayorder_<?php echo $id ?>"> <table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="cellulemenu"><?php echo $text; ?></td>
</tr>
</table>
<div class="clear"></div>
</li>
<?php } ?>
</ul>
</div>
</div></td>
<td> </td>
</tr>
</table></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td> </td>
<td> </td>
</tr>
</table><table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><form action="<?php echo $editFormAction; ?>#mini_news" method="POST" name="form3" id="form3">
<table align="left" class="ligne_normal_colone1">
<tr valign="baseline">
<td colspan="2" align="center" nowrap="nowrap">Ajouter un mini article :</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nom de l'article :</td>
<td><input type="text" name="article_name" value="" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td><input type="submit" value="Ajouter" class="modif_bouton_2"/></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form3" />
</form></td>
<td> </td>
</tr>
<tr>
<td valign="top"><a name="mini_news" id="selectedaudio"></a><form action="<?php echo $editFormAction; ?>" method="post" name="form4" id="form4">
<table class="ligne_normal_colone1">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Nom de l'article :</td>
<td><input type="text" name="article_name" value="<?php echo $row_middle_div_article_modif['article_name']; ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap">Texte :<br />
<table>
<tr>
<td>
<?php
// Show IF Conditional region1
if ($totalRows_online_middle_div_article == 0 OR @$row_middle_div_article_modif['on_off_line'] == "Y") {
?>
<input type="radio" name="on_off_line" value="Y" <?php if (!(strcmp($row_middle_div_article_modif['on_off_line'],"Y"))) {echo "checked=\"checked\"";} ?> />
En ligne</td>
<td><input type="radio" name="on_off_line" value="N" <?php if (!(strcmp($row_middle_div_article_modif['on_off_line'],"N"))) {echo "checked=\"checked\"";} ?> />
Hors ligne
<?php
// else Conditional region1
} else { ?>
<input type="hidden" name="on_off_line" value="Y" <?php if (!(strcmp($row_middle_div_article_modif['on_off_line'],"Y"))) {echo "checked=\"checked\"";} ?> />
<input type="hidden" name="on_off_line" value="N" <?php if (!(strcmp($row_middle_div_article_modif['on_off_line'],"N"))) {echo "checked=\"checked\"";} ?> />
<?php }
// endif Conditional region1
?><br />
<input type="submit" value="Modifier" class="modif_bouton_2"/></td>
</tr>
</table></td>
<td>
<textarea id="articleText2" name="articleText2"><?php echo $row_middle_div_article_modif['article_text']; ?></textarea>
<script type="text/javascript">
//<![CDATA[
// This call can be placed at any point after the
// <textarea>, or inside a <head><script> in a
// window.onload event handler.
// Replace the <textarea id="editor"> with an CKEditor
// instance, using default configurations.
CKEDITOR.replace( 'articleText2',{
filebrowserBrowseUrl: '../fckeditor/editor/plugins/kfm/', width : '220px',
height: '400px',toolbar : 'mininews'
});
CKEDITOR.on('instanceReady', function () {
$(".cke_editor iframe").webkitimageresize().webkittableresize().webkittdresize();
});
//]]>
</script>
</td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"> </td>
<td valign="baseline">
</td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form4" />
<input type="hidden" name="article_id" value="<?php echo $row_middle_div_article_modif['article_id']; ?>" />
</form></td>
<td valign="top"><table border="1">
<tr class="table_style_first_lign">
<td>Nom :</td>
<td>Status :</td>
<td colspan="2"></td>
</tr>
<?php do { ?>
<tr class="class=table_style">
<td class="table_style"><?php echo $row_middlediv_article['article_name']; ?></td>
<td class="table_style"><?php echo $row_middlediv_article['on_off_line']; ?></td>
<td class="table_style"><a href="home_news.php?middlediv_article=<?php echo $row_middlediv_article['article_id']; ?>#mini_news">Modifier</a></td>
<td class="table_style"><a href="del/mini_news_del.php?mini_news_Id=<?php echo $row_middlediv_article['article_id']; ?>" onclick="return confirm('<?php echo NXT_getResource("Are you sure?"); ?>');">Supprimer</a></td>
</tr>
<?php } while ($row_middlediv_article = mysql_fetch_assoc($middlediv_article)); ?>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_design);
mysql_free_result($home_news);
mysql_free_result($homeAccordion_news_total);
mysql_free_result($accordion_design);
mysql_free_result($accordion_news_sort);
mysql_free_result($middlediv_article);
mysql_free_result($middle_div_article_modif);
mysql_free_result($online_middle_div_article);
?>