[ PHPXref.com ] [ Generated: Sun Jul 20 19:47:24 2008 ] [ phpMyBackupPro 1.8 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/phpMyBackupPro/ -> definitions.php (source)

   1  <?php
   2  /*
   3   +--------------------------------------------------------------------------+
   4   | phpMyBackupPro                                                           |
   5   +--------------------------------------------------------------------------+
   6   | Copyright (c) 2004-2006 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.8");  // 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  if (!function_exists("mysql_connect")) {
  59      echo "The MySQL module for PHP seems not to be installed correctly.<br>
  60      You can configure the MySQL module in php.ini. Read the HTTP servers (eg. Apache) log files for more infomation.";
  61      exit;    
  62  }
  63  
  64  // define arrays fro several server mode
  65  $CONF['sql_host_s']=array();
  66  $CONF['sql_user_s']=array();
  67  $CONF['sql_passwd_s']=array();
  68  $CONF['sql_db_s']=array();
  69  require_once(PMBP_MAIN_INC);
  70  @include_once(PMBP_GLOBAL_CONF_SQL);    
  71  
  72  // set working sql server
  73  if (count($CONF['sql_host_s'])) {
  74      // set working server and register session vars
  75      if (!isset($_SESSION['sql_host_org'])) $_SESSION['sql_host_org']=$CONF['sql_host'];
  76      if (!isset($_SESSION['sql_user_org'])) $_SESSION['sql_user_org']=$CONF['sql_user'];
  77      if (!isset($_SESSION['sql_passwd_org'])) $_SESSION['sql_passwd_org']=$CONF['sql_passwd'];
  78      if (!isset($_SESSION['sql_db_org'])) $_SESSION['sql_db_org']=$CONF['sql_db'];    
  79      if (!isset($_SESSION['wss'])) $_SESSION['wss']=-1;
  80  
  81      if(isset($_POST['mysql_host'])) $_SESSION['wss']=$_POST['mysql_host'];
  82  
  83      // 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
  84      // otherwise set to original host
  85      if ($_SESSION['wss']<0 || basename($_SERVER['SCRIPT_NAME'])=="config.php" || !isset($CONF['sql_host_s'][$_SESSION['wss']]) ) {
  86          $CONF['sql_host']=$_SESSION['sql_host_org'];
  87          $CONF['sql_user']=$_SESSION['sql_user_org'];
  88          $CONF['sql_passwd']=$_SESSION['sql_passwd_org'];
  89          $CONF['sql_db']=$_SESSION['sql_db_org'];
  90      } else {
  91          $CONF['sql_host']=$CONF['sql_host_s'][$_SESSION['wss']];
  92          $CONF['sql_user']=$CONF['sql_user_s'][$_SESSION['wss']];
  93          $CONF['sql_passwd']=$CONF['sql_passwd_s'][$_SESSION['wss']];
  94          $CONF['sql_db']=$CONF['sql_db_s'][$_SESSION['wss']];        
  95      }
  96  }
  97  
  98  // try to create export sub directories
  99  if (count($CONF['sql_host_s']) && basename($_SERVER['SCRIPT_NAME'])!=="config.php") {
 100      // multi db mode
 101      if ($_SESSION['wss']<0) {
 102          // main account from global_conf.php
 103          define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR);    
 104      } else {
 105          // other accounts        
 106          define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR.$CONF['sql_host']."_".$CONF['sql_user']."/");            
 107      }
 108  } else {
 109      // single db mode
 110      define('PMBP_EXPORT_DIR',$_PMBP_EXPORT_DIR);
 111  }
 112  @umask(0000);
 113  @mkdir(PMBP_EXPORT_DIR,0777);                
 114  
 115  // check if language was just changed in config.php
 116  if (isset($_POST['lang']) && ereg_replace(".*/","",$_SERVER['PHP_SELF'])=="config.php") $CONF['lang']=$_POST['lang'];
 117  
 118  // include language.inc.php
 119  if (!isset($CONF['lang'])) $CONF['lang']="english";
 120  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");
 121  
 122  // set local time to defined or environment variable value
 123  if (function_exists("phpversion")) {
 124      $tmp=@phpversion();
 125      $phpvers=$tmp[0].$tmp[1].$tmp[2];
 126  } else {
 127      $phpvers="0";
 128  }
 129  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,"");
 130  
 131  // special part for arabic language
 132  if ($CONF['lang']=="arabic") define('ARABIC_HTML'," dir=\"rtl\""); else define('ARABIC_HTML',"");
 133  
 134  // update the system variables
 135  include ("sys_vars.inc.php");
 136  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]