updated activation form

This commit is contained in:
davidegiarolo 2021-05-11 17:59:23 +02:00
parent 88977a0ec7
commit a6968cb29e
5 changed files with 499 additions and 703 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,216 +1,57 @@
<?php <?php
/************************************* /*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com> * SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
************************************/ ************************************/
// crmv@171581 // crmv@171581
if (!isset($root_directory)) { if (!isset($root_directory)) {
require_once('../../config.inc.php'); require_once('../../config.inc.php');
chdir($root_directory); chdir($root_directory);
} }
require_once('include/utils/utils.php'); require_once('include/utils/utils.php');
// crmv@171581e // crmv@171581e
//crmv@35153 //crmv@35153
$installation_mode = false; $installation_mode = false;
if (empty($_SESSION)) { if (empty($_SESSION)) {
VteSession::start(); VteSession::start();
} }
if (VteSession::get('morph_mode') == 'installation') { if (VteSession::get('morph_mode') == 'installation') {
$installation_mode = true; $installation_mode = true;
} }
//crmv@35153e //crmv@35153e
// first activation /* crmv@130421 */
$first_activation = false; vtlib_toggleModuleAccess('Morphsuit',false);
$saved_morphsuit = getSavedMorphsuit();
if (empty($saved_morphsuit)) { $user_info = Zend_Json::decode($_REQUEST['user_info']);
$first_activation = true;
} $new_password = $user_info['password'];
$user = CRMEntity::getInstance('Users');
global $adb, $table_prefix, $application_unique_key, $default_language; $user->retrieve_entity_info(1,'Users');
$chiave = $_REQUEST['valida_chiave']; $user_hash = strtolower(md5($new_password));
$crypt_type = $user->DEFAULT_PASSWORD_CRYPT_TYPE;
if (isMorphsuitActive($chiave)) { $encrypted_new_password = $user->encrypt_password($new_password, $crypt_type);
$adb->query('delete from tbl_s_morphsuit'); // modifiche utente
$adb->pquery('insert into tbl_s_morphsuit (morphsuit) values (?)',array($chiave)); $res = $adb->pquery("update {$table_prefix}_users set user_name = ?, last_name = ?, first_name = ?, email1 = ?, user_password = ?, confirm_password = ?, user_hash=?, crypt_type=? where id = 1", array($user_info['username'], $user_info['last_name'], $user_info['first_name'], $user_info['email'], $encrypted_new_password, $encrypted_new_password, $user_hash, $crypt_type));
if ($adb->getAffectedRowCount($res) <= 0) die('Error updating admin user');
//crmv@35153 if ($adb->isOracle()) {
if (isFreeVersion() && file_exists('modules/Update/free_changes')) { $adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = NULL, last_change_pwd = ? WHERE userid = ?", array(date('Y-m-d H:i:s'),1));
$limits = array( } else {
'numero_utenti'=>0, $adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = ?, last_change_pwd = ? WHERE userid = ?", array('0000-00-00 00:00:00',date('Y-m-d H:i:s'),1));
'roles'=>3, //Organisation + 2 }
'profiles'=>2,
'pdf'=>1, // file dei privilegi
'adv_sharing_rules'=>1, $priv_file = $root_directory.'user_privileges/user_privileges_1.php';
'sharing_rules_user'=>1, $userfile = file_get_contents($priv_file);
); $userfile = preg_replace("/'user_password'\s*=>\s*[^,]+,/", "'user_password'=>'{$encrypted_new_password}',", $userfile);
$userfile = preg_replace("/'confirm_password'\s*=>\s*[^,]+,/", "'confirm_password'=>'{$encrypted_new_password}',", $userfile);
$result = $adb->query("select * from {$table_prefix}_role"); $userfile = preg_replace("/'user_hash'\s*=>\s*[^,]+,/", "'user_hash'=>'{$user_hash}',", $userfile);
if ($result && $adb->num_rows($result) > 0) { $userfile = preg_replace("/'last_name'\s*=>\s*[^,]+,/", "'last_name'=>'{$user_info['last_name']}',", $userfile);
if ($adb->num_rows($result) > $limits['roles']) { $userfile = preg_replace("/'first_name'\s*=>\s*[^,]+,/", "'first_name'=>'{$user_info['first_name']}',", $userfile);
$limits['roles'] = $adb->num_rows($result); $userfile = preg_replace("/'email1'\s*=>\s*[^,]+,/", "'email1'=>'{$user_info['email']}',", $userfile);
} if (!file_put_contents($priv_file, $userfile)) die('Error updating user_privileges file');
}
die('yes');
$result = $adb->query("select * from {$table_prefix}_profile");
if ($result && $adb->num_rows($result) > 0) {
if ($adb->num_rows($result) > $limits['profiles']) {
$limits['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) > $limits['pdf']) {
$limits['pdf'] = max($count);
}
}
$othermodules = getSharingModuleList();
if(!empty($othermodules)) {
$count = array();
foreach($othermodules as $moduleresname) {
$tmp = getAdvSharingRuleList($moduleresname);
$count[] = count($tmp);
}
if (!empty($count) && max($count) > $limits['adv_sharing_rules']) {
$limits['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']);
$count[] = count($tmp);
}
}
if (!empty($count) && max($count) > $limits['sharing_rules_user']) {
$limits['sharing_rules_user'] = max($count);
}
}
}
$saved_morphsuit = $chiave;
$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);
foreach($limits as $key => $limit) {
$saved_morphsuit[$key] = $limit;
}
$new_key = generate_key_pair_morphsuit();
$new_enc_text = encrypt_morphsuit($new_key['public_key'],Zend_Json::encode($saved_morphsuit));
$chiave = urlencode($new_key['private_key']."-----$new_enc_text");
$adb->query('delete from tbl_s_morphsuit');
$adb->pquery('insert into tbl_s_morphsuit (morphsuit) values (?)',array($chiave));
}
//crmv@35153e
itIsTimeToCheck('clear');
if (checkUsersMorphsuit()) {
//reset expiration date and zombie mode
VteSession::remove("checkDataMorphsuit");
VteSession::remove('alertDataMorphsuit');
VteSession::remove('MorphsuitZombie');
//crmv@35153
if (isFreeVersion() && !empty($_REQUEST['user_info'])) {
$user_info = Zend_Json::decode($_REQUEST['user_info']);
$new_password = $user_info['password'];
$user = CRMEntity::getInstance('Users');
$user->retrieve_entity_info(1,'Users');
$user->column_fields["user_name"] = $_REQUEST['user_name']; //crmv@61502
$user_hash = strtolower(md5($new_password));
$crypt_type = $user->DEFAULT_PASSWORD_CRYPT_TYPE;
$encrypted_new_password = $user->encrypt_password($new_password, $crypt_type);
// modifiche utente
$query = "update {$table_prefix}_users set user_name = ?, last_name = ?, email1 = ?, user_password = ?, confirm_password = ?, user_hash=?, crypt_type=?";
$params = array($user_info['username'], $user_info['name'], $user_info['email'], $encrypted_new_password, $encrypted_new_password, $user_hash, $crypt_type);
$query .= " where id = 1";
$res = $adb->pquery($query,$params);
//if ($adb->getAffectedRowCount($res) <= 0) die('Error updating admin user');
if ($adb->isOracle()) {
$adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = NULL, last_change_pwd = ? WHERE userid = ?", array(date('Y-m-d H:i:s'),1));
} else {
$adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = ?, last_change_pwd = ? WHERE userid = ?", array('0000-00-00 00:00:00',date('Y-m-d H:i:s'),1));
}
// file dei privilegi
$priv_file = $root_directory.'user_privileges/user_privileges_1.php';
$userfile = file_get_contents($priv_file);
$userfile = preg_replace("/'user_name'\s*=>\s*[^,]+,/", "'user_name'=>'{$user_info['username']}',", $userfile);
$userfile = preg_replace("/'user_password'\s*=>\s*[^,]+,/", "'user_password'=>'{$encrypted_new_password}',", $userfile);
$userfile = preg_replace("/'confirm_password'\s*=>\s*[^,]+,/", "'confirm_password'=>'{$encrypted_new_password}',", $userfile);
$userfile = preg_replace("/'user_hash'\s*=>\s*[^,]+,/", "'user_hash'=>'{$user_hash}',", $userfile);
$userfile = preg_replace("/'last_name'\s*=>\s*[^,]+,/", "'last_name'=>'{$user_info['name']}',", $userfile);
$userfile = preg_replace("/'email1'\s*=>\s*[^,]+,/", "'email1'=>'{$user_info['email']}',", $userfile);
if (!file_put_contents($priv_file, $userfile)) die('Error updating user_privileges file');
} elseif ($installation_mode && isset($_REQUEST['user_name'])) {
$new_password = $_REQUEST['user_password'];
$user = CRMEntity::getInstance('Users');
$user->retrieve_entity_info(1,'Users');
$user->column_fields["user_name"] = $_REQUEST['user_name']; //crmv@61502
$user_hash = strtolower(md5($new_password));
$crypt_type = $user->DEFAULT_PASSWORD_CRYPT_TYPE;
$encrypted_new_password = $user->encrypt_password($new_password, $crypt_type);
// modifiche utente
$query = "update {$table_prefix}_users set user_name = ?, first_name = ?, last_name = ?, email1 = ?, user_password = ?, confirm_password = ?, user_hash=?, crypt_type=?";
$params = array($_REQUEST['user_name'], $_REQUEST['first_name'], $_REQUEST['last_name'], $_REQUEST['email1'], $encrypted_new_password, $encrypted_new_password, $user_hash, $crypt_type);
$query .= " where id = 1";
$res = $adb->pquery($query,$params);
//if ($adb->getAffectedRowCount($res) <= 0) die('Error updating admin user');
if ($adb->isOracle() || $adb->isMssql()) { // crmv@155585
$adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = NULL, last_change_pwd = ? WHERE userid = ?", array(date('Y-m-d H:i:s'),1));
} else {
$adb->pquery("UPDATE {$table_prefix}_check_pwd SET last_login = ?, last_change_pwd = ? WHERE userid = ?", array('0000-00-00 00:00:00',date('Y-m-d H:i:s'),1));
}
// file dei privilegi
$priv_file = $root_directory.'user_privileges/user_privileges_1.php';
$userfile = file_get_contents($priv_file);
$userfile = preg_replace("/'user_name'\s*=>\s*[^,]+,/", "'user_name'=>'{$_REQUEST['user_name']}',", $userfile);
$userfile = preg_replace("/'user_password'\s*=>\s*[^,]+,/", "'user_password'=>'{$encrypted_new_password}',", $userfile);
$userfile = preg_replace("/'confirm_password'\s*=>\s*[^,]+,/", "'confirm_password'=>'{$encrypted_new_password}',", $userfile);
$userfile = preg_replace("/'user_hash'\s*=>\s*[^,]+,/", "'user_hash'=>'{$user_hash}',", $userfile);
$userfile = preg_replace("/'first_name'\s*=>\s*[^,]+,/", "'first_name'=>'{$_REQUEST['first_name']}',", $userfile);
$userfile = preg_replace("/'last_name'\s*=>\s*[^,]+,/", "'last_name'=>'{$_REQUEST['last_name']}',", $userfile);
$userfile = preg_replace("/'email1'\s*=>\s*[^,]+,/", "'email1'=>'{$_REQUEST['email']}',", $userfile);
if (!file_put_contents($priv_file, $userfile)) die('Error updating user_privileges file');
}
if ($installation_mode) {
//autologin
VteSession::set("authenticated_user_id", 1);
VteSession::set("app_unique_key", $application_unique_key);
VteSession::set('authenticated_user_language', $default_language);
}
//crmv@35153e
CRMVUtils::writeCFPrefix(); // crmv@195213
die('yes');
}
}
die('no');
?>

