* SPDX-License-Identifier: AGPL-3.0-only ************************************/ /* crmv@35153 crmv@103922 */ // crmv@171581 if (!isset($root_directory)) { require_once('../../config.inc.php'); chdir($root_directory); } require_once('include/utils/utils.php'); // crmv@171581e $installation_mode = false; if (empty($_SESSION)) { // disable session limiter for the activation VteSession::$maxRequests = 100; // crmv@146653 VteSession::start(); } if (VteSession::get('morph_mode') == 'installation') { $installation_mode = true; } include('vteversion.php'); //crmv@130421 crmv@181168 global $adb; if (!empty($_REQUEST['vte_user_info'])) { $vte_user_info = Zend_Json::decode($_REQUEST['vte_user_info']); $email = $vte_user_info['email']; } elseif (!empty($_REQUEST['email'])) { $email = $_REQUEST['email']; } $update_mode = false; if (file_exists('modules/Update/free_changes') && getUserName(1) == 'admin') { $update_mode = true; } $tipo_installazione = strval($_REQUEST['tipo_installazione']); $durata_installazione = strval($_REQUEST['durata_installazione']); $numero_utenti = strval($_REQUEST['numero_utenti']); $params = array( 'email'=>$email, 'tipo_installazione'=>$tipo_installazione, 'durata_installazione'=>$durata_installazione, 'numero_utenti'=>$numero_utenti, 'subversion'=>$enterprise_subversion, //crmv@130421 ); $chiave = getChiave($params); function getChiave($params) { global $application_unique_key,$root_directory,$adb,$table_prefix; $params['application_unique_key'] = $application_unique_key; $params['root_directory'] = $root_directory; $params['data_installazione'] = date('Y-m-d'); $mac_address = OSUtils::getMACAddress(); // crmv@167416 $params['mac_address'] = $mac_address; if ($params['tipo_installazione'] == 'Free') { $params['numero_utenti'] = 0; $params['roles'] = 3; //Organisation + 2 $params['profiles'] = 2; $params['pdf'] = 1; $params['adv_sharing_rules'] = 1; $params['sharing_rules_user'] = 1; $result = $adb->query("select * from {$table_prefix}_role"); if ($result && $adb->num_rows($result) > 0) { if ($adb->num_rows($result) > $params['roles']) { $params['roles'] = $adb->num_rows($result); } } $result = $adb->query("select * from {$table_prefix}_profile"); if ($result && $adb->num_rows($result) > 0) { if ($adb->num_rows($result) > $params['profiles']) { $params['profiles'] = $adb->num_rows($result); } } $result = $adb->query("SELECT COUNT(*) as count FROM {$table_prefix}_pdfmaker GROUP BY module"); if ($result && $adb->num_rows($result) > 0) { $count = array(); while($row=$adb->fetchByAssoc($result)) { $count[] = $row['count']; } if (!empty($count) && max($count) > $params['pdf']) { $params['pdf'] = max($count); } } $othermodules = getSharingModuleList(); if(!empty($othermodules)) { $count = array(); foreach($othermodules as $moduleresname) { $tmp = getAdvSharingRuleList($moduleresname) ?: array(); // crmv@192073 $count[] = count($tmp); } if (!empty($count) && max($count) > $params['adv_sharing_rules']) { $params['adv_sharing_rules'] = max($count); } } $othermodules = getSharingModuleList(Array('Contacts')); if(!empty($othermodules)) { $result = $adb->query("SELECT id FROM {$table_prefix}_users WHERE status = 'Active' AND user_name <> 'admin'"); if ($result) { $count = array(); while($row=$adb->fetchByAssoc($result)) { foreach($othermodules as $moduleresname) { $tmp = getSharingRuleListUser($moduleresname,$row['id']) ?: array(); // crmv@192073 $count[] = count($tmp); } } if (!empty($count) && max($count) > $params['sharing_rules_user']) { $params['sharing_rules_user'] = max($count); } } } } $key = generate_key_pair_morphsuit(); $chiave = encrypt_morphsuit($key['public_key'],Zend_Json::encode($params)); return urlencode($key['private_key'].'-----'.$chiave); } if ($_REQUEST['type'] == 'time_expired') { $saved_morphsuit = getSavedMorphsuit(); $saved_morphsuit = urldecode(trim($saved_morphsuit)); $private_key = substr($saved_morphsuit,0,strpos($saved_morphsuit,'-----')); $enc_text = substr($saved_morphsuit,strpos($saved_morphsuit,'-----')+5); $saved_morphsuit = @decrypt_morphsuit($private_key,$enc_text); $saved_morphsuit = Zend_Json::decode($saved_morphsuit); $saved_morphsuit_id = $saved_morphsuit['id']; } if ($tipo_installazione == 'Free') { $saved_morphsuit = getSavedMorphsuit(); if (empty($saved_morphsuit)) { // first activation include_once("modules/Users/Users.php"); $user = CRMEntity::getInstance('Users'); $user->retrieve_entity_info(1,'Users'); } echo $chiave; exit; } include('modules/Morphsuit/HeaderMorphsuit.php'); require_once('modules/Morphsuit/Morphsuit.php'); $focusMorphsuit = new Morphsuit(); $vteActivationMail = $focusMorphsuit->vteActivationMail; $sectionTitle = $mod_strings['LBL_MORPHSUIT_ACTIVATION']." $enterprise_mode $enterprise_current_version"; ?>