I added the possibility to rename images and to open the images in a popup. Popups in the Cutenews image manager are nothing new. But I made it also for the page you are showing the images on, and I made it optional.

Creating thumbs with a dropshadow will be added shortly.  https://cutephp.com/forum/style_emoticons/default/smile.gif


Thank you.  https://cutephp.com/forum/style_emoticons/default/smile.gif

Will be fixed in the next update.

Well when I post images in my news they are aligned to the left all the time so I end up manually adding a <div align="center"> around the HTML for the images to keep everything looking nice.

When adding an image in addnews you have the image properties. Isn't that what you need?

To have buttons rather than text links replace the following chuncks of code.

The button will be added to the code. Thanks for that.

Just a thought here, but I have a php script that takes a directory of images and not only creates a thumb with the GDLib but also adds a rather nice drop shadow effect (using a number of user defined .png files) to the newly created thumbnail too. Maybe this could be a little upgrade for your mod  https://cutephp.com/forum/style_emoticons/default/wink.gif


Please send me the script. I'll try to add it.

Thank you.   https://cutephp.com/forum/style_emoticons/default/smile.gif

Now, to get it so that I can choose <div align="left">, <div align="center">, or <div align="right"> from a button within short/full story hehe.


I don't completely understand. What do you mean exactly?

And can you send me the code for the buttons as seen in your screenshots? I'm too lazy to make it myself.  https://cutephp.com/forum/style_emoticons/default/rolleyes.gif

Thanks.

Everything works mint except when I insert a clickable thumb as it seems to miss a bit out of the inserted URL.


Right, it worked when using the wysiwyg editor. But without it the href was too short.

I fixed it. Download the latest version from the first post.

There was an error with multiple uploads. The previous version uploaded only 2 images. I corrected it.

Please replace the old file with the updated file.

&gt;&gt;Download&lt;&lt;

Name: Advanced Image Module
Author: FI-DD
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: I modified the existing image module of cutenews 1.4.1 and 1.3.6.
It saves the original image and a resized thumbnail of the image in a different folder.
Features:
* Auto thumbnail creation on upload (for every image a thumbnail is created and saved in a certain folder)
* Possibility to set the width of the thumbnail
* Improved multiple upload fields - no buttons anymore (taken from CuteNews.RU)
* Small preview image next to each file in image manager
* Preview the thumb by a single click
* Preview the original image by a single click
* Insert the original image into news
* Insert the thumbnail into news
* Insert a clickable thumbnail into news (opens the original image in a new window/popup)
* Rename files (taken from CuteNews.RU)
* Open images in a popup - not only in CuteNews but also on your news page. (optional)
* Add a shadow to the thumbnails (optional)
* Thumbnail support for jpg and gif images
* vspace and hspace as image properties
* In image properties default value of the alt tag is the picture's name

Update Version 2.0:

* Supports subdirectories
* Supports cropping the thumbs (all thumbs have the same width and height)
* Supports moving images from one folder to another
* Supports pagination


Update Version 3.0:

* Watermark (text)
* Watermark (image)
* Create thumbs for already existing images.
* Fixed the image path bug (hopefully).


Update Version 4.0:

* Rounded corners


Insert image preview
http://img466.imageshack.us/img466/6469/insertimage6nf.th.jpg
Image manager preview
http://img117.imageshack.us/img117/7119/imagemanager9pi.th.jpg
Demo: the module (user/login: demo/demo) example blog with images.
Requirements: Your server needs the GD Library.
Discussion Topic: here
Instructions:
&gt;&gt;Download page&lt;&lt;


http://www.cutephp.com/cutenews/addons/c4a-addon.zip

Installation instructions are for cutenews 1.3.6 but with a little bit of coding it should work in 1.4.0 as well.

