function process(Vtiger_Request $request)
 {
     $currentUserModel = Users_Record_Model::getCurrentUserModel();
     $baseUserId = $currentUserModel->getId();
     $userId = $request->get('id');
     $user = new Users();
     $currentUser = $user->retrieveCurrentUserInfoFromFile($userId);
     $name = $currentUserModel->getName();
     $userName = $currentUser->column_fields['user_name'];
     Vtiger_Session::set('AUTHUSERID', $userId);
     Vtiger_Session::set('authenticated_user_id', $userId);
     Vtiger_Session::set('user_name', $userName);
     Vtiger_Session::set('full_user_name', $name);
     $status = 'Switched';
     if (Vtiger_Session::get('baseUserId') == '') {
         Vtiger_Session::set('baseUserId', $baseUserId);
         $status = 'Signed in';
     } elseif ($userId == Vtiger_Session::get('baseUserId')) {
         $baseUserId = $userId;
         Vtiger_Session::set('baseUserId', '');
         $status = 'Signed out';
     } else {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     $dbLog = PearDatabase::getInstance('log');
     $dbLog->insert('l_yf_switch_users', ['baseid' => $baseUserId, 'destid' => $userId, 'busername' => $currentUserModel->getName(), 'dusername' => $name, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'agent' => $_SERVER['HTTP_USER_AGENT'], 'status' => $status]);
     header('Location: index.php');
 }
Exemple #2
0
 public static function getActiveLayout()
 {
     $layout = Vtiger_Session::get('layout');
     if (!empty($layout)) {
         return $layout;
     }
     return vglobal('defaultLayout');
 }
Exemple #3
0
 public static function getActiveLayout()
 {
     $layout = Vtiger_Session::get('layout');
     if (!empty($layout)) {
         return $layout;
     }
     return AppConfig::main('defaultLayout');
 }
Exemple #4
0
 public function __construct($message = null, $code = 0)
 {
     parent::__construct($message, $code);
     Vtiger_Session::init();
     $request = new Vtiger_Request($_REQUEST);
     $dbLog = PearDatabase::getInstance('log');
     $userName = Vtiger_Session::get('full_user_name');
     $dbLog->insert('o_yf_access_for_api', ['username' => empty($userName) ? '-' : $userName, 'date' => date('Y-m-d H:i:s'), 'ip' => Vtiger_Functions::getRemoteIP(), 'url' => Vtiger_Functions::getBrowserInfo()->url, 'agent' => $_SERVER['HTTP_USER_AGENT'], 'request' => json_encode($_REQUEST)]);
 }
Exemple #5
0
 /**
  * Function to get the list of Header Links
  * @return <Array> - List of Vtiger_Link_Model instances
  */
 function getHeaderLinks()
 {
     $userModel = Users_Record_Model::getCurrentUserModel();
     $headerLinks = [];
     $userPersonalSettingsLinks = ['linktype' => 'HEADERLINK', 'linklabel' => $userModel->getDisplayName(), 'linkurl' => '', 'linkicon' => ''];
     if (SysSecurity::getBoolean('SHOW_MY_PREFERENCES')) {
         $userPersonalSettingsLinks['childlinks'][] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'linkicon' => ''];
     }
     $userPersonalSettingsLinks['childlinks'][] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => '?module=Users&parent=Settings&action=Logout', 'linkicon' => ''];
     array_push($headerLinks, $userPersonalSettingsLinks);
     if ($userModel->isAdminUser()) {
         $crmSettingsLink = array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => '', 'linkicon' => 'setting.png', 'nocaret' => true, 'childlinks' => array(array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => '?module=Vtiger&parent=Settings&view=Index', 'linkicon' => ''), array('linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MANAGE_USERS', 'linkurl' => '?module=Users&parent=Settings&view=List', 'linkicon' => '')));
         array_push($headerLinks, $crmSettingsLink);
     }
     require 'user_privileges/switchUsers.php';
     $baseUserId = $userModel->getId();
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     if (key_exists($baseUserId, $switchUsers)) {
         $childlinks = [];
         if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
             $user = new Users();
             $currentUser = $user->retrieveCurrentUserInfoFromFile($baseUserId);
             $userName = $currentUser->column_fields['first_name'] . ' ' . $currentUser->column_fields['last_name'];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $baseUserId, 'linkicon' => ''];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => NULL];
         }
         foreach ($switchUsers[$baseUserId] as $userid => $userName) {
             if ($userid != $baseUserId) {
                 $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $userid, 'linkicon' => ''];
             }
         }
         $customHeaderLinks = ['linktype' => 'HEADERLINK', 'linklabel' => 'SwitchUsers', 'linkurl' => '', 'linkicon' => 'glyphicon glyphicon-transfer', 'nocaret' => true, 'childlinks' => $childlinks];
         array_push($headerLinks, $customHeaderLinks);
     }
     $headerLinkInstances = [];
     $index = 0;
     foreach ($headerLinks as $headerLink) {
         $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink);
         if (isset($headerLink['childlinks'])) {
             foreach ($headerLink['childlinks'] as $childLink) {
                 $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink));
             }
         }
         $headerLinkInstances[$index++] = $headerLinkInstance;
     }
     $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, ['HEADERLINK']);
     foreach ($headerLinks as $headerType => $headerLinks) {
         foreach ($headerLinks as $headerLink) {
             $headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
         }
     }
     return $headerLinkInstances;
 }
