cvs: php4 /ext/session/ php_session.h session.c

[email protected] ("Zeev Suraski")
Newsgroups php.version4
Message-ID <cvszeev959339569@cvsserver>
zeev		Fri May 26 04:12:49 2000 EDT

  Modified files:
    /php4/ext/session	php_session.h session.c 
  Log:
  Use the INI framework in the session module
  
  
Index: php4/ext/session/php_session.h
diff -u php4/ext/session/php_session.h:1.30 php4/ext/session/php_session.h:1.31
--- php4/ext/session/php_session.h:1.30	Thu Mar 30 10:50:09 2000
+++ php4/ext/session/php_session.h	Fri May 26 04:12:49 2000
@@ -77,22 +77,25 @@
 	char *extern_referer_chk;
 	char *entropy_file;
 	char *cache_limiter;
-	int entropy_length;
-	int cookie_lifetime;
+	long entropy_length;
+	long cookie_lifetime;
 	char *cookie_path;
 	char *cookie_domain;
-	zend_bool define_sid;
-	zend_bool use_cookies;
 	ps_module *mod;
 	void *mod_data;
 	HashTable vars;
 	int nr_open_sessions;
-	int gc_probability;
-	int gc_maxlifetime;
+	long gc_probability;
+	long gc_maxlifetime;
 	int module_number;
-	int cache_expire;
+	long cache_expire;
 	const struct ps_serializer_struct *serializer;
 	zval *http_session_vars;
+	char *serialize_handler;
+	char *save_handler;
+	zend_bool auto_start;
+	zend_bool define_sid;
+	zend_bool use_cookies;
 } php_ps_globals;
 
 extern zend_module_entry session_module_entry;
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.139 php4/ext/session/session.c:1.140
--- php4/ext/session/session.c:1.139	Tue May 23 16:13:00 2000
+++ php4/ext/session/session.c	Fri May 26 04:12:49 2000
@@ -68,22 +68,22 @@
 };
 
 PHP_INI_BEGIN()
-	PHP_INI_ENTRY("session.save_path", "/tmp", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.name", "PHPSESSID", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.save_handler", "files", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.auto_start", "0", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.gc_probability", "1", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.gc_maxlifetime", "1440", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.serialize_handler", "php", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.cookie_lifetime", "0", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.cookie_path", "/", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.cookie_domain", "", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.use_cookies", "1", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.referer_check", "", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.entropy_file", "", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.entropy_length", "0", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.cache_limiter", "nocache", PHP_INI_ALL, NULL)
-	PHP_INI_ENTRY("session.cache_expire", "180", PHP_INI_ALL, NULL)
+	STD_PHP_INI_ENTRY("session.save_path",			"/tmp",			PHP_INI_ALL, OnUpdateString,		save_path,			php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.name",				"PHPSESSID",	PHP_INI_ALL, OnUpdateString,		session_name,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.save_handler",		"files",		PHP_INI_ALL, OnUpdateString,		save_handler,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_BOOLEAN("session.auto_start",		"0",			PHP_INI_ALL, OnUpdateBool,			auto_start,			php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.gc_probability",		"1",			PHP_INI_ALL, OnUpdateInt,			gc_probability,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.gc_maxlifetime",		"1440",			PHP_INI_ALL, OnUpdateInt,			gc_maxlifetime,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.serialize_handler",	"php",			PHP_INI_ALL, OnUpdateString,		serialize_handler,	php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.cookie_lifetime",	"0",			PHP_INI_ALL, OnUpdateInt,			cookie_lifetime,	php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.cookie_path",		"/",			PHP_INI_ALL, OnUpdateString,		cookie_path,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.cookie_domain",		"",				PHP_INI_ALL, OnUpdateString,		cookie_domain,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_BOOLEAN("session.use_cookies",		"1",			PHP_INI_ALL, OnUpdateBool,			use_cookies,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.referer_check",		"",				PHP_INI_ALL, OnUpdateString,		extern_referer_chk,	php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.entropy_file",		"",				PHP_INI_ALL, OnUpdateString,		entropy_file,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.entropy_length",		"0",			PHP_INI_ALL, OnUpdateInt,			entropy_length,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.cache_limiter",		"nocache",		PHP_INI_ALL, OnUpdateString,		cache_limiter,		php_ps_globals,	ps_globals)
+	STD_PHP_INI_ENTRY("session.cache_expire",		"180",			PHP_INI_ALL, OnUpdateInt,			cache_expire,		php_ps_globals,	ps_globals)
 	/* Commented out until future discussion */
 	/* PHP_INI_ENTRY("session.encode_sources", "globals,track", PHP_INI_ALL, NULL) */
 PHP_INI_END()
@@ -1229,26 +1229,19 @@
 
 static void php_rinit_session_globals(PSLS_D)
 {
-	PS(mod) = _php_find_ps_module(INI_STR("session.save_handler") PSLS_CC);
-	PS(serializer) = \
-		_php_find_ps_serializer(INI_STR("session.serialize_handler") PSLS_CC);
+	PS(mod) = _php_find_ps_module(PS(save_handler) PSLS_CC);
+	PS(serializer) = _php_find_ps_serializer(PS(serialize_handler) PSLS_CC);
 		
 	zend_hash_init(&PS(vars), 0, NULL, NULL, 0);
 	PS(define_sid) = 0;
-	PS(use_cookies) = INI_BOOL("session.use_cookies");
 	PS(save_path) = estrdup(INI_STR("session.save_path"));
 	PS(session_name) = estrdup(INI_STR("session.name"));
 	PS(entropy_file) = estrdup(INI_STR("session.entropy_file"));
-	PS(entropy_length) = INI_INT("session.entropy_length");
-	PS(gc_probability) = INI_INT("session.gc_probability");
-	PS(gc_maxlifetime) = INI_INT("session.gc_maxlifetime");
 	PS(extern_referer_chk) = estrdup(INI_STR("session.referer_check"));
 	PS(id) = NULL;
-	PS(cookie_lifetime) = INI_INT("session.cookie_lifetime");
 	PS(cookie_path) = estrdup(INI_STR("session.cookie_path"));
 	PS(cookie_domain) = estrdup(INI_STR("session.cookie_domain"));
 	PS(cache_limiter) = estrdup(INI_STR("session.cache_limiter"));
-	PS(cache_expire) = INI_INT("session.cache_expire");
 	PS(nr_open_sessions) = 0;
 	PS(mod_data) = NULL;
 }
@@ -1282,7 +1275,7 @@
 		return SUCCESS;
 	}
 
-	if (INI_INT("session.auto_start"))
+	if (PS(auto_start))
 		_php_session_start(PSLS_C);
 
 	return SUCCESS;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.