This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
||
3 | /********************************************************************************* |
||
4 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
6 | |||
7 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
8 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it under |
||
11 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
12 | * Free Software Foundation with the addition of the following permission added |
||
13 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
14 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
15 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
19 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
20 | * details. |
||
21 | * |
||
22 | * You should have received a copy of the GNU Affero General Public License along with |
||
23 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
25 | * 02110-1301 USA. |
||
26 | * |
||
27 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
28 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
29 | * |
||
30 | * The interactive user interfaces in modified source and object code versions |
||
31 | * of this program must display Appropriate Legal Notices, as required under |
||
32 | * Section 5 of the GNU Affero General Public License version 3. |
||
33 | * |
||
34 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
35 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
36 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
37 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
39 | ********************************************************************************/ |
||
40 | |||
41 | |||
42 | if( !isset( $install_script ) || !$install_script ){ |
||
43 | die($mod_strings['ERR_NO_DIRECT_SCRIPT']); |
||
44 | } |
||
45 | |||
46 | class NonDBLocalization extends Localization { |
||
47 | |||
48 | public function __construct() { |
||
49 | global $sugar_config; |
||
50 | $this->localeNameFormatDefault = empty($sugar_config['locale_name_format_default']) ? 's f l' : $sugar_config['default_name_format']; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Creates dropdown items that have localized example names while filtering out invalid formats |
||
55 | * |
||
56 | * @override |
||
57 | * @param array un-prettied dropdown list |
||
58 | * @return array array of dropdown options |
||
59 | */ |
||
60 | public function getUsableLocaleNameOptions($options) { |
||
61 | global $mod_strings; |
||
62 | $examples = array('s' => $mod_strings['LBL_LOCALE_NAME_FIRST'], |
||
63 | 'f' => $mod_strings['LBL_LOCALE_NAME_LAST'], |
||
64 | 'l' => $mod_strings['LBL_LOCALE_NAME_SALUTATION']); |
||
65 | $newOpts = array(); |
||
66 | foreach ($options as $key => $val) { |
||
67 | if ($this->isAllowedNameFormat($key) && $this->isAllowedNameFormat($val)) { |
||
68 | $newVal = ''; |
||
69 | $pieces = str_split($val); |
||
70 | foreach ($pieces as $piece) { |
||
71 | if (isset($examples[$piece])) { |
||
72 | $newVal .= $examples[$piece]; |
||
73 | } else { |
||
74 | $newVal .= $piece; |
||
75 | } |
||
76 | } |
||
77 | $newOpts[$key] = $newVal; |
||
78 | } |
||
79 | } |
||
80 | return $newOpts; |
||
81 | } |
||
82 | |||
83 | } |
||
84 | |||
85 | class InstallLayout |
||
0 ignored issues
–
show
|
|||
86 | { |
||
87 | |||
88 | public static function getSelect($name, $options, $default) { |
||
89 | $out = "<select name=\"$name\">"; |
||
90 | foreach($options as $key => $value) { |
||
91 | $selected = ''; |
||
92 | if($key==$default) $selected = ' selected="selected"'; |
||
93 | $out .= "<option label=\"$value\" value=\"$key\"$selected>$value</option>"; |
||
94 | } |
||
95 | $out .= "</select>"; |
||
96 | return $out; |
||
97 | } |
||
98 | |||
99 | private function getHeaderStyles() { |
||
100 | $out = <<<EOQ |
||
101 | <link REL="SHORTCUT ICON" HREF="include/images/sugar_icon.ico"> |
||
102 | <link rel="stylesheet" href="install/install2.css" type="text/css"> |
||
103 | <link rel="stylesheet" href="themes/Suite7/css/fontello.css"> |
||
104 | <link rel="stylesheet" href="themes/Suite7/css/animation.css"><!--[if IE 7]><link rel="stylesheet" href="css/fontello-ie7.css"><![endif]--> |
||
105 | <link rel='stylesheet' type='text/css' href='include/javascript/yui/build/container/assets/container.css' /> |
||
106 | EOQ; |
||
107 | return $out; |
||
108 | } |
||
109 | |||
110 | private function getHeaderScripts($sugar_version, $js_custom_version) { |
||
111 | $out = <<<EOQ |
||
112 | <script src="include/javascript/jquery/jquery-min.js"></script> |
||
113 | <script src="cache/include/javascript/sugar_grp1_yui.js?s={$sugar_version}&c={$js_custom_version}"></script> |
||
114 | EOQ; |
||
115 | return $out; |
||
116 | } |
||
117 | |||
118 | /** |
||
119 | * @param $title page title |
||
120 | * @param $styles linked css files (string) |
||
121 | * @param $scripts linked javascript files (string) |
||
122 | * @return string Install page layout header |
||
123 | */ |
||
124 | private function getHeader($mod_strings, $styles, $scripts) |
||
125 | { |
||
126 | $out = <<<EOQ |
||
127 | <head> |
||
128 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||
129 | <meta http-equiv="Content-Style-Type" content="text/css"> |
||
130 | <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' /> |
||
131 | <title>{$mod_strings['LBL_WIZARD_TITLE']} {$mod_strings['LBL_SYSOPTS_DB_TITLE']}</title> |
||
132 | $styles |
||
133 | $scripts |
||
134 | </head> |
||
135 | EOQ; |
||
136 | return $out; |
||
137 | } |
||
138 | |||
139 | |||
140 | /** |
||
141 | * @param $name form tag name |
||
142 | * @param $id form tag id |
||
143 | * @param $errs form errors |
||
144 | * @param $title form header line |
||
145 | * @param $items form items (string) |
||
146 | * @param $controlls form controll buttons (string) |
||
147 | * @return string |
||
148 | */ |
||
149 | private function getForm($mod_strings, $name, $id, $errs, $items, $controlls, $scripts, $next_step) |
||
150 | { |
||
151 | $out = <<<EOQ |
||
152 | <iframe id="upload_target" name="upload_target" src="install.php?sugar_body_only=1&uploadLogoFrame=1" style="width:0;height:0;border:0px solid #fff;"></iframe> |
||
153 | <form action="install.php" method="post" name="$name" id="$id" enctype="multipart/form-data"> |
||
154 | <input type="hidden" name="current_step" value="{$next_step}"> |
||
155 | <div id="install_content"> |
||
156 | <div id="installoptions"> |
||
157 | {$errs} |
||
158 | $items |
||
159 | </div> |
||
160 | </div> |
||
161 | <div class="clear"></div> |
||
162 | <hr> |
||
163 | <div id="installcontrols"> |
||
164 | $controlls |
||
165 | </div> |
||
166 | <script type="text/javascript"> |
||
167 | $scripts; |
||
168 | </script> |
||
169 | </form> |
||
170 | <div id="installStatus" style="display: none;"> |
||
171 | <h2>{$mod_strings['LBL_INSTALL_PROCESS']}</h2> |
||
172 | <p><img alt="Status" src="install/processing.gif"><br><span class="preloader-status"></span></p> |
||
173 | </div> |
||
174 | EOQ; |
||
175 | |||
176 | return $out; |
||
177 | } |
||
178 | |||
179 | |||
180 | /** |
||
181 | * @param $header install page head |
||
182 | * @param $form install page form step |
||
183 | * @return string install page |
||
184 | */ |
||
185 | private function getOutput($header, $form, $sugar_md, $mod_strings) |
||
186 | { |
||
187 | $langHeader = get_language_header(); |
||
188 | $out = <<<EOQ |
||
189 | <!DOCTYPE HTML> |
||
190 | <html {$langHeader}> |
||
191 | $header |
||
192 | <body onload="//document.getElementById('button_next2').focus();"> |
||
193 | <!--SuiteCRM installer--> |
||
194 | <div id="install_container"> |
||
195 | <div id="install_box"> |
||
196 | <div id='licenseDiv'></div> |
||
197 | <header id="install_header"> |
||
198 | <div class="install_img"> |
||
199 | <a href="https://suitecrm.com" target="_blank"> |
||
200 | <img src="{$sugar_md}" alt="SuiteCRM"> |
||
201 | </a> |
||
202 | </div> |
||
203 | <div id="steps"> |
||
204 | <p>{$mod_strings['LBL_STEP2']}</p> |
||
205 | <i class="icon-progress-0" id="complete"></i> |
||
206 | <i class="icon-progress-1" id="complete"></i> |
||
207 | <i class="icon-progress-2"></i> |
||
208 | </div> |
||
209 | </header> |
||
210 | $form |
||
211 | </div> |
||
212 | |||
213 | <footer id="install_footer"> |
||
214 | <p id="footer_links"><a href="https://suitecrm.com" target="_blank">Visit suitecrm.com</a> | <a href="https://suitecrm.com/index.php?option=com_kunena&view=category&Itemid=1137&layout=list" target="_blank">Support Forums</a> | <a href="https://suitecrm.com/wiki/index.php/Installation" target="_blank">Installation Guide</a> | <a href="LICENSE.txt" target="_blank">License</a> |
||
215 | </footer> |
||
216 | </div> |
||
217 | </body> |
||
218 | </html> |
||
219 | EOQ; |
||
220 | return $out; |
||
221 | } |
||
222 | |||
223 | private function getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages, |
||
224 | $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden) { |
||
225 | |||
226 | |||
227 | |||
228 | // ------------------------------ |
||
229 | // DB Type and DB configuration |
||
230 | // ----------------------------------> |
||
231 | |||
232 | |||
233 | // database selection |
||
234 | $out_dbtypesel = " |
||
235 | <div class=\"floatbox\" id=\"fb5\"> |
||
236 | <h2>{$mod_strings['LBL_DBCONF_TITLE']}</h2> |
||
237 | |||
238 | <div class=\"form_section\"> |
||
239 | <h3>{$mod_strings['LBL_SYSOPTS_DB']}</h3>"; |
||
240 | |||
241 | foreach($drivers as $type => $driver) { |
||
242 | $oci = ($type == "oci8")?"":'none'; // hack for special oracle message |
||
243 | $out_dbtypesel.=<<<EOQ |
||
244 | <input type="radio" class="checkbox" name="setup_db_type" id="setup_db_type" value="$type" {$checked[$type]} onclick="onDBTypeClick(this);//document.getElementById('ociMsg').style.display='$oci'"/>{$mod_strings[$driver->label]}<br> |
||
245 | EOQ; |
||
246 | } |
||
247 | $out_dbtypesel.=<<<EOQ |
||
248 | </div> |
||
249 | <div name="ociMsg" id="ociMsg" style="display:none"></div> |
||
250 | <!-- </div> --> |
||
251 | EOQ; |
||
252 | |||
253 | |||
254 | $out2 = $out_dbtypesel; |
||
255 | |||
256 | |||
257 | $out2.=<<<EOQ2 |
||
258 | |||
259 | <!-- <div class="floatbox"> --> |
||
260 | |||
261 | <div class="form_section starhook"> |
||
262 | <!-- <div class="required">{$mod_strings['LBL_REQUIRED']}</div> --> |
||
263 | <h3>{$mod_strings['LBL_DBCONF_TITLE_NAME']}</h3> |
||
264 | EOQ2; |
||
265 | |||
266 | $config_params = $db->installConfig(); |
||
267 | $form = ''; |
||
268 | foreach($config_params as $group => $gdata) { |
||
269 | $form.= "<div class='install_block'>"; |
||
270 | if($mod_strings[$group . '_LABEL']) { |
||
271 | $form .= "<label>{$mod_strings[$group . '_LABEL']}" . "<i> i <div class=\"tooltip\">{$mod_strings[$group]}</div></i></label>\n"; |
||
272 | } |
||
273 | foreach($gdata as $name => $value) { |
||
274 | |||
275 | if(!empty($value)) { |
||
276 | if(!empty($value['required'])) { |
||
277 | $form .= "<span class=\"required\">*</span>"; |
||
278 | } |
||
279 | else { |
||
280 | } |
||
281 | if(!empty($_SESSION[$name])) { |
||
282 | $sessval = $_SESSION[$name]; |
||
283 | } else { |
||
284 | $sessval = ''; |
||
285 | } |
||
286 | if(!empty($value["type"])) { |
||
287 | $type = $value["type"]; |
||
288 | } else { |
||
289 | $type = ''; |
||
290 | } |
||
291 | |||
292 | $form .= <<<FORM |
||
293 | |||
294 | FORM; |
||
295 | //if the type is password, set a hidden field to capture the value. This is so that we can properly encode special characters, which is a limitation with password fields |
||
296 | if($type=='password'){ |
||
297 | $form .= "</div><div class=\"install_block\"><label>{$mod_strings['LBL_DBCONF_TITLE_PSWD_INFO_LABEL']}</label><span> </span><input type='$type' name='{$name}_entry' id='{$name}_entry' value='".urldecode($sessval)."'><input type='hidden' name='$name' id='$name' value='".urldecode($sessval)."'></div><div class=\"install_block\">"; |
||
298 | }else{ |
||
299 | $form .= "<input type='$type' name='$name' id='$name' value='$sessval'>"; |
||
300 | } |
||
301 | |||
302 | |||
303 | |||
304 | $form .= <<<FORM |
||
305 | FORM; |
||
306 | |||
307 | } else { |
||
308 | $form .= "<input name=\"$name\" id=\"$name\" value=\"\" type=\"hidden\">\n"; |
||
309 | } |
||
310 | } |
||
311 | $form .= "</div>"; |
||
312 | } |
||
313 | |||
314 | $out2 .= $form; |
||
315 | |||
316 | |||
317 | |||
318 | // ---------- user data set (dbConfig_a.php) |
||
319 | |||
320 | |||
321 | //if we are installing in custom mode, include the following html |
||
322 | if($db->supports("create_user")) { |
||
323 | // create / set db user dropdown |
||
324 | $auto_select = ''; |
||
325 | $provide_select = ''; |
||
326 | $create_select = ''; |
||
327 | $same_select = ''; |
||
328 | if (isset($_SESSION['dbUSRData'])) { |
||
329 | // if($_SESSION['dbUSRData']=='auto') {$auto_select ='selected';} |
||
330 | if ($_SESSION['dbUSRData'] == 'provide') { |
||
331 | $provide_select = 'selected'; |
||
332 | } |
||
333 | if (isset($_SESSION['install_type']) && !empty($_SESSION['install_type']) && strtolower($_SESSION['install_type']) == 'custom') { |
||
334 | if ($_SESSION['dbUSRData'] == 'create') { |
||
335 | $create_select = 'selected'; |
||
336 | } |
||
337 | } |
||
338 | if ($_SESSION['dbUSRData'] == 'same') { |
||
339 | $same_select = 'selected'; |
||
340 | } |
||
341 | } else { |
||
342 | $same_select = 'selected'; |
||
343 | } |
||
344 | $dbUSRDD = "<select name='dbUSRData' id='dbUSRData' onchange='toggleDBUser();'>"; |
||
345 | $dbUSRDD .= "<option value='provide' $provide_select>" . $mod_strings['LBL_DBCONFIG_PROVIDE_DD'] . "</option>"; |
||
346 | $dbUSRDD .= "<option value='create' $create_select>" . $mod_strings['LBL_DBCONFIG_CREATE_DD'] . "</option>"; |
||
347 | $dbUSRDD .= "<option value='same' $same_select>" . $mod_strings['LBL_DBCONFIG_SAME_DD'] . "</option>"; |
||
348 | $dbUSRDD .= "</select><br> "; |
||
349 | |||
350 | |||
351 | $setup_db_sugarsales_password = urldecode($_SESSION['setup_db_sugarsales_password']); |
||
352 | $setup_db_sugarsales_user = urldecode($_SESSION['setup_db_sugarsales_user']); |
||
353 | $setup_db_sugarsales_password_retype = urldecode($_SESSION['setup_db_sugarsales_password_retype']); |
||
354 | |||
355 | |||
356 | $out2 .= <<<EOQ2 |
||
357 | <br> |
||
358 | <div class='install_block'> |
||
359 | <!-- |
||
360 | <div class="ibmsg">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div> |
||
361 | --> |
||
362 | </div> |
||
363 | <div class='install_block'> |
||
364 | <div class="formrow"> |
||
365 | <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']}<i> i <div class="tooltip">{$mod_strings['LBL_DBCONFIG_SECURITY']}</div></i></label> |
||
366 | $dbUSRDD |
||
367 | </div> |
||
368 | <div class="clear"></div> |
||
369 | <span id='connection_user_div' style="display:none"> |
||
370 | <div class="formrow"> |
||
371 | <label>{$mod_strings['LBL_DBCONF_SUGAR_DB_USER']} <span class="required">*</span></label> |
||
372 | <input type="text" name="setup_db_sugarsales_user" maxlength="16" value="{$_SESSION['setup_db_sugarsales_user']}" /> |
||
373 | </div> |
||
374 | <div class="clear"></div> |
||
375 | <div class="formrow"> |
||
376 | <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD']}</label> |
||
377 | <input type="password" name="setup_db_sugarsales_password_entry" value="{$setup_db_sugarsales_password}" /> |
||
378 | <input type="hidden" name="setup_db_sugarsales_password" value="{$setup_db_sugarsales_password}" /> |
||
379 | </div> |
||
380 | <div class="clear"></div> |
||
381 | <div class="formrow"> |
||
382 | <label>{$mod_strings['LBL_DBCONF_DB_PASSWORD2']}</label> |
||
383 | <input type="password" name="setup_db_sugarsales_password_retype_entry" value="{$setup_db_sugarsales_password_retype}" /> |
||
384 | <input type="hidden" name="setup_db_sugarsales_password_retype" value="{$setup_db_sugarsales_password_retype}" /> |
||
385 | </div> |
||
386 | </span> |
||
387 | </div> |
||
388 | |||
389 | EOQ2; |
||
390 | } |
||
391 | $out =$out2; |
||
392 | |||
393 | |||
394 | |||
395 | // ------ siteConfig_a.php |
||
396 | $out .=<<<EOQ |
||
397 | </div> |
||
398 | </div> |
||
399 | <div class="floatbox" id="fb6"> |
||
400 | <h2>{$mod_strings['LBL_SITECFG_TITLE']}</h2> |
||
401 | <div class="form_section"> |
||
402 | <p>{$errors}</p> |
||
403 | <div class="required">{$mod_strings['LBL_REQUIRED']}</div> |
||
404 | |||
405 | <h3>{$mod_strings['LBL_SITECFG_TITLE2']}<div class="tooltip-toggle"><em> i </em><div class="tooltip">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</div></div></h3> |
||
406 | EOQ; |
||
407 | //hide this in typical mode |
||
408 | if(!empty($_SESSION['install_type']) && strtolower($_SESSION['install_type'])=='custom'){ |
||
409 | $out .=<<<EOQ |
||
410 | <div class='install_block'> |
||
411 | {$mod_strings['LBL_SITECFG_URL_MSG']} |
||
412 | <span class="required">*</span> |
||
413 | <label><b>{$mod_strings['LBL_SITECFG_URL']}</b></label> |
||
414 | <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> |
||
415 | <br>{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']} |
||
416 | <span class="required">*</span> |
||
417 | <label><b>{$mod_strings['LBL_SYSTEM_NAME']}</b></label> |
||
418 | <input type="text" name="setup_system_name" value="{$_SESSION['setup_system_name']}" size="40" /><br> |
||
419 | </div> |
||
420 | EOQ; |
||
421 | $db = getDbConnection(); |
||
422 | if($db->supports("collation")) { |
||
423 | $collationOptions = $db->getCollationList(); |
||
424 | } |
||
425 | if(!empty($collationOptions)) { |
||
426 | if(isset($_SESSION['setup_db_options']['collation'])) { |
||
427 | $default = $_SESSION['setup_db_options']['collation']; |
||
428 | } else { |
||
429 | $default = $db->getDefaultCollation(); |
||
430 | } |
||
431 | $options = get_select_options_with_id(array_combine($collationOptions, $collationOptions), $default); |
||
432 | $out .=<<<EOQ |
||
433 | <div class='install_block'> |
||
434 | <br>{$mod_strings['LBL_SITECFG_COLLATION_MSG']} |
||
435 | <span class="required">*</span> |
||
436 | <label><b>{$mod_strings['LBL_COLLATION']}</b></label> |
||
437 | <select name="setup_db_collation" id="setup_db_collation">$options</select><br> |
||
438 | </div> |
||
439 | EOQ; |
||
440 | } |
||
441 | } |
||
442 | |||
443 | $help_url = get_help_button_url(); |
||
444 | if(!isset($_SESSION['email1'])) { |
||
445 | $_SESSION['email1'] = null; |
||
446 | } |
||
447 | |||
448 | if(!isset($_SESSION['setup_site_admin_user_name'])) { |
||
449 | $_SESSION['setup_site_admin_user_name'] = null; |
||
450 | } |
||
451 | |||
452 | $out .=<<<EOQ |
||
453 | <div class='install_block'> |
||
454 | <!-- |
||
455 | <p class="ibmsg">{$mod_strings['LBL_SITECFG_PASSWORD_MSG']}</p> |
||
456 | --> |
||
457 | <div class="formrow big"> |
||
458 | <label>{$mod_strings['LBL_SITECFG_ADMIN_Name']} <span class="required">*</span></label> |
||
459 | <input type="text" name="setup_site_admin_user_name" value="{$_SESSION['setup_site_admin_user_name']}" size="20" maxlength="60" /> |
||
460 | </div> |
||
461 | |||
462 | <div class="clear"></div> |
||
463 | |||
464 | <div class="formrow big"> |
||
465 | <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS']} <span class="required">*</span></label> |
||
466 | <input type="password" name="setup_site_admin_password" value="{$_SESSION['setup_site_admin_password']}" size="20" /> |
||
467 | </div> |
||
468 | |||
469 | <div class="clear"></div> |
||
470 | |||
471 | <div class="formrow big"> |
||
472 | <label>{$mod_strings['LBL_SITECFG_ADMIN_PASS_2']} <span class="required">*</span></label> |
||
473 | <input type="password" name="setup_site_admin_password_retype" value="{$_SESSION['setup_site_admin_password_retype']}" size="20" /> |
||
474 | </div> |
||
475 | |||
476 | <div class="clear"></div> |
||
477 | |||
478 | <div class="formrow big"> |
||
479 | <label>{$mod_strings['LBL_SITECFG_URL']} <span class="required">*</span></label> |
||
480 | <input type="text" name="setup_site_url" value="{$_SESSION['setup_site_url']}" size="40" /> |
||
481 | </div> |
||
482 | |||
483 | <div class="clear"></div> |
||
484 | |||
485 | |||
486 | <div class="formrow big"> |
||
487 | <label>{$mod_strings['LBL_EMAIL_ADDRESS']} <span class="required">*</span></label> |
||
488 | <input type="email" name="email1" value="{$_SESSION['email1']}" size="40" /> |
||
489 | </div> |
||
490 | |||
491 | <div class="clear"></div> |
||
492 | |||
493 | |||
494 | <div class="clear"></div> |
||
495 | <!-- |
||
496 | <a href="javascript:;" onclick="$('.security-block').toggle();">More..</a><br/><br/> |
||
497 | --> |
||
498 | EOQ; |
||
499 | |||
500 | |||
501 | $out.=<<<EOQ |
||
502 | </div> |
||
503 | EOQ; |
||
504 | |||
505 | $out .= <<<EOQ |
||
506 | |||
507 | EOQ; |
||
508 | |||
509 | |||
510 | |||
511 | // ------------------ |
||
512 | // Choose Demo Data |
||
513 | // -------------------------> |
||
514 | |||
515 | |||
516 | //demo data select |
||
517 | $demoDD = "<select name='demoData' id='demoData' class='select'><option value='no' >".$mod_strings['LBL_NO']."</option><option value='yes'>".$mod_strings['LBL_YES']."</option>"; |
||
518 | $demoDD .= "</select>"; |
||
519 | |||
520 | $out .=<<<EOQ3 |
||
521 | </div> |
||
522 | </div> |
||
523 | |||
524 | <div class="floatbox full" id="fb0"> |
||
525 | <h2>{$mod_strings['LBL_MORE_OPTIONS_TITLE']}</h2> |
||
526 | </div> |
||
527 | |||
528 | <div class="floatbox full" id="fb1"> |
||
529 | <div class="install_block"> |
||
530 | <h3 onclick="$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_DBCONF_DEMO_DATA_TITLE']}</h3> |
||
531 | |||
532 | <div class="form_section" style="display: none;"> |
||
533 | <div class="clear"></div> |
||
534 | <div class="formrow big"> |
||
535 | <label>{$mod_strings['LBL_DBCONF_DEMO_DATA']}</label> |
||
536 | {$demoDD} |
||
537 | </div> |
||
538 | </div> |
||
539 | </div> |
||
540 | </div> |
||
541 | EOQ3; |
||
542 | |||
543 | |||
544 | |||
545 | |||
546 | //--------------- |
||
547 | // SMTP Settings |
||
548 | //--------------------> |
||
549 | |||
550 | |||
551 | // smtp |
||
552 | // TODO-t: test it for all types |
||
553 | $MAIL_SSL_OPTIONS_GMAIL = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '2'); |
||
554 | //$MAIL_SSL_OPTIONS_YAHOO = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], '1'); |
||
555 | $MAIL_SSL_OPTIONS_EXCHG = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); |
||
556 | $MAIL_SSL_OPTIONS_OTHER = get_select_options_with_id($app_list_strings['email_settings_for_ssl'], 'none'); |
||
557 | |||
558 | // set default notify_allow_default_outbound checkbox value |
||
559 | $notify_allow_default_outbound_checked = empty($_SESSION['notify_allow_default_outbound']) ? '' : ' checked="checked" '; |
||
560 | |||
561 | // set default smtp toggle buttons selected value |
||
562 | if(empty($_SESSION['smtp_tab_selected'])) $_SESSION['smtp_tab_selected'] = 'smtp_tab_other'; |
||
563 | |||
564 | $out .= <<<EOQ |
||
565 | <div class="floatbox full" id="fb2"> |
||
566 | <!-- smtp settings --> |
||
567 | <h3 onclick="$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_MAIL_SMTP_SETTINGS']}</h3> |
||
568 | <div style="display: none;"> |
||
569 | |||
570 | <br> |
||
571 | <!-- |
||
572 | <p>{$mod_strings['LBL_WIZARD_SMTP_DESC']}</p> |
||
573 | --> |
||
574 | |||
575 | <!-- smtp types toggler buttons --> |
||
576 | |||
577 | <p style="display: inline;">{$mod_strings['LBL_CHOOSE_EMAIL_PROVIDER']} </p><div class="tooltip-toggle"> <em>i</em> <div class="tooltip">{$mod_strings['LBL_WIZARD_SMTP_DESC']}</div></div> |
||
578 | <div class="clear"></div> |
||
579 | <div> |
||
580 | <input type="button" class="smtp_tab_toggler" id="smtp_tab_gmail_toggler" for="smtp_tab_gmail" value="{$mod_strings['LBL_SMTPTYPE_GMAIL']}" /> |
||
581 | <input type="button" class="smtp_tab_toggler" id="smtp_tab_yahoo_toggler" for="smtp_tab_yahoo" value="{$mod_strings['LBL_SMTPTYPE_YAHOO']}" /> |
||
582 | <input type="button" class="smtp_tab_toggler" id="smtp_tab_exchange_toggler" for="smtp_tab_exchange" value="{$mod_strings['LBL_SMTPTYPE_EXCHANGE']}" /> |
||
583 | <input type="button" class="smtp_tab_toggler selected" id="smtp_tab_other_toggler" for="smtp_tab_other" value="{$mod_strings['LBL_SMTPTYPE_OTHER']}" /> |
||
584 | <input type="hidden" name="smtp_tab_selected" value="{$_SESSION['smtp_tab_selected']}"> |
||
585 | </div> |
||
586 | |||
587 | <!-- smtp / gmail tab --> |
||
588 | |||
589 | <div class="form_section smtp_tab" id="smtp_tab_gmail"> |
||
590 | |||
591 | <div class="formrow"> |
||
592 | <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> |
||
593 | <input type="text" name="smtp_tab_gmail[mail_smtpserver]" size="25" maxlength="64" value="smtp.gmail.com"> |
||
594 | </div> |
||
595 | |||
596 | <div class="formrow"> |
||
597 | <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> |
||
598 | <input type="text" name="smtp_tab_gmail[mail_smtpport]" size="5" maxlength="5" value="587"> |
||
599 | </div> |
||
600 | |||
601 | <div class="clear"></div> |
||
602 | |||
603 | <div class="formrow"> |
||
604 | <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> |
||
605 | <input type="checkbox" name="smtp_tab_gmail[mail_smtpauth_req]" id="smtp_tab_gmail__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_1');"> |
||
606 | </div> |
||
607 | |||
608 | <div class="formrow"> |
||
609 | <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> |
||
610 | <select name="smtp_tab_gmail[mail_smtpssl]"> |
||
611 | {$MAIL_SSL_OPTIONS_GMAIL} |
||
612 | </select> |
||
613 | </div> |
||
614 | |||
615 | <div class="clear"></div> |
||
616 | |||
617 | |||
618 | <div class="toggleArea" id="toggleArea_1"> |
||
619 | <div class="formrow"> |
||
620 | <label>{$mod_strings['LBL_GMAIL_SMTPUSER']}</label> |
||
621 | <input type="text" name="smtp_tab_gmail[mail_smtpuser]" id="smtp_tab_gmail__mail_smtpuser" size="25" maxlength="64"> |
||
622 | </div> |
||
623 | |||
624 | <div class="clear"></div> |
||
625 | |||
626 | <div class="formrow"> |
||
627 | <label>{$mod_strings['LBL_GMAIL_SMTPPASS']}</label> |
||
628 | <input type="password" name="smtp_tab_gmail[mail_smtppass]" id="smtp_tab_gmail__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> |
||
629 | </div> |
||
630 | |||
631 | <div class="clear"></div> |
||
632 | |||
633 | <div class="formrow"> |
||
634 | <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> |
||
635 | <input name="smtp_tab_gmail[notify_allow_default_outbound]" id="smtp_tab_gmail__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> |
||
636 | </div> |
||
637 | </div> |
||
638 | |||
639 | <div class="clear"></div> |
||
640 | </div> |
||
641 | |||
642 | <!-- smtp / yahoo! mail tab --> |
||
643 | |||
644 | <div class="form_section smtp_tab" id="smtp_tab_yahoo"> |
||
645 | |||
646 | <input type="hidden" name="smtp_tab_yahoo[mail_smtpserver]" size="25" maxlength="64" value="smtp.mail.yahoo.com"> |
||
647 | <input type="text" name="smtp_tab_yahoo[mail_smtpport]" size="5" maxlength="5" value="465"> |
||
648 | <input type="hidden" name="smtp_tab_yahoo[mail_smtpssl]" value="1"> |
||
649 | |||
650 | <div class="formrow"> |
||
651 | <label>{$mod_strings['LBL_YAHOOMAIL_SMTPUSER']}</label> |
||
652 | <input type="text" name="smtp_tab_yahoo[mail_smtpuser]" size="25" maxlength="64"> |
||
653 | </div> |
||
654 | |||
655 | <div class="clear"></div> |
||
656 | |||
657 | <div class="formrow"> |
||
658 | <label>{$mod_strings['LBL_YAHOOMAIL_SMTPPASS']}</label> |
||
659 | <input type="password" name="smtp_tab_yahoo[mail_smtppass]" size="25" maxlength="64" value="" tabindex="1"> |
||
660 | </div> |
||
661 | |||
662 | <div class="clear"></div> |
||
663 | |||
664 | <div class="formrow"> |
||
665 | <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> |
||
666 | <input name="smtp_tab_yahoo[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> |
||
667 | </div> |
||
668 | |||
669 | <div class="clear"></div> |
||
670 | </div> |
||
671 | |||
672 | <!-- smtp / ms-exchange tab --> |
||
673 | |||
674 | <div class="form_section smtp_tab" id="smtp_tab_exchange"> |
||
675 | |||
676 | <div class="formrow"> |
||
677 | <label>{$mod_strings['LBL_EXCHANGE_SMTPSERVER']}</label> |
||
678 | <input type="text" name="smtp_tab_exchange[mail_smtpserver]" size="25" maxlength="64" value=""> |
||
679 | </div> |
||
680 | |||
681 | <div class="formrow"> |
||
682 | <label>{$mod_strings['LBL_EXCHANGE_SMTPPORT']}</label> |
||
683 | <input type="text" name="smtp_tab_exchange[mail_smtpport]" size="5" maxlength="5" value="25"> |
||
684 | </div> |
||
685 | |||
686 | <div class="clear"></div> |
||
687 | |||
688 | <div class="formrow"> |
||
689 | <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> |
||
690 | <input type="checkbox" name="smtp_tab_exchange[mail_smtpauth_req]" id="smtp_tab_exchange__mail_smtpauth_req" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_2');"> |
||
691 | </div> |
||
692 | |||
693 | <div class="formrow"> |
||
694 | <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> |
||
695 | <select name="smtp_tab_exchange[mail_smtpssl]" tabindex="501"> |
||
696 | {$MAIL_SSL_OPTIONS_EXCHG} |
||
697 | </select> |
||
698 | </div> |
||
699 | |||
700 | <div class="clear"></div> |
||
701 | |||
702 | <div class="toggleArea" id="toggleArea_2"> |
||
703 | <div class="formrow"> |
||
704 | <label>{$mod_strings['LBL_EXCHANGE_SMTPUSER']}</label> |
||
705 | <input type="text" name="smtp_tab_exchange[mail_smtpuser]" id="smtp_tab_exchange__mail_smtpuser" size="25" maxlength="64"> |
||
706 | </div> |
||
707 | |||
708 | <div class="clear"></div> |
||
709 | |||
710 | <div class="formrow"> |
||
711 | <label>{$mod_strings['LBL_EXCHANGE_SMTPPASS']}</label> |
||
712 | <input type="password" name="smtp_tab_exchange[mail_smtppass]" id="smtp_tab_exchange__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> |
||
713 | </div> |
||
714 | |||
715 | <div class="clear"></div> |
||
716 | |||
717 | <div class="formrow"> |
||
718 | <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> |
||
719 | <input name="smtp_tab_exchange[notify_allow_default_outbound]" id="smtp_tab_exchange__notify_allow_default_outbound" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> |
||
720 | </div> |
||
721 | </div> |
||
722 | |||
723 | <div class="clear"></div> |
||
724 | </div> |
||
725 | |||
726 | <!-- smtp / other tab--> |
||
727 | |||
728 | <div class="form_section smtp_tab" id="smtp_tab_other"> |
||
729 | |||
730 | <div class="formrow"> |
||
731 | <label>{$mod_strings['LBL_MAIL_SMTPSERVER']}</label> |
||
732 | <input type="text" name="smtp_tab_other[mail_smtpserver]" size="25" maxlength="64" value=""> |
||
733 | </div> |
||
734 | |||
735 | <div class="formrow"> |
||
736 | <label>{$mod_strings['LBL_MAIL_SMTPPORT']}</label> |
||
737 | <input type="text" name="smtp_tab_other[mail_smtpport]" size="5" maxlength="5" value="25"> |
||
738 | </div> |
||
739 | |||
740 | <div class="clear"></div> |
||
741 | |||
742 | <div class="formrow"> |
||
743 | <label>{$mod_strings['LBL_MAIL_SMTPAUTH_REQ']}</label> |
||
744 | <input type="hidden" name="smtp_tab_other[mail_smtpauth_req]" value="0"> |
||
745 | <input type="checkbox" id="mail_smtpauth_req_chk" name="smtp_tab_other[mail_smtpauth_req]" value="1" checked="checked" onclick="toggleSMTPAuthSettings(this, 'toggleArea_3');"> |
||
746 | </div> |
||
747 | |||
748 | <div class="formrow"> |
||
749 | <label>{$mod_strings['LBL_EMAIL_SMTP_SSL_OR_TLS']}</label> |
||
750 | <select name="smtp_tab_other[mail_smtpssl]" tabindex="501"> |
||
751 | {$MAIL_SSL_OPTIONS_OTHER} |
||
752 | </select> |
||
753 | </div> |
||
754 | |||
755 | <div class="clear"></div> |
||
756 | |||
757 | <div class="toggleArea" id="toggleArea_3"> |
||
758 | <div class="formrow"> |
||
759 | <label>{$mod_strings['LBL_MAIL_SMTPUSER']}</label> |
||
760 | <input type="text" name="smtp_tab_other[mail_smtpuser]" id="smtp_tab_other__mail_smtpuser" size="25" maxlength="64"> |
||
761 | </div> |
||
762 | |||
763 | <div class="clear"></div> |
||
764 | |||
765 | <div class="formrow"> |
||
766 | <label>{$mod_strings['LBL_MAIL_SMTPPASS']}</label> |
||
767 | <input type="password" name="smtp_tab_other[mail_smtppass]" id="smtp_tab_other__mail_smtppass" size="25" maxlength="64" value="" tabindex="1"> |
||
768 | </div> |
||
769 | |||
770 | <div class="clear"></div> |
||
771 | |||
772 | <div class="formrow"> |
||
773 | <label>{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION']} <i>i<div class="tooltip">{$mod_strings['LBL_ALLOW_DEFAULT_SELECTION_HELP']}</div></i></label> |
||
774 | <input type="hidden" name="smtp_tab_other[notify_allow_default_outbound]" value="0"> |
||
775 | <input id="notify_allow_default_outbound_chk" name="smtp_tab_other[notify_allow_default_outbound]" value="2" tabindex="1" class="checkbox" type="checkbox" {$notify_allow_default_outbound_checked}> |
||
776 | </div> |
||
777 | </div> |
||
778 | |||
779 | <div class="clear"></div> |
||
780 | <!-- </div> --> |
||
781 | |||
782 | <!-- smtp default values & tabs toggler js & tooltip help --> |
||
783 | |||
784 | <script> |
||
785 | |||
786 | var toggleSMTPAuthFields = { |
||
787 | toggleArea_1 : { |
||
788 | user: 'smtp_tab_gmail__mail_smtpuser', |
||
789 | pass: 'smtp_tab_gmail__mail_smtppass', |
||
790 | allow: 'smtp_tab_gmail__notify_allow_default_outbound' |
||
791 | }, |
||
792 | toggleArea_2 : { |
||
793 | user: 'smtp_tab_exchange__mail_smtpuser', |
||
794 | pass: 'smtp_tab_exchange__mail_smtppass', |
||
795 | allow: 'smtp_tab_exchange__notify_allow_default_outbound' |
||
796 | }, |
||
797 | toggleArea_3 : { |
||
798 | user: 'smtp_tab_other__mail_smtpuser', |
||
799 | pass: 'smtp_tab_other__mail_smtppass', |
||
800 | allow: 'notify_allow_default_outbound_chk' |
||
801 | } |
||
802 | }; |
||
803 | |||
804 | var toggleSMTPAuthSettings = function(chkbox, elemID) { |
||
805 | if($(chkbox).prop('checked')) { |
||
806 | $('#' + elemID).show(); |
||
807 | } |
||
808 | else { |
||
809 | $('#' + toggleSMTPAuthFields[elemID].user).val(''); |
||
810 | $('#' + toggleSMTPAuthFields[elemID].pass).val(''); |
||
811 | $('#' + toggleSMTPAuthFields[elemID].allow).prop('checked', false); |
||
812 | $('#' + elemID).hide(); |
||
813 | } |
||
814 | }; |
||
815 | |||
816 | $(function(){ |
||
817 | |||
818 | $('.smtp_tab_toggler').click(function(){ |
||
819 | $('.smtp_tab_toggler.selected').removeClass('selected'); |
||
820 | $(this).addClass('selected'); |
||
821 | $('.smtp_tab').hide(); |
||
822 | $('#'+$(this).attr('for')).show(); |
||
823 | $('input[name="smtp_tab_selected"]').val($(this).attr('for')); |
||
824 | }); |
||
825 | |||
826 | // save last selected tab and set as default when form (re)load |
||
827 | $('#{$_SESSION['smtp_tab_selected']}_toggler').click(); |
||
828 | |||
829 | $('select[name="smtp_tab_gmail[mail_smtpssl]"] option').each(function(){ |
||
830 | if(!$(this).html()) { |
||
831 | $(this).html('-none-'); |
||
832 | } |
||
833 | }); |
||
834 | $('select[name="smtp_tab_yahoo[mail_smtpssl]"] option').each(function(){ |
||
835 | if(!$(this).html()) { |
||
836 | $(this).html('-none-'); |
||
837 | } |
||
838 | }); |
||
839 | $('select[name="smtp_tab_exchange[mail_smtpssl]"] option').each(function(){ |
||
840 | if(!$(this).html()) { |
||
841 | $(this).html('-none-'); |
||
842 | } |
||
843 | }); |
||
844 | $('select[name="smtp_tab_other[mail_smtpssl]"] option').each(function(){ |
||
845 | if(!$(this).html()) { |
||
846 | $(this).html('-none-'); |
||
847 | } |
||
848 | }); |
||
849 | |||
850 | |||
851 | toggleSMTPAuthSettings(document.getElementById('smtp_tab_gmail__mail_smtpauth_req'), 'toggleArea_1'); |
||
852 | toggleSMTPAuthSettings(document.getElementById('smtp_tab_exchange__mail_smtpauth_req'), 'toggleArea_2'); |
||
853 | toggleSMTPAuthSettings(document.getElementById('mail_smtpauth_req_chk'), 'toggleArea_3'); |
||
854 | |||
855 | }); |
||
856 | </script> |
||
857 | |||
858 | </div> <!-- toggle hidden box end --> |
||
859 | EOQ; |
||
860 | |||
861 | |||
862 | // db setup (dbConfig_a.php) |
||
863 | $out2 =<<<EOQ2 |
||
864 | <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''> |
||
865 | </div> |
||
866 | EOQ2; |
||
867 | |||
868 | |||
869 | |||
870 | |||
871 | |||
872 | |||
873 | |||
874 | // ---------- |
||
875 | // Branding |
||
876 | // -------------> |
||
877 | |||
878 | // company logo |
||
879 | $currentLogoLink = SugarThemeRegistry::current()->getImageURL('company_logo.png'); |
||
880 | // show logo if we have |
||
881 | $hiddenLogo = ''; |
||
882 | if(!file_exists($currentLogoLink)) { |
||
883 | $hiddenLogo = 'display:none;'; |
||
884 | } |
||
885 | |||
886 | |||
887 | // TODO--low: check the tooltip text at the logo image! |
||
888 | |||
889 | $out .= <<<EOQ |
||
890 | |||
891 | <!-- Branding --> |
||
892 | </div> |
||
893 | </div> |
||
894 | <div class="floatbox full" id="fb3"> |
||
895 | <h3 onclick="$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_WIZARD_SYSTEM_TITLE']}</h3> |
||
896 | |||
897 | <div class="form_section" style="display: none;"> |
||
898 | |||
899 | <p class="ibmsg">{$mod_strings['LBL_WIZARD_SYSTEM_DESC']}</p> |
||
900 | |||
901 | <p class="ibmsg">{$mod_strings['LBL_SITECFG_SYS_NAME_MSG']}</p> |
||
902 | |||
903 | <div class="formrow"> |
||
904 | <label>{$mod_strings['SYSTEM_NAME_WIZARD']} <i>i<div class="tooltip">{$mod_strings['SYSTEM_NAME_HELP']}</div></i></label> |
||
905 | <input type="text" name="setup_system_name" size="25" maxlength="64" value="{$_SESSION['setup_system_name']}"> |
||
906 | </div> |
||
907 | |||
908 | <div class="clear"></div> |
||
909 | |||
910 | <div class="formrow"> |
||
911 | <!-- file upload --> |
||
912 | <label>{$mod_strings['NEW_LOGO']} <i>i<div class="tooltip">{$mod_strings['NEW_LOGO_HELP']}</div></i></label> |
||
913 | <input type="file" name="company_logo" id="company_logo"> |
||
914 | </div> |
||
915 | |||
916 | <div class="clear"></div> |
||
917 | |||
918 | <div class="formrow"> |
||
919 | <label> </label> |
||
920 | <input type="button" name="company_logo_upload_btn" value="{$mod_strings['COMPANY_LOGO_UPLOAD_BTN']}" onclick="onUploadImageClick(this);"> |
||
921 | </div> |
||
922 | |||
923 | |||
924 | <div class="clear"></div> |
||
925 | |||
926 | <div class="formrow" id="current_logo_row"> |
||
927 | <label>{$mod_strings['CURRENT_LOGO']} <i>i<div class="tooltip">{$mod_strings['CURRENT_LOGO_HELP']}</div></i> </label> |
||
928 | <img height="100" src="$currentLogoLink" alt="Company Logo" style="max-height: 100px; max-width: 230px; float:left; $hiddenLogo" /> |
||
929 | </div> |
||
930 | |||
931 | <div class="clear"></div> |
||
932 | </div> |
||
933 | |||
934 | EOQ; |
||
935 | |||
936 | |||
937 | // System location defaults |
||
938 | |||
939 | // TODO--low: 1000s sep, Decimal Symb, Name Format |
||
940 | |||
941 | $defaultDateFormatSelect = self::getSelect('default_date_format', $sugarConfigDefaults['date_formats'], empty($_SESSION['default_date_format']) ? $sugarConfigDefaults['datef'] : $_SESSION['default_date_format']); |
||
942 | $defaultTimeFormatSelect = self::getSelect('default_time_format', $sugarConfigDefaults['time_formats'], empty($_SESSION['default_time_format']) ? 'h:ia' : $_SESSION['default_time_format'] /* $sugarConfigDefaults['timef'] */); |
||
943 | |||
944 | $timezoneSelect = self::getSelect('timezone', array_merge(array(TimeDate::guessTimezone() => TimeDate::guessTimezone()), TimeDate::getTimezoneList()), TimeDate::guessTimezone()); |
||
945 | |||
946 | //$defaultLanguageSelect = get_select_options_with_id($supportedLanguages, $current_language); |
||
947 | $defaultLanguageSelect = self::getSelect('default_language', $supportedLanguages, $current_language); |
||
948 | |||
949 | // example name formats (its are in the original language file so may this functionality was there in the original sugarcrm installer also) |
||
950 | $nonDBLocalization = new NonDBLocalization(); |
||
951 | $sugarConfigDefaults['name_formats'] = $nonDBLocalization->getUsableLocaleNameOptions($sugarConfigDefaults['name_formats']); |
||
952 | $defaultLocalNameFormatSelect = self::getSelect('default_locale_name_format', $sugarConfigDefaults['name_formats'], empty($_SESSION['default_locale_name_format']) ? $sugarConfigDefaults['default_locale_name_format'] : $_SESSION['default_locale_name_format']); |
||
953 | |||
954 | $out .= <<<EOQ |
||
955 | </div> |
||
956 | <!-- System Local Settings --> |
||
957 | <!-- TODO--low: add the time-zone settings here!! --> |
||
958 | <div class="floatbox full" id="fb4"> |
||
959 | <h3 onclick="$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_LOCALE_TITLE']}</h3> |
||
960 | |||
961 | <div class="form_section" style="display: none;"> |
||
962 | |||
963 | <p class="ibmsg">{$mod_strings['LBL_WIZARD_LOCALE_DESC']}</p> |
||
964 | |||
965 | <div class="formrow"> |
||
966 | <label>{$mod_strings['LBL_DATE_FORMAT']}</label> |
||
967 | $defaultDateFormatSelect |
||
968 | </div> |
||
969 | |||
970 | <div class="formrow"> |
||
971 | <label>{$mod_strings['LBL_TIME_FORMAT']}</label> |
||
972 | $defaultTimeFormatSelect |
||
973 | </div> |
||
974 | |||
975 | <div class="clear"></div> |
||
976 | |||
977 | <div class="formrow"> |
||
978 | <label>{$mod_strings['LBL_TIMEZONE']}</label> |
||
979 | $timezoneSelect |
||
980 | </div> |
||
981 | |||
982 | <div class="clear"></div> |
||
983 | |||
984 | <div class="formrow" style="display: none;"> |
||
985 | <label>{$mod_strings['LBL_LANGUAGE']}</label> |
||
986 | $defaultLanguageSelect |
||
987 | </div> |
||
988 | |||
989 | <div class="clear"></div> |
||
990 | |||
991 | <div class="formrow"> |
||
992 | <label>{$mod_strings['LBL_CURRENCY']}</label> |
||
993 | <input type="text" name="default_currency_name" value="{$sugarConfigDefaults['default_currency_name']}"> |
||
994 | </div> |
||
995 | |||
996 | <div class="formrow"> |
||
997 | <label>{$mod_strings['LBL_CURRENCY_SYMBOL']}</label> |
||
998 | <input type="text" name="default_currency_symbol" size="4" value="{$sugarConfigDefaults['default_currency_symbol']}"> |
||
999 | </div> |
||
1000 | |||
1001 | <div class="clear"></div> |
||
1002 | |||
1003 | <div class="formrow"> |
||
1004 | <label>{$mod_strings['LBL_CURRENCY_ISO4217']}</label> |
||
1005 | <input type="text" name="default_currency_iso4217" size="4" value="{$sugarConfigDefaults['default_currency_iso4217']}"> |
||
1006 | </div> |
||
1007 | |||
1008 | <!-- |
||
1009 | <div class="formrow"> |
||
1010 | <label>{$mod_strings['LBL_NUMBER_GROUPING_SEP']}</label> |
||
1011 | <input type="text" name="default_number_grouping_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_number_grouping_seperator']}"> |
||
1012 | </div> |
||
1013 | |||
1014 | |||
1015 | <div class="formrow"> |
||
1016 | <label>{$mod_strings['LBL_DECIMAL_SEP']}</label> |
||
1017 | <input type="text" name="default_decimal_seperator" size="3" maxlength="1" value="{$sugarConfigDefaults['default_decimal_seperator']}"> |
||
1018 | </div> |
||
1019 | |||
1020 | <div class="clear"></div> |
||
1021 | |||
1022 | <div class="formrow"> |
||
1023 | <label>{$mod_strings['LBL_NAME_FORMAT']}</label> |
||
1024 | $defaultLocalNameFormatSelect |
||
1025 | </div> |
||
1026 | --> |
||
1027 | |||
1028 | <div class="clear"></div> |
||
1029 | </div> |
||
1030 | </div> |
||
1031 | |||
1032 | EOQ; |
||
1033 | |||
1034 | |||
1035 | $out.= "<div class=\"floatbox full\">"; |
||
1036 | $out.= " <h3 onclick=\"$(this).next().toggle();\" class=\"toggler\">» {$mod_strings['LBL_SITECFG_SECURITY_TITLE']}</h3>"; |
||
1037 | |||
1038 | $out.=<<<EOQ |
||
1039 | |||
1040 | <div class="security-block" style="display:none;"> |
||
1041 | <table cellspacing="0" cellpadding="0" border="0" align="center" class="shell"> |
||
1042 | <tr><td colspan="2" id="help"><!-- <a href="{$help_url}" target='_blank'>{$mod_strings['LBL_HELP']} </a> --></td></tr> |
||
1043 | <tr> |
||
1044 | <th width="500"> |
||
1045 | </th> |
||
1046 | <th width="200" style="text-align: right;"> </th> |
||
1047 | </tr> |
||
1048 | <tr> |
||
1049 | <td colspan="2"> |
||
1050 | {$errors} |
||
1051 | <div class="required">{$mod_strings['LBL_REQUIRED']}</div> |
||
1052 | <table width="100%" cellpadding="0" cellpadding="0" border="0" class="StyleDottedHr"> |
||
1053 | <tr><th colspan="3" align="left">{$mod_strings['LBL_SITECFG_SITE_SECURITY']}</td></tr> |
||
1054 | |||
1055 | EOQ; |
||
1056 | $checked = ''; |
||
1057 | //if(!empty($_SESSION['setup_site_sugarbeet_anonymous_stats'])) $checked = 'checked=""'; |
||
1058 | $out .= " |
||
1059 | <tr style='display:none'><td></td> |
||
1060 | <td><input type='checkbox' class='checkbox' name='setup_site_sugarbeet_anonymous_stats' value='yes' $checked /></td> |
||
1061 | <td><b>{$mod_strings['LBL_SITECFG_ANONSTATS']}</b><br><i>{$mod_strings['LBL_SITECFG_ANONSTATS_DIRECTIONS']}</i></td></tr> |
||
1062 | |||
1063 | "; |
||
1064 | $checked = ''; |
||
1065 | //if(!empty($_SESSION['setup_site_sugarbeet_automatic_checks'])) $checked = 'checked=""'; |
||
1066 | $out .= <<<EOQ |
||
1067 | <tr style='display:none'><td></td> |
||
1068 | <td><input type="checkbox" class="checkbox" name="setup_site_sugarbeet_automatic_checks" value="yes" /></td> |
||
1069 | <td><b>{$mod_strings['LBL_SITECFG_SUGAR_UP']}</b><br><i>{$mod_strings['LBL_SITECFG_SUGAR_UP_DIRECTIONS']}</i><br> </td></tr> |
||
1070 | <tbody id="setup_site_session_section_pre"> |
||
1071 | <tr><td></td> |
||
1072 | <td><input type="checkbox" class="checkbox" name="setup_site_custom_session_path" value="yes" onclick="javascript:$('#setup_site_session_section').toggle();" {$customSession} /></td> |
||
1073 | <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION']}</b><br> |
||
1074 | <em>{$mod_strings['LBL_SITECFG_CUSTOM_SESSION_DIRECTIONS']}</em><br> </td> |
||
1075 | </tr> |
||
1076 | </tbody> |
||
1077 | <tbody id="setup_site_session_section" {$customSessionHidden}> |
||
1078 | <tr><td></td> |
||
1079 | <td style="text-align : right;"></td> |
||
1080 | <td align="left"> |
||
1081 | <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_SESSION_PATH']} <span class="required">*</span></div> |
||
1082 | <input type="text" name="setup_site_session_path" size='40' value="{$_SESSION['setup_site_session_path']}" /></td> |
||
1083 | </div> |
||
1084 | </td> |
||
1085 | </tr> |
||
1086 | </tbody> |
||
1087 | <tbody id="setup_site_log_dir_pre"> |
||
1088 | <tr><td></td> |
||
1089 | <td><input type="checkbox" class="checkbox" name="setup_site_custom_log_dir" value="yes" onclick="javascript:$('#setup_site_log_dir').toggle();" {$customLog} /></td> |
||
1090 | <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_LOG']}</b><br> |
||
1091 | <em>{$mod_strings['LBL_SITECFG_CUSTOM_LOG_DIRECTIONS']}</em><br> </td> |
||
1092 | </tr> |
||
1093 | </tbody> |
||
1094 | <tbody id="setup_site_log_dir" {$customLogHidden}> |
||
1095 | <tr><td></td> |
||
1096 | <td style="text-align : right;" ></td> |
||
1097 | <td align="left"> |
||
1098 | <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_LOG_DIR']} <span class="required">*</span></div> |
||
1099 | <input type="text" name="setup_site_log_dir" size='30' value="{$_SESSION['setup_site_log_dir']}" /> |
||
1100 | </div> |
||
1101 | </tr> |
||
1102 | </tbody> |
||
1103 | <tbody id="setup_site_guid_section_pre"> |
||
1104 | <tr><td></td> |
||
1105 | <td><input type="checkbox" class="checkbox" name="setup_site_specify_guid" value="yes" onclick="javascript:$('#setup_site_guid_section').toggle();" {$customId} /></td> |
||
1106 | <td><b>{$mod_strings['LBL_SITECFG_CUSTOM_ID']}</b><br> |
||
1107 | <em>{$mod_strings['LBL_SITECFG_CUSTOM_ID_DIRECTIONS']}</em><br> </td> |
||
1108 | </tr> |
||
1109 | </tbody> |
||
1110 | <tbody id="setup_site_guid_section" {$customIdHidden}> |
||
1111 | <tr><td></td> |
||
1112 | <td style="text-align : right;"></td> |
||
1113 | <td align="left"> |
||
1114 | <div><div style="width:200px;float:left">{$mod_strings['LBL_SITECFG_APP_ID']} <span class="required">*</span></div> |
||
1115 | <input type="text" name="setup_site_guid" size='30' value="{$_SESSION['setup_site_guid']}" /> |
||
1116 | </div> |
||
1117 | </td> |
||
1118 | </tr> |
||
1119 | </tbody> |
||
1120 | </table> |
||
1121 | </td> |
||
1122 | </tr> |
||
1123 | </table> |
||
1124 | </div> |
||
1125 | EOQ; |
||
1126 | |||
1127 | $out.= "</div>"; |
||
1128 | |||
1129 | |||
1130 | |||
1131 | return $out; |
||
1132 | } |
||
1133 | |||
1134 | private function getFormControlls($mod_strings, $formId) { |
||
1135 | $out =<<<EOQ |
||
1136 | <div id="checkingDiv" style="display:none"> |
||
1137 | <p><img alt="{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}" src='install/processing.gif'> <br>{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}</p> |
||
1138 | </div> |
||
1139 | <div id='sysCheckMsg' style="display:none"> |
||
1140 | <p>{$mod_strings['LBL_DROP_DB_CONFIRM']}</p> |
||
1141 | <input id='accept_btn' type='button' class='button' onclick='confirm_drop_tables(true)' value="{$mod_strings['LBL_ACCEPT']}"> |
||
1142 | <input type='button' class='button' onclick='confirm_drop_tables(false)' id="button_cancel_dbConfig" value="{$mod_strings['LBL_CANCEL']}"> |
||
1143 | </div> |
||
1144 | |||
1145 | <div id="preloaderDiv" style="display:none"> |
||
1146 | <p><img alt="Please wait.." src='install/processing.gif'> <br><span id="process_msg">Please wait..</span></p> |
||
1147 | </div> |
||
1148 | <div class="clear"></div> |
||
1149 | |||
1150 | <div id="errorMsgs" style="display:none"></div> |
||
1151 | |||
1152 | <div class="text-right"> |
||
1153 | <input type='hidden' name='setup_db_drop_tables' id='setup_db_drop_tables' value=''> |
||
1154 | |||
1155 | <input type="hidden" name="goto" id="goto"> |
||
1156 | <input type="hidden" id="hidden_goto" name="goto" value="{$mod_strings['LBL_BACK']}" /> |
||
1157 | |||
1158 | <input class="button" type="button" value="{$mod_strings['LBL_BACK']}" id="button_back_settings" onclick="onBackClick(this); //document.getElementById('goto').value='{$mod_strings['LBL_BACK']}';document.getElementById('$formId').submit();" /> |
||
1159 | <!-- |
||
1160 | <input class="button" type="button" value="{$mod_strings['LBL_LANG_BUTTON_COMMIT']}" onclick="document.getElementById('goto').value='{$mod_strings['LBL_NEXT']}';document.getElementById('$formId').submit();" id="button_next2"/> |
||
1161 | --> |
||
1162 | <input class="button" type="button" name="goto" id="button_next2" value="{$mod_strings['LBL_NEXT']}" onClick="onNextClick(this); //callDBCheck();"/> |
||
1163 | <script> |
||
1164 | |||
1165 | /** |
||
1166 | * Back button clicked |
||
1167 | */ |
||
1168 | var onBackClick = function(e) { |
||
1169 | removeSMTPSettings(); |
||
1170 | storeConfig(e, function(){ |
||
1171 | removeSMTPSettings(); |
||
1172 | // original back-submit |
||
1173 | document.getElementById('goto').value='{$mod_strings['LBL_BACK']}'; |
||
1174 | document.getElementById('$formId').submit(); |
||
1175 | }); |
||
1176 | }; |
||
1177 | |||
1178 | |||
1179 | /** |
||
1180 | * Preloader popup panel. |
||
1181 | */ |
||
1182 | var preloaderMsgPanel; |
||
1183 | |||
1184 | /** |
||
1185 | * Show a preloader popup panel. |
||
1186 | */ |
||
1187 | var preloaderOn = function(msg, status) { |
||
1188 | //$('#process_msg').html(msg); |
||
1189 | //$('#preloaderDiv').show(); |
||
1190 | getPanel = function() { |
||
1191 | var args = { width:"300px", |
||
1192 | modal:true, |
||
1193 | fixedcenter: true, |
||
1194 | constraintoviewport: false, |
||
1195 | underlay:"shadow", |
||
1196 | close:false, |
||
1197 | draggable:true, |
||
1198 | |||
1199 | effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5} |
||
1200 | } ; |
||
1201 | msg_panel = new YAHOO.widget.Panel('p_msg', args); |
||
1202 | |||
1203 | msg_panel.setHeader(msg); |
||
1204 | status = status?status:'Please wait...'; |
||
1205 | msg_panel.setBody('<p><img alt="'+status+'" src="install/processing.gif"><br><span class="preloader-status">'+status+'</span></p>'); |
||
1206 | msg_panel.render(document.body); |
||
1207 | preloaderMsgPanel = msg_panel; |
||
1208 | } |
||
1209 | getPanel(); |
||
1210 | preloaderMsgPanel.show; |
||
1211 | }; |
||
1212 | |||
1213 | /** |
||
1214 | * Popup panel hide. |
||
1215 | */ |
||
1216 | var preloaderOff = function() { |
||
1217 | //$('#process_msg').html(''); |
||
1218 | //$('#preloaderDiv').hide(); |
||
1219 | preloaderMsgPanel.hide(); |
||
1220 | }; |
||
1221 | |||
1222 | /** |
||
1223 | * Change status message in popup panel. |
||
1224 | */ |
||
1225 | var preloaderSetStatus = function(msg) { |
||
1226 | $('.preloader-status').html(msg); |
||
1227 | }; |
||
1228 | |||
1229 | /** |
||
1230 | * Otiginal callback function for compant logo uploader, override this function to callback the upload finist event. |
||
1231 | */ |
||
1232 | var uploadLogoCallback = function(status) { |
||
1233 | // Upload finished, more details in status. (override this function) |
||
1234 | }; |
||
1235 | |||
1236 | /** |
||
1237 | * Upload company logo in uploader-iframe. |
||
1238 | */ |
||
1239 | var uploadLogo = function(e, cb) { |
||
1240 | if(cb) { |
||
1241 | uploadLogoCallback = cb; |
||
1242 | } |
||
1243 | $(e.form).attr('action', 'install.php?sugar_body_only=1&uploadLogo=1&callback=uploadLogoCallback') |
||
1244 | $(e.form).attr('target', 'upload_target'); |
||
1245 | $(e.form).submit(); |
||
1246 | }; |
||
1247 | |||
1248 | /** |
||
1249 | * Store config into the server session. |
||
1250 | */ |
||
1251 | var storeConfig = function(e, cb) { |
||
1252 | var _cb = false; |
||
1253 | if(cb) { |
||
1254 | _cb = cb; |
||
1255 | } |
||
1256 | $.post('install.php?sugar_body_only=1&storeConfig=1', $(e.form).serialize(), function(resp, err){ |
||
1257 | if(err!=='success') { |
||
1258 | console.error(err); |
||
1259 | } |
||
1260 | else if(resp) { |
||
1261 | //console.error('configuration store failed'); |
||
1262 | |||
1263 | document.getElementById("errorMsgs").innerHTML = resp; |
||
1264 | document.getElementById("errorMsgs").style.display = ''; |
||
1265 | return false; |
||
1266 | |||
1267 | } |
||
1268 | else { |
||
1269 | $('#errorMsgs').html(''); |
||
1270 | $('#errorMsgs').hide(); |
||
1271 | if(_cb) { |
||
1272 | _cb(); |
||
1273 | } |
||
1274 | } |
||
1275 | }); |
||
1276 | }; |
||
1277 | |||
1278 | /** |
||
1279 | * Other SMTP settings form parts to Other tab. we want to add these to the POST request. |
||
1280 | */ |
||
1281 | var removeSMTPSettings = function() { |
||
1282 | // // on form submit prevent set the other tab div with inputs and post that! |
||
1283 | // $('.smtp_tab').each(function(i,e){ |
||
1284 | // if($(this).attr('id') == $('input[name="smtp_tab_selected"]').val() && $(this).attr('id')!='smtp_tab_other') { |
||
1285 | // var selid = '#' + $(this).attr('id') + ' '; |
||
1286 | // $('input[name="mail_smtpserver"]').val( $(selid+'input[name="_mail_smtpserver"]').val() ); |
||
1287 | // $('#mail_smtpauth_req_chk').prop( $(selid+'input[name="_mail_smtpauth_req"]').prop() ); |
||
1288 | // $('input[name="mail_smtpuser"]').val( $(selid+'input[name="_mail_smtpuser"]').val() ); |
||
1289 | // $('input[name="mail_smtppass"]').val( $(selid+'input[name="_mail_smtppass"]').val() ); |
||
1290 | // $('#notify_allow_default_outbound_chk').prop( $(selid+'input[name="_notify_allow_default_outbound"]').prop() ); |
||
1291 | // $('input[name="mail_smtpport"]').val( $(selid+'input[name="_mail_smtpport"]').val() ); |
||
1292 | // $('input[name="mail_smtpssl"]').val( $(selid+'input[name="_mail_smtpssl"]').val() ); |
||
1293 | // } |
||
1294 | // }); |
||
1295 | }; |
||
1296 | |||
1297 | /** |
||
1298 | * Show and refresh status message to user. |
||
1299 | */ |
||
1300 | statReaderStop = false; |
||
1301 | var startStatusReader = function() { |
||
1302 | setInterval(function(){ |
||
1303 | if(!statReaderStop) { |
||
1304 | $.getJSON('install/status.json?' + Math.random(), function(resp){ |
||
1305 | preloaderSetStatus(resp.message); |
||
1306 | if(resp.command && resp.command.function == 'redirect') { |
||
1307 | document.location.href = resp.command.arguments; |
||
1308 | statReaderStop = true; |
||
1309 | } |
||
1310 | }); |
||
1311 | } |
||
1312 | }, 1200); |
||
1313 | }; |
||
1314 | |||
1315 | var dbCheckPassed = function(url, next_step, msgpanel) { |
||
1316 | msgpanel.hide(); |
||
1317 | document.installForm.goto.value="{$mod_strings['LBL_NEXT']}"; |
||
1318 | document.getElementById('hidden_goto').value="{$mod_strings['LBL_NEXT']}"; |
||
1319 | document.installForm.current_step.value=next_step; |
||
1320 | removeSMTPSettings(); |
||
1321 | // TODO--low: add correct form validation for all fields (number is number, server name a valid server name etc) |
||
1322 | $('#installForm').attr('action', 'install.php'); |
||
1323 | |||
1324 | //preloaderOn('{$mod_strings['LBL_INSTALL_PROCESS']}', '...'); |
||
1325 | startStatusReader(); |
||
1326 | |||
1327 | $('#installForm').hide(); |
||
1328 | $('#installStatus').show(); |
||
1329 | $("html, body").animate({ |
||
1330 | scrollTop:0 |
||
1331 | }); |
||
1332 | document.installForm.submit(); |
||
1333 | }; |
||
1334 | |||
1335 | /** |
||
1336 | * Starting company logo upload. |
||
1337 | */ |
||
1338 | var onUploadImageClick = function(e) { |
||
1339 | var _e = e; |
||
1340 | preloaderOn('{$mod_strings['UPLOAD_LOGO']}'); |
||
1341 | uploadLogo(e, function(status){ |
||
1342 | preloaderOff(); |
||
1343 | // upload finish |
||
1344 | $('#errorMsgs').html(''); |
||
1345 | $('#errorMsgs').hide(); |
||
1346 | if(status.errors) { |
||
1347 | // show errors.. |
||
1348 | var errList = ''; |
||
1349 | $.each(status.errors, function(i,e){ |
||
1350 | errList+= '<li class="error"><span class="error">' + e + '</span></li>'; |
||
1351 | }); |
||
1352 | $('#errorMsgs').html('<p><b>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</b></p><ul>' + errList + '</ul>'); |
||
1353 | $('#errorMsgs').show(); |
||
1354 | |||
1355 | // storeConfig(_e); |
||
1356 | } |
||
1357 | else { |
||
1358 | // show logo .. |
||
1359 | $('#current_logo_row img').attr('src', status.filepath + '?' + Math.random()); |
||
1360 | var imghtml = $('<div>').append($('#current_logo_row img')).html(); |
||
1361 | $('#current_logo_row img').remove(); |
||
1362 | $('#current_logo_row').append(imghtml); |
||
1363 | $('#current_logo_row img').show(); |
||
1364 | // storeConfig(_e, function(){ |
||
1365 | // callDBCheck(function(url, next_step, msgpanel){ |
||
1366 | // dbCheckPassed(url, next_step, msgpanel); |
||
1367 | // }); |
||
1368 | // }); |
||
1369 | } |
||
1370 | }); |
||
1371 | }; |
||
1372 | |||
1373 | /** |
||
1374 | * Client side pre-validation. |
||
1375 | */ |
||
1376 | var getFormErrors = function() { |
||
1377 | var errors = []; |
||
1378 | |||
1379 | $('.field-error').removeClass('field-error'); |
||
1380 | |||
1381 | if(!$('input[name="email1"]').val()) { |
||
1382 | errors.push('{$mod_strings['ERR_ADMIN_EMAIL']}'); |
||
1383 | $('input[name="email1"]').addClass('field-error'); |
||
1384 | } |
||
1385 | |||
1386 | if(!$('input[name="setup_site_url"]').val()) { |
||
1387 | errors.push('{$mod_strings['ERR_SITE_URL']}'); |
||
1388 | $('input[name="email1"]').addClass('field-error'); |
||
1389 | } |
||
1390 | |||
1391 | return errors; |
||
1392 | }; |
||
1393 | |||
1394 | /** |
||
1395 | * Click to next button and start the installation. |
||
1396 | */ |
||
1397 | var onNextClick = function(e) { |
||
1398 | var errors = getFormErrors(); |
||
1399 | if(!errors.length) { |
||
1400 | var _e = e; |
||
1401 | storeConfig(_e, function(){ |
||
1402 | callDBCheck(function(url, next_step, msgpanel){ |
||
1403 | dbCheckPassed(url, next_step, msgpanel); |
||
1404 | }); |
||
1405 | }); |
||
1406 | } |
||
1407 | else { |
||
1408 | $('#errorMsgs').html("<p><b>Please fix the following errors before proceeding:</b></p><ul><li class=\"error\">" + errors.join('</li><li>') + "</li></ul>"); |
||
1409 | $('#errorMsgs').show(); |
||
1410 | //alert(errors.join('</li><li>')); |
||
1411 | } |
||
1412 | return false; |
||
1413 | }; |
||
1414 | </script> |
||
1415 | </div> |
||
1416 | EOQ; |
||
1417 | return $out; |
||
1418 | } |
||
1419 | |||
1420 | private function getFormScripts($mod_strings, $next_step) { |
||
1421 | $out =<<<EOQ |
||
1422 | /** |
||
1423 | * Submit form without step. |
||
1424 | */ |
||
1425 | var formRefreshSubmit = function(e) { |
||
1426 | document.getElementById('goto').value='resend'; |
||
1427 | document.getElementById('hidden_goto').value='resend'; |
||
1428 | e.form.submit(); |
||
1429 | } |
||
1430 | |||
1431 | $('#fts_type').change(function(){ |
||
1432 | if($(this).val() == '') |
||
1433 | hideFTSSettings(); |
||
1434 | else |
||
1435 | showFTSSettings(); |
||
1436 | }); |
||
1437 | |||
1438 | function showFTSSettings() |
||
1439 | { |
||
1440 | $('#fts_port_row').show(); |
||
1441 | $('#fts_host_row').show(); |
||
1442 | } |
||
1443 | |||
1444 | function hideFTSSettings() |
||
1445 | { |
||
1446 | $('#fts_port_row').hide(); |
||
1447 | $('#fts_host_row').hide(); |
||
1448 | } |
||
1449 | |||
1450 | |||
1451 | function toggleDBUser(){ |
||
1452 | if(typeof(document.getElementById('dbUSRData')) !='undefined' |
||
1453 | && document.getElementById('dbUSRData') != null){ |
||
1454 | |||
1455 | ouv = document.getElementById('dbUSRData').value; |
||
1456 | if(ouv == 'provide' || ouv == 'create'){ |
||
1457 | document.getElementById('connection_user_div').style.display = ''; |
||
1458 | //document.getElementById('sugarDBUs<br>er').style.display = 'none'; |
||
1459 | }else{ |
||
1460 | document.getElementById('connection_user_div').style.display = 'none'; |
||
1461 | //document.getElementById('sugarDBUser').style.display = ''; |
||
1462 | } |
||
1463 | } |
||
1464 | } |
||
1465 | toggleDBUser(); |
||
1466 | |||
1467 | var msgPanel; |
||
1468 | |||
1469 | // Modified: Callback function added. |
||
1470 | function callDBCheck(cb){ |
||
1471 | var _cb = cb; |
||
1472 | //begin main function that will be called |
||
1473 | ajaxCall = function(msg_panel){ |
||
1474 | //create success function for callback |
||
1475 | |||
1476 | getPanel = function() { |
||
1477 | var args = { width:"300px", |
||
1478 | modal:true, |
||
1479 | fixedcenter: true, |
||
1480 | constraintoviewport: false, |
||
1481 | underlay:"shadow", |
||
1482 | close:false, |
||
1483 | draggable:true, |
||
1484 | |||
1485 | effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5} |
||
1486 | } ; |
||
1487 | msg_panel = new YAHOO.widget.Panel('p_msg', args); |
||
1488 | |||
1489 | msg_panel.setHeader("{$mod_strings['LBL_LICENSE_CHKDB_HEADER']}"); |
||
1490 | msg_panel.setBody(document.getElementById("checkingDiv").innerHTML); |
||
1491 | msg_panel.render(document.body); |
||
1492 | msgPanel = msg_panel; |
||
1493 | } |
||
1494 | |||
1495 | |||
1496 | passed = function(url){ |
||
1497 | _cb(url, "{$next_step}", msgPanel); |
||
1498 | } |
||
1499 | success = function(o) { |
||
1500 | //condition for just the preexisting database |
||
1501 | if (o.responseText.indexOf('preexeest')>=0){ |
||
1502 | |||
1503 | // throw confirmation message |
||
1504 | msg_panel.setBody(document.getElementById("sysCheckMsg").innerHTML); |
||
1505 | msg_panel.render(document.body); |
||
1506 | msgPanel = msg_panel; |
||
1507 | document.getElementById('accept_btn').focus(); |
||
1508 | //condition for no errors |
||
1509 | }else if (o.responseText.indexOf('dbCheckPassed')>=0){ |
||
1510 | //make navigation |
||
1511 | passed("install.php?goto={$mod_strings['LBL_NEXT']}"); |
||
1512 | |||
1513 | //condition for other errors |
||
1514 | }else{ |
||
1515 | //turn off loading message |
||
1516 | msgPanel.hide(); |
||
1517 | document.getElementById("errorMsgs").innerHTML = o.responseText; |
||
1518 | document.getElementById("errorMsgs").style.display = ''; |
||
1519 | return false; |
||
1520 | } |
||
1521 | |||
1522 | |||
1523 | }//end success |
||
1524 | |||
1525 | |||
1526 | //copy the db values over to the hidden field counterparts |
||
1527 | document.installForm.setup_db_admin_password.value = document.installForm.setup_db_admin_password_entry.value; |
||
1528 | |||
1529 | |||
1530 | |||
1531 | //set loading message and create url |
||
1532 | postData = "checkDBSettings=true&to_pdf=1&sugar_body_only=1"; |
||
1533 | postData += "&setup_db_database_name="+document.installForm.setup_db_database_name.value; |
||
1534 | if(typeof(document.installForm.setup_db_host_instance) != 'undefined'){ |
||
1535 | postData += "&setup_db_host_instance="+document.installForm.setup_db_host_instance.value; |
||
1536 | } |
||
1537 | if(typeof(document.installForm.setup_db_port_num) != 'undefined'){ |
||
1538 | postData += "&setup_db_port_num="+document.installForm.setup_db_port_num.value; |
||
1539 | } |
||
1540 | postData += "&setup_db_host_name="+document.installForm.setup_db_host_name.value; |
||
1541 | postData += "&setup_db_admin_user_name="+document.installForm.setup_db_admin_user_name.value; |
||
1542 | postData += "&setup_db_admin_password="+encodeURIComponent(document.installForm.setup_db_admin_password.value); |
||
1543 | if(typeof(document.installForm.setup_db_sugarsales_user) != 'undefined'){ |
||
1544 | postData += "&setup_db_sugarsales_user="+document.installForm.setup_db_sugarsales_user.value; |
||
1545 | } |
||
1546 | if(typeof(document.installForm.setup_db_sugarsales_password) != 'undefined'){ |
||
1547 | document.installForm.setup_db_sugarsales_password.value = document.installForm.setup_db_sugarsales_password_entry.value; |
||
1548 | postData += "&setup_db_sugarsales_password="+encodeURIComponent(document.installForm.setup_db_sugarsales_password.value); |
||
1549 | } |
||
1550 | if(typeof(document.installForm.setup_db_sugarsales_password_retype) != 'undefined'){ |
||
1551 | document.installForm.setup_db_sugarsales_password_retype.value = document.installForm.setup_db_sugarsales_password_retype_entry.value; |
||
1552 | postData += "&setup_db_sugarsales_password_retype="+encodeURIComponent(document.installForm.setup_db_sugarsales_password_retype.value); |
||
1553 | } |
||
1554 | if(typeof(document.installForm.dbUSRData) != 'undefined'){ |
||
1555 | postData += "&dbUSRData="+document.getElementById('dbUSRData').value; |
||
1556 | } |
||
1557 | |||
1558 | postData += "&demoData="+document.installForm.demoData.value; |
||
1559 | |||
1560 | postData += "&to_pdf=1&sugar_body_only=1"; |
||
1561 | |||
1562 | //if this is a call already in progress, then just return |
||
1563 | if(typeof ajxProgress != 'undefined'){ |
||
1564 | return; |
||
1565 | } |
||
1566 | |||
1567 | getPanel(); |
||
1568 | msgPanel.show; |
||
1569 | var ajxProgress = YAHOO.util.Connect.asyncRequest('POST','install.php', {success: success, failure: success}, postData); |
||
1570 | |||
1571 | |||
1572 | };//end ajaxCall method |
||
1573 | ajaxCall(); |
||
1574 | return; |
||
1575 | } |
||
1576 | |||
1577 | // Modified: Show a message for user when install started.. "Installation process, pease wait..." |
||
1578 | function confirm_drop_tables(yes_no){ |
||
1579 | |||
1580 | if(yes_no == true){ |
||
1581 | document.getElementById('setup_db_drop_tables').value = true; |
||
1582 | //make navigation |
||
1583 | document.installForm.goto.value="{$mod_strings['LBL_NEXT']}"; |
||
1584 | document.getElementById('hidden_goto').value="{$mod_strings['LBL_NEXT']}"; |
||
1585 | document.installForm.current_step.value="{$next_step}"; |
||
1586 | |||
1587 | msgPanel.hide(); |
||
1588 | |||
1589 | //preloaderOn('{$mod_strings['LBL_INSTALL_PROCESS']}', '...'); |
||
1590 | startStatusReader(); |
||
1591 | |||
1592 | removeSMTPSettings(); |
||
1593 | |||
1594 | $('#installForm').hide(); |
||
1595 | $('#installStatus').show(); |
||
1596 | $("html, body").animate({ |
||
1597 | scrollTop:0 |
||
1598 | }); |
||
1599 | document.installForm.submit(); |
||
1600 | |||
1601 | }else{ |
||
1602 | //set drop tables to false |
||
1603 | document.getElementById('setup_db_drop_tables').value = false; |
||
1604 | msgPanel.hide(); |
||
1605 | } |
||
1606 | } |
||
1607 | |||
1608 | |||
1609 | var onDBTypeClick = function(e) { |
||
1610 | formRefreshSubmit(e); |
||
1611 | }; |
||
1612 | EOQ; |
||
1613 | return $out; |
||
1614 | } |
||
1615 | |||
1616 | /** |
||
1617 | * @param $data form data |
||
1618 | * @return string output |
||
1619 | */ |
||
1620 | public function show($data = null) { |
||
1621 | foreach($data as $__key => $__val) { |
||
1622 | $$__key = $__val; |
||
1623 | } |
||
1624 | $formId = 'installForm'; |
||
1625 | $out = $this->getOutput( |
||
1626 | $this->getHeader( |
||
1627 | $mod_strings, |
||
1628 | $this->getHeaderStyles(), |
||
1629 | $this->getHeaderScripts($sugar_version, $js_custom_version) |
||
1630 | ), |
||
1631 | $this->getForm( |
||
1632 | $mod_strings, |
||
1633 | $formId, |
||
1634 | $formId, |
||
1635 | $errs, |
||
1636 | $this->getFormItems($mod_strings, $app_list_strings, $sugarConfigDefaults, $drivers, $checked, $db, $errors, $supportedLanguages, |
||
1637 | $current_language, $customSession, $customLog, $customId, $customSessionHidden, $customLogHidden, $customIdHidden), |
||
1638 | $this->getFormControlls($mod_strings, $formId), |
||
1639 | $this->getFormScripts($mod_strings, $next_step), |
||
1640 | $next_step |
||
1641 | ), |
||
1642 | $sugar_md, |
||
1643 | $mod_strings |
||
1644 | ); |
||
1645 | echo $out; |
||
1646 | return $out; |
||
1647 | } |
||
1648 | |||
1649 | } |
||
1650 | |||
1651 | class DisplayErrors { |
||
0 ignored issues
–
show
|
|||
1652 | |||
1653 | private static $settingsStack = array(); |
||
1654 | |||
1655 | public static function show() { |
||
1656 | array_push(self::$settingsStack, array( |
||
1657 | 'level' => error_reporting(), |
||
1658 | 'display_errors' => ini_get('display_errors'), |
||
1659 | )); |
||
1660 | |||
1661 | error_reporting(E_ALL); |
||
1662 | ini_set('display_errors', 1); |
||
1663 | } |
||
1664 | |||
1665 | public static function restore() { |
||
1666 | $settings = array_pop(self::$settingsStack); |
||
1667 | error_reporting($settings['level']); |
||
1668 | ini_set('display_errors', $settings['display_errors']); |
||
1669 | } |
||
1670 | } |
||
1671 | |||
1672 | |||
1673 | //-------------------------------------- InstallLayout |
||
1674 | |||
1675 | global $sugar_version, $js_custom_version; |
||
1676 | |||
1677 | |||
1678 | |||
1679 | if( !isset( $install_script ) || !$install_script ){ |
||
1680 | die($mod_strings['ERR_NO_DIRECT_SCRIPT']); |
||
1681 | } |
||
1682 | |||
1683 | |||
1684 | |||
1685 | //---------------- systemOption: db driver select |
||
1686 | |||
1687 | if(!isset($_SESSION['setup_db_type']) || $_SESSION['setup_db_type'] ==''){ |
||
1688 | $_SESSION['setup_db_type'] = 'mysql'; |
||
1689 | } |
||
1690 | $setup_db_type = $_SESSION['setup_db_type']; |
||
1691 | |||
1692 | $errs = ''; |
||
1693 | if(isset($validation_errors)) { |
||
1694 | if(count($validation_errors) > 0) { |
||
1695 | $errs = '<div id="errorMsgs">'; |
||
1696 | $errs .= "<p>{$mod_strings['LBL_SYSOPTS_ERRS_TITLE']}</p>"; |
||
1697 | $errs .= '<ul>'; |
||
1698 | |||
1699 | foreach($validation_errors as $error) { |
||
1700 | $errs .= '<li>' . $error . '</li>'; |
||
1701 | } |
||
1702 | |||
1703 | $errs .= '</ul>'; |
||
1704 | $errs .= '</div>'; |
||
1705 | } |
||
1706 | } |
||
1707 | |||
1708 | $drivers = DBManagerFactory::getDbDrivers(); |
||
1709 | foreach(array_keys($drivers) as $dname) { |
||
1710 | $checked[$dname] = ''; |
||
1711 | } |
||
1712 | $checked[$setup_db_type] = 'checked="checked"'; |
||
1713 | |||
1714 | |||
1715 | |||
1716 | //----------------- dbConfig_a: db name user pass... |
||
1717 | |||
1718 | if(empty($_SESSION['setup_db_host_name'])){ |
||
1719 | $_SESSION['setup_db_host_name'] = (isset($sugar_config['db_host_name'])) ? $sugar_config['db_host_name'] : $_SERVER['SERVER_NAME']; |
||
1720 | } |
||
1721 | |||
1722 | |||
1723 | // DB split |
||
1724 | $createDbCheckbox = ''; |
||
1725 | $createDb = (!empty($_SESSION['setup_db_create_database'])) ? 'checked="checked"' : ''; |
||
1726 | $dropCreate = (!empty($_SESSION['setup_db_drop_tables'])) ? 'checked="checked"' : ''; |
||
1727 | $instanceName = ''; |
||
1728 | if (isset($_SESSION['setup_db_host_instance']) && !empty($_SESSION['setup_db_host_instance'])){ |
||
1729 | $instanceName = $_SESSION['setup_db_host_instance']; |
||
1730 | } |
||
1731 | |||
1732 | $setupDbPortNum =''; |
||
1733 | if (isset($_SESSION['setup_db_port_num']) && !empty($_SESSION['setup_db_port_num'])){ |
||
1734 | $setupDbPortNum = $_SESSION['setup_db_port_num']; |
||
1735 | } |
||
1736 | |||
1737 | if(!isset($_SESSION['setup_db_manager'])) { |
||
1738 | $_SESSION['setup_db_manager'] = null; |
||
1739 | } |
||
1740 | |||
1741 | $db = getInstallDbInstance(); |
||
1742 | |||
1743 | |||
1744 | |||
1745 | |||
1746 | |||
1747 | //----------------- siteConfig_a.php Site Config & admin user |
||
1748 | |||
1749 | |||
1750 | if( is_file("config.php") ){ |
||
1751 | if(!empty($sugar_config['default_theme'])) |
||
1752 | $_SESSION['site_default_theme'] = $sugar_config['default_theme']; |
||
1753 | |||
1754 | if(!empty($sugar_config['disable_persistent_connections'])) |
||
1755 | $_SESSION['disable_persistent_connections'] = |
||
1756 | $sugar_config['disable_persistent_connections']; |
||
1757 | if(!empty($sugar_config['default_language'])) |
||
1758 | $_SESSION['default_language'] = $sugar_config['default_language']; |
||
1759 | if(!empty($sugar_config['translation_string_prefix'])) |
||
1760 | $_SESSION['translation_string_prefix'] = $sugar_config['translation_string_prefix']; |
||
1761 | if(!empty($sugar_config['default_charset'])) |
||
1762 | $_SESSION['default_charset'] = $sugar_config['default_charset']; |
||
1763 | |||
1764 | if(!empty($sugar_config['default_currency_name'])) |
||
1765 | $_SESSION['default_currency_name'] = $sugar_config['default_currency_name']; |
||
1766 | if(!empty($sugar_config['default_currency_symbol'])) |
||
1767 | $_SESSION['default_currency_symbol'] = $sugar_config['default_currency_symbol']; |
||
1768 | if(!empty($sugar_config['default_currency_iso4217'])) |
||
1769 | $_SESSION['default_currency_iso4217'] = $sugar_config['default_currency_iso4217']; |
||
1770 | |||
1771 | if(!empty($sugar_config['rss_cache_time'])) |
||
1772 | $_SESSION['rss_cache_time'] = $sugar_config['rss_cache_time']; |
||
1773 | if(!empty($sugar_config['languages'])) |
||
1774 | { |
||
1775 | // We need to encode the languages in a way that can be retrieved later. |
||
1776 | $language_keys = Array(); |
||
1777 | $language_values = Array(); |
||
1778 | |||
1779 | foreach($sugar_config['languages'] as $key=>$value) |
||
1780 | { |
||
1781 | $language_keys[] = $key; |
||
1782 | $language_values[] = $value; |
||
1783 | } |
||
1784 | |||
1785 | $_SESSION['language_keys'] = urlencode(implode(",",$language_keys)); |
||
1786 | $_SESSION['language_values'] = urlencode(implode(",",$language_values)); |
||
1787 | } |
||
1788 | } |
||
1789 | |||
1790 | //// errors |
||
1791 | $errors = ''; |
||
1792 | if( isset($validation_errors) && is_array($validation_errors)){ |
||
1793 | if( count($validation_errors) > 0 ){ |
||
1794 | $errors = '<div id="errorMsgs">'; |
||
1795 | $errors .= '<p>'.$mod_strings['LBL_SITECFG_FIX_ERRORS'].'</p><ul>'; |
||
1796 | foreach( $validation_errors as $error ){ |
||
1797 | $errors .= '<li>' . $error . '</li>'; |
||
1798 | } |
||
1799 | $errors .= '</ul></div>'; |
||
1800 | } |
||
1801 | } |
||
1802 | |||
1803 | |||
1804 | //// ternaries |
||
1805 | $sugarUpdates = (isset($_SESSION['setup_site_sugarbeet']) && !empty($_SESSION['setup_site_sugarbeet'])) ? 'checked="checked"' : ''; |
||
1806 | $siteSecurity = (isset($_SESSION['setup_site_defaults']) && !empty($_SESSION['setup_site_defaults'])) ? 'checked="checked"' : ''; |
||
1807 | |||
1808 | $customSession = (isset($_SESSION['setup_site_custom_session_path']) && !empty($_SESSION['setup_site_custom_session_path'])) ? 'checked="checked"' : ''; |
||
1809 | $customLog = (isset($_SESSION['setup_site_custom_log_dir']) && !empty($_SESSION['setup_site_custom_log_dir'])) ? 'checked="checked"' : ''; |
||
1810 | $customId = (isset($_SESSION['setup_site_specify_guid']) && !empty($_SESSION['setup_site_specify_guid'])) ? 'checked="checked"' : ''; |
||
1811 | |||
1812 | $customSessionHidden = (isset($_SESSION['setup_site_custom_session_path']) && !empty($_SESSION['setup_site_custom_session_path'])) ? '' : ' style="display:none;" '; |
||
1813 | $customLogHidden = (isset($_SESSION['setup_site_custom_log_dir']) && !empty($_SESSION['setup_site_custom_log_dir'])) ? '' : ' style="display:none;" '; |
||
1814 | $customIdHidden = (isset($_SESSION['setup_site_specify_guid']) && !empty($_SESSION['setup_site_specify_guid'])) ? '' : ' style="display:none;" '; |
||
1815 | |||
1816 | |||
1817 | // defaults or user sets |
||
1818 | // warn: may the system bring it up |
||
1819 | $_SESSION = array_merge($_SESSION, $_POST); |
||
1820 | $sugarConfigDefaults = array_merge(get_sugar_config_defaults(), $_SESSION); |
||
1821 | |||
1822 | //----- show layout |
||
1823 | |||
1824 | // show display errors (for testing only - do not forget restore!) |
||
1825 | // DisplayErrors::show(); |
||
1826 | |||
1827 | $installConfigLayout = new InstallLayout(); |
||
1828 | $installConfigLayout->show(get_defined_vars()); |
||
1829 | |||
1830 | // restore display errors |
||
1831 | // DisplayErrors::restore(); |
||
1832 | |||
1833 | // TODO--low: add Name Format [default_locale_name_format] [Dr. David Livingstone] -- ??? |
||
1834 | |||
1835 | ?> |
Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.