本文整理汇总了PHP中createUserPrivilegesfile函数的典型用法代码示例。如果您正苦于以下问题:PHP createUserPrivilegesfile函数的具体用法?PHP createUserPrivilegesfile怎么用?PHP createUserPrivilegesfile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createUserPrivilegesfile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultUsersAccess
/**
* Function creates default user's Role, Profiles
*/
public function setDefaultUsersAccess()
{
$adminPassword = $_SESSION['installation_info']['admin_password'];
$this->db->pquery('update vtiger_users set email1=? where id=1', array($_SESSION['installation_info']['admin_email']));
$newUser = new Users();
$newUser->retrieve_entity_info(1, 'Users');
$newUser->change_password('admin', $adminPassword, false);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile(1);
}
示例2: recalculate
public function recalculate()
{
$php_max_execution_time = vglobal('php_max_execution_time');
set_time_limit($php_max_execution_time);
vimport('~~modules/Users/CreateUserPrivilegeFile.php');
$userIdsList = Settings_Profiles_Record_Model::getUsersList(true);
if ($userIdsList) {
foreach ($userIdsList as $userId) {
createUserPrivilegesfile($userId);
}
}
}
示例3: process
public function process(Vtiger_Request $request)
{
$adb = \PearDatabase::getInstance();
switch ($request->get('option')) {
case 'recreateUserPrivilegs':
$sql = 'SELECT id FROM vtiger_users WHERE status = "Active"';
$result = $adb->query($sql);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
while ($row = $adb->fetchByAssoc($result)) {
createUserPrivilegesfile($row['id']);
createUserSharingPrivilegesfile($row['id']);
ini_set('display_errors', 1);
global $root_directory;
require_once $root_directory . 'user_privileges/user_privileges_' . $row['id'] . '.php';
require_once $root_directory . 'user_privileges/sharing_privileges_' . $row['id'] . '.php';
}
break;
case 'enableModComments':
$commentsModuleModel = Vtiger_Module_Model::getInstance('ModComments');
if ($commentsModuleModel && $commentsModuleModel->isActive()) {
$relatedToFieldResult = $adb->pquery('SELECT fieldid FROM vtiger_field WHERE fieldname = ? AND tabid = ?', array('related_to', $commentsModuleModel->getId()));
$fieldId = $adb->query_result($relatedToFieldResult, 0, 'fieldid');
$sql = 'SELECT * FROM vtiger_tab WHERE (isentitytype = 1 AND presence = 0) OR name = "Events"';
$result = $adb->query($sql);
while ($row = $adb->fetchByAssoc($result)) {
$sql = 'SELECT fieldid FROM vtiger_fieldmodulerel WHERE fieldid = ? AND module = "ModComments" AND relmodule = ?';
$check = $adb->pquery($sql, array($fieldId, $row['name']));
if ($adb->num_rows($check) == 0) {
$sql = 'INSERT INTO vtiger_fieldmodulerel SET fieldid = ?, module = "ModComments", relmodule = ?';
$adb->pquery($sql, array($fieldId, $row['name']));
}
}
}
break;
case 'initFilterSortOrder':
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_col', 'VARCHAR(255)');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_dir', 'VARCHAR(4)');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric_check', 'TINYINT');
\SwVtTools\DbCheck::checkColumn('vtiger_customview', 'order_numeric', 'VARCHAR(10)');
$adb = PearDatabase::getInstance();
$em = new VTEventsManager($adb);
// Registering event for Recurring Invoices
$em->registerHandler('vtiger.filter.process.customview.editajax.view.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.process.customview.editajax.view.finish', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.filter.process.customview.save.action.before', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
$em->registerHandler('vtiger.filter.listview.orderby', 'modules/SwVtTools/EventHandler.php', 'SwVtToolsEventHandler', "");
break;
}
}
示例4: array
$field->uitype = 1;
$field->typeofdata = 'V~O';
$field->readonly = '0';
$field->displaytype = '5';
$field->masseditable = '0';
$field->quickcreate = '0';
$field->columntype = 'VARCHAR(5)';
$field->defaultvalue = 0;
$usersBlockInstance->addField($field);
echo '<br> Added isOwner field in Users';
}
//Setting up is_owner for every admin user of CRM
$adb = PearDatabase::getInstance();
$idResult = $adb->pquery('SELECT id FROM vtiger_users WHERE is_admin = ? AND status=?', array('on', 'Active'));
if ($adb->num_rows($idResult) > 0) {
for ($i = 0; $i <= $adb->num_rows($idResult); $i++) {
$userid = $adb->query_result($idResult, $i, 'id');
$adb->pquery('UPDATE vtiger_users SET is_owner=? WHERE id=?', array(1, $userid));
echo '<br>Account Owner Informnation saved in vtiger';
//Recreate user prvileges
createUserPrivilegesfile($userId);
echo '<br>User previleges file recreated aftter adding is_owner field';
}
} else {
echo '<br>Account Owner was not existed in this database';
}
//Reports Chart Supported
Migration_Index_View::ExecuteQuery("CREATE TABLE IF NOT EXISTS vtiger_reporttype(\n reportid INT(10),\n data text,\n\t\t\t\t\t\tPRIMARY KEY (`reportid`),\n\t\t\t\t\t\tCONSTRAINT `fk_1_vtiger_reporttype` FOREIGN KEY (`reportid`) REFERENCES `vtiger_report` (`reportid`) ON DELETE CASCADE)\n ENGINE=InnoDB DEFAULT CHARSET=utf8;", array());
//Configuration Editor fix
$sql = "UPDATE vtiger_settings_field SET name = ? WHERE name = ?";
Migration_Index_View::ExecuteQuery($sql, array('LBL_CONFIG_EDITOR', 'Configuration Editor'));
示例5: vtlib_RecreateUserPrivilegeFiles
/**
* Recreate user privileges files.
*/
function vtlib_RecreateUserPrivilegeFiles()
{
$adb = PearDatabase::getInstance();
$userres = $adb->query('SELECT id FROM vtiger_users WHERE deleted = 0');
if ($userres && $adb->num_rows($userres)) {
while ($userrow = $adb->fetch_array($userres)) {
createUserPrivilegesfile($userrow['id']);
}
}
}
示例6: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
if ($this->mode != 'edit') {
$sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
$result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
if ($adb->num_rows($result) > 0) {
Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
return false;
}
}
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例7: create_default_users_access
//.........这里部分代码省略.........
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",18,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",7,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",6,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",4,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",2,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",13,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",14,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile3_id . ",18,10,0)");
//Inserting into vtiger_profile2utility Guest Profile Read-Only
//Import Export BusinessCar Not Allowed.
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",8,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,8,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,8,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,8,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,8,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,9,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,5,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,6,1)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",7,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",6,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",4,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",2,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",13,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",14,10,0)");
$adb->query("insert into vtiger_profile2utility values (" . $profile4_id . ",18,10,0)");
// Invalidate any cached information
VTCacheUtils::clearRoleSubordinates();
// create default admin user
$user = new Users();
$user->column_fields["last_name"] = 'Administrator';
$user->column_fields["user_name"] = 'admin';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'on';
$user->column_fields["user_password"] = $admin_password;
$user->column_fields["tz"] = 'Europe/Berlin';
$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = 'yyyy-mm-dd';
$user->column_fields["hour_format"] = 'am/pm';
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
//added by philip for default admin emailid
if ($admin_email == '') {
$admin_email = "admin@vtigeruser.com";
}
$user->column_fields["email1"] = $admin_email;
$role_query = "select roleid from vtiger_role where rolename='CEO'";
$adb->checkConnection();
$adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
$role_result = $adb->query($role_query);
$role_id = $adb->query_result($role_result, 0, "roleid");
$user->column_fields["roleid"] = $role_id;
$user->save("Users");
$admin_user_id = $user->id;
//Inserting into vtiger_groups table
$group1_id = $adb->getUniqueID("vtiger_users");
$group2_id = $adb->getUniqueID("vtiger_users");
$group3_id = $adb->getUniqueID("vtiger_users");
$adb->query("insert into vtiger_groups values ('" . $group1_id . "','Team Selling','Group Related to Sales')");
$adb->query("insert into vtiger_group2role values ('" . $group1_id . "','H" . $role4_id . "')");
$adb->query("insert into vtiger_group2rs values ('" . $group1_id . "','H" . $role5_id . "')");
$adb->query("insert into vtiger_groups values ('" . $group2_id . "','Marketing Group','Group Related to Marketing Activities')");
$adb->query("insert into vtiger_group2role values ('" . $group2_id . "','H" . $role2_id . "')");
$adb->query("insert into vtiger_group2rs values ('" . $group2_id . "','H" . $role3_id . "')");
$adb->query("insert into vtiger_groups values ('" . $group3_id . "','Support Group','Group Related to providing Support to Customers')");
$adb->query("insert into vtiger_group2role values ('" . $group3_id . "','H" . $role3_id . "')");
$adb->query("insert into vtiger_group2rs values ('" . $group3_id . "','H" . $role3_id . "')");
// Setting user group relation for admin user
$adb->pquery("insert into vtiger_users2group values (?,?)", array($group2_id, $admin_user_id));
//Creating the flat files for admin user
createUserPrivilegesfile($admin_user_id);
createUserSharingPrivilegesfile($admin_user_id);
//Insert into vtiger_profile2field
insertProfile2field($profile1_id);
insertProfile2field($profile2_id);
insertProfile2field($profile3_id);
insertProfile2field($profile4_id);
insert_def_org_field();
}
示例8: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
//Event triggering code
require_once "include/events/include.inc";
//In Bulk mode stop triggering events
if (!self::isBulkSaveMode()) {
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromCRMEntity($this);
$em->triggerEvent("vtiger.entity.beforesave.modifiable", $entityData);
$em->triggerEvent("vtiger.entity.beforesave", $entityData);
$em->triggerEvent("vtiger.entity.beforesave.final", $entityData);
}
if ($this->mode != 'edit') {
$sql = 'SELECT id FROM vtiger_users WHERE user_name = ? OR email1 = ?';
$result = $adb->pquery($sql, array($this->column_fields['user_name'], $this->column_fields['email1']));
if ($adb->num_rows($result) > 0) {
Vtiger_Functions::throwNewException('LBL_USER_EXISTS');
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_USER_EXISTS'));
return false;
}
} else {
$query = 'SELECT `roleid` FROM `vtiger_user2role` WHERE `userid` = ? LIMIT 1;';
$oldRoleResult = $adb->pquery($query, [$this->id]);
$oldRole = $adb->query_result($oldRoleResult, 0, 'roleid');
if ($oldRole != $this->column_fields['roleid']) {
$query = 'DELETE FROM `vtiger_module_dashboard_widgets` WHERE `userid` = ?;';
$adb->pquery($query, [$this->id]);
}
}
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
if ($em) {
//Event triggering code
$em->triggerEvent("vtiger.entity.aftersave", $entityData);
$em->triggerEvent("vtiger.entity.aftersave.final", $entityData);
//Event triggering code ends
}
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?", array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval, 0, 'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if (isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'], $this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例9: saveUserPreferences
public function saveUserPreferences($userPreferenceData)
{
$db = PearDatabase::getInstance();
$updateQuery = 'UPDATE vtiger_users SET ' . (implode('=?,', array_keys($userPreferenceData)) . '=?') . ' WHERE id = ?';
$updateQueryParams = array_values($userPreferenceData);
$updateQueryParams[] = $this->getId();
$db->pquery($updateQuery, $updateQueryParams);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
createUserPrivilegesfile($this->getId());
}
示例10: recalculate
/**
* Function recalculate the sharing rules
*/
public function recalculate()
{
$php_max_execution_time = vglobal('php_max_execution_time');
set_time_limit($php_max_execution_time);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
$userIdsList = $this->getUsersList();
if ($userIdsList) {
foreach ($userIdsList as $userId) {
createUserPrivilegesfile($userId);
}
}
}
示例11: values
$auditrecord = $record;
}
$date_var = $adb->formatDate(date('Y-m-d H:i:s'), true);
$query = "insert into vtiger_audit_trial values(?,?,?,?,?,?)";
$params = array($adb->getUniqueID('vtiger_audit_trial'), $focus->id, 'Users', 'Authenticate', '', $date_var);
$adb->pquery($query, $params);
}
// Recording the login info
$usip = $_SERVER['REMOTE_ADDR'];
$intime = date("Y/m/d H:i:s");
require_once 'modules/Users/LoginHistory.php';
$loghistory = new LoginHistory();
$Signin = $loghistory->user_login($focus->column_fields["user_name"], $usip, $intime);
//Security related entries start
require_once 'include/utils/UserInfoUtil.php';
createUserPrivilegesfile($focus->id);
//Security related entries end
session_unregister('login_password');
session_unregister('login_error');
session_unregister('login_user_name');
$_SESSION['authenticated_user_id'] = $focus->id;
$_SESSION['app_unique_key'] = $application_unique_key;
// store the user's theme in the session
if (isset($_REQUEST['login_theme'])) {
$authenticated_user_theme = $_REQUEST['login_theme'];
} elseif (isset($_REQUEST['ck_login_theme'])) {
$authenticated_user_theme = $_REQUEST['ck_login_theme'];
} else {
$authenticated_user_theme = $default_theme;
}
// store the user's language in the session
示例12: recalculate
/**
* Function to recalculate user priviliges files
* @param <Array> $oldUsersList
*/
public function recalculate($oldUsersList)
{
$php_max_execution_time = vglobal('php_max_execution_time');
set_time_limit($php_max_execution_time);
require_once 'modules/Users/CreateUserPrivilegeFile.php';
$userIdsList = array();
foreach ($oldUsersList as $userId => $userRecordModel) {
$userIdsList[$userId] = $userId;
}
$this->members = null;
foreach ($this->getUsersList(true) as $userId => $userRecordModel) {
$userIdsList[$userId] = $userId;
}
foreach ($userIdsList as $userId) {
createUserPrivilegesfile($userId);
}
}
示例13: save
/** Function to save the user information into the database
* @param $module -- module name:: Type varchar
*
*/
function save($module_name) {
global $log, $adb;
//Save entity being called with the modulename as parameter
$this->saveentity($module_name);
// Added for Reminder Popup support
$query_prev_interval = $adb->pquery("SELECT reminder_interval from vtiger_users where id=?",
array($this->id));
$prev_reminder_interval = $adb->query_result($query_prev_interval,0,'reminder_interval');
//$focus->imagename = $image_upload_array['imagename'];
$this->saveHomeStuffOrder($this->id);
SaveTagCloudView($this->id);
// Added for Reminder Popup support
$this->resetReminderInterval($prev_reminder_interval);
//Creating the Privileges Flat File
if(isset($this->column_fields['roleid'])) {
updateUser2RoleMapping($this->column_fields['roleid'],$this->id);
}
//After adding new user, set the default activity types for new user
Vtiger_Util_Helper::setCalendarDefaultActivityTypesForUser($this->id);
require_once('modules/Users/CreateUserPrivilegeFile.php');
createUserPrivilegesfile($this->id);
createUserSharingPrivilegesfile($this->id);
}
示例14: vtlib_purify
<?php
/*************************************************************************************************
* Copyright 2016 JPL TSolucio, S.L. -- This file is a part of TSOLUCIO coreBOS Customizations.
* Licensed under the vtiger CRM Public License Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You can redistribute it and/or modify it
* under the terms of the License. JPL TSolucio, S.L. reserves all rights not expressly
* granted by the License. coreBOS distributed by JPL TSolucio S.L. is distributed in
* the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Unless required by
* applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing
* permissions and limitations under the License. You may obtain a copy of the License
* at <http://corebos.org/documentation/doku.php?id=en:devel:vpl11>
*************************************************************************************************
* Author : JPL TSolucio, S. L.
*************************************************************************************************/
include 'modules/Users/CreateUserPrivilegeFile.php';
$record = vtlib_purify($_REQUEST['record']);
if (!empty($record)) {
createUserPrivilegesfile($record);
createUserSharingPrivilegesfile($record);
}
header("Location: index.php?action=DetailView&module=Users&record=" . $record);
示例15: createDefaultUsersAccess
//.........这里部分代码省略.........
//Import Export BusinessCar Not Allowed.
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",8,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,8,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,9,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,5,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,6,1)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",7,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",6,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",4,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",2,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",13,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",14,10,0)", array());
$adb->pquery("INSERT INTO vtiger_profile2utility VALUES (" . $profileId4 . ",18,10,0)", array());
// Invalidate any cached information
VTCacheUtils::clearRoleSubordinates();
$adminPassword = $_SESSION['config_file_info']['password'];
$userDateFormat = $_SESSION['config_file_info']['dateformat'];
$userTimeZone = $_SESSION['config_file_info']['timezone'];
//Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
$userFirstName = $_SESSION['config_file_info']['firstname'];
$userLastName = $_SESSION['config_file_info']['lastname'];
// create default admin user
$user = CRMEntity::getInstance('Users');
//Fix for http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7974
$user->column_fields["first_name"] = $userFirstName;
$user->column_fields["last_name"] = $userLastName;
//Ends
$user->column_fields["user_name"] = 'admin';
$user->column_fields["status"] = 'Active';
$user->column_fields["is_admin"] = 'on';
$user->column_fields["user_password"] = $adminPassword;
$user->column_fields["time_zone"] = $userTimeZone;
$user->column_fields["holidays"] = 'de,en_uk,fr,it,us,';
$user->column_fields["workdays"] = '0,1,2,3,4,5,6,';
$user->column_fields["weekstart"] = '1';
$user->column_fields["namedays"] = '';
$user->column_fields["currency_id"] = 1;
$user->column_fields["reminder_interval"] = '1 Minute';
$user->column_fields["reminder_next_time"] = date('Y-m-d H:i');
$user->column_fields["date_format"] = $userDateFormat;
$user->column_fields["hour_format"] = 'am/pm';
$user->column_fields["start_hour"] = '08:00';
$user->column_fields["end_hour"] = '23:00';
$user->column_fields["imagename"] = '';
$user->column_fields["internal_mailer"] = '1';
$user->column_fields["activity_view"] = 'This Week';
$user->column_fields["lead_view"] = 'Today';
$adminEmail = $_SESSION['config_file_info']['admin_email'];
if ($adminEmail == '') {
$adminEmail = "admin@vtigeruser.com";
}
$user->column_fields["email1"] = $adminEmail;
$roleQuery = "SELECT roleid FROM vtiger_role WHERE rolename='CEO'";
$adb->checkConnection();
$adb->database->SetFetchMode(ADODB_FETCH_ASSOC);
$roleResult = $adb->pquery($roleQuery, array());
$roleId = $adb->query_result($roleResult, 0, "roleid");
$user->column_fields["roleid"] = $roleId;
$user->save("Users");
$adminUserId = $user->id;
//Inserting into vtiger_groups table
$groupId1 = $adb->getUniqueID("vtiger_users");
$groupId2 = $adb->getUniqueID("vtiger_users");
$groupId3 = $adb->getUniqueID("vtiger_users");
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId1 . "','Team Selling','Group Related to Sales')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId1 . "','H" . $roleId4 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId1 . "','H" . $roleId5 . "')", array());
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId2 . "','Marketing Group','Group Related to Marketing Activities')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId2 . "','H" . $roleId2 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId2 . "','H" . $roleId3 . "')", array());
$adb->pquery("INSERT INTO vtiger_groups VALUES ('" . $groupId3 . "','Support Group','Group Related to providing Support to Customers')", array());
$adb->pquery("INSERT INTO vtiger_group2role VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
$adb->pquery("INSERT INTO vtiger_group2rs VALUES ('" . $groupId3 . "','H" . $roleId3 . "')", array());
// Setting user group relation for admin user
$adb->pquery("INSERT INTO vtiger_users2group VALUES (?,?)", array($groupId2, $adminUserId), array());
//Creating the flat files for admin user
createUserPrivilegesfile($adminUserId);
createUserSharingPrivilegesfile($adminUserId);
//INSERT INTO vtiger_profile2field
insertProfile2field($profileId1);
insertProfile2field($profileId2);
insertProfile2field($profileId3);
insertProfile2field($profileId4);
insert_def_org_field();
}