3 && $member_db[1] != 5){ msg("error", $echo['error'], $echo['moduleAccess']); } $orig_cat_lines = file("./data/category.db.php"); //only show allowed categories $allowed_cats = array(); $cat_lines = array(); foreach($orig_cat_lines as $single_line){ $ocat_arr = explode("|", $single_line); if($member_db[1] <= $ocat_arr[3] or ($ocat_arr[3] == '0' || $ocat_arr[3] == '')){ $cat_lines[] = $single_line; $allowed_cats[] = $ocat_arr[0]; } } /* long2short check */ $l2scheck = active_plugins(); $l2s = new PluginSettings('Long-2-Short'); $full2short = (int) $l2s->settings['characters']; /* long2short check end */ if ($config_catSM == " ") { $config_catMS = "display: none"; } if ($action == "addnews"){ echoheader("addnews", $echo['header']); // XFields v2.1 - addblock //$xfieldsaction = "categoryfilter"; //include("xfields.mdu"); // XFields v2.1 - End addblock $short_story_id = 'short_story'; $full_story_id = 'full_story'; // Are we using the WYSIWYG ? if($config_use_wysiwyg == "yes"){ $use_wysiwyg = true; }else{ $use_wysiwyg = false; } // END - Are we using the WYSIWYG ? echo " "; // ADD NEWS FORM echo"
".$echo['title']."
"; if($config_use_avatar == "yes"){ echo"
".$echo['avatar']." ".$echo['optional']."
"; } if ($use_wysiwyg) { echo"
".$echo['short']." "; if ($l2scheck['long-to-short.php'] == 1){ echo"

".$echo['l2s_1']." ".$full2short." ".$echo['l2s_2']."

"; } echo"
"; echo insertSmilies("$short_story_id", 14, true, "$use_wysiwyg"); echo"
"; echo quickcode2(short_story,1); echo"
"; } else { echo"
".$echo['short']." "; if ($l2scheck['long-to-short.php'] == 1){ $characters = (int) $l2s->settings['characters']; echo"

".$echo['l2s_1']." ".$characters." ".$echo['l2s_2']."

"; } if ($config_hide_inserttag == "true"){ echo inserttag(short); } echo"
"; echo insertSmilies("$short_story_id", 14, true, "$use_wysiwyg"); echo"
"; echo quickcode(short_story,0); echo"
"; } if ($use_wysiwyg) { echo"
".$echo['full']." ".$echo['optional']."
"; echo insertSmilies("$full_story_id", 14, true, "$use_wysiwyg"); echo"
"; echo quickcode2(full_story,1); echo"
"; }else{ echo"
".$echo['full']." ".$echo['optional']." "; if ($config_hide_inserttag == "true"){ echo inserttag(full); } echo"
"; echo insertSmilies("$full_story_id", 14, true, "$use_wysiwyg"); echo"
"; echo quickcode(full_story,0); echo"
"; } // XFields v2.1 - addblock $xfieldsaction = "list"; $xfieldsadd = true; include("xfields.mdu"); // XFields v2.1 - End addblock echo"
"; echo"
".$echo['optionsHeader']." "; if(count($cat_lines) > 0){ echo"
 
 [".$echo['sayList']."]
 
    "; foreach($cat_lines as $single_line){ $cat_arr = explode("|", $single_line); $if_is_selected = ""; if($category == $cat_arr[0]){ $if_is_selected = " checked "; } // echo"$cat_arr[1],\n"; echo"
  • "; $i++; } echo"
1
"; } echo"
 
$article_format_options


   \n \n   :
 
 
"; $buffer = run_actions('new-advanced-options'); if ($buffer == "") { echo " "; } else { echo"
 
"; echo $buffer; echo"
"; } echo"
"; echofooter(); } // ADD NEWS FORM // ******************************************************************************** // Do add News to news.txt // ******************************************************************************** elseif($action == "doaddnews"){ run_actions('new-validate-entry'); // Format our categories variable if( is_array($category) ){ //User has selected multiple categories $nice_category = ''; $ccount = 0; foreach($category as $ckey=>$cvalue){ if( !in_array($cvalue,$allowed_cats) ){ die('$e_falseCat'); } if($ccount==0){ $nice_category = $cvalue; }//first cat else{ $nice_category = $nice_category.','.$cvalue; } $ccount++; } } else { //Single or Not category //don't format $nice_cats because we have not selected any. if( $category !="" and isset($category) and !in_array($category,$allowed_cats) ){ die('$e_falseCat'); } $nice_category = '0'; } // die($nice_category); // 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[1] == 3 or $postpone_draft == "draft"){ //if the user is Journalist, add the article as unapproved $decide_news_file = "./data/unapproved_news.txt"; $added_time = time()+ ($config_date_adjust*60); $postpone = FALSE; $unapproved_status_msg = "".$echo['headerAddedDraftComplete'].""; } elseif($postpone_draft == "postpone"){ if( !ereg("^[[:digit:]]{1,}$", $from_date_hour) or !ereg("^[[:digit:]]{1,}$", $from_date_minutes) ){ msg("error",$echo['error'],"".$echo['badTimeFormat']."", "javascript:history.go(-1)"); } $postpone = TRUE; $added_time = mktime($from_date_hour,$from_date_minutes,0,$from_date_month,$from_date_day,$from_date_year) + ($config_date_adjust*60); $decide_news_file = "./data/postponed_news.txt"; } else{ $postpone = FALSE; $added_time = time()+ ($config_date_adjust*60); $decide_news_file = "./data/news.txt"; } $n_to_br = TRUE; $use_html = TRUE; $short_story = replace_news("add", $short_story, $n_to_br, $use_html); $full_story = replace_news("add", $full_story, $n_to_br, $use_html); // $title = replace_news("add", $title, TRUE, $use_html); $title = replace_news("add", $title, TRUE, FALSE); // HTML in title is not allowed if(trim($title) == "" or !$title){ msg("error",$echo['error'],$echo['emptyTitle'], "javascript:history.go(-1)"); } if(trim($short_story) == "" or !$short_story){ msg("error",$echo['error'],$echo['emptyArticle'], "javascript:history.go(-1)"); } if($member_db[7] == 1){ $added_by_email = $member_db[5]; } else{ $added_by_email = "none"; } run_actions('new-save-entry'); // Save The News Article In Active_News_File $all_db = file("$decide_news_file"); foreach($all_db as $news_line){ $news_arr = explode("|", $news_line); if($news_arr[0] == $added_time){ $added_time++; } } // XFields v2.1 - addblock $xfieldsid = $added_time; $xfieldsaction = "init"; include("xfields.mdu"); $xfieldsaction = "save"; include("xfields.mdu"); // XFields v2.1 - End addblock $editdate = ""; $editname = ""; $news_file = fopen("$decide_news_file", "w"); fwrite($news_file, "$added_time|$member_db[2]|$title|$short_story|$full_story|$manual_avatar|$nice_category|$editdate|$editname||\n"); 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); // Incrase By 1 The Number of Written News for Current User $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); if($member_db[1] == 3){ //user is journalist and the article needs to be approved, Notify !!! if($config_notify_unapproved == "yes" and $config_notify_status == "active"){ send_mail("$config_notify_email", "CuteNews - ".$echo['headerAddedDraft']."", "".$echo['activationReq'].""); } } if($postpone){ msg("info", $echo['headerAddedPostponed'], $echo['headerAddedPostponedComplete'].$echo['langdate']("r",$added_time)); } else{ msg("info", $echo['headerAdded'], $echo['headerAddedComplete'].$unapproved_status_msg."."); } } ?>