function enterObject()
 {
     $article = new rex_article();
     if ($article->setArticleId($this->getElement(1))) {
         $this->params['form_output'][$this->getId()] = $this->parse('value.article.tpl.php', array('article' => $article));
     }
 }
예제 #2
0
function rex_newsletter_sendmail($userinfo, $aid, $mail_reply, $mail_subject)
{
    global $REX;
    $tmp_redaxo = $REX['REDAXO'];
    $REX['REDAXO'] = true;
    // ***** HTML VERSION KOMPLETT
    $REX_ARTICLE = new rex_article();
    $REX_ARTICLE->setCLang(0);
    $REX_ARTICLE->setArticleId($aid);
    $REX_ARTICLE->getContentAsQuery(TRUE);
    // $REX_ARTICLE->setTemplateId(xx);
    $REX['ADDON']['NEWSLETTER_TEXT'] = FALSE;
    $html_body = $REX_ARTICLE->getArticleTemplate();
    // ***** TEXT VERSION
    $REX_ARTICLE = new rex_article();
    $REX_ARTICLE->setCLang(0);
    $REX_ARTICLE->setArticleId($aid);
    $REX_ARTICLE->getContentAsQuery(TRUE);
    // $REX_ARTICLE->setTemplateId(xx);
    $REX['ADDON']['NEWSLETTER_TEXT'] = TRUE;
    // FILTERN VERSION KOMPLETT
    $text_body = $REX_ARTICLE->getArticle();
    $text_body = str_replace("<br />", "<br />", $text_body);
    $text_body = str_replace("<p>", "\n\n</p>", $text_body);
    $text_body = str_replace("<ul>", "\n\n</ul>", $text_body);
    $text_body = preg_replace("#(\\<)(.*)(\\>)#imsU", "", $text_body);
    $text_body = html_entity_decode($text_body);
    $REX['REDAXO'] = true;
    // ***** MAIL VERSAND
    // Allgemeine Initialisierung
    // $mail = new PHPMailer();
    $mail = new rex_mailer();
    $mail->AddAddress($userinfo["email"]);
    $mail->From = $mail_reply;
    $mail->FromName = $mail_reply;
    $subject = $mail_subject;
    // Subject
    // Bodies
    // html
    foreach ($userinfo as $k => $v) {
        $subject = str_replace("###" . $k . "###", $v, $subject);
        $html_body = str_replace("###" . $k . "###", $v, $html_body);
        $text_body = str_replace("###" . $k . "###", $v, $text_body);
        $subject = str_replace("###" . strtoupper($k) . "###", $v, $subject);
        $html_body = str_replace("###" . strtoupper($k) . "###", $v, $html_body);
        $text_body = str_replace("###" . strtoupper($k) . "###", $v, $text_body);
    }
    // text
    // echo "<pre>$text_body</pre>";
    $mail->Subject = $subject;
    $mail->AltBody = $text_body;
    $mail->Body = $html_body;
    $mail->Send();
    $REX['REDAXO'] = $tmp_redaxo;
}
예제 #3
0
 public static function addNewstoSitemap($params)
 {
     $mainArticle = rex_asd_news_config::getConfig('article');
     $mainArticle = new rex_article($mainArticle);
     foreach (rex_asd_news::getByWhere(array('clang' => null)) as $news) {
         /** @var rex_asd_news $news */
         $fragment = array('loc' => $news->getUrl(), 'lastmod' => $news->getPublishDate()->format('c'), 'changefreq' => self::calc_article_changefreq($news->getPublishDate()->getTimestamp()), 'priority' => self::calc_article_priority($mainArticle->getValue('id'), $mainArticle->getValue('clang'), $mainArticle->getValue('path') . '|' . $news->getValue('id')));
         $params['subject'][rex_asd_news_config::getName()][] = $fragment;
     }
     return $params['subject'];
 }
 /**
  * Wert für die Ausgabe
  */
 function matchArticle($content)
 {
     $var = 'REX_ARTICLE';
     $matches = $this->getArticleInputParams($content, $var);
     foreach ($matches as $match) {
         list($param_str, $article_id, $clang) = $match;
         $article = new rex_article($article_id, $clang);
         $content = str_replace($var . '[' . $param_str . ']', $article->getArticle(), $content);
     }
     return $content;
 }
 static function getListValue($params)
 {
     if (intval($params['value']) < 1) {
         return '-';
     }
     if ($art = new rex_article($params['value'])) {
         return $art->getValue('name');
     } else {
         return 'article ' . $params['value'] . ' not found';
     }
 }
