function execute()
 {
     $text = "";
     if (isset($this->action["elements"][2])) {
         $text .= $this->action["elements"][2];
     }
     if ($text == "") {
         $text = $this->params["answertext"];
     }
     if (isset($this->action["elements"][5]) && $this->action["elements"][5] == "0") {
         $text = nl2br(htmlspecialchars($text));
     }
     if (isset($this->action["elements"][5]) && $this->action["elements"][5] == "2") {
         $text = htmlspecialchars_decode($text);
         $text = str_replace('<br />', '', $text);
         $text = str_replace('&#039;', '\'', $text);
         $text = rex_a79_textile($text);
     }
     if (isset($this->action["elements"][3])) {
         $text = $this->action["elements"][3] . $text;
     }
     if (isset($this->action["elements"][4])) {
         $text .= $this->action["elements"][4];
     }
     foreach ($this->elements_email as $search => $replace) {
         $text = str_replace('###' . $search . '###', $replace, $text);
     }
     $this->params["output"] = $text;
 }
/**
 * Textile Addon
 *
 * @author markus[dot]staab[at]redaxo[dot]de Markus Staab
 * 
 * @package redaxo4
 * @version $Id: function_help.inc.php,v 1.5 2008/03/11 16:04:40 kills Exp $
 */
function rex_a79_help_overview()
{
    global $REX_USER, $I18N_A79;
    // check perms
    if (!$REX_USER->hasPerm('textile[help]')) {
        return;
    }
    $formats = rex_a79_help_overview_formats();
    echo '<div class="a79_help_overview">
          <h3 class="a79">' . $I18N_A79->msg('instructions') . '</h3>
          <table style="width: 100%">
            <colgroup>
              <col width="50%" />
              <col width="50%" />
            </colgroup>
        ';
    foreach ($formats as $format) {
        $label = $format[0];
        $id = preg_replace('/[^a-zA-z0-9]/', '', htmlentities($label));
        echo '
            <thead>
              <tr>
                <th colspan="3"><a href="#" onclick="toggleElement(\'' . $id . '\'); return false;">' . htmlspecialchars($label) . '</a></th>
              </tr>
            </thead>

            <tbody id="' . $id . '" style="display: none">
              <tr>
                <th>' . $I18N_A79->msg('input') . '</th>
                <th>' . $I18N_A79->msg('preview') . '</th>
              </tr>
           ';
        foreach ($format[1] as $perm => $formats) {
            foreach ($formats as $_format) {
                $desc = $_format[0];
                $code = '';
                if (isset($_format[1])) {
                    $code = $_format[1];
                }
                if ($code == '') {
                    $code = $desc;
                }
                $code = trim(rex_a79_textile($code));
                echo '<tr>
                <td>' . nl2br(htmlspecialchars($desc)) . '</td>
                <td>' . $code . '</td>
              </tr>
              ';
            }
        }
        echo '</tbody>';
    }
    echo '</table>';
    echo '</div>';
}
/**
 * Textile Addon
 *  
 * @author staab[at]public-4u[dot]de Markus Staab
 * @author <a href="http://www.public-4u.de">www.public-4u.de</a>
 * @package redaxo4
 * @version $Id: function_help.inc.php,v 1.4 2007/10/13 13:52:01 kills Exp $
 */
function rex_a79_help_overview()
{
    global $REX_USER;
    // check perms
    if (!$REX_USER->hasPerm('textile[help]')) {
        return;
    }
    $formats = rex_a79_help_overview_formats();
    echo '<div class="a79_help_overview">';
    echo '<h3 class="a79">Anleitung/Hinweise</h3>';
    echo '<table style="width: 100%">';
    foreach ($formats as $format) {
        $label = $format[0];
        $id = preg_replace('/[^a-zA-z0-9]/', '', htmlentities($label));
        echo '
          <thead>  
            <tr>  
              <th colspan="3"><a href="#" onclick="return toggleElement(\'' . $id . '\');">' . $label . '</a></th>  
            </tr>  
          </thead>
         ';
        echo '<tbody id="' . $id . '" style="display: none">  
            <tr>  
              <th>Ausgabe</th>  
              <th>Eingabe</th>  
              <th>HTML-Code</th>  
            </tr>
           ';
        foreach ($format[1] as $perm => $formats) {
            foreach ($formats as $_format) {
                $desc = $_format[0];
                $code = '';
                if (isset($_format[1])) {
                    $code = $_format[1];
                }
                if ($code == '') {
                    $code = $desc;
                }
                $code = trim(rex_a79_textile($code));
                echo '<tr>  
                <td>' . $code . '</td>  
                <td>' . nl2br(htmlspecialchars($desc)) . '</td>  
                <td>' . htmlspecialchars($code) . '</td>  
              </tr>
              ';
            }
        }
        echo '</tbody>';
    }
    echo '</table>';
    echo '</div>';
}
Example #4
0
 protected function textile($string)
 {
     if (OOAddon::isAvailable("textile")) {
         if ($string != "") {
             $string = str_replace("\t", "", $string);
             $string = htmlspecialchars_decode($string);
             $string = str_replace("<br />", "", $string);
             return rex_a79_textile($string);
         }
     } else {
         return $string;
     }
 }
