Source for file admin.mostlydbadmin.html.php

Documentation is available at admin.mostlydbadmin.html.php

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

Documentation generated on Mon, 05 May 2008 16:15:50 +0400 by phpDocumentor 1.4.0