if (!$_POST['admin_email']) {
        $error_check = true;
        $email_message = ERROR_WRONG_EMAIL_NULL;
    }
    $_SESSION['company'] = $_SESSION['companies'][$_POST['company']];
    $admin_email = db_prepare_input($_POST['admin_email']);
    $sql = "select admin_id, admin_name, admin_email, admin_pass \r\n  \tfrom " . TABLE_USERS . " where admin_email = '" . db_input($admin_email) . "'";
    $result = $db->Execute($sql);
    if (!($admin_email == $result->fields['admin_email'])) {
        $error_check = true;
        $email_message = ERROR_WRONG_EMAIL;
    }
    if (!$error_check) {
        $new_password = pw_create_random_value(ENTRY_PASSWORD_MIN_LENGTH);
        $admin_pass = pw_encrypt_password($new_password);
        $sql = "update " . TABLE_USERS . " set admin_pass = '******' \r\n\t\twhere admin_email = '" . $result->fields['admin_email'] . "'";
        $db->Execute($sql);
        $html_msg['EMAIL_CUSTOMERS_NAME'] = $result->fields['admin_name'];
        $html_msg['EMAIL_MESSAGE_HTML'] = sprintf(TEXT_EMAIL_MESSAGE, $new_password);
        validate_send_mail($result->fields['admin_name'], $result->fields['admin_email'], TEXT_EMAIL_SUBJECT, sprintf(TEXT_EMAIL_MESSAGE, $new_password), COMPANY_NAME, EMAIL_FROM, $html_msg);
        $email_message = SUCCESS_PASSWORD_SENT;
        gen_add_audit_log(GEN_LOG_RESEND_PW . $admin_email);
    }
}
/*****************   prepare to display templates  *************************/
$include_header = false;
$include_footer = false;
$include_tabs = false;
$include_calendar = false;
$include_template = 'template_main.php';
define('PAGE_TITLE', TITLE);
     // if we are here, there's been an error or delivery method was email
     if ($output['pdf'] && $delivery_method == 'S') {
         // open a temp file
         $temp_file = DIR_FS_MY_FILES . $_SESSION['company'] . '/' . $output['filename'];
         $handle = fopen($temp_file, 'w');
         // put the string into the file
         fwrite($handle, $output['pdf']);
         fclose($handle);
         // generate the email
         $block = array();
         if ($cc_address) {
             $block['EMAIL_CC_NAME'] = $cc_name;
             $block['EMAIL_CC_ADDRESS'] = $cc_address;
         }
         $attachments_list['file'] = $temp_file;
         $success = validate_send_mail($to_name, $to_address, $email_subject, $email_text, $from_name, $from_address, $block, $attachments_list);
         if ($success) {
             $messageStack->add(EMAIL_SEND_SUCCESS, 'success');
         }
         // remove the temp file
         unlink($temp_file);
     }
     $Prefs = FetchReportDetails($ReportID);
     //fetch the defaults
     // Update with passed parameters if so
     // NOTE: The max number of parameters to test is currrently set at the date and 10 form specific.
     $title = RW_TITLE_CRITERIA;
     $IncludePage = 'template_filter.php';
     break;
 case 'cancel':
 default:
Example #3
0
                    }
                    break;
            }
            // if we are here, delivery method was email
            if (!$error && $output) {
                $temp_file = DIR_FS_MY_FILES . $_SESSION['company'] . '/temp/' . $output['filename'];
                $handle = fopen($temp_file, 'w');
                fwrite($handle, $output['pdf']);
                fclose($handle);
                $block = array();
                if ($cc_email) {
                    $block['EMAIL_CC_NAME'] = $cc_name;
                    $block['EMAIL_CC_ADDRESS'] = $cc_email;
                }
                $attachments_list['file'] = $temp_file;
                $success = validate_send_mail($to_name, $to_email, $message_subject, $email_text, $from_name, $from_email, $block, $attachments_list);
                if ($success) {
                    $messageStack->add(EMAIL_SEND_SUCCESS, 'success');
                }
                unlink($temp_file);
            }
        default:
    }
}
/*****************   prepare to display templates  *************************/
$DateArray = explode(':', $report->datedefault);
if (!isset($DateArray[1])) {
    $DateArray[1] = '';
}
if (!isset($DateArray[2])) {
    $DateArray[2] = '';