/**
  * GET SITEMAP ARTICLES FROM DB
  *
  * @return (array) sitemap articles
  */
 private function get_db_articles()
 {
     global $REX, $SEO42_URLS;
     if ($REX['ADDON']['seo42']['settings']['rewriter']) {
         // use seo42 pathlist
         array_multisort($SEO42_URLS);
         foreach ($SEO42_URLS as $url) {
             $article = OOArticle::getArticleById($url['id'], $url['clang']);
             if (OOArticle::isValid($article)) {
                 $hasPermission = true;
                 // community addon
                 if (class_exists('rex_com_auth') && !rex_com_auth::checkPerm($article)) {
                     $hasPermission = false;
                 }
                 // add sitemap block
                 if (($article->isOnline() || $article->getId() == $REX['START_ARTICLE_ID'] && $article->getClang() == $REX['START_CLANG_ID']) && !isset($url['status']) && $hasPermission) {
                     $db_articles[$url['id']][$url['clang']] = array('loc' => rex_getUrl($url['id'], $url['clang']), 'lastmod' => date('c', $article->getValue('updatedate')), 'changefreq' => self::calc_article_changefreq($article->getValue('updatedate'), ''), 'priority' => self::calc_article_priority($url['id'], $url['clang'], $article->getValue('path'), ''), 'noindex' => $article->getValue('seo_noindex'));
                 }
             }
         }
     } else {
         // at the moment: no sitemap urls if rewriter is turned off
     }
     // EXTENSIONPOINT SEO42_SITEMAP_ARRAY_CREATED
     $db_articles = rex_register_extension_point('SEO42_SITEMAP_ARRAY_CREATED', $db_articles);
     // EXTENSIONPOINT SEO42_SITEMAP_ARRAY_FINAL (READ ONLY)
     rex_register_extension_point('SEO42_SITEMAP_ARRAY_FINAL', $db_articles);
     $this->db_articles = $db_articles;
 }
 function getBreadcrumb($startPageLabel, $includeCurrent = FALSE, $category_id = 0)
 {
     if (!$this->_setActivePath()) {
         return FALSE;
     }
     global $REX;
     $path = $this->path;
     $i = 1;
     $lis = '';
     if ($startPageLabel) {
         $lis .= '<li class="rex-lvl' . $i . '"><a href="' . rex_getUrl($REX['START_ARTICLE_ID']) . '">' . htmlspecialchars($startPageLabel) . '</a></li>';
         $i++;
         // StartArticle nicht doppelt anzeigen
         if (isset($path[0]) && $path[0] == $REX['START_ARTICLE_ID']) {
             unset($path[0]);
         }
     }
     foreach ($path as $pathItem) {
         if ($cat = OOCategory::getCategoryById($pathItem) && $this->_check($cat, $i)) {
             $lis .= '<li class="rex-lvl' . $i . '"><a href="' . $cat->getUrl() . '">' . htmlspecialchars($cat->getName()) . '</a></li>';
             $i++;
         }
     }
     if ($includeCurrent) {
         if ($art = OOArticle::getArticleById($this->current_article_id) && $this->_check($art, $i)) {
             if (!$art->isStartpage()) {
                 $lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($art->getName()) . '</li>';
             } else {
                 $cat = OOCategory::getCategoryById($this->current_article_id);
                 $lis .= '<li class="rex-lvl' . $i . '">' . htmlspecialchars($cat->getName()) . '</li>';
             }
         }
     }
     return '<ul class="rex-breadcrumb">' . $lis . '</ul>';
 }
function rex_getUrl($id, $clang = "", $params = "")
{
    /*
     * Object Helper Function:
     * Returns a url for linking to this article
     * This url respects the setting for mod_rewrite
     * support!
     *
     * If you pass an associative array for $params,
     * then these parameters will be attached to the URL.
     * e.g.:
     *   $param = array("order" => "123", "name" => "horst");
     *   $article->getUrl($param);
     * will return:
     *   index.php?article_id=1&order=123&name=horst
     * or if mod_rewrite support is activated:
     *   /1-The_Article_Name?order=123&name=horst
     */
    global $REX;
    // ----- definiere sprache
    if ($clang == "") {
        $clang = $REX[CUR_CLANG];
    }
    // ----- get article Name
    $id = $id + 0;
    if ($id == 0) {
        $name = "NoName";
    } else {
        $ooa = OOArticle::getArticleById($id);
        if ($ooa) {
            $name = strtolower($ooa->getName());
        }
        $name = preg_replace("/[^a-zA-Z]/", "", $name);
    }
    // ----- get params
    $param_string = "";
    if (is_array($params)) {
        $first = true;
        foreach ($params as $key => $value) {
            // Nur Wenn MOD_REWRITE aktiv ist, das erste "&amp;" entfernen.
            if ($first && $REX['MOD_REWRITE']) {
                $first = false;
            } else {
                $param_string .= '&amp;';
            }
            $param_string .= $key . '=' . $value;
        }
    } else {
        if ($params != "") {
            $param_string = str_replace('&', '&amp;', $params);
        }
    }
    if ($REX['MOD_REWRITE'] && $param_string != "") {
        $param_string = "?" . $param_string;
    }
    // ----- create url
    $url = $REX['MOD_REWRITE'] ? "{$id}-{$clang}-{$name}.html" : "index.php?article_id={$id}&amp;clang={$clang}";
    return $REX['WWW_PATH'] . "{$url}" . "{$param_string}";
}
/**
 * Erweitert das Meta-Formular um die neuen Meta-Felder
 */
