@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | * @param array $_options options for specific backends |
| 34 | 34 | * @return bool |
| 35 | 35 | */ |
| 36 | - public function __construct( $_stream, array $_options ); |
|
| 36 | + public function __construct($_stream, array $_options); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * exports a record into resource of handle |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param object of interface egw_record _record |
| 42 | 42 | * @return bool |
| 43 | 43 | */ |
| 44 | - public function export_record( importexport_iface_egw_record $_record ); |
|
| 44 | + public function export_record(importexport_iface_egw_record $_record); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Retruns total number of exported records. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * @param array $_options options for specific backends |
| 28 | 28 | * @return bool |
| 29 | 29 | */ |
| 30 | - public function __construct( $_stream, array $_options ); |
|
| 30 | + public function __construct($_stream, array $_options); |
|
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * cleanup |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | * @param string _position may be: {first|last|next|previous|somenumber} |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - public function get_record( $_position = 'next' ); |
|
| 45 | + public function get_record($_position = 'next'); |
|
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | 48 | * Retruns total number of records for the open resource. |
@@ -30,39 +30,39 @@ discard block |
||
| 30 | 30 | * @param DOMElement $_node |
| 31 | 31 | * @return string XML string |
| 32 | 32 | */ |
| 33 | - public static function array2xml ( $_data, $_name = 'root', $_node=null ) {
|
|
| 33 | + public static function array2xml($_data, $_name = 'root', $_node = null) {
|
|
| 34 | 34 | $returnXML = false; |
| 35 | - if ( $_node === null ) {
|
|
| 36 | - $_node = new DOMDocument( '1.0', 'utf-8' ); |
|
| 35 | + if ($_node === null) {
|
|
| 36 | + $_node = new DOMDocument('1.0', 'utf-8');
|
|
| 37 | 37 | $_node->formatOutput = true; |
| 38 | 38 | $returnXML = true; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $datatype = gettype( $_data ); |
|
| 42 | - switch ( $datatype ) {
|
|
| 41 | + $datatype = gettype($_data); |
|
| 42 | + switch ($datatype) {
|
|
| 43 | 43 | case 'array' : |
| 44 | - $subnode = new DOMElement( 'entry' ); |
|
| 45 | - $_node->appendChild( $subnode ); |
|
| 46 | - $subnode->setAttribute( 'type', $datatype ); |
|
| 47 | - $subnode->setAttribute( 'name' , $_name ); |
|
| 44 | + $subnode = new DOMElement('entry');
|
|
| 45 | + $_node->appendChild($subnode); |
|
| 46 | + $subnode->setAttribute('type', $datatype);
|
|
| 47 | + $subnode->setAttribute('name', $_name);
|
|
| 48 | 48 | |
| 49 | - foreach ( $_data as $ikey => $ivalue ) {
|
|
| 50 | - self::array2xml( $ivalue, $ikey, $subnode ); |
|
| 49 | + foreach ($_data as $ikey => $ivalue) {
|
|
| 50 | + self::array2xml($ivalue, $ikey, $subnode); |
|
| 51 | 51 | } |
| 52 | 52 | break; |
| 53 | 53 | |
| 54 | 54 | default : |
| 55 | - switch ( $datatype ) {
|
|
| 55 | + switch ($datatype) {
|
|
| 56 | 56 | case 'boolean' : |
| 57 | 57 | $data = $_data !== false ? 'TRUE' : 'FALSE'; |
| 58 | 58 | break; |
| 59 | 59 | default: |
| 60 | 60 | $data = &$_data; |
| 61 | 61 | } |
| 62 | - $subnode = new DOMElement( 'entry' , $data ); |
|
| 63 | - $_node->appendChild( $subnode ); |
|
| 64 | - $subnode->setAttribute( 'type', $datatype ); |
|
| 65 | - $subnode->setAttribute( 'name' , $_name ); |
|
| 62 | + $subnode = new DOMElement('entry', $data);
|
|
| 63 | + $_node->appendChild($subnode); |
|
| 64 | + $subnode->setAttribute('type', $datatype);
|
|
| 65 | + $subnode->setAttribute('name', $_name);
|
|
| 66 | 66 | break; |
| 67 | 67 | } |
| 68 | 68 | return $returnXML ? $_node->saveXML() : ''; |
@@ -74,28 +74,28 @@ discard block |
||
| 74 | 74 | * @param string $_xml |
| 75 | 75 | * @return array |
| 76 | 76 | */ |
| 77 | - public static function xml2array( $_xml ) {
|
|
| 78 | - if ( $_xml instanceof DOMElement ) {
|
|
| 77 | + public static function xml2array($_xml) {
|
|
| 78 | + if ($_xml instanceof DOMElement) {
|
|
| 79 | 79 | $n = &$_xml; |
| 80 | 80 | } else {
|
| 81 | 81 | $n = new DOMDocument; |
| 82 | 82 | $loaded = $n->loadXML($_xml); |
| 83 | - if(!$loaded) return array(); |
|
| 83 | + if (!$loaded) return array(); |
|
| 84 | 84 | } |
| 85 | 85 | $xml_array = array(); |
| 86 | 86 | |
| 87 | - foreach($n->childNodes as $nc) {
|
|
| 87 | + foreach ($n->childNodes as $nc) {
|
|
| 88 | 88 | |
| 89 | - if ( $nc->nodeType != XML_ELEMENT_NODE ) continue; |
|
| 89 | + if ($nc->nodeType != XML_ELEMENT_NODE) continue; |
|
| 90 | 90 | |
| 91 | 91 | $name = $nc->attributes->getNamedItem('name')->nodeValue;
|
| 92 | 92 | $type = $nc->attributes->getNamedItem('type')->nodeValue;
|
| 93 | 93 | |
| 94 | 94 | //echo $nc->nodeType. "(length ): ". $nc->nodeName. " => ". $nc->nodeValue. "; Attriubtes: name=$name, type=$type \n "; |
| 95 | - if( $nc->childNodes->length >= 2) {
|
|
| 95 | + if ($nc->childNodes->length >= 2) {
|
|
| 96 | 96 | $xml_array[$name] = self::xml2array($nc); |
| 97 | 97 | } else {
|
| 98 | - switch ( $type ) {
|
|
| 98 | + switch ($type) {
|
|
| 99 | 99 | case 'boolean' : |
| 100 | 100 | $value = $nc->nodeValue == 'FALSE' ? false : true; |
| 101 | 101 | break; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @param string $_identifier |
| 38 | 38 | */ |
| 39 | - public function __construct( $_identifier='' ); |
|
| 39 | + public function __construct($_identifier = ''); |
|
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | 42 | * magic method to set attributes of record |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return string identifier |
| 99 | 99 | */ |
| 100 | - public function save ( $_dst_identifier ); |
|
| 100 | + public function save($_dst_identifier); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * copys current record to record identified by $_dst_identifier |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | * @param string $_dst_identifier |
| 106 | 106 | * @return string dst_identifier |
| 107 | 107 | */ |
| 108 | - public function copy ( $_dst_identifier ); |
|
| 108 | + public function copy($_dst_identifier); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * moves current record to record identified by $_dst_identifier |
@@ -114,14 +114,14 @@ discard block |
||
| 114 | 114 | * @param string $_dst_identifier |
| 115 | 115 | * @return string dst_identifier |
| 116 | 116 | */ |
| 117 | - public function move ( $_dst_identifier ); |
|
| 117 | + public function move($_dst_identifier); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * delets current record from backend |
| 121 | 121 | * @return void |
| 122 | 122 | * |
| 123 | 123 | */ |
| 124 | - public function delete (); |
|
| 124 | + public function delete(); |
|
| 125 | 125 | |
| 126 | 126 | /** |
| 127 | 127 | * destructor |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'wizard_step80' => lang('Filters'), |
| 65 | 65 | ); |
| 66 | 66 | list($appname, $part2) = explode('_', get_class($this)); |
| 67 | - if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= '_'.$part2; // Handle apps with _ in the name |
|
| 67 | + if (!$GLOBALS['egw_info']['apps'][$appname]) $appname .= '_'.$part2; // Handle apps with _ in the name |
|
| 68 | 68 | Api\Translation::add_app($appname); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,14 +73,14 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv) |
| 75 | 75 | { |
| 76 | - if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true)); |
|
| 76 | + if ($this->debug) error_log(get_class($this).'::wizard_step30->$content '.print_r($content, true)); |
|
| 77 | 77 | // return from step30 |
| 78 | 78 | if ($content['step'] == 'wizard_step30') |
| 79 | 79 | { |
| 80 | - foreach($content['fields']['export'] as $field_name) |
|
| 80 | + foreach ($content['fields']['export'] as $field_name) |
|
| 81 | 81 | { |
| 82 | 82 | // Preserve original field names, where available |
| 83 | - if($content['plugin_options']['no_header_translation'] && $content['plugin_options']['mapping'][$field_name]) |
|
| 83 | + if ($content['plugin_options']['no_header_translation'] && $content['plugin_options']['mapping'][$field_name]) |
|
| 84 | 84 | { |
| 85 | 85 | $content['mapping'][$field_name] = $content['plugin_options']['mapping'][$field_name]; |
| 86 | 86 | } |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | $content['mapping'][$field_name] = $field_name; |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | - if($content['mapping']['all_custom_fields']) { |
|
| 92 | + if ($content['mapping']['all_custom_fields']) { |
|
| 93 | 93 | // Need the appname during actual export, to fetch the fields |
| 94 | 94 | $parts = explode('_', get_class($this)); |
| 95 | 95 | $appname = $parts[0]; |
| 96 | - foreach($parts as $name_part) { |
|
| 97 | - if($GLOBALS['egw_info']['apps'][$appname]) break; |
|
| 96 | + foreach ($parts as $name_part) { |
|
| 97 | + if ($GLOBALS['egw_info']['apps'][$appname]) break; |
|
| 98 | 98 | $appname .= '_'.$name_part; // Handle apps with _ in the name |
| 99 | 99 | } |
| 100 | 100 | $content['mapping']['all_custom_fields'] = $appname; |
@@ -105,13 +105,13 @@ discard block |
||
| 105 | 105 | switch (array_search('pressed', $content['button'])) |
| 106 | 106 | { |
| 107 | 107 | case 'next': |
| 108 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
| 108 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
| 109 | 109 | case 'previous' : |
| 110 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
| 110 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
| 111 | 111 | case 'finish': |
| 112 | 112 | return 'wizard_finish'; |
| 113 | 113 | default : |
| 114 | - return $this->wizard_step30($content,$sel_options,$readonlys,$preserv); |
|
| 114 | + return $this->wizard_step30($content, $sel_options, $readonlys, $preserv); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | // init step30 |
@@ -125,15 +125,15 @@ discard block |
||
| 125 | 125 | unset ($preserv['button']); |
| 126 | 126 | unset ($preserv['fields']); |
| 127 | 127 | $content['fields'] = array(''); |
| 128 | - if(!$content['mapping']) $content['mapping'] = $content['plugin_options']['mapping']; |
|
| 128 | + if (!$content['mapping']) $content['mapping'] = $content['plugin_options']['mapping']; |
|
| 129 | 129 | |
| 130 | 130 | $row = 1; |
| 131 | - foreach($this->export_fields as $field => $name) { |
|
| 131 | + foreach ($this->export_fields as $field => $name) { |
|
| 132 | 132 | $content['fields'][] = array( |
| 133 | 133 | 'field' => $field, |
| 134 | 134 | 'name' => lang($name), |
| 135 | 135 | ); |
| 136 | - if($content['mapping'][$field]) { |
|
| 136 | + if ($content['mapping'][$field]) { |
|
| 137 | 137 | $content['fields']['export'][$row] = $field; |
| 138 | 138 | } |
| 139 | 139 | $row++; |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv) |
| 157 | 157 | { |
| 158 | - if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true)); |
|
| 158 | + if ($this->debug) error_log(get_class($this).'::wizard_step40->$content '.print_r($content, true)); |
|
| 159 | 159 | // return from step40 |
| 160 | 160 | if ($content['step'] == 'wizard_step40') { |
| 161 | - if($content['begin_with_fieldnames'] == 'label') { |
|
| 162 | - foreach($content['mapping'] as $field => &$label) { |
|
| 161 | + if ($content['begin_with_fieldnames'] == 'label') { |
|
| 162 | + foreach ($content['mapping'] as $field => &$label) { |
|
| 163 | 163 | // Check first, to avoid clearing any pseudo-columns (ex: All custom fields) |
| 164 | 164 | $label = $this->export_fields[$field] ? $this->export_fields[$field] : $label; |
| 165 | 165 | } |
@@ -167,13 +167,13 @@ discard block |
||
| 167 | 167 | switch (array_search('pressed', $content['button'])) |
| 168 | 168 | { |
| 169 | 169 | case 'next': |
| 170 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
| 170 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
| 171 | 171 | case 'previous' : |
| 172 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
| 172 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
| 173 | 173 | case 'finish': |
| 174 | 174 | return 'wizard_finish'; |
| 175 | 175 | default : |
| 176 | - return $this->wizard_step40($content,$sel_options,$readonlys,$preserv); |
|
| 176 | + return $this->wizard_step40($content, $sel_options, $readonlys, $preserv); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | // init step40 |
@@ -183,18 +183,18 @@ discard block |
||
| 183 | 183 | $content['step'] = 'wizard_step40'; |
| 184 | 184 | |
| 185 | 185 | // If editing an existing definition, these will be in plugin_options |
| 186 | - if(!$content['delimiter'] && $content['plugin_options']['delimiter']) { |
|
| 186 | + if (!$content['delimiter'] && $content['plugin_options']['delimiter']) { |
|
| 187 | 187 | $content['delimiter'] = $content['plugin_options']['delimiter']; |
| 188 | 188 | } elseif (!$content['delimiter']) { |
| 189 | 189 | $content['delimiter'] = ';'; |
| 190 | 190 | } |
| 191 | - if(!$content['charset'] && $content['plugin_options']['charset']) { |
|
| 191 | + if (!$content['charset'] && $content['plugin_options']['charset']) { |
|
| 192 | 192 | $content['charset'] = $content['plugin_options']['charset'] ? $content['plugin_options']['charset'] : 'user'; |
| 193 | 193 | } |
| 194 | - if(!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) { |
|
| 194 | + if (!array_key_exists('begin_with_fieldnames', $content) && array_key_exists('begin_with_fieldnames', $content['plugin_options'])) { |
|
| 195 | 195 | $content['begin_with_fieldnames'] = $content['plugin_options']['begin_with_fieldnames']; |
| 196 | 196 | } |
| 197 | - if(!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) { |
|
| 197 | + if (!array_key_exists('convert', $content) && array_key_exists('convert', $content['plugin_options'])) { |
|
| 198 | 198 | $content['convert'] = $content['plugin_options']['convert']; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -204,17 +204,17 @@ discard block |
||
| 204 | 204 | 1 => lang('Field names'), |
| 205 | 205 | 'label' => lang('Field labels') |
| 206 | 206 | ); |
| 207 | - $sel_options['charset'] = Api\Translation::get_installed_charsets()+ |
|
| 207 | + $sel_options['charset'] = Api\Translation::get_installed_charsets() + |
|
| 208 | 208 | array( |
| 209 | 209 | 'user' => lang('User preference'), |
| 210 | 210 | ); |
| 211 | 211 | |
| 212 | 212 | // Add in extra allowed charsets |
| 213 | 213 | $config = Api\Config::read('importexport'); |
| 214 | - $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings()); |
|
| 215 | - if($extra_charsets) |
|
| 214 | + $extra_charsets = array_intersect(explode(',', $config['import_charsets']), mb_list_encodings()); |
|
| 215 | + if ($extra_charsets) |
|
| 216 | 216 | { |
| 217 | - $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets)); |
|
| 217 | + $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets, $extra_charsets)); |
|
| 218 | 218 | } |
| 219 | 219 | $sel_options['convert'] = array( |
| 220 | 220 | 0 => lang('Database values'), |
@@ -238,15 +238,15 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | function wizard_step80(&$content, &$sel_options, &$readonlys, &$preserv) |
| 240 | 240 | { |
| 241 | - if($this->debug) error_log(get_class($this) . '::' . __METHOD__ .'->$content '.print_r($content,true)); |
|
| 241 | + if ($this->debug) error_log(get_class($this).'::'.__METHOD__.'->$content '.print_r($content, true)); |
|
| 242 | 242 | // return from submit |
| 243 | 243 | if ($content['step'] == 'wizard_step80') { |
| 244 | 244 | // Process submitted |
| 245 | 245 | unset($content['filter']); |
| 246 | 246 | unset($content['set_filter']['fields']); |
| 247 | - foreach($content['set_filter'] as $key => $value) |
|
| 247 | + foreach ($content['set_filter'] as $key => $value) |
|
| 248 | 248 | { |
| 249 | - if($value) { |
|
| 249 | + if ($value) { |
|
| 250 | 250 | $content['filter'][$key] = $value; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | switch (array_search('pressed', $content['button'])) |
| 257 | 257 | { |
| 258 | 258 | case 'next': |
| 259 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
| 259 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
| 260 | 260 | case 'previous' : |
| 261 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
| 261 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
| 262 | 262 | case 'finish': |
| 263 | 263 | return 'wizard_finish'; |
| 264 | 264 | default : |
| 265 | - return $this->wizard_step80($content,$sel_options,$readonlys,$preserv); |
|
| 265 | + return $this->wizard_step80($content, $sel_options, $readonlys, $preserv); |
|
| 266 | 266 | } |
| 267 | 267 | } else { |
| 268 | 268 | |
@@ -273,15 +273,15 @@ discard block |
||
| 273 | 273 | unset ($preserv['button']); |
| 274 | 274 | |
| 275 | 275 | $content['set_filter']['fields'] = importexport_helper_functions::get_filter_fields( |
| 276 | - $content['application'],$content['plugin'],$this |
|
| 276 | + $content['application'], $content['plugin'], $this |
|
| 277 | 277 | ); |
| 278 | 278 | // Load existing filter from either content or definition |
| 279 | - foreach($content['set_filter']['fields'] as $field => $settings) |
|
| 279 | + foreach ($content['set_filter']['fields'] as $field => $settings) |
|
| 280 | 280 | { |
| 281 | 281 | $content['set_filter'][$field] = $content['filter'][$field]; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if(!$content['set_filter']['fields']) |
|
| 284 | + if (!$content['set_filter']['fields']) |
|
| 285 | 285 | { |
| 286 | 286 | // No fields |
| 287 | 287 | return importexport_definitions_ui::SKIP; |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | var $public_functions = array('index' => True); |
| 22 | 22 | |
| 23 | - function index($params=null) |
|
| 23 | + function index($params = null) |
|
| 24 | 24 | { |
| 25 | 25 | // if we have a xet file, run new et2 config |
| 26 | 26 | if (file_exists(EGW_SERVER_ROOT.'/'.$_GET['appname'].'/templates/default/config.xet')) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | //_debug_array($params); |
| 47 | 47 | $_appname = $_GET['appname']; |
| 48 | 48 | } |
| 49 | - if ($GLOBALS['egw']->acl->check('site_config_acce',1,'admin')) |
|
| 49 | + if ($GLOBALS['egw']->acl->check('site_config_acce', 1, 'admin')) |
|
| 50 | 50 | { |
| 51 | 51 | Egw::redirect_link('/index.php'); |
| 52 | 52 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | Api\Translation::add_app($_appname); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if(get_magic_quotes_gpc() && is_array($_POST['newsettings'])) |
|
| 60 | + if (get_magic_quotes_gpc() && is_array($_POST['newsettings'])) |
|
| 61 | 61 | { |
| 62 | 62 | $_POST['newsettings'] = array_stripslashes($_POST['newsettings']); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - switch($_appname) |
|
| 65 | + switch ($_appname) |
|
| 66 | 66 | { |
| 67 | 67 | case 'admin': |
| 68 | 68 | case 'addressbook': |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $t = new Framework\Template(Framework\Template::get_dir($appname)); |
| 90 | 90 | $t->set_unknowns('keep'); |
| 91 | 91 | $t->set_file(array('config' => 'config.tpl')); |
| 92 | - $t->set_block('config','header','header'); |
|
| 92 | + $t->set_block('config', 'header', 'header'); |
|
| 93 | 93 | |
| 94 | 94 | // fix header templates missing essential parts like display of validation errors |
| 95 | 95 | $header = $t->get_var('header'); |
@@ -107,15 +107,15 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | $t->set_var('header', $header); |
| 109 | 109 | |
| 110 | - $t->set_block('config','body','body'); |
|
| 111 | - $t->set_block('config','footer','footer'); |
|
| 110 | + $t->set_block('config', 'body', 'body'); |
|
| 111 | + $t->set_block('config', 'footer', 'footer'); |
|
| 112 | 112 | |
| 113 | 113 | // fix footer submit buttons to just {submit} {cancel} |
| 114 | 114 | $t->set_var('footer', preg_replace('/<input[^>]+value="{lang_(submit|cancel)}"[^>]*>/', '{$1}', $t->get_var('footer'))); |
| 115 | 115 | |
| 116 | 116 | $c = new Api\Config($config_appname); |
| 117 | 117 | $c->read_repository(); |
| 118 | - if ($_POST['cancel'] || ($_POST['submit'] || $_POST['save'] || $_POST['apply']) && $GLOBALS['egw']->acl->check('site_config_acce',2,'admin')) |
|
| 118 | + if ($_POST['cancel'] || ($_POST['submit'] || $_POST['save'] || $_POST['apply']) && $GLOBALS['egw']->acl->check('site_config_acce', 2, 'admin')) |
|
| 119 | 119 | { |
| 120 | 120 | Egw::redirect_link('/admin/index.php?ajax=true'); |
| 121 | 121 | } |
@@ -123,9 +123,9 @@ discard block |
||
| 123 | 123 | if ($_POST['submit'] || $_POST['save'] || $_POST['apply']) |
| 124 | 124 | { |
| 125 | 125 | /* Load hook file with functions to validate each Api\Config (one/none/all) */ |
| 126 | - Api\Hooks::single('config_validate',$appname); |
|
| 126 | + Api\Hooks::single('config_validate', $appname); |
|
| 127 | 127 | |
| 128 | - foreach($_POST['newsettings'] as $key => $config) |
|
| 128 | + foreach ($_POST['newsettings'] as $key => $config) |
|
| 129 | 129 | { |
| 130 | 130 | if ($config) |
| 131 | 131 | { |
@@ -133,26 +133,26 @@ discard block |
||
| 133 | 133 | if (in_array($key, (array)$GLOBALS['egw_info']['server']['found_validation_hook'], true) && function_exists($key)) |
| 134 | 134 | { |
| 135 | 135 | call_user_func($key, $config, $c); |
| 136 | - if($GLOBALS['config_error']) |
|
| 136 | + if ($GLOBALS['config_error']) |
|
| 137 | 137 | { |
| 138 | - $errors .= lang($GLOBALS['config_error']) . "\n"; |
|
| 138 | + $errors .= lang($GLOBALS['config_error'])."\n"; |
|
| 139 | 139 | $GLOBALS['config_error'] = False; |
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | /* don't erase passwords, since we also don't print them */ |
| 144 | - elseif(strpos($key,'passwd') === false && strpos($key,'password') === false && strpos($key,'root_pw') === false) |
|
| 144 | + elseif (strpos($key, 'passwd') === false && strpos($key, 'password') === false && strpos($key, 'root_pw') === false) |
|
| 145 | 145 | { |
| 146 | 146 | unset($c->config_data[$key]); |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | - if(in_array('final_validation', (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && |
|
| 149 | + if (in_array('final_validation', (array)$GLOBALS['egw_info']['server']['found_validation_hook']) && |
|
| 150 | 150 | function_exists('final_validation')) |
| 151 | 151 | { |
| 152 | 152 | final_validation($_POST['newsettings']); |
| 153 | - if($GLOBALS['config_error']) |
|
| 153 | + if ($GLOBALS['config_error']) |
|
| 154 | 154 | { |
| 155 | - $errors .= lang($GLOBALS['config_error']) . "\n"; |
|
| 155 | + $errors .= lang($GLOBALS['config_error'])."\n"; |
|
| 156 | 156 | $GLOBALS['config_error'] = False; |
| 157 | 157 | } |
| 158 | 158 | unset($GLOBALS['egw_info']['server']['found_validation_hook']); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $c->save_repository(); |
| 162 | 162 | |
| 163 | - if(!$errors && !$_POST['apply']) |
|
| 163 | + if (!$errors && !$_POST['apply']) |
|
| 164 | 164 | { |
| 165 | 165 | Framework::message(lang('Configuration saved.'), 'success'); |
| 166 | 166 | Egw::redirect_link('/index.php', array( |
@@ -170,10 +170,10 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $t->set_var('error',''); |
|
| 174 | - if($errors) |
|
| 173 | + $t->set_var('error', ''); |
|
| 174 | + if ($errors) |
|
| 175 | 175 | { |
| 176 | - Framework::message(lang('Error') . ': ' . $errors, 'error'); |
|
| 176 | + Framework::message(lang('Error').': '.$errors, 'error'); |
|
| 177 | 177 | unset($errors); |
| 178 | 178 | unset($GLOBALS['config_error']); |
| 179 | 179 | } |
@@ -181,41 +181,41 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | Framework::message(lang('Configuration saved.'), 'success'); |
| 183 | 183 | } |
| 184 | - $t->set_var('title',lang('Site Configuration')); |
|
| 185 | - $t->set_var('action_url',$GLOBALS['egw']->link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname)); |
|
| 186 | - $t->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']); |
|
| 187 | - $t->set_var('th_text', $GLOBALS['egw_info']['theme']['th_text']); |
|
| 188 | - $t->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']); |
|
| 189 | - $t->set_var('row_off', $GLOBALS['egw_info']['theme']['row_off']); |
|
| 184 | + $t->set_var('title', lang('Site Configuration')); |
|
| 185 | + $t->set_var('action_url', $GLOBALS['egw']->link('/index.php', 'menuaction=admin.uiconfig.index&appname='.$appname)); |
|
| 186 | + $t->set_var('th_bg', $GLOBALS['egw_info']['theme']['th_bg']); |
|
| 187 | + $t->set_var('th_text', $GLOBALS['egw_info']['theme']['th_text']); |
|
| 188 | + $t->set_var('row_on', $GLOBALS['egw_info']['theme']['row_on']); |
|
| 189 | + $t->set_var('row_off', $GLOBALS['egw_info']['theme']['row_off']); |
|
| 190 | 190 | $t->set_var('hidden_vars', Api\Html::input_hidden('csrf_token', Api\Csrf::token(__CLASS__))); |
| 191 | 191 | |
| 192 | 192 | $vars = $t->get_undefined('body'); |
| 193 | 193 | |
| 194 | - if (Api\Hooks::single('config',$appname)) // reload the config-values, they might have changed |
|
| 194 | + if (Api\Hooks::single('config', $appname)) // reload the config-values, they might have changed |
|
| 195 | 195 | { |
| 196 | 196 | $c->read_repository(); |
| 197 | 197 | } |
| 198 | - foreach($vars as $value) |
|
| 198 | + foreach ($vars as $value) |
|
| 199 | 199 | { |
| 200 | - $valarray = explode('_',$value); |
|
| 200 | + $valarray = explode('_', $value); |
|
| 201 | 201 | $type = array_shift($valarray); |
| 202 | - $newval = implode(' ',$valarray); |
|
| 202 | + $newval = implode(' ', $valarray); |
|
| 203 | 203 | |
| 204 | 204 | switch ($type) |
| 205 | 205 | { |
| 206 | 206 | case 'lang': |
| 207 | - $t->set_var($value,lang($newval)); |
|
| 207 | + $t->set_var($value, lang($newval)); |
|
| 208 | 208 | break; |
| 209 | 209 | case 'value': |
| 210 | - $newval = str_replace(' ','_',$newval); |
|
| 210 | + $newval = str_replace(' ', '_', $newval); |
|
| 211 | 211 | /* Don't show passwords in the form */ |
| 212 | - if(strpos($value,'passwd') !== false || strpos($value,'password') !== false || strpos($value,'root_pw') !== false) |
|
| 212 | + if (strpos($value, 'passwd') !== false || strpos($value, 'password') !== false || strpos($value, 'root_pw') !== false) |
|
| 213 | 213 | { |
| 214 | - $t->set_var($value,''); |
|
| 214 | + $t->set_var($value, ''); |
|
| 215 | 215 | } |
| 216 | 216 | else |
| 217 | 217 | { |
| 218 | - $t->set_var($value,$c->config_data[$newval]); |
|
| 218 | + $t->set_var($value, $c->config_data[$newval]); |
|
| 219 | 219 | } |
| 220 | 220 | break; |
| 221 | 221 | /* |
@@ -233,46 +233,45 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | case 'selected': |
| 235 | 235 | $configs = array(); |
| 236 | - $newvals = explode(' ',$newval); |
|
| 236 | + $newvals = explode(' ', $newval); |
|
| 237 | 237 | $setting = end($newvals); |
| 238 | - for ($i=0;$i<(count($newvals) - 1); $i++) |
|
| 238 | + for ($i = 0; $i < (count($newvals) - 1); $i++) |
|
| 239 | 239 | { |
| 240 | 240 | $configs[] = $newvals[$i]; |
| 241 | 241 | } |
| 242 | - $config = implode('_',$configs); |
|
| 242 | + $config = implode('_', $configs); |
|
| 243 | 243 | /* echo $config . '=' . $c->config_data[$config]; */ |
| 244 | 244 | if ($c->config_data[$config] == $setting) |
| 245 | 245 | { |
| 246 | - $t->set_var($value,' selected'); |
|
| 246 | + $t->set_var($value, ' selected'); |
|
| 247 | 247 | } |
| 248 | 248 | else |
| 249 | 249 | { |
| 250 | - $t->set_var($value,''); |
|
| 250 | + $t->set_var($value, ''); |
|
| 251 | 251 | } |
| 252 | 252 | break; |
| 253 | 253 | case 'hook': |
| 254 | - $newval = str_replace(' ','_',$newval); |
|
| 255 | - if(function_exists($newval)) |
|
| 254 | + $newval = str_replace(' ', '_', $newval); |
|
| 255 | + if (function_exists($newval)) |
|
| 256 | 256 | { |
| 257 | - $t->set_var($value,$newval($c->config_data)); |
|
| 257 | + $t->set_var($value, $newval($c->config_data)); |
|
| 258 | 258 | } |
| 259 | 259 | else |
| 260 | 260 | { |
| 261 | - $t->set_var($value,''); |
|
| 261 | + $t->set_var($value, ''); |
|
| 262 | 262 | } |
| 263 | 263 | break; |
| 264 | 264 | case 'call': // eg. call_class::method or call_app.class.method |
| 265 | - $newval = str_replace(' ','_',$newval); |
|
| 266 | - $t->set_var($value,ExecMethod($newval,$c->config_data)); |
|
| 265 | + $newval = str_replace(' ', '_', $newval); |
|
| 266 | + $t->set_var($value, ExecMethod($newval, $c->config_data)); |
|
| 267 | 267 | break; |
| 268 | 268 | default: |
| 269 | - $t->set_var($value,''); |
|
| 269 | + $t->set_var($value, ''); |
|
| 270 | 270 | break; |
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | $t->set_var('submit', '<div class="dialogFooterToolbar" style="text-align: left">'. |
| 274 | - ($GLOBALS['egw']->acl->check('site_config_acce',2,'admin') ? '' : |
|
| 275 | - Api\Html::submit_button('save', 'Save')."\n". |
|
| 274 | + ($GLOBALS['egw']->acl->check('site_config_acce', 2, 'admin') ? '' : Api\Html::submit_button('save', 'Save')."\n". |
|
| 276 | 275 | Api\Html::submit_button('apply', 'Apply'))); |
| 277 | 276 | $t->set_var('cancel', Api\Html::submit_button('cancel', 'Cancel').'</div>'); |
| 278 | 277 | |
@@ -282,10 +281,10 @@ discard block |
||
| 282 | 281 | // render the page |
| 283 | 282 | $GLOBALS['egw']->framework->render( |
| 284 | 283 | '<div id="admin-config-'.$appname.'" class="admin-config">'. |
| 285 | - $t->parse('out','header'). |
|
| 286 | - $t->fp('out','body'). |
|
| 287 | - $t->fp('out','footer').'</div>', |
|
| 288 | - null,true |
|
| 284 | + $t->parse('out', 'header'). |
|
| 285 | + $t->fp('out', 'body'). |
|
| 286 | + $t->fp('out', 'footer').'</div>', |
|
| 287 | + null, true |
|
| 289 | 288 | ); |
| 290 | 289 | } |
| 291 | 290 | } |
@@ -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); |
@@ -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 | } |
@@ -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 | |