Ejemplo n.º 1
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     require $file_base . '/config.php';
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'user_groups ORDER BY user_group_id');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['user_group_id']))) {
             continue;
         }
         $is_super_admin = $row['admin_rights'];
         $is_super_moderator = $row['super_moderator_rights'];
         $group_name_remap = array('Unregistered' => 'Guests', 'Moderators' => 'Super-members', 'Super Moderators' => 'Super-moderators');
         if (array_key_exists($row['user_group_name'], $group_name_remap)) {
             $row['user_group_name'] = $group_name_remap[$row['user_group_name']];
         }
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['user_group_name']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['user_group_name'], 0, $is_super_admin, $is_super_moderator, $row['user_group_title'], '', NULL, NULL, NULL, constant('FLOOD_INTERVAL'), 0, $row['post_attachments'] == 0 ? 0 : 5, 5, constant('AVATAR_DIMENSIONS_MAX'), constant('AVATAR_DIMENSIONS_MAX'), 30000, 700, 25, $row['add_mana']);
         }
         // privileges
         set_specific_permission($id_new, 'vote_in_polls', $row['vote_on_polls']);
         set_specific_permission($id_new, 'use_pt', $row['pm']);
         set_specific_permission($id_new, 'submit_lowrange_content', $row['post_new_topics']);
         set_specific_permission($id_new, 'view_member_photos', $row['view_member_info']);
         set_specific_permission($id_new, 'edit_lowrange_content', $row['edit_own_posts']);
         set_specific_permission($id_new, 'add_public_events', $row['post_public_events']);
         set_specific_permission($id_new, 'view_calendar', $row['view_public_events']);
         $denies = array();
         if ($row['view_board'] == 0) {
             $denies[] = array('forumview', get_module_zone('forumview'));
         }
         if ($row['search'] == 0) {
             $denies[] = array('search', get_module_zone('search'));
         }
         foreach ($denies as $deny) {
             list($page, $zone) = $deny;
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('group_page_access', 'group_id', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             if (is_null($test)) {
                 $GLOBALS['SITE_DB']->query_insert('group_page_access', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             }
         }
         import_id_remap_put('group', strval($row['user_group_id']), $id_new);
     }
 }
