PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/www/admin/updates-product.php

https://github.com/orchestra-io/sample-openx
PHP | 186 lines | 122 code | 23 blank | 41 comment | 26 complexity | 2a6d4e9486dda327d2cec15cdc97bc52 MD5 | raw file
  1. <?php
  2. /*
  3. +---------------------------------------------------------------------------+
  4. | OpenX v${RELEASE_MAJOR_MINOR} |
  5. | =======${RELEASE_MAJOR_MINOR_DOUBLE_UNDERLINE} |
  6. | |
  7. | Copyright (c) 2003-2009 OpenX Limited |
  8. | For contact details, see: http://www.openx.org/ |
  9. | |
  10. | This program is free software; you can redistribute it and/or modify |
  11. | it under the terms of the GNU General Public License as published by |
  12. | the Free Software Foundation; either version 2 of the License, or |
  13. | (at your option) any later version. |
  14. | |
  15. | This program is distributed in the hope that it will be useful, |
  16. | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  17. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  18. | GNU General Public License for more details. |
  19. | |
  20. | You should have received a copy of the GNU General Public License |
  21. | along with this program; if not, write to the Free Software |
  22. | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
  23. +---------------------------------------------------------------------------+
  24. $Id: updates-product.php 39870 2009-07-14 07:48:14Z matteo.beccati $
  25. */
  26. // Require the initialisation file
  27. require_once '../../init.php';
  28. // Required files
  29. require_once MAX_PATH . '/www/admin/config.php';
  30. require_once MAX_PATH . '/www/admin/lib-maintenance.inc.php';
  31. require_once MAX_PATH . '/lib/OA/Sync.php';
  32. // Security check
  33. OA_Permission::enforceAccount(OA_ACCOUNT_ADMIN);
  34. /*-------------------------------------------------------*/
  35. /* HTML framework */
  36. /*-------------------------------------------------------*/
  37. phpAds_PageHeader("updates-index");
  38. phpAds_MaintenanceSelection("product", "updates");
  39. /*-------------------------------------------------------*/
  40. /* Main code */
  41. /*-------------------------------------------------------*/
  42. // Determine environment
  43. $doApplicationVariable = OA_Dal::factoryDO('application_variable');
  44. $doApplicationVariable->name = 'oa_version';
  45. $doApplicationVariable->find();
  46. $doApplicationVariable->fetch();
  47. $current = $strCurrentlyUsing.' '.MAX_PRODUCT_NAME.'&nbsp;v'.OA_VERSION.' '.($doApplicationVariable->value!=OA_VERSION ? '(warning: database is stamped as v'.$doApplicationVariable->value.') ' : '');
  48. $current .= $strRunningOn.' '.str_replace('/', '&nbsp;', ereg_replace(" .*$", '', $_SERVER["SERVER_SOFTWARE"])).', ';
  49. $current .= 'PHP&nbsp;'.phpversion().' '.$strAndPlain.' '.phpAds_dbmsname;
  50. // Get the database version number.
  51. $connection = DBC::getCurrentConnection();
  52. $connectionId = $connection->getConnectionId();
  53. $aVersion = $connectionId->getServerVersion();
  54. $current .= '&nbsp;' . $aVersion['major'] . '.' . $aVersion['minor'] . '.' . $aVersion['patch'] . '-' . $aVersion['extra'];
  55. echo "<br />".$current.".<br /><br />";
  56. phpAds_ShowBreak();
  57. if (!isset($session['maint_update'])) {
  58. if (function_exists('xml_parser_create')) {
  59. // Show wait please text with rotating logo
  60. echo "<br />";
  61. echo "<table border='0' cellspacing='1' cellpadding='2'><tr><td>";
  62. echo "<img src='" . OX::assetPath() . "/images/install-busy.gif' width='16' height='16'>";
  63. echo "</td><td class='install'>".$strSearchingUpdates."</td></tr></table>";
  64. // Send the output to the browser
  65. if (false !== ob_get_contents()) {
  66. ob_flush();
  67. }
  68. flush();
  69. // Get updates info and store them into a session var
  70. $oSync = new OA_Sync();
  71. $res = $oSync->checkForUpdates();
  72. phpAds_SessionDataRegister('maint_update', $res);
  73. phpAds_SessionDataStore();
  74. echo "<script language='JavaScript'>\n";
  75. echo "<!--\n";
  76. echo "document.location.replace('updates-product.php');\n";
  77. echo "//-->\n";
  78. echo "</script>\n";
  79. exit();
  80. } else {
  81. echo "<br />".$strNotAbleToCheck."<br /><br />";
  82. echo "<br /><br />".$strForUpdatesLookOnWebsite."<br /><br />";
  83. echo "<b><img src='" . OX::assetPath() . "/images/caret-r.gif'>&nbsp;<a href='http://".$phpAds_producturl."' target='_blank'>".$strClickToVisitWebsite."</a></b>";
  84. }
  85. } else {
  86. $maint_update = $session['maint_update'];
  87. unset($session['maint_update']);
  88. phpAds_SessionDataStore();
  89. if ($maint_update[0] > 0 && $maint_update[0] != 800) {
  90. $errorMessage = $strErrorOccurred.": {$maint_update[1]} (code: {$maint_update[0]})";
  91. phpAds_Die (htmlentities($errorMessage), $strUpdateServerDown);
  92. }
  93. echo "<br /><br />";
  94. if ($maint_update[0] == 800) {
  95. echo "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='24' valign='top'>";
  96. echo "<img src='" . OX::assetPath() . "/images/info.gif'>&nbsp;&nbsp;";
  97. echo "</td><td valign='top'><b>".$strNoNewVersionAvailable."</b>";
  98. echo "</td></tr></table><br />";
  99. phpAds_ShowBreak();
  100. } elseif ($maint_update[0] == -1) {
  101. echo "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='24' valign='top'>";
  102. echo "<img src='" . OX::assetPath() . "/images/error.gif'>&nbsp;&nbsp;";
  103. echo "</td><td valign='top'><b>".$strServerCommunicationError."</b>";
  104. echo "</td></tr></table><br />";
  105. phpAds_ShowBreak();
  106. } elseif ($maint_update[0] == -2) {
  107. echo "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='24' valign='top'>";
  108. echo "<img src='" . OX::assetPath() . "/images/error.gif'>&nbsp;&nbsp;";
  109. echo "</td><td valign='top'><b>".$strCheckForUpdatesDisabled."</b>";
  110. echo "</td></tr></table><br />";
  111. phpAds_ShowBreak();
  112. } elseif (is_array($maint_update[1])) {
  113. echo "<table border='0' cellspacing='0' cellpadding='0'><tr><td width='24' valign='top'>";
  114. if ($maint_update[1]['security_fix'] == 1) {
  115. echo "<img src='" . OX::assetPath() . "/images/error.gif'>&nbsp;&nbsp;";
  116. echo "</td><td valign='top'>".$strSecurityUpdate;
  117. } else {
  118. echo "<img src='" . OX::assetPath() . "/images/info.gif'>&nbsp;&nbsp;";
  119. echo "</td><td valign='top'>".$strNewVersionAvailable;
  120. }
  121. echo "</td></tr></table>";
  122. echo "<br />";
  123. phpAds_ShowBreak();
  124. echo "<br /><br />";
  125. echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
  126. echo "<tr height='25'><td height='25'>&nbsp;&nbsp;<b>".$strAvailableUpdates."</b></td></tr>";
  127. echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
  128. echo "<tr height='25' bgcolor='#F6F6F6'><td height='25' valign='top' nowrap>";
  129. echo "<br />&nbsp;&nbsp;<img src='" . OX::assetPath() . "/images/icon-setup.gif' align='absmiddle'>&nbsp;";
  130. echo $maint_update[1]['product_name']." ".$maint_update[1]['config_readable']."</td>";
  131. echo "<td width='32'>&nbsp;</td>";
  132. echo "<td><br />".$maint_update[1]['description']."<br /><br />";
  133. echo "</td>";
  134. echo "<td width='32'>&nbsp;</td>";
  135. echo "</tr>";
  136. if ($maint_update[1]['url_zip'] != '' || $maint_update[1]['url_tgz'] != '') {
  137. echo "<tr height='1'><td colspan='2' bgcolor='#F6F6F6'><img src='" . OX::assetPath() . "/images/spacer.gif' height='1' width='100%'>";
  138. echo "<td colspan='2' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break-el.gif' height='1' width='100%'></td></tr>";
  139. echo "<tr height='25' bgcolor='#F6F6F6'><td height='25' colspan='2'>&nbsp;&nbsp;</td><td>";
  140. if ($maint_update[1]['url_zip'] != '') {
  141. echo "<img src='" . OX::assetPath() . "/images/icon-filetype-zip.gif' align='absmiddle'>&nbsp;";
  142. echo "<a href='".$maint_update[1]['url_zip']."'>".$strDownloadZip."</a>";
  143. if ($maint_update[1]['url_tgz'] != '') {
  144. echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  145. }
  146. }
  147. if ($maint_update[1]['url_tgz'] != '') {
  148. echo "<img src='" . OX::assetPath() . "/images/icon-filetype-zip.gif' align='absmiddle'>&nbsp;";
  149. echo "<a href='".$maint_update[1]['url_tgz']."'>".$strDownloadGZip."</a>";
  150. }
  151. echo "</td><td>&nbsp;</td></tr>";
  152. }
  153. echo "<tr height='1'><td colspan='4' bgcolor='#888888'><img src='" . OX::assetPath() . "/images/break.gif' height='1' width='100%'></td></tr>";
  154. echo "</table>";
  155. } else {
  156. phpAds_Die($strErrorOccurred, $strUpdateServerDown);
  157. }
  158. }
  159. /*-------------------------------------------------------*/
  160. /* HTML framework */
  161. /*-------------------------------------------------------*/
  162. phpAds_PageFooter();
  163. ?>