Example #5
0
function a587_getPlaintext($_text, $_remove)
{
    global $REX;
    foreach (explode(',', $REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['order']) as $elem) {
        switch ($elem) {
            case 'selectors':
                // remove elements selected by css-selectors
                $html = new simple_html_dom();
                $html->load($_text);
                $html->remove($_remove);
                $html->load($html->outertext);
                $_text = $html->plaintext;
                break;
            case 'regex':
                // regex
                if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['regex'])) {
                    $regex = array();
                    $replacement = array();
                    $odd = true;
                    foreach (explode("\n", $REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['regex']) as $line) {
                        if ($line != '') {
                            if ($odd) {
                                $regex[] = trim($line);
                            } else {
                                $replacement[] = $line;
                            }
                            $odd = !$odd;
                        }
                    }
                    $_text = preg_replace($regex, $replacement, $_text);
                }
                break;
            case 'textile':
                // strip HTML-tags
                if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['textile']) and function_exists('rex_a79_textile')) {
                    $_text = rex_a79_textile($_text);
                }
                break;
            case 'striptags':
                // strip HTML-tags
                if (!empty($REX['ADDON']['rexsearch_plugins']['rexsearch']['plaintext']['settings']['striptags'])) {
                    $_text = strip_tags($_text);
                }
                break;
        }
    }
    return $_text;
}
 function executeAction()
 {
     $text = $this->getElement(2);
     if ($text == '') {
         $text = $this->params['answertext'];
     }
     $text = rex_translate($text, null, false);
     if ($this->getElement(5) == '0') {
         $text = nl2br(htmlspecialchars($text));
     }
     if ($this->getElement(5) == '2') {
         $text = htmlspecialchars_decode($text);
         $text = str_replace('<br />', '', $text);
         $text = str_replace('&#039;', '\'', $text);
         $text = rex_a79_textile($text);
     }
     $text = $this->getElement(3) . $text . $this->getElement(4);
     foreach ($this->params['value_pool']['email'] as $search => $replace) {
         $text = str_replace('###' . $search . '###', $replace, $text);
     }
     $this->params['output'] = $text;
 }
