function show_stats() { $mainframe = JFactory::getApplication(); $user = JFactory::getUser(); $db = JFactory::getDBO(); $form_id = JRequest::getVar('form_id'); $row = JTable::getInstance('formmaker', 'Table'); $row->load($form_id); if (!$user->authorise('core.manage.submits', 'com_formmaker')) { if ($user->authorise('core.manage.submits.own', 'com_formmaker') && $row->created_by != $user->id) { $mainframe->redirect("index.php?option=com_formmaker", JText::_('JACCESS_NOT_PERMITTED'), 'error'); } } $id = JRequest::getVar('id'); $from = JRequest::getVar('from'); $to = JRequest::getVar('to'); $where = ' AND form_id=' . $form_id; if ($from != '') { $where .= " AND `date`>='" . $from . " 00:00:00' "; } if ($to != '') { $where .= " AND `date`<='" . $to . " 23:59:59' "; } $query = "SELECT element_value FROM #__formmaker_submits WHERE element_label='" . $db->escape((int) $id) . "'" . $where; $db->setQuery($query); $choices = $db->loadObjectList(); if ($db->getErrorNum()) { echo $db->stderr(); return false; } HTML_contact::show_stats($choices); }