예제 #6
0
 /**
  * @param rex_article         $art
  * @param rex_yrewrite_domain $domain
  *
  * @return string|false
  */
 public function getCustomUrl(rex_article $art, rex_yrewrite_domain $domain)
 {
     if ($domain->getStartId() == $art->getId()) {
         if ($domain->getStartClang() == $art->getClang()) {
             return '/';
         }
         return $this->getClang($art->getClang(), $domain) . '/';
     }
     if ($url = $art->getValue('yrewrite_url')) {
         return $url;
     }
     return false;
 }
예제 #7
0
/**
 * Gibt eine Url zu einem Artikel zurück.
 *
 * @param string       $_id
 * @param int|string   $_clang  SprachId des Artikels
 * @param array|string $_params Array von Parametern
 * @param bool         $escape  Flag whether the argument separator "&" should be escaped (&amp;)
 *
 * @return string
 *
 * @package redaxo\structure
 */
function rex_getUrl($_id = '', $_clang = '', $_params = '', $escape = true)
{
    $id = (int) $_id;
    $clang = (int) $_clang;
    // ----- get id
    if ($id == 0) {
        $id = rex::getProperty('article_id');
    }
    // ----- get clang
    // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
    // Die rexExtension muss selbst entscheiden was sie damit macht
    if ($_clang === '' && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
        $clang = rex_clang::getCurrentId();
    }
    // ----- get params
    $param_string = rex_param_string($_params, $escape ? '&amp;' : '&');
    $name = 'NoName';
    if ($id != 0) {
        $ooa = rex_article::get($id, $clang);
        if ($ooa) {
            $name = rex_parse_article_name($ooa->getName());
        }
    }
    // ----- EXTENSION POINT
    $url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'name' => $name, 'clang' => $clang, 'params' => $param_string, 'escape' => $escape]));
    if ($url == '') {
        $_clang = '';
        if (rex_clang::count() > 1) {
            $_clang .= ($escape ? '&amp;' : '&') . 'clang=' . $clang;
        }
        $url = rex_url::frontendController() . '?article_id=' . $id . $_clang . $param_string;
    }
    return $url;
}
예제 #8
0
 public static function getForward($params)
 {
     // Url wurde von einer anderen Extension bereits gesetzt
     if (isset($params['subject']) && $params['subject'] != '') {
         return $params['subject'];
     }
     self::init();
     $domain = $params['domain'];
     if ($domain == 'undefined') {
         $domain = '';
     }
     $url = $params['url'];
     foreach (self::$paths as $p) {
         if ($p['domain'] == $domain && ($p['url'] == $url || $p['url'] . '/' == $url)) {
             $forward_url = '';
             if ($p['type'] == 'article' && ($art = rex_article::get($p['article_id'], $p['clang']))) {
                 $forward_url = rex_getUrl($p['article_id'], $p['clang']);
             } elseif ($p['type'] == 'media' && ($media = rex_media::get($p['media']))) {
                 $forward_url = '/files/' . $p['media'];
             } elseif ($p['type'] == 'extern' && $p['extern'] != '') {
                 $forward_url = $p['extern'];
             }
             if ($forward_url != '') {
                 header('HTTP/1.1 ' . self::$movetypes[$p['movetype']]);
                 header('Location: ' . $forward_url);
                 exit;
             }
         }
     }
     return false;
 }
예제 #9
0
파일: var_link.php 프로젝트: DECAF/redaxo
 public static function getWidget($id, $name, $value, array $args = [])
 {
     $art_name = '';
     $art = rex_article::get($value);
     $category = 0;
     // Falls ein Artikel vorausgewählt ist, dessen Namen anzeigen und beim öffnen der Linkmap dessen Kategorie anzeigen
     if ($art instanceof rex_article) {
         $art_name = $art->getName();
         $category = $art->getCategoryId();
     }
     $open_params = '&clang=' . rex_clang::getCurrentId();
     if ($category || isset($args['category']) && ($category = (int) $args['category'])) {
         $open_params .= '&category_id=' . $category;
     }
     $class = ' rex-disabled';
     $open_func = '';
     $delete_func = '';
     if (rex::getUser()->getComplexPerm('structure')->hasStructurePerm()) {
         $class = '';
         $open_func = 'openLinkMap(\'REX_LINK_' . $id . '\', \'' . $open_params . '\');';
         $delete_func = 'deleteREXLink(' . $id . ');';
     }
     $e = [];
     $e['field'] = '<input class="form-control" type="text" name="REX_LINK_NAME[' . $id . ']" value="' . htmlspecialchars($art_name) . '" id="REX_LINK_' . $id . '_NAME" readonly="readonly" /><input type="hidden" name="' . $name . '" id="REX_LINK_' . $id . '" value="' . $value . '" />';
     $e['functionButtons'] = '
                     <a href="#" class="btn btn-popup' . $class . '" onclick="' . $open_func . 'return false;" title="' . rex_i18n::msg('var_link_open') . '"><i class="rex-icon rex-icon-open-linkmap"></i></a>
                     <a href="#" class="btn btn-popup' . $class . '" onclick="' . $delete_func . 'return false;" title="' . rex_i18n::msg('var_link_delete') . '"><i class="rex-icon rex-icon-delete-link"></i></a>';
     $fragment = new rex_fragment();
     $fragment->setVar('elements', [$e], false);
     $media = $fragment->parse('core/form/widget.php');
     return $media;
 }
