function sendEmailToAdministrators($subject, $body) { //Set headers for emails $headers = "From: quota_store\r\n"; //$headers .= "Reply-To: " . strip_tags($_POST['req-email']) . "\r\n"; //$headers .= "CC: susan@example.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $admin = user_array(eF_executeQuery("select * from users where login='******'")); //is fixed, the below lines must be removed. // This is just a temporary fix. $content = '<html>'; $content .= ' <body>'; $salutation = '<p>Dear ' . $admin['name'] . ' ' . $admin['surname'] . '</p>'; $footer = '<p><em>This is an automated message by the Quota Store.</em></p>'; $content .= $salutation . $body . $footer; $content .= ' </body>'; $content .= '</html>'; $myEmail = '*****@*****.**'; /* echo "about to send email to Dr. Sadjadi: " . $myEmail . PHP_EOL; echo "subject: " .PHP_EOL; var_dump($subject); echo "content: ".PHP_EOL; var_dump($content); echo "headers: ".PHP_EOL; var_dump($headers); mail($myEmail, $subject, $content, $headers); */ // TODO This fucntion does not return any admins. It needs to be fixed. $admins = db_getAdministrators_new(); foreach ($admins as $admin) { $content = '<html>'; $content .= ' <body>'; $salutation = '<p>Dear ' . $admin['name'] . ' ' . $admin['surname'] . '</p>'; $footer = '<p><em>This is an automated message by the Quota Store.</em></p>'; $content .= $salutation . $body . $footer; $content .= ' </body>'; $content .= '</html>'; /* echo "about to send email to admin: " . $admin['email'] .PHP_EOL; echo "subject: " .PHP_EOL; var_dump($subject); echo "content: ".PHP_EOL; var_dump($content); echo "headers: ".PHP_EOL; var_dump($headers); */ mail($admin['email'], $subject, $content, $headers); } }
function db_getUserTimeZone($userId) { //jh modified to use efront timezone info //jh original: $sql = "SELECT data FROM module_vlabs_user_info_data WHERE userid = ".$userId." and fieldid = 4"; $sql = "SELECT timezone FROM users WHERE login = '******'"; return user_array(eF_executeQuery($sql)); }
/** * Prints a table with access rights * * input is string as 'rw-rw-rw-' * names are same as used in get_access */ function show_access($db, $tableid, $id, $USER, $global_settings) { global $client; $table = get_cell($db, 'tableoftables', 'real_tablename', 'id', $tableid); if ($id) { $ra = $db->Execute("SELECT gr,gw,er,ew,ownerid FROM {$table} WHERE id='{$id}'"); if ($ra) { $gr = $ra->fields[0]; $gw = $ra->fields[1]; $er = $ra->fields[2]; $ew = $ra->fields[3]; $ownerid = $ra->fields[4]; } // $access=get_cell($db,$table,"access","id",$id); // $ownerid=get_cell($db,$table,"ownerid","id",$id); $groupid = get_cell($db, 'users', 'groupid', 'id', $ownerid); $group = get_cell($db, 'groups', 'name', 'id', $groupid); $rur = $db->Execute("SELECT trusteduserid FROM trust WHERE tableid='{$tableid}' AND recordid='{$id}' AND rw='r'"); while (!$rur->EOF) { $ur[] = $rur->fields('trusteduserid'); $rur->MoveNext(); } $ruw = $db->Execute("SELECT trusteduserid FROM trust WHERE tableid='{$tableid}' AND recordid='{$id}' AND rw='w'"); while (!$ruw->EOF) { $uw[] = $ruw->fields('trusteduserid'); $ruw->MoveNext(); } } else { $access = $global_settings['access']; // translate the $access string into our new format if ($access[3] == 'r') { $gr = 1; } if ($access[4] == 'w') { $gw = 1; } if ($access[6] == 'r') { $er = 1; } if ($access[7] == 'w') { $ew = 1; } $group = get_cell($db, 'groups', 'name', 'id', $USER['groupid']); } $user_array = user_array($db); echo "<table border=0>\n"; echo "<tr><th>Access:</th><th>{$group}</th><th>Everyone</th><th>and also</th></tr>\n"; echo "<tr><th>Read</th>\n"; if ($gr) { $sel = "checked"; } else { $sel = false; } echo "<td><input type='checkbox' {$sel} name='grr' value=' '></td>\n"; if ($er) { $sel = "checked"; } else { $sel = false; } echo "<td><input type='checkbox' {$sel} name='evr' value=' '></td>\n"; // multiple select box for trusted users. Opera does not like 1 as size if ($client->browser == "Opera" || $client->browser == "Internet Explorer") { $size = 2; } else { $size = 2; } echo "<td>\n<select multiple size='{$size}' name='trust_read[]'>\n"; echo "<option>nobody else</option>\n"; foreach ($user_array as $user) { if (@in_array($user["id"], $ur)) { $selected = "selected"; } else { $selected = false; } echo "<option {$selected} value=" . $user["id"] . ">" . $user["name"] . "</option>\n"; } echo "</select></td>\n"; echo "</tr>\n"; echo "<tr><th>Write</th>\n"; if ($gw) { $sel = "checked"; } else { $sel = false; } echo "<td><input type='checkbox' {$sel} name='grw' value=' '></td>\n"; if ($ew) { $sel = "checked"; } else { $sel = false; } echo "<td><input type='checkbox' {$sel} name='evw' value=' '></td>\n"; echo "<td>\n<select multiple size='{$size}' name='trust_write[]'>\n"; echo "<option>nobody else</option>\n"; foreach ($user_array as $user) { if (@in_array($user["id"], $uw)) { $selected = "selected"; } else { $selected = false; } echo "<option {$selected} value=" . $user["id"] . ">" . $user["name"] . "</option>\n"; } echo "</select></td>\n"; echo "</tr>\n"; echo "</table>\n"; }