function obExit($header = null, $do_footer = null, $from_index = false, $from_fatal_error = false) { global $context, $settings, $modSettings, $txt, $smcFunc; static $header_done = false, $footer_done = false, $level = 0, $has_fatal_error = false; // Attempt to prevent a recursive loop. ++$level; if ($level > 1 && !$from_fatal_error && !$has_fatal_error) { exit; } if ($from_fatal_error) { $has_fatal_error = true; } // Clear out the stat cache. trackStats(); // If we have mail to send, send it. if (!empty($context['flush_mail'])) { AddMailQueue(true); } $do_header = $header === null ? !$header_done : $header; if ($do_footer === null) { $do_footer = $do_header; } // Has the template/header been done yet? if ($do_header) { // Was the page title set last minute? Also update the HTML safe one. if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) { $context['page_title_html_safe'] = $smcFunc['htmlspecialchars'](un_htmlspecialchars($context['page_title'])); } // Start up the session URL fixer. ob_start('ob_sessrewrite'); if (!empty($settings['output_buffers']) && is_string($settings['output_buffers'])) { $buffers = explode(',', $settings['output_buffers']); } elseif (!empty($settings['output_buffers'])) { $buffers = $settings['output_buffers']; } else { $buffers = array(); } if (isset($modSettings['integrate_buffer'])) { $buffers = array_merge(explode(',', $modSettings['integrate_buffer']), $buffers); } if (!empty($buffers)) { foreach ($buffers as $function) { $function = trim($function); $call = strpos($function, '::') !== false ? explode('::', $function) : $function; // Is it valid? if (is_callable($call)) { ob_start($call); } } } // Display the screen in the logical order. template_header(); $header_done = true; } if ($do_footer) { if (WIRELESS && !isset($context['sub_template'])) { fatal_lang_error('wireless_error_notyet', false); } // Just show the footer, then. loadSubTemplate(isset($context['sub_template']) ? $context['sub_template'] : 'main'); // Anything special to put out? if (!empty($context['insert_after_template']) && !isset($_REQUEST['xml'])) { echo $context['insert_after_template']; } // Just so we don't get caught in an endless loop of errors from the footer... if (!$footer_done) { $footer_done = true; template_footer(); // (since this is just debugging... it's okay that it's after </html>.) if (!isset($_REQUEST['xml'])) { db_debug_junk(); } } } // Remember this URL in case someone doesn't like sending HTTP_REFERER. if (strpos($_SERVER['REQUEST_URL'], 'action=dlattach') === false && strpos($_SERVER['REQUEST_URL'], 'action=viewsmfile') === false) { $_SESSION['old_url'] = $_SERVER['REQUEST_URL']; } // For session check verfication.... don't switch browsers... $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; if (!empty($settings['strict_doctype'])) { // The theme author wants to use the STRICT doctype (only God knows why). $temp = ob_get_contents(); if (function_exists('ob_clean')) { ob_clean(); } else { ob_end_clean(); ob_start('ob_sessrewrite'); } echo strtr($temp, array('var smf_iso_case_folding' => 'var target_blank = \'_blank\'; var smf_iso_case_folding', 'target="_blank"' => 'onclick="this.target=target_blank"')); } // Hand off the output to the portal, etc. we're integrated with. call_integration_hook('integrate_exit', array($do_footer && !WIRELESS)); // Don't exit if we're coming from index.php; that will pass through normally. if (!$from_index || WIRELESS) { exit; } }
<?php foreach ($pdo->conn->query("SELECT * FROM tbl_time WHERE date='" . date("Y-m-d") . "' ORDER by datetime DESC") as $value) { ?> <tr> <td><?php echo strtoupper($pdo->selectData('tbl_employee', 'name', array('id' => $value['employee_id']))); ?> </td> <td><?php echo $obj->normal_time($value['time_in']); ?> </td> <td><?php echo $obj->normal_time($value['time_out']); ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </div> <?php template_footer();
/** * show_log * * Actually show the log for this specific day * * @param PDO $db A PDO object referring to the database * * @return void * @author Eli White <*****@*****.**> **/ function show_log(PDO $db) { $channel = $_GET['w']; $day = $_GET['d']; $parts = explode('-', $day); $formatted_date = "{$parts[0]}-{$parts[1]}-{$parts[2]}"; // Begin the HTML page: template_header('Date: ' . utf8specialchars($formatted_date) . ' - Channel: ' . utf8specialchars($channel)); // Query the database to get all log lines for this date: $prepared = $db->prepare("select time(tstamp) as t, type, nick, message\n from logs\n where lower(chan) = :chan and date(tstamp) = :day\n order by tstamp asc"); $prepared->execute(array(':chan' => $channel, ':day' => $day)); // Loop through each line, foreach ($prepared as $row) { // Prepare some basic details for output: $color = nick_color($row['nick']); $time = utf8specialchars($row['t']); $msg = utf8specialchars($row['message']); $nick = utf8specialchars($row['nick']); $type = false; // Now change the format of the line based upon the type: switch ($row['type']) { case 4: // PRIVMSG (A Regular Message) echo "[{$time}] <span style=\"color:#{$color};\">" . "<{$nick}></span> {$msg}<br />\n"; break; case 5: // ACTION (emote) echo "[{$time}] <span style=\"color:#{$color};\">" . "*{$nick} {$msg}</span><br />\n"; break; case 1: // JOIN echo "[{$time}] -> {$nick} joined the room.<br />\n"; break; case 2: // PART (leaves channel) echo "[{$time}] -> {$nick} left the room: {$msg}<br />\n"; break; case 3: // QUIT (quits the server) echo "[{$time}] -> {$nick} left the server: {$msg}<br />\n"; break; case 6: // NICK (changes their nickname) echo "[{$time}] -> {$nick} is now known as: {$msg}<br />\n"; break; case 7: // KICK (booted) echo "[{$time}] -> {$nick} boots {$msg} from the room.<br />\n"; break; case 8: // MODE (changed their mode) $type = 'MODE'; case 9: // TOPIC (changed the topic) $type = $type ? $type : 'TOPIC'; echo "[{$time}] -> {$nick}: :{$type}: {$msg}<br />\n"; } } // Finish up the page: template_footer(); }
/** * show_log * * Actually show the log for this specific day * * @param PDO $db A PDO object referring to the database * @param string $table The name of the logging table * @return void * @author Eli White <*****@*****.**> **/ function show_log(PDO $db, $table) { $channel = $_GET['c']; $host = $_GET['h']; $day = $_GET['d']; $parts = explode('-', $day); $formatted_date = "{$parts[0]}-{$parts[1]}-{$parts[2]}"; // Begin the HTML page: template_header('Date: ' . utf8specialchars($formatted_date) . ' - Channel: ' . utf8specialchars($channel) . ' (' . utf8specialchars($host) . ')'); // Query the database to get all log lines for this date: $prepared = $db->prepare("SELECT time(`created_on`) AS t, type, nick, message\n FROM {$table}\n WHERE `host` = ? AND `channel` = ? AND date(`created_on`) = ?\n ORDER by `created_on` asc"); $prepared->execute(array($host, $channel, $day)); // Loop through each line, foreach ($prepared as $result) { // Prepare some basic details for output: $color = nick_color($result->nick); $time = utf8specialchars($result->t); $msg = utf8specialchars($result->message); $nick = utf8specialchars($result->nick); $type = false; // Now change the format of the line based upon the type: switch ($result->type) { case 'privmsg': // PRIVMSG (A Regular Message) echo "[{$time}] <span style=\"color:#{$color};\">" . "<{$nick}></span> {$msg}<br />\n"; break; case 'action': // ACTION (emote) echo "[{$time}] <span style=\"color:#{$color};\">" . "*{$nick} {$msg}</span><br />\n"; break; case 'join': // JOIN echo "[{$time}] -> {$nick} joined the room.<br />\n"; break; case 'part': // PART (leaves channel) echo "[{$time}] -> {$nick} left the room: {$msg}<br />\n"; break; /* Not currently logged case 3: // QUIT (quits the server) echo "[$time] -> {$nick} left the server: {$msg}<br />\n"; break; case 6: // NICK (changes their nickname) echo "[$time] -> {$nick} is now known as: {$msg}<br />\n"; break; case 7: // KICK (booted) echo "[$time] -> {$nick} boots {$msg} from the room.<br />\n"; break; case 8: // MODE (changed their mode) $type = 'MODE'; case 9: // TOPIC (changed the topic) $type = $type ? $type : 'TOPIC'; echo "[$time] -> {$nick}: :{$type}: {$msg}<br />\n"; */ } } // Finish up the page: template_footer(); }
/** * This shuts down the SSI and shows the footer. */ function ssi_shutdown() { if (!isset($_GET['ssi_function']) || $_GET['ssi_function'] != 'shutdown') { template_footer(); } }
function die404() { header('HTTP/1.1 404 Not Found'); template_header('HTTP/1.1 404 Not Found'); template_navigation(); echo ''; template_footer(); }
function obExit($header = null, $do_footer = null, $from_index = false) { global $context, $settings, $modSettings, $txt; static $header_done = false, $footer_done = false; // Clear out the stat cache. trackStats(); $do_header = $header === null ? !$header_done : $header; if ($do_footer === null) { $do_footer = $do_header; } // Has the template/header been done yet? if ($do_header) { // Start up the session URL fixer. ob_start('ob_sessrewrite'); // Just in case we have anything bad already in there... if ((isset($_REQUEST['debug']) || isset($_REQUEST['xml']) || WIRELESS && WIRELESS_PROTOCOL == 'wap') && in_array($txt['lang_locale'], array('UTF-8', 'ISO-8859-1'))) { ob_start('validate_unicode__recursive'); } if (!empty($settings['output_buffers']) && is_string($settings['output_buffers'])) { $buffers = explode(',', $settings['output_buffers']); } elseif (!empty($settings['output_buffers'])) { $buffers = $settings['output_buffers']; } else { $buffers = array(); } if (isset($modSettings['integrate_buffer'])) { $buffers = array_merge(explode(',', $modSettings['integrate_buffer']), $buffers); } if (!empty($buffers)) { foreach ($buffers as $buffer_function) { if (function_exists(trim($buffer_function))) { ob_start(trim($buffer_function)); } } } // Display the screen in the logical order. template_header(); $header_done = true; } if ($do_footer) { if (WIRELESS && !isset($context['sub_template'])) { fatal_lang_error('wireless_error_notyet', false); } // Just show the footer, then. loadSubTemplate(isset($context['sub_template']) ? $context['sub_template'] : 'main'); // Just so we don't get caught in an endless loop of errors from the footer... if (!$footer_done) { $footer_done = true; template_footer(); // (since this is just debugging... it's okay that it's after </html>.) if (!isset($_REQUEST['xml'])) { db_debug_junk(); } } } // Remember this URL in case someone doesn't like sending HTTP_REFERER. if (strpos($_SERVER['REQUEST_URL'], 'action=dlattach') === false) { $_SESSION['old_url'] = $_SERVER['REQUEST_URL']; } // For session check verfication.... don't switch browsers... $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; // Hand off the output to the portal, etc. we're integrated with. if (isset($modSettings['integrate_exit'], $context['template_layers']) && in_array('main', $context['template_layers']) && function_exists($modSettings['integrate_exit'])) { call_user_func($modSettings['integrate_exit'], $do_footer && !WIRELESS); } // Don't exit if we're coming from index.php; that will pass through normally. if (!$from_index || WIRELESS) { exit; } }
<div style="border:1px solid #e7dc2b;background: #fff888;margin:15px;padding:10px;">No items available from in the last <?php echo get_offset(true); ?> hour(s). Try <a href="index.php?hours=-1" id="viewallitems">viewing all items</a></div> <div style="background: url('<?php template_directory(); ?>/spinner-back.png');margin:15px;padding:10px;display:none;">Now loading all available items - If they don't load within 20 seconds, click <a href="index.php?hours=-1">here</a><br /><img src="<?php template_directory(); ?>/spinner.gif" alt="Loading..." /></div> <?php } ?> </ul> </div> </div> </div> <div id="sidebar"> <ul> <?php if( has_feeds() ): ?> <li id="sources"><h3>Sources</h3> <ul> <?php list_feeds('title_length=35&format=<li><a href="%1$s"><img class="icon" src="%2$s" /><span class="title">%3$s</span></a></li>'); ?> </ul> </li> <?php endif; ?> <li>Powered by <a href="http://getlilina.org/">Lilina News Aggregator</a></li> </ul> </div> <?php template_footer(); ?> <!-- Generated in: <?php global $timer_start; echo lilina_timer_end($timer_start); ?> --> <script src="<?php echo get_option('baseurl') ?>inc/js/jquery.js"></script> <script src="<?php template_directory(); ?>/greader.js"></script> </body> </html>
/** * Ends execution. * * What it does: * - Takes care of template loading and remembering the previous URL. * - Calls ob_start() with ob_sessrewrite to fix URLs if necessary. * * @param bool|null $header = null * @param bool|null $do_footer = null * @param bool $from_index = false * @param bool $from_fatal_error = false */ function obExit($header = null, $do_footer = null, $from_index = false, $from_fatal_error = false) { global $context, $txt; static $header_done = false, $footer_done = false, $level = 0, $has_fatal_error = false; // Attempt to prevent a recursive loop. ++$level; if ($level > 1 && !$from_fatal_error && !$has_fatal_error) { exit; } if ($from_fatal_error) { $has_fatal_error = true; } // Clear out the stat cache. trackStats(); // If we have mail to send, send it. if (!empty($context['flush_mail'])) { // @todo this relies on 'flush_mail' being only set in AddMailQueue itself... :\ AddMailQueue(true); } $do_header = $header === null ? !$header_done : $header; if ($do_footer === null) { $do_footer = $do_header; } // Has the template/header been done yet? if ($do_header) { // Was the page title set last minute? Also update the HTML safe one. if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) { $context['page_title_html_safe'] = Util::htmlspecialchars(un_htmlspecialchars($context['page_title'])) . (!empty($context['current_page']) ? ' - ' . $txt['page'] . ' ' . ($context['current_page'] + 1) : ''); } // Start up the session URL fixer. ob_start('ob_sessrewrite'); call_integration_buffer(); // Display the screen in the logical order. template_header(); $header_done = true; } if ($do_footer) { // Show the footer. loadSubTemplate(isset($context['sub_template']) ? $context['sub_template'] : 'main'); // Just so we don't get caught in an endless loop of errors from the footer... if (!$footer_done) { $footer_done = true; template_footer(); // (since this is just debugging... it's okay that it's after </html>.) if (!isset($_REQUEST['xml'])) { displayDebug(); } } } // Need user agent $req = request(); // Remember this URL in case someone doesn't like sending HTTP_REFERER. $invalid_old_url = array('action=dlattach', 'action=jsoption', 'action=viewadminfile', ';xml', ';api'); $make_old = true; foreach ($invalid_old_url as $url) { if (strpos($_SERVER['REQUEST_URL'], $url) !== false) { $make_old = false; break; } } if ($make_old === true) { $_SESSION['old_url'] = $_SERVER['REQUEST_URL']; } // For session check verification.... don't switch browsers... $_SESSION['USER_AGENT'] = $req->user_agent(); // Hand off the output to the portal, etc. we're integrated with. call_integration_hook('integrate_exit', array($do_footer)); // Don't exit if we're coming from index.php; that will pass through normally. if (!$from_index) { exit; } }
function obExit($header = null, $do_footer = null, $from_index = false, $from_fatal_error = false) { global $context, $modSettings; static $header_done = false, $footer_done = false, $level = 0, $has_fatal_error = false; if (EoS_Smarty::isActive()) { return EoS_Smarty::obExit($header, $do_footer, $from_index, $from_fatal_error); } // Attempt to prevent a recursive loop. ++$level; if ($level > 1 && !$from_fatal_error && !$has_fatal_error) { exit; } if ($from_fatal_error) { $has_fatal_error = true; } // Custom templates to load, or just default? /*$is_admin = isset($_REQUEST['action']) && $_REQUEST['action'] === 'admin'; $templates = array('index'); // Load each template... foreach ($templates as $template) { if(!$is_admin) loadTemplate($template); else loadAdminTemplate($template); } $context['template_layers'] = array('html', 'body'); */ // Clear out the stat cache. trackStats(); // If we have mail to send, send it. if (!empty($context['flush_mail'])) { AddMailQueue(true); } $do_header = $header === null ? !$header_done : $header; if ($do_footer === null) { $do_footer = $do_header; } $context['template_benchmark'] = microtime(); // Has the template/header been done yet? if ($do_header) { // Was the page title set last minute? Also update the HTML safe one. if (!empty($context['page_title']) && empty($context['page_title_html_safe'])) { $context['page_title_html_safe'] = $context['forum_name_html_safe'] . ' - ' . commonAPI::htmlspecialchars(un_htmlspecialchars($context['page_title'])); } // Start up the session URL fixer. ob_start('ob_sessrewrite'); HookAPI::integrateOB(); //if(!empty($modSettings['simplesef_enable'])) // ob_start('SimpleSEF::ob_simplesef'); // Display the screen in the logical order. template_header(); $header_done = true; } if ($do_footer) { if (WIRELESS && !isset($context['sub_template'])) { fatal_lang_error('wireless_error_notyet', false); } // Just show the footer, then. loadSubTemplate(isset($context['sub_template']) ? $context['sub_template'] : 'main'); // Just so we don't get caught in an endless loop of errors from the footer... if (!$footer_done) { $footer_done = true; template_footer(); // (since this is just debugging... it's okay that it's after </html>.) if (!isset($_REQUEST['xml'])) { db_debug_junk(); } } } // Remember this URL in case someone doesn't like sending HTTP_REFERER. if (strpos($_SERVER['REQUEST_URL'], 'action=dlattach') === false && strpos($_SERVER['REQUEST_URL'], 'action=viewsmfile') === false) { $_SESSION['old_url'] = $_SERVER['REQUEST_URL']; } // For session check verfication.... don't switch browsers... $_SESSION['USER_AGENT'] = $_SERVER['HTTP_USER_AGENT']; // Hand off the output to the portal, etc. we're integrated with. HookAPI::callHook('integrate_exit', array($do_footer)); if (!empty($modSettings['simplesef_enable'])) { SimpleSEF::fixXMLOutput($do_footer); } // Don't exit if we're coming from index.php; that will pass through normally. if (!$from_index) { exit; } }