Avatar billede uso Nybegynder
19. august 2004 - 16:18 Der er 2 kommentarer og
1 løsning

PHP-Fusion hjælp. (artikler til indsendte tutorials)

Hej eksperter... (Forbered jer på et langt spørgsmål!)

Jeg er igang med min / vores hjemmeside - (www.teamdragon.1go.dk MIDLERTIDIG ADRESSE) og vil gerne have lidt hjælp.

Jeg ved godt at det er en MEGET stor mundfuld - men vil i ikk prøve alligevel?

Problemet er, at jeg mægtig gerne vil have to artikel systemer - Tutorials/Lav tutorials og Indsendte Tutorials/Indsend tutorial.

(Lav tutorials er for admins...)

Okay - nu er der nogen der siger "Hvor er Indsendte/Indsend tutorial henne" så svarer jeg: log på og kik. Nå så når vi så langt...

Jeg tror at "Indsendte tutorials" virker - men jeg ved det ikke endnu. Det ved jeg først når at indsend tutorial virker. Det er egentlig meget simpelt:

Du trykker "Indsend tutorial" og indsender dit tutorial.
Vi kikker på det og godkender det.
Du kan nu se det i "Indsendte tutorials."

hmm, ja så tror jeg at jeg er noget der til hvor admins skal godkende det. Ihverfald så har jeg ikke lavet noget som helst med admin menuen endnu. men tilgengæld - har jeg ingen anelse hvor på kortet jeg befinder mig - og ved ingen ting om hvor jeg skal skrive noget... derfor vil jeg have jer til og hjælpe mig...

Lidt koder...

(Det hedder lyrics fordi en jeg kender - lavede det samme, så jeg kaldte det samme som han gjorde...)
(MAIN_DIR)
Submit_lyric.php:

<?
/*
---------------------------------------------------
    PHP-Fusion - Content Management System
    -------------------------------------------
    © Nick Jones (Digitanium) 2002-2004
    http://www.php-fusion.co.uk
    nick@php-fusion.co.uk
    -------------------------------------------
    Released under the terms and conditions of
    the GNU General Public License (Version 2)
---------------------------------------------------
*/
@require "fusion_config.php";
require "header.php";
require "subheader.php";
require fusion_langdir."lyrics.php";
require "side_left.php";

if (isset($_POST['submit_lyric'])) {
    $sub_name = stripinput($_POST['sub_name']);
    $sub_email = stripinput($_POST['sub_email']);
    $subject = stripinput($_POST['subject']);
    $postdate = strftime($settings['longdate'], time()+($settings['timeoffset']*3600));
    $description = encscript($_POST['description']);
    $description = addslashes($description);
    if (isset($_POST['line_breaks'])) {
        $lyric .= "\n\n<span class='small'>".LAN_430."$sub_name".LAN_431."$postdate</span>";
        $breaks = "y";
    } else {
        $lyric .= "<br><br>\n<span class='small'>".LAN_430."$sub_name".LAN_431."$postdate</span>";
        $breaks = "n";
    }
    $lyric = encscript($lyric);
    $lyric = addslashes($lyric);
    if ($sub_name != "" && $sub_email != "" && $subject != "" && $lyric != "") {
        $result = dbquery("INSERT INTO ".$fusion_prefix."submitted_lyrics VALUES ('', '$sub_name', '$sub_email', '$sub_cat', '$subject', '$description', '$lyric', '$breaks', '".time()."', '$user_ip')");
        opentable(LAN_400);
        echo "<center><br />
".LAN_410."<br />
".LAN_411."<br /><br />
<a href='submit_lyric.php'>".LAN_412."</a><br /><br />
<a href='index.php'>".LAN_413."</a><br /><br />
</center>\n";
        closetable();
    } else {
        opentable(LAN_400);
        echo "<center><br />
".LAN_420."<br />
".LAN_421."<br /><br />
<a href='submit_lyric.php'>".LAN_422."</a><br /><br />
</center>\n";
        closetable();
    }
} else {
    if (isset($_POST['preview_lyric'])) {
        $sub_name = stripinput($_POST['sub_name']);
        $sub_email = stripinput($_POST['sub_email']);
        $subject = stripinput($_POST['subject']);
        $postdate = strftime($settings['longdate'], time()+($settings['timeoffset']*3600));
        $description = encscript($_POST['description']);
        $description = stripslashes($description);
        $lyric = encscript($lyric);
        $lyric = stripslashes($lyric);
        if (isset($_POST['line_breaks'])) {
            $preview_lyric = $lyric."\n\n<span class='small'>".LAN_430."$sub_name".LAN_431."$postdate</span>";
            $preview_lyric = nl2br($preview_lyric);
            $breaks = " checked";
        } else {
            $preview_lyric = $lyric."<br /><br />\n<span class='small'>".LAN_430."$sub_name".LAN_431."$postdate</span>";
            $breaks = "";
        }
        opentable($subject);
        echo $description;
        closetable();
        tablebreak();
        opentable($subject);
        echo $preview_lyric;
        closetable();
        tablebreak();
    }
    $result = dbquery("SELECT * FROM ".$fusion_prefix."lyric_cats ORDER BY lyric_cat_name DESC");
    if (dbrows($result) != 0) {
        while ($data = dbarray($result)) {
            if (isset($_POST['preview_lyric'])) {
                if ($sub_cat == $data['lyric_cat_id']) { $sel = " selected"; } else { $sel = ""; }
            }
            $catlist .= "<option value='$data[lyric_cat_id]'$sel>".$data['lyric_cat_name']."</option>\n";
        }
    }
    opentable(LAN_400);
    echo LAN_440."<br /><br />
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>
<form name='userform' method='post' action='$PHP_SELF'>
<tr>
<td>".LAN_441."</td>
<td><input type='text' name='sub_name' value='";
    if (isset($_POST['preview_lyric'])) { echo "$sub_name"; } else { echo $userdata['user_name']; }
    echo "' maxlength='32' class='textbox' style='width:200px;'></td>
    </tr>
<tr>
<td>".LAN_442."</td>
<td><input type='text' name='sub_email' value='";
    if (isset($_POST['preview_lyric'])) { echo "$sub_email"; } else { echo $userdata['user_email']; }
    echo "' maxlength='64' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td width='100'>".LAN_443."</td>
<td><select name='sub_cat' class='textbox' style='width:200px;'>
$catlist</select></td>
</tr>
<tr>
<td>".LAN_444."</td>
<td><input type='text' name='subject' value='$subject' maxlength='64' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td valign='top'>".LAN_445."</td>
<td><textarea class='textbox' name='description' rows='5' style='width:300px;'>$description</textarea></td>
</tr>
<tr>
<td valign='top'>".LAN_446."</td>
<td><textarea class='textbox' name='lyric' rows='8' style='width:300px;'>$lyric</textarea><br /><br />
".LAN_447."<br /><br />
<input type='checkbox' name='line_breaks' value='yes'$breaks>".LAN_448."<br /></td>
</tr>
<tr>
<td colspan='2'><br /><center>
<input type='submit' name='preview_lyric' value='".LAN_449."' class='button'>
<input type='submit' name='submit_lyric' value='".LAN_450."' class='button'></center>
</td>
</tr>
</table>
</form>\n";
    closetable();
}

