コード例 #1
0
ファイル: dbf_misc.c プロジェクト: dashiwa/php52-backports
char *db_cur_date(char *cp)
{
	struct tm *ctm, tmbuf;
	time_t	  c_time;

	c_time = time((time_t *)NULL);
	ctm = php_localtime_r(&c_time, &tmbuf);
	if (cp == NULL)
		cp = (char *)malloc(9);

	if (ctm == NULL || cp == NULL)
		return NULL;

	db_set_date(cp, ctm->tm_year + 1900, ctm->tm_mon + 1, ctm->tm_mday);

	return cp;
}
コード例 #2
0
ファイル: easter.c プロジェクト: nishisan/scripts
static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
{

	/* based on code by Simon Kershaw, <*****@*****.**> */

	struct tm te;
	long year, golden, solar, lunar, pfm, dom, tmp, easter;
	long method = CAL_EASTER_DEFAULT;

	/* Default to the current year if year parameter is not given */
	{
		time_t a;
		struct tm b, *res;
		time(&a);
		res = php_localtime_r(&a, &b);
		if (!res) {
			year = 1900;
		} else {
			year = 1900 + b.tm_year;
		}
	}

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
		"|ll", &year, &method) == FAILURE) {
			return;
	}
 
	if (gm && (year<1970 || year>2037)) {				/* out of range for timestamps */
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is only valid for years between 1970 and 2037 inclusive");
		RETURN_FALSE;
	}

	golden = (year % 19) + 1;					/* the Golden number */

	if ((year <= 1582 && method != CAL_EASTER_ALWAYS_GREGORIAN) ||
	    (year >= 1583 && year <= 1752 && method != CAL_EASTER_ROMAN && method != CAL_EASTER_ALWAYS_GREGORIAN) ||
	     method == CAL_EASTER_ALWAYS_JULIAN) {		/* JULIAN CALENDAR */
	     
		dom = (year + (year/4) + 5) % 7;			/* the "Dominical number" - finding a Sunday */
		if (dom < 0) {
			dom += 7;
		}

		pfm = (3 - (11*golden) - 7) % 30;			/* uncorrected date of the Paschal full moon */
		if (pfm < 0) {
			pfm += 30;
		}
	} else {							/* GREGORIAN CALENDAR */
		dom = (year + (year/4) - (year/100) + (year/400)) % 7;	/* the "Domincal number" */
		if (dom < 0) {
			dom += 7;
		}

		solar = (year-1600)/100 - (year-1600)/400;		/* the solar and lunar corrections */
		lunar = (((year-1400) / 100) * 8) / 25;

		pfm = (3 - (11*golden) + solar - lunar) % 30;		/* uncorrected date of the Paschal full moon */
		if (pfm < 0) {
			pfm += 30;
		}
	}

	if ((pfm == 29) || (pfm == 28 && golden > 11)) {		/* corrected date of the Paschal full moon */
		pfm--;							/* - days after 21st March                 */
	}

	tmp = (4-pfm-dom) % 7;
	if (tmp < 0) {
		tmp += 7;
	}

	easter = pfm + tmp + 1;	    					/* Easter as the number of days after 21st March */

	if (gm) {							/* return a timestamp */
		te.tm_isdst = -1;
		te.tm_year = year-1900;
		te.tm_sec = 0;
		te.tm_min = 0;
		te.tm_hour = 0;

		if (easter < 11) {
			te.tm_mon = 2;			/* March */
			te.tm_mday = easter+21;
		} else {
			te.tm_mon = 3;			/* April */
			te.tm_mday = easter-10;
		}

	        Z_LVAL_P(return_value) = mktime(&te);
	} else {							/* return the days after March 21 */	
	        Z_LVAL_P(return_value) = easter;
	}

        Z_TYPE_P(return_value) = IS_LONG;

}
コード例 #3
0
ファイル: php_cassandra.c プロジェクト: moarty/php-driver
static void
php_cassandra_log(const CassLogMessage* message, void* data)
{
  char log[MAXPATHLEN + 1];
  uint log_length = 0;

  /* Making a copy here because location could be updated by a PHP thread. */
  uv_rwlock_rdlock(&log_lock);
  if (log_location) {
    log_length = MIN(strlen(log_location), MAXPATHLEN);
    memcpy(log, log_location, log_length);
  }
  uv_rwlock_rdunlock(&log_lock);

  log[log_length] = '\0';

  if (log_length > 0) {
    int fd = -1;
#ifndef _WIN32
    if (!strcmp(log, "syslog")) {
      php_syslog(LOG_NOTICE, "cassandra | [%s] %s (%s:%d)",
                 cass_log_level_string(message->severity), message->message,
                 message->file, message->line);
      return;
    }
#endif

    fd = open(log, O_CREAT | O_APPEND | O_WRONLY, 0644);

    if (fd != 1) {
      time_t log_time;
      struct tm log_tm;
      char log_time_str[32];
      size_t needed = 0;
      char* tmp     = NULL;

      time(&log_time);
      php_localtime_r(&log_time, &log_tm);
      strftime(log_time_str, sizeof(log_time_str), "%d-%m-%Y %H:%M:%S %Z", &log_tm);

      needed = snprintf(NULL, 0, "%s [%s] %s (%s:%d)%s",
                        log_time_str,
                        cass_log_level_string(message->severity), message->message,
                        message->file, message->line,
                        PHP_EOL);

      tmp = malloc(needed + 1);
      sprintf(tmp, "%s [%s] %s (%s:%d)%s",
              log_time_str,
              cass_log_level_string(message->severity), message->message,
              message->file, message->line,
              PHP_EOL);

      write(fd, tmp, needed);
      free(tmp);
      close(fd);
      return;
    }
  }

  /* This defaults to using "stderr" instead of "sapi_module.log_message"
   * because there are no guarantees that all implementations of the SAPI
   * logging function are thread-safe.
   */

  fprintf(stderr, "cassandra | [%s] %s (%s:%d)%s",
          cass_log_level_string(message->severity), message->message,
          message->file, message->line,
          PHP_EOL);
}
コード例 #4
0
ファイル: log.c プロジェクト: remicollet/suhosin7
SUHOSIN7_API void suhosin_log(int loglevel, char *fmt, ...)
{
	int s, r, i=0, fd;
	long written, towrite;
	int getcaller=0;
	char *wbuf;
	struct timeval tv;
	time_t now;
	struct tm tm;
#if defined(AF_UNIX)
	struct sockaddr_un saun;
#endif
#ifdef PHP_WIN32
	LPTSTR strs[2];
	unsigned short etype;
	DWORD evid;
#endif
	char buf[5000];
	char error[5000];
	char *ip_address;
	char *fname;
	char *alertstring;
	int lineno = 0;
	va_list ap;

	getcaller = (loglevel & S_GETCALLER) == S_GETCALLER;

	/* remove the S_GETCALLER flag */
	loglevel = loglevel & ~S_GETCALLER;

	// SDEBUG("(suhosin_log) loglevel: %d log_syslog: %ld - log_sapi: %ld - log_script: %ld", loglevel, SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script));
	SDEBUG("(suhosin_log) loglevel: %d - log_sapi: %ld - log_stdout: %ld", loglevel, SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_stdout));

	/* dump core if wanted */
	if (SUHOSIN7_G(coredump) && loglevel == S_MEMORY) {
		volatile unsigned int *x = 0;
		volatile int y = *x;
	}
	
	if (SUHOSIN7_G(log_use_x_forwarded_for)) {
		ip_address = suhosin_getenv("HTTP_X_FORWARDED_FOR", 20);
		if (ip_address == NULL) {
			ip_address = "X-FORWARDED-FOR not set";
		}
	} else {
		ip_address = suhosin_getenv("REMOTE_ADDR", 11);
		if (ip_address == NULL) {
			ip_address = "REMOTE_ADDR not set";
		}
	}
	
	
	va_start(ap, fmt);
	ap_php_vsnprintf(error, sizeof(error), fmt, ap);
	va_end(ap);
	while (error[i]) {
		if (error[i] < 32) error[i] = '.';
		i++;
	}
	
	if (SUHOSIN7_G(simulation)) {
		alertstring = "ALERT-SIMULATION";
	} else {
		alertstring = "ALERT";
	}
	
	if (zend_is_executing()) {
		// zend_execute_data *exdata = EG(current_execute_data);
		// if (exdata) {
		// 	if (getcaller && exdata->prev_execute_data && exdata->prev_execute_data->opline && exdata->prev_execute_data->func) {
		// 		lineno = exdata->prev_execute_data->opline->lineno;
		// 		fname = (char *)ZSTR_VAL(exdata->prev_execute_data->func->op_array.filename);
		// 	} else if (exdata->opline && exdata->func) {
		// 		lineno = exdata->opline->lineno;
		// 		fname = (char *)ZSTR_VAL(exdata->func->op_array.filename);
		// 	} else {
		// 		lineno = 0;
		// 		fname = "[unknown filename]";
		// 	}
		// } else {
			lineno = zend_get_executed_lineno();
			fname = (char *)zend_get_executed_filename();
		// }
		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s', line %u)", alertstring, error, ip_address, fname, lineno);
	} else {
		fname = suhosin_getenv("SCRIPT_FILENAME", 15);
		if (fname==NULL) {
			fname = "unknown";
		}
		ap_php_snprintf(buf, sizeof(buf), "%s - %s (attacker '%s', file '%s')", alertstring, error, ip_address, fname);
	}
			
	/* Syslog-Logging disabled? */
