/** * Submits a bug report to Dioscouri. * Thanks so much! They really help improve the product! */ function sendBug() { $mainframe = JFactory::getApplication(); $body = JRequest::getVar('body'); $name = JRequest::getVar('title'); $body .= "\n\n Project: tienda"; $body .= "\n Tracker: Bug"; $body .= "\n Affected Version: " . Tienda::getVersion(); $doc = JDocument::getInstance('raw'); ob_start(); $option = JRequest::getCmd('option'); $db = JFactory::getDBO(); $path = JPATH_ADMINISTRATOR . '/components/com_admin/'; require_once $path . 'admin.admin.html.php'; $path .= 'tmpl/'; require_once $path . 'sysinfo_system.php'; require_once $path . 'sysinfo_directory.php'; require_once $path . 'sysinfo_phpinfo.php'; require_once $path . 'sysinfo_phpsettings.php'; require_once $path . 'sysinfo_config.php'; jimport('joomla.filesystem.file'); $contents = ob_get_contents(); ob_end_clean(); $doc->setBuffer($contents); $contents = $doc->render(); $sitename = $config->get('sitename', $mainframe->getCfg('sitename')); // write file with info $config = JFactory::getConfig(); $filename = 'system_info_' . $sitename . '.html'; $file = JPATH_SITE . '/tmp/' . $filename; JFile::write($file, $contents); $mailer = JFactory::getMailer(); $success = false; // For now, bug submission goes to info@dioscouri.com, // but in the future, it will go to projects@dioscouri.com // (once we get the Redmine auto-create working properly // and format the subject/body of the email properly) $mailer->addRecipient('*****@*****.**'); $mailer->setSubject($name); $mailfrom = $config->get('emails_defaultemail', $mainframe->getCfg('mailfrom')); $fromname = $config->get('emails_defaultname', $mainframe->getCfg('fromname')); // check user mail format type, default html $mailer->setBody($body); $mailer->addAttachment($file); $sender = array($mailfrom, $fromname); $mailer->setSender($sender); $sent = $mailer->send(); if ($sent == '1') { $success = true; } JFile::delete($file); if ($success) { $msg = JText::_('COM_TIENDA_BUG_SUBMIT_OK'); $msgtype = 'message'; } else { $msg = JText::_('COM_TIENDA_BUG_SUBMIT_FAIL'); $msgtype = 'notice'; } $mainframe->redirect(JRoute::_('index.php?option=com_tienda&view=dashboard'), $msg, $msgtype); }