Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Patch script improvement

 - added a link to go to login page after patch is done
 - added a link to go back to admin.php after patch is done
   (only appears if the file was run from admin.php)
 - general aesthetics modifications
  • Loading branch information...
commit f6d1333ad39cba0c578892a8c425d83f2b3f2286 1 parent ae35631
Craig authored bradymiller committed

Showing 1 changed file with 45 additions and 33 deletions. Show diff stats Hide diff stats

  1. 78  sql_patch.php
78  sql_patch.php
@@ -23,46 +23,58 @@
23 23
 // Force logging off
24 24
 $GLOBALS["enable_auditlog"]=0;
25 25
 
26  
-?>
  26
+$EMRversion = trim(preg_replace('/\s*\([^)]*\)/', '', $GLOBALS['openemr_version']));
  27
+?>   
  28
+
27 29
 
28 30
 <html>
29 31
 <head>
30  
-<title>OpenEMR Database Patch</title>
  32
+<title>OpenEMR <?php echo attr($EMRversion) ?> <?php echo xlt('Database Patch'); ?></title>
31 33
 <link rel='STYLESHEET' href='interface/themes/style_blue.css'>
32 34
 </head>
33  
-<body>
34  
-<center>
35  
-<span class='title'>OpenEMR Database Patch</span>
36  
-<br>
37  
-</center>
38  
-
39  
-<?php
40  
-upgradeFromSqlFile('patch.sql');
41  
-flush();
42  
-
43  
-echo "<font color='green'>Updating global configuration defaults...</font><br />\n";
44  
-require_once("library/globals.inc.php");
45  
-foreach ($GLOBALS_METADATA as $grpname => $grparr) {
46  
-  foreach ($grparr as $fldid => $fldarr) {
47  
-    list($fldname, $fldtype, $flddef, $flddesc) = $fldarr;
48  
-    if (substr($fldtype, 0, 2) !== 'm_') {
49  
-      $row = sqlQuery("SELECT count(*) AS count FROM globals WHERE gl_name = '$fldid'");
50  
-      if (empty($row['count'])) {
51  
-        sqlStatement("INSERT INTO globals ( gl_name, gl_index, gl_value ) " .
52  
-          "VALUES ( '$fldid', '0', '$flddef' )");
  35
+<body style="color:green;">
  36
+<div style="box-shadow: 3px 3px 5px 6px #ccc; border-radius: 20px; padding: 10px 40px;background-color:#EFEFEF; width:500px; margin:40px auto"> 
  37
+  
  38
+  <p style="font-weight:bold; font-size:1.8em; text-align:center">OpenEMR <?php echo text($EMRversion),' ',xlt('Database Patch'),' ',text($v_realpatch) ?></p>      
  39
+  <p style="font-weight:bold; text-align:center;"><?php echo xlt('Applying Patch to site'),' : ',text($_SESSION['site_id']) ?></p>
  40
+   
  41
+  
  42
+  <?php
  43
+  upgradeFromSqlFile('patch.sql');
  44
+  flush();
  45
+  
  46
+  echo '<p style="font-weight:bold; text-align:left; color:green">',xlt('Updating global configuration defaults'),'...</p>';
  47
+  require_once("library/globals.inc.php");
  48
+  foreach ($GLOBALS_METADATA as $grpname => $grparr) {
  49
+    foreach ($grparr as $fldid => $fldarr) {
  50
+      list($fldname, $fldtype, $flddef, $flddesc) = $fldarr;
  51
+      if (substr($fldtype, 0, 2) !== 'm_') {
  52
+        $row = sqlQuery("SELECT count(*) AS count FROM globals WHERE gl_name = '$fldid'");
  53
+        if (empty($row['count'])) {
  54
+          sqlStatement("INSERT INTO globals ( gl_name, gl_index, gl_value ) " .
  55
+            "VALUES ( '$fldid', '0', '$flddef' )");
  56
+        }
53 57
       }
54 58
     }
55 59
   }
56  
-}
57  
-
58  
-echo "<font color='green'>Updating version indicators...</font><br />\n";
59  
-sqlStatement("UPDATE version SET v_realpatch = '$v_realpatch'");
60  
-
61  
-echo "<p><font color='green'>Database patch finished.</font></p>\n";
62  
-echo "</body></html>\n";
63  
-exit();
64  
-
65  
-?>
66  
-
  60
+                                
  61
+  echo '<p style="font-weight:bold; text-align:left;">',xlt('Updating version indicators'),'...</p>'; 
  62
+  sqlStatement("UPDATE version SET v_realpatch = '$v_realpatch'");
  63
+   
  64
+                  
  65
+  echo '<p style="text-align:center; font-size:1.8em;">',xlt('Database Patch'),' ',text($v_realpatch),' ',xlt('finished'),'.</p>'; 
  66
+  
  67
+  echo '<p style="text-align:center; font-size:1.8em;">OpenEMR ',xlt('Version'),' = ',text($EMRversion.'('.$v_realpatch.')'),'.</p>';  
  68
+   
  69
+  echo '<p><a style="border-radius: 10px; padding:5px; width:200px; margin:0 auto; background-color:green; color:white; font-weight:bold; display:block; text-align:center;" href="index.php?site=',attr($_SESSION['site_id']).'">',xlt('Log in'),'</a></p>';  
  70
+  
  71
+  if(isset($_SERVER['HTTP_REFERER'])) {
  72
+      $split = preg_split('/\//',$_SERVER['HTTP_REFERER']);
  73
+      if($split[count($split) - 1] == 'admin.php')
  74
+        echo '<p><a style="border-radius: 10px; padding:5px; width:200px; margin:0 auto; background-color:green; color:white; font-weight:bold; display:block; text-align:center;" href="admin.php">',xlt('Back to Admin Page'),'</a></p>';
  75
+  }  
  76
+  
  77
+  ?>
  78
+</div>
67 79
 </body>
68 80
 </html>

0 notes on commit f6d1333

Please sign in to comment.
Something went wrong with that request. Please try again.