@@ -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'; |
@@ -1429,13 +1429,18 @@ discard block |
||
| 1429 | 1429 | function calendar_upgrade1_0_1_008() |
| 1430 | 1430 | { |
| 1431 | 1431 | $config_data = Api\Config::read('calendar'); |
| 1432 | - if (isset($config_data['fields'])) // old custom fields |
|
| 1432 | + if (isset($config_data['fields'])) |
|
| 1433 | + { |
|
| 1434 | + // old custom fields |
|
| 1433 | 1435 | { |
| 1434 | 1436 | $customfields = array(); |
| 1437 | + } |
|
| 1435 | 1438 | $order = 0; |
| 1436 | 1439 | foreach($config_data['fields'] as $name => $data) |
| 1437 | 1440 | { |
| 1438 | - if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
|
| 1441 | + if ($name{0} == '#' && !$data['disabled']) |
|
| 1442 | + { |
|
| 1443 | + // real not-disabled custom field |
|
| 1439 | 1444 | { |
| 1440 | 1445 | $customfields[substr($name,1)] = array( |
| 1441 | 1446 | 'type' => 'text', |
@@ -1444,6 +1449,7 @@ discard block |
||
| 1444 | 1449 | 'order' => ($order += 10), |
| 1445 | 1450 | ); |
| 1446 | 1451 | } |
| 1452 | + } |
|
| 1447 | 1453 | } |
| 1448 | 1454 | if (count($customfields)) |
| 1449 | 1455 | { |
@@ -2589,9 +2595,12 @@ discard block |
||
| 2589 | 2595 | 'cal_recur_date' => $row['cal_recur_date'], |
| 2590 | 2596 | 'cal_user_type' => 'e', |
| 2591 | 2597 | $email.'='.$GLOBALS['egw_setup']->db->quote($row['email']), |
| 2592 | - ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
|
| 2598 | + ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) |
|
| 2599 | + { |
|
| 2600 | + // order A, T, U, X |
|
| 2593 | 2601 | { |
| 2594 | 2602 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
| 2603 | + } |
|
| 2595 | 2604 | $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status')))); |
| 2596 | 2605 | } |
| 2597 | 2606 | } |
@@ -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 | { |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | $owner[count($owner)] = $GLOBALS['egw_setup']->oProc->f($field); |
| 22 | 22 | } |
| 23 | - if($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'],'0.9.10pre4')) |
|
| 23 | + if ($GLOBALS['egw_setup']->alessthanb($GLOBALS['setup_info']['phpgwapi']['currentver'], '0.9.10pre4')) |
|
| 24 | 24 | { |
| 25 | 25 | $acctstbl = 'accounts'; |
| 26 | 26 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $acctstbl = 'phpgw_accounts'; |
| 30 | 30 | } |
| 31 | - for($i=0;$i<count($owner);$i++) |
|
| 31 | + for ($i = 0; $i < count($owner); $i++) |
|
| 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(); |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | function calendar_upgrade0_9_3pre1() |
| 43 | 43 | { |
| 44 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry','cal_create_by'); |
|
| 45 | - calendar_v0_9_2to0_9_3update_owner('webcal_entry_user','cal_login'); |
|
| 44 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry', 'cal_create_by'); |
|
| 45 | + calendar_v0_9_2to0_9_3update_owner('webcal_entry_user', 'cal_login'); |
|
| 46 | 46 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.3pre2'; |
| 47 | 47 | return $GLOBALS['setup_info']['calendar']['currentver']; |
| 48 | 48 | } |
@@ -209,12 +209,12 @@ discard block |
||
| 209 | 209 | ) |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry',__LINE__,__FILE__); |
|
| 212 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry', __LINE__, __FILE__); |
|
| 213 | 213 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 214 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 214 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 215 | 215 | { |
| 216 | - $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__); |
|
| 217 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 216 | + $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__); |
|
| 217 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 218 | 218 | { |
| 219 | 219 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 220 | 220 | $cal_owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | $cal_access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
| 225 | 225 | $cal_name = $GLOBALS['egw_setup']->oProc->f('cal_name'); |
| 226 | 226 | $cal_description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
| 227 | - $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))); |
|
| 228 | - $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))); |
|
| 229 | - $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
| 227 | + $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))); |
|
| 228 | + $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))); |
|
| 229 | + $db2->query('SELECT groups FROM webcal_entry_groups WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
| 230 | 230 | $db2->next_record(); |
| 231 | 231 | $cal_group = $db2->f('groups'); |
| 232 | 232 | $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) ' |
| 233 | - .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')",__LINE__,__FILE__); |
|
| 233 | + .'VALUES('.$cal_id.",'".$cal_owner."','".$cal_group."',".$datetime.",".$moddatetime.",".$cal_duration.",".$cal_priority.",'".$cal_type."','".$cal_access."','".$cal_name."','".$cal_description."')", __LINE__, __FILE__); |
|
| 234 | 234 | } |
| 235 | 235 | } |
| 236 | 236 | |
@@ -251,17 +251,17 @@ discard block |
||
| 251 | 251 | ) |
| 252 | 252 | ); |
| 253 | 253 | |
| 254 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user',__LINE__,__FILE__); |
|
| 254 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_user', __LINE__, __FILE__); |
|
| 255 | 255 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 256 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 256 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 257 | 257 | { |
| 258 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id',__LINE__,__FILE__); |
|
| 259 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 258 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id,cal_login,cal_status FROM webcal_entry_user ORDER BY cal_id', __LINE__, __FILE__); |
|
| 259 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 260 | 260 | { |
| 261 | 261 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 262 | 262 | $cal_login = $GLOBALS['egw_setup']->oProc->f('cal_login'); |
| 263 | 263 | $cal_status = $GLOBALS['egw_setup']->oProc->f('cal_status'); |
| 264 | - $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')",__LINE__,__FILE__); |
|
| 264 | + $db2->query('INSERT INTO calendar_entry_user(cal_id,cal_login,cal_status) VALUES('.$cal_id.','.$cal_login.",'".$cal_status."')", __LINE__, __FILE__); |
|
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
@@ -284,18 +284,18 @@ discard block |
||
| 284 | 284 | ) |
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | - $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats',__LINE__,__FILE__); |
|
| 287 | + $GLOBALS['egw_setup']->oProc->query('SELECT count(*) FROM webcal_entry_repeats', __LINE__, __FILE__); |
|
| 288 | 288 | $GLOBALS['egw_setup']->oProc->next_record(); |
| 289 | - if($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 289 | + if ($GLOBALS['egw_setup']->oProc->f(0)) |
|
| 290 | 290 | { |
| 291 | - $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__); |
|
| 292 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 291 | + $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__); |
|
| 292 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 293 | 293 | { |
| 294 | 294 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 295 | 295 | $cal_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
| 296 | - if(isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
| 296 | + if (isset($GLOBALS['egw_setup']->oProc->Record['cal_end'])) |
|
| 297 | 297 | { |
| 298 | - $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 | + $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))); |
|
| 299 | 299 | $useend = 1; |
| 300 | 300 | } |
| 301 | 301 | else |
@@ -305,12 +305,12 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | $cal_frequency = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
| 307 | 307 | $cal_days = $GLOBALS['egw_setup']->oProc->f('cal_days'); |
| 308 | - $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 | + $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__); |
|
| 309 | 309 | } |
| 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']; |
@@ -322,19 +322,19 @@ discard block |
||
| 322 | 322 | $db2 = $GLOBALS['egw_setup']->db; |
| 323 | 323 | |
| 324 | 324 | $GLOBALS['egw_setup']->oProc->RenameColumn('calendar_entry', 'cal_duration', 'cal_edatetime'); |
| 325 | - $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__); |
|
| 326 | - if($GLOBALS['egw_setup']->oProc->num_rows()) |
|
| 325 | + $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__); |
|
| 326 | + if ($GLOBALS['egw_setup']->oProc->num_rows()) |
|
| 327 | 327 | { |
| 328 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 328 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 329 | 329 | { |
| 330 | - $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 | + $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__); |
|
| 331 | 331 | $db2->next_record(); |
| 332 | 332 | $tz = $db2->f('preference_value'); |
| 333 | 333 | $cal_id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 334 | 334 | $datetime = $GLOBALS['egw_setup']->oProc->f('cal_datetime') - ((60 * 60) * $tz); |
| 335 | 335 | $mdatetime = $GLOBALS['egw_setup']->oProc->f('cal_mdatetime') - ((60 * 60) * $tz); |
| 336 | 336 | $edatetime = $datetime + (60 * $GLOBALS['egw_setup']->oProc->f('cal_edatetime')); |
| 337 | - $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id,__LINE__,__FILE__); |
|
| 337 | + $db2->query('UPDATE calendar_entry SET cal_datetime='.$datetime.', cal_edatetime='.$edatetime.', cal_mdatetime='.$mdatetime.' WHERE cal_id='.$cal_id, __LINE__, __FILE__); |
|
| 338 | 338 | } |
| 339 | 339 | } |
| 340 | 340 | |
@@ -582,22 +582,22 @@ discard block |
||
| 582 | 582 | { |
| 583 | 583 | $db2 = $GLOBALS['egw_setup']->db; |
| 584 | 584 | |
| 585 | - if(extension_loaded('mcal') == False) |
|
| 585 | + if (extension_loaded('mcal') == False) |
|
| 586 | 586 | { |
| 587 | - define(RECUR_NONE,0); |
|
| 588 | - define(RECUR_DAILY,1); |
|
| 589 | - define(RECUR_WEEKLY,2); |
|
| 590 | - define(RECUR_MONTHLY_MDAY,3); |
|
| 591 | - define(RECUR_MONTHLY_WDAY,4); |
|
| 592 | - define(RECUR_YEARLY,5); |
|
| 593 | - |
|
| 594 | - define(M_SUNDAY,1); |
|
| 595 | - define(M_MONDAY,2); |
|
| 596 | - define(M_TUESDAY,4); |
|
| 597 | - define(M_WEDNESDAY,8); |
|
| 598 | - define(M_THURSDAY,16); |
|
| 599 | - define(M_FRIDAY,32); |
|
| 600 | - define(M_SATURDAY,64); |
|
| 587 | + define(RECUR_NONE, 0); |
|
| 588 | + define(RECUR_DAILY, 1); |
|
| 589 | + define(RECUR_WEEKLY, 2); |
|
| 590 | + define(RECUR_MONTHLY_MDAY, 3); |
|
| 591 | + define(RECUR_MONTHLY_WDAY, 4); |
|
| 592 | + define(RECUR_YEARLY, 5); |
|
| 593 | + |
|
| 594 | + define(M_SUNDAY, 1); |
|
| 595 | + define(M_MONDAY, 2); |
|
| 596 | + define(M_TUESDAY, 4); |
|
| 597 | + define(M_WEDNESDAY, 8); |
|
| 598 | + define(M_THURSDAY, 16); |
|
| 599 | + define(M_FRIDAY, 32); |
|
| 600 | + define(M_SATURDAY, 64); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | // calendar_entry => phpgw_cal |
@@ -624,13 +624,13 @@ discard block |
||
| 624 | 624 | ) |
| 625 | 625 | ); |
| 626 | 626 | |
| 627 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry',__LINE__,__FILE__); |
|
| 628 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 627 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry', __LINE__, __FILE__); |
|
| 628 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 629 | 629 | { |
| 630 | 630 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 631 | 631 | $owner = $GLOBALS['egw_setup']->oProc->f('cal_owner'); |
| 632 | 632 | $access = $GLOBALS['egw_setup']->oProc->f('cal_access'); |
| 633 | - switch($access) |
|
| 633 | + switch ($access) |
|
| 634 | 634 | { |
| 635 | 635 | case 'private': |
| 636 | 636 | $is_public = 0; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | $description = $GLOBALS['egw_setup']->oProc->f('cal_description'); |
| 653 | 653 | |
| 654 | 654 | $db2->query("INSERT INTO phpgw_cal(cal_id,owner,groups,datetime,mdatetime,edatetime,priority,cal_type,is_public,title,description) " |
| 655 | - . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')",__LINE__,__FILE__); |
|
| 655 | + . "VALUES($id,$owner,'$groups',$datetime,$mdatetime,$edatetime,$priority,'$type',$is_public,'$title','$description')", __LINE__, __FILE__); |
|
| 656 | 656 | } |
| 657 | 657 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry'); |
| 658 | 658 | |
@@ -660,12 +660,12 @@ discard block |
||
| 660 | 660 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_repeats', |
| 661 | 661 | Array( |
| 662 | 662 | 'fd' => array( |
| 663 | - 'cal_id' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
| 664 | - 'recur_type' => array('type' => 'int', 'precision' => 8,'nullable' => False), |
|
| 665 | - 'recur_use_end' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
| 666 | - 'recur_enddate' => array('type' => 'int', 'precision' => 8,'nullable' => True), |
|
| 667 | - 'recur_interval' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1'), |
|
| 668 | - 'recur_data' => array('type' => 'int', 'precision' => 8,'nullable' => True,'default' => '1') |
|
| 663 | + 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
| 664 | + 'recur_type' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
|
| 665 | + 'recur_use_end' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
| 666 | + 'recur_enddate' => array('type' => 'int', 'precision' => 8, 'nullable' => True), |
|
| 667 | + 'recur_interval' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1'), |
|
| 668 | + 'recur_data' => array('type' => 'int', 'precision' => 8, 'nullable' => True, 'default' => '1') |
|
| 669 | 669 | ), |
| 670 | 670 | 'pk' => array(), |
| 671 | 671 | 'fk' => array(), |
@@ -673,12 +673,12 @@ discard block |
||
| 673 | 673 | 'uc' => array() |
| 674 | 674 | ) |
| 675 | 675 | ); |
| 676 | - $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats',__LINE__,__FILE__); |
|
| 677 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 676 | + $GLOBALS['egw_setup']->oProc->query('SELECT * FROM calendar_entry_repeats', __LINE__, __FILE__); |
|
| 677 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 678 | 678 | { |
| 679 | 679 | $id = $GLOBALS['egw_setup']->oProc->f('cal_id'); |
| 680 | 680 | $recur_type = $GLOBALS['egw_setup']->oProc->f('cal_type'); |
| 681 | - switch($recur_type) |
|
| 681 | + switch ($recur_type) |
|
| 682 | 682 | { |
| 683 | 683 | case 'daily': |
| 684 | 684 | $recur_type_num = RECUR_DAILY; |
@@ -701,20 +701,20 @@ discard block |
||
| 701 | 701 | $recur_interval = $GLOBALS['egw_setup']->oProc->f('cal_frequency'); |
| 702 | 702 | $days = strtoupper($GLOBALS['egw_setup']->oProc->f('cal_days')); |
| 703 | 703 | $recur_data = 0; |
| 704 | - $recur_data += (substr($days,0,1)=='Y'?M_SUNDAY:0); |
|
| 705 | - $recur_data += (substr($days,1,1)=='Y'?M_MONDAY:0); |
|
| 706 | - $recur_data += (substr($days,2,1)=='Y'?M_TUESDAY:0); |
|
| 707 | - $recur_data += (substr($days,3,1)=='Y'?M_WEDNESDAY:0); |
|
| 708 | - $recur_data += (substr($days,4,1)=='Y'?M_THURSDAY:0); |
|
| 709 | - $recur_data += (substr($days,5,1)=='Y'?M_FRIDAY:0); |
|
| 710 | - $recur_data += (substr($days,6,1)=='Y'?M_SATURDAY:0); |
|
| 704 | + $recur_data += (substr($days, 0, 1) == 'Y' ? M_SUNDAY : 0); |
|
| 705 | + $recur_data += (substr($days, 1, 1) == 'Y' ? M_MONDAY : 0); |
|
| 706 | + $recur_data += (substr($days, 2, 1) == 'Y' ? M_TUESDAY : 0); |
|
| 707 | + $recur_data += (substr($days, 3, 1) == 'Y' ? M_WEDNESDAY : 0); |
|
| 708 | + $recur_data += (substr($days, 4, 1) == 'Y' ? M_THURSDAY : 0); |
|
| 709 | + $recur_data += (substr($days, 5, 1) == 'Y' ? M_FRIDAY : 0); |
|
| 710 | + $recur_data += (substr($days, 6, 1) == 'Y' ? M_SATURDAY : 0); |
|
| 711 | 711 | $db2->query("INSERT INTO phpgw_cal_repeats(cal_id,recur_type,recur_use_end,recur_enddate,recur_interval,recur_data) " |
| 712 | - . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)",__LINE__,__FILE__); |
|
| 712 | + . "VALUES($id,$recur_type_num,$recur_use_end,$recur_end,$recur_interval,$recur_data)", __LINE__, __FILE__); |
|
| 713 | 713 | } |
| 714 | 714 | $GLOBALS['egw_setup']->oProc->DropTable('calendar_entry_repeats'); |
| 715 | 715 | |
| 716 | 716 | // calendar_entry_user => phpgw_cal_user |
| 717 | - $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user','phpgw_cal_user'); |
|
| 717 | + $GLOBALS['egw_setup']->oProc->RenameTable('calendar_entry_user', 'phpgw_cal_user'); |
|
| 718 | 718 | |
| 719 | 719 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.002'; |
| 720 | 720 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -733,11 +733,11 @@ discard block |
||
| 733 | 733 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
| 734 | 734 | Array( |
| 735 | 735 | 'fd' => array( |
| 736 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
| 737 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
| 738 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
| 736 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
| 737 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
| 738 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
| 739 | 739 | ), |
| 740 | - 'pk' => array('locale','name'), |
|
| 740 | + 'pk' => array('locale', 'name'), |
|
| 741 | 741 | 'fk' => array(), |
| 742 | 742 | 'ix' => array(), |
| 743 | 743 | 'uc' => array() |
@@ -769,10 +769,10 @@ discard block |
||
| 769 | 769 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_holidays', |
| 770 | 770 | Array( |
| 771 | 771 | 'fd' => array( |
| 772 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
| 773 | - 'locale' => array('type' => 'char', 'precision' => 2,'nullable' => False), |
|
| 774 | - 'name' => array('type' => 'varchar', 'precision' => 50,'nullable' => False), |
|
| 775 | - 'date_time' => array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0') |
|
| 772 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
| 773 | + 'locale' => array('type' => 'char', 'precision' => 2, 'nullable' => False), |
|
| 774 | + 'name' => array('type' => 'varchar', 'precision' => 50, 'nullable' => False), |
|
| 775 | + 'date_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0') |
|
| 776 | 776 | ), |
| 777 | 777 | 'pk' => array('hol_id'), |
| 778 | 778 | 'fk' => array(), |
@@ -789,10 +789,10 @@ discard block |
||
| 789 | 789 | function calendar_upgrade0_9_11_007() |
| 790 | 790 | { |
| 791 | 791 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
| 792 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','mday',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 793 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','month_num',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 794 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','occurence',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 795 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','dow',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 792 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'mday', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 793 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'month_num', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 794 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'occurence', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 795 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'dow', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 796 | 796 | |
| 797 | 797 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.008'; |
| 798 | 798 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | function calendar_upgrade0_9_11_009() |
| 810 | 810 | { |
| 811 | 811 | $GLOBALS['egw_setup']->oProc->query('DELETE FROM phpgw_cal_holidays'); |
| 812 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays','observance_rule',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 812 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_holidays', 'observance_rule', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 813 | 813 | |
| 814 | 814 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.11.010'; |
| 815 | 815 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | function calendar_upgrade0_9_13_002() |
| 846 | 846 | { |
| 847 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','reference',array('type' => 'int', 'precision' => 8,'nullable' => False, 'default' => '0')); |
|
| 847 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'reference', array('type' => 'int', 'precision' => 8, 'nullable' => False, 'default' => '0')); |
|
| 848 | 848 | |
| 849 | 849 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.003'; |
| 850 | 850 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_alarm', |
| 857 | 857 | Array( |
| 858 | 858 | 'fd' => array( |
| 859 | - 'alarm_id' => array('type' => 'auto','nullable' => False), |
|
| 859 | + 'alarm_id' => array('type' => 'auto', 'nullable' => False), |
|
| 860 | 860 | 'cal_id' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
| 861 | 861 | 'cal_owner' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
| 862 | 862 | 'cal_time' => array('type' => 'int', 'precision' => 8, 'nullable' => False), |
@@ -869,8 +869,8 @@ discard block |
||
| 869 | 869 | ) |
| 870 | 870 | ); |
| 871 | 871 | |
| 872 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','uid',array('type' => 'varchar', 'precision' => 255,'nullable' => False)); |
|
| 873 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal','location',array('type' => 'varchar', 'precision' => 255,'nullable' => True)); |
|
| 872 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'uid', array('type' => 'varchar', 'precision' => 255, 'nullable' => False)); |
|
| 873 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal', 'location', array('type' => 'varchar', 'precision' => 255, 'nullable' => True)); |
|
| 874 | 874 | |
| 875 | 875 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.004'; |
| 876 | 876 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | |
| 880 | 880 | function calendar_upgrade0_9_13_004() |
| 881 | 881 | { |
| 882 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm','alarm_enabled',array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => '1')); |
|
| 882 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_alarm', 'alarm_enabled', array('type' => 'int', 'precision' => 4, 'nullable' => False, 'default' => '1')); |
|
| 883 | 883 | |
| 884 | 884 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.005'; |
| 885 | 885 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -889,18 +889,18 @@ discard block |
||
| 889 | 889 | function calendar_upgrade0_9_13_005() |
| 890 | 890 | { |
| 891 | 891 | $calendar_data = Array(); |
| 892 | - $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal',__LINE__,__FILE__); |
|
| 893 | - while($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 892 | + $GLOBALS['egw_setup']->oProc->query('SELECT cal_id, category FROM phpgw_cal', __LINE__, __FILE__); |
|
| 893 | + while ($GLOBALS['egw_setup']->oProc->next_record()) |
|
| 894 | 894 | { |
| 895 | 895 | $calendar_data[$GLOBALS['egw_setup']->oProc->f('cal_id')] = $GLOBALS['egw_setup']->oProc->f('category'); |
| 896 | 896 | } |
| 897 | 897 | |
| 898 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','category',array('type' => 'varchar', 'precision' => 30,'nullable' => True)); |
|
| 898 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'category', array('type' => 'varchar', 'precision' => 30, 'nullable' => True)); |
|
| 899 | 899 | |
| 900 | 900 | @reset($calendar_data); |
| 901 | - while($calendar_data && list($cal_id,$category) = each($calendar_data)) |
|
| 901 | + while ($calendar_data && list($cal_id, $category) = each($calendar_data)) |
|
| 902 | 902 | { |
| 903 | - $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id,__LINE__,__FILE__); |
|
| 903 | + $GLOBALS['egw_setup']->oProc->query("UPDATE phpgw_cal SET category='".$category."' WHERE cal_id=".$cal_id, __LINE__, __FILE__); |
|
| 904 | 904 | } |
| 905 | 905 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.006'; |
| 906 | 906 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | |
| 910 | 910 | function calendar_upgrade0_9_13_006() |
| 911 | 911 | { |
| 912 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats','recur_exception',array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
| 912 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_repeats', 'recur_exception', array('type' => 'varchar', 'precision' => 255, 'nullable' => True, 'default' => '')); |
|
| 913 | 913 | |
| 914 | 914 | $GLOBALS['setup_info']['calendar']['currentver'] = '0.9.13.007'; |
| 915 | 915 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -919,20 +919,20 @@ discard block |
||
| 919 | 919 | |
| 920 | 920 | function calendar_upgrade0_9_13_007() |
| 921 | 921 | { |
| 922 | - $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user','cal_type',array( |
|
| 922 | + $GLOBALS['egw_setup']->oProc->AddColumn('phpgw_cal_user', 'cal_type', array( |
|
| 923 | 923 | 'type' => 'varchar', |
| 924 | 924 | 'precision' => '1', |
| 925 | 925 | 'nullable' => False, |
| 926 | 926 | 'default' => 'u' |
| 927 | 927 | )); |
| 928 | 928 | |
| 929 | - $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra',array( |
|
| 929 | + $GLOBALS['egw_setup']->oProc->CreateTable('phpgw_cal_extra', array( |
|
| 930 | 930 | 'fd' => array( |
| 931 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 932 | - 'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False), |
|
| 933 | - 'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '') |
|
| 931 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 932 | + 'cal_extra_name' => array('type' => 'varchar', 'precision' => '40', 'nullable' => False), |
|
| 933 | + 'cal_extra_value' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '') |
|
| 934 | 934 | ), |
| 935 | - 'pk' => array('cal_id','cal_extra_name'), |
|
| 935 | + 'pk' => array('cal_id', 'cal_extra_name'), |
|
| 936 | 936 | 'fk' => array(), |
| 937 | 937 | 'ix' => array(), |
| 938 | 938 | 'uc' => array() |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | function calendar_upgrade0_9_16_001() |
| 950 | 950 | { |
| 951 | 951 | // this is to set the default as schema_proc was not setting an empty default |
| 952 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user','cal_type',array( |
|
| 952 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal_user', 'cal_type', array( |
|
| 953 | 953 | 'type' => 'varchar', |
| 954 | 954 | 'precision' => '1', |
| 955 | 955 | 'nullable' => False, |
@@ -966,15 +966,15 @@ discard block |
||
| 966 | 966 | |
| 967 | 967 | function calendar_upgrade0_9_16_002() |
| 968 | 968 | { |
| 969 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
| 969 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
| 970 | 970 | 'fd' => array( |
| 971 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 972 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 973 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 974 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 975 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 976 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 977 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 971 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 972 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 973 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 974 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 975 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 976 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 977 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 978 | 978 | ), |
| 979 | 979 | 'pk' => array(), |
| 980 | 980 | 'fk' => array(), |
@@ -990,14 +990,14 @@ discard block |
||
| 990 | 990 | |
| 991 | 991 | function calendar_upgrade0_9_16_003() |
| 992 | 992 | { |
| 993 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user',array( |
|
| 993 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_user', array( |
|
| 994 | 994 | 'fd' => array( |
| 995 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 996 | - 'cal_login' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 997 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A'), |
|
| 998 | - 'cal_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u') |
|
| 995 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 996 | + 'cal_login' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 997 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A'), |
|
| 998 | + 'cal_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u') |
|
| 999 | 999 | ), |
| 1000 | - 'pk' => array('cal_id','cal_login','cal_type'), |
|
| 1000 | + 'pk' => array('cal_id', 'cal_login', 'cal_type'), |
|
| 1001 | 1001 | 'fk' => array(), |
| 1002 | 1002 | 'ix' => array(), |
| 1003 | 1003 | 'uc' => array() |
@@ -1011,16 +1011,16 @@ discard block |
||
| 1011 | 1011 | |
| 1012 | 1012 | function calendar_upgrade0_9_16_004() |
| 1013 | 1013 | { |
| 1014 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays',array( |
|
| 1014 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_holidays', array( |
|
| 1015 | 1015 | 'fd' => array( |
| 1016 | - 'hol_id' => array('type' => 'auto','nullable' => False), |
|
| 1017 | - 'locale' => array('type' => 'char','precision' => '2','nullable' => False), |
|
| 1018 | - 'name' => array('type' => 'varchar','precision' => '50','nullable' => False), |
|
| 1019 | - 'mday' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1020 | - 'month_num' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1021 | - 'occurence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1022 | - 'dow' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1023 | - 'observance_rule' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1016 | + 'hol_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1017 | + 'locale' => array('type' => 'char', 'precision' => '2', 'nullable' => False), |
|
| 1018 | + 'name' => array('type' => 'varchar', 'precision' => '50', 'nullable' => False), |
|
| 1019 | + 'mday' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1020 | + 'month_num' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1021 | + 'occurence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1022 | + 'dow' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1023 | + 'observance_rule' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1024 | 1024 | ), |
| 1025 | 1025 | 'pk' => array('hol_id'), |
| 1026 | 1026 | 'fk' => array(), |
@@ -1038,13 +1038,13 @@ discard block |
||
| 1038 | 1038 | { |
| 1039 | 1039 | // creates uid's for all entries which do not have unique ones, they are '[email protected]' |
| 1040 | 1040 | // very old entries even have an empty uid, see 0.9.16.006 update |
| 1041 | - $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 | + $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__); |
|
| 1042 | 1042 | while ($GLOBALS['egw_setup']->oProc->next_record()) |
| 1043 | 1043 | { |
| 1044 | 1044 | $config[$GLOBALS['egw_setup']->oProc->f(0)] = $GLOBALS['egw_setup']->oProc->f(1); |
| 1045 | 1045 | } |
| 1046 | 1046 | $GLOBALS['egw_setup']->oProc->query('UPDATE phpgw_cal SET uid='. |
| 1047 | - $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'),'cal_id', |
|
| 1047 | + $GLOBALS['egw_setup']->db->concat($GLOBALS['egw_setup']->db->quote('cal-'), 'cal_id', |
|
| 1048 | 1048 | $GLOBALS['egw_setup']->db->quote('-'.$config['install_id'].'@'. |
| 1049 | 1049 | ($config['mail_suffix'] ? $config['mail_suffix'] : 'local'))). |
| 1050 | 1050 | " WHERE uid LIKE '-@%' OR uid=''"); |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | function calendar_upgrade0_9_16_007() |
| 1068 | 1068 | { |
| 1069 | 1069 | // update the sequenzes for refreshed tables (postgres only) |
| 1070 | - $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays','hol_id'); |
|
| 1070 | + $GLOBALS['egw_setup']->oProc->UpdateSequence('phpgw_cal_holidays', 'hol_id'); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0'; |
| 1073 | 1073 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1077,19 +1077,19 @@ discard block |
||
| 1077 | 1077 | |
| 1078 | 1078 | function calendar_upgrade1_0_0() |
| 1079 | 1079 | { |
| 1080 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','uid','cal_uid'); |
|
| 1081 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','owner','cal_owner'); |
|
| 1082 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','category','cal_category'); |
|
| 1083 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','groups','cal_groups'); |
|
| 1084 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','datetime','cal_starttime'); |
|
| 1085 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','mdatetime','cal_modified'); |
|
| 1086 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','edatetime','cal_endtime'); |
|
| 1087 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','priority','cal_priority'); |
|
| 1088 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','is_public','cal_public'); |
|
| 1089 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','title','cal_title'); |
|
| 1090 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','description','cal_description'); |
|
| 1091 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','location','cal_location'); |
|
| 1092 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal','reference','cal_reference'); |
|
| 1080 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'uid', 'cal_uid'); |
|
| 1081 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'owner', 'cal_owner'); |
|
| 1082 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'category', 'cal_category'); |
|
| 1083 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'groups', 'cal_groups'); |
|
| 1084 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'datetime', 'cal_starttime'); |
|
| 1085 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'mdatetime', 'cal_modified'); |
|
| 1086 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'edatetime', 'cal_endtime'); |
|
| 1087 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'priority', 'cal_priority'); |
|
| 1088 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'is_public', 'cal_public'); |
|
| 1089 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'title', 'cal_title'); |
|
| 1090 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'description', 'cal_description'); |
|
| 1091 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'location', 'cal_location'); |
|
| 1092 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal', 'reference', 'cal_reference'); |
|
| 1093 | 1093 | |
| 1094 | 1094 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.001'; |
| 1095 | 1095 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1099,13 +1099,13 @@ discard block |
||
| 1099 | 1099 | |
| 1100 | 1100 | function calendar_upgrade1_0_0_001() |
| 1101 | 1101 | { |
| 1102 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','locale','hol_locale'); |
|
| 1103 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','name','hol_name'); |
|
| 1104 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','mday','hol_mday'); |
|
| 1105 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','month_num','hol_month_num'); |
|
| 1106 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','occurence','hol_occurence'); |
|
| 1107 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','dow','hol_dow'); |
|
| 1108 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays','observance_rule','hol_observance_rule'); |
|
| 1102 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'locale', 'hol_locale'); |
|
| 1103 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'name', 'hol_name'); |
|
| 1104 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'mday', 'hol_mday'); |
|
| 1105 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'month_num', 'hol_month_num'); |
|
| 1106 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'occurence', 'hol_occurence'); |
|
| 1107 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'dow', 'hol_dow'); |
|
| 1108 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_holidays', 'observance_rule', 'hol_observance_rule'); |
|
| 1109 | 1109 | |
| 1110 | 1110 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.002'; |
| 1111 | 1111 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1115,8 +1115,8 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | function calendar_upgrade1_0_0_002() |
| 1117 | 1117 | { |
| 1118 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_login','cal_user_id'); |
|
| 1119 | - $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user','cal_type','cal_user_type'); |
|
| 1118 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_login', 'cal_user_id'); |
|
| 1119 | + $GLOBALS['egw_setup']->oProc->RenameColumn('phpgw_cal_user', 'cal_type', 'cal_user_type'); |
|
| 1120 | 1120 | |
| 1121 | 1121 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.0.003'; |
| 1122 | 1122 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1126,7 +1126,7 @@ discard block |
||
| 1126 | 1126 | |
| 1127 | 1127 | function calendar_upgrade1_0_0_003() |
| 1128 | 1128 | { |
| 1129 | - $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal','cal_title',array( |
|
| 1129 | + $GLOBALS['egw_setup']->oProc->AlterColumn('phpgw_cal', 'cal_title', array( |
|
| 1130 | 1130 | 'type' => 'varchar', |
| 1131 | 1131 | 'precision' => '255', |
| 1132 | 1132 | 'nullable' => False, |
@@ -1141,15 +1141,15 @@ discard block |
||
| 1141 | 1141 | |
| 1142 | 1142 | function calendar_upgrade1_0_0_004() |
| 1143 | 1143 | { |
| 1144 | - $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats',array( |
|
| 1144 | + $GLOBALS['egw_setup']->oProc->RefreshTable('phpgw_cal_repeats', array( |
|
| 1145 | 1145 | 'fd' => array( |
| 1146 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1147 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1148 | - 'recur_use_end' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 1149 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 1150 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1151 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1152 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 1146 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1147 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1148 | + 'recur_use_end' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 1149 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 1150 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1151 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1152 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 1153 | 1153 | ), |
| 1154 | 1154 | 'pk' => array('cal_id'), |
| 1155 | 1155 | 'fk' => array(), |
@@ -1166,19 +1166,19 @@ discard block |
||
| 1166 | 1166 | function calendar_upgrade1_0_0_005() |
| 1167 | 1167 | { |
| 1168 | 1168 | // change prefix of all calendar tables to egw_ |
| 1169 | - foreach(array('cal_user','cal_repeats','cal_extra','cal_holidays','cal') as $name) |
|
| 1169 | + foreach (array('cal_user', 'cal_repeats', 'cal_extra', 'cal_holidays', 'cal') as $name) |
|
| 1170 | 1170 | { |
| 1171 | - $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name,'egw_'.$name); |
|
| 1171 | + $GLOBALS['egw_setup']->oProc->RenameTable('phpgw_'.$name, 'egw_'.$name); |
|
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | // create new dates table, with content from the egw_cal table |
| 1175 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates',array( |
|
| 1175 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_dates', array( |
|
| 1176 | 1176 | 'fd' => array( |
| 1177 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1178 | - 'cal_start' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1179 | - 'cal_end' => array('type' => 'int','precision' => '8','nullable' => False) |
|
| 1177 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1178 | + 'cal_start' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1179 | + 'cal_end' => array('type' => 'int', 'precision' => '8', 'nullable' => False) |
|
| 1180 | 1180 | ), |
| 1181 | - 'pk' => array('cal_id','cal_start'), |
|
| 1181 | + 'pk' => array('cal_id', 'cal_start'), |
|
| 1182 | 1182 | 'fk' => array(), |
| 1183 | 1183 | 'ix' => array(), |
| 1184 | 1184 | 'uc' => array() |
@@ -1186,49 +1186,49 @@ discard block |
||
| 1186 | 1186 | $GLOBALS['egw_setup']->oProc->query("INSERT INTO egw_cal_dates SELECT cal_id,cal_starttime,cal_endtime FROM egw_cal"); |
| 1187 | 1187 | |
| 1188 | 1188 | // drop the fields transfered to the dates table |
| 1189 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1189 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1190 | 1190 | 'fd' => array( |
| 1191 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1192 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1193 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1194 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1195 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1196 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1197 | - 'cal_endtime' => array('type' => 'int','precision' => '8'), |
|
| 1198 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1199 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
| 1200 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1201 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1191 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1192 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1193 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1194 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1195 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1196 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1197 | + 'cal_endtime' => array('type' => 'int', 'precision' => '8'), |
|
| 1198 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1199 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
| 1200 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1201 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1202 | 1202 | 'cal_description' => array('type' => 'text'), |
| 1203 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1204 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1203 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1204 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1205 | 1205 | ), |
| 1206 | 1206 | 'pk' => array('cal_id'), |
| 1207 | 1207 | 'fk' => array(), |
| 1208 | 1208 | 'ix' => array(), |
| 1209 | 1209 | 'uc' => array() |
| 1210 | - ),'cal_starttime'); |
|
| 1211 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1210 | + ), 'cal_starttime'); |
|
| 1211 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1212 | 1212 | 'fd' => array( |
| 1213 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1214 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1215 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1216 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1217 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1218 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1219 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1220 | - 'cal_type' => array('type' => 'varchar','precision' => '10'), |
|
| 1221 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1222 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1213 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1214 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1215 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1216 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1217 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1218 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1219 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1220 | + 'cal_type' => array('type' => 'varchar', 'precision' => '10'), |
|
| 1221 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1222 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1223 | 1223 | 'cal_description' => array('type' => 'text'), |
| 1224 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1225 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1224 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1225 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1226 | 1226 | ), |
| 1227 | 1227 | 'pk' => array('cal_id'), |
| 1228 | 1228 | 'fk' => array(), |
| 1229 | 1229 | 'ix' => array(), |
| 1230 | 1230 | 'uc' => array() |
| 1231 | - ),'cal_endtime'); |
|
| 1231 | + ), 'cal_endtime'); |
|
| 1232 | 1232 | |
| 1233 | 1233 | $GLOBALS['setup_info']['calendar']['currentver'] = '1.0.1.001'; |
| 1234 | 1234 | return $GLOBALS['setup_info']['calendar']['currentver']; |
@@ -1244,15 +1244,15 @@ discard block |
||
| 1244 | 1244 | 'precision' => '8', |
| 1245 | 1245 | 'default' => '0' |
| 1246 | 1246 | ));*/ |
| 1247 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
| 1247 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
| 1248 | 1248 | 'fd' => array( |
| 1249 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1250 | - 'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'), |
|
| 1251 | - 'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u'), |
|
| 1252 | - 'cal_user_id' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0'), |
|
| 1253 | - 'cal_status' => array('type' => 'char','precision' => '1','default' => 'A') |
|
| 1249 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1250 | + 'cal_recur_date' => array('type' => 'int', 'precision' => '8', 'default' => '0'), |
|
| 1251 | + 'cal_user_type' => array('type' => 'varchar', 'precision' => '1', 'nullable' => False, 'default' => 'u'), |
|
| 1252 | + 'cal_user_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 1253 | + 'cal_status' => array('type' => 'char', 'precision' => '1', 'default' => 'A') |
|
| 1254 | 1254 | ), |
| 1255 | - 'pk' => array('cal_id','cal_recur_date','cal_user_type','cal_user_id'), |
|
| 1255 | + 'pk' => array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id'), |
|
| 1256 | 1256 | 'fk' => array(), |
| 1257 | 1257 | 'ix' => array(), |
| 1258 | 1258 | 'uc' => array() |
@@ -1266,50 +1266,50 @@ discard block |
||
| 1266 | 1266 | |
| 1267 | 1267 | function calendar_upgrade1_0_1_002() |
| 1268 | 1268 | { |
| 1269 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1269 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1270 | 1270 | 'fd' => array( |
| 1271 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1272 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1273 | - 'cal_owner' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1274 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1275 | - 'cal_groups' => array('type' => 'varchar','precision' => '255'), |
|
| 1276 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1277 | - 'cal_priority' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '2'), |
|
| 1278 | - 'cal_public' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '1'), |
|
| 1279 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1271 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1272 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1273 | + 'cal_owner' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1274 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1275 | + 'cal_groups' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1276 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1277 | + 'cal_priority' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '2'), |
|
| 1278 | + 'cal_public' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '1'), |
|
| 1279 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1280 | 1280 | 'cal_description' => array('type' => 'text'), |
| 1281 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1282 | - 'cal_reference' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0') |
|
| 1281 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1282 | + 'cal_reference' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0') |
|
| 1283 | 1283 | ), |
| 1284 | 1284 | 'pk' => array('cal_id'), |
| 1285 | 1285 | 'fk' => array(), |
| 1286 | 1286 | 'ix' => array(), |
| 1287 | 1287 | 'uc' => array() |
| 1288 | - ),'cal_type'); |
|
| 1289 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_owner',array( |
|
| 1288 | + ), 'cal_type'); |
|
| 1289 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_owner', array( |
|
| 1290 | 1290 | 'type' => 'int', |
| 1291 | 1291 | 'precision' => '4', |
| 1292 | 1292 | 'nullable' => False |
| 1293 | 1293 | )); |
| 1294 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_priority',array( |
|
| 1294 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_priority', array( |
|
| 1295 | 1295 | 'type' => 'int', |
| 1296 | 1296 | 'precision' => '2', |
| 1297 | 1297 | 'nullable' => False, |
| 1298 | 1298 | 'default' => '2' |
| 1299 | 1299 | )); |
| 1300 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_public',array( |
|
| 1300 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_public', array( |
|
| 1301 | 1301 | 'type' => 'int', |
| 1302 | 1302 | 'precision' => '2', |
| 1303 | 1303 | 'nullable' => False, |
| 1304 | 1304 | 'default' => '1' |
| 1305 | 1305 | )); |
| 1306 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_reference',array( |
|
| 1306 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_reference', array( |
|
| 1307 | 1307 | 'type' => 'int', |
| 1308 | 1308 | 'precision' => '4', |
| 1309 | 1309 | 'nullable' => False, |
| 1310 | 1310 | 'default' => '0' |
| 1311 | 1311 | )); |
| 1312 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_modifier',array( |
|
| 1312 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_modifier', array( |
|
| 1313 | 1313 | 'type' => 'int', |
| 1314 | 1314 | 'precision' => '4' |
| 1315 | 1315 | )); |
@@ -1322,36 +1322,36 @@ discard block |
||
| 1322 | 1322 | |
| 1323 | 1323 | function calendar_upgrade1_0_1_003() |
| 1324 | 1324 | { |
| 1325 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
| 1325 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
| 1326 | 1326 | 'fd' => array( |
| 1327 | - 'cal_id' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1328 | - 'recur_type' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 1329 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 1330 | - 'recur_interval' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1331 | - 'recur_data' => array('type' => 'int','precision' => '8','default' => '1'), |
|
| 1332 | - 'recur_exception' => array('type' => 'varchar','precision' => '255','default' => '') |
|
| 1327 | + 'cal_id' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1328 | + 'recur_type' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 1329 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 1330 | + 'recur_interval' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1331 | + 'recur_data' => array('type' => 'int', 'precision' => '8', 'default' => '1'), |
|
| 1332 | + 'recur_exception' => array('type' => 'varchar', 'precision' => '255', 'default' => '') |
|
| 1333 | 1333 | ), |
| 1334 | 1334 | 'pk' => array('cal_id'), |
| 1335 | 1335 | 'fk' => array(), |
| 1336 | 1336 | 'ix' => array(), |
| 1337 | 1337 | 'uc' => array() |
| 1338 | - ),'recur_use_end'); |
|
| 1339 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','cal_id',array( |
|
| 1338 | + ), 'recur_use_end'); |
|
| 1339 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'cal_id', array( |
|
| 1340 | 1340 | 'type' => 'int', |
| 1341 | 1341 | 'precision' => '4', |
| 1342 | 1342 | 'nullable' => False |
| 1343 | 1343 | )); |
| 1344 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_type',array( |
|
| 1344 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_type', array( |
|
| 1345 | 1345 | 'type' => 'int', |
| 1346 | 1346 | 'precision' => '2', |
| 1347 | 1347 | 'nullable' => False |
| 1348 | 1348 | )); |
| 1349 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_interval',array( |
|
| 1349 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_interval', array( |
|
| 1350 | 1350 | 'type' => 'int', |
| 1351 | 1351 | 'precision' => '2', |
| 1352 | 1352 | 'default' => '1' |
| 1353 | 1353 | )); |
| 1354 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_data',array( |
|
| 1354 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_data', array( |
|
| 1355 | 1355 | 'type' => 'int', |
| 1356 | 1356 | 'precision' => '2', |
| 1357 | 1357 | 'default' => '1' |
@@ -1365,13 +1365,13 @@ discard block |
||
| 1365 | 1365 | |
| 1366 | 1366 | function calendar_upgrade1_0_1_004() |
| 1367 | 1367 | { |
| 1368 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
| 1368 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
| 1369 | 1369 | 'type' => 'int', |
| 1370 | 1370 | 'precision' => '4', |
| 1371 | 1371 | 'nullable' => False, |
| 1372 | 1372 | 'default' => '0' |
| 1373 | 1373 | )); |
| 1374 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1374 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1375 | 1375 | 'type' => 'int', |
| 1376 | 1376 | 'precision' => '4', |
| 1377 | 1377 | 'nullable' => False, |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | |
| 1387 | 1387 | function calendar_upgrade1_0_1_005() |
| 1388 | 1388 | { |
| 1389 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_quantity',array( |
|
| 1389 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_quantity', array( |
|
| 1390 | 1390 | 'type' => 'int', |
| 1391 | 1391 | 'precision' => '4', |
| 1392 | 1392 | 'default' => '1' |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | |
| 1401 | 1401 | function calendar_upgrade1_0_1_006() |
| 1402 | 1402 | { |
| 1403 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_non_blocking',array( |
|
| 1403 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_non_blocking', array( |
|
| 1404 | 1404 | 'type' => 'int', |
| 1405 | 1405 | 'precision' => '2', |
| 1406 | 1406 | 'default' => '0' |
@@ -1414,9 +1414,9 @@ discard block |
||
| 1414 | 1414 | |
| 1415 | 1415 | function calendar_upgrade1_0_1_007() |
| 1416 | 1416 | { |
| 1417 | - $GLOBALS['egw_setup']->db->update('egw_cal_repeats',array('recur_exception' => null),array('recur_exception' => ''),__LINE__,__FILE__,'calendar'); |
|
| 1417 | + $GLOBALS['egw_setup']->db->update('egw_cal_repeats', array('recur_exception' => null), array('recur_exception' => ''), __LINE__, __FILE__, 'calendar'); |
|
| 1418 | 1418 | |
| 1419 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats','recur_exception',array( |
|
| 1419 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_repeats', 'recur_exception', array( |
|
| 1420 | 1420 | 'type' => 'text' |
| 1421 | 1421 | )); |
| 1422 | 1422 | |
@@ -1433,11 +1433,11 @@ discard block |
||
| 1433 | 1433 | { |
| 1434 | 1434 | $customfields = array(); |
| 1435 | 1435 | $order = 0; |
| 1436 | - foreach($config_data['fields'] as $name => $data) |
|
| 1436 | + foreach ($config_data['fields'] as $name => $data) |
|
| 1437 | 1437 | { |
| 1438 | 1438 | if ($name{0} == '#' && !$data['disabled']) // real not-disabled custom field |
| 1439 | 1439 | { |
| 1440 | - $customfields[substr($name,1)] = array( |
|
| 1440 | + $customfields[substr($name, 1)] = array( |
|
| 1441 | 1441 | 'type' => 'text', |
| 1442 | 1442 | 'len' => $data['length'].($data['shown'] ? ','.$data['shown'] : ''), |
| 1443 | 1443 | 'label' => $data['name'], |
@@ -1460,38 +1460,38 @@ discard block |
||
| 1460 | 1460 | function calendar_upgrade1_0_1_009() |
| 1461 | 1461 | { |
| 1462 | 1462 | $db2 = clone($GLOBALS['egw_setup']->db); |
| 1463 | - $GLOBALS['egw_setup']->db->select('egw_cal','DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date',"cal_groups != ''",__LINE__,__FILE__, |
|
| 1464 | - False,'','calendar',0,',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
| 1465 | - while(($row = $GLOBALS['egw_setup']->db->row(true))) |
|
| 1463 | + $GLOBALS['egw_setup']->db->select('egw_cal', 'DISTINCT egw_cal.cal_id,cal_groups,cal_recur_date', "cal_groups != ''", __LINE__, __FILE__, |
|
| 1464 | + False, '', 'calendar', 0, ',egw_cal_user WHERE egw_cal.cal_id=egw_cal_user.cal_id'); |
|
| 1465 | + while (($row = $GLOBALS['egw_setup']->db->row(true))) |
|
| 1466 | 1466 | { |
| 1467 | 1467 | $row['cal_user_type'] = 'u'; |
| 1468 | - foreach(explode(',',$row['cal_groups']) as $group) |
|
| 1468 | + foreach (explode(',', $row['cal_groups']) as $group) |
|
| 1469 | 1469 | { |
| 1470 | 1470 | $row['cal_user_id'] = $group; |
| 1471 | - $db2->insert('egw_cal_user',array('cal_status' => 'U'),$row,__LINE__,__FILE__,'calendar'); |
|
| 1471 | + $db2->insert('egw_cal_user', array('cal_status' => 'U'), $row, __LINE__, __FILE__, 'calendar'); |
|
| 1472 | 1472 | } |
| 1473 | 1473 | } |
| 1474 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1474 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1475 | 1475 | 'fd' => array( |
| 1476 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1477 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1478 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1479 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1480 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1481 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1482 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1483 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1476 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1477 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1478 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1479 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1480 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1481 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1482 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1483 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1484 | 1484 | 'cal_description' => array('type' => 'text'), |
| 1485 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1486 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1487 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1488 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0') |
|
| 1485 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1486 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1487 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1488 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0') |
|
| 1489 | 1489 | ), |
| 1490 | 1490 | 'pk' => array('cal_id'), |
| 1491 | 1491 | 'fk' => array(), |
| 1492 | 1492 | 'ix' => array(), |
| 1493 | 1493 | 'uc' => array() |
| 1494 | - ),'cal_groups'); |
|
| 1494 | + ), 'cal_groups'); |
|
| 1495 | 1495 | |
| 1496 | 1496 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2'; |
| 1497 | 1497 | } |
@@ -1501,7 +1501,7 @@ discard block |
||
| 1501 | 1501 | function calendar_upgrade1_2() |
| 1502 | 1502 | { |
| 1503 | 1503 | // get old alarms (saved before 1.2) working again |
| 1504 | - $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 | + $GLOBALS['egw_setup']->db->query("UPDATE egw_async SET async_method ='calendar.bocalupdate.send_alarm' WHERE async_method ='calendar.bocalendar.send_alarm'", __LINE__, __FILE__); |
|
| 1505 | 1505 | |
| 1506 | 1506 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.2.001'; |
| 1507 | 1507 | } |
@@ -1509,7 +1509,7 @@ discard block |
||
| 1509 | 1509 | |
| 1510 | 1510 | function calendar_upgrade1_2_001() |
| 1511 | 1511 | { |
| 1512 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_special',array( |
|
| 1512 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_special', array( |
|
| 1513 | 1513 | 'type' => 'int', |
| 1514 | 1514 | 'precision' => '2', |
| 1515 | 1515 | 'default' => '0' |
@@ -1527,7 +1527,7 @@ discard block |
||
| 1527 | 1527 | |
| 1528 | 1528 | function calendar_upgrade1_4() |
| 1529 | 1529 | { |
| 1530 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_etag',array( |
|
| 1530 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_etag', array( |
|
| 1531 | 1531 | 'type' => 'int', |
| 1532 | 1532 | 'precision' => '4', |
| 1533 | 1533 | 'default' => '0' |
@@ -1539,59 +1539,59 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | function calendar_upgrade1_5() |
| 1541 | 1541 | { |
| 1542 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1542 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1543 | 1543 | 'fd' => array( |
| 1544 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1545 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1546 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1547 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1548 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1549 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1550 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1551 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1544 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1545 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1546 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1547 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1548 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1549 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1550 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1551 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1552 | 1552 | 'cal_description' => array('type' => 'text'), |
| 1553 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1554 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1555 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1556 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1557 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1558 | - 'cal_etag' => array('type' => 'int','precision' => '4'), |
|
| 1559 | - 'cal_edit_time' => array('type' => 'int','precision' => '8') |
|
| 1553 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1554 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1555 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1556 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1557 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1558 | + 'cal_etag' => array('type' => 'int', 'precision' => '4'), |
|
| 1559 | + 'cal_edit_time' => array('type' => 'int', 'precision' => '8') |
|
| 1560 | 1560 | ), |
| 1561 | 1561 | 'pk' => array('cal_id'), |
| 1562 | 1562 | 'fk' => array(), |
| 1563 | 1563 | 'ix' => array(), |
| 1564 | 1564 | 'uc' => array() |
| 1565 | - ),'cal_edit_user'); |
|
| 1566 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal',array( |
|
| 1565 | + ), 'cal_edit_user'); |
|
| 1566 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal', array( |
|
| 1567 | 1567 | 'fd' => array( |
| 1568 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 1569 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 1570 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 1571 | - 'cal_category' => array('type' => 'varchar','precision' => '30'), |
|
| 1572 | - 'cal_modified' => array('type' => 'int','precision' => '8'), |
|
| 1573 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 1574 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1'), |
|
| 1575 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 1568 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1569 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 1570 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 1571 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30'), |
|
| 1572 | + 'cal_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 1573 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 1574 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1'), |
|
| 1575 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 1576 | 1576 | 'cal_description' => array('type' => 'text'), |
| 1577 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 1578 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'), |
|
| 1579 | - 'cal_modifier' => array('type' => 'int','precision' => '4'), |
|
| 1580 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1581 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 1582 | - 'cal_etag' => array('type' => 'int','precision' => '4') |
|
| 1577 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 1578 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0'), |
|
| 1579 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 1580 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1581 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 1582 | + 'cal_etag' => array('type' => 'int', 'precision' => '4') |
|
| 1583 | 1583 | ), |
| 1584 | 1584 | 'pk' => array('cal_id'), |
| 1585 | 1585 | 'fk' => array(), |
| 1586 | 1586 | 'ix' => array(), |
| 1587 | 1587 | 'uc' => array() |
| 1588 | - ),'cal_edit_time'); |
|
| 1589 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_etag',array( |
|
| 1588 | + ), 'cal_edit_time'); |
|
| 1589 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_etag', array( |
|
| 1590 | 1590 | 'type' => 'int', |
| 1591 | 1591 | 'precision' => '4', |
| 1592 | 1592 | 'default' => '0' |
| 1593 | 1593 | )); |
| 1594 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL',__LINE__,__FILE__); |
|
| 1594 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_etag=0 WHERE cal_etag IS NULL', __LINE__, __FILE__); |
|
| 1595 | 1595 | |
| 1596 | 1596 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.5.001'; |
| 1597 | 1597 | } |
@@ -1599,12 +1599,12 @@ discard block |
||
| 1599 | 1599 | |
| 1600 | 1600 | function calendar_upgrade1_5_001() |
| 1601 | 1601 | { |
| 1602 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_id',array( |
|
| 1602 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_id', array( |
|
| 1603 | 1603 | 'type' => 'int', |
| 1604 | 1604 | 'precision' => '4', |
| 1605 | 1605 | 'nullable' => False |
| 1606 | 1606 | )); |
| 1607 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1607 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1608 | 1608 | 'type' => 'varchar', |
| 1609 | 1609 | 'precision' => '128', |
| 1610 | 1610 | 'nullable' => False |
@@ -1618,12 +1618,12 @@ discard block |
||
| 1618 | 1618 | { |
| 1619 | 1619 | // update the alarm methods |
| 1620 | 1620 | $async = new Api\Asyncservice(); |
| 1621 | - foreach((array)$async->read('cal:%') as $job) |
|
| 1621 | + foreach ((array)$async->read('cal:%') as $job) |
|
| 1622 | 1622 | { |
| 1623 | 1623 | if ($job['method'] == 'calendar.bocalupdate.send_alarm') |
| 1624 | 1624 | { |
| 1625 | 1625 | $job['method'] = 'calendar.calendar_boupdate.send_alarm'; |
| 1626 | - $async->write($job,true); |
|
| 1626 | + $async->write($job, true); |
|
| 1627 | 1627 | } |
| 1628 | 1628 | } |
| 1629 | 1629 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.6'; |
@@ -1640,48 +1640,48 @@ discard block |
||
| 1640 | 1640 | { |
| 1641 | 1641 | // Set UID of series exception to UID of series master |
| 1642 | 1642 | // update cal_etag, cal_modified and cal_modifier to distribute changes on GroupDAV devices |
| 1643 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1643 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1644 | 1644 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
| 1645 | 1645 | FROM egw_cal cal_ex |
| 1646 | 1646 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
| 1647 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1647 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1648 | 1648 | { |
| 1649 | 1649 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
| 1650 | 1650 | { |
| 1651 | 1651 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
| 1652 | 1652 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
| 1653 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1653 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1654 | 1654 | } |
| 1655 | 1655 | } |
| 1656 | 1656 | |
| 1657 | 1657 | // Search series exception for nearest exception in series master and add that RECURRENCE-ID |
| 1658 | 1658 | // as cal_reference (for 1.6.003 and move it to new field cal_recurrence in 1.7.001) |
| 1659 | 1659 | $diff = null; |
| 1660 | - foreach($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
| 1660 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT egw_cal.cal_id,cal_start,recur_exception FROM egw_cal |
|
| 1661 | 1661 | JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id |
| 1662 | 1662 | JOIN egw_cal_repeats ON cal_reference=egw_cal_repeats.cal_id |
| 1663 | - WHERE cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1663 | + WHERE cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1664 | 1664 | { |
| 1665 | 1665 | $recurrence = null; |
| 1666 | - foreach(explode(',',$row['recur_exception']) as $ts) |
|
| 1666 | + foreach (explode(',', $row['recur_exception']) as $ts) |
|
| 1667 | 1667 | { |
| 1668 | - if (is_null($recurrence) || abs($ts-$row['cal_start']) < $diff) |
|
| 1668 | + if (is_null($recurrence) || abs($ts - $row['cal_start']) < $diff) |
|
| 1669 | 1669 | { |
| 1670 | 1670 | $recurrence = $ts; |
| 1671 | - $diff = abs($ts-$row['cal_start']); |
|
| 1671 | + $diff = abs($ts - $row['cal_start']); |
|
| 1672 | 1672 | } |
| 1673 | 1673 | } |
| 1674 | 1674 | if ($recurrence) |
| 1675 | 1675 | { |
| 1676 | 1676 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$recurrence. |
| 1677 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1677 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1678 | 1678 | } |
| 1679 | 1679 | else |
| 1680 | 1680 | { |
| 1681 | 1681 | // if we cannot determine the RECURRENCE-ID use cal_start |
| 1682 | 1682 | // because RECURRENCE-ID must be present |
| 1683 | 1683 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_reference='.(int)$row['cal_start']. |
| 1684 | - ' WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1684 | + ' WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1685 | 1685 | } |
| 1686 | 1686 | } |
| 1687 | 1687 | |
@@ -1696,33 +1696,33 @@ discard block |
||
| 1696 | 1696 | */ |
| 1697 | 1697 | function calendar_upgrade1_6_003() |
| 1698 | 1698 | { |
| 1699 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_creator',array( |
|
| 1699 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_creator', array( |
|
| 1700 | 1700 | 'type' => 'int', |
| 1701 | 1701 | 'precision' => '4', |
| 1702 | 1702 | 'comment' => 'creating user' |
| 1703 | 1703 | )); |
| 1704 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner',__LINE__,__FILE__); |
|
| 1705 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_creator',array( |
|
| 1704 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_creator=cal_owner', __LINE__, __FILE__); |
|
| 1705 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_creator', array( |
|
| 1706 | 1706 | 'type' => 'int', |
| 1707 | 1707 | 'precision' => '4', |
| 1708 | 1708 | 'nullable' => False, |
| 1709 | 1709 | 'comment' => 'creating user' |
| 1710 | 1710 | )); |
| 1711 | 1711 | |
| 1712 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_created',array( |
|
| 1712 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_created', array( |
|
| 1713 | 1713 | 'type' => 'int', |
| 1714 | 1714 | 'precision' => '8', |
| 1715 | 1715 | 'comment' => 'creation time of event' |
| 1716 | 1716 | )); |
| 1717 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified',__LINE__,__FILE__); |
|
| 1718 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_created',array( |
|
| 1717 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_created=cal_modified', __LINE__, __FILE__); |
|
| 1718 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_created', array( |
|
| 1719 | 1719 | 'type' => 'int', |
| 1720 | 1720 | 'precision' => '8', |
| 1721 | 1721 | 'nullable' => False, |
| 1722 | 1722 | 'comment' => 'creation time of event' |
| 1723 | 1723 | )); |
| 1724 | 1724 | |
| 1725 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_recurrence',array( |
|
| 1725 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_recurrence', array( |
|
| 1726 | 1726 | 'type' => 'int', |
| 1727 | 1727 | 'precision' => '8', |
| 1728 | 1728 | 'nullable' => False, |
@@ -1733,14 +1733,14 @@ discard block |
||
| 1733 | 1733 | // move RECURRENCE-ID from temporarily (1.6.003) |
| 1734 | 1734 | // used field cal_reference to new field cal_recurrence |
| 1735 | 1735 | // and restore cal_reference field of series exceptions with id of the series master |
| 1736 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1736 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1737 | 1737 | SELECT cal_ex.cal_id AS cal_id_ex,cal_master.cal_id AS cal_id_master, |
| 1738 | 1738 | cal_ex.cal_reference AS cal_reference_ex,cal_ex.cal_uid AS cal_uid_ex, |
| 1739 | 1739 | cal_master.cal_uid AS cal_uid_master |
| 1740 | 1740 | FROM egw_cal cal_ex |
| 1741 | 1741 | JOIN egw_cal cal_master |
| 1742 | 1742 | ON cal_ex.cal_uid=cal_master.cal_uid AND cal_master.cal_reference = 0 AND cal_ex.cal_owner = cal_master.cal_owner |
| 1743 | - WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__,__FILE__) as $row) |
|
| 1743 | + WHERE cal_ex.cal_reference !=0 AND cal_master.cal_id IS NOT NULL',__LINE__, __FILE__) as $row) |
|
| 1744 | 1744 | { |
| 1745 | 1745 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_recurrence='.(int)$row['cal_reference_ex']. |
| 1746 | 1746 | ', cal_reference='.(int)$row['cal_id_master']. |
@@ -1757,7 +1757,7 @@ discard block |
||
| 1757 | 1757 | */ |
| 1758 | 1758 | function calendar_upgrade1_7_001() |
| 1759 | 1759 | { |
| 1760 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_role',array( |
|
| 1760 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_role', array( |
|
| 1761 | 1761 | 'type' => 'varchar', |
| 1762 | 1762 | 'precision' => '64', |
| 1763 | 1763 | 'default' => 'REQ-PARTICIPANT' |
@@ -1773,14 +1773,14 @@ discard block |
||
| 1773 | 1773 | */ |
| 1774 | 1774 | function calendar_upgrade1_7_002() |
| 1775 | 1775 | { |
| 1776 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones',array( |
|
| 1776 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_cal_timezones', array( |
|
| 1777 | 1777 | 'fd' => array( |
| 1778 | - 'tz_id' => array('type' => 'auto','nullable' => False), |
|
| 1779 | - 'tz_tzid' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
| 1780 | - 'tz_alias' => array('type' => 'int','precision' => '4','comment' => 'tz_id for data'), |
|
| 1781 | - 'tz_latitude' => array('type' => 'int','precision' => '4'), |
|
| 1782 | - 'tz_longitude' => array('type' => 'int','precision' => '4'), |
|
| 1783 | - 'tz_component' => array('type' => 'text','comment' => 'iCal VTIMEZONE component') |
|
| 1778 | + 'tz_id' => array('type' => 'auto', 'nullable' => False), |
|
| 1779 | + 'tz_tzid' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
| 1780 | + 'tz_alias' => array('type' => 'int', 'precision' => '4', 'comment' => 'tz_id for data'), |
|
| 1781 | + 'tz_latitude' => array('type' => 'int', 'precision' => '4'), |
|
| 1782 | + 'tz_longitude' => array('type' => 'int', 'precision' => '4'), |
|
| 1783 | + 'tz_component' => array('type' => 'text', 'comment' => 'iCal VTIMEZONE component') |
|
| 1784 | 1784 | ), |
| 1785 | 1785 | 'pk' => array('tz_id'), |
| 1786 | 1786 | 'fk' => array(), |
@@ -1800,38 +1800,38 @@ discard block |
||
| 1800 | 1800 | */ |
| 1801 | 1801 | function calendar_upgrade1_7_003() |
| 1802 | 1802 | { |
| 1803 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_type',array( |
|
| 1803 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_type', array( |
|
| 1804 | 1804 | 'type' => 'varchar', |
| 1805 | 1805 | 'precision' => '1', |
| 1806 | 1806 | 'nullable' => False, |
| 1807 | 1807 | 'default' => 'u', |
| 1808 | 1808 | 'comment' => 'u=user, g=group, c=contact, r=resource, e=email' |
| 1809 | 1809 | )); |
| 1810 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 1810 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 1811 | 1811 | 'type' => 'varchar', |
| 1812 | 1812 | 'precision' => '128', |
| 1813 | 1813 | 'nullable' => False, |
| 1814 | 1814 | 'comment' => 'id or email-address for type=e' |
| 1815 | 1815 | )); |
| 1816 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_status',array( |
|
| 1816 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_status', array( |
|
| 1817 | 1817 | 'type' => 'char', |
| 1818 | 1818 | 'precision' => '1', |
| 1819 | 1819 | 'default' => 'A', |
| 1820 | 1820 | 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative' |
| 1821 | 1821 | )); |
| 1822 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_quantity',array( |
|
| 1822 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_quantity', array( |
|
| 1823 | 1823 | 'type' => 'int', |
| 1824 | 1824 | 'precision' => '4', |
| 1825 | 1825 | 'default' => '1', |
| 1826 | 1826 | 'comment' => 'only for certain types (eg. resources)' |
| 1827 | 1827 | )); |
| 1828 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_role',array( |
|
| 1828 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_role', array( |
|
| 1829 | 1829 | 'type' => 'varchar', |
| 1830 | 1830 | 'precision' => '64', |
| 1831 | 1831 | 'default' => 'REQ-PARTICIPANT', |
| 1832 | 1832 | 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id' |
| 1833 | 1833 | )); |
| 1834 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_modified',array( |
|
| 1834 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_modified', array( |
|
| 1835 | 1835 | 'type' => 'timestamp', |
| 1836 | 1836 | 'default' => 'current_timestamp', |
| 1837 | 1837 | 'comment' => 'automatic timestamp of last update' |
@@ -1847,19 +1847,19 @@ discard block |
||
| 1847 | 1847 | */ |
| 1848 | 1848 | function calendar_upgrade1_7_004() |
| 1849 | 1849 | { |
| 1850 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_start',array( |
|
| 1850 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_start', array( |
|
| 1851 | 1851 | 'type' => 'int', |
| 1852 | 1852 | 'precision' => '8', |
| 1853 | 1853 | 'nullable' => False, |
| 1854 | 1854 | 'comment' => 'starttime in server time' |
| 1855 | 1855 | )); |
| 1856 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates','cal_end',array( |
|
| 1856 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_dates', 'cal_end', array( |
|
| 1857 | 1857 | 'type' => 'int', |
| 1858 | 1858 | 'precision' => '8', |
| 1859 | 1859 | 'nullable' => False, |
| 1860 | 1860 | 'comment' => 'endtime in server time' |
| 1861 | 1861 | )); |
| 1862 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','tz_id',array( |
|
| 1862 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'tz_id', array( |
|
| 1863 | 1863 | 'type' => 'int', |
| 1864 | 1864 | 'precision' => '4', |
| 1865 | 1865 | 'comment' => 'key into egw_cal_timezones' |
@@ -1868,7 +1868,7 @@ discard block |
||
| 1868 | 1868 | // set id of server timezone for existing events, as that's the timezone their recurrences are using |
| 1869 | 1869 | if (($tzid = date_default_timezone_get()) && ($tz_id = calendar_timezones::tz2id($tzid))) |
| 1870 | 1870 | { |
| 1871 | - $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id,__LINE__,__FILE__); |
|
| 1871 | + $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET tz_id='.(int)$tz_id, __LINE__, __FILE__); |
|
| 1872 | 1872 | } |
| 1873 | 1873 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.005'; |
| 1874 | 1874 | } |
@@ -1895,22 +1895,22 @@ discard block |
||
| 1895 | 1895 | */ |
| 1896 | 1896 | function calendar_upgrade1_7_006() |
| 1897 | 1897 | { |
| 1898 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1899 | - WHERE (cal_end-cal_start)%86400=86340',__LINE__,__FILE__) as $row) |
|
| 1898 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1899 | + WHERE (cal_end-cal_start)%86400=86340',__LINE__, __FILE__) as $row) |
|
| 1900 | 1900 | { |
| 1901 | 1901 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end+59 |
| 1902 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
| 1902 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | - foreach($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1906 | - WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__,__FILE__) as $row) |
|
| 1905 | + foreach ($GLOBALS['egw_setup']->db->query('SELECT * FROM egw_cal_dates |
|
| 1906 | + WHERE cal_end-cal_start>0 AND (cal_end-cal_start)%86400=0',__LINE__, __FILE__) as $row) |
|
| 1907 | 1907 | { |
| 1908 | 1908 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_dates SET cal_end=cal_end-1 |
| 1909 | - WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'],__LINE__,__FILE__); |
|
| 1909 | + WHERE cal_id='.(int)$row['cal_id'].' AND cal_start='.(int)$row['cal_start'], __LINE__, __FILE__); |
|
| 1910 | 1910 | } |
| 1911 | 1911 | |
| 1912 | 1912 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal_repeats SET recur_interval=1 |
| 1913 | - WHERE recur_interval=0',__LINE__,__FILE__); |
|
| 1913 | + WHERE recur_interval=0',__LINE__, __FILE__); |
|
| 1914 | 1914 | |
| 1915 | 1915 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.007'; |
| 1916 | 1916 | } |
@@ -1926,17 +1926,17 @@ discard block |
||
| 1926 | 1926 | { |
| 1927 | 1927 | // Set UID of series exception to UID of series master |
| 1928 | 1928 | // update cal_etag,cal_modified and cal_modifier to distribute changes on GroupDAV devices |
| 1929 | - foreach($GLOBALS['egw_setup']->db->query(' |
|
| 1929 | + foreach ($GLOBALS['egw_setup']->db->query(' |
|
| 1930 | 1930 | SELECT cal_ex.cal_id,cal_ex.cal_uid AS cal_uid_ex,cal_master.cal_uid AS cal_uid_master |
| 1931 | 1931 | FROM egw_cal cal_ex |
| 1932 | 1932 | JOIN egw_cal cal_master ON cal_ex.cal_reference=cal_master.cal_id |
| 1933 | - WHERE cal_ex.cal_reference != 0',__LINE__,__FILE__) as $row) |
|
| 1933 | + WHERE cal_ex.cal_reference != 0',__LINE__, __FILE__) as $row) |
|
| 1934 | 1934 | { |
| 1935 | 1935 | if (strlen($row['cal_uid_master']) > 0 && $row['cal_uid_ex'] != $row['cal_uid_master']) |
| 1936 | 1936 | { |
| 1937 | 1937 | $GLOBALS['egw_setup']->db->query('UPDATE egw_cal SET cal_uid=\''.$row['cal_uid_master']. |
| 1938 | 1938 | '\',cal_etag=cal_etag+1,cal_modified='.time(). |
| 1939 | - ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'],__LINE__,__FILE__); |
|
| 1939 | + ',cal_modifier=NULL WHERE cal_id='.(int)$row['cal_id'], __LINE__, __FILE__); |
|
| 1940 | 1940 | } |
| 1941 | 1941 | } |
| 1942 | 1942 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.008'; |
@@ -1949,7 +1949,7 @@ discard block |
||
| 1949 | 1949 | */ |
| 1950 | 1950 | function calendar_upgrade1_7_008() |
| 1951 | 1951 | { |
| 1952 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user',array('cal_user_type','cal_user_id')); |
|
| 1952 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', array('cal_user_type', 'cal_user_id')); |
|
| 1953 | 1953 | |
| 1954 | 1954 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.009'; |
| 1955 | 1955 | } |
@@ -1961,22 +1961,22 @@ discard block |
||
| 1961 | 1961 | */ |
| 1962 | 1962 | function calendar_upgrade1_7_009() |
| 1963 | 1963 | { |
| 1964 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_uid'); |
|
| 1965 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_owner'); |
|
| 1964 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_uid'); |
|
| 1965 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_owner'); |
|
| 1966 | 1966 | |
| 1967 | 1967 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.7.010'; |
| 1968 | 1968 | } |
| 1969 | 1969 | |
| 1970 | 1970 | function calendar_upgrade1_7_010() |
| 1971 | 1971 | { |
| 1972 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','cal_deleted',array( |
|
| 1972 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'cal_deleted', array( |
|
| 1973 | 1973 | 'type' => 'bool', |
| 1974 | 1974 | 'nullable' => False, |
| 1975 | 1975 | 'default' => '0', |
| 1976 | 1976 | 'comment' => '1 if the event has been deleted, but you want to keep it around' |
| 1977 | 1977 | )); |
| 1978 | 1978 | |
| 1979 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
| 1979 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.001'; // was 1.7.011 |
|
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | 1982 | function calendar_upgrade1_7_011() |
@@ -2006,36 +2006,36 @@ discard block |
||
| 2006 | 2006 | 'precision' => '8', |
| 2007 | 2007 | 'comment' => 'ts when event was deleted' |
| 2008 | 2008 | ));*/ |
| 2009 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal',array( |
|
| 2009 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal', array( |
|
| 2010 | 2010 | 'fd' => array( |
| 2011 | - 'cal_id' => array('type' => 'auto','nullable' => False), |
|
| 2012 | - 'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'), |
|
| 2013 | - 'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'), |
|
| 2014 | - 'cal_category' => array('type' => 'varchar','precision' => '30','comment' => 'category id'), |
|
| 2015 | - 'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'), |
|
| 2016 | - 'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2'), |
|
| 2017 | - 'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'), |
|
| 2018 | - 'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '1'), |
|
| 2011 | + 'cal_id' => array('type' => 'auto', 'nullable' => False), |
|
| 2012 | + 'cal_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'comment' => 'unique id of event(-series)'), |
|
| 2013 | + 'cal_owner' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'event owner / calendar'), |
|
| 2014 | + 'cal_category' => array('type' => 'varchar', 'precision' => '30', 'comment' => 'category id'), |
|
| 2015 | + 'cal_modified' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts of last modification'), |
|
| 2016 | + 'cal_priority' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '2'), |
|
| 2017 | + 'cal_public' => array('type' => 'int', 'precision' => '2', 'nullable' => False, 'default' => '1', 'comment' => '1=public, 0=private event'), |
|
| 2018 | + 'cal_title' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False, 'default' => '1'), |
|
| 2019 | 2019 | 'cal_description' => array('type' => 'text'), |
| 2020 | - 'cal_location' => array('type' => 'varchar','precision' => '255'), |
|
| 2021 | - 'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'), |
|
| 2022 | - 'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'), |
|
| 2023 | - 'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'), |
|
| 2024 | - 'cal_special' => array('type' => 'int','precision' => '2','default' => '0'), |
|
| 2025 | - 'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'), |
|
| 2026 | - 'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'), |
|
| 2027 | - 'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'), |
|
| 2028 | - 'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'), |
|
| 2029 | - 'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'), |
|
| 2030 | - 'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted') |
|
| 2020 | + 'cal_location' => array('type' => 'varchar', 'precision' => '255'), |
|
| 2021 | + 'cal_reference' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'default' => '0', 'comment' => 'cal_id of series for exception'), |
|
| 2022 | + 'cal_modifier' => array('type' => 'int', 'precision' => '4', 'comment' => 'user who last modified event'), |
|
| 2023 | + 'cal_non_blocking' => array('type' => 'int', 'precision' => '2', 'default' => '0', 'comment' => '1 for non-blocking events'), |
|
| 2024 | + 'cal_special' => array('type' => 'int', 'precision' => '2', 'default' => '0'), |
|
| 2025 | + 'cal_etag' => array('type' => 'int', 'precision' => '4', 'default' => '0', 'comment' => 'etag for optimistic locking'), |
|
| 2026 | + 'cal_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False, 'comment' => 'creating user'), |
|
| 2027 | + 'cal_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'comment' => 'creation time of event'), |
|
| 2028 | + 'cal_recurrence' => array('type' => 'int', 'precision' => '8', 'nullable' => False, 'default' => '0', 'comment' => 'cal_start of original recurrence for exception'), |
|
| 2029 | + 'tz_id' => array('type' => 'int', 'precision' => '4', 'comment' => 'key into egw_cal_timezones'), |
|
| 2030 | + 'cal_deleted' => array('type' => 'int', 'precision' => '8', 'comment' => 'ts when event was deleted') |
|
| 2031 | 2031 | ), |
| 2032 | 2032 | 'pk' => array('cal_id'), |
| 2033 | 2033 | 'fk' => array(), |
| 2034 | - 'ix' => array('cal_uid','cal_owner','cal_deleted'), |
|
| 2034 | + 'ix' => array('cal_uid', 'cal_owner', 'cal_deleted'), |
|
| 2035 | 2035 | 'uc' => array() |
| 2036 | - ),array( |
|
| 2036 | + ), array( |
|
| 2037 | 2037 | // for deleted rows use cal_modified as deleted date, NULL for not deleted ones |
| 2038 | - 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true,'bool').' THEN cal_modified ELSE NULL END', |
|
| 2038 | + 'cal_deleted' => 'CASE cal_deleted WHEN '.$GLOBALS['egw_setup']->db->quote(true, 'bool').' THEN cal_modified ELSE NULL END', |
|
| 2039 | 2039 | )); |
| 2040 | 2040 | |
| 2041 | 2041 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.002'; |
@@ -2047,16 +2047,16 @@ discard block |
||
| 2047 | 2047 | */ |
| 2048 | 2048 | function calendar_upgrade1_9_002() |
| 2049 | 2049 | { |
| 2050 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','caldav_name',array( |
|
| 2050 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'caldav_name', array( |
|
| 2051 | 2051 | 'type' => 'varchar', |
| 2052 | 2052 | 'precision' => '64', |
| 2053 | 2053 | 'comment' => 'name part of CalDAV URL, if specified by client' |
| 2054 | 2054 | )); |
| 2055 | - $GLOBALS['egw_setup']->db->query($sql='UPDATE egw_cal SET caldav_name='. |
|
| 2055 | + $GLOBALS['egw_setup']->db->query($sql = 'UPDATE egw_cal SET caldav_name='. |
|
| 2056 | 2056 | $GLOBALS['egw_setup']->db->concat( |
| 2057 | - $GLOBALS['egw_setup']->db->to_varchar('cal_id'),"'.ics'"),__LINE__,__FILE__); |
|
| 2057 | + $GLOBALS['egw_setup']->db->to_varchar('cal_id'), "'.ics'"), __LINE__, __FILE__); |
|
| 2058 | 2058 | |
| 2059 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','caldav_name'); |
|
| 2059 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'caldav_name'); |
|
| 2060 | 2060 | |
| 2061 | 2061 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.003'; |
| 2062 | 2062 | } |
@@ -2067,8 +2067,8 @@ discard block |
||
| 2067 | 2067 | */ |
| 2068 | 2068 | function calendar_upgrade1_9_003() |
| 2069 | 2069 | { |
| 2070 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal','cal_modified'); |
|
| 2071 | - $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user','cal_user_modified'); |
|
| 2070 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal', 'cal_modified'); |
|
| 2071 | + $GLOBALS['egw_setup']->oProc->CreateIndex('egw_cal_user', 'cal_user_modified'); |
|
| 2072 | 2072 | |
| 2073 | 2073 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.004'; |
| 2074 | 2074 | } |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | */ |
| 2081 | 2081 | function calendar_upgrade1_9_004() |
| 2082 | 2082 | { |
| 2083 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates','recur_exception',array( |
|
| 2083 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_dates', 'recur_exception', array( |
|
| 2084 | 2084 | 'type' => 'bool', |
| 2085 | 2085 | 'default' => '', |
| 2086 | 2086 | 'null' => false, |
@@ -2088,16 +2088,16 @@ discard block |
||
| 2088 | 2088 | )); |
| 2089 | 2089 | |
| 2090 | 2090 | // migrate existing exceptions to egw_cal_dates |
| 2091 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
| 2091 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_repeats', |
|
| 2092 | 2092 | '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', |
| 2093 | 2093 | 'egw_cal_repeats.recur_exception IS NOT NULL', __LINE__, __FILE__, false, |
| 2094 | 2094 | 'GROUP BY egw_cal_repeats.cal_id,egw_cal_repeats.recur_exception', 'calendar', '', |
| 2095 | 2095 | 'JOIN egw_cal_dates ON egw_cal_repeats.cal_id=egw_cal_dates.cal_id') as $row) |
| 2096 | 2096 | { |
| 2097 | - foreach($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
| 2097 | + foreach ($row['recur_exception'] ? array_unique(explode(',', $row['recur_exception'])) : array() as $recur_exception) |
|
| 2098 | 2098 | { |
| 2099 | 2099 | $GLOBALS['egw_setup']->db->insert('egw_cal_dates', array( |
| 2100 | - 'cal_end' => $recur_exception+$row['cal_end']-$row['cal_start'], |
|
| 2100 | + 'cal_end' => $recur_exception + $row['cal_end'] - $row['cal_start'], |
|
| 2101 | 2101 | 'recur_exception' => true, |
| 2102 | 2102 | ), array( |
| 2103 | 2103 | 'cal_id' => $row['cal_id'], |
@@ -2109,11 +2109,11 @@ discard block |
||
| 2109 | 2109 | |
| 2110 | 2110 | $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
| 2111 | 2111 | 'fd' => array( |
| 2112 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2113 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
| 2114 | - 'recur_enddate' => array('type' => 'int','precision' => '8'), |
|
| 2115 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2116 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2112 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2113 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
| 2114 | + 'recur_enddate' => array('type' => 'int', 'precision' => '8'), |
|
| 2115 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2116 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2117 | 2117 | ), |
| 2118 | 2118 | 'pk' => array('cal_id'), |
| 2119 | 2119 | 'fk' => array(), |
@@ -2134,19 +2134,19 @@ discard block |
||
| 2134 | 2134 | // returns NULL, if there are no rows! |
| 2135 | 2135 | if ((int)$max_description_length <= 16384 && $GLOBALS['egw_setup']->oProc->max_varchar_length >= 16384) |
| 2136 | 2136 | { |
| 2137 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_description',array( |
|
| 2137 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_description', array( |
|
| 2138 | 2138 | 'type' => 'varchar', |
| 2139 | 2139 | 'precision' => '16384' |
| 2140 | 2140 | )); |
| 2141 | 2141 | } |
| 2142 | 2142 | // allow more categories |
| 2143 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
| 2143 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
| 2144 | 2144 | 'type' => 'varchar', |
| 2145 | 2145 | 'precision' => '64', |
| 2146 | 2146 | 'comment' => 'category id(s)' |
| 2147 | 2147 | )); |
| 2148 | 2148 | // remove silly default of 1 |
| 2149 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_title',array( |
|
| 2149 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_title', array( |
|
| 2150 | 2150 | 'type' => 'varchar', |
| 2151 | 2151 | 'precision' => '255', |
| 2152 | 2152 | 'nullable' => False |
@@ -2161,14 +2161,14 @@ discard block |
||
| 2161 | 2161 | { |
| 2162 | 2162 | // PostgreSQL needs temporary a nullable column, to not stall on broken events without dates! |
| 2163 | 2163 | // We add that constrain in 1.9.007, after deleting all rows with range_start=0 OR range_start IS NULL |
| 2164 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_start',array( |
|
| 2164 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_start', array( |
|
| 2165 | 2165 | 'type' => 'int', |
| 2166 | 2166 | 'precision' => '8', |
| 2167 | 2167 | 'comment' => 'startdate (of range)' |
| 2168 | 2168 | )); |
| 2169 | 2169 | $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__); |
| 2170 | 2170 | |
| 2171 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal','range_end',array( |
|
| 2171 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal', 'range_end', array( |
|
| 2172 | 2172 | 'type' => 'int', |
| 2173 | 2173 | 'precision' => '8', |
| 2174 | 2174 | 'comment' => 'enddate (of range, UNTIL of RRULE)' |
@@ -2184,18 +2184,18 @@ discard block |
||
| 2184 | 2184 | { |
| 2185 | 2185 | $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__); |
| 2186 | 2186 | } |
| 2187 | - $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats',array( |
|
| 2187 | + $GLOBALS['egw_setup']->oProc->DropColumn('egw_cal_repeats', array( |
|
| 2188 | 2188 | 'fd' => array( |
| 2189 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2190 | - 'recur_type' => array('type' => 'int','precision' => '2','nullable' => False), |
|
| 2191 | - 'recur_interval' => array('type' => 'int','precision' => '2','default' => '1'), |
|
| 2192 | - 'recur_data' => array('type' => 'int','precision' => '2','default' => '1') |
|
| 2189 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2190 | + 'recur_type' => array('type' => 'int', 'precision' => '2', 'nullable' => False), |
|
| 2191 | + 'recur_interval' => array('type' => 'int', 'precision' => '2', 'default' => '1'), |
|
| 2192 | + 'recur_data' => array('type' => 'int', 'precision' => '2', 'default' => '1') |
|
| 2193 | 2193 | ), |
| 2194 | 2194 | 'pk' => array('cal_id'), |
| 2195 | 2195 | 'fk' => array(), |
| 2196 | 2196 | 'ix' => array(), |
| 2197 | 2197 | 'uc' => array() |
| 2198 | - ),'recur_enddate'); |
|
| 2198 | + ), 'recur_enddate'); |
|
| 2199 | 2199 | |
| 2200 | 2200 | return $GLOBALS['setup_info']['calendar']['currentver'] = '1.9.007'; |
| 2201 | 2201 | } |
@@ -2207,14 +2207,14 @@ discard block |
||
| 2207 | 2207 | */ |
| 2208 | 2208 | function calendar_upgrade1_9_007() |
| 2209 | 2209 | { |
| 2210 | - foreach(array('egw_cal_repeats','egw_cal_dates','egw_cal_user','egw_cal_extra') as $table) |
|
| 2210 | + foreach (array('egw_cal_repeats', 'egw_cal_dates', 'egw_cal_user', 'egw_cal_extra') as $table) |
|
| 2211 | 2211 | { |
| 2212 | 2212 | $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__); |
| 2213 | 2213 | } |
| 2214 | 2214 | $GLOBALS['egw_setup']->db->query("DELETE FROM egw_cal WHERE range_start=0 OR range_start IS NULL", __LINE__, __FILE__); |
| 2215 | 2215 | |
| 2216 | 2216 | // now we can remove temporary default of 0 from range_start and set it NOT NULL |
| 2217 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','range_start',array( |
|
| 2217 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'range_start', array( |
|
| 2218 | 2218 | 'type' => 'int', |
| 2219 | 2219 | 'precision' => '8', |
| 2220 | 2220 | 'nullable' => False, |
@@ -2279,7 +2279,7 @@ discard block |
||
| 2279 | 2279 | |
| 2280 | 2280 | function calendar_upgrade1_9_010() |
| 2281 | 2281 | { |
| 2282 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
| 2282 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
| 2283 | 2283 | 'type' => 'varchar', |
| 2284 | 2284 | 'precision' => '200', |
| 2285 | 2285 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2309,7 +2309,7 @@ discard block |
||
| 2309 | 2309 | SET cal_reference=0,cal_recurrence=0,cal_etag=cal_etag+1,cal_modifier=0,cal_modified=".time()." |
| 2310 | 2310 | WHERE cal_reference != 0 AND cal_id IN (SELECT cal_id FROM egw_cal_repeats)", __LINE__, __FILE__); |
| 2311 | 2311 | |
| 2312 | - foreach($GLOBALS['egw_setup']->db->query( |
|
| 2312 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
| 2313 | 2313 | "SELECT DISTINCT master.cal_id,egw_cal_user.cal_user_type,egw_cal_user.cal_user_id,'E' AS cal_status |
| 2314 | 2314 | FROM egw_cal_user |
| 2315 | 2315 | JOIN egw_cal ON egw_cal_user.cal_id=egw_cal.cal_id |
@@ -2336,7 +2336,7 @@ discard block |
||
| 2336 | 2336 | */ |
| 2337 | 2337 | function calendar_upgrade14_1_001() |
| 2338 | 2338 | { |
| 2339 | - foreach($GLOBALS['egw_setup']->db->query( |
|
| 2339 | + foreach ($GLOBALS['egw_setup']->db->query( |
|
| 2340 | 2340 | "SELECT egw_cal.cal_id AS cal_id,cal_start,cal_end,range_start,range_end,egw_cal_repeats.*,tz_tzid AS tzid |
| 2341 | 2341 | FROM egw_cal |
| 2342 | 2342 | JOIN egw_cal_repeats ON egw_cal_repeats.cal_id=egw_cal.cal_id |
@@ -2364,7 +2364,7 @@ discard block |
||
| 2364 | 2364 | $enddate->modify(($event['end'] - $event['start']).' second'); |
| 2365 | 2365 | if (($range_end = $enddate->format('server')) != $event['range_end']) |
| 2366 | 2366 | { |
| 2367 | - $GLOBALS['egw_setup']->db->update('egw_cal',array( |
|
| 2367 | + $GLOBALS['egw_setup']->db->update('egw_cal', array( |
|
| 2368 | 2368 | 'range_end' => $range_end, |
| 2369 | 2369 | 'cal_etag=cal_etag+1', |
| 2370 | 2370 | 'cal_modified' => time(), |
@@ -2374,7 +2374,7 @@ discard block |
||
| 2374 | 2374 | //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)); |
| 2375 | 2375 | } |
| 2376 | 2376 | } |
| 2377 | - return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
| 2377 | + return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.002'; // skip 14.2.001 update, as query is fixed now |
|
| 2378 | 2378 | } |
| 2379 | 2379 | |
| 2380 | 2380 | /** |
@@ -2398,7 +2398,7 @@ discard block |
||
| 2398 | 2398 | // if maximum is bigger then 3 |
| 2399 | 2399 | if ($values[1] > 3) |
| 2400 | 2400 | { |
| 2401 | - switch($GLOBALS['egw_setup']->db->Type) |
|
| 2401 | + switch ($GLOBALS['egw_setup']->db->Type) |
|
| 2402 | 2402 | { |
| 2403 | 2403 | case 'mysql': |
| 2404 | 2404 | $sql = "UPDATE egw_cal |
@@ -2443,7 +2443,7 @@ discard block |
||
| 2443 | 2443 | |
| 2444 | 2444 | function calendar_upgrade14_2_003() |
| 2445 | 2445 | { |
| 2446 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_uid',array( |
|
| 2446 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_uid', array( |
|
| 2447 | 2447 | 'type' => 'ascii', |
| 2448 | 2448 | 'precision' => '128', |
| 2449 | 2449 | 'nullable' => False, |
@@ -2455,13 +2455,13 @@ discard block |
||
| 2455 | 2455 | { |
| 2456 | 2456 | $GLOBALS['egw_setup']->db->query("UPDATE egw_cal SET cal_category='' WHERE cal_category NOT REGEXP '^[0-9,]*$'", __LINE__, __FILE__); |
| 2457 | 2457 | } |
| 2458 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','cal_category',array( |
|
| 2458 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'cal_category', array( |
|
| 2459 | 2459 | 'type' => 'ascii', |
| 2460 | 2460 | 'meta' => 'category', |
| 2461 | 2461 | 'precision' => '64', |
| 2462 | 2462 | 'comment' => 'category id(s)' |
| 2463 | 2463 | )); |
| 2464 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal','caldav_name',array( |
|
| 2464 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal', 'caldav_name', array( |
|
| 2465 | 2465 | 'type' => 'ascii', |
| 2466 | 2466 | 'precision' => '128', |
| 2467 | 2467 | 'comment' => 'name part of CalDAV URL, if specified by client' |
@@ -2518,22 +2518,22 @@ discard block |
||
| 2518 | 2518 | 'type' => 'auto', |
| 2519 | 2519 | 'nullable' => False |
| 2520 | 2520 | ));*/ |
| 2521 | - $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user',array( |
|
| 2521 | + $GLOBALS['egw_setup']->oProc->RefreshTable('egw_cal_user', array( |
|
| 2522 | 2522 | 'fd' => array( |
| 2523 | - 'cal_id' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 2524 | - 'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0'), |
|
| 2525 | - 'cal_user_type' => array('type' => 'ascii','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
| 2526 | - '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'), |
|
| 2527 | - 'cal_status' => array('type' => 'ascii','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
| 2528 | - 'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'), |
|
| 2529 | - 'cal_role' => array('type' => 'ascii','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
| 2530 | - 'cal_user_modified' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'automatic timestamp of last update'), |
|
| 2531 | - 'cal_user_auto' => array('type' => 'auto','nullable' => False) |
|
| 2523 | + 'cal_id' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 2524 | + 'cal_recur_date' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False, 'default' => '0'), |
|
| 2525 | + 'cal_user_type' => array('type' => 'ascii', 'precision' => '1', 'nullable' => False, 'default' => 'u', 'comment' => 'u=user, g=group, c=contact, r=resource, e=email'), |
|
| 2526 | + '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'), |
|
| 2527 | + 'cal_status' => array('type' => 'ascii', 'precision' => '1', 'default' => 'A', 'comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'), |
|
| 2528 | + 'cal_quantity' => array('type' => 'int', 'precision' => '4', 'default' => '1', 'comment' => 'only for certain types (eg. resources)'), |
|
| 2529 | + 'cal_role' => array('type' => 'ascii', 'precision' => '64', 'default' => 'REQ-PARTICIPANT', 'comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'), |
|
| 2530 | + 'cal_user_modified' => array('type' => 'timestamp', 'default' => 'current_timestamp', 'comment' => 'automatic timestamp of last update'), |
|
| 2531 | + 'cal_user_auto' => array('type' => 'auto', 'nullable' => False) |
|
| 2532 | 2532 | ), |
| 2533 | 2533 | 'pk' => array('cal_user_auto'), |
| 2534 | 2534 | 'fk' => array(), |
| 2535 | - 'ix' => array('cal_user_modified',array('cal_user_type','cal_user_id')), |
|
| 2536 | - 'uc' => array(array('cal_id','cal_recur_date','cal_user_type','cal_user_id')) |
|
| 2535 | + 'ix' => array('cal_user_modified', array('cal_user_type', 'cal_user_id')), |
|
| 2536 | + 'uc' => array(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id')) |
|
| 2537 | 2537 | )); |
| 2538 | 2538 | |
| 2539 | 2539 | return $GLOBALS['setup_info']['calendar']['currentver'] = '14.2.005'; |
@@ -2542,12 +2542,12 @@ discard block |
||
| 2542 | 2542 | |
| 2543 | 2543 | function calendar_upgrade14_2_005() |
| 2544 | 2544 | { |
| 2545 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_tzid',array( |
|
| 2545 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_tzid', array( |
|
| 2546 | 2546 | 'type' => 'ascii', |
| 2547 | 2547 | 'precision' => '128', |
| 2548 | 2548 | 'nullable' => False |
| 2549 | 2549 | )); |
| 2550 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones','tz_component',array( |
|
| 2550 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_timezones', 'tz_component', array( |
|
| 2551 | 2551 | 'type' => 'ascii', |
| 2552 | 2552 | 'precision' => '8192', |
| 2553 | 2553 | 'comment' => 'iCal VTIMEZONE component' |
@@ -2563,7 +2563,7 @@ discard block |
||
| 2563 | 2563 | */ |
| 2564 | 2564 | function calendar_upgrade14_3() |
| 2565 | 2565 | { |
| 2566 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user','cal_user_attendee',array( |
|
| 2566 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_cal_user', 'cal_user_attendee', array( |
|
| 2567 | 2567 | 'type' => 'varchar', |
| 2568 | 2568 | 'precision' => '255', |
| 2569 | 2569 | 'comment' => 'email or json object with attr. cn, url, ...' |
@@ -2574,12 +2574,12 @@ discard block |
||
| 2574 | 2574 | |
| 2575 | 2575 | // delete all but one row, which would give a doublicate key, after above normalising of email addresses |
| 2576 | 2576 | // by ordering by status we prever accepted over tentative over unknow over deleted |
| 2577 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
| 2577 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "cal_id,cal_recur_date,$email AS email", array( |
|
| 2578 | 2578 | 'cal_user_type' => 'e', |
| 2579 | 2579 | ), __LINE__, __FILE__, false, "GROUP BY cal_id,cal_recur_date,$email HAVING COUNT(*)>1", 'calendar') as $row) |
| 2580 | 2580 | { |
| 2581 | 2581 | $n = 0; |
| 2582 | - foreach($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
| 2582 | + foreach ($GLOBALS['egw_setup']->db->select('egw_cal_user', "*,$email AS email", array( |
|
| 2583 | 2583 | 'cal_id' => $row['cal_id'], |
| 2584 | 2584 | 'cal_recur_date' => $row['cal_recur_date'], |
| 2585 | 2585 | 'cal_user_type' => 'e', |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | ), __LINE__, __FILE__, false, 'ORDER BY cal_status', 'calendar') as $user) // order A, T, U, X |
| 2588 | 2588 | { |
| 2589 | 2589 | if (strpos($user['email'], '@') !== false && !$n++) continue; |
| 2590 | - $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id','cal_recur_date','cal_user_type','cal_user_id','cal_status')))); |
|
| 2590 | + $GLOBALS['egw_setup']->db->delete('egw_cal_user', array_intersect_key($user, array_flip(array('cal_id', 'cal_recur_date', 'cal_user_type', 'cal_user_id', 'cal_status')))); |
|
| 2591 | 2591 | } |
| 2592 | 2592 | } |
| 2593 | 2593 | |
@@ -2596,7 +2596,7 @@ discard block |
||
| 2596 | 2596 | "UPDATE egw_cal_user SET cal_user_attendee=cal_user_id,cal_user_id=MD5($email) WHERE cal_user_type='e'", |
| 2597 | 2597 | __LINE__, __FILE__); |
| 2598 | 2598 | |
| 2599 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user','cal_user_id',array( |
|
| 2599 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_user', 'cal_user_id', array( |
|
| 2600 | 2600 | 'type' => 'ascii', |
| 2601 | 2601 | 'meta' => array( |
| 2602 | 2602 | "cal_user_type='u'" => 'account' |
@@ -2618,7 +2618,7 @@ discard block |
||
| 2618 | 2618 | { |
| 2619 | 2619 | $GLOBALS['calendar_upgrade14_3_001-run'] = true; |
| 2620 | 2620 | |
| 2621 | - 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 |
|
| 2621 | + 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 | 2622 | FROM egw_cal_user |
| 2623 | 2623 | 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 |
| 2624 | 2624 | WHERE egw_cal_user.cal_user_type='e' AND egw_cal_user.cal_user_attendee IS NOT NULL |
@@ -2669,8 +2669,8 @@ discard block |
||
| 2669 | 2669 | { |
| 2670 | 2670 | Api\Preferences::change_preference('calendar', '/^favorite_/', function($attr, $old_value, $owner) |
| 2671 | 2671 | { |
| 2672 | - unset($attr, $owner); // not used, but required by function signature |
|
| 2673 | - if($old_value['state'] && is_array($old_value['state'])) |
|
| 2672 | + unset($attr, $owner); // not used, but required by function signature |
|
| 2673 | + if ($old_value['state'] && is_array($old_value['state'])) |
|
| 2674 | 2674 | { |
| 2675 | 2675 | unset($old_value['state']['date']); |
| 2676 | 2676 | unset($old_value['state']['startdate']); |
@@ -2690,15 +2690,15 @@ discard block |
||
| 2690 | 2690 | { |
| 2691 | 2691 | Api\Preferences::change_preference('calendar', 'use_time_grid', function($attr, $old_value, $owner) |
| 2692 | 2692 | { |
| 2693 | - unset($attr, $owner); // not used, but required by function signature |
|
| 2694 | - switch($old_value) |
|
| 2693 | + unset($attr, $owner); // not used, but required by function signature |
|
| 2694 | + switch ($old_value) |
|
| 2695 | 2695 | { |
| 2696 | 2696 | case 'all': |
| 2697 | 2697 | return 0; |
| 2698 | 2698 | case 'day_week': |
| 2699 | - return ['day','day4','week']; |
|
| 2699 | + return ['day', 'day4', 'week']; |
|
| 2700 | 2700 | case 'day4': |
| 2701 | - return ['day','day4']; |
|
| 2701 | + return ['day', 'day4']; |
|
| 2702 | 2702 | } |
| 2703 | 2703 | return null; |
| 2704 | 2704 | }); |
@@ -2723,7 +2723,7 @@ discard block |
||
| 2723 | 2723 | function calendar_upgrade16_1_001() |
| 2724 | 2724 | { |
| 2725 | 2725 | $GLOBALS['egw_setup']->oProc->AlterColumn('egw_cal_extra', 'cal_extra_value', |
| 2726 | - array('type' => 'varchar','meta' => 'cfvalue','precision' => '16384','nullable' => False,'default' => '')); |
|
| 2726 | + array('type' => 'varchar', 'meta' => 'cfvalue', 'precision' => '16384', 'nullable' => False, 'default' => '')); |
|
| 2727 | 2727 | |
| 2728 | 2728 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'forced'); |
| 2729 | 2729 | Api\Preferences::change_preference('calendar', 'defaultresource_sel', 'resources', 'addressbook', 'default'); |
@@ -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 | */ |
@@ -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; |
@@ -211,7 +220,10 @@ discard block |
||
| 211 | 220 | } |
| 212 | 221 | |
| 213 | 222 | $cmd = $config['git'].' log '.escapeshellarg($last_tag.'..HEAD'); |
| 214 | - if (getcwd() != $path) $cmd = 'cd '.$path.'; '.$cmd; |
|
| 223 | + if (getcwd() != $path) |
|
| 224 | + { |
|
| 225 | + $cmd = 'cd '.$path.'; '.$cmd; |
|
| 226 | + } |
|
| 215 | 227 | $output = null; |
| 216 | 228 | run_cmd($cmd, $output); |
| 217 | 229 | |
@@ -242,7 +254,10 @@ discard block |
||
| 242 | 254 | { |
| 243 | 255 | global $config, $verbose; |
| 244 | 256 | |
| 245 | - if ($verbose) echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n"; |
|
| 257 | + if ($verbose) |
|
| 258 | + { |
|
| 259 | + echo "Get modules from .mrconfig in checkoutdir $config[checkoutdir]\n"; |
|
| 260 | + } |
|
| 246 | 261 | |
| 247 | 262 | if (!is_dir($config['checkoutdir'])) |
| 248 | 263 | { |
@@ -273,12 +288,21 @@ discard block |
||
| 273 | 288 | 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)) |
| 274 | 289 | { |
| 275 | 290 | $repo = $url = substr($matches[1], 0, 3) == 'svn' ? $matches[5] : $matches[3]; |
| 276 | - if (substr($matches[1], 0, 3) == 'svn') $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo); |
|
| 291 | + if (substr($matches[1], 0, 3) == 'svn') |
|
| 292 | + { |
|
| 293 | + $repo = preg_replace('#/(trunk|branches)/.*$#', '', $repo); |
|
| 294 | + } |
|
| 277 | 295 | $modules[$repo][$config['aliasdir'].($module ? '/'.$module : '')] = $url; |
| 278 | - if ($module === '' && !isset($baseurl)) $baseurl = str_replace('/egroupware.git', '', $url); |
|
| 296 | + if ($module === '' && !isset($baseurl)) |
|
| 297 | + { |
|
| 298 | + $baseurl = str_replace('/egroupware.git', '', $url); |
|
| 299 | + } |
|
| 279 | 300 | } |
| 280 | 301 | } |
| 281 | - if ($verbose) print_r($modules); |
|
| 302 | + if ($verbose) |
|
| 303 | + { |
|
| 304 | + print_r($modules); |
|
| 305 | + } |
|
| 282 | 306 | return $modules; |
| 283 | 307 | } |
| 284 | 308 | |
@@ -345,7 +369,11 @@ discard block |
||
| 345 | 369 | |
| 346 | 370 | $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
| 347 | 371 | |
| 348 | - if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
| 372 | + if (empty($config['tag'])) |
|
| 373 | + { |
|
| 374 | + return; |
|
| 375 | + } |
|
| 376 | + // otherwise we copy everything in svn root! |
|
| 349 | 377 | |
| 350 | 378 | echo "Creating tag $config[tag]\n"; |
| 351 | 379 | |
@@ -361,7 +389,10 @@ discard block |
||
| 361 | 389 | global $config,$verbose; |
| 362 | 390 | |
| 363 | 391 | // push local changes to Github incl. tags |
| 364 | - if ($verbose) echo "Pushing changes and tags\n"; |
|
| 392 | + if ($verbose) |
|
| 393 | + { |
|
| 394 | + echo "Pushing changes and tags\n"; |
|
| 395 | + } |
|
| 365 | 396 | chdir($config['checkoutdir']); |
| 366 | 397 | run_cmd($config['mr']. ' up'); // in case someone else pushed something |
| 367 | 398 | chdir($config['checkoutdir']); |
@@ -429,7 +460,10 @@ discard block |
||
| 429 | 460 | { |
| 430 | 461 | continue; |
| 431 | 462 | } |
| 432 | - if ($verbose) echo "Uploading $path as $content_type\n"; |
|
| 463 | + if ($verbose) |
|
| 464 | + { |
|
| 465 | + echo "Uploading $path as $content_type\n"; |
|
| 466 | + } |
|
| 433 | 467 | $name = basename($path); |
| 434 | 468 | github_api($config['upload_url'], array( |
| 435 | 469 | 'name' => $name, |
@@ -441,7 +475,10 @@ discard block |
||
| 441 | 475 | { |
| 442 | 476 | $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
| 443 | 477 | $cmd = $config['rsync'].' '.$archives.' '.$target; |
| 444 | - if ($verbose) echo $cmd."\n"; |
|
| 478 | + if ($verbose) |
|
| 479 | + { |
|
| 480 | + echo $cmd."\n"; |
|
| 481 | + } |
|
| 445 | 482 | passthru($cmd); |
| 446 | 483 | } |
| 447 | 484 | } |
@@ -474,25 +511,40 @@ discard block |
||
| 474 | 511 | { |
| 475 | 512 | case 'POST': |
| 476 | 513 | curl_setopt($c, CURLOPT_POST, true); |
| 477 | - if (is_array($data)) $data = json_encode($data, JSON_FORCE_OBJECT); |
|
| 514 | + if (is_array($data)) |
|
| 515 | + { |
|
| 516 | + $data = json_encode($data, JSON_FORCE_OBJECT); |
|
| 517 | + } |
|
| 478 | 518 | curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
| 479 | 519 | break; |
| 480 | 520 | case 'GET': |
| 481 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
| 521 | + if(count($data)) |
|
| 522 | + { |
|
| 523 | + $url .= '?' . http_build_query($data); |
|
| 524 | + } |
|
| 482 | 525 | break; |
| 483 | 526 | case 'FILE': |
| 484 | 527 | curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type")); |
| 485 | 528 | curl_setopt($c, CURLOPT_POST, true); |
| 486 | 529 | curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload)); |
| 487 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
| 530 | + if(count($data)) |
|
| 531 | + { |
|
| 532 | + $url .= '?' . http_build_query($data); |
|
| 533 | + } |
|
| 488 | 534 | break; |
| 489 | 535 | default: |
| 490 | 536 | throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!"); |
| 491 | 537 | } |
| 492 | 538 | curl_setopt($c, CURLOPT_URL, $url); |
| 493 | 539 | |
| 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"; |
|
| 540 | + if (is_string($data)) |
|
| 541 | + { |
|
| 542 | + $short_data = strlen($data) > 100 ? substr($data, 0, 100).' ...' : $data; |
|
| 543 | + } |
|
| 544 | + if ($verbose) |
|
| 545 | + { |
|
| 546 | + echo "Sending $method request to $url ".(isset($short_data)&&$method!='GET'?$short_data:'')."\n"; |
|
| 547 | + } |
|
| 496 | 548 | |
| 497 | 549 | if (($response = curl_exec($c)) === false) |
| 498 | 550 | { |
@@ -503,7 +555,10 @@ discard block |
||
| 503 | 555 | throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
| 504 | 556 | } |
| 505 | 557 | |
| 506 | - if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 558 | + if ($verbose) |
|
| 559 | + { |
|
| 560 | + echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
|
| 561 | + } |
|
| 507 | 562 | |
| 508 | 563 | curl_close($c); |
| 509 | 564 | |
@@ -520,13 +575,19 @@ discard block |
||
| 520 | 575 | { |
| 521 | 576 | global $config; |
| 522 | 577 | |
| 523 | - if (!isset($value)) $value = $config[$name]; |
|
| 578 | + if (!isset($value)) |
|
| 579 | + { |
|
| 580 | + $value = $config[$name]; |
|
| 581 | + } |
|
| 524 | 582 | if (is_string($value) && strpos($value, '$') !== false) |
| 525 | 583 | { |
| 526 | 584 | $translate = array(); |
| 527 | 585 | foreach($config as $n => $val) |
| 528 | 586 | { |
| 529 | - if (is_string($val)) $translate['$'.$n] = $val; |
|
| 587 | + if (is_string($val)) |
|
| 588 | + { |
|
| 589 | + $translate['$'.$n] = $val; |
|
| 590 | + } |
|
| 530 | 591 | } |
| 531 | 592 | $value = strtr($value, $translate); |
| 532 | 593 | } |
@@ -628,7 +689,10 @@ discard block |
||
| 628 | 689 | if (is_null($revision)) |
| 629 | 690 | { |
| 630 | 691 | list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url); |
| 631 | - if (empty($branch)) $branch = $config['version']; |
|
| 692 | + if (empty($branch)) |
|
| 693 | + { |
|
| 694 | + $branch = $config['version']; |
|
| 695 | + } |
|
| 632 | 696 | $tags_url .= '/tags'; |
| 633 | 697 | $pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
| 634 | 698 | $matches = null; |
@@ -654,11 +718,18 @@ discard block |
||
| 654 | 718 | $message = ''; |
| 655 | 719 | foreach($xml as $log) |
| 656 | 720 | { |
| 657 | - if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
| 721 | + if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) |
|
| 722 | + { |
|
| 723 | + continue; |
|
| 724 | + } |
|
| 725 | + // no match --> ignore |
|
| 658 | 726 | |
| 659 | 727 | $message .= $msg."\n"; |
| 660 | 728 | } |
| 661 | - if ($verbose) echo $message; |
|
| 729 | + if ($verbose) |
|
| 730 | + { |
|
| 731 | + echo $message; |
|
| 732 | + } |
|
| 662 | 733 | |
| 663 | 734 | return $message; |
| 664 | 735 | } |
@@ -689,7 +760,10 @@ discard block |
||
| 689 | 760 | { |
| 690 | 761 | return null; |
| 691 | 762 | } |
| 692 | - if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg; |
|
| 763 | + if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) |
|
| 764 | + { |
|
| 765 | + $msg = $prefix.$msg; |
|
| 766 | + } |
|
| 693 | 767 | |
| 694 | 768 | return $msg; |
| 695 | 769 | } |
@@ -726,7 +800,10 @@ discard block |
||
| 726 | 800 | if (!$is_regexp && strpos($log->paths->path, $pattern) !== false || |
| 727 | 801 | $is_regexp && preg_match($pattern, $log->paths->path, $matches)) |
| 728 | 802 | { |
| 729 | - if ($verbose) echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
| 803 | + if ($verbose) |
|
| 804 | + { |
|
| 805 | + echo "Revision {$log['revision']} matches".($matches?': '.$matches[1] : '')."\n"; |
|
| 806 | + } |
|
| 730 | 807 | return (int)$log['revision']; |
| 731 | 808 | } |
| 732 | 809 | } |
@@ -746,7 +823,10 @@ discard block |
||
| 746 | 823 | { |
| 747 | 824 | usage("Path '$config[obs]' not found!"); |
| 748 | 825 | } |
| 749 | - if ($verbose) echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n"; |
|
| 826 | + if ($verbose) |
|
| 827 | + { |
|
| 828 | + echo $only_update_changelog ? "Updating OBS changelogs\n" : "Updating OBS checkout\n"; |
|
| 829 | + } |
|
| 750 | 830 | run_cmd('osc up '.$config['obs']); |
| 751 | 831 | |
| 752 | 832 | $n = 0; |
@@ -766,10 +846,16 @@ discard block |
||
| 766 | 846 | if (basename($path) != basename($new_name)) |
| 767 | 847 | { |
| 768 | 848 | unlink($path); |
| 769 | - if ($verbose) echo "rm $path\n"; |
|
| 849 | + if ($verbose) |
|
| 850 | + { |
|
| 851 | + echo "rm $path\n"; |
|
| 852 | + } |
|
| 770 | 853 | } |
| 771 | 854 | copy($new_name,dirname($path).'/'.basename($new_name)); |
| 772 | - if ($verbose) echo "cp $new_name ".dirname($path)."/\n"; |
|
| 855 | + if ($verbose) |
|
| 856 | + { |
|
| 857 | + echo "cp $new_name ".dirname($path)."/\n"; |
|
| 858 | + } |
|
| 773 | 859 | ++$n; |
| 774 | 860 | } |
| 775 | 861 | // if we have no changelog (eg. because commands run separate), try parsing it from changelog file |
@@ -807,7 +893,10 @@ discard block |
||
| 807 | 893 | if ($content != $content_was) |
| 808 | 894 | { |
| 809 | 895 | file_put_contents($path,$content); |
| 810 | - if ($verbose) echo "Updated $path\n"; |
|
| 896 | + if ($verbose) |
|
| 897 | + { |
|
| 898 | + echo "Updated $path\n"; |
|
| 899 | + } |
|
| 811 | 900 | ++$n; |
| 812 | 901 | } |
| 813 | 902 | } |
@@ -845,9 +934,12 @@ discard block |
||
| 845 | 934 | } |
| 846 | 935 | $n += empty($lines[$n+1]) ? 2 : 1; // overead empty line behind header |
| 847 | 936 | $logentry = ''; |
| 848 | - while($lines[$n]) // entry is terminated by empty line |
|
| 937 | + while($lines[$n]) |
|
| 938 | + { |
|
| 939 | + // entry is terminated by empty line |
|
| 849 | 940 | { |
| 850 | 941 | $logentry .= (substr($lines[$n], 0, 2) == ' ' ? substr($lines[$n], 2) : $lines[$n])."\n"; |
| 942 | + } |
|
| 851 | 943 | ++$n; |
| 852 | 944 | } |
| 853 | 945 | return substr($logentry, 0, -1); // remove training "\n" |
@@ -868,7 +960,10 @@ discard block |
||
| 868 | 960 | |
| 869 | 961 | list($header) = explode("\n", $content); |
| 870 | 962 | $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
| 871 | - if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
| 963 | + if (substr($config['changelog'],0,2) != ' ') |
|
| 964 | + { |
|
| 965 | + $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
| 966 | + } |
|
| 872 | 967 | $content = $new_header."\n\n".$config['changelog']. |
| 873 | 968 | "\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content; |
| 874 | 969 | |
@@ -882,10 +977,13 @@ discard block |
||
| 882 | 977 | { |
| 883 | 978 | global $config; |
| 884 | 979 | |
| 885 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 980 | + if (substr($config['sourcedir'],0,2) == '~/') |
|
| 981 | + { |
|
| 982 | + // sha1_file cant deal with '~/rpm' |
|
| 886 | 983 | { |
| 887 | 984 | $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
| 888 | 985 | } |
| 986 | + } |
|
| 889 | 987 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
| 890 | 988 | |
| 891 | 989 | if (!file_exists($sumsfile)) |
@@ -896,11 +994,17 @@ discard block |
||
| 896 | 994 | // signing it |
| 897 | 995 | if (empty($config['gpg']) || !file_exists($config['gpg'])) |
| 898 | 996 | { |
| 899 | - if (!empty($config['gpg'])) echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n"; |
|
| 997 | + if (!empty($config['gpg'])) |
|
| 998 | + { |
|
| 999 | + echo "{$config['gpg']} not found --> skipping signing sha1sum file!\n"; |
|
| 1000 | + } |
|
| 900 | 1001 | return; |
| 901 | 1002 | } |
| 902 | 1003 | echo "Signing sha1sum file:\n"; |
| 903 | - if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc'); |
|
| 1004 | + if (file_exists($sumsfile.'.asc')) |
|
| 1005 | + { |
|
| 1006 | + unlink($sumsfile.'.asc'); |
|
| 1007 | + } |
|
| 904 | 1008 | $cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile; |
| 905 | 1009 | run_cmd($cmd); |
| 906 | 1010 | unlink($sumsfile); // delete the unsigned file |
@@ -913,11 +1017,17 @@ discard block |
||
| 913 | 1017 | { |
| 914 | 1018 | global $config; |
| 915 | 1019 | |
| 916 | - if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true); |
|
| 917 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 1020 | + if (!file_exists($config['sourcedir'])) |
|
| 1021 | + { |
|
| 1022 | + mkdir($config['sourcedir'],0755,true); |
|
| 1023 | + } |
|
| 1024 | + if (substr($config['sourcedir'],0,2) == '~/') |
|
| 1025 | + { |
|
| 1026 | + // sha1_file cant deal with '~/rpm' |
|
| 918 | 1027 | { |
| 919 | 1028 | $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
| 920 | 1029 | } |
| 1030 | + } |
|
| 921 | 1031 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
| 922 | 1032 | $sums = ''; |
| 923 | 1033 | |
@@ -955,12 +1065,22 @@ discard block |
||
| 955 | 1065 | { |
| 956 | 1066 | foreach((array)$config['all-add'] as $add) |
| 957 | 1067 | { |
| 958 | - if (substr($add, -4) != '.tar') continue; // probably a module |
|
| 959 | - if (!($tar = realpath($add))) throw new Exception("File '$add' not found!"); |
|
| 1068 | + if (substr($add, -4) != '.tar') |
|
| 1069 | + { |
|
| 1070 | + continue; |
|
| 1071 | + } |
|
| 1072 | + // probably a module |
|
| 1073 | + if (!($tar = realpath($add))) |
|
| 1074 | + { |
|
| 1075 | + throw new Exception("File '$add' not found!"); |
|
| 1076 | + } |
|
| 960 | 1077 | $cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar; |
| 961 | 1078 | } |
| 962 | 1079 | } |
| 963 | - if (file_exists($file.'.bz2')) $cmd .= '; rm -f '.$file.'.bz2'; |
|
| 1080 | + if (file_exists($file.'.bz2')) |
|
| 1081 | + { |
|
| 1082 | + $cmd .= '; rm -f '.$file.'.bz2'; |
|
| 1083 | + } |
|
| 964 | 1084 | $cmd .= '; '.$config['bzip2'].' '.$file; |
| 965 | 1085 | // run cmd now and continue without adding all tar-ball to sums, as we dont want to publish it |
| 966 | 1086 | run_cmd($cmd); |
@@ -981,7 +1101,10 @@ discard block |
||
| 981 | 1101 | |
| 982 | 1102 | foreach($config['extra'] as $name => $modules) |
| 983 | 1103 | { |
| 984 | - if (is_numeric($name)) $name = $modules; |
|
| 1104 | + if (is_numeric($name)) |
|
| 1105 | + { |
|
| 1106 | + $name = $modules; |
|
| 1107 | + } |
|
| 985 | 1108 | $dirs = ' egroupware/'.implode(' egroupware/', (array)$modules); |
| 986 | 1109 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
| 987 | 1110 | switch($type) |
@@ -1022,7 +1145,10 @@ discard block |
||
| 1022 | 1145 | { |
| 1023 | 1146 | echo "Updating virus signatures\n"; |
| 1024 | 1147 | $cmd = '/usr/bin/sudo '.$config['freshclam']; |
| 1025 | - if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n"; |
|
| 1148 | + if (!$verbose && function_exists('posix_getuid') && posix_getuid()) |
|
| 1149 | + { |
|
| 1150 | + echo $cmd."\n"; |
|
| 1151 | + } |
|
| 1026 | 1152 | $output = null; |
| 1027 | 1153 | run_cmd($cmd,$output,1); // 1 = ignore already up to date database |
| 1028 | 1154 | } |
@@ -1050,7 +1176,10 @@ discard block |
||
| 1050 | 1176 | } |
| 1051 | 1177 | |
| 1052 | 1178 | // we need to stash uncommited changes like .mrconfig, before copying |
| 1053 | - if (file_exists($config['checkoutdir'].'/.git')) run_cmd("cd $config[checkoutdir]; git stash"); |
|
| 1179 | + if (file_exists($config['checkoutdir'].'/.git')) |
|
| 1180 | + { |
|
| 1181 | + run_cmd("cd $config[checkoutdir]; git stash"); |
|
| 1182 | + } |
|
| 1054 | 1183 | |
| 1055 | 1184 | try { |
| 1056 | 1185 | $cmd = '/usr/bin/rsync -r --delete --delete-excluded --exclude .svn --exclude .git\* --exclude .mrconfig --exclude node_modules/ '.$config['checkoutdir'].'/ '.$config['egw_buildroot'].'/'.$config['aliasdir'].'/'; |
@@ -1059,8 +1188,14 @@ discard block |
||
| 1059 | 1188 | catch (Exception $e) { |
| 1060 | 1189 | // catch failures to pop stash, before throwing exception |
| 1061 | 1190 | } |
| 1062 | - if (file_exists($config['checkoutdir'].'/.git')) run_cmd("git stash pop"); |
|
| 1063 | - if (isset($e)) throw $e; |
|
| 1191 | + if (file_exists($config['checkoutdir'].'/.git')) |
|
| 1192 | + { |
|
| 1193 | + run_cmd("git stash pop"); |
|
| 1194 | + } |
|
| 1195 | + if (isset($e)) |
|
| 1196 | + { |
|
| 1197 | + throw $e; |
|
| 1198 | + } |
|
| 1064 | 1199 | |
| 1065 | 1200 | if (($cmd = config_translate('patchCmd')) && $cmd[0] != '#') |
| 1066 | 1201 | { |
@@ -1145,9 +1280,12 @@ discard block |
||
| 1145 | 1280 | if ($ret || substr($line,0,5) == 'URL: ') |
| 1146 | 1281 | { |
| 1147 | 1282 | $url = substr($line,5); |
| 1148 | - if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
| 1283 | + if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) |
|
| 1284 | + { |
|
| 1285 | + // wrong branch (or no svn dir) |
|
| 1149 | 1286 | { |
| 1150 | 1287 | echo "Checkout is of wrong branch --> deleting it\n"; |
| 1288 | + } |
|
| 1151 | 1289 | system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
| 1152 | 1290 | clearstatcache(); |
| 1153 | 1291 | } |
@@ -1194,19 +1332,31 @@ discard block |
||
| 1194 | 1332 | $svnbranch = $config['svnbase'].'/'.$config['svnbranch']; |
| 1195 | 1333 | $url = $svnbranch.'/'.$config['svnalias']; |
| 1196 | 1334 | $cmd = $svn.' propget svn:externals --strict '.$url; |
| 1197 | - if ($verbose) echo $cmd."\n"; |
|
| 1335 | + if ($verbose) |
|
| 1336 | + { |
|
| 1337 | + echo $cmd."\n"; |
|
| 1338 | + } |
|
| 1198 | 1339 | $output = $ret = null; |
| 1199 | 1340 | exec($cmd,$output,$ret); |
| 1200 | 1341 | $config['modules'] = array(); |
| 1201 | 1342 | foreach($output as $line) |
| 1202 | 1343 | { |
| 1203 | 1344 | $line = trim($line); |
| 1204 | - if (empty($line) || $line[0] == '#') continue; |
|
| 1345 | + if (empty($line) || $line[0] == '#') |
|
| 1346 | + { |
|
| 1347 | + continue; |
|
| 1348 | + } |
|
| 1205 | 1349 | list($path,$url) = preg_split('/[ \t\r\n]+/',$line); |
| 1206 | 1350 | $matches = null; |
| 1207 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
| 1351 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) |
|
| 1352 | + { |
|
| 1353 | + die("Invalid SVN URL: $url\n"); |
|
| 1354 | + } |
|
| 1208 | 1355 | $repo = $matches[1]; |
| 1209 | - if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
|
| 1356 | + if ($repo == 'http://svn.egroupware.org/egroupware') |
|
| 1357 | + { |
|
| 1358 | + $repo = 'svn+ssh://[email protected]/egroupware'; |
|
| 1359 | + } |
|
| 1210 | 1360 | $config['modules'][$repo][$path] = $url; |
| 1211 | 1361 | } |
| 1212 | 1362 | // process extra modules |
@@ -1215,13 +1365,25 @@ discard block |
||
| 1215 | 1365 | $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
| 1216 | 1366 | $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
| 1217 | 1367 | $url .= $module; |
| 1218 | - if (strpos($module,'://') !== false) $module = basename($module); |
|
| 1219 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
| 1368 | + if (strpos($module,'://') !== false) |
|
| 1369 | + { |
|
| 1370 | + $module = basename($module); |
|
| 1371 | + } |
|
| 1372 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) |
|
| 1373 | + { |
|
| 1374 | + die("Invalid SVN URL: $url\n"); |
|
| 1375 | + } |
|
| 1220 | 1376 | $repo = $matches[1]; |
| 1221 | - if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
|
| 1377 | + if ($repo == 'http://svn.egroupware.org/egroupware') |
|
| 1378 | + { |
|
| 1379 | + $repo = 'svn+ssh://[email protected]/egroupware'; |
|
| 1380 | + } |
|
| 1222 | 1381 | $config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url; |
| 1223 | 1382 | } |
| 1224 | - if ($verbose) print_r($config['modules']); |
|
| 1383 | + if ($verbose) |
|
| 1384 | + { |
|
| 1385 | + print_r($config['modules']); |
|
| 1386 | + } |
|
| 1225 | 1387 | return $config['modules']; |
| 1226 | 1388 | } |
| 1227 | 1389 | |
@@ -1232,7 +1394,11 @@ discard block |
||
| 1232 | 1394 | { |
| 1233 | 1395 | global $config,$svn; |
| 1234 | 1396 | |
| 1235 | - if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
| 1397 | + if (empty($config['svntag'])) |
|
| 1398 | + { |
|
| 1399 | + return; |
|
| 1400 | + } |
|
| 1401 | + // otherwise we copy everything in svn root! |
|
| 1236 | 1402 | |
| 1237 | 1403 | $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
| 1238 | 1404 | |
@@ -1271,11 +1437,17 @@ discard block |
||
| 1271 | 1437 | { |
| 1272 | 1438 | $output[] = $cmd; |
| 1273 | 1439 | exec($cmd,$output,$ret); |
| 1274 | - if ($verbose) echo implode("\n",$output)."\n"; |
|
| 1440 | + if ($verbose) |
|
| 1441 | + { |
|
| 1442 | + echo implode("\n",$output)."\n"; |
|
| 1443 | + } |
|
| 1275 | 1444 | } |
| 1276 | 1445 | if ($ret && !in_array($ret,(array)$no_bailout)) |
| 1277 | 1446 | { |
| 1278 | - if (!$verbose) echo implode("\n",$output)."\n"; |
|
| 1447 | + if (!$verbose) |
|
| 1448 | + { |
|
| 1449 | + echo implode("\n",$output)."\n"; |
|
| 1450 | + } |
|
| 1279 | 1451 | throw new Exception("Error during '$cmd' --> aborting",$ret); |
| 1280 | 1452 | } |
| 1281 | 1453 | return $ret; |
@@ -1321,7 +1493,10 @@ discard block |
||
| 1321 | 1493 | echo "options and their defaults:\n"; |
| 1322 | 1494 | if ($verbose) |
| 1323 | 1495 | { |
| 1324 | - if (!isset($config['modules'])) $config['modules'] = get_modules_per_repo(); |
|
| 1496 | + if (!isset($config['modules'])) |
|
| 1497 | + { |
|
| 1498 | + $config['modules'] = get_modules_per_repo(); |
|
| 1499 | + } |
|
| 1325 | 1500 | } |
| 1326 | 1501 | else |
| 1327 | 1502 | { |
@@ -1329,7 +1504,10 @@ discard block |
||
| 1329 | 1504 | } |
| 1330 | 1505 | foreach($config as $name => $default) |
| 1331 | 1506 | { |
| 1332 | - if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
| 1507 | + if (is_array($default)) |
|
| 1508 | + { |
|
| 1509 | + $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
| 1510 | + } |
|
| 1333 | 1511 | echo '--'.str_pad($name,20).$default."\n"; |
| 1334 | 1512 | } |
| 1335 | 1513 | if ($error) |
@@ -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 |
@@ -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' => '16.1', // '14.3' |
|
| 22 | + 'version' => '16.1', // '14.3' |
|
| 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_16.1_buildroot', |
| 28 | 28 | 'sourcedir' => '/home/download/stylite-epl/egroupware-epl-16.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('stylite', 'esyncpro', 'archive', // create an extra archive for given apps |
|
| 37 | + 'extra' => 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; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | run_cmd($cmd, $output); |
| 217 | 217 | |
| 218 | 218 | $changelog = ''; |
| 219 | - foreach($output as $line) |
|
| 219 | + foreach ($output as $line) |
|
| 220 | 220 | { |
| 221 | 221 | if (substr($line, 0, 4) == " " && ($msg = _match_log_pattern(substr($line, 4), $log_pattern, $prefix))) |
| 222 | 222 | { |
@@ -248,13 +248,13 @@ discard block |
||
| 248 | 248 | { |
| 249 | 249 | throw new Exception("checkout directory '{$config['checkoutdir']} does NOT exists or is NO directory!"); |
| 250 | 250 | } |
| 251 | - if (!($mrconfig = file_get_contents($path=$config['checkoutdir'].'/.mrconfig'))) |
|
| 251 | + if (!($mrconfig = file_get_contents($path = $config['checkoutdir'].'/.mrconfig'))) |
|
| 252 | 252 | { |
| 253 | 253 | throw new Exception("$path not found!"); |
| 254 | 254 | } |
| 255 | 255 | $module = $baseurl = null; |
| 256 | 256 | $modules = array(); |
| 257 | - foreach(explode("\n", $mrconfig) as $line) |
|
| 257 | + foreach (explode("\n", $mrconfig) as $line) |
|
| 258 | 258 | { |
| 259 | 259 | $matches = null; |
| 260 | 260 | if (isset($baseurl)) |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | $cmd = $config['git'].' clone '.(!empty($config['branch']) ? ' -b '.$config['branch'] : ''). |
| 320 | 320 | ' [email protected]:EGroupware/egroupware.git '.$config['checkoutdir']; |
| 321 | 321 | run_cmd($cmd); |
| 322 | - run_cmd('mr up'); // need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!) |
|
| 322 | + run_cmd('mr up'); // need to run mr up twice for new checkout, because chained .mrconfig wont run first time (because not there yet!) |
|
| 323 | 323 | } |
| 324 | 324 | elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir'])) |
| 325 | 325 | { |
@@ -343,9 +343,9 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | chdir($config['checkoutdir']); |
| 345 | 345 | |
| 346 | - $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
|
| 346 | + $config['tag'] = config_translate('tag'); // allow to use config vars like $version in tag |
|
| 347 | 347 | |
| 348 | - if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
| 348 | + if (empty($config['tag'])) return; // otherwise we copy everything in svn root! |
|
| 349 | 349 | |
| 350 | 350 | echo "Creating tag $config[tag]\n"; |
| 351 | 351 | |
@@ -358,16 +358,16 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | function do_release() |
| 360 | 360 | { |
| 361 | - global $config,$verbose; |
|
| 361 | + global $config, $verbose; |
|
| 362 | 362 | |
| 363 | 363 | // push local changes to Github incl. tags |
| 364 | 364 | if ($verbose) echo "Pushing changes and tags\n"; |
| 365 | 365 | chdir($config['checkoutdir']); |
| 366 | - run_cmd($config['mr']. ' up'); // in case someone else pushed something |
|
| 366 | + run_cmd($config['mr'].' up'); // in case someone else pushed something |
|
| 367 | 367 | chdir($config['checkoutdir']); |
| 368 | - run_cmd($config['git'].' push'); // regular commits like changelog |
|
| 368 | + run_cmd($config['git'].' push'); // regular commits like changelog |
|
| 369 | 369 | $tag = config_translate('tag'); |
| 370 | - run_cmd($config['mr']. ' push origin '.$tag); // pushing tags in all apps |
|
| 370 | + run_cmd($config['mr'].' push origin '.$tag); // pushing tags in all apps |
|
| 371 | 371 | |
| 372 | 372 | if (empty($config['github_user']) || empty($config['github_token'])) |
| 373 | 373 | { |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | 'body' => $config['changelog'], |
| 385 | 385 | ); |
| 386 | 386 | $response = github_api("/repos/EGroupware/egroupware/releases", $data); |
| 387 | - $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template |
|
| 387 | + $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response['upload_url']); // remove {?name,label} template |
|
| 388 | 388 | |
| 389 | 389 | do_upload(); |
| 390 | 390 | } |
@@ -394,33 +394,33 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | function do_upload() |
| 396 | 396 | { |
| 397 | - global $config,$verbose; |
|
| 397 | + global $config, $verbose; |
|
| 398 | 398 | |
| 399 | 399 | if (empty($config['upload_url'])) |
| 400 | 400 | { |
| 401 | 401 | $response = github_api("/repos/EGroupware/egroupware/releases", array(), 'GET'); |
| 402 | - $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template |
|
| 402 | + $config['upload_url'] = preg_replace('/{\?[^}]+}$/', '', $response[0]['upload_url']); // remove {?name,label} template |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | $archives = config_translate('upload'); |
| 406 | 406 | echo "Uploading $archives to $config[upload_url]\n"; |
| 407 | 407 | |
| 408 | - foreach(glob($archives, GLOB_BRACE) as $path) |
|
| 408 | + foreach (glob($archives, GLOB_BRACE) as $path) |
|
| 409 | 409 | { |
| 410 | 410 | $label = null; |
| 411 | 411 | if (substr($path, -4) == '.zip') |
| 412 | 412 | { |
| 413 | 413 | $content_type = 'application/zip'; |
| 414 | 414 | } |
| 415 | - elseif(substr($path, -7) == '.tar.gz') |
|
| 415 | + elseif (substr($path, -7) == '.tar.gz') |
|
| 416 | 416 | { |
| 417 | 417 | $content_type = 'application/x-gzip'; |
| 418 | 418 | } |
| 419 | - elseif(substr($path, -8) == '.tar.bz2') |
|
| 419 | + elseif (substr($path, -8) == '.tar.bz2') |
|
| 420 | 420 | { |
| 421 | 421 | $content_type = 'application/x-bzip2'; |
| 422 | 422 | } |
| 423 | - elseif(substr($path, -8) == '.txt.asc') |
|
| 423 | + elseif (substr($path, -8) == '.txt.asc') |
|
| 424 | 424 | { |
| 425 | 425 | $content_type = 'text/plain'; |
| 426 | 426 | $label = 'Signed hashes of downloads'; |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | if (!empty($config['release'])) |
| 441 | 441 | { |
| 442 | - $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
|
| 442 | + $target = config_translate('release'); // allow to use config vars like $svnbranch in module |
|
| 443 | 443 | $cmd = $config['rsync'].' '.$archives.' '.$target; |
| 444 | 444 | if ($verbose) echo $cmd."\n"; |
| 445 | 445 | passthru($cmd); |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * @throws Exception |
| 458 | 458 | * @return array with response |
| 459 | 459 | */ |
| 460 | -function github_api($_url, $data, $method='POST', $upload=null, $content_type=null) |
|
| 460 | +function github_api($_url, $data, $method = 'POST', $upload = null, $content_type = null) |
|
| 461 | 461 | { |
| 462 | 462 | global $config, $verbose; |
| 463 | 463 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | curl_setopt($c, CURLOPT_TIMEOUT, 240); |
| 471 | 471 | curl_setopt($c, CURLOPT_FOLLOWLOCATION, true); |
| 472 | 472 | |
| 473 | - switch($method) |
|
| 473 | + switch ($method) |
|
| 474 | 474 | { |
| 475 | 475 | case 'POST': |
| 476 | 476 | curl_setopt($c, CURLOPT_POST, true); |
@@ -478,13 +478,13 @@ discard block |
||
| 478 | 478 | curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
| 479 | 479 | break; |
| 480 | 480 | case 'GET': |
| 481 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
| 481 | + if (count($data)) $url .= '?'.http_build_query($data); |
|
| 482 | 482 | break; |
| 483 | 483 | case 'FILE': |
| 484 | 484 | curl_setopt($c, CURLOPT_HTTPHEADER, array("Content-type: $content_type")); |
| 485 | 485 | curl_setopt($c, CURLOPT_POST, true); |
| 486 | 486 | curl_setopt($c, CURLOPT_POSTFIELDS, file_get_contents($upload)); |
| 487 | - if(count($data)) $url .= '?' . http_build_query($data); |
|
| 487 | + if (count($data)) $url .= '?'.http_build_query($data); |
|
| 488 | 488 | break; |
| 489 | 489 | default: |
| 490 | 490 | throw new Exception(__FUNCTION__.": Unknown/unimplemented method=$method!"); |
@@ -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 | { |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | curl_setopt($c, CURLOPT_HEADER, true); |
| 501 | 501 | curl_setopt($c, CURLOPT_RETURNTRANSFER, false); |
| 502 | 502 | curl_exec($c); |
| 503 | - throw new Exception("$method request to $url failed ".(isset($short_data)&&$method!='GET'?$short_data:'')); |
|
| 503 | + throw new Exception("$method request to $url failed ".(isset($short_data) && $method != 'GET' ? $short_data : '')); |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | if ($verbose) echo (strlen($response) > 200 ? substr($response, 0, 200).' ...' : $response)."\n"; |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | * @param string $name |
| 517 | 517 | * @param string $value =null value to use, default $config[$name] |
| 518 | 518 | */ |
| 519 | -function config_translate($name, $value=null) |
|
| 519 | +function config_translate($name, $value = null) |
|
| 520 | 520 | { |
| 521 | 521 | global $config; |
| 522 | 522 | |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | if (is_string($value) && strpos($value, '$') !== false) |
| 525 | 525 | { |
| 526 | 526 | $translate = array(); |
| 527 | - foreach($config as $n => $val) |
|
| 527 | + foreach ($config as $n => $val) |
|
| 528 | 528 | { |
| 529 | 529 | if (is_string($val)) $translate['$'.$n] = $val; |
| 530 | 530 | } |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | */ |
| 551 | 551 | function do_editchangelog() |
| 552 | 552 | { |
| 553 | - global $config,$svn; |
|
| 553 | + global $config, $svn; |
|
| 554 | 554 | |
| 555 | 555 | echo "Querying changelog from Git/SVN\n"; |
| 556 | 556 | if (!isset($config['modules'])) |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | // query changelog per repo |
| 561 | 561 | $changelog = ''; |
| 562 | 562 | $last_tag = null; |
| 563 | - foreach($config['modules'] as $branch_url => $modules) |
|
| 563 | + foreach ($config['modules'] as $branch_url => $modules) |
|
| 564 | 564 | { |
| 565 | 565 | $revision = null; |
| 566 | 566 | if (substr($branch_url, -4) == '.git') |
@@ -573,15 +573,15 @@ discard block |
||
| 573 | 573 | $changelog .= get_changelog_from_svn($branch_url, $config['editchangelog'], $revision); |
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | - $logfile = tempnam('/tmp','checkout-build-archives'); |
|
| 577 | - file_put_contents($logfile,$changelog); |
|
| 576 | + $logfile = tempnam('/tmp', 'checkout-build-archives'); |
|
| 577 | + file_put_contents($logfile, $changelog); |
|
| 578 | 578 | $cmd = $config['editor'].' '.escapeshellarg($logfile); |
| 579 | 579 | passthru($cmd); |
| 580 | 580 | $config['changelog'] = file_get_contents($logfile); |
| 581 | 581 | // remove trailing newlines |
| 582 | - while (substr($config['changelog'],-1) == "\n") |
|
| 582 | + while (substr($config['changelog'], -1) == "\n") |
|
| 583 | 583 | { |
| 584 | - $config['changelog'] = substr($config['changelog'],0,-1); |
|
| 584 | + $config['changelog'] = substr($config['changelog'], 0, -1); |
|
| 585 | 585 | } |
| 586 | 586 | // allow user to abort, by deleting the changelog |
| 587 | 587 | if (strlen($config['changelog']) <= 2) |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | run_cmd($cmd); |
| 607 | 607 | |
| 608 | 608 | // update obs changelogs (so all changlogs are updated in case of a later error and changelog step can be skiped) |
| 609 | - do_obs(true); // true: only update debian.changes in obs checkouts |
|
| 609 | + do_obs(true); // true: only update debian.changes in obs checkouts |
|
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | /** |
@@ -620,41 +620,41 @@ discard block |
||
| 620 | 620 | * @param string $prefix ='* ' prefix, which if not presend should be added to all log messages |
| 621 | 621 | * @return string with changelog |
| 622 | 622 | */ |
| 623 | -function get_changelog_from_svn($branch_url, $log_pattern=null, &$revision=null, $prefix='* ') |
|
| 623 | +function get_changelog_from_svn($branch_url, $log_pattern = null, &$revision = null, $prefix = '* ') |
|
| 624 | 624 | { |
| 625 | 625 | //echo __FUNCTION__."('$branch_url','$log_pattern','$revision','$prefix')\n"; |
| 626 | - global $config,$verbose,$svn; |
|
| 626 | + global $config, $verbose, $svn; |
|
| 627 | 627 | |
| 628 | 628 | if (is_null($revision)) |
| 629 | 629 | { |
| 630 | - list($tags_url,$branch) = preg_split('#/(branches/|trunk)#',$branch_url); |
|
| 630 | + list($tags_url, $branch) = preg_split('#/(branches/|trunk)#', $branch_url); |
|
| 631 | 631 | if (empty($branch)) $branch = $config['version']; |
| 632 | 632 | $tags_url .= '/tags'; |
| 633 | - $pattern='|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
|
| 633 | + $pattern = '|/tags/('.preg_quote($config['version'], '|').'\.[0-9.]+)|'; |
|
| 634 | 634 | $matches = null; |
| 635 | - $revision = get_last_svn_tag($tags_url,$pattern,$matches); |
|
| 635 | + $revision = get_last_svn_tag($tags_url, $pattern, $matches); |
|
| 636 | 636 | $tag = $matches[1]; |
| 637 | 637 | } |
| 638 | - elseif(!is_numeric($revision)) |
|
| 638 | + elseif (!is_numeric($revision)) |
|
| 639 | 639 | { |
| 640 | - $revision = get_last_svn_tag($tags_url,$tag=$revision); |
|
| 640 | + $revision = get_last_svn_tag($tags_url, $tag = $revision); |
|
| 641 | 641 | } |
| 642 | 642 | $cmd = $svn.' log --xml -r '.escapeshellarg($revision.':HEAD').' '.escapeshellarg($branch_url); |
| 643 | 643 | if (($v = $verbose)) |
| 644 | 644 | { |
| 645 | 645 | echo "Querying SVN for log from r$revision".($tag ? " ($tag)" : '').":\n$cmd\n"; |
| 646 | - $verbose = false; // otherwise no $output! |
|
| 646 | + $verbose = false; // otherwise no $output! |
|
| 647 | 647 | } |
| 648 | 648 | $output = array(); |
| 649 | - run_cmd($cmd,$output); |
|
| 649 | + run_cmd($cmd, $output); |
|
| 650 | 650 | $verbose = $v; |
| 651 | - array_shift($output); // remove the command |
|
| 651 | + array_shift($output); // remove the command |
|
| 652 | 652 | |
| 653 | - $xml = simplexml_load_string($output=implode("\n",$output)); |
|
| 653 | + $xml = simplexml_load_string($output = implode("\n", $output)); |
|
| 654 | 654 | $message = ''; |
| 655 | - foreach($xml as $log) |
|
| 655 | + foreach ($xml as $log) |
|
| 656 | 656 | { |
| 657 | - if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
| 657 | + if (!($msg = _match_log_pattern($log->msg, $log_pattern, $prefix))) continue; // no match --> ignore |
|
| 658 | 658 | |
| 659 | 659 | $message .= $msg."\n"; |
| 660 | 660 | } |
@@ -671,25 +671,25 @@ discard block |
||
| 671 | 671 | * @param string $prefix ='* ' |
| 672 | 672 | * @return string |
| 673 | 673 | */ |
| 674 | -function _match_log_pattern($msg, $log_pattern, $prefix='* ') |
|
| 674 | +function _match_log_pattern($msg, $log_pattern, $prefix = '* ') |
|
| 675 | 675 | { |
| 676 | 676 | $pattern_len = strlen($log_pattern); |
| 677 | 677 | $prefix_len = strlen($prefix); |
| 678 | 678 | |
| 679 | 679 | $matches = null; |
| 680 | - if ($log_pattern[0] == '/' && preg_match($log_pattern,$msg,$matches)) |
|
| 680 | + if ($log_pattern[0] == '/' && preg_match($log_pattern, $msg, $matches)) |
|
| 681 | 681 | { |
| 682 | 682 | $msg = $matches[1]; |
| 683 | 683 | } |
| 684 | - elseif($log_pattern && $log_pattern[0] != '/' && substr($msg,0,$pattern_len) == $log_pattern) |
|
| 684 | + elseif ($log_pattern && $log_pattern[0] != '/' && substr($msg, 0, $pattern_len) == $log_pattern) |
|
| 685 | 685 | { |
| 686 | - list($msg) = explode("\n",$msg); |
|
| 686 | + list($msg) = explode("\n", $msg); |
|
| 687 | 687 | } |
| 688 | - elseif($log_pattern) |
|
| 688 | + elseif ($log_pattern) |
|
| 689 | 689 | { |
| 690 | 690 | return null; |
| 691 | 691 | } |
| 692 | - if ($prefix_len && substr($msg,0,$prefix_len) != $prefix) $msg = $prefix.$msg; |
|
| 692 | + if ($prefix_len && substr($msg, 0, $prefix_len) != $prefix) $msg = $prefix.$msg; |
|
| 693 | 693 | |
| 694 | 694 | return $msg; |
| 695 | 695 | } |
@@ -703,30 +703,30 @@ discard block |
||
| 703 | 703 | * @param array &$matches=null on return matches of preg_match |
| 704 | 704 | * @return int revision of last svn tag matching pattern |
| 705 | 705 | */ |
| 706 | -function get_last_svn_tag($tags_url,$pattern,&$matches=null) |
|
| 706 | +function get_last_svn_tag($tags_url, $pattern, &$matches = null) |
|
| 707 | 707 | { |
| 708 | - global $verbose,$svn; |
|
| 708 | + global $verbose, $svn; |
|
| 709 | 709 | |
| 710 | 710 | $cmd = $svn.' log --xml --limit 40 -v '.escapeshellarg($tags_url); |
| 711 | 711 | if (($v = $verbose)) |
| 712 | 712 | { |
| 713 | 713 | echo "Querying SVN for last tags\n$cmd\n"; |
| 714 | - $verbose = false; // otherwise no $output! |
|
| 714 | + $verbose = false; // otherwise no $output! |
|
| 715 | 715 | } |
| 716 | 716 | $output = array(); |
| 717 | - run_cmd($cmd,$output); |
|
| 717 | + run_cmd($cmd, $output); |
|
| 718 | 718 | $verbose = $v; |
| 719 | - array_shift($output); // remove the command |
|
| 719 | + array_shift($output); // remove the command |
|
| 720 | 720 | |
| 721 | - $xml = simplexml_load_string($output=implode("\n",$output)); |
|
| 721 | + $xml = simplexml_load_string($output = implode("\n", $output)); |
|
| 722 | 722 | $is_regexp = $pattern[0] == substr($pattern, -1); |
| 723 | - foreach($xml as $log) |
|
| 723 | + foreach ($xml as $log) |
|
| 724 | 724 | { |
| 725 | 725 | //print_r($log); |
| 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 | } |
@@ -738,9 +738,9 @@ discard block |
||
| 738 | 738 | * |
| 739 | 739 | * @param boolean $only_update_changelog =false true update debian.changes, but nothing else, nor commit it |
| 740 | 740 | */ |
| 741 | -function do_obs($only_update_changelog=false) |
|
| 741 | +function do_obs($only_update_changelog = false) |
|
| 742 | 742 | { |
| 743 | - global $config,$verbose; |
|
| 743 | + global $config, $verbose; |
|
| 744 | 744 | |
| 745 | 745 | if (!is_dir($config['obs'])) |
| 746 | 746 | { |
@@ -750,25 +750,25 @@ discard block |
||
| 750 | 750 | run_cmd('osc up '.$config['obs']); |
| 751 | 751 | |
| 752 | 752 | $n = 0; |
| 753 | - foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path) |
|
| 753 | + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($config['obs'])) as $path) |
|
| 754 | 754 | { |
| 755 | 755 | if (basename(dirname($path)) == '.osc' || |
| 756 | 756 | !preg_match('/\/('.preg_quote($config['packagename']). |
| 757 | 757 | ($config['obs_package_alias'] ? '|'.preg_quote($config['obs_package_alias']) : ''). |
| 758 | - ')[a-z-]*-('.preg_quote($config['version']).'|trunk)/',$path)) |
|
| 758 | + ')[a-z-]*-('.preg_quote($config['version']).'|trunk)/', $path)) |
|
| 759 | 759 | { |
| 760 | 760 | continue; |
| 761 | 761 | } |
| 762 | 762 | $matches = null; |
| 763 | - if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/',$path,$matches) && |
|
| 764 | - file_exists($new_name=$config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2])) |
|
| 763 | + if (preg_match('/\/('.preg_quote($config['packagename']).'[a-z-]*)-'.preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/', $path, $matches) && |
|
| 764 | + file_exists($new_name = $config['sourcedir'].'/'.$matches[1].'-'.$config['version'].'.'.$config['packaging'].$matches[2])) |
|
| 765 | 765 | { |
| 766 | 766 | if (basename($path) != basename($new_name)) |
| 767 | 767 | { |
| 768 | 768 | unlink($path); |
| 769 | 769 | if ($verbose) echo "rm $path\n"; |
| 770 | 770 | } |
| 771 | - copy($new_name,dirname($path).'/'.basename($new_name)); |
|
| 771 | + copy($new_name, dirname($path).'/'.basename($new_name)); |
|
| 772 | 772 | if ($verbose) echo "cp $new_name ".dirname($path)."/\n"; |
| 773 | 773 | ++$n; |
| 774 | 774 | } |
@@ -778,35 +778,35 @@ discard block |
||
| 778 | 778 | $config['changelog'] = parse_current_changelog(); |
| 779 | 779 | } |
| 780 | 780 | // updating dsc, spec and changelog files |
| 781 | - if (!$only_update_changelog && (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') || |
|
| 781 | + if (!$only_update_changelog && (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') || |
|
| 782 | 782 | !empty($config['changelog']) && basename($path) == 'debian.changes') |
| 783 | 783 | { |
| 784 | 784 | $content = $content_was = file_get_contents($path); |
| 785 | 785 | |
| 786 | - if (substr($path,-4) == '.dsc' || substr($path,-5) == '.spec') |
|
| 786 | + if (substr($path, -4) == '.dsc' || substr($path, -5) == '.spec') |
|
| 787 | 787 | { |
| 788 | - $content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m','Version: '.$config['version'].'.'.$config['packaging'],$content); |
|
| 788 | + $content = preg_replace('/^Version: '.preg_quote($config['version']).'\.[0-9.]+[0-9]/m', 'Version: '.$config['version'].'.'.$config['packaging'], $content); |
|
| 789 | 789 | } |
| 790 | - if (substr($path,-4) == '.dsc') |
|
| 790 | + if (substr($path, -4) == '.dsc') |
|
| 791 | 791 | { |
| 792 | 792 | $content = preg_replace('/^(Debtransform-Tar: '.preg_quote($config['packagename']).'[a-z-]*)-'. |
| 793 | 793 | preg_quote($config['version']).'\.[0-9.]+[0-9](\.tar\.(gz|bz2))$/m', |
| 794 | - '\\1-'.$config['version'].'.'.$config['packaging'].'\\2',$content); |
|
| 794 | + '\\1-'.$config['version'].'.'.$config['packaging'].'\\2', $content); |
|
| 795 | 795 | } |
| 796 | - if (basename($path) == 'debian.changes' && strpos($content,$config['version'].'.'.$config['packaging']) === false) |
|
| 796 | + if (basename($path) == 'debian.changes' && strpos($content, $config['version'].'.'.$config['packaging']) === false) |
|
| 797 | 797 | { |
| 798 | 798 | $content = update_changelog($content); |
| 799 | 799 | } |
| 800 | - if (!empty($config['changelog']) && substr($path,-5) == '.spec' && |
|
| 801 | - ($pos_changelog = strpos($content,'%changelog')) !== false) |
|
| 800 | + if (!empty($config['changelog']) && substr($path, -5) == '.spec' && |
|
| 801 | + ($pos_changelog = strpos($content, '%changelog')) !== false) |
|
| 802 | 802 | { |
| 803 | 803 | $pos_changelog += strlen("%changelog\n"); |
| 804 | - $content = substr($content,0,$pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n". |
|
| 805 | - $config['changelog']."\n".substr($content,$pos_changelog); |
|
| 804 | + $content = substr($content, 0, $pos_changelog).' *'.date('D M d Y').' '.$config['changelog_packager']."\n". |
|
| 805 | + $config['changelog']."\n".substr($content, $pos_changelog); |
|
| 806 | 806 | } |
| 807 | 807 | if ($content != $content_was) |
| 808 | 808 | { |
| 809 | - file_put_contents($path,$content); |
|
| 809 | + file_put_contents($path, $content); |
|
| 810 | 810 | if ($verbose) echo "Updated $path\n"; |
| 811 | 811 | ++$n; |
| 812 | 812 | } |
@@ -827,33 +827,33 @@ discard block |
||
| 827 | 827 | * @param boolean $set_packaging =false true: set packaging from last changelog entry |
| 828 | 828 | * @return string changelog entries without header and footer lines |
| 829 | 829 | */ |
| 830 | -function parse_current_changelog($set_packaging=false) |
|
| 830 | +function parse_current_changelog($set_packaging = false) |
|
| 831 | 831 | { |
| 832 | 832 | global $config; |
| 833 | 833 | |
| 834 | 834 | $changelog = file_get_contents($config['checkoutdir'].'/doc/rpm-build/debian.changes'); |
| 835 | 835 | $lines = explode("\n", $changelog, 100); |
| 836 | 836 | $matches = null; |
| 837 | - foreach($lines as $n => $line) |
|
| 837 | + foreach ($lines as $n => $line) |
|
| 838 | 838 | { |
| 839 | - if (preg_match($preg='/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'. |
|
| 839 | + if (preg_match($preg = '/^'.preg_quote($config['packagename']).' \('.preg_quote($config['version']).'\.'. |
|
| 840 | 840 | ($set_packaging ? '([0-9]+)' : preg_quote($config['packaging'])).'/', $line, $matches)) |
| 841 | 841 | { |
| 842 | 842 | if ($set_packaging) |
| 843 | 843 | { |
| 844 | 844 | $config['packaging'] = $matches[1]; |
| 845 | 845 | } |
| 846 | - $n += empty($lines[$n+1]) ? 2 : 1; // overead empty line behind header |
|
| 846 | + $n += empty($lines[$n + 1]) ? 2 : 1; // overead empty line behind header |
|
| 847 | 847 | $logentry = ''; |
| 848 | - while($lines[$n]) // entry is terminated by empty line |
|
| 848 | + while ($lines[$n]) // entry is terminated by empty line |
|
| 849 | 849 | { |
| 850 | 850 | $logentry .= (substr($lines[$n], 0, 2) == ' ' ? substr($lines[$n], 2) : $lines[$n])."\n"; |
| 851 | 851 | ++$n; |
| 852 | 852 | } |
| 853 | - return substr($logentry, 0, -1); // remove training "\n" |
|
| 853 | + return substr($logentry, 0, -1); // remove training "\n" |
|
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | - return null; // paragraph for current version NOT found |
|
| 856 | + return null; // paragraph for current version NOT found |
|
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | /** |
@@ -867,8 +867,8 @@ discard block |
||
| 867 | 867 | global $config; |
| 868 | 868 | |
| 869 | 869 | list($header) = explode("\n", $content); |
| 870 | - $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/','('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
|
| 871 | - if (substr($config['changelog'],0,2) != ' ') $config['changelog'] = ' '.implode("\n ",explode("\n",$config['changelog'])); |
|
| 870 | + $new_header = preg_replace('/\('.preg_quote($config['version']).'\.[0-9.]+[0-9](.*)\)/', '('.$config['version'].'.'.$config['packaging'].'\\1)', $header); |
|
| 871 | + if (substr($config['changelog'], 0, 2) != ' ') $config['changelog'] = ' '.implode("\n ", explode("\n", $config['changelog'])); |
|
| 872 | 872 | $content = $new_header."\n\n".$config['changelog']. |
| 873 | 873 | "\n\n -- ".$config['changelog_packager'].' '.date('r')."\n\n".$content; |
| 874 | 874 | |
@@ -882,9 +882,9 @@ discard block |
||
| 882 | 882 | { |
| 883 | 883 | global $config; |
| 884 | 884 | |
| 885 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 885 | + if (substr($config['sourcedir'], 0, 2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 886 | 886 | { |
| 887 | - $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
|
| 887 | + $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1); |
|
| 888 | 888 | } |
| 889 | 889 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
| 890 | 890 | |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | if (file_exists($sumsfile.'.asc')) unlink($sumsfile.'.asc'); |
| 904 | 904 | $cmd = $config['gpg'].' --local-user '.$config['packager'].' --clearsign '.$sumsfile; |
| 905 | 905 | run_cmd($cmd); |
| 906 | - unlink($sumsfile); // delete the unsigned file |
|
| 906 | + unlink($sumsfile); // delete the unsigned file |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -913,22 +913,22 @@ discard block |
||
| 913 | 913 | { |
| 914 | 914 | global $config; |
| 915 | 915 | |
| 916 | - if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'],0755,true); |
|
| 917 | - if (substr($config['sourcedir'],0,2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 916 | + if (!file_exists($config['sourcedir'])) mkdir($config['sourcedir'], 0755, true); |
|
| 917 | + if (substr($config['sourcedir'], 0, 2) == '~/') // sha1_file cant deal with '~/rpm' |
|
| 918 | 918 | { |
| 919 | - $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'],1); |
|
| 919 | + $config['sourcedir'] = getenv('HOME').substr($config['sourcedir'], 1); |
|
| 920 | 920 | } |
| 921 | 921 | $sumsfile = $config['sourcedir'].'/sha1sum-'.$config['packagename'].'-'.$config['version'].'.'.$config['packaging'].'.txt'; |
| 922 | 922 | $sums = ''; |
| 923 | 923 | |
| 924 | 924 | chdir($config['egw_buildroot']); |
| 925 | 925 | |
| 926 | - if($config['extra']) |
|
| 926 | + if ($config['extra']) |
|
| 927 | 927 | { |
| 928 | 928 | $exclude = $exclude_all = array(); |
| 929 | - foreach($config['extra'] as $name => $modules) |
|
| 929 | + foreach ($config['extra'] as $name => $modules) |
|
| 930 | 930 | { |
| 931 | - foreach((array)$modules as $module) |
|
| 931 | + foreach ((array)$modules as $module) |
|
| 932 | 932 | { |
| 933 | 933 | $exclude[] = basename($module); |
| 934 | 934 | if (!empty($config['all-add']) && !in_array($module, $config['all-add']) && (is_int($name) || !in_array($name, $config['all-add']))) |
@@ -938,24 +938,24 @@ discard block |
||
| 938 | 938 | } |
| 939 | 939 | } |
| 940 | 940 | $exclude_extra = ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude); |
| 941 | - $exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : ''; |
|
| 941 | + $exclude_all_extra = $exclude_all ? ' --exclude=egroupware/'.implode(' --exclude=egroupware/', $exclude_all) : ''; |
|
| 942 | 942 | } |
| 943 | - foreach($config['types'] as $type) |
|
| 943 | + foreach ($config['types'] as $type) |
|
| 944 | 944 | { |
| 945 | 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; |
| 949 | - switch($type) |
|
| 949 | + switch ($type) |
|
| 950 | 950 | { |
| 951 | 951 | case 'all.tar.bz2': // single tar-ball for debian builds not easily supporting to use multiple |
| 952 | 952 | $file = $config['sourcedir'].'/'.$config['packagename'].'-all-'.$config['version'].'.'.$config['packaging'].'.tar'; |
| 953 | 953 | $cmd = $config['tar'].' --owner=root --group=root -cf '.$file.$exclude_all_extra.' egroupware'; |
| 954 | 954 | if (!empty($config['all-add'])) |
| 955 | 955 | { |
| 956 | - foreach((array)$config['all-add'] as $add) |
|
| 956 | + foreach ((array)$config['all-add'] as $add) |
|
| 957 | 957 | { |
| 958 | - if (substr($add, -4) != '.tar') continue; // probably a module |
|
| 958 | + if (substr($add, -4) != '.tar') continue; // probably a module |
|
| 959 | 959 | if (!($tar = realpath($add))) throw new Exception("File '$add' not found!"); |
| 960 | 960 | $cmd .= '; '.$config['tar'].' --owner=root --group=root -Af '.$file.' '.$tar; |
| 961 | 961 | } |
@@ -979,15 +979,15 @@ discard block |
||
| 979 | 979 | run_cmd($cmd); |
| 980 | 980 | $sums .= sha1_file($file)."\t".basename($file)."\n"; |
| 981 | 981 | |
| 982 | - foreach($config['extra'] as $name => $modules) |
|
| 982 | + foreach ($config['extra'] as $name => $modules) |
|
| 983 | 983 | { |
| 984 | 984 | if (is_numeric($name)) $name = $modules; |
| 985 | 985 | $dirs = ' egroupware/'.implode(' egroupware/', (array)$modules); |
| 986 | 986 | $file = $config['sourcedir'].'/'.$config['packagename'].'-'.$name.'-'.$config['version'].'.'.$config['packaging'].'.'.$type; |
| 987 | - switch($type) |
|
| 987 | + switch ($type) |
|
| 988 | 988 | { |
| 989 | 989 | case 'all.tar.bz2': |
| 990 | - break; // nothing to do |
|
| 990 | + break; // nothing to do |
|
| 991 | 991 | case 'tar.bz2': |
| 992 | 992 | case 'tar.gz': |
| 993 | 993 | $cmd = $config['tar'].' --owner=root --group=root -c'.$tar_type.'f '.$file.$dirs; |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | // writing sha1sum file |
| 1005 | - file_put_contents($sumsfile,$sums); |
|
| 1005 | + file_put_contents($sumsfile, $sums); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | /** |
@@ -1010,7 +1010,7 @@ discard block |
||
| 1010 | 1010 | */ |
| 1011 | 1011 | function do_virusscan() |
| 1012 | 1012 | { |
| 1013 | - global $config,$verbose; |
|
| 1013 | + global $config, $verbose; |
|
| 1014 | 1014 | |
| 1015 | 1015 | if (!file_exists($config['clamscan']) || !is_executable($config['clamscan'])) |
| 1016 | 1016 | { |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | $cmd = '/usr/bin/sudo '.$config['freshclam']; |
| 1025 | 1025 | if (!$verbose && function_exists('posix_getuid') && posix_getuid()) echo $cmd."\n"; |
| 1026 | 1026 | $output = null; |
| 1027 | - run_cmd($cmd,$output,1); // 1 = ignore already up to date database |
|
| 1027 | + run_cmd($cmd, $output, 1); // 1 = ignore already up to date database |
|
| 1028 | 1028 | } |
| 1029 | 1029 | echo "Starting virusscan\n"; |
| 1030 | 1030 | $cmd = $config['clamscan'].' --quiet -r '.$config['egw_buildroot']; |
@@ -1081,12 +1081,12 @@ discard block |
||
| 1081 | 1081 | */ |
| 1082 | 1082 | function do_svncheckout() |
| 1083 | 1083 | { |
| 1084 | - global $config,$svn; |
|
| 1084 | + global $config, $svn; |
|
| 1085 | 1085 | |
| 1086 | 1086 | echo "Starting svn checkout/update\n"; |
| 1087 | 1087 | if (!file_exists($config['checkoutdir'])) |
| 1088 | 1088 | { |
| 1089 | - mkdir($config['checkoutdir'],0755,true); |
|
| 1089 | + mkdir($config['checkoutdir'], 0755, true); |
|
| 1090 | 1090 | } |
| 1091 | 1091 | elseif (!is_dir($config['checkoutdir']) || !is_writable($config['checkoutdir'])) |
| 1092 | 1092 | { |
@@ -1101,17 +1101,17 @@ discard block |
||
| 1101 | 1101 | { |
| 1102 | 1102 | get_modules_per_repo(); |
| 1103 | 1103 | } |
| 1104 | - $config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name |
|
| 1104 | + $config['svntag'] = config_translate('svntag'); // in case svntag command did not run, translate tag name |
|
| 1105 | 1105 | |
| 1106 | 1106 | if (file_exists($config['aliasdir'])) |
| 1107 | 1107 | { |
| 1108 | - system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags |
|
| 1108 | + system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout, as we dont implement switching tags |
|
| 1109 | 1109 | clearstatcache(); |
| 1110 | 1110 | } |
| 1111 | - foreach($config['modules'] as $repo => $modules) |
|
| 1111 | + foreach ($config['modules'] as $repo => $modules) |
|
| 1112 | 1112 | { |
| 1113 | 1113 | $cmd = $svn.' co '; |
| 1114 | - foreach($modules as $path => $url) |
|
| 1114 | + foreach ($modules as $path => $url) |
|
| 1115 | 1115 | { |
| 1116 | 1116 | if ($path == $config['aliasdir']) |
| 1117 | 1117 | { |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | $cmd = $svn.' co '; |
| 1122 | 1122 | continue; |
| 1123 | 1123 | } |
| 1124 | - if(file_exists($config['aliasdir'])) |
|
| 1124 | + if (file_exists($config['aliasdir'])) |
|
| 1125 | 1125 | { |
| 1126 | 1126 | die("'egroupware' applications must be first one in externals!\n"); |
| 1127 | 1127 | } |
@@ -1139,16 +1139,16 @@ discard block |
||
| 1139 | 1139 | // check if correct branch |
| 1140 | 1140 | $cmd = 'LANG=C '.$svn.' info'; |
| 1141 | 1141 | $output = $ret = null; |
| 1142 | - exec($cmd,$output,$ret); |
|
| 1143 | - foreach($output as $line) |
|
| 1142 | + exec($cmd, $output, $ret); |
|
| 1143 | + foreach ($output as $line) |
|
| 1144 | 1144 | { |
| 1145 | - if ($ret || substr($line,0,5) == 'URL: ') |
|
| 1145 | + if ($ret || substr($line, 0, 5) == 'URL: ') |
|
| 1146 | 1146 | { |
| 1147 | - $url = substr($line,5); |
|
| 1148 | - if ($ret || substr($url,0,strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
| 1147 | + $url = substr($line, 5); |
|
| 1148 | + if ($ret || substr($url, 0, strlen($svnbranch)) != $svnbranch) // wrong branch (or no svn dir) |
|
| 1149 | 1149 | { |
| 1150 | 1150 | echo "Checkout is of wrong branch --> deleting it\n"; |
| 1151 | - system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
|
| 1151 | + system('/bin/rm -rf .svn '.$config['aliasdir']); // --> remove the whole checkout |
|
| 1152 | 1152 | clearstatcache(); |
| 1153 | 1153 | } |
| 1154 | 1154 | break; |
@@ -1160,10 +1160,10 @@ discard block |
||
| 1160 | 1160 | run_cmd($cmd); |
| 1161 | 1161 | |
| 1162 | 1162 | chdir($config['aliasdir']); |
| 1163 | - foreach($config['extra'] as $module) |
|
| 1163 | + foreach ($config['extra'] as $module) |
|
| 1164 | 1164 | { |
| 1165 | - $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
| 1166 | - $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
|
| 1165 | + $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
| 1166 | + $url = strpos($module, '://') === false ? $svnbranch.'/' : ''; |
|
| 1167 | 1167 | $url .= $module; |
| 1168 | 1168 | $cmd = $svn.' co '.$url; |
| 1169 | 1169 | run_cmd($cmd); |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | */ |
| 1189 | 1189 | function get_modules_per_svn_repo() |
| 1190 | 1190 | { |
| 1191 | - global $config,$svn,$verbose; |
|
| 1191 | + global $config, $svn, $verbose; |
|
| 1192 | 1192 | |
| 1193 | 1193 | // process alias/externals |
| 1194 | 1194 | $svnbranch = $config['svnbase'].'/'.$config['svnbranch']; |
@@ -1196,27 +1196,27 @@ discard block |
||
| 1196 | 1196 | $cmd = $svn.' propget svn:externals --strict '.$url; |
| 1197 | 1197 | if ($verbose) echo $cmd."\n"; |
| 1198 | 1198 | $output = $ret = null; |
| 1199 | - exec($cmd,$output,$ret); |
|
| 1199 | + exec($cmd, $output, $ret); |
|
| 1200 | 1200 | $config['modules'] = array(); |
| 1201 | - foreach($output as $line) |
|
| 1201 | + foreach ($output as $line) |
|
| 1202 | 1202 | { |
| 1203 | 1203 | $line = trim($line); |
| 1204 | 1204 | if (empty($line) || $line[0] == '#') continue; |
| 1205 | - list($path,$url) = preg_split('/[ \t\r\n]+/',$line); |
|
| 1205 | + list($path, $url) = preg_split('/[ \t\r\n]+/', $line); |
|
| 1206 | 1206 | $matches = null; |
| 1207 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
| 1207 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n"); |
|
| 1208 | 1208 | $repo = $matches[1]; |
| 1209 | 1209 | if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
| 1210 | 1210 | $config['modules'][$repo][$path] = $url; |
| 1211 | 1211 | } |
| 1212 | 1212 | // process extra modules |
| 1213 | - foreach($config['extra'] as $module) |
|
| 1213 | + foreach ($config['extra'] as $module) |
|
| 1214 | 1214 | { |
| 1215 | - $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
| 1216 | - $url = strpos($module,'://') === false ? $svnbranch.'/' : ''; |
|
| 1215 | + $module = config_translate(null, $module); // allow to use config vars like $svnbranch in module |
|
| 1216 | + $url = strpos($module, '://') === false ? $svnbranch.'/' : ''; |
|
| 1217 | 1217 | $url .= $module; |
| 1218 | - if (strpos($module,'://') !== false) $module = basename($module); |
|
| 1219 | - if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/',$url,$matches)) die("Invalid SVN URL: $url\n"); |
|
| 1218 | + if (strpos($module, '://') !== false) $module = basename($module); |
|
| 1219 | + if (!preg_match('/([a-z+]+:\/\/[a-z@.]+\/[a-z]+)\/(branches|tags|trunk)/', $url, $matches)) die("Invalid SVN URL: $url\n"); |
|
| 1220 | 1220 | $repo = $matches[1]; |
| 1221 | 1221 | if ($repo == 'http://svn.egroupware.org/egroupware') $repo = 'svn+ssh://[email protected]/egroupware'; |
| 1222 | 1222 | $config['modules'][$repo][$config['aliasdir'].'/'.$module] = $url; |
@@ -1230,11 +1230,11 @@ discard block |
||
| 1230 | 1230 | */ |
| 1231 | 1231 | function do_svntag() |
| 1232 | 1232 | { |
| 1233 | - global $config,$svn; |
|
| 1233 | + global $config, $svn; |
|
| 1234 | 1234 | |
| 1235 | - if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
| 1235 | + if (empty($config['svntag'])) return; // otherwise we copy everything in svn root! |
|
| 1236 | 1236 | |
| 1237 | - $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
|
| 1237 | + $config['svntag'] = config_translate('svntag'); // allow to use config vars like $version in tag |
|
| 1238 | 1238 | |
| 1239 | 1239 | echo "Creating SVN tag $config[svntag]\n"; |
| 1240 | 1240 | if (!isset($config['modules'])) |
@@ -1242,9 +1242,9 @@ discard block |
||
| 1242 | 1242 | get_modules_per_repo(); |
| 1243 | 1243 | } |
| 1244 | 1244 | // create tags (per repo) |
| 1245 | - foreach($config['modules'] as $repo => $modules) |
|
| 1245 | + foreach ($config['modules'] as $repo => $modules) |
|
| 1246 | 1246 | { |
| 1247 | - $cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ',$modules).' '.$repo.'/'.$config['svntag'].'/'; |
|
| 1247 | + $cmd = $svn.' cp --parents -m '.escapeshellarg('Creating '.$config['svntag']).' '.implode(' ', $modules).' '.$repo.'/'.$config['svntag'].'/'; |
|
| 1248 | 1248 | run_cmd($cmd); |
| 1249 | 1249 | } |
| 1250 | 1250 | } |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | * @param int|array $no_bailout =null exit code(s) to NOT bail out |
| 1258 | 1258 | * @return int exit code of $cmd |
| 1259 | 1259 | */ |
| 1260 | -function run_cmd($cmd,array &$output=null,$no_bailout=null) |
|
| 1260 | +function run_cmd($cmd, array &$output = null, $no_bailout = null) |
|
| 1261 | 1261 | { |
| 1262 | 1262 | global $verbose; |
| 1263 | 1263 | |
@@ -1265,18 +1265,18 @@ discard block |
||
| 1265 | 1265 | { |
| 1266 | 1266 | echo $cmd."\n"; |
| 1267 | 1267 | $ret = null; |
| 1268 | - system($cmd,$ret); |
|
| 1268 | + system($cmd, $ret); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | else |
| 1271 | 1271 | { |
| 1272 | 1272 | $output[] = $cmd; |
| 1273 | - exec($cmd,$output,$ret); |
|
| 1274 | - if ($verbose) echo implode("\n",$output)."\n"; |
|
| 1273 | + exec($cmd, $output, $ret); |
|
| 1274 | + if ($verbose) echo implode("\n", $output)."\n"; |
|
| 1275 | 1275 | } |
| 1276 | - if ($ret && !in_array($ret,(array)$no_bailout)) |
|
| 1276 | + if ($ret && !in_array($ret, (array)$no_bailout)) |
|
| 1277 | 1277 | { |
| 1278 | - if (!$verbose) echo implode("\n",$output)."\n"; |
|
| 1279 | - throw new Exception("Error during '$cmd' --> aborting",$ret); |
|
| 1278 | + if (!$verbose) echo implode("\n", $output)."\n"; |
|
| 1279 | + throw new Exception("Error during '$cmd' --> aborting", $ret); |
|
| 1280 | 1280 | } |
| 1281 | 1281 | return $ret; |
| 1282 | 1282 | } |
@@ -1303,7 +1303,7 @@ discard block |
||
| 1303 | 1303 | return 'NULL'; |
| 1304 | 1304 | case 'object': |
| 1305 | 1305 | case 'array': |
| 1306 | - return str_replace(array("\n",' '/*,'Array'*/),'',print_r($var,true)); |
|
| 1306 | + return str_replace(array("\n", ' '/*,'Array'*/), '', print_r($var, true)); |
|
| 1307 | 1307 | } |
| 1308 | 1308 | return 'UNKNOWN TYPE!'; |
| 1309 | 1309 | } |
@@ -1313,9 +1313,9 @@ discard block |
||
| 1313 | 1313 | * |
| 1314 | 1314 | * @param string $error =null optional error-message |
| 1315 | 1315 | */ |
| 1316 | -function usage($error=null) |
|
| 1316 | +function usage($error = null) |
|
| 1317 | 1317 | { |
| 1318 | - global $prog,$config,$verbose; |
|
| 1318 | + global $prog, $config, $verbose; |
|
| 1319 | 1319 | |
| 1320 | 1320 | echo "Usage: $prog [-h|--help] [-v|--verbose] [options, ...]\n\n"; |
| 1321 | 1321 | echo "options and their defaults:\n"; |
@@ -1325,12 +1325,12 @@ discard block |
||
| 1325 | 1325 | } |
| 1326 | 1326 | else |
| 1327 | 1327 | { |
| 1328 | - unset($config['modules']); // they give an error, because of nested array and are quite lengthy |
|
| 1328 | + unset($config['modules']); // they give an error, because of nested array and are quite lengthy |
|
| 1329 | 1329 | } |
| 1330 | - foreach($config as $name => $default) |
|
| 1330 | + foreach ($config as $name => $default) |
|
| 1331 | 1331 | { |
| 1332 | - if (is_array($default)) $default = json_encode ($default, JSON_UNESCAPED_SLASHES); |
|
| 1333 | - echo '--'.str_pad($name,20).$default."\n"; |
|
| 1332 | + if (is_array($default)) $default = json_encode($default, JSON_UNESCAPED_SLASHES); |
|
| 1333 | + echo '--'.str_pad($name, 20).$default."\n"; |
|
| 1334 | 1334 | } |
| 1335 | 1335 | if ($error) |
| 1336 | 1336 | { |
@@ -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 | { |
@@ -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, |
@@ -100,7 +103,10 @@ discard block |
||
| 100 | 103 | { |
| 101 | 104 | case 'suse': |
| 102 | 105 | // openSUSE 12.1+ no longer uses php5 |
| 103 | - if (file_exists('/usr/bin/php5')) $config['php'] = '/usr/bin/php5'; |
|
| 106 | + if (file_exists('/usr/bin/php5')) |
|
| 107 | + { |
|
| 108 | + $config['php'] = '/usr/bin/php5'; |
|
| 109 | + } |
|
| 104 | 110 | $config['start_db'] = '/sbin/service mysql'; |
| 105 | 111 | $config['autostart_db'] = '/sbin/chkconfig --level 345 mysql on'; |
| 106 | 112 | $config['start_webserver'] = '/sbin/service apache2'; |
@@ -145,9 +151,12 @@ discard block |
||
| 145 | 151 | // fall through |
| 146 | 152 | case 'rh': |
| 147 | 153 | // some MySQL packages (mysql.com, MariaDB, ...) use "mysql" as service name instead of RH default "mysqld" |
| 148 | - if (file_exists('/usr/bin/systemctl')) // RHEL 7 |
|
| 154 | + if (file_exists('/usr/bin/systemctl')) |
|
| 155 | + { |
|
| 156 | + // RHEL 7 |
|
| 149 | 157 | { |
| 150 | 158 | $config['start_db'] = '/usr/bin/systemctl %s mariadb'; |
| 159 | + } |
|
| 151 | 160 | $config['autostart_db'] = build_cmd('start_db', 'enable'); |
| 152 | 161 | $config['start_webserver'] = '/usr/bin/systemctl %s httpd'; |
| 153 | 162 | $config['autostart_webserver'] = build_cmd('start_webserver', 'enable'); |
@@ -176,11 +185,14 @@ discard block |
||
| 176 | 185 | while($config_set) |
| 177 | 186 | { |
| 178 | 187 | $val = array_shift($config_set); |
| 179 | - if (($quote = $val[0]) == "'" || $quote == '"') // arguments might be quoted with ' or " |
|
| 188 | + if (($quote = $val[0]) == "'" || $quote == '"') |
|
| 189 | + { |
|
| 190 | + // arguments might be quoted with ' or " |
|
| 180 | 191 | { |
| 181 | 192 | while (substr($val,-1) != $quote) |
| 182 | 193 | { |
| 183 | 194 | if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!'); |
| 195 | + } |
|
| 184 | 196 | $val .= ' '.array_shift($config_set); |
| 185 | 197 | } |
| 186 | 198 | $val = substr($val,1,-1); |
@@ -245,8 +257,11 @@ discard block |
||
| 245 | 257 | // basic config checks |
| 246 | 258 | foreach(array('php','source_dir','data_dir','setup-cli') as $name) |
| 247 | 259 | { |
| 248 | - if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!'); |
|
| 249 | -} |
|
| 260 | + if (!file_exists($config[$name])) |
|
| 261 | + { |
|
| 262 | + bail_out(1,$config[$name].' not found!'); |
|
| 263 | + } |
|
| 264 | + } |
|
| 250 | 265 | |
| 251 | 266 | // fix important php.ini and conf.d/*.ini settings |
| 252 | 267 | check_fix_php_apc_ini(); |
@@ -255,13 +270,16 @@ discard block |
||
| 255 | 270 | $setup_cli = $config['php'].' -d memory_limit=-1 '.$config['setup-cli']; |
| 256 | 271 | |
| 257 | 272 | // if we have a header, include it |
| 258 | -if (file_exists($config['header']) && filesize($config['header']) >= 200) // default header redirecting to setup is 147 bytes |
|
| 273 | +if (file_exists($config['header']) && filesize($config['header']) >= 200) |
|
| 274 | +{ |
|
| 275 | + // default header redirecting to setup is 147 bytes |
|
| 259 | 276 | { |
| 260 | 277 | $GLOBALS['egw_info'] = array( |
| 261 | 278 | 'flags' => array( |
| 262 | 279 | 'noapi' => true, |
| 263 | 280 | ) |
| 264 | 281 | ); |
| 282 | +} |
|
| 265 | 283 | include $config['header']; |
| 266 | 284 | |
| 267 | 285 | // get user from header and replace password, as we dont know it |
@@ -285,7 +303,10 @@ discard block |
||
| 285 | 303 | if ($ret) |
| 286 | 304 | { |
| 287 | 305 | system(build_cmd('start_db', 'start')); |
| 288 | - if (!empty($config['autostart_db'])) system($config['autostart_db']); |
|
| 306 | + if (!empty($config['autostart_db'])) |
|
| 307 | + { |
|
| 308 | + system($config['autostart_db']); |
|
| 309 | + } |
|
| 289 | 310 | } |
| 290 | 311 | } |
| 291 | 312 | // create database |
@@ -301,7 +322,10 @@ discard block |
||
| 301 | 322 | @list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3); |
| 302 | 323 | $extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']); |
| 303 | 324 | $extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type'])); |
| 304 | - if (empty($rest)) unset($config['account-auth']); |
|
| 325 | + if (empty($rest)) |
|
| 326 | + { |
|
| 327 | + unset($config['account-auth']); |
|
| 328 | + } |
|
| 305 | 329 | if ($config['account_repository'] == 'ldap' || $config['auth_type'] == 'ldap') |
| 306 | 330 | { |
| 307 | 331 | // set account_min_id to 1100 if not specified to NOT clash with system accounts |
@@ -361,7 +385,10 @@ discard block |
||
| 361 | 385 | $setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']); |
| 362 | 386 | foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name) |
| 363 | 387 | { |
| 364 | - if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
|
| 388 | + if (!empty($config[$name])) |
|
| 389 | + { |
|
| 390 | + $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
|
| 391 | + } |
|
| 365 | 392 | } |
| 366 | 393 | run_cmd($setup_mailserver); |
| 367 | 394 | |
@@ -377,7 +404,10 @@ discard block |
||
| 377 | 404 | if ($ret) |
| 378 | 405 | { |
| 379 | 406 | system(build_cmd('start_webserver', 'start')); |
| 380 | - if (!empty($config['autostart_webserver'])) system($config['autostart_webserver']); |
|
| 407 | + if (!empty($config['autostart_webserver'])) |
|
| 408 | + { |
|
| 409 | + system($config['autostart_webserver']); |
|
| 410 | + } |
|
| 381 | 411 | } |
| 382 | 412 | else |
| 383 | 413 | { |
@@ -422,10 +452,16 @@ discard block |
||
| 422 | 452 | $header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']); |
| 423 | 453 | run_cmd($header_update); |
| 424 | 454 | $ret = run_cmd($setup_update,$output,15); |
| 425 | - if ($ret != 15) break; |
|
| 455 | + if ($ret != 15) |
|
| 456 | + { |
|
| 457 | + break; |
|
| 458 | + } |
|
| 426 | 459 | // fall through |
| 427 | 460 | case 15: // missing configuration (eg. mailserver) |
| 428 | - if (!$verbose) echo implode("\n",(array)$output)."\n"; |
|
| 461 | + if (!$verbose) |
|
| 462 | + { |
|
| 463 | + echo implode("\n",(array)$output)."\n"; |
|
| 464 | + } |
|
| 429 | 465 | break; |
| 430 | 466 | |
| 431 | 467 | case 0: |
@@ -455,9 +491,15 @@ discard block |
||
| 455 | 491 | { |
| 456 | 492 | global $config; |
| 457 | 493 | |
| 458 | - if (isset($config[$cmd])) $cmd = $config[$cmd]; |
|
| 494 | + if (isset($config[$cmd])) |
|
| 495 | + { |
|
| 496 | + $cmd = $config[$cmd]; |
|
| 497 | + } |
|
| 459 | 498 | |
| 460 | - if (strpos($cmd, '%s')) return str_replace('%s', $arg, $cmd); |
|
| 499 | + if (strpos($cmd, '%s')) |
|
| 500 | + { |
|
| 501 | + return str_replace('%s', $arg, $cmd); |
|
| 502 | + } |
|
| 461 | 503 | |
| 462 | 504 | return $cmd.' '.$arg; |
| 463 | 505 | } |
@@ -526,7 +568,10 @@ discard block |
||
| 526 | 568 | */ |
| 527 | 569 | function bail_out($ret=1,$output=null) |
| 528 | 570 | { |
| 529 | - if ($output) echo implode("\n",(array)$output); |
|
| 571 | + if ($output) |
|
| 572 | + { |
|
| 573 | + echo implode("\n",(array)$output); |
|
| 574 | + } |
|
| 530 | 575 | echo "\n\nInstallation failed --> exiting!\n\n"; |
| 531 | 576 | exit($ret); |
| 532 | 577 | } |
@@ -569,7 +614,11 @@ discard block |
||
| 569 | 614 | echo "options and their defaults:\n"; |
| 570 | 615 | foreach($config as $name => $default) |
| 571 | 616 | { |
| 572 | - if (in_array($name, array('postfix','cyrus'))) continue; // do NOT report deprecated options |
|
| 617 | + if (in_array($name, array('postfix','cyrus'))) |
|
| 618 | + { |
|
| 619 | + continue; |
|
| 620 | + } |
|
| 621 | + // do NOT report deprecated options |
|
| 573 | 622 | if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16) |
| 574 | 623 | { |
| 575 | 624 | $default = '<16 char random string>'; |
@@ -662,7 +711,10 @@ discard block |
||
| 662 | 711 | // only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' && |
| 663 | 712 | ($domains=_ucr_get('mail/hosteddomains'))) |
| 664 | 713 | { |
| 665 | - if (!is_array($domains)) $domains = explode("\n", $domains); |
|
| 714 | + if (!is_array($domains)) |
|
| 715 | + { |
|
| 716 | + $domains = explode("\n", $domains); |
|
| 717 | + } |
|
| 666 | 718 | $domain = array_shift($domains); |
| 667 | 719 | // set "use auth with session credentials",tls,"not user editable","further identities" |
| 668 | 720 | $config['smtpserver'] = "$mailserver,465,,,yes,tls,no,yes"; |
@@ -672,13 +724,19 @@ discard block |
||
| 672 | 724 | { |
| 673 | 725 | $config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',Imap\\Dovecot'; |
| 674 | 726 | // default with sieve port to 4190, as config is only available on host mailserver app is installed |
| 675 | - if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port'))) $sieve_port = 4190; |
|
| 727 | + if (!($sieve_port = _ucr_get('mail/dovecot/sieve/port'))) |
|
| 728 | + { |
|
| 729 | + $sieve_port = 4190; |
|
| 730 | + } |
|
| 676 | 731 | } |
| 677 | 732 | else |
| 678 | 733 | { |
| 679 | 734 | $config['imap'] = /*'cyrus,'._ucr_secret('cyrus')*/','.',Imap\\Cyrus'; |
| 680 | 735 | // default with sieve port to 4190, as config is only available on host mailserver app is installed |
| 681 | - if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) $sieve_port = 4190; |
|
| 736 | + if (!($sieve_port = _ucr_get('mail/cyrus/sieve/port'))) |
|
| 737 | + { |
|
| 738 | + $sieve_port = 4190; |
|
| 739 | + } |
|
| 682 | 740 | } |
| 683 | 741 | // set folders so mail creates them on first login, UCS does not automatic |
| 684 | 742 | $config['folder'] = 'INBOX/Sent,INBOX/Trash,INBOX/Drafts,INBOX/Templates,INBOX/Spam'; |
@@ -743,7 +801,10 @@ discard block |
||
| 743 | 801 | $shm_size = ini_get('apc.shm_size'); |
| 744 | 802 | $shm_segments = ini_get('apc.shm_segments'); |
| 745 | 803 | // ancent APC (3.1.3) in Debian 6/Squezze has size in MB without a unit |
| 746 | - if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576)) $shm_size .= 'M'; |
|
| 804 | + if (($numeric_size = is_numeric($shm_size) && $shm_size <= 1048576)) |
|
| 805 | + { |
|
| 806 | + $shm_size .= 'M'; |
|
| 807 | + } |
|
| 747 | 808 | |
| 748 | 809 | $size = _size_with_unit($shm_size) * $shm_segments; |
| 749 | 810 | //echo "shm_size=$shm_size, shm_segments=$shm_segments --> $size, numeric_size=$numeric_size\n"; |
@@ -759,7 +820,10 @@ discard block |
||
| 759 | 820 | file_exists($path = $matches[1]) && ($apc_ini = file_get_contents($path))) |
| 760 | 821 | { |
| 761 | 822 | $new_shm_size = 128 / $shm_segments; |
| 762 | - if (!$numeric_size) $new_shm_size .= 'M'; |
|
| 823 | + if (!$numeric_size) |
|
| 824 | + { |
|
| 825 | + $new_shm_size .= 'M'; |
|
| 826 | + } |
|
| 763 | 827 | if (preg_match('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', $apc_ini)) |
| 764 | 828 | { |
| 765 | 829 | file_put_contents($path, preg_replace('|^apc.shm_size\s*=\s*(\d+[KMG]?)$|m', 'apc.shm_size='.$new_shm_size, $apc_ini)); |
@@ -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,23 +56,23 @@ 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 | 'php5enmod' => '', |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | // read language from LANG enviroment variable |
| 72 | 72 | if (($lang = isset($_ENV['LANG']) ? $_ENV['LANG'] : (isset($_SERVER['LANG']) ? $_SERVER['LANG'] : null))) |
| 73 | 73 | { |
| 74 | - @list($lang,$nat) = preg_split('/[_.]/',$lang); |
|
| 75 | - if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw'))) |
|
| 74 | + @list($lang, $nat) = preg_split('/[_.]/', $lang); |
|
| 75 | + if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw'))) |
|
| 76 | 76 | { |
| 77 | 77 | $lang .= '-'.strtolower($nat); |
| 78 | 78 | } |
@@ -85,16 +85,13 @@ discard block |
||
| 85 | 85 | * |
| 86 | 86 | * @param string $distro =null default autodetect |
| 87 | 87 | */ |
| 88 | -function set_distro_defaults($distro=null) |
|
| 88 | +function set_distro_defaults($distro = null) |
|
| 89 | 89 | { |
| 90 | 90 | global $config; |
| 91 | 91 | if (is_null($distro)) |
| 92 | 92 | { |
| 93 | - $distro = file_exists('/etc/SuSE-release') ? 'suse' : |
|
| 94 | - (file_exists('/etc/mandriva-release') ? 'mandriva' : |
|
| 95 | - (file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi', |
|
| 96 | - file_get_contents('/etc/lsb-release')) ? 'univention' : |
|
| 97 | - (file_exists('/etc/debian_version') ? 'debian' : 'rh'))); |
|
| 93 | + $distro = file_exists('/etc/SuSE-release') ? 'suse' : (file_exists('/etc/mandriva-release') ? 'mandriva' : (file_exists('/etc/lsb-release') && preg_match('/^DISTRIB_ID="?Univention"?$/mi', |
|
| 94 | + file_get_contents('/etc/lsb-release')) ? 'univention' : (file_exists('/etc/debian_version') ? 'debian' : 'rh'))); |
|
| 98 | 95 | } |
| 99 | 96 | switch (($config['distro'] = $distro)) |
| 100 | 97 | { |
@@ -154,9 +151,9 @@ discard block |
||
| 154 | 151 | } |
| 155 | 152 | elseif (!file_exists('/etc/init.d/mysqld') && file_exists('/etc/init.d/mysql')) |
| 156 | 153 | { |
| 157 | - foreach(array('start_db','autostart_db') as $name) |
|
| 154 | + foreach (array('start_db', 'autostart_db') as $name) |
|
| 158 | 155 | { |
| 159 | - $config[$name] = str_replace('mysqld','mysql',$config[$name]); |
|
| 156 | + $config[$name] = str_replace('mysqld', 'mysql', $config[$name]); |
|
| 160 | 157 | } |
| 161 | 158 | } |
| 162 | 159 | break; |
@@ -172,48 +169,48 @@ discard block |
||
| 172 | 169 | if (($config_set = isset($_ENV['EGW_POST_INSTALL']) ? $_ENV['EGW_POST_INSTALL'] : @$_SERVER['EGW_POST_INSTALL'])) |
| 173 | 170 | { |
| 174 | 171 | $conf = array(); |
| 175 | - $config_set = preg_split('/[ \t]+/',trim($config_set)); |
|
| 176 | - while($config_set) |
|
| 172 | + $config_set = preg_split('/[ \t]+/', trim($config_set)); |
|
| 173 | + while ($config_set) |
|
| 177 | 174 | { |
| 178 | 175 | $val = array_shift($config_set); |
| 179 | 176 | if (($quote = $val[0]) == "'" || $quote == '"') // arguments might be quoted with ' or " |
| 180 | 177 | { |
| 181 | - while (substr($val,-1) != $quote) |
|
| 178 | + while (substr($val, -1) != $quote) |
|
| 182 | 179 | { |
| 183 | 180 | if (!$config_set) throw new Exception('Invalid EGW_POST_INSTALL enviroment variable!'); |
| 184 | 181 | $val .= ' '.array_shift($config_set); |
| 185 | 182 | } |
| 186 | - $val = substr($val,1,-1); |
|
| 183 | + $val = substr($val, 1, -1); |
|
| 187 | 184 | } |
| 188 | 185 | $conf[] = $val; |
| 189 | 186 | } |
| 190 | - $argv = array_merge($conf,$argv); |
|
| 187 | + $argv = array_merge($conf, $argv); |
|
| 191 | 188 | } |
| 192 | 189 | |
| 193 | 190 | $auth_type_given = false; |
| 194 | -while(($arg = array_shift($argv))) |
|
| 191 | +while (($arg = array_shift($argv))) |
|
| 195 | 192 | { |
| 196 | 193 | if ($arg == '-v' || $arg == '--verbose') |
| 197 | 194 | { |
| 198 | 195 | $verbose = true; |
| 199 | 196 | } |
| 200 | - elseif($arg == '-h' || $arg == '--help') |
|
| 197 | + elseif ($arg == '-h' || $arg == '--help') |
|
| 201 | 198 | { |
| 202 | 199 | usage(); |
| 203 | 200 | } |
| 204 | - elseif($arg == '--suse') |
|
| 201 | + elseif ($arg == '--suse') |
|
| 205 | 202 | { |
| 206 | 203 | set_distro_defaults('suse'); |
| 207 | 204 | } |
| 208 | - elseif($arg == '--distro') |
|
| 205 | + elseif ($arg == '--distro') |
|
| 209 | 206 | { |
| 210 | 207 | set_distro_defaults(array_shift($argv)); |
| 211 | 208 | } |
| 212 | - elseif(substr($arg,0,2) == '--' && isset($config[$name=substr($arg,2)])) |
|
| 209 | + elseif (substr($arg, 0, 2) == '--' && isset($config[$name = substr($arg, 2)])) |
|
| 213 | 210 | { |
| 214 | 211 | $config[$name] = array_shift($argv); |
| 215 | 212 | |
| 216 | - switch($name) |
|
| 213 | + switch ($name) |
|
| 217 | 214 | { |
| 218 | 215 | case 'auth_type': |
| 219 | 216 | $auth_type_given = true; |
@@ -234,18 +231,18 @@ discard block |
||
| 234 | 231 | } |
| 235 | 232 | |
| 236 | 233 | $replace = array(); |
| 237 | -foreach($config as $name => $value) |
|
| 234 | +foreach ($config as $name => $value) |
|
| 238 | 235 | { |
| 239 | 236 | $replace['$'.$name] = $value; |
| 240 | - if (strpos($value,'$') !== false) |
|
| 237 | + if (strpos($value, '$') !== false) |
|
| 241 | 238 | { |
| 242 | - $config[$name] = strtr($value,$replace); |
|
| 239 | + $config[$name] = strtr($value, $replace); |
|
| 243 | 240 | } |
| 244 | 241 | } |
| 245 | 242 | // basic config checks |
| 246 | -foreach(array('php','source_dir','data_dir','setup-cli') as $name) |
|
| 243 | +foreach (array('php', 'source_dir', 'data_dir', 'setup-cli') as $name) |
|
| 247 | 244 | { |
| 248 | - if (!file_exists($config[$name])) bail_out(1,$config[$name].' not found!'); |
|
| 245 | + if (!file_exists($config[$name])) bail_out(1, $config[$name].' not found!'); |
|
| 249 | 246 | } |
| 250 | 247 | |
| 251 | 248 | // fix important php.ini and conf.d/*.ini settings |
@@ -260,13 +257,13 @@ discard block |
||
| 260 | 257 | $GLOBALS['egw_info'] = array( |
| 261 | 258 | 'flags' => array( |
| 262 | 259 | 'noapi' => true, |
| 263 | - 'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header |
|
| 260 | + 'currentapp' => 'login', // stop PHP Notice: Undefined index "currentapp" in pre 16.1 header |
|
| 264 | 261 | ) |
| 265 | 262 | ); |
| 266 | 263 | include $config['header']; |
| 267 | 264 | |
| 268 | 265 | // get user from header and replace password, as we dont know it |
| 269 | - $old_password = patch_header($config['header'],$config['config_user'],$config['config_passwd']); |
|
| 266 | + $old_password = patch_header($config['header'], $config['config_user'], $config['config_passwd']); |
|
| 270 | 267 | // register a shutdown function to put old password back in any case |
| 271 | 268 | register_shutdown_function(function() use (&$config, $old_password) |
| 272 | 269 | { |
@@ -274,7 +271,7 @@ discard block |
||
| 274 | 271 | }); |
| 275 | 272 | } |
| 276 | 273 | // new header or does not include requested domain (!= "default") --> new install |
| 277 | -if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']])) |
|
| 274 | +if (!isset($GLOBALS['egw_domain']) || $config['domain'] !== 'default' && !isset($GLOBALS['egw_domain'][$config['domain']])) |
|
| 278 | 275 | { |
| 279 | 276 | // --> new install |
| 280 | 277 | $extra_config = ''; |
@@ -291,7 +288,7 @@ discard block |
||
| 291 | 288 | } |
| 292 | 289 | // create database |
| 293 | 290 | $setup_db = $setup_cli.' --setup-cmd-database sub_command=create_db'; |
| 294 | - 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) |
|
| 291 | + 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 | 292 | { |
| 296 | 293 | $setup_db .= ' '.escapeshellarg($name.'='.$config[$name]); |
| 297 | 294 | } |
@@ -299,7 +296,7 @@ discard block |
||
| 299 | 296 | |
| 300 | 297 | // check if ldap is required and initialise it |
| 301 | 298 | // we need to specify account_repository and auth_type to --install as extra config, otherwise install happens for sql! |
| 302 | - @list($config['account_repository'],$config['auth_type'],$rest) = explode(',',$config['account-auth'],3); |
|
| 299 | + @list($config['account_repository'], $config['auth_type'], $rest) = explode(',', $config['account-auth'], 3); |
|
| 303 | 300 | $extra_config .= ' '.escapeshellarg('account_repository='.$config['account_repository']); |
| 304 | 301 | $extra_config .= ' '.escapeshellarg('auth_type='.(empty($config['auth_type']) ? $config['account_repository'] : $config['auth_type'])); |
| 305 | 302 | if (empty($rest)) unset($config['account-auth']); |
@@ -310,15 +307,15 @@ discard block |
||
| 310 | 307 | |
| 311 | 308 | $setup_ldap = $setup_cli.' --setup-cmd-ldap sub_command='. |
| 312 | 309 | ($config['account_repository'] == 'ldap' ? 'create_ldap' : 'test_ldap'); |
| 313 | - foreach(array( |
|
| 314 | - 'domain','ldap_suffix','ldap_host','ldap_admin','ldap_admin_pw', // non-egw params: only used for create |
|
| 315 | - 'ldap_base','ldap_root_dn','ldap_root_pw','ldap_context','ldap_search_filter','ldap_group_context', // egw params |
|
| 310 | + foreach (array( |
|
| 311 | + 'domain', 'ldap_suffix', 'ldap_host', 'ldap_admin', 'ldap_admin_pw', // non-egw params: only used for create |
|
| 312 | + 'ldap_base', 'ldap_root_dn', 'ldap_root_pw', 'ldap_context', 'ldap_search_filter', 'ldap_group_context', // egw params |
|
| 316 | 313 | 'ldap_encryption_type', 'sambaadmin/sambasid', |
| 317 | 314 | ) as $name) |
| 318 | 315 | { |
| 319 | - if (strpos($value=$config[$name],'$') !== false) |
|
| 316 | + if (strpos($value = $config[$name], '$') !== false) |
|
| 320 | 317 | { |
| 321 | - $config[$name] = $value = strtr($value,array( |
|
| 318 | + $config[$name] = $value = strtr($value, array( |
|
| 322 | 319 | '$suffix' => $config['ldap_suffix'], |
| 323 | 320 | '$base' => $config['ldap_base'], |
| 324 | 321 | '$admin_pw' => $config['ldap_admin_pw'], |
@@ -326,7 +323,7 @@ discard block |
||
| 326 | 323 | } |
| 327 | 324 | $setup_ldap .= ' '.escapeshellarg($name.'='.$value); |
| 328 | 325 | |
| 329 | - if (!in_array($name,array('domain','ldap_suffix','ldap_admin','ldap_admin_pw'))) |
|
| 326 | + if (!in_array($name, array('domain', 'ldap_suffix', 'ldap_admin', 'ldap_admin_pw'))) |
|
| 330 | 327 | { |
| 331 | 328 | $extra_config .= ' '.escapeshellarg($name.'='.$value); |
| 332 | 329 | } |
@@ -360,7 +357,7 @@ discard block |
||
| 360 | 357 | } |
| 361 | 358 | // create mailserver config (fmail requires at least minimal config given as default, otherwise fatal error) |
| 362 | 359 | $setup_mailserver = $setup_cli.' --config '.escapeshellarg($config['domain'].','.$config['config_user'].','.$config['config_passwd']); |
| 363 | - foreach(array('account-auth','smtpserver','smtp','postfix','mailserver','imap','cyrus','sieve','folder') as $name) |
|
| 360 | + foreach (array('account-auth', 'smtpserver', 'smtp', 'postfix', 'mailserver', 'imap', 'cyrus', 'sieve', 'folder') as $name) |
|
| 364 | 361 | { |
| 365 | 362 | if (!empty($config[$name])) $setup_mailserver .= ' --'.$name.' '.escapeshellarg($config[$name]); |
| 366 | 363 | } |
@@ -374,7 +371,7 @@ discard block |
||
| 374 | 371 | // check if webserver is started and start it (permanent) if not |
| 375 | 372 | if ($config['start_webserver']) |
| 376 | 373 | { |
| 377 | - exec(build_cmd('start_webserver', 'status'),$dummy,$ret); |
|
| 374 | + exec(build_cmd('start_webserver', 'status'), $dummy, $ret); |
|
| 378 | 375 | if ($ret) |
| 379 | 376 | { |
| 380 | 377 | system(build_cmd('start_webserver', 'start')); |
@@ -416,18 +413,18 @@ discard block |
||
| 416 | 413 | // update egroupware, or single app(s), in later case skip backup |
| 417 | 414 | $setup_update = $setup_cli.' --update '.escapeshellarg('all,'.$config['config_user'].','.$config['config_passwd']. |
| 418 | 415 | (empty($config['install-update-app']) ? '' : ',no,'.$config['install-update-app'])); |
| 419 | - $ret = run_cmd($setup_update,$output,array(4,15)); |
|
| 416 | + $ret = run_cmd($setup_update, $output, array(4, 15)); |
|
| 420 | 417 | |
| 421 | - switch($ret) |
|
| 418 | + switch ($ret) |
|
| 422 | 419 | { |
| 423 | 420 | case 4: // header needs an update |
| 424 | 421 | $header_update = $setup_cli.' --update-header '.escapeshellarg($config['config_passwd'].','.$config['config_user']); |
| 425 | 422 | run_cmd($header_update); |
| 426 | - $ret = run_cmd($setup_update,$output,15); |
|
| 423 | + $ret = run_cmd($setup_update, $output, 15); |
|
| 427 | 424 | if ($ret != 15) break; |
| 428 | 425 | // fall through |
| 429 | 426 | case 15: // missing configuration (eg. mailserver) |
| 430 | - if (!$verbose) echo implode("\n",(array)$output)."\n"; |
|
| 427 | + if (!$verbose) echo implode("\n", (array)$output)."\n"; |
|
| 431 | 428 | break; |
| 432 | 429 | |
| 433 | 430 | case 0: |
@@ -472,18 +469,18 @@ discard block |
||
| 472 | 469 | * @param string $password new password |
| 473 | 470 | * @return string old password |
| 474 | 471 | */ |
| 475 | -function patch_header($filename,&$user,$password) |
|
| 472 | +function patch_header($filename, &$user, $password) |
|
| 476 | 473 | { |
| 477 | 474 | $header = file_get_contents($filename); |
| 478 | 475 | |
| 479 | 476 | $umatches = $pmatches = null; |
| 480 | - if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m",$header,$umatches) || |
|
| 481 | - !preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m",$header,$pmatches)) |
|
| 477 | + if (!preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_user'] = '", '/')."([^']+)';/m", $header, $umatches) || |
|
| 478 | + !preg_match('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", $header, $pmatches)) |
|
| 482 | 479 | { |
| 483 | - bail_out(99,"$filename is no regular EGroupware header.inc.php!"); |
|
| 480 | + bail_out(99, "$filename is no regular EGroupware header.inc.php!"); |
|
| 484 | 481 | } |
| 485 | - file_put_contents($filename,preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", |
|
| 486 | - "\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';",$header)); |
|
| 482 | + file_put_contents($filename, preg_replace('/'.preg_quote("\$GLOBALS['egw_info']['server']['header_admin_password'] = '", '/')."([^']*)';/m", |
|
| 483 | + "\$GLOBALS['egw_info']['server']['header_admin_password'] = '".$password."';", $header)); |
|
| 487 | 484 | |
| 488 | 485 | $user = $umatches[1]; |
| 489 | 486 | |
@@ -498,7 +495,7 @@ discard block |
||
| 498 | 495 | * @param int|array|true $no_bailout =null exit code(s) to NOT bail out, or true to never bail out |
| 499 | 496 | * @return int exit code of $cmd |
| 500 | 497 | */ |
| 501 | -function run_cmd($cmd,array &$output=null,$no_bailout=null) |
|
| 498 | +function run_cmd($cmd, array &$output = null, $no_bailout = null) |
|
| 502 | 499 | { |
| 503 | 500 | global $verbose; |
| 504 | 501 | |
@@ -506,16 +503,16 @@ discard block |
||
| 506 | 503 | { |
| 507 | 504 | echo $cmd."\n"; |
| 508 | 505 | $ret = null; |
| 509 | - system($cmd,$ret); |
|
| 506 | + system($cmd, $ret); |
|
| 510 | 507 | } |
| 511 | 508 | else |
| 512 | 509 | { |
| 513 | 510 | $output[] = $cmd; |
| 514 | - exec($cmd,$output,$ret); |
|
| 511 | + exec($cmd, $output, $ret); |
|
| 515 | 512 | } |
| 516 | - if ($ret && $no_bailout !== true && !in_array($ret,(array)$no_bailout)) |
|
| 513 | + if ($ret && $no_bailout !== true && !in_array($ret, (array)$no_bailout)) |
|
| 517 | 514 | { |
| 518 | - bail_out($ret,$verbose?null:$output); |
|
| 515 | + bail_out($ret, $verbose ? null : $output); |
|
| 519 | 516 | } |
| 520 | 517 | return $ret; |
| 521 | 518 | } |
@@ -526,9 +523,9 @@ discard block |
||
| 526 | 523 | * @param int $ret =1 |
| 527 | 524 | * @param array|string $output line(s) to output before temination notice |
| 528 | 525 | */ |
| 529 | -function bail_out($ret=1,$output=null) |
|
| 526 | +function bail_out($ret = 1, $output = null) |
|
| 530 | 527 | { |
| 531 | - if ($output) echo implode("\n",(array)$output); |
|
| 528 | + if ($output) echo implode("\n", (array)$output); |
|
| 532 | 529 | echo "\n\nInstallation failed --> exiting!\n\n"; |
| 533 | 530 | exit($ret); |
| 534 | 531 | } |
@@ -539,21 +536,21 @@ discard block |
||
| 539 | 536 | * @param int $len =16 |
| 540 | 537 | * @return string |
| 541 | 538 | */ |
| 542 | -function randomstring($len=16) |
|
| 539 | +function randomstring($len = 16) |
|
| 543 | 540 | { |
| 544 | 541 | static $usedchars = array( |
| 545 | - '0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f', |
|
| 546 | - 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v', |
|
| 547 | - 'w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L', |
|
| 548 | - 'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z', |
|
| 549 | - '@','!','%','&','(',')','=','?',';',':','#','_','-','<', |
|
| 550 | - '>','|','[',']','}', // dont add /\,'"{ as we have problems dealing with them |
|
| 542 | + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', |
|
| 543 | + 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', |
|
| 544 | + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', |
|
| 545 | + 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', |
|
| 546 | + '@', '!', '%', '&', '(', ')', '=', '?', ';', ':', '#', '_', '-', '<', |
|
| 547 | + '>', '|', '[', ']', '}', // dont add /\,'"{ as we have problems dealing with them |
|
| 551 | 548 | ); |
| 552 | 549 | |
| 553 | 550 | $str = ''; |
| 554 | - for($i=0; $i < $len; $i++) |
|
| 551 | + for ($i = 0; $i < $len; $i++) |
|
| 555 | 552 | { |
| 556 | - $str .= $usedchars[mt_rand(0,count($usedchars)-1)]; |
|
| 553 | + $str .= $usedchars[mt_rand(0, count($usedchars) - 1)]; |
|
| 557 | 554 | } |
| 558 | 555 | return $str; |
| 559 | 556 | } |
@@ -563,20 +560,20 @@ discard block |
||
| 563 | 560 | * |
| 564 | 561 | * @param string $error =null optional error-message |
| 565 | 562 | */ |
| 566 | -function usage($error=null) |
|
| 563 | +function usage($error = null) |
|
| 567 | 564 | { |
| 568 | - global $prog,$config; |
|
| 565 | + global $prog, $config; |
|
| 569 | 566 | |
| 570 | 567 | echo "Usage: $prog [-h|--help] [-v|--verbose] [--distro=(suse|rh|debian)] [options, ...]\n\n"; |
| 571 | 568 | echo "options and their defaults:\n"; |
| 572 | - foreach($config as $name => $default) |
|
| 569 | + foreach ($config as $name => $default) |
|
| 573 | 570 | { |
| 574 | - if (in_array($name, array('postfix','cyrus'))) continue; // do NOT report deprecated options |
|
| 575 | - if (in_array($name,array('config_passwd','db_pass','admin_passwd','ldap_root_pw')) && strlen($config[$name]) == 16) |
|
| 571 | + if (in_array($name, array('postfix', 'cyrus'))) continue; // do NOT report deprecated options |
|
| 572 | + if (in_array($name, array('config_passwd', 'db_pass', 'admin_passwd', 'ldap_root_pw')) && strlen($config[$name]) == 16) |
|
| 576 | 573 | { |
| 577 | 574 | $default = '<16 char random string>'; |
| 578 | 575 | } |
| 579 | - echo '--'.str_pad($name,20).$default."\n"; |
|
| 576 | + echo '--'.str_pad($name, 20).$default."\n"; |
|
| 580 | 577 | } |
| 581 | 578 | if ($error) |
| 582 | 579 | { |
@@ -626,8 +623,8 @@ discard block |
||
| 626 | 623 | $config['distro'] = 'univention'; |
| 627 | 624 | |
| 628 | 625 | // set lang from ucr locale, as cloud-config at least never has anything but EN set in enviroment |
| 629 | - @list($lang,$nat) = preg_split('/[_.]/', _ucr_get('locale/default')); |
|
| 630 | - if (in_array($lang.'-'.strtolower($nat),array('es-es','pt-br','zh-tw'))) |
|
| 626 | + @list($lang, $nat) = preg_split('/[_.]/', _ucr_get('locale/default')); |
|
| 627 | + if (in_array($lang.'-'.strtolower($nat), array('es-es', 'pt-br', 'zh-tw'))) |
|
| 631 | 628 | { |
| 632 | 629 | $lang .= '-'.strtolower($nat); |
| 633 | 630 | } |
@@ -652,7 +649,7 @@ discard block |
||
| 652 | 649 | // ldap password hash (our default blowfish_crypt seems not to work) |
| 653 | 650 | $config['ldap_encryption_type'] = 'sha512_crypt'; |
| 654 | 651 | |
| 655 | - $config['account_min_id'] = 1200; // UCS use 11xx for internal users/groups |
|
| 652 | + $config['account_min_id'] = 1200; // UCS use 11xx for internal users/groups |
|
| 656 | 653 | |
| 657 | 654 | $config['account-auth'] = 'univention,ldap'; |
| 658 | 655 | |
@@ -662,7 +659,7 @@ discard block |
||
| 662 | 659 | // mailserver, see setup-cli.php --help config |
| 663 | 660 | if (($mailserver = exec('/usr/bin/univention-ldapsearch -x "(univentionAppID=mailserver_*)" univentionAppInstalledOnServer|sed -n "s/univentionAppInstalledOnServer: \(.*\)/\1/p"')) && |
| 664 | 661 | // only set on host mailserver app is installed: _ucr_get('mail/cyrus/imap') == 'yes' && |
| 665 | - ($domains=_ucr_get('mail/hosteddomains'))) |
|
| 662 | + ($domains = _ucr_get('mail/hosteddomains'))) |
|
| 666 | 663 | { |
| 667 | 664 | if (!is_array($domains)) $domains = explode("\n", $domains); |
| 668 | 665 | $domain = array_shift($domains); |
@@ -702,12 +699,12 @@ discard block |
||
| 702 | 699 | */ |
| 703 | 700 | function _ucr_get($name) |
| 704 | 701 | { |
| 705 | - static $values=null; |
|
| 702 | + static $values = null; |
|
| 706 | 703 | if (!isset($values)) |
| 707 | 704 | { |
| 708 | 705 | $output = $matches = null; |
| 709 | 706 | exec('/usr/sbin/ucr dump', $output); |
| 710 | - foreach($output as $line) |
|
| 707 | + foreach ($output as $line) |
|
| 711 | 708 | { |
| 712 | 709 | if (preg_match("/^([^:]+): (.*)\n?$/", $line, $matches)) |
| 713 | 710 | { |
@@ -783,7 +780,7 @@ discard block |
||
| 783 | 780 | */ |
| 784 | 781 | function _size_with_unit($size) |
| 785 | 782 | { |
| 786 | - switch(strtoupper(substr($size, -1))) |
|
| 783 | + switch (strtoupper(substr($size, -1))) |
|
| 787 | 784 | { |
| 788 | 785 | case 'G': |
| 789 | 786 | $size *= 1024; |
@@ -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 | { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ); |
| 106 | 106 | if ($location == 'admin') |
| 107 | 107 | { |
| 108 | - display_section(self::$appname,$file); |
|
| 108 | + display_section(self::$appname,$file); |
|
| 109 | 109 | } |
| 110 | 110 | else |
| 111 | 111 | { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | 'yes' => lang('Yes') |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | - $settings = array( |
|
| 131 | + $settings = array( |
|
| 132 | 132 | 'startfolder' => array( |
| 133 | 133 | 'type' => 'input', |
| 134 | 134 | 'name' => 'startfolder', |
@@ -464,7 +464,7 @@ |
||
| 464 | 464 | { |
| 465 | 465 | unset($args); // unused, but required by function signature |
| 466 | 466 | $appname = 'preferences'; |
| 467 | - $file = Array( |
|
| 467 | + $file = array( |
|
| 468 | 468 | 'Site configuration' => Egw::link('/index.php','menuaction=admin.admin_config.index&appname=' . $appname.'&ajax=true'), |
| 469 | 469 | ); |
| 470 | 470 | display_section($appname, $file); |
@@ -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'), |
@@ -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.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.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 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'type' => 'select', |
| 151 | 151 | 'name' => 'showhome', |
| 152 | 152 | 'values' => $yes_no, |
| 153 | - 'label' => lang('Show link "%1" in side box menu?',lang('Your home directory')), |
|
| 153 | + 'label' => lang('Show link "%1" in side box menu?', lang('Your home directory')), |
|
| 154 | 154 | 'xmlrpc' => True, |
| 155 | 155 | 'admin' => False, |
| 156 | 156 | 'forced' => 'yes', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | 'type' => 'select', |
| 160 | 160 | 'name' => 'showusers', |
| 161 | 161 | 'values' => $yes_no, |
| 162 | - 'label' => lang('Show link "%1" in side box menu?',lang('Users and groups')), |
|
| 162 | + 'label' => lang('Show link "%1" in side box menu?', lang('Users and groups')), |
|
| 163 | 163 | 'xmlrpc' => True, |
| 164 | 164 | 'admin' => False, |
| 165 | 165 | 'forced' => 'yes', |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | 'size' => 60, |
| 172 | 172 | 'label' => 'Default document to insert entries', |
| 173 | 173 | 'name' => 'default_document', |
| 174 | - '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')).' '. |
|
| 174 | + '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')).' '. |
|
| 175 | 175 | lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'name').' '. |
| 176 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
| 176 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
| 177 | 177 | 'run_lang' => false, |
| 178 | 178 | 'xmlrpc' => True, |
| 179 | 179 | 'admin' => False, |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | 'label' => 'Directory with documents to insert entries', |
| 185 | 185 | 'name' => 'document_dir', |
| 186 | 186 | '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')).' '. |
| 187 | - lang('The document can contain placeholder like {{%1}}, to be replaced with the data.','name').' '. |
|
| 188 | - lang('The following document-types are supported:'). implode(',',Api\Storage\Merge::get_file_extensions()), |
|
| 187 | + lang('The document can contain placeholder like {{%1}}, to be replaced with the data.', 'name').' '. |
|
| 188 | + lang('The following document-types are supported:').implode(',', Api\Storage\Merge::get_file_extensions()), |
|
| 189 | 189 | 'run_lang' => false, |
| 190 | 190 | 'xmlrpc' => True, |
| 191 | 191 | 'admin' => False, |
@@ -127,8 +127,7 @@ |
||
| 127 | 127 | /** |
| 128 | 128 | * Show files shared |
| 129 | 129 | * |
| 130 | - * @param array $content=null |
|
| 131 | - * @param string $msg='' |
|
| 130 | + * @param array $content |
|
| 132 | 131 | */ |
| 133 | 132 | public function index(array $content=null) |
| 134 | 133 | { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $readonlys = null; |
| 90 | 90 | $total = Sharing::so()->get_rows($query, $rows, $readonlys); |
| 91 | 91 | |
| 92 | - foreach($rows as &$row) |
|
| 92 | + foreach ($rows as &$row) |
|
| 93 | 93 | { |
| 94 | 94 | if (substr($row['share_path'], 0, strlen(self::$tmp_dir)) === self::$tmp_dir) |
| 95 | 95 | { |
@@ -130,21 +130,21 @@ discard block |
||
| 130 | 130 | * @param array $content=null |
| 131 | 131 | * @param string $msg='' |
| 132 | 132 | */ |
| 133 | - public function index(array $content=null) |
|
| 133 | + public function index(array $content = null) |
|
| 134 | 134 | { |
| 135 | 135 | if (!is_array($content)) |
| 136 | 136 | { |
| 137 | 137 | $content = array( |
| 138 | 138 | 'nm' => array( |
| 139 | - 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 140 | - 'no_filter' => True, // current dir only |
|
| 141 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 142 | - 'no_cat' => True, // I disable the cat-selectbox |
|
| 143 | - 'lettersearch' => false, // I show a lettersearch |
|
| 144 | - 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 145 | - 'start' => 0, // IO position in list |
|
| 146 | - 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
| 147 | - 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 139 | + 'get_rows' => 'filemanager.filemanager_shares.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 140 | + 'no_filter' => True, // current dir only |
|
| 141 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 142 | + 'no_cat' => True, // I disable the cat-selectbox |
|
| 143 | + 'lettersearch' => false, // I show a lettersearch |
|
| 144 | + 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 145 | + 'start' => 0, // IO position in list |
|
| 146 | + 'order' => 'share_created', // IO name of the column to sort after (optional for the sortheaders) |
|
| 147 | + 'sort' => 'DESC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 148 | 148 | //'default_cols' => '!', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
| 149 | 149 | 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, |
| 150 | 150 | //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | elseif ($content['nm']['action']) |
| 158 | 158 | { |
| 159 | - switch($content['nm']['action']) |
|
| 159 | + switch ($content['nm']['action']) |
|
| 160 | 160 | { |
| 161 | 161 | case 'delete': |
| 162 | 162 | $where = array('share_owner' => $GLOBALS['egw_info']['user']['account_id']); |
@@ -101,7 +101,10 @@ |
||
| 101 | 101 | $row['type'] = $row['share_writable'] ? Sharing::WRITABLE : Sharing::READONLY; |
| 102 | 102 | } |
| 103 | 103 | $row['share_passwd'] = (boolean)$row['share_passwd']; |
| 104 | - if ($row['share_with']) $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
| 104 | + if ($row['share_with']) |
|
| 105 | + { |
|
| 106 | + $row['share_with'] = preg_replace('/,([^ ])/', ', $1', $row['share_with']); |
|
| 107 | + } |
|
| 105 | 108 | } |
| 106 | 109 | return $total; |
| 107 | 110 | } |
@@ -536,6 +536,9 @@ discard block |
||
| 536 | 536 | * @param int &$errs=null on return number of errors |
| 537 | 537 | * @param int &$dirs=null on return number of dirs deleted |
| 538 | 538 | * @param int &$files=null on return number of files deleted |
| 539 | + * @param integer $errs |
|
| 540 | + * @param integer $files |
|
| 541 | + * @param integer $dirs |
|
| 539 | 542 | * @return string success or failure message displayed to the user |
| 540 | 543 | */ |
| 541 | 544 | static public function action($action,$selected,$dir=null,&$errs=null,&$files=null,&$dirs=null) |
@@ -704,6 +707,9 @@ discard block |
||
| 704 | 707 | * @param int &$errs=null on return number of errors |
| 705 | 708 | * @param int &$dirs=null on return number of dirs deleted |
| 706 | 709 | * @param int &$files=null on return number of files deleted |
| 710 | + * @param integer $errs |
|
| 711 | + * @param integer $dirs |
|
| 712 | + * @param integer $files |
|
| 707 | 713 | * @return string |
| 708 | 714 | */ |
| 709 | 715 | public static function do_delete(array $selected, &$errs=null, &$dirs=null, &$files=null) |
@@ -1325,7 +1331,6 @@ discard block |
||
| 1325 | 1331 | * |
| 1326 | 1332 | * @param string $action eg. 'delete', ... |
| 1327 | 1333 | * @param array $selected selected path(s) |
| 1328 | - * @param string $dir=null current directory |
|
| 1329 | 1334 | * @see static::action() |
| 1330 | 1335 | */ |
| 1331 | 1336 | public static function ajax_action($action, $selected, $dir=null, $props=null) |
@@ -1420,7 +1420,7 @@ |
||
| 1420 | 1420 | if (Vfs::file_exists($target) && $app_dir) |
| 1421 | 1421 | { |
| 1422 | 1422 | if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir); |
| 1423 | - error_log("Symlinking $target to $app_dir"); |
|
| 1423 | + error_log("symlinking $target to $app_dir"); |
|
| 1424 | 1424 | Vfs::symlink($target, Vfs::concat($app_dir,Vfs::encodePathComponent($file['name']))); |
| 1425 | 1425 | } |
| 1426 | 1426 | } |
@@ -87,7 +87,10 @@ discard block |
||
| 87 | 87 | // search for plugins with additional filemanager views |
| 88 | 88 | foreach(Api\Hooks::process('filemanager_views') as $views) |
| 89 | 89 | { |
| 90 | - if (is_array($views)) static::$views += $views; |
|
| 90 | + if (is_array($views)) |
|
| 91 | + { |
|
| 92 | + static::$views += $views; |
|
| 93 | + } |
|
| 91 | 94 | } |
| 92 | 95 | static::$views_init = true; |
| 93 | 96 | } |
@@ -310,7 +313,10 @@ discard block |
||
| 310 | 313 | $content['nm']['home_dir'] = static::get_home_dir(); |
| 311 | 314 | $content['nm']['view'] = $GLOBALS['egw_info']['user']['preferences']['filemanager']['nm_view']; |
| 312 | 315 | |
| 313 | - if (isset($_GET['msg'])) $msg = $_GET['msg']; |
|
| 316 | + if (isset($_GET['msg'])) |
|
| 317 | + { |
|
| 318 | + $msg = $_GET['msg']; |
|
| 319 | + } |
|
| 314 | 320 | |
| 315 | 321 | // Blank favorite set via GET needs special handling for path |
| 316 | 322 | if (isset($_GET['favorite']) && $_GET['favorite'] == 'blank') |
@@ -344,7 +350,10 @@ discard block |
||
| 344 | 350 | // reset lettersearch as it confuses users (they think the dir is empty) |
| 345 | 351 | $content['nm']['searchletter'] = false; |
| 346 | 352 | // switch recusive display off |
| 347 | - if (!$content['nm']['filter']) $content['nm']['filter'] = ''; |
|
| 353 | + if (!$content['nm']['filter']) |
|
| 354 | + { |
|
| 355 | + $content['nm']['filter'] = ''; |
|
| 356 | + } |
|
| 348 | 357 | } |
| 349 | 358 | } |
| 350 | 359 | $view = static::get_view(); |
@@ -393,37 +402,70 @@ discard block |
||
| 393 | 402 | { |
| 394 | 403 | $tpl = new Etemplate('filemanager.index'); |
| 395 | 404 | |
| 396 | - if($msg) Framework::message($msg); |
|
| 405 | + if($msg) |
|
| 406 | + { |
|
| 407 | + Framework::message($msg); |
|
| 408 | + } |
|
| 397 | 409 | |
| 398 | 410 | if (($content['nm']['action'] || $content['nm']['rows']) && (empty($content['button']) || !isset($content['button']))) |
| 399 | 411 | { |
| 400 | 412 | if ($content['nm']['action']) |
| 401 | 413 | { |
| 402 | 414 | $msg = static::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
| 403 | - if($msg) Framework::message($msg); |
|
| 415 | + if($msg) |
|
| 416 | + { |
|
| 417 | + Framework::message($msg); |
|
| 418 | + } |
|
| 404 | 419 | |
| 405 | 420 | // clean up after action |
| 406 | 421 | unset($content['nm']['selected']); |
| 407 | 422 | // reset any occasion where action may be stored, as it may be ressurected out of the helpers by etemplate, which is quite unconvenient in case of action delete |
| 408 | - if (isset($content['nm']['action'])) unset($content['nm']['action']); |
|
| 409 | - if (isset($content['nm']['nm_action'])) unset($content['nm']['nm_action']); |
|
| 410 | - if (isset($content['nm_action'])) unset($content['nm_action']); |
|
| 423 | + if (isset($content['nm']['action'])) |
|
| 424 | + { |
|
| 425 | + unset($content['nm']['action']); |
|
| 426 | + } |
|
| 427 | + if (isset($content['nm']['nm_action'])) |
|
| 428 | + { |
|
| 429 | + unset($content['nm']['nm_action']); |
|
| 430 | + } |
|
| 431 | + if (isset($content['nm_action'])) |
|
| 432 | + { |
|
| 433 | + unset($content['nm_action']); |
|
| 434 | + } |
|
| 411 | 435 | // we dont use ['nm']['rows']['delete'], so unset it, if it is present |
| 412 | - if (isset($content['nm']['rows']['delete'])) unset($content['nm']['rows']['delete']); |
|
| 436 | + if (isset($content['nm']['rows']['delete'])) |
|
| 437 | + { |
|
| 438 | + unset($content['nm']['rows']['delete']); |
|
| 439 | + } |
|
| 413 | 440 | } |
| 414 | 441 | elseif($content['nm']['rows']['delete']) |
| 415 | 442 | { |
| 416 | 443 | $msg = static::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); |
| 417 | - if($msg) Framework::message($msg); |
|
| 444 | + if($msg) |
|
| 445 | + { |
|
| 446 | + Framework::message($msg); |
|
| 447 | + } |
|
| 418 | 448 | |
| 419 | 449 | // clean up after action |
| 420 | 450 | unset($content['nm']['rows']['delete']); |
| 421 | 451 | // reset any occasion where action may be stored, as we use ['nm']['rows']['delete'] anyhow |
| 422 | 452 | // we clean this up, as it may be ressurected out of the helpers by etemplate, which is quite unconvenient in case of action delete |
| 423 | - if (isset($content['nm']['action'])) unset($content['nm']['action']); |
|
| 424 | - if (isset($content['nm']['nm_action'])) unset($content['nm']['nm_action']); |
|
| 425 | - if (isset($content['nm_action'])) unset($content['nm_action']); |
|
| 426 | - if (isset($content['nm']['selected'])) unset($content['nm']['selected']); |
|
| 453 | + if (isset($content['nm']['action'])) |
|
| 454 | + { |
|
| 455 | + unset($content['nm']['action']); |
|
| 456 | + } |
|
| 457 | + if (isset($content['nm']['nm_action'])) |
|
| 458 | + { |
|
| 459 | + unset($content['nm']['nm_action']); |
|
| 460 | + } |
|
| 461 | + if (isset($content['nm_action'])) |
|
| 462 | + { |
|
| 463 | + unset($content['nm_action']); |
|
| 464 | + } |
|
| 465 | + if (isset($content['nm']['selected'])) |
|
| 466 | + { |
|
| 467 | + unset($content['nm']['selected']); |
|
| 468 | + } |
|
| 427 | 469 | } |
| 428 | 470 | unset($content['nm']['rows']); |
| 429 | 471 | Api\Cache::setSession('filemanager', 'index',$content['nm']); |
@@ -587,9 +629,12 @@ discard block |
||
| 587 | 629 | foreach(Vfs::find($path) as $p) |
| 588 | 630 | { |
| 589 | 631 | $to = $dir.substr($p,$len); |
| 590 | - if ($to == $p) // cant copy into itself! |
|
| 632 | + if ($to == $p) |
|
| 633 | + { |
|
| 634 | + // cant copy into itself! |
|
| 591 | 635 | { |
| 592 | 636 | ++$errs; |
| 637 | + } |
|
| 593 | 638 | continue; |
| 594 | 639 | } |
| 595 | 640 | if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to,null,STREAM_MKDIR_RECURSIVE)) |
@@ -644,7 +689,10 @@ discard block |
||
| 644 | 689 | continue; |
| 645 | 690 | } |
| 646 | 691 | } |
| 647 | - if ($target[0] != '/') $target = Vfs::concat($dir, $target); |
|
| 692 | + if ($target[0] != '/') |
|
| 693 | + { |
|
| 694 | + $target = Vfs::concat($dir, $target); |
|
| 695 | + } |
|
| 648 | 696 | if (!Vfs::stat($target)) |
| 649 | 697 | { |
| 650 | 698 | return lang('Link target %1 not found!', Vfs::decodePath($target)); |
@@ -687,10 +735,16 @@ discard block |
||
| 687 | 735 | switch($action) |
| 688 | 736 | { |
| 689 | 737 | case 'document': |
| 690 | - if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
|
| 738 | + if (!$settings) |
|
| 739 | + { |
|
| 740 | + $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
|
| 741 | + } |
|
| 691 | 742 | $document_merge = new filemanager_merge(Vfs::decodePath($dir)); |
| 692 | 743 | $msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']); |
| 693 | - if($msg) return $msg; |
|
| 744 | + if($msg) |
|
| 745 | + { |
|
| 746 | + return $msg; |
|
| 747 | + } |
|
| 694 | 748 | $errs = count($selected); |
| 695 | 749 | return false; |
| 696 | 750 | } |
@@ -727,7 +781,9 @@ discard block |
||
| 727 | 781 | unset($selected[$key]); |
| 728 | 782 | } |
| 729 | 783 | } |
| 730 | - if ($selected) // somethings left to delete |
|
| 784 | + if ($selected) |
|
| 785 | + { |
|
| 786 | + // somethings left to delete |
|
| 731 | 787 | { |
| 732 | 788 | // some precaution to never allow to (recursivly) remove /, /apps or /home |
| 733 | 789 | foreach((array)$selected as $path) |
@@ -735,6 +791,7 @@ discard block |
||
| 735 | 791 | if (preg_match('/^\/?(home|apps|)\/*$/',$path)) |
| 736 | 792 | { |
| 737 | 793 | $errs++; |
| 794 | + } |
|
| 738 | 795 | return lang("Cautiously rejecting to remove folder '%1'!",Vfs::decodePath($path)); |
| 739 | 796 | } |
| 740 | 797 | } |
@@ -782,7 +839,10 @@ discard block |
||
| 782 | 839 | { |
| 783 | 840 | Api\Cache::setSession('filemanager', 'index',$query); |
| 784 | 841 | } |
| 785 | - if(!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 842 | + if(!$query['path']) |
|
| 843 | + { |
|
| 844 | + $query['path'] = static::get_home_dir(); |
|
| 845 | + } |
|
| 786 | 846 | |
| 787 | 847 | // Change template to match selected view |
| 788 | 848 | if($query['view']) |
@@ -840,7 +900,10 @@ discard block |
||
| 840 | 900 | $filter = $query['filter'] === '' ? 1 : $query['filter']; |
| 841 | 901 | |
| 842 | 902 | $maxdepth = $filter && $filter != 4 ? (int)(boolean)$filter : null; |
| 843 | - if($filter == 5) $maxdepth = 2; |
|
| 903 | + if($filter == 5) |
|
| 904 | + { |
|
| 905 | + $maxdepth = 2; |
|
| 906 | + } |
|
| 844 | 907 | $n = 0; |
| 845 | 908 | $vfs_options = array( |
| 846 | 909 | 'mindepth' => 1, |
@@ -893,10 +956,16 @@ discard block |
||
| 893 | 956 | { |
| 894 | 957 | unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
| 895 | 958 | $row =& $rows[$path2n[$path]]; |
| 896 | - if ( !is_array($props) ) continue; |
|
| 959 | + if ( !is_array($props) ) |
|
| 960 | + { |
|
| 961 | + continue; |
|
| 962 | + } |
|
| 897 | 963 | foreach($props as $prop) |
| 898 | 964 | { |
| 899 | - if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) continue; |
|
| 965 | + if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) |
|
| 966 | + { |
|
| 967 | + continue; |
|
| 968 | + } |
|
| 900 | 969 | $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'],0,64).' ...'; |
| 901 | 970 | } |
| 902 | 971 | } |
@@ -1021,7 +1090,10 @@ discard block |
||
| 1021 | 1090 | if (!($dir = Vfs::dirname($path))) |
| 1022 | 1091 | { |
| 1023 | 1092 | $msg .= lang('File or directory not found!')." Vfs::dirname('$path')===false"; |
| 1024 | - if ($button == 'save') $button = 'apply'; |
|
| 1093 | + if ($button == 'save') |
|
| 1094 | + { |
|
| 1095 | + $button = 'apply'; |
|
| 1096 | + } |
|
| 1025 | 1097 | continue; |
| 1026 | 1098 | } |
| 1027 | 1099 | $to = Vfs::concat($dir, $content['name']); |
@@ -1030,7 +1102,10 @@ discard block |
||
| 1030 | 1102 | $tpl->set_validation_error('name',lang("There's already a file with that name!").'<br />'. |
| 1031 | 1103 | lang('To overwrite the existing file store again.',lang($button))); |
| 1032 | 1104 | $content['confirm_overwrite'] = $to; |
| 1033 | - if ($button == 'save') $button = 'apply'; |
|
| 1105 | + if ($button == 'save') |
|
| 1106 | + { |
|
| 1107 | + $button = 'apply'; |
|
| 1108 | + } |
|
| 1034 | 1109 | continue; |
| 1035 | 1110 | } |
| 1036 | 1111 | if (Vfs::rename($path,$to)) |
@@ -1103,13 +1178,19 @@ discard block |
||
| 1103 | 1178 | } |
| 1104 | 1179 | if ($ok && !$failed) |
| 1105 | 1180 | { |
| 1106 | - if(!$perm_changed++) $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1181 | + if(!$perm_changed++) |
|
| 1182 | + { |
|
| 1183 | + $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1184 | + } |
|
| 1107 | 1185 | $content['old'][$name] = $content[$name]; |
| 1108 | 1186 | } |
| 1109 | 1187 | elseif($failed) |
| 1110 | 1188 | { |
| 1111 | - if(!$perm_failed++) $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1189 | + if(!$perm_failed++) |
|
| 1190 | + { |
|
| 1191 | + $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1112 | 1192 | ($ok ? ' ('.lang('%1 failed, %2 succeded',$failed,$ok).')' : '')); |
| 1193 | + } |
|
| 1113 | 1194 | } |
| 1114 | 1195 | } |
| 1115 | 1196 | elseif (call_user_func_array($cmd,array($path,$value))) |
@@ -1162,7 +1243,10 @@ discard block |
||
| 1162 | 1243 | } |
| 1163 | 1244 | } |
| 1164 | 1245 | Framework::refresh_opener($msg, 'filemanager', $refresh_path ? $refresh_path : $path, 'edit', null, '&path=[^&]*'); |
| 1165 | - if ($button == 'save') Framework::window_close(); |
|
| 1246 | + if ($button == 'save') |
|
| 1247 | + { |
|
| 1248 | + Framework::window_close(); |
|
| 1249 | + } |
|
| 1166 | 1250 | } |
| 1167 | 1251 | if ($content['is_link'] && !Vfs::stat($path)) |
| 1168 | 1252 | { |
@@ -1172,12 +1256,18 @@ discard block |
||
| 1172 | 1256 | $content['icon'] = Vfs::mime_icon($content['mime']); |
| 1173 | 1257 | $content['msg'] = $msg; |
| 1174 | 1258 | |
| 1175 | - if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; |
|
| 1259 | + if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) |
|
| 1260 | + { |
|
| 1261 | + $content['ro_uid_root'] = 'root'; |
|
| 1262 | + } |
|
| 1176 | 1263 | // only owner can change group & perms |
| 1177 | 1264 | if (($readonlys['gid'] = !$content['is_owner'] || |
| 1178 | - Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs |
|
| 1265 | + Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) |
|
| 1266 | + { |
|
| 1267 | + // no uid, gid or perms in oldvfs |
|
| 1179 | 1268 | { |
| 1180 | 1269 | if (!$content['gid']) $content['ro_gid_root'] = 'root'; |
| 1270 | + } |
|
| 1181 | 1271 | foreach($content['perms'] as $name => $value) |
| 1182 | 1272 | { |
| 1183 | 1273 | $readonlys['perms['.$name.']'] = true; |
@@ -1210,9 +1300,13 @@ discard block |
||
| 1210 | 1300 | 5 => lang('Display of content'), |
| 1211 | 1301 | 0 => lang('No access'), |
| 1212 | 1302 | ); |
| 1213 | - if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) // backend supports eacl |
|
| 1303 | + if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) |
|
| 1214 | 1304 | { |
| 1215 | - unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1305 | + // backend supports eacl |
|
| 1306 | + { |
|
| 1307 | + unset($readonlys['tabs']['filemanager.file.eacl']); |
|
| 1308 | + } |
|
| 1309 | + // --> switch the tab on again |
|
| 1216 | 1310 | foreach($content['eacl'] as &$eacl) |
| 1217 | 1311 | { |
| 1218 | 1312 | $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'],PHP_URL_PATH),'/'); |
@@ -1269,10 +1363,13 @@ discard block |
||
| 1269 | 1363 | 'comment' => (string)$content['comment'], |
| 1270 | 1364 | 'mergeapp' => $content['mergeapp'] |
| 1271 | 1365 | ); |
| 1272 | - if ($cfs) foreach($cfs as $name => $data) |
|
| 1366 | + if ($cfs) |
|
| 1367 | + { |
|
| 1368 | + foreach($cfs as $name => $data) |
|
| 1273 | 1369 | { |
| 1274 | 1370 | $preserve['old']['#'.$name] = (string)$content['#'.$name]; |
| 1275 | 1371 | } |
| 1372 | + } |
|
| 1276 | 1373 | } |
| 1277 | 1374 | if (Vfs::$is_root) |
| 1278 | 1375 | { |
@@ -1294,7 +1391,10 @@ discard block |
||
| 1294 | 1391 | $tpl->setElementAttribute('tabs', 'add_tabs', true); |
| 1295 | 1392 | |
| 1296 | 1393 | $tabs =& $tpl->getElementAttribute('tabs','tabs'); |
| 1297 | - if (true) $tabs = array(); |
|
| 1394 | + if (true) |
|
| 1395 | + { |
|
| 1396 | + $tabs = array(); |
|
| 1397 | + } |
|
| 1298 | 1398 | |
| 1299 | 1399 | foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
| 1300 | 1400 | { |
@@ -1347,7 +1447,10 @@ discard block |
||
| 1347 | 1447 | 'files' => 0, |
| 1348 | 1448 | ); |
| 1349 | 1449 | |
| 1350 | - if (!isset($dir)) $dir = array_pop($selected); |
|
| 1450 | + if (!isset($dir)) |
|
| 1451 | + { |
|
| 1452 | + $dir = array_pop($selected); |
|
| 1453 | + } |
|
| 1351 | 1454 | |
| 1352 | 1455 | switch($action) |
| 1353 | 1456 | { |
@@ -1421,7 +1524,10 @@ discard block |
||
| 1421 | 1524 | $target=Vfs::concat($dir,Vfs::encodePathComponent($file['name'])); |
| 1422 | 1525 | if (Vfs::file_exists($target) && $app_dir) |
| 1423 | 1526 | { |
| 1424 | - if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir); |
|
| 1527 | + if (!Vfs::file_exists($app_dir)) |
|
| 1528 | + { |
|
| 1529 | + Vfs::mkdir($app_dir); |
|
| 1530 | + } |
|
| 1425 | 1531 | error_log("Symlinking $target to $app_dir"); |
| 1426 | 1532 | Vfs::symlink($target, Vfs::concat($app_dir,Vfs::encodePathComponent($file['name']))); |
| 1427 | 1533 | } |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | if (!static::$views_init) |
| 81 | 81 | { |
| 82 | 82 | // translate our labels |
| 83 | - foreach(static::$views as &$label) |
|
| 83 | + foreach (static::$views as &$label) |
|
| 84 | 84 | { |
| 85 | 85 | $label = lang($label); |
| 86 | 86 | } |
| 87 | 87 | // search for plugins with additional filemanager views |
| 88 | - foreach(Api\Hooks::process('filemanager_views') as $views) |
|
| 88 | + foreach (Api\Hooks::process('filemanager_views') as $views) |
|
| 89 | 89 | { |
| 90 | 90 | if (is_array($views)) static::$views += $views; |
| 91 | 91 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public static function get_view() |
| 103 | 103 | { |
| 104 | - $view =& Api\Cache::getSession('filemanager', 'view'); |
|
| 104 | + $view = & Api\Cache::getSession('filemanager', 'view'); |
|
| 105 | 105 | if (isset($_GET['view'])) |
| 106 | 106 | { |
| 107 | 107 | $view = $_GET['view']; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | 'open' => array( |
| 126 | 126 | 'caption' => lang('Open'), |
| 127 | 127 | 'icon' => '', |
| 128 | - 'group' => $group=1, |
|
| 128 | + 'group' => $group = 1, |
|
| 129 | 129 | 'allowOnMultiple' => false, |
| 130 | 130 | 'onExecute' => 'javaScript:app.filemanager.open', |
| 131 | 131 | 'default' => true |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'caption' => lang('Edit settings'), |
| 151 | 151 | 'group' => $group, |
| 152 | 152 | 'allowOnMultiple' => false, |
| 153 | - 'onExecute' => Api\Header\UserAgent::mobile()?'javaScript:app.filemanager.viewEntry':'javaScript:app.filemanager.editprefs', |
|
| 153 | + 'onExecute' => Api\Header\UserAgent::mobile() ? 'javaScript:app.filemanager.viewEntry' : 'javaScript:app.filemanager.editprefs', |
|
| 154 | 154 | 'mobileViewTemplate' => 'file?'.filemtime(Api\Etemplate\Widget\Template::rel2path('/filemanager/templates/mobile/file.xet')) |
| 155 | 155 | ), |
| 156 | 156 | 'mkdir' => array( |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | ), |
| 193 | 193 | // DRAG and DROP events |
| 194 | 194 | 'file_drag' => array( |
| 195 | - 'dragType' => array('file','link'), |
|
| 195 | + 'dragType' => array('file', 'link'), |
|
| 196 | 196 | 'type' => 'drag', |
| 197 | 197 | 'onExecute' => 'javaScript:app.filemanager.drag' |
| 198 | 198 | ), |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | else |
| 233 | 233 | { |
| 234 | - foreach(Vfs\Sharing::$modes as $mode => $data) |
|
| 234 | + foreach (Vfs\Sharing::$modes as $mode => $data) |
|
| 235 | 235 | { |
| 236 | 236 | $actions['mail']['children']['mail_'.$mode] = array( |
| 237 | 237 | 'caption' => $data['label'], |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | // This would be done automatically, but we're overriding |
| 244 | - foreach($actions as $action_id => $action) |
|
| 244 | + foreach ($actions as $action_id => $action) |
|
| 245 | 245 | { |
| 246 | - if($action['type'] == 'drop' && $action['caption']) |
|
| 246 | + if ($action['type'] == 'drop' && $action['caption']) |
|
| 247 | 247 | { |
| 248 | 248 | $action['type'] = 'popup'; |
| 249 | - if($action['acceptedTypes'] == 'file') |
|
| 249 | + if ($action['acceptedTypes'] == 'file') |
|
| 250 | 250 | { |
| 251 | 251 | $action['enabled'] = 'javaScript:app.filemanager.paste_enabled'; |
| 252 | 252 | } |
@@ -266,10 +266,10 @@ discard block |
||
| 266 | 266 | * |
| 267 | 267 | * @return string merge application or NULL if no property found |
| 268 | 268 | */ |
| 269 | - private static function get_mergeapp($path, $scope='self') |
|
| 269 | + private static function get_mergeapp($path, $scope = 'self') |
|
| 270 | 270 | { |
| 271 | 271 | $app = null; |
| 272 | - switch($scope) |
|
| 272 | + switch ($scope) |
|
| 273 | 273 | { |
| 274 | 274 | case 'self': |
| 275 | 275 | $props = Vfs::propfind($path, static::$merge_prop_namespace); |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | case 'parents': |
| 279 | 279 | // search for props in parent directories |
| 280 | 280 | $currentpath = $path; |
| 281 | - while($dir = Vfs::dirname($currentpath)) |
|
| 281 | + while ($dir = Vfs::dirname($currentpath)) |
|
| 282 | 282 | { |
| 283 | 283 | $props = Vfs::propfind($dir, static::$merge_prop_namespace); |
| 284 | - if(!empty($props)) |
|
| 284 | + if (!empty($props)) |
|
| 285 | 285 | { |
| 286 | 286 | // found prop in parent directory |
| 287 | 287 | return $app = $props[0]['val']; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * @param array $content |
| 301 | 301 | * @param string $msg |
| 302 | 302 | */ |
| 303 | - function index(array $content=null,$msg=null) |
|
| 303 | + function index(array $content = null, $msg = null) |
|
| 304 | 304 | { |
| 305 | 305 | if (!is_array($content)) |
| 306 | 306 | { |
@@ -310,16 +310,16 @@ discard block |
||
| 310 | 310 | if (!is_array($content['nm'])) |
| 311 | 311 | { |
| 312 | 312 | $content['nm'] = array( |
| 313 | - 'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 314 | - 'filter' => '', // current dir only |
|
| 315 | - 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 316 | - 'no_cat' => True, // I disable the cat-selectbox |
|
| 317 | - 'lettersearch' => True, // I show a lettersearch |
|
| 318 | - 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 319 | - 'start' => 0, // IO position in list |
|
| 320 | - 'order' => 'name', // IO name of the column to sort after (optional for the sortheaders) |
|
| 321 | - 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 322 | - 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
|
| 313 | + 'get_rows' => 'filemanager.filemanager_ui.get_rows', // I method/callback to request the data for the rows eg. 'notes.bo.get_rows' |
|
| 314 | + 'filter' => '', // current dir only |
|
| 315 | + 'no_filter2' => True, // I disable the 2. filter (params are the same as for filter) |
|
| 316 | + 'no_cat' => True, // I disable the cat-selectbox |
|
| 317 | + 'lettersearch' => True, // I show a lettersearch |
|
| 318 | + 'searchletter' => false, // I0 active letter of the lettersearch or false for [all] |
|
| 319 | + 'start' => 0, // IO position in list |
|
| 320 | + 'order' => 'name', // IO name of the column to sort after (optional for the sortheaders) |
|
| 321 | + 'sort' => 'ASC', // IO direction of the sort: 'ASC' or 'DESC' |
|
| 322 | + 'default_cols' => '!comment,ctime', // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns |
|
| 323 | 323 | 'csv_fields' => false, // I false=disable csv export, true or unset=enable it with auto-detected fieldnames, |
| 324 | 324 | //or array with name=>label or name=>array('label'=>label,'type'=>type) pairs (type is a eT widget-type) |
| 325 | 325 | 'actions' => static::get_actions(), |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | 'parent_id' => 'dir', |
| 329 | 329 | 'is_parent' => 'is_dir', |
| 330 | 330 | 'favorites' => true, |
| 331 | - 'placeholder_actions' => array('mkdir','paste','file_drop_mail','file_drop_move','file_drop_copy','file_drop_symlink') |
|
| 331 | + 'placeholder_actions' => array('mkdir', 'paste', 'file_drop_mail', 'file_drop_move', 'file_drop_copy', 'file_drop_symlink') |
|
| 332 | 332 | ); |
| 333 | 333 | $content['nm']['path'] = static::get_home_dir(); |
| 334 | 334 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | if (isset($_GET['path']) && ($path = $_GET['path'])) |
| 351 | 351 | { |
| 352 | - switch($path) |
|
| 352 | + switch ($path) |
|
| 353 | 353 | { |
| 354 | 354 | case '..': |
| 355 | 355 | $path = Vfs::dirname($content['nm']['path']); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | $path = static::get_home_dir(); |
| 359 | 359 | break; |
| 360 | 360 | } |
| 361 | - if ($path && $path[0] == '/' && Vfs::stat($path,true) && Vfs::is_dir($path) && Vfs::check_access($path,Vfs::READABLE)) |
|
| 361 | + if ($path && $path[0] == '/' && Vfs::stat($path, true) && Vfs::is_dir($path) && Vfs::check_access($path, Vfs::READABLE)) |
|
| 362 | 362 | { |
| 363 | 363 | $content['nm']['path'] = $path; |
| 364 | 364 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | } |
| 375 | 375 | $view = static::get_view(); |
| 376 | 376 | |
| 377 | - call_user_func($view,$content,$msg); |
|
| 377 | + call_user_func($view, $content, $msg); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | /** |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | * @param boolean &$is_setup=null on return true if authenticated user is setup config user, false otherwise |
| 388 | 388 | * @return boolean true is root user given, false otherwise (including logout / empty $user) |
| 389 | 389 | */ |
| 390 | - protected function sudo($user='',$password=null,&$is_setup=null) |
|
| 390 | + protected function sudo($user = '', $password = null, &$is_setup = null) |
|
| 391 | 391 | { |
| 392 | 392 | if (!$user) |
| 393 | 393 | { |
@@ -396,15 +396,15 @@ discard block |
||
| 396 | 396 | else |
| 397 | 397 | { |
| 398 | 398 | // config user & password |
| 399 | - $is_setup = Api\Session::user_pw_hash($user,$password) === $GLOBALS['egw_info']['server']['config_hash']; |
|
| 399 | + $is_setup = Api\Session::user_pw_hash($user, $password) === $GLOBALS['egw_info']['server']['config_hash']; |
|
| 400 | 400 | // or vfs root user from setup >> configuration |
| 401 | - $is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] && |
|
| 402 | - in_array($user,preg_split('/, */',$GLOBALS['egw_info']['server']['vfs_root_user'])) && |
|
| 401 | + $is_root = $is_setup || $GLOBALS['egw_info']['server']['vfs_root_user'] && |
|
| 402 | + in_array($user, preg_split('/, */', $GLOBALS['egw_info']['server']['vfs_root_user'])) && |
|
| 403 | 403 | $GLOBALS['egw']->auth->authenticate($user, $password, 'text'); |
| 404 | 404 | } |
| 405 | 405 | //error_log(__METHOD__."('$user','$password',$is_setup) user_pw_hash(...)='".Api\Session::user_pw_hash($user,$password)."', config_hash='{$GLOBALS['egw_info']['server']['config_hash']}' --> returning ".array2string($is_root)); |
| 406 | - Api\Cache::setSession('filemanager', 'is_setup',$is_setup); |
|
| 407 | - Api\Cache::setSession('filemanager', 'is_root',Vfs::$is_root = $is_root); |
|
| 406 | + Api\Cache::setSession('filemanager', 'is_setup', $is_setup); |
|
| 407 | + Api\Cache::setSession('filemanager', 'is_root', Vfs::$is_root = $is_root); |
|
| 408 | 408 | return Vfs::$is_root; |
| 409 | 409 | } |
| 410 | 410 | |
@@ -414,18 +414,18 @@ discard block |
||
| 414 | 414 | * @param array $content |
| 415 | 415 | * @param string $msg |
| 416 | 416 | */ |
| 417 | - function listview(array $content=null,$msg=null) |
|
| 417 | + function listview(array $content = null, $msg = null) |
|
| 418 | 418 | { |
| 419 | 419 | $tpl = new Etemplate('filemanager.index'); |
| 420 | 420 | |
| 421 | - if($msg) Framework::message($msg); |
|
| 421 | + if ($msg) Framework::message($msg); |
|
| 422 | 422 | |
| 423 | 423 | if (($content['nm']['action'] || $content['nm']['rows']) && (empty($content['button']) || !isset($content['button']))) |
| 424 | 424 | { |
| 425 | 425 | if ($content['nm']['action']) |
| 426 | 426 | { |
| 427 | - $msg = static::action($content['nm']['action'],$content['nm']['selected'],$content['nm']['path']); |
|
| 428 | - if($msg) Framework::message($msg); |
|
| 427 | + $msg = static::action($content['nm']['action'], $content['nm']['selected'], $content['nm']['path']); |
|
| 428 | + if ($msg) Framework::message($msg); |
|
| 429 | 429 | |
| 430 | 430 | // clean up after action |
| 431 | 431 | unset($content['nm']['selected']); |
@@ -436,10 +436,10 @@ discard block |
||
| 436 | 436 | // we dont use ['nm']['rows']['delete'], so unset it, if it is present |
| 437 | 437 | if (isset($content['nm']['rows']['delete'])) unset($content['nm']['rows']['delete']); |
| 438 | 438 | } |
| 439 | - elseif($content['nm']['rows']['delete']) |
|
| 439 | + elseif ($content['nm']['rows']['delete']) |
|
| 440 | 440 | { |
| 441 | - $msg = static::action('delete',array_keys($content['nm']['rows']['delete']),$content['nm']['path']); |
|
| 442 | - if($msg) Framework::message($msg); |
|
| 441 | + $msg = static::action('delete', array_keys($content['nm']['rows']['delete']), $content['nm']['path']); |
|
| 442 | + if ($msg) Framework::message($msg); |
|
| 443 | 443 | |
| 444 | 444 | // clean up after action |
| 445 | 445 | unset($content['nm']['rows']['delete']); |
@@ -451,11 +451,11 @@ discard block |
||
| 451 | 451 | if (isset($content['nm']['selected'])) unset($content['nm']['selected']); |
| 452 | 452 | } |
| 453 | 453 | unset($content['nm']['rows']); |
| 454 | - Api\Cache::setSession('filemanager', 'index',$content['nm']); |
|
| 454 | + Api\Cache::setSession('filemanager', 'index', $content['nm']); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | 457 | // be tolerant with (in previous versions) not correct urlencoded pathes |
| 458 | - if ($content['nm']['path'][0] == '/' && !Vfs::stat($content['nm']['path'],true) && Vfs::stat(urldecode($content['nm']['path']))) |
|
| 458 | + if ($content['nm']['path'][0] == '/' && !Vfs::stat($content['nm']['path'], true) && Vfs::stat(urldecode($content['nm']['path']))) |
|
| 459 | 459 | { |
| 460 | 460 | $content['nm']['path'] = urldecode($content['nm']['path']); |
| 461 | 461 | } |
@@ -466,22 +466,22 @@ discard block |
||
| 466 | 466 | list($button) = each($content['button']); |
| 467 | 467 | unset($content['button']); |
| 468 | 468 | } |
| 469 | - switch($button) |
|
| 469 | + switch ($button) |
|
| 470 | 470 | { |
| 471 | 471 | case 'upload': |
| 472 | 472 | if (!$content['upload']) |
| 473 | 473 | { |
| 474 | - Framework::message(lang('You need to select some files first!'),'error'); |
|
| 474 | + Framework::message(lang('You need to select some files first!'), 'error'); |
|
| 475 | 475 | break; |
| 476 | 476 | } |
| 477 | 477 | $upload_success = $upload_failure = array(); |
| 478 | - foreach(isset($content['upload'][0]) ? $content['upload'] : array($content['upload']) as $upload) |
|
| 478 | + foreach (isset($content['upload'][0]) ? $content['upload'] : array($content['upload']) as $upload) |
|
| 479 | 479 | { |
| 480 | 480 | // encode chars which special meaning in url/vfs (some like / get removed!) |
| 481 | - $to = Vfs::concat($content['nm']['path'],Vfs::encodePathComponent($upload['name'])); |
|
| 481 | + $to = Vfs::concat($content['nm']['path'], Vfs::encodePathComponent($upload['name'])); |
|
| 482 | 482 | if ($upload && |
| 483 | 483 | (Vfs::is_writable($content['nm']['path']) || Vfs::is_writable($to)) && |
| 484 | - copy($upload['tmp_name'],Vfs::PREFIX.$to)) |
|
| 484 | + copy($upload['tmp_name'], Vfs::PREFIX.$to)) |
|
| 485 | 485 | { |
| 486 | 486 | $upload_success[] = $upload['name']; |
| 487 | 487 | } |
@@ -493,12 +493,11 @@ discard block |
||
| 493 | 493 | $content['nm']['msg'] = ''; |
| 494 | 494 | if ($upload_success) |
| 495 | 495 | { |
| 496 | - Framework::message( count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : |
|
| 497 | - lang('%1 successful uploaded.',implode(', ',$upload_success))); |
|
| 496 | + Framework::message(count($upload_success) == 1 && !$upload_failure ? lang('File successful uploaded.') : lang('%1 successful uploaded.', implode(', ', $upload_success))); |
|
| 498 | 497 | } |
| 499 | 498 | if ($upload_failure) |
| 500 | 499 | { |
| 501 | - Framework::message(lang('Error uploading file!')."\n".etemplate::max_upload_size_message(),'error'); |
|
| 500 | + Framework::message(lang('Error uploading file!')."\n".etemplate::max_upload_size_message(), 'error'); |
|
| 502 | 501 | } |
| 503 | 502 | break; |
| 504 | 503 | } |
@@ -519,16 +518,16 @@ discard block |
||
| 519 | 518 | $tpl->setElementAttribute('nm[buttons][upload]', 'drop_target', 'popupMainDiv'); |
| 520 | 519 | } |
| 521 | 520 | // Set view button to match current settings |
| 522 | - if($content['nm']['view'] == 'tile') |
|
| 521 | + if ($content['nm']['view'] == 'tile') |
|
| 523 | 522 | { |
| 524 | - $tpl->setElementAttribute('nm[button][change_view]','statustext',lang('List view')); |
|
| 525 | - $tpl->setElementAttribute('nm[button][change_view]','image','list_row'); |
|
| 523 | + $tpl->setElementAttribute('nm[button][change_view]', 'statustext', lang('List view')); |
|
| 524 | + $tpl->setElementAttribute('nm[button][change_view]', 'image', 'list_row'); |
|
| 526 | 525 | } |
| 527 | 526 | // if initial load is done via GET request (idots template or share.php) |
| 528 | 527 | // get_rows cant call app.filemanager.set_readonly, so we need to do that here |
| 529 | 528 | $content['initial_path_readonly'] = !Vfs::is_writable($content['nm']['path']); |
| 530 | 529 | |
| 531 | - $tpl->exec('filemanager.filemanager_ui.index',$content,$sel_options,$readonlys,array('nm' => $content['nm'])); |
|
| 530 | + $tpl->exec('filemanager.filemanager_ui.index', $content, $sel_options, $readonlys, array('nm' => $content['nm'])); |
|
| 532 | 531 | } |
| 533 | 532 | |
| 534 | 533 | /** |
@@ -564,7 +563,7 @@ discard block |
||
| 564 | 563 | * @param int &$files=null on return number of files deleted |
| 565 | 564 | * @return string success or failure message displayed to the user |
| 566 | 565 | */ |
| 567 | - static public function action($action,$selected,$dir=null,&$errs=null,&$files=null,&$dirs=null) |
|
| 566 | + static public function action($action, $selected, $dir = null, &$errs = null, &$files = null, &$dirs = null) |
|
| 568 | 567 | { |
| 569 | 568 | if (!count($selected)) |
| 570 | 569 | { |
@@ -572,20 +571,20 @@ discard block |
||
| 572 | 571 | } |
| 573 | 572 | $errs = $dirs = $files = 0; |
| 574 | 573 | |
| 575 | - switch($action) |
|
| 574 | + switch ($action) |
|
| 576 | 575 | { |
| 577 | 576 | |
| 578 | 577 | case 'delete': |
| 579 | - return static::do_delete($selected,$errs,$files,$dirs); |
|
| 578 | + return static::do_delete($selected, $errs, $files, $dirs); |
|
| 580 | 579 | |
| 581 | 580 | case 'mail': |
| 582 | 581 | case 'copy': |
| 583 | - foreach($selected as $path) |
|
| 582 | + foreach ($selected as $path) |
|
| 584 | 583 | { |
| 585 | 584 | if (strpos($path, 'mail::') === 0 && $path = substr($path, 6)) |
| 586 | 585 | { |
| 587 | 586 | // Support for dropping mail in filemanager - Pass mail back to mail app |
| 588 | - if(ExecMethod2('mail.mail_ui.vfsSaveMessage', $path, $dir, false)) |
|
| 587 | + if (ExecMethod2('mail.mail_ui.vfsSaveMessage', $path, $dir, false)) |
|
| 589 | 588 | { |
| 590 | 589 | ++$files; |
| 591 | 590 | } |
@@ -596,8 +595,8 @@ discard block |
||
| 596 | 595 | } |
| 597 | 596 | elseif (!Vfs::is_dir($path)) |
| 598 | 597 | { |
| 599 | - $to = Vfs::concat($dir,Vfs::basename($path)); |
|
| 600 | - if ($path != $to && Vfs::copy($path,$to)) |
|
| 598 | + $to = Vfs::concat($dir, Vfs::basename($path)); |
|
| 599 | + if ($path != $to && Vfs::copy($path, $to)) |
|
| 601 | 600 | { |
| 602 | 601 | ++$files; |
| 603 | 602 | } |
@@ -609,19 +608,19 @@ discard block |
||
| 609 | 608 | else |
| 610 | 609 | { |
| 611 | 610 | $len = strlen(dirname($path)); |
| 612 | - foreach(Vfs::find($path) as $p) |
|
| 611 | + foreach (Vfs::find($path) as $p) |
|
| 613 | 612 | { |
| 614 | - $to = $dir.substr($p,$len); |
|
| 613 | + $to = $dir.substr($p, $len); |
|
| 615 | 614 | if ($to == $p) // cant copy into itself! |
| 616 | 615 | { |
| 617 | 616 | ++$errs; |
| 618 | 617 | continue; |
| 619 | 618 | } |
| 620 | - if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to,null,STREAM_MKDIR_RECURSIVE)) |
|
| 619 | + if (($is_dir = Vfs::is_dir($p)) && Vfs::mkdir($to, null, STREAM_MKDIR_RECURSIVE)) |
|
| 621 | 620 | { |
| 622 | 621 | ++$dirs; |
| 623 | 622 | } |
| 624 | - elseif(!$is_dir && Vfs::copy($p,$to)) |
|
| 623 | + elseif (!$is_dir && Vfs::copy($p, $to)) |
|
| 625 | 624 | { |
| 626 | 625 | ++$files; |
| 627 | 626 | } |
@@ -634,15 +633,15 @@ discard block |
||
| 634 | 633 | } |
| 635 | 634 | if ($errs) |
| 636 | 635 | { |
| 637 | - return lang('%1 errors copying (%2 diretories and %3 files copied)!',$errs,$dirs,$files); |
|
| 636 | + return lang('%1 errors copying (%2 diretories and %3 files copied)!', $errs, $dirs, $files); |
|
| 638 | 637 | } |
| 639 | - return $dirs ? lang('%1 directories and %2 files copied.',$dirs,$files) : lang('%1 files copied.',$files); |
|
| 638 | + return $dirs ? lang('%1 directories and %2 files copied.', $dirs, $files) : lang('%1 files copied.', $files); |
|
| 640 | 639 | |
| 641 | 640 | case 'move': |
| 642 | - foreach($selected as $path) |
|
| 641 | + foreach ($selected as $path) |
|
| 643 | 642 | { |
| 644 | - $to = Vfs::is_dir($dir) || count($selected) > 1 ? Vfs::concat($dir,Vfs::basename($path)) : $dir; |
|
| 645 | - if ($path != $to && Vfs::rename($path,$to)) |
|
| 643 | + $to = Vfs::is_dir($dir) || count($selected) > 1 ? Vfs::concat($dir, Vfs::basename($path)) : $dir; |
|
| 644 | + if ($path != $to && Vfs::rename($path, $to)) |
|
| 646 | 645 | { |
| 647 | 646 | ++$files; |
| 648 | 647 | } |
@@ -653,17 +652,17 @@ discard block |
||
| 653 | 652 | } |
| 654 | 653 | if ($errs) |
| 655 | 654 | { |
| 656 | - return lang('%1 errors moving (%2 files moved)!',$errs,$files); |
|
| 655 | + return lang('%1 errors moving (%2 files moved)!', $errs, $files); |
|
| 657 | 656 | } |
| 658 | - return lang('%1 files moved.',$files); |
|
| 657 | + return lang('%1 files moved.', $files); |
|
| 659 | 658 | |
| 660 | 659 | case 'symlink': // symlink given files to $dir |
| 661 | - foreach((array)$selected as $target) |
|
| 660 | + foreach ((array)$selected as $target) |
|
| 662 | 661 | { |
| 663 | 662 | $link = Vfs::concat($dir, Vfs::basename($target)); |
| 664 | - if (!Vfs::stat($dir) || ($ok = Vfs::mkdir($dir,0,true))) |
|
| 663 | + if (!Vfs::stat($dir) || ($ok = Vfs::mkdir($dir, 0, true))) |
|
| 665 | 664 | { |
| 666 | - if(!$ok) |
|
| 665 | + if (!$ok) |
|
| 667 | 666 | { |
| 668 | 667 | $errs++; |
| 669 | 668 | continue; |
@@ -685,15 +684,14 @@ discard block |
||
| 685 | 684 | } |
| 686 | 685 | if (count((array)$selected) == 1) |
| 687 | 686 | { |
| 688 | - return $files ? lang('Symlink to %1 created.', Vfs::decodePath($target)) : |
|
| 689 | - lang('Error creating symlink to target %1!', Vfs::decodePath($target)); |
|
| 687 | + return $files ? lang('Symlink to %1 created.', Vfs::decodePath($target)) : lang('Error creating symlink to target %1!', Vfs::decodePath($target)); |
|
| 690 | 688 | } |
| 691 | 689 | $ret = lang('%1 elements linked.', $files); |
| 692 | 690 | if ($errs) |
| 693 | 691 | { |
| 694 | - $ret = lang('%1 errors linking (%2)!',$errs, $ret); |
|
| 692 | + $ret = lang('%1 errors linking (%2)!', $errs, $ret); |
|
| 695 | 693 | } |
| 696 | - return $ret;//." Vfs::symlink('$target', '$link')"; |
|
| 694 | + return $ret; //." Vfs::symlink('$target', '$link')"; |
|
| 697 | 695 | |
| 698 | 696 | case 'createdir': |
| 699 | 697 | $dst = Vfs::concat($dir, is_array($selected) ? $selected[0] : $selected); |
@@ -709,13 +707,13 @@ discard block |
||
| 709 | 707 | |
| 710 | 708 | default: |
| 711 | 709 | list($action, $settings) = explode('_', $action, 2); |
| 712 | - switch($action) |
|
| 710 | + switch ($action) |
|
| 713 | 711 | { |
| 714 | 712 | case 'document': |
| 715 | 713 | if (!$settings) $settings = $GLOBALS['egw_info']['user']['preferences']['filemanager']['default_document']; |
| 716 | 714 | $document_merge = new filemanager_merge(Vfs::decodePath($dir)); |
| 717 | 715 | $msg = $document_merge->download($settings, $selected, '', $GLOBALS['egw_info']['user']['preferences']['filemanager']['document_dir']); |
| 718 | - if($msg) return $msg; |
|
| 716 | + if ($msg) return $msg; |
|
| 719 | 717 | $errs = count($selected); |
| 720 | 718 | return false; |
| 721 | 719 | } |
@@ -732,12 +730,12 @@ discard block |
||
| 732 | 730 | * @param int &$files=null on return number of files deleted |
| 733 | 731 | * @return string |
| 734 | 732 | */ |
| 735 | - public static function do_delete(array $selected, &$errs=null, &$dirs=null, &$files=null) |
|
| 733 | + public static function do_delete(array $selected, &$errs = null, &$dirs = null, &$files = null) |
|
| 736 | 734 | { |
| 737 | 735 | $dirs = $files = $errs = 0; |
| 738 | 736 | // we first delete all selected links (and files) |
| 739 | 737 | // feeding the links to dirs to Vfs::find() deletes the content of the dirs, not just the link! |
| 740 | - foreach($selected as $key => $path) |
|
| 738 | + foreach ($selected as $key => $path) |
|
| 741 | 739 | { |
| 742 | 740 | if (!Vfs::is_dir($path) || Vfs::is_link($path)) |
| 743 | 741 | { |
@@ -755,21 +753,21 @@ discard block |
||
| 755 | 753 | if ($selected) // somethings left to delete |
| 756 | 754 | { |
| 757 | 755 | // some precaution to never allow to (recursivly) remove /, /apps or /home |
| 758 | - foreach((array)$selected as $path) |
|
| 756 | + foreach ((array)$selected as $path) |
|
| 759 | 757 | { |
| 760 | 758 | if (Vfs::isProtectedDir($path)) |
| 761 | 759 | { |
| 762 | 760 | $errs++; |
| 763 | - return lang("Cautiously rejecting to remove folder '%1'!",Vfs::decodePath($path)); |
|
| 761 | + return lang("Cautiously rejecting to remove folder '%1'!", Vfs::decodePath($path)); |
|
| 764 | 762 | } |
| 765 | 763 | } |
| 766 | 764 | // now we use find to loop through all files and dirs: (selected only contains dirs now) |
| 767 | 765 | // - depth=true to get first the files and then the dir containing it |
| 768 | 766 | // - hidden=true to also return hidden files (eg. Thumbs.db), as we cant delete non-empty dirs |
| 769 | 767 | // - show-deleted=false to not (finally) deleted versioned files |
| 770 | - foreach(Vfs::find($selected,array('depth'=>true,'hidden'=>true,'show-deleted'=>false)) as $path) |
|
| 768 | + foreach (Vfs::find($selected, array('depth'=>true, 'hidden'=>true, 'show-deleted'=>false)) as $path) |
|
| 771 | 769 | { |
| 772 | - if (($is_dir = Vfs::is_dir($path) && !Vfs::is_link($path)) && Vfs::rmdir($path,0)) |
|
| 770 | + if (($is_dir = Vfs::is_dir($path) && !Vfs::is_link($path)) && Vfs::rmdir($path, 0)) |
|
| 773 | 771 | { |
| 774 | 772 | ++$dirs; |
| 775 | 773 | } |
@@ -785,13 +783,13 @@ discard block |
||
| 785 | 783 | } |
| 786 | 784 | if ($errs) |
| 787 | 785 | { |
| 788 | - return lang('%1 errors deleteting (%2 directories and %3 files deleted)!',$errs,$dirs,$files); |
|
| 786 | + return lang('%1 errors deleteting (%2 directories and %3 files deleted)!', $errs, $dirs, $files); |
|
| 789 | 787 | } |
| 790 | 788 | if ($dirs) |
| 791 | 789 | { |
| 792 | - return lang('%1 directories and %2 files deleted.',$dirs,$files); |
|
| 790 | + return lang('%1 directories and %2 files deleted.', $dirs, $files); |
|
| 793 | 791 | } |
| 794 | - return $files == 1 ? lang('File deleted.') : lang('%1 files deleted.',$files); |
|
| 792 | + return $files == 1 ? lang('File deleted.') : lang('%1 files deleted.', $files); |
|
| 795 | 793 | } |
| 796 | 794 | |
| 797 | 795 | /** |
@@ -805,37 +803,37 @@ discard block |
||
| 805 | 803 | // do NOT store query, if hierarchical data / children are requested |
| 806 | 804 | if (!$query['csv_export']) |
| 807 | 805 | { |
| 808 | - Api\Cache::setSession('filemanager', 'index',$query); |
|
| 806 | + Api\Cache::setSession('filemanager', 'index', $query); |
|
| 809 | 807 | } |
| 810 | - if(!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 808 | + if (!$query['path']) $query['path'] = static::get_home_dir(); |
|
| 811 | 809 | |
| 812 | 810 | // Change template to match selected view |
| 813 | - if($query['view']) |
|
| 811 | + if ($query['view']) |
|
| 814 | 812 | { |
| 815 | 813 | $query['template'] = ($query['view'] == 'row' ? 'filemanager.index.rows' : 'filemanager.tile'); |
| 816 | 814 | |
| 817 | 815 | // Store as preference but only for index, not home |
| 818 | - if($query['get_rows'] == 'filemanager.filemanager_ui.get_rows') |
|
| 816 | + if ($query['get_rows'] == 'filemanager.filemanager_ui.get_rows') |
|
| 819 | 817 | { |
| 820 | - $GLOBALS['egw']->preferences->add('filemanager','nm_view',$query['view']); |
|
| 818 | + $GLOBALS['egw']->preferences->add('filemanager', 'nm_view', $query['view']); |
|
| 821 | 819 | $GLOBALS['egw']->preferences->save_repository(); |
| 822 | 820 | } |
| 823 | 821 | } |
| 824 | 822 | // be tolerant with (in previous versions) not correct urlencoded pathes |
| 825 | - if (!Vfs::stat($query['path'],true) && Vfs::stat(urldecode($query['path']))) |
|
| 823 | + if (!Vfs::stat($query['path'], true) && Vfs::stat(urldecode($query['path']))) |
|
| 826 | 824 | { |
| 827 | 825 | $query['path'] = urldecode($query['path']); |
| 828 | 826 | } |
| 829 | - if (!Vfs::stat($query['path'],true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'],Vfs::READABLE)) |
|
| 827 | + if (!Vfs::stat($query['path'], true) || !Vfs::is_dir($query['path']) || !Vfs::check_access($query['path'], Vfs::READABLE)) |
|
| 830 | 828 | { |
| 831 | 829 | // only redirect, if it would be to some other location, gives redirect-loop otherwise |
| 832 | 830 | if ($query['path'] != ($path = static::get_home_dir())) |
| 833 | 831 | { |
| 834 | 832 | // we will leave here, since we are not allowed, or the location does not exist. Index must handle that, and give |
| 835 | 833 | // an appropriate message |
| 836 | - Egw::redirect_link('/index.php',array('menuaction'=>'filemanager.filemanager_ui.index', |
|
| 834 | + Egw::redirect_link('/index.php', array('menuaction'=>'filemanager.filemanager_ui.index', |
|
| 837 | 835 | 'path' => $path, |
| 838 | - 'msg' => lang('The requested path %1 is not available.',Vfs::decodePath($query['path'])), |
|
| 836 | + 'msg' => lang('The requested path %1 is not available.', Vfs::decodePath($query['path'])), |
|
| 839 | 837 | 'ajax' => 'true' |
| 840 | 838 | )); |
| 841 | 839 | } |
@@ -843,35 +841,35 @@ discard block |
||
| 843 | 841 | return 0; |
| 844 | 842 | } |
| 845 | 843 | $rows = $dir_is_writable = array(); |
| 846 | - if($query['searchletter'] && !empty($query['search'])) |
|
| 844 | + if ($query['searchletter'] && !empty($query['search'])) |
|
| 847 | 845 | { |
| 848 | - $namefilter = '/^'.$query['searchletter'].'.*'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; |
|
| 846 | + $namefilter = '/^'.$query['searchletter'].'.*'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'/i'; |
|
| 849 | 847 | if ($query['searchletter'] == strtolower($query['search'][0])) |
| 850 | 848 | { |
| 851 | - $namefilter = '/^('.$query['searchletter'].'.*'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'|'. |
|
| 852 | - str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).')/i'; |
|
| 849 | + $namefilter = '/^('.$query['searchletter'].'.*'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'|'. |
|
| 850 | + str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).')/i'; |
|
| 853 | 851 | } |
| 854 | 852 | } |
| 855 | 853 | elseif ($query['searchletter']) |
| 856 | 854 | { |
| 857 | 855 | $namefilter = '/^'.$query['searchletter'].'/i'; |
| 858 | 856 | } |
| 859 | - elseif(!empty($query['search'])) |
|
| 857 | + elseif (!empty($query['search'])) |
|
| 860 | 858 | { |
| 861 | - $namefilter = '/'.str_replace(array('\\?','\\*'),array('.{1}','.*'),preg_quote($query['search'])).'/i'; |
|
| 859 | + $namefilter = '/'.str_replace(array('\\?', '\\*'), array('.{1}', '.*'), preg_quote($query['search'])).'/i'; |
|
| 862 | 860 | } |
| 863 | 861 | |
| 864 | 862 | // Re-map so 'No filters' favorite ('') is depth 1 |
| 865 | 863 | $filter = $query['filter'] === '' ? 1 : $query['filter']; |
| 866 | 864 | |
| 867 | 865 | $maxdepth = $filter && $filter != 4 ? (int)(boolean)$filter : null; |
| 868 | - if($filter == 5) $maxdepth = 2; |
|
| 866 | + if ($filter == 5) $maxdepth = 2; |
|
| 869 | 867 | $n = 0; |
| 870 | 868 | $vfs_options = array( |
| 871 | 869 | 'mindepth' => 1, |
| 872 | 870 | 'maxdepth' => $maxdepth, |
| 873 | 871 | 'dirsontop' => $filter <= 1, |
| 874 | - 'type' => $filter && $filter != 5 ? ($filter == 4 ? 'd' : null) : ($filter == 5 ? 'F':'f'), |
|
| 872 | + 'type' => $filter && $filter != 5 ? ($filter == 4 ? 'd' : null) : ($filter == 5 ? 'F' : 'f'), |
|
| 875 | 873 | 'order' => $query['order'], 'sort' => $query['sort'], |
| 876 | 874 | 'limit' => (int)$query['num_rows'].','.(int)$query['start'], |
| 877 | 875 | 'need_mime' => true, |
@@ -879,11 +877,11 @@ discard block |
||
| 879 | 877 | 'hidden' => $filter == 3, |
| 880 | 878 | 'follow' => $filter == 5, |
| 881 | 879 | ); |
| 882 | - if($query['col_filter']['mime']) |
|
| 880 | + if ($query['col_filter']['mime']) |
|
| 883 | 881 | { |
| 884 | 882 | $vfs_options['mime'] = $query['col_filter']['mime']; |
| 885 | 883 | } |
| 886 | - foreach(Vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'],$vfs_options,true) as $path => $row) |
|
| 884 | + foreach (Vfs::find(!empty($query['col_filter']['dir']) ? $query['col_filter']['dir'] : $query['path'], $vfs_options, true) as $path => $row) |
|
| 887 | 885 | { |
| 888 | 886 | //echo $path; _debug_array($row); |
| 889 | 887 | |
@@ -898,39 +896,39 @@ discard block |
||
| 898 | 896 | { |
| 899 | 897 | $dir_is_writable[$path] = Vfs::is_writable($path); |
| 900 | 898 | } |
| 901 | - if(!$dir_is_writable[$path]) |
|
| 899 | + if (!$dir_is_writable[$path]) |
|
| 902 | 900 | { |
| 903 | 901 | $row['class'] .= 'noEdit '; |
| 904 | 902 | } |
| 905 | 903 | $row['class'] .= 'isDir '; |
| 906 | 904 | } |
| 907 | 905 | $row['download_url'] = Vfs::download_url($path); |
| 908 | - $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal |
|
| 906 | + $row['gid'] = -abs($row['gid']); // gid are positive, but we use negagive account_id for groups internal |
|
| 909 | 907 | |
| 910 | 908 | $rows[++$n] = $row; |
| 911 | 909 | $path2n[$path] = $n; |
| 912 | 910 | } |
| 913 | 911 | // query comments and cf's for the displayed rows |
| 914 | - $cols_to_show = explode(',',$GLOBALS['egw_info']['user']['preferences']['filemanager']['nextmatch-filemanager.index.rows']); |
|
| 912 | + $cols_to_show = explode(',', $GLOBALS['egw_info']['user']['preferences']['filemanager']['nextmatch-filemanager.index.rows']); |
|
| 915 | 913 | |
| 916 | 914 | // Always include comment in tiles |
| 917 | - if($query['view'] == 'tile') |
|
| 915 | + if ($query['view'] == 'tile') |
|
| 918 | 916 | { |
| 919 | 917 | $cols_to_show[] = 'comment'; |
| 920 | 918 | } |
| 921 | - $all_cfs = in_array('customfields',$cols_to_show) && $cols_to_show[count($cols_to_show)-1][0] != '#'; |
|
| 922 | - if ($path2n && (in_array('comment',$cols_to_show) || in_array('customfields',$cols_to_show)) && |
|
| 919 | + $all_cfs = in_array('customfields', $cols_to_show) && $cols_to_show[count($cols_to_show) - 1][0] != '#'; |
|
| 920 | + if ($path2n && (in_array('comment', $cols_to_show) || in_array('customfields', $cols_to_show)) && |
|
| 923 | 921 | ($path2props = Vfs::propfind(array_keys($path2n)))) |
| 924 | 922 | { |
| 925 | - foreach($path2props as $path => $props) |
|
| 923 | + foreach ($path2props as $path => $props) |
|
| 926 | 924 | { |
| 927 | - unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
|
| 928 | - $row =& $rows[$path2n[$path]]; |
|
| 929 | - if ( !is_array($props) ) continue; |
|
| 930 | - foreach($props as $prop) |
|
| 925 | + unset($row); // fixes a weird problem with php5.1, does NOT happen with php5.2 |
|
| 926 | + $row = & $rows[$path2n[$path]]; |
|
| 927 | + if (!is_array($props)) continue; |
|
| 928 | + foreach ($props as $prop) |
|
| 931 | 929 | { |
| 932 | - if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'],$cols_to_show)) continue; |
|
| 933 | - $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'],0,64).' ...'; |
|
| 930 | + if (!$all_cfs && $prop['name'][0] == '#' && !in_array($prop['name'], $cols_to_show)) continue; |
|
| 931 | + $row[$prop['name']] = strlen($prop['val']) < 64 ? $prop['val'] : substr($prop['val'], 0, 64).' ...'; |
|
| 934 | 932 | } |
| 935 | 933 | } |
| 936 | 934 | } |
@@ -942,7 +940,7 @@ discard block |
||
| 942 | 940 | if ($GLOBALS['egw_info']['flags']['currentapp'] == 'projectmanager') |
| 943 | 941 | { |
| 944 | 942 | // we need our app.css file |
| 945 | - if (!file_exists(EGW_SERVER_ROOT.($css_file='/filemanager/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css'))) |
|
| 943 | + if (!file_exists(EGW_SERVER_ROOT.($css_file = '/filemanager/templates/'.$GLOBALS['egw_info']['server']['template_set'].'/app.css'))) |
|
| 946 | 944 | { |
| 947 | 945 | $css_file = '/filemanager/templates/default/app.css'; |
| 948 | 946 | } |
@@ -958,7 +956,7 @@ discard block |
||
| 958 | 956 | * @param array $content |
| 959 | 957 | * @param string $msg |
| 960 | 958 | */ |
| 961 | - function file(array $content=null,$msg='') |
|
| 959 | + function file(array $content = null, $msg = '') |
|
| 962 | 960 | { |
| 963 | 961 | $tpl = new Etemplate('filemanager.file'); |
| 964 | 962 | |
@@ -968,9 +966,9 @@ discard block |
||
| 968 | 966 | { |
| 969 | 967 | $msg .= $_GET['msg']; |
| 970 | 968 | } |
| 971 | - if (!($path = str_replace(array('#','?'),array('%23','%3F'),$_GET['path'])) || // ?, # need to stay encoded! |
|
| 969 | + if (!($path = str_replace(array('#', '?'), array('%23', '%3F'), $_GET['path'])) || // ?, # need to stay encoded! |
|
| 972 | 970 | // actions enclose pathes containing comma with " |
| 973 | - ($path[0] == '"' && substr($path,-1) == '"' && !($path = substr(str_replace('""','"',$path),1,-1))) || |
|
| 971 | + ($path[0] == '"' && substr($path, -1) == '"' && !($path = substr(str_replace('""', '"', $path), 1, -1))) || |
|
| 974 | 972 | !($stat = Vfs::lstat($path))) |
| 975 | 973 | { |
| 976 | 974 | $msg .= lang('File or directory not found!')." path='$path', stat=".array2string($stat); |
@@ -983,10 +981,10 @@ discard block |
||
| 983 | 981 | $content['path'] = $path; |
| 984 | 982 | $content['hsize'] = Vfs::hsize($stat['size']); |
| 985 | 983 | $content['mime'] = Vfs::mime_content_type($path); |
| 986 | - $content['gid'] *= -1; // our widgets use negative gid's |
|
| 984 | + $content['gid'] *= -1; // our widgets use negative gid's |
|
| 987 | 985 | if (($props = Vfs::propfind($path))) |
| 988 | 986 | { |
| 989 | - foreach($props as $prop) |
|
| 987 | + foreach ($props as $prop) |
|
| 990 | 988 | { |
| 991 | 989 | $content[$prop['name']] = $prop['val']; |
| 992 | 990 | } |
@@ -999,9 +997,9 @@ discard block |
||
| 999 | 997 | $content['tabs'] = $_GET['tabs']; |
| 1000 | 998 | if (!($content['is_dir'] = Vfs::is_dir($path) && !Vfs::is_link($path))) |
| 1001 | 999 | { |
| 1002 | - $content['perms']['executable'] = (int)!!($content['mode'] & 0111); |
|
| 1000 | + $content['perms']['executable'] = (int)!!($content['mode']&0111); |
|
| 1003 | 1001 | $mask = 6; |
| 1004 | - if (preg_match('/^text/',$content['mime']) && $content['size'] < 100000) |
|
| 1002 | + if (preg_match('/^text/', $content['mime']) && $content['size'] < 100000) |
|
| 1005 | 1003 | { |
| 1006 | 1004 | $content['text_content'] = file_get_contents(Vfs::PREFIX.$path); |
| 1007 | 1005 | } |
@@ -1011,19 +1009,19 @@ discard block |
||
| 1011 | 1009 | //currently not implemented in backend $content['perms']['sticky'] = (int)!!($content['mode'] & 0x201); |
| 1012 | 1010 | $mask = 7; |
| 1013 | 1011 | } |
| 1014 | - foreach(array('owner' => 6,'group' => 3,'other' => 0) as $name => $shift) |
|
| 1012 | + foreach (array('owner' => 6, 'group' => 3, 'other' => 0) as $name => $shift) |
|
| 1015 | 1013 | { |
| 1016 | - $content['perms'][$name] = ($content['mode'] >> $shift) & $mask; |
|
| 1014 | + $content['perms'][$name] = ($content['mode'] >> $shift)&$mask; |
|
| 1017 | 1015 | } |
| 1018 | - $content['is_owner'] = Vfs::has_owner_rights($path,$content); |
|
| 1016 | + $content['is_owner'] = Vfs::has_owner_rights($path, $content); |
|
| 1019 | 1017 | } |
| 1020 | 1018 | else |
| 1021 | 1019 | { |
| 1022 | 1020 | //_debug_array($content); |
| 1023 | - $path =& $content['path']; |
|
| 1021 | + $path = & $content['path']; |
|
| 1024 | 1022 | |
| 1025 | 1023 | list($button) = @each($content['button']); unset($content['button']); |
| 1026 | - if(!$button && $content['sudo']) |
|
| 1024 | + if (!$button && $content['sudo']) |
|
| 1027 | 1025 | { |
| 1028 | 1026 | // Button to stop sudo is not in button namespace |
| 1029 | 1027 | $button = 'sudo'; |
@@ -1032,21 +1030,21 @@ discard block |
||
| 1032 | 1030 | // need to check 'setup' button (submit button in sudo popup), as some browsers (eg. chrome) also fill the hidden field |
| 1033 | 1031 | if ($button == 'sudo' && Vfs::$is_root || $button == 'setup' && $content['sudo']['user']) |
| 1034 | 1032 | { |
| 1035 | - $msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '',$content['sudo']['passwd']) ? |
|
| 1033 | + $msg = $this->sudo($button == 'setup' ? $content['sudo']['user'] : '', $content['sudo']['passwd']) ? |
|
| 1036 | 1034 | lang('Root access granted.') : ($button == 'setup' && $content['sudo']['user'] ? |
| 1037 | 1035 | lang('Wrong username or password!') : lang('Root access stopped.')); |
| 1038 | 1036 | unset($content['sudo']); |
| 1039 | 1037 | $content['is_owner'] = Vfs::has_owner_rights($path); |
| 1040 | 1038 | } |
| 1041 | - if (in_array($button,array('save','apply'))) |
|
| 1039 | + if (in_array($button, array('save', 'apply'))) |
|
| 1042 | 1040 | { |
| 1043 | 1041 | $props = array(); |
| 1044 | 1042 | $perm_changed = $perm_failed = 0; |
| 1045 | - foreach($content['old'] as $name => $old_value) |
|
| 1043 | + foreach ($content['old'] as $name => $old_value) |
|
| 1046 | 1044 | { |
| 1047 | 1045 | if (isset($content[$name]) && ($old_value != $content[$name] || |
| 1048 | 1046 | // do not check for modification, if modify_subs is checked! |
| 1049 | - $content['modify_subs'] && in_array($name,array('uid','gid','perms'))) && |
|
| 1047 | + $content['modify_subs'] && in_array($name, array('uid', 'gid', 'perms'))) && |
|
| 1050 | 1048 | ($name != 'uid' || Vfs::$is_root)) |
| 1051 | 1049 | { |
| 1052 | 1050 | if ($name == 'name') |
@@ -1060,23 +1058,23 @@ discard block |
||
| 1060 | 1058 | $to = Vfs::concat($dir, $content['name']); |
| 1061 | 1059 | if (file_exists(Vfs::PREFIX.$to) && $content['confirm_overwrite'] !== $to) |
| 1062 | 1060 | { |
| 1063 | - $tpl->set_validation_error('name',lang("There's already a file with that name!").'<br />'. |
|
| 1064 | - lang('To overwrite the existing file store again.',lang($button))); |
|
| 1061 | + $tpl->set_validation_error('name', lang("There's already a file with that name!").'<br />'. |
|
| 1062 | + lang('To overwrite the existing file store again.', lang($button))); |
|
| 1065 | 1063 | $content['confirm_overwrite'] = $to; |
| 1066 | 1064 | if ($button == 'save') $button = 'apply'; |
| 1067 | 1065 | continue; |
| 1068 | 1066 | } |
| 1069 | - if (Vfs::rename($path,$to)) |
|
| 1067 | + if (Vfs::rename($path, $to)) |
|
| 1070 | 1068 | { |
| 1071 | - $msg .= lang('Renamed %1 to %2.',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' '; |
|
| 1069 | + $msg .= lang('Renamed %1 to %2.', Vfs::decodePath(basename($path)), Vfs::decodePath(basename($to))).' '; |
|
| 1072 | 1070 | $content['old']['name'] = $content[$name]; |
| 1073 | 1071 | $path = $to; |
| 1074 | - $content['mime'] = Api\MimeMagic::filename2mime($path); // recheck mime type |
|
| 1075 | - $refresh_path = Vfs::dirname($path); // for renames, we have to refresh the parent |
|
| 1072 | + $content['mime'] = Api\MimeMagic::filename2mime($path); // recheck mime type |
|
| 1073 | + $refresh_path = Vfs::dirname($path); // for renames, we have to refresh the parent |
|
| 1076 | 1074 | } |
| 1077 | 1075 | else |
| 1078 | 1076 | { |
| 1079 | - $msg .= lang('Rename of %1 to %2 failed!',Vfs::decodePath(basename($path)),Vfs::decodePath(basename($to))).' '; |
|
| 1077 | + $msg .= lang('Rename of %1 to %2 failed!', Vfs::decodePath(basename($path)), Vfs::decodePath(basename($to))).' '; |
|
| 1080 | 1078 | if (Vfs::deny_script($to)) |
| 1081 | 1079 | { |
| 1082 | 1080 | $msg .= lang('You are NOT allowed to upload a script!').' '; |
@@ -1096,7 +1094,7 @@ discard block |
||
| 1096 | 1094 | 'val' => (!empty($content[$name]) ? $content[$name] : null), |
| 1097 | 1095 | ), |
| 1098 | 1096 | ); |
| 1099 | - if (Vfs::proppatch($path,$mergeprop)) |
|
| 1097 | + if (Vfs::proppatch($path, $mergeprop)) |
|
| 1100 | 1098 | { |
| 1101 | 1099 | $content['old'][$name] = $content[$name]; |
| 1102 | 1100 | $msg .= lang('Setting for document merge saved.'); |
@@ -1108,22 +1106,22 @@ discard block |
||
| 1108 | 1106 | } |
| 1109 | 1107 | else |
| 1110 | 1108 | { |
| 1111 | - static $name2cmd = array('uid' => 'chown','gid' => 'chgrp','perms' => 'chmod'); |
|
| 1112 | - $cmd = array('egw_vfs',$name2cmd[$name]); |
|
| 1109 | + static $name2cmd = array('uid' => 'chown', 'gid' => 'chgrp', 'perms' => 'chmod'); |
|
| 1110 | + $cmd = array('egw_vfs', $name2cmd[$name]); |
|
| 1113 | 1111 | $value = $name == 'perms' ? static::perms2mode($content['perms']) : $content[$name]; |
| 1114 | 1112 | if ($content['modify_subs']) |
| 1115 | 1113 | { |
| 1116 | 1114 | if ($name == 'perms') |
| 1117 | 1115 | { |
| 1118 | - $changed = Vfs::find($path,array('type'=>'d'),$cmd,array($value)); |
|
| 1119 | - $changed += Vfs::find($path,array('type'=>'f'),$cmd,array($value & 0666)); // no execute for files |
|
| 1116 | + $changed = Vfs::find($path, array('type'=>'d'), $cmd, array($value)); |
|
| 1117 | + $changed += Vfs::find($path, array('type'=>'f'), $cmd, array($value&0666)); // no execute for files |
|
| 1120 | 1118 | } |
| 1121 | 1119 | else |
| 1122 | 1120 | { |
| 1123 | - $changed = Vfs::find($path,null,$cmd,array($value)); |
|
| 1121 | + $changed = Vfs::find($path, null, $cmd, array($value)); |
|
| 1124 | 1122 | } |
| 1125 | 1123 | $ok = $failed = 0; |
| 1126 | - foreach($changed as &$r) |
|
| 1124 | + foreach ($changed as &$r) |
|
| 1127 | 1125 | { |
| 1128 | 1126 | if ($r) |
| 1129 | 1127 | { |
@@ -1136,32 +1134,32 @@ discard block |
||
| 1136 | 1134 | } |
| 1137 | 1135 | if ($ok && !$failed) |
| 1138 | 1136 | { |
| 1139 | - if(!$perm_changed++) $msg .= lang('Permissions of %1 changed.',$path.' '.lang('and all it\'s childeren')); |
|
| 1137 | + if (!$perm_changed++) $msg .= lang('Permissions of %1 changed.', $path.' '.lang('and all it\'s childeren')); |
|
| 1140 | 1138 | $content['old'][$name] = $content[$name]; |
| 1141 | 1139 | } |
| 1142 | - elseif($failed) |
|
| 1140 | + elseif ($failed) |
|
| 1143 | 1141 | { |
| 1144 | - if(!$perm_failed++) $msg .= lang('Failed to change permissions of %1!',$path.lang('and all it\'s childeren'). |
|
| 1145 | - ($ok ? ' ('.lang('%1 failed, %2 succeded',$failed,$ok).')' : '')); |
|
| 1142 | + if (!$perm_failed++) $msg .= lang('Failed to change permissions of %1!', $path.lang('and all it\'s childeren'). |
|
| 1143 | + ($ok ? ' ('.lang('%1 failed, %2 succeded', $failed, $ok).')' : '')); |
|
| 1146 | 1144 | } |
| 1147 | 1145 | } |
| 1148 | - elseif (call_user_func_array($cmd,array($path,$value))) |
|
| 1146 | + elseif (call_user_func_array($cmd, array($path, $value))) |
|
| 1149 | 1147 | { |
| 1150 | - $msg .= lang('Permissions of %1 changed.',$path); |
|
| 1148 | + $msg .= lang('Permissions of %1 changed.', $path); |
|
| 1151 | 1149 | $content['old'][$name] = $content[$name]; |
| 1152 | 1150 | } |
| 1153 | 1151 | else |
| 1154 | 1152 | { |
| 1155 | - $msg .= lang('Failed to change permissions of %1!',$path); |
|
| 1153 | + $msg .= lang('Failed to change permissions of %1!', $path); |
|
| 1156 | 1154 | } |
| 1157 | 1155 | } |
| 1158 | 1156 | } |
| 1159 | 1157 | } |
| 1160 | 1158 | if ($props) |
| 1161 | 1159 | { |
| 1162 | - if (Vfs::proppatch($path,$props)) |
|
| 1160 | + if (Vfs::proppatch($path, $props)) |
|
| 1163 | 1161 | { |
| 1164 | - foreach($props as $prop) |
|
| 1162 | + foreach ($props as $prop) |
|
| 1165 | 1163 | { |
| 1166 | 1164 | $content['old'][$prop['name']] = $prop['val']; |
| 1167 | 1165 | } |
@@ -1178,8 +1176,8 @@ discard block |
||
| 1178 | 1176 | if ($content['eacl']['delete']) |
| 1179 | 1177 | { |
| 1180 | 1178 | list($ino_owner) = each($content['eacl']['delete']); |
| 1181 | - list(, $owner) = explode('-',$ino_owner,2); // $owner is a group and starts with a minus! |
|
| 1182 | - $msg .= Vfs::eacl($path,null,$owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); |
|
| 1179 | + list(, $owner) = explode('-', $ino_owner, 2); // $owner is a group and starts with a minus! |
|
| 1180 | + $msg .= Vfs::eacl($path, null, $owner) ? lang('ACL deleted.') : lang('Error deleting the ACL entry!'); |
|
| 1183 | 1181 | } |
| 1184 | 1182 | elseif ($button == 'eacl') |
| 1185 | 1183 | { |
@@ -1189,7 +1187,7 @@ discard block |
||
| 1189 | 1187 | } |
| 1190 | 1188 | else |
| 1191 | 1189 | { |
| 1192 | - $msg .= Vfs::eacl($path,$content['eacl']['rights'],$content['eacl_owner']) ? |
|
| 1190 | + $msg .= Vfs::eacl($path, $content['eacl']['rights'], $content['eacl_owner']) ? |
|
| 1193 | 1191 | lang('ACL added.') : lang('Error adding the ACL!'); |
| 1194 | 1192 | } |
| 1195 | 1193 | } |
@@ -1199,7 +1197,7 @@ discard block |
||
| 1199 | 1197 | } |
| 1200 | 1198 | if ($content['is_link'] && !Vfs::stat($path)) |
| 1201 | 1199 | { |
| 1202 | - $msg .= ($msg ? "\n" : '').lang('Link target %1 not found!',$content['symlink']); |
|
| 1200 | + $msg .= ($msg ? "\n" : '').lang('Link target %1 not found!', $content['symlink']); |
|
| 1203 | 1201 | } |
| 1204 | 1202 | $content['link'] = Egw::link(Vfs::download_url($path)); |
| 1205 | 1203 | $content['icon'] = Vfs::mime_icon($content['mime']); |
@@ -1208,10 +1206,10 @@ discard block |
||
| 1208 | 1206 | if (($readonlys['uid'] = !Vfs::$is_root) && !$content['uid']) $content['ro_uid_root'] = 'root'; |
| 1209 | 1207 | // only owner can change group & perms |
| 1210 | 1208 | if (($readonlys['gid'] = !$content['is_owner'] || |
| 1211 | - Vfs::parse_url(Vfs::resolve_url($content['path']),PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs |
|
| 1209 | + Vfs::parse_url(Vfs::resolve_url($content['path']), PHP_URL_SCHEME) == 'oldvfs')) // no uid, gid or perms in oldvfs |
|
| 1212 | 1210 | { |
| 1213 | 1211 | if (!$content['gid']) $content['ro_gid_root'] = 'root'; |
| 1214 | - foreach($content['perms'] as $name => $value) |
|
| 1212 | + foreach ($content['perms'] as $name => $value) |
|
| 1215 | 1213 | { |
| 1216 | 1214 | $readonlys['perms['.$name.']'] = true; |
| 1217 | 1215 | } |
@@ -1229,37 +1227,37 @@ discard block |
||
| 1229 | 1227 | } |
| 1230 | 1228 | elseif (!Vfs::is_writable($path)) |
| 1231 | 1229 | { |
| 1232 | - foreach($cfs as $name => $data) |
|
| 1230 | + foreach ($cfs as $name => $data) |
|
| 1233 | 1231 | { |
| 1234 | 1232 | $readonlys['#'.$name] = true; |
| 1235 | 1233 | } |
| 1236 | 1234 | } |
| 1237 | - $readonlys['tabs']['filemanager.file.eacl'] = true; // eacl off by default |
|
| 1235 | + $readonlys['tabs']['filemanager.file.eacl'] = true; // eacl off by default |
|
| 1238 | 1236 | if ($content['is_dir']) |
| 1239 | 1237 | { |
| 1240 | - $readonlys['tabs']['filemanager.file.preview'] = true; // no preview tab for dirs |
|
| 1241 | - $sel_options['rights']=$sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( |
|
| 1238 | + $readonlys['tabs']['filemanager.file.preview'] = true; // no preview tab for dirs |
|
| 1239 | + $sel_options['rights'] = $sel_options['owner'] = $sel_options['group'] = $sel_options['other'] = array( |
|
| 1242 | 1240 | 7 => lang('Display and modification of content'), |
| 1243 | 1241 | 5 => lang('Display of content'), |
| 1244 | 1242 | 0 => lang('No access'), |
| 1245 | 1243 | ); |
| 1246 | - if(($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) // backend supports eacl |
|
| 1244 | + if (($content['eacl'] = Vfs::get_eacl($content['path'])) !== false) // backend supports eacl |
|
| 1247 | 1245 | { |
| 1248 | - unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1249 | - foreach($content['eacl'] as &$eacl) |
|
| 1246 | + unset($readonlys['tabs']['filemanager.file.eacl']); // --> switch the tab on again |
|
| 1247 | + foreach ($content['eacl'] as &$eacl) |
|
| 1250 | 1248 | { |
| 1251 | - $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'],PHP_URL_PATH),'/'); |
|
| 1249 | + $eacl['path'] = rtrim(Vfs::parse_url($eacl['path'], PHP_URL_PATH), '/'); |
|
| 1252 | 1250 | $readonlys['delete['.$eacl['ino'].'-'.$eacl['owner'].']'] = $eacl['ino'] != $content['ino'] || |
| 1253 | 1251 | $eacl['path'] != $content['path'] || !$content['is_owner']; |
| 1254 | 1252 | } |
| 1255 | - array_unshift($content['eacl'],false); // make the keys start with 1, not 0 |
|
| 1253 | + array_unshift($content['eacl'], false); // make the keys start with 1, not 0 |
|
| 1256 | 1254 | $content['eacl']['owner'] = 0; |
| 1257 | 1255 | $content['eacl']['rights'] = 5; |
| 1258 | 1256 | } |
| 1259 | 1257 | } |
| 1260 | 1258 | else |
| 1261 | 1259 | { |
| 1262 | - $sel_options['owner']=$sel_options['group']=$sel_options['other'] = array( |
|
| 1260 | + $sel_options['owner'] = $sel_options['group'] = $sel_options['other'] = array( |
|
| 1263 | 1261 | 6 => lang('Read & write access'), |
| 1264 | 1262 | 4 => lang('Read access only'), |
| 1265 | 1263 | 0 => lang('No access'), |
@@ -1269,11 +1267,11 @@ discard block |
||
| 1269 | 1267 | // mergeapp |
| 1270 | 1268 | $content['mergeapp'] = static::get_mergeapp($path, 'self'); |
| 1271 | 1269 | $content['mergeapp_parent'] = static::get_mergeapp($path, 'parents'); |
| 1272 | - if(!empty($content['mergeapp'])) |
|
| 1270 | + if (!empty($content['mergeapp'])) |
|
| 1273 | 1271 | { |
| 1274 | 1272 | $content['mergeapp_effective'] = $content['mergeapp']; |
| 1275 | 1273 | } |
| 1276 | - elseif(!empty($content['mergeapp_parent'])) |
|
| 1274 | + elseif (!empty($content['mergeapp_parent'])) |
|
| 1277 | 1275 | { |
| 1278 | 1276 | $content['mergeapp_effective'] = $content['mergeapp_parent']; |
| 1279 | 1277 | } |
@@ -1285,7 +1283,7 @@ discard block |
||
| 1285 | 1283 | $mergeapp_list = Link::app_list('merge'); |
| 1286 | 1284 | unset($mergeapp_list[$GLOBALS['egw_info']['flags']['currentapp']]); // exclude filemanager from list |
| 1287 | 1285 | $mergeapp_empty = !empty($content['mergeapp_parent']) |
| 1288 | - ? $mergeapp_list[$content['mergeapp_parent']] . ' (parent setting)' : ''; |
|
| 1286 | + ? $mergeapp_list[$content['mergeapp_parent']].' (parent setting)' : ''; |
|
| 1289 | 1287 | $sel_options['mergeapp'] = array('' => $mergeapp_empty); |
| 1290 | 1288 | $sel_options['mergeapp'] = $sel_options['mergeapp'] + $mergeapp_list; |
| 1291 | 1289 | // mergeapp other gui options |
@@ -1302,7 +1300,7 @@ discard block |
||
| 1302 | 1300 | 'comment' => (string)$content['comment'], |
| 1303 | 1301 | 'mergeapp' => $content['mergeapp'] |
| 1304 | 1302 | ); |
| 1305 | - if ($cfs) foreach($cfs as $name => $data) |
|
| 1303 | + if ($cfs) foreach ($cfs as $name => $data) |
|
| 1306 | 1304 | { |
| 1307 | 1305 | $preserve['old']['#'.$name] = (string)$content['#'.$name]; |
| 1308 | 1306 | } |
@@ -1310,26 +1308,26 @@ discard block |
||
| 1310 | 1308 | if (Vfs::$is_root) |
| 1311 | 1309 | { |
| 1312 | 1310 | $tpl->setElementAttribute('sudouser', 'label', 'Logout'); |
| 1313 | - $tpl->setElementAttribute('sudouser', 'help','Log out as superuser'); |
|
| 1311 | + $tpl->setElementAttribute('sudouser', 'help', 'Log out as superuser'); |
|
| 1314 | 1312 | // Need a more complex submit because button type is buttononly, which doesn't submit |
| 1315 | - $tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"login")'); |
|
| 1313 | + $tpl->setElementAttribute('sudouser', 'onclick', 'app.filemanager.set_sudoButton(widget,"login")'); |
|
| 1316 | 1314 | |
| 1317 | 1315 | } |
| 1318 | 1316 | elseif ($button == 'sudo') |
| 1319 | 1317 | { |
| 1320 | 1318 | $tpl->setElementAttribute('sudouser', 'label', 'Superuser'); |
| 1321 | - $tpl->setElementAttribute('sudouser', 'help','Enter setup user and password to get root rights'); |
|
| 1322 | - $tpl->setElementAttribute('sudouser', 'onclick','app.filemanager.set_sudoButton(widget,"logout")'); |
|
| 1319 | + $tpl->setElementAttribute('sudouser', 'help', 'Enter setup user and password to get root rights'); |
|
| 1320 | + $tpl->setElementAttribute('sudouser', 'onclick', 'app.filemanager.set_sudoButton(widget,"logout")'); |
|
| 1323 | 1321 | } |
| 1324 | - if (($extra_tabs = Vfs::getExtraInfo($path,$content))) |
|
| 1322 | + if (($extra_tabs = Vfs::getExtraInfo($path, $content))) |
|
| 1325 | 1323 | { |
| 1326 | 1324 | // add to existing tabs in template |
| 1327 | 1325 | $tpl->setElementAttribute('tabs', 'add_tabs', true); |
| 1328 | 1326 | |
| 1329 | - $tabs =& $tpl->getElementAttribute('tabs','tabs'); |
|
| 1327 | + $tabs = & $tpl->getElementAttribute('tabs', 'tabs'); |
|
| 1330 | 1328 | if (true) $tabs = array(); |
| 1331 | 1329 | |
| 1332 | - foreach(isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 1330 | + foreach (isset($extra_tabs[0]) ? $extra_tabs : array($extra_tabs) as $extra_tab) |
|
| 1333 | 1331 | { |
| 1334 | 1332 | $tabs[] = array( |
| 1335 | 1333 | 'label' => $extra_tab['label'], |
@@ -1352,7 +1350,7 @@ discard block |
||
| 1352 | 1350 | Framework::window_focus(); |
| 1353 | 1351 | $GLOBALS['egw_info']['flags']['app_header'] = lang('Preferences').' '.Vfs::decodePath($path); |
| 1354 | 1352 | |
| 1355 | - $tpl->exec('filemanager.filemanager_ui.file',$content,$sel_options,$readonlys,$preserve,2); |
|
| 1353 | + $tpl->exec('filemanager.filemanager_ui.file', $content, $sel_options, $readonlys, $preserve, 2); |
|
| 1356 | 1354 | } |
| 1357 | 1355 | |
| 1358 | 1356 | /** |
@@ -1363,7 +1361,7 @@ discard block |
||
| 1363 | 1361 | * @param string $dir=null current directory |
| 1364 | 1362 | * @see static::action() |
| 1365 | 1363 | */ |
| 1366 | - public static function ajax_action($action, $selected, $dir=null, $props=null) |
|
| 1364 | + public static function ajax_action($action, $selected, $dir = null, $props = null) |
|
| 1367 | 1365 | { |
| 1368 | 1366 | // do we have root rights, need to run here too, as method is static and therefore does NOT run __construct |
| 1369 | 1367 | if (Api\Cache::getSession('filemanager', 'is_root')) |
@@ -1382,15 +1380,15 @@ discard block |
||
| 1382 | 1380 | |
| 1383 | 1381 | if (!isset($dir)) $dir = array_pop($selected); |
| 1384 | 1382 | |
| 1385 | - switch($action) |
|
| 1383 | + switch ($action) |
|
| 1386 | 1384 | { |
| 1387 | 1385 | case 'upload': |
| 1388 | 1386 | $script_error = 0; |
| 1389 | - foreach($selected as $tmp_name => &$data) |
|
| 1387 | + foreach ($selected as $tmp_name => &$data) |
|
| 1390 | 1388 | { |
| 1391 | 1389 | $path = Vfs::concat($dir, Vfs::encodePathComponent($data['name'])); |
| 1392 | 1390 | |
| 1393 | - if(Vfs::deny_script($path)) |
|
| 1391 | + if (Vfs::deny_script($path)) |
|
| 1394 | 1392 | { |
| 1395 | 1393 | if (!isset($script_error)) |
| 1396 | 1394 | { |
@@ -1412,7 +1410,7 @@ discard block |
||
| 1412 | 1410 | { |
| 1413 | 1411 | if (is_dir($GLOBALS['egw_info']['server']['temp_dir']) && is_writable($GLOBALS['egw_info']['server']['temp_dir'])) |
| 1414 | 1412 | { |
| 1415 | - $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'] . '/' . basename($tmp_name); |
|
| 1413 | + $tmp_path = $GLOBALS['egw_info']['server']['temp_dir'].'/'.basename($tmp_name); |
|
| 1416 | 1414 | } |
| 1417 | 1415 | else |
| 1418 | 1416 | { |
@@ -1447,16 +1445,16 @@ discard block |
||
| 1447 | 1445 | case 'link': |
| 1448 | 1446 | // First upload |
| 1449 | 1447 | $arr = static::ajax_action('upload', $selected, $dir, $props); |
| 1450 | - $app_dir = Link::vfs_path($props['entry']['app'],$props['entry']['id'],'',true); |
|
| 1448 | + $app_dir = Link::vfs_path($props['entry']['app'], $props['entry']['id'], '', true); |
|
| 1451 | 1449 | |
| 1452 | - foreach($arr['uploaded'] as $file) |
|
| 1450 | + foreach ($arr['uploaded'] as $file) |
|
| 1453 | 1451 | { |
| 1454 | - $target=Vfs::concat($dir,Vfs::encodePathComponent($file['name'])); |
|
| 1452 | + $target = Vfs::concat($dir, Vfs::encodePathComponent($file['name'])); |
|
| 1455 | 1453 | if (Vfs::file_exists($target) && $app_dir) |
| 1456 | 1454 | { |
| 1457 | 1455 | if (!Vfs::file_exists($app_dir)) Vfs::mkdir($app_dir); |
| 1458 | 1456 | error_log("Symlinking $target to $app_dir"); |
| 1459 | - Vfs::symlink($target, Vfs::concat($app_dir,Vfs::encodePathComponent($file['name']))); |
|
| 1457 | + Vfs::symlink($target, Vfs::concat($app_dir, Vfs::encodePathComponent($file['name']))); |
|
| 1460 | 1458 | } |
| 1461 | 1459 | } |
| 1462 | 1460 | // Must return to avoid adding to $response again |
@@ -1478,7 +1476,7 @@ discard block |
||
| 1478 | 1476 | */ |
| 1479 | 1477 | private function perms2mode(array $perms) |
| 1480 | 1478 | { |
| 1481 | - $mode = $perms['owner'] << 6 | $perms['group'] << 3 | $perms['other']; |
|
| 1479 | + $mode = $perms['owner'] << 6|$perms['group'] << 3|$perms['other']; |
|
| 1482 | 1480 | if ($mode['executable']) |
| 1483 | 1481 | { |
| 1484 | 1482 | $mode |= 0111; |
@@ -155,7 +155,7 @@ |
||
| 155 | 155 | * Get a list of the user's portlets, and their associated values & settings, for display |
| 156 | 156 | * |
| 157 | 157 | * Actual portlet content is provided by each portlet. |
| 158 | - * @param template etemplate so attributes can be set |
|
| 158 | + * @param template Etemplate so attributes can be set |
|
| 159 | 159 | */ |
| 160 | 160 | protected function get_user_portlets(Etemplate &$template) |
| 161 | 161 | { |
@@ -49,21 +49,21 @@ discard block |
||
| 49 | 49 | $content = array( |
| 50 | 50 | 'portlets' => $this->get_user_portlets($template) |
| 51 | 51 | ); |
| 52 | - $template->setElementAttribute('home.index','actions',$this->get_actions()); |
|
| 52 | + $template->setElementAttribute('home.index', 'actions', $this->get_actions()); |
|
| 53 | 53 | |
| 54 | 54 | $GLOBALS['egw_info']['flags']['app_header'] = lang('home'); |
| 55 | 55 | $GLOBALS['egw_info']['flags']['currentapp'] = 'home'; |
| 56 | 56 | |
| 57 | 57 | // Main screen message |
| 58 | 58 | Api\Translation::add_app('mainscreen'); |
| 59 | - $greeting = Api\Translation::translate('mainscreen_message',false,''); |
|
| 59 | + $greeting = Api\Translation::translate('mainscreen_message', false, ''); |
|
| 60 | 60 | |
| 61 | - if($greeting == 'mainscreen_message'|| empty($greeting)) |
|
| 61 | + if ($greeting == 'mainscreen_message' || empty($greeting)) |
|
| 62 | 62 | { |
| 63 | - Api\Translation::add_app('mainscreen','en'); // trying the en one |
|
| 64 | - $greeting = Api\Translation::translate('mainscreen_message',false,''); |
|
| 63 | + Api\Translation::add_app('mainscreen', 'en'); // trying the en one |
|
| 64 | + $greeting = Api\Translation::translate('mainscreen_message', false, ''); |
|
| 65 | 65 | } |
| 66 | - if(!($greeting == 'mainscreen_message'|| empty($greeting))) |
|
| 66 | + if (!($greeting == 'mainscreen_message' || empty($greeting))) |
|
| 67 | 67 | { |
| 68 | 68 | $content['mainscreen_message'] = $greeting; |
| 69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | // Now run the portlets themselves |
| 74 | 74 | $attrs = array(); |
| 75 | - foreach($content['portlets'] as $portlet => $p_data) |
|
| 75 | + foreach ($content['portlets'] as $portlet => $p_data) |
|
| 76 | 76 | { |
| 77 | 77 | $id = $p_data['id']; |
| 78 | 78 | |
| 79 | - if(!$id) continue; |
|
| 79 | + if (!$id) continue; |
|
| 80 | 80 | $portlet = $this->get_portlet($id, $p_data, $content, $attrs, true); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -94,15 +94,15 @@ discard block |
||
| 94 | 94 | $add_portlets = $portlets; |
| 95 | 95 | $change_for_add = function(&$add_portlets) use (&$change_for_add) |
| 96 | 96 | { |
| 97 | - foreach($add_portlets as $id => &$add) |
|
| 97 | + foreach ($add_portlets as $id => &$add) |
|
| 98 | 98 | { |
| 99 | - if(is_array($add['children'])) |
|
| 99 | + if (is_array($add['children'])) |
|
| 100 | 100 | { |
| 101 | 101 | $change_for_add($add['children']); |
| 102 | 102 | } |
| 103 | - if($id && !$add['children']) |
|
| 103 | + if ($id && !$add['children']) |
|
| 104 | 104 | { |
| 105 | - $add['id'] = 'add_' . $id; |
|
| 105 | + $add['id'] = 'add_'.$id; |
|
| 106 | 106 | $add['class'] = 'add_'.$id; |
| 107 | 107 | } |
| 108 | 108 | } |
@@ -121,10 +121,10 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | // Add all known portlets as drop actions too. If there are multiple matches, there will be a menu |
| 123 | 123 | $drop_execute = 'javaScript:app.home.add_from_drop'; |
| 124 | - foreach($portlets as $app => &$children) |
|
| 124 | + foreach ($portlets as $app => &$children) |
|
| 125 | 125 | { |
| 126 | 126 | // Home portlets - uses link system, so all apps that support that are accepted |
| 127 | - if(!$children['children']) |
|
| 127 | + if (!$children['children']) |
|
| 128 | 128 | { |
| 129 | 129 | $children['class'] = $app; |
| 130 | 130 | $children['onExecute'] = $drop_execute; |
@@ -133,11 +133,11 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | else |
| 135 | 135 | { |
| 136 | - foreach($children['children'] as $portlet => $app_portlet) |
|
| 136 | + foreach ($children['children'] as $portlet => $app_portlet) |
|
| 137 | 137 | { |
| 138 | - if(!is_array($app_portlet)) continue; |
|
| 138 | + if (!is_array($app_portlet)) continue; |
|
| 139 | 139 | $app_portlet['class'] = $portlet; |
| 140 | - $app_portlet['id'] = 'drop_' . $app_portlet['id']; |
|
| 140 | + $app_portlet['id'] = 'drop_'.$app_portlet['id']; |
|
| 141 | 141 | $app_portlet['onExecute'] = $drop_execute; |
| 142 | 142 | $app_portlet['acceptedTypes'] = $app; |
| 143 | 143 | $app_portlet['type'] = 'drop'; |
@@ -157,13 +157,13 @@ discard block |
||
| 157 | 157 | * Actual portlet content is provided by each portlet. |
| 158 | 158 | * @param template etemplate so attributes can be set |
| 159 | 159 | */ |
| 160 | - protected function get_user_portlets(Etemplate &$template) |
|
| 160 | + protected function get_user_portlets(Etemplate&$template) |
|
| 161 | 161 | { |
| 162 | 162 | $portlets = array(); |
| 163 | 163 | |
| 164 | - foreach((array)$GLOBALS['egw_info']['user']['preferences']['home']as $id => $context) |
|
| 164 | + foreach ((array)$GLOBALS['egw_info']['user']['preferences']['home']as $id => $context) |
|
| 165 | 165 | { |
| 166 | - if(strpos($id,'portlet_') !== 0 || // Not a portlet |
|
| 166 | + if (strpos($id, 'portlet_') !== 0 || // Not a portlet |
|
| 167 | 167 | in_array($id, array_keys($GLOBALS['egw_info']['user']['apps'])) || // Some other app put it's pref in here |
| 168 | 168 | !is_array($context) // Not a valid portlet (probably user deleted a default) |
| 169 | 169 | ) continue; |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | $classname = $context['class']; |
| 172 | 172 | |
| 173 | 173 | // Avoid portlets for apps user can't use (eg. from defaults/forced) |
| 174 | - list($app,$other) = explode('_',$classname); |
|
| 175 | - if(!$GLOBALS['egw_info']['apps'][$app]) $app .='_'.$other; |
|
| 176 | - if(!$GLOBALS['egw_info']['user']['apps'][$app]) { |
|
| 174 | + list($app, $other) = explode('_', $classname); |
|
| 175 | + if (!$GLOBALS['egw_info']['apps'][$app]) $app .= '_'.$other; |
|
| 176 | + if (!$GLOBALS['egw_info']['user']['apps'][$app]) { |
|
| 177 | 177 | continue; |
| 178 | 178 | } |
| 179 | 179 | |
@@ -187,12 +187,12 @@ discard block |
||
| 187 | 187 | // Get settings |
| 188 | 188 | // Exclude common attributes changed through UI and settings lacking a type |
| 189 | 189 | $settings = $portlet->get_properties(); |
| 190 | - foreach($settings as $key => $setting) |
|
| 190 | + foreach ($settings as $key => $setting) |
|
| 191 | 191 | { |
| 192 | - if(is_array($setting) && !array_key_exists('type',$setting)) unset($settings[$key]); |
|
| 192 | + if (is_array($setting) && !array_key_exists('type', $setting)) unset($settings[$key]); |
|
| 193 | 193 | } |
| 194 | 194 | $settings += $context; |
| 195 | - foreach(home_portlet::$common_attributes as $attr) |
|
| 195 | + foreach (home_portlet::$common_attributes as $attr) |
|
| 196 | 196 | { |
| 197 | 197 | unset($settings[$attr]); |
| 198 | 198 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | // Add in default for admins |
| 206 | 206 | self::create_default_actions($actions, $id); |
| 207 | 207 | |
| 208 | - $template->setElementAttribute("portlets[" . count($portlets) . "[$id]", 'actions', $actions); |
|
| 208 | + $template->setElementAttribute("portlets[".count($portlets)."[$id]", 'actions', $actions); |
|
| 209 | 209 | |
| 210 | 210 | $portlets[] = $portlet_content; |
| 211 | 211 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | protected function get_portlet($id, &$context, &$content, &$attributes, $full_exec = false) |
| 231 | 231 | { |
| 232 | - if(!$context['class']) $context['class'] = 'home_link_portlet'; |
|
| 232 | + if (!$context['class']) $context['class'] = 'home_link_portlet'; |
|
| 233 | 233 | |
| 234 | 234 | // This should be set already, but just in case the execution path |
| 235 | 235 | // is different from normal... |
| 236 | - if(Api\Json\Response::isJSONResponse()) |
|
| 236 | + if (Api\Json\Response::isJSONResponse()) |
|
| 237 | 237 | { |
| 238 | 238 | $GLOBALS['egw']->framework->response = Api\Json\Response::get(); |
| 239 | 239 | } |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | // Exclude common attributes changed through UI and settings lacking a type |
| 250 | 250 | $settings = $portlet->get_properties(); |
| 251 | - foreach($settings as $key => $setting) |
|
| 251 | + foreach ($settings as $key => $setting) |
|
| 252 | 252 | { |
| 253 | - if(is_array($setting) && !array_key_exists('type',$setting)) unset($settings[$key]); |
|
| 253 | + if (is_array($setting) && !array_key_exists('type', $setting)) unset($settings[$key]); |
|
| 254 | 254 | } |
| 255 | 255 | $settings += $context; |
| 256 | - foreach(home_portlet::$common_attributes as $attr) |
|
| 256 | + foreach (home_portlet::$common_attributes as $attr) |
|
| 257 | 257 | { |
| 258 | 258 | unset($settings[$attr]); |
| 259 | 259 | } |
@@ -268,31 +268,31 @@ discard block |
||
| 268 | 268 | self::create_default_actions($attributes['actions'], $id); |
| 269 | 269 | |
| 270 | 270 | // Set any provided common attributes (size, etc) |
| 271 | - foreach(home_portlet::$common_attributes as $name) |
|
| 271 | + foreach (home_portlet::$common_attributes as $name) |
|
| 272 | 272 | { |
| 273 | - if(array_key_exists($name, $context)) |
|
| 273 | + if (array_key_exists($name, $context)) |
|
| 274 | 274 | { |
| 275 | 275 | $attributes[$name] = $context[$name]; |
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | - foreach($attributes as $attr => $value) |
|
| 278 | + foreach ($attributes as $attr => $value) |
|
| 279 | 279 | { |
| 280 | 280 | $etemplate->setElementAttribute($id, $attr, $value); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // Make sure custom javascript is loaded |
| 284 | 284 | $appname = $context['appname']; |
| 285 | - if(!$appname) |
|
| 285 | + if (!$appname) |
|
| 286 | 286 | { |
| 287 | - list($app) = explode('_',$classname); |
|
| 288 | - if($GLOBALS['egw_info']['apps'][$app]) |
|
| 287 | + list($app) = explode('_', $classname); |
|
| 288 | + if ($GLOBALS['egw_info']['apps'][$app]) |
|
| 289 | 289 | { |
| 290 | 290 | $appname = $app; |
| 291 | 291 | } |
| 292 | 292 | } |
| 293 | 293 | Framework::includeJS('', $classname, $appname ? $appname : 'home'); |
| 294 | 294 | |
| 295 | - if($full_exec) |
|
| 295 | + if ($full_exec) |
|
| 296 | 296 | { |
| 297 | 297 | $content = $portlet->exec($id, $etemplate, $full_exec ? 2 : -1); |
| 298 | 298 | } |
@@ -309,23 +309,23 @@ discard block |
||
| 309 | 309 | protected function get_legacy_portlets(&$content, &$attributes) |
| 310 | 310 | { |
| 311 | 311 | $sorted_apps = array_keys($GLOBALS['egw_info']['user']['apps']); |
| 312 | - $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated', 'homepage_display'); |
|
| 312 | + $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents', 'homeShowLatest', 'mainscreen_showmail', 'mainscreen_showbirthdays', 'mainscreen_show_new_updated', 'homepage_display'); |
|
| 313 | 313 | |
| 314 | - foreach($sorted_apps as $appname) |
|
| 314 | + foreach ($sorted_apps as $appname) |
|
| 315 | 315 | { |
| 316 | 316 | // If there's already [new] settings, or no preference, skip it |
| 317 | - if($content[$appname]) continue; |
|
| 317 | + if ($content[$appname]) continue; |
|
| 318 | 318 | $no_pref = true; |
| 319 | - foreach($portal_oldvarnames as $varcheck) |
|
| 319 | + foreach ($portal_oldvarnames as $varcheck) |
|
| 320 | 320 | { |
| 321 | 321 | $thisd = $GLOBALS['egw_info']['user']['preferences'][$appname][$varcheck]; |
| 322 | - if($thisd) |
|
| 322 | + if ($thisd) |
|
| 323 | 323 | { |
| 324 | 324 | $no_pref = false; |
| 325 | 325 | break; |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | - if($no_pref || !Api\Hooks::exists('home', $appname)) |
|
| 328 | + if ($no_pref || !Api\Hooks::exists('home', $appname)) |
|
| 329 | 329 | { |
| 330 | 330 | continue; |
| 331 | 331 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | $_content = ''; |
| 337 | 337 | $_attributes = array(); |
| 338 | 338 | $this->get_portlet($appname, $context, $_content, $_attributes); |
| 339 | - if(trim($_content)) |
|
| 339 | + if (trim($_content)) |
|
| 340 | 340 | { |
| 341 | 341 | $content[$appname] = $_content; |
| 342 | 342 | $attributes[$appname] = $_attributes; |
@@ -355,24 +355,24 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | // Ignore some problem files and base classes that shouldn't be options |
| 357 | 357 | $ignore = array( |
| 358 | - '.','..', |
|
| 358 | + '.', '..', |
|
| 359 | 359 | 'class.home_portlet.inc.php', |
| 360 | 360 | 'class.home_legacy_portlet.inc.php', |
| 361 | 361 | 'class.home_favorite_portlet.inc.php' |
| 362 | 362 | ); |
| 363 | 363 | // Look through all known classes for portlets - for now, they need 'portlet' in the file name |
| 364 | - foreach(array_keys($GLOBALS['egw_info']['apps']) as $appname) |
|
| 364 | + foreach (array_keys($GLOBALS['egw_info']['apps']) as $appname) |
|
| 365 | 365 | { |
| 366 | - if(in_array($appname, array('phpgwapi', 'felamimail'))) continue; |
|
| 367 | - $files = (array)@scandir(EGW_SERVER_ROOT . '/'.$appname .'/inc/'); |
|
| 368 | - if(!$files) continue; |
|
| 366 | + if (in_array($appname, array('phpgwapi', 'felamimail'))) continue; |
|
| 367 | + $files = (array)@scandir(EGW_SERVER_ROOT.'/'.$appname.'/inc/'); |
|
| 368 | + if (!$files) continue; |
|
| 369 | 369 | |
| 370 | - foreach($files as $entry) |
|
| 370 | + foreach ($files as $entry) |
|
| 371 | 371 | { |
| 372 | - if (!in_array($entry, $ignore) && substr($entry,-8) == '.inc.php' && strpos($entry,'portlet')) |
|
| 372 | + if (!in_array($entry, $ignore) && substr($entry, -8) == '.inc.php' && strpos($entry, 'portlet')) |
|
| 373 | 373 | { |
| 374 | 374 | list(,$classname) = explode('.', $entry); |
| 375 | - if(class_exists($classname) && |
|
| 375 | + if (class_exists($classname) && |
|
| 376 | 376 | in_array('home_portlet', class_parents($classname, false))) |
| 377 | 377 | { |
| 378 | 378 | $classes[$appname][] = $classname; |
@@ -384,19 +384,19 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - if(!$classes[$appname]) continue; |
|
| 387 | + if (!$classes[$appname]) continue; |
|
| 388 | 388 | |
| 389 | 389 | // Build 'Add' actions for each discovered portlet. |
| 390 | 390 | // Portlets from other apps go in sub-actions |
| 391 | - $add_to =& $list; |
|
| 392 | - if($classes[$appname] && $appname != 'home') |
|
| 391 | + $add_to = & $list; |
|
| 392 | + if ($classes[$appname] && $appname != 'home') |
|
| 393 | 393 | { |
| 394 | 394 | $list[$appname] = array( |
| 395 | 395 | 'caption' => lang($appname), |
| 396 | 396 | ); |
| 397 | - $add_to =& $list[$appname]['children']; |
|
| 397 | + $add_to = & $list[$appname]['children']; |
|
| 398 | 398 | } |
| 399 | - foreach($classes[$appname] as $portlet) |
|
| 399 | + foreach ($classes[$appname] as $portlet) |
|
| 400 | 400 | { |
| 401 | 401 | $instance = new $portlet(); |
| 402 | 402 | $desc = $instance->get_description(); |
@@ -416,10 +416,10 @@ discard block |
||
| 416 | 416 | }, array(), 60); |
| 417 | 417 | |
| 418 | 418 | // Filter list by current user's permissions |
| 419 | - foreach(array_keys($list) as $appname) |
|
| 419 | + foreach (array_keys($list) as $appname) |
|
| 420 | 420 | { |
| 421 | - if(in_array($appname, array_keys($GLOBALS['egw_info']['apps']))) { |
|
| 422 | - if(!in_array($appname, array_keys($GLOBALS['egw_info']['user']['apps']))) |
|
| 421 | + if (in_array($appname, array_keys($GLOBALS['egw_info']['apps']))) { |
|
| 422 | + if (!in_array($appname, array_keys($GLOBALS['egw_info']['user']['apps']))) |
|
| 423 | 423 | { |
| 424 | 424 | unset($list[$appname]); |
| 425 | 425 | } |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | */ |
| 437 | 437 | protected static function create_default_actions(&$actions, $portlet_id = null) |
| 438 | 438 | { |
| 439 | - if($GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 439 | + if ($GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 440 | 440 | { |
| 441 | 441 | $actions['add_default'] = array( |
| 442 | 442 | 'type' => 'popup', |
@@ -446,25 +446,25 @@ discard block |
||
| 446 | 446 | 'icon' => 'preference' |
| 447 | 447 | ); |
| 448 | 448 | // Customize for the given portlet |
| 449 | - if($portlet_id !== null) |
|
| 449 | + if ($portlet_id !== null) |
|
| 450 | 450 | { |
| 451 | - foreach(array('forced','group','default') as $location) |
|
| 451 | + foreach (array('forced', 'group', 'default') as $location) |
|
| 452 | 452 | { |
| 453 | 453 | $loc = $GLOBALS['egw']->preferences->$location; |
| 454 | 454 | |
| 455 | - if($loc['home'][$portlet_id]) |
|
| 455 | + if ($loc['home'][$portlet_id]) |
|
| 456 | 456 | { |
| 457 | 457 | // If it's forced, no point in setting default |
| 458 | - if($location == 'forced') |
|
| 458 | + if ($location == 'forced') |
|
| 459 | 459 | { |
| 460 | 460 | unset($actions['add_default']); |
| 461 | 461 | } |
| 462 | 462 | // If it's a group, we'd like to know which |
| 463 | - if($location == 'group') |
|
| 463 | + if ($location == 'group') |
|
| 464 | 464 | { |
| 465 | 465 | $options = array('account_type' => 'groups'); |
| 466 | - $groups = Api\Accounts::link_query('',$options); |
|
| 467 | - foreach(array_keys($groups) as $gid) |
|
| 466 | + $groups = Api\Accounts::link_query('', $options); |
|
| 467 | + foreach (array_keys($groups) as $gid) |
|
| 468 | 468 | { |
| 469 | 469 | $prefs = new Api\Preferences($gid); |
| 470 | 470 | $prefs->read_repository(); |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | $actions['remove_default_'.$location] = array( |
| 479 | 479 | 'type' => 'popup', |
| 480 | - 'caption' => lang('Remove as default for %1',is_numeric($location) ? Api\Accounts::id2name($location,'account_fullname') : $location), |
|
| 480 | + 'caption' => lang('Remove as default for %1', is_numeric($location) ? Api\Accounts::id2name($location, 'account_fullname') : $location), |
|
| 481 | 481 | 'onExecute' => 'javaScript:app.home.set_default', |
| 482 | 482 | 'group' => 'Admins', |
| 483 | 483 | 'portlet_group' => $location |
@@ -488,14 +488,14 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Change action for forced |
| 491 | - if($portlet_id && $GLOBALS['egw']->preferences->forced['home'][$portlet_id]) |
|
| 491 | + if ($portlet_id && $GLOBALS['egw']->preferences->forced['home'][$portlet_id]) |
|
| 492 | 492 | { |
| 493 | 493 | // No one can remove it |
| 494 | 494 | $actions['remove_portlet']['enabled'] = false; |
| 495 | - $actions['remove_portlet']['caption'] .= ' ('.lang('Forced') .')'; |
|
| 495 | + $actions['remove_portlet']['caption'] .= ' ('.lang('Forced').')'; |
|
| 496 | 496 | |
| 497 | 497 | // Non-admins can't edit it |
| 498 | - if($actions['edit_settings'] && !$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 498 | + if ($actions['edit_settings'] && !$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 499 | 499 | { |
| 500 | 500 | $actions['edit_settings']['enabled'] = false; |
| 501 | 501 | $actions['edit_settings']['visible'] = false; |
@@ -514,14 +514,14 @@ discard block |
||
| 514 | 514 | public function ajax_set_properties($portlet_id, $attributes, $values, $group = false) |
| 515 | 515 | { |
| 516 | 516 | //error_log(__METHOD__ . "($portlet_id, " .array2string($attributes).','.array2string($values).",$group)"); |
| 517 | - if(!$attributes) |
|
| 517 | + if (!$attributes) |
|
| 518 | 518 | { |
| 519 | 519 | $attributes = array(); |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - if(!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 522 | + if (!$GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 523 | 523 | { |
| 524 | - if($group == 'forced') |
|
| 524 | + if ($group == 'forced') |
|
| 525 | 525 | { |
| 526 | 526 | // Quietly reject |
| 527 | 527 | return; |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | // Not an admin, can only override. |
| 530 | 530 | $group = false; |
| 531 | 531 | } |
| 532 | - if($group && $GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 532 | + if ($group && $GLOBALS['egw_info']['user']['apps']['admin']) |
|
| 533 | 533 | { |
| 534 | 534 | $prefs = new Api\Preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']); |
| 535 | 535 | } |
@@ -543,23 +543,23 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | $response = Api\Json\Response::get(); |
| 545 | 545 | |
| 546 | - if($values =='~reload~') |
|
| 546 | + if ($values == '~reload~') |
|
| 547 | 547 | { |
| 548 | 548 | $full_exec = true; |
| 549 | 549 | $values = array(); |
| 550 | 550 | } |
| 551 | - if($values == '~remove~') |
|
| 551 | + if ($values == '~remove~') |
|
| 552 | 552 | { |
| 553 | 553 | // Already removed client side, needs to be removed permanently |
| 554 | - $default = $prefs->default_prefs('home',$portlet_id) || $prefs->group['home'][$portlet_id]; |
|
| 554 | + $default = $prefs->default_prefs('home', $portlet_id) || $prefs->group['home'][$portlet_id]; |
|
| 555 | 555 | |
| 556 | - if($default) |
|
| 556 | + if ($default) |
|
| 557 | 557 | { |
| 558 | 558 | // Can't delete forced - not a UI option though |
| 559 | - if(!$GLOBALS['egw']->preferences->forced['home'][$portlet_id]) |
|
| 559 | + if (!$GLOBALS['egw']->preferences->forced['home'][$portlet_id]) |
|
| 560 | 560 | { |
| 561 | 561 | // Set a flag to override default instead of just delete |
| 562 | - $GLOBALS['egw']->preferences->add('home',$portlet_id, 'deleted'); |
|
| 562 | + $GLOBALS['egw']->preferences->add('home', $portlet_id, 'deleted'); |
|
| 563 | 563 | $GLOBALS['egw']->preferences->save_repository(); |
| 564 | 564 | } |
| 565 | 565 | } |
@@ -576,19 +576,19 @@ discard block |
||
| 576 | 576 | // Remove some constant stuff that winds up here |
| 577 | 577 | unset($values['edit_template']); |
| 578 | 578 | unset($values['readonly']); |
| 579 | - unset($values['disabled']);unset($values['no_lang']); |
|
| 579 | + unset($values['disabled']); unset($values['no_lang']); |
|
| 580 | 580 | unset($values['actions']); |
| 581 | 581 | unset($values['statustext']); |
| 582 | - unset($values['type']);unset($values['label']);unset($values['status']); |
|
| 583 | - unset($values['value']);unset($values['align']); |
|
| 582 | + unset($values['type']); unset($values['label']); unset($values['status']); |
|
| 583 | + unset($values['value']); unset($values['align']); |
|
| 584 | 584 | |
| 585 | 585 | // Get portlet settings, and merge new with old |
| 586 | 586 | $context = array_merge((array)$portlets[$portlet_id], $values); |
| 587 | 587 | $context['group'] = $group; |
| 588 | 588 | |
| 589 | 589 | // Handle add IDs |
| 590 | - $classname =& $context['class']; |
|
| 591 | - if(strpos($classname,'add_') == 0 && !class_exists($classname)) |
|
| 590 | + $classname = & $context['class']; |
|
| 591 | + if (strpos($classname, 'add_') == 0 && !class_exists($classname)) |
|
| 592 | 592 | { |
| 593 | 593 | $add = true; |
| 594 | 594 | $classname = substr($classname, 4); |
@@ -597,13 +597,13 @@ discard block |
||
| 597 | 597 | $portlet = $this->get_portlet($portlet_id, $context, $content, $attributes, $full_exec); |
| 598 | 598 | |
| 599 | 599 | $context['class'] = get_class($portlet); |
| 600 | - foreach($portlet->get_properties() as $property) |
|
| 600 | + foreach ($portlet->get_properties() as $property) |
|
| 601 | 601 | { |
| 602 | - if($values[$property['name']]) |
|
| 602 | + if ($values[$property['name']]) |
|
| 603 | 603 | { |
| 604 | 604 | $context[$property['name']] = $values[$property['name']]; |
| 605 | 605 | } |
| 606 | - elseif($portlets[$portlet_id][$property['name']]) |
|
| 606 | + elseif ($portlets[$portlet_id][$property['name']]) |
|
| 607 | 607 | { |
| 608 | 608 | $context[$property['name']] = $portlets[$portlet_id][$property['name']]; |
| 609 | 609 | } |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | $update = array('attributes' => $attributes); |
| 614 | 614 | |
| 615 | 615 | // New portlet? Flag going straight to edit mode |
| 616 | - if($add) |
|
| 616 | + if ($add) |
|
| 617 | 617 | { |
| 618 | 618 | $update['edit_settings'] = true; |
| 619 | 619 | } |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | // Save updated preferences |
| 628 | - $prefs->save_repository(True,$type); |
|
| 628 | + $prefs->save_repository(True, $type); |
|
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | /** |
@@ -638,10 +638,10 @@ discard block |
||
| 638 | 638 | public static function ajax_set_default($action, $portlet_ids, $group) |
| 639 | 639 | { |
| 640 | 640 | // Admins only |
| 641 | - if(!$GLOBALS['egw_info']['apps']['admin']) return; |
|
| 641 | + if (!$GLOBALS['egw_info']['apps']['admin']) return; |
|
| 642 | 642 | |
| 643 | 643 | // Load the appropriate group |
| 644 | - if($group) |
|
| 644 | + if ($group) |
|
| 645 | 645 | { |
| 646 | 646 | $prefs = new Api\Preferences(is_numeric($group) ? $group : $GLOBALS['egw_info']['user']['account_id']); |
| 647 | 647 | } |
@@ -653,30 +653,30 @@ discard block |
||
| 653 | 653 | |
| 654 | 654 | $type = is_numeric($group) ? "user" : $group; |
| 655 | 655 | |
| 656 | - if($action == 'add') |
|
| 656 | + if ($action == 'add') |
|
| 657 | 657 | { |
| 658 | - foreach($portlet_ids as $id) |
|
| 658 | + foreach ($portlet_ids as $id) |
|
| 659 | 659 | { |
| 660 | 660 | Api\Json\Response::get()->call('egw.message', lang("Set default")); |
| 661 | 661 | // Current user is setting the default, copy their settings |
| 662 | 662 | $settings = $GLOBALS['egw_info']['user']['preferences']['home'][$id]; |
| 663 | 663 | $settings['group'] = $group; |
| 664 | - $prefs->add('home',$id,$settings,$type); |
|
| 664 | + $prefs->add('home', $id, $settings, $type); |
|
| 665 | 665 | |
| 666 | 666 | // Remove user's copy |
| 667 | - $GLOBALS['egw']->preferences->delete('home',$id); |
|
| 667 | + $GLOBALS['egw']->preferences->delete('home', $id); |
|
| 668 | 668 | $GLOBALS['egw']->preferences->save_repository(true); |
| 669 | 669 | } |
| 670 | 670 | } |
| 671 | 671 | else if ($action == "delete") |
| 672 | 672 | { |
| 673 | - foreach($portlet_ids as $id) |
|
| 673 | + foreach ($portlet_ids as $id) |
|
| 674 | 674 | { |
| 675 | 675 | Api\Json\Response::get()->call('egw.message', lang("Removed default")); |
| 676 | - $prefs->delete('home',$id, $type); |
|
| 676 | + $prefs->delete('home', $id, $type); |
|
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | - $prefs->save_repository(false,$type); |
|
| 679 | + $prefs->save_repository(false, $type); |
|
| 680 | 680 | |
| 681 | 681 | // Update Api\Preferences client side for consistency |
| 682 | 682 | $prefs = $GLOBALS['egw']->preferences; |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | 'state' => array( |
| 730 | 730 | 'cat_id' => '0', |
| 731 | 731 | 'filter' => 'default', |
| 732 | - 'owner' => 0, // current user |
|
| 732 | + 'owner' => 0, // current user |
|
| 733 | 733 | 'sortby' => 'user', |
| 734 | 734 | 'planner_days' => '0', |
| 735 | 735 | 'view' => 'week', |
@@ -778,9 +778,9 @@ discard block |
||
| 778 | 778 | { |
| 779 | 779 | unset($app_prefs['home']['portlet_setup142n']); |
| 780 | 780 | } |
| 781 | - foreach($app_prefs as $app => $prefs) |
|
| 781 | + foreach ($app_prefs as $app => $prefs) |
|
| 782 | 782 | { |
| 783 | - foreach($prefs as $name => $value) |
|
| 783 | + foreach ($prefs as $name => $value) |
|
| 784 | 784 | { |
| 785 | 785 | Api\Preferences::delete_preference($app, $name, 'default'); |
| 786 | 786 | $preferences->add($app, $name, $value, 'default'); |
@@ -801,10 +801,10 @@ discard block |
||
| 801 | 801 | */ |
| 802 | 802 | public static function setup_default_home() |
| 803 | 803 | { |
| 804 | - switch($GLOBALS['egw_info']['server'][self::HOME_VERSION]) |
|
| 804 | + switch ($GLOBALS['egw_info']['server'][self::HOME_VERSION]) |
|
| 805 | 805 | { |
| 806 | 806 | case self::CURRENT_HOME_VERSION: |
| 807 | - return; // already up to date --> nothing to do |
|
| 807 | + return; // already up to date --> nothing to do |
|
| 808 | 808 | |
| 809 | 809 | default: |
| 810 | 810 | call_user_func(array(__CLASS__, 'setup_default_home_'.str_replace('.', '_', self::CURRENT_HOME_VERSION))); |
@@ -76,7 +76,10 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | $id = $p_data['id']; |
| 78 | 78 | |
| 79 | - if(!$id) continue; |
|
| 79 | + if(!$id) |
|
| 80 | + { |
|
| 81 | + continue; |
|
| 82 | + } |
|
| 80 | 83 | $portlet = $this->get_portlet($id, $p_data, $content, $attrs, true); |
| 81 | 84 | } |
| 82 | 85 | |
@@ -135,7 +138,10 @@ discard block |
||
| 135 | 138 | { |
| 136 | 139 | foreach($children['children'] as $portlet => $app_portlet) |
| 137 | 140 | { |
| 138 | - if(!is_array($app_portlet)) continue; |
|
| 141 | + if(!is_array($app_portlet)) |
|
| 142 | + { |
|
| 143 | + continue; |
|
| 144 | + } |
|
| 139 | 145 | $app_portlet['class'] = $portlet; |
| 140 | 146 | $app_portlet['id'] = 'drop_' . $app_portlet['id']; |
| 141 | 147 | $app_portlet['onExecute'] = $drop_execute; |
@@ -166,14 +172,21 @@ discard block |
||
| 166 | 172 | if(strpos($id,'portlet_') !== 0 || // Not a portlet |
| 167 | 173 | in_array($id, array_keys($GLOBALS['egw_info']['user']['apps'])) || // Some other app put it's pref in here |
| 168 | 174 | !is_array($context) // Not a valid portlet (probably user deleted a default) |
| 169 | - ) continue; |
|
| 175 | + ) |
|
| 176 | + { |
|
| 177 | + continue; |
|
| 178 | + } |
|
| 170 | 179 | |
| 171 | 180 | $classname = $context['class']; |
| 172 | 181 | |
| 173 | 182 | // Avoid portlets for apps user can't use (eg. from defaults/forced) |
| 174 | 183 | list($app,$other) = explode('_',$classname); |
| 175 | - if(!$GLOBALS['egw_info']['apps'][$app]) $app .='_'.$other; |
|
| 176 | - if(!$GLOBALS['egw_info']['user']['apps'][$app]) { |
|
| 184 | + if(!$GLOBALS['egw_info']['apps'][$app]) |
|
| 185 | + { |
|
| 186 | + $app .='_'.$other; |
|
| 187 | + } |
|
| 188 | + if(!$GLOBALS['egw_info']['user']['apps'][$app]) |
|
| 189 | + { |
|
| 177 | 190 | continue; |
| 178 | 191 | } |
| 179 | 192 | |
@@ -189,7 +202,10 @@ discard block |
||
| 189 | 202 | $settings = $portlet->get_properties(); |
| 190 | 203 | foreach($settings as $key => $setting) |
| 191 | 204 | { |
| 192 | - if(is_array($setting) && !array_key_exists('type',$setting)) unset($settings[$key]); |
|
| 205 | + if(is_array($setting) && !array_key_exists('type',$setting)) |
|
| 206 | + { |
|
| 207 | + unset($settings[$key]); |
|
| 208 | + } |
|
| 193 | 209 | } |
| 194 | 210 | $settings += $context; |
| 195 | 211 | foreach(home_portlet::$common_attributes as $attr) |
@@ -229,7 +245,10 @@ discard block |
||
| 229 | 245 | */ |
| 230 | 246 | protected function get_portlet($id, &$context, &$content, &$attributes, $full_exec = false) |
| 231 | 247 | { |
| 232 | - if(!$context['class']) $context['class'] = 'home_link_portlet'; |
|
| 248 | + if(!$context['class']) |
|
| 249 | + { |
|
| 250 | + $context['class'] = 'home_link_portlet'; |
|
| 251 | + } |
|
| 233 | 252 | |
| 234 | 253 | // This should be set already, but just in case the execution path |
| 235 | 254 | // is different from normal... |
@@ -250,7 +269,10 @@ discard block |
||
| 250 | 269 | $settings = $portlet->get_properties(); |
| 251 | 270 | foreach($settings as $key => $setting) |
| 252 | 271 | { |
| 253 | - if(is_array($setting) && !array_key_exists('type',$setting)) unset($settings[$key]); |
|
| 272 | + if(is_array($setting) && !array_key_exists('type',$setting)) |
|
| 273 | + { |
|
| 274 | + unset($settings[$key]); |
|
| 275 | + } |
|
| 254 | 276 | } |
| 255 | 277 | $settings += $context; |
| 256 | 278 | foreach(home_portlet::$common_attributes as $attr) |
@@ -314,7 +336,10 @@ discard block |
||
| 314 | 336 | foreach($sorted_apps as $appname) |
| 315 | 337 | { |
| 316 | 338 | // If there's already [new] settings, or no preference, skip it |
| 317 | - if($content[$appname]) continue; |
|
| 339 | + if($content[$appname]) |
|
| 340 | + { |
|
| 341 | + continue; |
|
| 342 | + } |
|
| 318 | 343 | $no_pref = true; |
| 319 | 344 | foreach($portal_oldvarnames as $varcheck) |
| 320 | 345 | { |
@@ -349,7 +374,8 @@ discard block |
||
| 349 | 374 | */ |
| 350 | 375 | protected function get_portlet_list() |
| 351 | 376 | { |
| 352 | - $list = Api\Cache::getTree('home', 'portlet_classes', function() { |
|
| 377 | + $list = Api\Cache::getTree('home', 'portlet_classes', function() |
|
| 378 | + { |
|
| 353 | 379 | $list = array(); |
| 354 | 380 | $classes = array(); |
| 355 | 381 | |
@@ -363,9 +389,15 @@ discard block |
||
| 363 | 389 | // Look through all known classes for portlets - for now, they need 'portlet' in the file name |
| 364 | 390 | foreach(array_keys($GLOBALS['egw_info']['apps']) as $appname) |
| 365 | 391 | { |
| 366 | - if(in_array($appname, array('phpgwapi', 'felamimail'))) continue; |
|
| 392 | + if(in_array($appname, array('phpgwapi', 'felamimail'))) |
|
| 393 | + { |
|
| 394 | + continue; |
|
| 395 | + } |
|
| 367 | 396 | $files = (array)@scandir(EGW_SERVER_ROOT . '/'.$appname .'/inc/'); |
| 368 | - if(!$files) continue; |
|
| 397 | + if(!$files) |
|
| 398 | + { |
|
| 399 | + continue; |
|
| 400 | + } |
|
| 369 | 401 | |
| 370 | 402 | foreach($files as $entry) |
| 371 | 403 | { |
@@ -384,7 +416,10 @@ discard block |
||
| 384 | 416 | } |
| 385 | 417 | } |
| 386 | 418 | |
| 387 | - if(!$classes[$appname]) continue; |
|
| 419 | + if(!$classes[$appname]) |
|
| 420 | + { |
|
| 421 | + continue; |
|
| 422 | + } |
|
| 388 | 423 | |
| 389 | 424 | // Build 'Add' actions for each discovered portlet. |
| 390 | 425 | // Portlets from other apps go in sub-actions |
@@ -418,7 +453,8 @@ discard block |
||
| 418 | 453 | // Filter list by current user's permissions |
| 419 | 454 | foreach(array_keys($list) as $appname) |
| 420 | 455 | { |
| 421 | - if(in_array($appname, array_keys($GLOBALS['egw_info']['apps']))) { |
|
| 456 | + if(in_array($appname, array_keys($GLOBALS['egw_info']['apps']))) |
|
| 457 | + { |
|
| 422 | 458 | if(!in_array($appname, array_keys($GLOBALS['egw_info']['user']['apps']))) |
| 423 | 459 | { |
| 424 | 460 | unset($list[$appname]); |
@@ -638,7 +674,10 @@ discard block |
||
| 638 | 674 | public static function ajax_set_default($action, $portlet_ids, $group) |
| 639 | 675 | { |
| 640 | 676 | // Admins only |
| 641 | - if(!$GLOBALS['egw_info']['apps']['admin']) return; |
|
| 677 | + if(!$GLOBALS['egw_info']['apps']['admin']) |
|
| 678 | + { |
|
| 679 | + return; |
|
| 680 | + } |
|
| 642 | 681 | |
| 643 | 682 | // Load the appropriate group |
| 644 | 683 | if($group) |
@@ -701,7 +740,10 @@ discard block |
||
| 701 | 740 | $preferences = $GLOBALS['egw']->preferences; |
| 702 | 741 | $preferences->read_repository(); |
| 703 | 742 | $lang = $preferences->default['common']['lang']; |
| 704 | - if (empty($lang)) $lang = 'en'; |
|
| 743 | + if (empty($lang)) |
|
| 744 | + { |
|
| 745 | + $lang = 'en'; |
|
| 746 | + } |
|
| 705 | 747 | |
| 706 | 748 | Api\Translation::add_app('calendar', $lang); |
| 707 | 749 | $weekview = lang('Weekview'); |