@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | /** |
413 | 413 | * Displays the planner view |
414 | 414 | * |
415 | - * @param boolean|Etemplate $home = false if etemplate return content suitable for home-page |
|
415 | + * @param null|Etemplate $home = false if etemplate return content suitable for home-page |
|
416 | 416 | */ |
417 | 417 | function &planner($content = array(), $home=false) |
418 | 418 | { |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * Used for home app |
498 | 498 | * |
499 | 499 | * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown |
500 | - * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
|
500 | + * @param null|Etemplate $home = false if not false return content suitable for home-page |
|
501 | 501 | */ |
502 | 502 | function &month($weeks=0,$home=false) |
503 | 503 | { |
@@ -580,6 +580,8 @@ discard block |
||
580 | 580 | * @param int &$first timestamp 0h of first day of week containing the first of the current month |
581 | 581 | * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month |
582 | 582 | * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15. |
583 | + * @param integer $first |
|
584 | + * @param integer $last |
|
583 | 585 | */ |
584 | 586 | function _week_align_month(&$first,&$last,$day=1) |
585 | 587 | { |
@@ -604,7 +606,7 @@ discard block |
||
604 | 606 | * Displays the weekview, with 5 or 7 days |
605 | 607 | * |
606 | 608 | * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used |
607 | - * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
|
609 | + * @param null|Etemplate $home = false if not false return content suitable for home-page |
|
608 | 610 | */ |
609 | 611 | function week($days=0,$home=false) |
610 | 612 | { |
@@ -740,7 +742,7 @@ discard block |
||
740 | 742 | /** |
741 | 743 | * Query the open ToDo's via a hook from InfoLog or any other 'calendar_include_todos' provider |
742 | 744 | * |
743 | - * @param array/string $todo_label label for the todo-box or array with 2 values: the label and a boolean show_all |
|
745 | + * @param string $todo_label label for the todo-box or array with 2 values: the label and a boolean show_all |
|
744 | 746 | * On return $todo_label contains the label for the todo-box |
745 | 747 | * @return string/boolean Api\Html with a table of open todo's or false if no hook availible |
746 | 748 | */ |
@@ -824,7 +826,7 @@ discard block |
||
824 | 826 | * - 'edit_popup' => '400x300' (optional) |
825 | 827 | * |
826 | 828 | * @param string $app |
827 | - * @param int|string $id |
|
829 | + * @param string $id |
|
828 | 830 | * @return string |
829 | 831 | */ |
830 | 832 | public static function integration_get_popup($app,$id) |
@@ -864,7 +866,7 @@ discard block |
||
864 | 866 | * Icons specified in $events['icons'] are always displayed! |
865 | 867 | * |
866 | 868 | * @param string $app |
867 | - * @param int|string $id |
|
869 | + * @param string $id |
|
868 | 870 | * @param array $event |
869 | 871 | * @return array |
870 | 872 | */ |
@@ -169,7 +169,10 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public function week_number($time) |
171 | 171 | { |
172 | - if (!is_a($time,'DateTime')) $time = new Api\DateTime($time); |
|
172 | + if (!is_a($time,'DateTime')) |
|
173 | + { |
|
174 | + $time = new Api\DateTime($time); |
|
175 | + } |
|
173 | 176 | |
174 | 177 | // if week does not start Monday and $time is Sunday --> add one day |
175 | 178 | if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w'))) |
@@ -227,7 +230,8 @@ discard block |
||
227 | 230 | $tmpl = new Etemplate('calendar.toolbar'); |
228 | 231 | $tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content)); |
229 | 232 | // Adjust toolbar for mobile |
230 | - if(Api\Header\UserAgent::mobile()){ |
|
233 | + if(Api\Header\UserAgent::mobile()) |
|
234 | + { |
|
231 | 235 | $tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar'); |
232 | 236 | $tmpl->setElementAttribute('toolbar','view_range', '3'); |
233 | 237 | } |
@@ -386,10 +390,12 @@ discard block |
||
386 | 390 | { |
387 | 391 | foreach (array_keys($actions) as $key) |
388 | 392 | { |
389 | - if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) { |
|
393 | + if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) |
|
394 | + { |
|
390 | 395 | $actions[$key]['toolbarDefault'] = false; |
391 | 396 | } |
392 | - else { |
|
397 | + else |
|
398 | + { |
|
393 | 399 | $actions[$key]['toolbarDefault'] = true; |
394 | 400 | } |
395 | 401 | } |
@@ -406,29 +412,38 @@ discard block |
||
406 | 412 | */ |
407 | 413 | function &planner($content = array(), $home=false) |
408 | 414 | { |
409 | - if ($this->sortby == 'month') // yearly planner with month rows |
|
415 | + if ($this->sortby == 'month') |
|
416 | + { |
|
417 | + // yearly planner with month rows |
|
410 | 418 | { |
411 | 419 | $this->first = $this->bo->date2array($this->date); |
420 | + } |
|
412 | 421 | $this->first['day'] = 1; |
413 | 422 | unset($this->first['raw']); |
414 | 423 | $this->last = $this->first; |
415 | 424 | $this->last['year']++; |
416 | 425 | $this->last = $this->bo->date2ts($this->last)-1; |
417 | 426 | } |
418 | - elseif (!$this->planner_view || $this->planner_view == 'month') // planner monthview |
|
427 | + elseif (!$this->planner_view || $this->planner_view == 'month') |
|
428 | + { |
|
429 | + // planner monthview |
|
419 | 430 | { |
420 | 431 | if ($this->day < 15) // show one complete month |
421 | 432 | { |
422 | 433 | $this->_week_align_month($this->first,$this->last); |
434 | + } |
|
423 | 435 | } |
424 | 436 | else // show 2 half month |
425 | 437 | { |
426 | 438 | $this->_week_align_month($this->first,$this->last,15); |
427 | 439 | } |
428 | 440 | } |
429 | - elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview |
|
441 | + elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') |
|
442 | + { |
|
443 | + // weeekview |
|
430 | 444 | { |
431 | 445 | $start = new Api\DateTime($this->date); |
446 | + } |
|
432 | 447 | $start->setWeekstart(); |
433 | 448 | $this->first = $start->format('ts'); |
434 | 449 | $this->last = $this->bo->date2array($this->first); |
@@ -467,7 +482,10 @@ discard block |
||
467 | 482 | $this->to_client($event); |
468 | 483 | } |
469 | 484 | |
470 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
485 | + if ($this->debug > 0) |
|
486 | + { |
|
487 | + $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
488 | + } |
|
471 | 489 | |
472 | 490 | $tmpl = $home ? $home : new Etemplate('calendar.planner'); |
473 | 491 | |
@@ -491,7 +509,10 @@ discard block |
||
491 | 509 | */ |
492 | 510 | function &month($weeks=0,$home=false) |
493 | 511 | { |
494 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); |
|
512 | + if ($this->debug > 0) |
|
513 | + { |
|
514 | + $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); |
|
515 | + } |
|
495 | 516 | |
496 | 517 | if (!$home) |
497 | 518 | { |
@@ -533,7 +554,10 @@ discard block |
||
533 | 554 | $weekNavH = "1 month"; |
534 | 555 | $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; |
535 | 556 | } |
536 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
557 | + if ($this->debug > 0) |
|
558 | + { |
|
559 | + $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
560 | + } |
|
537 | 561 | |
538 | 562 | // Loop through, using Api\DateTime to handle DST |
539 | 563 | $week = 0; |
@@ -578,7 +602,10 @@ discard block |
||
578 | 602 | $start->setWeekstart(); |
579 | 603 | $first = $start->format('ts'); |
580 | 604 | $start->setDate($this->year,$this->month+1,$day); |
581 | - if ($day == 1) $start->add('-1day'); |
|
605 | + if ($day == 1) |
|
606 | + { |
|
607 | + $start->add('-1day'); |
|
608 | + } |
|
582 | 609 | $start->setWeekstart(); |
583 | 610 | // now we need to calculate the end of the last day of that week |
584 | 611 | // as simple $last += WEEK_s - 1; does NOT work, if daylight saving changes in that week!!! |
@@ -601,19 +628,31 @@ discard block |
||
601 | 628 | if (!$days) |
602 | 629 | { |
603 | 630 | $days = isset($_GET['days']) ? $_GET['days'] : $this->cal_prefs['days_in_weekview']; |
604 | - if ($days != 5) $days = 7; |
|
605 | - if ($days != $this->cal_prefs['days_in_weekview']) // save the preference |
|
631 | + if ($days != 5) |
|
632 | + { |
|
633 | + $days = 7; |
|
634 | + } |
|
635 | + if ($days != $this->cal_prefs['days_in_weekview']) |
|
636 | + { |
|
637 | + // save the preference |
|
606 | 638 | { |
607 | 639 | $GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days); |
640 | + } |
|
608 | 641 | $GLOBALS['egw']->preferences->save_repository(); |
609 | 642 | $this->cal_prefs['days_in_weekview'] = $days; |
610 | 643 | } |
611 | 644 | } |
612 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date); |
|
645 | + if ($this->debug > 0) |
|
646 | + { |
|
647 | + $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date); |
|
648 | + } |
|
613 | 649 | |
614 | - if ($days <= 4) // next 4 days view |
|
650 | + if ($days <= 4) |
|
651 | + { |
|
652 | + // next 4 days view |
|
615 | 653 | { |
616 | 654 | $wd_start = $this->first = $this->bo->date2ts($this->date); |
655 | + } |
|
617 | 656 | $this->last = strtotime("+$days days",$this->first) - 1; |
618 | 657 | $view = $days == 1 ? 'day' : 'day4'; |
619 | 658 | } |
@@ -622,12 +661,15 @@ discard block |
||
622 | 661 | $start = new Api\DateTime($this->date); |
623 | 662 | $start->setWeekstart(); |
624 | 663 | $wd_start = $this->first = $start->format('ts'); |
625 | - if ($days <= 5) // no weekend-days |
|
664 | + if ($days <= 5) |
|
665 | + { |
|
666 | + // no weekend-days |
|
626 | 667 | { |
627 | 668 | switch($this->cal_prefs['weekdaystarts']) |
628 | 669 | { |
629 | 670 | case 'Saturday': |
630 | 671 | $this->first = strtotime("+2 days",$this->first); |
672 | + } |
|
631 | 673 | break; |
632 | 674 | case 'Sunday': |
633 | 675 | $this->first = strtotime("+1 day",$this->first); |
@@ -656,7 +698,10 @@ discard block |
||
656 | 698 | ) + $this->search_params; |
657 | 699 | |
658 | 700 | $users = $this->search_params['users']; |
659 | - if (!is_array($users)) $users = array($users); |
|
701 | + if (!is_array($users)) |
|
702 | + { |
|
703 | + $users = array($users); |
|
704 | + } |
|
660 | 705 | |
661 | 706 | $content = array('view' => array()); |
662 | 707 | |
@@ -679,8 +724,7 @@ discard block |
||
679 | 724 | $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1); |
680 | 725 | if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] ||// for more then X users, show all in one row |
681 | 726 | $days == 1 // Showing just 1 day |
682 | - ) |
|
683 | - { |
|
727 | + ) { |
|
684 | 728 | $content['view'][] = (array)$this->tagWholeDayOnTop($this->bo->search($search_params)) + |
685 | 729 | array('owner' => $users); |
686 | 730 | } |
@@ -783,7 +827,8 @@ discard block |
||
783 | 827 | $icons .= ($icons?' ':'').Api\Html::image('infolog',$name,lang($alt),'border="0" width="15" height="15"'); |
784 | 828 | } |
785 | 829 | $todo['icons'] = $icons; |
786 | - if($todo['edit']) { |
|
830 | + if($todo['edit']) |
|
831 | + { |
|
787 | 832 | $todo['edit_size'] = $todo['edit']['size']; |
788 | 833 | unset($todo['edit']['size']); |
789 | 834 | $edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" '); |
@@ -897,7 +942,10 @@ discard block |
||
897 | 942 | // This disables the event actions for the grid rows (calendar weeks/owners) |
898 | 943 | foreach($actions as $id => &$action) |
899 | 944 | { |
900 | - if($id=='add') continue; |
|
945 | + if($id=='add') |
|
946 | + { |
|
947 | + continue; |
|
948 | + } |
|
901 | 949 | if(!$action['enabled']) |
902 | 950 | { |
903 | 951 | $action['enabled'] = 'javaScript:app.calendar.is_event'; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @var mixed |
43 | 43 | */ |
44 | - var $debug=false; |
|
44 | + var $debug = false; |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * extra rows above and below the workday |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @var boolean |
94 | 94 | */ |
95 | - var $use_time_grid=true; |
|
95 | + var $use_time_grid = true; |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Pref value of use_time_grid preference |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @var boolean |
107 | 107 | */ |
108 | - var $scroll_to_wdstart=false; |
|
108 | + var $scroll_to_wdstart = false; |
|
109 | 109 | |
110 | 110 | /** |
111 | 111 | * counter for the current whole day event of a single day |
112 | 112 | * |
113 | 113 | * @var int |
114 | 114 | */ |
115 | - var $wholeDayPosCounter=1; |
|
115 | + var $wholeDayPosCounter = 1; |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Switch to disable private data and possibility to view and edit events |
@@ -125,26 +125,26 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @param array $set_states = null to manualy set / change one of the states, default NULL = use $_REQUEST |
127 | 127 | */ |
128 | - function __construct($set_states=null) |
|
128 | + function __construct($set_states = null) |
|
129 | 129 | { |
130 | - parent::__construct(false,$set_states); // call the parent's constructor |
|
130 | + parent::__construct(false, $set_states); // call the parent's constructor |
|
131 | 131 | $this->extraRowsOriginal = $this->extraRows; //save original extraRows value |
132 | 132 | |
133 | 133 | $GLOBALS['egw_info']['flags']['nonavbar'] = False; |
134 | 134 | |
135 | 135 | // Check for GET message (from merge) |
136 | - if($_GET['msg']) |
|
136 | + if ($_GET['msg']) |
|
137 | 137 | { |
138 | 138 | Framework::message($_GET['msg']); |
139 | 139 | unset($_GET['msg']); |
140 | 140 | } |
141 | 141 | // standard params for calling bocal::search for all views |
142 | - $this->owner = str_replace('%2C',',',$this->owner); |
|
142 | + $this->owner = str_replace('%2C', ',', $this->owner); |
|
143 | 143 | $this->search_params = array( |
144 | 144 | 'start' => $this->date, |
145 | - 'cat_id' => $this->cat_id ? (is_array($this->cat_id)?$this->cat_id:explode(',',$this->cat_id)) : 0, |
|
146 | - 'users' => explode(',',$this->owner), |
|
147 | - 'owner' => explode(',',$this->owner), |
|
145 | + 'cat_id' => $this->cat_id ? (is_array($this->cat_id) ? $this->cat_id : explode(',', $this->cat_id)) : 0, |
|
146 | + 'users' => explode(',', $this->owner), |
|
147 | + 'owner' => explode(',', $this->owner), |
|
148 | 148 | 'filter' => $this->filter, |
149 | 149 | 'daywise' => True, |
150 | 150 | 'use_so_events' => $this->test === 'true', |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function week_number($time) |
172 | 172 | { |
173 | - if (!is_a($time,'DateTime')) $time = new Api\DateTime($time); |
|
173 | + if (!is_a($time, 'DateTime')) $time = new Api\DateTime($time); |
|
174 | 174 | |
175 | 175 | // if week does not start Monday and $time is Sunday --> add one day |
176 | 176 | if ($this->cal_prefs['weekdaystarts'] != 'Monday' && !($wday = $time->format('w'))) |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | /** |
189 | 189 | * Load all views used by calendar, client side switches between them as needed |
190 | 190 | */ |
191 | - function index($content=array()) |
|
191 | + function index($content = array()) |
|
192 | 192 | { |
193 | - if($content['merge']) |
|
193 | + if ($content['merge']) |
|
194 | 194 | { |
195 | 195 | // View from sidebox is JSON encoded |
196 | - $this->manage_states(array_merge($content,json_decode($content['view'],true))); |
|
197 | - if($content['first']) |
|
196 | + $this->manage_states(array_merge($content, json_decode($content['view'], true))); |
|
197 | + if ($content['first']) |
|
198 | 198 | { |
199 | - $this->first = Api\DateTime::to($content['first'],'ts'); |
|
199 | + $this->first = Api\DateTime::to($content['first'], 'ts'); |
|
200 | 200 | } |
201 | - if($content['last']) |
|
201 | + if ($content['last']) |
|
202 | 202 | { |
203 | - $this->last = Api\DateTime::to($content['last'],'ts'); |
|
203 | + $this->last = Api\DateTime::to($content['last'], 'ts'); |
|
204 | 204 | } |
205 | 205 | $_GET['merge'] = $content['merge']; |
206 | 206 | $this->merge(); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualCalendar'.ucfirst($this->view)); |
217 | 217 | |
218 | 218 | // Sidebox & iframe for old views |
219 | - if(in_array($this->view,array('year')) && $_GET['view']) |
|
219 | + if (in_array($this->view, array('year')) && $_GET['view']) |
|
220 | 220 | { |
221 | 221 | $GLOBALS['egw_info']['flags']['nonavbar'] = true; |
222 | 222 | $this->manage_states($_GET); |
@@ -228,24 +228,24 @@ discard block |
||
228 | 228 | $tmpl = new Etemplate('calendar.toolbar'); |
229 | 229 | $tmpl->setElementAttribute('toolbar', 'actions', $this->getToolbarActions($content)); |
230 | 230 | // Adjust toolbar for mobile |
231 | - if(Api\Header\UserAgent::mobile()){ |
|
232 | - $tmpl->setElementAttribute('toolbar','class', 'et2_head_toolbar'); |
|
233 | - $tmpl->setElementAttribute('toolbar','view_range', '3'); |
|
231 | + if (Api\Header\UserAgent::mobile()) { |
|
232 | + $tmpl->setElementAttribute('toolbar', 'class', 'et2_head_toolbar'); |
|
233 | + $tmpl->setElementAttribute('toolbar', 'view_range', '3'); |
|
234 | 234 | } |
235 | - $tmpl->exec('calendar_uiviews::index',array()); |
|
235 | + $tmpl->exec('calendar_uiviews::index', array()); |
|
236 | 236 | |
237 | 237 | // Load the different views once, we'll switch between them on the client side |
238 | 238 | $todo = new Etemplate('calendar.todo'); |
239 | 239 | $label = ''; |
240 | - $todo->exec('calendar_uiviews::index',array('todos'=>'', 'label' => $label)); |
|
240 | + $todo->exec('calendar_uiviews::index', array('todos'=>'', 'label' => $label)); |
|
241 | 241 | |
242 | 242 | // Actually, this takes care of most of it... |
243 | 243 | $this->week(); |
244 | 244 | |
245 | 245 | $planner = new Etemplate('calendar.planner'); |
246 | 246 | // Get the actions |
247 | - $planner->setElementAttribute('planner','actions',$this->get_actions()); |
|
248 | - $planner->exec('calendar_uiviews::index',array()); |
|
247 | + $planner->setElementAttribute('planner', 'actions', $this->get_actions()); |
|
248 | + $planner->exec('calendar_uiviews::index', array()); |
|
249 | 249 | |
250 | 250 | // List view in a separate file |
251 | 251 | $list_ui = new calendar_uilist(); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | { |
388 | 388 | foreach (array_keys($actions) as $key) |
389 | 389 | { |
390 | - if (!in_array($key, array('day_view','week_view','next', 'today','previous'))) { |
|
390 | + if (!in_array($key, array('day_view', 'week_view', 'next', 'today', 'previous'))) { |
|
391 | 391 | $actions[$key]['toolbarDefault'] = false; |
392 | 392 | } |
393 | 393 | else { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @param boolean|Etemplate $home = false if etemplate return content suitable for home-page |
407 | 407 | */ |
408 | - function &planner($content = array(), $home=false) |
|
408 | + function &planner($content = array(), $home = false) |
|
409 | 409 | { |
410 | 410 | if ($this->sortby == 'month') // yearly planner with month rows |
411 | 411 | { |
@@ -414,17 +414,17 @@ discard block |
||
414 | 414 | unset($this->first['raw']); |
415 | 415 | $this->last = $this->first; |
416 | 416 | $this->last['year']++; |
417 | - $this->last = $this->bo->date2ts($this->last)-1; |
|
417 | + $this->last = $this->bo->date2ts($this->last) - 1; |
|
418 | 418 | } |
419 | 419 | elseif (!$this->planner_view || $this->planner_view == 'month') // planner monthview |
420 | 420 | { |
421 | 421 | if ($this->day < 15) // show one complete month |
422 | 422 | { |
423 | - $this->_week_align_month($this->first,$this->last); |
|
423 | + $this->_week_align_month($this->first, $this->last); |
|
424 | 424 | } |
425 | 425 | else // show 2 half month |
426 | 426 | { |
427 | - $this->_week_align_month($this->first,$this->last,15); |
|
427 | + $this->_week_align_month($this->first, $this->last, 15); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | elseif ($this->planner_view == 'week' || $this->planner_view == 'weekN') // weeekview |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | $start->setWeekstart(); |
434 | 434 | $this->first = $start->format('ts'); |
435 | 435 | $this->last = $this->bo->date2array($this->first); |
436 | - $this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks'])-1; |
|
436 | + $this->last['day'] += ($this->planner_view == 'week' ? 7 : 7 * $this->cal_prefs['multiple_weeks']) - 1; |
|
437 | 437 | $this->last['hour'] = 23; $this->last['minute'] = $this->last['sec'] = 59; |
438 | 438 | unset($this->last['raw']); |
439 | 439 | $this->last = $this->bo->date2ts($this->last); |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | } |
450 | 450 | |
451 | 451 | $merge = $this->merge(); |
452 | - if($merge) |
|
452 | + if ($merge) |
|
453 | 453 | { |
454 | - Egw::redirect_link('/index.php',array( |
|
454 | + Egw::redirect_link('/index.php', array( |
|
455 | 455 | 'menuaction' => 'calendar.calendar_uiviews.index', |
456 | 456 | 'msg' => $merge, |
457 | 457 | 'ajax' => 'true' |
@@ -464,21 +464,21 @@ discard block |
||
464 | 464 | $search_params['end'] = $this->last; |
465 | 465 | $search_params['enum_groups'] = $this->sortby == 'user'; |
466 | 466 | $content['planner'] = $this->bo->search($search_params); |
467 | - foreach($content['planner'] as &$event) |
|
467 | + foreach ($content['planner'] as &$event) |
|
468 | 468 | { |
469 | 469 | $this->to_client($event); |
470 | 470 | } |
471 | 471 | |
472 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3',False,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
472 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::planner() date=%1: first=%2, last=%3', False, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
473 | 473 | |
474 | 474 | $tmpl = $home ? $home : new Etemplate('calendar.planner'); |
475 | 475 | |
476 | - $tmpl->setElementAttribute('planner','start_date', Api\DateTime::to($this->first, Api\DateTime::ET2)); |
|
477 | - $tmpl->setElementAttribute('planner','end_date', Api\DateTime::to($this->last, Api\DateTime::ET2)); |
|
478 | - $tmpl->setElementAttribute('planner','owner', $search_params['users']); |
|
479 | - $tmpl->setElementAttribute('planner','group_by', $this->sortby); |
|
476 | + $tmpl->setElementAttribute('planner', 'start_date', Api\DateTime::to($this->first, Api\DateTime::ET2)); |
|
477 | + $tmpl->setElementAttribute('planner', 'end_date', Api\DateTime::to($this->last, Api\DateTime::ET2)); |
|
478 | + $tmpl->setElementAttribute('planner', 'owner', $search_params['users']); |
|
479 | + $tmpl->setElementAttribute('planner', 'group_by', $this->sortby); |
|
480 | 480 | // Get the actions |
481 | - $tmpl->setElementAttribute('planner','actions',$this->get_actions()); |
|
481 | + $tmpl->setElementAttribute('planner', 'actions', $this->get_actions()); |
|
482 | 482 | |
483 | 483 | $tmpl->exec(__METHOD__, $content); |
484 | 484 | } |
@@ -491,30 +491,30 @@ discard block |
||
491 | 491 | * @param int $weeks = 0 number of weeks to show, if 0 (default) all weeks of one month are shown |
492 | 492 | * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
493 | 493 | */ |
494 | - function &month($weeks=0,$home=false) |
|
494 | + function &month($weeks = 0, $home = false) |
|
495 | 495 | { |
496 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2',True,$weeks,$this->date); |
|
496 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(weeks=%1) date=%2', True, $weeks, $this->date); |
|
497 | 497 | |
498 | 498 | if (!$home) |
499 | 499 | { |
500 | - trigger_error(__METHOD__ .' only used by home app', E_USER_DEPRECATED); |
|
500 | + trigger_error(__METHOD__.' only used by home app', E_USER_DEPRECATED); |
|
501 | 501 | return; |
502 | 502 | } |
503 | 503 | |
504 | - $this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all'; // all views |
|
504 | + $this->use_time_grid = !$this->use_time_grid_pref || $this->use_time_grid_pref == 'all'; // all views |
|
505 | 505 | $granularity = 0; |
506 | - if($weeks) |
|
506 | + if ($weeks) |
|
507 | 507 | { |
508 | 508 | $granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30); |
509 | 509 | |
510 | 510 | $list = $this->cal_prefs['use_time_grid']; |
511 | - if(!is_array($list)) |
|
511 | + if (!is_array($list)) |
|
512 | 512 | { |
513 | - $list = explode(',',$list); |
|
513 | + $list = explode(',', $list); |
|
514 | 514 | } |
515 | - if(is_array($list)) |
|
515 | + if (is_array($list)) |
|
516 | 516 | { |
517 | - $granularity = in_array('weekN',$list) ? 0 : $granularity; |
|
517 | + $granularity = in_array('weekN', $list) ? 0 : $granularity; |
|
518 | 518 | } |
519 | 519 | } |
520 | 520 | $content = array('view' => array()); |
@@ -524,23 +524,23 @@ discard block |
||
524 | 524 | $start = new Api\DateTime($this->date); |
525 | 525 | $start->setWeekstart(); |
526 | 526 | $this->first = $start->format('ts'); |
527 | - $this->last = strtotime("+$weeks weeks",$this->first) - 1; |
|
527 | + $this->last = strtotime("+$weeks weeks", $this->first) - 1; |
|
528 | 528 | $weekNavH = "$weeks weeks"; |
529 | 529 | $navHeader = lang('Week').' '.$this->week_number($this->first).' - '.$this->week_number($this->last).': '. |
530 | - $this->bo->long_date($this->first,$this->last); |
|
530 | + $this->bo->long_date($this->first, $this->last); |
|
531 | 531 | } |
532 | 532 | else |
533 | 533 | { |
534 | - $this->_week_align_month($this->first,$this->last); |
|
534 | + $this->_week_align_month($this->first, $this->last); |
|
535 | 535 | $weekNavH = "1 month"; |
536 | - $navHeader = lang(adodb_date('F',$this->bo->date2ts($this->date))).' '.$this->year; |
|
536 | + $navHeader = lang(adodb_date('F', $this->bo->date2ts($this->date))).' '.$this->year; |
|
537 | 537 | } |
538 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4',False,$weeks,$this->date,$this->bo->date2string($this->first),$this->bo->date2string($this->last)); |
|
538 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::month(%1) date=%2: first=%3, last=%4', False, $weeks, $this->date, $this->bo->date2string($this->first), $this->bo->date2string($this->last)); |
|
539 | 539 | |
540 | 540 | // Loop through, using Api\DateTime to handle DST |
541 | 541 | $week = 0; |
542 | 542 | $week_start = new EGroupware\Api\DateTime($this->first); |
543 | - $week_start->setTime(0,0,0); |
|
543 | + $week_start->setTime(0, 0, 0); |
|
544 | 544 | $week_end = new Api\DateTime($week_start); |
545 | 545 | $week_end->add(new DateInterval('P6DT23H59M59S')); |
546 | 546 | $last = new EGroupware\Api\DateTime($this->last); |
@@ -554,14 +554,14 @@ discard block |
||
554 | 554 | array( |
555 | 555 | 'id' => $week_start->format('Ymd') |
556 | 556 | ); |
557 | - $home->setElementAttribute("view[$week]",'onchange',false); |
|
558 | - $home->setElementAttribute("view[$week]",'granularity',$granularity); |
|
559 | - $home->setElementAttribute("view[$week]",'show_weekend', $this->search_params['weekend']); |
|
557 | + $home->setElementAttribute("view[$week]", 'onchange', false); |
|
558 | + $home->setElementAttribute("view[$week]", 'granularity', $granularity); |
|
559 | + $home->setElementAttribute("view[$week]", 'show_weekend', $this->search_params['weekend']); |
|
560 | 560 | $week++; |
561 | 561 | } |
562 | 562 | |
563 | 563 | // Get the actions |
564 | - $home->setElementAttribute('view','actions',$this->get_actions()); |
|
564 | + $home->setElementAttribute('view', 'actions', $this->get_actions()); |
|
565 | 565 | |
566 | 566 | $home->exec(__METHOD__, $content); |
567 | 567 | } |
@@ -573,13 +573,13 @@ discard block |
||
573 | 573 | * @param int &$last timestamp 23:59:59 of last day of week containg the last day of the current month |
574 | 574 | * @param int $day = 1 should the alignment be based on the 1. of the month or an other date, eg. the 15. |
575 | 575 | */ |
576 | - function _week_align_month(&$first,&$last,$day=1) |
|
576 | + function _week_align_month(&$first, &$last, $day = 1) |
|
577 | 577 | { |
578 | 578 | $start = new Api\DateTime($this->date); |
579 | - $start->setDate($this->year,$this->month,$this->day=$day); |
|
579 | + $start->setDate($this->year, $this->month, $this->day = $day); |
|
580 | 580 | $start->setWeekstart(); |
581 | 581 | $first = $start->format('ts'); |
582 | - $start->setDate($this->year,$this->month+1,$day); |
|
582 | + $start->setDate($this->year, $this->month + 1, $day); |
|
583 | 583 | if ($day == 1) $start->add('-1day'); |
584 | 584 | $start->setWeekstart(); |
585 | 585 | // now we need to calculate the end of the last day of that week |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $arr['day'] += 6; |
589 | 589 | $arr['hour'] = 23; |
590 | 590 | $arr['min'] = $arr['sec'] = 59; |
591 | - unset($arr['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
591 | + unset($arr['raw']); // otherwise date2ts does not calc raw new, but uses it |
|
592 | 592 | $last = $this->bo->date2ts($arr); |
593 | 593 | } |
594 | 594 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * @param int $days = 0 number of days to show, if 0 (default) the value from the URL or the prefs is used |
599 | 599 | * @param boolean|etemplate2 $home = false if not false return content suitable for home-page |
600 | 600 | */ |
601 | - function week($days=0,$home=false) |
|
601 | + function week($days = 0, $home = false) |
|
602 | 602 | { |
603 | 603 | if (!$days) |
604 | 604 | { |
@@ -606,17 +606,17 @@ discard block |
||
606 | 606 | if ($days != 5) $days = 7; |
607 | 607 | if ($days != $this->cal_prefs['days_in_weekview']) // save the preference |
608 | 608 | { |
609 | - $GLOBALS['egw']->preferences->add('calendar','days_in_weekview',$days); |
|
609 | + $GLOBALS['egw']->preferences->add('calendar', 'days_in_weekview', $days); |
|
610 | 610 | $GLOBALS['egw']->preferences->save_repository(); |
611 | 611 | $this->cal_prefs['days_in_weekview'] = $days; |
612 | 612 | } |
613 | 613 | } |
614 | - if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2',True,$days,$this->date); |
|
614 | + if ($this->debug > 0) $this->bo->debug_message('uiviews::week(days=%1) date=%2', True, $days, $this->date); |
|
615 | 615 | |
616 | 616 | if ($days <= 4) // next 4 days view |
617 | 617 | { |
618 | 618 | $wd_start = $this->first = $this->bo->date2ts($this->date); |
619 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
619 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
620 | 620 | $view = $days == 1 ? 'day' : 'day4'; |
621 | 621 | } |
622 | 622 | else |
@@ -626,30 +626,30 @@ discard block |
||
626 | 626 | $wd_start = $this->first = $start->format('ts'); |
627 | 627 | if ($days <= 5) // no weekend-days |
628 | 628 | { |
629 | - switch($this->cal_prefs['weekdaystarts']) |
|
629 | + switch ($this->cal_prefs['weekdaystarts']) |
|
630 | 630 | { |
631 | 631 | case 'Saturday': |
632 | - $this->first = strtotime("+2 days",$this->first); |
|
632 | + $this->first = strtotime("+2 days", $this->first); |
|
633 | 633 | break; |
634 | 634 | case 'Sunday': |
635 | - $this->first = strtotime("+1 day",$this->first); |
|
635 | + $this->first = strtotime("+1 day", $this->first); |
|
636 | 636 | break; |
637 | 637 | } |
638 | 638 | } |
639 | - $this->last = strtotime("+$days days",$this->first) - 1; |
|
639 | + $this->last = strtotime("+$days days", $this->first) - 1; |
|
640 | 640 | $view = 'week'; |
641 | 641 | } |
642 | 642 | |
643 | 643 | $granularity = ($this->cal_prefs['interval'] ? (int)$this->cal_prefs['interval'] : 30); |
644 | 644 | |
645 | 645 | $list = $this->cal_prefs['use_time_grid']; |
646 | - if(!is_array($list)) |
|
646 | + if (!is_array($list)) |
|
647 | 647 | { |
648 | - $list = explode(',',$list); |
|
648 | + $list = explode(',', $list); |
|
649 | 649 | } |
650 | - if(is_array($list)) |
|
650 | + if (is_array($list)) |
|
651 | 651 | { |
652 | - $granularity = in_array($view,$list) ? 0 : $granularity; |
|
652 | + $granularity = in_array($view, $list) ? 0 : $granularity; |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | $search_params = array( |
@@ -662,15 +662,15 @@ discard block |
||
662 | 662 | |
663 | 663 | $content = array('view' => array()); |
664 | 664 | |
665 | - if(!$home) |
|
665 | + if (!$home) |
|
666 | 666 | { |
667 | 667 | // Fill with the minimum needed 'weeks' |
668 | 668 | $min = max( |
669 | 669 | 6, // Some months need 6 weeks for full display |
670 | - $this->cal_prefs['multiple_weeks'], // WeekN view |
|
670 | + $this->cal_prefs['multiple_weeks'], // WeekN view |
|
671 | 671 | $this->cal_prefs['week_consolidate'] // We collapse after this many users |
672 | 672 | ); |
673 | - for($i = 0; $i < $min; $i++) |
|
673 | + for ($i = 0; $i < $min; $i++) |
|
674 | 674 | { |
675 | 675 | $content['view'][] = array(); |
676 | 676 | } |
@@ -678,8 +678,8 @@ discard block |
||
678 | 678 | else |
679 | 679 | { |
680 | 680 | // Always do 7 days for a week so scrolling works properly |
681 | - $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days",$this->first) - 1); |
|
682 | - if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] ||// for more then X users, show all in one row |
|
681 | + $this->last = ($days == 4 ? $this->last : $search_params['end'] = strtotime("+$days days", $this->first) - 1); |
|
682 | + if (count($users) == 1 || count($users) >= $this->cal_prefs['week_consolidate'] || // for more then X users, show all in one row |
|
683 | 683 | $days == 1 // Showing just 1 day |
684 | 684 | ) |
685 | 685 | { |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | else |
690 | 690 | { |
691 | - foreach($users as $uid) |
|
691 | + foreach ($users as $uid) |
|
692 | 692 | { |
693 | 693 | $search_params['users'] = $uid; |
694 | 694 | $content['view'][] = $this->tagWholeDayOnTop($this->bo->search($search_params)) |
@@ -696,15 +696,15 @@ discard block |
||
696 | 696 | } |
697 | 697 | } |
698 | 698 | } |
699 | - $tmpl = $home ? $home :new Etemplate('calendar.view'); |
|
700 | - foreach(array_keys($content['view']) as $index) |
|
699 | + $tmpl = $home ? $home : new Etemplate('calendar.view'); |
|
700 | + foreach (array_keys($content['view']) as $index) |
|
701 | 701 | { |
702 | - $tmpl->setElementAttribute("view[$index]",'granularity',$granularity); |
|
703 | - $tmpl->setElementAttribute("view[$index]",'show_weekend',$this->search_params['weekend']); |
|
702 | + $tmpl->setElementAttribute("view[$index]", 'granularity', $granularity); |
|
703 | + $tmpl->setElementAttribute("view[$index]", 'show_weekend', $this->search_params['weekend']); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | // Get the actions |
707 | - $tmpl->setElementAttribute('view','actions',$this->get_actions()); |
|
707 | + $tmpl->setElementAttribute('view', 'actions', $this->get_actions()); |
|
708 | 708 | |
709 | 709 | $tmpl->exec(__METHOD__, $content); |
710 | 710 | } |
@@ -746,19 +746,19 @@ discard block |
||
746 | 746 | 'owner' => $this->owner // num. id of the user, not necessary current user |
747 | 747 | )); |
748 | 748 | |
749 | - if(is_array($todo_label)) |
|
749 | + if (is_array($todo_label)) |
|
750 | 750 | { |
751 | - list($label,$showall)=$todo_label; |
|
751 | + list($label, $showall) = $todo_label; |
|
752 | 752 | } |
753 | 753 | else |
754 | 754 | { |
755 | - $label=$todo_label; |
|
756 | - $showall=true; |
|
755 | + $label = $todo_label; |
|
756 | + $showall = true; |
|
757 | 757 | } |
758 | 758 | $maxshow = (int)$GLOBALS['egw_info']['user']['preferences']['infolog']['mainscreen_maxshow']; |
759 | - if($maxshow <= 0) |
|
759 | + if ($maxshow <= 0) |
|
760 | 760 | { |
761 | - $maxshow=10; |
|
761 | + $maxshow = 10; |
|
762 | 762 | } |
763 | 763 | //print_debug("get_todos(): label=$label; showall=$showall; max=$maxshow"); |
764 | 764 | |
@@ -766,31 +766,31 @@ discard block |
||
766 | 766 | $todo_list = array(); |
767 | 767 | if (is_array($todos_from_hook) && count($todos_from_hook)) |
768 | 768 | { |
769 | - foreach($todos_from_hook as $todos) |
|
769 | + foreach ($todos_from_hook as $todos) |
|
770 | 770 | { |
771 | 771 | $i = 0; |
772 | 772 | if (is_array($todos)) |
773 | 773 | { |
774 | 774 | $todo_label = !empty($label) ? $label : lang("open ToDo's:"); |
775 | 775 | |
776 | - foreach($todos as &$todo) |
|
776 | + foreach ($todos as &$todo) |
|
777 | 777 | { |
778 | - if(!$showall && ($i++ > $maxshow)) |
|
778 | + if (!$showall && ($i++ > $maxshow)) |
|
779 | 779 | { |
780 | 780 | break; |
781 | 781 | } |
782 | 782 | $icons = ''; |
783 | - foreach($todo['icons'] as $name => $alt) |
|
783 | + foreach ($todo['icons'] as $name => $alt) |
|
784 | 784 | { |
785 | - $icons .= ($icons?' ':'').Api\Html::image('infolog',$name,lang($alt),'border="0" width="15" height="15"'); |
|
785 | + $icons .= ($icons ? ' ' : '').Api\Html::image('infolog', $name, lang($alt), 'border="0" width="15" height="15"'); |
|
786 | 786 | } |
787 | 787 | $todo['icons'] = $icons; |
788 | - if($todo['edit']) { |
|
788 | + if ($todo['edit']) { |
|
789 | 789 | $todo['edit_size'] = $todo['edit']['size']; |
790 | 790 | unset($todo['edit']['size']); |
791 | - $edit_icon_href = Api\Html::a_href( $icons, $todo['edit'],'',' data-todo="app|750x590" '); |
|
792 | - $edit_href = Api\Html::a_href( $todo['title'], $todo['edit'],'',' data-todo="app|750x590" '); |
|
793 | - $todo['edit'] = Framework::link('/index.php',$todo['edit'],true); |
|
791 | + $edit_icon_href = Api\Html::a_href($icons, $todo['edit'], '', ' data-todo="app|750x590" '); |
|
792 | + $edit_href = Api\Html::a_href($todo['title'], $todo['edit'], '', ' data-todo="app|750x590" '); |
|
793 | + $todo['edit'] = Framework::link('/index.php', $todo['edit'], true); |
|
794 | 794 | } |
795 | 795 | $todo_list[] = $todo; |
796 | 796 | } |
@@ -812,9 +812,9 @@ discard block |
||
812 | 812 | * @param int|string $id |
813 | 813 | * @return string |
814 | 814 | */ |
815 | - public static function integration_get_popup($app,$id) |
|
815 | + public static function integration_get_popup($app, $id) |
|
816 | 816 | { |
817 | - $app_data = calendar_bo::integration_get_data($app,'edit_link'); |
|
817 | + $app_data = calendar_bo::integration_get_data($app, 'edit_link'); |
|
818 | 818 | |
819 | 819 | if (is_array($app_data) && isset($app_data['edit'])) |
820 | 820 | { |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | } |
825 | 825 | else |
826 | 826 | { |
827 | - $edit = Link::edit($app,$id,$popup_size); |
|
827 | + $edit = Link::edit($app, $id, $popup_size); |
|
828 | 828 | } |
829 | 829 | if ($edit) |
830 | 830 | { |
@@ -853,28 +853,28 @@ discard block |
||
853 | 853 | * @param array $event |
854 | 854 | * @return array |
855 | 855 | */ |
856 | - static function integration_get_icons($app,$id,$event) |
|
856 | + static function integration_get_icons($app, $id, $event) |
|
857 | 857 | { |
858 | 858 | $icons = array(); |
859 | 859 | if ($event['icons']) |
860 | 860 | { |
861 | - foreach(explode(',',$event['icons']) as $icon) |
|
861 | + foreach (explode(',', $event['icons']) as $icon) |
|
862 | 862 | { |
863 | - list($icon_app,$icon) = explode(':',$icon); |
|
864 | - if (Api\Image::find($icon_app,$icon)) |
|
863 | + list($icon_app, $icon) = explode(':', $icon); |
|
864 | + if (Api\Image::find($icon_app, $icon)) |
|
865 | 865 | { |
866 | - $icons[] = Api\Html::image($icon_app,$icon); |
|
866 | + $icons[] = Api\Html::image($icon_app, $icon); |
|
867 | 867 | } |
868 | 868 | } |
869 | 869 | } |
870 | - $app_data = calendar_bo::integration_get_data($app,'icons'); |
|
870 | + $app_data = calendar_bo::integration_get_data($app, 'icons'); |
|
871 | 871 | if (is_null($app_data)) |
872 | 872 | { |
873 | - $icons[] = Api\Html::image($app,'navbar'); // use navbar icon |
|
873 | + $icons[] = Api\Html::image($app, 'navbar'); // use navbar icon |
|
874 | 874 | } |
875 | 875 | elseif ($app_data) |
876 | 876 | { |
877 | - $icons += (array)ExecMethod2($app_data,$id,$event); |
|
877 | + $icons += (array)ExecMethod2($app_data, $id, $event); |
|
878 | 878 | } |
879 | 879 | return $icons; |
880 | 880 | } |
@@ -897,22 +897,22 @@ discard block |
||
897 | 897 | unset($actions['select_all']); |
898 | 898 | |
899 | 899 | // This disables the event actions for the grid rows (calendar weeks/owners) |
900 | - foreach($actions as $id => &$action) |
|
900 | + foreach ($actions as $id => &$action) |
|
901 | 901 | { |
902 | - if($id=='add') continue; |
|
903 | - if(!$action['enabled']) |
|
902 | + if ($id == 'add') continue; |
|
903 | + if (!$action['enabled']) |
|
904 | 904 | { |
905 | 905 | $action['enabled'] = 'javaScript:app.calendar.is_event'; |
906 | 906 | } |
907 | 907 | } |
908 | 908 | $actions['add']['open'] = '{"app":"calendar","type":"add"}'; |
909 | - $actions['add']['onExecute'] = 'javaScript:app.calendar.action_open'; |
|
909 | + $actions['add']['onExecute'] = 'javaScript:app.calendar.action_open'; |
|
910 | 910 | $actions['copy']['open'] = '{"app": "calendar", "type": "add", "extra": "cal_id=$id&action=copy"}'; |
911 | 911 | $actions['copy']['onExecute'] = 'javaScript:app.calendar.action_open'; |
912 | 912 | $actions['print']['open'] = '{"app": "calendar", "type": "add", "extra": "cal_id=$id&print=1"}'; |
913 | 913 | $actions['print']['onExecute'] = 'javaScript:app.calendar.action_open'; |
914 | 914 | |
915 | - foreach($actions['status']['children'] as $id => &$status) |
|
915 | + foreach ($actions['status']['children'] as $id => &$status) |
|
916 | 916 | { |
917 | 917 | $status = array( |
918 | 918 | 'id' => $id, |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | |
924 | 924 | if ($actions['filemanager']) |
925 | 925 | { |
926 | - $actions['filemanager']['url'] = '/index.php?'. $actions['filemanager']['url']; |
|
926 | + $actions['filemanager']['url'] = '/index.php?'.$actions['filemanager']['url']; |
|
927 | 927 | $actions['filemanager']['onExecute'] = 'javaScript:app.calendar.action_open'; |
928 | 928 | } |
929 | 929 | if ($actions['infolog_app']) |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | $action['onExecute'] = 'javaScript:app.calendar.action_merge'; |
938 | 938 | if (!empty($action['children'])) |
939 | 939 | { |
940 | - foreach($action['children'] as &$child) |
|
940 | + foreach ($action['children'] as &$child) |
|
941 | 941 | { |
942 | 942 | $set_execute($child); |
943 | 943 | } |
@@ -971,26 +971,26 @@ discard block |
||
971 | 971 | { |
972 | 972 | $start = $this->bo->date2array($event['start']); |
973 | 973 | $end = $this->bo->date2array($event['end']); |
974 | - if(!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
974 | + if (!$start['hour'] && !$start['minute'] && $end['hour'] == 23 && $end['minute'] == 59) |
|
975 | 975 | { |
976 | - if($event['non_blocking']) |
|
976 | + if ($event['non_blocking']) |
|
977 | 977 | { |
978 | - $dayEvents[$day][$num]['whole_day_on_top']=true; |
|
979 | - $this->whole_day_positions[$num]=($this->rowHeight*($num+2)); |
|
978 | + $dayEvents[$day][$num]['whole_day_on_top'] = true; |
|
979 | + $this->whole_day_positions[$num] = ($this->rowHeight * ($num + 2)); |
|
980 | 980 | $extraRowsToAdd++; |
981 | 981 | } |
982 | 982 | else |
983 | 983 | { |
984 | - $dayEvents[$day][$num]['whole_day']=true; |
|
984 | + $dayEvents[$day][$num]['whole_day'] = true; |
|
985 | 985 | } |
986 | 986 | } |
987 | 987 | $this->to_client($dayEvents[$day][$num]); |
988 | 988 | } |
989 | 989 | // check after every day if we have to increase $this->extraRows |
990 | - if(($this->extraRowsOriginal+$extraRowsToAdd) > $this->extraRows) |
|
990 | + if (($this->extraRowsOriginal + $extraRowsToAdd) > $this->extraRows) |
|
991 | 991 | { |
992 | 992 | $this->remBotExtraRows = $extraRowsToAdd; |
993 | - $this->extraRows = ($this->extraRowsOriginal+$extraRowsToAdd); |
|
993 | + $this->extraRows = ($this->extraRowsOriginal + $extraRowsToAdd); |
|
994 | 994 | } |
995 | 995 | } |
996 | 996 | } |
@@ -11,6 +11,10 @@ discard block |
||
11 | 11 | |
12 | 12 | use EGroupware\Api; |
13 | 13 | |
14 | +/** |
|
15 | + * @param string $table |
|
16 | + * @param string $field |
|
17 | + */ |
|
14 | 18 | function calendar_v0_9_2to0_9_3update_owner($table, $field) |
15 | 19 | { |
16 | 20 | $GLOBALS['egw_setup']->oProc->query("select distinct($field) from $table"); |
@@ -2306,7 +2310,7 @@ discard block |
||
2306 | 2310 | * |
2307 | 2311 | * Also fix recurring events containing a reference to an other master, created when an exception is made a recurring event. |
2308 | 2312 | * |
2309 | - * @return type |
|
2313 | + * @return string |
|
2310 | 2314 | */ |
2311 | 2315 | function calendar_upgrade14_1() |
2312 | 2316 | { |
@@ -1909,7 +1909,7 @@ |
||
1909 | 1909 | WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
1910 | 1910 | } |
1911 | 1911 | |
1912 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1912 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
|
1913 | 1913 | WHERE recur_interval=0',__LINE__,__FILE__); |
1914 | 1914 | |
1915 | 1915 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
34 | 34 | $GLOBALS['egw_setup']->oProc->next_record(); |
35 | - $GLOBALS['egw_setup']->oProc->query("UPDATE $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
35 | + $GLOBALS['egw_setup']->oProc->query("update $table SET $field=".$GLOBALS['egw_setup']->oProc->f('account_id')." WHERE $field='".$owner[$i]."'"); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | $GLOBALS['egw_setup']->oProc->AlterColumn($table, $field, array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => 0)); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $db2 = clone($GLOBALS['egw_setup']->db); |
189 | 189 | |
190 | 190 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry', |
191 | - Array( |
|
191 | + array( |
|
192 | 192 | 'fd' => array( |
193 | 193 | 'cal_id' => array('type' => 'auto', 'nullable' => false), |
194 | 194 | 'cal_owner' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry'); |
239 | 239 | |
240 | 240 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_user', |
241 | - Array( |
|
241 | + array( |
|
242 | 242 | 'fd' => array( |
243 | 243 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
244 | 244 | 'cal_login' => array('type' => 'int', 'precision' => 4, 'nullable' => false, 'default' => '0'), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_user'); |
269 | 269 | |
270 | 270 | $GLOBALS['egw_setup']->oProc->CreateTable('calendar_entry_repeats', |
271 | - Array( |
|
271 | + array( |
|
272 | 272 | 'fd' => array( |
273 | 273 | 'cal_id' => array('type' => 'int', 'precision' => 4, 'default' => '0', 'nullable' => false), |
274 | 274 | 'cal_type' => array('type' => 'varchar', 'precision' => 20, 'default' => 'daily', 'nullable' => false), |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
313 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
313 | + $GLOBALS['egw_setup']->oProc->query("update {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
314 | 314 | |
315 | 315 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
316 | 316 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | // calendar_entry => phpgw_cal |
604 | 604 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal', |
605 | - Array( |
|
605 | + array( |
|
606 | 606 | 'fd' => array( |
607 | 607 | 'cal_id' => array('type' => 'auto', 'nullable' => False), |
608 | 608 | 'owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | // calendar_entry_repeats => phpgw_cal_repeats |
660 | 660 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
661 | - Array( |
|
661 | + array( |
|
662 | 662 | 'fd' => array( |
663 | 663 | 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
664 | 664 | 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | function calendar_upgrade0_9_11_003() |
732 | 732 | { |
733 | 733 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
734 | - Array( |
|
734 | + array( |
|
735 | 735 | 'fd' => array( |
736 | 736 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
737 | 737 | 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | { |
768 | 768 | $GLOBALS['egw_setup']->oProc->DropTable('phpgw_cal_holidays'); |
769 | 769 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
770 | - Array( |
|
770 | + array( |
|
771 | 771 | 'fd' => array( |
772 | 772 | 'hol_id' => array('type' => 'auto','nullable' => False), |
773 | 773 | 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | function calendar_upgrade0_9_13_003() |
855 | 855 | { |
856 | 856 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
857 | - Array( |
|
857 | + array( |
|
858 | 858 | 'fd' => array( |
859 | 859 | 'alarm_id' => array('type' => 'auto','nullable' => False), |
860 | 860 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | |
889 | 889 | function calendar_upgrade0_9_13_005() |
890 | 890 | { |
891 | - $calendar_data = Array(); |
|
891 | + $calendar_data = array(); |
|
892 | 892 | $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
893 | 893 | while($GLOBALS['egw_setup']->oProc->next_record()) |
894 | 894 | { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
21 | 21 | } |
22 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
22 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
23 | 23 | { |
24 | 24 | $acctstbl = 'accounts'; |
25 | 25 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | { |
28 | 28 | $acctstbl = 'phpgw_accounts'; |
29 | 29 | } |
30 | - for($i=0;$i<count($owner);$i++) |
|
30 | + for ($i = 0; $i < count($owner); $i++) |
|
31 | 31 | { |
32 | 32 | $GLOBALS['egw_setup']->oProc->query("SELECT account_id FROM $acctstbl WHERE account_lid='".$owner[$i]."'"); |
33 | 33 | $GLOBALS['egw_setup']->oProc->next_record(); |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | function calendar_upgrade0_9_3pre1() |
42 | 42 | { |
43 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
44 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
43 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
44 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
45 | 45 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
46 | 46 | return $GLOBALS['setup_info']['calendar']['currentver']; |
47 | 47 | } |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | |
211 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
211 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
212 | 212 | $GLOBALS['egw_setup']->oProc->next_record(); |
213 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
213 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
214 | 214 | { |
215 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
216 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
215 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_owner,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description,cal_id,cal_date,cal_time,cal_mod_date,cal_mod_time FROM webcal_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
216 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
217 | 217 | { |
218 | 218 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
219 | 219 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
224 | 224 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
225 | 225 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
226 | - $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'),0,4))); |
|
227 | - $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),4))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),2,2))),intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')),0,2))),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'),0,4))); |
|
228 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
226 | + $datetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_date'), 0, 4))); |
|
227 | + $moddatetime = mktime(intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 4))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 2, 2))), intval(strrev(substr(strrev($GLOBALS['egw_setup']->oProc->f('cal_mod_time')), 0, 2))), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_mod_date'), 0, 4))); |
|
228 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
229 | 229 | $db2->next_record(); |
230 | 230 | $cal_group = $db2->f('groups'); |
231 | 231 | $db2->query('INSERT INTO calendar_entry(cal_id,cal_owner,cal_group,cal_datetime,cal_mdatetime,cal_duration,cal_priority,cal_type,cal_access,cal_name,cal_description) ' |
232 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
232 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -250,17 +250,17 @@ discard block |
||
250 | 250 | ) |
251 | 251 | ); |
252 | 252 | |
253 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
253 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
254 | 254 | $GLOBALS['egw_setup']->oProc->next_record(); |
255 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
255 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
256 | 256 | { |
257 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
258 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
257 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
258 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
259 | 259 | { |
260 | 260 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
261 | 261 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
262 | 262 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
263 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
263 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
@@ -283,18 +283,18 @@ discard block |
||
283 | 283 | ) |
284 | 284 | ); |
285 | 285 | |
286 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
286 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
287 | 287 | $GLOBALS['egw_setup']->oProc->next_record(); |
288 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
288 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
289 | 289 | { |
290 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id',__LINE__,__FILE__); |
|
291 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
290 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_type,cal_end,cal_frequency,cal_days FROM webcal_entry_repeats ORDER BY cal_id', __LINE__, __FILE__); |
|
291 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
292 | 292 | { |
293 | 293 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
294 | 294 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
295 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
295 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
296 | 296 | { |
297 | - $enddate = mktime(0,0,0,intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),4,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),6,2)),intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'),0,4))); |
|
297 | + $enddate = mktime(0, 0, 0, intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 4, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 6, 2)), intval(substr($GLOBALS['egw_setup']->oProc->f('cal_end'), 0, 4))); |
|
298 | 298 | $useend = 1; |
299 | 299 | } |
300 | 300 | else |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | } |
305 | 305 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
306 | 306 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
307 | - $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')",__LINE__,__FILE__); |
|
307 | + $db2->query('INSERT INTO calendar_entry_repeats(cal_id,cal_type,cal_use_end,cal_end,cal_frequency,cal_days) VALUES('.$cal_id.",'".$cal_type."',".$useend.",".$enddate.",".$cal_frequency.",'".$cal_days."')", __LINE__, __FILE__); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | $GLOBALS['egw_setup']->oProc->DropTable('webcal_entry_repeats'); |
312 | - $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'",__LINE__,__FILE__); |
|
312 | + $GLOBALS['egw_setup']->oProc->query("UPDATE {$GLOBALS['egw_setup']->applications_table} SET app_tables='calendar_entry,calendar_entry_user,calendar_entry_repeats' WHERE app_name='calendar'", __LINE__, __FILE__); |
|
313 | 313 | |
314 | 314 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.7pre2'; |
315 | 315 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -321,19 +321,19 @@ discard block |
||
321 | 321 | $db2 = $GLOBALS['egw_setup']->db; |
322 | 322 | |
323 | 323 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
324 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id',__LINE__,__FILE__); |
|
325 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
324 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_datetime,cal_owner,cal_edatetime,cal_mdatetime FROM calendar_entry ORDER BY cal_id', __LINE__, __FILE__); |
|
325 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
326 | 326 | { |
327 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
327 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
328 | 328 | { |
329 | - $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'),__LINE__,__FILE__); |
|
329 | + $db2->query("SELECT preference_value FROM preferences WHERE preference_name='tz_offset' AND preference_appname='common' AND preference_owner=".$GLOBALS['egw_setup']->db->f('cal_owner'), __LINE__, __FILE__); |
|
330 | 330 | $db2->next_record(); |
331 | 331 | $tz = $db2->f('preference_value'); |
332 | 332 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
333 | 333 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
334 | 334 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
335 | 335 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
336 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
336 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | { |
582 | 582 | $db2 = $GLOBALS['egw_setup']->db; |
583 | 583 | |
584 | - if(extension_loaded('mcal') == False) |
|
584 | + if (extension_loaded('mcal') == False) |
|
585 | 585 | { |
586 | - define(RECUR_NONE,0); |
|
587 | - define(RECUR_DAILY,1); |
|
588 | - define(RECUR_WEEKLY,2); |
|
589 | - define(RECUR_MONTHLY_MDAY,3); |
|
590 | - define(RECUR_MONTHLY_WDAY,4); |
|
591 | - define(RECUR_YEARLY,5); |
|
592 | - |
|
593 | - define(M_SUNDAY,1); |
|
594 | - define(M_MONDAY,2); |
|
595 | - define(M_TUESDAY,4); |
|
596 | - define(M_WEDNESDAY,8); |
|
597 | - define(M_THURSDAY,16); |
|
598 | - define(M_FRIDAY,32); |
|
599 | - define(M_SATURDAY,64); |
|
586 | + define(RECUR_NONE, 0); |
|
587 | + define(RECUR_DAILY, 1); |
|
588 | + define(RECUR_WEEKLY, 2); |
|
589 | + define(RECUR_MONTHLY_MDAY, 3); |
|
590 | + define(RECUR_MONTHLY_WDAY, 4); |
|
591 | + define(RECUR_YEARLY, 5); |
|
592 | + |
|
593 | + define(M_SUNDAY, 1); |
|
594 | + define(M_MONDAY, 2); |
|
595 | + define(M_TUESDAY, 4); |
|
596 | + define(M_WEDNESDAY, 8); |
|
597 | + define(M_THURSDAY, 16); |
|
598 | + define(M_FRIDAY, 32); |
|
599 | + define(M_SATURDAY, 64); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | // calendar_entry => phpgw_cal |
@@ -623,13 +623,13 @@ discard block |
||
623 | 623 | ) |
624 | 624 | ); |
625 | 625 | |
626 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
627 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
626 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
627 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
628 | 628 | { |
629 | 629 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
630 | 630 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
631 | 631 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
632 | - switch($access) |
|
632 | + switch ($access) |
|
633 | 633 | { |
634 | 634 | case 'private': |
635 | 635 | $is_public = 0; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
652 | 652 | |
653 | 653 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
654 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
654 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
655 | 655 | } |
656 | 656 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
657 | 657 | |
@@ -659,12 +659,12 @@ discard block |
||
659 | 659 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
660 | 660 | Array( |
661 | 661 | 'fd' => array( |
662 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
663 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
664 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
665 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
666 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
667 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
662 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
663 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
664 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
665 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
666 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
667 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
668 | 668 | ), |
669 | 669 | 'pk' => array(), |
670 | 670 | 'fk' => array(), |
@@ -672,12 +672,12 @@ discard block |
||
672 | 672 | 'uc' => array() |
673 | 673 | ) |
674 | 674 | ); |
675 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
676 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
675 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
676 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
677 | 677 | { |
678 | 678 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
679 | 679 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
680 | - switch($recur_type) |
|
680 | + switch ($recur_type) |
|
681 | 681 | { |
682 | 682 | case 'daily': |
683 | 683 | $recur_type_num = RECUR_DAILY; |
@@ -700,20 +700,20 @@ discard block |
||
700 | 700 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
701 | 701 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
702 | 702 | $recur_data = 0; |
703 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
704 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
705 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
706 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
707 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
708 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
709 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
703 | + $recur_data += (substr($days, 0, 1) == 'Y' ?M_SUNDAY:0); |
|
704 | + $recur_data += (substr($days, 1, 1) == 'Y' ?M_MONDAY:0); |
|
705 | + $recur_data += (substr($days, 2, 1) == 'Y' ?M_TUESDAY:0); |
|
706 | + $recur_data += (substr($days, 3, 1) == 'Y' ?M_WEDNESDAY:0); |
|
707 | + $recur_data += (substr($days, 4, 1) == 'Y' ?M_THURSDAY:0); |
|
708 | + $recur_data += (substr($days, 5, 1) == 'Y' ?M_FRIDAY:0); |
|
709 | + $recur_data += (substr($days, 6, 1) == 'Y' ?M_SATURDAY:0); |
|
710 | 710 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
711 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
711 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
712 | 712 | } |
713 | 713 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
714 | 714 | |
715 | 715 | // calendar_entry_user => phpgw_cal_user |
716 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
716 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
717 | 717 | |
718 | 718 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
719 | 719 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -732,11 +732,11 @@ discard block |
||
732 | 732 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
733 | 733 | Array( |
734 | 734 | 'fd' => array( |
735 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
736 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
737 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
735 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
736 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
737 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
738 | 738 | ), |
739 | - 'pk' => array('locale','name'), |
|
739 | + 'pk' => array('locale', 'name'), |
|
740 | 740 | 'fk' => array(), |
741 | 741 | 'ix' => array(), |
742 | 742 | 'uc' => array() |
@@ -768,10 +768,10 @@ discard block |
||
768 | 768 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
769 | 769 | Array( |
770 | 770 | 'fd' => array( |
771 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
772 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
773 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
774 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
771 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
772 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
773 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
774 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
775 | 775 | ), |
776 | 776 | 'pk' => array('hol_id'), |
777 | 777 | 'fk' => array(), |
@@ -788,10 +788,10 @@ discard block |
||
788 | 788 | function calendar_upgrade0_9_11_007() |
789 | 789 | { |
790 | 790 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
791 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
794 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
791 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
794 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
795 | 795 | |
796 | 796 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
797 | 797 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | function calendar_upgrade0_9_11_009() |
809 | 809 | { |
810 | 810 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
811 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
811 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
812 | 812 | |
813 | 813 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
814 | 814 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | |
844 | 844 | function calendar_upgrade0_9_13_002() |
845 | 845 | { |
846 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
846 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
847 | 847 | |
848 | 848 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
849 | 849 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
856 | 856 | Array( |
857 | 857 | 'fd' => array( |
858 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
858 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
859 | 859 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
860 | 860 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
861 | 861 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | ) |
869 | 869 | ); |
870 | 870 | |
871 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
872 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
871 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
872 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
873 | 873 | |
874 | 874 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
875 | 875 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | |
879 | 879 | function calendar_upgrade0_9_13_004() |
880 | 880 | { |
881 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
881 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
882 | 882 | |
883 | 883 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
884 | 884 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -888,18 +888,18 @@ discard block |
||
888 | 888 | function calendar_upgrade0_9_13_005() |
889 | 889 | { |
890 | 890 | $calendar_data = Array(); |
891 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
892 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
891 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
892 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
893 | 893 | { |
894 | 894 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
895 | 895 | } |
896 | 896 | |
897 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
897 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
898 | 898 | |
899 | 899 | @reset($calendar_data); |
900 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
900 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
901 | 901 | { |
902 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
902 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
903 | 903 | } |
904 | 904 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
905 | 905 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | function calendar_upgrade0_9_13_006() |
910 | 910 | { |
911 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
911 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
912 | 912 | |
913 | 913 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
914 | 914 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -918,20 +918,20 @@ discard block |
||
918 | 918 | |
919 | 919 | function calendar_upgrade0_9_13_007() |
920 | 920 | { |
921 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
921 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
922 | 922 | 'type' => 'varchar', |
923 | 923 | 'precision' => '1', |
924 | 924 | 'nullable' => False, |
925 | 925 | 'default' => 'u' |
926 | 926 | )); |
927 | 927 | |
928 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
928 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
929 | 929 | 'fd' => array( |
930 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
931 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
932 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
930 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
931 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
932 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
933 | 933 | ), |
934 | - 'pk' => array('cal_id','cal_extra_name'), |
|
934 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
935 | 935 | 'fk' => array(), |
936 | 936 | 'ix' => array(), |
937 | 937 | 'uc' => array() |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | function calendar_upgrade0_9_16_001() |
949 | 949 | { |
950 | 950 | // this is to set the default as schema_proc was not setting an empty default |
951 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
951 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
952 | 952 | 'type' => 'varchar', |
953 | 953 | 'precision' => '1', |
954 | 954 | 'nullable' => False, |
@@ -965,15 +965,15 @@ discard block |
||
965 | 965 | |
966 | 966 | function calendar_upgrade0_9_16_002() |
967 | 967 | { |
968 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
968 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
969 | 969 | 'fd' => array( |
970 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
971 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
972 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
973 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
974 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
975 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
976 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
970 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
971 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
972 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
973 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
974 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
975 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
976 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
977 | 977 | ), |
978 | 978 | 'pk' => array(), |
979 | 979 | 'fk' => array(), |
@@ -989,14 +989,14 @@ discard block |
||
989 | 989 | |
990 | 990 | function calendar_upgrade0_9_16_003() |
991 | 991 | { |
992 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
992 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
993 | 993 | 'fd' => array( |
994 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
995 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
996 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
997 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
994 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
995 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
996 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
997 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
998 | 998 | ), |
999 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
999 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
1000 | 1000 | 'fk' => array(), |
1001 | 1001 | 'ix' => array(), |
1002 | 1002 | 'uc' => array() |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | function calendar_upgrade0_9_16_004() |
1012 | 1012 | { |
1013 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
1013 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
1014 | 1014 | 'fd' => array( |
1015 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
1016 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
1017 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
1018 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1019 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1020 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1021 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1022 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1015 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
1016 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
1017 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
1018 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1019 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1020 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1021 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1022 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1023 | 1023 | ), |
1024 | 1024 | 'pk' => array('hol_id'), |
1025 | 1025 | 'fk' => array(), |
@@ -1037,13 +1037,13 @@ discard block |
||
1037 | 1037 | { |
1038 | 1038 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
1039 | 1039 | // very old entries even have an empty uid, see 0.9.16.006 update |
1040 | - $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'",__LINE__,__FILE__); |
|
1040 | + $GLOBALS['egw_setup']->oProc->query("SELECT config_name,config_value FROM {$GLOBALS['egw_setup']->config_table} WHERE config_name IN ('install_id','mail_suffix') AND config_app='phpgwapi'", __LINE__, __FILE__); |
|
1041 | 1041 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
1042 | 1042 | { |
1043 | 1043 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
1044 | 1044 | } |
1045 | 1045 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
1046 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
1046 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
1047 | 1047 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
1048 | 1048 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
1049 | 1049 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | function calendar_upgrade0_9_16_007() |
1067 | 1067 | { |
1068 | 1068 | // update the sequenzes for refreshed tables (postgres only) |
1069 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
1069 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
1070 | 1070 | |
1071 | 1071 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
1072 | 1072 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1076,19 +1076,19 @@ discard block |
||
1076 | 1076 | |
1077 | 1077 | function calendar_upgrade1_0_0() |
1078 | 1078 | { |
1079 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
1091 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
1079 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
1091 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
1092 | 1092 | |
1093 | 1093 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
1094 | 1094 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1098,13 +1098,13 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | function calendar_upgrade1_0_0_001() |
1100 | 1100 | { |
1101 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
1107 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
1101 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
1107 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
1108 | 1108 | |
1109 | 1109 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
1110 | 1110 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1114,8 +1114,8 @@ discard block |
||
1114 | 1114 | |
1115 | 1115 | function calendar_upgrade1_0_0_002() |
1116 | 1116 | { |
1117 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
1118 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
1117 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
1118 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
1119 | 1119 | |
1120 | 1120 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
1121 | 1121 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | function calendar_upgrade1_0_0_003() |
1127 | 1127 | { |
1128 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
1128 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
1129 | 1129 | 'type' => 'varchar', |
1130 | 1130 | 'precision' => '255', |
1131 | 1131 | 'nullable' => False, |
@@ -1140,15 +1140,15 @@ discard block |
||
1140 | 1140 | |
1141 | 1141 | function calendar_upgrade1_0_0_004() |
1142 | 1142 | { |
1143 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
1143 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
1144 | 1144 | 'fd' => array( |
1145 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1146 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1147 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1148 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1149 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1150 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1151 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1145 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1146 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1147 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1148 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1149 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1150 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1151 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1152 | 1152 | ), |
1153 | 1153 | 'pk' => array('cal_id'), |
1154 | 1154 | 'fk' => array(), |
@@ -1165,19 +1165,19 @@ discard block |
||
1165 | 1165 | function calendar_upgrade1_0_0_005() |
1166 | 1166 | { |
1167 | 1167 | // change prefix of all calendar tables to egw_ |
1168 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
1168 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
1169 | 1169 | { |
1170 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
1170 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | // create new dates table, with content from the egw_cal table |
1174 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
1174 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
1175 | 1175 | 'fd' => array( |
1176 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1177 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1178 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
1176 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1177 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1178 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
1179 | 1179 | ), |
1180 | - 'pk' => array('cal_id','cal_start'), |
|
1180 | + 'pk' => array('cal_id', 'cal_start'), |
|
1181 | 1181 | 'fk' => array(), |
1182 | 1182 | 'ix' => array(), |
1183 | 1183 | 'uc' => array() |
@@ -1185,49 +1185,49 @@ discard block |
||
1185 | 1185 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
1186 | 1186 | |
1187 | 1187 | // drop the fields transfered to the dates table |
1188 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1188 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1189 | 1189 | 'fd' => array( |
1190 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1191 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1192 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1193 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1194 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1195 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1196 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
1197 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1198 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1199 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1200 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1190 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1191 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1192 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1193 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1194 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1195 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1196 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
1197 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1198 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1199 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1200 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1201 | 1201 | 'cal_description' => array('type' => 'text'), |
1202 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1203 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1202 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1203 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1204 | 1204 | ), |
1205 | 1205 | 'pk' => array('cal_id'), |
1206 | 1206 | 'fk' => array(), |
1207 | 1207 | 'ix' => array(), |
1208 | 1208 | 'uc' => array() |
1209 | - ),'cal_starttime'); |
|
1210 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1209 | + ), 'cal_starttime'); |
|
1210 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1211 | 1211 | 'fd' => array( |
1212 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1213 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1214 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1215 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1216 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1217 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1218 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1219 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
1220 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1221 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1212 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1213 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1214 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1215 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1216 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1217 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1218 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1219 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
1220 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1221 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1222 | 1222 | 'cal_description' => array('type' => 'text'), |
1223 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1224 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1223 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1224 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1225 | 1225 | ), |
1226 | 1226 | 'pk' => array('cal_id'), |
1227 | 1227 | 'fk' => array(), |
1228 | 1228 | 'ix' => array(), |
1229 | 1229 | 'uc' => array() |
1230 | - ),'cal_endtime'); |
|
1230 | + ), 'cal_endtime'); |
|
1231 | 1231 | |
1232 | 1232 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
1233 | 1233 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1243,15 +1243,15 @@ discard block |
||
1243 | 1243 | 'precision' => '8', |
1244 | 1244 | 'default' => '0' |
1245 | 1245 | ));*/ |
1246 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
1246 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
1247 | 1247 | 'fd' => array( |
1248 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1249 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
1250 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
1251 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
1252 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
1248 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1249 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
1250 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
1251 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
1252 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
1253 | 1253 | ), |
1254 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
1254 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
1255 | 1255 | 'fk' => array(), |
1256 | 1256 | 'ix' => array(), |
1257 | 1257 | 'uc' => array() |
@@ -1265,50 +1265,50 @@ discard block |
||
1265 | 1265 | |
1266 | 1266 | function calendar_upgrade1_0_1_002() |
1267 | 1267 | { |
1268 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1268 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1269 | 1269 | 'fd' => array( |
1270 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1271 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1272 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1273 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1274 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
1275 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1276 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
1277 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
1278 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1270 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1271 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1272 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1273 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1274 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
1275 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1276 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
1277 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
1278 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1279 | 1279 | 'cal_description' => array('type' => 'text'), |
1280 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1281 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
1280 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1281 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
1282 | 1282 | ), |
1283 | 1283 | 'pk' => array('cal_id'), |
1284 | 1284 | 'fk' => array(), |
1285 | 1285 | 'ix' => array(), |
1286 | 1286 | 'uc' => array() |
1287 | - ),'cal_type'); |
|
1288 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
1287 | + ), 'cal_type'); |
|
1288 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
1289 | 1289 | 'type' => 'int', |
1290 | 1290 | 'precision' => '4', |
1291 | 1291 | 'nullable' => False |
1292 | 1292 | )); |
1293 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
1293 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
1294 | 1294 | 'type' => 'int', |
1295 | 1295 | 'precision' => '2', |
1296 | 1296 | 'nullable' => False, |
1297 | 1297 | 'default' => '2' |
1298 | 1298 | )); |
1299 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
1299 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
1300 | 1300 | 'type' => 'int', |
1301 | 1301 | 'precision' => '2', |
1302 | 1302 | 'nullable' => False, |
1303 | 1303 | 'default' => '1' |
1304 | 1304 | )); |
1305 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
1305 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
1306 | 1306 | 'type' => 'int', |
1307 | 1307 | 'precision' => '4', |
1308 | 1308 | 'nullable' => False, |
1309 | 1309 | 'default' => '0' |
1310 | 1310 | )); |
1311 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
1311 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
1312 | 1312 | 'type' => 'int', |
1313 | 1313 | 'precision' => '4' |
1314 | 1314 | )); |
@@ -1321,36 +1321,36 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | function calendar_upgrade1_0_1_003() |
1323 | 1323 | { |
1324 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
1324 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
1325 | 1325 | 'fd' => array( |
1326 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1327 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
1328 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
1329 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1330 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
1331 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
1326 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1327 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
1328 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
1329 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1330 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
1331 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
1332 | 1332 | ), |
1333 | 1333 | 'pk' => array('cal_id'), |
1334 | 1334 | 'fk' => array(), |
1335 | 1335 | 'ix' => array(), |
1336 | 1336 | 'uc' => array() |
1337 | - ),'recur_use_end'); |
|
1338 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
1337 | + ), 'recur_use_end'); |
|
1338 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
1339 | 1339 | 'type' => 'int', |
1340 | 1340 | 'precision' => '4', |
1341 | 1341 | 'nullable' => False |
1342 | 1342 | )); |
1343 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
1343 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
1344 | 1344 | 'type' => 'int', |
1345 | 1345 | 'precision' => '2', |
1346 | 1346 | 'nullable' => False |
1347 | 1347 | )); |
1348 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
1348 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
1349 | 1349 | 'type' => 'int', |
1350 | 1350 | 'precision' => '2', |
1351 | 1351 | 'default' => '1' |
1352 | 1352 | )); |
1353 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
1353 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
1354 | 1354 | 'type' => 'int', |
1355 | 1355 | 'precision' => '2', |
1356 | 1356 | 'default' => '1' |
@@ -1364,13 +1364,13 @@ discard block |
||
1364 | 1364 | |
1365 | 1365 | function calendar_upgrade1_0_1_004() |
1366 | 1366 | { |
1367 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1367 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1368 | 1368 | 'type' => 'int', |
1369 | 1369 | 'precision' => '4', |
1370 | 1370 | 'nullable' => False, |
1371 | 1371 | 'default' => '0' |
1372 | 1372 | )); |
1373 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1373 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1374 | 1374 | 'type' => 'int', |
1375 | 1375 | 'precision' => '4', |
1376 | 1376 | 'nullable' => False, |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | |
1386 | 1386 | function calendar_upgrade1_0_1_005() |
1387 | 1387 | { |
1388 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
1388 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
1389 | 1389 | 'type' => 'int', |
1390 | 1390 | 'precision' => '4', |
1391 | 1391 | 'default' => '1' |
@@ -1399,7 +1399,7 @@ discard block |
||
1399 | 1399 | |
1400 | 1400 | function calendar_upgrade1_0_1_006() |
1401 | 1401 | { |
1402 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
1402 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
1403 | 1403 | 'type' => 'int', |
1404 | 1404 | 'precision' => '2', |
1405 | 1405 | 'default' => '0' |
@@ -1413,9 +1413,9 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | function calendar_upgrade1_0_1_007() |
1415 | 1415 | { |
1416 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
1416 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
1417 | 1417 | |
1418 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
1418 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
1419 | 1419 | 'type' => 'text' |
1420 | 1420 | )); |
1421 | 1421 | |
@@ -1432,11 +1432,11 @@ discard block |
||
1432 | 1432 | { |
1433 | 1433 | $customfields = array(); |
1434 | 1434 | $order = 0; |
1435 | - foreach($config_data['fields'] as $name => $data) |
|
1435 | + foreach ($config_data['fields'] as $name => $data) |
|
1436 | 1436 | { |
1437 | 1437 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
1438 | 1438 | { |
1439 | - $customfields[substr($name,1)] = array( |
|
1439 | + $customfields[substr($name, 1)] = array( |
|
1440 | 1440 | 'type' => 'text', |
1441 | 1441 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
1442 | 1442 | 'label' => $data['name'], |
@@ -1459,38 +1459,38 @@ discard block |
||
1459 | 1459 | function calendar_upgrade1_0_1_009() |
1460 | 1460 | { |
1461 | 1461 | $db2 = clone($GLOBALS['egw_setup']->db); |
1462 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
1463 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1464 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1462 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
1463 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
1464 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
1465 | 1465 | { |
1466 | 1466 | $row['cal_user_type'] = 'u'; |
1467 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
1467 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
1468 | 1468 | { |
1469 | 1469 | $row['cal_user_id'] = $group; |
1470 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
1470 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
1471 | 1471 | } |
1472 | 1472 | } |
1473 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1473 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1474 | 1474 | 'fd' => array( |
1475 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1476 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1477 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1478 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1479 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1480 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1481 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1482 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1475 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1476 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1477 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1478 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1479 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1480 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1481 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1482 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1483 | 1483 | 'cal_description' => array('type' => 'text'), |
1484 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1485 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1486 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1487 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
1484 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1485 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1486 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1487 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
1488 | 1488 | ), |
1489 | 1489 | 'pk' => array('cal_id'), |
1490 | 1490 | 'fk' => array(), |
1491 | 1491 | 'ix' => array(), |
1492 | 1492 | 'uc' => array() |
1493 | - ),'cal_groups'); |
|
1493 | + ), 'cal_groups'); |
|
1494 | 1494 | |
1495 | 1495 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
1496 | 1496 | } |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | function calendar_upgrade1_2() |
1501 | 1501 | { |
1502 | 1502 | // get old alarms (saved before 1.2) working again |
1503 | - $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'",__LINE__,__FILE__); |
|
1503 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
1504 | 1504 | |
1505 | 1505 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
1506 | 1506 | } |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | |
1509 | 1509 | function calendar_upgrade1_2_001() |
1510 | 1510 | { |
1511 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
1511 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
1512 | 1512 | 'type' => 'int', |
1513 | 1513 | 'precision' => '2', |
1514 | 1514 | 'default' => '0' |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | |
1527 | 1527 | function calendar_upgrade1_4() |
1528 | 1528 | { |
1529 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
1529 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
1530 | 1530 | 'type' => 'int', |
1531 | 1531 | 'precision' => '4', |
1532 | 1532 | 'default' => '0' |
@@ -1538,59 +1538,59 @@ discard block |
||
1538 | 1538 | |
1539 | 1539 | function calendar_upgrade1_5() |
1540 | 1540 | { |
1541 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1541 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1542 | 1542 | 'fd' => array( |
1543 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1544 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1545 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1546 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1547 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1548 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1549 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1550 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1543 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1544 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1545 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1546 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1547 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1548 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1549 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1550 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1551 | 1551 | 'cal_description' => array('type' => 'text'), |
1552 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1553 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1554 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1555 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1556 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1557 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
1558 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
1552 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1553 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1554 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1555 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1556 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1557 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
1558 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
1559 | 1559 | ), |
1560 | 1560 | 'pk' => array('cal_id'), |
1561 | 1561 | 'fk' => array(), |
1562 | 1562 | 'ix' => array(), |
1563 | 1563 | 'uc' => array() |
1564 | - ),'cal_edit_user'); |
|
1565 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
1564 | + ), 'cal_edit_user'); |
|
1565 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
1566 | 1566 | 'fd' => array( |
1567 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
1568 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
1569 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
1570 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
1571 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
1572 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
1573 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
1574 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
1567 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
1568 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
1569 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
1570 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
1571 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
1572 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
1573 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
1574 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
1575 | 1575 | 'cal_description' => array('type' => 'text'), |
1576 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
1577 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
1578 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
1579 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1580 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
1581 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
1576 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
1577 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
1578 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
1579 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1580 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
1581 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
1582 | 1582 | ), |
1583 | 1583 | 'pk' => array('cal_id'), |
1584 | 1584 | 'fk' => array(), |
1585 | 1585 | 'ix' => array(), |
1586 | 1586 | 'uc' => array() |
1587 | - ),'cal_edit_time'); |
|
1588 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
1587 | + ), 'cal_edit_time'); |
|
1588 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
1589 | 1589 | 'type' => 'int', |
1590 | 1590 | 'precision' => '4', |
1591 | 1591 | 'default' => '0' |
1592 | 1592 | )); |
1593 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
1593 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
1594 | 1594 | |
1595 | 1595 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
1596 | 1596 | } |
@@ -1598,12 +1598,12 @@ discard block |
||
1598 | 1598 | |
1599 | 1599 | function calendar_upgrade1_5_001() |
1600 | 1600 | { |
1601 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
1601 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
1602 | 1602 | 'type' => 'int', |
1603 | 1603 | 'precision' => '4', |
1604 | 1604 | 'nullable' => False |
1605 | 1605 | )); |
1606 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1606 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1607 | 1607 | 'type' => 'varchar', |
1608 | 1608 | 'precision' => '128', |
1609 | 1609 | 'nullable' => False |
@@ -1617,12 +1617,12 @@ discard block |
||
1617 | 1617 | { |
1618 | 1618 | // update the alarm methods |
1619 | 1619 | $async = new Api\Asyncservice(); |
1620 | - foreach((array)$async->read('cal:%') as $job) |
|
1620 | + foreach ((array)$async->read('cal:%') as $job) |
|
1621 | 1621 | { |
1622 | 1622 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
1623 | 1623 | { |
1624 | 1624 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
1625 | - $async->write($job,true); |
|
1625 | + $async->write($job, true); |
|
1626 | 1626 | } |
1627 | 1627 | } |
1628 | 1628 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1639,48 +1639,48 @@ discard block |
||
1639 | 1639 | { |
1640 | 1640 | // Set UID of series exception to UID of series master |
1641 | 1641 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1642 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1642 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1643 | 1643 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1644 | 1644 | FROM egw_cal cal_ex |
1645 | 1645 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1646 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1646 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1647 | 1647 | { |
1648 | 1648 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1649 | 1649 | { |
1650 | 1650 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1651 | 1651 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1652 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1652 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1653 | 1653 | } |
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
1657 | 1657 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
1658 | 1658 | $diff = null; |
1659 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1659 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
1660 | 1660 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
1661 | 1661 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
1662 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1662 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1663 | 1663 | { |
1664 | 1664 | $recurrence = null; |
1665 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
1665 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
1666 | 1666 | { |
1667 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
1667 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
1668 | 1668 | { |
1669 | 1669 | $recurrence = $ts; |
1670 | - $diff = abs($ts-$row['cal_start']); |
|
1670 | + $diff = abs($ts - $row['cal_start']); |
|
1671 | 1671 | } |
1672 | 1672 | } |
1673 | 1673 | if ($recurrence) |
1674 | 1674 | { |
1675 | 1675 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
1676 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1676 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1677 | 1677 | } |
1678 | 1678 | else |
1679 | 1679 | { |
1680 | 1680 | // if we cannot determine the RECURRENCE-ID use cal_start |
1681 | 1681 | // because RECURRENCE-ID must be present |
1682 | 1682 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
1683 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1683 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1684 | 1684 | } |
1685 | 1685 | } |
1686 | 1686 | |
@@ -1695,33 +1695,33 @@ discard block |
||
1695 | 1695 | */ |
1696 | 1696 | function calendar_upgrade1_6_003() |
1697 | 1697 | { |
1698 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
1698 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
1699 | 1699 | 'type' => 'int', |
1700 | 1700 | 'precision' => '4', |
1701 | 1701 | 'comment' => 'creating user' |
1702 | 1702 | )); |
1703 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
1704 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
1703 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
1704 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
1705 | 1705 | 'type' => 'int', |
1706 | 1706 | 'precision' => '4', |
1707 | 1707 | 'nullable' => False, |
1708 | 1708 | 'comment' => 'creating user' |
1709 | 1709 | )); |
1710 | 1710 | |
1711 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
1711 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
1712 | 1712 | 'type' => 'int', |
1713 | 1713 | 'precision' => '8', |
1714 | 1714 | 'comment' => 'creation time of event' |
1715 | 1715 | )); |
1716 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
1717 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
1716 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
1717 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
1718 | 1718 | 'type' => 'int', |
1719 | 1719 | 'precision' => '8', |
1720 | 1720 | 'nullable' => False, |
1721 | 1721 | 'comment' => 'creation time of event' |
1722 | 1722 | )); |
1723 | 1723 | |
1724 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
1724 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
1725 | 1725 | 'type' => 'int', |
1726 | 1726 | 'precision' => '8', |
1727 | 1727 | 'nullable' => False, |
@@ -1732,14 +1732,14 @@ discard block |
||
1732 | 1732 | // move RECURRENCE-ID from temporarily (1.6.003) |
1733 | 1733 | // used field cal_reference to new field cal_recurrence |
1734 | 1734 | // and restore cal_reference field of series exceptions with id of the series master |
1735 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1735 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1736 | 1736 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
1737 | 1737 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
1738 | 1738 | cal_master.cal_uid AS cal_uid_master |
1739 | 1739 | FROM egw_cal cal_ex |
1740 | 1740 | JOIN egw_cal cal_master |
1741 | 1741 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
1742 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
1742 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
1743 | 1743 | { |
1744 | 1744 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
1745 | 1745 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | */ |
1757 | 1757 | function calendar_upgrade1_7_001() |
1758 | 1758 | { |
1759 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
1759 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
1760 | 1760 | 'type' => 'varchar', |
1761 | 1761 | 'precision' => '64', |
1762 | 1762 | 'default' => 'REQ-PARTICIPANT' |
@@ -1772,14 +1772,14 @@ discard block |
||
1772 | 1772 | */ |
1773 | 1773 | function calendar_upgrade1_7_002() |
1774 | 1774 | { |
1775 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
1775 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
1776 | 1776 | 'fd' => array( |
1777 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
1778 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
1779 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
1780 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
1781 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
1782 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
1777 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
1778 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
1779 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
1780 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
1781 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
1782 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
1783 | 1783 | ), |
1784 | 1784 | 'pk' => array('tz_id'), |
1785 | 1785 | 'fk' => array(), |
@@ -1799,38 +1799,38 @@ discard block |
||
1799 | 1799 | */ |
1800 | 1800 | function calendar_upgrade1_7_003() |
1801 | 1801 | { |
1802 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
1802 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
1803 | 1803 | 'type' => 'varchar', |
1804 | 1804 | 'precision' => '1', |
1805 | 1805 | 'nullable' => False, |
1806 | 1806 | 'default' => 'u', |
1807 | 1807 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
1808 | 1808 | )); |
1809 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
1809 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
1810 | 1810 | 'type' => 'varchar', |
1811 | 1811 | 'precision' => '128', |
1812 | 1812 | 'nullable' => False, |
1813 | 1813 | 'comment' => 'id or email-address for type=e' |
1814 | 1814 | )); |
1815 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
1815 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
1816 | 1816 | 'type' => 'char', |
1817 | 1817 | 'precision' => '1', |
1818 | 1818 | 'default' => 'A', |
1819 | 1819 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
1820 | 1820 | )); |
1821 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
1821 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
1822 | 1822 | 'type' => 'int', |
1823 | 1823 | 'precision' => '4', |
1824 | 1824 | 'default' => '1', |
1825 | 1825 | 'comment' => 'only for certain types (eg. resources)' |
1826 | 1826 | )); |
1827 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
1827 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
1828 | 1828 | 'type' => 'varchar', |
1829 | 1829 | 'precision' => '64', |
1830 | 1830 | 'default' => 'REQ-PARTICIPANT', |
1831 | 1831 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
1832 | 1832 | )); |
1833 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
1833 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
1834 | 1834 | 'type' => 'timestamp', |
1835 | 1835 | 'default' => 'current_timestamp', |
1836 | 1836 | 'comment' => 'automatic timestamp of last update' |
@@ -1846,19 +1846,19 @@ discard block |
||
1846 | 1846 | */ |
1847 | 1847 | function calendar_upgrade1_7_004() |
1848 | 1848 | { |
1849 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
1849 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
1850 | 1850 | 'type' => 'int', |
1851 | 1851 | 'precision' => '8', |
1852 | 1852 | 'nullable' => False, |
1853 | 1853 | 'comment' => 'starttime in server time' |
1854 | 1854 | )); |
1855 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
1855 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
1856 | 1856 | 'type' => 'int', |
1857 | 1857 | 'precision' => '8', |
1858 | 1858 | 'nullable' => False, |
1859 | 1859 | 'comment' => 'endtime in server time' |
1860 | 1860 | )); |
1861 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
1861 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
1862 | 1862 | 'type' => 'int', |
1863 | 1863 | 'precision' => '4', |
1864 | 1864 | 'comment' => 'key into egw_cal_timezones' |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
1868 | 1868 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
1869 | 1869 | { |
1870 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
1870 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
1871 | 1871 | } |
1872 | 1872 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
1873 | 1873 | } |
@@ -1894,22 +1894,22 @@ discard block |
||
1894 | 1894 | */ |
1895 | 1895 | function calendar_upgrade1_7_006() |
1896 | 1896 | { |
1897 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1898 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
1897 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1898 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
1899 | 1899 | { |
1900 | 1900 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
1901 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1901 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1902 | 1902 | } |
1903 | 1903 | |
1904 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1905 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
1904 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
1905 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
1906 | 1906 | { |
1907 | 1907 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
1908 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
1908 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
1909 | 1909 | } |
1910 | 1910 | |
1911 | 1911 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
1912 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
1912 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
1913 | 1913 | |
1914 | 1914 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
1915 | 1915 | } |
@@ -1925,17 +1925,17 @@ discard block |
||
1925 | 1925 | { |
1926 | 1926 | // Set UID of series exception to UID of series master |
1927 | 1927 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
1928 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
1928 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
1929 | 1929 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
1930 | 1930 | FROM egw_cal cal_ex |
1931 | 1931 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
1932 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
1932 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
1933 | 1933 | { |
1934 | 1934 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
1935 | 1935 | { |
1936 | 1936 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
1937 | 1937 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
1938 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
1938 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
1939 | 1939 | } |
1940 | 1940 | } |
1941 | 1941 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1948,7 +1948,7 @@ discard block |
||
1948 | 1948 | */ |
1949 | 1949 | function calendar_upgrade1_7_008() |
1950 | 1950 | { |
1951 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
1951 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
1952 | 1952 | |
1953 | 1953 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
1954 | 1954 | } |
@@ -1960,22 +1960,22 @@ discard block |
||
1960 | 1960 | */ |
1961 | 1961 | function calendar_upgrade1_7_009() |
1962 | 1962 | { |
1963 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
1964 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
1963 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
1964 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
1965 | 1965 | |
1966 | 1966 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | function calendar_upgrade1_7_010() |
1970 | 1970 | { |
1971 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
1971 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
1972 | 1972 | 'type' => 'bool', |
1973 | 1973 | 'nullable' => False, |
1974 | 1974 | 'default' => '0', |
1975 | 1975 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
1976 | 1976 | )); |
1977 | 1977 | |
1978 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1978 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | function calendar_upgrade1_7_011() |
@@ -2005,36 +2005,36 @@ discard block |
||
2005 | 2005 | 'precision' => '8', |
2006 | 2006 | 'comment' => 'ts when event was deleted' |
2007 | 2007 | ));*/ |
2008 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
2008 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
2009 | 2009 | 'fd' => array( |
2010 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
2011 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
2012 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
2013 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
2014 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
2015 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
2016 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
2017 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
2010 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
2011 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
2012 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
2013 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
2014 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
2015 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
2016 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
2017 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
2018 | 2018 | 'cal_description' => array('type' => 'text'), |
2019 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
2020 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
2021 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
2022 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
2023 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
2024 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
2025 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
2026 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
2027 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
2028 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
2029 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
2019 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
2020 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
2021 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
2022 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
2023 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
2024 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
2025 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
2026 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
2027 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
2028 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
2029 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
2030 | 2030 | ), |
2031 | 2031 | 'pk' => array('cal_id'), |
2032 | 2032 | 'fk' => array(), |
2033 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
2033 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
2034 | 2034 | 'uc' => array() |
2035 | - ),array( |
|
2035 | + ), array( |
|
2036 | 2036 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
2037 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
2037 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
2038 | 2038 | )); |
2039 | 2039 | |
2040 | 2040 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2046,16 +2046,16 @@ discard block |
||
2046 | 2046 | */ |
2047 | 2047 | function calendar_upgrade1_9_002() |
2048 | 2048 | { |
2049 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
2049 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
2050 | 2050 | 'type' => 'varchar', |
2051 | 2051 | 'precision' => '64', |
2052 | 2052 | 'comment' => 'name part of CalDAV URL, if specified by client' |
2053 | 2053 | )); |
2054 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
2054 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
2055 | 2055 | $GLOBALS['egw_setup']->db->concat( |
2056 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
2056 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
2057 | 2057 | |
2058 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
2058 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
2059 | 2059 | |
2060 | 2060 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
2061 | 2061 | } |
@@ -2066,8 +2066,8 @@ discard block |
||
2066 | 2066 | */ |
2067 | 2067 | function calendar_upgrade1_9_003() |
2068 | 2068 | { |
2069 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
2070 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
2069 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
2070 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
2071 | 2071 | |
2072 | 2072 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
2073 | 2073 | } |
@@ -2079,7 +2079,7 @@ discard block |
||
2079 | 2079 | */ |
2080 | 2080 | function calendar_upgrade1_9_004() |
2081 | 2081 | { |
2082 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
2082 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
2083 | 2083 | 'type' => 'bool', |
2084 | 2084 | 'default' => '', |
2085 | 2085 | 'null' => false, |
@@ -2087,16 +2087,16 @@ discard block |
||
2087 | 2087 | )); |
2088 | 2088 | |
2089 | 2089 | // migrate existing exceptions to egw_cal_dates |
2090 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2090 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
2091 | 2091 | 'egw_cal_repeats.cal_id AS cal_id,egw_cal_repeats.recur_exception AS recur_exception,MIN(cal_start) AS cal_start,MIN(cal_end) AS cal_end', |
2092 | 2092 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
2093 | 2093 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
2094 | 2094 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
2095 | 2095 | { |
2096 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2096 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
2097 | 2097 | { |
2098 | 2098 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
2099 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
2099 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
2100 | 2100 | 'recur_exception' => true, |
2101 | 2101 | ), array( |
2102 | 2102 | 'cal_id' => $row['cal_id'], |
@@ -2108,11 +2108,11 @@ discard block |
||
2108 | 2108 | |
2109 | 2109 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
2110 | 2110 | 'fd' => array( |
2111 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2112 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2113 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
2114 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2115 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2111 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2112 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2113 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
2114 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2115 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2116 | 2116 | ), |
2117 | 2117 | 'pk' => array('cal_id'), |
2118 | 2118 | 'fk' => array(), |
@@ -2133,19 +2133,19 @@ discard block |
||
2133 | 2133 | // returns NULL, if there are no rows! |
2134 | 2134 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
2135 | 2135 | { |
2136 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
2136 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
2137 | 2137 | 'type' => 'varchar', |
2138 | 2138 | 'precision' => '16384' |
2139 | 2139 | )); |
2140 | 2140 | } |
2141 | 2141 | // allow more categories |
2142 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2142 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2143 | 2143 | 'type' => 'varchar', |
2144 | 2144 | 'precision' => '64', |
2145 | 2145 | 'comment' => 'category id(s)' |
2146 | 2146 | )); |
2147 | 2147 | // remove silly default of 1 |
2148 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
2148 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
2149 | 2149 | 'type' => 'varchar', |
2150 | 2150 | 'precision' => '255', |
2151 | 2151 | 'nullable' => False |
@@ -2160,14 +2160,14 @@ discard block |
||
2160 | 2160 | { |
2161 | 2161 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
2162 | 2162 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
2163 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
2163 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
2164 | 2164 | 'type' => 'int', |
2165 | 2165 | 'precision' => '8', |
2166 | 2166 | 'comment' => 'startdate (of range)' |
2167 | 2167 | )); |
2168 | 2168 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_start = (SELECT MIN(cal_start) FROM egw_cal_dates WHERE egw_cal_dates.cal_id=egw_cal.cal_id)', __LINE__, __FILE__); |
2169 | 2169 | |
2170 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
2170 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
2171 | 2171 | 'type' => 'int', |
2172 | 2172 | 'precision' => '8', |
2173 | 2173 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2183,18 +2183,18 @@ discard block |
||
2183 | 2183 | { |
2184 | 2184 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET range_end=recur_enddate FROM egw_cal_repeats WHERE egw_cal.cal_id=egw_cal_repeats.cal_id', __LINE__, __FILE__); |
2185 | 2185 | } |
2186 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
2186 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
2187 | 2187 | 'fd' => array( |
2188 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2189 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
2190 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
2191 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
2188 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2189 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
2190 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
2191 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
2192 | 2192 | ), |
2193 | 2193 | 'pk' => array('cal_id'), |
2194 | 2194 | 'fk' => array(), |
2195 | 2195 | 'ix' => array(), |
2196 | 2196 | 'uc' => array() |
2197 | - ),'recur_enddate'); |
|
2197 | + ), 'recur_enddate'); |
|
2198 | 2198 | |
2199 | 2199 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
2200 | 2200 | } |
@@ -2206,14 +2206,14 @@ discard block |
||
2206 | 2206 | */ |
2207 | 2207 | function calendar_upgrade1_9_007() |
2208 | 2208 | { |
2209 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
2209 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
2210 | 2210 | { |
2211 | 2211 | $GLOBALS['egw_setup']->db->query("DELETE FROM $table WHERE cal_id IN (SELECT cal_id FROM egw_cal WHERE range_start=0 OR range_start IS NULL)", __LINE__, __FILE__); |
2212 | 2212 | } |
2213 | 2213 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
2214 | 2214 | |
2215 | 2215 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
2216 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
2216 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
2217 | 2217 | 'type' => 'int', |
2218 | 2218 | 'precision' => '8', |
2219 | 2219 | 'nullable' => False, |
@@ -2278,7 +2278,7 @@ discard block |
||
2278 | 2278 | |
2279 | 2279 | function calendar_upgrade1_9_010() |
2280 | 2280 | { |
2281 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2281 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2282 | 2282 | 'type' => 'varchar', |
2283 | 2283 | 'precision' => '200', |
2284 | 2284 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2308,7 +2308,7 @@ discard block |
||
2308 | 2308 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
2309 | 2309 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
2310 | 2310 | |
2311 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2311 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2312 | 2312 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
2313 | 2313 | FROM egw_cal_user |
2314 | 2314 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2335,7 +2335,7 @@ discard block |
||
2335 | 2335 | */ |
2336 | 2336 | function calendar_upgrade14_1_001() |
2337 | 2337 | { |
2338 | - foreach($GLOBALS['egw_setup']->db->query( |
|
2338 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
2339 | 2339 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
2340 | 2340 | FROM egw_cal |
2341 | 2341 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2363,7 +2363,7 @@ discard block |
||
2363 | 2363 | $enddate->modify(($event['end'] - $event['start']).' second'); |
2364 | 2364 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
2365 | 2365 | { |
2366 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
2366 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
2367 | 2367 | 'range_end' => $range_end, |
2368 | 2368 | 'cal_etag=cal_etag+1', |
2369 | 2369 | 'cal_modified' => time(), |
@@ -2373,7 +2373,7 @@ discard block |
||
2373 | 2373 | //error_log(__FUNCTION__."() #$event[id], start=".date('Y-m-d H:i:s', $event['start']).', end='.date('Y-m-d H:i:s', $event['end']).', range_end='.date('Y-m-d H:i:s', $event['recur_enddate']).' --> '.date('Y-m-d H:i:s', $range_end)); |
2374 | 2374 | } |
2375 | 2375 | } |
2376 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2376 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
2377 | 2377 | } |
2378 | 2378 | |
2379 | 2379 | /** |
@@ -2397,7 +2397,7 @@ discard block |
||
2397 | 2397 | // if maximum is bigger then 3 |
2398 | 2398 | if ($values[1] > 3) |
2399 | 2399 | { |
2400 | - switch($GLOBALS['egw_setup']->db->Type) |
|
2400 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
2401 | 2401 | { |
2402 | 2402 | case 'mysql': |
2403 | 2403 | $sql = "UPDATE egw_cal |
@@ -2442,7 +2442,7 @@ discard block |
||
2442 | 2442 | |
2443 | 2443 | function calendar_upgrade14_2_003() |
2444 | 2444 | { |
2445 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
2445 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
2446 | 2446 | 'type' => 'ascii', |
2447 | 2447 | 'precision' => '128', |
2448 | 2448 | 'nullable' => False, |
@@ -2454,13 +2454,13 @@ discard block |
||
2454 | 2454 | { |
2455 | 2455 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
2456 | 2456 | } |
2457 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
2457 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
2458 | 2458 | 'type' => 'ascii', |
2459 | 2459 | 'meta' => 'category', |
2460 | 2460 | 'precision' => '64', |
2461 | 2461 | 'comment' => 'category id(s)' |
2462 | 2462 | )); |
2463 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
2463 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
2464 | 2464 | 'type' => 'ascii', |
2465 | 2465 | 'precision' => '128', |
2466 | 2466 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2517,22 +2517,22 @@ discard block |
||
2517 | 2517 | 'type' => 'auto', |
2518 | 2518 | 'nullable' => False |
2519 | 2519 | ));*/ |
2520 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
2520 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
2521 | 2521 | 'fd' => array( |
2522 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
2523 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
2524 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2525 | - 'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'), |
|
2526 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2527 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
2528 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2529 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
2530 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
2522 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
2523 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
2524 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
2525 | + 'cal_user_id' => array('type' => 'varchar', 'meta' => array("cal_user_type='u'" => 'account'), 'precision' => '128', 'nullable' => False, 'comment' => 'id or email-address for type=e'), |
|
2526 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
2527 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
2528 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
2529 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
2530 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
2531 | 2531 | ), |
2532 | 2532 | 'pk' => array('cal_user_auto'), |
2533 | 2533 | 'fk' => array(), |
2534 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
2535 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
2534 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
2535 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
2536 | 2536 | )); |
2537 | 2537 | |
2538 | 2538 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2541,12 +2541,12 @@ discard block |
||
2541 | 2541 | |
2542 | 2542 | function calendar_upgrade14_2_005() |
2543 | 2543 | { |
2544 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
2544 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
2545 | 2545 | 'type' => 'ascii', |
2546 | 2546 | 'precision' => '128', |
2547 | 2547 | 'nullable' => False |
2548 | 2548 | )); |
2549 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
2549 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
2550 | 2550 | 'type' => 'ascii', |
2551 | 2551 | 'precision' => '8192', |
2552 | 2552 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | */ |
2563 | 2563 | function calendar_upgrade14_3() |
2564 | 2564 | { |
2565 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
2565 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
2566 | 2566 | 'type' => 'varchar', |
2567 | 2567 | 'precision' => '255', |
2568 | 2568 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2573,12 +2573,12 @@ discard block |
||
2573 | 2573 | |
2574 | 2574 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
2575 | 2575 | // by ordering by status we prever accepted over tentative over unknow over deleted |
2576 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2576 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
2577 | 2577 | 'cal_user_type' => 'e', |
2578 | 2578 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
2579 | 2579 | { |
2580 | 2580 | $n = 0; |
2581 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2581 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
2582 | 2582 | 'cal_id' => $row['cal_id'], |
2583 | 2583 | 'cal_recur_date' => $row['cal_recur_date'], |
2584 | 2584 | 'cal_user_type' => 'e', |
@@ -2587,7 +2587,7 @@ discard block |
||
2587 | 2587 | { |
2588 | 2588 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2589 | 2589 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
2590 | - array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
|
2590 | + array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status'))), |
|
2591 | 2591 | __LINE__, __FILE__, 'calendar'); |
2592 | 2592 | } |
2593 | 2593 | } |
@@ -2597,7 +2597,7 @@ discard block |
||
2597 | 2597 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
2598 | 2598 | __LINE__, __FILE__); |
2599 | 2599 | |
2600 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
2600 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
2601 | 2601 | 'type' => 'ascii', |
2602 | 2602 | 'meta' => array( |
2603 | 2603 | "cal_user_type='u'" => 'account' |
@@ -2619,7 +2619,7 @@ discard block |
||
2619 | 2619 | { |
2620 | 2620 | $GLOBALS['calendar_upgrade14_3_001-run'] = true; |
2621 | 2621 | |
2622 | - foreach($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2622 | + foreach ($GLOBALS['egw_setup']->db->query("SELECT egw_cal_user.cal_id AS cal_id,egw_cal_user.cal_user_id AS cal_user_id,egw_cal_user.cal_user_attendee AS cal_user_attendee |
|
2623 | 2623 | FROM egw_cal_user |
2624 | 2624 | JOIN egw_cal_user euser ON euser.cal_id=egw_cal_user.cal_id AND euser.cal_user_type='e' AND euser.cal_user_id=egw_cal_user.cal_user_id AND euser.cal_user_attendee IS NULL |
2625 | 2625 | WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL |
@@ -2670,8 +2670,8 @@ discard block |
||
2670 | 2670 | { |
2671 | 2671 | Api\Preferences::change_preference('calendar', '/^favorite_/', function($attr, $old_value, $owner) |
2672 | 2672 | { |
2673 | - unset($attr, $owner); // not used, but required by function signature |
|
2674 | - if($old_value['state'] && is_array($old_value['state'])) |
|
2673 | + unset($attr, $owner); // not used, but required by function signature |
|
2674 | + if ($old_value['state'] && is_array($old_value['state'])) |
|
2675 | 2675 | { |
2676 | 2676 | unset($old_value['state']['date']); |
2677 | 2677 | unset($old_value['state']['startdate']); |
@@ -2691,15 +2691,15 @@ discard block |
||
2691 | 2691 | { |
2692 | 2692 | Api\Preferences::change_preference('calendar', 'use_time_grid', function($attr, $old_value, $owner) |
2693 | 2693 | { |
2694 | - unset($attr, $owner); // not used, but required by function signature |
|
2695 | - switch($old_value) |
|
2694 | + unset($attr, $owner); // not used, but required by function signature |
|
2695 | + switch ($old_value) |
|
2696 | 2696 | { |
2697 | 2697 | case 'all': |
2698 | 2698 | return 0; |
2699 | 2699 | case 'day_week': |
2700 | - return ['day','day4','week']; |
|
2700 | + return ['day', 'day4', 'week']; |
|
2701 | 2701 | case 'day4': |
2702 | - return ['day','day4']; |
|
2702 | + return ['day', 'day4']; |
|
2703 | 2703 | } |
2704 | 2704 | return null; |
2705 | 2705 | }); |
@@ -2724,7 +2724,7 @@ discard block |
||
2724 | 2724 | function calendar_upgrade16_1_001() |
2725 | 2725 | { |
2726 | 2726 | $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_extra', 'cal_extra_value', |
2727 | - array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '')); |
|
2727 | + array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => '')); |
|
2728 | 2728 | |
2729 | 2729 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'forced'); |
2730 | 2730 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'default'); |
@@ -2736,8 +2736,8 @@ discard block |
||
2736 | 2736 | { |
2737 | 2737 | // Explicitly add months as showing list of events, no times |
2738 | 2738 | $change = function($attr, $old_value, $owner) { |
2739 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
2740 | - if(is_array($old_value) && !in_array('month', $old_value)) |
|
2739 | + if ($owner == Api\Preferences::FORCED_ID) return; |
|
2740 | + if (is_array($old_value) && !in_array('month', $old_value)) |
|
2741 | 2741 | { |
2742 | 2742 | $old_value[] = 'month'; |
2743 | 2743 | } |
@@ -2759,7 +2759,7 @@ discard block |
||
2759 | 2759 | { |
2760 | 2760 | // Update birthdays as events preference from boolean |
2761 | 2761 | $change = function($attr, $old_value, $owner) { |
2762 | - if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2762 | + if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2763 | 2763 | return $old_value ? 'birthday' : 'none'; |
2764 | 2764 | }; |
2765 | 2765 | Api\Preferences::change_preference('calendar', 'birthdays_as_events', $change); |
@@ -1428,13 +1428,18 @@ discard block |
||
1428 | 1428 | function calendar_upgrade1_0_1_008() |
1429 | 1429 | { |
1430 | 1430 | $config_data = Api\Config::read('calendar'); |
1431 | - if (isset($config_data['fields'])) // old custom fields |
|
1431 | + if (isset($config_data['fields'])) |
|
1432 | + { |
|
1433 | + // old custom fields |
|
1432 | 1434 | { |
1433 | 1435 | $customfields = array(); |
1436 | + } |
|
1434 | 1437 | $order = 0; |
1435 | 1438 | foreach($config_data['fields'] as $name => $data) |
1436 | 1439 | { |
1437 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
1440 | + if ($name{0} == '#' && !$data['disabled']) |
|
1441 | + { |
|
1442 | + // real not-disabled custom field |
|
1438 | 1443 | { |
1439 | 1444 | $customfields[substr($name,1)] = array( |
1440 | 1445 | 'type' => 'text', |
@@ -1443,6 +1448,7 @@ discard block |
||
1443 | 1448 | 'order' => ($order += 10), |
1444 | 1449 | ); |
1445 | 1450 | } |
1451 | + } |
|
1446 | 1452 | } |
1447 | 1453 | if (count($customfields)) |
1448 | 1454 | { |
@@ -2583,9 +2589,12 @@ discard block |
||
2583 | 2589 | 'cal_recur_date' => $row['cal_recur_date'], |
2584 | 2590 | 'cal_user_type' => 'e', |
2585 | 2591 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
2586 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
2592 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
2593 | + { |
|
2594 | + // order A, T, U, X |
|
2587 | 2595 | { |
2588 | 2596 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
2597 | + } |
|
2589 | 2598 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', |
2590 | 2599 | array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status'))), |
2591 | 2600 | __LINE__, __FILE__, 'calendar'); |
@@ -2735,8 +2744,12 @@ discard block |
||
2735 | 2744 | function calendar_upgrade16_1_002() |
2736 | 2745 | { |
2737 | 2746 | // Explicitly add months as showing list of events, no times |
2738 | - $change = function($attr, $old_value, $owner) { |
|
2739 | - if($owner == Api\Preferences::FORCED_ID) return; |
|
2747 | + $change = function($attr, $old_value, $owner) |
|
2748 | + { |
|
2749 | + if($owner == Api\Preferences::FORCED_ID) |
|
2750 | + { |
|
2751 | + return; |
|
2752 | + } |
|
2740 | 2753 | if(is_array($old_value) && !in_array('month', $old_value)) |
2741 | 2754 | { |
2742 | 2755 | $old_value[] = 'month'; |
@@ -2758,8 +2771,13 @@ discard block |
||
2758 | 2771 | function calendar_upgrade17_1() |
2759 | 2772 | { |
2760 | 2773 | // Update birthdays as events preference from boolean |
2761 | - $change = function($attr, $old_value, $owner) { |
|
2762 | - if (!isset($old_value)) return null; // do not set anything, if nothing was set before |
|
2774 | + $change = function($attr, $old_value, $owner) |
|
2775 | + { |
|
2776 | + if (!isset($old_value)) |
|
2777 | + { |
|
2778 | + return null; |
|
2779 | + } |
|
2780 | + // do not set anything, if nothing was set before |
|
2763 | 2781 | return $old_value ? 'birthday' : 'none'; |
2764 | 2782 | }; |
2765 | 2783 | Api\Preferences::change_preference('calendar', 'birthdays_as_events', $change); |
@@ -187,7 +187,7 @@ |
||
187 | 187 | * |
188 | 188 | * @param string $file filename |
189 | 189 | * @param boolean $dry_run =false true: only echo fixed file, not fix it |
190 | - * @return boolean false on error |
|
190 | + * @return boolean|null false on error |
|
191 | 191 | */ |
192 | 192 | function fix_api($file, $dry_run=false) |
193 | 193 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | // raw replacements |
19 | 19 | $add_use_api = array( |
20 | - "#use EGroupware\\\\Api;\n#" => '', // remove evtl. use EGroupware\Api, as we add it again below |
|
20 | + "#use EGroupware\\\\Api;\n#" => '', // remove evtl. use EGroupware\Api, as we add it again below |
|
21 | 21 | "#<\?php\n+\s*/\*+?(.*)\*/#msU" => "<?php\n/**$1*/\n\nuse EGroupware\\Api;", |
22 | 22 | ); |
23 | 23 | $replace = array( |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | // enclose class-names and static methods with some syntax check |
47 | 47 | $class_start = '#(?<!function)([\[\s,;().!=])'; |
48 | 48 | $class_end = '(::|\\(|\\)|;|\?|:|\\s|,|$)#'; |
49 | -foreach(array( |
|
49 | +foreach (array( |
|
50 | 50 | 'accounts' => 'Api\\Accounts', |
51 | 51 | 'acl' => 'Api\\Acl', |
52 | 52 | 'EGW_ACL_READ' => 'Api\\Acl::READ', |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | * @param boolean $dry_run =false true: only echo fixed file, not fix it |
190 | 190 | * @return boolean false on error |
191 | 191 | */ |
192 | -function fix_api($file, $dry_run=false) |
|
192 | +function fix_api($file, $dry_run = false) |
|
193 | 193 | { |
194 | 194 | global $prog, $replace, $add_use_api; |
195 | - if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
195 | + if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
196 | 196 | |
197 | 197 | if (($content = $content_in = file_get_contents($file)) === false) return false; |
198 | 198 | |
@@ -203,12 +203,12 @@ discard block |
||
203 | 203 | } |
204 | 204 | $content2 = preg_replace(array_keys($replace), array_values($replace), $content); |
205 | 205 | |
206 | - if ($content2 == $content_in) return true; // nothing changed |
|
206 | + if ($content2 == $content_in) return true; // nothing changed |
|
207 | 207 | |
208 | 208 | $content = preg_replace(array_keys($add_use_api), array_values($add_use_api), $content2); |
209 | 209 | |
210 | 210 | // shorten some classes, if used, with further use declarations |
211 | - foreach(array('Api\\Etemplate', 'Api\\Vfs', 'Api\\Acl', 'Api\\Egw', 'Api\\Framework', 'Api\\Link') as $namespace) |
|
211 | + foreach (array('Api\\Etemplate', 'Api\\Vfs', 'Api\\Acl', 'Api\\Egw', 'Api\\Framework', 'Api\\Link') as $namespace) |
|
212 | 212 | { |
213 | 213 | if (strpos($content, $namespace) !== false && strpos($content, 'use EGroupware\\'.$namespace) === false) |
214 | 214 | { |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | * @param boolean $dry_run =false true: only echo fixed file, not fix it |
248 | 248 | * @return boolean false on error |
249 | 249 | */ |
250 | -function fix_api_recursive($dir, $dry_run=false) |
|
250 | +function fix_api_recursive($dir, $dry_run = false) |
|
251 | 251 | { |
252 | 252 | if (!is_dir($dir)) return false; |
253 | 253 | |
254 | - foreach(scandir($dir) as $file) |
|
254 | + foreach (scandir($dir) as $file) |
|
255 | 255 | { |
256 | 256 | if ($file == '.' || $file == '..') continue; |
257 | 257 | |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | { |
260 | 260 | fix_api_recursive($dir.'/'.$file, $dry_run); |
261 | 261 | } |
262 | - elseif(substr($file,-4) == '.php') |
|
262 | + elseif (substr($file, -4) == '.php') |
|
263 | 263 | { |
264 | - echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': '; |
|
264 | + echo "\r".str_repeat(' ', 100)."\r".$dir.'/'.$file.': '; |
|
265 | 265 | fix_api($dir.'/'.$file, $dry_run); |
266 | 266 | } |
267 | 267 | } |
268 | - echo "\r".str_repeat(' ',100)."\r"; |
|
268 | + echo "\r".str_repeat(' ', 100)."\r"; |
|
269 | 269 | return true; |
270 | 270 | } |
271 | 271 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @param string $error =null |
276 | 276 | */ |
277 | -function usage($error=null) |
|
277 | +function usage($error = null) |
|
278 | 278 | { |
279 | 279 | global $prog; |
280 | 280 | echo "Usage: $prog [-h|--help] [-d|--dry-run] file(s) or dir(s)\n\n"; |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | if (!$args) usage(); |
289 | 289 | |
290 | 290 | $dry_run = false; |
291 | -while(($arg = array_shift($args)) && $arg[0] == '-') |
|
291 | +while (($arg = array_shift($args)) && $arg[0] == '-') |
|
292 | 292 | { |
293 | - switch($arg) |
|
293 | + switch ($arg) |
|
294 | 294 | { |
295 | 295 | case '-h': |
296 | 296 | case '--help': |
@@ -323,4 +323,4 @@ discard block |
||
323 | 323 | fix_api_recursive($arg, $dry_run); |
324 | 324 | } |
325 | 325 | } |
326 | -while(($arg = array_shift($args))); |
|
326 | +while (($arg = array_shift($args))); |
@@ -10,10 +10,13 @@ discard block |
||
10 | 10 | * @version $Id$ |
11 | 11 | */ |
12 | 12 | |
13 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
|
13 | +if (php_sapi_name() !== 'cli') |
|
14 | +{ |
|
15 | + // security precaution: forbit calling as web-page |
|
14 | 16 | { |
15 | 17 | die('<h1>fix_api.php must NOT be called as web-page --> exiting !!!</h1>'); |
16 | 18 | } |
19 | +} |
|
17 | 20 | |
18 | 21 | // raw replacements |
19 | 22 | $add_use_api = array( |
@@ -192,9 +195,16 @@ discard block |
||
192 | 195 | function fix_api($file, $dry_run=false) |
193 | 196 | { |
194 | 197 | global $prog, $replace, $add_use_api; |
195 | - if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
198 | + if (basename($file) == $prog) |
|
199 | + { |
|
200 | + return true; |
|
201 | + } |
|
202 | + // dont fix ourself ;-) |
|
196 | 203 | |
197 | - if (($content = $content_in = file_get_contents($file)) === false) return false; |
|
204 | + if (($content = $content_in = file_get_contents($file)) === false) |
|
205 | + { |
|
206 | + return false; |
|
207 | + } |
|
198 | 208 | |
199 | 209 | if (!preg_match("|<\?php\n+\s*/\*\*?.*\*/|msU", $content)) |
200 | 210 | { |
@@ -203,7 +213,11 @@ discard block |
||
203 | 213 | } |
204 | 214 | $content2 = preg_replace(array_keys($replace), array_values($replace), $content); |
205 | 215 | |
206 | - if ($content2 == $content_in) return true; // nothing changed |
|
216 | + if ($content2 == $content_in) |
|
217 | + { |
|
218 | + return true; |
|
219 | + } |
|
220 | + // nothing changed |
|
207 | 221 | |
208 | 222 | $content = preg_replace(array_keys($add_use_api), array_values($add_use_api), $content2); |
209 | 223 | |
@@ -249,11 +263,17 @@ discard block |
||
249 | 263 | */ |
250 | 264 | function fix_api_recursive($dir, $dry_run=false) |
251 | 265 | { |
252 | - if (!is_dir($dir)) return false; |
|
266 | + if (!is_dir($dir)) |
|
267 | + { |
|
268 | + return false; |
|
269 | + } |
|
253 | 270 | |
254 | 271 | foreach(scandir($dir) as $file) |
255 | 272 | { |
256 | - if ($file == '.' || $file == '..') continue; |
|
273 | + if ($file == '.' || $file == '..') |
|
274 | + { |
|
275 | + continue; |
|
276 | + } |
|
257 | 277 | |
258 | 278 | if (is_dir($dir.'/'.$file)) |
259 | 279 | { |
@@ -278,14 +298,20 @@ discard block |
||
278 | 298 | { |
279 | 299 | global $prog; |
280 | 300 | echo "Usage: $prog [-h|--help] [-d|--dry-run] file(s) or dir(s)\n\n"; |
281 | - if ($error) echo $error."\n\n"; |
|
301 | + if ($error) |
|
302 | + { |
|
303 | + echo $error."\n\n"; |
|
304 | + } |
|
282 | 305 | exit($error ? 1 : 0); |
283 | 306 | } |
284 | 307 | |
285 | 308 | $args = $_SERVER['argv']; |
286 | 309 | $prog = basename(array_shift($args)); |
287 | 310 | |
288 | -if (!$args) usage(); |
|
311 | +if (!$args) |
|
312 | +{ |
|
313 | + usage(); |
|
314 | +} |
|
289 | 315 | |
290 | 316 | $dry_run = false; |
291 | 317 | while(($arg = array_shift($args)) && $arg[0] == '-') |
@@ -303,16 +329,22 @@ discard block |
||
303 | 329 | break; |
304 | 330 | |
305 | 331 | default: |
306 | - if ($args) // not last argument |
|
332 | + if ($args) |
|
333 | + { |
|
334 | + // not last argument |
|
307 | 335 | { |
308 | 336 | usage("Unknown argument '$arg'!"); |
309 | 337 | } |
338 | + } |
|
310 | 339 | break 2; |
311 | 340 | } |
312 | 341 | } |
313 | 342 | |
314 | 343 | do { |
315 | - if (!file_exists($arg)) usage("Error: $arg not found!"); |
|
344 | + if (!file_exists($arg)) |
|
345 | + { |
|
346 | + usage("Error: $arg not found!"); |
|
347 | + } |
|
316 | 348 | |
317 | 349 | if (!is_dir($arg)) |
318 | 350 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * Fix depricated stuff in a given file |
24 | 24 | * |
25 | 25 | * @param string $file filename |
26 | - * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created |
|
26 | + * @param boolean $replace_file replace existing file if modifications are necessary, otherwise .php53 file is created |
|
27 | 27 | * @return boolean false on error |
28 | 28 | */ |
29 | 29 | function fix_depricated($file,$replace_file=false) |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * Loop recursive through directory and call fix_depricated for each php file |
147 | 147 | * |
148 | 148 | * @param string $dir |
149 | - * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created |
|
149 | + * @param boolean $replace_file replace existing file if modifications are necessary, otherwise .php53 file is created |
|
150 | 150 | * @return boolean false on error |
151 | 151 | */ |
152 | 152 | function fix_depricated_recursive($dir,$replace_file=false) |
@@ -174,7 +174,6 @@ discard block |
||
174 | 174 | /** |
175 | 175 | * Give usage |
176 | 176 | * |
177 | - * @param string $error=null |
|
178 | 177 | */ |
179 | 178 | function usage($error=null) |
180 | 179 | { |
@@ -26,47 +26,47 @@ discard block |
||
26 | 26 | * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created |
27 | 27 | * @return boolean false on error |
28 | 28 | */ |
29 | -function fix_depricated($file,$replace_file=false) |
|
29 | +function fix_depricated($file, $replace_file = false) |
|
30 | 30 | { |
31 | 31 | $orig = $lines = file_get_contents($file); |
32 | 32 | if ($lines === false) return false; |
33 | 33 | global $prog; |
34 | - if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
34 | + if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
35 | 35 | |
36 | 36 | // PHP Deprecated: Assigning the return value of new by reference is deprecated |
37 | - if (preg_match('/= *& *new /m',$lines)) |
|
37 | + if (preg_match('/= *& *new /m', $lines)) |
|
38 | 38 | { |
39 | - $lines = preg_replace('/= *& *new /','= new ',$lines); |
|
39 | + $lines = preg_replace('/= *& *new /', '= new ', $lines); |
|
40 | 40 | } |
41 | 41 | // PHP Deprecated: Function split() is deprecated |
42 | - if (preg_match_all('/[= \t(]+spliti? *\\(("[^"]*"|\'[^\']*\'),/m',$lines,$matches)) |
|
42 | + if (preg_match_all('/[= \t(]+spliti? *\\(("[^"]*"|\'[^\']*\'),/m', $lines, $matches)) |
|
43 | 43 | { |
44 | 44 | $replace = array(); |
45 | 45 | //print_r($matches); |
46 | - foreach($matches[1] as $key => $pattern) |
|
46 | + foreach ($matches[1] as $key => $pattern) |
|
47 | 47 | { |
48 | 48 | $full_pattern = $matches[0][$key]; |
49 | 49 | // single char --> just explode |
50 | - if (strlen($pattern) == 3 || strlen($pattern) == 4 && substr($pattern,0,2) == '"\\') |
|
50 | + if (strlen($pattern) == 3 || strlen($pattern) == 4 && substr($pattern, 0, 2) == '"\\') |
|
51 | 51 | { |
52 | - $replace[$full_pattern] = str_replace('split','explode',$full_pattern); |
|
52 | + $replace[$full_pattern] = str_replace('split', 'explode', $full_pattern); |
|
53 | 53 | } |
54 | 54 | else |
55 | 55 | { |
56 | - $preg_pattern = $pattern[0].'/'.str_replace('/','\\\\/',substr($pattern,1,-1)).'/'.$pattern[0]; |
|
57 | - if (strpos($full_pattern,'spliti')) $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0]; |
|
58 | - $replace[$full_pattern] = str_replace(array('spliti','split',$pattern),array('preg_split','preg_split',$preg_pattern),$full_pattern); |
|
56 | + $preg_pattern = $pattern[0].'/'.str_replace('/', '\\\\/', substr($pattern, 1, -1)).'/'.$pattern[0]; |
|
57 | + if (strpos($full_pattern, 'spliti')) $preg_pattern = substr($preg_pattern, 0, -1).'i'.$pattern[0]; |
|
58 | + $replace[$full_pattern] = str_replace(array('spliti', 'split', $pattern), array('preg_split', 'preg_split', $preg_pattern), $full_pattern); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | //print_r($replace); |
62 | - $lines = strtr($lines,$replace); |
|
62 | + $lines = strtr($lines, $replace); |
|
63 | 63 | } |
64 | 64 | // PHP Deprecated: Function ereg() is deprecated |
65 | - if (preg_match_all('/!?eregi? *\\(("[^"]+"[^,]*|\'[^\']+\'[^,]*), *(\$[A-Za-z0-9_\[\]\$\'\"]+)(, *\$[A-Za-z0-9_\[\]\$\'\"]+)?\)([ )&|]+)/m',$lines,$matches)) |
|
65 | + if (preg_match_all('/!?eregi? *\\(("[^"]+"[^,]*|\'[^\']+\'[^,]*), *(\$[A-Za-z0-9_\[\]\$\'\"]+)(, *\$[A-Za-z0-9_\[\]\$\'\"]+)?\)([ )&|]+)/m', $lines, $matches)) |
|
66 | 66 | { |
67 | 67 | $replace = array(); |
68 | 68 | //print_r($matches); |
69 | - foreach($matches[1] as $key => $pattern) |
|
69 | + foreach ($matches[1] as $key => $pattern) |
|
70 | 70 | { |
71 | 71 | $full_pattern = $matches[0][$key]; |
72 | 72 | $what = $matches[2][$key]; |
@@ -75,25 +75,25 @@ discard block |
||
75 | 75 | if (preg_quote($pattern) == $pattern) |
76 | 76 | { |
77 | 77 | |
78 | - $replace[$full_pattern] = (strpos($full_pattern,'eregi')!==false?'strposi':'strpos').'('.$what.','.$pattern. |
|
79 | - ') '.($full_pattern[0]=='!'?'===':'!==').' false'.$matches[4][$key]; |
|
78 | + $replace[$full_pattern] = (strpos($full_pattern, 'eregi') !== false ? 'strposi' : 'strpos').'('.$what.','.$pattern. |
|
79 | + ') '.($full_pattern[0] == '!' ? '===' : '!==').' false'.$matches[4][$key]; |
|
80 | 80 | } |
81 | 81 | else |
82 | 82 | { |
83 | 83 | // full ereg regular expression --> preg_match |
84 | - $preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'"); |
|
85 | - $replace[$full_pattern] = str_replace(array('eregi','ereg',$pattern),array('preg_match','preg_match',$preg_pattern),$full_pattern); |
|
84 | + $preg_pattern = "'/'.".str_replace('/', '\\\\/', $pattern).(strpos($full_pattern, 'eregi') !== false ? ".'/i'" : ".'/'"); |
|
85 | + $replace[$full_pattern] = str_replace(array('eregi', 'ereg', $pattern), array('preg_match', 'preg_match', $preg_pattern), $full_pattern); |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | //print_r($replace); |
89 | - $lines = strtr($lines,$replace); |
|
89 | + $lines = strtr($lines, $replace); |
|
90 | 90 | } |
91 | 91 | // PHP Deprecated: Function ereg_replace() is deprecated |
92 | - if (preg_match_all('/eregi?_replace *\\((".+"|\'.+\'|[^,]+), *(.+), *[\'s$].+\)[,; =]/m',$lines,$matches)) |
|
92 | + if (preg_match_all('/eregi?_replace *\\((".+"|\'.+\'|[^,]+), *(.+), *[\'s$].+\)[,; =]/m', $lines, $matches)) |
|
93 | 93 | { |
94 | 94 | $replace = array(); |
95 | 95 | //print_r($matches); |
96 | - foreach($matches[1] as $key => $pattern) |
|
96 | + foreach ($matches[1] as $key => $pattern) |
|
97 | 97 | { |
98 | 98 | $full_pattern = $matches[0][$key]; |
99 | 99 | $other = $matches[2][$key]; |
@@ -101,41 +101,41 @@ discard block |
||
101 | 101 | // simple replace --> use str_replace() |
102 | 102 | if (preg_quote($pattern) == $pattern) |
103 | 103 | { |
104 | - $replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace'),array('stri_replace','str_replace'),$full_pattern); |
|
104 | + $replace[$full_pattern] = str_replace(array('eregi_replace', 'ereg_replace'), array('stri_replace', 'str_replace'), $full_pattern); |
|
105 | 105 | } |
106 | 106 | else |
107 | 107 | { |
108 | 108 | // full ereg regular expression --> preg_replace |
109 | - $preg_pattern = "'/'.".str_replace('/','\\\\/',$pattern).(strpos($full_pattern,'eregi') !== false ? ".'/i'" : ".'/'"); |
|
110 | - $replace[$full_pattern] = str_replace(array('eregi_replace','ereg_replace',$pattern), |
|
111 | - array('preg_replace','preg_replace',$preg_pattern),$full_pattern); |
|
109 | + $preg_pattern = "'/'.".str_replace('/', '\\\\/', $pattern).(strpos($full_pattern, 'eregi') !== false ? ".'/i'" : ".'/'"); |
|
110 | + $replace[$full_pattern] = str_replace(array('eregi_replace', 'ereg_replace', $pattern), |
|
111 | + array('preg_replace', 'preg_replace', $preg_pattern), $full_pattern); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | //print_r($replace); |
115 | - $lines = strtr($lines,$replace); |
|
115 | + $lines = strtr($lines, $replace); |
|
116 | 116 | } |
117 | 117 | // remove extra '/' from regular expressions |
118 | - $lines = str_replace(array("'/'.'","'.'/'","'.'/i'"),array("'/","/'","/i'"),$lines); |
|
118 | + $lines = str_replace(array("'/'.'", "'.'/'", "'.'/i'"), array("'/", "/'", "/i'"), $lines); |
|
119 | 119 | |
120 | 120 | // fix call to not longer existing PDO method $result->fetchSingle() |
121 | - $lines = str_replace('->fetchSingle(','->fetchColumn(',$lines); |
|
121 | + $lines = str_replace('->fetchSingle(', '->fetchColumn(', $lines); |
|
122 | 122 | |
123 | 123 | // fix calls to deprecated call_user_method(_array)?(method,object[,args]) |
124 | - if (preg_match('/call_user_method(_array)?\(/',$lines,$matches)) |
|
124 | + if (preg_match('/call_user_method(_array)?\(/', $lines, $matches)) |
|
125 | 125 | { |
126 | - $lines = preg_replace('/call_user_method\(([^,]+),([^,\)]+)([,)])/','call_user_func(array(\\2,\\1)\\3',$lines); |
|
127 | - $lines = preg_replace('/call_user_method_array\(([^,]+),([^,\)]+)([,)])/','call_user_func_array(array(\\2,\\1)\\3',$lines); |
|
126 | + $lines = preg_replace('/call_user_method\(([^,]+),([^,\)]+)([,)])/', 'call_user_func(array(\\2,\\1)\\3', $lines); |
|
127 | + $lines = preg_replace('/call_user_method_array\(([^,]+),([^,\)]+)([,)])/', 'call_user_func_array(array(\\2,\\1)\\3', $lines); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | if ($lines != $orig) |
131 | 131 | { |
132 | - file_put_contents($file.'53',$lines); |
|
133 | - system('/usr/bin/php -l '.$file.'53',$ret); |
|
132 | + file_put_contents($file.'53', $lines); |
|
133 | + system('/usr/bin/php -l '.$file.'53', $ret); |
|
134 | 134 | system('/usr/bin/diff -u '.$file.' '.$file.'53'); |
135 | 135 | if (!$ret && $replace_file) |
136 | 136 | { |
137 | 137 | unlink($file); |
138 | - rename($file.'53',$file); |
|
138 | + rename($file.'53', $file); |
|
139 | 139 | } |
140 | 140 | return !$ret; |
141 | 141 | } |
@@ -149,25 +149,25 @@ discard block |
||
149 | 149 | * @param boolean $replace_file=false replace existing file if modifications are necessary, otherwise .php53 file is created |
150 | 150 | * @return boolean false on error |
151 | 151 | */ |
152 | -function fix_depricated_recursive($dir,$replace_file=false) |
|
152 | +function fix_depricated_recursive($dir, $replace_file = false) |
|
153 | 153 | { |
154 | 154 | if (!is_dir($dir)) return false; |
155 | 155 | |
156 | - foreach(scandir($dir) as $file) |
|
156 | + foreach (scandir($dir) as $file) |
|
157 | 157 | { |
158 | 158 | if ($file == '.' || $file == '..') continue; |
159 | 159 | |
160 | 160 | if (is_dir($dir.'/'.$file)) |
161 | 161 | { |
162 | - fix_depricated_recursive($dir.'/'.$file,$replace_file); |
|
162 | + fix_depricated_recursive($dir.'/'.$file, $replace_file); |
|
163 | 163 | } |
164 | - elseif(substr($file,-4) == '.php') |
|
164 | + elseif (substr($file, -4) == '.php') |
|
165 | 165 | { |
166 | - echo "\r".str_repeat(' ',100)."\r".$dir.'/'.$file.': '; |
|
167 | - fix_depricated($dir.'/'.$file,$replace_file); |
|
166 | + echo "\r".str_repeat(' ', 100)."\r".$dir.'/'.$file.': '; |
|
167 | + fix_depricated($dir.'/'.$file, $replace_file); |
|
168 | 168 | } |
169 | 169 | } |
170 | - echo "\r".str_repeat(' ',100)."\r"; |
|
170 | + echo "\r".str_repeat(' ', 100)."\r"; |
|
171 | 171 | return true; |
172 | 172 | } |
173 | 173 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param string $error=null |
178 | 178 | */ |
179 | -function usage($error=null) |
|
179 | +function usage($error = null) |
|
180 | 180 | { |
181 | 181 | global $prog; |
182 | 182 | echo "Usage: $prog [--replace] [-h|--help] file or dir\n\n"; |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | if (!$args) usage(); |
191 | 191 | |
192 | 192 | $replace_file = false; |
193 | -while(($arg = array_shift($args))) |
|
193 | +while (($arg = array_shift($args))) |
|
194 | 194 | { |
195 | - switch($arg) |
|
195 | + switch ($arg) |
|
196 | 196 | { |
197 | 197 | case '-h': |
198 | 198 | case '--help': |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | |
217 | 217 | if (!is_dir($arg)) |
218 | 218 | { |
219 | - fix_depricated($arg,$replace_file); |
|
219 | + fix_depricated($arg, $replace_file); |
|
220 | 220 | } |
221 | 221 | else |
222 | 222 | { |
223 | - fix_depricated_recursive($arg,$replace_file); |
|
223 | + fix_depricated_recursive($arg, $replace_file); |
|
224 | 224 | } |
225 | 225 | \ No newline at end of file |
@@ -14,10 +14,13 @@ discard block |
||
14 | 14 | * @version $Id$ |
15 | 15 | */ |
16 | 16 | |
17 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
|
17 | +if (php_sapi_name() !== 'cli') |
|
18 | +{ |
|
19 | + // security precaution: forbit calling as web-page |
|
18 | 20 | { |
19 | 21 | die('<h1>fix_depricated.php must NOT be called as web-page --> exiting !!!</h1>'); |
20 | 22 | } |
23 | +} |
|
21 | 24 | |
22 | 25 | /** |
23 | 26 | * Fix depricated stuff in a given file |
@@ -29,9 +32,16 @@ discard block |
||
29 | 32 | function fix_depricated($file,$replace_file=false) |
30 | 33 | { |
31 | 34 | $orig = $lines = file_get_contents($file); |
32 | - if ($lines === false) return false; |
|
35 | + if ($lines === false) |
|
36 | + { |
|
37 | + return false; |
|
38 | + } |
|
33 | 39 | global $prog; |
34 | - if (basename($file) == $prog) return true; // dont fix ourself ;-) |
|
40 | + if (basename($file) == $prog) |
|
41 | + { |
|
42 | + return true; |
|
43 | + } |
|
44 | + // dont fix ourself ;-) |
|
35 | 45 | |
36 | 46 | // PHP Deprecated: Assigning the return value of new by reference is deprecated |
37 | 47 | if (preg_match('/= *& *new /m',$lines)) |
@@ -54,7 +64,10 @@ discard block |
||
54 | 64 | else |
55 | 65 | { |
56 | 66 | $preg_pattern = $pattern[0].'/'.str_replace('/','\\\\/',substr($pattern,1,-1)).'/'.$pattern[0]; |
57 | - if (strpos($full_pattern,'spliti')) $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0]; |
|
67 | + if (strpos($full_pattern,'spliti')) |
|
68 | + { |
|
69 | + $preg_pattern = substr($preg_pattern,0,-1).'i'.$pattern[0]; |
|
70 | + } |
|
58 | 71 | $replace[$full_pattern] = str_replace(array('spliti','split',$pattern),array('preg_split','preg_split',$preg_pattern),$full_pattern); |
59 | 72 | } |
60 | 73 | } |
@@ -151,11 +164,17 @@ discard block |
||
151 | 164 | */ |
152 | 165 | function fix_depricated_recursive($dir,$replace_file=false) |
153 | 166 | { |
154 | - if (!is_dir($dir)) return false; |
|
167 | + if (!is_dir($dir)) |
|
168 | + { |
|
169 | + return false; |
|
170 | + } |
|
155 | 171 | |
156 | 172 | foreach(scandir($dir) as $file) |
157 | 173 | { |
158 | - if ($file == '.' || $file == '..') continue; |
|
174 | + if ($file == '.' || $file == '..') |
|
175 | + { |
|
176 | + continue; |
|
177 | + } |
|
159 | 178 | |
160 | 179 | if (is_dir($dir.'/'.$file)) |
161 | 180 | { |
@@ -180,14 +199,20 @@ discard block |
||
180 | 199 | { |
181 | 200 | global $prog; |
182 | 201 | echo "Usage: $prog [--replace] [-h|--help] file or dir\n\n"; |
183 | - if ($error) echo $error."\n\n"; |
|
202 | + if ($error) |
|
203 | + { |
|
204 | + echo $error."\n\n"; |
|
205 | + } |
|
184 | 206 | exit($error ? 1 : 0); |
185 | 207 | } |
186 | 208 | |
187 | 209 | $args = $_SERVER['argv']; |
188 | 210 | $prog = basename(array_shift($args)); |
189 | 211 | |
190 | -if (!$args) usage(); |
|
212 | +if (!$args) |
|
213 | +{ |
|
214 | + usage(); |
|
215 | +} |
|
191 | 216 | |
192 | 217 | $replace_file = false; |
193 | 218 | while(($arg = array_shift($args))) |
@@ -204,15 +229,21 @@ discard block |
||
204 | 229 | break; |
205 | 230 | |
206 | 231 | default: |
207 | - if ($args) // not last argument |
|
232 | + if ($args) |
|
233 | + { |
|
234 | + // not last argument |
|
208 | 235 | { |
209 | 236 | usage("Unknown argument '$arg'!"); |
210 | 237 | } |
238 | + } |
|
211 | 239 | break 2; |
212 | 240 | } |
213 | 241 | } |
214 | 242 | |
215 | -if (!file_exists($arg)) usage("Error: $arg not found!"); |
|
243 | +if (!file_exists($arg)) |
|
244 | +{ |
|
245 | + usage("Error: $arg not found!"); |
|
246 | +} |
|
216 | 247 | |
217 | 248 | if (!is_dir($arg)) |
218 | 249 | { |
@@ -464,6 +464,7 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param string $name |
466 | 466 | * @param string $value =null value to use, default $config[$name] |
467 | + * @return string |
|
467 | 468 | */ |
468 | 469 | function config_translate($name, $value=null) |
469 | 470 | { |
@@ -1194,7 +1195,7 @@ discard block |
||
1194 | 1195 | * Runs given shell command, exists with error-code after echoing the output of the failed command (if not already running verbose) |
1195 | 1196 | * |
1196 | 1197 | * @param string $cmd |
1197 | - * @param array& $output=null $output of command, only if !$verbose !!! |
|
1198 | + * @param array& $output $output of command, only if !$verbose !!! |
|
1198 | 1199 | * @param int|array $no_bailout =null exit code(s) to NOT bail out |
1199 | 1200 | * @return int exit code of $cmd |
1200 | 1201 | */ |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | } |
404 | 404 | |
405 | 405 | $archives = config_translate('upload'); |
406 | - echo "Uploading $archives to $config[upload_url]\n"; |
|
406 | + echo "uploading $archives to $config[upload_url]\n"; |
|
407 | 407 | |
408 | 408 | foreach(glob($archives, GLOB_BRACE) as $path) |
409 | 409 | { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | { |
430 | 430 | continue; |
431 | 431 | } |
432 | - if ($verbose) echo "Uploading $path as $content_type\n"; |
|
432 | + if ($verbose) echo "uploading $path as $content_type\n"; |
|
433 | 433 | $name = basename($path); |
434 | 434 | github_api($config['upload_url'], array( |
435 | 435 | 'name' => $name, |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | curl_setopt($c, CURLOPT_URL, $url); |
493 | 493 | |
494 | 494 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
495 | - if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
495 | + if ($verbose) echo "sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
496 | 496 | |
497 | 497 | if (($response = curl_exec($c)) === false) |
498 | 498 | { |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | if (!$is_regexp && strpos($log->paths->path, $pattern) !== false || |
727 | 727 | $is_regexp && preg_match($pattern, $log->paths->path, $matches)) |
728 | 728 | { |
729 | - if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
729 | + if ($verbose) echo "revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
730 | 730 | return (int)$log['revision']; |
731 | 731 | } |
732 | 732 | } |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | if ($content != $content_was) |
808 | 808 | { |
809 | 809 | file_put_contents($path,$content); |
810 | - if ($verbose) echo "Updated $path\n"; |
|
810 | + if ($verbose) echo "updated $path\n"; |
|
811 | 811 | ++$n; |
812 | 812 | } |
813 | 813 | } |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | } |
943 | 943 | foreach($config['types'] as $type) |
944 | 944 | { |
945 | - echo "Creating $type archives\n"; |
|
945 | + echo "creating $type archives\n"; |
|
946 | 946 | $tar_type = $type == 'tar.bz2' ? 'j' : 'z'; |
947 | 947 | |
948 | 948 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | |
1065 | 1065 | if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#') |
1066 | 1066 | { |
1067 | - echo "Running $cmd\n"; |
|
1067 | + echo "running $cmd\n"; |
|
1068 | 1068 | run_cmd($cmd); |
1069 | 1069 | } |
1070 | 1070 | // fix permissions |
@@ -10,10 +10,13 @@ discard block |
||
10 | 10 | * @version $Id$ |
11 | 11 | */ |
12 | 12 | |
13 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling setup-cli as web-page |
|
13 | +if (php_sapi_name() !== 'cli') |
|
14 | +{ |
|
15 | + // security precaution: forbit calling setup-cli as web-page |
|
14 | 16 | { |
15 | 17 | die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>'); |
16 | 18 | } |
19 | +} |
|
17 | 20 | date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings |
18 | 21 | |
19 | 22 | $verbose = 0; |
@@ -137,7 +140,10 @@ discard block |
||
137 | 140 | case 'release': |
138 | 141 | case 'copychangelog': |
139 | 142 | $config[$name] = $value; |
140 | - if ($value) array_unshift($config['run'],$name); |
|
143 | + if ($value) |
|
144 | + { |
|
145 | + array_unshift($config['run'],$name); |
|
146 | + } |
|
141 | 147 | break; |
142 | 148 | |
143 | 149 | case 'editchangelog': |
@@ -153,7 +159,10 @@ discard block |
||
153 | 159 | { |
154 | 160 | usage("Path '$value' not found!"); |
155 | 161 | } |
156 | - if (!in_array('obs',$config['run'])) $config['run'][] = 'obs'; |
|
162 | + if (!in_array('obs',$config['run'])) |
|
163 | + { |
|
164 | + $config['run'][] = 'obs'; |
|
165 | + } |
|
157 | 166 | // fall through |
158 | 167 | default: |
159 | 168 | $config[$name] = $value; |
@@ -213,7 +222,10 @@ discard block |
||
213 | 222 | if (!empty($last_tag)) |
214 | 223 | { |
215 | 224 | $cmd = $config['git'].' log '.escapeshellarg($last_tag.'..HEAD'); |
216 | - if (getcwd() != $path) $cmd = 'cd '.$path.'; '.$cmd; |
|
225 | + if (getcwd() != $path) |
|
226 | + { |
|
227 | + $cmd = 'cd '.$path.'; '.$cmd; |
|
228 | + } |
|
217 | 229 | $output = null; |
218 | 230 | run_cmd($cmd, $output); |
219 | 231 | |
@@ -244,7 +256,10 @@ discard block |
||
244 | 256 | { |
245 | 257 | global $config, $verbose; |
246 | 258 | |
247 | - if ($verbose) echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n"; |
|
259 | + if ($verbose) |
|
260 | + { |
|
261 | + echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n"; |
|
262 | + } |
|
248 | 263 | |
249 | 264 | if (!is_dir($config['checkoutdir'])) |
250 | 265 | { |
@@ -275,12 +290,21 @@ discard block |
||
275 | 290 | elseif (isset($module) && preg_match('/^checkout\s*=\s*(git\s+clone\s+(-b\s+[0-9.]+\s+)?((git|http)[^ ]+)|svn\s+checkout\s+((svn|http)[^ ]+))/', $line, $matches)) |
276 | 291 | { |
277 | 292 | $repo = $url = substr($matches[1], 0, 3) == 'svn' ? $matches[5] : $matches[3]; |
278 | - if (substr($matches[1], 0, 3) == 'svn') $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo); |
|
293 | + if (substr($matches[1], 0, 3) == 'svn') |
|
294 | + { |
|
295 | + $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo); |
|
296 | + } |
|
279 | 297 | $modules[$repo][$config['aliasdir'].($module ? '/'.$module : '')] = $url; |
280 | - if ($module === '' && !isset($baseurl)) $baseurl = str_replace('/egroupware.git', '', $url); |
|
298 | + if ($module === '' && !isset($baseurl)) |
|
299 | + { |
|
300 | + $baseurl = str_replace('/egroupware.git', '', $url); |
|
301 | + } |
|
281 | 302 | } |
282 | 303 | } |
283 | - if ($verbose) print_r($modules); |
|
304 | + if ($verbose) |
|
305 | + { |
|
306 | + print_r($modules); |
|
307 | + } |
|
284 | 308 | return $modules; |
285 | 309 | } |
286 | 310 | |
@@ -348,7 +372,11 @@ discard block |
||
348 | 372 | |
349 | 373 | $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
350 | 374 | |
351 | - if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
375 | + if (empty($config['tag'])) |
|
376 | + { |
|
377 | + return; |
|
378 | + } |
|
379 | + // otherwise we copy everything in svn root! |
|
352 | 380 | |
353 | 381 | echo "Creating tag $config[tag]\n"; |
354 | 382 | |
@@ -364,7 +392,10 @@ discard block |
||
364 | 392 | global $config,$verbose; |
365 | 393 | |
366 | 394 | // push local changes to Github incl. tags |
367 | - if ($verbose) echo "Pushing changes and tags\n"; |
|
395 | + if ($verbose) |
|
396 | + { |
|
397 | + echo "Pushing changes and tags\n"; |
|
398 | + } |
|
368 | 399 | chdir($config['checkoutdir']); |
369 | 400 | run_cmd($config['mr']. ' up'); // in case someone else pushed something |
370 | 401 | chdir($config['checkoutdir']); |
@@ -432,7 +463,10 @@ discard block |
||
432 | 463 | { |
433 | 464 | continue; |
434 | 465 | } |
435 | - if ($verbose) echo "Uploading $path as $content_type\n"; |
|
466 | + if ($verbose) |
|
467 | + { |
|
468 | + echo "Uploading $path as $content_type\n"; |
|
469 | + } |
|
436 | 470 | $name = basename($path); |
437 | 471 | github_api($config['upload_url'], array( |
438 | 472 | 'name' => $name, |
@@ -444,7 +478,10 @@ discard block |
||
444 | 478 | { |
445 | 479 | $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
446 | 480 | $cmd = $config['rsync'].' '.$archives.' '.$target; |
447 | - if ($verbose) echo $cmd."\n"; |
|
481 | + if ($verbose) |
|
482 | + { |
|
483 | + echo $cmd."\n"; |
|
484 | + } |
|
448 | 485 | passthru($cmd); |
449 | 486 | } |
450 | 487 | } |
@@ -477,25 +514,40 @@ discard block |
||
477 | 514 | { |
478 | 515 | case 'POST': |
479 | 516 | curl_setopt($c, CURLOPT_POST, true); |
480 | - if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT); |
|
517 | + if (is_array($data)) |
|
518 | + { |
|
519 | + $data = json_encode($data, JSON_FORCE_OBJECT); |
|
520 | + } |
|
481 | 521 | curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
482 | 522 | break; |
483 | 523 | case 'GET': |
484 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
524 | + if(count($data)) |
|
525 | + { |
|
526 | + $url .= '?' . http_build_query($data); |
|
527 | + } |
|
485 | 528 | break; |
486 | 529 | case 'FILE': |
487 | 530 | curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type")); |
488 | 531 | curl_setopt($c, CURLOPT_POST, true); |
489 | 532 | curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload)); |
490 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
533 | + if(count($data)) |
|
534 | + { |
|
535 | + $url .= '?' . http_build_query($data); |
|
536 | + } |
|
491 | 537 | break; |
492 | 538 | default: |
493 | 539 | throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!"); |
494 | 540 | } |
495 | 541 | curl_setopt($c, CURLOPT_URL, $url); |
496 | 542 | |
497 | - if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
498 | - if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
543 | + if (is_string($data)) |
|
544 | + { |
|
545 | + $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
546 | + } |
|
547 | + if ($verbose) |
|
548 | + { |
|
549 | + echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
550 | + } |
|
499 | 551 | |
500 | 552 | if (($response = curl_exec($c)) === false) |
501 | 553 | { |
@@ -506,7 +558,10 @@ discard block |
||
506 | 558 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
507 | 559 | } |
508 | 560 | |
509 | - if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
561 | + if ($verbose) |
|
562 | + { |
|
563 | + echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
564 | + } |
|
510 | 565 | |
511 | 566 | curl_close($c); |
512 | 567 | |
@@ -523,13 +578,19 @@ discard block |
||
523 | 578 | { |
524 | 579 | global $config; |
525 | 580 | |
526 | - if (!isset($value)) $value = $config[$name]; |
|
581 | + if (!isset($value)) |
|
582 | + { |
|
583 | + $value = $config[$name]; |
|
584 | + } |
|
527 | 585 | if (is_string($value) && strpos($value, '$') !== false) |
528 | 586 | { |
529 | 587 | $translate = array(); |
530 | 588 | foreach($config as $n => $val) |
531 | 589 | { |
532 | - if (is_string($val)) $translate['$'.$n] = $val; |
|
590 | + if (is_string($val)) |
|
591 | + { |
|
592 | + $translate['$'.$n] = $val; |
|
593 | + } |
|
533 | 594 | } |
534 | 595 | $value = strtr($value, $translate); |
535 | 596 | } |
@@ -638,7 +699,10 @@ discard block |
||
638 | 699 | if (is_null($revision)) |
639 | 700 | { |
640 | 701 | list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url); |
641 | - if (empty($branch)) $branch = $config['version']; |
|
702 | + if (empty($branch)) |
|
703 | + { |
|
704 | + $branch = $config['version']; |
|
705 | + } |
|
642 | 706 | $tags_url .= '/tags'; |
643 | 707 | $pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
644 | 708 | $matches = null; |
@@ -664,11 +728,18 @@ discard block |
||
664 | 728 | $message = ''; |
665 | 729 | foreach($xml as $log) |
666 | 730 | { |
667 | - if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
731 | + if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) |
|
732 | + { |
|
733 | + continue; |
|
734 | + } |
|
735 | + // no match --> ignore |
|
668 | 736 | |
669 | 737 | $message .= $msg."\n"; |
670 | 738 | } |
671 | - if ($verbose) echo $message; |
|
739 | + if ($verbose) |
|
740 | + { |
|
741 | + echo $message; |
|
742 | + } |
|
672 | 743 | |
673 | 744 | return $message; |
674 | 745 | } |
@@ -699,7 +770,10 @@ discard block |
||
699 | 770 | { |
700 | 771 | return null; |
701 | 772 | } |
702 | - if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg; |
|
773 | + if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) |
|
774 | + { |
|
775 | + $msg = $prefix.$msg; |
|
776 | + } |
|
703 | 777 | |
704 | 778 | return $msg; |
705 | 779 | } |
@@ -736,7 +810,10 @@ discard block |
||
736 | 810 | if (!$is_regexp && strpos($log->paths->path, $pattern) !== false || |
737 | 811 | $is_regexp && preg_match($pattern, $log->paths->path, $matches)) |
738 | 812 | { |
739 | - if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
813 | + if ($verbose) |
|
814 | + { |
|
815 | + echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
816 | + } |
|
740 | 817 | return (int)$log['revision']; |
741 | 818 | } |
742 | 819 | } |
@@ -756,7 +833,10 @@ discard block |
||
756 | 833 | { |
757 | 834 | usage("Path '$config[obs]' not found!"); |
758 | 835 | } |
759 | - if ($verbose) echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n"; |
|
836 | + if ($verbose) |
|
837 | + { |
|
838 | + echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n"; |
|
839 | + } |
|
760 | 840 | run_cmd('osc up '.$config['obs']); |
761 | 841 | |
762 | 842 | $n = 0; |
@@ -776,10 +856,16 @@ discard block |
||
776 | 856 | if (basename($path) != basename($new_name)) |
777 | 857 | { |
778 | 858 | unlink($path); |
779 | - if ($verbose) echo "rm $path\n"; |
|
859 | + if ($verbose) |
|
860 | + { |
|
861 | + echo "rm $path\n"; |
|
862 | + } |
|
780 | 863 | } |
781 | 864 | copy($new_name,dirname($path).'/'.basename($new_name)); |
782 | - if ($verbose) echo "cp $new_name ".dirname($path)."/\n"; |
|
865 | + if ($verbose) |
|
866 | + { |
|
867 | + echo "cp $new_name ".dirname($path)."/\n"; |
|
868 | + } |
|
783 | 869 | ++$n; |
784 | 870 | } |
785 | 871 | // if we have no changelog (eg. because commands run separate), try parsing it from changelog file |
@@ -817,7 +903,10 @@ discard block |
||
817 | 903 | if ($content != $content_was) |
818 | 904 | { |
819 | 905 | file_put_contents($path,$content); |
820 | - if ($verbose) echo "Updated $path\n"; |
|
906 | + if ($verbose) |
|
907 | + { |
|
908 | + echo "Updated $path\n"; |
|
909 | + } |
|
821 | 910 | ++$n; |
822 | 911 | } |
823 | 912 | } |
@@ -855,9 +944,12 @@ discard block |
||
855 | 944 | } |
856 | 945 | $n += empty($lines[$n+1]) ? 2 : 1; // overead empty line behind header |
857 | 946 | $logentry = ''; |
858 | - while($lines[$n]) // entry is terminated by empty line |
|
947 | + while($lines[$n]) |
|
948 | + { |
|
949 | + // entry is terminated by empty line |
|
859 | 950 | { |
860 | 951 | $logentry .= (substr($lines[$n], 0, 2) == ' ' ? substr($lines[$n], 2) : $lines[$n])."\n"; |
952 | + } |
|
861 | 953 | ++$n; |
862 | 954 | } |
863 | 955 | return substr($logentry, 0, -1); // remove training "\n" |
@@ -878,7 +970,10 @@ discard block |
||
878 | 970 | |
879 | 971 | list($header) = explode("\n", $content); |
880 | 972 | $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
881 | - if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
973 | + if (substr($config['changelog'],0,2) != ' ') |
|
974 | + { |
|
975 | + $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
976 | + } |
|
882 | 977 | $content = $new_header."\n\n".$config['changelog']. |
883 | 978 | "\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content; |
884 | 979 | |
@@ -916,10 +1011,13 @@ discard block |
||
916 | 1011 | { |
917 | 1012 | global $config; |
918 | 1013 | |
919 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
1014 | + if (substr($config['sourcedir'],0,2) == '~/') |
|
1015 | + { |
|
1016 | + // sha1_file cant deal with '~/rpm' |
|
920 | 1017 | { |
921 | 1018 | $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
922 | 1019 | } |
1020 | + } |
|
923 | 1021 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
924 | 1022 | |
925 | 1023 | if (!file_exists($sumsfile)) |
@@ -930,11 +1028,17 @@ discard block |
||
930 | 1028 | // signing it |
931 | 1029 | if (empty($config['gpg']) || !file_exists($config['gpg'])) |
932 | 1030 | { |
933 | - if (!empty($config['gpg'])) echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n"; |
|
1031 | + if (!empty($config['gpg'])) |
|
1032 | + { |
|
1033 | + echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n"; |
|
1034 | + } |
|
934 | 1035 | return; |
935 | 1036 | } |
936 | 1037 | echo "Signing sha1sum file:\n"; |
937 | - if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc'); |
|
1038 | + if (file_exists($sumsfile.'.asc')) |
|
1039 | + { |
|
1040 | + unlink($sumsfile.'.asc'); |
|
1041 | + } |
|
938 | 1042 | $cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile; |
939 | 1043 | run_cmd($cmd); |
940 | 1044 | unlink($sumsfile); // delete the unsigned file |
@@ -947,11 +1051,17 @@ discard block |
||
947 | 1051 | { |
948 | 1052 | global $config; |
949 | 1053 | |
950 | - if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true); |
|
951 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
1054 | + if (!file_exists($config['sourcedir'])) |
|
1055 | + { |
|
1056 | + mkdir($config['sourcedir'],0755,true); |
|
1057 | + } |
|
1058 | + if (substr($config['sourcedir'],0,2) == '~/') |
|
1059 | + { |
|
1060 | + // sha1_file cant deal with '~/rpm' |
|
952 | 1061 | { |
953 | 1062 | $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
954 | 1063 | } |
1064 | + } |
|
955 | 1065 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
956 | 1066 | $sums = ''; |
957 | 1067 | |
@@ -989,12 +1099,22 @@ discard block |
||
989 | 1099 | { |
990 | 1100 | foreach((array)$config['all-add'] as $add) |
991 | 1101 | { |
992 | - if (substr($add, -4) != '.tar') continue; // probably a module |
|
993 | - if (!($tar = realpath($add))) throw new Exception("File '$add' not found!"); |
|
1102 | + if (substr($add, -4) != '.tar') |
|
1103 | + { |
|
1104 | + continue; |
|
1105 | + } |
|
1106 | + // probably a module |
|
1107 | + if (!($tar = realpath($add))) |
|
1108 | + { |
|
1109 | + throw new Exception("File '$add' not found!"); |
|
1110 | + } |
|
994 | 1111 | $cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar; |
995 | 1112 | } |
996 | 1113 | } |
997 | - if (file_exists($file.'.bz2')) $cmd .= '; rm -f '.$file.'.bz2'; |
|
1114 | + if (file_exists($file.'.bz2')) |
|
1115 | + { |
|
1116 | + $cmd .= '; rm -f '.$file.'.bz2'; |
|
1117 | + } |
|
998 | 1118 | $cmd .= '; '.$config['bzip2'].' '.$file; |
999 | 1119 | // run cmd now and continue without adding all tar-ball to sums, as we dont want to publish it |
1000 | 1120 | run_cmd($cmd); |
@@ -1015,7 +1135,10 @@ discard block |
||
1015 | 1135 | |
1016 | 1136 | foreach($config['extra'] as $name => $modules) |
1017 | 1137 | { |
1018 | - if (is_numeric($name)) $name = $modules; |
|
1138 | + if (is_numeric($name)) |
|
1139 | + { |
|
1140 | + $name = $modules; |
|
1141 | + } |
|
1019 | 1142 | $dirs = ' egroupware/'.implode(' egroupware/', (array)$modules); |
1020 | 1143 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
1021 | 1144 | switch($type) |
@@ -1056,7 +1179,10 @@ discard block |
||
1056 | 1179 | { |
1057 | 1180 | echo "Updating virus signatures\n"; |
1058 | 1181 | $cmd = '/usr/bin/sudo '.$config['freshclam']; |
1059 | - if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n"; |
|
1182 | + if (!$verbose && function_exists('posix_getuid') && posix_getuid()) |
|
1183 | + { |
|
1184 | + echo $cmd."\n"; |
|
1185 | + } |
|
1060 | 1186 | $output = null; |
1061 | 1187 | run_cmd($cmd,$output,1); // 1 = ignore already up to date database |
1062 | 1188 | } |
@@ -1084,7 +1210,10 @@ discard block |
||
1084 | 1210 | } |
1085 | 1211 | |
1086 | 1212 | // we need to stash uncommited changes like .mrconfig, before copying |
1087 | - if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash"); |
|
1213 | + if (file_exists($config['checkoutdir'].'/.git')) |
|
1214 | + { |
|
1215 | + run_cmd("cd $config[checkoutdir]; git stash"); |
|
1216 | + } |
|
1088 | 1217 | |
1089 | 1218 | try { |
1090 | 1219 | $cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude .mrconfig --exclude node_modules/ --exclude tests '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/'; |
@@ -1093,8 +1222,14 @@ discard block |
||
1093 | 1222 | catch (Exception $e) { |
1094 | 1223 | // catch failures to pop stash, before throwing exception |
1095 | 1224 | } |
1096 | - if (file_exists($config['checkoutdir'].'/.git')) run_cmd("git stash pop"); |
|
1097 | - if (isset($e)) throw $e; |
|
1225 | + if (file_exists($config['checkoutdir'].'/.git')) |
|
1226 | + { |
|
1227 | + run_cmd("git stash pop"); |
|
1228 | + } |
|
1229 | + if (isset($e)) |
|
1230 | + { |
|
1231 | + throw $e; |
|
1232 | + } |
|
1098 | 1233 | |
1099 | 1234 | if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#') |
1100 | 1235 | { |
@@ -1179,9 +1314,12 @@ discard block |
||
1179 | 1314 | if ($ret || substr($line,0,5) == 'URL: ') |
1180 | 1315 | { |
1181 | 1316 | $url = substr($line,5); |
1182 | - if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
1317 | + if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) |
|
1318 | + { |
|
1319 | + // wrong branch (or no svn dir) |
|
1183 | 1320 | { |
1184 | 1321 | echo "Checkout is of wrong branch --> deleting it\n"; |
1322 | + } |
|
1185 | 1323 | system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
1186 | 1324 | clearstatcache(); |
1187 | 1325 | } |
@@ -1228,19 +1366,31 @@ discard block |
||
1228 | 1366 | $svnbranch = $config['svnbase'].'/'.$config['svnbranch']; |
1229 | 1367 | $url = $svnbranch.'/'.$config['svnalias']; |
1230 | 1368 | $cmd = $svn.' propget svn:externals --strict '.$url; |
1231 | - if ($verbose) echo $cmd."\n"; |
|
1369 | + if ($verbose) |
|
1370 | + { |
|
1371 | + echo $cmd."\n"; |
|
1372 | + } |
|
1232 | 1373 | $output = $ret = null; |
1233 | 1374 | exec($cmd,$output,$ret); |
1234 | 1375 | $config['modules'] = array(); |
1235 | 1376 | foreach($output as $line) |
1236 | 1377 | { |
1237 | 1378 | $line = trim($line); |
1238 | - if (empty($line) || $line[0] == '#') continue; |
|
1379 | + if (empty($line) || $line[0] == '#') |
|
1380 | + { |
|
1381 | + continue; |
|
1382 | + } |
|
1239 | 1383 | list($path,$url) = preg_split('/[ \t\r\n]+/',$line); |
1240 | 1384 | $matches = null; |
1241 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
1385 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) |
|
1386 | + { |
|
1387 | + die("Invalid SVN URL: $url\n"); |
|
1388 | + } |
|
1242 | 1389 | $repo = $matches[1]; |
1243 | - if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
|
1390 | + if ($repo == 'http://svn.egroupware.org/egroupware') |
|
1391 | + { |
|
1392 | + $repo = 'svn+ssh://[email protected]/egroupware'; |
|
1393 | + } |
|
1244 | 1394 | $config['modules'][$repo][$path] = $url; |
1245 | 1395 | } |
1246 | 1396 | // process extra modules |
@@ -1249,13 +1399,25 @@ discard block |
||
1249 | 1399 | $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
1250 | 1400 | $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
1251 | 1401 | $url .= $module; |
1252 | - if (strpos($module,'://') !== false) $module = basename($module); |
|
1253 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
1402 | + if (strpos($module,'://') !== false) |
|
1403 | + { |
|
1404 | + $module = basename($module); |
|
1405 | + } |
|
1406 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) |
|
1407 | + { |
|
1408 | + die("Invalid SVN URL: $url\n"); |
|
1409 | + } |
|
1254 | 1410 | $repo = $matches[1]; |
1255 | - if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
|
1411 | + if ($repo == 'http://svn.egroupware.org/egroupware') |
|
1412 | + { |
|
1413 | + $repo = 'svn+ssh://[email protected]/egroupware'; |
|
1414 | + } |
|
1256 | 1415 | $config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url; |
1257 | 1416 | } |
1258 | - if ($verbose) print_r($config['modules']); |
|
1417 | + if ($verbose) |
|
1418 | + { |
|
1419 | + print_r($config['modules']); |
|
1420 | + } |
|
1259 | 1421 | return $config['modules']; |
1260 | 1422 | } |
1261 | 1423 | |
@@ -1266,7 +1428,11 @@ discard block |
||
1266 | 1428 | { |
1267 | 1429 | global $config,$svn; |
1268 | 1430 | |
1269 | - if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
1431 | + if (empty($config['svntag'])) |
|
1432 | + { |
|
1433 | + return; |
|
1434 | + } |
|
1435 | + // otherwise we copy everything in svn root! |
|
1270 | 1436 | |
1271 | 1437 | $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
1272 | 1438 | |
@@ -1305,11 +1471,17 @@ discard block |
||
1305 | 1471 | { |
1306 | 1472 | $output[] = $cmd; |
1307 | 1473 | exec($cmd,$output,$ret); |
1308 | - if ($verbose) echo implode("\n",$output)."\n"; |
|
1474 | + if ($verbose) |
|
1475 | + { |
|
1476 | + echo implode("\n",$output)."\n"; |
|
1477 | + } |
|
1309 | 1478 | } |
1310 | 1479 | if ($ret && !in_array($ret,(array)$no_bailout)) |
1311 | 1480 | { |
1312 | - if (!$verbose) echo implode("\n",$output)."\n"; |
|
1481 | + if (!$verbose) |
|
1482 | + { |
|
1483 | + echo implode("\n",$output)."\n"; |
|
1484 | + } |
|
1313 | 1485 | throw new Exception("Error during '$cmd' --> aborting",$ret); |
1314 | 1486 | } |
1315 | 1487 | return $ret; |
@@ -1355,7 +1527,10 @@ discard block |
||
1355 | 1527 | echo "options and their defaults:\n"; |
1356 | 1528 | if ($verbose) |
1357 | 1529 | { |
1358 | - if (!isset($config['modules'])) $config['modules'] = get_modules_per_repo(); |
|
1530 | + if (!isset($config['modules'])) |
|
1531 | + { |
|
1532 | + $config['modules'] = get_modules_per_repo(); |
|
1533 | + } |
|
1359 | 1534 | } |
1360 | 1535 | else |
1361 | 1536 | { |
@@ -1363,7 +1538,10 @@ discard block |
||
1363 | 1538 | } |
1364 | 1539 | foreach($config as $name => $default) |
1365 | 1540 | { |
1366 | - if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
1541 | + if (is_array($default)) |
|
1542 | + { |
|
1543 | + $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
1544 | + } |
|
1367 | 1545 | echo '--'.str_pad($name,20).$default."\n"; |
1368 | 1546 | } |
1369 | 1547 | if ($error) |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | { |
15 | 15 | die('<h1>checkout-build-archives.php must NOT be called as web-page --> exiting !!!</h1>'); |
16 | 16 | } |
17 | -date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings |
|
17 | +date_default_timezone_set('Europe/Berlin'); // to get ride of 5.3 warnings |
|
18 | 18 | |
19 | 19 | $verbose = 0; |
20 | 20 | $config = array( |
21 | 21 | 'packagename' => 'egroupware-epl', |
22 | - 'version' => '17.1', // '17.1' |
|
22 | + 'version' => '17.1', // '17.1' |
|
23 | 23 | 'packaging' => date('Ymd'), // '20160520' |
24 | - 'branch' => 'master', // checked out branch |
|
25 | - 'tag' => '$version.$packaging', // name of tag |
|
24 | + 'branch' => 'master', // checked out branch |
|
25 | + 'tag' => '$version.$packaging', // name of tag |
|
26 | 26 | 'checkoutdir' => realpath(__DIR__.'/../..'), |
27 | 27 | 'egw_buildroot' => '/tmp/build_root/epl_17.1_buildroot', |
28 | 28 | 'sourcedir' => '/home/download/stylite-epl/egroupware-epl-17.1', |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | 'svnalias' => 'aliases/default-ssh', // default alias |
35 | 35 | 'extra' => array('$stylitebase/$svnbranch/stylite', '$stylitebase/$svnbranch/esyncpro', '$stylitebase/trunk/archive'),//, '$stylitebase/$svnbranch/groups'), //,'svn+ssh://[email protected]/stylite/trunk/eventmgr'), |
36 | 36 | */ |
37 | - 'extra' => array('functions' => array('stylite'), 'esyncpro', 'archive', // create an extra archive for given apps |
|
37 | + 'extra' => array('functions' => array('stylite'), 'esyncpro', 'archive', // create an extra archive for given apps |
|
38 | 38 | // these apps are placed in egroupware-epl-contrib archive |
39 | 39 | 'contrib' => array('phpgwapi', 'etemplate', 'jdots', 'phpbrain', 'wiki', 'sambaadmin', 'sitemgr', 'phpfreechat')), |
40 | - 'aliasdir' => 'egroupware', // directory created by the alias |
|
41 | - 'types' => array('tar.bz2','tar.gz','zip','all.tar.bz2'), |
|
40 | + 'aliasdir' => 'egroupware', // directory created by the alias |
|
41 | + 'types' => array('tar.bz2', 'tar.gz', 'zip', 'all.tar.bz2'), |
|
42 | 42 | // add given extra-apps or (uncompressed!) archives to above all.tar.bz2 archive |
43 | 43 | 'all-add' => array('contrib', '/home/stylite/epl-trunk/phpfreechat_data_public.tar'), |
44 | 44 | // diverse binaries we need |
@@ -55,12 +55,12 @@ discard block |
||
55 | 55 | 'gpg' => trim(`which gpg`), |
56 | 56 | 'editor' => trim(`which vi`), |
57 | 57 | 'rsync' => trim(`which rsync`).' --progress -e ssh --exclude "*-stylite-*" --exclude "*-esyncpro-*"', |
58 | - 'composer' => ($composer=trim(`which composer.phar`)) ? $composer.' install --ignore-platform-reqs --no-dev' : '', |
|
58 | + 'composer' => ($composer = trim(`which composer.phar`)) ? $composer.' install --ignore-platform-reqs --no-dev' : '', |
|
59 | 59 | 'after-checkout' => 'rm -rf */source */templates/*/source', |
60 | 60 | 'packager' => '[email protected]', |
61 | 61 | 'obs' => '/home/stylite/obs/stylite-epl-trunk', |
62 | - 'obs_package_alias' => '', // name used in obs package, if different from packagename |
|
63 | - 'changelog' => false, // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes |
|
62 | + 'obs_package_alias' => '', // name used in obs package, if different from packagename |
|
63 | + 'changelog' => false, // eg. '* 1. Zeile\n* 2. Zeile' for debian.changes |
|
64 | 64 | 'changelog_packager' => 'Ralf Becker <[email protected]>', |
65 | 65 | 'editchangelog' => '* ', |
66 | 66 | //'sfuser' => 'ralfbecker', |
@@ -69,23 +69,23 @@ discard block |
||
69 | 69 | 'upload' => '$sourcedir/*egroupware-epl{,-contrib}-$version.$packaging*', |
70 | 70 | 'copychangelog' => '$sourcedir/README', //'$sfuser,[email protected]:/home/frs/project/e/eg/egroupware/README', |
71 | 71 | 'skip' => array(), |
72 | - 'run' => array('checkout','editchangelog','tag','copy','virusscan','create','sign','obs','copychangelog'), |
|
72 | + 'run' => array('checkout', 'editchangelog', 'tag', 'copy', 'virusscan', 'create', 'sign', 'obs', 'copychangelog'), |
|
73 | 73 | 'patchCmd' => '# run cmd after copy eg. "cd $egw_buildroot; patch -p1 /path/to/patch"', |
74 | - 'github_user' => 'ralfbecker', // Github user for following token |
|
75 | - 'github_token' => '', // Github repo personal access token from above user |
|
74 | + 'github_user' => 'ralfbecker', // Github user for following token |
|
75 | + 'github_token' => '', // Github repo personal access token from above user |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | // process config from command line |
79 | 79 | $argv = $_SERVER['argv']; |
80 | 80 | $prog = array_shift($argv); |
81 | 81 | |
82 | -while(($arg = array_shift($argv))) |
|
82 | +while (($arg = array_shift($argv))) |
|
83 | 83 | { |
84 | 84 | if ($arg == '-v' || $arg == '--verbose') |
85 | 85 | { |
86 | 86 | ++$verbose; |
87 | 87 | } |
88 | - elseif($arg == '-h' || $arg == '--help') |
|
88 | + elseif ($arg == '-h' || $arg == '--help') |
|
89 | 89 | { |
90 | 90 | if (in_array('editchangelog', $config['skip']) || !in_array('editchangelog', $config['run'])) |
91 | 91 | { |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | } |
94 | 94 | usage(); |
95 | 95 | } |
96 | - elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)])) |
|
96 | + elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)])) |
|
97 | 97 | { |
98 | 98 | $value = array_shift($argv); |
99 | - switch($name) |
|
99 | + switch ($name) |
|
100 | 100 | { |
101 | 101 | case 'extra': // stored as array and allow to add/delete items with +/- prefix |
102 | 102 | case 'types': |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | { |
120 | 120 | $value = array_unique(preg_split('/[ ,]+/', $value)); |
121 | 121 | } |
122 | - switch($op) |
|
122 | + switch ($op) |
|
123 | 123 | { |
124 | 124 | case '+': |
125 | 125 | $config[$name] = array_unique(array_merge($config[$name], $value)); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | case 'release': |
138 | 138 | case 'copychangelog': |
139 | 139 | $config[$name] = $value; |
140 | - if ($value) array_unshift($config['run'],$name); |
|
140 | + if ($value) array_unshift($config['run'], $name); |
|
141 | 141 | break; |
142 | 142 | |
143 | 143 | case 'editchangelog': |
144 | 144 | $config[$name] = $value ? $value : true; |
145 | - if (!in_array('editchangelog',$config['run'])) |
|
145 | + if (!in_array('editchangelog', $config['run'])) |
|
146 | 146 | { |
147 | - array_unshift($config['run'],'editchangelog'); |
|
147 | + array_unshift($config['run'], 'editchangelog'); |
|
148 | 148 | } |
149 | 149 | break; |
150 | 150 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | usage("Path '$value' not found!"); |
155 | 155 | } |
156 | - if (!in_array('obs',$config['run'])) $config['run'][] = 'obs'; |
|
156 | + if (!in_array('obs', $config['run'])) $config['run'][] = 'obs'; |
|
157 | 157 | // fall through |
158 | 158 | default: |
159 | 159 | $config[$name] = $value; |
@@ -171,16 +171,16 @@ discard block |
||
171 | 171 | } |
172 | 172 | $svn = $config['svn']; |
173 | 173 | |
174 | -$run = array_diff($config['run'],$config['skip']); |
|
174 | +$run = array_diff($config['run'], $config['skip']); |
|
175 | 175 | |
176 | 176 | // if we dont edit the changelog, set packaging from changelog |
177 | 177 | if (!in_array('editchangelog', $run)) |
178 | 178 | { |
179 | 179 | parse_current_changelog(true); |
180 | 180 | } |
181 | -foreach($run as $func) |
|
181 | +foreach ($run as $func) |
|
182 | 182 | { |
183 | - chdir(dirname(__FILE__)); // make relative filenames work, if other command changes dir |
|
183 | + chdir(dirname(__FILE__)); // make relative filenames work, if other command changes dir |
|
184 | 184 | call_user_func('do_'.$func); |
185 | 185 | } |
186 | 186 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages |
196 | 196 | * @return string with changelog |
197 | 197 | */ |
198 | -function get_changelog_from_git($_path, $log_pattern=null, &$last_tag=null, $prefix='* ') |
|
198 | +function get_changelog_from_git($_path, $log_pattern = null, &$last_tag = null, $prefix = '* ') |
|
199 | 199 | { |
200 | 200 | //echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n"; |
201 | 201 | global $config; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $output = null; |
218 | 218 | run_cmd($cmd, $output); |
219 | 219 | |
220 | - foreach($output as $line) |
|
220 | + foreach ($output as $line) |
|
221 | 221 | { |
222 | 222 | if (substr($line, 0, 4) == " " && ($msg = _match_log_pattern(substr($line, 4), $log_pattern, $prefix))) |
223 | 223 | { |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | { |
251 | 251 | throw new Exception("checkout directory '{$config['checkoutdir']} does NOT exists or is NO directory!"); |
252 | 252 | } |
253 | - if (!($mrconfig = file_get_contents($path=$config['checkoutdir'].'/.mrconfig'))) |
|
253 | + if (!($mrconfig = file_get_contents($path = $config['checkoutdir'].'/.mrconfig'))) |
|
254 | 254 | { |
255 | 255 | throw new Exception("$path not found!"); |
256 | 256 | } |
257 | 257 | $module = $baseurl = null; |
258 | 258 | $modules = array(); |
259 | - foreach(explode("\n", $mrconfig) as $line) |
|
259 | + foreach (explode("\n", $mrconfig) as $line) |
|
260 | 260 | { |
261 | 261 | $matches = null; |
262 | 262 | if (isset($baseurl)) |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $cmd = $config['git'].' clone '.(!empty($config['branch']) ? ' -b '.$config['branch'] : ''). |
323 | 323 | ' [email protected]:EGroupware/egroupware.git '.$config['checkoutdir']; |
324 | 324 | run_cmd($cmd); |
325 | - run_cmd('mr up'); // need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!) |
|
325 | + run_cmd('mr up'); // need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!) |
|
326 | 326 | } |
327 | 327 | elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir'])) |
328 | 328 | { |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | } |
347 | 347 | chdir($config['checkoutdir']); |
348 | 348 | |
349 | - $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
|
349 | + $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
|
350 | 350 | |
351 | - if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
351 | + if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
352 | 352 | |
353 | 353 | echo "Creating tag $config[tag]\n"; |
354 | 354 | |
@@ -361,16 +361,16 @@ discard block |
||
361 | 361 | */ |
362 | 362 | function do_release() |
363 | 363 | { |
364 | - global $config,$verbose; |
|
364 | + global $config, $verbose; |
|
365 | 365 | |
366 | 366 | // push local changes to Github incl. tags |
367 | 367 | if ($verbose) echo "Pushing changes and tags\n"; |
368 | 368 | chdir($config['checkoutdir']); |
369 | - run_cmd($config['mr']. ' up'); // in case someone else pushed something |
|
369 | + run_cmd($config['mr'].' up'); // in case someone else pushed something |
|
370 | 370 | chdir($config['checkoutdir']); |
371 | - run_cmd($config['git'].' push'); // regular commits like changelog |
|
371 | + run_cmd($config['git'].' push'); // regular commits like changelog |
|
372 | 372 | $tag = config_translate('tag'); |
373 | - run_cmd($config['mr']. ' push origin '.$tag); // pushing tags in all apps |
|
373 | + run_cmd($config['mr'].' push origin '.$tag); // pushing tags in all apps |
|
374 | 374 | |
375 | 375 | if (empty($config['github_user']) || empty($config['github_token'])) |
376 | 376 | { |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | 'body' => $config['changelog'], |
388 | 388 | ); |
389 | 389 | $response = github_api("/repos/EGroupware/egroupware/releases", $data); |
390 | - $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template |
|
390 | + $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template |
|
391 | 391 | |
392 | 392 | do_upload(); |
393 | 393 | } |
@@ -397,33 +397,33 @@ discard block |
||
397 | 397 | */ |
398 | 398 | function do_upload() |
399 | 399 | { |
400 | - global $config,$verbose; |
|
400 | + global $config, $verbose; |
|
401 | 401 | |
402 | 402 | if (empty($config['upload_url'])) |
403 | 403 | { |
404 | 404 | $response = github_api("/repos/EGroupware/egroupware/releases", array(), 'GET'); |
405 | - $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template |
|
405 | + $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | $archives = config_translate('upload'); |
409 | 409 | echo "Uploading $archives to $config[upload_url]\n"; |
410 | 410 | |
411 | - foreach(glob($archives, GLOB_BRACE) as $path) |
|
411 | + foreach (glob($archives, GLOB_BRACE) as $path) |
|
412 | 412 | { |
413 | 413 | $label = null; |
414 | 414 | if (substr($path, -4) == '.zip') |
415 | 415 | { |
416 | 416 | $content_type = 'application/zip'; |
417 | 417 | } |
418 | - elseif(substr($path, -7) == '.tar.gz') |
|
418 | + elseif (substr($path, -7) == '.tar.gz') |
|
419 | 419 | { |
420 | 420 | $content_type = 'application/x-gzip'; |
421 | 421 | } |
422 | - elseif(substr($path, -8) == '.tar.bz2') |
|
422 | + elseif (substr($path, -8) == '.tar.bz2') |
|
423 | 423 | { |
424 | 424 | $content_type = 'application/x-bzip2'; |
425 | 425 | } |
426 | - elseif(substr($path, -8) == '.txt.asc') |
|
426 | + elseif (substr($path, -8) == '.txt.asc') |
|
427 | 427 | { |
428 | 428 | $content_type = 'text/plain'; |
429 | 429 | $label = 'Signed hashes of downloads'; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | if (!empty($config['release'])) |
444 | 444 | { |
445 | - $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
|
445 | + $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
|
446 | 446 | $cmd = $config['rsync'].' '.$archives.' '.$target; |
447 | 447 | if ($verbose) echo $cmd."\n"; |
448 | 448 | passthru($cmd); |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * @throws Exception |
461 | 461 | * @return array with response |
462 | 462 | */ |
463 | -function github_api($_url, $data, $method='POST', $upload=null, $content_type=null) |
|
463 | +function github_api($_url, $data, $method = 'POST', $upload = null, $content_type = null) |
|
464 | 464 | { |
465 | 465 | global $config, $verbose; |
466 | 466 | |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | curl_setopt($c, CURLOPT_TIMEOUT, 240); |
474 | 474 | curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); |
475 | 475 | |
476 | - switch($method) |
|
476 | + switch ($method) |
|
477 | 477 | { |
478 | 478 | case 'POST': |
479 | 479 | curl_setopt($c, CURLOPT_POST, true); |
@@ -481,13 +481,13 @@ discard block |
||
481 | 481 | curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
482 | 482 | break; |
483 | 483 | case 'GET': |
484 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
484 | + if (count($data)) $url .= '?'.http_build_query($data); |
|
485 | 485 | break; |
486 | 486 | case 'FILE': |
487 | 487 | curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type")); |
488 | 488 | curl_setopt($c, CURLOPT_POST, true); |
489 | 489 | curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload)); |
490 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
490 | + if (count($data)) $url .= '?'.http_build_query($data); |
|
491 | 491 | break; |
492 | 492 | default: |
493 | 493 | throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!"); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | curl_setopt($c, CURLOPT_URL, $url); |
496 | 496 | |
497 | 497 | if (is_string($data)) $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
498 | - if ($verbose) echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
498 | + if ($verbose) echo "Sending $method request to $url ".(isset($short_data) && $method != 'GET' ? $short_data : '')."\n"; |
|
499 | 499 | |
500 | 500 | if (($response = curl_exec($c)) === false) |
501 | 501 | { |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | curl_setopt($c, CURLOPT_HEADER, true); |
504 | 504 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
505 | 505 | curl_exec($c); |
506 | - throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
506 | + throw new Exception("$method request to $url failed ".(isset($short_data) && $method != 'GET' ? $short_data : '')); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | * @param string $name |
520 | 520 | * @param string $value =null value to use, default $config[$name] |
521 | 521 | */ |
522 | -function config_translate($name, $value=null) |
|
522 | +function config_translate($name, $value = null) |
|
523 | 523 | { |
524 | 524 | global $config; |
525 | 525 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | if (is_string($value) && strpos($value, '$') !== false) |
528 | 528 | { |
529 | 529 | $translate = array(); |
530 | - foreach($config as $n => $val) |
|
530 | + foreach ($config as $n => $val) |
|
531 | 531 | { |
532 | 532 | if (is_string($val)) $translate['$'.$n] = $val; |
533 | 533 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | */ |
554 | 554 | function do_editchangelog() |
555 | 555 | { |
556 | - global $config,$svn; |
|
556 | + global $config, $svn; |
|
557 | 557 | |
558 | 558 | echo "Querying changelog from Git/SVN\n"; |
559 | 559 | if (!isset($config['modules'])) |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | // query changelog per repo |
564 | 564 | $changelog = ''; |
565 | 565 | $last_tag = null; |
566 | - foreach($config['modules'] as $branch_url => $modules) |
|
566 | + foreach ($config['modules'] as $branch_url => $modules) |
|
567 | 567 | { |
568 | 568 | $revision = null; |
569 | 569 | if (substr($branch_url, -4) == '.git') |
@@ -580,15 +580,15 @@ discard block |
||
580 | 580 | { |
581 | 581 | $changelog = "Could not query changelog for $config[version], eg. no last tag found!\n"; |
582 | 582 | } |
583 | - $logfile = tempnam('/tmp','checkout-build-archives'); |
|
584 | - file_put_contents($logfile,$changelog); |
|
583 | + $logfile = tempnam('/tmp', 'checkout-build-archives'); |
|
584 | + file_put_contents($logfile, $changelog); |
|
585 | 585 | $cmd = $config['editor'].' '.escapeshellarg($logfile); |
586 | 586 | passthru($cmd); |
587 | 587 | $config['changelog'] = file_get_contents($logfile); |
588 | 588 | // remove trailing newlines |
589 | - while (substr($config['changelog'],-1) == "\n") |
|
589 | + while (substr($config['changelog'], -1) == "\n") |
|
590 | 590 | { |
591 | - $config['changelog'] = substr($config['changelog'],0,-1); |
|
591 | + $config['changelog'] = substr($config['changelog'], 0, -1); |
|
592 | 592 | } |
593 | 593 | // allow user to abort, by deleting the changelog |
594 | 594 | if (strlen($config['changelog']) <= 2) |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | } |
604 | 604 | file_put_contents($changelog, update_changelog(file_get_contents($changelog))); |
605 | 605 | |
606 | - update_api_setup($api_setup=$config['checkoutdir'].'/api/setup/setup.inc.php'); |
|
606 | + update_api_setup($api_setup = $config['checkoutdir'].'/api/setup/setup.inc.php'); |
|
607 | 607 | |
608 | 608 | if (file_exists($config['checkoutdir'].'/.git')) |
609 | 609 | { |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | run_cmd($cmd); |
617 | 617 | |
618 | 618 | // update obs changelogs (so all changlogs are updated in case of a later error and changelog step can be skiped) |
619 | - do_obs(true); // true: only update debian.changes in obs checkouts |
|
619 | + do_obs(true); // true: only update debian.changes in obs checkouts |
|
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
@@ -630,41 +630,41 @@ discard block |
||
630 | 630 | * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages |
631 | 631 | * @return string with changelog |
632 | 632 | */ |
633 | -function get_changelog_from_svn($branch_url, $log_pattern=null, &$revision=null, $prefix='* ') |
|
633 | +function get_changelog_from_svn($branch_url, $log_pattern = null, &$revision = null, $prefix = '* ') |
|
634 | 634 | { |
635 | 635 | //echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n"; |
636 | - global $config,$verbose,$svn; |
|
636 | + global $config, $verbose, $svn; |
|
637 | 637 | |
638 | 638 | if (is_null($revision)) |
639 | 639 | { |
640 | - list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url); |
|
640 | + list($tags_url, $branch) = preg_split('#/(branches/|trunk)#', $branch_url); |
|
641 | 641 | if (empty($branch)) $branch = $config['version']; |
642 | 642 | $tags_url .= '/tags'; |
643 | - $pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
|
643 | + $pattern = '|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
|
644 | 644 | $matches = null; |
645 | - $revision = get_last_svn_tag($tags_url,$pattern,$matches); |
|
645 | + $revision = get_last_svn_tag($tags_url, $pattern, $matches); |
|
646 | 646 | $tag = $matches[1]; |
647 | 647 | } |
648 | - elseif(!is_numeric($revision)) |
|
648 | + elseif (!is_numeric($revision)) |
|
649 | 649 | { |
650 | - $revision = get_last_svn_tag($tags_url,$tag=$revision); |
|
650 | + $revision = get_last_svn_tag($tags_url, $tag = $revision); |
|
651 | 651 | } |
652 | 652 | $cmd = $svn.' log --xml -r '.escapeshellarg($revision.':HEAD').' '.escapeshellarg($branch_url); |
653 | 653 | if (($v = $verbose)) |
654 | 654 | { |
655 | 655 | echo "Querying SVN for log from r$revision".($tag ? " ($tag)" : '').":\n$cmd\n"; |
656 | - $verbose = false; // otherwise no $output! |
|
656 | + $verbose = false; // otherwise no $output! |
|
657 | 657 | } |
658 | 658 | $output = array(); |
659 | - run_cmd($cmd,$output); |
|
659 | + run_cmd($cmd, $output); |
|
660 | 660 | $verbose = $v; |
661 | - array_shift($output); // remove the command |
|
661 | + array_shift($output); // remove the command |
|
662 | 662 | |
663 | - $xml = simplexml_load_string($output=implode("\n",$output)); |
|
663 | + $xml = simplexml_load_string($output = implode("\n", $output)); |
|
664 | 664 | $message = ''; |
665 | - foreach($xml as $log) |
|
665 | + foreach ($xml as $log) |
|
666 | 666 | { |
667 | - if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
667 | + if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
668 | 668 | |
669 | 669 | $message .= $msg."\n"; |
670 | 670 | } |
@@ -681,25 +681,25 @@ discard block |
||
681 | 681 | * @param string $prefix ='* ' |
682 | 682 | * @return string |
683 | 683 | */ |
684 | -function _match_log_pattern($msg, $log_pattern, $prefix='* ') |
|
684 | +function _match_log_pattern($msg, $log_pattern, $prefix = '* ') |
|
685 | 685 | { |
686 | 686 | $pattern_len = strlen($log_pattern); |
687 | 687 | $prefix_len = strlen($prefix); |
688 | 688 | |
689 | 689 | $matches = null; |
690 | - if ($log_pattern[0] == '/' && preg_match($log_pattern,$msg,$matches)) |
|
690 | + if ($log_pattern[0] == '/' && preg_match($log_pattern, $msg, $matches)) |
|
691 | 691 | { |
692 | 692 | $msg = $matches[1]; |
693 | 693 | } |
694 | - elseif($log_pattern && $log_pattern[0] != '/' && substr($msg,0,$pattern_len) == $log_pattern) |
|
694 | + elseif ($log_pattern && $log_pattern[0] != '/' && substr($msg, 0, $pattern_len) == $log_pattern) |
|
695 | 695 | { |
696 | - list($msg) = explode("\n",$msg); |
|
696 | + list($msg) = explode("\n", $msg); |
|
697 | 697 | } |
698 | - elseif($log_pattern) |
|
698 | + elseif ($log_pattern) |
|
699 | 699 | { |
700 | 700 | return null; |
701 | 701 | } |
702 | - if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg; |
|
702 | + if ($prefix_len && substr($msg, 0, $prefix_len) != $prefix) $msg = $prefix.$msg; |
|
703 | 703 | |
704 | 704 | return $msg; |
705 | 705 | } |
@@ -713,30 +713,30 @@ discard block |
||
713 | 713 | * @param array &$matches=null on return matches of preg_match |
714 | 714 | * @return int revision of last svn tag matching pattern |
715 | 715 | */ |
716 | -function get_last_svn_tag($tags_url,$pattern,&$matches=null) |
|
716 | +function get_last_svn_tag($tags_url, $pattern, &$matches = null) |
|
717 | 717 | { |
718 | - global $verbose,$svn; |
|
718 | + global $verbose, $svn; |
|
719 | 719 | |
720 | 720 | $cmd = $svn.' log --xml --limit 40 -v '.escapeshellarg($tags_url); |
721 | 721 | if (($v = $verbose)) |
722 | 722 | { |
723 | 723 | echo "Querying SVN for last tags\n$cmd\n"; |
724 | - $verbose = false; // otherwise no $output! |
|
724 | + $verbose = false; // otherwise no $output! |
|
725 | 725 | } |
726 | 726 | $output = array(); |
727 | - run_cmd($cmd,$output); |
|
727 | + run_cmd($cmd, $output); |
|
728 | 728 | $verbose = $v; |
729 | - array_shift($output); // remove the command |
|
729 | + array_shift($output); // remove the command |
|
730 | 730 | |
731 | - $xml = simplexml_load_string($output=implode("\n",$output)); |
|
731 | + $xml = simplexml_load_string($output = implode("\n", $output)); |
|
732 | 732 | $is_regexp = $pattern[0] == substr($pattern, -1); |
733 | - foreach($xml as $log) |
|
733 | + foreach ($xml as $log) |
|
734 | 734 | { |
735 | 735 | //print_r($log); |
736 | 736 | if (!$is_regexp && strpos($log->paths->path, $pattern) !== false || |
737 | 737 | $is_regexp && preg_match($pattern, $log->paths->path, $matches)) |
738 | 738 | { |
739 | - if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
739 | + if ($verbose) echo "Revision {$log['revision']} matches".($matches ? ': '.$matches[1] : '')."\n"; |
|
740 | 740 | return (int)$log['revision']; |
741 | 741 | } |
742 | 742 | } |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | * |
749 | 749 | * @param boolean $only_update_changelog =false true update debian.changes, but nothing else, nor commit it |
750 | 750 | */ |
751 | -function do_obs($only_update_changelog=false) |
|
751 | +function do_obs($only_update_changelog = false) |
|
752 | 752 | { |
753 | - global $config,$verbose; |
|
753 | + global $config, $verbose; |
|
754 | 754 | |
755 | 755 | if (!is_dir($config['obs'])) |
756 | 756 | { |
@@ -760,25 +760,25 @@ discard block |
||
760 | 760 | run_cmd('osc up '.$config['obs']); |
761 | 761 | |
762 | 762 | $n = 0; |
763 | - foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path) |
|
763 | + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path) |
|
764 | 764 | { |
765 | 765 | if (basename(dirname($path)) == '.osc' || |
766 | 766 | !preg_match('/\/('.preg_quote($config['packagename']). |
767 | 767 | ($config['obs_package_alias'] ? '|'.preg_quote($config['obs_package_alias']) : ''). |
768 | - ')[a-z-]*-('.preg_quote($config['version']).'|trunk)/',$path)) |
|
768 | + ')[a-z-]*-('.preg_quote($config['version']).'|trunk)/', $path)) |
|
769 | 769 | { |
770 | 770 | continue; |
771 | 771 | } |
772 | 772 | $matches = null; |
773 | - if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/',$path,$matches) && |
|
774 | - file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2])) |
|
773 | + if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/', $path, $matches) && |
|
774 | + file_exists($new_name = $config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2])) |
|
775 | 775 | { |
776 | 776 | if (basename($path) != basename($new_name)) |
777 | 777 | { |
778 | 778 | unlink($path); |
779 | 779 | if ($verbose) echo "rm $path\n"; |
780 | 780 | } |
781 | - copy($new_name,dirname($path).'/'.basename($new_name)); |
|
781 | + copy($new_name, dirname($path).'/'.basename($new_name)); |
|
782 | 782 | if ($verbose) echo "cp $new_name ".dirname($path)."/\n"; |
783 | 783 | ++$n; |
784 | 784 | } |
@@ -788,35 +788,35 @@ discard block |
||
788 | 788 | $config['changelog'] = parse_current_changelog(); |
789 | 789 | } |
790 | 790 | // updating dsc, spec and changelog files |
791 | - if (!$only_update_changelog && (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') || |
|
791 | + if (!$only_update_changelog && (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') || |
|
792 | 792 | !empty($config['changelog']) && basename($path) == 'debian.changes') |
793 | 793 | { |
794 | 794 | $content = $content_was = file_get_contents($path); |
795 | 795 | |
796 | - if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') |
|
796 | + if (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') |
|
797 | 797 | { |
798 | - $content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m','Version: '.$config['version'].'.'.$config['packaging'],$content); |
|
798 | + $content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m', 'Version: '.$config['version'].'.'.$config['packaging'], $content); |
|
799 | 799 | } |
800 | - if (substr($path,-4) == '.dsc') |
|
800 | + if (substr($path, -4) == '.dsc') |
|
801 | 801 | { |
802 | 802 | $content = preg_replace('/^(Debtransform-Tar: '.preg_quote($config['packagename']).'[a-z-]*)-'. |
803 | 803 | preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/m', |
804 | - '\\1-'.$config['version'].'.'.$config['packaging'].'\\2',$content); |
|
804 | + '\\1-'.$config['version'].'.'.$config['packaging'].'\\2', $content); |
|
805 | 805 | } |
806 | - if (basename($path) == 'debian.changes' && strpos($content,$config['version'].'.'.$config['packaging']) === false) |
|
806 | + if (basename($path) == 'debian.changes' && strpos($content, $config['version'].'.'.$config['packaging']) === false) |
|
807 | 807 | { |
808 | 808 | $content = update_changelog($content); |
809 | 809 | } |
810 | - if (!empty($config['changelog']) && substr($path,-5) == '.spec' && |
|
811 | - ($pos_changelog = strpos($content,'%changelog')) !== false) |
|
810 | + if (!empty($config['changelog']) && substr($path, -5) == '.spec' && |
|
811 | + ($pos_changelog = strpos($content, '%changelog')) !== false) |
|
812 | 812 | { |
813 | 813 | $pos_changelog += strlen("%changelog\n"); |
814 | - $content = substr($content,0,$pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n". |
|
815 | - $config['changelog']."\n".substr($content,$pos_changelog); |
|
814 | + $content = substr($content, 0, $pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n". |
|
815 | + $config['changelog']."\n".substr($content, $pos_changelog); |
|
816 | 816 | } |
817 | 817 | if ($content != $content_was) |
818 | 818 | { |
819 | - file_put_contents($path,$content); |
|
819 | + file_put_contents($path, $content); |
|
820 | 820 | if ($verbose) echo "Updated $path\n"; |
821 | 821 | ++$n; |
822 | 822 | } |
@@ -837,33 +837,33 @@ discard block |
||
837 | 837 | * @param boolean $set_packaging =false true: set packaging from last changelog entry |
838 | 838 | * @return string changelog entries without header and footer lines |
839 | 839 | */ |
840 | -function parse_current_changelog($set_packaging=false) |
|
840 | +function parse_current_changelog($set_packaging = false) |
|
841 | 841 | { |
842 | 842 | global $config; |
843 | 843 | |
844 | 844 | $changelog = file_get_contents($config['checkoutdir'].'/doc/rpm-build/debian.changes'); |
845 | 845 | $lines = explode("\n", $changelog, 100); |
846 | 846 | $matches = null; |
847 | - foreach($lines as $n => $line) |
|
847 | + foreach ($lines as $n => $line) |
|
848 | 848 | { |
849 | - if (preg_match($preg='/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'. |
|
849 | + if (preg_match($preg = '/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'. |
|
850 | 850 | ($set_packaging ? '([0-9]+)' : preg_quote($config['packaging'])).'/', $line, $matches)) |
851 | 851 | { |
852 | 852 | if ($set_packaging) |
853 | 853 | { |
854 | 854 | $config['packaging'] = $matches[1]; |
855 | 855 | } |
856 | - $n += empty($lines[$n+1]) ? 2 : 1; // overead empty line behind header |
|
856 | + $n += empty($lines[$n + 1]) ? 2 : 1; // overead empty line behind header |
|
857 | 857 | $logentry = ''; |
858 | - while($lines[$n]) // entry is terminated by empty line |
|
858 | + while ($lines[$n]) // entry is terminated by empty line |
|
859 | 859 | { |
860 | 860 | $logentry .= (substr($lines[$n], 0, 2) == ' ' ? substr($lines[$n], 2) : $lines[$n])."\n"; |
861 | 861 | ++$n; |
862 | 862 | } |
863 | - return substr($logentry, 0, -1); // remove training "\n" |
|
863 | + return substr($logentry, 0, -1); // remove training "\n" |
|
864 | 864 | } |
865 | 865 | } |
866 | - return null; // paragraph for current version NOT found |
|
866 | + return null; // paragraph for current version NOT found |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | /** |
@@ -877,8 +877,8 @@ discard block |
||
877 | 877 | global $config; |
878 | 878 | |
879 | 879 | list($header) = explode("\n", $content); |
880 | - $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
|
881 | - if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
880 | + $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/', '('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
|
881 | + if (substr($config['changelog'], 0, 2) != ' ') $config['changelog'] = ' '.implode("\n ", explode("\n", $config['changelog'])); |
|
882 | 882 | $content = $new_header."\n\n".$config['changelog']. |
883 | 883 | "\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content; |
884 | 884 | |
@@ -916,9 +916,9 @@ discard block |
||
916 | 916 | { |
917 | 917 | global $config; |
918 | 918 | |
919 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
919 | + if (substr($config['sourcedir'], 0, 2) == '~/') // sha1_file cant deal with '~/rpm' |
|
920 | 920 | { |
921 | - $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
|
921 | + $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1); |
|
922 | 922 | } |
923 | 923 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
924 | 924 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc'); |
938 | 938 | $cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile; |
939 | 939 | run_cmd($cmd); |
940 | - unlink($sumsfile); // delete the unsigned file |
|
940 | + unlink($sumsfile); // delete the unsigned file |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | /** |
@@ -947,22 +947,22 @@ discard block |
||
947 | 947 | { |
948 | 948 | global $config; |
949 | 949 | |
950 | - if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true); |
|
951 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
950 | + if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'], 0755, true); |
|
951 | + if (substr($config['sourcedir'], 0, 2) == '~/') // sha1_file cant deal with '~/rpm' |
|
952 | 952 | { |
953 | - $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
|
953 | + $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1); |
|
954 | 954 | } |
955 | 955 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
956 | 956 | $sums = ''; |
957 | 957 | |
958 | 958 | chdir($config['egw_buildroot']); |
959 | 959 | |
960 | - if($config['extra']) |
|
960 | + if ($config['extra']) |
|
961 | 961 | { |
962 | 962 | $exclude = $exclude_all = array(); |
963 | - foreach($config['extra'] as $name => $modules) |
|
963 | + foreach ($config['extra'] as $name => $modules) |
|
964 | 964 | { |
965 | - foreach((array)$modules as $module) |
|
965 | + foreach ((array)$modules as $module) |
|
966 | 966 | { |
967 | 967 | $exclude[] = basename($module); |
968 | 968 | if (!empty($config['all-add']) && !in_array($module, $config['all-add']) && (is_int($name) || !in_array($name, $config['all-add']))) |
@@ -972,24 +972,24 @@ discard block |
||
972 | 972 | } |
973 | 973 | } |
974 | 974 | $exclude_extra = ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude); |
975 | - $exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : ''; |
|
975 | + $exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : ''; |
|
976 | 976 | } |
977 | - foreach($config['types'] as $type) |
|
977 | + foreach ($config['types'] as $type) |
|
978 | 978 | { |
979 | 979 | echo "Creating $type archives\n"; |
980 | 980 | $tar_type = $type == 'tar.bz2' ? 'j' : 'z'; |
981 | 981 | |
982 | 982 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
983 | - switch($type) |
|
983 | + switch ($type) |
|
984 | 984 | { |
985 | 985 | case 'all.tar.bz2': // single tar-ball for debian builds not easily supporting to use multiple |
986 | 986 | $file = $config['sourcedir'].'/'.$config['packagename'].'-all-'.$config['version'].'.'.$config['packaging'].'.tar'; |
987 | 987 | $cmd = $config['tar'].' --owner=root --group=root -cf '.$file.$exclude_all_extra.' egroupware'; |
988 | 988 | if (!empty($config['all-add'])) |
989 | 989 | { |
990 | - foreach((array)$config['all-add'] as $add) |
|
990 | + foreach ((array)$config['all-add'] as $add) |
|
991 | 991 | { |
992 | - if (substr($add, -4) != '.tar') continue; // probably a module |
|
992 | + if (substr($add, -4) != '.tar') continue; // probably a module |
|
993 | 993 | if (!($tar = realpath($add))) throw new Exception("File '$add' not found!"); |
994 | 994 | $cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar; |
995 | 995 | } |
@@ -1013,15 +1013,15 @@ discard block |
||
1013 | 1013 | run_cmd($cmd); |
1014 | 1014 | $sums .= sha1_file($file)."\t".basename($file)."\n"; |
1015 | 1015 | |
1016 | - foreach($config['extra'] as $name => $modules) |
|
1016 | + foreach ($config['extra'] as $name => $modules) |
|
1017 | 1017 | { |
1018 | 1018 | if (is_numeric($name)) $name = $modules; |
1019 | 1019 | $dirs = ' egroupware/'.implode(' egroupware/', (array)$modules); |
1020 | 1020 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
1021 | - switch($type) |
|
1021 | + switch ($type) |
|
1022 | 1022 | { |
1023 | 1023 | case 'all.tar.bz2': |
1024 | - break; // nothing to do |
|
1024 | + break; // nothing to do |
|
1025 | 1025 | case 'tar.bz2': |
1026 | 1026 | case 'tar.gz': |
1027 | 1027 | $cmd = $config['tar'].' --owner=root --group=root -c'.$tar_type.'f '.$file.$dirs; |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | } |
1037 | 1037 | } |
1038 | 1038 | // writing sha1sum file |
1039 | - file_put_contents($sumsfile,$sums); |
|
1039 | + file_put_contents($sumsfile, $sums); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | /** |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | */ |
1045 | 1045 | function do_virusscan() |
1046 | 1046 | { |
1047 | - global $config,$verbose; |
|
1047 | + global $config, $verbose; |
|
1048 | 1048 | |
1049 | 1049 | if (!file_exists($config['clamscan']) || !is_executable($config['clamscan'])) |
1050 | 1050 | { |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | $cmd = '/usr/bin/sudo '.$config['freshclam']; |
1059 | 1059 | if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n"; |
1060 | 1060 | $output = null; |
1061 | - run_cmd($cmd,$output,1); // 1 = ignore already up to date database |
|
1061 | + run_cmd($cmd, $output, 1); // 1 = ignore already up to date database |
|
1062 | 1062 | } |
1063 | 1063 | echo "Starting virusscan\n"; |
1064 | 1064 | $cmd = $config['clamscan'].' --quiet -r '.$config['egw_buildroot']; |
@@ -1115,12 +1115,12 @@ discard block |
||
1115 | 1115 | */ |
1116 | 1116 | function do_svncheckout() |
1117 | 1117 | { |
1118 | - global $config,$svn; |
|
1118 | + global $config, $svn; |
|
1119 | 1119 | |
1120 | 1120 | echo "Starting svn checkout/update\n"; |
1121 | 1121 | if (!file_exists($config['checkoutdir'])) |
1122 | 1122 | { |
1123 | - mkdir($config['checkoutdir'],0755,true); |
|
1123 | + mkdir($config['checkoutdir'], 0755, true); |
|
1124 | 1124 | } |
1125 | 1125 | elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir'])) |
1126 | 1126 | { |
@@ -1135,17 +1135,17 @@ discard block |
||
1135 | 1135 | { |
1136 | 1136 | get_modules_per_repo(); |
1137 | 1137 | } |
1138 | - $config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name |
|
1138 | + $config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name |
|
1139 | 1139 | |
1140 | 1140 | if (file_exists($config['aliasdir'])) |
1141 | 1141 | { |
1142 | - system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags |
|
1142 | + system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags |
|
1143 | 1143 | clearstatcache(); |
1144 | 1144 | } |
1145 | - foreach($config['modules'] as $repo => $modules) |
|
1145 | + foreach ($config['modules'] as $repo => $modules) |
|
1146 | 1146 | { |
1147 | 1147 | $cmd = $svn.' co '; |
1148 | - foreach($modules as $path => $url) |
|
1148 | + foreach ($modules as $path => $url) |
|
1149 | 1149 | { |
1150 | 1150 | if ($path == $config['aliasdir']) |
1151 | 1151 | { |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $cmd = $svn.' co '; |
1156 | 1156 | continue; |
1157 | 1157 | } |
1158 | - if(file_exists($config['aliasdir'])) |
|
1158 | + if (file_exists($config['aliasdir'])) |
|
1159 | 1159 | { |
1160 | 1160 | die("'egroupware' applications must be first one in externals!\n"); |
1161 | 1161 | } |
@@ -1173,16 +1173,16 @@ discard block |
||
1173 | 1173 | // check if correct branch |
1174 | 1174 | $cmd = 'LANG=C '.$svn.' info'; |
1175 | 1175 | $output = $ret = null; |
1176 | - exec($cmd,$output,$ret); |
|
1177 | - foreach($output as $line) |
|
1176 | + exec($cmd, $output, $ret); |
|
1177 | + foreach ($output as $line) |
|
1178 | 1178 | { |
1179 | - if ($ret || substr($line,0,5) == 'URL: ') |
|
1179 | + if ($ret || substr($line, 0, 5) == 'URL: ') |
|
1180 | 1180 | { |
1181 | - $url = substr($line,5); |
|
1182 | - if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
1181 | + $url = substr($line, 5); |
|
1182 | + if ($ret || substr($url, 0, strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
1183 | 1183 | { |
1184 | 1184 | echo "Checkout is of wrong branch --> deleting it\n"; |
1185 | - system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
|
1185 | + system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
|
1186 | 1186 | clearstatcache(); |
1187 | 1187 | } |
1188 | 1188 | break; |
@@ -1194,10 +1194,10 @@ discard block |
||
1194 | 1194 | run_cmd($cmd); |
1195 | 1195 | |
1196 | 1196 | chdir($config['aliasdir']); |
1197 | - foreach($config['extra'] as $module) |
|
1197 | + foreach ($config['extra'] as $module) |
|
1198 | 1198 | { |
1199 | - $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
1200 | - $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
|
1199 | + $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
1200 | + $url = strpos($module, '://') === false ? $svnbranch.'/' : ''; |
|
1201 | 1201 | $url .= $module; |
1202 | 1202 | $cmd = $svn.' co '.$url; |
1203 | 1203 | run_cmd($cmd); |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | */ |
1223 | 1223 | function get_modules_per_svn_repo() |
1224 | 1224 | { |
1225 | - global $config,$svn,$verbose; |
|
1225 | + global $config, $svn, $verbose; |
|
1226 | 1226 | |
1227 | 1227 | // process alias/externals |
1228 | 1228 | $svnbranch = $config['svnbase'].'/'.$config['svnbranch']; |
@@ -1230,27 +1230,27 @@ discard block |
||
1230 | 1230 | $cmd = $svn.' propget svn:externals --strict '.$url; |
1231 | 1231 | if ($verbose) echo $cmd."\n"; |
1232 | 1232 | $output = $ret = null; |
1233 | - exec($cmd,$output,$ret); |
|
1233 | + exec($cmd, $output, $ret); |
|
1234 | 1234 | $config['modules'] = array(); |
1235 | - foreach($output as $line) |
|
1235 | + foreach ($output as $line) |
|
1236 | 1236 | { |
1237 | 1237 | $line = trim($line); |
1238 | 1238 | if (empty($line) || $line[0] == '#') continue; |
1239 | - list($path,$url) = preg_split('/[ \t\r\n]+/',$line); |
|
1239 | + list($path, $url) = preg_split('/[ \t\r\n]+/', $line); |
|
1240 | 1240 | $matches = null; |
1241 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
1241 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n"); |
|
1242 | 1242 | $repo = $matches[1]; |
1243 | 1243 | if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
1244 | 1244 | $config['modules'][$repo][$path] = $url; |
1245 | 1245 | } |
1246 | 1246 | // process extra modules |
1247 | - foreach($config['extra'] as $module) |
|
1247 | + foreach ($config['extra'] as $module) |
|
1248 | 1248 | { |
1249 | - $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
1250 | - $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
|
1249 | + $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
1250 | + $url = strpos($module, '://') === false ? $svnbranch.'/' : ''; |
|
1251 | 1251 | $url .= $module; |
1252 | - if (strpos($module,'://') !== false) $module = basename($module); |
|
1253 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
1252 | + if (strpos($module, '://') !== false) $module = basename($module); |
|
1253 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n"); |
|
1254 | 1254 | $repo = $matches[1]; |
1255 | 1255 | if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
1256 | 1256 | $config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url; |
@@ -1264,11 +1264,11 @@ discard block |
||
1264 | 1264 | */ |
1265 | 1265 | function do_svntag() |
1266 | 1266 | { |
1267 | - global $config,$svn; |
|
1267 | + global $config, $svn; |
|
1268 | 1268 | |
1269 | - if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
1269 | + if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
1270 | 1270 | |
1271 | - $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
|
1271 | + $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
|
1272 | 1272 | |
1273 | 1273 | echo "Creating SVN tag $config[svntag]\n"; |
1274 | 1274 | if (!isset($config['modules'])) |
@@ -1276,9 +1276,9 @@ discard block |
||
1276 | 1276 | get_modules_per_repo(); |
1277 | 1277 | } |
1278 | 1278 | // create tags (per repo) |
1279 | - foreach($config['modules'] as $repo => $modules) |
|
1279 | + foreach ($config['modules'] as $repo => $modules) |
|
1280 | 1280 | { |
1281 | - $cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ',$modules).' '.$repo.'/'.$config['svntag'].'/'; |
|
1281 | + $cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ', $modules).' '.$repo.'/'.$config['svntag'].'/'; |
|
1282 | 1282 | run_cmd($cmd); |
1283 | 1283 | } |
1284 | 1284 | } |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | * @param int|array $no_bailout =null exit code(s) to NOT bail out |
1292 | 1292 | * @return int exit code of $cmd |
1293 | 1293 | */ |
1294 | -function run_cmd($cmd,array &$output=null,$no_bailout=null) |
|
1294 | +function run_cmd($cmd, array &$output = null, $no_bailout = null) |
|
1295 | 1295 | { |
1296 | 1296 | global $verbose; |
1297 | 1297 | |
@@ -1299,18 +1299,18 @@ discard block |
||
1299 | 1299 | { |
1300 | 1300 | echo $cmd."\n"; |
1301 | 1301 | $ret = null; |
1302 | - system($cmd,$ret); |
|
1302 | + system($cmd, $ret); |
|
1303 | 1303 | } |
1304 | 1304 | else |
1305 | 1305 | { |
1306 | 1306 | $output[] = $cmd; |
1307 | - exec($cmd,$output,$ret); |
|
1308 | - if ($verbose) echo implode("\n",$output)."\n"; |
|
1307 | + exec($cmd, $output, $ret); |
|
1308 | + if ($verbose) echo implode("\n", $output)."\n"; |
|
1309 | 1309 | } |
1310 | - if ($ret && !in_array($ret,(array)$no_bailout)) |
|
1310 | + if ($ret && !in_array($ret, (array)$no_bailout)) |
|
1311 | 1311 | { |
1312 | - if (!$verbose) echo implode("\n",$output)."\n"; |
|
1313 | - throw new Exception("Error during '$cmd' --> aborting",$ret); |
|
1312 | + if (!$verbose) echo implode("\n", $output)."\n"; |
|
1313 | + throw new Exception("Error during '$cmd' --> aborting", $ret); |
|
1314 | 1314 | } |
1315 | 1315 | return $ret; |
1316 | 1316 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | return 'NULL'; |
1338 | 1338 | case 'object': |
1339 | 1339 | case 'array': |
1340 | - return str_replace(array("\n",' '/*,'Array'*/),'',print_r($var,true)); |
|
1340 | + return str_replace(array("\n", ' '/*,'Array'*/), '', print_r($var, true)); |
|
1341 | 1341 | } |
1342 | 1342 | return 'UNKNOWN TYPE!'; |
1343 | 1343 | } |
@@ -1347,9 +1347,9 @@ discard block |
||
1347 | 1347 | * |
1348 | 1348 | * @param string $error =null optional error-message |
1349 | 1349 | */ |
1350 | -function usage($error=null) |
|
1350 | +function usage($error = null) |
|
1351 | 1351 | { |
1352 | - global $prog,$config,$verbose; |
|
1352 | + global $prog, $config, $verbose; |
|
1353 | 1353 | |
1354 | 1354 | echo "Usage: $prog [-h|--help] [-v|--verbose] [options, ...]\n\n"; |
1355 | 1355 | echo "options and their defaults:\n"; |
@@ -1359,12 +1359,12 @@ discard block |
||
1359 | 1359 | } |
1360 | 1360 | else |
1361 | 1361 | { |
1362 | - unset($config['modules']); // they give an error, because of nested array and are quite lengthy |
|
1362 | + unset($config['modules']); // they give an error, because of nested array and are quite lengthy |
|
1363 | 1363 | } |
1364 | - foreach($config as $name => $default) |
|
1364 | + foreach ($config as $name => $default) |
|
1365 | 1365 | { |
1366 | - if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
1367 | - echo '--'.str_pad($name,20).$default."\n"; |
|
1366 | + if (is_array($default)) $default = json_encode($default, JSON_UNESCAPED_SLASHES); |
|
1367 | + echo '--'.str_pad($name, 20).$default."\n"; |
|
1368 | 1368 | } |
1369 | 1369 | if ($error) |
1370 | 1370 | { |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @param string $cmd |
487 | 487 | * @param array &$output=null $output of command |
488 | - * @param int|array|true $no_bailout =null exit code(s) to NOT bail out, or true to never bail out |
|
488 | + * @param integer $no_bailout =null exit code(s) to NOT bail out, or true to never bail out |
|
489 | 489 | * @return int exit code of $cmd |
490 | 490 | */ |
491 | 491 | function run_cmd($cmd,array &$output=null,$no_bailout=null) |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | * Read one Univention secret/password eg. _ucr_secret('mysql') |
713 | 713 | * |
714 | 714 | * @param string $name |
715 | - * @return string|boolean |
|
715 | + * @return false|string |
|
716 | 716 | */ |
717 | 717 | function _ucr_secret($name) |
718 | 718 | { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | 'php' => PHP_BINARY, |
19 | 19 | 'source_dir' => realpath(__DIR__.'/../..'), |
20 | 20 | 'data_dir' => '/var/lib/egroupware', |
21 | - 'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm |
|
21 | + 'header' => '$data_dir/header.inc.php', // symlinked to source_dir by rpm |
|
22 | 22 | 'setup-cli' => '$source_dir/setup/setup-cli.php', |
23 | 23 | 'domain' => 'default', |
24 | 24 | 'config_user' => 'admin', |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | 'db_user' => 'egroupware', |
31 | 31 | 'db_pass' => randomstring(), |
32 | 32 | 'db_grant_host' => 'localhost', |
33 | - 'db_root' => 'root', // mysql root user/pw to create database |
|
33 | + 'db_root' => 'root', // mysql root user/pw to create database |
|
34 | 34 | 'db_root_pw' => '', |
35 | 35 | 'backup' => '', |
36 | 36 | 'admin_user' => 'sysop', |
37 | 37 | 'admin_passwd'=> randomstring(), |
38 | 38 | 'admin_email' => '', |
39 | - 'lang' => 'en', // languages for admin user and extra lang to install |
|
39 | + 'lang' => 'en', // languages for admin user and extra lang to install |
|
40 | 40 | 'charset' => 'utf-8', |
41 | 41 | 'start_db' => '/sbin/service mysqld', |
42 | 42 | 'autostart_db' => '/sbin/chkconfig --level 345 mysqld on', |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | 'ldap_search_filter' => '(uid=%user)', |
57 | 57 | 'ldap_group_context' => 'ou=groups,$base', |
58 | 58 | 'ldap_encryption_type' => '', |
59 | - 'sambaadmin/sambasid'=> '', // SID for sambaadmin |
|
59 | + 'sambaadmin/sambasid'=> '', // SID for sambaadmin |
|
60 | 60 | 'mailserver' => '', |
61 | 61 | 'smtpserver' => 'localhost,25', |
62 | - 'smtp' => '', // see setup-cli.php --help config |
|
62 | + 'smtp' => '', // see setup-cli.php --help config |
|
63 | 63 | 'imap' => '', |
64 | 64 | 'sieve' => '', |
65 | 65 | 'folder' => '', |
66 | - 'install-update-app' => '', // install or update a single (non-default) app |
|
67 | - 'webserver_user'=> 'apache', // required to fix permissions |
|
66 | + 'install-update-app' => '', // install or update a single (non-default) app |
|
67 | + 'webserver_user'=> 'apache', // required to fix permissions |
|
68 | 68 | 'apache_config' => '/etc/httpd/conf.d/egroupware.conf', |
69 | 69 | 'php5enmod' => '', |
70 | 70 | ); |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | // read language from LANG enviroment variable |
73 | 73 | if (($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : (isset($_SERVER['LANG']) ? $_SERVER['LANG'] : null))) |
74 | 74 | { |
75 | - @list($lang,$nat) = preg_split('/[_.]/',$lang); |
|
76 | - if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw'))) |
|
75 | + @list($lang, $nat) = preg_split('/[_.]/', $lang); |
|
76 | + if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw'))) |
|
77 | 77 | { |
78 | 78 | $lang .= '-'.strtolower($nat); |
79 | 79 | } |
@@ -86,16 +86,13 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param string $distro =null default autodetect |
88 | 88 | */ |
89 | -function set_distro_defaults($distro=null) |
|
89 | +function set_distro_defaults($distro = null) |
|
90 | 90 | { |
91 | 91 | global $config; |
92 | 92 | if (is_null($distro)) |
93 | 93 | { |
94 | - $distro = file_exists('/etc/SuSE-release') ? 'suse' : |
|
95 | - (file_exists('/etc/mandriva-release') ? 'mandriva' : |
|
96 | - (file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi', |
|
97 | - file_get_contents('/etc/lsb-release')) ? 'univention' : |
|
98 | - (file_exists('/etc/debian_version') ? 'debian' : 'rh'))); |
|
94 | + $distro = file_exists('/etc/SuSE-release') ? 'suse' : (file_exists('/etc/mandriva-release') ? 'mandriva' : (file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi', |
|
95 | + file_get_contents('/etc/lsb-release')) ? 'univention' : (file_exists('/etc/debian_version') ? 'debian' : 'rh'))); |
|
99 | 96 | } |
100 | 97 | switch (($config['distro'] = $distro)) |
101 | 98 | { |
@@ -158,9 +155,9 @@ discard block |
||
158 | 155 | } |
159 | 156 | elseif (!file_exists('/etc/init.d/mysqld') && file_exists('/etc/init.d/mysql')) |
160 | 157 | { |
161 | - foreach(array('start_db','autostart_db') as $name) |
|
158 | + foreach (array('start_db', 'autostart_db') as $name) |
|
162 | 159 | { |
163 | - $config[$name] = str_replace('mysqld','mysql',$config[$name]); |
|
160 | + $config[$name] = str_replace('mysqld', 'mysql', $config[$name]); |
|
164 | 161 | } |
165 | 162 | } |
166 | 163 | break; |
@@ -176,48 +173,48 @@ discard block |
||
176 | 173 | if (($config_set = isset($_ENV['EGW_POST_INSTALL']) ? $_ENV['EGW_POST_INSTALL'] : @$_SERVER['EGW_POST_INSTALL'])) |
177 | 174 | { |
178 | 175 | $conf = array(); |
179 | - $config_set = preg_split('/[ \t]+/',trim($config_set)); |
|
180 | - while($config_set) |
|
176 | + $config_set = preg_split('/[ \t]+/', trim($config_set)); |
|
177 | + while ($config_set) |
|
181 | 178 | { |
182 | 179 | $val = array_shift($config_set); |
183 | 180 | if (($quote = $val[0]) == "'" || $quote == '"') // arguments might be quoted with ' or " |
184 | 181 | { |
185 | - while (substr($val,-1) != $quote) |
|
182 | + while (substr($val, -1) != $quote) |
|
186 | 183 | { |
187 | 184 | if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!'); |
188 | 185 | $val .= ' '.array_shift($config_set); |
189 | 186 | } |
190 | - $val = substr($val,1,-1); |
|
187 | + $val = substr($val, 1, -1); |
|
191 | 188 | } |
192 | 189 | $conf[] = $val; |
193 | 190 | } |
194 | - $argv = array_merge($conf,$argv); |
|
191 | + $argv = array_merge($conf, $argv); |
|
195 | 192 | } |
196 | 193 | |
197 | 194 | $auth_type_given = false; |
198 | -while(($arg = array_shift($argv))) |
|
195 | +while (($arg = array_shift($argv))) |
|
199 | 196 | { |
200 | 197 | if ($arg == '-v' || $arg == '--verbose') |
201 | 198 | { |
202 | 199 | $verbose = true; |
203 | 200 | } |
204 | - elseif($arg == '-h' || $arg == '--help') |
|
201 | + elseif ($arg == '-h' || $arg == '--help') |
|
205 | 202 | { |
206 | 203 | usage(); |
207 | 204 | } |
208 | - elseif($arg == '--suse') |
|
205 | + elseif ($arg == '--suse') |
|
209 | 206 | { |
210 | 207 | set_distro_defaults('suse'); |
211 | 208 | } |
212 | - elseif($arg == '--distro') |
|
209 | + elseif ($arg == '--distro') |
|
213 | 210 | { |
214 | 211 | set_distro_defaults(array_shift($argv)); |
215 | 212 | } |
216 | - elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)])) |
|
213 | + elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)])) |
|
217 | 214 | { |
218 | 215 | $config[$name] = array_shift($argv); |
219 | 216 | |
220 | - switch($name) |
|
217 | + switch ($name) |
|
221 | 218 | { |
222 | 219 | case 'auth_type': |
223 | 220 | $auth_type_given = true; |
@@ -238,18 +235,18 @@ discard block |
||
238 | 235 | } |
239 | 236 | |
240 | 237 | $replace = array(); |
241 | -foreach($config as $name => $value) |
|
238 | +foreach ($config as $name => $value) |
|
242 | 239 | { |
243 | 240 | $replace['$'.$name] = $value; |
244 | - if (strpos($value,'$') !== false) |
|
241 | + if (strpos($value, '$') !== false) |
|
245 | 242 | { |
246 | - $config[$name] = strtr($value,$replace); |
|
243 | + $config[$name] = strtr($value, $replace); |
|
247 | 244 | } |
248 | 245 | } |
249 | 246 | // basic config checks |
250 | -foreach(array('php','source_dir','data_dir','setup-cli') as $name) |
|
247 | +foreach (array('php', 'source_dir', 'data_dir', 'setup-cli') as $name) |
|
251 | 248 | { |
252 | - if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!'); |
|
249 | + if (!file_exists($config[$name])) bail_out(1, $config[$name].' not found!'); |
|
253 | 250 | } |
254 | 251 | |
255 | 252 | // fix important php.ini and conf.d/*.ini settings |
@@ -264,13 +261,13 @@ discard block |
||
264 | 261 | $GLOBALS['egw_info'] = array( |
265 | 262 | 'flags' => array( |
266 | 263 | 'noapi' => true, |
267 | - 'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header |
|
264 | + 'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header |
|
268 | 265 | ) |
269 | 266 | ); |
270 | 267 | include $config['header']; |
271 | 268 | |
272 | 269 | // get user from header and replace password, as we dont know it |
273 | - $old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']); |
|
270 | + $old_password = patch_header($config['header'], $config['config_user'], $config['config_passwd']); |
|
274 | 271 | // register a shutdown function to put old password back in any case |
275 | 272 | register_shutdown_function(function() use (&$config, $old_password) |
276 | 273 | { |
@@ -278,7 +275,7 @@ discard block |
||
278 | 275 | }); |
279 | 276 | } |
280 | 277 | // new header or does not include requested domain (!= "default") --> new install |
281 | -if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']])) |
|
278 | +if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']])) |
|
282 | 279 | { |
283 | 280 | // --> new install |
284 | 281 | $extra_config = ''; |
@@ -295,7 +292,7 @@ discard block |
||
295 | 292 | } |
296 | 293 | // create database |
297 | 294 | $setup_db = $setup_cli.' --setup-cmd-database sub_command=create_db'; |
298 | - foreach(array('domain','db_type','db_host','db_port','db_name','db_user','db_pass','db_root','db_root_pw','db_grant_host') as $name) |
|
295 | + foreach (array('domain', 'db_type', 'db_host', 'db_port', 'db_name', 'db_user', 'db_pass', 'db_root', 'db_root_pw', 'db_grant_host') as $name) |
|
299 | 296 | { |
300 | 297 | $setup_db .= ' '.escapeshellarg($name.'='.$config[$name]); |
301 | 298 | } |
@@ -303,7 +300,7 @@ discard block |
||
303 | 300 | |
304 | 301 | // check if ldap is required and initialise it |
305 | 302 | // we need to specify account_repository and auth_type to --install as extra config, otherwise install happens for sql! |
306 | - @list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3); |
|
303 | + @list($config['account_repository'], $config['auth_type'], $rest) = explode(',', $config['account-auth'], 3); |
|
307 | 304 | $extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']); |
308 | 305 | $extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type'])); |
309 | 306 | if (empty($rest)) unset($config['account-auth']); |
@@ -314,15 +311,15 @@ discard block |
||
314 | 311 | |
315 | 312 | $setup_ldap = $setup_cli.' --setup-cmd-ldap sub_command='. |
316 | 313 | ($config['account_repository'] == 'ldap' ? 'create_ldap' : 'test_ldap'); |
317 | - foreach(array( |
|
318 | - 'domain','ldap_suffix','ldap_host','ldap_admin','ldap_admin_pw', // non-egw params: only used for create |
|
319 | - 'ldap_base','ldap_root_dn','ldap_root_pw','ldap_context','ldap_search_filter','ldap_group_context', // egw params |
|
314 | + foreach (array( |
|
315 | + 'domain', 'ldap_suffix', 'ldap_host', 'ldap_admin', 'ldap_admin_pw', // non-egw params: only used for create |
|
316 | + 'ldap_base', 'ldap_root_dn', 'ldap_root_pw', 'ldap_context', 'ldap_search_filter', 'ldap_group_context', // egw params |
|
320 | 317 | 'ldap_encryption_type', 'sambaadmin/sambasid', |
321 | 318 | ) as $name) |
322 | 319 | { |
323 | - if (strpos($value=$config[$name],'$') !== false) |
|
320 | + if (strpos($value = $config[$name], '$') !== false) |
|
324 | 321 | { |
325 | - $config[$name] = $value = strtr($value,array( |
|
322 | + $config[$name] = $value = strtr($value, array( |
|
326 | 323 | '$suffix' => $config['ldap_suffix'], |
327 | 324 | '$base' => $config['ldap_base'], |
328 | 325 | '$admin_pw' => $config['ldap_admin_pw'], |
@@ -330,7 +327,7 @@ discard block |
||
330 | 327 | } |
331 | 328 | $setup_ldap .= ' '.escapeshellarg($name.'='.$value); |
332 | 329 | |
333 | - if (!in_array($name,array('domain','ldap_suffix','ldap_admin','ldap_admin_pw'))) |
|
330 | + if (!in_array($name, array('domain', 'ldap_suffix', 'ldap_admin', 'ldap_admin_pw'))) |
|
334 | 331 | { |
335 | 332 | $extra_config .= ' '.escapeshellarg($name.'='.$value); |
336 | 333 | } |
@@ -364,7 +361,7 @@ discard block |
||
364 | 361 | } |
365 | 362 | // create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error) |
366 | 363 | $setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']); |
367 | - foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name) |
|
364 | + foreach (array('account-auth', 'smtpserver', 'smtp', 'postfix', 'mailserver', 'imap', 'cyrus', 'sieve', 'folder') as $name) |
|
368 | 365 | { |
369 | 366 | if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
370 | 367 | } |
@@ -378,7 +375,7 @@ discard block |
||
378 | 375 | // check if webserver is started and start it (permanent) if not |
379 | 376 | if ($config['start_webserver']) |
380 | 377 | { |
381 | - exec(build_cmd('start_webserver', 'status'),$dummy,$ret); |
|
378 | + exec(build_cmd('start_webserver', 'status'), $dummy, $ret); |
|
382 | 379 | if ($ret) |
383 | 380 | { |
384 | 381 | system(build_cmd('start_webserver', 'start')); |
@@ -420,18 +417,18 @@ discard block |
||
420 | 417 | // update egroupware, or single app(s), in later case skip backup |
421 | 418 | $setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd']. |
422 | 419 | (empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app'])); |
423 | - $ret = run_cmd($setup_update,$output,array(4,15)); |
|
420 | + $ret = run_cmd($setup_update, $output, array(4, 15)); |
|
424 | 421 | |
425 | - switch($ret) |
|
422 | + switch ($ret) |
|
426 | 423 | { |
427 | 424 | case 4: // header needs an update |
428 | 425 | $header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']); |
429 | 426 | run_cmd($header_update); |
430 | - $ret = run_cmd($setup_update,$output,15); |
|
427 | + $ret = run_cmd($setup_update, $output, 15); |
|
431 | 428 | if ($ret != 15) break; |
432 | 429 | // fall through |
433 | 430 | case 15: // missing configuration (eg. mailserver) |
434 | - if (!$verbose) echo implode("\n",(array)$output)."\n"; |
|
431 | + if (!$verbose) echo implode("\n", (array)$output)."\n"; |
|
435 | 432 | break; |
436 | 433 | |
437 | 434 | case 0: |
@@ -476,18 +473,18 @@ discard block |
||
476 | 473 | * @param string $password new password |
477 | 474 | * @return string old password |
478 | 475 | */ |
479 | -function patch_header($filename,&$user,$password) |
|
476 | +function patch_header($filename, &$user, $password) |
|
480 | 477 | { |
481 | 478 | $header = file_get_contents($filename); |
482 | 479 | |
483 | 480 | $umatches = $pmatches = null; |
484 | - if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m",$header,$umatches) || |
|
485 | - !preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m",$header,$pmatches)) |
|
481 | + if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m", $header, $umatches) || |
|
482 | + !preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", $header, $pmatches)) |
|
486 | 483 | { |
487 | - bail_out(99,"$filename is no regular EGroupware header.inc.php!"); |
|
484 | + bail_out(99, "$filename is no regular EGroupware header.inc.php!"); |
|
488 | 485 | } |
489 | - file_put_contents($filename,preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", |
|
490 | - "\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';",$header)); |
|
486 | + file_put_contents($filename, preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", |
|
487 | + "\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';", $header)); |
|
491 | 488 | |
492 | 489 | $user = $umatches[1]; |
493 | 490 | |
@@ -502,7 +499,7 @@ discard block |
||
502 | 499 | * @param int|array|true $no_bailout =null exit code(s) to NOT bail out, or true to never bail out |
503 | 500 | * @return int exit code of $cmd |
504 | 501 | */ |
505 | -function run_cmd($cmd,array &$output=null,$no_bailout=null) |
|
502 | +function run_cmd($cmd, array &$output = null, $no_bailout = null) |
|
506 | 503 | { |
507 | 504 | global $verbose; |
508 | 505 | |
@@ -510,16 +507,16 @@ discard block |
||
510 | 507 | { |
511 | 508 | echo $cmd."\n"; |
512 | 509 | $ret = null; |
513 | - system($cmd,$ret); |
|
510 | + system($cmd, $ret); |
|
514 | 511 | } |
515 | 512 | else |
516 | 513 | { |
517 | 514 | $output[] = $cmd; |
518 | - exec($cmd,$output,$ret); |
|
515 | + exec($cmd, $output, $ret); |
|
519 | 516 | } |
520 | - if ($ret && $no_bailout !== true && !in_array($ret,(array)$no_bailout)) |
|
517 | + if ($ret && $no_bailout !== true && !in_array($ret, (array)$no_bailout)) |
|
521 | 518 | { |
522 | - bail_out($ret,$verbose?null:$output); |
|
519 | + bail_out($ret, $verbose ?null:$output); |
|
523 | 520 | } |
524 | 521 | return $ret; |
525 | 522 | } |
@@ -530,9 +527,9 @@ discard block |
||
530 | 527 | * @param int $ret =1 |
531 | 528 | * @param array|string $output line(s) to output before temination notice |
532 | 529 | */ |
533 | -function bail_out($ret=1,$output=null) |
|
530 | +function bail_out($ret = 1, $output = null) |
|
534 | 531 | { |
535 | - if ($output) echo implode("\n",(array)$output); |
|
532 | + if ($output) echo implode("\n", (array)$output); |
|
536 | 533 | echo "\n\nInstallation failed --> exiting!\n\n"; |
537 | 534 | exit($ret); |
538 | 535 | } |
@@ -543,24 +540,24 @@ discard block |
||
543 | 540 | * @param int $len =16 |
544 | 541 | * @return string |
545 | 542 | */ |
546 | -function randomstring($len=16) |
|
543 | +function randomstring($len = 16) |
|
547 | 544 | { |
548 | 545 | static $usedchars = array( |
549 | - '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', |
|
550 | - 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', |
|
551 | - 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', |
|
552 | - 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
|
553 | - '@','!','&','(',')','=','?',';',':','#','_','-','<', |
|
554 | - '>','|','[',']','}', // dont add %, /\,'"{ as we have problems dealing with them |
|
546 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', |
|
547 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', |
|
548 | + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', |
|
549 | + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
550 | + '@', '!', '&', '(', ')', '=', '?', ';', ':', '#', '_', '-', '<', |
|
551 | + '>', '|', '[', ']', '}', // dont add %, /\,'"{ as we have problems dealing with them |
|
555 | 552 | ); |
556 | 553 | |
557 | 554 | // use cryptographically secure random_int available in PHP 7+ |
558 | 555 | $func = function_exists('random_int') ? 'random_int' : 'mt_rand'; |
559 | 556 | |
560 | 557 | $str = ''; |
561 | - for($i=0; $i < $len; $i++) |
|
558 | + for ($i = 0; $i < $len; $i++) |
|
562 | 559 | { |
563 | - $str .= $usedchars[$func(0,count($usedchars)-1)]; |
|
560 | + $str .= $usedchars[$func(0, count($usedchars) - 1)]; |
|
564 | 561 | } |
565 | 562 | return $str; |
566 | 563 | } |
@@ -570,20 +567,20 @@ discard block |
||
570 | 567 | * |
571 | 568 | * @param string $error =null optional error-message |
572 | 569 | */ |
573 | -function usage($error=null) |
|
570 | +function usage($error = null) |
|
574 | 571 | { |
575 | - global $prog,$config; |
|
572 | + global $prog, $config; |
|
576 | 573 | |
577 | 574 | echo "Usage: $prog [-h|--help] [-v|--verbose] [--distro=(suse|rh|debian)] [options, ...]\n\n"; |
578 | 575 | echo "options and their defaults:\n"; |
579 | - foreach($config as $name => $default) |
|
576 | + foreach ($config as $name => $default) |
|
580 | 577 | { |
581 | - if (in_array($name, array('postfix','cyrus'))) continue; // do NOT report deprecated options |
|
582 | - if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16) |
|
578 | + if (in_array($name, array('postfix', 'cyrus'))) continue; // do NOT report deprecated options |
|
579 | + if (in_array($name, array('config_passwd', 'db_pass', 'admin_passwd', 'ldap_root_pw')) && strlen($config[$name]) == 16) |
|
583 | 580 | { |
584 | 581 | $default = '<16 char random string>'; |
585 | 582 | } |
586 | - echo '--'.str_pad($name,20).$default."\n"; |
|
583 | + echo '--'.str_pad($name, 20).$default."\n"; |
|
587 | 584 | } |
588 | 585 | if ($error) |
589 | 586 | { |
@@ -638,8 +635,8 @@ discard block |
||
638 | 635 | $config['distro'] = 'univention'; |
639 | 636 | |
640 | 637 | // set lang from ucr locale, as cloud-config at least never has anything but EN set in enviroment |
641 | - @list($lang,$nat) = preg_split('/[_.]/', _ucr_get('locale/default')); |
|
642 | - if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw'))) |
|
638 | + @list($lang, $nat) = preg_split('/[_.]/', _ucr_get('locale/default')); |
|
639 | + if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw'))) |
|
643 | 640 | { |
644 | 641 | $lang .= '-'.strtolower($nat); |
645 | 642 | } |
@@ -664,7 +661,7 @@ discard block |
||
664 | 661 | // ldap password hash (our default blowfish_crypt seems not to work) |
665 | 662 | $config['ldap_encryption_type'] = 'sha512_crypt'; |
666 | 663 | |
667 | - $config['account_min_id'] = 1200; // UCS use 11xx for internal users/groups |
|
664 | + $config['account_min_id'] = 1200; // UCS use 11xx for internal users/groups |
|
668 | 665 | |
669 | 666 | $config['account-auth'] = 'univention,univention'; |
670 | 667 | |
@@ -674,7 +671,7 @@ discard block |
||
674 | 671 | // mailserver, see setup-cli.php --help config |
675 | 672 | if (($mailserver = exec('/usr/bin/univention-ldapsearch -x "(univentionAppID=mailserver_*)" univentionAppInstalledOnServer|sed -n "s/univentionAppInstalledOnServer: \(.*\)/\1/p"')) && |
676 | 673 | // only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' && |
677 | - ($domains=_ucr_get('mail/hosteddomains'))) |
|
674 | + ($domains = _ucr_get('mail/hosteddomains'))) |
|
678 | 675 | { |
679 | 676 | if (!is_array($domains)) $domains = explode("\n", $domains); |
680 | 677 | $domain = array_shift($domains); |
@@ -721,12 +718,12 @@ discard block |
||
721 | 718 | */ |
722 | 719 | function _ucr_get($name) |
723 | 720 | { |
724 | - static $values=null; |
|
721 | + static $values = null; |
|
725 | 722 | if (!isset($values)) |
726 | 723 | { |
727 | 724 | $output = $matches = null; |
728 | 725 | exec('/usr/sbin/ucr dump', $output); |
729 | - foreach($output as $line) |
|
726 | + foreach ($output as $line) |
|
730 | 727 | { |
731 | 728 | if (preg_match("/^([^:]+): (.*)\n?$/", $line, $matches)) |
732 | 729 | { |
@@ -812,7 +809,7 @@ discard block |
||
812 | 809 | file_exists($default_cert_dir = $locations['default_cert_dir'])) |
813 | 810 | { |
814 | 811 | $check_dirs = array($default_cert_dir); |
815 | - foreach(scandir($default_cert_dir) as $cert) |
|
812 | + foreach (scandir($default_cert_dir) as $cert) |
|
816 | 813 | { |
817 | 814 | $cert = $default_cert_dir.'/'.$cert; |
818 | 815 | if (is_link($cert) && ($link = readlink($cert)) && |
@@ -829,7 +826,7 @@ discard block |
||
829 | 826 | //echo "$config[apache_config] contains open_basedir $matches[1]\n"; |
830 | 827 | $open_basedirs = explode(':', $matches[1]); |
831 | 828 | $need_adding = array(); |
832 | - foreach($check_dirs as $dir) |
|
829 | + foreach ($check_dirs as $dir) |
|
833 | 830 | { |
834 | 831 | if (!in_array($dir, $open_basedirs)) $need_adding[] = $dir; |
835 | 832 | } |
@@ -858,7 +855,7 @@ discard block |
||
858 | 855 | function _size_with_unit($_size) |
859 | 856 | { |
860 | 857 | $size = (int)$_size; |
861 | - switch(strtoupper(substr($_size, -1))) |
|
858 | + switch (strtoupper(substr($_size, -1))) |
|
862 | 859 | { |
863 | 860 | case 'G': |
864 | 861 | $size *= 1024; |
@@ -9,10 +9,13 @@ discard block |
||
9 | 9 | * @version $Id$ |
10 | 10 | */ |
11 | 11 | |
12 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling post_install as web-page |
|
12 | +if (php_sapi_name() !== 'cli') |
|
13 | +{ |
|
14 | + // security precaution: forbit calling post_install as web-page |
|
13 | 15 | { |
14 | 16 | die('<h1>post_install.php must NOT be called as web-page --> exiting !!!</h1>'); |
15 | 17 | } |
18 | +} |
|
16 | 19 | $verbose = false; |
17 | 20 | $config = array( |
18 | 21 | 'php' => PHP_BINARY, |
@@ -101,7 +104,10 @@ discard block |
||
101 | 104 | { |
102 | 105 | case 'suse': |
103 | 106 | // openSUSE 12.1+ no longer uses php5 |
104 | - if (file_exists('/usr/bin/php5')) $config['php'] = '/usr/bin/php5'; |
|
107 | + if (file_exists('/usr/bin/php5')) |
|
108 | + { |
|
109 | + $config['php'] = '/usr/bin/php5'; |
|
110 | + } |
|
105 | 111 | $config['start_db'] = '/sbin/service mysql'; |
106 | 112 | $config['autostart_db'] = '/sbin/chkconfig --level 345 mysql on'; |
107 | 113 | $config['start_webserver'] = '/sbin/service apache2'; |
@@ -149,9 +155,12 @@ discard block |
||
149 | 155 | // fall through |
150 | 156 | case 'rh': |
151 | 157 | // some MySQL packages (mysql.com, MariaDB, ...) use "mysql" as service name instead of RH default "mysqld" |
152 | - if (file_exists('/usr/bin/systemctl')) // RHEL 7 |
|
158 | + if (file_exists('/usr/bin/systemctl')) |
|
159 | + { |
|
160 | + // RHEL 7 |
|
153 | 161 | { |
154 | 162 | $config['start_db'] = '/usr/bin/systemctl %s mariadb'; |
163 | + } |
|
155 | 164 | $config['autostart_db'] = build_cmd('start_db', 'enable'); |
156 | 165 | $config['start_webserver'] = '/usr/bin/systemctl %s httpd'; |
157 | 166 | $config['autostart_webserver'] = build_cmd('start_webserver', 'enable'); |
@@ -180,11 +189,14 @@ discard block |
||
180 | 189 | while($config_set) |
181 | 190 | { |
182 | 191 | $val = array_shift($config_set); |
183 | - if (($quote = $val[0]) == "'" || $quote == '"') // arguments might be quoted with ' or " |
|
192 | + if (($quote = $val[0]) == "'" || $quote == '"') |
|
193 | + { |
|
194 | + // arguments might be quoted with ' or " |
|
184 | 195 | { |
185 | 196 | while (substr($val,-1) != $quote) |
186 | 197 | { |
187 | 198 | if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!'); |
199 | + } |
|
188 | 200 | $val .= ' '.array_shift($config_set); |
189 | 201 | } |
190 | 202 | $val = substr($val,1,-1); |
@@ -249,8 +261,11 @@ discard block |
||
249 | 261 | // basic config checks |
250 | 262 | foreach(array('php','source_dir','data_dir','setup-cli') as $name) |
251 | 263 | { |
252 | - if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!'); |
|
253 | -} |
|
264 | + if (!file_exists($config[$name])) |
|
265 | + { |
|
266 | + bail_out(1,$config[$name].' not found!'); |
|
267 | + } |
|
268 | + } |
|
254 | 269 | |
255 | 270 | // fix important php.ini and conf.d/*.ini settings |
256 | 271 | check_fix_php_apc_ini(); |
@@ -259,7 +274,9 @@ discard block |
||
259 | 274 | $setup_cli = $config['php'].' -d memory_limit=-1 '.$config['setup-cli']; |
260 | 275 | |
261 | 276 | // if we have a header, include it |
262 | -if (file_exists($config['header']) && filesize($config['header']) >= 200) // default header redirecting to setup is 147 bytes |
|
277 | +if (file_exists($config['header']) && filesize($config['header']) >= 200) |
|
278 | +{ |
|
279 | + // default header redirecting to setup is 147 bytes |
|
263 | 280 | { |
264 | 281 | $GLOBALS['egw_info'] = array( |
265 | 282 | 'flags' => array( |
@@ -267,6 +284,7 @@ discard block |
||
267 | 284 | 'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header |
268 | 285 | ) |
269 | 286 | ); |
287 | +} |
|
270 | 288 | include $config['header']; |
271 | 289 | |
272 | 290 | // get user from header and replace password, as we dont know it |
@@ -290,7 +308,10 @@ discard block |
||
290 | 308 | if ($ret) |
291 | 309 | { |
292 | 310 | system(build_cmd('start_db', 'start')); |
293 | - if (!empty($config['autostart_db'])) system($config['autostart_db']); |
|
311 | + if (!empty($config['autostart_db'])) |
|
312 | + { |
|
313 | + system($config['autostart_db']); |
|
314 | + } |
|
294 | 315 | } |
295 | 316 | } |
296 | 317 | // create database |
@@ -306,7 +327,10 @@ discard block |
||
306 | 327 | @list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3); |
307 | 328 | $extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']); |
308 | 329 | $extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type'])); |
309 | - if (empty($rest)) unset($config['account-auth']); |
|
330 | + if (empty($rest)) |
|
331 | + { |
|
332 | + unset($config['account-auth']); |
|
333 | + } |
|
310 | 334 | if (array_intersect(array($config['account_repository'], $config['auth_type']), array('ldap', 'univention'))) |
311 | 335 | { |
312 | 336 | // set account_min_id to 1100 if not specified to NOT clash with system accounts |
@@ -366,7 +390,10 @@ discard block |
||
366 | 390 | $setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']); |
367 | 391 | foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name) |
368 | 392 | { |
369 | - if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
|
393 | + if (!empty($config[$name])) |
|
394 | + { |
|
395 | + $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
|
396 | + } |
|
370 | 397 | } |
371 | 398 | run_cmd($setup_mailserver); |
372 | 399 | |
@@ -382,7 +409,10 @@ discard block |
||
382 | 409 | if ($ret) |
383 | 410 | { |
384 | 411 | system(build_cmd('start_webserver', 'start')); |
385 | - if (!empty($config['autostart_webserver'])) system($config['autostart_webserver']); |
|
412 | + if (!empty($config['autostart_webserver'])) |
|
413 | + { |
|
414 | + system($config['autostart_webserver']); |
|
415 | + } |
|
386 | 416 | } |
387 | 417 | else |
388 | 418 | { |
@@ -428,10 +458,16 @@ discard block |
||
428 | 458 | $header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']); |
429 | 459 | run_cmd($header_update); |
430 | 460 | $ret = run_cmd($setup_update,$output,15); |
431 | - if ($ret != 15) break; |
|
461 | + if ($ret != 15) |
|
462 | + { |
|
463 | + break; |
|
464 | + } |
|
432 | 465 | // fall through |
433 | 466 | case 15: // missing configuration (eg. mailserver) |
434 | - if (!$verbose) echo implode("\n",(array)$output)."\n"; |
|
467 | + if (!$verbose) |
|
468 | + { |
|
469 | + echo implode("\n",(array)$output)."\n"; |
|
470 | + } |
|
435 | 471 | break; |
436 | 472 | |
437 | 473 | case 0: |
@@ -461,9 +497,15 @@ discard block |
||
461 | 497 | { |
462 | 498 | global $config; |
463 | 499 | |
464 | - if (isset($config[$cmd])) $cmd = $config[$cmd]; |
|
500 | + if (isset($config[$cmd])) |
|
501 | + { |
|
502 | + $cmd = $config[$cmd]; |
|
503 | + } |
|
465 | 504 | |
466 | - if (strpos($cmd, '%s')) return str_replace('%s', $arg, $cmd); |
|
505 | + if (strpos($cmd, '%s')) |
|
506 | + { |
|
507 | + return str_replace('%s', $arg, $cmd); |
|
508 | + } |
|
467 | 509 | |
468 | 510 | return $cmd.' '.$arg; |
469 | 511 | } |
@@ -532,7 +574,10 @@ discard block |
||
532 | 574 | */ |
533 | 575 | function bail_out($ret=1,$output=null) |
534 | 576 | { |
535 | - if ($output) echo implode("\n",(array)$output); |
|
577 | + if ($output) |
|
578 | + { |
|
579 | + echo implode("\n",(array)$output); |
|
580 | + } |
|
536 | 581 | echo "\n\nInstallation failed --> exiting!\n\n"; |
537 | 582 | exit($ret); |
538 | 583 | } |
@@ -578,7 +623,11 @@ discard block |
||
578 | 623 | echo "options and their defaults:\n"; |
579 | 624 | foreach($config as $name => $default) |
580 | 625 | { |
581 | - if (in_array($name, array('postfix','cyrus'))) continue; // do NOT report deprecated options |
|
626 | + if (in_array($name, array('postfix','cyrus'))) |
|
627 | + { |
|
628 | + continue; |
|
629 | + } |
|
630 | + // do NOT report deprecated options |
|
582 | 631 | if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16) |
583 | 632 | { |
584 | 633 | $default = '<16 char random string>'; |
@@ -676,7 +725,10 @@ discard block |
||
676 | 725 | // only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' && |
677 | 726 | ($domains=_ucr_get('mail/hosteddomains'))) |
678 | 727 | { |
679 | - if (!is_array($domains)) $domains = explode("\n", $domains); |
|
728 | + if (!is_array($domains)) |
|
729 | + { |
|
730 | + $domains = explode("\n", $domains); |
|
731 | + } |
|
680 | 732 | $domain = array_shift($domains); |
681 | 733 | // set "use auth with session credentials",tls,"not user editable","further identities" |
682 | 734 | $config['smtpserver'] = "$mailserver,465,,,yes,tls,no,yes"; |
@@ -695,13 +747,19 @@ discard block |
||
695 | 747 | $config['imap'] = ',,Imap\\Dovecot'; |
696 | 748 | } |
697 | 749 | // default with sieve port to 4190, as config is only available on host mailserver app is installed |
698 | - if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port'))) $sieve_port = 4190; |
|
750 | + if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port'))) |
|
751 | + { |
|
752 | + $sieve_port = 4190; |
|
753 | + } |
|
699 | 754 | } |
700 | 755 | else |
701 | 756 | { |
702 | 757 | $config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',Imap\\Cyrus'; |
703 | 758 | // default with sieve port to 4190, as config is only available on host mailserver app is installed |
704 | - if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) $sieve_port = 4190; |
|
759 | + if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) |
|
760 | + { |
|
761 | + $sieve_port = 4190; |
|
762 | + } |
|
705 | 763 | } |
706 | 764 | // set folders so mail creates them on first login, UCS does not automatic |
707 | 765 | $config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,Spam,,Ham'; |
@@ -764,7 +822,10 @@ discard block |
||
764 | 822 | $shm_size = ini_get('apc.shm_size'); |
765 | 823 | $shm_segments = ini_get('apc.shm_segments'); |
766 | 824 | // ancent APC (3.1.3) in Debian 6/Squezze has size in MB without a unit |
767 | - if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576)) $shm_size .= 'M'; |
|
825 | + if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576)) |
|
826 | + { |
|
827 | + $shm_size .= 'M'; |
|
828 | + } |
|
768 | 829 | |
769 | 830 | $size = _size_with_unit($shm_size) * $shm_segments; |
770 | 831 | //echo "shm_size=$shm_size, shm_segments=$shm_segments --> $size, numeric_size=$numeric_size\n"; |
@@ -780,7 +841,10 @@ discard block |
||
780 | 841 | file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path))) |
781 | 842 | { |
782 | 843 | $new_shm_size = 128 / $shm_segments; |
783 | - if (!$numeric_size) $new_shm_size .= 'M'; |
|
844 | + if (!$numeric_size) |
|
845 | + { |
|
846 | + $new_shm_size .= 'M'; |
|
847 | + } |
|
784 | 848 | if (preg_match('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', $apc_ini)) |
785 | 849 | { |
786 | 850 | file_put_contents($path, preg_replace('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', 'apc.shm_size='.$new_shm_size, $apc_ini)); |
@@ -831,7 +895,10 @@ discard block |
||
831 | 895 | $need_adding = array(); |
832 | 896 | foreach($check_dirs as $dir) |
833 | 897 | { |
834 | - if (!in_array($dir, $open_basedirs)) $need_adding[] = $dir; |
|
898 | + if (!in_array($dir, $open_basedirs)) |
|
899 | + { |
|
900 | + $need_adding[] = $dir; |
|
901 | + } |
|
835 | 902 | } |
836 | 903 | if ($need_adding) |
837 | 904 | { |
@@ -75,8 +75,7 @@ |
||
75 | 75 | /** |
76 | 76 | * Mount GUI |
77 | 77 | * |
78 | - * @param array $content=null |
|
79 | - * @param string $msg='' |
|
78 | + * @param array $content |
|
80 | 79 | */ |
81 | 80 | public function index(array $content=null, $msg='', $msg_type=null) |
82 | 81 | { |
@@ -131,7 +131,10 @@ discard block |
||
131 | 131 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
132 | 132 | { |
133 | 133 | $url = str_replace('$path',$path,$content['mounts']['url']); |
134 | - if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
|
134 | + if (empty($url) && $this->versioning) |
|
135 | + { |
|
136 | + $url = Versioning\StreamWrapper::PREFIX.$path; |
|
137 | + } |
|
135 | 138 | |
136 | 139 | if ($content['mounts']['enable'] && !$this->versioning) |
137 | 140 | { |
@@ -227,16 +230,25 @@ discard block |
||
227 | 230 | $content['versionedpath'] = '/'; |
228 | 231 | $content['mtime'] = 100; |
229 | 232 | } |
230 | - if (true) $content = array( |
|
233 | + if (true) |
|
234 | + { |
|
235 | + $content = array( |
|
231 | 236 | 'versionedpath' => $content['versionedpath'], |
232 | 237 | 'mtime' => $content['mtime'], |
233 | 238 | ); |
239 | + } |
|
234 | 240 | if ($this->versioning) |
235 | 241 | { |
236 | 242 | // statistical information |
237 | 243 | $content += Versioning\StreamWrapper::summary(); |
238 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
239 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
244 | + if ($content['total_files']) |
|
245 | + { |
|
246 | + $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
247 | + } |
|
248 | + if ($content['total_size']) |
|
249 | + { |
|
250 | + $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
251 | + } |
|
240 | 252 | } |
241 | 253 | if (!($content['is_root']=Vfs::$is_root)) |
242 | 254 | { |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | * @param array $content=null |
79 | 79 | * @param string $msg='' |
80 | 80 | */ |
81 | - public function index(array $content=null, $msg='', $msg_type=null) |
|
81 | + public function index(array $content = null, $msg = '', $msg_type = null) |
|
82 | 82 | { |
83 | 83 | if (is_array($content)) |
84 | 84 | { |
85 | 85 | //_debug_array($content); |
86 | 86 | if ($content['sudo']) |
87 | 87 | { |
88 | - $msg = $this->sudo($content['user'],$content['password'],self::$is_setup) ? |
|
88 | + $msg = $this->sudo($content['user'], $content['password'], self::$is_setup) ? |
|
89 | 89 | lang('Root access granted.') : lang('Wrong username or password!'); |
90 | 90 | $msg_type = Vfs::$is_root ? 'success' : 'error'; |
91 | 91 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | Vfs::chgrp($path, 'Admins'); |
100 | 100 | Vfs::chmod($path, 075); |
101 | 101 | $msg = Vfs::mount($url, $path) ? |
102 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
102 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
103 | 103 | Vfs::$is_root = $backup; |
104 | 104 | } |
105 | 105 | elseif (Vfs::$is_root) |
106 | 106 | { |
107 | 107 | if ($content['logout']) |
108 | 108 | { |
109 | - $msg = $this->sudo('','',self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
109 | + $msg = $this->sudo('', '', self::$is_setup) ? 'Logout failed!' : lang('Root access stopped.'); |
|
110 | 110 | $msg_type = !Vfs::$is_root ? 'success' : 'error'; |
111 | 111 | } |
112 | 112 | if ($content['mounts']['disable'] || self::$is_setup && $content['mounts']['umount']) |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | if (!in_array($path, self::$protected_path) && $path != '/') |
123 | 123 | { |
124 | 124 | $msg = Vfs::umount($path) ? |
125 | - lang('%1 successful unmounted.',$path) : lang('Error unmounting %1!',$path); |
|
125 | + lang('%1 successful unmounted.', $path) : lang('Error unmounting %1!', $path); |
|
126 | 126 | } |
127 | 127 | else // re-mount / with sqlFS, to disable versioning |
128 | 128 | { |
129 | - $msg = Vfs::mount($url=Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path,$path) ? |
|
130 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
129 | + $msg = Vfs::mount($url = Vfs\Sqlfs\StreamWrapper::SCHEME.'://default'.$path, $path) ? |
|
130 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | if (($path = $content['mounts']['path']) && |
134 | 134 | ($content['mounts']['enable'] || self::$is_setup && $content['mounts']['mount'])) |
135 | 135 | { |
136 | - $url = str_replace('$path',$path,$content['mounts']['url']); |
|
136 | + $url = str_replace('$path', $path, $content['mounts']['url']); |
|
137 | 137 | if (empty($url) && $this->versioning) $url = Versioning\StreamWrapper::PREFIX.$path; |
138 | 138 | |
139 | 139 | if ($content['mounts']['enable'] && !$this->versioning) |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | elseif (!Vfs::file_exists($path) || !Vfs::is_dir($path)) |
145 | 145 | { |
146 | - $msg = lang('Path %1 not found or not a directory!',$path); |
|
146 | + $msg = lang('Path %1 not found or not a directory!', $path); |
|
147 | 147 | $msg_type = 'error'; |
148 | 148 | } |
149 | 149 | // dont allow to change mount of /apps or /templates (eg. switching on versioning) |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | } |
155 | 155 | else |
156 | 156 | { |
157 | - $msg = Vfs::mount($url,$path) ? |
|
158 | - lang('Successful mounted %1 on %2.',$url,$path) : lang('Error mounting %1 on %2!',$url,$path); |
|
157 | + $msg = Vfs::mount($url, $path) ? |
|
158 | + lang('Successful mounted %1 on %2.', $url, $path) : lang('Error mounting %1 on %2!', $url, $path); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | if ($content['allow_delete_versions'] != $GLOBALS['egw_info']['server']['allow_delete_versions']) |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | 'hidden' => true, |
201 | 201 | 'depth' => true, |
202 | 202 | 'path_preg' => '#/\.(attic|versions)/#', |
203 | - )+(!(int)$content['mtime'] ? array() : array( |
|
204 | - 'mtime' => ($content['mtime']<0?'-':'+').(int)$content['mtime'], |
|
203 | + ) + (!(int)$content['mtime'] ? array() : array( |
|
204 | + 'mtime' => ($content['mtime'] < 0 ? '-' : '+').(int)$content['mtime'], |
|
205 | 205 | )), function($path) use (&$deleted, &$errors) |
206 | 206 | { |
207 | 207 | if (($is_dir = Vfs::is_dir($path)) && Vfs::rmdir($path) || |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | } |
216 | 216 | }); |
217 | 217 | } |
218 | - $time = number_format(microtime(true)-$starttime, 1); |
|
218 | + $time = number_format(microtime(true) - $starttime, 1); |
|
219 | 219 | $msg = ($errors ? lang('%1 errors deleting!', $errors)."\n\n" : ''). |
220 | 220 | lang('%1 files or directories deleted in %2 seconds.', $deleted, $time); |
221 | 221 | $msg_type = $errors ? 'error' : 'info'; |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | { |
239 | 239 | // statistical information |
240 | 240 | $content += Versioning\StreamWrapper::summary(); |
241 | - if ($content['total_files']) $content['percent_files'] = number_format(100.0*$content['version_files']/$content['total_files'],1).'%'; |
|
242 | - if ($content['total_size']) $content['percent_size'] = number_format(100.0*$content['version_size']/$content['total_size'],1).'%'; |
|
241 | + if ($content['total_files']) $content['percent_files'] = number_format(100.0 * $content['version_files'] / $content['total_files'], 1).'%'; |
|
242 | + if ($content['total_size']) $content['percent_size'] = number_format(100.0 * $content['version_size'] / $content['total_size'], 1).'%'; |
|
243 | 243 | } |
244 | - if (!($content['is_root']=Vfs::$is_root)) |
|
244 | + if (!($content['is_root'] = Vfs::$is_root)) |
|
245 | 245 | { |
246 | 246 | if (empty($msg)) |
247 | 247 | { |
@@ -257,16 +257,16 @@ discard block |
||
257 | 257 | |
258 | 258 | $n = 2; |
259 | 259 | $content['mounts'] = array(); |
260 | - foreach(Vfs::mount() as $path => $url) |
|
260 | + foreach (Vfs::mount() as $path => $url) |
|
261 | 261 | { |
262 | 262 | $content['mounts'][$n++] = array( |
263 | 263 | 'path' => $path, |
264 | 264 | 'url' => $url, |
265 | 265 | ); |
266 | 266 | $readonlys["disable[$path]"] = !$this->versioning || !Vfs::$is_root || |
267 | - Vfs::parse_url($url,PHP_URL_SCHEME) != $this->versioning; |
|
267 | + Vfs::parse_url($url, PHP_URL_SCHEME) != $this->versioning; |
|
268 | 268 | } |
269 | - $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
269 | + $readonlys['umount[/]'] = $readonlys['umount[/apps]'] = true; // do not allow to unmount / or /apps |
|
270 | 270 | $readonlys['url'] = !self::$is_setup; |
271 | 271 | |
272 | 272 | $sel_options['allow_delete_versions'] = array( |
@@ -276,13 +276,13 @@ discard block |
||
276 | 276 | ); |
277 | 277 | // show [Mount /etemplates] button for admin, if not already mounted and available |
278 | 278 | $readonlys['etemplates'] = !class_exists('\EGroupware\Stylite\Vfs\Merge\StreamWrapper') || |
279 | - ($fs_tab=Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
279 | + ($fs_tab = Vfs::mount($url)) && isset($fs_tab['/etemplates']) || |
|
280 | 280 | !isset($GLOBALS['egw_info']['user']['apps']['admin']); |
281 | 281 | //_debug_array($content); |
282 | 282 | |
283 | 283 | $tpl = new Etemplate('filemanager.admin'); |
284 | 284 | $GLOBALS['egw_info']['flags']['app_header'] = lang('VFS mounts and versioning'); |
285 | - $tpl->exec('filemanager.filemanager_admin.index',$content,$sel_options,$readonlys); |
|
285 | + $tpl->exec('filemanager.filemanager_admin.index', $content, $sel_options, $readonlys); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | } |
303 | 303 | $content = '<p>'.implode("</p>\n<p>", (array)$msgs)."</p>\n"; |
304 | 304 | |
305 | - $content .= Api\Html::form('<p>'.($check_only&&is_array($msgs) ? |
|
305 | + $content .= Api\Html::form('<p>'.($check_only && is_array($msgs) ? |
|
306 | 306 | Api\Html::submit_button('fix', lang('Fix reported problems')) : ''). |
307 | 307 | Api\Html::submit_button('cancel', lang('Cancel')).'</p>', |
308 | - '','/index.php',array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
308 | + '', '/index.php', array('menuaction'=>'filemanager.filemanager_admin.fsck')); |
|
309 | 309 | |
310 | 310 | $GLOBALS['egw']->framework->render($content, lang('Admin').' - '.lang('Check virtual filesystem'), true); |
311 | 311 | } |
@@ -92,8 +92,6 @@ |
||
92 | 92 | * Here we need to handle any incoming data. Setup is done in the constructor, |
93 | 93 | * output is handled by parent. |
94 | 94 | * |
95 | - * @param type $id |
|
96 | - * @param Etemplate $etemplate |
|
97 | 95 | */ |
98 | 96 | public static function process($content = array()) |
99 | 97 | { |
@@ -104,7 +104,10 @@ |
||
104 | 104 | if ($content['nm']['action']) |
105 | 105 | { |
106 | 106 | $msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
107 | - if($msg) Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
107 | + if($msg) |
|
108 | + { |
|
109 | + Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
110 | + } |
|
108 | 111 | foreach($content['nm']['selected'] as &$id) |
109 | 112 | { |
110 | 113 | $id = 'filemanager::'.$id; |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * Construct the portlet |
24 | 24 | * |
25 | 25 | */ |
26 | - public function __construct(Array &$context = array(), &$need_reload = false) |
|
26 | + public function __construct(array &$context = array(), &$need_reload = false) |
|
27 | 27 | { |
28 | 28 | $context['appname'] = 'filemanager'; |
29 | 29 |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | $context['appname'] = 'filemanager'; |
29 | 29 | |
30 | 30 | // Let parent handle the basic stuff |
31 | - parent::__construct($context,$need_reload); |
|
31 | + parent::__construct($context, $need_reload); |
|
32 | 32 | |
33 | 33 | $this->nm_settings += array( |
34 | 34 | 'get_rows' => 'filemanager.filemanager_favorite_portlet.get_rows', |
35 | 35 | 'csv_export' => true, |
36 | 36 | // Use a different template so it can be accessed from client side |
37 | - 'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows' ), |
|
37 | + 'template' => ($this->nm_settings['view'] == 'tile' ? 'filemanager.tile' : 'filemanager.home.rows'), |
|
38 | 38 | // Filemanager needs this header, it's an important component for actions, but we reduce it to the minimum |
39 | 39 | 'header_left' => 'filemanager.home.header_left', |
40 | 40 | // Use a reduced column set for home, user can change if needed |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'parent_id' => 'dir', |
47 | 47 | 'is_parent' => 'mime', |
48 | 48 | 'is_parent_value'=> Vfs::DIR_MIME_TYPE, |
49 | - 'placeholder_actions' => array('mkdir','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink') |
|
49 | + 'placeholder_actions' => array('mkdir', 'file_drop_mail', 'file_drop_move', 'file_drop_copy', 'file_drop_symlink') |
|
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $ui = new filemanager_ui(); |
81 | 81 | $total = $ui->get_rows($query, $rows, $readonlys); |
82 | 82 | // Change template to match selected view |
83 | - if($query['view']) |
|
83 | + if ($query['view']) |
|
84 | 84 | { |
85 | 85 | $query['template'] = ($query['view'] == 'row' ? 'filemanager.home.rows' : 'filemanager.tile'); |
86 | 86 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | // the etemplate exec to fire again. |
104 | 104 | if ($content['nm']['action']) |
105 | 105 | { |
106 | - $msg = filemanager_ui::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
|
107 | - if($msg) Api\Json\Response::get()->apply('egw.message',array($msg)); |
|
108 | - foreach($content['nm']['selected'] as &$id) |
|
106 | + $msg = filemanager_ui::action($content['nm']['action'], $content['nm']['selected'], $content['nm']['path']); |
|
107 | + if ($msg) Api\Json\Response::get()->apply('egw.message', array($msg)); |
|
108 | + foreach ($content['nm']['selected'] as &$id) |
|
109 | 109 | { |
110 | 110 | $id = 'filemanager::'.$id; |
111 | 111 | } |
112 | 112 | // Directly request an update - this will get filemanager tab too |
113 | - Api\Json\Response::get()->apply('egw.dataRefreshUIDs',array($content['nm']['selected'])); |
|
113 | + Api\Json\Response::get()->apply('egw.dataRefreshUIDs', array($content['nm']['selected'])); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | } |
117 | 117 | \ No newline at end of file |
@@ -91,7 +91,7 @@ |
||
91 | 91 | /** |
92 | 92 | * Entries for filemanagers's admin menu |
93 | 93 | * |
94 | - * @param string|array $location ='admin' hook name or params |
|
94 | + * @param string $location ='admin' hook name or params |
|
95 | 95 | */ |
96 | 96 | static function admin($location = 'admin') |
97 | 97 | { |
@@ -85,7 +85,10 @@ discard block |
||
85 | 85 | $file['Shared files'] = Egw::link('/index.php','menuaction=filemanager.filemanager_shares.index&ajax=true'); |
86 | 86 | display_sidebox(self::$appname,$title,$file); |
87 | 87 | } |
88 | - if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname); |
|
88 | + if ($GLOBALS['egw_info']['user']['apps']['admin']) |
|
89 | + { |
|
90 | + self::admin(self::$appname); |
|
91 | + } |
|
89 | 92 | } |
90 | 93 | |
91 | 94 | /** |
@@ -95,7 +98,10 @@ discard block |
||
95 | 98 | */ |
96 | 99 | static function admin($location = 'admin') |
97 | 100 | { |
98 | - if (is_array($location)) $location = $location['location']; |
|
101 | + if (is_array($location)) |
|
102 | + { |
|
103 | + $location = $location['location']; |
|
104 | + } |
|
99 | 105 | |
100 | 106 | $file = Array( |
101 | 107 | //'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname='.self::$appname.'&ajax=true'), |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ); |
104 | 104 | if ($location == 'admin') |
105 | 105 | { |
106 | - display_section(self::$appname,$file); |
|
106 | + display_section(self::$appname,$file); |
|
107 | 107 | } |
108 | 108 | else |
109 | 109 | { |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | 'yes' => lang('Yes') |
124 | 124 | ); |
125 | 125 | |
126 | - $settings = array( |
|
126 | + $settings = array( |
|
127 | 127 | 'sections.1' => array( |
128 | 128 | 'type' => 'section', |
129 | 129 | 'title' => lang('General settings'), |
@@ -95,7 +95,7 @@ |
||
95 | 95 | { |
96 | 96 | if (is_array($location)) $location = $location['location']; |
97 | 97 | |
98 | - $file = Array( |
|
98 | + $file = array( |
|
99 | 99 | //'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname='.self::$appname.'&ajax=true'), |
100 | 100 | 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname='.self::$appname.'&ajax=true'), |
101 | 101 | 'Check virtual filesystem' => Egw::link('/index.php','menuaction=filemanager.filemanager_admin.fsck'), |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | $basepath = '/home'; |
37 | 37 | $homepath = '/home/'.$GLOBALS['egw_info']['user']['account_lid']; |
38 | 38 | //echo "<p>admin_prefs_sidebox_hooks::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n"; |
39 | - $file_prefs = &$GLOBALS['egw_info']['user']['preferences'][self::$appname]; |
|
39 | + $file_prefs = &$GLOBALS['egw_info']['user']['preferences'][self::$appname]; |
|
40 | 40 | if ($location == 'sidebox_menu') |
41 | 41 | { |
42 | - $title = $GLOBALS['egw_info']['apps'][self::$appname]['title'] . ' '. lang('Menu'); |
|
42 | + $title = $GLOBALS['egw_info']['apps'][self::$appname]['title'].' '.lang('Menu'); |
|
43 | 43 | $file = array(); |
44 | - if($GLOBALS['egw_info']['apps']['stylite']) |
|
44 | + if ($GLOBALS['egw_info']['apps']['stylite']) |
|
45 | 45 | { |
46 | 46 | // add "file a file" (upload) dialog |
47 | 47 | $file[] = array( |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | // add selection for available views, if we have more then one |
55 | 55 | if (count(filemanager_ui::init_views()) > 1) |
56 | 56 | { |
57 | - $index_url = Egw::link('/index.php',array('menuaction' => 'filemanager.filemanager_ui.index'),false); |
|
57 | + $index_url = Egw::link('/index.php', array('menuaction' => 'filemanager.filemanager_ui.index'), false); |
|
58 | 58 | $file[] = array( |
59 | - 'text' => Api\Html::select('filemanager_view',filemanager_ui::get_view(),filemanager_ui::$views,false, |
|
59 | + 'text' => Api\Html::select('filemanager_view', filemanager_ui::get_view(), filemanager_ui::$views, false, |
|
60 | 60 | ' onchange="'."egw_appWindow('filemanager').location='$index_url&view='+this.value;". |
61 | 61 | '" style="width: 100%;"'), |
62 | 62 | 'no_lang' => True, |
@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | } |
66 | 66 | if ($file_prefs['showhome'] != 'no') |
67 | 67 | { |
68 | - $file['Your home directory'] = Egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$homepath,'ajax'=>'true')); |
|
68 | + $file['Your home directory'] = Egw::link('/index.php', array('menuaction'=>self::$appname.'.filemanager_ui.index', 'path'=>$homepath, 'ajax'=>'true')); |
|
69 | 69 | } |
70 | 70 | if ($file_prefs['showusers'] != 'no') |
71 | 71 | { |
72 | - $file['Users and groups'] = Egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$basepath,'ajax'=>'true')); |
|
72 | + $file['Users and groups'] = Egw::link('/index.php', array('menuaction'=>self::$appname.'.filemanager_ui.index', 'path'=>$basepath, 'ajax'=>'true')); |
|
73 | 73 | } |
74 | - if (!empty($file_prefs['showbase']) && $file_prefs['showbase']=='yes') |
|
74 | + if (!empty($file_prefs['showbase']) && $file_prefs['showbase'] == 'yes') |
|
75 | 75 | { |
76 | - $file['Basedirectory'] = Egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$rootpath,'ajax'=>'true')); |
|
76 | + $file['Basedirectory'] = Egw::link('/index.php', array('menuaction'=>self::$appname.'.filemanager_ui.index', 'path'=>$rootpath, 'ajax'=>'true')); |
|
77 | 77 | } |
78 | 78 | if (!empty($file_prefs['startfolder'])) |
79 | 79 | { |
80 | - $file['Startfolder']= Egw::link('/index.php',array('menuaction'=>self::$appname.'.filemanager_ui.index','path'=>$file_prefs['startfolder'],'ajax'=>'true')); |
|
80 | + $file['Startfolder'] = Egw::link('/index.php', array('menuaction'=>self::$appname.'.filemanager_ui.index', 'path'=>$file_prefs['startfolder'], 'ajax'=>'true')); |
|
81 | 81 | } |
82 | - $file['Placeholders'] = Egw::link('/index.php','menuaction=filemanager.filemanager_merge.show_replacements'); |
|
83 | - $file['Shared files'] = Egw::link('/index.php','menuaction=filemanager.filemanager_shares.index&ajax=true'); |
|
84 | - display_sidebox(self::$appname,$title,$file); |
|
82 | + $file['Placeholders'] = Egw::link('/index.php', 'menuaction=filemanager.filemanager_merge.show_replacements'); |
|
83 | + $file['Shared files'] = Egw::link('/index.php', 'menuaction=filemanager.filemanager_shares.index&ajax=true'); |
|
84 | + display_sidebox(self::$appname, $title, $file); |
|
85 | 85 | } |
86 | 86 | if ($GLOBALS['egw_info']['user']['apps']['admin']) self::admin(self::$appname); |
87 | 87 | } |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | |
98 | 98 | $file = Array( |
99 | 99 | //'Site Configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname='.self::$appname.'&ajax=true'), |
100 | - 'Custom fields' => Egw::link('/index.php','menuaction=admin.admin_customfields.index&appname='.self::$appname.'&ajax=true'), |
|
101 | - 'Check virtual filesystem' => Egw::link('/index.php','menuaction=filemanager.filemanager_admin.fsck'), |
|
100 | + 'Custom fields' => Egw::link('/index.php', 'menuaction=admin.admin_customfields.index&appname='.self::$appname.'&ajax=true'), |
|
101 | + 'Check virtual filesystem' => Egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.fsck'), |
|
102 | 102 | 'VFS mounts and versioning' => Egw::link('/index.php', 'menuaction=filemanager.filemanager_admin.index'), |
103 | 103 | ); |
104 | 104 | if ($location == 'admin') |
105 | 105 | { |
106 | - display_section(self::$appname,$file); |
|
106 | + display_section(self::$appname, $file); |
|
107 | 107 | } |
108 | 108 | else |
109 | 109 | { |
110 | - display_sidebox(self::$appname,lang('Admin'),$file); |
|
110 | + display_sidebox(self::$appname, lang('Admin'), $file); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'type' => 'select', |
158 | 158 | 'name' => 'showhome', |
159 | 159 | 'values' => $yes_no, |
160 | - 'label' => lang('Show link "%1" in side box menu?',lang('Your home directory')), |
|
160 | + 'label' => lang('Show link "%1" in side box menu?', lang('Your home directory')), |
|
161 | 161 | 'xmlrpc' => True, |
162 | 162 | 'admin' => False, |
163 | 163 | 'forced' => 'yes', |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | 'type' => 'select', |
167 | 167 | 'name' => 'showusers', |
168 | 168 | 'values' => $yes_no, |
169 | - 'label' => lang('Show link "%1" in side box menu?',lang('Users and groups')), |
|
169 | + 'label' => lang('Show link "%1" in side box menu?', lang('Users and groups')), |
|
170 | 170 | 'xmlrpc' => True, |
171 | 171 | 'admin' => False, |
172 | 172 | 'forced' => 'yes', |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | 'size' => 60, |
179 | 179 | 'label' => 'Default document to insert entries', |
180 | 180 | 'name' => 'default_document', |
181 | - 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.',lang('filemanager')).' '. |
|
181 | + 'help' => lang('If you specify a document (full vfs path) here, %1 displays an extra document icon for each entry. That icon allows to download the specified document with the data inserted.', lang('filemanager')).' '. |
|
182 | 182 | lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'name').' '. |
183 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
183 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
184 | 184 | 'run_lang' => false, |
185 | 185 | 'xmlrpc' => True, |
186 | 186 | 'admin' => False, |
@@ -191,8 +191,8 @@ discard block |
||
191 | 191 | 'label' => 'Directory with documents to insert entries', |
192 | 192 | 'name' => 'document_dir', |
193 | 193 | 'help' => lang('If you specify a directory (full vfs path) here, %1 displays an action for each document. That action allows to download the specified document with the %1 data inserted.', lang('filemanager')).' '. |
194 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','name').' '. |
|
195 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
194 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'name').' '. |
|
195 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
196 | 196 | 'run_lang' => false, |
197 | 197 | 'xmlrpc' => True, |
198 | 198 | 'admin' => False, |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | } |
248 | 248 | asort($mimes); |
249 | - $settings += array ( |
|
249 | + $settings += array( |
|
250 | 250 | 'sections.2' => array( |
251 | 251 | 'type' => 'section', |
252 | 252 | 'title' => lang('Collab Editor settings'), |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | 'type' => 'color', |
259 | 259 | 'label' => lang('User color indicator'), |
260 | 260 | 'name' => 'collab_user_color', |
261 | - 'help' => lang('Use eg. %1 or %2','#FF0000','orange'), |
|
261 | + 'help' => lang('Use eg. %1 or %2', '#FF0000', 'orange'), |
|
262 | 262 | 'no_lang'=> true, |
263 | 263 | 'xmlrpc' => True, |
264 | 264 | 'admin' => False, |
@@ -281,15 +281,15 @@ discard block |
||
281 | 281 | 'label' => lang('Merge print open handler'), |
282 | 282 | 'help' => lang('Defines how to open a merge print document'), |
283 | 283 | 'name' => 'merge_open_handler', |
284 | - 'values' => array ('download' => lang('download'), 'collabora' => 'Collabora'), |
|
284 | + 'values' => array('download' => lang('download'), 'collabora' => 'Collabora'), |
|
285 | 285 | 'default' => 'collabora', |
286 | 286 | ), |
287 | - 'document_doubleclick_action' => array ( |
|
287 | + 'document_doubleclick_action' => array( |
|
288 | 288 | 'type' => 'select', |
289 | 289 | 'label' => lang('Default action on double-click'), |
290 | 290 | 'help' => lang('Defines how to handle double click action on a document file. Images are always opened in the expose-view and emails with email application. All other mime-types are handled by the browser itself.'), |
291 | 291 | 'name' => 'document_doubleclick_action', |
292 | - 'values' => array ( |
|
292 | + 'values' => array( |
|
293 | 293 | 'collabora' => lang('open documents with Collabora, if permissions are given'), |
294 | 294 | 'download' => lang('download documents'), |
295 | 295 | 'collabeditor' => lang('open odt documents with CollabEditor') |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | foreach ($implemented as $app) |
346 | 346 | { |
347 | 347 | if (($access = \EGroupware\Api\Vfs\Links\StreamWrapper::check_app_rights($app)) && |
348 | - ($l = Api\Hooks::process('filemanager-editor-link',$app, true)) && $l[$app] |
|
348 | + ($l = Api\Hooks::process('filemanager-editor-link', $app, true)) && $l[$app] |
|
349 | 349 | && $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_doubleclick_action'] == $app) |
350 | 350 | { |
351 | 351 | $link = $l[$app]; |