// 	if (((SUHOSIN7_G(log_syslog)|S_INTERNAL) & loglevel)==0) {
// 		goto log_file;
// 	}	
// 	
// #if defined(AF_UNIX)
// 	ap_php_snprintf(error, sizeof(error), "<%u>suhosin[%u]: %s\n", (unsigned int)(SUHOSIN7_G(log_syslog_facility)|SUHOSIN7_G(log_syslog_priority)),getpid(),buf);
// 
// 	s = socket(AF_UNIX, SOCK_DGRAM, 0);
// 	if (s == -1) {
// 		goto log_file;
// 	}
// 	
// 	memset(&saun, 0, sizeof(saun));
// 	saun.sun_family = AF_UNIX;
// 	strcpy(saun.sun_path, SYSLOG_PATH);
// 	/*saun.sun_len = sizeof(saun);*/
// 	
// 	r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
// 	if (r) {
// 		close(s);
//     		s = socket(AF_UNIX, SOCK_STREAM, 0);
// 		if (s == -1) {
// 			goto log_file;
// 		}
// 	
// 		memset(&saun, 0, sizeof(saun));
// 		saun.sun_family = AF_UNIX;
// 		strcpy(saun.sun_path, SYSLOG_PATH);
// 		/*saun.sun_len = sizeof(saun);*/
// 
// 		r = connect(s, (struct sockaddr *)&saun, sizeof(saun));
// 		if (r) { 
// 			close(s);
// 			goto log_file;
// 		}
// 	}
// 	send(s, error, strlen(error), 0);
// 	
// 	close(s);
// #endif
// #ifdef PHP_WIN32
// 	ap_php_snprintf(error, sizeof(error), "suhosin[%u]: %s", getpid(),buf);
// 
// 	switch (SUHOSIN7_G(log_syslog_priority)) {			/* translate UNIX type into NT type */
// 		case 1: /*LOG_ALERT:*/
// 			etype = EVENTLOG_ERROR_TYPE;
// 			break;
// 		case 6: /*LOG_INFO:*/
// 			etype = EVENTLOG_INFORMATION_TYPE;
// 			break;
// 		default:
// 			etype = EVENTLOG_WARNING_TYPE;
// 	}
// 	evid = loglevel;
// 	strs[0] = error;
// 	/* report the event */
// 	if (log_source == NULL) {
// 		log_source = RegisterEventSource(NULL, "Suhosin-" SUHOSIN_EXT_VERSION);
// 	}
// 	ReportEvent(log_source, etype, (unsigned short) SUHOSIN7_G(log_syslog_priority), evid, NULL, 1, 0, strs, NULL);
// 	
// #endif
log_file:
	/* File-Logging disabled? */
	if ((SUHOSIN7_G(log_file) & loglevel)==0) {
		goto log_sapi;
	}
	
	if (!SUHOSIN7_G(log_filename) || !SUHOSIN7_G(log_filename)[0]) {
		goto log_sapi;
	}
	fd = open(SUHOSIN7_G(log_filename), O_CREAT|O_APPEND|O_WRONLY, 0640);
	if (fd == -1) {
	    suhosin_log(S_INTERNAL, "Unable to open logfile: %s", SUHOSIN7_G(log_filename));
	    return;
	}

	if (SUHOSIN7_G(log_file_time)) {
		gettimeofday(&tv, NULL);
		now = tv.tv_sec;
		php_localtime_r(&now, &tm);
		ap_php_snprintf(error, sizeof(error), "%s %2d %02d:%02d:%02d [%u] %s\n", month_names[tm.tm_mon], tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, getpid(),buf);
	} else {
		ap_php_snprintf(error, sizeof(error), "%s\n", buf);
	}
	towrite = strlen(error);
	wbuf = error;
	php_flock(fd, LOCK_EX);
	while (towrite > 0) {
		written = write(fd, wbuf, towrite);
		if (written < 0) {
			break;
		}
		towrite -= written;
		wbuf += written;
	}
	php_flock(fd, LOCK_UN);
	close(fd);

