From 78cac2a42e0977d36dc3fd32a8503953dd6dd81d Mon Sep 17 00:00:00 2001 From: Cliff Woolley Date: Fri, 17 May 2002 05:16:18 +0000 Subject: [PATCH] * restore the php_flag and php_admin_flag Apache directives which for some mysterious reason never made their way from sapi/apache to sapi/apache2filter when it was first written PR: 16629 * change the allowed locations of php_admin_value (and php_admin_flag to match) to ACCESS_CONF instead of OR_NONE to match sapi/apache. No idea why it was ever OR_NONE. PR: 16489 --- sapi/apache2filter/apache_config.c | 32 ++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/sapi/apache2filter/apache_config.c b/sapi/apache2filter/apache_config.c index a46c99222a..90a544415f 100644 --- a/sapi/apache2filter/apache_config.c +++ b/sapi/apache2filter/apache_config.c @@ -83,6 +83,30 @@ static const char *php_apache_admin_value_handler(cmd_parms *cmd, void *dummy, c return real_value_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM); } +static const char *real_flag_hnd(cmd_parms *cmd, void *dummy, const char *arg1, const char *arg2, int status) +{ + char bool_val[2]; + + if (!strcasecmp(arg2, "On")) { + bool_val[0] = '1'; + } else { + bool_val[0] = '0'; + } + bool_val[1] = 0; + + return real_value_hnd(cmd, dummy, arg1, bool_val, status); +} + +static const char *php_apache_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value) +{ + return real_flag_hnd(cmd, dummy, name, value, PHP_INI_USER); +} + +static const char *php_apache_admin_flag_handler(cmd_parms *cmd, void *dummy, const char *name, const char *value) +{ + return real_flag_hnd(cmd, dummy, name, value, PHP_INI_SYSTEM); +} + static const char *php_apache_phpini_set(cmd_parms *cmd, void *mconfig, const char *arg) { if (apache2_php_ini_path_override) { @@ -139,8 +163,12 @@ const command_rec php_dir_cmds[] = { AP_INIT_TAKE2("php_value", php_apache_value_handler, NULL, OR_OPTIONS, "PHP Value Modifier"), - AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, OR_NONE, - "PHP Value Modifier"), + AP_INIT_TAKE2("php_flag", php_apache_flag_handler, NULL, OR_OPTIONS, + "PHP Flag Modifier"), + AP_INIT_TAKE2("php_admin_value", php_apache_admin_value_handler, NULL, ACCESS_CONF, + "PHP Value Modifier (Admin)"), + AP_INIT_TAKE2("php_admin_flag", php_apache_admin_flag_handler, NULL, ACCESS_CONF, + "PHP Flag Modifier (Admin)"), AP_INIT_TAKE1("PHPINIDir", php_apache_phpini_set, NULL, RSRC_CONF, "Directory containing the php.ini file"), {NULL} -- 2.40.0