[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/migrate/ -> index.php (source)

   1  <?php
   2  /*+**********************************************************************************

   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.1

   4   * ("License"); You may not use this file except in compliance with the License

   5   * The Original Code is:  vtiger CRM Open Source

   6   * The Initial Developer of the Original Code is vtiger.

   7   * Portions created by vtiger are Copyright (C) vtiger.

   8   * All Rights Reserved.

   9   ************************************************************************************/
  10  chdir (dirname(__FILE__) . '/..');
  11  include_once  'vtigerversion.php';
  12  include_once  'data/CRMEntity.php';
  13  
  14  @session_start();
  15  
  16  if(isset($_REQUEST['username']) && isset($_REQUEST['password'])){
  17      global $root_directory, $log;
  18      $userName = $_REQUEST['username'];
  19      $password = $_REQUEST['password'];
  20  
  21      $user = CRMEntity::getInstance('Users');
  22      $user->column_fields['user_name'] = $userName;
  23      if ($user->doLogin($password)) {
  24          $zip = new ZipArchive();
  25          $fileName = 'vtiger6.zip';
  26          if ($zip->open($fileName)) {
  27              for ($i = 0; $i < $zip->numFiles; $i++) {
  28                  $log->fatal('Filename: ' . $zip->getNameIndex($i) . '<br />');
  29              }
  30              if ($zip->extractTo($root_directory)) {
  31                  $zip->close();
  32                  
  33                  $userid = $user->retrieve_user_id($userName);
  34                  $_SESSION['authenticated_user_id'] = $userid;
  35  
  36                  header('Location: ../index.php?module=Migration&view=Index&mode=step1');
  37              } else {
  38                  $errorMessage = '<p>ERROR EXTRACTING MIGRATION ZIP FILE!</p>';
  39                  header('Location: index.php?error='.$errorMessage);
  40              }
  41          } else {
  42              $errorMessage = 'ERROR READING MIGRATION ZIP FILE!';
  43              header('Location: index.php?error='.$errorMessage);
  44          }
  45      } else {
  46          $errorMessage = 'INVALID CREDENTIALS';
  47          header('Location: index.php?error='.$errorMessage);
  48      }
  49  }
  50  ?>
  51  <html>
  52      <head>
  53          <title>Vtiger CRM Setup</title>
  54          <meta name="viewport" content="width=device-width, initial-scale=1.0">
  55          <script type="text/javascript" src="resources/js/jquery-min.js"></script>
  56          <link href="resources/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  57          <link href="resources/css/mkCheckbox.css" rel="stylesheet">
  58          <link href="resources/css/style.css" rel="stylesheet">
  59      </head>
  60      <body>
  61          <div class="container-fluid page-container">
  62              <div class="row-fluid">
  63                  <div class="span6">
  64                      <div class="logo">
  65                          <img src="resources/images/vt1.png" alt="Vtiger Logo"/>
  66                      </div>
  67                  </div>
  68                  <div class="span6">
  69                      <div class="head pull-right">
  70                          <h3>Migration Wizard</h3>
  71                      </div>
  72                  </div>
  73              </div>
  74              <div class="row-fluid main-container">
  75                  <div class="span12 inner-container">
  76                      <div class="row-fluid">
  77                          <div class="span10">
  78                              <h4 class=""> Welcome </h4>
  79                          </div>
  80                          <div class="span2">
  81                              <a href="https://wiki.vtiger.com/vtiger6/" target="_blank" class="pull-right">
  82                                  <img src="resources/images/help40.png" alt="Help-Icon"/>
  83                              </a>
  84                          </div>
  85                      </div>
  86                      <hr>
  87                      <div class="row-fluid">
  88                          <div class="span4 welcome-image">
  89                              <img src="resources/images/migration_screen.png" alt="Vtiger Logo"/>
  90                          </div>
  91                          <div class="span8">
  92                              <?php $currentVersion = explode('.', $vtiger_current_version);
  93                              if($currentVersion[0] >= 6 && $currentVersion[1] >= 0){?>
  94                              <div>
  95                                  <h3> Welcome to Vtiger Migration </h3>
  96                                  <?php
  97                                  if(isset($_REQUEST['error'])) {
  98                                      echo '<span><font color="red"><b>'.filter_var($_REQUEST['error'], FILTER_SANITIZE_STRING).'</b></font></span><br><br>';
  99                                  }?>
 100                                  <p>We have detected that you have <strong>Vtiger <?php echo $vtiger_current_version?> </strong>installation. <br> <br> </p>
 101                                  <p>
 102                                      <strong> Warning: </strong>Please note that it is not possible to revert back to <?php echo $vtiger_current_version?> after the upgrade to vtiger 6 <br>
 103                                      So, it is important to take a backup of the <?php echo $vtiger_current_version?> installation, including the source files
 104                                      and database.</p><br>
 105                                  <form action="index.php" method="POST">
 106                                      <div><input type="checkbox" id="checkBox1" name="checkBox1"/> <div class="chkbox"></div> I have taken the backup of database <a href="http://community.vtiger.com/help/vtigercrm/administrators/backup.html" target="_blank" >(how to?)</a> </div><br>
 107                                      <div><input type="checkbox" id="checkBox2" name="checkBox2"/> <div class="chkbox"></div> I have taken the backup of source folder <a href="http://community.vtiger.com/help/vtigercrm/administrators/backup.html" target="_blank" >(how to?)</a></div><br>
 108                                      <br><div>
 109                                          <span id="error"></span>
 110                                          User Name <span class="no">&nbsp;</span>
 111                                          <input type="text" value="" name="username" id="username" />&nbsp;&nbsp;
 112                                          Password <span class="no">&nbsp;</span>
 113                                          <input type="password" value="" name="password" id="password" />&nbsp;&nbsp;
 114                                      </div>
 115                                      <br><br><br>
 116                                      <div class="button-container">
 117                                          <input type="submit" class="btn btn-large btn-primary" id="startMigration" name="startMigration" value="Start Migration" />
 118                                      </div>
 119                                  </form>
 120                              </div>
 121                              <?php } else if($currentVersion[0] < 6){?>
 122                              <div><br><br><br><br><br>
 123                                  <h3><font color='red'>WARNING : Cannot continue with Migration </font></h3>
 124                                  <p>
 125                                      We detected that this installation is running <strong>Vtiger CRM </strong><?php if($vtiger_current_version < 6 ) { echo '<b>'.$vtiger_current_version.'</b>'; } ?>.
 126                                      Please upgrade to <strong>5.4.0</strong> first before continuing with this wizard.
 127                                  </p>
 128                                  <br><br><br><br>
 129                                  <div class="button-container">
 130                                          <input type="button" onclick="window.location.href='index.php'" class="btn btn-large btn-primary" value="Finish"/>
 131                                  </div>
 132                              </div>
 133                              <?php } else {?><br><br><br><br>
 134                                  <h3><font color='red'>WARNING : Cannot continue with Migration </font></h3>
 135                                  <p>
 136                                      <strong>We detected that this source is upgraded latest version.</strong>
 137                                  </p>
 138                                  <br><br><br><br>
 139                                  <div class="button-container">
 140                                          <input type="button" onclick="window.location.href='index.php'" class="btn btn-large btn-primary" value="Finish"/>
 141                                  </div>
 142                              <?php }?>
 143                          </div>
 144                      </div>
 145                  </div>
 146              </div>
 147              <script>
 148                  $(document).ready(function(){
 149                      $('input[name="startMigration"]').click(function(){
 150                          if($("#checkBox1").is(':checked') == false || $("#checkBox2").is(':checked') == false){
 151                              alert('Before starting migration, please take your database and source backup');
 152                              return false;
 153                          }
 154                          if($('#username').val() == '' || $('#password').val() == ''){
 155                              alert('Please enter Admin credentials to start Migration');
 156                              return false;
 157                          }
 158                          return true;
 159                      });
 160                  });
 161              </script>
 162      </body>
 163  </html>
 164  


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1