log_sapi:
	/* SAPI Logging activated? */
	// SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script), SUHOSIN7_G(log_phpscript));
	if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) {
		sapi_module.log_message(buf);
	}
	if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) {
		fprintf(stdout, "%s\n", buf);
	}

/*log_script:*/
	/* script logging activated? */
// 	if (((SUHOSIN7_G(log_script) & loglevel)!=0) && SUHOSIN7_G(log_scriptname)!=NULL) {
// 		char cmd[8192], *cmdpos, *bufpos;
// 		FILE *in;
// 		int space;
// 		struct stat st;
// 		
// 		char *sname = SUHOSIN7_G(log_scriptname);
// 		while (isspace(*sname)) ++sname;
// 		if (*sname == 0) goto log_phpscript;
// 		
// 		if (VCWD_STAT(sname, &st) < 0) {
// 			suhosin_log(S_INTERNAL, "unable to find logging shell script %s - file dropped", sname);
// 			goto log_phpscript;
// 		}
// 		if (access(sname, X_OK|R_OK) < 0) {
// 			suhosin_log(S_INTERNAL, "logging shell script %s is not executable - file dropped", sname);
// 			goto log_phpscript;					
// 		}
// 		
// 		/* TODO: clean up this code to calculate size of output dynamically */
// 		ap_php_snprintf(cmd, sizeof(cmd) - 20, "%s %s \'", sname, loglevel2string(loglevel));
// 		space = sizeof(cmd) - strlen(cmd) - 20;
// 		cmdpos = cmd + strlen(cmd);
// 		bufpos = buf;
// 		if (space <= 1) return;
// 		while (space > 2 && *bufpos) {
// 			if (*bufpos == '\'') {
// 				if (space<=5) break;
// 				*cmdpos++ = '\'';
// 				*cmdpos++ = '\\';
// 				*cmdpos++ = '\'';
// 				*cmdpos++ = '\'';
// 				bufpos++;
// 				space-=4;
// 			} else {
// 				*cmdpos++ = *bufpos++;
// 				space--;
// 			}
// 		}
// 		*cmdpos++ = '\'';
// 		*cmdpos++ = ' ';
// 		*cmdpos++ = '2';
// 		*cmdpos++ = '>';
// 		*cmdpos++ = '&';
// 		*cmdpos++ = '1';
// 		*cmdpos = 0;
// 		
// 		if ((in=VCWD_POPEN(cmd, "r"))==NULL) {
// 			suhosin_log(S_INTERNAL, "Unable to execute logging shell script: %s", sname);
// 			goto log_phpscript;
// 		}
// 		/* read and forget the result */
// 		while (1) {
// 			int readbytes = fread(cmd, 1, sizeof(cmd), in);
// 			if (readbytes<=0) {
// 				break;
// 			}
// 			if (strncmp(cmd, "sh: ", 4) == 0) {
// 				/* assume this is an error */
// 				suhosin_log(S_INTERNAL, "Error while executing logging shell script: %s", sname);
// 				pclose(in);
// 				goto log_phpscript;
// 			}
// 		}
// 		pclose(in);
// 	}
// log_phpscript:
// 	if ((SUHOSIN7_G(log_phpscript) & loglevel)!=0 && EG(in_execution) && SUHOSIN7_G(log_phpscriptname) && SUHOSIN7_G(log_phpscriptname)[0]) {
// 		zend_file_handle file_handle;
// 		zend_op_array *new_op_array;
// 		zval *result = NULL;
// 		
// 		long orig_execution_depth = SUHOSIN7_G(execution_depth);
// 		char *orig_basedir = PG(open_basedir);
// 		
// 		char *phpscript = SUHOSIN7_G(log_phpscriptname);
// 		SDEBUG("scriptname %s", SUHOSIN7_G(log_phpscriptname));
// 		if (zend_stream_open(phpscript, &file_handle) == SUCCESS) {
// 			if (!file_handle.opened_path) {
// 				file_handle.opened_path = estrndup(phpscript, strlen(phpscript));
// 			}
// 			new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE);
// 			zend_destroy_file_handle(&file_handle);
// 			if (new_op_array) {
// 				HashTable *active_symbol_table = EG(active_symbol_table);
// 				zval *zerror, *zerror_class;
// 				
// 				if (active_symbol_table == NULL) {
// 					active_symbol_table = &EG(symbol_table);
// 				}
// 				EG(return_value_ptr_ptr) = &result;
// 				EG(active_op_array) = new_op_array;
// 				
// 				MAKE_STD_ZVAL(zerror);
// 				MAKE_STD_ZVAL(zerror_class);
// 				ZVAL_STRING(zerror, buf, 1);
// 				ZVAL_LONG(zerror_class, loglevel);
// 
// 				zend_hash_update(active_symbol_table, "SUHOSIN_ERROR", sizeof("SUHOSIN_ERROR"), (void **)&zerror, sizeof(zval *), NULL);
// 				zend_hash_update(active_symbol_table, "SUHOSIN_ERRORCLASS", sizeof("SUHOSIN_ERRORCLASS"), (void **)&zerror_class, sizeof(zval *), NULL);
// 				
// 				SUHOSIN7_G(execution_depth) = 0;
// 				if (SUHOSIN7_G(log_phpscript_is_safe)) {
// 					PG(open_basedir) = NULL;
// 				}
// 				
// 				zend_execute(new_op_array);
// 				
// 				SUHOSIN7_G(execution_depth) = orig_execution_depth;
// 				PG(open_basedir) = orig_basedir;
// 				
// 				destroy_op_array(new_op_array);
// 				efree(new_op_array);
// 
// 				if (!EG(exception))
// 				{
// 					if (EG(return_value_ptr_ptr)) {
// 						zval_ptr_dtor(EG(return_value_ptr_ptr));
// 						EG(return_value_ptr_ptr) = NULL;
// 					}
// 				}
// 			} else {
// 				suhosin_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SUHOSIN7_G(log_phpscriptname));
// 				return;
// 			}
// 		} else {
// 			suhosin_log(S_INTERNAL, "Unable to execute logging PHP script: %s", SUHOSIN7_G(log_phpscriptname));
// 			return;
// 		}
// 	}
// 
}
コード例 #5
0
ファイル: datetime.c プロジェクト: AzerTyQsdF/osx
/* {{{ php_mktime
 */
