function downloadsUpdate() { try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Downloads' WHERE `id` = 53"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Downloads' WHERE `area_id` = 132"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('53', 'Downloads', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Downloads' WHERE `module` = 'downloads'"); //following queries for changing the path from images/downloads into images/Downloads \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_category`\n SET `image` = REPLACE(`image`, 'images/downloads', 'images/Downloads')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_downloads_download_locale`\n SET `source` = REPLACE(`source`, 'images/downloads', 'images/Downloads')\n WHERE `source` LIKE ('" . ASCMS_PATH_OFFSET . "/images/downloads%')"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } $sourcePath = ASCMS_DOCUMENT_ROOT . '/images/downloads'; $targetPath = ASCMS_DOCUMENT_ROOT . '/images/Downloads'; try { if (file_exists($sourcePath) && !file_exists($targetPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) { return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Downloads Updated successfully'; }
function fileSharingUpdate() { try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'FileSharing' WHERE `id` = 68"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=media&archive=FileSharing' WHERE `area_id` = 187"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('68', 'FileSharing', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'FileSharing' WHERE `module` = 'filesharing'"); //update section \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'FileSharing',`value` = 'on' WHERE\n `section` = 'filesharing' AND `name` = 'permission' AND `group` = 'config'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } $sourcePath = ASCMS_DOCUMENT_ROOT . '/media/filesharing'; $targetPath = ASCMS_DOCUMENT_ROOT . '/media/FileSharing'; try { if (file_exists($sourcePath) && !file_exists($targetPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) { return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'FileSharing updated successfully'; }
function galleryUpdate() { try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Gallery' WHERE `id` = 3"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Gallery' WHERE `area_id` = 12"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('3', 'Gallery', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Gallery' WHERE `module` = 'gallery'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } $sourcePath = ASCMS_DOCUMENT_ROOT . '/images/gallery'; $targetPath = ASCMS_DOCUMENT_ROOT . '/images/Gallery'; try { if (file_exists($sourcePath) && !file_exists($targetPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) { return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Gallery Component Updated Successfully'; }
function marketUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Market' WHERE `id` = 33"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Market' WHERE `area_id` = 98"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('33', 'Market', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Market' WHERE `module` = 'market'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $marketMediaPath = ASCMS_DOCUMENT_ROOT . '/media'; try { if (file_exists($marketMediaPath . '/market') && !file_exists($marketMediaPath . '/Market')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($marketMediaPath . '/market'); if (!\Cx\Lib\FileSystem\FileSystem::move($marketMediaPath . '/market', $marketMediaPath . '/Market')) { return 'Failed to move the folder from ' . $marketMediaPath . '/market to ' . $marketMediaPath . '/Market.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Market updated successfully.'; }
function forumUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Forum' WHERE `id` = 20"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Forum' WHERE `area_id` = 106"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('20', 'Forum', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Forum' WHERE `module` = 'forum'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $sourcePath = ASCMS_DOCUMENT_ROOT . '/media/forum'; $destinationPath = ASCMS_DOCUMENT_ROOT . '/media/Forum'; try { if (file_exists($sourcePath) && !file_exists($destinationPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $destinationPath)) { return 'Failed to move the folder from ' . $sourcePath . ' to ' . $destinationPath . '.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Forum updated successfully.'; }
function accessUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Access' WHERE `id` = 23"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access', `module_id` = '23' WHERE `area_id` = 18"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Access' WHERE `area_id` = 208"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('23', 'Access', 'core_module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Access' WHERE `module` = 'access'"); //update module name for crm core settings \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Access' WHERE `section` = 'access' AND `name` = 'providers' AND `group` = 'sociallogin'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $accessImgPath = ASCMS_DOCUMENT_ROOT . '/images'; try { if (file_exists($accessImgPath . '/access') && !file_exists($accessImgPath . '/Access')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($accessImgPath . '/access'); if (!\Cx\Lib\FileSystem\FileSystem::move($accessImgPath . '/access', $accessImgPath . '/Access')) { return 'Failed to move the folder from ' . $accessImgPath . '/access to ' . $accessImgPath . '/Access.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Access updated successfully.'; }
function calendarUpdate() { try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Calendar' WHERE `id` = 21"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Calendar' WHERE `area_id` = 16"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('21', 'Calendar', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Calendar' WHERE `module` = 'calendar'"); //following queries for changing the path from images/calendar into images/Calendar \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_calendar_event` SET `pic` = REPLACE(`pic`, 'images/calendar', 'images/Calendar'),\n `attach` = REPLACE(`attach`, 'images/calendar', 'images/Calendar'),\n `place_map` = REPLACE(`place_map`, 'images/calendar', 'images/Calendar')\n WHERE `pic` LIKE ('" . ASCMS_PATH_OFFSET . "/images/calendar%') "); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } $sourcePath = ASCMS_DOCUMENT_ROOT . '/images/calendar'; $targetPath = ASCMS_DOCUMENT_ROOT . '/images/Calendar'; try { if (file_exists($sourcePath) && !file_exists($targetPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) { return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Calendar Component Updated Successfully'; }
/** * 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; }
function ecardUpdates() { //Update database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Ecard' WHERE `id` = 49"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Ecard' WHERE `area_id` = 130"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('49', 'Ecard', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Ecard' WHERE `module` = 'ecard'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folders $imgModulesfolderPath = ASCMS_DOCUMENT_ROOT . '/images/modules/ecard'; $mediafolderPath = ASCMS_DOCUMENT_ROOT . '/media/Ecard'; try { if (!file_exists($mediafolderPath)) { \Cx\Lib\FileSystem\FileSystem::make_folder($mediafolderPath); \Cx\Lib\FileSystem\FileSystem::makeWritable($mediafolderPath); } //move the folder from '/images/modules/ecard/ecards_optimized' to '/media/Ecard/ecards_optimized' if (file_exists($imgModulesfolderPath . '/ecards_optimized') && !file_exists($mediafolderPath . '/ecards_optimized')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/ecards_optimized'); if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/ecards_optimized', $mediafolderPath . '/ecards_optimized')) { return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/ecards_optimized to ' . $mediafolderPath . '/ecards_optimized.'; } } //move the folder from '/images/modules/ecard/send_ecards' to '/media/Ecard/send_ecards' if (file_exists($imgModulesfolderPath . '/send_ecards') && !file_exists($mediafolderPath . '/send_ecards')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/send_ecards'); if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/send_ecards', $mediafolderPath . '/send_ecards')) { return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/send_ecards to ' . $mediafolderPath . '/send_ecards.'; } } //move the folder from '/images/modules/ecard/thumbnails' to '/media/Ecard/thumbnails' if (file_exists($imgModulesfolderPath . '/thumbnails') && !file_exists($mediafolderPath . '/thumbnails')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($imgModulesfolderPath . '/thumbnails'); if (!\Cx\Lib\FileSystem\FileSystem::move($imgModulesfolderPath . '/thumbnails', $mediafolderPath . '/thumbnails')) { return 'Failed to Move the folders from ' . $imgModulesfolderPath . '/thumbnails to ' . $mediafolderPath . '/thumbnails.'; } } return 'Successfully updated.'; } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } }
/** * 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; }
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; }
/** * 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 crmUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Crm' WHERE `id` = 69"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=customers' WHERE `area_id` = 191"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=task' WHERE `area_id` = 192"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=deals' WHERE `area_id` = 193"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Crm&act=settings' WHERE `area_id` = 195"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('69', 'Crm', 'module')"); //update module name for email templates \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Crm' WHERE `section` = 'crm'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Crm' WHERE `section` = 'crm'"); //update module name for crm core settings \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Crm' WHERE `section` = 'crm'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $crmImgPath = ASCMS_DOCUMENT_ROOT . '/images'; $crmMediaPath = ASCMS_DOCUMENT_ROOT . '/media'; try { if (file_exists($crmImgPath . '/crm') && !file_exists($crmImgPath . '/Crm')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($crmImgPath . '/crm'); if (!\Cx\Lib\FileSystem\FileSystem::move($crmImgPath . '/crm', $crmImgPath . '/Crm')) { return 'Failed to move the folder from ' . $crmImgPath . '/crm to ' . $crmImgPath . '/Crm.'; } } if (file_exists($crmMediaPath . '/crm') && !file_exists($crmMediaPath . '/Crm')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($crmMediaPath . '/crm'); if (!\Cx\Lib\FileSystem\FileSystem::move($crmMediaPath . '/crm', $crmMediaPath . '/Crm')) { return 'Failed to move the folder from ' . $crmMediaPath . '/crm to ' . $crmMediaPath . '/Crm.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Crm updated successfully.'; }
function mediaDirUpdate() { try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'MediaDir' WHERE `id` = 60"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=MediaDir' WHERE `area_id` = 153"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('60', 'MediaDir', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'MediaDir' WHERE `module` = 'mediadir'"); //update class name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'linkGroup' WHERE `name` = 'link_group'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'googleMap' WHERE `name` = 'google_map'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'addStep' WHERE `name` = 'add_step'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'fieldGroup' WHERE `name` = 'field_group'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'productAttributes' WHERE `name` = 'product_attributes'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_inputfield_types` SET `name` = 'googleWeather' WHERE `name` = 'google_weather'"); //following queries for changing the path from images/mediadir into images/MediaDir \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_categories` \n SET `picture` = REPLACE(`picture`, 'images/mediadir', 'images/MediaDir')\n WHERE `picture` LIKE ('" . ASCMS_PATH_OFFSET . "/images/mediadir%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_forms` \n SET `picture` = REPLACE(`picture`, 'images/mediadir', 'images/MediaDir')\n WHERE `picture` LIKE ('" . ASCMS_PATH_OFFSET . "/images/mediadir%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_levels` \n SET `picture` = REPLACE(`picture`, 'images/mediadir', 'images/MediaDir')\n WHERE `picture` LIKE ('" . ASCMS_PATH_OFFSET . "/images/mediadir%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_rel_entry_inputfields` \n SET `value` = REPLACE(`value`, 'images/mediadir', 'images/MediaDir')\n WHERE `value` LIKE ('" . ASCMS_PATH_OFFSET . "/images/mediadir%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_mediadir_rel_entry_inputfields_clean1` \n SET `value` = REPLACE(`value`, 'images/mediadir', 'images/MediaDir')\n WHERE `value` LIKE ('" . ASCMS_PATH_OFFSET . "/images/mediadir%')"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } $sourcePath = ASCMS_DOCUMENT_ROOT . '/images/mediadir'; $targetPath = ASCMS_DOCUMENT_ROOT . '/images/MediaDir'; try { if (file_exists($sourcePath) && !file_exists($targetPath)) { \Cx\Lib\FileSystem\FileSystem::makeWritable($sourcePath); if (!\Cx\Lib\FileSystem\FileSystem::move($sourcePath, $targetPath)) { return 'Failed to Moved the files from ' . $sourcePath . ' to ' . $targetPath . '.<br>'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Media Directory Updated Successfully'; }
function shopUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Shop' WHERE `id` = 16"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Shop' WHERE `area_id` = 13"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('16', 'Shop', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Shop' WHERE `module` = 'shop'"); //update module name for crm core settings \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_setting` SET `section` = 'Shop' WHERE `section` = 'shop'"); //update module name for email templates \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_mail_template` SET `section` = 'Shop' WHERE `section` = 'shop'"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "core_text` SET `section` = 'Shop' WHERE `section` = 'shop'"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $shopImgPath = ASCMS_DOCUMENT_ROOT . '/images'; $shopMediaPath = ASCMS_DOCUMENT_ROOT . '/media'; try { if (file_exists($shopImgPath . '/shop') && !file_exists($shopImgPath . '/Shop')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($shopImgPath . '/shop'); if (!\Cx\Lib\FileSystem\FileSystem::move($shopImgPath . '/shop', $shopImgPath . '/Shop')) { return 'Failed to move the folder from ' . $shopImgPath . '/shop to ' . $shopImgPath . '/Shop.'; } } if (file_exists($shopMediaPath . '/shop') && !file_exists($shopMediaPath . '/Shop')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($shopMediaPath . '/shop'); if (!\Cx\Lib\FileSystem\FileSystem::move($shopMediaPath . '/shop', $shopMediaPath . '/Shop')) { return 'Failed to move the folder from ' . $shopMediaPath . '/shop to ' . $shopMediaPath . '/Shop.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Shop updated successfully.'; }
/** * 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); } }
function blogUpdates() { //Update the database changes try { //update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Blog' WHERE `id` = 47"); //update navigation url \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog' WHERE `area_id` = 119"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=manageEntry' WHERE `area_id` = 120"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=addEntry' WHERE `area_id` = 121"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=manageCategory' WHERE `area_id` = 122"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=addCategory' WHERE `area_id` = 123"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=settings' WHERE `area_id` = 124"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Blog&act=networks' WHERE `area_id` = 125"); //Insert component entry \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('47', 'Blog', 'module')"); //update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Blog' WHERE `module` = 'blog'"); //following queries for changing the path from images/blog into images/Blog \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_blog_messages_lang` \n SET `image` = REPLACE(`image`, 'images/blog', 'images/Blog')\n WHERE `image` LIKE ('" . ASCMS_PATH_OFFSET . "/images/blog%')"); \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_blog_networks` \n SET `icon` = REPLACE(`icon`, 'images/blog', 'images/Blog')\n WHERE `icon` LIKE ('" . ASCMS_PATH_OFFSET . "/images/blog%')"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $blogImgPath = ASCMS_DOCUMENT_ROOT . '/images'; try { if (file_exists($blogImgPath . '/blog') && !file_exists($blogImgPath . '/Blog')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($blogImgPath . '/blog'); if (!\Cx\Lib\FileSystem\FileSystem::move($blogImgPath . '/blog', $blogImgPath . '/Blog')) { return 'Failed to move the folder from ' . $blogImgPath . '/blog to ' . $blogImgPath . '/Blog.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Blog updated successfully.'; }
function podcastUpdate() { try { // Update module name \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "modules` SET `name` = 'Podcast' WHERE `id` = 35"); // Update navigation url value \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "backend_areas` SET `uri` = 'index.php?cmd=Podcast' WHERE `area_id` = 93"); // Insert entry for component \Cx\Lib\UpdateUtil::sql("INSERT INTO `" . DBPREFIX . "component` (`id`, `name`, `type`) VALUES ('35', 'Podcast', 'module')"); // Update module name for frontend pages \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "content_page` SET `module` = 'Podcast' WHERE `module` = 'podcast'"); // Update the thumbnail path from images/podcast into images/Podcast \Cx\Lib\UpdateUtil::sql("UPDATE `" . DBPREFIX . "module_podcast_medium`\n SET `thumbnail` = REPLACE(`thumbnail`, 'images/podcast', 'images/Podcast')\n WHERE `thumbnail` LIKE ('" . ASCMS_PATH_OFFSET . "/images/podcast%')"); } catch (\Cx\Lib\UpdateException $e) { return "Error: {$e->sql}"; } //Update script for moving the folder $imgPath = ASCMS_DOCUMENT_ROOT . '/images'; $mediaPath = ASCMS_DOCUMENT_ROOT . '/media'; try { if (file_exists($imgPath . '/podcast') && !file_exists($imgPath . '/Podcast')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($imgPath . '/podcast'); if (!\Cx\Lib\FileSystem\FileSystem::move($imgPath . '/podcast', $imgPath . '/Podcast')) { return 'Failed to move the folder from ' . $imgPath . '/podcast to ' . $imgPath . '/Podcast.'; } } if (file_exists($mediaPath . '/podcast') && !file_exists($mediaPath . '/Podcast')) { \Cx\Lib\FileSystem\FileSystem::makeWritable($mediaPath . '/podcast'); if (!\Cx\Lib\FileSystem\FileSystem::move($mediaPath . '/podcast', $mediaPath . '/Podcast')) { return 'Failed to move the folder from ' . $mediaPath . '/podcast to ' . $mediaPath . '/Podcast.'; } } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return $e->getMessage(); } return 'Podcast Component database updated successfully'; }
/** * 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; }
/** * Handles database errors * * Also migrates old names to the new structure * @return boolean False. Always. * @static * @throws Cx\Lib\Update_DatabaseException */ static function errorHandler() { // Shipment static $break = false; if ($break) { die("\n Shipment::errorHandler(): Recursion detected while handling an error.<br /><br />\n This should not happen. We are very sorry for the inconvenience.<br />\n Please contact customer support: helpdesk@comvation.com"); } $break = true; //die("Shipment::errorHandler(): Disabled!<br />"); // Fix the Zones table first Zones::errorHandler(); $table_name = DBPREFIX . 'module_shop_shipper'; $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'ord' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'notnull' => true, 'default' => '1', 'renamefrom' => 'status')); $table_index = array(); $default_lang_id = \FWLanguage::getDefaultLangId(); if (\Cx\Lib\UpdateUtil::table_exist($table_name)) { if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'name')) { \Text::deleteByKey('Shop', self::TEXT_NAME); $query = "\n SELECT `id`, `name`\n FROM `{$table_name}`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if (!$objResult) { throw new \Cx\Lib\Update_DatabaseException("Failed to query names", $query); } while (!$objResult->EOF) { $id = $objResult->fields['id']; $name = $objResult->fields['name']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate name '{$name}'"); } $objResult->MoveNext(); } } } \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index); $table_name = DBPREFIX . 'module_shop_shipment_cost'; $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'shipper_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => true, 'default' => '0'), 'max_weight' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'fee' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'cost'), 'free_from' => array('type' => 'DECIMAL(9,2)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'price_free')); $table_index = array(); \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index); // Always! return false; }
/** * 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; }
/** * Handle any error occurring in this class. * * Tries to fix known problems with the database table. * @global mixed $objDatabase Database object * @return boolean False. Always. * @throws Update_DatabaseException * @static * @author Reto Kohli <*****@*****.**> */ static function errorHandler() { $table_name = DBPREFIX . "core_text"; if (!\Cx\Lib\UpdateUtil::table_exist($table_name)) { $query = "\n CREATE TABLE `" . DBPREFIX . "core_text` (\n `id` INT(10) UNSIGNED NOT NULL DEFAULT 0,\n `lang_id` INT(10) UNSIGNED NOT NULL DEFAULT 1,\n `section` VARCHAR(32) NULL DEFAULT NULL,\n `key` VARCHAR(255) NOT NULL,\n `text` TEXT NOT NULL,\n PRIMARY KEY `id` (`id`, `lang_id`, `section`, `key`(32)),\n FULLTEXT `text` (`text`)\n ) ENGINE=MyISAM"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if (!$objResult) { throw new \Cx\Lib\Update_DatabaseException('Failed to create Text table', $query); } } // More to come... return false; }
/** * Handles database errors * * Also migrates text fields to the new structure * @return boolean False. Always. * @static * @throws Cx\Lib\Update_DatabaseException */ static function errorHandler() { // Product // Fix the Text, Discount, and Manufacturer tables first \Text::errorHandler(); // Discount::errorHandler(); // Called by Customer::errorHandler(); Manufacturer::errorHandler(); $table_name = DBPREFIX . 'module_shop_products'; $table_structure = array('id' => array('type' => 'INT(10)', 'unsigned' => true, 'auto_increment' => true, 'primary' => true), 'normalprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'resellerprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'discountprice' => array('type' => 'DECIMAL(9,2)', 'default' => '0.00'), 'discount_active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '0', 'renamefrom' => 'is_special_offer'), 'stock' => array('type' => 'INT(10)', 'default' => '10'), 'stock_visible' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'stock_visibility'), 'active' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1', 'renamefrom' => 'status'), 'b2b' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1'), 'b2c' => array('type' => 'TINYINT(1)', 'unsigned' => true, 'default' => '1'), 'date_start' => array('type' => 'TIMESTAMP', 'default' => '0000-00-00 00:00:00', 'renamefrom' => 'startdate'), 'date_end' => array('type' => 'TIMESTAMP', 'default' => '0000-00-00 00:00:00', 'renamefrom' => 'enddate'), 'weight' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'category_id' => array('type' => 'VARCHAR(255)', 'default' => '', 'renamefrom' => 'catid'), 'vat_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'manufacturer_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null, 'renamefrom' => 'manufacturer'), 'group_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'article_id' => array('type' => 'INT(10)', 'unsigned' => true, 'notnull' => false, 'default' => null), 'usergroup_ids' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'ord' => array('type' => 'INT(10)', 'default' => '0', 'renamefrom' => 'sort_order'), 'distribution' => array('type' => 'VARCHAR(16)', 'default' => '', 'renamefrom' => 'handler'), 'picture' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'flags' => array('type' => 'VARCHAR(4096)', 'notnull' => false, 'default' => null), 'minimum_order_quantity' => array('type' => 'INT(10)', 'unsigned' => false, 'default' => '0')); $table_index = array('group_id' => array('fields' => array('group_id')), 'article_id' => array('fields' => array('article_id')), 'flags' => array('fields' => array('flags'), 'type' => 'FULLTEXT')); $default_lang_id = \FWLanguage::getDefaultLangId(); if (\Cx\Lib\UpdateUtil::table_exist($table_name)) { if (\Cx\Lib\UpdateUtil::column_exist($table_name, 'title')) { // Migrate all Product strings to the Text table first \Text::deleteByKey('Shop', self::TEXT_NAME); \Text::deleteByKey('Shop', self::TEXT_SHORT); \Text::deleteByKey('Shop', self::TEXT_LONG); \Text::deleteByKey('Shop', self::TEXT_CODE); \Text::deleteByKey('Shop', self::TEXT_URI); \Text::deleteByKey('Shop', self::TEXT_KEYS); $query = "\n SELECT `id`, `title`, `shortdesc`, `description`,\n `product_id`, `external_link`, `keywords`\n FROM `{$table_name}`"; $objResult = \Cx\Lib\UpdateUtil::sql($query); if (!$objResult) { throw new \Cx\Lib\Update_DatabaseException("Failed to query Product strings", $query); } while (!$objResult->EOF) { $id = $objResult->fields['id']; $name = $objResult->fields['title']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_NAME, $name)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product name '{$name}'"); } $short = $objResult->fields['shortdesc']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_SHORT, $short)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product short '{$short}'"); } $long = $objResult->fields['description']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_LONG, $long)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product long '{$long}'"); } $code = $objResult->fields['product_id']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_CODE, $code)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product code '{$code}'"); } $uri = $objResult->fields['external_link']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_URI, $uri)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product uri '{$uri}'"); } $keys = $objResult->fields['keywords']; if (!\Text::replace($id, $default_lang_id, 'Shop', self::TEXT_KEYS, $keys)) { throw new \Cx\Lib\Update_DatabaseException("Failed to migrate Product keys '{$keys}'"); } $objResult->MoveNext(); } } } \Cx\Lib\UpdateUtil::table($table_name, $table_structure, $table_index); // Also fix Customer and some related tables Customer::errorHandler(); // Always return false; }
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; }
/** * 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; }