/** * comments * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Comments * @author Henry Ruhs * * @param integer $article * @param string $route */ function comments($article = '', $route = '') { $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start'); /* query comments */ $comments = Redaxscript\Db::forTablePrefix('comments')->where(array('status' => 1, 'article' => $article))->whereIn('language', array(Redaxscript\Registry::get('language'), ''))->orderGlobal('rank'); /* query result */ $result = $comments->findArray(); if ($result) { $num_rows = count($result); $sub_maximum = ceil($num_rows / s('limit')); $sub_active = LAST_SUB_PARAMETER; /* sub parameter */ if (LAST_SUB_PARAMETER > $sub_maximum || LAST_SUB_PARAMETER == '') { $sub_active = 1; } else { $offset_string = ($sub_active - 1) * s('limit') . ', '; } } $comments->limit($offset_string . s('limit')); /* query result */ $result = $comments->findArray(); $num_rows_active = count($result); /* handle error */ if ($result == '' || $num_rows == '') { $error = l('comment_no'); } else { if ($result) { $accessValidator = new Redaxscript\Validator\Access(); $output .= '<div class="box_line"></div>'; 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); } } /* collect headline output */ $output .= Redaxscript\Hook::trigger('comment_start', $r) . '<h3 id="comment-' . $id . '" class="title_comment">'; if ($url) { $output .= anchor_element('external', '', '', $author, $url, '', 'rel="nofollow"'); } else { $output .= $author; } $output .= '</h3>'; /* collect box output */ $output .= infoline('comments', $id, $author, $date); $output .= '<div class="box_comment">' . $text . '</div>' . Redaxscript\Hook::trigger('comment_end', $r); /* admin dock */ if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') { $output .= admin_dock('comments', $id); } } else { $counter++; } } /* handle access */ if ($num_rows_active == $counter) { $error = l('access_no'); } } } /* handle error */ if ($error) { $output = '<div class="box_comment_error">' . $error . l('point') . '</div>'; } $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end'); echo $output; /* call pagination as needed */ if ($sub_maximum > 1 && s('pagination') == 1) { pagination($sub_active, $sub_maximum, $route); } }
/** * 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; }
/** * 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; }
/** * comments * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Comments * @author Henry Ruhs * * @param integer $article * @param string $route */ function comments($article, $route) { $output = Redaxscript\Hook::trigger('commentStart'); /* query comments */ $comments = Redaxscript\Db::forTablePrefix('comments')->where(['status' => 1, 'article' => $article])->whereLanguageIs(Redaxscript\Registry::get('language'))->orderGlobal('rank'); /* query result */ $result = $comments->findArray(); if ($result) { $num_rows = count($result); $sub_maximum = ceil($num_rows / Redaxscript\Db::getSetting('limit')); $sub_active = Redaxscript\Registry::get('lastSubParameter'); /* sub parameter */ if (Redaxscript\Registry::get('lastSubParameter') > $sub_maximum || !Redaxscript\Registry::get('lastSubParameter')) { $sub_active = 1; } else { $offset_string = ($sub_active - 1) * Redaxscript\Db::getSetting('limit') . ', '; } } $comments->limit($offset_string . Redaxscript\Db::getSetting('limit')); /* query result */ $result = $comments->findArray(); $num_rows_active = count($result); /* handle error */ if (!$result || !$num_rows) { $error = Redaxscript\Language::get('comment_no'); } else { 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); } } /* collect headline output */ $output .= Redaxscript\Hook::trigger('commentFragmentStart', $r) . '<h3 id="comment-' . $id . '" class="rs-title-comment">'; if ($url) { $output .= '<a href="' . $url . '" rel="nofollow">' . $author . '</a>'; } else { $output .= $author; } $output .= '</h3>'; /* collect box output */ $output .= '<div class="rs-box-comment">' . $text . '</div>'; $output .= byline('comments', $id, $author, $date); $output .= Redaxscript\Hook::trigger('commentFragmentEnd', $r); /* admin dock */ if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token') && Redaxscript\Registry::get('firstParameter') != 'logout') { $output .= admin_dock('comments', $id); } } else { $counter++; } } /* handle access */ if ($num_rows_active == $counter) { $error = Redaxscript\Language::get('access_no'); } } } /* handle error */ if ($error) { $output = '<div class="rs-box-comment">' . $error . Redaxscript\Language::get('point') . '</div>'; } $output .= Redaxscript\Hook::trigger('commentEnd'); echo $output; /* call pagination as needed */ if ($sub_maximum > 1 && Redaxscript\Db::getSetting('pagination') == 1) { pagination($sub_active, $sub_maximum, $route); } }
/** * 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; }
/** * comments * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Comments * @author Henry Ruhs * * @param integer $article * @param string $route */ function comments($article = '', $route = '') { $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start'); /* query comments */ $query = 'SELECT id, author, url, text, date, article, access FROM ' . PREFIX . 'comments WHERE (language = \'' . LANGUAGE . '\' || language = \'\') && article = ' . $article . ' && status = 1 ORDER BY rank ' . s('order'); $result = mysql_query($query); if ($result) { $num_rows = mysql_num_rows($result); $sub_maximum = ceil($num_rows / s('limit')); $sub_active = LAST_SUB_PARAMETER; /* if sub parameter */ if (LAST_SUB_PARAMETER > $sub_maximum || LAST_SUB_PARAMETER == '') { $sub_active = 1; } else { $offset_string = ($sub_active - 1) * s('limit') . ', '; } } $query .= ' LIMIT ' . $offset_string . s('limit'); $result = mysql_query($query); $num_rows_active = mysql_num_rows($result); /* handle error */ if ($result == '' || $num_rows == '') { $error = l('comment_no'); } else { if ($result) { $accessValidator = new Redaxscript\Validator\Access(); $output .= '<div class="box_line"></div>'; 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); } } /* collect headline output */ $output .= Redaxscript\Hook::trigger('comment_start', $id) . '<h3 id="comment-' . $id . '" class="title_comment">'; if ($url) { $output .= anchor_element('external', '', '', $author, $url, '', 'rel="nofollow"'); } else { $output .= $author; } $output .= '</h3>'; /* collect box output */ $output .= infoline('comments', $id, $author, $date); $output .= '<div class="box_comment">' . $text . '</div>' . Redaxscript\Hook::trigger('comment_end', $id); /* admin dock */ if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') { $output .= admin_dock('comments', $id); } } else { $counter++; } } /* handle access */ if ($num_rows_active == $counter) { $error = l('access_no'); } } } /* handle error */ if ($error) { $output = '<div class="box_comment_error">' . $error . l('point') . '</div>'; } $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end'); echo $output; /* call pagination as needed */ if ($sub_maximum > 1 && s('pagination') == 1) { pagination($sub_active, $sub_maximum, $route); } }
/** * 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; }