/** * @param $user * @return mixed|void */ public static function onRegister($user) { parent::onRegister($user); $albums = new Models\Db\Table\GalleryAlbums(); $albums->newProfileAlbums($user->userid); }
/** * @return array|bool|mixed */ public function uploadProfileImage() { $albums = new GalleryAlbums(); $res = $albums->fetchRow($albums->select()->where("type=?", "profile")->where("owner_type IS NULL")->where("owner_id=?", $_SESSION['user']->userid)); if ($res === null) { $albumid = $albums->newProfileAlbums($_SESSION['user']->userid); $res = $albums->fetchRow($albums->select()->where("type=?", "profile")->where("owner_type IS NULL")->where("owner_id=?", $_SESSION['user']->userid)); } else { $albumid = $res->id; } $result = $this->uploadImage($albumid); /** @var Album $res */ $res->addImage($result['imageid']); if (is_array($result)) { return $result; } return false; }