Ejemplo n.º 2
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     $globals = array();
     require $file_base . '/universal.php';
     //avatar dementions are set in av_width and av_height values from aef_registry db table
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'registry WHERE ' . db_string_equal_to('name', 'av_width') . ' OR ' . db_string_equal_to('name', 'av_height') . ' OR ' . db_string_equal_to('name', 'usersiglen'));
     $INFO = array();
     foreach ($rows as $row) {
         $key = $row['name'];
         $val = $row['regval'];
         $INFO[$key] = $val;
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'user_groups WHERE post_count=-1 ORDER BY member_group');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['member_group']))) {
             continue;
         }
         $is_super_admin = $row['mem_gr_name'] == 'Administrator' ? 1 : 0;
         $is_super_moderator = $row['mem_gr_name'] == 'Universal Moderator' ? 1 : 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['mem_gr_name']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['mem_gr_name'], 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, NULL, 5, 0, 5, 5, $INFO['av_width'], $INFO['av_height'], 30000, $INFO['usersiglen']);
         }
         // privileges
         set_specific_permission($id_new, 'comcode_dangerous', true);
         $check_id_exists = $GLOBALS['FORUM_DB']->query_value_null_ok('import_id_remap WHERE id_old=' . strval($row['member_group']) . ' AND id_type=\'group\' AND id_session=' . strval(get_session_id()), 'id_old');
         if (is_null($check_id_exists)) {
             import_id_remap_put('group', strval($row['member_group']), $id_new);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'setting');
     $INFO = array();
     foreach ($rows as $row) {
         $key = $row['varname'];
         $val = $row['value'];
         if ($val == '') {
             $val = $row['defaultvalue'];
         }
         $INFO[$key] = $val;
     }
     $rows = $db->query('SELECT *,g.usergroupid AS usergroupid FROM ' . $table_prefix . 'usergroup g LEFT JOIN ' . $table_prefix . 'usergroupleader l ON g.usergroupid=l.usergroupid LEFT JOIN ' . $table_prefix . 'userpromotion p ON g.usergroupid=p.usergroupid');
     $remap_id = array();
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['usergroupid']))) {
             continue;
         }
         $row_group_leader = NULL;
         if (!is_null($row['userid'])) {
             $row_group_leader = -$row['userid'];
         }
         // This will be fixed when we import members
         $row_promotion_target = NULL;
         $row_promotion_target = $row['joinusergroupid'];
         // This will be fixed when all the usergroups are added
         $is_super_admin = ($row['adminpermissions'] & 2) != 0 ? 1 : 0;
         $is_super_moderator = ($row['adminpermissions'] & 1) != 0 ? 1 : 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['title']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['title'], 0, $is_super_admin, $is_super_moderator, $row['usertitle'], '', $row_promotion_target, $row['reputation'], $row_group_leader, 5, 0, 5, $row['attachlimit'], $row['avatarmaxwidth'], $row['avatarmaxheight'], $INFO['postmaxchars'], array_key_exists('sigmax', $INFO) ? $INFO['sigmax'] : 700);
         }
         // Zone permissions
         if (!(($row['forumpermissions'] & 1) != 0) || ($row['genericoptions'] & 32) != 0) {
             $GLOBALS['SITE_DB']->query_delete('group_zone_access', array('group_id' => $id_new));
         }
         // Page permissions
         $denies = array();
         if (($row['forumpermissions'] & 4) == 0) {
             $denies[] = array('search', get_module_zone('search'));
         }
         if (($row['forumpermissions'] & 8) == 0) {
             $denies[] = array('contactmember', get_module_zone('contactmember'));
         }
         if (($row['genericpermissions'] & 1) == 0) {
             $denies[] = array('members', get_module_zone('members'));
         }
         foreach ($denies as $deny) {
             list($page, $zone) = $deny;
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('group_page_access', 'group_id', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             if (is_null($test)) {
                 $GLOBALS['SITE_DB']->query_insert('group_page_access', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             }
         }
         // privileges
         set_specific_permission($id_new, 'comcode_dangerous', $INFO['allowhtml'] == 1);
         set_specific_permission($id_new, 'bypass_word_filter', $INFO['censorwords'] == 0);
         set_specific_permission($id_new, 'use_quick_reply', $INFO['quickreply'] == 1);
         set_specific_permission($id_new, 'vote_in_polls', ($row['forumpermissions'] & 32768) != 0);
         set_specific_permission($id_new, 'view_member_photos', ($row['genericpermissions'] & 4096) != 0);
         set_specific_permission($id_new, 'view_any_profile_field', ($row['genericpermissions'] & 262144) != 0);
         set_specific_permission($id_new, 'see_warnings', ($row['genericpermissions'] & 8) != 0);
         set_specific_permission($id_new, 'warn_members', ($row['genericpermissions'] & 16384) != 0);
         set_specific_permission($id_new, 'may_choose_custom_title', ($row['genericpermissions'] & 2048) != 0);
         $remap_id[$row['usergroupid']] = $id_new;
         import_id_remap_put('group', strval($row['usergroupid']), $id_new);
     }
     // Now we must fix promotion
     foreach ($rows as $row) {
         if (!is_null($row['joinusergroupid'])) {
             $row_promotion_target = $remap_id[$row['joinusergroupid']];
             $GLOBALS['FORUM_DB']->query_update('f_groups', array('g_promotion_target' => $row_promotion_target), array('id' => $remap_id[$row['usergroupid']]), '', 1);
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Standard import function.
  *
  * @param  object		The DB connection to import from
  * @param  string		The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT name,id FROM ' . $table_prefix . 'core_acl_aro_groups');
     $avatar_max_width = 100;
     $avatar_max_height = 100;
     foreach ($rows as $row) {
         if (import_check_if_imported('id', strval($row['id']))) {
             continue;
         }
         $is_super_admin = $row['name'] == 'Administrator' ? 1 : 0;
         $is_super_moderator = $row['name'] == 'Universal Moderator' ? 1 : 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g INNER JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['name']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['name'], 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, NULL, 5, 0, 5, 5, $avatar_max_width, $avatar_max_height, 30000);
         }
         // privileges
         if ($is_super_moderator == 1) {
             set_specific_permission($id_new, 'allow_html', true);
         }
         if (!import_check_if_imported('group', strval($row['id']))) {
             import_id_remap_put('group', strval($row['id']), $id_new);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix)
 {
     global $ADDITIONAL_DATA;
     $avatar_max_width = !empty($ADDITIONAL_DATA['avatar_max_width']) ? $ADDITIONAL_DATA['avatar_max_width'] : 100;
     //added by Duck
     $avatar_max_height = !empty($ADDITIONAL_DATA['avatar_max_height']) ? $ADDITIONAL_DATA['avatar_max_height'] : 100;
     //added by Duck
     $max_attachments_upload = !empty($ADDITIONAL_DATA['maxattachments']) ? $ADDITIONAL_DATA['maxattachments'] : 10;
     //added by Duck
     $group_leaders = array();
     $grps = $db->query('SELECT * FROM ' . $table_prefix . 'group_moderators ORDER BY id_group');
     foreach ($grps as $grp) {
         $group_leaders[$grp['id_group']] = $grp['id_member'];
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'membergroups ORDER BY id_group');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['id_group']))) {
             continue;
         }
         //Edited by Duck
         $leader = array_key_exists($row['id_group'], $group_leaders) ? $group_leaders[$row['id_group']] : NULL;
         if ($row['group_name'] == 'Administrator') {
             $group_name = 'Administrators';
         } elseif ($row['group_name'] == 'Global Moderator') {
             $group_name = 'Super-moderators';
         } else {
             $group_name = $row['group_name'];
         }
         $is_super_admin = 0;
         $is_super_moderator = 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $group_name), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($group_name, 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, $leader, 5, 0, 5, $max_attachments_upload, $avatar_max_width, $avatar_max_height, 30000);
             //Edited by Duck
         }
         // privileges
         set_specific_permission($id_new, 'allow_html', true);
         if (!import_check_if_imported('group', strval($row['id_group']))) {
             import_id_remap_put('group', strval($row['id_group']), $id_new);
         }
     }
     $this->update_group_promotions($db, $table_prefix);
 }
