@@ -570,8 +570,7 @@ discard block |
||
570 | 570 | $rule = explode('=', $rule); |
571 | 571 | if (empty($rule[1])) { |
572 | 572 | form_set_error('elysia_cron_default_rules', t('Invalid rule: %rule', array('%rule' => $rule[0]))); |
573 | - } |
|
574 | - elseif (!preg_match('/^\\s*([0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+)\\s*$/', trim($rule[1]))) { |
|
573 | + } elseif (!preg_match('/^\\s*([0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+[ ]+[0-9*,\/-]+)\\s*$/', trim($rule[1]))) { |
|
575 | 574 | form_set_error('elysia_cron_default_rules', t('Invalid rule: %rule', array('%rule' => $rule[0]))); |
576 | 575 | } |
577 | 576 | } |
@@ -602,15 +601,13 @@ discard block |
||
602 | 601 | if (!preg_match('/^_elysia_cron_([^_]+_[^_]+)_(.*)$/', $key, $r)) { |
603 | 602 | if ($op == t('Reset to defaults') || ($key != 'cron_safe_threshold' && !$value)) { |
604 | 603 | variable_del($key); |
605 | - } |
|
606 | - elseif ($key != 'elysia_cron_default_rules') { |
|
604 | + } elseif ($key != 'elysia_cron_default_rules') { |
|
607 | 605 | if (is_array($value) && isset($form_values['array_filter'])) { |
608 | 606 | $value = array_keys(array_filter($value)); |
609 | 607 | } |
610 | 608 | variable_set($key, $value); |
611 | 609 | } |
612 | - } |
|
613 | - else { |
|
610 | + } else { |
|
614 | 611 | $nullvalue = $r[1] != 'job_weight' ? !$value : !$value && $value !== '0'; |
615 | 612 | |
616 | 613 | //dprint($r[1].' '.$r[1].' '.$r[2]); |
@@ -635,8 +632,7 @@ discard block |
||
635 | 632 | elysia_cron_reset_channel_rule($r[2]); |
636 | 633 | break; |
637 | 634 | } |
638 | - } |
|
639 | - else { |
|
635 | + } else { |
|
640 | 636 | switch ($r[1]) { |
641 | 637 | case 'job_channel': |
642 | 638 | elysia_cron_set_job_channel($r[2], $value); |
@@ -650,8 +646,7 @@ discard block |
||
650 | 646 | if ($value != 'custom') { |
651 | 647 | if ($value == 'default') { |
652 | 648 | elysia_cron_reset_job_rule($r[2]); |
653 | - } |
|
654 | - else { |
|
649 | + } else { |
|
655 | 650 | elysia_cron_set_job_rule($r[2], $value); |
656 | 651 | } |
657 | 652 | } |
@@ -675,8 +670,7 @@ discard block |
||
675 | 670 | } |
676 | 671 | if ($op == t('Reset to defaults')) { |
677 | 672 | drupal_set_message(t('The configuration options have been reset to their default values.')); |
678 | - } |
|
679 | - else { |
|
673 | + } else { |
|
680 | 674 | drupal_set_message(t('The configuration options have been saved.')); |
681 | 675 | } |
682 | 676 | } |
@@ -702,8 +696,7 @@ discard block |
||
702 | 696 | // Run cron manually from Cron form. |
703 | 697 | if (elysia_cron_run()) { |
704 | 698 | drupal_set_message(t('Cron run successfully.')); |
705 | - } |
|
706 | - else { |
|
699 | + } else { |
|
707 | 700 | drupal_set_message(t('Cron run failed.'), 'error'); |
708 | 701 | } |
709 | 702 | |
@@ -722,8 +715,7 @@ discard block |
||
722 | 715 | if (elysia_cron_is_job_running($job, false)) { |
723 | 716 | if (time() - elysia_cron_get_job_last_run($job, 0) > variable_get('elysia_cron_stuck_time', 3600)) { |
724 | 717 | drupal_set_message(t('Job %job already running, but is probably stuck, so i consider it as terminated', array('%job' => $job))); |
725 | - } |
|
726 | - else { |
|
718 | + } else { |
|
727 | 719 | drupal_set_message(t('Job %job already running', array('%job' => $job))); |
728 | 720 | $running = true; |
729 | 721 | } |
@@ -16,8 +16,9 @@ discard block |
||
16 | 16 | |
17 | 17 | function _dcf_hook_menu($items, $maycache) { |
18 | 18 | $new_items = array(); |
19 | - foreach ($items as $k => $v) |
|
20 | - $new_items[_dcf_internal_path($k)] = $v; |
|
19 | + foreach ($items as $k => $v) { |
|
20 | + $new_items[_dcf_internal_path($k)] = $v; |
|
21 | + } |
|
21 | 22 | return $new_items; |
22 | 23 | } |
23 | 24 | |
@@ -28,23 +29,26 @@ discard block |
||
28 | 29 | } |
29 | 30 | if (!empty($a['#type']) && $a['#type'] == 'actions') |
30 | 31 | unset($a['#type']); |
31 | - foreach ($a as $k => &$v) |
|
32 | - if (is_array($v)) |
|
32 | + foreach ($a as $k => &$v) { |
|
33 | + if (is_array($v)) |
|
33 | 34 | _dcf_convert_render_array($v); |
34 | -} |
|
35 | + } |
|
36 | + } |
|
35 | 37 | |
36 | 38 | function _dcr_render_array($output) { |
37 | - foreach ($output as $k => &$v) |
|
38 | - if ((is_numeric($k) || $k{0} != '#') && is_string($v)) |
|
39 | + foreach ($output as $k => &$v) { |
|
40 | + if ((is_numeric($k) || $k{0} != '#') && is_string($v)) |
|
39 | 41 | $v = array( '#type' => 'markup', '#value' => $v, '#weight' => -1 ); |
42 | + } |
|
40 | 43 | _dcf_convert_render_array($output); |
41 | 44 | return drupal_render($output); |
42 | 45 | } |
43 | 46 | |
44 | 47 | function _dcr_form(&$form) { |
45 | - foreach ($form as $k => &$v) |
|
46 | - if ((is_numeric($k) || $k{0} != '#') && is_string($v)) |
|
48 | + foreach ($form as $k => &$v) { |
|
49 | + if ((is_numeric($k) || $k{0} != '#') && is_string($v)) |
|
47 | 50 | $v = array( '#type' => 'markup', '#value' => $v, '#weight' => -1 ); |
51 | + } |
|
48 | 52 | _dcf_convert_render_array($form); |
49 | 53 | return $form; |
50 | 54 | } |
@@ -61,7 +65,8 @@ discard block |
||
61 | 65 | return t($string); |
62 | 66 | } |
63 | 67 | |
64 | -function _dco_watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) { // WARN d7 changed WATCHDOG_ costants |
|
68 | +function _dco_watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) { |
|
69 | +// WARN d7 changed WATCHDOG_ costants |
|
65 | 70 | return watchdog($type, $message, $variables, $severity, $link); |
66 | 71 | } |
67 | 72 |
@@ -28,8 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | if (EC_DRUPAL_VERSION >= 7) { |
30 | 30 | $object = db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron} where name = :name", array(':name' => $name))->fetch(); |
31 | - } |
|
32 | - else { |
|
31 | + } else { |
|
33 | 32 | $object = db_fetch_object(db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron} where name = '%s'", $name)); |
34 | 33 | } |
35 | 34 | $default_objects = _ctools_export_get_defaults('elysia_cron', $export); |
@@ -37,12 +36,10 @@ discard block |
||
37 | 36 | if ($object) { |
38 | 37 | if (isset($default_objects[$name])) { |
39 | 38 | return _elysia_cron_ctools_export_load_object_db_and_code($object, $default_objects[$name], $export); |
40 | - } |
|
41 | - else { |
|
39 | + } else { |
|
42 | 40 | return _elysia_cron_ctools_export_load_object_db($object, $export); |
43 | 41 | } |
44 | - } |
|
45 | - elseif (isset($default_objects[$name])) { |
|
42 | + } elseif (isset($default_objects[$name])) { |
|
46 | 43 | return _elysia_cron_ctools_export_load_object_code($default_objects[$name], $export); |
47 | 44 | } |
48 | 45 | } |
@@ -61,8 +58,7 @@ discard block |
||
61 | 58 | |
62 | 59 | if (EC_DRUPAL_VERSION >= 7) { |
63 | 60 | $objects = db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron}")->fetchAll(); |
64 | - } |
|
65 | - else { |
|
61 | + } else { |
|
66 | 62 | $objects = array(); |
67 | 63 | $rs = db_query("select " . implode(", ", $GLOBALS['_ec_columns']) . " from {elysia_cron}"); |
68 | 64 | while ($o = db_fetch_object($rs)) { |
@@ -92,8 +88,7 @@ discard block |
||
92 | 88 | foreach ($code_object as $keyd => $value) { |
93 | 89 | if (!isset($object->$keyd) || is_null($object->$keyd)) { |
94 | 90 | $object->$keyd = $value; |
95 | - } |
|
96 | - else if ($object->$keyd !== $value) { |
|
91 | + } else if ($object->$keyd !== $value) { |
|
97 | 92 | $overridden = true; |
98 | 93 | } |
99 | 94 | } |
@@ -65,8 +65,7 @@ discard block |
||
65 | 65 | $vn = 'ecc_' . _ec_get_name($r[1]) . '_laf'; |
66 | 66 | break; |
67 | 67 | } |
68 | - } |
|
69 | - elseif (preg_match('/^elysia_cron_(.*)_(rule|disabled|context|running|last_run|last_execution_time|execution_count|avg_execution_time|max_execution_time)/', $v->name, $r)) { |
|
68 | + } elseif (preg_match('/^elysia_cron_(.*)_(rule|disabled|context|running|last_run|last_execution_time|execution_count|avg_execution_time|max_execution_time)/', $v->name, $r)) { |
|
70 | 69 | switch ($r[2]) { |
71 | 70 | case 'rule': |
72 | 71 | $vn = 'ec_' . _ec_get_name($r[1]) . '_rul'; |
@@ -99,8 +98,7 @@ discard block |
||
99 | 98 | } |
100 | 99 | if ($vn) { |
101 | 100 | variable_set($vn, unserialize($v->value)); |
102 | - } |
|
103 | - else { |
|
101 | + } else { |
|
104 | 102 | _dco_watchdog('cron', 'Error in update, cant convert %name (value: %value)', array('%name' => $v->name, '%value' => $v->value), WATCHDOG_ERROR); |
105 | 103 | } |
106 | 104 | |
@@ -125,14 +123,12 @@ discard block |
||
125 | 123 | // Must use "$v" for PHP5.3 running D6 version (detect the error even if it doesn't pass here) |
126 | 124 | db_change_field($v = 'elysia_cron', 'disable', 'disabled', array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE)); |
127 | 125 | |
128 | - } |
|
129 | - elseif (EC_DRUPAL_VERSION >= 6) { |
|
126 | + } elseif (EC_DRUPAL_VERSION >= 6) { |
|
130 | 127 | // D6 |
131 | 128 | $ret = array(); |
132 | 129 | db_change_field($ret, 'elysia_cron', 'disable', 'disabled', array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE)); |
133 | 130 | } |
134 | - } |
|
135 | - else { |
|
131 | + } else { |
|
136 | 132 | // D5 |
137 | 133 | switch ($GLOBALS['db_type']) { |
138 | 134 | case 'mysqli': |
@@ -185,8 +181,7 @@ discard block |
||
185 | 181 | $name = false; |
186 | 182 | if (preg_match('/^ecc_(.+)_(r|d|lr|la|ac|ec|let|aet|met|lst|laf)/', $v->name, $r)) { |
187 | 183 | $name = ':' . $r[1]; |
188 | - } |
|
189 | - elseif (preg_match('/^ec_(.+)_(rul|d|c|w|r|lr|let|ec|aet|met)/', $v->name, $r)) { |
|
184 | + } elseif (preg_match('/^ec_(.+)_(rul|d|c|w|r|lr|let|ec|aet|met)/', $v->name, $r)) { |
|
190 | 185 | $name = $r[1]; |
191 | 186 | } |
192 | 187 | if ($name) { |
@@ -275,13 +270,11 @@ discard block |
||
275 | 270 | // Must use "$v" for PHP5.3 running D6 version (detect the error even if it doesn't pass here) |
276 | 271 | db_change_field($v = 'elysia_cron', 'weight', 'weight', array('type' => 'int', 'not null' => FALSE)); |
277 | 272 | |
278 | - } |
|
279 | - elseif (EC_DRUPAL_VERSION >= 6) { |
|
273 | + } elseif (EC_DRUPAL_VERSION >= 6) { |
|
280 | 274 | // D6 |
281 | 275 | $ret = array(); |
282 | 276 | db_change_field($ret, 'elysia_cron', 'weight', 'weight', array('type' => 'int', 'not null' => FALSE)); |
283 | - } |
|
284 | - else { |
|
277 | + } else { |
|
285 | 278 | // D5 |
286 | 279 | db_query("alter table {elysia_cron} change weight weight int(11)"); |
287 | 280 | } |
@@ -310,13 +303,11 @@ discard block |
||
310 | 303 | // Must use "$v" for PHP5.3 running D6 version (detect the error even if it doesn't pass here) |
311 | 304 | db_change_field($v = 'elysia_cron', 'disabled', 'disable', array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE)); |
312 | 305 | |
313 | - } |
|
314 | - elseif (EC_DRUPAL_VERSION >= 6) { |
|
306 | + } elseif (EC_DRUPAL_VERSION >= 6) { |
|
315 | 307 | // D6 |
316 | 308 | $ret = array(); |
317 | 309 | db_change_field($ret, 'elysia_cron', 'disabled', 'disable', array('type' => 'int', 'size' => 'tiny', 'not null' => FALSE)); |
318 | - } |
|
319 | - else { |
|
310 | + } else { |
|
320 | 311 | // D5 |
321 | 312 | db_query("alter table {elysia_cron} change disabled disable tinyint(1)"); |
322 | 313 | } |
@@ -50,8 +50,7 @@ discard block |
||
50 | 50 | $expected_date[$i] -= $ranges[$i][1] + 1; |
51 | 51 | } |
52 | 52 | $new = $expected_date[$i] + ceil(($date[$i] - $expected_date[$i]) / $r['d']) * $r['d']; |
53 | - } |
|
54 | - elseif ($r['n']) { |
|
53 | + } elseif ($r['n']) { |
|
55 | 54 | $new = __cronNextOrEqual($date[$i], $r['n'], $ranges[$i][0], $ranges[$i][1]); |
56 | 55 | } |
57 | 56 | if ($new != $date[$i]) { |
@@ -113,11 +112,9 @@ discard block |
||
113 | 112 | foreach (explode(',', $rule) as $token) { |
114 | 113 | if (preg_match('/^([0-9]+)-([0-9]+)$/', $token, $r)) { |
115 | 114 | $result['n'] = array_merge($result['n'], range($r[1], $r[2])); |
116 | - } |
|
117 | - elseif (preg_match('/^\*\/([0-9]+)$/', $token, $r)) { |
|
115 | + } elseif (preg_match('/^\*\/([0-9]+)$/', $token, $r)) { |
|
118 | 116 | $result['d'] = $r[1]; |
119 | - } |
|
120 | - elseif (is_numeric($token)) { |
|
117 | + } elseif (is_numeric($token)) { |
|
121 | 118 | $result['n'][] = $token; |
122 | 119 | } |
123 | 120 | } |
@@ -21,7 +21,6 @@ |
||
21 | 21 | |
22 | 22 | if (function_exists('elysia_cron_run')) { |
23 | 23 | elysia_cron_run(); |
24 | -} |
|
25 | -else { |
|
24 | +} else { |
|
26 | 25 | drupal_cron_run(); |
27 | 26 | } |
@@ -27,19 +27,19 @@ |
||
27 | 27 | exit("Error: couldn't get log_dir from config file."); |
28 | 28 | } |
29 | 29 | |
30 | -if( isset($_GET["f"]) ){ |
|
30 | +if( isset($_GET["f"]) ) { |
|
31 | 31 | $f = $_GET["f"]; |
32 | 32 | $f = escapeshellcmd($f); |
33 | 33 | } else { |
34 | 34 | $f = ""; |
35 | 35 | } |
36 | -if( isset($_GET["s"]) ){ |
|
36 | +if( isset($_GET["s"]) ) { |
|
37 | 37 | $s = $_GET["s"]; |
38 | 38 | $s = escapeshellcmd($s); |
39 | 39 | } else { |
40 | 40 | $s = ""; |
41 | 41 | } |
42 | -if( isset($_GET["l"]) ){ |
|
42 | +if( isset($_GET["l"]) ) { |
|
43 | 43 | $l = (int)$_GET["l"]; |
44 | 44 | } else { |
45 | 45 | $l = 0; |
@@ -90,8 +90,7 @@ |
||
90 | 90 | if (isset($permissions[$perm_name])) { |
91 | 91 | sort($permissions[$perm_name]); |
92 | 92 | $permission['roles'] = $permissions[$perm_name]; |
93 | - } |
|
94 | - else { |
|
93 | + } else { |
|
95 | 94 | $permission['roles'] = array(); |
96 | 95 | } |
97 | 96 | $perm_identifier = features_var_export($perm_name); |
@@ -126,8 +126,7 @@ discard block |
||
126 | 126 | // The format has no filters and does not exist, use the default input |
127 | 127 | // format. |
128 | 128 | $filters[$format] = filter_list_format(variable_get('filter_default_format', 1)); |
129 | - } |
|
130 | - else { |
|
129 | + } else { |
|
131 | 130 | $filters[$format] = array(); |
132 | 131 | while ($filter = db_fetch_object($result)) { |
133 | 132 | $list = module_invoke($filter->module, 'filter', 'list'); |
@@ -169,8 +168,7 @@ discard block |
||
169 | 168 | } |
170 | 169 | if ($format_id && $format_id == variable_get('filter_default_format', 1)) { |
171 | 170 | $format['roles'] = ','. implode(',', array_keys(user_roles())) .','; |
172 | - } |
|
173 | - else { |
|
171 | + } else { |
|
174 | 172 | $format['roles'] = ','. implode(',', $format_rids) .','; |
175 | 173 | } |
176 | 174 | |
@@ -178,8 +176,7 @@ discard block |
||
178 | 176 | if ($format_id) { |
179 | 177 | $format['format'] = $format_id; |
180 | 178 | drupal_write_record('filter_formats', $format, 'format'); |
181 | - } |
|
182 | - else { |
|
179 | + } else { |
|
183 | 180 | drupal_write_record('filter_formats', $format); |
184 | 181 | } |
185 | 182 |