@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | $select_lang = $_POST['select_lang']; |
25 | 25 | $message = get_magic_quotes_gpc() ? stripslashes($_POST['message']) : $_POST['message']; |
26 | 26 | $acl_ok = array(); |
27 | - if (!$GLOBALS['egw']->acl->check('mainscreen_messa',1,'admin')) |
|
27 | + if (!$GLOBALS['egw']->acl->check('mainscreen_messa', 1, 'admin')) |
|
28 | 28 | { |
29 | 29 | $acl_ok['mainscreen'] = True; |
30 | 30 | } |
31 | - if (!$GLOBALS['egw']->acl->check('mainscreen_messa',2,'admin')) |
|
31 | + if (!$GLOBALS['egw']->acl->check('mainscreen_messa', 2, 'admin')) |
|
32 | 32 | { |
33 | 33 | $acl_ok['loginscreen'] = True; |
34 | 34 | } |
@@ -38,16 +38,16 @@ discard block |
||
38 | 38 | $GLOBALS['egw']->redirect_link('/admin/index.php'); |
39 | 39 | } |
40 | 40 | |
41 | - Framework::includeJS('ckeditor','ckeditor'); |
|
41 | + Framework::includeJS('ckeditor', 'ckeditor'); |
|
42 | 42 | |
43 | 43 | $GLOBALS['egw']->template->set_file(array('message' => 'mainscreen_message.tpl')); |
44 | - $GLOBALS['egw']->template->set_block('message','form','form'); |
|
45 | - $GLOBALS['egw']->template->set_block('message','row','row'); |
|
46 | - $GLOBALS['egw']->template->set_block('message','row_2','row_2'); |
|
44 | + $GLOBALS['egw']->template->set_block('message', 'form', 'form'); |
|
45 | + $GLOBALS['egw']->template->set_block('message', 'row', 'row'); |
|
46 | + $GLOBALS['egw']->template->set_block('message', 'row_2', 'row_2'); |
|
47 | 47 | |
48 | 48 | if ($_POST['save']) |
49 | 49 | { |
50 | - Api\Translation::write($select_lang,$section,$section.'_message',$message); |
|
50 | + Api\Translation::write($select_lang, $section, $section.'_message', $message); |
|
51 | 51 | Framework::message(lang('message has been updated')); |
52 | 52 | |
53 | 53 | $section = ''; |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | switch ($section) |
60 | 60 | { |
61 | 61 | case 'mainscreen': |
62 | - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang); |
|
62 | + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message').': '.strtoupper($select_lang); |
|
63 | 63 | break; |
64 | 64 | case 'loginscreen': |
65 | - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang); |
|
65 | + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message').': '.strtoupper($select_lang); |
|
66 | 66 | break; |
67 | 67 | default: |
68 | 68 | $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message'); |
@@ -72,70 +72,70 @@ discard block |
||
72 | 72 | { |
73 | 73 | echo $GLOBALS['egw']->framework->header(); |
74 | 74 | |
75 | - $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.admin_messages.index')); |
|
76 | - $GLOBALS['egw']->template->set_var('value',' '); |
|
77 | - $GLOBALS['egw']->template->fp('rows','row_2',True); |
|
75 | + $GLOBALS['egw']->template->set_var('form_action', $GLOBALS['egw']->link('/index.php', 'menuaction=admin.admin_messages.index')); |
|
76 | + $GLOBALS['egw']->template->set_var('value', ' '); |
|
77 | + $GLOBALS['egw']->template->fp('rows', 'row_2', True); |
|
78 | 78 | |
79 | 79 | $langs = Api\Translation::get_installed_langs(); |
80 | 80 | $langs['en'] .= ' ('.lang('All languages').')'; |
81 | 81 | $lang_select = Api\Html::select('select_lang', 'en', $langs); |
82 | 82 | |
83 | - $GLOBALS['egw']->template->set_var('label',lang('Language')); |
|
84 | - $GLOBALS['egw']->template->set_var('value',$lang_select); |
|
85 | - $GLOBALS['egw']->template->fp('rows','row',True); |
|
83 | + $GLOBALS['egw']->template->set_var('label', lang('Language')); |
|
84 | + $GLOBALS['egw']->template->set_var('value', $lang_select); |
|
85 | + $GLOBALS['egw']->template->fp('rows', 'row', True); |
|
86 | 86 | |
87 | 87 | $select_section = '<select name="section">'."\n"; |
88 | - foreach(array_keys($acl_ok) as $key) |
|
88 | + foreach (array_keys($acl_ok) as $key) |
|
89 | 89 | { |
90 | 90 | $select_section .= ' <option value="'.$key.'"'. |
91 | - ($key == $_POST['section'] ? ' selected' : '') . '>' . |
|
92 | - ($key == 'mainscreen' ? lang('Main screen') : lang("Login screen")) . "</option>\n"; |
|
91 | + ($key == $_POST['section'] ? ' selected' : '').'>'. |
|
92 | + ($key == 'mainscreen' ? lang('Main screen') : lang("Login screen"))."</option>\n"; |
|
93 | 93 | } |
94 | 94 | $select_section .= '</select>'; |
95 | - $GLOBALS['egw']->template->set_var('label',lang('Section')); |
|
96 | - $GLOBALS['egw']->template->set_var('value',$select_section); |
|
97 | - $GLOBALS['egw']->template->fp('rows','row',True); |
|
95 | + $GLOBALS['egw']->template->set_var('label', lang('Section')); |
|
96 | + $GLOBALS['egw']->template->set_var('value', $select_section); |
|
97 | + $GLOBALS['egw']->template->fp('rows', 'row', True); |
|
98 | 98 | |
99 | 99 | $GLOBALS['egw']->template->set_var('value', |
100 | 100 | Api\Html::submit_button('edit', lang('Edit'))."\n".Api\Html::submit_button('cancel', lang('Cancel'))); |
101 | - $GLOBALS['egw']->template->fp('rows','row_2',True); |
|
101 | + $GLOBALS['egw']->template->fp('rows', 'row_2', True); |
|
102 | 102 | } |
103 | 103 | else |
104 | 104 | { |
105 | - $current_message = Api\Translation::read($select_lang,$section,$section.'_message'); |
|
105 | + $current_message = Api\Translation::read($select_lang, $section, $section.'_message'); |
|
106 | 106 | if ($_POST['no']) $current_message = strip_tags($current_message); |
107 | 107 | if (empty($_POST['no']) && ($_POST['yes'] || empty($current_message) || |
108 | 108 | strlen($current_message) != strlen(strip_tags($current_message)))) |
109 | 109 | { |
110 | - $text_or_htmlarea = Api\Html::fckEditorQuick('message','advanced',$current_message,'400px','800px'); |
|
110 | + $text_or_htmlarea = Api\Html::fckEditorQuick('message', 'advanced', $current_message, '400px', '800px'); |
|
111 | 111 | $htmlarea_button = Api\Html::submit_button("no", lang('disable WYSIWYG-editor')); |
112 | 112 | } |
113 | 113 | else |
114 | 114 | { |
115 | - $text_or_htmlarea='<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">' . |
|
116 | - Api\Html::htmlspecialchars($current_message) . '</textarea>'; |
|
115 | + $text_or_htmlarea = '<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">'. |
|
116 | + Api\Html::htmlspecialchars($current_message).'</textarea>'; |
|
117 | 117 | $htmlarea_button = Api\Html::submit_button("yes", lang('activate WYSIWYG-editor')); |
118 | 118 | } |
119 | 119 | echo $GLOBALS['egw']->framework->header(); |
120 | 120 | |
121 | - $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.admin_messages.index')); |
|
122 | - $GLOBALS['egw']->template->set_var('select_lang',$select_lang); |
|
123 | - $GLOBALS['egw']->template->set_var('section',$section); |
|
124 | - $GLOBALS['egw']->template->set_var('value',' '); |
|
125 | - $GLOBALS['egw']->template->fp('rows','row_2',True); |
|
121 | + $GLOBALS['egw']->template->set_var('form_action', $GLOBALS['egw']->link('/index.php', 'menuaction=admin.admin_messages.index')); |
|
122 | + $GLOBALS['egw']->template->set_var('select_lang', $select_lang); |
|
123 | + $GLOBALS['egw']->template->set_var('section', $section); |
|
124 | + $GLOBALS['egw']->template->set_var('value', ' '); |
|
125 | + $GLOBALS['egw']->template->fp('rows', 'row_2', True); |
|
126 | 126 | |
127 | - $GLOBALS['egw']->template->set_var('value',$text_or_htmlarea); |
|
127 | + $GLOBALS['egw']->template->set_var('value', $text_or_htmlarea); |
|
128 | 128 | |
129 | - $GLOBALS['egw']->template->fp('rows','row_2',True); |
|
129 | + $GLOBALS['egw']->template->fp('rows', 'row_2', True); |
|
130 | 130 | |
131 | 131 | $GLOBALS['egw']->template->set_var('value', |
132 | 132 | Api\Html::submit_button('save', lang('Save'))."\n".Api\Html::submit_button('cancel', lang('Cancel')). |
133 | 133 | "\n".$htmlarea_button); |
134 | - $GLOBALS['egw']->template->fp('rows','row_2',True); |
|
134 | + $GLOBALS['egw']->template->fp('rows', 'row_2', True); |
|
135 | 135 | } |
136 | 136 | |
137 | - $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); |
|
138 | - $GLOBALS['egw']->template->pparse('out','form'); |
|
137 | + $GLOBALS['egw']->template->set_var('lang_cancel', lang('Cancel')); |
|
138 | + $GLOBALS['egw']->template->pparse('out', 'form'); |
|
139 | 139 | |
140 | 140 | echo $GLOBALS['egw']->framework->footer(); |
141 | 141 | } |
@@ -52,10 +52,13 @@ discard block |
||
52 | 52 | |
53 | 53 | $section = ''; |
54 | 54 | } |
55 | - if ($_POST['cancel']) // back to section/lang-selection |
|
55 | + if ($_POST['cancel']) |
|
56 | + { |
|
57 | + // back to section/lang-selection |
|
56 | 58 | { |
57 | 59 | $message = $section = ''; |
58 | 60 | } |
61 | + } |
|
59 | 62 | switch ($section) |
60 | 63 | { |
61 | 64 | case 'mainscreen': |
@@ -103,7 +106,10 @@ discard block |
||
103 | 106 | else |
104 | 107 | { |
105 | 108 | $current_message = Api\Translation::read($select_lang,$section,$section.'_message'); |
106 | - if ($_POST['no']) $current_message = strip_tags($current_message); |
|
109 | + if ($_POST['no']) |
|
110 | + { |
|
111 | + $current_message = strip_tags($current_message); |
|
112 | + } |
|
107 | 113 | if (empty($_POST['no']) && ($_POST['yes'] || empty($current_message) || |
108 | 114 | strlen($current_message) != strlen(strip_tags($current_message)))) |
109 | 115 | { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $_content =null |
35 | 35 | * @param string $msg ='' |
36 | 36 | */ |
37 | - function index(array $_content=null, $msg='') |
|
37 | + function index(array $_content = null, $msg = '') |
|
38 | 38 | { |
39 | 39 | if (is_array($_content)) |
40 | 40 | { |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | list($action) = each($_content['button']); |
45 | 45 | unset($_content['button']); |
46 | 46 | } |
47 | - elseif($_content['rows']['delete']) |
|
47 | + elseif ($_content['rows']['delete']) |
|
48 | 48 | { |
49 | 49 | list($action) = each($_content['rows']['delete']); |
50 | 50 | unset($_content['rows']['delete']); |
51 | 51 | } |
52 | - switch($action) |
|
52 | + switch ($action) |
|
53 | 53 | { |
54 | 54 | case 'save': |
55 | 55 | case 'apply': |
56 | 56 | $saved = 0; |
57 | - foreach($_content['rows'] as $data) |
|
57 | + foreach ($_content['rows'] as $data) |
|
58 | 58 | { |
59 | 59 | if (!empty($data['phrase'])) |
60 | 60 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | } |
81 | 81 | $content = array('rows' => array()); |
82 | - foreach(Api\Translation::load_app('custom', 'en') as $phrase => $translation) |
|
82 | + foreach (Api\Translation::load_app('custom', 'en') as $phrase => $translation) |
|
83 | 83 | { |
84 | 84 | $content['rows'][++$row] = array( |
85 | 85 | 'phrase' => $phrase, |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | 'phrase' => '', |
92 | 92 | 'translation' => '', |
93 | 93 | ); |
94 | - $readonlys["delete[$row]"] = true; // no delete for empty row |
|
94 | + $readonlys["delete[$row]"] = true; // no delete for empty row |
|
95 | 95 | $content['msg'] = $msg; |
96 | 96 | |
97 | 97 | $GLOBALS['egw_info']['flags']['app_header'] = lang('Custom translation'); |
@@ -62,8 +62,14 @@ |
||
62 | 62 | ++$saved; |
63 | 63 | } |
64 | 64 | } |
65 | - if ($saved) $msg = lang('%1 phrases saved.', $saved); |
|
66 | - if ($action == 'apply') break; |
|
65 | + if ($saved) |
|
66 | + { |
|
67 | + $msg = lang('%1 phrases saved.', $saved); |
|
68 | + } |
|
69 | + if ($action == 'apply') |
|
70 | + { |
|
71 | + break; |
|
72 | + } |
|
67 | 73 | // fall through |
68 | 74 | case 'cancel': |
69 | 75 | Egw::redirect_link('/admin/index.php'); |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | $apps->read_installed_apps(); |
51 | 51 | } |
52 | 52 | $changes = $setup_info = array(); |
53 | - foreach(array_keys($GLOBALS['egw_info']['apps']) as $app) |
|
53 | + foreach (array_keys($GLOBALS['egw_info']['apps']) as $app) |
|
54 | 54 | { |
55 | - if (!file_exists($path=EGW_SERVER_ROOT.'/'.$app.'/setup/setup.inc.php') || !include($path)) continue; |
|
55 | + if (!file_exists($path = EGW_SERVER_ROOT.'/'.$app.'/setup/setup.inc.php') || !include($path)) continue; |
|
56 | 56 | |
57 | - foreach((array)$setup_info[$app]['tables'] as $table) |
|
57 | + foreach ((array)$setup_info[$app]['tables'] as $table) |
|
58 | 58 | { |
59 | 59 | if (!($definition = $GLOBALS['egw']->db->get_table_definitions($app, $table))) continue; |
60 | 60 | |
61 | 61 | $cf = array(); |
62 | - foreach($definition['fd'] as $col => $data) |
|
62 | + foreach ($definition['fd'] as $col => $data) |
|
63 | 63 | { |
64 | 64 | if (!empty($data['meta'])) |
65 | 65 | { |
66 | - foreach((array)$data['meta'] as $key => $val) |
|
66 | + foreach ((array)$data['meta'] as $key => $val) |
|
67 | 67 | { |
68 | 68 | list($type, $subtype) = explode('-', $val.'-'); |
69 | 69 | if (in_array($type, array('account', 'user', 'group'))) |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | if ($cf && !empty($cf['cfname']) && !empty($cf['cfvalue']) && |
88 | 88 | ($account_cfs = Api\Storage\Customfields::get_account_cfs($app == 'phpgwapi' ? 'addressbook' : $app))) |
89 | 89 | { |
90 | - foreach($account_cfs as $type => $names) |
|
90 | + foreach ($account_cfs as $type => $names) |
|
91 | 91 | { |
92 | 92 | unset($subtype); |
93 | 93 | list($type, $subtype) = explode('-', $type); |
@@ -114,53 +114,53 @@ discard block |
||
114 | 114 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
115 | 115 | * @throws Api\Exception\WrongUserinput(lang("Application '%1' not found (maybe not installed or misspelled)!",$name),8); |
116 | 116 | */ |
117 | - protected function exec($check_only=false) |
|
117 | + protected function exec($check_only = false) |
|
118 | 118 | { |
119 | - foreach($this->change as $from => $to) |
|
119 | + foreach ($this->change as $from => $to) |
|
120 | 120 | { |
121 | 121 | if (!(int)$from || !(int)$to) |
122 | 122 | { |
123 | - throw new Api\Exception\WrongUserinput(lang("Account-id's have to be integers!"),16); |
|
123 | + throw new Api\Exception\WrongUserinput(lang("Account-id's have to be integers!"), 16); |
|
124 | 124 | } |
125 | 125 | if (($from < 0) != ($to < 0)) |
126 | 126 | { |
127 | - throw new Api\Exception\WrongUserinput(lang("Can NOT change users into groups, same sign required!"),17); |
|
127 | + throw new Api\Exception\WrongUserinput(lang("Can NOT change users into groups, same sign required!"), 17); |
|
128 | 128 | } |
129 | 129 | if (!($from_exists = $GLOBALS['egw']->accounts->exists($from))) |
130 | 130 | { |
131 | - throw new Api\Exception\WrongUserinput(lang("Source account #%1 does NOT exist!", $from),18); |
|
131 | + throw new Api\Exception\WrongUserinput(lang("Source account #%1 does NOT exist!", $from), 18); |
|
132 | 132 | } |
133 | 133 | if ($from_exists !== ($from > 0 ? 1 : 2)) |
134 | 134 | { |
135 | - throw new Api\Exception\WrongUserinput(lang("Group #%1 must have negative sign!", $from),19); |
|
135 | + throw new Api\Exception\WrongUserinput(lang("Group #%1 must have negative sign!", $from), 19); |
|
136 | 136 | } |
137 | 137 | if ($GLOBALS['egw']->accounts->exists($to) && !isset($this->change[$to])) |
138 | 138 | { |
139 | - throw new Api\Exception\WrongUserinput(lang("Destination account #%1 does exist and is NOT renamed itself! Can not merge Api\Accounts, it will violate unique contains. Delete with transfer of data instead.", $to),20); |
|
139 | + throw new Api\Exception\WrongUserinput(lang("Destination account #%1 does exist and is NOT renamed itself! Can not merge Api\Accounts, it will violate unique contains. Delete with transfer of data instead.", $to), 20); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | $columns2change = $this->get_changes(); |
143 | 143 | $total = 0; |
144 | - foreach($columns2change as $app => $data) |
|
144 | + foreach ($columns2change as $app => $data) |
|
145 | 145 | { |
146 | - if (!isset($GLOBALS['egw_info']['apps'][$app])) continue; // $app is not installed |
|
146 | + if (!isset($GLOBALS['egw_info']['apps'][$app])) continue; // $app is not installed |
|
147 | 147 | |
148 | 148 | $db = clone($GLOBALS['egw']->db); |
149 | 149 | $db->set_app($app); |
150 | 150 | if ($check_only) $db->log_updates = true; |
151 | 151 | |
152 | - foreach($data as $table => $columns) |
|
152 | + foreach ($data as $table => $columns) |
|
153 | 153 | { |
154 | - $db->column_definitions = $db->get_table_definitions($app,$table); |
|
154 | + $db->column_definitions = $db->get_table_definitions($app, $table); |
|
155 | 155 | $db->column_definitions = $db->column_definitions['fd']; |
156 | 156 | if (!$columns) |
157 | 157 | { |
158 | 158 | echo "$app: $table no columns with account-id's\n"; |
159 | - continue; // noting to do for this table |
|
159 | + continue; // noting to do for this table |
|
160 | 160 | } |
161 | 161 | if (!is_array($columns)) $columns = array($columns); |
162 | 162 | |
163 | - foreach($columns as $column) |
|
163 | + foreach ($columns as $column) |
|
164 | 164 | { |
165 | 165 | $type = $where = null; |
166 | 166 | if (is_array($column)) |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | $where = $column; |
171 | 171 | $column = array_shift($where); |
172 | 172 | } |
173 | - $total += ($changed = self::_update_account_id($this->change,$db,$table,$column,$where,$type)); |
|
173 | + $total += ($changed = self::_update_account_id($this->change, $db, $table, $column, $where, $type)); |
|
174 | 174 | if (!$check_only && $changed) echo "$app:\t$table.$column $changed id's changed\n"; |
175 | 175 | } |
176 | 176 | } |
177 | 177 | } |
178 | 178 | if (!$check_only) |
179 | 179 | { |
180 | - foreach($GLOBALS['egw_info']['apps'] as $app => $data) |
|
180 | + foreach ($GLOBALS['egw_info']['apps'] as $app => $data) |
|
181 | 181 | { |
182 | 182 | $total += ($changed = Api\Storage\Customfields::change_account_ids($app, $this->change)); |
183 | 183 | if ($changed) echo "$app:\t$changed id's in definition of private custom fields changed\n"; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | if ($total) Api\Cache::flush(Api\Cache::INSTANCE); |
187 | 187 | |
188 | - return lang("Total of %1 id's changed.",$total)."\n"; |
|
188 | + return lang("Total of %1 id's changed.", $total)."\n"; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
@@ -199,16 +199,16 @@ discard block |
||
199 | 199 | * @param string $type |
200 | 200 | * @return int number of changed ids |
201 | 201 | */ |
202 | - private static function _update_account_id(array $ids2change,Api\Db $db,$table,$column,array $where=null,$type=null) |
|
202 | + private static function _update_account_id(array $ids2change, Api\Db $db, $table, $column, array $where = null, $type = null) |
|
203 | 203 | { |
204 | 204 | $update_sql = ''; |
205 | - foreach($ids2change as $from => $to) |
|
205 | + foreach ($ids2change as $from => $to) |
|
206 | 206 | { |
207 | - $update_sql .= "WHEN ".$db->quote($from,$db->column_definitions[$column]['type'])." THEN ".$db->quote($to,$db->column_definitions[$column]['type'])." "; |
|
207 | + $update_sql .= "WHEN ".$db->quote($from, $db->column_definitions[$column]['type'])." THEN ".$db->quote($to, $db->column_definitions[$column]['type'])." "; |
|
208 | 208 | } |
209 | 209 | $update_sql .= 'END'; |
210 | 210 | |
211 | - switch($type) |
|
211 | + switch ($type) |
|
212 | 212 | { |
213 | 213 | case 'commasep': |
214 | 214 | case 'serialized': |
@@ -217,23 +217,23 @@ discard block |
||
217 | 217 | $select[] = "$column IS NOT NULL"; |
218 | 218 | $select[] = "$column != ''"; |
219 | 219 | $change = array(); |
220 | - foreach($db->select($table,'DISTINCT '.$column,$select,__LINE__,__FILE__) as $row) |
|
220 | + foreach ($db->select($table, 'DISTINCT '.$column, $select, __LINE__, __FILE__) as $row) |
|
221 | 221 | { |
222 | - $ids = $type != 'serialized' ? explode(',',$old_ids=$row[$column]) : json_php_unserialize($old_ids=$row[$column]); |
|
223 | - foreach($ids as $key => $id) |
|
222 | + $ids = $type != 'serialized' ? explode(',', $old_ids = $row[$column]) : json_php_unserialize($old_ids = $row[$column]); |
|
223 | + foreach ($ids as $key => $id) |
|
224 | 224 | { |
225 | 225 | if (isset($ids2change[$id])) $ids[$key] = $ids2change[$id]; |
226 | 226 | } |
227 | - $ids2 = $type != 'serialized' ? implode(',',$ids) : serialize($ids); |
|
227 | + $ids2 = $type != 'serialized' ? implode(',', $ids) : serialize($ids); |
|
228 | 228 | if ($ids2 != $old_ids) |
229 | 229 | { |
230 | 230 | $change[$old_ids] = $ids2; |
231 | 231 | } |
232 | 232 | } |
233 | 233 | $changed = 0; |
234 | - foreach($change as $from => $to) |
|
234 | + foreach ($change as $from => $to) |
|
235 | 235 | { |
236 | - $db->update($table,array($column=>$to),$where+array($column=>$from),__LINE__,__FILE__); |
|
236 | + $db->update($table, array($column=>$to), $where + array($column=>$from), __LINE__, __FILE__); |
|
237 | 237 | $changed += $db->affected_rows(); |
238 | 238 | } |
239 | 239 | break; |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | case 'abs': |
242 | 242 | if (!$where) $where = array(); |
243 | 243 | $where[$column] = array(); |
244 | - foreach($ids2change as $from => $to) |
|
244 | + foreach ($ids2change as $from => $to) |
|
245 | 245 | { |
246 | 246 | $where[$column][] = abs($from); |
247 | 247 | } |
248 | - $db->update($table,$column.'= CASE '.$column.' '.preg_replace('/-([0-9]+)/','\1',$update_sql),$where,__LINE__,__FILE__); |
|
248 | + $db->update($table, $column.'= CASE '.$column.' '.preg_replace('/-([0-9]+)/', '\1', $update_sql), $where, __LINE__, __FILE__); |
|
249 | 249 | $changed = $db->affected_rows(); |
250 | 250 | break; |
251 | 251 | |
@@ -253,21 +253,21 @@ discard block |
||
253 | 253 | if (!$where) $where = array(); |
254 | 254 | $where[$column] = array(); |
255 | 255 | $update_sql = ''; |
256 | - foreach($ids2change as $from => $to) |
|
256 | + foreach ($ids2change as $from => $to) |
|
257 | 257 | { |
258 | 258 | if ($from < 0) $from -= 2; |
259 | 259 | if ($to < 0) $to -= 2; |
260 | 260 | $where[$column][] = $from; |
261 | - $update_sql .= 'WHEN '.$db->quote($from,$db->column_definitions[$column]['type']).' THEN '.$db->quote($to,$db->column_definitions[$column]['type']).' '; |
|
261 | + $update_sql .= 'WHEN '.$db->quote($from, $db->column_definitions[$column]['type']).' THEN '.$db->quote($to, $db->column_definitions[$column]['type']).' '; |
|
262 | 262 | } |
263 | - $db->update($table,$column.'= CASE '.$column.' '.$update_sql.'END',$where,__LINE__,__FILE__); |
|
263 | + $db->update($table, $column.'= CASE '.$column.' '.$update_sql.'END', $where, __LINE__, __FILE__); |
|
264 | 264 | $changed = $db->affected_rows(); |
265 | 265 | break; |
266 | 266 | |
267 | 267 | default: |
268 | 268 | if (!$where) $where = array(); |
269 | 269 | $where[$column] = array_keys($ids2change); |
270 | - $db->update($table,$column.'= CASE '.$column.' '.$update_sql,$where,__LINE__,__FILE__); |
|
270 | + $db->update($table, $column.'= CASE '.$column.' '.$update_sql, $where, __LINE__, __FILE__); |
|
271 | 271 | $changed = $db->affected_rows(); |
272 | 272 | break; |
273 | 273 | } |
@@ -282,10 +282,10 @@ discard block |
||
282 | 282 | function __tostring() |
283 | 283 | { |
284 | 284 | $change = array(); |
285 | - foreach($this->change as $from => $to) |
|
285 | + foreach ($this->change as $from => $to) |
|
286 | 286 | { |
287 | 287 | $change[] = $from.'->'.$to; |
288 | 288 | } |
289 | - return lang('Change account_id').': '.implode(', ',$change); |
|
289 | + return lang('Change account_id').': '.implode(', ', $change); |
|
290 | 290 | } |
291 | 291 | } |
@@ -52,11 +52,17 @@ discard block |
||
52 | 52 | $changes = $setup_info = array(); |
53 | 53 | foreach(array_keys($GLOBALS['egw_info']['apps']) as $app) |
54 | 54 | { |
55 | - if (!file_exists($path=EGW_SERVER_ROOT.'/'.$app.'/setup/setup.inc.php') || !include($path)) continue; |
|
55 | + if (!file_exists($path=EGW_SERVER_ROOT.'/'.$app.'/setup/setup.inc.php') || !include($path)) |
|
56 | + { |
|
57 | + continue; |
|
58 | + } |
|
56 | 59 | |
57 | 60 | foreach((array)$setup_info[$app]['tables'] as $table) |
58 | 61 | { |
59 | - if (!($definition = $GLOBALS['egw']->db->get_table_definitions($app, $table))) continue; |
|
62 | + if (!($definition = $GLOBALS['egw']->db->get_table_definitions($app, $table))) |
|
63 | + { |
|
64 | + continue; |
|
65 | + } |
|
60 | 66 | |
61 | 67 | $cf = array(); |
62 | 68 | foreach($definition['fd'] as $col => $data) |
@@ -71,8 +77,14 @@ discard block |
||
71 | 77 | if (!is_numeric($key) || !empty($subtype)) |
72 | 78 | { |
73 | 79 | $col = array($col); |
74 | - if (!is_numeric($key)) $col[] = $key; |
|
75 | - if (!empty($subtype)) $col['.type'] = $subtype; |
|
80 | + if (!is_numeric($key)) |
|
81 | + { |
|
82 | + $col[] = $key; |
|
83 | + } |
|
84 | + if (!empty($subtype)) |
|
85 | + { |
|
86 | + $col['.type'] = $subtype; |
|
87 | + } |
|
76 | 88 | } |
77 | 89 | $changes[$app][$table][] = $col; |
78 | 90 | } |
@@ -92,13 +104,19 @@ discard block |
||
92 | 104 | unset($subtype); |
93 | 105 | list($type, $subtype) = explode('-', $type); |
94 | 106 | $col = array($cf['cfvalue']); |
95 | - if (!empty($subtype)) $col['.type'] = $subtype; |
|
107 | + if (!empty($subtype)) |
|
108 | + { |
|
109 | + $col['.type'] = $subtype; |
|
110 | + } |
|
96 | 111 | $col[$cf['cfname']] = $names; |
97 | 112 | $changes[$app][$table][] = $col; |
98 | 113 | } |
99 | 114 | } |
100 | 115 | } |
101 | - if (isset($changes[$app])) ksort($changes[$app]); |
|
116 | + if (isset($changes[$app])) |
|
117 | + { |
|
118 | + ksort($changes[$app]); |
|
119 | + } |
|
102 | 120 | } |
103 | 121 | ksort($changes); |
104 | 122 | //print_r($changes); |
@@ -143,11 +161,18 @@ discard block |
||
143 | 161 | $total = 0; |
144 | 162 | foreach($columns2change as $app => $data) |
145 | 163 | { |
146 | - if (!isset($GLOBALS['egw_info']['apps'][$app])) continue; // $app is not installed |
|
164 | + if (!isset($GLOBALS['egw_info']['apps'][$app])) |
|
165 | + { |
|
166 | + continue; |
|
167 | + } |
|
168 | + // $app is not installed |
|
147 | 169 | |
148 | 170 | $db = clone($GLOBALS['egw']->db); |
149 | 171 | $db->set_app($app); |
150 | - if ($check_only) $db->log_updates = true; |
|
172 | + if ($check_only) |
|
173 | + { |
|
174 | + $db->log_updates = true; |
|
175 | + } |
|
151 | 176 | |
152 | 177 | foreach($data as $table => $columns) |
153 | 178 | { |
@@ -158,7 +183,10 @@ discard block |
||
158 | 183 | echo "$app: $table no columns with account-id's\n"; |
159 | 184 | continue; // noting to do for this table |
160 | 185 | } |
161 | - if (!is_array($columns)) $columns = array($columns); |
|
186 | + if (!is_array($columns)) |
|
187 | + { |
|
188 | + $columns = array($columns); |
|
189 | + } |
|
162 | 190 | |
163 | 191 | foreach($columns as $column) |
164 | 192 | { |
@@ -171,7 +199,10 @@ discard block |
||
171 | 199 | $column = array_shift($where); |
172 | 200 | } |
173 | 201 | $total += ($changed = self::_update_account_id($this->change,$db,$table,$column,$where,$type)); |
174 | - if (!$check_only && $changed) echo "$app:\t$table.$column $changed id's changed\n"; |
|
202 | + if (!$check_only && $changed) |
|
203 | + { |
|
204 | + echo "$app:\t$table.$column $changed id's changed\n"; |
|
205 | + } |
|
175 | 206 | } |
176 | 207 | } |
177 | 208 | } |
@@ -180,10 +211,16 @@ discard block |
||
180 | 211 | foreach($GLOBALS['egw_info']['apps'] as $app => $data) |
181 | 212 | { |
182 | 213 | $total += ($changed = Api\Storage\Customfields::change_account_ids($app, $this->change)); |
183 | - if ($changed) echo "$app:\t$changed id's in definition of private custom fields changed\n"; |
|
214 | + if ($changed) |
|
215 | + { |
|
216 | + echo "$app:\t$changed id's in definition of private custom fields changed\n"; |
|
217 | + } |
|
184 | 218 | } |
185 | 219 | } |
186 | - if ($total) Api\Cache::flush(Api\Cache::INSTANCE); |
|
220 | + if ($total) |
|
221 | + { |
|
222 | + Api\Cache::flush(Api\Cache::INSTANCE); |
|
223 | + } |
|
187 | 224 | |
188 | 225 | return lang("Total of %1 id's changed.",$total)."\n"; |
189 | 226 | } |
@@ -212,7 +249,10 @@ discard block |
||
212 | 249 | { |
213 | 250 | case 'commasep': |
214 | 251 | case 'serialized': |
215 | - if (!$where) $where = array(); |
|
252 | + if (!$where) |
|
253 | + { |
|
254 | + $where = array(); |
|
255 | + } |
|
216 | 256 | $select = $where; |
217 | 257 | $select[] = "$column IS NOT NULL"; |
218 | 258 | $select[] = "$column != ''"; |
@@ -222,7 +262,10 @@ discard block |
||
222 | 262 | $ids = $type != 'serialized' ? explode(',',$old_ids=$row[$column]) : json_php_unserialize($old_ids=$row[$column]); |
223 | 263 | foreach($ids as $key => $id) |
224 | 264 | { |
225 | - if (isset($ids2change[$id])) $ids[$key] = $ids2change[$id]; |
|
265 | + if (isset($ids2change[$id])) |
|
266 | + { |
|
267 | + $ids[$key] = $ids2change[$id]; |
|
268 | + } |
|
226 | 269 | } |
227 | 270 | $ids2 = $type != 'serialized' ? implode(',',$ids) : serialize($ids); |
228 | 271 | if ($ids2 != $old_ids) |
@@ -239,7 +282,10 @@ discard block |
||
239 | 282 | break; |
240 | 283 | |
241 | 284 | case 'abs': |
242 | - if (!$where) $where = array(); |
|
285 | + if (!$where) |
|
286 | + { |
|
287 | + $where = array(); |
|
288 | + } |
|
243 | 289 | $where[$column] = array(); |
244 | 290 | foreach($ids2change as $from => $to) |
245 | 291 | { |
@@ -250,13 +296,22 @@ discard block |
||
250 | 296 | break; |
251 | 297 | |
252 | 298 | case 'prefs': // prefs groups are shifted down by 2 as -1 and -2 are for default and forced prefs |
253 | - if (!$where) $where = array(); |
|
299 | + if (!$where) |
|
300 | + { |
|
301 | + $where = array(); |
|
302 | + } |
|
254 | 303 | $where[$column] = array(); |
255 | 304 | $update_sql = ''; |
256 | 305 | foreach($ids2change as $from => $to) |
257 | 306 | { |
258 | - if ($from < 0) $from -= 2; |
|
259 | - if ($to < 0) $to -= 2; |
|
307 | + if ($from < 0) |
|
308 | + { |
|
309 | + $from -= 2; |
|
310 | + } |
|
311 | + if ($to < 0) |
|
312 | + { |
|
313 | + $to -= 2; |
|
314 | + } |
|
260 | 315 | $where[$column][] = $from; |
261 | 316 | $update_sql .= 'WHEN '.$db->quote($from,$db->column_definitions[$column]['type']).' THEN '.$db->quote($to,$db->column_definitions[$column]['type']).' '; |
262 | 317 | } |
@@ -265,7 +320,10 @@ discard block |
||
265 | 320 | break; |
266 | 321 | |
267 | 322 | default: |
268 | - if (!$where) $where = array(); |
|
323 | + if (!$where) |
|
324 | + { |
|
325 | + $where = array(); |
|
326 | + } |
|
269 | 327 | $where[$column] = array_keys($ids2change); |
270 | 328 | $db->update($table,$column.'= CASE '.$column.' '.$update_sql,$where,__LINE__,__FILE__); |
271 | 329 | $changed = $db->affected_rows(); |
@@ -50,57 +50,57 @@ discard block |
||
50 | 50 | 'link' => false, |
51 | 51 | 'icon' => false |
52 | 52 | ); |
53 | - display_sidebox($appname,lang('Admin'),$file); |
|
53 | + display_sidebox($appname, lang('Admin'), $file); |
|
54 | 54 | return; |
55 | 55 | } |
56 | 56 | if ($GLOBALS['egw_info']['user']['apps']['admin']) |
57 | 57 | { |
58 | 58 | |
59 | - if (! $GLOBALS['egw']->acl->check('site_config_acce',1,'admin')) |
|
59 | + if (!$GLOBALS['egw']->acl->check('site_config_acce', 1, 'admin')) |
|
60 | 60 | { |
61 | - $file['Site Configuration'] = Egw::link('/index.php','menuaction=admin.admin_config.index&appname=admin&ajax=true'); |
|
61 | + $file['Site Configuration'] = Egw::link('/index.php', 'menuaction=admin.admin_config.index&appname=admin&ajax=true'); |
|
62 | 62 | } |
63 | 63 | |
64 | - if (! $GLOBALS['egw']->acl->check('account_access',1,'admin')) |
|
64 | + if (!$GLOBALS['egw']->acl->check('account_access', 1, 'admin')) |
|
65 | 65 | { |
66 | - $file['User Accounts'] = array( |
|
66 | + $file['User Accounts'] = array( |
|
67 | 67 | 'id' => '/accounts', |
68 | 68 | 'icon' => Api\Image::find('addressbook', 'accounts'), |
69 | 69 | ); |
70 | 70 | } |
71 | 71 | |
72 | - if (! $GLOBALS['egw']->acl->check('account_access',16,'admin')) |
|
72 | + if (!$GLOBALS['egw']->acl->check('account_access', 16, 'admin')) |
|
73 | 73 | { |
74 | - $file['Bulk password reset'] = Egw::link('/index.php','menuaction=admin.admin_passwordreset.index&ajax=true'); |
|
74 | + $file['Bulk password reset'] = Egw::link('/index.php', 'menuaction=admin.admin_passwordreset.index&ajax=true'); |
|
75 | 75 | } |
76 | 76 | |
77 | - if (! $GLOBALS['egw']->acl->check('group_access',1,'admin')) |
|
77 | + if (!$GLOBALS['egw']->acl->check('group_access', 1, 'admin')) |
|
78 | 78 | { |
79 | - $file['User Groups'] = array( |
|
79 | + $file['User Groups'] = array( |
|
80 | 80 | 'id' => '/groups', |
81 | 81 | 'icon' => Api\Image::find('addressbook', 'group'), |
82 | 82 | 'child' => 1, |
83 | 83 | ); |
84 | 84 | } |
85 | 85 | |
86 | - if (! $GLOBALS['egw']->acl->check('global_categorie',1,'admin')) |
|
86 | + if (!$GLOBALS['egw']->acl->check('global_categorie', 1, 'admin')) |
|
87 | 87 | { |
88 | - $file['Global Categories'] = Egw::link('/index.php','menuaction=admin.admin_categories.index&appname=phpgw&ajax=true'); |
|
88 | + $file['Global Categories'] = Egw::link('/index.php', 'menuaction=admin.admin_categories.index&appname=phpgw&ajax=true'); |
|
89 | 89 | } |
90 | 90 | |
91 | - if (!$GLOBALS['egw']->acl->check('mainscreen_messa',1,'admin') || !$GLOBALS['egw']->acl->check('mainscreen_messa',2,'admin')) |
|
91 | + if (!$GLOBALS['egw']->acl->check('mainscreen_messa', 1, 'admin') || !$GLOBALS['egw']->acl->check('mainscreen_messa', 2, 'admin')) |
|
92 | 92 | { |
93 | - $file['Change Main Screen Message'] = Egw::link('/index.php','menuaction=admin.admin_messages.index'); |
|
93 | + $file['Change Main Screen Message'] = Egw::link('/index.php', 'menuaction=admin.admin_messages.index'); |
|
94 | 94 | } |
95 | 95 | |
96 | - if (! $GLOBALS['egw']->acl->check('current_sessions',1,'admin')) |
|
96 | + if (!$GLOBALS['egw']->acl->check('current_sessions', 1, 'admin')) |
|
97 | 97 | { |
98 | - $file['View Sessions'] = Egw::link('/index.php','menuaction=admin.admin_accesslog.sessions&ajax=true'); |
|
98 | + $file['View Sessions'] = Egw::link('/index.php', 'menuaction=admin.admin_accesslog.sessions&ajax=true'); |
|
99 | 99 | } |
100 | 100 | |
101 | - if (! $GLOBALS['egw']->acl->check('access_log_acces',1,'admin')) |
|
101 | + if (!$GLOBALS['egw']->acl->check('access_log_acces', 1, 'admin')) |
|
102 | 102 | { |
103 | - $file['View Access Log'] = Egw::link('/index.php','menuaction=admin.admin_accesslog.index&ajax=true'); |
|
103 | + $file['View Access Log'] = Egw::link('/index.php', 'menuaction=admin.admin_accesslog.index&ajax=true'); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /* disable old EGroupware error_log, as it is not used anymore |
@@ -109,48 +109,48 @@ discard block |
||
109 | 109 | $file['View Error Log'] = Egw::link('/index.php','menuaction=admin.uilog.list_log'); |
110 | 110 | }*/ |
111 | 111 | |
112 | - if (! $GLOBALS['egw']->acl->check('applications_acc',16,'admin')) |
|
112 | + if (!$GLOBALS['egw']->acl->check('applications_acc', 16, 'admin')) |
|
113 | 113 | { |
114 | 114 | $file['Clear cache and register hooks'] = array( |
115 | 115 | 'id' => 'admin/clear_cache', |
116 | 116 | 'no_lang' => true, |
117 | - 'link' => "javascript:egw.message('".lang('Clear cache and register hooks') . "<br />" .lang('Please wait...')."','info'); " . |
|
117 | + 'link' => "javascript:egw.message('".lang('Clear cache and register hooks')."<br />".lang('Please wait...')."','info'); ". |
|
118 | 118 | "egw.json('admin.admin_hooks.ajax_clear_cache').sendRequest(true);" |
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - if (! $GLOBALS['egw']->acl->check('asyncservice_acc',1,'admin')) |
|
122 | + if (!$GLOBALS['egw']->acl->check('asyncservice_acc', 1, 'admin')) |
|
123 | 123 | { |
124 | - $file['Asynchronous timed services'] = Egw::link('/index.php','menuaction=admin.admin_asyncservice.index'); |
|
124 | + $file['Asynchronous timed services'] = Egw::link('/index.php', 'menuaction=admin.admin_asyncservice.index'); |
|
125 | 125 | } |
126 | 126 | |
127 | - if (! $GLOBALS['egw']->acl->check('db_backup_access',1,'admin')) |
|
127 | + if (!$GLOBALS['egw']->acl->check('db_backup_access', 1, 'admin')) |
|
128 | 128 | { |
129 | - $file['DB backup and restore'] = Egw::link('/index.php','menuaction=admin.admin_db_backup.index'); |
|
129 | + $file['DB backup and restore'] = Egw::link('/index.php', 'menuaction=admin.admin_db_backup.index'); |
|
130 | 130 | } |
131 | 131 | |
132 | - if (! $GLOBALS['egw']->acl->check('info_access',1,'admin')) |
|
132 | + if (!$GLOBALS['egw']->acl->check('info_access', 1, 'admin')) |
|
133 | 133 | { |
134 | - $file['phpInfo'] = "javascript:egw.openPopup('" . Egw::link('/admin/phpinfo.php','',false) . "',960,600,'phpinfoWindow')"; |
|
134 | + $file['phpInfo'] = "javascript:egw.openPopup('".Egw::link('/admin/phpinfo.php', '', false)."',960,600,'phpinfoWindow')"; |
|
135 | 135 | } |
136 | - $file['Admin queue and history'] = Egw::link('/index.php','menuaction=admin.admin_cmds.index&ajax=true'); |
|
137 | - $file['Remote administration instances'] = Egw::link('/index.php','menuaction=admin.admin_cmds.remotes&ajax=true'); |
|
138 | - $file['Custom translation'] = Egw::link('/index.php','menuaction=admin.admin_customtranslation.index'); |
|
139 | - $file['Changelog and versions'] = Egw::link('/index.php','menuaction=api.EGroupware\\Api\\Framework\\About.index&ajax=true'); |
|
136 | + $file['Admin queue and history'] = Egw::link('/index.php', 'menuaction=admin.admin_cmds.index&ajax=true'); |
|
137 | + $file['Remote administration instances'] = Egw::link('/index.php', 'menuaction=admin.admin_cmds.remotes&ajax=true'); |
|
138 | + $file['Custom translation'] = Egw::link('/index.php', 'menuaction=admin.admin_customtranslation.index'); |
|
139 | + $file['Changelog and versions'] = Egw::link('/index.php', 'menuaction=api.EGroupware\\Api\\Framework\\About.index&ajax=true'); |
|
140 | 140 | |
141 | - $file['Submit statistic information'] = Egw::link('/index.php','menuaction=admin.admin_statistics.submit'); |
|
141 | + $file['Submit statistic information'] = Egw::link('/index.php', 'menuaction=admin.admin_statistics.submit'); |
|
142 | 142 | |
143 | 143 | if ($location == 'admin') |
144 | 144 | { |
145 | - display_section($appname,$file); |
|
145 | + display_section($appname, $file); |
|
146 | 146 | } |
147 | 147 | else |
148 | 148 | { |
149 | - foreach($file as &$url) |
|
149 | + foreach ($file as &$url) |
|
150 | 150 | { |
151 | 151 | if (is_array($url) && $url['link']) $url = $url['link']; |
152 | 152 | } |
153 | - display_sidebox($appname,lang('Admin'),$file); |
|
153 | + display_sidebox($appname, lang('Admin'), $file); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | function ajax_clear_cache() |
162 | 162 | { |
163 | - if ($GLOBALS['egw']->acl->check('applications_acc',16,'admin')) |
|
163 | + if ($GLOBALS['egw']->acl->check('applications_acc', 16, 'admin')) |
|
164 | 164 | { |
165 | 165 | $GLOBALS['egw']->redirect_link('/index.php'); |
166 | 166 | } |
@@ -168,9 +168,9 @@ discard block |
||
168 | 168 | |
169 | 169 | Api\Image::invalidate(); |
170 | 170 | |
171 | - if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // Egw object in setup is limited |
|
171 | + if (method_exists($GLOBALS['egw'], 'invalidate_session_cache')) // Egw object in setup is limited |
|
172 | 172 | { |
173 | - $GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session |
|
173 | + $GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session |
|
174 | 174 | } |
175 | 175 | // allow apps to hook into "Admin >> Clear cache and register hooks" |
176 | 176 | Api\Hooks::process('clear_cache', array(), true); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | 'icon' => 'lock', |
196 | 196 | ); |
197 | 197 | |
198 | - if (!$GLOBALS['egw']->acl->check('current_sessions',1,'admin')) // no rights to view |
|
198 | + if (!$GLOBALS['egw']->acl->check('current_sessions', 1, 'admin')) // no rights to view |
|
199 | 199 | { |
200 | 200 | $actions[] = array( |
201 | 201 | 'description' => 'Login History', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
208 | - if (!$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights |
|
208 | + if (!$GLOBALS['egw']->acl->check('account_access', 64, 'admin')) // no rights to set ACL-rights |
|
209 | 209 | { |
210 | 210 | $actions[] = array( |
211 | 211 | 'description' => 'Deny access', |
@@ -229,18 +229,18 @@ discard block |
||
229 | 229 | $emailadmin = Api\Mail\Account::get_default(); |
230 | 230 | if ($emailadmin->acc_smtp_type && $emailadmin->acc_smtp_type !== 'EGroupware\Api\Mail\Smtp') |
231 | 231 | { |
232 | - $actions[] = array ( |
|
232 | + $actions[] = array( |
|
233 | 233 | 'id' => 'mail_activeAccounts', |
234 | 234 | 'caption' => '(de)activate mail accounts', |
235 | 235 | 'icon' => 'mail/navbar', |
236 | - 'children' => array ( |
|
237 | - 'active' => array ( |
|
236 | + 'children' => array( |
|
237 | + 'active' => array( |
|
238 | 238 | 'caption' => 'activate', |
239 | 239 | 'onExecute' => 'javaScript:app.admin.emailadminActiveAccounts', |
240 | 240 | 'icon' => 'check', |
241 | 241 | 'allowOnMultiple' => true |
242 | 242 | ), |
243 | - 'inactive' => array ( |
|
243 | + 'inactive' => array( |
|
244 | 244 | 'caption' => 'deactivate', |
245 | 245 | 'onExecute' => 'javaScript:app.admin.emailadminActiveAccounts', |
246 | 246 | 'icon' => 'bullet', |
@@ -148,7 +148,10 @@ discard block |
||
148 | 148 | { |
149 | 149 | foreach($file as &$url) |
150 | 150 | { |
151 | - if (is_array($url) && $url['link']) $url = $url['link']; |
|
151 | + if (is_array($url) && $url['link']) |
|
152 | + { |
|
153 | + $url = $url['link']; |
|
154 | + } |
|
152 | 155 | } |
153 | 156 | display_sidebox($appname,lang('Admin'),$file); |
154 | 157 | } |
@@ -168,9 +171,13 @@ discard block |
||
168 | 171 | |
169 | 172 | Api\Image::invalidate(); |
170 | 173 | |
171 | - if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // Egw object in setup is limited |
|
174 | + if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) |
|
172 | 175 | { |
173 | - $GLOBALS['egw']->invalidate_session_cache(); // in case with cache the egw_info array in the session |
|
176 | + // Egw object in setup is limited |
|
177 | + { |
|
178 | + $GLOBALS['egw']->invalidate_session_cache(); |
|
179 | + } |
|
180 | + // in case with cache the egw_info array in the session |
|
174 | 181 | } |
175 | 182 | // allow apps to hook into "Admin >> Clear cache and register hooks" |
176 | 183 | Api\Hooks::process('clear_cache', array(), true); |
@@ -195,7 +202,9 @@ discard block |
||
195 | 202 | 'icon' => 'lock', |
196 | 203 | ); |
197 | 204 | |
198 | - if (!$GLOBALS['egw']->acl->check('current_sessions',1,'admin')) // no rights to view |
|
205 | + if (!$GLOBALS['egw']->acl->check('current_sessions',1,'admin')) |
|
206 | + { |
|
207 | + // no rights to view |
|
199 | 208 | { |
200 | 209 | $actions[] = array( |
201 | 210 | 'description' => 'Login History', |
@@ -204,8 +213,11 @@ discard block |
||
204 | 213 | 'icon' => 'timesheet', |
205 | 214 | ); |
206 | 215 | } |
216 | + } |
|
207 | 217 | |
208 | - if (!$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights |
|
218 | + if (!$GLOBALS['egw']->acl->check('account_access',64,'admin')) |
|
219 | + { |
|
220 | + // no rights to set ACL-rights |
|
209 | 221 | { |
210 | 222 | $actions[] = array( |
211 | 223 | 'description' => 'Deny access', |
@@ -214,6 +226,7 @@ discard block |
||
214 | 226 | 'icon' => 'cancel', |
215 | 227 | ); |
216 | 228 | } |
229 | + } |
|
217 | 230 | |
218 | 231 | // currently no way to deny Admins access to administrate mail |
219 | 232 | // we could add a deny check as for other admin functionality |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param egw_record $_definition |
23 | 23 | */ |
24 | - public function export( $_stream, importexport_definition $_definition) { |
|
24 | + public function export($_stream, importexport_definition $_definition) { |
|
25 | 25 | $options = $_definition->plugin_options; |
26 | 26 | |
27 | 27 | $query = array( |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | // $_record is an array, that's what search() returns |
41 | 41 | foreach ($selection as $_record) { |
42 | 42 | $record = new admin_egw_group_record($_record); |
43 | - if($options['convert']) { |
|
43 | + if ($options['convert']) { |
|
44 | 44 | importexport_export_csv::convert($record, admin_egw_group_record::$types, 'admin', $lookups); |
45 | 45 | } else { |
46 | 46 | // Implode arrays, so they don't say 'Array' |
47 | - foreach($record->get_record_array() as $key => $value) { |
|
48 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
47 | + foreach ($record->get_record_array() as $key => $value) { |
|
48 | + if (is_array($value)) $record->$key = implode(',', $value); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | $export_object->export_record($record); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | /** |
26 | 26 | * Exports records as defined in $_definition |
27 | 27 | * |
28 | - * @param egw_record $_definition |
|
28 | + * @param importexport_definition $_definition |
|
29 | 29 | */ |
30 | 30 | public function export( $_stream, importexport_definition $_definition) { |
31 | 31 | $options = $_definition->plugin_options; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * return html for options. |
133 | 133 | * this way the plugin has all opportunities for options tab |
134 | 134 | * |
135 | - * @return string html |
|
135 | + * @return boolean html |
|
136 | 136 | */ |
137 | 137 | public function get_options_etpl() { |
138 | 138 | return false; |
@@ -125,8 +125,8 @@ |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | public static function get_mimetype() { |
128 | - return 'text/csv'; |
|
129 | - } |
|
128 | + return 'text/csv'; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * return html for options. |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param egw_record $_definition |
23 | 23 | */ |
24 | - public function export( $_stream, importexport_definition $_definition) { |
|
24 | + public function export( $_stream, importexport_definition $_definition) |
|
25 | + { |
|
25 | 26 | $options = $_definition->plugin_options; |
26 | 27 | |
27 | 28 | $query = array( |
@@ -38,14 +39,22 @@ discard block |
||
38 | 39 | ); |
39 | 40 | |
40 | 41 | // $_record is an array, that's what search() returns |
41 | - foreach ($selection as $_record) { |
|
42 | + foreach ($selection as $_record) |
|
43 | + { |
|
42 | 44 | $record = new admin_egw_group_record($_record); |
43 | - if($options['convert']) { |
|
45 | + if($options['convert']) |
|
46 | + { |
|
44 | 47 | importexport_export_csv::convert($record, admin_egw_group_record::$types, 'admin', $lookups); |
45 | - } else { |
|
48 | + } |
|
49 | + else |
|
50 | + { |
|
46 | 51 | // Implode arrays, so they don't say 'Array' |
47 | - foreach($record->get_record_array() as $key => $value) { |
|
48 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
52 | + foreach($record->get_record_array() as $key => $value) |
|
53 | + { |
|
54 | + if(is_array($value)) |
|
55 | + { |
|
56 | + $record->$key = implode(',', $value); |
|
57 | + } |
|
49 | 58 | } |
50 | 59 | } |
51 | 60 | $export_object->export_record($record); |
@@ -58,7 +67,8 @@ discard block |
||
58 | 67 | * |
59 | 68 | * @return string name |
60 | 69 | */ |
61 | - public static function get_name() { |
|
70 | + public static function get_name() |
|
71 | + { |
|
62 | 72 | return lang('Group CSV export'); |
63 | 73 | } |
64 | 74 | |
@@ -67,7 +77,8 @@ discard block |
||
67 | 77 | * |
68 | 78 | * @return string descriprion |
69 | 79 | */ |
70 | - public static function get_description() { |
|
80 | + public static function get_description() |
|
81 | + { |
|
71 | 82 | return lang("Exports groups into a CSV File. "); |
72 | 83 | } |
73 | 84 | |
@@ -76,11 +87,13 @@ discard block |
||
76 | 87 | * |
77 | 88 | * @return string suffix |
78 | 89 | */ |
79 | - public static function get_filesuffix() { |
|
90 | + public static function get_filesuffix() |
|
91 | + { |
|
80 | 92 | return 'csv'; |
81 | 93 | } |
82 | 94 | |
83 | - public static function get_mimetype() { |
|
95 | + public static function get_mimetype() |
|
96 | + { |
|
84 | 97 | return 'text/csv'; |
85 | 98 | } |
86 | 99 | |
@@ -90,7 +103,8 @@ discard block |
||
90 | 103 | * |
91 | 104 | * @return string html |
92 | 105 | */ |
93 | - public function get_options_etpl() { |
|
106 | + public function get_options_etpl() |
|
107 | + { |
|
94 | 108 | return false; |
95 | 109 | } |
96 | 110 | |
@@ -98,7 +112,8 @@ discard block |
||
98 | 112 | * returns slectors of this plugin via xajax |
99 | 113 | * |
100 | 114 | */ |
101 | - public function get_selectors_etpl() { |
|
115 | + public function get_selectors_etpl() |
|
116 | + { |
|
102 | 117 | return array( |
103 | 118 | 'preserv' => array('no_error_for_no_selection'), |
104 | 119 | ); |
@@ -40,11 +40,10 @@ discard block |
||
40 | 40 | { |
41 | 41 | if ((string)$content['owner'] === '0' && $GLOBALS['egw_info']['user']['apps']['admin']) |
42 | 42 | { |
43 | - $deny_edit = $content['account_id'] ? $GLOBALS['egw']->acl->check('account_access', 16, 'admin') : |
|
44 | - $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
|
43 | + $deny_edit = $content['account_id'] ? $GLOBALS['egw']->acl->check('account_access', 16, 'admin') : $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
|
45 | 44 | //error_log(__METHOD__."() contact_id=$content[contact_id], account_id=$content[account_id], deny_edit=".array2string($deny_edit)); |
46 | 45 | |
47 | - if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
46 | + if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
48 | 47 | |
49 | 48 | // load our translations |
50 | 49 | Api\Translation::add_app('admin'); |
@@ -58,7 +57,7 @@ discard block |
||
58 | 57 | throw new Api\Exception\NotFound('Account data NOT found!'); |
59 | 58 | } |
60 | 59 | if ($account['account_expires'] == -1) $account['account_expires'] = ''; |
61 | - unset($account['account_pwd']); // do NOT send to client |
|
60 | + unset($account['account_pwd']); // do NOT send to client |
|
62 | 61 | $account['memberships'] = array_keys($account['memberships']); |
63 | 62 | $acl = new Acl($content['account_id']); |
64 | 63 | $acl->read_repository(); |
@@ -78,7 +77,7 @@ discard block |
||
78 | 77 | 'account_status' => 'A', |
79 | 78 | 'memberships' => array(), |
80 | 79 | 'anonymous' => false, |
81 | - 'changepassword' => true, //old default: (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days'], |
|
80 | + 'changepassword' => true, //old default: (bool)$GLOBALS['egw_info']['server']['change_pwd_every_x_days'], |
|
82 | 81 | 'mustchangepassword' => false, |
83 | 82 | 'account_primary_group' => $GLOBALS['egw']->accounts->name2id('Default'), |
84 | 83 | 'homedirectory' => $GLOBALS['egw_info']['server']['ldap_account_home'], |
@@ -99,7 +98,7 @@ discard block |
||
99 | 98 | |
100 | 99 | if ($deny_edit) |
101 | 100 | { |
102 | - foreach(array_keys($account) as $key) |
|
101 | + foreach (array_keys($account) as $key) |
|
103 | 102 | { |
104 | 103 | $readonlys[$key] = true; |
105 | 104 | } |
@@ -131,11 +130,11 @@ discard block |
||
131 | 130 | { |
132 | 131 | if ($content['old_account'] && $content['old_account'] == array_diff_key($content, $content['old_account'])) |
133 | 132 | { |
134 | - return ''; // no need to save account data, if nothing changed |
|
133 | + return ''; // no need to save account data, if nothing changed |
|
135 | 134 | } |
136 | 135 | //error_log(__METHOD__."(".array2string($content).")"); |
137 | 136 | $account = array(); |
138 | - foreach(array( |
|
137 | + foreach (array( |
|
139 | 138 | // need to copy/rename some fields named different in account and contact |
140 | 139 | 'n_given' => 'account_firstname', |
141 | 140 | 'n_family' => 'account_lastname', |
@@ -152,11 +151,10 @@ discard block |
||
152 | 151 | { |
153 | 152 | if (is_int($c_name)) $c_name = $a_name; |
154 | 153 | |
155 | - switch($a_name) |
|
154 | + switch ($a_name) |
|
156 | 155 | { |
157 | 156 | case 'account_expires': |
158 | - $account[$a_name] = $content[$c_name] ? $content[$c_name] : |
|
159 | - ($content['account_status'] ? 'never' : 'already'); |
|
157 | + $account[$a_name] = $content[$c_name] ? $content[$c_name] : ($content['account_status'] ? 'never' : 'already'); |
|
160 | 158 | break; |
161 | 159 | |
162 | 160 | case 'changepassword': // boolean values: admin_cmd_edit_user understands '' as NOT set |
@@ -171,7 +169,7 @@ discard block |
||
171 | 169 | } |
172 | 170 | } |
173 | 171 | // Make sure primary group is in account groups |
174 | - if($account['account_primary_group'] && !array_search($account['account_primary_group'], (array)$account['account_groups'])) |
|
172 | + if ($account['account_primary_group'] && !array_search($account['account_primary_group'], (array)$account['account_groups'])) |
|
175 | 173 | { |
176 | 174 | $account['account_groups'][] = $account['account_primary_group']; |
177 | 175 | } |
@@ -204,7 +202,7 @@ discard block |
||
204 | 202 | * |
205 | 203 | * @param array $content =null |
206 | 204 | */ |
207 | - public static function delete(array $content=null) |
|
205 | + public static function delete(array $content = null) |
|
208 | 206 | { |
209 | 207 | if (!is_array($content)) |
210 | 208 | { |
@@ -221,7 +219,7 @@ discard block |
||
221 | 219 | } |
222 | 220 | //error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content)); |
223 | 221 | } |
224 | - if ($GLOBALS['egw']->acl->check('account_access',32,'admin') || !($content['account_id'] > 0) || |
|
222 | + if ($GLOBALS['egw']->acl->check('account_access', 32, 'admin') || !($content['account_id'] > 0) || |
|
225 | 223 | $GLOBALS['egw_info']['user']['account_id'] == $content['account_id']) |
226 | 224 | { |
227 | 225 | Framework::window_close(lang('Permission denied!!!')); |
@@ -275,7 +273,7 @@ discard block |
||
275 | 273 | } |
276 | 274 | } |
277 | 275 | |
278 | - if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
276 | + if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
279 | 277 | |
280 | 278 | // set home-directory when account_lid is entered, but only for new Api\Accounts |
281 | 279 | if ($changed == 'account_lid' && !$data['account_id'] && |
@@ -294,7 +292,7 @@ discard block |
||
294 | 292 | $cmd = new admin_cmd_edit_user($data['account_id'], $data); |
295 | 293 | $cmd->run(null, false, false, true); |
296 | 294 | } |
297 | - catch(Exception $e) |
|
295 | + catch (Exception $e) |
|
298 | 296 | { |
299 | 297 | Api\Json\Response::get()->data($e->getMessage()); |
300 | 298 | } |
@@ -44,20 +44,30 @@ discard block |
||
44 | 44 | $GLOBALS['egw']->acl->check('account_access', 4, 'admin'); |
45 | 45 | //error_log(__METHOD__."() contact_id=$content[contact_id], account_id=$content[account_id], deny_edit=".array2string($deny_edit)); |
46 | 46 | |
47 | - if (!$content['account_id'] && $deny_edit) return; // no right to add new Api\Accounts, should not happen by AB ACL |
|
47 | + if (!$content['account_id'] && $deny_edit) |
|
48 | + { |
|
49 | + return; |
|
50 | + } |
|
51 | + // no right to add new Api\Accounts, should not happen by AB ACL |
|
48 | 52 | |
49 | 53 | // load our translations |
50 | 54 | Api\Translation::add_app('admin'); |
51 | 55 | |
52 | - if ($content['id']) // existing account |
|
56 | + if ($content['id']) |
|
57 | + { |
|
58 | + // existing account |
|
53 | 59 | { |
54 | 60 | // invalidate account, before reading it, to code with changed to DB or LDAP outside EGw |
55 | 61 | Api\Accounts::cache_invalidate((int)$content['account_id']); |
62 | + } |
|
56 | 63 | if (!($account = $GLOBALS['egw']->accounts->read($content['account_id']))) |
57 | 64 | { |
58 | 65 | throw new Api\Exception\NotFound('Account data NOT found!'); |
59 | 66 | } |
60 | - if ($account['account_expires'] == -1) $account['account_expires'] = ''; |
|
67 | + if ($account['account_expires'] == -1) |
|
68 | + { |
|
69 | + $account['account_expires'] = ''; |
|
70 | + } |
|
61 | 71 | unset($account['account_pwd']); // do NOT send to client |
62 | 72 | $account['memberships'] = array_keys($account['memberships']); |
63 | 73 | $acl = new Acl($content['account_id']); |
@@ -150,7 +160,10 @@ discard block |
||
150 | 160 | 'homedirectory', 'loginshell', |
151 | 161 | ) as $c_name => $a_name) |
152 | 162 | { |
153 | - if (is_int($c_name)) $c_name = $a_name; |
|
163 | + if (is_int($c_name)) |
|
164 | + { |
|
165 | + $c_name = $a_name; |
|
166 | + } |
|
154 | 167 | |
155 | 168 | switch($a_name) |
156 | 169 | { |
@@ -269,13 +282,20 @@ discard block |
||
269 | 282 | if (!$data['account_id'] && in_array($changed, array('n_given', 'n_family', 'account_lid'))) |
270 | 283 | { |
271 | 284 | $email = Api\Accounts::email($data['account_firstname'], $data['account_lastname'], $data['account_lid']); |
272 | - if ($email && $email[0] != '@' && strpos($email, '@')) // only add valid email addresses |
|
285 | + if ($email && $email[0] != '@' && strpos($email, '@')) |
|
286 | + { |
|
287 | + // only add valid email addresses |
|
273 | 288 | { |
274 | 289 | Api\Json\Response::get()->assign('addressbook-edit_email', 'value', $email); |
275 | 290 | } |
291 | + } |
|
276 | 292 | } |
277 | 293 | |
278 | - if (!$data['account_lid'] && !$data['account_id']) return; // makes no sense to check before |
|
294 | + if (!$data['account_lid'] && !$data['account_id']) |
|
295 | + { |
|
296 | + return; |
|
297 | + } |
|
298 | + // makes no sense to check before |
|
279 | 299 | |
280 | 300 | // set home-directory when account_lid is entered, but only for new Api\Accounts |
281 | 301 | if ($changed == 'account_lid' && !$data['account_id'] && |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | 'List config settings' => 1, |
15 | 15 | 'Change config settings' => 2 |
16 | 16 | ) |
17 | -); // added and working ralfbecker |
|
17 | +); // added and working ralfbecker |
|
18 | 18 | |
19 | 19 | $GLOBALS['acl_manager']['admin']['account_access'] = array( |
20 | 20 | 'name' => 'Deny access to user accounts', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'Delete account' => 32, |
28 | 28 | 'change ACL Rights' => 64 |
29 | 29 | ) |
30 | -); // was already there and seems to work ralfbecker |
|
30 | +); // was already there and seems to work ralfbecker |
|
31 | 31 | |
32 | 32 | $GLOBALS['acl_manager']['admin']['group_access'] = array( |
33 | 33 | 'name' => 'Deny access to groups', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'Edit group' => 16, |
40 | 40 | 'Delete group' => 32 |
41 | 41 | ) |
42 | -); // was already there and seems to work ralfbecker |
|
42 | +); // was already there and seems to work ralfbecker |
|
43 | 43 | |
44 | 44 | $GLOBALS['acl_manager']['admin']['applications_acc'] = array( |
45 | 45 | 'name' => 'Deny access to applications', |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | 'Register application hooks' => 16 |
54 | 54 | ) |
55 | -); // added and working ralfbecker |
|
55 | +); // added and working ralfbecker |
|
56 | 56 | |
57 | 57 | $GLOBALS['acl_manager']['admin']['global_categorie'] = array( |
58 | 58 | 'name' => 'Deny access to global categories', |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | 'Delete category' => 32, |
66 | 66 | 'Add sub-category' => 64 |
67 | 67 | ) |
68 | -); // added and working ralfbecker |
|
68 | +); // added and working ralfbecker |
|
69 | 69 | |
70 | 70 | $GLOBALS['acl_manager']['admin']['mainscreen_messa'] = array( |
71 | 71 | 'name' => 'Deny access to mainscreen message', |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'Main screen message' => 1, |
74 | 74 | 'Login message' => 2 |
75 | 75 | ) |
76 | -); // added and working ralfbecker |
|
76 | +); // added and working ralfbecker |
|
77 | 77 | |
78 | 78 | $GLOBALS['acl_manager']['admin']['current_sessions'] = array( |
79 | 79 | 'name' => 'Deny access to current sessions', |
@@ -83,40 +83,40 @@ discard block |
||
83 | 83 | 'Show session IP address' => 4, |
84 | 84 | 'Kill session' => 8 |
85 | 85 | ) |
86 | -); // checked and working ralfbecker |
|
86 | +); // checked and working ralfbecker |
|
87 | 87 | |
88 | 88 | $GLOBALS['acl_manager']['admin']['access_log_acces'] = array( |
89 | 89 | 'name' => 'Deny access to access log', |
90 | 90 | 'rights' => array( |
91 | 91 | 'Show access log' => 1 |
92 | 92 | ) |
93 | -); // added and working ralfbecker |
|
93 | +); // added and working ralfbecker |
|
94 | 94 | |
95 | 95 | $GLOBALS['acl_manager']['admin']['error_log_access'] = array( |
96 | 96 | 'name' => 'Deny access to error log', |
97 | 97 | 'rights' => array( |
98 | 98 | 'Show error log' => 1 |
99 | 99 | ) |
100 | -); // added and working ralfbecker |
|
100 | +); // added and working ralfbecker |
|
101 | 101 | |
102 | 102 | $GLOBALS['acl_manager']['admin']['asyncservice_acc'] = array( |
103 | 103 | 'name' => 'Deny access to asynchronous timed services', |
104 | 104 | 'rights' => array( |
105 | 105 | 'Asynchronous timed services' => 1 |
106 | 106 | ) |
107 | -); // added and working ralfbecker |
|
107 | +); // added and working ralfbecker |
|
108 | 108 | |
109 | 109 | $GLOBALS['acl_manager']['admin']['db_backup_access'] = array( |
110 | 110 | 'name' => 'Deny access to DB backup and restore', |
111 | 111 | 'rights' => array( |
112 | 112 | 'DB backup and restore' => 1 |
113 | 113 | ) |
114 | -); // added and working ralfbecker |
|
114 | +); // added and working ralfbecker |
|
115 | 115 | |
116 | 116 | $GLOBALS['acl_manager']['admin']['info_access'] = array( |
117 | 117 | 'name' => 'Deny access to phpinfo', |
118 | 118 | 'rights' => array( |
119 | 119 | 'Show phpinfo()' => 1 |
120 | 120 | ) |
121 | -); // added and working ralfbecker |
|
121 | +); // added and working ralfbecker |
|
122 | 122 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | var $public_functions = array('index' => True); |
21 | 21 | |
22 | - function index($_content=null) |
|
22 | + function index($_content = null) |
|
23 | 23 | { |
24 | 24 | if (is_array($_content)) |
25 | 25 | { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | throw new Api\Exception\WrongParameter("Wrong or missing appname parameter!"); |
35 | 35 | } |
36 | - if ($GLOBALS['egw']->acl->check('site_config_acce',1,'admin')) |
|
36 | + if ($GLOBALS['egw']->acl->check('site_config_acce', 1, 'admin')) |
|
37 | 37 | { |
38 | 38 | Api\Framework::redirect_link('/index.php'); |
39 | 39 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | Api\Translation::add_app($_appname); |
45 | 45 | } |
46 | 46 | |
47 | - switch($_appname) |
|
47 | + switch ($_appname) |
|
48 | 48 | { |
49 | 49 | case 'admin': |
50 | 50 | case 'addressbook': |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $c = new Api\Config($config_appname); |
68 | 68 | $c->read_repository(); |
69 | - if ($_content['cancel'] || ($_content['save'] || $_content['apply']) && $GLOBALS['egw']->acl->check('site_config_acce',2,'admin')) |
|
69 | + if ($_content['cancel'] || ($_content['save'] || $_content['apply']) && $GLOBALS['egw']->acl->check('site_config_acce', 2, 'admin')) |
|
70 | 70 | { |
71 | 71 | Api\Framework::redirect_link('/admin/index.php?ajax=true'); |
72 | 72 | } |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | /* Load hook file with functions to validate each config (one/none/all) */ |
80 | 80 | Api\Hooks::single(array( |
81 | 81 | 'location' => 'config_validate', |
82 | - )+$_content['newsettings'], $appname); |
|
82 | + ) + $_content['newsettings'], $appname); |
|
83 | 83 | |
84 | - foreach($_content['newsettings'] as $key => $config) |
|
84 | + foreach ($_content['newsettings'] as $key => $config) |
|
85 | 85 | { |
86 | 86 | if ($config) |
87 | 87 | { |
@@ -89,26 +89,26 @@ discard block |
||
89 | 89 | if (in_array($key, (array)$GLOBALS['egw_info']['server']['found_validation_hook'], true) && function_exists($key)) |
90 | 90 | { |
91 | 91 | call_user_func($key, $config, $c); |
92 | - if($GLOBALS['config_error']) |
|
92 | + if ($GLOBALS['config_error']) |
|
93 | 93 | { |
94 | - $errors .= lang($GLOBALS['config_error']) . "\n"; |
|
94 | + $errors .= lang($GLOBALS['config_error'])."\n"; |
|
95 | 95 | $GLOBALS['config_error'] = False; |
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
99 | 99 | // don't erase passwords, since we also don't print them |
100 | - elseif(strpos($key,'passwd') === false && strpos($key,'password') === false && strpos($key,'root_pw') === false) |
|
100 | + elseif (strpos($key, 'passwd') === false && strpos($key, 'password') === false && strpos($key, 'root_pw') === false) |
|
101 | 101 | { |
102 | 102 | unset($c->config_data[$key]); |
103 | 103 | } |
104 | 104 | } |
105 | - if(in_array('final_validation', (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && |
|
105 | + if (in_array('final_validation', (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && |
|
106 | 106 | function_exists('final_validation')) |
107 | 107 | { |
108 | 108 | final_validation($_content['newsettings']); |
109 | - if($GLOBALS['config_error']) |
|
109 | + if ($GLOBALS['config_error']) |
|
110 | 110 | { |
111 | - $errors .= lang($GLOBALS['config_error']) . "\n"; |
|
111 | + $errors .= lang($GLOBALS['config_error'])."\n"; |
|
112 | 112 | $GLOBALS['config_error'] = False; |
113 | 113 | } |
114 | 114 | unset($GLOBALS['egw_info']['server']['found_validation_hook']); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | |
117 | 117 | $c->save_repository(); |
118 | 118 | |
119 | - if(!$errors && !$_content['apply']) |
|
119 | + if (!$errors && !$_content['apply']) |
|
120 | 120 | { |
121 | 121 | Api\Framework::message(lang('Configuration saved.'), 'success'); |
122 | 122 | Api\Framework::redirect_link('/index.php', array( |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - if($errors) |
|
129 | + if ($errors) |
|
130 | 130 | { |
131 | - Api\Framework::message(lang('Error') . ': ' . $errors, 'error'); |
|
131 | + Api\Framework::message(lang('Error').': '.$errors, 'error'); |
|
132 | 132 | unset($errors); |
133 | 133 | unset($GLOBALS['config_error']); |
134 | 134 | } |
@@ -160,13 +160,13 @@ discard block |
||
160 | 160 | // for security reasons we do not send all config to client-side, but only ones mentioned in templates |
161 | 161 | $matches = null; |
162 | 162 | preg_match_all('/id="newsettings\[([^]]+)\]"/', file_get_contents($path), $matches, PREG_PATTERN_ORDER); |
163 | - foreach($matches[1] as $name) |
|
163 | + foreach ($matches[1] as $name) |
|
164 | 164 | { |
165 | 165 | $content['newsettings'][$name] = $config[$name]; |
166 | 166 | } |
167 | 167 | |
168 | 168 | // make everything readonly and remove save/apply button, if user has not rights to store config |
169 | - if ($GLOBALS['egw']->acl->check('site_config_acce',2,'admin')) |
|
169 | + if ($GLOBALS['egw']->acl->check('site_config_acce', 2, 'admin')) |
|
170 | 170 | { |
171 | 171 | $readonlys[__ALL__] = true; |
172 | 172 | $readonlys['cancel'] = false; |
@@ -146,7 +146,10 @@ |
||
146 | 146 | $ret = Api\Hooks::single($config, $appname); |
147 | 147 | if (is_array($ret)) |
148 | 148 | { |
149 | - if (isset($ret['sel_options'])) $sel_options = $ret['sel_options']; |
|
149 | + if (isset($ret['sel_options'])) |
|
150 | + { |
|
151 | + $sel_options = $ret['sel_options']; |
|
152 | + } |
|
150 | 153 | $config = array_merge($config, $ret); |
151 | 154 | } |
152 | 155 |
@@ -18,11 +18,11 @@ |
||
18 | 18 | parent::__construct(); |
19 | 19 | |
20 | 20 | // Field mapping |
21 | - $this->export_fields = array( |
|
21 | + $this->export_fields = array( |
|
22 | 22 | 'account_id' => lang('Account ID'), |
23 | 23 | 'account_lid' => lang('Group Name'), |
24 | 24 | 'account_members' => lang('Members'), |
25 | - ); |
|
25 | + ); |
|
26 | 26 | |
27 | 27 | // Custom fields - not really used in admin... |
28 | 28 | unset($this->export_fields['customfields']); |
@@ -47,7 +47,7 @@ |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | $custom = Api\Storage\Customfields::get('resources', true); |
50 | - foreach($custom as $name => $data) { |
|
50 | + foreach ($custom as $name => $data) { |
|
51 | 51 | $this->mapping_fields['#'.$name] = $data['label']; |
52 | 52 | } |
53 | 53 |
@@ -14,7 +14,8 @@ discard block |
||
14 | 14 | |
15 | 15 | class infolog_wizard_export_csv extends importexport_wizard_basic_export_csv |
16 | 16 | { |
17 | - public function __construct() { |
|
17 | + public function __construct() |
|
18 | + { |
|
18 | 19 | parent::__construct(); |
19 | 20 | |
20 | 21 | // Field mapping |
@@ -27,7 +28,8 @@ discard block |
||
27 | 28 | // Custom fields |
28 | 29 | unset($this->export_fields['custom']); // Heading, not a real field |
29 | 30 | $custom = Api\Storage\Customfields::get('infolog', true); |
30 | - foreach($custom as $name => $data) { |
|
31 | + foreach($custom as $name => $data) |
|
32 | + { |
|
31 | 33 | $this->export_fields['#'.$name] = $data['label']; |
32 | 34 | } |
33 | 35 | } |