/** * Event function for login * @param object $evctl */ public function eventLogin(EventControler $evctl) { $login_success = false; if ($evctl->user_name != '' && $evctl->user_password != '') { $qry = "\n\t\t\tselect * from " . $this->getTable() . " \n\t\t\twhere `user_name` = ? AND `password` = ?"; $this->query($qry, array($evctl->user_name, MD5($evctl->user_password))); if ($this->getNumRows() == 1) { $this->next(); // fetch the first row $iduser = $this->iduser; if ($this->is_active != 'Yes') { $_SESSION["do_crm_messages"]->set_message('error', _('The account is not active, please ask your admin to check this !')); } else { $login_success = true; } } elseif ($this->getNumRows() > 1) { $_SESSION["do_crm_messages"]->set_message('info', _('This is not your fault, you have entered correct login details but some other user has same login details, which is very unlikely. Please ask your admin to change the username or password. !')); } else { $_SESSION["do_crm_messages"]->set_message('error', _('Wrong login details !')); } } else { $_SESSION["do_crm_messages"]->set_message('error', _('Please enter a valid username and password !')); } if ($login_success === true) { $this->sessionPersistent("do_user", "logout.php", TTL_LONG); $this->set_user_crm_privileges(); $subordinate_users = $this->get_subordinate_users_by_iduser($iduser); $this->set_subordinate_users($subordinate_users); $do_mod_datashare_permission = new ModuleToDatashareRelation(); $this->set_module_data_share_permissions($do_mod_datashare_permission->get_all_datashare_permissions()); $dis = new Display($evctl->goto); //@see view/login_view if ((int) $evctl->sqrecord > 0) { $dis->addParam("sqrecord", (int) $evctl->sqrecord); } //do login audit $do_login_audit = new LoginAudit(); $do_login_audit->do_login_audit(); //load the global setting object if (!is_object($_SESSION["do_global_settings"])) { $do_global_settings = new CRMGlobalSettings(); $do_global_settings->sessionPersistent("do_global_settings", "logout.php", TTL); } //update the unseen feed to viewed = 1 on login $do_livefeed_display = new LiveFeedDisplay(); $do_livefeed_display->set_feed_viewed_onlogin($iduser); //finally do the re-direct $evctl->setDisplayNext($dis); } }
<?php // Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt /** * data sharing across modules * @author Abhik Chakraborty */ $mod_datashare_rel = new ModuleToDatashareRelation(); $datashare_permission = new DatasharePermission(); $datashare_permission->getAll(); $ds_permission_array = array(); while ($datashare_permission->next()) { $ds_permission_array[$datashare_permission->iddatashare_standard_permission] = $datashare_permission->permission_name; } ?> <div class="container-fluid"> <div class="row-fluid"> <?php include_once "modules/Settings/settings_leftmenu.php"; ?> <div class="span9" style="margin-left:3px;"> <div class="box_content"> <h3><?php echo _('Settings'); ?> > <a href="<?php echo NavigationControl::getNavigationLink($module, "datashare_details"); ?> "><?php echo _('Sharing Rules'); ?>