function rex_a62_metainfo_form($params)
{
    $OOArt = OOArticle::getArticleById($params['id'], $params['clang']);
    $params['activeItem'] = $params['article'];
    // Hier die category_id setzen, damit beim klick auf den REX_LINK_BUTTON der Medienpool in der aktuellen Kategorie startet
    $params['activeItem']->setValue('category_id', $OOArt->getCategoryId());
    return $params['subject'] . _rex_a62_metainfo_form('art_', $params, '_rex_a62_metainfo_art_handleSave');
}
function rex_a128_historyHandler($params)
{
    global $page, $subpage, $REX_USER, $REX;
    $mypage = $params['mypage'];
    require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_historyManager.inc.php';
    require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_history.inc.php';
    require $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_historyItem.inc.php';
    $function = rex_request('function', 'string');
    $mode = rex_request('mode', 'string');
    // Alle Histories registrierens
    $articleHistory =& rexHistoryManager::getHistory('articles');
    $templateHistory =& rexHistoryManager::getHistory('templates');
    $moduleHistory =& rexHistoryManager::getHistory('modules');
    $actionHistory =& rexHistoryManager::getHistory('actions');
    $sql = new rex_sql();
    $sql->debugsql = true;
    if ($page == 'module' && $function == 'edit' && ($module_id = rex_get('modul_id', 'int')) != 0) {
        $result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'modultyp WHERE id=' . $module_id);
        if (isset($result[0])) {
            $link = 'index.php?page=' . $page . '&function=' . $function . '&modul_id=' . $module_id;
            $title = $result[0]['name'];
            if ($REX_USER->hasPerm('advancedMode[]')) {
                $title .= ' [' . $module_id . ']';
            }
            $moduleHistory->addItem(new rexHistoryItem($title, $link));
        }
    } elseif ($page == 'module' && $subpage == 'actions' && $function == 'edit' && ($action_id = rex_get('action_id', 'int')) != 0) {
        $result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'action WHERE id=' . $action_id);
        if (isset($result[0])) {
            $link = 'index.php?page=' . $page . '&subpage=' . $subpage . '&function=' . $function . '&modul_id=' . $action_id;
            $title = $result[0]['name'];
            if ($REX_USER->hasPerm('advancedMode[]')) {
                $title .= ' [' . $action_id . ']';
            }
            $actionHistory->addItem(new rexHistoryItem($title, $link));
        }
    } elseif ($page == 'template' && $function == 'edit' && ($template_id = rex_get('template_id', 'int')) != 0) {
        $result = $sql->getArray('SELECT name FROM ' . $REX['TABLE_PREFIX'] . 'template WHERE id=' . $template_id);
        if (isset($result[0])) {
            $link = 'index.php?page=' . $page . '&function=' . $function . '&template_id=' . $template_id;
            $title = $result[0]['name'];
            if ($REX_USER->hasPerm('advancedMode[]')) {
                $title .= ' [' . $template_id . ']';
            }
            $templateHistory->addItem(new rexHistoryItem($title, $link));
        }
    } elseif ($page == 'content' && $mode == 'edit' && ($article_id = rex_get('article_id', 'int')) != 0) {
        $art = OOArticle::getArticleById($article_id);
        if (OOArticle::isValid($art)) {
            $link = 'index.php?page=' . $page . '&mode=' . $mode . '&article_id=' . $article_id;
            $title = $art->getName();
            if ($REX_USER->hasPerm('advancedMode[]')) {
                $title .= ' [' . $article_id . ']';
            }
            $articleHistory->addItem(new rexHistoryItem($title, $link));
        }
    }
}
    function matchArticle($content, $replaceInTemplate = false)
    {
        global $REX;
        $var = 'REX_ARTICLE';
        $matches = $this->getVarParams($content, $var);
        foreach ($matches as $match) {
            list($param_str, $args) = $match;
            list($article_id, $args) = $this->extractArg('id', $args, 0);
            list($clang, $args) = $this->extractArg('clang', $args, '$REX[\'CUR_CLANG\']');
            list($ctype, $args) = $this->extractArg('ctype', $args, -1);
            list($field, $args) = $this->extractArg('field', $args, '');
            $tpl = '';
            if ($article_id == 0) {
                // REX_ARTICLE[field=name] keine id -> feld von aktuellem artikel verwenden
                if ($field) {
                    if (OOArticle::hasValue($field)) {
                        $tpl = '<?php echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, '$this->getValue(\'' . addslashes($field) . '\')') . '); ?>';
                    }
                } else {
                    if ($replaceInTemplate) {
                        // aktueller Artikel darf nur in Templates, nicht in Modulen eingebunden werden
                        // => endlossschleife
                        $tpl = '<?php echo ' . $this->handleGlobalVarParamsSerialized($var, $args, '$this->getArticle(' . $ctype . ')') . '; ?>';
                    }
                }
            } else {
                if ($article_id > 0) {
                    // REX_ARTICLE[field=name id=5] feld von gegebene artikel id verwenden
                    if ($field) {
                        if (OOArticle::hasValue($field)) {
                            // bezeichner wählen, der keine variablen
                            // aus modulen/templates überschreibt
                            $varname = '$__rex_art';
                            $tpl = '<?php
	          ' . $varname . ' = OOArticle::getArticleById(' . $article_id . ', ' . $clang . ');
	          if(' . $varname . ') echo htmlspecialchars(' . $this->handleGlobalVarParamsSerialized($var, $args, $varname . '->getValue(\'' . addslashes($field) . '\')') . ');
	          ?>';
                        }
                    } else {
                        // bezeichner wählen, der keine variablen
                        // aus modulen/templates überschreibt
                        $varname = '$__rex_art';
                        $tpl = '<?php
	        ' . $varname . ' = new rex_article();
	        ' . $varname . '->setArticleId(' . $article_id . ');
	        ' . $varname . '->setClang(' . $clang . ');
          echo ' . $this->handleGlobalVarParamsSerialized($var, $args, $varname . '->getArticle(' . $ctype . ')') . ';
	        ?>';
                    }
                }
            }
            if ($tpl != '') {
                $content = str_replace($var . '[' . $param_str . ']', $tpl, $content);
            }
        }
        return $content;
    }
 function getArticleName()
 {
     $article_id = $this->getValue();
     $article_name = '';
     if ($article_id != '' && $article_id != 0) {
         $ooa = OOArticle::getArticleById($article_id);
         if ($ooa !== null) {
             $article_name = $ooa->getName();
         }
     }
     return $article_name;
 }
 /**
  * Wert für die Ausgabe
  */
 function matchArticleVar($content)
 {
     global $article_id, $clang;
     $var = 'REX_ARTICLE_VAR';
     $matches = $this->getArticleVarInputParams($content, $var);
     $article = OOArticle::getArticleById($article_id, $clang);
     foreach ($matches as $match) {
         list($param_str) = $match;
         $content = str_replace($var . '[' . $param_str . ']', $article->getValue($param_str), $content);
     }
     return $content;
 }
 public static function control()
 {
     global $REX;
     $myself = 'url_control';
     $addon = $REX['ADDON'][$myself]['addon'];
     $rewriter = $REX['ADDON'][$myself]['rewriter'];
     // http://www.domain.de/kategorie/artikel.html
     $url_full = parent::getFullRequestedUrl();
     $parse = parse_url($url_full);
     $url_path = $parse['path'];
     $sql = rex_sql::factory();
     //$sql->debugsql = true;
     $sql->setQuery('SELECT  *
                     FROM    ' . $REX['TABLE_PREFIX'] . 'url_control_manager
                     WHERE   status = "1"
                         AND (
                             url = "' . mysql_real_escape_string($url_full) . '"
                             OR
                             url = "' . mysql_real_escape_string($url_path) . '"
                         )
                 ');
     if ($sql->getRows() == 1) {
         $method = $sql->getValue('method');
         $params = unserialize($sql->getValue('method_parameters'));
         switch ($method) {
             case 'article':
                 $article_id = (int) $params['article']['article_id'];
                 $clang = (int) $params['article']['clang'];
                 if ($params['article']['action'] == 'view') {
                     return array('article_id' => $article_id, 'clang' => $clang);
                 } elseif ($params['article']['action'] == 'redirect') {
                     $a = OOArticle::getArticleById((int) $params['article']['article_id'], (int) $params['article']['clang']);
                     if ($a instanceof OOArticle) {
                         if (isset($rewriter[$addon]['get_url'])) {
                             $func = $rewriter[$addon]['get_url'];
                             $url = call_user_func($func, $article_id, $clang);
                         } else {
                             $url = $a->getUrl();
                         }
                     }
                     //$url = rex_getUrl((int) $params['article']['article_id'], (int) $params['article']['clang']);
                     self::redirect($a->getUrl(), $params['http_type']['code']);
                 }
                 break;
             case 'target_url':
                 $url = $params['target_url']['url'];
                 self::redirect($url, $params['http_type']['code']);
                 break;
         }
     }
     return false;
 }
示例#10
0
function rex_linkmap_format_label($OOobject)
{
    global $REX_USER, $I18N;
    $label = $OOobject->getName();
    if (trim($label) == '') {
        $label = '&nbsp;';
    }
    if ($REX_USER->hasPerm('advancedMode[]')) {
        $label .= ' [' . $OOobject->getId() . ']';
    }
    if (OOArticle::isValid($OOobject) && !$OOobject->hasTemplate()) {
        $label .= ' [' . $I18N->msg('lmap_has_no_template') . ']';
    }
    return $label;
}
/**
 * Object Helper Function:
 * Returns a url for linking to this article
 * This url respects the setting for mod_rewrite
 * support!
 *
 * If you pass an associative array for $params,
 * then these parameters will be attached to the URL.
 * 
 * 
 * USAGE:
 *   $param = array("order" => "123", "name" => "horst");
 *   $url = $article->getUrl($param);
 * 
 *   - OR -
 *  
 *   $url = $article->getUrl("order=123&name=horst");
 * 
 * RETURNS:
 *   index.php?article_id=1&order=123&name=horst
 * or if mod_rewrite support is activated:
 *   /1-The_Article_Name?order=123&name=horst
 */
function rex_getUrl($id = '', $clang = '', $params = '')
{
    global $REX, $article_id;
    $id = (int) $id;
    $clang = (int) $clang;
    // ----- get id
    if (strlen($id) == 0 || $id == 0) {
        $id = $article_id;
    }
    // ----- get clang
    // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
    // Die rexExtension muss selbst entscheiden was sie damit macht
    if (strlen($clang) == 0 && (count($REX['CLANG']) > 1 || rex_extension_is_registered('URL_REWRITE'))) {
        $clang = $REX['CUR_CLANG'];
    }
    // ----- get params
    $param_string = '';
    if (is_array($params)) {
        foreach ($params as $key => $value) {
            $param_string .= '&amp;' . $key . '=' . $value;
        }
    } elseif ($params != '') {
        $param_string = str_replace('&', '&amp;', $params);
    }
    // ----- get article name
    $id = (int) $id;
    if ($id != 0) {
        $ooa = OOArticle::getArticleById($id, $clang);
        if ($ooa) {
            $name = rex_parseArticleName($ooa->getName());
        }
    }
    if (!isset($name) or $name == '') {
        $name = 'NoName';
    }
    // ----- EXTENSION POINT
    $url = rex_register_extension_point('URL_REWRITE', '', array('id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string));
    if ($url == '') {
        // ----- get rewrite function
        if ($REX['MOD_REWRITE'] === true || $REX['MOD_REWRITE'] == 'true') {
            $rewrite_fn = 'rexrewrite_apache_rewrite';
        } else {
            $rewrite_fn = 'rexrewrite_no_rewrite';
        }
        $url = call_user_func($rewrite_fn, $id, $name, $clang, $param_string);
    }
    return $url;
}
    function enterObject(&$email_elements, &$sql_elements, &$warning, &$form_output, $send = 0)
    {
        global $REX;
        if (!isset($REX["xform_classes_be_link"])) {
            $REX["xform_classes_be_link"] = 0;
        }
        $REX["xform_classes_be_link"]++;
        $i = $REX["xform_classes_be_link"];
        if ($this->value == "" && !$send) {
            if (isset($this->elements[3])) {
                $this->value = $this->elements[3];
            }
        }
        $wc = "";
        if (isset($warning[$this->getId()])) {
            $wc = $warning[$this->getId()];
        }
        $linkname = "";
        if ($this->getValue() != "" && ($a = OOArticle::getArticleById($this->getValue()))) {
            $linkname = $a->getName();
        }
        $form_output[] = '
      
    <div class="xform-element formbe_mediapool formlabel-' . $this->getName() . '">
        <label class="text ' . $wc . '" for="el_' . $this->getId() . '" >' . $this->elements[2] . '</label>
    <div class="rex-widget">
    <div class="rex-widget-link">
      <p class="rex-widget-field">
        <input type="hidden" name="FORM[' . $this->params["form_name"] . '][el_' . $this->id . ']" id="LINK_' . $i . '" value="' . $this->getValue() . '" />
        <input type="text" size="30" name="LINK_' . $i . '_NAME" value="' . htmlspecialchars($linkname) . '" id="LINK_' . $i . '_NAME" readonly="readonly" />
      </p>

       <p class="rex-widget-icons rex-widget-1col">
        <span class="rex-widget-column rex-widget-column-first">
          <a href="#" class="rex-icon-file-open" onclick="openLinkMap(\'LINK_' . $i . '\', \'&clang=0&category_id=1\');return false;" title="Link auswŠhlen" tabindex="21"></a>
          <a href="#" class="rex-icon-file-delete" onclick="deleteREXLink(' . $i . ');return false;" title="AusgewŠhlten Link lšschen" tabindex="22"></a>
        </span>
      </p>
    </div>
    </div>
    <div class="rex-clearer"></div>
    </div>
  ';
        $email_elements[$this->elements[1]] = stripslashes($this->value);
        if (!isset($this->elements[4]) || $this->elements[4] != "no_db") {
            $sql_elements[$this->elements[1]] = $this->value;
        }
    }
 public static function getTypeValuesHTML()
 {
     global $REX;
     $return = [];
     /**
      * prepare Opengraph from MetaInfo TypeValues
      */
     if (self::$curArticle->getValue('art_open_graph_typevalues')) {
         $typeValues = explode("\n", self::$curArticle->getValue('art_open_graph_typevalues'));
         foreach ($typeValues as $typeValue) {
             $typeValue = explode('|', $typeValue);
             $return[] = '<meta property="' . trim($typeValue[0]) . '" content="' . trim($typeValue[1]) . '">';
         }
     }
     return implode("\n\t", $return) . "\n\t";
 }
 function enterObject()
 {
     static $counter = 0;
     $counter++;
     if ($this->getValue() == '' && !$this->params['send']) {
         $this->setValue($this->getElement(3));
     }
     $linkName = '';
     if ($this->getValue() != '' && ($a = OOArticle::getArticleById($this->getValue()))) {
         $linkName = $a->getName();
     }
     $this->params['form_output'][$this->getId()] = $this->parse('value.be_link.tpl.php', compact('counter', 'linkName'));
     $this->params['value_pool']['email'][$this->getName()] = stripslashes($this->getValue());
     if ($this->getElement(4) != 'no_db') {
         $this->params['value_pool']['sql'][$this->getName()] = $this->getValue();
     }
 }
function navi()
{
    echo "<ul>";
    // start HTML-List
    $max_depth = 3;
    // max nesting-depth root is depth=0
    $inc_art = true;
    // include articles
    $inc_root_art = false;
    // include root articles
    $inc_start_art = false;
    // include start article
    $config = array($max_depth, $inc_art, $inc_start_art, $inc_root_art);
    // config array
    $items = [];
    // wrapper for subitem sizes
    $count = 0;
    // items per nesting level
    foreach (OOCategory::getRootCategories() as $item) {
        if (!$item->isOnline()) {
            continue;
        }
        $count++;
        // initalize each root-item
        // print root-item
        echo '<li><a href="' . $item->getUrl() . '" title="' . $item->getName() . '">' . $item->getName() . '</a></li>';
        $d = 0;
        // set nesting-depth for root-item
        getSubItems($item, $d, $config);
        $d = 0;
        // REset nesting-depth for root-item
    }
    // get Root Articles
    if (sizeof(OOArticle::getRootArticles()) >= 1 && $config[3]) {
        foreach (OOArticle::getRootArticles() as $art) {
            if (!$art->isOnline()) {
                continue;
            }
            echo '<li><a href="' . $art->getUrl() . '" title="' . $art->getName() . '">' . $art->getName() . '</a></li>';
        }
    }
    echo "</ul>";
}
 function setArticleId($article_id)
 {
     // bc
     if ($this->viasql) {
         return parent::setArticleId($article_id);
     }
     global $REX;
     $article_id = (int) $article_id;
     $this->article_id = $article_id;
     $OOArticle = OOArticle::getArticleById($article_id, $this->clang);
     if (OOArticle::isValid($OOArticle)) {
         $this->category_id = $OOArticle->getCategoryId();
         $this->template_id = $OOArticle->getTemplateId();
         return TRUE;
     }
     $this->article_id = 0;
     $this->template_id = 0;
     $this->category_id = 0;
     return FALSE;
 }
 function url_generate_column_article($params)
 {
     global $I18N;
     $list = $params['list'];
     $return = '';
     $a = OOArticle::getArticleById($list->getValue("article_id"), $list->getValue("clang"));
     if ($a instanceof OOArticle) {
         $return = $a->getName();
         $return .= ' [';
         $return .= '<a href="index.php?article_id=' . $list->getValue('article_id') . '&amp;clang=' . $list->getValue('clang') . '">Backend</a>';
         $return .= ' | ';
         $return .= '<a href="' . rex_getUrl($list->getValue('article_id'), $list->getValue('clang')) . '">Frontend</a>';
         $return .= ']';
         $tree = $a->getParentTree();
         $levels = array();
         foreach ($tree as $object) {
             $levels[] = $object->getName();
         }
         $return .= '<div class="url-control-path"><small><b>Pfad: </b>' . implode(' : ', $levels) . '</small></div>';
     }
     return $return;
 }
/**
 * Gibt eine Url zu einem Artikel zurück
 *
 * @param [$_id] ArtikelId des Artikels
 * @param [$_clang] SprachId des Artikels
 * @param [$_params] Array von Parametern
 * @param [$_divider] Trennzeichen für Parameter
 * (z.B. &amp; für HTML, & für Javascript)
 */
function rex_getUrl($_id = '', $_clang = '', $_params = '', $_divider = '&amp;')
{
    global $REX, $article_id;
    $id = (int) $_id;
    $clang = (int) $_clang;
    // ----- get id
    if ($id == 0) {
        $id = $article_id;
    }
    // ----- get clang
    // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
    // Die rexExtension muss selbst entscheiden was sie damit macht
    if ($_clang === '' && (count($REX['CLANG']) > 1 || rex_extension_is_registered('URL_REWRITE'))) {
        $clang = $REX['CUR_CLANG'];
    }
    // ----- get params
    $param_string = rex_param_string($_params, $_divider);
    if ($id != 0) {
        $ooa = OOArticle::getArticleById($id, $clang);
        if ($ooa) {
            $name = rex_parse_article_name($ooa->getName());
        }
    }
    if (!isset($name) or $name == '') {
        $name = 'NoName';
    }
    // ----- EXTENSION POINT
    $url = rex_register_extension_point('URL_REWRITE', '', array('id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string, 'divider' => $_divider));
    if ($url == '') {
        // ----- get rewrite function
        if ($REX['MOD_REWRITE'] === true || $REX['MOD_REWRITE'] == 'true') {
            $rewrite_fn = 'rex_apache_rewrite';
        } else {
            $rewrite_fn = 'rex_no_rewrite';
        }
        $url = call_user_func($rewrite_fn, $id, $name, $clang, $param_string, $_divider);
    }
    return $url;
}
    } else {
        $warning = $action->getErrro();
    }
}
// ---------------------------- FUNKTIONEN FÜR MODULE
if ($function == 'delete') {
    $del = rex_sql::factory();
    $del->setQuery("SELECT " . $REX['TABLE_PREFIX'] . "article_slice.article_id, " . $REX['TABLE_PREFIX'] . "article_slice.clang, " . $REX['TABLE_PREFIX'] . "article_slice.ctype, " . $REX['TABLE_PREFIX'] . "module.name FROM " . $REX['TABLE_PREFIX'] . "article_slice\r\n      LEFT JOIN " . $REX['TABLE_PREFIX'] . "module ON " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id=" . $REX['TABLE_PREFIX'] . "module.id\r\n      WHERE " . $REX['TABLE_PREFIX'] . "article_slice.modultyp_id='{$modul_id}' GROUP BY " . $REX['TABLE_PREFIX'] . "article_slice.article_id");
    if ($del->getRows() > 0) {
        $module_in_use_message = '';
        $modulname = htmlspecialchars($del->getValue($REX['TABLE_PREFIX'] . "module.name"));
        for ($i = 0; $i < $del->getRows(); $i++) {
            $aid = $del->getValue($REX['TABLE_PREFIX'] . "article_slice.article_id");
            $clang_id = $del->getValue($REX['TABLE_PREFIX'] . "article_slice.clang");
            $ctype = $del->getValue($REX['TABLE_PREFIX'] . "article_slice.ctype");
            $OOArt = OOArticle::getArticleById($aid, $clang_id);
            $label = $OOArt->getName() . ' [' . $aid . ']';
            if (count($REX['CLANG']) > 1) {
                $label = '(' . rex_translate($REX['CLANG'][$clang_id]) . ') ' . $label;
            }
            $module_in_use_message .= '<li><a href="index.php?page=content&amp;article_id=' . $aid . '&clang=' . $clang_id . '&ctype=' . $ctype . '">' . htmlspecialchars($label) . '</a></li>';
            $del->next();
        }
        if ($module_in_use_message != '') {
            $warning_block = '<ul>' . $module_in_use_message . '</ul>';
        }
        $warning = $I18N->msg("module_cannot_be_deleted", $modulname);
    } else {
        $del->setQuery("DELETE FROM " . $REX['TABLE_PREFIX'] . "module WHERE id='{$modul_id}'");
        $del->setQuery("DELETE FROM " . $REX['TABLE_PREFIX'] . "module_action WHERE module_id='{$modul_id}'");
        $info = $I18N->msg("module_deleted");
 function _setActivePath()
 {
     global $REX;
     $article_id = $REX["ARTICLE_ID"];
     if ($OOArt = OOArticle::getArticleById($article_id)) {
         $path = trim($OOArt->getValue("path"), '|');
         $this->path = array();
         if ($path != "") {
             $this->path = explode("|", $path);
         }
         $this->current_article_id = $article_id;
         $this->current_category_id = $OOArt->getCategoryId();
         return TRUE;
     }
     return FALSE;
 }
示例#21
0
if ($article->getRows() == 1) {
    // ----- ctype holen
    $template_attributes = $article->getValue('template_attributes');
    // Für Artikel ohne Template
    if ($template_attributes === null) {
        $template_attributes = '';
    }
    $REX['CTYPE'] = rex_getAttributes('ctype', $template_attributes, array());
    // ctypes - aus dem template
    $ctype = rex_request('ctype', 'rex-ctype-id', 1);
    if (!array_key_exists($ctype, $REX['CTYPE'])) {
        $ctype = 1;
    }
    // default = 1
    // ----- Artikel wurde gefunden - Kategorie holen
    $OOArt = OOArticle::getArticleById($article_id, $clang);
    $category_id = $OOArt->getCategoryId();
    // ----- category pfad und rechte
    require $REX['INCLUDE_PATH'] . '/functions/function_rex_category.inc.php';
    // $KATout kommt aus dem include
    // $KATPERM
    if ($REX['PAGE'] == 'content' && $article_id > 0) {
        $KATout .= "\n" . '<p>';
        if ($article->getValue('startpage') == 1) {
            $KATout .= $I18N->msg('start_article') . ' : ';
        } else {
            $KATout .= $I18N->msg('article') . ' : ';
        }
        $catname = str_replace(' ', '&nbsp;', htmlspecialchars($article->getValue('name')));
        $KATout .= '<a href="index.php?page=content&amp;article_id=' . $article_id . '&amp;mode=edit&amp;clang=' . $clang . '"' . rex_tabindex() . '>' . $catname . '</a>';
        // $KATout .= " [$article_id]";
 function getStartArticle()
 {
     return OOArticle::getCategoryStartArticle($this->_id, $this->_clang);
 }
 function getRootArticles($ignore_offlines = false, $clang = false)
 {
     global $REX;
     if ($clang === false) {
         $clang = $GLOBALS[REX][CUR_CLANG];
     }
     return OOArticle::getArticlesOfCategory(0, $ignore_offlines, $clang);
 }
 function getRootArticles($ignore_offlines = FALSE, $clang = FALSE)
 {
     return OOArticle::getArticlesOfCategory(0, $ignore_offlines, $clang);
 }
 public static function extension_sitemap_seo42($sitemap)
 {
     global $REX;
     $myself = 'url_control';
     $addon = $REX['ADDON'][$myself]['addon'];
     $rewriter = $REX['ADDON'][$myself]['rewriter'];
     $query = '  SELECT  `article_id`,
                         `clang`,
                         `table`,
                         `table_parameters`
                 FROM    ' . $REX['TABLE_PREFIX'] . 'url_control_generate
                 ';
     $sql = rex_sql::factory();
     $sql->setQuery($query);
     $paths = array();
     if ($sql->getRows() >= 1) {
         $results = $sql->getArray();
         foreach ($results as $result) {
             $article_id = $result['article_id'];
             $clang = $result['clang'];
             $a = OOArticle::getArticleById($article_id, $clang);
             if ($a instanceof OOArticle) {
                 if (isset($rewriter[$addon]['get_url'])) {
                     $func = $rewriter[$addon]['get_url'];
                     $path = call_user_func($func, $article_id, $clang);
                 } else {
                     $path = $a->getUrl();
                 }
                 $table = $result['table'];
                 $table_params = unserialize($result['table_parameters']);
                 if (isset($table_params[$table][$table . '_sitemap_settings'])) {
                     $sitemapSetting = $table_params[$table][$table . '_sitemap_settings'];
                 } else {
                     $sitemapSetting = 'Artikel ohne dynamische Seiten';
                 }
                 switch ($sitemapSetting) {
                     case 'Artikel ohne dynamische Seiten':
                         break;
                     case 'Artikel mit dynamische Seiten':
                         $sitemapNode = $sitemap['subject'][$a->getId()][0];
                         $tableUrls = url_generate::getUrlsByTable($table);
                         foreach ($tableUrls as $tableUrl) {
                             $sitemapNode['loc'] = $tableUrl;
                             $sitemap['subject'][][] = $sitemapNode;
                         }
                         break;
                     case 'Nur dynamische Seiten':
                         $sitemapNode = $sitemap['subject'][$a->getId()][0];
                         unset($sitemap['subject'][$a->getId()]);
                         $tableUrls = url_generate::getUrlsByTable($table);
                         foreach ($tableUrls as $tableUrl) {
                             $sitemapNode['loc'] = $tableUrl;
                             $sitemap['subject'][][] = $sitemapNode;
                         }
                         break;
                 }
             }
         }
     }
     return $sitemap['subject'];
 }
示例#26
0
 /**
  * Indexes a certain article.
  * 
  * @param int $_id
  * @param mixed $_clang
  * 
  * @return int
  */
 function indexArticle($_id, $_clang = false)
 {
     global $REX;
     if ($_clang === false) {
         $langs = $this->languages;
     } else {
         $langs = array(intval($_clang) => $this->languages[intval($_clang)]);
     }
     $return = array();
     $keywords = array();
     foreach ($langs as $langID => $v) {
         if (in_array($_id, $this->excludeIDs)) {
             $return[$v] = A587_ART_EXCLUDED;
             continue;
         }
         $REX['CUR_CLANG'] = $langID;
         $delete = new rex_sql();
         $where = sprintf("ftable = '%s' AND fid = %d AND clang = %d", $delete->escape($this->tablePrefix . 'article'), $_id, $langID);
         // delete from cache
         $select = new rex_sql();
         $select->setTable($this->tablePrefix . '587_searchindex');
         $select->setWhere($where);
         $select->select('id');
         $indexIds = array();
         foreach ($select->getArray() as $result) {
             $indexIds[] = $result['id'];
         }
         $this->deleteCache($indexIds);
         // delete old
         $delete->setTable($this->tablePrefix . '587_searchindex');
         $delete->setWhere($where);
         $delete->delete();
         // index article
         $article = OOArticle::getArticleById(intval($_id), $langID);
         if (is_object($article) and ($article->isOnline() or $this->indexOffline)) {
             $this->beginFrontendMode();
             if (ini_get('allow_url_fopen') and $this->indexViaHTTP) {
                 $articleText = @file_get_contents('http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], '/redaxo/') + 1) . rex_geturl($_id, $langID, '', '&'));
             } elseif ($_id != 0 and $this->dontIndexRedirects) {
                 $rex_article = new rex_article(intval($_id), $langID);
                 $article_content_file = $this->generatedPath . '/articles/' . $_id . '.' . $langID . '.content';
                 if (!file_exists($article_content_file)) {
                     include_once $this->includePath . "/functions/function_rex_generate.inc.php";
                     $generated = rex_generateArticleContent($_id, $langID);
                     if ($generated !== true) {
                         $return[$v] = A587_ART_IDNOTFOUND;
                         continue;
                     }
                 }
                 if (file_exists($article_content_file) and preg_match($this->encodeRegex('~(header\\s*\\(\\s*["\']\\s*Location\\s*:)|(rex_redirect\\s*\\()~is'), rex_get_file_contents($article_content_file))) {
                     $return[$v] = A587_ART_REDIRECT;
                     continue;
                 }
                 if ($this->indexWithTemplate) {
                     $articleText = $rex_article->getArticleTemplate();
                 } else {
                     $articleText = $rex_article->getArticle();
                 }
                 if ($this->ep_outputfilter) {
                     $tmp = array('artid' => $REX['ARTICLE_ID'], 'clang' => $REX['CUR_CLANG']);
                     $REX['ARTICLE_ID'] = $_id;
                     $REX['CUR_CLANG'] = $langID;
                     $articleText = rex_register_extension_point('OUTPUT_FILTER', $articleText, array('environment' => 'frontend', 'sendcharset' => false));
                     $REX['ARTICLE_ID'] = $tmp['artid'];
                     $REX['CUR_CLANG'] = $tmp['clang'];
                 }
             }
             $insert = new rex_sql();
             $articleData = array();
             $articleData['texttype'] = 'article';
             $articleData['ftable'] = $this->tablePrefix . 'article';
             $articleData['fcolumn'] = NULL;
             $articleData['clang'] = $article->getClang();
             $articleData['fid'] = intval($_id);
             $articleData['catid'] = $article->getCategoryId();
             $articleData['unchangedtext'] = $insert->escape($articleText);
             $articleData['plaintext'] = $insert->escape($plaintext = $this->getPlaintext($articleText));
             if (array_key_exists($REX['TABLE_PREFIX'] . 'article', $this->includeColumns)) {
                 $additionalValues = array();
                 $select->flush();
                 $select->setTable($REX['TABLE_PREFIX'] . 'article');
                 $select->setWhere('id = ' . $_id . ' AND clang = ' . $langID);
                 $select->select('`' . implode('`,`', $this->includeColumns[$REX['TABLE_PREFIX'] . 'article']) . '`');
                 foreach ($this->includeColumns[$REX['TABLE_PREFIX'] . 'article'] as $col) {
                     $additionalValues[$col] = $select->getValue($col);
                 }
                 $articleData['values'] = $insert->escape(serialize($additionalValues));
             }
             foreach (preg_split($this->encodeRegex('~[[:punct:][:space:]]+~ism'), $plaintext) as $keyword) {
                 if ($this->significantCharacterCount <= mb_strlen($keyword, 'UTF-8')) {
                     $keywords[] = array('search' => $keyword, 'clang' => $langID);
                 }
             }
             $articleData['teaser'] = $insert->escape($this->getTeaserText($plaintext));
             $insert->setTable($this->tablePrefix . '587_searchindex');
             $insert->setValues($articleData);
             $insert->insert();
             $this->endFrontendMode();
             $return[$langID] = A587_ART_GENERATED;
         }
     }
     $this->storeKeywords($keywords, false);
     return $return;
 }
示例#27
0
 public function getBreadcrumbNavigation()
 {
     global $REX;
     $listType = 'ul';
     if ($this->breadcrumbOlList) {
         $listType = 'ol';
     }
     if ($this->breadcrumbCssClass !== '') {
         $cssClass = ' class="' . $this->breadcrumbCssClass . '"';
     } else {
         $cssClass = '';
     }
     $html = '<' . $listType . $cssClass . '>';
     $path = explode('|', $REX['ART'][$REX['ARTICLE_ID']]['path'][$REX['CUR_CLANG']] . $REX['ARTICLE_ID']);
     if ($REX['ARTICLE_ID'] !== $REX['START_ARTICLE_ID']) {
         $path = array_merge(array($REX['START_ARTICLE_ID']), $path);
     }
     foreach ($path as $id) {
         if ($id) {
             if ($this->breadcrumbStartArticleName === false && intval($id) === $REX['START_ARTICLE_ID']) {
                 continue;
             }
             $article = OOArticle::getArticleById($id);
             $articleName = $article->getName();
             if ($article->isOnline()) {
                 if ($this->breadcrumbStartArticleName !== '' && intval($id) === $REX['START_ARTICLE_ID']) {
                     $articleName = $this->breadcrumbStartArticleName;
                 }
                 $html .= '<li>';
                 if (intval($id) === $REX['ARTICLE_ID']) {
                     $html .= $articleName;
                 } else {
                     $html .= '<a href="' . $article->getUrl() . '">' . $articleName . '</a>';
                 }
                 $html .= '</li>';
             }
         }
     }
     return $html .= '</' . $listType . '>';
 }
/**
 * rex_rewriter_generate_pathnames
 * generiert die Pathlist, abhŠngig von Aktion
 * @author markus.staab[at]redaxo[dot]de Markus Staab
 * @package redaxo4.2
 */
function rex_rewriter_generate_pathnames($params)
{
    global $REX, $REXPATH;
    if (file_exists(FULLNAMES_PATHLIST)) {
        require_once FULLNAMES_PATHLIST;
    }
    if (!isset($REXPATH)) {
        $REXPATH = array();
    }
    if (!isset($params['extension_point'])) {
        $params['extension_point'] = '';
    }
    $where = '';
    switch ($params['extension_point']) {
        // ------- sprachabhängig, einen artikel aktualisieren
        case 'CAT_DELETED':
        case 'ART_DELETED':
            unset($REXPATH[$params['id']]);
            break;
        case 'CAT_ADDED':
        case 'CAT_UPDATED':
        case 'ART_ADDED':
        case 'ART_UPDATED':
            $where = '(id=' . $params['id'] . ' AND clang=' . $params['clang'] . ') OR (path LIKE "%|' . $params['id'] . '|%" AND clang=' . $params['clang'] . ')';
            break;
            // ------- alles aktualisieren
        // ------- alles aktualisieren
        case 'ALL_GENERATED':
        default:
            $where = '1=1';
            break;
    }
    if ($where != '') {
        $db = new rex_sql();
        // $db->debugsql=true;
        $db->setQuery('SELECT id,clang,path,startpage FROM ' . $REX['TABLE_PREFIX'] . 'article WHERE ' . $where . ' and revision=0');
        while ($db->hasNext()) {
            $clang = $db->getValue('clang');
            $pathname = '';
            if (count($REX['CLANG']) > 1) {
                $pathname = $REX['CLANG'][$clang] . '/';
            }
            // pfad über kategorien bauen
            $path = trim($db->getValue('path'), '|');
            if ($path != '') {
                $path = explode('|', $path);
                foreach ($path as $p) {
                    $ooc = OOCategory::getCategoryById($p, $clang);
                    $name = $ooc->getName();
                    unset($ooc);
                    // speicher freigeben
                    $pathname = rex_rewriter_appendToPath($pathname, $name);
                }
            }
            $ooa = OOArticle::getArticleById($db->getValue('id'), $clang);
            if ($ooa->isStartArticle()) {
                $ooc = $ooa->getCategory();
                $catname = $ooc->getName();
                unset($ooc);
                // speicher freigeben
                $pathname = rex_rewriter_appendToPath($pathname, $catname);
            }
            // eigentlicher artikel anhängen
            $name = $ooa->getName();
            unset($ooa);
            // speicher freigeben
            $pathname = rex_rewriter_appendToPath($pathname, $name);
            $pathname = substr($pathname, 0, strlen($pathname) - 1) . '.html';
            $REXPATH[$db->getValue('id')][$db->getValue('clang')] = $pathname;
            $db->next();
        }
    }
    rex_put_file_contents(FULLNAMES_PATHLIST, "<?php\n\$REXPATH = " . var_export($REXPATH, true) . ";\n");
}
示例#29
0
 function getArticle()
 {
     return OOArticle::getArticleById($this->getArticleId());
 }
示例#30
0
} else {
    // echo "nichts";
    $rex_com_auth_info = 0;
    // 0 - nichts / 1 - logout / 2 - failed login / 3 - logged in
    unset($REX['COM_USER']);
}
$rex_com_auth_jump = rex_request('rex_com_auth_jump', 'string');
if (isset($jump_aid) && ($article = OOArticle::getArticleById($jump_aid)) || $rex_com_auth_use_jump_url && $rex_com_auth_jump != "") {
    ob_end_clean();
    $url_params['rex_com_auth_info'] = $rex_com_auth_info;
    if ($rex_com_auth_use_jump_url && $rex_com_auth_jump != "") {
        header('Location: http://' . $REX["SERVER"] . '/' . rex_com_auth_urldecode($rex_com_auth_jump));
    } else {
        if ($rex_com_auth_jump != "") {
            $url_params[$REX['ADDON']['community']['plugin_auth']['request']['jump']] = $rex_com_auth_jump;
        }
        header('Location:' . rex_getUrl($jump_aid, '', $url_params, '&'));
    }
    exit;
}
// ---------- page_permissions
if ($article = OOArticle::getArticleById($REX["ARTICLE_ID"])) {
    if (!rex_com_checkperm($article)) {
        ob_end_clean();
        header('Location:' . rex_getUrl($REX['ADDON']['community']['plugin_auth']['article_withoutperm'], '', $url_params, '&'));
        exit;
    }
} else {
    // Wenn Article nicht vorhanden - nichts machen -> wird dann von der index.php geregelt sodass eine fehlerseite auftaucht
    // $jump_aid = $REX['ADDON']['community']['plugin_auth']['article_withoutperm'];
}