function _formatRexMedia($value, $format)
 {
     if (!is_array($format)) {
         $format = array();
     }
     $params = $format['params'];
     // Resize aktivieren, falls nicht anders übergeben
     if (empty($params['resize'])) {
         $params['resize'] = true;
     }
     $media = OOMedia::getMediaByName($value);
     // Bilder als Thumbnail
     if ($media->isImage()) {
         $value = $media->toImage($params);
     } else {
         $value = $media->toIcon();
     }
     return $value;
 }
Пример #2
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 matchMedia(&$sql, $content)
 {
     $vars = array('REX_FILE', 'REX_MEDIA');
     foreach ($vars as $var) {
         $matches = $this->getVarParams($content, $var);
         foreach ($matches as $match) {
             list($param_str, $args) = $match;
             list($id, $args) = $this->extractArg('id', $args, 0);
             if ($id > 0 && $id < 11) {
                 // Mimetype ausgeben
                 if (isset($args['mimetype'])) {
                     $OOM = OOMedia::getMediaByName($this->getValue($sql, 'file' . $id));
                     if ($OOM) {
                         $replace = $OOM->getType();
                     }
                 } else {
                     $replace = $this->getValue($sql, 'file' . $id);
                 }
                 $replace = $this->handleGlobalVarParams($var, $args, $replace);
                 $content = str_replace($var . '[' . $param_str . ']', $replace, $content);
             }
         }
     }
     return $content;
 }
 function execute()
 {
     if (!$this->image->isImage()) {
         return false;
     }
     $gdimage =& $this->image->getImage();
     $w = $this->image->getWidth();
     $h = $this->image->getHeight();
     $filename = $this->image->getFileName();
     if ($im_image = OOMedia::getMediaByName($filename)) {
         $focuspoint_data = explode(",", $im_image->getValue('med_focuspoint_data'), 2);
         if (count($focuspoint_data) == 2) {
             // Mittelpunkt finden
             $x = ceil($w / 2);
             $y = ceil($h / 2);
             // focusoffsets einarbeiten
             $fp_w = $focuspoint_data[0];
             $fp_h = $focuspoint_data[1];
             // Neuen Mittelpunkt finden
             $nx = $x + ceil($x * $fp_w);
             $ny = $y - ceil($y * $fp_h);
             // Abstand zum Rand herausfinden
             $nw = $w - $nx;
             // 1/2 Breite
             if ($fp_w < 0) {
                 $nw = $nx;
                 // 1/2 Breite
             }
             $nh = $ny;
             // 1/2 Breite
             if ($fp_h < 0) {
                 $nh = $h - $ny;
                 // 1/2 Breite
             }
             $npx = $nx - $nw;
             $npy = $ny - $nh;
             $nw = $nw * 2;
             $nh = $nh * 2;
             if (function_exists('ImageCreateTrueColor')) {
                 $des = @ImageCreateTrueColor($nw, $nh);
             } else {
                 $des = @ImageCreate($nw, $nh);
             }
             $this->keepTransparent($des);
             imagecopyresampled($des, $gdimage, 0, 0, $npx, $npy, $nw, $nh, $nw, $nh);
             $gdimage = $des;
             $this->image->refreshDimensions();
             $w = $nw;
             $h = $nh;
         }
     }
     if (!isset($this->params['style']) || !in_array($this->params['style'], $this->options)) {
         $this->params['style'] = 'maximum';
     }
     // relatives resizen
     if (substr(trim($this->params['width']), -1) === '%') {
         $this->params['width'] = round($w * (rtrim($this->params['width'], '%') / 100));
     }
     if (substr(trim($this->params['height']), -1) === '%') {
         $this->params['height'] = round($h * (rtrim($this->params['height'], '%') / 100));
     }
     if ($this->params['style'] == 'maximum') {
         $this->resizeMax($w, $h);
     } elseif ($this->params['style'] == 'minimum') {
         $this->resizeMin($w, $h);
     } else {
         // warp => nichts tun
     }
     // ----- not enlarge image
     if ($w <= $this->params['width'] && $h <= $this->params['height'] && $this->params['allow_enlarge'] == 'not_enlarge') {
         $this->params['width'] = $w;
         $this->params['height'] = $h;
         $this->keepTransparent($gdimage);
         return;
     }
     if (!isset($this->params['width'])) {
         $this->params['width'] = $w;
     }
     if (!isset($this->params['height'])) {
         $this->params['height'] = $h;
     }
     if (function_exists('ImageCreateTrueColor')) {
         $des = @ImageCreateTrueColor($this->params['width'], $this->params['height']);
     } else {
         $des = @ImageCreate($this->params['width'], $this->params['height']);
     }
     if (!$des) {
         return;
     }
     $this->keepTransparent($des);
     imagecopyresampled($des, $gdimage, 0, 0, 0, 0, $this->params['width'], $this->params['height'], $w, $h);
     $gdimage = $des;
     $this->image->refreshDimensions();
 }
Пример #5
0
<?php

if ('REX_MEDIA[1]') {
    $bild = OOMedia::getMediaByName('REX_MEDIA[1]');
    $bildTitle = $bild->getTitle();
    $bildDateiName = $bild->getFileName();
    $bildBreite = $bild->getWidth();
    $bildHoehe = $bild->getHeight();
    $focuspoint_css = $bild->getValue('med_focuspoint_css');
    $focuspoint_data = explode(",", $bild->getValue('med_focuspoint_data'), 2);
    if (count($focuspoint_data) == 2) {
        echo '
        <div class="focuspoint"
          data-focus-x="' . $focuspoint_data[0] . '"
          data-focus-y="' . $focuspoint_data[1] . '"
          data-image-w="' . $bildBreite . '"
          data-image-h="' . $bildHoehe . '">
          <img src="/files/' . $bildDateiName . '" alt="' . htmlspecialchars($bildTitle) . '" />
        </div>
        ';
    } else {
        echo '<img src="/files/' . $bildDateiName . '" alt="' . htmlspecialchars($bildTitle) . '" />';
    }
}
Пример #6
0
         if ($kurs->url != "") {
             $article = OOArticle::getArticleById($kurs->url, $REX['CUR_CLANG']);
             print '<a href="' . rex_getUrl($kurs->url) . '">' . $article->getName() . '</a><br>';
         }
         if ($kurs->url_extern != "") {
             print '<a href="' . $kurs->url_extern . '" target="_blank">' . $kurs->url_extern . '</a><br>';
         }
         print '</b></div>';
         print '</div>';
     }
     if (count($kurs->dokumente) > 0) {
         print '<div class="col-xs-12 kurs_row" data-height-watch>';
         print '<div class="kurs_box abstand-box"><b>Downloads:</b> ';
         print '<ul>';
         foreach ($kurs->dokumente as $dokument) {
             $ooDokument = OOMedia::getMediaByName($dokument);
             $titel = $ooDokument->getTitle();
             if ($titel == "") {
                 $titel = $dokument;
             }
             print '<li><a href="' . seo42::getMediaFile($dokument) . '" target="_blank">' . $titel . '</a></li>';
         }
         print '</ul>';
         print '</div>';
         print '</div>';
     }
 }
 if ($kurs->anmeldung_moeglich == "ja" || $kurs->anmeldung_moeglich == "ausgebucht") {
     print '</div>';
     print '<div class="row">';
     print '<div class="col-xs-12 col-sm-6 kurs_row" data-height-watch>';