public function save() { $result = false; $e_sql = "SELECT aut_id FROM auth WHERE aut_id = '" . Database::singleton()->escape($this->usr_id) . "'"; $e_result = Database::singleton()->query_fetch($e_sql); if ($e_result) { $sql = "UPDATE auth SET \n\t\t\t\t\t\taut_username = '******',\n\t\t\t\t\t\taut_password = '******',\n\t\t\t\t\t\taut_salt = '" . Database::singleton()->escape($this->salt) . "',\n\t\t\t\t\t\taut_agp_id = '" . Database::singleton()->escape($this->auth_group) . "',\n\t\t\t\t\t\taut_name = '" . Database::singleton()->escape($this->name) . "',\t\t\t\t\t\t\n\t\t\t\t\t\taut_email = '" . Database::singleton()->escape($this->email) . "',\n\t\t\t\t\t\taut_phone = '" . Database::singleton()->escape($this->phone) . "',\n\t\t\t\t\t\taut_status = '" . Database::singleton()->escape($this->status) . "',\t\t\t\t\t\n\t\t\t\t\t\tauth_join_newsletter = '" . Database::singleton()->escape($this->join_newsletter) . "',\t\t\t\t\t\n\t\t\t\t\t\taut_last_touched = NOW()\n\t\t\t\t\t\twhere aut_id = '" . Database::singleton()->escape($this->usr_id) . "'"; $result = Database::singleton()->query($sql); } else { $uniqueUserNameSQL = "SELECT aut_id FROM auth WHERE aut_username like '" . Database::singleton()->escape($this->username) . "'"; $uniqueUserNameResult = Database::singleton()->query_fetch($uniqueUserNameSQL); if ($uniqueUserNameResult) { //Username already exists return false; } $sql = "INSERT INTO auth SET \n\t\t\t\t\t\taut_username = '******',\n\t\t\t\t\t\taut_password = '******',\n\t\t\t\t\t\taut_salt = '" . Database::singleton()->escape($this->salt) . "',\n\t\t\t\t\t\taut_name = '" . Database::singleton()->escape($this->name) . "',\t\t\t\t\t\t\n\t\t\t\t\t\taut_email = '" . Database::singleton()->escape($this->email) . "',\n\t\t\t\t\t\taut_phone = '" . Database::singleton()->escape($this->phone) . "',\n\t\t\t\t\t\taut_status = '" . Database::singleton()->escape($this->status) . "',\t\t\t\t\n\t\t\t\t\t\tauth_join_newsletter = '" . Database::singleton()->escape($this->join_newsletter) . "',\t\t\t\t\t\n\t\t\t\t\t\taut_last_touched = NOW(),\n\t\t\t\t\t\taut_agp_id = '" . Database::singleton()->escape($this->auth_group) . "'"; $result = Database::singleton()->query($sql); //$e_result = Database::singleton()->query_fetch($e_sql); $this->setId(Database::singleton()->lastInsertedID()); $headers = 'From: ' . SiteConfig::get("EComm::AdminEmail") . '\\r\\n'; $smarty = new Smarty(); $user = new User($this->getId()); $smarty->assign('user', $user); $message = $smarty->fetch("create_new_account_email.tpl"); mail($this->email, "Your account has been created", $message, $headers); } include_once SITE_ROOT . '/modules/Mail/include/MailUser.php'; $nUser = new MailUser($this->email); if ($this->join_newsletter) { $name = explode(" ", trim($this->name)); $nUser->setEmail($this->email); @$nUser->setFirstName($name[0]); @$nUser->setLastName($name[1]); $nUser->save(); } else { $nUser->delete(); } return $result; }
public function getUserInterface($params) { switch (@$_REQUEST['section']) { case 'collect': // collect client data $browser = $_SERVER['HTTP_USER_AGENT']; $log = new MailViewLog(); $log->setUser($params['user']); $log->setSendOut($params['mso_id']); $log->setBrowser($browser); $log->save(); $im = imagecreatefromjpeg(dirname(__FILE__) . '/images/norexLink.jpg'); header("Content-Type: image/jpeg"); imagejpeg($im); die; //params['user'] . '/' . $params['mso_id']; //params['user'] . '/' . $params['mso_id']; case 'signup': if (@(!is_null($_REQUEST['newsletter_submit']))) { include_once 'include/MailUser.php'; trim($_REQUEST['newsletter_name']); $name = explode(" ", $_REQUEST['newsletter_name']); $nUser = new MailUser(); $nUser->setEmail($_REQUEST['newsletter_email']); @$nUser->setFirstName($name[0]); @$nUser->setLastName($name[1]); $nUser->save(); return $this->smarty->fetch('newslettersignedup.tpl'); } break; } }
public function getListUsersForm() { $form = new Form('MailList_users', 'post', '/admin/Mail'); $form->setConstants(array('section' => 'lists')); $form->addElement('hidden', 'section'); $form->setConstants(array('action' => 'updateList')); $form->addElement('hidden', 'action'); $form->setConstants(array('listId' => $this->getId())); $form->addElement('hidden', 'listId'); $users = array(); foreach ($this->getListUsers() as $user) { $users[] = $user->getId(); } $allusers = array(); foreach (MailUser::getAllMailUsers() as $user) { $allusers[$user->getId()] = $user->__toString(); } $form->setDefaults(array('subscribers' => $users)); $ams = $form->addElement('advmultiselect', 'subscribers', null, $allusers, array('style' => 'width: 300px;', 'onblur' => 'changeCallback(this);')); $ams->setLabel(array($this->getName(), 'Available', 'Subscribed to List')); if ($form->validate() && $form->isSubmitted()) { $clean = $form->getSubmitValues(); if (isset($_REQUEST['subscribers-t'])) { foreach ($_REQUEST['subscribers-t'] as $from) { $this->removeListUser($from); } } if (isset($_REQUEST['subscribers-f'])) { foreach ($_REQUEST['subscribers-f'] as $from) { $this->addListUser($from); } } } return $form; }