@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | if (!extension_loaded('dom')) |
13 | 13 | { |
14 | 14 | echo "<p>Required PHP DOM extension missing, installation of ImportExport definitions aborted.</p>\n"; |
15 | - return; // otherwise we mess up the whole eGroupware install process |
|
15 | + return; // otherwise we mess up the whole eGroupware install process |
|
16 | 16 | } |
17 | -require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
17 | +require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
18 | 18 | |
19 | 19 | // This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db |
20 | 20 | $GLOBALS['egw_setup']->setup_account_object(); |
@@ -22,22 +22,22 @@ discard block |
||
22 | 22 | // step through every source code intstalled app |
23 | 23 | $egwdir = dir(EGW_INCLUDE_ROOT); |
24 | 24 | while (false !== ($appdir = $egwdir->read())) { |
25 | - $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
|
26 | - if ( !is_dir( $defdir ) ) continue; |
|
25 | + $defdir = EGW_INCLUDE_ROOT."/$appdir/setup/"; |
|
26 | + if (!is_dir($defdir)) continue; |
|
27 | 27 | |
28 | 28 | // step through each file in defdir of app |
29 | 29 | $d = dir($defdir); |
30 | 30 | while (false !== ($entry = $d->read())) { |
31 | - $file = $defdir. '/'. $entry; |
|
32 | - list( $filename, $extension) = explode('.',$entry); |
|
33 | - if ( $extension != 'xml' ) continue; |
|
34 | - importexport_definitions_bo::import( $file ); |
|
31 | + $file = $defdir.'/'.$entry; |
|
32 | + list($filename, $extension) = explode('.', $entry); |
|
33 | + if ($extension != 'xml') continue; |
|
34 | + importexport_definitions_bo::import($file); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | 38 | // give Default and Admins group rights for ImportExport |
39 | -foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name) |
|
39 | +foreach (array('Default' => 'Default', 'Admins' => 'Admin') as $account_lid => $name) |
|
40 | 40 | { |
41 | - $account_id = $GLOBALS['egw_setup']->add_account($account_lid,$name,'Group',False,False); |
|
42 | - $GLOBALS['egw_setup']->add_acl('importexport','run',$account_id); |
|
41 | + $account_id = $GLOBALS['egw_setup']->add_account($account_lid, $name, 'Group', False, False); |
|
42 | + $GLOBALS['egw_setup']->add_acl('importexport', 'run', $account_id); |
|
43 | 43 | } |
@@ -21,16 +21,24 @@ |
||
21 | 21 | |
22 | 22 | // step through every source code intstalled app |
23 | 23 | $egwdir = dir(EGW_INCLUDE_ROOT); |
24 | -while (false !== ($appdir = $egwdir->read())) { |
|
24 | +while (false !== ($appdir = $egwdir->read())) |
|
25 | +{ |
|
25 | 26 | $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
26 | - if ( !is_dir( $defdir ) ) continue; |
|
27 | + if ( !is_dir( $defdir ) ) |
|
28 | + { |
|
29 | + continue; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | // step through each file in defdir of app |
29 | 33 | $d = dir($defdir); |
30 | - while (false !== ($entry = $d->read())) { |
|
34 | + while (false !== ($entry = $d->read())) |
|
35 | + { |
|
31 | 36 | $file = $defdir. '/'. $entry; |
32 | 37 | list( $filename, $extension) = explode('.',$entry); |
33 | - if ( $extension != 'xml' ) continue; |
|
38 | + if ( $extension != 'xml' ) |
|
39 | + { |
|
40 | + continue; |
|
41 | + } |
|
34 | 42 | importexport_definitions_bo::import( $file ); |
35 | 43 | } |
36 | 44 | } |
@@ -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. |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * cleanup |
34 | 34 | * |
35 | 35 | * @return |
36 | - */ |
|
36 | + void |
|
37 | 37 | public function __destruct( ); |
38 | 38 | |
39 | 39 | /** |
@@ -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; |
@@ -20,7 +20,8 @@ discard block |
||
20 | 20 | * @todo deal with other types like objects |
21 | 21 | * @static only namespace here |
22 | 22 | */ |
23 | -class importexport_arrayxml { |
|
23 | +class importexport_arrayxml |
|
24 | +{ |
|
24 | 25 | |
25 | 26 | /** |
26 | 27 | * converts a php array to an xml string |
@@ -30,29 +31,34 @@ discard block |
||
30 | 31 | * @param DOMElement $_node |
31 | 32 | * @return string XML string |
32 | 33 | */ |
33 | - public static function array2xml ( $_data, $_name = 'root', $_node=null ) { |
|
34 | + public static function array2xml ( $_data, $_name = 'root', $_node=null ) |
|
35 | + { |
|
34 | 36 | $returnXML = false; |
35 | - if ( $_node === null ) { |
|
37 | + if ( $_node === null ) |
|
38 | + { |
|
36 | 39 | $_node = new DOMDocument( '1.0', 'utf-8' ); |
37 | 40 | $_node->formatOutput = true; |
38 | 41 | $returnXML = true; |
39 | 42 | } |
40 | 43 | |
41 | 44 | $datatype = gettype( $_data ); |
42 | - switch ( $datatype ) { |
|
45 | + switch ( $datatype ) |
|
46 | + { |
|
43 | 47 | case 'array' : |
44 | 48 | $subnode = new DOMElement( 'entry' ); |
45 | 49 | $_node->appendChild( $subnode ); |
46 | 50 | $subnode->setAttribute( 'type', $datatype ); |
47 | 51 | $subnode->setAttribute( 'name' , $_name ); |
48 | 52 | |
49 | - foreach ( $_data as $ikey => $ivalue ) { |
|
53 | + foreach ( $_data as $ikey => $ivalue ) |
|
54 | + { |
|
50 | 55 | self::array2xml( $ivalue, $ikey, $subnode ); |
51 | 56 | } |
52 | 57 | break; |
53 | 58 | |
54 | 59 | default : |
55 | - switch ( $datatype ) { |
|
60 | + switch ( $datatype ) |
|
61 | + { |
|
56 | 62 | case 'boolean' : |
57 | 63 | $data = $_data !== false ? 'TRUE' : 'FALSE'; |
58 | 64 | break; |
@@ -74,28 +80,43 @@ discard block |
||
74 | 80 | * @param string $_xml |
75 | 81 | * @return array |
76 | 82 | */ |
77 | - public static function xml2array( $_xml ) { |
|
78 | - if ( $_xml instanceof DOMElement ) { |
|
83 | + public static function xml2array( $_xml ) |
|
84 | + { |
|
85 | + if ( $_xml instanceof DOMElement ) |
|
86 | + { |
|
79 | 87 | $n = &$_xml; |
80 | - } else { |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
81 | 91 | $n = new DOMDocument; |
82 | 92 | $loaded = $n->loadXML($_xml); |
83 | - if(!$loaded) return array(); |
|
93 | + if(!$loaded) |
|
94 | + { |
|
95 | + return array(); |
|
96 | + } |
|
84 | 97 | } |
85 | 98 | $xml_array = array(); |
86 | 99 | |
87 | - foreach($n->childNodes as $nc) { |
|
100 | + foreach($n->childNodes as $nc) |
|
101 | + { |
|
88 | 102 | |
89 | - if ( $nc->nodeType != XML_ELEMENT_NODE ) continue; |
|
103 | + if ( $nc->nodeType != XML_ELEMENT_NODE ) |
|
104 | + { |
|
105 | + continue; |
|
106 | + } |
|
90 | 107 | |
91 | 108 | $name = $nc->attributes->getNamedItem('name')->nodeValue; |
92 | 109 | $type = $nc->attributes->getNamedItem('type')->nodeValue; |
93 | 110 | |
94 | 111 | //echo $nc->nodeType. "(length ): ". $nc->nodeName. " => ". $nc->nodeValue. "; Attriubtes: name=$name, type=$type \n "; |
95 | - if( $nc->childNodes->length >= 2) { |
|
112 | + if( $nc->childNodes->length >= 2) |
|
113 | + { |
|
96 | 114 | $xml_array[$name] = self::xml2array($nc); |
97 | - } else { |
|
98 | - switch ( $type ) { |
|
115 | + } |
|
116 | + else |
|
117 | + { |
|
118 | + switch ( $type ) |
|
119 | + { |
|
99 | 120 | case 'boolean' : |
100 | 121 | $value = $nc->nodeValue == 'FALSE' ? false : true; |
101 | 122 | break; |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | const TEMPLATE_MARKER = '-eTemplate-'; |
24 | 24 | |
25 | 25 | /** |
26 | - * List of steps. Key is the function, value is the translated title. |
|
27 | - */ |
|
26 | + * List of steps. Key is the function, value is the translated title. |
|
27 | + */ |
|
28 | 28 | public $steps; |
29 | 29 | |
30 | 30 | /** |
31 | - * List of eTemplates to use for each step. You can override this with your own etemplates steps. |
|
32 | - */ |
|
31 | + * List of eTemplates to use for each step. You can override this with your own etemplates steps. |
|
32 | + */ |
|
33 | 33 | protected $step_templates = array( |
34 | 34 | 'wizard_step30' => 'importexport.wizard_basic_import_csv.sample_file', |
35 | 35 | 'wizard_step40' => 'importexport.wizard_basic_import_csv.choosesepncharset', |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
42 | - * Destination fields for the mapping |
|
43 | - * Key is the field name, value is the human version |
|
44 | - */ |
|
42 | + * Destination fields for the mapping |
|
43 | + * Key is the field name, value is the human version |
|
44 | + */ |
|
45 | 45 | protected $mapping_fields = array(); |
46 | 46 | |
47 | 47 | /** |
48 | - * List of conditions your plugin supports |
|
49 | - */ |
|
48 | + * List of conditions your plugin supports |
|
49 | + */ |
|
50 | 50 | protected $conditions = array(); |
51 | 51 | |
52 | 52 | /** |
53 | - * List of actions your plugin supports |
|
54 | - */ |
|
53 | + * List of actions your plugin supports |
|
54 | + */ |
|
55 | 55 | protected $actions = array(); |
56 | 56 | |
57 | 57 | /** |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
71 | - * Take a sample CSV file. It will be processed in later steps |
|
72 | - */ |
|
71 | + * Take a sample CSV file. It will be processed in later steps |
|
72 | + */ |
|
73 | 73 | function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv) |
74 | 74 | { |
75 | 75 | if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true)); |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
266 | - * Process the sample file, get the fields out of it, then allow them to be mapped onto |
|
267 | - * the fields the destination understands. Also, set any translations to be done to the field. |
|
268 | - * |
|
269 | - * You can use the eTemplate |
|
270 | - */ |
|
266 | + * Process the sample file, get the fields out of it, then allow them to be mapped onto |
|
267 | + * the fields the destination understands. Also, set any translations to be done to the field. |
|
268 | + * |
|
269 | + * You can use the eTemplate |
|
270 | + */ |
|
271 | 271 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
272 | 272 | { |
273 | 273 | if($this->debug) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
@@ -348,8 +348,8 @@ discard block |
||
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
351 | - * Edit conditions |
|
352 | - */ |
|
351 | + * Edit conditions |
|
352 | + */ |
|
353 | 353 | function wizard_step55(&$content, &$sel_options, &$readonlys, &$preserv) |
354 | 354 | { |
355 | 355 | if($this->debug) error_log(get_class($this) . '::wizard_step55->$content '.print_r($content,true)); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv) |
72 | 72 | { |
73 | - if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true)); |
|
73 | + if ($this->debug) error_log(get_class($this).'::wizard_step30->$content '.print_r($content, true)); |
|
74 | 74 | // return from step30 |
75 | 75 | if ($content['step'] == 'wizard_step30') |
76 | 76 | { |
@@ -78,17 +78,17 @@ discard block |
||
78 | 78 | { |
79 | 79 | case 'next': |
80 | 80 | // Move sample file to temp |
81 | - if($content['file']['tmp_name']) { |
|
82 | - $GLOBALS['egw']->session->appsession('csvfile',$content['application'],$content['file']['tmp_name']); |
|
81 | + if ($content['file']['tmp_name']) { |
|
82 | + $GLOBALS['egw']->session->appsession('csvfile', $content['application'], $content['file']['tmp_name']); |
|
83 | 83 | } |
84 | 84 | unset($content['file']); |
85 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
85 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
86 | 86 | case 'previous' : |
87 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
87 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
88 | 88 | case 'finish': |
89 | 89 | return 'wizard_finish'; |
90 | 90 | default : |
91 | - return $this->wizard_step30($content,$sel_options,$readonlys,$preserv); |
|
91 | + return $this->wizard_step30($content, $sel_options, $readonlys, $preserv); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | // init step30 |
@@ -115,55 +115,55 @@ discard block |
||
115 | 115 | */ |
116 | 116 | function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv) |
117 | 117 | { |
118 | - if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true)); |
|
118 | + if ($this->debug) error_log(get_class($this).'::wizard_step40->$content '.print_r($content, true)); |
|
119 | 119 | // return from step40 |
120 | 120 | if ($content['step'] == 'wizard_step40') { |
121 | 121 | switch (array_search('pressed', $content['button'])) |
122 | 122 | { |
123 | 123 | case 'next': |
124 | 124 | // Process sample file for fields |
125 | - if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile',$content['application']), "rb")) !== FALSE) { |
|
125 | + if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile', $content['application']), "rb")) !== FALSE) { |
|
126 | 126 | $data = fgetcsv($handle, 8000, $content['fieldsep']); |
127 | 127 | //error_log(array2string($data)); |
128 | 128 | fclose($handle); |
129 | 129 | |
130 | 130 | // Remove & forget file |
131 | - unlink($GLOBALS['egw']->session->appsession('csvfile',$content['application'])); |
|
131 | + unlink($GLOBALS['egw']->session->appsession('csvfile', $content['application'])); |
|
132 | 132 | egw_cache::setSession($content['application'], 'csvfile', ''); |
133 | - $content['csv_fields'] = translation::convert($data,$content['charset']); |
|
133 | + $content['csv_fields'] = translation::convert($data, $content['charset']); |
|
134 | 134 | |
135 | 135 | // Reset field mapping for new file |
136 | 136 | $content['field_mapping'] = array(); |
137 | 137 | |
138 | 138 | // Try to match automatically |
139 | 139 | $english = array(); |
140 | - foreach($content['csv_fields'] as $index => $field) { |
|
141 | - if($content['field_mapping'][$index]) continue; |
|
140 | + foreach ($content['csv_fields'] as $index => $field) { |
|
141 | + if ($content['field_mapping'][$index]) continue; |
|
142 | 142 | $best_match = ''; |
143 | 143 | $best_match_value = 0; |
144 | - foreach($this->mapping_fields as $key => $field_name) { |
|
145 | - if(is_array($field_name)) continue; |
|
146 | - if(strcasecmp($field, $field_name) == 0 || strcasecmp($field,$key) == 0) { |
|
144 | + foreach ($this->mapping_fields as $key => $field_name) { |
|
145 | + if (is_array($field_name)) continue; |
|
146 | + if (strcasecmp($field, $field_name) == 0 || strcasecmp($field, $key) == 0) { |
|
147 | 147 | $content['field_mapping'][$index] = $key; |
148 | 148 | continue 2; |
149 | 149 | } |
150 | 150 | // Check english also |
151 | - if($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != 'en' && !isset($english[$field_name])) { |
|
151 | + if ($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != 'en' && !isset($english[$field_name])) { |
|
152 | 152 | $msg_id = translation::get_message_id($field_name, $content['application']); |
153 | 153 | } |
154 | - if($msg_id) { |
|
154 | + if ($msg_id) { |
|
155 | 155 | $english[$field_name] = translation::read('en', $content['application'], $msg_id); |
156 | 156 | } else { |
157 | 157 | $english[$field_name] = false; |
158 | 158 | } |
159 | - if($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) { |
|
159 | + if ($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) { |
|
160 | 160 | $content['field_mapping'][$index] = $key; |
161 | 161 | continue 2; |
162 | 162 | } |
163 | 163 | |
164 | 164 | // Check for similar but slightly different |
165 | 165 | $match = 0; |
166 | - if(similar_text(strtolower($field), strtolower($field_name), $match) && |
|
166 | + if (similar_text(strtolower($field), strtolower($field_name), $match) && |
|
167 | 167 | $match > 85 && |
168 | 168 | $match > $best_match_value |
169 | 169 | ) { |
@@ -172,20 +172,20 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | } |
175 | - if($best_match) { |
|
175 | + if ($best_match) { |
|
176 | 176 | $content['field_mapping'][$index] = $best_match; |
177 | 177 | } |
178 | 178 | } |
179 | - } elseif(!$content['csv_fields'] && $content['plugin_options']['csv_fields']) { |
|
179 | + } elseif (!$content['csv_fields'] && $content['plugin_options']['csv_fields']) { |
|
180 | 180 | $content['csv_fields'] = $content['plugin_options']['csv_fields']; |
181 | 181 | } |
182 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
182 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
183 | 183 | case 'previous' : |
184 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
184 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
185 | 185 | case 'finish': |
186 | 186 | return 'wizard_finish'; |
187 | 187 | default : |
188 | - return $this->wizard_step40($content,$sel_options,$readonlys,$preserv); |
|
188 | + return $this->wizard_step40($content, $sel_options, $readonlys, $preserv); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | // init step40 |
@@ -195,17 +195,17 @@ discard block |
||
195 | 195 | $content['step'] = 'wizard_step40'; |
196 | 196 | |
197 | 197 | // If editing an existing definition, these will be in plugin_options |
198 | - if(!$content['fieldsep'] && $content['plugin_options']['fieldsep']) { |
|
198 | + if (!$content['fieldsep'] && $content['plugin_options']['fieldsep']) { |
|
199 | 199 | $content['fieldsep'] = $content['plugin_options']['fieldsep']; |
200 | 200 | } elseif (!$content['fieldsep']) { |
201 | 201 | $content['fieldsep'] = ';'; |
202 | 202 | } |
203 | - if(!$content['charset'] && $content['plugin_options']['charset']) { |
|
203 | + if (!$content['charset'] && $content['plugin_options']['charset']) { |
|
204 | 204 | $content['charset'] = $content['plugin_options']['charset']; |
205 | 205 | } |
206 | - if(!array_key_exists('num_header_lines', $content)) |
|
206 | + if (!array_key_exists('num_header_lines', $content)) |
|
207 | 207 | { |
208 | - if(array_key_exists('num_header_lines', $content['plugin_options'])) |
|
208 | + if (array_key_exists('num_header_lines', $content['plugin_options'])) |
|
209 | 209 | { |
210 | 210 | $content['num_header_lines'] = $content['plugin_options']['num_header_lines']; |
211 | 211 | } |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | $content['num_header_lines'] = 1; |
216 | 216 | } |
217 | 217 | } |
218 | - if(!$content['update_cats'] && $content['plugin_options']['update_cats']) { |
|
218 | + if (!$content['update_cats'] && $content['plugin_options']['update_cats']) { |
|
219 | 219 | $content['update_cats'] = $content['plugin_options']['update_cats']; |
220 | 220 | } |
221 | - if(!array_key_exists('convert', $content) && is_array($content['plugin_options']) && array_key_exists('convert', $content['plugin_options'])) { |
|
221 | + if (!array_key_exists('convert', $content) && is_array($content['plugin_options']) && array_key_exists('convert', $content['plugin_options'])) { |
|
222 | 222 | $content['convert'] = $content['plugin_options']['convert']; |
223 | 223 | } |
224 | 224 | else |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | $content['convert'] = 1; |
228 | 228 | } |
229 | 229 | |
230 | - $sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+ |
|
230 | + $sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets() + |
|
231 | 231 | array( |
232 | 232 | 'user' => lang('User preference'), |
233 | 233 | ); |
234 | 234 | |
235 | 235 | // Add in extra allowed charsets |
236 | 236 | $config = config::read('importexport'); |
237 | - $extra_charsets = array_intersect(explode(',',$config['import_charsets']), mb_list_encodings()); |
|
238 | - if($extra_charsets) |
|
237 | + $extra_charsets = array_intersect(explode(',', $config['import_charsets']), mb_list_encodings()); |
|
238 | + if ($extra_charsets) |
|
239 | 239 | { |
240 | - $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets,$extra_charsets)); |
|
240 | + $sel_options['charset'] += array(lang('Extra encodings') => array_combine($extra_charsets, $extra_charsets)); |
|
241 | 241 | } |
242 | 242 | $sel_options['convert'] = array( |
243 | 243 | 0 => lang('Database values'), |
244 | 244 | 1 => lang('Human friendly values') |
245 | 245 | ); |
246 | 246 | $preserv = $content; |
247 | - if($this->mapping_fields['cat_id']) { |
|
247 | + if ($this->mapping_fields['cat_id']) { |
|
248 | 248 | $sel_options['update_cats'] = array( |
249 | 249 | 'add' => lang('Add'), |
250 | 250 | 'replace'=> lang('Replace') |
@@ -266,18 +266,18 @@ discard block |
||
266 | 266 | */ |
267 | 267 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
268 | 268 | { |
269 | - if($this->debug) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
269 | + if ($this->debug) error_log(get_class($this).'::wizard_step50->$content '.print_r($content, true)); |
|
270 | 270 | // return from step50 |
271 | 271 | if ($content['step'] == 'wizard_step50') |
272 | 272 | { |
273 | 273 | unset($content['field_mapping']); |
274 | 274 | unset($content['field_conversion']); |
275 | - foreach($content['mapping'] as $field) |
|
275 | + foreach ($content['mapping'] as $field) |
|
276 | 276 | { |
277 | 277 | $index = $field['index']; |
278 | - foreach(array('conversion'=>'field_conversion', 'field' => 'field_mapping') as $id => $dest) |
|
278 | + foreach (array('conversion'=>'field_conversion', 'field' => 'field_mapping') as $id => $dest) |
|
279 | 279 | { |
280 | - if(trim($field[$id]) != '' && $field[$id] !== '--NONE--') |
|
280 | + if (trim($field[$id]) != '' && $field[$id] !== '--NONE--') |
|
281 | 281 | { |
282 | 282 | $content[$dest][$index] = trim($field[$id]); |
283 | 283 | } |
@@ -287,13 +287,13 @@ discard block |
||
287 | 287 | switch (array_search('pressed', $content['button'])) |
288 | 288 | { |
289 | 289 | case 'next': |
290 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
290 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
291 | 291 | case 'previous' : |
292 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
292 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
293 | 293 | case 'finish': |
294 | 294 | return 'wizard_finish'; |
295 | 295 | default : |
296 | - return $this->wizard_step50($content,$sel_options,$readonlys,$preserv); |
|
296 | + return $this->wizard_step50($content, $sel_options, $readonlys, $preserv); |
|
297 | 297 | } |
298 | 298 | } |
299 | 299 | // init step50 |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $content['step'] = 'wizard_step50'; |
304 | 304 | |
305 | 305 | $content['mapping'] = array(false); |
306 | - if(array_key_exists('field_mapping', $content)) |
|
306 | + if (array_key_exists('field_mapping', $content)) |
|
307 | 307 | { |
308 | 308 | $field = $content['field_mapping']; |
309 | 309 | $conversion = $content['field_conversion']; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $conversion = $content['plugin_options']['field_conversion']; |
315 | 315 | } |
316 | 316 | $empties = 1; |
317 | - foreach($content['csv_fields'] as $index => $title) |
|
317 | + foreach ($content['csv_fields'] as $index => $title) |
|
318 | 318 | { |
319 | 319 | $content['mapping'][] = array( |
320 | 320 | 'index' => $index, |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | 'field' => $field[$index], |
323 | 323 | 'conversion' => $conversion[$index] |
324 | 324 | ); |
325 | - if(strstr($title,lang('Extra %1'))) $empties++; |
|
325 | + if (strstr($title, lang('Extra %1'))) $empties++; |
|
326 | 326 | } |
327 | - while($empties <= 3) |
|
327 | + while ($empties <= 3) |
|
328 | 328 | { |
329 | 329 | $content['mapping'][] = array( |
330 | 330 | 'index' => $index + $empties, |
331 | 331 | 'title' => lang('Extra %1', $empties), |
332 | - 'field' => $field[$index+$empties], |
|
333 | - 'conversion' => $conversion[$index+$empties] |
|
332 | + 'field' => $field[$index + $empties], |
|
333 | + 'conversion' => $conversion[$index + $empties] |
|
334 | 334 | ); |
335 | 335 | $empties++; |
336 | 336 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | function wizard_step55(&$content, &$sel_options, &$readonlys, &$preserv) |
350 | 350 | { |
351 | - if($this->debug) error_log(get_class($this) . '::wizard_step55->$content '.print_r($content,true)); |
|
351 | + if ($this->debug) error_log(get_class($this).'::wizard_step55->$content '.print_r($content, true)); |
|
352 | 352 | |
353 | 353 | // return from step55 |
354 | 354 | if ($content['step'] == 'wizard_step55') |
@@ -356,8 +356,8 @@ discard block |
||
356 | 356 | |
357 | 357 | // Clear conditions that don't do anything |
358 | 358 | array_shift($content['conditions']); |
359 | - foreach($content['conditions'] as $key => &$condition) { |
|
360 | - if(($condition['true']['action'] == 'none' || !$condition['true']['action']) |
|
359 | + foreach ($content['conditions'] as $key => &$condition) { |
|
360 | + if (($condition['true']['action'] == 'none' || !$condition['true']['action']) |
|
361 | 361 | && ($condition['false']['action'] == 'none' || !$condition['false']['action']) && |
362 | 362 | !$condition['string'] |
363 | 363 | ) { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | // Check for true without false, or false without true - set to 'none' |
369 | - elseif($condition['true']['action'] == '' && $condition['false']['action'] != '' || |
|
369 | + elseif ($condition['true']['action'] == '' && $condition['false']['action'] != '' || |
|
370 | 370 | $condition['true']['action'] != '' && $condition['false']['action'] == '' || |
371 | 371 | !$condition['true'] || !$condition['false'] |
372 | 372 | ) |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | switch (array_search('pressed', $content['button'])) |
379 | 379 | { |
380 | 380 | case 'next': |
381 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
|
381 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], 1); |
|
382 | 382 | case 'previous' : |
383 | - return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],-1); |
|
383 | + return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'], -1); |
|
384 | 384 | case 'finish': |
385 | 385 | return 'wizard_finish'; |
386 | 386 | case 'add': |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | $content['conditions'][] = array('string' => ''); |
390 | 390 | return 'wizard_step55'; |
391 | 391 | default : |
392 | - return $this->wizard_step55($content,$sel_options,$readonlys,$preserv); |
|
392 | + return $this->wizard_step55($content, $sel_options, $readonlys, $preserv); |
|
393 | 393 | break; |
394 | 394 | } |
395 | 395 | } |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | $content['text'] = $this->steps['wizard_step55']; |
398 | 398 | $content['step'] = 'wizard_step55'; |
399 | 399 | |
400 | - if(!$content['conditions'] && $content['plugin_options']['conditions']) { |
|
400 | + if (!$content['conditions'] && $content['plugin_options']['conditions']) { |
|
401 | 401 | $content['conditions'] = $content['plugin_options']['conditions']; |
402 | 402 | } |
403 | 403 | $preserv = $content; |
404 | 404 | |
405 | - foreach($content['field_mapping'] as $field) { |
|
405 | + foreach ($content['field_mapping'] as $field) { |
|
406 | 406 | $sel_options['string'][$field] = $this->mapping_fields[$field]; |
407 | - if(!$sel_options['string'][$field]) |
|
407 | + if (!$sel_options['string'][$field]) |
|
408 | 408 | { |
409 | - foreach($this->mapping_fields as $fields) |
|
409 | + foreach ($this->mapping_fields as $fields) |
|
410 | 410 | { |
411 | - if(is_array($fields) && $fields[$field]) |
|
411 | + if (is_array($fields) && $fields[$field]) |
|
412 | 412 | { |
413 | 413 | $sel_options['string'][$field] = $fields[$field]; |
414 | 414 | } |
@@ -70,7 +70,10 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function wizard_step30(&$content, &$sel_options, &$readonlys, &$preserv) |
72 | 72 | { |
73 | - if($this->debug) error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true)); |
|
73 | + if($this->debug) |
|
74 | + { |
|
75 | + error_log(get_class($this) . '::wizard_step30->$content '.print_r($content,true)); |
|
76 | + } |
|
74 | 77 | // return from step30 |
75 | 78 | if ($content['step'] == 'wizard_step30') |
76 | 79 | { |
@@ -78,7 +81,8 @@ discard block |
||
78 | 81 | { |
79 | 82 | case 'next': |
80 | 83 | // Move sample file to temp |
81 | - if($content['file']['tmp_name']) { |
|
84 | + if($content['file']['tmp_name']) |
|
85 | + { |
|
82 | 86 | $GLOBALS['egw']->session->appsession('csvfile',$content['application'],$content['file']['tmp_name']); |
83 | 87 | } |
84 | 88 | unset($content['file']); |
@@ -115,14 +119,19 @@ discard block |
||
115 | 119 | */ |
116 | 120 | function wizard_step40(&$content, &$sel_options, &$readonlys, &$preserv) |
117 | 121 | { |
118 | - if($this->debug) error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true)); |
|
122 | + if($this->debug) |
|
123 | + { |
|
124 | + error_log(get_class($this) . '::wizard_step40->$content '.print_r($content,true)); |
|
125 | + } |
|
119 | 126 | // return from step40 |
120 | - if ($content['step'] == 'wizard_step40') { |
|
127 | + if ($content['step'] == 'wizard_step40') |
|
128 | + { |
|
121 | 129 | switch (array_search('pressed', $content['button'])) |
122 | 130 | { |
123 | 131 | case 'next': |
124 | 132 | // Process sample file for fields |
125 | - if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile',$content['application']), "rb")) !== FALSE) { |
|
133 | + if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile',$content['application']), "rb")) !== FALSE) |
|
134 | + { |
|
126 | 135 | $data = fgetcsv($handle, 8000, $content['fieldsep']); |
127 | 136 | //error_log(array2string($data)); |
128 | 137 | fclose($handle); |
@@ -137,26 +146,40 @@ discard block |
||
137 | 146 | |
138 | 147 | // Try to match automatically |
139 | 148 | $english = array(); |
140 | - foreach($content['csv_fields'] as $index => $field) { |
|
141 | - if($content['field_mapping'][$index]) continue; |
|
149 | + foreach($content['csv_fields'] as $index => $field) |
|
150 | + { |
|
151 | + if($content['field_mapping'][$index]) |
|
152 | + { |
|
153 | + continue; |
|
154 | + } |
|
142 | 155 | $best_match = ''; |
143 | 156 | $best_match_value = 0; |
144 | - foreach($this->mapping_fields as $key => $field_name) { |
|
145 | - if(is_array($field_name)) continue; |
|
146 | - if(strcasecmp($field, $field_name) == 0 || strcasecmp($field,$key) == 0) { |
|
157 | + foreach($this->mapping_fields as $key => $field_name) |
|
158 | + { |
|
159 | + if(is_array($field_name)) |
|
160 | + { |
|
161 | + continue; |
|
162 | + } |
|
163 | + if(strcasecmp($field, $field_name) == 0 || strcasecmp($field,$key) == 0) |
|
164 | + { |
|
147 | 165 | $content['field_mapping'][$index] = $key; |
148 | 166 | continue 2; |
149 | 167 | } |
150 | 168 | // Check english also |
151 | - if($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != 'en' && !isset($english[$field_name])) { |
|
169 | + if($GLOBALS['egw_info']['user']['preferences']['common']['lang'] != 'en' && !isset($english[$field_name])) |
|
170 | + { |
|
152 | 171 | $msg_id = translation::get_message_id($field_name, $content['application']); |
153 | 172 | } |
154 | - if($msg_id) { |
|
173 | + if($msg_id) |
|
174 | + { |
|
155 | 175 | $english[$field_name] = translation::read('en', $content['application'], $msg_id); |
156 | - } else { |
|
176 | + } |
|
177 | + else |
|
178 | + { |
|
157 | 179 | $english[$field_name] = false; |
158 | 180 | } |
159 | - if($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) { |
|
181 | + if($english[$field_name] && strcasecmp($field, $english[$field_name]) == 0) |
|
182 | + { |
|
160 | 183 | $content['field_mapping'][$index] = $key; |
161 | 184 | continue 2; |
162 | 185 | } |
@@ -172,11 +195,14 @@ discard block |
||
172 | 195 | } |
173 | 196 | |
174 | 197 | } |
175 | - if($best_match) { |
|
198 | + if($best_match) |
|
199 | + { |
|
176 | 200 | $content['field_mapping'][$index] = $best_match; |
177 | 201 | } |
178 | 202 | } |
179 | - } elseif(!$content['csv_fields'] && $content['plugin_options']['csv_fields']) { |
|
203 | + } |
|
204 | + elseif(!$content['csv_fields'] && $content['plugin_options']['csv_fields']) |
|
205 | + { |
|
180 | 206 | $content['csv_fields'] = $content['plugin_options']['csv_fields']; |
181 | 207 | } |
182 | 208 | return $GLOBALS['egw']->importexport_definitions_ui->get_step($content['step'],1); |
@@ -195,12 +221,16 @@ discard block |
||
195 | 221 | $content['step'] = 'wizard_step40'; |
196 | 222 | |
197 | 223 | // If editing an existing definition, these will be in plugin_options |
198 | - if(!$content['fieldsep'] && $content['plugin_options']['fieldsep']) { |
|
224 | + if(!$content['fieldsep'] && $content['plugin_options']['fieldsep']) |
|
225 | + { |
|
199 | 226 | $content['fieldsep'] = $content['plugin_options']['fieldsep']; |
200 | - } elseif (!$content['fieldsep']) { |
|
227 | + } |
|
228 | + elseif (!$content['fieldsep']) |
|
229 | + { |
|
201 | 230 | $content['fieldsep'] = ';'; |
202 | 231 | } |
203 | - if(!$content['charset'] && $content['plugin_options']['charset']) { |
|
232 | + if(!$content['charset'] && $content['plugin_options']['charset']) |
|
233 | + { |
|
204 | 234 | $content['charset'] = $content['plugin_options']['charset']; |
205 | 235 | } |
206 | 236 | if(!array_key_exists('num_header_lines', $content)) |
@@ -215,10 +245,12 @@ discard block |
||
215 | 245 | $content['num_header_lines'] = 1; |
216 | 246 | } |
217 | 247 | } |
218 | - if(!$content['update_cats'] && $content['plugin_options']['update_cats']) { |
|
248 | + if(!$content['update_cats'] && $content['plugin_options']['update_cats']) |
|
249 | + { |
|
219 | 250 | $content['update_cats'] = $content['plugin_options']['update_cats']; |
220 | 251 | } |
221 | - if(!array_key_exists('convert', $content) && is_array($content['plugin_options']) && array_key_exists('convert', $content['plugin_options'])) { |
|
252 | + if(!array_key_exists('convert', $content) && is_array($content['plugin_options']) && array_key_exists('convert', $content['plugin_options'])) |
|
253 | + { |
|
222 | 254 | $content['convert'] = $content['plugin_options']['convert']; |
223 | 255 | } |
224 | 256 | else |
@@ -244,12 +276,15 @@ discard block |
||
244 | 276 | 1 => lang('Human friendly values') |
245 | 277 | ); |
246 | 278 | $preserv = $content; |
247 | - if($this->mapping_fields['cat_id']) { |
|
279 | + if($this->mapping_fields['cat_id']) |
|
280 | + { |
|
248 | 281 | $sel_options['update_cats'] = array( |
249 | 282 | 'add' => lang('Add'), |
250 | 283 | 'replace'=> lang('Replace') |
251 | 284 | ); |
252 | - } else { |
|
285 | + } |
|
286 | + else |
|
287 | + { |
|
253 | 288 | $content['no_cats'] = true; |
254 | 289 | } |
255 | 290 | unset ($preserv['button']); |
@@ -266,7 +301,10 @@ discard block |
||
266 | 301 | */ |
267 | 302 | function wizard_step50(&$content, &$sel_options, &$readonlys, &$preserv) |
268 | 303 | { |
269 | - if($this->debug) error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
304 | + if($this->debug) |
|
305 | + { |
|
306 | + error_log(get_class($this) . '::wizard_step50->$content '.print_r($content,true)); |
|
307 | + } |
|
270 | 308 | // return from step50 |
271 | 309 | if ($content['step'] == 'wizard_step50') |
272 | 310 | { |
@@ -322,7 +360,10 @@ discard block |
||
322 | 360 | 'field' => $field[$index], |
323 | 361 | 'conversion' => $conversion[$index] |
324 | 362 | ); |
325 | - if(strstr($title,lang('Extra %1'))) $empties++; |
|
363 | + if(strstr($title,lang('Extra %1'))) |
|
364 | + { |
|
365 | + $empties++; |
|
366 | + } |
|
326 | 367 | } |
327 | 368 | while($empties <= 3) |
328 | 369 | { |
@@ -348,7 +389,10 @@ discard block |
||
348 | 389 | */ |
349 | 390 | function wizard_step55(&$content, &$sel_options, &$readonlys, &$preserv) |
350 | 391 | { |
351 | - if($this->debug) error_log(get_class($this) . '::wizard_step55->$content '.print_r($content,true)); |
|
392 | + if($this->debug) |
|
393 | + { |
|
394 | + error_log(get_class($this) . '::wizard_step55->$content '.print_r($content,true)); |
|
395 | + } |
|
352 | 396 | |
353 | 397 | // return from step55 |
354 | 398 | if ($content['step'] == 'wizard_step55') |
@@ -356,7 +400,8 @@ discard block |
||
356 | 400 | |
357 | 401 | // Clear conditions that don't do anything |
358 | 402 | array_shift($content['conditions']); |
359 | - foreach($content['conditions'] as $key => &$condition) { |
|
403 | + foreach($content['conditions'] as $key => &$condition) |
|
404 | + { |
|
360 | 405 | if(($condition['true']['action'] == 'none' || !$condition['true']['action']) |
361 | 406 | && ($condition['false']['action'] == 'none' || !$condition['false']['action']) && |
362 | 407 | !$condition['string'] |
@@ -369,8 +414,7 @@ discard block |
||
369 | 414 | elseif($condition['true']['action'] == '' && $condition['false']['action'] != '' || |
370 | 415 | $condition['true']['action'] != '' && $condition['false']['action'] == '' || |
371 | 416 | !$condition['true'] || !$condition['false'] |
372 | - ) |
|
373 | - { |
|
417 | + ) { |
|
374 | 418 | $condition[$condition['true']['action'] == '' ? 'true' : 'false']['action'] = "none"; |
375 | 419 | } |
376 | 420 | } |
@@ -397,12 +441,14 @@ discard block |
||
397 | 441 | $content['text'] = $this->steps['wizard_step55']; |
398 | 442 | $content['step'] = 'wizard_step55'; |
399 | 443 | |
400 | - if(!$content['conditions'] && $content['plugin_options']['conditions']) { |
|
444 | + if(!$content['conditions'] && $content['plugin_options']['conditions']) |
|
445 | + { |
|
401 | 446 | $content['conditions'] = $content['plugin_options']['conditions']; |
402 | 447 | } |
403 | 448 | $preserv = $content; |
404 | 449 | |
405 | - foreach($content['field_mapping'] as $field) { |
|
450 | + foreach($content['field_mapping'] as $field) |
|
451 | + { |
|
406 | 452 | $sel_options['string'][$field] = $this->mapping_fields[$field]; |
407 | 453 | if(!$sel_options['string'][$field]) |
408 | 454 | { |
@@ -29,23 +29,23 @@ discard block |
||
29 | 29 | |
30 | 30 | if (ini_get('session.save_handler') == 'files' && !is_writable(ini_get('session.save_path')) && is_dir('/tmp') && is_writable('/tmp')) |
31 | 31 | { |
32 | - ini_set('session.save_path','/tmp'); // regular users may have no rights to apache's session dir |
|
32 | + ini_set('session.save_path', '/tmp'); // regular users may have no rights to apache's session dir |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Include PEAR::Console_Getopt |
36 | 36 | require_once 'Console/Getopt.php'; |
37 | 37 | |
38 | 38 | // Define exit codes for errors |
39 | -define('HEADER_NOT_FOUND',9); |
|
40 | -define('NO_ARGS',10); |
|
41 | -define('INVALID_OPTION',11); |
|
39 | +define('HEADER_NOT_FOUND', 9); |
|
40 | +define('NO_ARGS', 10); |
|
41 | +define('INVALID_OPTION', 11); |
|
42 | 42 | |
43 | 43 | // Reading the incoming arguments - same as $argv |
44 | 44 | $args = Console_Getopt::readPHPArgv(); |
45 | 45 | |
46 | 46 | // Make sure we got them (for non CLI binaries) |
47 | 47 | if (PEAR::isError($args)) { |
48 | - fwrite(STDERR,"importexport_cli: ".$args->getMessage()."\n".$usage); |
|
48 | + fwrite(STDERR, "importexport_cli: ".$args->getMessage()."\n".$usage); |
|
49 | 49 | exit(NO_ARGS); |
50 | 50 | } |
51 | 51 | |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | ); |
64 | 64 | |
65 | 65 | // Convert the arguments to options - check for the first argument |
66 | -if ( realpath($_SERVER['argv'][0]) == __FILE__ ) { |
|
67 | - $options = Console_Getopt::getOpt($args,$short_opts,$long_opts); |
|
66 | +if (realpath($_SERVER['argv'][0]) == __FILE__) { |
|
67 | + $options = Console_Getopt::getOpt($args, $short_opts, $long_opts); |
|
68 | 68 | } else { |
69 | - $options = Console_Getopt::getOpt2($args,$short_opts,$long_opts); |
|
69 | + $options = Console_Getopt::getOpt2($args, $short_opts, $long_opts); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check the options are valid |
73 | 73 | if (PEAR::isError($options)) { |
74 | - fwrite(STDERR,"importexport_cli: ".$options->getMessage()."\n".$usage."\n"); |
|
74 | + fwrite(STDERR, "importexport_cli: ".$options->getMessage()."\n".$usage."\n"); |
|
75 | 75 | exit(INVALID_OPTION); |
76 | 76 | } |
77 | 77 | |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | $dryrun = true; |
99 | 99 | break; |
100 | 100 | default : |
101 | - fwrite (STDERR,$usage."\n"); |
|
101 | + fwrite(STDERR, $usage."\n"); |
|
102 | 102 | exit(INVALID_OPTION); |
103 | 103 | } |
104 | 104 | } |
105 | 105 | // check file |
106 | -if ( !$user || !$password ) { |
|
107 | - fwrite(STDERR,'importexport_cli: You have to supply a username / password'."\n".$usage); |
|
106 | +if (!$user || !$password) { |
|
107 | + fwrite(STDERR, 'importexport_cli: You have to supply a username / password'."\n".$usage); |
|
108 | 108 | exit(INVALID_OPTION); |
109 | 109 | } |
110 | 110 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | 'nonavbar' => True, |
118 | 118 | 'currentapp' => 'importexport', |
119 | 119 | 'autocreate_session_callback' => 'import_export_access', |
120 | - 'login' => $user . '@' . $domain, |
|
120 | + 'login' => $user.'@'.$domain, |
|
121 | 121 | 'passwd' => $password, |
122 | 122 | ); |
123 | 123 | if (!is_readable($path_to_egroupware.'/header.inc.php')) |
124 | 124 | { |
125 | - fwrite(STDERR,"importexport.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n"); |
|
125 | + fwrite(STDERR, "importexport.php: Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n"); |
|
126 | 126 | exit(HEADER_NOT_FOUND); |
127 | 127 | } |
128 | 128 | include($path_to_egroupware.'/header.inc.php'); |
@@ -130,13 +130,13 @@ discard block |
||
130 | 130 | // check file |
131 | 131 | if (!is_readable($file)) |
132 | 132 | { |
133 | - fwrite(STDERR,"importexport_cli: ". $file. ' is not readable'."\n"); |
|
133 | + fwrite(STDERR, "importexport_cli: ".$file.' is not readable'."\n"); |
|
134 | 134 | exit(INVALID_OPTION); |
135 | 135 | } |
136 | 136 | |
137 | 137 | $definition = new importexport_definition($definition); |
138 | -if( $definition->get_identifier() < 1 ) { |
|
139 | - fwrite(STDERR,"importexport_cli: Definition not found! \n"); |
|
138 | +if ($definition->get_identifier() < 1) { |
|
139 | + fwrite(STDERR, "importexport_cli: Definition not found! \n"); |
|
140 | 140 | exit(INVALID_OPTION); |
141 | 141 | } |
142 | 142 | |
@@ -147,8 +147,8 @@ discard block |
||
147 | 147 | |
148 | 148 | $po = new $definition->plugin; |
149 | 149 | |
150 | -$resource = fopen( $file, 'r' ); |
|
151 | -$po->$type( $resource, $definition ); |
|
150 | +$resource = fopen($file, 'r'); |
|
151 | +$po->$type($resource, $definition); |
|
152 | 152 | |
153 | 153 | exit(); |
154 | 154 |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | --dry-run no real action, just console output |
24 | 24 | \n"; |
25 | 25 | |
26 | -if (php_sapi_name() != 'cli') { |
|
26 | +if (php_sapi_name() != 'cli') |
|
27 | +{ |
|
27 | 28 | die('This script only runs form command line'); |
28 | 29 | } |
29 | 30 | |
@@ -44,7 +45,8 @@ discard block |
||
44 | 45 | $args = Console_Getopt::readPHPArgv(); |
45 | 46 | |
46 | 47 | // Make sure we got them (for non CLI binaries) |
47 | -if (PEAR::isError($args)) { |
|
48 | +if (PEAR::isError($args)) |
|
49 | +{ |
|
48 | 50 | fwrite(STDERR,"importexport_cli: ".$args->getMessage()."\n".$usage); |
49 | 51 | exit(NO_ARGS); |
50 | 52 | } |
@@ -63,22 +65,28 @@ discard block |
||
63 | 65 | ); |
64 | 66 | |
65 | 67 | // Convert the arguments to options - check for the first argument |
66 | -if ( realpath($_SERVER['argv'][0]) == __FILE__ ) { |
|
68 | +if ( realpath($_SERVER['argv'][0]) == __FILE__ ) |
|
69 | +{ |
|
67 | 70 | $options = Console_Getopt::getOpt($args,$short_opts,$long_opts); |
68 | -} else { |
|
71 | +} |
|
72 | +else |
|
73 | +{ |
|
69 | 74 | $options = Console_Getopt::getOpt2($args,$short_opts,$long_opts); |
70 | 75 | } |
71 | 76 | |
72 | 77 | // Check the options are valid |
73 | -if (PEAR::isError($options)) { |
|
78 | +if (PEAR::isError($options)) |
|
79 | +{ |
|
74 | 80 | fwrite(STDERR,"importexport_cli: ".$options->getMessage()."\n".$usage."\n"); |
75 | 81 | exit(INVALID_OPTION); |
76 | 82 | } |
77 | 83 | |
78 | 84 | $domain = 'default'; |
79 | 85 | $dryrun = false; |
80 | -foreach ($options[0] as $option) { |
|
81 | - switch ($option[0]) { |
|
86 | +foreach ($options[0] as $option) |
|
87 | +{ |
|
88 | + switch ($option[0]) |
|
89 | + { |
|
82 | 90 | case '--file' : |
83 | 91 | $file = $option[1]; |
84 | 92 | break; |
@@ -103,7 +111,8 @@ discard block |
||
103 | 111 | } |
104 | 112 | } |
105 | 113 | // check file |
106 | -if ( !$user || !$password ) { |
|
114 | +if ( !$user || !$password ) |
|
115 | +{ |
|
107 | 116 | fwrite(STDERR,'importexport_cli: You have to supply a username / password'."\n".$usage); |
108 | 117 | exit(INVALID_OPTION); |
109 | 118 | } |
@@ -135,7 +144,8 @@ discard block |
||
135 | 144 | } |
136 | 145 | |
137 | 146 | $definition = new importexport_definition($definition); |
138 | -if( $definition->get_identifier() < 1 ) { |
|
147 | +if( $definition->get_identifier() < 1 ) |
|
148 | +{ |
|
139 | 149 | fwrite(STDERR,"importexport_cli: Definition not found! \n"); |
140 | 150 | exit(INVALID_OPTION); |
141 | 151 | } |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | $setup_info['admin']['name'] = 'admin'; |
13 | 13 | $setup_info['admin']['version'] = '16.1'; |
14 | 14 | $setup_info['admin']['app_order'] = 1; |
15 | -$setup_info['admin']['tables'] = array('egw_admin_queue','egw_admin_remote'); |
|
15 | +$setup_info['admin']['tables'] = array('egw_admin_queue', 'egw_admin_remote'); |
|
16 | 16 | $setup_info['admin']['enable'] = 1; |
17 | -$setup_info['admin']['index'] = 'admin.admin_ui.index&ajax=true'; |
|
17 | +$setup_info['admin']['index'] = 'admin.admin_ui.index&ajax=true'; |
|
18 | 18 | |
19 | 19 | $setup_info['admin']['author'][] = array( |
20 | 20 | 'name' => 'eGroupWare coreteam', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'url' => 'www.egroupware.org' |
28 | 28 | ); |
29 | 29 | |
30 | -$setup_info['admin']['license'] = 'GPL'; |
|
30 | +$setup_info['admin']['license'] = 'GPL'; |
|
31 | 31 | $setup_info['admin']['description'] = 'EGroupware administration application'; |
32 | 32 | |
33 | 33 | /* The hooks this app includes, needed for hooks registration */ |
@@ -47,11 +47,11 @@ |
||
47 | 47 | /* Dependencies for this app to work */ |
48 | 48 | $setup_info['admin']['depends'][] = array( |
49 | 49 | 'appname' => 'phpgwapi', |
50 | - 'versions' => Array('14.1') |
|
50 | + 'versions' => array('14.1') |
|
51 | 51 | ); |
52 | 52 | $setup_info['admin']['depends'][] = array( |
53 | 53 | 'appname' => 'etemplate', |
54 | - 'versions' => Array('14.1') |
|
54 | + 'versions' => array('14.1') |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 |
@@ -15,37 +15,37 @@ |
||
15 | 15 | $phpgw_baseline = array( |
16 | 16 | 'egw_admin_queue' => array( |
17 | 17 | 'fd' => array( |
18 | - 'cmd_id' => array('type' => 'auto','nullable' => False), |
|
19 | - 'cmd_uid' => array('type' => 'ascii','precision' => '64','nullable' => False), |
|
20 | - 'cmd_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False), |
|
21 | - 'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
22 | - 'cmd_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False), |
|
23 | - 'cmd_type' => array('type' => 'ascii','precision' => '32','nullable' => False,'default' => 'admin_cmd'), |
|
24 | - 'cmd_status' => array('type' => 'int','precision' => '1'), |
|
25 | - 'cmd_scheduled' => array('type' => 'int','meta' => 'timestamp','precision' => '8'), |
|
26 | - 'cmd_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8'), |
|
27 | - 'cmd_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'), |
|
28 | - 'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'), |
|
29 | - 'cmd_error' => array('type' => 'varchar','precision' => '255'), |
|
30 | - 'cmd_errno' => array('type' => 'int','precision' => '4'), |
|
31 | - 'cmd_requested' => array('type' => 'int','precision' => '4'), |
|
32 | - 'cmd_requested_email' => array('type' => 'varchar','precision' => '128'), |
|
33 | - 'cmd_comment' => array('type' => 'varchar','precision' => '255'), |
|
34 | - 'cmd_data' => array('type' => 'ascii','precision' => '16384'), |
|
35 | - 'remote_id' => array('type' => 'int','precision' => '4') |
|
18 | + 'cmd_id' => array('type' => 'auto', 'nullable' => False), |
|
19 | + 'cmd_uid' => array('type' => 'ascii', 'precision' => '64', 'nullable' => False), |
|
20 | + 'cmd_creator' => array('type' => 'int', 'meta' => 'user', 'precision' => '4', 'nullable' => False), |
|
21 | + 'cmd_creator_email' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
22 | + 'cmd_created' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8', 'nullable' => False), |
|
23 | + 'cmd_type' => array('type' => 'ascii', 'precision' => '32', 'nullable' => False, 'default' => 'admin_cmd'), |
|
24 | + 'cmd_status' => array('type' => 'int', 'precision' => '1'), |
|
25 | + 'cmd_scheduled' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'), |
|
26 | + 'cmd_modified' => array('type' => 'int', 'meta' => 'timestamp', 'precision' => '8'), |
|
27 | + 'cmd_modifier' => array('type' => 'int', 'meta' => 'user', 'precision' => '4'), |
|
28 | + 'cmd_modifier_email' => array('type' => 'varchar', 'precision' => '128'), |
|
29 | + 'cmd_error' => array('type' => 'varchar', 'precision' => '255'), |
|
30 | + 'cmd_errno' => array('type' => 'int', 'precision' => '4'), |
|
31 | + 'cmd_requested' => array('type' => 'int', 'precision' => '4'), |
|
32 | + 'cmd_requested_email' => array('type' => 'varchar', 'precision' => '128'), |
|
33 | + 'cmd_comment' => array('type' => 'varchar', 'precision' => '255'), |
|
34 | + 'cmd_data' => array('type' => 'ascii', 'precision' => '16384'), |
|
35 | + 'remote_id' => array('type' => 'int', 'precision' => '4') |
|
36 | 36 | ), |
37 | 37 | 'pk' => array('cmd_id'), |
38 | 38 | 'fk' => array(), |
39 | - 'ix' => array('cmd_status','cmd_scheduled'), |
|
39 | + 'ix' => array('cmd_status', 'cmd_scheduled'), |
|
40 | 40 | 'uc' => array('cmd_uid') |
41 | 41 | ), |
42 | 42 | 'egw_admin_remote' => array( |
43 | 43 | 'fd' => array( |
44 | - 'remote_id' => array('type' => 'auto','nullable' => False), |
|
45 | - 'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False), |
|
46 | - 'remote_hash' => array('type' => 'ascii','precision' => '32','nullable' => False), |
|
47 | - 'remote_url' => array('type' => 'ascii','precision' => '128','nullable' => False), |
|
48 | - 'remote_domain' => array('type' => 'ascii','precision' => '64','nullable' => False) |
|
44 | + 'remote_id' => array('type' => 'auto', 'nullable' => False), |
|
45 | + 'remote_name' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False), |
|
46 | + 'remote_hash' => array('type' => 'ascii', 'precision' => '32', 'nullable' => False), |
|
47 | + 'remote_url' => array('type' => 'ascii', 'precision' => '128', 'nullable' => False), |
|
48 | + 'remote_domain' => array('type' => 'ascii', 'precision' => '64', 'nullable' => False) |
|
49 | 49 | ), |
50 | 50 | 'pk' => array('remote_id'), |
51 | 51 | 'fk' => array(), |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | |
21 | 21 | function admin_upgrade1_4() |
22 | 22 | { |
23 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_queue',array( |
|
23 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_queue', array( |
|
24 | 24 | 'fd' => array( |
25 | 25 | 'cmd_id' => array('type' => 'auto'), |
26 | - 'cmd_uid' => array('type' => 'varchar','precision' => '255','nullable' => False), |
|
27 | - 'cmd_creator' => array('type' => 'int','precision' => '4','nullable' => False), |
|
28 | - 'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
29 | - 'cmd_created' => array('type' => 'int','precision' => '8','nullable' => False), |
|
30 | - 'cmd_type' => array('type' => 'varchar','precision' => '32','nullable' => False,'default' => 'admin_cmd'), |
|
31 | - 'cmd_status' => array('type' => 'int','precision' => '1'), |
|
32 | - 'cmd_scheduled' => array('type' => 'int','precision' => '8'), |
|
33 | - 'cmd_modified' => array('type' => 'int','precision' => '8'), |
|
34 | - 'cmd_modifier' => array('type' => 'int','precision' => '4'), |
|
35 | - 'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'), |
|
36 | - 'cmd_error' => array('type' => 'varchar','precision' => '255'), |
|
37 | - 'cmd_errno' => array('type' => 'int','precision' => '4'), |
|
38 | - 'cmd_requested' => array('type' => 'int','precision' => '4'), |
|
39 | - 'cmd_requested_email' => array('type' => 'varchar','precision' => '128'), |
|
40 | - 'cmd_comment' => array('type' => 'varchar','precision' => '255'), |
|
26 | + 'cmd_uid' => array('type' => 'varchar', 'precision' => '255', 'nullable' => False), |
|
27 | + 'cmd_creator' => array('type' => 'int', 'precision' => '4', 'nullable' => False), |
|
28 | + 'cmd_creator_email' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
29 | + 'cmd_created' => array('type' => 'int', 'precision' => '8', 'nullable' => False), |
|
30 | + 'cmd_type' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False, 'default' => 'admin_cmd'), |
|
31 | + 'cmd_status' => array('type' => 'int', 'precision' => '1'), |
|
32 | + 'cmd_scheduled' => array('type' => 'int', 'precision' => '8'), |
|
33 | + 'cmd_modified' => array('type' => 'int', 'precision' => '8'), |
|
34 | + 'cmd_modifier' => array('type' => 'int', 'precision' => '4'), |
|
35 | + 'cmd_modifier_email' => array('type' => 'varchar', 'precision' => '128'), |
|
36 | + 'cmd_error' => array('type' => 'varchar', 'precision' => '255'), |
|
37 | + 'cmd_errno' => array('type' => 'int', 'precision' => '4'), |
|
38 | + 'cmd_requested' => array('type' => 'int', 'precision' => '4'), |
|
39 | + 'cmd_requested_email' => array('type' => 'varchar', 'precision' => '128'), |
|
40 | + 'cmd_comment' => array('type' => 'varchar', 'precision' => '255'), |
|
41 | 41 | 'cmd_data' => array('type' => 'blob') |
42 | 42 | ), |
43 | 43 | 'pk' => array('cmd_id'), |
44 | 44 | 'fk' => array(), |
45 | - 'ix' => array('cmd_status','cmd_scheduled'), |
|
45 | + 'ix' => array('cmd_status', 'cmd_scheduled'), |
|
46 | 46 | 'uc' => array('cmd_uid') |
47 | 47 | )); |
48 | 48 | return $GLOBALS['setup_info']['admin']['currentver'] = '1.5.001'; |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | |
52 | 52 | function admin_upgrade1_5_001() |
53 | 53 | { |
54 | - $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_remote',array( |
|
54 | + $GLOBALS['egw_setup']->oProc->CreateTable('egw_admin_remote', array( |
|
55 | 55 | 'fd' => array( |
56 | 56 | 'remote_id' => array('type' => 'auto'), |
57 | - 'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False), |
|
58 | - 'remote_hash' => array('type' => 'varchar','precision' => '32','nullable' => False), |
|
59 | - 'remote_url' => array('type' => 'varchar','precision' => '128','nullable' => False), |
|
60 | - 'remote_domain' => array('type' => 'varchar','precision' => '64','nullable' => False) |
|
57 | + 'remote_name' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False), |
|
58 | + 'remote_hash' => array('type' => 'varchar', 'precision' => '32', 'nullable' => False), |
|
59 | + 'remote_url' => array('type' => 'varchar', 'precision' => '128', 'nullable' => False), |
|
60 | + 'remote_domain' => array('type' => 'varchar', 'precision' => '64', 'nullable' => False) |
|
61 | 61 | ), |
62 | 62 | 'pk' => array('remote_id'), |
63 | 63 | 'fk' => array(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | function admin_upgrade1_5_002() |
73 | 73 | { |
74 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_admin_queue','remote_id',array( |
|
74 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_admin_queue', 'remote_id', array( |
|
75 | 75 | 'type' => 'int', |
76 | 76 | 'precision' => '4' |
77 | 77 | )); |
@@ -110,18 +110,18 @@ discard block |
||
110 | 110 | |
111 | 111 | function admin_upgrade14_1() |
112 | 112 | { |
113 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_uid',array( |
|
113 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_uid', array( |
|
114 | 114 | 'type' => 'ascii', |
115 | 115 | 'precision' => '64', |
116 | 116 | 'nullable' => False |
117 | 117 | )); |
118 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_type',array( |
|
118 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_type', array( |
|
119 | 119 | 'type' => 'ascii', |
120 | 120 | 'precision' => '32', |
121 | 121 | 'nullable' => False, |
122 | 122 | 'default' => 'admin_cmd' |
123 | 123 | )); |
124 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue','cmd_data',array( |
|
124 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_queue', 'cmd_data', array( |
|
125 | 125 | 'type' => 'ascii', |
126 | 126 | 'precision' => '16384' |
127 | 127 | )); |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | |
133 | 133 | function admin_upgrade14_2_001() |
134 | 134 | { |
135 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_hash',array( |
|
135 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_hash', array( |
|
136 | 136 | 'type' => 'ascii', |
137 | 137 | 'precision' => '32', |
138 | 138 | 'nullable' => False |
139 | 139 | )); |
140 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_url',array( |
|
140 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_url', array( |
|
141 | 141 | 'type' => 'ascii', |
142 | 142 | 'precision' => '128', |
143 | 143 | 'nullable' => False |
144 | 144 | )); |
145 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote','remote_domain',array( |
|
145 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_admin_remote', 'remote_domain', array( |
|
146 | 146 | 'type' => 'ascii', |
147 | 147 | 'precision' => '64', |
148 | 148 | 'nullable' => False |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | // asuming everythings not MySQL uses PostgreSQL regular expression syntax |
162 | 162 | $regexp = substr($GLOBALS['egw_setup']->db->Type, 0, 5) == 'mysql' ? 'REGEXP' : '~*'; |
163 | 163 | |
164 | - foreach($GLOBALS['egw_setup']->db->select('egw_admin_queue', 'cmd_id,cmd_data', |
|
164 | + foreach ($GLOBALS['egw_setup']->db->select('egw_admin_queue', 'cmd_id,cmd_data', |
|
165 | 165 | 'cmd_status NOT IN ('.implode(',', admin_cmd::$require_pw_stati).") AND cmd_data $regexp '(pw|passwd\\_?\\d*|password|db\\_pass)\\?\"'", |
166 | 166 | __LINE__, __FILE__, false, '', 'admin') as $row) |
167 | 167 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @param string|int|array $account account name or id, or array with all parameters |
24 | 24 | * @param string $password =null password |
25 | 25 | */ |
26 | - function __construct($account,$password=null) |
|
26 | + function __construct($account, $password = null) |
|
27 | 27 | { |
28 | 28 | if (!is_array($account)) |
29 | 29 | { |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | * @throws Api\Exception\WrongUserinput(lang("Unknown account: %1 !!!",$this->account),15); |
45 | 45 | * @throws Api\Exception\WrongUserinput(lang('Error changing the password for %1 !!!',$this->account),99); |
46 | 46 | */ |
47 | - protected function exec($check_only=false) |
|
47 | + protected function exec($check_only = false) |
|
48 | 48 | { |
49 | - $account_id = admin_cmd::parse_account($this->account,true); // true = user, no group |
|
49 | + $account_id = admin_cmd::parse_account($this->account, true); // true = user, no group |
|
50 | 50 | // check creator is still admin and not explicitly forbidden to edit Api\Accounts |
51 | - if ($this->creator) $this->_check_admin('account_access',16); |
|
51 | + if ($this->creator) $this->_check_admin('account_access', 16); |
|
52 | 52 | |
53 | 53 | if ($check_only) return true; |
54 | 54 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (!$auth->change_password(null, $this->password, $account_id)) |
58 | 58 | { |
59 | 59 | // as long as the Api\Auth class is not throwing itself ... |
60 | - throw new Exception(lang('Error changing the password for %1 !!!',$this->account),99); |
|
60 | + throw new Exception(lang('Error changing the password for %1 !!!', $this->account), 99); |
|
61 | 61 | } |
62 | 62 | return lang('Password updated'); |
63 | 63 | } |
@@ -69,6 +69,6 @@ discard block |
||
69 | 69 | */ |
70 | 70 | function __tostring() |
71 | 71 | { |
72 | - return lang('change password for %1',admin_cmd::display_account($this->account)); |
|
72 | + return lang('change password for %1', admin_cmd::display_account($this->account)); |
|
73 | 73 | } |
74 | 74 | } |
@@ -48,9 +48,15 @@ |
||
48 | 48 | { |
49 | 49 | $account_id = admin_cmd::parse_account($this->account,true); // true = user, no group |
50 | 50 | // check creator is still admin and not explicitly forbidden to edit Api\Accounts |
51 | - if ($this->creator) $this->_check_admin('account_access',16); |
|
51 | + if ($this->creator) |
|
52 | + { |
|
53 | + $this->_check_admin('account_access',16); |
|
54 | + } |
|
52 | 55 | |
53 | - if ($check_only) return true; |
|
56 | + if ($check_only) |
|
57 | + { |
|
58 | + return true; |
|
59 | + } |
|
54 | 60 | |
55 | 61 | $auth = new Api\Auth; |
56 | 62 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * Constructor |
20 | 20 | * |
21 | 21 | * @param string/int/array $account account name or id, or array with all parameters |
22 | - * @param string $password=null password |
|
22 | + * @param string $password password |
|
23 | 23 | */ |
24 | 24 | function __construct($account,$password=null) |
25 | 25 | { |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * change the password of a given user |
38 | 38 | * |
39 | - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself |
|
39 | + * @param boolean $check_only only run the checks (and throw the exceptions), but not the command itself |
|
40 | 40 | * @return string success message |
41 | 41 | * @throws egw_exception_no_admin |
42 | 42 | * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15); |