Exemple #1
0
 public function account($data, $zones)
 {
     msAPI::log('[' . strtoupper($this->handler) . '] Parsing account array from received data');
     $accounts = array();
     switch ($this->handler) {
         case 'json':
             if (!empty($data['accounts'])) {
                 // Check for multiple..
                 if (isset($data['accounts']['account'][0])) {
                     for ($i = 0; $i < count($data['accounts']['account']); $i++) {
                         $a = (array) $data['accounts']['account'][$i];
                         $accounts[] = array('name' => isset($a['name']) && $a['name'] ? substr($a['name'], 0, 200) : '', 'email' => isset($a['email']) && $a['email'] && mswIsValidEmail($a['email']) ? $a['email'] : '', 'password' => isset($a['password']) && $a['password'] ? $a['password'] : '', 'timezone' => isset($a['timezone']) && $a['timezone'] && in_array($a['timezone'], $zones) ? $a['timezone'] : $this->settings->timezone, 'ip' => isset($a['ip']) && $a['ip'] ? substr($a['ip'], 0, 200) : '', 'language' => isset($a['language']) && $a['language'] && is_dir(PATH . 'content/language/' . $a['language']) ? $a['language'] : $this->settings->language, 'notes' => isset($a['notes']) && $a['notes'] ? $a['notes'] : '');
                     }
                 } else {
                     $a = (array) $data['accounts']['account'];
                     $accounts[] = array('name' => isset($a['name']) && $a['name'] ? substr($a['name'], 0, 200) : '', 'email' => isset($a['email']) && $a['email'] && mswIsValidEmail($a['email']) ? $a['email'] : '', 'password' => isset($a['password']) && $a['password'] ? $a['password'] : '', 'timezone' => isset($a['timezone']) && $a['timezone'] && in_array($a['timezone'], $zones) ? $a['timezone'] : $this->settings->timezone, 'ip' => isset($a['ip']) && $a['ip'] ? substr($a['ip'], 0, 200) : '', 'language' => isset($a['language']) && $a['language'] && is_dir(PATH . 'content/language/' . $a['language']) ? $a['language'] : $this->settings->language, 'notes' => isset($a['notes']) && $a['notes'] ? $a['notes'] : '');
                 }
             }
             break;
         case 'xml':
             if (!empty($data->accounts)) {
                 for ($i = 0; $i < count($data->accounts->account); $i++) {
                     $a = (array) $data->accounts->account[$i];
                     $accounts[] = array('name' => isset($a['name']) && $a['name'] ? substr($a['name'], 0, 200) : '', 'email' => isset($a['email']) && $a['email'] && mswIsValidEmail($a['email']) ? $a['email'] : '', 'password' => isset($a['password']) && $a['password'] ? $a['password'] : '', 'timezone' => isset($a['timezone']) && $a['timezone'] && in_array($a['timezone'], $zones) ? $a['timezone'] : $this->settings->timezone, 'ip' => isset($a['ip']) && $a['ip'] ? substr($a['ip'], 0, 200) : '', 'language' => isset($a['language']) && $a['language'] && is_dir(PATH . 'content/language/' . $a['language']) ? $a['language'] : $this->settings->language, 'notes' => isset($a['notes']) && $a['notes'] ? $a['notes'] : '');
                 }
             }
             break;
     }
     return array('accounts' => $accounts);
 }
 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;
 }
