]> granicus.if.org Git - php/commitdiff
- Change PHP_ to V_ (directory & file functions)
authorAndi Gutmans <andi@php.net>
Sat, 15 Apr 2000 14:20:01 +0000 (14:20 +0000)
committerAndi Gutmans <andi@php.net>
Sat, 15 Apr 2000 14:20:01 +0000 (14:20 +0000)
ext/db/db.c
ext/filepro/filepro.c
ext/ftp/php_ftp.c
ext/gd/gd.c
ext/rpc/com/COM.c
main/fopen_wrappers.c
main/main.c
main/php.h
main/php_realpath.c
main/rfc1867.c
main/safe_mode.c

index bc131aa7598fa5e0af23d8f5a83b6ef779611eed..c2f666d44cc2959c342fb493e98a1c579b1e4233 100644 (file)
@@ -123,7 +123,7 @@ static int php_dbm_key_exists(DBM *dbf, datum key_datum) {
 #define DBM_CREATE_MODE "a+b"
 #define DBM_NEW_MODE "w+b"
 #define DBM_DEFAULT_MODE "r"
-#define DBM_OPEN(filename, mode) PHP_FOPEN(filename, mode)
+#define DBM_OPEN(filename, mode) V_FOPEN(filename, mode)
 #define DBM_CLOSE(dbf) fclose(dbf)
 #define DBM_STORE(dbf, key, value, mode) flatfile_store(dbf, key, value, mode)
 #define DBM_FETCH(dbf, key) flatfile_fetch(dbf, key)
index 3de10645e4eea9e9cd6abf19c5eb4685d16e5667..f08812ed974c6f75a592f6f8f6a0706dbc34ee19 100644 (file)
@@ -210,7 +210,7 @@ PHP_FUNCTION(filepro)
                RETURN_FALSE;
        }
 
-       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
+       if (!(fp = V_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open map: [%d] %s",
                                        errno, strerror(errno));
                RETURN_FALSE;
@@ -306,7 +306,7 @@ PHP_FUNCTION(filepro_rowcount)
                RETURN_FALSE;
        }
 
-       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
+       if (!(fp = V_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
                                        errno, strerror(errno));
                RETURN_FALSE;
@@ -516,7 +516,7 @@ PHP_FUNCTION(filepro_retrieve)
                RETURN_FALSE;
        }
 
