} else { $t_content .= $single_line; } } if (mn_put_contents($file['templates'], $t_content) && unlink($dir['templates'] . $t_groups[$var['tmpl_group']] . '_' . $var['tmpl_type'] . '.html')) { header('location: ./mn-templates.php?back=deleted'); exit; } else { overal_header($lang['tmpl_templates'], $lang['tmpl_msg_put_contents_error'], 'error'); } } else { if (unlink($dir['templates'] . 'mn_default_' . $_POST['id'] . '.html')) { header('location: ./mn-templates.php?back=deleted'); exit; } else { overal_header($lang['tmpl_templates'], $lang['tmpl_msg_put_contents_error'], 'error'); } } } elseif (isset($_GET['action']) && $_GET['action'] == 'default') { foreach ($default_template as $d_num => $d_tmpl) { mn_put_contents($dir['templates'] . 'mn_default_' . $d_num . '.html', $d_tmpl); } header('location: ./mn-templates.php?defaults'); exit; } else { $templates_result = ''; foreach ($templates as $i) { if (!file_exists($dir['templates'] . 'mn_default_' . $i . '.html')) { continue; } else { $delete_link = in_array($i, $default_templates) ? '' : ' · <a href="./mn-templates.php?action=delete&id=' . $i . '" class="fancy">' . $lang['uni_delete'] . '</a>';
} $c_file = file($dir['comments'] . 'comments_' . $_POST['post'] . '.php'); $c_content = ''; foreach ($c_file as $c_line) { $c_data = explode(DELIMITER, $c_line); if ($c_data[0] == $_POST['id']) { continue; } else { $c_content .= $c_line; } } if (mn_put_contents($dir['comments'] . 'comments_' . $_POST['post'] . '.php', $c_content)) { header('location: ./mn-comments.php?back=deleted'); exit; } else { overal_header($lang['comm_comments'], $lang['comm_msg_put_contents_error'], 'error'); } } elseif (isset($_GET['a']) && $_GET['a'] == 'm' && isset($_GET['t']) && $_GET['t'] == $_SESSION['mn_token']) { if (isset($_GET['f']) && isset($_GET['c']) && file_exists($dir['comments'] . 'comments_' . (int) $_GET['f'] . '.php')) { $c_file = file($dir['comments'] . 'comments_' . (int) $_GET['f'] . '.php'); $c_content = ''; $status = isset($_GET['s']) && $_GET['s'] >= 0 && $_GET['s'] <= 5 ? $_GET['s'] : '2'; foreach ($c_file as $c_line) { $c_data = explode(DELIMITER, $c_line); if ($_GET['s'] == 'd' && (int) $c_data[0] == (int) $_GET['c']) { continue; } elseif ((int) $c_data[0] == (int) $_GET['c']) { $c_content .= $c_data[0] . DELIMITER . $c_data[1] . DELIMITER . $c_data[2] . DELIMITER . $status . DELIMITER . $c_data[4] . DELIMITER . $c_data[5] . DELIMITER . $c_data[6] . DELIMITER . $c_data[7] . DELIMITER . $c_data[8] . DELIMITER . $c_data[9] . DELIMITER . $c_data[10] . DELIMITER . $c_data[11] . DELIMITER . $c_data[12] . DELIMITER . $c_data[13] . DELIMITER . trim($c_data[14]) . "\n"; } else { $c_content .= $c_line; }
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit' && isset($_GET['id']) && array_key_exists($_GET['id'], $folders)) { $var = array('folder_name' => $folders[$_GET['id']]['name'], 'folder_id' => $_GET['id'], 'folder_parent' => $folders[$_GET['id']]['parent_id']); overall_header($lang['folders_edit_folder'] . ' » ' . $var['folder_name'], $lang['folders_edit_folder'], 'main'); } elseif (isset($_GET['action']) && $_GET['action'] == 'delete' && isset($_GET['id']) && array_key_exists($_GET['id'], $folders)) { $var = array('folder_name' => $folders[$_GET['id']]['name'], 'folder_id' => $_GET['id'], 'folder_parent' => $folders[$_GET['id']]['parent_id']); $admin_tmpl['folders_main'] = false; } elseif (isset($_POST['action']) && $_POST['action'] == 'delete' && isset($_POST['id']) && array_key_exists($_POST['id'], $folders)) { unset($folders[$_POST['id']]); if (mn_put_contents($file['folders'], DIE_LINE . serialize($folders))) { if (empty($folders)) { unlink($file['folders']); } header('location: ./mn-folders.php?back=deleted'); exit; } else { overal_header($lang['folders_folders'], $lang['folders_msg_put_contents_error'], 'error'); } } else { if (isset($_GET['back']) && $_GET['back'] == 'added') { overall_header($lang['folders_folders'], $lang['folders_msg_folder_added'], 'ok'); } elseif (isset($_GET['back']) && $_GET['back'] == 'canceled') { overall_header($lang['folders_folders'], $lang['folders_msg_folder_canceled'], 'info'); } elseif (isset($_GET['back']) && $_GET['back'] == 'deleted') { overall_header($lang['folders_folders'], $lang['folders_msg_folder_deleted'], 'ok'); } elseif (isset($_GET['back']) && $_GET['back'] == 'edited') { overall_header($lang['folders_folders'], $lang['folders_msg_folder_edited'], 'ok'); } else { overall_header($lang['folders_folders'], $lang['folders_folders'], 'main'); } $var['action'] = 'add'; }
} elseif (isset($_POST['action']) && $_POST['action'] == 'delete' && isset($_POST['id']) && $_POST['id'] != 1) { $u_file = file($file['users']); $u_content = ''; foreach ($u_file as $u_line) { $u_data = explode(DELIMITER, $u_line); if ($u_data[0] == $_POST['id']) { continue; } else { $u_content .= $u_line; } } if (mn_put_contents($file['users'], $u_content)) { header('location: ./mn-users.php?back=deleted'); exit; } else { overal_header($lang['cats_categories'], $lang['users_msg_put_contents_error'], 'error'); } } else { $u_file = file($file['users']); array_shift($u_file); $users_result = ''; $users = array(); $groups = load_basic_data('groups'); $posts_count = get_posts_count('users'); foreach ($u_file as $single_line) { $temp_data = explode(DELIMITER, $single_line); $users[$temp_data[0]] = $temp_data[1] . DELIMITER . $temp_data[3] . DELIMITER . $temp_data[4]; } $users = mn_natcasesort($users); foreach ($users as $user_id => $temp_data) { $u_data = explode(DELIMITER, $temp_data);
} elseif (isset($_POST['action']) && $_POST['action'] == 'delete' && isset($_POST['id']) && file_exists($file['galleries'])) { $galleries_file = file($file['galleries']); $galleries_file_content = ''; foreach ($galleries_file as $single_line) { $gallery_data = explode(DELIMITER, $single_line); if ($gallery_data[0] == $_POST['id']) { continue; } else { $galleries_file_content .= $single_line; } } if (mn_put_contents($file['galleries'], $galleries_file_content)) { header('location: ./mn-galleries.php?back=deleted'); exit; } else { overal_header($lang['galleries_galleries'], $lang['galleries_msg_put_contents_error'], 'error'); } } elseif (isset($_GET['action']) && $_GET['action'] == 'code' && isset($_GET['gal']) && is_numeric($_GET['gal'])) { $admin_tmpl['galleries_main'] = false; $admin_tmpl['code'] = true; } else { if (isset($_GET['back']) && $_GET['back'] == 'added') { overall_header($lang['galleries_galleries'], $lang['galleries_msg_gallery_added'], 'ok'); } elseif (isset($_GET['back']) && $_GET['back'] == 'deleted') { overall_header($lang['galleries_galleries'], $lang['galleries_msg_gallery_deleted'], 'ok'); } elseif (isset($_GET['back']) && $_GET['back'] == 'edited') { overall_header($lang['galleries_galleries'], $lang['galleries_msg_gallery_edited'], 'ok'); } else { overall_header($lang['galleries_galleries'], $lang['galleries_galleries'], 'main'); } $var['action'] = 'add';
} $u_file = file($file['users']); $u_content = ''; foreach ($u_file as $u_line) { $u_data = explode(DELIMITER, $u_line); if (isset($u_data[4]) && $u_data[4] == $_POST['id']) { $u_content .= $u_data[0] . DELIMITER . $u_data[1] . DELIMITER . $u_data[2] . DELIMITER . $u_data[3] . DELIMITER . trim($_POST['group_alt']) . DELIMITER . $u_data[5] . DELIMITER . $u_data[6] . DELIMITER . $u_data[7] . DELIMITER . $u_data[8] . DELIMITER . $u_data[9] . DELIMITER . $u_data[10] . DELIMITER . $u_data[11] . DELIMITER . $u_data[12] . DELIMITER . $u_data[13] . DELIMITER . $u_data[14] . DELIMITER . $u_data[15] . DELIMITER . $u_data[16] . DELIMITER . $u_data[17] . DELIMITER . $u_data[18] . DELIMITER . $u_data[19] . DELIMITER . $u_data[20] . DELIMITER . $u_data[21] . DELIMITER . $u_data[22] . DELIMITER . $u_data[23] . DELIMITER . $u_data[24] . DELIMITER . $u_data[25] . DELIMITER . $u_data[26] . DELIMITER . $u_data[27] . DELIMITER . trim($u_data[28]) . DELIMITER . $u_data[29] . DELIMITER . $u_data[30] . DELIMITER . $u_data[31] . DELIMITER . $u_data[32] . DELIMITER . trim($u_data[33]) . "\n"; } else { $u_content .= $u_line; } } if (mn_put_contents($file['groups'], $g_content) && mn_put_contents($file['users'], $u_content)) { header('location: ./mn-groups.php?back=deleted'); exit; } else { overal_header($lang['groups_groups'], $lang['groups_msg_put_contents_error'], 'error'); } } else { $g_file = file($file['groups']); array_shift($g_file); $groups_result = ''; foreach ($g_file as $g_line) { $g_data = explode(DELIMITER, $g_line); $group_id = trim($g_data[0]); if ($group_id == 1) { $groups_result .= '<tr><td><span class="main-link tooltip" title="' . $lang['groups_msg_not_editable'] . '">' . $lang['groups_default_group_1'] . '</span><br /> </td>'; } else { $groups_result .= '<tr><td><a href="./mn-groups.php?action=edit&id=' . $group_id . '" class="main-link">' . $g_data[1] . '</a><br /> <span class="links hide"><a href="./mn-groups.php?action=edit&id=' . $group_id . '">' . $lang['uni_edit'] . '</a> · <a href="./mn-groups.php?action=delete&id=' . $group_id . '" class="fancy">' . $lang['uni_delete'] . '</a></span></td>'; } for ($i = 0; $i <= 14; $i++) { $groups_result .= '<td class="c"><img src="./stuff/img/icons/permission-' . $g_data[3][$i] . '.png" alt="" width="16" height="16" class="tooltip" title="' . $lang['groups_perms_section_' . $i] . ' - ' . $lang['groups_perms_' . $g_data[3][$i]] . '" /></td>';