require "side_right.php";
require "footer.php";
?>

Readlyric.php:

<?
/*
-------------------------------------------------------
PHP-Fusion
-----------------------------------------------
© Nick Jones 2002-2004
http://www.digitaldominion.co.uk
nick@digitaldominion.co.uk
-----------------------------------------------
Released under the terms and conditions of the
GNU General Public License (http://gnu.org).
-------------------------------------------------------
*/
@require "fusion_config.php";
require "header.php";
require "subheader.php";

if (empty($page)) {
$page = 0;
$result = dbquery("UPDATE ".$fusion_prefix."lyrics SET lyric_reads=lyric_reads+1 WHERE lyric_id='$lyric_id'");
}

require "navigation.php";
require "sidebar.php";
echo "</td>
<td valign=\"top\" class=\"bodybg\">\n";

$result = dbquery("SELECT * FROM ".$fusion_prefix."lyrics WHERE lyric_id='$lyric_id'");
if (dbrows($result) != 0) {
$data = dbarray($result);
$lyric = stripslashes($data[lyric_lyric]);
$lyric = explode("<--PAGEBREAK-->", $lyric);
$pagecount = count($lyric) - 1;
$lyric_subject = stripslashes($data[lyric_subject]);
$lyric_date = strftime($settings[longdate], $data[lyric_datestamp]+($settings[timeoffset]*3600));
$lyric_info = array($data[lyric_id], $data[lyric_email], $data[lyric_name], $lyric_date,
$data[lyric_breaks], $data[lyric_comments], $data[lyric_reads]);
render_lyric($lyric_subject, $lyric[$page], $lyric_info);
if (count($lyric) > 1) {
tablebreak();
if ($page > 0) {
$prevpage = $page - 1;
$prev = "<a href=\"$PHP_SELF?lyric_id=$lyric_id&page=$prevpage\" class=\"white\">".LAN_50."</a>";
}
if ($page < $pagecount) {
$nextpage = $page + 1;
$next = "<a href=\"$PHP_SELF?lyric_id=$lyric_id&page=$nextpage\" class=\"white\">".LAN_51."</a>";
}
$currentpage = $page + 1;
$current = LAN_52.$currentpage.LAN_53.count($lyric);
prevnextbar($prev,$current,$next);
}
}

echo "</td>
<td width=\"170\" valign=\"top\" class=\"srborder\">\n";
require "userinfo.php";
require "poll.php";
require "shoutbox.php";
echo "</td>
</tr>
</table>\n";

require "footer.php";
?>

lyrics.php:
<?
/*
-------------------------------------------------------
PHP-Fusion
-----------------------------------------------
© Nick Jones 2002-2004
http://www.digitaldominion.co.uk
nick@digitaldominion.co.uk
-----------------------------------------------
Released under the terms and conditions of the
GNU General Public License (http://gnu.org).
-------------------------------------------------------
lyrics.php © Helmuth Mikkelsen May 2004
*/
@require "fusion_config.php";
require "header.php";
require "subheader.php";
require fusion_langdir."lyrics.php";

require "side_left.php";
echo "</td>
<td valign=\"top\" class=\"bodybg\">\n";

