[ Index ]

PHP Cross Reference of Mambo 4.6.5

[ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/administrator/components/com_mostlydbadmin/ -> admin.mostlydbadmin.html.php (source)

   1  <?php
   2  /**
   3  * @package Mambo
   4  * @author Mambo Foundation Inc see README.php
   5  * @copyright (C) 2000 - 2009 Mambo Foundation Inc.
   6  * See COPYRIGHT.php for copyright notices and details.
   7  * @license GNU/GPL Version 2, see LICENSE.php
   8  *
   9  * Redistributions of files must retain the above copyright notice.
  10  *
  11  * Mambo is free software; you can redistribute it and/or
  12  * modify it under the terms of the GNU General Public License
  13  * as published by the Free Software Foundation; version 2 of the License.
  14  */
  15  
  16  /** ensure this file is being included by a parent file */
  17  defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
  18  
  19  /**
  20  * @package Mambo_4.6
  21  */
  22  class HTML_dbadmin
  23  {
  24  	function backupIntro( $tablelist, $p_option )
  25      {
  26      ?>
  27          <table cellpadding="4" cellspacing="0"  width="100%">
  28          <tr>
  29              <td width="100%" class="sectionname"><img src="images/backup.png" class="imgcenter"><?php echo T_('Database Backup'); ?></td>
  30          </tr>
  31          </table>
  32          <form action="index2.php?option=com_mostlydbadmin&task=doBackup" method="post">
  33          <table  align="center" cellspacing="0" cellpadding="2" width="100%" class="adminform">
  34          </tr>
  35          <tr>
  36              <td><?php echo T_('Where would you like to back up your Database Tables to?'); ?><br /> <br />
  37                  <input type="radio" name="OutDest" value="screen" />
  38                      <?php echo T_('Display Results on the Screen'); ?><br /> 
  39                  <input type="radio" name="OutDest" value="remote"/>
  40                      <?php echo T_('Download to a file on my local computer'); ?><br /> 
  41                  <input type="radio" name="OutDest" value="local" / checked="checked" >
  42                      <?php echo T_('Store the file in the backup directory on the server'); ?>
  43              </td>
  44              <td>&nbsp;</td>
  45              <td><?php echo T_('What format would you like to save them as?'); ?><br /> <br />
  46              <?php if (function_exists('gzcompress'))
  47              {
  48              ?>
  49              <input type="radio" name="OutType" value="zip" /><?php echo T_('As a Zip file'); ?><br />
  50              <?php
  51              }
  52              if (function_exists('bzcompress'))
  53              {
  54              ?>
  55              <input type="radio" name="OutType" value="bzip" /><?php echo T_('As a BZip file'); ?><br />
  56              <?php
  57              }
  58              if (function_exists('gzencode'))
  59              {
  60              ?>
  61              <input type="radio" name="OutType" value="gzip" /><?php echo T_('As a GZip file'); ?><br />
  62              <?php
  63              }
  64              ?>
  65              <input type="radio" name="OutType" value="sql" checked="checked" /><?php echo T_('As a SQL (plain text) file'); ?>
  66              <br />
  67              <input type="radio" name="OutType" value="html" /><?php echo T_('As formatted HTML'); ?></td>
  68          </tr>
  69          <tr>
  70          <td> <p><?php echo T_('What do you want to back up?'); ?><br /><br />
  71              <input type="radio" name="toBackUp" value="data" /><?php echo T_('Data Only'); ?><br />
  72              <input type="radio" name="toBackUp" value="structure" /><?php echo T_('Structure Only'); ?><br />
  73              <input type="radio" name="toBackUp" value="both" checked="checked" /><?php echo T_('Data and Structure'); ?></p>
  74          </td>
  75          <td>&nbsp;</td>
  76          <td> <p align="left"><?php echo T_('Which Database Tables would you like to back up?<br />
  77            Please note, it is highly recommended you select ALL your tables.'); ?></p>
  78            <?php echo $tablelist; ?>
  79          </td>
  80          </tr>
  81          <tr>
  82              <td>&nbsp;</td>
  83              <td>&nbsp;</td>
  84              <td align="center">&nbsp;<br /> <input type="submit" value="<?php echo T_('Backup the Selected Tables'); ?>" class="button" /></td>
  85          </tr>
  86      </table>
  87      </form>
  88      <?php
  89      }
  90      
  91  	function restoreIntro($enctype,$uploads_okay,$local_backup_path)
  92      {
  93      ?>
  94          <table cellpadding="4" cellspacing="0"  width="100%">
  95          <tr>
  96              <td width="100%" class="sectionname"><img src="images/dbrestore.png" class="imgcenter">Database Restore</td>
  97          </tr>
  98          </table>
  99          <table  align="center" cellspacing="0" cellpadding="2" width="100%" class="adminform">
 100          <form action="index2.php?option=com_mostlydbadmin&task=doRestore" method="post" <?php echo $enctype;?>>
 101          <tr>
 102              <th class="title" colspan="3"><?php echo T_('Existing Backups'); ?></th>
 103          </tr>
 104          <?php
 105      if (isset($local_backup_path))
 106      {
 107          if ($handle = @opendir($local_backup_path))
 108          {
 109          ?>
 110          <tr><td>&nbsp;</td><td><strong><?php echo T_('Backup File Name'); ?></strong></td><td><strong><?php echo T_('Created Date/Time'); ?></strong></td></tr>
 111          <?php
 112          while ($file = @readdir($handle))
 113          {
 114              if (is_file($local_backup_path . "/" . $file))
 115              {
 116                  if (eregi(".\.sql$",$file) || eregi(".\.bz2$",$file) || eregi(".\.gz$",$file) || eregi(".\.zip$",$file))
 117                  {
 118                      echo "\t\t<tr><td align=\"center\"><input type=\"radio\" name=\"file\" value=\"$file\"></td><td>$file</td><td>" . date("m/d/y H:i:sa", filemtime($local_backup_path . "/" . $file)) . "</td></tr>\n";
 119                  }
 120              }
 121          }
 122          }
 123          else
 124          {
 125              echo "\t\t<tr><td colspan=\"3\" class=\"error\">". T_('Error!<br />Invalid or non-existant backup path in your configuration file :')." <br />" . $local_backup_path . "/" . $file . "</td></tr>\n";
 126          }
 127          @closedir($handle);
 128      }
 129      else
 130      {
 131          echo "\t\t<tr><td colspan=\"3\" class=\"error\">". T_('Error!<br />Backup path in your configuration file has not been configured.')."</td></tr>\n";
 132      }
 133      if ($uploads_okay)
 134      {
 135          ?>
 136          <tr>
 137              <td colspan="3"><br /><?php echo T_('Or alternatively, if you\'ve downloaded a backup to your computer, you can restore from a local file :'); ?></td>
 138          </tr>
 139          <tr>
 140              <td>&nbsp;</td>
 141              <td><br /><input type="file" name="upfile" class="button"></td>
 142              <td>&nbsp;</td>
 143          </tr>
 144          <?php
 145      }
 146          ?>
 147          <tr>
 148              <td>&nbsp;</td>
 149              <td>&nbsp;<br />
 150              <input type="submit" class="button" value="<?php echo T_('Perform the Restore'); ?>" />&nbsp;&nbsp; <input type="reset" class="button" value="<?php echo T_('Reset'); ?>" /></td>
 151              <td>&nbsp;</td>
 152          </tr>
 153          </form>
 154      </table>
 155      <?php
 156      }
 157  	function showDbAdminMessage($message,$title,$option,$task)
 158      {
 159          global $PHP_SELF;
 160          ?>
 161              <table  cellpadding="4" cellspacing="0" width="100%" class="adminlist">
 162          <tr>
 163              <th width="55%" class="title"><?php echo $title; ?></th>
 164          </tr>
 165          <tr>
 166              <td align="left"><strong><?php echo $message; ?></strong></td>
 167          </tr>
 168          </table>
 169          <?php
 170      }
 171  
 172  	function xquery( $sql='', $msg='', $rows=null, $option ) {
 173  ?>
 174  <form action="index2.php" method="post" name="adminForm">
 175    <table cellpadding="4" cellspacing="0"  width="100%">
 176      <tr>
 177        <td width="100%" class="sectionname"><img src="images/query.png" class="imgcenter"><?php echo T_('Execute Query'); ?></td> 
 178        <td nowrap="nowrap">&nbsp;</td>
 179      </tr>
 180    </table>
 181   <table cellpadding="4" cellspacing="1"  width="100%" class="adminform">
 182      <tr>
 183          <td>SQL:</td>
 184      </tr>
 185      <tr>
 186          <td><textarea name="sql" rows="10" cols="80" class="inputbox"><?php echo $sql;?></textarea></td>
 187      </tr>
 188      <tr>
 189          <td>
 190              <input type="submit" value="<?php echo T_('Execute Query'); ?>" class="button" />
 191              <input type="button" value="<?php echo T_('Clear Query'); ?>" class="button" onclick="document.adminForm.sql.value=''" />
 192              <input type="checkbox" name="batch" value="1" /> <?php echo T_('Batch Mode'); ?>
 193          </td>
 194      </tr>
 195  <?php    if ($msg) { ?>
 196      <tr>
 197          <td><?php echo $msg;?></td>
 198      </tr>
 199  <?php    } ?>
 200  <?php    
 201          if (is_array( $rows ) && count( $rows ) > 0) {
 202              $n = count( $rows );
 203  ?>
 204      <tr>
 205          <td>
 206              <table cellspacing="0" cellpadding="2" border="1">
 207                  <tr>
 208                      <th>#</th>
 209  <?php        foreach($rows[0] as $key => $value) { ?>
 210                      <th><?php echo $key;?></th>
 211  <?php         } ?>
 212                  <tr>
 213  <?php        for ($i=0; $i < $n; $i++) {
 214                  echo "\n    <tr>";
 215                  echo "\n        <td>$i</td>";
 216                  foreach($rows[$i] as $key => $value) {
 217                      echo "\n        <td>$value</td>";
 218                  }
 219                  echo "\n    </tr>";
 220              }
 221  ?>
 222              </table>
 223          </td>
 224      </tr>
 225  <?php    } ?>
 226   </table>
 227  <input type="hidden" name="option" value="<?php echo $option; ?>" />
 228  <input type="hidden" name="task" value="xquery" />
 229  </form>
 230  <?php
 231      }
 232  }
 233  ?>