CuteNews

Welcome Guest ( Log In | Register )

Profile
Personal Photo
Rating
 
Options
Options
Personal Statement
NyNe doesn't have a personal statement currently.
Personal Info
NyNe
CuteHack: Core Coder
26 years old
Male
Reno, NV
Born Feb-28-1987
Interests
No Information
Statistics
Joined: 21-November 04
Profile Views: 8,222*
Last Seen: 22nd August 2009 - 08:41 PM
Local Time: May 23 2013, 05:35 PM
748 posts (0 per day)
Contact Information
AIM iX NyNe
Yahoo ixnyne
ICQ 199965748
MSN eric@nemchik.com
Contact Private
* Profile views updated each hour

NyNe

Support

***


Topics
Posts
Comments
Friends
My Content
5 Feb 2005
Name: Ensure Comm_File Validity
Author: NyNe
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description:
QUOTE
CuteNews did not added your comment because there is some problem with the comments database.
This will run through your news.txt and collect news IDs, and match them to IDs in comments.txt, if there is an ID in comments.txt thats not in news.txt it will remove the line - if there is a missing ID in comments.txt it will create a comment line so that new comments can be added.
this is very useful for those of you (like me) who have tampered with your news.txt or comments.txt and need it fixed
Instructions:
Step 1:
If your entire comments.txt is empty, make a seperate file (name it anything you want, as long as you can find it afterwards) with the .php extension naturally, wich you'll locate inside the CuteNews Root directory.
Inside put this code
CODE
<?php
echo "Done";
$news_file = "data/news.txt";
$comm_file = "data/comments.txt";
//CODE FROM STEP 3 HERE//
?>
In the case of a completly empty comments.txt this is usually due to too many spam comments. So get some spam protection.
Ofcourse, having alot of news without having ever archived can cause this as well.
When you're done making this file. Go to it 1 time with your browser. The page WILL only show the word "Done".
Running this file a second time migth corrupt your comments.txt again.

