Example #1
0
 /**
  * {@inheritdoc}
  */
 public function __toString()
 {
     if ($this->user->isEmpty()) {
         return '';
     }
     return $this->user->__toString() . ':' . $this->pass->__toString();
 }
Example #2
0
 /**
     @param $method String
     @return $user User || null
     Tries to fetch a User by its authenticationMethod field.
 */
 public static function fromAuthenticationMethod($method)
 {
     //Preparing query to fetch User data:
     $stmt = Config::getDB()->prepare('SELECT * FROM users WHERE authenticationMethod = ?');
     $stmt->bind_param('s', $method);
     //Fetching and checking User:
     $user = new User($stmt);
     if ($user->isEmpty()) {
         return null;
     }
     return $user;
 }
Example #3
0
 protected function _create()
 {
     $this->seo(['title' => 'Campaign Create', 'description' => 'Create a new campaign']);
     $session = Registry::get('session');
     $view = $this->getActionView();
     $advertisers = \User::isEmpty(["org_id = ?" => $this->org->_id, 'type = ?' => 'advertiser', 'live' => true], ['_id', 'name', 'meta'], ['msg' => 'Please Add an Advertiser!!', 'controller' => $this, 'redirect' => '/advertiser/add.html']);
     $view->set('advertisers', User::objectArr($advertisers, ['_id', 'name', 'meta']));
     $categories = \Category::isEmpty(['org_id' => $this->org->_id], ['name', '_id'], ['msg' => 'Please Set Categories!!', 'controller' => $this, 'redirect' => '/admin/settings.html']);
     $view->set('categories', $categories);
     $link = RM::get("link");
     if (!$link) {
         $session->set('$flashMessage', 'Please give any link!!');
         $this->redirect('/campaign/manage.html');
     }
     if ($session->get('$lastFetchedLink') !== $link) {
         $session->set('$lastFetchedLink', $link);
         $meta = Shared\Utils::fetchCampaign($link);
         $session->set('Campaign\\Create:$meta', $meta);
     } else {
         $meta = $session->get('Campaign\\Create:$meta');
     }
     $view->set("meta", $meta)->set("type", RM::get("type"))->set("errors", []);
 }