/**
 * Delete an emoticon.
 *
 * @param  SHORT_TEXT The ID of the emoticon to delete.
 */
function ocf_delete_emoticon($code)
{
    $old_theme_img_code = $GLOBALS['FORUM_DB']->query_value('f_emoticons', 'e_theme_img_code', array('e_code' => $code));
    $GLOBALS['FORUM_DB']->query_delete('f_emoticons', array('e_code' => $code), '', 1);
    require_code('themes2');
    tidy_theme_img_code(NULL, $old_theme_img_code, 'f_emoticons', 'e_theme_img_code');
    log_it('DELETE_EMOTICON', $code);
}
Example #2
0
/**
 * Delete a calendar event type.
 *
 * @param  AUTO_LINK		The ID of the event type
 */
function delete_event_type($id)
{
    $myrows = $GLOBALS['SITE_DB']->query_select('calendar_types', array('t_title', 't_logo'), array('id' => $id), '', 1);
    if (!array_key_exists(0, $myrows)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    $myrow = $myrows[0];
    $lowest = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT MIN(id) FROM ' . get_table_prefix() . 'calendar_types WHERE id<>' . strval($id) . ' AND id<>' . strval(db_get_first_id()));
    if (is_null($lowest)) {
        warn_exit(do_lang_tempcode('NO_DELETE_LAST_CATEGORY'));
    }
    $GLOBALS['SITE_DB']->query_update('calendar_events', array('e_type' => $lowest), array('e_type' => $id));
    $GLOBALS['SITE_DB']->query_delete('calendar_types', array('id' => $id), '', 1);
    $GLOBALS['SITE_DB']->query_delete('calendar_interests', array('t_type' => $id));
    log_it('DELETE_EVENT_TYPE', strval($id), get_translated_text($myrow['t_title']));
    delete_lang($myrow['t_title']);
    $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'calendar', 'category_name' => strval($id)));
    require_code('themes2');
    tidy_theme_img_code(NULL, $myrow['t_logo'], 'calendar_types', 't_logo');
}
Example #3
0
/**
 * Delete a news category.
 *
 * @param  AUTO_LINK		The news category to delete
 */
function delete_news_category($id)
{
    $rows = $GLOBALS['SITE_DB']->query_select('news_categories', array('nc_title', 'nc_img'), array('id' => $id), '', 1);
    if (!array_key_exists(0, $rows)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    $myrow = $rows[0];
    $min = $GLOBALS['SITE_DB']->query_value_null_ok_full('SELECT MIN(id) FROM ' . get_table_prefix() . 'news_categories WHERE id<>' . strval((int) $id));
    if (is_null($min)) {
        warn_exit(do_lang_tempcode('YOU_MUST_KEEP_ONE_NEWS_CAT'));
    }
    log_it('DELETE_NEWS_CATEGORY', strval($id), get_translated_text($myrow['nc_title']));
    delete_lang($myrow['nc_title']);
    $GLOBALS['SITE_DB']->query_update('news', array('news_category' => $min), array('news_category' => $id));
    $GLOBALS['SITE_DB']->query_delete('news_categories', array('id' => $id), '', 1);
    $GLOBALS['SITE_DB']->query_delete('news_category_entries', array('news_entry_category' => $id));
    $GLOBALS['SITE_DB']->query_delete('group_category_access', array('module_the_name' => 'news', 'category_name' => strval($id)));
    $GLOBALS['SITE_DB']->query_delete('gsp', array('module_the_name' => 'news', 'category_name' => strval($id)));
    require_code('themes2');
    tidy_theme_img_code(NULL, $myrow['nc_img'], 'news_categories', 'nc_img');
    decache('side_news_categories');
}
/**
 * Delete a usergroup.
 *
 * @param  AUTO_LINK		The ID of the usergroup to delete.
 * @param  ?GROUP			The usergroup to move primary members to (NULL: main members).
 */
function ocf_delete_group($group_id, $target_group = NULL)
{
    $orig_target_group = $target_group;
    if (is_null($target_group)) {
        $target_group = get_first_default_group();
    }
    if ($group_id == db_get_first_id() + 0 || $group_id == db_get_first_id() + 1 || $group_id == db_get_first_id() + 8) {
        fatal_exit(do_lang_tempcode('INTERNAL_ERROR'));
    }
    $_group_info = $GLOBALS['FORUM_DB']->query_select('f_groups', array('g_name', 'g_title', 'g_rank_image'), array('id' => $group_id), '', 1);
    if (!array_key_exists(0, $_group_info)) {
        warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
    }
    $_name = $_group_info[0]['g_name'];
    $_title = $_group_info[0]['g_title'];
    $name = get_translated_text($_name, $GLOBALS['FORUM_DB']);
    delete_lang($_name, $GLOBALS['FORUM_DB']);
    delete_lang($_title, $GLOBALS['FORUM_DB']);
    $GLOBALS['FORUM_DB']->query_update('f_groups', array('g_promotion_target' => NULL), array('g_promotion_target' => $group_id));
    $GLOBALS['FORUM_DB']->query_update('f_members', array('m_primary_group' => $target_group), array('m_primary_group' => $group_id));
    if (!is_null($orig_target_group)) {
        $GLOBALS['FORUM_DB']->query_update('f_group_members', array('gm_group_id' => $target_group), array('gm_group_id' => $group_id), '', NULL, NULL, false, true);
    }
    $GLOBALS['FORUM_DB']->query_delete('f_group_members', array('gm_group_id' => $group_id));
    $GLOBALS['FORUM_DB']->query_delete('f_groups', array('id' => $group_id), '', 1);
    // No need to delete ocPortal permission stuff, as it could be on any MSN site, and ocPortal is coded with a tolerance due to the forum driver system. However, to be tidy...
    $GLOBALS['SITE_DB']->query_delete('gsp', array('group_id' => $group_id));
    $GLOBALS['SITE_DB']->query_delete('group_zone_access', array('group_id' => $group_id));
    $GLOBALS['SITE_DB']->query_delete('group_category_access', array('group_id' => $group_id));
    $GLOBALS['SITE_DB']->query_delete('group_page_access', array('group_id' => $group_id));
    if (addon_installed('ecommerce')) {
        $GLOBALS['FORUM_DB']->query_delete('f_usergroup_subs', array('s_group_id' => $group_id));
    }
    require_code('themes2');
    tidy_theme_img_code(NULL, $_group_info[0]['g_rank_image'], 'f_groups', 'g_rank_image', $GLOBALS['FORUM_DB']);
    log_it('DELETE_GROUP', strval($group_id), $name);
}