Exemple #1
0
 // ========== End of verification.. ==============
 // If no errors, we can enter the new member in the DB
 // At this point we have two data arrays:
 //		$allData['data'] - the 'core' user data
 //		$eufVals['data'] - any extended user fields
 if (!$error) {
     $error_message = '';
     $fp = new floodprotect();
     if ($fp->flood("user", "user_join") == FALSE) {
         header("location:" . e_BASE . "index.php");
         exit;
     }
     if ($_POST['email'] && $sql->select("user", "*", "user_email='" . $_POST['email'] . "' AND user_ban='" . USER_BANNED . "'")) {
         exit;
     }
     $u_key = e_user_model::randomKey();
     // Key for signup completion
     $allData['data']['user_sess'] = $u_key;
     // Validation key
     $userMethods->userClassUpdate($allData['data'], 'usersup');
     if ($pref['user_reg_veri']) {
         $allData['data']['user_ban'] = USER_REGISTERED_NOT_VALIDATED;
     } else {
         $allData['data']['user_ban'] = USER_VALIDATED;
     }
     // Work out data to be written to user audit trail
     $signup_data = array('user_name', 'user_loginname', 'user_email', 'user_ip');
     //		foreach (array() as $f)
     foreach ($signup_data as $f) {
         $signup_data[$f] = $allData['data'][$f];
         // Just copy across selected fields
Exemple #2
0
 /**
  * Save and apply user preferences
  * @param boolean $from_post
  * @param boolean $force
  * @return boolean success
  */
 public function save($from_post = false, $force = false)
 {
     if ($this->_user->getId()) {
         if ($from_post) {
             $this->mergePostedData(false, true, false);
         }
         if ($force || $this->dataHasChanged()) {
             $data = $this->toString(true);
             $this->apply();
             return e107::getDb('user_prefs')->db_Update('user', "user_prefs='{$data}' WHERE user_id=" . $this->_user->getId()) ? true : false;
         }
         return 0;
     }
     return false;
 }
Exemple #3
0
 /**
  * Send an activation email to all unactivated users older than so many hours.
  * @param bool $resetPasswords
  * @param int $age in hours. ie. older than 24 hours will be sent an email.
  */
 function resend_to_all($resetPasswords = false, $age = 24, $class = '')
 {
     global $sql, $pref;
     $tp = e107::getParser();
     $sql = e107::getDb();
     $sql2 = e107::getDb('toall');
     $emailLogin = e107::getPref('allowEmailLogin');
     e107::lan('core', 'signup');
     $ageOpt = intval($age) . " hours ago";
     $age = strtotime($ageOpt);
     //	$query = "SELECT u.*, ue.* FROM `#user` AS u LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id WHERE u.user_ban = 2 AND u.user_email != '' AND u.user_join < ".$age." ORDER BY u.user_id DESC";
     $query = "SELECT u.* FROM `#user` AS u WHERE u.user_ban = 2 AND u.user_email != '' AND u.user_join < " . $age . " ";
     if (!empty($class)) {
         $query .= " AND FIND_IN_SET( " . intval($class) . ", u.user_class) ";
     }
     $query .= " ORDER BY u.user_id DESC";
     $sql->gen($query);
     $recipients = array();
     $usr = e107::getUserSession();
     while ($row = $sql->fetch()) {
         if ($resetPasswords === true) {
             $rawPassword = $usr->generateRandomString('********');
             $sessKey = e_user_model::randomKey();
             $updateQry = array('user_sess' => $sessKey, 'user_password' => $usr->HashPassword($rawPassword, $row['user_loginname']), 'WHERE' => 'user_id = ' . $row['user_id'] . " LIMIT 1");
             if (!$sql2->update('user', $updateQry)) {
                 e107::getMessage()->addError("Error updating user's password. #" . $row['user_id'] . " : " . $row['user_email']);
                 e107::getMessage()->addDebug(print_a($updateQry, true));
                 //	break;
             } else {
                 e107::getMessage()->addInfo("Updated " . $row['user_id'] . " : " . $row['user_email']);
             }
             $row['user_sess'] = $sessKey;
         } else {
             $rawPassword = '******';
         }
         $activationUrl = SITEURL . "signup.php?activate." . $row['user_id'] . "." . $row['user_sess'];
         $recipients[] = array('mail_recipient_id' => $row['user_id'], 'mail_recipient_name' => $row['user_name'], 'mail_recipient_email' => $row['user_email'], 'mail_target_info' => array('USERID' => $row['user_id'], 'LOGINNAME' => intval($emailLogin) === 1 ? $row['user_email'] : $row['user_loginname'], 'PASSWORD' => $rawPassword, 'DISPLAYNAME' => $tp->toDB($row['user_name']), 'SUBJECT' => LAN_SIGNUP_98, 'USERNAME' => $row['user_name'], 'USERLASTVISIT' => $row['user_lastvisit'], 'ACTIVATION_LINK' => '<a href="' . $activationUrl . '">' . $activationUrl . '</a>', 'ACTIVATION_URL' => $activationUrl, 'DATE_SHORT' => $tp->toDate(time(), 'short'), 'DATE_LONG' => $tp->toDate(time(), 'long'), 'SITEURL' => SITEURL));
         //	echo $row['user_id']." ".$row['user_sess']." ".$row['user_name']." ".$row['user_email']."<br />";
     }
     $siteadminemail = e107::getPref('siteadminemail');
     $siteadmin = e107::getPref('siteadmin');
     $mailer = e107::getBulkEmail();
     // Create the mail body
     $mailData = array('mail_total_count' => count($recipients), 'mail_content_status' => MAIL_STATUS_TEMP, 'mail_create_app' => 'core', 'mail_title' => 'RESEND ACTIVATION', 'mail_subject' => LAN_SIGNUP_98, 'mail_sender_email' => e107::getPref('replyto_email', $siteadminemail), 'mail_sender_name' => e107::getPref('replyto_name', $siteadmin), 'mail_notify_complete' => 0, 'mail_body' => 'null', 'template' => 'signup', 'mail_send_style' => 'signup');
     $mailer->sendEmails('signup', $mailData, $recipients, array('mail_force_queue' => 1));
     $totalMails = count($recipients);
     $url = e_ADMIN . "mailout.php?mode=pending&action=list";
     e107::getMessage()->addSuccess("Total emails added to <a href='" . $url . "'>mail queue</a>: " . $totalMails);
 }