コード例 #1
0
ファイル: ps_olsi.php プロジェクト: albertobraschi/Hab
 /**
  * process export
  * @name process_export
  * @param Filterstatement to select orders
  * @param db-object
  * @return bool true/false
  */
 function process_export(&$db)
 {
     global $mosConfig_absolute_path, $database;
     $xmldoc = new DOMIT_Document();
     $xmldoc->appendEntityTranslationTable(get_html_translation_table(HTML_SPECIALCHARS, ENT_QUOTES));
     //damit sollte htmlspecialchars nicht mehr notwendig sein
     $xmldoc->expandEmptyElementTags(false);
     $xmldoc->appendChild($xmldoc->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"IS0-8859-1\""));
     $xmldoc->setDocumentElement($xmldoc->createElement('OLOrders'));
     $xmldoc->documentElement->appendChild($xmldoc->createElement('Version1.1'));
     $order_status = vmGet($_REQUEST, 'status', '');
     $order_from = vmGet($_REQUEST, 'from', '');
     $order_since = vmGet($_REQUEST, 'since', '');
     $order_since = vmGet($_REQUEST, 'since', '');
     $order_to = vmGet($_REQUEST, 'to', '');
     $order_id = vmGet($_REQUEST, 'order_id', '');
     $where = array();
     if (!$order_status && !$order_from && !$order_since && !$order_to && !$order_id) {
         $order_status = 'P';
     }
     if ($order_status) {
         $where[] = "order_status = '" . $db->getEscaped($order_status) . "'";
     }
     if ($order_from) {
         $where[] = "order_id >= '" . $db->getEscaped($order_from) . "'";
     } elseif ($order_since) {
         $where[] = "order_id > '" . $db->getEscaped($order_since) . "'";
     } elseif ($order_id) {
         $where[] = "order_id = '" . $db->getEscaped($order_id) . "'";
     }
     if ($order_to && !$order_id) {
         $where[] = "order_id <= '" . $db->getEscaped($order_to) . "'";
     }
     //select the orders to export
     $q = 'SELECT * FROM #__{vm}_orders WHERE vendor_id=\'' . $db->f('vendor_id') . '\' AND ';
     $q .= implode($where);
     $db->setQuery($q);
     $orders = $db->loadAssocList();
     for ($i = 0; $i < count($orders); $i++) {
         //get billing and shipping address
         $q = "SELECT * FROM #__{vm}_order_user_info WHERE order_id='" . $orders[$i]['order_id'] . "'";
         $db->setQuery($q);
         $orders[$i]['user_info'] = $db->loadAssocList();
         //get shipping address
         $q = "SELECT * FROM #__{vm}_order_item WHERE order_id='" . $orders[$i]['order_id'] . "'";
         $db->setQuery($q);
         $orders[$i]['item'] = $db->loadAssocList();
         //get payment info
         $q = "SELECT * FROM #__{vm}_order_payment WHERE order_id='" . $orders[$i]['order_id'] . "'";
         $db->setQuery($q);
         $orders[$i]['payment'] = $db->loadAssocList();
     }
     foreach ($orders as $order) {
         //print_r($order);
         $OLWebOrder['OLWebOrder']['TransactionHeader']['TransactionID'] = $order['order_id'];
         $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['OrderDate'] = date('d.m.Y H:i:s', $order['cdate']);
         $OLWebOrder['OLWebOrder']['OrderHeader']['HeaderText'] = $order['customer_note'];
         $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['RefNo'] = str_pad($order['order_id'], 8, 0, STR_PAD_LEFT);
         for ($i = 0; $i < count($order['user_info']); $i++) {
             switch ($order['user_info'][$i]['address_type']) {
                 case 'BT':
                 default:
                     if ($order['company']) {
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name1'] = $order['user_info'][$i]['company'];
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] . ' ' : ' ') . $order['user_info'][$i]['last_name'];
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Matchcode'] = $order['user_info'][$i]['company'] . ', ' . $order['user_info'][$i]['customers_city'];
                     } else {
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name1'] = $order['user_info'][$i]['last_name'];
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Name2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] : '');
                         $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Matchcode'] = $order['user_info'][$i]['last_name'] . ', ' . $order['user_info'][$i]['city'];
                     }
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Title'] = $order['user_info'][$i]['title'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Street'] = $order['user_info'][$i]['address_1'] . ($order['user_info'][$i]['address_2'] ? ', ' . $order['user_info'][$i]['address_2'] : '');
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['ZIPCode'] = $order['user_info'][$i]['zip'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['City'] = $order['user_info'][$i]['city'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['State'] = $order['user_info'][$i]['state'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['Country'] = $this->getISOCode2($order['user_info'][$i]['country']);
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['EMail'] = $order['user_info'][$i]['user_email'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['AddrTelefon'] = $order['user_info'][$i]['phone_1'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['Address']['AddrFax'] = $order['user_info'][$i]['fax'];
                     break;
                 case 'ST':
                     if ($order['company']) {
                         $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName1'] = $order['user_info'][$i]['company'];
                         $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] . ' ' : ' ') . $order['user_info'][$i]['last_name'];
                     } else {
                         $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName1'] = $order['user_info'][$i]['last_name'];
                         $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAName2'] = $order['user_info'][$i]['first_name'] . ($order['user_info'][$i]['middle_name'] ? ' ' . $order['user_info'][$i]['middle_name'] : '');
                     }
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DATitle'] = $order['user_info'][$i]['title'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAStreet'] = $order['user_info'][$i]['address_1'] . ($order['user_info'][$i]['address_2'] ? ', ' . $order['user_info'][$i]['address_2'] : '');
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAZIPCode'] = $order['user_info'][$i]['zip'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DACity'] = $order['user_info'][$i]['city'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DAState'] = $order['user_info'][$i]['state'];
                     $OLWebOrder['OLWebOrder']['OrderHeader']['DeliveryAddress']['DACountry'] = $this->getISOCode2($order['user_info'][$i]['country']);
                     break;
             }
         }
         $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['CarrierCode'] = $this->getCarrierCode($order[$i]['ship_method_id']);
         $OLWebOrder['OLWebOrder']['OrderHeader']['ProcessingOptions']['DeliveryPriceGross'] = 0;
         $OLWebOrder['OLWebOrder']['OrderHeader']['Payment']['Currency'] = $order['order_currency'];
         $OLWebOrder['OLWebOrder']['OrderHeader']['Payment']['BelOLPayCond'] = $this->getPaymentCode($order['payment'][0]['payment_method_id']);
         $this->OLWebOrder[] = $OLWebOrder;
         $OLWebOrder = array();
     }
     $this->xmldoc =& $xmldoc;
     return true;
 }
