Exemple #1
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;
 }
Exemple #2
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;
 }