Cutenews:Problem z dodawaniem newsów i usuwaniem komentarzy!


(Elanaboo) #1

Witam!

Mam następujący problem jakiś tydzień temu przenosiłem cutenews na inny serwer z boo.pl na obecny na domeny.pl! Zgrałem wszystkie pliki i wszystko było ok... Wrzuciłem nawet dwa nowe newsy i wszystko działało jak powinno!

Aż dwa dni temu wyskoczyły błedy typu :

gdy chce dodać newsa to wyskakuje coś takiego:

8aov78i.jpg

gdy chce skasować komentarze to też u góry wyskakuje błąd i nie można skasować danych komentarzy!

7x0lutv.jpg

O to zawartość plików editnews.mdu :

?PHP


if($member_db[1] 3){ msg("error", "Access Denied", "You don't have permission to edit news"); }

// ********************************************************************************

// List all news available for editing

// ********************************************************************************

if($action == "list")

{

        echoheader("editnews","Edit News");


    $cat_lines = @file("./data/category.db.php");

    foreach($cat_lines as $single_line){

                $cat_arr = explode("|", $single_line);

        $cat[$cat_arr[0]] = $cat_arr[1];

    }


    // How Many News to show on one page

    if($news_per_page == ""){ $news_per_page = 21; }


    $all_db = array();

    if($source == ""){ $all_db = file("./data/news.txt"); }

    else{ $all_db = file("./data/archives/${source}.news.arch"); }




// choose only needed news items

if ($category != "" or $author != "" or $member_db[1] == 3){

        foreach($all_db as $raw_line){

                $raw_arr = explode("|", $raw_line);

        if (($category == "" or $raw_arr[6] == $category) and ($author == "" or $raw_arr[1] == $author) and( $member_db[1] != 3 or $raw_arr[1] == $member_db[2] )){

                         $all_db_tmp[] = $raw_line;

        }

    }

$all_db = $all_db_tmp;

}



// Prelist Entries

    $flag = 1;

        if($start_from == "0"){ $start_from = ""; }

    $i = $start_from;

    $entries_showed = 0;


if(!empty($all_db)){


    foreach ($all_db as $line){

        if($j $start_from){ $j++; continue; }

        $i++;


        $item_db = explode("|",$line);

             $itemdate = date("d/m/y",$item_db[0]);


                     if($flag == 1){ $bg="#F7F6F4"; $flag = 0; }

                     else {$bg = "#FFFFFF"; $flag = 1;}


                     if(strlen($item_db[2]) 74){ $title = substr($item_db[2],0,70)." ..."; }

            $title = stripslashes( preg_replace(array("'\|'", "'\"'", "'\''"), array("I", """, "'"), $item_db[2]) );

                     $entries .= "


$title
";

             $count_comments = countComments($item_db[0], $source);

             if($count_comments == 0){$entries .= "";}

             else{$entries .= "$count_comments";}


             $entries .= "       ";


             if($item_db[6] == ""){ $my_cat = ""; }

             elseif($cat[$item_db[6]] == ""){ $my_cat = ""; }

             else{ $my_cat = $cat[$item_db[6]]; }


             $entries .= "$my_cat 

                 $itemdate


                       $item_db[1]





            ";

                $entries_showed ++;


            if($i = $news_per_page + $start_from){ break; }

    }//foreach news line

}

// End prelisting




    $all_count_news = count($all_db);

    if($category != ""){ $cat_msg = "Category: $cat[$category];"; }

    if($source != ""){


                $news_lines = file("./data/archives/$source.news.arch");

                $count = count($news_lines);

                $last = $count-1;

                $first_news_arr = explode("|", $news_lines[$last]);

                $last_news_arr = explode("|", $news_lines[0]);

                $first_timestamp = $first_news_arr[0];

                $last_timestamp = $last_news_arr[0];

                $source_msg = "Archive: ". date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp) .";";

        }




///////////////////////////////////////////

// Options Bar

echo"

| Showing $entries_showed articles from total $all_count_news ; $cat_msg $source_msg | show options  |
|

|   |
| Source  | - Active News -"; if(!$handle = opendir("./data/archives")){ die("Can not open directory ./data/archives "); }

               while (false !== ($file = readdir($handle)))

       {

                       if($file != "." and $file != ".." and !is_dir("./data/archives/$file") and eregi("news.arch", $file))

        {

                $file_arr = explode(".", $file);

            $id = $file_arr[0];

            $news_lines = file("./data/archives/$file");

            $count = count($news_lines);

            $last = $count-1;

            $first_news_arr = explode("|", $news_lines[$last]);

            $last_news_arr = explode("|", $news_lines[0]);

            $first_timestamp = $first_news_arr[0];

            $last_timestamp = $last_news_arr[0];

                            $arch_date = date("d M Y",$first_timestamp) ." - ". date("d M Y",$last_timestamp);

            $ifselected = "";

            if($source == $file_arr[0]){ $ifselected = "selected"; }

            echo "Archive: $arch_date ($count)";

                       }

               }

    closedir($handle);

echo" | |
| Category  | - All -"; $cat_lines = file("./data/category.db.php"); foreach($cat_lines as $single_line){ $cat_arr = explode("|", $single_line); $ifselected = ""; if($category == $cat_arr[0]){ $ifselected = "selected"; } echo"$cat_arr[1]\n"; } echo" | |
| Author  | - Any -"; $user_lines = file("./data/users.db.php"); foreach($user_lines as $single_line){ if(!eregi("\?", $single_line)){ $user_arr = explode("|", $single_line); $ifselected = ""; if($user_arr[1] != 4){ if($author == $user_arr[2]){ $ifselected = "selected"; } echo"$user_arr[2]\n"; } } } echo" | |
| News per page  | | |
| | | |

|

 "; // End Options Bar //////////////////////////////////////////////////////////////////////////////// Showing List of News if($entries_showed == 0){ echo"

  • No articles found -"; } else{ echo JSCRIPT; echo"Previous"; $tmp = 1; } if(count($all_db) $i) { if($tmp){ $npp_nav .= "  ||  ";} $how_next = count($all_db) - $i; if($how_next $news_per_page){ $how_next = $news_per_page; } $npp_nav .= "Next $how_next"; } if($entries_showed != 0){ echo   $npp_nav With selected: -- Choose Action -- Delete HTML; if($member_db[1] == 1){ echo"Send to Archive"; } echoChange Category HTML; } echo HTML; echofooter(); } // ******************************************************************************** // Edit News Article // ******************************************************************************** elseif($action == "editnews") { // Show The Article for Editing if($source == ""){ $all_db = file("./data/news.txt"); } else{ $all_db = file("./data/archives/$source.news.arch"); } $found = FALSE; foreach ($all_db as $line) { $item_db=explode("|",$line); if ($id == $item_db[0]){ $found = TRUE; break;} }//foreach news line $have_perm = 0; if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;} elseif($member_db[1] == 3 and $item_db[1] == $member_db[2]) {$have_perm = 1;} if(!$have_perm){ msg("error", "NO Access", "You dont have access for this action", "$PHP_SELF?mod=editnewsaction=list"); } if (!$found){ msg("error","Error !!

| Title | | |
| Avatar URL |    (optional) | |
| Category | "; $cat_lines = file("./data/category.db.php"); foreach($cat_lines as $single_line){ $cat_arr = explode("|", $single_line); if($item_db[6] == $cat_arr[0]){ echo"$cat_arr[1]\n"; $selected = TRUE; }else{ echo"$cat_arr[1]\n"; } } if(!$selected){ echo"     "; } else{ echo"     "; } echo" | |
| Short Story | $item_db[3] | [insert image][quick tags]"; echo insertSmilies('short', 4); echo" |
| Full Story(optional) | $item_db[4] | [insert image][quick tags]"; echo insertSmilies('full', 4); echo" |
| |     [options]   [delete] |
| Options |   Convert new lines to br /   Use HTML in this article |
| |   |
| Comments"; // Show the Comments for Editing if($source == ""){ $all_comments_db = file("./data/comments.txt"); } else{ $all_comments_db = file("./data/archives/${source}.comments.arch"); } $found_newsid = FALSE; foreach($all_comments_db as $comment_line) { $comment_line = trim($comment_line); $comments_arr = explode("||",$comment_line); if($comments_arr[0] == $id) {//if these are comments for our story $found_newsid = TRUE; if ($comments_arr[1] != "") { echo" |  ".strtolower(Poster)." | ".strtolower(Date)." | | |
| |   $comment_arr[1] | $comtime | | |
| | | delete all? | | |
| | | |

"; break;//foreach comment line }//if there are any comments else { echo" No Comments "; } }//if these are comments for our story }//foreach comments line if($found_newsid == FALSE){ echo" No Comments "; } echofooter(); } // ******************************************************************************** // Do Edit News // ******************************************************************************** elseif($action == "doeditnews") { if(trim($title) == "" and $ifdelete != "yes"){ msg("error","Error !!