$CONVERT['do_groups'] = true; } $CONVERT['do_users'] = false; // checking if the users-table exists if (phorum_convert_check_users($oldlink)) { $CONVERT['do_users'] = true; } // reading the forums $forums = phorum_convert_getForums($oldlink); // going through all the forums (and folders) echo "Writing forumdata ... {$CONVERT['lbr']}"; flush(); $offsets = array(); foreach ($forums as $forumid => $forumdata) { $newforum = phorum_convert_prepareForum($forumdata); phorum_db_add_forum($newforum); if (!$forumdata['folder']) { $PHORUM['forum_id'] = $forumid; $CONVERT['forum_id'] = $forumid; echo "Reading maximum message-id from messages-table... {$CONVERT['lbr']}"; flush(); $CONVERT['max_id'] = phorum_db_get_max_messageid(); $offsets[$forumid] = $CONVERT['max_id']; if ($forumdata['allow_uploads'] == 'Y' && file_exists($CONVERT['attachmentdir'] . "/" . $forumdata['table_name'])) { $CONVERT['attachments'] = phorum_convert_getAttachments($forumdata['table_name']); echo "Reading attachments for forum " . $forumdata['name'] . "...{$CONVERT['lbr']}"; flush(); } echo "Writing postings for forum " . $forumdata['name'] . "...{$CONVERT['lbr']}"; flush(); $count = 1;
"read_length"=>20, "moderation"=>0, "threaded_list"=>0, "threaded_read"=>0, "float_to_top"=>1, "display_ip_address"=>0, "allow_email_notify"=>1, "language"=>'english', "email_moderators"=>0, "display_order"=>0, "edit_post"=>1, "pub_perms" => 1, "reg_perms" => 15 ); $GLOBALS["PHORUM"]['forum_id']=phorum_db_add_forum($forum); $GLOBALS["PHORUM"]['vroot']=0; // create a test post $test_message=array( "forum_id" => $GLOBALS['PHORUM']["forum_id"], "thread" => 0, "parent_id" => 0, "author" => 'Phorum Installer', "subject" => 'Test Message', "email" => '', "ip" => '127.0.0.1', "user_id" => 0, "moderator_post" => 0, "closed" => 0, "status" => PHORUM_STATUS_APPROVED,
$oldfolder = array_shift($oldfolder_tmp); } else { $oldfolder = array('vroot' => 0, 'parent_id' => 0); } if (empty($error)) { unset($_POST["module"]); unset($_POST["phorum_admin_token"]); unset($_POST["vroot"]); // we set it separately below // update the folder if (defined("PHORUM_EDIT_FOLDER")) { $cur_folder_id = $_POST['forum_id']; $res = phorum_db_update_forum($_POST); // add the folder } else { $res = phorum_db_add_forum($_POST); $cur_folder_id = $res; $built_paths = phorum_admin_build_path_array($cur_folder_id); phorum_db_update_forum(array('forum_id' => $cur_folder_id, 'forum_path' => $built_paths[$cur_folder_id])); } // check for changes which require a forum-path update $setforumpath = false; if (defined("PHORUM_EDIT_FOLDER")) { if ($oldfolder['name'] != $_POST['name'] || $oldfolder['parent_id'] != $_POST['parent_id'] || $setvroot) { $setforumpath = true; } // add the folder } // other db-operations done, now doing the work for vroots if ($res) { $cur_folder_tmp = phorum_db_get_forums($cur_folder_id);
$template = array("name" => 'Announcements', "active" => 1, "description" => 'Read this forum first to find out the latest information.', "template" => 'emerald', "folder_flag" => 0, "parent_id" => 0, "list_length_flat" => 30, "list_length_threaded" => 15, "read_length" => 20, "moderation" => 0, "threaded_list" => 0, "threaded_read" => 0, "float_to_top" => 0, "display_ip_address" => 0, "allow_email_notify" => 1, "language" => ${$PHORUM}["default_forum_options"]["language"], "email_moderators" => 0, "display_order" => 99, "edit_post" => 1, "pub_perms" => 1, "reg_perms" => 3); $vroots[] = 0; // get all current forums $forums = phorum_db_get_forums(); // find the vroots foreach ($forums as $forum) { if ($forum["vroot"] == $forum["forum_id"] && $forum["folder_flag"]) { $vroots[] = $forum["forum_id"]; } } foreach ($vroots as $vroot) { // alter the template to work for this vroot $template["vroot"] = $vroot; $template["parent_id"] = $vroot; // add the new announcement forum for this vroot $forum_id = phorum_db_add_forum($template); // activate the forum in the announcements module $PHORUM["mod_announcements"]["vroot"][$vroot] = $forum_id; // update messages to the new forum_id $sql = "update {$PHORUM['message_table']} set forum_id={$forum_id}, sort=2 where forum_id={$vroot}"; phorum_db_interact(DB_RETURN_RES, $sql); // update the new forums stats $PHORUM["forum_id"] = $forum_id; phorum_db_update_forum_stats(true); } // add the hooks and functions to the module if (!in_array("announcements", $PHORUM["hooks"]["common"]["mods"])) { $PHORUM["hooks"]["common"]["mods"][] = "announcements"; } if (!in_array("phorum_setup_announcements", $PHORUM["hooks"]["common"]["funcs"])) { $PHORUM["hooks"]["common"]["funcs"][] = "phorum_setup_announcements";