Example #1
0
     // insert the default module settings
     // hooks
     $mods_initial = array('announcements' => 1, 'bbcode' => 1, 'editor_tools' => 1, 'event_logging' => 0, 'html' => 0, 'smtp_mail' => 0, 'modules_in_use' => 0, 'replace' => 0, 'smileys' => 1, 'spamhurdles' => 0, 'mod_tidy' => 0, 'username_restrictions' => 0);
     $hooks_initial = array('after_header' => array('mods' => array(0 => 'announcements', 1 => 'editor_tools'), 'funcs' => array(0 => 'phorum_show_announcements', 1 => 'phorum_mod_editor_tools_after_header')), 'common' => array('mods' => array(0 => 'announcements', 1 => 'editor_tools'), 'funcs' => array(0 => 'phorum_setup_announcements', 1 => 'phorum_mod_editor_tools_common')), 'before_editor' => array('mods' => array(0 => 'editor_tools'), 'funcs' => array(0 => 'phorum_mod_editor_tools_before_editor')), 'tpl_editor_before_textarea' => array('mods' => array(0 => 'editor_tools'), 'funcs' => array(0 => 'phorum_mod_editor_tools_tpl_editor_before_textarea')), 'before_footer' => array('mods' => array(0 => 'editor_tools'), 'funcs' => array(0 => 'phorum_mod_editor_tools_before_footer')), 'format' => array('mods' => array(0 => 'smileys', 1 => 'bbcode'), 'funcs' => array(0 => 'phorum_mod_smileys', 1 => 'phorum_bb_code')), 'quote' => array('mods' => array(0 => 'bbcode'), 'funcs' => array(0 => 'phorum_bb_code_quote')));
     // set initial settings
     $settings = array("title" => "Phorum 5", "description" => "Congratulations!  You have installed Phorum 5!  To change this text, go to your admin, choose General Settings and change the description", "session_timeout" => "30", "short_session_timeout" => "60", "tight_security" => "0", "session_path" => "/", "session_domain" => "", "admin_session_salt" => microtime(), "cache_users" => "0", "cache_rss" => "0", "cache_newflags" => "0", "cache_messages" => "0", "cache_css" => "1", "cache_javascript" => "1", "use_cookies" => "1", "use_bcc" => "1", "use_rss" => "1", "default_feed" => "rss", "internal_version" => "" . PHORUM_SCHEMA_VERSION . "", "internal_patchlevel" => "" . PHORUM_SCHEMA_PATCHLEVEL . "", "enable_pm" => "1", "display_name_source" => "username", "user_edit_timelimit" => "0", "enable_dropdown_userlist" => "1", "enable_moderator_notifications" => "1", "show_new_on_index" => "1", "dns_lookup" => "1", "tz_offset" => "0", "user_time_zone" => "1", "user_language" => "1", "user_template" => "0", "registration_control" => "1", "file_uploads" => "0", "file_types" => "", "max_file_size" => "", "file_space_quota" => "", "file_offsite" => "0", "system_email_from_name" => "", "hide_forums" => "1", "track_user_activity" => "86400", "track_edits" => 0, "html_title" => "Phorum", "head_tags" => "", "cache_users" => 0, "cache_newflags" => 0, "cache_messages" => 0, "redirect_after_post" => "list", "reply_on_read_page" => 1, "status" => "normal", "index_style" => PHORUM_INDEX_FLAT, "default_forum_options" => $default_forum_options, "hooks" => $hooks_initial, "mods" => $mods_initial, "mod_announcements" => array('module' => 'modsettings', 'mod' => 'announcements', 'forum_id' => 1, 'pages' => array('index' => '1', 'list' => '1'), 'number_to_show' => 5, 'only_show_unread' => NULL, 'days_to_show' => 0));
     // check for the fileinfo extension
     if (function_exists("finfo_open")) {
         $settings['file_fileinfo_ext'] = 1;
     } else {
         $settings['file_fileinfo_ext'] = 0;
     }
     $PHORUM['DB']->update_settings($settings);
     // Generate the (at this point empty) cache data for the
     // custom field handling.
     phorum_api_custom_field_rebuild_cache();
     // posting forum and test-message
     // create an announcements forum
     $forum = array("name" => 'Announcements', "active" => 1, "description" => 'Read this forum first to find out the latest information.', "template" => $default_forum_options['template'], "folder_flag" => 0, "parent_id" => 0, "list_length_flat" => $default_forum_options['list_length_flat'], "list_length_threaded" => $default_forum_options['list_length_threaded'], "read_length" => $default_forum_options['read_length'], "moderation" => $default_forum_options['moderation'], "threaded_list" => $default_forum_options['threaded_list'], "threaded_read" => $default_forum_options['threaded_read'], "float_to_top" => $default_forum_options['float_to_top'], "display_ip_address" => $default_forum_options['display_ip_address'], "allow_email_notify" => $default_forum_options['allow_email_notify'], "language" => $default_forum_options['language'], "email_moderators" => $default_forum_options['email_moderators'], "display_order" => 99, "pub_perms" => $default_forum_options['pub_perms'], "reg_perms" => $default_forum_options['reg_perms'], "inherit_id" => 0, "forum_path" => 'a:2:{i:0;s:8:"Phorum 5";i:1;s:13:"Announcements";}');
     $PHORUM['DB']->add_forum($forum);
     // create a test forum
     $forum = array("name" => 'Test Forum', "active" => 1, "description" => 'This is a test forum.  Feel free to delete it or edit after installation, using the admin interface.', "template" => $default_forum_options['template'], "folder_flag" => 0, "parent_id" => 0, "list_length_flat" => $default_forum_options['list_length_flat'], "list_length_threaded" => $default_forum_options['list_length_threaded'], "read_length" => $default_forum_options['read_length'], "moderation" => $default_forum_options['moderation'], "threaded_list" => $default_forum_options['threaded_list'], "threaded_read" => $default_forum_options['threaded_read'], "float_to_top" => $default_forum_options['float_to_top'], "display_ip_address" => $default_forum_options['display_ip_address'], "allow_email_notify" => $default_forum_options['allow_email_notify'], "language" => $default_forum_options['language'], "email_moderators" => $default_forum_options['email_moderators'], "display_order" => 0, "pub_perms" => $default_forum_options['pub_perms'], "reg_perms" => $default_forum_options['reg_perms'], "inherit_id" => 0, "forum_path" => 'a:2:{i:0;s:8:"Phorum 5";i:2;s:10:"Test Forum";}');
     $PHORUM['forum_id'] = $PHORUM['DB']->add_forum($forum);
     $PHORUM['vroot'] = 0;
     // create a test post
     $test_message = array("forum_id" => $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, "sort" => PHORUM_SORT_DEFAULT, "msgid" => '', "body" => "This is a test message. You can delete it after installation using the moderation tools. These tools will be visible in this screen if you log in as the administrator user that you created during install.\n\nPhorum 5 Team");
     $PHORUM['DB']->post_message($test_message);
     phorum_api_thread_update_metadata($test_message["thread"]);
     $PHORUM['DB']->update_forum_stats(true);
 }
 $frm = new PhorumInputForm("", "post", "Continue ->");
Example #2
0
/**
 * Restore a previously deleted custom field.
 *
 * If a custom field is deleted, it's settings and data are not deleted.
 * The field is only flagged as deleted. This function can be used for
 * reverting the delete action.
 *
 * @param int $id
 *     The id of the custom field to restore.
 *
 * @return bool
 *     TRUE if the restore was successfull or FALSE if there was an error.
 *     The functions {@link phorum_api_error_message()} and
 *     {@link phorum_api_error_code()} can be used to retrieve information
 *     about the error that occurred.
 */
function phorum_api_custom_field_restore($id)
{
    global $PHORUM;
    settype($id, "int");
    $field = $PHORUM['DB']->custom_field_config_get($id);
    if ($field !== NULL) {
        $field['deleted'] = FALSE;
        $PHORUM['DB']->custom_field_config_set($field);
        phorum_api_custom_field_rebuild_cache();
    } else {
        return phorum_api_error(PHORUM_ERRNO_NOTFOUND, "Unable to restore custom field {$id}: no configuration found.");
    }
    return TRUE;
}