コード例 #1
0
ファイル: Currency.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Handles database errors
  *
  * Also migrates old Currency names to the Text class,
  * and inserts default Currencyes if necessary
  * @return  boolean     false       Always!
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     global $objDatabase;
     // Currency
     \Text::errorHandler();
     $table_name = DBPREFIX . 'module_shop_currencies';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'code' => array('type' => 'CHAR(3)', 'notnull' => true, 'default' => ''), 'symbol' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => ''), 'rate' => array('type' => 'DECIMAL(10,4)', 'unsigned' => true, 'notnull' => true, 'default' => '1.0000'), 'increment' => array('type' => 'DECIMAL(6,5)', 'unsigned' => true, 'notnull' => true, 'default' => '0.01'), 'ord' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'renamefrom' => 'sort_order'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'renamefrom' => 'status'), 'default' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'renamefrom' => 'is_default'));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
             // Migrate all Currency names to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             $query = "\n                    SELECT `id`, `code`, `name`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query Currency names", $query);
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['id'];
                 $name = $objResult->fields['name'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Currency name '{$name}'");
                 }
                 $objResult->MoveNext();
             }
         }
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
         return false;
     }
     // If the table did not exist, insert defaults
     $arrCurrencies = array('Schweizer Franken' => array('CHF', 'sFr.', 1.0, '0.05', 1, 1, 1), 'Euro' => array('EUR', html_entity_decode("€"), 1.18, '0.01', 2, 1, 0), 'United States Dollars' => array('USD', '$', 0.88, '0.01', 3, 1, 0));
     // There is no previous version of this table!
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure);
     // And there aren't even records to migrate, so
     foreach ($arrCurrencies as $name => $arrCurrency) {
         $query = "\n                INSERT INTO `contrexx_module_shop_currencies` (\n                    `code`, `symbol`, `rate`, `increment`,\n                    `ord`, `active`, `default`\n                ) VALUES (\n                    '" . join("','", $arrCurrency) . "'\n                )";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to insert default Currencies");
         }
         $id = $objDatabase->Insert_ID();
         if (!\Text::replace($id, FRONTEND_LANG_ID, 'Shop', self::TEXT_NAME, $name)) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to add Text for default Currency name '{$name}'");
         }
     }
     // Always
     return false;
 }
コード例 #2
0
ファイル: Discount.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Tries to fix any database problems
  * @return  boolean           False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     //die("Discount::errorHandler(): Disabled!<br />");
     // Discount
     \Text::errorHandler();
     $table_name = DBPREFIX . 'module_shop_article_group';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true));
     $table_index = array();
     //\DBG::activate(DBG_DB);
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
         \Text::deleteByKey('Shop', self::TEXT_NAME_GROUP_ARTICLE);
         $query = "\n                SELECT `id`, `name`\n                  FROM `{$table_name}`";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to query article group names", $query);
         }
         while (!$objResult->EOF) {
             $group_id = $objResult->fields['id'];
             $name = $objResult->fields['name'];
             if (!\Text::replace($group_id, $default_lang_id, 'Shop', self::TEXT_NAME_GROUP_ARTICLE, $name)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate article group names");
             }
             $objResult->MoveNext();
         }
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     $table_name = DBPREFIX . 'module_shop_customer_group';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true));
     $table_index = array();
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
         \Text::deleteByKey('Shop', self::TEXT_NAME_GROUP_CUSTOMER);
         $query = "\n                SELECT `id`, `name`\n                  FROM `{$table_name}`";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to query customer group names", $query);
         }
         while (!$objResult->EOF) {
             $group_id = $objResult->fields['id'];
             $name = $objResult->fields['name'];
             if (!\Text::replace($group_id, $default_lang_id, 'Shop', self::TEXT_NAME_GROUP_CUSTOMER, $name)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate customer group names");
             }
             $objResult->MoveNext();
         }
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     $table_name = DBPREFIX . 'module_shop_rel_discount_group';
     $table_structure = array('customer_group_id' => array('type' => 'int(10)', 'unsigned' => true, 'notnull' => true, 'default' => 0, 'primary' => true), 'article_group_id' => array('type' => 'int(10)', 'unsigned' => true, 'notnull' => true, 'default' => 0, 'primary' => true), 'rate' => array('type' => 'decimal(9,2)', 'notnull' => true, 'default' => '0.00'));
     $table_index = array();
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     $table_name = DBPREFIX . 'module_shop_discountgroup_count_name';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true));
     $table_index = array();
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
         \Text::deleteByKey('Shop', self::TEXT_NAME_GROUP_COUNT);
         \Text::deleteByKey('Shop', self::TEXT_UNIT_GROUP_COUNT);
         $query = "\n                SELECT `id`, `name`, `unit`\n                  FROM `{$table_name}`";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to query count group names", $query);
         }
         while (!$objResult->EOF) {
             $group_id = $objResult->fields['id'];
             $name = $objResult->fields['name'];
             $unit = $objResult->fields['unit'];
             if (!\Text::replace($group_id, $default_lang_id, 'Shop', self::TEXT_NAME_GROUP_COUNT, $name)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate count group names");
             }
             if (!\Text::replace($group_id, $default_lang_id, 'Shop', self::TEXT_UNIT_GROUP_COUNT, $unit)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate count group units");
             }
             $objResult->MoveNext();
         }
         \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     }
     $table_name = DBPREFIX . 'module_shop_discountgroup_count_rate';
     $table_structure = array('group_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => 0, 'primary' => true), 'count' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => 1, 'primary' => true), 'rate' => array('type' => 'DECIMAL(5,2)', 'unsigned' => true, 'notnull' => true, 'default' => '0.00'));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always
     return false;
 }
コード例 #3
0
 /**
  * Handles all kinds of database errors
  *
  * Creates the processors' table, and creates default entries if necessary
  * @return  boolean                         False. Always.
  * @global  ADOConnection   $objDatabase
  */
 static function errorHandler()
 {
     // PaymentProcessing
     $table_name_old = DBPREFIX . 'module_shop_processors';
     $table_name_new = DBPREFIX . 'module_shop_payment_processors';
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
         \Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name_new);
     }
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'ENUM("internal", "external")', 'default' => 'internal'), 'name' => array('type' => 'VARCHAR(255)', 'default' => ''), 'description' => array('type' => 'TEXT', 'default' => ''), 'company_url' => array('type' => 'VARCHAR(255)', 'default' => ''), 'status' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => 1), 'picture' => array('type' => 'VARCHAR(255)', 'default' => ''));
     \Cx\Lib\UpdateUtil::table($table_name_new, $table_structure);
     $arrPsp = array(array(1, 'external', 'saferpay', 'Saferpay is a comprehensive Internet payment platform, specially developed for commercial applications. It provides a guarantee of secure payment processes over the Internet for merchants as well as for cardholders. Merchants benefit from the easy integration of the payment method into their e-commerce platform, and from the modularity with which they can take account of current and future requirements. Cardholders benefit from the security of buying from any shop that uses Saferpay.', 'http://www.saferpay.com/', 1, 'logo_saferpay.gif'), array(2, 'external', 'paypal', 'With more than 40 million member accounts in over 45 countries worldwide, PayPal is the world\'s largest online payment service. PayPal makes sending money as easy as sending email! Any PayPal member can instantly and securely send money to anyone in the U.S. with an email address. PayPal can also be used on a web-enabled cell phone. In the future, PayPal will be available to use on web-enabled pagers and other handheld devices.', 'http://www.paypal.com/', 1, 'logo_paypal.gif'), array(3, 'external', 'yellowpay', 'PostFinance vereinfacht das Inkasso im Online-Shop.', 'http://www.postfinance.ch/', 1, 'logo_postfinance.gif'), array(4, 'internal', 'internal', 'Internal no forms', '', 1, ''), array(9, 'internal', 'internal_lsv', 'LSV with internal form', '', 1, ''), array(10, 'external', 'datatrans', 'Die professionelle und komplette Payment-Lösung', 'http://datatrans.biz/', 1, 'logo_datatrans.gif'), array(11, 'external', 'mobilesolutions', 'PostFinance Mobile', 'https://postfinance.mobilesolutions.ch/', 1, 'logo_postfinance_mobile.gif'));
     $query_template = "\n            REPLACE INTO `{$table_name_new}` (\n                `id`, `type`, `name`,\n                `description`,\n                `company_url`, `status`, `picture`\n            ) VALUES (\n                ?, ?, ?, ?, ?, ?, ?\n            )";
     foreach ($arrPsp as $psp) {
         \Cx\Lib\UpdateUtil::sql($query_template, $psp);
     }
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
         \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     }
     // Drop obsolete PSPs -- see Payment::errorHandler()
     \Cx\Lib\UpdateUtil::sql("\n            DELETE FROM `" . DBPREFIX . "module_shop_payment_processors`\n             WHERE `id` IN (5, 6, 7, 8)");
     // Always
     return false;
 }
コード例 #4
0
ファイル: ShopMail.class.php プロジェクト: Niggu/cloudrexx
    /**
     * Migrates existing old Shop mailtemplates to the new MailTemplate class
     * @return  boolean         False.  Always.
     * @throws  Cx\Lib\Update_DatabaseException
     */
    static function errorHandler()
    {
        // Mail
        \Cx\Core\MailTemplate\Controller\MailTemplate::errorHandler();
        if (\Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'core_mail_template')) {
            // Make sure there are no bodies lying around
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_NAME);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_FROM);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SENDER);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_REPLY);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_TO);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_CC);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_BCC);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SUBJECT);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE_HTML);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_ATTACHMENTS);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_INLINE);
        }
        $arrFrom = $arrSender = $arrSubject = array();
        $arrLanguageId = \FWLanguage::getIdArray();
        if (empty($arrLanguageId)) {
            throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs");
        }
        if (\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'module_shop_mail')) {
            // Migrate existing templates from the shop to the MailTemplate,
            // appending "_backup_by_update" to the respective keys.
            // Make them unprotected.
            // These are the keys replacing the IDs:
            $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login');
            foreach ($arrLanguageId as $lang_id) {
                // Mind that the template name is single language yet!
                $arrTemplates = self::getTemplateArray($lang_id);
                if (empty($arrTemplates)) {
                    continue;
                }
                foreach ($arrTemplates as $id => $arrTemplate) {
                    // NOTE: utf8_encode() may be necessary in some cases.
                    // It usually works without it, but was necessary on a few installations.
                    //                    $arrTemplate = array_map("utf8_encode", $arrTemplate);
                    if (!empty($arrTemplate['from']) && empty($arrFrom[$id])) {
                        $arrFrom[$id] = $arrTemplate['from'];
                    }
                    if (!empty($arrTemplate['sender']) && empty($arrSender[$id])) {
                        $arrSender[$id] = $arrTemplate['sender'];
                    }
                    if (!empty($arrTemplate['subject']) && empty($arrSubject[$id])) {
                        $arrSubject[$id] = str_replace('<DATE>', '[ORDER_DATE]', $arrTemplate['subject']);
                    }
                    if (isset($arrKey[$id])) {
                        // System templates get their default key
                        $arrTemplate['key'] = $arrKey[$id] . '_backup_by_update';
                        // Clear the protected flag, so the old templates
                        // may be removed at will
                        $arrTemplate['protected'] = false;
                    } else {
                        // Custom templates:
                        // Make the name lowercase and replace any non-letter
                        $new_key = preg_replace('/[^a-z]/', '_', strtolower($arrTemplate['name']));
                        // Keep it unique!  Use the ID if the key is taken
                        if (in_array($new_key, $arrKey)) {
                            $new_key = $id;
                        }
                        // Remember used keys, and replace the former ID
                        $arrKey[$id] = $new_key;
                        $arrTemplate['key'] = $new_key;
                    }
                    // Some installations may contain corrupt templates
                    // causing empty (0 or "") keys.  Those would make
                    // MailTemplate::store() fail!
                    if (empty($arrTemplate['key'])) {
                        $arrTemplate['key'] = uniqid() . '_backup_by_update)';
                    }
                    foreach ($arrTemplate as &$string) {
                        // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS].
                        $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string);
                        // This is completely unreliable.
                        // Use the process as described above, not replacing the old templates,
                        // but adding the new ones instead.
                        //                    $string = str_replace('[ORDER_DATA]', $order_data, $string);
                        //                    $string = preg_replace('/[\\w\\s\\:]+\\[USERNAME\\](?:\\n|<br\\s?\\/?
                        //                          >)*[\\w\\s\\:]+\\[PASSWORD\\]/',
                        //                        $login_data, $string);
                    }
                    //                $arrTemplate['message_html'] = preg_replace(
                    //                    '/(?:\r|\n|\r\n)/', "<br />\n", $arrTemplate['message']);
                    $arrTemplate['lang_id'] = $lang_id;
                    if (!\Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', $arrTemplate)) {
                        throw new \Cx\Lib\Update_DatabaseException("Failed to store Mailtemplate");
                    }
                }
            }
            // Drop old Mail tables after successful migration
            \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail_content');
            \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail');
        }
        // Add the new default templates with the new keys
        // and have the user migrate changes herself!
        foreach ($arrLanguageId as $lang_id) {
            if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'order_confirmation', $lang_id)) {
                \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'order_confirmation', 'name' => 'Bestellungsbestätigung', 'from' => isset($arrFrom[1]) ? $arrFrom[1] : '', 'sender' => isset($arrSender[1]) ? $arrSender[1] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[1]) ? $arrSubject[1] : '', 'message' => <<<EOF
