function ajaxaddsportsuserAction() { if (!($sport = new FM_Components_Sports(array('id' => $_POST['orgId'])))) { print '0'; exit; } $user = new FM_Components_SportsUser(array('uname' => $_POST['uname'])); if ($user->getId()) { print '2'; exit; } $pwd = FM_Components_SportsUser::generatePassword(); $_POST['pwd'] = $pwd; if ($id = FM_Components_SportsUser::addUser($_POST)) { $user = new FM_Components_SportsUser(array('id' => $id)); $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $sport->getName() . ' administrator @ 4Monmouth.com' . "\r\n" . 'Reply-To: nobody@4monmouth.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($_POST['email'], 'You have been added as a user of ' . $sport->getName() . ' @ 4Monmouth.com', FM_Components_EmailFormatter::createConfirmLetter($_POST, $sport), $headers); print Zend_Json::encode($user->toArray()); exit; } print '0'; exit; }
public function ajaxupdatepwdAction() { if ($_POST) { $member = new FM_Components_Member(array('pwd' => $_POST['old'])); if ($member && $member->getId()) { if (FM_Components_Member::update(array('id' => $member->getId()), array('pwd' => $_POST['newPwd']))) { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Password Admin @ 4Monmouth.com' . "\r\n" . 'Reply-To: nobody@4monmouth.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($member->getEmail(), 'Password Change @ 4Monmouth.com', FM_Components_EmailFormatter::updatePasswordNoOrg($_POST), $headers); print '1'; exit; } } print '2'; exit; } print '0'; exit; }
public function ajaxaddeventAction() { if ($this->_user && ($this->_user->getOrgId() || $this->_user->isRoot())) { //user is admin for this group, show edit if ($_POST['datetag']) { $_POST['starttime'] = $_POST['stimeh'] . ':' . $_POST['stimem']; $_POST['endtime'] = $_POST['etimeh'] . ':' . $_POST['etimem']; $_POST['id'] = $_POST['ceid']; $_POST['frontPage'] = array_key_exists('frontPage', $_POST) ? 1 : 0; if ($id = FM_Components_Events::saveNewEvent($_POST)) { $c = new FM_Components_Events(array('eventId' => $id)); $rv = $c->toArray(); $rv['time'] = $c->getFormattedTime(); if (FM_Components_Organization::getOrgType($_POST['orgId']) == 4) { $sport = new FM_Components_Organization(array('id' => $_POST['orgId'])); $users = FM_Components_SportsUser::getAll($_POST['orgId']); foreach ($users as $index => $user) { $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: ' . $sport->getName() . ' administrator @ 4Monmouth.com' . "\r\n" . 'Reply-To: nobody@4monmouth.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $ad = FM_Components_Util_TextAd::getRandom(6); $content = $_POST['content'] . "\n" . $ad; mail($user->getEmail(), 'A New Event Has Been Posted', FM_Components_EmailFormatter::sendSportsEvent($_POST, $c->getFormattedTime(), $sport), $headers); } } $rv['date'] = date('m-d-Y', strtotime($_POST['datetag'])); print Zend_Json::encode($rv); exit; } else { print '0'; } } } exit; }