if ($name && mswIsValidEmail($email)) {
     $PORTAL = mswGetTableData('portal', 'email', $email);
     // Does visitor exists? If not, add account..
     if (isset($PORTAL->id)) {
         $pass = '';
         if ($PORTAL->language && file_exists(LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-dispute-user-current.txt')) {
             $mailT = LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-dispute-user-current.txt';
             $pLang = $PORTAL->language;
         } else {
             $mailT = LANG_PATH . 'admin-dispute-user-current.txt';
         }
         $userID = $PORTAL->id;
     } else {
         $pass = $MSPORTAL->ms_generate();
         $mailT = LANG_PATH . 'admin-dispute-user-new.txt';
         $userID = $MSACC->add(array('name' => $name, 'email' => $email, 'userPass' => $pass, 'enabled' => 'yes', 'timezone' => '', 'ip' => '', 'notes' => ''));
         $PORTAL = new stdclass();
         $PORTAL->email = $email;
     }
     // If this user isn`t in dispute already, add them..
     if ($PORTAL->email != $USER->email && mswRowCount('disputes WHERE `ticketID` = \'' . $tickID . '\' AND `visitorID` = \'' . $userID . '\'') == 0) {
         $MSTICKET->addDisputeUser($tickID, $userID, $priv);
         // Send notification if enabled..
         if ($send == 'yes') {
             $MSMAIL->addTag('{NAME}', $name);
             $MSMAIL->addTag('{TITLE}', $TICKET->subject);
             $MSMAIL->addTag('{EMAIL}', $email);
             $MSMAIL->addTag('{PASSWORD}', $pass);
             $MSMAIL->addTag('{ID}', $tickID);
             $MSMAIL->addTag('{USER}', $USER->name);
             $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $email, 'to_name' => $name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($tickID)), $emailSubjects['dispute']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => $mailT, 'language' => isset($pLang) ? $pLang : $SETTINGS->language, 'alive' => 'yes'));
Esempio n. 2
0
    if (!mswIsValidEmail($_POST['checkEntered'])) {
        $ret = 'exists';
        $msg = $msg_main13;
    } else {
        $ret = $MSACC->check();
        if ($ret == 'exists') {
            $msg = $msg_portal32;
        }
    }
    echo $JSON->encode(array('response' => $ret, 'message' => $msg));
    exit;
}
// Add..
if (isset($_POST['process'])) {
    if (trim($_POST['name'])) {
        $MSACC->add();
        // Send welcome email?
        if (isset($_POST['welcome'])) {
            // Message tags..
            $MSMAIL->addTag('{NAME}', $_POST['name']);
            $MSMAIL->addTag('{EMAIL}', $_POST['email']);
            $MSMAIL->addTag('{PASSWORD}', $_POST['userPass']);
            // Send..
            $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $_POST['email'], 'to_name' => $_POST['name'], 'subject' => str_replace(array('{website}'), array($SETTINGS->website), $emailSubjects['add']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => LANG_PATH . 'admin-add-account.txt', 'language' => $_POST['language']));
        }
        $OK1 = true;
    }
}
// Update..
if (isset($_POST['update'])) {
    if (trim($_POST['name'])) {
Esempio n. 3
0
 public function import($lines, $del, $enc)
 {
     $count = 0;
     $data = array();
     // Upload CSV file..
     if (is_uploaded_file($_FILES['file']['tmp_name'])) {
         $handle = fopen($_FILES['file']['tmp_name'], 'r');
         if ($handle) {
             while (($CSV = fgetcsv($handle, $lines, $del, $enc)) !== false) {
                 // Clean array..
                 $CSV = array_map('trim', $CSV);
                 // Add account..
                 $_POST['name'] = isset($CSV[0]) && $CSV[0] ? $CSV[0] : '';
                 $_POST['email'] = isset($CSV[1]) && mswIsValidEmail($CSV[1]) ? $CSV[1] : '';
                 $_POST['userPass'] = isset($CSV[2]) && $CSV[2] ? $CSV[2] : substr(md5(uniqid(rand(), 1)), 0, $this->settings->minPassValue);
                 $_POST['enabled'] = 'yes';
                 $_POST['timezone'] = isset($CSV[3]) && in_array($CSV[3], array_keys($this->timezones)) ? $CSV[3] : $this->settings->timezone;
                 $_POST['ip'] = '';
                 // If name and email are ok and email doesn`t exist, we can add user..
                 if ($_POST['name'] && $_POST['email'] && accounts::check($_POST['email']) == 'accept') {
                     ++$count;
                     // Add to db..
                     accounts::add(array('name' => $_POST['name'], 'email' => $_POST['email'], 'userPass' => $_POST['userPass'], 'enabled' => 'yes', 'timezone' => $_POST['timezone'], 'ip' => $_POST['ip'], 'notes' => '', 'language' => $this->settings->language, 'enableLog' => $this->settings->enableLog));
                     // Add to array..
                     $data[$count] = array($_POST['name'], $_POST['email'], $_POST['userPass']);
                 }
             }
             fclose($handle);
         }
         // Clear temp file..
         @unlink($_FILES['file']['tmp_name']);
     }
     return $data;
 }
Esempio n. 4
0
 if ($_POST['subject'] && $_POST['comments'] && $_POST['name'] && mswIsValidEmail($_POST['email'])) {
     // Check if account exists for email address..
     $PORTAL = mswGetTableData('portal', 'email', mswSafeImportString($_POST['email']));
     // Check language..
     if (isset($_PORTAL->id) && $PORTAL->language && file_exists(LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-add-ticket.txt')) {
         $mailT = LANG_BASE_PATH . $PORTAL->language . '/mail-templates/admin-add-ticket.txt';
         $pLang = $PORTAL->language;
     } else {
         $mailT = LANG_PATH . 'admin-add-ticket.txt';
     }
     $pass = '';
     // If portal account doesn`t exist, we need to create it..
     if (!isset($PORTAL->id)) {
         $pass = $MSPORTAL->ms_generate();
         $mailT = LANG_PATH . 'admin-add-ticket-new.txt';
         $userID = $MSACC->add(array('name' => $_POST['name'], 'email' => $_POST['email'], 'userPass' => $pass, 'enabled' => 'yes', 'timezone' => '', 'ip' => '', 'notes' => '', 'language' => $SETTINGS->language));
     }
     // Add ticket to database..
     if (isset($userID) && $userID > 0 || isset($PORTAL->id)) {
         $ID = $MSPTICKETS->add(array('dept' => (int) $_POST['dept'], 'assigned' => isset($_POST['waiting']) ? 'waiting' : (!empty($_POST['assigned']) ? implode(',', $_POST['assigned']) : ''), 'visitor' => isset($userID) ? $userID : $PORTAL->id, 'subject' => $_POST['subject'], 'quoteBody' => '', 'comments' => $_POST['comments'], 'priority' => $_POST['priority'], 'replyStatus' => isset($_POST['closed']) ? 'admin' : 'visitor', 'ticketStatus' => isset($_POST['closed']) ? 'close' : 'open', 'ip' => '', 'notes' => '', 'disputed' => 'no'));
         // Add attachments, history, send emails..
         if ($ID > 0) {
             // Attachments..
             $attString = array();
             if (!empty($_FILES['attachment']['tmp_name'])) {
                 for ($i = 0; $i < count($_FILES['attachment']['tmp_name']); $i++) {
                     $a_name = $_FILES['attachment']['name'][$i];
                     $a_temp = $_FILES['attachment']['tmp_name'][$i];
                     $a_size = $_FILES['attachment']['size'][$i];
                     $a_mime = $_FILES['attachment']['type'][$i];
                     if ($a_name && $a_temp && $a_size > 0) {