Exemplo n.º 1
0
/**
 * Frontendausgabe CMS:tag textarea
 *
 * @Args: int type_container -> id von cms:tag <cms:lay type="container" id="XX" />
 *        int type_number  -> Entspricht der Verdopplungsid eines Containers
 *        int type_typenumber -> Eindeutige Id des Contents
 *        array $type_config -> Attribute und deren Werte des cms:tags
 * @Return String Content
 * @Access public
 */
function type_output_textarea($type_container, $type_number, $type_typenumber, $type_config)
{
    global $sess, $cfg_cms, $cfg_client, $idcatside, $mod_lang, $content, $cms_side;
    global $cms_edittype, $cms_mod, $con_side, $cms_path, $core_bbcode;
    //catch vars and arrays from the tag attributes
    eval(_type_get_dynamic_val_string($type_config));
    // Content aus Array holen
    $mod_content = is_array($content[$type_container][$type_number]) ? $content[$type_container][$type_number]['3'][$type_typenumber]['1'] : '';
    // HTML Tags maskieren falls htmltags=convert
    if ($type_config['htmltags'] == 'convert' || empty($type_config['htmltags']) || $type_config['htmltags'] != 'strip' && $type_config['htmltags'] != 'allow') {
        $mod_content = htmlspecialchars($mod_content, ENT_COMPAT, 'UTF-8');
    }
    // nl2br
    if ($type_config['nl2br'] == 'true' || empty($type_config['nl2br'])) {
        $mod_content = nl2br($mod_content);
    }
    // bbcode
    if ($type_config['transform'] == 'bbcode') {
        include_once $cms_path . 'inc/class.core_bbcode.php';
        if (!is_object($core_bbcode)) {
            $core_bbcode = new core_bbcode();
        }
        $mod_content = $core_bbcode->parse_bbcode($mod_content);
    }
    // alle Tags entfernen
    if ($type_config['htmltags'] == 'strip') {
        // wenn nl2br aktiviert, <br>- tags duerfen nicht gestrippt werden
        if ($type_config['nl2br'] == 'true' || empty($type_config['nl2br'])) {
            $mod_content = str_replace('<br />', '{cms_temp_break}', $mod_content);
            $mod_content = strip_tags($mod_content);
            $mod_content = str_replace('{cms_temp_break}', '<br />', $mod_content);
        } else {
            $mod_content = strip_tags($mod_content);
        }
    }
    // make global edit_all url
    if (_type_check_editall($cms_side, $type_config)) {
        $cms_edittype[$type_container][$type_number][] = '3-' . $type_typenumber;
    }
    // Editiermodus
    if (_type_check_editable($cms_side['edit'], $type_config['editable'], $cms_side['view'], isset($cms_side['edit_all'])) && $type_config['menuoptions'] != 'false') {
        $title = empty($type_config['title']) ? $mod_lang['type_textarea'] : $type_config['title'];
        // advanced Modus
        if ($type_config['menuoptions'] == 'advanced') {
            $new = false;
            $delete = false;
            $up = false;
            $down = false;
            // neu anlegen & loeschen
            if ($type_number != '1' || $mod_content != '') {
                $new = true;
                $delete = true;
            }
            // nach oben verschieben
            if ($type_number != '1') {
                $up = true;
            }
            // nach unten verschieben
            if ($mod_content != '' && $cms_mod['modul']['lastentry'] != 'true') {
                $down = true;
            }
        }
        $ids[] = 3;
        $infos = array('container_number' => $type_container, 'cmstag_id' => $type_typenumber, 'mod_repeat_id' => $type_number, 'title' => $title, 'base_url' => $con_side[$idcatside]['link'], 'mode' => $type_config['menuoptions']);
        //menu erstellen
        $mod = _type_get_layer_menu($ids, $infos, $delete, $new, $up, $down);
        //Wenn nur editbutton gefordert - Ausgabe BACKEND
        if ($type_config['mode'] == 'editbutton') {
            return $mod;
        }
        //Content mit Editbutton erzeugen
        $mod = $mod_content . $mod;
    } else {
        $mod = $mod_content;
    }
    //Frontend: wenn Editbutton
    if ($type_config['mode'] == 'editbutton') {
        return;
    }
    // Style
    $css = _type_get_style($type_config['styleclass'], $type_config['styleid'], $type_config['styledb']);
    $css['type'] = trim($css['type']);
    if (!empty($css['type'])) {
        $mod = '<span ' . $css['fullstyle'] . '>' . $mod . '</span>';
    }
    return $mod;
}
 /**
  * Styled textarea Output
  *
  * Frontendausgabe analog CMS:tag textarea
  *
  * @Args: string mod_content -> Inhalt wie er in der DB vorhanden ist
  *        array  $type_config -> Attribute und deren Werte analog des cms:tags
  * @Return String Content
  * @Access public
  */
 function getTextarea($mod_content, $type_config)
 {
     //catch vars and arrays from the tag attributes
     eval($this->_getDynamicValString($type_config));
     // HTML Tags maskieren falls htmltags=convert
     if ($type_config['htmltags'] == 'convert' || empty($type_config['htmltags']) || $type_config['htmltags'] != 'strip' && $type_config['htmltags'] != 'allow') {
         $mod_content = htmlspecialchars($mod_content, ENT_COMPAT, 'UTF-8');
     }
     // nl2br
     if ($type_config['nl2br'] == 'true' || empty($type_config['nl2br'])) {
         $mod_content = nl2br($mod_content);
     }
     // bbcode
     if ($type_config['transform'] == 'bbcode') {
         include_once $cms_path . 'inc/class.core_bbcode.php';
         if (!is_object($core_bbcode)) {
             $core_bbcode = new core_bbcode();
         }
         $mod_content = $core_bbcode->parse_bbcode($mod_content);
     }
     // alle Tags entfernen
     if ($type_config['htmltags'] == 'strip') {
         // wenn nl2br aktiviert, <br>- tags duerfen nicht gestrippt werden
         if ($type_config['nl2br'] == 'true' || empty($type_config['nl2br'])) {
             $mod_content = str_replace('<br />', '{cms_temp_break}', $mod_content);
             $mod_content = strip_tags($mod_content);
             $mod_content = str_replace('{cms_temp_break}', '<br />', $mod_content);
         } else {
             $mod_content = strip_tags($mod_content);
         }
     }
     $mod = $mod_content;
     // Style
     $css = $this->_getStyle($type_config['styleclass'], $type_config['styleid'], $type_config['styledb']);
     $css['type'] = trim($css['type']);
     if (!empty($css['type'])) {
         $mod = '<span ' . $css['fullstyle'] . '>' . $mod . '</span>';
     }
     return $mod;
 }