function addFatalMessage ($message, $extra="") {
global $FATAL;
- if (empty($extra)) {
- // Regular text message to add to $FATAL
- $FATAL[] = $message;
- } else {
+ if (is_array($extra)) {
+ // Multiple extras for a message with masks
+ $message = call_user_func_array('sprintf', $extra);
+ } elseif (!empty($extra)) {
// $message is text with a mask plus extras to insert into the text
$message = sprintf($message, $extra);
- $FATAL[] = $message;
}
+ // Add message to $FATAL
+ $FATAL[] = $message;
+
// Log fatal messages away
DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}");
}
$OUT .= "<tr>\n";
if (ereg('Y', $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._YEARS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_YEARS--}</strong></td>\n";
}
if (ereg("M", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._MONTHS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MONTHS--}</strong></td>\n";
}
if (ereg("W", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._WEEKS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_WEEKS--}</strong></td>\n";
}
if (ereg("D", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._DAYS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_DAYS--}</strong></td>\n";
}
if (ereg("h", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._HOURS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_HOURS--}</strong></td>\n";
}
if (ereg("m", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._MINUTES."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_MINUTES--}</strong></td>\n";
}
if (ereg("s", $display) || (empty($display))) {
- $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">"._SECONDS."</strong></td>\n";
+ $OUT .= " <td align=\"center\" class=\"admin_title bottom\"><div class=\"tiny\">{--_SECONDS--}</strong></td>\n";
}
$OUT .= "</tr>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_ye\" size=\"1\">\n";
for ($idx = 0; $idx <= 10; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $Y) $OUT .= " selected default";
+ if ($idx == $Y) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
for ($idx = 0; $idx <= 11; $idx++)
{
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $M) $OUT .= " selected default";
+ if ($idx == $M) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_we\" size=\"1\">\n";
for ($idx = 0; $idx <= 4; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $W) $OUT .= " selected default";
+ if ($idx == $W) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_da\" size=\"1\">\n";
for ($idx = 0; $idx <= 31; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $D) $OUT .= " selected default";
+ if ($idx == $D) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_ho\" size=\"1\">\n";
for ($idx = 0; $idx <= 23; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $h) $OUT .= " selected default";
+ if ($idx == $h) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_mi\" size=\"1\">\n";
for ($idx = 0; $idx <= 59; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $m) $OUT .= " selected default";
+ if ($idx == $m) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
$OUT .= " <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_se\" size=\"1\">\n";
for ($idx = 0; $idx <= 59; $idx++) {
$OUT .= " <option class=\"mini_select\" value=\"".$idx."\"";
- if ($idx == $s) $OUT .= " selected default";
+ if ($idx == $s) $OUT .= " selected=\"selected\"";
$OUT .= ">".$idx."</option>\n";
}
$OUT .= " </select></td>\n";
// Return calculated value
return $ret;
}
+
// Sends out mail to all administrators
// IMPORTANT: Please use SEND_ADMIN_NOTIFCATION() for now!
-function SEND_ADMIN_EMAILS_PRO($subj, $template, $content, $UID) {
+function SEND_ADMIN_EMAILS_PRO ($subj, $template, $content, $UID) {
// Trim template name
$template = trim($template);
$aids = array();
while (list($aid) = SQL_FETCHROW($result)) {
$aids[] = $aid;
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
+ // Init result
+ $result = false;
+
// "implode" IDs and query string
$aid = implode(",", $aids);
if ($aid == "-1") {
- // Add line to userlog
- USERLOG_ADD_LINE($subj, $msg, $UID);
- return;
+ if (EXT_IS_ACTIVE("events")) {
+ // Add line to user events
+ EVENTS_ADD_LINE($subj, $msg, $UID);
+ } else {
+ // Log error for debug
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Extension 'events' missing: tpl=%s,subj=%s,UID=%s",
+ $template,
+ $subj,
+ $UID
+ ));
+ }
} elseif ($aid == "0") {
// Select all email adresses
$result = SQL_QUERY("SELECT email FROM `{!_MYSQL_PREFIX!}_admins` ORDER BY `id`", __FILE__, __LINE__);
// Load email addresses and send away
while (list($email) = SQL_FETCHROW($result)) {
SEND_EMAIL($email, $subj, $msg);
- }
+ } // END - while
// Free memory
SQL_FREERESULT($result);
}
// Generates a ***weak*** seed (taken from de.php.net/mt_srand)
-function make_seed () {
+function generateSeed () {
list($usec, $sec) = explode(" ", microtime());
return ((float)$sec + (float)$usec);
}
return $msg;
}
+// Checks wether the given extension is currently not installed
+// and redirects if so.
+function REDIRCT_ON_UNINSTALLED_EXTENSION ($ext_name) {
+ // Is the extension uninstalled/inactive?
+ if (!EXT_IS_ACTIVE($ext_name)) {
+ // Redirect to index
+ LOAD_URL("modules.php?module=index&msg=".constant('CODE_EXTENSION_PROBLEM')."&ext=".$ext_name);
+ } // END - if
+}
+
+// Generate a "link" for the given admin id (aid)
+function GENERATE_AID_LINK ($aid) {
+ // No assigned admin is default
+ $admin = "<div class=\"admin_note\">{--ADMIN_NO_ADMIN_ASSIGNED--}</div>";
+
+ // Zero? = Not assigned
+ if ($aid == "0") {
+ // Load admin's login
+ $login = GET_ADMIN_LOGIN($aid);
+ if ($login != "***") {
+ // Is the extension there?
+ if (EXT_IS_ACTIVE("admins")) {
+ // Admin found
+ $admin = "<a href=\"".ADMINS_CREATE_EMAIL_LINK(GET_ADMIN_EMAIL($aid))."\">".$login."</a>";
+ } else {
+ // Extension not found
+ $admin = sprintf(getMessage('EXTENSION_PROBLEM_NOT_INSTALLED'), "admins");
+ }
+ } else {
+ // Maybe deleted?
+ $admin = "<div class=\"admin_note\">".sprintf(getMessage('ADMIN_ID_404'), $aid)."</div>";
+ }
+ } // END - if
+
+ // Return result
+ return $admin;
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////