Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions | Variables
php_logos.c File Reference
#include "php.h"
#include "logos.h"
#include "php_logos.h"
#include "ext/standard/info.h"
#include "SAPI.h"

Go to the source code of this file.

Classes

Defines

#define CONTENT_TYPE_HEADER   "Content-Type: "

Typedefs

typedef struct _php_info_logo php_info_logo

Functions

PHPAPI int php_register_info_logo (char *logo_string, const char *mimetype, const unsigned char *data, int size)
PHPAPI int php_unregister_info_logo (char *logo_string)
int php_init_info_logos (void)
int php_shutdown_info_logos (void)
int php_info_logos (const char *logo_string TSRMLS_DC)

Variables

static HashTable phpinfo_logo_hash

Class Documentation

struct _php_info_logo

Definition at line 27 of file php_logos.c.

Class Members
const unsigned char * data
int mimelen
const char * mimetype
int size

Define Documentation

#define CONTENT_TYPE_HEADER   "Content-Type: "

Definition at line 71 of file php_logos.c.


Typedef Documentation

typedef struct _php_info_logo php_info_logo

Function Documentation

int php_info_logos ( const char *logo_string  TSRMLS_DC)

Definition at line 72 of file php_logos.c.

{
       php_info_logo *logo_image;
       char *content_header;
       int len;

       if(FAILURE==zend_hash_find(&phpinfo_logo_hash, (char *) logo_string, strlen(logo_string), (void **)&logo_image))
              return 0;

       len = sizeof(CONTENT_TYPE_HEADER) - 1 + logo_image->mimelen;
       content_header = emalloc(len + 1);
       memcpy(content_header, CONTENT_TYPE_HEADER, sizeof(CONTENT_TYPE_HEADER) - 1);
       memcpy(content_header + sizeof(CONTENT_TYPE_HEADER) - 1 , logo_image->mimetype, logo_image->mimelen);
       content_header[len] = '\0';
       sapi_add_header(content_header, len, 0);

       PHPWRITE(logo_image->data, logo_image->size);
       return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 53 of file php_logos.c.

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_register_info_logo ( char *  logo_string,
const char *  mimetype,
const unsigned char *  data,
int  size 
)

Definition at line 36 of file php_logos.c.

{
       php_info_logo info_logo;

       info_logo.mimetype = mimetype;
       info_logo.mimelen  = strlen(mimetype);
       info_logo.data     = data;
       info_logo.size     = size;

       return zend_hash_add(&phpinfo_logo_hash, logo_string, strlen(logo_string), &info_logo, sizeof(php_info_logo), NULL);
}

Here is the caller graph for this function:

Definition at line 65 of file php_logos.c.

Here is the call graph for this function:

Here is the caller graph for this function:

PHPAPI int php_unregister_info_logo ( char *  logo_string)

Definition at line 48 of file php_logos.c.

{
       return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
}

Variable Documentation

Definition at line 34 of file php_logos.c.