Syntax Desktop PHP Cross Reference Web Portal Systems

Source: /admin/modules/phpMyBackupPro/config.php - 411 lines - 21228 bytes - Summary - Text - Print

   1  <?php
   2  /*
   3   +--------------------------------------------------------------------------+
   4   | phpMyBackupPro                                                           |
   5   +--------------------------------------------------------------------------+
   6   | Copyright (c) 2004-2007 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  
  27  require_once ("../../config/cfg.php");
  28  require_once ("login.php");
  29  $CONF['sql_passwd']=$synDbPassword;
  30  $CONF['sql_host']=$synDbHost;
  31  $CONF['sql_user']=$synDbUser;
  32  $CONF['sql_db']=$synDbName;
  33  $CONF['del_time']='';
  34  
  35  // items which are checkboxes and the config page basic(1) or ext(2)
  36  $checkbox=array("ftp_use"=>1,"ftp_pasv"=>1,"email_use"=>1,"import_error"=>2,"no_login"=>2,"ftp_del"=>1,"dir_backup"=>2,"dir_rec"=>2,"login"=>2);
  37  
  38  // check if all configuration settings are available
  39  // login, stylesheet and lang are checked before
  40  if (!isset($CONF['sitename'])) $CONF['sitename']='';
  41  if (!isset($CONF['ftp_use'])) $CONF['ftp_use']='';
  42  if (!isset($CONF['ftp_server'])) $CONF['ftp_server']='';
  43  if (!isset($CONF['ftp_user'])) $CONF['ftp_user']='';
  44  //if (!isset($CONF['sql_passwd'])) $CONF['sql_passwd']='';
  45  //if (!isset($CONF['sql_host'])) $CONF['sql_host']='localhost';
  46  //if (!isset($CONF['sql_user'])) $CONF['sql_user']='root';
  47  //if (!isset($CONF['sql_db'])) $CONF['sql_db']='syntax';
  48  /if (!isset($CONF['ftp_passwd'])) $CONF['ftp_passwd']='';
  49  if (!isset($CONF['ftp_path'])) $CONF['ftp_path']='';
  50  if (!isset($CONF['ftp_pasv'])) $CONF['ftp_pasv']='';
  51  if (!isset($CONF['ftp_port'])) $CONF['ftp_port']='';
  52  if (!isset($CONF['ftp_del'])) $CONF['ftp_del']='';
  53  if (!isset($CONF['email_use'])) $CONF['email_use']='';
  54  if (!isset($CONF['email'])) $CONF['email']='';
  55  if (!isset($CONF['date'])) $CONF['date']='';
  56  //if (!isset($CONF['del_time'])) $CONF['del_time']='';
  57  if (!isset($CONF['del_number'])) $CONF['del_number']='';
  58  if (!isset($CONF['timelimit'])) $CONF['timelimit']='';
  59  if (!isset($CONF['confirm'])) $CONF['confirm']='';
  60  if (!isset($CONF['import_error'])) $CONF['import_error']='';
  61  if (!isset($CONF['no_login'])) $CONF['no_loginxxxx']='';
  62  if (!isset($CONF['dir_backup'])) $CONF['dir_backup']='';
  63  if (!isset($CONF['dir_rec'])) $CONF['dir_rec']='';
  64      
  65  // if save button was clicked
  66  if (isset($_POST['submit'])) {
  67  
  68      // configurations
  69      if (isset($_POST['sql_host']) || isset($_POST['del_time'])) {
  70      
  71          // first set all check boxes of the selected configuration tab to "0"
  72          foreach ($checkbox as $item=>$page) {
  73              // checkboxes on extended configurations
  74              if ($page=="2" && isset($_GET['ext'])) $CONF[$item]="0";
  75                  // checkboxes on basic configurations
  76                  elseif($page=="1" && !isset($_GET['ext'])) $CONF[$item]="0";
  77          }
  78          
  79          // update $CONF
  80          foreach($CONF as $item=>$value) {
  81              // don't save settings for several servers in conf.php
  82              if ($item=="sql_host_s" || $item=="sql_user_s" || $item=="sql_passwd_s" || $item=="sql_db_s") continue;
  83              
  84              // don't save data of settings the user isn't allowed to change
  85              if ($_SESSION['multi_user_mode']) {
  86                  if ($item=="sitename" && $PMBP_MU_CONF['sitename']) continue;
  87                  if (($item=="email_use"|$item=="email") && !$PMBP_MU_CONF['allow_email']) continue;
  88                  
  89                  if (!$PMBP_MU_CONF['allow_ftp'] && !$PMBP_MU_CONF['allow_dir_backup']) {
  90                      if ($item=="ftp_server") continue;
  91                      if ($item=="ftp_user") continue;
  92                      if ($item=="ftp_passwd") continue;
  93                      if ($item=="ftp_path") continue;
  94                      if ($item=="ftp_pasv") continue;
  95                      if ($item=="ftp_port") continue;
  96                      if ($item=="ftp_use") continue;
  97                      if ($item=="dir_backup") continue;
  98                      if ($item=="dir_rec") continue;
  99                  }
 100                  if ($PMBP_MU_CONF['allow_dir_backup']) {
 101                      if ($item=="dir_backup") continue;
 102                      if ($item=="dir_rec") continue;
 103                  }
 104                  if ($PMBP_MU_CONF['allow_ftp']) {
 105                      if ($item=="ftp_use") continue;
 106                  }                
 107              }
 108              
 109              // check if the value was posted
 110              if (isset($_POST[$item])) {
 111                  if (isset($checkbox[$item])) {
 112                      $CONF[$item]=1;
 113                  } else {
 114                      $CONF[$item]=$_POST[$item];
 115                  }
 116              }
 117          }       
 118             
 119      // system variables
 120      } else {
 121          foreach($_POST as $key=>$value) {
 122              if ($key!="submit") $PMBP_SYS_VAR[$key]=$value;
 123          }
 124      }
 125      
 126      // save $CONF to global_conf.php
 127      if (PMBP_save_global_conf()) {
 128          $out="<div class=\"green\">".C_SAVED."!</div>\n";
 129      } else {
 130          $out="<div class=\"red\">".PMBP_GLOBAL_CONF." ".C_WRITEABLE."!</div>\n";
 131      }
 132  }
 133  
 134  
 135  PMBP_print_header(ereg_replace(".*/","",$_SERVER['SCRIPT_NAME']));
 136  if (isset($out)) echo $out;
 137  
 138  // validation type of some variables
 139  $validate=array('timelimit'=>"int",'del_time'=>"float",'email'=>"email",'ftp_port'=>"int");
 140  $conf=array(C_TIMELIMIT=>"timelimit",C_FTP_PORT=>"ftp_port",C_DEL_TIME=>"del_time",C_EMAIL=>"email");
 141  
 142  // validate
 143  foreach($CONF as $key=>$value) {
 144      if (array_key_exists($key,$validate)) {
 145          switch($validate[$key]) {
 146              case "int": if (!eregi("^[0-9]*$",$value)) echo "<div class=\"red\">'".array_search($key,$conf)."' ".C_WRONG_TYPE."</div>\n";
 147                  break;
 148              case "float": if (!eregi("^[0-9]*\.?[0-9]*$",$value)) echo "<div class=\"red\">'".array_search($key,$conf)."' ".C_WRONG_TYPE."</div>\n";
 149                  break;
 150              case "email": if ($value||$CONF['email_use']) {
 151                      foreach(explode(",",$value) as $value2) {
 152                          if (!eregi("^\ *[a-zA-Z0-9_-]+(\.[a-zA-Z0-9\._-]+)*@([a-zA-Z0-9-]+\.)+([a-z]{2,4})$",$value2)) {
 153                              echo "<div class=\"red\">'".array_search($key,$conf)."' ".C_WRONG_TYPE."</div>\n";
 154                              break;
 155                          }
 156                      }
 157                  }
 158                  break;
 159          }
 160      }
 161  }
 162  
 163  // if no db connection possible
 164  if (isset($_SESSION['sql_host_org'])) {
 165      if (!@mysql_connect($_SESSION['sql_host_org'],$_SESSION['sql_user_org'],$_SESSION['sql_passwd_org'])) echo "<div class=\"red\">".C_WRONG_SQL."</div>";     
 166      if ($_SESSION['sql_db_org']) if (!@mysql_select_db($_SESSION['sql_db_org'])) echo "<div class=\"red\">".C_WRONG_DB."</div>";    
 167  } else {
 168      if (!@mysql_connect($CONF['sql_host'],$CONF['sql_user'],$CONF['sql_passwd'])) echo "<div class=\"red\">".C_WRONG_SQL."</div>";
 169      if ($CONF['sql_db']) if (!@mysql_select_db($CONF['sql_db'])) echo "<div class=\"red\">".C_WRONG_DB."</div>";
 170  }
 171  
 172  // only if 'good internet connection' and if no ftp connection possible
 173  if ($CONF['ftp_use'] || $CONF['dir_backup']) {
 174      
 175      if (!$CONF['ftp_server']) {
 176          echo "<div class=\"red\">".C_WRONG_FTP."</div>";
 177      // check only if internet connection seems to be good
 178      } elseif(!$_SESSION['PMBP_VERSION']) {
 179          if (!$conn_id=@ftp_connect($CONF['ftp_server'],$CONF['ftp_port'],$PMBP_SYS_VAR['ftp_timeout']))
 180              echo "<div class=\"red\">".C_WRONG_FTP."</div>";
 181      }
 182  }
 183  
 184  // print configuration selection
 185  if (!$_SESSION['multi_user_mode']) {
 186      if (isset($_GET['ext'])) echo "<div class=\"bold\"><a href=\"config.php\">".C_BASIC_VAL."</a> | ".C_EXT_VAL." | <a href=\"config.php?sys=TRUE\">".PMBP_C_SYSTEM_VAL."</a></div>";
 187          elseif(isset($_GET['sys'])) echo "<div class=\"bold\"><a href=\"config.php\">".C_BASIC_VAL."</a> | <a href=\"config.php?ext=TRUE\">".C_EXT_VAL."</a> | ".PMBP_C_SYSTEM_VAL."</div>\n";
 188              else echo "<div class=\"bold\">".C_BASIC_VAL." | <a href=\"config.php?ext=TRUE\">".C_EXT_VAL."</a> | <a href=\"config.php?sys=TRUE\">".PMBP_C_SYSTEM_VAL."</a></div>\n";
 189  }
 190  
 191  // print html code
 192  if (isset($_GET['ext'])) echo "<br><form action=\"config.php?ext=TRUE\" method=\"post\">\n";
 193      elseif(isset($_GET['sys'])) echo "<br><form action=\"config.php?sys=TRUE\" method=\"post\">\n";
 194          else echo "<br><form action=\"config.php\" method=\"post\">\n";
 195  echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"1\" width=\"100%\">\n";
 196  
 197  if ($_SESSION['multi_user_mode']) {
 198      // configurations in mu user mode
 199      echo "<tr>";
 200      echo "<td colspan=\"8\">&nbsp;</td></tr><tr>";
 201      echo "<td>".C_LANG."*:</td><td>".PMBP_config_print("lang")."</td>\n";
 202      echo "<td>".C_DATE."*:</td><td>".PMBP_config_print("date")."</td>\n";      
 203      echo "<td>".C_STYLESHEET."*:</td><td>".PMBP_config_print("stylesheet")."</td>\n";      
 204      if (!$PMBP_MU_CONF['sitename']) {
 205          echo "<td>".C_SITENAME."*:</td><td>".PMBP_config_print("sitename")."</td>\n";
 206      } else {
 207          echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 208      }    
 209      echo "</tr><tr>";  
 210      if ($PMBP_MU_CONF['allow_email']) {
 211          echo "<td><br><div class=\"bold_left\">".C_TITLE_DELETE."</div></td><td colspan=\"3\"><br><hr></td>\n";    
 212          echo "<td><br><div class=\"bold_left\">".C_TITLE_EMAIL."</div></td><td colspan=\"3\"><br><hr></td>\n";        
 213      } else {
 214          echo "<td><br><div class=\"bold_left\">".C_TITLE_DELETE."</div></td><td colspan=\"7\"><br><hr></td>\n";
 215      }
 216      echo "</tr><tr>";
 217      echo "<td>".C_DEL_TIME.":</td><td>".PMBP_config_print("del_time")."</td>\n";
 218      echo "<td>".C_DEL_NUMBER.":</td><td>".PMBP_config_print("del_number")."</td>\n";
 219      if ($PMBP_MU_CONF['allow_email']) {    
 220          echo "<td>".C_EMAIL_USE.":</td><td>".PMBP_config_print("email_use")."</td>\n";
 221          echo "<td>".C_EMAIL.":</td><td>".PMBP_config_print("email")."</td>\n";
 222      } else {
 223          echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 224          echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 225      }
 226      echo "</tr><tr>";
 227      if ($PMBP_MU_CONF['allow_ftp'] || $PMBP_MU_CONF['allow_dir_backup']) {
 228          echo "<td><br><div class=\"bold_left\">".C_TITLE_FTP."</div></td><td colspan=\"7\"><br><hr></td>\n";
 229          echo "</tr><tr>";
 230          if ($PMBP_MU_CONF['allow_ftp']) {
 231              echo "<td>".C_FTP_USE.":</td><td>".PMBP_config_print("ftp_use")."</td>\n";
 232          } else {
 233              echo "<td>&nbsp;</td><td>&nbsp;</td>\n";    
 234          }
 235          echo "<td>".C_FTP_SERVER.":</td><td>".PMBP_config_print("ftp_server")."</td>\n";
 236          echo "<td>".C_FTP_USER.":</td><td>".PMBP_config_print("ftp_user")."</td>\n";
 237          echo "<td>".C_FTP_PASSWD.":</td><td>".PMBP_config_print("ftp_passwd")."</td>\n";
 238          echo "</tr><tr>";
 239          echo "<td>".C_FTP_PATH.":</td><td>".PMBP_config_print("ftp_path")."</td>\n";
 240          echo "<td>".C_FTP_PASV.":</td><td>".PMBP_config_print("ftp_pasv")."</td>\n";
 241          echo "<td>".C_FTP_PORT.":</td><td>".PMBP_config_print("ftp_port")."</td>\n";
 242          echo "<td>".C_FTP_DEL.":</td><td>".PMBP_config_print("ftp_del")."</td>\n";
 243          echo "</tr><tr>";
 244      }
 245      echo "<td><br><div class=\"bold_left\">".C_TITLE_CONFIG."</div></td><td colspan=\"7\"><br><hr></td>\n";
 246      echo "</tr><tr>";
 247      echo "<td>".C_TIMELIMIT." (".F_SECONDS.")*:</td><td>".PMBP_config_print("timelimit")."</td>\n";
 248      echo "<td>".C_CONFIRM."*:</td><td>".PMBP_config_print("confirm")."</td>\n";
 249      if ($PMBP_MU_CONF['allow_dir_backup']) {    
 250      echo "<td>".C_DIR_BACKUP.":</td><td>".PMBP_config_print("dir_backup")."</td>\n";
 251      echo "<td>".C_DIR_REC.":</td><td>".PMBP_config_print("dir_rec")."</td>\n";
 252      } else {
 253          echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 254          echo "<td>&nbsp;</td><td>&nbsp;</td>\n";    
 255      }
 256      echo "</tr>";
 257  } elseif (isset($_GET['ext'])) {
 258      echo "<tr>";
 259      echo "<td><br><div class=\"bold_left\">".C_TITLE_STYLE."</div></td><td colspan=\"7\"><br><hr></td>\n";
 260      echo "</tr><tr>";
 261      echo "<td>".C_STYLESHEET."*:</td><td>".PMBP_config_print("stylesheet")."</td>\n";
 262      echo "<td>".C_DATE."*:</td><td>".PMBP_config_print("date")."</td>\n";
 263      echo "<td>".C_LOGIN."*:</td><td>".PMBP_config_print("login")."</td>\n";
 264      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 265      echo "</tr><tr>";
 266      echo "<td><br><div class=\"bold_left\">".C_TITLE_DELETE."</div></td><td colspan=\"7\"><br><hr></td>\n";
 267      echo "</tr><tr>";
 268      echo "<td>".C_DEL_TIME.":</td><td>".PMBP_config_print("del_time")."</td>\n";
 269      echo "<td>".C_DEL_NUMBER.":</td><td>".PMBP_config_print("del_number")."</td>\n";
 270      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 271      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 272      echo "</tr><tr>";
 273      echo "<td><br><div class=\"bold_left\">".C_TITLE_CONFIG."</div></td><td colspan=\"7\"><br><hr></td>\n";
 274      echo "</tr><tr>";
 275      echo "<td>".C_TIMELIMIT." (".F_SECONDS.")*:</td><td>".PMBP_config_print("timelimit")."</td>\n";
 276      echo "<td>".C_CONFIRM."*:</td><td>".PMBP_config_print("confirm")."</td>\n";
 277      echo "<td>".C_IMPORT_ERROR.":</td><td>".PMBP_config_print("import_error")."</td>\n";
 278      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 279      echo "</tr><tr>";
 280      echo "<td>".C_DIR_BACKUP.":</td><td>".PMBP_config_print("dir_backup")."</td>\n";
 281      echo "<td>".C_DIR_REC.":</td><td>".PMBP_config_print("dir_rec")."</td>\n";
 282      echo "<td>[".C_NO_LOGIN.":</td><td>".PMBP_config_print("no_login")."]</td>\n";
 283      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 284      echo "</tr>";
 285  } elseif(isset($_GET['sys'])) {
 286      echo "<div class=\"red\">".PMBP_C_SYS_WARNING."</div><br>";
 287      $i=0;
 288      foreach($PMBP_SYS_VAR as $key=>$value) {            
 289          if ($i%2==0) echo "<tr>\n";
 290          echo "<td colspan=\"2\">".$key.":</td><td colspan=\"2\"><input type=\"text\" size=\"20\" name=\"".$key."\" value=\"".$value."\"></td>\n";
 291          if ($i%2==1) echo "</tr>";
 292          $i++;
 293      }
 294      if ($i%2) echo "</tr>\n";
 295  } else {
 296      echo "<tr>";
 297      echo "<td colspan=\"8\">&nbsp;</td></tr>";
 298      echo "<tr><td>".C_SITENAME."*:</td><td>".PMBP_config_print("sitename")."</td>\n";
 299      echo "<td>".C_LANG."*:</td><td>".PMBP_config_print("lang")."</td>\n";
 300      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 301      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 302      echo "</tr><tr>";
 303      echo "<td><br><div class=\"bold_left\">".C_TITLE_SQL."</div></td><td colspan=\"7\"><br><hr></td>\n";
 304      echo "</tr><tr>";
 305      echo "<td>".C_SQL_HOST."*:</td><td>".PMBP_config_print("sql_host")."</td>\n";
 306      echo "<td>".C_SQL_USER."*:</td><td>".PMBP_config_print("sql_user")."</td>\n";
 307      echo "<td>".C_SQL_PASSWD."*:</td><td>".PMBP_config_print("sql_passwd")."</td>\n";
 308      echo "<td>".C_SQL_DB.":</td><td>".PMBP_config_print("sql_db")."</td>\n";
 309      echo "</tr><tr>";
 310      echo "<td><br><div class=\"bold_left\">".C_TITLE_FTP."</div></td><td colspan=\"7\"><br><hr></td>\n";
 311      echo "</tr><tr>";
 312      echo "<td>".C_FTP_USE.":</td><td>".PMBP_config_print("ftp_use")."</td>\n";
 313      echo "<td>".C_FTP_SERVER.":</td><td>".PMBP_config_print("ftp_server")."</td>\n";
 314      echo "<td>".C_FTP_USER.":</td><td>".PMBP_config_print("ftp_user")."</td>\n";
 315      echo "<td>".C_FTP_PASSWD.":</td><td>".PMBP_config_print("ftp_passwd")."</td>\n";
 316      echo "</tr><tr>";
 317      echo "<td>".C_FTP_PATH.":</td><td>".PMBP_config_print("ftp_path")."</td>\n";
 318      echo "<td>".C_FTP_PASV.":</td><td>".PMBP_config_print("ftp_pasv")."</td>\n";
 319      echo "<td>".C_FTP_PORT.":</td><td>".PMBP_config_print("ftp_port")."</td>\n";
 320      echo "<td>".C_FTP_DEL.":</td><td>".PMBP_config_print("ftp_del")."</td>\n";
 321      echo "</tr><tr>";
 322      echo "<td><br><div class=\"bold_left\">".C_TITLE_EMAIL."</div></td><td colspan=\"7\"><br><hr></td>\n";
 323      echo "</tr><tr>";
 324      echo "<td>".C_EMAIL_USE.":</td><td>".PMBP_config_print("email_use")."</td>\n";
 325      echo "<td>".C_EMAIL.":</td><td>".PMBP_config_print("email")."</td>\n";
 326      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 327      echo "<td>&nbsp;</td><td>&nbsp;</td>\n";
 328      echo "</tr>";
 329  }
 330  
 331  echo "<tr><td colspan=\"8\">\n<input name=\"submit\" type=\"submit\" value=\"".C_SAVE."\" class=\"button\"></td></tr>\n</table>\n</form>";
 332  PMBP_print_footer();
 333  
 334  
 335  // two functions only used in config.php
 336  
 337  // returns the html code for the different configuration items and controls
 338  function PMBP_config_print($item) {
 339      global $CONF;
 340      
 341      // vars whos type is checkbox, password, select or a filelist
 342      global $checkbox;
 343      $password=array("sql_passwd","ftp_passwd");
 344      $select['confirm']=array(C_CONFIRM_1,C_CONFIRM_2,C_CONFIRM_3,C_CONFIRM_4);
 345      $time=time();
 346      $select['date']=array(BD_DATE_FORMAT=>strftime(BD_DATE_FORMAT,$time),
 347          "%x %X"=>strftime("%x %X",$time),"%x %H:%M"=>strftime("%x %H:%M",$time),
 348          "%m/%d/%y %X"=>strftime("%m/%d/%y %X",$time),"%m/%d/%y %H:%M"=>strftime("%m/%d/%y %H:%M",$time),
 349          "%b %d %Y %X"=>strftime("%b %d %Y %X",$time),"%b %d %Y %H:%M"=>strftime("%b %d %Y %H:%M",$time),
 350          "%Y/%m/%d %X"=>strftime("%Y/%m/%d %X",$time),"%Y/%m/%d %H:%M"=>strftime("%Y/%m/%d %H:%M",$time));
 351      $filelist['lang']=array(PMBP_LANGUAGE_DIR,".inc.php");
 352      $filelist['stylesheet']=array(PMBP_STYLESHEET_DIR,".css");
 353  
 354      // create the html code
 355      if (isset($checkbox[$item])) {
 356          if ($CONF[$item]) $status=" checked"; else $status=" ";        
 357          $out="<input type=\"checkbox\" name=\"".$item."\" value=\"".$CONF[$item]."\"".$status.PMBP_config_disable($item).">";
 358      } elseif (in_array($item,$password)) {
 359          $out="<input type=\"password\" size=\"10\" name=\"".$item."\" value=\"".$CONF[$item]."\"".PMBP_config_disable($item).">";
 360      } elseif (isset($select[$item])) {
 361          $out="<select name=\"".$item."\"".PMBP_config_disable($item).">\n";
 362          foreach($select[$item] as $opt_no=>$print_value)
 363              if ($opt_no==$CONF[$item]) $out.="<option value=\"".$opt_no."\" selected>".$print_value."</option>\n";
 364                  else $out.="<option value=\"".$opt_no."\">".$print_value."</option>\n";
 365          $out.="</select>";
 366      } elseif(isset($filelist[$item])) {
 367          $files=FALSE;
 368          $handle=opendir("./".$filelist[$item][0]);
 369          while ($file=readdir($handle))
 370              if (substr($file,-(strlen($filelist[$item][1])),strlen($filelist[$item][1]))==$filelist[$item][1])
 371                  $files[]=substr($file,0,strlen($file)-strlen($filelist[$item][1]));
 372          $out="<select name=\"".$item."\">\n";
 373          foreach($files as $file)
 374              if ($file==$CONF[$item]) $out.="<option value=\"".$file."\" selected>".$file."</option>\n"; else $out.="<option value=\"".$file."\">".$file."</option>\n";
 375          $out.="</select>";
 376      } else {
 377          $out="<input type=\"text\" size=\"10\" name=\"".$item."\" value=\"".$CONF[$item]."\"".PMBP_config_disable($item)."><br>";
 378      }
 379      return $out;
 380  }
 381  
 382  // checks if a item should be disabled and returns the code to disable it
 383  function PMBP_config_disable($item) {
 384      global $CONF;
 385      global $PMBP_SYS_VAR;
 386      global $PMBP_MU_CONF;
 387      
 388      // availability check for some functions
 389      $disable=array('ftp_use'=>"!function_exists(\"ftp_connect\")",'ftp_server'=>"!function_exists(\"ftp_connect\")",
 390          'ftp_user'=>"!function_exists(\"ftp_connect\")",'ftp_passwd'=>"!function_exists(\"ftp_connect\")",
 391          'ftp_path'=>"!function_exists(\"ftp_connect\")",'ftp_pasv'=>"!function_exists(\"ftp_connect\")",
 392          'ftp_port'=>"!function_exists(\"ftp_connect\")",'email_use'=>"!function_exists(\"mail\")",'email'=>"!function_exists(\"mail\")",
 393          'no_login'=>($_SESSION['multi_user_mode'] || $CONF['login'])?1:0,
 394          'timelimit'=>"ini_get(\"safe_mode\")");
 395  
 396      // disable selected items due to system restrictions
 397      $out="";
 398      if (isset($disable[$item])) {
 399          if (eval("return(".$disable[$item].");")) $out=" disabled";
 400          // special case 'timelimit'
 401          if ($item=="timelimit" && $out) {
 402              $timelimit=ini_get("max_execution_time");
 403              if ($CONF['timelimit']!=$timelimit) {
 404                  $CONF['timelimit']=$timelimit;
 405                  PMBP_save_global_conf();
 406              }
 407          }
 408      }
 409      return $out;
 410  }
 411  ?>

title

Description

title

Description

title

Description

title

title

Body