]> granicus.if.org Git - php/commitdiff
Use the INI framework in the session module
authorZeev Suraski <zeev@php.net>
Fri, 26 May 2000 11:12:49 +0000 (11:12 +0000)
committerZeev Suraski <zeev@php.net>
Fri, 26 May 2000 11:12:49 +0000 (11:12 +0000)
ext/session/php_session.h
ext/session/session.c

index a93f4d87f4f104348d9071e800dca17e0a9f69e3..9e50e626bd746c2d77a9ba2ead70879d8b416372 100644 (file)
@@ -77,22 +77,25 @@ typedef struct {
        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 32c3db5c61ac178298bf8119857939be3deb3516..366bf076ff5694eae58a4cccaaeafbe8aaea71c2 100644 (file)
@@ -68,22 +68,22 @@ function_entry session_functions[] = {
 };
 
 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 @@ PHP_FUNCTION(session_unset)
 
 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 @@ PHP_RINIT_FUNCTION(session)
                return SUCCESS;
        }
 
-       if (INI_INT("session.auto_start"))
+       if (PS(auto_start))
                _php_session_start(PSLS_C);
 
        return SUCCESS;