void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm)
{
	pval **arguments[7];
	struct tm *ta, tmbuf;
	time_t t, seconds;
	int i, gmadjust, arg_count = ZEND_NUM_ARGS();
	int is_dst = -1, chgsecs = 0;
	long val;

	if (arg_count > 7 || zend_get_parameters_array_ex(arg_count, arguments) == FAILURE) {
		WRONG_PARAM_COUNT;
	}
	/* convert supplied arguments to longs */
	for (i = 0; i < arg_count; i++) {
		convert_to_long_ex(arguments[i]);
	}
	t = time(NULL);
#ifdef HAVE_TZSET
	tzset();
#endif
	/*
	** Set default time parameters with local time values,
	** EVEN when some GMT time parameters are specified!
	** This may give strange result, with PHP gmmktime(0, 0, 0),
	** which is assumed to return GMT midnight time
	** for today (in localtime), so that the result time may be
	** AFTER or BEFORE the current time.
	** May be we should initialize tn using gmtime(), so that
	** default parameters for PHP gmmktime would be the current
	** GMT time values...
	*/
	ta = php_localtime_r(&t, &tmbuf);

	/* Let DST be unknown. mktime() should compute the right value
	** and behave correctly. Unless the user overrides this.
	*/
	ta->tm_isdst = -1;

	/*
	** Now change date values with supplied parameters.
	*/
	switch(arg_count) {
	case 7: /* daylight saving time flag */
#ifdef PHP_WIN32
		if (daylight > 0) {
			ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]);
		} else {
			ta->tm_isdst = is_dst = 0;
		}
#else
		ta->tm_isdst = is_dst = Z_LVAL_PP(arguments[6]);
#endif
		/* fall-through */
	case 6: /* year */
		/* special case: 
		   a zero in year, month and day is considered illegal
		   as it would be interpreted as 30.11.1999 otherwise
		*/
		if (  (  Z_LVAL_PP(arguments[5])==0)
			  &&(Z_LVAL_PP(arguments[4])==0)
			  &&(Z_LVAL_PP(arguments[3])==0)
			  ) {
			RETURN_LONG(-1);
		}

		/*
		** Accept parameter in range 0..1000 interpreted as 1900..2900
		** (if 100 is given, it means year 2000)
		** or in range 1001..9999 interpreted as is (this will store
		** negative tm_year for years in range 1001..1899)
		** This function is then Y2K ready, and accepts a wide range of
		** dates including the whole gregorian calendar.
		** But it cannot represent ancestral dates prior to year 1001.
		** Additionally, input parameters of 0..70 are mapped to 100..170
		*/
		if (Z_LVAL_PP(arguments[5]) < 70)
			ta->tm_year = Z_LVAL_PP(arguments[5]) + 100;
		else
			ta->tm_year = Z_LVAL_PP(arguments[5])
			  - ((Z_LVAL_PP(arguments[5]) > 1000) ? 1900 : 0);
		/* fall-through */
	case 5: /* day in month (1-based) */
 		val = (*arguments[4])->value.lval; 
		if (val < 1) { 
			chgsecs += (1-val) * 60*60*24; 
			val = 1; 			
		} 
		ta->tm_mday = val; 
		/* fall-through */ 
	case 4: /* month (zero-based) */
		val = (*arguments[3])->value.lval - 1; 
		while (val < 0) { 
			val += 12; ta->tm_year--; 
		} 
		ta->tm_mon = val; 
		/* fall-through */ 
	case 3: /* second */
		val = (*arguments[2])->value.lval; 
		if (val < 1) { 
			chgsecs += (1-val); val = 1; 
		} 
		ta->tm_sec = val; 
		/* fall-through */ 
	case 2: /* minute */
		val = (*arguments[1])->value.lval; 
		if (val < 1) { 
			chgsecs += (1-val) * 60; val = 1; 
		} 
		ta->tm_min = val; 
		/* fall-through */ 
	case 1: /* hour */
		val = (*arguments[0])->value.lval; 
		/*
		   We avoid midnight and a couple of hours after midnight here to work around
		   various OS-level bugs in mktime and specifically daylight savings time issues
		   in many mktime implementation.
		   See bugs #27533 and #27719 for more info.
		*/
		if (val < 4) { 
			chgsecs += (4-val) * 60*60; val = 4; 
		} 
		ta->tm_hour = val; 
		/* fall-through */ 
	case 0: 
		break; 
	} 
	
	t = mktime(ta); 

