CVS update: php31/ext/standard

From: Date: Tue, 15 Sep 1998 18:23:46 +0000
Subject: CVS update: php31/ext/standard
Groups: php.dev 
Request: Send a blank email to php-dev+get-1128@lists.php.net to get a copy of this message
Date: Tuesday September 15, 1998 @ 14:23 Author: shane Update of /repository/php31/ext/standard In directory asf:/u2/tmp/cvs-serv6775/ext/standard Modified Files: basic_functions.c file.c Log Message: fix odbc pconnect and get_meta_tag Index: php31/ext/standard/basic_functions.c diff -c php31/ext/standard/basic_functions.c:2.14 php31/ext/standard/basic_functions.c:2.15 *** php31/ext/standard/basic_functions.c:2.14 Tue Sep 15 07:54:43 1998 --- php31/ext/standard/basic_functions.c Tue Sep 15 14:23:45 1998 *************** *** 83,90 **** --- 83,92 ---- extern int _php3_send_error(char *message, char *address); #endif /*FIXME THREAD SAFETY!!!*/ + //#ifndef THREAD_SAFE static pval *user_compare_func_name; static HashTable *user_shutdown_function_names; + //#endif BEGIN_FUNCTION_ENTRIES(basic_functions) {"intval", int_value, NULL}, Index: php31/ext/standard/file.c diff -c php31/ext/standard/file.c:2.4 php31/ext/standard/file.c:2.5 *** php31/ext/standard/file.c:2.4 Tue Sep 1 17:44:14 1998 --- php31/ext/standard/file.c Tue Sep 15 14:23:45 1998 *************** *** 26,32 **** | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 2.4 1998/09/01 21:44:14 shane Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif --- 26,32 ---- | Authors: Rasmus Lerdorf <rasmus@lerdorf.on.ca> | +----------------------------------------------------------------------+ */ ! /* $Id: file.c,v 2.5 1998/09/15 18:23:45 shane Exp $ */ #ifdef THREAD_SAFE #include "tls.h" #endif *************** *** 210,229 **** }; /* get_meta_tags(string filename); ! extracts all meta tags from a file and creates variables from them (prefixed with meta_) The meta tag must have a name and content attribute, otherwise it will be skipped. - The variable type created is always a string. The function stops parsing at the closing head tag. */ void php3_get_meta_tags(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; FILE *fp; char buf[8192]; - register int i=0; int use_include_path = 0; - int len,var_namelen; - char var_name[50],*val,*tmp,*end,*slashed; int issock=0, socketd=0; TLS_VARS; /* check args */ --- 210,227 ---- }; /* get_meta_tags(string filename); ! extracts all meta tags from a file and returns an array The meta tag must have a name and content attribute, otherwise it will be skipped. The function stops parsing at the closing head tag. */ void php3_get_meta_tags(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; FILE *fp; char buf[8192]; int use_include_path = 0; int issock=0, socketd=0; + int len,var_namelen, i=0; + char var_name[50],*val=NULL,*tmp,*end,*slashed; TLS_VARS; /* check args */ *************** *** 254,279 **** RETURN_FALSE; } ! /* Initialize return array */ ! if (array_init(return_value) == FAILURE) { RETURN_FALSE; ! } ! /* Now loop through the file and do the magic quotes thing if needed */ memset(buf,0,8191); while((issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp)) && !strstr(buf,"</head>") && !strstr(buf,"</HEAD>")) { if(strstr(buf,"<meta")||strstr(buf,"<META")) { /* get the variable name from the name attribute of the meta tag */ tmp=strstr(buf,"name=\""); ! if(tmp){ tmp+=6; end=strstr(tmp,"\""); ! if(end){ unsigned char *c; *end='\0'; ! snprintf(var_name,50,"meta_%s",tmp); *end='"'; c = var_name; --- 252,285 ---- RETURN_FALSE; } ! if (array_init(return_value)==FAILURE) { ! if (issock) { ! #if WIN32|WINNT ! closesocket(socketd); ! #else ! close(socketd); ! #endif ! } else { ! fclose(fp); ! } RETURN_FALSE; ! } /* Now loop through the file and do the magic quotes thing if needed */ memset(buf,0,8191); while((issock?SOCK_FGETS(buf,8191,socketd):(int)fgets(buf,8191,fp)) && !strstr(buf,"</head>") && !strstr(buf,"</HEAD>")) { if(strstr(buf,"<meta")||strstr(buf,"<META")) { + memset(var_name,0,50); /* get the variable name from the name attribute of the meta tag */ tmp=strstr(buf,"name=\""); ! if(tmp) { tmp+=6; end=strstr(tmp,"\""); ! if(end) { unsigned char *c; *end='\0'; ! snprintf(var_name,50,"%s",tmp); *end='"'; c = var_name; *************** *** 312,325 **** } } } ! if(*var_name && val) { if (GLOBAL(php3_ini)->magic_quotes_runtime) { slashed = _php3_addslashes(val,0,&len,0); } else { slashed = estrndup(val,strlen(val)); } ! SET_VAR_STRING(var_name,slashed); efree(val); } } } --- 318,336 ---- } } } ! if (*var_name && val) { ! pval *pval_ptr; ! if (GLOBAL(php3_ini)->magic_quotes_runtime) { slashed = _php3_addslashes(val,0,&len,0); } else { slashed = estrndup(val,strlen(val)); } ! add_get_index_string(return_value, i, slashed, &pval_ptr, 0); ! _php3_hash_pointer_update(return_value->value.ht, var_name, strlen(var_name)+1, pval_ptr); ! /* SET_VAR_STRING(var_name,slashed); */ efree(val); + i++; } } } *************** *** 333,338 **** --- 344,350 ---- fclose(fp); } } + void php3_file(INTERNAL_FUNCTION_PARAMETERS) { pval *filename, *arg2; -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#1128) next »