public function onStartup() { if ($user = GWF_Session::getUser()) { if ($user->isOptionEnabled(GWF_User::RECORD_IPS)) { $this->includeClass('GWF_AccountAccess'); GWF_AccountAccess::onAccess($this, $user); } } }
private function onChange() { $back = ''; $user = GWF_Session::getUser(); $form = $this->getForm(); if (false !== ($errors = $form->validate($this->module))) { return $errors; } # Upload Avatar if (false !== ($file = $form->getVar('avatar'))) { $back .= $this->saveAvatar($file); Common::unlink($file['tmp_name']); } # Flags if ($this->module->cfgShowAdult() && GWF_Time::getAge($user->getVar('user_birthdate')) > $this->module->cfgAdultAge()) { $back .= $this->changeFlag($user, 'adult', GWF_USER::WANTS_ADULT); } $back .= $this->changeFlag($user, 'online', GWF_USER::HIDE_ONLINE); $back .= $this->changeFlag($user, 'show_bday', GWF_USER::SHOW_BIRTHDAY); $back .= $this->changeFlag($user, 'show_obday', GWF_USER::SHOW_OTHER_BIRTHDAYS); $back .= $this->changeFlag($user, 'show_email', GWF_USER::SHOW_EMAIL); $back .= $this->changeFlag($user, 'allow_email', GWF_USER::ALLOW_EMAIL); # Flags IP recording $msg_record_disabled = $this->changeFlag($user, 'record_ips', GWF_USER::RECORD_IPS); if ($msg_record_disabled !== '') { $back .= $msg_record_disabled; if (!$user->isOptionEnabled(GWF_User::RECORD_IPS)) { GWF_AccountAccess::sendAlertMail($this->module, $user, 'record_disabled'); unset($_POST['alert_uas'], $_POST['alert_ips'], $_POST['alert_isps']); } } $back .= $this->changeFlag($user, 'alert_uas', GWF_USER::ALERT_UAS); $back .= $this->changeFlag($user, 'alert_ips', GWF_USER::ALERT_IPS); $back .= $this->changeFlag($user, 'alert_isps', GWF_USER::ALERT_ISPS); # Email Format $newfmt = (int) $_POST['email_fmt']; $oldfmt = $user->isOptionEnabled(GWF_User::EMAIL_TEXT) ? GWF_User::EMAIL_TEXT : 0; if ($newfmt !== $oldfmt) { $user->saveOption(GWF_User::EMAIL_TEXT, $newfmt > 0); $back .= $this->module->message('msg_email_fmt_' . $newfmt); } # Change EMAIL $newmail = $form->getVar('email'); $oldmail = $user->getVar('user_email'); if ($newmail !== $oldmail) { require_once 'ChangeEmail.php'; $back .= Account_ChangeEmail::changeEmail($this->module, $user, $newmail); } # Change Demo $demo_changed = false; $oldcid = (int) $user->getVar('user_countryid'); $newcid = (int) $form->getVar('countryid'); if ($oldcid !== $newcid) { $demo_changed = true; } $oldlid = (int) $user->getVar('user_langid'); $newlid = (int) $form->getVar('langid'); if ($oldlid !== $newlid) { $demo_changed = true; } $oldlid2 = (int) $user->getVar('user_langid2'); $newlid2 = (int) $form->getVar('langid2'); if ($oldlid2 !== $newlid2) { $demo_changed = true; } $oldgender = $user->getVar('user_gender'); $newgender = $form->getVar('gender', GWF_User::NO_GENDER); if ($oldgender !== $newgender) { $demo_changed = true; } $oldbirthdate = $user->getVar('user_birthdate'); $newbirthdate = $form->getVar('birthdate'); if ($newbirthdate === '') { $newbirthdate = '00000000'; } if ($oldbirthdate != $newbirthdate) { $demo_changed = true; } if ($demo_changed) { $data = array('user_countryid' => $newcid, 'user_langid' => $newlid, 'user_langid2' => $newlid2, 'user_gender' => $newgender, 'user_birthdate' => $newbirthdate); require_once 'ChangeDemo.php'; $back .= Account_ChangeDemo::requestChange($this->module, $user, $data); } return $back; }