예제 #1
0
/**
 * This file is part of the SysCP project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.syscp.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <*****@*****.**>
 * @license    GPLv2 http://files.syscp.org/misc/COPYING.txt
 * @package    Functions
 * @version    $Id$
 */
function getCustomers($limit_resource = '')
{
    global $db;
    $additional_conditions = '';
    $additional_conditions_array = array();
    if (getSessionUserDetail('customers_see_all') != true) {
        $additional_conditions_array[] = '`adminid` = \'' . (int) getSessionUserDetail('adminid') . '\'';
    }
    if ($limit_resource != '') {
        $additional_conditions_array[] = '(`' . $limit_resource . '_used` < `' . $limit_resource . '` OR `' . $limit_resource . '` = \'-1\')';
    }
    if (!empty($additional_conditions_array)) {
        $additional_conditions = ' WHERE ' . implode(' AND ', $additional_conditions_array) . ' ';
    }
    $query = 'SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `' . TABLE_PANEL_CUSTOMERS . '` ' . $additional_conditions . ' ORDER BY `name` ASC';
    $result = $db->query($query);
    $customers_array = array();
    while ($row = $db->fetch_array($result)) {
        $customers_array[$row['customerid']] = getCorrectFullUserDetails($row) . ' (' . $row['loginname'] . ')';
    }
    return $customers_array;
}
예제 #2
0
            try {
                $bulk = new DomainBulkAction($file_name, $customerid);
                $result = $bulk->doImport($separator, $offset);
            } catch (Exception $e) {
                standard_error('domain_import_error', $e->getMessage());
            }
            // @FIXME find a way to display $result['notice'] here somehow,
            //        as it might be important if you've reached your maximum allocation of domains
            // update customer/admin counters
            updateCounters(false);
            $result_str = $result['imported'] . ' / ' . $result['all'];
            standard_success('domain_import_successfully', $result_str, array('filename' => $filename, 'action' => '', 'page' => 'domains'));
        } else {
            $customers = makeoption($lng['panel']['please_choose'], 0, 0, true);
            $result_customers_stmt = Database::prepare("\n\t\t\t\tSELECT `customerid`, `loginname`, `name`, `firstname`, `company`\n\t\t\t\tFROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int) $userinfo['adminid'] . "' ") . " ORDER BY `name` ASC");
            $params = array();
            if ($userinfo['customers_see_all'] == '0') {
                $params['adminid'] = $userinfo['adminid'];
            }
            Database::pexecute($result_customers_stmt, $params);
            while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
                $customers .= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']);
            }
            $domain_import_data = (include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_import.php');
            $domain_import_form = htmlform::genHTMLForm($domain_import_data);
            $title = $domain_import_data['domain_import']['title'];
            $image = $domain_import_data['domain_import']['image'];
            eval("echo \"" . getTemplate("domains/domains_import") . "\";");
        }
    }
}
예제 #3
0
         $customers .= makeoption(getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid'], $result['customerid']);
     }
 } else {
     $customer = $db->query_first("SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid` = '" . (int) $result['customerid'] . "'");
     $result['customername'] = getCorrectFullUserDetails($customer) . ' (' . $customer['loginname'] . ')';
 }
 if ($userinfo['customers_see_all'] == '1') {
     if ($settings['panel']['allow_domain_change_admin'] == '1') {
         $admins = '';
         $result_admins = $db->query("SELECT `adminid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_ADMINS . "` WHERE (`domains_used` < `domains` OR `domains` = '-1') OR `adminid` = '" . (int) $result['adminid'] . "' ORDER BY `name` ASC");
         while ($row_admin = $db->fetch_array($result_admins)) {
             $admins .= makeoption(getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $result['adminid']);
         }
     } else {
         $admin = $db->query_first("SELECT `adminid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_ADMINS . "` WHERE `adminid` = '" . (int) $result['adminid'] . "'");
         $result['adminname'] = getCorrectFullUserDetails($admin) . ' (' . $admin['loginname'] . ')';
     }
 }
 $result['domain'] = $idna_convert->decode($result['domain']);
 $domains = makeoption($lng['domains']['noaliasdomain'], 0, NULL, true);
 $result_domains = $db->query("SELECT `d`.`id`, `d`.`domain`  FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid`=0 AND `d`.`id`<>'" . (int) $result['id'] . "' AND `c`.`standardsubdomain`<>`d`.`id` AND `d`.`customerid`='" . (int) $result['customerid'] . "' AND `c`.`customerid`=`d`.`customerid` ORDER BY `d`.`domain` ASC");
 while ($row_domain = $db->fetch_array($result_domains)) {
     $domains .= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']);
 }
 if ($userinfo['ip'] == "-1") {
     $result_ipsandports = $db->query("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' ORDER BY `ip`, `port` ASC");
     $result_ssl_ipsandports = $db->query("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='1' ORDER BY `ip`, `port` ASC");
 } else {
     $admin_ip = $db->query_first("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id`='" . (int) $userinfo['ip'] . "' ORDER BY `ip`, `port` ASC");
     $result_ipsandports = $db->query("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='0' AND `ip`='" . $admin_ip['ip'] . "' ORDER BY `ip`, `port` ASC");
     $result_ssl_ipsandports = $db->query("SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `ssl`='1' AND `ip`='" . $admin_ip['ip'] . "' ORDER BY `ip`, `port` ASC");
예제 #4
0
        Database::pexecute($andere_stmt, array('id' => $id));
        $numrows_andere = Database::num_rows();
        while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
            $subticket = ticket::getInstanceOf($userinfo, (int) $row2['id']);
            $lastchange = date("d.m.Y H:i\\h", $subticket->Get('lastchange'));
            if ($subticket->Get('by') == '1') {
                $by = $lng['ticket']['staff'];
            } else {
                $cid = $subticket->Get('customer');
                $usr_stmt = Database::prepare('
					SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
					FROM `' . TABLE_PANEL_CUSTOMERS . '`
					WHERE `customerid` = :cid');
                $usr = Database::pexecute_first($usr_stmt, array('cid' => $cid));
                if (isset($usr['loginname'])) {
                    $customer = getCorrectFullUserDetails($usr);
                    $customerloginname = ' (' . $usr['loginname'] . ')';
                    $customerid = $usr['customerid'];
                } else {
                    $customer = $lng['ticket']['nonexistingcustomer'];
                    $customerid = 0;
                    $customerloginname = '';
                }
                if ($customerid != 0) {
                    $by = '<a href="' . $linker->getLink(array('section' => 'customers', 'page' => 'customers', 'action' => 'su', 'id' => $customerid)) . '" rel="external">';
                    $by .= $customer . $customerloginname . '</a>';
                } else {
                    $by = $customer;
                }
            }
            $subject = $subticket->Get('subject');
예제 #5
0
				ORDER BY `lastchange` ASC');
            Database::pexecute($andere_stmt, array("answerto" => $id));
            $numrows_andere = Database::num_rows();
            while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
                $subticket = ticket::getInstanceOf($userinfo, (int) $row2['id']);
                $lastchange = date("d.m.Y H:i\\h", $subticket->Get('lastchange'));
                if ($subticket->Get('by') == '1') {
                    $by = $lng['ticket']['staff'];
                } else {
                    $cid = $subticket->Get('customer');
                    $usr_stmt = Database::prepare('
						SELECT `customerid`, `firstname`, `name`, `company`, `loginname`
						FROM `' . TABLE_PANEL_CUSTOMERS . '`
						WHERE `customerid` = :customerid ');
                    $usr = Database::pexecute_first($usr_stmt, array("customerid" => $cid));
                    $by = getCorrectFullUserDetails($usr);
                }
                $subject = $subticket->Get('subject');
                $message = $subticket->Get('message');
                $row2 = htmlentities_array($row2);
                eval("\$ticket_replies.=\"" . getTemplate("tickets/tickets_tickets_list") . "\";");
            }
            $priorities = makeoption($lng['ticket']['high'], '1', $mainticket->Get('priority'), true, true);
            $priorities .= makeoption($lng['ticket']['normal'], '2', $mainticket->Get('priority'), true, true);
            $priorities .= makeoption($lng['ticket']['low'], '3', $mainticket->Get('priority'), true, true);
            $subject = htmlentities($mainticket->Get('subject'));
            $ticket_replies_count = $numrows_andere + 1;
            // don't forget the main-ticket!
            $ticket_reply_data = (include_once dirname(__FILE__) . '/lib/formfields/customer/tickets/formfield.ticket_reply.php');
            $ticket_reply_form = htmlform::genHTMLForm($ticket_reply_data);
            $title = $ticket_reply_data['ticket_reply']['title'];