@@ -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 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /* |
| 16 | 16 | Set global flag to indicate for which config settings we have equally named validation methods |
| 17 | 17 | */ |
| 18 | -$GLOBALS['egw_info']['server']['found_validation_hook'] = array('vfs_image_dir','fw_mobile_app_list'); |
|
| 18 | +$GLOBALS['egw_info']['server']['found_validation_hook'] = array('vfs_image_dir', 'fw_mobile_app_list'); |
|
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | 21 | * Check VFS dir exists and delete image map to recreate it, if vfs-image-dir changes |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | if (!Vfs::file_exists($vfs_image_dir) || !Vfs::is_dir($vfs_image_dir)) |
| 31 | 31 | { |
| 32 | - $GLOBALS['config_error'] = lang('VFS directory "%1" NOT found!',$vfs_image_dir); |
|
| 32 | + $GLOBALS['config_error'] = lang('VFS directory "%1" NOT found!', $vfs_image_dir); |
|
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | if (($f = $this->db_backup->fopen_backup())) |
| 29 | 29 | { |
| 30 | 30 | $this->db_backup->backup($f); |
| 31 | - if(is_resource($f)) |
|
| 31 | + if (is_resource($f)) |
|
| 32 | 32 | fclose($f); |
| 33 | 33 | /* Remove old backups. */ |
| 34 | 34 | $this->db_backup->housekeeping(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | function index() |
| 42 | 42 | { |
| 43 | 43 | $tpl_root = EGW_SERVER_ROOT.'/setup/templates/default'; |
| 44 | - $self = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'admin.admin_db_backup.index')); |
|
| 44 | + $self = $GLOBALS['egw']->link('/index.php', array('menuaction'=>'admin.admin_db_backup.index')); |
|
| 45 | 45 | Api\Translation::add_app('setup'); |
| 46 | 46 | Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline'); |
| 47 | 47 | |
@@ -29,7 +29,9 @@ |
||
| 29 | 29 | { |
| 30 | 30 | $this->db_backup->backup($f); |
| 31 | 31 | if(is_resource($f)) |
| 32 | - fclose($f); |
|
| 32 | + { |
|
| 33 | + fclose($f); |
|
| 34 | + } |
|
| 33 | 35 | /* Remove old backups. */ |
| 34 | 36 | $this->db_backup->housekeeping(); |
| 35 | 37 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $_identifier |
| 37 | 37 | */ |
| 38 | - public function __construct( $_identifier='' ) { |
|
| 39 | - if(is_array($_identifier)) { |
|
| 38 | + public function __construct($_identifier = '') { |
|
| 39 | + if (is_array($_identifier)) { |
|
| 40 | 40 | $this->identifier = $_identifier['account_id']; |
| 41 | 41 | } else { |
| 42 | 42 | $this->identifier = $_identifier; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @todo add some checks |
| 91 | 91 | * @return void |
| 92 | 92 | */ |
| 93 | - public function set_record(array $_record){ |
|
| 93 | + public function set_record(array $_record) { |
|
| 94 | 94 | $this->user = $_record; |
| 95 | 95 | $this->account_groups = $GLOBALS['egw']->accounts->memberships($this->identifier, true); |
| 96 | 96 | } |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | * |
| 120 | 120 | * @return string identifier |
| 121 | 121 | */ |
| 122 | - public function save ( $_dst_identifier ) { |
|
| 123 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 122 | + public function save($_dst_identifier) { |
|
| 123 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | * @param string $_dst_identifier |
| 130 | 130 | * @return string dst_identifier |
| 131 | 131 | */ |
| 132 | - public function copy ( $_dst_identifier ) { |
|
| 133 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 132 | + public function copy($_dst_identifier) { |
|
| 133 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | * @param string $_dst_identifier |
| 141 | 141 | * @return string dst_identifier |
| 142 | 142 | */ |
| 143 | - public function move ( $_dst_identifier ) { |
|
| 144 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 143 | + public function move($_dst_identifier) { |
|
| 144 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
| 148 | 148 | * delets current record from backend |
| 149 | 149 | * |
| 150 | 150 | */ |
| 151 | - public function delete () { |
|
| 151 | + public function delete() { |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | |
@@ -35,10 +35,14 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string $_identifier |
| 37 | 37 | */ |
| 38 | - public function __construct( $_identifier='' ) { |
|
| 39 | - if(is_array($_identifier)) { |
|
| 38 | + public function __construct( $_identifier='' ) |
|
| 39 | + { |
|
| 40 | + if(is_array($_identifier)) |
|
| 41 | + { |
|
| 40 | 42 | $this->identifier = $_identifier['account_id']; |
| 41 | - } else { |
|
| 43 | + } |
|
| 44 | + else |
|
| 45 | + { |
|
| 42 | 46 | $this->identifier = $_identifier; |
| 43 | 47 | } |
| 44 | 48 | $this->set_record($GLOBALS['egw']->accounts->read($this->identifier)); |
@@ -49,7 +53,8 @@ discard block |
||
| 49 | 53 | * |
| 50 | 54 | * @param string $_attribute_name |
| 51 | 55 | */ |
| 52 | - public function __get($_attribute_name) { |
|
| 56 | + public function __get($_attribute_name) |
|
| 57 | + { |
|
| 53 | 58 | return $this->user[$_attribute_name]; |
| 54 | 59 | } |
| 55 | 60 | |
@@ -59,7 +64,8 @@ discard block |
||
| 59 | 64 | * @param string $_attribute_name |
| 60 | 65 | * @param data $data |
| 61 | 66 | */ |
| 62 | - public function __set($_attribute_name, $data) { |
|
| 67 | + public function __set($_attribute_name, $data) |
|
| 68 | + { |
|
| 63 | 69 | $this->user[$_attribute_name] = $data; |
| 64 | 70 | } |
| 65 | 71 | |
@@ -71,7 +77,8 @@ discard block |
||
| 71 | 77 | * |
| 72 | 78 | * @return array complete record as associative array |
| 73 | 79 | */ |
| 74 | - public function get_record_array() { |
|
| 80 | + public function get_record_array() |
|
| 81 | + { |
|
| 75 | 82 | return $this->user; |
| 76 | 83 | } |
| 77 | 84 | |
@@ -80,7 +87,8 @@ discard block |
||
| 80 | 87 | * |
| 81 | 88 | *@return string title |
| 82 | 89 | */ |
| 83 | - public function get_title() { |
|
| 90 | + public function get_title() |
|
| 91 | + { |
|
| 84 | 92 | return Api\Accounts::username($this->identifier); |
| 85 | 93 | } |
| 86 | 94 | |
@@ -90,7 +98,8 @@ discard block |
||
| 90 | 98 | * @todo add some checks |
| 91 | 99 | * @return void |
| 92 | 100 | */ |
| 93 | - public function set_record(array $_record){ |
|
| 101 | + public function set_record(array $_record) |
|
| 102 | + { |
|
| 94 | 103 | $this->user = $_record; |
| 95 | 104 | $this->account_groups = $GLOBALS['egw']->accounts->memberships($this->identifier, true); |
| 96 | 105 | } |
@@ -100,7 +109,8 @@ discard block |
||
| 100 | 109 | * |
| 101 | 110 | * @return string identifier of current record |
| 102 | 111 | */ |
| 103 | - public function get_identifier() { |
|
| 112 | + public function get_identifier() |
|
| 113 | + { |
|
| 104 | 114 | return $this->identifier; |
| 105 | 115 | } |
| 106 | 116 | |
@@ -110,7 +120,8 @@ discard block |
||
| 110 | 120 | * |
| 111 | 121 | * @return string Full URL of an icon, or appname/icon_name |
| 112 | 122 | */ |
| 113 | - public function get_icon() { |
|
| 123 | + public function get_icon() |
|
| 124 | + { |
|
| 114 | 125 | return 'user'; |
| 115 | 126 | } |
| 116 | 127 | |
@@ -119,7 +130,8 @@ discard block |
||
| 119 | 130 | * |
| 120 | 131 | * @return string identifier |
| 121 | 132 | */ |
| 122 | - public function save ( $_dst_identifier ) { |
|
| 133 | + public function save ( $_dst_identifier ) |
|
| 134 | + { |
|
| 123 | 135 | unset($_dst_identifier); // not used, but require by function signature |
| 124 | 136 | } |
| 125 | 137 | |
@@ -129,7 +141,8 @@ discard block |
||
| 129 | 141 | * @param string $_dst_identifier |
| 130 | 142 | * @return string dst_identifier |
| 131 | 143 | */ |
| 132 | - public function copy ( $_dst_identifier ) { |
|
| 144 | + public function copy ( $_dst_identifier ) |
|
| 145 | + { |
|
| 133 | 146 | unset($_dst_identifier); // not used, but require by function signature |
| 134 | 147 | } |
| 135 | 148 | |
@@ -140,7 +153,8 @@ discard block |
||
| 140 | 153 | * @param string $_dst_identifier |
| 141 | 154 | * @return string dst_identifier |
| 142 | 155 | */ |
| 143 | - public function move ( $_dst_identifier ) { |
|
| 156 | + public function move ( $_dst_identifier ) |
|
| 157 | + { |
|
| 144 | 158 | unset($_dst_identifier); // not used, but require by function signature |
| 145 | 159 | } |
| 146 | 160 | |
@@ -148,7 +162,8 @@ discard block |
||
| 148 | 162 | * delets current record from backend |
| 149 | 163 | * |
| 150 | 164 | */ |
| 151 | - public function delete () { |
|
| 165 | + public function delete () |
|
| 166 | + { |
|
| 152 | 167 | |
| 153 | 168 | } |
| 154 | 169 | |
@@ -156,7 +171,8 @@ discard block |
||
| 156 | 171 | * destructor |
| 157 | 172 | * |
| 158 | 173 | */ |
| 159 | - public function __destruct() { |
|
| 174 | + public function __destruct() |
|
| 175 | + { |
|
| 160 | 176 | unset ($this->user); |
| 161 | 177 | } |
| 162 | 178 | } |
@@ -18,20 +18,20 @@ |
||
| 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 | - 'account_lid' => lang('LoginID'), |
|
| 24 | - 'account_firstname' => lang('First Name'), |
|
| 25 | - 'account_lastname' => lang('Last Name'), |
|
| 26 | - 'account_email' => lang('email'), |
|
| 27 | - 'account_pwd' => lang('Password'), |
|
| 28 | - 'account_status' => lang('Status'), |
|
| 29 | - 'account_primary_group' => lang('Primary Group'), |
|
| 30 | - 'account_groups' => lang('Groups'), |
|
| 31 | - 'account_expires' => lang('Expires'), |
|
| 32 | - 'account_lastlogin' => lang('Last login'), |
|
| 33 | - 'account_lastpwd_change'=> lang('Last password change'), |
|
| 34 | - ); |
|
| 23 | + 'account_lid' => lang('LoginID'), |
|
| 24 | + 'account_firstname' => lang('First Name'), |
|
| 25 | + 'account_lastname' => lang('Last Name'), |
|
| 26 | + 'account_email' => lang('email'), |
|
| 27 | + 'account_pwd' => lang('Password'), |
|
| 28 | + 'account_status' => lang('Status'), |
|
| 29 | + 'account_primary_group' => lang('Primary Group'), |
|
| 30 | + 'account_groups' => lang('Groups'), |
|
| 31 | + 'account_expires' => lang('Expires'), |
|
| 32 | + 'account_lastlogin' => lang('Last login'), |
|
| 33 | + 'account_lastpwd_change'=> lang('Last password change'), |
|
| 34 | + ); |
|
| 35 | 35 | |
| 36 | 36 | // Custom fields - not really used in admin... |
| 37 | 37 | unset($this->export_fields['customfields']); |
@@ -14,7 +14,8 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | class admin_wizard_export_users_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 |
@@ -36,7 +37,8 @@ discard block |
||
| 36 | 37 | // Custom fields - not really used in admin... |
| 37 | 38 | unset($this->export_fields['customfields']); |
| 38 | 39 | $custom = Api\Storage\Customfields::get('admin', true); |
| 39 | - foreach($custom as $name => $data) { |
|
| 40 | + foreach($custom as $name => $data) |
|
| 41 | + { |
|
| 40 | 42 | $this->export_fields['#'.$name] = $data['label']; |
| 41 | 43 | } |
| 42 | 44 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | // Custom fields - not really used in admin... |
| 28 | 28 | unset($this->export_fields['customfields']); |
| 29 | 29 | $custom = Api\Storage\Customfields::get('admin', true); |
| 30 | - foreach($custom as $name => $data) { |
|
| 30 | + foreach ($custom as $name => $data) { |
|
| 31 | 31 | $this->export_fields['#'.$name] = $data['label']; |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param string $_identifier |
| 36 | 36 | */ |
| 37 | - public function __construct( $_identifier='' ) { |
|
| 38 | - if(is_array($_identifier)) { |
|
| 37 | + public function __construct($_identifier = '') { |
|
| 38 | + if (is_array($_identifier)) { |
|
| 39 | 39 | $this->identifier = $_identifier['account_id']; |
| 40 | 40 | } else { |
| 41 | 41 | $this->identifier = $_identifier; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | * @todo add some checks |
| 90 | 90 | * @return void |
| 91 | 91 | */ |
| 92 | - public function set_record(array $_record){ |
|
| 92 | + public function set_record(array $_record) { |
|
| 93 | 93 | $this->group = $_record; |
| 94 | - $this->group['account_members'] = $GLOBALS['egw']->accounts->members($this->group['account_id'],true); |
|
| 94 | + $this->group['account_members'] = $GLOBALS['egw']->accounts->members($this->group['account_id'], true); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @return string identifier |
| 120 | 120 | */ |
| 121 | - public function save ( $_dst_identifier ) { |
|
| 122 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 121 | + public function save($_dst_identifier) { |
|
| 122 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -128,8 +128,8 @@ discard block |
||
| 128 | 128 | * @param string $_dst_identifier |
| 129 | 129 | * @return string dst_identifier |
| 130 | 130 | */ |
| 131 | - public function copy ( $_dst_identifier ) { |
|
| 132 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 131 | + public function copy($_dst_identifier) { |
|
| 132 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
@@ -139,15 +139,15 @@ discard block |
||
| 139 | 139 | * @param string $_dst_identifier |
| 140 | 140 | * @return string dst_identifier |
| 141 | 141 | */ |
| 142 | - public function move ( $_dst_identifier ) { |
|
| 143 | - unset($_dst_identifier); // not used, but require by function signature |
|
| 142 | + public function move($_dst_identifier) { |
|
| 143 | + unset($_dst_identifier); // not used, but require by function signature |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
| 147 | 147 | * delets current record from backend |
| 148 | 148 | * |
| 149 | 149 | */ |
| 150 | - public function delete () { |
|
| 150 | + public function delete() { |
|
| 151 | 151 | |
| 152 | 152 | } |
| 153 | 153 | |
@@ -34,10 +34,14 @@ discard block |
||
| 34 | 34 | * |
| 35 | 35 | * @param string $_identifier |
| 36 | 36 | */ |
| 37 | - public function __construct( $_identifier='' ) { |
|
| 38 | - if(is_array($_identifier)) { |
|
| 37 | + public function __construct( $_identifier='' ) |
|
| 38 | + { |
|
| 39 | + if(is_array($_identifier)) |
|
| 40 | + { |
|
| 39 | 41 | $this->identifier = $_identifier['account_id']; |
| 40 | - } else { |
|
| 42 | + } |
|
| 43 | + else |
|
| 44 | + { |
|
| 41 | 45 | $this->identifier = $_identifier; |
| 42 | 46 | } |
| 43 | 47 | $this->set_record($GLOBALS['egw']->accounts->read($this->identifier)); |
@@ -48,7 +52,8 @@ discard block |
||
| 48 | 52 | * |
| 49 | 53 | * @param string $_attribute_name |
| 50 | 54 | */ |
| 51 | - public function __get($_attribute_name) { |
|
| 55 | + public function __get($_attribute_name) |
|
| 56 | + { |
|
| 52 | 57 | return $this->group[$_attribute_name]; |
| 53 | 58 | } |
| 54 | 59 | |
@@ -58,7 +63,8 @@ discard block |
||
| 58 | 63 | * @param string $_attribute_name |
| 59 | 64 | * @param data $data |
| 60 | 65 | */ |
| 61 | - public function __set($_attribute_name, $data) { |
|
| 66 | + public function __set($_attribute_name, $data) |
|
| 67 | + { |
|
| 62 | 68 | $this->group[$_attribute_name] = $data; |
| 63 | 69 | } |
| 64 | 70 | |
@@ -70,7 +76,8 @@ discard block |
||
| 70 | 76 | * |
| 71 | 77 | * @return array complete record as associative array |
| 72 | 78 | */ |
| 73 | - public function get_record_array() { |
|
| 79 | + public function get_record_array() |
|
| 80 | + { |
|
| 74 | 81 | return $this->group; |
| 75 | 82 | } |
| 76 | 83 | |
@@ -79,7 +86,8 @@ discard block |
||
| 79 | 86 | * |
| 80 | 87 | *@return string title |
| 81 | 88 | */ |
| 82 | - public function get_title() { |
|
| 89 | + public function get_title() |
|
| 90 | + { |
|
| 83 | 91 | return Api\Accounts::username($this->identifier); |
| 84 | 92 | } |
| 85 | 93 | |
@@ -89,7 +97,8 @@ discard block |
||
| 89 | 97 | * @todo add some checks |
| 90 | 98 | * @return void |
| 91 | 99 | */ |
| 92 | - public function set_record(array $_record){ |
|
| 100 | + public function set_record(array $_record) |
|
| 101 | + { |
|
| 93 | 102 | $this->group = $_record; |
| 94 | 103 | $this->group['account_members'] = $GLOBALS['egw']->accounts->members($this->group['account_id'],true); |
| 95 | 104 | } |
@@ -99,7 +108,8 @@ discard block |
||
| 99 | 108 | * |
| 100 | 109 | * @return string identifier of current record |
| 101 | 110 | */ |
| 102 | - public function get_identifier() { |
|
| 111 | + public function get_identifier() |
|
| 112 | + { |
|
| 103 | 113 | return $this->identifier; |
| 104 | 114 | } |
| 105 | 115 | |
@@ -109,7 +119,8 @@ discard block |
||
| 109 | 119 | * |
| 110 | 120 | * @return string Full URL of an icon, or appname/icon_name |
| 111 | 121 | */ |
| 112 | - public function get_icon() { |
|
| 122 | + public function get_icon() |
|
| 123 | + { |
|
| 113 | 124 | return 'group'; |
| 114 | 125 | } |
| 115 | 126 | |
@@ -118,7 +129,8 @@ discard block |
||
| 118 | 129 | * |
| 119 | 130 | * @return string identifier |
| 120 | 131 | */ |
| 121 | - public function save ( $_dst_identifier ) { |
|
| 132 | + public function save ( $_dst_identifier ) |
|
| 133 | + { |
|
| 122 | 134 | unset($_dst_identifier); // not used, but require by function signature |
| 123 | 135 | } |
| 124 | 136 | |
@@ -128,7 +140,8 @@ discard block |
||
| 128 | 140 | * @param string $_dst_identifier |
| 129 | 141 | * @return string dst_identifier |
| 130 | 142 | */ |
| 131 | - public function copy ( $_dst_identifier ) { |
|
| 143 | + public function copy ( $_dst_identifier ) |
|
| 144 | + { |
|
| 132 | 145 | unset($_dst_identifier); // not used, but require by function signature |
| 133 | 146 | } |
| 134 | 147 | |
@@ -139,7 +152,8 @@ discard block |
||
| 139 | 152 | * @param string $_dst_identifier |
| 140 | 153 | * @return string dst_identifier |
| 141 | 154 | */ |
| 142 | - public function move ( $_dst_identifier ) { |
|
| 155 | + public function move ( $_dst_identifier ) |
|
| 156 | + { |
|
| 143 | 157 | unset($_dst_identifier); // not used, but require by function signature |
| 144 | 158 | } |
| 145 | 159 | |
@@ -147,7 +161,8 @@ discard block |
||
| 147 | 161 | * delets current record from backend |
| 148 | 162 | * |
| 149 | 163 | */ |
| 150 | - public function delete () { |
|
| 164 | + public function delete () |
|
| 165 | + { |
|
| 151 | 166 | |
| 152 | 167 | } |
| 153 | 168 | |
@@ -155,7 +170,8 @@ discard block |
||
| 155 | 170 | * destructor |
| 156 | 171 | * |
| 157 | 172 | */ |
| 158 | - public function __destruct() { |
|
| 173 | + public function __destruct() |
|
| 174 | + { |
|
| 159 | 175 | unset ($this->group); |
| 160 | 176 | } |
| 161 | 177 | } |
@@ -239,11 +239,11 @@ |
||
| 239 | 239 | unset($postdata[$name]); |
| 240 | 240 | } |
| 241 | 241 | $opts = array('http' => |
| 242 | - array( |
|
| 243 | - 'method' => 'POST', |
|
| 244 | - 'header' => 'Content-type: application/x-www-form-urlencoded', |
|
| 245 | - 'content' => http_build_query($postdata), |
|
| 246 | - ) |
|
| 242 | + array( |
|
| 243 | + 'method' => 'POST', |
|
| 244 | + 'header' => 'Content-type: application/x-www-form-urlencoded', |
|
| 245 | + 'content' => http_build_query($postdata), |
|
| 246 | + ) |
|
| 247 | 247 | ); |
| 248 | 248 | $url = $remote['remote_url'].'/admin/remote.php?domain='.urlencode($remote['remote_domain']).'&secret='.urlencode($secret); |
| 249 | 249 | //echo "sending command to $url\n"; _debug_array($opts); |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | const successful = 2; |
| 61 | 61 | const failed = 3; |
| 62 | 62 | const pending = 4; |
| 63 | - const queued = 5; // command waits to be fetched from remote |
|
| 63 | + const queued = 5; // command waits to be fetched from remote |
|
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * Status which stil need passwords available |
| 67 | 67 | * |
| 68 | 68 | * @var array |
| 69 | 69 | */ |
| 70 | - static $require_pw_stati = array(self::scheduled,self::pending,self::queued); |
|
| 70 | + static $require_pw_stati = array(self::scheduled, self::pending, self::queued); |
|
| 71 | 71 | |
| 72 | 72 | /** |
| 73 | 73 | * The status of the command, one of either scheduled, successful, failed or deleted |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * @return string success message |
| 154 | 154 | * @throws Exception() |
| 155 | 155 | */ |
| 156 | - protected abstract function exec($check_only=false); |
|
| 156 | + protected abstract function exec($check_only = false); |
|
| 157 | 157 | |
| 158 | 158 | /** |
| 159 | 159 | * Return a title / string representation for a given command, eg. to display it |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $this->type = get_class($this); |
| 192 | 192 | |
| 193 | - foreach($data as $name => $value) |
|
| 193 | + foreach ($data as $name => $value) |
|
| 194 | 194 | { |
| 195 | 195 | $this->$name = $name == 'data' && !is_array($value) ? json_php_unserialize($value) : $value; |
| 196 | 196 | } |
@@ -209,13 +209,13 @@ discard block |
||
| 209 | 209 | * @return mixed return value of the command |
| 210 | 210 | * @throws Exceptions on error |
| 211 | 211 | */ |
| 212 | - function run($time=null,$set_modifier=true,$skip_checks=false,$dry_run=false) |
|
| 212 | + function run($time = null, $set_modifier = true, $skip_checks = false, $dry_run = false) |
|
| 213 | 213 | { |
| 214 | 214 | if (!is_null($time)) |
| 215 | 215 | { |
| 216 | 216 | $this->scheduled = $time; |
| 217 | 217 | $this->status = admin_cmd::scheduled; |
| 218 | - $ret = lang('Command scheduled to run at %1',date('Y-m-d H:i',$time)); |
|
| 218 | + $ret = lang('Command scheduled to run at %1', date('Y-m-d H:i', $time)); |
|
| 219 | 219 | // running the checks of the arguments for local commands, if not explicitly requested to not run them |
| 220 | 220 | if (!$this->remote_id && !$skip_checks) |
| 221 | 221 | { |
@@ -281,21 +281,21 @@ discard block |
||
| 281 | 281 | { |
| 282 | 282 | if (!($remote = $this->read_remote($this->remote_id))) |
| 283 | 283 | { |
| 284 | - throw new Api\Exception\WrongUserinput(lang('Invalid remote id or name "%1"!',$this->remote_id),997); |
|
| 284 | + throw new Api\Exception\WrongUserinput(lang('Invalid remote id or name "%1"!', $this->remote_id), 997); |
|
| 285 | 285 | } |
| 286 | 286 | if (!$this->uid) |
| 287 | 287 | { |
| 288 | - $this->save(); // to get the uid |
|
| 288 | + $this->save(); // to get the uid |
|
| 289 | 289 | } |
| 290 | 290 | $secret = md5($this->uid.$remote['remote_hash']); |
| 291 | 291 | |
| 292 | 292 | $postdata = $this->as_array(); |
| 293 | 293 | if (is_object($GLOBALS['egw']->translation)) |
| 294 | 294 | { |
| 295 | - $postdata = Api\Translation::convert($postdata,Api\Translation::charset(),'utf-8'); |
|
| 295 | + $postdata = Api\Translation::convert($postdata, Api\Translation::charset(), 'utf-8'); |
|
| 296 | 296 | } |
| 297 | 297 | // dont send the id's which have no meaning on the remote install |
| 298 | - foreach(array('id','creator','modifier','requested','remote_id') as $name) |
|
| 298 | + foreach (array('id', 'creator', 'modifier', 'requested', 'remote_id') as $name) |
|
| 299 | 299 | { |
| 300 | 300 | unset($postdata[$name]); |
| 301 | 301 | } |
@@ -321,12 +321,12 @@ discard block |
||
| 321 | 321 | } |
| 322 | 322 | if (is_object($GLOBALS['egw']->translation)) |
| 323 | 323 | { |
| 324 | - $message = Api\Translation::convert($message,'utf-8'); |
|
| 324 | + $message = Api\Translation::convert($message, 'utf-8'); |
|
| 325 | 325 | } |
| 326 | 326 | $matches = null; |
| 327 | - if (is_string($message) && preg_match('/^([0-9]+) (.*)$/',$message,$matches)) |
|
| 327 | + if (is_string($message) && preg_match('/^([0-9]+) (.*)$/', $message, $matches)) |
|
| 328 | 328 | { |
| 329 | - throw new Api\Exception($matches[2],(int)$matches[1]); |
|
| 329 | + throw new Api\Exception($matches[2], (int)$matches[1]); |
|
| 330 | 330 | } |
| 331 | 331 | return $message; |
| 332 | 332 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * @param boolean $set_modifier =true set the current user as modifier or 0 (= run by the system) |
| 353 | 353 | * @return boolean true on success, false otherwise |
| 354 | 354 | */ |
| 355 | - function save($set_modifier=true) |
|
| 355 | + function save($set_modifier = true) |
|
| 356 | 356 | { |
| 357 | 357 | admin_cmd::_instanciate_sql(); |
| 358 | 358 | |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | $this->modifier = $set_modifier ? $GLOBALS['egw_info']['user']['account_id'] : 0; |
| 368 | 368 | if ($set_modifier) $this->modifier_email = admin_cmd::user_email(); |
| 369 | 369 | } |
| 370 | - $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
| 370 | + $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
| 371 | 371 | |
| 372 | 372 | // data is stored serialized |
| 373 | 373 | // paswords are masked / removed, if we dont need them anymore |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $this->set_periodic_job(); |
| 407 | 407 | } |
| 408 | 408 | // existing object with no rrule, cancle evtl. running periodic job |
| 409 | - elseif($vars['id']) |
|
| 409 | + elseif ($vars['id']) |
|
| 410 | 410 | { |
| 411 | 411 | $this->cancel_periodic_job(); |
| 412 | 412 | } |
@@ -420,13 +420,13 @@ discard block |
||
| 420 | 420 | * @param boolean $return_serialized =true true: return json serialized string, false: return array |
| 421 | 421 | * @return string|array see $return_serialized |
| 422 | 422 | */ |
| 423 | - static function mask_passwords($data, $return_serialized=true) |
|
| 423 | + static function mask_passwords($data, $return_serialized = true) |
|
| 424 | 424 | { |
| 425 | 425 | if (!is_array($data)) |
| 426 | 426 | { |
| 427 | 427 | $data = json_php_unserialize($data); |
| 428 | 428 | } |
| 429 | - foreach($data as $key => &$value) |
|
| 429 | + foreach ($data as $key => &$value) |
|
| 430 | 430 | { |
| 431 | 431 | if (is_array($value)) |
| 432 | 432 | { |
@@ -474,10 +474,10 @@ discard block |
||
| 474 | 474 | { |
| 475 | 475 | $data['data'] = json_php_unserialize($data['data']); |
| 476 | 476 | } |
| 477 | - if (!(class_exists($class = 'EGroupware\\'.$data['type']) || // namespaced class |
|
| 477 | + if (!(class_exists($class = 'EGroupware\\'.$data['type']) || // namespaced class |
|
| 478 | 478 | class_exists($class = $data['type'])) || $data['type'] == 'admin_cmd') |
| 479 | 479 | { |
| 480 | - throw new Api\Exception\WrongParameter(lang('Unknown command %1!',$class), 10); |
|
| 480 | + throw new Api\Exception\WrongParameter(lang('Unknown command %1!', $class), 10); |
|
| 481 | 481 | } |
| 482 | 482 | $cmd = new $class($data); |
| 483 | 483 | |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | { |
| 486 | 486 | return $cmd; |
| 487 | 487 | } |
| 488 | - throw new Api\Exception\WrongParameter(lang('%1 is no command!',$class), 10); |
|
| 488 | + throw new Api\Exception\WrongParameter(lang('%1 is no command!', $class), 10); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | /** |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | * @param array $readonlys |
| 498 | 498 | * @return int |
| 499 | 499 | */ |
| 500 | - static function get_rows($query,&$rows,$readonlys) |
|
| 500 | + static function get_rows($query, &$rows, $readonlys) |
|
| 501 | 501 | { |
| 502 | 502 | admin_cmd::_instanciate_sql(); |
| 503 | 503 | |
@@ -514,21 +514,21 @@ discard block |
||
| 514 | 514 | $query['col_filter'][] = 'cmd_rrule IS NOT NULL'; |
| 515 | 515 | } |
| 516 | 516 | unset($query['col_filter']['periodic']); |
| 517 | - if($query['col_filter']['parent']) |
|
| 517 | + if ($query['col_filter']['parent']) |
|
| 518 | 518 | { |
| 519 | 519 | $query['col_filter']['parent'] = (int)$query['col_filter']['parent']; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | - $total = admin_cmd::$sql->get_rows($query,$rows,$readonlys); |
|
| 522 | + $total = admin_cmd::$sql->get_rows($query, $rows, $readonlys); |
|
| 523 | 523 | |
| 524 | 524 | if (!$rows) return 0; |
| 525 | 525 | |
| 526 | 526 | $async = new Api\Asyncservice(); |
| 527 | - foreach($rows as &$row) |
|
| 527 | + foreach ($rows as &$row) |
|
| 528 | 528 | { |
| 529 | 529 | try { |
| 530 | 530 | $cmd = admin_cmd::instanciate($row); |
| 531 | - $row['title'] = $cmd->__tostring(); // we call __tostring explicit, as a cast to string requires php5.2+ |
|
| 531 | + $row['title'] = $cmd->__tostring(); // we call __tostring explicit, as a cast to string requires php5.2+ |
|
| 532 | 532 | } |
| 533 | 533 | catch (Exception $e) { |
| 534 | 534 | $row['title'] = $e->getMessage(); |
@@ -536,25 +536,24 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | $row['value'] = $cmd->value; |
| 538 | 538 | |
| 539 | - if(method_exists($cmd, 'summary')) |
|
| 539 | + if (method_exists($cmd, 'summary')) |
|
| 540 | 540 | { |
| 541 | 541 | $row['data'] = $cmd->summary(); |
| 542 | 542 | } |
| 543 | 543 | else |
| 544 | 544 | { |
| 545 | - $row['data'] = !($data = json_php_unserialize($row['data'])) ? '' : |
|
| 546 | - json_encode($data+(empty($row['rrule'])?array():array('rrule' => $row['rrule'])), |
|
| 545 | + $row['data'] = !($data = json_php_unserialize($row['data'])) ? '' : json_encode($data + (empty($row['rrule']) ? array() : array('rrule' => $row['rrule'])), |
|
| 547 | 546 | JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); |
| 548 | 547 | } |
| 549 | - if($row['rrule']) |
|
| 548 | + if ($row['rrule']) |
|
| 550 | 549 | { |
| 551 | - $rrule = calendar_rrule::event2rrule(calendar_rrule::parseRrule($row['rrule'],true)+array( |
|
| 550 | + $rrule = calendar_rrule::event2rrule(calendar_rrule::parseRrule($row['rrule'], true) + array( |
|
| 552 | 551 | 'start' => time(), |
| 553 | 552 | 'tzid'=> Api\DateTime::$server_timezone->getName() |
| 554 | 553 | )); |
| 555 | 554 | $row['rrule'] = ''.$rrule; |
| 556 | 555 | } |
| 557 | - if(!$row['scheduled'] && $cmd && $cmd->async_job_id) |
|
| 556 | + if (!$row['scheduled'] && $cmd && $cmd->async_job_id) |
|
| 558 | 557 | { |
| 559 | 558 | $job = $async->read($cmd->async_job_id); |
| 560 | 559 | |
@@ -580,11 +579,11 @@ discard block |
||
| 580 | 579 | admin_cmd::_instanciate_sql(); |
| 581 | 580 | |
| 582 | 581 | // Need a new one to avoid column name modification |
| 583 | - $sql = new Api\Storage\Base('admin','egw_admin_queue',null); |
|
| 582 | + $sql = new Api\Storage\Base('admin', 'egw_admin_queue', null); |
|
| 584 | 583 | $labels = $sql->query_list('cmd_type'); |
| 585 | 584 | |
| 586 | 585 | // for admin app we also add all available cmd objects |
| 587 | - foreach(scandir(__DIR__) as $file) |
|
| 586 | + foreach (scandir(__DIR__) as $file) |
|
| 588 | 587 | { |
| 589 | 588 | $matches = null; |
| 590 | 589 | if (preg_match('/^class\.(admin_cmd_.*)\.inc\.php$/', $file, $matches)) |
@@ -595,15 +594,15 @@ discard block |
||
| 595 | 594 | } |
| 596 | 595 | } |
| 597 | 596 | } |
| 598 | - foreach($labels as $class => &$label) |
|
| 597 | + foreach ($labels as $class => &$label) |
|
| 599 | 598 | { |
| 600 | - if(class_exists($class)) |
|
| 599 | + if (class_exists($class)) |
|
| 601 | 600 | { |
| 602 | 601 | $label = $class::name(); |
| 603 | 602 | } |
| 604 | - elseif (class_exists('EGroupware\\' . $class)) |
|
| 603 | + elseif (class_exists('EGroupware\\'.$class)) |
|
| 605 | 604 | { |
| 606 | - $class = 'EGroupware\\' . $class; |
|
| 605 | + $class = 'EGroupware\\'.$class; |
|
| 607 | 606 | $label = $class::name(); |
| 608 | 607 | } |
| 609 | 608 | } |
@@ -634,11 +633,11 @@ discard block |
||
| 634 | 633 | * @param array $filter =null if set (!=null) col-data pairs, to be and-ed (!) into the query without wildcards |
| 635 | 634 | * @return array |
| 636 | 635 | */ |
| 637 | - static function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null) |
|
| 636 | + static function &search($criteria, $only_keys = True, $order_by = '', $extra_cols = '', $wildcard = '', $empty = False, $op = 'AND', $start = false, $filter = null) |
|
| 638 | 637 | { |
| 639 | 638 | admin_cmd::_instanciate_sql(); |
| 640 | 639 | |
| 641 | - return admin_cmd::$sql->search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,$start,$filter); |
|
| 640 | + return admin_cmd::$sql->search($criteria, $only_keys, $order_by, $extra_cols, $wildcard, $empty, $op, $start, $filter); |
|
| 642 | 641 | } |
| 643 | 642 | |
| 644 | 643 | /** |
@@ -650,7 +649,7 @@ discard block |
||
| 650 | 649 | { |
| 651 | 650 | if (is_null(admin_cmd::$sql)) |
| 652 | 651 | { |
| 653 | - admin_cmd::$sql = new Api\Storage\Base('admin','egw_admin_queue',null,'cmd_'); |
|
| 652 | + admin_cmd::$sql = new Api\Storage\Base('admin', 'egw_admin_queue', null, 'cmd_'); |
|
| 654 | 653 | } |
| 655 | 654 | } |
| 656 | 655 | |
@@ -663,7 +662,7 @@ discard block |
||
| 663 | 662 | { |
| 664 | 663 | if (is_null(admin_cmd::$remote)) |
| 665 | 664 | { |
| 666 | - admin_cmd::$remote = new Api\Storage\Base('admin','egw_admin_remote'); |
|
| 665 | + admin_cmd::$remote = new Api\Storage\Base('admin', 'egw_admin_remote'); |
|
| 667 | 666 | } |
| 668 | 667 | } |
| 669 | 668 | |
@@ -675,11 +674,11 @@ discard block |
||
| 675 | 674 | */ |
| 676 | 675 | function __get($property) |
| 677 | 676 | { |
| 678 | - if (property_exists('admin_cmd',$property)) |
|
| 677 | + if (property_exists('admin_cmd', $property)) |
|
| 679 | 678 | { |
| 680 | - return $this->$property; // making all (non static) class vars readonly available |
|
| 679 | + return $this->$property; // making all (non static) class vars readonly available |
|
| 681 | 680 | } |
| 682 | - switch($property) |
|
| 681 | + switch ($property) |
|
| 683 | 682 | { |
| 684 | 683 | case 'accounts': |
| 685 | 684 | self::_instanciate_accounts(); |
@@ -698,9 +697,9 @@ discard block |
||
| 698 | 697 | */ |
| 699 | 698 | function __isset($property) |
| 700 | 699 | { |
| 701 | - if (property_exists('admin_cmd',$property)) |
|
| 700 | + if (property_exists('admin_cmd', $property)) |
|
| 702 | 701 | { |
| 703 | - return isset($this->$property); // making all (non static) class vars readonly available |
|
| 702 | + return isset($this->$property); // making all (non static) class vars readonly available |
|
| 704 | 703 | } |
| 705 | 704 | return isset($this->data[$property]); |
| 706 | 705 | } |
@@ -712,7 +711,7 @@ discard block |
||
| 712 | 711 | * @param mixed $value |
| 713 | 712 | * @return mixed |
| 714 | 713 | */ |
| 715 | - function __set($property,$value) |
|
| 714 | + function __set($property, $value) |
|
| 716 | 715 | { |
| 717 | 716 | $this->data[$property] = $value; |
| 718 | 717 | } |
@@ -734,19 +733,19 @@ discard block |
||
| 734 | 733 | */ |
| 735 | 734 | function as_array() |
| 736 | 735 | { |
| 737 | - if (version_compare(PHP_VERSION,'5.1.2','>')) |
|
| 736 | + if (version_compare(PHP_VERSION, '5.1.2', '>')) |
|
| 738 | 737 | { |
| 739 | - $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
| 738 | + $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
|
| 740 | 739 | } |
| 741 | 740 | else |
| 742 | 741 | { |
| 743 | - foreach(array_keys(get_class_vars(__CLASS__)) as $name) |
|
| 742 | + foreach (array_keys(get_class_vars(__CLASS__)) as $name) |
|
| 744 | 743 | { |
| 745 | 744 | $vars[$name] = $this->$name; |
| 746 | 745 | } |
| 747 | 746 | } |
| 748 | 747 | unset($vars['data']); |
| 749 | - if ($this->data) $vars = array_merge($this->data,$vars); |
|
| 748 | + if ($this->data) $vars = array_merge($this->data, $vars); |
|
| 750 | 749 | |
| 751 | 750 | return $vars; |
| 752 | 751 | } |
@@ -758,14 +757,14 @@ discard block |
||
| 758 | 757 | * @param int $extra_deny =null further admin rights to check, eg. 16 = deny edit Api\Accounts |
| 759 | 758 | * @throws Api\Exception\NoPermission\Admin |
| 760 | 759 | */ |
| 761 | - protected function _check_admin($extra_acl=null,$extra_deny=null) |
|
| 760 | + protected function _check_admin($extra_acl = null, $extra_deny = null) |
|
| 762 | 761 | { |
| 763 | 762 | if ($this->creator) |
| 764 | 763 | { |
| 765 | 764 | admin_cmd::_instanciate_acl($this->creator); |
| 766 | 765 | // todo: check only if and with $this->creator |
| 767 | - if (!admin_cmd::$acl->check('run',1,'admin') && // creator is no longer admin |
|
| 768 | - $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) // creator is explicitly forbidden to do something |
|
| 766 | + if (!admin_cmd::$acl->check('run', 1, 'admin') && // creator is no longer admin |
|
| 767 | + $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl, $extra_deny, 'admin')) // creator is explicitly forbidden to do something |
|
| 769 | 768 | { |
| 770 | 769 | throw new Api\Exception\NoPermission\Admin(); |
| 771 | 770 | } |
@@ -781,13 +780,13 @@ discard block |
||
| 781 | 780 | */ |
| 782 | 781 | static function parse_apps(array $apps) |
| 783 | 782 | { |
| 784 | - foreach($apps as $key => $name) |
|
| 783 | + foreach ($apps as $key => $name) |
|
| 785 | 784 | { |
| 786 | 785 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
| 787 | 786 | { |
| 788 | - foreach($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
| 787 | + foreach ($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
| 789 | 788 | { |
| 790 | - if (!strcasecmp($name,$data['title']) || !strcasecmp($name,lang($app))) |
|
| 789 | + if (!strcasecmp($name, $data['title']) || !strcasecmp($name, lang($app))) |
|
| 791 | 790 | { |
| 792 | 791 | $apps[$key] = $name = $app; |
| 793 | 792 | break; |
@@ -796,7 +795,7 @@ discard block |
||
| 796 | 795 | } |
| 797 | 796 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
| 798 | 797 | { |
| 799 | - throw new Api\Exception\WrongUserinput(lang("Application '%1' not found (maybe not installed or misspelled)!",$name),8); |
|
| 798 | + throw new Api\Exception\WrongUserinput(lang("Application '%1' not found (maybe not installed or misspelled)!", $name), 8); |
|
| 800 | 799 | } |
| 801 | 800 | } |
| 802 | 801 | return $apps; |
@@ -811,20 +810,20 @@ discard block |
||
| 811 | 810 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$account), 15); |
| 812 | 811 | * @throws Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')), 16); |
| 813 | 812 | */ |
| 814 | - static function parse_account($account,$allow_only_user=null) |
|
| 813 | + static function parse_account($account, $allow_only_user = null) |
|
| 815 | 814 | { |
| 816 | 815 | admin_cmd::_instanciate_accounts(); |
| 817 | 816 | |
| 818 | 817 | if (!($type = admin_cmd::$accounts->exists($account)) || |
| 819 | - !is_numeric($id=$account) && !($id = admin_cmd::$accounts->name2id($account))) |
|
| 818 | + !is_numeric($id = $account) && !($id = admin_cmd::$accounts->name2id($account))) |
|
| 820 | 819 | { |
| 821 | - throw new Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$account), 15); |
|
| 820 | + throw new Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!", $account), 15); |
|
| 822 | 821 | } |
| 823 | 822 | if (!is_null($allow_only_user) && $allow_only_user !== ($type == 1)) |
| 824 | 823 | { |
| 825 | - throw new Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')), 16); |
|
| 824 | + throw new Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!", $account, $allow_only_user ?lang('user') : lang('group')), 16); |
|
| 826 | 825 | } |
| 827 | - if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
| 826 | + if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
| 828 | 827 | |
| 829 | 828 | return $id; |
| 830 | 829 | } |
@@ -838,14 +837,14 @@ discard block |
||
| 838 | 837 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$account), 15); |
| 839 | 838 | * @throws Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only?lang('user'):lang('group')), 16); |
| 840 | 839 | */ |
| 841 | - static function parse_accounts($accounts,$allow_only_user=null) |
|
| 840 | + static function parse_accounts($accounts, $allow_only_user = null) |
|
| 842 | 841 | { |
| 843 | 842 | if (!$accounts) return null; |
| 844 | 843 | |
| 845 | 844 | $ids = array(); |
| 846 | - foreach(is_array($accounts) ? $accounts : explode(',',$accounts) as $account) |
|
| 845 | + foreach (is_array($accounts) ? $accounts : explode(',', $accounts) as $account) |
|
| 847 | 846 | { |
| 848 | - $ids[] = admin_cmd::parse_account($account,$allow_only_user); |
|
| 847 | + $ids[] = admin_cmd::parse_account($account, $allow_only_user); |
|
| 849 | 848 | } |
| 850 | 849 | return $ids; |
| 851 | 850 | } |
@@ -863,11 +862,11 @@ discard block |
||
| 863 | 862 | { |
| 864 | 863 | $datein = $date; |
| 865 | 864 | // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format |
| 866 | - $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/','\3-\2-\1',$date); |
|
| 865 | + $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/', '\3-\2-\1', $date); |
|
| 867 | 866 | |
| 868 | - if (($date = strtotime($date)) === false) |
|
| 867 | + if (($date = strtotime($date)) === false) |
|
| 869 | 868 | { |
| 870 | - throw new Api\Exception\WrongUserinput(lang('Invalid formated date "%1"!',$datein),6); |
|
| 869 | + throw new Api\Exception\WrongUserinput(lang('Invalid formated date "%1"!', $datein), 6); |
|
| 871 | 870 | } |
| 872 | 871 | } |
| 873 | 872 | return (int)$date; |
@@ -881,7 +880,7 @@ discard block |
||
| 881 | 880 | * @return boolean |
| 882 | 881 | * @throws Api\Exception\WrongUserinput(lang('Invalid value "%1" use yes or no!',$value),998); |
| 883 | 882 | */ |
| 884 | - static function parse_boolean($value,$default=null) |
|
| 883 | + static function parse_boolean($value, $default = null) |
|
| 885 | 884 | { |
| 886 | 885 | if (is_bool($value) || is_int($value)) |
| 887 | 886 | { |
@@ -891,15 +890,15 @@ discard block |
||
| 891 | 890 | { |
| 892 | 891 | return $default; |
| 893 | 892 | } |
| 894 | - if (in_array($value,array('1','yes','true',lang('yes'),lang('true')))) |
|
| 893 | + if (in_array($value, array('1', 'yes', 'true', lang('yes'), lang('true')))) |
|
| 895 | 894 | { |
| 896 | 895 | return true; |
| 897 | 896 | } |
| 898 | - if (in_array($value,array('0','no','false',lang('no'),lang('false')))) |
|
| 897 | + if (in_array($value, array('0', 'no', 'false', lang('no'), lang('false')))) |
|
| 899 | 898 | { |
| 900 | 899 | return false; |
| 901 | 900 | } |
| 902 | - throw new Api\Exception\WrongUserinput(lang('Invalid value "%1" use yes or no!',$value),998); |
|
| 901 | + throw new Api\Exception\WrongUserinput(lang('Invalid value "%1" use yes or no!', $value), 998); |
|
| 903 | 902 | } |
| 904 | 903 | |
| 905 | 904 | /** |
@@ -917,9 +916,9 @@ discard block |
||
| 917 | 916 | 'remote_id' => $id_or_name, |
| 918 | 917 | 'remote_name' => $id_or_name, |
| 919 | 918 | 'remote_domain' => $id_or_name, |
| 920 | - ),true,'','','',false,'OR')) || count($remotes) != 1) |
|
| 919 | + ), true, '', '', '', false, 'OR')) || count($remotes) != 1) |
|
| 921 | 920 | { |
| 922 | - throw new Api\Exception\WrongUserinput(lang('Invalid remote id or name "%1"!',$id_or_name),997); |
|
| 921 | + throw new Api\Exception\WrongUserinput(lang('Invalid remote id or name "%1"!', $id_or_name), 997); |
|
| 923 | 922 | } |
| 924 | 923 | return $remotes[0]['remote_id']; |
| 925 | 924 | } |
@@ -936,7 +935,7 @@ discard block |
||
| 936 | 935 | { |
| 937 | 936 | if (!is_object($GLOBALS['egw']->accounts)) |
| 938 | 937 | { |
| 939 | - throw new Api\Exception\AssertionFailed(lang('%1 class not instanciated','accounts'),999); |
|
| 938 | + throw new Api\Exception\AssertionFailed(lang('%1 class not instanciated', 'accounts'), 999); |
|
| 940 | 939 | } |
| 941 | 940 | admin_cmd::$accounts = $GLOBALS['egw']->accounts; |
| 942 | 941 | } |
@@ -949,13 +948,13 @@ discard block |
||
| 949 | 948 | * @param int $account =null account_id the class needs to be instanciated for, default need only account-independent methods |
| 950 | 949 | * @throws Api\Exception\AssertionFailed(lang('%1 class not instanciated','acl'),999); |
| 951 | 950 | */ |
| 952 | - protected function _instanciate_acl($account=null) |
|
| 951 | + protected function _instanciate_acl($account = null) |
|
| 953 | 952 | { |
| 954 | 953 | if (!is_object(admin_cmd::$acl) || $account && admin_cmd::$acl->account_id != $account) |
| 955 | 954 | { |
| 956 | 955 | if (!is_object($GLOBALS['egw']->acl)) |
| 957 | 956 | { |
| 958 | - throw new Api\Exception\AssertionFailed(lang('%1 class not instanciated','acl'),999); |
|
| 957 | + throw new Api\Exception\AssertionFailed(lang('%1 class not instanciated', 'acl'), 999); |
|
| 959 | 958 | } |
| 960 | 959 | if ($account && $GLOBALS['egw']->acl->account_id != $account) |
| 961 | 960 | { |
@@ -975,20 +974,20 @@ discard block |
||
| 975 | 974 | * @param $account_id =null account_id, default current user |
| 976 | 975 | * @return string |
| 977 | 976 | */ |
| 978 | - static function user_email($account_id=null) |
|
| 977 | + static function user_email($account_id = null) |
|
| 979 | 978 | { |
| 980 | 979 | if ($account_id) |
| 981 | 980 | { |
| 982 | 981 | admin_cmd::_instanciate_accounts(); |
| 983 | - $fullname = admin_cmd::$accounts->id2name($account_id,'account_fullname'); |
|
| 984 | - $email = admin_cmd::$accounts->id2name($account_id,'account_email'); |
|
| 982 | + $fullname = admin_cmd::$accounts->id2name($account_id, 'account_fullname'); |
|
| 983 | + $email = admin_cmd::$accounts->id2name($account_id, 'account_email'); |
|
| 985 | 984 | } |
| 986 | 985 | else |
| 987 | 986 | { |
| 988 | 987 | $fullname = $GLOBALS['egw_info']['user']['account_fullname']; |
| 989 | 988 | $email = $GLOBALS['egw_info']['user']['account_email']; |
| 990 | 989 | } |
| 991 | - return $fullname . ($email ? ' <'.$email.'>' : ''); |
|
| 990 | + return $fullname.($email ? ' <'.$email.'>' : ''); |
|
| 992 | 991 | } |
| 993 | 992 | |
| 994 | 993 | /** |
@@ -1012,11 +1011,11 @@ discard block |
||
| 1012 | 1011 | { |
| 1013 | 1012 | return false; |
| 1014 | 1013 | } |
| 1015 | - if (!($jobs = admin_cmd::search(array(),false,'cmd_scheduled','','',false,'AND',array(0,1),array( |
|
| 1014 | + if (!($jobs = admin_cmd::search(array(), false, 'cmd_scheduled', '', '', false, 'AND', array(0, 1), array( |
|
| 1016 | 1015 | 'cmd_status' => admin_cmd::scheduled, |
| 1017 | 1016 | )))) |
| 1018 | 1017 | { |
| 1019 | - return false; // no schduled command, no need to setup the job |
|
| 1018 | + return false; // no schduled command, no need to setup the job |
|
| 1020 | 1019 | } |
| 1021 | 1020 | $next = $jobs[0]; |
| 1022 | 1021 | if (($time = $next['scheduled']) < time()) // should run immediatly |
@@ -1026,11 +1025,11 @@ discard block |
||
| 1026 | 1025 | $async = new Api\Asyncservice(); |
| 1027 | 1026 | |
| 1028 | 1027 | // we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class! |
| 1029 | - list($app) = explode('_',$class=$next['type']); |
|
| 1028 | + list($app) = explode('_', $class = $next['type']); |
|
| 1030 | 1029 | $callback = $app.'.'.$class.'.run_queued_jobs'; |
| 1031 | 1030 | |
| 1032 | - $async->cancel_timer(admin_cmd::async_job_id); // we delete it in case a job already exists |
|
| 1033 | - return $async->set_timer($time,admin_cmd::async_job_id,$callback,null,$next['creator']); |
|
| 1031 | + $async->cancel_timer(admin_cmd::async_job_id); // we delete it in case a job already exists |
|
| 1032 | + return $async->set_timer($time, admin_cmd::async_job_id, $callback, null, $next['creator']); |
|
| 1034 | 1033 | } |
| 1035 | 1034 | |
| 1036 | 1035 | /** |
@@ -1040,20 +1039,20 @@ discard block |
||
| 1040 | 1039 | */ |
| 1041 | 1040 | static function run_queued_jobs() |
| 1042 | 1041 | { |
| 1043 | - if (!($jobs = admin_cmd::search(array(),false,'cmd_scheduled','','',false,'AND',false,array( |
|
| 1042 | + if (!($jobs = admin_cmd::search(array(), false, 'cmd_scheduled', '', '', false, 'AND', false, array( |
|
| 1044 | 1043 | 'cmd_status' => admin_cmd::scheduled, |
| 1045 | 1044 | 'cmd_scheduled <= '.time(), |
| 1046 | 1045 | )))) |
| 1047 | 1046 | { |
| 1048 | - return false; // no schduled commands, no need to setup the job |
|
| 1047 | + return false; // no schduled commands, no need to setup the job |
|
| 1049 | 1048 | } |
| 1050 | - admin_cmd::$running_queued_jobs = true; // stop admin_cmd::run() which calls admin_cmd::save() to install a new job |
|
| 1049 | + admin_cmd::$running_queued_jobs = true; // stop admin_cmd::run() which calls admin_cmd::save() to install a new job |
|
| 1051 | 1050 | |
| 1052 | - foreach($jobs as $job) |
|
| 1051 | + foreach ($jobs as $job) |
|
| 1053 | 1052 | { |
| 1054 | 1053 | try { |
| 1055 | 1054 | $cmd = admin_cmd::instanciate($job); |
| 1056 | - $cmd->run(null,false); // false = dont set current user as modifier, as job is run by the queue/system itself |
|
| 1055 | + $cmd->run(null, false); // false = dont set current user as modifier, as job is run by the queue/system itself |
|
| 1057 | 1056 | } |
| 1058 | 1057 | catch (Exception $e) { // we need to mark that command as failed, to prevent further execution |
| 1059 | 1058 | _egw_log_exception($e); |
@@ -1083,13 +1082,13 @@ discard block |
||
| 1083 | 1082 | if (empty($this->rrule)) return false; |
| 1084 | 1083 | |
| 1085 | 1084 | // parse rrule and calculate next execution time |
| 1086 | - $event = calendar_rrule::parseRrule($this->rrule, true); // true: allow HOURLY or MINUTELY |
|
| 1085 | + $event = calendar_rrule::parseRrule($this->rrule, true); // true: allow HOURLY or MINUTELY |
|
| 1087 | 1086 | // rrule can depend on start-time, use policy creation time by default, if rrule_start is not set |
| 1088 | 1087 | $event['start'] = empty($this->rrule_start) ? $this->created : $this->rrule_start; |
| 1089 | 1088 | $event['tzid'] = Api\DateTime::$server_timezone->getName(); |
| 1090 | - $rrule = calendar_rrule::event2rrule($event, false); // false = server timezone |
|
| 1089 | + $rrule = calendar_rrule::event2rrule($event, false); // false = server timezone |
|
| 1091 | 1090 | $rrule->rewind(); |
| 1092 | - while((($time = $rrule->current()->format('ts'))) <= time()) |
|
| 1091 | + while ((($time = $rrule->current()->format('ts'))) <= time()) |
|
| 1093 | 1092 | { |
| 1094 | 1093 | $rrule->next(); |
| 1095 | 1094 | } |
@@ -1097,7 +1096,7 @@ discard block |
||
| 1097 | 1096 | // schedule run_periodic_job to run at that time |
| 1098 | 1097 | $async = new Api\Asyncservice(); |
| 1099 | 1098 | $job_id = empty($this->async_job_id) ? self::PERIOD_ASYNC_ID_PREFIX.$this->id : $this->async_job_id; |
| 1100 | - $async->cancel_timer($job_id); // we delete it in case a job already exists |
|
| 1099 | + $async->cancel_timer($job_id); // we delete it in case a job already exists |
|
| 1101 | 1100 | return $async->set_timer($time, $job_id, __CLASS__.'::run_periodic_job', $this->as_array(), $this->creator); |
| 1102 | 1101 | } |
| 1103 | 1102 | |
@@ -1110,7 +1109,7 @@ discard block |
||
| 1110 | 1109 | { |
| 1111 | 1110 | $async = new Api\Asyncservice(); |
| 1112 | 1111 | $job_id = empty($this->async_job_id) ? self::PERIOD_ASYNC_ID_PREFIX.$this->id : $this->async_job_id; |
| 1113 | - $async->cancel_timer($job_id); // we delete it in case a job already exists |
|
| 1112 | + $async->cancel_timer($job_id); // we delete it in case a job already exists |
|
| 1114 | 1113 | } |
| 1115 | 1114 | |
| 1116 | 1115 | /** |
@@ -1127,10 +1126,10 @@ discard block |
||
| 1127 | 1126 | $single = $cmd->as_array(); |
| 1128 | 1127 | $single['parent'] = $single['id']; |
| 1129 | 1128 | $args = array_diff_key($single, array_flip(array( |
| 1130 | - 'id','uid', |
|
| 1131 | - 'created','modified','modifier', |
|
| 1132 | - 'async_job_id','rrule','scheduled', |
|
| 1133 | - 'status', 'set', 'old','value','result' |
|
| 1129 | + 'id', 'uid', |
|
| 1130 | + 'created', 'modified', 'modifier', |
|
| 1131 | + 'async_job_id', 'rrule', 'scheduled', |
|
| 1132 | + 'status', 'set', 'old', 'value', 'result' |
|
| 1134 | 1133 | ))); |
| 1135 | 1134 | |
| 1136 | 1135 | $periodic = admin_cmd::instanciate($args); |
@@ -1156,9 +1155,9 @@ discard block |
||
| 1156 | 1155 | admin_cmd::_instanciate_remote(); |
| 1157 | 1156 | |
| 1158 | 1157 | $sites = array(lang('local')); |
| 1159 | - if (($remote = admin_cmd::$remote->query_list('remote_name','remote_id'))) |
|
| 1158 | + if (($remote = admin_cmd::$remote->query_list('remote_name', 'remote_id'))) |
|
| 1160 | 1159 | { |
| 1161 | - $sites = array_merge($sites,$remote); |
|
| 1160 | + $sites = array_merge($sites, $remote); |
|
| 1162 | 1161 | } |
| 1163 | 1162 | return $sites; |
| 1164 | 1163 | } |
@@ -1171,11 +1170,11 @@ discard block |
||
| 1171 | 1170 | * @param array &$readonlys |
| 1172 | 1171 | * @return int |
| 1173 | 1172 | */ |
| 1174 | - static function get_remotes($query,&$rows,&$readonlys) |
|
| 1173 | + static function get_remotes($query, &$rows, &$readonlys) |
|
| 1175 | 1174 | { |
| 1176 | 1175 | admin_cmd::_instanciate_remote(); |
| 1177 | 1176 | |
| 1178 | - return admin_cmd::$remote->get_rows($query,$rows,$readonlys); |
|
| 1177 | + return admin_cmd::$remote->get_rows($query, $rows, $readonlys); |
|
| 1179 | 1178 | } |
| 1180 | 1179 | |
| 1181 | 1180 | /** |
@@ -1203,7 +1202,7 @@ discard block |
||
| 1203 | 1202 | |
| 1204 | 1203 | if ($data['install_id'] && $data['config_passwd']) // calculate hash |
| 1205 | 1204 | { |
| 1206 | - $data['remote_hash'] = self::remote_hash($data['install_id'],$data['config_passwd']); |
|
| 1205 | + $data['remote_hash'] = self::remote_hash($data['install_id'], $data['config_passwd']); |
|
| 1207 | 1206 | } |
| 1208 | 1207 | elseif (!$data['remote_hash'] && !($data['install_id'] && $data['config_passwd'])) |
| 1209 | 1208 | { |
@@ -1215,12 +1214,12 @@ discard block |
||
| 1215 | 1214 | // check if a unique key constrain would be violated by saving the entry |
| 1216 | 1215 | if (($num = admin_cmd::$remote->not_unique())) |
| 1217 | 1216 | { |
| 1218 | - $col = admin_cmd::$remote->table_def['uc'][$num-1]; // $num is 1 based! |
|
| 1219 | - throw new egw_exception_db_not_unique(lang('Value for column %1 is not unique!',$this->table_name.'.'.$col),$num); |
|
| 1217 | + $col = admin_cmd::$remote->table_def['uc'][$num - 1]; // $num is 1 based! |
|
| 1218 | + throw new egw_exception_db_not_unique(lang('Value for column %1 is not unique!', $this->table_name.'.'.$col), $num); |
|
| 1220 | 1219 | } |
| 1221 | 1220 | if (admin_cmd::$remote->save() != 0) |
| 1222 | 1221 | { |
| 1223 | - throw new Api\Db\Exception(lang('Error saving to db:').' '.$this->sql->db->Error.' ('.$this->sql->db->Errno.')',$this->sql->db->Errno); |
|
| 1222 | + throw new Api\Db\Exception(lang('Error saving to db:').' '.$this->sql->db->Error.' ('.$this->sql->db->Errno.')', $this->sql->db->Errno); |
|
| 1224 | 1223 | } |
| 1225 | 1224 | return admin_cmd::$remote->data['remote_id']; |
| 1226 | 1225 | } |
@@ -1232,11 +1231,11 @@ discard block |
||
| 1232 | 1231 | * @param string $config_passwd |
| 1233 | 1232 | * @return string 32char md5 hash |
| 1234 | 1233 | */ |
| 1235 | - static function remote_hash($install_id,$config_passwd) |
|
| 1234 | + static function remote_hash($install_id, $config_passwd) |
|
| 1236 | 1235 | { |
| 1237 | 1236 | if (empty($config_passwd) || !self::is_md5($install_id)) |
| 1238 | 1237 | { |
| 1239 | - throw new Api\Exception\WrongParameter(empty($config_passwd)?'Empty Api\Config password':'install_id no md5 hash'); |
|
| 1238 | + throw new Api\Exception\WrongParameter(empty($config_passwd) ? 'Empty Api\Config password' : 'install_id no md5 hash'); |
|
| 1240 | 1239 | } |
| 1241 | 1240 | if (!self::is_md5($config_passwd)) $config_passwd = md5($config_passwd); |
| 1242 | 1241 | |
@@ -1266,7 +1265,7 @@ discard block |
||
| 1266 | 1265 | */ |
| 1267 | 1266 | static function is_md5($str) |
| 1268 | 1267 | { |
| 1269 | - return preg_match('/^[0-9a-f]{32}$/',$str); |
|
| 1268 | + return preg_match('/^[0-9a-f]{32}$/', $str); |
|
| 1270 | 1269 | } |
| 1271 | 1270 | |
| 1272 | 1271 | /** |
@@ -1283,26 +1282,26 @@ discard block |
||
| 1283 | 1282 | * @param string $config_passwd of the current domain |
| 1284 | 1283 | * @throws Api\Exception\NoPermission |
| 1285 | 1284 | */ |
| 1286 | - function check_remote_access($secret,$config_passwd) |
|
| 1285 | + function check_remote_access($secret, $config_passwd) |
|
| 1287 | 1286 | { |
| 1288 | 1287 | // as a security measure remote administration need to be enabled under Admin > Site configuration |
| 1289 | - list(,$remote_admin_install_id) = explode('-',$this->uid); |
|
| 1290 | - $allowed_remote_admin_ids = $GLOBALS['egw_info']['server']['allow_remote_admin'] ? explode(',',$GLOBALS['egw_info']['server']['allow_remote_admin']) : array(); |
|
| 1288 | + list(,$remote_admin_install_id) = explode('-', $this->uid); |
|
| 1289 | + $allowed_remote_admin_ids = $GLOBALS['egw_info']['server']['allow_remote_admin'] ? explode(',', $GLOBALS['egw_info']['server']['allow_remote_admin']) : array(); |
|
| 1291 | 1290 | |
| 1292 | 1291 | // to authenticate with the installation we use a secret, which is a md5 hash build from the uid |
| 1293 | 1292 | // of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash |
| 1294 | 1293 | // of the md5 hash of the Api\Config password and the install_id (egw_admin_remote.remote_hash) |
| 1295 | - if (is_null($config_passwd) || is_numeric($this->uid) || !in_array($remote_admin_install_id,$allowed_remote_admin_ids) || |
|
| 1296 | - $secret != ($md5=md5($this->uid.$this->remote_hash($GLOBALS['egw_info']['server']['install_id'],$config_passwd)))) |
|
| 1294 | + if (is_null($config_passwd) || is_numeric($this->uid) || !in_array($remote_admin_install_id, $allowed_remote_admin_ids) || |
|
| 1295 | + $secret != ($md5 = md5($this->uid.$this->remote_hash($GLOBALS['egw_info']['server']['install_id'], $config_passwd)))) |
|
| 1297 | 1296 | { |
| 1298 | 1297 | //die("secret='$secret' != '$md5', is_null($config_passwd)=".is_null($config_passwd).", uid=$this->uid, remote_install_id=$remote_admin_install_id, allowed: ".implode(', ',$allowed_remote_admin_ids)); |
| 1299 | 1298 | unset($md5); |
| 1300 | 1299 | $msg = lang('Permission denied!'); |
| 1301 | - if (!in_array($remote_admin_install_id,$allowed_remote_admin_ids)) |
|
| 1300 | + if (!in_array($remote_admin_install_id, $allowed_remote_admin_ids)) |
|
| 1302 | 1301 | { |
| 1303 | 1302 | $msg .= "\n".lang('Remote administration need to be enabled in the remote instance under Admin > Site configuration!'); |
| 1304 | 1303 | } |
| 1305 | - throw new Api\Exception\NoPermission($msg,0); |
|
| 1304 | + throw new Api\Exception\NoPermission($msg, 0); |
|
| 1306 | 1305 | } |
| 1307 | 1306 | } |
| 1308 | 1307 | |
@@ -1312,7 +1311,7 @@ discard block |
||
| 1312 | 1311 | * @param int $len =16 |
| 1313 | 1312 | * @return string |
| 1314 | 1313 | */ |
| 1315 | - static function randomstring($len=16) |
|
| 1314 | + static function randomstring($len = 16) |
|
| 1316 | 1315 | { |
| 1317 | 1316 | return Api\Auth::randomstring($len); |
| 1318 | 1317 | } |
@@ -1334,7 +1333,7 @@ discard block |
||
| 1334 | 1333 | */ |
| 1335 | 1334 | protected function get_etemplate() |
| 1336 | 1335 | { |
| 1337 | - static $tpl = null; // some caching to not instanciate it twice |
|
| 1336 | + static $tpl = null; // some caching to not instanciate it twice |
|
| 1338 | 1337 | |
| 1339 | 1338 | if (!isset($tpl)) |
| 1340 | 1339 | { |
@@ -1365,7 +1364,7 @@ discard block |
||
| 1365 | 1364 | { |
| 1366 | 1365 | $tpl->run(function($cname, $expand, $widget) use (&$labels, &$label) |
| 1367 | 1366 | { |
| 1368 | - switch($widget->type) |
|
| 1367 | + switch ($widget->type) |
|
| 1369 | 1368 | { |
| 1370 | 1369 | // remember label from last description widget |
| 1371 | 1370 | case 'description': |
@@ -1408,7 +1407,7 @@ discard block |
||
| 1408 | 1407 | { |
| 1409 | 1408 | $tpl->run(function($cname, $expand, $widget) use (&$widgets, &$last_select, $selectboxes) |
| 1410 | 1409 | { |
| 1411 | - switch($widget->type) |
|
| 1410 | + switch ($widget->type) |
|
| 1412 | 1411 | { |
| 1413 | 1412 | // ignore non input-widgets |
| 1414 | 1413 | case 'hbox': case 'vbox': case 'box': case 'groupbox': |
@@ -1473,12 +1472,12 @@ discard block |
||
| 1473 | 1472 | */ |
| 1474 | 1473 | public function get_result() |
| 1475 | 1474 | { |
| 1476 | - if($this->result) |
|
| 1475 | + if ($this->result) |
|
| 1477 | 1476 | { |
| 1478 | 1477 | return is_array($this->result) ? implode("\n", $this->result) : $this->result; |
| 1479 | 1478 | } |
| 1480 | 1479 | return lang("Command was run %1 on %2", |
| 1481 | - static::$stati[ $this->status ], |
|
| 1480 | + static::$stati[$this->status], |
|
| 1482 | 1481 | Api\DateTime::to($this->created)); |
| 1483 | 1482 | } |
| 1484 | 1483 | } |
@@ -172,7 +172,10 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public static function name() |
| 174 | 174 | { |
| 175 | - if (self::NAME) return self::NAME; |
|
| 175 | + if (self::NAME) |
|
| 176 | + { |
|
| 177 | + return self::NAME; |
|
| 178 | + } |
|
| 176 | 179 | |
| 177 | 180 | return ucfirst(str_replace(['_cmd_', '_', '\\'], ' ', get_called_class())); |
| 178 | 181 | } |
@@ -242,7 +245,10 @@ discard block |
||
| 242 | 245 | { |
| 243 | 246 | $ret = $this->remote_exec($dry_run); |
| 244 | 247 | } |
| 245 | - if (is_null($this->status)) $this->status = admin_cmd::successful; |
|
| 248 | + if (is_null($this->status)) |
|
| 249 | + { |
|
| 250 | + $this->status = admin_cmd::successful; |
|
| 251 | + } |
|
| 246 | 252 | } |
| 247 | 253 | catch (Exception $e) { |
| 248 | 254 | _egw_log_exception($e); |
@@ -339,7 +345,10 @@ discard block |
||
| 339 | 345 | function delete() |
| 340 | 346 | { |
| 341 | 347 | $this->cancel_periodic_job(); |
| 342 | - if ($this->status != admin_cmd::scheduled) return false; |
|
| 348 | + if ($this->status != admin_cmd::scheduled) |
|
| 349 | + { |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 343 | 352 | |
| 344 | 353 | $this->status = admin_cmd::deleted; |
| 345 | 354 | |
@@ -365,7 +374,10 @@ discard block |
||
| 365 | 374 | { |
| 366 | 375 | $this->modified = time(); |
| 367 | 376 | $this->modifier = $set_modifier ? $GLOBALS['egw_info']['user']['account_id'] : 0; |
| 368 | - if ($set_modifier) $this->modifier_email = admin_cmd::user_email(); |
|
| 377 | + if ($set_modifier) |
|
| 378 | + { |
|
| 379 | + $this->modifier_email = admin_cmd::user_email(); |
|
| 380 | + } |
|
| 369 | 381 | } |
| 370 | 382 | $vars = get_object_vars($this); // does not work in php5.1.2 due a bug |
| 371 | 383 | |
@@ -481,10 +493,13 @@ discard block |
||
| 481 | 493 | } |
| 482 | 494 | $cmd = new $class($data); |
| 483 | 495 | |
| 484 | - if ($cmd instanceof admin_cmd) // dont allow others classes to be executed that way! |
|
| 496 | + if ($cmd instanceof admin_cmd) |
|
| 497 | + { |
|
| 498 | + // dont allow others classes to be executed that way! |
|
| 485 | 499 | { |
| 486 | 500 | return $cmd; |
| 487 | 501 | } |
| 502 | + } |
|
| 488 | 503 | throw new Api\Exception\WrongParameter(lang('%1 is no command!',$class), 10); |
| 489 | 504 | } |
| 490 | 505 | |
@@ -521,7 +536,10 @@ discard block |
||
| 521 | 536 | |
| 522 | 537 | $total = admin_cmd::$sql->get_rows($query,$rows,$readonlys); |
| 523 | 538 | |
| 524 | - if (!$rows) return 0; |
|
| 539 | + if (!$rows) |
|
| 540 | + { |
|
| 541 | + return 0; |
|
| 542 | + } |
|
| 525 | 543 | |
| 526 | 544 | $async = new Api\Asyncservice(); |
| 527 | 545 | foreach($rows as &$row) |
@@ -746,7 +764,10 @@ discard block |
||
| 746 | 764 | } |
| 747 | 765 | } |
| 748 | 766 | unset($vars['data']); |
| 749 | - if ($this->data) $vars = array_merge($this->data,$vars); |
|
| 767 | + if ($this->data) |
|
| 768 | + { |
|
| 769 | + $vars = array_merge($this->data,$vars); |
|
| 770 | + } |
|
| 750 | 771 | |
| 751 | 772 | return $vars; |
| 752 | 773 | } |
@@ -765,10 +786,13 @@ discard block |
||
| 765 | 786 | admin_cmd::_instanciate_acl($this->creator); |
| 766 | 787 | // todo: check only if and with $this->creator |
| 767 | 788 | if (!admin_cmd::$acl->check('run',1,'admin') && // creator is no longer admin |
| 768 | - $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) // creator is explicitly forbidden to do something |
|
| 789 | + $extra_acl && $extra_deny && admin_cmd::$acl->check($extra_acl,$extra_deny,'admin')) |
|
| 790 | + { |
|
| 791 | + // creator is explicitly forbidden to do something |
|
| 769 | 792 | { |
| 770 | 793 | throw new Api\Exception\NoPermission\Admin(); |
| 771 | 794 | } |
| 795 | + } |
|
| 772 | 796 | } |
| 773 | 797 | } |
| 774 | 798 | |
@@ -785,11 +809,14 @@ discard block |
||
| 785 | 809 | { |
| 786 | 810 | if (!isset($GLOBALS['egw_info']['apps'][$name])) |
| 787 | 811 | { |
| 788 | - foreach($GLOBALS['egw_info']['apps'] as $app => $data) // check against title and localised name |
|
| 812 | + foreach($GLOBALS['egw_info']['apps'] as $app => $data) |
|
| 813 | + { |
|
| 814 | + // check against title and localised name |
|
| 789 | 815 | { |
| 790 | 816 | if (!strcasecmp($name,$data['title']) || !strcasecmp($name,lang($app))) |
| 791 | 817 | { |
| 792 | 818 | $apps[$key] = $name = $app; |
| 819 | + } |
|
| 793 | 820 | break; |
| 794 | 821 | } |
| 795 | 822 | } |
@@ -824,7 +851,11 @@ discard block |
||
| 824 | 851 | { |
| 825 | 852 | throw new Api\Exception\WrongUserinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')), 16); |
| 826 | 853 | } |
| 827 | - if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign |
|
| 854 | + if ($type == 2 && $id > 0) |
|
| 855 | + { |
|
| 856 | + $id = -$id; |
|
| 857 | + } |
|
| 858 | + // groups use negative id's internally, fix it, if user given the wrong sign |
|
| 828 | 859 | |
| 829 | 860 | return $id; |
| 830 | 861 | } |
@@ -840,7 +871,10 @@ discard block |
||
| 840 | 871 | */ |
| 841 | 872 | static function parse_accounts($accounts,$allow_only_user=null) |
| 842 | 873 | { |
| 843 | - if (!$accounts) return null; |
|
| 874 | + if (!$accounts) |
|
| 875 | + { |
|
| 876 | + return null; |
|
| 877 | + } |
|
| 844 | 878 | |
| 845 | 879 | $ids = array(); |
| 846 | 880 | foreach(is_array($accounts) ? $accounts : explode(',',$accounts) as $account) |
@@ -859,9 +893,12 @@ discard block |
||
| 859 | 893 | */ |
| 860 | 894 | static function parse_date($date) |
| 861 | 895 | { |
| 862 | - if (!is_numeric($date)) // we allow to input a timestamp |
|
| 896 | + if (!is_numeric($date)) |
|
| 897 | + { |
|
| 898 | + // we allow to input a timestamp |
|
| 863 | 899 | { |
| 864 | 900 | $datein = $date; |
| 901 | + } |
|
| 865 | 902 | // convert german DD.MM.YYYY format into ISO YYYY-MM-DD format |
| 866 | 903 | $date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/','\3-\2-\1',$date); |
| 867 | 904 | |
@@ -1019,10 +1056,13 @@ discard block |
||
| 1019 | 1056 | return false; // no schduled command, no need to setup the job |
| 1020 | 1057 | } |
| 1021 | 1058 | $next = $jobs[0]; |
| 1022 | - if (($time = $next['scheduled']) < time()) // should run immediatly |
|
| 1059 | + if (($time = $next['scheduled']) < time()) |
|
| 1060 | + { |
|
| 1061 | + // should run immediatly |
|
| 1023 | 1062 | { |
| 1024 | 1063 | return admin_cmd::run_queued_jobs(); |
| 1025 | 1064 | } |
| 1065 | + } |
|
| 1026 | 1066 | $async = new Api\Asyncservice(); |
| 1027 | 1067 | |
| 1028 | 1068 | // we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class! |
@@ -1080,7 +1120,10 @@ discard block |
||
| 1080 | 1120 | */ |
| 1081 | 1121 | public function set_periodic_job() |
| 1082 | 1122 | { |
| 1083 | - if (empty($this->rrule)) return false; |
|
| 1123 | + if (empty($this->rrule)) |
|
| 1124 | + { |
|
| 1125 | + return false; |
|
| 1126 | + } |
|
| 1084 | 1127 | |
| 1085 | 1128 | // parse rrule and calculate next execution time |
| 1086 | 1129 | $event = calendar_rrule::parseRrule($this->rrule, true); // true: allow HOURLY or MINUTELY |
@@ -1201,10 +1244,13 @@ discard block |
||
| 1201 | 1244 | { |
| 1202 | 1245 | admin_cmd::_instanciate_remote(); |
| 1203 | 1246 | |
| 1204 | - if ($data['install_id'] && $data['config_passwd']) // calculate hash |
|
| 1247 | + if ($data['install_id'] && $data['config_passwd']) |
|
| 1248 | + { |
|
| 1249 | + // calculate hash |
|
| 1205 | 1250 | { |
| 1206 | 1251 | $data['remote_hash'] = self::remote_hash($data['install_id'],$data['config_passwd']); |
| 1207 | 1252 | } |
| 1253 | + } |
|
| 1208 | 1254 | elseif (!$data['remote_hash'] && !($data['install_id'] && $data['config_passwd'])) |
| 1209 | 1255 | { |
| 1210 | 1256 | throw new Api\Exception\WrongUserinput(lang('Either Install ID AND config password needed OR the remote hash!')); |
@@ -1238,7 +1284,10 @@ discard block |
||
| 1238 | 1284 | { |
| 1239 | 1285 | throw new Api\Exception\WrongParameter(empty($config_passwd)?'Empty Api\Config password':'install_id no md5 hash'); |
| 1240 | 1286 | } |
| 1241 | - if (!self::is_md5($config_passwd)) $config_passwd = md5($config_passwd); |
|
| 1287 | + if (!self::is_md5($config_passwd)) |
|
| 1288 | + { |
|
| 1289 | + $config_passwd = md5($config_passwd); |
|
| 1290 | + } |
|
| 1242 | 1291 | |
| 1243 | 1292 | return md5($config_passwd.$install_id); |
| 1244 | 1293 | } |
@@ -1369,7 +1418,10 @@ discard block |
||
| 1369 | 1418 | { |
| 1370 | 1419 | // remember label from last description widget |
| 1371 | 1420 | case 'description': |
| 1372 | - if (!empty($widget->attrs['value'])) $label = $widget->attrs['value']; |
|
| 1421 | + if (!empty($widget->attrs['value'])) |
|
| 1422 | + { |
|
| 1423 | + $label = $widget->attrs['value']; |
|
| 1424 | + } |
|
| 1373 | 1425 | break; |
| 1374 | 1426 | // ignore non input-widgets |
| 1375 | 1427 | case 'hbox': case 'vbox': case 'box': case 'groupbox': |
@@ -1381,8 +1433,14 @@ discard block |
||
| 1381 | 1433 | default: |
| 1382 | 1434 | if (!empty($widget->id)) |
| 1383 | 1435 | { |
| 1384 | - if (!empty($widget->attrs['label'])) $label = $widget->attrs['label']; |
|
| 1385 | - if (!empty($label)) $labels[$widget->id] = $label; |
|
| 1436 | + if (!empty($widget->attrs['label'])) |
|
| 1437 | + { |
|
| 1438 | + $label = $widget->attrs['label']; |
|
| 1439 | + } |
|
| 1440 | + if (!empty($label)) |
|
| 1441 | + { |
|
| 1442 | + $labels[$widget->id] = $label; |
|
| 1443 | + } |
|
| 1386 | 1444 | $label = null; |
| 1387 | 1445 | } |
| 1388 | 1446 | break; |
@@ -1420,7 +1478,10 @@ discard block |
||
| 1420 | 1478 | case 'button': case 'buttononly': case 'taglist-thumbnail': |
| 1421 | 1479 | break; |
| 1422 | 1480 | case 'radio': |
| 1423 | - if (!is_array($widgets[$widget->id])) $widgets[$widget->id] = []; |
|
| 1481 | + if (!is_array($widgets[$widget->id])) |
|
| 1482 | + { |
|
| 1483 | + $widgets[$widget->id] = []; |
|
| 1484 | + } |
|
| 1424 | 1485 | $label = (string)$widget->attrs['label']; |
| 1425 | 1486 | // translate "{something} {else}" type options |
| 1426 | 1487 | if (strpos($label, '{') !== false) |
@@ -1434,7 +1495,10 @@ discard block |
||
| 1434 | 1495 | break; |
| 1435 | 1496 | // config templates have options in the template |
| 1436 | 1497 | case 'option': |
| 1437 | - if (!is_array($widgets[$last_select])) $widgets[$last_select] = []; |
|
| 1498 | + if (!is_array($widgets[$last_select])) |
|
| 1499 | + { |
|
| 1500 | + $widgets[$last_select] = []; |
|
| 1501 | + } |
|
| 1438 | 1502 | $label = (string)$widget->attrs['#text']; |
| 1439 | 1503 | // translate "{something} {else}" type options |
| 1440 | 1504 | if (strpos($label, '{') !== false) |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | ); |
| 16 | 16 | include('../header.inc.php'); |
| 17 | 17 | |
| 18 | -if ($GLOBALS['egw']->acl->check('info_access',1,'admin')) |
|
| 18 | +if ($GLOBALS['egw']->acl->check('info_access', 1, 'admin')) |
|
| 19 | 19 | { |
| 20 | 20 | $GLOBALS['egw']->redirect_link('/index.php'); |
| 21 | 21 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | if (isset($_GET['auth'])) |
| 36 | 36 | { |
| 37 | - list($_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']) = explode(':',base64_decode($_GET['auth']),2); |
|
| 37 | + list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode($_GET['auth']), 2); |
|
| 38 | 38 | } |
| 39 | 39 | return Api\Header\Authenticate::autocreate_session_callback($account); |
| 40 | 40 | } |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | 'noheader' => True, |
| 46 | 46 | 'currentapp' => preg_match('|/webdav.php/apps/([A-Za-z0-9_-]+)/|', $_SERVER['REQUEST_URI'], $matches) ? $matches[1] : 'filemanager', |
| 47 | 47 | 'autocreate_session_callback' => 'check_access', |
| 48 | - 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
| 49 | - 'auth_realm' => 'EGroupware WebDAV server', // cant use Vfs\WebDAV::REALM as autoloading and include path not yet setup! |
|
| 48 | + 'no_exception_handler' => 'basic_auth', // we use a basic auth exception handler (sends exception message as basic auth realm) |
|
| 49 | + 'auth_realm' => 'EGroupware WebDAV server', // cant use Vfs\WebDAV::REALM as autoloading and include path not yet setup! |
|
| 50 | 50 | ) |
| 51 | 51 | ); |
| 52 | 52 | |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | // temporary mount ownCloud default /clientsync as /home/$user, if not explicitly mounted |
| 76 | 76 | // so ownCloud dir contains users home-dir by default |
| 77 | -if (strpos($_SERVER['REQUEST_URI'],'/webdav.php/clientsync') !== false && |
|
| 78 | - ($fstab=Vfs::mount()) && !isset($fstab['/clientsync'])) |
|
| 77 | +if (strpos($_SERVER['REQUEST_URI'], '/webdav.php/clientsync') !== false && |
|
| 78 | + ($fstab = Vfs::mount()) && !isset($fstab['/clientsync'])) |
|
| 79 | 79 | { |
| 80 | 80 | $is_root_backup = Vfs::$is_root; |
| 81 | 81 | Vfs::$is_root = true; |
| 82 | - $ok = Vfs::mount($url='vfs://default/home/$user', $clientsync='/clientsync', null, false); |
|
| 82 | + $ok = Vfs::mount($url = 'vfs://default/home/$user', $clientsync = '/clientsync', null, false); |
|
| 83 | 83 | Vfs::$is_root = $is_root_backup; |
| 84 | 84 | //error_log("mounting ownCloud default '$clientsync' as '$url' ".($ok ? 'successful' : 'failed!')); |
| 85 | 85 | } |