/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $extras = Redaxscript\Db::forTablePrefix('extras')->whereIn('language', array(Redaxscript\Registry::get('language'), ''));
    /* has filter */
    if ($filter) {
        $id = Redaxscript\Db::forTablePrefix('extras')->where('alias', $filter)->findOne()->id;
        /* handle sibling */
        $sibling = Redaxscript\Db::forTablePrefix('extras')->where('id', $id)->findOne()->sibling;
        /* query sibling collection */
        $sibling_array = Redaxscript\Db::forTablePrefix('extras')->whereIn('sibling', array($id, $sibling > 0 ? $sibling : null))->where('language', Redaxscript\Registry::get('language'))->select('id')->findArrayFlat();
        /* process sibling array */
        foreach ($sibling_array as $value) {
            $id_array[] = $value;
        }
        $id_array[] = $sibling;
        $id_array[] = $id;
    } else {
        $id_array = $extras->where('status', 1)->orderByAsc('rank')->select('id')->findArrayFlat();
    }
    /* query result */
    $result = $extras->whereIn('id', $id_array)->findArray();
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        foreach ($result as $r) {
            $access = $r['access'];
            /* access granted */
            if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    $parser->init($text, array('className' => array('readmore' => 'link_read_more', 'codequote' => 'js_code_quote box_code'), 'route' => $route));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $r);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra" id="extra-' . $alias . '">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $r);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
示例#2
0
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $query = 'SELECT id, title, text, category, article, headline, access FROM ' . PREFIX . 'extras WHERE (language = \'' . LANGUAGE . '\' || language = \'\')';
    if (is_numeric($filter)) {
        $query .= ' && rank = ' . $filter;
    } else {
        if ($filter) {
            $query .= ' && alias = \'' . $filter . '\'';
        } else {
            $query .= ' && status = 1';
        }
    }
    $query .= ' ORDER BY rank';
    $result = mysql_query($query);
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        while ($r = mysql_fetch_assoc($result)) {
            $access = $r['access'];
            $check_access = $accessValidator->validate($access, MY_GROUPS);
            /* if access granted */
            if ($check_access == 1) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), $text, $route, array('className' => array('break' => 'link_read_more', 'code' => 'box_code')));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $id);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $id);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
示例#3
0
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $extras = Redaxscript\Db::forTablePrefix('extras')->whereIn('language', array(Redaxscript\Registry::get('language'), ''));
    /* setup filter */
    if (is_numeric($filter)) {
        $extras->where('rank', $filter);
    } else {
        if ($filter) {
            $extras->where('alias', $filter);
        } else {
            $extras->where('status', 1);
        }
    }
    $extras->orderByAsc('rank');
    /* query result */
    $result = $extras->findArray();
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        foreach ($result as $r) {
            $access = $r['access'];
            /* if access granted */
            if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    $parser->init($text, $route, array('className' => array('break' => 'link_read_more', 'code' => 'box_code')));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $r);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $r);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
示例#4
0
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter)
{
    if (!$filter) {
        $output .= Redaxscript\Hook::trigger('extraStart');
    }
    $categoryId = Redaxscript\Registry::get('categoryId');
    $articleId = Redaxscript\Registry::get('articleId');
    $firstParameter = Redaxscript\Registry::get('firstParameter');
    /* query extras */
    $extras = Redaxscript\Db::forTablePrefix('extras')->whereLanguageIs(Redaxscript\Registry::get('language'));
    /* has filter */
    if ($filter) {
        $id = Redaxscript\Db::forTablePrefix('extras')->where('alias', $filter)->findOne()->id;
        /* handle sibling */
        $sibling = Redaxscript\Db::forTablePrefix('extras')->where('id', $id)->findOne()->sibling;
        /* query sibling collection */
        $sibling_array = Redaxscript\Db::forTablePrefix('extras')->whereIn('sibling', [$id, $sibling > 0 ? $sibling : null])->where('language', Redaxscript\Registry::get('language'))->select('id')->findFlatArray();
        /* process sibling array */
        foreach ($sibling_array as $value) {
            $id_array[] = $value;
        }
        $id_array[] = $sibling;
        $id_array[] = $id;
    } else {
        $id_array = $extras->where('status', 1)->orderByAsc('rank')->select('id')->findFlatArray();
    }
    /* query result */
    if ($id_array) {
        $result = $extras->whereIn('id', $id_array)->findArray();
    }
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        foreach ($result as $r) {
            $access = $r['access'];
            /* access granted */
            if ($accessValidator->validate($access, Redaxscript\Registry::get('myGroups')) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if category or article matched */
                if ($category === $categoryId || $article === $articleId || !$category && !$article) {
                    /* parser */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    $parser->init($text, ['route' => $route]);
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extraFragmentStart', $r);
                    if ($headline == 1) {
                        $output .= '<h3 class="rs-title-extra" id="extra-' . $alias . '">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="rs-box-extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extraFragmentEnd', $r);
                    /* prepend admin dock */
                    if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token') && $firstParameter != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if (!$filter) {
        $output .= Redaxscript\Hook::trigger('extraEnd');
    }
    echo $output;
}