/**
 * Loads the mysql extensions if it is not loaded yet
 *
 * @param   string  $extension  mysql extension to load
 */
function PMA_DBI_checkAndLoadMysqlExtension($extension = 'mysql')
{
    if (!function_exists($extension . '_connect')) {
        PMA_dl($extension);
        // check whether mysql is available
        if (!function_exists($extension . '_connect')) {
            return false;
        }
    }
    return true;
}
            PMA_dl('iconv');
            if (!@extension_loaded('iconv')) {
                echo $strCantLoadRecodeIconv;
                exit;
            }
        }
        $PMA_recoding_engine = 'iconv';
    } else {
        if (@extension_loaded('iconv')) {
            $PMA_recoding_engine = 'iconv';
        } elseif (@extension_loaded('recode')) {
            $PMA_recoding_engine = 'recode';
        } else {
            PMA_dl('iconv');
            if (!@extension_loaded('iconv')) {
                PMA_dl('recode');
                if (!@extension_loaded('recode')) {
                    echo $strCantLoadRecodeIconv;
                    exit;
                } else {
                    $PMA_recoding_engine = 'recode';
                }
            } else {
                $PMA_recoding_engine = 'iconv';
            }
        }
    }
}
// end load recode/iconv extension
define('PMA_CHARSET_NONE', 0);
define('PMA_CHARSET_ICONV', 1);
Example #3
0
 /**
  * Whether GD2 is present
  */
 function checkGd2()
 {
     if ($this->get('GD2Available') == 'yes') {
         $this->set('PMA_IS_GD2', 1);
     } elseif ($this->get('GD2Available') == 'no') {
         $this->set('PMA_IS_GD2', 0);
     } else {
         if (!@extension_loaded('gd')) {
             PMA_dl('gd');
         }
         if (!@function_exists('imagecreatetruecolor')) {
             $this->set('PMA_IS_GD2', 0);
         } else {
             if (@function_exists('gd_info')) {
                 $gd_nfo = gd_info();
                 if (strstr($gd_nfo["GD Version"], '2.')) {
                     $this->set('PMA_IS_GD2', 1);
                 } else {
                     $this->set('PMA_IS_GD2', 0);
                 }
             } else {
                 /* We must do hard way... */
                 ob_start();
                 phpinfo(INFO_MODULES);
                 /* Only modules */
                 $a = strip_tags(ob_get_contents());
                 ob_end_clean();
                 /* Get GD version string from phpinfo output */
                 if (preg_match('@GD Version[[:space:]]*\\(.*\\)@', $a, $v)) {
                     if (strstr($v, '2.')) {
                         $this->set('PMA_IS_GD2', 1);
                     } else {
                         $this->set('PMA_IS_GD2', 0);
                     }
                 } else {
                     $this->set('PMA_IS_GD2', 0);
                 }
             }
         }
     }
 }
Example #4
0
             } else {
                 $_SESSION['configuration'] = array_merge($_SESSION['configuration'], $vals);
                 message('notice', 'Configuration changed');
                 $show_info = TRUE;
             }
         } else {
             $show_info = TRUE;
         }
         break;
     case 'blah':
         show_blah_form($_SESSION['configuration']);
         break;
 */
 case 'versioncheck':
     // Check for latest available version
     PMA_dl('curl');
     $url = 'http://phpmyadmin.net/home_page/version.php';
     $data = '';
     $f = @fopen($url, 'r');
     if ($f === FALSE) {
         if (!function_exists('curl_init')) {
             message('error', 'Neither URL wrappers nor CURL are available. Version check is not possible.');
             break;
         }
     } else {
         $data = fread($f, 20);
         fclose($f);
     }
     if (empty($data) && function_exists('curl_init')) {
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_HEADER, FALSE);
Example #5
0
<?php

/* $Id: mysql.dbi.lib.php,v 2.33 2004/09/28 10:41:49 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Interface to the classic MySQL extension
 */
/**
 * Loads the mysql extensions if it is not loaded yet
 */
if (!@function_exists('mysql_connect')) {
    PMA_dl('mysql');
}
// check whether mysql is available
if (!@function_exists('mysql_connect')) {
    require_once './libraries/header_http.inc.php';
    echo sprintf($strCantLoad, 'mysql') . '<br />' . "\n" . '<a href="./Documentation.html#faqmysql" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . "\n";
    exit;
}
// MySQL client API
if (!defined('PMA_MYSQL_CLIENT_API')) {
    if (function_exists('mysql_get_client_info')) {
        $client_api = explode('.', mysql_get_client_info());
        define('PMA_MYSQL_CLIENT_API', (int) sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
        unset($client_api);
    } else {
        define('PMA_MYSQL_CLIENT_API', 32332);
        // always expect the worst...
    }
}
function PMA_DBI_connect($user, $password)
Example #6
0
<?php

/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * @version $Id$
 */
if (!defined('PHPMYADMIN')) {
    exit;
}
/**
 * checks for DBG extension and trys to load if not loaded
 *
 * allways use $GLOBALS here, as this script is included by footer.inc.hp
 * which can also be included from inside a function
 */
if ($GLOBALS['cfg']['DBG']['enable']) {
    /**
     * Loads the DBG extension if needed
     */
    if (!@extension_loaded('dbg') && !PMA_dl('dbg')) {
        echo '<div class="warning">' . sprintf($GLOBALS['strCantLoad'], 'DBG') . ' <a href="./Documentation.html#faqdbg" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . '</div>';
    } else {
        $GLOBALS['DBG'] = true;
    }
}
Example #7
0
    if ($GLOBALS['charset'] == 'iso-8859-8-i') {
        mb_internal_encoding('iso-8859-8');
    } else {
        mb_internal_encoding($GLOBALS['charset']);
    }
}
// This is for handling input better
if (defined('PMA_MULTIBYTE_ENCODING') || $GLOBALS['PMA_allow_mbstr']) {
    $GLOBALS['PMA_strpos'] = 'mb_strpos';
    require './libraries/string_mb.lib.php';
} else {
    $GLOBALS['PMA_strpos'] = 'strpos';
    require './libraries/string_native.lib.php';
}
if (!@extension_loaded('ctype')) {
    PMA_dl('ctype');
}
if (@extension_loaded('ctype')) {
    require './libraries/string_type_ctype.lib.php';
} else {
    require './libraries/string_type_native.lib.php';
}
/**
 * This checks if a string actually exists inside another string
 * We try to do it in a PHP3-portable way.
 * We don't care about the position it is in.
 *
 * @uses    PMA_STR_pos()
 * @param   string   string to search for
 * @param   string   string to search in
 * @return  boolean  whether the needle is in the haystack or not
Example #8
0
    }
    if ($GLOBALS['PMA_dl_allowed']) {
        return @dl($module . $suffix);
    } else {
        return FALSE;
    }
}
// Whether GD2 is present
if (!defined('PMA_IS_GD2')) {
    if ($cfg['GD2Available'] == 'yes') {
        define('PMA_IS_GD2', 1);
    } elseif ($cfg['GD2Available'] == 'no') {
        define('PMA_IS_GD2', 0);
    } else {
        if (!@extension_loaded('gd')) {
            PMA_dl('gd');
        }
        if (!@function_exists('imagecreatetruecolor')) {
            define('PMA_IS_GD2', 0);
        } else {
            if (@function_exists('gd_info')) {
                $gd_nfo = gd_info();
                if (strstr($gd_nfo["GD Version"], '2.')) {
                    define('PMA_IS_GD2', 1);
                } else {
                    define('PMA_IS_GD2', 0);
                }
            } else {
                /* We must do hard way... */
                ob_start();
                phpinfo(INFO_MODULES);
Example #9
0
// vim: expandtab sw=4 ts=4 sts=4:
/** Specialized String Functions for phpMyAdmin
 *
 * Copyright 2002 Robin Johnson <*****@*****.**>
 * http://www.orbis-terrarum.net/?l=people.robbat2
 *
 * Defines a set of function callbacks that have a pure C version available if
 * the "ctype" extension is available, but otherwise have PHP versions to use
 * (that are slower).
 *
 * The SQL Parser code relies heavily on these functions.
 */
/* Try to load mbstring, unless we're using buggy php version */
if (PMA_PHP_INT_VERSION != 40203) {
    if (!@extension_loaded('mbstring')) {
        PMA_dl('mbstring');
    }
}
/* windows-* and tis-620 are not supported and are not multibyte,
 * others can be ignored as they're not multibyte */
$GLOBALS['using_mb_charset'] = substr($GLOBALS['charset'], 0, 8) != 'windows-' && substr($GLOBALS['charset'], 0, 9) != 'iso-8859-' && substr($GLOBALS['charset'], 0, 3) != 'cp-' && $GLOBALS['charset'] != 'koi8-r' && $GLOBALS['charset'] != 'tis-620';
$GLOBALS['PMA_allow_mbstr'] = @function_exists('mb_strlen') && $GLOBALS['using_mb_charset'];
if ($GLOBALS['PMA_allow_mbstr']) {
    // the hebrew lang file uses iso-8859-8-i, encoded RTL,
    // but mb_internal_encoding only supports iso-8859-8
    if ($GLOBALS['charset'] == 'iso-8859-8-i') {
        mb_internal_encoding('iso-8859-8');
    } else {
        mb_internal_encoding($GLOBALS['charset']);
    }
}
<?php

/* $Id: cookie.auth.lib.php 10471 2007-07-03 00:28:32Z lem9 $ */
// vim: expandtab sw=4 ts=4 sts=4:
// +--------------------------------------------------------------------------+
// | Set of functions used to run cookie based authentication.                |
// | Thanks to Piotr Roszatycki <d3xter at users.sourceforge.net> and         |
// | Dan Wilson who built this patch for the Debian package.                  |
// +--------------------------------------------------------------------------+
if (!isset($coming_from_common)) {
    exit;
}
// timestamp for login timeout
$current_time = time();
// Uses faster mcrypt library if available
if (function_exists('mcrypt_encrypt') || PMA_dl('mcrypt')) {
    require_once './libs/mcrypt.lib.php';
} else {
    require_once './libs/blowfish.php';
    // for main.php:
    define('PMA_WARN_FOR_MCRYPT', 1);
}
/**
 * Displays authentication form
 *
 * @global  string    the font face to use
 * @global  string    the default font size to use
 * @global  string    the big font size to use
 * @global  array     the list of servers settings
 * @global  array     the list of available translations
 * @global  string    the current language
Example #11
0
<?php

/* $Id: setup.php,v 2.3 2003/11/26 22:52:25 rabus Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
if (isset($GLOBALS['cfg']['DBG']['enable']) && $GLOBALS['cfg']['DBG']['enable']) {
    /**
     * Loads the DBG extension if needed
     */
    if (!@extension_loaded('dbg')) {
        PMA_dl('dbg');
    }
    if (!@extension_loaded('dbg')) {
        echo sprintf($strCantLoad, 'DBG') . '<br />' . "\n" . '<a href="./Documentation.html#faqdbg" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . "\n";
        require_once './footer.inc.php';
    }
    $GLOBALS['DBG'] = true;
}
Example #12
0
<?php

/* $Id: mysqli.dbi.lib.php,v 2.37 2005/08/08 14:55:07 lem9 Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Interface to the improved MySQL extension (MySQLi)
 */
/**
 * Loads the MySQLi extension if it is not loaded yet
 */
if (!@function_exists('mysqli_connect')) {
    PMA_dl('mysqli');
}
// check whether mysql is available
if (!@function_exists('mysqli_connect')) {
    require_once './libraries/header_http.inc.php';
    echo sprintf($strCantLoad, 'mysqli') . '<br />' . "\n" . '<a href="./Documentation.html#faqmysql" target="documentation">' . $GLOBALS['strDocu'] . '</a>' . "\n";
    exit;
}
// MySQL client API
if (!defined('PMA_MYSQL_CLIENT_API')) {
    $client_api = explode('.', mysqli_get_client_info());
    define('PMA_MYSQL_CLIENT_API', (int) sprintf('%d%02d%02d', $client_api[0], $client_api[1], intval($client_api[2])));
    unset($client_api);
}
// Constants from mysql_com.h of MySQL 4.1.3
define('NOT_NULL_FLAG', 1);
define('PRI_KEY_FLAG', 2);
define('UNIQUE_KEY_FLAG', 4);
define('MULTIPLE_KEY_FLAG', 8);
define('BLOB_FLAG', 16);