if (empty($cat_id)) {
opentable(LAN_200);
$result = dbquery("SELECT * FROM ".$fusion_prefix."lyrics_cats ORDER BY lyrics_cat_name");
$rows = dbrows($result);
if ($rows != 0) {
$columns = 2;
$counter = 0;
$thisrow = 1;
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"body\">
<tr>\n";
while($data = dbarray($result)) {
$result2 = dbquery("SELECT count(lyrics_cats) FROM ".$fusion_prefix."lyrics WHERE lyrics_cats='$data[lyrics_cat_id]'");
$num = dbresult($result2, 0);
echo "<td align=\"center\" valign=\"top\" width=\"40%\"><a href=\"$PHP_SELF?lyric_id=$data[lyrics_cat_id]\">$data[lyrics_cat_name]</a> <span class=\"small2\">($num)</span>";
if ($data[lyrics_cat_description] != "") {
echo "<br>
<span class=\"small\">".stripslashes($data[lyrics_cat_description])."</span>";
}
echo "</td>\n";
if ($rows != $thisrow) {
if($counter % $columns) echo "</tr>\n<tr>\n";
}
$counter++;
$thisrow++;
}
echo "</tr>
</table>\n";
} else {
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"body\">
<tr>
<td align=\"center\">".LAN_201."</td>
</tr>
</table>\n";
}
} else {
$result = dbquery("SELECT * FROM ".$fusion_prefix."lyrics_cats WHERE lyrics_cat_id='$cat_id'");
$data = dbarray($result);
$cat_name = stripslashes($data[lyrics_cat_name]);
opentable(LAN_200.": $cat_name");
$result = dbquery("SELECT * FROM ".$fusion_prefix."lyrics WHERE lyrics_cats='$cat_id' ORDER BY lyrics_name");
$rows = dbrows($result);
if ($rows != 0) {
echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" class=\"body\">
<tr>
<td>";
$i = 1;
while ($data = dbarray($result)) {
$dateposted = strftime("%d.%m.%y", $data[lyric_datestamp]+($settings[timeoffset]*3600));
if ($data[lyric_datestamp]+604800 > time()+($settings[timeoffset]*3600)) {
$new = " <span class=\"small\">[".LAN_202."]</span>";
} else {
$new = "";
}
echo "<div><a href=\"readlyrics.php?lyric_id=$data[lyric_id]\">".stripslashes($data[lyric_subject])."</a>$new</div>
<div>".stripslashes($data[article_snippet])."</div>\n";
if ($i != $rows) {
echo "<br>\n";
} else {
echo "\n";
}
$i++;
}
echo "</td>
</tr>
</table>\n";
} else {
echo "<center>".LAN_203."</center>\n";
}
}
closetable();

echo "</td>
<td width=\"170\" valign=\"top\" class=\"srborder\">\n";
require "side_right.php";
require "footer.php";
echo "</td>
</tr>
</table>\n";

require "footer.php";
?>

Okay - det var så Lyric forside, læs og skriv.

Nu kommer der så nogle admin sider... (De er næsten uberørt...)
(FUSION_ADMIN)
Submisisions.php
<?
/*
---------------------------------------------------
    PHP-Fusion - Content Management System
    -------------------------------------------
    © Nick Jones (Digitanium) 2002-2004
    http://www.php-fusion.co.uk
    nick@php-fusion.co.uk
    -------------------------------------------
    Released under the terms and conditions of
    the GNU General Public License (Version 2)
---------------------------------------------------
*/
@require "../fusion_config.php";
require "../header.php";
require fusion_basedir."subheader.php";
require fusion_langdir."admin/admin_main.php";
require fusion_langdir."admin/admin_submissions.php";
require "navigation.php";

if (!Admin()) header("Location: ../index.php");

