我在来自 Joomla 和 Jomsocial 的 PHP 和 MySQL 应用程序上收到以下错误:
[05-Apr-2013 12:23:45 America/Denver] PHP Notice: Undefined index: query in /home2
/robervl4/public_html/forum/components/com_community/community.php on line 50
这不是开箱即用的。该应用程序按应有的方式显示数据库中的产品,唯一的问题是我收到此错误。
这是文件的 PHP 代码,第 50 行是:
parse_str($parts['query'], $qstring);
代码:
// DISABLE FORMAT=FEED for now 17Jan13 as requested by Fuqaha
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$viewType = $jinput->request->get('format', 'html','NONE');
if(strtolower($viewType)=='feed') {
$u = JFactory::getURI();
$parts = parse_url($u->toString());
parse_str($parts['query'], $qstring);
unset($qstring['format']);
$parts['query'] = http_build_query($qstring) ;
//recompose the URL to redirect
$scheme = isset($parts['scheme']) ? $parts['scheme'] . '://' : '';
$host = isset($parts['host']) ? $parts['host'] : '';
$port = isset($parts['port']) ? ':' . $parts['port'] : '';
$path = isset($parts['path']) ? $parts['path'] : '';
$query = isset($parts['query']) ? '?' . $parts['query'] : '';
$fragment = isset($parts['fragment']) ? '#' . $parts['fragment'] : '';
$mainframe->redirect(CRoute::_("$scheme$host$port$path$query$fragment"));
exit('Redirecting to Non-Feed page');
}