[CUSTOMER_SALUTATION],

Herzlichen Dank für Ihre Bestellung im [SHOP_COMPANY] Online Shop.

Ihre Auftrags-Nr. lautet: [ORDER_ID]
Ihre Kunden-Nr. lautet: [CUSTOMER_ID]
Bestellungszeit: [ORDER_DATE] [ORDER_TIME]

------------------------------------------------------------------------
Bestellinformationen
------------------------------------------------------------------------[[ORDER_ITEM]
ID:             [PRODUCT_ID]
Artikel Nr.:    [PRODUCT_CODE]
Menge:          [PRODUCT_QUANTITY]
Beschreibung:   [PRODUCT_TITLE][[PRODUCT_OPTIONS]
            [PRODUCT_OPTIONS][PRODUCT_OPTIONS]]
Stückpreis:      [PRODUCT_ITEM_PRICE] [CURRENCY]                       Total [PRODUCT_TOTAL_PRICE] [CURRENCY][[USER_DATA]
Benutzername:   [USER_NAME]
Passwort:       [USER_PASS][USER_DATA]][[COUPON_DATA]
Gutschein Code: [COUPON_CODE][COUPON_DATA]][ORDER_ITEM]]
------------------------------------------------------------------------
Zwischensumme:    [ORDER_ITEM_COUNT] Artikel                             [ORDER_ITEM_SUM] [CURRENCY][[DISCOUNT_COUPON]
Gutschein Code: [DISCOUNT_COUPON_CODE]   [DISCOUNT_COUPON_AMOUNT] [CURRENCY][DISCOUNT_COUPON]]
------------------------------------------------------------------------[[SHIPMENT]
Versandart:     [SHIPMENT_NAME]   [SHIPMENT_PRICE] [CURRENCY][SHIPMENT]][[PAYMENT]
Bezahlung:      [PAYMENT_NAME]   [PAYMENT_PRICE] [CURRENCY][PAYMENT]][[VAT]
[VAT_TEXT]                   [VAT_PRICE] [CURRENCY][VAT]]
------------------------------------------------------------------------
Gesamtsumme                                                [ORDER_SUM] [CURRENCY]
------------------------------------------------------------------------

Bemerkungen:
[REMARKS]


Ihre Kundenadresse:
[CUSTOMER_COMPANY]
[CUSTOMER_FIRSTNAME] [CUSTOMER_LASTNAME]
[CUSTOMER_ADDRESS]
[CUSTOMER_ZIP] [CUSTOMER_CITY]
[CUSTOMER_COUNTRY][[SHIPPING_ADDRESS]


Lieferadresse:
[SHIPPING_COMPANY]
[SHIPPING_FIRSTNAME] [SHIPPING_LASTNAME]
[SHIPPING_ADDRESS]
[SHIPPING_ZIP] [SHIPPING_CITY]
[SHIPPING_COUNTRY][SHIPPING_ADDRESS]]

Ihr Link zum Online Store: [SHOP_HOMEPAGE][[CUSTOMER_LOGIN]

Ihre Zugangsdaten zum Shop:
Benutzername:   [CUSTOMER_USERNAME]
Passwort:       [CUSTOMER_PASSWORD][CUSTOMER_LOGIN]]

Wir freuen uns auf Ihren nächsten Besuch im [SHOP_COMPANY] Online Store und wünschen Ihnen noch einen schönen Tag.

P.S. Diese Auftragsbestätigung wurde gesendet an: [CUSTOMER_EMAIL]

Mit freundlichen Grüssen
Ihr [SHOP_COMPANY] Online Shop Team

[SHOP_HOMEPAGE]
EOF
, 'message_html' => <<<EOF
[CUSTOMER_SALUTATION],<br />
<br />
Herzlichen Dank f&uuml;r Ihre Bestellung im [SHOP_COMPANY] Online Shop.<br />
<br />
Ihre Auftrags-Nr. lautet: [ORDER_ID]<br />
Ihre Kunden-Nr. lautet: [CUSTOMER_ID]<br />
Bestellungszeit: [ORDER_DATE] [ORDER_TIME]<br />
<br />
<br />
<table cellspacing="1" cellpadding="1" style="border: 0;">
<tbody>
<tr>
  <td colspan="6">Bestellinformationen</td>
</tr>
<tr>
  <td><div style="text-align: right;">ID</div></td>
  <td><div style="text-align: right;">Artikel Nr.</div></td>
  <td><div style="text-align: right;">Menge</div></td>
  <td>Beschreibung</td>
  <td><div style="text-align: right;">St&uuml;ckpreis</div></td>
  <td><div style="text-align: right;">Total</div></td>
</tr><!--[[ORDER_ITEM]-->
<tr>
  <td><div style="text-align: right;">[PRODUCT_ID]</div></td>
  <td><div style="text-align: right;">[PRODUCT_CODE]</div></td>
  <td><div style="text-align: right;">[PRODUCT_QUANTITY]</div></td>
  <td>[PRODUCT_TITLE]<!--[[PRODUCT_OPTIONS]--><br />
    [PRODUCT_OPTIONS]<!--[PRODUCT_OPTIONS]]--></td>
  <td><div style="text-align: right;">[PRODUCT_ITEM_PRICE] [CURRENCY]</div></td>
  <td><div style="text-align: right;">[PRODUCT_TOTAL_PRICE] [CURRENCY]</div></td>
</tr><!--[[USER_DATA]-->
<tr>
  <td colspan="3">&nbsp;</td>
  <td>Benutzername: [USER_NAME]<br />Passwort: [USER_PASS]</td>
  <td colspan="2">&nbsp;</td>
</tr><!--[USER_DATA]]--><!--[[COUPON_DATA]-->
<tr>
  <td colspan="3">&nbsp;</td>
  <td>Gutschein Code: [COUPON_CODE]</td>
  <td colspan="2">&nbsp;</td>
</tr><!--[COUPON_DATA]]--><!--[ORDER_ITEM]]-->
<tr style="border-top: 4px none;">
  <td colspan="2">Zwischensumme</td>
  <td><div style="text-align: right;">[ORDER_ITEM_COUNT]</div></td>
  <td colspan="2">Artikel</td>
  <td><div style="text-align: right;">[ORDER_ITEM_SUM] [CURRENCY]</div></td>
</tr><!--[[DISCOUNT_COUPON]-->
<tr style="border-top: 4px none;">
  <td colspan="3">Gutscheincode</td>
  <td colspan="2">[DISCOUNT_COUPON_CODE]</td>
  <td><div style="text-align: right;">[DISCOUNT_COUPON_AMOUNT] [CURRENCY]</div></td>
</tr><!--[DISCOUNT_COUPON]][[SHIPMENT]-->
<tr style="border-top: 2px none;">
  <td colspan="3">Versandart</td>
  <td colspan="2">[SHIPMENT_NAME]</td>
  <td><div style="text-align: right;">[SHIPMENT_PRICE] [CURRENCY]</div></td>
</tr><!--[SHIPMENT]][[PAYMENT]-->
<tr style="border-top: 2px none;">
  <td colspan="3">Bezahlung</td>
  <td colspan="2">[PAYMENT_NAME]</td>
  <td><div style="text-align: right;">[PAYMENT_PRICE] [CURRENCY]</div></td>
</tr><!--[PAYMENT]][[VAT]-->
<tr style="border-top: 2px none;">
  <td colspan="5">[VAT_TEXT]</td>
  <td><div style="text-align: right;">[VAT_PRICE] [CURRENCY]</div></td>
</tr><!--[VAT]]-->
<tr style="border-top: 4px none;">
  <td colspan="5">Gesamtsumme</td>
  <td><div style="text-align: right;">[ORDER_SUM] [CURRENCY]</div></td>
</tr>
</tbody>
</table>
<br />
Bemerkungen:<br />
[REMARKS]<br />
<br />
<br />
Ihre Kundenadresse:<br />
[CUSTOMER_COMPANY]<br />
[CUSTOMER_FIRSTNAME] [CUSTOMER_LASTNAME]<br />
[CUSTOMER_ADDRESS]<br />
[CUSTOMER_ZIP] [CUSTOMER_CITY]<br />
[CUSTOMER_COUNTRY]<br /><!--[[SHIPPING_ADDRESS]-->
<br />
<br />
Lieferadresse:<br />
[SHIPPING_COMPANY]<br />
[SHIPPING_FIRSTNAME] [SHIPPING_LASTNAME]<br />
[SHIPPING_ADDRESS]<br />
[SHIPPING_ZIP] [SHIPPING_CITY]<br />
[SHIPPING_COUNTRY]<br /><!--[SHIPPING_ADDRESS]]-->
<br />
<br />
Ihr Link zum Online Store: [SHOP_HOMEPAGE]<br /><!--[[CUSTOMER_LOGIN]-->
<br />
Ihre Zugangsdaten zum Shop:<br />
Benutzername:   [CUSTOMER_USERNAME]<br />
Passwort:       [CUSTOMER_PASSWORD]<br /><!--[CUSTOMER_LOGIN]]-->
<br />
Wir freuen uns auf Ihren n&auml;chsten Besuch im [SHOP_COMPANY] Online Store und w&uuml;nschen Ihnen noch einen sch&ouml;nen Tag.<br />
<br />
P.S. Diese Auftragsbest&auml;tigung wurde gesendet an: [CUSTOMER_EMAIL]<br />
<br />
Mit freundlichen Gr&uuml;ssen<br />
Ihr [SHOP_COMPANY] Online Shop Team<br />
<br />
[SHOP_HOMEPAGE]<br />
<br />
EOF
, 'protected' => true, 'html' => true));
            }
            if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'order_complete', $lang_id)) {
                \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'order_complete', 'name' => 'Auftrag abgeschlossen', 'from' => isset($arrFrom[2]) ? $arrFrom[2] : '', 'sender' => isset($arrSender[2]) ? $arrSender[2] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[2]) ? $arrSubject[2] : '', 'message' => <<<EOF
[CUSTOMER_SALUTATION]

Ihre Bestellung wurde ausgeführt. Sie werden in den nächsten Tagen ihre Lieferung erhalten.

Herzlichen Dank für das Vertrauen.
Wir würden uns freuen, wenn Sie uns weiterempfehlen und wünschen Ihnen noch einen schönen Tag.

Mit freundlichen Grüssen
Ihr [SHOP_COMPANY] Online Shop Team

[SHOP_HOMEPAGE]
EOF
, 'message_html' => <<<EOF
[CUSTOMER_SALUTATION]<br />
<br />
Ihre Bestellung wurde ausgeführt. Sie werden in den nächsten Tagen ihre Lieferung erhalten.<br />
<br />
Herzlichen Dank für das Vertrauen.<br />
Wir würden uns freuen, wenn Sie uns weiterempfehlen und wünschen Ihnen noch einen schönen Tag.<br />
<br />
Mit freundlichen Grüssen<br />
Ihr [SHOP_COMPANY] Online Shop Team<br />
<br />
[SHOP_HOMEPAGE]<br />
EOF
, 'protected' => true, 'html' => true));
            }
            if (!\Cx\Core\MailTemplate\Controller\MailTemplate::get('Shop', 'customer_login', $lang_id)) {
                \Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', array('lang_id' => $lang_id, 'key' => 'customer_login', 'name' => 'Logindaten', 'from' => isset($arrFrom[3]) ? $arrFrom[3] : '', 'sender' => isset($arrSender[3]) ? $arrSender[3] : '', 'to' => '[CUSTOMER_EMAIL]', 'subject' => isset($arrSubject[3]) ? $arrSubject[3] : '', 'message' => <<<EOF
[CUSTOMER_SALUTATION]

Hier Ihre Zugangsdaten zum Shop:[[CUSTOMER_LOGIN]
Benutzername: [CUSTOMER_USERNAME]
Passwort: [CUSTOMER_PASSWORD][CUSTOMER_LOGIN]]

Mit freundlichen Grüssen
Ihr [SHOP_COMPANY] Online Shop Team

[SHOP_HOMEPAGE]
EOF
, 'message_html' => <<<EOF
[CUSTOMER_SALUTATION]<br />
<br />
Hier Ihre Zugangsdaten zum Shop:<br /><!--[[CUSTOMER_LOGIN]-->
Benutzername: [CUSTOMER_USERNAME]<br />
Passwort: [CUSTOMER_PASSWORD]<br /><!--[CUSTOMER_LOGIN]]-->
<br />
Mit freundlichen Gr&uuml;ssen<br />
Ihr [SHOP_COMPANY] Online Shop Team<br />
<br />
[SHOP_HOMEPAGE]<br />
EOF
, 'protected' => true, 'html' => true));
            }
        }
        // Always!
        return false;
    }
