/**
  * 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 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 rex_linkmap_format_label($OOobject)
{
    global $REX_USER, $I18N;
    $label = $OOobject->getName();
    if (trim($label) == '') {
        $label = ' ';
    }
    if ($REX_USER->hasPerm('advancedMode[]')) {
        $label .= ' [' . $OOobject->getId() . ']';
    }
    if (OOArticle::isValid($OOobject) && !$OOobject->hasTemplate()) {
        $label .= ' [' . $I18N->msg('lmap_has_no_template') . ']';
    }
    return $label;
}
 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;
 }
Exemple #5
0
 protected function _getLangNavigation()
 {
     global $REX;
     // ul id
     if ($this->langUlId == '') {
         $ulIdAttribute = '';
     } else {
         $ulIdAttribute = ' id="' . $this->langUlId . '"';
     }
     $out = '<ul' . $ulIdAttribute . '>';
     foreach ($REX['CLANG'] as $clangId => $clangName) {
         $article = OOArticle::getArticleById($REX['ARTICLE_ID'], $clangId);
         // new article id
         if (OOArticle::isValid($article) && $article->isOnline()) {
             $newArticleId = $article->getId();
             $articleStatus = true;
         } else {
             $newArticleId = $REX['START_ARTICLE_ID'];
             $articleStatus = false;
         }
         if (!$articleStatus && $this->langHideLiIfOfflineArticle) {
             // do nothing
         } else {
             $langCode = '';
             $originalName = '';
             $langSlug = '';
             if (class_exists('seo42')) {
                 $langCode = seo42::getLangCode($clangId);
                 $originalName = seo42::getOriginalLangName($clangId);
                 $langSlug = seo42::getLangUrlSlug($clangId);
             }
             if ($langCode == '') {
                 $langCode = $clangName;
             }
             if ($originalName == '') {
                 $originalName = $clangName;
             }
             if ($langSlug == '') {
                 $langSlug = $clangName;
             }
             // link text
             if ($this->langUseLangCodeAsLinkText) {
                 $linkText = $langCode;
             } else {
                 $linkText = $originalName;
             }
             if ($this->langUpperCaseLinkText) {
                 $linkText = strtoupper($linkText);
             }
             // li attribute
             if ($this->langShowLiIds) {
                 $liIdAttribute = ' id="' . $langSlug . '"';
             } else {
                 $liIdAttribute = '';
             }
             // class attribute
             if ($REX['CUR_CLANG'] == $clangId) {
                 $liClassAttribute = ' class="' . $this->langSelectedClass . '"';
             } else {
                 $liClassAttribute = '';
             }
             // li out
             $out .= '<li' . $liIdAttribute . $liClassAttribute . '><a href="' . rex_getUrl($newArticleId, $clangId) . '">' . $linkText . '</a></li>';
         }
     }
     $out .= '</ul>';
     return $out;
 }
 $neu_error_emailaddress = str_replace("\\'", "'", rex_post('neu_error_emailaddress', 'string'));
 $neu_SERVER = str_replace("\\'", "'", rex_post('neu_SERVER', 'string'));
 $neu_SERVERNAME = str_replace("\\'", "'", rex_post('neu_SERVERNAME', 'string'));
 $neu_modrewrite = rex_post('neu_modrewrite', 'string');
 $startArt = OOArticle::getArticleById($neu_startartikel);
 $notFoundArt = OOArticle::getArticleById($neu_notfoundartikel);
 $REX['LANG'] = $neu_lang;
 $master_file = $REX['INCLUDE_PATH'] . '/master.inc.php';
 $cont = rex_get_file_contents($master_file);
 if (!OOArticle::isValid($startArt)) {
     $warning .= $I18N->msg('settings_invalid_sitestart_article') . "<br />";
 } else {
     $cont = ereg_replace("(REX\\['START_ARTICLE_ID'\\].?\\=.?)[^;]*", "\\1" . strtolower($neu_startartikel), $cont);
     $REX['START_ARTICLE_ID'] = $neu_startartikel;
 }
 if (!OOArticle::isValid($notFoundArt)) {
     $warning .= $I18N->msg('settings_invalid_notfound_article') . "<br />";
 } else {
     $cont = ereg_replace("(REX\\['NOTFOUND_ARTICLE_ID'\\].?\\=.?)[^;]*", "\\1" . strtolower($neu_notfoundartikel), $cont);
     $REX['NOTFOUND_ARTICLE_ID'] = $neu_notfoundartikel;
 }
 $sql = new rex_sql();
 $sql->setQuery('SELECT * FROM rex_template WHERE id=' . $neu_defaulttemplateid . ' AND active=1');
 if ($sql->getRows() != 1 && $neu_defaulttemplateid != 0) {
     $warning .= $I18N->msg('settings_invalid_default_template') . "<br />";
 } else {
     $cont = ereg_replace("(REX\\['DEFAULT_TEMPLATE_ID'\\].?\\=.?)[^;]*", "\\1" . strtolower($neu_defaulttemplateid), $cont);
     $REX['DEFAULT_TEMPLATE_ID'] = $neu_defaulttemplateid;
 }
 $cont = ereg_replace("(REX\\['ERROR_EMAIL'\\].?\\=.?)[^;]*", "\\1\"" . strtolower($neu_error_emailaddress) . "\"", $cont);
 $cont = ereg_replace("(REX\\['LANG'\\].?\\=.?)[^;]*", "\\1\"" . $neu_lang . "\"", $cont);
    /**
     * Gibt das Button Template zurück
     */
    function getLinkButton($id, $article_id, $category = '')
    {
        global $REX;
        $art_name = '';
        $clang = '';
        $art = OOArticle::getArticleById($article_id);
        // Falls ein Artikel vorausgewählt ist, dessen Namen anzeigen und beim öffnen der Linkmap dessen Kategorie anzeigen
        if (OOArticle::isValid($art)) {
            $art_name = $art->getName();
            $category = $art->getCategoryId();
        }
        $open_params = '&clang=' . $REX['CUR_CLANG'];
        if ($category != '') {
            $open_params .= '&category_id=' . $category;
        }
        $media = '
	<div class="rex-wdgt">
		<div class="rex-wdgt-lnk">
          <p class="rex-wdgt-fld">
  			<input type="hidden" name="LINK[' . $id . ']" id="LINK_' . $id . '" value="' . $article_id . '" />
  			<input type="text" size="30" name="LINK_NAME[' . $id . ']" value="' . $art_name . '" id="LINK_' . $id . '_NAME" readonly="readonly" />
  		  </p>
          <p class="rex-wdgt-icons">
          	<a href="#" onclick="openLinkMap(\'LINK_' . $id . '\', \'' . $open_params . '\');return false;"' . rex_tabindex() . '><img src="media/file_open.gif" width="16" height="16" alt="Open Linkmap" title="Open Linkmap" /></a>
 			<a href="#" onclick="deleteREXLink(' . $id . ');return false;"' . rex_tabindex() . '><img src="media/file_del.gif" width="16" height="16" title="Remove Selection" alt="Remove Selection" /></a>
 		  </p>
 		  <div class="rex-clearer"></div>
 		</div>
 	</div>';
        return $media;
    }
 function setArticleId($article_id)
 {
     global $REX;
     $article_id = (int) $article_id;
     $this->article_id = (int) $article_id;
     if ($this->viasql) {
         // ---------- select article
         $qry = "SELECT * FROM " . $REX['TABLE_PREFIX'] . "article WHERE " . $REX['TABLE_PREFIX'] . "article.id='{$article_id}' AND clang='" . $this->clang . "'";
         $this->ARTICLE->setQuery($qry);
         if ($this->ARTICLE->getRows() == 1) {
             $this->template_id = $this->getValue('template_id');
             $this->category_id = $this->getValue('category_id');
             return TRUE;
         }
     } else {
         $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 _formatNode(&$node)
 {
     if ($this->ignore_startarticles && OOArticle::isValid($node) && $node->isStartPage()) {
         return '';
     }
     $name = $node->getName();
     if ($name == '') {
         if ($this->ignore_empty) {
             return '';
         } else {
             $name = $this->empty_value;
         }
     }
     if ($this->depth_limit > 0 && $this->_depth >= $this->depth_limit) {
         return '';
     }
     $s = '';
     $s_self = '';
     $s_child = '';
     // Kategorien ingorieren?
     if (OOCategory::isValid($node) && !$this->ignore_categories || OOArticle::isValid($node) && !($this->ignore_startarticles && $node->isStartPage())) {
         $s_self .= $this->_formatNodeValue($name, $node);
         if (OOCategory::isValid($node)) {
             $childs = $node->getChildren($this->ignore_offlines, $this->clang);
             $articles = $node->getArticles($this->ignore_offlines, $this->clang);
             if (is_array($childs) && count($childs) > 0 || is_array($articles) && count($articles) > 0 && !$this->ignore_articles) {
                 $this->_depth++;
                 if (is_array($childs)) {
                     foreach ($childs as $child) {
                         $s_child .= $this->_formatNode($child);
                     }
                 }
                 // Artikel ingorieren?
                 if (!$this->ignore_articles) {
                     if (is_array($articles)) {
                         foreach ($articles as $article) {
                             //                if ($article->isStartPage())
                             //                {
                             //                  continue;
                             //                }
                             $s_child .= '<' . $this->child_tag . $this->child_attr . '>';
                             $s_child .= $this->_formatNodeValue($article->getName(), $article);
                             $s_child .= '</' . $this->child_tag . '>';
                         }
                     }
                 }
                 // Parent Tag nur erstellen, wenn auch Childs vorhanden sind
                 if ($s_child != '') {
                     $s_self .= '<' . $this->parent_tag . $this->parent_attr . '>';
                     $s_self .= $s_child;
                     $s_self .= '</' . $this->parent_tag . '>';
                 }
                 $this->_depth--;
             }
         }
         // Parent Tag nur erstellen, wenn auch Childs vorhanden sind
         if ($s_self != '') {
             $s .= '<' . $this->child_tag . $this->child_attr . '>';
             $s .= $s_self;
             $s .= '</' . $this->child_tag . '>';
         }
     }
     return $s;
 }
    public static function showUrlTypeMsg($params)
    {
        global $REX, $I18N;
        $currentArticle = OOArticle::getArticleById($REX['ARTICLE_ID']);
        $urlField = $currentArticle->getValue('seo_custom_url');
        $articleId = $currentArticle->getValue('id');
        $clangId = $currentArticle->getValue('clang');
        $msg = '';
        $isError = false;
        $urlData = seo42_utils::getUrlTypeData($urlField);
        $jsonData = json_decode($urlData, true);
        if ($REX['CUR_CLANG'] != $REX['START_CLANG_ID']) {
            $currentArticleDefaultLang = OOArticle::getArticleById($REX['ARTICLE_ID'], $REX['START_CLANG_ID']);
            $data = json_decode($currentArticleDefaultLang->getValue('seo_custom_url'), true);
            if (isset($data['url_clone']) && $data['url_clone'] == true) {
                $jsonData = $data;
            }
        }
        if (isset($jsonData['url_type'])) {
            switch ($jsonData['url_type']) {
                case SEO42_URL_TYPE_INTERN_REPLACE:
                    $customArticleId = $jsonData['article_id'];
                    $article = OOArticle::getArticleById($customArticleId);
                    if (OOArticle::isValid($article)) {
                        $msg = $I18N->msg('seo42_urltype_intern') . ' <a href="index.php?page=content&article_id=' . $customArticleId . '&mode=edit&clang=' . $REX['CUR_CLANG'] . '">' . $article->getName() . '</a>';
                    } else {
                        $msg = $I18N->msg('seo42_urltype_error');
                        $isError = true;
                    }
                    break;
                case SEO42_URL_TYPE_INTERN_REPLACE_CLANG:
                    $customArticleId = $jsonData['article_id'];
                    $customClangId = $jsonData['clang_id'];
                    $article = OOArticle::getArticleById($customArticleId, $customClangId);
                    if (OOArticle::isValid($article)) {
                        $msg = $I18N->msg('seo42_urltype_intern_plus_clang', '<a href="index.php?page=content&article_id=' . $customArticleId . '&mode=edit&clang=' . $customClangId . '">' . $article->getName() . '</a>', $REX['CLANG'][$customClangId]);
                    } else {
                        $msg = $I18N->msg('seo42_urltype_error');
                        $isError = true;
                    }
                    break;
                case SEO42_URL_TYPE_USERDEF_INTERN:
                    // do nothing
                    break;
                case SEO42_URL_TYPE_USERDEF_EXTERN:
                    $customUrl = $jsonData['custom_url'];
                    if (seo42_utils::stringStartsWith($customUrl, 'javascript:')) {
                        $msg = $I18N->msg('seo42_urltype_userdef_javascript');
                    } else {
                        $msg = $I18N->msg('seo42_urltype_userdef') . ': <a href="' . $customUrl . '" target="_blank">' . $customUrl . '</a>';
                    }
                    break;
                case SEO42_URL_TYPE_MEDIAPOOL:
                    $customUrl = '/' . $REX['MEDIA_DIR'] . '/' . $jsonData['file'];
                    $msg = $I18N->msg('seo42_urltype_mediapool', '<a href="' . $customUrl . '" target="_blank">' . $jsonData['file'] . '</a>');
                    break;
                case SEO42_URL_TYPE_LANGSWITCH:
                    $newClangId = $jsonData['clang_id'];
                    $msg = $I18N->msg('seo42_urltype_langswitch', $REX['CLANG'][$newClangId]);
                    break;
                case SEO42_URL_TYPE_NONE:
                    $msg = $I18N->msg('seo42_urltype_none');
                    break;
                case SEO42_URL_TYPE_REMOVE_ROOT_CAT:
                    // do nothing
                    break;
                case SEO42_URL_TYPE_CALL_FUNC:
                    if (isset($jsonData['no_url']) && $jsonData['no_url']) {
                        $msg = $I18N->msg('seo42_urltype_none');
                    }
                    break;
                default:
                case SEO42_URL_TYPE_DEFAULT:
                    // do nothing
                    break;
            }
        }
        if ($msg != '') {
            echo '	<style type=text/css>
						.rex-info p,
						.rex-warning p { 
							padding: 4px 0 2px 0; 
						}
					</style>';
            if ($isError) {
                echo rex_warning($msg);
            } else {
                echo rex_info($msg);
            }
        }
    }
/**
 * Backend Search Addon
 *
 * @author markus[dot]staab[at]redaxo[dot]de Markus Staab
 *
 * @package redaxo4
 * @version $Id: extension_search_structure.inc.php,v 1.2 2008/04/12 10:22:30 kills Exp $
 */
function rex_a256_search_structure($params)
{
    global $REX, $REX_USER, $I18N_BE_SEARCH;
    if (!($REX_USER->isAdmin() || $REX_USER->hasPerm('be_search[structure]'))) {
        return $params['subject'];
    }
    $message = '';
    $search_result = '';
    $editUrl = 'index.php?page=content&article_id=%s&mode=edit&clang=%s&a256_article_name=%s';
    $structureUrl = 'index.php?page=structure&category_id=%s&clang=%s&a256_article_name=%s';
    // ------------ globale Parameter
    $page = rex_request('page', 'string');
    $mode = rex_request('mode', 'string');
    $category_id = rex_request('category_id', 'int');
    $article_id = rex_request('article_id', 'int');
    $clang = rex_request('clang', 'int');
    $ctype = rex_request('ctype', 'int');
    // ------------ Parameter
    $a256_article_id = rex_request('a256_article_id', 'int');
    $a256_clang = rex_request('a256_clang', 'int');
    $a256_article_name = rex_request('a256_article_name', 'string');
    $a256_article_name_post = rex_post('a256_article_name', 'string');
    $mode = rex_request('mode', 'string');
    // ------------ Suche via ArtikelId
    if ($a256_article_id != 0) {
        $OOArt = OOArticle::getArticleById($a256_article_id, $a256_clang);
        if (OOArticle::isValid($OOArt)) {
            header('Location:' . sprintf($editUrl, $a256_article_id, $a256_clang, urlencode($a256_article_name)));
            exit;
        }
    }
    // Auswahl eines normalen Artikels => category holen
    if ($article_id != 0) {
        $OOArt = OOArticle::getArticleById($article_id, $clang);
        $category_id = $OOArt->getCategoryId();
    }
    // ------------ Suche via ArtikelName
    // hier nur dne post artikel namen abfragen,
    // da sonst bei vorherigen headerweiterleitungen
    // auch gesucht wuerde
    if ($a256_article_name_post != '') {
        $qry = '
    SELECT id
    FROM ' . $REX['TABLE_PREFIX'] . 'article
    WHERE
      clang = ' . $a256_clang . ' AND
      (
        name LIKE "%' . $a256_article_name . '%" OR
        catname LIKE "%' . $a256_article_name . '%"
      )';
        if ($category_id != 0) {
            $qry .= ' AND path LIKE "%|' . $category_id . '|%"';
        }
        $search = new rex_sql();
        //    $search->debugsql = true;
        $search->setQuery($qry);
        $foundRows = $search->getRows();
        // Suche ergab nur einen Treffer => Direkt auf den Treffer weiterleiten
        if ($foundRows == 1) {
            $OOArt = OOArticle::getArticleById($search->getValue('id'), $a256_clang);
            if ($REX_USER->hasCategoryPerm($OOArt->getCategoryId())) {
                header('Location:' . sprintf($editUrl, $search->getValue('id'), $a256_clang, urlencode($a256_article_name)));
                exit;
            }
        } else {
            if ($foundRows > 0) {
                $search_result .= '<ul class="a256-search-result">';
                for ($i = 0; $i < $foundRows; $i++) {
                    $OOArt = OOArticle::getArticleById($search->getValue('id'), $a256_clang);
                    $label = $OOArt->getName();
                    if ($REX_USER->hasCategoryPerm($OOArt->getCategoryId())) {
                        if ($REX_USER->hasPerm('advancedMode[]')) {
                            $label .= ' [' . $search->getValue('id') . ']';
                        }
                        $s = '';
                        $first = true;
                        foreach ($OOArt->getParentTree() as $treeItem) {
                            $treeLabel = $treeItem->getName();
                            if ($REX_USER->hasPerm('advancedMode[]')) {
                                $treeLabel .= ' [' . $treeItem->getId() . ']';
                            }
                            $prefix = ': ';
                            if ($first) {
                                $prefix = '';
                                $first = false;
                            }
                            $s .= '<li>' . $prefix . '<a href="' . sprintf($structureUrl, $treeItem->getId(), $a256_clang, urlencode($a256_article_name)) . '">' . htmlspecialchars($treeLabel) . ' </a></li>';
                        }
                        $prefix = ': ';
                        if ($first) {
                            $prefix = '';
                            $first = false;
                        }
                        $s .= '<li>' . $prefix . '<a href="' . sprintf($editUrl, $search->getValue('id'), $a256_clang, urlencode($a256_article_name)) . '">' . htmlspecialchars($label) . ' </a></li>';
                        $search_result .= '<li><ul class="a256-search-hit">' . $s . '</ul></li>';
                    }
                    $search->next();
                }
                $search_result .= '</ul>';
            } else {
                $message = rex_warning($I18N_BE_SEARCH->msg('search_no_results'));
            }
        }
    }
    $select_name = 'category_id';
    $add_homepage = true;
    if ($mode == 'edit' || $mode == 'meta') {
        $select_name = 'article_id';
        $add_homepage = false;
    }
    $category_select = new rex_category_select(false, false, true, $add_homepage);
    $category_select->setName($select_name);
    $category_select->setId('rex-a256-category-id');
    $category_select->setSize('1');
    $category_select->setAttribute('onchange', 'this.form.submit();');
    $category_select->setSelected($category_id);
    $form = '  <form action="index.php" method="post">
        <input type="hidden" name="page" id="rex-a256-article-clang" value="' . $page . '" />
        <input type="hidden" name="mode" id="rex-a256-article-clang" value="' . $mode . '" />
        <input type="hidden" name="category_id" id="rex-a256-article-clang" value="' . $category_id . '" />
        <input type="hidden" name="article_id" id="rex-a256-article-clang" value="' . $article_id . '" />
        <input type="hidden" name="clang" id="rex-a256-article-clang" value="' . $clang . '" />
        <input type="hidden" name="ctype" id="rex-a256-article-clang" value="' . $ctype . '" />
        <input type="hidden" name="a256_clang" id="rex-a256-article-clang" value="' . $clang . '" />

		    <div class="rex-f-lft">
	        <label for="rex-a256-article-name">' . $I18N_BE_SEARCH->msg('search_article_name') . '</label>
    	    <input type="text" name="a256_article_name" id="rex-a256-article-name" value="' . htmlspecialchars(stripslashes($a256_article_name)) . '"' . rex_tabindex() . ' />

        	<label for="rex-a256-article-id">' . $I18N_BE_SEARCH->msg('search_article_id') . '</label>
	        <input type="text" name="a256_article_id" id="rex-a256-article-id"' . rex_tabindex() . ' />
    	    <input class="rex-sbmt" type="submit" name="a256_start_search" value="' . $I18N_BE_SEARCH->msg('search_start') . '"' . rex_tabindex() . ' />
		    </div>

    		<div class="rex-f-rght">
    			<label for="rex-a256-category-id">' . $I18N_BE_SEARCH->msg('search_quick_navi') . '</label>';
    $category_select->setAttribute('tabindex', rex_tabindex(false));
    $form .= $category_select->get() . '
    			<noscript>
    			  <input type="submit" name="a256_start_jump" value="' . $I18N_BE_SEARCH->msg('search_jump_to_category') . '" />
    			</noscript>
        </div>
      </form>';
    $search_bar = $message . '<div id="rex-a256-searchbar">
     ' . $form . '
     ' . $search_result . '
   </div>
   <div class="rex-clearer"></div>';
    return $search_bar . $params['subject'];
}
/**
 * Castet die Variable $var zum Typ $vartype
 * 
 * Mögliche PHP-Typen sind:
 *  - bool (auch boolean)
 *  - int (auch integer)
 *  - double
 *  - string
 *  - float
 *  - real
 *  - object
 *  - array
 *  - '' (nicht casten)
 *  
 * Mögliche REDAXO-Typen sind:
 *  - rex-article-id
 *  - rex-category-id
 *  - rex-clang-id
 *  - rex-template-id
 *  - rex-ctype-id
 *  - rex-slice-id
 *  - rex-module-id
 *  - rex-action-id
 *  - rex-media-id
 *  - rex-mediacategory-id
 *  - rex-user-id
 * 
 * @access private
 */
function _rex_cast_var($var, $vartype, $default, $mode)
{
    global $REX;
    if (!is_string($vartype)) {
        trigger_error('String expected for $vartype in _rex_cast_var()!', E_USER_ERROR);
        exit;
    }
    switch ($vartype) {
        // ---------------- REDAXO types
        case 'rex-article-id':
            $var = (int) $var;
            if ($mode == 'found') {
                if (!OOArticle::isValid(OOArticle::getArticleById($var))) {
                    $var = (int) $default;
                }
            }
            break;
        case 'rex-category-id':
            $var = (int) $var;
            if ($mode == 'found') {
                if (!OOCategory::isValid(OOCategory::getCategoryById($var))) {
                    $var = (int) $default;
                }
            }
            break;
        case 'rex-clang-id':
            $var = (int) $var;
            if ($mode == 'found') {
                if (empty($REX['CLANG'][$var])) {
                    $var = (int) $default;
                }
            }
            break;
        case 'rex-template-id':
        case 'rex-ctype-id':
        case 'rex-slice-id':
        case 'rex-module-id':
        case 'rex-action-id':
        case 'rex-media-id':
        case 'rex-mediacategory-id':
        case 'rex-user-id':
            // erstmal keine weitere validierung
            $var = (int) $var;
            break;
            // ---------------- PHP types
        // ---------------- PHP types
        case 'bool':
        case 'boolean':
            $var = (bool) $var;
            break;
        case 'int':
        case 'integer':
            $var = (int) $var;
            break;
        case 'double':
            $var = (double) $var;
            break;
        case 'float':
        case 'real':
            $var = (double) $var;
            break;
        case 'string':
            $var = (string) $var;
            break;
        case 'object':
            $var = (object) $var;
            break;
        case 'array':
            if (empty($var)) {
                $var = array();
            } else {
                $var = (array) $var;
            }
            break;
            // kein Cast, nichts tun
        // kein Cast, nichts tun
        case '':
            break;
            // Evtl Typo im vartype, deshalb hier fehlermeldung!
        // Evtl Typo im vartype, deshalb hier fehlermeldung!
        default:
            trigger_error('Unexpected vartype "' . $vartype . '" in _rex_cast_var()!', E_USER_ERROR);
            exit;
    }
    return $var;
}
/**
 * Castet die Variable $var zum Typ $vartype
 *
 * Mögliche PHP-Typen sind:
 *  - bool (auch boolean)
 *  - int (auch integer)
 *  - double
 *  - string
 *  - float
 *  - real
 *  - object
 *  - array
 *  - '' (nicht casten)
 *
 * Mögliche REDAXO-Typen sind:
 *  - rex-article-id
 *  - rex-category-id
 *  - rex-clang-id
 *  - rex-template-id
 *  - rex-ctype-id
 *  - rex-slice-id
 *  - rex-module-id
 *  - rex-action-id
 *  - rex-media-id
 *  - rex-mediacategory-id
 *  - rex-user-id
 *
 * @access private
 */
function _rex_cast_var($var, $vartype, $default = null, $mode = 'default')
{
    global $REX;
    if (is_string($vartype)) {
        $casted = true;
        switch ($vartype) {
            // ---------------- REDAXO types
            case 'rex-article-id':
                $var = (int) $var;
                if ($mode == 'found') {
                    if (!OOArticle::isValid(OOArticle::getArticleById($var))) {
                        $var = (int) $default;
                    }
                }
                break;
            case 'rex-category-id':
                $var = (int) $var;
                if ($mode == 'found') {
                    if (!OOCategory::isValid(OOCategory::getCategoryById($var))) {
                        $var = (int) $default;
                    }
                }
                break;
            case 'rex-clang-id':
                $var = (int) $var;
                if ($mode == 'found') {
                    if (empty($REX['CLANG'][$var])) {
                        $var = (int) $default;
                    }
                }
                break;
            case 'rex-template-id':
            case 'rex-ctype-id':
            case 'rex-slice-id':
            case 'rex-module-id':
            case 'rex-action-id':
            case 'rex-media-id':
            case 'rex-mediacategory-id':
            case 'rex-user-id':
                // erstmal keine weitere validierung
                $var = (int) $var;
                break;
                // ---------------- PHP types
            // ---------------- PHP types
            case 'bool':
            case 'boolean':
                $var = (bool) $var;
                break;
            case 'int':
            case 'integer':
                $var = (int) $var;
                break;
            case 'double':
                $var = (double) $var;
                break;
            case 'float':
            case 'real':
                $var = (double) $var;
                break;
            case 'string':
                $var = (string) $var;
                break;
            case 'object':
                $var = (object) $var;
                break;
            case 'array':
                if ($var === '') {
                    $var = array();
                } else {
                    $var = (array) $var;
                }
                break;
                // kein Cast, nichts tun
            // kein Cast, nichts tun
            case '':
                break;
            default:
                // check for array with generic type
                if (strpos($vartype, 'array[') === 0) {
                    if (empty($var)) {
                        $var = array();
                    } else {
                        $var = (array) $var;
                    }
                    // check if every element in the array is from the generic type
                    $matches = array();
                    if (preg_match('@array\\[([^\\]]*)\\]@', $vartype, $matches)) {
                        foreach ($var as $key => $value) {
                            try {
                                $var[$key] = _rex_cast_var($value, $matches[1]);
                            } catch (InvalidArgumentException $e) {
                                // Evtl Typo im vartype, mit urspr. typ als fehler melden
                                throw new InvalidArgumentException('Unexpected vartype "' . $vartype . '" in _rex_cast_var()!');
                            }
                        }
                    } else {
                        throw new InvalidArgumentException('Unexpected vartype "' . $vartype . '" in _rex_cast_var()!');
                    }
                } else {
                    $casted = false;
                }
        }
        if ($casted) {
            return $var;
        }
    }
    if (is_callable($vartype)) {
        $var = call_user_func($vartype, $var);
    } elseif (is_array($vartype)) {
        $var = _rex_cast_var($var, 'array');
        $newVar = array();
        foreach ($vartype as $cast) {
            if (!is_array($cast) || !isset($cast[0])) {
                throw new InvalidArgumentException('Unexpected vartype in _rex_cast_var()!');
            }
            $key = $cast[0];
            $innerVartype = isset($cast[1]) ? $cast[1] : '';
            if (array_key_exists($key, $var)) {
                $newVar[$key] = _rex_cast_var($var[$key], $innerVartype);
            } elseif (!isset($cast[2])) {
                $newVar[$key] = _rex_cast_var('', $innerVartype);
            } else {
                $newVar[$key] = $cast[2];
            }
        }
        $var = $newVar;
    } elseif (is_string($vartype)) {
        throw new InvalidArgumentException('Unexpected vartype "' . $vartype . '" in _rex_cast_var()!');
    } else {
        throw new InvalidArgumentException('Unexpected vartype in _rex_cast_var()!');
    }
    return $var;
}
 /**
  * RESOLVE()
  *
  * resolve url to ARTICLE_ID & CLANG,
  * resolve rewritten params back to GET/REQUEST
  */
 function resolve()
 {
     global $REX, $SEO42_URLS, $SEO42_IDS;
     if (!file_exists(SEO42_PATHLIST)) {
         seo42_generate_pathlist(array());
     }
     require_once SEO42_PATHLIST;
     if (!$REX['REDAXO']) {
         $article_id = -1;
         $clang = $REX['CUR_CLANG'];
         $start_id = $REX['START_ARTICLE_ID'];
         $notfound_id = $REX['NOTFOUND_ARTICLE_ID'];
         $install_subdir = seo42::getServerSubDir();
         // 42
         $homelang = $REX['ADDON']['seo42']['settings']['homelang'];
         // TRY IMMEDIATE MATCH OF REQUEST_URI AGAINST PATHLIST..
         if (self::resolve_from_pathlist(ltrim($_SERVER['REQUEST_URI'], '/'))) {
             return;
         }
         // allow_article_id ?
         if ($REX['ADDON']['seo42']['settings']['allow_article_id'] && rex_get('article_id', 'int') > 0) {
             return self::setArticleId(rex_request('article_id', 'int'), rex_request('clang', 'int', $clang));
         }
         // IF NON_REWRITTEN URLS ALLOWED -> USE ARTICLE_ID FROM REQUEST
         if ($REX['ADDON']['seo42']['settings']['auto_redirects'] != SEO42_AUTO_REDIRECT_NONE && rex_get('article_id', 'int') > 0) {
             if ($REX['ADDON']['seo42']['settings']['auto_redirects'] == SEO42_AUTO_REDIRECT_ARTICLE_ID) {
                 $artId = rex_request('article_id', 'int');
                 $clangId = rex_request('clang', 'int', $clang);
                 $article = OOArticle::getArticleById($artId, $clangId);
                 if (OOArticle::isValid($article)) {
                     $redirect = array('id' => $artId, 'clang' => $clangId, 'status' => 301);
                     return self::redirect($redirect);
                     /*todo: include params*/
                 }
             }
         }
         // GET PATH RELATIVE TO INTALL_SUBDIR ---------------> 42
         $path = ltrim($_SERVER['REQUEST_URI'], '/');
         if (seo42::isSubDirInstall()) {
             $path = substr($path, strlen($install_subdir));
             $path = ltrim($path, '/');
         }
         // TRIM STANDARD PARAMS
         if (($pos = strpos($path, '?')) !== false) {
             $path = substr($path, 0, $pos);
         }
         // TRIM ANCHORS
         if (($pos = strpos($path, '#')) !== false) {
             $path = substr($path, 0, $pos);
         }
         // RETRY RESOLVE VIA PATHLIST
         if (self::resolve_from_pathlist($path)) {
             return;
         }
         // smart redirects option
         if ($REX['ADDON']['seo42']['settings']['smart_redirects']) {
             $trimmedReuqestUri = trim($_SERVER['REQUEST_URI'], '/');
             $trimmedReuqestUri = str_replace('.html', '', $trimmedReuqestUri);
             $requestUriWithCorrectUrlEnding = $trimmedReuqestUri . $REX['ADDON']['seo42']['settings']['url_ending'];
             if (isset($SEO42_URLS[$requestUriWithCorrectUrlEnding])) {
                 $redirect = array('id' => $SEO42_URLS[$requestUriWithCorrectUrlEnding]['id'], 'clang' => $SEO42_URLS[$requestUriWithCorrectUrlEnding]['clang'], 'status' => 301);
                 return self::redirect($redirect);
             }
         }
         // auto redirects
         if ($REX['ADDON']['seo42']['settings']['auto_redirects'] == SEO42_AUTO_REDIRECT_URL_REWRITE || $REX['ADDON']['seo42']['settings']['auto_redirects'] == SEO42_AUTO_REDIRECT_URL_REWRITE_R3) {
             // smart redirects for old fashioned standard redaxo rewrite methods
             if ($REX['ADDON']['seo42']['settings']['auto_redirects'] == SEO42_AUTO_REDIRECT_URL_REWRITE_R3) {
                 preg_match('/\\/(.*(\\.))?((?P<clang>[0-9]+)(.*)\\-(?P<id>[0-9]+))((\\-|\\.).*)/', $_SERVER['REQUEST_URI'], $url_params);
             } else {
                 preg_match('/\\/(.*(\\.))?((?P<id>[0-9]+)\\-(?P<clang>[0-9]+))((\\-|\\.).*)/', $_SERVER['REQUEST_URI'], $url_params);
             }
             if ($url_params !== false && isset($url_params['id']) && isset($url_params['clang'])) {
                 $article = OOArticle::getArticleById($url_params['id'], $url_params['clang']);
                 if (OOArticle::isValid($article)) {
                     $redirect = array('id' => $url_params['id'], 'clang' => $url_params['clang'], 'status' => 301);
                     return self::redirect($redirect);
                 }
             }
         }
         // check for possible lang slug to load up correct language for 404 article
         $firstSlashPos = strpos($path, '/');
         if ($firstSlashPos !== false) {
             $possibleLangSlug = substr($path, 0, $firstSlashPos);
             $langSlugs = array();
             foreach ($REX['CLANG'] as $clangId => $clangName) {
                 $langSlugs[$clangId] = seo42::getLangUrlSlug($clangId);
             }
             $clangId = array_search($possibleLangSlug, $langSlugs);
             if ($clangId !== false) {
                 $clang = $clangId;
                 $REX['CUR_CLANG'] = $clang;
             }
         }
         // GET ID FROM EXTENSION POINT
         $ep = rex_register_extension_point('SEO42_ARTICLE_ID_NOT_FOUND', '');
         if (isset($ep['article_id']) && $ep['article_id'] > 0) {
             if (isset($ep['clang']) && $ep['clang'] > -1) {
                 $clang = $ep['clang'];
             }
             return self::setArticleId($ep['article_id'], $clang);
         }
         // STILL NO MATCH -> 404
         seo42::set404ResponseFlag();
         self::setArticleId($notfound_id, $clang);
     }
 }
    function getLinkButton($id, $article_id, $category = '')
    {
        global $REX, $I18N;
        $art_name = '';
        $clang = '';
        $art = OOArticle::getArticleById($article_id);
        // Falls ein Artikel vorausgewählt ist, dessen Namen anzeigen und beim öffnen der Linkmap dessen Kategorie anzeigen
        if (OOArticle::isValid($art)) {
            $art_name = $art->getName();
            $category = $art->getCategoryId();
        }
        $open_params = '&clang=' . $REX['CUR_CLANG'];
        if ($category != '') {
            $open_params .= '&category_id=' . $category;
        }
        $open_class = 'rex-icon-file-open rex-icon-file-open-inactive';
        $delete_class = 'rex-icon-file-delete rex-icon-file-delete-inactive';
        $open_func = '';
        $delete_func = '';
        if ($REX['USER']->hasStructurePerm()) {
            $open_class = 'rex-icon-file-open';
            $delete_class = 'rex-icon-file-delete';
            $open_func = 'openLinkMap(\'LINK_' . $id . '\', \'' . $open_params . '\');';
            $delete_func = 'deleteREXLink(' . $id . ');';
        }
        $media = '
	<div class="rex-widget">
		<div class="rex-widget-link">
      <p class="rex-widget-field">
  			<input type="hidden" name="LINK[' . $id . ']" id="LINK_' . $id . '" value="' . $article_id . '" />
  			<input type="text" size="30" name="LINK_NAME[' . $id . ']" value="' . htmlspecialchars($art_name) . '" id="LINK_' . $id . '_NAME" readonly="readonly" />
		  </p>
       <p class="rex-widget-icons rex-widget-1col">
       	<span class="rex-widget-column rex-widget-column-first">
  	     	<a href="#" class="' . $open_class . '" onclick="' . $open_func . 'return false;" title="' . $I18N->msg('var_link_open') . '"' . rex_tabindex() . '></a>
 	  			<a href="#" class="' . $delete_class . '" onclick="' . $delete_func . 'return false;" title="' . $I18N->msg('var_link_delete') . '"' . rex_tabindex() . '></a>
	 	  	</span>
 		  </p>
 		</div>
 	</div>
 	<div class="rex-clearer"></div>';
        return $media;
    }
Exemple #16
0
    public static function getDebugInfo($articleId = 0)
    {
        global $I18N, $REX;
        if ($articleId != 0) {
            self::initArticle($articleId);
        }
        if (!OOArticle::isValid(self::$curArticle)) {
            return '';
        }
        $out = '<div id="seo42-debug">';
        $out .= '<h1>---------- SEO42 DEBUG BEGIN ----------<h1>';
        // general information
        $out .= '<h2>General Information</h2>';
        $out .= '<table>';
        $out .= '<tr><td class="left"><code>REDAXO Version</code></td><td class="right"><code>' . $REX['VERSION'] . '.' . $REX['SUBVERSION'] . '.' . $REX['MINORVERSION'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>SEO42 Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['seo42'] . '</code></td></tr>';
        $out .= '<tr><td class="left"><code>PHP Version</code></td><td class="right"><code>' . phpversion() . '</code></td></tr>';
        if (isset($REX['ADDON']['version']['community'])) {
            $out .= '<tr><td class="left"><code>Community Version</code></td><td class="right"><code>' . $REX['ADDON']['version']['community'] . '</code></td></tr>';
        }
        $out .= '</table>';
        // methods
        $out .= '<h2>Class Methods</h2>';
        $out .= '<table>';
        $out .= self::getDebugInfoRow('rex_getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTrimmedUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getFullUrl', array(self::$curArticle->getId()));
        $out .= self::getDebugInfoRow('seo42::getTitle');
        $out .= self::getDebugInfoRow('seo42::getTitlePart');
        $out .= self::getDebugInfoRow('seo42::getDescription');
        $out .= self::getDebugInfoRow('seo42::getKeywords');
        $out .= self::getDebugInfoRow('seo42::getRobotRules');
        $out .= self::getDebugInfoRow('seo42::getCanonicalUrl');
        $out .= self::getDebugInfoRow('seo42::getArticleName');
        $out .= self::getDebugInfoRow('seo42::isStartArticle');
        $out .= self::getDebugInfoRow('seo42::getWebsiteName');
        $out .= self::getDebugInfoRow('seo42::getLangCode', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangSlug', array('0'));
        $out .= self::getDebugInfoRow('seo42::getLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getOriginalLangName', array('0'));
        $out .= self::getDebugInfoRow('seo42::getServerProtocol');
        $out .= self::getDebugInfoRow('seo42::getBaseUrl');
        $out .= self::getDebugInfoRow('seo42::getServerUrl');
        $out .= self::getDebugInfoRow('seo42::getServer');
        $out .= self::getDebugInfoRow('seo42::getServerWithSubDir');
        $out .= self::getDebugInfoRow('seo42::getServerSubDir');
        $out .= self::getDebugInfoRow('seo42::isWwwServerUrl');
        $out .= self::getDebugInfoRow('seo42::hasTemplateBaseTag');
        $out .= self::getDebugInfoRow('seo42::isSubDirInstall');
        $out .= self::getDebugInfoRow('seo42::isMultiLangInstall');
        $out .= self::getDebugInfoRow('seo42::getLangCount');
        $out .= self::getDebugInfoRow('seo42::getTitleDelimiter');
        $out .= self::getDebugInfoRow('seo42::getUrlStart');
        $out .= self::getDebugInfoRow('seo42::has404ResponseFlag');
        $out .= self::getDebugInfoRow('seo42::getQueryString');
        $out .= self::getDebugInfoRow('seo42::getMediaDir');
        $out .= self::getDebugInfoRow('seo42::getMediaDirName');
        $out .= self::getDebugInfoRow('seo42::getMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaUrl', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getAbsoluteMediaFile', array('image.png'));
        $out .= self::getDebugInfoRow('seo42::getMediaAddonDir');
        $out .= self::getDebugInfoRow('seo42::getLangTags');
        $out .= self::getDebugInfoRow('seo42::getHtml');
        $out .= self::getDebugInfoRow('seo42::getImageTag', array('image.png', 'rex_mediapool_detail', '150', '100'));
        $out .= self::getDebugInfoRow('seo42::getImageManagerFile', array('image.png', 'rex_mediapool_detail'));
        $out .= self::getDebugInfoRow('seo42::getDownloadFile', array('doc.pdf'));
        $out .= self::getDebugInfoRow('seo42::getUrlString', array("The Hitchhiker's Guide to the Galaxy!"));
        $out .= self::getDebugInfoRow('seo42::getAnswer');
        $out .= '</table>';
        // settings
        $out .= '<h2>Settings</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['ADDON']['seo42']['settings'], true);
        $out .= '</pre>';
        // cached redirects
        $out .= '<h2>Cached Redirects</h2>';
        $out .= '<pre class="rex-code">';
        $out .= seo42_utils::print_r_pretty($REX['SEO42_CACHED_REDIRECTS'], true);
        $out .= '</pre>';
        // pathlist
        $out .= '<h2>Pathlist</h2>';
        $pathlistRoot = SEO42_PATHLIST;
        if (file_exists($pathlistRoot)) {
            $content = rex_get_file_contents($pathlistRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $pathlistRoot;
        }
        // .htaccess
        $out .= '<h2>.htaccess</h2>';
        $htaccessRoot = $REX['FRONTEND_PATH'] . '/.htaccess';
        if (file_exists($htaccessRoot)) {
            $content = rex_get_file_contents($htaccessRoot);
            $out .= rex_highlight_string($content, true);
        } else {
            $out .= 'File not found: ' . $htaccessRoot;
        }
        $out .= '<h1>---------- SEO42 DEBUG END ----------</h1>';
        $out .= '</div>';
        $out .= '<style type="text/css">
					#seo42-debug h1 {
						font-size: 16px;
						margin: 10px 0;
					}

					#seo42-debug h2 {
						margin: 15px 0;
						font-size: 14px;
					}

					#seo42-debug .rex-code {
						border: 1px solid #F2353A;
					}

					#seo42-debug code,
					#seo42-debug .rex-code {
						color: #000;
						background: #FAF9F5;
					}

					#seo42-debug table {
						width: 100%;
						border-collapse: collapse;
						border-spacing: 0;
						background: #FAF9F5;
					}

					#seo42-debug table th,
					#seo42-debug table thead td {
						font-weight: bold;
					}

					#seo42-debug table td, 
					#seo42-debug table th {
						padding: 12px;
						border: 1px solid #F2353A;
						text-align: left;
					}

					#seo42-debug table td.left {
						width: 280px;
					}
				</style>';
        return $out;
    }