ate('Errors'); $context['sub_template'] = 'fatal_error'; } // We want whatever for the header, and a footer. (footer includes sub template!) obExit(null, true); /* DO NOT IGNORE: If you are creating a bridge to SMF or modifying this function, you MUST make ABSOLUTELY SURE that this function quits and DOES NOT RETURN TO NORMAL PROGRAM FLOW. Otherwise, security error messages will not be shown, and your forum will be in a very easily hackable state. */ trigger_error('Hacking attempt...', E_USER_ERROR); } // A fatal error with a message stored in the language file. function fatal_lang_error($error, $log = true, $sprintf = array()) { global $txt; // Load the language file... loadLanguage('Errors'); // Are we formatting anything? if (empty($sprintf)) fatal_error($txt[$error], $log); else fatal_error(vsprintf($txt[$error], $sprintf), $log); } // Handler for standard error messages. function error_handler($error_level, $error_string, $file, $line) { global $settings, $modSettings, $db_show_debug; // Ignore errors if we're ignoring them or they are strict notices from PHP 5 (which cannot be solved without breaking PHP 4.) if (error_reporting() == 0 || (defined('E_STRICT') && $error_level == E_STRICT && (empty($modSettings['enableErrorLogging']) || $modSettings['enableErrorLogging'] != 2))) return; if (strpos($file, 'eval()') !== false && !empty($settings['current_include_filename'])) { if (function_exists('debug_backtrace')) { $array = debug_backtrace(); for ($i = 0; $i < count($array); $i++) { if ($array[$i]['function'] != 'loadSubTemplate') continue; // This is a bug in PHP, with eval, it seems! if (empty($array[$i]['args'])) $i++; break; } if (isset($array[$i]) && !empty($array[$i]['args'])) $file = realpath($settings['current_include_filename']) . ' (' . $array[$i]['args'][0] . ' sub template - eval?)'; else $file = realpath($settings['current_include_filename']) . ' (eval?)'; } else $file = realpath($settings['current_include_filename']) . ' (eval?)'; } if (isset($db_show_debug) && $db_show_debug === true) { // Commonly, undefined indexes will occur inside attributes; try to show them anyway! if ($error_level % 255 != E_ERROR) { $temporary = ob_get_contents(); if (substr($temporary, -2) == '="') echo '"'; } // Debugging! This should look like a PHP error message. echo '
', $error_level % 255 == E_ERROR ? 'Error' : ($error_level % 255 == E_WARNING ? 'Warning' : 'Notice'), ': ', $error_string, ' in ', $file, ' on line ', $line, '
'; } $message = log_error($error_level . ': ' . $error_string, $file, $line); // Dying on these errors only causes MORE problems (blank pages!) if ($file == 'Unknown') return; // If this is an E_ERROR or E_USER_ERROR.... die. Violently so. if ($error_level % 255 == E_ERROR) obExit(false); else return; // If this is an E_ERROR, E_USER_ERROR, E_WARNING, or E_USER_WARNING.... die. Violently so. if ($error_level % 255 == E_ERROR || $error_level % 255 == E_WARNING) fatal_error(allowedTo('admin_forum') ? $message : $error_string, false); // We should NEVER get to this point. Any fatal error MUST quit, or very bad things can happen. if ($error_level % 255 == E_ERROR) die('Hacking attempt...'); } // Just wrap it so we don't take up time and space here in Errors.php. function db_fatal_error($loadavg = false) { global $sourcedir; // Just load the other file and run it. require_once($sourcedir . '/Subs-Auth.php'); show_db_error($loadavg); // Since we use "or db_fatal_error();" this is needed... return false; } ?> "post" || codeFix[i].className == "signature") && codeFix[i].offsetHeight < 20) codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + "px"; } }'; elseif ($context['browser']['is_firefox']) echo ' window.addEventListener("load", smf_codeFix, false); function smf_codeFix() { var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div"); for (var i = 0; i < codeFix.length; i++) { if (codeFix[i].className == "code" && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0)) codeFix[i].style.overflow = "scroll"; } }'; else echo ' var window_oldOnload = window.onload; window.onload = smf_codeFix; function smf_codeFix() { var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div"); for (var i = codeFix.length - 1; i > 0; i--) { if (codeFix[i].currentStyle.overflow == "auto" && (codeFix[i].currentStyle.height == "" || codeFix[i].currentStyle.height == "auto") && (codeFix[i].scrollWidth > codeFix[i].clientWidth || codeFix[i].clientWidth == 0) && (codeFix[i].offsetHeight != 0 || codeFix[i].className == "code")) codeFix[i].style.height = (codeFix[i].offsetHeight + 36) + "px"; } if (window_oldOnload) { window_oldOnload(); window_oldOnload = null; } }'; echo ' // ]]>'; } echo ' '; // The following will be used to let the user know that some AJAX process is running echo ' '; } // Show a linktree. This is that thing that shows "My Community | General Category | General Discussion".. function theme_linktree() { global $context, $settings, $options; echo ''; } // Show the menu up top. Something like [home] [help] [profile] [logout]... function template_menu() { global $context, $settings, $options, $scripturl, $txt; // Work out where we currently are. $current_action = 'home'; if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers'))) $current_action = 'admin'; if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm'))) $current_action = $context['current_action']; if ($context['current_action'] == 'search2') $current_action = 'search'; if ($context['current_action'] == 'theme') $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin'; // Are we using right-to-left orientation? if ($context['right_to_left']) { $first = 'last'; $last = 'first'; } else { $first = 'first'; $last = 'last'; } // Show the start of the tab section. echo ' '; // Show the [home] button. echo ($current_action=='home' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'home' ? '' : ''; // Show the [help] button. echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'help' ? '' : ''; // How about the [search] button? if ($context['allow_search']) echo ($current_action == 'search' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'search' ? '' : ''; // Is the user allowed to administrate at all? ([admin]) if ($context['allow_admin']) echo ($current_action == 'admin' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'admin' ? '' : ''; // Edit Profile... [profile] if ($context['allow_edit_profile']) echo ($current_action == 'profile' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'profile' ? '' : ''; // Go to PM center... [pm] if ($context['user']['is_logged'] && $context['allow_pm']) echo ($current_action == 'pm' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'pm' ? '' : ''; // The [calendar]! if ($context['allow_calendar']) echo ($current_action == 'calendar' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'calendar' ? '' : ''; // the [member] list button if ($context['allow_memberlist']) echo ($current_action == 'mlist' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'mlist' ? '' : ''; // If the user is a guest, show [login] button. if ($context['user']['is_guest']) echo ($current_action == 'login' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'login' ? '' : ''; // If the user is a guest, also show [register] button. if ($context['user']['is_guest']) echo ($current_action == 'register' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'register' ? '' : ''; // Otherwise, they might want to [logout]... if ($context['user']['is_logged']) echo ($current_action == 'logout' || $context['browser']['is_ie4']) ? '' : '' , ' ' , $current_action == 'logout' ? '' : ''; // The end of tab section. echo '
   ' , $txt[103] , '    ' , $txt[119] , '    ' , $txt[182] , '    ' , $txt[2] , '    ' , $txt[79] , '    ' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '['. $context['user']['unread_messages'] . ']' : '' , '    ' , $txt['calendar24'] , '    ' , $txt[331] , '    ' , $txt[34] , '    ' , $txt[97] , '    ' , $txt[108] , '   
'; } // Generate a strip of buttons. function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '') { global $settings, $buttons, $context, $txt, $scripturl; // Create the buttons... foreach ($button_strip as $key => $value) { if (isset($value['test']) && empty($context[$value['test']])) { unset($button_strip[$key]); continue; } elseif (!isset($buttons[$key]) || $force_reset) $buttons[$key] = '' . $txt[$value['text']] . ''; $button_strip[$key] = $buttons[$key]; } if (empty($button_strip)) return ' '; echo '   ', implode('  |  ', $button_strip) , '  '; } ?>e typing. Climbing the array might be slower, anyhow. $this_category = &$context['categories'][$row_board['ID_CAT']]['boards']; // This is a parent board. if (empty($row_board['ID_PARENT'])) { // Is this a new board, or just another moderator? if (!isset($this_category[$row_board['ID_BOARD']])) { // Not a child. $isChild = false; $this_category[$row_board['ID_BOARD']] = array( 'new' => empty($row_board['isRead']), 'id' => $row_board['ID_BOARD'], 'name' => $row_board['boardName'], 'description' => $row_board['description'], 'moderators' => array(), 'link_moderators' => array(), 'children' => array(), 'link_children' => array(), 'children_new' => false, 'topics' => $row_board['numTopics'], 'posts' => $row_board['numPosts'], 'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0', 'link' => '' . $row_board['boardName'] . '' ); } if (!empty($row_board['ID_MODERATOR'])) { $this_category[$row_board['ID_BOARD']]['moderators'][$row_board['ID_MODERATOR']] = array( 'id' => $row_board['ID_MODERATOR'], 'name' => $row_board['modRealName'], 'href' => $scripturl . '?action=profile;u=' . $row_board['ID_MODERATOR'], 'link' => '' . $row_board['modRealName'] . '' ); $this_category[$row_board['ID_BOARD']]['link_moderators'][] = '' . $row_board['modRealName'] . ''; } } // Found a child board.... make sure we've found its parent and the child hasn't been set already. elseif (isset($this_category[$row_board['ID_PARENT']]['children']) && !isset($this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']])) { // A valid child! $isChild = true; $this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']] = array( 'id' => $row_board['ID_BOARD'], 'name' => $row_board['boardName'], 'description' => $row_board['description'], 'new' => empty($row_board['isRead']) && $row_board['posterName'] != '', 'topics' => $row_board['numTopics'], 'posts' => $row_board['numPosts'], 'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0', 'link' => '' . $row_board['boardName'] . '' ); // Counting child board posts is... slow :/. if (!empty($modSettings['countChildPosts'])) { $this_category[$row_board['ID_PARENT']]['posts'] += $row_board['numPosts']; $this_category[$row_board['ID_PARENT']]['topics'] += $row_board['numTopics']; } // Does this board contain new boards? $this_category[$row_board['ID_PARENT']]['children_new'] |= empty($row_board['isRead']); // This is easier to use in many cases for the theme.... $this_category[$row_board['ID_PARENT']]['link_children'][] = &$this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['link']; } // Child of a child... just add it on... elseif (!empty($modSettings['countChildPosts'])) { if (!isset($parent_map)) $parent_map = array(); if (!isset($parent_map[$row_board['ID_PARENT']])) foreach ($this_category as $id => $board) { if (!isset($board['children'][$row_board['ID_PARENT']])) continue; $parent_map[$row_board['ID_PARENT']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]); $parent_map[$row_board['ID_BOARD']] = array(&$this_category[$id], &$this_category[$id]['children'][$row_board['ID_PARENT']]); break; } if (isset($parent_map[$row_board['ID_PARENT']])) { $parent_map[$row_board['ID_PARENT']][0]['posts'] += $row_board['numPosts']; $parent_map[$row_board['ID_PARENT']][0]['topics'] += $row_board['numTopics']; $parent_map[$row_board['ID_PARENT']][1]['posts'] += $row_board['numPosts']; $parent_map[$row_board['ID_PARENT']][1]['topics'] += $row_board['numTopics']; continue; } continue; } // Found a child of a child - skip. else continue; // Prepare the subject, and make sure it's not too long. censorText($row_board['subject']); $row_board['short_subject'] = shorten_subject($row_board['subject'], 24); $this_last_post = array( 'id' => $row_board['ID_MSG'], 'time' => $row_board['posterTime'] > 0 ? timeformat($row_board['posterTime']) : $txt[470], 'timestamp' => forum_time(true, $row_board['posterTime']), 'subject' => $row_board['short_subject'], 'member' => array( 'id' => $row_board['ID_MEMBER'], 'username' => $row_board['posterName'] != '' ? $row_board['posterName'] : $txt[470], 'name' => $row_board['realName'], 'href' => $row_board['posterName'] != '' && !empty($row_board['ID_MEMBER']) ? $scripturl . '?action=profile;u=' . $row_board['ID_MEMBER'] : '', 'link' => $row_board['posterName'] != '' ? (!empty($row_board['ID_MEMBER']) ? '' . $row_board['realName'] . '' : $row_board['realName']) : $txt[470], ), 'start' => 'msg' . $row_board['new_from'], 'topic' => $row_board['ID_TOPIC'] ); // Provide the href and link. if ($row_board['subject'] != '') { $this_last_post['href'] = $scripturl . '?topic=' . $row_board['ID_TOPIC'] . '.msg' . ($user_info['is_guest'] ? $modSettings['maxMsgID'] : $row_board['new_from']) . (empty($row_board['isRead']) ? ';boardseen' : '') . '#new'; $this_last_post['link'] = '' . $row_board['short_subject'] . ''; } else { $this_last_post['href'] = ''; $this_last_post['link'] = $txt[470]; } // Set the last post in the parent board. if (empty($row_board['ID_PARENT']) || ($isChild && !empty($row_board['posterTime']) && $this_category[$row_board['ID_PARENT']]['last_post']['timestamp'] < forum_time(true, $row_board['posterTime']))) $this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'] = $this_last_post; // Just in the child...? if ($isChild) { $this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['last_post'] = $this_last_post; // If there are no posts in this board, it really can't be new... $this_category[$row_board['ID_PARENT']]['children'][$row_board['ID_BOARD']]['new'] &= $row_board['posterName'] != ''; } // No last post for this board? It's not new then, is it..? elseif ($row_board['posterName'] == '') $this_category[$row_board['ID_BOARD']]['new'] = false; // Determine a global most recent topic. if (!empty($row_board['posterTime']) && forum_time(true, $row_board['posterTime']) > $most_recent_topic['timestamp']) $most_recent_topic = array( 'timestamp' => forum_time(true, $row_board['posterTime']), 'ref' => &$this_category[$isChild ? $row_board['ID_PARENT'] : $row_board['ID_BOARD']]['last_post'], ); } mysql_free_result($result_boards); // Load the users online right now. $result = db_query(" SELECT lo.ID_MEMBER, lo.logTime, mem.realName, mem.memberName, mem.showOnline, mg.onlineColor, mg.ID_GROUP, mg.groupName FROM {$db_prefix}log_online AS lo LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = lo.ID_MEMBER) LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))", __FILE__, __LINE__); $context['users_online'] = array(); $context['list_users_online'] = array(); $context['online_groups'] = array(); $context['num_guests'] = 0; $context['num_buddies'] = 0; $context['num_users_hidden'] = 0; $context['show_buddies'] = !empty($user_info['buddies']); while ($row = mysql_fetch_assoc($result)) { if (empty($row['realName'])) { $context['num_guests']++; continue; } elseif (empty($row['showOnline']) && !allowedTo('moderate_forum')) { $context['num_users_hidden']++; continue; } // Some basic color coding... if (!empty($row['onlineColor'])) $link = '' . $row['realName'] . ''; else $link = '' . $row['realName'] . ''; $is_buddy = in_array($row['ID_MEMBER'], $user_info['buddies']); if ($is_buddy) { $context['num_buddies']++; $link = '' . $link . ''; } $context['users_online'][$row['logTime'] . $row['memberName']] = array( 'id' => $row['ID_MEMBER'], 'username' => $row['memberName'], 'name' => $row['realName'], 'group' => $row['ID_GROUP'], 'href' => $scripturl . '?action=profile;u=' . $row['ID_MEMBER'], 'link' => $link, 'is_buddy' => $is_buddy, 'hidden' => empty($row['showOnline']), ); $context['list_users_online'][$row['logTime'] . $row['memberName']] = empty($row['showOnline']) ? '' . $link . '' : $link; if (!isset($context['online_groups'][$row['ID_GROUP']])) $context['online_groups'][$row['ID_GROUP']] = array( 'id' => $row['ID_GROUP'], 'name' => $row['groupName'], 'color' => $row['onlineColor'] ); } mysql_free_result($result); krsort($context['users_online']); krsort($context['list_users_online']); ksort($context['online_groups']); $context['num_users_online'] = count($context['users_online']) + $context['num_users_hidden']; // Track most online statistics? if (!empty($modSettings['trackStats'])) { // Determine the most users online - both all time and per day. $total_users = $context['num_guests'] + $context['num_users_online']; // More members on now than ever were? Update it! if (!isset($modSettings['mostOnline']) || $total_users >= $modSettings['mostOnline']) updateSettings(array('mostOnline' => $total_users, 'mostDate' => time())); $date = strftime('%Y-%m-%d', forum_time(false)); // One or more stats are not up-to-date? if (!isset($modSettings['mostOnlineUpdated']) || $modSettings['mostOnlineUpdated'] != $date) { $request = db_query(" SELECT mostOn FROM {$db_prefix}log_activity WHERE date = '$date' LIMIT 1", __FILE__, __LINE__); // The log_activity hasn't got an entry for today? if (mysql_num_rows($request) == 0) { db_query(" INSERT IGNORE INTO {$db_prefix}log_activity (date, mostOn) VALUES ('$date', $total_users)", __FILE__, __LINE__); } // There's an entry in log_activity on today... else { list ($modSettings['mostOnlineToday']) = mysql_fetch_row($request); if ($total_users > $modSettings['mostOnlineToday']) trackStats(array('mostOn' => $total_users)); $total_users = max($total_users, $modSettings['mostOnlineToday']); } mysql_free_result($request); updateSettings(array('mostOnlineUpdated' => $date, 'mostOnlineToday' => $total_users)); } // Highest number of users online today? elseif ($total_users > $modSettings['mostOnlineToday']) { trackStats(array('mostOn' => $total_users)); updateSettings(array('mostOnlineUpdated' => $date, 'mostOnlineToday' => $total_users)); } } // Set the latest member. $context['latest_member'] = &$context['common_stats']['latest_member']; // Load the most recent post? if ((!empty($settings['number_recent_posts']) && $settings['number_recent_posts'] == 1) || $settings['show_sp1_info']) $context['latest_post'] = $most_recent_topic['ref']; if (!empty($settings['number_recent_posts']) && $settings['number_recent_posts'] > 1) { require_once($sourcedir . '/Recent.php'); if (($context['latest_posts'] = cache_get_data('boardindex-latest_posts:' . md5($user_info['query_see_board'] . $user_info['language']), 180)) == null) { $context['latest_posts'] = getLastPosts($settings['number_recent_posts']); cache_put_data('boardindex-latest_posts:' . md5($user_info['query_see_board'] . $user_info['language']), $context['latest_posts'], 180); } // We have to clean up the cached data a bit. foreach ($context['latest_posts'] as $k => $post) { $context['latest_posts'][$k]['time'] = timeformat($post['raw_timestamp']); $context['latest_posts'][$k]['timestamp'] = forum_time(true, $post['raw_timestamp']); } } $settings['display_recent_bar'] = !empty($settings['number_recent_posts']) ? $settings['number_recent_posts'] : 0; $settings['show_member_bar'] &= allowedTo('view_mlist'); $context['show_stats'] = allowedTo('view_stats') && !empty($modSettings['trackStats']); $context['show_member_list'] = allowedTo('view_mlist'); $context['show_who'] = allowedTo('who_view') && !empty($modSettings['who_enabled']); // Set some permission related settings. $context['show_login_bar'] = $user_info['is_guest'] && !empty($modSettings['enableVBStyleLogin']); $context['show_calendar'] = allowedTo('calendar_view') && !empty($modSettings['cal_enabled']); // Load the calendar? if ($context['show_calendar']) $context['show_calendar'] = calendarDoIndex(); $context['page_title'] = $txt[18]; } // Called from the BoardIndex to display the current day's events on the board index. function calendarDoIndex() { global $modSettings, $context, $user_info, $scripturl, $sc, $ID_MEMBER; // Make sure at least one of the options is checked. if (empty($modSettings['cal_showeventsonindex']) && empty($modSettings['cal_showbdaysonindex']) && empty($modSettings['cal_showholidaysonindex'])) return false; // Get the current forum time and check whether the statistics are up to date. if (empty($modSettings['cal_today_updated']) || $modSettings['cal_today_updated'] != strftime('%Y%m%d', forum_time(false))) updateStats('calendar'); // Load the holidays for today, ... if (!empty($modSettings['cal_showholidaysonindex']) && isset($modSettings['cal_today_holiday'])) $holidays = unserialize($modSettings['cal_today_holiday']); // ... the birthdays for today, ... if (!empty($modSettings['cal_showbdaysonindex']) && isset($modSettings['cal_today_birthday'])) $bday = unserialize($modSettings['cal_today_birthday']); // ... and the events for today. if (!empty($modSettings['cal_showeventsonindex']) && isset($modSettings['cal_today_event'])) $events = unserialize($modSettings['cal_today_event']); // No events, birthdays, or holidays... don't show anything. Simple. if (empty($holidays) && empty($bday) && empty($events)) return false; // This shouldn't be less than one! if (empty($modSettings['cal_days_for_index']) || $modSettings['cal_days_for_index'] < 1) $days_for_index = 86400; else $days_for_index = $modSettings['cal_days_for_index'] * 86400; $context['calendar_only_today'] = $modSettings['cal_days_for_index'] == 1; // Get the current member time/date. $now = forum_time(); // This is used to show the "how-do-I-edit" help. $context['calendar_can_edit'] = allowedTo('calendar_edit_any'); // Holidays between now and now + days. $context['calendar_holidays'] = array(); for ($i = $now; $i < $now + $days_for_index; $i += 86400) { if (isset($holidays[strftime('%Y-%m-%d', $i)])) $context['calendar_holidays'] = array_merge($context['calendar_holidays'], $holidays[strftime('%Y-%m-%d', $i)]); } // Happy Birthday, guys and gals! $context['calendar_birthdays'] = array(); for ($i = $now; $i < $now + $days_for_index; $i += 86400) if (isset($bday[strftime('%Y-%m-%d', $i)])) { foreach ($bday[strftime('%Y-%m-%d', $i)] as $index => $dummy) $bday[strftime('%Y-%m-%d', $i)][$index]['is_today'] = strftime('%Y-%m-%d', $i) == strftime('%Y-%m-%d', forum_time()); $context['calendar_birthdays'] = array_merge($context['calendar_birthdays'], $bday[strftime('%Y-%m-%d', $i)]); } $context['calendar_events'] = array(); $duplicates = array(); for ($i = $now; $i < $now + $days_for_index; $i += 86400) { if (empty($events[strftime('%Y-%m-%d', $i)])) continue; foreach ($events[strftime('%Y-%m-%d', $i)] as $ev => $event) { if (empty($event['topic']) || (count(array_intersect($user_info['groups'], $event['allowed_groups'])) != 0 || allowedTo('admin_forum'))) { if (isset($duplicates[$events[strftime('%Y-%m-%d', $i)][$ev]['topic'] . $events[strftime('%Y-%m-%d', $i)][$ev]['title']])) { unset($events[strftime('%Y-%m-%d', $i)][$ev]); continue; } $this_event = &$events[strftime('%Y-%m-%d', $i)][$ev]; $this_event['href'] = $this_event['topic'] == 0 ? '' : $scripturl . '?topic=' . $this_event['topic'] . '.0'; $this_event['modify_href'] = $scripturl . '?action=' . ($this_event['topic'] == 0 ? 'calendar;sa=post;' : 'post;msg=' . $this_event['msg'] . ';topic=' . $this_event['topic'] . '.0;calendar;') . 'eventid=' . $this_event['id'] . ';sesc=' . $sc; $this_event['can_edit'] = allowedTo('calendar_edit_any') || ($this_event['poster'] == $ID_MEMBER && allowedTo('calendar_edit_own')); $this_event['is_today'] = (strftime('%Y-%m-%d', $i)) == strftime('%Y-%m-%d', forum_time()); $this_event['date'] = strftime('%Y-%m-%d', $i); $duplicates[$this_event['topic'] . $this_event['title']] = true; } else unset($events[strftime('%Y-%m-%d', $i)][$ev]); } if (!empty($events[strftime('%Y-%m-%d', $i)])) $context['calendar_events'] = array_merge($context['calendar_events'], $events[strftime('%Y-%m-%d', $i)]); } for ($i = 0, $n = count($context['calendar_birthdays']); $i < $n; $i++) $context['calendar_birthdays'][$i]['is_last'] = !isset($context['calendar_birthdays'][$i + 1]); for ($i = 0, $n = count($context['calendar_events']); $i < $n; $i++) $context['calendar_events'][$i]['is_last'] = !isset($context['calendar_events'][$i + 1]); // This is used to make sure the header should be displayed. return !empty($context['calendar_holidays']) || !empty($context['calendar_birthdays']) || !empty($context['calendar_events']); } ?>mber";s:5:"\d+";})$~', $row['extra'], $matches) === 1) db_query(" UPDATE {$db_prefix}log_actions SET extra = '$matches[1]" . strlen($matches[3]) . ":\"$matches[3]\"$matches[4]' WHERE ID_ACTION = $row[ID_ACTION] LIMIT 1", __FILE__, __LINE__); } mysql_free_result($request); // Refresh some serialized strings stored in the settings table. updateStats('calendar'); // The memberlist cache needs to be recalculated too. updateSettings(array('memberlist_updated' => time())); } ?> The Bloggers Forum - Index

The Bloggers Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

SMF - Just Installed!

General Category

No New Posts

General Discussion

Feel free to talk about anything and everything in this board.

48 Posts
44 Topics
Last post by rosasafes
in Re: A Short Story about ...
on July 10, 2010, 12:12:09 AM

* The Bloggers Forum - Info Center

Forum Stats

Forum Stats

48 Posts in 44 Topics by 678 Members. Latest Member: p15s6orv
Latest Post: "Re: A Short Story about ..." ( July 10, 2010, 12:12:09 AM )
View the most recent posts on the forum.
[More Stats]

Users Online

Users Online

2 Guests, 0 Users

Most Online Today: 8. Most Online Ever: 38 (March 23, 2010, 09:15:13 AM)

Login Forgot your password?

Login

ourcedir . '/BoardIndex.php'); return 'BoardIndex'; } // Otherwise, it was set - so let's go to that action. require_once($sourcedir . '/' . $actionArray[$_REQUEST['action']][0]); return $actionArray[$_REQUEST['action']][1]; } ?>