예제 #10
0
/**
 * Gibt eine Url zu einem Artikel zurück.
 *
 * @param int|null $id
 * @param int|null $clang     SprachId des Artikels
 * @param array    $params    Array von Parametern
 * @param string   $separator
 *
 * @return string
 *
 * @package redaxo\structure
 */
function rex_getUrl($id = null, $clang = null, array $params = [], $separator = '&amp;')
{
    $id = (int) $id;
    $clang = (int) $clang;
    // ----- get id
    if ($id == 0) {
        $id = rex_article::getCurrentId();
    }
    // ----- get clang
    // Wenn eine rexExtension vorhanden ist, immer die clang mitgeben!
    // Die rexExtension muss selbst entscheiden was sie damit macht
    if (!rex_clang::exists($clang) && (rex_clang::count() > 1 || rex_extension::isRegistered('URL_REWRITE'))) {
        $clang = rex_clang::getCurrentId();
    }
    // ----- EXTENSION POINT
    $url = rex_extension::registerPoint(new rex_extension_point('URL_REWRITE', '', ['id' => $id, 'clang' => $clang, 'params' => $params, 'separator' => $separator]));
    if ($url == '') {
        if (rex_clang::count() > 1) {
            $clang = $separator . 'clang=' . $clang;
        } else {
            $clang = '';
        }
        $params = rex_string::buildQuery($params, $separator);
        $params = $params ? $separator . $params : '';
        $url = rex_url::frontendController() . '?article_id=' . $id . $clang . $params;
    }
    return $url;
}
예제 #11
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;
 }
예제 #12
0
 public function isValid($value)
 {
     $article = rex_article::get($value);
     if (!$article instanceof rex_article) {
         return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
     }
     return true;
 }
