Exemplo n.º 1
0
 public function execute()
 {
     if (!rex::getUser()->isAdmin()) {
         throw new rex_api_exception('user has no permission for this operation!');
     }
     $type = rex_get('type', 'string');
     switch ($type) {
         case 'articles':
             $prefix = 'art\\_%';
             $defaultFields = [['translate:online_from', 'art_online_from', '1', '', '10', ''], ['translate:online_to', 'art_online_to', '2', '', '10', ''], ['translate:description', 'art_description', '3', '', '2', '']];
             break;
         case 'media':
             $prefix = 'med\\_%';
             $defaultFields = [['translate:pool_file_description', 'med_description', '1', '', '2', ''], ['translate:pool_file_copyright', 'med_copyright', '2', '', '1', '']];
             break;
         default:
             throw new rex_api_exception(sprintf('metainfo type "%s" does not have default field.', $type));
     }
     $existing = rex_sql::factory()->getArray('SELECT name FROM ' . rex::getTable('metainfo_field') . ' WHERE name LIKE ?', [$prefix]);
     $existing = array_column($existing, 'name', 'name');
     foreach ($defaultFields as $field) {
         if (!isset($existing[$field[1]])) {
             $return = call_user_func_array('rex_metainfo_add_field', $field);
             if (is_string($return)) {
                 throw new rex_api_exception($return);
             }
         }
     }
     return new rex_api_result(true, rex_i18n::msg('minfo_default_fields_created'));
 }
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));
        }
    }
}
Exemplo n.º 3
0
 public static function deleteSlices()
 {
     $IDs = rex_get('slices');
     $sql = rex_sql::factory();
     // $sql->setDebug();
     $sql->setTable(rex::getTablePrefix() . 'article_slice');
     $sql->setWhere("id IN('" . implode("','", $IDs) . "')", array());
     $sql->delete();
     $_SESSION[__CLASS__]['active'] = 0;
     die;
 }
 function get()
 {
     global $REX;
     if ($this->checkPermission()) {
         $callable = array($this, '_get');
         $cachekey = $this->funcCache->computeCacheKey($callable, array($REX['USER']->getUserLogin()));
         $cacheBackend = $this->funcCache->getCache();
         $configForm = '';
         if ($this->config) {
             $configForm = $this->config ? $this->config->get() : '';
             // config changed -> remove cache to reflect changes
             if ($this->config->changed()) {
                 $cacheBackend->remove($cachekey);
             }
         }
         // refresh clicked in actionbar
         if (rex_get('refresh', 'string') == $this->getId()) {
             $cacheBackend->remove($cachekey);
         }
         // prueft ob inhalte des callables gecacht vorliegen
         $content = $this->funcCache->call($callable, array($REX['USER']->getUserLogin()));
         // wenn gecachter inhalt leer ist, vom cache entfernen und nochmals checken
         // damit leere komponenten sofort angezeigt werden, wenn neue inhalte verfuegbar sind
         if ($content == '') {
             $cacheBackend->remove($cachekey);
             $content = $this->funcCache->call($callable, array($REX['USER']->getUserLogin()));
         }
         $cachestamp = $cacheBackend->getLastModified($cachekey);
         if (!$cachestamp) {
             $cachestamp = time();
         }
         // falls kein gueltiger cache vorhanden
         $cachetime = rex_formatter::format($cachestamp, 'strftime', 'datetime');
         $content = strtr($content, array('%%actionbar%%' => $this->getActionBar()));
         $content = strtr($content, array('%%cachetime%%' => $cachetime));
         $content = strtr($content, array('%%config%%' => $configForm));
         // refresh clicked in actionbar
         if (rex_get('ajax-get', 'string') == $this->getId()) {
             // clear output-buffer
             while (@ob_end_clean()) {
             }
             rex_send_resource($content);
             exit;
         }
         return $content;
     }
     return '';
 }
Exemplo n.º 5
0
 function image_manager_init()
 {
     global $REX;
     //--- handle image request
     $rex_img_file = rex_get('rex_img_file', 'string');
     $rex_img_type = rex_get('rex_img_type', 'string');
     $rex_img_init = false;
     if ($rex_img_file != '' && $rex_img_type != '') {
         $rex_img_init = true;
     }
     $imagepath = $REX['HTDOCS_PATH'] . $REX['MEDIA_DIR'] . '/' . $rex_img_file;
     $cachepath = $REX['GENERATED_PATH'] . '/files/';
     // REGISTER EXTENSION POINT
     $subject = array('rex_img_type' => $rex_img_type, 'rex_img_file' => $rex_img_file, 'rex_img_init' => $rex_img_init, 'imagepath' => $imagepath, 'cachepath' => $cachepath);
     $subject = rex_register_extension_point('IMAGE_MANAGER_INIT', $subject);
     if (isset($subject['rex_img_file'])) {
         $rex_img_file = $subject['rex_img_file'];
     }
     if (isset($subject['rex_img_type'])) {
         $rex_img_type = $subject['rex_img_type'];
     }
     if (isset($subject['imagepath'])) {
         $imagepath = $subject['imagepath'];
     }
     if (isset($subject['cachepath'])) {
         $cachepath = $subject['cachepath'];
     }
     if ($subject['rex_img_init']) {
         $image = new rex_image($imagepath);
         $image_cacher = new rex_image_cacher($cachepath);
         $image_manager = new rex_image_manager($image_cacher);
         $image = $image_manager->applyEffects($image, $rex_img_type);
         $image_manager->sendImage($image, $rex_img_type);
         exit;
     }
 }