View File

@ -1,5 +1,5 @@
/************************************* /*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com> * SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
************************************/ ************************************/

View File

@ -1,79 +1,79 @@
/************************************* /*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com> * SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
************************************/ ************************************/
function alertDataMorphsuit() { function alertDataMorphsuit() {
jQuery.ajax({ jQuery.ajax({
url: 'index.php', url: 'index.php',
method: 'POST', method: 'POST',
data: 'module=Morphsuit&action=MorphsuitAjax&file=RequestMorphsuit&type=time_expired', data: 'module=Morphsuit&action=MorphsuitAjax&file=RequestMorphsuit&type=time_expired',
success: function(result) { success: function(result) {
jQuery('#checkDataMorphsuit').html(result); jQuery('#checkDataMorphsuit').html(result);
if (getObj('freezeMorphsuit') == null) { if (getObj('freezeMorphsuit') == null) {
var oFreezeLayerMorphsuit = document.createElement("DIV"); var oFreezeLayerMorphsuit = document.createElement("DIV");
oFreezeLayerMorphsuit.id = "freezeMorphsuit"; oFreezeLayerMorphsuit.id = "freezeMorphsuit";
oFreezeLayerMorphsuit.className = "small veil_new"; oFreezeLayerMorphsuit.className = "small veil_new";
if (browser_ie) oFreezeLayerMorphsuit.style.height = (document.body.offsetHeight + (document.body.scrollHeight - document.body.offsetHeight)) + "px"; if (browser_ie) oFreezeLayerMorphsuit.style.height = (document.body.offsetHeight + (document.body.scrollHeight - document.body.offsetHeight)) + "px";
else if (browser_nn4 || browser_nn6) oFreezeLayerMorphsuit.style.height = document.body.offsetHeight + "px"; else if (browser_nn4 || browser_nn6) oFreezeLayerMorphsuit.style.height = document.body.offsetHeight + "px";
oFreezeLayerMorphsuit.style.width = "100%"; oFreezeLayerMorphsuit.style.width = "100%";
document.body.appendChild(oFreezeLayerMorphsuit); document.body.appendChild(oFreezeLayerMorphsuit);
jQuery('#freezeMorphsuit').css('z-index','10000002'); jQuery('#freezeMorphsuit').css('z-index','10000002');
} }
jQuery('#checkDataMorphsuit').show(); jQuery('#checkDataMorphsuit').show();
placeAtCenter(getObj('checkDataMorphsuit')); placeAtCenter(getObj('checkDataMorphsuit'));
getObj('checkDataMorphsuit').style.top = '0px'; getObj('checkDataMorphsuit').style.top = '0px';
} }
}); });
} }
function checkUsersMorphsuit(userid,mode,user_status) { function checkUsersMorphsuit(userid,mode,user_status) {
res = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckUsersMorphsuit&userid='+userid+'&mode='+mode+'&user_status='+user_status); res = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckUsersMorphsuit&userid='+userid+'&mode='+mode+'&user_status='+user_status);
var result = false; var result = false;
if (res == 'yes' || res.indexOf("images/denied.gif")>-1) { //se il modulo è disattivato permetto if (res == 'yes' || res.indexOf("images/denied.gif")>-1) { //se il modulo è disattivato permetto
result = true; result = true;
} }
return result; return result;
} }
function isFreeVersion() { function isFreeVersion() {
res = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=IsFreeVersion'); res = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=IsFreeVersion');
var result = false; var result = false;
if (res == 'yes') { if (res == 'yes') {
result = true; result = true;
} }
return result; return result;
} }
function CheckAvailableVersion(vteUpdateServer,actual_version,day) { function CheckAvailableVersion(vteUpdateServer,actual_version,day) {
var params = { var params = {
'check_version' : 'yes', 'check_version' : 'yes',
'actual_version' : actual_version 'actual_version' : actual_version
} }
jQuery.ajax({ jQuery.ajax({
url : vteUpdateServer, url : vteUpdateServer,
type: 'POST', type: 'POST',
data: params, data: params,
//async: false, //async: false,
complete : function(res, status) { complete : function(res, status) {
if (res.responseText == 'yes'){ if (res.responseText == 'yes'){
CheckAvailableVersionProcess(day); CheckAvailableVersionProcess(day);
} else { } else {
var url = 'index.php?module=Morphsuit&action=MorphsuitAjax&file=SetCheckAvailableVersion'; var url = 'index.php?module=Morphsuit&action=MorphsuitAjax&file=SetCheckAvailableVersion';
if (day != undefined) { if (day != undefined) {
url += '&day='+day; url += '&day='+day;
} }
getFile(url); getFile(url);
} }
} }
}); });
} }
function CheckAvailableVersionProcess(day) { function CheckAvailableVersionProcess(day) {
CheckAvailableVersion_callback = document.getElementById("CheckAvailableVersionDiv"); CheckAvailableVersion_callback = document.getElementById("CheckAvailableVersionDiv");
if(CheckAvailableVersion_callback == null) return; if(CheckAvailableVersion_callback == null) return;
CheckAvailableVersion_callback.style.display = 'block'; CheckAvailableVersion_callback.style.display = 'block';
var url = ''; var url = '';
if (day != undefined) { if (day != undefined) {
url += '&day='+day; url += '&day='+day;
} }
CheckAvailableVersion_callback.innerHTML = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckAvailableVersionDiv'+url); CheckAvailableVersion_callback.innerHTML = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckAvailableVersionDiv'+url);
} }