Step 2:
If it's just 1 article that randomly has this problem
open ./inc/shows.inc.php
find:
CODE
//################################################################################
####################################
if($allow_comments){
add above:
the code from step 3

Step 3:
CODE
// Ensure $comm_file is valid - Start AddBlock
// build news
$news_db = file("$news_file");
foreach($news_db as $null => $news_db_line){
    $item_arr = explode("|", $news_db_line);
    $news_item[$item_arr[0]]['n'] = true;
    $news_item[$item_arr[0]]['nv'] = $item_arr[0]."|>|";
}

// build comments
$comm_db = file("$comm_file");
foreach($comm_db as $null => $comm_db_line){
    $item_arr = explode("|", $comm_db_line);
    $news_item[$item_arr[0]]['c'] = true;
    $news_item[$item_arr[0]]['cv'] = str_replace("\n", "", $comm_db_line);
}

// run validation
rsort($news_item); reset($news_item);
$fp = fopen($comm_file, "wb");
foreach($news_item as $null => $comm_item){
    if ($comm_item['n'] == true) {
if ($comm_item['c'] == true) {
    $news_comm = $comm_item['cv']."\n";
} else {
    $news_comm = $comm_item['nv']."\n";
}
fwrite($fp, $news_comm);
    }
}
fclose($fp);
// Ensure $comm_file is valid - End AddBlock
4 Feb 2005
Name: Choose Date/Time For Posts & Prospective Posting
Author: NyNe
CuteNews Compatibility: 1.3.6 - 1.4.1
Description: What This Hack Does:
This hack will add date/time selector boxes in both add and edit news.
*update: If the time you enter in either edit or add news is the same as a time already in the database it will add 1 second to the time.
*update: When adding or editing news, the news.txt and comments.txt will be sorted by order of timestamp
It will also put an option in the system config for administrators to turn prospective posting on/off.
With prospective posting on, posts that have been written with dates in the future will not display until their date.

credit to maraboli for conceptual coding
credit to fusion news for the date displaying in html forms
Instructions:

open ./inc/options.mdu
find:
CODE
showRow("Reverse News", "if yes, older news will be shown on the top", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[reverse_active]", "$config_reverse_active"));

add below:
CODE
// <!-- Start ModifyTime v2.0 -->
        showRow("Prospective Posting", "news in the future does not display until its date", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[prospective_posting]", "$config_prospective_posting"));
// <!-- End ModifyTime v2.0 -->



open ./data/config.php
find:
CODE
$config_reverse_active = "no";

add under: (change yes to no if you'd like it turned off, can be changed from system config later)
CODE
$config_prospective_posting = "yes";



open ./inc/shows.inc.php
find:
CODE
if($category and $requested_cats[$news_arr[6]] != TRUE){ continue; }

add above:
CODE
// <!-- Start ModifyTime v2.0 -->
if ($config_prospective_posting == "yes") { $current_date = date("U"); if ($news_arr[0] > $current_date) { continue; } }
// <!-- End ModifyTime v2.0 -->



open ./inc/addnews.mdu
find:
CODE
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to add news"); }

add under:
CODE
// <!-- Start ModifyTime v2.0 -->
$months = array('01'=>'January', '02'=>'February', '03'=>'March', '04'=>'April', '05'=>'May', '06'=>'June', '07'=>'July', '08'=>'August', '09'=>'September', '10'=>'October', '11'=>'November', '12'=>'December');
if ($config_prospective_posting == "yes") { $prospective_message = "<font style=\"font-size:7pt\">(posts in the future will not be displayed until after their dates)</font>"; } else { $prospective_message = ""; }
$current_time = time()+ ($config_date_adjust*60);
// <!-- End ModifyTime v2.0 -->


find:
CODE
    echo "
    <script LANGUAGE=\"JavaScript\">
    function preview(){

add above:
CODE
// <!-- Start ModifyTime v2.0 -->
  $month = "<select size=\"1\" name=\"edit_month\">";
  for($i=1;$i<=12;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("m", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $month .= "<option value=\"$i\"$selected>".$months[$i]."</option>";
  }
  $month .= "</select>";
  $day = "<select size=\"1\" name=\"edit_day\">";
  for($i=1;$i<=31;$i++){
    if( date("j", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $day .= "<option value=\"$i\"$selected>$i</option>";
  }
  $day .= "</select>";
  $year = "<select size=\"1\" name=\"edit_year\">";
  for($i=(date("Y")-30);$i<=(date("Y")+30);$i++){
    if( date("Y", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $year .= "<option value=\"$i\"$selected>$i</option>";
  }
  $year .= "</select>";
  $hour = "<select size=\"1\" name=\"edit_hour\">";
  for($i=0;$i<=23;$i++){
    if( date("G", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $hour .= "<option value=\"$i\"$selected>$i</option>";
  }
  $hour .= "</select>";
  $min = "<select size=\"1\" name=\"edit_min\">";
for($i=0;$i<=59;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("i", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $min .= "<option value=\"$i\"$selected>$i</option>";
  }
  $min .= "</select>";
  $sec = "<select size=\"1\" name=\"edit_sec\">";
  for($i=0;$i<=59;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("s", $current_time) == $i )
      $selected = " selected";
    else
      $selected = "";
    $sec .= "<option value=\"$i\"$selected>$i</option>";
  }
  $sec .= "</select>";
// <!-- End ModifyTime v2.0 -->


find:
CODE
<form method=post name=addnews action=\"$PHP_SELF\">

add below:
CODE
<!-- Start ModifyTime v2.0 -->
       <tr>
       <td valign=middle width=\"75\">
       Date:
       <td width=\"571\" colspan=\"7\">
       $month$day$year
       </tr>
       <tr>
       <td valign=middle width=\"75\">
       Time:
       <td width=\"571\" colspan=\"7\">
       $hour:$min:$sec $prospective_message
       </tr>
<!-- End ModifyTime v2.0 -->


find:
CODE
$added_time = time()+ ($config_date_adjust*60);

replace with:
CODE
    // <!-- Start ModifyTime v2.0 -->
    $added_time = strtotime("$edit_day ".$months[$edit_month]." $edit_year $edit_hour:$edit_min:$edit_sec");
    // <!-- End ModifyTime v2.0 -->


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

add under:
CODE
// <!-- Start ModifyTime v2.0 -->
    rsort($all_db); reset($all_db);
// <!-- End ModifyTime v2.0 -->


find:
CODE
foreach ($all_db as $line){ fwrite($news_file, "$line");}

replace with:
CODE
// <!-- Start ModifyTime v2.0 -->
rsort($all_db);  reset($all_db);
foreach ($all_db as $null => $line){ fwrite($news_file, "$line");}
// <!-- End ModifyTime v2.0 -->


find:
CODE
    fwrite($new_com_db, "$added_time|>|\n");
    foreach ($old_com_db as $line){ fwrite($new_com_db, "$line");}

replace with:
CODE
// <!-- Start ModifyTime v2.0 -->
    fwrite($new_com_db, "$added_time|>|\n");
    rsort($old_com_db);  reset($old_com_db);
    foreach ($old_com_db as $null => $line){ fwrite($new_com_db, "$line");}
// <!-- End ModifyTime v2.0 -->



open ./inc/editnews.mdu
find:
CODE
if($member_db[1] > 3){ msg("error", "Access Denied", "You don't have permission to edit news"); }

add under:
CODE
// <!-- Start ModifyTime v2.0 -->
$months = array('01'=>'January', '02'=>'February', '03'=>'March', '04'=>'April', '05'=>'May', '06'=>'June', '07'=>'July', '08'=>'August', '09'=>'September', '10'=>'October', '11'=>'November', '12'=>'December');
if ($config_prospective_posting == "yes") { $prospective_message = "<font style=\"font-size:7pt\">(posts in the future will not be displayed until after their dates)</font>"; } else { $prospective_message = ""; }
// <!-- End ModifyTime v2.0 -->


find:
CODE
    echo"
    <script LANGUAGE=\"JavaScript\">
        function preview(){

add above:
CODE
// <!-- Start ModifyTime v2.0 -->
  $month = "<select size=\"1\" name=\"edit_month\">";
  for($i=1;$i<=12;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("m", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $month .= "<option value=\"$i\"$selected>".$months[$i]."</option>";
  }
  $month .= "</select>";
  $day = "<select size=\"1\" name=\"edit_day\">";
  for($i=1;$i<=31;$i++){
    if( date("j", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $day .= "<option value=\"$i\"$selected>$i</option>";
  }
  $day .= "</select>";
  $year = "<select size=\"1\" name=\"edit_year\">";
  for($i=(date("Y")-30);$i<=(date("Y")+30);$i++){
    if( date("Y", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $year .= "<option value=\"$i\"$selected>$i</option>";
  }
  $year .= "</select>";
  $hour = "<select size=\"1\" name=\"edit_hour\">";
  for($i=0;$i<=23;$i++){
    if( date("G", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $hour .= "<option value=\"$i\"$selected>$i</option>";
  }
  $hour .= "</select>";
  $min = "<select size=\"1\" name=\"edit_min\">";
for($i=0;$i<=59;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("i", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $min .= "<option value=\"$i\"$selected>$i</option>";
  }
  $min .= "</select>";
  $sec = "<select size=\"1\" name=\"edit_sec\">";
  for($i=0;$i<=59;$i++){
    if( $i < 10 ) $i = '0'.$i;
    if( date("s", $item_db[0]) == $i )
      $selected = " selected";
    else
      $selected = "";
    $sec .= "<option value=\"$i\"$selected>$i</option>";
  }
  $sec .= "</select>";
// <!-- End ModifyTime v2.0 -->


find:
CODE
        <td valign=middle width=\"75\">
        Info.
        <td width=\"571\" colspan=\"6\">
        Posted on $newstime by $item_db[1]

replace with:
CODE
<!-- Start ModifyTime v2.0 -->
        <tr>
        <td valign=middle width=\"75\">
        Info.
        <td width=\"571\" colspan=\"6\">
        Posted on $newstime by $item_db[1]
        </tr>
        <tr>
        <td valign=middle width=\"75\">
        Date:
        <td width=\"571\" colspan=\"7\">
        $month$day$year
        </tr>
        <tr>
        <td valign=middle width=\"75\">
        Time:
        <td width=\"571\" colspan=\"7\">
        $hour:$min:$sec $prospective_message
        </tr>
        <input type=hidden name=pass_time value=$item_db[0]>
<!-- End ModifyTime v2.0 -->


find:
CODE
fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$category||\n");

replace with:
CODE
//<!-- Start ModifyTime v2.0 -->
$converted_input_date=strtotime("$edit_day ".$months[$edit_month]." $edit_year $edit_hour:$edit_min:$edit_sec");
$all_db = file("./data/news.txt"); rsort($all_db); reset($all_db);
foreach($all_db as $null => $news_line){ $news_arr = explode("|", $news_line); if($news_arr[0] == $converted_input_date){ $converted_input_date++; } }
if ($disable_comments != 1) $disable_comments = 0;
fwrite($new_db,"$converted_input_date|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$category||\n");
$ccf=""; $converted_com_file = file($com_file);
for ($c = 0; $c < sizeof($converted_com_file); $c++) {$ccf=$ccf.$converted_com_file[$c];}
$fp = fopen($com_file, "wb"); fwrite($fp, str_replace($pass_time,$converted_input_date,$ccf)); fclose($fp);
//<!-- End ModifyTime v2.0 -->


find:
CODE
fclose($new_db);

add under:
CODE
//<!-- Start ModifyTime v2.0 -->
  $sorted_news = file("./data/news.txt"); sort($sorted_news); reset($sorted_news);
  foreach ($sorted_news as $null => $sorted_news_line) {
      $sorted_news_output = str_replace("\n", "", $sorted_news_line)."\n".$sorted_news_output;
  }
  $fp = fopen($news_file, "wb"); fwrite($fp, $sorted_news_output); fclose($fp);
//<!-- End ModifyTime v2.0 -->


find:
CODE
msg("info","Changes Saved","The changes were successfully saved", "$PHP_SELF?mod=editnews&action=editnews&id=$id&source=$source");

replace with:
CODE
// <!-- Start ModifyTime v2.0 -->
msg("info","Changes Saved","The changes were successfully saved", "$PHP_SELF?mod=editnews&action=editnews&id=$converted_input_date&source=$source");
// <!-- End ModifyTime v2.0 -->


and you're done!
15 Jan 2005
Name: Mail On Comments
Author: NyNe
CuteNews Compatibility: 1.3.6 (higher version have this option build in)
Description: Whenever someone makes a comment, you'll receive an email.
Requirements: CuteMail Hack
Instructions:

open ./inc/options.mdu
find:
CODE
     $registrationdate
     </tr>

add below:
CODE
<!--// MailOnComment v1.1 - Start AddBlock-->
"; if(trim($member_db[10]) == 1){ $mail_com = "checked"; }
if($member_db[1] != 4){echo"<tr>
<td height=\"21\" width=\"200\" bgcolor=#F7F6F4>
              mail on comments
<td height=\"21\" width=\"400\" bgcolor=#F7F6F4 >
<input type=checkbox value=\"1\" name=change_mail_on_comment $mail_com>    when someone comments you will recieve an e-mail
</tr>"; }else{ $bg = "bgcolor=#F7F6F4"; } echo "
<!--// MailOnComment v1.1 - End AddBlock-->

find:
CODE
        showRow("Admin Email", "used as sender of mail, if blank mail will be from webmaster@yourdomain", "<input type=text style=\"text-align: center;\"  name='save_con[mail_admin_address]' value='$config_mail_admin_address' size=40>");

add below:
CODE
// MailOnComment v1.1 - Start AddBlock
        showRow("Admin MailOnComment", "admin should always recieve mail when any user comments", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[mail_admin_comments]", "$config_mail_admin_comments"));
// MailOnComment v1.1 - End AddBlock


open ./inc/addnews.mdu
find:
CODE
<input style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked> Convert new lines to <br />

add in front of it: (so you get the    on the same line - it might already be there)
CODE
<!--// MailOnComment v1.1 - Start AddBlock-->
"; if(trim($member_db[10]) == 1){ $mail_com = "checked"; } echo "
  <input style=\"border:0; background-color:transparent\" type=checkbox value=\"1\" name=\"mail_on_comment\" $mail_com> Recieve mail when this post is commented on<br>
<!--// MailOnComment v1.1 - End AddBlock-->
  

find:
CODE
fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$category||\n");

replace with:
CODE
// MailOnComment v1.1 - Start ChangeBlock
if ($mail_on_comment != 1) $mail_on_comment = 0;
fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$category|$mail_on_comment||\n");
// MailOnComment v1.1 - End ChangeBlock


open ./inc/editnews.mdu
find:
CODE
fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$category||\n");

replace with:
CODE
   // MailOnComment v1.1 - Start ChangeBlock
   if ($mail_on_comment != 1) $mail_on_comment = 0;
   fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$title|$short_story|$full_story|$editavatar|$category|$mail_on_comment||\n");
   // MailOnComment v1.1 - End ChangeBlock

find:
CODE
<option title="delete all selected news" value="mass_delete">Delete</option>

add below:
CODE
<!--// MailOnComment v1.1 - Start AddBlock-->
<option title="enable/disable mail on comments for selected news" value="mass_mail_comments">Enable/Disable Mail on Comments</option>
<!--// MailOnComment v1.1 - End AddBlock-->

find:
CODE
<input style=\"border:0; background-color:transparent\" type=checkbox value=\"yes\" name=\"if_convert_new_lines\" checked> Convert new lines to <br />

add in front of it: (so you get the    on the same line - it might already be there)
CODE
<!--// MailOnComment v1.1 - Start AddBlock-->
"; if(trim($item_db[7]) == 1){ $mail_com = "checked"; } echo "
  <input style=\"border:0; background-color:transparent\" type=checkbox value=\"1\" name=\"mail_on_comment\" $mail_com> Recieve mail when this post is commented on<br>
<!--// MailOnComment v1.1 - End AddBlock-->
  


open ./inc/massactions.mdu
find:
CODE
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  If No Action Is Choosed
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

add above:
CODE
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Mass MailOnComments v1.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "mass_mail_comments"){

if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }

echoheader("options", "Enable/Disable Mail On Comments");

echo "<form action=\"$PHP_SELF\" method=post><table border=0 cellpading=0 cellspacing=0 width=100% height=100%><tr><td><select name=mail_comments><option value=\"1\">Enable</option><option value=\"0\">Enable</option></select> mail on comments for these <b>".count($selected_news)."</b> posts?";

foreach($selected_news as $null => $newsid){
    echo "<input type=hidden name=selected_news[] value=\"$newsid\">";
}

echo " <input type=hidden name=action value=\"do_mass_mail_comments\"><input type=hidden name=source value=\"$source\"><input type=hidden name=mod value=\"massactions\"> <input type=submit value=\"Change\"></td></tr></table></form>";

echofooter();
exit;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  DO Mass MailOnComments 1.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
elseif($action == "do_mass_mail_comments"){
if(!$selected_news){ msg("error", "Error", "You have not specified any articles", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
if($source == ""){ $news_file = "./data/news.txt";}
else{ $news_file = "./data/archives/$source.news.arch"; }
    $changed_articles = 0;
    $old_db = file("$news_file");
    $new_db = fopen("$news_file", w);
    foreach($old_db as $null => $old_db_line){
  $old_db_arr = explode("|", $old_db_line);
  if(@!in_array($old_db_arr[0], $selected_news)){
   fwrite($new_db,"$old_db_line");
         }
         else
            {
    $have_perm = 0;
       if(($member_db[1] == 1) or ($member_db[1] == 2)){$have_perm = 1;}
       elseif($member_db[1] == 3 and $old_db_arr[1] == $member_db[2]) {$have_perm = 1;}
    if(!$have_perm){ fwrite($new_db,"$old_db_line"); }
                else{
                 fwrite($new_db,"$old_db_arr[0]|$old_db_arr[1]|$old_db_arr[2]|$old_db_arr[3]|$old_db_arr[4]|$old_db_arr[5]|$old_db_arr[6]|$mail_comments||\n");
                 $changed_articles ++;
                }
   }
    }
    fclose($new_db);
if(count($selected_news) == $changed_articles){ msg("info", "News Changed", "All articles that you selected ($changed_articles) were changed successfully", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
else{ msg("error", "News Changed (with errors)", "Only $changed_articles of ".count($selected_news)." articles that you selected were changed successfully", "$PHP_SELF?mod=editnews&action=list&source=$source"); }
}


open ./inc/shows.inc.php
find:
CODE
//################################################################################
####################################
//                         Add Comment
//################################################################################
####################################

add above:
CODE
//################################################################################
####################################
//                         Check for MailOnComment v1.1
//################################################################################
####################################
$all_news = file("$news_file");
    while (list(, $news_data) = each($all_news)){
    $news_data = explode("|",$news_data);
    if(($id == $news_data[0]) && ($news_data[7] == 1)){
  $mail_on_comment_run = TRUE;
  while (list(, $user) = each($all_users)){
   $user_arr = explode("|",$user);
   if ($news_data[1] == $user_arr[2]) {
    $mail_on_comment_address = $user_arr[5];
   }
  }
    }
}

find:
CODE
            $found = TRUE;
        }else{
                        fwrite($new_comments, $old_comments_line);[/quote]
add above:
[code]// MailOnComment v1.1 - Start AddBlock
if ($mail_on_comment_run == true) {
$all_news = file("$news_file");
while (list(, $news_data) = each($all_news)){
    $news_arr = explode("|",$news_data);
    if ($news_arr[0] == $old_comments_arr[0] && isset($news_arr[2]) && $news_arr[2] != "") {
  $mail_comment = html_entity_decode(preg_replace(array("'<br />'", "'<br>'", "'|'", "'\\''"), array("\n", "\n", "|", "\'"), $comments), ENT_QUOTES);
  $mail_name = html_entity_decode(preg_replace(array("'|'", "'\\''"), array("|", "\'"), $name), ENT_QUOTES);
  $mail_title = html_entity_decode(preg_replace(array("'|'", "'\\''"), array("|", "\'"), $news_arr[2]), ENT_QUOTES);
  $send_them_mail = "";
  if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail)){ $send_them_mail = "\n Send them mail: $mail"; }
  cute_mail($mail_on_comment_address, "Your post has received a comment", "$mail_name has commented on your post: \n $mail_title $send_them_mail \n\n Comment: \n $mail_comment");
  if ($config_mail_admin_comments == "yes") { cute_mail($config_mail_admin_address, "$news_arr[1]'s post has received a comment", "$mail_name has commented on $news_arr[1]'s post: \n $mail_title $send_them_mail \n\n Comment: \n $mail_comment"); }
    }
}}
// MailOnComment v1.1 - End AddBlock
14 Jan 2005
Name: Different Image Directories For Each User
Author: Sandro & NyNe
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Give each user his own folder where he may upload/use images. Admin has full rights.
Instructions:

open ./data/config.php
find:
CODE
?>

add above:
CODE
$config_path_image_upload = "./data/upimages";

$config_user_image_upload = "yes";

$config_user_image_delete = "yes";


open ./inc/options.mdu
find:
CODE
   echo"
   <input type=hidden name=mod value=options>
   <input type=hidden name=action value=dosavesyscon>".

add above:
CODE
       showRow("Image Directory", "folder where images will be saved", "<input type=text style=\"text-align: center;\"  name='save_con[path_image_upload]' value='".str_replace("/".$username, "", $config_path_image_upload)."' size=40>");

       showRow("User Image Directories", "if yes, users keep their images in their own image directories", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[user_image_upload]", "$config_user_image_upload"));

       showRow("Users Can Delete Images", "if yes, users can delete images", makeDropDown(array("yes"=>"Yes","no"=>"No"), "save_con[user_image_delete]", "$config_user_image_delete"));

find:
CODE
                   array(
                          'name'                => "Manage Uploaded Images",
                          'url'                => "$PHP_SELF?mod=images",
                          'access'        => "1",
                   ),

replace with:
CODE
                   array(
                          'name'                => "Manage Uploaded Images",
                          'url'                => "$PHP_SELF?mod=images",
                          'access'        => "3",
                   ),


open ./inc/images.mdu
find:
CODE
if($member_db[1] > 3 or ($member_db[1] != 1 and $action == "doimagedelete")){ msg("error", "Access Denied", "You don't have permission to manage images"); }

replace with:
CODE
if($member_db[1] > 3 or ($member_db[1] != 1 and $action == "doimagedelete" and $config_user_image_delete == "no")){ msg("error", "Access Denied", "You don't have permission to manage images"); }


open ./index.php
find:
CODE
$config_path_image_upload        = "./data/upimages";

replace with:
CODE
/* DIFDU v1.0
$config_path_image_upload        = "./data/upimages"; */

find:
CODE
require_once("./data/config.php");

add below:
CODE
// Start DIFDU v1.0
if ($config_user_image_upload == "yes") { $config_path_image_upload .= "/$username"; }
// End DIFDU v1.0

find:
CODE
/* END Login Authorization using SESSIONS */
}

add below:
CODE
// Start DIFDU v1.0
if (!is_dir($config_path_image_upload) && $member_db[1] < 4) {
  mkdir($config_path_image_upload);
  @chmod($config_path_image_upload, 755);
}
// End DIFDU v1.0
9 Jan 2005
Name: show random article
Author: NyNe
CuteNews Compatibility: 1.3.6 - * (no incompatibility reported yet)
Description: Allows you to show a random article on your site. You can limit this article inside a certain category(s)
Instructions:

create a file called show_random.php in the CuteNews root folder and put this in it
CODE
<?
// show_random.php
error_reporting (E_ALL ^ E_NOTICE);
$cutepath =  __FILE__;
$cutepath = preg_replace( "'\\\show_random\.php'", "", $cutepath);
$cutepath = preg_replace( "'/show_random\.php'", "", $cutepath);
$news = file($cutepath."data/news.txt");
shuffle($news);
$i = 0;
$newsids = array();
foreach ($news as $news_line) {
$news_arr = explode("|", $news_line);
if (isset($category) && !stristr($category, $news_arr[6])) { continue; }
$newsids[$i] = $news_arr[0];
$i++;
}
$randid = mt_rand(0, count($newsids)-1);
$subaction = "showfull";
$id = $newsids[$randid];
include($cutepath."show_news.php");
?>


then include the file as if it were show_news.php like so
CODE
<?
$category = "1,2"; // whatever categories you want (or dont set any)
$template = "Headlines"; // whatever template you want (or dont set one)
include ("/cutepath/show_random.php");
?>

i dont think other variables are really too useful unless you have
hacks installed that use more

NOTE: this will display the full story of whatever article, NOT THE SHORT STORY unless you make a new template for it
Last Visitors


4 Apr 2013 - 7:16


25 Jan 2013 - 11:27


16 Dec 2012 - 21:27


4 Aug 2012 - 18:05


17 Jul 2012 - 5:18

Comments
Millar
Thanks for the posts man.
30 Apr 2010 - 22:32
abaromy
[URL=http://mysiteevaluate.com] Website price[/URL]
23 Apr 2010 - 10:38
electric griddle
Your hacks are great, the posts are really helpful. Thanks you :)
18 Apr 2010 - 10:50

Friends
There are no friends to display.
RSS Lo-Fi Version Time is now: 24th May 2013 - 12:35 AM