コード例 #5
0
ファイル: Customer.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Handles database errors
  *
  * Also migrates old Shop Customers to the User accounts and adds
  * all new settings
  * @return  boolean     false     Always!
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Customer
     $table_name_old = DBPREFIX . "module_shop_customers";
     // If the old Customer table is missing, the migration has completed
     // successfully already
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
         return false;
     }
     // Ensure that the ShopSettings (including \Cx\Core\Setting) and Order tables
     // are ready first!
     //DBG::log("Customer::errorHandler(): Adding settings");
     ShopSettings::errorHandler();
     //        \Cx\Core\Country\Controller\Country::errorHandler(); // Called by Order::errorHandler();
     Order::errorHandler();
     Discount::errorHandler();
     \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     $objUser = \FWUser::getFWUserObject()->objUser;
     // Create new User_Profile_Attributes
     $index_notes = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_notes', 'Shop');
     if (!$index_notes) {
         //DBG::log("Customer::errorHandler(): Adding notes attribute...");
         //            $objProfileAttribute = new \User_Profile_Attribute();
         $objProfileAttribute = $objUser->objAttribute->getById(0);
         //DBG::log("Customer::errorHandler(): NEW notes attribute: ".var_export($objProfileAttribute, true));
         $objProfileAttribute->setNames(array(1 => 'Notizen', 2 => 'Notes', 3 => 'Notes', 4 => 'Notes', 5 => 'Notes', 6 => 'Notes'));
         $objProfileAttribute->setType('text');
         $objProfileAttribute->setMultiline(true);
         $objProfileAttribute->setParent(0);
         $objProfileAttribute->setProtection(array(1));
         //DBG::log("Customer::errorHandler(): Made notes attribute: ".var_export($objProfileAttribute, true));
         if (!$objProfileAttribute->store()) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
         }
         //Re initialize shop setting
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
         //DBG::log("Customer::errorHandler(): Stored notes attribute, ID ".$objProfileAttribute->getId());
         if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_notes', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_notes'))) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'notes' setting");
         }
         //DBG::log("Customer::errorHandler(): Stored notes attribute ID setting");
     }
     $index_group = \Cx\Core\Setting\Controller\Setting::getValue('user_profile_attribute_customer_group_id', 'Shop');
     if (!$index_group) {
         //            $objProfileAttribute = new \User_Profile_Attribute();
         $objProfileAttribute = $objUser->objAttribute->getById(0);
         $objProfileAttribute->setNames(array(1 => 'Kundenrabattgruppe', 2 => 'Discount group', 3 => 'Kundenrabattgruppe', 4 => 'Kundenrabattgruppe', 5 => 'Kundenrabattgruppe', 6 => 'Kundenrabattgruppe'));
         $objProfileAttribute->setType('text');
         $objProfileAttribute->setParent(0);
         $objProfileAttribute->setProtection(array(1));
         if (!$objProfileAttribute->store()) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to create User_Profile_Attribute 'notes'");
         }
         //Re initialize shop setting
         \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
         if (!(\Cx\Core\Setting\Controller\Setting::set('user_profile_attribute_customer_group_id', $objProfileAttribute->getId()) && \Cx\Core\Setting\Controller\Setting::update('user_profile_attribute_customer_group_id'))) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to update User_Profile_Attribute 'customer_group_id' setting");
         }
     }
     // For the migration, a temporary flag is needed in the orders table
     // in order to prevent mixing up old and new customer_id values.
     $table_order_name = DBPREFIX . "module_shop_orders";
     if (!\Cx\Lib\UpdateUtil::column_exist($table_order_name, 'migrated')) {
         $query = "\n                ALTER TABLE `{$table_order_name}`\n                  ADD `migrated` TINYINT(1) unsigned NOT NULL default 0";
         \Cx\Lib\UpdateUtil::sql($query);
     }
     // Create missing UserGroups for customers and resellers
     $objGroup = null;
     $group_id_customer = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_customer', 'Shop');
     if ($group_id_customer) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroup($group_id_customer);
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('group_name' => 'Shop Endkunden'));
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = new \UserGroup();
         $objGroup->setActiveStatus(true);
         $objGroup->setDescription('Online Shop Endkunden');
         $objGroup->setName('Shop Endkunden');
         $objGroup->setType('frontend');
     }
     //DBG::log("Group: ".var_export($objGroup, true));
     if (!$objGroup) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to create UserGroup for customers");
     }
     //DBG::log("Customer::errorHandler(): Made customer usergroup: ".var_export($objGroup, true));
     if (!$objGroup->store() || !$objGroup->getId()) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup for customers");
     }
     //DBG::log("Customer::errorHandler(): Stored customer usergroup, ID ".$objGroup->getId());
     \Cx\Core\Setting\Controller\Setting::set('usergroup_id_customer', $objGroup->getId());
     if (!\Cx\Core\Setting\Controller\Setting::update('usergroup_id_customer')) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup ID for customers");
     }
     $group_id_customer = $objGroup->getId();
     $objGroup = null;
     $group_id_reseller = \Cx\Core\Setting\Controller\Setting::getValue('usergroup_id_reseller', 'Shop');
     if ($group_id_reseller) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroup($group_id_reseller);
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = \FWUser::getFWUserObject()->objGroup->getGroups(array('group_name' => 'Shop Wiederverkäufer'));
     }
     if (!$objGroup || $objGroup->EOF) {
         $objGroup = new \UserGroup();
         $objGroup->setActiveStatus(true);
         $objGroup->setDescription('Online Shop Wiederverkäufer');
         $objGroup->setName('Shop Wiederverkäufer');
         $objGroup->setType('frontend');
     }
     if (!$objGroup) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to create UserGroup for resellers");
     }
     //DBG::log("Customer::errorHandler(): Made reseller usergroup: ".var_export($objGroup, true));
     if (!$objGroup->store() || !$objGroup->getId()) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup for resellers");
     }
     \Cx\Core\Setting\Controller\Setting::set('usergroup_id_reseller', $objGroup->getId());
     if (!\Cx\Core\Setting\Controller\Setting::update('usergroup_id_reseller')) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to store UserGroup ID for resellers");
     }
     $group_id_reseller = $objGroup->getId();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     $query = "\n            SELECT `customer`.`customerid`,\n                   `customer`.`prefix`, `customer`.`firstname`,\n                   `customer`.`lastname`,\n                   `customer`.`company`, `customer`.`address`,\n                   `customer`.`city`, `customer`.`zip`,\n                   `customer`.`country_id`,\n                   `customer`.`phone`, `customer`.`fax`,\n                   `customer`.`email`,\n                   `customer`.`username`, `customer`.`password`,\n                   `customer`.`company_note`,\n                   `customer`.`is_reseller`,\n                   `customer`.`customer_status`, `customer`.`register_date`,\n                   `customer`.`group_id`\n              FROM `{$table_name_old}` AS `customer`\n             ORDER BY `customer`.`customerid` ASC";
     $objResult = \Cx\Lib\UpdateUtil::sql($query);
     while (!$objResult->EOF) {
         $old_customer_id = $objResult->fields['customerid'];
         if (empty($objResult->fields['email'])) {
             $objResult->fields['email'] = $objResult->fields['username'];
         }
         $email = $objResult->fields['email'];
         $objUser = \FWUser::getFWUserObject()->objUser->getUsers(array('email' => array(0 => $email)));
         // TODO: See whether a User with that username (but different e-mail address) exists!
         $objUser_name = \FWUser::getFWUserObject()->objUser->getUsers(array('username' => array(0 => $objResult->fields['username'])));
         if ($objUser && $objUser_name) {
             $objUser = $objUser_name;
         }
         $objCustomer = null;
         if ($objUser) {
             $objCustomer = self::getById($objUser->getId());
         }
         if (!$objCustomer) {
             $lang_id = Order::getLanguageIdByCustomerId($old_customer_id);
             $lang_id = \FWLanguage::getLangIdByIso639_1($lang_id);
             if (!$lang_id) {
                 $lang_id = $default_lang_id;
             }
             $objCustomer = new Customer();
             if (preg_match('/^(?:frau|mad|mme|signora|miss)/i', $objResult->fields['prefix'])) {
                 $objCustomer->gender('gender_female');
             } elseif (preg_match('/^(?:herr|mon|signore|mister|mr)/i', $objResult->fields['prefix'])) {
                 $objCustomer->gender('gender_male');
                 //                } else {
                 // Other "genders", like "family", "thing", or "it" won't be matched
                 // and are left on "gender_unknown".
                 //DBG::log("*** Prefix {$objResult->fields['prefix']}, UNKNOWN GENDER!");
             }
             //DBG::log("Prefix {$objResult->fields['prefix']}, made gender ".$objCustomer->gender());
             $objCustomer->company($objResult->fields['company']);
             $objCustomer->firstname($objResult->fields['firstname']);
             $objCustomer->lastname($objResult->fields['lastname']);
             $objCustomer->address($objResult->fields['address']);
             $objCustomer->city($objResult->fields['city']);
             $objCustomer->zip($objResult->fields['zip']);
             $objCustomer->country_id($objResult->fields['country_id']);
             $objCustomer->phone($objResult->fields['phone']);
             $objCustomer->fax($objResult->fields['fax']);
             $objCustomer->email($objResult->fields['email']);
             $objCustomer->companynote($objResult->fields['company_note']);
             $objCustomer->active($objResult->fields['customer_status']);
             // Handled by a UserGroup now, see below
             //$objCustomer->setResellerStatus($objResult->fields['is_reseller']);
             $objCustomer->register_date($objResult->fields['register_date']);
             $objCustomer->group_id($objResult->fields['group_id']);
             // NOTE: Mind that the User class has been modified to accept e-mail addresses
             // as usernames!
             $objCustomer->username($objResult->fields['username']);
             // Copy the md5 hash of the password!
             $objCustomer->password = $objResult->fields['password'];
             $objCustomer->setFrontendLanguage($lang_id);
         }
         if ($objResult->fields['is_reseller']) {
             $objCustomer->setGroups($objCustomer->getAssociatedGroupIds() + array($group_id_reseller));
             //DBG::log("Customer::errorHandler(): Added reseller: ".$objCustomer->id());
         } else {
             $objCustomer->setGroups($objCustomer->getAssociatedGroupIds() + array($group_id_customer));
             //DBG::log("Customer::errorHandler(): Added customer: ".$objCustomer->id());
         }
         if (!$objCustomer->store()) {
             //DBG::log(var_export($objCustomer, true));
             throw new \Cx\Lib\Update_DatabaseException("Failed to migrate existing Customer ID " . $old_customer_id . " to Users (Messages: " . join(', ', $objCustomer->error_msg) . ")");
         }
         // Update the Orders table with the new Customer ID.
         // Note that we use the ambiguous old customer ID that may
         // coincide with a new User ID, so to prevent inconsistencies,
         // migrated Orders are marked as such.
         $query = "\n                UPDATE `{$table_order_name}`\n                   SET `customer_id`=" . $objCustomer->id() . ",\n                       `migrated`=1\n                 WHERE `customer_id`={$old_customer_id}\n                   AND `migrated`=0";
         \Cx\Lib\UpdateUtil::sql($query);
         // Drop migrated
         $query = "\n                DELETE FROM `{$table_name_old}`\n                 WHERE `customerid`={$old_customer_id}";
         \Cx\Lib\UpdateUtil::sql($query);
         $objResult->MoveNext();
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return false;
         }
     }
     // Remove the flag, it's no longer needed.
     // (You could also verify that all records have been migrated by
     // querying them with "[...] WHERE `migrated`=0", which *MUST* result
     // in an empty recordset.  This is left as an exercise for the reader.)
     $query = "\n            ALTER TABLE `{$table_order_name}`\n             DROP `migrated`";
     \Cx\Lib\UpdateUtil::sql($query);
     \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     //DBG::log("Updated Customer table and related stuff");
     // Always
     return false;
 }