Example #7
0
    function showList($eingeloggt = FALSE, $msg = "", $returnUrl = false)
    {
        $I18N_NEWS_DB = new i18n(REX_LANG, REX_INCLUDE_PATH . '/addons/' . MY_PAGE . '/lang');
        if (!empty($msg)) {
            print "<div class=\"msg\">{$msg}</div>\n";
        }
        $conf['max'] = $this->num == "" ? $conf['max'] = 10 : $this->num;
        $conf['page'] = $_GET['page'] ? $_GET['page'] : 1;
        if ($this->pagination == 0) {
            $conf['page'] = 1;
        }
        $conf['page'] = (int) $conf['page'];
        if ($this->archive == "" or $this->archive == "0") {
            $addWhere = 'WHERE (
                    ((offline_date = "0000-00-00") OR (REPLACE(offline_date, "-", "") > CURDATE() + 0))
                    AND
                    ((archive_date = "0000-00-00") OR REPLACE(archive_date, "-", "") > CURDATE() + 0)
                    AND 
                    ((online_date = "0000-00-00") OR REPLACE(online_date, "-", "") <= CURDATE() + 0)
            )';
        } elseif ($this->archive == "1") {
            $addWhere = 'WHERE (
                    (
                        (offline_date != "0000-00-00") AND (REPLACE(offline_date, "-", "") > CURDATE() + 0)
                        OR (offline_date = "0000-00-00")
                    )
                    AND
                    ((archive_date != "0000-00-00") AND REPLACE(archive_date, "-", "") <= CURDATE() + 0)
                    AND 
                    ((online_date = "0000-00-00") OR REPLACE(online_date, "-", "") <= CURDATE() + 0)
             )';
        } else {
            $addWhere = 'WHERE (
                    ((offline_date = "0000-00-00") OR (REPLACE(offline_date, "-", "") > CURDATE() + 0))
                    AND
                    ((online_date = "0000-00-00") OR REPLACE(online_date, "-", "") <= CURDATE() + 0)
            )';
        }
        $_cat = $_GET['cat'];
        if (isset($_cat)) {
            $addSQL = 'AND category LIKE "%|' . $_cat . '|%" ';
        }
        if ($this->category > 0 and $this->category != 999) {
            $addSQL = 'AND category LIKE "%|' . $this->category . '|%" ';
        }
        if ($this->active == 0) {
            $addSQL .= 'AND status = "0" ';
        }
        if ($this->active == 1) {
            $addSQL .= 'AND status = "1" ';
        }
        if ($this->language != "") {
            $addSQL .= 'AND clang = ' . $this->language;
        }
        if ($this->view == 1) {
            $addSQL .= ' AND flag = 1';
        } else {
            if ($this->view == 2) {
                $addSQL .= ' AND flag = 0';
            }
        }
        // 21.04.2013: StickyNews auf Startseite priorisiert
        $addSticky = $addOrderBy = "";
        if ($this->id == $this->start_article_id) {
            $addSticky = ',
				CASE 
				WHEN REPLACE(stickyUntil, "-", "") > CURDATE() + 0 THEN true
				ELSE false
				END as st		
			';
            $addOrderBy = 'st DESC, ';
        }
        $qry = 'SELECT * ' . $addSticky . '
				FROM ' . TBL_NEWS . ' 
				' . $addWhere . '
				' . $addSQL . '
				ORDER BY ' . $addOrderBy . 'online_date ' . $this->sort;
        if ($result = mysql_query($qry)) {
            $total = mysql_num_rows($result);
        }
        $pnum = round(ceil($total / $conf['max']), $conf['max']);
        $limitStart = ($conf['page'] - 1) * $conf['max'];
        $limitEnd = $conf['max'];
        $qry .= ' LIMIT ' . $limitStart . ',' . $limitEnd;
        $sql = new rex_sql();
        if ($this->debug == 1) {
            $sql->debugsql = true;
        }
        $data = $sql->getArray($qry);
        if ($this->pagination == 1 and $total > $conf['max']) {
            $pager['jumplist'] = self::drawJumplist(rex_getUrl('', '', array("page" => 'SEITENZAHL'), '&amp;'), "&lt;", " ", "&gt;", $conf['page'], $pnum);
        }
        // http://www.redaxo.org/de/forum/addons-f30/news-addon-d-mind-t18730.html
        if (!class_exists('Smarty')) {
            include 'redaxo/include/addons/news/libs/Smarty.class.php';
        }
        $t = new Smarty();
        $t->debugging = false;
        $t->caching = false;
        $t->cache_lifetime = 120;
        $t->config_dir = 'redaxo/include/addons/news/view/configs/';
        $t->compile_dir = 'redaxo/include/addons/news/view/templates_c/';
        $t->cache_dir = 'redaxo/include/addons/news/view/cache/';
        $t->template_dir = 'redaxo/include/addons/news/view/templates/';
        if (is_array($data) && sizeof($data) > 0) {
            $i = 1;
            foreach ($data as $row) {
                // Selbe News ausschliessen, falls in rechter Spalte Liste
                if ($row['id'] == rex_request('newsid')) {
                    continue;
                }
                include "redaxo/include/addons/" . MY_PAGE . "/conf/conf.php";
                if ($this->detailArticle) {
                    if ($REX_NEWS_CONF['rewrite'] == 1) {
                        $url = self::rewriteNewsUrls($row['name'], $row['id']);
                    } else {
                        $url = rex_getUrl($this->detailArticle, $this->language, array('newsid' => $row['id']), '&amp;');
                    }
                }
                $item[$i]['id'] = $row['id'];
                $item[$i]['name'] = $row['name'];
                $item[$i]['url'] = $url;
                $item[$i]['date'] = $this->rex_news_format_date($row['online_date'], $this->language);
                $item[$i]['source'] = $row["source"];
                $teaser = "";
                if ($row['teaser'] != "") {
                    $teaser = $row['teaser'];
                    $item[$i]['teaser'] = $teaser;
                } else {
                    $teaser2 = htmlspecialchars_decode($row["article"]);
                    $teaser2 = str_replace("<br />", "", $teaser);
                    $teaser2 = rex_a79_textile($teaser);
                    $teaser2 = str_replace("###", "&#x20;", $teaser);
                    $teaser2 = strip_tags($teaser);
                    $item[$i]['teaser'] = substr($teaser2, 0, strpos($teaser2, ".", 80) + 1);
                }
                $text = htmlspecialchars_decode($row["article"]);
                $text = str_replace("<br />", "", $text);
                $text = rex_a79_textile($text);
                $text = str_replace("###", "&#x20;", $text);
                $text = strip_tags($text);
                $item[$i]['text'] = $text;
                if ($row["thumb"] != "" and $this->images == true) {
                    // Bildausgabe
                    $images = explode(",", $row["thumb"]);
                    if (file_exists($REX['HTDOCS_PATH'] . 'files/' . $images[0])) {
                        $media = OOMedia::getMediaByName($images[0]);
                        if (is_array($media) and sizeof($media) > 0) {
                            $mediaTitle = $media->getValue('title');
                            $MediaDesc = $media->getValue('med_description');
                        }
                    }
                    $item[$i]['image'] = '<a href="' . $url . '" title="' . $row['name'] . '"><img src="index.php?rex_img_type=' . $REX_NEWS_CONF['image_list_type'] . '&amp;rex_img_file=' . $images[0] . '" title="' . $mediaTitle . '" alt="' . $MediaDesc . '" /></a>';
                }
                $i++;
            }
        }
        $t->assign("pager", $pager);
        $t->assign("data", $item);
        $t->display($this->template);
    }
 function a720_echotextile($msg)
 {
     global $REX;
     if (OOAddon::isAvailable("textile")) {
         if ($msg != '') {
             $msg = str_replace("\t", "", $msg);
             // tabs entfernen
             if (strpos($REX['LANG'], 'utf')) {
                 echo rex_a79_textile($msg);
             } else {
                 echo utf8_decode(rex_a79_textile($msg));
             }
         }
     } else {
         $fallback = rex_warning('WARNUNG: Das <a href="index.php?page=addon">Textile Addon</a> ist nicht aktiviert! Der Text wird ungeparst angezeigt..');
         $fallback .= '<pre>' . $msg . '</pre>';
         echo $fallback;
     }
 }
