Beispiel #1
0
  /**
   * Error log handler
   *
   * @access  public
   * @param   string
   * @param   string
   * @param   string
   * @param   string
   * @param   string
   * @return  boolean
   *
   * @author  r23 <*****@*****.**>
   * @since   OOS 1.3.1
   */
  function oos_error_log_handler($sErrNo, $sErrMsg, $sErrFile, $sErrLine, $sErrVars) {
    if (substr($sErrMsg, 0, 4) == 'stat') {
      return true;
    }


    // define an assoc array of error string
    // in reality the only entries we should
    // consider are 2,8,256,512 and 1024
    $errortype = array ( 1   =>  'Error',
                         2   =>  'Warning',
                         4   =>  'Parsing Error',
                         8   =>  'Notice',
                         16  =>  'Core Error',
                         32  =>  'Core Warning',
                         64  =>  'Compile Error',
                         128 =>  'Compile Warning',
                         256 =>  'User Error',
                         512 =>  'User Warning',
                         1024=>  'User Notice');

    // $aErrUser = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
    $aErrUser = array(E_USER_ERROR);

    if (in_array($sErrNo, $aErrUser)) {
      $sUserIP = oos_server_get_remote();

      $sErr = '[' . date('D M j G:i:s Y') . ']'
             .' [error]'
             .' [client ' . $sUserIP . '] ';

      $sErr .= '( MyOOS )'
              .' '. $errortype[$sErrNo]
              .' '. $sErrMsg
              .' in file '.$sErrFile
              .' line '.$sErrLine . "\n";

      @error_log($sErr, 3, OOS_TEMP_PATH . 'logs/php_error.log');

      if ($sErrNo == E_USER_ERROR){
        oos_mail(WEBMASTER_NAME, WEBMASTER_NAME_EMAIL_ADDRESS, '[ERROR] Critical User Error', nl2br($sErr), WEBMASTER_NAME, WEBMASTER_NAME_EMAIL_ADDRESS, '1');
      }
    }
  }
