$sql = "SELECT t.topic_id, t.topic_title, t.forum_id\n\t\tFROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p\n\t\tWHERE {$where_sql}"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, 'Could not obtain topic information', __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); $topic_title = $row['topic_title']; $topic_id = $row['topic_id']; $forum_id = $row['forum_id']; if ($submit) { $friend_name = isset($HTTP_POST_VARS['friend_name']) ? trim(strip_tags($HTTP_POST_VARS['friend_name'])) : ''; $friend_email = isset($HTTP_POST_VARS['friend_email']) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['friend_email']))) : ''; if (!$friend_name || !$friend_email) { message_die(GENERAL_MESSAGE, $lang['No_friend_specified']); } $server_url = server_path_info(FALSE); $email_headers = 'From: ' . $userdata['user_email'] . "\nReturn-Path: " . $userdata['user_email'] . "\n"; include $phpbb_root_path . 'includes/emailer.' . $phpEx; $emailer = new emailer($board_config['smtp_delivery']); $emailer->use_template('email_topic', $userdata['user_lang']); $emailer->email_address($friend_email); $emailer->set_subject(); //$lang['Email_topic'] $emailer->extra_headers($email_headers); $emailer->assign_vars(array('SITENAME' => $board_config['sitename'], 'USERNAME' => $userdata['username'], 'FRIEND_NAME' => $friend_name, 'TOPIC' => $topic_title, 'BOARD_EMAIL' => $board_config['board_email'], 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $userdata['username']), 'U_TOPIC' => $server_url . "viewtopic.{$phpEx}?" . POST_TOPIC_URL . "={$topic_id}")); $emailer->send(); $emailer->reset(); $redirect .= $post_id ? "#{$post_id}" : ''; $template->assign_vars(array('META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.{$phpEx}?{$redirect}") . '">')); $msg = $lang['Email_sent'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.{$phpEx}?{$redirect}") . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.{$phpEx}") . '">', '</a>'); message_die(GENERAL_MESSAGE, $msg);
} // Tidy the cache if (method_exists($cache, 'tidy') && time() - $board_config['cache_gc'] > $board_config['cache_last_gc']) { $cache->tidy(); set_config('cache_last_gc', time(), TRUE); } // Only through a error when we are outside of a sandbox. if ((file_exists('install') || file_exists('contrib')) && !file_exists('CVS')) { message_die(GENERAL_MESSAGE, 'Please ensure both the install/ and contrib/ directories are deleted'); } if ($board_config['auth_mode'] == 'ldap') { include $phpbb_root_path . 'includes/functions_ldap_groups.' . $phpEx; include $phpbb_root_path . 'includes/functions_ldap.' . $phpEx; } $board_config['referers_on'] = TRUE; // Needs SQL and Config Option ## ToonArmy if ($board_config['referers_on'] && !empty($HTTP_POST_VARS['HTTP_REFERER'])) { $referer_url = strtolower($HTTP_POST_VARS['HTTP_REFERER']); if (strpos($referer_url, server_path_info(FALSE)) === FALSE) { record_referer($referer_url); } } // Databae Optimize if (intval($board_config['cron_enable'])) { if (!intval($board_config['cron_lock']) && intval($board_config['cron_next']) <= time()) { include $phpbb_root_path . 'includes/optimize_database_cron.' . $phpEx; } elseif (intval($board_config['cron_lock']) && $board_config['cron_next'] + $board_config['cron_every'] <= time()) { // Unlock the Cron it must have got stuck. set_config('cron_lock', 0, 1); } }