Example #1
0
function delete_s_file_type_extensions($content_type)
{
    $content_type = validate_content_type($content_type);
    if (is_exists_file_type($content_type)) {
        $query = "DELETE FROM s_file_type_extension " . "WHERE content_type = '{$content_type}'";
        $delete = db_query($query);
        $rows_affected = db_affected_rows();
        if ($delete && $rows_affected !== -1) {
            if ($rows_affected > 0) {
                opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, NULL, array($content_type));
            }
            return TRUE;
        } else {
            opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, db_error(), array($content_type));
            return FALSE;
        }
    } else {
        return FALSE;
    }
}
Example #2
0
            $HTTP_VARS['op'] = NULL;
        }
    }
} else {
    if ($HTTP_VARS['op'] == 'update') {
        if (is_not_empty_array($HTTP_VARS['content_type'])) {
            for ($i = 0; $i < count($HTTP_VARS['content_type']); $i++) {
                if ($HTTP_VARS['exists_ind'][$i] == 'Y') {
                    if (is_exists_file_type($HTTP_VARS['content_type'][$i])) {
                        if (!update_s_file_type($HTTP_VARS['content_type'][$i], $HTTP_VARS['content_group'][$i], $HTTP_VARS['extension'][$i], trim_explode(',', $HTTP_VARS['alt_extensions'][$i]), $HTTP_VARS['description'][$i], $HTTP_VARS['image'][$i], $HTTP_VARS['thumbnail_support_ind'][$i])) {
                            $errors[] = array('error' => 'File Type "' . $HTTP_VARS['content_type'][$i] . '" not updated.', 'detail' => db_error());
                        }
                    }
                } else {
                    if (strlen($HTTP_VARS['content_type'][$i]) > 0) {
                        if (!is_exists_file_type($HTTP_VARS['content_type'][$i])) {
                            if (!insert_s_file_type($HTTP_VARS['content_type'][$i], $HTTP_VARS['content_group'][$i], $HTTP_VARS['extension'][$i], trim_explode(',', $HTTP_VARS['alt_extensions'][$i]), $HTTP_VARS['description'][$i], $HTTP_VARS['image'][$i], $HTTP_VARS['thumbnail_support_ind'][$i])) {
                                $errors[] = array('error' => 'File Type "' . $HTTP_VARS['content_type'][$i] . '" not inserted.', 'detail' => db_error());
                            }
                        }
                    }
                }
            }
        }
        $HTTP_VARS['op'] = '';
    }
}
if (strlen($HTTP_VARS['op']) == 0) {
    if (is_not_empty_array($errors)) {
        echo format_error_block($errors);
    }