Ejemplo n.º 1
0
 /**
  * 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);
     }
 }
Ejemplo n.º 2
0
<?php

// Copyright SQCRM. For licensing, reuse, modification and distribution see license.txt
/**
* live activity feed
* @author Abhik Chakraborty
*/
$do_feed_display = new LiveFeedDisplay();
if (isset($_REQUEST["livefeed"]) && $_REQUEST["livefeed"] == true) {
    $live_feed = $do_feed_display->load_live_feed();
    if (count($live_feed) > 0) {
        ?>
		<div class="notes_content">
			<?php 
        if (strlen($live_feed["avatar"]) > 3) {
            ?>
			<img src="<?php 
            echo $live_feed["avatar"];
            ?>
" style="width:20px;height:20px;" />
			<?php 
        } else {
            ?>
			<span class="add-on"><i class="icon-user"></i></span>
			<?php 
        }
        ?>
			<strong><?php 
        echo $live_feed["user_name"];
        ?>
</strong>