Пример #1
0
 /**
  * insert demo data to mail tables
  * @return bool|string
  */
 protected function insertMailDemoData()
 {
     try {
         if (\Cx\Lib\UpdateUtil::table_empty(CALENDAR_NEW_MAIL_TABLE)) {
             \Cx\Lib\UpdateUtil::sql("\r\n                    INSERT IGNORE INTO `" . CALENDAR_NEW_MAIL_TABLE . "` (`id`, `title`, `content_text`, `content_html`, `recipients`, `lang_id`, `action_id`, `is_default`, `status`)\r\n                        VALUES\r\n                            (1, '[[URL]] - Einladung zu [[TITLE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]] \r\n\r\nSie wurden auf [[URL]] zum Event \"[[TITLE]]\" eingeladen.\r\nDetails: [[LINK_EVENT]]\r\n\r\nFolgen Sie dem unten stehenden Link um sich f&uuml;r diesen Event an- oder abzumelden.\r\nHinweis: Sollte der Link nicht funktionieren, kopieren Sie die komplette Adresse ohne Zeilenumbr&uuml;che in die Adresszeile Ihres Browsers und dr&uuml;cken Sie anschliessend \"Enter\".\r\n\r\n[[LINK_REGISTRATION]]\r\n\r\n\r\n--\r\nDiese Nachricht wurde automatisch generiert\r\n[[DATE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]]<br />\r\n<br />\r\nSie wurden auf <a href=\"http://[[URL]]\" title=\"[[URL]]\">[[URL]]</a> zum Event <a href=\"[[LINK_EVENT]]\" title=\"Event Details\">&quot;[[TITLE]]&quot;</a> eingeladen. <br />\r\nKlicken Sie <a href=\"[[LINK_REGISTRATION]]\" title=\"Anmeldung\">hier</a>, um sich an diesem Event an- oder abzumelden.<br />\r\n<br />\r\n<br />\r\n--<br />\r\n<em>Diese Nachricht wurde automatisch generiert</em><br />\r\n<em>[[DATE]]</em>', '', 1, 1, 1, 1),\r\n                            (15, '[[URL]] - Neue [[REGISTRATION_TYPE]] f&uuml;r [[TITLE]]', 'Hallo\r\n\r\nAuf [[URL]] wurde eine neue [[REGISTRATION_TYPE]] f&uuml;r den Termin \"[[TITLE]]\" eingetragen.\r\n\r\nInformationen zur [[REGISTRATION_TYPE]]\r\n[[REGISTRATION_DATA]]\r\n\r\n-- \r\nDiese Nachricht wurde automatisch generiert [[DATE]]', 'Hallo<br />\r\n<br />\r\nAuf [[URL]] wurde eine neue [[REGISTRATION_TYPE]] f&uuml;r den Termin &quot;[[TITLE]]&quot; eingetragen.<br />\r\n<br />\r\n<h2>Informationen zur [[REGISTRATION_TYPE]]</h2>\r\n[[REGISTRATION_DATA]] <br />\r\n<br />\r\n-- <br />\r\nDiese Nachricht wurde automatisch generiert [[DATE]]', '', 1, 3, 1, 1),\r\n                            (14, '[[URL]] - Erfolgreiche [[REGISTRATION_TYPE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]]\r\n\r\nIhre [[REGISTRATION_TYPE]] zum Event \"[[TITLE]]\" vom [[START_DATE]] wurde erfolgreich in unserem System eingetragen.\r\n\r\n\r\n--\r\nDiese Nachricht wurde automatisch generiert\r\n[[DATE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]]<br />\r\n<br />\r\nIhre [[REGISTRATION_TYPE]] zum Event <a title=\"[[TITLE]]\" href=\"[[LINK_EVENT]]\">[[TITLE]]</a> vom [[START_DATE]] wurde erfolgreich in unserem System eingetragen.<br />\r\n<br />\r\n--<br />\r\n<em>Diese Nachricht wurde automatisch generiert<br />\r\n[[DATE]]</em>', '', 1, 2, 1, 1),\r\n                            (16, '[[URL]] - Neuer Termin: [[TITLE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]] \r\n\r\nUnter [[URL]] finden Sie den neuen Event \"[[TITLE]]\".\r\nDetails: [[LINK_EVENT]]\r\n\r\n\r\n--\r\nDiese Nachricht wurde automatisch generiert\r\n[[DATE]]', 'Hallo [[FIRSTNAME]] [[LASTNAME]]<br />\r\n<br />\r\nUnter <a title=\"[[URL]]\" href=\"http://[[URL]]\">[[URL]]</a> finden Sie den neuen Event <a title=\"Event Details\" href=\"[[LINK_EVENT]]\">&quot;[[TITLE]]&quot;</a>. <br />\r\n<br />\r\n<br />\r\n--<br />\r\n<em>Diese Nachricht wurde automatisch generiert</em><br />\r\n<em>[[DATE]]</em>', '', 1, 4, 1, 1)\r\n                ");
         }
         if (!checkMemoryLimit() || !checkTimeoutLimit()) {
             return 'timeout';
         }
         if (\Cx\Lib\UpdateUtil::table_empty(CALENDAR_NEW_MAIL_ACTION_TABLE)) {
             \Cx\Lib\UpdateUtil::sql("\r\n                    INSERT IGNORE INTO `" . CALENDAR_NEW_MAIL_ACTION_TABLE . "`\r\n                        VALUES\r\n                            (1, 'invitationTemplate', 'empty', 0),\r\n                            (2, 'confirmationRegistration', 'author', 0),\r\n                            (3, 'notificationRegistration', 'empty', 0),\r\n                            (4, 'notificationNewEntryFE', 'admin', 0)\r\n                ");
         }
     } catch (\Cx\Lib\UpdateException $e) {
         return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
     }
     return true;
 }
Пример #2
0
 /**
  * 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;
 }
Пример #3
0
 /**
  * Migrates existing old Shop mailtemplates to the new MailTemplate class
  * @return  boolean         False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     if (!(include_once \Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseFrameworkPath() . '/UpdateUtil')) {
         return false;
     }
     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);
     }
     // Migrate existing templates from the shop to the MailTemplate.
     // These are the keys replacing the IDs.
     // TODO: Migrate the old template using the original IDs, make them unprotected
     // TODO: Add the new default templates with the new keys
     // and have the user migrate changes herself!
     $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login');
     $arrLanguageId = \FWLanguage::getIdArray();
     if (empty($arrLanguageId)) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs");
     }
     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) {
             // TODO: utf8_encode() may not be necessary in all cases.
             // It worked without it for me earlier, but was necessary for verkehrstheorie.ch
             $arrTemplate = array_map("utf8_encode", $arrTemplate);
             if (isset($arrKey[$id])) {
                 // System templates get their default key
                 $arrTemplate['key'] = $arrKey[$id];
                 if ($id == 4) {
                     // Clear the protected flag, so the obsolete template
                     // #4 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;
             }
             foreach ($arrTemplate as &$string) {
                 // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS].
                 $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string);
                 // TODO: 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');
     // Always!
     return false;
 }
Пример #4
0
            <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) {
Пример #5
0
    /**
     * 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;
    }