/* {{{ isAdminAllowed(): check if the admin functions are allowed for the calling script */ static int isAdminAllowed(TSRMLS_D) { const char *filename = zend_get_executed_filename(TSRMLS_C); if (EAG(allowed_admin_path) && *EAG(allowed_admin_path)) { char *path; char *p; char *next; path = estrdup(EAG(allowed_admin_path)); p = path; while (p && *p) { next = strchr(p, DEFAULT_DIR_SEPARATOR); if (next != NULL) { *next = '\0'; ++next; } if (!php_check_specific_open_basedir(p, filename TSRMLS_CC)) { efree(path); return 1; } p = next; } efree(path); return 0; } return 0; }
/** * Init the debug system. This must be called before any debug * functions are used. */ void ea_debug_init (TSRMLS_D) { F_fp = fopen (EAG(ea_log_file), "a"); if (!F_fp) F_fp = stderr; file_no = fileno(F_fp); }
static size_t calc_string(char *str, int len TSRMLS_DC) #endif { if (len > MAX_DUP_STR_LEN || zend_hash_add(&EAG(strings), str, len, &str, sizeof(char *), NULL) == SUCCESS) { EA_SIZE_ALIGN(len); return len; } return 0; }
/** * Pad the message with the current pad level. */ void ea_debug_pad (long debug_level TSRMLS_DC) { #ifdef DEBUG /* This ifdef is still req'd because xpad is N/A in a non-debug compile */ if (ea_debug & debug_level) { int i; if (F_fp != stderr) { EACCELERATOR_FLOCK(file_no, LOCK_EX); } i = EAG (xpad); while (i-- > 0) { fputc ('\t', F_fp); } if (F_fp != stderr) { EACCELERATOR_FLOCK(file_no, LOCK_UN); } } #endif }