Ejemplo n.º 6
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'config');
     $INFO = array();
     foreach ($rows as $row) {
         $key = $row['config_name'];
         $val = $row['config_value'];
         $INFO[$key] = $val;
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'groups WHERE group_single_user=0 ORDER BY group_id');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['group_id']))) {
             continue;
         }
         $row_group_leader = NULL;
         if ($row['group_moderator'] != 0) {
             $row_group_leader = -$row['group_moderator'];
         }
         // This will be fixed when we import members
         $is_super_admin = 0;
         $is_super_moderator = 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['group_name']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['group_name'], 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, $row_group_leader, 5, 0, 5, 5, $INFO['avatar_max_width'], $INFO['avatar_max_height'], 30000, $INFO['max_sig_chars']);
         }
         // privileges
         set_specific_permission($id_new, 'comcode_dangerous', $INFO['allow_html']);
         import_id_remap_put('group', strval($row['group_id']), $id_new);
     }
 }
Ejemplo n.º 7
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     if (either_param('importer') == 'ipb1') {
         global $INFO;
         require_once $file_base . '/conf_global.php';
     } else {
         $rows = $db->query('SELECT * FROM ' . $table_prefix . 'conf_settings');
         $INFO = array();
         foreach ($rows as $row) {
             $key = $row['conf_key'];
             $val = $row['conf_value'];
             if ($val == '') {
                 $val = $row['conf_default'];
             }
             $INFO[$key] = $val;
         }
     }
     $max_post_length_comcode = $INFO['max_post_length'];
     $max_sig_length_comcode = $INFO['max_sig_length'];
     list($max_avatar_width, $max_avatar_height) = explode('x', $INFO['avatar_dims']);
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'groups');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['g_id']))) {
             continue;
         }
         list($_promotion_target, $_promotion_threshold) = explode('&', $row['g_promotion']);
         $promotion_target = intval($_promotion_target);
         $promotion_threshold = intval($_promotion_threshold);
         if ($promotion_target == -1 || $promotion_threshold == -1) {
             $promotion_target = NULL;
             $promotion_threshold = NULL;
         }
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['g_title']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group(@html_entity_decode($row['g_title'], ENT_QUOTES, get_charset()), 0, $row['g_access_cp'], $row['g_is_supmod'], '', '', $promotion_target, $promotion_threshold, NULL, $row['g_avoid_flood'] ? 0 : $row['g_search_flood'], 0, 5, 5, $max_avatar_width, $max_avatar_height, $max_post_length_comcode, $max_sig_length_comcode);
         }
         // Zone permissions
         if ($row['g_view_board'] == 0) {
             $GLOBALS['SITE_DB']->query_delete('group_zone_access', array('group_id' => $id_new));
         }
         // Page permissions
         $denies = array();
         if ($row['g_use_search'] == 0) {
             $denies[] = array('search', get_module_zone('search'));
         }
         list($_contact_member, ) = explode(':', $row['g_email_limit']);
         $contact_member = intval($_contact_member);
         if ($contact_member == 0) {
             $denies[] = array('contactmember', get_module_zone('contactmember'));
         }
         foreach ($denies as $deny) {
             list($page, $zone) = $deny;
             if (is_null($zone)) {
                 continue;
             }
             $test = $GLOBALS['SITE_DB']->query_value_null_ok('group_page_access', 'group_id', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             if (is_null($test)) {
                 $GLOBALS['SITE_DB']->query_insert('group_page_access', array('group_id' => $id_new, 'zone_name' => $zone, 'page_name' => $page));
             }
         }
         // privileges
         set_specific_permission($id_new, 'comcode_dangerous', $row['g_dohtml']);
         set_specific_permission($id_new, 'view_member_photos', $row['g_mem_info']);
         set_specific_permission($id_new, 'edit_own_midrange_content', $row['g_edit_topic']);
         set_specific_permission($id_new, 'edit_own_lowrange_content', $row['g_edit_posts']);
         set_specific_permission($id_new, 'delete_own_midrange_content', $row['g_delete_own_topics']);
         set_specific_permission($id_new, 'bypass_validation_lowrange_content', $row['g_avoid_q']);
         set_specific_permission($id_new, 'submit_midrange_content', $row['g_post_new_topics']);
         set_specific_permission($id_new, 'submit_lowrange_content', $row['g_reply_other_topics']);
         set_specific_permission($id_new, 'delete_own_lowrange_content', $row['g_delete_own_posts']);
         set_specific_permission($id_new, 'close_own_topics', $row['g_open_close_posts']);
         set_specific_permission($id_new, 'vote_in_polls', $row['g_vote_polls']);
         set_specific_permission($id_new, 'use_pt', $row['g_use_pm']);
         set_specific_permission($id_new, 'delete_account', $row['g_can_remove']);
         set_specific_permission($id_new, 'access_closed_site', $row['g_access_offline']);
         import_id_remap_put('group', strval($row['g_id']), $id_new);
     }
 }