#ifdef PHP_WIN32
	if (t - chgsecs < 0) {
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support negative values for this function");
		RETURN_LONG(-1);
	}
#endif

	seconds = t - chgsecs;

	/*
	   Here we check to see if the chgsecs fuzz factor we applied caused us to
	   move from dst to non-dst or vice-versa.  If so we adjust accordingly to
	   avoid being off by an hour on the dst changeover date.
	*/
	if (is_dst == -1) {
		struct tm t1, t2;
		t1 = *localtime(&t);
		t2 = *localtime(&seconds);

		if (t1.tm_isdst != t2.tm_isdst) {
			seconds += (t1.tm_isdst == 1) ? 3600 : -3600;
			ta = localtime(&seconds);
		}

		/*
		   If the user didn't specify whether the timestamp passed in was dst or not
		   then we fill it in based on the dst setting at the evaluated timestamp
		   at the current TZ
		*/
		is_dst = ta->tm_isdst; 
	}
	
	if (gm) {
#if HAVE_TM_GMTOFF
	    /*
		** mktime(ta) very nicely just filled ta->tm_gmtoff with
		** the exactly right value for adjustment if we want GMT.
	    */
	    gmadjust = ta->tm_gmtoff;
#else
	    /*
	    ** If correcting for daylight savings time, we set the adjustment to
		** the value of timezone - 3600 seconds.
	    */
#ifdef __CYGWIN__
	    gmadjust = -(is_dst ? _timezone - 3600 : _timezone);
#else
	    gmadjust = -(is_dst ? timezone - 3600 : timezone);
#endif
#endif
		seconds += gmadjust;
	}

	RETURN_LONG(seconds);
}
コード例 #6
0
ファイル: datetime.c プロジェクト: AzerTyQsdF/osx
/* {{{ php_date
 */
