Beispiel #1
0
 /**
  * @before _secure, memberLayout, _check
  */
 public function create()
 {
     $this->seo(array("title" => "Submit Your FakeReferer", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "submitTrigger") {
         $title = RequestMethods::post("title");
         $url = RequestMethods::post("url");
         $keyword = RequestMethods::post("keyword");
         $referer = RequestMethods::post("referer");
         $tld = RequestMethods::post("tld");
         switch ($referer) {
             case 'blank':
                 $googl = Registry::get("googl");
                 $object = $googl->shortenURL("http://b.onlinedatafile.com/?hash=" . base64_encode($url));
                 $fakereferer = new \Referer(array("user_id" => $this->user->id, "title" => $title, "url" => $url, "short_url" => $object->id, "keyword" => "", "referer" => $referer, "tld" => "NONE", "live" => true));
                 $fakereferer->save();
                 $response["success"] = true;
                 break;
             default:
                 $fakereferer = new \Referer(array("user_id" => $this->user->id, "title" => $title, "url" => $url, "short_url" => "", "keyword" => $keyword, "referer" => $referer, "tld" => $tld, "live" => false));
                 $response = $this->_shortUrl($fakereferer);
                 break;
         }
         if (isset($response["success"])) {
             $view->set("success", 'Your request has been submiited. See status <a href="/fakereferer/manage">Manage</a>');
         } elseif (isset($response["error"])) {
             $view->set("success", "ERROR: " . $response["error"]);
         }
     }
 }