当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik::checkUserIsSuperUser方法代码示例

本文整理汇总了PHP中Piwik::checkUserIsSuperUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkUserIsSuperUser方法的具体用法?PHP Piwik::checkUserIsSuperUser怎么用?PHP Piwik::checkUserIsSuperUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik的用法示例。


在下文中一共展示了Piwik::checkUserIsSuperUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAllTablesStatus

 public static function getAllTablesStatus()
 {
     Piwik::checkUserIsSuperUser();
     $db = Zend_Registry::get('db');
     // http://dev.mysql.com/doc/refman/5.1/en/show-table-status.html
     $tablesPiwik = Piwik::getTablesInstalled();
     $total = array('Name' => 'Total', 'Data_length' => 0, 'Index_length' => 0, 'Rows' => 0);
     $table = array();
     foreach ($tablesPiwik as $tableName) {
         $t = self::getTableStatus($tableName);
         $total['Data_length'] += $t['Data_length'];
         $total['Index_length'] += $t['Index_length'];
         $total['Rows'] += $t['Rows'];
         $t['Total_length'] = Piwik::getPrettySizeFromBytes($t['Index_length'] + $t['Data_length']);
         $t['Data_length'] = Piwik::getPrettySizeFromBytes($t['Data_length']);
         $t['Index_length'] = Piwik::getPrettySizeFromBytes($t['Index_length']);
         $t['Rows'] = Piwik::getPrettySizeFromBytes($t['Rows']);
         $table[] = $t;
     }
     $total['Total_length'] = Piwik::getPrettySizeFromBytes($total['Data_length'] + $total['Index_length']);
     $total['Data_length'] = Piwik::getPrettySizeFromBytes($total['Data_length']);
     $total['Index_length'] = Piwik::getPrettySizeFromBytes($total['Index_length']);
     $total['TotalRows'] = Piwik::getPrettySizeFromBytes($total['Rows']);
     $table['Total'] = $total;
     return $table;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:26,代码来源:API.php

示例2: oneClickUpdate

 public function oneClickUpdate()
 {
     Piwik::checkUserIsSuperUser();
     $this->newVersion = $this->checkNewVersionIsAvailableOrDie();
     Piwik::setMaxExecutionTime(0);
     $url = Zend_Registry::get('config')->General->latest_version_url;
     $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)), array('oneClick_Copy', Piwik_Translate('CoreUpdater_InstallingTheLatestVersion')), 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 = Piwik_View::factory('update_one_click_done');
     $view->coreError = $errorMessage;
     $view->feedbackMessages = $messages;
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:25,代码来源:Controller.php

