Exemple #1
0
/**
 *   Send approval message to user
 */
function user_EmailApproval($system, $recID, $tmp_password, $is_approvement)
{
    $mysqli = $system->get_mysqli();
    $dbowner_Email = user_getDbOwner($mysqli, 'ugr_eMail');
    $user = user_getById($mysqli, $recID);
    //find user
    if ($user) {
        $ugr_Name = $user['ugr_Name'];
        $ugr_FullName = $user['ugr_FirstName'] . ' ' . $user['ugr_LastName'];
        $ugr_Organisation = $user['ugr_Organisation'];
        $ugr_eMail = $user['ugr_eMail'];
        if ($is_approvement) {
            $email_text = "Your Heurist account registration has been approved.";
        } else {
            $email_text = "A new Heurist account has been created for you.";
        }
        //give them a pointer to the search page for the database
        $email_text .= "\n\nLogin to the database: " . HEURIST_DBNAME . " at " . HEURIST_BASE_URL . "?db=" . HEURIST_DBNAME . "\n" . "\n\nwith the username: "******" and password: "******"\n\nTo change your password go to Profile -> My User Info in the top right menu";
        }
        $email_text = $email_text . "\n\nWe recommend visiting http://HeuristNetwork.org and the online Help " . "pages, which provide comprehensive overviews and step-by-step instructions for using Heurist.";
        $email_title = 'User Registration: ' . $ugr_FullName . ' [' . $ugr_eMail . ']';
        $rv = sendEmail($ugr_eMail, $email_title, $email_text, "From: " . $dbowner_Email);
        if ($rv != 'ok') {
            $system->addError(HEURIST_SYSTEM_CONFIG, 'Error_Mail_Approvement', $rv);
        }
    } else {
        $system->addError(HEURIST_NOT_FOUND, 'User not found');
        return false;
    }
    return true;
}
Exemple #2
0
 /**
  * Returns all info for current user and some sys config parameters
  */
 public function getCurrentUserAndSysInfo()
 {
     $user = $this->current_User;
     if ($user) {
         $user['ugr_Password'] = '';
         // do not send password to client side
         $user['ugr_Admin'] = $this->is_admin();
         $user['ugr_DbOwner'] = $this->is_dbowner();
         if (!@$user['ugr_Preferences']) {
             $user['ugr_Preferences'] = user_getDefaultPreferences();
         }
     }
     if ($this->mysqli && defined('HEURIST_DBNAME')) {
         $dbowner = user_getDbOwner($this->mysqli);
         $dbrecent = array();
         if (@$user['ugr_ID'] > 0) {
             foreach ($_SESSION as $db => $session) {
                 $user_id = @$_SESSION[$db]['ugr_ID'] ? $_SESSION[$db]['ugr_ID'] : @$_SESSION[$db . '.heurist']['user_id'];
                 if ($user_id == $user['ugr_ID']) {
                     if (strpos($db, HEURIST_DB_PREFIX) === 0) {
                         $db = substr($db, strlen(HEURIST_DB_PREFIX));
                     }
                     array_push($dbrecent, $db);
                 }
             }
         }
         $res = array("currentUser" => $user, "sysinfo" => array("registration_allowed" => $this->get_system('sys_AllowRegistration'), "db_registeredid" => $this->get_system('sys_dbRegisteredID'), "help" => HEURIST_HELP, "version" => HEURIST_VERSION, "dbowner_name" => @$dbowner['ugr_FirstName'] . ' ' . @$dbowner['ugr_LastName'], "dbowner_email" => @$dbowner['ugr_eMail'], "sysadmin_email" => HEURIST_MAIL_TO_ADMIN, "db_total_records" => $this->get_system('sys_RecordCount'), "db_usergroups" => user_getAllWorkgroups($this->mysqli), "basePathV3" => HEURIST_BASE_URL, "dbconst" => $this->getLocalConstants(), "dbrecent" => $dbrecent, 'max_post_size' => $this->_get_config_bytes(ini_get('post_max_size')), 'max_file_size' => $this->_get_config_bytes(ini_get('upload_max_filesize'))));
     } else {
         $res = array("currentUser" => null, "sysinfo" => array("help" => HEURIST_HELP, "version" => HEURIST_VERSION, "sysadmin_email" => HEURIST_MAIL_TO_ADMIN, "basePathV3" => HEURIST_BASE_URL));
     }
     return $res;
 }