Zajawka: newsy, artykuły, linki itd. (dodany plik)
|
djdandi |
Dodany dnia 17.11.2011 21:33:06
|
Początkujący
Postów: 164 Pomógł: 1 Ostrzeżeń: 5
v7.02.04 Data rejestracji: 05.11.2007 14:14
|
Witam staram się zrobić coś co nazywa się zajawka, która służy do wyświetlania na stronie głównej w odpowiednim miejscu tytuły (newsów, artykułów i wszystkiego innego dodanego na stronie) pod spodem link Czytaj więcej - który oczywiście przenosi do odpowiedniej frazy.
Co udało mi się zrobić.
Udało mi się dodać do bazy danych tabelę zajawka_linki (coś na zasadzie site_links)
Dodałem do PA w dziale Zarządzanie treścią zakładkę Zajawka.
Do pliku zajawka dodałem funkcje aby wywoływały ostatnie artykuły i newsy.
Załączam grafikę jak to teraz wygląda.
Teraz problemy:
Nie mogę za nic dodać funkcji aby można było edytować poszczególne dane (artykuły, newsy...)
Nie mogę zrobić aby zapisywało mi te dane do odpowiedniej tabeli o której wspominałem wyżej.
Na koniec jak potem zrobić aby odczytywało mi to co jest zaznaczona (Umieść w zajawce) na stronie w pliku np. zajawki.php
Mam nadzieję że w miarę wytłumaczyłem mój problem, proszę administracje o pozostawienie tego tematu.
W razie czego proszę o zmianę mojej treści tematu jeśli coś będzie z nią nie tak - z góry dziękuję.
Załączam jeszcze plik który wyświetla to co jest na obrazku w PA.
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: weblinks.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";
if (!checkrights("W") || !defined("iAUTH") || !isset($_GET['aid']) || $_GET['aid'] != iAUTH) redirect("../index.php");
require_once THEMES."templates/admin_header.php";
require_once INCLUDES."html_buttons_include.php";
include LOCALE.LOCALESET."admin/zajawka.php";
// Set number of articles to display
$limit = "100";
if (!file_exists(INFUSIONS."enhanced_user_info_panel/eui.js")) {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_articles_panel/eap.js'></script>");
} else {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_user_info_panel/eui.js'></script>");
}
if ((isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['link_id']) && isnum($_GET['link_id']))) {
$data = dbarray(dbquery("SELECT link_order FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'"));
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET link_order=link_order-1 WHERE link_order>'".$data['link_order']."'");
$result = dbquery("DELETE FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'");
redirect(FUSION_SELF.$aidlink."&status=del");
}elseif (isset($_POST['savelink']))
if (dbrows($result)) {
$data = dbarray($result);
$link_name = $data['link_name'];
$link_url = $data['link_url'];
$link_visibility = $data['link_visibility'];
$link_order = $data['link_order'];
$pos1_check = ($data['link_position']=="1" ? " checked='checked'" : "");
$pos2_check = ($data['link_position']=="2" ? " checked='checked'" : "");
$window_check = ($data['link_window']=="1" ? " checked='checked'" : "");
opentable($locale['401']);
} else {
redirect(FUSION_SELF.$aidlink);
}
{
$link_name = "";
$link_url = "";
$link_visibility = "";
$link_order = "";
$pos1_check = " checked='checked'";
$pos2_check = "";
$window_check = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['400']);
}
// Latest Articles
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_datestamp DESC LIMIT 0,$limit");
echo "<div class='side-label eui_master_head' style='margin-bottom:1px' title='".$locale['401']."'>".$locale['401']."</div>\n";
echo "<div class='eui_master_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['413']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
// Articles by views
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, ta.article_reads, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_reads DESC LIMIT 0,$limit");
echo "<div class='side-label eui_head' style='margin-bottom:1px' title='".$locale['402']."'>".$locale['402']."</div>\n";
echo "<div class='eui_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$title = ($locale['eap_104'].$data['article_reads'].$locale['eap_105']);
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$title."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='edit' value='".$locale['413']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
closetable();
///////////////////////////////////////////////////////////////////
opentable($locale['403']);
$result = dbquery(
"SELECT tn.*, tc.* FROM ".DB_NEWS." tn
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 0,55");
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['news_subject'], 53);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='edit' value='".$locale['413']."' class='button' /></td>\n";
echo "</td>\n";
echo "</tr>\n</table>\n</form>\n";
}
} else {
echo "<div style='text-align:center'>Brak</div>\n";
}
closetable();
require_once THEMES."templates/footer.php";
?>
W załączniku dodałem pliki instalacyjne wtyczki.
Nadal nie działa dodawanie tematów newsów do bazy danych oraz wyświetlanie ich w zajawce, dlatego proszę o pomoc.
djdandi dodał/a następującą plik:
Edytowane przez djdandi dnia 19.11.2011 16:19:46
|
|
|
|
Wścibski Gość |
Dodany dnia 23.12.2024 14:20:37
|
Pan Kontekstualny
Postów: n^x
Data rejestracji: Zawsze
|
|
IP: localhost |
|
|
Drecha |
Dodany dnia 17.11.2011 22:22:50
|
Bywalec
Postów: 749 Pomógł: 28 Ostrzeżeń: 1
v7.02.07 Data rejestracji: 30.01.2009 17:11
|
Trochę logicznego myślenia, zajrzyj na początek do plików odpowiedzialnych za dodawanie i edytowanie newsów, artykułów itd, może one Ci coś podpowiedzą |
|
|
|
djdandi |
Dodany dnia 17.11.2011 22:39:11
|
Początkujący
Postów: 164 Pomógł: 1 Ostrzeżeń: 5
v7.02.04 Data rejestracji: 05.11.2007 14:14
|
Zaglądałem zmieniałem, dodawałem kilka funkcji z stamtąd ale nic to nie dało nie wiem jak to ugryźć.
|
|
|
|
Drecha |
Dodany dnia 17.11.2011 22:47:38
|
Bywalec
Postów: 749 Pomógł: 28 Ostrzeżeń: 1
v7.02.07 Data rejestracji: 30.01.2009 17:11
|
O ile dobrze widzę, to za aktualizowanie tabeli newsów odpowiada fragment w linii około 159:
$result = dbquery("UPDATE ".DB_NEWS." SET news_subject='$news_subject', news_cat='$news_cat', news_end='$news_end_date', news_image='$news_image', news_news='$body', news_extended='$body2', news_breaks='$news_breaks',".($news_start_date != 0 ? " news_datestamp='$news_start_date'," : "")." news_start='$news_start_date', news_image_t1='$news_image_t1', news_image_t2='$news_image_t2', 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']."'");
|
|
|
|
djdandi |
Dodany dnia 18.11.2011 08:27:59
|
Początkujący
Postów: 164 Pomógł: 1 Ostrzeżeń: 5
v7.02.04 Data rejestracji: 05.11.2007 14:14
|
Być może ale gdzie to dodać i jak pozmieniać aby zapisywały się tylko tytuły i w odpowiedniej tabeli w bazie hmm.
Przerobiłem tą linię co podałeś dodałem ją do pliku zajawka.php w katalogu administrator ale nic się nie dzieje nie zapisuje danych do bazy danych.
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET news_subject='$link_name', WHERE link_id='".$_POST['link_id']."'");
Kliknij i zaczekaj na załadowanie kodu ...
Edytowane przez djdandi dnia 18.11.2011 11:12:15
|
|
|
|
Xerxes |
Dodany dnia 18.11.2011 17:53:34
|
Początkujący
Postów: 121 Pomógł: 4 Ostrzeżeń: 1
v7.02.07 Data rejestracji: 05.10.2010 18:24
|
Zdefiniowałeś DB_ZAJAWKA_LINKI ?
Usuń przecinek po news_subject='$link_name'
EDIT:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: weblinks.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";
if (!checkrights("W") || !defined("iAUTH") || !isset($_GET['aid']) || $_GET['aid'] != iAUTH) redirect("../index.php");
require_once THEMES."templates/admin_header.php";
require_once INCLUDES."html_buttons_include.php";
include LOCALE.LOCALESET."admin/zajawka.php";
// Set number of articles to display
$limit = "100";
if (!file_exists(INFUSIONS."enhanced_user_info_panel/eui.js")) {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_articles_panel/eap.js'></script>");
} else {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_user_info_panel/eui.js'></script>");
}
if ((isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['link_id']) && isnum($_GET['link_id']))) {
$data = dbarray(dbquery("SELECT link_order FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'"));
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET link_order=link_order-1 WHERE link_order>'".$data['link_order']."'");
$result = dbquery("DELETE FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'");
redirect(FUSION_SELF.$aidlink."&status=del");
}elseif (isset($_POST['savelink']))
if (dbrows($result)) {
$data = dbarray($result);
$link_name = $data['link_name'];
$link_url = $data['link_url'];
$link_visibility = $data['link_visibility'];
$link_order = $data['link_order'];
$pos1_check = ($data['link_position']=="1" ? " checked='checked'" : "");
$pos2_check = ($data['link_position']=="2" ? " checked='checked'" : "");
$window_check = ($data['link_window']=="1" ? " checked='checked'" : "");
opentable($locale['401']);
} else {
redirect(FUSION_SELF.$aidlink);
}
{
$link_name = "";
$link_url = "";
$link_visibility = "";
$link_order = "";
$pos1_check = " checked='checked'";
$pos2_check = "";
$window_check = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['400']);
}
// Latest Articles
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_datestamp DESC LIMIT 0,$limit");
echo "<div class='side-label eui_master_head' style='margin-bottom:1px' title='".$locale['401']."'>".$locale['401']."</div>\n";
echo "<div class='eui_master_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['413']."' class='button' /></td>\n";
echo "</tr>\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
// Articles by views
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, ta.article_reads, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_reads DESC LIMIT 0,$limit");
echo "<div class='side-label eui_head' style='margin-bottom:1px' title='".$locale['402']."'>".$locale['402']."</div>\n";
echo "<div class='eui_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$title = ($locale['eap_104'].$data['article_reads'].$locale['eap_105']);
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$title."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<a href='article.php?$aidlink&action=edit&article_id=".$data['article_id']."'>".$locale['413']."</a></td>\n";
echo "</tr>\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
closetable();
///////////////////////////////////////////////////////////////////
opentable($locale['403']);
$result = dbquery(
"SELECT tn.*, tc.* FROM ".DB_NEWS." tn
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 0,55");
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['news_subject'], 53);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label><hr />\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<a href='news.php?$aidlink&action=edit&news_id=".$data['news_id']."'>".$locale['413']."</a></td>\n";
echo "</td>\n";
echo "</tr>\n</table>\n</form>\n";
}
} else {
echo "<div style='text-align:center'>Brak</div>\n";
}
closetable();
require_once THEMES."templates/footer.php";
?>
Masz kod gdzie można edytować artykuły i newsy. Nie sprawdzałem czy działa ale myślę, że powinno. Zamiast inputu masz link ale to nie problem żeby graficznie wyglądał identycznie.
Edytowane przez Xerxes dnia 18.11.2011 18:26:41
|
|
|
|
djdandi |
Dodany dnia 18.11.2011 18:27:48
|
Początkujący
Postów: 164 Pomógł: 1 Ostrzeżeń: 5
v7.02.04 Data rejestracji: 05.11.2007 14:14
|
W bazie zdefiniowałem ZAJAWKA_LINKI
Dodałem do pliku administration/zajawka.php:
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET news_subject='$link_name' WHERE link_id='".$_POST['link_id']."'");
Kliknij i zaczekaj na załadowanie kodu ...
Ale teraz jest błąd i nie wyświetlają się linki do newsów:
Table 'modrylas.db_zajawka_linki' doesn't exist
Teraz cały plik wygląda tak.
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fu...
+--------------------------------------------------------+
| Filename: weblinks.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 www.gnu.org/licen... Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
if (!checkrights("W") || !defined("iAUTH") || !isset($_GET['aid']) || $_GET['aid'] != iAUTH) redirect("../index.php");
require_once THEMES."templates/admin_header.php";
require_once INCLUDES."html_buttons_include.php";
include LOCALE.LOCALESET."admin/zajawka.php";
// Set number of articles to display
$limit = "100";
if (!file_exists(INFUSIONS."enhanced_user_info_panel/eui.js")) {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_articles_panel/eap.js'></script>");
} else {
add_to_head("<script type='text/javascript' src='".INFUSIONS."enhanced_user_info_panel/eui.js'></script>");
}
if ((isset($_GET['action']) && $_GET['action'] == "delete") && (isset($_GET['link_id']) && isnum($_GET['link_id']))) {
$data = dbarray(dbquery("SELECT link_order FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'"));
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET link_order=link_order-1 WHERE link_order>'".$data['link_order']."'");
$result = dbquery("DELETE FROM ".DB_ZAJAWKA_LINKI." WHERE link_id='".$_GET['link_id']."'");
redirect(FUSION_SELF.$aidlink."&status=del");
}elseif (isset($_POST['savelink']))
if (dbrows($result)) {
$data = dbarray($result);
$link_name = $data['link_name'];
$link_url = $data['link_url'];
$link_visibility = $data['link_visibility'];
$link_order = $data['link_order'];
$pos1_check = ($data['link_position']=="1" ? " checked='checked'" : "");
$pos2_check = ($data['link_position']=="2" ? " checked='checked'" : "");
$window_check = ($data['link_window']=="1" ? " checked='checked'" : "");
opentable($locale['401']);
} else {
redirect(FUSION_SELF.$aidlink);
}
{
$link_name = "";
$link_url = "";
$link_visibility = "";
$link_order = "";
$pos1_check = " checked='checked'";
$pos2_check = "";
$window_check = "";
$formaction = FUSION_SELF.$aidlink;
opentable($locale['400']);
}
// Latest Articles
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_datestamp DESC LIMIT 0,$limit");
echo "<div class='side-label eui_master_head' style='margin-bottom:1px' title='".$locale['401']."'>".$locale['401']."</div>\n";
echo "<div class='eui_master_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label>\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['413']."' class='button' /></td>\n";
echo "</tr><hr />\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
// Articles by views
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, ta.article_reads, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_reads DESC LIMIT 0,$limit");
echo "<div class='side-label eui_head' style='margin-bottom:1px' title='".$locale['402']."'>".$locale['402']."</div>\n";
echo "<div class='eui_body' style='margin-bottom:3px'>\n";
if (dbrows($result)) {
while($data = dbarray($result)) {
$title = ($locale['eap_104'].$data['article_reads'].$locale['eap_105']);
$itemsubject = trimlink($data['article_subject'], 63);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$title."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label>\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='savelink' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='edit' value='".$locale['413']."' class='button' /></td>\n";
echo "</tr><hr />\n</table>\n</form>\n";
}
echo "</div>\n";
} else {
echo "<div style='text-align:center'></div>\n";
}
closetable();
///////////////////////////////////////////////////////////////////
opentable($locale['403']);
//$result = dbquery("INSERT INTO ".DB_ZAJAWKA." (news_subject, news_cat, news_news, news_extended, news_breaks, news_name, news_datestamp, news_start, news_end, news_image, news_image_t1, news_image_t2, news_visibility, news_draft, news_sticky, news_reads, news_allow_comments, news_allow_ratings) VALUES ('$news_subject', '$news_cat', '$body', '$body2', '$news_breaks', '".$userdata['user_id']."', '".($news_start_date != 0 ? $news_start_date : time())."', '$news_start_date', '$news_end_date', '$news_image', '$news_image_t1', '$news_image_t2', '$news_visibility', '$news_draft', '$news_sticky', '0', '$news_comments', '$news_ratings')");
$result = dbquery(
"SELECT tn.*, tc.* FROM ".DB_NEWS." tn
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 0,55");
$result = dbquery("UPDATE ".DB_ZAJAWKA_LINKI." SET news_subject='$link_name', WHERE link_id='".$_POST['link_id']."'");
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['news_subject'], 53);
echo "<table cellpadding='0' cellspacing='0' >\n<tr><td class='left' width='58%'>\n";
echo THEME_BULLET." <a href='".BASEDIR."news.php?readmore=".$data['news_id']."' title='".$data['news_subject']."' class='side'>$itemsubject</a>\n";
echo "<form name='layoutform' method='post' action='".$formaction."'>\n";
echo "</td>\n";
echo "<td class='tbl' width='42%'><label><input type='radio' name='link_position' value='1'".$pos1_check." /> ".$locale['410']."</label>\n";
echo "<label><input type='radio' name='link_position' value='2'".$pos2_check." /> ".$locale['411']."</label>\n";
//echo "<label><input type='checkbox' name='link_window' value='1'".$window_check." /> ".$locale['428']."</label></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\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='save' value='".$locale['412']."' class='button' /></td>\n";
echo "<td align='center' colspan='2' class='tbl'>\n";
echo "<input type='submit' name='edit' value='".$locale['413']."' class='button' /></td>\n";
echo "</td>\n";
echo "</tr><hr />\n</table>\n</form>\n";
}
} else {
echo "<div style='text-align:center'>Brak</div>\n";
}
closetable();
require_once THEMES."templates/footer.php";
?> Kliknij i zaczekaj na załadowanie kodu ...
Edit: Sprawdziłem ale niestety nie działa tak jak powinno kiedy kliknę na [edytuj] przenosi mnie na stronę główną (news.php)
|
|
|