Exemple #6
0
 /**
  * Function to get the instance of the logged in User
  * @return Users object
  */
 function getLogin()
 {
     $user = parent::getLogin();
     if (!$user) {
         $userid = Vtiger_Session::get('AUTHUSERID', $_SESSION['authenticated_user_id']);
         if ($userid) {
             $user = CRMEntity::getInstance('Users');
             $user->retrieveCurrentUserInfoFromFile($userid);
             $this->setLogin($user);
         }
     }
     return $user;
 }
 public function transferRecordsOwnership($module, $transferOwnerId, $relatedModuleRecordIds)
 {
     $currentUser = vglobal('current_user');
     $db = PearDatabase::getInstance();
     $db->update('vtiger_crmentity', ['smownerid' => $transferOwnerId, 'modifiedby' => $currentUser->id, 'modifiedtime' => date('Y-m-d H:i:s')], 'crmid IN (' . implode(',', $relatedModuleRecordIds) . ')');
     vimport('~modules/ModTracker/ModTracker.php');
     $flag = ModTracker::isTrackingEnabledForModule($module);
     if ($flag) {
         foreach ($relatedModuleRecordIds as $record) {
             $id = $db->getUniqueID('vtiger_modtracker_basic');
             $query = 'INSERT INTO vtiger_modtracker_basic ( id, whodid, whodidsu, changedon, crmid, module ) SELECT ? , ? , ?, ?, crmid, setype FROM vtiger_crmentity WHERE crmid = ?';
             $db->pquery($query, [$id, $currentUser->id, Vtiger_Session::get('baseUserId'), date('Y-m-d H:i:s', time()), $record]);
             $query = 'INSERT INTO vtiger_modtracker_detail ( id, fieldname, postvalue , prevalue ) SELECT ? , ? ,? , smownerid FROM vtiger_crmentity WHERE crmid = ?';
             $db->pquery($query, [$id, 'assigned_user_id', $currentUser->id, $record]);
         }
     }
 }
 /**
  * Function to get the instance of the logged in User
  * @return Users object
  */
 function getLogin()
 {
     $user = parent::getLogin();
     if (!$user) {
         // SalesPlatform.ru begin Session bugfix
         if ($_SESSION['app_unique_key'] == vglobal('application_unique_key')) {
             // SalesPlatform.ru end
             $userid = Vtiger_Session::get('AUTHUSERID', $_SESSION['authenticated_user_id']);
             if ($userid) {
                 $user = CRMEntity::getInstance('Users');
                 $user->retrieveCurrentUserInfoFromFile($userid);
                 $this->setLogin($user);
             }
             // SalesPlatform.ru begin
         }
         // SalesPlatform.ru end
     }
     return $user;
 }
