home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / home / admin / www / phpMyBackupPro / definitions.php < prev    next >
Encoding:
PHP Script  |  2005-07-21  |  6.2 KB  |  131 lines

  1. <?php
  2. /*
  3.  +--------------------------------------------------------------------------+
  4.  | phpMyBackupPro                                                           |
  5.  +--------------------------------------------------------------------------+
  6.  | Copyright (c) 2004-2005 by Dirk Randhahn                                 |
  7.  | http://www.phpMyBackupPro.net                                            |
  8.  | version information can be found in definitions.php.                     |
  9.  |                                                                          |
  10.  | This program is free software; you can redistribute it and/or            |
  11.  | modify it under the terms of the GNU General Public License              |
  12.  | as published by the Free Software Foundation; either version 2           |
  13.  | of the License, or (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. */
  25.  
  26. // ---- adjust these two lines to your file system. The pathes must be relative to this file! ----- //
  27.  
  28. define('PMBP_GLOBAL_CONF',"global_conf.php");    // example: define('PMBP_GLOBAL_CONF',"../../files/global_conf.php");
  29. $_PMBP_EXPORT_DIR="export/";                     // example: $_PMBP_EXPORT_DIR="../../files/export/";
  30.  
  31. // ---- adjust this line, only if you are going to backup from several database servers or if you have to use different accounts ---- //
  32.  
  33. define('PMBP_GLOBAL_CONF_SQL',"global_conf_sql.php");    // example: define('PMBP_GLOBAL_CONF',"../../files/global_conf_sql.php");
  34.  
  35. // ---- no need to modify anything more! ---- //
  36.  
  37. // definitions
  38. define('PMBP_VERSION',"v.1.7.1");  // This is the version of this phpMyBackupPro release
  39.  
  40. define('PMBP_MAIN_INC',"./functions.inc.php");
  41. define('PMBP_JAVASCRIPTS',"javascripts.js");
  42. define('PMBP_STYLESHEET_DIR',"stylesheets/");
  43. define('PMBP_LANGUAGE_DIR',"language/");
  44. define('PMBP_IMAGE_DIR',"images/");
  45. define('PMBP_WEBSITE',"http://www.phpMyBackupPro.net");
  46.  
  47. // includes
  48. if (!@include_once(PMBP_GLOBAL_CONF)) {
  49.     echo "global_conf.php is missing.<br>Please read INSTALL.txt and specify the global_conf.php path in definitions.php.";
  50.     exit;
  51. } else {
  52.     if (!isset($CONF['login'])) {
  53.         echo "global_conf.php is incomplete. Please update it with a valid copy of the global_conf.php file.";
  54.         exit;
  55.     }
  56. }
  57.  
  58. // define arrays fro several server mode
  59. $CONF['sql_host_s']=array();
  60. $CONF['sql_user_s']=array();
  61. $CONF['sql_passwd_s']=array();
  62. $CONF['sql_db_s']=array();
  63. require_once(PMBP_MAIN_INC);
  64. @include_once(PMBP_GLOBAL_CONF_SQL);    
  65.  
  66. // set working sql server
  67. if (count($CONF['sql_host_s'])) {
  68.     // set working server and register session vars
  69.     if (!isset($_SESSION['sql_host_org'])) $_SESSION['sql_host_org']=$CONF['sql_host'];
  70.     if (!isset($_SESSION['sql_user_org'])) $_SESSION['sql_user_org']=$CONF['sql_user'];
  71.     if (!isset($_SESSION['sql_passwd_org'])) $_SESSION['sql_passwd_org']=$CONF['sql_passwd'];
  72.     if (!isset($_SESSION['sql_db_org'])) $_SESSION['sql_db_org']=$CONF['sql_db'];    
  73.     if (!isset($_SESSION['wss'])) $_SESSION['wss']=-1;
  74.  
  75.     if(isset($_POST['mysql_host'])) $_SESSION['wss']=$_POST['mysql_host'];
  76.  
  77.     // load setting from $_SESSION['wss'] as long we are not on the config page and if the host data are still in global_conf_sql.php
  78.     // otherwise set to original host
  79.     if ($_SESSION['wss']<0 || basename($_SERVER['SCRIPT_NAME'])=="config.php" || !isset($CONF['sql_host_s'][$_SESSION['wss']]) ) {
  80.         $CONF['sql_host']=$_SESSION['sql_host_org'];
  81.         $CONF['sql_user']=$_SESSION['sql_user_org'];
  82.         $CONF['sql_passwd']=$_SESSION['sql_passwd_org'];
  83.         $CONF['sql_db']=$_SESSION['sql_db_org'];
  84.     } else {
  85.         $CONF['sql_host']=$CONF['sql_host_s'][$_SESSION['wss']];
  86.         $CONF['sql_user']=$CONF['sql_user_s'][$_SESSION['wss']];
  87.         $CONF['sql_passwd']=$CONF['sql_passwd_s'][$_SESSION['wss']];
  88.         $CONF['sql_db']=$CONF['sql_db_s'][$_SESSION['wss']];        
  89.     }
  90. }
  91.  
  92. // try to create export sub directories
  93. if (count($CONF['sql_host_s']) && basename($_SERVER['SCRIPT_NAME'])!=="config.php") {
  94.     // multi db mode
  95.     if ($_SESSION['wss']<0) {
  96.         // main account from global_conf.php
  97.         define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR);    
  98.     } else {
  99.         // other accounts        
  100.         define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR.$CONF['sql_host']."_".$CONF['sql_user']."/");            
  101.     }
  102. } else {
  103.     // single db mode
  104.     define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR);
  105. }
  106. @umask(0000);
  107. @mkdir(PMBP_EXPORT_DIR,0777);                
  108.  
  109. // check if language was just changed in config.php
  110. if (isset($_POST['lang']) && ereg_replace(".*/","",$_SERVER['PHP_SELF'])=="config.php") $CONF['lang']=$_POST['lang'];
  111.  
  112. // include language.inc.php
  113. if (!isset($CONF['lang'])) $CONF['lang']="english";
  114. if (!file_exists("./".PMBP_LANGUAGE_DIR.$CONF['lang'].".inc.php")) include_once("./".PMBP_LANGUAGE_DIR."english.inc.php"); else include("./".PMBP_LANGUAGE_DIR.$CONF['lang'].".inc.php");
  115.  
  116. // set local time to defined or environment variable value
  117. if (function_exists("phpversion")) {
  118.     $tmp=@phpversion();
  119.     $phpvers=$tmp[0].$tmp[1].$tmp[2];
  120. } else {
  121.     $phpvers="0";
  122. }
  123. if (defined("BD_LANG_SHORTCUT") AND $phpvers>=4.3) setlocale(LC_TIME,BD_LANG_SHORTCUT,BD_LANG_SHORTCUT."_".strtoupper('BD_LANG_SHORTCUT')); else setlocale(LC_TIME,"");
  124.  
  125. // special part for arabic language
  126. if ($CONF['lang']=="arabic") define('ARABIC_HTML'," dir=\"rtl\""); else define('ARABIC_HTML',"");
  127.  
  128. // update the system variables
  129. include("sys_vars.inc.php");
  130. ?>
  131.