function send($newsletter_id)
 {
     global $db;
     $owpDBTable = owpDBGetTables();
     $send_mail = new phpmailer();
     $send_mail->From = OWP_EMAIL_ADDRESS;
     $send_mail->FromName = OWP_NAME;
     $send_mail->Subject = $this->title;
     $sql = "SELECT admin_gender, admin_firstname, admin_lastname,\n                     admin_email_address \n              FROM " . $owpDBTable['administrators'] . " \n              WHERE admin_newsletter = '1'";
     $mail_values = $db->Execute($sql);
     while ($mail = $mail_values->fields) {
         $send_mail->Body = $this->content;
         $send_mail->AddAddress($mail['admin_email_address'], $mail['admin_firstname'] . ' ' . $mail['admin_lastname']);
         $send_mail->Send();
         // Clear all addresses and attachments for next loop
         $send_mail->ClearAddresses();
         $send_mail->ClearAttachments();
         $mail_values->MoveNext();
     }
     $today = date("Y-m-d H:i:s");
     $db->Execute("UPDATE " . $owpDBTable['newsletters'] . " \n                       SET date_sent = " . $db->DBTimeStamp($today) . ",\n                           status = '1' \n                     WHERE newsletters_id = '" . owpDBInput($newsletter_id) . "'");
 }
     owpRedirect(owpLink($owpFilename['countries'], 'page=' . $_GET['page'] . '&cID=' . $_GET['cID']));
     break;
 case 'deleteconfirm':
     $db->Execute("DELETE FROM " . $owpDBTable['countries'] . " \n                      WHERE countries_id = '" . $_GET['cID'] . "'");
     owpRedirect(owpLink($owpFilename['countries'], 'page=' . $_GET['page']));
     break;
 case 'download':
     $db_table_file = 'db_' . $owpDBTable['countries'] . '-' . date('YmdHis') . '.csv';
     $file = fopen(OWP_CSV_TEMP . $db_table_file, "a+");
     $sql = "SELECT countries_id, countries_name, countries_iso_code_2, \n                       countries_iso_code_3, address_format_id \n                FROM " . $owpDBTable['countries'] . " \n                ORDER BY countries_name";
     $rs = $db->Execute($sql);
     $rs->MoveFirst();
     rs2csvfile($rs, $file);
     fclose($file);
     if (CVS_SEND_MAIL == 'true') {
         $sql = "SELECT admin_gender, admin_firstname, admin_lastname, admin_email_address \n                  FROM " . $owpDBTable['administrators'] . " \n                  WHERE admin_id = '" . owpDBInput($_SESSION['user_id']) . "'";
         $mail_query = $db->Execute($sql);
         $mail_send_to = $mail_query->fields;
         // Let's build a message object using the email class
         $send_mail = new phpmailer();
         $send_mail->From = OWP_OWNER_EMAIL_ADDRESS;
         $send_mail->FromName = OWP_NAME;
         $send_mail->Subject = EMAIL_COUNTRIES_CVS . strftime(DATE_FORMAT_LONG);
         if ($mail_send_to['admin_gender'] == 'm') {
             $body = EMAIL_GREET_MR . $mail_send_to['admin_lastname'] . ',' . "\n\n";
         } else {
             $body = EMAIL_GREET_MS . $mail_send_to['admin_lastname'] . ',' . "\n\n";
         }
         $body .= EMAIL_CVS_INTRO . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
         $body .= EMAIL_FTP_INFO . "\n";
         $body .= '         ' . $db_table_file . "\n\n";
    $error = true;
    $entry_telephone_error = true;
} else {
    $entry_telephone_error = false;
}
if (strlen($password) < PASSWORD_MIN_LENGTH) {
    $error = true;
    $entry_password_error = true;
} else {
    $entry_password_error = false;
}
if ($password != $confirmation) {
    $error = true;
    $entry_password_error = true;
}
$check_email_query = $db->Execute("SELECT count(*) as total \n                                     FROM " . $owpDBTable['administrators'] . " \n                                     WHERE admin_email_address = '" . owpDBInput($email_address) . "'\n                                       AND admin_id != '" . $_SESSION['user_id'] . "'");
$check_email = $check_email_query->fields;
if ($check_email['total'] > 0) {
    $error = true;
    $entry_email_address_exists = true;
} else {
    $entry_email_address_exists = false;
}
if ($error == true) {
    $processed = true;
    define('JS_PASSWORD_CHECK', 'true');
    $breadcrumb->add(NAVBAR_TITLE_1, owpLink($owpFilename['account'], '', 'SSL'));
    $breadcrumb->add(NAVBAR_TITLE_2, owpLink($owpFilename['account_edit'], '', 'SSL'));
    ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php 
   Copyright (c) 2002 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */
require 'includes/system.php';
require OWP_LANGUAGES_DIR . $language . '/' . $owpFilename['password_forgotten'];
if ($_GET['action'] == 'process') {
    $sql = "SELECT admin_id, admin_gender, admin_firstname, admin_lastname, admin_email_address\n            FROM " . $owpDBTable['administrators'] . " \n            WHERE admin_email_address = '" . owpDBInput($email_address) . "'";
    $check_admin_query = $db->Execute($sql);
    if ($check_admin_query->RecordCount()) {
        $check_admin = $check_admin_query->fields;
        // Crypted password mods - create a new password, update the database and mail it to them
        include_once OWP_FUNCTIONS_DIR . $owpFilename['password_crypt'];
        $newpass = owpCreatePassword(PASSWORD_MIN_LENGTH);
        $crpted_password = owpCryptPassword($newpass);
        $db->Execute("UPDATE " . $owpDBTable['administrators'] . " \n                       SET admin_password = " . $db->qstr($crpted_password) . "\n                     WHERE admin_id = '" . owpDBInput($check_admin['admin_id']) . "'");
        $name = $check_admin['admin_firstname'] . " " . $check_admin['admin_lastname'];
        if ($check_admin['admin_gender'] == 'm') {
            $email_text = EMAIL_GREET_MR . $check_admin['admin_lastname'] . ',' . "\n\n";
        } else {
            $email_text = EMAIL_GREET_MS . $check_admin['admin_lastname'] . ',' . "\n\n";
        }
        $email_text .= EMAIL_PASSWORD_INTRO;
        $email_text .= sprintf(EMAIL_PASSWORD_BODY, $newpass);
        $email_text .= EMAIL_PASSWORD_FOOT;
        owpMail($name, $check_admin['admin_email_address'], EMAIL_PASSWORD_SUBJECT, nl2br($email_text), OWP_NAME, OWP_EMAIL_ADDRESS);
        $messageStack->add_session(SUCCESS_PASSWORD_SENT, 'success');
        owpRedirect(owpLink($owpFilename['login'], '', 'SSL'));
    } else {
        $messageStack->add(ERROR_NO_USER, 'error');
    }
Esempio n. 5
0
    include_once OWP_FUNCTIONS_DIR . $owpFilename['password_crypt'];
    $sql = "SELECT admin_id, admin_gender, admin_firstname, admin_lastname,\n                   admin_email_address, admin_password, admin_allowed_pages, admin_login \n            FROM " . $owpDBTable['administrators'] . " \n            WHERE admin_email_address = '" . owpDBInput($email_address) . "'";
    $check_admin_query = $db->Execute($sql);
    if ($check_admin_query->RecordCount()) {
        $check_admin = $check_admin_query->fields;
        if (!owpValidatePasword($password, $check_admin['admin_password'])) {
            $messageStack->add(ERROR_LOGIN_ERROR, 'error');
        } else {
            if ($check_admin['admin_login'] == '1') {
                $_SESSION['user_id'] = $check_admin['admin_id'];
                $_SESSION['gender'] = $check_admin['admin_gender'];
                $_SESSION['firstname'] = $check_admin['admin_firstname'];
                $_SESSION['lastname'] = $check_admin['admin_lastname'];
                $_SESSION['allowed_pages'] = $check_admin['admin_allowed_pages'];
                $today = date("Y-m-d H:i:s");
                $db->Execute("UPDATE " . $owpDBTable['administrators_info'] . " \n\t                   SET admin_info_date_of_last_logon = " . $db->DBTimeStamp($today) . ",\n\t                       admin_info_number_of_logons = admin_info_number_of_logons+1 \n                         WHERE admin_info_id = '" . owpDBInput($check_admin['admin_id']) . "'");
                if (sizeof($navigation->snapshot) > 0) {
                    $origin_href = owpLink($navigation->snapshot['page'], owpArraytoString($_SESSION['navigation']->snapshot['get'], array(owpSessionName())), $_SESSION['navigation']->snapshot['mode']);
                    $navigation->clear_snapshot();
                    owpRedirect($origin_href);
                } else {
                    owpRedirect(owpLink($owpFilename['index'], '', 'NONSSL'));
                }
            } else {
                $messageStack->add(ERROR_NO_USER_LOGIN, 'error');
            }
        }
    } else {
        $messageStack->add(ERROR_LOGIN_NO_USER, 'error');
    }
}
    $newsletter_query = $db->Execute($sql);
    $newsletter = $newsletter_query->fields;
    include OWP_LANGUAGES_DIR . $language . '/modules/newsletters/' . $nInfo->module . '.php';
    include OWP_MODULES_DIR . 'newsletters/' . $nInfo->module . '.php';
    $module_name = $nInfo->module;
    $module = new $module_name($nInfo->title, $nInfo->content);
    ?>
      <tr>
        <td><?php 
    echo $module->confirm();
    ?>
</td>
      </tr>
<?php 
} elseif ($_GET['action'] == 'confirm_send') {
    $sql = "SELECT newsletters_id, title, content, module \n            FROM " . $owpDBTable['newsletters'] . " \n            WHERE newsletters_id = '" . owpDBInput($_GET['nID']) . "'";
    $newsletter_query = $db->Execute($sql);
    $newsletter = $newsletter_query->fields;
    $nInfo = new objectInfo($newsletter);
    include_once OWP_LANGUAGES_DIR . $language . '/modules/newsletters/' . $nInfo->module . '.php';
    include_once OWP_MODULES_DIR . $nInfo->module . '.php';
    $module_name = $nInfo->module;
    $module = new $module_name($nInfo->title, $nInfo->content);
    ?>
      <tr>
        <td><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" valign="middle"><?php 
    echo owpImage(OWP_IMAGES_DIR . 'ani_send_email.gif', IMAGE_ANI_SEND_EMAIL);
    ?>
</td>