Name: List all commenters
Author: FI-DD
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: on the active news page you can add a list of all people that have commented on that article.
Demo: [url="http://democute.de.funpic.de/cute/example2.php"]here[/url
Instructions:
///////////////////////////////////
Installation:

1. Open functions.inc.php and add this at the end of the file before the last ?>

//////////////////////////////////////////////////////////////////
// Function: Lists all commenters with mail or url when available
function list_commenters($news, $linebreak, $separator) {
global $cutepath;
$alle_comments = file($cutepath."/data/comments.txt");
$i=0;
foreach($alle_comments as $comments_line)
{
$comments_line = trim($comments_line);
$comments_line_arr = explode("|>|", $comments_line);
if($news == $comments_line_arr[0])
{
$individual_comment = explode("||", $comments_line_arr[1]);
foreach ($individual_comment as $single_comment)
{
$single_comment_arr = explode("|", $single_comment);
if (($single_comment_arr[0] != "") && (!stristr($output, $single_comment_arr[1])))
{
$i++;
if($single_comment_arr[2] != "none")
{
if( preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $single_comment_arr[2])){ $url_target = "";$mail_or_url = "mailto:"; }
else
{
$url_target = "target=\"_blank\"";
$mail_or_url = "";
if(substr($single_comment_arr[2],0,3) == "www") $mail_or_url = "http://";
}
$output .= "[url="]".stripslashes($single_comment_arr[1])."[/url]".$separator;
}
else $output .= $single_comment_arr[1].$separator;
if (fmod($i, $linebreak)==0) $output .= "
";
}
}

}
}
if (fmod($i, $linebreak)=="0") $output = substr($output, 0, -(strlen($separator)+6));
else $output = substr($output, 0, -strlen($separator));
return $output;
}


2. Open shows.inc.php

a. Find:

$output = str_replace("{title}", $news_arr[2], $template_full);

add below:

if(CountComments($news_arr[0], $archive) > 0){
$output = str_replace('[commenters-header]', '', $output);
$output = str_replace('[/commenters-header]', '', $output);
$output = preg_replace("#\{commenters:(.*):(.*)\}#ie", "list_commenters('".$news_arr[0]."', '\\1', '\\2')", $output);
}
else $output = preg_replace("#\[commenters-header\](.*?)\[/commenters-header\]#i", "", $output);


b. Find:

$output = $template_active;


add below:

if(CountComments($news_arr[0], $archive) > 0){
$output = str_replace('[commenters-header]', '', $output);
$output = str_replace('[/commenters-header]', '', $output);
$output = preg_replace("#\{commenters:(.*):(.*)\}#ie", "list_commenters('".$news_arr[0]."', '\\1', '\\2')", $output);
}
else $output = preg_replace("#\[commenters-header\](.*?)\[/commenters-header\]#i", "", $output);


Now you can use [commenters-header]{commenters:N:S}[/commenters-header] in your template (Active News/Full Story) to list the commenters for each article.
N is the number of commenters per line (0 = all in one line) and S is the separator between each commenter.
Everything between [commenters-header] and [/commenters-header] shows only if there is a comment.

For example:

[commenters-header]{commenters:2: - }[/commenters-header]

would show this:

commenter1 - commenter2 -
commenter3 - commenter4
////////////////////////////////////////


Something like this?

<?php
$all_news = file("news.txt");
foreach ($all_news as $news) {
     $news_arr = explode("|", $news);
     if ($news_arr[0] == "ID") {
     $title = $news_arr[2];
     }
}
?>


Date change possibility for news


https://cutephp.com/forum/index.php?showtopic=38
https://cutephp.com/forum/index.php?showtopic=5137

Multi category possibility for news


https://cutephp.com/forum/index.php?showtopic=9412

And last wishe : little seach engine ?


A standard search feature is built in.
A better search is here: https://cutephp.com/forum/index.php?showtopic=9277

Name: Un-Archive news
Author: FI-DD
CuteNews Compatibility: 1.3.6 - 1.4.0 (Higher versions have this option)
Description: take your news from the archive and make them active again.
Instructions:

Installation

1. Open massactions.mdu and find this at the end of the file:

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~
  If No Action Is Chosen
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

and add above:

/* ~~~~~~~~~~~~~~~~~~
  Mass UN-Archive
 ~~~~~~~~~~~~~~~~~~~ */
elseif($action == "mass_unarchive"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source == ""){ msg("error", "Error", "That news is not in an archive", "$PHP_SELF?mod=editnews&action=list&source=$source"); }

echoheader("options", "Un-Archive");

echo "<form method=post action=\"$PHP_SELF\"><table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr><td >
Do you really want to un-archive the ([b]".count($selected_news)."[/b]) chosen articles?


