Ejemplo n.º 1
0
 /**
  * Stamps the current datestamp and ip_address.
  */
 public static function stampResource(\Resource $resource, $action)
 {
     $activity = new Activity();
     $activity->class_name = $resource->getNamespace();
     $activity->resource_id = $resource->getId();
     $activity->action = $action;
     if (\User\Current::isLoggedIn()) {
         $activity->user_id = \User\Current::getUserId();
     }
     try {
         $activity->ip_address = \Server::getUserIp();
     } catch (Exception $e) {
         $activity->ip_address = '0.0.0.0';
         \Error::log($e);
     }
     \ResourceFactory::saveResource($activity);
 }
Ejemplo n.º 2
0
 public function buildHref()
 {
     if ($this->secure) {
         $this->mod_vars['authkey'] = \User\Current::getAuthKey();
     }
     if (!empty($this->mod_vars)) {
         foreach ($this->mod_vars as $k => $v) {
             if (is_array($v)) {
                 foreach ($v as $ak => $av) {
                     $data[] = $k . '[' . $ak . ']=' . $av;
                 }
             } else {
                 $data[] = "{$k}={$v}";
             }
         }
         // Ampersand will be changed to & in Tag class
         return $this->module_path . '?' . implode('&', $data);
     } else {
         return $this->module_path;
     }
 }