Exemple #9
0
 public function process(Vtiger_Request $request)
 {
     $moduleName = $request->getModule();
     $users = Users_Module_Model::getSwitchUsers();
     $userId = $request->get('id');
     $baseUserId = $userId;
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     unset($users[$baseUserId]);
     unset($users[$userId]);
     $viewer = $this->getViewer($request);
     $viewer->assign('SWITCH_USERS', $users);
     $viewer->assign('MODULE_NAME', $moduleName);
     $viewer->assign('BASE_USER_ID', $baseUserId);
     $this->preProcess($request);
     $viewer->view('SwitchUsers.tpl', $moduleName);
     $this->postProcess($request);
 }
 function handleEvent($eventName, $data)
 {
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $log = vglobal('log');
     $current_module = vglobal('current_module');
     if (!is_object($data)) {
         $extendedData = $data;
         $data = $extendedData['entityData'];
     }
     $moduleName = $data->getModuleName();
     $flag = ModTracker::isTrackingEnabledForModule($moduleName);
     if ($flag) {
         if ($eventName == 'vtiger.entity.aftersave.final') {
             $recordId = $data->getId();
             $columnFields = $data->getData();
             $vtEntityDelta = new VTEntityDelta();
             $delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
             $newerEntity = $vtEntityDelta->getNewEntity($moduleName, $recordId);
             $newerColumnFields = $newerEntity->getData();
             $newerColumnFields = array_change_key_case($newerColumnFields, CASE_LOWER);
             $delta = array_change_key_case($delta, CASE_LOWER);
             if (is_array($delta)) {
                 $inserted = false;
                 foreach ($delta as $fieldName => $values) {
                     if ($fieldName != 'modifiedtime') {
                         if (!$inserted) {
                             $checkRecordPresentResult = $adb->pquery('SELECT * FROM vtiger_modtracker_basic WHERE crmid = ?', array($recordId));
                             if (!$adb->num_rows($checkRecordPresentResult) && $data->isNew()) {
                                 $status = ModTracker::$CREATED;
                             } else {
                                 $status = ModTracker::$UPDATED;
                             }
                             $this->id = $adb->getUniqueId('vtiger_modtracker_basic');
                             $adb->insert('vtiger_modtracker_basic', ['id' => $this->id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => $newerColumnFields['modifiedtime'], 'status' => $status, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
                             $inserted = true;
                         }
                         $adb->pquery('INSERT INTO vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES(?,?,?,?)', array($this->id, $fieldName, $values['oldValue'], $values['currentValue']));
                     }
                 }
             }
             $isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
             if ($adb->num_rows($isMyRecord) > 0) {
                 $adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
             }
         }
         if ($eventName == 'vtiger.entity.beforedelete') {
             $recordId = $data->getId();
             $columnFields = $data->getData();
             $id = $adb->getUniqueId('vtiger_modtracker_basic');
             $adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$DELETED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
             $isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
             if ($adb->num_rows($isMyRecord) > 0) {
                 $adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
             }
         }
         if ($eventName == 'vtiger.entity.afterrestore') {
             $recordId = $data->getId();
             $columnFields = $data->getData();
             $id = $adb->getUniqueId('vtiger_modtracker_basic');
             $adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$RESTORED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
             $isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
             if ($adb->num_rows($isMyRecord) > 0) {
                 $adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
             }
         }
         if ($eventName == 'vtiger.entity.link.after') {
             ModTracker::linkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
         }
         if ($eventName == 'vtiger.entity.unlink.after') {
             ModTracker::unLinkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
         }
     }
 }
Exemple #11
0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 * ****************************************************************************** */
chdir(dirname(__FILE__) . '/../');
/**
 * Start the cron services configured.
 */
include_once 'include/Webservices/Relation.php';
include_once 'include/main/WebUI.php';
require_once 'vtlib/Vtiger/Cron.php';
require_once 'modules/Emails/mail.php';
Vtiger_Session::init();
if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi' || !empty(Vtiger_Session::get('authenticated_user_id')) && !empty(Vtiger_Session::get('app_unique_key')) && Vtiger_Session::get('app_unique_key') == vglobal('application_unique_key')) {
    $log = LoggerManager::getLogger('CRON');
    vglobal('log', $log);
    $cronTasks = false;
    if (isset($_REQUEST['service'])) {
        // Run specific service
        $cronTasks = [Vtiger_Cron::getInstance($_REQUEST['service'])];
    } else {
        // Run all service
        $cronTasks = Vtiger_Cron::listAllActiveInstances();
    }
    $cronStarts = date('Y-m-d H:i:s');
    //set global current user permissions
    $current_user = vglobal('current_user');
    $current_user = Users::getActiveAdminUser();
    echo sprintf('---------------  %s | Start CRON  ----------', date('Y-m-d H:i:s')) . PHP_EOL;
Exemple #12
0
 static function trackRelation($sourceModule, $sourceId, $targetModule, $targetId, $type)
 {
     $adb = PearDatabase::getInstance();
     $current_user = vglobal('current_user');
     $currentTime = date('Y-m-d H:i:s');
     $id = $adb->getUniqueId('vtiger_modtracker_basic');
     $adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $sourceId, 'module' => $sourceModule, 'whodid' => $current_user->id, 'changedon' => $currentTime, 'status' => $type, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
     $adb->insert('vtiger_modtracker_relations', ['id' => $id, 'targetmodule' => $targetModule, 'targetid' => $targetId, 'changedon' => $currentTime]);
     $isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $sourceId));
     if ($adb->num_rows($isMyRecord) > 0) {
         $adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($sourceId));
     }
 }
 /**
  * Function that returns current language
  * @return <String> -
  */
 public static function getLanguage()
 {
     if (vglobal('translated_language')) {
         $language = vglobal('translated_language');
     } elseif (Vtiger_Session::get('language') != '') {
         $language = Vtiger_Session::get('language');
     } else {
         $language = Users_Record_Model::getCurrentUserModel()->get('language');
     }
     $language = empty($language) ? vglobal('default_language') : $language;
     return $language;
 }