if (Admin()) {
    if ($stage == "" || $stage == "1") {
        if ($t == "l") {
            if (isset($delete)) {
                opentable(LAN_400);
                $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_links WHERE sublink_id='$delete'");
                echo "<br><div align='center'>".LAN_401."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
                closetable();
            }
        } else if ($t == "n") {
            if (isset($delete)) {
                opentable(LAN_460);
                $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_news WHERE subnews_id='$delete'");
                echo "<br><div align='center'>".LAN_461."<br><br>
<a href='$PHP_SELF'>".LAN_462."</a><br><br>
<a href='index.php'>".LAN_463."</a></div><br>\n";
                closetable();
            }
        } else if ($t == "a") {
            if (isset($delete)) {
                opentable(LAN_510);
                $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_articles WHERE sub_article_id='$delete'");
                echo "<br><div align='center'>".LAN_511."<br><br>
<a href='$PHP_SELF'>".LAN_512."</a><br><br>
<a href='index.php'>".LAN_513."</a></div><br>\n";
                closetable();
            }
        } else {
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_links ORDER BY sublink_datestamp DESC");
            if (dbrows($result) != "0") {
                while ($data = dbarray($result)) {
                    $links .= "<tr><td>".$data['sublink_sitename']."</td>
<td align='right' width='100'><span class='small'><a href='$PHP_SELF?stage=2&t=l&sublink_id=".$data['sublink_id']."'>".LAN_420."</a></span> |
<span class='small'><a href='$PHP_SELF?t=l&delete=".$data['sublink_id']."'>".LAN_421."</a></span></td></tr>";
                }
            } else {
                $links = "<tr><td colspan='2'>".LAN_422."</td></tr>";
            }
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_news ORDER BY subnews_datestamp DESC");
            if (dbrows($result) != "0") {
                while ($data = dbarray($result)) {
                    $news .= "<tr><td>".$data['subnews_subject']."</td>
<td align='right' width='100'><span class='small'><a href='$PHP_SELF?stage=2&t=n&subnews_id=".$data['subnews_id']."'>".LAN_480."</a></span> |
<span class='small'><a href='$PHP_SELF?t=n&delete=".$data['subnews_id']."'>".LAN_481."</a></span></td></tr>";
                }
            } else {
                $news = "<tr><td colspan='2'>".LAN_482."</td></tr>";
            }
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_articles ORDER BY sub_article_datestamp DESC");
            if (dbrows($result) != "0") {
                while ($data = dbarray($result)) {
                    $articles .= "<tr><td>".$data['sub_article_subject']."</td>
<td align='right' width='100'><span class='small'><a href='$PHP_SELF?stage=2&t=a&sub_article_id=".$data['sub_article_id']."'>".LAN_520."</a></span> |
<span class='small'><a href='$PHP_SELF?t=a&delete=".$data['sub_article_id']."'>".LAN_521."</a></span></td></tr>";
                }
            } else {
                $articles = "<tr><td colspan='2'>".LAN_522."</td></tr>";
            }
            opentable(LAN_404);
            echo "<table align='center' width='400' cellspacing='0' cellpadding='0' class='tbl'>
<tr><td colspan='2' class='altbg'>".LAN_423."</td></tr>
$links
<tr><td colspan='2' class='altbg'>".LAN_483."</td></tr>
$news
<tr><td colspan='2' class='altbg'>".LAN_523."</td></tr>
$articles
</table>\n";
            closetable();
        }
    }
    if ($stage == "2" && $t == "l") {
        if (isset($_POST['add'])) {
            $result = dbquery("INSERT INTO ".$fusion_prefix."weblinks VALUES('', '$link_sitename', '$link_description', '$link_url', '$link_category', '".time()."', '0')");
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_links WHERE sublink_id='$sublink_id'");
            opentable(LAN_430);
            echo "<br><div align='center'>".LAN_431."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else if (isset($_POST['delete'])) {
            opentable(LAN_432);
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_links WHERE sublink_id='$sublink_id'");
            echo "<br><div align='center'>".LAN_433."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else {
            $result = dbquery("SELECT * FROM ".$fusion_prefix."weblink_cats ORDER BY weblink_cat_name");
            if (dbrows($result) != 0) {
                while($data = dbarray($result)) {
                    $opts .= "<option value='".$data['weblink_cat_id']."'>".$data['weblink_cat_name']."</option>\n";
                }
            } else {
                $opts .= "<option value='0'>".LAN_434."</option>\n";
            }
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_links WHERE sublink_id='$sublink_id'");
            $data = dbarray($result);
            $posted = strftime($settings['longdate'], $data['sublink_datestamp']+($settings['timeoffset']*3600));
            opentable(LAN_440);
            echo "<table align='center' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td style='text-align:center;'>".LAN_441."<a href='mailto:".$data['sublink_email']."'>".$data['sublink_name']."</a>".LAN_442."$posted</td>
</tr>
<tr>
<td style='text-align:center;'><a href='".$data['sublink_url']."' target='_blank'>".$data['sublink_sitename']."</a> (".$data['sublink_url'].")</td>
</tr>
<tr>
<td style='text-align:center;'><span class='alt'>".LAN_443."</span> ".$data['sublink_category']."</td>
</tr>
<form name='publish' method='post' action='$PHP_SELF?stage=2&t=l&sublink_id=$sublink_id'>
<tr>
<td><center><br>
".LAN_444."<br><br>
</center>
<table>
<tr>
<td>".LAN_445."</td>
<td><input type='text' name='link_sitename' value='".$data['sublink_sitename']."' class='textbox' style='width:200px'></td>
</tr>
<tr>
<td>".LAN_446."</td>
<td><input type='text' name='link_url' value='".$data['sublink_url']."' class='textbox' style='width:300px'></td>
</tr>
<tr>
<td>".LAN_447."</td>
<td><input type='text' name='link_description' value='".$data['sublink_description']."' class='textbox' style='width:300px'></td>
</tr>
<tr>
<td>".LAN_443."</td>
<td><select name='link_category' class='textbox' style='width:200px'>
$opts</select></td>
</tr>
</table>
<center><input type='submit' name='add' value='".LAN_448."' class='button'><br><br>
".LAN_449."<br>
<input type='submit' name='delete' value='".LAN_450."' class='button'></center>
</td>
</tr>
</form>
</table>";
            closetable();
        }
    }
    if ($stage == "2" && $t == "n") {
        if (isset($_POST['publish'])) {
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_news WHERE subnews_id='$subnews_id'");
            $data = dbarray($result);
            $subject = stripinput($data['subnews_subject']);
            $news = addslashes($data['subnews_news']);
            if ($data['subnews_extended'] != "") {
                $extendednews = addslashes($data['subnews_extended']);
            }
            $result = dbquery("INSERT INTO ".$fusion_prefix."news VALUES('', '$subject', '$news', '$extendednews', '".$data['subnews_breaks']."', '".$userdata['user_id']."', '".time()."', '0', '0')");
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_news WHERE subnews_id='$subnews_id'");
            opentable(LAN_490);
            echo "<br><div align='center'>".LAN_491."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else if (isset($_POST['delete'])) {
            opentable(LAN_492);
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_news WHERE subnews_id='$subnews_id'");
            echo "<br><div align='center'>".LAN_493."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else {   
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_news WHERE subnews_id='$subnews_id'");
            $data = dbarray($result);
            $subject = $data['subnews_subject'];
            $news = stripslashes($data['subnews_news']);
            if ($data['subnews_extended'] != "") {
                $extendednews = stripslashes($data['subnews_extended']);
            }
            if ($data['subnews_breaks'] == "y") {
                $news = nl2br($news);
                if ($data['subnews_extended'] != "") {
                    $extendednews = nl2br($extendednews);
                }
            }
            opentable($subject);
            echo $news;
            closetable();
            if ($extendednews != "") {
                tablebreak();
                opentable($subject);
                echo $extendednews;
                closetable();
            }
            tablebreak();
            opentable(LAN_500);
            echo "<form name='publish' method='post' action='$PHP_SELF?sub=submissions&stage=2&t=n&subnews_id=$subnews_id'>
<center>
".LAN_501."<br>
<input type='submit' name='publish' value='".LAN_502."' class='button'><br><br>
".LAN_503."<br>
<input type='submit' name='delete' value='".LAN_504."' class='button'>
</center>
</form>\n";
            closetable();
        }
    }
    if ($stage == "2" && $t == "a") {
        if (isset($_POST['publish'])) {
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_articles WHERE sub_article_id='$sub_article_id'");
            $data = dbarray($result);
            $subject = stripinput($data['sub_article_subject']);
            $description = addslashes($data['sub_article_description']);
            $article = addslashes($data['sub_article_body']);
            $result = dbquery("INSERT INTO ".$fusion_prefix."articles VALUES('', '".$data['sub_article_cat']."', '$subject', '$description', '$article', '".$data['sub_article_breaks']."', '0', '".$userdata['user_id']."', '".time()."', '0')");
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_articles WHERE sub_article_id='$sub_article_id'");
            opentable(LAN_530);
            echo "<br><div align='center'>".LAN_531."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else if (isset($_POST['delete'])) {
            opentable(LAN_532);
            $result = dbquery("DELETE FROM ".$fusion_prefix."submitted_articles WHERE sub_article_id='$sub_article_id'");
            echo "<br><div align='center'>".LAN_533."<br><br>
<a href='$PHP_SELF'>".LAN_402."</a><br><br>
<a href='index.php'>".LAN_403."</a></div><br>\n";
            closetable();
        } else {   
            $result = dbquery("SELECT * FROM ".$fusion_prefix."submitted_articles WHERE sub_article_id='$sub_article_id'");
            $data = dbarray($result);
            $subject = $data['sub_article_subject'];
            $description = stripslashes($data['sub_article_description']);
            $article = stripslashes($data['sub_article_body']);
            if ($data['sub_article_breaks'] == "y") {
                $article = nl2br($data['sub_article_body']);
            }
            opentable($subject);
            echo $description;
            closetable();
            tablebreak();
            opentable($subject);
            echo $article;
            closetable();
            tablebreak();
            opentable(LAN_540);
            echo "<form name='publish' method='post' action='$PHP_SELF?sub=submissions&stage=2&t=a&sub_article_id=$sub_article_id'>
<center>
".LAN_541."<br>
<input type='submit' name='publish' value='".LAN_542."' class='button'><br><br>
".LAN_543."<br>
<input type='submit' name='delete' value='".LAN_544."' class='button'>
</center>
</form>\n";
            closetable();
        }
    }
}