$REX['ADDON']['version'][$mypage] = '1.0';
$REX['ADDON']['author'][$mypage] = 'Markus Staab';
$REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de';
// redaxo o. redaxo_textile
//$REX['ADDON']['settings'][$mypage]['set'] = 'redaxo';
$REX['ADDON']['settings'][$mypage]['set'] = 'redaxo_textile';
$I18N_A287 = new i18n($REX['LANG'], $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/');
if ($REX['REDAXO']) {
    $markitup = rex_post('markitup_preview', 'string');
    $markitup_textile = rex_post('markitup_textile_preview', 'string');
    if ($markitup != '') {
        echo stripslashes($markitup);
        exit;
    } else {
        if ($markitup_textile != '') {
            if (!OOAddon::isAvailable('textile')) {
                echo 'Dieses Modul benötigt das "textile" Addon!';
            } else {
                require_once $REX['INCLUDE_PATH'] . '/addons/textile/classes/class.textile.inc.php';
                require_once $REX['INCLUDE_PATH'] . '/addons/textile/functions/function_textile.inc.php';
                echo rex_a79_textile(stripslashes($markitup_textile));
            }
            exit;
        } else {
            $path = $REX['HTDOCS_PATH'] . 'files/' . $REX['TEMP_PREFIX'] . '/markitup/';
            $set = $REX['ADDON']['settings'][$mypage]['set'];
            $links = '  <script type="text/javascript" src="' . $path . 'jquery.pack.js"></script>' . "\n" . '  <script type="text/javascript" src="' . $path . 'jquery.markitup.js"></script>' . "\n" . '  <script type="text/javascript" src="' . $path . 'sets/' . $set . '/set.js"></script>' . "\n" . '  <script type="text/javascript">$(document).ready(function(){$(".markitup").markItUp(' . $set . ');})</script>' . "\n" . '  <link rel="stylesheet" type="text/css" href="' . $path . 'skins/markitup/style.css" />' . "\n" . '  <link rel="stylesheet" type="text/css" href="' . $path . 'sets/' . $set . '/style.css" />' . "\n";
            rex_register_extension('PAGE_HEADER', create_function('$params', 'return $params[\'subject\'].\'' . $links . '\';'));
        }
    }
}