Exemple #14
0
	public static function addConvertToAccountRelation($sourceModule, $sourceId, $current_user)
	{
		$adb = PearDatabase::getInstance();
		$adb->insert('vtiger_modtracker_basic', [
			'id' => $adb->getUniqueId('vtiger_modtracker_basic'),
			'crmid' => $sourceId,
			'module' => $sourceModule,
			'whodid' => $current_user,
			'changedon' => date('Y-m-d H:i:s'),
			'status' => 6,
			'whodidsu' => Vtiger_Session::get('baseUserId'),
		]);
	}
Exemple #15
0
 /**
  * Function to get the list of Header Links
  * @return <Array> - List of Vtiger_Link_Model instances
  */
 public function getHeaderLinks(Vtiger_Request $request)
 {
     $userModel = Users_Record_Model::getCurrentUserModel();
     $headerLinks = [];
     if ($userModel->isAdminUser()) {
         if ($request->get('parent') != 'Settings') {
             $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SYSTEM_SETTINGS', 'linkurl' => 'index.php?module=Vtiger&parent=Settings&view=Index', 'glyphicon' => 'glyphicon glyphicon-cog'];
         } else {
             $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_USER_PANEL', 'linkurl' => 'index.php', 'glyphicon' => 'glyphicon glyphicon-user'];
         }
     }
     //TODO To remove in the future
     if (SysSecurity::getBoolean('SHOW_MY_PREFERENCES')) {
         $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'glyphicon' => 'glyphicon glyphicon-tasks'];
     }
     $headerLinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => 'index.php?module=Users&parent=Settings&action=Logout', 'glyphicon' => 'glyphicon glyphicon-off'];
     require 'user_privileges/switchUsers.php';
     $baseUserId = $userModel->getId();
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     if (key_exists($baseUserId, $switchUsers)) {
         $childlinks = [];
         if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
             $entityData = Vtiger_Functions::getEntityModuleInfo('Users');
             $user = new Users();
             $currentUser = $user->retrieveCurrentUserInfoFromFile($baseUserId);
             $colums = [];
             foreach (explode(',', $entityData['fieldname']) as $fieldname) {
                 $colums[] = $currentUser->column_fields[$fieldname];
             }
             $userName = implode(' ', $colums);
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $baseUserId, 'linkicon' => ''];
             $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => NULL];
         }
         foreach ($switchUsers[$baseUserId] as $userid => $userName) {
             if ($userid != $baseUserId) {
                 $childlinks[] = ['linktype' => 'HEADERLINK', 'linklabel' => $userName, 'linkurl' => '?module=Users&action=SwitchUsers&id=' . $userid, 'linkicon' => ''];
             }
         }
         $customHeaderLinks = ['linktype' => 'HEADERLINK', 'linklabel' => 'SwitchUsers', 'linkurl' => '', 'glyphicon' => 'glyphicon glyphicon-transfer', 'nocaret' => true, 'childlinks' => $childlinks];
         if (count($childlinks)) {
             array_push($headerLinks, $customHeaderLinks);
         }
     }
     $headerLinkInstances = [];
     foreach ($headerLinks as $headerLink) {
         $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink);
         if (isset($headerLink['childlinks'])) {
             foreach ($headerLink['childlinks'] as $childLink) {
                 $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink));
             }
         }
         $headerLinkInstances[] = $headerLinkInstance;
     }
     $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, ['HEADERLINK']);
     foreach ($headerLinks as $headerType => $headerLinks) {
         foreach ($headerLinks as $headerLink) {
             $headerLinkInstances[] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink);
         }
     }
     return $headerLinkInstances;
 }
