function view_article() { do_header(); include "templates/index_viewarticle.inc.php"; build_matrix('news', $_REQUEST['id']); do_footer(); }
function main() { global $db; if (isset($_REQUEST['id'])) { $result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1"); while ($row = $result->FetchNextObject()) { do_header(); $header = new Template(); $header->open_template('cheats_header'); $header->addvar('{id}', $row->ID); $header->addvar('{title}', stripslashes($row->TITLE)); $header->parse_template(); $header->print_template(); $cheats = $db->Execute("SELECT id,Modid,title,cheat FROM `Obsedb_cheats` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`"); while ($cheat = $cheats->FetchNextObject()) { // CHEAT HTML echo "<b>" . clean($cheat->TITLE) . "</b><br />\n \t\t\t " . stripslashes($cheat->CHEAT) . "<br /><br />"; // END CHEAT HTML } do_footer(); } } else { do_header(); echo "<b>System Error Message</b><br />"; echo "You cannot access this page directly, please go back and select a Mod.<br />"; echo "If the problem persists, please contact the webmaster."; do_footer(); } }
function awshit($deathmessage) { global $headerisprinted; if (!$headerisprinted) { do_header('Barf Report', true); } printf('<div class="message_box">%s</div>', $deathmessage); do_footer(); exit; }
function _display_password_form() { bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale'); textdomain('postfixadmin'); do_header('Postfixadmin Squirrelmail - Login'); echo _('The PostfixAdmin plugin needs your current mailbox password'); echo "<form action='' method='post'>"; echo _('Password for'); echo " " . $_SESSION['username'] . " :"; echo "<input type='password' name='password' value=''>"; echo "<input type='submit' value='" . _('Submit') . "'></form>"; do_footer(); }
function handle_error($status = '404 Not Found', $header, $text) { global $config; header('HTTP/1.0 ' . $status); header('Status: ' . $status); do_header(); echo '<h3>' . $header . '</h3>'; echo '<p class="warning">Sorry :-(</p>'; echo '<p>' . $text . '</p>'; echo '<p class="leave"><a href="' . $config['base'] . '">Go to ' . $config['shortener'] . '</a></p>'; do_footer(); die; }
function view() { global $db; if (!is_numeric($_REQUEST['id'])) { die("Critical Error: Aborting script operations."); } $result = $db->Execute("SELECT * FROM Obsedb_companies WHERE id = {$_REQUEST['id']} LIMIT 1"); $company = array(); $company['title'] = stripslashes($result->fields['title']); $company['description'] = clean($result->fields['description']); if (!empty($result->fields['homepage'])) { $company['homepage'] = '<a href="' . stripslashes($result->fields['homepage']) . '" target="_blank">' . stripslashes($result->fields['homepage']) . '</a>'; } if (!empty($result->fields['logo'])) { $company['logo'] .= "<img src=\""; $company['logo'] .= stripslashes($result->fields['logo']); $company['logo'] .= "\" alt=\"" . $company['title'] . " align=\"right\" hspace=\"2\" vspace=\"2\">"; } $result = $db->Execute("\n\t\t\tSELECT id, title, section, developer\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE developer = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;"); while ($row = $result->FetchNextObject()) { $company['dev_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />'; } $result = $db->Execute("\n\t\t\tSELECT id, title, section, publisher\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE publisher = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;"); while ($row = $result->FetchNextObject()) { $company['pub_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />'; } do_header(); $template = new Template(); $template->open_template('company_profile'); $template->addvar('{title}', $company['title']); $template->addvar('{homepage}', $company['homepage']); $template->addvar('{logo}', $company['logo']); $template->addvar('{description}', $company['description']); $template->parse_template(); $template->print_template(); if (!empty($company['dev_links'])) { $company_profile_devlinks = new Template(); $company_profile_devlinks->open_template('company_profile_devlinks'); $company_profile_devlinks->addvar('{links}', $company['dev_links']); $company_profile_devlinks->parse_template(); $company_profile_devlinks->print_template(); } if (!empty($company['pub_links'])) { $company_profile_publinks = new Template(); $company_profile_publinks->open_template('company_profile_publinks'); $company_profile_publinks->addvar('{links}', $company['pub_links']); $company_profile_publinks->parse_template(); $company_profile_publinks->print_template(); } do_footer(); }
function main() { global $db; do_header(); if (!empty($_REQUEST['id'])) { $poll = $db->Execute("\n\t\t\t\tSELECT id,title\n\t\t\t\tFROM `Obsedb_polls`\n\t\t\t\tWHERE `id` = '" . $_REQUEST['id'] . "'"); $result = $db->Execute("SELECT * FROM Obsedb_polls_options WHERE poll_id = '{$_REQUEST['id']}' ORDER BY id"); while ($row = $result->FetchNextObject()) { $poll_options .= "<tr><td bgcolor='#FFFFFF'>" . stripslashes($row->TEXT) . " - {$row->COUNT} votes</td></tr>"; } if ($poll->RecordCount() < 1) { include "templates/poll_error.inc.php"; } else { include "templates/poll_view.inc.php"; } } do_footer(); }
function main() { global $db; // Get Mod Info if (isset($_REQUEST['id'])) { $result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1"); while ($row = $result->FetchNextObject()) { $cheats = $db->Execute("SELECT id,Modid FROM `Obsedb_cheats` WHERE Modid = {$_REQUEST['id']} LIMIT 1"); if ($cheats->RecordCount() >= 1) { $cheat_link = "<a href=\"cheats.php?id={$row->ID}\">Cheats</a>"; } else { $cheat_link = "Cheats"; } do_header(); $tplHeader = new Template(); $tplHeader->open_template('downloads_header'); $tplHeader->addvar('{title}', stripslashes($row->TITLE)); $tplHeader->addvar('{id}', $row->ID); $tplHeader->addvar('{cheat_link}', $cheat_link); $tplHeader->parse_template(); $tplHeader->print_template(); $downloads = $db->Execute("SELECT id,Modid,title,download FROM `Obsedb_downloads` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`"); while ($download = $downloads->FetchNextObject()) { // DOWNLOAD HTML echo "<a href='" . stripslashes($download->DOWNLOAD) . "'>" . clean($download->TITLE) . "</a><br /><br />"; // END DOWNLOAD HTML } $tplFooter = new Template(); $tplFooter->open_template('downloads_footer'); $tplFooter->parse_template(); $tplFooter->print_template(); do_footer(); } } else { do_header(); echo "<b>System Error Message</b><br />"; echo "You cannot access this page directly, please go back and select a Mod.<br />"; echo "If the problem persists, please contact the webmaster."; do_footer(); } }
function mailbag_main() { global $db; do_header(); $tplHeader = new Template(); $tplHeader->open_template('mailbag_header'); $tplHeader->print_template(); $tplItem = new Template(); $tplItem->open_template('mailbag_item'); $result = $db->Execute("SELECT * FROM `Obsedb_mailbag` ORDER BY `id` DESC"); while ($row = $result->FetchNextObject()) { $tplItem->addvar('{title}', stripslashes($row->TITLE)); $tplItem->addvar('{message}', clean($row->MESSAGE)); $tplItem->addvar('{reply}', clean($row->REPLY)); $tplItem->parse_template(); $tplItem->print_template(); } $tplFooter = new Template(); $tplFooter->open_template('mailbag_footer'); $tplFooter->print_template(); do_footer(); }
/** * This is it - the start of rendering of a website page. * Take in all inputs, sends them to the correct functions to process, gathers up all the outputs, sticks them together and echoes them. */ function do_site() { // More SEO redirection (monikers) // Does this URL arrangement support monikers? $url_id = get_param('id', NULL, true); if ($url_id !== NULL && url_monikers_enabled()) { $type = get_param('type', 'misc'); $looking_for = '_SEARCH:' . get_page_name() . ':' . $type . ':_WILD'; $hooks = find_all_hooks('systems', 'content_meta_aware'); $ob_info = NULL; foreach (array_keys($hooks) as $hook) { require_code('hooks/systems/content_meta_aware/' . filter_naughty($hook)); $ob = object_factory('Hook_content_meta_aware_' . $hook, true); if ($ob === NULL) { continue; } $ob_info = $ob->info(); $ob_info['view_pagelink_pattern'] = preg_replace('#:[^:]*$#', ':_WILD', $ob_info['view_pagelink_pattern']); if ($ob_info['view_pagelink_pattern'] == $looking_for && $ob_info['support_url_monikers']) { if (is_numeric($url_id)) { $correct_moniker = find_id_moniker(array('page' => get_page_name(), 'type' => get_param('type', 'misc'), 'id' => $url_id)); if ($correct_moniker !== NULL && $correct_moniker != $url_id && count($_POST) == 0) { header('HTTP/1.0 301 Moved Permanently'); $_new_url = build_url(array('page' => '_SELF', 'id' => $correct_moniker), '_SELF', NULL, true); $new_url = $_new_url->evaluate(); header('Location: ' . $new_url); exit; } } else { // See if it is deprecated if (strpos(get_db_type(), 'mysql') !== false) { $monikers = $GLOBALS['SITE_DB']->query_select('url_id_monikers USE INDEX (uim_moniker)', array('m_resource_id', 'm_deprecated'), array('m_resource_page' => get_page_name(), 'm_resource_type' => get_param('type', 'misc'), 'm_moniker' => $url_id)); } else { $monikers = $GLOBALS['SITE_DB']->query_select('url_id_monikers', array('m_resource_id', 'm_deprecated'), array('m_resource_page' => get_page_name(), 'm_resource_type' => get_param('type', 'misc'), 'm_moniker' => $url_id)); } if (!array_key_exists(0, $monikers)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $deprecated = $monikers[0]['m_deprecated'] == 1; if ($deprecated && count($_POST) == 0) { $correct_moniker = find_id_moniker(array('page' => get_page_name(), 'type' => get_param('type', 'misc'), 'id' => $monikers[0]['m_resource_id'])); header('HTTP/1.0 301 Moved Permanently'); $_new_url = build_url(array('page' => '_SELF', 'id' => $correct_moniker), '_SELF', NULL, true); $new_url = $_new_url->evaluate(); header('Location: ' . $new_url); exit; } else { $_GET['id'] = $monikers[0]['m_resource_id']; // We need to know the ID number rather than the moniker } } break; } } } // Any messages to output? if (get_param_integer('redirected', 0) == 1) { $messages = $GLOBALS['SITE_DB']->query_select('messages_to_render', array('r_message', 'r_type'), array('r_session_id' => get_session_id()), 'ORDER BY r_time DESC'); foreach ($messages as $message) { if ($GLOBALS['XSS_DETECT']) { ocp_mark_as_escaped($message['r_message']); } attach_message(protect_from_escaping($message['r_message']), $message['r_type']); } if (count($messages) != 0) { $GLOBALS['SITE_DB']->query('DELETE FROM ' . $GLOBALS['SITE_DB']->get_table_prefix() . 'messages_to_render WHERE r_session_id=' . strval((int) get_session_id()) . ' OR r_time<' . strval(time() - 60 * 60)); } } if (in_safe_mode()) { $disable_safe_mode_url = get_self_url(true, true, array('keep_safe_mode' => NULL)); attach_message(do_lang_tempcode('CURRENTLY_HAS_KEEP_SAFE_MODE', escape_html($disable_safe_mode_url)), 'notice'); } if (get_param_integer('keep_fatalistic', 0) == 1) { $disable_fatalistic_url = get_self_url(true, true, array('keep_fatalistic' => NULL)); attach_message(do_lang_tempcode('CURRENTLY_HAS_KEEP_FATALISTIC', escape_html($disable_fatalistic_url)), 'notice'); } $special_page_type = get_param('special_page_type', 'view'); global $ZONE; $keep_markers = get_param_integer('keep_markers', 0); $show_edit_links = get_param_integer('show_edit_links', 0); global $KEEP_MARKERS, $SHOW_EDIT_LINKS; $KEEP_MARKERS = $keep_markers == 1 || $special_page_type == 'show_markers'; if ($KEEP_MARKERS && !headers_sent()) { header('Content-type: text/html; charset=' . get_charset()); } $SHOW_EDIT_LINKS = $show_edit_links == 1 || $special_page_type == 'show_edit_links'; $out_evaluated = NULL; if ($special_page_type != 'view' && $special_page_type != 'show_markers') { require_code('view_modes'); initialise_special_page_types($special_page_type); } // Set up Xdebug profiling if ($special_page_type == 'profile') { if (function_exists('xdebug_start_profiling')) { xdebug_start_profiling(); } // xdebug 1 style if (ini_get('xdebug.profiler_enable') != '1') { attach_message(escape_html('Profiling must be enabled in php.ini'), 'warn'); } // xdebug 2 style if (!is_writable_wrap(ini_get('xdebug.profiler_output_dir'))) { attach_message(escape_html('xdebug.profiler_output_dir needs setting to a writable directory'), 'warn'); } } // Allow the site to be closed $site_closed = get_option('site_closed'); if ($site_closed == '1' && !has_specific_permission(get_member(), 'access_closed_site') && !$GLOBALS['IS_ACTUALLY_ADMIN']) { require_code('site2'); closed_site(); } // Work out which page we're viewing global $PAGE; $PAGE = get_page_name(); $doing_special_page_type = $special_page_type != 'view' && $special_page_type != 'show_markers' && $special_page_type != 'show_edit_links' && $special_page_type != 'memory' && (has_specific_permission(get_member(), 'view_profiling_modes') || $GLOBALS['IS_ACTUALLY_ADMIN']); // Load up our frames into strings. Note that the header and the footer are fixed already. $middle = request_page($PAGE, true); global $CYCLES; $CYCLES = array(); // Here we reset some Tempcode environmental stuff, because template compilation or preprocessing may have dirtied things if ($middle === NULL || $middle->is_definitely_empty()) { $GLOBALS['HTTP_STATUS_CODE'] = '404'; if (!headers_sent()) { if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) { header('HTTP/1.0 404 Not Found'); } } $title = get_page_title('ERROR_OCCURRED'); $text = do_lang_tempcode('NO_PAGE_OUTPUT'); $middle = warn_screen($title, $text, false); } // Extra stuff we can tag on (like messages) $additional = new ocp_tempcode(); $site_closed = get_option('site_closed'); // May have been JUST changed in page load - think Setup Wizard if ($site_closed == '1' && $PAGE != 'login' && $PAGE != 'join' && get_param_integer('wide_high', 0) == 0) { $additional->attach(do_template('ADDITIONAL', array('_GUID' => '03a41a91606b3ad05330e7d6f3e741c1', 'TYPE' => 'notice', 'MESSAGE' => do_lang_tempcode(has_specific_permission(get_member(), 'access_closed_site') ? 'SITE_SPECIAL_ACCESS' : 'SITE_SPECIAL_ACCESS_SU')))); } if ($GLOBALS['IS_ACTUALLY_ADMIN']) { $unsu_link = get_self_url(true, true, array('keep_su' => NULL)); $su_username = $GLOBALS['FORUM_DRIVER']->get_username(get_member()); $additional->attach(do_template('ADDITIONAL', array('_GUID' => '13a41a91606b3ad05330e7d6f3e741c1', 'TYPE' => 'notice', 'MESSAGE' => do_lang_tempcode('USING_SU', escape_html($unsu_link), escape_html($su_username))))); } $out = new ocp_tempcode(); // This is important - it makes sure the tempcode tree appears nicely $middle->handle_symbol_preprocessing(); // Due to the '->evaluate()' below, plus so that some symbol preprocessing can be passed into header $out->attach(do_header()); if (function_exists('memory_get_usage') && get_param('special_page_type', '') == 'memory') { if (function_exists('memory_get_peak_usage')) { $memory_usage = memory_get_peak_usage(); } else { $memory_usage = memory_get_usage(); } $additional->attach(do_template('ADDITIONAL', array('_GUID' => 'd605c0d111742a8cd2d4ef270a1e5fe1', 'TYPE' => 'inform', 'MESSAGE' => do_lang_tempcode('MEMORY_USAGE', float_format(round(floatval($memory_usage) / 1024.0 / 1024.0, 2)))))); } // Whack it into our global template global $ATTACHED_MESSAGES; $global_template = 'GLOBAL'; if (get_option('show_docs') == '0') { $GLOBALS['HELPER_PANEL_TUTORIAL'] = ''; } $helper_panel_pic = $GLOBALS['HELPER_PANEL_PIC']; if ($helper_panel_pic != '') { if (find_theme_image($helper_panel_pic, true) == '') { $helper_panel_pic = ''; } } $global = do_template($global_template, array('HELPER_PANEL_TUTORIAL' => $GLOBALS['HELPER_PANEL_TUTORIAL'], 'HELPER_PANEL_HTML' => $GLOBALS['HELPER_PANEL_HTML'], 'HELPER_PANEL_TEXT' => $GLOBALS['HELPER_PANEL_TEXT'], 'HELPER_PANEL_PIC' => $helper_panel_pic, 'MIDDLE' => $doing_special_page_type ? $middle : $middle->evaluate(), 'MESSAGE_TOP' => $ATTACHED_MESSAGES, 'MESSAGE' => $additional, 'BREADCRUMBS' => breadcrumbs())); unset($middle); $out->attach($global); $out->attach(do_footer()); $out->handle_symbol_preprocessing(); if (get_value('xhtml_strict') === '1') { $out = make_xhtml_strict($out); } // Validation $novalidate = get_param_integer('keep_novalidate', get_param_integer('novalidate', 0)); $show_edit_links = get_param_integer('show_edit_links', 0); if ((in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) || $GLOBALS['FORUM_DRIVER']->is_staff(get_member())) && ($special_page_type == 'code' || $novalidate == 0 && get_option('validation') == '1') && $GLOBALS['REFRESH_URL'][0] == '' && $show_edit_links == 0) { require_code('view_modes'); $out_evaluated = $out->evaluate(NULL, false); do_xhtml_validation($out_evaluated, $special_page_type == 'code' && get_param_integer('preview_mode', NULL) === NULL, get_param_integer('preview_mode', 0)); } // Cacheing for spiders if (running_script('index') && count($_POST) == 0 && isset($GLOBALS['SITE_INFO']['fast_spider_cache']) && $GLOBALS['SITE_INFO']['fast_spider_cache'] == '1' && is_guest()) { $bot_type = get_bot_type(); if (($bot_type !== NULL || isset($GLOBALS['SITE_INFO']['any_guest_cached_too']) && $GLOBALS['SITE_INFO']['any_guest_cached_too'] == '1') && can_fast_spider_cache()) { $fast_cache_path = get_custom_file_base() . '/persistant_cache/' . md5(serialize(get_self_url_easy())); if ($bot_type === NULL) { $fast_cache_path .= '__non-bot'; } if (!array_key_exists('js_on', $_COOKIE)) { $fast_cache_path .= '__no-js'; } if (is_mobile()) { $fast_cache_path .= '_mobile'; } $fast_cache_path .= '.gcd'; if (!is_dir(get_custom_file_base() . '/persistant_cache/')) { if (@mkdir(get_custom_file_base() . '/persistant_cache/', 0777)) { fix_permissions(get_custom_file_base() . '/persistant_cache/', 0777); sync_file(get_custom_file_base() . '/persistant_cache/'); } else { intelligent_write_error($fast_cache_path); } } $out_evaluated = $out->evaluate(NULL, false); $myfile = @fopen($fast_cache_path, 'wb') or intelligent_write_error($fast_cache_path); if (function_exists('gzencode')) { fwrite($myfile, gzencode($out_evaluated, 9)); } else { fwrite($myfile, $out_evaluated); } fclose($myfile); fix_permissions($fast_cache_path); sync_file($fast_cache_path); } } if ($doing_special_page_type) { special_page_types($special_page_type, $out, $out_evaluated); } // We calculated the time before outputting so that latency and bandwidth do not adversely affect the result global $PAGE_START_TIME, $PAGE_STRING; $page_generation_time = microtime_diff($PAGE_START_TIME, microtime(false)); if (!$GLOBALS['QUICK_REDIRECT']) { if ($out_evaluated !== NULL) { echo $out_evaluated; } else { $GLOBALS['FINISHING_OUTPUT'] = true; $out->evaluate_echo(); } } // Finally, stats if ($PAGE_STRING !== NULL) { log_stats($PAGE_STRING, intval($page_generation_time)); } // When someone hits the Admin Zone front page. if ($ZONE['zone_name'] == 'adminzone' && get_page_name() == 'start') { // Security feature admins can turn on require_code('notifications'); $current_username = $GLOBALS['FORUM_DRIVER']->get_username(get_member()); $subject = do_lang('AFA_NOTIFICATION_MAIL_SUBJECT', $current_username, get_site_name(), get_ip_address()); $mail = do_lang('AFA_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($current_username), comcode_escape(get_ip_address())); dispatch_notification('adminzone_frontpage_accessed', NULL, $subject, $mail); // Track very basic details of what sites use ocPortal. You can remove if you like. if (preg_match('#^localhost[\\.\\:$]?#', ocp_srv('HTTP_HOST')) == 0) { global $EXPIRE, $KEY; $timeout_before = @ini_get('default_socket_timeout'); @ini_set('default_socket_timeout', '3'); http_download_file('http://ocportal.com/user.php?url=' . urlencode(get_base_url()) . '&name=' . urlencode(get_site_name()) . '®istered=2&key=' . ($KEY === NULL ? '' : strval($KEY)) . '&expire=' . ($EXPIRE === NULL ? '' : strval($EXPIRE)) . '&version=' . urlencode(ocp_version_full()), NULL, false); @ini_set('default_socket_timeout', $timeout_before); } } // Little disk space check $last_space_check = get_value('last_space_check'); if ($last_space_check === NULL || intval($last_space_check) < time() - 60 * 60 * 3) { set_value('last_space_check', strval(time())); $low_space_check = intval(get_option('low_space_check')) * 1024 * 1024; $disk_space = @disk_free_space(get_file_base()); if (is_integer($disk_space) && $disk_space < $low_space_check) { require_code('notifications'); $subject = do_lang('LOW_DISK_SPACE_SUBJECT', NULL, NULL, NULL, get_site_default_lang()); $message = do_lang('LOW_DISK_SPACE_MAIL', strval(intval(round($disk_space / 1024 / 1024))), NULL, NULL, get_site_default_lang()); dispatch_notification('low_disk_space', NULL, $subject, $message, NULL, A_FROM_SYSTEM_PRIVILEGED); } } //exit(); }
function do_error($mess = false, $error = false, $send_status = true) { global $globals; $globals['ads'] = false; if (!$mess) { $mess = _('algún error nos ha petado'); } if ($error && $send_status) { header("HTTP/1.0 {$error} {$mess}"); header("Status: {$error} {$mess}"); } do_header(_('error')); echo '<STYLE TYPE="text/css" MEDIA=screen>' . "\n"; echo '<!--' . "\n"; echo '.errt { text-align:center; padding-top:20px; font-size:150%; color:#FF6400;}' . "\n"; echo '.errl { text-align:center; margin-top:20px; margin-bottom:20px; }' . "\n"; echo '-->' . "\n"; echo '</STYLE>' . "\n"; echo '<div class="errt">' . $mess . '<br />' . "\n"; if ($error) { echo '(' . _('error') . ' ' . $error . ')</div>' . "\n"; } do_footer_menu(); do_footer(); die; }
function do_error_message($message) { echo '<h2 class="alert">' . $message . '</h2><br/><br/><a href="/">Home Page</a><br/><br/>'; do_footer(); exit; }
/** * Show results of running a validation function. * * @param string The data validated * @param array Error information * @param boolean Whether we are opening up an XHTML-fragment in a preview box * @param boolean Whether to return Tempcode * @return string Returned result (won't return it $ret is false) */ function display_validation_results($out, $error, $preview_mode = false, $ret = false) { global $KEEP_MARKERS, $SHOW_EDIT_LINKS; $KEEP_MARKERS = false; $SHOW_EDIT_LINKS = false; global $XHTML_SPIT_OUT; $XHTML_SPIT_OUT = 1; if (function_exists('set_time_limit')) { @set_time_limit(280); } require_css('adminzone'); if (!$ret) { $echo = do_header($preview_mode); $echo->evaluate_echo(); } else { ob_start(); } $title = get_page_title('VALIDATION_ERROR'); // Escape and colourfy $i = 0; // Output header if (count($_POST) == 0) { $messy_url = get_param_integer('keep_markers', 0) == 1 ? new ocp_tempcode() : build_url(array('page' => '_SELF', 'special_page_type' => 'code', 'keep_markers' => 1), '_SELF', NULL, true); $ignore_url = build_url(array('page' => '_SELF', 'keep_novalidate' => 1), '_SELF', NULL, true); $ignore_url_2 = build_url(array('page' => '_SELF', 'novalidate' => 1), '_SELF', NULL, true); } else { $messy_url = new ocp_tempcode(); $ignore_url = new ocp_tempcode(); $ignore_url_2 = new ocp_tempcode(); } $error_lines = array(); $return_url = new ocp_tempcode(); if (count($error['errors']) != 0) { $errorst = new ocp_tempcode(); foreach ($error['errors'] as $j => $_error) { $errorst->attach(do_template('VALIDATE_ERROR', array('_GUID' => '2239470f4b9bd38fcb570689cecaedd2', 'I' => strval($j), 'LINE' => integer_format($_error['line']), 'POS' => integer_format($_error['pos']), 'ERROR' => $_error['error']))); $error_lines[$_error['line']] = 1; } $errors = $errorst->evaluate(); $echo = do_template('VALIDATE_ERROR_SCREEN', array('_GUID' => 'db6c362632471e7c856380d32da91054', 'MSG' => do_lang_tempcode('_NEXT_ITEM_BACK'), 'RETURN_URL' => $return_url, 'TITLE' => $title, 'IGNORE_URL_2' => $ignore_url_2, 'IGNORE_URL' => $ignore_url, 'MESSY_URL' => $messy_url, 'ERRORS' => $errorst, 'RET' => $ret)); unset($errorst); $echo->evaluate_echo(); } else { $echo = do_template('VALIDATE_SCREEN', array('_GUID' => 'd8de848803287e4c592418d57450b7db', 'MSG' => do_lang_tempcode('_NEXT_ITEM_BACK'), 'RETURN_URL' => $return_url, 'TITLE' => get_page_title('VIEWING_SOURCE'), 'MESSY_URL' => $messy_url, 'RET' => $ret)); $echo->evaluate_echo(); } $level_ranges = $error['level_ranges']; $tag_ranges = $error['tag_ranges']; $value_ranges = $error['value_ranges']; $current_range = 0; $current_tag = 0; $current_value = 0; $number = 1; $in_at = false; for ($i = 0; $i < strlen($out); ++$i) { if (isset($level_ranges[$current_range])) { $level = $level_ranges[$current_range][0]; $start = $level_ranges[$current_range][1]; if ($start == 0) { $start = 1; } // Hack for when error starts before a line, messing up our output if ($i == $start) { $x = 8; if ($level % $x == 0) { $colour = 'teal'; } if ($level % $x == 1) { $colour = 'blue'; } if ($level % $x == 2) { $colour = 'purple'; } if ($level % $x == 3) { $colour = 'gray'; } if ($level % $x == 4) { $colour = 'red'; } if ($level % $x == 5) { $colour = 'maroon'; } if ($level % $x == 6) { $colour = 'navy'; } if ($level % $x == 7) { $colour = 'olive'; } $previous = $i == 0 ? '' : $out[$i - 1]; $string = new ocp_tempcode(); if ($previous == ' ' || $previous == chr(10) || $previous == chr(13)) { $string->attach(str_pad('', $level * 3 * 6, ' ')); } $string->attach(do_template('VALIDATE_TAG_START', array('_GUID' => '3a4c99283d32006143fc688ce8f2cadc', 'COLOUR' => $colour))); $string->evaluate_echo(); } } if (isset($tag_ranges[$current_tag])) { $start = $tag_ranges[$current_tag][0]; if ($i == $start) { $string = do_template('VALIDATE_TAG_NAME_START'); $string->evaluate_echo(); } } if (isset($value_ranges[$current_value])) { $start = $value_ranges[$current_value][0]; if ($i == $start) { $in_at = true; $string = do_template('VALIDATE_ATTRIBUTE_START'); $string->evaluate_echo(); } } $char = $out[$i]; if ($char == chr(10) || $i == 0) { if ($number > 1) { $escaped_code = do_template('VALIDATE_LINE_END'); $escaped_code->evaluate_echo(); } if (isset($error_lines[$number])) { $markers = new ocp_tempcode(); foreach ($error['errors'] as $j => $_error) { if ($number == $_error['line']) { $markers->attach(do_template('VALIDATE_MARKER', array('_GUID' => '4b1898d5f1e0f56d18a47561659da3bb', 'I' => strval($j), 'ERROR' => $_error['error']))); } } $escaped_code = do_template('VALIDATE_LINE_ERROR', array('_GUID' => '2ffa5c26090d3d814206e3a9e46c7b4e', 'MARKERS' => $markers, 'NUMBER' => integer_format($number))); $escaped_code->evaluate_echo(); } else { $escaped_code = do_template('VALIDATE_LINE', array('_GUID' => '4994f4748c3cd0cbf4e9278ca0e9b1fc', 'NUMBER' => integer_format($number))); $escaped_code->evaluate_echo(); } ++$number; } // Marker $end_markers = new ocp_tempcode(); if (isset($error_lines[$number])) { foreach ($error['errors'] as $_error) { if ($i == $_error['global_pos']) { $_text = do_template('VALIDATE_MARKER_START'); $_text->evaluate_echo(); if ($char == chr(13) || $char == chr(10)) { $__text = '!' . do_lang('HERE') . '!'; if (function_exists('ocp_mark_as_escaped')) { ocp_mark_as_escaped($__text); } echo $__text; } $end_markers->attach(do_template('VALIDATE_MARKER_END')); } } } // Escaping if ($char == '&') { $char = '&'; } if ($char == '<') { $char = '<'; } if ($char == '>') { $char = '>'; } if ($char == '"') { $char = '"'; } if ($char == '\'') { $char = '''; } if (is_null($level_ranges) && $char == ' ') { $char = ' '; } if (is_null($level_ranges) && $char == "\t") { $char = ' '; } // if ($char==' ') $char=' '; if (function_exists('ocp_mark_as_escaped')) { ocp_mark_as_escaped($char); } echo $char; // Marker $end_markers->evaluate_echo(); if (isset($value_ranges[$current_value])) { $end = $value_ranges[$current_value][1]; if ($i == $end - 1) { if ($in_at) { $text = do_template('VALIDATE_ATTRIBUTE_END'); $text->evaluate_echo(); } $in_at = false; ++$current_value; } } if (isset($level_ranges[$current_range])) { $end = $level_ranges[$current_range][2]; if ($i == $end - 1) { $string = do_template('VALIDATE_TAG_END'); $string->evaluate_echo(); ++$current_range; while (isset($level_ranges[$current_range]) && $level_ranges[$current_range][1] <= $i) { ++$current_range; } } } if (isset($tag_ranges[$current_tag])) { $end = $tag_ranges[$current_tag][1]; if ($i == $end - 1) { $string = do_template('VALIDATE_TAG_NAME_END'); $string->evaluate_echo(); ++$current_tag; } } } if ($number > 1) { $escaped_code = do_template('VALIDATE_LINE_END'); $escaped_code->evaluate_echo(); } $echo = do_template('VALIDATE_SCREEN_END', array('_GUID' => '739514a06ae65252293fc62b1c7cec40', 'RET' => $ret)); $echo->evaluate_echo(); if (!$ret) { $echo = do_footer(); $echo->evaluate_echo(); exit; } $out = ob_get_contents(); ob_end_clean(); return $out; }
function do_error($mess = false, $error = false, $send_status = true) { global $globals; $globals['ads'] = false; if (!$mess) { $mess = _('algún error nos ha petado'); } if ($error && $send_status) { header("HTTP/1.0 {$error} {$mess}"); header("Status: {$error} {$mess}"); } do_header(_('error')); echo '<STYLE TYPE="text/css" MEDIA=screen>' . "\n"; echo '<!--' . "\n"; echo '.errt { text-align:center; padding-top:50px; font-size:300%; color:#FF6400;}' . "\n"; echo '.errl { text-align:center; margin-top:50px; margin-bottom:100px; }' . "\n"; echo '-->' . "\n"; echo '</STYLE>' . "\n"; echo '<p class="errt">' . $mess . '<br />' . "\n"; if ($error) { echo '(' . _('error') . ' ' . $error . ')</p>' . "\n"; } echo '<div class="errl"><img src="' . $globals['base_url'] . 'img/mnm/lame_excuse_01.png" width="362" height="100" alt="ooops logo" /></div>' . "\n"; do_footer_menu(); do_footer(); die; }
function error($text, $ver) { echo ' <div class="notice"> <p align="left" style="padding-left:15px;"><b>error occured:</b></p></div> <div class="notice" style="margin-bottom:0px; border-bottom:2px solid #222;"> <textarea cols="100" rows="15" style="width:98%;" class="txt"> '; echo $text; echo '</textarea></div>'; do_footer($ver); die; }
/** * Render the site as closed. */ function closed_site() { if (get_page_name() != 'login' && get_page_name() != 'join' && get_page_name() != 'lostpassword') { @ob_end_clean(); if (!headers_sent()) { if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) { header('HTTP/1.0 503 Service Temporarily Unavailable'); } } log_stats('/closed', 0); $GLOBALS['SCREEN_TEMPLATE_CALLED'] = ''; $echo = do_header(); if (count($_POST) > 0) { $redirect = build_url(array('page' => ''), '', array('keep_session' => 1)); } else { $redirect = build_url(array('page' => '_SELF'), '_SELF', array('keep_session' => 1), true); } if (is_object($redirect)) { $redirect = $redirect->evaluate(); } $login_url = build_url(array('page' => 'login', 'type' => 'misc', 'redirect' => $redirect), get_module_zone('login')); $join_url = get_forum_type() == 'none' ? '' : $GLOBALS['FORUM_DRIVER']->join_url(); $echo->attach(do_template('CLOSED_SITE', array('_GUID' => '4e753c50eca7c98344d2107fc18c4554', 'CLOSED' => comcode_to_tempcode(get_option('closed'), NULL, true), 'LOGIN_URL' => $login_url, 'JOIN_URL' => $join_url))); $echo->attach(do_footer()); $echo->handle_symbol_preprocessing(); $echo->evaluate_echo(); exit; } }
/** * Do a terminal execution on a defined page type * * @param mixed The error message (string or tempcode) * @param ID_TEXT Name of the terminal page template */ function _generic_exit($text, $template) { @ob_end_clean(); // Incase in minimodule if (get_param_integer('keep_fatalistic', 0) == 1) { fatal_exit($text); } @header('Content-type: text/html; charset=' . get_charset()); @header('Content-Disposition: inline'); //$x=@ob_get_contents(); @ob_end_clean(); //if (is_string($x)) @print($x); Disabled as causes weird crashes $text_eval = is_object($text) ? $text->evaluate() : $text; if ($GLOBALS['HTTP_STATUS_CODE'] == '200') { if ($text_eval == do_lang('ocf:NO_MARKERS_SELECTED') || $text_eval == do_lang('NOTHING_SELECTED')) { if (!headers_sent()) { $GLOBALS['HTTP_STATUS_CODE'] = '400'; if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) { header('HTTP/1.0 400 Bad Request'); } } } elseif ($text_eval == do_lang('MISSING_RESOURCE') || $text_eval == do_lang('USER_NO_EXIST')) { if (!headers_sent()) { $GLOBALS['HTTP_STATUS_CODE'] = '404'; if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) { header('HTTP/1.0 404 Not Found'); } } if (ocp_srv('HTTP_REFERER') != '') { relay_error_notification($text_eval . ' ' . do_lang('REFERRER', ocp_srv('HTTP_REFERER'), substr(get_browser_string(), 0, 255)), false, 'error_occurred_missing_resource'); } } elseif ($template == 'WARN_SCREEN') { if (!headers_sent()) { $GLOBALS['HTTP_STATUS_CODE'] = '500'; if (!browser_matches('ie') && strpos(ocp_srv('SERVER_SOFTWARE'), 'IIS') === false) { header('HTTP/1.0 500 Internal server error'); } } } } if (array_key_exists('MSN_DB', $GLOBALS) && !is_null($GLOBALS['MSN_DB'])) { $GLOBALS['FORUM_DB'] = $GLOBALS['MSN_DB']; $GLOBALS['MSN_DB'] = NULL; } global $EXITING; if (running_script('upgrader') || !function_exists('get_page_title')) { critical_error('PASSON', is_object($text) ? $text->evaluate() : $text); } if ($EXITING >= 1 || !function_exists('get_member')) { critical_error('EMERGENCY', is_object($text) ? $text->evaluate() : escape_html($text)); } $EXITING++; if (!function_exists('do_header')) { require_code('site'); } if (get_forum_type() == 'ocf' && get_db_type() != 'xml') { require_code('ocf_groups'); $restrict_answer = ocf_get_best_group_property($GLOBALS['FORUM_DRIVER']->get_members_groups(get_member()), 'flood_control_submit_secs'); $GLOBALS['NO_DB_SCOPE_CHECK'] = true; $GLOBALS['SITE_DB']->query_update('f_members', array('m_last_submit_time' => time() - $restrict_answer - 1), array('id' => get_member()), '', 1); $GLOBALS['NO_DB_SCOPE_CHECK'] = false; } global $DONE_HEADER; $bail_out = isset($DONE_HEADER) && $DONE_HEADER; $echo = $bail_out ? new ocp_tempcode() : do_header(running_script('preview') || running_script('iframe') || running_script('shoutbox')); if ($template == 'INFORM_SCREEN' && is_object($GLOBALS['DISPLAYED_TITLE'])) { $title = get_page_title($GLOBALS['DISPLAYED_TITLE'], false); } else { $title = get_page_title($template == 'INFORM_SCREEN' ? 'MESSAGE' : 'ERROR_OCCURRED'); } if (running_script('preview') || running_script('iframe') || running_script('shoutbox')) { $echo = do_template('STYLED_HTML_WRAP', array('TITLE' => do_lang_tempcode($template == 'INFORM_SCREEN' ? 'MESSAGE' : 'ERROR_OCCURRED'), 'FRAME' => true, 'TARGET' => '_top', 'CONTENT' => $text)); $echo->handle_symbol_preprocessing(); $echo->evaluate_echo(); exit; } $inside = do_template($template, array('TITLE' => $title, 'TEXT' => $text, 'PROVIDE_BACK' => true)); $echo->attach(running_script('preview') || running_script('iframe') || running_script('shoutbox') ? $inside : globalise($inside)); $echo->attach(do_footer($bail_out)); $echo->handle_symbol_preprocessing(); $echo->evaluate_echo(); exit; }
function do_qanda_text($link) { global $globals, $db; $cleaner = function ($comment) use($link) { $comment->content = preg_replace('/{.{1,10}?}|^( *#\\d+)+/', '', $comment->content); $comment->content = preg_replace_callback('/#(\\d+)/', function ($matches) use($link) { global $db; $order = $matches[1]; if ($order == 0) { return "<em>@{$link->username}</em>"; } $username = $db->get_var("select user_login from users, comments where user_id = comment_user_id and comment_link_id = {$link->id} and comment_order = {$order}"); return "<em>@{$username}</em>"; }, $comment->content); $comment->content = preg_replace('/[\\n]{3,}/', "\n", $comment->content); $comment->content = $comment->to_html($comment->content); }; $qas = get_qanda($link); do_header(_('Q&A simple') . ": {$link->title}", 'post'); foreach ($qas as $qa) { $a = $qa->answer; foreach ($qa->questions as $q) { $cleaner($q); } $cleaner($a); } $link->permalink = $link->get_permalink(); Haanga::Load('comment_qa_simple.html', compact('qas', 'link')); do_footer(); }
/** * Turn the tempcode lump into a standalone page (except for header/footer which is assumed already handled elsewhere). * * @param tempcode The tempcode to put into a nice frame * @param ?mixed 'Additional' message (NULL: none) * @param string The type of special message * @set inform warn "" * @param boolean Whether to automatically include the header and footer templates * @return tempcode Standalone page */ function globalise($middle, $message = NULL, $type = '', $include_header_and_footer = false) { require_code('site'); if (running_script('iframe')) { global $ATTACHED_MESSAGES; $middle->handle_symbol_preprocessing(); $tpl = do_template('STYLED_HTML_WRAP', array('TITLE' => is_null($GLOBALS['DISPLAYED_TITLE']) ? do_lang_tempcode('NA') : $GLOBALS['DISPLAYED_TITLE'], 'EXTRA_HEAD' => $GLOBALS['EXTRA_HEAD'], 'EXTRA_FOOT' => $GLOBALS['EXTRA_FOOT'], 'MESSAGE_TOP' => $ATTACHED_MESSAGES, 'FRAME' => true, 'TARGET' => '_self', 'CONTENT' => $middle)); $tpl->handle_symbol_preprocessing(); return $tpl; } global $DONE_HEADER; global $CYCLES; $CYCLES = array(); // Here we reset some Tempcode environmental stuff, because template compilation or preprocessing may have dirtied things if ($GLOBALS['HELPER_PANEL_TUTORIAL'] === NULL) { $GLOBALS['HELPER_PANEL_TUTORIAL'] = ''; } if ($GLOBALS['HELPER_PANEL_HTML'] === NULL) { $GLOBALS['HELPER_PANEL_HTML'] = ''; } if ($GLOBALS['HELPER_PANEL_TEXT'] === NULL) { $GLOBALS['HELPER_PANEL_TEXT'] = ''; } if ($GLOBALS['HELPER_PANEL_PIC'] === NULL) { $GLOBALS['HELPER_PANEL_PIC'] = ''; } $_message = $message !== NULL ? do_template('ADDITIONAL', array('_GUID' => 'b4c9f0a0bbfb9344d00c29db8ff5715d', 'TYPE' => $type, 'MESSAGE' => $message)) : new ocp_tempcode(); if (get_option('show_docs') == '0') { $GLOBALS['HELPER_PANEL_TUTORIAL'] = ''; } $global = new ocp_tempcode(); $bail_out = isset($DONE_HEADER) && $DONE_HEADER; if ($include_header_and_footer && !$bail_out) { $global->attach(do_header()); } $global->attach(do_template('GLOBAL', array('_GUID' => '592faa2c0e8bf2dc3492de2c11ca7131', 'HELPER_PANEL_TUTORIAL' => $GLOBALS['HELPER_PANEL_TUTORIAL'], 'HELPER_PANEL_HTML' => $GLOBALS['HELPER_PANEL_HTML'], 'HELPER_PANEL_TEXT' => $GLOBALS['HELPER_PANEL_TEXT'], 'HELPER_PANEL_PIC' => $GLOBALS['HELPER_PANEL_PIC'], 'MESSAGE_TOP' => $GLOBALS['ATTACHED_MESSAGES'], 'MESSAGE' => $_message, 'MIDDLE' => $middle, 'BREADCRUMBS' => breadcrumbs()))); if ($include_header_and_footer) { $global->attach(do_footer($bail_out)); } $global->handle_symbol_preprocessing(); if (get_value('xhtml_strict') === '1') { $global = make_xhtml_strict($global); } return $global; }
echo '<div class="sneaker-status"><strong>'._('estado').'</strong></div>'; echo "</div>\n"; echo "</div>\n"; for ($i=0; $i<$max_items;$i++) { echo '<div id="sneaker-'.$i.'" class="sneaker-item"> '; echo "</div>\n"; } echo '</div>'; //echo "</div>\n"; // air-with-footer ?> <script type="text/javascript"> var chat_status = document.getElementById('chat-status'); //<![CDATA[ check_control('vote'); check_control('problem'); check_control('comment'); check_control('new'); check_control('published'); check_control('chat'); //]]> </script> <? do_footer(false); ?>
echo '</div>'; // Print "conversation" for a given note $answers = $db->object_iterator("SELECT" . Post::SQL . ", conversations WHERE conversation_type='post' and conversation_to = {$post_id} and post_id = conversation_from ORDER BY conversation_from asc LIMIT 100", 'Post'); if ($answers) { echo '<div style="padding-left: 40px; padding-top: 10px">'; echo '<ol class="comments-list">'; foreach ($answers as $answer) { echo '<li>'; $answer->print_summary(); echo '</li>'; $ids[] = $answer->id; } echo "</ol>"; echo '</div>' . "\n"; } } Haanga::Load('get_total_answers_by_ids.html', array('type' => 'post', 'ids' => implode(',', $ids))); // Update conversation time if ($view == 3 && $time_read > 0 && $user->id == $current_user->user_id) { Post::update_read_conversation($time_read); } } echo '</div>'; do_pages($rows, $page_size); } echo '</div>'; if ($rows > 15) { do_footer_menu(); } do_footer(); exit(0);
function main() { global $db; if (isset($_REQUEST['section'])) { $where = "WHERE Obsedb_news.section = {$_REQUEST['section']}"; } // Globalize Variables $search = $_REQUEST['search']; $keyword = $_REQUEST['keyword']; $month = $_REQUEST['month']; $year = $_REQUEST['year']; do_header(); echo '<form method="post" action="archive.php">'; echo '<table border="0" cellspacing="0" cellpadding="0" width="100%">'; echo '<tr>'; echo '<td width="25%">Keywords:</td>'; echo '<td width="25%">Month:</td>'; echo '<td width="25%">Year:</td>'; echo '<td width="25%"></td>'; echo '</tr>'; echo '<tr>'; echo '<td width="25%"><input type="text" name="keyword" size="15"></td>'; echo '<td width="25%"><select name="month">'; echo '<option value="' . date("m") . '">' . date("F") . '</option>'; echo '<option value="01">January</option>'; echo '<option value="02">February</option>'; echo '<option value="03">March</option>'; echo '<option value="04">April</option>'; echo '<option value="05">May</option>'; echo '<option value="06">June</option>'; echo '<option value="07">July</option>'; echo '<option value="08">August</option>'; echo '<option value="09">September</option>'; echo '<option value="10">October</option>'; echo '<option value="11">November</option>'; echo '<option value="12">December</option>'; echo '</select></td>'; echo '<td width="25%"><select name="year">'; $thisyear = date("Y"); $startyear = $thisyear; while ($startyear >= $thisyear - 5) { if ($startyear == $thisyear) { echo "<option value=\"{$startyear}\" selected>{$startyear}</option>"; } else { echo "<option value=\"{$startyear}\">{$startyear}</option>"; } $startyear--; } echo '</select></td>'; echo '<td width="25%"><input type="submit" value="List Articles" name="submit"></td>'; echo '</tr>'; echo '</table>'; echo '<input type="hidden" name="search" value="1">'; echo '</form>'; echo '<table border="0" cellspacing="0" cellpadding="4" width="100%">'; $sections = FetchSections("Obsedb_news_sections"); $specialdata = "<b>News Sections</b><br />"; foreach ($sections as $key => $value) { $specialdata .= " "; $specialdata .= '<a href="archive.php?section=' . $key . '">' . stripslashes($value) . '</a><br />'; } $specialdata .= "<br />"; // Decide which query to use if ($search == 1) { if (!empty($keyword)) { $where = " AND `title` LIKE '%{$keyword}%'"; } $result = $db->Execute("SELECT id,title,author,date,section FROM Obsedb_news WHERE date LIKE '" . $year . "." . $month . ".%' {$where} ORDER BY date DESC"); } else { $result = $db->Execute("SELECT id,title,author,date,section FROM Obsedb_news ORDER BY date DESC LIMIT 0,50"); } while ($row = $result->FetchNextObject()) { echo '<tr>'; echo '<td><a href="index.php?do=viewarticle&id=' . $row->ID . '">' . $row->TITLE . '</a></td>'; echo '<td>' . $row->DATE . '</td>'; echo '<td>' . $row->AUTHOR . '</td>'; echo '</tr>'; } echo '</table><br /><br />'; do_footer(); }