Exemplo n.º 1
0
/**
 *   Send approval message to user
 */
function sendApprovalEmail($recID, $tmp_password)
{
    $dbowner_Email = get_dbowner_email();
    if ($dbowner_Email) {
        //mysql_connection_overwrite(DATABASE);
        $query = "select * from " . DATABASE . ".sysUGrps where ugr_ID={$recID}";
        $res = mysql_query($query);
        while ($row = mysql_fetch_assoc($res)) {
            $ugr_Name = $row['ugr_Name'];
            $ugr_FullName = $row['ugr_FirstName'] . ' ' . $row['ugr_LastName'];
            $ugr_Organisation = $row['ugr_Organisation'];
            $ugr_eMail = $row['ugr_eMail'];
            if ($tmp_password != null) {
                $email_text = "A new Heurist account has been created for you.";
            } else {
                $email_text = "Your Heurist account registration has been approved.";
            }
            if (HEURIST_DBNAME == 'H3Sandpit') {
                // If the registration was on the sandpit DB on main Heurist server, return to the project home page
                // We don't bother to test for the Heurist server on the assumption it is very unlikely that anyone else
                // will have or navigate to this database anywhere else
                $email_text .= "\n\nPlease go to: " . HEURIST_BASE_URL . "index.html with the username: "******"\n\nHeurist database: " . HEURIST_DBNAME . "\n" . "Login at: " . HEURIST_BASE_URL . "search/search.html?db=" . HEURIST_DBNAME . "\n" . "with the username: "******" and password: "******"\n\nTo change your password go to My Profile -> My User Info in the top right menu";
            }
            $email_text = $email_text . "\n\nWe recommend visiting the 'Take the Tour' section and also visiting the Help " . "function, which provides comprehensive overviews and step-by-step instructions for using Heurist.";
            $rv = mail($ugr_eMail, 'Heurist User Registration: ' . $ugr_FullName . ' [' . $ugr_eMail . ']', $email_text, "From: " . $dbowner_Email . "\r\nCc: " . $dbowner_Email);
            if (!$rv) {
                //TODO  SAW this should not fail silently
                error_log("mail send failed: " . $ugr_eMail);
            }
        }
    }
}
    } else {
        // core database record created OK
        $dbID = mysql_insert_id();
        $returnData = $dbID;
        //Write the database title into the details, further data will be entered by the Heurist form
        $res = mysql_query("insert into recDetails (dtl_RecID,dtl_DetailTypeID,dtl_Value) VALUES ('{$dbID}', " . DT_NAME . ", '" . mysql_real_escape_string($dbTitle) . "')");
        //Write db version as detail
        if ($dbVersion) {
            $update = "insert into recDetails (dtl_RecID,dtl_DetailTypeID,dtl_Value) VALUES ('{$dbID}', 335, '{$dbVersion}')";
            $res = mysql_query($update);
        }
        // Write the record bookmark into the bookmarks table. This allos the user registering the database
        // to see thir lsit of databases as My Bookmarks
        $res = mysql_query("insert into usrBookmarks\n            (bkm_UGrpID,bkm_RecID) VALUES ('{$indexdb_user_id}','{$dbID}')");
        //send email to administrator about new database registration
        $email_text = "There is a new Heurist database registration on the Heurist Master Index\n\n" . "Database Title:     " . htmlentities($dbTitle) . "\n" . "Registration ID:    " . $dbID . "\n" . "DB Format Version:  " . $dbVersion . "\n\n" . "Go to the address below to review the database:\n" . $serverURL;
        $dbowner_Email = get_dbowner_email();
        $email_title = 'Database registration ID: ' . $dbID . '. User [' . $indexdb_user_id . ']';
        sendEmail($dbowner_Email, $email_title, $email_text, null);
        //END email -----------------------------------
    }
} else {
    // existing registration - used to update title, but this is now handled by metadata edit form
    // This should now not be called any more
    // just incase there was a problem let's return the id.
    $dbID = mysql_fetch_assoc($res);
    if (@$dbID && array_key_exists("rec_ID", $dbID)) {
        $returnData = $dbID["rec_ID"];
    }
}
echo $returnData;
Exemplo n.º 3
0
/**
*   Send approval message to user
*/
function sendApprovalEmail($recID, $tmp_password)
{
    $dbowner_Email = get_dbowner_email();
    if ($dbowner_Email) {
        //mysql_connection_overwrite(DATABASE);
        $query = "select * from " . DATABASE . ".sysUGrps where ugr_ID={$recID}";
        $res = mysql_query($query);
        while ($row = mysql_fetch_assoc($res)) {
            $ugr_Name = $row['ugr_Name'];
            $ugr_FullName = $row['ugr_FirstName'] . ' ' . $row['ugr_LastName'];
            $ugr_Organisation = $row['ugr_Organisation'];
            $ugr_eMail = $row['ugr_eMail'];
            if ($tmp_password != null) {
                $email_text = "Welcome! A new Heurist account has been created for you";
            } else {
                $email_text = "Welcome! Your Heurist account registration has been approved";
            }
            $email_text .= "\n\nPlease open an existing database with " . HEURIST_BASE_URL . " or go to: " . HEURIST_BASE_URL . "admin/setup/dbcreate/createNewDB.php to create a new database Your 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 particularly the Learn menu 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 . ']';
            if (@$dbowner_Email) {
                sendEmail($ugr_eMail, $email_title, $email_text, "From: " . $dbowner_Email);
                sendEmail($dbowner_Email, $email_title, $email_text, "From: " . $dbowner_Email);
            } else {
            }
        }
    }
}