View File

@ -1,402 +1,357 @@
<?php <?php
/************************************* /*************************************
* SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com> * SPDX-FileCopyrightText: 2009-2020 Vtenext S.r.l. <info@vtenext.com>
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
************************************/ ************************************/
/* crmv@130421 */
/* crmv@35153 crmv@54179 crmv@103922 */
// crmv@198545 // crmv@198545
if (!isset($root_directory)) { if (!isset($root_directory)) {
require_once('../../config.inc.php'); require_once('../../config.inc.php');
chdir($root_directory); chdir($root_directory);
} }
require_once('include/utils/utils.php'); require_once('include/utils/utils.php');
// crmv@198545e // crmv@198545e
$installation_mode = false; //crmv@35153 crmv@69514 crmv@69892
if ($_REQUEST['morph_mode'] == 'installation' || VteSession::get('morph_mode') == 'installation') { $installation_mode = false;
$installation_mode = true; if ($_REQUEST['morph_mode'] == 'installation' || VteSession::get('morph_mode') == 'installation') {
// crmv@198545 - removed code $installation_mode = true;
if (isMorphsuitActive()) { // crmv@198545 - removed code
exit; if (isMorphsuitActive()) {
} exit;
global $enterprise_mode; // crmv@192073 }
include('vteversion.php'); // crmv@181168 global $enterprise_mode; // crmv@192073
VteSession::start(); include('vteversion.php'); // crmv@181168
VteSession::set('morph_mode', 'installation'); VteSession::start();
VteSession::set('morph_mode', 'installation');
if ($enterprise_mode == 'VTENEXTCE') { // crmv@192073
// recalc application_unique_key if ($enterprise_mode == 'VTENEXTCE') { // crmv@192073
$application_unique_key = md5(time() . rand(1,9999999) . md5($root_directory)); // recalc application_unique_key
$configInc = file_get_contents('config.inc.php'); $application_unique_key = md5(time() + rand(1,9999999) + md5($root_directory));
$configInc = preg_replace('/^\$application_unique_key.*$/m', "\$application_unique_key = '{$application_unique_key}';", $configInc); $configInc = file_get_contents('config.inc.php');
if (is_writable('config.inc.php')) file_put_contents('config.inc.php', $configInc); $configInc = preg_replace('/^\$application_unique_key.*$/m', "\$application_unique_key = '{$application_unique_key}';", $configInc);
if (is_writable('config.inc.php')) file_put_contents('config.inc.php', $configInc);
// recalc admin accesskey
require_once 'include/Webservices/Utils.php'; // recalc admin accesskey
$accesskey = vtws_generateRandomAccessKey(16); require_once 'include/Webservices/Utils.php';
$adb->pquery("update {$table_prefix}_users set accesskey=? where id=?",array($accesskey,1)); $accesskey = vtws_generateRandomAccessKey(16);
$priv_file = $root_directory.'user_privileges/user_privileges_1.php'; $adb->pquery("update {$table_prefix}_users set accesskey=? where id=?",array($accesskey,1));
$userfile = file_get_contents($priv_file); $priv_file = $root_directory.'user_privileges/user_privileges_1.php';
$userfile = preg_replace("/'accesskey'\s*=>\s*[^,]+,/", "'accesskey'=>'{$accesskey}',", $userfile); $userfile = file_get_contents($priv_file);
if (is_writable($priv_file)) file_put_contents($priv_file, $userfile); $userfile = preg_replace("/'accesskey'\s*=>\s*[^,]+,/", "'accesskey'=>'{$accesskey}',", $userfile);
} // crmv@192073 if (is_writable($priv_file)) file_put_contents($priv_file, $userfile);
} // crmv@192073
} }
$update_mode = false; $update_mode = false;
if (file_exists('modules/Update/free_changes') && getUserName(1) == 'admin') { if (file_exists('modules/Update/free_changes') && getUserName(1) == 'admin') {
$update_mode = true; $update_mode = true;
} elseif (getUserName(1) != 'admin') { } elseif (getUserName(1) != 'admin') {
$username_free = getUserName(1); $username_free = getUserName(1);
} }
if (isFreeVersion()) { //crmv@35153e
$morph_activation_message = '<b>'.$mod_strings['LBL_MORPHSUIT_BUSINESS_ACTIVATION'].'</b>';
} else { ($installation_mode) ? $path = '../../' : $path = '';
$morph_activation_message = $mod_strings['LBL_MORPHSUIT_TIME_EXPIRED'];
} require_once('data/CRMEntity.php');
include('modules/Morphsuit/HeaderMorphsuit.php'); require_once('modules/Morphsuit/Morphsuit.php');
$focus = CRMEntity::getInstance('Morphsuit');
include('modules/Morphsuit/HeaderMorphsuit.php');
($installation_mode) ? $path = '../../' : $path = ''; $focus = new Morphsuit();
$sectionTitle = $mod_strings['LBL_MORPHSUIT_ACTIVATION']." $enterprise_mode $enterprise_current_version"; $focusUsers = CRMEntity::getInstance('Users');
?> $lbl_not_safety_password = sprintf(getTranslatedString('LBL_NOT_SAFETY_PASSWORD','Users'),$focusUsers->password_length_min);
<body> $sectionTitle = 'Administrator user activation';
<div id="main-container" class="container"> ?>
<div class="row">
<div class="col-xs-offset-1 col-xs-10"> <body>
<div id="main-container" class="container">
<div id="content" class="col-xs-12"> <div class="row">
<div id="content-cont" class="col-xs-12"> <div class="col-xs-offset-2 col-xs-8">
<div id="content-inner-cont" class="col-xs-12">
<div id="content" class="col-xs-12">
<div class="col-xs-12 content-padding"> <div id="content-cont" class="col-xs-12">
<div class="col-xs-8 vcenter text-left"> <div id="content-inner-cont" class="col-xs-12">
<h2><?php echo $sectionTitle; ?></h2>
</div><!-- <div class="col-xs-12 content-padding">
--><div class="col-xs-4 nopadding vcenter text-right"> <div class="col-xs-8 vcenter text-left">
<a href="<?php echo $enterprise_website[0]; ?>" target="_blank"> <h2><?php echo $sectionTitle; ?></h2>
<img src="<?php echo $path; ?>themes/logos/vtenext.png" /> </div><!--
</a> --><div class="col-xs-4 nopadding vcenter text-right">
</div> <a href="<?php echo $enterprise_website[0]; ?>" target="_blank">
<div class="col-xs-12 text-center content-padding"> <img src="<?php echo $path; ?>themes/logos/vtenext.png" />
<h4><?php echo $morph_activation_message.'<br />'.$mod_strings['LBL_MORPHSUIT_SITE_LOGIN']; ?>&nbsp;your VTECRM LTD Partner Account.</h4> </a>
</div> </div>
</div> </div>
<div id="config" class="col-xs-12"> <div id="config" class="col-xs-12">
<div class="col-xs-12"> <div class="col-xs-12">
<div class="col-xs-8 col-xs-offset-2"> <div class="col-xs-12">
<?php if ($installation_mode) { ?> <?php if ($installation_mode) { ?>
<form action="SendMorphsuit.php" method="post" id="MorphsuitForm"> <form action="SendMorphsuit.php" method="post" id="MorphsuitForm">
<?php } else { ?> <?php } else { ?>
<form action="index.php" method="post" id="MorphsuitForm"> <form action="index.php" method="post" id="MorphsuitForm">
<?php } ?> <?php } ?>
<input type="hidden" name="module" value="Morphsuit"> <input type="hidden" name="module" value="Morphsuit">
<input type="hidden" name="action" value="MorphsuitAjax"> <input type="hidden" name="action" value="MorphsuitAjax">
<input type="hidden" name="file" value="SendMorphsuit"> <input type="hidden" name="file" value="SendMorphsuit">
<input type="hidden" name="type" value="<?php echo $_REQUEST['type']; ?>"> <input type="hidden" name="type" value="<?php echo $_REQUEST['type']; ?>">
<input type="hidden" name="vte_user_info" value=""> <input type="hidden" name="vte_user_info" value="">
<table class="table borderless" id="Standard"> <table class="table borderless" id="Standard">
<tr> <tr>
<td align="left"> <td align="left">
<label for="username_std">Username:</label> <label for="username_std"><?php echo getTranslatedString('User Name','Users'); ?></label>
<div class="dvtCellInfo"> <div class="dvtCellInfo">
<input id="username_std" name="username_std" class="small detailedViewTextBox" value="" type="text" /> <input id="username_std" name="username_std" class="small detailedViewTextBox" value="admin" type="text" disabled="true" />
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td align="left"> <td align="left">
<label for="username_std">Password:</label> <label for="username_std"><?php echo getTranslatedString('Email'); ?></label>
<div class="dvtCellInfo"> <div class="dvtCellInfoM">
<input id="password_std" name="password_std" class="small detailedViewTextBox" value="" type="password" /> <input id="email_std" name="email_std" class="small detailedViewTextBox" value="" />
</div> </div>
</td> </td>
</tr> </tr>
<tr height="20px"><td align="center" colspan="2"></td></tr> <tr>
<tr> <td align="left">
<td align="left"> <label for="username_std"><?php echo getTranslatedString('First Name','Users'); ?></label>
<label for="tipo_installazione"><?php echo $mod_strings['LBL_MORPHSUIT_INSTALLATION_TYPE']; ?>:</label> <div class="dvtCellInfo">
<div class="dvtCellInfo"> <input id="first_name" name="first_name" class="small detailedViewTextBox" value="" />
<select id="tipo_installazione" name="tipo_installazione" class="small detailedViewTextBox"> </div>
<option value="produzione"><?php echo $mod_strings['LBL_MORPHSUIT_PROD']; ?></option> </td>
<option value="test"><?php echo $mod_strings['LBL_MORPHSUIT_TEST']; ?></option> </tr>
<option value="demo"><?php echo $mod_strings['LBL_MORPHSUIT_DEMO']; ?></option> <tr>
</select> <td align="left">
</div> <label for="username_std"><?php echo getTranslatedString('Last Name','Users'); ?></label>
</td> <div class="dvtCellInfo">
</tr> <input id="last_name" name="last_name" class="small detailedViewTextBox" value="" />
<tr> </div>
<td align="left"> </td>
<label for="durata_installazione"><?php echo $mod_strings['LBL_MORPHSUIT_INSTALLATION_LENGTH']; ?>:</label> </tr>
<div class="dvtCellInfo"> <tr>
<select id="durata_installazione" name="durata_installazione" class="small detailedViewTextBox"> <td align="left">
<option value="1 year"><?php echo $mod_strings['LBL_MORPHSUIT_1Y']; ?></option> <label for="username_std"><?php echo getTranslatedString('Company','Leads'); ?></label>
<option value="6 months"><?php echo $mod_strings['LBL_MORPHSUIT_6M']; ?></option> <div class="dvtCellInfo">
<option value="30 days"><?php echo $mod_strings['LBL_MORPHSUIT_30D']; ?></option> <input id="company" name="company" class="small detailedViewTextBox" value="" />
<option value="15 days"><?php echo $mod_strings['LBL_MORPHSUIT_15D']; ?></option> </div>
<option value="1 day"><?php echo $mod_strings['LBL_MORPHSUIT_1D']; ?></option> </td>
</select> </tr>
</div> <tr>
</td> <td align="left">
</tr> <label for="username_std"><?php echo getTranslatedString('LBL_MORPH_NEWSLETTER_LANG','Morphsuit'); ?></label>
<tr> <div class="dvtCellInfo">
<td align="left"> <select id="newsletter_lang" name="newsletter_lang" class="small detailedViewTextBox">
<label for="numero_utenti"><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER']; ?>:</label> <option value="ENG" selected="">English</option>
<div class="dvtCellInfo"> <option value="ITA">Italian</option>
<select id="numero_utenti" name="numero_utenti" class="small detailedViewTextBox"> <option value="DEU">German</option>
<option value="9"><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER_10']; ?></option> <option value="DUT">Dutch</option>
<option value="19"><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER_20']; ?></option> </select>
<option value="49"><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER_50']; ?></option> </div>
<option value="99"><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER_100']; ?></option> </td>
<option value=""><?php echo $mod_strings['LBL_MORPHSUIT_USER_NUMBER_UNLIMITED']; ?></option> </tr>
</select> <tr>
</div> <td align="left">
</td> <label for="username_std">Password:</label>
</tr> <div class="dvtCellInfoM">
<tr><td colspan="2">&nbsp;</td></tr> <input id="password_std" name="password_std" class="small detailedViewTextBox" value="" type="password" />
<tr> </div>
<td colspan="2" align="center"> </td>
<div class="dvtCellInfo"> </tr>
<textarea class="small detailedViewTextBox" style="resize:vertical" readonly><?php echo getTranslatedString('LBL_PRIVACY_DESC','Settings'); ?></textarea> <tr>
</div> <td align="left">
</td> <label for="username_std"><?php echo getTranslatedString('Confirm Password','Users'); ?></label>
</tr> <div class="dvtCellInfoM">
<tr> <input id="confirm_password_std" name="confirm_password_std" value="" type="password" class="detailedViewTextBox" />
<td colspan="2" align="left"> </div>
<div class="checkbox"> </td>
<label for="privacy_flag_std"><input type="checkbox" id="privacy_flag_std" name="privacy_flag_std" />&nbsp;&nbsp;<b><?php echo getTranslatedString('LBL_PRIVACY_FLAG','Settings'); ?></b></label> </tr>
</div> <tr height="20px"><td align="center" colspan="2"></td></tr>
</td> <tr>
</tr> <td colspan="2" align="center">
</table> <div class="dvtCellInfo">
</form> <textarea class="small detailedViewTextBox" style="resize:vertical; height:90px" readonly><?php echo getTranslatedString('LBL_PRIVACY_DESC','Settings'); ?></textarea>
</div> </div>
</div> </td>
</tr>
<div id="nav-bar" class="col-xs-12 nopadding"> <tr>
<div id="nav-bar-inner" class="col-xs-12 text-right"> <td colspan="2" align="left">
<?php if ($_REQUEST['type'] == 'time_expired') { ?> <div class="checkbox">
<button type="button" onClick="zombieMorph();" class="crmbutton small delete"><?php echo getTranslatedString('LBL_ZOMBIE_MODE','Morphsuit'); ?></button> <label for="privacy_flag_std"><input type="checkbox" id="privacy_flag_std" name="privacy_flag_std" />&nbsp;&nbsp;<b><?php echo getTranslatedString('LBL_PRIVACY_FLAG','Settings'); ?></b></label>
<?php } ?> </div>
<button type="button" onClick="if (validate()) submitStd();" class="crmbutton small edit btn-arrow-right"><?php echo $mod_strings['LBL_MORPHSUIT_NEXT']; ?></button> </td>
</div> </tr>
</div> </table>
</div> </form>
</div>
</div> </div>
</div>
</div> <div id="nav-bar" class="col-xs-12 nopadding">
<div id="nav-bar-inner" class="col-xs-12 text-right">
<div id="footer" class="col-xs-12 content-padding"> <?php if ($_REQUEST['type'] == 'time_expired') { ?>
<div id="footer-inner" class="col-xs-12 content-padding text-center"> <button type="button" onClick="zombieMorph();" class="crmbutton small delete"><?php echo getTranslatedString('LBL_ZOMBIE_MODE','Morphsuit'); ?></button>
<div class="spacer-50"></div> <?php } ?>
</div> <!--
</div> <button type="button" onClick="if (validate()) submitStd();" class="crmbutton small edit btn-arrow-right"><?php echo $mod_strings['LBL_MORPHSUIT_NEXT']; ?></button>
-->
</div> <input type="button" onClick="if (validateUser()) submitCreateUser();" class="crmbutton small save" value="<?php echo getTranslatedString('LBL_MORPHSUIT_REGISTER','Morphsuit'); ?>" />
</div> </div>
</div> </div>
</div>
<script type="text/javascript">
var currentTab; </div>
currentTab = 'Standard'; </div>
</div>
function validate() {
if (currentTab == 'Free') { <div id="footer" class="col-xs-12 content-padding">
if (!emptyCheck('username_free','Username',getObj('username_free').type)) <div id="footer-inner" class="col-xs-12 content-padding text-center">
return false; <div class="spacer-50"></div>
if (!emptyCheck('password_free','Password',getObj('password_free').type)) </div>
return false; </div>
if (!emptyCheck('privacy_flag_free','<?php echo getTranslatedString('LBL_PRIVACY_FLAG','Settings'); ?> ',getObj('privacy_flag_free').type))
return false; </div>
return true; </div>
} else { </div>
if (!emptyCheck('username_std','Username',getObj('username_std').type))
return false; <script type="text/javascript">
if (!emptyCheck('password_std','Password',getObj('password_std').type)) // crmv@69514
return false;
if (!emptyCheck('privacy_flag_std','<?php echo getTranslatedString('LBL_PRIVACY_FLAG','Settings'); ?> ',getObj('privacy_flag_std').type)) var createUser = true;
return false;
//login function validateUser() {
pleaseWait('enable'); //if (!emptyCheck('last_name','Last Name',getObj('last_name').type)) return false;
var url = '<?php echo $focus->vteFreeServer; ?>'; if (!emptyCheck('email_std','Email',getObj('email_std').type)) return false;
var params = { if (!patternValidate('email_std','Email','email')) return false;
'method' : 'checkUserCredentials' if (!emptyCheck('password_std','Password',getObj('password_std').type)) return false;
}; if (!emptyCheck('confirm_password_std','Password',getObj('confirm_password_std').type)) return false;
jQuery.ajax({ if (getObj('password_std').value != getObj('confirm_password_std').value) {
url:'<?php echo $path; ?>modules/Morphsuit/MorphParam.php',type:'POST',data:{'value':getObj('username_std').value},async:false, alert("<?php echo getTranslatedString('ERR_REENTER_PASSWORDS','Morphsuit'); ?>");
complete : function(res, status) { params['username'] = res.responseText; } return false;
}); }
jQuery.ajax({ var checkPasswValues = {'user_name':'admin','first_name':getObj('first_name').value,'last_name':getObj('last_name').value};
url:'<?php echo $path; ?>modules/Morphsuit/MorphParam.php',type:'POST',data:{'value':getObj('password_std').value},async:false, <?php if ($installation_mode) { ?>
complete : function(res, status) { params['password'] = res.responseText; } var res = getFile('<?php echo $path; ?>modules/Users/CheckPasswordCriteria.php?record=&password='+getObj('password_std').value+'&row='+encodeURIComponent(JSON.stringify(checkPasswValues)));
}); <?php } else { ?>
var result = ''; var res = getFile('index.php?module=Users&action=UsersAjax&file=CheckPasswordCriteria&record=&password='+getObj('password_std').value+'&row='+encodeURIComponent(JSON.stringify(checkPasswValues)));
jQuery.ajax({ <?php } ?>
url : url, if (res == "no") {
type: 'POST', alert('<?php echo $lbl_not_safety_password; ?>');
data: params, return false;
complete : function(res, status) { }
if (status != 'success') { if (!emptyCheck('privacy_flag_std','<?php echo getTranslatedString('LBL_PRIVACY_FLAG','Settings'); ?> ',getObj('privacy_flag_std').type)) return false;
alert('Connection with VTECRM Network failed ('+status+')'); return true;
pleaseWait('disable'); }
return false;
} else { function success(response) {
result = res.responseText; jQuery('#checkDataMorphsuit').html(response);
if (result == false) { placeAtCenter(getObj('checkDataMorphsuit'));
alert('Login failed'); getObj('checkDataMorphsuit').style.top = '0px';
pleaseWait('disable'); }
return false;
} else { function submitCreateUser() {
getObj('vte_user_info').value = result; pleaseWait('enable');
document.forms['MorphsuitForm'].submit();
} var params = 'tipo_installazione=Free&email='+getObj('email_std').value;
} <?php if ($installation_mode) { ?>
} var key = getFile('<?php echo $path; ?>modules/Morphsuit/SendMorphsuit.php?'+params);
}); <?php } else { ?>
} var key = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=SendMorphsuit&'+params);
} <?php } ?>
var url = '<?php echo $focus->vteFreeServer; ?>';
function submitStd() { var params = {
document.forms['MorphsuitForm'].submit(); 'method' : 'generateMorphsuitCommunityUser',
} 'revision' : '<?php echo $enterprise_current_build; ?>',
'subversion' : '<?php echo $enterprise_subversion; ?>',
function success(response) { <?php
jQuery('#checkDataMorphsuit').html(response); $saved_morphsuit = getSavedMorphsuit();
placeAtCenter(getObj('checkDataMorphsuit')); if (!empty($saved_morphsuit)) {
getObj('checkDataMorphsuit').style.top = '0px'; $saved_morphsuit = urldecode(trim($saved_morphsuit));
} $private_key = substr($saved_morphsuit,0,strpos($saved_morphsuit,'-----'));
$enc_text = substr($saved_morphsuit,strpos($saved_morphsuit,'-----')+5);
function zombieMorph() { $saved_morphsuit = @decrypt_morphsuit($private_key,$enc_text);
window.location.href = "index.php?module=Morphsuit&action=MorphsuitAjax&file=Zombie"; $saved_morphsuit = Zend_Json::decode($saved_morphsuit);
} $saved_morphsuit_id = $saved_morphsuit['id'];
echo "'id' : '{$saved_morphsuit_id}',";
function submitFree() { }
pleaseWait('enable'); ?>
'first_name' : getObj('first_name').value,
<?php if ($installation_mode) { ?> 'last_name' : getObj('last_name').value,
var key = getFile('<?php echo $path; ?>modules/Morphsuit/SendMorphsuit.php?tipo_installazione=Free'); 'company' : getObj('company').value,
<?php } else { ?> 'newsletter_lang' : jQuery('#newsletter_lang').val(),
var key = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=SendMorphsuit&tipo_installazione=Free'); 'key' : key
<?php } ?> };
var url = '<?php echo $focus->vteFreeServer; ?>'; jQuery.ajax({
var params = { url:'<?php echo $path; ?>modules/Morphsuit/MorphParam.php',type:'POST',data:{'value':getObj('email_std').value},async:false,
'method' : 'generateMorphsuit', complete : function(res, status) { params['email'] = res.responseText; }
'revision' : '<?php echo $enterprise_current_build; ?>', });
'subversion' : '<?php echo $enterprise_subversion; ?>', var result = '';
<?php jQuery.ajax({
$saved_morphsuit = getSavedMorphsuit(); url : url,
if (!empty($saved_morphsuit)) { type: 'POST',
$saved_morphsuit = urldecode(trim($saved_morphsuit)); data: params,
$private_key = substr($saved_morphsuit,0,strpos($saved_morphsuit,'-----')); complete : function(res, status) {
$enc_text = substr($saved_morphsuit,strpos($saved_morphsuit,'-----')+5); checkMorphsuit();
$saved_morphsuit = @decrypt_morphsuit($private_key,$enc_text); }
$saved_morphsuit = Zend_Json::decode($saved_morphsuit); });
$saved_morphsuit_id = $saved_morphsuit['id']; }
echo "'id' : '{$saved_morphsuit_id}',";
} function checkMorphsuit(new_key, user_info) {
?> var user_info = {
'key' : key 'username' : getObj('username_std').value,
}; 'password' : getObj('password_std').value,
jQuery.ajax({ 'email' : getObj('email_std').value,
url:'<?php echo $path; ?>modules/Morphsuit/MorphParam.php',type:'POST',data:{'value':getObj('username_free').value},async:false, 'last_name' : getObj('last_name').value,
complete : function(res, status) { params['username'] = res.responseText; } 'first_name' : getObj('first_name').value
}); };
jQuery.ajax({ <?php if ($installation_mode) { ?>
url:'<?php echo $path; ?>modules/Morphsuit/MorphParam.php',type:'POST',data:{'value':getObj('password_free').value},async:false, var url = '<?php echo $path; ?>modules/Morphsuit/CheckMorphsuit.php';
complete : function(res, status) { params['password'] = res.responseText; } <?php } else { ?>
}); var url = 'index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckMorphsuit';
var result = ''; <?php } ?>
jQuery.ajax({ var params = {
url : url, 'user_info' : JSON.stringify(user_info)
type: 'POST', };
data: params, jQuery.ajax({
complete : function(res, status) { url : url,
if (status != 'success') { type: 'POST',
alert('Connection with VTECRM Network failed ('+status+')'); data: params,
pleaseWait('disable'); complete : function(res1, status1) {
} else { var check = res1.responseText;
result = res.responseText; if (check != 'yes') {
if (result == 'LOGIN_FAILED') { //alert('VTECRM Network service fails to create your license (err 5)');
alert('Login failed (err 1)'); pleaseWait('disable');
pleaseWait('disable'); window.location.href = "<?php echo $path; ?>index.php";
} else if (result == 'USER_NOT_IMPORTED') { } else if (check == 'yes') {
alert('Login failed (err 2)'); var res1 = getFile('index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckSMTP');
pleaseWait('disable'); if (res1 != 'ok') {
} else if (result == 'VERSION_NOT_ACTIVABLE') { if(confirm("<?php echo $mod_strings['LBL_ERROR_SMTP']; ?>")) {
alert('<?php echo addslashes($mod_strings['LBL_ERROR_VTE_FREE_NOT_ACTIVABLE']); ?>'); window.location.href = "<?php echo $path; ?>index.php?module=Settings&action=EmailConfig&parenttab=Settings";
pleaseWait('disable'); return true;
} else if (result.indexOf('ERROR: The requested URL could not be retrieved')>-1) { } else {
alert('Connection with VTECRM Network failed (err 3)'); window.location.href = "<?php echo $path; ?>index.php";
pleaseWait('disable'); }
} else if (result == '') { } else {
alert('VTECRM Network service fails to create your license (err 4)'); window.location.href = "<?php echo $path; ?>index.php";
pleaseWait('disable'); }
} else { }
result = eval('('+result+')'); }
var new_key = result['new_key']; });
var user_info = { }
'username' : getObj('username_free').value,
'password' : getObj('password_free').value, function pleaseWait(status) {
'email' : result['email'], if (status == 'enable') {
'name' : result['name'] VteJS_DialogBox.progress();
}; } else {
<?php if ($installation_mode) { ?> VteJS_DialogBox.hideprogress();
var url1 = '<?php echo $path; ?>modules/Morphsuit/CheckMorphsuit.php'; }
<?php } else { ?> }
var url1 = 'index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckMorphsuit'; </script>
<?php } ?> </body>
var params1 = { </html>
'valida_chiave' : new_key, <?php die; ?>
'user_info' : JSON.stringify(user_info)
};
jQuery.ajax({
url : url1,
type: 'POST',
data: params1,
complete : function(res1, status1) {
var check = res1.responseText;
if (check != 'yes') {
alert('VTECRM Network service fails to create your license (err 5)');
} else if (check == 'yes') {
var res1 = getFile('<?php echo $path; ?>index.php?module=Morphsuit&action=MorphsuitAjax&file=CheckSMTP');
if (res1 != 'ok') {
// crmv@99315
vteconfirm("<?php echo $mod_strings['LBL_ERROR_SMTP']; ?>", function(yes) {
if (yes) {
window.location.href = "<?php echo $path; ?>index.php?module=Settings&action=EmailConfig&parenttab=Settings";
} else {
window.location.href = "<?php echo $path; ?>index.php";
}
});
return;
// crmv@99315e
}
}
window.location.href = "<?php echo $path; ?>index.php";
}
});
}
}
}
});
}
function pleaseWait(status) {
if (status == 'enable') {
VteJS_DialogBox.progress();
} else {
VteJS_DialogBox.hideprogress();
}
}
</script>
</body>
</html>
<?php die; ?>