-       if (!(fp = PHP_FOPEN(workbuf, "r"))) {
+       if (!(fp = V_FOPEN(workbuf, "r"))) {
                php_error(E_WARNING, "filePro: cannot open key: [%d] %s",
                                        errno, strerror(errno));
            fclose(fp);
index d1e0d2e749760822b4a12e6c4f1276b79e35b1f8..390af90887809218e6a901c7fedcc81b2152c3b0 100644 (file)
@@ -550,7 +550,7 @@ PHP_FUNCTION(ftp_get)
                RETURN_FALSE;
        }
 
-       if ((outfp = PHP_FOPEN(arg2->value.str.val, "w")) == NULL) {
+       if ((outfp = V_FOPEN(arg2->value.str.val, "w")) == NULL) {
                fclose(tmpfp);
                php_error(E_WARNING, "error opening %s", arg2->value.str.val);
                RETURN_FALSE;
@@ -634,7 +634,7 @@ PHP_FUNCTION(ftp_put)
        convert_to_string(arg3);
        XTYPE(xtype, arg4);
 
-       if ((infp = PHP_FOPEN(arg3->value.str.val, "r")) == NULL) {
+       if ((infp = V_FOPEN(arg3->value.str.val, "r")) == NULL) {
                php_error(E_WARNING, "error opening %s", arg3->value.str.val);
                RETURN_FALSE;
        }
index fc0b450af65519939b98b347ff4b326ce1516ea5..026af1db6a6b223cccc8379f2af6b83978ac374d 100644 (file)
@@ -343,7 +343,7 @@ PHP_FUNCTION(imageloadfont) {
        convert_to_string_ex(file);
 
 #ifdef PHP_WIN32
-       fp = PHP_FOPEN((*file)->value.str.val, "rb");
+       fp = V_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -446,7 +446,7 @@ PHP_FUNCTION(imagecreatefrompng)
        convert_to_string_ex(file);
        fn = (*file)->value.str.val;
 #ifdef PHP_WIN32
-       fp = PHP_FOPEN((*file)->value.str.val, "rb");
+       fp = V_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -492,7 +492,7 @@ PHP_FUNCTION(imagepng)
        }
 
        if (argc == 2) {
-               fp = PHP_FOPEN(fn, "wb");
+               fp = V_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImagePng: unable to open %s for writing", fn);
                        RETURN_FALSE;
@@ -554,7 +554,7 @@ PHP_FUNCTION(imagecreatefromgif )
        fn = (*file)->value.str.val;
 
 #ifdef PHP_WIN32
-       fp = PHP_FOPEN((*file)->value.str.val, "rb");
+       fp = V_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -603,7 +603,7 @@ PHP_FUNCTION(imagegif)
        }
 
        if (argc == 2) {
-               fp = PHP_FOPEN(fn, "wb");
+               fp = V_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImageGif: unable to open %s for writing", fn);
                        RETURN_FALSE;
@@ -669,7 +669,7 @@ PHP_FUNCTION(imagecreatefromjpeg)
        convert_to_string_ex(file);
        fn = (*file)->value.str.val;
 #ifdef PHP_WIN32
-       fp = PHP_FOPEN((*file)->value.str.val, "rb");
+       fp = V_FOPEN((*file)->value.str.val, "rb");
 #else
        fp = php_fopen_wrapper((*file)->value.str.val, "r", IGNORE_PATH|IGNORE_URL_WIN, &issock, &socketd, NULL);
 #endif
@@ -720,7 +720,7 @@ PHP_FUNCTION(imagejpeg)
        }
 
        if (argc > 1 && fn && strlen(fn)) {
-               fp = PHP_FOPEN(fn, "wb");
+               fp = V_FOPEN(fn, "wb");
                if (!fp) {
                        php_error(E_WARNING, "ImageJpeg: unable to open %s for writing", fn);
                        RETURN_FALSE;
index 06a656516e53500c59917ad8521374c7635f8104..37c045ef3aed6979a568133ee31e2cd288ae48c1 100644 (file)
@@ -161,7 +161,7 @@ static PHP_INI_MH(OnTypelibFileChange)
 #endif
 
 
-       if (!new_value || (typelib_file=PHP_FOPEN(new_value, "r"))==NULL) {
+       if (!new_value || (typelib_file=V_FOPEN(new_value, "r"))==NULL) {
                return FAILURE;
        }
 
index 8be243993cac60fce1f1a68a2e823852877f7734..bce69d9728401a5dd6f9a44798f34a9955674c1f 100644 (file)
@@ -210,7 +210,7 @@ PHPAPI FILE *php_fopen_wrapper(char *path, char *mode, int options, int *issock,
                if (php_check_open_basedir(path)) {
                        return NULL;
                }
-               fp = PHP_FOPEN(path, mode);
+               fp = V_FOPEN(path, mode);
                if (fp && opened_path) {
                        *opened_path = expand_filepath(path);
                }
@@ -292,7 +292,7 @@ PHPAPI FILE *php_fopen_primary_script(void)
                SG(request_info).path_translated = NULL;
                return NULL;
        }
-       fp = PHP_FOPEN(fn, "r");
+       fp = V_FOPEN(fn, "r");
 
        /* refuse to open anything that is not a regular file */
        if (fp && (0 > fstat(fileno(fp), &st) || !S_ISREG(st.st_mode))) {
@@ -308,7 +308,7 @@ PHPAPI FILE *php_fopen_primary_script(void)
        temp = estrdup(fn);
        php_dirname(temp, strlen(temp));
        if (*temp) {
-               PHP_CHDIR(temp);
+               V_CHDIR(temp);
        }
        efree(temp);
        SG(request_info).path_translated = fn;
@@ -341,7 +341,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                        return NULL;
                }
                if (php_check_open_basedir(filename)) return NULL;
-               fp = PHP_FOPEN(filename, mode);
+               fp = V_FOPEN(filename, mode);
                if (fp && opened_path) {
                        *opened_path = expand_filepath(filename);
                }
@@ -363,7 +363,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                                return NULL;
                        }
                        if (php_check_open_basedir(trypath)) return NULL;
-                       fp = PHP_FOPEN(trypath, mode);
+                       fp = V_FOPEN(trypath, mode);
                        if (fp && opened_path) {
                                *opened_path = expand_filepath(trypath);
                        }
@@ -372,7 +372,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                        if (php_check_open_basedir(filename)) {
                                return NULL;
                        }
-                       fp = PHP_FOPEN(filename, mode);
+                       fp = V_FOPEN(filename, mode);
                        if (fp && opened_path) {
                                *opened_path = expand_filepath(filename);
                        }
@@ -386,7 +386,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                if (php_check_open_basedir(filename)) {
                        return NULL;
                }
-               fp = PHP_FOPEN(filename, mode);
+               fp = V_FOPEN(filename, mode);
                if (fp && opened_path) {
                        *opened_path = strdup(filename);
                }
@@ -413,7 +413,7 @@ PHPAPI FILE *php_fopen_with_path(char *filename, char *mode, char *path, char **
                                return NULL;
                        }
                }
-               if ((fp = PHP_FOPEN(trypath, mode)) != NULL) {
+               if ((fp = V_FOPEN(trypath, mode)) != NULL) {
                        if (php_check_open_basedir(trypath)) {
                                fclose(fp);
                                efree(pathbuf);
@@ -916,7 +916,7 @@ static FILE *php_fopen_url_wrapper(const char *path, char *mode, int options, in
                                if (php_check_open_basedir((char *) path)) {
                                        fp = NULL;
                                } else {
-                                       fp = PHP_FOPEN(path, mode);
+                                       fp = V_FOPEN(path, mode);
                                }
                        }
                }
@@ -1010,7 +1010,7 @@ PHPAPI char *expand_filepath(char *filepath)
        if (filepath[0] == '.') {
                char *cwd = malloc(MAXPATHLEN + 1);
 
-               if (PHP_GETCWD(cwd, MAXPATHLEN)) {
+               if (V_GETCWD(cwd, MAXPATHLEN)) {
                        char *cwd_end = cwd + strlen(cwd);
 
                        if (filepath[1] == '.') {       /* parent directory - .. */
index 9c0eae11ed14e1e8594bdbd9bc27ad4e5dc0477d..1ec9de91f9616fc3402d078568da486014f628cd 100644 (file)
@@ -252,7 +252,7 @@ void php_log_err(char *log_message)
                        return;
                }
 #endif
-               log_file = PHP_FOPEN(PG(error_log), "a");
+               log_file = V_FOPEN(PG(error_log), "a");
                if (log_file != NULL) {
                        time(&error_time);
                        strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", localtime_r(&error_time, &tmbuf)); 
index ab47f021625813eda85df6ce92937c702bc9a1b5..89968361f1e5bd69d572b122246c5e6def24b189 100644 (file)
@@ -289,17 +289,17 @@ PHPAPI int cfg_get_string(char *varname, char **result);
 
 /* Virtual current directory support */
 #ifdef VIRTUAL_DIR
-#define PHP_GETCWD(buff, size) virtual_getcwd(buff,size)
-#define PHP_FOPEN(path, mode) virtual_fopen(path, mode)
-#define PHP_CHDIR(path) virtual_chdir(path)
-#define PHP_CHDIR_FILE(path) virtual_chdir_file(path)
-#define PHP_GETWD(buf)
+#define V_GETCWD(buff, size) virtual_getcwd(buff,size)
+#define V_FOPEN(path, mode) virtual_fopen(path, mode)
+#define V_CHDIR(path) virtual_chdir(path)
+#define V_CHDIR_FILE(path) virtual_chdir_file(path)
+#define V_GETWD(buf)
 #else
-#define PHP_GETCWD(buff, size) getcwd(buff,size)
-#define PHP_FOPEN(path, mode)  fopen(path, mode)
-#define PHP_CHDIR(path) chdir(path)
-#define PHP_CHDIR_FILE(path) chdir_file(path)
-#define PHP_GETWD(buf) getwd(buf)
+#define V_GETCWD(buff, size) getcwd(buff,size)
+#define V_FOPEN(path, mode)  fopen(path, mode)
+#define V_CHDIR(path) chdir(path)
+#define V_CHDIR_FILE(path) chdir_file(path)
+#define V_GETWD(buf) getwd(buf)
 #endif
 
 #include "zend_constants.h"
index b134b3fce33005a5159ab732bcc88a9c420eb761..d60efa362c2782b67ce180a03a3ca3703c3d83b9 100644 (file)
@@ -63,7 +63,7 @@ char *php_realpath(char *path, char resolved_path []) {
        if ((*workpos == '\\') || (*workpos == '/')) {
                /* We start at the root of the current drive */
                /* Get the current directory */
-               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
+               if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
@@ -79,7 +79,7 @@ char *php_realpath(char *path, char resolved_path []) {
                workpos++;
        } else {
                /* Use the current directory */
-               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
+               if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
@@ -94,7 +94,7 @@ char *php_realpath(char *path, char resolved_path []) {
                workpos++;
        } else {
                /* Use the current directory */
-               if (PHP_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
+               if (V_GETCWD(path_construction, MAXPATHLEN-1) == NULL) {
                        /* Unable to get cwd */
                        resolved_path[0] = 0;
                        return NULL;
index 5116f42208e9aab025a5a6212daf2ade91784015..b35fa7a90f3ff102495c0462b0d9069409275e4f 100644 (file)
@@ -257,7 +257,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
                                } else if ((loc - ptr - 4) <= 0) {
                                        fn = "none";
                                } else {
-                                       fp = PHP_FOPEN(fn, "wb");
+                                       fp = V_FOPEN(fn, "wb");
                                        if (!fp) {
                                                php_error(E_WARNING, "File Upload Error - Unable to open temporary file [%s]", fn);
                                                SAFE_RETURN;
index b072552787146da7d3ed729c6fbeee9de37f67fc..ac33ba88db000d65ff9874077637115225e8da8d 100644 (file)
@@ -88,7 +88,7 @@ PHPAPI int php_checkuid(const char *fn, int mode) {
                duid = sb.st_uid;
        } else {
                s = emalloc(MAXPATHLEN+1);
-               if (!PHP_GETCWD(s,MAXPATHLEN)) {
+               if (!V_GETCWD(s,MAXPATHLEN)) {
                        php_error(E_WARNING, "Unable to access current working directory");
                        return(0);
                }