コード例 #6
0
 /**
  * Fixes database errors.
  *
  * Also migrates settings from the old Shop settings table to \Cx\Core\Setting.
  * @return  boolean                 False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     global $_CONFIGURATION;
     // ShopSettings
     \Cx\Core\Setting\Controller\Setting::errorHandler();
     \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     $table_name = DBPREFIX . 'module_shop_config';
     $i = 0;
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         // Migrate all entries using the \Cx\Core\Setting\Controller\Setting class
         $query = "\n                SELECT `name`, `value`, `status`\n                  FROM " . DBPREFIX . "module_shop_config\n                 ORDER BY `id` ASC";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException('Failed to query old Shop settings', $query);
         }
         while (!$objResult->EOF) {
             $name = $objResult->fields['name'];
             $value = $objResult->fields['value'];
             $status = $objResult->fields['status'];
             $name_status = null;
             switch ($name) {
                 // OBSOLETE
                 case 'tax_default_id':
                 case 'tax_enabled':
                 case 'tax_included':
                 case 'tax_number':
                     // Ignore, do not migrate!
                     $name = null;
                     break;
                     // VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\])
                 // VALUE ONLY (RE: arrConfig\[.*?\]\[.value.\])
                 case 'confirmation_emails':
                     $name = 'email_confirmation';
                     break;
                 case 'country_id':
                 case 'datatrans_merchant_id':
                 case 'datatrans_request_type':
                     break;
                 case 'datatrans_status':
                     $name = 'datatrans_active';
                     break;
                 case 'datatrans_use_testserver':
                 case 'email':
                 case 'fax':
                 case 'orderitems_amount_max':
                 case 'paypal_default_currency':
                 case 'postfinance_mobile_ijustwanttotest':
                 case 'postfinance_mobile_sign':
                 case 'postfinance_mobile_status':
                 case 'postfinance_mobile_webuser':
                 case 'product_sorting':
                 case 'saferpay_finalize_payment':
                 case 'saferpay_window_option':
                     break;
                 case 'shop_address':
                 case 'shop_company':
                 case 'shop_show_products_default':
                 case 'shop_thumbnail_max_height':
                 case 'shop_thumbnail_max_width':
                 case 'shop_thumbnail_quality':
                 case 'shop_weight_enable':
                     $name = preg_replace('/^shop_/', '', $name);
                     break;
                 case 'telephone':
                 case 'vat_default_id':
                 case 'vat_enabled_foreign_customer':
                 case 'vat_enabled_foreign_reseller':
                 case 'vat_enabled_home_customer':
                 case 'vat_enabled_home_reseller':
                 case 'vat_included_foreign_customer':
                 case 'vat_included_foreign_reseller':
                 case 'vat_included_home_customer':
                 case 'vat_included_home_reseller':
                 case 'vat_number':
                 case 'vat_other_id':
                     break;
                 case 'yellowpay_accepted_payment_methods':
                 case 'yellowpay_authorization_type':
                 case 'yellowpay_hash_seed':
                 case 'yellowpay_hash_signature_in':
                 case 'yellowpay_hash_signature_out':
                 case 'yellowpay_use_testserver':
                     $name = preg_replace('/^yellowpay(.*)$/', 'postfinance$1', $name);
                     break;
                 case 'yellowpay_id':
                     // Obsolete
                     $name = null;
                     break;
                     // VALUE & STATUS
                 // VALUE & STATUS
                 case 'paypal_account_email':
                     $name_status = 'paypal_active';
                     break;
                 case 'saferpay_id':
                     $name_status = 'saferpay_active';
                     break;
                 case 'yellowpay_shop_id':
                     $name = 'postfinance_shop_id';
                     $name_status = 'postfinance_active';
                     break;
                     // STATUS ONLY (RE: arrConfig\[.*?\]\[.status.\])
                 // STATUS ONLY (RE: arrConfig\[.*?\]\[.status.\])
                 case 'payment_lsv_status':
                     $name_status = 'payment_lsv_active';
                     $name = null;
                     break;
                 case 'saferpay_use_test_account':
                     $name_status = $name;
                     $name = null;
                     break;
             }
             if ($name) {
                 if (\Cx\Core\Setting\Controller\Setting::getValue($name, 'Shop') === NULL && !\Cx\Core\Setting\Controller\Setting::add($name, $value, ++$i)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to add \\Cx\\Core\\Setting entry for '{$name}'");
                 }
             }
             if ($name_status) {
                 if (\Cx\Core\Setting\Controller\Setting::getValue($name_status, 'Shop') === NULL && !\Cx\Core\Setting\Controller\Setting::add($name_status, $status, ++$i)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to add \\Cx\\Core\\Setting entry for status '{$name_status}'");
                 }
             }
             $objResult->MoveNext();
         }
     }
     \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     // Try adding any that just *might* be missing for *any* reason
     \Cx\Core\Setting\Controller\Setting::add('email', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('email_confirmation', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('company', 'Comvation AG', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('address', 'Burgstrasse 20', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('country_id', 204, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('telephone', '+4133 2266000', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('fax', '+4133 2266001', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_number', '12345678', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_enabled_foreign_customer', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_enabled_foreign_reseller', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_enabled_home_customer', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_enabled_home_reseller', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_included_foreign_customer', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_included_foreign_reseller', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_included_home_customer', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_included_home_reseller', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_default_id', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('vat_other_id', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('weight_enable', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('show_products_default', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('product_sorting', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, '0:TXT_SHOP_PRODUCT_SORTING_ALPHABETIC,' . '1:TXT_SHOP_PRODUCT_SORTING_INDIVIDUAL,' . '2:TXT_SHOP_PRODUCT_SORTING_PRODUCTCODE', 'config');
     \Cx\Core\Setting\Controller\Setting::add('thumbnail_max_width', 140, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('thumbnail_max_height', 140, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('thumbnail_quality', 90, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('saferpay_id', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('saferpay_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('saferpay_use_test_account', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('saferpay_finalize_payment', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('saferpay_window_option', 2, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('paypal_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('paypal_account_email', '*****@*****.**', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('paypal_default_currency', 'CHF', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     // Also see Yellowpay.class
     \Cx\Core\Setting\Controller\Setting::add('payrexx_instance_name', 'Instanz Name', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
     \Cx\Core\Setting\Controller\Setting::add('payrexx_api_secret', 'API Secret', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
     \Cx\Core\Setting\Controller\Setting::add('payrexx_active', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_shop_id', 'Ihr Kontoname', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
     \Cx\Core\Setting\Controller\Setting::add('postfinance_active', '0', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_authorization_type', 'SAL', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, 'RES:Reservation,SAL:Verkauf');
     // OBSOLETE
     // As it appears that in_array(0, $array) is true for each non-empty
     // $array, indices for the entries must be numbered starting at 1.
     //        $arrPayments = array();
     //        foreach (self::$arrKnownPaymentMethod as $index => $name) {
     //            $arrPayments[$index] = $name;
     //        }
     //        \Cx\Core\Setting\Controller\Setting::add('postfinance_accepted_payment_methods', '', ++$i,
     //                \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOXGROUP,
     //                \Cx\Core\Setting\Controller\Setting::joinValues($arrPayments));
     \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_in', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
     \Cx\Core\Setting\Controller\Setting::add('postfinance_hash_signature_out', 'Mindestens 16 Buchstaben, Ziffern und Zeichen', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT);
     \Cx\Core\Setting\Controller\Setting::add('postfinance_use_testserver', '1', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX, '1');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_webuser', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_sign', 'geheimer_schlüssel', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_ijustwanttotest', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('postfinance_mobile_status', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('datatrans_merchant_id', '1234', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('datatrans_active', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('datatrans_request_type', 'CAA', ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('datatrans_use_testserver', 1, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('payment_lsv_active', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     // New for V3.0
     // Disable jsCart by default.
     $useJsCart = '0';
     // Activate it in case it was activated in config/configuration.php
     if (isset($_CONFIGURATION['custom']['shopJsCart']) && $_CONFIGURATION['custom']['shopJsCart']) {
         $useJsCart = '1';
     }
     \Cx\Core\Setting\Controller\Setting::add('use_js_cart', $useJsCart, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX);
     // Disable shopnavbar on other pages by default.
     $shopnavbar = '0';
     // Activate it in case it was activated in config/configuration.php
     if (isset($_CONFIGURATION['custom']['shopnavbar']) && $_CONFIGURATION['custom']['shopnavbar']) {
         $shopnavbar = '1';
     }
     \Cx\Core\Setting\Controller\Setting::add('shopnavbar_on_all_pages', $shopnavbar, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_CHECKBOX);
     // New for v3.1.0
     \Cx\Core\Setting\Controller\Setting::add('orderitems_amount_min', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     // New for v2.2(?)
     \Cx\Core\Setting\Controller\Setting::add('orderitems_amount_max', 0, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     // New for v2.3
     \Cx\Core\Setting\Controller\Setting::add('register', ShopLibrary::REGISTER_MANDATORY, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN, \Cx\Core\Setting\Controller\Setting::joinValues(array(ShopLibrary::REGISTER_MANDATORY, ShopLibrary::REGISTER_OPTIONAL, ShopLibrary::REGISTER_NONE)), 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_products_per_page_frontend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('history_maximum_age_days', 730, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_orders_per_page_frontend', 10, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_orders_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_customers_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_manufacturers_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_mailtemplate_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('numof_coupon_per_page_backend', 25, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('usergroup_id_customer', 0, 341, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USERGROUP, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('usergroup_id_reseller', 0, 342, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USERGROUP, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('user_profile_attribute_customer_group_id', 0, 351, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('user_profile_attribute_notes', 0, 352, \Cx\Core\Setting\Controller\Setting::TYPE_DROPDOWN_USER_CUSTOM_ATTRIBUTE, null, 'config');
     \Cx\Core\Setting\Controller\Setting::add('num_categories_per_row', 4, ++$i, \Cx\Core\Setting\Controller\Setting::TYPE_TEXT, null, 'config');
     // Note that the Settings *MUST* be reinited after adding new entries!
     // Add more new/missing settings here
     \Cx\Lib\UpdateUtil::drop_table($table_name);
     // Always
     return false;
 }
コード例 #7
0
ファイル: Text.class.php プロジェクト: Cloudrexx/cloudrexx
 /**
  * Handle any error occurring in this class.
  *
  * Tries to fix known problems with the database table.
  * @global  mixed     $objDatabase    Database object
  * @return  boolean                   False.  Always.
  * @throws  Update_DatabaseException
  * @static
  * @author  Reto Kohli <*****@*****.**>
  */
 static function errorHandler()
 {
     $table_name = DBPREFIX . "core_text";
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         $query = "\n                CREATE TABLE `" . DBPREFIX . "core_text` (\n                  `id` INT(10) UNSIGNED NOT NULL DEFAULT 0,\n                  `lang_id` INT(10) UNSIGNED NOT NULL DEFAULT 1,\n                  `section` VARCHAR(32) NULL DEFAULT NULL,\n                  `key` VARCHAR(255) NOT NULL,\n                  `text` TEXT NOT NULL,\n                  PRIMARY KEY `id` (`id`, `lang_id`, `section`, `key`(32)),\n                  FULLTEXT `text` (`text`)\n                ) ENGINE=MyISAM";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         if (!$objResult) {
             throw new \Cx\Lib\Update_DatabaseException('Failed to create Text table', $query);
         }
     }
     // More to come...
     return false;
 }
コード例 #8
0
 /**
  * Handles any kind of database error
  * @throws  Cx\Lib\Update_DatabaseException
  * @return  boolean                 False.  Always.
  */
 static function errorHandler()
 {
     // ShopCategory
     // Fix the Text and Settings table first
     \Text::errorHandler();
     ShopSettings::errorHandler();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     $table_name = DBPREFIX . 'module_shop_categories';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'renamefrom' => 'catid'), 'parent_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'parentid'), 'ord' => array('type' => 'INT(5)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'catsorting'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'catstatus'), 'picture' => array('type' => 'VARCHAR(255)', 'default' => ''), 'flags' => array('type' => 'VARCHAR(255)', 'default' => ''));
     $table_index = array('flags' => array('fields' => 'flags', 'type' => 'FULLTEXT'));
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'catname')) {
             // Migrate all ShopCategory names to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             \Text::deleteByKey('Shop', self::TEXT_DESCRIPTION);
             $query = "\n                    SELECT `catid`, `catname`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query ShopCategory names");
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['catid'];
                 $name = $objResult->fields['catname'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate ShopCategory name '{$name}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always
     return false;
 }
コード例 #9
0
ファイル: Country.class.php プロジェクト: nahakiole/cloudrexx
 /**
  * Tries to recreate the database table(s) for the class
  *
  * Should be called whenever there's a problem with the database table.
  * @return  boolean             False.  Always.
  */
 static function errorHandler()
 {
     $table_name = DBPREFIX . 'core_country';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'alpha2' => array('type' => 'CHAR(2)', 'notnull' => true, 'default' => ''), 'alpha3' => array('type' => 'CHAR(3)', 'notnull' => true, 'default' => ''), 'ord' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'renamefrom' => 'sort_order'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'renamefrom' => 'is_active'));
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure);
     if (\Cx\Lib\UpdateUtil::table_empty($table_name)) {
         \Text::deleteByKey('core', self::TEXT_NAME);
         // Copy the Countries from the Shop module if possible
         if (\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . "module_shop_countries")) {
             $query = "\n                    SELECT `countries_id`, `countries_name`,\n                           `countries_iso_code_2`, `countries_iso_code_3`,\n                           `activation_status`\n                      FROM " . DBPREFIX . "module_shop_countries";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to to query Country names", $query);
             }
             $default_lang_id = \FWLanguage::getDefaultLangId();
             while (!$objResult->EOF) {
                 $id = $objResult->fields['countries_id'];
                 $name = $objResult->fields['countries_name'];
                 $alpha2 = $objResult->fields['countries_iso_code_2'];
                 $alpha3 = $objResult->fields['countries_iso_code_3'];
                 $active = $objResult->fields['activation_status'];
                 $ord = 0;
                 if ($id == 14) {
                     // fixing missing name
                     $name = 'Österreich';
                 }
                 if (!self::store($alpha2, $alpha3, $default_lang_id, $name, $ord, $active, $id)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to to migrate Country '{$name}'");
                 }
                 $objResult->MoveNext();
             }
             \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_countries');
         }
     }
     // USE FOR NEW INSTALLATIONS ONLY!
     // These records will lead to inconsistencies with Country references in
     // other tables otherwise.
     if (\Cx\Lib\UpdateUtil::table_empty($table_name)) {
         // Add new Country records if available
         if (file_exists(ASCMS_CORE_PATH . '/countries_iso_3166-2.php') && (include_once ASCMS_CORE_PATH . '/countries_iso_3166-2.php')) {
             //DBG::log("Country::errorHandler(): Included ISO file");
             $arrCountries = null;
             $ord = 0;
             foreach ($arrCountries as $country_id => $arrCountry) {
                 $name = $arrCountry[0];
                 $alpha2 = $arrCountry[1];
                 $alpha3 = $arrCountry[2];
                 // Not currently in use:
                 //                    $numeric = $arrCountry[3];
                 //                    $iso_full = $arrCountry[4];
                 // English (language ID 2) only!
                 if (!self::store($alpha2, $alpha3, 2, $name, ++$ord, true, $country_id)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to to add Country '{$name}' from ISO file");
                 }
                 //DBG::log("Country::errorHandler(): Added Country ID $country_id: '$name'");
             }
         }
     }
     //DBG::activate(DBG_ADODB);
     // Add more languages from the countries_languages.php file,
     // if present
     $arrCountries = array();
     // $arrCountries is redefined in the file
     if (file_exists(ASCMS_CORE_PATH . '/countries_languages.php') && (include_once ASCMS_CORE_PATH . '/countries_languages.php')) {
         foreach ($arrCountries as $alpha2 => $arrLanguage) {
             //DBG::log("errorHandler: Looking for Alpha-2 $alpha2");
             $country_id = self::getIdByAlpha2($alpha2);
             if (!$country_id) {
                 // TODO: Fail or not?
                 continue;
             }
             foreach ($arrLanguage as $lang_id => $name) {
                 if (!\Text::replace($country_id, $lang_id, 'core', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to to update Country '{$name}' from languages file");
                 }
                 //DBG::log("Country::errorHandler(): Added Country ID $country_id: language ID $lang_id");
             }
         }
     }
     \Cx\Core\Setting\Controller\Setting::init('core', 'country');
     \Cx\Core\Setting\Controller\Setting::add('numof_countries_per_page_backend', 30, 101);
     // More to come...
     // Always!
     return false;
 }