Beispiel #2
0
                                                        emailed_to,
                                                        date_sent) VALUES ('" . $coupon_id ."',
                                                                           '0',
                                                                           'Admin',
                                                                           '" . $email_address . "',
                                                                           '" . date("Y-m-d H:i:s", time()) . "' )");
                     $email_text .= EMAIL_COUPON_INCENTIVE_HEADER .  "\n\n" .
                                    $coupon_desc['coupon_description'] .
                                    sprintf(EMAIL_COUPON_REDEEM, $coupon['coupon_code']) . "\n\n" .
                                    "\n\n";
                   }
                 }
                 $email_text .= EMAIL_TEXT;
                 $email_text .= sprintf(EMAIL_PASSWORD_BODY, $newpass);
                 $email_text .= EMAIL_CONTACT;
                 oos_mail($name, $check_customer_values['customers_email_address'], EMAIL_SUBJECT, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
                 oos_redirect_admin(oos_href_link_admin($aFilename['customers'], 'selected_box=customers&page=' . $_GET['page'] . '&cID=' . $_GET['cID']));
              }
            }
          }
        }
        break;
      case 'statusconfirm':
        $customers_id = oos_db_prepare_input($_GET['cID']);

        $customerstable = $oostable['customers'];
        $check_status_sql = "SELECT customers_status
                             FROM $customerstable
                             WHERE customers_id = '" . intval($customers_id) . "'";
        $customers_status = $dbconn->GetOne($check_status_sql);
 $firstname = $customer_values['customers_firstname'];
 $lastname = ltrim($customer_values['customers_lastname']);
 $lastname = substr($lastname, 0, 1);
 $customers_name = $firstname . ' ' . $lastname . '. ';
 $reviewstable = $oostable['reviews'];
 $dbconn->Execute("INSERT INTO {$reviewstable}\n                  (products_id,\n                   customers_id,\n                   customers_name,\n                   reviews_rating,\n                   date_added) VALUES ('" . intval($nProductsId) . "',\n                                       '" . intval($_SESSION['customer_id']) . "',\n                                       '" . oos_db_input($customers_name) . "',\n                                       '" . oos_db_input($rating) . "',\n                                       '" . date("Y-m-d H:i:s", time()) . "')");
 $insert_id = $dbconn->Insert_ID();
 $reviews_descriptiontable = $oostable['reviews_description'];
 $dbconn->Execute("INSERT INTO {$reviews_descriptiontable}\n                  (reviews_id,\n                   reviews_languages_id,\n                   reviews_text) VALUES ('" . intval($insert_id) . "',\n                                         '" . intval($nLanguageID) . "',\n                                         '" . oos_db_input($review) . "')");
 $email_subject = 'Review: ' . $product_info['products_name'];
 $email_text = "\n";
 $email_text .= "Firstname: " . $customer_values['customers_firstname'] . "\n";
 $email_text .= "Lastname:  " . $customer_values['customers_lastname'] . "\n";
 $email_text .= "\n";
 $email_text .= "Text:         " . $review . "\n";
 oos_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $email_subject, nl2br($email_text), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
 // clear cache
 require 'includes/classes/class_template.php';
 $oSmarty =& new Template();
 $sLocaleDir = $oSmarty->template_dir;
 $aSkins = array();
 if (is_dir($sLocaleDir)) {
     if ($dh = opendir($sLocaleDir)) {
         while (($file = readdir($dh)) !== false) {
             if ($file == '.' || $file == '..' || $file == 'CVS' || $file == '.svn' || $file == 'default' || filetype($sLocaleDir . $file) == 'file') {
                 continue;
             }
             if (filetype(realpath($sLocaleDir . $file)) == 'dir') {
                 $aSkins[] = $file;
             }
         }
   http://www.oscommerce.com

   Copyright (c) 2003 osCommerce
   ----------------------------------------------------------------------
   Released under the GNU General Public License
   ---------------------------------------------------------------------- */
/** ensure this file is being included by a parent file */
defined('OOS_VALID_MOD') or die('Direct Access to this location is not allowed.');
require 'includes/languages/' . $sLanguage . '/main_contact_us.php';
$error = '0';
if (isset($_POST['action']) && $_POST['action'] == 'send' && (isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid'])) {
    $name = oos_prepare_input($_POST['name']);
    $email = oos_prepare_input($_POST['email']);
    $enquiry = oos_prepare_input($_POST['enquiry']);
    if (oos_validate_is_email(trim($email))) {
        oos_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $aLang['email_subject'], $enquiry, $name, $email);
        MyOOS_CoreApi::redirect(oos_href_link($aModules['main'], $aFilename['contact_us'], 'action=success'));
    } else {
        $error = '1';
    }
}
// links breadcrumb
$oBreadcrumb->add($aLang['navbar_title'], oos_href_link($aModules['main'], $aFilename['contact_us']));
$aOption['template_main'] = $sTheme . '/system/old_contact_us.html';
$aOption['page_heading'] = $sTheme . '/heading/page_heading.html';
$nPageType = OOS_PAGE_TYPE_MAINPAGE;
require 'includes/oos_system.php';
if (!isset($option)) {
    require 'includes/info_message.php';
    require 'includes/oos_blocks.php';
}
            if ($gender == 'm') {
                $email_owner .= $aLang['entry_gender'] . ' ' . $aLang['male'] . "\n";
            } else {
                $email_owner .= $aLang['entry_gender'] . ' ' . $aLang['female'] . "\n";
            }
        }

        $email_owner .= $aLang['owner_email_first_name'] . ' ' . $firstname . "\n" .
                        $aLang['owner_email_last_name'] . ' ' . $lastname . "\n\n" .
                        $aLang['owner_email_street'] . ' ' . $street_address . "\n" .
                        $aLang['owner_email_post_code'] . ' ' . $postcode . "\n" .
                        $aLang['owner_email_city'] . ' ' . $city . "\n" .
                        $aLang['email_separator'] . "\n\n" .
                        $aLang['owner_email_contact'] . "\n" .
                        $aLang['owner_email_telephone_number'] . ' ' . $telephone . "\n" .
                        $aLang['owner_email_fax_number'] . ' ' . $fax . "\n" .
                        $aLang['owner_email_address'] . ' ' . $email_address . "\n" .
                        $aLang['email_separator'] . "\n\n" .
                        $aLang['owner_email_options'] . "\n";
        if ($newsletter == '1') {
            $email_owner .= $aLang['owner_email_newsletter'] . $aLang['entry_newsletter_yes'] . "\n";
        } else {
            $email_owner .= $aLang['owner_email_newsletter'] . $aLang['entry_newsletter_no'] . "\n";
        }
        oos_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $aLang['owner_email_subject'], nl2br($email_owner), $name, $email_address);
    }

    MyOOS_CoreApi::redirect(oos_href_link($aPages['account'], '', 'SSL'));
}

