View | Details | Raw Unified | Return to bug 4907
Collapse All | Expand All

(-)php4-4.2.3/ext/imap/php_imap.c (+52 lines)
Lines 133-142 Link Here
133
133
134
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
134
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
135
	PHP_FE(imap_get_quota,							NULL)
135
	PHP_FE(imap_get_quota,							NULL)
136
	PHP_FE(imap_set_quota,							NULL)
136
	PHP_FE(imap_set_quota,							NULL)
137
 	PHP_FE(imap_setacl,								NULL)
137
 	PHP_FE(imap_setacl,								NULL)
138
 	PHP_FE(imap_getacl,								NULL)
138
#endif
139
#endif
139
140
140
	PHP_FE(imap_mail,								NULL)
141
	PHP_FE(imap_mail,								NULL)
141
142
142
	PHP_FALIAS(imap_header, 		imap_headerinfo,	NULL)
143
	PHP_FALIAS(imap_header, 		imap_headerinfo,	NULL)
Lines 384-393 Link Here
384
		IMAPG(quota_usage) = qlist->usage;
385
		IMAPG(quota_usage) = qlist->usage;
385
		IMAPG(quota_limit) = qlist->limit;
386
		IMAPG(quota_limit) = qlist->limit;
386
	}
387
	}
387
}
388
}
388
/* }}} */
389
/* }}} */
390
391
392
/* {{{ mail_getquota 
393
 *
394
 * Mail GET_ACL callback
395
 * Called via the mail_parameter function in c-client:src/c-client/mail.c
396
 */
397
void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
398
{
399
	TSRMLS_FETCH();
400
401
	/* walk through the ACLLIST */
402
	for (; alist; alist = alist->next)
403
	{
404
		add_assoc_stringl(IMAPG(imap_acl_list), alist->identifier, alist->rights, strlen(alist->rights), 1);
405
	}
406
407
}
408
/* }}} */
389
#endif
409
#endif
390
410
391
/* {{{ php_imap_init_globals
411
/* {{{ php_imap_init_globals
392
 */
412
 */
393
static void php_imap_init_globals(zend_imap_globals *imap_globals)
413
static void php_imap_init_globals(zend_imap_globals *imap_globals)
Lines 406-415 Link Here
406
	imap_globals->imap_messages_tail = NIL;
426
	imap_globals->imap_messages_tail = NIL;
407
	imap_globals->imap_folder_objects = NIL;
427
	imap_globals->imap_folder_objects = NIL;
408
	imap_globals->imap_folder_objects_tail = NIL;
428
	imap_globals->imap_folder_objects_tail = NIL;
409
	imap_globals->imap_sfolder_objects = NIL;
429
	imap_globals->imap_sfolder_objects = NIL;
410
	imap_globals->imap_sfolder_objects_tail = NIL;
430
	imap_globals->imap_sfolder_objects_tail = NIL;
431
	imap_globals->imap_acl_list = NIL;
411
432
412
	imap_globals->folderlist_style = FLIST_ARRAY;
433
	imap_globals->folderlist_style = FLIST_ARRAY;
413
}
434
}
414
/* }}} */
435
/* }}} */
415
436
Lines 1105-1114 Link Here
1105
1126
1106
	RETURN_LONG(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
1127
	RETURN_LONG(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
1107
}
1128
}
1108
/* }}} */
1129
/* }}} */
1109
1130
1131
1132
/* {{{ proto array imap_get_quota(int stream_id, string mailbox)
1133
	Gets the ACL for a given mailbox */
1134
PHP_FUNCTION(imap_getacl)
1135
{
1136
	zval **streamind, **mailbox;
1137
	pils *imap_le_struct;
1138
1139
	if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &streamind, &mailbox) == FAILURE) {
1140
		ZEND_WRONG_PARAM_COUNT();
1141
	}
1142
1143
	ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
1144
1145
	convert_to_string_ex(mailbox);
1146
1147
    /* initializing the special array for the return values */
1148
    array_init(return_value);
1149
1150
    IMAPG(imap_acl_list) = return_value;
1151
1152
	/* set the callback for the GET_ACL function */
1153
	mail_parameters(NIL, SET_ACL, (void *) mail_getacl);
1154
	if(!imap_getacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox))) {
1155
		php_error(E_WARNING, "c-client imap_getacl failed");
1156
		RETURN_FALSE;
1157
	}
1158
1159
    IMAPG(imap_acl_list) = NIL;
1160
}
1161
/* }}} */
1110
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
1162
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
1111
1163
1112
1164
1113
/* {{{ proto int imap_expunge(int stream_id)
1165
/* {{{ proto int imap_expunge(int stream_id)
1114
   Permanently delete all messages marked for deletion */
1166
   Permanently delete all messages marked for deletion */
(-)php4-4.2.3/ext/imap/php_imap.h (+2 lines)
Lines 177-186 Link Here
177
177
178
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
178
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
179
PHP_FUNCTION(imap_get_quota);
179
PHP_FUNCTION(imap_get_quota);
180
PHP_FUNCTION(imap_set_quota);
180
PHP_FUNCTION(imap_set_quota);
181
PHP_FUNCTION(imap_setacl);
181
PHP_FUNCTION(imap_setacl);
182
PHP_FUNCTION(imap_getacl);
182
#endif
183
#endif
183
184
184
185
185
ZEND_BEGIN_MODULE_GLOBALS(imap)
186
ZEND_BEGIN_MODULE_GLOBALS(imap)
186
	char *imap_user;
187
	char *imap_user;
Lines 208-217 Link Here
208
	unsigned long status_uidnext;
209
	unsigned long status_uidnext;
209
	unsigned long status_uidvalidity;
210
	unsigned long status_uidvalidity;
210
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
211
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
211
	unsigned long quota_usage;
212
	unsigned long quota_usage;
212
	unsigned long quota_limit;
213
	unsigned long quota_limit;
214
	pval *imap_acl_list;
213
#endif
215
#endif
214
ZEND_END_MODULE_GLOBALS(imap)
216
ZEND_END_MODULE_GLOBALS(imap)
215
217
216
#ifdef ZTS
218
#ifdef ZTS
217
# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)
219
# define IMAPG(v) TSRMG(imap_globals_id, zend_imap_globals *, v)

Return to bug 4907