1<?php 2/************************* 3 Coppermine Photo Gallery 4 ************************ 5 Copyright (c) 2003-2016 Coppermine Dev Team 6 v1.0 originally written by Gregory Demar 7 8 This program is free software; you can redistribute it and/or modify 9 it under the terms of the GNU General Public License version 3 10 as published by the Free Software Foundation. 11 12 ******************************************** 13 Coppermine version: 1.6.03 14 $HeadURL$ 15**********************************************/ 16 17if (!defined('IN_COPPERMINE')) die('Not in Coppermine...'); 18 19class DbaseSelect 20{ 21 protected $dbtypes = array('mysqli'=>'MYSQLI','pdo:mysql'=>'PDO:MYSQL','mysql'=>'MYSQL'); 22 23 public function __construct ($dbtypes=null) 24 { 25 if ($dbtypes) $this->dbtypes = $dbtypes; 26 } 27 28 public function options ($sel='mysqli', $upd=false) 29 { 30 $opts = ''; 31 foreach ($this->dbtypes as $dtype => $dsp) { 32 $opts .= '<option value="'.$dtype.'"'; 33 list($tnam,$tsub) = explode(':', $dtype.':'); 34 require_once 'include/database/'.$tnam.'/install.php'; 35 $ifunc = 'dbcheck_'.$tnam; 36 if (function_exists($ifunc) && $ifunc($tsub)===true) { 37 if ($dtype == $sel) $opts .= ' selected'; 38 $opts .= '>'.$dsp; 39 } else { 40 $opts .= ' disabled>'.$dsp.' ('.$ifunc($tsub).')'; 41 } 42 $opts .= '</option>'; 43 } 44 return $opts; 45 } 46 47} 48//EOF