Hallo,
kann einer in dieser news.php, den tinymce einfügen, oder hat jmd. zufällig einen?:
PHP
<?php
if(!defined("ITS_OK") || !IsAdminLoggedIn() || $userRank < 5 ) { header("Location: ./admin"); }
$action = "default";
if(isset($_GET["action"])) {
switch($_GET["action"]) {
case "add": { $action = "add"; break; }
case "edit": { if(isset($_GET["id"])) { $action = "edit"; break; } }
default: { $action = "default"; }
}
}
if($action == "add") {
if(isset($_POST["submit_news"])) {
$title = pString($_POST["news_title"]);
$text = pString($_POST["news_text"]);
$image = pString($_POST["news_img"]);
if(strlen($title) > 0 AND strlen($text) > 0 AND strlen($image) > 0) {
mysql_query("INSERT INTO cms_articles (title, text, time, author, img) VALUES ('".$title."', '".$text."', '".time()."', '".userInfo(protect($_SESSION["login_username"]), "username")."', '".$image."');");
header("Location: admin.php?p=news");
} else {
$err = true;
$msg = "Alle Felder sind erforderlich.";
}
}
} elseif($action == "edit") {
if(isset($_POST["edit_news"])) {
$title = pString($_POST["news_title"]);
$text = pString($_POST["news_text"]);
$image = pString($_POST["news_img"]);
if(strlen($title) > 0 AND strlen($text) > 0 AND strlen($image) > 0) {
mysql_query("UPDATE cms_articles SET title = '".$title."', text = '".$text."', img = '".$image."' WHERE id = '".protect($_GET["id"])."'");
$msg = "News erfolgreich gespeichert.";
} else {
$err = true;
$msg = "Alle Felder sind erforderlich.";
}
}
}
?>
<div class="row">
<div class="col-lg-12">
<h1>Panel <small> Neuigkeiten</small></h1>
<?php
switch($action) {
case "add": {
?>
<ol class="breadcrumb">
<li><a href="<?php echo cmsSettings("site_url"); ?>admin"><i class="icon-dashboard"></i> Panel</a></li>
<li><a href="<?php echo cmsSettings("site_url"); ?>admin?p=news"><i class="icon-dashboard"></i> Neuigkeiten</a></li>
<li class="active"><i class="icon-file-alt"></i> Artikel schreiben</li>
</ol>
<?php break;
}
case "edit": {
?>
<ol class="breadcrumb">
<li><a href="<?php echo cmsSettings("site_url"); ?>admin"><i class="icon-dashboard"></i> Panel</a></li>
<li><a href="<?php echo cmsSettings("site_url"); ?>admin?p=news"><i class="icon-dashboard"></i> Neuigkeiten</a></li>
<li class="active"><i class="icon-file-alt"></i> Artikel bearbeiten</li>
</ol>
<?php break;
}
default: {
?>
<ol class="breadcrumb">
<li><a href="<?php echo cmsSettings("site_url"); ?>admin"><i class="icon-dashboard"></i> Panel</a></li>
<li class="active"><i class="icon-file-alt"></i> Neuigkeiten</li>
</ol>
<?php
}
}
?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<?php if(isset($msg)) { ?>
<div class="alert alert-<?php if($err) { echo "danger"; } else { echo "success"; } ?> alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<?php echo $msg; ?>
</div>
<?php } ?>
<?php if($action == "add") { ?>
<form role="form" method="post">
<div class="form-group">
<label>Titel</label>
<input type="text" class="form-control" name="news_title" placeholder="Titel..." />
</div>
<div class="form-group">
<label>Text</label>
<textarea type="text" class="form-control" name="news_text" placeholder="Text..."></textarea>
</div>
<div class="form-group">
<label>Top Story Bild</label>
<style type="text/css">
.hovero { width:300px; }
</style>
<select type="text" class="form-control" name="news_img">
<?php
$v = openDir("templates/default/img/news/");
while($file = readDir($v)) {
if ($file != "." && $file != ".." && $file != "index.php") {
//for($file = 1; $file < 62; $file++) {
?>
<option class="hovero" style="background: url('<?php echo cmsSettings("topstorys")."/".$file; ?>') no-repeat;height:182px;" name="<?php echo $file; ?>"><?php echo str_replace(".png", null, $file); ?></option>
<?php
}
}
//}
?>
</select>
</div>
<input type="submit" name="submit_news" value="<?php echo $lng["save"]; ?>" class="form-control" />
</form>
<?php } elseif($action == "edit") {
$qsq = mysql_query("SELECT * FROM cms_articles WHERE id = '".protect($_GET["id"])."' LIMIT 1");
if(mysql_num_rows($qsq) == 0) { header("Location: admin.php?p=news"); exit(); }
$aa = mysql_fetch_object($qsq);
?>
<form role="form" method="post">
<div class="form-group">
<label>Titel</label>
<input type="text" class="form-control" name="news_title" value="<?php echo $aa->title; ?>" placeholder="Titel..." />
</div>
<div class="form-group">
<label>Text</label>
<textarea type="text" class="form-control" name="news_text" placeholder="Text..."><?php echo $aa->text; ?></textarea>
</div>
<div class="form-group">
<label>Top Story Bild</label>
<style type="text/css">
.hovero { width:300px; }
</style>
<select type="text" class="form-control" name="news_img">
<?php
for($file = 1; $file < 62; $file++) {
?>
<option class="hovero" style="background: url('<?php echo cmsSettings("topstorys")."/".$file.".png"; ?>') no-repeat;height:182px;" name="<?php echo $file; ?>" <?php if($aa->img == $file) { echo "selected"; } ?>><?php echo $file; ?></option>
<?php
}
?>
</select>
</div>
<input type="submit" name="edit_news" value="<?php echo $lng["save"]; ?>" class="form-control" />
</form>
<?php }else { ?>
<a href="<?php echo cmsSettings("site_url"); ?>admin.php?p=news&action=add">Artikel schreiben</a>
<table class="table table-striped">
<thead>
<tr>
<td>ID</td>
<td>Titel</td>
<td>Aktion</td>
<tr>
</thead>
<tbody>
<?php
$article = mysql_query("SELECT * FROM cms_articles ORDER BY id DESC");
if(mysql_num_rows($article) == 0)
{
echo "<tr><td colspan='5'>Es wurden noch keine Neuigkeiten geschrieben.</td></tr>";
} else {
while($row = mysql_fetch_object($article))
{
?>
<tr id="article_<?php echo protect($row->id); ?>">
<td><?php echo $row->id; ?></td>
<td><?php echo $row->title; ?></td>
<td><?php echo '<a rel="tooltip" title="'.$lng["edit"].'" href="'.cmsSettings("site_url").'admin.php?p=news&action=edit&id='.$row->id.'"><i class="fa fa-pencil"></i></a> <a rel="tooltip" title="'.$lng["delete"].'" href="#" onClick="adm_news_delete('.$row->id.');"><i class="fa fa-times"></i></a>'; ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php } ?>
</div>
</div>
Alles anzeigen