mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
mcal_next_recurrence() actually works again now (in addition to not
crashing). Also, cleaned up the formatting.
This commit is contained in:
parent
e45c1af8b4
commit
d91d3bbee2
1 changed files with 258 additions and 318 deletions
|
@ -66,8 +66,7 @@ typedef struct _php_mcal_le_struct {
|
||||||
} pils;
|
} pils;
|
||||||
|
|
||||||
|
|
||||||
typedef struct cal_list
|
typedef struct cal_list {
|
||||||
{
|
|
||||||
u_int32_t uid;
|
u_int32_t uid;
|
||||||
struct cal_list *next;
|
struct cal_list *next;
|
||||||
} cal_list_t;
|
} cal_list_t;
|
||||||
|
@ -201,7 +200,6 @@ PHP_MINIT_FUNCTION(mcal)
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int add_assoc_object(pval *arg, char *key, pval *tmp)
|
static int add_assoc_object(pval *arg, char *key, pval *tmp)
|
||||||
{
|
{
|
||||||
HashTable *symtable;
|
HashTable *symtable;
|
||||||
|
@ -214,7 +212,6 @@ static int add_assoc_object(pval *arg, char *key, pval *tmp)
|
||||||
return zend_hash_update(symtable, key, strlen(key)+1, (void *)&tmp, sizeof(pval *), NULL);
|
return zend_hash_update(symtable, key, strlen(key)+1, (void *)&tmp, sizeof(pval *), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
{
|
{
|
||||||
pval *calendar;
|
pval *calendar;
|
||||||
|
@ -240,7 +237,6 @@ void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
if (myargc == 4) {
|
if (myargc == 4) {
|
||||||
convert_to_long(options);
|
convert_to_long(options);
|
||||||
flags=options->value.lval;
|
flags=options->value.lval;
|
||||||
php_printf("option is: %d\n",options->value.lval);
|
|
||||||
}
|
}
|
||||||
mcal_stream = cal_open(NULL,calendar->value.str.val,0);
|
mcal_stream = cal_open(NULL,calendar->value.str.val,0);
|
||||||
if (!mcal_stream) {
|
if (!mcal_stream) {
|
||||||
|
@ -256,6 +252,73 @@ void php_mcal_do_open(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
||||||
RETURN_LONG(ind);
|
RETURN_LONG(ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void php_mcal_event_init(struct _php_mcal_le_struct *mystruct)
|
||||||
|
{
|
||||||
|
calevent_free(mystruct->event);
|
||||||
|
mystruct->event=calevent_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
void make_event_object(pval *mypvalue, CALEVENT *event)
|
||||||
|
{
|
||||||
|
pval *start, *end, *recurend;
|
||||||
|
object_init(mypvalue);
|
||||||
|
add_property_long(mypvalue,"id",event->id);
|
||||||
|
add_property_long(mypvalue,"public",event->public);
|
||||||
|
|
||||||
|
MAKE_STD_ZVAL(start);
|
||||||
|
object_init(start);
|
||||||
|
if (event->start.has_date) {
|
||||||
|
add_property_long(start,"year",event->start.year);
|
||||||
|
add_property_long(start,"month",event->start.mon);
|
||||||
|
add_property_long(start,"mday",event->start.mday);
|
||||||
|
}
|
||||||
|
if (event->start.has_time) {
|
||||||
|
add_property_long(start,"hour",event->start.hour);
|
||||||
|
add_property_long(start,"min",event->start.min);
|
||||||
|
add_property_long(start,"sec",event->start.sec);
|
||||||
|
}
|
||||||
|
add_assoc_object(mypvalue, "start", start);
|
||||||
|
|
||||||
|
MAKE_STD_ZVAL(end);
|
||||||
|
object_init(end);
|
||||||
|
if (event->end.has_date) {
|
||||||
|
add_property_long(end,"year",event->end.year);
|
||||||
|
add_property_long(end,"month",event->end.mon);
|
||||||
|
add_property_long(end,"mday",event->end.mday);
|
||||||
|
}
|
||||||
|
if (event->end.has_time) {
|
||||||
|
add_property_long(end,"hour",event->end.hour);
|
||||||
|
add_property_long(end,"min",event->end.min);
|
||||||
|
add_property_long(end,"sec",event->end.sec);
|
||||||
|
}
|
||||||
|
add_assoc_object(mypvalue, "end", end);
|
||||||
|
|
||||||
|
if (event->category)
|
||||||
|
add_property_string(mypvalue,"category",event->category,1);
|
||||||
|
if (event->title)
|
||||||
|
add_property_string(mypvalue,"title",event->title,1);
|
||||||
|
if (event->description)
|
||||||
|
add_property_string(mypvalue,"description",event->description,1);
|
||||||
|
add_property_long(mypvalue,"alarm",event->alarm);
|
||||||
|
add_property_long(mypvalue,"recur_type",event->recur_type);
|
||||||
|
add_property_long(mypvalue,"recur_interval",event->recur_interval);
|
||||||
|
|
||||||
|
MAKE_STD_ZVAL(recurend);
|
||||||
|
object_init(recurend);
|
||||||
|
if (event->recur_enddate.has_date) {
|
||||||
|
add_property_long(recurend,"year",event->recur_enddate.year);
|
||||||
|
add_property_long(recurend,"month",event->recur_enddate.mon);
|
||||||
|
add_property_long(recurend,"mday",event->recur_enddate.mday);
|
||||||
|
}
|
||||||
|
if (event->recur_enddate.has_time) {
|
||||||
|
add_property_long(recurend,"hour",event->recur_enddate.hour);
|
||||||
|
add_property_long(recurend,"min",event->recur_enddate.min);
|
||||||
|
add_property_long(recurend,"sec",event->recur_enddate.sec);
|
||||||
|
}
|
||||||
|
add_assoc_object(mypvalue, "recur_enddate", recurend);
|
||||||
|
|
||||||
|
add_property_long(mypvalue,"recur_data",event->recur_data.weekly_wday);
|
||||||
|
}
|
||||||
|
|
||||||
/* {{{ proto int mcal_close(int stream_id [, int options])
|
/* {{{ proto int mcal_close(int stream_id [, int options])
|
||||||
Close an MCAL stream */
|
Close an MCAL stream */
|
||||||
|
@ -296,7 +359,6 @@ PHP_FUNCTION(mcal_open)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto int mcal_reopen(int stream_id, string calendar [, int options])
|
/* {{{ proto int mcal_reopen(int stream_id, string calendar [, int options])
|
||||||
Reopen MCAL stream to new calendar */
|
Reopen MCAL stream to new calendar */
|
||||||
PHP_FUNCTION(mcal_reopen)
|
PHP_FUNCTION(mcal_reopen)
|
||||||
|
@ -424,72 +486,6 @@ PHP_FUNCTION(mcal_fetch_current_stream_event)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void make_event_object(pval *mypvalue, CALEVENT *event)
|
|
||||||
{
|
|
||||||
pval *start, *end, *recurend;
|
|
||||||
object_init(mypvalue);
|
|
||||||
add_property_long(mypvalue,"id",event->id);
|
|
||||||
add_property_long(mypvalue,"public",event->public);
|
|
||||||
|
|
||||||
MAKE_STD_ZVAL(start);
|
|
||||||
object_init(start);
|
|
||||||
if (event->start.has_date) {
|
|
||||||
add_property_long(start,"year",event->start.year);
|
|
||||||
add_property_long(start,"month",event->start.mon);
|
|
||||||
add_property_long(start,"mday",event->start.mday);
|
|
||||||
}
|
|
||||||
if (event->start.has_time) {
|
|
||||||
add_property_long(start,"hour",event->start.hour);
|
|
||||||
add_property_long(start,"min",event->start.min);
|
|
||||||
add_property_long(start,"sec",event->start.sec);
|
|
||||||
}
|
|
||||||
add_assoc_object(mypvalue, "start",start);
|
|
||||||
|
|
||||||
MAKE_STD_ZVAL(end);
|
|
||||||
object_init(end);
|
|
||||||
if (event->end.has_date) {
|
|
||||||
add_property_long(end,"year",event->end.year);
|
|
||||||
add_property_long(end,"month",event->end.mon);
|
|
||||||
add_property_long(end,"mday",event->end.mday);
|
|
||||||
}
|
|
||||||
if (event->end.has_time) {
|
|
||||||
add_property_long(end,"hour",event->end.hour);
|
|
||||||
add_property_long(end,"min",event->end.min);
|
|
||||||
add_property_long(end,"sec",event->end.sec);
|
|
||||||
}
|
|
||||||
add_assoc_object(mypvalue, "end",end);
|
|
||||||
|
|
||||||
if (event->category)
|
|
||||||
add_property_string(mypvalue,"category",event->category,1);
|
|
||||||
if (event->title)
|
|
||||||
add_property_string(mypvalue,"title",event->title,1);
|
|
||||||
if (event->description)
|
|
||||||
add_property_string(mypvalue,"description",event->description,1);
|
|
||||||
add_property_long(mypvalue,"alarm",event->alarm);
|
|
||||||
add_property_long(mypvalue,"recur_type",event->recur_type);
|
|
||||||
add_property_long(mypvalue,"recur_interval",event->recur_interval);
|
|
||||||
|
|
||||||
MAKE_STD_ZVAL(recurend);
|
|
||||||
object_init(recurend);
|
|
||||||
if (event->recur_enddate.has_date) {
|
|
||||||
add_property_long(recurend,"year",event->recur_enddate.year);
|
|
||||||
add_property_long(recurend,"month",event->recur_enddate.mon);
|
|
||||||
add_property_long(recurend,"mday",event->recur_enddate.mday);
|
|
||||||
}
|
|
||||||
if (event->recur_enddate.has_time) {
|
|
||||||
add_property_long(recurend,"hour",event->recur_enddate.hour);
|
|
||||||
add_property_long(recurend,"min",event->recur_enddate.min);
|
|
||||||
add_property_long(recurend,"sec",event->recur_enddate.sec);
|
|
||||||
}
|
|
||||||
add_assoc_object(mypvalue, "recur_enddate",recurend);
|
|
||||||
|
|
||||||
add_property_long(mypvalue,"recur_data",event->recur_data.weekly_wday);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto array mcal_list_events(int stream_id,object begindate [, object enddate])
|
/* {{{ proto array mcal_list_events(int stream_id,object begindate [, object enddate])
|
||||||
Returns list of UIDs for that day or range of days */
|
Returns list of UIDs for that day or range of days */
|
||||||
PHP_FUNCTION(mcal_list_events)
|
PHP_FUNCTION(mcal_list_events)
|
||||||
|
@ -523,8 +519,7 @@ PHP_FUNCTION(mcal_list_events)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(myargc ==7)
|
if (myargc == 7) {
|
||||||
{
|
|
||||||
convert_to_long(startyear);
|
convert_to_long(startyear);
|
||||||
convert_to_long(startmonth);
|
convert_to_long(startmonth);
|
||||||
convert_to_long(startday);
|
convert_to_long(startday);
|
||||||
|
@ -534,8 +529,7 @@ PHP_FUNCTION(mcal_list_events)
|
||||||
dt_setdate(&startdate,startyear->value.lval,startmonth->value.lval,startday->value.lval);
|
dt_setdate(&startdate,startyear->value.lval,startmonth->value.lval,startday->value.lval);
|
||||||
dt_setdate(&enddate,endyear->value.lval,endmonth->value.lval,endday->value.lval);
|
dt_setdate(&enddate,endyear->value.lval,endmonth->value.lval,endday->value.lval);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
startdate=mcal_le_struct->event->start;
|
startdate=mcal_le_struct->event->start;
|
||||||
enddate=mcal_le_struct->event->end;
|
enddate=mcal_le_struct->event->end;
|
||||||
}
|
}
|
||||||
|
@ -543,8 +537,7 @@ PHP_FUNCTION(mcal_list_events)
|
||||||
g_cal_list=NULL;
|
g_cal_list=NULL;
|
||||||
cal_search_range(mcal_le_struct->mcal_stream,&startdate,&enddate);
|
cal_search_range(mcal_le_struct->mcal_stream,&startdate,&enddate);
|
||||||
my_cal_list=g_cal_list;
|
my_cal_list=g_cal_list;
|
||||||
while(my_cal_list != NULL)
|
while (my_cal_list != NULL) {
|
||||||
{
|
|
||||||
add_next_index_long(return_value,my_cal_list->uid);
|
add_next_index_long(return_value,my_cal_list->uid);
|
||||||
my_cal_list=my_cal_list->next;
|
my_cal_list=my_cal_list->next;
|
||||||
free(g_cal_list);
|
free(g_cal_list);
|
||||||
|
@ -612,6 +605,7 @@ PHP_FUNCTION(mcal_rename_calendar)
|
||||||
php_error(E_WARNING, "Unable to find stream pointer");
|
php_error(E_WARNING, "Unable to find stream pointer");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(mcal_rename(mcal_le_struct->mcal_stream,src_calendar->value.str.val,dest_calendar->value.str.val)) {RETURN_TRUE;}
|
if(mcal_rename(mcal_le_struct->mcal_stream,src_calendar->value.str.val,dest_calendar->value.str.val)) {RETURN_TRUE;}
|
||||||
else {RETURN_FALSE; }
|
else {RETURN_FALSE; }
|
||||||
|
@ -619,9 +613,6 @@ PHP_FUNCTION(mcal_rename_calendar)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto int mcal_reopen(int stream_id, array date, array time)
|
/* {{{ proto int mcal_reopen(int stream_id, array date, array time)
|
||||||
List alarms for a given time */
|
List alarms for a given time */
|
||||||
PHP_FUNCTION(mcal_list_alarms)
|
PHP_FUNCTION(mcal_list_alarms)
|
||||||
|
@ -649,8 +640,7 @@ PHP_FUNCTION(mcal_list_alarms)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myargc ==7)
|
if (myargc == 7) {
|
||||||
{
|
|
||||||
convert_to_long(year);
|
convert_to_long(year);
|
||||||
convert_to_long(month);
|
convert_to_long(month);
|
||||||
convert_to_long(day);
|
convert_to_long(day);
|
||||||
|
@ -660,15 +650,13 @@ PHP_FUNCTION(mcal_list_alarms)
|
||||||
dt_setdate(&mydate,year->value.lval,month->value.lval,day->value.lval);
|
dt_setdate(&mydate,year->value.lval,month->value.lval,day->value.lval);
|
||||||
dt_settime(&mydate,hour->value.lval,min->value.lval,sec->value.lval);
|
dt_settime(&mydate,hour->value.lval,min->value.lval,sec->value.lval);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
mydate=mcal_le_struct->event->start;
|
mydate=mcal_le_struct->event->start;
|
||||||
}
|
}
|
||||||
g_cal_list=NULL;
|
g_cal_list=NULL;
|
||||||
cal_search_alarm(mcal_le_struct->mcal_stream,&mydate);
|
cal_search_alarm(mcal_le_struct->mcal_stream,&mydate);
|
||||||
my_cal_list=g_cal_list;
|
my_cal_list=g_cal_list;
|
||||||
while(my_cal_list != NULL)
|
while (my_cal_list != NULL) {
|
||||||
{
|
|
||||||
add_next_index_long(return_value,my_cal_list->uid);
|
add_next_index_long(return_value,my_cal_list->uid);
|
||||||
my_cal_list=my_cal_list->next;
|
my_cal_list=my_cal_list->next;
|
||||||
free(g_cal_list);
|
free(g_cal_list);
|
||||||
|
@ -835,16 +823,12 @@ PHP_FUNCTION(mcal_snooze)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cal_snooze(mcal_le_struct->mcal_stream,uid->value.lval))
|
if (cal_snooze(mcal_le_struct->mcal_stream,uid->value.lval)) {
|
||||||
{
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -964,14 +948,12 @@ PHP_FUNCTION(mcal_event_set_start)
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dt_setdate(&(mcal_le_struct->event->start),year->value.lval,month->value.lval,date->value.lval);
|
dt_setdate(&(mcal_le_struct->event->start),year->value.lval,month->value.lval,date->value.lval);
|
||||||
|
|
||||||
if (myargc > 4) myhour=hour->value.lval;
|
if (myargc > 4) myhour=hour->value.lval;
|
||||||
if (myargc > 5) mymin=min->value.lval;
|
if (myargc > 5) mymin=min->value.lval;
|
||||||
if (myargc > 6) mysec=sec->value.lval;
|
if (myargc > 6) mysec=sec->value.lval;
|
||||||
if (myargc >4) dt_settime(&(mcal_le_struct->event->start),myhour,mymin,mysec);
|
if (myargc >4) dt_settime(&(mcal_le_struct->event->start),myhour,mymin,mysec);
|
||||||
|
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
@ -1060,11 +1042,8 @@ PHP_FUNCTION(mcal_event_init)
|
||||||
}
|
}
|
||||||
|
|
||||||
convert_to_long(streamind);
|
convert_to_long(streamind);
|
||||||
|
|
||||||
ind = streamind->value.lval;
|
ind = streamind->value.lval;
|
||||||
|
|
||||||
mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
|
mcal_le_struct = (pils *)zend_list_find(ind, &ind_type);
|
||||||
|
|
||||||
if (!mcal_le_struct ) {
|
if (!mcal_le_struct ) {
|
||||||
php_error(E_WARNING, "Unable to find stream pointer");
|
php_error(E_WARNING, "Unable to find stream pointer");
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
|
@ -1073,13 +1052,6 @@ PHP_FUNCTION(mcal_event_init)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
void php_mcal_event_init(struct _php_mcal_le_struct *mystruct)
|
|
||||||
{
|
|
||||||
calevent_free(mystruct->event);
|
|
||||||
mystruct->event=calevent_new();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto int mcal_event_set_class(int stream_id, int class)
|
/* {{{ proto int mcal_event_set_class(int stream_id, int class)
|
||||||
Add an class to the streams global event */
|
Add an class to the streams global event */
|
||||||
PHP_FUNCTION(mcal_event_set_class)
|
PHP_FUNCTION(mcal_event_set_class)
|
||||||
|
@ -1108,8 +1080,6 @@ PHP_FUNCTION(mcal_event_set_class)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto bool mcal_is_leap_year(int year)
|
/* {{{ proto bool mcal_is_leap_year(int year)
|
||||||
Returns true if year is a leap year, false if not */
|
Returns true if year is a leap year, false if not */
|
||||||
PHP_FUNCTION(mcal_is_leap_year)
|
PHP_FUNCTION(mcal_is_leap_year)
|
||||||
|
@ -1121,12 +1091,10 @@ PHP_FUNCTION(mcal_is_leap_year)
|
||||||
WRONG_PARAM_COUNT;
|
WRONG_PARAM_COUNT;
|
||||||
}
|
}
|
||||||
convert_to_long(year);
|
convert_to_long(year);
|
||||||
if(isleapyear(year->value.lval))
|
if (isleapyear(year->value.lval)) {
|
||||||
{
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1149,7 +1117,6 @@ PHP_FUNCTION(mcal_days_in_month)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto bool mcal_date_valid(int year, int month, int day)
|
/* {{{ proto bool mcal_date_valid(int year, int month, int day)
|
||||||
Returns true if the date is a valid date */
|
Returns true if the date is a valid date */
|
||||||
PHP_FUNCTION(mcal_date_valid)
|
PHP_FUNCTION(mcal_date_valid)
|
||||||
|
@ -1163,19 +1130,15 @@ PHP_FUNCTION(mcal_date_valid)
|
||||||
convert_to_long(year);
|
convert_to_long(year);
|
||||||
convert_to_long(month);
|
convert_to_long(month);
|
||||||
convert_to_long(day);
|
convert_to_long(day);
|
||||||
if(datevalid(year->value.lval,month->value.lval,day->value.lval))
|
if (datevalid(year->value.lval,month->value.lval,day->value.lval)) {
|
||||||
{
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto bool mcal_time_valid(int hour, int min, int sec)
|
/* {{{ proto bool mcal_time_valid(int hour, int min, int sec)
|
||||||
Returns true if the time is a valid time */
|
Returns true if the time is a valid time */
|
||||||
PHP_FUNCTION(mcal_time_valid)
|
PHP_FUNCTION(mcal_time_valid)
|
||||||
|
@ -1189,12 +1152,10 @@ PHP_FUNCTION(mcal_time_valid)
|
||||||
convert_to_long(hour);
|
convert_to_long(hour);
|
||||||
convert_to_long(min);
|
convert_to_long(min);
|
||||||
convert_to_long(sec);
|
convert_to_long(sec);
|
||||||
if(timevalid(hour->value.lval,min->value.lval,sec->value.lval))
|
if (timevalid(hour->value.lval,min->value.lval,sec->value.lval)) {
|
||||||
{
|
|
||||||
RETURN_TRUE;
|
RETURN_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1240,7 +1201,7 @@ PHP_FUNCTION(mcal_day_of_year)
|
||||||
|
|
||||||
RETURN_LONG(dt_dayofyear(&mydate));
|
RETURN_LONG(dt_dayofyear(&mydate));
|
||||||
}
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto int mcal_day_of_week(int ayear, int amonth, int aday, int byear, int bmonth, int bday)
|
/* {{{ proto int mcal_day_of_week(int ayear, int amonth, int aday, int byear, int bmonth, int bday)
|
||||||
Returns <0, 0, >0 if a<b, a==b, a>b respectively */
|
Returns <0, 0, >0 if a<b, a==b, a>b respectively */
|
||||||
|
@ -1268,11 +1229,8 @@ PHP_FUNCTION(mcal_date_compare)
|
||||||
|
|
||||||
RETURN_LONG(dt_compare(&myadate, &mybdate));
|
RETURN_LONG(dt_compare(&myadate, &mybdate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto object mcal_next_recurrence(int stream_id, int weekstart, array next)
|
/* {{{ proto object mcal_next_recurrence(int stream_id, int weekstart, array next)
|
||||||
Returns an object filled with the next date the event occurs, on or after the supplied date. Returns empty date field if event does not occur or something is invalid. */
|
Returns an object filled with the next date the event occurs, on or after the supplied date. Returns empty date field if event does not occur or something is invalid. */
|
||||||
PHP_FUNCTION(mcal_next_recurrence)
|
PHP_FUNCTION(mcal_next_recurrence)
|
||||||
|
@ -1332,8 +1290,9 @@ PHP_FUNCTION(mcal_next_recurrence)
|
||||||
|
|
||||||
calevent_next_recurrence(mcal_le_struct->event,&mydate,weekstart->value.lval);
|
calevent_next_recurrence(mcal_le_struct->event,&mydate,weekstart->value.lval);
|
||||||
|
|
||||||
MAKE_STD_ZVAL(return_value);
|
if (object_init(return_value) == FAILURE) {
|
||||||
object_init(return_value);
|
RETURN_FALSE;
|
||||||
|
}
|
||||||
if (mydate.has_date) {
|
if (mydate.has_date) {
|
||||||
add_property_long(return_value,"year",mydate.year);
|
add_property_long(return_value,"year",mydate.year);
|
||||||
add_property_long(return_value,"month",mydate.mon);
|
add_property_long(return_value,"month",mydate.mon);
|
||||||
|
@ -1347,7 +1306,6 @@ PHP_FUNCTION(mcal_next_recurrence)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
/* {{{ proto string mcal_event_set_recur_none(int stream_id)
|
/* {{{ proto string mcal_event_set_recur_none(int stream_id)
|
||||||
Create a daily recurrence */
|
Create a daily recurrence */
|
||||||
PHP_FUNCTION(mcal_event_set_recur_none)
|
PHP_FUNCTION(mcal_event_set_recur_none)
|
||||||
|
@ -1573,20 +1531,15 @@ PHP_FUNCTION(mcal_event_set_recur_yearly)
|
||||||
|
|
||||||
|
|
||||||
/* Interfaces to callbacks */
|
/* Interfaces to callbacks */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cc_searched (unsigned long cal_uid)
|
void cc_searched (unsigned long cal_uid)
|
||||||
{
|
{
|
||||||
if(g_cal_list==NULL)
|
if (g_cal_list==NULL) {
|
||||||
{
|
|
||||||
g_cal_list=malloc(sizeof(struct cal_list));
|
g_cal_list=malloc(sizeof(struct cal_list));
|
||||||
g_cal_list->uid=cal_uid;
|
g_cal_list->uid=cal_uid;
|
||||||
g_cal_list->next=NULL;
|
g_cal_list->next=NULL;
|
||||||
g_cal_list_end=g_cal_list;
|
g_cal_list_end=g_cal_list;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
g_cal_list_end->next=malloc(sizeof(struct cal_list));
|
g_cal_list_end->next=malloc(sizeof(struct cal_list));
|
||||||
g_cal_list_end=g_cal_list_end->next;
|
g_cal_list_end=g_cal_list_end->next;
|
||||||
g_cal_list_end->uid=cal_uid;
|
g_cal_list_end->uid=cal_uid;
|
||||||
|
@ -1594,46 +1547,33 @@ void cc_searched (unsigned long cal_uid)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cc_appended(u_int32_t uid)
|
void cc_appended(u_int32_t uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cc_fetched(const CALEVENT *event)
|
void cc_fetched(const CALEVENT *event)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cc_login(const char **user, const char **pwd)
|
void cc_login(const char **user, const char **pwd)
|
||||||
{
|
{
|
||||||
|
|
||||||
*user=mcal_user;
|
*user=mcal_user;
|
||||||
*pwd=mcal_password;
|
*pwd=mcal_password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cc_vlog(const char *fmt,va_list ap)
|
void cc_vlog(const char *fmt,va_list ap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void cc_vdlog(const char *fmt,va_list ap)
|
void cc_vdlog(const char *fmt,va_list ap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local_ variables:
|
* Local_ variables:
|
||||||
* tab-width: 4
|
* tab-width: 4
|
||||||
* c-basic-offset: 4
|
* c-basic-offset: 4
|
||||||
* End:
|
* End:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue