本文整理汇总了PHP中Piwik\Piwik::checkUserHasSuperUserAccess方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserHasSuperUserAccess方法的具体用法?PHP Piwik::checkUserHasSuperUserAccess怎么用?PHP Piwik::checkUserHasSuperUserAccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::checkUserHasSuperUserAccess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Mobile Messaging Settings tab :
* - set delegated management
* - provide & validate SMS API credential
* - add & activate phone numbers
* - check remaining credits
*/
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@MobileMessaging/index');
$this->setManageVariables($view);
return $view->render();
}
示例2: index
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$limit = Common::getRequestVar('limit', 100, 'int');
// Render the Twig template templates/index.twig and assign the view variable answerToLife to the view.
return $this->renderTemplate('index', array('limit' => $limit));
}
示例3: index
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@TasksTimetable/index.twig');
$this->setGeneralVariablesView($view);
$tasks = Option::get('TaskScheduler.timetable');
if (!empty($tasks)) {
$tasks = unserialize($tasks);
}
if (empty($tasks)) {
$tasks = array();
} else {
asort($tasks);
}
$tsNow = Date::now()->getTimestamp();
$dateFormat = Piwik::translate(Date::DATE_FORMAT_LONG) . ' h:mm:ss';
$formatter = new Formatter();
$tasksFormatted = array();
foreach ($tasks as $name => $timestamp) {
$tasksFormatted[] = array('name' => $name, 'executionDate' => Date::factory($timestamp)->getLocalized($dateFormat), 'ts_difference' => $formatter->getPrettyTimeFromSeconds($timestamp - $tsNow));
}
$view->currentTime = Date::now()->getLocalized($dateFormat);
$view->tasks = $tasksFormatted;
return $view->render();
}
示例4: configfile
public function configfile()
{
Piwik::checkUserHasSuperUserAccess();
$allSettings = Settings\Manager::getAllPluginSettings();
$configValues = $this->configReader->getConfigValuesFromFiles();
$configValues = $this->configReader->addConfigValuesFromPluginSettings($configValues, $allSettings);
$configValues = $this->sortConfigValues($configValues);
return $this->renderTemplate('configfile', array('allConfigValues' => $configValues));
}
示例5: index
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@IP2Location/index');
$view->language = LanguagesManager::getLanguageCodeForCurrentUser();
$this->setBasicVariablesView($view);
$view->adminMenu = MenuAdmin::getInstance()->getMenu();
$view->topMenu = MenuTop::getInstance()->getMenu();
$view->notifications = NotificationManager::getAllNotificationsToDisplay();
$view->userMenu = MenuUser::getInstance()->getMenu();
$view->phpVersion = phpversion();
$view->phpIsNewEnough = version_compare($view->phpVersion, '5.3.0', '>=');
$view->assign('userMenu', 'IP2Location');
$view->assign('dbNotFound', false);
$view->assign('dbOutDated', false);
$view->assign('showResults', false);
$view->assign('fileName', '-');
$view->assign('date', '-');
$view->assign('country', '');
$view->assign('regionName', '');
$view->assign('cityName', '');
$view->assign('position', '');
$ipAddress = trim(Common::getRequestVar('ipAddress', $_SERVER['REMOTE_ADDR']));
$view->assign('ipAddress', $ipAddress);
$dbPath = PIWIK_INCLUDE_PATH . '/plugins/IP2Location/data/';
$dbFile = '';
if ($handle = opendir($dbPath)) {
while (false !== ($file = readdir($handle))) {
if (strtoupper(substr($file, -4)) == '.BIN') {
$dbFile = $dbPath . $file;
break;
}
}
closedir($handle);
}
if (!$dbFile) {
$view->assign('dbNotFound', true);
}
if ($dbFile) {
$view->assign('fileName', $file);
if (filemtime($dbFile) < strtotime('-2 months')) {
$view->assign('dbOutDated', true);
} else {
$view->assign('date', date('d M, Y', filemtime($dbFile)));
}
if (!empty($_POST)) {
$view->assign('showResults', true);
$result = IP2LocationAPI::lookup($ipAddress, $dbFile);
$view->assign('country', $result['countryCode'] != '-' ? $result['countryName'] . ' (' . $result['countryCode'] . ')' : '-');
$view->assign('regionName', !preg_match('/not supported/', $result['regionName']) ? $result['regionName'] : '-');
$view->assign('cityName', !preg_match('/not supported/', $result['cityName']) ? $result['cityName'] : '-');
$view->assign('position', !preg_match('/not supported/', $result['latitude']) && $result['latitude'] != '-' ? $result['latitude'] . ', ' . $result['longitude'] : '-');
}
}
echo $view->render();
}
示例6: configfile
public function configfile()
{
Piwik::checkUserHasSuperUserAccess();
$settings = new SettingsProvider(\Piwik\Plugin\Manager::getInstance());
$allSettings = $settings->getAllSystemSettings();
$configValues = $this->configReader->getConfigValuesFromFiles();
$configValues = $this->configReader->addConfigValuesFromSystemSettings($configValues, $allSettings);
$configValues = $this->sortConfigValues($configValues);
return $this->renderTemplate('configfile', array('allConfigValues' => $configValues));
}
示例7: testAllSizes
public function testAllSizes()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@ImageGraph/testAllSizes');
$this->setGeneralVariablesView($view);
$period = Common::getRequestVar('period', 'day', 'string');
$date = Common::getRequestVar('date', 'today', 'string');
$_GET['token_auth'] = Piwik::getCurrentUserTokenAuth();
$availableReports = APIPlugins::getInstance()->getReportMetadata($this->idSite, $period, $date);
$view->availableReports = $availableReports;
$view->graphTypes = array('');
$view->graphSizes = array(array(null, null), array(460, 150), array(300, 150), array(240, 150), array(800, 150), array(600, 300, $fontSize = 18, 300, 150));
return $view->render();
}
示例8: index
/**
* Returns the index for this plugin. Shows every other report defined by this plugin,
* except the '...ByYear' reports. These can be loaded as related reports.
*
* Also, the 'getIndividual...Summary' reports are loaded by AJAX, as they can take
* a significant amount of time to load on setups w/ lots of websites.
*/
public function index()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@DBStats/index');
$this->setBasicVariablesView($view);
$view->databaseUsageSummary = $this->renderReport(new GetDatabaseUsageSummary());
$view->trackerDataSummary = $this->renderReport(new GetTrackerDataSummary());
$view->metricDataSummary = $this->renderReport(new GetMetricDataSummary());
$view->reportDataSummary = $this->renderReport(new GetReportDataSummary());
$view->adminDataSummary = $this->renderReport(new GetAdminDataSummary());
list($siteCount, $userCount, $totalSpaceUsed) = API::getInstance()->getGeneralInformation();
$view->siteCount = MetricsFormatter::getPrettyNumber($siteCount);
$view->userCount = MetricsFormatter::getPrettyNumber($userCount);
$view->totalSpaceUsed = MetricsFormatter::getPrettySizeFromBytes($totalSpaceUsed);
return $view->render();
}
示例9: oneClickUpdate
public function oneClickUpdate()
{
Piwik::checkUserHasSuperUserAccess();
$view = new OneClickDone(Piwik::getCurrentUserTokenAuth());
$useHttps = Common::getRequestVar('https', 1, 'int');
try {
$messages = $this->updater->updatePiwik($useHttps);
} catch (ArchiveDownloadException $e) {
$view->httpsFail = $useHttps;
$view->error = $e->getMessage();
$messages = $e->getUpdateLogMessages();
} catch (UpdaterException $e) {
$view->error = $e->getMessage();
$messages = $e->getUpdateLogMessages();
}
$view->feedbackMessages = $messages;
$this->addCustomLogoInfo($view);
return $view->render();
}
示例10: saveLicenseKey
/**
* Saves the given license key in case the key is actually valid (exists on the Piwik Marketplace and is not
* yet expired).
*
* @param string $licenseKey
* @return bool
*
* @throws Exception In case of an invalid license key
* @throws Service\Exception In case of any network problems
*/
public function saveLicenseKey($licenseKey)
{
Piwik::checkUserHasSuperUserAccess();
$licenseKey = trim($licenseKey);
// we are currently using the Marketplace service directly to 1) change LicenseKey and 2) not use any cache
$this->marketplaceService->authenticate($licenseKey);
try {
$consumer = $this->marketplaceService->fetch('consumer/validate', array());
} catch (Api\Service\Exception $e) {
if ($e->getCode() === Api\Service\Exception::HTTP_ERROR) {
throw $e;
}
$consumer = array();
}
if (empty($consumer['isValid'])) {
throw new Exception(Piwik::translate('Marketplace_ExceptionLinceseKeyIsNotValid'));
}
$this->setLicenseKey($licenseKey);
return true;
}
示例11: adminIndex
public function adminIndex()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@GeoIpChain/adminIndex');
$providerHandler = new LocationProvider();
$providers = [];
foreach ($providerHandler->getProviders() as $provider) {
/* @var $provider \Piwik\Plugins\GeoIpChain\Provider\AbstractProvider */
$data = ['name' => $provider->getName(), 'isWorking' => $provider->isWorking(), 'usedFile' => null, 'doesSupportIpV4' => $provider->doesSupportIpV4(), 'doesSupportIpV6' => $provider->doesSupportIpV6(), 'supportFields' => $provider->getSupportedFields()];
if ($provider instanceof LocaleAwareProvider) {
$provider->setLocale(\Locale::acceptFromHttp($this->getUsedAcceptLanguage()));
}
if ($provider instanceof FileAwareProvider) {
$data['usedFile'] = $provider->getFile();
}
$data['result'] = false;
if ($provider->isWorking() === true) {
try {
/* @var $result \Geocoder\Model\AddressCollection */
$result = $provider->geocode($this->getUsedIp());
/* @var $firstResult \Geocoder\Model\Address */
$firstResult = $result->first();
$data['result'] = $firstResult->toArray();
} catch (NoResult $ex) {
} catch (UnsupportedOperation $ex) {
}
}
$providers[] = $data;
}
$view->usedIp = $this->getUsedIp();
$view->defaultIp = $this->getDefaultIp();
$view->usedAcceptLanguage = $this->getUsedAcceptLanguage();
$view->defaultAcceptLanguage = $this->getDefaultAcceptLanguage();
$view->providers = $providers;
$this->setBasicVariablesView($view);
$this->setBasicVariablesAdminView($view);
return $view->render();
}
示例12: oneClickUpdate
public function oneClickUpdate()
{
Piwik::checkUserHasSuperUserAccess();
$this->newVersion = $this->checkNewVersionIsAvailableOrDie();
SettingsServer::setMaxExecutionTime(0);
$url = self::getLatestZipUrl($this->newVersion);
$steps = array(array('oneClick_Download', Piwik::translate('CoreUpdater_DownloadingUpdateFromX', $url)), array('oneClick_Unpack', Piwik::translate('CoreUpdater_UnpackingTheUpdate')), array('oneClick_Verify', Piwik::translate('CoreUpdater_VerifyingUnpackedFiles')), array('oneClick_CreateConfigFileBackup', Piwik::translate('CoreUpdater_CreatingBackupOfConfigurationFile', self::CONFIG_FILE_BACKUP)));
$incompatiblePlugins = $this->getIncompatiblePlugins($this->newVersion);
if (!empty($incompatiblePlugins)) {
$namesToDisable = array();
foreach ($incompatiblePlugins as $incompatiblePlugin) {
$namesToDisable[] = $incompatiblePlugin->getPluginName();
}
$steps[] = array('oneClick_DisableIncompatiblePlugins', Piwik::translate('CoreUpdater_DisablingIncompatiblePlugins', implode(', ', $namesToDisable)));
}
$steps[] = array('oneClick_Copy', Piwik::translate('CoreUpdater_InstallingTheLatestVersion'));
$steps[] = array('oneClick_Finished', Piwik::translate('CoreUpdater_PiwikUpdatedSuccessfully'));
$errorMessage = false;
$messages = array();
foreach ($steps as $step) {
try {
$method = $step[0];
$message = $step[1];
$this->{$method}();
$messages[] = $message;
} catch (Exception $e) {
$errorMessage = $e->getMessage();
break;
}
}
$view = new OneClickDone(Piwik::getCurrentUserTokenAuth());
$view->coreError = $errorMessage;
$view->feedbackMessages = $messages;
$this->addCustomLogoInfo($view);
return $view->render();
}
示例13: admin
/**
* @return string
*/
public function admin()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@LoginLdap/index');
ControllerAdmin::setBasicVariablesAdminView($view);
if (!function_exists('ldap_connect')) {
$notification = new Notification(Piwik::translate('LoginLdap_LdapFunctionsMissing'));
$notification->context = Notification::CONTEXT_ERROR;
$notification->type = Notification::TYPE_PERSISTENT;
Notification\Manager::notify('LoginLdap_LdapFunctionsMissing', $notification);
}
$this->setBasicVariablesView($view);
$serverNames = Config::getServerNameList() ?: array();
$view->servers = array();
if (empty($serverNames)) {
try {
$serverInfo = ServerInfo::makeFromOldConfig()->getProperties();
$serverInfo['name'] = 'server';
$view->servers[] = $serverInfo;
} catch (Exception $ex) {
// ignore
}
} else {
foreach ($serverNames as $server) {
$serverConfig = Config::getServerConfig($server);
if (!empty($serverConfig)) {
$serverConfig['name'] = $server;
$view->servers[] = $serverConfig;
}
}
}
$view->ldapConfig = Config::getPluginOptionValuesWithDefaults();
$view->isLoginControllerActivated = PluginManager::getInstance()->isPluginActivated('Login');
$view->updatedFromPre30 = Option::get('LoginLdap_updatedFromPre3_0');
return $view->render();
}
示例14: systemCheckPage
/**
* This controller action renders an admin tab that runs the installation
* system check, so people can see if there are any issues w/ their running
* Piwik installation.
*
* This admin tab is only viewable by the Super User.
*/
public function systemCheckPage()
{
Piwik::checkUserHasSuperUserAccess();
$view = new View('@Installation/systemCheckPage', $this->getInstallationSteps(), __FUNCTION__);
$this->setBasicVariablesView($view);
$view->duringInstall = false;
$this->setupSystemCheckView($view);
$infos = $view->infos;
$infos['extra'] = SystemCheck::performAdminPageOnlySystemCheck();
$view->infos = $infos;
return $view->render();
}
示例15: runScheduledTasks
/**
* Will run all scheduled tasks due to run at this time.
*
* @return array
*/
public function runScheduledTasks()
{
Piwik::checkUserHasSuperUserAccess();
return TaskScheduler::runTasks();
}