- attempted to fixed crashes with the custom session handler.

External SMTP library
 - added functionality to have Drupal not use the default PHP mail()
   function. For more info see: http://www.drupal.org/node.php?id=44
   Note: for this to work all modules that send mails should use the
   Drupal function to send mail:
     user_mail($mail, $subject, $message, $header);

Calendar
 - added an archive page which users can use to find archives instead of
   the good old block.

Miscellaneous
 - fixed a "random" offset bug on module.inc that occurred on Windows.

All of this needs more testing, and further suggestions are welcome.
4.0.x
Kjartan Mannes 2002-01-09 14:35:40 +00:00
parent c71e133958
commit 3b5c380611
4 changed files with 3083 additions and 3006 deletions

View File

@ -29,8 +29,8 @@ function module_list() {
while ($file = readdir($handle)) { while ($file = readdir($handle)) {
if (".module" == substr($file, -7)) { if (".module" == substr($file, -7)) {
$filename = substr($file, 0, -7); $filename = substr($file, 0, -7);
include "modules/$filename.module";
$list[$filename] = $filename; $list[$filename] = $filename;
include "modules/$filename.module";
} }
} }
closedir($handle); closedir($handle);

View File

@ -101,4 +101,65 @@ function calendar_block() {
return $block; return $block;
} }
function calendar_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = "<a href=\"module.php?mod=calendar\">archives</a>";
}
return $links ? $links : array();
}
function calendar_page() {
global $date, $theme, $op, $month, $year, $meta;
$theme->header();
switch ($op) {
case t("Show"):
global $edit;
$date = mktime(0, 0, 0, $edit[month], $edit[day], $edit[year]);
// Fall though
default:
global $edit;
$years = array(2001 => 2001, 2002 => 2002, 2003 => 2003, 2004 => 2004, 2005 => 2005);
$months = array("-", t("January"), t("February"), t("March"), t("April"), t("May"), t("June"), t("July"), t("August"), t("September"), t("October"), t("November"), t("December"));
for ($i = 1; $i <= 31; $i++) $days[$i] = $i;
for ($i = 0; $i <= 23; $i++) $hours[$i] = $i < 10 ? "0$i" : $i;
for ($i = 0; $i <= 59; $i++) $minutes[$i] = $i < 10 ? "0$i" : $i;
if ($edit[start]) {
$edit[year] = date("Y", $edit[start]);
$edit[month] = date("m", $edit[start]);
$edit[day] = date("d", $edit[start]);
};
$start = str_replace("<b>:</b><br />", " ", form_select("", "year", ($edit[year] ? $edit[year] : date("Y")), $years) . form_select("", "month", ($edit[month] ? $edit[month] : date("m")), $months) . form_select("", "day", ($edit[day] ? $edit[day] : date("d")), $days) . form_submit(t("Show")));
$start = str_replace("<p>", "", $start);
$start = str_replace("</p>\n", " ", $start);
$start = str_replace("<option value=\"0\">-</option>", "", $start);
$form = $start;
$theme->box(t("Archives"), form($form));
if (user_access("access content")) {
// Fetch event nodes for the selected date, or current date if none selected.
$result = db_query("SELECT nid FROM node WHERE status = '1' AND created > ". ($date > 0 ? check_input($date) : time()) ." ORDER BY created LIMIT 30");
if($result){
while ($nid = db_fetch_object($result)) {
node_view(node_load(array("nid" => $nid->nid)), 1);
}
}
else {
$output .= t("Your search yielded no result.");
}
}
else {
$theme->box(t("Access denied"), message_access());
}
}
$theme->footer();
}
?> ?>

View File

@ -18,13 +18,15 @@ function sess_read($key) {
global $user; global $user;
$user = user_load(array("sid" => $key, "status" => 1)); $user = user_load(array("sid" => $key, "status" => 1));
return $user->session; return $user->session ? $user->session : '';
} }
function sess_write($key, $value) { function sess_write($key, $value) {
global $HTTP_SERVER_VARS; global $HTTP_SERVER_VARS;
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'"); db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'");
return '';
} }
function sess_destroy($key) { function sess_destroy($key) {
@ -214,8 +216,14 @@ function user_access($string) {
} }
function user_mail($mail, $subject, $message, $header) { function user_mail($mail, $subject, $message, $header) {
// print "<pre>subject: $subject<hr />header: $header<hr />$message</pre>"; print "<pre>subject: $subject<hr />header: $header<hr />$message</pre>";
if (variable_get("smtp_library", "") && file_exists(variable_get("smtp_library", ""))) {
include_once variable_get("smtp_library", "");
user_mail_wrapper($mail, $subject, $message, $header);
}
else {
mail($mail, $subject, $message, $header); mail($mail, $subject, $message, $header);
}
} }
function user_deny($type, $mask) { function user_deny($type, $mask) {

View File

@ -18,13 +18,15 @@ function sess_read($key) {
global $user; global $user;
$user = user_load(array("sid" => $key, "status" => 1)); $user = user_load(array("sid" => $key, "status" => 1));
return $user->session; return $user->session ? $user->session : '';
} }
function sess_write($key, $value) { function sess_write($key, $value) {
global $HTTP_SERVER_VARS; global $HTTP_SERVER_VARS;
db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'"); db_query("UPDATE users SET hostname = '". check_input($HTTP_SERVER_VARS[REMOTE_ADDR]) ."', session = '". check_query($value) ."', timestamp = '". time() ."' WHERE sid = '$key'");
return '';
} }
function sess_destroy($key) { function sess_destroy($key) {
@ -214,8 +216,14 @@ function user_access($string) {
} }
function user_mail($mail, $subject, $message, $header) { function user_mail($mail, $subject, $message, $header) {
// print "<pre>subject: $subject<hr />header: $header<hr />$message</pre>"; print "<pre>subject: $subject<hr />header: $header<hr />$message</pre>";
if (variable_get("smtp_library", "") && file_exists(variable_get("smtp_library", ""))) {
include_once variable_get("smtp_library", "");
user_mail_wrapper($mail, $subject, $message, $header);
}
else {
mail($mail, $subject, $message, $header); mail($mail, $subject, $message, $header);
}
} }
function user_deny($type, $mask) { function user_deny($type, $mask) {