当前位置: 首页>>代码示例>>PHP>>正文


PHP rex_sql::showTables方法代码示例

本文整理汇总了PHP中rex_sql::showTables方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::showTables方法的具体用法?PHP rex_sql::showTables怎么用?PHP rex_sql::showTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rex_sql的用法示例。


在下文中一共展示了rex_sql::showTables方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 function execute()
 {
     global $REX;
     $tables = rex_sql::showTables(1, $REX['TABLE_PREFIX']);
     if (is_array($tables) && !empty($tables)) {
         $sql = rex_sql::factory();
         // $sql->debugsql = true;
         return $sql->setQuery('OPTIMIZE TABLE ' . implode(', ', $tables));
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:11,代码来源:class.cronjob.inc.php

示例2: verifyDbSchema

 public static function verifyDbSchema()
 {
     $err_msg = '';
     // Prüfen, welche Tabellen bereits vorhanden sind
     $existingTables = [];
     foreach (rex_sql::showTables() as $tblname) {
         if (substr($tblname, 0, strlen(rex::getTablePrefix())) == rex::getTablePrefix()) {
             $existingTables[] = $tblname;
         }
     }
     foreach (array_diff(self::getRequiredTables(), $existingTables) as $missingTable) {
         $err_msg .= rex_i18n::msg('setup_502', $missingTable) . '<br />';
     }
     return $err_msg;
 }
开发者ID:alsahh,项目名称:redaxo,代码行数:15,代码来源:import.php

示例3: execute

 public function execute()
 {
     $tables = rex_sql::showTables(1, rex::getTablePrefix());
     if (is_array($tables) && !empty($tables)) {
         $sql = rex_sql::factory();
         // $sql->setDebug();
         try {
             $sql->setQuery('OPTIMIZE TABLE ' . implode(', ', $tables));
             return true;
         } catch (rex_sql_exception $e) {
             return false;
         }
     }
     return false;
 }
开发者ID:staabm,项目名称:redaxo,代码行数:15,代码来源:cronjob.php

示例4: rex_metainfo_cleanup

/**
 * Alle Metafelder löschen, nicht das nach einem Import in der Parameter Tabelle
 * noch Datensätze zu Feldern stehen, welche nicht als Spalten in der
 * rex_article angelegt wurden!
 */
function rex_metainfo_cleanup($epOrParams)
{
    $params = $epOrParams instanceof rex_extension_point ? $epOrParams->getParams() : $epOrParams;
    // Cleanup nur durchführen, wenn auch die rex_article Tabelle neu angelegt wird
    if (isset($params['force']) && $params['force'] != true && strpos($params['content'], 'CREATE TABLE `' . rex::getTablePrefix() . 'article`') === false && strpos($params['content'], 'CREATE TABLE ' . rex::getTablePrefix() . 'article') === false) {
        return;
    }
    // check wheter tables exists
    $tables = rex_sql::showTables();
    if (!isset($tables[rex::getTablePrefix() . 'metainfo_field'])) {
        return false;
    }
    // since this extension may be used also when the addon is not yet installed,
    // require needed classes manually
    require_once __DIR__ . '/../lib/table_manager.php';
    $sql = rex_sql::factory();
    $sql->setQuery('SELECT name FROM ' . rex::getTablePrefix() . 'metainfo_field');
    for ($i = 0; $i < $sql->getRows(); ++$i) {
        if (substr($sql->getValue('name'), 0, 4) == 'med_') {
            $tableManager = new rex_metainfo_table_manager(rex::getTablePrefix() . 'media');
        } else {
            $tableManager = new rex_metainfo_table_manager(rex::getTablePrefix() . 'article');
        }
        $tableManager->deleteColumn($sql->getValue('name'));
        $sql->next();
    }
    // evtl reste aufräumen
    $tablePrefixes = ['article' => ['art_', 'cat_'], 'media' => ['med_']];
    foreach ($tablePrefixes as $table => $prefixes) {
        $table = rex::getTablePrefix() . $table;
        $tableManager = new rex_metainfo_table_manager($table);
        foreach (rex_sql::showColumns($table) as $column) {
            $column = $column['name'];
            if (in_array(substr($column, 0, 4), $prefixes)) {
                $tableManager->deleteColumn($column);
            }
        }
    }
    $sql = rex_sql::factory();
    $sql->setQuery('DELETE FROM ' . rex::getTablePrefix() . 'metainfo_field');
}
开发者ID:staabm,项目名称:redaxo,代码行数:46,代码来源:extension_cleanup.php

示例5: rex_setup_addons

        }
        if ($err_msg == '') {
            $err_msg .= rex_setup_addons(true);
        }
    } elseif ($dbanlegen == 0) {
        // ----- leere Datenbank neu einrichten
        $import_sql = $REX['INCLUDE_PATH'] . '/install/redaxo4_0.sql';
        if ($err_msg == '') {
            $err_msg .= rex_setup_import($import_sql);
        }
        $err_msg .= rex_setup_addons();
    }
    if ($err_msg == "" && isset($dbanlegen)) {
        // Prüfen, welche Tabellen bereits vorhanden sind
        $existingTables = array();
        foreach (rex_sql::showTables() as $tblname) {
            if (substr($tblname, 0, strlen($REX['TABLE_PREFIX'])) == $REX['TABLE_PREFIX']) {
                $existingTables[] = $tblname;
            }
        }
        foreach (array_diff($requiredTables, $existingTables) as $missingTable) {
            $err_msg .= $I18N->msg('setup_031', $missingTable . '<br />');
        }
    }
    if ($err_msg == "") {
        $send = "";
        $checkmodus = 4;
    }
}
if ($checkmodus == 3) {
    rex_setup_title($I18N->msg('setup_step3'));
开发者ID:BackupTheBerlios,项目名称:redaxo,代码行数:31,代码来源:setup.inc.php

示例6: foreach

     $field->setAttribute('style', 'width: 200px;');
     $select =& $field->getSelect();
     $select->setSize(1);
     foreach ($REX['CLANG'] as $key => $value) {
         $select->addOption($value, $key);
     }
 }
 $field =& $form->addSelectField('table');
 $field->setLabel($I18N->msg('b_table'));
 $field->setAttribute('onchange', 'url_generate_table(this);');
 $field->setAttribute('style', 'width: 200px;');
 $select =& $field->getSelect();
 $select->setSize(1);
 $select->addOption($I18N->msg('b_no_table_selected'), '');
 $fields = array();
 $tables = rex_sql::showTables();
 foreach ($tables as $table) {
     $select->addOption($table, $table);
     $columns = rex_sql::showColumns($table);
     foreach ($columns as $column) {
         $fields[$table][] = $column['name'];
     }
 }
 $table_id = $field->getAttribute('id');
 $fieldContainer =& $form->addContainerField('table_parameters');
 $fieldContainer->setAttribute('style', 'display: none');
 if (count($fields > 0)) {
     foreach ($fields as $table => $columns) {
         $group = $table;
         $options = $columns;
         $type = 'select';
开发者ID:ReggaePanda,项目名称:redaxo_plugin_url_control,代码行数:31,代码来源:url_generate.php

示例7: exportDb

 /**
  * Erstellt einen SQL Dump, der die aktuellen Datebankstruktur darstellt.
  * Dieser wird in der Datei $filename gespeichert.
  *
  * @param string $filename
  * @param array  $tables
  *
  * @return bool TRUE wenn ein Dump erstellt wurde, sonst FALSE
  */
 public static function exportDb($filename, array $tables = null)
 {
     $fp = @fopen($filename, 'w');
     if (!$fp) {
         return false;
     }
     $sql = rex_sql::factory();
     $nl = "\n";
     $insertSize = 5000;
     // ----- EXTENSION POINT
     rex_extension::registerPoint(new rex_extension_point('BACKUP_BEFORE_DB_EXPORT'));
     // Versionsstempel hinzufügen
     fwrite($fp, '## Redaxo Database Dump Version ' . rex::getVersion('%s') . $nl);
     fwrite($fp, '## Prefix ' . rex::getTablePrefix() . $nl);
     //fwrite($fp, '## charset '.rex_i18n::msg('htmlcharset').$nl.$nl);
     fwrite($fp, '## charset utf-8' . $nl . $nl);
     //  fwrite($fp, '/*!40110 START TRANSACTION; */'.$nl);
     if (is_null($tables)) {
         $tables = [];
         foreach (rex_sql::showTables(1, rex::getTablePrefix()) as $table) {
             if ($table != rex::getTable('user') && substr($table, 0, strlen(rex::getTablePrefix() . rex::getTempPrefix())) != rex::getTablePrefix() . rex::getTempPrefix()) {
                 // Tabellen die mit rex_tmp_ beginnne, werden nicht exportiert!
                 $tables[] = $table;
             }
         }
     }
     foreach ($tables as $table) {
         //---- export metadata
         $create = rex_sql::showCreateTable($table);
         fwrite($fp, 'DROP TABLE IF EXISTS `' . $table . '`;' . $nl);
         fwrite($fp, $create . ';' . $nl);
         $fields = $sql->getArray('SHOW FIELDS FROM `' . $table . '`');
         foreach ($fields as &$field) {
             if (preg_match('#^(bigint|int|smallint|mediumint|tinyint|timestamp)#i', $field['Type'])) {
                 $field = 'int';
             } elseif (preg_match('#^(float|double|decimal)#', $field['Type'])) {
                 $field = 'double';
             } elseif (preg_match('#^(char|varchar|text|longtext|mediumtext|tinytext)#', $field['Type'])) {
                 $field = 'string';
             }
             // else ?
         }
         //---- export tabledata
         $start = 0;
         $max = $insertSize;
         do {
             $array = $sql->getArray('SELECT * FROM `' . $table . '` LIMIT ' . $start . ',' . $max, [], PDO::FETCH_NUM);
             $count = $sql->getRows();
             if ($count > 0 && $start == 0) {
                 fwrite($fp, $nl . 'LOCK TABLES `' . $table . '` WRITE;');
                 fwrite($fp, $nl . '/*!40000 ALTER TABLE `' . $table . '` DISABLE KEYS */;');
             } elseif ($count == 0) {
                 break;
             }
             $start += $max;
             $values = [];
             foreach ($array as $row) {
                 $record = [];
                 foreach ($fields as $idx => $type) {
                     $column = $row[$idx];
                     switch ($type) {
                         case 'int':
                             $record[] = intval($column);
                             break;
                         case 'double':
                             $record[] = sprintf('%.10F', (double) $column);
                             break;
                         case 'string':
                         default:
                             $record[] = $sql->escape($column, "'");
                             break;
                     }
                 }
                 $values[] = $nl . '  (' . implode(',', $record) . ')';
             }
             if (!empty($values)) {
                 fwrite($fp, $nl . 'INSERT INTO `' . $table . '` VALUES ' . implode(',', $values) . ';');
                 unset($values);
             }
         } while ($count >= $max);
         if ($start > 0) {
             fwrite($fp, $nl . '/*!40000 ALTER TABLE `' . $table . '` ENABLE KEYS */;');
             fwrite($fp, $nl . 'UNLOCK TABLES;' . $nl . $nl);
         }
     }
     fclose($fp);
     $hasContent = true;
     // Den Dateiinhalt geben wir nur dann weiter, wenn es unbedingt notwendig ist.
     if (rex_extension::isRegistered('BACKUP_AFTER_DB_EXPORT')) {
         $content = rex_file::get($filename);
         $hashBefore = md5($content);
//.........这里部分代码省略.........
开发者ID:VIEWSION,项目名称:redaxo,代码行数:101,代码来源:backup.php

示例8: file_get_contents

         $form = $fragment->parse('core/page/section.php');
         echo $form;
         echo rex_view::info('<a href="index.php?page=' . $page . '"><b>&laquo; ' . rex_i18n::msg('yform_back_to_overview') . '</b></a>');
         $show_list = false;
     } else {
         try {
             $content = file_get_contents($yform->objparams['value_pool']['email']['importfile']);
             rex_yform_manager_table_api::importTablesets($content);
             echo rex_view::info(rex_i18n::msg('yform_manager_table_import_success'));
         } catch (Exception $e) {
             echo rex_view::warning(rex_i18n::msg('yform_manager_table_import_failed', '', $e->getMessage()));
         }
     }
 } else {
     if ($func == 'migrate' && rex::getUser()->isAdmin()) {
         $available_tables = rex_sql::showTables();
         $yform_tables = array();
         $missing_tables = array();
         foreach (rex_yform_manager_table::getAll() as $g_table) {
             $yform_tables[] = $g_table->getTableName();
         }
         foreach ($available_tables as $a_table) {
             if (!in_array($a_table, $yform_tables)) {
                 $missing_tables[$a_table] = $a_table;
             }
         }
         $yform = new rex_yform();
         $yform->setDebug(true);
         $yform->setHiddenField('page', $page);
         $yform->setHiddenField('func', $func);
         $yform->setValueField('select', array('table_name', rex_i18n::msg('yform_table'), $missing_tables));
开发者ID:xong,项目名称:redaxo_yform,代码行数:31,代码来源:table_edit.php

示例9: rex_a1_import_db

/**
 * Importiert den SQL Dump $filename in die Datenbank
 *
 * @param string Pfad + Dateinamen zur SQL-Datei
 *
 * @return array Gibt ein Assoc. Array zurück.
 *               'state' => boolean (Status ob fehler aufgetreten sind)
 *               'message' => Evtl. Status/Fehlermeldung
 */
function rex_a1_import_db($filename)
{
    global $REX, $I18N;
    $return = array();
    $return['state'] = false;
    $return['message'] = '';
    $msg = '';
    $error = '';
    if ($filename == '' || substr($filename, -4, 4) != ".sql") {
        $return['message'] = $I18N->msg('im_export_no_import_file_chosen_or_wrong_version') . '<br>';
        return $return;
    }
    $conts = rex_get_file_contents($filename);
    // Versionsstempel prüfen
    // ## Redaxo Database Dump Version x.x
    $version = strpos($conts, '## Redaxo Database Dump Version ' . $REX['VERSION']);
    if ($version === false) {
        $return['message'] = $I18N->msg('im_export_no_valid_import_file') . '. [## Redaxo Database Dump Version ' . $REX['VERSION'] . '] is missing';
        return $return;
    }
    // Versionsstempel entfernen
    $conts = trim(str_replace('## Redaxo Database Dump Version ' . $REX['VERSION'], '', $conts));
    // Prefix prüfen
    // ## Prefix xxx_
    if (preg_match('/^## Prefix ([a-zA-Z0-9\\_]*)/', $conts, $matches) && isset($matches[1])) {
        // prefix entfernen
        $prefix = $matches[1];
        $conts = trim(str_replace('## Prefix ' . $prefix, '', $conts));
    } else {
        // Prefix wurde nicht gefunden
        $return['message'] = $I18N->msg('im_export_no_valid_import_file') . '. [## Prefix ' . $REX['TABLE_PREFIX'] . '] is missing';
        return $return;
    }
    // Charset prŸfen
    // ## charset xxx_
    if (preg_match('/^## charset ([a-zA-Z0-9\\_\\-]*)/', $conts, $matches) && isset($matches[1])) {
        // charset entfernen
        $charset = $matches[1];
        $conts = trim(str_replace('## charset ' . $charset, '', $conts));
        if ($I18N->msg('htmlcharset') != $charset) {
            $return['message'] = $I18N->msg('im_export_no_valid_charset') . '. ' . $I18N->msg('htmlcharset') . ' != ' . $charset;
            return $return;
        }
    }
    /*
    // Charset nicht zwingend notwendig
    else
    {
      $return['message'] = $I18N->msg('im_export_no_valid_import_file').'. [## Charset '. $I18N->msg('htmlcharset') .'] is missing]';
      return $return;
    }
    */
    // Prefix im export mit dem der installation angleichen
    if ($REX['TABLE_PREFIX'] != $prefix) {
        // Hier case-insensitiv ersetzen, damit alle möglich Schreibweisen (TABLE TablE, tAblE,..) ersetzt werden
        // Dies ist wichtig, da auch SQLs innerhalb von Ein/Ausgabe der Module vom rex-admin verwendet werden
        $conts = preg_replace('/(TABLE `?)' . preg_quote($prefix, '/') . '/i', '$1' . $REX['TABLE_PREFIX'], $conts);
        $conts = preg_replace('/(INTO `?)' . preg_quote($prefix, '/') . '/i', '$1' . $REX['TABLE_PREFIX'], $conts);
        $conts = preg_replace('/(EXISTS `?)' . preg_quote($prefix, '/') . '/i', '$1' . $REX['TABLE_PREFIX'], $conts);
    }
    // ----- EXTENSION POINT
    $filesize = filesize($filename);
    $msg = rex_register_extension_point('A1_BEFORE_DB_IMPORT', $msg, array('content' => $conts, 'filename' => $filename, 'filesize' => $filesize));
    // Datei aufteilen
    $lines = explode("\n", $conts);
    $add = new rex_sql();
    $error = '';
    foreach ($lines as $line) {
        $line = trim($line, "\r");
        // Windows spezifische extras
        $line = trim($line, ";");
        // mysql 3.x
        if ($line == '') {
            continue;
        }
        $add->setQuery($line);
        if ($add->hasError()) {
            $error .= "\n" . $add->getError();
        }
    }
    if ($error != '') {
        $return['message'] = trim($error);
        return $return;
    }
    $msg .= $I18N->msg('im_export_database_imported') . '. ' . $I18N->msg('im_export_entry_count', count($lines)) . '<br />';
    // prüfen, ob eine user tabelle angelegt wurde
    $tables = rex_sql::showTables();
    $user_table_found = in_array($REX['TABLE_PREFIX'] . 'user', $tables);
    if (!$user_table_found) {
        $create_user_table = '
    CREATE TABLE ' . $REX['TABLE_PREFIX'] . 'user
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:redaxo-svn,代码行数:101,代码来源:function_import_export.inc.php

示例10: rex_a1_export_db

/**
 * Erstellt einen SQL Dump, der die aktuellen Datebankstruktur darstellt.
 * Dieser wird in der Datei $filename gespeichert.
 *
 * @return boolean TRUE wenn ein Dump erstellt wurde, sonst FALSE
 */
function rex_a1_export_db($filename, array $tables = null)
{
    global $REX, $I18N;
    $fp = @fopen($filename, 'w');
    if (!$fp) {
        return false;
    }
    // Im Frontend gibts kein I18N
    if (!is_object($I18N)) {
        $I18N = rex_create_lang($REX['LANG']);
    }
    $sql = rex_sql::factory();
    $nl = "\n";
    $insertSize = 5000;
    // ----- EXTENSION POINT
    rex_register_extension_point('A1_BEFORE_DB_EXPORT');
    // Versionsstempel hinzufügen
    fwrite($fp, '## Redaxo Database Dump Version ' . $REX['VERSION'] . $nl);
    fwrite($fp, '## Prefix ' . $REX['TABLE_PREFIX'] . $nl);
    fwrite($fp, '## charset ' . $I18N->msg('htmlcharset') . $nl . $nl);
    //  fwrite($fp, '/*!40110 START TRANSACTION; */'.$nl);
    if (is_null($tables)) {
        $tables = array();
        foreach (rex_sql::showTables(1, $REX['TABLE_PREFIX']) as $table) {
            if ($table != $REX['TABLE_PREFIX'] . 'user' && substr($table, 0, strlen($REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX'])) != $REX['TABLE_PREFIX'] . $REX['TEMP_PREFIX']) {
                // Tabellen die mit rex_tmp_ beginnne, werden nicht exportiert!
                $tables[] = $table;
            }
        }
    }
    foreach ($tables as $table) {
        //---- export metadata
        $create = rex_sql::showCreateTable($table);
        fwrite($fp, "DROP TABLE IF EXISTS `{$table}`;\n");
        fwrite($fp, "{$create};\n");
        $fields = $sql->getArray("SHOW FIELDS FROM `{$table}`");
        foreach ($fields as $idx => $field) {
            if (preg_match('#^(bigint|int|smallint|mediumint|tinyint|timestamp)#i', $field['Type'])) {
                $fields[$idx] = 'int';
            } elseif (preg_match('#^(float|double|decimal)#', $field['Type'])) {
                $fields[$idx] = 'double';
            } elseif (preg_match('#^(char|varchar|text|longtext|mediumtext|tinytext)#', $field['Type'])) {
                $fields[$idx] = 'string';
            }
            // else ?
        }
        //---- export tabledata
        $start = 0;
        $max = $insertSize;
        do {
            $sql->freeResult();
            $sql->setQuery("SELECT * FROM `{$table}` LIMIT {$start},{$max}");
            if ($sql->getRows() > 0 && $start == 0) {
                fwrite($fp, "\nLOCK TABLES `{$table}` WRITE;");
                fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` DISABLE KEYS */;");
            } elseif ($sql->getRows() == 0) {
                break;
            }
            $start += $max;
            $values = array();
            while ($sql->hasNext()) {
                $record = array();
                foreach ($fields as $idx => $type) {
                    $column = $sql->getValue($idx);
                    switch ($type) {
                        case 'int':
                            $record[] = intval($column);
                            break;
                        case 'double':
                            $record[] = sprintf('%.10F', (double) $column);
                            break;
                        case 'string':
                        default:
                            $record[] = $sql->escape($column, "'", true);
                            break;
                    }
                }
                $values[] = $nl . '  (' . implode(',', $record) . ')';
                $sql->next();
            }
            if (!empty($values)) {
                $values = implode(',', $values);
                fwrite($fp, "\nINSERT INTO `{$table}` VALUES {$values};");
                unset($values);
            }
        } while ($sql->getRows() >= $max);
        if ($start > 0) {
            fwrite($fp, "\n/*!40000 ALTER TABLE `{$table}` ENABLE KEYS */;");
            fwrite($fp, "\nUNLOCK TABLES;\n\n");
        }
    }
    fclose($fp);
    $hasContent = true;
    // Den Dateiinhalt geben wir nur dann weiter, wenn es unbedingt notwendig ist.
//.........这里部分代码省略.........
开发者ID:Barnhiac,项目名称:MTW_REDAXO,代码行数:101,代码来源:function_import_export.inc.php

示例11: a587_getSettingsFormSection

    $sampleoutput .= $rexsearch->getHighlightedText($sample);
}
$sampleoutput .= '</div></div>';
echo a587_getSettingsFormSection('a587_highlight', $I18N->Msg('a587_settings_highlight_header'), array(array('type' => 'string', 'id' => 'a587_rexsearch_surroundtags_start', 'name' => 'a587_rexsearch[surroundtags][0]', 'label' => $I18N->Msg('a587_settings_surroundtags_start'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['surroundtags'][0]) ? htmlspecialchars($REX['ADDON']['settings']['rexsearch']['surroundtags'][0]) : ''), array('type' => 'string', 'id' => 'a587_rexsearch_surroundtags_end', 'name' => 'a587_rexsearch[surroundtags][1]', 'label' => $I18N->Msg('a587_settings_surroundtags_end'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['surroundtags'][1]) ? htmlspecialchars($REX['ADDON']['settings']['rexsearch']['surroundtags'][1]) : ''), array('type' => 'hidden', 'name' => 'a587_rexsearch[limit][0]', 'value' => '0'), array('type' => 'string', 'id' => 'a587_rexsearch_limit', 'name' => 'a587_rexsearch[limit][1]', 'label' => $I18N->Msg('a587_settings_limit'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['limit'][1]) ? intval($REX['ADDON']['settings']['rexsearch']['limit'][1]) : ''), array('type' => 'string', 'id' => 'a587_rexsearch_maxteaserchars', 'name' => 'a587_rexsearch[maxteaserchars]', 'label' => $I18N->Msg('a587_settings_maxteaserchars'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['maxteaserchars']) ? intval($REX['ADDON']['settings']['rexsearch']['maxteaserchars']) : ''), array('type' => 'string', 'id' => 'a587_rexsearch_maxhighlightchars', 'name' => 'a587_rexsearch[maxhighlightchars]', 'label' => $I18N->Msg('a587_settings_maxhighlightchars'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['maxhighlightchars']) ? intval($REX['ADDON']['settings']['rexsearch']['maxhighlightchars']) : ''), array('type' => 'select', 'id' => 'a587_rexsearch_highlight', 'name' => 'a587_rexsearch[highlight]', 'label' => $I18N->Msg('a587_settings_highlight_label'), 'options' => array(array('value' => 'sentence', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'sentence', 'name' => $I18N->Msg('a587_settings_highlight_sentence')), array('value' => 'paragraph', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'paragraph', 'name' => $I18N->Msg('a587_settings_highlight_paragraph')), array('value' => 'surroundtext', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'surroundtext', 'name' => $I18N->Msg('a587_settings_highlight_surroundtext')), array('value' => 'surroundtextsingle', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'surroundtextsingle', 'name' => $I18N->Msg('a587_settings_highlight_surroundtextsingle')), array('value' => 'teaser', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'teaser', 'name' => $I18N->Msg('a587_settings_highlight_teaser')), array('value' => 'array', 'selected' => $REX['ADDON']['settings']['rexsearch']['highlight'] == 'array', 'name' => $I18N->Msg('a587_settings_highlight_array')))), array('type' => 'directoutput', 'output' => '<div class="rex-form-row">' . $sampleoutput . '</div>')));
$categories = array();
foreach (a587_getCategories() as $id => $name) {
    $categories[] = array('value' => $id, 'selected' => !empty($REX['ADDON']['settings']['rexsearch']['exclude_category_ids']) and is_array($REX['ADDON']['settings']['rexsearch']['exclude_category_ids']) and in_array($id, $REX['ADDON']['settings']['rexsearch']['exclude_category_ids']), 'name' => $name . ' (' . $id . ')');
}
$articles = array();
foreach (a587_getArticles() as $id => $name) {
    $articles[] = array('value' => $id, 'selected' => !empty($REX['ADDON']['settings']['rexsearch']['exclude_article_ids']) and is_array($REX['ADDON']['settings']['rexsearch']['exclude_article_ids']) and in_array($id, $REX['ADDON']['settings']['rexsearch']['exclude_article_ids']), 'name' => $name . ' (' . $id . ')');
}
echo a587_getSettingsFormSection('a587_exclude', $I18N->Msg('a587_settings_exclude'), array(array('type' => 'string', 'id' => 'a587_settings_exclude_blacklist', 'name' => 'a587_rexsearch[blacklist]', 'label' => $I18N->Msg('a587_settings_exclude_blacklist'), 'value' => isset($REX['ADDON']['settings']['rexsearch']['blacklist']) ? htmlspecialchars(implode(',', $REX['ADDON']['settings']['rexsearch']['blacklist'])) : ''), array('type' => 'multipleselect', 'id' => 'a587_rexsearch_exclude_article_ids', 'name' => 'a587_rexsearch[exclude_article_ids][]', 'label' => $I18N->Msg('a587_settings_exclude_articles'), 'size' => 15, 'options' => $articles), array('type' => 'multipleselect', 'id' => 'a587_rexsearch_exclude_category_ids', 'name' => 'a587_rexsearch[exclude_category_ids][]', 'label' => $I18N->Msg('a587_settings_exclude_categories'), 'size' => 15, 'options' => $categories)));
$options = array();
$sql_tables = new rex_sql();
foreach ($sql_tables->showTables() as $table) {
    if (false === strpos($table, '587_search') and false === strpos($table, '587_keywords')) {
        $sql_columns = new rex_sql();
        foreach ($sql_tables->showColumns($table) as $column) {
            /*switch(strtolower(substr($column['type'],0,4)))
              {
                case 'text':
                case 'char':
                case 'varc':*/
            $options[] = array('value' => htmlspecialchars($table . '`.`' . $column['name']), 'checked' => in_array($column['name'], (!empty($REX['ADDON']['settings']['rexsearch']['include'][$table]) and is_array($REX['ADDON']['settings']['rexsearch']['include'][$table])) ? $REX['ADDON']['settings']['rexsearch']['include'][$table] : array()), 'name' => $table . '  .  ' . $column['name'], 'id' => $table . '  .  ' . $column['name']);
            //}
        }
    }
}
echo a587_getSettingsFormSection('a587_include', $I18N->Msg('a587_settings_include'), array(array('type' => 'multiplecheckboxes', 'id' => 'a587_rexsearch_include', 'name' => 'a587_rexsearch[include][]', 'label' => '', 'size' => 20, 'options' => $options)));
$options = array(array('value' => '', 'name' => '', 'selected' => false, 'id' => 'a587_optiondummy'));
开发者ID:olien,项目名称:rexsearch,代码行数:31,代码来源:settings.inc.php


注:本文中的rex_sql::showTables方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。