예제 #13
0
 public function getForm(array $params)
 {
     $OOArt = rex_article::get($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 parent::renderFormAndSave(self::PREFIX, $params);
 }
예제 #14
0
 public static function getArticleValue($id, $field, $clang = null)
 {
     if ($clang === null) {
         $clang = rex_clang::getCurrentId();
     }
     $article = rex_article::get($id, $clang);
     return htmlspecialchars($article->getValue($field));
 }
예제 #15
0
 public function hasValue($value)
 {
     // bc
     if ($this->viasql) {
         return parent::hasValue($value);
     }
     $value = $this->correctValue($value);
     return rex_article::get($this->article_id, $this->clang)->hasValue($value);
 }
예제 #16
0
 public function setValue($value)
 {
     $value = (int) $value;
     $article = rex_article::get($value);
     if (!$article instanceof rex_article) {
         return rex_i18n::msg('system_setting_' . $this->key . '_invalid');
     }
     rex_config::set('structure', $this->key, $value);
     return true;
 }
예제 #17
0
 /**
  * Löscht die gecachten Meta-Dateien eines Artikels. Wenn keine clang angegeben, wird
  * der Artikel in allen Sprachen gelöscht.
  *
  * @param int $id    ArtikelId des Artikels
  * @param int $clang ClangId des Artikels
  *
  * @return bool True on success, False on errro
  */
 public static function deleteMeta($id, $clang = null)
 {
     // sanity check
     if ($id < 0) {
         return false;
     }
     $cachePath = rex_path::addonCache('structure');
     foreach (rex_clang::getAllIds() as $_clang) {
         if ($clang !== null && $clang != $_clang) {
             continue;
         }
         rex_file::delete($cachePath . $id . '.' . $_clang . '.article');
         rex_article::clearInstance([$id, $_clang]);
         rex_category::clearInstance([$id, $_clang]);
     }
     return true;
 }
예제 #18
0
 public static function getWidget($id, $name, $value, array $args = [])
 {
     $open_params = '&clang=' . rex_clang::getCurrentId();
     if (isset($args['category']) && ($category = (int) $args['category'])) {
         $open_params .= '&amp;category_id=' . $category;
     }
     $options = '';
     $linklistarray = explode(',', $value);
     if (is_array($linklistarray)) {
         foreach ($linklistarray as $link) {
             if ($link != '') {
                 if ($article = rex_article::get($link)) {
                     $options .= '<option value="' . $link . '">' . htmlspecialchars($article->getName()) . '</option>';
                 }
             }
         }
     }
     $disabled = ' disabled';
     $open_func = '';
     $delete_func = '';
     if (rex::getUser()->getComplexPerm('structure')->hasStructurePerm()) {
         $disabled = '';
         $open_func = 'openREXLinklist(' . $id . ', \'' . $open_params . '\');';
         $delete_func = 'deleteREXLinklist(' . $id . ');';
     }
     $e = [];
     $e['field'] = '
             <select class="form-control" name="REX_LINKLIST_SELECT[' . $id . ']" id="REX_LINKLIST_SELECT_' . $id . '" size="10">
                 ' . $options . '
             </select>
             <input type="hidden" name="' . $name . '" id="REX_LINKLIST_' . $id . '" value="' . $value . '" />';
     $e['moveButtons'] = '
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'top\');return false;" title="' . rex_i18n::msg('var_linklist_move_top') . '"><i class="rex-icon rex-icon-top"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'up\');return false;" title="' . rex_i18n::msg('var_linklist_move_up') . '"><i class="rex-icon rex-icon-up"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'down\');return false;" title="' . rex_i18n::msg('var_linklist_move_down') . '"><i class="rex-icon rex-icon-down"></i></a>
                 <a href="#" class="btn btn-popup" onclick="moveREXLinklist(' . $id . ',\'bottom\');return false;" title="' . rex_i18n::msg('var_linklist_move_bottom') . '"><i class="rex-icon rex-icon-bottom"></i></a>';
     $e['functionButtons'] = '
                 <a href="#" class="btn btn-popup" onclick="' . $open_func . 'return false;" title="' . rex_i18n::msg('var_link_open') . '"' . $disabled . '><i class="rex-icon rex-icon-open-linkmap"></i></a>
                 <a href="#" class="btn btn-popup" onclick="' . $delete_func . 'return false;" title="' . rex_i18n::msg('var_link_delete') . '"' . $disabled . '><i class="rex-icon rex-icon-delete-link"></i></a>';
     $fragment = new rex_fragment();
     $fragment->setVar('elements', [$e], false);
     $link = $fragment->parse('core/form/widget_list.php');
     return $link;
 }
예제 #19
0
 public function execute()
 {
     $article_id = rex_request('article_id', 'int');
     $clang = rex_request('clang', 'int');
     $slice_id = rex_request('slice_id', 'int');
     $direction = rex_request('direction', 'string');
     $ooArt = rex_article::get($article_id, $clang);
     if (!$ooArt instanceof rex_article) {
         throw new rex_api_exception('Unable to find article with id "' . $article_id . '" and clang "' . $clang . '"!');
     }
     $category_id = $ooArt->getCategoryId();
     /**
      * @var rex_user
      */
     $user = rex::getUser();
     // check permissions
     if (!$user->hasPerm('moveSlice[]')) {
         throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
     }
     if (!$user->getComplexPerm('structure')->hasCategoryPerm($category_id)) {
         throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
     }
     // modul und rechte vorhanden ?
     $CM = rex_sql::factory();
     $CM->setQuery('select * from ' . rex::getTablePrefix() . 'article_slice left join ' . rex::getTablePrefix() . 'module on ' . rex::getTablePrefix() . 'article_slice.module_id=' . rex::getTablePrefix() . 'module.id where ' . rex::getTablePrefix() . "article_slice.id='{$slice_id}' and clang_id={$clang}");
     if ($CM->getRows() != 1) {
         throw new rex_api_exception(rex_i18n::msg('module_not_found'));
     } else {
         $module_id = (int) $CM->getValue(rex::getTablePrefix() . 'article_slice.module_id');
         // ----- RECHTE AM MODUL ?
         if ($user->getComplexPerm('modules')->hasPerm($module_id)) {
             $message = rex_content_service::moveSlice($slice_id, $clang, $direction);
         } else {
             throw new rex_api_exception(rex_i18n::msg('no_rights_to_this_function'));
         }
     }
     $result = new rex_api_result(true, $message);
     return $result;
 }
예제 #20
0
function rex_metainfo_content_sidebar($extionPointParams)
{
    $params = $extionPointParams->getParams();
    $article = rex_article::get($params['article_id'], $params['clang']);
    $articleStatusTypes = rex_article_service::statusTypes();
    $panel = '';
    $panel .= '<dl class="dl-horizontal">';
    $panel .= '<dt>' . rex_i18n::msg('created_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('createuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('created_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('createdate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_by') . '</dt>';
    $panel .= '<dd>' . $article->getValue('updateuser') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('updated_on') . '</dt>';
    $panel .= '<dd>' . rex_formatter::strftime($article->getValue('updatedate'), 'date') . '</dd>';
    $panel .= '<dt>' . rex_i18n::msg('status') . '</dt>';
    $panel .= '<dd class="' . $articleStatusTypes[$article->getValue('status')][1] . '">' . $articleStatusTypes[$article->getValue('status')][0] . '</dd>';
    $panel .= '</dl>';
    $fragment = new rex_fragment();
    $fragment->setVar('title', rex_i18n::msg('metadata'), false);
    $fragment->setVar('body', $panel, false);
    $content = $fragment->parse('core/page/section.php');
    return $content;
}
예제 #21
0
파일: linkmap.php 프로젝트: staabm/redaxo
 protected function listItem(rex_article $article, $category_id)
 {
     $liAttr = ' class="list-group-item"';
     $url = 'javascript:insertLink(\'redaxo://' . $article->getId() . '\',\'' . addslashes(htmlspecialchars($article->getName())) . '\');';
     return rex_linkmap_tree_renderer::formatLi($article, $category_id, $this->context, $liAttr, ' href="' . $url . '"') . '</li>' . "\n";
 }
예제 #22
0
<?php

if (!rex::isBackend()) {
    rex_extension::register('OUTPUT_FILTER', function (rex_extension_point $ep) {
        // Bereite Ausnahmen vor: Templates und Artikel
        // Dort werden E-Mailadressen nicht verschlüsselt
        $whitelistTemplates = rex_addon::get('emailobfuscator')->getConfig('templates', []);
        $whitelistArticles = rex_addon::get('emailobfuscator')->getConfig('articles', '');
        if ($whitelistArticles != '') {
            $whitelistArticles = explode(',', $whitelistArticles);
        } else {
            $whitelistArticles = [];
        }
        if (!is_null(rex_article::getCurrent()) && !in_array(rex_article::getCurrent()->getTemplateId(), $whitelistTemplates) && !in_array(rex_article::getCurrentId(), $whitelistArticles)) {
            $subject = $ep->getSubject();
            // Ersetze mailto-Links (zuerst!)
            // Anmerkung: Attributwerte (hier: href) benötigen nicht zwingend Anführungsstriche drumrum,
            // deshalb prüfen wir zusätzlich noch auf '>' am Ende .
            $subject = preg_replace_callback('/mailto:(.*?)(?=[\'|"|\\>])/', 'emailobfuscator::encodeEmailLinks', $subject);
            // Ersetze E-Mailadressen
            $subject = preg_replace_callback('/([\\w\\-\\+\\.]+)@([\\w\\-\\.]+\\.[\\w]{2,})/', 'emailobfuscator::encodeEmail', $subject);
            // Injiziere CSS vors schließende </head> im Seitenkopf
            if ($this->getConfig('autoload_css')) {
                $cssFile = '<link rel="stylesheet" href="' . $this->getAssetsUrl('emailobfuscator.css?v=' . $this->getVersion()) . '">';
                $subject = str_replace('</head>', $cssFile . '</head>', $subject);
            }
            // Injiziere JavaScript vors schließende </body> der Seite
            if ($this->getConfig('autoload_js')) {
                $jsFile = '<script src="' . $this->getAssetsUrl('emailobfuscator.js?v=' . $this->getVersion()) . '"></script>';
                $subject = str_replace('</body>', $jsFile . '</body>', $subject);
            }
 public function getArticle($articleId, $clangId = null)
 {
     global $REX;
     // set rex vars for this website
     $this->switchRexVars();
     // get article content
     $article = new rex_article($articleId, $clangId);
     $articleContent = $article->getArticle();
     // restore rex vars for current website
     $REX['WEBSITE_MANAGER']->getCurrentWebsite()->switchRexVars();
     return $articleContent;
 }
예제 #24
0
    }
}
// ---------------------------- FUNKTIONEN FUER MODULE
if ($function == 'delete') {
    $del = rex_sql::factory();
    $del->setQuery('SELECT ' . rex::getTablePrefix() . 'article_slice.article_id, ' . rex::getTablePrefix() . 'article_slice.clang_id, ' . rex::getTablePrefix() . 'article_slice.ctype_id, ' . rex::getTablePrefix() . 'module.name FROM ' . rex::getTablePrefix() . 'article_slice
            LEFT JOIN ' . rex::getTablePrefix() . 'module ON ' . rex::getTablePrefix() . 'article_slice.module_id=' . rex::getTablePrefix() . 'module.id
            WHERE ' . rex::getTablePrefix() . "article_slice.module_id='{$module_id}' GROUP BY " . rex::getTablePrefix() . 'article_slice.article_id');
    if ($del->getRows() > 0) {
        $module_in_use_message = '';
        $modulname = htmlspecialchars($del->getValue(rex::getTablePrefix() . 'module.name'));
        for ($i = 0; $i < $del->getRows(); ++$i) {
            $aid = $del->getValue(rex::getTablePrefix() . 'article_slice.article_id');
            $clang_id = $del->getValue(rex::getTablePrefix() . 'article_slice.clang_id');
            $ctype = $del->getValue(rex::getTablePrefix() . 'article_slice.ctype_id');
            $OOArt = rex_article::get($aid, $clang_id);
            $label = $OOArt->getName() . ' [' . $aid . ']';
            if (rex_clang::count() > 1) {
                $label = '(' . rex_i18n::translate(rex_clang::get($clang_id)->getName()) . ') ' . $label;
            }
            $module_in_use_message .= '<li><a href="' . rex_url::backendPage('content', ['article_id' => $aid, 'clang' => $clang_id, 'ctype' => $ctype]) . '">' . htmlspecialchars($label) . '</a></li>';
            $del->next();
        }
        $error = rex_i18n::msg('module_cannot_be_deleted', $modulname);
        if ($module_in_use_message != '') {
            $error .= '<ul>' . $module_in_use_message . '</ul>';
        }
    } else {
        $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . "module WHERE id='{$module_id}'");
        if ($del->getRows() > 0) {
            $del->setQuery('DELETE FROM ' . rex::getTablePrefix() . "module_action WHERE module_id='{$module_id}'");
예제 #25
0
     </div>
     ';
 // ------------------------------------------ WARNING
 if ($mode != 'edit' && $message != '') {
     echo rex_warning($message);
 }
 echo '
     <div class="rex-cnt-bdy">
     ';
 if ($mode == 'edit') {
     // ------------------------------------------ START: MODULE EDITIEREN/ADDEN ETC.
     echo '
           <!-- *** OUTPUT OF ARTICLE-CONTENT-EDIT-MODE - START *** -->
           <div class="rex-cnt-editmode">
           ';
     $CONT = new rex_article();
     $CONT->message = $message;
     $CONT->setArticleId($article_id);
     $CONT->setSliceId($slice_id);
     $CONT->setMode($mode);
     $CONT->setCLang($clang);
     $CONT->setEval(TRUE);
     $CONT->setFunction($function);
     eval("?>" . $CONT->getArticle($ctype));
     echo '
           </div>
           <!-- *** OUTPUT OF ARTICLE-CONTENT-EDIT-MODE - END *** -->
           ';
     // ------------------------------------------ END: MODULE EDITIEREN/ADDEN ETC.
 } elseif ($mode == 'meta') {
     // ------------------------------------------ START: META VIEW
예제 #26
0
 /**
  * Indexes a certain column.
  * Returns the number of the indexed rows or false.
  * 
  * @param string $_table
  * @param mixed $_column
  * @param mixed $_idcol
  * @param mixed $_id
  * @param mixed $_start
  * @param mixed $_count
  * 
  * @return mixed
  */
 function indexColumn($_table, $_column, $_idcol = false, $_id = false, $_start = false, $_count = false, $_where = false)
 {
     $delete = new rex_sql();
     $where = sprintf(" `ftable` = '%s' AND `fcolumn` = '%s' AND `texttype` = 'db_column'", $delete->escape($_table), $delete->escape($_column));
     //if(is_string($_idcol) AND ($_id !== false))
     //$where .= sprintf(' AND fid = %d',$_id);
     // delete from cache
     $select = new rex_sql();
     $select->setTable($this->tablePrefix . '587_searchindex');
     $select->setWhere($where);
     $indexIds = array();
     if ($select->select('id')) {
         foreach ($select->getArray() as $result) {
             $indexIds[] = $result['id'];
         }
         $this->deleteCache($indexIds);
     }
     // delete old data
     if ($_start === 0) {
         $delete->setTable($this->tablePrefix . '587_searchindex');
         $delete->setWhere($where);
         $delete->delete();
     }
     $sql = new rex_sql();
     // get primary key column(s)
     $primaryKeys = array();
     foreach ($sql->getArray("SHOW COLUMNS FROM `" . $_table . "` WHERE `KEY` = 'PRI'") as $col) {
         $primaryKeys[] = $col['Field'];
     }
     // index column
     $sql->flush();
     $sql->setTable($_table);
     $where = '1 ';
     if (is_string($_idcol) and $_id) {
         $where .= sprintf(' AND (%s = %d)', $_idcol, $_id);
     }
     if (!empty($_where) and is_string($_where)) {
         $where .= ' AND (' . $_where . ')';
     }
     if (is_numeric($_start) and is_numeric($_count)) {
         $where .= ' LIMIT ' . $_start . ',' . $_count;
     }
     $sql->setWhere($where);
     $count = false;
     if ($sql->select('*')) {
         $this->beginFrontendMode();
         $count = 0;
         $keywords = array();
         foreach ($sql->getArray() as $value) {
             if (!empty($value[$_column]) and ($this->indexOffline or $this->tablePrefix . 'article' != $_table or $value['status'] == '1') and ($this->tablePrefix . 'article' != $_table or !in_array($value['id'], $this->excludeIDs))) {
                 $insert = new rex_sql();
                 $indexData = array();
                 $indexData['texttype'] = 'db_column';
                 $indexData['ftable'] = $_table;
                 $indexData['fcolumn'] = $_column;
                 if (array_key_exists('clang', $value)) {
                     $indexData['clang'] = $value['clang'];
                 } else {
                     $indexData['clang'] = NULL;
                 }
                 $indexData['fid'] = NULL;
                 if (is_string($_idcol) and array_key_exists($_idcol, $value)) {
                     $indexData['fid'] = $value[$_idcol];
                 } elseif ($_table == $this->tablePrefix . 'article') {
                     $indexData['fid'] = $value['id'];
                 } elseif (count($primaryKeys) == 1) {
                     $indexData['fid'] = $value[$primaryKeys[0]];
                 } elseif (count($primaryKeys)) {
                     $fids = array();
                     foreach ($primaryKeys as $pk) {
                         $fids[$pk] = $value[$pk];
                     }
                     $indexData['fid'] = json_encode($fids);
                 }
                 if (is_null($indexData['fid'])) {
                     $indexData['fid'] = $this->getMinFID();
                 }
                 if (array_key_exists('re_id', $value)) {
                     $indexData['catid'] = $value['re_id'];
                     if ($_table == $this->tablePrefix . 'article') {
                         $indexData['catid'] = intval($value['startpage']) ? $value['id'] : $value['re_id'];
                     }
                 } elseif (array_key_exists('category_id', $value)) {
                     $indexData['catid'] = $value['category_id'];
                 } else {
                     $indexData['catid'] = NULL;
                 }
                 $additionalValues = array();
                 foreach ($this->includeColumns[$_table] as $col) {
                     $additionalValues[$col] = $value[$col];
                 }
                 $indexData['values'] = $insert->escape(serialize($additionalValues));
                 $indexData['unchangedtext'] = $insert->escape((string) $value[$_column]);
                 $indexData['plaintext'] = $insert->escape($plaintext = $this->getPlaintext($value[$_column]));
                 foreach (preg_split($this->encodeRegex('~[[:punct:][:space:]]+~ism'), $plaintext) as $keyword) {
                     if ($this->significantCharacterCount <= mb_strlen($keyword, 'UTF-8')) {
                         $keywords[] = array('search' => $keyword, 'clang' => is_null($indexData['clang']) ? false : $indexData['clang']);
                     }
                 }
                 $indexData['teaser'] = '';
                 if ($this->tablePrefix . 'article' == $_table) {
                     $rex_article = new rex_article(intval($value['id']), intval($value['clang']));
                     $teaser = true;
                     $article_content_file = $this->generatedPath . '/articles/' . intval($value['id']) . '.' . intval($value['clang']) . '.content';
                     if (!file_exists($article_content_file)) {
                         include_once $this->includePath . "/functions/function_rex_generate.inc.php";
                         $generated = rex_generateArticleContent(intval($value['id']), intval($value['clang']));
                         if ($generated !== true) {
                             $teaser = false;
                             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))) {
                         $teaser = false;
                     }
                     $indexData['teaser'] = $teaser ? $insert->escape($this->getTeaserText($this->getPlaintext($rex_article->getArticle()))) : '';
                 }
                 $insert->setTable($this->tablePrefix . '587_searchindex');
                 $insert->setValues($indexData);
                 $insert->insert();
                 $count++;
             }
         }
         $this->storeKeywords($keywords, false);
         $this->endFrontendMode();
     } else {
         return false;
     }
     return $count;
 }
예제 #27
0
<?php

/**
 * Regelt die Rechte an den einzelnen Kategorien und gibt den Pfad aus
 * Kategorien = Startartikel und Bezüge.
 *
 * @package redaxo5
 */
$KATout = '';
// Variable definiert und vorbelegt wenn nicht existent
$KAToutARR = [];
// Variable definiert und vorbelegt wenn nicht existent
$navigation = [];
$object_id = $article_id > 0 ? $article_id : $category_id;
$object = rex_article::get($object_id, $clang);
if ($object) {
    $tree = $object->getParentTree();
    if (!$object->isStartarticle()) {
        $tree[] = $object;
    }
    foreach ($tree as $parent) {
        $id = $parent->getId();
        if (rex::getUser()->getComplexPerm('structure')->hasCategoryPerm($id)) {
            $n = [];
            $n['title'] = str_replace(' ', '&nbsp;', htmlspecialchars($parent->getName()));
            if ($parent->isStartarticle()) {
                $n['href'] = rex_url::backendPage('structure', ['category_id' => $id, 'clang' => $clang]);
            }
            $navigation[] = $n;
        }
    }
 function article($article_id = null, $clang = null)
 {
     parent::rex_article($article_id, $clang);
 }
예제 #29
0
 function getSlice()
 {
     // TODO:: ------------------- .' AND revision='.$this->revision
     $art = new rex_article();
     $art->setArticleId($this->getArticleId());
     $art->setClang($this->getClang());
     $art->getSlice = $this->getId();
     $art->setEval(true);
     return @$art->replaceLinks($art->getArticle());
 }
예제 #30
0
파일: boot.php 프로젝트: redaxo/redaxo
                $select .= '<option value="' . $version['history_date'] . '">' . $version['history_date'] . '</option>';
            }
            $content1select = '<select id="content-history-select-date-1" class="content-history-select" data-iframe="content-history-iframe-1" style="">' . $select . '</select>';
            $content1iframe = '<iframe id="content-history-iframe-1" class="history-iframe"></iframe>';
            $content2select = '<select id="content-history-select-date-2" class="content-history-select" data-iframe="content-history-iframe-2">' . $select . '</select>';
            $content2iframe = '<iframe id="content-history-iframe-2" class="history-iframe"></iframe>';
            $button_restore = '<a class="btn btn-apply" href="javascript:rex_history_snapVersion(\'content-history-select-date-2\');">' . $this->i18n('snapshot_reactivate') . '</a>';
            // fragment holen und ausgeben
            $fragment = new rex_fragment();
            $fragment->setVar('title', $this->i18n('overview_versions'));
            $fragment->setVar('info', $info, false);
            $fragment->setVar('content1select', $content1select, false);
            $fragment->setVar('content1iframe', $content1iframe, false);
            $fragment->setVar('content2select', $content2select, false);
            $fragment->setVar('content2iframe', $content2iframe, false);
            $fragment->setVar('button_restore', $button_restore, false);
            echo $fragment->parse('history/layer.php');
            exit;
    }
    rex_extension::register('STRUCTURE_CONTENT_HEADER', function (rex_extension_point $ep) {
        if ($ep->getParam('page') == 'content/edit') {
            echo '<script>
                    var history_article_id = ' . rex_article::getCurrentId() . ';
                    var history_clang_id = ' . rex_clang::getCurrentId() . ';
                    var history_ctype_id = ' . rex_request('ctype', 'int', 0) . ';
                    var history_revision = ' . rex_request('rex_set_version', 'int', 0) . ';
                    var history_article_link = "' . rex_getUrl(rex_article::getCurrentId(), rex_clang::getCurrentId(), ['history_revision' => rex_request('rex_set_version', 'int', 0)], '&') . '";
                    </script>';
        }
    });
}