public function updateDatabase() { global $navigation; global $htmlOutput; require_once 'db/db100.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.8') { if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.8'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once __DIR__ . '/../update_1_0_2_beta_to_1_0_3_beta/parameters_refractor.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.11') { if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.11'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once 'db/db100.php'; require_once __DIR__ . '/parameter_manager.php'; require_once __DIR__ . '/parameter_db.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.5') { $module = \Modules\developer\localization\Db::getModule('community', 'newsletter'); //community/user module $sql = "select max(`row_number`) as 'max_row_number' from `" . DB_PREF . "module` where `group_id` = '" . (int) $module['group_id'] . "' "; $rs = mysql_query($sql); if ($rs) { if ($lock = mysql_fetch_assoc($rs)) { $maxRowNumber = $lock['max_row_number']; } else { trigger_error('Can\'t get max row number ' . $sql); } $sqlUser = "******" . DB_PREF . "module` (`group_id`, `row_number`, `name`, `admin`, `translation`, `managed`, `version`, `core`) \n VALUES (" . (int) $module['group_id'] . ", " . ($maxRowNumber + 1) . ", 'user', 1, 'User', 1, '1.00', 1);\n "; $rs = mysql_query($sqlUser); if ($rs) { $userModuleId = mysql_insert_id(); $users = $this->getUsers(); foreach ($users as $user) { $this->addPermissions($userModuleId, $user['id']); } } else { trigger_error($sqlUser . ' ' . mysql_error()); } } else { trigger_error($sql . ' ' . mysql_error()); } $sql = "\n CREATE TABLE IF NOT EXISTS `" . DB_PREF . "m_community_user` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\n `login` varchar(255) NULL,\n `language_id` int(11) NOT NULL,\n `email` varchar(255) NOT NULL,\n `password` varchar(32) NOT NULL,\n `verified` tinyint(1) NOT NULL DEFAULT '0',\n `created_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n `last_login` timestamp NULL DEFAULT NULL,\n `verification_code` varchar(32) NOT NULL,\n `new_email` varchar(255) DEFAULT NULL,\n `new_password` varchar(32) DEFAULT NULL,\n `warned_on` timestamp NULL DEFAULT NULL,\n `valid_until` timestamp NULL DEFAULT NULL COMMENT 'required for maintenance. Real date should be calculated in real time by last_login field.',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=9 ;\n "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } \Modules\developer\localization\Manager::saveParameters(__DIR__ . '/community_user_parameters.php'); \Modules\developer\localization\Manager::saveParameters(__DIR__ . '/standard_languages_parameters.php'); //end community/user module //drop additional field in widget tables $tablesWithBaseUrl = array(); $tablesWithBaseUrl[] = DB_PREF . 'mc_text_photos_text_title'; $tablesWithBaseUrl[] = DB_PREF . 'mc_text_photos_text_photo'; $tablesWithBaseUrl[] = DB_PREF . 'mc_text_photos_text'; $tablesWithBaseUrl[] = DB_PREF . 'mc_text_photos_faq'; $tablesWithBaseUrl[] = DB_PREF . 'mc_misc_rich_text'; foreach ($tablesWithBaseUrl as $table) { $sqlColumns = "show columns from `" . $table . "`"; $rsColumns = mysql_query($sqlColumns); if ($rsColumns) { $columns = array(); while ($lockColumn = mysql_fetch_assoc($rsColumns)) { $columns[$lockColumn['Field']] = 1; } if (isset($columns['base_url'])) { $sql = " alter table `" . $table . "` drop `base_url` "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } } } else { trigger_error($sql . ' ' . mysql_error()); } } $replaceParameters = array(); $replaceParameters[] = array('from' => 'show_unsubscribtion_button', 'to' => 'show_unsubscribe_button'); $replaceParameters[] = array('from' => 'man_aditional_add_rss', 'to' => 'man_additional_add_rss'); $replaceParameters[] = array('from' => 'man_aditional_button_title', 'to' => 'man_additional_button_title'); $replaceParameters[] = array('from' => 'man_aditional_created_on', 'to' => 'man_additional_created_on'); $replaceParameters[] = array('from' => 'man_aditional_description', 'to' => 'man_additional_description'); $replaceParameters[] = array('from' => 'man_aditional_error_date_format', 'to' => 'man_additional_error_date_format'); $replaceParameters[] = array('from' => 'man_aditional_inactive', 'to' => 'man_additional_inactive'); $replaceParameters[] = array('from' => 'man_aditional_info', 'to' => 'man_additional_info'); $replaceParameters[] = array('from' => 'man_aditional_keywords', 'to' => 'man_additional_keywords'); $replaceParameters[] = array('from' => 'man_aditional_no_redirect', 'to' => 'man_additional_no_redirect'); $replaceParameters[] = array('from' => 'man_aditional_page_properties', 'to' => 'man_additional_page_properties'); $replaceParameters[] = array('from' => 'man_aditional_page_title', 'to' => 'man_additional_page_title'); $replaceParameters[] = array('from' => 'man_aditional_redirect', 'to' => 'man_additional_redirect'); $replaceParameters[] = array('from' => 'man_aditional_subpage', 'to' => 'man_additional_subpage'); $replaceParameters[] = array('from' => 'man_aditional_type', 'to' => 'man_additional_type'); $replaceParameters[] = array('from' => 'man_aditional_url', 'to' => 'man_additional_url'); $replaceParameters[] = array('from' => 'man_aditional_visible', 'to' => 'man_additional_visible'); foreach ($replaceParameters as $parameter) { $sql = " update `" . DB_PREF . "parameter` set `name` = '" . mysql_real_escape_string($parameter['to']) . "' where `name` = '" . mysql_real_escape_string($parameter['from']) . "' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } } $replaceParameters = array(); $replaceParameters[] = array('from' => 'Log zise in days', 'to' => 'Log size in days'); $replaceParameters[] = array('from' => 'Field fonfiguration file', 'to' => 'Field configuration file'); $replaceParameters[] = array('from' => 'Unpossible to delete the record', 'to' => 'Impossible to delete the record'); $replaceParameters[] = array('from' => 'Aditional info', 'to' => 'Additional info'); foreach ($replaceParameters as $parameter) { $sql = " update `" . DB_PREF . "parameter` set `translation` = '" . mysql_real_escape_string($parameter['to']) . "' where `translation` = '" . mysql_real_escape_string($parameter['from']) . "' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } } if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.5'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once 'db/db100.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.4') { $module = \Db_100::getModule(null, 'administrator', 'email_queue'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations'); \Db_100::addStringParameter($group['id'], 'Email queue', 'email_queue', 'Email queue', 1); $module = \Db_100::getModule(null, 'developer', 'modules'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations_install'); \Db_100::addStringParameter($group['id'], 'Updated module detected', 'updated_module_detected', 'New version detected', 1); \Db_100::addStringParameter($group['id'], 'Install', 'install', 'Install', 1); \Db_100::addStringParameter($group['id'], 'Update', 'update', 'Update', 1); $module = \Db_100::getModule(null, 'standard', 'menu_management'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations'); \Db_100::addStringParameter($group['id'], 'Save', 'save', 'Save', 1); $module = \Db_100::getModule(null, 'community', 'newsletter'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations'); \Db_100::addStringParameter($group['id'], 'Where to send?', 'where_to_send', 'Send test email to: ', 1); $sql = "update `" . DB_PREF . "parameter` set `name` = 'was_sent' where `name` = 'was_send' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } //delete duplicated parameter $module = \Db_100::getModule(null, 'developer', 'std_mod'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations'); $sql = "select * from `" . DB_PREF . "parameter` where `group_id` = '" . (int) $group['id'] . "' and `name` = '" . mysql_real_escape_string('error_required') . "'"; $rs = mysql_query($sql); $parameters = array(); if ($rs) { while ($lock = mysql_fetch_assoc($rs)) { $parameters[] = $lock; } } else { trigger_error($sql . " " . mysql_error()); } if (sizeof($parameters) > 1) { $sql = "delete from `" . DB_PREF . "parameter` where `id` = " . (int) $parameters[1]['id'] . " "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . " " . mysql_error()); } } //end delete duplicated parameter //fix logo galery layout field $sql = "update `" . DB_PREF . "mc_text_photos_logo_gallery` set `layout` = 'default' where `layout` = 'undefined' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } //correct separator module_id field $sql = "select * from `" . DB_PREF . "content_element_to_modules` where `group_key` = 'text_photos' and `module_key` = 'separator' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } $contentToModule = array(); while ($lock = mysql_fetch_assoc($rs)) { $contentToModule[] = $lock; } $sql = "select * from `" . DB_PREF . "mc_text_photos_separator` where 1 "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } $separators = array(); while ($lock = mysql_fetch_assoc($rs)) { $separators[] = $lock; } foreach ($contentToModule as $key => $module) { if (isset($separators[$key])) { $sql = "update `" . DB_PREF . "content_element_to_modules` set `module_id` = " . (int) $separators[$key]['id'] . " where `id` = " . (int) $module['id'] . " "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } } } //end correct separator module_id field //fix to_big to too_big $sql = "update `" . DB_PREF . "parameter` set `name` = 'too_big' where `name` = 'to_big' "; $rs = mysql_query($sql); if (!$rs) { trigger_error($sql . ' ' . mysql_error()); } if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.4'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once __DIR__ . '/../update_1_0_2_beta_to_1_0_3_beta/parameters_refractor.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.9') { $sql = "ALTER TABLE `" . DB_PREF . "content_element` CHANGE `row_number` `row_number` DOUBLE NOT NULL DEFAULT '0' "; $rs = mysql_query($sql); if (!$sql) { trigger_error($sql . ' ' . mysql_error()); } $module = \Db_100::getModule(null, 'standard', 'menu_management'); $parametersRefractor = new \update_1_0_2_beta_to_1_0_3_beta\ParametersRefractor(); $group = $parametersRefractor->getParametersGroup($module['id'], 'admin_translations'); if ($group) { if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'general')) { \Db_100::addStringParameter($group['id'], 'General', 'general', 'General', 1); } if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'seo')) { \Db_100::addStringParameter($group['id'], 'Seo', 'seo', 'SEO', 1); } if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'advanced')) { \Db_100::addStringParameter($group['id'], 'Advanced', 'advanced', 'Advanced', 1); } if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'copy')) { \Db_100::addStringParameter($group['id'], 'Copy', 'copy', 'Copy', 1); } if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'paste')) { \Db_100::addStringParameter($group['id'], 'Paste', 'paste', 'Paste', 1); } if (!\Db_100::getParameter('standard', 'menu_management', 'admin_translations', 'cancel')) { \Db_100::addStringParameter($group['id'], 'Cancel', 'cancel', 'Cancel', 1); } } if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.9'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once 'db/db100.php'; require_once __DIR__ . '/db.php'; require_once __DIR__ . '/../update_1_0_2_beta_to_1_0_3_beta/parameters_refractor.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.8') { $parametersRefractor = new \update_1_0_2_beta_to_1_0_3_beta\ParametersRefractor(); //add table widget $widgetGroup = Db::getWidgetGroup('text_photos'); $newWidget = array('name' => 'table', 'group_id' => $widgetGroup['id'], 'dynamic' => 0, 'translation' => 'Table', 'version' => '1.00', 'row_number' => Db::getMaxWidgetGroupRow($widgetGroup['id']) + 1); Db::addWidget($widgetGroup['id'], $newWidget); //add parameters group $module = \Db_100::getModule(null, 'standard', 'content_management'); $parameterGroup = $parametersRefractor->getParametersGroup($module['id'], 'widget_table'); if ($parameterGroup) { $parameterGroupId = $parameterGroup['id']; } else { $parameterGroupId = $parametersRefractor->addParameterGroup($module['id'], 'widget_table', 'Widget table', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_table', 'widget_title')) { \Db_100::addStringParameter($parameterGroupId, 'Widget title', 'widget_title', 'Table', 1); } Db::createTableWidgetTables(); //upate contact form widget Db::updateContactFormWidget(); Db::updateContactFormTextareaFiel(); //update contact form widget parameters $parametersRefractor->deleteParameter('standard', 'content_management', 'widget_contact_form', 'text_field'); $parametersRefractor->deleteParameter('standard', 'content_management', 'widget_contact_form', 'text_row'); $module = \Db_100::getModule(null, 'community', 'user'); $group = $parametersRefractor->getParametersGroup($module['id'], 'translations'); if ($group) { if (!\Db_100::getParameter('community', 'user', 'translations', 'autologin')) { \Db_100::addStringParameter($group['id'], 'Autologin', 'autologin', 'Remember me', 0); } } $group = $parametersRefractor->getParametersGroup($module['id'], 'options'); if ($group) { if (!\Db_100::getParameter('community', 'user', 'options', 'enable_autologin')) { \Db_100::addBoolParameter($group['id'], 'Enable autologin', 'enable_autologin', true, 1); } if (!\Db_100::getParameter('community', 'user', 'options', 'require_email_confirmation')) { \Db_100::addBoolParameter($group['id'], 'Require email confirmation', 'require_email_confirmation', true, 1); } if (!\Db_100::getParameter('community', 'user', 'options', 'autologin_after_registration')) { \Db_100::addBoolParameter($group['id'], 'Autologin after registration', 'autologin_after_registration', true, 1); } if (!\Db_100::getParameter('community', 'user', 'options', 'autologin_time')) { \Db_100::addIntegerParameter($group['id'], 'Autologin time (days)', 'autologin_time', 300, 1); } } $module = \Db_100::getModule(null, 'standard', 'content_management'); $group = $parametersRefractor->getParametersGroup($module['id'], 'widget_contact_form'); if ($group) { if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'text')) { \Db_100::addStringParameter($group['id'], 'Text', 'text', 'Text', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'text_multiline')) { \Db_100::addStringParameter($group['id'], 'Text (multiline)', 'text_multiline', 'Text (multiline)', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'select')) { \Db_100::addStringParameter($group['id'], 'Select', 'select', 'Select', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'checkbox')) { \Db_100::addStringParameter($group['id'], 'Checkbox', 'checkbox', 'Checbox', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'radio')) { \Db_100::addStringParameter($group['id'], 'Radio', 'radio', 'Radio', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'values_popup_title')) { \Db_100::addStringParameter($group['id'], 'Values popup title', 'values_popup_title', 'Values', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'widget_contact_form', 'values_field_title')) { \Db_100::addStringParameter($group['id'], 'Values field title', 'values_field_title', 'Enter available values. Each value on a new line.', 1); } } $group = $parametersRefractor->getParametersGroup($module['id'], 'admin_translations'); if ($group) { if (!\Db_100::getParameter('standard', 'content_management', 'admin_translations', 'warning_not_saved')) { \Db_100::addStringParameter($group['id'], 'Warning not saved', 'warning_not_saved', 'Your changes are not saved', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'admin_translations', 'saved')) { \Db_100::addStringParameter($group['id'], 'Saved', 'saved', 'Saved', 1); } if (!\Db_100::getParameter('standard', 'content_management', 'admin_translations', 'save_now')) { \Db_100::addStringParameter($group['id'], 'Save now', 'save_now', 'Save now', 1); } } $module = \Db_100::getModule(null, 'standard', 'configuration'); $group = $parametersRefractor->getParametersGroup($module['id'], 'system_translations'); if ($group) { if (!\Db_100::getParameter('standard', 'configuration', 'system_translations', 'system_message')) { \Db_100::addStringParameter($group['id'], 'System message', 'system_message', 'System message', 1); } if (!\Db_100::getParameter('standard', 'configuration', 'system_translations', 'help')) { \Db_100::addStringParameter($group['id'], 'Help', 'help', 'Help', 1); } } if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.8'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }
public function updateDatabase() { global $navigation; global $htmlOutput; require_once 'db/db100.php'; $answer = ''; if (\Db_100::getSystemVariable('version') != '1.0.1 Beta') { $module = \Db_100::getModule(null, 'standard', 'menu_management'); $group = \Db_100::getParameterGroup($module['id'], 'admin_translations'); $sql = "\n INSERT INTO `" . DB_PREF . "parameter` (`name`, `admin`, `row_number`, `regexpression`, `group_id`, `translation`, `comment`, `type`) VALUES\n('error_type_url_empty', 1, 17, '', " . $group['id'] . ", 'Error type url empty', NULL, 'string');\n "; $rs = mysql_query($sql); if ($rs) { $sql2 = "INSERT INTO `" . DB_PREF . "par_string` (`value`, `parameter_id`) VALUES\n('External url can\\'t be empty', " . mysql_insert_id() . ")"; $rs2 = mysql_query($sql2); if (!$rs2) { trigger_error($sql2 . " " . mysql_error()); } } else { trigger_error($sql . " " . mysql_error()); } if ($this->curStep == $this->stepCount) { \Db_100::setSystemVariable('version', '1.0.1 Beta'); } } if ($this->curStep == $this->stepCount) { header("location: " . $navigation->generateLink($navigation->curStep() + 1)); } else { header("location: " . $navigation->generateLink($navigation->curStep(), $navigation->curScript() + 1)); } return $answer; }