Ejemplo n.º 1
0
 static function replaceVars($template, $er = array())
 {
     $r = rex_extension::registerPoint(new rex_extension_point('YFORM_EMAIL_BEFORE_REPLACEVARS', ['template' => $template, 'search_replace' => $er, 'status' => false]));
     $template = $r['template'];
     $er = $r['search_replace'];
     $status = $r['status'];
     if ($status) {
         return true;
     }
     $er['REX_SERVER'] = rex::getServer();
     $er['REX_ERROR_EMAIL'] = rex::getErrorEmail();
     $er['REX_SERVERNAME'] = rex::getServerName();
     $er['REX_NOTFOUND_ARTICLE_ID'] = rex_article::getNotfoundArticleId();
     $er['REX_ARTICLE_ID'] = rex_article::getCurrentId();
     $template['body'] = rex_var::parse($template['body'], '', 'yform_email_template', $er);
     $template['body_html'] = rex_var::parse($template['body_html'], '', 'yform_email_template', $er);
     // rex_vars bug: sonst wird der Zeilenumbruch entfernt - wenn DATA_VAR am Ende einer Zeile
     if (rex_string::versionCompare(rex::getVersion(), '5.0.1', '<')) {
         $template['body'] = str_replace("?>\r", "?>\r\n\r", $template['body']);
         $template['body'] = str_replace("?>\n", "?>\n\r\n", $template['body']);
         $template['body_html'] = str_replace("?>\r", "?>\r\n\r", $template['body_html']);
         $template['body_html'] = str_replace("?>\n", "?>\n\r\n", $template['body_html']);
     }
     $template['body'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body', $template['body']));
     $template['body_html'] = rex_file::getOutput(rex_stream::factory('yform/email/template/' . $template['name'] . '/body_html', $template['body_html']));
     return $template;
 }
Ejemplo n.º 2
0
 public static function init()
 {
     self::$domainsByMountId = [];
     self::$domainsByName = [];
     self::$aliasDomains = [];
     self::$paths = [];
     self::addDomain(new rex_yrewrite_domain('undefined', 0, rex_article::getSiteStartArticleId(), rex_article::getNotfoundArticleId()));
     self::$pathfile = rex_path::addonCache('yrewrite', 'pathlist.php');
     self::$configfile = rex_path::addonCache('yrewrite', 'config.php');
     self::readConfig();
     self::readPathFile();
 }
Ejemplo n.º 3
0
 public static function init()
 {
     if (null === self::$scheme) {
         self::setScheme(new rex_yrewrite_scheme());
     }
     self::$domainsByMountId = [];
     self::$domainsByName = [];
     self::$aliasDomains = [];
     self::$paths = [];
     $path = dirname($_SERVER['SCRIPT_NAME']);
     if (rex::isBackend()) {
         $path = dirname($path);
     }
     $path = rtrim($path, '/') . '/';
     self::addDomain(new rex_yrewrite_domain('default', null, $path, 0, rex_article::getSiteStartArticleId(), rex_article::getNotfoundArticleId()));
     self::$pathfile = rex_path::addonCache('yrewrite', 'pathlist.php');
     self::$configfile = rex_path::addonCache('yrewrite', 'config.php');
     self::readConfig();
     self::readPathFile();
 }
Ejemplo n.º 4
0
 /**
  * Returns  true if this Article is the not found article.
  *
  * @return bool
  */
 public function isNotFoundArticle()
 {
     return $this->id == rex_article::getNotfoundArticleId();
 }
Ejemplo n.º 5
0
 /**
  * Löscht einen Artikel.
  *
  * @param int $id ArtikelId des Artikels, der gelöscht werden soll
  *
  * @throws rex_api_exception
  *
  * @return string Eine Statusmeldung
  */
 public static function _deleteArticle($id)
 {
     // artikel loeschen
     //
     // kontrolle ob erlaubnis nicht hier.. muss vorher geschehen
     //
     // -> startarticle = 0
     // --> artikelfiles löschen
     // ---> article
     // ---> content
     // ---> clist
     // ---> alist
     // -> startarticle = 1
     // --> rekursiv aufrufen
     if ($id == rex_article::getSiteStartArticleId()) {
         throw new rex_api_exception(rex_i18n::msg('cant_delete_sitestartarticle'));
     }
     if ($id == rex_article::getNotfoundArticleId()) {
         throw new rex_api_exception(rex_i18n::msg('cant_delete_notfoundarticle'));
     }
     $ART = rex_sql::factory();
     $ART->setQuery('select * from ' . rex::getTablePrefix() . 'article where id=? and clang_id=?', [$id, rex_clang::getStartId()]);
     $message = '';
     if ($ART->getRows() > 0) {
         $parent_id = $ART->getValue('parent_id');
         $message = rex_extension::registerPoint(new rex_extension_point('ART_PRE_DELETED', $message, ['id' => $id, 'parent_id' => $parent_id, 'name' => $ART->getValue('name'), 'status' => $ART->getValue('status'), 'priority' => $ART->getValue('priority'), 'path' => $ART->getValue('path'), 'template_id' => $ART->getValue('template_id')]));
         if ($ART->getValue('startarticle') == 1) {
             $message = rex_i18n::msg('category_deleted');
             $SART = rex_sql::factory();
             $SART->setQuery('select * from ' . rex::getTablePrefix() . 'article where parent_id=? and clang_id=?', [$id, rex_clang::getStartId()]);
             for ($i = 0; $i < $SART->getRows(); ++$i) {
                 self::_deleteArticle($id);
                 $SART->next();
             }
         } else {
             $message = rex_i18n::msg('article_deleted');
         }
         rex_article_cache::delete($id);
         $ART->setQuery('delete from ' . rex::getTablePrefix() . 'article where id=' . $id);
         $ART->setQuery('delete from ' . rex::getTablePrefix() . 'article_slice where article_id=' . $id);
         // --------------------------------------------------- Listen generieren
         rex_article_cache::deleteLists($parent_id);
         return $message;
     } else {
         throw new rex_api_exception(rex_i18n::msg('category_doesnt_exist'));
     }
 }
Ejemplo n.º 6
0
        if (rex_be_controller::getCurrentPagePart(1) == 'content') {
            rex_be_controller::getPageObject('structure')->setIsActive(true);
        }
    });
    if (rex_be_controller::getCurrentPagePart(1) == 'system') {
        rex_system_setting::register(new rex_system_setting_default_template_id());
    }
    rex_extension::register('CLANG_DELETED', function (rex_extension_point $ep) {
        $del = rex_sql::factory();
        $del->setQuery('delete from ' . rex::getTablePrefix() . "article_slice where clang_id='" . $ep->getParam('clang')->getId() . "'");
    });
} else {
    rex_extension::register('FE_OUTPUT', function (rex_extension_point $ep) {
        $content = $ep->getSubject();
        $article = new rex_article_content();
        $article->setCLang(rex_clang::getCurrentId());
        if ($article->setArticleId(rex_article::getCurrentId())) {
            $content .= $article->getArticleTemplate();
        } else {
            $content .= 'Kein Startartikel selektiert / No starting Article selected. Please click here to enter <a href="' . rex_url::backendController() . '">redaxo</a>';
            rex_response::sendPage($content);
            exit;
        }
        $art_id = $article->getArticleId();
        if ($art_id == rex_article::getNotfoundArticleId() && $art_id != rex_article::getSiteStartArticleId()) {
            rex_response::setStatus(rex_response::HTTP_NOT_FOUND);
        }
        // ----- inhalt ausgeben
        rex_response::sendPage($content, $article->getValue('updatedate'));
    });
}
Ejemplo n.º 7
0
rex_perm::register('moveCategory[]', null, rex_perm::OPTIONS);
rex_perm::register('copyArticle[]', null, rex_perm::OPTIONS);
rex_perm::register('copyContent[]', null, rex_perm::OPTIONS);
rex_perm::register('publishArticle[]', null, rex_perm::OPTIONS);
rex_perm::register('publishCategory[]', null, rex_perm::OPTIONS);
rex_perm::register('article2startarticle[]', null, rex_perm::OPTIONS);
rex_perm::register('article2category[]', null, rex_perm::OPTIONS);
rex_complex_perm::register('structure', 'rex_structure_perm');
require_once __DIR__ . '/functions/function_rex_url.php';
$this->setProperty('start_article_id', $this->getConfig('start_article_id', 1));
$this->setProperty('notfound_article_id', $this->getConfig('notfound_article_id', 1));
if (rex_request('article_id', 'int') == 0) {
    $this->setProperty('article_id', rex_article::getSiteStartArticleId());
} else {
    $article_id = rex_request('article_id', 'int');
    $article_id = rex_article::get($article_id) ? $article_id : rex_article::getNotfoundArticleId();
    $this->setProperty('article_id', $article_id);
}
if (rex::isBackend() && rex::getUser()) {
    rex_view::addJsFile($this->getAssetsUrl('linkmap.js'));
    rex_extension::register('PAGE_SIDEBAR', function () {
        $category_id = rex_request('category_id', 'int');
        $article_id = rex_request('article_id', 'int');
        $clang = rex_request('clang', 'int');
        $ctype = rex_request('ctype', 'int');
        $category_id = rex_category::get($category_id) ? $category_id : 0;
        $article_id = rex_article::get($article_id) ? $article_id : 0;
        $clang = rex_clang::exists($clang) ? $clang : rex_clang::getStartId();
        // TODO - CHECK PERM
        $context = new rex_context(['page' => 'structure', 'category_id' => $category_id, 'article_id' => $article_id, 'clang' => $clang, 'ctype' => $ctype]);
        // check if a new category was folded