@@ -15,37 +15,37 @@ |
||
| 15 | 15 | $phpgw_baseline = array( |
| 16 | 16 | 'egw_admin_queue' => array( |
| 17 | 17 | 'fd' => array( |
| 18 | - 'cmd_id' => array('type' => 'auto','nullable' => False), |
|
| 19 | - 'cmd_uid' => array('type' => 'ascii','precision' => '64','nullable' => False), |
|
| 20 | - 'cmd_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False), |
|
| 21 | - 'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
| 22 | - 'cmd_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False), |
|
| 23 | - 'cmd_type' => array('type' => 'ascii','precision' => '32','nullable' => False,'default' => 'admin_cmd'), |
|
| 24 | - 'cmd_status' => array('type' => 'int','precision' => '1'), |
|
| 25 | - 'cmd_scheduled' => array('type' => 'int','meta' => 'timestamp','precision' => '8'), |
|
| 26 | - 'cmd_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8'), |
|
| 27 | - 'cmd_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'), |
|
| 28 | - 'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'), |
|
| 29 | - 'cmd_error' => array('type' => 'varchar','precision' => '255'), |
|
| 30 | - 'cmd_errno' => array('type' => 'int','precision' => '4'), |
|
| 31 | - 'cmd_requested' => array('type' => 'int','precision' => '4'), |
|
| 32 | - 'cmd_requested_email' => array('type' => 'varchar','precision' => '128'), |
|
| 33 | - 'cmd_comment' => array('type' => 'varchar','precision' => '255'), |
|
| 34 | - 'cmd_data' => array('type' => 'ascii','precision' => '16384'), |
|
| 35 | - 'remote_id' => array('type' => 'int','precision' => '4') |
|
| 18 | + 'cmd_id' => array('type' => 'auto', 'nullable' => False), |
|
| 19 | + 'cmd_uid' => array('type' => 'ascii', 'precision' => '64', 'nullable' => False), |
|
| 20 | + 'cmd_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False), |
|
| 21 | + 'cmd_creator_email' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
| 22 | + 'cmd_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False), |
|
| 23 | + 'cmd_type' => array('type' => 'ascii', 'precision' => '32', 'nullable' => False, 'default' => 'admin_cmd'), |
|
| 24 | + 'cmd_status' => array('type' => 'int', 'precision' => '1'), |
|
| 25 | + 'cmd_scheduled' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'), |
|
| 26 | + 'cmd_modified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'), |
|
| 27 | + 'cmd_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4'), |
|
| 28 | + 'cmd_modifier_email' => array('type' => 'varchar', 'precision' => '128'), |
|
| 29 | + 'cmd_error' => array('type' => 'varchar', 'precision' => '255'), |
|
| 30 | + 'cmd_errno' => array('type' => 'int', 'precision' => '4'), |
|
| 31 | + 'cmd_requested' => array('type' => 'int', 'precision' => '4'), |
|
| 32 | + 'cmd_requested_email' => array('type' => 'varchar', 'precision' => '128'), |
|
| 33 | + 'cmd_comment' => array('type' => 'varchar', 'precision' => '255'), |
|
| 34 | + 'cmd_data' => array('type' => 'ascii', 'precision' => '16384'), |
|
| 35 | + 'remote_id' => array('type' => 'int', 'precision' => '4') |
|
| 36 | 36 | ), |
| 37 | 37 | 'pk' => array('cmd_id'), |
| 38 | 38 | 'fk' => array(), |
| 39 | - 'ix' => array('cmd_status','cmd_scheduled'), |
|
| 39 | + 'ix' => array('cmd_status', 'cmd_scheduled'), |
|
| 40 | 40 | 'uc' => array('cmd_uid') |
| 41 | 41 | ), |
| 42 | 42 | 'egw_admin_remote' => array( |
| 43 | 43 | 'fd' => array( |
| 44 | - 'remote_id' => array('type' => 'auto','nullable' => False), |
|
| 45 | - 'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False), |
|
| 46 | - 'remote_hash' => array('type' => 'ascii','precision' => '32','nullable' => False), |
|
| 47 | - 'remote_url' => array('type' => 'ascii','precision' => '128','nullable' => False), |
|
| 48 | - 'remote_domain' => array('type' => 'ascii','precision' => '64','nullable' => False) |
|
| 44 | + 'remote_id' => array('type' => 'auto', 'nullable' => False), |
|
| 45 | + 'remote_name' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False), |
|
| 46 | + 'remote_hash' => array('type' => 'ascii', 'precision' => '32', 'nullable' => False), |
|
| 47 | + 'remote_url' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False), |
|
| 48 | + 'remote_domain' => array('type' => 'ascii', 'precision' => '64', 'nullable' => False) |
|
| 49 | 49 | ), |
| 50 | 50 | 'pk' => array('remote_id'), |
| 51 | 51 | 'fk' => array(), |
@@ -20,29 +20,29 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function admin_upgrade1_4() |
| 22 | 22 | { |
| 23 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_queue',array( |
|
| 23 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_queue', array( |
|
| 24 | 24 | 'fd' => array( |
| 25 | 25 | 'cmd_id' => array('type' => 'auto'), |
| 26 | - 'cmd_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
| 27 | - 'cmd_creator' => array('type' => 'int','precision' => '4','nullable' => False), |
|
| 28 | - 'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
| 29 | - 'cmd_created' => array('type' => 'int','precision' => '8','nullable' => False), |
|
| 30 | - 'cmd_type' => array('type' => 'varchar','precision' => '32','nullable' => False,'default' => 'admin_cmd'), |
|
| 31 | - 'cmd_status' => array('type' => 'int','precision' => '1'), |
|
| 32 | - 'cmd_scheduled' => array('type' => 'int','precision' => '8'), |
|
| 33 | - 'cmd_modified' => array('type' => 'int','precision' => '8'), |
|
| 34 | - 'cmd_modifier' => array('type' => 'int','precision' => '4'), |
|
| 35 | - 'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'), |
|
| 36 | - 'cmd_error' => array('type' => 'varchar','precision' => '255'), |
|
| 37 | - 'cmd_errno' => array('type' => 'int','precision' => '4'), |
|
| 38 | - 'cmd_requested' => array('type' => 'int','precision' => '4'), |
|
| 39 | - 'cmd_requested_email' => array('type' => 'varchar','precision' => '128'), |
|
| 40 | - 'cmd_comment' => array('type' => 'varchar','precision' => '255'), |
|
| 26 | + 'cmd_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
| 27 | + 'cmd_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
| 28 | + 'cmd_creator_email' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
| 29 | + 'cmd_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
| 30 | + 'cmd_type' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False, 'default' => 'admin_cmd'), |
|
| 31 | + 'cmd_status' => array('type' => 'int', 'precision' => '1'), |
|
| 32 | + 'cmd_scheduled' => array('type' => 'int', 'precision' => '8'), |
|
| 33 | + 'cmd_modified' => array('type' => 'int', 'precision' => '8'), |
|
| 34 | + 'cmd_modifier' => array('type' => 'int', 'precision' => '4'), |
|
| 35 | + 'cmd_modifier_email' => array('type' => 'varchar', 'precision' => '128'), |
|
| 36 | + 'cmd_error' => array('type' => 'varchar', 'precision' => '255'), |
|
| 37 | + 'cmd_errno' => array('type' => 'int', 'precision' => '4'), |
|
| 38 | + 'cmd_requested' => array('type' => 'int', 'precision' => '4'), |
|
| 39 | + 'cmd_requested_email' => array('type' => 'varchar', 'precision' => '128'), |
|
| 40 | + 'cmd_comment' => array('type' => 'varchar', 'precision' => '255'), |
|
| 41 | 41 | 'cmd_data' => array('type' => 'blob') |
| 42 | 42 | ), |
| 43 | 43 | 'pk' => array('cmd_id'), |
| 44 | 44 | 'fk' => array(), |
| 45 | - 'ix' => array('cmd_status','cmd_scheduled'), |
|
| 45 | + 'ix' => array('cmd_status', 'cmd_scheduled'), |
|
| 46 | 46 | 'uc' => array('cmd_uid') |
| 47 | 47 | )); |
| 48 | 48 | return $GLOBALS['setup_info']['admin']['currentver'] = '1.5.001'; |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | function admin_upgrade1_5_001() |
| 53 | 53 | { |
| 54 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_remote',array( |
|
| 54 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_remote', array( |
|
| 55 | 55 | 'fd' => array( |
| 56 | 56 | 'remote_id' => array('type' => 'auto'), |
| 57 | - 'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False), |
|
| 58 | - 'remote_hash' => array('type' => 'varchar','precision' => '32','nullable' => False), |
|
| 59 | - 'remote_url' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
| 60 | - 'remote_domain' => array('type' => 'varchar','precision' => '64','nullable' => False) |
|
| 57 | + 'remote_name' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False), |
|
| 58 | + 'remote_hash' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False), |
|
| 59 | + 'remote_url' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
| 60 | + 'remote_domain' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False) |
|
| 61 | 61 | ), |
| 62 | 62 | 'pk' => array('remote_id'), |
| 63 | 63 | 'fk' => array(), |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | function admin_upgrade1_5_002() |
| 73 | 73 | { |
| 74 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_admin_queue','remote_id',array( |
|
| 74 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_admin_queue', 'remote_id', array( |
|
| 75 | 75 | 'type' => 'int', |
| 76 | 76 | 'precision' => '4' |
| 77 | 77 | )); |
@@ -110,18 +110,18 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | function admin_upgrade14_1() |
| 112 | 112 | { |
| 113 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_uid',array( |
|
| 113 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_uid', array( |
|
| 114 | 114 | 'type' => 'ascii', |
| 115 | 115 | 'precision' => '64', |
| 116 | 116 | 'nullable' => False |
| 117 | 117 | )); |
| 118 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_type',array( |
|
| 118 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_type', array( |
|
| 119 | 119 | 'type' => 'ascii', |
| 120 | 120 | 'precision' => '32', |
| 121 | 121 | 'nullable' => False, |
| 122 | 122 | 'default' => 'admin_cmd' |
| 123 | 123 | )); |
| 124 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_data',array( |
|
| 124 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_data', array( |
|
| 125 | 125 | 'type' => 'ascii', |
| 126 | 126 | 'precision' => '16384' |
| 127 | 127 | )); |
@@ -132,17 +132,17 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | function admin_upgrade14_2_001() |
| 134 | 134 | { |
| 135 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_hash',array( |
|
| 135 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_hash', array( |
|
| 136 | 136 | 'type' => 'ascii', |
| 137 | 137 | 'precision' => '32', |
| 138 | 138 | 'nullable' => False |
| 139 | 139 | )); |
| 140 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_url',array( |
|
| 140 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_url', array( |
|
| 141 | 141 | 'type' => 'ascii', |
| 142 | 142 | 'precision' => '128', |
| 143 | 143 | 'nullable' => False |
| 144 | 144 | )); |
| 145 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_domain',array( |
|
| 145 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_domain', array( |
|
| 146 | 146 | 'type' => 'ascii', |
| 147 | 147 | 'precision' => '64', |
| 148 | 148 | 'nullable' => False |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | // asuming everythings not MySQL uses PostgreSQL regular expression syntax |
| 162 | 162 | $regexp = substr($GLOBALS['egw_setup']->db->Type, 0, 5) == 'mysql' ? 'REGEXP' : '~*'; |
| 163 | 163 | |
| 164 | - foreach($GLOBALS['egw_setup']->db->select('egw_admin_queue', 'cmd_id,cmd_data', |
|
| 164 | + foreach ($GLOBALS['egw_setup']->db->select('egw_admin_queue', 'cmd_id,cmd_data', |
|
| 165 | 165 | 'cmd_status NOT IN ('.implode(',', admin_cmd::$require_pw_stati).") AND cmd_data $regexp '(pw|passwd\\_?\\d*|password|db\\_pass)\\?\"'", |
| 166 | 166 | __LINE__, __FILE__, false, '', 'admin') as $row) |
| 167 | 167 | { |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string|int|array $account account name or id, or array with all parameters |
| 24 | 24 | * @param string $password =null password |
| 25 | 25 | */ |
| 26 | - function __construct($account,$password=null) |
|
| 26 | + function __construct($account, $password = null) |
|
| 27 | 27 | { |
| 28 | 28 | if (!is_array($account)) |
| 29 | 29 | { |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
| 45 | 45 | * @throws Api\Exception\WrongUserinput(lang('Error changing the password for %1 !!!',$this->account),99); |
| 46 | 46 | */ |
| 47 | - protected function exec($check_only=false) |
|
| 47 | + protected function exec($check_only = false) |
|
| 48 | 48 | { |
| 49 | - $account_id = admin_cmd::parse_account($this->account,true); // true = user, no group |
|
| 49 | + $account_id = admin_cmd::parse_account($this->account, true); // true = user, no group |
|
| 50 | 50 | // check creator is still admin and not explicitly forbidden to edit Api\Accounts |
| 51 | - if ($this->creator) $this->_check_admin('account_access',16); |
|
| 51 | + if ($this->creator) $this->_check_admin('account_access', 16); |
|
| 52 | 52 | |
| 53 | 53 | if ($check_only) return true; |
| 54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (!$auth->change_password(null, $this->password, $account_id)) |
| 58 | 58 | { |
| 59 | 59 | // as long as the Api\Auth class is not throwing itself ... |
| 60 | - throw new Exception(lang('Error changing the password for %1 !!!',$this->account),99); |
|
| 60 | + throw new Exception(lang('Error changing the password for %1 !!!', $this->account), 99); |
|
| 61 | 61 | } |
| 62 | 62 | return lang('Password updated'); |
| 63 | 63 | } |
@@ -69,6 +69,6 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function __tostring() |
| 71 | 71 | { |
| 72 | - return lang('change password for %1',admin_cmd::display_account($this->account)); |
|
| 72 | + return lang('change password for %1', admin_cmd::display_account($this->account)); |
|
| 73 | 73 | } |
| 74 | 74 | } |
@@ -48,9 +48,15 @@ |
||
| 48 | 48 | { |
| 49 | 49 | $account_id = admin_cmd::parse_account($this->account,true); // true = user, no group |
| 50 | 50 | // check creator is still admin and not explicitly forbidden to edit Api\Accounts |
| 51 | - if ($this->creator) $this->_check_admin('account_access',16); |
|
| 51 | + if ($this->creator) |
|
| 52 | + { |
|
| 53 | + $this->_check_admin('account_access',16); |
|
| 54 | + } |
|
| 52 | 55 | |
| 53 | - if ($check_only) return true; |
|
| 56 | + if ($check_only) |
|
| 57 | + { |
|
| 58 | + return true; |
|
| 59 | + } |
|
| 54 | 60 | |
| 55 | 61 | $auth = new Api\Auth; |
| 56 | 62 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * Constructor |
| 20 | 20 | * |
| 21 | 21 | * @param string/int/array $account account name or id, or array with all parameters |
| 22 | - * @param string $password=null password |
|
| 22 | + * @param string $password password |
|
| 23 | 23 | */ |
| 24 | 24 | function __construct($account,$password=null) |
| 25 | 25 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | /** |
| 37 | 37 | * change the password of a given user |
| 38 | 38 | * |
| 39 | - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself |
|
| 39 | + * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself |
|
| 40 | 40 | * @return string success message |
| 41 | 41 | * @throws egw_exception_no_admin |
| 42 | 42 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15); |
@@ -275,37 +275,37 @@ |
||
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | - * Returns warnings that were encountered during importing |
|
| 279 | - * Maximum of one warning message per record, but you can concatenate them if you need to |
|
| 280 | - * |
|
| 281 | - * @return Array ( |
|
| 282 | - * record_# => warning message |
|
| 283 | - * ) |
|
| 284 | - */ |
|
| 278 | + * Returns warnings that were encountered during importing |
|
| 279 | + * Maximum of one warning message per record, but you can concatenate them if you need to |
|
| 280 | + * |
|
| 281 | + * @return Array ( |
|
| 282 | + * record_# => warning message |
|
| 283 | + * ) |
|
| 284 | + */ |
|
| 285 | 285 | public function get_warnings() { |
| 286 | 286 | return $this->warnings; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
| 290 | - * Returns errors that were encountered during importing |
|
| 291 | - * Maximum of one error message per record, but you can append if you need to |
|
| 292 | - * |
|
| 293 | - * @return Array ( |
|
| 294 | - * record_# => error message |
|
| 295 | - * ) |
|
| 296 | - */ |
|
| 290 | + * Returns errors that were encountered during importing |
|
| 291 | + * Maximum of one error message per record, but you can append if you need to |
|
| 292 | + * |
|
| 293 | + * @return Array ( |
|
| 294 | + * record_# => error message |
|
| 295 | + * ) |
|
| 296 | + */ |
|
| 297 | 297 | public function get_errors() { |
| 298 | 298 | return $this->errors; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
| 302 | - * Returns a list of actions taken, and the number of records for that action. |
|
| 303 | - * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
| 304 | - * |
|
| 305 | - * @return Array ( |
|
| 306 | - * action => record count |
|
| 307 | - * ) |
|
| 308 | - */ |
|
| 302 | + * Returns a list of actions taken, and the number of records for that action. |
|
| 303 | + * Actions are things like 'insert', 'update', 'delete', and may be different for each plugin. |
|
| 304 | + * |
|
| 305 | + * @return Array ( |
|
| 306 | + * action => record count |
|
| 307 | + * ) |
|
| 308 | + */ |
|
| 309 | 309 | public function get_results() { |
| 310 | 310 | return $this->results; |
| 311 | 311 | } |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * class import_csv for admin (users) |
| 17 | 17 | */ |
| 18 | -class admin_import_users_csv implements importexport_iface_import_plugin { |
|
| 18 | +class admin_import_users_csv implements importexport_iface_import_plugin { |
|
| 19 | 19 | |
| 20 | 20 | private static $plugin_options = array( |
| 21 | - 'fieldsep', // char |
|
| 22 | - 'charset', // string |
|
| 21 | + 'fieldsep', // char |
|
| 22 | + 'charset', // string |
|
| 23 | 23 | 'num_header_lines', // int number of header lines |
| 24 | 24 | 'field_conversion', // array( $csv_col_num => conversion) |
| 25 | - 'field_mapping', // array( $csv_col_num => adb_filed) |
|
| 26 | - 'conditions', /* => array containing condition arrays: |
|
| 25 | + 'field_mapping', // array( $csv_col_num => adb_filed) |
|
| 26 | + 'conditions', /* => array containing condition arrays: |
|
| 27 | 27 | 'type' => exists, // exists |
| 28 | 28 | 'string' => '#kundennummer', |
| 29 | 29 | 'true' => array( |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * actions which could be done to data entries |
| 42 | 42 | */ |
| 43 | - protected static $actions = array( 'none', 'update', 'create', 'delete', 'disable', 'enable' ); |
|
| 43 | + protected static $actions = array('none', 'update', 'create', 'delete', 'disable', 'enable'); |
|
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * conditions for actions |
| 47 | 47 | * |
| 48 | 48 | * @var array |
| 49 | 49 | */ |
| 50 | - protected static $conditions = array( 'exists' ); |
|
| 50 | + protected static $conditions = array('exists'); |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * @var definition |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | * @param string $_charset |
| 91 | 91 | * @param definition $_definition |
| 92 | 92 | */ |
| 93 | - public function import( $_stream, importexport_definition $_definition ) { |
|
| 94 | - $import_csv = new importexport_import_csv( $_stream, array( |
|
| 93 | + public function import($_stream, importexport_definition $_definition) { |
|
| 94 | + $import_csv = new importexport_import_csv($_stream, array( |
|
| 95 | 95 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
| 96 | 96 | 'charset' => $_definition->plugin_options['charset'], |
| 97 | 97 | )); |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | $this->definition = $_definition; |
| 100 | 100 | |
| 101 | 101 | // user, is admin ? |
| 102 | - $this->is_admin = isset( $GLOBALS['egw_info']['user']['apps']['admin'] ) && $GLOBALS['egw_info']['user']['apps']['admin']; |
|
| 102 | + $this->is_admin = isset($GLOBALS['egw_info']['user']['apps']['admin']) && $GLOBALS['egw_info']['user']['apps']['admin']; |
|
| 103 | 103 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 104 | 104 | |
| 105 | 105 | // dry run? |
| 106 | - $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; |
|
| 106 | + $this->dry_run = isset($_definition->plugin_options['dry_run']) ? $_definition->plugin_options['dry_run'] : false; |
|
| 107 | 107 | |
| 108 | 108 | // set FieldMapping. |
| 109 | 109 | $import_csv->mapping = $_definition->plugin_options['field_mapping']; |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | $import_csv->conversion = $_definition->plugin_options['field_conversion']; |
| 113 | 113 | |
| 114 | 114 | //check if file has a header lines |
| 115 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
| 115 | + if (isset($_definition->plugin_options['num_header_lines']) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
| 116 | 116 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
| 117 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
| 117 | + } elseif (isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
| 118 | 118 | // First method is preferred |
| 119 | 119 | $import_csv->skip_records(1); |
| 120 | 120 | } |
@@ -130,22 +130,22 @@ discard block |
||
| 130 | 130 | 'account_status' => array('A' => lang('Active'), '' => lang('Disabled'), 'D' => lang('Disabled')), |
| 131 | 131 | ); |
| 132 | 132 | |
| 133 | - while ( $record = $import_csv->get_record() ) { |
|
| 133 | + while ($record = $import_csv->get_record()) { |
|
| 134 | 134 | $success = false; |
| 135 | 135 | // don't import empty records |
| 136 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
| 136 | + if (count(array_unique($record)) < 2) continue; |
|
| 137 | 137 | |
| 138 | - if(strtolower($record['account_expires']) == 'never') $record['account_expires'] = -1; |
|
| 138 | + if (strtolower($record['account_expires']) == 'never') $record['account_expires'] = -1; |
|
| 139 | 139 | importexport_import_csv::convert($record, admin_egw_user_record::$types, 'admin', $lookups); |
| 140 | 140 | |
| 141 | - if ( $_definition->plugin_options['conditions'] ) { |
|
| 142 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
| 143 | - switch ( $condition['type'] ) { |
|
| 141 | + if ($_definition->plugin_options['conditions']) { |
|
| 142 | + foreach ($_definition->plugin_options['conditions'] as $condition) { |
|
| 143 | + switch ($condition['type']) { |
|
| 144 | 144 | // exists |
| 145 | 145 | case 'exists' : |
| 146 | 146 | $accounts = array(); |
| 147 | 147 | // Skip the search if the field is empty |
| 148 | - if($record[$condition['string']] !== '') |
|
| 148 | + if ($record[$condition['string']] !== '') |
|
| 149 | 149 | { |
| 150 | 150 | $accounts = $GLOBALS['egw']->accounts->search(array( |
| 151 | 151 | 'type' => 'accounts', |
@@ -154,20 +154,20 @@ discard block |
||
| 154 | 154 | )); |
| 155 | 155 | } |
| 156 | 156 | // Search looks in the given field, but doesn't do an exact match |
| 157 | - foreach ( (array)$accounts as $key => $account ) |
|
| 157 | + foreach ((array)$accounts as $key => $account) |
|
| 158 | 158 | { |
| 159 | - if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
| 159 | + if ($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
| 160 | 160 | } |
| 161 | - if ( is_array( $accounts ) && count( $accounts ) >= 1 ) { |
|
| 161 | + if (is_array($accounts) && count($accounts) >= 1) { |
|
| 162 | 162 | // apply action to all contacts matching this exists condition |
| 163 | 163 | $action = $condition['true']; |
| 164 | - foreach ( (array)$accounts as $account ) { |
|
| 164 | + foreach ((array)$accounts as $account) { |
|
| 165 | 165 | $record['account_id'] = $account['account_id']; |
| 166 | - $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
|
| 166 | + $success = $this->action($action['action'], $record, $import_csv->get_current_position()); |
|
| 167 | 167 | } |
| 168 | 168 | } else { |
| 169 | 169 | $action = $condition['false']; |
| 170 | - $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
|
| 170 | + $success = ($this->action($action['action'], $record, $import_csv->get_current_position())); |
|
| 171 | 171 | } |
| 172 | 172 | break; |
| 173 | 173 | |
@@ -180,9 +180,9 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | } else { |
| 182 | 182 | // unconditional insert |
| 183 | - $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
|
| 183 | + $success = $this->action('insert', $record, $import_csv->get_current_position()); |
|
| 184 | 184 | } |
| 185 | - if($success) $count++; |
|
| 185 | + if ($success) $count++; |
|
| 186 | 186 | } |
| 187 | 187 | return $count; |
| 188 | 188 | } |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | * @param array $_data contact data for the action |
| 195 | 195 | * @return bool success or not |
| 196 | 196 | */ |
| 197 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
| 197 | + private function action($_action, $_data, $record_num = 0) { |
|
| 198 | 198 | switch ($_action) { |
| 199 | 199 | case 'none' : |
| 200 | 200 | return true; |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | $_data['account_expires'] = $_action == 'disable' ? 'already' : ''; |
| 204 | 204 | case 'create' : |
| 205 | 205 | case 'update' : |
| 206 | - $command = new admin_cmd_edit_user(($_action=='create'?null:$_data['account_lid']), $_data); |
|
| 207 | - if($this->dry_run) { |
|
| 206 | + $command = new admin_cmd_edit_user(($_action == 'create' ? null : $_data['account_lid']), $_data); |
|
| 207 | + if ($this->dry_run) { |
|
| 208 | 208 | $this->results[$_action]++; |
| 209 | 209 | return true; |
| 210 | 210 | } |
@@ -104,8 +104,7 @@ |
||
| 104 | 104 | /** |
| 105 | 105 | * imports entries according to given definition object. |
| 106 | 106 | * @param resource $_stream |
| 107 | - * @param string $_charset |
|
| 108 | - * @param definition $_definition |
|
| 107 | + * @param importexport_definition $_definition |
|
| 109 | 108 | */ |
| 110 | 109 | public function import( $_stream, importexport_definition $_definition ) { |
| 111 | 110 | $import_csv = new importexport_import_csv( $_stream, array( |
@@ -15,7 +15,8 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * class import_csv for admin (users) |
| 17 | 17 | */ |
| 18 | -class admin_import_users_csv implements importexport_iface_import_plugin { |
|
| 18 | +class admin_import_users_csv implements importexport_iface_import_plugin |
|
| 19 | +{ |
|
| 19 | 20 | |
| 20 | 21 | private static $plugin_options = array( |
| 21 | 22 | 'fieldsep', // char |
@@ -90,7 +91,8 @@ discard block |
||
| 90 | 91 | * @param string $_charset |
| 91 | 92 | * @param definition $_definition |
| 92 | 93 | */ |
| 93 | - public function import( $_stream, importexport_definition $_definition ) { |
|
| 94 | + public function import( $_stream, importexport_definition $_definition ) |
|
| 95 | + { |
|
| 94 | 96 | $import_csv = new importexport_import_csv( $_stream, array( |
| 95 | 97 | 'fieldsep' => $_definition->plugin_options['fieldsep'], |
| 96 | 98 | 'charset' => $_definition->plugin_options['charset'], |
@@ -112,9 +114,12 @@ discard block |
||
| 112 | 114 | $import_csv->conversion = $_definition->plugin_options['field_conversion']; |
| 113 | 115 | |
| 114 | 116 | //check if file has a header lines |
| 115 | - if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) { |
|
| 117 | + if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) |
|
| 118 | + { |
|
| 116 | 119 | $import_csv->skip_records($_definition->plugin_options['num_header_lines']); |
| 117 | - } elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) { |
|
| 120 | + } |
|
| 121 | + elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) |
|
| 122 | + { |
|
| 118 | 123 | // First method is preferred |
| 119 | 124 | $import_csv->skip_records(1); |
| 120 | 125 | } |
@@ -130,17 +135,27 @@ discard block |
||
| 130 | 135 | 'account_status' => array('A' => lang('Active'), '' => lang('Disabled'), 'D' => lang('Disabled')), |
| 131 | 136 | ); |
| 132 | 137 | |
| 133 | - while ( $record = $import_csv->get_record() ) { |
|
| 138 | + while ( $record = $import_csv->get_record() ) |
|
| 139 | + { |
|
| 134 | 140 | $success = false; |
| 135 | 141 | // don't import empty records |
| 136 | - if( count( array_unique( $record ) ) < 2 ) continue; |
|
| 142 | + if( count( array_unique( $record ) ) < 2 ) |
|
| 143 | + { |
|
| 144 | + continue; |
|
| 145 | + } |
|
| 137 | 146 | |
| 138 | - if(strtolower($record['account_expires']) == 'never') $record['account_expires'] = -1; |
|
| 147 | + if(strtolower($record['account_expires']) == 'never') |
|
| 148 | + { |
|
| 149 | + $record['account_expires'] = -1; |
|
| 150 | + } |
|
| 139 | 151 | importexport_import_csv::convert($record, admin_egw_user_record::$types, 'admin', $lookups); |
| 140 | 152 | |
| 141 | - if ( $_definition->plugin_options['conditions'] ) { |
|
| 142 | - foreach ( $_definition->plugin_options['conditions'] as $condition ) { |
|
| 143 | - switch ( $condition['type'] ) { |
|
| 153 | + if ( $_definition->plugin_options['conditions'] ) |
|
| 154 | + { |
|
| 155 | + foreach ( $_definition->plugin_options['conditions'] as $condition ) |
|
| 156 | + { |
|
| 157 | + switch ( $condition['type'] ) |
|
| 158 | + { |
|
| 144 | 159 | // exists |
| 145 | 160 | case 'exists' : |
| 146 | 161 | $accounts = array(); |
@@ -156,16 +171,23 @@ discard block |
||
| 156 | 171 | // Search looks in the given field, but doesn't do an exact match |
| 157 | 172 | foreach ( (array)$accounts as $key => $account ) |
| 158 | 173 | { |
| 159 | - if($account[$condition['string']] != $record[$condition['string']]) unset($accounts[$key]); |
|
| 174 | + if($account[$condition['string']] != $record[$condition['string']]) |
|
| 175 | + { |
|
| 176 | + unset($accounts[$key]); |
|
| 177 | + } |
|
| 160 | 178 | } |
| 161 | - if ( is_array( $accounts ) && count( $accounts ) >= 1 ) { |
|
| 179 | + if ( is_array( $accounts ) && count( $accounts ) >= 1 ) |
|
| 180 | + { |
|
| 162 | 181 | // apply action to all contacts matching this exists condition |
| 163 | 182 | $action = $condition['true']; |
| 164 | - foreach ( (array)$accounts as $account ) { |
|
| 183 | + foreach ( (array)$accounts as $account ) |
|
| 184 | + { |
|
| 165 | 185 | $record['account_id'] = $account['account_id']; |
| 166 | 186 | $success = $this->action( $action['action'], $record, $import_csv->get_current_position() ); |
| 167 | 187 | } |
| 168 | - } else { |
|
| 188 | + } |
|
| 189 | + else |
|
| 190 | + { |
|
| 169 | 191 | $action = $condition['false']; |
| 170 | 192 | $success = ($this->action( $action['action'], $record, $import_csv->get_current_position() )); |
| 171 | 193 | } |
@@ -176,13 +198,21 @@ discard block |
||
| 176 | 198 | die('condition / action not supported!!!'); |
| 177 | 199 | break; |
| 178 | 200 | } |
| 179 | - if ($action['last']) break; |
|
| 201 | + if ($action['last']) |
|
| 202 | + { |
|
| 203 | + break; |
|
| 204 | + } |
|
| 180 | 205 | } |
| 181 | - } else { |
|
| 206 | + } |
|
| 207 | + else |
|
| 208 | + { |
|
| 182 | 209 | // unconditional insert |
| 183 | 210 | $success = $this->action( 'insert', $record, $import_csv->get_current_position() ); |
| 184 | 211 | } |
| 185 | - if($success) $count++; |
|
| 212 | + if($success) |
|
| 213 | + { |
|
| 214 | + $count++; |
|
| 215 | + } |
|
| 186 | 216 | } |
| 187 | 217 | return $count; |
| 188 | 218 | } |
@@ -194,8 +224,10 @@ discard block |
||
| 194 | 224 | * @param array $_data contact data for the action |
| 195 | 225 | * @return bool success or not |
| 196 | 226 | */ |
| 197 | - private function action ( $_action, $_data, $record_num = 0 ) { |
|
| 198 | - switch ($_action) { |
|
| 227 | + private function action ( $_action, $_data, $record_num = 0 ) |
|
| 228 | + { |
|
| 229 | + switch ($_action) |
|
| 230 | + { |
|
| 199 | 231 | case 'none' : |
| 200 | 232 | return true; |
| 201 | 233 | case 'disable': |
@@ -204,13 +236,15 @@ discard block |
||
| 204 | 236 | case 'create' : |
| 205 | 237 | case 'update' : |
| 206 | 238 | $command = new admin_cmd_edit_user(($_action=='create'?null:$_data['account_lid']), $_data); |
| 207 | - if($this->dry_run) { |
|
| 239 | + if($this->dry_run) |
|
| 240 | + { |
|
| 208 | 241 | $this->results[$_action]++; |
| 209 | 242 | return true; |
| 210 | 243 | } |
| 211 | 244 | try { |
| 212 | 245 | $command->run(); |
| 213 | - } catch (Exception $e) { |
|
| 246 | + } |
|
| 247 | + catch (Exception $e) { |
|
| 214 | 248 | $this->errors[$record_num] = $e->getMessage(); |
| 215 | 249 | return false; |
| 216 | 250 | } |
@@ -227,7 +261,8 @@ discard block |
||
| 227 | 261 | * |
| 228 | 262 | * @return string name |
| 229 | 263 | */ |
| 230 | - public static function get_name() { |
|
| 264 | + public static function get_name() |
|
| 265 | + { |
|
| 231 | 266 | return lang('User CSV import'); |
| 232 | 267 | } |
| 233 | 268 | |
@@ -236,7 +271,8 @@ discard block |
||
| 236 | 271 | * |
| 237 | 272 | * @return string descriprion |
| 238 | 273 | */ |
| 239 | - public static function get_description() { |
|
| 274 | + public static function get_description() |
|
| 275 | + { |
|
| 240 | 276 | return lang("Creates / updates user accounts from CSV file"); |
| 241 | 277 | } |
| 242 | 278 | |
@@ -245,7 +281,8 @@ discard block |
||
| 245 | 281 | * |
| 246 | 282 | * @return string suffix (comma seperated) |
| 247 | 283 | */ |
| 248 | - public static function get_filesuffix() { |
|
| 284 | + public static function get_filesuffix() |
|
| 285 | + { |
|
| 249 | 286 | return 'csv'; |
| 250 | 287 | } |
| 251 | 288 | |
@@ -261,7 +298,8 @@ discard block |
||
| 261 | 298 | * preserv => array, |
| 262 | 299 | * ) |
| 263 | 300 | */ |
| 264 | - public function get_options_etpl() { |
|
| 301 | + public function get_options_etpl() |
|
| 302 | + { |
|
| 265 | 303 | // lets do it! |
| 266 | 304 | } |
| 267 | 305 | |
@@ -270,7 +308,8 @@ discard block |
||
| 270 | 308 | * |
| 271 | 309 | * @return string etemplate name |
| 272 | 310 | */ |
| 273 | - public function get_selectors_etpl() { |
|
| 311 | + public function get_selectors_etpl() |
|
| 312 | + { |
|
| 274 | 313 | // lets do it! |
| 275 | 314 | } |
| 276 | 315 | |
@@ -282,7 +321,8 @@ discard block |
||
| 282 | 321 | * record_# => warning message |
| 283 | 322 | * ) |
| 284 | 323 | */ |
| 285 | - public function get_warnings() { |
|
| 324 | + public function get_warnings() |
|
| 325 | + { |
|
| 286 | 326 | return $this->warnings; |
| 287 | 327 | } |
| 288 | 328 | |
@@ -294,7 +334,8 @@ discard block |
||
| 294 | 334 | * record_# => error message |
| 295 | 335 | * ) |
| 296 | 336 | */ |
| 297 | - public function get_errors() { |
|
| 337 | + public function get_errors() |
|
| 338 | + { |
|
| 298 | 339 | return $this->errors; |
| 299 | 340 | } |
| 300 | 341 | |
@@ -306,7 +347,8 @@ discard block |
||
| 306 | 347 | * action => record count |
| 307 | 348 | * ) |
| 308 | 349 | */ |
| 309 | - public function get_results() { |
|
| 350 | + public function get_results() |
|
| 351 | + { |
|
| 310 | 352 | return $this->results; |
| 311 | 353 | } |
| 312 | 354 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * @param string|int $account =null account name or id |
| 25 | 25 | * @param array|string $apps =null app-names |
| 26 | 26 | */ |
| 27 | - function __construct($allow,$account=null,$apps=null) |
|
| 27 | + function __construct($allow, $account = null, $apps = null) |
|
| 28 | 28 | { |
| 29 | 29 | if (!is_array($allow)) |
| 30 | 30 | { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | } |
| 37 | 37 | if (isset($allow['apps']) && !is_array($allow['apps'])) |
| 38 | 38 | { |
| 39 | - $allow['apps'] = explode(',',$allow['apps']); |
|
| 39 | + $allow['apps'] = explode(',', $allow['apps']); |
|
| 40 | 40 | } |
| 41 | 41 | admin_cmd::__construct($allow); |
| 42 | 42 | } |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
| 51 | 51 | * @throws Api\Exception\WrongUserinput(lang("Application '%1' not found (maybe not installed or misspelled)!",$name),8); |
| 52 | 52 | */ |
| 53 | - protected function exec($check_only=false) |
|
| 53 | + protected function exec($check_only = false) |
|
| 54 | 54 | { |
| 55 | 55 | $account_id = admin_cmd::parse_account($this->account); |
| 56 | 56 | // check creator is still admin and not explicitly forbidden to edit accounts/groups |
| 57 | - if ($this->creator) $this->_check_admin($account_id > 0 ? 'account_access' : 'group_access',16); |
|
| 57 | + if ($this->creator) $this->_check_admin($account_id > 0 ? 'account_access' : 'group_access', 16); |
|
| 58 | 58 | |
| 59 | 59 | $apps = admin_cmd::parse_apps($this->apps); |
| 60 | 60 | |
@@ -62,15 +62,15 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | //echo "account=$this->account, account_id=$account_id, apps: ".implode(', ',$apps)."\n"; |
| 64 | 64 | admin_cmd::_instanciate_acl($account_id); |
| 65 | - foreach($apps as $app) |
|
| 65 | + foreach ($apps as $app) |
|
| 66 | 66 | { |
| 67 | 67 | if ($this->allow) |
| 68 | 68 | { |
| 69 | - admin_cmd::$acl->add_repository($app,'run',$account_id,1); |
|
| 69 | + admin_cmd::$acl->add_repository($app, 'run', $account_id, 1); |
|
| 70 | 70 | } |
| 71 | 71 | else |
| 72 | 72 | { |
| 73 | - admin_cmd::$acl->delete_repository($app,'run',$account_id); |
|
| 73 | + admin_cmd::$acl->delete_repository($app, 'run', $account_id); |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | return lang('Applications run rights updated.'); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function __tostring() |
| 85 | 85 | { |
| 86 | - return lang('%1 rights for %2 and applications %3',$this->allow ? lang('Grant') : lang('Remove'), |
|
| 87 | - admin_cmd::display_account($this->account),implode(', ',$this->apps)); |
|
| 86 | + return lang('%1 rights for %2 and applications %3', $this->allow ? lang('Grant') : lang('Remove'), |
|
| 87 | + admin_cmd::display_account($this->account), implode(', ', $this->apps)); |
|
| 88 | 88 | } |
| 89 | 89 | } |
@@ -18,9 +18,8 @@ discard block |
||
| 18 | 18 | /** |
| 19 | 19 | * Constructor |
| 20 | 20 | * |
| 21 | - * @param boolean/array $allow true=give rights, false=remove rights, or array with all 3 params |
|
| 22 | - * @param string/int $account=null account name or id |
|
| 23 | - * @param array/string $apps=null app-names |
|
| 21 | + * @param boolean $allow true=give rights, false=remove rights, or array with all 3 params |
|
| 22 | + * @param string/int $account account name or id |
|
| 24 | 23 | */ |
| 25 | 24 | function __construct($allow,$account=null,$apps=null) |
| 26 | 25 | { |
@@ -42,7 +41,7 @@ discard block |
||
| 42 | 41 | /** |
| 43 | 42 | * give or remove run rights from a given account and application |
| 44 | 43 | * |
| 45 | - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself |
|
| 44 | + * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself |
|
| 46 | 45 | * @return string success message |
| 47 | 46 | * @throws egw_exception_no_admin |
| 48 | 47 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15); |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * admin command: give or remove run rights from a given account and application |
| 15 | 15 | */ |
| 16 | -class admin_cmd_account_app extends admin_cmd |
|
| 16 | +class admin_cmd_account_app extends admin_cmd |
|
| 17 | 17 | { |
| 18 | 18 | /** |
| 19 | 19 | * Constructor |
@@ -52,11 +52,17 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $account_id = admin_cmd::parse_account($this->account); |
| 54 | 54 | // check creator is still admin and not explicitly forbidden to edit accounts/groups |
| 55 | - if ($this->creator) $this->_check_admin($account_id > 0 ? 'account_access' : 'group_access',16); |
|
| 55 | + if ($this->creator) |
|
| 56 | + { |
|
| 57 | + $this->_check_admin($account_id > 0 ? 'account_access' : 'group_access',16); |
|
| 58 | + } |
|
| 56 | 59 | |
| 57 | 60 | $apps = admin_cmd::parse_apps($this->apps); |
| 58 | 61 | |
| 59 | - if ($check_only) return true; |
|
| 62 | + if ($check_only) |
|
| 63 | + { |
|
| 64 | + return true; |
|
| 65 | + } |
|
| 60 | 66 | |
| 61 | 67 | //echo "account=$this->account, account_id=$account_id, apps: ".implode(', ',$apps)."\n"; |
| 62 | 68 | admin_cmd::_instanciate_acl($account_id); |
@@ -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. |
@@ -14,14 +14,16 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Export users plugin |
| 16 | 16 | */ |
| 17 | -class admin_export_groups_csv implements importexport_iface_export_plugin { |
|
| 17 | +class admin_export_groups_csv implements importexport_iface_export_plugin |
|
| 18 | +{ |
|
| 18 | 19 | |
| 19 | 20 | /** |
| 20 | 21 | * Exports records as defined in $_definition |
| 21 | 22 | * |
| 22 | 23 | * @param egw_record $_definition |
| 23 | 24 | */ |
| 24 | - public function export( $_stream, importexport_definition $_definition) { |
|
| 25 | + public function export( $_stream, importexport_definition $_definition) |
|
| 26 | + { |
|
| 25 | 27 | $options = $_definition->plugin_options; |
| 26 | 28 | |
| 27 | 29 | $selection = array(); |
@@ -40,14 +42,22 @@ discard block |
||
| 40 | 42 | ); |
| 41 | 43 | |
| 42 | 44 | // $_record is an array, that's what search() returns |
| 43 | - foreach ($selection as $_record) { |
|
| 45 | + foreach ($selection as $_record) |
|
| 46 | + { |
|
| 44 | 47 | $record = new admin_egw_group_record($_record); |
| 45 | - if($options['convert']) { |
|
| 48 | + if($options['convert']) |
|
| 49 | + { |
|
| 46 | 50 | importexport_export_csv::convert($record, admin_egw_group_record::$types, 'admin', $lookups); |
| 47 | - } else { |
|
| 51 | + } |
|
| 52 | + else |
|
| 53 | + { |
|
| 48 | 54 | // Implode arrays, so they don't say 'Array' |
| 49 | - foreach($record->get_record_array() as $key => $value) { |
|
| 50 | - if(is_array($value)) $record->$key = implode(',', $value); |
|
| 55 | + foreach($record->get_record_array() as $key => $value) |
|
| 56 | + { |
|
| 57 | + if(is_array($value)) |
|
| 58 | + { |
|
| 59 | + $record->$key = implode(',', $value); |
|
| 60 | + } |
|
| 51 | 61 | } |
| 52 | 62 | } |
| 53 | 63 | $export_object->export_record($record); |
@@ -60,7 +70,8 @@ discard block |
||
| 60 | 70 | * |
| 61 | 71 | * @return string name |
| 62 | 72 | */ |
| 63 | - public static function get_name() { |
|
| 73 | + public static function get_name() |
|
| 74 | + { |
|
| 64 | 75 | return lang('Group CSV export'); |
| 65 | 76 | } |
| 66 | 77 | |
@@ -69,7 +80,8 @@ discard block |
||
| 69 | 80 | * |
| 70 | 81 | * @return string descriprion |
| 71 | 82 | */ |
| 72 | - public static function get_description() { |
|
| 83 | + public static function get_description() |
|
| 84 | + { |
|
| 73 | 85 | return lang("Exports groups into a CSV File. "); |
| 74 | 86 | } |
| 75 | 87 | |
@@ -78,11 +90,13 @@ discard block |
||
| 78 | 90 | * |
| 79 | 91 | * @return string suffix |
| 80 | 92 | */ |
| 81 | - public static function get_filesuffix() { |
|
| 93 | + public static function get_filesuffix() |
|
| 94 | + { |
|
| 82 | 95 | return 'csv'; |
| 83 | 96 | } |
| 84 | 97 | |
| 85 | - public static function get_mimetype() { |
|
| 98 | + public static function get_mimetype() |
|
| 99 | + { |
|
| 86 | 100 | return 'text/csv'; |
| 87 | 101 | } |
| 88 | 102 | |
@@ -92,7 +106,8 @@ discard block |
||
| 92 | 106 | * |
| 93 | 107 | * @return string html |
| 94 | 108 | */ |
| 95 | - public function get_options_etpl() { |
|
| 109 | + public function get_options_etpl() |
|
| 110 | + { |
|
| 96 | 111 | return false; |
| 97 | 112 | } |
| 98 | 113 | |
@@ -100,7 +115,8 @@ discard block |
||
| 100 | 115 | * returns slectors of this plugin via xajax |
| 101 | 116 | * |
| 102 | 117 | */ |
| 103 | - public function get_selectors_etpl() { |
|
| 118 | + public function get_selectors_etpl() |
|
| 119 | + { |
|
| 104 | 120 | return array( |
| 105 | 121 | 'preserv' => array('no_error_for_no_selection'), |
| 106 | 122 | ); |
@@ -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 | |
@@ -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 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | * |
| 25 | 25 | * @param array $data =array() default parm from parent class, no real parameters |
| 26 | 26 | */ |
| 27 | - function __construct($data=array()) |
|
| 27 | + function __construct($data = array()) |
|
| 28 | 28 | { |
| 29 | 29 | admin_cmd::__construct($data); |
| 30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * @param boolean $check_only =false only run the checks (and throw the exceptions), but not the command itself |
| 36 | 36 | * @return string success message |
| 37 | 37 | */ |
| 38 | - protected function exec($check_only=false) |
|
| 38 | + protected function exec($check_only = false) |
|
| 39 | 39 | { |
| 40 | 40 | if ($check_only) return true; |
| 41 | 41 | |
@@ -37,7 +37,10 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | protected function exec($check_only=false) |
| 39 | 39 | { |
| 40 | - if ($check_only) return true; |
|
| 40 | + if ($check_only) |
|
| 41 | + { |
|
| 42 | + return true; |
|
| 43 | + } |
|
| 41 | 44 | |
| 42 | 45 | admin_cmd::_instanciate_accounts(); |
| 43 | 46 | |
@@ -20,7 +20,6 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * Constructor |
| 22 | 22 | * |
| 23 | - * @param array $data=array() default parm from parent class, no real parameters |
|
| 24 | 23 | */ |
| 25 | 24 | function __construct($data=array()) |
| 26 | 25 | { |
@@ -30,7 +29,7 @@ discard block |
||
| 30 | 29 | /** |
| 31 | 30 | * give or remove run rights from a given account and application |
| 32 | 31 | * |
| 33 | - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself |
|
| 32 | + * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself |
|
| 34 | 33 | * @return string success message |
| 35 | 34 | */ |
| 36 | 35 | protected function exec($check_only=false) |