Exemple #16
0
 public static function getSwitchUsers()
 {
     $userModel = Users_Record_Model::getCurrentUserModel();
     require 'user_privileges/switchUsers.php';
     $baseUserId = $userModel->getId();
     if (Vtiger_Session::has('baseUserId') && Vtiger_Session::get('baseUserId') != '') {
         $baseUserId = Vtiger_Session::get('baseUserId');
     }
     $users = [];
     if (array_key_exists($baseUserId, $switchUsers)) {
         foreach ($switchUsers[$baseUserId] as $userid => $userName) {
             $users[$userid] = $userName;
         }
         if (count($users) > 1) {
             return $users;
         }
     }
     return [];
 }
Exemple #17
0
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 * ****************************************************************************** */
chdir(dirname(__FILE__) . '/../');
/**
 * Start the cron services configured.
 */
include_once 'include/Webservices/Relation.php';
include_once 'include/main/WebUI.php';
require_once 'vtlib/Vtiger/Cron.php';
require_once 'modules/Emails/mail.php';
Vtiger_Session::init();
$authenticatedUserId = Vtiger_Session::get('authenticated_user_id');
$appUniqueKey = Vtiger_Session::get('app_unique_key');
if (PHP_SAPI === 'cli' || PHP_SAPI === 'cgi-fcgi' || !empty($authenticatedUserId) && !empty($appUniqueKey) && $appUniqueKey == vglobal('application_unique_key')) {
    $log = LoggerManager::getLogger('CRON');
    vglobal('log', $log);
    $cronTasks = false;
    if (isset($_REQUEST['service'])) {
        // Run specific service
        $cronTasks = [Vtiger_Cron::getInstance($_REQUEST['service'])];
    } else {
        // Run all service
        $cronTasks = Vtiger_Cron::listAllActiveInstances();
    }
    $cronStarts = date('Y-m-d H:i:s');
    //set global current user permissions
    $current_user = vglobal('current_user');
    $current_user = Users::getActiveAdminUser();
 public static function setSessionQuery($currentModule, $query, $viewid)
 {
     if (Vtiger_Session::has($currentModule . '_listquery')) {
         if (Vtiger_Session::get($currentModule . '_listquery') != $query) {
             Vtiger_Session::remove($currentModule . '_DetailView_Navigation' . $viewid);
         }
     }
     Vtiger_Session::set($currentModule . '_listquery', $query);
 }