コード例 #2
0
ファイル: install_utils.php プロジェクト: klr2003/sourceread
/**
 * (re)write the web.config file to prevent browser access to the log file
 */
function handleWebConfig()
{
    global $setup_site_log_dir;
    global $setup_site_log_file;
    require_once 'include/domit/xml_domit_include.php';
    $prefix = $setup_site_log_dir . empty($setup_site_log_dir) ? '' : '/';
    $config_array = array(array('1' => $prefix . str_replace('.', '\\.', $setup_site_log_file) . '\\.*', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'install.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'upgradeWizard.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'emailman.log', '2' => 'log_file_restricted.html'), array('1' => 'not_imported_.*.txt', '2' => 'log_file_restricted.html'), array('1' => 'XTemplate/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'data/(.*).php', '2' => 'index.php'), array('1' => 'examples/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*)/(.*)', '2' => 'index.php'), array('1' => 'metadata/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'modules/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'soap/(.*).php', '2' => 'index.php'), array('1' => 'emailmandelivery.php', '2' => 'index.php'), array('1' => 'cron.php', '2' => 'index.php'));
    $xmldoc = new DOMIT_Document();
    //create XML declaration
    $xmlDecl = $xmldoc->createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"');
    $xmldoc->appendChild($xmlDecl);
    $rootElement = $xmldoc->createElement('configuration');
    $xmldoc->appendChild($rootElement);
    $system_webserver = $xmldoc->createElement('system.webServer');
    $rewrite = $xmldoc->createElement('rewrite');
    $rules = $xmldoc->createElement('rules');
    for ($i = 0; $i < count($config_array); $i++) {
        $rule[$i] = $xmldoc->createElement('rule');
        $rule[$i]->setAttribute('name', $i);
        $rule[$i]->setAttribute('stopProcessing', 'true');
        $match[$i] = $xmldoc->createElement('match');
        $match[$i]->setAttribute('url', $config_array[$i]['1']);
        $rule[$i]->appendChild($match[$i]);
        $action[$i] = $xmldoc->createElement('action');
        $action[$i]->setAttribute('type', 'Redirect');
        $action[$i]->setAttribute('url', $config_array[$i]['2']);
        $rule[$i]->appendChild($action[$i]);
        $rules->appendChild($rule[$i]);
    }
    $rewrite->appendChild($rules);
    $system_webserver->appendChild($rewrite);
    $rootElement->appendChild($system_webserver);
    //    echo $xmldoc->documentElement->toNormalizedString(true);
    $xmldoc->saveXML('web.config', true);
}
コード例 #3
0
global $sugar_config;
$setup_site_log_dir = isset($_SESSION['setup_site_custom_log_dir']) ? $_SESSION['setup_site_log_dir'] : '.';
$setup_site_log_file = 'sugarcrm.log';
// may be an option later
require_once 'include/domit/xml_domit_include.php';
$uploadDir = '';
$uploadHta = '';
if (empty($GLOBALS['sugar_config']['upload_dir'])) {
    $GLOBALS['sugar_config']['upload_dir'] = 'cache/upload/';
}
$prefix = $setup_site_log_dir . empty($setup_site_log_dir) ? '' : '/';
$config_array = array(array('1' => $prefix . str_replace('.', '\\.', $setup_site_log_file) . '\\.*', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'install.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'upgradeWizard.log', '2' => 'log_file_restricted.html'), array('1' => $prefix . 'emailman.log', '2' => 'log_file_restricted.html'), array('1' => 'not_imported_.*.txt', '2' => 'log_file_restricted.html'), array('1' => 'XTemplate/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'data/(.*).php', '2' => 'index.php'), array('1' => 'examples/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*).php', '2' => 'index.php'), array('1' => 'include/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*).php', '2' => 'index.php'), array('1' => 'log4php/(.*)/(.*)', '2' => 'index.php'), array('1' => 'metadata/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'modules/(.*)/(.*).php', '2' => 'index.php'), array('1' => 'soap/(.*).php', '2' => 'index.php'), array('1' => 'emailmandelivery.php', '2' => 'index.php'), array('1' => 'cron.php', '2' => 'index.php'), array('1' => $sugar_config['upload_dir'] . '.*', '2' => 'index.php'));
$xmldoc = new DOMIT_Document();
//var_dump($config_array);
//create XML declaration
$xmlDecl = $xmldoc->createProcessingInstruction('xml', 'version="1.0" encoding="UTF-8"');
$xmldoc->appendChild($xmlDecl);
$rootElement = $xmldoc->createElement('configuration');
$xmldoc->appendChild($rootElement);
$system_webserver = $xmldoc->createElement('system.webServer');
$rewrite = $xmldoc->createElement('rewrite');
$rules = $xmldoc->createElement('rules');
$rule = array();
$match = array();
$rule_action = array();
for ($i = 0; $i < count($config_array); $i++) {
    $rule[$i] = $xmldoc->createElement('rule');
    $rule[$i]->setAttribute('name', $i);
    $rule[$i]->setAttribute('stopProcessing', 'true');
    $match[$i] = $xmldoc->createElement('match');
    $match[$i]->setAttribute('url', $config_array[$i]['1']);