@@ -49,10 +49,13 @@ discard block |
||
| 49 | 49 | $GLOBALS['egw_info']['setup']['stage']['header'] = $GLOBALS['egw_setup']->detection->check_header(); |
| 50 | 50 | if ($GLOBALS['egw_info']['setup']['stage']['header'] != '10') |
| 51 | 51 | { |
| 52 | - if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) // header needs update, go there direct |
|
| 52 | + if ($GLOBALS['egw_info']['setup']['stage']['header'] == 4) |
|
| 53 | + { |
|
| 54 | + // header needs update, go there direct |
|
| 53 | 55 | { |
| 54 | 56 | Header('Location: manageheader.php'); |
| 55 | 57 | } |
| 58 | + } |
|
| 56 | 59 | else // run check-install first |
| 57 | 60 | { |
| 58 | 61 | Header('Location: check_install.php?intro=1'); |
@@ -97,7 +100,9 @@ discard block |
||
| 97 | 100 | } |
| 98 | 101 | } |
| 99 | 102 | |
| 100 | -if ($GLOBALS['DEBUG']) { echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 103 | +if ($GLOBALS['DEBUG']) |
|
| 104 | +{ |
|
| 105 | +echo 'Stage: ' . $GLOBALS['egw_info']['setup']['stage']['db']; } |
|
| 101 | 106 | // begin DEBUG code |
| 102 | 107 | //$GLOBALS['egw_info']['setup']['stage']['db'] = 0; |
| 103 | 108 | //$action = 'Upgrade'; |
@@ -501,8 +506,14 @@ discard block |
||
| 501 | 506 | $msg = ''; |
| 502 | 507 | if ($to_upgrade || $to_install) |
| 503 | 508 | { |
| 504 | - if ($to_upgrade) $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
| 505 | - if ($to_install) $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
| 509 | + if ($to_upgrade) |
|
| 510 | + { |
|
| 511 | + $msg = '<b>'.lang('The following applications need to be upgraded:').'</b> '.implode(', ',$to_upgrade); |
|
| 512 | + } |
|
| 513 | + if ($to_install) |
|
| 514 | + { |
|
| 515 | + $msg .= ($msg?'<br />':'').'<b>'.lang('The following applications are required, but NOT installed:').'</b> '.implode(', ',$to_install); |
|
| 516 | + } |
|
| 506 | 517 | } |
| 507 | 518 | $btn_manage_apps = $GLOBALS['egw_setup']->html->make_frm_btn_simple( |
| 508 | 519 | $msg ? $msg : lang('This stage is completed<br />'), |
@@ -285,7 +285,10 @@ |
||
| 285 | 285 | $val = array2string($val); |
| 286 | 286 | break; |
| 287 | 287 | default: |
| 288 | - if (is_array($val)) $val = implode(', ', $val); |
|
| 288 | + if (is_array($val)) |
|
| 289 | + { |
|
| 290 | + $val = implode(', ', $val); |
|
| 291 | + } |
|
| 289 | 292 | break; |
| 290 | 293 | } |
| 291 | 294 | $setup_tpl->set_var('bg_color', $bgcolor[++$i & 1]); |
@@ -13,10 +13,13 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | chdir(dirname(__FILE__)); // to enable our relative pathes to work |
| 15 | 15 | |
| 16 | -if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
|
| 16 | +if (php_sapi_name() !== 'cli') |
|
| 17 | +{ |
|
| 18 | + // security precaution: forbit calling as web-page |
|
| 17 | 19 | { |
| 18 | 20 | die('<h1>setup/doc/chown.php must NOT be called as web-page --> exiting !!!</h1>'); |
| 19 | 21 | } |
| 22 | +} |
|
| 20 | 23 | |
| 21 | 24 | $recursive = false; |
| 22 | 25 | |
@@ -70,7 +73,10 @@ discard block |
||
| 70 | 73 | { |
| 71 | 74 | global $change; |
| 72 | 75 | |
| 73 | - if (is_null($stat) && !($stat = stat($path))) return false; |
|
| 76 | + if (is_null($stat) && !($stat = stat($path))) |
|
| 77 | + { |
|
| 78 | + return false; |
|
| 79 | + } |
|
| 74 | 80 | |
| 75 | 81 | if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
| 76 | 82 | { |
@@ -86,10 +92,12 @@ discard block |
||
| 86 | 92 | foreach(new DirectoryIterator($path) as $child) |
| 87 | 93 | { |
| 88 | 94 | if (!$child->isDot()) |
| 89 | - chown_grp($child->getPathname(), array( |
|
| 95 | + { |
|
| 96 | + chown_grp($child->getPathname(), array( |
|
| 90 | 97 | 'uid' => $child->getOwner(), |
| 91 | 98 | 'gid' => $child->getGroup(), |
| 92 | 99 | ), $recursive); |
| 100 | + } |
|
| 93 | 101 | } |
| 94 | 102 | } |
| 95 | 103 | } |
@@ -81,18 +81,26 @@ |
||
| 81 | 81 | |
| 82 | 82 | // step through every source code intstalled app |
| 83 | 83 | $egwdir = dir(EGW_INCLUDE_ROOT); |
| 84 | - while (false !== ($appdir = $egwdir->read())) { |
|
| 84 | + while (false !== ($appdir = $egwdir->read())) |
|
| 85 | + { |
|
| 85 | 86 | $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
| 86 | - if ( !is_dir( $defdir ) ) continue; |
|
| 87 | + if ( !is_dir( $defdir ) ) |
|
| 88 | + { |
|
| 89 | + continue; |
|
| 90 | + } |
|
| 87 | 91 | |
| 88 | 92 | // step through each file in defdir of app |
| 89 | 93 | $d = dir($defdir); |
| 90 | - while (false !== ($entry = $d->read())) { |
|
| 94 | + while (false !== ($entry = $d->read())) |
|
| 95 | + { |
|
| 91 | 96 | try |
| 92 | 97 | { |
| 93 | 98 | $file = $defdir. '/'. $entry; |
| 94 | 99 | list( $filename, $extension) = explode('.',$entry); |
| 95 | - if ( $extension != 'xml' ) continue; |
|
| 100 | + if ( $extension != 'xml' ) |
|
| 101 | + { |
|
| 102 | + continue; |
|
| 103 | + } |
|
| 96 | 104 | importexport_definitions_bo::import( $file ); |
| 97 | 105 | } |
| 98 | 106 | catch (Exception $e) |
@@ -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 | } |
@@ -24,7 +24,8 @@ |
||
| 24 | 24 | * So this interface just garanties the interaction with userinterfaces. It |
| 25 | 25 | * has nothing to do with datatypes. |
| 26 | 26 | */ |
| 27 | -interface importexport_iface_import_plugin { |
|
| 27 | +interface importexport_iface_import_plugin |
|
| 28 | +{ |
|
| 28 | 29 | |
| 29 | 30 | /** |
| 30 | 31 | * imports entries according to given definition object. |
@@ -90,14 +90,22 @@ discard block |
||
| 90 | 90 | /** |
| 91 | 91 | * Called from framework so Import / Export can add links into other apps' sidebox. |
| 92 | 92 | */ |
| 93 | - public static function other_apps() { |
|
| 94 | - if(!$GLOBALS['egw_info']['user']['apps']['importexport']) return array(); |
|
| 95 | - if($GLOBALS['egw_info']['flags']['no_importexport'] === true) return array(); |
|
| 93 | + public static function other_apps() |
|
| 94 | + { |
|
| 95 | + if(!$GLOBALS['egw_info']['user']['apps']['importexport']) |
|
| 96 | + { |
|
| 97 | + return array(); |
|
| 98 | + } |
|
| 99 | + if($GLOBALS['egw_info']['flags']['no_importexport'] === true) |
|
| 100 | + { |
|
| 101 | + return array(); |
|
| 102 | + } |
|
| 96 | 103 | |
| 97 | 104 | $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 98 | 105 | $cache = Api\Cache::getCache(Api\Cache::SESSION, 'importexport', 'sidebox_links'); |
| 99 | 106 | |
| 100 | - if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) { |
|
| 107 | + if(!$cache[$appname] && $GLOBALS['egw_info']['user']['apps']['importexport']) |
|
| 108 | + { |
|
| 101 | 109 | $cache[$appname]['import'] = importexport_helper_functions::has_definitions($appname, 'import'); |
| 102 | 110 | $cache[$appname]['export'] = importexport_helper_functions::has_definitions($appname, 'export'); |
| 103 | 111 | Api\Cache::setCache(Api\Cache::SESSION, 'importexport', 'sidebox_links', $cache); |
@@ -117,7 +125,8 @@ discard block |
||
| 117 | 125 | 'app' => 'importexport', |
| 118 | 126 | 'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['import']) > 1 ? 'Import' : 'Import CSV' |
| 119 | 127 | ); |
| 120 | - if($GLOBALS['egw_info']['flags']['disable_importexport']['import']) { |
|
| 128 | + if($GLOBALS['egw_info']['flags']['disable_importexport']['import']) |
|
| 129 | + { |
|
| 121 | 130 | $file['Import CSV']['link'] = ''; |
| 122 | 131 | } |
| 123 | 132 | } |
@@ -134,7 +143,8 @@ discard block |
||
| 134 | 143 | 'app' => 'importexport', |
| 135 | 144 | 'text' => in_array($appname, array('sitemgr')) || count($plugins[$appname]['export']) > 1 ? 'Export' : 'Export CSV' |
| 136 | 145 | ); |
| 137 | - if($GLOBALS['egw_info']['flags']['disable_importexport']['export']) { |
|
| 146 | + if($GLOBALS['egw_info']['flags']['disable_importexport']['export']) |
|
| 147 | + { |
|
| 138 | 148 | $file['Export CSV']['link'] = ''; |
| 139 | 149 | } |
| 140 | 150 | } |
@@ -142,15 +152,17 @@ discard block |
||
| 142 | 152 | $config = Api\Config::read('importexport'); |
| 143 | 153 | if($appname != 'admin' && ($config['users_create_definitions'] || $GLOBALS['egw_info']['user']['apps']['admin']) && |
| 144 | 154 | count(importexport_helper_functions::get_plugins($appname)) > 0 |
| 145 | - ) |
|
| 146 | - { |
|
| 155 | + ) { |
|
| 147 | 156 | $file['Define imports|exports'] = Egw::link('/index.php',array( |
| 148 | 157 | 'menuaction' => 'importexport.importexport_definitions_ui.index', |
| 149 | 158 | 'application' => $appname, |
| 150 | 159 | 'ajax' => 'true' |
| 151 | 160 | ),$GLOBALS['egw_info']['user']['apps']['admin'] ? 'admin' : 'preferences'); |
| 152 | 161 | } |
| 153 | - if($file) display_sidebox($appname,lang('importexport'),$file); |
|
| 162 | + if($file) |
|
| 163 | + { |
|
| 164 | + display_sidebox($appname,lang('importexport'),$file); |
|
| 165 | + } |
|
| 154 | 166 | } |
| 155 | 167 | |
| 156 | 168 | /** |
@@ -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; |
@@ -34,7 +34,8 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * get_selector(); //returns array |
| 36 | 36 | */ |
| 37 | -interface importexport_iface_export_plugin { |
|
| 37 | +interface importexport_iface_export_plugin |
|
| 38 | +{ |
|
| 38 | 39 | |
| 39 | 40 | /** |
| 40 | 41 | * exports entries according to given definition object. |