function _recommendUpdate() { global $objDatabase; /******************************** * EXTENSION: Captcha * * ADDED: Contrexx v3.0.0 * ********************************/ try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } if (!preg_match('/<!--\\s+BEGIN\\s+recommend_captcha\\s+-->.*<!--\\s+END\\s+recommend_captcha\\s+-->/ms', $content)) { // migrate captcha stuff $content = preg_replace('/<img[^>]+\\{RECOM_CAPTCHA_URL\\}.*\\{RECOM_CAPTCHA_OFFSET\\}[^>]+>/ms', '{RECOM_CAPTCHA_CODE}', $content); // migration for very old versions $content = preg_replace('/(.*)(<tr[^>]*>.*?<td[^>]*>.*?\\{RECOM_CAPTCHA_CODE\\}.*?<\\/td>.*?<\\/tr>)/ms', '$1<!-- BEGIN recommend_captcha -->$2<!-- END recommend_captcha -->', $content, -1, $count); // migration for newer versions if (!$count) { $content = preg_replace('/(.*)(<p[^>]*>.*?\\{RECOM_CAPTCHA_.*?\\}.*?<\\/p>)/ms', '$1<!-- BEGIN recommend_captcha -->$2<!-- END recommend_captcha -->', $content); } $content = preg_replace('/(.*)(<p[^>]*><label.*<\\/label>)(.*?\\{RECOM_CAPTCHA_.*?\\}.*?)(<\\/p>)/ms', '$1$2{RECOM_CAPTCHA_CODE}$4', $content); } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'recommend'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _loginUpdate() { global $objUpdate, $_CONFIG; // only update if installed version is at least a version 2.0.0 // older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) { try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return null; } // add missing captcha template block if (!preg_match('/<!--\\s+BEGIN\\s+captcha\\s+-->.*<!--\\s+END\\s+captcha\\s+-->/ms', $content)) { $content = preg_replace('/(<input[^>]+name\\s*=\\s*[\'"]PASSWORD[\'"][^>]*>.*?<\\/p>)(\\s+)/ms', '$1$2<!-- BEGIN captcha -->$2<p><label for="coreCaptchaCode">{TXT_CORE_CAPTCHA}</label>{CAPTCHA_CODE}</p>$2<!-- END captcha -->', $content); } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'login', 'cmd' => ''), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } return true; }
function _podcastUpdate() { global $objDatabase, $_ARRAYLANG, $objUpdate, $_CONFIG; //move podcast images directory $path = ASCMS_DOCUMENT_ROOT . '/images'; $oldImagesPath = '/content/podcast'; $newImagesPath = '/podcast'; if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '1.2.1')) { if (!file_exists($path . $newImagesPath) && file_exists($path . $oldImagesPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $oldImagesPath); if (!\Cx\Lib\FileSystem\FileSystem::copy_folder($path . $oldImagesPath, $path . $newImagesPath)) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_TO_MOVE_DIRECTORY'], $path . $oldImagesPath, $path . $newImagesPath)); return false; } } \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath); \Cx\Lib\FileSystem\FileSystem::makeWritable($path . $newImagesPath . '/youtube_thumbnails'); //change thumbnail paths $query = "UPDATE `" . DBPREFIX . "module_podcast_medium` SET `thumbnail` = REPLACE(`thumbnail`, '/images/content/podcast/', '/images/podcast/')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } //set new default settings $query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '50' WHERE `setname` = 'thumb_max_size' AND `setvalue` = ''"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } $query = "UPDATE `" . DBPREFIX . "module_podcast_settings` SET `setvalue` = '85' WHERE `setname` = 'thumb_max_size_homecontent' AND `setvalue` = ''"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } // only update if installed version is at least a version 2.0.0 // older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) { try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } // add missing placeholder {PODCAST_JAVASCRIPT} if (strpos($content, '{PODCAST_JAVASCRIPT}') === false) { $content .= "\n{PODCAST_JAVASCRIPT}"; } // add missing placeholder {PODCAST_PAGING} if (strpos($content, '{PODCAST_PAGING}') === false) { $content = preg_replace('/(\\s+)(<!--\\s+END\\s+podcast_media\\s+-->)/ms', '$1$2$1<div class="noMedium">$1 {PODCAST_PAGING}$1</div>', $content); } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'podcast'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _marketUpdate() { global $objDatabase, $_ARRAYLANG; $query = "SELECT id FROM " . DBPREFIX . "module_market_settings WHERE name='codeMode'"; $objCheck = $objDatabase->SelectLimit($query, 1); if ($objCheck !== false) { if ($objCheck->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_market_settings` ( `id` , `name` , `value` , `description` , `type` )\n VALUES ( NULL , 'codeMode', '1', 'TXT_MARKET_SET_CODE_MODE', '2')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market_mail'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market_mail')); return false; } if (!isset($arrColumns['MAILTO'])) { $query = "ALTER TABLE `" . DBPREFIX . "module_market_mail` ADD `mailto` VARCHAR( 10 ) NOT NULL AFTER `content`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } /***************************************************************** * EXTENSION: New attributes 'color' and 'sort_id' for entries * * ADDED: Contrexx v2.1.0 * *****************************************************************/ $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_market'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_market')); return false; } if (!isset($arrColumns['SORT_ID'])) { $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `sort_id` INT( 4 ) NOT NULL DEFAULT '0' AFTER `paypal`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!isset($arrColumns['COLOR'])) { $query = "ALTER TABLE `" . DBPREFIX . "module_market` ADD `color` VARCHAR(50) NOT NULL DEFAULT '' AFTER `description`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } try { // delete obsolete table contrexx_module_market_access \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_market_access'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_market_spez_fields', array('id' => array('type' => 'INT(5)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(100)'), 'value' => array('type' => 'VARCHAR(100)'), 'type' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1'), 'lang_id' => array('type' => 'INT(2)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0'))); } catch (\Cx\Lib\UpdateException $e) { DBG::trace(); return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _dataUpdate() { global $objDatabase; $arrTables = $objDatabase->MetaTables('TABLES'); if (!sizeof($arrTables)) { return _databaseError("MetaTables('TABLES')", 'Could not read Table metadata'); } // Create neccessary tables if not present $tables = array('module_data_categories' => "CREATE TABLE `" . DBPREFIX . "module_data_categories` (\n `category_id` int(4) unsigned NOT NULL default '0',\n `lang_id` int(2) unsigned NOT NULL default '0',\n `is_active` enum('0','1') NOT NULL default '1',\n `parent_id` int(10) unsigned NOT NULL default '0',\n `name` varchar(100) NOT NULL default '',\n `active` enum('0','1') NOT NULL default '1',\n `cmd` int(10) unsigned NOT NULL default '1',\n `action` enum('content','overlaybox','subcategories') NOT NULL default 'content',\n `sort` int(10) unsigned NOT NULL default '1',\n `box_height` int(10) unsigned NOT NULL default '500',\n `box_width` int(11) NOT NULL default '350',\n `template` text NOT NULL,\n PRIMARY KEY (`category_id`,`lang_id`)\n ) ENGINE=InnoDB", 'module_data_message_to_category' => "CREATE TABLE `" . DBPREFIX . "module_data_message_to_category` (\n `message_id` int(6) unsigned NOT NULL default '0',\n `category_id` int(4) unsigned NOT NULL default '0',\n `lang_id` int(2) unsigned NOT NULL default '0',\n PRIMARY KEY (`message_id`,`category_id`,`lang_id`),\n KEY `category_id` (`category_id`)\n ) ENGINE=InnoDB", 'module_data_messages' => "CREATE TABLE `" . DBPREFIX . "module_data_messages` (\n `message_id` int(6) unsigned NOT NULL auto_increment,\n `user_id` int(5) unsigned NOT NULL default '0',\n `time_created` int(14) unsigned NOT NULL default '0',\n `time_edited` int(14) unsigned NOT NULL default '0',\n `hits` int(7) unsigned NOT NULL default '0',\n `active` enum('0','1') NOT NULL default '1',\n `sort` int(10) unsigned NOT NULL default '1',\n `mode` set('normal','forward') NOT NULL default 'normal',\n `release_time` int(15) NOT NULL default '0',\n `release_time_end` int(15) NOT NULL default '0',\n PRIMARY KEY (`message_id`)\n ) ENGINE=InnoDB", 'module_data_settings' => "CREATE TABLE `" . DBPREFIX . "module_data_settings` (\n `name` varchar(50) NOT NULL default '',\n `value` text NOT NULL,\n PRIMARY KEY (`name`)\n ) ENGINE=InnoDB"); /////////////////////////////////////////////////////////////////// // Create tables // /////////////////////////////////////////////////////////////////// foreach ($tables as $name => $query) { if (in_array(DBPREFIX . $name, $arrTables)) { continue; } if (!$objDatabase->Execute($query)) { return _databaseError($query, $objDatabase->ErrorMsg()); } // TODO: Unused // $installed[] = $name; } try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_data_placeholders', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'SET(\'cat\',\'entry\')', 'notnull' => true, 'default' => ''), 'ref_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'placeholder' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '')), array('placeholder' => array('fields' => array('placeholder'), 'type' => 'UNIQUE'), 'type' => array('fields' => array('type', 'ref_id'), 'type' => 'UNIQUE'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $settings_query = "\nINSERT INTO `" . DBPREFIX . "module_data_settings` (`name`, `value`) VALUES\n('data_block_activated', '0'),\n('data_block_messages', '3'),\n('data_comments_activated', '1'),\n('data_comments_anonymous', '1'),\n('data_comments_autoactivate', '1'),\n('data_comments_editor', 'wysiwyg'),\n('data_comments_notification', '1'),\n('data_comments_timeout', '30'),\n('data_entry_action', 'overlaybox'),\n('data_general_introduction', '150'),\n('data_rss_activated', '0'),\n('data_rss_comments', '10'),\n('data_rss_messages', '5'),\n('data_tags_hitlist', '5'),\n('data_target_cmd', '1'),\n('data_template_category',\n'<!-- BEGIN datalist_category -->\n<!-- this displays the category and the subcategories -->\n<div class=\\\"datalist_block\\\">\n<dl>\n <!-- BEGIN category -->\n <dt class=\\\"cattitle\\\"><div class=\\\"bg\\\"><h4>[[CATTITLE]]</h4></div></dt>\n <dd class=\\\"catcontent\\\">\n <dl>\n <!-- BEGIN entry -->\n <dt>[[TITLE]]</dt>\n <dd>\n [[IMAGE]] [[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]] [[TARGET]]>[[TXT_MORE]]</a>\n <br style=\\\"clear: both;\\\" />\n </dd>\n <!-- END entry -->\n </dl>\n </dd>\n <!-- END category -->\n</dl>\n</div>\n<!-- END datalist_category -->\n<!-- BEGIN datalist_single_category-->\n<!-- this displays just the entries of the category -->\n<div class=\\\"datalist_block\\\">\n<dl>\n <!-- BEGIN single_entry -->\n <dt class=\\\"cattitle\\\"><div class=\\\"bg\\\"><h4>[[TITLE]]</h4></div></dt>\n <dd class=\\\"catcontent2\\\">\n [[IMAGE]] <p>[[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]] [[TARGET]]>[[TXT_MORE]]</a></p>\n <div style=\\\"clear: both;\\\" />\n </dd>\n <!-- END single_entry -->\n</dl>\n</div>\n<!-- END datalist_single_category -->\n'),\n('data_template_entry',\n'<!-- BEGIN datalist_entry-->\n<div class=\\\"datalist_block\\\">\n<dl>\n <dt>[[TITLE]]</dt>\n <dd>\n [[IMAGE]] [[CONTENT]] <a href=\\\"[[HREF]]\\\" [[CLASS]]>[[TXT_MORE]]</a>\n <br style=\\\"clear: both;\\\" />\n </dd>\n</dl>\n</div>\n<!-- END datalist_entry -->\n '),\n('data_template_thickbox',\n'<!-- BEGIN thickbox -->\n<dl class=\\\"data_module\\\">\n <dt><h6 style=\\\"margin-bottom:10px;\\\">[[TITLE]]</h6></dt>\n <dd style=\\\"clear:left;\\\">\n <!-- BEGIN image -->\n <img src=\\\"[[PICTURE]]\\\" style=\\\"float: left; margin-right: 5px;\\\" />\n <!-- END image -->\n [[CONTENT]]\n <!-- BEGIN attachment -->\n <img src=\\\"/themes/default/images/arrow.gif\\\" width=\\\"16\\\" height=\\\"8\\\" />\n <a href=\\\"javascript:void(0);\\\" onclick=\\\"window.open(\\'[[HREF]]\\', \\'attachment\\');\\\">[[TXT_DOWNLOAD]]</a>\n <!-- END attachment -->\n </dd>\n</dl>\n<!--<br /><img src=\\\"/themes/default/images/arrow.gif\\\" width=\\\"16\\\" height=\\\"8\\\" /><a onclick=\\\"Javascript:window.print();\\\" style=\\\"cursor:pointer;\\\">Drucken</a>-->\n<!-- END thickbox -->\n'),\n('data_thickbox_height', '450'),\n('data_thickbox_width', '400'),\n('data_voting_activated', '0');\n"; /////////////////////////////////////////////////////////////////// // data module settings // /////////////////////////////////////////////////////////////////// $query = "SELECT COUNT(*) AS recordcount FROM `" . DBPREFIX . "module_data_settings`"; $objResult = $objDatabase->Execute($query); if ($objResult === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } if ($objResult->fields['recordcount'] == 0) { // module_data_settings table is empty. Fill it with default data. if (!$objDatabase->Execute($settings_query)) { return _databaseError($settings_query, $objDatabase->ErrorMsg()); } } /********************************************************* * EXTENSION: Thunbmail Image & Attachment description * * ADDED: Contrexx v2.1.0 * *********************************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_data_messages_lang', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'default' => '1'), 'subject' => array('type' => 'VARCHAR(250)', 'default' => ''), 'content' => array('type' => 'text'), 'tags' => array('type' => 'VARCHAR(250)', 'default' => ''), 'image' => array('type' => 'VARCHAR(250)', 'default' => ''), 'thumbnail' => array('type' => 'VARCHAR(250)'), 'thumbnail_type' => array('type' => 'ENUM(\'original\',\'thumbnail\')', 'default' => 'original', 'after' => 'thumbnail'), 'thumbnail_width' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'thumbnail_height' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'attachment' => array('type' => 'VARCHAR(255)', 'default' => ''), 'attachment_description' => array('type' => 'VARCHAR(255)', 'default' => ''), 'mode' => array('type' => 'SET(\'normal\',\'forward\')', 'default' => 'normal'), 'forward_url' => array('type' => 'VARCHAR(255)', 'default' => ''), 'forward_target' => array('type' => 'VARCHAR(40)', 'notnull' => false)), array(), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _votingUpdate() { try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_system', array('id' => array('type' => 'INT', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'date' => array('type' => 'TIMESTAMP', 'notnull' => true, 'default_expr' => 'CURRENT_TIMESTAMP'), 'title' => array('type' => 'VARCHAR(60)', 'notnull' => true, 'default' => '', 'renamefrom' => 'name'), 'question' => array('type' => 'TEXT', 'notnull' => false), 'status' => array('type' => 'TINYINT(1)', 'notnull' => false, 'default' => 1), 'votes' => array('type' => 'INT(11)', 'notnull' => false, 'default' => 0), 'submit_check' => array('type' => "ENUM('cookie','email')", 'notnull' => true, 'default' => 'cookie'), 'additional_nickname' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_forename' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_surname' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_phone' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_street' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_zip' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_email' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_city' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0), 'additional_comment' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_additionaldata', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'nickname' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => '', 'renamefrom' => 'name'), 'surname' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'phone' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'street' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'zip' => array('type' => 'VARCHAR(30)', 'notnull' => true, 'default' => ''), 'city' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'email' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => ''), 'comment' => array('type' => 'TEXT', 'after' => 'email'), 'voting_system_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'renamefrom' => 'voting_sytem_id'), 'date_entered' => array('type' => 'TIMESTAMP', 'notnull' => true, 'default_expr' => 'CURRENT_TIMESTAMP', 'on_update' => 'CURRENT_TIMESTAMP'), 'forename' => array('type' => 'VARCHAR(80)', 'notnull' => true, 'default' => '')), array('voting_system_id' => array('fields' => array('voting_system_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_email', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'email' => array('type' => 'VARCHAR(255)'), 'valid' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0')), array('email' => array('fields' => array('email'), 'type' => 'UNIQUE'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'voting_rel_email_system', array('email_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'system_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'voting_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'valid' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0')), array('email_id' => array('fields' => array('email_id', 'system_id'), 'type' => 'UNIQUE'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _auctionUpdate() { try { // delete obsolete table contrexx_module_auction_access \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_auction_access'); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. DBG::trace(); return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _searchUpdate() { /********************************************************* * EXTENSION: Change name of HTML_Template_Sigma block * * ADDED: Contrexx v3.0.0 * *********************************************************/ try { \Cx\Lib\UpdateUtil::migrateContentPage('search', null, 'searchrow', 'search_result', '3.0.0'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _downloadsUpdate() { global $objDatabase, $_ARRAYLANG, $_CORELANG; try { \Cx\Lib\UpdateUtil::sql("UPDATE " . DBPREFIX . "module_downloads_download_locale l SET\n l.source = (SELECT source FROM " . DBPREFIX . "module_downloads_download d WHERE d.id = l.download_id),\n l.source_name = (SELECT source_name FROM " . DBPREFIX . "module_downloads_download d WHERE d.id = l.download_id);"); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file', 'after' => 'id'), 'mime_type' => array('type' => 'ENUM(\'image\',\'document\',\'pdf\',\'media\',\'archive\',\'application\',\'link\')', 'notnull' => true, 'default' => 'image', 'after' => 'type'), 'icon' => array('type' => 'ENUM(\'_blank\',\'avi\',\'bmp\',\'css\',\'doc\',\'dot\',\'exe\',\'fla\',\'gif\',\'htm\',\'html\',\'inc\',\'jpg\',\'js\',\'mp3\',\'nfo\',\'pdf\',\'php\',\'png\',\'pps\',\'ppt\',\'rar\',\'swf\',\'txt\',\'wma\',\'xls\',\'zip\')', 'notnull' => true, 'default' => '_blank', 'after' => 'source_name'), 'size' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'icon'), 'image' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'size'), 'owner_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'image'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'owner_id'), 'license' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'access_id'), 'version' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => '', 'after' => 'license'), 'author' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'version'), 'website' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'author'), 'ctime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'website'), 'mtime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'ctime'), 'is_active' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'mtime'), 'visibility' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'is_active'), 'order' => array('type' => 'INT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'visibility'), 'views' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'order'), 'download_count' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'views'), 'expiration' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'download_count'), 'validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'expiration')), array('is_active' => array('fields' => array('is_active')), 'visibility' => array('fields' => array('visibility')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download_locale', array('lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'download_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'lang_id'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'download_id'), 'source' => array('type' => 'VARCHAR(255)', 'after' => 'name'), 'source_name' => array('type' => 'VARCHAR(255)', 'after' => 'source'), 'description' => array('type' => 'text', 'after' => 'source_name')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'), 'description' => array('fields' => array('description'), 'type' => 'FULLTEXT'))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _galleryUpdate() { global $objDatabase, $_ARRAYLANG; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_categories', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'pid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6)', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'comment' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'voting' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'backendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'backend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontendProtected' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'frontend_access_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_gallery_pictures', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'catid' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'validated' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'status' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'catimg' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'sorting' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'default' => '999'), 'size_show' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'path' => array('type' => 'TEXT', 'notnull' => true), 'link' => array('type' => 'TEXT', 'notnull' => true), 'lastedit' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0'), 'size_type' => array('type' => "SET('abs', 'proz')", 'notnull' => true, 'default' => 'proz'), 'size_proz' => array('type' => "INT(3)", 'notnull' => true, 'default' => '0'), 'size_abs_h' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'size_abs_w' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'quality' => array('type' => 'TINYINT(3)', 'notnull' => true, 'default' => '0')), array('galleryPicturesIndex' => array('type' => 'FULLTEXT', 'fields' => array('path')))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $arrSettings = array('1' => array('name' => 'max_images_upload', 'value' => '10'), '2' => array('name' => 'standard_quality', 'value' => '95'), '3' => array('name' => 'standard_size_proz', 'value' => '25'), '4' => array('name' => 'standard_width_abs', 'value' => '140'), '6' => array('name' => 'standard_height_abs', 'value' => '0'), '7' => array('name' => 'standard_size_type', 'value' => 'abs'), '8' => array('name' => 'validation_show_limit', 'value' => '10'), '9' => array('name' => 'validation_standard_type', 'value' => 'all'), '11' => array('name' => 'show_names', 'value' => 'off'), '12' => array('name' => 'quality', 'value' => '95'), '13' => array('name' => 'show_comments', 'value' => 'off'), '14' => array('name' => 'show_voting', 'value' => 'off'), '15' => array('name' => 'enable_popups', 'value' => 'on'), '16' => array('name' => 'image_width', 'value' => '1200'), '17' => array('name' => 'paging', 'value' => '30'), '18' => array('name' => 'show_latest', 'value' => 'on'), '19' => array('name' => 'show_random', 'value' => 'on'), '20' => array('name' => 'header_type', 'value' => 'hierarchy'), '21' => array('name' => 'show_ext', 'value' => 'off'), '22' => array('name' => 'show_file_name', 'value' => 'on'), '23' => array('name' => 'slide_show', 'value' => 'slideshow'), '24' => array('name' => 'slide_show_seconds', 'value' => '3')); foreach ($arrSettings as $id => $arrSetting) { $query = "SELECT 1 FROM `" . DBPREFIX . "module_gallery_settings` WHERE `name`= '" . $arrSetting['name'] . "'"; if (($objRS = $objDatabase->Execute($query)) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } if ($objRS->RecordCount() == 0) { $query = "\n INSERT INTO `" . DBPREFIX . "module_gallery_settings` (`id`, `name`, `value`)\n VALUES (" . $id . ", '" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')\n ON DUPLICATE KEY UPDATE `id` = `id`\n "; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } /************************************************************************** * EXTENSION: cleanup: delete translations, comments and * * votes of inexisting pictures * * ADDED: Contrexx v3.0.1 * **************************************************************************/ try { \Cx\Lib\UpdateUtil::sql(' DELETE `language_pics` FROM `' . DBPREFIX . 'module_gallery_language_pics` as `language_pics` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `language_pics`.`picture_id` WHERE `pictures`.`id` IS NULL '); \Cx\Lib\UpdateUtil::sql(' DELETE `comments` FROM `' . DBPREFIX . 'module_gallery_comments` as `comments` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `comments`.`picid` WHERE `pictures`.`id` IS NULL '); \Cx\Lib\UpdateUtil::sql(' DELETE `votes` FROM `' . DBPREFIX . 'module_gallery_votes` as `votes` LEFT JOIN `' . DBPREFIX . 'module_gallery_pictures` as `pictures` ON `pictures`.`id` = `votes`.`picid` WHERE `pictures`.`id` IS NULL '); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // remove the script tag at the beginning of the gallery page \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'gallery'), '/^\\s*(<script[^>]+>.+?Shadowbox.+?<\\/script>)+/sm', '', array('content'), '3.0.3'); return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _updateModules() { global $objDatabase; $arrModules = getModules(); try { \Cx\Lib\UpdateUtil::sql('TRUNCATE TABLE `' . DBPREFIX . 'modules`'); // NOTE: scheme migration is done in core/core.php // add modules foreach ($arrModules as $arrModule) { \Cx\Lib\UpdateUtil::sql("INSERT INTO " . DBPREFIX . "modules ( `id` , `name` , `description_variable` , `status` , `is_required` , `is_core` , `is_active`, `distributor` ) VALUES ( " . $arrModule['id'] . " , '" . $arrModule['name'] . "', '" . $arrModule['description_variable'] . "', '" . $arrModule['status'] . "', '" . $arrModule['is_required'] . "', '" . $arrModule['is_core'] . "', " . $arrModule['is_active'] . ", 'Comvation AG') ON DUPLICATE KEY UPDATE `id` = `id`"); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _updateBackendAreas() { global $objDatabase, $objUpdate, $_CONFIG; $arrBackendAreas = array(array('area_id' => 1, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_CONTENT_MANAGEMENT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 2, 'access_id' => 1), array('area_id' => 2, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_MODULE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 6, 'access_id' => 2), array('area_id' => 3, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_ADMINISTRATION', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 8, 'access_id' => 3), array('area_id' => 8, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_CORE_ECOMMERCE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 4, 'access_id' => 4), array('area_id' => 15, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_CORE_MEDIA', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 3, 'access_id' => 162), array('area_id' => 28, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_CORE_STATS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 7, 'access_id' => 163), array('area_id' => 29, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_CORE_EMAIL_MARKETING', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 5, 'access_id' => 152), array('area_id' => 188, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'Nettools', 'is_active' => 1, 'uri' => 'index.php?cmd=nettools', 'target' => '_self', 'module_id' => 32, 'order_id' => 0, 'access_id' => 0), array('area_id' => 177, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'global', 'area_name' => 'Json Adapter', 'is_active' => 1, 'uri' => 'index.php?cmd=jsondata', 'target' => '_self', 'module_id' => 63, 'order_id' => 0, 'access_id' => 0), array('area_id' => 178, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'global', 'area_name' => 'File Browser', 'is_active' => 1, 'uri' => 'index.php?cmd=fileBrowser', 'target' => '_self', 'module_id' => 26, 'order_id' => 0, 'access_id' => 0), array('area_id' => 180, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_SEARCH', 'is_active' => 1, 'uri' => 'index.php?cmd=search', 'target' => '_self', 'module_id' => 5, 'order_id' => 0, 'access_id' => 0), array('area_id' => 181, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_UPLOAD', 'is_active' => 1, 'uri' => 'index.php?cmd=upload', 'target' => '_self', 'module_id' => 52, 'order_id' => 0, 'access_id' => 0), array('area_id' => 183, 'parent_area_id' => 0, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_LOGOUT', 'is_active' => 1, 'uri' => 'index.php?cmd=logout', 'target' => '_self', 'module_id' => 67, 'order_id' => 0, 'access_id' => 0), array('area_id' => 184, 'parent_area_id' => 0, 'type' => 'group', 'scope' => 'backend', 'area_name' => 'TXT_HOME', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 0), array('area_id' => 5, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_NEW_PAGE', 'is_active' => 1, 'uri' => 'index.php?cmd=content&act=new', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 5), array('area_id' => 6, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CONTENT_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=content', 'target' => '_self', 'module_id' => 1, 'order_id' => 2, 'access_id' => 6), array('area_id' => 10, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_NEWS_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=news', 'target' => '_self', 'module_id' => 8, 'order_id' => 4, 'access_id' => 10), array('area_id' => 75, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CONTENT_HISTORY', 'is_active' => 1, 'uri' => 'index.php?cmd=workflow', 'target' => '_self', 'module_id' => 1, 'order_id' => 3, 'access_id' => 75), array('area_id' => 76, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_BLOCK_SYSTEM', 'is_active' => 1, 'uri' => 'index.php?cmd=block', 'target' => '_self', 'module_id' => 7, 'order_id' => 7, 'access_id' => 76), array('area_id' => 90, 'parent_area_id' => 1, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CONTACTS', 'is_active' => 1, 'uri' => 'index.php?cmd=contact', 'target' => '_self', 'module_id' => 6, 'order_id' => 5, 'access_id' => 84), array('area_id' => 9, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_GUESTBOOK', 'is_active' => 1, 'uri' => 'index.php?cmd=guestbook', 'target' => '_self', 'module_id' => 10, 'order_id' => 0, 'access_id' => 9), array('area_id' => 11, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DOC_SYS_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=docsys', 'target' => '_self', 'module_id' => 19, 'order_id' => 0, 'access_id' => 11), array('area_id' => 12, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_THUMBNAIL_GALLERY', 'is_active' => 1, 'uri' => 'index.php?cmd=gallery', 'target' => '_self', 'module_id' => 3, 'order_id' => 0, 'access_id' => 12), array('area_id' => 14, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_VOTING', 'is_active' => 1, 'uri' => 'index.php?cmd=voting', 'target' => '_self', 'module_id' => 17, 'order_id' => 0, 'access_id' => 14), array('area_id' => 16, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CALENDAR', 'is_active' => 1, 'uri' => 'index.php?cmd=calendar', 'target' => '_self', 'module_id' => 21, 'order_id' => 0, 'access_id' => 16), array('area_id' => 27, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_NEWS_SYNDICATION', 'is_active' => 1, 'uri' => 'index.php?cmd=feed', 'target' => '_self', 'module_id' => 22, 'order_id' => 0, 'access_id' => 27), array('area_id' => 59, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_LINKS_MODULE_DESCRIPTION', 'is_active' => 1, 'uri' => 'index.php?cmd=directory', 'target' => '_self', 'module_id' => 12, 'order_id' => 0, 'access_id' => 59), array('area_id' => 64, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_RECOMMEND', 'is_active' => 1, 'uri' => 'index.php?cmd=recommend', 'target' => '_self', 'module_id' => 27, 'order_id' => 0, 'access_id' => 64), array('area_id' => 82, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_LIVECAM', 'is_active' => 1, 'uri' => 'index.php?cmd=livecam', 'target' => '_self', 'module_id' => 30, 'order_id' => 0, 'access_id' => 82), array('area_id' => 89, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_MEMBERDIR', 'is_active' => 1, 'uri' => 'index.php?cmd=memberdir', 'target' => '_self', 'module_id' => 31, 'order_id' => 0, 'access_id' => 83), array('area_id' => 93, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_PODCAST', 'is_active' => 1, 'uri' => 'index.php?cmd=podcast', 'target' => '_self', 'module_id' => 35, 'order_id' => 0, 'access_id' => 87), array('area_id' => 98, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_MARKET_MODULE_DESCRIPTION', 'is_active' => 1, 'uri' => 'index.php?cmd=market', 'target' => '_self', 'module_id' => 33, 'order_id' => 0, 'access_id' => 98), array('area_id' => 106, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_FORUM', 'is_active' => 1, 'uri' => 'index.php?cmd=forum', 'target' => '_self', 'module_id' => 20, 'order_id' => 0, 'access_id' => 106), array('area_id' => 109, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_EGOVERNMENT', 'is_active' => 1, 'uri' => 'index.php?cmd=egov', 'target' => '_self', 'module_id' => 38, 'order_id' => 0, 'access_id' => 109), array('area_id' => 119, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog', 'target' => '_self', 'module_id' => 47, 'order_id' => 0, 'access_id' => 119), array('area_id' => 128, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DATA_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=data', 'target' => '_self', 'module_id' => 48, 'order_id' => 0, 'access_id' => 146), array('area_id' => 130, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_ECARD', 'is_active' => 1, 'uri' => 'index.php?cmd=ecard', 'target' => '_self', 'module_id' => 49, 'order_id' => 0, 'access_id' => 151), array('area_id' => 134, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_U2U_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=u2u', 'target' => '_self', 'module_id' => 54, 'order_id' => 0, 'access_id' => 149), array('area_id' => 135, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE', 'is_active' => 1, 'uri' => 'index.php?cmd=knowledge', 'target' => '_self', 'module_id' => 56, 'order_id' => 0, 'access_id' => 129), array('area_id' => 141, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_JOBS_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=jobs', 'target' => '_self', 'module_id' => 57, 'order_id' => 0, 'access_id' => 148), array('area_id' => 153, 'parent_area_id' => 2, 'type' => 'navigation', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=mediadir', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 153), array('area_id' => 163, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SYSTEM_LOGS', 'is_active' => 1, 'uri' => 'index.php?cmd=log', 'target' => '_self', 'module_id' => 1, 'order_id' => 10, 'access_id' => 55), array('area_id' => 17, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SYSTEM_SETTINGS', 'is_active' => 1, 'uri' => 'index.php?cmd=settings', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 17), array('area_id' => 18, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_USER_ADMINISTRATION', 'is_active' => 1, 'uri' => 'index.php?cmd=access', 'target' => '_self', 'module_id' => 1, 'order_id' => 3, 'access_id' => 18), array('area_id' => 20, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DATABASE_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=dbm', 'target' => '_self', 'module_id' => 1, 'order_id' => 8, 'access_id' => 20), array('area_id' => 21, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DESIGN_MANAGEMENT', 'is_active' => 1, 'uri' => 'index.php?cmd=skins', 'target' => '_self', 'module_id' => 1, 'order_id' => 4, 'access_id' => 21), array('area_id' => 22, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_LANGUAGE_SETTINGS', 'is_active' => 1, 'uri' => 'index.php?cmd=language', 'target' => '_self', 'module_id' => 64, 'order_id' => 5, 'access_id' => 22), array('area_id' => 23, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_MODULE_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=modulemanager', 'target' => '_self', 'module_id' => 1, 'order_id' => 6, 'access_id' => 23), array('area_id' => 24, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SERVER_INFO', 'is_active' => 1, 'uri' => 'index.php?cmd=server', 'target' => '_self', 'module_id' => 1, 'order_id' => 9, 'access_id' => 24), array('area_id' => 110, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_ALIAS_ADMINISTRATION', 'is_active' => 1, 'uri' => 'index.php?cmd=alias', 'target' => '_self', 'module_id' => 41, 'order_id' => 7, 'access_id' => 115), array('area_id' => 182, 'parent_area_id' => 3, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_LICENSE', 'is_active' => 1, 'uri' => 'index.php?cmd=license', 'target' => '_self', 'module_id' => 66, 'order_id' => 2, 'access_id' => 0), array('area_id' => 127, 'parent_area_id' => 5, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_NEW_PAGE_ON_FIRST_LEVEL', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 127), array('area_id' => 26, 'parent_area_id' => 6, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DELETE_PAGES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 26), array('area_id' => 35, 'parent_area_id' => 6, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_EDIT_PAGES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 35), array('area_id' => 36, 'parent_area_id' => 6, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_ACCESS_CONTROL', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 36), array('area_id' => 53, 'parent_area_id' => 6, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_COPY_DELETE_SITES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 53), array('area_id' => 161, 'parent_area_id' => 6, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_MOVE_NODE', 'is_active' => 1, 'uri' => 'index.php?cmd=content', 'target' => '_self', 'module_id' => 1, 'order_id' => 8, 'access_id' => 160), array('area_id' => 38, 'parent_area_id' => 7, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_MODIFY_MEDIA_FILES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 38), array('area_id' => 39, 'parent_area_id' => 7, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_UPLOAD_MEDIA_FILES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 39), array('area_id' => 13, 'parent_area_id' => 8, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SHOP', 'is_active' => 1, 'uri' => 'index.php?cmd=shop', 'target' => '_self', 'module_id' => 16, 'order_id' => 1, 'access_id' => 13), array('area_id' => 162, 'parent_area_id' => 8, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CHECKOUT_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=checkout', 'target' => '_self', 'module_id' => 62, 'order_id' => 2, 'access_id' => 161), array('area_id' => 152, 'parent_area_id' => 10, 'type' => 'function', 'scope' => 'frontend', 'area_name' => 'TXT_SUBMIT_NEWS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 8, 'order_id' => 0, 'access_id' => 61), array('area_id' => 65, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_OVERVIEW', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 1, 'access_id' => 65), array('area_id' => 66, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_NEW_CATEGORY', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 2, 'access_id' => 66), array('area_id' => 67, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_UPLOAD', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 3, 'access_id' => 67), array('area_id' => 68, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_IMPORT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 4, 'access_id' => 68), array('area_id' => 69, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_VALIDATE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 5, 'access_id' => 69), array('area_id' => 70, 'parent_area_id' => 12, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_GALLERY_MENU_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 3, 'order_id' => 6, 'access_id' => 70), array('area_id' => 7, 'parent_area_id' => 15, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_MEDIA_MANAGER', 'is_active' => 1, 'uri' => 'index.php?cmd=media&archive=archive1', 'target' => '_self', 'module_id' => 1, 'order_id' => 2, 'access_id' => 7), array('area_id' => 32, 'parent_area_id' => 15, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_IMAGE_ADMINISTRATION', 'is_active' => 1, 'uri' => 'index.php?cmd=media&archive=content', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 32), array('area_id' => 132, 'parent_area_id' => 15, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DOWNLOADS', 'is_active' => 1, 'uri' => 'index.php?cmd=downloads', 'target' => '_self', 'module_id' => 53, 'order_id' => 4, 'access_id' => 141), array('area_id' => 187, 'parent_area_id' => 15, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_FILESHARING_MODULE', 'is_active' => 1, 'uri' => 'index.php?cmd=media&archive=filesharing', 'target' => '_self', 'module_id' => 68, 'order_id' => 3, 'access_id' => 8), array('area_id' => 144, 'parent_area_id' => 16, 'type' => 'function', 'scope' => 'frontend', 'area_name' => 'TXT_ACCESS_COMMUNITY_EVENTS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 21, 'order_id' => 0, 'access_id' => 145), array('area_id' => 31, 'parent_area_id' => 18, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_EDIT_USERINFOS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 31), array('area_id' => 40, 'parent_area_id' => 19, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 40), array('area_id' => 41, 'parent_area_id' => 20, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DBM_MAINTENANCE_TITLE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 41), array('area_id' => 46, 'parent_area_id' => 21, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_ACTIVATE_SKINS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 46), array('area_id' => 47, 'parent_area_id' => 21, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_EDIT_SKINS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 47), array('area_id' => 92, 'parent_area_id' => 21, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_THEME_IMPORT_EXPORT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 102), array('area_id' => 48, 'parent_area_id' => 22, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_EDIT_LANGUAGE_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 48), array('area_id' => 49, 'parent_area_id' => 22, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DELETE_LANGUAGES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 49), array('area_id' => 50, 'parent_area_id' => 22, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_LANGUAGE_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 50), array('area_id' => 51, 'parent_area_id' => 23, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_REGISTER_MODULES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 51), array('area_id' => 52, 'parent_area_id' => 23, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_INST_REMO_MODULES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 0, 'access_id' => 52), array('area_id' => 166, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_VISITOR_DETAILS', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=visitors', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 166), array('area_id' => 164, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_VISITORS_AND_PAGE_VIEWS', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=requests', 'target' => '_self', 'module_id' => 1, 'order_id' => 2, 'access_id' => 164), array('area_id' => 167, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_REFERER', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=referer', 'target' => '_self', 'module_id' => 1, 'order_id' => 3, 'access_id' => 167), array('area_id' => 168, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_SEARCH_ENGINES', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=spiders', 'target' => '_self', 'module_id' => 1, 'order_id' => 4, 'access_id' => 168), array('area_id' => 169, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_SEARCH_TERMS', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=search', 'target' => '_self', 'module_id' => 1, 'order_id' => 5, 'access_id' => 169), array('area_id' => 170, 'parent_area_id' => 28, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SETTINGS', 'is_active' => 1, 'uri' => 'index.php?cmd=stats&stat=settings', 'target' => '_self', 'module_id' => 1, 'order_id' => 6, 'access_id' => 170), array('area_id' => 172, 'parent_area_id' => 29, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_LISTS', 'is_active' => 1, 'uri' => 'index.php?cmd=newsletter&act=lists', 'target' => '_self', 'module_id' => 4, 'order_id' => 2, 'access_id' => 172), array('area_id' => 171, 'parent_area_id' => 29, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_EMAIL_CAMPAIGNS', 'is_active' => 1, 'uri' => 'index.php?cmd=newsletter&act=mails', 'target' => '_self', 'module_id' => 4, 'order_id' => 1, 'access_id' => 171), array('area_id' => 174, 'parent_area_id' => 29, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_RECIPIENTS', 'is_active' => 1, 'uri' => 'index.php?cmd=newsletter&act=users', 'target' => '_self', 'module_id' => 4, 'order_id' => 4, 'access_id' => 174), array('area_id' => 175, 'parent_area_id' => 29, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_CORE_NEWS', 'is_active' => 1, 'uri' => 'index.php?cmd=newsletter&act=news', 'target' => '_self', 'module_id' => 4, 'order_id' => 5, 'access_id' => 175), array('area_id' => 176, 'parent_area_id' => 29, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_SETTINGS', 'is_active' => 1, 'uri' => 'index.php?cmd=newsletter&act=dispatch', 'target' => '_self', 'module_id' => 4, 'order_id' => 6, 'access_id' => 176), array('area_id' => 145, 'parent_area_id' => 59, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_ADD_FILES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 12, 'order_id' => 0, 'access_id' => 96), array('area_id' => 146, 'parent_area_id' => 59, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MANAGE_FILES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 12, 'order_id' => 1, 'access_id' => 94), array('area_id' => 147, 'parent_area_id' => 59, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_MANAGE_CONFIGURATION', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 12, 'order_id' => 2, 'access_id' => 92), array('area_id' => 148, 'parent_area_id' => 59, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_CATEGORY_AND_LEVEL_MANAGEMENT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 12, 'order_id' => 3, 'access_id' => 97), array('area_id' => 77, 'parent_area_id' => 75, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DELETED_RESTORE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 1, 'access_id' => 77), array('area_id' => 78, 'parent_area_id' => 75, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_WORKFLOW_VALIDATE', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 0, 'order_id' => 1, 'access_id' => 78), array('area_id' => 91, 'parent_area_id' => 90, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_CONTACT_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 6, 'order_id' => 0, 'access_id' => 85), array('area_id' => 149, 'parent_area_id' => 98, 'type' => 'function', 'scope' => 'frontend', 'area_name' => 'TXT_ADD_ADVERTISEMENT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 33, 'order_id' => 0, 'access_id' => 99), array('area_id' => 150, 'parent_area_id' => 98, 'type' => 'function', 'scope' => 'frontend', 'area_name' => 'TXT_MODIFY_ADVERTISEMENT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 33, 'order_id' => 1, 'access_id' => 100), array('area_id' => 151, 'parent_area_id' => 98, 'type' => 'function', 'scope' => 'frontend', 'area_name' => 'TXT_DELETE_ADVERTISEMENT', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 33, 'order_id' => 2, 'access_id' => 101), array('area_id' => 107, 'parent_area_id' => 106, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_FORUM_MENU_CATEGORIES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 20, 'order_id' => 1, 'access_id' => 107), array('area_id' => 108, 'parent_area_id' => 106, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_FORUM_MENU_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 20, 'order_id' => 2, 'access_id' => 108), array('area_id' => 120, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_ENTRY_MANAGE_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=manageEntry', 'target' => '_self', 'module_id' => 47, 'order_id' => 1, 'access_id' => 120), array('area_id' => 121, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_ENTRY_ADD_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=addEntry', 'target' => '_self', 'module_id' => 47, 'order_id' => 2, 'access_id' => 121), array('area_id' => 122, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_CATEGORY_MANAGE_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=manageCategory', 'target' => '_self', 'module_id' => 47, 'order_id' => 3, 'access_id' => 122), array('area_id' => 123, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_CATEGORY_ADD_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=addCategory', 'target' => '_self', 'module_id' => 47, 'order_id' => 4, 'access_id' => 123), array('area_id' => 124, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_SETTINGS_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=settings', 'target' => '_self', 'module_id' => 47, 'order_id' => 6, 'access_id' => 124), array('area_id' => 125, 'parent_area_id' => 119, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_BLOG_NETWORKS_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=blog&act=networks', 'target' => '_self', 'module_id' => 47, 'order_id' => 5, 'access_id' => 125), array('area_id' => 129, 'parent_area_id' => 128, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DATA_ENTRY_MANAGE_TITLE', 'is_active' => 1, 'uri' => 'index.php?cmd=data&act=manageEntry', 'target' => '_self', 'module_id' => 48, 'order_id' => 1, 'access_id' => 147), array('area_id' => 133, 'parent_area_id' => 132, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_DOWNLOADS_ADMINISTER', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 53, 'order_id' => 1, 'access_id' => 142), array('area_id' => 136, 'parent_area_id' => 135, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE_ACCESS_OVERVIEW', 'is_active' => 1, 'uri' => 'index.php?cmd=knowledge§ion=articles', 'target' => '_self', 'module_id' => 56, 'order_id' => 1, 'access_id' => 130), array('area_id' => 137, 'parent_area_id' => 135, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE_ACCESS_EDIT_ARTICLES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 56, 'order_id' => 2, 'access_id' => 131), array('area_id' => 138, 'parent_area_id' => 135, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE_ACCESS_CATEGORIES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 56, 'order_id' => 3, 'access_id' => 132), array('area_id' => 139, 'parent_area_id' => 135, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE_ACCESS_EDIT_CATEGORIES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 56, 'order_id' => 4, 'access_id' => 133), array('area_id' => 140, 'parent_area_id' => 135, 'type' => 'function', 'scope' => 'backend', 'area_name' => 'TXT_KNOWLEDGE_ACCESS_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 56, 'order_id' => 5, 'access_id' => 134), array('area_id' => 154, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_ADD_ENTRY', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 154), array('area_id' => 155, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_MODIFY_ENTRY', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 155), array('area_id' => 156, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_MANAGE_LEVELS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 156), array('area_id' => 157, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_MANAGE_CATEGORIES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 157), array('area_id' => 158, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_INTERFACES', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 158), array('area_id' => 160, 'parent_area_id' => 153, 'type' => 'function', 'scope' => 'global', 'area_name' => 'TXT_MEDIADIR_SETTINGS', 'is_active' => 1, 'uri' => '', 'target' => '_self', 'module_id' => 60, 'order_id' => 0, 'access_id' => 159), array('area_id' => 185, 'parent_area_id' => 184, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_DASHBOARD', 'is_active' => 1, 'uri' => 'index.php', 'target' => '_self', 'module_id' => 1, 'order_id' => 1, 'access_id' => 0), array('area_id' => 186, 'parent_area_id' => 184, 'type' => 'navigation', 'scope' => 'backend', 'area_name' => 'TXT_FRONTEND', 'is_active' => 1, 'uri' => '../index.php', 'target' => '_blank', 'module_id' => 1, 'order_id' => 2, 'access_id' => 0)); $objDatabase->Execute("TRUNCATE TABLE " . DBPREFIX . "backend_areas"); // add backend areas foreach ($arrBackendAreas as $arrBackendArea) { $query = "INSERT INTO " . DBPREFIX . "backend_areas (`area_id`, `parent_area_id` , `type` , `scope`, `area_name` , `is_active` , `uri` , `target` , `module_id` , `order_id` , `access_id`\n\t\t\t) VALUES (\n\t\t\t" . $arrBackendArea['area_id'] . ", '" . $arrBackendArea['parent_area_id'] . "', '" . $arrBackendArea['type'] . "', '" . $arrBackendArea['scope'] . "', '" . $arrBackendArea['area_name'] . "', '" . $arrBackendArea['is_active'] . "', '" . $arrBackendArea['uri'] . "', '" . $arrBackendArea['target'] . "', '" . $arrBackendArea['module_id'] . "', '" . $arrBackendArea['order_id'] . "', '" . $arrBackendArea['access_id'] . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } // add permission to stats settings if the user had permission to stats if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { try { $result = \Cx\Lib\UpdateUtil::sql("SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE access_id = 163 GROUP BY `group_id`"); if ($result !== false) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`)\n VALUES (170, " . intval($result->fields['group_id']) . ")"); $result->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /*************************************************** * BUGFIX: Clean up duplicate usage of access ids * ***************************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.2')) { $arrAccessIds = array(116 => 145, 122 => 146, 123 => 147, 140 => 148, 141 => 149); $query = 'SELECT `group_id`, `access_id` FROM `' . DBPREFIX . 'access_group_static_ids` WHERE `access_id` IN (' . implode(',', array_keys($arrAccessIds)) . ')'; $objResult = $objDatabase->Execute($query); if ($objResult) { while (!$objResult->EOF) { $query = 'INSERT IGNORE INTO `' . DBPREFIX . 'access_group_static_ids` (`access_id`, `group_id`) VALUES (' . $arrAccessIds[$objResult->fields['access_id']] . ', ' . $objResult->fields['group_id'] . ')'; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } $objResult->MoveNext(); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } return true; }
function _u2uUpdate() { global $objDatabase; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_address_list', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'buddies_id' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0')), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_message_log', array('message_id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'message_text' => array('type' => 'TEXT', 'notnull' => true), 'message_title' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_sent_messages', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'message_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'receiver_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'mesage_open_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'date_time' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00')), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(50)'), 'value' => array('type' => 'TEXT')), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_settings', array('id' => array('type' => 'INT(11) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'name' => array('type' => 'VARCHAR(50)', 'notnull' => true), 'value' => array('type' => 'TEXT', 'notnull' => true)), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_u2u_user_log', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_sent_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_unread_items' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_status' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1')), array(), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /****************************************************** * EXTENSION: Initial adding of the settings values * * ADDED: Contrexx v2.1.2 * *******************************************************/ $arrSettings = array('max_posting_size' => '2000', 'max_posting_chars' => '2000', 'wysiwyg_editor' => '1', 'subject' => 'Eine neue Nachricht von [senderName]', 'from' => 'Contrexx U2U Nachrichtensystem', 'email_message' => 'Hallo <strong>[receiverName]</strong>,<br />\\r\\n<br />\\r\\n<strong>[senderName]</strong> hat Ihnen eine private Nachricht gesendet. Um die Nachricht zu lesen, folgen Sie bitte folgendem Link:<br />\\r\\n<br />\\r\\nhttp://[domainName]/index.php?section=u2u&cmd=notification<br />\\r\\n <br />\\r\\n<br />'); foreach ($arrSettings as $name => $value) { $query = "SELECT 1 FROM `" . DBPREFIX . "module_u2u_settings` WHERE `name` = '" . $name . "'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_u2u_settings` (`name`, `value`) VALUES ('" . $name . "', '" . $value . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } /******************************** * EXTENSION: Timezone * * ADDED: Contrexx v3.0.0 * ********************************/ try { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_u2u_sent_messages` CHANGE `date_time` `date_time` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00"'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _jobsUpdate() { global $objDatabase; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs', array('id' => array('type' => 'INT(6)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'author' => array('type' => 'VARCHAR(150)', 'notnull' => true, 'default' => ''), 'text' => array('type' => 'MEDIUMTEXT'), 'workloc' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'workload' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'work_start' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'catid' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(2)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'userid' => array('type' => 'INT(6)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => 1), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)), array('newsindex' => array('fields' => array('title', 'text'), 'type' => 'fulltext'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_categories', array('catid' => array('type' => 'INT(2)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => ''), 'lang' => array('type' => 'INT(2)', 'default' => 1, 'unsigned' => true), 'sort_style' => array('type' => "ENUM('alpha', 'date', 'date_alpha')", 'default' => 'alpha'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_location', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(100)', 'default' => ''))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_rel_loc_jobs', array('job' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'location' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_jobs_settings', array('id' => array('type' => 'INT(10)', 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(250)', 'default' => ''), 'value' => array('type' => 'TEXT', 'default' => ''))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $arrSettings = array(array('name' => 'footnote', 'value' => 'Hat Ihnen diese Bewerbung zugesagt? \\r\\nDann können Sie sich sogleich telefonisch, per E-mail oder Web Formular bewerben.'), array('name' => 'link', 'value' => 'Online für diese Stelle bewerben.'), array('name' => 'url', 'value' => 'index.php?section=contact&cmd=5&44=%URL%&43=%TITLE%'), array('name' => 'show_location_fe', 'value' => '1')); foreach ($arrSettings as $arrSetting) { $query = "SELECT 1 FROM `" . DBPREFIX . "module_jobs_settings` WHERE `name` = '" . $arrSetting['name'] . "'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult !== false) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_jobs_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } /******************************** * EXTENSION: Timezone * * ADDED: Contrexx v3.0.0 * ********************************/ try { \Cx\Lib\UpdateUtil::sql(' ALTER TABLE `' . DBPREFIX . 'module_jobs` CHANGE `startdate` `startdate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00", CHANGE `enddate` `enddate` TIMESTAMP NOT NULL DEFAULT "0000-00-00 00:00:00" '); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _knowledgeUpdate() { global $objDatabase; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_article_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'question' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0), 'answer' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_article_content_lang' => array('fields' => array('lang')), 'module_knowledge_article_content_article' => array('fields' => array('article')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1), 'hits' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votes' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'votevalue' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'sort' => array('type' => 'INT', 'notnull' => true, 'default' => 0), 'date_created' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0), 'date_updated' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 1, 'unsigned' => true), 'parent' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'sort' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_categories_sort' => array('fields' => array('sort')), 'module_knowledge_categories_parent' => array('fields' => array('parent')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_categories_content', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'category' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 1))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_settings', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0)), array('module_knowledge_settings_name' => array('fields' => array('name')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 1, 'unsigned' => true)), array('module_knowledge_tags_name' => array('fields' => array('name')))); if (strpos(\Cx\Lib\UpdateUtil::sql('SHOW CREATE TABLE `' . DBPREFIX . 'module_knowledge_tags_articles`')->fields['Create Table'], 'UNIQUE KEY') === false) { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'primary' => true, 'auto_increment' => true, 'unsigned' => true), 'article' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'tag' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true)), array('module_knowledge_tags_articles_tag' => array('fields' => array('tag')), 'module_knowledge_tags_articles_article' => array('fields' => array('article')))); } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $arrSettings = array(array('name' => 'max_subcategories', 'value' => '5'), array('name' => 'column_number', 'value' => '2'), array('name' => 'max_rating', 'value' => '8'), array('name' => 'best_rated_sidebar_template', 'value' => '<h2>Bestbewertete Artikel</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'best_rated_sidebar_length', 'value' => '82'), array('name' => 'best_rated_sidebar_amount', 'value' => '5'), array('name' => 'tag_cloud_sidebar_template', 'value' => '[[CLOUD]] <br style="clear: both;" />'), array('name' => 'most_read_sidebar_template', 'value' => '<h2>Bestbewertete Artikel 2</h2>\\r\\n<div class="clearfix">\\r\\n<ul class="knowledge_sidebar">\\r\\n<!-- BEGIN article -->\\r\\n<li><a href="[[URL]]">[[ARTICLE]]</a></li>\\r\\n<!-- END article -->\\r\\n</ul>\\r\\n</div>'), array('name' => 'most_read_sidebar_length', 'value' => '79'), array('name' => 'most_read_sidebar_amount', 'value' => '5'), array('name' => 'best_rated_siderbar_template', 'value' => ''), array('name' => 'most_read_amount', 'value' => '5'), array('name' => 'best_rated_amount', 'value' => '5')); foreach ($arrSettings as $arrSetting) { $query = "SELECT 1 FROM `" . DBPREFIX . "module_knowledge_settings` WHERE `name` = '" . $arrSetting['name'] . "'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult !== false) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_knowledge_settings` (`name`, `value`) VALUES ('" . $arrSetting['name'] . "', '" . $arrSetting['value'] . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } /******************************************* * EXTENSION: Duplicate entries clean up * * ADDED: Contrexx v3.0.2 * *******************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_knowledge_tags_articles', array('article' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'tag' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'article')), array('article' => array('fields' => array('article', 'tag'), 'type' => 'UNIQUE', 'force' => true)), 'MyISAM'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _ecardUpdate() { global $objDatabase, $_ARRAYLANG, $_CORELANG; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_ecards', array('code' => array('type' => 'VARCHAR(35)', 'notnull' => true, 'default' => '', 'primary' => true), 'date' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'TTL' => array('type' => 'INT(10)', 'notnull' => true, 'default' => 0, 'unsigned' => true), 'salutation' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'senderEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientName' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'recipientEmail' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'message' => array('type' => 'TEXT', 'notnull' => true))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_ecard_settings', array('setting_name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'primary' => true), 'setting_value' => array('type' => 'TEXT', 'notnull' => true, 'default' => 0))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $ins_tpl = "\n INSERT INTO " . DBPREFIX . "module_ecard_settings (setting_name, setting_value)\n VALUES ('%s', '%s')\n ON DUPLICATE KEY UPDATE `setting_name` = `setting_name`\n "; $insert_values = array(array('maxCharacters', '100'), array('maxLines', '50'), array('motive_0', 'Bild_001.jpg'), array('motive_1', 'Bild_002.jpg'), array('motive_2', ''), array('motive_3', ''), array('motive_4', ''), array('motive_5', ''), array('motive_6', ''), array('motive_7', ''), array('motive_8', ''), array('maxHeight', '300'), array('validdays', '30'), array('maxWidth', '300'), array('maxHeightThumb', '80'), array('maxWidthThumb', '80'), array('subject', 'Sie haben eine E-Card erhalten!'), array('emailText', "[[ECARD_SENDER_NAME]] hat Ihnen eine E-Card geschickt.<br />\n Sie können diese während den nächsten [[ECARD_VALID_DAYS]] Tagen unter [[ECARD_URL]] abrufen.")); foreach ($insert_values as $setting) { $query = sprintf($ins_tpl, addslashes($setting[0]), addslashes($setting[1])); if (!$objDatabase->Execute($query)) { return _databaseError($query, $objDatabase->ErrorMsg()); } } /* * ********************************************** * BUGFIX: Set write access to the image dir * * ********************************************** */ $arrImagePaths = array(array(ASCMS_DOCUMENT_ROOT . '/images/modules/ecard', ASCMS_PATH_OFFSET . '/images/modules/ecard'), array(ASCMS_ECARD_OPTIMIZED_PATH, ASCMS_ECARD_OPTIMIZED_WEB_PATH), array(ASCMS_ECARD_SEND_ECARDS_PATH, ASCMS_ECARD_SEND_ECARDS_WEB_PATH), array(ASCMS_ECARD_THUMBNAIL_PATH, ASCMS_ECARD_THUMBNAIL_WEB_PATH)); foreach ($arrImagePaths as $arrImagePath) { if (\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0])) { if ($mediaDir = @opendir($arrImagePath[0])) { while ($file = readdir($mediaDir)) { if ($file != '.' && $file != '..') { if (!\Cx\Lib\FileSystem\FileSystem::makeWritable($arrImagePath[0] . '/' . $file)) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], $arrImagePath[0] . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], $arrImagePath[0] . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _media1Update() { global $_ARRAYLANG, $_CORELANG; /* require_once ASCMS_FRAMEWORK_PATH.'/File.class.php'; $objFile = new File(); $paths = glob(ASCMS_DOCUMENT_ROOT.'/media/archive*'); foreach ($paths as $path) { $path = "$path/"; $web_path = preg_replace("#".ASCMS_DOCUMENT_ROOT."/media/#", ASCMS_PATH_OFFSET . '/media/', $path); $status = $objFile->delFile($path, $web_path, '.htaccess'); if ($status == 'error') { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], "<pre>$web_path</pre>", $_CORELANG['TXT_UPDATE_TRY_AGAIN'])); return false; } }*/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_media_settings', array('name' => array('type' => 'VARCHAR(50)'), 'value' => array('type' => 'VARCHAR(250)', 'after' => 'name')), array('name' => array('fields' => array('name'))), 'InnoDB'); $arrValues = array(array("media1_frontend_changable", "off"), array("media2_frontend_changable", "off"), array("media3_frontend_changable", "off"), array("media4_frontend_changable", "off"), array("media1_frontend_managable", "off"), array("media2_frontend_managable", "off"), array("media3_frontend_managable", "off"), array("media4_frontend_managable", "off")); for ($i = 0; $i < count($arrValues); $i++) { $rs = \Cx\Lib\UpdateUtil::sql('SELECT 1 FROM ' . DBPREFIX . 'module_media_settings WHERE name="' . $arrValues[$i][0] . '";'); if ($rs->EOF) { \Cx\Lib\UpdateUtil::sql('INSERT INTO ' . DBPREFIX . 'module_media_settings VALUES ("' . $arrValues[$i][0] . '","' . $arrValues[$i][1] . '")'); } } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $arrContentSites = array('media1', 'media2', 'media3', 'media4'); // replace source url to image foreach ($arrContentSites as $module) { try { \Cx\Lib\UpdateUtil::migrateContentPage($module, '', 'images/modules/media/_base.gif', 'core_modules/media/View/Media/_base.gif', '3.1.2'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } return true; }
function _filesharingUpdate() { try { /********************************* * EXTENSION: Initial creation * * ADDED: Contrexx v3.0.0 * *********************************/ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_filesharing', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'file' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'after' => 'id'), 'source' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'after' => 'file'), 'cmd' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'after' => 'source'), 'hash' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'after' => 'cmd'), 'check' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'after' => 'hash'), 'expiration_date' => array('type' => 'TIMESTAMP', 'notnull' => false, 'default' => NULL, 'after' => 'check'), 'upload_id' => array('type' => 'INT(10)', 'notnull' => false, 'default' => NULL, 'after' => 'expiration_date'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_filesharing_mail_template', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'lang_id' => array('type' => 'INT(1)', 'notnull' => true, 'after' => 'id'), 'subject' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'after' => 'lang_id'), 'content' => array('type' => 'TEXT', 'notnull' => true, 'after' => 'subject'))); \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_filesharing_mail_template` (`id`, `lang_id`, `subject`, `content`) VALUES (1, 1, "Jemand teilt eine Datei mit Ihnen", "Guten Tag,\\r\\n\\r\\nJemand hat auf [[DOMAIN]] eine Datei mit Ihnen geteilt.\\r\\n\\r\\n<!-- BEGIN filesharing_file -->\\r\\nDownload-Link: [[FILE_DOWNLOAD]]\\r\\n<!-- END filesharing_file -->\\r\\n\\r\\nDie Person hat eine Nachricht hinterlassen:\\r\\n[[MESSAGE]]\\r\\n\\r\\nFreundliche Grüsse"), (2, 2, "Somebody is sharing a file with you", "Hi,\\r\\n\\r\\nSomebody shared a file with you on [[DOMAIN]].\\r\\n\\r\\n<!-- BEGIN filesharing_file -->\\r\\nDownload link: [[FILE_DOWNLOAD]]\\r\\n<!-- END filesharing_file -->\\r\\n\\r\\nThe person has left a message for you:\\r\\n[[MESSAGE]]\\r\\n\\r\\nBest regards") ON DUPLICATE KEY UPDATE `id` = `id` '); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_setting` (`section`, `name`, `group`, `type`, `value`, `values`, `ord`) VALUES (\'filesharing\',\'permission\',\'config\',\'text\',\'off\',\'\',0)'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _checkoutUpdate() { try { /********************************* * EXTENSION: Initial creation * * ADDED: Contrexx v3.0.0 * *********************************/ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_checkout_settings_general', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'after' => 'id'), 'value' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'name'))); \Cx\Lib\UpdateUtil::sql('INSERT INTO `' . DBPREFIX . 'module_checkout_settings_general` (`id`, `name`, `value`) VALUES (1, "epayment_status", 1) ON DUPLICATE KEY UPDATE `id` = `id`'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_checkout_settings_mails', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'TEXT', 'notnull' => true, 'after' => 'id'), 'content' => array('type' => 'TEXT', 'notnull' => true, 'after' => 'title'))); \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_checkout_settings_mails` (`id`, `title`, `content`) VALUES (1, "[[DOMAIN_URL]] - Neue Zahlung", "Guten Tag<br />\\r\\n<br />\\r\\nAuf [[DOMAIN_URL]] wurde eine neue Zahlung abgewickelt:<br />\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur Transaktion</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n ID</td>\\r\\n <td>\\r\\n [[TRANSACTION_ID]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Status</td>\\r\\n <td>\\r\\n [[TRANSACTION_STATUS]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Datum und Uhrzeit</td>\\r\\n <td>\\r\\n [[TRANSACTION_TIME]]</td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur beglichenen Rechnung</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n Nummer</td>\\r\\n <td>\\r\\n [[INVOICE_NUMBER]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Betrag</td>\\r\\n <td>\\r\\n [[INVOICE_AMOUNT]] [[INVOICE_CURRENCY]]</td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur Kontaktperson</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n Anrede</td>\\r\\n <td>\\r\\n [[CONTACT_TITLE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Vorname</td>\\r\\n <td>\\r\\n [[CONTACT_FORENAME]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Nachname</td>\\r\\n <td>\\r\\n [[CONTACT_SURNAME]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Firma</td>\\r\\n <td>\\r\\n [[CONTACT_COMPANY]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Strasse</td>\\r\\n <td>\\r\\n [[CONTACT_STREET]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n PLZ</td>\\r\\n <td>\\r\\n [[CONTACT_POSTCODE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Ort</td>\\r\\n <td>\\r\\n [[CONTACT_PLACE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Land</td>\\r\\n <td>\\r\\n [[CONTACT_COUNTRY]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Telefon</td>\\r\\n <td>\\r\\n [[CONTACT_PHONE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n E-Mail-Adresse</td>\\r\\n <td>\\r\\n <a href=\\"[[CONTACT_EMAIL]]?csrf=ODg4MTM2Nzg1&csrf=NDQzMzAwNjE0\\">[[CONTACT_EMAIL]]</a></td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\nFreundliche Grüsse<br />\\r\\nDas [[DOMAIN_URL]] Team"), (2, "[[DOMAIN_URL]] - Zahlungsbestätigung", "Guten Tag<br />\\r\\n<br />\\r\\nGerne bestätigen wir die erfolgreiche Abwicklung folgender Zahlung auf [[DOMAIN_URL]]:<br />\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur Transaktion</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n ID</td>\\r\\n <td>\\r\\n [[TRANSACTION_ID]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Status</td>\\r\\n <td>\\r\\n [[TRANSACTION_STATUS]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Datum und Uhrzeit</td>\\r\\n <td>\\r\\n [[TRANSACTION_TIME]]</td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur beglichenen Rechnung</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n Nummer</td>\\r\\n <td>\\r\\n [[INVOICE_NUMBER]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Betrag</td>\\r\\n <td>\\r\\n [[INVOICE_AMOUNT]] [[INVOICE_CURRENCY]]</td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\n<table border=\\"0\\" cellpadding=\\"0\\" cellspacing=\\"0\\">\\r\\n <tbody>\\r\\n <tr>\\r\\n <td colspan=\\"2\\" nowrap=\\"nowrap\\" width=\\"150\\">\\r\\n <strong>Angaben zur Kontaktperson</strong></td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td width=\\"150\\">\\r\\n Anrede</td>\\r\\n <td>\\r\\n [[CONTACT_TITLE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Vorname</td>\\r\\n <td>\\r\\n [[CONTACT_FORENAME]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Nachname</td>\\r\\n <td>\\r\\n [[CONTACT_SURNAME]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Firma</td>\\r\\n <td>\\r\\n [[CONTACT_COMPANY]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Strasse</td>\\r\\n <td>\\r\\n [[CONTACT_STREET]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n PLZ</td>\\r\\n <td>\\r\\n [[CONTACT_POSTCODE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Ort</td>\\r\\n <td>\\r\\n [[CONTACT_PLACE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Land</td>\\r\\n <td>\\r\\n [[CONTACT_COUNTRY]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n Telefon</td>\\r\\n <td>\\r\\n [[CONTACT_PHONE]]</td>\\r\\n </tr>\\r\\n <tr>\\r\\n <td>\\r\\n E-Mail-Adresse</td>\\r\\n <td>\\r\\n <a href=\\"[[CONTACT_EMAIL]]?csrf=MTQ3ODg2NDkx&csrf=ODg4NzYwNDE2\\">[[CONTACT_EMAIL]]</a></td>\\r\\n </tr>\\r\\n </tbody>\\r\\n</table>\\r\\n<br />\\r\\nFreundliche Grüsse<br />\\r\\nDas [[DOMAIN_URL]] Team") ON DUPLICATE KEY UPDATE `id` = `id` '); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_checkout_settings_yellowpay', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'TEXT', 'notnull' => true, 'after' => 'id'), 'value' => array('type' => 'TEXT', 'notnull' => true, 'after' => 'name'))); \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_checkout_settings_yellowpay` (`id`, `name`, `value`) VALUES (1, "pspid", "demoShop"), (2, "sha_in", "sech10zeichenminimum"), (3, "sha_out", "sech10zeichenminimum"), (4, "testserver", 1), (5, "operation", "SAL") ON DUPLICATE KEY UPDATE `id` = `id` '); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_checkout_transactions', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'time' => array('type' => 'INT(10)', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'status' => array('type' => 'ENUM(\'confirmed\',\'waiting\',\'cancelled\')', 'notnull' => true, 'after' => 'time'), 'invoice_number' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'after' => 'status'), 'invoice_currency' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '1', 'after' => 'invoice_number'), 'invoice_amount' => array('type' => 'INT(15)', 'notnull' => true, 'after' => 'invoice_currency'), 'contact_title' => array('type' => 'ENUM(\'mister\',\'miss\')', 'notnull' => true, 'after' => 'invoice_amount'), 'contact_forename' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_title'), 'contact_surname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_forename'), 'contact_company' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_surname'), 'contact_street' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_company'), 'contact_postcode' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_street'), 'contact_place' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_postcode'), 'contact_country' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '204', 'after' => 'contact_place'), 'contact_phone' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_country'), 'contact_email' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'contact_phone'))); \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_checkout_transactions` (`id`, `time`, `status`, `invoice_number`, `invoice_currency`, `invoice_amount`, `contact_title`, `contact_forename`, `contact_surname`, `contact_company`, `contact_street`, `contact_postcode`, `contact_place`, `contact_country`, `contact_phone`, `contact_email`) VALUES (1, 1346661560, "confirmed", 987654321, 1, 48000, "mister", "Hans", "Muster", "Musterfirma", "Musterstrasse 123", 1234, "Musterort", 204, "012 345 67 89", "*****@*****.**") ON DUPLICATE KEY UPDATE `id` = `id` '); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }
function _memberdirUpdate() { global $objDatabase, $_ARRAYLANG, $_CORELANG; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_directories', array('dirid' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parentdir' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '1'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'description' => array('type' => 'TEXT'), 'displaymode' => array('type' => 'SET(\'0\',\'1\',\'2\')', 'notnull' => true, 'default' => '0'), 'sort' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '1'), 'pic1' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '0'), 'pic2' => array('type' => 'SET(\'1\',\'0\')', 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1')), array('memberdir_dir' => array('fields' => array('name', 'description'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_name', array('field' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'dirid' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'active' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => ''), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_settings', array('setid' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'setname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'setvalue' => array('type' => 'TEXT'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_memberdir_values', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'dirid' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0'), 'pic1' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'pic2' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), '0' => array('type' => 'SMALLINT(5)', 'notnull' => true, 'unsigned' => true, 'default' => '0'), '1' => array('type' => 'TEXT'), '2' => array('type' => 'TEXT'), '3' => array('type' => 'TEXT'), '4' => array('type' => 'TEXT'), '5' => array('type' => 'TEXT'), '6' => array('type' => 'TEXT'), '7' => array('type' => 'TEXT'), '8' => array('type' => 'TEXT'), '9' => array('type' => 'TEXT'), '10' => array('type' => 'TEXT'), '11' => array('type' => 'TEXT'), '12' => array('type' => 'TEXT'), '13' => array('type' => 'TEXT'), '14' => array('type' => 'TEXT'), '15' => array('type' => 'TEXT'), '16' => array('type' => 'TEXT'), '17' => array('type' => 'TEXT'), '18' => array('type' => 'TEXT'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'))); $arrSettings = array('default_listing' => array('1', '1'), 'max_height' => array('400', '1'), 'max_width' => array('500', '1')); foreach ($arrSettings as $key => $arrSetting) { if (!\Cx\Lib\UpdateUtil::sql("SELECT 1 FROM `" . DBPREFIX . "module_memberdir_settings` WHERE `setname` = '" . $key . "'")->RecordCount()) { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "module_memberdir_settings`\n SET `setname` = '" . $key . "',\n `setvalue` = '" . $arrSetting[0] . "',\n `lang_id` = '" . $arrSetting[1] . "'\n "); } } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } if (!\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_MEDIA_PATH . '/memberdir')) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_MEDIA_PATH . '/memberdir/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _utf8Update() { global $objUpdate, $_DBCONFIG, $objDatabase, $_ARRAYLANG, $_CORELANG; $preferedCollation = 'utf8_unicode_ci'; $usedCollation = ''; $result = true; // fetch currently used collation try { $objResult = \Cx\Lib\UpdateUtil::sql('SHOW CREATE TABLE `' . DBPREFIX . 'access_users`'); if ($objResult->EOF) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'access_users')); return false; } $createStatement = $objResult->fields['Create Table']; // note: if charset latin1 is used, collation won't be set $matches = array(); if (preg_match('/COLLATE=([a-z_0-9]*)/', $createStatement, $matches)) { $usedCollation = $matches[1]; } \DBG::dump('Currently used collation: ' . $usedCollation); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // fetch available collations $arrCollations = _getUtf8Collations(); if (!is_array($arrCollations)) { return $arrCollations; } if (!isset($_SESSION['contrexx_update']['update']['core'])) { $_SESSION['contrexx_update']['update']['core'] = array(); } // note: $usedCollation is the currently used collation. // in case $usedCollation is non-utf8, then the following var // won't be set. This will cause the update system to ask the user // to select an utf8 collation. if (in_array($usedCollation, $arrCollations)) { $_SESSION['contrexx_update']['update']['core']['utf8_collation'] = $usedCollation; } if (isset($_DBCONFIG['charset']) && $_DBCONFIG['charset'] == 'utf8') { // do not update templates if they should be utf8 already $_SESSION['contrexx_update']['update']['utf'] = true; } // show dialog to select utf8 collation if (empty($_SESSION['contrexx_update']['update']['core']['utf8_collation'])) { if (isset($_POST['dbCollation']) && in_array($objUpdate->stripslashes($_POST['dbCollation']), $arrCollations)) { $_SESSION['contrexx_update']['update']['core']['utf8_collation'] = $objUpdate->stripslashes($_POST['dbCollation']); } else { $collationMenu = '<select name="dbCollation">'; foreach ($arrCollations as $collation) { $collationMenu .= '<option value="' . $collation . '"' . ($collation == $preferedCollation ? ' selected="selected"' : '') . '>' . $collation . '</option>'; } $collationMenu .= '</select><br />'; setUpdateMsg($_ARRAYLANG['TXT_SELECT_DB_COLLATION'], 'title'); setUpdateMsg(sprintf($_ARRAYLANG['TXT_SELECT_DB_COLLATION_MSG'] . '<br /><br />', $collationMenu), 'msg'); setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button'); return false; } } // WRITE COLLATION TO CONFIG FILE IF NECESSARY if (empty($_DBCONFIG['collation'])) { \DBG::msg('New collation set in _utf8Update(): ' . $_SESSION['contrexx_update']['update']['core']['utf8_collation']); // configuration.php will get written by core.php's _writeNewConfigurationFile() $_DBCONFIG['collation'] = $_SESSION['contrexx_update']['update']['core']['utf8_collation']; // IMPORTANT! // setting result to 'charset_changed' will cause a reinitialization of the update system // to ensure that the db-connections use the proper charset/collation $result = 'charset_changed'; } // SET DATABASE CHARSET AND COLLATION try { $objDbStatement = \Cx\Lib\UpdateUtil::sql("SHOW CREATE DATABASE `" . $_DBCONFIG['database'] . "`"); if (!preg_match('#DEFAULT\\sCHARACTER\\sSET\\sutf8\\sCOLLATE\\s' . $_SESSION['contrexx_update']['update']['core']['utf8_collation'] . '#s', $objDbStatement->fields['Create Database'])) { \Cx\Lib\UpdateUtil::sql("ALTER DATABASE `" . $_DBCONFIG['database'] . "` DEFAULT CHARACTER SET utf8 COLLATE " . $objUpdate->addslashes($_SESSION['contrexx_update']['update']['core']['utf8_collation'])); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // CHANGE TABLE CHARSET AND COLLATION $arrContrexxTables = array(DBPREFIX . 'access_group_dynamic_ids', DBPREFIX . 'access_group_static_ids', DBPREFIX . 'access_rel_user_group', DBPREFIX . 'access_settings', DBPREFIX . 'access_users', DBPREFIX . 'access_user_attribute', DBPREFIX . 'access_user_attribute_name', DBPREFIX . 'access_user_attribute_value', DBPREFIX . 'access_user_core_attribute', DBPREFIX . 'access_user_groups', DBPREFIX . 'access_user_mail', DBPREFIX . 'access_user_network', DBPREFIX . 'access_user_profile', DBPREFIX . 'access_user_title', DBPREFIX . 'access_user_validity', DBPREFIX . 'module_block_blocks', DBPREFIX . 'module_block_categories', DBPREFIX . 'module_block_rel_lang_content', DBPREFIX . 'module_block_rel_pages', DBPREFIX . 'module_block_settings', DBPREFIX . 'module_blog_categories', DBPREFIX . 'module_blog_comments', 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', 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', DBPREFIX . 'module_checkout_settings_general', DBPREFIX . 'module_checkout_settings_mails', DBPREFIX . 'module_checkout_settings_yellowpay', DBPREFIX . 'module_checkout_transactions', DBPREFIX . 'module_contact_form', DBPREFIX . 'module_contact_form_data', DBPREFIX . 'module_contact_form_field', DBPREFIX . 'module_contact_form_field_lang', DBPREFIX . 'module_contact_form_lang', DBPREFIX . 'module_contact_form_submit_data', DBPREFIX . 'module_contact_recipient', DBPREFIX . 'module_contact_recipient_lang', DBPREFIX . 'module_contact_settings', DBPREFIX . 'backend_areas', DBPREFIX . 'backups', DBPREFIX . 'content_node', DBPREFIX . 'content_page', DBPREFIX . 'core_country', DBPREFIX . 'core_mail_template', DBPREFIX . 'core_setting', DBPREFIX . 'core_text', DBPREFIX . 'ids', DBPREFIX . 'languages', DBPREFIX . 'lib_country', DBPREFIX . 'log', DBPREFIX . 'log_entry', DBPREFIX . 'modules', DBPREFIX . 'module_repository', DBPREFIX . 'sessions', DBPREFIX . 'settings', DBPREFIX . 'settings_image', DBPREFIX . 'settings_smtp', DBPREFIX . 'skins', DBPREFIX . 'module_data_categories', DBPREFIX . 'module_data_messages', DBPREFIX . 'module_data_messages_lang', DBPREFIX . 'module_data_message_to_category', DBPREFIX . 'module_data_placeholders', DBPREFIX . 'module_data_settings', 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', DBPREFIX . 'module_docsys', DBPREFIX . 'module_docsys_categories', DBPREFIX . 'module_docsys_entry_category', 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', DBPREFIX . 'module_ecard_ecards', DBPREFIX . 'module_ecard_settings', 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', 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', DBPREFIX . 'module_filesharing', DBPREFIX . 'module_filesharing_mail_template', 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', 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', DBPREFIX . 'module_guestbook', DBPREFIX . 'module_guestbook_settings', DBPREFIX . 'module_jobs', DBPREFIX . 'module_jobs_categories', DBPREFIX . 'module_jobs_location', DBPREFIX . 'module_jobs_rel_loc_jobs', DBPREFIX . 'module_jobs_settings', 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', DBPREFIX . 'module_livecam', DBPREFIX . 'module_livecam_settings', DBPREFIX . 'module_market', DBPREFIX . 'module_market_categories', DBPREFIX . 'module_market_mail', DBPREFIX . 'module_market_paypal', DBPREFIX . 'module_market_settings', DBPREFIX . 'module_market_spez_fields', DBPREFIX . 'module_media_settings', 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_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', DBPREFIX . 'module_memberdir_directories', DBPREFIX . 'module_memberdir_name', DBPREFIX . 'module_memberdir_settings', DBPREFIX . 'module_memberdir_values', DBPREFIX . 'module_news', DBPREFIX . 'module_news_categories', DBPREFIX . 'module_news_categories_locale', DBPREFIX . 'module_news_comments', DBPREFIX . 'module_news_locale', DBPREFIX . 'module_news_settings', DBPREFIX . 'module_news_settings_locale', DBPREFIX . 'module_news_stats_view', DBPREFIX . 'module_news_teaser_frame', DBPREFIX . 'module_news_teaser_frame_templates', DBPREFIX . 'module_news_ticker', DBPREFIX . 'module_news_types', DBPREFIX . 'module_news_types_locale', 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', 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', DBPREFIX . 'module_recommend', DBPREFIX . 'module_shop_article_group', DBPREFIX . 'module_shop_attribute', DBPREFIX . 'module_shop_categories', 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_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_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', DBPREFIX . 'stats_browser', DBPREFIX . 'stats_colourdepth', DBPREFIX . 'stats_config', DBPREFIX . 'stats_country', DBPREFIX . 'stats_hostname', DBPREFIX . 'stats_javascript', DBPREFIX . 'stats_operatingsystem', DBPREFIX . 'stats_referer', DBPREFIX . 'stats_requests', DBPREFIX . 'stats_requests_summary', DBPREFIX . 'stats_screenresolution', DBPREFIX . 'stats_search', DBPREFIX . 'stats_spiders', DBPREFIX . 'stats_spiders_summary', DBPREFIX . 'stats_visitors', DBPREFIX . 'stats_visitors_summary', DBPREFIX . 'module_u2u_address_list', DBPREFIX . 'module_u2u_message_log', DBPREFIX . 'module_u2u_sent_messages', DBPREFIX . 'module_u2u_settings', DBPREFIX . 'module_u2u_user_log', DBPREFIX . 'voting_additionaldata', DBPREFIX . 'voting_email', DBPREFIX . 'voting_rel_email_system', DBPREFIX . 'voting_results', DBPREFIX . 'voting_system', DBPREFIX . 'module_feed_newsml_content_item', DBPREFIX . 'module_newsletter_system', DBPREFIX . 'module_newsletter_config', DBPREFIX . 'module_shop_shipment'); // fetch table collations try { $objInstalledTable = \Cx\Lib\UpdateUtil::sql("SHOW TABLE STATUS LIKE '" . DBPREFIX . "%'"); while (!$objInstalledTable->EOF) { $arrInstalledTables[$objInstalledTable->fields['Name']] = $objInstalledTable->fields['Collation']; $objInstalledTable->MoveNext(); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // remove existing constraints $arrInstalledTableNames = array_keys($arrInstalledTables); if (!isset($_SESSION['contrexx_update']['update']['core']['constraints'])) { $_SESSION['contrexx_update']['update']['core']['constraints'] = array(); } try { foreach ($arrInstalledTableNames as $table) { // fetch constraints $constraints = \Cx\Lib\UpdateUtil::get_constraints($table); // check if any constraints are set if (!count($constraints)) { continue; } // backup constraint definition (will be restored after the data has been migrated) $_SESSION['contrexx_update']['update']['core']['constraints'][$table] = $constraints; // remove constraints \Cx\Lib\UpdateUtil::set_constraints($table, array()); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // migrate tables to utf8 collation try { foreach ($arrContrexxTables as $table) { $converted = false; if (in_array($table, $arrInstalledTableNames)) { if ($arrInstalledTables[$table] == $_SESSION['contrexx_update']['update']['core']['utf8_collation']) { continue; } else { \DBG::msg('UTF-8: Migrate DB-Table: ' . $table); if (!in_array($table . '_new', $arrInstalledTableNames)) { $objTableStructure = \Cx\Lib\UpdateUtil::sql("SHOW CREATE TABLE `" . $table . "`"); $objTableStructure->fields['Create Table'] = preg_replace(array('/TABLE `' . $table . '/', '/collate[\\s|=][a-z0-9_]+_bin/i', '/default current_timestamp on update current_timestamp/i', '/character\\s+set[\\s|=][a-z0-9_]+/i', '/collate[\\s|=][a-z0-9_]+/i', '/default charset=[a-z0-9_]+/i'), array('TABLE `' . $table . '_new', 'BINARY', '', '', '', ''), $objTableStructure->fields['Create Table']); \Cx\Lib\UpdateUtil::sql($objTableStructure->fields['Create Table'] . " DEFAULT CHARSET=utf8 COLLATE=" . $objUpdate->addslashes($_SESSION['contrexx_update']['update']['core']['utf8_collation']) . ";\n"); } $objResult = \Cx\Lib\UpdateUtil::sql("SELECT COUNT(1) AS rowCount FROM `" . $table . "`"); $oriCount = $objResult->fields['rowCount']; $objResult = \Cx\Lib\UpdateUtil::sql("SELECT COUNT(1) AS rowCount FROM `" . $table . "_new`"); $newCount = $objResult->fields['rowCount']; if ($oriCount !== $newCount) { // migrate data \Cx\Lib\UpdateUtil::sql("TRUNCATE TABLE `" . $table . "_new`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . $table . "_new` SELECT * FROM `" . $table . "`"); } \Cx\Lib\UpdateUtil::sql("DROP TABLE `" . $table . "`"); $converted = true; } } if (in_array($table . '_new', $arrInstalledTableNames) || $converted) { \Cx\Lib\UpdateUtil::sql("RENAME TABLE `" . $table . "_new` TO `" . $table . "`"); } if (!checkTimeoutLimit()) { return 'timeout'; } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // reset constraints try { foreach ($_SESSION['contrexx_update']['update']['core']['constraints'] as $table => $constraints) { // set constraints \Cx\Lib\UpdateUtil::set_constraints($table, $constraints); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // migrate themes to utf8 if (!isset($_SESSION['contrexx_update']['update']['utf'])) { if (_convertThemes2UTF()) { $_SESSION['contrexx_update']['update']['utf'] = true; } else { return false; } } // $result is either TRUE or 'charset_changed' in case the charset/collation has been changed return $result; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _downloadsUpdate() { global $objDatabase, $_ARRAYLANG, $_CORELANG, $objUpdate, $_CONFIG; /************************************************ * EXTENSION: Initial creation of the * * database tables * * ADDED: Contrexx v2.1.0 * ************************************************/ $arrTables = $objDatabase->MetaTables('TABLES'); if (!sizeof($arrTables)) { setUpdateMsg($_ARRAYLANG['TXT_UNABLE_DETERMINE_DATABASE_STRUCTURE']); return false; } $tables = array(DBPREFIX . 'module_downloads_category' => "CREATE TABLE `" . DBPREFIX . "module_downloads_category` (\n `id` int(11) unsigned NOT NULL auto_increment,\n `parent_id` int(11) unsigned NOT NULL default '0',\n `is_active` tinyint(1) unsigned NOT NULL default '1',\n `visibility` tinyint(1) unsigned NOT NULL default '1',\n `owner_id` int(5) unsigned NOT NULL default '0',\n `order` int(3) unsigned NOT NULL default '0',\n `deletable_by_owner` tinyint(1) unsigned NOT NULL default '1',\n `modify_access_by_owner` tinyint(1) unsigned NOT NULL default '1',\n `read_access_id` int(11) unsigned NOT NULL default '0',\n `add_subcategories_access_id` int(11) unsigned NOT NULL default '0',\n `manage_subcategories_access_id` int(11) unsigned NOT NULL default '0',\n `add_files_access_id` int(11) unsigned NOT NULL default '0',\n `manage_files_access_id` int(11) unsigned NOT NULL default '0',\n `image` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`),\n KEY `is_active` (`is_active`),\n KEY `visibility` (`visibility`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_category_locale' => "CREATE TABLE `" . DBPREFIX . "module_downloads_category_locale` (\n `lang_id` int(11) unsigned NOT NULL default '0',\n `category_id` int(11) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n PRIMARY KEY (`lang_id`,`category_id`),\n FULLTEXT KEY `name` (`name`),\n FULLTEXT KEY `description` (`description`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_download_locale' => "CREATE TABLE `" . DBPREFIX . "module_downloads_download_locale` (\n `lang_id` int(11) unsigned NOT NULL default '0',\n `download_id` int(11) unsigned NOT NULL default '0',\n `name` varchar(255) NOT NULL default '',\n `description` text NOT NULL,\n PRIMARY KEY (`lang_id`,`download_id`),\n FULLTEXT KEY `name` (`name`),\n FULLTEXT KEY `description` (`description`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_rel_download_category' => "CREATE TABLE `" . DBPREFIX . "module_downloads_rel_download_category` (\n `download_id` int(10) unsigned NOT NULL default '0',\n `category_id` int(10) unsigned NOT NULL default '0',\n `order` int(3) unsigned NOT NULL default '0',\n PRIMARY KEY (`download_id`,`category_id`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_rel_download_download' => "CREATE TABLE `" . DBPREFIX . "module_downloads_rel_download_download` (\n `id1` int(10) unsigned NOT NULL default '0',\n `id2` int(10) unsigned NOT NULL default '0',\n PRIMARY KEY (`id1`,`id2`)\n ) ENGINE=MyISAM", DBPREFIX . 'module_downloads_settings' => "CREATE TABLE `" . DBPREFIX . "module_downloads_settings` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(32) NOT NULL default '',\n `value` varchar(255) NOT NULL default '',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM"); foreach ($tables as $name => $query) { #print_r($arrTables); if (in_array($name, $arrTables)) { continue; } if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_download', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file'), 'mime_type' => array('type' => 'ENUM(\'image\',\'document\',\'pdf\',\'media\',\'archive\',\'application\',\'link\')', 'notnull' => true, 'default' => 'image'), 'source' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'source_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'icon' => array('type' => 'ENUM(\'_blank\',\'avi\',\'bmp\',\'css\',\'doc\',\'dot\',\'exe\',\'fla\',\'gif\',\'htm\',\'html\',\'inc\',\'jpg\',\'js\',\'mp3\',\'nfo\',\'pdf\',\'php\',\'png\',\'pps\',\'ppt\',\'rar\',\'swf\',\'txt\',\'wma\',\'xls\',\'zip\')', 'notnull' => true, 'default' => '_blank'), 'size' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'image' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'owner_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'license' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'version' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => ''), 'author' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'website' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'ctime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'mtime' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'is_active' => array('type' => 'TINYINT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'visibility' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1'), 'order' => array('type' => 'INT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'views' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'download_count' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'expiration' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0')), array('is_active' => array('fields' => array('is_active')), 'visibility' => array('fields' => array('visibility')))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /************************************************ * EXTENSION: Initial adding of the * * settings values * * ADDED: Contrexx v2.1.0 * ************************************************/ $arrSettings = array('overview_cols_count' => '2', 'overview_max_subcats' => '5', 'use_attr_size' => '1', 'use_attr_license' => '1', 'use_attr_version' => '1', 'use_attr_author' => '1', 'use_attr_website' => '1', 'most_viewed_file_count' => '5', 'most_downloaded_file_count' => '5', 'most_popular_file_count' => '5', 'newest_file_count' => '5', 'updated_file_count' => '5', 'new_file_time_limit' => '604800', 'updated_file_time_limit' => '604800', 'associate_user_to_groups' => ''); foreach ($arrSettings as $name => $value) { $query = "SELECT 1 FROM `" . DBPREFIX . "module_downloads_settings` WHERE `name` = '" . $name . "'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_downloads_settings` (`name`, `value`) VALUES ('" . $name . "', '" . $value . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } /************************************************ * BUGFIX: Set write access to the upload dir * ************************************************/ if (\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_DOWNLOADS_IMAGES_PATH)) { if ($mediaDir = @opendir(ASCMS_DOWNLOADS_IMAGES_PATH)) { while ($file = readdir($mediaDir)) { if ($file != '.' && $file != '..') { if (!\Cx\Lib\FileSystem\FileSystem::makeWritable(ASCMS_DOWNLOADS_IMAGES_PATH . '/' . $file)) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], ASCMS_DOWNLOADS_IMAGES_PATH . '/' . $file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_DOWNLOADS_IMAGES_PATH . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_DOWNLOADS_IMAGES_PATH . '/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } /************************************************ * EXTENSION: Groups * * ADDED: Contrexx v2.1.2 * ************************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_group', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'is_active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '1'), 'type' => array('type' => 'ENUM(\'file\',\'url\')', 'notnull' => true, 'default' => 'file'), 'info_page' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_group_locale', array('lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'group_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_downloads_rel_group_category', array('group_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'category_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /******************************************************* * EXTENSION: Localisation of download source fields * * ADDED: Contrexx v3.0.0 * ********************************************************/ try { $arrColumns = $objDatabase->MetaColumns(DBPREFIX . 'module_downloads_download_locale'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_downloads_download_locale')); return false; } if (!isset($arrColumns['SOURCE']) && !isset($arrColumns['SOURCE_NAME'])) { \Cx\Lib\UpdateUtil::sql(' ALTER TABLE `' . DBPREFIX . 'module_downloads_download_locale` ADD `source` VARCHAR(255) NULL DEFAULT NULL AFTER `name`, ADD `source_name` VARCHAR(255) NULL DEFAULT NULL AFTER `source`, ADD `metakeys` TEXT NOT NULL AFTER `description` '); \Cx\Lib\UpdateUtil::sql(' UPDATE `' . DBPREFIX . 'module_downloads_download` AS download INNER JOIN `' . DBPREFIX . 'module_downloads_download_locale` AS download_locale ON download.id = download_locale.download_id SET download_locale.source = download.source, download_locale.source_name = download.source_name '); \Cx\Lib\UpdateUtil::sql(' ALTER TABLE `' . DBPREFIX . 'module_downloads_download` DROP COLUMN `source`, DROP COLUMN `source_name` '); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************************** * EXTENSION: Increase length of download source fields * * ADDED: Contrexx v3.1.0 * **********************************************************/ try { if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { \Cx\Lib\UpdateUtil::sql(' ALTER TABLE `' . DBPREFIX . 'module_downloads_download_locale` CHANGE `source` `source` VARCHAR(1024) NULL DEFAULT NULL, CHANGE `source_name` `source_name` VARCHAR(1024) NULL DEFAULT NULL '); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************************** * EXTENSION: Add access ids of "editing all downloads" * * to groups which had access to "administer"* * ADDED: Contrexx v3.1.1 * **********************************************************/ try { if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0.2')) { $result = \Cx\Lib\UpdateUtil::sql("SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE access_id = 142 GROUP BY `group_id`"); if ($result !== false) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`)\n VALUES (143, " . intval($result->fields['group_id']) . ")"); $result->MoveNext(); } } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
function _blogUpdate() { global $objDatabase, $_ARRAYLANG, $_CORELANG, $objUpdate, $_CONFIG; /* * Check for missing setting "blog_comments_editor" in database. In the update-package for 1.2 this value somehow * got lost. */ $query = ' SELECT name FROM `' . DBPREFIX . 'module_blog_settings` WHERE name="blog_comments_editor" LIMIT 1'; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_blog_settings` ( `name` , `value` ) VALUES ('blog_comments_editor', 'wysiwyg')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_categories', array('category_id' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_comments', array('comment_id' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'user_name' => array('type' => 'VARCHAR(50)', 'notnull' => false), 'user_mail' => array('type' => 'VARCHAR(250)', 'notnull' => false), 'user_www' => array('type' => 'VARCHAR(255)', 'notnull' => false), 'subject' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'comment' => array('type' => 'TEXT')), array('message_id' => array('fields' => array('message_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_message_to_category', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'category_id' => array('type' => 'INT(4)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)), array('category_id' => array('fields' => array('category_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_messages', array('message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_created' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_edited' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'hits' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'default' => '0'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_networks_lang', array('network_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_blog_votes', array('vote_id' => array('type' => 'INT(8)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'message_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'time_voted' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0'), 'vote' => array('type' => 'ENUM(\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\',\'10\')', 'notnull' => true, 'default' => '1')), array('message_id' => array('fields' => array('message_id')))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { //update to 2.2.3 in this block if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.2.3')) { //we've hidden the wysiwyg - let's default to textarea \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_settings SET value="textarea" WHERE name="blog_comments_editor"'); //comments: convert escaped db entries to their unescaped equivalents $rs = \Cx\Lib\UpdateUtil::sql('SELECT comment_id, comment FROM ' . DBPREFIX . 'module_blog_comments'); while (!$rs->EOF) { $content = $rs->fields['comment']; $id = $rs->fields['comment_id']; $content = contrexx_raw2db(html_entity_decode($content, ENT_QUOTES, CONTREXX_CHARSET)); \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_blog_comments SET comment="' . $content . '" WHERE comment_id=' . $id); $rs->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } // replace placeholder {TXT_COMMENT_ADD_SPAM} with {TXT_COMMENT_CAPTCHA} $content = str_replace('{TXT_COMMENT_ADD_SPAM}', '{TXT_COMMENT_CAPTCHA}', $content); // replace <img src="[[BLOG_DETAILS_COMMENT_ADD_SPAM_URL]]" alt="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" title="[[BLOG_DETAILS_COMMENT_ADD_SPAM_ALT]]" /> with {COMMENT_CAPTCHA_CODE} $content = preg_replace('/<img[^>]+\\{BLOG_DETAILS_COMMENT_ADD_SPAM_URL\\}[^>]+>/ms', '{COMMENT_CAPTCHA_CODE}', $content); // remove <input type="text" name="frmAddComment_Captcha" /> $content = preg_replace('/<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Captcha[^>]+>/ms', '', $content); // remove <input type="hidden" name="frmAddComment_Offset" value="[[BLOG_DETAILS_COMMENT_ADD_SPAM_OFFSET]]" /> $content = preg_replace('/<(div|p)[^>]*>\\s*<input[^>]+name\\s*=\\s*[\'"]frmAddComment_Offset[^>]+>\\s*<\\/(div|p)>/ms', '', $content); // add missing comment_captcha template block if (!preg_match('/<!--\\s+BEGIN\\s+comment_captcha\\s+-->.*<!--\\s+END\\s+comment_captcha\\s+-->/ms', $content)) { $content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{TXT_COMMENT_CAPTCHA\\}.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count); if (!$count) { $content = preg_replace('/(.*)(<(div|p)[^{]*?>.*?\\{COMMENT_CAPTCHA_CODE\\}.*?<\\/\\3>)/ms', '$1<!-- BEGIN comment_captcha -->$2<!-- END comment_captcha -->', $content, -1, $count); } } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'blog', 'cmd' => 'details'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /** * Everything went fine. Return without any errors. */ return true; }
function _newsletterUpdate() { global $objDatabase, $objUpdate, $_CONFIG; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_category', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'status' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'status'), 'notification_email' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'name')), array('name' => array('fields' => array('name')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_confirm_mail', array('id' => array('type' => 'INT(1)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'content' => array('type' => 'longtext', 'after' => 'title'), 'recipients' => array('type' => 'text', 'after' => 'content'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'subject' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'template' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'subject'), 'content' => array('type' => 'text', 'after' => 'template'), 'attachment' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'content'), 'priority' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'attachment'), 'sender_email' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'priority'), 'sender_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'sender_email'), 'return_path' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'sender_name'), 'smtp_server' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'return_path'), 'status' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'smtp_server'), 'count' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'status'), 'recipient_count' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'count'), 'date_create' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'recipient_count'), 'date_sent' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'date_create'), 'tmp_copy' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'date_sent'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } DBG::msg("Done checking tables.. going to check settings"); //the two values notifyOnUnsubscribe and notificationUnsubscribe have been merged into the latter. $unsubscribeVal = 1; try { DBG::msg("Retrieving old unsubscribe value if set."); $res = \Cx\Lib\UpdateUtil::sql("SELECT setvalue FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notifyOnUnsubscribe'"); if (!$res->EOF) { $unsubscribeVal = $res->fields['setvalue']; } else { DBG::msg("Not found. Retrieving new unsubscribe value if set."); $res = \Cx\Lib\UpdateUtil::sql("SELECT setvalue FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notificatonUnsubscribe'"); if (!$res->EOF) { $unsubscribeVal = $res->fields['setvalue']; } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $settings = array('sender_mail' => array('setid' => 1, 'setname' => 'sender_mail', 'setvalue' => '*****@*****.**', 'status' => 1), 'sender_name' => array('setid' => 2, 'setname' => 'sender_name', 'setvalue' => 'admin', 'status' => 1), 'reply_mail' => array('setid' => 3, 'setname' => 'reply_mail', 'setvalue' => '*****@*****.**', 'status' => 1), 'mails_per_run' => array('setid' => 4, 'setname' => 'mails_per_run', 'setvalue' => '30', 'status' => 1), 'text_break_after' => array('setid' => 5, 'setname' => 'text_break_after', 'setvalue' => '100', 'status' => 1), 'test_mail' => array('setid' => 6, 'setname' => 'test_mail', 'setvalue' => '*****@*****.**', 'status' => 1), 'overview_entries_limit' => array('setid' => 7, 'setname' => 'overview_entries_limit', 'setvalue' => '10', 'status' => 1), 'rejected_mail_operation' => array('setid' => 8, 'setname' => 'rejected_mail_operation', 'setvalue' => 'delete', 'status' => 1), 'defUnsubscribe' => array('setid' => 9, 'setname' => 'defUnsubscribe', 'setvalue' => '0', 'status' => 1), 'notificationSubscribe' => array('setid' => 11, 'setname' => 'notificationSubscribe', 'setvalue' => '1', 'status' => 1), 'notificationUnsubscribe' => array('setid' => 10, 'setname' => 'notificationUnsubscribe', 'setvalue' => $unsubscribeVal, 'status' => 1), 'recipient_attribute_status' => array('setid' => 12, 'setname' => 'recipient_attribute_status', 'setvalue' => '{"recipient_sex":{"active":true,"required":false},"recipient_salutation":{"active":true,"required":false},"recipient_title":{"active":false,"required":false},"recipient_firstname":{"active":true,"required":false},"recipient_lastname":{"active":true,"required":false},"recipient_position":{"active":false,"required":false},"recipient_company":{"active":true,"required":false},"recipient_industry":{"active":false,"required":false},"recipient_address":{"active":true,"required":false},"recipient_city":{"active":true,"required":false},"recipient_zip":{"active":true,"required":false},"recipient_country":{"active":true,"required":false},"recipient_phone":{"active":true,"required":false},"recipient_private":{"active":false,"required":false},"recipient_mobile":{"active":false,"required":false},"recipient_fax":{"active":false,"required":false},"recipient_birthday":{"active":true,"required":false},"recipient_website":{"active":false,"required":false}}', 'status' => 1), 'reject_info_mail_text' => array('setid' => 13, 'setname' => 'reject_info_mail_text', 'setvalue' => 'Der Newsletter konnte an folgende E-Mail-Adresse nicht versendet werden:\\r\\n[[EMAIL]]\\r\\n\\r\\nUm die E-Mail Adresse zu bearbeiten, klicken Sie bitte auf den folgenden Link:\\r\\n[[LINK]]', 'status' => 1)); try { DBG::msg("Reading current settings"); $res = \Cx\Lib\UpdateUtil::sql("SELECT * FROM " . DBPREFIX . "module_newsletter_settings"); while (!$res->EOF) { $field = $res->fields['setname']; DBG::msg("...merging {$field} with default settings"); if (isset($settings[$field])) { //do we have another value for this? $settings[$field]['setvalue'] = $res->fields['setvalue']; } $res->MoveNext(); } DBG::msg("Updating settings"); foreach ($settings as $entry) { $setid = intval($entry['setid']); $field = addslashes($entry['setname']); $value = addslashes($entry['setvalue']); $status = intval($entry['status']); DBG::msg("...deleting field {$field}"); \Cx\Lib\UpdateUtil::sql("DELETE FROM " . DBPREFIX . "module_newsletter_settings WHERE setid = '{$setid}' OR setname = '{$field}'"); DBG::msg("...rewriting field {$field}"); \Cx\Lib\UpdateUtil::sql("\n INSERT INTO " . DBPREFIX . "module_newsletter_settings\n (setid, setname, setvalue, status)\n VALUES (\n '{$setid}', '{$field}', '{$value}', '{$status}'\n );\n "); } DBG::msg("Deleting old unsubscribe key if set"); \Cx\Lib\UpdateUtil::sql("DELETE FROM " . DBPREFIX . "module_newsletter_settings WHERE setname='notifyOnUnsubscribe'"); DBG::msg("Done with newsletter update"); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { DBG::msg("Setting recipient count"); $objResult = \Cx\Lib\UpdateUtil::sql("SELECT `newsletter`, COUNT(1) AS recipient_count FROM `" . DBPREFIX . "module_newsletter_tmp_sending` GROUP BY `newsletter`"); if ($objResult->RecordCount()) { while (!$objResult->EOF) { \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_newsletter` SET `recipient_count` = " . $objResult->fields['recipient_count'] . " WHERE `id`=" . $objResult->fields['newsletter']); $objResult->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } // Add notification recipients to confirm_mail table try { $objResult = \Cx\Lib\UpdateUtil::sql("SELECT id FROM `" . DBPREFIX . "module_newsletter_confirm_mail` WHERE id='3'"); if ($objResult->RecordCount() == 0) { DBG::msg("inserting standard confirm mails"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "module_newsletter_confirm_mail` (`id` ,`title` ,`content` ,`recipients`) VALUES ('3', '[[url]] - Neue Newsletter Empfänger [[action]]', 'Hallo Admin Eine neue Empfänger [[action]] in ihrem Newsletter System. Automatisch generierte Nachricht [[date]]', '');"); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_access_user', array('accessUserID' => array('type' => 'INT(5)', 'unsigned' => true), 'newsletterCategoryID' => array('type' => 'INT(11)', 'after' => 'accessUserID'), 'code' => array('type' => 'VARCHAR(255)', 'after' => 'newsletterCategoryID', 'notnull' => true, 'default' => '')), array('rel' => array('fields' => array('accessUserID', 'newsletterCategoryID'), 'type' => 'UNIQUE'), 'accessUserID' => array('fields' => array('accessUserID')))); // set random newsletter code for access recipients \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_newsletter_access_user SET `code` = SUBSTR(MD5(RAND()),1,12) WHERE `code` = \'\''); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_rel_usergroup_newsletter', array('userGroup' => array('type' => 'INT(10)', 'unsigned' => true), 'newsletter' => array('type' => 'INT(10)', 'unsigned' => true, 'after' => 'userGroup')), array('uniq' => array('fields' => array('userGroup', 'newsletter'), 'type' => 'UNIQUE'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_settings', array('setid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'setname' => array('type' => 'VARCHAR(250)', 'after' => 'setid', 'notnull' => true, 'default' => ''), 'setvalue' => array('type' => 'text', 'after' => 'setname'), 'status' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'setvalue')), array('setname' => array('fields' => array('setname'), 'type' => 'UNIQUE'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_tmp_sending', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'newsletter' => array('type' => 'INT(11)', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'email' => array('type' => 'VARCHAR(255)', 'after' => 'newsletter', 'notnull' => true, 'default' => ''), 'sendt' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'email'), 'type' => array('type' => 'ENUM(\'access\',\'newsletter\',\'core\')', 'notnull' => true, 'default' => 'newsletter', 'after' => 'sendt'), 'code' => array('type' => 'VARCHAR(10)', 'after' => 'type')), array('unique_email' => array('fields' => array('newsletter', 'email'), 'type' => 'UNIQUE'), 'email' => array('fields' => array('email')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_email_link', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'email_id' => array('type' => 'INT(11)', 'unsigned' => true, 'after' => 'id'), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'email_id'), 'url' => array('type' => 'VARCHAR(255)', 'after' => 'title')), array('email_id' => array('fields' => array('email_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_email_link_feedback', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'link_id' => array('type' => 'INT(11)', 'unsigned' => true, 'after' => 'id'), 'email_id' => array('type' => 'INT(11)', 'unsigned' => true, 'after' => 'link_id'), 'recipient_id' => array('type' => 'INT(11)', 'unsigned' => true, 'after' => 'email_id'), 'recipient_type' => array('type' => 'ENUM(\'access\',\'newsletter\')', 'after' => 'recipient_id')), array('link_id' => array('fields' => array('link_id', 'email_id', 'recipient_id', 'recipient_type'), 'type' => 'UNIQUE'), 'email_id' => array('fields' => array('email_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_template', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'description' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'name'), 'html' => array('type' => 'text', 'after' => 'description'), 'required' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'html'), 'type' => array('type' => 'ENUM(\'e-mail\',\'news\')', 'notnull' => true, 'default' => 'e-mail', 'after' => 'required'))); // migrate country field if (newsletter_migrate_country_field() == 'timeout') { return 'timeout'; } // IMPORTANT: the table definition statement of module_newsletter_user must be AFTER newsletter_migrate_country_field() has been called! // fix missing columns & rename old columns if required \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_newsletter_user', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'code' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'email' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'code'), 'uri' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'email'), 'sex' => array('type' => 'ENUM(\'m\',\'f\')', 'notnull' => false, 'after' => 'uri'), 'salutation' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'sex', 'renamefrom' => 'title'), 'title' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'salutation'), 'lastname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'title'), 'firstname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'lastname'), 'position' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'firstname'), 'company' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'position'), 'industry_sector' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'company'), 'address' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'industry_sector', 'renamefrom' => 'street'), 'zip' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'address'), 'city' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'zip'), 'country_id' => array('type' => 'SMALLINT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'city'), 'phone_office' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'country_id', 'renamefrom' => 'phone'), 'phone_private' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'phone_office'), 'phone_mobile' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'phone_private'), 'fax' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'phone_mobile'), 'notes' => array('type' => 'text', 'after' => 'fax'), 'birthday' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => '00-00-0000', 'after' => 'notes'), 'status' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '0', 'after' => 'birthday'), 'emaildate' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'status'), 'language' => array('type' => 'INT(3)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'emaildate')), array('email' => array('fields' => array('email'), 'type' => 'UNIQUE'), 'status' => array('fields' => array('status')))); // fix user's SALUTATION of previews updates if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0') && $objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.3')) { // set user's SALUTATION based of previews updates \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_newsletter_user` SET `salutation` = `title`, `title` = '' WHERE `salutation` = '0' AND `title` REGEXP '^[0-9]+\$'"); // clear all user's TITLE attribute that consist only of a number (it is most likely not the case that a user's TITLE is a number, // so we assume that it is a left over of the preview update bug, which did not migrate the user's TITLE attribute to the user's SALUTATION attribute \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_newsletter_user` SET `title` = '' WHERE `title` REGEXP '^[0-9]+\$'"); } // switch to source mode for all newsletter content pages \Cx\Lib\UpdateUtil::setSourceModeOnContentPage(array('module' => 'newsletter'), '3.0.1'); // replace several placeholders that have changed $search = array('/TXT_NEWSLETTER_URI/', '/NEWSLETTER_URI/', '/TXT_NEWSLETTER_STREET/', '/NEWSLETTER_STREET/'); $replace = array('TXT_NEWSLETTER_WEBSITE', 'NEWSLETTER_WEBSITE', 'TXT_NEWSLETTER_ADDRESS', 'NEWSLETTER_ADDRESS'); \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'newsletter'), $search, $replace, array('content'), '3.0.1'); // sorry, brainfuck coming up... // this adds the missing template block newsletter_list as well as the placeholder [[NEWSLETTER_LIST_SELECTED]] $search = array('/(<!--\\s+BEGIN\\s+newsletter_lists\\s+-->)(.*)(<!--\\s+END\\s+newsletter_lists\\s+-->)/ms'); $callback = function ($matches) { if (preg_match('/^(.*)(<[^>]+[\'"]list\\[\\{NEWSLETTER_LIST_ID\\}\\][\'"])([^>]*>)(.*)$/ms', $matches[2], $listMatches)) { if (strpos($listMatches[2] . $listMatches[3], '{NEWSLETTER_LIST_SELECTED}') === false) { $matches[2] = $listMatches[1] . $listMatches[2] . ' {NEWSLETTER_LIST_SELECTED} ' . $listMatches[3] . $listMatches[4]; } else { $matches[2] = $listMatches[1] . $listMatches[2] . $listMatches[3] . $listMatches[4]; } } if (!preg_match('/<!--\\s+BEGIN\\s+newsletter_list\\s+-->.*<!--\\s+END\\s+newsletter_list\\s+-->/ms', $matches[2])) { return $matches[1] . '<!-- BEGIN newsletter_list -->' . $matches[2] . '<!-- END newsletter_list -->' . $matches[3]; } else { return $matches[1] . $matches[2] . $matches[3]; } }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'newsletter'), $search, $callback, array('content'), '3.0.1'); // this adds the missing placeholders [[SELECTED_DAY]], [[SELECTED_MONTH]], [[SELECTED_YEAR]] $search = array('/(<option[^>]+\\{USERS_BIRTHDAY_(DAY|MONTH|YEAR)\\}[\'"])([^>]*>)/ms'); $callback = function ($matches) { if (strpos($matches[1] . $matches[3], '{SELECTED_' . $matches[2] . '}') === false) { return $matches[1] . ' {SELECTED_' . $matches[2] . '} ' . $matches[3]; } else { return $matches[1] . $matches[3]; } }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'newsletter'), $search, $callback, array('content'), '3.0.1'); // replace [[TXT_NEWSLETTER_TITLE]] to [[TXT_NEWSLETTER_SALUTATION]] // replace [[NEWSLETTER_TITLE]] to [[NEWSLETTER_SALUTATION]] $search = array('/.*\\{NEWSLETTER_TITLE\\}.*/ms'); $callback = function ($matches) { if (!preg_match('/<!--\\s+BEGIN\\s+recipient_title\\s+-->.*\\{NEWSLETTER_TITLE\\}.*<!--\\s+END\\s+recipient_title\\s+-->/ms', $matches[0]) && !preg_match('/<!--\\s+BEGIN\\s+recipient_salutation\\s+-->/ms', $matches[0]) && !preg_match('/\\{NEWSLETTER_SALUTATION\\}/ms', $matches[0])) { return str_replace(array('TXT_NEWSLETTER_TITLE', '{NEWSLETTER_TITLE}'), array('TXT_NEWSLETTER_SALUTATION', '{NEWSLETTER_SALUTATION}'), $matches[0]); } else { return $matches[0]; } }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'newsletter'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.3') && empty($_SESSION['contrexx_update']['newsletter_links_decoded'])) { try { $objResult = \Cx\Lib\UpdateUtil::sql('SELECT `id`, `url` FROM `' . DBPREFIX . 'module_newsletter_email_link`'); if ($objResult !== false && $objResult->RecordCount() > 0) { while (!$objResult->EOF) { \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'module_newsletter_email_link` SET `url` = ? WHERE `id` = ?', array(html_entity_decode($objResult->fields['url'], ENT_QUOTES, CONTREXX_CHARSET), $objResult->fields['id'])); $objResult->MoveNext(); } } $_SESSION['contrexx_update']['newsletter_links_decoded'] = true; } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) { // add access to access ids 152/171/172/174/175/176 for user groups which had access to access id 25 try { $result = \Cx\Lib\UpdateUtil::sql("SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE access_id = 25 GROUP BY group_id"); if ($result !== false) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`)\n VALUES\n (152, " . intval($result->fields['group_id']) . "),\n (171, " . intval($result->fields['group_id']) . "),\n (172, " . intval($result->fields['group_id']) . "),\n (174, " . intval($result->fields['group_id']) . "),\n (175, " . intval($result->fields['group_id']) . "),\n (176, " . intval($result->fields['group_id']) . ")\n "); $result->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } // add access id 176 for user groups which had access to 172 if version is older than 3.1.0 if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { try { $result = \Cx\Lib\UpdateUtil::sql("SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE access_id = 172 GROUP BY `group_id`"); if ($result !== false) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`)\n VALUES (176, " . intval($result->fields['group_id']) . ")"); $result->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } return true; }
public function getInactiveContentLanguageCheckboxes() { try { $activeLanguageIds = implode(',', \FWLanguage::getIdArray()); $objResult = \Cx\Lib\UpdateUtil::sql(' SELECT DISTINCT `lang` FROM `' . DBPREFIX . 'content_navigation` WHERE `lang` NOT IN (' . $activeLanguageIds . ') UNION DISTINCT SELECT DISTINCT `lang` FROM `' . DBPREFIX . 'content_navigation_history` WHERE `lang` NOT IN (' . $activeLanguageIds . ') ORDER BY `lang` ASC '); if ($objResult->RecordCount()) { $arrLanguages = \FWLanguage::getLanguageArray(); $inactiveContentLanguages = ''; while (!$objResult->EOF) { $inactiveContentLanguages .= ' <input style="clear:left;float:left;margin-top:3px;" type="checkbox" name="migrateLangIds" id="migrate-lang-' . $objResult->fields['lang'] . '" value="' . $objResult->fields['lang'] . '" /> <label for="migrate-lang-' . $objResult->fields['lang'] . '">' . $arrLanguages[$objResult->fields['lang']]['name'] . '</label><br /> '; $objResult->MoveNext(); } return $inactiveContentLanguages; } else { return ''; } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _contactUpdate() { global $objUpdate, $_CONFIG; try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_recipient', array('id' => array('type' => 'INT', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'id_form' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 0), 'name' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'email' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'sort' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 0))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_field', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'id_form' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'type' => array('type' => 'ENUM(\'text\',\'label\',\'checkbox\',\'checkboxGroup\',\'date\',\'file\',\'multi_file\',\'hidden\',\'password\',\'radio\',\'select\',\'textarea\',\'recipient\')', 'notnull' => true, 'default' => 'text'), 'attributes' => array('type' => 'TEXT'), 'is_required' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'check_type' => array('type' => 'INT(3)', 'notnull' => true, 'default' => '1'), 'order_id' => array('type' => 'SMALLINT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0'))); /**************************** * ADDED: Contrexx v3.0.0 * ****************************/ /* * Create new table 'module_contact_form_field_lang' * to store language patameters of each field */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_field_lang', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'fieldID' => array('type' => 'INT(10)', 'unsigned' => true, 'after' => 'id'), 'langID' => array('type' => 'INT(10)', 'unsigned' => true, 'after' => 'fieldID'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'langID'), 'attributes' => array('type' => 'text', 'after' => 'name')), array('fieldID' => array('fields' => array('fieldID', 'langID'), 'type' => 'UNIQUE'))); /* * Migrate name and attributes fields from 'module_contact_form_field' table * to 'module_contact_form_field_lang' table for active frontend language. * For other languages empty string */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form_field', 'name') && \Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form', 'langId')) { $query = "SELECT `field`.`id`, `field`.`id_form`, `field`.`name`, `field`.`attributes`, `form`.`langId`\n FROM `" . DBPREFIX . "module_contact_form_field` AS `field`\n JOIN `" . DBPREFIX . "module_contact_form` AS `form`\n ON `form`.`id` = `field`.`id_form`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if ($objResult) { while (!$objResult->EOF) { $rowCountResult = \Cx\Lib\UpdateUtil::sql("SELECT 1\n FROM `" . DBPREFIX . "module_contact_form_field_lang`\n WHERE `fieldID` = " . $objResult->fields['id'] . "\n AND `langID` = " . $objResult->fields['langId'] . "\n LIMIT 1"); if ($rowCountResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_contact_form_field_lang` (\n `fieldID`, `langID`, `name`, `attributes`\n ) VALUES (\n " . $objResult->fields['id'] . ",\n " . $objResult->fields['langId'] . ",\n '" . addslashes($objResult->fields['name']) . "',\n '" . addslashes($objResult->fields['attributes']) . "')"; \Cx\Lib\UpdateUtil::sql($query); } $objResult->MoveNext(); } } } /* * Create table 'module_contact_recipient_lang' */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_recipient_lang', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'primary' => true, 'auto_increment' => true), 'recipient_id' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'after' => 'id'), 'langID' => array('type' => 'INT(11)', 'notnull' => true, 'after' => 'recipient_id'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'langID')), array('recipient_id' => array('fields' => array('recipient_id', 'langID'), 'type' => 'UNIQUE'))); /* * Transfer recipientId and name from 'module_contact_recipient' * to 'module_contact_recipient_lang' */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_recipient', 'name')) { $query = "SELECT `id`, `id_form`, `name` FROM `" . DBPREFIX . "module_contact_recipient`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); while (!$objResult->EOF) { $langId = 1; if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form', 'langId')) { $query = "SELECT `langId`\n FROM `" . DBPREFIX . "module_contact_form`\n WHERE `id` = " . $objResult->fields['id_form']; $formLangId = \Cx\Lib\UpdateUtil::sql($query); $langId = $formLangId->fields['langId'] != null ? $formLangId->fields['langId'] : 1; } else { $langId = 1; } /* * Check for row already exsist */ $rowCountResult = \Cx\Lib\UpdateUtil::sql("SELECT 1 as count\n FROM `" . DBPREFIX . "module_contact_recipient_lang`\n WHERE `recipient_id` = " . $objResult->fields['id'] . "\n AND `langID` = " . $langId . "\n LIMIT 1"); if ($rowCountResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_contact_recipient_lang` (\n `recipient_id`, `langID`, `name`\n ) VALUES (\n " . $objResult->fields['id'] . ",\n {$langId},\n '" . addslashes($objResult->fields['name']) . "')"; \Cx\Lib\UpdateUtil::sql($query); } $objResult->MoveNext(); } } /* * Drop column 'recipient name' from 'module_contact_recipient' */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_recipient', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'id_form' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 0, 'after' => 'id'), 'email' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'id_form'), 'sort' => array('type' => 'INT(11)', 'notnull' => true, 'default' => 0, 'after' => 'email'))); /* * Create new table 'module_contact_form_submit_data' */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_submit_data', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'id_entry' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'after' => 'id'), 'id_field' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'after' => 'id_entry'), 'formlabel' => array('type' => 'TEXT', 'after' => 'id_field'), 'formvalue' => array('type' => 'TEXT', 'after' => 'formlabel'))); /* * Transfer 'data' field of 'module_contact_form_data' table to 'field_label' and 'field_value' * in 'module_contact_form_submit_data' after base64 decoding * Fetch fieldId from 'module_contact_form_field_lang' table by matching fieldLabel */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form_data', 'data')) { /* * Execute migrate script for every 30 dataset */ $query = "SELECT `id`, `id_form`, `data`\n FROM `" . DBPREFIX . "module_contact_form_data`\n WHERE `data` != ''\n LIMIT 30"; while (($objResult = \Cx\Lib\UpdateUtil::sql($query)) && $objResult->RecordCount()) { while (!$objResult->EOF) { $fields_attr = explode(";", $objResult->fields['data']); foreach ($fields_attr as $key => $value) { $field_attr = explode(",", $value); $field_label = base64_decode($field_attr[0]); $field_value = base64_decode($field_attr[1]); /* * In the contrexx 2.1.4, the recipient fields were stored as 'contactFormField_recipient' in the submitted data. */ if ($field_label == "contactFormField_recipient" && \Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form_field', 'name')) { $form_recipient_query = "SELECT `name`\n FROM `" . DBPREFIX . "module_contact_form_field`\n WHERE `type` = 'recipient'\n AND `id_form` = " . $objResult->fields['id_form'] . "\n LIMIT 1"; $formRecipientResult = \Cx\Lib\UpdateUtil::sql($form_recipient_query); $field_label = $formRecipientResult->fields['name']; } $form_label_query = ' SELECT `lang`.`fieldID` FROM `' . DBPREFIX . 'module_contact_form_field` AS `field` LEFT JOIN `' . DBPREFIX . 'module_contact_form_field_lang` AS `lang` ON `lang`.`fieldID` = `field`.`id` WHERE (`field`.`id_form` = ' . $objResult->fields['id_form'] . ') AND (`lang`.`name` = "' . contrexx_raw2db($field_label) . '") '; $formLabelResult = \Cx\Lib\UpdateUtil::sql($form_label_query); $fieldId = $formLabelResult->fields['fieldID'] != null ? $formLabelResult->fields['fieldID'] : 0; $submitCount = \Cx\Lib\UpdateUtil::sql("SELECT 1\n FROM `" . DBPREFIX . "module_contact_form_submit_data`\n WHERE `id_entry` = " . $objResult->fields['id'] . "\n AND `id_field` = " . $fieldId . "\n LIMIT 1"); if ($submitCount->RecordCount() == 0) { $submitQuery = "INSERT INTO `" . DBPREFIX . "module_contact_form_submit_data` (\n `id_entry`, `id_field`, `formlabel`, `formvalue`\n ) VALUES (\n " . $objResult->fields['id'] . ",\n " . $fieldId . ",\n '" . addslashes($field_label) . "',\n '" . addslashes($field_value) . "')"; \Cx\Lib\UpdateUtil::sql($submitQuery); } } /* * Empty column 'data' of the current dataset */ $updateQuery = "UPDATE `" . DBPREFIX . "module_contact_form_data`\n SET `data` = ''\n WHERE `id` = " . $objResult->fields['id']; \Cx\Lib\UpdateUtil::sql($updateQuery); $objResult->MoveNext(); } } } /* * Alter table 'module_contact_form_data' by dropping 'data' field and adding 'id_lang' */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_data', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'primary' => true, 'auto_increment' => true), 'id_form' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'default' => 0, 'after' => 'id'), 'id_lang' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'default' => 1, 'after' => 'id_form'), 'time' => array('type' => 'INT(14)', 'notnull' => true, 'unsigned' => true, 'default' => 0, 'after' => 'id_lang'), 'host' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'after' => 'time'), 'lang' => array('type' => 'VARCHAR(64)', 'notnull' => true, 'after' => 'host'), 'browser' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'after' => 'lang'), 'ipaddress' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'after' => 'browser'))); /* * Alter table 'module_contact_form_field' by dropping name and attributes column * Add 'special_type' column */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_field', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'id_form' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => 0, 'after' => 'id'), 'type' => array('type' => 'ENUM(\'text\',\'label\',\'checkbox\',\'checkboxGroup\',\'country\',\'date\',\'file\',\'multi_file\',\'fieldset\',\'hidden\',\'horizontalLine\',\'password\',\'radio\',\'select\',\'textarea\',\'recipient\',\'special\')', 'notnull' => true, 'default' => 'text', 'after' => 'id_form'), 'special_type' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'after' => 'type'), 'is_required' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'special_type'), 'check_type' => array('type' => 'INT(3)', 'notnull' => true, 'default' => 1, 'after' => 'is_required'), 'order_id' => array('type' => 'SMALLINT(5)', 'notnull' => true, 'unsigned' => true, 'default' => 0, 'after' => 'check_type'))); /* * Update 'id_lang' column with form language id */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form', 'langId')) { $query = "SELECT `id`, `id_form` FROM `" . DBPREFIX . "module_contact_form_data`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if ($objResult) { while (!$objResult->EOF) { $query = "UPDATE `" . DBPREFIX . "module_contact_form_data`\n SET `id_lang` = (\n SELECT `langId` from `" . DBPREFIX . "module_contact_form`\n WHERE `id` = " . $objResult->fields['id_form'] . "\n ) WHERE `id` = " . $objResult->fields['id']; \Cx\Lib\UpdateUtil::sql($query); $objResult->MoveNext(); } } } /* * Create table 'module_contact_form_lang' */ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form_lang', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'formID' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'after' => 'id'), 'langID' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'after' => 'formID'), 'is_active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => 1, 'after' => 'langID'), 'name' => array('type' => 'VARCHAR(255)', 'after' => 'is_active'), 'text' => array('type' => 'TEXT', 'after' => 'name'), 'feedback' => array('type' => 'TEXT', 'after' => 'text'), 'mailTemplate' => array('type' => 'TEXT', 'after' => 'feedback'), 'subject' => array('type' => 'VARCHAR(255)', 'after' => 'mailTemplate')), array('formID' => array('fields' => array('formID', 'langID'), 'type' => 'UNIQUE'))); /* * Migrate few fields from module_contact_form to module_contact_form_lang * and remaining fields to module_contact_form of new version */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form', 'name')) { $query = "SELECT `id`, `name`, `subject`, `text`, `feedback`, `langId`\n FROM `" . DBPREFIX . "module_contact_form`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); while (!$objResult->EOF) { /* * Check for row already exsist */ $rowCountResult = \Cx\Lib\UpdateUtil::sql("SELECT 1\n FROM `" . DBPREFIX . "module_contact_form_lang`\n WHERE `formID` = " . $objResult->fields['id'] . "\n AND `langID` = " . $objResult->fields['langId'] . "\n LIMIT 1"); if ($rowCountResult->RecordCount() == 0) { $formLangQuery = "INSERT INTO `" . DBPREFIX . "module_contact_form_lang` (\n `formID`,\n `langID`,\n `is_active`,\n `name`,\n `text`,\n `feedback`,\n `mailTemplate`,\n `subject`\n ) VALUES (\n " . $objResult->fields['id'] . ",\n " . $objResult->fields['langId'] . ",\n 1,\n '" . addslashes($objResult->fields['name']) . "',\n '" . addslashes($objResult->fields['text']) . "',\n '" . addslashes($objResult->fields['feedback']) . "',\n '" . addslashes('<table> <tbody> <!-- BEGIN form_field --> <tr> <td> [[FIELD_LABEL]] </td> <td> [[FIELD_VALUE]] </td> </tr> <!-- END form_field --> </tbody> </table>') . "',\n '" . addslashes($objResult->fields['subject']) . "'\n )"; \Cx\Lib\UpdateUtil::sql($formLangQuery); } $objResult->MoveNext(); } } /* * Alter table 'module_contact_form' by dropping name, subject, feedback and form text * Add new column 'html_mail' */ if (\Cx\Lib\UpdateUtil::column_exist(DBPREFIX . 'module_contact_form', 'html_mail')) { $htmlMailIsNew = false; } else { $htmlMailIsNew = true; } \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form', array('id' => array('type' => 'INT(10)', 'notnull' => true, 'unsigned' => true, 'primary' => true, 'auto_increment' => true), 'mails' => array('type' => 'TEXT', 'after' => 'id'), 'showForm' => array('type' => 'TINYINT(1)', 'notnull' => true, 'unsigned' => true, 'default' => 0, 'after' => 'mails'), 'use_captcha' => array('type' => 'TINYINT(1)', 'notnull' => true, 'unsigned' => true, 'default' => 1, 'after' => 'showForm'), 'use_custom_style' => array('type' => 'TINYINT(1)', 'notnull' => true, 'unsigned' => true, 'default' => 0, 'after' => 'use_captcha'), 'send_copy' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0, 'after' => 'use_custom_style'), 'use_email_of_sender' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => 0, 'after' => 'send_copy'), 'html_mail' => array('type' => 'TINYINT(1)', 'notnull' => true, 'unsigned' => true, 'default' => 1, 'after' => 'use_email_of_sender'), 'send_attachment' => array('type' => 'TINYINT(1)', 'notnull' => true, 'unsigned' => true, 'default' => '0'))); if ($htmlMailIsNew) { \Cx\Lib\UpdateUtil::sql('UPDATE ' . DBPREFIX . 'module_contact_form SET html_mail = 0'); } if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.1.5')) { // for all versions >= 2.2.0 // change all fields currently set to 'file' to 'multi_file' ('multi_file' is same as former 'file' in previous versions) \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_contact_form_field` SET `type` = 'multi_file' WHERE `type` = 'file'"); } /** * Update the content pages */ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) { $em = \Env::get('em'); $cl = \Env::get('ClassLoader'); $cl->loadFile(ASCMS_CORE_MODULE_PATH . '/contact/admin.class.php'); $pageRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); $Contact = new \ContactManager(); $Contact->initContactForms(); foreach ($Contact->arrForms as $id => $form) { foreach ($form['lang'] as $langId => $lang) { if ($lang['is_active'] == true) { $page = $pageRepo->findOneByModuleCmdLang('contact', $id, $langId); if ($page) { $page->setContent($Contact->_getSourceCode($id, $langId)); $page->setUpdatedAtToNow(); $em->persist($page); } } } } $em->flush(); } /******************************************* * EXTENSION: Database structure changes * * ADDED: Contrexx v3.1.0 * *******************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_contact_form', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'mails' => array('type' => 'text', 'after' => 'id'), 'showForm' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'mails'), 'use_captcha' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'showForm'), 'use_custom_style' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'use_captcha'), 'save_data_in_crm' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'use_custom_style'), 'send_copy' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'save_data_in_crm'), 'use_email_of_sender' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'send_copy'), 'html_mail' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'use_email_of_sender'), 'send_attachment' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'html_mail'))); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _coreUpdate() { global $objUpdate, $objDatabase, $_ARRAYLANG, $_CORELANG, $_CONFIG; $query = "SELECT `id` FROM `" . DBPREFIX . "languages` WHERE `charset` != 'UTF-8'"; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { while (!$objResult->EOF) { $query = "UPDATE `" . DBPREFIX . "languages` SET `charset` = 'UTF-8' WHERE `id`=" . $objResult->fields['id']; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } $objResult->MoveNext(); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $query = "SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE `access_id` = '5' GROUP BY `group_id`"; $objGroup = $objDatabase->Execute($query); if ($objGroup !== false) { while (!$objGroup->EOF) { $query = "INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`) VALUES ('127', '" . $objGroup->fields['group_id'] . "')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } $objGroup->MoveNext(); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } /*if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) { $query = "SELECT `catid` FROM `".DBPREFIX."content_navigation`"; $objContentNavigation = $objDatabase->Execute($query); if ($objContentNavigation !== false) { $arrContentSiteIds = array(); while (!$objContentNavigation->EOF) { array_push($arrContentSiteIds, $objContentNavigation->fields['catid']); $objContentNavigation->MoveNext(); } $query = "DELETE FROM `".DBPREFIX."content` WHERE `id` != ".implode(' AND `id` != ', $arrContentSiteIds); if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } try { \Cx\Lib\UpdateUtil::table( DBPREFIX.'content_navigation', array( 'catid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'is_validated' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'parcat' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'catname' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'target' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => ''), 'displayorder' => array('type' => 'SMALLINT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '1000'), 'displaystatus' => array('type' => 'SET(\'on\',\'off\')', 'notnull' => true, 'default' => 'on'), 'activestatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'cachingstatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'username' => array('type' => 'VARCHAR(40)', 'notnull' => true, 'default' => ''), 'changelog' => array('type' => 'INT(14)', 'notnull' => false), 'cmd' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'), 'module' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'protected' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '0'), 'frontend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'backend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'themes_id' => array('type' => 'INT(4)', 'notnull' => true, 'default' => '0'), 'css_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'custom_content' => array('type' => 'VARCHAR(64)', 'after' => 'css_name', 'default' => '') ), array( 'parcat' => array('fields' => array('parcat')), 'module' => array('fields' => array('module')), 'catname' => array('fields' => array('catname')) ) ); \Cx\Lib\UpdateUtil::table( DBPREFIX.'content_navigation_history', array( 'id' => array('type' => 'INT(7)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'is_active' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '0'), 'catid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'parcat' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'catname' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => ''), 'target' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => ''), 'displayorder' => array('type' => 'SMALLINT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '1000'), 'displaystatus' => array('type' => 'SET(\'ON\',\'OFF\')', 'notnull' => true, 'default' => 'on'), 'activestatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'cachingstatus' => array('type' => 'SET(\'0\',\'1\')', 'notnull' => true, 'default' => '1'), 'username' => array('type' => 'VARCHAR(40)', 'notnull' => true, 'default' => ''), 'changelog' => array('type' => 'INT(14)', 'notnull' => false), 'cmd' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => ''), 'lang' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1'), 'module' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'startdate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'enddate' => array('type' => 'DATE', 'notnull' => true, 'default' => '0000-00-00'), 'protected' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '0'), 'frontend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'backend_access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'themes_id' => array('type' => 'INT(4)', 'notnull' => true, 'default' => '0'), 'css_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'custom_content' => array('type' => 'VARCHAR(64)', 'after' => 'css_name', 'default' => '') ), array( 'catid' => array('fields' => array('catid')) ) ); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }*/ // migrate modules table to new scheme try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'modules', array('id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => false), 'name' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'distributor' => array('type' => 'CHAR(50)', 'after' => 'name'), 'description_variable' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => '', 'after' => 'distributor'), 'status' => array('type' => 'SET(\'y\',\'n\')', 'notnull' => true, 'default' => 'n', 'after' => 'description_variable'), 'is_required' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'status'), 'is_core' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '0', 'after' => 'is_required'), 'is_active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'is_core'), 'is_licensed' => array('type' => 'TINYINT(1)', 'after' => 'is_active')), array('id' => array('fields' => array('id'), 'type' => 'UNIQUE'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'log', array('id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'userid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => false), 'datetime' => array('type' => 'datetime', 'notnull' => false, 'default' => '0000-00-00 00:00:00'), 'useragent' => array('type' => 'VARCHAR(250)', 'notnull' => false, 'default_expr' => 'NULL'), 'userlanguage' => array('type' => 'VARCHAR(250)', 'notnull' => false, 'default_expr' => 'NULL'), 'remote_addr' => array('type' => 'VARCHAR(250)', 'notnull' => false, 'default_expr' => 'NULL'), 'remote_host' => array('type' => 'VARCHAR(250)', 'notnull' => false, 'default_expr' => 'NULL'), 'http_via' => array('type' => 'VARCHAR(250)'), 'http_client_ip' => array('type' => 'VARCHAR(250)'), 'http_x_forwarded_for' => array('type' => 'VARCHAR(250)'), 'referer' => array('type' => 'VARCHAR(250)'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************** * * * MIGRATE BACKEND_AREAS TO NEW ACCESS SYSTEM * * BUGFIX: Add UNIQUE key on access_id * * * *********************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'backend_areas', array('area_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parent_area_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'type' => array('type' => 'ENUM(\'group\',\'function\',\'navigation\')', 'notnull' => false, 'default' => 'navigation'), 'scope' => array('type' => 'ENUM(\'global\',\'frontend\',\'backend\')', 'notnull' => true, 'default' => 'global', 'after' => 'type'), 'area_name' => array('type' => 'VARCHAR(100)', 'notnull' => false, 'default_expr' => 'NULL'), 'is_active' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '1'), 'uri' => array('type' => 'VARCHAR(255)'), 'target' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => '_self'), 'module_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'order_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'access_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0')), array('area_name' => array('fields' => array('area_name')))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************* * * ADD COUNTRY TABLE * ********************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'lib_country', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(64)', 'after' => 'id'), 'iso_code_2' => array('type' => 'CHAR(2)', 'after' => 'name'), 'iso_code_3' => array('type' => 'CHAR(3)', 'notnull' => false, 'after' => 'iso_code_2')), array('unique' => array('fields' => array('iso_code_2'), 'type' => 'UNIQUE'), 'INDEX_COUNTRIES_NAME' => array('fields' => array('name'))), 'InnoDB'); $arrCountries = array(1 => array('name' => 'Afghanistan', 'iso_2' => 'AF', 'iso_3' => 'AFG'), 2 => array('name' => 'Albania', 'iso_2' => 'AL', 'iso_3' => 'ALB'), 3 => array('name' => 'Algeria', 'iso_2' => 'DZ', 'iso_3' => 'DZA'), 4 => array('name' => 'American Samoa', 'iso_2' => 'AS', 'iso_3' => 'ASM'), 5 => array('name' => 'Andorra', 'iso_2' => 'AD', 'iso_3' => 'AND'), 6 => array('name' => 'Angola', 'iso_2' => 'AO', 'iso_3' => 'AGO'), 7 => array('name' => 'Anguilla', 'iso_2' => 'AI', 'iso_3' => 'AIA'), 8 => array('name' => 'Antarctica', 'iso_2' => 'AQ', 'iso_3' => 'ATA'), 9 => array('name' => 'Antigua and Barbuda', 'iso_2' => 'AG', 'iso_3' => 'ATG'), 10 => array('name' => 'Argentina', 'iso_2' => 'AR', 'iso_3' => 'ARG'), 11 => array('name' => 'Armenia', 'iso_2' => 'AM', 'iso_3' => 'ARM'), 12 => array('name' => 'Aruba', 'iso_2' => 'AW', 'iso_3' => 'ABW'), 13 => array('name' => 'Australia', 'iso_2' => 'AU', 'iso_3' => 'AUS'), 14 => array('name' => 'Österreich', 'iso_2' => 'AT', 'iso_3' => 'AUT'), 15 => array('name' => 'Azerbaijan', 'iso_2' => 'AZ', 'iso_3' => 'AZE'), 16 => array('name' => 'Bahamas', 'iso_2' => 'BS', 'iso_3' => 'BHS'), 17 => array('name' => 'Bahrain', 'iso_2' => 'BH', 'iso_3' => 'BHR'), 18 => array('name' => 'Bangladesh', 'iso_2' => 'BD', 'iso_3' => 'BGD'), 19 => array('name' => 'Barbados', 'iso_2' => 'BB', 'iso_3' => 'BRB'), 20 => array('name' => 'Belarus', 'iso_2' => 'BY', 'iso_3' => 'BLR'), 21 => array('name' => 'Belgium', 'iso_2' => 'BE', 'iso_3' => 'BEL'), 22 => array('name' => 'Belize', 'iso_2' => 'BZ', 'iso_3' => 'BLZ'), 23 => array('name' => 'Benin', 'iso_2' => 'BJ', 'iso_3' => 'BEN'), 24 => array('name' => 'Bermuda', 'iso_2' => 'BM', 'iso_3' => 'BMU'), 25 => array('name' => 'Bhutan', 'iso_2' => 'BT', 'iso_3' => 'BTN'), 26 => array('name' => 'Bolivia', 'iso_2' => 'BO', 'iso_3' => 'BOL'), 27 => array('name' => 'Bosnia and Herzegowina', 'iso_2' => 'BA', 'iso_3' => 'BIH'), 28 => array('name' => 'Botswana', 'iso_2' => 'BW', 'iso_3' => 'BWA'), 29 => array('name' => 'Bouvet Island', 'iso_2' => 'BV', 'iso_3' => 'BVT'), 30 => array('name' => 'Brazil', 'iso_2' => 'BR', 'iso_3' => 'BRA'), 31 => array('name' => 'British Indian Ocean Territory', 'iso_2' => 'IO', 'iso_3' => 'IOT'), 32 => array('name' => 'Brunei Darussalam', 'iso_2' => 'BN', 'iso_3' => 'BRN'), 33 => array('name' => 'Bulgaria', 'iso_2' => 'BG', 'iso_3' => 'BGR'), 34 => array('name' => 'Burkina Faso', 'iso_2' => 'BF', 'iso_3' => 'BFA'), 35 => array('name' => 'Burundi', 'iso_2' => 'BI', 'iso_3' => 'BDI'), 36 => array('name' => 'Cambodia', 'iso_2' => 'KH', 'iso_3' => 'KHM'), 37 => array('name' => 'Cameroon', 'iso_2' => 'CM', 'iso_3' => 'CMR'), 38 => array('name' => 'Canada', 'iso_2' => 'CA', 'iso_3' => 'CAN'), 39 => array('name' => 'Cape Verde', 'iso_2' => 'CV', 'iso_3' => 'CPV'), 40 => array('name' => 'Cayman Islands', 'iso_2' => 'KY', 'iso_3' => 'CYM'), 41 => array('name' => 'Central African Republic', 'iso_2' => 'CF', 'iso_3' => 'CAF'), 42 => array('name' => 'Chad', 'iso_2' => 'TD', 'iso_3' => 'TCD'), 43 => array('name' => 'Chile', 'iso_2' => 'CL', 'iso_3' => 'CHL'), 44 => array('name' => 'China', 'iso_2' => 'CN', 'iso_3' => 'CHN'), 45 => array('name' => 'Christmas Island', 'iso_2' => 'CX', 'iso_3' => 'CXR'), 46 => array('name' => 'Cocos (Keeling) Islands', 'iso_2' => 'CC', 'iso_3' => 'CCK'), 47 => array('name' => 'Colombia', 'iso_2' => 'CO', 'iso_3' => 'COL'), 48 => array('name' => 'Comoros', 'iso_2' => 'KM', 'iso_3' => 'COM'), 49 => array('name' => 'Congo', 'iso_2' => 'CG', 'iso_3' => 'COG'), 50 => array('name' => 'Cook Islands', 'iso_2' => 'CK', 'iso_3' => 'C*K'), 51 => array('name' => 'Costa Rica', 'iso_2' => 'CR', 'iso_3' => 'CRI'), 52 => array('name' => 'Cote D\'Ivoire', 'iso_2' => 'CI', 'iso_3' => 'CIV'), 53 => array('name' => 'Croatia', 'iso_2' => 'HR', 'iso_3' => 'HRV'), 54 => array('name' => 'Cuba', 'iso_2' => 'CU', 'iso_3' => 'CUB'), 55 => array('name' => 'Cyprus', 'iso_2' => 'CY', 'iso_3' => 'CYP'), 56 => array('name' => 'Czech Republic', 'iso_2' => 'CZ', 'iso_3' => 'CZE'), 57 => array('name' => 'Denmark', 'iso_2' => 'DK', 'iso_3' => 'DNK'), 58 => array('name' => 'Djibouti', 'iso_2' => 'DJ', 'iso_3' => 'DJI'), 59 => array('name' => 'Dominica', 'iso_2' => 'DM', 'iso_3' => 'DMA'), 60 => array('name' => 'Dominican Republic', 'iso_2' => 'DO', 'iso_3' => 'DOM'), 61 => array('name' => 'East Timor', 'iso_2' => 'TP', 'iso_3' => 'TMP'), 62 => array('name' => 'Ecuador', 'iso_2' => 'EC', 'iso_3' => 'ECU'), 63 => array('name' => 'Egypt', 'iso_2' => 'EG', 'iso_3' => 'EGY'), 64 => array('name' => 'El Salvador', 'iso_2' => 'SV', 'iso_3' => 'SLV'), 65 => array('name' => 'Equatorial Guinea', 'iso_2' => 'GQ', 'iso_3' => 'GNQ'), 66 => array('name' => 'Eritrea', 'iso_2' => 'ER', 'iso_3' => 'ERI'), 67 => array('name' => 'Estonia', 'iso_2' => 'EE', 'iso_3' => 'EST'), 68 => array('name' => 'Ethiopia', 'iso_2' => 'ET', 'iso_3' => 'ETH'), 69 => array('name' => 'Falkland Islands (Malvinas)', 'iso_2' => 'FK', 'iso_3' => 'FLK'), 70 => array('name' => 'Faroe Islands', 'iso_2' => 'FO', 'iso_3' => 'FRO'), 71 => array('name' => 'Fiji', 'iso_2' => 'FJ', 'iso_3' => 'FJI'), 72 => array('name' => 'Finland', 'iso_2' => 'FI', 'iso_3' => 'FIN'), 73 => array('name' => 'France', 'iso_2' => 'FR', 'iso_3' => 'FRA'), 74 => array('name' => 'France, Metropolitan', 'iso_2' => 'FX', 'iso_3' => 'FXX'), 75 => array('name' => 'French Guiana', 'iso_2' => 'GF', 'iso_3' => 'GUF'), 76 => array('name' => 'French Polynesia', 'iso_2' => 'PF', 'iso_3' => 'PYF'), 77 => array('name' => 'French Southern Territories', 'iso_2' => 'TF', 'iso_3' => 'ATF'), 78 => array('name' => 'Gabon', 'iso_2' => 'GA', 'iso_3' => 'GAB'), 79 => array('name' => 'Gambia', 'iso_2' => 'GM', 'iso_3' => 'GMB'), 80 => array('name' => 'Georgia', 'iso_2' => 'GE', 'iso_3' => 'GEO'), 81 => array('name' => 'Deutschland', 'iso_2' => 'DE', 'iso_3' => 'DEU'), 82 => array('name' => 'Ghana', 'iso_2' => 'GH', 'iso_3' => 'GHA'), 83 => array('name' => 'Gibraltar', 'iso_2' => 'GI', 'iso_3' => 'GIB'), 84 => array('name' => 'Greece', 'iso_2' => 'GR', 'iso_3' => 'GRC'), 85 => array('name' => 'Greenland', 'iso_2' => 'GL', 'iso_3' => 'GRL'), 86 => array('name' => 'Grenada', 'iso_2' => 'GD', 'iso_3' => 'GRD'), 87 => array('name' => 'Guadeloupe', 'iso_2' => 'GP', 'iso_3' => 'GLP'), 88 => array('name' => 'Guam', 'iso_2' => 'GU', 'iso_3' => 'GUM'), 89 => array('name' => 'Guatemala', 'iso_2' => 'GT', 'iso_3' => 'GTM'), 90 => array('name' => 'Guinea', 'iso_2' => 'GN', 'iso_3' => 'GIN'), 91 => array('name' => 'Guinea-bissau', 'iso_2' => 'GW', 'iso_3' => 'GNB'), 92 => array('name' => 'Guyana', 'iso_2' => 'GY', 'iso_3' => 'GUY'), 93 => array('name' => 'Haiti', 'iso_2' => 'HT', 'iso_3' => 'HTI'), 94 => array('name' => 'Heard and Mc Donald Islands', 'iso_2' => 'HM', 'iso_3' => 'HMD'), 95 => array('name' => 'Honduras', 'iso_2' => 'HN', 'iso_3' => 'HND'), 96 => array('name' => 'Hong Kong', 'iso_2' => 'HK', 'iso_3' => 'HKG'), 97 => array('name' => 'Hungary', 'iso_2' => 'HU', 'iso_3' => 'HUN'), 98 => array('name' => 'Iceland', 'iso_2' => 'IS', 'iso_3' => 'ISL'), 99 => array('name' => 'India', 'iso_2' => 'IN', 'iso_3' => 'IND'), 100 => array('name' => 'Indonesia', 'iso_2' => 'ID', 'iso_3' => 'IDN'), 101 => array('name' => 'Iran (Islamic Republic of)', 'iso_2' => 'IR', 'iso_3' => 'IRN'), 102 => array('name' => 'Iraq', 'iso_2' => 'IQ', 'iso_3' => 'IRQ'), 103 => array('name' => 'Ireland', 'iso_2' => 'IE', 'iso_3' => 'IRL'), 104 => array('name' => 'Israel', 'iso_2' => 'IL', 'iso_3' => 'ISR'), 105 => array('name' => 'Italy', 'iso_2' => 'IT', 'iso_3' => 'ITA'), 106 => array('name' => 'Jamaica', 'iso_2' => 'JM', 'iso_3' => 'JAM'), 107 => array('name' => 'Japan', 'iso_2' => 'JP', 'iso_3' => 'JPN'), 108 => array('name' => 'Jordan', 'iso_2' => 'JO', 'iso_3' => 'JOR'), 109 => array('name' => 'Kazakhstan', 'iso_2' => 'KZ', 'iso_3' => 'KAZ'), 110 => array('name' => 'Kenya', 'iso_2' => 'KE', 'iso_3' => 'KEN'), 111 => array('name' => 'Kiribati', 'iso_2' => 'KI', 'iso_3' => 'KIR'), 112 => array('name' => 'Korea, Democratic People\'s Republic of', 'iso_2' => 'KP', 'iso_3' => 'PRK'), 113 => array('name' => 'Korea, Republic of', 'iso_2' => 'KR', 'iso_3' => 'KOR'), 114 => array('name' => 'Kuwait', 'iso_2' => 'KW', 'iso_3' => 'KWT'), 115 => array('name' => 'Kyrgyzstan', 'iso_2' => 'KG', 'iso_3' => 'KGZ'), 116 => array('name' => 'Lao People\'s Democratic Republic', 'iso_2' => 'LA', 'iso_3' => 'LAO'), 117 => array('name' => 'Latvia', 'iso_2' => 'LV', 'iso_3' => 'LVA'), 118 => array('name' => 'Lebanon', 'iso_2' => 'LB', 'iso_3' => 'LBN'), 119 => array('name' => 'Lesotho', 'iso_2' => 'LS', 'iso_3' => 'LSO'), 120 => array('name' => 'Liberia', 'iso_2' => 'LR', 'iso_3' => 'LBR'), 121 => array('name' => 'Libyan Arab Jamahiriya', 'iso_2' => 'LY', 'iso_3' => 'LBY'), 122 => array('name' => 'Liechtenstein', 'iso_2' => 'LI', 'iso_3' => 'LIE'), 123 => array('name' => 'Lithuania', 'iso_2' => 'LT', 'iso_3' => 'LTU'), 124 => array('name' => 'Luxembourg', 'iso_2' => 'LU', 'iso_3' => 'LUX'), 125 => array('name' => 'Macau', 'iso_2' => 'MO', 'iso_3' => 'MAC'), 126 => array('name' => 'Macedonia, The Former Yugoslav Republic of', 'iso_2' => 'MK', 'iso_3' => 'MKD'), 127 => array('name' => 'Madagascar', 'iso_2' => 'MG', 'iso_3' => 'MDG'), 128 => array('name' => 'Malawi', 'iso_2' => 'MW', 'iso_3' => 'MWI'), 129 => array('name' => 'Malaysia', 'iso_2' => 'MY', 'iso_3' => 'MYS'), 130 => array('name' => 'Maldives', 'iso_2' => 'MV', 'iso_3' => 'MDV'), 131 => array('name' => 'Mali', 'iso_2' => 'ML', 'iso_3' => 'MLI'), 132 => array('name' => 'Malta', 'iso_2' => 'MT', 'iso_3' => 'MLT'), 133 => array('name' => 'Marshall Islands', 'iso_2' => 'MH', 'iso_3' => 'MHL'), 134 => array('name' => 'Martinique', 'iso_2' => 'MQ', 'iso_3' => 'MTQ'), 135 => array('name' => 'Mauritania', 'iso_2' => 'MR', 'iso_3' => 'MRT'), 136 => array('name' => 'Mauritius', 'iso_2' => 'MU', 'iso_3' => 'MUS'), 137 => array('name' => 'Mayotte', 'iso_2' => 'YT', 'iso_3' => 'MYT'), 138 => array('name' => 'Mexico', 'iso_2' => 'MX', 'iso_3' => 'MEX'), 139 => array('name' => 'Micronesia, Federated States of', 'iso_2' => 'FM', 'iso_3' => 'FSM'), 140 => array('name' => 'Moldova, Republic of', 'iso_2' => 'MD', 'iso_3' => 'MDA'), 141 => array('name' => 'Monaco', 'iso_2' => 'MC', 'iso_3' => 'MCO'), 142 => array('name' => 'Mongolia', 'iso_2' => 'MN', 'iso_3' => 'MNG'), 143 => array('name' => 'Montserrat', 'iso_2' => 'MS', 'iso_3' => 'MSR'), 144 => array('name' => 'Morocco', 'iso_2' => 'MA', 'iso_3' => 'MAR'), 145 => array('name' => 'Mozambique', 'iso_2' => 'MZ', 'iso_3' => 'MOZ'), 146 => array('name' => 'Myanmar', 'iso_2' => 'MM', 'iso_3' => 'MMR'), 147 => array('name' => 'Namibia', 'iso_2' => 'NA', 'iso_3' => 'NAM'), 148 => array('name' => 'Nauru', 'iso_2' => 'NR', 'iso_3' => 'NRU'), 149 => array('name' => 'Nepal', 'iso_2' => 'NP', 'iso_3' => 'NPL'), 150 => array('name' => 'Netherlands', 'iso_2' => 'NL', 'iso_3' => 'NLD'), 151 => array('name' => 'Netherlands Antilles', 'iso_2' => 'AN', 'iso_3' => 'ANT'), 152 => array('name' => 'New Caledonia', 'iso_2' => 'NC', 'iso_3' => 'NCL'), 153 => array('name' => 'New Zealand', 'iso_2' => 'NZ', 'iso_3' => 'NZL'), 154 => array('name' => 'Nicaragua', 'iso_2' => 'NI', 'iso_3' => 'NIC'), 155 => array('name' => 'Niger', 'iso_2' => 'NE', 'iso_3' => 'NER'), 156 => array('name' => 'Nigeria', 'iso_2' => 'NG', 'iso_3' => 'NGA'), 157 => array('name' => 'Niue', 'iso_2' => 'NU', 'iso_3' => 'NIU'), 158 => array('name' => 'Norfolk Island', 'iso_2' => 'NF', 'iso_3' => 'NFK'), 159 => array('name' => 'Northern Mariana Islands', 'iso_2' => 'MP', 'iso_3' => 'MNP'), 160 => array('name' => 'Norway', 'iso_2' => 'NO', 'iso_3' => 'NOR'), 161 => array('name' => 'Oman', 'iso_2' => 'OM', 'iso_3' => 'OMN'), 162 => array('name' => 'Pakistan', 'iso_2' => 'PK', 'iso_3' => 'PAK'), 163 => array('name' => 'Palau', 'iso_2' => 'PW', 'iso_3' => 'PLW'), 164 => array('name' => 'Panama', 'iso_2' => 'PA', 'iso_3' => 'PAN'), 165 => array('name' => 'Papua New Guinea', 'iso_2' => 'PG', 'iso_3' => 'PNG'), 166 => array('name' => 'Paraguay', 'iso_2' => 'PY', 'iso_3' => 'PRY'), 167 => array('name' => 'Peru', 'iso_2' => 'PE', 'iso_3' => 'PER'), 168 => array('name' => 'Philippines', 'iso_2' => 'PH', 'iso_3' => 'PHL'), 169 => array('name' => 'Pitcairn', 'iso_2' => 'PN', 'iso_3' => 'PCN'), 170 => array('name' => 'Poland', 'iso_2' => 'PL', 'iso_3' => 'POL'), 171 => array('name' => 'Portugal', 'iso_2' => 'PT', 'iso_3' => 'PRT'), 172 => array('name' => 'Puerto Rico', 'iso_2' => 'PR', 'iso_3' => 'PRI'), 173 => array('name' => 'Qatar', 'iso_2' => 'QA', 'iso_3' => 'QAT'), 174 => array('name' => 'Reunion', 'iso_2' => 'RE', 'iso_3' => 'REU'), 175 => array('name' => 'Romania', 'iso_2' => 'RO', 'iso_3' => 'ROM'), 176 => array('name' => 'Russian Federation', 'iso_2' => 'RU', 'iso_3' => 'RUS'), 177 => array('name' => 'Rwanda', 'iso_2' => 'RW', 'iso_3' => 'RWA'), 178 => array('name' => 'Saint Kitts and Nevis', 'iso_2' => 'KN', 'iso_3' => 'KNA'), 179 => array('name' => 'Saint Lucia', 'iso_2' => 'LC', 'iso_3' => 'LCA'), 180 => array('name' => 'Saint Vincent and the Grenadines', 'iso_2' => 'VC', 'iso_3' => 'VCT'), 181 => array('name' => 'Samoa', 'iso_2' => 'WS', 'iso_3' => 'WSM'), 182 => array('name' => 'San Marino', 'iso_2' => 'SM', 'iso_3' => 'SMR'), 183 => array('name' => 'Sao Tome and Principe', 'iso_2' => 'ST', 'iso_3' => 'STP'), 184 => array('name' => 'Saudi Arabia', 'iso_2' => 'SA', 'iso_3' => 'SAU'), 185 => array('name' => 'Senegal', 'iso_2' => 'SN', 'iso_3' => 'SEN'), 186 => array('name' => 'Seychelles', 'iso_2' => 'SC', 'iso_3' => 'SYC'), 187 => array('name' => 'Sierra Leone', 'iso_2' => 'SL', 'iso_3' => 'SLE'), 188 => array('name' => 'Singapore', 'iso_2' => 'SG', 'iso_3' => 'SGP'), 189 => array('name' => 'Slovakia (Slovak Republic)', 'iso_2' => 'SK', 'iso_3' => 'SVK'), 190 => array('name' => 'Slovenia', 'iso_2' => 'SI', 'iso_3' => 'SVN'), 191 => array('name' => 'Solomon Islands', 'iso_2' => 'SB', 'iso_3' => 'SLB'), 192 => array('name' => 'Somalia', 'iso_2' => 'SO', 'iso_3' => 'SOM'), 193 => array('name' => 'South Africa', 'iso_2' => 'ZA', 'iso_3' => 'ZAF'), 194 => array('name' => 'South Georgia and the South Sandwich Islands', 'iso_2' => 'GS', 'iso_3' => 'SGS'), 195 => array('name' => 'Spain', 'iso_2' => 'ES', 'iso_3' => 'ESP'), 196 => array('name' => 'Sri Lanka', 'iso_2' => 'LK', 'iso_3' => 'LKA'), 197 => array('name' => 'St. Helena', 'iso_2' => 'SH', 'iso_3' => 'SHN'), 198 => array('name' => 'St. Pierre and Miquelon', 'iso_2' => 'PM', 'iso_3' => 'SPM'), 199 => array('name' => 'Sudan', 'iso_2' => 'SD', 'iso_3' => 'SDN'), 200 => array('name' => 'Suriname', 'iso_2' => 'SR', 'iso_3' => 'SUR'), 201 => array('name' => 'Svalbard and Jan Mayen Islands', 'iso_2' => 'SJ', 'iso_3' => 'SJM'), 202 => array('name' => 'Swaziland', 'iso_2' => 'SZ', 'iso_3' => 'SWZ'), 203 => array('name' => 'Sweden', 'iso_2' => 'SE', 'iso_3' => 'SWE'), 204 => array('name' => 'Schweiz', 'iso_2' => 'CH', 'iso_3' => 'CHE'), 205 => array('name' => 'Syrian Arab Republic', 'iso_2' => 'SY', 'iso_3' => 'SYR'), 206 => array('name' => 'Taiwan', 'iso_2' => 'TW', 'iso_3' => 'TWN'), 207 => array('name' => 'Tajikistan', 'iso_2' => 'TJ', 'iso_3' => 'TJK'), 208 => array('name' => 'Tanzania, United Republic of', 'iso_2' => 'TZ', 'iso_3' => 'TZA'), 209 => array('name' => 'Thailand', 'iso_2' => 'TH', 'iso_3' => 'THA'), 210 => array('name' => 'Togo', 'iso_2' => 'TG', 'iso_3' => 'TGO'), 211 => array('name' => 'Tokelau', 'iso_2' => 'TK', 'iso_3' => 'TKL'), 212 => array('name' => 'Tonga', 'iso_2' => 'TO', 'iso_3' => 'TON'), 213 => array('name' => 'Trinidad and Tobago', 'iso_2' => 'TT', 'iso_3' => 'TTO'), 214 => array('name' => 'Tunisia', 'iso_2' => 'TN', 'iso_3' => 'TUN'), 215 => array('name' => 'Turkey', 'iso_2' => 'TR', 'iso_3' => 'TUR'), 216 => array('name' => 'Turkmenistan', 'iso_2' => 'TM', 'iso_3' => 'TKM'), 217 => array('name' => 'Turks and Caicos Islands', 'iso_2' => 'TC', 'iso_3' => 'TCA'), 218 => array('name' => 'Tuvalu', 'iso_2' => 'TV', 'iso_3' => 'TUV'), 219 => array('name' => 'Uganda', 'iso_2' => 'UG', 'iso_3' => 'UGA'), 220 => array('name' => 'Ukraine', 'iso_2' => 'UA', 'iso_3' => 'UKR'), 221 => array('name' => 'United Arab Emirates', 'iso_2' => 'AE', 'iso_3' => 'ARE'), 222 => array('name' => 'United Kingdom', 'iso_2' => 'GB', 'iso_3' => 'GBR'), 223 => array('name' => 'United States', 'iso_2' => 'US', 'iso_3' => 'USA'), 224 => array('name' => 'United States Minor Outlying Islands', 'iso_2' => 'UM', 'iso_3' => 'UMI'), 225 => array('name' => 'Uruguay', 'iso_2' => 'UY', 'iso_3' => 'URY'), 226 => array('name' => 'Uzbekistan', 'iso_2' => 'UZ', 'iso_3' => 'UZB'), 227 => array('name' => 'Vanuatu', 'iso_2' => 'VU', 'iso_3' => 'VUT'), 228 => array('name' => 'Vatican City State (Holy See)', 'iso_2' => 'VA', 'iso_3' => 'VAT'), 229 => array('name' => 'Venezuela', 'iso_2' => 'VE', 'iso_3' => 'VEN'), 230 => array('name' => 'Viet Nam', 'iso_2' => 'VN', 'iso_3' => 'VNM'), 231 => array('name' => 'Virgin Islands (British)', 'iso_2' => 'VG', 'iso_3' => 'VGB'), 232 => array('name' => 'Virgin Islands (U.S.)', 'iso_2' => 'VI', 'iso_3' => 'VIR'), 233 => array('name' => 'Wallis and Futuna Islands', 'iso_2' => 'WF', 'iso_3' => 'WLF'), 234 => array('name' => 'Western Sahara', 'iso_2' => 'EH', 'iso_3' => 'ESH'), 235 => array('name' => 'Yemen', 'iso_2' => 'YE', 'iso_3' => 'YEM'), 236 => array('name' => 'Yugoslavia', 'iso_2' => 'YU', 'iso_3' => 'YUG'), 237 => array('name' => 'Zaire', 'iso_2' => 'ZR', 'iso_3' => 'ZAR'), 238 => array('name' => 'Zambia', 'iso_2' => 'ZM', 'iso_3' => 'ZMB'), 239 => array('name' => 'Zimbabwe', 'iso_2' => 'ZW', 'iso_3' => 'ZWE')); foreach ($arrCountries as $countryId => $arrCountry) { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "lib_country` VALUES (" . $countryId . ", '" . addslashes($arrCountry['name']) . "', '" . $arrCountry['iso_2'] . "', '" . $arrCountry['iso_3'] . "') ON DUPLICATE KEY UPDATE `id` = `id`"); } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { /********************************************************** * NEW IN VERSION 2.1: templates for mobile devices! * ***********************************************************/ /********************************************************** * EXTENSION: Fallback language and app device template * * ADDED: Contrexx v3.0.0 * ***********************************************************/ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'languages', array('id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'lang' => array('type' => 'VARCHAR(5)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'name' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'lang'), 'charset' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => 'iso-8859-1', 'after' => 'name'), 'themesid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'charset'), 'print_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'themesid'), 'pdf_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'print_themes_id'), 'frontend' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'pdf_themes_id'), 'backend' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'frontend'), 'is_default' => array('type' => 'SET(\'true\',\'false\')', 'notnull' => true, 'default' => 'false', 'after' => 'backend'), 'mobile_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'is_default'), 'fallback' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'mobile_themes_id'), 'app_themes_id' => array('type' => 'INT(2)', 'after' => 'fallback')), array('lang' => array('fields' => array('lang'), 'type' => 'UNIQUE'), 'defaultstatus' => array('fields' => array('is_default')))); \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'languages` SET `app_themes_id` = `themesid` WHERE `app_themes_id` = 0'); \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'languages` SET `mobile_themes_id` = `themesid` WHERE `mobile_themes_id` = 0'); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { /******************************************************************** * NEW IN VERSION 3.1.1: no fallback language should be possible ********************************************************************/ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'languages', array('id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'lang' => array('type' => 'VARCHAR(5)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'name' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'lang'), 'charset' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => 'iso-8859-1', 'after' => 'name'), 'themesid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'charset'), 'print_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'themesid'), 'pdf_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'print_themes_id'), 'frontend' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'pdf_themes_id'), 'backend' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'frontend'), 'is_default' => array('type' => 'SET(\'true\',\'false\')', 'notnull' => true, 'default' => 'false', 'after' => 'backend'), 'mobile_themes_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'is_default'), 'fallback' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => false, 'default' => '0', 'after' => 'mobile_themes_id'), 'app_themes_id' => array('type' => 'INT(2)', 'after' => 'fallback')), array('lang' => array('fields' => array('lang'), 'type' => 'UNIQUE'), 'defaultstatus' => array('fields' => array('is_default')), 'name' => array('fields' => array('name')), 'name_2' => array('fields' => array('name'), 'type' => 'FULLTEXT'))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************************** * Add unique index on theme name. Who needs multiple * themes with the same name anyways? Are there people * who know the difference between "aaa" and "aaa"? Guess * not. It's just useless. * NOTE THIS KICKS OUT ALL DUPLICATE DESIGNS WITH THE * SAME NAME FROM THE DATABASE. WHICH I CONSIDER A * NECCESSARY EVIL. **********************************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'skins', array('id' => array('type' => 'INT(2) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'themesname' => array('type' => 'VARCHAR(50)', 'notnull' => true), 'foldername' => array('type' => 'VARCHAR(50)', 'notnull' => true), 'expert' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1')), array('theme_unique' => array('fields' => array('themesname'), 'type' => 'UNIQUE', 'force' => true), 'folder_unique' => array('fields' => array('foldername'), 'type' => 'UNIQUE', 'force' => true))); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /*********************************************************** * EXTENSION: css class instead of id for auto generated * * submenu in nested navigation * * ADDED: Contrexx v3.0.0 * ************************************************************/ function changeNestedNavigationCss($directory) { if ($handle = opendir($directory)) { while (($file = readdir($handle)) !== false) { if (!in_array($file, array('.', '..', '.svn'))) { $file = $directory . '/' . $file; if (is_dir($file)) { changeNestedNavigationCss($file); } else { if (substr($file, -4) == '.css') { try { $objFile = new \Cx\Lib\FileSystem\File($file); if (($data = $objFile->getData()) && !empty($data)) { $objFile->write(preg_replace('/#menu_level_(\\d+)(?!([\\w-_]+))/i', '.menu_level_\\1', $data)); } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { \DBG::msg($e->getMessage()); return false; } } } } } closedir($handle); } } $path = ASCMS_DOCUMENT_ROOT . '/themes'; foreach (scandir($path) as $theme) { if (!in_array($theme, array('.', '..'))) { $theme = $path . '/' . $theme; $changeNestedNavigationCss = false; $navigationFiles = array('navbar.html', 'navbar2.html', 'navbar3.html', 'subnavbar.html', 'subnavbar2.html', 'subnavbar3.html'); foreach ($navigationFiles as $file) { $file = $theme . '/' . $file; if (file_exists($file)) { try { $objFile = new \Cx\Lib\FileSystem\File($file); if (($data = $objFile->getData()) && !empty($data)) { if (strpos($data, 'nested_navigation') !== false) { $changeNestedNavigationCss = true; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { \DBG::msg($e->getMessage()); } } } if ($changeNestedNavigationCss) { changeNestedNavigationCss($theme); } } } /***************************************** * EXTENSION: {JAVASCRIPT} placeholder * * ADDED: Contrexx v2.1.0 * *****************************************/ $path = ASCMS_DOCUMENT_ROOT . '/themes'; foreach (scandir($path) as $theme) { if (!in_array($theme, array('.', '..', '.svn'))) { $theme = $path . '/' . $theme; $file = $theme . '/index.html'; if (file_exists($file)) { try { $objFile = new \Cx\Lib\FileSystem\File($file); if (($data = $objFile->getData()) && !empty($data)) { if (strpos($data, '{JAVASCRIPT}') === false) { $data = preg_replace('/(\\s*)<\\/head>/ms', "\$1 {JAVASCRIPT}\$1</head>", $data); if ($data) { $objFile->write($data); } } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { \DBG::msg($e->getMessage()); } } } } /******************************** * EXTENSION: Timezone * * ADDED: Contrexx v3.0.0 * ********************************/ try { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'log` CHANGE `datetime` `datetime` TIMESTAMP NULL DEFAULT "0000-00-00 00:00:00"'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************************** * EXTENSION: Session garbage collector considers now * * the individual lifetime of each session * * (needed since remember me is implemented) * * ADDED: Contrexx v3.0.1 * ***********************************************************/ try { $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'sessions'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'sessions')); return false; } if (!isset($arrColumns['REMEMBER_ME'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'sessions` ADD `remember_me` INT(1) NOT NULL DEFAULT 0 AFTER `sessionid`'); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /********************************************************** * EXTENSION: Delete old cache class which causes * * classloader confliction. * * ADDED: Contrexx v3.0.1 * ***********************************************************/ $path = ASCMS_DOCUMENT_ROOT . '/lib/FRAMEWORK/Cache.class.php'; if (file_exists($path)) { if (!\Cx\Lib\FileSystem\FileSystem::delete_file($path)) { setUpdateMsg('Die Datei "/lib/FRAMEWORK/Cache.class.php" konnte nicht gelöscht werden. Bitte löschen Sie diese manuell.', 'error'); setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_UPDATE_TRY_AGAIN'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button'); return false; } } /******************************************************** * EXTENSION: Add new access id (178) to those groups * * having access to the news (10) or * * blog (119) module. * * ADDED: Contrexx v3.1.0 * ********************************************************/ try { \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'access_group_static_ids` (`access_id`, `group_id`) SELECT 178, `group_id` FROM `' . DBPREFIX . 'access_group_static_ids` WHERE (`access_id` = 10) OR (`access_id` = 119) GROUP BY `group_id` ON DUPLICATE KEY UPDATE `access_id` = `access_id` '); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { Text::errorHandler(); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { \Cx\Core\Setting\Controller\Setting::errorHandler(); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /******************************************************** * EXTENSION: ADD COMPONENTS TABLE * * ADDED: Contrexx v3.1.0 * ********************************************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'component', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'name' => array('type' => 'VARCHAR(100)', 'after' => 'id'), 'type' => array('type' => 'ENUM(\'core\',\'core_module\',\'module\')', 'after' => 'name')), null, 'InnoDB'); \Cx\Lib\UpdateUtil::sql("\n INSERT IGNORE INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES\n (70, 'Workbench', 'core_module'),\n (71, 'FrontendEditing', 'core_module'),\n (72, 'ContentManager', 'core')\n "); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } return true; }
/** * Cloudrexx * * @link http://www.cloudrexx.com * @copyright Cloudrexx AG 2007-2015 * * According to our dual licensing model, this program can be used either * under the terms of the GNU Affero General Public License, version 3, * or under a proprietary license. * * The texts of the GNU Affero General Public License with an additional * permission and of our proprietary license can be found at and * in the LICENSE file you have received along with this program. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * "Cloudrexx" is a registered trademark of Cloudrexx AG. * The licensing of the program under the AGPLv3 does not imply a * trademark license. Therefore any rights, title and interest in * our trademarks remain entirely with us. */ function _accessUpdate() { global $objDatabase, $objUpdate, $_CONFIG, $_ARRAYLANG, $_CORELANG; $arrTables = $objDatabase->MetaTables('TABLES'); if (!$arrTables) { setUpdateMsg($_ARRAYLANG['TXT_UNABLE_DETERMINE_DATABASE_STRUCTURE']); return false; } /**************************** * * ADD NOTIFICATION E-MAILS * ***************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_mail', array('type' => array('type' => 'ENUM(\'reg_confirm\',\'reset_pw\',\'user_activated\',\'user_deactivated\',\'new_user\')', 'notnull' => true, 'default' => 'reg_confirm'), 'lang_id' => array('type' => 'TINYINT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'sender_mail' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'sender_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'subject' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => ''), 'format' => array('type' => 'ENUM(\'text\',\'html\',\'multipart\')', 'notnull' => true, 'default' => 'text'), 'body_text' => array('type' => 'TEXT'), 'body_html' => array('type' => 'TEXT')), array('mail' => array('fields' => array('type', 'lang_id'), 'type' => 'UNIQUE')), 'InnoDB'); $result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_dynamic_ids`'); if ($result->EOF) { \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_dynamic_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )'); } $result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_static_ids`'); if ($result->EOF) { \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_static_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )'); } } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } \DBG::msg('001'); $arrMails = array(array('type' => 'reg_confirm', 'subject' => 'Benutzerregistrierung bestätigen', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nVielen Dank für Ihre Anmeldung bei [[HOST]].\\r\\nBitte klicken Sie auf den folgenden Link, um Ihre E-Mail-Adresse zu bestätigen:\\r\\n[[ACTIVATION_LINK]]\\r\\n\\r\\nUm sich später einzuloggen, geben Sie bitte Ihren Benutzernamen \\"[[USERNAME]]\\" und das Passwort ein, das Sie bei der Registrierung festgelegt haben.\\r\\n\\r\\n\\r\\n--\\r\\nIhr [[SENDER]]'), array('type' => 'reset_pw', 'subject' => 'Kennwort zurücksetzen', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nUm ein neues Passwort zu wählen, müssen Sie auf die unten aufgeführte URL gehen und dort Ihr neues Passwort eingeben.\\r\\n\\r\\nWICHTIG: Die Gültigkeit der URL wird nach 60 Minuten verfallen, nachdem diese E-Mail abgeschickt wurde.\\r\\nFalls Sie mehr Zeit benötigen, geben Sie Ihre E-Mail Adresse einfach ein weiteres Mal ein.\\r\\n\\r\\nIhre URL:\\r\\n[[URL]]\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'user_activated', 'subject' => 'Ihr Benutzerkonto wurde aktiviert', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nIhr Benutzerkonto auf [[HOST]] wurde soeben aktiviert und kann von nun an verwendet werden.\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'user_deactivated', 'subject' => 'Ihr Benutzerkonto wurde deaktiviert', 'body_text' => 'Hallo [[USERNAME]],\\r\\n\\r\\nIhr Benutzerkonto auf [[HOST]] wurde soeben deaktiviert.\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]'), array('type' => 'new_user', 'subject' => 'Ein neuer Benutzer hat sich registriert', 'body_text' => 'Der Benutzer [[USERNAME]] hat sich soeben registriert und muss nun frei geschaltet werden.\\r\\n\\r\\nÜber die folgende Adresse kann das Benutzerkonto von [[USERNAME]] verwaltet werden:\\r\\n[[LINK]]\\r\\n\\r\\n\\r\\n--\\r\\n[[SENDER]]')); foreach ($arrMails as $arrMail) { $query = "SELECT 1 FROM `" . DBPREFIX . "access_user_mail` WHERE `type` = '" . $arrMail['type'] . "'"; $objMail = $objDatabase->SelectLimit($query, 1); if ($objMail !== false) { if ($objMail->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "access_user_mail` (\n `type`,\n `lang_id`,\n `sender_mail`,\n `sender_name`,\n `subject`,\n `body_text`,\n `body_html`\n ) VALUES (\n '" . $arrMail['type'] . "',\n 0,\n '" . addslashes($_CONFIG['coreAdminEmail']) . "',\n '" . addslashes($_CONFIG['coreAdminName']) . "',\n '" . $arrMail['subject'] . "',\n '" . $arrMail['body_text'] . "',\n ''\n )"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } /**************** * * ADD SETTINGS * ***************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_settings', array('key' => array('type' => 'VARCHAR(32)', 'notnull' => true, 'default' => ''), 'value' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'key'), 'status' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'value')), array('key' => array('fields' => array('key'), 'type' => 'UNIQUE')), 'InnoDB'); if (in_array(DBPREFIX . "communit_config", $arrTables)) { $objResult = \Cx\Lib\UpdateUtil::sql('SELECT `name`, `value`, `status` FROM `' . DBPREFIX . 'community_config`'); while (!$objResult->EOF) { $arrCommunityConfig[$objResult->fields['name']] = array('value' => $objResult->fields['value'], 'status' => $objResult->fields['status']); $objResult->MoveNext(); } } $arrSettings = array('user_activation' => array('value' => '', 'status' => isset($arrCommunityConfig['user_activation']['status']) ? $arrCommunityConfig['user_activation']['status'] : 0), 'user_activation_timeout' => array('value' => isset($arrCommunityConfig['user_activation_timeout']['value']) ? $arrCommunityConfig['user_activation_timeout']['value'] : 0, 'status' => isset($arrCommunityConfig['user_activation_timeout']['status']) ? $arrCommunityConfig['user_activation_timeout']['status'] : 0), 'assigne_to_groups' => array('value' => isset($arrCommunityConfig['community_groups']['value']) ? $arrCommunityConfig['community_groups']['value'] : '', 'status' => 1), 'max_profile_pic_width' => array('value' => '160', 'status' => 1), 'max_profile_pic_height' => array('value' => '160', 'status' => 1), 'profile_thumbnail_pic_width' => array('value' => '50', 'status' => 1), 'profile_thumbnail_pic_height' => array('value' => '50', 'status' => 1), 'max_profile_pic_size' => array('value' => '30000', 'status' => 1), 'max_pic_width' => array('value' => '600', 'status' => 1), 'max_pic_height' => array('value' => '600', 'status' => 1), 'max_thumbnail_pic_width' => array('value' => '130', 'status' => 1), 'max_thumbnail_pic_height' => array('value' => '130', 'status' => 1), 'max_pic_size' => array('value' => '200000', 'status' => 1), 'notification_address' => array('value' => addslashes($_CONFIG['coreAdminEmail']), 'status' => 1), 'user_config_email_access' => array('value' => '', 'status' => 1), 'user_config_profile_access' => array('value' => '', 'status' => 1), 'default_email_access' => array('value' => 'members_only', 'status' => 1), 'default_profile_access' => array('value' => 'members_only', 'status' => 1), 'user_delete_account' => array('value' => '', 'status' => 1), 'block_currently_online_users' => array('value' => '10', 'status' => 0), 'block_currently_online_users_pic' => array('value' => '', 'status' => 0), 'block_last_active_users' => array('value' => '10', 'status' => 0), 'block_last_active_users_pic' => array('value' => '', 'status' => 0), 'block_latest_reg_users' => array('value' => '10', 'status' => 0), 'block_latest_reg_users_pic' => array('value' => '', 'status' => 0), 'block_birthday_users' => array('value' => '10', 'status' => 0), 'block_birthday_users_pic' => array('value' => '', 'status' => 0), 'session_user_interval' => array('value' => '0', 'status' => 1), 'user_accept_tos_on_signup' => array('value' => '', 'status' => 0), 'user_captcha' => array('value' => '', 'status' => 0), 'profile_thumbnail_method' => array('value' => 'crop', 'status' => 1), 'profile_thumbnail_scale_color' => array('value' => '#FFFFFF', 'status' => 1)); foreach ($arrSettings as $key => $arrSetting) { if (!\Cx\Lib\UpdateUtil::sql("SELECT 1 FROM `" . DBPREFIX . "access_settings` WHERE `key` = '" . $key . "'")->RecordCount()) { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings`\n SET `key` = '" . $key . "',\n `value` = '" . $arrSetting['value'] . "',\n `status` = '" . $arrSetting['status'] . "'\n "); } } // delete obsolete table community_config \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'community_config'); // delete obsolete table user_validity \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'user_validity'); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /******************** * * ADD USER PROFILE * *******************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_profile', array('user_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'gender' => array('type' => 'ENUM(\'gender_undefined\',\'gender_female\',\'gender_male\')', 'notnull' => true, 'default' => 'gender_undefined', 'after' => 'user_id'), 'title' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'gender'), 'firstname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'title'), 'lastname' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'firstname'), 'company' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'lastname'), 'address' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'company'), 'city' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => '', 'after' => 'address'), 'zip' => array('type' => 'VARCHAR(10)', 'notnull' => true, 'default' => '', 'after' => 'city'), 'country' => array('type' => 'SMALLINT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'zip'), 'phone_office' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => '', 'after' => 'country'), 'phone_private' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => '', 'after' => 'phone_office'), 'phone_mobile' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => '', 'after' => 'phone_private'), 'phone_fax' => array('type' => 'VARCHAR(20)', 'notnull' => true, 'default' => '', 'after' => 'phone_mobile'), 'birthday' => array('type' => 'VARCHAR(11)', 'notnull' => false, 'after' => 'phone_fax'), 'website' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'birthday'), 'profession' => array('type' => 'VARCHAR(150)', 'notnull' => true, 'default' => '', 'after' => 'website'), 'interests' => array('type' => 'text', 'after' => 'profession'), 'signature' => array('type' => 'text', 'after' => 'interests'), 'picture' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'signature')), array('profile' => array('fields' => array('firstname' => 100, 'lastname' => 100, 'company' => 50))), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /*************************** * * MIGRATE GROUP RELATIONS * **************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_rel_user_group', array('user_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'group_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'user_id')), array(), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'access_users'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'access_users')); return false; } if (in_array('groups', $arrColumns)) { $query = "SELECT `id`, `groups` FROM " . DBPREFIX . "access_users WHERE `groups` != ''"; $objUser = $objDatabase->Execute($query); if ($objUser) { while (!$objUser->EOF) { $arrGroups = explode(',', $objUser->fields['groups']); foreach ($arrGroups as $groupId) { $query = "SELECT 1 FROM " . DBPREFIX . "access_rel_user_group WHERE `user_id` = " . $objUser->fields['id'] . " AND `group_id` = " . intval($groupId); $objRel = $objDatabase->SelectLimit($query, 1); if ($objRel) { if ($objRel->RecordCount() == 0) { $query = "INSERT INTO " . DBPREFIX . "access_rel_user_group (`user_id`, `group_id`) VALUES (" . $objUser->fields['id'] . ", " . intval($groupId) . ")"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } $objUser->MoveNext(); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $query = "ALTER TABLE `" . DBPREFIX . "access_users` DROP `groups`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } \DBG::msg('002'); /********************* * * ADD USER VALIDITY * ********************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_validity', array('validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true)), array(), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } $query = "SELECT 1 FROM `" . DBPREFIX . "access_user_validity`"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult) { if ($objResult->RecordCount() == 0) { $query = "\n INSERT INTO `" . DBPREFIX . "access_user_validity` (`validity`) VALUES\n ('0'), ('1'), ('15'), ('31'), ('62'),\n ('92'), ('123'), ('184'), ('366'), ('731')\n "; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } /******************** * * MIGRATE PROFILES * *******************/ if (in_array('firstname', $arrColumns)) { $query = "SELECT `id`, `firstname`, `lastname`, `residence`, `profession`, `interests`, `webpage`, `company`, `zip`, `phone`, `mobile`, `street` FROM `" . DBPREFIX . "access_users`"; $objUser = $objDatabase->Execute($query); if ($objUser) { while (!$objUser->EOF) { $query = "SELECT 1 FROM `" . DBPREFIX . "access_user_profile` WHERE `user_id` = " . $objUser->fields['id']; $objProfile = $objDatabase->SelectLimit($query, 1); if ($objProfile) { if ($objProfile->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "access_user_profile` (\n `user_id`,\n `gender`,\n `firstname`,\n `lastname`,\n `company`,\n `address`,\n `city`,\n `zip`,\n `country`,\n `phone_office`,\n `phone_private`,\n `phone_mobile`,\n `phone_fax`,\n `website`,\n `profession`,\n `interests`,\n `picture`\n ) VALUES (\n " . $objUser->fields['id'] . ",\n 'gender_undefined',\n '" . addslashes($objUser->fields['firstname']) . "',\n '" . addslashes($objUser->fields['lastname']) . "',\n '" . addslashes($objUser->fields['company']) . "',\n '" . addslashes($objUser->fields['street']) . "',\n '" . addslashes($objUser->fields['residence']) . "',\n '" . addslashes($objUser->fields['zip']) . "',\n 0,\n '',\n '" . addslashes($objUser->fields['phone']) . "',\n '" . addslashes($objUser->fields['mobile']) . "',\n '',\n '" . addslashes($objUser->fields['webpage']) . "',\n '" . addslashes($objUser->fields['profession']) . "',\n '" . addslashes($objUser->fields['interests']) . "',\n ''\n )"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $objUser->MoveNext(); } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } } $arrRemoveColumns = array('firstname', 'lastname', 'residence', 'profession', 'interests', 'webpage', 'company', 'zip', 'phone', 'mobile', 'street', 'levelid'); foreach ($arrRemoveColumns as $column) { if (in_array($column, $arrColumns)) { $query = "ALTER TABLE " . DBPREFIX . "access_users DROP `" . $column . "`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } $arrColumnDetails = $objDatabase->MetaColumns(DBPREFIX . 'access_users'); if ($arrColumnDetails === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'access_users')); return false; } if (in_array('regdate', $arrColumns)) { if ($arrColumnDetails['REGDATE']->type == 'date') { if (!in_array('regdate_new', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `regdate_new` INT( 14 ) UNSIGNED NULL DEFAULT '0' AFTER `regdate`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } $query = "UPDATE `" . DBPREFIX . "access_users` SET `regdate_new` = UNIX_TIMESTAMP(`regdate`), `regdate` = '0000-00-00' WHERE `regdate` != '0000-00-00'"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } $query = "ALTER TABLE `" . DBPREFIX . "access_users` DROP `regdate`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'access_users'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'access_users')); return false; } if (in_array('regdate_new', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` CHANGE `regdate_new` `regdate` INT( 14 ) UNSIGNED NOT NULL DEFAULT '0'"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } $query = "ALTER TABLE `" . DBPREFIX . "access_users` CHANGE `is_admin` `is_admin` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0'"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } if (!in_array('email_access', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `email_access` ENUM( 'everyone', 'members_only', 'nobody' ) NOT NULL DEFAULT 'nobody' AFTER `email`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('profile_access', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `profile_access` ENUM( 'everyone', 'members_only', 'nobody' ) NOT NULL DEFAULT 'members_only' AFTER `active`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('frontend_lang_id', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` CHANGE `langId` `frontend_lang_id` INT( 2 ) UNSIGNED NOT NULL DEFAULT '0'"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('backend_lang_id', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `backend_lang_id` INT( 2 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `frontend_lang_id`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } else { $query = "UPDATE `" . DBPREFIX . "access_users` SET `backend_lang_id` = `frontend_lang_id`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } if (!in_array('last_auth', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `last_auth` INT( 14 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `regdate`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('last_activity', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `last_activity` INT( 14 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `last_auth`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('expiration', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `expiration` INT( 14 ) UNSIGNED NOT NULL DEFAULT '0' AFTER `regdate`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('validity', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "access_users` ADD `validity` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `expiration`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } else { try { \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "access_users` SET `expiration` = `validity`*60*60*24+`regdate` WHERE `expiration` = 0 AND `validity` > 0"); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } \DBG::msg('003'); /*********************************** * * MIGRATE COMMUNITY CONTENT PAGES * **********************************/ // only execute this part for versions < 2.0.0 $pattern = array('/section=community&(amp;)?cmd=profile/', '/section=community&(amp;)?cmd=register/', '/section=community/'); $replacement = array('section=access&$1cmd=settings', 'section=access&$1cmd=signup', 'section=access'); try { \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array(), $pattern, $replacement, array('content', 'target'), '2.0.0'); \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'community'), array('/community/', '/profile/', '/register/'), array('access', 'settings', 'signup'), array('module', 'cmd'), '2.0.0'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /*********************************** * * CREATE PROFILE ATTRIBUTE TABLES * **********************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_attribute', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'parent_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'id'), 'type' => array('type' => 'ENUM(\'text\',\'textarea\',\'mail\',\'uri\',\'date\',\'image\',\'checkbox\',\'menu\',\'menu_option\',\'group\',\'frame\',\'history\')', 'notnull' => true, 'default' => 'text', 'after' => 'parent_id'), 'mandatory' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'type'), 'sort_type' => array('type' => 'ENUM(\'asc\',\'desc\',\'custom\')', 'notnull' => true, 'default' => 'asc', 'after' => 'mandatory'), 'order_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'sort_type'), 'access_special' => array('type' => 'ENUM(\'\',\'menu_select_higher\',\'menu_select_lower\')', 'notnull' => true, 'default' => '', 'after' => 'order_id'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'access_special')), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_attribute_name', array('attribute_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'attribute_id'), 'name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'lang_id')), array(), 'InnoDB'); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_attribute_value', array('attribute_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'user_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'attribute_id'), 'history_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'user_id'), 'value' => array('type' => 'text', 'after' => 'history_id')), array('value' => array('fields' => array('value'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_core_attribute', array('id' => array('type' => 'VARCHAR(25)', 'primary' => true), 'mandatory' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'id'), 'sort_type' => array('type' => 'ENUM(\'asc\',\'desc\',\'custom\')', 'notnull' => true, 'default' => 'asc', 'after' => 'mandatory'), 'order_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'sort_type'), 'access_special' => array('type' => 'ENUM(\'\',\'menu_select_higher\',\'menu_select_lower\')', 'notnull' => true, 'default' => '', 'after' => 'order_id'), 'access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'access_special')), array(), 'InnoDB'); /************************ * * ADD USER TITLE TABLE * ***********************/ \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_title', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'title' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'order_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'title')), array('title' => array('fields' => array('title'), 'type' => 'UNIQUE')), 'InnoDB'); $arrDefaultTitle = array('Sehr geehrte Frau', 'Sehr geehrter Herr', 'Dear Ms', 'Dear Mr', 'Madame', 'Monsieur'); foreach ($arrDefaultTitle as $title) { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_user_title` SET `title` = '" . $title . "' ON DUPLICATE KEY UPDATE `id` = `id`"); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /****************************** * * REMOVE OBSOLETE ACCESS IDS * *****************************/ $query = 'DELETE FROM `' . DBPREFIX . 'access_group_static_ids` WHERE `access_id` IN (28, 29, 30, 33, 34, 36)'; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } /******************* * * MIGRATE SESSION * ******************/ $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'sessions'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'sessions')); return false; } if (!in_array('user_id', $arrColumns)) { $query = "\n ALTER TABLE `" . DBPREFIX . "sessions`\n DROP `username`,\n ADD `user_id` INT UNSIGNED NOT NULL DEFAULT 0 AFTER `status`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } /*************************************** * * ADD CHECKBOX PROFILE ATTRIBUTE TYPE * **************************************/ $query = "ALTER TABLE `" . DBPREFIX . "access_user_attribute` CHANGE `type` `type` enum('text','textarea','mail','uri','date','image','checkbox','menu','menu_option','group','frame','history') NOT NULL DEFAULT 'text'"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } // Currently, this is only here to create the u2u_active field.. but instead of adding // 10 lines for each new field in the future, why not just extend this block try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_users', array('id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'is_admin' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'id'), 'username' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'is_admin'), 'password' => array('type' => 'VARCHAR(32)', 'notnull' => false, 'after' => 'username'), 'regdate' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'password'), 'expiration' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'regdate'), 'validity' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'expiration'), 'last_auth' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'validity'), 'last_auth_status' => array('type' => 'INT(1)', 'notnull' => true, 'default' => '1', 'after' => 'last_auth'), 'last_activity' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'last_auth_status'), 'email' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'last_activity'), 'email_access' => array('type' => 'ENUM(\'everyone\',\'members_only\',\'nobody\')', 'notnull' => true, 'default' => 'nobody', 'after' => 'email'), 'frontend_lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'email_access'), 'backend_lang_id' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'frontend_lang_id'), 'active' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'backend_lang_id'), 'primary_group' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'active'), 'profile_access' => array('type' => 'ENUM(\'everyone\',\'members_only\',\'nobody\')', 'notnull' => true, 'default' => 'members_only', 'after' => 'primary_group'), 'restore_key' => array('type' => 'VARCHAR(32)', 'notnull' => true, 'default' => '', 'after' => 'profile_access'), 'restore_key_time' => array('type' => 'INT(14)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'restore_key'), 'u2u_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1', 'after' => 'restore_key_time')), array('username' => array('fields' => array('username')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_groups', array('group_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'group_name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'group_id'), 'group_description' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'group_name'), 'is_active' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '1', 'after' => 'group_description'), 'type' => array('type' => 'ENUM(\'frontend\',\'backend\')', 'notnull' => true, 'default' => 'frontend', 'after' => 'is_active'), 'homepage' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'type'))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } \DBG::msg('004'); // only update if installed version is at least a version 2.0.0 // older versions < 2.0 have a complete other structure of the content page and must therefore completely be reinstalled if (!$objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.0.0')) { try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } // add missing access_captcha template block if (!preg_match('/<!--\\s+BEGIN\\s+access_captcha\\s+-->.*<!--\\s+END\\s+access_captcha\\s+-->/ms', $content)) { $content = preg_replace('/(<\\/fieldset>|)(\\s*)(<p[^>]*>|)(\\{ACCESS_SIGNUP_BUTTON\\})(<\\/p>|)/ms', '$2<!-- BEGIN access_captcha -->$2$3<label>{TXT_ACCESS_CAPTCHA}</label>{ACCESS_CAPTCHA_CODE}$5$2<!-- END access_captcha -->$2$1$2$3$4$5', $content); } // add missing access_newsletter template block if (!preg_match('/<!--\\s+BEGIN\\s+access_newsletter\\s+-->.*<!--\\s+END\\s+access_newsletter\\s+-->/ms', $content)) { $content = preg_replace('/(\\s*)(<p[^>]*>|)(\\{ACCESS_SIGNUP_BUTTON\\})(<\\/p>|)/ms', '$1<!-- BEGIN access_newsletter -->$1<fieldset><legend>Newsletter abonnieren</legend>$1 <!-- BEGIN access_newsletter_list -->$1 <p>$1 <label for="access_user_newsletters-{ACCESS_NEWSLETTER_ID}"> {ACCESS_NEWSLETTER_NAME}</label>$1 <input type="checkbox" name="access_user_newsletters[]" id="access_user_newsletters-{ACCESS_NEWSLETTER_ID}" value="{ACCESS_NEWSLETTER_ID}"{ACCESS_NEWSLETTER_SELECTED} />$1 </p>$1 <!-- END access_newsletter_list -->$1</fieldset>$1<!-- END access_newsletter -->$1$2$3$4', $content); } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'access', 'cmd' => 'signup'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /*************************************** * * ADD NETWORK TABLE FOR SOCIAL LOGIN * **************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.3')) { try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'access_user_network', array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'oauth_provider' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'oauth_id' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'oauth_provider'), 'user_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'oauth_id')), array(), 'InnoDB'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /*************************************** * * ADD NEW VALUES FOR SOCIAL LOGIN * **************************************/ try { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('sociallogin', '', '0') ON DUPLICATE KEY UPDATE `key` = `key`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('sociallogin_show_signup', '', 0) ON DUPLICATE KEY UPDATE `key` = `key`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('use_usernames', '0', '1') ON DUPLICATE KEY UPDATE `key` = `key`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('sociallogin_assign_to_groups', '3', '0') ON DUPLICATE KEY UPDATE `key` = `key`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('sociallogin_active_automatically', '', '1') ON DUPLICATE KEY UPDATE `key` = `key`"); \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "core_setting` (`section`, `name`, `group`, `type`, `value`, `values`, `ord`) VALUES ('access', 'providers', 'sociallogin', 'text', '{\"facebook\":{\"active\":\"0\",\"settings\":[\"\",\"\"]},\"twitter\":{\"active\":\"0\",\"settings\":[\"\",\"\"]},\"google\":{\"active\":\"0\",\"settings\":[\"\",\"\",\"\"]}}', '', '0') ON DUPLICATE KEY UPDATE `section` = `section`"); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /** * Content page * access signup */ try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } // fix duplicated social networks blocks if (preg_match('/<!--\\s+BEGIN\\s+access_social_networks\\s+-->.*<!--\\s+BEGIN\\s+access_social_networks\\s+-->/ms', $content)) { $content = preg_replace('/<br\\s+\\/><br\\s+\\/><!--\\s+BEGIN\\s+access_social_networks\\s+-->.*?<!--\\s+END\\s+access_social_networks\\s+-->/ms', '', $content); } // add missing access_social_networks template block if (!preg_match('/<!--\\s+BEGIN\\s+access_social_networks\\s+-->.*<!--\\s+END\\s+access_social_networks\\s+-->/ms', $content)) { $content = preg_replace('/(<!--\\s+BEGIN\\s+access_signup_form\\s+-->.*?)(<div[^>]*>|)(.*?\\{ACCESS_SIGNUP_MESSAGE\\}.*?)(<\\/div>|)/ms', '$1<br /><br /><!-- BEGIN access_social_networks --><fieldset><legend>oder Login mit Social Media</legend><!-- BEGIN access_social_networks_facebook --> <a class="facebook loginbutton" href="{ACCESS_SOCIALLOGIN_FACEBOOK}">Facebook</a> <!-- END access_social_networks_facebook --> <!-- BEGIN access_social_networks_google --> <a class="google loginbutton" href="{ACCESS_SOCIALLOGIN_GOOGLE}">Google</a> <!-- END access_social_networks_google --> <!-- BEGIN access_social_networks_twitter --> <a class="twitter loginbutton" href="{ACCESS_SOCIALLOGIN_TWITTER}">Twitter</a> <!-- END access_social_networks_twitter --> </fieldset> <!-- END access_social_networks -->$2$3$4', $content); } return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'access', 'cmd' => 'signup'), $search, $callback, array('content'), '3.0.2'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /*************************************** * * ADD SETTING FOR SOCIAL LOGIN * **************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.3')) { try { \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "access_settings` (`key`, `value`, `status`) VALUES ('sociallogin_activation_timeout', '10', '0') ON DUPLICATE KEY UPDATE `key` = `key`"); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /*************************************** * * STRICT_TRANS_TABLES ISSUE FIX FOR PROFILE TABLE * **************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { try { \Cx\Lib\UpdateUtil::sql("ALTER TABLE `" . DBPREFIX . "access_user_profile` CHANGE `interests` `interests` TEXT NULL"); \Cx\Lib\UpdateUtil::sql("ALTER TABLE `" . DBPREFIX . "access_user_profile` CHANGE `signature` `signature` TEXT NULL"); // add access to filesharing for existing groups try { $result = \Cx\Lib\UpdateUtil::sql("SELECT `group_id` FROM `" . DBPREFIX . "access_group_static_ids` WHERE access_id = 7 GROUP BY group_id"); if ($result !== false) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO `" . DBPREFIX . "access_group_static_ids` (`access_id`, `group_id`)\n VALUES (8, " . intval($result->fields['group_id']) . ")"); $result->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /************************************************ * BUGFIX: Set write access to the upload dir * ************************************************/ // This is obsolete due to the new \Cx\Lib\FileSystem /* require_once ASCMS_FRAMEWORK_PATH.'/File.class.php'; $objFile = new File(); if (is_writeable(ASCMS_ACCESS_PROFILE_IMG_PATH) || $objFile->setChmod(ASCMS_ACCESS_PROFILE_IMG_PATH, ASCMS_ACCESS_PROFILE_IMG_WEB_PATH, '')) { if ($mediaDir = @opendir(ASCMS_ACCESS_PROFILE_IMG_PATH)) { while($file = readdir($mediaDir)) { if ($file != '.' && $file != '..') { if (!is_writeable(ASCMS_ACCESS_PROFILE_IMG_PATH.'/'.$file) && !$objFile->setChmod(ASCMS_ACCESS_PROFILE_IMG_PATH.'/', ASCMS_ACCESS_PROFILE_IMG_WEB_PATH.'/', $file)) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], ASCMS_ACCESS_PROFILE_IMG_PATH.'/'.$file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_ACCESS_PROFILE_IMG_PATH.'/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_ACCESS_PROFILE_IMG_PATH.'/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } require_once ASCMS_FRAMEWORK_PATH.'/File.class.php'; $objFile = new File(); if (is_writeable(ASCMS_ACCESS_PHOTO_IMG_PATH) || $objFile->setChmod(ASCMS_ACCESS_PHOTO_IMG_PATH, ASCMS_ACCESS_PHOTO_IMG_WEB_PATH, '')) { if ($mediaDir = @opendir(ASCMS_ACCESS_PHOTO_IMG_PATH)) { while($file = readdir($mediaDir)) { if ($file != '.' && $file != '..') { if (!is_writeable(ASCMS_ACCESS_PHOTO_IMG_PATH.'/'.$file) && !$objFile->setChmod(ASCMS_ACCESS_PHOTO_IMG_PATH.'/', ASCMS_ACCESS_PHOTO_IMG_WEB_PATH.'/', $file)) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_FILE'], ASCMS_ACCESS_PHOTO_IMG_PATH.'/'.$file, $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_ACCESS_PHOTO_IMG_PATH.'/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; } } else { setUpdateMsg(sprintf($_ARRAYLANG['TXT_SET_WRITE_PERMISSON_TO_DIR_AND_CONTENT'], ASCMS_ACCESS_PHOTO_IMG_PATH.'/', $_CORELANG['TXT_UPDATE_TRY_AGAIN']), 'msg'); return false; }*/ return true; }
function _crmInstall() { try { $result = \Cx\Lib\UpdateUtil::sql('SELECT `id` FROM `' . DBPREFIX . 'core_text` WHERE `section` = \'crm\''); if (!$result || $result->RecordCount() == 0) { // add core mail template table because it is possible it doesn't yet exist \Cx\Lib\UpdateUtil::table(DBPREFIX . 'core_mail_template', array('key' => array('type' => 'tinytext'), 'section' => array('type' => 'tinytext', 'after' => 'key'), 'text_id' => array('type' => 'INT(10)', 'unsigned' => true, 'after' => 'section'), 'html' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'text_id'), 'protected' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'html')), null, 'MyISAM', 'cx3upgrade'); Cx\Lib\UpdateUtil::sql("\n ALTER TABLE `" . DBPREFIX . "core_mail_template`\n ADD PRIMARY KEY (`key` (32), `section` (32))\n "); // migrate mail templates \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_bcc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_cc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_from\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_message\', \'Guten Tag,\\r\\n\\r\\nNachfolgend erhalten Sie Ihre persönlichen Zugangsdaten zur Website http://www.example.com/\\r\\n\\r\\nBenutzername: [CRM_CONTACT_USERNAME]\\r\\nKennwort: [CRM_CONTACT_PASSWORD]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_message_html\', \'<div>Guten Tag,<br />\\r\\n<br />\\r\\nNachfolgend erhalten Sie Ihre persönlichen Zugangsdaten zur Website <a href="http://www.example.com/">http://www.example.com/</a><br />\\r\\n<br />\\r\\nBenutzername: [CRM_CONTACT_USERNAME]<br />\\r\\nKennwort: [CRM_CONTACT_PASSWORD]</div>\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_name\', \'Benachrichtigung über Benutzerkonto\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_reply\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_sender\', \'Ihr Firmenname\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_subject\', \'Ihr persönlischer Zugang\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(12, 1, \'crm\', \'core_mail_template_to\', \'[CRM_CONTACT_EMAIL]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_bcc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_cc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_from\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_message\', \'Der Mitarbeiter [CRM_TASK_CREATED_USER] hat eine neue Aufgabe erstellt und Ihnen zugewiesen: [CRM_TASK_URL]\\r\\n\\r\\nBeschreibung: [CRM_TASK_DESCRIPTION_TEXT_VERSION]\\r\\n\\r\\nFällig am: [CRM_TASK_DUE_DATE]\\r\\n\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_message_html\', \'<div style="padding:0px; margin:0px; font-family:Tahoma, sans-serif; font-size:14px; width:620px; color: #333;">\\r\\n<div style="padding: 0px 20px; border:1px solid #e0e0e0; margin-bottom: 10px; width:618px;">\\r\\n<h1 style="background-color: #e0e0e0;color: #3d4a6b;font-size: 18px;font-weight: normal;padding: 15px 20px;margin-top: 0 !important;margin-bottom: 0 !important;margin-left: -20px !important;margin-right: -20px !important;-webkit-margin-before: 0 !important;-webkit-margin-after: 0 !important;-webkit-margin-start: -20px !important;-webkit-margin-end: -20px !important;">Neue Aufgabe wurde Ihnen zugewiesen</h1>\\r\\n\\r\\n<p style="margin-top: 20px;word-wrap: break-word !important;">Der Mitarbeiter [CRM_TASK_CREATED_USER] hat eine neue Aufgabe erstellt und Ihnen zugewiesen: [CRM_TASK_LINK]</p>\\r\\n\\r\\n<p style="margin-top: 20px;word-wrap: break-word !important;">Beschreibung: [CRM_TASK_DESCRIPTION_HTML_VERSION]<br />\\r\\nFällig am: [CRM_TASK_DUE_DATE]</p>\\r\\n</div>\\r\\n</div>\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_name\', \'Neue Aufgabe\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_reply\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_sender\', \'Ihr Firmenname\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_subject\', \'Neue Aufgabe : [CRM_TASK_NAME]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(13, 1, \'crm\', \'core_mail_template_to\', \'[CRM_ASSIGNED_USER_EMAIL]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_bcc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_cc\', \'\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_from\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_message\', \'Im CRM wurde ein neuer Kontakt erfasst: [CRM_CONTACT_DETAILS_URL]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_message_html\', \'<div style="padding:0px; margin:0px; font-family:Tahoma, sans-serif; font-size:14px; width:620px; color: #333;">\\r\\n<div style="padding: 0px 20px; border:1px solid #e0e0e0; margin-bottom: 10px; width:618px;">\\r\\n<h1 style="background-color: #e0e0e0;color: #3d4a6b;font-size: 18px;font-weight: normal;padding: 15px 20px;margin-top: 0 !important;margin-bottom: 0 !important;margin-left: -20px !important;margin-right: -20px !important;-webkit-margin-before: 0 !important;-webkit-margin-after: 0 !important;-webkit-margin-start: -20px !important;-webkit-margin-end: -20px !important;">Neuer Kontakt im CRM</h1>\\r\\n\\r\\n<p style="margin-top: 20px;word-wrap: break-word !important;">Neuer Kontakt: [CRM_CONTACT_DETAILS_LINK].</p>\\r\\n</div>\\r\\n</div>\\r\\n\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_name\', \'Benachrichtigung an Mitarbeiter über neue Kontakte\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_reply\', \'info@example.com\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_sender\', \'Ihr Firmenname\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_subject\', \'Neuer Kontakt erfasst\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_text` (`id`, `lang_id`, `section`, `key`, `text`) VALUES(14, 1, \'crm\', \'core_mail_template_to\', \'[CRM_ASSIGNED_USER_EMAIL]\')'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_mail_template` (`key`, `section`, `text_id`, `html`, `protected`) VALUES(\'crm_user_account_created\', \'crm\', 12, 1, 1)'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_mail_template` (`key`, `section`, `text_id`, `html`, `protected`) VALUES(\'crm_notify_staff_on_contact_added\', \'crm\', 14, 1, 1)'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_mail_template` (`key`, `section`, `text_id`, `html`, `protected`) VALUES(\'crm_task_assigned\', \'crm\', 13, 1, 1)'); \Cx\Lib\UpdateUtil::sql('INSERT IGNORE INTO `' . DBPREFIX . 'core_setting` (`section`, `name`, `group`, `type`, `value`, `values`, `ord`) VALUES (\'crm\',\'numof_mailtemplate_per_page_backend\',\'config\',\'text\',\'25\',\'\',1001)'); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } }
function _newsUpdate() { global $objDatabase, $_CONFIG, $objUpdate, $_ARRAYLANG; /************************************************ * EXTENSION: Placeholder NEWS_LINK replaced * * by NEWS_LINK_TITLE * * ADDED: Contrexx v2.1.0 * ************************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '2.1.0')) { try { \Cx\Lib\UpdateUtil::migrateContentPage('news', null, '{NEWS_LINK}', '{NEWS_LINK_TITLE}', '2.1.0'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /************************************************ * EXTENSION: Front- and backend permissions * * ADDED: Contrexx v2.1.0 * ************************************************/ $query = "SELECT 1 FROM `" . DBPREFIX . "module_news_settings` WHERE `name` = 'news_message_protection'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_news_settings` (`name`, `value`) VALUES ('news_message_protection', '1'),\n ('recent_news_message_limit', '5')\n "; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $query = "SELECT 1 FROM `" . DBPREFIX . "module_news_settings` WHERE `name` = 'news_message_protection_restricted'"; $objResult = $objDatabase->SelectLimit($query, 1); if ($objResult) { if ($objResult->RecordCount() == 0) { $query = "INSERT INTO `" . DBPREFIX . "module_news_settings` (`name`, `value`) VALUES ('news_message_protection_restricted', '1')"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } } else { return _databaseError($query, $objDatabase->ErrorMsg()); } $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news')); return false; } if (!in_array('frontend_access_id', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `frontend_access_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `validated`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } if (!in_array('backend_access_id', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `backend_access_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `frontend_access_id`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } /************************************************ * EXTENSION: Thunbmail Image * * ADDED: Contrexx v2.1.0 * ************************************************/ $arrColumns = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news'); if ($arrColumns === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news')); return false; } if (!in_array('teaser_image_thumbnail_path', $arrColumns)) { $query = "ALTER TABLE `" . DBPREFIX . "module_news` ADD `teaser_image_thumbnail_path` TEXT NOT NULL AFTER `teaser_image_path`"; if ($objDatabase->Execute($query) === false) { return _databaseError($query, $objDatabase->ErrorMsg()); } } try { // delete obsolete table contrexx_module_news_access \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_news_access'); # fix some ugly NOT NULL without defaults \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news', array('id' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false, 'default_expr' => 'NULL'), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'text' => array('type' => 'MEDIUMTEXT', 'notnull' => true), 'redirect' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'source' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'url1' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'url2' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => ''), 'catid' => array('type' => 'INT(2) UNSIGNED', 'notnull' => true, 'default' => 0), 'lang' => array('type' => 'INT(2) UNSIGNED', 'notnull' => true, 'default' => 0), 'userid' => array('type' => 'INT(6) UNSIGNED', 'notnull' => true, 'default' => 0), 'startdate' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00'), 'enddate' => array('type' => 'DATETIME', 'notnull' => true, 'default' => '0000-00-00 00:00:00'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => 1), 'validated' => array('type' => "ENUM('0','1')", 'notnull' => true, 'default' => 0), 'frontend_access_id' => array('type' => 'INT(10) UNSIGNED', 'notnull' => true, 'default' => 0), 'backend_access_id' => array('type' => 'INT(10) UNSIGNED', 'notnull' => true, 'default' => 0), 'teaser_only' => array('type' => "ENUM('0','1')", 'notnull' => true, 'default' => 0), 'teaser_frames' => array('type' => 'TEXT', 'notnull' => true), 'teaser_text' => array('type' => 'TEXT', 'notnull' => true), 'teaser_show_link' => array('type' => 'TINYINT(1) UNSIGNED', 'notnull' => true, 'default' => 1), 'teaser_image_path' => array('type' => 'TEXT', 'notnull' => true), 'teaser_image_thumbnail_path' => array('type' => 'TEXT', 'notnull' => true), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => 0)), array('newsindex' => array('type' => 'FULLTEXT', 'fields' => array('text', 'title', 'teaser_text')))); } catch (\Cx\Lib\UpdateException $e) { // we COULD do something else here.. DBG::trace(); return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } //encoding was a little messy in 2.1.4. convert titles and teasers to their raw representation if ($_CONFIG['coreCmsVersion'] == "2.1.4") { try { $res = \Cx\Lib\UpdateUtil::sql('SELECT `id`, `title`, `teaser_text` FROM `' . DBPREFIX . 'module_news` WHERE `changelog` > ' . mktime(0, 0, 0, 12, 15, 2010)); while ($res->MoveNext()) { $title = $res->fields['title']; $teaserText = $res->fields['teaser_text']; $id = $res->fields['id']; //title is html entity style $title = html_entity_decode($title, ENT_QUOTES, CONTREXX_CHARSET); //teaserText is html entity style, but no cloudrexx was specified on encoding $teaserText = html_entity_decode($teaserText); \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'module_news` SET `title`="' . addslashes($title) . '", `teaser_text`="' . addslashes($teaserText) . '" where `id`=' . $id); } $hfr = new HackyFeedRepublisher(); $hfr->runRepublishing(); } catch (\Cx\Lib\UpdateException $e) { DBG::trace(); return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /**************************** * ADDED: Contrexx v3.0.0 * *****************************/ try { \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_locale', array('news_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'news_id'), 'is_active' => array('type' => 'INT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'lang_id'), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'is_active'), 'text' => array('type' => 'mediumtext', 'notnull' => true, 'after' => 'title'), 'teaser_text' => array('type' => 'text', 'notnull' => true, 'after' => 'text')), array('newsindex' => array('fields' => array('text', 'title', 'teaser_text'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_categories_locale', array('category_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'category_id'), 'name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'lang_id')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_types', array('typeid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'primary' => true, 'auto_increment' => true))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_types_locale', array('lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true), 'type_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'lang_id'), 'name' => array('type' => 'VARCHAR(100)', 'notnull' => true, 'default' => '', 'after' => 'type_id')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_settings_locale', array('name' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => '', 'primary' => true), 'lang_id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'primary' => true, 'after' => 'name'), 'value' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'lang_id')), array('name' => array('fields' => array('name'), 'type' => 'FULLTEXT'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_comments', array('id' => array('type' => 'INT(11)', 'unsigned' => true, 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'id'), 'text' => array('type' => 'mediumtext', 'notnull' => true, 'after' => 'title'), 'newsid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'text'), 'date' => array('type' => 'INT(14)', 'notnull' => false, 'default' => NULL, 'after' => 'newsid'), 'poster_name' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'date'), 'userid' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'poster_name'), 'ip_address' => array('type' => 'VARCHAR(15)', 'notnull' => true, 'default' => '0.0.0.0', 'after' => 'userid'), 'is_active' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '1', 'after' => 'ip_address'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_stats_view', array('user_sid' => array('type' => 'CHAR(32)', 'notnull' => true), 'news_id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'after' => 'user_sid'), 'time' => array('type' => 'timestamp', 'notnull' => true, 'default_expr' => 'CURRENT_TIMESTAMP', 'on_update' => 'CURRENT_TIMESTAMP', 'after' => 'news_id')), array('idx_user_sid' => array('fields' => array('user_sid')), 'idx_news_id' => array('fields' => array('news_id')))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news', array('id' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'primary' => true, 'auto_increment' => true), 'date' => array('type' => 'INT(14)', 'notnull' => false, 'default' => NULL, 'after' => 'id'), 'title' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'date'), 'text' => array('type' => 'mediumtext', 'notnull' => true, 'after' => 'title'), 'redirect' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'text'), 'source' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'redirect'), 'url1' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'source'), 'url2' => array('type' => 'VARCHAR(250)', 'notnull' => true, 'default' => '', 'after' => 'url1'), 'catid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'url2'), 'lang' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'catid'), 'typeid' => array('type' => 'INT(2)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'lang'), 'publisher' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'typeid'), 'publisher_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'publisher'), 'author' => array('type' => 'VARCHAR(255)', 'notnull' => true, 'default' => '', 'after' => 'publisher_id'), 'author_id' => array('type' => 'INT(5)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'author'), 'userid' => array('type' => 'INT(6)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'author_id'), 'startdate' => array('type' => 'timestamp', 'notnull' => true, 'default' => '0000-00-00 00:00:00', 'after' => 'userid'), 'enddate' => array('type' => 'timestamp', 'notnull' => true, 'default' => '0000-00-00 00:00:00', 'after' => 'startdate'), 'status' => array('type' => 'TINYINT(4)', 'notnull' => true, 'default' => '1', 'after' => 'enddate'), 'validated' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'status'), 'frontend_access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'validated'), 'backend_access_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0', 'after' => 'frontend_access_id'), 'teaser_only' => array('type' => 'ENUM(\'0\',\'1\')', 'notnull' => true, 'default' => '0', 'after' => 'backend_access_id'), 'teaser_frames' => array('type' => 'text', 'notnull' => true, 'after' => 'teaser_only'), 'teaser_text' => array('type' => 'text', 'notnull' => true, 'after' => 'teaser_frames'), 'teaser_show_link' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'after' => 'teaser_text'), 'teaser_image_path' => array('type' => 'text', 'notnull' => true, 'after' => 'teaser_show_link'), 'teaser_image_thumbnail_path' => array('type' => 'text', 'notnull' => true, 'after' => 'teaser_image_path'), 'changelog' => array('type' => 'INT(14)', 'notnull' => true, 'default' => '0', 'after' => 'teaser_image_thumbnail_path'), 'allow_comments' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'changelog')), array('newsindex' => array('fields' => array('text', 'title', 'teaser_text'), 'type' => 'FULLTEXT'))); $arrColumnsNews = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news'); if ($arrColumnsNews === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news')); return false; } if (isset($arrColumnsNews['TITLE']) && isset($arrColumnsNews['TEXT']) && isset($arrColumnsNews['TEASER_TEXT']) && isset($arrColumnsNews['LANG'])) { \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_news_locale` (`news_id`, `lang_id`, `title`, `text`, `teaser_text`) SELECT `id`, `lang`, `title`, `text`, `teaser_text` FROM `' . DBPREFIX . 'module_news` ON DUPLICATE KEY UPDATE `news_id` = `news_id` '); } if (isset($arrColumnsNews['TITLE'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news` DROP `title`'); } if (isset($arrColumnsNews['TEXT'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news` DROP `text`'); } if (isset($arrColumnsNews['TEASER_TEXT'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news` DROP `teaser_text`'); } if (isset($arrColumnsNews['LANG'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news` DROP `lang`'); } $arrColumnsNewsCategories = $objDatabase->MetaColumnNames(DBPREFIX . 'module_news_categories'); if ($arrColumnsNewsCategories === false) { setUpdateMsg(sprintf($_ARRAYLANG['TXT_UNABLE_GETTING_DATABASE_TABLE_STRUCTURE'], DBPREFIX . 'module_news_categories')); return false; } if (isset($arrColumnsNewsCategories['NAME'])) { \Cx\Lib\UpdateUtil::sql(' INSERT INTO ' . DBPREFIX . 'module_news_categories_locale (`category_id`, `lang_id`, `name`) SELECT c.catid, l.id, c.name FROM ' . DBPREFIX . 'module_news_categories AS c, ' . DBPREFIX . 'languages AS l ORDER BY c.catid, l.id ON DUPLICATE KEY UPDATE `category_id` = `category_id` '); \Cx\Lib\UpdateUtil::sql(' INSERT INTO ' . DBPREFIX . 'module_news_categories_locale (`category_id`, `lang_id`, `name`) SELECT c.catid, l.id, c.name FROM ' . DBPREFIX . 'module_news_categories AS c, ' . DBPREFIX . 'languages AS l ORDER BY c.catid, l.id ON DUPLICATE KEY UPDATE `category_id` = `category_id` '); \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news_categories` DROP `name`'); } if (isset($arrColumnsNewsCategories['LANG'])) { \Cx\Lib\UpdateUtil::sql('ALTER TABLE `' . DBPREFIX . 'module_news_categories` DROP `lang`'); } \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_news_settings_locale` (`name`, `lang_id`, `value`) SELECT n.`name`, l.`id`, n.`value` FROM `' . DBPREFIX . 'module_news_settings` AS n, `' . DBPREFIX . 'languages` AS l WHERE n.`name` IN ("news_feed_description", "news_feed_title") ORDER BY n.`name`, l.`id` ON DUPLICATE KEY UPDATE `' . DBPREFIX . 'module_news_settings_locale`.`name` = `' . DBPREFIX . 'module_news_settings_locale`.`name` '); \Cx\Lib\UpdateUtil::sql('DELETE FROM `' . DBPREFIX . 'module_news_settings` WHERE `name` IN ("news_feed_title", "news_feed_description")'); \Cx\Lib\UpdateUtil::sql(' INSERT INTO `' . DBPREFIX . 'module_news_settings` (`name`, `value`) VALUES ("news_comments_activated", "0"), ("news_comments_anonymous", "0"), ("news_comments_autoactivate", "0"), ("news_comments_notification", "1"), ("news_comments_timeout", "30"), ("news_default_teasers", ""), ("news_use_types","0"), ("news_use_top","0"), ("news_top_days","10"), ("news_top_limit","10"), ("news_assigned_author_groups", "0"), ("news_assigned_publisher_groups", "0") ON DUPLICATE KEY UPDATE `name` = `name` '); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { \Cx\Lib\UpdateUtil::migrateContentPage('news', 'details', array('{NEWS_DATE}', '{NEWS_COMMENTS_DATE}'), array('{NEWS_LONG_DATE}', '{NEWS_COMMENTS_LONG_DATE}'), '3.0.1'); // this adds the block news_redirect $search = array('/.*\\{NEWS_TEXT\\}.*/ms'); $callback = function ($matches) { if (!preg_match('/<!--\\s+BEGIN\\s+news_redirect\\s+-->/ms', $matches[0])) { $newsContent = <<<NEWS <!-- BEGIN news_text -->{NEWS_TEXT}<!-- END news_text --> <!-- BEGIN news_redirect -->{TXT_NEWS_REDIRECT_INSTRUCTION} <a href="{NEWS_REDIRECT_URL}" target="_blank">{NEWS_REDIRECT_URL}</a><!-- END news_redirect --> NEWS; return str_replace('{NEWS_TEXT}', $newsContent, $matches[0]); } else { return $matches[0]; } }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'news', 'cmd' => 'details'), $search, $callback, array('content'), '3.0.1'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } try { // migrate content page to version 3.0.1 $search = array('/(.*)/ms'); $callback = function ($matches) { $content = $matches[1]; if (empty($content)) { return $content; } // migrate to ckeditor $content = str_replace('FCKeditorAPI.GetInstance(\'newsText\').SetData(\'\')', 'CKEDITOR.instances[\'newsText\'].setData()', $content); if (!preg_match('/<!--\\s+BEGIN\\s+news_submit_form_captcha\\s+-->.*<!--\\s+END\\s+news_submit_form_captcha\\s+-->/ms', $content)) { // check if captcha code is already present if (preg_match('/\\{IMAGE_URL\\}/ms', $content)) { // add missing template block news_submit_form_captcha $content = preg_replace('/(.*)(<p[^>]*>.*?<label[^>]*>.*?\\{IMAGE_URL\\}.*?<\\/p>)/ms', '$1<!-- BEGIN news_submit_form_captcha -->$2<!-- END news_submit_form_captcha -->', $content); } else { // add whole captcha code incl. template block $content = preg_replace('/(.*)(<tr[^>]*>.*?<td([^>]*)>.*?\\{NEWS_TEXT\\}.*?(\\s*)<\\/tr>)/ms', '$1$2$4<!-- BEGIN news_submit_form_captcha -->$4<tr>$4 <td$3>{NEWS_CAPTCHA_CODE}</td>$4</tr>$4<!-- END news_submit_form_captcha -->', $content); } } // add text variable $content = str_replace('Captcha', '{TXT_NEWS_CAPTCHA}', $content); // replace image with {NEWS_CAPTCHA_CODE} $content = preg_replace('/<img[^>]+\\{IMAGE_URL\\}[^>]+>(?:<br\\s*\\/?>)?/ms', '{NEWS_CAPTCHA_CODE}', $content); // remove {TXT_CAPTCHA} $content = str_replace('{TXT_CAPTCHA}', '', $content); // remove <input type="text" name="captcha" id="captcha" /> $content = preg_replace('/<input[^>]+name\\s*=\\s*[\'"]captcha[\'"][^>]*>/ms', '', $content); return $content; }; \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('module' => 'news', 'cmd' => 'submit'), $search, $callback, array('content'), '3.0.1'); \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'news'), '/(\\{NEWS_COUNT_COMMENTS\\})/', '<!-- BEGIN news_comments_count -->$1<!-- END news_comments_count -->', array('content'), '3.0.3'); \Cx\Lib\UpdateUtil::migrateContentPageUsingRegex(array('module' => 'news', 'cmd' => 'details'), '/(\\{NEWS_COUNT_COMMENTS\\})/', '<!-- BEGIN news_comments_count -->$1<!-- END news_comments_count -->', array('content'), '3.0.3'); } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } /************************************************ * EXTENSION: Categories as NestedSet * * ADDED: Contrexx v3.1.0 * ************************************************/ if (!isset($_SESSION['contrexx_update']['news'])) { $_SESSION['contrexx_update']['news'] = array(); } if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0') && !isset($_SESSION['contrexx_update']['news']['nestedSet'])) { try { $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) { $nestedSetRootId = $objDatabase->Insert_ID(); } // count categories $objResultCount = \Cx\Lib\UpdateUtil::sql('SELECT count(`catid`) AS count FROM `' . DBPREFIX . 'module_news_categories`'); if ($objResultCount && !$objResultCount->EOF) { $count = $objResultCount->fields['count']; } // add nested set information to root node \Cx\Lib\UpdateUtil::sql(' UPDATE `' . DBPREFIX . 'module_news_categories` SET `parent_id` = ' . $nestedSetRootId . ', `left_id` = 1, `right_id` = ' . $count * 2 . ', `sorting` = 1, `level` = 1 WHERE `catid` = ' . $nestedSetRootId . ' '); // add nested set information to all categories $objResultCatSelect = \Cx\Lib\UpdateUtil::sql('SELECT `catid` FROM `' . DBPREFIX . 'module_news_categories` ORDER BY `catid` ASC'); if ($objResultCatSelect) { while (!$objResultCatSelect->EOF) { $catId = $objResultCatSelect->fields['catid']; if ($catId != $nestedSetRootId) { \Cx\Lib\UpdateUtil::sql(' UPDATE `' . DBPREFIX . 'module_news_categories` SET `parent_id` = ' . $nestedSetRootId . ', `left_id` = ' . $leftAndRight++ . ', `right_id` = ' . $leftAndRight++ . ', `sorting` = ' . $sorting++ . ', `level` = ' . $level . ' WHERE `catid` = ' . $catId . ' '); } $objResultCatSelect->MoveNext(); } } // add new tables \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_categories_locks', array('lockId' => array('type' => 'VARCHAR(32)'), 'lockTable' => array('type' => 'VARCHAR(32)', 'after' => 'lockId'), 'lockStamp' => array('type' => 'BIGINT(11)', 'notnull' => true, 'after' => 'lockTable'))); \Cx\Lib\UpdateUtil::table(DBPREFIX . 'module_news_categories_catid', array('id' => array('type' => 'INT(11)', 'notnull' => true))); // insert id of last added category \Cx\Lib\UpdateUtil::sql('INSERT INTO `' . DBPREFIX . 'module_news_categories_catid` (`id`) VALUES (' . $nestedSetRootId . ')'); $_SESSION['contrexx_update']['news']['nestedSet'] = true; } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /************************************ * EXTENSION: Module page changes * * ADDED: Contrexx v3.1.0 * ************************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { try { $result = \Cx\Lib\UpdateUtil::sql('SELECT `id` FROM `' . DBPREFIX . 'content_page` WHERE `module` = "news" AND `cmd` RLIKE "^[0-9]*$"'); if ($result && $result->RecordCount() > 0) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('id' => $result->fields['id']), '/(.*)/ms', function ($matches) { $page = $matches[0]; if (!empty($page) && !preg_match('/<!--\\s+BEGIN\\s+news_status_message\\s+-->.*<!--\\s+END\\s+news_status_message\\s+-->/ms', $page) && !preg_match('/<!--\\s+BEGIN\\s+news_menu\\s+-->.*<!--\\s+END\\s+news_menu\\s+-->/ms', $page) && !preg_match('/<!--\\s+BEGIN\\s+news_list\\s+-->.*<!--\\s+END\\s+news_list\\s+-->/ms', $page)) { $page = preg_replace_callback('/<form[^>]*>[^<]*\\{NEWS_CAT_DROPDOWNMENU\\}[^>]*<\\/form>/ims', function ($matches) { $menu = $matches[0]; $menu = preg_replace_callback('/(action\\s*=\\s*([\'"])[^\\2]+section=news)\\2/i', function ($matches) { return $matches[1] . '&cmd=[[NEWS_CMD]]' . $matches[2]; }, $menu); return ' <!-- BEGIN news_status_message --> {TXT_NEWS_NO_NEWS_FOUND} <!-- END news_status_message --> <!-- BEGIN news_menu --> ' . $menu . ' <!-- END news_menu --> '; }, $page); $page = preg_replace_callback('/<ul[^>]*>[^<]*<!--\\s+BEGIN\\s+newsrow\\s+-->.*<!--\\s+END\\s+newsrow\\s+-->[^>]*<\\/ul>/ims', function ($matches) { return ' <!-- BEGIN news_list --> ' . $matches[0] . ' <!-- END news_list --> '; }, $page); if (!preg_match('/<!--\\s+BEGIN\\s+news_status_message\\s+-->.*<!--\\s+END\\s+news_status_message\\s+-->/ms', $page)) { $page = ' <!-- BEGIN news_status_message --> {TXT_NEWS_NO_NEWS_FOUND} <!-- END news_status_message --> ' . $page; } } return $page; }, array('content'), '3.1.0'); $result->MoveNext(); } } $result = \Cx\Lib\UpdateUtil::sql('SELECT `id` FROM `' . DBPREFIX . 'content_page` WHERE `module` = "news" AND `cmd` RLIKE "^details[0-9]*$"'); if ($result && $result->RecordCount() > 0) { while (!$result->EOF) { \Cx\Lib\UpdateUtil::migrateContentPageUsingRegexCallback(array('id' => $result->fields['id']), '/(.*)/ms', function ($matches) { $page = $matches[0]; if (!empty($page) && !preg_match('/<!--\\s+BEGIN\\s+news_use_teaser_text\\s+-->.*<!--\\s+END\\s+news_use_teaser_text\\s+-->/ms', $page)) { $page = preg_replace('/\\{NEWS_TEASER_TEXT\\}/', '<!-- BEGIN news_use_teaser_text -->\\0<!-- END news_use_teaser_text -->', $page); } return $page; }, array('content'), '3.1.0'); $result->MoveNext(); } } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } /*********************************** * EXTENSION: new settings added * * ADDED: Contrexx v3.1.0 * ***********************************/ if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) { try { $result = \Cx\Lib\UpdateUtil::sql('SELECT `name` FROM `' . DBPREFIX . 'module_news_settings` WHERE `name` = "news_use_teaser_text"'); if ($result && $result->RecordCount() == 0) { \Cx\Lib\UpdateUtil::sql('INSERT INTO `' . DBPREFIX . 'module_news_settings` (`name`, `value`) VALUES ("news_use_teaser_text", 1)'); } } catch (\Cx\Lib\UpdateException $e) { return \Cx\Lib\UpdateUtil::DefaultActionHandler($e); } } return true; }