コード例 #10
0
ファイル: Order.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Handles database errors
  *
  * Also migrates the old database structure to the new one
  * @return  boolean             False.  Always.
  */
 static function errorHandler()
 {
     // Order
     ShopSettings::errorHandler();
     \Cx\Core\Country\Controller\Country::errorHandler();
     $table_name = DBPREFIX . 'module_shop_order_items';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'renamefrom' => 'order_items_id'), 'order_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'orderid'), 'product_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'productid'), 'product_name' => array('type' => 'VARCHAR(255)', 'default' => ''), 'price' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0.00'), 'quantity' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0'), 'vat_rate' => array('type' => 'DECIMAL(5,2)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'vat_percent'), 'weight' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0'));
     $table_index = array('order' => array('fields' => array('order_id')));
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     $table_name = DBPREFIX . 'module_shop_order_attributes';
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         $table_name_old = DBPREFIX . 'module_shop_order_items_attributes';
         $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'renamefrom' => 'orders_items_attributes_id'), 'item_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'order_items_id'), 'attribute_name' => array('type' => 'VARCHAR(255)', 'default' => '', 'renamefrom' => 'product_option_name'), 'option_name' => array('type' => 'VARCHAR(255)', 'default' => '', 'renamefrom' => 'product_option_value'), 'price' => array('type' => 'DECIMAL(9,2)', 'unsigned' => false, 'default' => '0.00', 'renamefrom' => 'product_option_values_price'));
         $table_index = array('item_id' => array('fields' => array('item_id')));
         \Cx\Lib\UpdateUtil::table($table_name_old, $table_structure, $table_index);
         \Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name);
     }
     // LSV
     $table_name = DBPREFIX . 'module_shop_lsv';
     $table_structure = array('order_id' => array('type' => 'INT(10)', 'unsigned' => true, 'primary' => true, 'renamefrom' => 'id'), 'holder' => array('type' => 'tinytext', 'default' => ''), 'bank' => array('type' => 'tinytext', 'default' => ''), 'blz' => array('type' => 'tinytext', 'default' => ''));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     $table_name = DBPREFIX . 'module_shop_orders';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'renamefrom' => 'orderid'), 'customer_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'customerid'), 'currency_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'selected_currency_id'), 'shipment_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'shipping_id'), 'payment_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'customer_lang'), 'status' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'order_status'), 'sum' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0.00', 'renamefrom' => 'currency_order_sum'), 'vat_amount' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0.00', 'renamefrom' => 'tax_price'), 'shipment_amount' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0.00', 'renamefrom' => 'currency_ship_price'), 'payment_amount' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0.00', 'renamefrom' => 'currency_payment_price'), 'billing_gender' => array('type' => 'VARCHAR(50)', 'notnull' => false, 'default' => null), 'billing_company' => array('type' => 'VARCHAR(100)', 'notnull' => false, 'default' => null), 'billing_firstname' => array('type' => 'VARCHAR(40)', 'notnull' => false, 'default' => null), 'billing_lastname' => array('type' => 'VARCHAR(100)', 'notnull' => false, 'default' => null), 'billing_address' => array('type' => 'VARCHAR(40)', 'notnull' => false, 'default' => null), 'billing_city' => array('type' => 'VARCHAR(50)', 'notnull' => false, 'default' => null), 'billing_zip' => array('type' => 'VARCHAR(10)', 'notnull' => false, 'default' => null), 'billing_country_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'billing_phone' => array('type' => 'VARCHAR(20)', 'notnull' => false, 'default' => null), 'billing_fax' => array('type' => 'VARCHAR(20)', 'notnull' => false, 'default' => null), 'billing_email' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'default' => null), 'gender' => array('type' => 'VARCHAR(50)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_prefix'), 'company' => array('type' => 'VARCHAR(100)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_company'), 'firstname' => array('type' => 'VARCHAR(40)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_firstname'), 'lastname' => array('type' => 'VARCHAR(100)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_lastname'), 'address' => array('type' => 'VARCHAR(40)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_address'), 'city' => array('type' => 'VARCHAR(50)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_city'), 'zip' => array('type' => 'VARCHAR(10)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_zip'), 'country_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_country_id'), 'phone' => array('type' => 'VARCHAR(20)', 'notnull' => false, 'default' => null, 'renamefrom' => 'ship_phone'), 'ip' => array('type' => 'VARCHAR(50)', 'default' => '', 'renamefrom' => 'customer_ip'), 'host' => array('type' => 'VARCHAR(100)', 'default' => '', 'renamefrom' => 'customer_host'), 'browser' => array('type' => 'VARCHAR(255)', 'default' => '', 'renamefrom' => 'customer_browser'), 'note' => array('type' => 'TEXT', 'default' => '', 'renamefrom' => 'customer_note'), 'date_time' => array('type' => 'TIMESTAMP', 'default' => '0000-00-00 00:00:00', 'renamefrom' => 'order_date'), 'modified_on' => array('type' => 'TIMESTAMP', 'default' => null, 'notnull' => false, 'renamefrom' => 'last_modified'), 'modified_by' => array('type' => 'VARCHAR(50)', 'notnull' => false, 'default' => null));
     $table_index = array('status' => array('fields' => array('status')));
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // TODO: TEST
     // Migrate present Customer addresses to the new billing address fields.
     // Note that this method is also called in Customer::errorHandler() *before*
     // any Customer is modified.  Thus, we can safely depend on the old
     // Customer table in one way -- if it doesn't exist, all Orders and Customers
     // have been successfully migrated already.
     $table_name_customer = DBPREFIX . "module_shop_customers";
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_customer)) {
         // On the other hand, there may have been an error somewhere in between
         // altering the Orders table and moving Customers to the Users table.
         // So, to be on the safe side, we will only update Orders where the billing
         // address fields are all NULL, as is the case just after the alteration
         // of the Orders table above.
         // Also note that any inconsistencies involving missing Customer records will
         // be left over as-is and may later be handled in the backend.
         $objResult = \Cx\Lib\UpdateUtil::sql("\n                SELECT DISTINCT `customer_id`,\n                       `customer`.`prefix`,\n                       `customer`.`firstname`, `customer`.`lastname`,\n                       `customer`.`company`, `customer`.`address`,\n                       `customer`.`city`, `customer`.`zip`,\n                       `customer`.`country_id`,\n                       `customer`.`phone`, `customer`.`fax`,\n                       `customer`.`email`\n                  FROM `{$table_name}`\n                  JOIN `{$table_name_customer}` AS `customer`\n                    ON `customerid`=`customer_id`\n                 WHERE `billing_gender` IS NULL\n                   AND `billing_company` IS NULL\n                   AND `billing_firstname` IS NULL\n                   AND `billing_lastname` IS NULL\n                   AND `billing_address` IS NULL\n                   AND `billing_city` IS NULL\n                   AND `billing_zip` IS NULL\n                   AND `billing_country_id` IS NULL\n                   AND `billing_phone` IS NULL\n                   AND `billing_fax` IS NULL\n                   AND `billing_email` IS NULL");
         while ($objResult && !$objResult->EOF) {
             $customer_id = $objResult->fields['customer_id'];
             $gender = 'gender_unknown';
             if (preg_match('/^(?:frau|mad|mme|signora|miss)/i', $objResult->fields['prefix'])) {
                 $gender = 'gender_female';
             } elseif (preg_match('/^(?:herr|mon|signore|mister|mr)/i', $objResult->fields['prefix'])) {
                 $gender = 'gender_male';
             }
             \Cx\Lib\UpdateUtil::sql("\n                    UPDATE `{$table_name}`\n                       SET `billing_gender`='" . addslashes($gender) . "',\n                           `billing_company`='" . addslashes($objResult->fields['company']) . "',\n                           `billing_firstname`='" . addslashes($objResult->fields['firstname']) . "',\n                           `billing_lastname`='" . addslashes($objResult->fields['lastname']) . "',\n                           `billing_address`='" . addslashes($objResult->fields['address']) . "',\n                           `billing_city`='" . addslashes($objResult->fields['city']) . "',\n                           `billing_zip`='" . addslashes($objResult->fields['zip']) . "',\n                           `billing_country_id`=" . intval($objResult->fields['country_id']) . ",\n                           `billing_phone`='" . addslashes($objResult->fields['phone']) . "',\n                           `billing_fax`='" . addslashes($objResult->fields['fax']) . "',\n                           `billing_email`='" . addslashes($objResult->fields['email']) . "'\n                     WHERE `customer_id`={$customer_id}\n                       AND `billing_gender` IS NULL\n                       AND `billing_company` IS NULL\n                       AND `billing_firstname` IS NULL\n                       AND `billing_lastname` IS NULL\n                       AND `billing_address` IS NULL\n                       AND `billing_city` IS NULL\n                       AND `billing_zip` IS NULL\n                       AND `billing_country_id` IS NULL\n                       AND `billing_phone` IS NULL\n                       AND `billing_fax` IS NULL\n                       AND `billing_email` IS NULL");
             $objResult->MoveNext();
         }
     }
     // Finally, update the migrated Order records with the proper gender
     // strings as used in the User class hierarchy as well
     $objResult = \Cx\Lib\UpdateUtil::sql("\n            SELECT `id`, `gender`\n              FROM `{$table_name}`\n             WHERE `gender` NOT IN\n                   ('gender_male', 'gender_female', 'gender_undefined')");
     while ($objResult && !$objResult->EOF) {
         $gender = 'gender_unknown';
         if (preg_match('/^(?:frau|mad|mme|signora|miss)/i', $objResult->fields['gender'])) {
             $gender = 'gender_female';
         } elseif (preg_match('/^(?:herr|mon|signore|mister|mr)/i', $objResult->fields['gender'])) {
             $gender = 'gender_male';
         }
         \Cx\Lib\UpdateUtil::sql("\n                UPDATE `{$table_name}`\n                   SET `gender`='" . addslashes($gender) . "'\n                 WHERE `id`=" . $objResult->fields['id']);
         $objResult->MoveNext();
     }
     // Always
     return false;
 }
