public static function addNew($name, $descr, $avatar, $background) { $channelId = UserChannel::generateId(6); $avatar = Utils::upload($avatar, 'img', 'avatar', $channelId, Config::getValue_('default-avatar')); $background = Utils::upload($background, 'img', 'background', $channelId, Config::getValue_('default-background')); UserChannel::create(array('id' => $channelId, 'name' => $name, 'description' => $descr, 'owner_id' => Session::get()->id, 'admins_ids' => ';' . Session::get()->id . ';', 'avatar' => $avatar, 'background' => $background, 'subscribers' => 0, 'subs_list' => '', 'views' => 0, 'verified' => 0)); }
public static function register($username, $password, $mail) { $appConfig = new Config(CONFIG . 'app.json'); $appConfig->parseFile(); $userRank = $appConfig->getValue('rankUser'); User::create(array('username' => $username, 'email' => $mail, 'pass' => password_hash($password, PASSWORD_BCRYPT), 'subscriptions' => '', 'reg_timestamp' => Utils::tps(), 'reg_ip' => $_SERVER['REMOTE_ADDR'], 'actual_ip' => $_SERVER['REMOTE_ADDR'], 'rank' => $userRank, 'settings' => json_encode(array()))); UserChannel::create(array('id' => UserChannel::generateId(6), 'name' => $username, 'description' => 'Chaîne de ' . $username, 'owner_id' => User::getIdByName($username), 'admins_ids' => ';' . User::getIdByName($username) . ';', 'avatar' => Config::getValue_('default-avatar'), 'background' => Config::getValue_('default-background'), 'subscribers' => 0, 'subs_list' => 0, 'views' => 0, 'verified' => 0)); }