Пример #1
0
 private function findError()
 {
     global $scripts;
     global $navigation;
     $answer = false;
     if ($this->getCurrentVersion() == $scripts::destinationVersion) {
         return IP_ERROR_COMPLETED;
     }
     $script = $navigation->curScript();
     $action = $navigation->curAction();
     $breadcrumb = $scripts->getScripts($this->getCurrentVersion());
     if (sizeof($breadcrumb) == 0) {
         return IP_ERROR_NO_INFORMATION;
     }
     if ($navigation->curStep() == 2 && sizeof($breadcrumb) < $script) {
         return IP_ERROR_404;
     }
     $curScript = $breadcrumb[$script - 1];
     require_once 'scripts/' . $curScript['script'] . '/script.php';
     eval('$tmpScript = new \\' . $curScript['script'] . '\\Script(sizeof($breadcrumb), $script, $action); ');
     if ($tmpScript->getActionsCount() < $action) {
         return IP_ERROR_404;
     }
     $module = \Db_100::getModule(null, 'standard', 'copy_content');
     if ($module) {
         return IP_ERROR_UNINSTALL_COPY_CONTENT;
     }
     //add check if copy content is not present
     return $answer;
 }
Пример #2
0
 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;
 }
Пример #3
0
 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;
 }
Пример #4
0
 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;
 }
Пример #5
0
 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;
 }