print_form_header('profilefield', 'kill'); construct_hidden_code('profilefieldid', $vbulletin->GPC['profilefieldid']); print_table_header(construct_phrase($vbphrase['confirm_deletion_x'], htmlspecialchars_uni($vbphrase['field' . $vbulletin->GPC['profilefieldid'] . '_title']))); print_description_row($vbphrase['are_you_sure_you_want_to_delete_this_user_profile_field']); print_submit_row($vbphrase['yes'], '', 2, $vbphrase['no']); } // ###################### Start Kill ####################### if ($_POST['do'] == 'kill') { $db->query_write("\n\t\tDELETE FROM " . TABLE_PREFIX . "phrase\n\t\tWHERE fieldname = 'cprofilefield' AND\n\t\t\t\tvarname IN ('field" . $vbulletin->GPC['profilefieldid'] . "_title', 'field" . $vbulletin->GPC['profilefieldid'] . "_desc')\n\t"); require_once DIR . '/includes/adminfunctions_language.php'; build_language(); require_once DIR . '/includes/class_dbalter.php'; $db_alter = new vB_Database_Alter_MySQL($db); $db->query_write("DELETE FROM " . TABLE_PREFIX . "profilefield WHERE profilefieldid = " . $vbulletin->GPC['profilefieldid']); if ($db_alter->fetch_table_info('userfield')) { $db_alter->drop_field("field" . $vbulletin->GPC['profilefieldid']); } $db->query_write("OPTIMIZE TABLE " . TABLE_PREFIX . "userfield"); build_profilefield_cache(); define('CP_REDIRECT', 'profilefield.php?do=modify'); print_stop_message('deleted_user_profile_field_successfully'); } // ###################### Start modify ####################### if ($_REQUEST['do'] == 'modify') { // cache profile field categories $pfcs = array(0); $pfcs_result = $db->query_read("\n\t\tSELECT * FROM " . TABLE_PREFIX . "profilefieldcategory\n\t\tORDER BY displayorder\n\t"); while ($pfc = $db->fetch_array($pfcs_result)) { $pfcs["{$pfc['profilefieldcategoryid']}"] = $pfc['profilefieldcategoryid']; } $db->free_result($pfcs_result);
//remove some common resources that a product may have registered. //tags $db->query_write("\r\n\t\tDELETE tagcontent\r\n\t\tFROM " . TABLE_PREFIX . "package AS package JOIN\r\n\t\t\t" . TABLE_PREFIX . "contenttype AS contenttype ON\r\n\t\t\t\tcontenttype.packageid = package.packageid JOIN\r\n\t\t\t" . TABLE_PREFIX . "tagcontent AS tagcontent ON\r\n\t\t\t\tcontenttype.contenttypeid = tagcontent.contenttypeid\r\n\t\tWHERE productid = '{$safe_productid}'\r\n\t"); // Packages, routes, actions, contenttypes $db->query_write("\r\n\t\tDELETE package, route, action, contenttype\r\n\t\tFROM " . TABLE_PREFIX . "package AS package\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "route AS route\r\n\t\t\tON route.packageid = package.packageid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "action AS action\r\n\t\t\tON action.routeid = route.routeid\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "contenttype AS contenttype\r\n\t\t\tON contenttype.packageid = package.packageid\r\n\t\tWHERE productid = '{$safe_productid}'\r\n\t"); // Clear routes from datastore build_datastore('routes', serialize(array()), 1); //clear the type cache. vB_Cache::instance()->purge('vb_types.types'); // need to remove the language columns for this product as well require_once DIR . '/includes/class_dbalter.php'; $db_alter = new vB_Database_Alter_MySQL($db); if ($db_alter->fetch_table_info('language')) { $phrasetypes = $db->query_read("\r\n\t\t\tSELECT fieldname\r\n\t\t\tFROM " . TABLE_PREFIX . "phrasetype\r\n\t\t\tWHERE product = '" . $db->escape_string($vbulletin->GPC['productid']) . "'\r\n\t\t"); while ($phrasetype = $db->fetch_array($phrasetypes)) { $db_alter->drop_field("phrasegroup_{$phrasetype['fieldname']}"); } } delete_product($vbulletin->GPC['productid']); build_all_styles(); vBulletinHook::build_datastore($db); require_once DIR . '/includes/adminfunctions_language.php'; build_language(); build_options(); require_once DIR . '/includes/functions_cron.php'; build_cron_next_run(); build_product_datastore(); // build bitfields to remove/add this products bitfields require_once DIR . '/includes/class_bitfield_builder.php'; vB_Bitfield_Builder::save($db); // reload block types
vB_Cache::instance()->purge('vb_types.types'); // need to remove the language columns for this product as well require_once(DIR . '/includes/class_dbalter.php'); $db_alter = new vB_Database_Alter_MySQL($db); if ($db_alter->fetch_table_info('language')) { $phrasetypes = $db->query_read(" SELECT fieldname FROM " . TABLE_PREFIX . "phrasetype WHERE product = '" . $db->escape_string($vbulletin->GPC['productid']) . "' "); while ($phrasetype = $db->fetch_array($phrasetypes)) { $db_alter->drop_field("phrasegroup_$phrasetype[fieldname]"); } } delete_product($vbulletin->GPC['productid']); build_all_styles(); vBulletinHook::build_datastore($db); require_once(DIR . '/includes/adminfunctions_language.php'); build_language(); build_options(); require_once(DIR . '/includes/functions_cron.php');