コード例 #11
0
ファイル: Zones.class.php プロジェクト: Niggu/cloudrexx
 /**
  * Handles database errors
  *
  * Also migrates text fields to the new structure
  * @return  boolean           False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Zones
     // Fix the Zone-Payment relation table
     $table_name = DBPREFIX . 'module_shop_rel_payment';
     $table_structure = array('zone_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'primary' => true, 'renamefrom' => 'zones_id'), 'payment_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'primary' => true));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Fix the Text table
     \Text::errorHandler();
     $table_name = DBPREFIX . 'module_shop_zones';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true, 'renamefrom' => 'zones_id'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'activation_status'));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'zones_name')) {
             // Migrate all Zone names to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             $query = "\n                    SELECT `zones_id`, `zones_name`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query Zone names", $query);
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['zones_id'];
                 $name = $objResult->fields['zones_name'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Zone name '{$name}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     $table_name_old = DBPREFIX . 'module_shop_rel_shipment';
     $table_name_new = DBPREFIX . 'module_shop_rel_shipper';
     if (!\Cx\Lib\UpdateUtil::table_exist($table_name_new) && \Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
         \Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name_new);
     }
     $table_structure = array('shipper_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'renamefrom' => 'shipment_id'), 'zone_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'renamefrom' => 'zones_id'));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name_new, $table_structure, $table_index);
     $table_name = DBPREFIX . 'module_shop_rel_countries';
     $table_structure = array('country_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'renamefrom' => 'countries_id'), 'zone_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'renamefrom' => 'zones_id'));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always
     return false;
 }
コード例 #12
0
ファイル: update.php プロジェクト: Cloudrexx/cloudrexx
function getConflictedModules($missedModules)
{
    $potentialMissedTables = array('blog' => array(DBPREFIX . 'module_blog_comments', DBPREFIX . 'module_blog_categories', DBPREFIX . 'module_blog_messages', DBPREFIX . 'module_blog_messages_lang', DBPREFIX . 'module_blog_message_to_category', DBPREFIX . 'module_blog_networks', DBPREFIX . 'module_blog_networks_lang', DBPREFIX . 'module_blog_settings', DBPREFIX . 'module_blog_votes'), 'calendar' => array(DBPREFIX . 'module_calendar', DBPREFIX . 'module_calendar_categories', DBPREFIX . 'module_calendar_form_data', DBPREFIX . 'module_calendar_form_fields', DBPREFIX . 'module_calendar_registrations', DBPREFIX . 'module_calendar_settings', DBPREFIX . 'module_calendar_style'), 'directory' => array(DBPREFIX . 'module_directory_categories', DBPREFIX . 'module_directory_dir', DBPREFIX . 'module_directory_inputfields', DBPREFIX . 'module_directory_levels', DBPREFIX . 'module_directory_mail', DBPREFIX . 'module_directory_rel_dir_cat', DBPREFIX . 'module_directory_rel_dir_level', DBPREFIX . 'module_directory_settings', DBPREFIX . 'module_directory_settings_google', DBPREFIX . 'module_directory_vote'), 'docsys' => array(DBPREFIX . 'module_docsys', DBPREFIX . 'module_docsys_categories', DBPREFIX . 'module_docsys_entry_category'), 'egov' => array(DBPREFIX . 'module_egov_configuration', DBPREFIX . 'module_egov_orders', DBPREFIX . 'module_egov_products', DBPREFIX . 'module_egov_product_calendar', DBPREFIX . 'module_egov_product_fields', DBPREFIX . 'module_egov_settings'), 'feed' => array(DBPREFIX . 'module_feed_category', DBPREFIX . 'module_feed_news', DBPREFIX . 'module_feed_newsml_association', DBPREFIX . 'module_feed_newsml_categories', DBPREFIX . 'module_feed_newsml_documents', DBPREFIX . 'module_feed_newsml_providers'), 'forum' => array(DBPREFIX . 'module_forum_access', DBPREFIX . 'module_forum_categories', DBPREFIX . 'module_forum_categories_lang', DBPREFIX . 'module_forum_notification', DBPREFIX . 'module_forum_postings', DBPREFIX . 'module_forum_rating', DBPREFIX . 'module_forum_settings', DBPREFIX . 'module_forum_statistics'), 'gallery' => array(DBPREFIX . 'module_gallery_categories', DBPREFIX . 'module_gallery_comments', DBPREFIX . 'module_gallery_language', DBPREFIX . 'module_gallery_language_pics', DBPREFIX . 'module_gallery_pictures', DBPREFIX . 'module_gallery_settings', DBPREFIX . 'module_gallery_votes'), 'guestbook' => array(DBPREFIX . 'module_guestbook', DBPREFIX . 'module_guestbook_settings'), 'livecam' => array(DBPREFIX . 'module_livecam', DBPREFIX . 'module_livecam_settings'), 'market' => array(DBPREFIX . 'module_market', DBPREFIX . 'module_market_categories', DBPREFIX . 'module_market_mail', DBPREFIX . 'module_market_paypal', DBPREFIX . 'module_market_settings', DBPREFIX . 'module_market_spez_fields'), 'memberdir' => array(DBPREFIX . 'module_memberdir_directories', DBPREFIX . 'module_memberdir_name', DBPREFIX . 'module_memberdir_settings', DBPREFIX . 'module_memberdir_values'), 'newsletter' => array(DBPREFIX . 'module_newsletter', DBPREFIX . 'module_newsletter_access_user', DBPREFIX . 'module_newsletter_attachment', DBPREFIX . 'module_newsletter_category', DBPREFIX . 'module_newsletter_confirm_mail', DBPREFIX . 'module_newsletter_email_link', DBPREFIX . 'module_newsletter_email_link_feedback', DBPREFIX . 'module_newsletter_rel_cat_news', DBPREFIX . 'module_newsletter_rel_usergroup_newsletter', DBPREFIX . 'module_newsletter_rel_user_cat', DBPREFIX . 'module_newsletter_settings', DBPREFIX . 'module_newsletter_template', DBPREFIX . 'module_newsletter_tmp_sending', DBPREFIX . 'module_newsletter_user', DBPREFIX . 'module_newsletter_user_title'), 'podcast' => array(DBPREFIX . 'module_podcast_category', DBPREFIX . 'module_podcast_medium', DBPREFIX . 'module_podcast_rel_category_lang', DBPREFIX . 'module_podcast_rel_medium_category', DBPREFIX . 'module_podcast_settings', DBPREFIX . 'module_podcast_template'), 'shop' => array(DBPREFIX . 'core_mail_template', DBPREFIX . 'core_country', DBPREFIX . 'module_shop_article_group', DBPREFIX . 'module_shop_attribute', DBPREFIX . 'module_shop_categories', DBPREFIX . 'module_shop_countries', DBPREFIX . 'module_shop_currencies', DBPREFIX . 'module_shop_customer_group', DBPREFIX . 'module_shop_discountgroup_count_name', DBPREFIX . 'module_shop_discountgroup_count_rate', DBPREFIX . 'module_shop_discount_coupon', DBPREFIX . 'module_shop_importimg', DBPREFIX . 'module_shop_lsv', DBPREFIX . 'module_shop_mail', DBPREFIX . 'module_shop_mail_content', DBPREFIX . 'module_shop_manufacturer', DBPREFIX . 'module_shop_option', DBPREFIX . 'module_shop_orders', DBPREFIX . 'module_shop_order_attributes', DBPREFIX . 'module_shop_order_items', DBPREFIX . 'module_shop_payment', DBPREFIX . 'module_shop_payment_processors', DBPREFIX . 'module_shop_pricelists', DBPREFIX . 'module_shop_products', DBPREFIX . 'module_shop_products_downloads', DBPREFIX . 'module_shop_rel_countries', DBPREFIX . 'module_shop_rel_customer_coupon', DBPREFIX . 'module_shop_rel_discount_group', DBPREFIX . 'module_shop_rel_payment', DBPREFIX . 'module_shop_rel_product_attribute', DBPREFIX . 'module_shop_rel_shipper', DBPREFIX . 'module_shop_shipment_cost', DBPREFIX . 'module_shop_shipper', DBPREFIX . 'module_shop_vat', DBPREFIX . 'module_shop_zones'), 'voting' => array(DBPREFIX . 'voting_additionaldata', DBPREFIX . 'voting_email', DBPREFIX . 'voting_rel_email_system', DBPREFIX . 'voting_results', DBPREFIX . 'voting_system'), 'downloads' => array(DBPREFIX . 'module_downloads_category', DBPREFIX . 'module_downloads_category_locale', DBPREFIX . 'module_downloads_download', DBPREFIX . 'module_downloads_download_locale', DBPREFIX . 'module_downloads_group', DBPREFIX . 'module_downloads_group_locale', DBPREFIX . 'module_downloads_rel_download_category', DBPREFIX . 'module_downloads_rel_download_download', DBPREFIX . 'module_downloads_rel_group_category', DBPREFIX . 'module_downloads_settings'), 'ecard' => array(DBPREFIX . 'module_ecard_ecards', DBPREFIX . 'module_ecard_settings'), 'jobs' => array(DBPREFIX . 'module_jobs', DBPREFIX . 'module_jobs_categories', DBPREFIX . 'module_jobs_location', DBPREFIX . 'module_jobs_rel_loc_jobs', DBPREFIX . 'module_jobs_settings'), 'knowledge' => array(DBPREFIX . 'module_knowledge_articles', DBPREFIX . 'module_knowledge_article_content', DBPREFIX . 'module_knowledge_categories', DBPREFIX . 'module_knowledge_categories_content', DBPREFIX . 'module_knowledge_settings', DBPREFIX . 'module_knowledge_tags', DBPREFIX . 'module_knowledge_tags_articles'), 'mediadir' => array(DBPREFIX . 'module_mediadir_categories', DBPREFIX . 'module_mediadir_categories_names', DBPREFIX . 'module_mediadir_comments', DBPREFIX . 'module_mediadir_entries', DBPREFIX . 'module_mediadir_forms', DBPREFIX . 'module_mediadir_form_names', DBPREFIX . 'module_mediadir_inputfields', DBPREFIX . 'module_mediadir_inputfield_names', DBPREFIX . 'module_mediadir_inputfield_types', DBPREFIX . 'module_mediadir_inputfield_verifications', DBPREFIX . 'module_mediadir_levels', DBPREFIX . 'module_mediadir_level_names', DBPREFIX . 'module_mediadir_mails', DBPREFIX . 'module_mediadir_mail_actions', DBPREFIX . 'module_mediadir_masks', DBPREFIX . 'module_mediadir_order_rel_forms_selectors', DBPREFIX . 'module_mediadir_rel_entry_categories', DBPREFIX . 'module_mediadir_rel_entry_inputfields', DBPREFIX . 'module_mediadir_rel_entry_inputfields_clean1', DBPREFIX . 'module_mediadir_rel_entry_levels', DBPREFIX . 'module_mediadir_settings', DBPREFIX . 'module_mediadir_settings_num_categories', DBPREFIX . 'module_mediadir_settings_num_entries', DBPREFIX . 'module_mediadir_settings_num_levels', DBPREFIX . 'module_mediadir_settings_perm_group_forms', DBPREFIX . 'module_mediadir_votes'));
    $conflictedModules = array();
    foreach ($missedModules as $module) {
        foreach ($potentialMissedTables[$module] as $table) {
            if (\Cx\Lib\UpdateUtil::table_exist($table)) {
                $result = \Cx\Lib\UpdateUtil::sql('SHOW TABLE STATUS WHERE `Name` = "' . $table . '"');
                if ($result && $result->RecordCount() > 0 && strpos($result->fields['Comment'], 'cx3upgrade') === false) {
                    $conflictedModules[$module][] = $table;
                }
            }
        }
    }
    return $conflictedModules;
}
コード例 #13
0
ファイル: update3.php プロジェクト: Niggu/cloudrexx
            <label>[[TXT_FILESHARING_FILE_NAME]]</label>[[FILESHARING_FILE_NAME]]
        </p>
        <p>
            <input name="delete" type="submit" value="[[TXT_FILESHARING_CONFIRM_DELETE]]" />
        </p>
    </form>
    <!-- END confirm_delete -->
HTMLCODE;
    if (!preg_match('/<!--\\s+BEGIN\\s+confirm_delete\\s+-->.*<!--\\s+END\\s+confirm_delete\\s+-->/ms', $matches[0])) {
        return str_replace('<!-- END upload_form -->', $newHtmlCode, $matches[0]);
    } else {
        return $matches[0];
    }
};
\Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'filesharing', 'cmd' => ''), $search, $callback, array('content'), '3.1.0');
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0') && (!\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'module_news_categories_catid') || \Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'module_news_categories_catid'))) {
    try {
        /************************************************
         * EXTENSION:    Categories as NestedSet         *
         * ADDED:        Contrexx v3.1.0                 *
         ************************************************/
        $nestedSetRootId = null;
        $count = null;
        $leftAndRight = 2;
        $sorting = 1;
        $level = 2;
        // add nested set columns
        \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_categories', array('catid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parent_id' => array('type' => 'INT(11)', 'after' => 'catid'), 'left_id' => array('type' => 'INT(11)', 'after' => 'parent_id'), 'right_id' => array('type' => 'INT(11)', 'after' => 'left_id'), 'sorting' => array('type' => 'INT(11)', 'after' => 'right_id'), 'level' => array('type' => 'INT(11)', 'after' => 'sorting')));
        // add nested set root node and select its id
        $objResultRoot = \Cx\Lib\UpdateUtil::sql('INSERT INTO `' . DBPREFIX . 'module_news_categories` (`catid`, `parent_id`, `left_id`, `right_id`, `sorting`, `level`) VALUES (0, 0, 0, 0, 0, 0)');
        if ($objResultRoot) {
コード例 #14
0
 /**
  * Handles database errors
  *
  * Also migrates the old Manufacturers to the new structure
  * @return  boolean             False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Manufacturer
     // Fix the Text table first
     \Text::errorHandler();
     $table_name = DBPREFIX . 'module_shop_manufacturer';
     // Note:  As this table uses a single column, the primary key will
     // have to be added separately below.  Otherwise, UpdateUtil::table()
     // will drop the id column first, then try to drop all the others,
     // which obviously won't work.
     // In that context, the "AUTO_INCREMENT" has to be dropped as well,
     // for that only applies to a primary key column.
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name) && \Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
         // Get rid of bodies
         \Text::deleteByKey('Shop', self::TEXT_NAME);
         \Text::deleteByKey('Shop', self::TEXT_URI);
         // Migrate all Manufacturer text fields to the Text table
         $query = "\n                SELECT `id`, `name`, `url`\n                  FROM `" . DBPREFIX . "module_shop_manufacturer`";
         $objResult = \Cx\Lib\UpdateUtil::sql($query);
         while (!$objResult->EOF) {
             $id = $objResult->fields['id'];
             $name = $objResult->fields['name'];
             $uri = $objResult->fields['url'];
             if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Manufacturer name '{$name}'");
             }
             if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_URI, $uri)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Manufacturer URI '{$uri}'");
             }
             $objResult->MoveNext();
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     \Cx\Lib\UpdateUtil::sql("\n            ALTER TABLE `{$table_name}`\n              ADD PRIMARY KEY (`id`)");
     \Cx\Lib\UpdateUtil::sql("\n            ALTER TABLE `{$table_name}`\n           CHANGE `id` `id` int(10) unsigned NOT NULL AUTO_INCREMENT");
     // Always
     return false;
 }
コード例 #15
0
 /**
  * Handles database errors
  *
  * Also migrates old ProductAttribute to new Attribute structures,
  * including Text records.
  * @return  boolean   false       Always!
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Attribute
     $default_lang_id = \FWLanguage::getDefaultLangId();
     $table_name_old = DBPREFIX . 'module_shop_products_attributes_name';
     $table_name_new = DBPREFIX . 'module_shop_attribute';
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_new)) {
         \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     } else {
         $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'display_type'));
         $table_index = array();
         if (\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
             if (\Cx\Lib\UpdateUtil::column_exist($table_name_old, 'name')) {
                 // Migrate all Product strings to the Text table first
                 \Text::deleteByKey('Shop', self::TEXT_ATTRIBUTE_NAME);
                 $query = "\n                        SELECT `id`, `name`\n                          FROM `{$table_name_old}`";
                 $objResult = \Cx\Lib\UpdateUtil::sql($query);
                 if (!$objResult) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to to query Attribute names", $query);
                 }
                 while (!$objResult->EOF) {
                     $id = $objResult->fields['id'];
                     $name = $objResult->fields['name'];
                     if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_ATTRIBUTE_NAME, $name)) {
                         throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Attribute name '{$name}'");
                     }
                     $objResult->MoveNext();
                 }
             }
         }
         //DBG::activate(DBG_ADODB);
         \Cx\Lib\UpdateUtil::table($table_name_old, $table_structure, $table_index);
         if (!\Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name_new)) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to rename Attribute table");
         }
     }
     $table_name_old = DBPREFIX . 'module_shop_products_attributes_value';
     $table_name_new = DBPREFIX . 'module_shop_option';
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_new)) {
         \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     } else {
         $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'attribute_id' => array('type' => 'INT(10)', 'unsigned' => true, 'renamefrom' => 'name_id'), 'price' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'));
         $table_index = array();
         if (\Cx\Lib\UpdateUtil::table_exist($table_name_old)) {
             if (\Cx\Lib\UpdateUtil::column_exist($table_name_old, 'value')) {
                 // Migrate all Product strings to the Text table first
                 \Text::deleteByKey('Shop', self::TEXT_OPTION_NAME);
                 $query = "\n                        SELECT `id`, `value`\n                          FROM `{$table_name_old}`";
                 $objResult = \Cx\Lib\UpdateUtil::sql($query);
                 if (!$objResult) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to to query option names", $query);
                 }
                 while (!$objResult->EOF) {
                     $id = $objResult->fields['id'];
                     $name = $objResult->fields['value'];
                     if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_OPTION_NAME, $name)) {
                         throw new \Cx\Lib\Update_DatabaseException("Failed to to migrate option Text '{$name}'");
                     }
                     $objResult->MoveNext();
                 }
             }
         }
         \Cx\Lib\UpdateUtil::table($table_name_old, $table_structure, $table_index);
         if (!\Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name_new)) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to rename Option table");
         }
     }
     $table_name_old = DBPREFIX . 'module_shop_products_attributes';
     $table_name_new = DBPREFIX . 'module_shop_rel_product_attribute';
     if (\Cx\Lib\UpdateUtil::table_exist($table_name_new)) {
         \Cx\Lib\UpdateUtil::drop_table($table_name_old);
     } else {
         $table_structure = array('product_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'primary' => true), 'option_id' => array('type' => 'INT(10)', 'unsigned' => true, 'primary' => true, 'renamefrom' => 'attributes_value_id'), 'ord' => array('type' => 'INT(10)', 'default' => '0', 'renamefrom' => 'sort_id'));
         $table_index = array();
         \Cx\Lib\UpdateUtil::table($table_name_old, $table_structure, $table_index);
         if (!\Cx\Lib\UpdateUtil::table_rename($table_name_old, $table_name_new)) {
             throw new \Cx\Lib\Update_DatabaseException("Failed to rename Product-Attribute relation table {$table_name_old} to {$table_name_new}");
         }
     }
     // Always
     return false;
 }
コード例 #16
0
ファイル: calendar.php プロジェクト: nahakiole/cloudrexx
 /**
  * create new tables
  * @return string|boolean
  */
 protected function createNewTables()
 {
     try {
         // host table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_HOST_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_HOST_TABLE, array('id' => array('type' => 'INT(1)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'id'), 'uri' => array('type' => 'mediumtext', 'after' => 'title'), 'cat_id' => array('type' => 'INT(11)', 'after' => 'uri'), 'key' => array('type' => 'VARCHAR(40)', 'after' => 'cat_id'), 'confirmed' => array('type' => 'INT(11)', 'after' => 'key'), 'status' => array('type' => 'INT(1)', 'after' => 'confirmed')), array('fk_contrexx_module_calendar_shared_hosts_contrexx_module_cale1' => array('fields' => array('cat_id'))));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // relation table for host - event
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REL_HOST_EVENT_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_REL_HOST_EVENT_TABLE, array('host_id' => array('type' => 'INT(11)'), 'event_id' => array('type' => 'INT(11)', 'notnull' => true, 'after' => 'host_id')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // settings table
         if (!\Cx\Lib\UpdateUtil::table_empty(CALENDAR_OLD_SETTINGS_TABLE)) {
             // remove old settings data
             \Cx\Lib\UpdateUtil::drop_table(CALENDAR_NEW_SETTINGS_TABLE);
         }
         \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_SETTINGS_TABLE, array('id' => array('type' => 'INT(7)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'section_id' => array('type' => 'INT(11)', 'after' => 'id'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'section_id'), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'name'), 'value' => array('type' => 'mediumtext', 'after' => 'title'), 'info' => array('type' => 'mediumtext', 'after' => 'value'), 'type' => array('type' => 'INT(11)', 'after' => 'info'), 'options' => array('type' => 'mediumtext', 'after' => 'type'), 'special' => array('type' => 'VARCHAR(255)', 'after' => 'options'), 'order' => array('type' => 'INT(11)', 'after' => 'special')));
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // settings section table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_SETTINGS_SECTION_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_SETTINGS_SECTION_TABLE, array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parent' => array('type' => 'INT(11)', 'after' => 'id'), 'order' => array('type' => 'INT(11)', 'after' => 'parent'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'order'), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'name')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // registration table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REGISTRATION_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_REGISTRATION_TABLE, array('id' => array('type' => 'INT(7)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'event_id' => array('type' => 'INT(7)', 'after' => 'id'), 'date' => array('type' => 'INT(15)', 'after' => 'event_id'), 'host_name' => array('type' => 'VARCHAR(255)', 'after' => 'date'), 'ip_address' => array('type' => 'VARCHAR(15)', 'after' => 'host_name'), 'type' => array('type' => 'INT(1)', 'after' => 'ip_address'), 'key' => array('type' => 'VARCHAR(45)', 'after' => 'type'), 'user_id' => array('type' => 'INT(7)', 'after' => 'key'), 'lang_id' => array('type' => 'INT(11)', 'after' => 'user_id'), 'export' => array('type' => 'INT(11)', 'after' => 'lang_id'), 'payment_method' => array('type' => 'INT(11)', 'after' => 'export'), 'paid' => array('type' => 'INT(11)', 'after' => 'payment_method')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // registration form table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REGISTRATION_FORM_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_REGISTRATION_FORM_TABLE, array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'status' => array('type' => 'INT(11)', 'after' => 'id'), 'order' => array('type' => 'INT(11)', 'after' => 'status'), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'order')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // registration form field table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REGISTRATION_FORM_FIELD_TABLE)) {
             \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_calendar_registration_form_field', array('id' => array('type' => 'INT(7)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'form' => array('type' => 'INT(11)', 'after' => 'id'), 'type' => array('type' => 'ENUM(\'inputtext\',\'textarea\',\'select\',\'radio\',\'checkbox\',\'mail\',\'seating\',\'agb\',\'salutation\',\'firstname\',\'lastname\',\'selectBillingAddress\',\'fieldset\')', 'after' => 'form'), 'required' => array('type' => 'INT(1)', 'after' => 'type'), 'order' => array('type' => 'INT(3)', 'after' => 'required'), 'affiliation' => array('type' => 'VARCHAR(45)', 'after' => 'order')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // registration form field name table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REGISTRATION_FORM_FIELD_NAME_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_REGISTRATION_FORM_FIELD_NAME_TABLE, array('field_id' => array('type' => 'INT(7)'), 'form_id' => array('type' => 'INT(11)', 'after' => 'field_id'), 'lang_id' => array('type' => 'INT(1)', 'after' => 'form_id'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'lang_id'), 'default' => array('type' => 'mediumtext', 'notnull' => true, 'after' => 'name')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // registration form field value table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_REGISTRATION_FORM_FIELD_VALUE_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_REGISTRATION_FORM_FIELD_VALUE_TABLE, array('reg_id' => array('type' => 'INT(7)'), 'field_id' => array('type' => 'INT(7)', 'after' => 'reg_id'), 'value' => array('type' => 'mediumtext', 'notnull' => true, 'after' => 'field_id')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // category table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_CATEGORY_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_CATEGORY_TABLE, array('id' => array('type' => 'INT(5)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'pos' => array('type' => 'INT(5)', 'notnull' => false, 'after' => 'id'), 'status' => array('type' => 'INT(1)', 'notnull' => false, 'after' => 'pos')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // category name table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_CATEGORY_NAME_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_CATEGORY_NAME_TABLE, array('cat_id' => array('type' => 'INT(11)'), 'lang_id' => array('type' => 'INT(11)', 'notnull' => false, 'after' => 'cat_id'), 'name' => array('type' => 'VARCHAR(225)', 'notnull' => false, 'after' => 'lang_id')), array('fk_contrexx_module_calendar_category_names_contrexx_module_ca1' => array('fields' => array('cat_id'))));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // mail table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_MAIL_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_MAIL_TABLE, array('id' => array('type' => 'INT(7)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'id'), 'content_text' => array('type' => 'longtext', 'after' => 'title'), 'content_html' => array('type' => 'longtext', 'after' => 'content_text'), 'recipients' => array('type' => 'mediumtext', 'after' => 'content_html'), 'lang_id' => array('type' => 'INT(1)', 'after' => 'recipients'), 'action_id' => array('type' => 'INT(1)', 'after' => 'lang_id'), 'is_default' => array('type' => 'INT(1)', 'after' => 'action_id'), 'status' => array('type' => 'INT(1)', 'after' => 'is_default')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // mail action table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_MAIL_ACTION_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_MAIL_ACTION_TABLE, array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'id'), 'default_recipient' => array('type' => 'ENUM(\'empty\',\'admin\',\'author\')', 'after' => 'name'), 'need_auth' => array('type' => 'INT(11)', 'after' => 'default_recipient')));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // event table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_EVENT_TABLE)) {
             \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_calendar_event', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'startdate' => array('type' => 'INT(14)', 'notnull' => false, 'after' => 'type'), 'enddate' => array('type' => 'INT(14)', 'notnull' => false, 'after' => 'startdate'), 'use_custom_date_display' => array('type' => 'TINYINT(1)', 'after' => 'enddate'), 'showStartDateList' => array('type' => 'INT(1)', 'after' => 'use_custom_date_display'), 'showEndDateList' => array('type' => 'INT(1)', 'after' => 'showStartDateList'), 'showStartTimeList' => array('type' => 'INT(1)', 'after' => 'showEndDateList'), 'showEndTimeList' => array('type' => 'INT(1)', 'after' => 'showStartTimeList'), 'showTimeTypeList' => array('type' => 'INT(1)', 'after' => 'showEndTimeList'), 'showStartDateDetail' => array('type' => 'INT(1)', 'after' => 'showTimeTypeList'), 'showEndDateDetail' => array('type' => 'INT(1)', 'after' => 'showStartDateDetail'), 'showStartTimeDetail' => array('type' => 'INT(1)', 'after' => 'showEndDateDetail'), 'showEndTimeDetail' => array('type' => 'INT(1)', 'after' => 'showStartTimeDetail'), 'showTimeTypeDetail' => array('type' => 'INT(1)', 'after' => 'showEndTimeDetail'), 'google' => array('type' => 'INT(11)', 'after' => 'showTimeTypeDetail'), 'access' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'google'), 'priority' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '3', 'after' => 'access'), 'price' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'priority'), 'link' => array('type' => 'VARCHAR(255)', 'after' => 'price'), 'pic' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'link'), 'attach' => array('type' => 'VARCHAR(255)', 'after' => 'pic'), 'place_mediadir_id' => array('type' => 'INT(11)', 'after' => 'attach'), 'catid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'place_mediadir_id'), 'show_in' => array('type' => 'VARCHAR(255)', 'after' => 'catid'), 'invited_groups' => array('type' => 'VARCHAR(45)', 'notnull' => false, 'after' => 'show_in'), 'invited_mails' => array('type' => 'mediumtext', 'notnull' => false, 'after' => 'invited_groups'), 'invitation_sent' => array('type' => 'INT(1)', 'after' => 'invited_mails'), 'invitation_email_template' => array('type' => 'VARCHAR(255)', 'after' => 'invitation_sent'), 'registration' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'invitation_email_template'), 'registration_form' => array('type' => 'INT(11)', 'after' => 'registration'), 'registration_num' => array('type' => 'VARCHAR(45)', 'notnull' => false, 'after' => 'registration_form'), 'registration_notification' => array('type' => 'VARCHAR(1024)', 'notnull' => false, 'after' => 'registration_num'), 'email_template' => array('type' => 'INT(11)', 'after' => 'registration_notification'), 'ticket_sales' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'email_template'), 'num_seating' => array('type' => 'text', 'after' => 'ticket_sales'), 'series_status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '0', 'after' => 'num_seating'), 'series_type' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_status'), 'series_pattern_count' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_type'), 'series_pattern_weekday' => array('type' => 'VARCHAR(7)', 'after' => 'series_pattern_count'), 'series_pattern_day' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_weekday'), 'series_pattern_week' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_day'), 'series_pattern_month' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_week'), 'series_pattern_type' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_month'), 'series_pattern_dourance_type' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_type'), 'series_pattern_end' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_dourance_type'), 'series_pattern_begin' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'series_pattern_end'), 'series_pattern_exceptions' => array('type' => 'longtext', 'after' => 'series_pattern_begin'), 'status' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '1', 'after' => 'series_pattern_exceptions'), 'confirmed' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '1', 'after' => 'status'), 'author' => array('type' => 'VARCHAR(255)', 'after' => 'confirmed'), 'all_day' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'author'), 'place' => array('type' => 'VARCHAR(255)', 'after' => 'all_day'), 'place_id' => array('type' => 'INT(11)', 'after' => 'place'), 'place_street' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'place_id'), 'place_zip' => array('type' => 'VARCHAR(10)', 'notnull' => false, 'after' => 'place_street'), 'place_city' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'place_zip'), 'place_country' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'place_city'), 'place_link' => array('type' => 'VARCHAR(255)', 'after' => 'place_country'), 'place_map' => array('type' => 'VARCHAR(255)', 'after' => 'place_link'), 'org_name' => array('type' => 'VARCHAR(255)', 'after' => 'place_map'), 'org_street' => array('type' => 'VARCHAR(255)', 'after' => 'org_name'), 'org_zip' => array('type' => 'VARCHAR(10)', 'after' => 'org_street'), 'org_city' => array('type' => 'VARCHAR(255)', 'after' => 'org_zip'), 'org_link' => array('type' => 'VARCHAR(255)', 'after' => 'org_city'), 'org_email' => array('type' => 'VARCHAR(255)', 'after' => 'org_link'), 'host_mediadir_id' => array('type' => 'INT(11)', 'after' => 'org_email')), array('fk_contrexx_module_calendar_notes_contrexx_module_calendar_ca1' => array('fields' => array('catid'))));
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         // event field table
         if (!\Cx\Lib\UpdateUtil::table_exist(CALENDAR_NEW_EVENT_FIELD_TABLE)) {
             \Cx\Lib\UpdateUtil::table(CALENDAR_NEW_EVENT_FIELD_TABLE, array('event_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'VARCHAR(225)', 'notnull' => false, 'after' => 'event_id'), 'title' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'lang_id'), 'description' => array('type' => 'mediumtext', 'notnull' => false, 'after' => 'title'), 'redirect' => array('type' => 'VARCHAR(255)', 'after' => 'description')), array('lang_field' => array('fields' => array('title')), 'fk_contrexx_module_calendar_note_field_contrexx_module_calend1' => array('fields' => array('event_id')), 'eventIndex' => array('fields' => array('title', 'description'), 'type' => 'FULLTEXT')));
         }
     } catch (\Cx\Lib\UpdateException $e) {
         return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
     }
     return true;
     // the style table hasn't been modified
 }
