<?php
include($bookdir."groups.php");
$content = "<"."?php"."\r"."$"."group_names = array(";
if (count($group_names) > 0) {
foreach ($group_names as $g) {
$content .= '"';
if ($g == $_POST['old_name']) { $content .= $_POST['new_name']; }
else { $content .= $g; }
$content .= '",'; }}
$content .= ');'."\r";
$content .= "$"."group_files = array(";
if (count($group_files) > 0) {
for ($g=0; $g<count($group_files); $g++) {
$content .= 'array(';
if ($group_names[$g] == $_POST['old_name']) {
if (isset($_POST['group_list'])) {
if (count($_POST['group_list']) > 0) {
foreach ($_POST['group_list'] as $h) { $content .= '"'.$h.'",'; }}}}
else {
if (count($group_files[$g]) > 0) {
foreach ($group_files[$g] as $h) { $content .= '"'.$h.'",'; }}}
$content .= '),'; }}
$content .= ');'."\r"."?".">";
$content = str_replace(",)",")",$content);
file_put_contents($bookdir."groups.php",$content);
?>