$all_active_db = file(SERVDIR . "/cdata/unapproved_news.txt"); $active_news_file = fopen(SERVDIR . "/cdata/unapproved_news.txt", "w"); flock($active_news_file, LOCK_EX); fwrite($active_news_file, $old_db_line); foreach ($all_active_db as $active_line) { fwrite($active_news_file, $active_line); } flock($active_news_file, LOCK_UN); fclose($active_news_file); $unapproved_count++; } } flock($new_db, LOCK_UN); fclose($new_db); if ($returnto == 'edit' && $id) { relocation("{$PHP_SELF}?mod=editnews&action=editnews&id={$id}&source=unapproved&saved=yes"); } msg('info', lang("Well done"), lang('Selected news <b>(%1)</b> were unapproved', $unapproved_count)); } elseif ($action == "mass_move_to_cat") { if (!$selected_news) { msg("error", lang('Error!'), lang("You have not specified any articles"), "#GOBACK"); } $CSRF = CSRFMake(); echoheader("options", lang("Move Articles to Category")); echo "<form action=\"{$PHP_SELF}\" method=post><table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr><td >Move selected articles (<b>" . count($selected_news) . "</b>) to category:"; echo '<table width="80%" border="0" cellspacing="0" cellpadding="0" class="panel">'; foreach ($cat_lines as $single_line) { $i++; $cat_arr = explode("|", $single_line); echo "<td style='font-size:10px;' valign=top>\n <label for='cat{$cat_arr[0]}'>\n <input {$if_is_selected} style='background-color:transparent;border:0px;' type=checkbox name='category[]' id='cat{$cat_arr[0]}' value='{$cat_arr[0]}'>{$cat_arr['1']}</label>"; if ($i % 4 == 0) {
echo "</table></td></tr>"; hook('field_options_additional'); echo "\n <input type=hidden id=currentid name=current value=general>\n <input type=hidden name=mod value=options>\n <input type=hidden name=action value=dosavesyscon>" . showRow("", "", "<br /><input style='font-weight:bold;font-size:120%;' type=submit value=\" Save Changes \" accesskey=\"s\">") . "\n </form></table>"; // select tabs ---------------- echo <<<HTML <script type="text/javascript"> var iof = document.location.toString(); if (iof.indexOf('#') > 0) ChangeOption(iof.substr(iof.indexOf('#') + 1)); </script> HTML; echofooter(); } elseif ($action == "dosavesyscon") { // Sanitize skin var $save_con["skin"] = preg_replace('~[^a-z0-9_.]~i', '', $save_con["skin"]); if (!file_exists(SERVDIR . "/skins/" . $save_con["skin"] . ".skin.php")) { $save_con['skin'] = 'default'; } if ($member_db[UDB_ACL] != 1) { msg("error", lang("Access Denied"), lang("You don't have permission for this section"), '#GOBACK'); } $handler = fopen(SERVDIR . "/cdata/config.php", "w"); fwrite($handler, "<?php \n\n//System Configurations (Auto Generated file)\n"); foreach ($save_con as $name => $value) { fwrite($handler, "\$config_{$name} = \"" . htmlspecialchars($value) . "\";\n"); } fwrite($handler, "?>"); fclose($handler); relocation(PHP_SELF . '?mod=options&action=syscon&message=1#' . $_REQUEST['current']); include SERVDIR . "/skins/" . $save_con["skin"] . ".skin.php"; } hook('options_additional_actions');
<?php if (!defined('INIT_INSTANCE')) { die('Access restricted'); } hook('init_main'); // If member access level is commenter, redirect him to personal options if ($member_db[UDB_ACL] == ACL_LEVEL_COMMENTER) { relocation($config_http_script_dir . "/index.php?mod=options&action=personal"); } // ---------------------------------------- if (REQ('action', 'GET') == 'permissions') { $errors = cn_selfcheck(); if (empty($errors)) { msg('info', lang('Everything is OK'), lang('All the files are writable'), '#GOBACK'); } else { msg('info', lang('Permissions error'), proc_tpl('main/perms')); } } // Check previous versions $data_folder_exists = is_dir(SERVDIR . '/data') ? 1 : 0; // ---------------------------------------- echoheader("home", lang("Welcome")); if (!is_readable(SERVDIR . "/cdata/archives")) { die_stat(false, lang("Cannot open directory `archives` for reading, check if it exists or is properly CHMOD'ed")); } if (!is_readable(SERVDIR . "/cdata/news.txt")) { die_stat(false, lang("Cannot open file news.txt for reading, check if it exists or is properly CHMOD'ed")); } if (!is_readable(SERVDIR . "/cdata/comments.txt")) { die_stat(false, lang("Cannot open file comments.txt for reading, check if it exists or is properly CHMOD'ed"));
//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, lang("CuteNews - Unapproved article was Added"), str_replace(array('%1', '%2'), array($member_db[UDB_NAME], $title), 'The user %1 (journalist) posted article %2 which needs first to be Approved')); } } if ($postpone) { msg("info", lang("News added (Postponed)"), lang("The news item was successfully added to the database as postponed. It will be activated at") . date(" Y-m-d H:i:s", $added_time), '#GOBACK'); } elseif (empty($preview_hmtl)) { $source = ''; if (strpos($decide_news_file, 'unapproved')) { $source = '&source=unapproved'; } if (strpos($decide_news_file, 'postponed')) { $source = '&source=postponed'; } relocation($PHP_SELF . "?mod=editnews&action=editnews&id={$added_time}&saved=yes{$source}"); } } } // --------------- show add news form ------------------- $CSRF = CSRFMake(); echoheader("addnews", lang("Add News")); $short_story_id = 'short_story'; $full_story_id = 'full_story'; $_cat_html = false; $_multi_cat_html = false; $_dateD = false; $_dateM = false; $_dateY = false; $xfields = array(); // init x-fields
} // Only for present file if (!file_exists(SERVDIR . '/cdata/' . $src)) { $src = 'news.txt'; } $dbpath = SERVDIR . '/cdata/' . $src; // Search and swap lines $all_db = file($dbpath); foreach ($all_db as $i => $ln) { list($lnid) = explode('|', $ln, 2); if ($lnid == $id) { if ($direct == 'up' && $i > 0) { $a = $all_db[$i - 1]; $all_db[$i - 1] = $all_db[$i]; $all_db[$i] = $a; break; } elseif ($direct == 'down' && $i < count($all_db)) { $a = $all_db[$i + 1]; $all_db[$i + 1] = $all_db[$i]; $all_db[$i] = $a; break; } } } $w = fopen($dbpath, 'w'); fwrite($w, join('', $all_db)); fclose($w); // Redirect after move $URL = $PHP_SELF . build_uri('mod,action,id,source,start_from,news_per_page,category,author,ord_title,ord_date', array('editnews', 'list', $item_db[NEW_ID]), false); relocation($URL, false); }