static void php_date(INTERNAL_FUNCTION_PARAMETERS, int gm)
{
	pval **format, **timestamp;
	time_t the_time;
	struct tm *ta, tmbuf;
	int i, size = 0, length, h, beat, fd, wd, yd, wk;
	char tmp_buff[32];
#if !HAVE_TM_GMTOFF
	long tzone;
	char *tname[2]= {"GMT Standard Time", "BST"};
#endif

	switch(ZEND_NUM_ARGS()) {
	case 1:
		if (zend_get_parameters_ex(1, &format) == FAILURE) {
			WRONG_PARAM_COUNT;
		}
		the_time = time(NULL);
		break;
	case 2:
		if (zend_get_parameters_ex(2, &format, &timestamp) == FAILURE) {
			WRONG_PARAM_COUNT;
		}
		convert_to_long_ex(timestamp);
		the_time = Z_LVAL_PP(timestamp);
#ifdef PHP_WIN32
		if (the_time < 0) {
			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Windows does not support dates prior to midnight (00:00:00), January 1, 1970");
			RETURN_FALSE;
		}
#endif
		break;
	default:
		WRONG_PARAM_COUNT;
	}
	convert_to_string_ex(format);

	if (gm) {
		ta = php_gmtime_r(&the_time, &tmbuf);
#if !HAVE_TM_GMTOFF
		tzone = 0;
#endif
	} else {
		ta = php_localtime_r(&the_time, &tmbuf);
#if !HAVE_TM_GMTOFF
#ifdef __CYGWIN__
		tzone = _timezone;
#else
		tzone = timezone;
#endif
		if (tzname[0] != NULL) {
			tname[0] = tzname[0];
		} else {
			tname[0] = "???";
		}

		if (tzname[1] != NULL) {
			tname[1] = tzname[1];
		}
#endif
	}

	if (!ta) {			/* that really shouldn't happen... */
		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unexpected error");
		RETURN_FALSE;
	}
	for (i = 0; i < Z_STRLEN_PP(format); i++) {
		switch (Z_STRVAL_PP(format)[i]) {
			case 'r':		/* rfc822 format */
				size += 31;
				break;
			case 'U':		/* seconds since the epoch */
				size += 10;
				break;
			case 'F':		/* month, textual, full */
			case 'l':		/* day (of the week), textual */
				size += 28;
				break;
			case 'T':		/* timezone name */
#if HAVE_TM_ZONE
				size += strlen(ta->tm_zone);
#elif HAVE_TZNAME
				if (ta->tm_isdst > 0 ) {
					size += strlen(tname[1]);
				} else {
					size += strlen(tname[0]);
				}
#endif
				break;
			case 'Z':		/* timezone offset in seconds */
				size += 6;
				break;
			case 'O':		/* GMT offset in [+-]HHMM format */
				size += 5;
				break;
			case 'Y':		/* year, numeric, 4 digits */
				size += 4;
				break;
			case 'M':		/* month, textual, 3 letters */
			case 'D':		/* day, textual, 3 letters */
			case 'z':		/* day of the year, 1 to 366 */
			case 'B':		/* Swatch Beat, 3 digits */
				size += 3;
				break;
			case 'y':		/* year, numeric, 2 digits */
			case 'm':		/* month, numeric */
			case 'n':		/* month, numeric, no leading zeroes */
			case 'd':		/* day of the month, numeric */
			case 'j':		/* day of the month, numeric, no leading zeros */
			case 'H':		/* hour, numeric, 24 hour format */
			case 'h':		/* hour, numeric, 12 hour format */
			case 'G':		/* hour, numeric, 24 hour format, no leading zeroes */
			case 'g':		/* hour, numeric, 12 hour format, no leading zeroes */
			case 'i':		/* minutes, numeric */
			case 's':		/* seconds, numeric */
			case 'A':		/* AM/PM */
			case 'a':		/* am/pm */
			case 'S':		/* standard english suffix for the day of the month (e.g. 3rd, 2nd, etc) */
			case 't':		/* days in current month */
			case 'W':		/* ISO-8601 week number of year, weeks starting on Monday */
				size += 2;
				break;
			case '\\':
				if (i < Z_STRLEN_PP(format) - 1) {
					i++;
				}
				size ++;
				break;
			case 'L':		/* boolean for leap year */
			case 'w':		/* day of the week, numeric */
			case 'I':		/* DST? */
			default:
				size++;
				break;
		}
	}

	Z_STRVAL_P(return_value) = (char *) emalloc(size + 1);
	Z_STRVAL_P(return_value)[0] = '\0';

	for (i = 0; i < Z_STRLEN_PP(format); i++) {
		switch (Z_STRVAL_PP(format)[i]) {
			case '\\':
				if (i < Z_STRLEN_PP(format) - 1) {
					char ch[2];
					ch[0]=Z_STRVAL_PP(format)[i + 1];
					ch[1]='\0';
					strcat(Z_STRVAL_P(return_value), ch);
					i++;
				}
				break;
			case 'U':		/* seconds since the epoch */
				sprintf(tmp_buff, "%ld", (long)the_time); /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'F':		/* month, textual, full */
				strcat(Z_STRVAL_P(return_value), mon_full_names[ta->tm_mon]);
				break;
			case 'l':		/* day (of the week), textual, full */
				strcat(Z_STRVAL_P(return_value), day_full_names[ta->tm_wday]);
				break;
			case 'Y':		/* year, numeric, 4 digits */
				sprintf(tmp_buff, "%d", ta->tm_year + YEAR_BASE);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'M':		/* month, textual, 3 letters */
				strcat(Z_STRVAL_P(return_value), mon_short_names[ta->tm_mon]);
				break;
			case 'D':		/* day (of the week), textual, 3 letters */
				strcat(Z_STRVAL_P(return_value), day_short_names[ta->tm_wday]);
				break;
			case 'z':		/* day (of the year) */
				sprintf(tmp_buff, "%d", ta->tm_yday);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'y':		/* year, numeric, 2 digits */
				sprintf(tmp_buff, "%02d", ((ta->tm_year)%100));  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'm':		/* month, numeric */
				sprintf(tmp_buff, "%02d", ta->tm_mon + 1);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'n':      /* month, numeric, no leading zeros */
				sprintf(tmp_buff, "%d", ta->tm_mon + 1);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'd':		/* day of the month, numeric */
				sprintf(tmp_buff, "%02d", ta->tm_mday);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'j':
				sprintf(tmp_buff, "%d", ta->tm_mday); /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'H':		/* hour, numeric, 24 hour format */
				sprintf(tmp_buff, "%02d", ta->tm_hour);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'h':		/* hour, numeric, 12 hour format */
				h = ta->tm_hour % 12; if (h==0) h = 12;
				sprintf(tmp_buff, "%02d", h);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'G':      /* hour, numeric, 24 hour format, no leading zeros */
				sprintf(tmp_buff, "%d", ta->tm_hour);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'g':      /* hour, numeric, 12 hour format, no leading zeros */
				h = ta->tm_hour % 12; if (h==0) h = 12;
				sprintf(tmp_buff, "%d", h);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'i':		/* minutes, numeric */
				sprintf(tmp_buff, "%02d", ta->tm_min);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 's':		/* seconds, numeric */
				sprintf(tmp_buff, "%02d", ta->tm_sec);  /* SAFE */ 
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'A':		/* AM/PM */
				strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "PM" : "AM"));
				break;
			case 'a':		/* am/pm */
				strcat(Z_STRVAL_P(return_value), (ta->tm_hour >= 12 ? "pm" : "am"));
				break;
			case 'S':		/* standard english suffix, e.g. 2nd/3rd for the day of the month */
				if (ta->tm_mday >= 10 && ta->tm_mday <= 19) {
					strcat(Z_STRVAL_P(return_value), "th");
				} else {
					switch (ta->tm_mday % 10) {
						case 1:
							strcat(Z_STRVAL_P(return_value), "st");
							break;
						case 2:
							strcat(Z_STRVAL_P(return_value), "nd");
							break;
						case 3:
							strcat(Z_STRVAL_P(return_value), "rd");
							break;
						default:
							strcat(Z_STRVAL_P(return_value), "th");
							break;
					}
				}
				break;
			case 't':		/* days in current month */
				sprintf(tmp_buff, "%2d", phpday_tab[isleap((ta->tm_year+YEAR_BASE))][ta->tm_mon] );
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'w':		/* day of the week, numeric EXTENSION */
				sprintf(tmp_buff, "%01d", ta->tm_wday);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'O':		/* GMT offset in [+-]HHMM format */
#if HAVE_TM_GMTOFF				
				sprintf(tmp_buff, "%c%02d%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
#else
				sprintf(tmp_buff, "%c%02d%02d", ((ta->tm_isdst ? tzone - 3600:tzone)>0)?'-':'+', abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600), abs(((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60));
#endif
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'Z':		/* timezone offset in seconds */
#if HAVE_TM_GMTOFF
				sprintf(tmp_buff, "%ld", ta->tm_gmtoff);
#else
				sprintf(tmp_buff, "%ld", ta->tm_isdst ? -(tzone- 3600) : -tzone);
#endif
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'L':		/* boolean for leapyear */
				sprintf(tmp_buff, "%d", (isleap((ta->tm_year+YEAR_BASE)) ? 1 : 0 ) );
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'T':		/* timezone name */
#if HAVE_TM_ZONE
				strcat(Z_STRVAL_P(return_value), ta->tm_zone);
#elif HAVE_TZNAME
				strcat(Z_STRVAL_P(return_value), ta->tm_isdst ? tname[1] : tname[0]);
#endif
				break;
			case 'B':	/* Swatch Beat a.k.a. Internet Time */
				beat =  (((((long)the_time)-(((long)the_time) -
					((((long)the_time) % 86400) + 3600))) * 10) / 864);
				while (beat < 0) {
					beat += 1000;
				}
				beat = beat % 1000;
				sprintf(tmp_buff, "%03d", beat); /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'I':
				sprintf(tmp_buff, "%d", ta->tm_isdst);
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'r':
#if HAVE_TM_GMTOFF
				sprintf(tmp_buff, "%3s, %02d %3s %04d %02d:%02d:%02d %c%02d%02d",
					day_short_names[ta->tm_wday],
					ta->tm_mday,
					mon_short_names[ta->tm_mon],
					ta->tm_year + YEAR_BASE,
					ta->tm_hour,
					ta->tm_min,
					ta->tm_sec,
					(ta->tm_gmtoff < 0) ? '-' : '+',
					abs(ta->tm_gmtoff / 3600),
					abs( (ta->tm_gmtoff % 3600) / 60 )
				);
#else
				sprintf(tmp_buff, "%3s, %02d %3s %04d %02d:%02d:%02d %c%02d%02d",
					day_short_names[ta->tm_wday],
					ta->tm_mday,
					mon_short_names[ta->tm_mon],
					ta->tm_year + YEAR_BASE,
					ta->tm_hour,
					ta->tm_min,
					ta->tm_sec,
					((ta->tm_isdst ? tzone - 3600 : tzone) > 0) ? '-' : '+',
					abs((ta->tm_isdst ? tzone - 3600 : tzone) / 3600),
					abs( ((ta->tm_isdst ? tzone - 3600 : tzone) % 3600) / 60 )
				);
#endif
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;
			case 'W':		/* ISO-8601 week number of year, weeks starting on Monday */
				wd = ta->tm_wday == 0 ? 6 : ta->tm_wday - 1; /* weekday */
				yd = ta->tm_yday + 1;					/* days since January 1st */

				fd = (7 + wd - yd % 7+ 1) % 7;			/* weekday (1st January) */	

				/* week is a last year week (52 or 53) */
				if ((yd <= 7 - fd) && fd > 3){			
					wk = (fd == 4 || (fd == 5 && isleap((ta->tm_year + YEAR_BASE - 1)))) ? 53 : 52;
				}
				/* week is a next year week (1) */
				else if (isleap((ta->tm_year+YEAR_BASE)) + 365 - yd < 3 - wd){
					wk = 1;
				}
				/* normal week */
				else {
					wk = (yd + 6 - wd + fd) / 7 - (fd > 3);
				}

				sprintf(tmp_buff, "%02d", wk);  /* SAFE */
				strcat(Z_STRVAL_P(return_value), tmp_buff);
				break;

			default:
				length = strlen(Z_STRVAL_P(return_value));
				Z_STRVAL_P(return_value)[length] = Z_STRVAL_PP(format)[i];
				Z_STRVAL_P(return_value)[length + 1] = '\0';
				break;
		}
	}
	Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
	Z_TYPE_P(return_value) = IS_STRING;
}
コード例 #7
0
PHPAPI void php_print_info(int flag)
{
	char **env,*tmp1,*tmp2;
	char *php_uname;
	int expose_php = INI_INT("expose_php");
	time_t the_time;
	struct tm *ta, tmbuf;
	ELS_FETCH();
	SLS_FETCH();

	the_time = time(NULL);
	ta = php_localtime_r(&the_time, &tmbuf);

	PUTS("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 3.2//EN\">\n<html>\n");

	if (flag & PHP_INFO_GENERAL) {
		char *zend_version = get_zend_version();

		php_uname = php_get_uname();
		PUTS("<head>");
		php_info_print_style();
		PUTS("<title>phpinfo()</title></head><body>");

		php_info_print_box_start(1);
		if (expose_php) {
			PUTS("<a href=\"http://www.php.net/\"><img src=\"");
			if (SG(request_info).request_uri) {
				PUTS(SG(request_info).request_uri);
			}
			if ((ta->tm_mon==3) && (ta->tm_mday==1)) {
				PUTS("?="PHP_EGG_LOGO_GUID"\" border=0 align=\"right\" alt=\"Thies!\"></a>");
			} else {
				PUTS("?="PHP_LOGO_GUID"\" border=0 align=\"right\" alt=\"PHP Logo\"></a>");
			}
		}
		php_printf("<H1>PHP Version %s</H1>\n", PHP_VERSION);
		php_info_print_box_end();
		php_info_print_table_start();
		php_info_print_table_row(2, "System", php_uname );
		php_info_print_table_row(2, "Build Date", __DATE__ );
#ifdef CONFIGURE_COMMAND
		php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND );
#endif
		if (sapi_module.pretty_name) {
			php_info_print_table_row(2, "Server API", sapi_module.pretty_name );
		}

#ifdef VIRTUAL_DIR
		php_info_print_table_row(2, "Virtual Directory Support", "enabled" );
#else
		php_info_print_table_row(2, "Virtual Directory Support", "disabled" );
#endif

		php_info_print_table_row(2, "Configuration File (php.ini) Path", php_ini_opened_path?php_ini_opened_path:PHP_CONFIG_FILE_PATH);

#if ZEND_DEBUG
		php_info_print_table_row(2, "ZEND_DEBUG", "enabled" );
#else
		php_info_print_table_row(2, "ZEND_DEBUG", "disabled" );
#endif

#ifdef ZTS
		php_info_print_table_row(2, "Thread Safety", "enabled" );
#else
		php_info_print_table_row(2, "Thread Safety", "disabled" );
#endif

#if HAVE_PHP_STREAM
		php_info_print_table_row(2, "Experimental PHP Streams", "enabled");
#endif
		
		php_info_print_table_end();

		/* Zend Engine */
		php_info_print_box_start(0);
		if (expose_php) {
			PUTS("<a href=\"http://www.zend.com/\"><img src=\"");
			if (SG(request_info).request_uri) {
				PUTS(SG(request_info).request_uri);
			}
			PUTS("?="ZEND_LOGO_GUID"\" border=\"0\" align=\"right\" alt=\"Zend logo\"></a>\n");
		}
		php_printf("This program makes use of the Zend scripting language engine:<BR>");
		zend_html_puts(zend_version, strlen(zend_version));
		php_printf("</BR>\n");
		php_info_print_box_end();
		efree(php_uname);
	}

	if ((flag & PHP_INFO_CREDITS) && expose_php) {	
		php_info_print_hr();
		PUTS("<h1 align=\"center\"><a href=\"");
		if (SG(request_info).request_uri) {
			PUTS(SG(request_info).request_uri);
		}
		PUTS("?=PHPB8B5F2A0-3C92-11d3-A3A9-4C7B08C10000\">");
		PUTS("PHP 4.0 Credits");
		PUTS("</a></h1>\n");
	}

	zend_ini_sort_entries(ELS_C);

	if (flag & PHP_INFO_CONFIGURATION) {
		php_info_print_hr();
		PUTS("<h1 align=\"center\">Configuration</h1>\n");
		SECTION("PHP Core\n");
		display_ini_entries(NULL);
	}

	if (flag & PHP_INFO_MODULES) {
		int show_info_func;

		show_info_func = 1;
		zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);

		SECTION("Additional Modules");
		php_info_print_table_start();
		show_info_func = 0;
		zend_hash_apply_with_argument(&module_registry, (int (*)(void *, void *)) _display_module_info, &show_info_func);
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_ENVIRONMENT) {
		SECTION("Environment");
		php_info_print_table_start();
		php_info_print_table_header(2, "Variable", "Value");
		for (env=environ; env!=NULL && *env !=NULL; env++) {
			tmp1 = estrdup(*env);
			if (!(tmp2=strchr(tmp1,'='))) { /* malformed entry? */
				efree(tmp1);
				continue;
			}
			*tmp2 = 0;
			tmp2++;
			php_info_print_table_row(2, tmp1, tmp2);
			efree(tmp1);
		}
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_VARIABLES) {
		pval **data;

		SECTION("PHP Variables");

		php_info_print_table_start();
		php_info_print_table_header(2, "Variable", "Value");
		if (zend_hash_find(&EG(symbol_table), "PHP_SELF", sizeof("PHP_SELF"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_SELF", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_TYPE", sizeof("PHP_AUTH_TYPE"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_TYPE", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_USER", sizeof("PHP_AUTH_USER"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_USER", (*data)->value.str.val);
		}
		if (zend_hash_find(&EG(symbol_table), "PHP_AUTH_PW", sizeof("PHP_AUTH_PW"), (void **) &data) != FAILURE) {
			php_info_print_table_row(2, "PHP_AUTH_PW", (*data)->value.str.val);
		}
		php_print_gpcse_array("HTTP_GET_VARS", sizeof("HTTP_GET_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_POST_VARS", sizeof("HTTP_POST_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_POST_FILES", sizeof("HTTP_POST_FILES")-1 ELS_CC);
		php_print_gpcse_array("HTTP_COOKIE_VARS", sizeof("HTTP_COOKIE_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_SERVER_VARS", sizeof("HTTP_SERVER_VARS")-1 ELS_CC);
		php_print_gpcse_array("HTTP_ENV_VARS", sizeof("HTTP_ENV_VARS")-1 ELS_CC);
		php_info_print_table_end();
	}

	if (flag & PHP_INFO_LICENSE) {
		SECTION("PHP License");
		php_info_print_box_start(0);
		PUTS("<P>\n");
		PUTS("This program is free software; you can redistribute it and/or modify ");
		PUTS("it under the terms of the PHP License as published by the PHP Group ");
		PUTS("and included in the distribution in the file:  LICENSE\n");
		PUTS("</P>\n");
		PUTS("<P>");
		PUTS("This program is distributed in the hope that it will be useful, ");
		PUTS("but WITHOUT ANY WARRANTY; without even the implied warranty of ");
		PUTS("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
		PUTS("</P>\n");
		PUTS("<P>");
		PUTS("If you did not receive a copy of the PHP license, or have any questions about ");
		PUTS("PHP licensing, please contact [email protected].\n");
		PUTS("</P>\n");
		php_info_print_box_end();
	}

	PUTS("</BODY></HTML>");
}