Exemplo n.º 6
0
$where .= "AND (width > " . $max_pixel . " OR height > " . $max_pixel . ")";
$FILESQL->setWhere($where . ' ORDER BY pixel asc');
// rex_sql has no special method for adding sort-order
$FILESQL->select('*, (width * height) AS pixel');
$files = $FILESQL->getArray();
if (rex_get('scale') == 'scale') {
    ob_end_clean();
    $initial = rex_get('initial');
    $progress = $initial - count($files);
    if ($progress) {
        $td_width = round($progress / $initial * 100);
    } else {
        $td_width = 0;
    }
    $td2_width = 100 - $td_width;
    if (rex_post('btn_update', 'string') != '' || rex_get('update_continue')) {
        ob_start();
        echo '<span style="font-family: sans-serif; font-size: 12px;">' . $I18N->msg('dcf_precomp_caption_progress') . '</span><br />';
        echo '<table cellpadding=0 cellspacing=0 border=0 style="height: 32px; width: 100%"><tr><td style="width: ' . $td_width . '%; background: #3c9ed0; color: #fff; font-size: 12px; font-weight: bold; font-family: sans-serif; text-align: left">&nbsp;&nbsp;' . $progress . '</td><td style="width:' . $td2_width . '%; text-align: right; font-size: 12px; font-weight: bold; font-family: sans-serif">&nbsp;</td></tr></table>';
        if (!count($files)) {
            echo '<br /><span style="font-family: sans-serif; font-size: 12px; font-weight: bold">' . $I18N->msg('dcf_precomp_caption_finished') . '</span>';
        } else {
            echo '<br /><span style="font-family: sans-serif; font-size: 12px;">' . $I18N->msg('dcf_precomp_no_reload') . '</span>';
        }
        $i = 0;
        foreach ($files as $file) {
            if ($file['width'] > $file['height']) {
                $ratio = $REX['ADDON']['upload_precompressor']['settings']['max_pixel'] / $file['width'];
            } else {
                $ratio = $REX['ADDON']['upload_precompressor']['settings']['max_pixel'] / $file['height'];
            }
Exemplo n.º 7
0
$REX['ADDON']['image_resize']['max_resizekb'] = 300;
$REX['ADDON']['image_resize']['max_resizepixel'] = 500;
$REX['ADDON']['image_resize']['jpg_quality'] = 75;
// --- /DYN
include_once $REX['INCLUDE_PATH'] . '/addons/image_resize/classes/class.thumbnail.inc.php';
if ($REX['GG']) {
    require_once $REX['INCLUDE_PATH'] . '/addons/image_resize/extensions/extension_wysiwyg.inc.php';
    rex_register_extension('OUTPUT_FILTER', 'rex_resize_wysiwyg_output');
} else {
    // Bei Update Cache loeschen
    if (!function_exists('rex_image_ep_mediaupdated')) {
        rex_register_extension('MEDIA_UPDATED', 'rex_image_ep_mediaupdated');
        function rex_image_ep_mediaupdated($params)
        {
            rex_thumbnail::deleteCache($params["filename"]);
        }
    }
}
// Resize Script
$rex_resize = rex_get('rex_resize', 'string');
if ($rex_resize != '') {
    rex_thumbnail::createFromUrl($rex_resize);
}
if ($REX['REDAXO']) {
    if (rex_get('css', 'string') == 'addons/' . $mypage) {
        $cssfile = $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/css/image_resize.css';
        rex_send_file($cssfile, 'text/css');
        exit;
    }
    rex_register_extension('PAGE_HEADER', create_function('$params', 'return $params[\'subject\'] .\'  <link rel="stylesheet" type="text/css" href="index.php?css=addons/' . $mypage . '" />\'."\\n";'));
}
Exemplo n.º 8
0
$REX['ADDON']['rxid'][$mypage] = '256';
$REX['ADDON']['page'][$mypage] = $mypage;
//$REX['ADDON']['name'][$mypage] = 'Backend Search';
//$REX['ADDON']['perm'][$mypage] = 'be_search[]';
$REX['ADDON']['version'][$mypage] = '1.0';
$REX['ADDON']['author'][$mypage] = 'Markus Staab';
$REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de';
$REX['EXTPERM'][] = 'be_search[medienpool]';
$REX['EXTPERM'][] = 'be_search[structure]';
if ($REX['REDAXO']) {
    if (rex_get('css', 'string') == 'addons/' . $mypage) {
        $cssfile = $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/css/be_search.css';
        rex_send_file($cssfile, 'text/css');
        exit;
    }
    if (rex_get('css', 'string') == 'addons/' . $mypage . '/ie7') {
        $cssfile = $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/css/be_search_ie_lte_7.css';
        rex_send_file($cssfile, 'text/css');
        exit;
    }
    rex_register_extension('PAGE_HEADER', create_function('$params', 'return $params[\'subject\'] .\'  <link rel="stylesheet" type="text/css" href="index.php?css=addons/' . $mypage . '" />
  <!--[if lte IE 7]><link rel="stylesheet" href="index.php?css=addons/' . $mypage . '/ie7" type="text/css" media="all" /><![endif]-->' . "\n" . '\';'));
    $I18N_BE_SEARCH = new i18n($REX['LANG'], $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang');
    // Include Extensions
    if (!isset($page) || $page == '' || $page == 'structure') {
        require_once $REX['INCLUDE_PATH'] . '/addons/be_search/extensions/extension_search_structure.inc.php';
        rex_register_extension('PAGE_STRUCTURE_HEADER', 'rex_a256_search_structure');
    } elseif ($page == 'content') {
        require_once $REX['INCLUDE_PATH'] . '/addons/be_search/extensions/extension_search_structure.inc.php';
        rex_register_extension('PAGE_CONTENT_HEADER', 'rex_a256_search_structure');
    } elseif ($page == 'medienpool') {
Exemplo n.º 9
0
        $REX['LANG'] = 'de_de';
    }
    $I18N = rex_create_lang($REX['LANG']);
    $REX['PAGES']['setup'] = rex_be_navigation::getSetupPage();
    $REX['PAGE'] = "setup";
} else {
    // ----------------- CREATE LANG OBJ
    $I18N = rex_create_lang($REX['LANG']);
    // ---- prepare login
    $REX['LOGIN'] = new rex_backend_login($REX['TABLE_PREFIX'] . 'user');
    $rex_user_login = rex_post('rex_user_login', 'string');
    $rex_user_psw = rex_post('rex_user_psw', 'string');
    if ($REX['PSWFUNC'] != '') {
        $REX['LOGIN']->setPasswordFunction($REX['PSWFUNC']);
    }
    if (rex_get('rex_logout', 'boolean')) {
        $REX['LOGIN']->setLogout(true);
    }
    $REX['LOGIN']->setLogin($rex_user_login, $rex_user_psw);
    $loginCheck = $REX['LOGIN']->checkLogin();
    $rex_user_loginmessage = "";
    if ($loginCheck !== true) {
        // login failed
        $rex_user_loginmessage = $REX['LOGIN']->message;
        // Fehlermeldung von der Datenbank
        if (is_string($loginCheck)) {
            $rex_user_loginmessage = $loginCheck;
        }
        $REX['PAGES']['login'] = rex_be_navigation::getLoginPage();
        $REX['PAGE'] = 'login';
        $REX['USER'] = null;
Exemplo n.º 10
0
 public static function checkPermissions($ep)
 {
     $AddonPerm = rex_config::get('slice_ui');
     $article = rex_sql::factory();
     // $article->setDebug();
     $articleTable = rex::getTablePrefix() . 'article';
     $article->setTable($articleTable);
     // $article->setDebug();
     $article->setQuery('
   SELECT article.*, template.attributes as template_attributes
   FROM ' . rex::getTablePrefix() . 'article as article
   LEFT JOIN ' . rex::getTablePrefix() . 'template as template ON template.id=article.template_id
   WHERE article.id = ? AND clang_id = ?', array($ep['article_id'], $ep['clang']));
     $ctype = 1;
     if ($c = rex_request('ctype')) {
         $ctype = $c;
     }
     $template_attributes = json_decode($article->getValue('template_attributes'), 1);
     if ($template_attributes === null) {
         $template_attributes = array();
     }
     $AddonPerm['ctypes'] = $AddonPerm['ctypes'][$article->getValue('template_id')];
     if (!rex_template::hasModule($template_attributes, $ep['ctype'], $ep['module_id'])) {
         return false;
     } elseif (!(rex::getUser()->isAdmin() || rex::getUser()->hasPerm('module[' . $ep['module_id'] . ']') || rex::getUser()->hasPerm('module[0]'))) {
         return false;
     }
     if (strpos(rex_get('page', 'string'), 'content/paste') === false) {
         if (!empty($AddonPerm['modules']) && !in_array('all', $AddonPerm['modules']) && !in_array($ep['module_id'], $AddonPerm['modules']) || !empty($AddonPerm['ctypes']) && !in_array('all', $AddonPerm['ctypes']) && !in_array($ep['ctype'], $AddonPerm['ctypes'])) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 11
0
 * @version $Id: config.inc.php,v 1.1 2008/03/26 13:34:13 kills Exp $
 */
$mypage = 'metainfo';
if ($REX['REDAXO']) {
    $I18N_META_INFOS = new i18n($REX['LANG'], $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang');
}
$REX['ADDON']['rxid'][$mypage] = '62';
$REX['ADDON']['page'][$mypage] = $mypage;
$REX['ADDON']['name'][$mypage] = 'Meta Infos';
$REX['ADDON']['perm'][$mypage] = 'metainfo[]';
$REX['ADDON']['version'][$mypage] = "1.0";
$REX['ADDON']['author'][$mypage] = "Markus Staab, Jan Kristinus";
$REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de';
$REX['PERM'][] = 'metainfo[]';
if ($REX['REDAXO']) {
    if (rex_get('js', 'string') == 'addons/metainfo') {
        $jsfile = $REX['INCLUDE_PATH'] . '/addons/metainfo/js/metainfo.js';
        rex_send_file($jsfile, 'text/javascript');
        exit;
    }
    // Include Extensions
    if (isset($page)) {
        if ($page == 'metainfo') {
            rex_register_extension('PAGE_HEADER', create_function('$params', 'return $params[\'subject\'] .\'  <script src="index.php?js=addons/metainfo" type="text/javascript"></script>\'."\\n";'));
        }
        require_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/extensions/extension_common.inc.php';
        if ($page == 'content' && isset($mode) && $mode == 'meta') {
            require_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/extensions/extension_art_metainfo.inc.php';
        } elseif ($page == 'structure') {
            require_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/extensions/extension_cat_metainfo.inc.php';
        } elseif ($page == 'medienpool') {
Exemplo n.º 12
0
 /**
  * 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);
     }
 }
Exemplo n.º 13
0
 $class = '';
 $status = '&nbsp;';
 if ($package->isActivated()) {
     $status = $getLink($package, 'deactivate', 'rex-icon-package-is-activated');
     $class .= ' rex-package-is-activated';
 } elseif ($package->isInstalled()) {
     $status = $getLink($package, 'activate', 'rex-icon-package-not-activated');
     $class .= ' rex-package-is-installed';
 } else {
     $class .= ' rex-package-not-installed';
 }
 $name = '<span class="rex-' . $type . '-name">' . htmlspecialchars($package->getName()) . '</span>';
 $class .= $package->isSystemPackage() ? ' rex-system-' . $type : '';
 // --------------------------------------------- API MESSAGES
 $message = '';
 if ($package->getPackageId() == rex_get('package', 'string') && rex_api_function::hasMessage()) {
     $message = '
             <tr class="rex-package-message">
                 <td colspan="8">
                      ' . rex_api_function::getMessage() . '
                 </td>
             </tr>';
     $class = ' mark';
 }
 $version = trim($package->getVersion()) != '' ? ' <span class="rex-' . $type . '-version">' . trim($package->getVersion()) . '</span>' : '';
 return $message . '
             <tr class="rex-package-is-' . $type . $class . '">
                 <td class="rex-table-icon"><i class="rex-icon rex-icon-package-' . $type . '"></i></td>
                 <td data-title="' . rex_i18n::msg('package_hname') . '">' . $name . '</td>
                 <td data-title="' . rex_i18n::msg('package_hversion') . '">' . $version . '</td>
                 <td class="rex-table-slim" data-title="' . rex_i18n::msg('package_hhelp') . '"><a href="' . rex_url::currentBackendPage(['subpage' => 'help', 'package' => $packageId]) . '" title="' . rex_i18n::msg('package_help') . ' ' . htmlspecialchars($package->getName()) . '"><i class="rex-icon rex-icon-help"></i> <span class="sr-only">' . rex_i18n::msg('package_help') . ' ' . htmlspecialchars($package->getName()) . '</span></a></td>
Exemplo n.º 14
0
        $Subject['class'][] = 'copy';
    }
    return $Subject;
});
if (rex::isBackend() && is_object(rex::getUser())) {
    rex_perm::register('copy[]');
    rex_perm::register('slice_ui[]', null, rex_perm::OPTIONS);
    rex_perm::register('slice_ui[settings]', null, rex_perm::OPTIONS);
}
if (rex::isBackend()) {
    rex_view::addCssFile($this->getAssetsUrl('slice_ui.css'));
    rex_view::addCssFile($this->getAssetsUrl('jquery-ui.datepicker.css'));
    rex_view::addJsFile($this->getAssetsUrl('slice_ui.js'));
    rex_view::addJsFile($this->getAssetsUrl('jquery-ui.datepicker.js'));
}
if (rex_post('update_slice_status') != 1 && rex_get('function') == '') {
    rex_extension::register('SLICE_SHOW', 'slice_ui::extendBackendSlices');
}
rex_extension::register('SLICE_SHOW', 'slice_ui::isActive');
if (strpos(rex_request('page'), 'content/emptyclipboard') !== false) {
    slice_ui::emptyClipboard();
}
if (!empty($Config['general']['sticky_slice_nav']) && $Config['general']['sticky_slice_nav']) {
    rex_view::addJsFile($this->getAssetsUrl('sticky_header.js'));
}
if (strpos(rex_request('page'), 'content/paste') !== false) {
    slice_ui::addSlice();
}
if (strpos(rex_request('page'), 'content/move') !== false) {
    slice_ui::moveSlice();
}
Exemplo n.º 15
0
<?php

/**
 * Guestbook Addon 
 * @author staab[at]public-4u[dot]de Markus Staab
 * @author <a href="http://www.public-4u.de">www.public-4u.de</a>
 * @author redaxo[at]koalashome[dot]de Sven (Koala) Eichler
 * @package redaxo4
 * @version $Id: entries.inc.php,v 1.10 2010/10/12 19:38:46 koala_s Exp $
 */
//------------------------------> Parameter
$Basedir = dirname(__FILE__);
$entry_id = rex_request('entry_id', 'integer');
$mode = rex_get('mode', 'string');
$func = rex_request('func', 'string');
$entry_id = !empty($entry_id) ? (int) $entry_id : 0;
$mode = !empty($mode) ? (string) $mode : '';
//DBO($func);
//if (rex_get('func','string') == 'status')
if ($func == 'status') {
    $status = $mode == 'online_it' ? 1 : 0;
    $qry = 'UPDATE ' . TBL_GBOOK . ' SET status="' . $status . '" WHERE id=' . $entry_id;
    $sql = new rex_sql();
    //$sql->debugsql = true;
    $sql->setQuery($qry);
    $func = '';
}
//------------------------------> Eintragsliste
//if (rex_get('func','string','') == '')
if ($func == '') {
    require_once $Basedir . '/../../addon_framework/classes/list/class.rex_list.inc.php';
 * @package redaxo4
 * @version svn:$Id$
 */
include_once $REX['INCLUDE_PATH'] . '/addons/community/functions/functions.plugin.inc.php';
// -------------- Defaults
$pluginname = rex_request('pluginname', 'string');
$function = rex_request('function', 'string');
$plugins = rex_read_plugins_folder();
$pluginname = array_search($pluginname, $plugins) !== false ? $pluginname : '';
$warning = '';
$info = '';
// ----------------- FUNCTIONS
if ($pluginname != '') {
    $install = rex_get('install', 'int', -1);
    $activate = rex_get('activate', 'int', -1);
    $uninstall = rex_get('uninstall', 'int', -1);
    // ----------------- plugin INSTALL
    if ($install == 1) {
        if (($warning = rex_install_plugin($plugins, $pluginname)) === true) {
            $info = $I18N_COM->msg("plugin_installed", $pluginname);
        }
    } elseif ($activate == 1) {
        if (($warning = rex_activate_plugin($plugins, $pluginname)) === true) {
            $info = $I18N_COM->msg("plugin_activated", $pluginname);
        }
    } elseif ($activate == 0) {
        if (($warning = rex_deactivate_plugin($plugins, $pluginname)) === true) {
            $info = $I18N_COM->msg("plugin_deactivated", $pluginname);
        }
    } elseif ($uninstall == 1) {
        if (($warning = rex_uninstall_plugin($plugins, $pluginname)) === true) {
Exemplo n.º 17
0
        include $helpfile;
    }
    echo '<br />
                <p id="rex-addon-credits">' . $credits . '</p>
                </div>
                <div class="rex-area-footer">
                    <p><a href="JavaScript:history.back();">' . $I18N->msg('addon_back') . '</a></p>
                </div>
            </div>';
}
// ----------------- FUNCTIONS
if ($addonname != '') {
    $install = rex_get('install', 'int', -1);
    $activate = rex_get('activate', 'int', -1);
    $uninstall = rex_get('uninstall', 'int', -1);
    $delete = rex_get('delete', 'int', -1);
    $redirect = false;
    // ----------------- ADDON INSTALL
    if ($install == 1) {
        if ($pluginname != '') {
            if (($warning = $addonManager->install($pluginname)) === true) {
                $info = $I18N->msg('plugin_installed', $pluginname);
            }
        } elseif (($warning = $addonManager->install($addonname)) === true) {
            $info = $I18N->msg('addon_installed', $addonname);
        }
    } elseif ($activate == 1) {
        if ($pluginname != '') {
            if (($warning = $addonManager->activate($pluginname)) === true) {
                $info = $I18N->msg('plugin_activated', $pluginname);
                $redirect = true;
Exemplo n.º 18
0
// $REX['ADDON']['image_resize']['default_filters'] = array('brand');
$REX['ADDON']['image_resize']['default_filters'] = array();
// --- DYN
$REX['ADDON']['image_resize']['max_cachefiles'] = 5;
$REX['ADDON']['image_resize']['max_filters'] = 5;
$REX['ADDON']['image_resize']['max_resizekb'] = 1000;
$REX['ADDON']['image_resize']['max_resizepixel'] = 500;
$REX['ADDON']['image_resize']['jpg_quality'] = 75;
// --- /DYN
include_once $REX['INCLUDE_PATH'] . '/addons/image_resize/classes/class.thumbnail.inc.php';
require_once $REX['INCLUDE_PATH'] . '/addons/image_resize/extensions/extension_wysiwyg.inc.php';
rex_register_extension('OUTPUT_FILTER', 'rex_resize_wysiwyg_output');
if ($REX['REDAXO']) {
    // Bei Update Cache loeschen
    if (!function_exists('rex_image_ep_mediaupdated')) {
        rex_register_extension('MEDIA_UPDATED', 'rex_image_ep_mediaupdated');
        function rex_image_ep_mediaupdated($params)
        {
            rex_thumbnail::deleteCache($params["filename"]);
        }
    }
}
// Resize Script
$rex_resize = rex_get('rex_resize', 'string');
if ($rex_resize != '') {
    rex_thumbnail::createFromUrl($rex_resize);
}
if ($REX['REDAXO']) {
    $I18N->appendFile($REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/');
    $REX['ADDON'][$mypage]['SUBPAGES'] = array(array('', $I18N->msg('iresize_subpage_desc')), array('settings', $I18N->msg('iresize_subpage_config')), array('clear_cache', $I18N->msg('iresize_subpage_clear_cache')));
}
Exemplo n.º 19
0
 * @author Dave Holloway
 * @author <a href="http://www.GN2-Netwerk.de">www.GN2-Netwerk.de</a>s
 *
 * @package redaxo4
 * @version $Id: index.inc.php,v 1.17 2007/10/19 15:37:46 kills Exp $
 */
include $REX['INCLUDE_PATH'] . "/layout/top.php";
$subline = '
<ul>
  <li><a href="http://tinymce.moxiecode.com" target="_blank">' . $I18N_A52->msg('website') . '</a> | </li>
  <li><a href="http://tinymce.moxiecode.com/tinymce/docs/index.html" target="_blank">' . $I18N_A52->msg('documentation') . '</a> | </li>
  <li><a href="http://tinymce.moxiecode.com/tinymce/docs/reference_plugins.html" target="_blank">' . $I18N_A52->msg('list_of_plugins') . '</a></li>
</ul>
';
rex_title($I18N_A52->msg('title'), $subline);
$install = rex_get('install', 'string');
if ($install != '') {
    include_once $REX['INCLUDE_PATH'] . '/addons/tinymce/functions/function_pclzip.inc.php';
    switch ($install) {
        case 'compressor':
            rex_a52_extract_archive('include/addons/tinymce/js/tinymce_compressor.zip');
            break;
        case 'spellchecker':
            rex_a52_extract_archive('include/addons/tinymce/js/tinymce_spellchecker.zip');
            break;
    }
}
$mdl_1 = <<<EOD
<?php
// Diese 3 Zeilen dürfen keine führenden Leerzeichen besitzen!
\$value1 =<<<TEXT
Exemplo n.º 20
0
<?php

$REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'] = rex_get('term', 'string', '');
$REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount'] = rex_get('monthcount', 'int', 12);
a587_stats_saveSettings($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']);
if ($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'] == 'all') {
    $term = '';
} else {
    $term = substr($REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselect'], 1);
}
$basedir = dirname(__FILE__);
require_once $basedir . '/phplot/phplot.php';
$stats = new RexSearchStats();
// fetch data
$bardata = array();
$cumulateddata = array();
$max = 1;
foreach ($stats->getTimestats($term, $REX['ADDON']['rexsearch_plugins'][$parent][$mypage]['settings']['searchtermselectmonthcount']) as $month) {
    $bardata[] = array(date('M', mktime(0, 0, 0, $month['m'], 1, 2010)) . "\n" . $month['count'], $month['count']);
    if ($month['count'] > $max) {
        $max = $month['count'];
    }
}
$title = $I18N->Msg('a587_stats_searchterm_timestats_title', empty($term) ? $I18N->Msg('a587_stats_searchterm_timestats_title0_all') : $I18N->Msg('a587_stats_searchterm_timestats_title0_single', $term), intval($_GET['monthcount']));
if (rex_lang_is_utf8()) {
    $title = utf8_decode($title);
}
// draw bars
$plot = new PHPlot(700, 240);
$plot->SetImageBorderType('none');
$plot->SetTransparentColor('white');
 function createFromUrl($rex_resize)
 {
     global $REX;
     // Loesche alle Ausgaben zuvor
     while (ob_get_level()) {
         ob_end_clean();
     }
     // get params
     preg_match('@([0-9]*)([awhc])__(([0-9]*)h__)?((\\-?[0-9]*)o__)?(.*)@', $rex_resize, $resize);
     $size = $resize[1];
     $mode = $resize[2];
     $height = $resize[4];
     $offset = $resize[6];
     $imagefile = $resize[7];
     $rex_filter = rex_get('rex_filter', 'array');
     if (count($rex_filter) > $REX['ADDON']['image_resize']['max_filters']) {
         $rex_filter = array();
     }
     $filters = '';
     foreach ($rex_filter as $filter) {
         $filters .= $filter;
     }
     if ($filters != '') {
         $filters = md5($filters);
     }
     $cachepath = $REX['INCLUDE_PATH'] . '/generated/files/image_resize__' . $filters . $rex_resize;
     $imagepath = $REX['HTDOCS_PATH'] . 'files/' . $imagefile;
     // ----- check for cache file
     if (file_exists($cachepath)) {
         // time of cache
         $cachetime = filectime($cachepath);
         // file exists?
         if (file_exists($imagepath)) {
             $filetime = filectime($imagepath);
         } else {
             // image file not exists
             print 'Error: Imagefile does not exist - ' . $imagefile;
             exit;
         }
         // cache is newer? - show cache
         if ($cachetime > $filetime) {
             $thumb = new rex_thumbnail($cachepath);
             $thumb->send($cachepath, $cachetime);
             exit;
         }
     }
     // ----- check params
     if (!file_exists($imagepath)) {
         print 'Error: Imagefile does not exist - ' . $imagefile;
         exit;
     }
     // ----- check filesize
     $max_file_size = $REX['ADDON']['image_resize']['max_resizekb'] * 1024;
     if (filesize($imagepath) > $max_file_size) {
         print 'Error: Imagefile is to big. Only files < ' . $REX['ADDON']['image_resize']['max_resizekb'] . 'kb are allowed. - ' . $imagefile;
         exit;
     }
     // ----- check mode
     if ($mode != 'w' && $mode != 'h' && $mode != 'a' && $mode != 'c') {
         print 'Error wrong mode - only h,w,a,c';
         exit;
     }
     if ($size == '') {
         print 'Error size is no INTEGER';
         exit;
     }
     if ($size > $REX['ADDON']['image_resize']['max_resizepixel'] || $height > $REX['ADDON']['image_resize']['max_resizepixel']) {
         print 'Error size to big: max ' . $REX['ADDON']['image_resize']['max_resizepixel'] . ' px';
         exit;
     }
     // ----- start thumb class
     $thumb = new rex_thumbnail($imagepath);
     $thumb->img_filename = $imagefile;
     $thumb->img_cachepath = $REX['INCLUDE_PATH'] . '/generated/files/';
     // check method
     if ($mode == 'w') {
         $thumb->size_width($size);
     }
     if ($mode == 'h') {
         $thumb->size_height($size);
     }
     if ($mode == 'c') {
         $thumb->size_crop($size, $height, $offset);
     } elseif ($height != '') {
         $thumb->size_height($height);
     }
     if ($mode == 'a') {
         $thumb->size_auto($size);
     }
     // Add Default Filters
     $rex_filter = array_merge($rex_filter, $REX['ADDON']['image_resize']['default_filters']);
     // Add Filters
     foreach ($rex_filter as $filter) {
         $thumb->addFilter($filter);
     }
     // save cache
     $thumb->generateImage($cachepath);
     exit;
 }
Exemplo n.º 22
0
$I18N_slice_ui = new i18n($REX['LANG'], $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/lang/');
$REX['ADDON']['version'][$mypage] = $I18N_slice_ui->msg('slice_ui_version');
$REX['ADDON']['author'][$mypage] = 'Sascha Weidner';
$REX['ADDON']['rxid'][$mypage] = $mypage;
$REX['ADDON']['page'][$mypage] = $mypage;
$REX['ADDON']['name'][$mypage] = $I18N_slice_ui->msg('slice_ui_menu_link');
$REX['ADDON']['perm'][$mypage] = 'copySlice[]';
$REX['PERM'][] = 'copySlice[]';
$REX['ADDON'][$mypage]['backend'] = '1';
$REX['ADDON'][$mypage]['frontend'] = '1';
if (rex_request('reset_clipboard')) {
    unset($_SESSION['slice_ui']);
}
require_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/settings.inc.php';
require_once $REX['INCLUDE_PATH'] . '/addons/' . $mypage . '/classes/class.rex_copy.inc.php';
if (rex_request('page') == 'content') {
    rex_register_extension('PAGE_HEADER', 'rex_copy::appendToPageHeader');
}
if (rex_request('function') == 'insertSlice') {
    rex_copy::addSlice(rex_get('article_id'), rex_get('slice_id'));
}
if (is_object($REX['USER']) && (!$REX['USER']->hasPerm('editContentOnly[]') && $REX['USER']->hasPerm('copySlice[]') || $REX['USER']->isAdmin())) {
    if (!empty($_SESSION['slice_ui']) || rex_request('function') == 'copySlice') {
        rex_register_extension('ART_SLICE_MENU', 'rex_copy::insertSlice');
        rex_register_extension('PAGE_CONTENT_MENU', 'rex_copy::insertPageSlice');
    }
    rex_register_extension('ART_SLICE_MENU', 'rex_copy::modifySliceEditMenu');
}
if (isset($REX['USER']) && rex_request('function') == 'copySlice') {
    rex_copy::copySlice(rex_get('slice_id'), rex_get('clang'));
}
Exemplo n.º 23
0
            $rex_user_loginmessage = $loginCheck;
        }
        $pages['login'] = rex_be_controller::getLoginPage();
        $page = 'login';
        rex_be_controller::setCurrentPage('login');
    } else {
        // Userspezifische Sprache einstellen
        $user = $login->getUser();
        $lang = $user->getLanguage();
        if ($lang && $lang != 'default' && $lang != rex::getProperty('lang')) {
            rex_i18n::setLocale($lang);
        }
        rex::setProperty('user', $user);
    }
    // Safe Mode
    if (($safeMode = rex_get('safemode', 'boolean', null)) !== null) {
        if ($safeMode) {
            rex_set_session('safemode', true);
        } else {
            rex_unset_session('safemode');
        }
    }
}
rex_be_controller::setPages($pages);
// ----- Prepare Core Pages
if (rex::getUser()) {
    rex_be_controller::appendLoggedInPages();
    rex_be_controller::setCurrentPage(trim(rex_request('page', 'string')));
}
rex_view::addJsFile(rex_url::coreAssets('jquery.min.js'));
rex_view::addJsFile(rex_url::coreAssets('jquery-ui.custom.min.js'));
Exemplo n.º 24
0
 public static function getMediaType()
 {
     return rex_get('rex_media_type', 'string');
 }
Exemplo n.º 25
0
$REX['ADDON']['version'][$mypage] = '1.0';
$REX['ADDON']['author'][$mypage] = 'Markus Staab, Jan Kristinus';
$REX['ADDON']['supportpage'][$mypage] = 'forum.redaxo.de';
$REX['PERM'][] = 'image_manager[]';
// --- DYN
$REX['ADDON']['image_manager']['jpg_quality'] = 85;
// --- /DYN
$REX['ADDON']['image_manager']['classpaths']['effects'] = array();
$REX['ADDON']['image_manager']['classpaths']['effects'][] = dirname(__FILE__) . '/classes/effects/';
require_once dirname(__FILE__) . '/classes/class.rex_image.inc.php';
require_once dirname(__FILE__) . '/classes/class.rex_image_cacher.inc.php';
require_once dirname(__FILE__) . '/classes/class.rex_image_manager.inc.php';
require_once dirname(__FILE__) . '/classes/class.rex_effect_abstract.inc.php';
//--- handle image request
$rex_img_file = rex_get('rex_img_file', 'string');
$rex_img_type = rex_get('rex_img_type', 'string');
if ($rex_img_file != '' && $rex_img_type != '') {
    $imagepath = $REX['HTDOCS_PATH'] . 'files/' . $rex_img_file;
    $cachepath = $REX['INCLUDE_PATH'] . '/generated/files/';
    $image = new rex_image($imagepath);
    $image_cacher = new rex_image_cacher($cachepath);
    $image_manager = new rex_image_manager($image_cacher);
    $image = $image_manager->applyEffects($image, $rex_img_type);
    $image_manager->sendImage($image, $rex_img_type);
    exit;
}
if ($REX['REDAXO']) {
    // delete thumbnails on mediapool changes
    if (!function_exists('rex_image_manager_ep_mediaupdated')) {
        rex_register_extension('MEDIA_UPDATED', 'rex_image_manager_ep_mediaupdated');
        function rex_image_manager_ep_mediaupdated($params)
Exemplo n.º 26
0
     }
     die;
     break;
 case 'robots':
     require_once $REX['INCLUDE_PATH'] . '/addons/seo42/classes/class.seo42_robots.inc.php';
     $robots = new seo42_robots();
     $robots->setContent($REX['ADDON']['seo42']['settings']['robots']);
     $robots->addSitemapLink();
     $robots->send();
     die;
     break;
 case 'download':
     error_reporting(0);
     @ini_set('display_errors', 0);
     if (isset($REX['ADDON']['seo42']['settings']['force_download_for_filetypes']) && is_array($REX['ADDON']['seo42']['settings']['force_download_for_filetypes']) && count($REX['ADDON']['seo42']['settings']['force_download_for_filetypes']) > 0 && isset($_GET["file"])) {
         $file = strtolower(preg_replace("/[^a-zA-Z0-9.\\-\$\\+]/", "_", rex_get('file', 'string')));
         $file = urlencode(basename($file));
         $fileWithPath = realpath('./' . $REX['MEDIA_DIR'] . '/' . $file);
         $pathInfo = pathinfo($fileWithPath);
         if (isset($pathInfo['extension']) && in_array($pathInfo['extension'], $REX['ADDON']['seo42']['settings']['force_download_for_filetypes']) && file_exists($fileWithPath)) {
             header('Content-Description: File Transfer');
             header('Content-Type: application/octet-stream');
             header('Content-Disposition: attachment; filename=' . $file);
             header('Expires: 0');
             header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
             header('Pragma: public');
             header('Link: <' . seo42::getServerUrl() . ltrim(seo42::getMediaFile($file), "./") . '>; rel="canonical"');
             header('Content-Length: ' . filesize($fileWithPath));
             ob_clean();
             flush();
             readfile($fileWithPath);
Exemplo n.º 27
0
 /**
  * checks whether an api function is bound to the current requests. If so, so the api function will be executed.
  */
 public static function handleCall()
 {
     if (static::hasFactoryClass()) {
         return static::callFactoryClass(__FUNCTION__, func_get_args());
     }
     $apiFunc = self::factory();
     if ($apiFunc != null) {
         if ($apiFunc->published !== true) {
             if (rex::isBackend() !== true) {
                 throw new rex_http_exception(new rex_api_exception('the api function ' . get_class($apiFunc) . ' is not published, therefore can only be called from the backend!'), rex_response::HTTP_FORBIDDEN);
             }
             if (!rex::getUser()) {
                 throw new rex_http_exception(new rex_api_exception('missing backend session to call api function ' . get_class($apiFunc) . '!'), rex_response::HTTP_UNAUTHORIZED);
             }
         }
         $urlResult = rex_get(self::REQ_RESULT_PARAM, 'string');
         if ($urlResult) {
             // take over result from url and do not execute the apiFunc
             $result = rex_api_result::fromJSON($urlResult);
             $apiFunc->result = $result;
         } else {
             try {
                 $result = $apiFunc->execute();
                 if (!$result instanceof rex_api_result) {
                     throw new rex_exception('Illegal result returned from api-function ' . rex_get(self::REQ_CALL_PARAM) . '. Expected a instance of rex_api_result but got "' . (is_object($result) ? get_class($result) : gettype($result)) . '".');
                 }
                 $apiFunc->result = $result;
                 if ($result->requiresReboot()) {
                     $context = rex_context::fromGet();
                     // add api call result to url
                     $context->setParam(self::REQ_RESULT_PARAM, $result->toJSON());
                     // and redirect to SELF for reboot
                     rex_response::sendRedirect($context->getUrl([], false));
                 }
             } catch (rex_api_exception $e) {
                 $message = $e->getMessage();
                 $result = new rex_api_result(false, $message);
                 $apiFunc->result = $result;
             }
         }
     }
 }
Exemplo n.º 28
0
 /**
  * Returns array('success'=>true) or array('error'=>'error message')
  */
 function handleUpload($uploadDirectory, $replaceOldFile = FALSE)
 {
     if (!is_writable($uploadDirectory)) {
         return array('error' => "Fehler: Upload-Verzeichnis hat keine Schreibrechte.");
     }
     if (!$this->file) {
         return array('error' => 'Fehler: Es wurden keine Dateien hochgeladen.');
     }
     $size = $this->file->getSize();
     if ($size == 0) {
         return array('error' => 'Fehler: Die Datei ist leer');
     }
     if ($size > $this->sizeLimit) {
         return array('error' => 'Fehler: Die Datei ist zu groß');
     }
     $pathinfo = pathinfo($this->file->getName());
     $filename = $pathinfo['filename'];
     //$filename = md5(uniqid());
     if (!isset($pathinfo['extension'])) {
         $pathinfo['extension'] = '';
     }
     $ext = $pathinfo['extension'];
     if ($this->allowedExtensions && in_array(strtolower($ext), $this->allowedExtensions)) {
         $these = implode(', ', $this->allowedExtensions);
         return array('error' => 'Fehler: Die Datei hat eine ungültige Endung, verboten sind: ' . $these . '.');
     }
     if (!$replaceOldFile) {
         $final_name = rex_mediapool_filename($filename . '.' . $ext);
     }
     if ($this->file->save($uploadDirectory . $final_name)) {
         rex_mediapool_syncFile($final_name, rex_get('mediaCat', 'int'), '');
         rex_set_session('media[rex_file_category]', rex_get('mediaCat', 'int'));
         return array('success' => true, 'filename' => '' . $final_name . '', 'mediaCatId' => rex_get('mediaCat', 'int'), 'fileId' => rex_media::get($final_name)->getId(), 'originalname' => '' . $filename . '.' . $ext . '', 'timestamp' => time());
     } else {
         return array('error' => 'Die Datei konnte nicht gespeichert werden.' . 'Der Upload wurde abgebrochen, oder es handelt sich um einen internen Fehler');
     }
 }
Exemplo n.º 29
0
    }
}
// Resize Script
$rex_resize = rex_get('rex_resize', 'string');
if ($rex_resize != '') {
    // Lösche alle Ausgaben zuvor
    while (ob_get_level()) {
        ob_end_clean();
    }
    // get params
    ereg('^([0-9]*)([awhc])__(([0-9]*)h__)?(.*)', $rex_resize, $resize);
    $size = $resize[1];
    $mode = $resize[2];
    $hmode = $resize[4];
    $imagefile = $resize[5];
    $rex_filter = rex_get('rex_filter', 'array');
    $filters = "";
    foreach ($rex_filter as $filter) {
        $filters .= $filter;
    }
    $filters = md5($filters);
    $cachepath = $REX['INCLUDE_PATH'] . '/generated/files/image_resize___' . $filters . $rex_resize;
    $imagepath = $REX['HTDOCS_PATH'] . 'files/' . $imagefile;
    // check for cache file
    if (file_exists($cachepath)) {
        // time of cache
        $cachetime = filectime($cachepath);
        // file exists?
        if (file_exists($imagepath)) {
            $filetime = filectime($imagepath);
        } else {
Exemplo n.º 30
0
/**
 *
 * @package redaxo4
 * @version $Id: medienpool.inc.php,v 1.163 2007/10/29 18:28:34 kills Exp $
 */
// TODOS
// - mediensuche
// - wysiwyg image pfade anschauen und kontrollieren
// - import checken
// - mehrere ebenen in kategorienedit  einbauen
// KOMMT NOCH
// - only types einbauen (only .gif/.pdf/.xxx ..)
// - direktjump bei &action=media_details&file_name=xysd.jpg
// *************************************** WENN HTMLAREA ODER INPUT FELD.. SAVE
// ----- opener_input_field setzen
$opener_input_field = rex_get('opener_input_field');
if (!isset($_REQUEST["opener_input_field"]) && $opener_input_field == '' && ($sess_opener_input_field = rex_session('media[opener_input_field]')) != '') {
    $opener_input_field = $sess_opener_input_field;
}
rex_set_session('media[opener_input_field]', $opener_input_field);
// *************************************** PERMS
$PERMALL = false;
if ($REX_USER->hasPerm('admin[]') or $REX_USER->hasPerm('media[0]')) {
    $PERMALL = true;
}
// *************************************** CONFIG
$doctypes = OOMedia::getDocTypes();
$imgtypes = OOMedia::getImageTypes();
$thumbs = true;
$thumbsresize = true;
if (!OOAddon::isAvailable('image_resize')) {