/** * Kicks off the appropriate search(es) * * Initiates the search engine and returns HTML formatted * results. It also provides support to plugins using a * search API. Backwards compatibility has been incorporated * in this function to allow legacy support to plugins using * the old API calls defined versions prior to Geeklog 1.5.1 * * @return string HTML output for search results * */ public function doSearch() { global $_CONF, $LANG01, $LANG09, $LANG31; // Verify current user can perform requested search if (!$this->_isSearchAllowed()) { return SEC_loginRequiredForm(); } // When full text searches are enabled, make sure the min. query length // is 3 characters. Otherwise, make sure at least one of query string, // author, or topic is not empty. if (empty($this->_query) && empty($this->_author) && empty($this->_topic) || $_CONF['search_use_fulltext'] && strlen($this->_query) < 3) { $retval = '<p>' . $LANG09[41] . '</p>' . LB; $retval .= $this->showForm(); return $retval; } // Build the URL strings $this->_searchURL = $_CONF['site_url'] . '/search.php?query=' . urlencode($this->_query) . (!empty($this->_keyType) ? '&keyType=' . $this->_keyType : '') . (!empty($this->_dateStart) ? '&datestart=' . $this->_dateStart : '') . (!empty($this->_dateEnd) ? '&dateend=' . $this->_dateEnd : '') . (!empty($this->_topic) ? '&topic=' . $this->_topic : '') . (!empty($this->_author) ? '&author=' . $this->_author : '') . ($this->_titlesOnly ? '&title=true' : ''); $url = "{$this->_searchURL}&type={$this->_type}&mode="; $obj = new ListFactory($url . 'search', $_CONF['search_limits'], $_CONF['num_search_results']); $obj->setField('ID', 'id', false); $obj->setField('URL', 'url', false); $show_num = $_CONF['search_show_num']; $show_type = $_CONF['search_show_type']; $show_user = $_CONF['contributedbyline']; $show_hits = !$_CONF['hideviewscount']; $style = isset($_CONF['search_style']) ? $_CONF['search_style'] : 'google'; if ($style == 'table') { $obj->setStyle('table'); // Title Name Display Sort Format $obj->setField($LANG09[62], LF_ROW_NUMBER, $show_num, false, '<b>%d.</b>'); $obj->setField($LANG09[5], LF_SOURCE_TITLE, $show_type, true, '<b>%s</b>'); $obj->setField($LANG09[16], 'title', true, true); $obj->setField($LANG09[63], 'description', true, false); $obj->setField($LANG09[17], 'date', true, true); $obj->setField($LANG09[18], 'uid', $show_user, true); $obj->setField($LANG09[50], 'hits', $show_hits, true); $this->_wordlength = 7; } else { if ($style == 'google') { $sort_uid = $this->_author == '' ? true : false; $sort_date = empty($this->_dateStart) || empty($this->_dateEnd) || $this->_dateStart != $this->_dateEnd ? true : false; $sort_type = $this->_type == 'all' ? true : false; $obj->setStyle('inline'); $obj->setField('', LF_ROW_NUMBER, $show_num, false, '<b>%d.</b>'); $obj->setField($LANG09[16], 'title', true, true, '%s<br' . XHTML . '>'); $obj->setField('', 'description', true, false, '%s<br' . XHTML . '>'); $obj->setField('', '_html', true, false, '<span class="searchresult-byline">'); $obj->setField($LANG09[18], 'uid', $show_user, $sort_uid, $LANG01[104] . ' %s '); $obj->setField($LANG09[17], 'date', true, $sort_date, $LANG01[36] . ' %s'); $obj->setField($LANG09[5], LF_SOURCE_TITLE, $show_type, $sort_type, ' - %s'); $obj->setField($LANG09[50], 'hits', $show_hits, true, ' - %s ' . $LANG09[50]); $obj->setField('', '_html', true, false, '</span>'); $this->_wordlength = 50; } } // get default sort order $default_sort = explode('|', $_CONF['search_def_sort']); $obj->setDefaultSort($default_sort[0], $default_sort[1]); // set this only now, for compatibility with PHP 4 $obj->setRowFunction(array($this, 'searchFormatCallback')); // Start search timer $searchtimer = new timerobject(); $searchtimer->setPrecision(4); $searchtimer->startTimer(); // Have plugins do their searches $page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 1; $result_plugins = PLG_doSearch($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author, $this->_keyType, $page, 5); // Add core searches $result_plugins = array_merge($result_plugins, $this->_searchStories()); // Loop through all plugins separating the new API from the old $new_api = 0; $old_api = 0; $num_results = 0; foreach ($result_plugins as $result) { if (is_a($result, 'SearchCriteria')) { $debug_info = $result->getName() . ' using APIv2'; if ($this->_type != 'all' && $this->_type != $result->getName()) { if ($this->_verbose) { $new_api++; COM_errorLog($debug_info . '. Skipped as type is not ' . $this->_type); } continue; } $api_results = $result->getResults(); if (!empty($api_results)) { $obj->addResultArray($api_results); } $api_callback_func = $result->getCallback(); if (!empty($api_callback_func)) { $debug_info .= ' with Callback Function.'; $obj->setCallback($result->getLabel(), $result->getName(), $api_callback_func, $result->getRank(), $result->getTotal()); } else { if ($result->getSQL() != '' || $result->getFTSQL() != '') { if ($_CONF['search_use_fulltext'] == true && $result->getFTSQL() != '') { $sql = $result->getFTSQL(); } else { $sql = $result->getSQL(); } $sql = $this->_convertsql($sql); $debug_info .= ' with SQL = ' . print_r($sql, 1); $obj->setQuery($result->getLabel(), $result->getName(), $sql, $result->getRank()); } } $this->_url_rewrite[$result->getName()] = $result->UrlRewriteEnable(); $this->_append_query[$result->getName()] = $result->AppendQueryEnable(); if ($this->_verbose) { $new_api++; COM_errorLog($debug_info); } } else { if (is_a($result, 'Plugin') && $result->num_searchresults != 0) { // Some backwards compatibility if ($this->_verbose) { $old_api++; $debug_info = $result->plugin_name . ' using APIv1 with backwards compatibility.'; $debug_info .= ' Count: ' . $result->num_searchresults; $debug_info .= ' Headings: ' . implode(',', $result->searchheading); COM_errorLog($debug_info); } // Find the column heading names that closely match what we are looking for // There may be issues here on different languages, but this _should_ capture most of the data $col_title = $this->_findColumn($result->searchheading, array($LANG09[16], $LANG31[4], 'Question', 'Site Page')); //Title,Subject $col_desc = $this->_findColumn($result->searchheading, array($LANG09[63], 'Answer')); $col_date = $this->_findColumn($result->searchheading, array($LANG09[17])); //'Date','Date Added','Last Updated','Date & Time' $col_user = $this->_findColumn($result->searchheading, array($LANG09[18], 'Submited by')); $col_hits = $this->_findColumn($result->searchheading, array($LANG09[50], $LANG09[23], 'Downloads', 'Clicks')); //'Hits','Views' $label = str_replace($LANG09[59], '', $result->searchlabel); $num_results += $result->num_itemssearched; // Extract the results for ($i = 0; $i < 5; $i++) { // If the plugin does not repect the $perpage perameter force it here. $j = $i + $page * 5 - 5; if ($j >= count($result->searchresults)) { break; } $old_row = $result->searchresults[$j]; if ($col_date != -1) { // Convert the date back to a timestamp $date = $old_row[$col_date]; $date = substr($date, 0, strpos($date, '@')); $date = $date == '' ? $old_row[$col_date] : strtotime($date); } $api_results = array(LF_SOURCE_NAME => $result->plugin_name, LF_SOURCE_TITLE => $label, 'title' => $col_title == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_title], 'description' => $col_desc == -1 ? '<i>' . $LANG09[70] . '</i>' : $old_row[$col_desc], 'date' => $col_date == -1 ? ' ' : $date, 'uid' => $col_user == -1 ? ' ' : $old_row[$col_user], 'hits' => $col_hits == -1 ? '0' : str_replace(',', '', $old_row[$col_hits])); preg_match('/href="([^"]+)"/i', $api_results['title'], $links); $api_results['url'] = empty($links) ? '#' : $links[1]; $obj->addResult($api_results); } } } } // Find out how many plugins are on the old/new system if ($this->_verbose) { COM_errorLog('Search Plugins using APIv1: ' . $old_api . ' APIv2: ' . $new_api); } // Execute the queries $results = $obj->ExecuteQueries(); // Searches are done, stop timer $searchtime = $searchtimer->stopTimer(); $escquery = htmlspecialchars($this->_query); $escquery = str_replace(array('{', '}'), array('{', '}'), $escquery); if ($this->_keyType == 'any') { $searchQuery = str_replace(' ', "</b>' " . $LANG09[57] . " '<b>", $escquery); $searchQuery = "<b>'{$searchQuery}'</b>"; } else { if ($this->_keyType == 'all') { $searchQuery = str_replace(' ', "</b>' " . $LANG09[56] . " '<b>", $escquery); $searchQuery = "<b>'{$searchQuery}'</b>"; } else { $searchQuery = $LANG09[55] . " '<b>{$escquery}</b>'"; } } // Clean the query string so that sprintf works as expected $searchQuery = str_replace('%', '%%', $searchQuery); $retval = "{$LANG09[25]} {$searchQuery}. "; if (count($results) == 0) { $retval .= sprintf($LANG09[24], 0); $retval = '<p>' . $retval . '</p>' . LB; $retval .= '<p>' . $LANG09[13] . '</p>' . LB; $retval .= $this->showForm(); } else { $retval .= $LANG09[64] . " ({$searchtime} {$LANG09[27]}). "; $retval .= str_replace('%', '%%', COM_createLink($LANG09[61], $url . 'refine')); $retval = '<p>' . $retval . '</p>' . LB; $retval = $obj->getFormattedOutput($results, $LANG09[11], $retval, '', $_CONF['search_show_sort'], $_CONF['search_show_limit']); } return $retval; }
/** * Kicks off the appropriate search(es) * * Initiates the search engine and returns HTML formatted * results. It also provides support to plugins using a * search API. * * @author Sami Barakat <s.m.barakat AT gmail DOT com> * @access public * @return string HTML output for search results * */ function doSearch() { global $_CONF, $LANG01, $LANG09, $LANG31, $_TABLES, $_USER; $debug_info = ''; $retval = ''; $list_top = ''; // Verify current user can perform requested search if (!$this->_isSearchAllowed()) { return $this->_getAccessDeniedMessage(); } // Make sure there is a query string // Full text searches have a minimum word length of 3 by default if (empty($this->_query)) { if ((empty($this->_author) || $this->_author == 0) && (empty($this->_type) || $this->_type == 'all') && (empty($this->_topic) || $this->_topic == 'all') && (empty($this->_dateStart) || empty($this->_dateEnd))) { $retval = $this->showForm(); $retval .= '<div style="margin-bottom:5px;border-bottom:1px solid #ccc;"></div><p>' . $LANG09[41] . '</p>' . LB; return $retval; } } elseif (strlen($this->_query) < 3) { $retval = $this->showForm(); $retval .= '<div style="margin-bottom:5px;border-bottom:1px solid #ccc;"></div><p>' . $LANG09[41] . '</p>' . LB; return $retval; } // Build the URL strings $this->_searchURL = $_CONF['site_url'] . '/search.php?query=' . urlencode($this->_query) . (!empty($this->_keyType) ? '&keyType=' . urlencode($this->_keyType) : '') . (!empty($this->_dateStart) ? '&datestart=' . urlencode($this->_dateStart) : '') . (!empty($this->_dateEnd) ? '&dateend=' . urlencode($this->_dateEnd) : '') . (!empty($this->_topic) ? '&topic=' . urlencode($this->_topic) : '') . (!empty($this->_author) ? '&author=' . urlencode($this->_author) : '') . (!empty($this->_searchDays) ? '&st=' . urlencode($this->_searchDays) : ''); $url = "{$this->_searchURL}&type={$this->_type}&mode="; $obj = new ListFactory($url . 'search', $_CONF['search_limits'], $_CONF['num_search_results']); $obj->setField('ID', 'id', false); $obj->setField('URL', 'url', false); $show_num = $_CONF['search_show_num']; $show_type = $_CONF['search_show_type']; $show_user = $_CONF['search_show_user']; $show_hits = $_CONF['search_show_hits']; $style = isset($_CONF['search_style']) ? $_CONF['search_style'] : 'google'; if (!COM_isAnonUser()) { $userStyle = DB_getItem($_TABLES['userprefs'], 'search_result_format', 'uid=' . (int) $_USER['uid']); if ($userStyle != '') { $style = $userStyle; } } if ($style == 'table') { $obj->setStyle('table'); // Title Name Display Sort Format $obj->setField($LANG09[62], ROW_NUMBER, $show_num, false, '<b>%d.</b>'); $obj->setField($LANG09[5], SQL_TITLE, $show_type, true, '<b>%s</b>'); $obj->setField($LANG09[16], 'title', true, true); $obj->setField($LANG09[63], 'description', true, false); $obj->setField($LANG09[17], 'date', true, true); $obj->setField($LANG09[18], 'uid', $show_user, true); $obj->setField($LANG09[50], 'hits', $show_hits, true); $this->_wordlength = 7; } else { if ($style == 'google') { $obj->setStyle('inline'); $obj->setField('', ROW_NUMBER, $show_num, false, '<span style="font-size:larger; font-weight:bold;">%d.</span>'); $obj->setField($LANG09[16], 'title', true, true, '<span style="font-size:larger; font-weight:bold;">%s</span><br/>'); $obj->setField('', 'description', true, false, '%s<br/>'); $obj->setField('', '_html', true, false, '<span style="color:green;">'); $obj->setField($LANG09[18], 'uid', $show_user, true, $LANG01[104] . ' %s '); $obj->setField($LANG09[17], 'date', true, true, $LANG01[36] . ' %s'); $obj->setField($LANG09[5], SQL_TITLE, $show_type, true, ' - %s'); $obj->setField($LANG09[50], 'hits', $show_hits, true, ' - %s ' . $LANG09[50]); $obj->setField('', '_html', true, false, '</span>'); $this->_wordlength = 50; } } $obj->setDefaultSort('date'); $obj->setRowFunction(array($this, 'searchFormatCallBack')); // Start search timer $searchtimer = new timerobject(); $searchtimer->setPercision(4); $searchtimer->startTimer(); // Have plugins do their searches $page = isset($_REQUEST['page']) ? COM_applyFilter($_REQUEST['page'], true) : 1; $result_plugins = PLG_doSearch($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author, $this->_keyType, $page, 5); $result_plugins_comment = PLG_doSearchComment($this->_query, $this->_dateStart, $this->_dateEnd, $this->_topic, $this->_type, $this->_author, $this->_keyType, $page, 5); $result_plugins = array_merge($result_plugins, $result_plugins_comment); // Add core searches if ($this->_type == 'all' || $this->_type == 'stories') { $result_plugins[] = $this->_searchStories(); } if ($this->_type == 'all' || $this->_type == 'comments') { $result_plugins[] = $this->_searchComments(); } // Loop through all plugins separating the new API from the old $new_api = 0; $old_api = 0; $num_results = 0; if (!isset($_CONF['search_use_fulltext'])) { $_CONF['search_use_fulltext'] = false; } foreach ($result_plugins as $result) { if (is_a($result, 'SearchCriteria')) { $debug_info .= $result->getName() . " using APIv2, "; $type = $result->getType(); if ($type == 'sql') { if ($_CONF['search_use_fulltext'] == true && $result->getFTSQL() != '') { $debug_info .= "search using FULLTEXT\n"; $sql = $result->getFTSQL(); } else { $debug_info .= "search using LIKE\n"; $sql = $result->getSQL(); } $sql = $this->_convertsql($sql); $obj->setQuery($result->getLabel(), $result->getName(), $sql, $result->getRank()); $this->_url_rewrite[$result->getName()] = $result->UrlRewriteEnable() ? true : false; } else { if ($type == 'text') { $obj->setQueryText($result->getLabel(), $result->getName(), $this->_query, $result->getNumResults(), $result->getRank()); } } $new_api++; } else { if (is_a($result, 'Plugin') && $result->num_searchresults != 0) { // Some backwards compatibility $debug_info .= $result->plugin_name . " using APIv1, search using backwards compatibility\n"; // Find the column heading names that closely match what we are looking for // There may be issues here on different languages, but this _should_ capture most of the data $col_title = $this->_findColumn($result->searchheading, array($LANG09[16], $LANG31[4], 'Question')); //Title,Subject $col_desc = $this->_findColumn($result->searchheading, array($LANG09[63], 'Answer')); $col_date = $this->_findColumn($result->searchheading, array($LANG09[17])); //'Date','Date Added','Last Updated','Date & Time' $col_user = $this->_findColumn($result->searchheading, array($LANG09[18], 'Submited by')); $col_hits = $this->_findColumn($result->searchheading, array($LANG09[50], $LANG09[23], 'Downloads', 'Clicks')); //'Hits','Views' $col_url = $this->_findColumn($result->searchheading, array('URL')); //'Hits','Views' $label = str_replace($LANG09[59], '', $result->searchlabel); if ($result->num_itemssearched > 0) { $_page = isset($_REQUEST['page']) ? COM_applyFilter($_REQUEST['page'], true) : 1; if (isset($_REQUEST['results'])) { $_per_page = COM_applyFilter($_REQUEST['results'], true); } else { $_per_page = $obj->getPerPage(); } $obj->addTotalRank(3); $pp = round(3 / $obj->getTotalRank() * $_per_page); $offset = ($_page - 1) * $pp; $limit = $pp; $obj->addToTotalFound($result->num_itemssearched); $counter = 0; // Extract the results foreach ($result->searchresults as $old_row) { if ($counter >= $offset && $counter <= $offset + $limit) { if ($col_date != -1) { // Convert the date back to a timestamp $date = $old_row[$col_date]; $date = substr($date, 0, strpos($date, '@')); if ($date == '') { $date = $old_row[$col_date]; } else { $date = strtotime($date); } } $api_results = array(SQL_NAME => $result->plugin_name, SQL_TITLE => $label, 'title' => $col_title == -1 ? $_CONF['search_no_data'] : $old_row[$col_title], 'description' => $col_desc == -1 ? $_CONF['search_no_data'] : $old_row[$col_desc], 'date' => $col_date == -1 ? ' ' : $date, 'uid' => $col_user == -1 ? '' : $old_row[$col_user], 'hits' => $col_hits == -1 ? '0' : str_replace(',', '', $old_row[$col_hits]), 'url' => $old_row[$col_url]); $obj->addResult($api_results); } $counter++; } } $old_api++; } } } // Find out how many plugins are on the old/new system $debug_info .= "\nAPIv1: {$old_api}\nAPIv2: {$new_api}"; // Execute the queries $results = $obj->ExecuteQueries(); // Searches are done, stop timer $searchtime = $searchtimer->stopTimer(); $escquery = htmlspecialchars($this->_query); if ($this->_keyType == 'any') { $searchQuery = str_replace(' ', "</b>' " . $LANG09[57] . " '<b>", $escquery); $searchQuery = "<b>'{$searchQuery}'</b>"; } else { if ($this->_keyType == 'all') { $searchQuery = str_replace(' ', "</b>' " . $LANG09[56] . " '<b>", $escquery); $searchQuery = "<b>'{$searchQuery}'</b>"; } else { $searchQuery = $LANG09[55] . " '<b>{$escquery}</b>'"; } } // Clean the query string so that sprintf works as expected $searchQuery = str_replace("%", "%%", $searchQuery); $searchText = "{$LANG09[25]} {$searchQuery}. "; $retval .= $this->showForm(); if (count($results) == 0) { $retval .= '<div style="margin-bottom:5px;border-bottom:1px solid #ccc;"></div>'; $retval .= $LANG09[74]; } else { $retval .= $obj->getFormattedOutput($results, $LANG09[11], $list_top, ''); } return $retval; }
// | of the License, or (at your option) any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // | | // | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +---------------------------------------------------------------------------+ // include '../../lib-common.php'; include '../library.php'; $mytimer = new timerobject(); $mytimer->startTimer(); $charset = COM_getCharset(); // Code added to handle the issue with the default $_COOKIE array being sent by the Flash Image uploader // We can sent the cookies in the post form data and then extract and filter the data to rebuild the COOKIE array // Also now need this to support Geeklog 1.6.1 that enables HTTP only cookie support. // Javascript no longer has access to the gl_session id in the cookie - issue only apparent in the YUI upload form if (!isset($_USER['uid']) and isset($_POST['cookie_session'])) { $_COOKIE[$_CONF['cookie_session']] = COM_applyFilter($_POST['cookie_session']); // Have a valid session id now from the COOKIE - ReInitialize the session data if (isset($_COOKIE[$_CONF['cookie_session']])) { $_USER = SESS_sessionCheck(); if ($_USER['uid'] > 0) { $_GROUPS = SEC_getUserGroups($_USER['uid']); // Global array of current user permissions [read,edit] $_RIGHTS = explode(',', SEC_getUserPermissions());
if ($forum == 0) { $link = '<p><a href="' . $_CONF['site_url'] . '/forum/index.php">' . $LANG_GF02['msg175'] . '</a></p>'; $report->set_var('bottomlink', $link); } else { $link = '<p><a href="' . $_CONF['site_url'] . '/forum/index.php?forum=' . $forum . '">' . $LANG_GF02['msg175'] . '</a></p>'; $report->set_var('bottomlink', $link); } $report->parse('output', 'report'); $pageBody = $report->finish($report->get_var('output')); $display .= FF_siteHeader($LANG_GF02['msg45']); $display .= $pageBody; $display .= FF_siteFooter(); echo $display; exit; } $mytimer = new timerobject(); $mytimer->startTimer(); $errMsg = ''; $uid = 1; if (!COM_isAnonUser() && isset($_USER['uid'])) { $uid = $_USER['uid']; } $dt = new Date('now', $_USER['tzid']); //Display Categories if ($forum == 0) { $birdSeedStart = ''; $dCat = isset($_GET['cat']) ? COM_applyFilter($_GET['cat'], true) : 0; $groups = array(); $usergroups = SEC_getUserGroups(); foreach ($usergroups as $group) { $groups[] = $group;
*/ require_once $_CONF['path_system'] . 'classes/timezoneconfig.class.php'; TimeZoneConfig::setSystemTimeZone(); /** * Include plugin class. * This is a poorly implemented class that was not very well thought out. * Still very necessary * */ require_once $_CONF['path_system'] . 'lib-plugins.php'; /** * Include page time -- used to time how fast each page was created * */ require_once $_CONF['path_system'] . 'classes/timer.class.php'; $_PAGE_TIMER = new timerobject(); $_PAGE_TIMER->startTimer(); /** * Include URL class * * This provides optional URL rewriting functionality. */ require_once $_CONF['path_system'] . 'classes/url.class.php'; $_URL = new url($_CONF['url_rewrite']); /** * This is our HTML template class. It is the same one found in PHPLib and is * licensed under the LGPL. See that file for details. * */ require_once $_CONF['path_system'] . 'classes/template.class.php'; /**
// | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // +---------------------------------------------------------------------------+ require_once '../lib-common.php'; // Path to your lib-common.php if (!in_array('forum', $_PLUGINS)) { echo COM_refresh($_CONF['site_url'] . '/index.php'); exit; } require_once $_CONF['path_system'] . 'classes/timer.class.php'; $mytimer = new timerobject(); $mytimer->setPercision(2); $mytimer->startTimer(); require_once $CONF_FORUM['path_include'] . 'gf_showtopic.php'; require_once $CONF_FORUM['path_include'] . 'gf_format.php'; $mytimer = new timerobject(); $mytimer->startTimer(); $display = ''; // Pass thru filter any get or post variables to only allow numeric values and remove any hostile data $highlight = isset($_REQUEST['highlight']) ? COM_applyFilter($_REQUEST['highlight']) : ''; $lastpost = isset($_REQUEST['lastpost']) ? COM_applyFilter($_REQUEST['lastpost']) : ''; $mode = isset($_REQUEST['mode']) ? COM_applyFilter($_REQUEST['mode']) : ''; $msg = isset($_GET['msg']) ? COM_applyFilter($_GET['msg']) : ''; $onlytopic = isset($_REQUEST['onlytopic']) ? COM_applyFilter($_REQUEST['onlytopic']) : ''; $page = isset($_REQUEST['page']) ? COM_applyFilter($_REQUEST['page'], true) : ''; $show = isset($_REQUEST['show']) ? COM_applyFilter($_REQUEST['show'], true) : ''; $showtopic = isset($_REQUEST['showtopic']) ? COM_applyFilter($_REQUEST['showtopic'], true) : ''; $result = DB_query("SELECT forum, pid, subject FROM {$_TABLES['forum_topic']} WHERE id = '{$showtopic}'"); // <- new list($forum, $topic_pid, $subject) = DB_fetchArray($result); // <- new
// | You should have received a copy of the GNU General Public License | // | along with this program; if not, write to the Free Software Foundation, | // | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | // | | // +--------------------------------------------------------------------------+ require_once '../lib-common.php'; if (!in_array('forum', $_PLUGINS)) { COM_404(); exit; } USES_forum_functions(); USES_forum_format(); USES_forum_topic(); require_once $_CONF['path_system'] . 'classes/timer.class.php'; $display = ''; $mytimer = new timerobject(); $mytimer->startTimer(); $showtopic = isset($_GET['showtopic']) ? COM_applyFilter($_GET['showtopic'], true) : 0; $show = isset($_GET['show']) ? COM_applyFilter($_GET['show'], true) : 0; $page = isset($_GET['page']) ? COM_applyFilter($_GET['page'], true) : 0; $mode = isset($_GET['mode']) ? COM_applyFilter($_GET['mode']) : ''; $highlight = isset($_GET['query']) ? COM_applyFilter($_GET['query']) : ''; $topic = isset($_GET['topic']) ? COM_applyFilter($_GET['topic'], true) : 0; $iframe = isset($_GET['onlytopic']) ? 1 : 0; // if no showtopic is provided, use the topic instead if ($showtopic == 0) { $showtopic = $topic; } if ($showtopic == 0) { $display = FF_siteHeader(); $display .= COM_startBlock();
$result = DB_query("SHOW VARIABLES LIKE 'have_innodb'"); $A = DB_fetchArray($result, true); if (strcasecmp($A[1], 'yes') == 0) { $retval = true; } else { $retval = false; } return $retval; } // MAIN echo COM_siteHeader('menu'); echo COM_startBlock('Changing tables to InnoDB'); if (innodb_supported()) { echo '<p>This may take a while ...</p>' . LB; flush(); $opt_time = new timerobject(); $opt_time->startTimer(); $result = DB_query("SHOW TABLES"); $numTables = DB_numRows($result); for ($i = 0; $i < $numTables; $i++) { $A = DB_fetchArray($result, true); if (in_array($A[0], $_TABLES)) { DB_query("ALTER TABLE {$A['0']} TYPE=InnoDB"); } } $exectime = $opt_time->stopTimer(); echo '<p>Changing ' . sizeof($_TABLES) . ' tables to InnoDB took ' . $exectime . ' seconds.<p>' . LB; } else { echo '<p>Sorry, your database does not support InnoDB tables.</p>' . LB; } echo COM_endBlock();
public function test_SetElapsedTime() { $this->t->setStartTime(0.5600000000000001); $this->t->setEndTime(0.66); $this->assertEquals(0.1, $this->t->getElapsedTime(), '', $this->prec); }