示例3: setGeneralSettings

 public function setGeneralSettings()
 {
     Piwik::checkUserIsSuperUser();
     $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format'));
     try {
         $this->checkTokenInUrl();
         $enableBrowserTriggerArchiving = Piwik_Common::getRequestVar('enableBrowserTriggerArchiving');
         $todayArchiveTimeToLive = Piwik_Common::getRequestVar('todayArchiveTimeToLive');
         Piwik_ArchiveProcessing::setBrowserTriggerArchiving((bool) $enableBrowserTriggerArchiving);
         Piwik_ArchiveProcessing::setTodayArchiveTimeToLive($todayArchiveTimeToLive);
         // Update email settings
         $mail = Zend_Registry::get('config')->mail;
         $mail->transport = Piwik_Common::getRequestVar('mailUseSmtp') == '1' ? 'smtp' : '';
         $mail->port = Piwik_Common::getRequestVar('mailPort', '');
         $mail->host = Piwik_Common::getRequestVar('mailHost', '');
         $mail->type = Piwik_Common::getRequestVar('mailType', '');
         $mail->username = Piwik_Common::getRequestVar('mailUsername', '');
         $mail->password = Piwik_Common::getRequestVar('mailPassword', '');
         $mail->encryption = Piwik_Common::getRequestVar('mailEncryption', '');
         Zend_Registry::get('config')->mail = $mail->toArray();
         $toReturn = $response->getResponse();
     } catch (Exception $e) {
         $toReturn = $response->getResponseException($e);
     }
     echo $toReturn;
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:26,代码来源:Controller.php

示例4: activate

 function activate()
 {
     Piwik::checkUserIsSuperUser();
     $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
     Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
     Piwik_Url::redirectToUrl('index.php?module=CorePluginsAdmin');
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:7,代码来源:Controller.php

示例5: activate

 public function activate()
 {
     Piwik::checkUserIsSuperUser();
     $this->checkTokenInUrl();
     $pluginName = Piwik_Common::getRequestVar('pluginName', null, 'string');
     Piwik_PluginsManager::getInstance()->activatePlugin($pluginName);
     Piwik_Url::redirectToReferer();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:8,代码来源:Controller.php

示例6: index

	function index()
	{
		Piwik::checkUserIsSuperUser();
		$view = Piwik_View::factory('DBStats');
		$view->tablesStatus = Piwik_DBStats_API::getInstance()->getAllTablesStatus();
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		echo $view->render();		
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:9,代码来源:Controller.php

示例7: oneClickResults

 public function oneClickResults()
 {
     Piwik_API_Request::reloadAuthUsingTokenAuth($_POST);
     Piwik::checkUserIsSuperUser();
     $view = Piwik_View::factory('update_one_click_results');
     $view->coreError = Piwik_Common::getRequestVar('error', '', 'string', $_POST);
     $view->feedbackMessages = safe_unserialize(Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('messages', '', 'string', $_POST)));
     echo $view->render();
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:9,代码来源:Controller.php

示例8: getLastVisits

 public function getLastVisits($idSite = false, $limit = 10, $minIdVisit = false)
 {
     if (is_null($idSite)) {
         Piwik::checkUserIsSuperUser();
     } else {
         Piwik::checkUserHasViewAccess($idSite);
     }
     $visitorDetails = self::loadLastVisitorDetailsFromDatabase(null, $idSite, $limit, $minIdVisit);
     $table = self::getCleanedVisitorsFromDetails($visitorDetails);
     return $table;
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:11,代码来源:API.php

示例9: generate

	public function generate() 
	{
		Piwik::checkUserIsSuperUser();
		$nonce = Piwik_Common::getRequestVar('form_nonce', '', 'string', $_POST);
		if(Piwik_Common::getRequestVar('choice', 'no') != 'yes' ||
				!Piwik_Nonce::verifyNonce('Piwik_VisitorGenerator.generate', $nonce))
		{
			Piwik::redirectToModule('VisitorGenerator', 'index');
		}
		Piwik_Nonce::discardNonce('Piwik_VisitorGenerator.generate');

		$daysToCompute = Piwik_Common::getRequestVar('daysToCompute', 1, 'int');

		// get idSite from POST with fallback to GET
		$idSite = Piwik_Common::getRequestVar('idSite', false, 'int', $_GET);
		$idSite = Piwik_Common::getRequestVar('idSite', $idSite, 'int', $_POST);

		Piwik::setMaxExecutionTime(0);

		$timer = new Piwik_Timer;
		$time = time() - ($daysToCompute-1)*86400;
		
		// Update site.ts_created if we generate visits on days before the website was created
		$site = new Piwik_Site($idSite);
		$minGeneratedDate = Piwik_Date::factory($time);
		if($minGeneratedDate->isEarlier($site->getCreationDate()))
		{
			// direct access to the website table (bad practise but this is a debug / dev plugin)
    		Zend_Registry::get('db')->update(Piwik_Common::prefixTable("site"), 
    							array('ts_created' =>  $minGeneratedDate->getDatetime()),
    							"idsite = $idSite");
		}
		
		$nbActionsTotal = 0;
		while($time <= time()) 
		{
			$nbActionsTotalThisDay = $this->generateVisits($time, $idSite);
			$time += 86400;
			$nbActionsTotal += $nbActionsTotalThisDay;
		}

		// Init view
		$view = Piwik_View::factory('generate');
		$this->setBasicVariablesView($view);
		$view->menu = Piwik_GetAdminMenu();
		$view->assign('timer', $timer);
		$view->assign('days', $daysToCompute);
		$view->assign('nbActionsTotal', $nbActionsTotal);
		$view->assign('nbRequestsPerSec', round($nbActionsTotal / $timer->getTime(),0));
		echo $view->render();
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:51,代码来源:Controller.php

示例10: testAllSizes

 public function testAllSizes()
 {
     Piwik::checkUserIsSuperUser();
     $view = Piwik_View::factory('debug_graphs_all_sizes');
     $this->setGeneralVariablesView($view);
     $period = Piwik_Common::getRequestVar('period', 'day', 'string');
     $date = Piwik_Common::getRequestVar('date', 'today', 'string');
     $_GET['token_auth'] = Piwik::getCurrentUserTokenAuth();
     $availableReports = Piwik_API_API::getInstance()->getReportMetadata($this->idSite, $period, $date);
     $view->availableReports = $availableReports;
     $view->graphTypes = array('');
     $view->graphSizes = array(array(null, null), array(Piwik_ReportRenderer::IMAGE_GRAPH_WIDTH, Piwik_ReportRenderer::IMAGE_GRAPH_HEIGHT), array(460, 150), array(300, 150), array(240, 150), array(800, 150), array(600, 300, $fontSize = 18, 300, 150));
     echo $view->render();
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:14,代码来源:Controller.php

示例11: 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()
 {
     Piwik::checkUserIsSuperUser();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $this->checkTokenInUrl();
         $providerId = Piwik_Common::getRequestVar('id');
         $provider = Piwik_UserCountry_LocationProvider::setCurrentProvider($providerId);
         if ($provider === false) {
             throw new Exception("Invalid provider ID: '{$providerId}'.");
         }
         // make sure the tracker will use the new location provider
         Piwik_Common::regenerateCacheGeneral();
     }
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:23,代码来源:Controller.php

示例12: setSettings

 public function setSettings()
 {
     $response = new Piwik_API_ResponseBuilder(Piwik_Common::getRequestVar('format'));
     try {
         Piwik::checkUserIsSuperUser();
         $this->checkTokenInUrl();
         $mode = Piwik_Common::getRequestVar('TeraWurflMode');
         $url = Piwik_Common::getRequestVar('TeraWurflURL');
         $path = Piwik_Common::getRequestVar('TeraWurflPath');
         switch ($mode) {
             case 'TeraWurfl':
             case 'TeraWurflEnterprise':
                 if (!(file_exists($path) && (require_once $path))) {
                     echo $response->getResponseException(new Exception("Could not save settings: The file " . htmlentities($path) . " does not exist"));
                     return;
                 } elseif (!class_exists($mode)) {
                     echo $response->getResponseException(new Exception("Could not save settings: The file " . htmlentities($path) . " exists but does not contain the required class " . htmlentities($mode)));
                     return;
                 } else {
                     Piwik_MobileAnalytics::saveSetting('TeraWurflMode', $mode);
                     Piwik_MobileAnalytics::saveSetting('TeraWurflPath', $path);
                 }
                 break;
             case 'TeraWurflRemoteClient':
                 require_once PIWIK_INCLUDE_PATH . '/plugins/MobileAnalytics/TeraWurflRemoteClient.php';
                 try {
                     $this->wurflObj = new TeraWurflRemoteClient($url);
                     @$this->wurflObj->getCapabilitiesFromAgent(null, Piwik_MobileAnalytics::$requiredCapabilities);
                 } catch (Exception $e) {
                     echo $response->getResponseException(new Exception("Could not save settings: A request to the Tera-WURFL web service (" . htmlentities($url) . ") failed."));
                     return;
                 }
                 Piwik_MobileAnalytics::saveSetting('TeraWurflURL', $url);
                 Piwik_MobileAnalytics::saveSetting('TeraWurflMode', $mode);
                 break;
             default:
             case 'disabled':
                 Piwik_MobileAnalytics::saveSetting('TeraWurflMode', 'disabled');
                 break;
         }
         echo $response->getResponse();
     } catch (Exception $e) {
         echo $response->getResponseException($e);
     }
 }
开发者ID:kamermans,项目名称:MobileAnalytics,代码行数:45,代码来源:Controller.php

示例13: index

 function index()
 {
     Piwik::checkUserIsSuperUser();
     require_once dirname(__FILE__) . '/PhpSecInfo/PhpSecInfo.php';
     // instantiate the class
     $psi = new PhpSecInfo();
     // load and run all tests
     $psi->loadAndRun();
     // grab the results as a multidimensional array
     $results = $psi->getResultsAsArray();
     // suppress results
     unset($results['test_results']['Core']['memory_limit']);
     unset($results['test_results']['Core']['post_max_size']);
     unset($results['test_results']['Core']['upload_max_filesize']);
     $view = Piwik_View::factory('index');
     $this->setGeneralVariablesView($view);
     $view->menu = Piwik_GetAdminMenu();
     $view->results = $results;
     echo $view->render();
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:20,代码来源:Controller.php

示例14: getDeleteLogsInfo

 protected function getDeleteLogsInfo()
 {
     Piwik::checkUserIsSuperUser();
     $deleteLogsInfos = array();
     $taskScheduler = new Piwik_TaskScheduler();
     $deleteLogsInfos["config"] = Zend_Registry::get('config')->Deletelogs->toArray();
     $privacyManager = new Piwik_PrivacyManager();
     $deleteLogsInfos["deleteTables"] = implode(", ", $privacyManager->getDeleteTableLogTables());
     $scheduleTimetable = $taskScheduler->getScheduledTimeForTask("Piwik_PrivacyManager", "deleteLogTables");
     $optionTable = Piwik_GetOption(self::OPTION_LAST_DELETE_PIWIK_LOGS);
     //If task was already rescheduled, read time from taskTimetable. Else, calculate next possible runtime.
     if (!empty($scheduleTimetable) && $scheduleTimetable - time() > 0) {
         $nextPossibleSchedule = (int) $scheduleTimetable;
     } else {
         $date = Piwik_Date::factory("today");
         $nextPossibleSchedule = $date->addDay(1)->getTimestamp();
     }
     //deletion schedule did not run before
     if (empty($optionTable)) {
         $deleteLogsInfos["lastRun"] = false;
         //next run ASAP (with next schedule run)
         $date = Piwik_Date::factory("today");
         $deleteLogsInfos["nextScheduleTime"] = $nextPossibleSchedule;
     } else {
         $deleteLogsInfos["lastRun"] = $optionTable;
         $deleteLogsInfos["lastRunPretty"] = Piwik_Date::factory((int) $optionTable)->getLocalized('%day% %shortMonth% %longYear%');
         //Calculate next run based on last run + interval
         $nextScheduleRun = (int) ($deleteLogsInfos["lastRun"] + $deleteLogsInfos["config"]["delete_logs_schedule_lowest_interval"] * 24 * 60 * 60);
         //is the calculated next run in the past? (e.g. plugin was disabled in the meantime or something) -> run ASAP
         if ($nextScheduleRun - time() <= 0) {
             $deleteLogsInfos["nextScheduleTime"] = $nextPossibleSchedule;
         } else {
             $deleteLogsInfos["nextScheduleTime"] = $nextScheduleRun;
         }
     }
     $deleteLogsInfos["nextRunPretty"] = Piwik::getPrettyTimeFromSeconds($deleteLogsInfos["nextScheduleTime"] - time());
     return $deleteLogsInfos;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:38,代码来源:Controller.php

示例15: oneClickUpdate

 public function oneClickUpdate()
 {
     Piwik::checkUserIsSuperUser();
     $this->checkNewVersionIsAvailableOrDie();
     $steps = array(array('oneClick_Download', Piwik_Translate('CoreUpdate_DownloadingUpdateFromX', self::LATEST_PIWIK_URL)), array('oneClick_Unpack', Piwik_Translate('CoreUpdate_UnpackingTheUpdate')), array('oneClick_Verify', Piwik_Translate('CoreUpdater_VerifyingUnpackedFiles')), array('oneClick_CreateConfigFileBackup', Piwik_Translate('CoreUpdater_CreatingBackupOfConfigurationFile', self::CONFIG_FILE_BACKUP)), array('oneClick_Copy', Piwik_Translate('CoreUpdater_InstallingTheLatestVersion')), 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 Piwik_View('CoreUpdater/templates/update_one_click_done.tpl');
     $view->coreError = $errorMessage;
     $view->feedbackMessages = $messages;
     echo $view->render();
 }
开发者ID:klando,项目名称:pgpiwik,代码行数:23,代码来源:Controller.php


注:本文中的Piwik::checkUserIsSuperUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。