本文整理汇总了PHP中Piwik\Piwik::checkUserIsSuperUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserIsSuperUser方法的具体用法?PHP Piwik::checkUserIsSuperUser怎么用?PHP Piwik::checkUserIsSuperUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Piwik
的用法示例。
在下文中一共展示了Piwik::checkUserIsSuperUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAllSizes
public function testAllSizes()
{
Piwik::checkUserIsSuperUser();
$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();
}
示例2: getAdminDataSummary
/**
* Shows a datatable that displays the amount of space each 'admin' table takes
* up in the MySQL database.
*
* An 'admin' table is a table that is not central to analytics functionality.
* So any table that isn't an archive table or a log table is an 'admin' table.
*
* @return string|void
*/
public function getAdminDataSummary()
{
Piwik::checkUserIsSuperUser();
return $this->renderReport(__FUNCTION__);
}
示例3: oneClickResults
public function oneClickResults()
{
Request::reloadAuthUsingTokenAuth($_POST);
Piwik::checkUserIsSuperUser();
$view = new View('@CoreUpdater/oneClickResults');
$view->coreError = Common::getRequestVar('error', '', 'string', $_POST);
$view->feedbackMessages = safe_unserialize(Common::unsanitizeInputValue(Common::getRequestVar('messages', '', 'string', $_POST)));
return $view->render();
}
示例4: deleteUser
/**
* Delete a user and all its access, given its login.
*
* @param string $userLogin the user login.
*
* @throws Exception if the user doesn't exist
*
* @return bool true on success
*/
public function deleteUser($userLogin)
{
Piwik::checkUserIsSuperUser();
$this->checkUserIsNotAnonymous($userLogin);
$this->checkUserIsNotSuperUser($userLogin);
if (!$this->userExists($userLogin)) {
throw new Exception(Piwik::translate("UsersManager_ExceptionDeleteDoesNotExist", $userLogin));
}
$this->deleteUserOnly($userLogin);
$this->deleteUserAccess($userLogin);
Cache::deleteTrackerCache();
}
示例5: initPluginModification
protected function initPluginModification($nonceName)
{
Piwik::checkUserIsSuperUser();
$nonce = Common::getRequestVar('nonce', null, 'string');
if (!Nonce::verifyNonce($nonceName, $nonce)) {
throw new \Exception(Piwik::translate('General_ExceptionNonceMismatch'));
}
Nonce::discardNonce($nonceName);
$pluginName = Common::getRequestVar('pluginName', null, 'string');
return $pluginName;
}
示例6: activateDoNotTrack
public function activateDoNotTrack()
{
Piwik::checkUserIsSuperUser();
Nonce::checkNonce(self::ACTIVATE_DNT_NONCE);
DoNotTrackHeaderChecker::activate();
$this->redirectToIndex('PrivacyManager', 'privacySettings');
}
示例7: uploadCustomLogo
public function uploadCustomLogo()
{
Piwik::checkUserIsSuperUser();
$logo = new CustomLogo();
$success = $logo->copyUploadedLogoToFilesystem();
if ($success) {
return '1';
}
return '0';
}
示例8: setDelegatedManagement
/**
* Specify if normal users can manage their own SMS API credential
*
* @param bool $delegatedManagement false if SMS API credential only manageable by super admin, true otherwise
*/
public function setDelegatedManagement($delegatedManagement)
{
Piwik::checkUserIsSuperUser();
Option::set(MobileMessaging::DELEGATED_MANAGEMENT_OPTION, $delegatedManagement);
}
示例9: 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::checkUserIsSuperUser();
$view = new View('@Installation/systemCheckPage', $this->getInstallationSteps(), __FUNCTION__);
$this->setBasicVariablesView($view);
$view->duringInstall = false;
$this->setupSystemCheckView($view);
$infos = $view->infos;
$infos['extra'] = self::performAdminPageOnlySystemCheck();
$view->infos = $infos;
return $view->render();
}
示例10: getUniqueSiteTimezones
/**
* Returns the list of unique timezones from all configured sites.
*
* @return array ( string )
*/
public function getUniqueSiteTimezones()
{
Piwik::checkUserIsSuperUser();
$results = Db::fetchAll("SELECT distinct timezone FROM " . Common::prefixTable('site'));
$timezones = array();
foreach ($results as $result) {
$timezones[] = $result['timezone'];
}
return $timezones;
}
示例11: recordAnonymousUserSettings
/**
* Records settings for the anonymous users (default report, default date)
*/
public function recordAnonymousUserSettings()
{
$response = new ResponseBuilder(Common::getRequestVar('format'));
try {
Piwik::checkUserIsSuperUser();
$this->checkTokenInUrl();
$anonymousDefaultReport = Common::getRequestVar('anonymousDefaultReport');
$anonymousDefaultDate = Common::getRequestVar('anonymousDefaultDate');
$userLogin = 'anonymous';
APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT, $anonymousDefaultReport);
APIUsersManager::getInstance()->setUserPreference($userLogin, APIUsersManager::PREFERENCE_DEFAULT_REPORT_DATE, $anonymousDefaultDate);
$toReturn = $response->getResponse();
} catch (Exception $e) {
$toReturn = $response->getResponseException($e);
}
return $toReturn;
}
示例12: removeAllPluginSettings
/**
* Removes all settings for this plugin from the database. Useful when uninstalling
* a plugin.
*/
public function removeAllPluginSettings()
{
Piwik::checkUserIsSuperUser();
Option::delete($this->getOptionKey());
$this->settingsValues = array();
}
示例13: setCurrentLocationProvider
/**
* Sets the current LocationProvider type.
*
* Input:
* Requires the 'id' query parameter to be set to the desired LocationProvider's ID.
*
* Output:
* Nothing.
*/
public function setCurrentLocationProvider()
{
$this->dieIfGeolocationAdminIsDisabled();
Piwik::checkUserIsSuperUser();
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$this->checkTokenInUrl();
$providerId = Common::getRequestVar('id');
$provider = LocationProvider::setCurrentProvider($providerId);
if ($provider === false) {
throw new Exception("Invalid provider ID: '{$providerId}'.");
}
return 1;
}
}
示例14: getIndividualMetricsSummary
/**
* Returns a datatable describing how much total space is taken up by each
* individual metric type.
*
* Goal metrics, metrics of the format .*_[0-9]+ and 'done...' metrics are grouped together.
*
* @param bool $forceCache false to use the cached result, true to run the queries again and
* cache the result.
* @return DataTable A datatable with three columns: 'data_size', 'index_size', 'row_count'.
*/
public function getIndividualMetricsSummary($forceCache = false)
{
Piwik::checkUserIsSuperUser();
return $this->metadataProvider->getRowCountsAndSizeByMetricName($forceCache);
}
示例15: count
set_time_limit(0);
@date_default_timezone_set('UTC');
require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php';
require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php';
require_once PIWIK_INCLUDE_PATH . '/core/Loader.php';
$GLOBALS['PIWIK_TRACKER_DEBUG'] = false;
define('PIWIK_ENABLE_DISPATCH', false);
Config::getInstance()->log['log_writers'][] = 'screen';
Config::getInstance()->log['log_level'] = 'VERBOSE';
FrontController::getInstance()->init();
$query = "SELECT count(*) FROM " . Common::prefixTable('log_visit');
$count = Db::fetchOne($query);
// when script run via browser, check for Super User & output html page to do conversion via AJAX
if (!Common::isPhpCliMode()) {
try {
Piwik::checkUserIsSuperUser();
} catch (Exception $e) {
Log::error('[error] You must be logged in as Super User to run this script. Please login in to Piwik and refresh this page.');
exit;
}
// the 'start' query param will be supplied by the AJAX requests, so if it's not there, the
// user is viewing the page in the browser.
if (Common::getRequestVar('start', false) === false) {
// output HTML page that runs update via AJAX
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<script type="text/javascript" src="../../libs/jquery/jquery.js"></script>
<script type="text/javascript">
(function ($) {