142 lines
No EOL
5.5 KiB
PHP
142 lines
No EOL
5.5 KiB
PHP
<?php
|
|
/**
|
|
* Project: BeCast WebEngine - simple site engine
|
|
* File: /modules/news/add.apnl.php
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library 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
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* @link http://www.becast.at
|
|
* @copyright 2009 - 2025 becast.at
|
|
* @author Bernhard Jaud <bernhard at becast dot at>
|
|
* @package BcWe core
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
* @version $Id$
|
|
*/
|
|
If (!defined("IN_BCWE_ADMIN")) {
|
|
die("Dieses Script kann nicht ausserhalb des Frameworks laufen!");
|
|
}
|
|
$session->page_begin("add News", True);
|
|
|
|
class add_news_panel extends admin_module{
|
|
|
|
function output(){
|
|
global $config, $db,$panel, $session;
|
|
$fail=FALSE;
|
|
if(isset($_POST['send'])&& $_POST['send']==1){
|
|
if(isset($_POST['text'])&& $_POST['text']!=""||isset($_POST['title'])&& $_POST['title']!=""){
|
|
$title=$db->escape($_POST['title']);
|
|
$db->query("INSERT INTO `" . $config["prefix"] . "news` (`text`,`date`,`author`,`category`,`title`,`active`) VALUES ('".$db->escape($_POST["text"])."','".time()."','".$session->userdata["uid"]."','".intval($_POST["category"])."','".$title."','".$_POST["active"]."')");
|
|
$panel->admin_message("Danke", "Die News wurden erfolgreich eingetragen!.",TRUE,"add_news");
|
|
}else{
|
|
$fail="<span style=\"text-align: center; color: red;\">Du musst alle Felder ausfüllen!</span>";
|
|
}
|
|
}elseif(!isset($_POST['send']) || $fail){
|
|
$panel->title="News schreiben";
|
|
$panel->form(array("action"=>$config["path"]."/admin/index.php?panel=add_news"));
|
|
if($fail){
|
|
$panel->content.=$fail;
|
|
}
|
|
$panel->content.="<h3>Titel:</h3>";
|
|
$panel->field(array("name"=>"title","typ"=>"text","value"=>$_POST["title"]));
|
|
$resultc=$db->query("SELECT `id`,`name` FROM `" . $config["prefix"] . "news_category` WHERE `active`='true'");
|
|
$karray["Keine"]="";
|
|
while($row=$db->fetch_array($resultc)){
|
|
$karray[$row["name"]]=$row["id"];
|
|
}
|
|
$panel->content.="<h3>Kategorie:</h3>";
|
|
$panel->select($karray,$_POST["category"],"category");
|
|
$panel->content.="<br />";
|
|
$panel->content.="<h3>Text:</h3>";
|
|
$panel->textarea(array("name"=>"text","value"=>$_POST["text"],"rows"=>"30","cols"=>"80"),"class=\"mceEditor\"");
|
|
$panel->content.="<h3>Aktiv:</h3>";
|
|
$panel->select(array("Nein"=>"false","Ja"=>"true"),$_POST["active"],"active");
|
|
$panel->content.="<br />";
|
|
$panel->field(array("name"=>"send","typ"=>"hidden","value"=>"1"));
|
|
$panel->content.="<br />";
|
|
$panel->submit();
|
|
$panel->formClose();
|
|
}
|
|
}
|
|
|
|
function meta(){
|
|
global $config;
|
|
$meta="<script type=\"text/javascript\" src=\"".$config["path"]."/js/jquery/jquery.min.js\"></script>
|
|
<script type=\"text/javascript\">
|
|
$(document).ready(function()
|
|
{
|
|
$(\"#url\").blur(function()
|
|
{
|
|
//remove all the class add the messagebox classes and start fading
|
|
$(\"#msgbox\").removeClass().addClass('messagebox').text('Warten...').fadeIn(\"slow\");
|
|
//check the username exists or not from ajax
|
|
$.post(\"ajax.php\",{ call:'url',url:$(this).val() } ,function(data)
|
|
{
|
|
if(data==1) //if username not avaiable
|
|
{
|
|
$(\"#msgbox\").fadeTo(200,0.1,function() //start fading the messagebox
|
|
{
|
|
//add message and change the class of the box and start fading
|
|
$(this).html('Url vergeben').addClass('messageboxerror').fadeTo(900,1);
|
|
});
|
|
}
|
|
else
|
|
{
|
|
$(\"#msgbox\").fadeTo(200,0.1,function() //start fading the messagebox
|
|
{
|
|
//add message and change the class of the box and start fading
|
|
$(this).html('').removeClass().fadeTo(900,1);
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
});
|
|
|
|
</script>";
|
|
$meta.='<script type="text/javascript" src="'.$config["path"].'/thirdparty/tiny/tiny_mce_gzip.js"></script>
|
|
<script type="text/javascript">
|
|
tinyMCE_GZ.init({
|
|
theme : "advanced",
|
|
mode : "textareas",
|
|
language : "de",
|
|
plugins : "table,advhr,advimage,advlink,insertdatetime,searchreplace",
|
|
disk_cache : true,
|
|
debug : false
|
|
});
|
|
</script>
|
|
<script type="text/javascript" src="'.$config["path"].'/thirdparty/tiny/tiny_mce.js"></script>
|
|
<script type="text/javascript">
|
|
tinyMCE.init({
|
|
theme : "advanced",
|
|
mode : "textareas",
|
|
language : "de",
|
|
plugins : "table,advhr,advimage,advlink,insertdatetime,searchreplace",
|
|
theme_advanced_disable : "styleselect,formatselect ",
|
|
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
|
|
theme_advanced_buttons2_add : "seperator,forecolor,removeformat,advhr",
|
|
theme_advanced_buttons3 : "tablecontrols,seperator",
|
|
theme_advanced_toolbar_location : "top",
|
|
theme_advanced_toolbar_align : "center",
|
|
remove_linebreaks : false,
|
|
convert_urls : false,
|
|
editor_selector : "mceEditor",
|
|
editor_deselector : "mceNoEditor"
|
|
});
|
|
</script>';
|
|
return $meta;
|
|
}
|
|
}
|
|
?>
|