| @@ -825,33 +825,33 @@ discard block | ||
| 825 | 825 | $fields = $index['fields']; | 
| 826 | 826 | |
| 827 | 827 |  		switch ($type) { | 
| 828 | - case 'unique': | |
| 829 | - $columns[] = " UNIQUE $name ($fields)"; | |
| 830 | - break; | |
| 831 | - case 'primary': | |
| 832 | - $columns[] = " PRIMARY KEY ($fields)"; | |
| 833 | - break; | |
| 834 | - case 'index': | |
| 835 | - case 'foreign': | |
| 836 | - case 'clustered': | |
| 837 | - case 'alternate_key': | |
| 838 | - /** | |
| 828 | + case 'unique': | |
| 829 | + $columns[] = " UNIQUE $name ($fields)"; | |
| 830 | + break; | |
| 831 | + case 'primary': | |
| 832 | + $columns[] = " PRIMARY KEY ($fields)"; | |
| 833 | + break; | |
| 834 | + case 'index': | |
| 835 | + case 'foreign': | |
| 836 | + case 'clustered': | |
| 837 | + case 'alternate_key': | |
| 838 | + /** | |
| 839 | 839 | * @todo here it is assumed that the primary key of the foreign | 
| 840 | 840 | * table will always be named 'id'. It must be noted though | 
| 841 | 841 | * that this can easily be fixed by referring to db dictionary | 
| 842 | 842 | * to find the correct primary field name | 
| 843 | 843 | */ | 
| 844 | - if ( $alter_table ) | |
| 845 | - $columns[] = " INDEX $name ($fields)"; | |
| 846 | - else | |
| 847 | - $columns[] = " KEY $name ($fields)"; | |
| 848 | - break; | |
| 849 | - case 'fulltext': | |
| 850 | - if ($this->full_text_indexing_installed()) | |
| 851 | - $columns[] = " FULLTEXT ($fields)"; | |
| 852 | - else | |
| 853 | -				$GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); | |
| 854 | - break; | |
| 844 | + if ( $alter_table ) | |
| 845 | + $columns[] = " INDEX $name ($fields)"; | |
| 846 | + else | |
| 847 | + $columns[] = " KEY $name ($fields)"; | |
| 848 | + break; | |
| 849 | + case 'fulltext': | |
| 850 | + if ($this->full_text_indexing_installed()) | |
| 851 | + $columns[] = " FULLTEXT ($fields)"; | |
| 852 | + else | |
| 853 | +				    $GLOBALS['log']->debug('MYISAM engine is not available/enabled, full-text indexes will be skipped. Skipping:',$name); | |
| 854 | + break; | |
| 855 | 855 | } | 
| 856 | 856 | } | 
| 857 | 857 |  	$columns = implode(", $alter_action ", $columns); | 
| @@ -935,33 +935,33 @@ discard block | ||
| 935 | 935 | |
| 936 | 936 |  		switch ($type){ | 
| 937 | 937 | // generic indices | 
| 938 | - case 'index': | |
| 939 | - case 'alternate_key': | |
| 940 | - case 'clustered': | |
| 941 | - if ($drop) | |
| 942 | -				$sql = "ALTER TABLE {$table} DROP INDEX {$name} "; | |
| 943 | - else | |
| 944 | -				$sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; | |
| 945 | - break; | |
| 946 | - // constraints as indices | |
| 947 | - case 'unique': | |
| 948 | - if ($drop) | |
| 949 | -				$sql = "ALTER TABLE {$table} DROP INDEX $name"; | |
| 950 | - else | |
| 951 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; | |
| 952 | - break; | |
| 953 | - case 'primary': | |
| 954 | - if ($drop) | |
| 955 | -				$sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; | |
| 956 | - else | |
| 957 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; | |
| 958 | - break; | |
| 959 | - case 'foreign': | |
| 960 | - if ($drop) | |
| 961 | -				$sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 962 | - else | |
| 963 | -				$sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; | |
| 964 | - break; | |
| 938 | + case 'index': | |
| 939 | + case 'alternate_key': | |
| 940 | + case 'clustered': | |
| 941 | + if ($drop) | |
| 942 | +				    $sql = "ALTER TABLE {$table} DROP INDEX {$name} "; | |
| 943 | + else | |
| 944 | +				    $sql = "ALTER TABLE {$table} ADD INDEX {$name} ({$fields})"; | |
| 945 | + break; | |
| 946 | + // constraints as indices | |
| 947 | + case 'unique': | |
| 948 | + if ($drop) | |
| 949 | +				    $sql = "ALTER TABLE {$table} DROP INDEX $name"; | |
| 950 | + else | |
| 951 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT UNIQUE {$name} ({$fields})"; | |
| 952 | + break; | |
| 953 | + case 'primary': | |
| 954 | + if ($drop) | |
| 955 | +				    $sql = "ALTER TABLE {$table} DROP PRIMARY KEY"; | |
| 956 | + else | |
| 957 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT PRIMARY KEY ({$fields})"; | |
| 958 | + break; | |
| 959 | + case 'foreign': | |
| 960 | + if ($drop) | |
| 961 | +				    $sql = "ALTER TABLE {$table} DROP FOREIGN KEY ({$fields})"; | |
| 962 | + else | |
| 963 | +				    $sql = "ALTER TABLE {$table} ADD CONSTRAINT FOREIGN KEY {$name} ({$fields}) REFERENCES {$definition['foreignTable']}({$definition['foreignField']})"; | |
| 964 | + break; | |
| 965 | 965 | } | 
| 966 | 966 | return $sql; | 
| 967 | 967 | } | 
| @@ -78,19 +78,19 @@ | ||
| 78 | 78 |      { | 
| 79 | 79 | $return_array = parent::getMapping($module); | 
| 80 | 80 |          switch ($module) { | 
| 81 | - case 'Contacts': | |
| 82 | - case 'Leads': | |
| 83 | - return $return_array + array( | |
| 84 | - "Job Title"=>"title", | |
| 85 | - "Home Country"=>"alt_address_country", | |
| 86 | - "E-mail 2 Address"=>"email2", | |
| 87 | - ); | |
| 88 | - break; | |
| 89 | - case 'Accounts': | |
| 90 | - return $return_array; | |
| 91 | - break; | |
| 92 | - default: | |
| 93 | - return $return_array; | |
| 81 | + case 'Contacts': | |
| 82 | + case 'Leads': | |
| 83 | + return $return_array + array( | |
| 84 | + "Job Title"=>"title", | |
| 85 | + "Home Country"=>"alt_address_country", | |
| 86 | + "E-mail 2 Address"=>"email2", | |
| 87 | + ); | |
| 88 | + break; | |
| 89 | + case 'Accounts': | |
| 90 | + return $return_array; | |
| 91 | + break; | |
| 92 | + default: | |
| 93 | + return $return_array; | |
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -78,76 +78,76 @@ | ||
| 78 | 78 |      { | 
| 79 | 79 | $return_array = parent::getMapping($module); | 
| 80 | 80 |          switch ($module) { | 
| 81 | - case 'Contacts': | |
| 82 | - case 'Leads': | |
| 83 | - return $return_array + array( | |
| 84 | - "Description"=>"description", | |
| 85 | - "Birthdate"=>"birthdate", | |
| 86 | - "Lead Source"=>"lead_source", | |
| 87 | - "Assistant"=>"assistant", | |
| 88 | - "Asst. Phone"=>"assistant_phone", | |
| 89 | - "Mailing Street"=>"primary_address_street", | |
| 90 | - "Mailing Address Line1"=>"primary_address_street_2", | |
| 91 | - "Mailing Address Line2"=>"primary_address_street_3", | |
| 92 | - "Mailing Address Line3"=>"primary_address_street_4", | |
| 93 | - "Mailing City"=>"primary_address_city", | |
| 94 | - "Mailing State"=>"primary_address_state", | |
| 95 | - "Mailing Zip/Postal Code"=>"primary_address_postalcode", | |
| 96 | - "Mailing Country"=>"primary_address_country", | |
| 97 | - "Other Street"=>"alt_address_street", | |
| 98 | - "Other Address Line 1"=>"alt_address_street_2", | |
| 99 | - "Other Address Line 2"=>"alt_address_street_3", | |
| 100 | - "Other Address Line 3"=>"alt_address_street_4", | |
| 101 | - "Other City"=>"alt_address_city", | |
| 102 | - "Other State"=>"alt_address_state", | |
| 103 | - "Other Zip/Postal Code"=>"alt_address_postalcode", | |
| 104 | - "Other Country"=>"alt_address_country", | |
| 105 | - "Phone"=>"phone_work", | |
| 106 | - "Mobile"=>"phone_mobile", | |
| 107 | - "Home Phone"=>"phone_home", | |
| 108 | - "Other Phone"=>"phone_other", | |
| 109 | - "Fax"=>"phone_fax", | |
| 110 | - "Email"=>"email1", | |
| 111 | - "Email Opt Out"=>"email_opt_out", | |
| 112 | - "Do Not Call"=>"do_not_call", | |
| 113 | - "Account Name"=>"account_name", | |
| 114 | - ); | |
| 115 | - break; | |
| 116 | - case 'Accounts': | |
| 117 | - return array( | |
| 118 | - "Account Name"=>"name", | |
| 119 | - "Annual Revenue"=>"annual_revenue", | |
| 120 | - "Type"=>"account_type", | |
| 121 | - "Ticker Symbol"=>"ticker_symbol", | |
| 122 | - "Rating"=>"rating", | |
| 123 | - "Industry"=>"industry", | |
| 124 | - "SIC Code"=>"sic_code", | |
| 125 | - "Ownership"=>"ownership", | |
| 126 | - "Employees"=>"employees", | |
| 127 | - "Description"=>"description", | |
| 128 | - "Billing Street"=>"billing_address_street", | |
| 129 | - "Billing Address Line1"=>"billing_address_street_2", | |
| 130 | - "Billing Address Line2"=>"billing_address_street_3", | |
| 131 | - "Billing City"=>"billing_address_city", | |
| 132 | - "Billing State"=>"billing_address_state", | |
| 133 | - "Billing State/Province"=>"billing_address_state", | |
| 134 | - "Billing Zip/Postal Code"=>"billing_address_postalcode", | |
| 135 | - "Billing Country"=>"billing_address_country", | |
| 136 | - "Shipping Street"=>"shipping_address_street", | |
| 137 | - "Shipping Address Line1"=>"shipping_address_street_2", | |
| 138 | - "Shipping Address Line2"=>"shipping_address_street_3", | |
| 139 | - "Shipping City"=>"shipping_address_city", | |
| 140 | - "Shipping State"=>"shipping_address_state", | |
| 141 | - "Shipping Zip/Postal Code"=>"shipping_address_postalcode", | |
| 142 | - "Shipping Country"=>"shipping_address_country", | |
| 143 | - "Phone"=>"phone_office", | |
| 144 | - "Fax"=>"phone_fax", | |
| 145 | - "Website"=>"website", | |
| 146 | - "Created Date"=>"date_entered", | |
| 147 | - ); | |
| 148 | - break; | |
| 149 | - default: | |
| 150 | - return $return_array; | |
| 81 | + case 'Contacts': | |
| 82 | + case 'Leads': | |
| 83 | + return $return_array + array( | |
| 84 | + "Description"=>"description", | |
| 85 | + "Birthdate"=>"birthdate", | |
| 86 | + "Lead Source"=>"lead_source", | |
| 87 | + "Assistant"=>"assistant", | |
| 88 | + "Asst. Phone"=>"assistant_phone", | |
| 89 | + "Mailing Street"=>"primary_address_street", | |
| 90 | + "Mailing Address Line1"=>"primary_address_street_2", | |
| 91 | + "Mailing Address Line2"=>"primary_address_street_3", | |
| 92 | + "Mailing Address Line3"=>"primary_address_street_4", | |
| 93 | + "Mailing City"=>"primary_address_city", | |
| 94 | + "Mailing State"=>"primary_address_state", | |
| 95 | + "Mailing Zip/Postal Code"=>"primary_address_postalcode", | |
| 96 | + "Mailing Country"=>"primary_address_country", | |
| 97 | + "Other Street"=>"alt_address_street", | |
| 98 | + "Other Address Line 1"=>"alt_address_street_2", | |
| 99 | + "Other Address Line 2"=>"alt_address_street_3", | |
| 100 | + "Other Address Line 3"=>"alt_address_street_4", | |
| 101 | + "Other City"=>"alt_address_city", | |
| 102 | + "Other State"=>"alt_address_state", | |
| 103 | + "Other Zip/Postal Code"=>"alt_address_postalcode", | |
| 104 | + "Other Country"=>"alt_address_country", | |
| 105 | + "Phone"=>"phone_work", | |
| 106 | + "Mobile"=>"phone_mobile", | |
| 107 | + "Home Phone"=>"phone_home", | |
| 108 | + "Other Phone"=>"phone_other", | |
| 109 | + "Fax"=>"phone_fax", | |
| 110 | + "Email"=>"email1", | |
| 111 | + "Email Opt Out"=>"email_opt_out", | |
| 112 | + "Do Not Call"=>"do_not_call", | |
| 113 | + "Account Name"=>"account_name", | |
| 114 | + ); | |
| 115 | + break; | |
| 116 | + case 'Accounts': | |
| 117 | + return array( | |
| 118 | + "Account Name"=>"name", | |
| 119 | + "Annual Revenue"=>"annual_revenue", | |
| 120 | + "Type"=>"account_type", | |
| 121 | + "Ticker Symbol"=>"ticker_symbol", | |
| 122 | + "Rating"=>"rating", | |
| 123 | + "Industry"=>"industry", | |
| 124 | + "SIC Code"=>"sic_code", | |
| 125 | + "Ownership"=>"ownership", | |
| 126 | + "Employees"=>"employees", | |
| 127 | + "Description"=>"description", | |
| 128 | + "Billing Street"=>"billing_address_street", | |
| 129 | + "Billing Address Line1"=>"billing_address_street_2", | |
| 130 | + "Billing Address Line2"=>"billing_address_street_3", | |
| 131 | + "Billing City"=>"billing_address_city", | |
| 132 | + "Billing State"=>"billing_address_state", | |
| 133 | + "Billing State/Province"=>"billing_address_state", | |
| 134 | + "Billing Zip/Postal Code"=>"billing_address_postalcode", | |
| 135 | + "Billing Country"=>"billing_address_country", | |
| 136 | + "Shipping Street"=>"shipping_address_street", | |
| 137 | + "Shipping Address Line1"=>"shipping_address_street_2", | |
| 138 | + "Shipping Address Line2"=>"shipping_address_street_3", | |
| 139 | + "Shipping City"=>"shipping_address_city", | |
| 140 | + "Shipping State"=>"shipping_address_state", | |
| 141 | + "Shipping Zip/Postal Code"=>"shipping_address_postalcode", | |
| 142 | + "Shipping Country"=>"shipping_address_country", | |
| 143 | + "Phone"=>"phone_office", | |
| 144 | + "Fax"=>"phone_fax", | |
| 145 | + "Website"=>"website", | |
| 146 | + "Created Date"=>"date_entered", | |
| 147 | + ); | |
| 148 | + break; | |
| 149 | + default: | |
| 150 | + return $return_array; | |
| 151 | 151 | } | 
| 152 | 152 | } | 
| 153 | 153 | |
| @@ -75,70 +75,70 @@ | ||
| 75 | 75 | ) | 
| 76 | 76 |      { | 
| 77 | 77 |          switch ($module) { | 
| 78 | - case 'Contacts': | |
| 79 | - case 'Leads': | |
| 80 | - return array( | |
| 81 | - "Salutation"=>"salutation", | |
| 82 | - "Full Name"=>"full_name", | |
| 83 | - "Company"=>"company", | |
| 84 | - "First Name"=>"first_name", | |
| 85 | - "Last Name"=>"last_name", | |
| 86 | - "Title"=>"title", | |
| 87 | - "Department"=>"department", | |
| 88 | - "Birthday"=>"birthdate", | |
| 89 | - "Home Phone"=>"phone_home", | |
| 90 | - "Mobile Phone"=>"phone_mobile", | |
| 91 | - "Business Phone"=>"phone_work", | |
| 92 | - "Other Phone"=>"phone_other", | |
| 93 | - "Business Fax"=>"phone_fax", | |
| 94 | - "E-mail Address"=>"email1", | |
| 95 | - "E-mail 2"=>"email2", | |
| 96 | - "Assistant's Name"=>"assistant", | |
| 97 | - "Assistant's Phone"=>"assistant_phone", | |
| 98 | - "Business Street"=>"primary_address_street", | |
| 99 | - "Business Street 2"=>"primary_address_street_2", | |
| 100 | - "Business Street 3"=>"primary_address_street_3", | |
| 101 | - "Business City"=>"primary_address_city", | |
| 102 | - "Business State"=>"primary_address_state", | |
| 103 | - "Business Postal Code"=>"primary_address_postalcode", | |
| 104 | - "Business Country/Region"=>"primary_address_country", | |
| 105 | - "Home Street"=>"alt_address_street", | |
| 106 | - "Home Street 2"=>"alt_address_street_2", | |
| 107 | - "Home Street 3"=>"alt_address_street_3", | |
| 108 | - "Home City"=>"alt_address_city", | |
| 109 | - "Home State"=>"alt_address_state", | |
| 110 | - "Home Postal Code"=>"alt_address_postalcode", | |
| 111 | - "Home Country/Region"=>"alt_address_country", | |
| 112 | - ); | |
| 113 | - break; | |
| 114 | - case 'Accounts': | |
| 115 | - return array( | |
| 116 | - "Company"=>"name", | |
| 117 | - "Business Street"=>"billing_address_street", | |
| 118 | - "Business City"=>"billing_address_city", | |
| 119 | - "Business State"=>"billing_address_state", | |
| 120 | - "Business Country"=>"billing_address_country", | |
| 121 | - "Business Postal Code"=>"billing_address_postalcode", | |
| 122 | - "Business Fax"=>"phone_fax", | |
| 123 | - "Company Main Phone"=>"phone_office", | |
| 124 | - "Web Page"=>"website", | |
| 125 | - ); | |
| 126 | - break; | |
| 127 | - case 'Opportunities': | |
| 128 | - return array( | |
| 129 | - "Opportunity Name"=>"name" , | |
| 130 | - "Type"=>"opportunity_type", | |
| 131 | - "Lead Source"=>"lead_source", | |
| 132 | - "Amount"=>"amount", | |
| 133 | - "Created Date"=>"date_entered", | |
| 134 | - "Close Date"=>"date_closed", | |
| 135 | - "Next Step"=>"next_step", | |
| 136 | - "Stage"=>"sales_stage", | |
| 137 | - "Probability (%)"=>"probability", | |
| 138 | - "Account Name"=>"account_name"); | |
| 139 | - break; | |
| 140 | - default: | |
| 141 | - return array(); | |
| 78 | + case 'Contacts': | |
| 79 | + case 'Leads': | |
| 80 | + return array( | |
| 81 | + "Salutation"=>"salutation", | |
| 82 | + "Full Name"=>"full_name", | |
| 83 | + "Company"=>"company", | |
| 84 | + "First Name"=>"first_name", | |
| 85 | + "Last Name"=>"last_name", | |
| 86 | + "Title"=>"title", | |
| 87 | + "Department"=>"department", | |
| 88 | + "Birthday"=>"birthdate", | |
| 89 | + "Home Phone"=>"phone_home", | |
| 90 | + "Mobile Phone"=>"phone_mobile", | |
| 91 | + "Business Phone"=>"phone_work", | |
| 92 | + "Other Phone"=>"phone_other", | |
| 93 | + "Business Fax"=>"phone_fax", | |
| 94 | + "E-mail Address"=>"email1", | |
| 95 | + "E-mail 2"=>"email2", | |
| 96 | + "Assistant's Name"=>"assistant", | |
| 97 | + "Assistant's Phone"=>"assistant_phone", | |
| 98 | + "Business Street"=>"primary_address_street", | |
| 99 | + "Business Street 2"=>"primary_address_street_2", | |
| 100 | + "Business Street 3"=>"primary_address_street_3", | |
| 101 | + "Business City"=>"primary_address_city", | |
| 102 | + "Business State"=>"primary_address_state", | |
| 103 | + "Business Postal Code"=>"primary_address_postalcode", | |
| 104 | + "Business Country/Region"=>"primary_address_country", | |
| 105 | + "Home Street"=>"alt_address_street", | |
| 106 | + "Home Street 2"=>"alt_address_street_2", | |
| 107 | + "Home Street 3"=>"alt_address_street_3", | |
| 108 | + "Home City"=>"alt_address_city", | |
| 109 | + "Home State"=>"alt_address_state", | |
| 110 | + "Home Postal Code"=>"alt_address_postalcode", | |
| 111 | + "Home Country/Region"=>"alt_address_country", | |
| 112 | + ); | |
| 113 | + break; | |
| 114 | + case 'Accounts': | |
| 115 | + return array( | |
| 116 | + "Company"=>"name", | |
| 117 | + "Business Street"=>"billing_address_street", | |
| 118 | + "Business City"=>"billing_address_city", | |
| 119 | + "Business State"=>"billing_address_state", | |
| 120 | + "Business Country"=>"billing_address_country", | |
| 121 | + "Business Postal Code"=>"billing_address_postalcode", | |
| 122 | + "Business Fax"=>"phone_fax", | |
| 123 | + "Company Main Phone"=>"phone_office", | |
| 124 | + "Web Page"=>"website", | |
| 125 | + ); | |
| 126 | + break; | |
| 127 | + case 'Opportunities': | |
| 128 | + return array( | |
| 129 | + "Opportunity Name"=>"name" , | |
| 130 | + "Type"=>"opportunity_type", | |
| 131 | + "Lead Source"=>"lead_source", | |
| 132 | + "Amount"=>"amount", | |
| 133 | + "Created Date"=>"date_entered", | |
| 134 | + "Close Date"=>"date_closed", | |
| 135 | + "Next Step"=>"next_step", | |
| 136 | + "Stage"=>"sales_stage", | |
| 137 | + "Probability (%)"=>"probability", | |
| 138 | + "Account Name"=>"account_name"); | |
| 139 | + break; | |
| 140 | + default: | |
| 141 | + return array(); | |
| 142 | 142 | } | 
| 143 | 143 | } | 
| 144 | 144 | |
| @@ -305,50 +305,50 @@ discard block | ||
| 305 | 305 | } | 
| 306 | 306 | |
| 307 | 307 |  switch( $install_type ){ | 
| 308 | - case "langpack": | |
| 309 | -        if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){ | |
| 310 | - die($mod_strings['ERR_UW_NO_LANG']); | |
| 311 | - } | |
| 312 | -        if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){ | |
| 313 | - die($mod_strings['ERR_UW_NO_LANG_DESC']); | |
| 314 | - } | |
| 308 | + case "langpack": | |
| 309 | +            if( !isset($_REQUEST['new_lang_name']) || ($_REQUEST['new_lang_name'] == "") ){ | |
| 310 | + die($mod_strings['ERR_UW_NO_LANG']); | |
| 311 | + } | |
| 312 | +            if( !isset($_REQUEST['new_lang_desc']) || ($_REQUEST['new_lang_desc'] == "") ){ | |
| 313 | + die($mod_strings['ERR_UW_NO_LANG_DESC']); | |
| 314 | + } | |
| 315 | 315 | |
| 316 | -        if( $mode == "Install" || $mode=="Enable" ){ | |
| 317 | - $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] ); | |
| 318 | - } | |
| 319 | -        else if( $mode == "Uninstall" || $mode=="Disable" ){ | |
| 320 | - $new_langs = array(); | |
| 321 | - $old_langs = $sugar_config['languages']; | |
| 322 | -            foreach( $old_langs as $key => $value ){ | |
| 323 | -                if( $key != $_REQUEST['new_lang_name'] ){ | |
| 324 | - $new_langs += array( $key => $value ); | |
| 316 | +            if( $mode == "Install" || $mode=="Enable" ){ | |
| 317 | + $sugar_config['languages'] = $sugar_config['languages'] + array( $_REQUEST['new_lang_name'] => $_REQUEST['new_lang_desc'] ); | |
| 318 | + } | |
| 319 | +            else if( $mode == "Uninstall" || $mode=="Disable" ){ | |
| 320 | + $new_langs = array(); | |
| 321 | + $old_langs = $sugar_config['languages']; | |
| 322 | +                foreach( $old_langs as $key => $value ){ | |
| 323 | +                    if( $key != $_REQUEST['new_lang_name'] ){ | |
| 324 | + $new_langs += array( $key => $value ); | |
| 325 | + } | |
| 325 | 326 | } | 
| 327 | + $sugar_config['languages'] = $new_langs; | |
| 328 | + | |
| 329 | + $default_sugar_instance_lang = 'en_us'; | |
| 330 | +	            if($current_language == $_REQUEST['new_lang_name']){ | |
| 331 | + $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; | |
| 332 | + $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 333 | + } | |
| 334 | + | |
| 335 | +	            if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ | |
| 336 | + $cfg = new Configurator(); | |
| 337 | + $cfg->config['languages'] = $new_langs; | |
| 338 | + $cfg->config['default_language'] = $default_sugar_instance_lang; | |
| 339 | + $cfg->handleOverride(); | |
| 340 | + $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 341 | + } | |
| 326 | 342 | } | 
| 327 | - $sugar_config['languages'] = $new_langs; | |
| 328 | - | |
| 329 | - $default_sugar_instance_lang = 'en_us'; | |
| 330 | -	        if($current_language == $_REQUEST['new_lang_name']){ | |
| 331 | - $_SESSION['authenticated_user_language'] =$default_sugar_instance_lang; | |
| 332 | - $lang_changed_string = $mod_strings['LBL_CURRENT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 333 | - } | |
| 334 | - | |
| 335 | -	        if($sugar_config['default_language'] == $_REQUEST['new_lang_name']){ | |
| 336 | - $cfg = new Configurator(); | |
| 337 | - $cfg->config['languages'] = $new_langs; | |
| 338 | - $cfg->config['default_language'] = $default_sugar_instance_lang; | |
| 339 | - $cfg->handleOverride(); | |
| 340 | - $lang_changed_string .= $mod_strings['LBL_DEFAULT_LANGUAGE_CHANGE'].$sugar_config['languages'][$default_sugar_instance_lang].'<br/>'; | |
| 341 | - } | |
| 342 | - } | |
| 343 | - ksort( $sugar_config ); | |
| 344 | -        if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ | |
| 345 | - die($mod_strings['ERR_UW_CONFIG_FAILED']); | |
| 346 | - } | |
| 347 | - break; | |
| 348 | - case "module": | |
| 349 | - require_once( "ModuleInstall/ModuleInstaller.php" ); | |
| 350 | - $mi = new ModuleInstaller(); | |
| 351 | -        switch( $mode ){ | |
| 343 | + ksort( $sugar_config ); | |
| 344 | +            if( !write_array_to_file( "sugar_config", $sugar_config, "config.php" ) ){ | |
| 345 | + die($mod_strings['ERR_UW_CONFIG_FAILED']); | |
| 346 | + } | |
| 347 | + break; | |
| 348 | + case "module": | |
| 349 | + require_once( "ModuleInstall/ModuleInstaller.php" ); | |
| 350 | + $mi = new ModuleInstaller(); | |
| 351 | +            switch( $mode ){ | |
| 352 | 352 | case "Install": | 
| 353 | 353 | //here we can determine if this is an upgrade or a new version | 
| 354 | 354 |              	if(!empty($previous_version)){ | 
| @@ -388,14 +388,14 @@ discard block | ||
| 388 | 388 | break; | 
| 389 | 389 | default: | 
| 390 | 390 | break; | 
| 391 | - } | |
| 391 | + } | |
| 392 | 392 |          $current_user->incrementETag("mainMenuETag"); | 
| 393 | 393 | break; | 
| 394 | - case "full": | |
| 395 | - // purposely flow into "case: patch" | |
| 396 | - case "patch": | |
| 397 | - switch($mode) | |
| 398 | - 		{ | |
| 394 | + case "full": | |
| 395 | + // purposely flow into "case: patch" | |
| 396 | + case "patch": | |
| 397 | + switch($mode) | |
| 398 | + 		    { | |
| 399 | 399 | case 'Install': | 
| 400 | 400 |   				$file = "$unzip_dir/" . constant('SUGARCRM_POST_INSTALL_FILE'); | 
| 401 | 401 | if(is_file($file)) | 
| @@ -424,7 +424,7 @@ discard block | ||
| 424 | 424 | break; | 
| 425 | 425 | default: | 
| 426 | 426 | break; | 
| 427 | - } | |
| 427 | + } | |
| 428 | 428 | |
| 429 | 429 | require( "sugar_version.php" ); | 
| 430 | 430 | $sugar_config['sugar_version'] = $sugar_version; | 
| @@ -435,8 +435,8 @@ discard block | ||
| 435 | 435 | die($mod_strings['ERR_UW_UPDATE_CONFIG']); | 
| 436 | 436 | } | 
| 437 | 437 | break; | 
| 438 | - default: | |
| 439 | - break; | |
| 438 | + default: | |
| 439 | + break; | |
| 440 | 440 | } | 
| 441 | 441 | |
| 442 | 442 |  switch( $mode ){ | 
| @@ -164,58 +164,58 @@ discard block | ||
| 164 | 164 | }//fi | 
| 165 | 165 | } | 
| 166 | 166 |  switch( $install_type ){ | 
| 167 | - case "full": | |
| 168 | - case "patch": | |
| 169 | -		if( !is_writable( "config.php" ) ){ | |
| 170 | - die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 171 | - } | |
| 172 | - break; | |
| 173 | - case "theme": | |
| 174 | - break; | |
| 175 | - case "langpack": | |
| 176 | - // find name of language pack: find single file in include/language/xx_xx.lang.php | |
| 177 | - $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); | |
| 178 | -		while( $f = $d->read() ){ | |
| 179 | -			if( $f == "." || $f == ".." ){ | |
| 180 | - continue; | |
| 181 | - } | |
| 182 | -			else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ | |
| 183 | - $new_lang_name = $match[1]; | |
| 184 | - } | |
| 185 | - } | |
| 186 | -		if( $new_lang_name == "" ){ | |
| 187 | - die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); | |
| 188 | - } | |
| 189 | - $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>"; | |
| 190 | - | |
| 191 | - $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); | |
| 192 | -		if( $new_lang_desc == "" ){ | |
| 193 | - die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); | |
| 194 | - } | |
| 195 | - $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>"; | |
| 196 | - | |
| 197 | -		if( !is_writable( "config.php" ) ){ | |
| 198 | - die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 199 | - } | |
| 200 | - break; | |
| 201 | - case "module": | |
| 202 | - $previous_install = array(); | |
| 203 | - if(!empty($id_name) & !empty($version)) | |
| 204 | - $previous_install = $uh->determineIfUpgrade($id_name, $version); | |
| 205 | - $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; | |
| 206 | - $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; | |
| 207 | - $show_files = false; | |
| 208 | - //rrs pull out unique_key | |
| 209 | - $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>"; | |
| 210 | - $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>"; | |
| 211 | - $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>"; | |
| 212 | - $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>"; | |
| 213 | - $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>"; | |
| 214 | - $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>"; | |
| 215 | - $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>"; | |
| 216 | - break; | |
| 217 | - default: | |
| 218 | - die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); | |
| 167 | + case "full": | |
| 168 | + case "patch": | |
| 169 | +		    if( !is_writable( "config.php" ) ){ | |
| 170 | + die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 171 | + } | |
| 172 | + break; | |
| 173 | + case "theme": | |
| 174 | + break; | |
| 175 | + case "langpack": | |
| 176 | + // find name of language pack: find single file in include/language/xx_xx.lang.php | |
| 177 | + $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); | |
| 178 | +		    while( $f = $d->read() ){ | |
| 179 | +			    if( $f == "." || $f == ".." ){ | |
| 180 | + continue; | |
| 181 | + } | |
| 182 | +			    else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ | |
| 183 | + $new_lang_name = $match[1]; | |
| 184 | + } | |
| 185 | + } | |
| 186 | +		    if( $new_lang_name == "" ){ | |
| 187 | + die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); | |
| 188 | + } | |
| 189 | + $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>"; | |
| 190 | + | |
| 191 | + $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); | |
| 192 | +		    if( $new_lang_desc == "" ){ | |
| 193 | + die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); | |
| 194 | + } | |
| 195 | + $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>"; | |
| 196 | + | |
| 197 | +		    if( !is_writable( "config.php" ) ){ | |
| 198 | + die( $mod_strings['ERR_UW_CONFIG'] ); | |
| 199 | + } | |
| 200 | + break; | |
| 201 | + case "module": | |
| 202 | + $previous_install = array(); | |
| 203 | + if(!empty($id_name) & !empty($version)) | |
| 204 | + $previous_install = $uh->determineIfUpgrade($id_name, $version); | |
| 205 | + $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; | |
| 206 | + $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; | |
| 207 | + $show_files = false; | |
| 208 | + //rrs pull out unique_key | |
| 209 | + $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>"; | |
| 210 | + $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>"; | |
| 211 | + $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>"; | |
| 212 | + $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>"; | |
| 213 | + $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>"; | |
| 214 | + $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>"; | |
| 215 | + $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>"; | |
| 216 | + break; | |
| 217 | + default: | |
| 218 | + die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); | |
| 219 | 219 | } | 
| 220 | 220 | |
| 221 | 221 | |
| @@ -317,33 +317,33 @@ discard block | ||
| 317 | 317 | } | 
| 318 | 318 | |
| 319 | 319 |  switch( $mode ){ | 
| 320 | - case "Install": | |
| 321 | -		if( $install_type == "langpack") { | |
| 322 | - print( $mod_strings['LBL_UW_LANGPACK_READY'] ); | |
| 323 | - echo '<br><br>'; | |
| 324 | - } | |
| 325 | - break; | |
| 326 | - case "Uninstall": | |
| 327 | -		if( $install_type == "langpack" ){ | |
| 328 | - print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] ); | |
| 329 | - echo '<br><br>'; | |
| 330 | - } | |
| 331 | -		else if($install_type != "module"){ | |
| 332 | - print( $mod_strings['LBL_UW_FILES_REMOVED'] ); | |
| 333 | - } | |
| 334 | - break; | |
| 335 | - case "Disable": | |
| 336 | -		if( $install_type == "langpack" ){ | |
| 337 | - print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] ); | |
| 338 | - echo '<br><br>'; | |
| 339 | - } | |
| 340 | - break; | |
| 341 | - case "Enable": | |
| 342 | -		if( $install_type == "langpack" ){ | |
| 343 | - print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] ); | |
| 344 | - echo '<br><br>'; | |
| 345 | - } | |
| 346 | - break; | |
| 320 | + case "Install": | |
| 321 | +		    if( $install_type == "langpack") { | |
| 322 | + print( $mod_strings['LBL_UW_LANGPACK_READY'] ); | |
| 323 | + echo '<br><br>'; | |
| 324 | + } | |
| 325 | + break; | |
| 326 | + case "Uninstall": | |
| 327 | +		    if( $install_type == "langpack" ){ | |
| 328 | + print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] ); | |
| 329 | + echo '<br><br>'; | |
| 330 | + } | |
| 331 | +		    else if($install_type != "module"){ | |
| 332 | + print( $mod_strings['LBL_UW_FILES_REMOVED'] ); | |
| 333 | + } | |
| 334 | + break; | |
| 335 | + case "Disable": | |
| 336 | +		    if( $install_type == "langpack" ){ | |
| 337 | + print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] ); | |
| 338 | + echo '<br><br>'; | |
| 339 | + } | |
| 340 | + break; | |
| 341 | + case "Enable": | |
| 342 | +		    if( $install_type == "langpack" ){ | |
| 343 | + print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] ); | |
| 344 | + echo '<br><br>'; | |
| 345 | + } | |
| 346 | + break; | |
| 347 | 347 | } | 
| 348 | 348 | |
| 349 | 349 | |
| @@ -652,53 +652,53 @@ | ||
| 652 | 652 | } | 
| 653 | 653 | |
| 654 | 654 |  switch($the_file) { | 
| 655 | - case 'old_php.php': | |
| 656 | - case 'welcome.php': | |
| 657 | - case 'license.php': | |
| 658 | - // | |
| 659 | - // Check to see if session variables are working properly | |
| 660 | - // | |
| 661 | - $_SESSION['test_session'] = 'sessions are available'; | |
| 662 | - @session_write_close(); | |
| 663 | - unset($_SESSION['test_session']); | |
| 664 | - @session_start(); | |
| 665 | - | |
| 666 | - if(!isset($_SESSION['test_session'])) | |
| 667 | -            { | |
| 668 | - $the_file = 'installDisabled.php'; | |
| 669 | - // PHP.ini location - | |
| 670 | -                $phpIniLocation = get_cfg_var("cfg_file_path"); | |
| 671 | - $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE']; | |
| 672 | - $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE']; | |
| 673 | -                $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>"; | |
| 674 | - break; | |
| 675 | - } | |
| 676 | - // check to see if installer has been disabled | |
| 677 | -            if(is_readable('config.php') && (filesize('config.php') > 0)) { | |
| 678 | -                include_once('config.php'); | |
| 679 | - | |
| 680 | -                if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) { | |
| 655 | + case 'old_php.php': | |
| 656 | + case 'welcome.php': | |
| 657 | + case 'license.php': | |
| 658 | + // | |
| 659 | + // Check to see if session variables are working properly | |
| 660 | + // | |
| 661 | + $_SESSION['test_session'] = 'sessions are available'; | |
| 662 | + @session_write_close(); | |
| 663 | + unset($_SESSION['test_session']); | |
| 664 | + @session_start(); | |
| 665 | + | |
| 666 | + if(!isset($_SESSION['test_session'])) | |
| 667 | +                { | |
| 681 | 668 | $the_file = 'installDisabled.php'; | 
| 682 | - $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION']; | |
| 683 | - $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2']; | |
| 684 | - $disabled_text =<<<EOQ | |
| 685 | -					<p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p> | |
| 669 | + // PHP.ini location - | |
| 670 | +                    $phpIniLocation = get_cfg_var("cfg_file_path"); | |
| 671 | + $disabled_title = $mod_strings['LBL_SESSION_ERR_TITLE']; | |
| 672 | + $disabled_title_2 = $mod_strings['LBL_SESSION_ERR_TITLE']; | |
| 673 | +                    $disabled_text = $mod_strings['LBL_SESSION_ERR_DESCRIPTION']."<pre>{$phpIniLocation}</pre>"; | |
| 674 | + break; | |
| 675 | + } | |
| 676 | + // check to see if installer has been disabled | |
| 677 | +                if(is_readable('config.php') && (filesize('config.php') > 0)) { | |
| 678 | +                    include_once('config.php'); | |
| 679 | + | |
| 680 | +                    if(!isset($sugar_config['installer_locked']) || $sugar_config['installer_locked'] == true) { | |
| 681 | + $the_file = 'installDisabled.php'; | |
| 682 | + $disabled_title = $mod_strings['LBL_DISABLED_DESCRIPTION']; | |
| 683 | + $disabled_title_2 = $mod_strings['LBL_DISABLED_TITLE_2']; | |
| 684 | + $disabled_text =<<<EOQ | |
| 685 | +    					<p>{$mod_strings['LBL_DISABLED_DESCRIPTION']}</p> | |
| 686 | 686 | <pre> | 
| 687 | 687 | 'installer_locked' => false, | 
| 688 | 688 | </pre> | 
| 689 | 689 |  					<p>{$mod_strings['LBL_DISABLED_DESCRIPTION_2']}</p> | 
| 690 | 690 | |
| 691 | 691 |  					<p>{$mod_strings['LBL_DISABLED_HELP_1']} <a href="{$mod_strings['LBL_DISABLED_HELP_LNK']}" target="_blank">{$mod_strings['LBL_DISABLED_HELP_2']}</a>.</p> | 
| 692 | -EOQ; | |
| 693 | - //if this is an offline client installation but the conversion did not succeed, | |
| 694 | - //then try to convert again | |
| 695 | -                    if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) { | |
| 696 | -                        header('Location: index.php?entryPoint=oc_convert&first_time=true'); | |
| 697 | - exit (); | |
| 692 | + EOQ; | |
| 693 | + //if this is an offline client installation but the conversion did not succeed, | |
| 694 | + //then try to convert again | |
| 695 | +                        if(isset($sugar_config['disc_client']) && $sugar_config['disc_client'] == true && isset($sugar_config['oc_converted']) && $sugar_config['oc_converted'] == false) { | |
| 696 | +                            header('Location: index.php?entryPoint=oc_convert&first_time=true'); | |
| 697 | + exit (); | |
| 698 | + } | |
| 698 | 699 | } | 
| 699 | 700 | } | 
| 700 | - } | |
| 701 | - break; | |
| 701 | + break; | |
| 702 | 702 | case 'register.php': | 
| 703 | 703 | case 'complete_install.php': | 
| 704 | 704 | session_unset(); |