@@ -538,268 +538,268 @@ discard block |
||
538 | 538 | |
539 | 539 | switch((string)$button) |
540 | 540 | { |
541 | - case 'exception': // create an exception in a recuring event |
|
542 | - $msg = $this->_create_exception($event,$preserv); |
|
543 | - break; |
|
541 | + case 'exception': // create an exception in a recuring event |
|
542 | + $msg = $this->_create_exception($event,$preserv); |
|
543 | + break; |
|
544 | 544 | |
545 | - case 'copy': // create new event with copied content, some content need to be unset to make a "new" event |
|
546 | - unset($event['id']); |
|
547 | - unset($event['uid']); |
|
548 | - unset($event['reference']); |
|
549 | - unset($preserv['reference']); |
|
550 | - unset($event['recurrence']); |
|
551 | - unset($preserv['recurrence']); |
|
552 | - unset($event['recur_exception']); |
|
553 | - unset($event['edit_single']); // in case it has been set |
|
554 | - unset($event['modified']); |
|
555 | - unset($event['modifier']); |
|
556 | - unset($event['caldav_name']); |
|
557 | - $event['owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD,0,$this->owner) ? $this->user : $this->owner; |
|
545 | + case 'copy': // create new event with copied content, some content need to be unset to make a "new" event |
|
546 | + unset($event['id']); |
|
547 | + unset($event['uid']); |
|
548 | + unset($event['reference']); |
|
549 | + unset($preserv['reference']); |
|
550 | + unset($event['recurrence']); |
|
551 | + unset($preserv['recurrence']); |
|
552 | + unset($event['recur_exception']); |
|
553 | + unset($event['edit_single']); // in case it has been set |
|
554 | + unset($event['modified']); |
|
555 | + unset($event['modifier']); |
|
556 | + unset($event['caldav_name']); |
|
557 | + $event['owner'] = !(int)$this->owner || !$this->bo->check_perms(EGW_ACL_ADD,0,$this->owner) ? $this->user : $this->owner; |
|
558 | + |
|
559 | + // Clear participant stati |
|
560 | + foreach($event['participant_types'] as $type => &$participants) |
|
561 | + { |
|
562 | + foreach($participants as $id => &$response) |
|
563 | + { |
|
564 | + if($type == 'u' && $id == $event['owner']) continue; |
|
565 | + calendar_so::split_status($response, $quantity, $role); |
|
566 | + // if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it |
|
567 | + $status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U'; |
|
568 | + $response = calendar_so::combine_status($status,$quantity,$role); |
|
569 | + } |
|
570 | + } |
|
558 | 571 | |
559 | - // Clear participant stati |
|
560 | - foreach($event['participant_types'] as $type => &$participants) |
|
561 | - { |
|
562 | - foreach($participants as $id => &$response) |
|
572 | + // Copy alarms |
|
573 | + if (is_array($event['alarm'])) |
|
563 | 574 | { |
564 | - if($type == 'u' && $id == $event['owner']) continue; |
|
565 | - calendar_so::split_status($response, $quantity, $role); |
|
566 | - // if resource defines callback for status of new status (eg. Resources app acknowledges direct booking acl), call it |
|
567 | - $status = isset($this->bo->resources[$type]['new_status']) ? ExecMethod($this->bo->resources[$type]['new_status'],$id) : 'U'; |
|
568 | - $response = calendar_so::combine_status($status,$quantity,$role); |
|
575 | + foreach($event['alarm'] as $n => &$alarm) |
|
576 | + { |
|
577 | + unset($alarm['id']); |
|
578 | + unset($alarm['cal_id']); |
|
579 | + } |
|
569 | 580 | } |
570 | - } |
|
571 | 581 | |
572 | - // Copy alarms |
|
573 | - if (is_array($event['alarm'])) |
|
574 | - { |
|
575 | - foreach($event['alarm'] as $n => &$alarm) |
|
582 | + // Get links to be copied |
|
583 | + // With no ID, $content['link_to']['to_id'] is used |
|
584 | + $content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0); |
|
585 | + foreach(egw_link::get_links('calendar', $content['id']) as $link) |
|
576 | 586 | { |
577 | - unset($alarm['id']); |
|
578 | - unset($alarm['cal_id']); |
|
587 | + if ($link['app'] != egw_link::VFS_APPNAME) |
|
588 | + { |
|
589 | + egw_link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
|
590 | + } |
|
591 | + elseif ($link['app'] == egw_link::VFS_APPNAME) |
|
592 | + { |
|
593 | + egw_link::link('calendar', $content['link_to']['to_id'], egw_link::VFS_APPNAME, array( |
|
594 | + 'tmp_name' => egw_link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'], |
|
595 | + 'name' => $link['id'], |
|
596 | + ), $link['remark']); |
|
597 | + } |
|
579 | 598 | } |
580 | - } |
|
599 | + unset($link); |
|
600 | + $preserv['view'] = $preserv['edit_single'] = false; |
|
601 | + $msg = lang('Event copied - the copy can now be edited'); |
|
602 | + $event['title'] = lang('Copy of:').' '.$event['title']; |
|
603 | + break; |
|
581 | 604 | |
582 | - // Get links to be copied |
|
583 | - // With no ID, $content['link_to']['to_id'] is used |
|
584 | - $content['link_to']['to_id'] = array('to_app' => 'calendar', 'to_id' => 0); |
|
585 | - foreach(egw_link::get_links('calendar', $content['id']) as $link) |
|
586 | - { |
|
587 | - if ($link['app'] != egw_link::VFS_APPNAME) |
|
605 | + case 'mail': |
|
606 | + case 'sendrequest': |
|
607 | + case 'save': |
|
608 | + case 'print': |
|
609 | + case 'apply': |
|
610 | + case 'infolog': |
|
611 | + if ($event['id'] && !$this->bo->check_perms(EGW_ACL_EDIT,$event)) |
|
588 | 612 | { |
589 | - egw_link::link('calendar', $content['link_to']['to_id'], $link['app'], $link['id'], $link['remark']); |
|
613 | + $msg = lang('Permission denied'); |
|
614 | + $button = ''; |
|
615 | + break; |
|
590 | 616 | } |
591 | - elseif ($link['app'] == egw_link::VFS_APPNAME) |
|
617 | + if ($event['start'] > $event['end']) |
|
592 | 618 | { |
593 | - egw_link::link('calendar', $content['link_to']['to_id'], egw_link::VFS_APPNAME, array( |
|
594 | - 'tmp_name' => egw_link::vfs_path($link['app2'], $link['id2']).'/'.$link['id'], |
|
595 | - 'name' => $link['id'], |
|
596 | - ), $link['remark']); |
|
619 | + $msg = lang('Error: Starttime has to be before the endtime !!!'); |
|
620 | + $button = ''; |
|
621 | + break; |
|
597 | 622 | } |
598 | - } |
|
599 | - unset($link); |
|
600 | - $preserv['view'] = $preserv['edit_single'] = false; |
|
601 | - $msg = lang('Event copied - the copy can now be edited'); |
|
602 | - $event['title'] = lang('Copy of:').' '.$event['title']; |
|
603 | - break; |
|
604 | - |
|
605 | - case 'mail': |
|
606 | - case 'sendrequest': |
|
607 | - case 'save': |
|
608 | - case 'print': |
|
609 | - case 'apply': |
|
610 | - case 'infolog': |
|
611 | - if ($event['id'] && !$this->bo->check_perms(EGW_ACL_EDIT,$event)) |
|
612 | - { |
|
613 | - $msg = lang('Permission denied'); |
|
614 | - $button = ''; |
|
615 | - break; |
|
616 | - } |
|
617 | - if ($event['start'] > $event['end']) |
|
618 | - { |
|
619 | - $msg = lang('Error: Starttime has to be before the endtime !!!'); |
|
620 | - $button = ''; |
|
621 | - break; |
|
622 | - } |
|
623 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate']) |
|
624 | - { |
|
625 | - $msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!'); |
|
626 | - $button = ''; |
|
627 | - break; |
|
628 | - } |
|
629 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval'])) |
|
630 | - { |
|
631 | - $msg = lang('Error: Duration of event longer then recurrence interval!'); |
|
632 | - $button = ''; |
|
633 | - break; |
|
634 | - } |
|
635 | - if (!$event['participants']) |
|
636 | - { |
|
637 | - $msg = lang('Error: no participants selected !!!'); |
|
638 | - $button = ''; |
|
639 | - break; |
|
640 | - } |
|
641 | - // if private event with ressource reservation is forbidden |
|
642 | - if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private']) |
|
643 | - { |
|
644 | - foreach (array_keys($event['participants']) as $uid) |
|
623 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $event['recur_enddate'] && $event['start'] > $event['recur_enddate']) |
|
624 | + { |
|
625 | + $msg = lang('repetition').': '.lang('Error: Starttime has to be before the endtime !!!'); |
|
626 | + $button = ''; |
|
627 | + break; |
|
628 | + } |
|
629 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $event['end']-$event['start'] > calendar_rrule::recurrence_interval($event['recur_type'], $event['recur_interval'])) |
|
630 | + { |
|
631 | + $msg = lang('Error: Duration of event longer then recurrence interval!'); |
|
632 | + $button = ''; |
|
633 | + break; |
|
634 | + } |
|
635 | + if (!$event['participants']) |
|
636 | + { |
|
637 | + $msg = lang('Error: no participants selected !!!'); |
|
638 | + $button = ''; |
|
639 | + break; |
|
640 | + } |
|
641 | + // if private event with ressource reservation is forbidden |
|
642 | + if (!$event['public'] && $GLOBALS['egw_info']['server']['no_ressources_private']) |
|
645 | 643 | { |
646 | - if ($uid[0] == 'r') //ressource detection |
|
644 | + foreach (array_keys($event['participants']) as $uid) |
|
647 | 645 | { |
648 | - $msg = lang('Error: ressources reservation in private events is not allowed!!!'); |
|
649 | - $button = ''; |
|
650 | - break 2; //break foreach and case |
|
646 | + if ($uid[0] == 'r') //ressource detection |
|
647 | + { |
|
648 | + $msg = lang('Error: ressources reservation in private events is not allowed!!!'); |
|
649 | + $button = ''; |
|
650 | + break 2; //break foreach and case |
|
651 | + } |
|
651 | 652 | } |
652 | 653 | } |
653 | - } |
|
654 | - if ($content['edit_single']) // we edited a single event from a series |
|
655 | - { |
|
656 | - $event['reference'] = $event['id']; |
|
657 | - $event['recurrence'] = $content['edit_single']; |
|
658 | - unset($event['id']); |
|
659 | - $conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']); |
|
660 | - if (!is_array($conflicts) && $conflicts) |
|
654 | + if ($content['edit_single']) // we edited a single event from a series |
|
661 | 655 | { |
662 | - // now we need to add the original start as recur-execption to the series |
|
663 | - $recur_event = $this->bo->read($event['reference']); |
|
664 | - $recur_event['recur_exception'][] = $content['edit_single']; |
|
665 | - // check if we need to move the alarms, because they are next on that exception |
|
666 | - foreach($recur_event['alarm'] as $id => $alarm) |
|
656 | + $event['reference'] = $event['id']; |
|
657 | + $event['recurrence'] = $content['edit_single']; |
|
658 | + unset($event['id']); |
|
659 | + $conflicts = $this->bo->update($event,$ignore_conflicts,true,false,true,$messages,$content['no_notifications']); |
|
660 | + if (!is_array($conflicts) && $conflicts) |
|
667 | 661 | { |
668 | - if ($alarm['time'] == $content['edit_single'] - $alarm['offset']) |
|
662 | + // now we need to add the original start as recur-execption to the series |
|
663 | + $recur_event = $this->bo->read($event['reference']); |
|
664 | + $recur_event['recur_exception'][] = $content['edit_single']; |
|
665 | + // check if we need to move the alarms, because they are next on that exception |
|
666 | + foreach($recur_event['alarm'] as $id => $alarm) |
|
669 | 667 | { |
670 | - $rrule = calendar_rrule::event2rrule($recur_event, true); |
|
671 | - foreach ($rrule as $time) |
|
668 | + if ($alarm['time'] == $content['edit_single'] - $alarm['offset']) |
|
672 | 669 | { |
673 | - if ($content['edit_single'] < $time->format('ts')) |
|
670 | + $rrule = calendar_rrule::event2rrule($recur_event, true); |
|
671 | + foreach ($rrule as $time) |
|
674 | 672 | { |
675 | - $alarm['time'] = $time->format('ts') - $alarm['offset']; |
|
676 | - $this->bo->save_alarm($event['reference'], $alarm); |
|
677 | - break; |
|
673 | + if ($content['edit_single'] < $time->format('ts')) |
|
674 | + { |
|
675 | + $alarm['time'] = $time->format('ts') - $alarm['offset']; |
|
676 | + $this->bo->save_alarm($event['reference'], $alarm); |
|
677 | + break; |
|
678 | + } |
|
678 | 679 | } |
679 | 680 | } |
680 | 681 | } |
682 | + unset($recur_event['start']); unset($recur_event['end']); // no update necessary |
|
683 | + unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start! |
|
684 | + $this->bo->update($recur_event,true); // no conflict check here |
|
685 | + unset($recur_event); |
|
686 | + unset($event['edit_single']); // if we further edit it, it's just a single event |
|
687 | + unset($preserv['edit_single']); |
|
688 | + } |
|
689 | + else // conflict or error, we need to reset everything to the state befor we tried to save it |
|
690 | + { |
|
691 | + $event['id'] = $event['reference']; |
|
692 | + $event['reference'] = $event['recurrence'] = 0; |
|
693 | + $event['uid'] = $content['uid']; |
|
681 | 694 | } |
682 | - unset($recur_event['start']); unset($recur_event['end']); // no update necessary |
|
683 | - unset($recur_event['alarm']); // unsetting alarms too, as they cant be updated without start! |
|
684 | - $this->bo->update($recur_event,true); // no conflict check here |
|
685 | - unset($recur_event); |
|
686 | - unset($event['edit_single']); // if we further edit it, it's just a single event |
|
687 | - unset($preserv['edit_single']); |
|
688 | 695 | } |
689 | - else // conflict or error, we need to reset everything to the state befor we tried to save it |
|
696 | + else // we edited a non-reccuring event or the whole series |
|
690 | 697 | { |
691 | - $event['id'] = $event['reference']; |
|
692 | - $event['reference'] = $event['recurrence'] = 0; |
|
693 | - $event['uid'] = $content['uid']; |
|
694 | - } |
|
695 | - } |
|
696 | - else // we edited a non-reccuring event or the whole series |
|
697 | - { |
|
698 | - if (($old_event = $this->bo->read($event['id']))) |
|
699 | - { |
|
700 | - if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
698 | + if (($old_event = $this->bo->read($event['id']))) |
|
701 | 699 | { |
702 | - // we edit a existing series event |
|
703 | - if ($event['start'] != $old_event['start'] || |
|
704 | - $event['whole_day'] != $old_event['whole_day']) |
|
700 | + if ($event['recur_type'] != MCAL_RECUR_NONE) |
|
705 | 701 | { |
706 | - if(!($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + 1, true))) |
|
702 | + // we edit a existing series event |
|
703 | + if ($event['start'] != $old_event['start'] || |
|
704 | + $event['whole_day'] != $old_event['whole_day']) |
|
707 | 705 | { |
708 | - $msg = lang("Error: You can't shift a series from the past!"); |
|
709 | - $noerror = false; |
|
710 | - break; |
|
711 | - } |
|
712 | - // splitting of series confirmed or first event clicked (no confirmation necessary) |
|
713 | - $orig_event = $event; |
|
706 | + if(!($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + 1, true))) |
|
707 | + { |
|
708 | + $msg = lang("Error: You can't shift a series from the past!"); |
|
709 | + $noerror = false; |
|
710 | + break; |
|
711 | + } |
|
712 | + // splitting of series confirmed or first event clicked (no confirmation necessary) |
|
713 | + $orig_event = $event; |
|
714 | 714 | |
715 | - // calculate offset against old series start or clicked recurrance, |
|
716 | - // depending on which is smaller |
|
717 | - $offset = $event['start'] - $old_event['start']; |
|
718 | - if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date'])) |
|
719 | - { |
|
720 | - $offset = $off2; |
|
721 | - } |
|
722 | - // base start-date of new series on actual / clicked date |
|
723 | - $actual_date = $event['actual_date']; |
|
724 | - $event['start'] = $actual_date + $offset; |
|
725 | - if ($content['duration']) |
|
726 | - { |
|
727 | - $event['end'] = $event['start'] + $content['duration']; |
|
728 | - } |
|
729 | - elseif($event['end'] < $event['start']) |
|
730 | - { |
|
731 | - $event['end'] = $event['start'] + $event['end'] - $actual_date; |
|
732 | - } |
|
733 | - //echo "<p>".__LINE__.": event[start]=$event[start]=".egw_time::to($event['start']).", duration=$content[duration], event[end]=$event[end]=".egw_time::to($event['end']).", offset=$offset</p>\n"; |
|
734 | - $event['participants'] = $old_event['participants']; |
|
735 | - foreach ($old_event['recur_exception'] as $key => $exdate) |
|
736 | - { |
|
737 | - if ($exdate > $actual_date) |
|
715 | + // calculate offset against old series start or clicked recurrance, |
|
716 | + // depending on which is smaller |
|
717 | + $offset = $event['start'] - $old_event['start']; |
|
718 | + if (abs($offset) > abs($off2 = $event['start'] - $event['actual_date'])) |
|
738 | 719 | { |
739 | - unset($old_event['recur_exception'][$key]); |
|
740 | - $event['recur_exception'][$key] += $offset; |
|
720 | + $offset = $off2; |
|
741 | 721 | } |
742 | - else |
|
722 | + // base start-date of new series on actual / clicked date |
|
723 | + $actual_date = $event['actual_date']; |
|
724 | + $event['start'] = $actual_date + $offset; |
|
725 | + if ($content['duration']) |
|
743 | 726 | { |
744 | - unset($event['recur_exception'][$key]); |
|
727 | + $event['end'] = $event['start'] + $content['duration']; |
|
745 | 728 | } |
746 | - } |
|
747 | - $old_alarms = $old_event['alarm']; |
|
748 | - if ($old_event['start'] < $actual_date) |
|
749 | - { |
|
750 | - unset($orig_event); |
|
751 | - // copy event by unsetting the id(s) |
|
752 | - unset($event['id']); |
|
753 | - unset($event['uid']); |
|
754 | - unset($event['caldav_name']); |
|
755 | - |
|
756 | - // set enddate of existing event |
|
757 | - $rriter = calendar_rrule::event2rrule($old_event, true); |
|
758 | - $rriter->rewind(); |
|
759 | - $last = $rriter->current(); |
|
760 | - do |
|
729 | + elseif($event['end'] < $event['start']) |
|
761 | 730 | { |
762 | - $rriter->next_no_exception(); |
|
763 | - $occurrence = $rriter->current(); |
|
731 | + $event['end'] = $event['start'] + $event['end'] - $actual_date; |
|
764 | 732 | } |
765 | - while ($rriter->valid() && |
|
766 | - egw_time::to($occurrence, 'ts') < $actual_date && |
|
767 | - ($last = $occurrence)); |
|
768 | - $last->setTime(0, 0, 0); |
|
769 | - $old_event['recur_enddate'] = egw_time::to($last, 'ts'); |
|
770 | - if (!$this->bo->update($old_event,true,true,false,true,$dummy=null,$content['no_notifications'])) |
|
733 | + //echo "<p>".__LINE__.": event[start]=$event[start]=".egw_time::to($event['start']).", duration=$content[duration], event[end]=$event[end]=".egw_time::to($event['end']).", offset=$offset</p>\n"; |
|
734 | + $event['participants'] = $old_event['participants']; |
|
735 | + foreach ($old_event['recur_exception'] as $key => $exdate) |
|
771 | 736 | { |
772 | - $msg .= ($msg ? ', ' : '') .lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
773 | - lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
774 | - htmlspecialchars(egw::link('/index.php',array( |
|
775 | - 'menuaction' => 'calendar.calendar_uiforms.edit', |
|
776 | - 'cal_id' => $content['id'], |
|
777 | - ))).'">','</a>'); |
|
778 | - $noerror = false; |
|
779 | - $event = $orig_event; |
|
780 | - break; |
|
737 | + if ($exdate > $actual_date) |
|
738 | + { |
|
739 | + unset($old_event['recur_exception'][$key]); |
|
740 | + $event['recur_exception'][$key] += $offset; |
|
741 | + } |
|
742 | + else |
|
743 | + { |
|
744 | + unset($event['recur_exception'][$key]); |
|
745 | + } |
|
746 | + } |
|
747 | + $old_alarms = $old_event['alarm']; |
|
748 | + if ($old_event['start'] < $actual_date) |
|
749 | + { |
|
750 | + unset($orig_event); |
|
751 | + // copy event by unsetting the id(s) |
|
752 | + unset($event['id']); |
|
753 | + unset($event['uid']); |
|
754 | + unset($event['caldav_name']); |
|
755 | + |
|
756 | + // set enddate of existing event |
|
757 | + $rriter = calendar_rrule::event2rrule($old_event, true); |
|
758 | + $rriter->rewind(); |
|
759 | + $last = $rriter->current(); |
|
760 | + do |
|
761 | + { |
|
762 | + $rriter->next_no_exception(); |
|
763 | + $occurrence = $rriter->current(); |
|
764 | + } |
|
765 | + while ($rriter->valid() && |
|
766 | + egw_time::to($occurrence, 'ts') < $actual_date && |
|
767 | + ($last = $occurrence)); |
|
768 | + $last->setTime(0, 0, 0); |
|
769 | + $old_event['recur_enddate'] = egw_time::to($last, 'ts'); |
|
770 | + if (!$this->bo->update($old_event,true,true,false,true,$dummy=null,$content['no_notifications'])) |
|
771 | + { |
|
772 | + $msg .= ($msg ? ', ' : '') .lang('Error: the entry has been updated since you opened it for editing!').'<br />'. |
|
773 | + lang('Copy your changes to the clipboard, %1reload the entry%2 and merge them.','<a href="'. |
|
774 | + htmlspecialchars(egw::link('/index.php',array( |
|
775 | + 'menuaction' => 'calendar.calendar_uiforms.edit', |
|
776 | + 'cal_id' => $content['id'], |
|
777 | + ))).'">','</a>'); |
|
778 | + $noerror = false; |
|
779 | + $event = $orig_event; |
|
780 | + break; |
|
781 | + } |
|
782 | + $event['alarm'] = array(); |
|
781 | 783 | } |
782 | - $event['alarm'] = array(); |
|
783 | 784 | } |
784 | 785 | } |
785 | - } |
|
786 | - else |
|
787 | - { |
|
788 | - if ($old_event['start'] != $event['start'] || |
|
789 | - $old_event['end'] != $event['end'] || |
|
790 | - $event['whole_day'] != $old_event['whole_day']) |
|
786 | + else |
|
791 | 787 | { |
792 | - $sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])); |
|
793 | - foreach((array)$event['participants'] as $uid => $status) |
|
788 | + if ($old_event['start'] != $event['start'] || |
|
789 | + $old_event['end'] != $event['end'] || |
|
790 | + $event['whole_day'] != $old_event['whole_day']) |
|
794 | 791 | { |
795 | - $q = $r = null; |
|
796 | - calendar_so::split_status($status,$q,$r); |
|
797 | - if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U') |
|
792 | + $sameday = (date('Ymd', $old_event['start']) == date('Ymd', $event['start'])); |
|
793 | + foreach((array)$event['participants'] as $uid => $status) |
|
798 | 794 | { |
799 | - $preferences = CreateObject('phpgwapi.preferences',$uid); |
|
800 | - $part_prefs = $preferences->read_repository(); |
|
801 | - switch ($part_prefs['calendar']['reset_stati']) |
|
795 | + $q = $r = null; |
|
796 | + calendar_so::split_status($status,$q,$r); |
|
797 | + if ($uid[0] != 'c' && $uid[0] != 'e' && $uid != $this->bo->user && $status != 'U') |
|
802 | 798 | { |
799 | + $preferences = CreateObject('phpgwapi.preferences',$uid); |
|
800 | + $part_prefs = $preferences->read_repository(); |
|
801 | + switch ($part_prefs['calendar']['reset_stati']) |
|
802 | + { |
|
803 | 803 | case 'no': |
804 | 804 | break; |
805 | 805 | case 'startday': |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | $status_reset_to_unknown = true; |
809 | 809 | $event['participants'][$uid] = calendar_so::combine_status('U',$q,$r); |
810 | 810 | // todo: report reset status to user |
811 | - } |
|
811 | + } |
|
812 | 812 | } |
813 | 813 | } |
814 | 814 | // check if we need to move the alarms, because they are relative |
@@ -925,83 +925,83 @@ discard block |
||
925 | 925 | } |
926 | 926 | break; |
927 | 927 | |
928 | - case 'cancel': |
|
929 | - if($content['cancel_needs_refresh']) |
|
930 | - { |
|
931 | - egw_framework::refresh_opener($msg, 'calendar'); |
|
932 | - } |
|
933 | - break; |
|
934 | - |
|
935 | - case 'delete': // delete of event (regular or series) |
|
936 | - $exceptions_kept = null; |
|
937 | - if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'], |
|
938 | - $content['delete_exceptions'] == 'true', $exceptions_kept)) |
|
939 | - { |
|
940 | - if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single']) |
|
928 | + case 'cancel': |
|
929 | + if($content['cancel_needs_refresh']) |
|
941 | 930 | { |
942 | - $msg = lang('Series deleted'); |
|
943 | - if ($exceptions_kept) $msg .= lang(', exceptions preserved'); |
|
931 | + egw_framework::refresh_opener($msg, 'calendar'); |
|
944 | 932 | } |
945 | - else |
|
933 | + break; |
|
934 | + |
|
935 | + case 'delete': // delete of event (regular or series) |
|
936 | + $exceptions_kept = null; |
|
937 | + if ($this->bo->delete($event['id'], (int)$content['edit_single'], false, $event['no_notifications'], |
|
938 | + $content['delete_exceptions'] == 'true', $exceptions_kept)) |
|
946 | 939 | { |
947 | - $msg = lang('Event deleted'); |
|
948 | - } |
|
940 | + if ($event['recur_type'] != MCAL_RECUR_NONE && $content['reference'] == 0 && !$content['edit_single']) |
|
941 | + { |
|
942 | + $msg = lang('Series deleted'); |
|
943 | + if ($exceptions_kept) $msg .= lang(', exceptions preserved'); |
|
944 | + } |
|
945 | + else |
|
946 | + { |
|
947 | + $msg = lang('Event deleted'); |
|
948 | + } |
|
949 | 949 | |
950 | - } |
|
951 | - break; |
|
950 | + } |
|
951 | + break; |
|
952 | 952 | |
953 | - case 'freetime': |
|
954 | - // the "click" has to be in onload, to make sure the button is already created |
|
955 | - $event['button_was'] = $button; |
|
956 | - break; |
|
953 | + case 'freetime': |
|
954 | + // the "click" has to be in onload, to make sure the button is already created |
|
955 | + $event['button_was'] = $button; |
|
956 | + break; |
|
957 | 957 | |
958 | - case 'add_alarm': |
|
959 | - $time = $content['start']; |
|
960 | - $offset = $time - $content['new_alarm']['date']; |
|
961 | - if ($event['recur_type'] != MCAL_RECUR_NONE && |
|
962 | - ($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) && |
|
963 | - $time < $next_occurrence['start']) |
|
964 | - { |
|
965 | - $content['new_alarm']['date'] = $next_occurrence['start'] - $offset; |
|
966 | - } |
|
967 | - if ($this->bo->check_perms(EGW_ACL_EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner'])) |
|
968 | - { |
|
969 | - $alarm = array( |
|
970 | - 'offset' => $offset, |
|
971 | - 'time' => $content['new_alarm']['date'], |
|
972 | - 'all' => !$content['new_alarm']['owner'], |
|
973 | - 'owner' => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user, |
|
974 | - ); |
|
975 | - if ($alarm['time'] < $this->bo->now_su) |
|
958 | + case 'add_alarm': |
|
959 | + $time = $content['start']; |
|
960 | + $offset = $time - $content['new_alarm']['date']; |
|
961 | + if ($event['recur_type'] != MCAL_RECUR_NONE && |
|
962 | + ($next_occurrence = $this->bo->read($event['id'], $this->bo->now_su + $offset, true)) && |
|
963 | + $time < $next_occurrence['start']) |
|
976 | 964 | { |
977 | - $msg = lang("Can't add alarms in the past !!!"); |
|
965 | + $content['new_alarm']['date'] = $next_occurrence['start'] - $offset; |
|
978 | 966 | } |
979 | - elseif ($event['id']) // save the alarm immediatly |
|
967 | + if ($this->bo->check_perms(EGW_ACL_EDIT,!$content['new_alarm']['owner'] ? $event : 0,$content['new_alarm']['owner'])) |
|
980 | 968 | { |
981 | - if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm))) |
|
969 | + $alarm = array( |
|
970 | + 'offset' => $offset, |
|
971 | + 'time' => $content['new_alarm']['date'], |
|
972 | + 'all' => !$content['new_alarm']['owner'], |
|
973 | + 'owner' => $content['new_alarm']['owner'] ? $content['new_alarm']['owner'] : $this->user, |
|
974 | + ); |
|
975 | + if ($alarm['time'] < $this->bo->now_su) |
|
976 | + { |
|
977 | + $msg = lang("Can't add alarms in the past !!!"); |
|
978 | + } |
|
979 | + elseif ($event['id']) // save the alarm immediatly |
|
982 | 980 | { |
983 | - $alarm['id'] = $alarm_id; |
|
984 | - $event['alarm'][$alarm_id] = $alarm; |
|
981 | + if (($alarm_id = $this->bo->save_alarm($event['id'],$alarm))) |
|
982 | + { |
|
983 | + $alarm['id'] = $alarm_id; |
|
984 | + $event['alarm'][$alarm_id] = $alarm; |
|
985 | 985 | |
986 | - $msg = lang('Alarm added'); |
|
987 | - egw_framework::refresh_opener($msg,'calendar', $event['id'], 'update'); |
|
986 | + $msg = lang('Alarm added'); |
|
987 | + egw_framework::refresh_opener($msg,'calendar', $event['id'], 'update'); |
|
988 | + } |
|
989 | + else |
|
990 | + { |
|
991 | + $msg = lang('Error adding the alarm'); |
|
992 | + } |
|
988 | 993 | } |
989 | 994 | else |
990 | 995 | { |
991 | - $msg = lang('Error adding the alarm'); |
|
996 | + for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {} // get a temporary non-conflicting, numeric id |
|
997 | + $event['alarm'][$alarm['id']] = $alarm; |
|
992 | 998 | } |
993 | 999 | } |
994 | 1000 | else |
995 | 1001 | { |
996 | - for($alarm['id']=1; isset($event['alarm'][$alarm['id']]); $alarm['id']++) {} // get a temporary non-conflicting, numeric id |
|
997 | - $event['alarm'][$alarm['id']] = $alarm; |
|
1002 | + $msg = lang('Permission denied'); |
|
998 | 1003 | } |
999 | - } |
|
1000 | - else |
|
1001 | - { |
|
1002 | - $msg = lang('Permission denied'); |
|
1003 | - } |
|
1004 | - break; |
|
1004 | + break; |
|
1005 | 1005 | } |
1006 | 1006 | // add notification-errors, if we have some |
1007 | 1007 | if (($notification_errors = notifications::errors(true))) |
@@ -129,41 +129,41 @@ discard block |
||
129 | 129 | } |
130 | 130 | foreach ($option as $k => $v) { |
131 | 131 | switch ($k) { |
132 | - case 'encoding': |
|
133 | - switch ($v) { |
|
134 | - case 'utf8': |
|
135 | - case 'ucs4_string': |
|
136 | - case 'ucs4_array': |
|
137 | - $this->_api_encoding = $v; |
|
138 | - break; |
|
139 | - default: |
|
140 | - $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
141 | - return false; |
|
142 | - } |
|
143 | - break; |
|
144 | - case 'overlong': |
|
145 | - $this->_allow_overlong = ($v) ? true : false; |
|
146 | - break; |
|
147 | - case 'strict': |
|
148 | - $this->_strict_mode = ($v) ? true : false; |
|
132 | + case 'encoding': |
|
133 | + switch ($v) { |
|
134 | + case 'utf8': |
|
135 | + case 'ucs4_string': |
|
136 | + case 'ucs4_array': |
|
137 | + $this->_api_encoding = $v; |
|
138 | + break; |
|
139 | + default: |
|
140 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
141 | + return false; |
|
142 | + } |
|
149 | 143 | break; |
150 | - case 'idn_version': |
|
151 | - if (in_array($v, array('2003', '2008'))) { |
|
152 | - $this->_idn_version = $v; |
|
153 | - } else { |
|
154 | - $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
155 | - } |
|
156 | - break; |
|
157 | - case 'encode_german_sz': // Deprecated |
|
158 | - if (!$v) { |
|
159 | - self::$NP['replacemaps'][0xDF] = array(0x73, 0x73); |
|
160 | - } else { |
|
161 | - unset(self::$NP['replacemaps'][0xDF]); |
|
162 | - } |
|
163 | - break; |
|
164 | - default: |
|
165 | - $this->_error('Set Parameter: Unknown option '.$k); |
|
166 | - return false; |
|
144 | + case 'overlong': |
|
145 | + $this->_allow_overlong = ($v) ? true : false; |
|
146 | + break; |
|
147 | + case 'strict': |
|
148 | + $this->_strict_mode = ($v) ? true : false; |
|
149 | + break; |
|
150 | + case 'idn_version': |
|
151 | + if (in_array($v, array('2003', '2008'))) { |
|
152 | + $this->_idn_version = $v; |
|
153 | + } else { |
|
154 | + $this->_error('Set Parameter: Unknown parameter '.$v.' for option '.$k); |
|
155 | + } |
|
156 | + break; |
|
157 | + case 'encode_german_sz': // Deprecated |
|
158 | + if (!$v) { |
|
159 | + self::$NP['replacemaps'][0xDF] = array(0x73, 0x73); |
|
160 | + } else { |
|
161 | + unset(self::$NP['replacemaps'][0xDF]); |
|
162 | + } |
|
163 | + break; |
|
164 | + default: |
|
165 | + $this->_error('Set Parameter: Unknown option '.$k); |
|
166 | + return false; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return true; |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | // Optionally set |
181 | 181 | if ($one_time_encoding) { |
182 | 182 | switch ($one_time_encoding) { |
183 | - case 'utf8': |
|
184 | - case 'ucs4_string': |
|
185 | - case 'ucs4_array': |
|
186 | - break; |
|
187 | - default: |
|
188 | - $this->_error('Unknown encoding '.$one_time_encoding); |
|
189 | - return false; |
|
183 | + case 'utf8': |
|
184 | + case 'ucs4_string': |
|
185 | + case 'ucs4_array': |
|
186 | + break; |
|
187 | + default: |
|
188 | + $this->_error('Unknown encoding '.$one_time_encoding); |
|
189 | + return false; |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | // Make sure to drop any newline characters around |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | // The output is UTF-8 by default, other output formats need conversion here |
256 | 256 | // If one time encoding is given, use this, else the objects property |
257 | 257 | switch (($one_time_encoding) ? $one_time_encoding : $this->_api_encoding) { |
258 | - case 'utf8': |
|
259 | - return $return; |
|
260 | - break; |
|
261 | - case 'ucs4_string': |
|
262 | - return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
|
263 | - break; |
|
264 | - case 'ucs4_array': |
|
265 | - return $this->_utf8_to_ucs4($return); |
|
266 | - break; |
|
267 | - default: |
|
268 | - $this->_error('Unsupported output format'); |
|
269 | - return false; |
|
258 | + case 'utf8': |
|
259 | + return $return; |
|
260 | + break; |
|
261 | + case 'ucs4_string': |
|
262 | + return $this->_ucs4_to_ucs4_string($this->_utf8_to_ucs4($return)); |
|
263 | + break; |
|
264 | + case 'ucs4_array': |
|
265 | + return $this->_utf8_to_ucs4($return); |
|
266 | + break; |
|
267 | + default: |
|
268 | + $this->_error('Unsupported output format'); |
|
269 | + return false; |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -281,16 +281,16 @@ discard block |
||
281 | 281 | // Forcing conversion of input to UCS4 array |
282 | 282 | // If one time encoding is given, use this, else the objects property |
283 | 283 | switch ($one_time_encoding ? $one_time_encoding : $this->_api_encoding) { |
284 | - case 'utf8': |
|
285 | - $decoded = $this->_utf8_to_ucs4($decoded); |
|
286 | - break; |
|
287 | - case 'ucs4_string': |
|
288 | - $decoded = $this->_ucs4_string_to_ucs4($decoded); |
|
289 | - case 'ucs4_array': |
|
290 | - break; |
|
291 | - default: |
|
292 | - $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); |
|
293 | - return false; |
|
284 | + case 'utf8': |
|
285 | + $decoded = $this->_utf8_to_ucs4($decoded); |
|
286 | + break; |
|
287 | + case 'ucs4_string': |
|
288 | + $decoded = $this->_ucs4_string_to_ucs4($decoded); |
|
289 | + case 'ucs4_array': |
|
290 | + break; |
|
291 | + default: |
|
292 | + $this->_error('Unsupported input format: '.($one_time_encoding ? $one_time_encoding : $this->_api_encoding)); |
|
293 | + return false; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | // No input, no output, what else did you expect? |
@@ -303,35 +303,35 @@ discard block |
||
303 | 303 | foreach ($decoded as $k => $v) { |
304 | 304 | // Make sure to use just the plain dot |
305 | 305 | switch($v) { |
306 | - case 0x3002: |
|
307 | - case 0xFF0E: |
|
308 | - case 0xFF61: |
|
309 | - $decoded[$k] = 0x2E; |
|
310 | - // Right, no break here, the above are converted to dots anyway |
|
311 | - // Stumbling across an anchoring character |
|
312 | - case 0x2E: |
|
313 | - case 0x2F: |
|
314 | - case 0x3A: |
|
315 | - case 0x3F: |
|
316 | - case 0x40: |
|
317 | - // Neither email addresses nor URLs allowed in strict mode |
|
318 | - if ($this->_strict_mode) { |
|
319 | - $this->_error('Neither email addresses nor URLs are allowed in strict mode.'); |
|
320 | - return false; |
|
321 | - } else { |
|
322 | - // Skip first char |
|
323 | - if ($k) { |
|
324 | - $encoded = ''; |
|
325 | - $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
326 | - if ($encoded) { |
|
327 | - $output .= $encoded; |
|
328 | - } else { |
|
329 | - $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
330 | - } |
|
331 | - $output .= chr($decoded[$k]); |
|
332 | - } |
|
333 | - $last_begin = $k + 1; |
|
334 | - } |
|
306 | + case 0x3002: |
|
307 | + case 0xFF0E: |
|
308 | + case 0xFF61: |
|
309 | + $decoded[$k] = 0x2E; |
|
310 | + // Right, no break here, the above are converted to dots anyway |
|
311 | + // Stumbling across an anchoring character |
|
312 | + case 0x2E: |
|
313 | + case 0x2F: |
|
314 | + case 0x3A: |
|
315 | + case 0x3F: |
|
316 | + case 0x40: |
|
317 | + // Neither email addresses nor URLs allowed in strict mode |
|
318 | + if ($this->_strict_mode) { |
|
319 | + $this->_error('Neither email addresses nor URLs are allowed in strict mode.'); |
|
320 | + return false; |
|
321 | + } else { |
|
322 | + // Skip first char |
|
323 | + if ($k) { |
|
324 | + $encoded = ''; |
|
325 | + $encoded = $this->_encode(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
326 | + if ($encoded) { |
|
327 | + $output .= $encoded; |
|
328 | + } else { |
|
329 | + $output .= $this->_ucs4_to_utf8(array_slice($decoded, $last_begin, (($k)-$last_begin))); |
|
330 | + } |
|
331 | + $output .= chr($decoded[$k]); |
|
332 | + } |
|
333 | + $last_begin = $k + 1; |
|
334 | + } |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 | // Catch the rest of the string |
@@ -65,92 +65,92 @@ discard block |
||
65 | 65 | while ($pos < $max) { |
66 | 66 | $ch = substr($args,$pos,1); |
67 | 67 | switch($ch) { |
68 | - case ' ': |
|
69 | - case "\t": |
|
70 | - case "\n": |
|
71 | - case "\r": |
|
72 | - if (!$quoted) { |
|
73 | - if ($intoken) { |
|
74 | - $intoken = false; |
|
75 | - $tokens[$stmtno][] = implode('',$tokarr); |
|
68 | + case ' ': |
|
69 | + case "\t": |
|
70 | + case "\n": |
|
71 | + case "\r": |
|
72 | + if (!$quoted) { |
|
73 | + if ($intoken) { |
|
74 | + $intoken = false; |
|
75 | + $tokens[$stmtno][] = implode('',$tokarr); |
|
76 | + } |
|
77 | + break; |
|
76 | 78 | } |
79 | + |
|
80 | + $tokarr[] = $ch; |
|
77 | 81 | break; |
78 | - } |
|
79 | 82 | |
80 | - $tokarr[] = $ch; |
|
81 | - break; |
|
83 | + case '`': |
|
84 | + if ($intoken) $tokarr[] = $ch; |
|
85 | + case '(': |
|
86 | + case ')': |
|
87 | + case '"': |
|
88 | + case "'": |
|
82 | 89 | |
83 | - case '`': |
|
84 | - if ($intoken) $tokarr[] = $ch; |
|
85 | - case '(': |
|
86 | - case ')': |
|
87 | - case '"': |
|
88 | - case "'": |
|
90 | + if ($intoken) { |
|
91 | + if (empty($endquote)) { |
|
92 | + $tokens[$stmtno][] = implode('',$tokarr); |
|
93 | + if ($ch == '(') $endquote = ')'; |
|
94 | + else $endquote = $ch; |
|
95 | + $quoted = true; |
|
96 | + $intoken = true; |
|
97 | + $tokarr = array(); |
|
98 | + } else if ($endquote == $ch) { |
|
99 | + $ch2 = substr($args,$pos+1,1); |
|
100 | + if ($ch2 == $endquote) { |
|
101 | + $pos += 1; |
|
102 | + $tokarr[] = $ch2; |
|
103 | + } else { |
|
104 | + $quoted = false; |
|
105 | + $intoken = false; |
|
106 | + $tokens[$stmtno][] = implode('',$tokarr); |
|
107 | + $endquote = ''; |
|
108 | + } |
|
109 | + } else |
|
110 | + $tokarr[] = $ch; |
|
111 | + |
|
112 | + }else { |
|
89 | 113 | |
90 | - if ($intoken) { |
|
91 | - if (empty($endquote)) { |
|
92 | - $tokens[$stmtno][] = implode('',$tokarr); |
|
93 | 114 | if ($ch == '(') $endquote = ')'; |
94 | 115 | else $endquote = $ch; |
95 | 116 | $quoted = true; |
96 | 117 | $intoken = true; |
97 | 118 | $tokarr = array(); |
98 | - } else if ($endquote == $ch) { |
|
99 | - $ch2 = substr($args,$pos+1,1); |
|
100 | - if ($ch2 == $endquote) { |
|
101 | - $pos += 1; |
|
102 | - $tokarr[] = $ch2; |
|
103 | - } else { |
|
104 | - $quoted = false; |
|
105 | - $intoken = false; |
|
106 | - $tokens[$stmtno][] = implode('',$tokarr); |
|
107 | - $endquote = ''; |
|
108 | - } |
|
109 | - } else |
|
110 | - $tokarr[] = $ch; |
|
119 | + if ($ch == '`') $tokarr[] = '`'; |
|
120 | + } |
|
121 | + break; |
|
111 | 122 | |
112 | - }else { |
|
123 | + default: |
|
113 | 124 | |
114 | - if ($ch == '(') $endquote = ')'; |
|
115 | - else $endquote = $ch; |
|
116 | - $quoted = true; |
|
117 | - $intoken = true; |
|
118 | - $tokarr = array(); |
|
119 | - if ($ch == '`') $tokarr[] = '`'; |
|
120 | - } |
|
121 | - break; |
|
125 | + if (!$intoken) { |
|
126 | + if ($ch == $endstmtchar) { |
|
127 | + $stmtno += 1; |
|
128 | + $tokens[$stmtno] = array(); |
|
129 | + break; |
|
130 | + } |
|
122 | 131 | |
123 | - default: |
|
132 | + $intoken = true; |
|
133 | + $quoted = false; |
|
134 | + $endquote = false; |
|
135 | + $tokarr = array(); |
|
124 | 136 | |
125 | - if (!$intoken) { |
|
126 | - if ($ch == $endstmtchar) { |
|
127 | - $stmtno += 1; |
|
128 | - $tokens[$stmtno] = array(); |
|
129 | - break; |
|
130 | 137 | } |
131 | 138 | |
132 | - $intoken = true; |
|
133 | - $quoted = false; |
|
134 | - $endquote = false; |
|
135 | - $tokarr = array(); |
|
136 | - |
|
137 | - } |
|
138 | - |
|
139 | - if ($quoted) $tokarr[] = $ch; |
|
140 | - else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch; |
|
141 | - else { |
|
142 | - if ($ch == $endstmtchar) { |
|
139 | + if ($quoted) $tokarr[] = $ch; |
|
140 | + else if (ctype_alnum($ch) || strpos($tokenchars,$ch) !== false) $tokarr[] = $ch; |
|
141 | + else { |
|
142 | + if ($ch == $endstmtchar) { |
|
143 | + $tokens[$stmtno][] = implode('',$tokarr); |
|
144 | + $stmtno += 1; |
|
145 | + $tokens[$stmtno] = array(); |
|
146 | + $intoken = false; |
|
147 | + $tokarr = array(); |
|
148 | + break; |
|
149 | + } |
|
143 | 150 | $tokens[$stmtno][] = implode('',$tokarr); |
144 | - $stmtno += 1; |
|
145 | - $tokens[$stmtno] = array(); |
|
151 | + $tokens[$stmtno][] = $ch; |
|
146 | 152 | $intoken = false; |
147 | - $tokarr = array(); |
|
148 | - break; |
|
149 | 153 | } |
150 | - $tokens[$stmtno][] = implode('',$tokarr); |
|
151 | - $tokens[$stmtno][] = $ch; |
|
152 | - $intoken = false; |
|
153 | - } |
|
154 | 154 | } |
155 | 155 | $pos += 1; |
156 | 156 | } |
@@ -469,15 +469,15 @@ discard block |
||
469 | 469 | $f1 = array(); |
470 | 470 | foreach($f0 as $token) { |
471 | 471 | switch (strtoupper($token)) { |
472 | - case 'CONSTRAINT': |
|
473 | - case 'DEFAULT': |
|
474 | - $hasparam = $token; |
|
475 | - break; |
|
476 | - default: |
|
477 | - if ($hasparam) $f1[$hasparam] = $token; |
|
478 | - else $f1[] = $token; |
|
479 | - $hasparam = false; |
|
480 | - break; |
|
472 | + case 'CONSTRAINT': |
|
473 | + case 'DEFAULT': |
|
474 | + $hasparam = $token; |
|
475 | + break; |
|
476 | + default: |
|
477 | + if ($hasparam) $f1[$hasparam] = $token; |
|
478 | + else $f1[] = $token; |
|
479 | + $hasparam = false; |
|
480 | + break; |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | $flds[] = $f1; |
@@ -511,31 +511,31 @@ discard block |
||
511 | 511 | else if (is_numeric($attr) && $attr > 1 && !is_numeric($v)) $attr = strtoupper($v); |
512 | 512 | |
513 | 513 | switch($attr) { |
514 | - case '0': |
|
515 | - case 'NAME': $fname = $v; break; |
|
516 | - case '1': |
|
517 | - case 'TYPE': $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break; |
|
518 | - |
|
519 | - case 'SIZE': |
|
520 | - $dotat = strpos($v,'.'); if ($dotat === false) $dotat = strpos($v,','); |
|
521 | - if ($dotat === false) $fsize = $v; |
|
522 | - else { |
|
523 | - $fsize = substr($v,0,$dotat); |
|
524 | - $fprec = substr($v,$dotat+1); |
|
525 | - } |
|
526 | - break; |
|
527 | - case 'UNSIGNED': $funsigned = true; break; |
|
528 | - case 'AUTOINCREMENT': |
|
529 | - case 'AUTO': $fautoinc = true; $fnotnull = true; break; |
|
530 | - case 'KEY': |
|
531 | - case 'PRIMARY': $fprimary = $v; $fnotnull = true; break; |
|
532 | - case 'DEF': |
|
533 | - case 'DEFAULT': $fdefault = $v; break; |
|
534 | - case 'NOTNULL': $fnotnull = $v; break; |
|
535 | - case 'NOQUOTE': $fnoquote = $v; break; |
|
536 | - case 'DEFDATE': $fdefdate = $v; break; |
|
537 | - case 'DEFTIMESTAMP': $fdefts = $v; break; |
|
538 | - case 'CONSTRAINT': $fconstraint = $v; break; |
|
514 | + case '0': |
|
515 | + case 'NAME': $fname = $v; break; |
|
516 | + case '1': |
|
517 | + case 'TYPE': $ty = $v; $ftype = $this->ActualType(strtoupper($v)); break; |
|
518 | + |
|
519 | + case 'SIZE': |
|
520 | + $dotat = strpos($v,'.'); if ($dotat === false) $dotat = strpos($v,','); |
|
521 | + if ($dotat === false) $fsize = $v; |
|
522 | + else { |
|
523 | + $fsize = substr($v,0,$dotat); |
|
524 | + $fprec = substr($v,$dotat+1); |
|
525 | + } |
|
526 | + break; |
|
527 | + case 'UNSIGNED': $funsigned = true; break; |
|
528 | + case 'AUTOINCREMENT': |
|
529 | + case 'AUTO': $fautoinc = true; $fnotnull = true; break; |
|
530 | + case 'KEY': |
|
531 | + case 'PRIMARY': $fprimary = $v; $fnotnull = true; break; |
|
532 | + case 'DEF': |
|
533 | + case 'DEFAULT': $fdefault = $v; break; |
|
534 | + case 'NOTNULL': $fnotnull = $v; break; |
|
535 | + case 'NOQUOTE': $fnoquote = $v; break; |
|
536 | + case 'DEFDATE': $fdefdate = $v; break; |
|
537 | + case 'DEFTIMESTAMP': $fdefts = $v; break; |
|
538 | + case 'CONSTRAINT': $fconstraint = $v; break; |
|
539 | 539 | } //switch |
540 | 540 | } // foreach $fld |
541 | 541 |
@@ -344,67 +344,67 @@ discard block |
||
344 | 344 | for ($i=0; $i < $len; $i++) { |
345 | 345 | $ch = $fmt[$i]; |
346 | 346 | switch($ch) { |
347 | - case 'Y': |
|
348 | - case 'y': |
|
349 | - $s .= '%Y'; |
|
350 | - break; |
|
351 | - case 'Q': |
|
352 | - case 'q': |
|
353 | - $s .= "'),Quarter($col)"; |
|
354 | - |
|
355 | - if ($len > $i+1) $s .= ",DATE_FORMAT($col,'"; |
|
356 | - else $s .= ",('"; |
|
357 | - $concat = true; |
|
358 | - break; |
|
359 | - case 'M': |
|
360 | - $s .= '%b'; |
|
361 | - break; |
|
362 | - |
|
363 | - case 'm': |
|
364 | - $s .= '%m'; |
|
365 | - break; |
|
366 | - case 'D': |
|
367 | - case 'd': |
|
368 | - $s .= '%d'; |
|
369 | - break; |
|
370 | - |
|
371 | - case 'H': |
|
372 | - $s .= '%H'; |
|
373 | - break; |
|
374 | - |
|
375 | - case 'h': |
|
376 | - $s .= '%I'; |
|
377 | - break; |
|
378 | - |
|
379 | - case 'i': |
|
380 | - $s .= '%i'; |
|
381 | - break; |
|
382 | - |
|
383 | - case 's': |
|
384 | - $s .= '%s'; |
|
385 | - break; |
|
386 | - |
|
387 | - case 'a': |
|
388 | - case 'A': |
|
389 | - $s .= '%p'; |
|
390 | - break; |
|
391 | - |
|
392 | - case 'w': |
|
393 | - $s .= '%w'; |
|
394 | - break; |
|
395 | - |
|
396 | - case 'l': |
|
397 | - $s .= '%W'; |
|
398 | - break; |
|
399 | - |
|
400 | - default: |
|
401 | - |
|
402 | - if ($ch == '\\') { |
|
403 | - $i++; |
|
404 | - $ch = substr($fmt,$i,1); |
|
405 | - } |
|
406 | - $s .= $ch; |
|
407 | - break; |
|
347 | + case 'Y': |
|
348 | + case 'y': |
|
349 | + $s .= '%Y'; |
|
350 | + break; |
|
351 | + case 'Q': |
|
352 | + case 'q': |
|
353 | + $s .= "'),Quarter($col)"; |
|
354 | + |
|
355 | + if ($len > $i+1) $s .= ",DATE_FORMAT($col,'"; |
|
356 | + else $s .= ",('"; |
|
357 | + $concat = true; |
|
358 | + break; |
|
359 | + case 'M': |
|
360 | + $s .= '%b'; |
|
361 | + break; |
|
362 | + |
|
363 | + case 'm': |
|
364 | + $s .= '%m'; |
|
365 | + break; |
|
366 | + case 'D': |
|
367 | + case 'd': |
|
368 | + $s .= '%d'; |
|
369 | + break; |
|
370 | + |
|
371 | + case 'H': |
|
372 | + $s .= '%H'; |
|
373 | + break; |
|
374 | + |
|
375 | + case 'h': |
|
376 | + $s .= '%I'; |
|
377 | + break; |
|
378 | + |
|
379 | + case 'i': |
|
380 | + $s .= '%i'; |
|
381 | + break; |
|
382 | + |
|
383 | + case 's': |
|
384 | + $s .= '%s'; |
|
385 | + break; |
|
386 | + |
|
387 | + case 'a': |
|
388 | + case 'A': |
|
389 | + $s .= '%p'; |
|
390 | + break; |
|
391 | + |
|
392 | + case 'w': |
|
393 | + $s .= '%w'; |
|
394 | + break; |
|
395 | + |
|
396 | + case 'l': |
|
397 | + $s .= '%W'; |
|
398 | + break; |
|
399 | + |
|
400 | + default: |
|
401 | + |
|
402 | + if ($ch == '\\') { |
|
403 | + $i++; |
|
404 | + $ch = substr($fmt,$i,1); |
|
405 | + } |
|
406 | + $s .= $ch; |
|
407 | + break; |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | $s.="')"; |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | |
886 | 886 | $len = -1; // mysql max_length is not accurate |
887 | 887 | switch (strtoupper($t)) { |
888 | - case 'STRING': |
|
889 | - case 'CHAR': |
|
890 | - case 'VARCHAR': |
|
891 | - case 'TINYBLOB': |
|
892 | - case 'TINYTEXT': |
|
893 | - case 'ENUM': |
|
894 | - case 'SET': |
|
888 | + case 'STRING': |
|
889 | + case 'CHAR': |
|
890 | + case 'VARCHAR': |
|
891 | + case 'TINYBLOB': |
|
892 | + case 'TINYTEXT': |
|
893 | + case 'ENUM': |
|
894 | + case 'SET': |
|
895 | 895 | |
896 | 896 | case MYSQLI_TYPE_TINY_BLOB : |
897 | 897 | case MYSQLI_TYPE_CHAR : |
@@ -957,15 +957,15 @@ discard block |
||
957 | 957 | |
958 | 958 | // Added floating-point types |
959 | 959 | // Maybe not necessery. |
960 | - case 'FLOAT': |
|
961 | - case 'DOUBLE': |
|
962 | - // case 'DOUBLE PRECISION': |
|
963 | - case 'DECIMAL': |
|
964 | - case 'DEC': |
|
965 | - case 'FIXED': |
|
966 | - default: |
|
967 | - //if (!is_numeric($t)) echo "<p>--- Error in type matching $t -----</p>"; |
|
968 | - return 'N'; |
|
960 | + case 'FLOAT': |
|
961 | + case 'DOUBLE': |
|
962 | + // case 'DOUBLE PRECISION': |
|
963 | + case 'DECIMAL': |
|
964 | + case 'DEC': |
|
965 | + case 'FIXED': |
|
966 | + default: |
|
967 | + //if (!is_numeric($t)) echo "<p>--- Error in type matching $t -----</p>"; |
|
968 | + return 'N'; |
|
969 | 969 | } |
970 | 970 | } // function |
971 | 971 |
@@ -287,64 +287,64 @@ discard block |
||
287 | 287 | for ($i=0; $i < $len; $i++) { |
288 | 288 | $ch = $fmt[$i]; |
289 | 289 | switch($ch) { |
290 | - case 'Y': |
|
291 | - case 'y': |
|
292 | - $s .= 'YYYY'; |
|
293 | - break; |
|
294 | - case 'Q': |
|
295 | - case 'q': |
|
296 | - $s .= 'Q'; |
|
297 | - break; |
|
298 | - |
|
299 | - case 'M': |
|
300 | - $s .= 'Mon'; |
|
301 | - break; |
|
302 | - |
|
303 | - case 'm': |
|
304 | - $s .= 'MM'; |
|
305 | - break; |
|
306 | - case 'D': |
|
307 | - case 'd': |
|
308 | - $s .= 'DD'; |
|
309 | - break; |
|
310 | - |
|
311 | - case 'H': |
|
312 | - $s.= 'HH24'; |
|
313 | - break; |
|
314 | - |
|
315 | - case 'h': |
|
316 | - $s .= 'HH'; |
|
317 | - break; |
|
318 | - |
|
319 | - case 'i': |
|
320 | - $s .= 'MI'; |
|
321 | - break; |
|
322 | - |
|
323 | - case 's': |
|
324 | - $s .= 'SS'; |
|
325 | - break; |
|
326 | - |
|
327 | - case 'a': |
|
328 | - case 'A': |
|
329 | - $s .= 'AM'; |
|
330 | - break; |
|
331 | - |
|
332 | - case 'w': |
|
333 | - $s .= 'D'; |
|
334 | - break; |
|
335 | - |
|
336 | - case 'l': |
|
337 | - $s .= 'DAY'; |
|
338 | - break; |
|
339 | - |
|
340 | - default: |
|
341 | - // handle escape characters... |
|
342 | - if ($ch == '\\') { |
|
343 | - $i++; |
|
344 | - $ch = substr($fmt,$i,1); |
|
345 | - } |
|
346 | - if (strpos('-/.:;, ',$ch) !== false) $s .= $ch; |
|
347 | - else $s .= '"'.$ch.'"'; |
|
290 | + case 'Y': |
|
291 | + case 'y': |
|
292 | + $s .= 'YYYY'; |
|
293 | + break; |
|
294 | + case 'Q': |
|
295 | + case 'q': |
|
296 | + $s .= 'Q'; |
|
297 | + break; |
|
298 | + |
|
299 | + case 'M': |
|
300 | + $s .= 'Mon'; |
|
301 | + break; |
|
302 | + |
|
303 | + case 'm': |
|
304 | + $s .= 'MM'; |
|
305 | + break; |
|
306 | + case 'D': |
|
307 | + case 'd': |
|
308 | + $s .= 'DD'; |
|
309 | + break; |
|
310 | + |
|
311 | + case 'H': |
|
312 | + $s.= 'HH24'; |
|
313 | + break; |
|
314 | + |
|
315 | + case 'h': |
|
316 | + $s .= 'HH'; |
|
317 | + break; |
|
318 | + |
|
319 | + case 'i': |
|
320 | + $s .= 'MI'; |
|
321 | + break; |
|
322 | + |
|
323 | + case 's': |
|
324 | + $s .= 'SS'; |
|
325 | + break; |
|
326 | + |
|
327 | + case 'a': |
|
328 | + case 'A': |
|
329 | + $s .= 'AM'; |
|
330 | + break; |
|
331 | + |
|
332 | + case 'w': |
|
333 | + $s .= 'D'; |
|
334 | + break; |
|
335 | + |
|
336 | + case 'l': |
|
337 | + $s .= 'DAY'; |
|
338 | + break; |
|
339 | + |
|
340 | + default: |
|
341 | + // handle escape characters... |
|
342 | + if ($ch == '\\') { |
|
343 | + $i++; |
|
344 | + $ch = substr($fmt,$i,1); |
|
345 | + } |
|
346 | + if (strpos('-/.:;, ',$ch) !== false) $s .= $ch; |
|
347 | + else $s .= '"'.$ch.'"'; |
|
348 | 348 | |
349 | 349 | } |
350 | 350 | } |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | } |
860 | 860 | switch ($mode) |
861 | 861 | { |
862 | - case ADODB_FETCH_NUM: $this->fetchMode = PGSQL_NUM; break; |
|
863 | - case ADODB_FETCH_ASSOC:$this->fetchMode = PGSQL_ASSOC; break; |
|
862 | + case ADODB_FETCH_NUM: $this->fetchMode = PGSQL_NUM; break; |
|
863 | + case ADODB_FETCH_ASSOC:$this->fetchMode = PGSQL_ASSOC; break; |
|
864 | 864 | |
865 | - case ADODB_FETCH_DEFAULT: |
|
866 | - case ADODB_FETCH_BOTH: |
|
867 | - default: $this->fetchMode = PGSQL_BOTH; break; |
|
865 | + case ADODB_FETCH_DEFAULT: |
|
866 | + case ADODB_FETCH_BOTH: |
|
867 | + default: $this->fetchMode = PGSQL_BOTH; break; |
|
868 | 868 | } |
869 | 869 | $this->adodbFetchMode = $mode; |
870 | 870 | $this->ADORecordSet($queryID); |
@@ -333,40 +333,40 @@ discard block |
||
333 | 333 | function ODBCTypes($t) |
334 | 334 | { |
335 | 335 | switch ((integer)$t) { |
336 | - case 1: |
|
337 | - case 12: |
|
338 | - case 0: |
|
339 | - case -95: |
|
340 | - case -96: |
|
341 | - return 'C'; |
|
342 | - case -97: |
|
343 | - case -1: //text |
|
344 | - return 'X'; |
|
345 | - case -4: //image |
|
346 | - return 'B'; |
|
336 | + case 1: |
|
337 | + case 12: |
|
338 | + case 0: |
|
339 | + case -95: |
|
340 | + case -96: |
|
341 | + return 'C'; |
|
342 | + case -97: |
|
343 | + case -1: //text |
|
344 | + return 'X'; |
|
345 | + case -4: //image |
|
346 | + return 'B'; |
|
347 | 347 | |
348 | - case 9: |
|
349 | - case 91: |
|
350 | - return 'D'; |
|
351 | - |
|
352 | - case 10: |
|
353 | - case 11: |
|
354 | - case 92: |
|
355 | - case 93: |
|
356 | - return 'T'; |
|
348 | + case 9: |
|
349 | + case 91: |
|
350 | + return 'D'; |
|
351 | + |
|
352 | + case 10: |
|
353 | + case 11: |
|
354 | + case 92: |
|
355 | + case 93: |
|
356 | + return 'T'; |
|
357 | 357 | |
358 | - case 4: |
|
359 | - case 5: |
|
360 | - case -6: |
|
361 | - return 'I'; |
|
358 | + case 4: |
|
359 | + case 5: |
|
360 | + case -6: |
|
361 | + return 'I'; |
|
362 | 362 | |
363 | - case -11: // uniqidentifier |
|
364 | - return 'R'; |
|
365 | - case -7: //bit |
|
366 | - return 'L'; |
|
363 | + case -11: // uniqidentifier |
|
364 | + return 'R'; |
|
365 | + case -7: //bit |
|
366 | + return 'L'; |
|
367 | 367 | |
368 | - default: |
|
369 | - return 'N'; |
|
368 | + default: |
|
369 | + return 'N'; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | |
@@ -404,21 +404,21 @@ discard block |
||
404 | 404 | } */ |
405 | 405 | |
406 | 406 | switch ($this->databaseType) { |
407 | - case 'access': |
|
408 | - case 'vfp': |
|
409 | - $qid = odbc_columns($this->_connectionID);#,'%','',strtoupper($table),'%'); |
|
410 | - break; |
|
407 | + case 'access': |
|
408 | + case 'vfp': |
|
409 | + $qid = odbc_columns($this->_connectionID);#,'%','',strtoupper($table),'%'); |
|
410 | + break; |
|
411 | 411 | |
412 | 412 | |
413 | - case 'db2': |
|
414 | - $colname = "%"; |
|
415 | - $qid = odbc_columns($this->_connectionID, "", $schema, $table, $colname); |
|
416 | - break; |
|
413 | + case 'db2': |
|
414 | + $colname = "%"; |
|
415 | + $qid = odbc_columns($this->_connectionID, "", $schema, $table, $colname); |
|
416 | + break; |
|
417 | 417 | |
418 | - default: |
|
419 | - $qid = @odbc_columns($this->_connectionID,'%','%',strtoupper($table),'%'); |
|
420 | - if (empty($qid)) $qid = odbc_columns($this->_connectionID); |
|
421 | - break; |
|
418 | + default: |
|
419 | + $qid = @odbc_columns($this->_connectionID,'%','%',strtoupper($table),'%'); |
|
420 | + if (empty($qid)) $qid = odbc_columns($this->_connectionID); |
|
421 | + break; |
|
422 | 422 | } |
423 | 423 | if (empty($qid)) return $false; |
424 | 424 |
@@ -489,43 +489,43 @@ discard block |
||
489 | 489 | if (!is_numeric($t)) return $t; |
490 | 490 | |
491 | 491 | switch ($t) { |
492 | - case 0: |
|
493 | - case 12: // variant |
|
494 | - case 8: // bstr |
|
495 | - case 129: //char |
|
496 | - case 130: //wc |
|
497 | - case 200: // varc |
|
498 | - case 202:// varWC |
|
499 | - case 128: // bin |
|
500 | - case 204: // varBin |
|
501 | - case 72: // guid |
|
502 | - if ($len <= $this->blobSize) return 'C'; |
|
503 | - |
|
504 | - case 201: |
|
505 | - case 203: |
|
506 | - return 'X'; |
|
507 | - case 128: |
|
508 | - case 204: |
|
509 | - case 205: |
|
510 | - return 'B'; |
|
511 | - case 7: |
|
512 | - case 133: return 'D'; |
|
513 | - |
|
514 | - case 134: |
|
515 | - case 135: return 'T'; |
|
516 | - |
|
517 | - case 11: return 'L'; |
|
518 | - |
|
519 | - case 16:// adTinyInt = 16, |
|
520 | - case 2://adSmallInt = 2, |
|
521 | - case 3://adInteger = 3, |
|
522 | - case 4://adBigInt = 20, |
|
523 | - case 17://adUnsignedTinyInt = 17, |
|
524 | - case 18://adUnsignedSmallInt = 18, |
|
525 | - case 19://adUnsignedInt = 19, |
|
526 | - case 20://adUnsignedBigInt = 21, |
|
527 | - return 'I'; |
|
528 | - default: return 'N'; |
|
492 | + case 0: |
|
493 | + case 12: // variant |
|
494 | + case 8: // bstr |
|
495 | + case 129: //char |
|
496 | + case 130: //wc |
|
497 | + case 200: // varc |
|
498 | + case 202:// varWC |
|
499 | + case 128: // bin |
|
500 | + case 204: // varBin |
|
501 | + case 72: // guid |
|
502 | + if ($len <= $this->blobSize) return 'C'; |
|
503 | + |
|
504 | + case 201: |
|
505 | + case 203: |
|
506 | + return 'X'; |
|
507 | + case 128: |
|
508 | + case 204: |
|
509 | + case 205: |
|
510 | + return 'B'; |
|
511 | + case 7: |
|
512 | + case 133: return 'D'; |
|
513 | + |
|
514 | + case 134: |
|
515 | + case 135: return 'T'; |
|
516 | + |
|
517 | + case 11: return 'L'; |
|
518 | + |
|
519 | + case 16:// adTinyInt = 16, |
|
520 | + case 2://adSmallInt = 2, |
|
521 | + case 3://adInteger = 3, |
|
522 | + case 4://adBigInt = 20, |
|
523 | + case 17://adUnsignedTinyInt = 17, |
|
524 | + case 18://adUnsignedSmallInt = 18, |
|
525 | + case 19://adUnsignedInt = 19, |
|
526 | + case 20://adUnsignedBigInt = 21, |
|
527 | + return 'I'; |
|
528 | + default: return 'N'; |
|
529 | 529 | } |
530 | 530 | } |
531 | 531 | |
@@ -558,40 +558,40 @@ discard block |
||
558 | 558 | for ($i=0,$max = $this->_numOfFields; $i < $max; $i++) { |
559 | 559 | //echo "<p>",$t,' ';var_dump($f->value); echo '</p>'; |
560 | 560 | switch($t) { |
561 | - case 135: // timestamp |
|
562 | - if (!strlen((string)$f->value)) $this->fields[] = false; |
|
563 | - else { |
|
564 | - if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value); |
|
565 | - else $val = $f->value; |
|
566 | - $this->fields[] = adodb_date('Y-m-d H:i:s',$val); |
|
567 | - } |
|
568 | - break; |
|
569 | - case 133:// A date value (yyyymmdd) |
|
570 | - if ($val = $f->value) { |
|
571 | - $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2); |
|
572 | - } else |
|
573 | - $this->fields[] = false; |
|
574 | - break; |
|
575 | - case 7: // adDate |
|
576 | - if (!strlen((string)$f->value)) $this->fields[] = false; |
|
577 | - else { |
|
578 | - if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value); |
|
579 | - else $val = $f->value; |
|
561 | + case 135: // timestamp |
|
562 | + if (!strlen((string)$f->value)) $this->fields[] = false; |
|
563 | + else { |
|
564 | + if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value); |
|
565 | + else $val = $f->value; |
|
566 | + $this->fields[] = adodb_date('Y-m-d H:i:s',$val); |
|
567 | + } |
|
568 | + break; |
|
569 | + case 133:// A date value (yyyymmdd) |
|
570 | + if ($val = $f->value) { |
|
571 | + $this->fields[] = substr($val,0,4).'-'.substr($val,4,2).'-'.substr($val,6,2); |
|
572 | + } else |
|
573 | + $this->fields[] = false; |
|
574 | + break; |
|
575 | + case 7: // adDate |
|
576 | + if (!strlen((string)$f->value)) $this->fields[] = false; |
|
577 | + else { |
|
578 | + if (!is_numeric($f->value)) $val = variant_date_to_timestamp($f->value); |
|
579 | + else $val = $f->value; |
|
580 | 580 | |
581 | - if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val); |
|
582 | - else $this->fields[] = adodb_date('Y-m-d H:i:s',$val); |
|
583 | - } |
|
584 | - break; |
|
585 | - case 1: // null |
|
586 | - $this->fields[] = false; |
|
587 | - break; |
|
588 | - case 6: // currency is not supported properly; |
|
589 | - ADOConnection::outp( '<b>'.$f->Name.': currency type not supported by PHP</b>'); |
|
590 | - $this->fields[] = (float) $f->value; |
|
591 | - break; |
|
592 | - default: |
|
593 | - $this->fields[] = $f->value; |
|
594 | - break; |
|
581 | + if (($val % 86400) == 0) $this->fields[] = adodb_date('Y-m-d',$val); |
|
582 | + else $this->fields[] = adodb_date('Y-m-d H:i:s',$val); |
|
583 | + } |
|
584 | + break; |
|
585 | + case 1: // null |
|
586 | + $this->fields[] = false; |
|
587 | + break; |
|
588 | + case 6: // currency is not supported properly; |
|
589 | + ADOConnection::outp( '<b>'.$f->Name.': currency type not supported by PHP</b>'); |
|
590 | + $this->fields[] = (float) $f->value; |
|
591 | + break; |
|
592 | + default: |
|
593 | + $this->fields[] = $f->value; |
|
594 | + break; |
|
595 | 595 | } |
596 | 596 | //print " $f->value $t, "; |
597 | 597 | $f = next($this->_flds); |
@@ -38,11 +38,11 @@ |
||
38 | 38 | { |
39 | 39 | $arr['dialect'] = $this->dialect; |
40 | 40 | switch($arr['dialect']) { |
41 | - case '': |
|
42 | - case '1': $s = 'Interbase 6.5, Dialect 1'; break; |
|
43 | - case '2': $s = 'Interbase 6.5, Dialect 2'; break; |
|
44 | - default: |
|
45 | - case '3': $s = 'Interbase 6.5, Dialect 3'; break; |
|
41 | + case '': |
|
42 | + case '1': $s = 'Interbase 6.5, Dialect 1'; break; |
|
43 | + case '2': $s = 'Interbase 6.5, Dialect 2'; break; |
|
44 | + default: |
|
45 | + case '3': $s = 'Interbase 6.5, Dialect 3'; break; |
|
46 | 46 | } |
47 | 47 | $arr['version'] = '6.5'; |
48 | 48 | $arr['description'] = $s; |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | $mode = $ADODB_FETCH_MODE; |
170 | 170 | } |
171 | 171 | switch ($mode) { |
172 | - case ADODB_FETCH_NUM: $this->fetchMode = FBSQL_NUM; break; |
|
173 | - case ADODB_FETCH_ASSOC: $this->fetchMode = FBSQL_ASSOC; break; |
|
174 | - case ADODB_FETCH_BOTH: |
|
175 | - default: |
|
176 | - $this->fetchMode = FBSQL_BOTH; break; |
|
172 | + case ADODB_FETCH_NUM: $this->fetchMode = FBSQL_NUM; break; |
|
173 | + case ADODB_FETCH_ASSOC: $this->fetchMode = FBSQL_ASSOC; break; |
|
174 | + case ADODB_FETCH_BOTH: |
|
175 | + default: |
|
176 | + $this->fetchMode = FBSQL_BOTH; break; |
|
177 | 177 | } |
178 | 178 | return $this->ADORecordSet($queryID); |
179 | 179 | } |
@@ -226,38 +226,38 @@ discard block |
||
226 | 226 | } |
227 | 227 | $len = -1; // fbsql max_length is not accurate |
228 | 228 | switch (strtoupper($t)) { |
229 | - case 'CHARACTER': |
|
230 | - case 'CHARACTER VARYING': |
|
231 | - case 'BLOB': |
|
232 | - case 'CLOB': |
|
233 | - case 'BIT': |
|
234 | - case 'BIT VARYING': |
|
235 | - if ($len <= $this->blobSize) return 'C'; |
|
229 | + case 'CHARACTER': |
|
230 | + case 'CHARACTER VARYING': |
|
231 | + case 'BLOB': |
|
232 | + case 'CLOB': |
|
233 | + case 'BIT': |
|
234 | + case 'BIT VARYING': |
|
235 | + if ($len <= $this->blobSize) return 'C'; |
|
236 | 236 | |
237 | - // so we have to check whether binary... |
|
238 | - case 'IMAGE': |
|
239 | - case 'LONGBLOB': |
|
240 | - case 'BLOB': |
|
241 | - case 'MEDIUMBLOB': |
|
242 | - return !empty($fieldobj->binary) ? 'B' : 'X'; |
|
237 | + // so we have to check whether binary... |
|
238 | + case 'IMAGE': |
|
239 | + case 'LONGBLOB': |
|
240 | + case 'BLOB': |
|
241 | + case 'MEDIUMBLOB': |
|
242 | + return !empty($fieldobj->binary) ? 'B' : 'X'; |
|
243 | 243 | |
244 | - case 'DATE': return 'D'; |
|
244 | + case 'DATE': return 'D'; |
|
245 | 245 | |
246 | - case 'TIME': |
|
247 | - case 'TIME WITH TIME ZONE': |
|
248 | - case 'TIMESTAMP': |
|
249 | - case 'TIMESTAMP WITH TIME ZONE': return 'T'; |
|
246 | + case 'TIME': |
|
247 | + case 'TIME WITH TIME ZONE': |
|
248 | + case 'TIMESTAMP': |
|
249 | + case 'TIMESTAMP WITH TIME ZONE': return 'T'; |
|
250 | 250 | |
251 | - case 'PRIMARY_KEY': |
|
252 | - return 'R'; |
|
253 | - case 'INTEGER': |
|
254 | - case 'SMALLINT': |
|
255 | - case 'BOOLEAN': |
|
251 | + case 'PRIMARY_KEY': |
|
252 | + return 'R'; |
|
253 | + case 'INTEGER': |
|
254 | + case 'SMALLINT': |
|
255 | + case 'BOOLEAN': |
|
256 | 256 | |
257 | - if (!empty($fieldobj->primary_key)) return 'R'; |
|
258 | - else return 'I'; |
|
257 | + if (!empty($fieldobj->primary_key)) return 'R'; |
|
258 | + else return 'I'; |
|
259 | 259 | |
260 | - default: return 'N'; |
|
260 | + default: return 'N'; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 |