<input type=button value=\" No \" onclick=\"java script:document.location='$PHP_SELF?mod=editnews&action=list&source=$source'\">   <input type=submit value=\" Yes \">
<input type=hidden name=source value=\"$source\">
<input type=hidden name=action value=\"do_mass_unarchive\">
<input type=hidden name=mod value=\"massactions\">";
foreach($selected_news as $null => $newsid){
    echo"<input type=hidden name=selected_news[] value=\"$newsid\">\n";
}
echo"</td></tr></table></form>";

echofooter();
exit;
}
/* ~~~~~~~~~~~~~~~~~~~~~~
  DO Mass UN-Archive
 ~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "do_mass_unarchive"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source == ""){ msg("error", "Error", "That news is not in an archive", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
    $moved_articles = 0;

    // build news
    $arch_file = "./data/archives/$source.news.arch";
    $news_file = "./data/news.txt";
    $write_news = "";
    $write_arch = "";
    $old_arch = file("$arch_file");
    foreach($old_arch as $null => $old_arch_line){
  $old_arch_arr = explode("|", $old_arch_line);
  if(in_array($old_arch_arr[0], $selected_news)){
      $write_news = str_replace("\n", "", $old_arch_line)."\n".$write_news;
      $write_arch = $write_arch;
      $moved_articles ++;
    } else {
      $write_news = $write_news;
      $write_arch = str_replace("\n", "", $old_arch_line)."\n".$write_arch;
  }
    }
    $old_news = file("$news_file");
    foreach($old_news as $null => $old_news_line){
  $write_news = str_replace("\n", "", $old_news_line)."\n".$write_news;
    }

    // write news
    $news_db = fopen("$news_file", "wb");
    $news_sorted = explode("\n", $write_news); rsort($news_sorted); reset($news_sorted);
    foreach ($news_sorted as $null => $line){ fwrite($news_db, "$line"); if ($line != "") { fwrite($news_db, "\n"); } }
    fclose($news_db);
    $arch_db = fopen("$arch_file", "wb");
    $arch_sorted = explode("\n", $write_arch); rsort($arch_sorted); reset($arch_sorted);
    foreach ($arch_sorted as $null => $line){ fwrite($arch_db, "$line"); if ($line != "") { fwrite($arch_db, "\n"); } }
    fclose($arch_db);

    // build comments
    $arch_file = "./data/archives/$source.comments.arch";
    $news_file = "./data/comments.txt";
    $write_news = "";
    $write_arch = "";
    $old_arch = file("$arch_file");
    foreach($old_arch as $null => $old_arch_line){
  $old_arch_arr = explode("|>|", $old_arch_line);
  if(in_array($old_arch_arr[0], $selected_news)){
      $write_news = str_replace("\n", "", $old_arch_line)."\n".$write_news;
      $write_arch = $write_arch;
  } else {
      $write_news = $write_news;
      $write_arch = str_replace("\n", "", $old_arch_line)."\n".$write_arch;
  }
    }
    $old_news = file("$news_file");
    foreach($old_news as $null => $old_news_line){
  $write_news = str_replace("\n", "", $old_news_line)."\n".$write_news;
    }

    // write comments
    $news_db = fopen("$news_file", "wb");
    $news_sorted = explode("\n", $write_news); rsort($news_sorted); reset($news_sorted);
    foreach ($news_sorted as $null => $line){ fwrite($news_db, "$line"); if ($line != "") { fwrite($news_db, "\n"); } }
    fclose($news_db);
    $arch_db = fopen("$arch_file", "wb");
    $arch_sorted = explode("\n", $write_arch); rsort($arch_sorted); reset($arch_sorted);
    foreach ($arch_sorted as $null => $line){ fwrite($arch_db, "$line"); if ($line != "") { fwrite($arch_db, "\n"); } }
    fclose($arch_db);
    
//delete the archive when empty
      $arch_file = "./data/archives/$source.news.arch";
    $arch_db_new = file("$arch_file");
    if  (!$arch_db_new[0]) {
    if(!$handle = opendir("./data/archives")){ die("<center>Can not open directory $cutepath/data/archive "); }
  while (false !== ($file = readdir($handle))){
      if($file == "$source.news.arch" or    $file == "$source.comments.arch"){
    unlink("./data/archives/$file");
      }
  }
    closedir($handle);
}

if(count($selected_news) == $moved_articles){ msg("info", "News Moved", "All articles that you selected ($moved_articles) were moved successfully to your active news.", "$PHP_SELF?mod=editnews&action=list"); }
else{ msg("error", "News Moved (with errors)", "$moved_articles of ".count($selected_news)." articles that you selected were moved successfully", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
}

2. Open editnews.mdu and find this:

if($member_db[1] == 1){ echo"<option title=\"make new archive with all selected news\" value=\"mass_archive\">Send to Archive</option>"; }

and replace with this:

if ($member_db[1] == 1) {
if($source == ""){ echo "<option title=\"make new archive with all selected news\" value=\"mass_archive\">Send to Archive</option>"; }
else { echo "<option title=\"bring selected back from archive\" value=\"mass_unarchive\">Un-Archive</option>"; }
}

Name: highlighted search results
Author: FI-DD
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: It's an improved way to show the search results.
The search term will be highlighted and shown in an excerpt of the news.
It is template driven and you will have additional quick tags, for example result's title, result's author, result's category.
Demo:  http://democute.de.funpic.de/cute/example2.php
Type "cutenews" in the textbox and press "Enter" to see the results.
Instructions:
(All lines refer to an unchanged cutenews 1.3.6 version of each file.)

Part 1: search.php

1. Find (this line 8):

require_once("$cutepath/inc/functions.inc.php");

and add below:

$cat_lines = file("$cutepath/data/category.db.php");
foreach($cat_lines as $single_line){
    $cat_arr = explode("|", $single_line);    

$cat[$cat_arr[0]] = $cat_arr[1];
    $cat_icon[$cat_arr[0]]=$cat_arr[2];
}

2. Find this (line 233):

////////// Showing Result

                    echo"
[b][url=]$item_arr[2][/url][/b] (". date("d F, Y", $item_arr[0]) .")";
////////// End Showing Result

and replace with this:

////////// Showing Result
include"$cutepath/data/search.tpl";
echo"$search_found";
$search_results = str_replace("{result-title}",$item_arr[2],$search_results);
$search_results = str_replace("{result-author}",$item_arr[1],$search_results);
$search_results = str_replace("{result-cat-id}",$item_arr[6],$search_results);
$search_results = str_replace("{result-category}",$cat[$item_arr[6]],$search_results);
$search_results = str_replace("{result-comments}",countComments($item_arr[0],$archive), $search_results);

if(!empty($item_arr[4])){$item_arr[4] = replace_news("show",$item_arr[4]);
$search_results = str_replace("{result-text}",str_replace("\n",'
',formattext($story,$item_arr[4])),$search_results);
}
else{$item_arr[3] = replace_news("show",$item_arr[3]);
$search_results = str_replace("{result-text}",str_replace("\n",'
',formattext($story,$item_arr[3])),$search_results);
}

$search_results = str_replace("[result-link]", "[url=]",$search_results); //You may add &$user_query here.
$search_results = str_replace("[/result-link]","[/url]", $search_results);
echo"$search_results";
////////// End Showing Result

Part 2: functions.inc.php

Add this at the end of the file before the last ?>

////////////////////////////////////////////////////////
// Function:    formattext

function formattext($whatfind, $html)
{
  $text = strip_tags($html);

  $pos = @strpos(strtoupper($text),strtoupper($whatfind));
  $otstup = 200; //set the number of letters to display for each result
  $result = '';
      if ($pos !== false) 
      {
    if ($pos < $otstup) 
    {
        $result = substr($text, 0, $otstup*2); 
        $result = eregi_replace ($whatfind,'<span style="color:red; background-color: #E9E9E9">'.$whatfind.'</span>',$result)."...";
    }
    else
    {
        $start=$pos-$otstup;
        $result = "...".substr($text, $pos-$otstup, $otstup*2)."...";
        $result = eregi_replace ($whatfind,'<span style="color:red; background-color: #E9E9E9">'.$whatfind.'</span>',$result);
    }
      }
      else
    {
    $result=substr($text, 0, $otstup*2);
    }
  return $result;
}

Part 3: options.mdu

1. Find this (line 370):

    [b]Edit Template Parts[/b]<table width="100%"><form method=post action="'.$PHP_SELF.'">
<tr> <!- start active news -->

and replace with this:

    [b]Edit Template Parts[/b]<table width="100%"><form method=post action="'.$PHP_SELF.'">';

if($do_template == 'search')
{
echo'
    <tr>
    <td height="7"  bgcolor=#F7F6F4 colspan="2">
    [b][url=j]search results[/url][/b]</tr>
    <tr id=\'active-news1\' '.$tr_hidden.'>
    <td height="9" width="200" valign="top">
    [b]{result-title}

    {result-author}

    {result-category}

    {result-cat-id}

    {result-comments}

    {result-text}

    [result-link] [/b] [b] [/result-link]

    <td height=\"9\"  valign=\"top\" width=430>
    - The title of the result

    - The author of the result

    - The category of the result 

    - The category ID of the result

    - Number of comments for the result

    - Excerpt of the news containing the search term

    - Link to the full story

    </tr>
    <tr id=\'active-news2\' '.$tr_hidden.'>
    <td height="8" colspan="2">
    <textarea rows="9" cols="98" name="search_results_act">'.$search_results.'</textarea>
    

    </tr>
    <tr>
    <td height="8"  colspan="2">
    <input type=hidden name=mod value=options>
    <input type=hidden name=action value=dosavetemplates>
    <input type=hidden name=do_template value="'.$do_template.'">
    
<input type=submit value="   Save Changes   " accesskey="s">
    </tr></form>
    </table>';
}
else {
echo '
<tr> <!- start active news -->


2. Find this:

        echofooter();
}
// ********************************************************************************
// Do Save Changes to Templates
// ********************************************************************************
elseif($action == "dosavetemplates")
{
           if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
    $templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next");
    foreach($templates_names as $template)
    {
                $$template = stripslashes($$template);
    }

    if($do_template == "" or !$do_template){ $do_template = "Default"; }
    $template_file = "./data/${do_template}.tpl";

        $handle = fopen("$template_file","w");
    fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n");
    fwrite($handle, "\$template_active = <<<HTML\n$edit_active\nHTML;\n\n\n");
        fwrite($handle, "\$template_full = <<<HTML\n$edit_full\nHTML;\n\n\n");
    fwrite($handle, "\$template_comment = <<<HTML\n$edit_comment\nHTML;\n\n\n");
    fwrite($handle, "\$template_form = <<<HTML\n$edit_form\nHTML;\n\n\n");
    fwrite($handle, "\$template_prev_next = <<<HTML\n$edit_prev_next\nHTML;\n");
    fwrite($handle, "\$template_comments_prev_next = <<<HTML\n$edit_comments_prev_next\nHTML;\n");
    fwrite($handle, "?>\n");


   
    and replace with this:
   

}
        echofooter();
}
// ********************************************************************************
// Do Save Changes to Templates
// ********************************************************************************
elseif($action == "dosavetemplates")
{
           if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
    $templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next");
    foreach($templates_names as $template)
    {
                $$template = stripslashes($$template);
    }

    if($do_template == 'search')
    {
    $template_file = "./data/${do_template}.tpl";
    $handle = fopen("$template_file","w");
    fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n");
    fwrite($handle, "\$search_results = <<<HTML\n$search_results_act\nHTML;\n");
    fwrite($handle, "?>\n");
    }

    else
    {

    if($do_template == "" or !$do_template){ $do_template = "Default"; }
    $template_file = "./data/${do_template}.tpl";

        $handle = fopen("$template_file","w");
    fwrite($handle, "<?PHP\n///////////////////// TEMPLATE $do_template /////////////////////\n");
    fwrite($handle, "\$template_active = <<<HTML\n$edit_active\nHTML;\n\n\n");
        fwrite($handle, "\$template_full = <<<HTML\n$edit_full\nHTML;\n\n\n");
    fwrite($handle, "\$template_comment = <<<HTML\n$edit_comment\nHTML;\n\n\n");
    fwrite($handle, "\$template_form = <<<HTML\n$edit_form\nHTML;\n\n\n");
    fwrite($handle, "\$template_prev_next = <<<HTML\n$edit_prev_next\nHTML;\n");
    fwrite($handle, "\$template_comments_prev_next = <<<HTML\n$edit_comments_prev_next\nHTML;\n");
    fwrite($handle, "?>\n");
}

<b>Part 4: search.tpl[/b]

In cutenews/data create a file called "search.tpl" and place inside something like this:

<?PHP
///////////////////// TEMPLATE search /////////////////////
$search_results = <<<HTML
<div align=left>[result-link]{result-title}[/result-link]</div>
<div align=left><p>{result-text}</p></div>
<table width=100%><tr><td width=50% align=left>[b]{result-category}[/b]</td><td width=50% align=right>[result-link]Read more...[/result-link]</td></tr></table><hr>

HTML;
?>

Title: Article Within Multiple Categories
Author: FI-DD
Cutenews Compatibility: 1.3.6 - 1.4.1 (higher versions have such an option built in)
Description: Post 1 article in more then 1 category
Demo: See FI-DD's homepage (in his signature)
username: demo
password: demo
Instructions: All lines refer to the unchanged cutenews 1.3.6. version of each file.
Part 1: addnews.mdu

1. Find (line 41):

    if(count($cat_lines) > 0){
  echo"<tr>
  <td width=\"75\">
  Category
  <td width=\"575\" colspan=\"2\">
  <select name=category tabindex=3>\n
        <option value=\"\"> </option>\n";
         foreach($cat_lines as $single_line){
    $cat_arr = explode("|", $single_line);
                $if_is_selected = "";
                if($category == $cat_arr[0]){ $if_is_selected = " selected "; }
                echo"<option $if_is_selected value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
      }
     echo"</select></tr>";

Replace with:

    $fp = file($cutepath.'/data/category.db.php');
    if(count($fp) > 0){
  $i = 0;
     foreach($fp as $fo){
         $cat_arr = explode('|', $fo);
            $lex_arr = explode(',', $item_db[6]);
            foreach($lex_arr as $cat_num => $cat_echo){
                if ($lex_arr[$cat_num] == $cat_arr[0]){$lex_arr[$cat_arr[0]] = $cat_arr[1];}
            }
         $echo_cat .= '
         <td style="font-size: 10px;">
         <label for="cat'.$cat_arr[0].'">
         <input type="checkbox"'.($cat_arr[1] == $lex_arr[$cat_arr[0]] ? ' checked' : '').' name="setcat['.$cat_arr[0].']" 

id="cat'.$cat_arr[0].'" class="panel" style="border: solid none #ccc;vertical-align: middle;background: transparent;">'.$cat_arr[1].'</label>';
         $i++;
         if ($i%4 == 0){$echo_cat .= '<tr>';}
  }
     echo '
     <tr>
     <td valign="top">Category:</td>
     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">'.$echo_cat.'</table>';

2. Find (line 138):

// Save The News Article In Active_News_File

    $all_db = file("./data/news.txt");

Add above:

    if (is_array($setcat))
    foreach($setcat as $cat => $set){$category .= $cat.',';}
    $category = preg_replace('{([,]+)$}', '', $category);

Part 2: editnews.mdu

1. Find (line 28):

// 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;

Replace with:

// 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);
        $cat_arr = explode(',', $raw_arr[6]);

        if (($category == "" or ($cat_arr[0] == $category or $cat_arr[1] == $category or $cat_arr[2] == $category or $cat_arr[3] == $category or $cat_arr[4] == $category or $cat_arr[5] == $category or $cat_arr[6] == $category or $cat_arr[7] == $category or $cat_arr[8] == $category or $cat_arr[9] == $category or $cat_arr[10] == $category or $cat_arr[11] == $category or $cat_arr[12] == $category or $cat_arr[13] == $category or $cat_arr[14] == $category or $cat_arr[15] == $category or $cat_arr[16] == $category or $cat_arr[17] == $category or $cat_arr[18] == $category or $cat_arr[19])) and ($author == "" or $raw_arr[1] == $author) and( $member_db[1] != 3 or $raw_arr[1] == $member_db[2] )){
             $all_db_tmp[] = $raw_line;

2. Find (line 69):

             if($item_db[6] == ""){ $my_cat = "<font color=gray>---</font>"; }
             elseif($cat[$item_db[6]] == ""){ $my_cat = "<font color=red>ID [b]$item_db[6][/b]</font>"; }
             else{ $my_cat = $cat[$item_db[6]]; }

Replace with:

     $cat_arr = explode(',', $item_db[6]);
     if (!$cat_arr[0] and !$cat_arr[1] and !$cat_arr[2] and !$cat_arr[3] and !$cat_arr[4] and !$cat_arr[5] and !$cat_arr[6] and !$cat_arr[7] and !$cat_arr[8] and !$cat_arr[9] and !$cat_arr[10] and !$cat_arr[11] and !$cat_arr[12] and !$cat_arr[13] and !$cat_arr[14] and !$cat_arr[15] and !$cat_arr[16] and !$cat_arr[17] and !$cat_arr[18] and !$cat_arr[19]){$my_cat = '[color=#gray]---[/color]';}
     elseif (!$cat[$cat_arr[0]]){$my_cat = '[color=#red]ID [b]      [/b][/color]'; }
     else {
         $my_cat = $cat[$cat_arr[0]].', '.$cat[$cat_arr[1]].', '.$cat[$cat_arr[2]].', '.$cat[$cat_arr[3]].', '.$cat[$cat_arr[4]].', '.$cat[$cat_arr[5]].', '.$cat[$cat_arr[6]].', '.$cat[$cat_arr[7]].', '.$cat[$cat_arr[8]].', '.$cat[$cat_arr[9]].', '.$cat[$cat_arr[10]].', '.$cat[$cat_arr[11]].', '.$cat[$cat_arr[12]].', '.$cat[$cat_arr[13]].', '.$cat[$cat_arr[14]].', '.$cat[$cat_arr[15]].', '.$cat[$cat_arr[16]].', '.$cat[$cat_arr[17]].', '.$cat[$cat_arr[18]].', '.$cat[$cat_arr[19]].', ';
         $my_cat = preg_replace('[([, ]+)$]', '', $my_cat);
     }

3. Find (line 427):

        echo"
           <tr>
        <td valign=middle width=\"75\" valign=\"top\">
        Category
        <td width=\"464\" colspan=\"3\">
        <select name=\"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"<option selected=\"selected\" value=\"$cat_arr[0]\">$cat_arr[1]</option>\n";
            $selected = TRUE;
                }else{ echo"<option value=\"$cat_arr[0]\">$cat_arr[1]</option>\n"; }
        }
    if(!$selected){ echo"<option selected value=\"\">     </option>"; }
    else{ echo"<option value=\"\">     </option>"; }

    echo"</select>
    <td width=\"103\" valign=\"top\">
        </tr>

Replace with:

    $fp = file($cutepath.'/data/category.db.php');
    if(count($fp) > 0){
  $i = 0;
     foreach($fp as $fo){
         $cat_arr = explode('|', $fo);
            $lex_arr = explode(',', $item_db[6]);
            foreach($lex_arr as $cat_num => $cat_echo){
                if ($lex_arr[$cat_num] == $cat_arr[0]){$lex_arr[$cat_arr[0]] = $cat_arr[1];}
            }
         $echo_cat .= '
         <td style="font-size: 10px;">
         <label for="cat'.$cat_arr[0].'">
         <input type="checkbox"'.($cat_arr[1] == $lex_arr[$cat_arr[0]] ? ' checked' : '').' name="setcat['.$cat_arr[0].']" 

id="cat'.$cat_arr[0].'" class="panel" style="border: solid none #ccc;vertical-align: middle;background: transparent;">'.$cat_arr[1].'</label>';
         $i++;
         if ($i%4 == 0){$echo_cat .= '<tr>';}
  }
     echo '
     <tr>
     <td valign="top">Category:</td>
     <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="panel">'.$echo_cat.'</table>';
    }
    echo "</td></tr>

4. Find (line 653):

                    $okchanges = TRUE;


Add below:

                        if (is_array($setcat))
    foreach($setcat as $cat => $set){$category .= $cat.',';}
    $category = preg_replace('{([,]+)$}', '', $category);

Part 3: shows.inc.php

1. Find (line 281):

                        $output = str_replace("{title}", $news_arr[2], $template_full);

Add below:

                            if ($news_arr[6]){
     $cat_arr = explode(',', $news_arr[6]);
     foreach($cat_arr as $cats){
         
          $news_arr[6] = $cat_arr[0];
          $cat_all .= '[url=]'.$cat[$cats].'[/url], ';
         }
     $cat_all = preg_replace('{, $}', '', $cat_all);
    }
                        $output = str_replace('{category}', $cat_all, $output);

2. Find (line 298):

                                $output = str_replace("[com-link]","[url=]$news_arr[6]&$user_query\">", $output);

Replace with:

                                $output = str_replace("[com-link]","<a 
href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=
$news_arr[6]\">", $output);

3. Find (line 483):

                        if($requested_cats and $requested_cats[$news_arr[6]] == TRUE){ $count_all ++; }

Replace with:

                        $cat_arr = explode(",", $news_arr[6]);

            if($requested_cats and ($requested_cats[$cat_arr[0]] or $requested_cats[$cat_arr[1]] or $requested_cats[$cat_arr[2]] or $requested_cats[$cat_arr[3]] or $requested_cats[$cat_arr[4]] or $requested_cats[$cat_arr[5]] or $requested_cats[$cat_arr[6]] or $requested_cats[$cat_arr[7]] or $requested_cats[$cat_arr[8]] or $requested_cats[$cat_arr[9]] or $requested_cats[$cat_arr[10]] or $requested_cats[$cat_arr[11]] or $requested_cats[$cat_arr[12]] or $requested_cats[$cat_arr[13]] or $requested_cats[$cat_arr[14]] or $requested_cats[$cat_arr[15]] or $requested_cats[$cat_arr[16]] or $requested_cats[$cat_arr[17]] or $requested_cats[$cat_arr[18]] or $requested_cats[$cat_arr[19]]) == TRUE){ $count_all ++; }

4. Find (line 497):

                if($category and $requested_cats[$news_arr[6]] != TRUE){ continue; }

Replace with:

     $cat_arr = explode(",", $news_arr[6]);
     if ($category and ($requested_cats[$cat_arr[0]] or $requested_cats[$cat_arr[1]] or $requested_cats[$cat_arr[2]] or $requested_cats[$cat_arr[3]] or $requested_cats[$cat_arr[4]] or $requested_cats[$cat_arr[5]] or $requested_cats[$cat_arr[6]] or $requested_cats[$cat_arr[7]] or $requested_cats[$cat_arr[8]] or $requested_cats[$cat_arr[9]] or $requested_cats[$cat_arr[10]] or 
$requested_cats[$cat_arr[11]] or $requested_cats[$cat_arr[12]] or $requested_cats[$cat_arr[13]] or $requested_cats[$cat_arr[14]] or 
$requested_cats[$cat_arr[15]] or $requested_cats[$cat_arr[16]] or $requested_cats[$cat_arr[17]] or $requested_cats[$cat_arr[18]] or $requested_cats[$cat_arr[19]]) != TRUE){continue;}

5. Find (line 507):

        $output = $template_active;

Add below:

            if ($news_arr[6]){
     $cat_arr = explode(',', $news_arr[6]);
     foreach($cat_arr as $cats){
          $news_arr[6] = $cat_arr[0];
          $cat_all .= '<a href="'.$config_http_home_url.'?category='.$cats.'">'.$cat[$cats].'[/url], ';
         }
     $cat_all = preg_replace('{, $}', '', $cat_all);
    }
    $output = str_replace('{category}', $cat_all, $output);
    unset($cat_all);

6. Find (line 514):

        $output = str_replace("[link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);

Replace with:

        $output = str_replace("[link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]\">", $output);

7. Find (line 547):

                    $output = str_replace("[full-link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);

Replace with:

                    $output = str_replace("[full-link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]\">", $output);

8. Find (line 557):

                        $output = str_replace("[com-link]","<a href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);

Replace with:

                        $output = str_replace("[com-link]","<a href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]\">", $output);

That's it!

Pawel,Apr 13 2005, 05:49 PM wrote:

I think, there should be a function in Article Options, when you are adding or editing news, not to take new lines into account, but only when you insert
tag.
[right][snapback]37443[/snapback][/right]

It's already available in cutenews 1.3.6  smile

When adding oder editing news click on options and uncheck [Convert new lines to
]

Also, it would be nice for the article author to receive email when a commented is added to a story.


https://cutephp.com/forum/index.php?showtopic=4630