File: /home/contexpert/public_html/admin/fisier/texte.php
<div class="aliniere_centru">
<?php
$mysql = mysql_query("SELECT count(*) FROM texte WHERE categorie = '".$_GET['categorie']."'"); //verifica in baza de date daca exista texte in acea categorie
if (mysql_result($mysql,0) == 0) { //daca nu exista atunci nu fa fi inclus nimic in WYSIWYG
$text='';
}
else if (mysql_result($mysql,0) == 1) { //daca exsita text il selecteaza pentru a il include in textare
$my_sql = mysql_query("SELECT * FROM texte WHERE categorie = '".$_GET['categorie']."'");
$row = mysql_fetch_array($my_sql);
$text = stripslashes($row['continut']);
}
if (isset($_POST["buton"])) { //verifica daca a fost lanssta operatia de inserare/modificare
$_POST["xhtml1"] = stripslashes($_POST["xhtml1"]);
if (mysql_result($mysql,0) == 0) { //daca exista text in baza de date il va modifica
$my_sql = mysql_query("INSERT INTO texte VALUES ('".$_GET['categorie']."', '".stripslashes($_POST["xhtmll"])."')");
if (mysql_affected_rows() == 1) {
echo '<div class="eroare">Textul a fost introdus în baza de date!</div>';
}
}
else { //daca nu, il va modifica
$my_sql = mysql_query("UPDATE texte SET continut = '".stripslashes($_POST["xhtmll"])."' WHERE categorie = '".$_GET['categorie']."'");
if (mysql_affected_rows() == 1) {
echo '<div class="eroare">Textul a fost modificat cu succes!</div>';
}
}
}
if (isset($_POST['buton'])) { $text = stripslashes($_POST['xhtmll']); }
?>
<script language="javascript" type="text/javascript" src="admin/fisier/wysiwyg/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "exact",
elements : "xhtmll",
extended_valid_elements : "a[href|target|name]",
plugins : "style,layer,table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
theme_advanced_buttons1_add_before : "newdocument,separator",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor,advsearchreplace",
theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,|,visualchars,nonbreaking",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_path_location : "bottom",
content_css : "example_full.css",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_link_list.js",
external_image_list_url : "example_image_list.js",
flash_external_list_url : "example_flash_list.js",
media_external_list_url : "example_media_list.js",
file_browser_callback : "fileBrowserCallBack",
theme_advanced_resize_horizontal : true,
theme_advanced_resizing : true,
nonbreaking_force_tab : true,
apply_source_formatting : true
});
// Custom event handler
function myCustomExecCommandHandler(editor_id, elm, command, user_interface, value) {
var linkElm, imageElm, inst;
switch (command) {
case "mceLink":
inst = tinyMCE.getInstanceById(editor_id);
linkElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "a");
if (linkElm)
alert("Link dialog has been overriden. Found link href: " + tinyMCE.getAttrib(linkElm, "href"));
else
alert("Link dialog has been overriden.");
return true;
case "mceImage":
inst = tinyMCE.getInstanceById(editor_id);
imageElm = tinyMCE.getParentElement(inst.selection.getFocusElement(), "img");
if (imageElm)
alert("Image dialog has been overriden. Found image src: " + tinyMCE.getAttrib(imageElm, "src"));
else
alert("Image dialog has been overriden.");
return true;
}
return false; // Pass to next handler in chain
}
// Custom save callback, gets called when the contents is to be submitted
function customSave(id, content) {
alert(id + "=" + content);
}
</script>
<form action="?categorie=<? echo $_GET['categorie'];?>&admin=<? echo $_GET['admin'];?>" method="post" onsubmit="myOnSubmitEventHandler()">
<p>
<textarea name="xhtmll" id="xhtmll" cols="90" rows="30" wrap="virtual" title="Introdu conţinutul textului pe care doriţi să il postaţi "><? echo $text;?></textarea>
<input type="submit" class="button" id="buton" name="buton" value="Îregistrează" />
</p>
</form>
</div>
<?
include("admin/fisier/uploadfisiere.php");
include("admin/fisier/browserfisiere.php");
?>