@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | // if we are NOT called as part of an update script, behave like a regular setup script |
| 13 | 13 | if (!isset($GLOBALS['egw_setup']) || !is_object($GLOBALS['egw_setup'])) |
| 14 | 14 | { |
| 15 | - $diagnostics = 1; // can be set to 0=non, 1=some (default for now), 2=all |
|
| 15 | + $diagnostics = 1; // can be set to 0=non, 1=some (default for now), 2=all |
|
| 16 | 16 | |
| 17 | 17 | include('./inc/functions.inc.php'); |
| 18 | 18 | // Authorize the user to use setup app and load the database |
@@ -25,50 +25,50 @@ discard block |
||
| 25 | 25 | $GLOBALS['egw_setup']->loaddb(); |
| 26 | 26 | |
| 27 | 27 | $tpl_root = $GLOBALS['egw_setup']->html->setup_tpl_dir('setup'); |
| 28 | - $setup_tpl = CreateObject('phpgwapi.Template',$tpl_root); |
|
| 28 | + $setup_tpl = CreateObject('phpgwapi.Template', $tpl_root); |
|
| 29 | 29 | $setup_tpl->set_file(array( |
| 30 | 30 | 'T_head' => 'head.tpl', |
| 31 | 31 | 'T_footer' => 'footer.tpl', |
| 32 | 32 | )); |
| 33 | - $GLOBALS['egw_setup']->html->show_header('',False,'config',$GLOBALS['egw_setup']->ConfigDomain . '(' . $GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'] . ')'); |
|
| 33 | + $GLOBALS['egw_setup']->html->show_header('', False, 'config', $GLOBALS['egw_setup']->ConfigDomain.'('.$GLOBALS['egw_domain'][$GLOBALS['egw_setup']->ConfigDomain]['db_type'].')'); |
|
| 34 | 34 | echo '<h3>'.'Fix mysql DB to match the eGroupWare system_charset'."</h3>\n"; |
| 35 | 35 | $running_standalone = true; |
| 36 | 36 | } |
| 37 | -$db =& $GLOBALS['egw_setup']->db; |
|
| 38 | -$charset2mysql =& $GLOBALS['egw_setup']->db->Link_ID->charset2mysql; |
|
| 37 | +$db = & $GLOBALS['egw_setup']->db; |
|
| 38 | +$charset2mysql = & $GLOBALS['egw_setup']->db->Link_ID->charset2mysql; |
|
| 39 | 39 | $mysql2charset = array_flip($charset2mysql); |
| 40 | 40 | |
| 41 | 41 | $ServerInfo = $db->Link_ID->ServerInfo(); |
| 42 | -$db_version = (float) $ServerInfo['version']; |
|
| 42 | +$db_version = (float)$ServerInfo['version']; |
|
| 43 | 43 | |
| 44 | 44 | if ($running_standalone || $_REQUEST['debug']) echo "<p>DB-Type='<b>{$GLOBALS['egw_setup']->db->Type}</b>', DB-Version=<b>$db_version</b> ($ServerInfo[description]), eGroupWare system_charset='<b>{$GLOBALS['egw_setup']->system_charset}</b>', DB-connection charset was '<b>{$GLOBALS['egw_setup']->db_charset_was}</b>'</p>\n"; |
| 45 | 45 | |
| 46 | 46 | $mysql_system_charset = isset($charset2mysql[$GLOBALS['egw_setup']->system_charset]) ? |
| 47 | 47 | $charset2mysql[$GLOBALS['egw_setup']->system_charset] : $GLOBALS['egw_setup']->system_charset; |
| 48 | 48 | |
| 49 | -if (substr($db->Type,0,5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was && |
|
| 49 | +if (substr($db->Type, 0, 5) == 'mysql' && $db_version >= 4.1 && $GLOBALS['egw_setup']->system_charset && $GLOBALS['egw_setup']->db_charset_was && |
|
| 50 | 50 | $GLOBALS['egw_setup']->system_charset != $GLOBALS['egw_setup']->db_charset_was) |
| 51 | 51 | { |
| 52 | 52 | $tables_modified = 'no'; |
| 53 | 53 | |
| 54 | 54 | $tables = array(); |
| 55 | - $db->query("SHOW TABLE STATUS",__LINE__,__FILE__); |
|
| 55 | + $db->query("SHOW TABLE STATUS", __LINE__, __FILE__); |
|
| 56 | 56 | while (($row = $db->row(true))) |
| 57 | 57 | { |
| 58 | 58 | $tables[$row['Name']] = $row['Collation']; |
| 59 | 59 | } |
| 60 | - foreach($tables as $table => $collation) |
|
| 60 | + foreach ($tables as $table => $collation) |
|
| 61 | 61 | { |
| 62 | 62 | $columns = array(); |
| 63 | - $db->query("SHOW FULL FIELDS FROM `$table`",__LINE__,__FILE__); |
|
| 64 | - while(($row = $db->row(true))) |
|
| 63 | + $db->query("SHOW FULL FIELDS FROM `$table`", __LINE__, __FILE__); |
|
| 64 | + while (($row = $db->row(true))) |
|
| 65 | 65 | { |
| 66 | 66 | $columns[] = $row; |
| 67 | 67 | } |
| 68 | 68 | //echo $table; _debug_array($columns); |
| 69 | 69 | $fulltext = $fulltext_back = array(); |
| 70 | - $db->query("SHOW KEYS FROM `$table`",__LINE__,__FILE__); |
|
| 71 | - while(($row = $db->row(true))) |
|
| 70 | + $db->query("SHOW KEYS FROM `$table`", __LINE__, __FILE__); |
|
| 71 | + while (($row = $db->row(true))) |
|
| 72 | 72 | { |
| 73 | 73 | if ($row['Index_type'] == 'FULLTEXT') |
| 74 | 74 | { |
@@ -77,12 +77,12 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $alter_table = $alter_table_back = array(); |
| 80 | - foreach($columns as $column) |
|
| 80 | + foreach ($columns as $column) |
|
| 81 | 81 | { |
| 82 | - if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i',$column['Type'],$matches)) |
|
| 82 | + if ($column['Collation'] && preg_match('/^(char|varchar|.*text)\(?([0-9]*)\)?$/i', $column['Type'], $matches)) |
|
| 83 | 83 | { |
| 84 | - list(,$type,$size) = $matches; |
|
| 85 | - list($charset) = explode('_',$column['Collation']); |
|
| 84 | + list(,$type, $size) = $matches; |
|
| 85 | + list($charset) = explode('_', $column['Collation']); |
|
| 86 | 86 | |
| 87 | 87 | if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
| 88 | 88 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | else |
| 99 | 99 | { |
| 100 | - $bintype = str_replace('text','blob',$type); |
|
| 100 | + $bintype = str_replace('text', 'blob', $type); |
|
| 101 | 101 | } |
| 102 | 102 | //echo "<p>$table.$col $type CHARACTER SET $charset $default $null</p>\n"; |
| 103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $idx_name = $fulltext[$col]; |
| 110 | 110 | $idx_cols = array(); |
| 111 | - foreach($fulltext as $c => $i) |
|
| 111 | + foreach ($fulltext as $c => $i) |
|
| 112 | 112 | { |
| 113 | 113 | if ($i == $idx_name) |
| 114 | 114 | { |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - list($charset) = explode('_',$collation); |
|
| 127 | + list($charset) = explode('_', $collation); |
|
| 128 | 128 | if (isset($mysql2charset[$charset])) $charset = $mysql2charset[$charset]; |
| 129 | 129 | if ($charset != $GLOBALS['egw_setup']->system_charset) |
| 130 | 130 | { |
@@ -132,26 +132,26 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | if (count($alter_table)) |
| 134 | 134 | { |
| 135 | - $alter_table = "ALTER TABLE $table\n".implode(",\n",$alter_table); |
|
| 135 | + $alter_table = "ALTER TABLE $table\n".implode(",\n", $alter_table); |
|
| 136 | 136 | |
| 137 | 137 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table)."</p>\n"; |
| 138 | - if (!$db->query($alter_table,__LINE__,__FILE__)) |
|
| 138 | + if (!$db->query($alter_table, __LINE__, __FILE__)) |
|
| 139 | 139 | { |
| 140 | 140 | echo "<p>SQL Error: ".nl2br($alter_table)."</p>\n"; |
| 141 | 141 | echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n"; |
| 142 | 142 | echo "<p>continuing ...</p>\n"; |
| 143 | 143 | continue; |
| 144 | 144 | } |
| 145 | - foreach($fulltext_back as $idx_name => $idx_cols) |
|
| 145 | + foreach ($fulltext_back as $idx_name => $idx_cols) |
|
| 146 | 146 | { |
| 147 | - $alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`',$idx_cols)."`)"; |
|
| 147 | + $alter_table_back[] = " ADD FULLTEXT `$idx_name` (`".implode('`,`', $idx_cols)."`)"; |
|
| 148 | 148 | } |
| 149 | 149 | if (count($alter_table_back)) |
| 150 | 150 | { |
| 151 | - $alter_table_back = "ALTER TABLE $table\n".implode(",\n",$alter_table_back); |
|
| 151 | + $alter_table_back = "ALTER TABLE $table\n".implode(",\n", $alter_table_back); |
|
| 152 | 152 | |
| 153 | 153 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.nl2br($alter_table_back)."</p>\n"; |
| 154 | - if (!$db->query($alter_table_back,__LINE__,__FILE__)) |
|
| 154 | + if (!$db->query($alter_table_back, __LINE__, __FILE__)) |
|
| 155 | 155 | { |
| 156 | 156 | echo "<p><b>SQL Error</b>: ".nl2br($alter_table_back)."</p>\n"; |
| 157 | 157 | echo "<b>{$db->Type} Error</b>: {$db->Errno} ({$db->Error})</p>\n"; |
@@ -163,13 +163,13 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | // change the default charset of the DB |
| 166 | - $db->query("SHOW CREATE DATABASE `$db->Database`",__LINE__,__FILE__); |
|
| 166 | + $db->query("SHOW CREATE DATABASE `$db->Database`", __LINE__, __FILE__); |
|
| 167 | 167 | $create_db = $db->next_record() ? $db->f(1) : ''; |
| 168 | - if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i',$create_db,$matches) && $matches[1] != $mysql_system_charset) |
|
| 168 | + if (preg_match('/CHARACTER SET ([a-z1-9_-]+) /i', $create_db, $matches) && $matches[1] != $mysql_system_charset) |
|
| 169 | 169 | { |
| 170 | 170 | $alter_db = "ALTER DATABASE `$db->Database` DEFAULT CHARACTER SET $mysql_system_charset"; |
| 171 | 171 | if ($running_standalone || $_REQUEST['debug']) echo '<p>'.$alter_db."</p>\n"; |
| 172 | - $db->query($alter_db,__LINE__,__FILE__); |
|
| 172 | + $db->query($alter_db, __LINE__, __FILE__); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | if ($running_standalone || $_REQUEST['debug']) |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param string $config_passwd=null pw of above user |
| 24 | 24 | * @param boolean $verbose=false if true, echos out some status information during the run |
| 25 | 25 | */ |
| 26 | - function __construct($domain,$config_user=null,$config_passwd=null) |
|
| 26 | + function __construct($domain, $config_user = null, $config_passwd = null) |
|
| 27 | 27 | { |
| 28 | 28 | if (!is_array($domain)) |
| 29 | 29 | { |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 46 | 46 | * @throws Exception('header.inc.php not found!'); |
| 47 | 47 | */ |
| 48 | - protected function exec($check_only=false) |
|
| 48 | + protected function exec($check_only = false) |
|
| 49 | 49 | { |
| 50 | - if ($check_only) return true; // nothing to check, no arguments ... |
|
| 50 | + if ($check_only) return true; // nothing to check, no arguments ... |
|
| 51 | 51 | |
| 52 | 52 | // instanciate setup object and check authorisation |
| 53 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
| 53 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
| 54 | 54 | |
| 55 | - $this->check_installed($this->domain,15,$this->verbose); |
|
| 55 | + $this->check_installed($this->domain, 15, $this->verbose); |
|
| 56 | 56 | |
| 57 | 57 | global $setup_info; |
| 58 | - foreach($setup_info as $appname => $info) |
|
| 58 | + foreach ($setup_info as $appname => $info) |
|
| 59 | 59 | { |
| 60 | 60 | if ($info['currentver']) self::$egw_setup->register_hooks($appname); |
| 61 | 61 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | function vfs_storage_mode_options($config) |
| 22 | 22 | { |
| 23 | - if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default=array( |
|
| 23 | + if (!isset($config['vfs_fstab']) || $config['vfs_fstab'] == json_encode($default = array( |
|
| 24 | 24 | '/' => 'sqlfs://$host/', |
| 25 | 25 | '/apps' => 'links://$host/apps', |
| 26 | 26 | )) || $config['vfs_fstab'] == serialize($default)) // detect old serialized value too |
| 27 | 27 | { |
| 28 | 28 | $config['vfs_storage_mode'] = 'fs'; |
| 29 | 29 | } |
| 30 | - elseif($config['vfs_fstab'] == json_encode($default_db=array( |
|
| 30 | + elseif ($config['vfs_fstab'] == json_encode($default_db = array( |
|
| 31 | 31 | '/' => 'sqlfs://$host/?storage=db', |
| 32 | 32 | '/apps' => 'links://$host/apps?storage=db', |
| 33 | 33 | )) || $config['vfs_fstab'] == serialize($default_db)) // detect old serialized value too |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $config['vfs_storage_mode'] = 'custom'; |
| 40 | 40 | } |
| 41 | 41 | //_debug_array(array_intersect_key($config,array('vfs_fstab'=>1,'vfs_storage_mode'=>1))); |
| 42 | - foreach(array( |
|
| 42 | + foreach (array( |
|
| 43 | 43 | 'fs' => lang('Filesystem (default)'), |
| 44 | 44 | 'db' => lang('Database').' (problems with files > 1MB)', |
| 45 | - 'custom' => lang('Custom set via %1','filemanager/cli.php mount'), |
|
| 45 | + 'custom' => lang('Custom set via %1', 'filemanager/cli.php mount'), |
|
| 46 | 46 | ) as $name => $label) |
| 47 | 47 | { |
| 48 | 48 | if ($name != 'custom' || $name === $config['vfs_storage_mode']) // dont show custom, if not custom |
@@ -57,24 +57,24 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | function encryptalgo($config) |
| 59 | 59 | { |
| 60 | - if(@function_exists('mcrypt_list_algorithms')) |
|
| 60 | + if (@function_exists('mcrypt_list_algorithms')) |
|
| 61 | 61 | { |
| 62 | 62 | $listed = array(); |
| 63 | - if(!isset($config['mcrypt_algo'])) |
|
| 63 | + if (!isset($config['mcrypt_algo'])) |
|
| 64 | 64 | { |
| 65 | - $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
| 65 | + $config['mcrypt_algo'] = 'tripledes'; /* MCRYPT_TRIPLEDES */ |
|
| 66 | 66 | } |
| 67 | 67 | $algos = @mcrypt_list_algorithms(); |
| 68 | 68 | $found = False; |
| 69 | 69 | |
| 70 | 70 | $out = ''; |
| 71 | - while(list($key,$value) = each($algos)) |
|
| 71 | + while (list($key, $value) = each($algos)) |
|
| 72 | 72 | { |
| 73 | 73 | $found = True; |
| 74 | 74 | /* Only show each once - seems this is a problem in some installs */ |
| 75 | - if(!in_array($value,$listed)) |
|
| 75 | + if (!in_array($value, $listed)) |
|
| 76 | 76 | { |
| 77 | - if($config['mcrypt_algo'] == $value) |
|
| 77 | + if ($config['mcrypt_algo'] == $value) |
|
| 78 | 78 | { |
| 79 | 79 | $selected = ' selected="selected"'; |
| 80 | 80 | } |
@@ -84,29 +84,29 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | $descr = strtoupper($value); |
| 86 | 86 | |
| 87 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
| 87 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
| 88 | 88 | $listed[] = $value; |
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | - if(!$found) |
|
| 91 | + if (!$found) |
|
| 92 | 92 | { |
| 93 | 93 | /* Something is wrong with their mcrypt install or php.ini */ |
| 94 | - $out = '<option value="">' . lang('no algorithms available') . '</option>' . "\n"; |
|
| 94 | + $out = '<option value="">'.lang('no algorithms available').'</option>'."\n"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | else |
| 98 | 98 | { |
| 99 | - $out = '<option value="tripledes">TRIPLEDES</option>' . "\n"; |
|
| 99 | + $out = '<option value="tripledes">TRIPLEDES</option>'."\n"; |
|
| 100 | 100 | } |
| 101 | 101 | return $out; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | function encryptmode($config) |
| 105 | 105 | { |
| 106 | - if(@function_exists('mcrypt_list_modes')) |
|
| 106 | + if (@function_exists('mcrypt_list_modes')) |
|
| 107 | 107 | { |
| 108 | 108 | $listed = array(); |
| 109 | - if(!isset($config['mcrypt_mode'])) |
|
| 109 | + if (!isset($config['mcrypt_mode'])) |
|
| 110 | 110 | { |
| 111 | 111 | $config['mcrypt_mode'] = 'cbc'; /* MCRYPT_MODE_CBC */ |
| 112 | 112 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | $found = False; |
| 115 | 115 | |
| 116 | 116 | $out = ''; |
| 117 | - while(list($key,$value) = each($modes)) |
|
| 117 | + while (list($key, $value) = each($modes)) |
|
| 118 | 118 | { |
| 119 | 119 | $found = True; |
| 120 | 120 | /* Only show each once - seems this is a problem in some installs */ |
| 121 | - if(!in_array($value,$listed)) |
|
| 121 | + if (!in_array($value, $listed)) |
|
| 122 | 122 | { |
| 123 | - if($config['mcrypt_mode'] == $value) |
|
| 123 | + if ($config['mcrypt_mode'] == $value) |
|
| 124 | 124 | { |
| 125 | 125 | $selected = ' selected="selected"'; |
| 126 | 126 | } |
@@ -130,34 +130,34 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | $descr = strtoupper($value); |
| 132 | 132 | |
| 133 | - $out .= '<option value="' . $value . '"' . $selected . '>' . $descr . '</option>' . "\n"; |
|
| 133 | + $out .= '<option value="'.$value.'"'.$selected.'>'.$descr.'</option>'."\n"; |
|
| 134 | 134 | $listed[] = $value; |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | - if(!$found) |
|
| 137 | + if (!$found) |
|
| 138 | 138 | { |
| 139 | 139 | /* Something is wrong with their mcrypt install or php.ini */ |
| 140 | - $out = '<option value="" selected="selected">' . lang('no modes available') . '</option>' . "\n"; |
|
| 140 | + $out = '<option value="" selected="selected">'.lang('no modes available').'</option>'."\n"; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | else |
| 144 | 144 | { |
| 145 | - $out = '<option value="cbc" selected="selected">CBC</option>' . "\n"; |
|
| 145 | + $out = '<option value="cbc" selected="selected">CBC</option>'."\n"; |
|
| 146 | 146 | } |
| 147 | 147 | return $out; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | -function passwdhashes($config,$return_hashes=false) |
|
| 150 | +function passwdhashes($config, $return_hashes = false) |
|
| 151 | 151 | { |
| 152 | - $hashes = sql_passwdhashes($config,true); |
|
| 152 | + $hashes = sql_passwdhashes($config, true); |
|
| 153 | 153 | if (isset($hashes['crypt'])) |
| 154 | 154 | { |
| 155 | - $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
| 155 | + $hashes['des'] = 'des (=crypt)'; // old LDAP name for crypt |
|
| 156 | 156 | } |
| 157 | 157 | return $return_hashes ? $hashes : _options_from($hashes, $config['ldap_encryption_type'] ? $config['ldap_encryption_type'] : 'des'); |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | -function sql_passwdhashes($config, $return_hashes=false, &$securest=null) |
|
| 160 | +function sql_passwdhashes($config, $return_hashes = false, &$securest = null) |
|
| 161 | 161 | { |
| 162 | 162 | $hashes = Api\Auth::passwdhashes($securest); |
| 163 | 163 | |
@@ -172,19 +172,19 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | function auth_types($config) |
| 174 | 174 | { |
| 175 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type']); |
|
| 175 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type']); |
|
| 176 | 176 | } |
| 177 | 177 | function auth_type_syncml($config) |
| 178 | 178 | { |
| 179 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_syncml']); |
|
| 179 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_syncml']); |
|
| 180 | 180 | } |
| 181 | 181 | function auth_type_groupdav($config) |
| 182 | 182 | { |
| 183 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_groupdav']); |
|
| 183 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_groupdav']); |
|
| 184 | 184 | } |
| 185 | 185 | function auth_type_activesync($config) |
| 186 | 186 | { |
| 187 | - return _options_from(setup_cmd_config::auth_types(),$config['auth_type_activesync']); |
|
| 187 | + return _options_from(setup_cmd_config::auth_types(), $config['auth_type_activesync']); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | * @param string $selected value of selected optino |
| 206 | 206 | * @return string |
| 207 | 207 | */ |
| 208 | -function _options_from(array $options,$selected) |
|
| 208 | +function _options_from(array $options, $selected) |
|
| 209 | 209 | { |
| 210 | - foreach($options as $value => $label) |
|
| 210 | + foreach ($options as $value => $label) |
|
| 211 | 211 | { |
| 212 | - $out .= '<option value="' . htmlspecialchars($value) . '"' . |
|
| 213 | - ($selected == $value ? ' selected="selected"' : '') . '>' . $label . '</option>' . "\n"; |
|
| 212 | + $out .= '<option value="'.htmlspecialchars($value).'"'. |
|
| 213 | + ($selected == $value ? ' selected="selected"' : '').'>'.$label.'</option>'."\n"; |
|
| 214 | 214 | } |
| 215 | 215 | return $out; |
| 216 | 216 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * @param boolean $verbose =false if true, echos out some status information during the run |
| 31 | 31 | * @param string $app =null single application to update or install |
| 32 | 32 | */ |
| 33 | - function __construct($domain,$config_user=null,$config_passwd=null,$backup=null,$verbose=false,$app=null) |
|
| 33 | + function __construct($domain, $config_user = null, $config_passwd = null, $backup = null, $verbose = false, $app = null) |
|
| 34 | 34 | { |
| 35 | 35 | if (!is_array($domain)) |
| 36 | 36 | { |
@@ -55,32 +55,32 @@ discard block |
||
| 55 | 55 | * @throws Exception(lang('Wrong credentials to access the header.inc.php file!'),2); |
| 56 | 56 | * @throws Exception('header.inc.php not found!'); |
| 57 | 57 | */ |
| 58 | - protected function exec($check_only=false) |
|
| 58 | + protected function exec($check_only = false) |
|
| 59 | 59 | { |
| 60 | 60 | global $setup_info; |
| 61 | 61 | |
| 62 | 62 | // instanciate setup object and check authorisation |
| 63 | - $this->check_setup_auth($this->config_user,$this->config_passwd,$this->domain); |
|
| 63 | + $this->check_setup_auth($this->config_user, $this->config_passwd, $this->domain); |
|
| 64 | 64 | |
| 65 | - $this->check_installed($this->domain,array(14),$this->verbose); |
|
| 65 | + $this->check_installed($this->domain, array(14), $this->verbose); |
|
| 66 | 66 | |
| 67 | 67 | if ($GLOBALS['egw_info']['setup']['stage']['db'] != 4 && |
| 68 | 68 | (!$this->app || !in_array($this->app, self::$apps_to_install) && !in_array($this->app, self::$apps_to_upgrade)) && |
| 69 | 69 | !self::check_autoinstall()) |
| 70 | 70 | { |
| 71 | - return lang('No update necessary, domain %1(%2) is up to date.',$this->domain,$GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
| 71 | + return lang('No update necessary, domain %1(%2) is up to date.', $this->domain, $GLOBALS['egw_domain'][$this->domain]['db_type']); |
|
| 72 | 72 | } |
| 73 | 73 | if ($check_only) return lang('Update necessary.'); |
| 74 | 74 | |
| 75 | 75 | $setup_info = self::$egw_setup->detection->upgrade_exclude($setup_info); |
| 76 | 76 | |
| 77 | - self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
| 77 | + self::$egw_setup->process->init_process(); // we need a new schema-proc instance for each new domain |
|
| 78 | 78 | |
| 79 | 79 | // request to install a single app |
| 80 | 80 | if ($this->app && in_array($this->app, self::$apps_to_install)) |
| 81 | 81 | { |
| 82 | 82 | $app_title = $setup_info[$this->app]['title'] ? $setup_info[$this->app]['title'] : $setup_info[$this->app]['name']; |
| 83 | - self::_echo_message($this->verbose,lang('Start installing application %1 ...',$app_title)); |
|
| 83 | + self::_echo_message($this->verbose, lang('Start installing application %1 ...', $app_title)); |
|
| 84 | 84 | ob_start(); |
| 85 | 85 | $terror = array($this->app => $setup_info[$this->app]); |
| 86 | 86 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $errors = self::$egw_setup->process->current($terror, $this->verbose); |
| 90 | 90 | $terror = self::$egw_setup->process->default_records($errors, $this->verbose); |
| 91 | - echo $app_title . ' ' . lang('tables installed, unless there are errors printed above') . '.'; |
|
| 91 | + echo $app_title.' '.lang('tables installed, unless there are errors printed above').'.'; |
|
| 92 | 92 | } |
| 93 | 93 | else |
| 94 | 94 | { |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | self::$egw_setup->register_app($setup_info[$this->app]['name']); |
| 104 | 104 | } |
| 105 | - echo $app_title . ' ' . lang('registered') . '.'; |
|
| 105 | + echo $app_title.' '.lang('registered').'.'; |
|
| 106 | 106 | |
| 107 | 107 | if ($setup_info[$this->app]['hooks']) |
| 108 | 108 | { |
| 109 | 109 | self::$egw_setup->register_hooks($setup_info[$this->app]['name']); |
| 110 | - echo "\n".$app_title . ' ' . lang('hooks registered') . '.'; |
|
| 110 | + echo "\n".$app_title.' '.lang('hooks registered').'.'; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | else |
| 115 | 115 | { |
| 116 | - self::_echo_message($this->verbose,lang('Start updating the database ...')); |
|
| 116 | + self::_echo_message($this->verbose, lang('Start updating the database ...')); |
|
| 117 | 117 | ob_start(); |
| 118 | - self::$egw_setup->process->pass($setup_info,'upgrade',false); |
|
| 118 | + self::$egw_setup->process->pass($setup_info, 'upgrade', false); |
|
| 119 | 119 | } |
| 120 | 120 | $messages = ob_get_contents(); |
| 121 | 121 | ob_end_clean(); |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @version $Id$ |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 14 | +chdir(dirname(__FILE__)); // to enable our relative pathes to work |
|
| 15 | 15 | |
| 16 | 16 | if (php_sapi_name() !== 'cli') // security precaution: forbit calling as web-page |
| 17 | 17 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | $ids = explode(',', $_SERVER['argv'][0]); |
| 41 | 41 | $change = array(); |
| 42 | -while($ids) |
|
| 42 | +while ($ids) |
|
| 43 | 43 | { |
| 44 | 44 | $from = (int)array_shift($ids); |
| 45 | 45 | $to = (int)array_shift($ids); |
@@ -66,24 +66,24 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | chown_grp($path, null, $recursive); |
| 68 | 68 | |
| 69 | -function chown_grp($path, array $stat=null, $recursive=false) |
|
| 69 | +function chown_grp($path, array $stat = null, $recursive = false) |
|
| 70 | 70 | { |
| 71 | 71 | global $change; |
| 72 | 72 | |
| 73 | 73 | if (is_null($stat) && !($stat = stat($path))) return false; |
| 74 | 74 | |
| 75 | - if (isset($change[$stat['uid']]) && !chown($path, $uid=$change[$stat['uid']])) |
|
| 75 | + if (isset($change[$stat['uid']]) && !chown($path, $uid = $change[$stat['uid']])) |
|
| 76 | 76 | { |
| 77 | 77 | echo "Faild to set new owner #$uid for $path\n"; |
| 78 | 78 | } |
| 79 | - if (isset($change[-$stat['gid']]) && !chgrp($path, $gid=-$change[-$stat['gid']])) |
|
| 79 | + if (isset($change[-$stat['gid']]) && !chgrp($path, $gid = -$change[-$stat['gid']])) |
|
| 80 | 80 | { |
| 81 | 81 | echo "Faild to set new group #$gid for $path\n"; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ($recursive && is_dir($path)) |
| 85 | 85 | { |
| 86 | - foreach(new DirectoryIterator($path) as $child) |
|
| 86 | + foreach (new DirectoryIterator($path) as $child) |
|
| 87 | 87 | { |
| 88 | 88 | if (!$child->isDot()) |
| 89 | 89 | chown_grp($child->getPathname(), array( |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | 'name' => 'eGroupware core team', |
| 21 | 21 | 'email' => '[email protected]' |
| 22 | 22 | ); |
| 23 | -$setup_info['importexport']['autoinstall'] = true; // install automatically on update |
|
| 23 | +$setup_info['importexport']['autoinstall'] = true; // install automatically on update |
|
| 24 | 24 | |
| 25 | -$setup_info['importexport']['license'] = 'GPL'; |
|
| 25 | +$setup_info['importexport']['license'] = 'GPL'; |
|
| 26 | 26 | $setup_info['importexport']['description'] = |
| 27 | 27 | ''; |
| 28 | 28 | $setup_info['importexport']['note'] = |
@@ -12,15 +12,15 @@ |
||
| 12 | 12 | $phpgw_baseline = array( |
| 13 | 13 | 'egw_importexport_definitions' => array( |
| 14 | 14 | 'fd' => array( |
| 15 | - 'definition_id' => array('type' => 'auto','nullable' => False), |
|
| 16 | - 'name' => array('type' => 'varchar','precision' => '255'), |
|
| 17 | - 'application' => array('type' => 'varchar','precision' => '50'), |
|
| 18 | - 'plugin' => array('type' => 'varchar','precision' => '100'), |
|
| 19 | - 'type' => array('type' => 'varchar','precision' => '20'), |
|
| 20 | - 'allowed_users' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255'), |
|
| 15 | + 'definition_id' => array('type' => 'auto', 'nullable' => False), |
|
| 16 | + 'name' => array('type' => 'varchar', 'precision' => '255'), |
|
| 17 | + 'application' => array('type' => 'varchar', 'precision' => '50'), |
|
| 18 | + 'plugin' => array('type' => 'varchar', 'precision' => '100'), |
|
| 19 | + 'type' => array('type' => 'varchar', 'precision' => '20'), |
|
| 20 | + 'allowed_users' => array('type' => 'varchar', 'meta' => 'account-commasep', 'precision' => '255'), |
|
| 21 | 21 | 'plugin_options' => array('type' => 'longtext'), |
| 22 | - 'owner' => array('type' => 'int','meta' => 'account','precision' => '4'), |
|
| 23 | - 'description' => array('type' => 'varchar','precision' => '255'), |
|
| 22 | + 'owner' => array('type' => 'int', 'meta' => 'account', 'precision' => '4'), |
|
| 23 | + 'description' => array('type' => 'varchar', 'precision' => '255'), |
|
| 24 | 24 | 'modified' => array('type' => 'timestamp'), |
| 25 | 25 | 'filter' => array('type' => 'longtext') |
| 26 | 26 | ), |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | function importexport_upgrade0_002() |
| 15 | 15 | { |
| 16 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','description',array( |
|
| 16 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'description', array( |
|
| 17 | 17 | 'type' => 'varchar', |
| 18 | 18 | 'precision' => '255' |
| 19 | 19 | )); |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | function importexport_upgrade1_8() |
| 46 | 46 | { |
| 47 | - $GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions','definition_id',array( |
|
| 47 | + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_importexport_definitions', 'definition_id', array( |
|
| 48 | 48 | 'type' => 'auto', |
| 49 | 49 | 'nullable' => False |
| 50 | 50 | )); |
| 51 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','modified',array( |
|
| 51 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'modified', array( |
|
| 52 | 52 | 'type' => 'timestamp' |
| 53 | 53 | )); |
| 54 | 54 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | function importexport_upgrade1_9_002() |
| 65 | 65 | { |
| 66 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array( |
|
| 66 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array( |
|
| 67 | 67 | 'type' => 'longtext' |
| 68 | 68 | )); |
| 69 | 69 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | // import i/e defintions |
| 75 | 75 | if (extension_loaded('dom')) |
| 76 | 76 | { |
| 77 | - require_once(EGW_INCLUDE_ROOT. '/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
| 77 | + require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.importexport_definitions_bo.inc.php'); |
|
| 78 | 78 | |
| 79 | 79 | // This sets up $GLOBALS['egw']->accounts and $GLOBALS['egw']->db |
| 80 | 80 | $GLOBALS['egw_setup']->setup_account_object(); |
@@ -82,18 +82,18 @@ discard block |
||
| 82 | 82 | // step through every source code intstalled app |
| 83 | 83 | $egwdir = dir(EGW_INCLUDE_ROOT); |
| 84 | 84 | while (false !== ($appdir = $egwdir->read())) { |
| 85 | - $defdir = EGW_INCLUDE_ROOT. "/$appdir/setup/"; |
|
| 86 | - if ( !is_dir( $defdir ) ) continue; |
|
| 85 | + $defdir = EGW_INCLUDE_ROOT."/$appdir/setup/"; |
|
| 86 | + if (!is_dir($defdir)) continue; |
|
| 87 | 87 | |
| 88 | 88 | // step through each file in defdir of app |
| 89 | 89 | $d = dir($defdir); |
| 90 | 90 | while (false !== ($entry = $d->read())) { |
| 91 | 91 | try |
| 92 | 92 | { |
| 93 | - $file = $defdir. '/'. $entry; |
|
| 94 | - list( $filename, $extension) = explode('.',$entry); |
|
| 95 | - if ( $extension != 'xml' ) continue; |
|
| 96 | - importexport_definitions_bo::import( $file ); |
|
| 93 | + $file = $defdir.'/'.$entry; |
|
| 94 | + list($filename, $extension) = explode('.', $entry); |
|
| 95 | + if ($extension != 'xml') continue; |
|
| 96 | + importexport_definitions_bo::import($file); |
|
| 97 | 97 | } |
| 98 | 98 | catch (Exception $e) |
| 99 | 99 | { |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | // give Default and Admins group rights for ImportExport |
| 107 | - foreach(array('Default' => 'Default','Admins' => 'Admin') as $account_lid => $name) |
|
| 107 | + foreach (array('Default' => 'Default', 'Admins' => 'Admin') as $account_lid => $name) |
|
| 108 | 108 | { |
| 109 | - $account_id = $GLOBALS['egw_setup']->add_account($account_lid,$name,'Group',False,False); |
|
| 110 | - $GLOBALS['egw_setup']->add_acl('importexport','run',$account_id); |
|
| 109 | + $account_id = $GLOBALS['egw_setup']->add_account($account_lid, $name, 'Group', False, False); |
|
| 110 | + $GLOBALS['egw_setup']->add_acl('importexport', 'run', $account_id); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $GLOBALS['setup_info']['importexport']['currentver'] = '1.9.004'; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | function importexport_upgrade1_9_003() |
| 117 | 117 | { |
| 118 | - $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions','filter',array( |
|
| 118 | + $GLOBALS['egw_setup']->oProc->AddColumn('egw_importexport_definitions', 'filter', array( |
|
| 119 | 119 | 'type' => 'longtext' |
| 120 | 120 | )); |
| 121 | 121 | |
@@ -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 | } |