Beispiel #6
0
    function after_process() {
      global $insert_id;

      if ( (defined('MODULE_PAYMENT_CC_EMAIL')) && (oos_validate_is_email(MODULE_PAYMENT_CC_EMAIL)) ) {
        $message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n" .
                   'CVV:' . $this->cc_cvv . "\n\n" . 'Start:' . $this->cc_start . "\n\n" .
                   'ISSUE:' . $this->cc_issue . "\n\n";


        oos_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
      }
    }
         $fromemail_error = '1';
         $error = '1';
     }
 }
 if (isset($_GET['action']) && $_GET['action'] == 'process' && empty($from_name)) {
     $fromname_error = '1';
     $error = '1';
 }
 if (isset($_GET['action']) && $_GET['action'] == 'process' && $error == '0' && (isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid'])) {
     $email_subject = sprintf($aLang['text_email_subject'], $from_name, STORE_NAME);
     $email_body = sprintf($aLang['text_email_intro'], $friendname, $from_name, $products_name, STORE_NAME) . "\n\n";
     if (!empty($_POST['yourmessage'])) {
         $email_body .= oos_prepare_input($_POST['yourname']) . "\n\n";
     }
     $email_body .= sprintf($aLang['text_email_link'], oos_href_link($aModules['products'], $aFilename['product_info'], 'products_id=' . $_GET['products_id'])) . "\n\n" . sprintf($aLang['text_email_signature'], STORE_NAME . "\n" . OOS_HTTP_SERVER . OOS_SHOP . "\n");
     oos_mail($friendname, $friendemail, $email_subject, stripslashes($email_body), '', $from_email_address);
 } else {
     if (isset($_SESSION['customer_id'])) {
         $your_name_prompt = $account_values['customers_firstname'] . ' ' . $account_values['customers_lastname'];
         $your_email_address_prompt = $account_values['customers_email_address'];
     } else {
         $your_name_prompt = oos_draw_input_field('yourname', $fromname_error == '1' ? $yourname : $_GET['yourname']);
         if ($fromname_error == '1') {
             $your_name_prompt .= '&nbsp;<span class="errorText">' . $aLang['text_required'] . '</span>';
         }
         $your_email_address_prompt = oos_draw_input_field('from', $fromemail_error == '1' ? $from : $_GET['from']);
         if ($fromemail_error == '1') {
             $your_email_address_prompt .= $aLang['entry_email_address_check_error'];
         }
     }
 }
Beispiel #8
0
                    $aLang['email_separator'] . "\n" .
                    sprintf($aLang['email_gv_from'], $send_name) . "\n";
        if (isset($_POST['message'])) {
            $gv_email .= $aLang['email_gv_message'] . "\n";
            if (isset($to_name)) {
                $gv_email .= sprintf($aLang['email_gv_send_to'], $to_name) . "\n\n";
            }
            $gv_email .= stripslashes($message) . "\n\n";
        }
        $gv_email .= sprintf($aLang['email_gv_redeem'], $id1) . "\n\n";
        $gv_email .= $aLang['email_gv_link'] . oos_href_link($aPages['gv_redeem'], 'gv_no=' . $id1, 'NONSSL', false, false);
        $gv_email .= "\n\n";
        $gv_email .= $aLang['email_gv_fixed_footer'] . "\n\n";
        $gv_email .= $aLang['email_gv_shop_footer'] . "\n\n";
        // $gv_email_subject = sprintf($aLang['email_gv_text_subject'], $send_name);
        oos_mail('', $email, $aLang['email_subject'], nl2br($gv_email), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

    }
}