echo "</td>\n";
require "../footer.php";
?>

Navigation.php (vidste ikk om den var nødvendig, men skrev alligevel)
<?
/*
---------------------------------------------------
    PHP-Fusion - Content Management System
    -------------------------------------------
    © Nick Jones (Digitanium) 2002-2004
    http://www.php-fusion.co.uk
    nick@php-fusion.co.uk
    -------------------------------------------
    Released under the terms and conditions of
    the GNU General Public License (Version 2)
---------------------------------------------------
*/
echo "<td width='$theme_width_l' valign='top' class='slborder'>\n";
@openside("$userdata[user_name]");
if (Member()) {
    $result = dbquery("SELECT count(message_id) FROM ".$fusion_prefix."messages WHERE message_to='".$userdata['user_id']."' AND message_read='0'");
echo "· <a href=\"".fusion_basedir."editprofile.php\" class=\"slink\">".LAN_60."</a><br>
· <a href=\"".fusion_basedir."messages.php\" class=\"slink\">".LAN_61."</a> [".dbresult($result, 0)."]<br>
· <a href=\"".fusion_basedir."members.php\" class=\"slink\">".LAN_62."</a><br>\n";
    if (Admin()) {
        echo "· <a href=\"".fusion_basedir."fusion_admin/index.php\" class=\"slink\">".LAN_63."</a><br>\n";
    }
    echo "· <a href=\"".fusion_basedir."index.php?logout=yes\" class=\"slink\">".LAN_64."</a>\n";
}
@closeside();
@openside(LAN_01);
if (Member()) {
    echo "· <a href=\"index.php\" class=\"slink\">".LAN_130."</a><br>
<hr class=\"shr\">
· <a href=\"../index.php\" class=\"slink\">".LAN_131."</a>\n";
}
@closeside();
@opensidex(LAN_132,"off");
if (SuperAdmin()) {
    $panel_titles = array(
        LAN_201 => "articles",
        LAN_202 => "article_cats",
        LAN_203 => "comments",
        LAN_204 => "custom_pages",
        LAN_205 => "db_backup",
        LAN_206 => "downloads",
        LAN_207 => "download_cats",
        LAN_222 => "faq",
        LAN_208 => "forums",
        LAN_209 => "images",
        LAN_210 => "members",
        LAN_211 => "news",
        LAN_212 => "panels",
        LAN_223 => "photoalbums",
        LAN_213 => "phpinfo",
        LAN_214 => "polls",
        LAN_215 => "shoutbox",
        LAN_216 => "site_links",
        LAN_217 => "settings",
        LAN_218 => "submissions",
        LAN_219 => "weblinks",
        LAN_220 => "weblink_cats",
        LAN_221 => "upgrade",
    );
} else if (Admin()) {
    $panel_titles = array(
        LAN_201 => "articles",
        LAN_203 => "comments",
        LAN_206 => "downloads",
        LAN_208 => "forums",
        LAN_209 => "images",
        LAN_210 => "members",
        LAN_211 => "news",
        LAN_223 => "photogallery",
        LAN_214 => "polls",
        LAN_215 => "shoutbox",
        LAN_218 => "submissions",
        LAN_219 => "weblinks",
    );
}
foreach ($panel_titles as $key=>$panel_link) {
    echo "· <a href='".$panel_link.".php'>$key</a><br>\n";
}
closesidex();
echo "</td>\n<td valign='top' class='bodybg'>\n";
?>

