3){ msg("error", "Access Denied", "You don't have permission to add news"); }
if ($action == "addnews"){
$cat_lines = file("./data/category.db.php");
echoheader("addnews", "Add News");
echo "
";
echofooter();
}
// ********************************************************************************
// Do add News to news.txt
// ********************************************************************************
elseif($action == "doaddnews")
{
if($if_convert_new_lines == "yes"){ $n_to_br = TRUE; }
if($if_use_html == "yes"){ $use_html = TRUE; }
$full_story = replace_news("add", $full_story, $n_to_br, $use_html);
$short_story = replace_news("add", $short_story, $n_to_br, $use_html);
// Music hack by appelsinjuice.org
$listening_to = replace_news("add", $listening_to, $n_to_br, $use_html);
// END Music hack block
$title = replace_news("add", $title, TRUE, $use_html);
if(trim($title) == "" or !$title){ msg("error","Error !!!","The title can not be blank.", "javascript:history.go(-1)"); }
if(trim($short_story) == "" or !$short_story){ msg("error","Error !!!","The story can not be blank.", "javascript:history.go(-1)"); }
// Custom Date MOD part
if ($customdate) {
$added_time = strtotime("$c_day "."$c_month "."$c_year "."$c_hour:$c_minute");
}
else {
$added_time = time()+ ($config_date_adjust*60);
}
// end Custom Date MOD part
if($member_db[7] == 1){ $added_by_email = $member_db[5]; }
else{ $added_by_email = "none"; }
// Save The News Article In Active_News_File
$all_db = file("./data/news.txt");
foreach($all_db as $news_line){
$news_arr = explode("|", $news_line);
if($news_arr[0] == $added_time){ $added_time++; }
}
// XFields Call
$xfieldsid = $added_time;
$xfieldsaction = "init";
include("xfields.mdu");
$xfieldsaction = "save";
include("xfields.mdu");
// End XFields Call
$news_file = fopen("./data/news.txt", "w");
// Music hack by appelsinjuice.org
fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$category|$listening_to|||||\n");
// END Music hack block
foreach ($all_db as $line){ fwrite($news_file, "$line");}
fclose($news_file);
// Add Blank Comment In The Active_Comments_File
$old_com_db = file("./data/comments.txt");
$new_com_db = fopen("./data/comments.txt", "w");
fwrite($new_com_db, "$added_time|>|\n");
foreach ($old_com_db as $line){ fwrite($new_com_db, "$line");}
fclose($new_com_db);
// Increase the Number of Written News by Current User by 1
$old_user_db = file("./data/users.db.php");
$new_user_db = fopen("./data/users.db.php", w);
foreach($old_user_db as $old_user_db_line){
$old_user_db_arr = explode("|", $old_user_db_line);
if($username!=$old_user_db_arr[2]){
fwrite($new_user_db,"$old_user_db_line");
}
else
{
$countplus = $old_user_db_arr[6]+1;
fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$old_user_db_arr[4]|$old_user_db_arr[5]|$countplus|$old_user_db_arr[7]|$old_user_db_arr[8]|$old_user_db_arr[9]||\n");
}
}
fclose($new_user_db);
msg("info","News added", "The news item with id \"$added_time\" was successfully added.");
}
?>
Historical archive. This is a preserved copy of 36 Degrees Design (2005–2008), the early web-design weblog of Stuart Frisby. It is maintained independently as a piece of web history and is not operated by, affiliated with, or endorsed by Stuart Frisby. If you are the original owner and would like this domain returned, get in touch — it’s yours, no fuss.