Exemplo n.º 1
0
 /**
  * Saves the layout for the current user
  * anonymous = in the session
  * authenticated user = in the DB
  */
 public function saveLayout()
 {
     $this->checkTokenInUrl();
     $layout = Common::unsanitizeInputValue(Common::getRequestVar('layout'));
     $idDashboard = Common::getRequestVar('idDashboard', 1, 'int');
     $name = Common::getRequestVar('name', '', 'string');
     if (Piwik::isUserIsAnonymous()) {
         $session = new SessionNamespace("Dashboard");
         $session->dashboardLayout = $layout;
         $session->setExpirationSeconds(1800);
     } else {
         $this->saveLayoutForUser(Piwik::getCurrentUserLogin(), $idDashboard, $layout);
         if (!empty($name)) {
             $this->updateDashboardName(Piwik::getCurrentUserLogin(), $idDashboard, $name);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Force expiration of the current nonce.
  *
  * @param string $id The unique nonce ID.
  */
 public static function discardNonce($id)
 {
     $ns = new SessionNamespace($id);
     $ns->unsetAll();
 }