$MSPORTAL->settings = $SETTINGS;
// Add users..
if (isset($_POST['add']) && isset($_GET['disputeUsers'])) {
    $count = 0;
    $tickID = (int) $_GET['disputeUsers'];
    $TICKET = mswGetTableData('tickets', 'id', $tickID);
    $USER = mswGetTableData('portal', 'id', $TICKET->visitorID);
    $new = array();
    if (!empty($_POST['name']) && $tickID > 0 && isset($TICKET->id) && isset($USER->id)) {
        // Batch loop visitors to be added..nuke duplicate emails..
        foreach (array_keys($_POST['email']) as $k) {
            $name = $_POST['name'][$k];
            $email = $_POST['email'][$k];
            $send = isset($_POST['send'][$k]) ? 'yes' : 'no';
            $priv = isset($_POST['priv'][$k]) ? 'yes' : 'no';
            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' => ''));
Exemple #4
0
function mswIsLoggedIn($t)
{
    if (isset($_SESSION[md5(SECRET_KEY) . '_ms_mail']) && isset($_SESSION[md5(SECRET_KEY) . '_ms_key']) && mswIsValidEmail($_SESSION[md5(SECRET_KEY) . '_ms_mail']) || isset($_COOKIE[md5(SECRET_KEY) . '_msc_mail']) && isset($_COOKIE[md5(SECRET_KEY) . '_msc_key']) && mswIsValidEmail($_COOKIE[md5(SECRET_KEY) . '_msc_mail'])) {
        if (!isset($t->name)) {
            header("Location: index.php?p=login");
            exit;
        }
    } else {
        header("Location: index.php?p=login");
        exit;
    }
}
Exemple #5
0
        if ($_POST['accpass'] == '') {
            $_POST['accpass'] = $MSPORTAL->generate();
        }
        $MSUSERS->add();
        // Send mail..
        if (isset($_POST['welcome'])) {
            // Message tags..
            $MSMAIL->addTag('{NAME}', mswCleanData($_POST['name']));
            $MSMAIL->addTag('{EMAIL}', $_POST['email']);
            $MSMAIL->addTag('{PASSWORD}', $_POST['accpass']);
            // Send..
            $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => mswCleanData($SETTINGS->website), 'to_email' => $_POST['email'], 'to_name' => $_POST['name'], 'subject' => str_replace(array('{website}'), array($SETTINGS->website), $emailSubjects['team-account']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => LANG_PATH . 'admin-new-team.txt', 'language' => $SETTINGS->language));
        }
        $OK1 = true;
    }
}
if (isset($_POST['update'])) {
    if (trim($_POST['name']) && mswIsValidEmail($_POST['email'])) {
        // Check edit for global user..
        if ($_GET['edit'] == '1' && $MSTEAM->id != '1') {
            $HEADERS->err403(true);
        }
        $MSUSERS->update($MSTEAM->id);
        $OK2 = true;
    }
}
$title = isset($_GET['edit']) ? $msg_user14 : $msg_adheader57;
$loadJQNyroModal = true;
include PATH . 'templates/header.php';
include PATH . 'templates/system/team/team.php';
include PATH . 'templates/footer.php';
     //========================
 //========================
 // Account login
 //========================
 case 'login':
     $redr = 'index.php?p=dashboard';
     // If login limit and ban time is enabled, check first..
     if ($SETTINGS->loginLimit > 0) {
         $ban = $MSACC->checkban($SETTINGS, $MSDT);
         if ($ban == 'fail') {
             $json = array('status' => 'err', 'field' => 'email', 'msg' => $msg_public_login4);
         }
     }
     if (!isset($json['status']) && isset($_POST['email'], $_POST['pass']) && $_POST['email'] && $_POST['pass']) {
         // Check for valid e-mail..
         if (!mswIsValidEmail($_POST['email'])) {
             $json = array('status' => 'err', 'field' => 'email', 'msg' => $msg_main13);
         } else {
             // Now check account..
             $ACC = mswGetTableData('portal', 'email', mswSafeImportString($_POST['email']), 'AND `userPass` = \'' . md5(SECRET_KEY . $_POST['pass']) . '\' AND `verified` = \'yes\'');
             if (isset($ACC->email)) {
                 // Check access..
                 if ($ACC->enabled == 'yes') {
                     $_SESSION[md5(SECRET_KEY) . '_msw_support'] = $ACC->email;
                     // Ticket/dispute redirection..
                     if (isset($_SESSION['ticketAccessID']) && (int) $_SESSION['ticketAccessID'] > 0) {
                         $redr = 'index.php?t=' . $_SESSION['ticketAccessID'];
                         unset($_SESSION['ticketAccessID']);
                     }
                     if (isset($_SESSION['disputeAccessID']) && (int) $_SESSION['disputeAccessID'] > 0) {
                         $redr = 'index.php?d=' . $_SESSION['disputeAccessID'];
Exemple #7
0
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'])) {
        $MSACC->update();
        // Anything to move?
        if (isset($_POST['dest_email']) && mswIsValidEmail($_POST['dest_email'])) {
            $MSACC->move($_POST['old_email'], $_POST['dest_email']);
        }
        $OK2 = true;
    }
}
$title = isset($_GET['edit']) ? $msg_accounts6 : $msg_adheader39;
$loadJQAlertify = true;
include PATH . 'templates/header.php';
include PATH . 'templates/system/accounts/accounts.php';
include PATH . 'templates/footer.php';
Exemple #8
0
include_once REL_PATH . 'control/classes/class.tickets.php';
include_once PATH . 'control/classes/class.accounts.php';
include_once REL_PATH . 'control/classes/class.fields.php';
include_once REL_PATH . 'control/classes/class.accounts.php';
$MSACC = new accounts();
$MSPORTAL = new accountSystem();
$MSPTICKETS = new tickets();
$MSCFMAN = new customFieldManager();
$MSACC->settings = $SETTINGS;
$MSPTICKETS->settings = $SETTINGS;
$MSPTICKETS->datetime = $MSDT;
$MSPORTAL->settings = $SETTINGS;
// Add ticket..
if (isset($_POST['process'])) {
    $OK = 'fail';
    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));
Exemple #9
0
function mswIsUserLoggedIn()
{
    return isset($_SESSION[md5(SECRET_KEY) . '_msw_support']) && mswIsValidEmail($_SESSION[md5(SECRET_KEY) . '_msw_support']) && mswRowCount('portal WHERE `email` = \'' . $_SESSION[md5(SECRET_KEY) . '_msw_support'] . '\' AND `verified` = \'yes\'') > 0 ? $_SESSION[md5(SECRET_KEY) . '_msw_support'] : 'guest';
}
Exemple #10
0
  Script: Maian Support
  Programmed & Designed by: David Ian Bennett
  E-Mail: support@maianscriptworld.co.uk
  Software Website: http://www.maiansupport.com
  Script Portal: http://www.maianscriptworld.co.uk

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  
  This File: team-profile.php
  Description: System File

  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
if (!defined('PARENT') || $MSTEAM->profile == 'no') {
    $HEADERS->err403(true);
}
// Load mail params
include REL_PATH . 'control/mail-data.php';
if (isset($_POST['process'])) {
    // Revert to default if blank..
    $_POST['name'] = $_POST['name'] ? $_POST['name'] : mswCleanData($MSTEAM->name);
    $_POST['email'] = $_POST['email'] && mswIsValidEmail($_POST['email']) ? $_POST['email'] : mswCleanData($MSTEAM->email);
    $rows = $MSUSERS->profile($MSTEAM);
    if ($rows > 0) {
        $OK = true;
    }
}
$title = $msg_adheader64;
include PATH . 'templates/header.php';
include PATH . 'templates/system/team/team-profile.php';
include PATH . 'templates/footer.php';
Exemple #11
0
    @session_destroy();
    unset($_SESSION[md5(SECRET_KEY) . '_ms_mail'], $_SESSION[md5(SECRET_KEY) . '_ms_key']);
    if (isset($_SESSION['autoPurgeRan'])) {
        unset($_SESSION['autoPurgeRan']);
    }
    if (isset($_COOKIE[md5(SECRET_KEY) . '_msc_mail'])) {
        @setcookie(md5(SECRET_KEY) . '_msc_mail', '');
        @setcookie(md5(SECRET_KEY) . '_msc_key', '');
        unset($_COOKIE[md5(SECRET_KEY) . '_msc_mail'], $_COOKIE[md5(SECRET_KEY) . '_msc_key']);
    }
    header("Location: index.php?p=login");
    exit;
}
if (isset($_POST['process'])) {
    if ($_POST['user'] && $_POST['pass']) {
        if (!mswIsValidEmail($_POST['user'])) {
            $U_ERROR = $msg_login6;
        } else {
            $USER = mswGetTableData('users', 'email', mswSafeImportString($_POST['user']), 'AND `accpass` = \'' . md5(SECRET_KEY . $_POST['pass']) . '\'');
            if (isset($USER->email)) {
                // Update page access..
                if ($USER->id > 0) {
                    $upa = userAccessPages($USER->id);
                    $USER->pageAccess = $upa;
                }
                // Add entry log..
                if ($USER->enableLog == 'yes') {
                    $MSUSERS->log($USER);
                }
                // Set session..
                $_SESSION[md5(SECRET_KEY) . '_ms_mail'] = $USER->email;
         if ($_POST[$f] != '' && $_POST[$f] != '0') {
             ++$sCount;
         }
     }
 }
 // Are all fields blank? If so, just refresh, pointless carrying on..
 // This can trigger from curious people just hitting the open ticket button without doing anything..
 if ($sCount == 0) {
     header("Location: index.php?p=open");
     exit;
 }
 // Ok, so lets see whats invalid..
 if (isset($_POST['name']) && $_POST['name'] == '') {
     array_push($eFields, 'input|name|err1');
 }
 if (isset($_POST['email']) && !mswIsValidEmail($_POST['email'])) {
     array_push($eFields, 'input|email|err1');
 }
 if ((int) $_POST['dept'] == '0') {
     array_push($eFields, 'select|dept|err1');
 }
 if ($_POST['subject'] == '') {
     array_push($eFields, 'input|subject|err1');
 }
 if ($_POST['comments'] == '') {
     array_push($eFields, 'textarea|comments|err1');
 }
 if (!in_array($_POST['priority'], $levelPrKeys)) {
     array_push($eFields, 'select|priority|err1');
 }
 if ($SETTINGS->recaptchaPublicKey && $SETTINGS->recaptchaPrivateKey && isset($_POST['recaptcha_response_field'])) {