Początkujący
Postów: 143 Pomógł: 3 Ostrzeżeń: 5
Data rejestracji: 01.10.2009 00:04
|
Witam wszystkich i proszę o pomoc w zmianie domyślnego wyglądu Newsów w Panelu na stronie news.php
Zacznę od początku co do tej poru udało mi się zrobić.
Więc utworzyłem nowe pole w pliku administration/news.php nowy wygląd to :
Jak widać dodano nowe pole news_obrazek w tym polu zapisywany jest adres do obrazka.
Nowy panel Newsów maiłby wyglądać tak:
I właśnie nie wiem jak to zrobić żeby mniej więcej tak wyglądało jak na rysunku powyżej.
Właśnie ten panel miałby przejść mały lifting.
Po kliknięciu na czytaj więcej miała by się wyświetlić strona o standardowym wyglądzie czyli:
Wiem, że trzeba zmodyfikować plik news.php ale próbuje to zrobić od dłuższego czasu ale nie potrafię proszę o pomoc będę bardzo wdzięczy.
Mój polik news.php wygląda następująco:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: news.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
// Predefined variables, do not edit these values
if ($settings['news_style'] == "1") { $i = 0; $rc = 0; $ncount = 1; $ncolumn = 1; $news_[0] = ""; $news_[1] = ""; $news_[2] = ""; } else { $i = 1; }
// Number of news displayed
$items_per_page = $settings['newsperpage'];
add_to_title($locale['global_200'].$locale['global_077']);
if (!isset($_GET['readmore']) || !isnum($_GET['readmore'])) {
$rows = dbcount("(news_id)", DB_NEWS, groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_draft='0'");
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) { $_GET['rowstart'] = 0; }
if ($rows) {
$result = dbquery(
"SELECT tn.*, tc.*, user_id, user_name FROM ".DB_NEWS." tn
LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().") AND (news_end='0'||news_end>=".time().") AND news_draft='0'
ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",$items_per_page"
);
$numrows = dbrows($result);
if ($settings['news_style'] == "1") { $nrows = round((dbrows($result) - 1) / 2); }
while ($data = dbarray($result)) {
$news_cat_image = "";
$news_subject = "<a name='news_".$data['news_id']."' id='news_".$data['news_id']."'></a><a href='".FUSION_SELF."?readmore=".$data['news_id']."' class='capmain'>".stripslashes($data['news_subject'])."</a>";
if ($data['news_cat_image']) {
$news_cat_image = "<a href='news_cats.php?cat_id=".$data['news_cat_id']."'><img src='".get_image("nc_".$data['news_cat_name'])."' alt='".$data['news_cat_name']."' class='news-category' /></a>";
} else {
$news_cat_image = "";
}
$news_news = $data['news_breaks'] == "y" ? nl2br(stripslashes($data['news_news'])) : stripslashes($data['news_news']);
if ($news_cat_image != "") $news_news = $news_cat_image.$news_news;
$news_info = array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"news_link" => $data['news_link'],
"news_date" => $data['news_datestamp'],
"news_ext" => $data['news_extended'] ? "y" : "n",
"news_reads" => $data['news_reads'],
"news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='".$data['news_id']."'"),
"news_allow_comments" => $data['news_allow_comments']
);
if ($settings['news_style'] == "1") {
if ($rows <= 2 || $ncount == 1) {
$news_[0] .= "<table width='100%' cellpadding='0' cellspacing='0'>\n";
$news_[0] .= "<tr>\n<td class='tbl2'><strong>".$news_subject."</strong></td>\n</tr>\n";
$news_[0] .= "<tr>\n<td class='tbl1' style='text-align:justify'>".$news_news."</td>\n</tr>\n";
$news_[0] .= "<tr>\n<td align='center' class='tbl2'>\n";
$news_[0] .= "<span class='small2'>".THEME_BULLET." <a href='profile.php?lookup=".$news_info['user_id']."'>".$news_info['user_name']."</a> ".$locale['global_071'].showdate("longdate", $news_info['news_date'])." ·\n";
if ($news_info['news_ext'] == "y" || $news_info['news_allow_comments']) {
$news_[0] .= $news_info['news_ext'] == "y" ? "<a href='".FUSION_SELF."?readmore=".$news_info['news_id']."'>".$locale['global_072']."</a> ·\n" : "";
$news_[0] .= $news_info['news_allow_comments'] ? "<a href='".FUSION_SELF."?readmore=".$news_info['news_id']."'>".$news_info['news_comments'].($news_info['news_comments'] == 1 ? $locale['global_073b'] : $locale['global_073'])."</a> ·\n" : "";
$news_[0] .= $news_info['news_reads'].$locale['global_074']." ·\n";
}
$news_[0] .= "<a href='print.php?type=N&item_id=".$news_info['news_id']."'><img src='".get_image("printer")."' alt='".$locale['global_075']."' style='vertical-align:middle;border:0;' /></a>";
if (checkrights("N")) { $news_[0] .= " · <a href='".ADMIN."news.php".$aidlink."&action=edit&news_id=".$news_info['news_id']."'><img src='".get_image("edit")."' alt='".$locale['global_076']."' title='".$locale['global_076']."' style='vertical-align:middle;border:0;' /></a></span>\n"; } else { $news_[0] .= "</span>\n"; }
$news_[0] .= "</td>\n</tr>\n</table>\n";
if ($ncount != $rows) { $news_[0] .= "<div><img src='".get_image("blank")."' alt='' width='1' height='8' /></div>\n"; }
} else {
if ($i == $nrows && $ncolumn != 2) { $ncolumn = 2; $i = 0; }
$row_color = ($rc % 2 == 0 ? "tbl2" : "tbl1");
$news_[$ncolumn] .= "<table width='100%' cellpadding='0' cellspacing='0'>\n";
$news_[$ncolumn] .= "<tr>\n<td class='tbl2'><strong>".$news_subject."</strong></td>\n</tr>\n";
$news_[$ncolumn] .= "<tr>\n<td class='tbl1' style='text-align:justify'>".$news_news."</td>\n</tr>\n";
$news_[$ncolumn] .= "<tr>\n<td align='center' class='tbl2'>\n";
$news_[$ncolumn] .= "<span class='small2'>".THEME_BULLET." <a href='profile.php?lookup=".$news_info['user_id']."'>".$news_info['user_name']."</a> ".$locale['global_071'].showdate("longdate", $news_info['news_date']);
if ($news_info['news_ext'] == "y" || $news_info['news_allow_comments']) {
$news_[$ncolumn] .= "<br />\n";
$news_[$ncolumn] .= $news_info['news_ext'] == "y" ? "<a href='".FUSION_SELF."?readmore=".$news_info['news_id']."'>".$locale['global_072']."</a> ·\n" : "";
$news_[$ncolumn] .= $news_info['news_allow_comments'] ? "<a href='".FUSION_SELF."?readmore=".$news_info['news_id']."#comments'>".$news_info['news_comments'].($news_info['news_comments'] == 1 ? $locale['global_073b'] : $locale['global_073'])."</a> ·\n" : "";
$news_[$ncolumn] .= $news_info['news_reads'].$locale['global_074']." ·\n";
} else {
$news_[$ncolumn] .= " ·\n";
}
$news_[$ncolumn] .= "<a href='print.php?type=N&item_id=".$news_info['news_id']."'><img src='".get_image("printer")."' alt='".$locale['global_075']."' style='vertical-align:middle;border:0;' /></a>\n";
if (checkrights("N")) { $news_[$ncolumn] .= " · <a href='".ADMIN."news.php".$aidlink."&action=edit&news_id=".$news_info['news_id']."'><img src='".get_image("edit")."' alt='".$locale['global_076']."' title='".$locale['global_076']."' style='vertical-align:middle;border:0;' /></a></span>\n"; } else { $news_[$ncolumn] .= "</span>\n"; }
$news_[$ncolumn] .= "</td>\n</tr>\n</table>\n";
if ($ncolumn == 1 && $i < ($nrows - 1)) { $news_[$ncolumn] .= "<div><img src='".get_image("blank")."' alt='' width='1' height='8' /></div>\n"; }
if ($ncolumn == 2 && $i < (dbrows($result) - $nrows - 2)) { $news_[$ncolumn] .= "<div><img src='".get_image("blank")."' alt='' width='1' height='8' /></div>\n"; }
$i++; $rc++;
}
$ncount++;
} else {
echo "<!--news_prepost_".$i."-->\n";
$i++;
render_news($news_subject, $news_news, $news_info);
}
}
if ($settings['news_style'] == "1") {
opentable($locale['global_077']);
echo "<table cellpadding='0' cellspacing='0' style='width:100%'>\n<tr>\n<td colspan='3' style='width:100%'>\n";
echo $news_[0];
echo "</td>\n</tr>\n<tr>\n<td style='width:50%;vertical-align:top;'>\n";
echo $news_[1];
echo "</td>\n<td style='width:10px'><img src='".get_image("blank")."' alt='' width='10' height='1' /></td>\n<td style='width:50%;vertical-align:top;'>\n";
echo $news_[2];
echo "</td>\n</tr>\n</table>\n";
closetable();
}
if ($rows > $items_per_page) echo "<div align='center' style=';margin-top:5px;'>\n".makepagenav($_GET['rowstart'],$items_per_page,$rows,3)."\n</div>\n";
} else {
opentable($locale['global_077']);
echo "<div style='text-align:center'><br />\n".$locale['global_078']."<br /><br />\n</div>\n";
closetable();
}
} else {
include INCLUDES."comments_include.php";
include INCLUDES."ratings_include.php";
$result = dbquery(
"SELECT tn.*, user_id, user_name FROM ".DB_NEWS." tn
LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
WHERE news_id='".$_GET['readmore']."' AND news_draft='0'"
);
if (dbrows($result)!=0) {
$data = dbarray($result);
if (!iMEMBER && $data['news_cat']==1)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==2)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==3)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==4)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==5)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==6)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==7)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==8)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==9)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==10)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==11)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==12)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==13)
redirect ('alert.php');
if (!iMEMBER && $data['news_cat']==14)
redirect ('alert.php');
if (!checkgroup("1") && $data['news_cat']==15)
redirect ('alertvip.php');
if (checkgroup($data['news_visibility'])) {
$news_cat_image = "";
if (!isset($_POST['post_comment']) && !isset($_POST['post_rating'])) {
$result2 = dbquery("UPDATE ".DB_NEWS." SET news_reads=news_reads+1 WHERE news_id='".$_GET['readmore']."'");
$data['news_reads']++;
}
$news_subject = $data['news_subject'];
if ($data['news_cat']) {
$result2 = dbquery("SELECT * FROM ".DB_NEWS_CATS." WHERE news_cat_id='".$data['news_cat']."'");
if (dbrows($result2)) {
$data2 = dbarray($result2);
$news_cat_image = "<a href='news_cats.php?cat_id=".$data2['news_cat_id']."'><img src='".get_image("nc_".$data2['news_cat_name'])."' alt='".$data2['news_cat_name']."' class='news-category' /></a>";
}
}
$news_news = stripslashes($data['news_extended'] ? $data['news_extended'] : $data['news_news']);
if ($data['news_breaks'] == "y") { $news_news = nl2br($news_news); }
if ($news_cat_image != "") $news_news = $news_cat_image.$news_news;
$news_info = array(
"news_id" => $data['news_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"news_link" => $data['news_link'],
"news_date" => $data['news_datestamp'],
"news_ext" => "n",
"news_reads" => $data['news_reads'],
"news_comments" => dbcount("(comment_id)", DB_COMMENTS, "comment_type='N' AND comment_item_id='".$data['news_id']."'"),
"news_allow_comments" => $data['news_allow_comments']
);
add_to_title($locale['global_201'].$news_subject);
echo "<!--news_pre_readmore-->";
render_news($news_subject, $news_news, $news_info);
echo "<!--news_sub_readmore-->";
if ($data['news_allow_comments']) { showcomments("N", DB_NEWS, "news_id", $_GET['readmore'], FUSION_SELF."?readmore=".$_GET['readmore']); }
if ($data['news_allow_ratings']) { showratings("N", $_GET['readmore'], FUSION_SELF."?readmore=".$_GET['readmore']); }
} else {
redirect(FUSION_SELF);
}
} else {
redirect(FUSION_SELF);
}
}
require_once THEMES."templates/footer.php";
?>
Plik administration/news.php:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2008 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: news.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
require_once THEMES."templates/admin_header_mce.php";
include LOCALE.LOCALESET."admin/news.php";
if (!checkrights("N") || !defined("iAUTH") || $_GET['aid'] != iAUTH) { redirect("../index.php"); }
if ($settings['tinymce_enabled']) {
echo "<script language='javascript' type='text/javascript'>advanced();</script>\n";
} else {
require_once INCLUDES."html_buttons_include.php";
}
if (isset($_GET['status'])) {
if ($_GET['status'] == "sn") {
$message = $locale['410'];
} elseif ($_GET['status'] == "su") {
$message = $locale['411'];
} elseif ($_GET['status'] == "del") {
$message = $locale['412'];
}
if ($message) { echo "<div class='admin-message'>".$message."</div>\n"; }
}
if (isset($_POST['save'])) {
$news_subject = stripinput($_POST['news_subject']);
$news_cat = isnum($_POST['news_cat']) ? $_POST['news_cat'] : "0";
$body = addslash($_POST['body']);
$body3 = addslash($_POST['body3']);
$body4 = addslash($_POST['body4']);
if ($_POST['body2']) {
$body2 = addslash(preg_replace("(^<p>\s</p>$)", "", $_POST['body2']));
} else {
$body2 = "";
}
$news_start_date = 0; $news_end_date = 0;
if ($_POST['news_start']['mday']!="--" && $_POST['news_start']['mon']!="--" && $_POST['news_start']['year']!="----") {
$news_start_date = mktime($_POST['news_start']['hours'],$_POST['news_start']['minutes'],0,$_POST['news_start']['mon'],$_POST['news_start']['mday'],$_POST['news_start']['year']);
}
if ($_POST['news_end']['mday']!="--" && $_POST['news_end']['mon']!="--" && $_POST['news_end']['year']!="----") {
$news_end_date = mktime($_POST['news_end']['hours'],$_POST['news_end']['minutes'],0,$_POST['news_end']['mon'],$_POST['news_end']['mday'],$_POST['news_end']['year']);
}
$news_visibility = isnum($_POST['news_visibility']) ? $_POST['news_visibility'] : "0";
$news_draft = isset($_POST['news_draft']) ? "1" : "0";
$news_sticky = isset($_POST['news_sticky']) ? "1" : "0";
if ($settings['tinymce_enabled'] != 1) { $news_breaks = isset($_POST['line_breaks']) ? "y" : "n"; } else { $news_breaks = "n"; }
$news_comments = isset($_POST['news_comments']) ? "1" : "0";
$news_ratings = isset($_POST['news_ratings']) ? "1" : "0";
if (isset($_POST['news_id']) && isnum($_POST['news_id'])) {
if ($news_sticky == "1") { $result = dbquery("UPDATE ".DB_NEWS." SET news_sticky='0' WHERE news_sticky='1'"); }
$result = dbquery("UPDATE ".DB_NEWS." SET news_subject='$news_subject', news_cat='$news_cat', news_news='$body', news_extended='$body2', news_link='$body3', news_obrazek='$body4', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_end='$news_end_date', news_visibility='$news_visibility', news_draft='$news_draft', news_sticky='$news_sticky', news_allow_comments='$news_comments', news_allow_ratings='$news_ratings' WHERE news_id='".$_POST['news_id']."'");
redirect(FUSION_SELF.$aidlink."&status=su");
} else {
if ($news_sticky == "1") { $result = dbquery("UPDATE ".DB_NEWS." SET news_sticky='0' WHERE news_sticky='1'"); }
$result = dbquery("INSERT INTO ".DB_NEWS." (news_subject, news_cat, news_news, news_extended, news_link, news_obrazek, news_breaks, news_name, news_datestamp, news_start, news_end, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$body3', '$body4', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");
redirect(FUSION_SELF.$aidlink."&status=sn");
}
} else if (isset($_POST['delete']) && (isset($_POST['news_id']) && isnum($_POST['news_id']))) {
$result = dbquery("DELETE FROM ".DB_NEWS." WHERE news_id='".$_POST['news_id']."'");
$result = dbquery("DELETE FROM ".DB_COMMENTS." WHERE comment_item_id='".$_POST['news_id']."' and comment_type='N'");
$result = dbquery("DELETE FROM ".DB_RATINGS." WHERE rating_item_id='".$_POST['news_id']."' and rating_type='N'");
redirect(FUSION_SELF.$aidlink."&status=del");
} else {
if (isset($_POST['preview'])) {
$news_subject = stripinput($_POST['news_subject']);
$news_cat = isnum($_POST['news_cat']) ? $_POST['news_cat'] : "0";
$body = phpentities(stripslash($_POST['body']));
$body3 = phpentities(stripslash($_POST['body3']));
$body4 = phpentities(stripslash($_POST['body4']));
$bodypreview = str_replace("src='".str_replace("../", "", IMAGES_N), "src='".IMAGES_N, stripslash($_POST['body']));
if ($_POST['body2']) {
$body2 = phpentities(stripslash($_POST['body2']));
$body2preview = str_replace("src='".str_replace("../", "", IMAGES_N), "src='".IMAGES_N, stripslash($_POST['body2']));
} else {
$body2 = "";
}
if (isset($_POST['line_breaks'])) {
$news_breaks = " checked='checked'";
$bodypreview = nl2br($bodypreview);
if ($body2) { $body2preview = nl2br($body2preview); }
} else {
$news_breaks = "";
}
$news_start = array(
"mday" => isnum($_POST['news_start']['mday']) ? $_POST['news_start']['mday'] : "--",
"mon" => isnum($_POST['news_start']['mon']) ? $_POST['news_start']['mon'] : "--",
"year" => isnum($_POST['news_start']['year']) ? $_POST['news_start']['year'] : "----",
"hours" => isnum($_POST['news_start']['hours']) ? $_POST['news_start']['hours'] : "0",
"minutes" => isnum($_POST['news_start']['minutes']) ? $_POST['news_start']['minutes'] : "0",
);
$news_end = array(
"mday" => isnum($_POST['news_end']['mday']) ? $_POST['news_end']['mday'] : "--",
"mon" => isnum($_POST['news_end']['mon']) ? $_POST['news_end']['mon'] : "--",
"year" => isnum($_POST['news_end']['year']) ? $_POST['news_end']['year'] : "----",
"hours" => isnum($_POST['news_end']['hours']) ? $_POST['news_end']['hours'] : "0",
"minutes" => isnum($_POST['news_end']['minutes']) ? $_POST['news_end']['minutes'] : "0",
);
$news_visibility = isnum($_POST['news_visibility']) ? $_POST['news_visibility'] : "0";
$news_draft = isset($_POST['news_draft']) ? " checked='checked'" : "";
$news_sticky = isset($_POST['news_sticky']) ? " checked='checked'" : "";
$news_comments = isset($_POST['news_comments']) ? " checked='checked'" : "";
$news_ratings = isset($_POST['news_ratings']) ? " checked='checked'" : "";
opentable($news_subject);
echo "$bodypreview\n";
closetable();
if (isset($body2preview)) {
opentable($news_subject);
echo "$body2preview\n";
closetable();
}
}
$result = dbquery("SELECT * FROM ".DB_NEWS." ORDER BY news_draft DESC, news_datestamp DESC");
if (dbrows($result) != 0) {
$editlist = ""; $sel = "";
while ($data = dbarray($result)) {
if ((isset($_POST['news_id']) && isnum($_POST['news_id'])) || (isset($_GET['news_id']) && isnum($_GET['news_id']))) {
$news_id = isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'];
$sel = ($news_id == $data['news_id'] ? " selected='selected'" : "");
}
$editlist .= "<option value='".$data['news_id']."'$sel>".($data['news_draft'] ? $locale['438']." " : "").$data['news_subject']."</option>\n";
}
opentable($locale['400']);
echo "<div style='text-align:center'>\n<form name='selectform' method='post' action='".FUSION_SELF.$aidlink."&action=edit'>\n";
echo "<select name='news_id' class='textbox' style='width:250px'>\n".$editlist."</select>\n";
echo "<input type='submit' name='edit' value='".$locale['420']."' class='button' />\n";
echo "<input type='submit' name='delete' value='".$locale['421']."' onclick='return DeleteNews();' class='button' />\n";
echo "</form>\n</div>\n";
closetable();
}
if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_POST['news_id']) && isnum($_POST['news_id'])) || (isset($_GET['news_id']) && isnum($_GET['news_id']))) {
$result = dbquery("SELECT * FROM ".DB_NEWS." WHERE news_id='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."'");
if (dbrows($result)) {
$data = dbarray($result);
$news_subject = $data['news_subject'];
$news_cat = $data['news_cat'];
$body = phpentities(stripslashes($data['news_news']));
$body2 = phpentities(stripslashes($data['news_extended']));
$body3 = phpentities(stripslashes($data['news_link']));
$body4 = phpentities(stripslashes($data['news_obrazek']));
if ($data['news_start'] > 0) $news_start = getdate($data['news_start']);
if ($data['news_end'] > 0) $news_end = getdate($data['news_end']);
$news_visibility = $data['news_visibility'];
$news_draft = $data['news_draft'] == "1" ? " checked='checked'" : "";
$news_sticky = $data['news_sticky'] == "1" ? " checked='checked'" : "";
$news_breaks = $data['news_breaks'] == "y" ? " checked='checked'" : "";
$news_comments = $data['news_allow_comments'] == "1" ? " checked='checked'" : "";
$news_ratings = $data['news_allow_ratings'] == "1" ? " checked='checked'" : "";
} else {
redirect(FUSION_SELF.$aidlink);
}
}
if ((isset($_POST['news_id']) && isnum($_POST['news_id'])) || (isset($_GET['news_id']) && isnum($_GET['news_id']))) {
opentable($locale['402']);
} else {
if (!isset($_POST['preview'])) {
$news_subject = "";
$news_cat = "0";
$body = "";
$body2 = "";
$body3 = "";
$body4 = "";
$news_visibility = 0;
$news_draft = "";
$news_sticky = "";
$news_breaks = " checked='checked'";
$news_comments = " checked='checked'";
$news_ratings = " checked='checked'";
}
opentable($locale['401']);
}
$result = dbquery("SELECT * FROM ".DB_NEWS_CATS." ORDER BY news_cat_name");
$news_cat_opts = ""; $sel = "";
if (dbrows($result)) {
while ($data = dbarray($result)) {
if (isset($news_cat)) $sel = ($news_cat == $data['news_cat_id'] ? " selected='selected'" : "");
$news_cat_opts .= "<option value='".$data['news_cat_id']."'$sel>".$data['news_cat_name']."</option>\n";
}
}
$visibility_opts = ""; $sel = "";
$user_groups = getusergroups();
while(list($key, $user_group) = each($user_groups)){
$sel = ($news_visibility == $user_group['0'] ? " selected='selected'" : "");
$visibility_opts .= "<option value='".$user_group['0']."'$sel>".$user_group['1']."</option>\n";
}
echo "<form name='inputform' method='post' action='".FUSION_SELF.$aidlink."' onsubmit='return ValidateForm(this);'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['422']."</td>\n";
echo "<td width='80%' class='tbl'><input type='text' name='news_subject' value='".$news_subject."' class='textbox' style='width: 250px' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td width='100' class='tbl'>".$locale['423']."</td>\n";
echo "<td width='80%' class='tbl'><select name='news_cat' class='textbox'>\n";
echo "<option value='0'>".$locale['424']."</option>\n".$news_cat_opts."</select></td>\n";
echo "</tr>\n<tr>\n";
echo "<tr>\n<td valign='top' class='tbl'>".$locale['439']."</td>\n";
echo "<td width='80%' class='tbl'><input type='text' name='body3' value='".$body3."' class='textbox' style='width: 250px' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<tr>\n<td valign='top' class='tbl'>".$locale['440']."</td>\n";
echo "<td width='80%' class='tbl'><input type='text' name='body4' value='".$body4."' class='textbox' style='width: 250px' /></td>\n";
echo "</tr>\n<tr>\n";
echo "<td valign='top' width='100' class='tbl'>".$locale['425']."</td>\n";
echo "<td width='80%' class='tbl'><textarea name='body' cols='95' rows='10' class='textbox' style='width:98%'>".$body."</textarea></td>\n";
echo "</tr>\n";
if (!$settings['tinymce_enabled']) {
echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";
echo display_html("inputform", "body", true, true, true, IMAGES_N);
echo "</td>\n</tr>\n";
}
echo "<tr>\n<td valign='top' width='100' class='tbl'>".$locale['426']."</td>\n";
echo "<td class='tbl'><textarea name='body2' cols='95' rows='10' class='textbox' style='width:98%'>".$body2."</textarea></td>\n";
echo "</tr>\n";
if ($settings['tinymce_enabled'] != 1) {
echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>\n";
echo display_html("inputform", "body2", true, true, true, IMAGES_N);
echo "</td>\n</tr>\n";
}
echo "</tr>\n";
echo "<td class='tbl'>".$locale['427']."</td>\n";
echo "<td class='tbl'><select name='news_start[mday]' class='textbox'>\n<option>--</option>\n";
for ($i=1;$i<=31;$i++) echo "<option".(isset($news_start['mday']) && $news_start['mday'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> <select name='news_start[mon]' class='textbox'>\n<option>--</option>\n";
for ($i=1;$i<=12;$i++) echo "<option".(isset($news_start['mon']) && $news_start['mon'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> <select name='news_start[year]' class='textbox'>\n<option>----</option>\n";
for ($i=2004;$i<=2020;$i++) echo "<option".(isset($news_start['year']) && $news_start['year'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> / <select name='news_start[hours]' class='textbox'>\n";
for ($i=0;$i<=24;$i++) echo "<option".(isset($news_start['hours']) && $news_start['hours'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> : <select name='news_start[minutes]' class='textbox'>\n";
for ($i=0;$i<=60;$i++) echo "<option".(isset($news_start['minutes']) && $news_start['minutes'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> : 00 ".$locale['429']."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['428']."</td>\n";
echo "<td class='tbl'><select name='news_end[mday]' class='textbox'>\n<option>--</option>\n";
for ($i=1;$i<=31;$i++) echo "<option".(isset($news_end['mday']) && $news_end['mday'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> <select name='news_end[mon]' class='textbox'>\n<option>--</option>\n";
for ($i=1;$i<=12;$i++) echo "<option".(isset($news_end['mon']) && $news_end['mon'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> <select name='news_end[year]' class='textbox'>\n<option>----</option>\n";
for ($i=2004;$i<=2010;$i++) echo "<option".(isset($news_end['year']) && $news_end['year'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> / <select name='news_end[hours]' class='textbox'>\n";
for ($i=0;$i<=24;$i++) echo "<option".(isset($news_end['hours']) && $news_end['hours'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> : <select name='news_end[minutes]' class='textbox'>\n";
for ($i=0;$i<=60;$i++) echo "<option".(isset($news_end['minutes']) && $news_end['minutes'] == $i ? " selected='selected'" : "").">$i</option>\n";
echo "</select> : 00 ".$locale['429']."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'>".$locale['430']."</td>\n";
echo "<td class='tbl'><select name='news_visibility' class='textbox'>\n".$visibility_opts."</select></td>\n";
echo "</tr>\n<tr>\n";
echo "<td class='tbl'></td><td class='tbl'>\n";
echo "<label><input type='checkbox' name='news_draft' value='yes'".$news_draft." /> ".$locale['431']."</label><br />\n";
echo "<label><input type='checkbox' name='news_sticky' value='yes'".$news_sticky." /> ".$locale['432']."</label><br />\n";
if ($settings['tinymce_enabled'] != 1) {
echo "<label><input type='checkbox' name='line_breaks' value='yes'".$news_breaks." /> ".$locale['433']."</label><br />\n";
}
echo "<label><input type='checkbox' name='news_comments' value='yes' onclick='SetRatings();'".$news_comments." /> ".$locale['434']."</label><br />\n";
echo "<label><input type='checkbox' name='news_ratings' value='yes'".$news_ratings." /> ".$locale['435']."</label></td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' colspan='2' class='tbl'><br />\n";
if ((isset($_POST['edit']) && (isset($_POST['news_id']) && isnum($_POST['news_id']))) || (isset($_POST['preview']) && (isset($_POST['news_id']) && isnum($_POST['news_id']))) || (isset($_GET['news_id']) && isnum($_GET['news_id']))) {
echo "<input type='hidden' name='news_id' value='".(isset($_POST['news_id']) ? $_POST['news_id'] : $_GET['news_id'])."' />\n";
}
echo "<input type='submit' name='preview' value='".$locale['436']."' class='button' />\n";
echo "<input type='submit' name='save' value='".$locale['437']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
closetable();
echo "<script type='text/javascript'>\n"."function DeleteNews() {\n";
echo "return confirm('".$locale['451']."');\n}\n";
echo "function ValidateForm(frm) {\n"."if(frm.news_subject.value=='') {\n";
echo "alert('".$locale['450']."');\n"."return false;\n}\n}\n";
echo "function SetRatings() {\n"."if (inputform.news_comments.checked == false) {\n";
echo "inputform.news_ratings.checked = false;\n"."inputform.news_ratings.disabled = true;\n";
echo "} else {\n"."inputform.news_ratings.disabled = false;\n}\n}\n</script>\n";
}
require_once THEMES."templates/footer.php";
?>
Dziękuję z góry.
Edytowane przez Pieka dnia 15.03.2011 20:34:33
Jeśli pomogłem kliknij:
|
Początkujący
Postów: 143 Pomógł: 3 Ostrzeżeń: 5
Data rejestracji: 01.10.2009 00:04
|
Oczywiście plik themes.php
<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
define("THEME_BULLET", "<span class='bullet'>·</span>");
require_once INCLUDES."theme_functions_include.php";
function render_page($license=false) {
global $settings, $main_style, $locale;
//Header
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='full-header'>\n".showbanners()."</td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='sub-header-left'></td>\n";
echo "<td class='sub-header'>".showsublinks(" ".THEME_BULLET." ", "white")."</td>\n";
echo "<td align='right' class='sub-header'>".showsubdate()."</td>\n";
echo "<td class='sub-header-right'></td>\n";
echo "</tr>\n</table>\n";
//Content
echo "<table cellpadding='0' cellspacing='0' width='100%' class='$main_style'>\n<tr>\n";
if (LEFT) { echo "<td class='side-border-left' valign='top'>".LEFT."</td>"; }
echo "<td class='main-bg' valign='top'>".U_CENTER.CONTENT.L_CENTER."</td>";
if (RIGHT) { echo "<td class='side-border-right' valign='top'>".RIGHT."</td>"; }
echo "</tr>\n</table>\n";
//Footer
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='sub-header-left'></td>\n";
echo "<td align='left' class='sub-header'>".sprintf($locale['global_172'], substr((get_microtime() - START_TIME),0,4))."</td>\n";
echo "<td align='right' class='sub-header'>".showcounter()."</td>\n";
echo "<td class='sub-header-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td align='center' class='main-footer'>".stripslashes($settings['footer']);
if (!$license) { echo "<br /><br />\n".showcopyright(); }
echo "</td>\n";
echo "</tr>\n</table>\n";
}
function render_news($subject, $news, $info) {
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$subject."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' class='spacer'>\n<tr>\n";
echo "<td class='main-body middle-border'>".$news."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' class='news-footer middle-border'>\n";
echo newsposter($info," ·").newsopts($info,"·").itemoptions("N",$info['news_id']);
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#f6a504;'></td>\n";
echo "</tr>\n</table>\n";
}
function render_article($subject, $article, $info) {
echo "<table width='100%' cellpadding='0' cellspacing='0'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$subject."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table width='100%' cellpadding='0' cellspacing='0' class='spacer'>\n<tr>\n";
echo "<td class='main-body middle-border'>".($info['article_breaks'] == "y" ? nl2br($article) : $article)."</td>\n";
echo "</tr>\n<tr>\n";
echo "<td align='center' class='news-footer'>\n";
echo articleposter($info," ·").articleopts($info,"·").itemoptions("A",$info['article_id']);
echo "</td>\n</tr>\n</table>\n";
}
function opentable($title) {
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='capmain-left'></td>\n";
echo "<td class='capmain'>".$title."</td>\n";
echo "<td class='capmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";
echo "<td class='main-body'>\n";
}
function closetable() {
echo "</td>\n";
echo "</tr><tr>\n";
echo "<td style='height:5px;background-color:#f6a504;'></td>\n";
echo "</tr>\n</table>\n";
}
function openside($title, $collapse = false, $state = "on") {
global $panel_collapse; $panel_collapse = $collapse;
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
echo "<td class='scapmain-left'></td>\n";
echo "<td class='scapmain'>$title</td>\n";
if ($collapse == true) {
$boxname = str_replace(" ", "", $title);
echo "<td class='scapmain' align='right'>".panelbutton($state, $boxname)."</td>\n";
}
echo "<td class='scapmain-right'></td>\n";
echo "</tr>\n</table>\n";
echo "<table cellpadding='0' cellspacing='0' width='100%' class='spacer'>\n<tr>\n";
echo "<td class='side-body'>\n";
if ($collapse == true) { echo panelstate($state, $boxname); }
}
function closeside() {
global $panel_collapse;
if ($panel_collapse == true) { echo "</div>\n"; }
echo "</td>\n</tr>\n</table>\n";
}
?>
Ale wydaje mi się ze nie trzeba nic zmieniać w tym pliku ale sam zobacz :)
Edytowane przez ArkaGdynia dnia 05.04.2010 12:33:18
Jeśli pomogłem kliknij:
|