Beispiel #1
0
function check_postponed_date($added_time, $all_db)
{
    if (preg_match("~^" . intval($added_time) . "\\|(.*)\$~m", join('', $all_db), $match)) {
        $added_time++;
        $added_time = check_postponed_date($added_time, $all_db);
    }
    return $added_time;
}
Beispiel #2
0
     if (time() + $config_date_adjust * 60 == $added_time) {
         $added_time++;
     } else {
         $added_time = time() + $config_date_adjust * 60;
     }
     $w = fopen(SERVDIR . '/cdata/newsid.txt', 'w');
     fwrite($w, $added_time);
     fclose($w);
 }
 // Save The News Article In Active_News_File
 $all_db = file($decide_news_file);
 $news_file = fopen($decide_news_file, "w");
 flock($news_file, LOCK_EX);
 $has_added = false;
 if ($postpone) {
     $added_time = check_postponed_date($added_time, $all_db);
 }
 $add_line = "{$added_time}|{$member_db['2']}|{$title}|{$short_story}|{$full_story}|{$manual_avatar}|{$nice_category}||{$pack}|{$options}|\n";
 foreach ($all_db as $line) {
     list($ID) = explode("|", $line);
     // Add one
     if ($ID <= time() + $config_date_adjust * 60 && $has_added == false) {
         fwrite($news_file, $add_line);
         $has_added = true;
     }
     fwrite($news_file, $line);
 }
 // In any case add this news
 if ($has_added == false) {
     fwrite($news_file, $add_line);
 }
Beispiel #3
0
 $old_db_arr = explode("|", $old_db_line);
 if ($id != $old_db_arr[0]) {
     fwrite($new_db, $old_db_line);
 } else {
     $have_perm = 0;
     if ($member_db[UDB_ACL] == ACL_LEVEL_ADMIN or $member_db[UDB_ACL] == ACL_LEVEL_EDITOR) {
         $have_perm = 1;
     } elseif ($member_db[UDB_ACL] == ACL_LEVEL_JOURNALIST and $old_db_arr[NEW_USER] == $member_db[UDB_NAME]) {
         $have_perm = 1;
     }
     if ($have_perm) {
         if ($ifdelete != "yes") {
             // If save as postponed news
             if ($source == "postponed") {
                 $postponed_time = mktime($from_date_hour, $from_date_minutes, 0, $from_date_month, $from_date_day, $from_date_year);
                 $id = check_postponed_date($postponed_time, $old_db);
             } else {
                 $id = $old_db_arr[NEW_ID];
             }
             $old_db_arr[NEW_ID] = $id;
             // Only for editor without wysiwyg
             if ($config_use_wysiwyg == 'no') {
                 $old_db_arr[NEW_OPT] = edit_option($old_db_arr[NEW_OPT], 'use_html', $if_use_html == 'yes' ? 1 : 0);
             } else {
                 $old_db_arr[NEW_OPT] = str_replace("\n", "", $old_db_arr[NEW_OPT]);
             }
             fwrite($new_db, "{$old_db_arr['0']}|{$old_db_arr['1']}|{$title}|{$short_story}|{$full_story}|{$editavatar}|{$nice_category}|{$old_db_arr['7']}|{$more}|{$old_db_arr['9']}|\n");
             $okchanges = true;
         } else {
             $okdeleted = true;
             // For postponed don't delete comment: it not exists