/**
  * Automatically install the type if required
  *
  * For adding type specific permissions, etc.
  */
 public function auto_install()
 {
     // If you change anything in here, remember to add the reverse to the uninstall() function below!
     if (!isset(phpbb::$config['titania_num_official_tools'])) {
         if (!class_exists('umil')) {
             include PHPBB_ROOT_PATH . 'umil/umil.' . PHP_EXT;
         }
         $umil = new umil(true, phpbb::$db);
         // Permissions
         $umil->permission_add(array('u_titania_mod_official_tool_moderate'));
         // Offical Tool count holder
         $umil->config_add('titania_num_official_tools', 0, true);
     }
 }
Esempio n. 2
0
}
// If you want a completely stand alone version (able to use UMIL without messing with any of the language stuff) send true, otherwise send false
$umil = new umil(true);
if (confirm_box(true)) {
    // Install the base 0.3.0 version
    if (!$umil->config_exists('test_version')) {
        // Lets add a config setting named test_enable and set it to true
        $umil->config_add('test_enable', true);
        // We must handle the version number ourselves.
        $umil->config_add('test_version', '0.3.0');
    }
    switch ($config['test_version']) {
        // Update to 0.3.1
        case '0.3.0':
            // Now to add some permission settings.  Showing both the one at a time and "multicall" options
            $umil->permission_add('a_test_mod', true);
            $umil->permission_add(array(array('f_test_mod', false), array('u_test_mod', true)));
            // How about we give some default permissions then as well?
            $umil->permission_set(array(array('ROLE_ADMIN_FULL', 'a_test_mod'), array('ROLE_USER_FULL', 'u_test_mod'), array('GUESTS', 'u_test_mod', 'group'), array('ROLE_FORUM_STANDARD', 'f_test_mod')));
            // No breaks
            // Update to 0.7.0
        // No breaks
        // Update to 0.7.0
        case '0.3.1':
            // Lets change our test_enable to false
            $umil->config_update('test_enable', false);
            // Lets remove some of those permission settings we added before
            $umil->permission_remove(array(array('f_test_mod', false), array('u_test_mod', true)));
            // Now to add a table (this uses the layout from develop/create_schema_files.php and from phpbb_db_tools)
            $umil->table_add('phpbb_test', array('COLUMNS' => array('test_id' => array('UINT', NULL, 'auto_increment'), 'test_text' => array('VCHAR_UNI', ''), 'test_bool' => array('BOOL', 0)), 'PRIMARY_KEY' => 'test_id', 'KEYS' => array('test_bool' => array('INDEX', 'test_bool'))));
            // Update to 0.9.0
Esempio n. 3
0
 /**
  * Automatically install the type if required
  *
  * For adding type specific permissions, etc.
  */
 public function auto_install()
 {
     // If you change anything in here, remember to add the reverse to the uninstall() function below!
     if (!isset(phpbb::$config['titania_num_styles'])) {
         if (!class_exists('umil')) {
             include PHPBB_ROOT_PATH . 'umil/umil.' . PHP_EXT;
         }
         $umil = new umil(true, phpbb::$db);
         // Permissions
         $umil->permission_add(array('u_titania_mod_style_queue_discussion', 'u_titania_mod_style_queue', 'u_titania_mod_style_validate', 'u_titania_mod_style_moderate', 'u_titania_mod_style_clr'));
         // Style count holder
         $umil->config_add('titania_num_styles', 0, true);
     }
 }
}
// We only allow a founder to install this MOD
if ($user->data['user_type'] != USER_FOUNDER) {
    if ($user->data['user_id'] == ANONYMOUS) {
        login_box('', 'LOGIN');
    }
    trigger_error('NOT_AUTHORISED');
}
if (!class_exists('umil')) {
    include $phpbb_root_path . 'umil/umil.' . $phpEx;
}
$umil = new umil(true);
$mod = array('name' => $user->lang['TEST_MOD'], 'version' => '1.0.0', 'config' => 'scheduled_posts_version', 'enable' => 'scheduled_posts_enable');
if (confirm_box(true)) {
    // Install the base 1.0.0 version
    if (!$umil->config_exists($mod['config'])) {
        // Lets add a config setting for enabling/disabling the MOD and set it to true
        $umil->config_add($mod['enable'], true);
        // We must handle the version number ourselves.
        $umil->config_add($mod['config'], $mod['version']);
        $umil->permission_add(array(array('f_future_post', 0), array('m_viewfp', 0)));
        // Our final action, we purge the board cache
        $umil->cache_purge();
    }
    // We are done
    trigger_error('Done!');
} else {
    confirm_box(false, 'INSTALL_TEST_MOD');
}
// Shouldn't get here.
redirect($phpbb_root_path . $user->page['page_name']);