Przedszkolak
Postów: 41 Ostrzeżeń: 1
Data rejestracji: 02.06.2007 19:38
|
Pieka napisał/a:
1. Jedna z mozliwosci: http://www.php-fu...d_id=13481, wiecej nie bede za Ciebie szukal.
2. Nie, chodzi o odwolanie w pliku readarticle.php.
3. Absolutnie nie. Przeczytaj np. na Google, co robi FUSION_SELF.
Prawie śmiga, lecz pojawia się jeden błąd.
Mianowicie, pozmieniałem pliki w ten sposób (na próbę czy zadziała):
administration/slowo.php
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "../maincore.php";
require_once "subheader.php";
require_once ADMIN."navigation.php";
include LOCALE.LOCALESET."admin/news-articles.php";
if (!checkrights("A") || !defined("iAUTH") || $aid != iAUTH) fallback("../index.php");
if (isset($article_id) && !isNum($article_id)) fallback("index.php");
if ($settings['tinymce_enabled'] == 1) echo "<script type='text/javascript'>advanced();</script>\n";
if (isset($status)) {
if ($status == "su") {
$title = $locale['500'];
$message = "<b>".$locale['501']."</b>";
} elseif ($status == "sn") {
$title = $locale['504'];
$message = "<b>".$locale['505']."</b>";
} elseif ($status == "del") {
$title = $locale['506'];
$message = "<b>".$locale['507']."</b>";
}
opentable($title);
echo "<div align='center'>".$message."</div>\n";
closetable();
tablebreak();
}
$result = dbquery("SELECT * FROM ".$db_prefix."article_cats2");
if (dbrows($result) != 0) {
if (isset($_POST['save'])) {
$subject = stripinput($_POST['subject']);
$body = addslash($_POST['body']);
$body2 = addslash($_POST['body2']);
if ($settings['tinymce_enabled'] != 1) { $breaks = isset($_POST['line_breaks']) ? "y" : "n"; } else { $breaks = "n"; }
$comments = isset($_POST['article_comments']) ? "1" : "0";
$ratings = isset($_POST['article_ratings']) ? "1" : "0";
if (isset($article_id)) {
$result = dbquery("UPDATE ".$db_prefix."articles2 SET article_cat='".$_POST['article_cat']."', article_subject='$subject', article_snippet='$body', article_article='$body2', article_breaks='$breaks', article_allow_comments='$comments', article_allow_ratings='$ratings' WHERE article_id='$article_id'");
redirect(FUSION_SELF.$aidlink."&status=su");
} else {
$result = dbquery("INSERT INTO ".$db_prefix."articles2 (article_cat, article_subject, article_snippet, article_article, article_breaks, article_name, article_datestamp, article_reads, article_allow_comments, article_allow_ratings) VALUES ('".$_POST['article_cat']."', '$subject', '$body', '$body2', '$breaks', '".$userdata['user_id']."', '".time()."', '0', '$comments', '$ratings')");
redirect(FUSION_SELF.$aidlink."&status=sn");
}
} else if (isset($_POST['delete'])) {
$result = dbquery("DELETE FROM ".$db_prefix."articles2 WHERE article_id='$article_id'");
$result = dbquery("DELETE FROM ".$db_prefix."comments WHERE comment_item_id='$article_id' and comment_type='A'");
$result = dbquery("DELETE FROM ".$db_prefix."ratings WHERE rating_item_id='$article_id' and rating_type='A'");
redirect(FUSION_SELF.$aidlink."&status=del");
} else {
if (isset($_POST['preview'])) {
$article_cat = $_POST['article_cat'];
$subject = stripinput($_POST['subject']);
$body = phpentities(stripslash($_POST['body']));
$body2 = phpentities(stripslash($_POST['body2']));
$bodypreview = str_replace("src='".str_replace("../", "", IMAGES_A), "src='".IMAGES_A, stripslash($_POST['body']));
$body2preview = str_replace("src='".str_replace("../", "", IMAGES_A), "src='".IMAGES_A, stripslash($_POST['body2']));
if (isset($_POST['line_breaks'])) {
$breaks = " checked";
$bodypreview = nl2br($bodypreview);
$body2preview = nl2br($body2preview);
}
$comments = isset($_POST['article_comments']) ? " checked" : "";
$ratings = isset($_POST['article_ratings']) ? " checked" : "";
opentable($subject);
echo "$bodypreview\n";
closetable();
tablebreak();
opentable($subject);
echo "$body2preview\n";
closetable();
tablebreak();
}
opentable($locale['508']);
$editlist = ""; $sel = "";
$result = dbquery("SELECT * FROM ".$db_prefix."articles2 ORDER BY article_datestamp DESC");
if (dbrows($result) != 0) {
while ($data = dbarray($result)) {
if (isset($article_id)) $sel = ($article_id == $data['article_id'] ? " selected" : "");
$editlist .= "<option value='".$data['article_id']."'$sel>".$data['article_subject']."</option>\n";
}
}
echo "<form name='selectform' method='post' action='".FUSION_SELF.$aidlink."'>
<center>
<select name='article_id' class='textbox' style='width:250px;'>
$editlist</select>
<input type='submit' name='edit' value='".$locale['509']."' class='button'>
<input type='submit' name='delete' value='".$locale['510']."' onclick='return DeleteArticle();' class='button'>
</center>
</form>\n";
closetable();
tablebreak();
if (isset($_POST['edit'])) {
$result = dbquery("SELECT * FROM ".$db_prefix."articles2 WHERE article_id='$article_id'");
if (dbrows($result) != 0) {
$data = dbarray($result);
$article_cat = $data['article_cat'];
$subject = $data['article_subject'];
$body = phpentities(stripslashes($data['article_snippet']));
$body2 = phpentities(stripslashes($data['article_article']));
$breaks = ($data['article_breaks'] == "y" ? " checked" : "");
$comments = ($data['article_allow_comments'] == "1" ? " checked" : "");
$ratings = ($data['article_allow_ratings'] == "1" ? " checked" : "");
}
}
if (isset($article_id)) {
$action = FUSION_SELF.$aidlink."&article_id=$article_id";
opentable($locale['500']);
} else {
if (!isset($_POST['preview'])) {
$subject = "";
$body = "";
$body2 = "";
$breaks = " checked";
$comments = " checked";
$ratings = " checked";
}
$action = FUSION_SELF.$aidlink;
opentable($locale['504']);
}
$result = dbquery("SELECT * FROM ".$db_prefix."article_cats2 ORDER BY article_cat_name DESC");
$catlist = ""; $sel = "";
while ($data = dbarray($result)) {
if (isset($article_cat)) $sel = ($article_cat == $data['article_cat_id'] ? " selected" : "");
$catlist .= "<option value='".$data['article_cat_id']."'$sel>".$data['article_cat_name']."</option>\n";
}
$image_files = makefilelist(IMAGES_A, ".|..|index.php", true);
$image_list = makefileopts($image_files);
echo "<form name='inputform' method='post' action='$action' onSubmit='return ValidateForm(this)'>
<table align='center' cellpadding='0' cellspacing='0'>
<tr>
<td width='100' class='tbl'>".$locale['511']."</td>
<td class='tbl'><select name='article_cat' class='textbox' style='width:250px;'>
$catlist</select></td>
</tr>
<tr>
<td width='100' class='tbl'>".$locale['512']."</td>
<td class='tbl'><input type='text' name='subject' value='$subject' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' width='100' class='tbl'>".$locale['513']."</td>
<td class='tbl'><textarea name='body' cols='95' rows='5' class='textbox'>$body</textarea></td>
</tr>\n";
if ($settings['tinymce_enabled'] != 1) {
echo "<tr>\n<td class='tbl'></td>\n<td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('body', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('body', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('body', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"addText('body', '<a href=\'', '\' target=\'_blank\'>Link</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"addText('body', '<img src=\'".str_replace("../","",IMAGES_A)."', '\' style=\'margin:5px;\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('body', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('body', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"addText('body', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body', '<span class=\'alt\'>', '</span>');\"><br>
<select name='setcolor' class='textbox' style='margin-top:5px;' onChange=\"addText('body', '<span style=\'color:' + this.options[this.selectedIndex].value + ';\'>', '</span>');this.selectedIndex=0;\">
<option value=''>".$locale['420']."</option>
<option value='maroon' style='color:maroon;'>Maroon</option>
<option value='red' style='color:red;'>Red</option>
<option value='orange' style='color:orange;'>Orange</option>
<option value='brown' style='color:brown;'>Brown</option>
<option value='yellow' style='color:yellow;'>Yellow</option>
<option value='green' style='color:green;'>Green</option>
<option value='lime' style='color:lime;'>Lime</option>
<option value='olive' style='color:olive;'>Olive</option>
<option value='cyan' style='color:cyan;'>Cyan</option>
<option value='blue' style='color:blue;'>Blue</option>
<option value='navy' style='color:navy;'>Navy Blue</option>
<option value='purple' style='color:purple;'>Purple</option>
<option value='violet' style='color:violet;'>Violet</option>
<option value='black' style='color:black;'>Black</option>
<option value='gray' style='color:gray;'>Gray</option>
<option value='silver' style='color:silver;'>Silver</option>
<option value='white' style='color:white;'>White</option>
</select>
<select name='insertimage' class='textbox' style='margin-top:5px;' onChange=\"insertText('body', '<img src=\'".str_replace("../","",IMAGES_A)."' + this.options[this.selectedIndex].value + '\' style=\'margin:5px;\' align=\'left\'>');this.selectedIndex=0;\">
<option value=''>".$locale['421']."</option>
$image_list</select>
</td>
</tr>\n";
}
echo "<tr>\n<td valign='top' width='100' class='tbl'>".$locale['514']."</td>
<td class='tbl'><textarea name='body2' cols='95' rows='10' class='textbox'>$body2</textarea></td>
</tr>\n";
if ($settings['tinymce_enabled'] != 1) {
echo "<tr>\n<td class='tbl'></td><td class='tbl'>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"addText('body2', '<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"addText('body2', '<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"addText('body2', '<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"addText('body2', '<a href=\'', '\' target=\'_blank\'>Link</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"addText('body2', '<img src=\'".str_replace("../","",IMAGES_A)."', '\' style=\'margin:5px;\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"addText('body2', '<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"addText('body2', '<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"addText('body2', '<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"addText('body2', '<span class=\'alt\'>', '</span>');\">
<input type='button' value='new page' class='button' style='width:60px;' onClick=\"insertText('body2', '<--PAGEBREAK-->');\"><br>
<select name='setcolor' class='textbox' style='margin-top:5px;' onChange=\"addText('body2', '<span style=\'color:' + this.options[this.selectedIndex].value + ';\'>', '</span>');this.selectedIndex=0;\">
<option value=''>".$locale['420']."</option>
<option value='maroon' style='color:maroon;'>Maroon</option>
<option value='red' style='color:red;'>Red</option>
<option value='orange' style='color:orange;'>Orange</option>
<option value='brown' style='color:brown;'>Brown</option>
<option value='yellow' style='color:yellow;'>Yellow</option>
<option value='green' style='color:green;'>Green</option>
<option value='lime' style='color:lime;'>Lime</option>
<option value='olive' style='color:olive;'>Olive</option>
<option value='cyan' style='color:cyan;'>Cyan</option>
<option value='blue' style='color:blue;'>Blue</option>
<option value='navy' style='color:navy;'>Navy Blue</option>
<option value='purple' style='color:purple;'>Purple</option>
<option value='violet' style='color:violet;'>Violet</option>
<option value='black' style='color:black;'>Black</option>
<option value='gray' style='color:gray;'>Gray</option>
<option value='silver' style='color:silver;'>Silver</option>
<option value='white' style='color:white;'>White</option>
</select>
<select name='insertimage' class='textbox' style='margin-top:5px;' onChange=\"insertText('body2', '<img src=\'".str_replace("../","",IMAGES_A)."' + this.options[this.selectedIndex].value + '\' style=\'margin:5px;\' align=\'left\'>');this.selectedIndex=0;\">
<option value=''>".$locale['421']."</option>
$image_list</select>
</td>
</tr>\n";
}
echo "<tr>
<td class='tbl'></td><td class='tbl'>";
if ($settings['tinymce_enabled'] != 1) echo "<input type='checkbox' name='line_breaks' value='yes'$breaks> ".$locale['417']."<br>\n";
echo "<input type='checkbox' name='article_comments' value='yes'$comments> ".$locale['423']."<br>
<input type='checkbox' name='article_ratings' value='yes'$ratings> ".$locale['424']."</td>
</tr>
<tr>
<td align='center' colspan='2' class='tbl'><br>
<input type='submit' name='preview' value='".$locale['515']."' class='button'>
<input type='submit' name='save' value='".$locale['516']."' class='button'></td>
</tr>
</table>
</form>\n";
closetable();
echo "<script type='text/javascript'>
function DeleteArticle() {
return confirm('".$locale['552']."');
}
function ValidateForm(frm) {
if(frm.subject.value=='') {
alert('".$locale['550']."');
return false;
}
}
</script>\n";
}
} else {
opentable($locale['517']);
echo "<center>".$locale['518']."<br>\n".$locale['519']."<br>
<a href='article_cats2.php".$aidlink."'>".$locale['520']."</a>".$locale['521']."</center>\n";
closetable();
}
echo "</td>\n";
require_once BASEDIR."footer.php";
?>
slowo.php
<?php
/*--------------------------------------------+
| PHP-Fusion 5 - Content Management System |
|---------------------------------------------|
| author: Nick Jones (Digitanium) © 2002-2005 |
| web: http://www.php-fu... |
| email: |
|---------------------------------------------|
| Released under the terms and conditions of |
| the GNU General Public License (Version 2) |
+--------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
include LOCALE.LOCALESET."articles.php";
if (!isset($cat_id)) {
opentable($locale['400']);
$result = dbquery("SELECT * FROM ".$db_prefix."article_cats2 WHERE ".groupaccess('article_cat_access')." ORDER BY article_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
$counter = 0; $columns = 2;
echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl'>\n<tr>\n";
while ($data = dbarray($result)) {
if ($counter != 0 && ($counter % $columns == 0)) echo "</tr>\n<tr>\n";
$num = dbcount("(article_cat)", "articles2", "article_cat='".$data['article_cat_id']."'");
echo "<td align='center' valign='top' width='50%'><a href='".FUSION_SELF."?cat_id=".$data['article_cat_id']."'>".$data['article_cat_name']."</a> <span class='small2'>($num)</span>";
if ($data['article_cat_description'] != "") echo "<br>\n<span class='small'>".$data['article_cat_description']."</span>";
echo "</td>\n";
$counter++;
}
echo "</tr>\n</table>\n";
} else {
echo "<center><br>\n".$locale['401']."<br><br>\n</center>\n";
}
closetable();
} else {
$res = 0;
if (!isNum($cat_id)) fallback(FUSION_SELF);
$result = dbquery("SELECT * FROM ".$db_prefix."article_cats2 WHERE article_cat_id='$cat_id'");
if (dbrows($result) != 0) {
$cdata = dbarray($result);
if (checkgroup($cdata['article_cat_access'])) {
$res = 1;
opentable($locale['400'].": ".$cdata['article_cat_name']);
$rows = dbcount("(article_id)", "articles2", "article_cat='$cat_id'");
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
if ($rows != 0) {
$result = dbquery("SELECT * FROM ".$db_prefix."articles2 WHERE article_cat='$cat_id' ORDER BY ".$cdata['article_cat_sorting']." LIMIT $rowstart,15");
$numrows = dbrows($result); $i = 1;
while ($data = dbarray($result)) {
if ($data['article_datestamp']+604800 > time()+($settings['timeoffset']*3600)) {
$new = " <span class='small'>[".$locale['402']."]</span>";
} else {
$new = "";
}
echo "<a href='readarticle2.php?article_id=".$data['article_id']."'>".$data['article_subject']."</a>$new<br>\n".stripslashes($data['article_snippet']);
echo ($i != $numrows ? "<br><br>\n" : "\n"); $i++;
}
closetable();
if ($rows > 15) echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,15,$rows,3,FUSION_SELF."?cat_id=$cat_id&")."\n</div>\n";
} else {
echo "<center>".$locale['403']."</center>\n";
closetable();
}
}
}
if ($res == 0) redirect(FUSION_SELF);
}
require_once "side_right.php";
require_once "footer.php";
?>
readarticle2.php (zmieniając odwołania article2 na slowo):
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2006 Nick Jones
| http://www.php-fu...
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";
require_once "subheader.php";
require_once "side_left.php";
require_once INCLUDES."comments_include.php";
require_once INCLUDES."ratings_include.php";
if (!isset($article_id) || !isNum($article_id)) fallback("index.php");
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
$result = dbquery(
"SELECT ta.*,tac.*, tu.user_id,user_name FROM ".$db_prefix."[b]slowo[/b] ta
INNER JOIN ".$db_prefix."article_cats2 tac ON ta.article_cat=tac.article_cat_id
LEFT JOIN ".$db_prefix."users tu ON ta.article_name=tu.user_id
WHERE article_id='$article_id'"
);
$res = 0;
if (dbrows($result) != 0) {
$data = dbarray($result);
if (checkgroup($data['article_cat_access'])) {
$res = 1;
if ($rowstart == 0) $result = dbquery("UPDATE ".$db_prefix."[b]slowo[/b] SET article_reads=article_reads+1 WHERE article_id='$article_id'");
$article = stripslashes($data['article_article']);
$article = explode("<--PAGEBREAK-->", $article);
$pagecount = count($article);
$article_subject = stripslashes($data['article_subject']);
$article_info = array(
"article_id" => $data['article_id'],
"user_id" => $data['user_id'],
"user_name" => $data['user_name'],
"article_date" => $data['article_datestamp'],
"article_breaks" => $data['article_breaks'],
"article_comments" => dbcount("(comment_id)", "comments", "comment_type='b' AND comment_item_id='".$data['article_id']."'"),
"article_reads" => $data['article_reads'],
"article_allow_comments" => $data['article_allow_comments']
);
render_article($article_subject, $article[$rowstart], $article_info);
if (count($article) > 1) {
$rows = $pagecount;
echo "<div align='center' style='margin-top:5px;'>\n".makePageNav($rowstart,1,$rows,3,FUSION_SELF."?article_id=$article_id&")."\n</div>\n";
}
if ($data['article_allow_comments']) showcomments("b","[b]slowo[/b]","article_id",$article_id,FUSION_SELF."?article_id=$article_id");
if ($data['article_allow_ratings']) showratings("b",$article_id,FUSION_SELF."?article_id=$article_id");
}
}
if ($res == 0) redirect("articles.php");
require_once "side_right.php";
require_once "footer.php";
?>
Następnie dodałem do PA ikony nowych: "slowo" "Kategorie slowo" poprzez wpisanie w dodatkowe strony:
$result = dbquery("INSERT INTO ".$db_prefix."admin (admin_rights, admin_image, admin_title, admin_link, admin_page) VALUES ('AC', 'article_cats.gif', 'Kategorie slowo', 'article_cats2.php', 1)");
$result = dbquery("INSERT INTO ".$db_prefix."admin (admin_rights, admin_image, admin_title, admin_link, admin_page) VALUES ('A', 'articles.gif', 'Arty 2', 'slowo.php', 1)");
if($result) echo"Wpis dodano poprawnie";
Następnie w dodatkowe strony -> podgląd wpisałem podane przez Ciebie wcześniej kody:
$result = dbquery("CREATE TABLE ".$db_prefix."article_cats2 (
article_cat_id SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
article_cat_name VARCHAR(100) NOT NULL DEFAULT '',
article_cat_description VARCHAR(200) NOT NULL DEFAULT '',
article_cat_sorting VARCHAR(50) NOT NULL DEFAULT 'article_subject ASC',
article_cat_access TINYINT(3) UNSIGNED NOT NULL DEFAULT '0',
PRIMARY KEY (article_cat_id)) TYPE=MyISAM;");
if($result) echo"Wpis dodano poprawnie";
$result = dbquery("CREATE TABLE ".$db_prefix."[b]slowo[/b] (
article_id SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
article_cat SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
article_subject VARCHAR(200) NOT NULL DEFAULT '',
article_snippet TEXT NOT NULL,
article_article TEXT NOT NULL,
article_breaks CHAR(1) NOT NULL DEFAULT '',
article_name SMALLINT(5) UNSIGNED NOT NULL DEFAULT '1',
article_datestamp INT(10) UNSIGNED NOT NULL DEFAULT '0',
article_reads SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0',
article_allow_comments TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
article_allow_ratings TINYINT(1) UNSIGNED NOT NULL DEFAULT '1',
PRIMARY KEY (article_id)) TYPE=MyISAM;");
if($result) echo"Wpis dodano poprawnie";
w PA "Kategorie slowo" działa i mogę dodać kategorię, jednak gdy w PA w chodzę w "slowo" to nie mogę dodać artykułu..
Widnieje również komunikat:
Table 'ryba10_ryba10.ep_articles2' doesn't exist
Rozumiem że brakuje jakiejś tabeli articles2? Tylko że ja żadnego pliku o takiej nazwie już nie mam.. Jak sobie z tym poradzić?
Edytowane przez Ryba_10 dnia 30.06.2008 08:36:55
|