if ($action == 'send' && $error == '0') {
    // validate entries
    $gv_amount = (double) $gv_amount;
    $customerstable = $oostable['customers'];
    $sql = "SELECT customers_firstname, customers_lastname
            FROM $customerstable
            WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'";
    $gv_result = $dbconn->Execute($sql);
    $gv = $gv_result->fields;
    $send_name = $gv['customers_firstname'] . ' ' . $gv['customers_lastname'];
}
 $UpdateOrders .= " where orders_id = '" . oos_db_input($oID) . "';";
 $dbconn->Execute($UpdateOrders);
 $order_updated = true;
 $check_status_result = $dbconn->Execute("select customers_name, customers_email_address, orders_status, date_purchased from " . $oostable['orders'] . " where orders_id = '" . (int) $oID . "'");
 $check_status = $check_status_result->fields;
 // Update Status History & Email Customer if Necessary
 if ($order->info['orders_status'] != $status) {
     // Notify Customer
     $customer_notified = '0';
     if (isset($_POST['notify']) && $_POST['notify'] == 'on') {
         $notify_comments = '';
         if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') {
             $notify_comments = sprintf(EMAIL_TEXT_COMMENTS_UPDATE, $comments) . "\n\n";
         }
         $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . oos_catalog_link($aFilename['catalog_account_history_info'], 'order_id=' . $oID, 'SSL') . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . oos_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$status]);
         oos_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         $customer_notified = '1';
     }
     // "Status History" table has gone through a few
     // different changes, so here are different versions of
     // the status update.
     // NOTE: Theoretically, there shouldn't be a
     //       orders_status field in the ORDERS table. It
     //       should really just use the latest value from
     //       this status history table.
     if ($CommentsWithStatus) {
         $dbconn->Execute("insert into " . $oostable['orders_status_history'] . "\n        (orders_id, orders_status_id, date_added, customer_notified, comments)\n        values ('" . oos_db_input($oID) . "', '" . oos_db_input($status) . "', '" . date("Y-m-d H:i:s", time()) . "', " . oos_db_input($customer_notified) . ", '" . oos_db_input($comments) . "')");
     } else {
         if ($OldNewStatusValues) {
             $dbconn->Execute("insert into " . $oostable['orders_status_history'] . "\n          (orders_id, new_value, old_value, date_added, customer_notified)\n          values ('" . oos_db_input($oID) . "', '" . oos_db_input($status) . "', '" . $order->info['orders_status'] . "', '" . date("Y-m-d H:i:s", time()) . "', " . oos_db_input($customer_notified) . ")");
         } else {
      if (EMAIL_USE_HTML == '1') {
        $email .= '<a href="' . oos_catalog_link($aCatalogPage['default']) . '">' . STORE_OWNER . "\n" . OOS_HTTP_SERVER . OOS_SHOP . '</a>';
      } else {
        $email .= STORE_OWNER . "\n" . OOS_HTTP_SERVER . OOS_SHOP;
      }

      $email .= "\n\n" . $_POST['message'];
      $custname = $inrec['fname'] . ' ' . $inrec['lname'];

      $outEmailAddr = '"' . $custname . '" <' . $inrec['email'] . '>';
      if (oos_is_not_null(RCS_EMAIL_COPIES_TO)) {
        $outEmailAddr .= ', ' . RCS_EMAIL_COPIES_TO;
      }

      oos_mail($custname, $outEmailAddr, EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

      $mline = '';

      // See if a record for this customer already exists; if not create one and if so update it
      $recovercartsalestable = $oostable['recovercartsales'];
      $done_result = $dbconn->Execute("SELECT customers_id FROM $recovercartsalestable WHERE customers_id = '" . $cid . "'");
      if ($done_result->RecordCount() == 0) {
        $recovercartsalestable = $oostable['recovercartsales'];
        $dbconn->Execute("INSERT INTO $recovercartsalestable (customers_id, recovercartsales_date_added, recovercartsales_date_modified ) VALUES ('" . $cid . "', '" . seadate('0') . "', '" . seadate('0') . "')");
     } else {
        $recovercartsalestable = $oostable['recovercartsales'];
        $dbconn->Execute("UPDATE $recovercartsalestable SET recovercartsales_date_modified = '" . seadate('0') . "' WHERE customers_id = '" . $cid . "'");
      }

      echo $cline;
     $hiddenPassword = '******';
     $stored_email[] = 'NONE';
     $admintable = $oostable['admin'];
     $check_email_query = "SELECT admin_email_address FROM {$admintable} WHERE admin_id <> " . $admin_id . "";
     $check_email_result =& $dbconn->Execute($check_email_query);
     while ($check_email = $check_email_result->fields) {
         $stored_email[] = $check_email['admin_email_address'];
         // Move that ADOdb pointer!
         $check_email_result->MoveNext();
     }
     if (in_array($_POST['admin_email_address'], $stored_email)) {
         oos_redirect_admin(oos_href_link_admin($aFilename['admin_members'], 'page=' . $_GET['page'] . 'mID=' . $_GET['mID'] . '&error=email&action=edit_member'));
     } else {
         $sql_data_array = array('admin_groups_id' => oos_db_prepare_input($_POST['admin_groups_id']), 'admin_firstname' => oos_db_prepare_input($_POST['admin_firstname']), 'admin_lastname' => oos_db_prepare_input($_POST['admin_lastname']), 'admin_email_address' => oos_db_prepare_input($_POST['admin_email_address']), 'admin_modified' => '" . date("Y-m-d H:i:s", time()) . "');
         oos_db_perform($oostable['admin'], $sql_data_array, 'update', 'admin_id = \'' . $admin_id . '\'');
         oos_mail($_POST['admin_firstname'] . ' ' . $_POST['admin_lastname'], $_POST['admin_email_address'], ADMIN_EMAIL_SUBJECT, sprintf(ADMIN_EMAIL_TEXT, $_POST['admin_firstname'], OOS_HTTP_SERVER . OOS_SHOP . OOS_ADMIN, $_POST['admin_email_address'], $hiddenPassword, STORE_OWNER), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         oos_redirect_admin(oos_href_link_admin($aFilename['admin_members'], 'page=' . $_GET['page'] . '&mID=' . $admin_id));
     }
     break;
 case 'member_delete':
     $admin_id = oos_db_prepare_input($_POST['admin_id']);
     $query = "DELETE FROM " . $oostable['admin'] . " WHERE admin_id = '" . $admin_id . "'";
     $dbconn->Execute($query);
     oos_redirect_admin(oos_href_link_admin($aFilename['admin_members'], 'page=' . $_GET['page']));
     break;
 case 'group_define':
     $selected_checkbox = $_POST['groups_to_boxes'];
     $admin_filestable = $oostable['admin_files'];
     $define_files_query = "SELECT admin_files_id FROM {$admin_filestable} ORDER BY admin_files_id";
     $define_files_result =& $dbconn->Execute($define_files_query);
     while ($define_files = $define_files_result->fields) {
            $email_order .= "Kontoinhaber: ". $banktransfer_owner . "\n";
            $email_order .= "BLZ:          ". $banktransfer_blz . "\n";
            $email_order .= "Konto:        ". $banktransfer_number . "\n";
            $email_order .= "Bank:         ". $banktransfer_bankname . "\n";

            if ($_POST['banktransfer_status'] == 0 || $_POST['banktransfer_status'] == 2){
                $email_order .= "Pruefstatus:   OK\r\n";
            } else {
                $email_order .= "Pruefstatus:   Es ist ein Problem aufgetreten, bitte beobachten!\r\n";
            }
         } elseif ($_POST['banktransfer_fax'] == "on") {
            $email_order .= "\n";
            $email_order .= "Kontodaten werden per Fax bestaetigt!\n";
         }
    }
    oos_mail('', SEND_EXTRA_ORDER_EMAILS_TO, $aLang['email_text_subject'], nl2br($email_order), $oOrder->customer['firstname'] . ' ' . $oOrder->customer['lastname'], $oOrder->customer['email_address'], true);
}


// load the after_process function from the payment modules
$oPaymentModules->after_process();

$oOrderTotalModules->sendFax();
$oOrderTotalModules->sendSMS();

$_SESSION['cart']->reset(true);

// unregister session variables used during checkout
unset($_SESSION['sendto']);
unset($_SESSION['billto']);
unset($_SESSION['shipping']);
/** ensure this file is being included by a parent file */
defined('OOS_VALID_MOD') or die('Direct Access to this location is not allowed.');
require 'includes/languages/' . $sLanguage . '/user_password_forgotten.php';
if (isset($_POST['action']) && $_POST['action'] == 'process' && (isset($_SESSION['formid']) && $_SESSION['formid'] == $_POST['formid'])) {
    $email_address = oos_prepare_input($_POST['email_address']);
    $customerstable = $oostable['customers'];
    $check_customer_sql = "SELECT customers_firstname, customers_lastname, customers_password, customers_id\n                           FROM {$customerstable}\n                           WHERE customers_email_address = '" . oos_db_input($email_address) . "'";
    $check_customer_result = $dbconn->Execute($check_customer_sql);
    if ($check_customer_result->RecordCount()) {
        $check_customer = $check_customer_result->fields;
        // Crypted password mods - create a new password, update the database and mail it to them
        $newpass = oos_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
        $crypted_password = oos_encrypt_password($newpass);
        $customerstable = $oostable['customers'];
        $dbconn->Execute("UPDATE {$customerstable}\n                          SET customers_password = '******'\n                          WHERE customers_id = '" . $check_customer['customers_id'] . "'");
        oos_mail($check_customer['customers_firstname'] . " " . $check_customer['customers_lastname'], $email_address, $aLang['email_password_reminder_subject'], nl2br(sprintf($aLang['email_password_reminder_body'], $newpass)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
        $_SESSION['info_message'] = $aLang['text_password_sent'];
        MyOOS_CoreApi::redirect(oos_href_link($aPages['login'], '', 'SSL', true, false));
    } else {
        MyOOS_CoreApi::redirect(oos_href_link($aPages['password_forgotten'], 'email=nonexistent', 'SSL'));
    }
} else {
    // links breadcrumb
    $oBreadcrumb->add($aLang['navbar_title_1'], oos_href_link($aPages['login'], '', 'SSL'));
    $oBreadcrumb->add($aLang['navbar_title_2'], oos_href_link($aPages['password_forgotten'], '', 'SSL'), bookmark);
    $aOption['template_main'] = $sTheme . '/modules/user_password_forgotten.html';
    $aOption['page_heading'] = $sTheme . '/heading/page_heading.html';
    $aOption['breadcrumb'] = 'default/system/breadcrumb.html';
    $nPageType = OOS_PAGE_TYPE_SERVICE;
    require 'includes/oos_system.php';
    if (!isset($option)) {
     $ticket_tickettable = $oostable['ticket_ticket'];
     $ticket_update_result = $dbconn->Execute("SELECT ticket_customers_email, ticket_customers_name, ticket_link_id FROM {$ticket_tickettable} WHERE ticket_id = '" . $tID . "'");
     $ticket_update = $ticket_update_result->fields;
     if (!$ticket_update['ticket_customers_email']) {
         $error = true;
         $messageStack->add_session(WARNING_TICKET_NOT_UPDATED . "AA", 'warning');
     }
     if ($error == false) {
         $sql_data_array = array('ticket_id' => $tID, 'ticket_status_id' => $status, 'ticket_priority_id' => $priority, 'ticket_department_id' => $department, 'ticket_date_modified' => 'now()', 'ticket_customer_notified' => '0', 'ticket_edited_by' => $ticket_admin_array[$admin], 'ticket_comments' => $enquiry);
         oos_db_perform($oostable['ticket_status_history'], $sql_data_array);
         $sql_data_array = array('ticket_date_last_modified' => 'now()', 'ticket_status_id' => $status, 'ticket_priority_id' => $priority, 'ticket_department_id' => $department, 'ticket_login_required' => $ticket_login_required);
         oos_db_perform($oostable['ticket_ticket'], $sql_data_array, 'update', 'ticket_id=\'' . $tID . '\'');
         // Email  Customer doesn't get the Message cause he should use the web
         $ticket_email_subject = TICKET_EMAIL_SUBJECT . $subject;
         $ticket_email_message = TICKET_EMAIL_message_HEADER . "\n\n" . oos_catalog_link($oosModules['ticket'], $oosCatalogFilename['ticket_view'], 'tlid=' . $ticket_update['ticket_link_id'], 'NONSSL', false, false) . "\n\n" . TICKET_EMAIL_message_FOOTER;
         oos_mail($ticket_update['ticket_customers_name'], $ticket_update['ticket_customers_email'], $ticket_email_subject, nl2br($ticket_email_message), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         $ticket_updated = true;
     }
     if ($ticket_updated) {
         $messageStack->add_session(SUCCESS_TICKET_UPDATED, 'success');
     } else {
         $messageStack->add_session(WARNING_TICKET_NOT_UPDATED, 'warning');
     }
     oos_redirect_admin(oos_href_link_admin($aFilename['ticket_view'], oos_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'deleteconfirm':
     $tID = oos_db_prepare_input($_GET['tID']);
     $ticket_tickettable = $oostable['ticket_ticket'];
     $dbconn->Execute("DELETE FROM {$ticket_tickettable} WHERE ticket_id='" . $tID . "'");
     oos_redirect_admin(oos_href_link_admin($aFilename['ticket_view'], oos_get_all_get_params(array('tID', 'action'))));
     break;
            $ticket_link_id .= substr($time, $x, 1) . oos_create_random_value(1, $type = 'chars');
        }
        $sql_data_array = array('ticket_link_id' => $ticket_link_id, 'ticket_customers_id' => $ticket_customers_id, 'ticket_customers_orders_id' => $ticket_customers_orders_id, 'ticket_customers_email' => $email, 'ticket_customers_name' => $name, 'ticket_subject' => $subject, 'ticket_status_id' => TICKET_DEFAULT_STATUS_ID, 'ticket_department_id' => $department, 'ticket_priority_id' => $priority, 'ticket_login_required' => TICKET_CUSTOMER_LOGIN_REQUIREMENT_DEFAULT, 'ticket_date_last_modified' => 'now()', 'ticket_date_last_customer_modified' => 'now()', 'ticket_date_created' => 'now()');
        oos_db_perform($oostable['ticket_ticket'], $sql_data_array);
        $insert_id = $dbconn->Insert_ID();
        $sql_data_array = array('ticket_id' => $insert_id, 'ticket_status_id' => TICKET_DEFAULT_STATUS_ID, 'ticket_priority_id' => $priority, 'ticket_department_id' => $department, 'ticket_date_modified' => 'now()', 'ticket_customer_notified' => '1', 'ticket_edited_by' => $name, 'ticket_comments' => $enquiry);
        oos_db_perform($oostable['ticket_status_history'], $sql_data_array);
        // Email  Customer doesn't get the Message cause he should use the web
        $ticket_email_subject = $aLang['ticket_email_subject'] . $subject;
        $ticket_email_message = $aLang['ticket_email_message_header'] . "\n\n" . oos_href_link($aPages['ticket_view'], 'tlid=' . $ticket_link_id, 'NONSSL', false, false) . "\n\n" . $aLang['ticket_email_ticket_nr'] . " " . $ticket_link_id . "\n" . $aLang['ticket_email_message_footer'];
        $ticket_email_message = decode($ticket_email_message);
        oos_mail($name, $email, $ticket_email_subject, nl2br($ticket_email_message), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '3');
        // send emails to other people
        if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
            // $ticket_email_message = $aLang['ticket_email_message_header'] . "\n\n" . oos_href_link($aPages['ticket_view'], 'tlid=' . $ticket_link_id, 'NONSSL', false, false) . "\n\n" . $aLang['ticket_email_message_footer'] . "\n\n" . $enquiry;
            oos_mail('', SEND_EXTRA_ORDER_EMAILS_TO, $ticket_email_subject, nl2br($ticket_email_message), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '1');
        }
        MyOOS_CoreApi::redirect(oos_href_link($aPages['ticket_create'], 'action=success&amp;tlid=' . $ticket_link_id));
    }
}
if (TICKET_USE_ORDER_IDS == '1' && isset($_SESSION['customer_id'])) {
    $orders_id = array();
    $orders_values = array();
    $orderstable = $oostable['orders'];
    $sql = "SELECT orders_id, date_purchased\n            FROM {$orderstable}\n            WHERE customers_id= '" . intval($_SESSION['customer_id']) . "'";
    $customers_orders_result = $dbconn->Execute($sql);
    if (isset($_GET['ticket_order_id'])) {
        $ticket_preselected_order_id = oos_var_prep_for_os($_GET['ticket_order_id']);
    }
    $orders_id[] = '';
    $orders_values[] = ' --- ';
// Check if email exists
    $admintable = $oostable['admin'];
    $check_admin_result = $dbconn->Execute("SELECT admin_id as check_id, admin_firstname as check_firstname, admin_lastname as check_lastname, admin_email_address as check_email_address FROM $admintable WHERE admin_email_address = '" . oos_db_input($email_address) . "'");
    if (!$check_admin_result->RecordCount()) {
      $login = '******';
    } else {
      $check_admin = $check_admin_result->fields;
      if ($check_admin['check_firstname'] != $firstname) {
        $login = '******';
      } else {
        $login = '******';
        $make_password = oos_create_random_value(7);
        $crypted_password = oos_encrypt_password($make_password);

        oos_mail($check_admin['check_firstname'] . ' ' . $check_admin['admin_lastname'], $check_admin['check_email_address'], ADMIN_PASSWORD_SUBJECT, nl2br(sprintf(ADMIN_EMAIL_TEXT, $make_password)), STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
        $admintable = $oostable['admin'];
        $dbconn->Execute("UPDATE $admintable
                          SET admin_password = '******'
                          WHERE admin_id = '" . oos_db_input($check_admin['check_id']) . "'");
      }
    }
  }
  require('includes/languages/' . $_SESSION['language'] . '/' . $aFilename['login']);

  if ($login == 'success') {
    $success_message = TEXT_FORGOTTEN_SUCCESS;
  } elseif ($login == 'fail') {
    $info_message = TEXT_FORGOTTEN_ERROR;
  }
?>