Exemple #1
0
function focus_setup_metainfo()
{
    global $REX;
    if (!isset($REX['USER'])) {
        return;
    }
    $install_metas = array('med_focuspoint_data' => array('Focuspoint Data', 'med_focuspoint_data', 200, '', 1, '', '', '', ''), 'med_focuspoint_css' => array('Focuspoint CSS', 'med_focuspoint_css', 201, '', 1, '', '', '', ''));
    $db = new rex_sql();
    foreach ($db->getDbArray('SHOW COLUMNS FROM `rex_file` LIKE \'med_focuspoint_%\';') as $column) {
        unset($install_metas[$column['Field']]);
    }
    foreach ($install_metas as $k => $v) {
        $db->setQuery('SELECT `name` FROM `rex_62_params` WHERE `name`=\'' . $k . '\';');
        if ($db->getRows() > 0) {
            // FIELD KNOWN TO METAINFO BUT MISSING IN ARTICLE..
            $db->setQuery('ALTER TABLE `rex_file` ADD `' . $k . '` TEXT NOT NULL;');
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde repariert.');
            }
        } else {
            if (!function_exists('a62_add_field')) {
                require_once $REX['INCLUDE_PATH'] . '/addons/metainfo/functions/function_metainfo.inc.php';
            }
            a62_add_field($v[0], $v[1], $v[2], $v[3], $v[4], $v[5], $v[6], $v[7], $v[8]);
            if ($REX['REDAXO']) {
                echo rex_info('Metainfo Feld ' . $k . ' wurde angelegt.');
            }
        }
    }
    rex_file::copy(rex_path::addon("focuspoint", "classes/class.rex_effect_focuspoint_resize.inc.php"), rex_path::addon("image_manager", "classes/effects/class.rex_effect_focuspoint_resize.inc.php"));
}
 /**
  * added the metafields
  * @return string
  */
 public static function addFields()
 {
     global $REX;
     $class = '';
     if (OOAddon::isAvailable('tinymce')) {
         $class = 'tinyMCEEditor';
     } elseif (OOAddon::isAvailable('ckeditor')) {
         $class = 'ckeditor';
     }
     return self::checkErrorMessage(a62_add_field('translate:content_category', 'asd_category', 2, '', 3, '', 'SELECT `name`, `id` FROM ' . rex_asd_news_config::getTableCategory()), a62_add_field('translate:asd_news_picture', 'asd_picture', 3, '', 6, ''), a62_add_field('translate:asd_news_text', 'asd_text', 4, 'class=' . $class, 2, ''));
 }
<?php

$myself = 'xmediapool_password';
// add metainfo field
if (OOAddon::isActivated('metainfo')) {
    $sql = rex_sql::factory();
    $fieldInfos = $sql->setQuery('SELECT id FROM ' . $REX['TABLE_PREFIX'] . '62_params WHERE name = med_' . $myself . '_password LIMIT 2');
    if ($sql->getRows() != 1) {
        a62_add_field('Passwort', 'med_' . $myself . '_password', 3, '', REX_A62_FIELD_TEXT, '');
    }
    $REX['ADDON']['install'][$myself] = 1;
} else {
    $REX['ADDON']['installmsg'][$myself] = $I18N->msg('xmediapool_password_install_error_metainfo_not_activated');
    $REX['ADDON']['install'][$myself] = 0;
}