1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
36:
37:
38: $silent = isset($_GET['silent']) || (isset($argv) && in_array('silent', $argv));
39:
40: if($silent){
41: header('Location: initialize.php?silent');
42: exit;
43: }
44:
45: include(realpath('protected/config/X2Config.php'));
46:
47:
48:
49:
50: $languageDirs = scandir('./protected/messages');
51: $languages = array();
52:
53: foreach($languageDirs as $code){
54: $name = getLanguageName($code);
55: if($name !== false)
56: $languages[$code] = $name;
57: }
58: $lang = isset($_GET['language']) ? strtolower($_GET['language']) : '';
59:
60: if(array_key_exists($lang, $languages)){
61: $installMessageFile = realpath("protected/messages/$lang/install.php");
62: $commonMessageFile = realpath("protected/messages/$lang/common.php");
63: }
64:
65: $installMessages = array();
66: $commonMessages = array();
67: if(isset($installMessageFile) && file_exists($installMessageFile)){
68: $installMessages = include($installMessageFile);
69: if(!is_array($installMessages))
70: $installMessages = array();
71: }
72: if(isset($commonMessageFile) && file_exists($commonMessageFile)){
73: $commonMessages = include($commonMessageFile);
74: if(!is_array($commonMessages))
75: $commonMessages = array();
76: }
77:
78: function getLanguageName($code){
79: global $languageDirs;
80:
81: if(in_array($code, $languageDirs)){
82: $appMessageFile = realpath("protected/messages/$code/app.php");
83: if(file_exists($appMessageFile)){
84: $appMessages = include($appMessageFile);
85: if(is_array($appMessages) and isset($appMessages['languageName']) && $appMessages['languageName'] != 'Template')
86: return $appMessages['languageName'];
87: }
88: }
89: return false;
90: }
91:
92:
93: function installer_t($str){
94: global $installMessages, $commonMessages;
95: if(isset($installMessages[$str]) && $installMessages[$str] != ''){
96: return $installMessages[$str];
97: }elseif(isset($commonMessages[$str]) && $commonMessages[$str] != ''){
98: return $commonMessages[$str];
99: }
100: return $str;
101: }
102:
103: $themeURL = 'themes/x2engine';
104:
105:
106: $dbStatus = '';
107:
108: if(isset($_GET['errors'])){
109:
110: $errorMessagesIni = $_GET['errors'];
111: $errorMessages = array();
112: $errorCss = array();
113:
114: foreach($errorMessagesIni as $message){
115: if($message == 'DB_COULD_NOT_SELECT'){
116: $dbErr = installer_t('Could not select database.');
117: $dbStatus = '<img src="'.$themeURL.'/images/NOT_OK.png">'.addslashes($dbErr);
118: $errorMessages[] = $dbErr;
119: $errorCss = array_unique(array_merge($errorCss, array('dbName', 'dbUser', 'dbPass')));
120: }else if($message == 'DB_CONNECTION_FAILED'){
121: $dbErr = installer_t('Could not connect to host.');
122: $dbStatus = '<img src="'.$themeURL.'/images/NOT_OK.png">'.addslashes($dbErr);
123: $errorMessages[] = $dbErr;
124: $errorCss = array_unique(array_merge($errorCss, array('dbHost', 'dbName', 'dbUser', 'dbPass')));
125: }else{
126: $error = explode('--', $message);
127: if(count($error) > 1){
128: $errorMessages[] = $error[1];
129: $errorCss[] = $error[0];
130: }else{
131: $errorMessages[] = $message;
132: }
133: }
134: }
135: }
136:
137: function getField($name, $default, $return = False){
138: $ret = Null;
139: if(isset($_GET[$name])){
140: if($name == 'dummy_data' && $_GET[$name] == 1)
141: $ret = ' checked="checked"';
142: else
143: $ret = $_GET[$name];
144: } else{
145: $ret = $default;
146: }
147: if($return)
148: return $ret;
149: else
150: echo $ret;
151: }
152:
153: function checkCurrency($code){
154: if(isset($_GET['currency'])){
155: if($_GET['currency'] == $code)
156: echo ' selected="selected"';
157: } else if($code == 'USD')
158: echo ' selected="selected"';
159: }
160:
161: function checkTimezone($timezone){
162: if((isset($_GET['timezone']) && $_GET['timezone'] == $timezone) || (!isset($_GET['timezone']) && $timezone == 'US/Pacific'))
163: return ' selected="selected"';
164: }
165:
166: date_default_timezone_set(isset($_GET['timezone']) ? $_GET['timezone'] : 'UTC');
167:
168: $timezones = array(
169: 'Pacific/Midway' => "(GMT-11:00) Midway Island",
170: 'US/Samoa' => "(GMT-11:00) Samoa",
171: 'US/Hawaii' => "(GMT-10:00) Hawaii",
172: 'US/Alaska' => "(GMT-09:00) Alaska",
173: 'US/Pacific' => "(GMT-08:00) Pacific Time (US & Canada)",
174: 'America/Tijuana' => "(GMT-08:00) Tijuana",
175: 'US/Arizona' => "(GMT-07:00) Arizona",
176: 'US/Mountain' => "(GMT-07:00) Mountain Time (US & Canada)",
177: 'America/Chihuahua' => "(GMT-07:00) Chihuahua",
178: 'America/Mazatlan' => "(GMT-07:00) Mazatlan",
179: 'America/Mexico_City' => "(GMT-06:00) Mexico City",
180: 'America/Monterrey' => "(GMT-06:00) Monterrey",
181: 'Canada/Saskatchewan' => "(GMT-06:00) Saskatchewan",
182: 'US/Central' => "(GMT-06:00) Central Time (US & Canada)",
183: 'US/Eastern' => "(GMT-05:00) Eastern Time (US & Canada)",
184: 'US/East-Indiana' => "(GMT-05:00) Indiana (East)",
185: 'America/Bogota' => "(GMT-05:00) Bogota",
186: 'America/Lima' => "(GMT-05:00) Lima",
187: 'America/Caracas' => "(GMT-04:30) Caracas",
188: 'Canada/Atlantic' => "(GMT-04:00) Atlantic Time (Canada)",
189: 'America/La_Paz' => "(GMT-04:00) La Paz",
190: 'America/Santiago' => "(GMT-04:00) Santiago",
191: 'Canada/Newfoundland' => "(GMT-03:30) Newfoundland",
192: 'America/Buenos_Aires' => "(GMT-03:00) Buenos Aires",
193: 'Greenland' => "(GMT-03:00) Greenland",
194: 'Atlantic/Stanley' => "(GMT-02:00) Stanley",
195: 'Atlantic/Azores' => "(GMT-01:00) Azores",
196: 'Atlantic/Cape_Verde' => "(GMT-01:00) Cape Verde Is.",
197: 'Africa/Casablanca' => "(GMT) Casablanca",
198: 'Europe/Dublin' => "(GMT) Dublin",
199: 'Europe/Lisbon' => "(GMT) Lisbon",
200: 'Europe/London' => "(GMT) London",
201: 'Africa/Monrovia' => "(GMT) Monrovia",
202: 'UTC' => "(UTC)",
203: 'Europe/Amsterdam' => "(GMT+01:00) Amsterdam",
204: 'Europe/Belgrade' => "(GMT+01:00) Belgrade",
205: 'Europe/Berlin' => "(GMT+01:00) Berlin",
206: 'Europe/Bratislava' => "(GMT+01:00) Bratislava",
207: 'Europe/Brussels' => "(GMT+01:00) Brussels",
208: 'Europe/Budapest' => "(GMT+01:00) Budapest",
209: 'Europe/Copenhagen' => "(GMT+01:00) Copenhagen",
210: 'Europe/Ljubljana' => "(GMT+01:00) Ljubljana",
211: 'Europe/Madrid' => "(GMT+01:00) Madrid",
212: 'Europe/Paris' => "(GMT+01:00) Paris",
213: 'Europe/Prague' => "(GMT+01:00) Prague",
214: 'Europe/Rome' => "(GMT+01:00) Rome",
215: 'Europe/Sarajevo' => "(GMT+01:00) Sarajevo",
216: 'Europe/Skopje' => "(GMT+01:00) Skopje",
217: 'Europe/Stockholm' => "(GMT+01:00) Stockholm",
218: 'Europe/Vienna' => "(GMT+01:00) Vienna",
219: 'Europe/Warsaw' => "(GMT+01:00) Warsaw",
220: 'Europe/Zagreb' => "(GMT+01:00) Zagreb",
221: 'Europe/Athens' => "(GMT+02:00) Athens",
222: 'Europe/Bucharest' => "(GMT+02:00) Bucharest",
223: 'Africa/Cairo' => "(GMT+02:00) Cairo",
224: 'Africa/Harare' => "(GMT+02:00) Harare",
225: 'Europe/Helsinki' => "(GMT+02:00) Helsinki",
226: 'Europe/Istanbul' => "(GMT+02:00) Istanbul",
227: 'Asia/Jerusalem' => "(GMT+02:00) Jerusalem",
228: 'Europe/Kiev' => "(GMT+02:00) Kyiv",
229: 'Europe/Minsk' => "(GMT+02:00) Minsk",
230: 'Europe/Riga' => "(GMT+02:00) Riga",
231: 'Europe/Sofia' => "(GMT+02:00) Sofia",
232: 'Europe/Tallinn' => "(GMT+02:00) Tallinn",
233: 'Europe/Vilnius' => "(GMT+02:00) Vilnius",
234: 'Asia/Baghdad' => "(GMT+03:00) Baghdad",
235: 'Asia/Kuwait' => "(GMT+03:00) Kuwait",
236: 'Europe/Moscow' => "(GMT+03:00) Moscow",
237: 'Africa/Nairobi' => "(GMT+03:00) Nairobi",
238: 'Asia/Riyadh' => "(GMT+03:00) Riyadh",
239: 'Europe/Volgograd' => "(GMT+03:00) Volgograd",
240: 'Asia/Tehran' => "(GMT+03:30) Tehran",
241: 'Asia/Baku' => "(GMT+04:00) Baku",
242: 'Asia/Muscat' => "(GMT+04:00) Muscat",
243: 'Asia/Tbilisi' => "(GMT+04:00) Tbilisi",
244: 'Asia/Yerevan' => "(GMT+04:00) Yerevan",
245: 'Asia/Kabul' => "(GMT+04:30) Kabul",
246: 'Asia/Yekaterinburg' => "(GMT+05:00) Ekaterinburg",
247: 'Asia/Karachi' => "(GMT+05:00) Karachi",
248: 'Asia/Tashkent' => "(GMT+05:00) Tashkent",
249: 'Asia/Kolkata' => "(GMT+05:30) Kolkata",
250: 'Asia/Kathmandu' => "(GMT+05:45) Kathmandu",
251: 'Asia/Almaty' => "(GMT+06:00) Almaty",
252: 'Asia/Dhaka' => "(GMT+06:00) Dhaka",
253: 'Asia/Novosibirsk' => "(GMT+06:00) Novosibirsk",
254: 'Asia/Bangkok' => "(GMT+07:00) Bangkok",
255: 'Asia/Jakarta' => "(GMT+07:00) Jakarta",
256: 'Asia/Krasnoyarsk' => "(GMT+07:00) Krasnoyarsk",
257: 'Asia/Chongqing' => "(GMT+08:00) Chongqing",
258: 'Asia/Hong_Kong' => "(GMT+08:00) Hong Kong",
259: 'Asia/Irkutsk' => "(GMT+08:00) Irkutsk",
260: 'Asia/Kuala_Lumpur' => "(GMT+08:00) Kuala Lumpur",
261: 'Australia/Perth' => "(GMT+08:00) Perth",
262: 'Asia/Singapore' => "(GMT+08:00) Singapore",
263: 'Asia/Taipei' => "(GMT+08:00) Taipei",
264: 'Asia/Ulaanbaatar' => "(GMT+08:00) Ulaan Bataar",
265: 'Asia/Urumqi' => "(GMT+08:00) Urumqi",
266: 'Asia/Seoul' => "(GMT+09:00) Seoul",
267: 'Asia/Tokyo' => "(GMT+09:00) Tokyo",
268: 'Asia/Yakutsk' => "(GMT+09:00) Yakutsk",
269: 'Australia/Adelaide' => "(GMT+09:30) Adelaide",
270: 'Australia/Darwin' => "(GMT+09:30) Darwin",
271: 'Australia/Brisbane' => "(GMT+10:00) Brisbane",
272: 'Australia/Canberra' => "(GMT+10:00) Canberra",
273: 'Pacific/Guam' => "(GMT+10:00) Guam",
274: 'Australia/Hobart' => "(GMT+10:00) Hobart",
275: 'Australia/Melbourne' => "(GMT+10:00) Melbourne",
276: 'Pacific/Port_Moresby' => "(GMT+10:00) Port Moresby",
277: 'Australia/Sydney' => "(GMT+10:00) Sydney",
278: 'Asia/Vladivostok' => "(GMT+10:00) Vladivostok",
279: 'Asia/Magadan' => "(GMT+11:00) Magadan",
280: 'Pacific/Auckland' => "(GMT+12:00) Auckland",
281: 'Pacific/Fiji' => "(GMT+12:00) Fiji",
282: 'Asia/Kamchatka' => "(GMT+12:00) Kamchatka",
283: );
284: ?><!DOCTYPE html>
285: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
286: <head>
287: <meta charset="UTF-8" />
288: <meta name="language" content="en" />
289: <title><?php echo installer_t('X2CRM Installation'); ?></title>
290: <link rel="icon" href="images/favicon.ico" type="image/x-icon">
291: <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
292: <link rel="stylesheet" type="text/css" href="<?php echo $themeURL; ?>/css/screen.css" media="screen, projection" />
293: <link rel="stylesheet" type="text/css" href="<?php echo $themeURL; ?>/css/main.css" />
294: <link rel="stylesheet" type="text/css" href="<?php echo $themeURL; ?>/css/form.css" />
295: <link rel="stylesheet" type="text/css" href="<?php echo $themeURL; ?>/css/install.css" />
296: <link rel="stylesheet" type="text/css" href="<?php echo $themeURL; ?>/css/ui-elements.css" />
297:
298: <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
299: <script type="text/javascript" src="js/backgroundImage.js"></script>
300: <script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
301:
302: <script type="text/javascript" src="js/webtoolkit.sha256.js"></script>
303:
304: <script type="text/javascript">
305:
306: function installStageRequest(stage,formData,done,fail,always) {
307: done = typeof done == 'undefined' ? function(){} : done;
308: fail = typeof fail == 'undefined' ? function(){} : fail;
309: always = typeof always == 'undefined' ? function(){} : always;
310: formData = typeof formData == undefined ? $('form#install').serialize() : formData;
311: $.ajax({
312: url:'initialize.php?stage='+stage,
313: type:'POST',
314: data:formData,
315: dataType:'json'
316: }).done(done).fail(fail).always(always);
317: }
318:
319:
320: function installStage(stages,formData,form,nDone,responseData) {
321: var thisStage = stages[0],stagesRemaining = stages.slice(1);
322: var box = $('#error-box');
323: if (typeof thisStage != 'undefined') {
324: if (thisStage=='validate') {
325: installStageRequest('validate',formData,(function(data) {
326: if(data.error || data.errors || data.globalError) {
327: box.html($("<h3>").text(data.message));
328: if(data.globalError)
329: box.append($("<span>").text(data.globalError).addClass('error'));
330: var errorList = $('<ul>');
331: for (var i in data.errors) {
332: errorList.append($('<li>').text(data.errors[i]).addClass('error'));
333: form.find("#"+i).addClass('error');
334: }
335: box.append(errorList);
336: } else {
337: installStage(stagesRemaining,formData,form,nDone+1,data);
338: }
339: }),(function(jqXHR,textStatus,errorMessage) {
340: alert('An unexpected server error occurred during validation: '+textStatus+' '+jqXHR.status+' '+errorMessage);
341: }));
342: } else {
343: var messageHeader = box.find('h3');
344: var percentDone = messageHeader.find('#percentDone');
345: var progressList = box.find('ul');
346: if(percentDone.length == 0) {
347: progressList.remove();
348: box.append($('<img src="<?php echo $themeURL; ?>/images/loading.gif">').css({'display':'block','margin-left':'auto','margin-right':'auto'}));
349: messageHeader.text("<?php echo installer_t("Installing X2CRM"); ?>");
350: percentDone = $('<span id="percentDone">');
351: messageHeader.append(percentDone);
352: progressList = $('<ul>');
353: progressList.insertAfter(messageHeader);
354: }
355: installStageRequest(thisStage,formData,(function(data) {
356: progressList.append($('<li>').text(data.message).css({color: (data.error ? 'red':'green')}));
357: if(!data.error)
358: installStage(stagesRemaining,formData,form,nDone+1,data);
359: else
360: box.find('img').remove();
361: }),(function(jqXHR,textStatus,errorMessage) {
362: alert('An unexpected server error occurred during installation: '+textStatus+' '+jqXHR.status+' '+errorMessage);
363: }));
364: }
365: } else {
366:
367: form.find("#complete").val(1);
368: document.forms[form.attr('id')].submit();
369: }
370: }
371:
372: submitExternalForm = function() {
373: (function($){
374: var form = $('form#install');
375: form.find('.error').removeClass('error');
376: var stages = <?php $stageLabels = require_once(realpath('protected/data/installStageLabels.php')); echo '["'.implode('","',array_keys($stageLabels)).'"]'; ?>;
377: installStage(stages,form.serialize(),form,0);
378: })(jQuery);
379: }
380:
381:
382: function changeLang(lang) {
383: window.location=('install.php?language='+lang);
384: }
385: $(function() {
386: $('#db-test-button').click(testDB);
387:
388: $('#currency').change(function() {
389: if($('#currency').val() == 'other')
390: $('#currency2').fadeIn(300);
391: else
392: $('#currency2').fadeOut(300);
393: });
394:
395: $('#test_db').change(function() {
396: if($('#test_db').is(':checked'))
397: $('#test_db_notice').fadeIn(300);
398: else
399: $('#test_db_notice').fadeOut(300);
400: });
401:
402: <?php if (!empty($errorMessages)):
403: $("#install").find("#<?php echo implode(',#', $errorCss); ?>").addClass('error');
404: <?php endif; ?>
405: });
406:
407:
408: function testDB() {
409: var data = $('#install').serialize()+'&testDb=1';
410: $.ajax({
411: type: "POST",
412: url: "initialize.php",
413: data: data,
414: dataType:'json',
415: beforeSend: function() {
416: $('#response-box').html('<img src="<?php echo $themeURL; ?>/images/loading.gif">');
417: }
418: }).done(function(r) {
419: var message = '';
420: var okImage = '<img src="<?php echo $themeURL; ?>/images/OK.png">';
421: var notOkImage = '<img src="<?php echo $themeURL; ?>/images/NOT_OK.png">';
422: if (r.errors || r.globalError || r.error) {
423: message = notOkImage + '<span class="error">'+r.message+'</span>';
424: } else {
425: message = okImage + r.message;
426: }
427: $('#response-box').html(message);
428: });
429: }
430:
431: </script>
432: </head>
433: <body class='not-mobile-body'>
434: <!--<img id="bg" src="uploads/defaultBg.jpg" alt="">-->
435: <div id="installer-box">
436: <noscript><h3><span id="noscript-error"><?php echo installer_t('This web application requires Javascript to function properly. Please enable Javascript in your web browser before continuing.'); ?></span></h3></noscript>
437: <?php
438:
439:
440:
441:
442:
443:
444:
445:
446: $logoFile = "images/mobile_logo.png";
447: echo "<img src=\"$logoFile\" alt=\"X2CRM\" id=\"installer-logo\">";
448: ?>
449: <h2 id="title"><?php echo installer_t('Install X2CRM Version').' '.$version; ?></h2>
450:
451:
452:
453: <?php echo installer_t('Welcome to the X2CRM application installer! We need to collect a little information before we can get your application up and running. Please fill out the fields listed below.'); ?>
454:
455:
456: <div class="wide form" id="install-form">
457: <?php
458: $thisFile = __FILE__;
459: $reqCheck = 'protected/components/views/requirements.php';
460: if(file_exists($reqCheck))
461: require_once($reqCheck);
462: else
463: echo "<span class=\"error\">Note: cannot find requirements check script.</span>";
464: ?>
465: <form name="install" id="install" action="initialize.php" method="POST">
466: <h2><?php echo installer_t('Application Info'); ?></h2><hr>
467: <div class="row"><label for="app"><?php echo installer_t('Application Name'); ?></label><input type="text" name="app" id="app" value="<?php getField('app', 'X2CRM'); ?>" style="width:190px" /></div>
468: <div class="row"><label for="language"><?php echo installer_t('Default Language'); ?></label>
469: <select name="language" id="language" onChange="changeLang(this.options[this.selectedIndex].value);" style="width:200px"><option value="">English</option>
470: <?php
471: foreach($languageDirs as $code){
472: $languageName = getLanguageName($code);
473: if($languageName !== false){
474: $selected = ($code == $lang) ? ' selected' : '';
475: echo " <option value=\"$code\"$selected>$languageName</option>\n";
476: }
477: }
478: echo '</select>';
479: ?></div>
480:
481: <div class="row"><label for="currency"><?php echo installer_t('Currency'); ?></label>
482: <select name="currency" id="currency">
483: <option value="USD"<?php checkCurrency('USD'); ?>>USD</option>
484: <option value="EUR"<?php checkCurrency('EUR'); ?>>EUR</option>
485: <option value="GBP"<?php checkCurrency('GBP'); ?>>GBP</option>
486: <option value="CAD"<?php checkCurrency('CAD'); ?>>CAD</option>
487: <option value="JPY"<?php checkCurrency('JPY'); ?>>JPY</option>
488: <option value="CNY"<?php checkCurrency('CNY'); ?>>CNY</option>
489: <option value="CHF"<?php checkCurrency('CHF'); ?>>CHF</option>
490: <option value="INR"<?php checkCurrency('INR'); ?>>INR</option>
491: <option value="BRL"<?php checkCurrency('BRL'); ?>>BRL</option>
492: <option value="other"<?php checkCurrency('other'); ?>><?php echo installer_t('Other'); ?></option>
493: </select>
494: <input type="text" name="currency2" id="currency2" style="width:120px;<?php if(!isset($_GET['currency']) || $_GET['currency'] != 'other') echo 'display:none;'; ?>" value="<?php getField('currency2', ''); ?>" />
495: </div>
496: <div class="row"><label for="timezone"><?php echo installer_t('Default Timezone'); ?></label>
497: <select name="timezone" id="timezone">
498: <?php
499: foreach($timezones as $key => $value)
500: echo '<option value="'.$key.'"'.checkTimezone($key).'>'.$value.'</option>';
501: ?>
502: </select>
503: </div>
504: <div class="row"><label for="dummy_data"><?php echo installer_t('Create sample data'); ?></label><input type='checkbox' name='dummy_data' id="dummy_data" value='1' <?php echo getField('dummy_data', 0, true) ? ' checked=1' : ''; ?> /><br /><br /></div>
505: <div class="row"><label for="adminUsername"><?php echo installer_t('Admin Username'); ?></label><input type="text" name="adminUsername" id="adminUsername" value="<?php getField('adminUsername', 'admin'); ?>" /></div>
506: <div class="row"><label for="adminPass"><?php echo installer_t('Admin Password'); ?></label><input type="password" name="adminPass" id="adminPass" /></div>
507: <div class="row"><label for="adminPass2"><?php echo installer_t('Confirm Password'); ?></label><input type="password" name="adminPass2" id="adminPass2" /></div>
508: <div class="row"><label for="adminEmail"><?php echo installer_t('Administrator Email'); ?></label><input type="text" name="adminEmail" id="adminEmail" value="<?php getField('adminEmail', ''); ?>" /></div>
509: <h2><?php echo installer_t('Visible Modules'); ?></h2><hr>
510: <div id="menu_items" class="row">
511: <?php echo installer_t('Choose which modules will be visible in the main menu. Any of these can be re-enabled after installation if necessary.'); ?><br /><br />
512: <?php
513: $modules = require_once(dirname(__FILE__).implode(DIRECTORY_SEPARATOR, array('', 'protected', 'data', '')).'enabledModules.php');
514: $disabledByDefault = array('products', 'quotes', 'bugReports', 'x2Leads');
515: foreach($modules as $moduleName):
516: $item = "menu_$moduleName";
517: if (function_exists('ucfirst')) {
518: $moduleLabel = ucfirst($moduleName);
519: } else {
520: $moduleLabel = $moduleName;
521: }
522: if ($moduleLabel === 'Workflow') {
523: $moduleLabel = 'Process';
524: } else if ($moduleLabel === 'X2Leads') {
525: $moduleLabel = 'Leads';
526: } else if ($moduleLabel === 'X2Activity') {
527: $moduleLabel = 'Activity';
528: } else if ($moduleLabel === 'BugReports') {
529: $moduleLabel = 'Bug Reports';
530: } else if ($moduleLabel === 'EmailInboxes') {
531: $moduleLabel = 'Email Inboxes';
532: }
533: ?>
534: <div class="checkbox-grid-cell">
535: <label for="<?php echo $item ?>"><?php echo $moduleLabel; ?></label>
536: <input type="checkbox" name="<?php echo $item ?>" id="<?php echo $item; ?>" value="1"<?php
537: echo getField($item, 1, !in_array($moduleName, $disabledByDefault)) ? ' checked=1' : ''; ?> />
538: </div>
539: <?php endforeach; ?>
540: </div>
541:
542: <h2><?php echo installer_t('Database Connection Info'); ?></h2><hr>
543: <?php echo installer_t('This release only supports MySQL. Please create a database before installing.'); ?><br /><br />
544:
545: <div id="db-form-box">
546: <div class="row"><label for="dbHost"><?php echo installer_t('Host Name'); ?></label><input type="text" name="dbHost" id="dbHost" value="<?php getField('dbHost', 'localhost'); ?>" /></div>
547: <div class="row"><label for="dbName"><?php echo installer_t('Database Name'); ?></label><input type="text" name="dbName" id="dbName" value="<?php getField('dbName', 'x2engine'); ?>" /></div>
548: <div class="row"><label for="dbUser"><?php echo installer_t('Username'); ?></label><input type="text" name="dbUser" id="dbUser" value="<?php getField('dbUser', 'root'); ?>" /></div>
549: <div class="row"><label for="dbPass"><?php echo installer_t('Password'); ?></label><input type="password" name="dbPass" id="dbPass" /></div>
550: <div class="row"><label for="test_db"><?php echo installer_t('Testing database'); ?></label><input type='checkbox' name='test_db' id="test_db" value='1' <?php echo getField('test_db', 0, true) ? ' checked=1' : ''; ?> /> </div>
551: <div class="row" id="test_db_notice" style="display:none;padding-bottom:20px;">
552: Enable this only if reinstalling on a separate database for automated testing. <em>Do not</em> use the same database for testing and production.
553: <br /><br />
554: To set up the configuration for web testing, ensure the following URL correctly resolves to index-test.php on this server:
555: <br />
556: <label for="test_url"><?php echo installer_t('Test base URL'); ?></label><input type="text" name='test_url' id="test_url" value="<?php getField('test_url', 'http://'.rtrim($_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'], 'install.php').'index-test.php'); ?>" />
557: </div>
558: </div>
559: <div id="db-test-box"><input type="button" id="db-test-button" class="x2-button" value="<?php echo installer_t('Test Connection'); ?>" />
560: <div id="response-box"><?php echo $dbStatus; ?></div>
561: </div>
562:
563: <div></div>
564:
565: <br /><br /><br />
566:
567: <div><?php if(file_exists('install_pro.php')) include('install_pro.php'); ?></div>
568:
569:
570: <?php
571: include(realpath('protected/components/UpdatesForm.php'));
572:
573: $editions = array('pro', 'pla');
574: $edition = 'opensource';
575: foreach ($editions as $ed)
576: if (file_exists("initialize_$ed.php"))
577: $edition = $ed;
578: $form = new UpdatesForm(
579: array(
580: 'x2_version' => $version,
581: 'unique_id' => getField('unique_id', 'none', True),
582: 'formId' => 'install',
583: 'submitButtonId' => 'install-button',
584: 'statusId' => 'error-box',
585: 'themeUrl' => $themeURL,
586: 'receiveUpdates' => getField('receiveUpdates', 1, True),
587: 'edition' => $edition,
588: ),
589: 'installer_t'
590: );
591: require_once(realpath('protected/views/admin/stayUpdated.php'));
592: ?>
593:
594:
595: <?php $haveErrors = !empty($errorMessages); ?>
596: <hr />
597: <div class="form" id="error-box"<?php echo $haveErrors ? Null : ' style="display:none;"'; ?>>
598: <?php if($haveErrors): ?>
599: <h3><?php echo installer_t("Please correct the following errors:") ?></h3>
600: <ul>
601: <?php foreach($errorMessages as $message): ?>
602: <li><?php echo $message; ?></li>
603: <?php endforeach; ?>
604: </ul>
605: <?php endif; ?>
606: </div>
607: <input type="hidden" id="complete" name="complete" value="0" />
608: <input type="submit" id="install-button" class="x2-button" value="<?php echo installer_t('Install'); ?>" />
609: <br />
610: </form>
611: <a style="text-align: center; display:block;" href="http://www.x2crm.com"><?php echo installer_t('For help or more information - X2CRM.com'); ?></a>
612:
613: </div>
614: <div id="footer">
615:
616:
617: Copyright © <?php echo date('Y'); ?><a href="http://www.x2crm.com">X2Engine Inc.</a><br />
618: <?php echo installer_t('All Rights Reserved.'); ?>
619: </div>
620: </div>
621: </body>
622: </html>
623: