Пример #1
0
 * The possible scopes for $plugin_param are: 'table', 'database', and 'server'
 */
if (isset($plugin_list)) {
    $plugin_list['xls'] = array('text' => 'strImportXLS', 'extension' => 'xls', 'options' => array(array('type' => 'bool', 'name' => 'col_names', 'text' => 'strImportColNames')), 'options_text' => 'strOptions');
    /* We do not define function when plugin is just queried for information above */
    return;
}
ini_set('memory_limit', '256M');
set_time_limit(120);
/* Append the PHPExcel directory to the include path variable */
set_include_path(get_include_path() . PATH_SEPARATOR . getcwd() . '/libraries/PHPExcel/');
require_once './libraries/PHPExcel/PHPExcel.php';
require_once './libraries/PHPExcel/PHPExcel/Reader/Excel5.php';
$objReader = new PHPExcel_Reader_Excel5();
$objReader->setReadDataOnly(true);
$objReader->setLoadAllSheets();
$objPHPExcel = $objReader->load($import_file);
$sheet_names = $objPHPExcel->getSheetNames();
$num_sheets = count($sheet_names);
$tables = array();
$tempRow = array();
$rows = array();
$col_names = array();
for ($s = 0; $s < $num_sheets; ++$s) {
    $current_sheet = $objPHPExcel->getSheet($s);
    $num_rows = $current_sheet->getHighestRow();
    $num_cols = PMA_getColumnNumberFromName($current_sheet->getHighestColumn());
    if ($num_rows != 1 && $num_cols != 1) {
        for ($r = 1; $r <= $num_rows; ++$r) {
            for ($c = 0; $c < $num_cols; ++$c) {
                $cell = $current_sheet->getCellByColumnAndRow($c, $r)->getCalculatedValue();