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


PHP Piwik_Common::unsanitizeInputValue方法代码示例

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


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

示例1: __construct

    public function __construct($string, $idSites)
    {
    	$string = Piwik_Common::unsanitizeInputValue($string);
        $string = trim($string);
		if( !Piwik_Archive::isSegmentationEnabled() 
			&& !empty($string))
		{
			throw new Exception("The Super User has disabled the use of 'segments' for the anonymous user. 
									Please log in to use Segmentation in the API.");
		}
        // As a preventive measure, we restrict the filter size to a safe limit
        $string = substr($string, 0, self::SEGMENT_TRUNCATE_LIMIT);
        
        $this->string = $string;
        $this->idSites = $idSites;
        $segment = new Piwik_SegmentExpression($string);
        $this->segment = $segment;

        // parse segments
        $expressions = $segment->parseSubExpressions();
        
        // convert segments name to sql segment
        // check that user is allowed to view this segment
        // and apply a filter to the value to match if necessary (to map DB fields format)
        $cleanedExpressions = array();
        foreach($expressions as $expression)
        {
            $operand = $expression[Piwik_SegmentExpression::INDEX_OPERAND];
            $cleanedExpression = $this->getCleanedExpression($operand);
            $expression[Piwik_SegmentExpression::INDEX_OPERAND] = $cleanedExpression;
            $cleanedExpressions[] = $expression;
        }
        $segment->setSubExpressionsAfterCleanup($cleanedExpressions);
    }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:34,代码来源:Segment.php

示例2: 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 = array();
         $mail['transport'] = Piwik_Common::getRequestVar('mailUseSmtp') == '1' ? 'smtp' : '';
         $mail['port'] = Piwik_Common::getRequestVar('mailPort', '');
         $mail['host'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailHost', ''));
         $mail['type'] = Piwik_Common::getRequestVar('mailType', '');
         $mail['username'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailUsername', ''));
         $mail['password'] = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('mailPassword', ''));
         $mail['encryption'] = Piwik_Common::getRequestVar('mailEncryption', '');
         Piwik_Config::getInstance()->mail = $mail;
         // update branding settings
         Piwik_Config::getInstance()->branding['use_custom_logo'] = Piwik_Common::getRequestVar('useCustomLogo', '0');
         $toReturn = $response->getResponse();
     } catch (Exception $e) {
         $toReturn = $response->getResponseException($e);
     }
     echo $toReturn;
 }
开发者ID:0h546f6f78696342756e4e59,项目名称:piwik,代码行数:28,代码来源:Controller.php

示例3: getAllDashboards

    public static function getAllDashboards($login)
    {
        $dashboards = Piwik_FetchAll('SELECT iddashboard, name
									  FROM ' . Piwik_Common::prefixTable('user_dashboard') . ' WHERE login = ? ORDER BY iddashboard', array($login));
        $pos = 0;
        $nameless = 1;
        foreach ($dashboards as &$dashboard) {
            if (!empty($dashboard['name'])) {
                $dashboard['name'] = $dashboard['name'];
            } else {
                $dashboard['name'] = Piwik_Translate('Dashboard_DashboardOf', $login);
                if ($nameless > 1) {
                    $dashboard['name'] .= " ({$nameless})";
                }
                if (empty($dashboard['layout'])) {
                    $layout = '[]';
                } else {
                    $layout = html_entity_decode($dashboard['layout']);
                    $layout = str_replace("\\\"", "\"", $layout);
                }
                $dashboard['layout'] = Piwik_Common::json_decode($layout);
                $nameless++;
            }
            $dashboard['name'] = Piwik_Common::unsanitizeInputValue($dashboard['name']);
            $pos++;
        }
        return $dashboards;
    }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:28,代码来源:Dashboard.php

示例4: worldMap

 function worldMap()
 {
     if (!Piwik_PluginsManager::getInstance()->isPluginActivated('UserCountry')) {
         return '';
     }
     $idSite = Piwik_Common::getRequestVar('idSite', 1, 'int');
     Piwik::checkUserHasViewAccess($idSite);
     $period = Piwik_Common::getRequestVar('period');
     $date = Piwik_Common::getRequestVar('date');
     $token_auth = Piwik::getCurrentUserTokenAuth();
     $view = Piwik_View::factory('worldmap');
     $view->dataUrl = "?module=API" . "&method=API.getProcessedReport&format=XML" . "&apiModule=UserCountry&apiAction=getCountry" . "&idSite=" . $idSite . "&period=" . $period . "&date=" . $date . "&token_auth=" . $token_auth . "&segment=" . Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('segment', '')) . "&filter_limit=-1";
     // definition of the color scale
     $view->hueMin = 218;
     $view->hueMax = 216;
     $view->satMin = "0.285";
     $view->satMax = "0.9";
     $view->lgtMin = ".97";
     $view->lgtMax = ".44";
     $request = new Piwik_API_Request('method=API.getMetadata&format=PHP' . '&apiModule=UserCountry&apiAction=getCountry' . '&idSite=' . $idSite . '&period=' . $period . '&date=' . $date . '&token_auth=' . $token_auth . '&filter_limit=-1');
     $metaData = $request->process();
     $metrics = array();
     foreach ($metaData[0]['metrics'] as $id => $val) {
         if (Piwik_Common::getRequestVar('period') == 'day' || $id != 'nb_uniq_visitors') {
             $metrics[] = array($id, $val);
         }
     }
     foreach ($metaData[0]['processedMetrics'] as $id => $val) {
         $metrics[] = array($id, $val);
     }
     $view->metrics = $metrics;
     $view->defaultMetric = 'nb_visits';
     echo $view->render();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:34,代码来源:Controller.php

示例5: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Piwik_Date $date ($this->date from controller)
  * @throws Exception
  */
 public function __construct($idSite, $date, $graphType = null)
 {
     $this->apiMethod = Piwik_Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = Piwik_Common::getRequestVar('label', '', 'string');
     $this->label = Piwik_Common::unsanitizeInputValue($this->label);
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Piwik_Common::getRequestVar('period', '', 'string');
     if (empty($this->period)) {
         throw new Exception("Parameter period not set.");
     }
     $this->idSite = $idSite;
     $this->graphType = $graphType;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         list($this->date, $lastN) = Piwik_ViewDataTable_GenerateGraphHTML_ChartEvolution::getDateRangeAndLastN($this->period, $end);
     }
     $this->segment = Piwik_Common::getRequestVar('segment', '', 'string');
     $this->loadEvolutionReport();
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:32,代码来源:RowEvolution.php

示例6: sendFeedback

 /**
  * send email to Piwik team and display nice thanks
  */
 function sendFeedback()
 {
     $email = Piwik_Common::getRequestVar('email', '', 'string');
     $body = Piwik_Common::getRequestVar('body', '', 'string');
     $category = Piwik_Common::getRequestVar('category', '', 'string');
     $nonce = Piwik_Common::getRequestVar('nonce', '', 'string');
     $view = Piwik_View::factory('sent');
     $view->feedbackEmailAddress = Zend_Registry::get('config')->General->feedback_email_address;
     try {
         $minimumBodyLength = 35;
         if (strlen($body) < $minimumBodyLength) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionBodyLength', array($minimumBodyLength)));
         }
         if (!Piwik::isValidEmailString($email)) {
             throw new Exception(Piwik_TranslateException('UsersManager_ExceptionInvalidEmail'));
         }
         if (preg_match('/https?:/i', $body)) {
             throw new Exception(Piwik_TranslateException('Feedback_ExceptionNoUrls'));
         }
         if (!Piwik_Nonce::verifyNonce('Piwik_Feedback.sendFeedback', $nonce)) {
             throw new Exception(Piwik_TranslateException('General_ExceptionNonceMismatch'));
         }
         Piwik_Nonce::discardNonce('Piwik_Feedback.sendFeedback');
         $mail = new Piwik_Mail();
         $mail->setFrom(Piwik_Common::unsanitizeInputValue($email));
         $mail->addTo($view->feedbackEmailAddress, 'Piwik Team');
         $mail->setSubject('[ Feedback form - Piwik ] ' . $category);
         $mail->setBodyText(Piwik_Common::unsanitizeInputValue($body) . "\n" . 'Piwik ' . Piwik_Version::VERSION . "\n" . 'IP: ' . Piwik_Common::getIpString() . "\n" . 'URL: ' . Piwik_Url::getReferer() . "\n");
         @$mail->send();
     } catch (Exception $e) {
         $view->ErrorString = $e->getMessage();
         $view->message = $body;
     }
     echo $view->render();
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:38,代码来源:Controller.php

示例7: setAxisYValues

 public function setAxisYValues(&$values)
 {
     foreach ($values as $label => &$data) {
         $this->series[] = array('label' => Piwik_Common::unsanitizeInputValue($label), 'internalLabel' => $label);
         array_walk($data, create_function('&$v', '$v = (float)$v;'));
         $this->data[] =& $data;
     }
 }
开发者ID:josl,项目名称:CGE-File-Sharing,代码行数:8,代码来源:Chart.php

示例8: 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

示例9: getFullReport

 /**
  * This method combines various reports (both from this and from other plugins) and
  * returns a complete report. The report is used in the Transitions API to load all
  * data at once.
  */
 public function getFullReport($pageUrl, $idSite, $period, $date, $segment = false, $limitBeforeGrouping = false)
 {
     Piwik::checkUserHasViewAccess($idSite);
     $pageUrl = Piwik_Common::unsanitizeInputValue($pageUrl);
     $report = array();
     $this->addMainPageMetricsToReport($report, $pageUrl, $idSite, $period, $date, $segment);
     $this->addLiveTransitionsDataToReport($report, $pageUrl, $idSite, $period, $date, $segment, $limitBeforeGrouping);
     // replace column names in the data tables
     $columnNames = array('label' => 'url', Piwik_Archive::INDEX_NB_ACTIONS => 'referrals');
     $reportNames = array('previousPages', 'followingPages', 'outlinks', 'downloads');
     foreach ($reportNames as $reportName) {
         if (isset($report[$reportName])) {
             $report[$reportName]->filter('ReplaceColumnNames', array($columnNames));
         }
     }
     return $report;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:22,代码来源:API.php

示例10: setColumnsToDisplay

 public function setColumnsToDisplay($columnsNames)
 {
     $newColumnsNames = array();
     $goals = array();
     $idSite = $this->getIdSite();
     if ($idSite) {
         $goals = Piwik_Goals_API::getInstance()->getGoals($idSite);
         $ecommerceGoal = array('idgoal' => Piwik_Archive::LABEL_ECOMMERCE_ORDER, 'name' => Piwik_Translate('Goals_EcommerceOrder'));
         $site = new Piwik_Site($idSite);
         //Case Ecommerce report table
         if ($this->isEcommerce) {
             $goals = array($ecommerceGoal);
         } elseif ($site->isEcommerceEnabled()) {
             $goals = array_merge(array($ecommerceGoal), $goals);
         }
     }
     foreach ($columnsNames as $columnName) {
         if (in_array($columnName, array('goal_%s_conversion_rate', 'goal_%s_nb_conversions', 'goal_%s_revenue_per_visit', 'goal_%s_revenue', 'goal_%s_avg_order_revenue', 'goal_%s_items'))) {
             foreach ($goals as $goal) {
                 $idgoal = $goal['idgoal'];
                 // Columns names are escaped in smarty via | escape:'html'
                 $goal['name'] = Piwik_Common::unsanitizeInputValue($goal['name']);
                 if ($this->processOnlyIdGoal > Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_FULL_TABLE && $this->processOnlyIdGoal != $idgoal && !$this->isEcommerce) {
                     continue;
                 }
                 $name = Piwik_Translate($this->getColumnTranslation($columnName), $goal['name']);
                 $columnNameGoal = str_replace('%s', $idgoal, $columnName);
                 $this->setColumnTranslation($columnNameGoal, $name);
                 $this->setDynamicMetricDocumentation($columnName, $columnNameGoal, $goal['name'], $goal['idgoal']);
                 if (strpos($columnNameGoal, '_rate') === false && $this->processOnlyIdGoal == Piwik_DataTable_Filter_AddColumnsProcessedMetricsGoal::GOALS_OVERVIEW) {
                     continue;
                 }
                 if (strstr($columnNameGoal, '_revenue') !== false) {
                     $this->columnsToRevenueFilter[] = $columnNameGoal;
                 } else {
                     $this->columnsToConversionFilter[] = $columnNameGoal;
                 }
                 $newColumnsNames[] = $columnNameGoal;
             }
         } else {
             $newColumnsNames[] = $columnName;
         }
     }
     parent::setColumnsToDisplay($newColumnsNames);
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:45,代码来源:Goals.php

示例11: __construct

 /**
  * The constructor
  * Initialize some local variables from the request
  * @param int $idSite
  * @param Piwik_Date $date ($this->date from controller)
  * @throws Exception
  */
 public function __construct($idSite, $date)
 {
     $this->apiMethod = Piwik_Common::getRequestVar('apiMethod', '', 'string');
     if (empty($this->apiMethod)) {
         throw new Exception("Parameter apiMethod not set.");
     }
     $this->label = Piwik_Common::getRequestVar('label', '', 'string');
     $this->label = Piwik_Common::unsanitizeInputValue($this->label);
     if ($this->label === '') {
         throw new Exception("Parameter label not set.");
     }
     $this->period = Piwik_Common::getRequestVar('period', '', 'string');
     if (empty($this->period)) {
         throw new Exception("Parameter period not set.");
     }
     $this->idSite = $idSite;
     if ($this->period != 'range') {
         // handle day, week, month and year: display last X periods
         $end = $date->toString();
         if ($this->period == 'year') {
             $start = $date->subYear(10)->toString();
         } else {
             if ($this->period == 'month') {
                 $start = $date->subMonth(30)->toString();
             } else {
                 if ($this->period == 'week') {
                     $start = $date->subWeek(30)->toString();
                 } else {
                     $start = $date->subDay(30)->toString();
                 }
             }
         }
         $this->date = $start . ',' . $end;
     }
     $this->segment = Piwik_Common::getRequestVar('segment', '', 'string');
     $this->loadEvolutionReport();
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:44,代码来源:RowEvolution.php

示例12: showErrorWrongDomain

 /** 
  * This method is called when the JS from startOverlaySession() detects that the target domain
  * is not configured for the current site.
  */
 public function showErrorWrongDomain()
 {
     $idSite = Piwik_Common::getRequestVar('idSite', 0, 'int');
     Piwik::checkUserHasViewAccess($idSite);
     $url = Piwik_Common::getRequestVar('url', '');
     $url = Piwik_Common::unsanitizeInputValue($url);
     $message = Piwik_Translate('Overlay_RedirectUrlError', array($url, "\n"));
     $message = nl2br(htmlentities($message));
     $view = Piwik_View::factory('error_wrong_domain');
     $view->message = $message;
     if (Piwik::isUserHasAdminAccess($idSite)) {
         // TODO use $idSite to link to the correct row. This is tricky because the #rowX ids don't match
         // the site ids when sites have been deleted.
         $url = 'index.php?module=SitesManager&action=index';
         $troubleshoot = htmlentities(Piwik_Translate('Overlay_RedirectUrlErrorAdmin'));
         $troubleshoot = sprintf($troubleshoot, '<a href="' . $url . '" target="_top">', '</a>');
         $view->troubleshoot = $troubleshoot;
     } else {
         $view->troubleshoot = htmlentities(Piwik_Translate('Overlay_RedirectUrlErrorUser'));
     }
     echo $view->render();
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:26,代码来源:Controller.php

示例13: saveLayoutAsDefault

    /**
     * Saves the layout as default
     */
    public function saveLayoutAsDefault()
    {
        $this->checkTokenInUrl();
        if (Piwik::isUserIsSuperUser()) {
            $layout = Piwik_Common::unsanitizeInputValue(Piwik_Common::getRequestVar('layout'));
            $paramsBind = array('', '1', $layout, $layout);
            Piwik_Query('INSERT INTO ' . Piwik_Common::prefixTable('user_dashboard') . ' (login, iddashboard, layout)
							VALUES (?,?,?)
						ON DUPLICATE KEY UPDATE layout=?', $paramsBind);
        }
    }
开发者ID:nnnnathann,项目名称:piwik,代码行数:14,代码来源:Controller.php

示例14: logme

 /**
  * Form-less login
  * @see how to use it on http://piwik.org/faq/how-to/#faq_30
  * @param none
  * @return void
  */
 function logme()
 {
     self::checkForceSslLogin();
     $password = Piwik_Common::getRequestVar('password', null, 'string');
     if (strlen($password) != 32) {
         throw new Exception(Piwik_TranslateException('Login_ExceptionPasswordMD5HashExpected'));
     }
     $login = Piwik_Common::getRequestVar('login', null, 'string');
     if ($login == Zend_Registry::get('config')->superuser->login) {
         throw new Exception(Piwik_TranslateException('Login_ExceptionInvalidSuperUserAuthenticationMethod', array("logme")));
     }
     $currentUrl = 'index.php';
     if (($idSite = Piwik_Common::getRequestVar('idSite', false, 'int')) !== false) {
         $currentUrl .= '?idSite=' . $idSite;
     }
     $urlToRedirect = Piwik_Common::getRequestVar('url', $currentUrl, 'string');
     $urlToRedirect = Piwik_Common::unsanitizeInputValue($urlToRedirect);
     $this->authenticateAndRedirect($login, $password, false, $urlToRedirect);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:25,代码来源:Controller.php

示例15: getRefererInformation

 /**
  * Returns an array containing the following information:
  * - referer_type
  *        - direct            -- absence of referer URL OR referer URL has the same host
  *        - site                -- based on the referer URL
  *        - search_engine        -- based on the referer URL
  *        - campaign            -- based on campaign URL parameter
  *
  * - referer_name
  *         - ()
  *         - piwik.net            -- site host name
  *         - google.fr            -- search engine host name
  *         - adwords-search    -- campaign name
  *
  * - referer_keyword
  *         - ()
  *         - ()
  *         - my keyword
  *         - my paid keyword
  *         - ()
  *         - ()
  *
  * - referer_url : the same for all the referer types
  *
  * @param $refererUrl must be URL Encoded
  * @param $currentUrl
  * @param $idSite
  * @return array
  */
 public function getRefererInformation($refererUrl, $currentUrl, $idSite)
 {
     $this->idsite = $idSite;
     // default values for the referer_* fields
     $refererUrl = Piwik_Common::unsanitizeInputValue($refererUrl);
     if (!empty($refererUrl) && !Piwik_Common::isLookLikeUrl($refererUrl)) {
         $refererUrl = '';
     }
     $currentUrl = Piwik_Tracker_Action::cleanupUrl($currentUrl);
     $this->refererUrl = $refererUrl;
     $this->refererUrlParse = @parse_url($this->refererUrl);
     $this->currentUrlParse = @parse_url($currentUrl);
     $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_DIRECT_ENTRY;
     $this->nameRefererAnalyzed = '';
     $this->keywordRefererAnalyzed = '';
     $this->refererHost = '';
     if (isset($this->refererUrlParse['host'])) {
         $this->refererHost = $this->refererUrlParse['host'];
     }
     $refererDetected = false;
     if (!empty($this->currentUrlParse['host']) && $this->detectRefererCampaign()) {
         $refererDetected = true;
     }
     if (!$refererDetected) {
         if ($this->detectRefererDirectEntry() || $this->detectRefererSearchEngine()) {
             $refererDetected = true;
         }
     }
     if (!empty($this->refererHost) && !$refererDetected) {
         $this->typeRefererAnalyzed = Piwik_Common::REFERER_TYPE_WEBSITE;
         $this->nameRefererAnalyzed = mb_strtolower($this->refererHost, 'UTF-8');
     }
     $refererInformation = array('referer_type' => $this->typeRefererAnalyzed, 'referer_name' => $this->nameRefererAnalyzed, 'referer_keyword' => $this->keywordRefererAnalyzed, 'referer_url' => $this->refererUrl);
     return $refererInformation;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:64,代码来源:Visit.php


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