!- her kommer ADMIN til artikel (tutorials alm.) systemet -!
Articles.php:
<?
/*
---------------------------------------------------
    PHP-Fusion - Content Management System
    -------------------------------------------
    © Nick Jones (Digitanium) 2002-2004
    http://www.php-fusion.co.uk
    nick@php-fusion.co.uk
    -------------------------------------------
    Released under the terms and conditions of
    the GNU General Public License (Version 2)
---------------------------------------------------
*/
@require "../fusion_config.php";
require "../header.php";
require fusion_basedir."subheader.php";
require fusion_langdir."admin/admin_main.php";
require fusion_langdir."admin/admin_news-articles.php";
require "navigation.php";

if (!Admin()) header("Location: ../index.php");

if (Admin()) {
    $result = dbquery("SELECT * FROM ".$fusion_prefix."article_cats");
    if (dbrows($result) != 0) {
        if (isset($_POST['save'])) {
            $subject = stripinput($subject);
            $body = addslashes($body);
            $body2 = addslashes($body2);
            if (isset($_POST['line_breaks'])) { $breaks = "y"; }
            if (isset($article_id)) {
                $result = dbquery("UPDATE ".$fusion_prefix."articles SET article_cat='$article_cat', article_subject='$subject', article_snippet='$body', article_article='$body2', article_breaks='$breaks' WHERE article_id='$article_id'");
                opentable(LAN_500);
                echo "<center><br>
".LAN_501."<br><br>
<a href='articles.php'>".LAN_502."</a><br><br>
<a href='index.php'>".LAN_503."</a><br><br>
</center>\n";
                closetable();
            } else {
                $result = dbquery("INSERT INTO ".$fusion_prefix."articles VALUES('', '$article_cat', '$subject', '$body', '$body2', '$breaks', '0', '".$userdata['user_id']."', '".time()."', '0')");
                opentable(LAN_504);
                echo "<center><br>
".LAN_505."<br><br>
<a href='articles.php'>".LAN_502."</a><br><br>
<a href='index.php'>".LAN_503."</a><br><br>
</center>\n";
                closetable();
            }
        } else if (isset($_POST['delete'])) {
            $result = dbquery("DELETE FROM ".$fusion_prefix."articles WHERE article_id='$article_id'");
            $result = dbquery("DELETE FROM ".$fusion_prefix."comments WHERE comment_item_id='$article_id' and comment_type='A'");
            opentable(LAN_506);
            echo "<center><br>
".LAN_507."<br><br>
<a href='articles.php'>".LAN_502."</a><br><br>
<a href='index.php'>".LAN_503."</a><br><br>
</center>\n";
            closetable();
        } else {
            if (isset($_POST['preview'])) {
                $subject = stripinput($subject);
                $body = stripslashes($body);
                $body2 = stripslashes($body2);
                $bodypreview = str_replace("src='", "src='../", $body);
                $body2preview = str_replace("src='", "src='../", $body2);
                if (isset($_POST['line_breaks'])) {
                    $breaks = " checked";
                    $bodypreview = nl2br($bodypreview);
                    $body2preview = nl2br($body2preview);
                }
                opentable($subject);
                echo "$bodypreview\n";
                closetable();
                tablebreak();
                opentable($subject);
                echo "$body2preview\n";
                closetable();
                tablebreak();
            }
            opentable(LAN_508);
            $result = dbquery("SELECT * FROM ".$fusion_prefix."articles ORDER BY article_datestamp DESC");
            if (dbrows($result) != 0) {
                while ($data = dbarray($result)) {
                    if (isset($article_id)) {
                        if ($article_id == $data['article_id']) { $sel = " selected"; } else { $sel = ""; }
                    }
                    $editlist .= "<option value='".$data['article_id']."'$sel>".$data['article_subject']."</option>\n";
                }
            }
            echo "<form name='selectform' method='post' action='$PHP_SELF'>
<center>
<select name='article_id' class='textbox' style='width:250px;'>
$editlist</select>
<input type='submit' name='edit' value='".LAN_509."' class='button'>
<input type='submit' name='delete' value='".LAN_510."' class='button'>
</center>
</form>\n";
            closetable();
            tablebreak();
            if (isset($_POST['edit'])) {
                $result = dbquery("SELECT * FROM ".$fusion_prefix."articles WHERE article_id='$article_id'");
                if (dbrows($result) != 0) {
                    $data = dbarray($result);
                    $article_cat = $data['article_cat'];
                    $subject = $data['article_subject'];
                    $body = stripslashes($data['article_snippet']);
                    $body2 = stripslashes($data['article_article']);
                    if ($data['article_breaks'] == "y") { $breaks = " checked"; }
                }
            }
            if (isset($article_id)) {
                $action = $PHP_SELF."?article_id=$article_id&article_cat=$article_cat";
                opentable(LAN_500);
            } else {
                $action = $PHP_SELF;
                opentable(LAN_504);
            }
            $result = dbquery("SELECT * FROM ".$fusion_prefix."article_cats ORDER BY article_cat_name DESC");
            while ($data = dbarray($result)) {
                if (isset($article_cat)) {
                    if ($article_cat == $data['article_cat_id']) { $sel = " selected"; } else { $sel = ""; }
                }
                $catlist .= "<option value='".$data['article_cat_id']."'$sel>".$data['article_cat_name']."</option>\n";
            }
            echo "<script language='Javascript'>
function ValidateForm(frm) {
    if(frm.subject.value=='') {
        alert('".LAN_550."');
        return false;
    }
}
</script>
<form name='editform' method='post' action='$action' onSubmit='return ValidateForm(this)'>
<table align='center' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='100'>".LAN_511."</td>
<td><select name='article_cat' class='textbox' style='width:250px;'>
$catlist</select></td>
</tr>
<tr>
<td width='100'>".LAN_512."</td>
<td><input type='text' name='subject' value='$subject' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td valign='top' width='100'>".LAN_513."</td>
<td><textarea name='body' cols='95' rows='5' class='textbox' onselect='updatePos(this);' onkeyup='updatePos(this);' onclick='updatePos(this);' ondblclick='updatePos(this);'>$body</textarea></td>
</tr>
<tr>
<td></td><td>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"AddText('<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"AddText('<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"AddText('<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"AddText('<a href=\'\' target=\'_blank\'>', '</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"insertText('<img src=\'fusion_images/\' style=\'margin:5px;\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"AddText('<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"AddText('<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"AddText('<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"AddText('<span class=\'alt\'>', '</span>');\"><br>
</td>
</tr>
<tr>
<td valign='top' width='100'>".LAN_514."</td>
<td><textarea name='body2' cols='95' rows='10' class='textbox' onselect='updatePos(this);' onkeyup='updatePos(this);' onclick='updatePos(this);' ondblclick='updatePos(this);'>$body2</textarea></td>
</tr>
<tr>
<td></td><td>
<input type='button' value='b' class='button' style='font-weight:bold;width:25px;' onClick=\"AddText2('<b>', '</b>');\">
<input type='button' value='i' class='button' style='font-style:italic;width:25px;' onClick=\"AddText2('<i>', '</i>');\">
<input type='button' value='u' class='button' style='text-decoration:underline;width:25px;' onClick=\"AddText2('<u>', '</u>');\">
<input type='button' value='link' class='button' style='width:35px;' onClick=\"AddText2('<a href=\'\' target=\'_blank\'>', '</a>');\">
<input type='button' value='img' class='button' style='width:35px;' onClick=\"insertText2('<img src=\'fusion_images/\' style=\'margin:5px;\' align=\'left\'>');\">
<input type='button' value='center' class='button' style='width:45px;' onClick=\"AddText2('<center>', '</center>');\">
<input type='button' value='small' class='button' style='width:40px;' onClick=\"AddText2('<span class=\'small\'>', '</span>');\">
<input type='button' value='small2' class='button' style='width:45px;' onClick=\"AddText2('<span class=\'small2\'>', '</span>');\">
<input type='button' value='alt' class='button' style='width:25px;' onClick=\"AddText2('<span class=\'alt\'>', '</span>');\">
<input type='button' value='new page' class='button' style='width:60px;' onClick=\"insertText2('<--PAGEBREAK-->');\">
</td>
</tr>
<tr>
<td align='center' colspan='2'><br>
<input type='checkbox' name='line_breaks' value='y'$breaks>".LAN_515."<br><br>
<input type='submit' name='preview' value='".LAN_516."' class='button'>
<input type='submit' name='save' value='".LAN_517."' class='button'></td>
</tr>
</table>
</form>\n";
            closetable();
            echo "<script language=\"JavaScript\">
var editBody = document.editform.body;
var editBody2 = document.editform.body2;
function insertText(theText) {
    if (editBody.createTextRange && editBody.curPos) {
        editBody.curPos.text = theText;
    } else {
        editBody.value += theText;
    }
    editBody.focus();
}
function insertText2(theText) {
    if (editBody2.createTextRange && editBody2.curPos) {
        editBody2.curPos.text = theText;
    } else {
        editBody2.value += theText;
    }
    editBody2.focus();
}
function AddText(wrap,unwrap) {
    if (editBody.curPos) {
        insertText(wrap + editBody.curPos.text + unwrap);
    } else {
        insertText(wrap + unwrap);
    }
}
function AddText2(wrap,unwrap) {
    if (editBody2.curPos) {
        insertText2(wrap + editBody2.curPos.text + unwrap);
    } else {
        insertText2(wrap + unwrap);
    }
}
function updatePos(obj) {
    if (obj.createTextRange) {
        obj.curPos = document.selection.createRange().duplicate();
    }
}
</script>\n";
        }
    } else {
        opentable(LAN_518);
        echo "<center>".LAN_519."<br>
".LAN_520."<br>
<a href='article_cats.php'>".LAN_521."</a>".LAN_522."</center>\n";
        closetable();
    }
}

echo "</td>\n";
require "../footer.php";
?>

Og til sidst, article_cats.php:

<?
/*
---------------------------------------------------
    PHP-Fusion - Content Management System
    -------------------------------------------
    © Nick Jones (Digitanium) 2002-2004
    http://www.php-fusion.co.uk
    nick@php-fusion.co.uk
    -------------------------------------------
    Released under the terms and conditions of
    the GNU General Public License (Version 2)
---------------------------------------------------
*/
@require "../fusion_config.php";
require "../header.php";
require fusion_basedir."subheader.php";
require fusion_langdir."admin/admin_main.php";
require fusion_langdir."admin/admin_news-articles.php";
require "navigation.php";

if (!Admin()) header("Location: ../index.php");

if (SuperAdmin()) {
    if ($action == "delete") {
        $result = dbquery("SELECT * FROM ".$fusion_prefix."articles WHERE article_cat='$cat_id'");
        if (dbrows($result) != 0) {
            opentable(LAN_450);
            echo "<center><br>
".LAN_451."<br>
<span class='small'>".LAN_452."</span><br><br>
<a href='article_cats.php'>".LAN_453."</a><br><br>
<a href='index.php'>".LAN_403."</a><br><br>
</center>\n";
        } else {
            $result = dbquery("DELETE FROM ".$fusion_prefix."article_cats WHERE article_cat_id='$cat_id'");
            opentable(LAN_450);
            echo "<center><br>
".LAN_454."<br><br>
<a href='article_cats.php'>".LAN_453."</a><br><br>
<a href='index.php'>".LAN_403."</a><br><br>
</center>\n";
        }
        closetable();
    } else {
        if (isset($_POST['save_cat'])) {
            if ($action == "edit") {
                $cat_name = stripinput($cat_name);
                $cat_description = stripinput($cat_description);
                $result = dbquery("UPDATE ".$fusion_prefix."article_cats SET article_cat_name='$cat_name', article_cat_description='$cat_description' WHERE article_cat_id='$cat_id'");
                unset($action, $cat_name, $cat_description, $cat_id);
            } else {
                $cat_name = stripinput($cat_name);
                $cat_description = stripinput($cat_description);
                $result = dbquery("INSERT INTO ".$fusion_prefix."article_cats VALUES('', '$cat_name', '$cat_description')");
                unset($cat_name, $cat_description);
            }
        }
        if ($action == "edit") {
            $result = dbquery("SELECT * FROM ".$fusion_prefix."article_cats WHERE article_cat_id='$cat_id'");
            $data = dbarray($result);
            $cat_name = $data['article_cat_name'];
            $cat_description = $data['article_cat_description'];
            $formaction = "$PHP_SELF?action=edit&cat_id=".$data['article_cat_id'];
            opentable(LAN_455);
        } else {
            $formaction = "$PHP_SELF";
            opentable(LAN_456);
        }
        echo "<form name='addcat' method='post' action='$formaction'>
<table align='center' width='400' cellspacing='0' cellpadding='0' class='tbl'>
<tr>
<td width='130'>".LAN_457."</td>
<td><input type='text' name='cat_name' value='$cat_name' class='textbox' style='width:200px;'></td>
</tr>
<tr>
<td width='130'>".LAN_458."</td>
<td><input type='text' name='cat_description' value='$cat_description' class='textbox' style='width:250px;'></td>
</tr>
<tr>
<td align='center' colspan='2'>
<input type='submit' name='save_cat' value='".LAN_459."' class='button'></td>
</tr>
</table>
</form>\n";
        closetable();
        tablebreak();
        opentable(LAN_460);
        echo "<table align='center' width='400' cellspacing='0' cellpadding='0' class='tbl'>\n";
        $result = dbquery("SELECT * FROM ".$fusion_prefix."article_cats ORDER BY article_cat_name");
        if (dbrows($result) != 0) {
            echo "<tr>
<td class='altbg'>".LAN_461."</td>
<td align='right' widtb='60' class='altbg'>".LAN_462."</td>
</tr>\n";
            while ($data = dbarray($result)) {
                echo "<tr>
<td><a href='$PHP_SELF?action=edit&cat_id=$data[article_cat_id]'>".$data['article_cat_name']."</a><br>
<span class='small'>".$data['article_cat_description']."</span></td>
<td align='right' valign='top'><a href='$PHP_SELF?action=delete&cat_id=".$data['article_cat_id']."'>".LAN_463."</a></td>
</tr>\n";
            }
            echo "</table>\n";
        } else {
            echo "<tr><td align='center'>".LAN_464."</td></tr>
</table>\n";
        }
        closetable();
    }
}

echo "</td>\n";
require "../footer.php";
?>

Håber at der er nogen der vil hjælpe derude... jeg sidder med blanke øjne selv...
Avatar billede uso Nybegynder
21. august 2004 - 19:55 #1
Ingen der har *lyst* til at gå igang?

// Jeg har self. ikke helt blanke øjne...

Jeg tror - at jeg skal tilføje noget til admin panelet - to links, Ituts (tuts*tutorials) cat. og Ituts, og så skal jeg i "Forslag fra brugere" have gjort noget sådan at man også kan se tilføjelser fra Ituts...

-> Men er det nok? Jeg prøver om jeg kan imorgen :-/
Avatar billede uso Nybegynder
01. september 2004 - 13:14 #2
<- Jeg fik ikke prøvet...

Er der ingen der vil hjælpe?
Avatar billede uso Nybegynder
26. oktober 2004 - 16:10 #3
Kan vist se at det er på tide at lukke spm efter 2 måneder.. der er sket meget siden da og jeg fik siden op og kører som den skal i lørdags...

Brugerne må leve med forummet som fint kan bruges til formålet :D

www.photoshop-freaks.tk ligger det nu på

//UsO
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester