2000-09-04 16:14:46 +00:00
|
|
|
<?
|
|
|
|
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
function id2story($id) {
|
|
|
|
### Perform query:
|
|
|
|
$result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.id = $id");
|
|
|
|
return db_fetch_object($result);
|
|
|
|
}
|
|
|
|
|
2000-10-04 10:25:08 +00:00
|
|
|
function load_theme() {
|
|
|
|
global $user, $themes;
|
|
|
|
|
|
|
|
if ($user->theme && file_exists($themes[$user->theme][0])) {
|
2000-12-14 14:20:06 +00:00
|
|
|
include_once $themes[$user->theme][0];
|
2000-10-04 10:25:08 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-12-14 14:20:06 +00:00
|
|
|
include_once $themes[key($themes)][0];
|
2000-10-04 10:25:08 +00:00
|
|
|
}
|
|
|
|
return new Theme();
|
|
|
|
}
|
|
|
|
|
2000-11-25 12:56:04 +00:00
|
|
|
function discussion_score($comment) {
|
|
|
|
$value = ($comment->votes) ? ($comment->score / $comment->votes) : (($comment->score) ? $comment->score : 0);
|
|
|
|
return (strpos($value, ".")) ? substr($value ."00", 0, 4) : $value .".00";
|
|
|
|
}
|
|
|
|
|
2000-10-24 07:24:24 +00:00
|
|
|
function check_field($message) {
|
2000-10-02 07:32:17 +00:00
|
|
|
return str_replace("\"", """, stripslashes($message));
|
2000-09-04 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
2000-10-24 07:24:24 +00:00
|
|
|
function check_input($message) {
|
2000-11-13 08:17:45 +00:00
|
|
|
global $allowed_html, $submission_size;
|
|
|
|
return strip_tags(addslashes(substr($message, 0, $submission_size)), $allowed_html);
|
2000-10-24 07:24:24 +00:00
|
|
|
}
|
|
|
|
|
2000-12-10 16:22:50 +00:00
|
|
|
function check_code($message) {
|
|
|
|
return $message;
|
|
|
|
}
|
|
|
|
|
2000-10-30 16:18:39 +00:00
|
|
|
function check_output($message, $nl2br = 0) {
|
2000-10-10 10:52:19 +00:00
|
|
|
global $allowed_html;
|
2000-10-30 16:18:39 +00:00
|
|
|
if ($nl2br == 1) return nl2br(strip_tags(stripslashes($message), $allowed_html));
|
|
|
|
else return strip_tags(stripslashes($message), $allowed_html);
|
2000-09-04 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function discussion_num_replies($id, $count = 0) {
|
|
|
|
$result = db_query("SELECT COUNT(cid) FROM comments WHERE pid = $id");
|
2000-10-19 13:31:23 +00:00
|
|
|
return ($result) ? db_result($result, 0) : 0;
|
2000-09-04 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
2000-10-24 07:24:24 +00:00
|
|
|
function discussion_num_filtered($sid, $pid) {
|
|
|
|
global $user;
|
2000-11-07 08:58:36 +00:00
|
|
|
|
2000-10-24 07:24:24 +00:00
|
|
|
$threshold = ($user->id) ? $user->threshold : "0";
|
2000-11-07 08:58:36 +00:00
|
|
|
$pid = ($pid) ? $pid : 0;
|
|
|
|
|
2000-10-24 07:24:24 +00:00
|
|
|
$result = db_query("SELECT COUNT(cid) FROM comments WHERE sid = $sid AND pid = $pid AND (votes != 0 AND score / votes < $threshold)");
|
|
|
|
return ($result) ? db_result($result, 0) : 0;
|
|
|
|
}
|
|
|
|
|
2000-11-07 08:58:36 +00:00
|
|
|
function format_plural($count, $singular, $plural) {
|
|
|
|
return ($count == 1) ? "$count $singular" : "$count $plural";
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
}
|
|
|
|
|
2000-12-16 08:39:01 +00:00
|
|
|
function format_interval($timestamp) {
|
2000-12-16 21:42:52 +00:00
|
|
|
if ($timestamp >= 86400) {
|
2000-12-16 08:39:01 +00:00
|
|
|
$output .= format_plural(floor($timestamp / 86400), "day ", "days ");
|
|
|
|
$timestamp = $timestamp % 86400;
|
|
|
|
}
|
2000-12-16 21:42:52 +00:00
|
|
|
if ($timestamp >= 3600) {
|
2000-12-16 08:39:01 +00:00
|
|
|
$output .= format_plural(floor($timestamp / 3600), "hour ", "hours ");
|
|
|
|
$timestamp = $timestamp % 3600;
|
|
|
|
}
|
2000-12-16 21:42:52 +00:00
|
|
|
if ($timestamp >= 60) {
|
2000-12-16 08:39:01 +00:00
|
|
|
$output .= floor($timestamp / 60) ." min ";
|
|
|
|
$timestamp = $timestamp % 60;
|
|
|
|
}
|
|
|
|
if ($timestamp > 0) {
|
2000-12-16 09:57:21 +00:00
|
|
|
$output .= "$timestamp sec";
|
2000-12-16 08:39:01 +00:00
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
function format_date($timestamp, $type = "medium") {
|
2000-10-30 16:18:39 +00:00
|
|
|
global $user;
|
|
|
|
|
|
|
|
$timestamp += ($user->timezone) ? $user->timezone - date("Z") : 0;
|
|
|
|
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
switch ($type) {
|
|
|
|
case "small":
|
|
|
|
$date = date("D, m/d/y - H:i", $timestamp);
|
|
|
|
break;
|
|
|
|
case "medium":
|
|
|
|
$date = date("l, m/d/Y - H:i", $timestamp);
|
|
|
|
break;
|
|
|
|
case "large":
|
|
|
|
$date = date("D, M d, Y - H:i", $timestamp);
|
|
|
|
break;
|
|
|
|
case "extra large":
|
|
|
|
$date = date("l, F dS, Y - H:i", $timestamp);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$date = date("D, M d, Y - H:i", $timestamp);
|
|
|
|
}
|
|
|
|
return $date;
|
|
|
|
}
|
|
|
|
|
2000-10-12 06:44:11 +00:00
|
|
|
function format_data($field, $replacement = "<I>na</I>") {
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
return ($field) ? $field : $replacement;
|
|
|
|
}
|
|
|
|
|
|
|
|
function format_username($username, $admin = 0) {
|
2000-12-14 14:20:06 +00:00
|
|
|
if ($username) return ($admin) ? "<A HREF=\"admin.php?mod=account&op=view&name=$username\">$username</A>" : "<A HREF=\"account.php?op=view&name=$username\">$username</A>";
|
2000-10-10 10:52:19 +00:00
|
|
|
else { global $anonymous; return $anonymous; }
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
}
|
|
|
|
|
2000-10-21 13:59:27 +00:00
|
|
|
function format_email($address) {
|
2000-09-28 12:34:44 +00:00
|
|
|
return ($address) ? "<A HREF=\"mailto:$address\">$address</A>" : format_data($address);
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function format_url($address, $description = "") {
|
|
|
|
// POSSIBLE EXTENSIONS:
|
|
|
|
// 1. add `http://' in case it's missing.
|
|
|
|
// 2. add a trailing `/' in case it's missing.
|
|
|
|
// 3. remove any parameters in the URI.
|
|
|
|
$description = ($description) ? $description : $address;
|
2000-09-28 12:34:44 +00:00
|
|
|
return ($address) ? "<A HREF=\"$address\">$description</A>" : format_data($address);
|
Over the last 2 days I redid and reorganized an afwul lot of code and
made quite a lot of additions. The most remarkable addition is the
diary server, which I slapped together in less then 40 minutes. Most
of the other changes are however `unvisible' for the user but add much
value to a better maintainability from a developer's objective. Like
always, I fixed quite a number of small bugs that creeped into the code
so we should have a bigger, better and more stable drop.org.
Unfortunatly, some theme update _are_ required:
REQUIRED THEME UPDATES:
=======================
* use format_username() where usernames are used
* use format_date() where timestamps/dates are used
* use format_email() where e-mail addresses are displayed
* use format_url() where url are displayed
* replace 'formatTimestamp' with format_date
* replace 'morelink_*' with 'display_morelink'
[most of these functions are in function.inc or template.inc]
___PLEASE___ (<- this should get your attention ;) update your themes
as soon as possible - it only takes 30 min. to get in sync with the
other themes. Don't start whining about the fact you don't know what
to change ... either eat the source cookie, or ask me to elaborate on
a few changes. Just let me know what's puzzling you and I'll try to
help you out!
TODO LIST FOR NEXT WEEK
=======================
* Add checks for max. text length in textarea's? Is there an HMTL
attribute for this or ...?
* Comment moderation + mojo
* Edit/admin user accounts: block, delete, change permissions, ...
* E-mail password, change password, change e-mail address -> extra
checks and routines to validate such `special' changes.
* Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|