Ejemplo n.º 8
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     require $file_base . '/Settings.php';
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'settings WHERE ' . db_string_equal_to('variable', 'avatar_max_width_upload') . ' OR ' . db_string_equal_to('variable', 'avatar_max_height_upload'));
     $INFO = array();
     foreach ($rows as $row) {
         $key = $row['variable'];
         $val = $row['value'];
         $INFO[$key] = $val;
     }
     $avatar_max_width = $INFO['avatar_max_width_upload'];
     $avatar_max_height = $INFO['avatar_max_height_upload'];
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'membergroups ORDER BY ID_GROUP');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['ID_GROUP']))) {
             continue;
         }
         $is_super_admin = $row['groupName'] == 'Administrator' ? 1 : 0;
         $is_super_moderator = $row['groupName'] == 'Global Moderator' ? 1 : 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['groupName']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['groupName'], 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, NULL, 5, 0, 5, 5, $avatar_max_width, $avatar_max_height, 30000);
         }
         // privileges
         set_specific_permission($id_new, 'allow_html', true);
         if (!import_check_if_imported('group', strval($row['ID_GROUP']))) {
             import_id_remap_put('group', strval($row['ID_GROUP']), $id_new);
         }
     }
 }
Ejemplo n.º 9
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_config($db, $table_prefix, $file_base)
 {
     $config_remapping = array('require_activation' => 'require_new_member_validation', 'board_disable' => 'site_closed', 'sitename' => 'site_name', 'site_desc' => 'site_scope', 'posts_per_page' => 'forum_posts_per_page', 'topics_per_page' => 'forum_topics_per_page', 'board_email' => 'staff_address', 'gzip_compress' => 'gzip_output', 'smtp_delivery' => 'smtp_sockets_use', 'smtp_host' => 'smtp_sockets_host', 'smtp_username' => 'smtp_sockets_username', 'smtp_password' => 'smtp_sockets_password');
     if (addon_installed('ldap')) {
         $config_remapping += array('ldap_server' => 'ldap_hostname', 'ldap_user' => 'ldap_bind_rdn', 'ldap_password' => 'ldap_bind_password');
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'config');
     $INFO = array();
     foreach ($rows as $row) {
         if ($row['config_name'] == 'require_activation') {
             if ($row['config_value'] == '2') {
                 $row['config_value'] = '1';
             } else {
                 $row['config_value'] = '0';
             }
         }
         if (array_key_exists($row['config_name'], $config_remapping)) {
             $value = $row['config_value'];
             $remapping = $config_remapping[$row['config_name']];
             if ($remapping[0] == '!') {
                 $remapping = substr($remapping, 1);
                 $value = 1 - $value;
             }
             set_option($remapping, $value);
         }
         $INFO[$row['config_name']] = $row['config_value'];
     }
     set_value('timezone', $INFO['board_timezone']);
     set_option('one_per_email_address', strval(1 - intval($INFO['allow_emailreuse'])));
     // Now some usergroup options
     $groups = $GLOBALS['OCF_DRIVER']->get_usergroup_list();
     foreach (array_keys($groups) as $id) {
         if ($GLOBALS['OCF_DRIVER']->is_super_admin($id)) {
             continue;
         }
         $GLOBALS['FORUM_DB']->query_update('f_groups', array('g_max_avatar_width' => $INFO['avatar_max_width'], 'g_max_avatar_height' => $INFO['avatar_max_height'], 'g_max_sig_length_comcode' => $INFO['max_sig_chars']), array('id' => $id), '', 1);
         set_specific_permission($id, 'own_avatars', $INFO['allow_avatar_upload'] == '1');
         set_specific_permission($id, 'rename_self', $INFO['allow_namechange'] == '1');
         set_specific_permission($id, 'bypass_word_filter', $INFO['allow_namechange'] == '1');
     }
 }