コード例 #17
0
ファイル: Payment.class.php プロジェクト: nahakiole/cloudrexx
 /**
  * Handles any kind of database errors
  *
  * Includes updating the payments table (I guess from version 1.2.0(?),
  * note that this is unconfirmed) to the current structure
  * @return  boolean               False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Payment
     // Fix the Text and Zones tables first
     \Text::errorHandler();
     Zones::errorHandler();
     \Yellowpay::errorHandler();
     $table_name = DBPREFIX . 'module_shop_payment';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'processor_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0'), 'fee' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'costs'), 'free_from' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'costs_free_sum'), 'ord' => array('type' => 'INT(5)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'sort_order'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'status'));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
             // Migrate all Payment names to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             $query = "\n                    SELECT `id`, `name`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query Payment names", $query);
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['id'];
                 $name = $objResult->fields['name'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Payment name '{$name}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Update Payments that use obsolete PSPs:
     //  - 05, 'Internal_CreditCard'
     //  - 06, 'Internal_Debit',
     // Uses 04, Internal
     \Cx\Lib\UpdateUtil::sql("UPDATE {$table_name}\n                SET `processor_id`=4 WHERE `processor_id` IN (5, 6)");
     // - 07, 'Saferpay_Mastercard_Multipay_CAR',
     // - 08, 'Saferpay_Visa_Multipay_CAR',
     // Uses 01, Saferpay
     \Cx\Lib\UpdateUtil::sql("UPDATE {$table_name}\n                SET `processor_id`=1 WHERE `processor_id` IN (7, 8)");
     $table_name = DBPREFIX . 'module_shop_rel_payment';
     $table_structure = array('payment_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'primary' => true), 'zone_id' => array('type' => 'INT(10)', 'unsigned' => true, 'default' => '0', 'primary' => true, 'renamefrom' => 'zones_id'));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always
     return false;
 }
コード例 #18
0
ファイル: Vat.class.php プロジェクト: nahakiole/cloudrexx
 /**
  * Tries to fix database problems
  *
  * Also migrates text fields to the new structure.
  * Note that no VAT classes are added here (yet), so neither the old
  * nor the new table exists to begin with, the new structure will be
  * created with no records.
  * @return  boolean               False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Vat
     $table_name = DBPREFIX . 'module_shop_vat';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'rate' => array('type' => 'DECIMAL(5,2)', 'unsigned' => true, 'notnull' => true, 'default' => '0.00', 'renamefrom' => 'percent'));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name, 'class')) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'class')) {
             // Migrate all Vat classes to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_CLASS);
             $query = "\n                    SELECT `id`, `class`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             while (!$objResult->EOF) {
                 $id = $objResult->fields['id'];
                 $class = $objResult->fields['class'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_CLASS, $class)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate VAT class '{$class}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always
     return false;
 }
コード例 #19
0
ファイル: Product.class.php プロジェクト: Cloudrexx/cloudrexx
 /**
  * Handles database errors
  *
  * Also migrates text fields to the new structure
  * @return  boolean         False.  Always.
  * @static
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Product
     // Fix the Text, Discount, and Manufacturer tables first
     \Text::errorHandler();
     //        Discount::errorHandler(); // Called by Customer::errorHandler();
     Manufacturer::errorHandler();
     $table_name = DBPREFIX . 'module_shop_products';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'normalprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'resellerprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'discountprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'discount_active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'is_special_offer'), 'stock' => array('type' => 'INT(10)', 'default' => '10'), 'stock_visible' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'stock_visibility'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'status'), 'b2b' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1'), 'b2c' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1'), 'date_start' => array('type' => 'TIMESTAMP', 'default' => '0000-00-00 00:00:00', 'renamefrom' => 'startdate'), 'date_end' => array('type' => 'TIMESTAMP', 'default' => '0000-00-00 00:00:00', 'renamefrom' => 'enddate'), 'weight' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'category_id' => array('type' => 'VARCHAR(255)', 'default' => '', 'renamefrom' => 'catid'), 'vat_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'manufacturer_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'manufacturer'), 'group_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'article_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'usergroup_ids' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'ord' => array('type' => 'INT(10)', 'default' => '0', 'renamefrom' => 'sort_order'), 'distribution' => array('type' => 'VARCHAR(16)', 'default' => '', 'renamefrom' => 'handler'), 'picture' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'flags' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'minimum_order_quantity' => array('type' => 'INT(10)', 'unsigned' => false, 'default' => '0'));
     $table_index = array('group_id' => array('fields' => array('group_id')), 'article_id' => array('fields' => array('article_id')), 'flags' => array('fields' => array('flags'), 'type' => 'FULLTEXT'));
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'title')) {
             // Migrate all Product strings to the Text table first
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             \Text::deleteByKey('Shop', self::TEXT_SHORT);
             \Text::deleteByKey('Shop', self::TEXT_LONG);
             \Text::deleteByKey('Shop', self::TEXT_CODE);
             \Text::deleteByKey('Shop', self::TEXT_URI);
             \Text::deleteByKey('Shop', self::TEXT_KEYS);
             $query = "\n                    SELECT `id`, `title`, `shortdesc`, `description`,\n                           `product_id`, `external_link`, `keywords`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query Product strings", $query);
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['id'];
                 $name = $objResult->fields['title'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product name '{$name}'");
                 }
                 $short = $objResult->fields['shortdesc'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_SHORT, $short)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product short '{$short}'");
                 }
                 $long = $objResult->fields['description'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_LONG, $long)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product long '{$long}'");
                 }
                 $code = $objResult->fields['product_id'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_CODE, $code)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product code '{$code}'");
                 }
                 $uri = $objResult->fields['external_link'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_URI, $uri)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product uri '{$uri}'");
                 }
                 $keys = $objResult->fields['keywords'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_KEYS, $keys)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product keys '{$keys}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Also fix Customer and some related tables
     Customer::errorHandler();
     // Always
     return false;
 }
コード例 #20
0
 public function migrateStatistics()
 {
     global $objUpdate, $_CONFIG;
     // only execute this part for versions < 2.1.5
     if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.1.5')) {
         if (!\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'content')) {
             return true;
         }
         try {
             //2.1.5: new field contrexx_stats_requests.pageTitle needs to be added and filled
             if (!\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'stats_requests', 'pageTitle')) {
                 \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'stats_requests` ADD `pageTitle` varchar(250) NOT NULL AFTER `sid`');
             }
             //fill pageTitle with current titles
             \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'stats_requests SET pageTitle = ( SELECT title FROM ' . DBPREFIX . 'content WHERE id=pageId ) WHERE EXISTS ( SELECT title FROM ' . DBPREFIX . 'content WHERE id=pageId ) AND pageTitle = \'\'');
         } catch (\Cx\Lib\UpdateException $e) {
             return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
         }
     }
     return true;
 }
コード例 #21
0
 /**
  * Handles database errors
  *
  * Also migrates old names to the new structure
  * @return  boolean         False.  Always.
  * @static
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     // Shipment
     static $break = false;
     if ($break) {
         die("\n                Shipment::errorHandler(): Recursion detected while handling an error.<br /><br />\n                This should not happen.  We are very sorry for the inconvenience.<br />\n                Please contact customer support: helpdesk@comvation.com");
     }
     $break = true;
     //die("Shipment::errorHandler(): Disabled!<br />");
     // Fix the Zones table first
     Zones::errorHandler();
     $table_name = DBPREFIX . 'module_shop_shipper';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'ord' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'renamefrom' => 'status'));
     $table_index = array();
     $default_lang_id = \FWLanguage::getDefaultLangId();
     if (\Cx\Lib\UpdateUtil::table_exist($table_name)) {
         if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) {
             \Text::deleteByKey('Shop', self::TEXT_NAME);
             $query = "\n                    SELECT `id`, `name`\n                      FROM `{$table_name}`";
             $objResult = \Cx\Lib\UpdateUtil::sql($query);
             if (!$objResult) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to query names", $query);
             }
             while (!$objResult->EOF) {
                 $id = $objResult->fields['id'];
                 $name = $objResult->fields['name'];
                 if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) {
                     throw new \Cx\Lib\Update_DatabaseException("Failed to migrate name '{$name}'");
                 }
                 $objResult->MoveNext();
             }
         }
     }
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     $table_name = DBPREFIX . 'module_shop_shipment_cost';
     $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'shipper_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'max_weight' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'fee' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'cost'), 'free_from' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'price_free'));
     $table_index = array();
     \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index);
     // Always!
     return false;
 }
コード例 #22
0
ファイル: index.php プロジェクト: Niggu/cloudrexx
require_once UPDATE_CORE . '/Init.class.php';
require_once UPDATE_CORE . '/Model/RecursiveArrayAccess.class.php';
require_once UPDATE_LIB . '/PEAR/HTML/Template/Sigma/Sigma.php';
require_once UPDATE_LIB . '/adodb/adodb.inc.php';
require_once UPDATE_LIB . '/FRAMEWORK/Language.class.php';
require_once UPDATE_LIB . '/FRAMEWORK/cxjs/ContrexxJavascript.class.php';
require_once UPDATE_LIB . '/FRAMEWORK/Javascript.class.php';
// Update files
require_once UPDATE_PATH . '/ContrexxUpdate.class.php';
require_once UPDATE_LIB . '/FRAMEWORK/UpdateUtil.class.php';
$objDatabase = getDatabaseObject($errorMsg);
if (!$objDatabase) {
    die($errorMsg);
}
Env::set('db', $objDatabase);
if (!\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'session_variable')) {
    require_once UPDATE_CORE . '/session.class.php';
    // Start session
    $sessionObj = new cmsSession();
} else {
    require_once UPDATE_CORE . '/session32.class.php';
    $sessionObj = \cmsSession::getInstance();
}
$sessionObj->cmsSessionStatusUpdate('backend');
// Initialize base system
$objInit = new InitCMS('update', \Env::get('em'));
Env::set('init', $objInit);
JS::activate('cx');
JS::activate('jquery-tools');
JS::registerJS('lib/contrexxUpdate.php');
JS::registerJS('lib/javascript/html2dom.js');