Ejemplo n.º 10
0
 /**
  * Standard import function.
  *
  * @param  object			The DB connection to import from
  * @param  string			The table prefix the target prefix is using
  * @param  PATH			The base directory we are importing from
  */
 function import_ocf_groups($db, $table_prefix, $file_base)
 {
     require $file_base . '/inc/config.php';
     $rows = $db->query_select('settings');
     $INFO = array();
     foreach ($rows as $row) {
         $key = $row['name'];
         $val = $row['value'];
         $INFO[$key] = $val;
     }
     $avatar_dimensions = explode('x', $INFO['postmaxavatarsize']);
     if (isset($avatar_dimensions[0]) && isset($avatar_dimensions[1]) && !is_null($avatar_dimensions[0]) && !is_null($avatar_dimensions[1])) {
         $avatar_max_width = intval($avatar_dimensions[0]);
         $avatar_max_height = intval($avatar_dimensions[1]);
     } else {
         $avatar_max_width = 100;
         $avatar_max_height = 100;
     }
     $rows = $db->query('SELECT * FROM ' . $table_prefix . 'usergroups ORDER BY gid');
     foreach ($rows as $row) {
         if (import_check_if_imported('group', strval($row['gid']))) {
             continue;
         }
         $is_super_admin = $row['title'] == 'Administrator' ? 1 : 0;
         $is_super_moderator = $row['title'] == 'Universal Moderator' ? 1 : 0;
         $id_new = $GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN ' . $GLOBALS['FORUM_DB']->get_table_prefix() . 'translate t ON g.g_name=t.id WHERE ' . db_string_equal_to('text_original', $row['title']), 'g.id');
         if (is_null($id_new)) {
             $id_new = ocf_make_group($row['title'], 0, $is_super_admin, $is_super_moderator, '', '', NULL, NULL, NULL, 5, 0, 5, 5, $avatar_max_width, $avatar_max_height, 30000);
         }
         // privileges
         set_specific_permission($id_new, 'allow_html', true);
         if (!import_check_if_imported('group', strval($row['gid']))) {
             import_id_remap_put('group', strval($row['gid']), $id_new);
         }
     }
 }