function smarty_function_initials_filter_links($params, $smarty) { $html = ''; $sep = ' . '; $default_type = 'absolute_path'; if (!isset($params['_initial'])) { $params['_initial'] = 'initial'; } $current_initial = isset($_REQUEST[$params['_initial']]) ? $_REQUEST[$params['_initial']] : ''; if (!isset($params['_htmlelement'])) { $params['_htmlelement'] = 'tiki-center'; } if (!isset($params['_template'])) { $params['_template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; } if (!isset($params['_class'])) { $params['_class'] = 'prevnext'; } // Include smarty functions used below $smarty = TikiLib::lib('smarty'); $smarty->loadPlugin('smarty_block_ajax_href'); $smarty->loadPlugin('smarty_function_query'); $tag_start = "\n" . '<a class="' . $params['_class'] . '" ' . smarty_block_ajax_href(array('template' => $params['_template'], 'htmlelement' => $params['_htmlelement']), smarty_function_query(array('_type' => $default_type, $params['_initial'] => 'X', 'offset' => 'NULL', 'reloff' => 'NULL'), $smarty), $smarty, false) . '>'; $alpha = explode(',', tra('a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z')); foreach ($alpha as $i) { if ($current_initial == $i) { $html .= "\n" . '<span class="highlight">' . strtoupper($i) . '</span>' . $sep; } else { $html .= "\n" . str_replace($params['_initial'] . '=X', $params['_initial'] . '=' . $i, $tag_start) . strtoupper($i) . '</a>' . $sep; } } $html .= "\n" . str_replace($params['_initial'] . '=X', $params['_initial'] . '=', $tag_start) . tra('All') . '</a>'; return '<div class="alphafilter">' . $html . '</div>'; }
function data2struct(&$data, $level, &$expanded) { static $cur = 0; $ret = ''; if (is_array($data) && $level > 0) { $cur++; $link = ''; if (isset($data['link']) && $data['link'] != '') { $link = $data['link']; } elseif (isset($data['link_id']) && isset($data['link_var']) && $data['link_id'] >= 0) { $link = smarty_function_query(array('_type' => 'absolute_path', $data['link_var'] => $data['link_id'], 'offset' => 'NULL'), $smarty); } if (isset($data['current'])) { $data['name'] = '<b>' . $data['name'] . '</b>'; } $name = $data['name'] . (isset($data['addon']) ? ' ' . $data['addon'] : ''); $ret .= str_repeat('.', $level) . '|' . $name . '|' . $link . '||folder.png'; if (in_array($cur, $expanded)) { $ret .= '||1'; } $ret .= "\n"; if (is_array($data['data'])) { foreach ($data['data'] as $d) { $ret .= data2struct($d, $level + 1, $expanded); } } } return $ret; }
function smarty_function_initials_filter_links($params, &$smarty) { $html = ''; $sep = ' . '; $default_type = 'absolute_path'; if (!isset($params['_initial'])) { $params['_initial'] = 'initial'; } $current_initial = isset($params['initial']) && isset($_REQUEST[$params['initial']]) ? $_REQUEST[$params['initial']] : ''; if (!isset($params['_htmlelement'])) { $params['_htmlelement'] = 'tiki-center'; } if (!isset($params['_template'])) { $params['_template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; } if (!isset($params['_class'])) { $params['_class'] = 'prevnext'; } // Include smarty functions used below global $smarty; require_once $smarty->_get_plugin_filepath('block', 'ajax_href'); require_once $smarty->_get_plugin_filepath('function', 'query'); $tag_start = "\n" . '<a class="' . $params['_class'] . '" ' . smarty_block_ajax_href(array('template' => $params['_template'], 'htmlelement' => $params['_htmlelement']), smarty_function_query(array('_type' => $default_type, $params['_initial'] => 'X', 'offset' => 'NULL', 'reloff' => 'NULL'), $smarty), $smarty, false) . '>'; foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z') as $i) { if ($current_initial == $i) { $html .= "\n" . '<span class="button2"><span class="linkbuton">' . strtoupper($i) . '</span></span>' . $sep; } else { $html .= "\n" . str_replace($params['_initial'] . '=X', $params['_initial'] . '=' . $i, $tag_start) . strtoupper($i) . '</a>' . $sep; } } $html .= "\n" . str_replace($params['_initial'] . '=X', $params['_initial'] . '=', $tag_start) . tra('All') . '</a>'; return '<div align="center">' . $html . '</div>'; }
function wikiplugin_survey($data, $params) { global $tiki_p_take_survey; if ($tiki_p_take_survey != 'y') { return ''; } $result = ''; if (!isset($params['id'])) { return ''; } // Check if user has taken this survey global $tiki_p_admin, $tikilib, $user; if ($tiki_p_admin != 'y') { if ($tikilib->user_has_voted($user, 'survey' . $params['id'])) { include_once 'lib/wiki-plugins/wikiplugin_remarksbox.php'; return wikiplugin_remarksbox('You cannot take this survey twice', array('type' => 'comment')); } } global $srvlib; include_once 'lib/surveys/surveylib.php'; $questions = $srvlib->list_survey_questions($params['id'], 0, -1, 'position_asc', ''); $error_msg = ''; if (isset($_REQUEST['surveyId']) && $_REQUEST['surveyId'] == $params['id']) { if (isset($_REQUEST['vote'])) { $srvlib->add_survey_hit($_REQUEST['surveyId']); } if (isset($_REQUEST['ans'])) { $srvlib->register_answers($params['id'], $questions['data'], $_REQUEST, $error_msg); if ($error_msg == '') { $location = isset($params['page']) ? 'tiki-index.php?page=' . urlencode($params['page']) : 'tiki-list_surveys.php'; header('Location: ' . $location); } } } $survey_info = $srvlib->get_survey($params['id']); $smarty = TikiLib::lib('smarty'); $smarty->assign('surveyId', $params['id']); $smarty->assign('survey_info', $survey_info); $smarty->assign('questions', $questions['data']); $smarty->assign('error_msg', $error_msg); $smarty->assign('show_name', 'n'); include_once 'lib/smarty_tiki/function.query.php'; $smarty->assign('form_action', smarty_function_query(array('_type' => 'absolute_path'), $smarty)); if (!empty($params['lang'])) { $result .= $smarty->fetchLang($params['lang'], 'tiki-take_survey.tpl'); } else { $result .= $smarty->fetch('tiki-take_survey.tpl'); } $result = '~np~' . $result . '~/np~'; return $result; }
function smarty_block_title($params, $content, $template, &$repeat) { global $prefs, $tiki_p_view_templates, $tiki_p_edit_templates, $tiki_p_admin; if ($repeat || empty($content)) { return; } $template->loadPlugin('smarty_function_icon'); if (!isset($params['help'])) { $params['help'] = ''; } if (!isset($params['admpage'])) { $params['admpage'] = ''; } if (!isset($params['url'])) { $template->loadPlugin('smarty_function_query'); $params['url'] = htmlspecialchars(smarty_function_query(array('_type' => 'absolute_path'), $template)); $params['url'] = str_replace('&amp;', '&', $params['url']); } // Set the variable for the HTML title tag $template->smarty->assign('headtitle', $content); $class = 'pagetitle'; $current = current_object(); $metadata = ''; $coordinates = TikiLib::lib('geo')->get_coordinates($current['type'], $current['object']); if ($coordinates) { $class = ' geolocated primary'; $metadata = " data-geo-lat=\"{$coordinates['lat']}\" data-geo-lon=\"{$coordinates['lon']}\""; if (isset($coordinates['zoom'])) { $metadata .= " data-geo-zoom=\"{$coordinates['zoom']}\""; } } $html = '<h1>'; $html .= '<a class="' . $class . '"' . $metadata . ' href="' . $params['url'] . '">' . htmlspecialchars($content) . "</a>\n"; if ($template->getTemplateVars('print_page') != 'y') { if ($prefs['feature_help'] == 'y' && $prefs['helpurl'] != '' && $params['help'] != '') { $html .= '<a href="' . $prefs['helpurl'] . rawurlencode($params['help']) . '" class="titletips" title="' . tra('Help page:') . ' ' . htmlspecialchars($content) . '" target="tikihelp">' . smarty_function_icon(array('_id' => 'help'), $template) . "</a>\n"; } if ($prefs['feature_edit_templates'] == 'y' && $tiki_p_edit_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) { $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View or edit tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square_edit', 'alt' => tra('Edit Template')), $template) . "</a>\n"; } elseif ($prefs['feature_view_tpl'] == 'y' && $tiki_p_view_templates == 'y' && ($tpl = $template->getTemplateVars('mid'))) { $html .= '<a href="tiki-edit_templates.php?template=' . $tpl . '" class="titletips" title="' . tra('View tpl:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'shape_square', 'alt' => tra('View Template')), $template) . "</a>\n"; } if ($tiki_p_admin == 'y' && $params['admpage'] != '') { $html .= '<a class="titletips" href="tiki-admin.php?page=' . $params['admpage'] . '" title="' . tra('Admin page:') . ' ' . htmlspecialchars($content) . '">' . smarty_function_icon(array('_id' => 'wrench', 'alt' => tra('Admin Feature')), $template) . "</a>\n"; } } $html .= '</h1>'; return $html; }
function s_f_attachments_actionshandler($params) { global $prefs, $user, $tikilib; if ($prefs['feature_wiki_attachments'] != 'y') { return false; } /*** Works only for wiki attachments yet ***/ if (!empty($params['upload']) && empty($params['fileId']) && empty($params['page'])) { return false; } ///FIXME if (!empty($params['page'])) { require_once "lib/wiki/renderlib.php"; $info =& $tikilib->get_page_info($params['page']); $pageRenderer = new WikiRenderer($info, $user, $info['data']); $objectperms = $pageRenderer->applyPermissions(); } global $filegallib; include_once 'lib/filegals/filegallib.php'; foreach ($params as $k => $v) { switch ($k) { case 'remove': /* FIXME check_ticket('index'); $owner = $wikilib->get_attachment_owner($_REQUEST['removeattach']); if ( ($user && ($owner == $user) ) || $objectperms->wiki_admin_attachments ) { $access->check_authenticity(); $wikilib->remove_wiki_attachment($_REQUEST['removeattach']); } $pageRenderer->setShowAttachments( 'y' ); */ $filegallib->actionHandler('removeFile', array('fileId' => $v)); break; case 'upload': if (isset($objectperms) && ($objectperms->wiki_admin_attachments || $objectperms->wiki_attach_files)) { /* check_ticket('index'); */ global $smarty; $smarty->loadPlugin('smarty_function_query'); $galleryId = $filegallib->get_attachment_gallery($params['page'], 'wiki page', true); $filegallib->actionHandler('uploadFile', array('galleryId' => array($galleryId), 'comment' => $params['comment'], 'returnUrl' => smarty_function_query(array('_type' => 'absolute_path', 's_f_attachments-upload' => 'NULL', 's_f_attachments-page' => 'NULL', 's_f_attachments-comment' => 'NULL'), $smarty))); } break; } } return true; }
function smarty_block_pagination_links($params, $url, $smarty, &$repeat) { global $prefs; if ($repeat) { return; } if (isset($params['resultset'])) { $resultSet = $params['resultset']; $params['cant'] = count($resultSet); $params['offset'] = $resultSet->getOffset(); $params['step'] = $resultSet->getMaxRecords(); $params['estimate'] = $resultSet->getEstimate(); } $html = ''; $default_type = 'absolute_path'; // Check main params and return no pagination links if there is a mistake if (!isset($params['cant']) || $params['cant'] <= 0) { return ''; } if (isset($params['step']) && $params['step'] == -1) { return ''; } // display all if (!isset($params['offset'])) { $params['offset'] = 0; } if (!isset($params['offset_arg'])) { $params['offset_arg'] = 'offset'; } if (!isset($params['zero_based_offset'])) { $params['zero_based_offset'] = 'y'; } if (!isset($params['show_numbers'])) { $params['show_numbers'] = 'y'; } if (!isset($params['_onclick'])) { $params['_onclick'] = ''; } if ($params['zero_based_offset'] != 'y') { //$params['offset']--; $zero_based_min = 1; $zero_based_maxminus = 0; } else { $zero_based_min = 0; $zero_based_maxminus = 1; } $params['_ajax'] = isset($params['_ajax']) ? $params['_ajax'] : 'y'; if (isset($params['reloff']) && ($params['reloff'] + $params['offset'] >= $params['cant'] || $params['reloff'] + $params['offset'] < $zero_based_min)) { return ''; } if (!isset($params['reloff']) && ($params['offset'] >= $params['cant'] + $zero_based_min || $params['offset'] < $zero_based_min)) { return ''; } // Include smarty functions used below $smarty->loadPlugin('smarty_block_ajax_href'); $smarty->loadPlugin('smarty_function_query'); $smarty->loadPlugin('smarty_function_icon'); // Make sure every params are initialized if (!isset($params['itemname'])) { $params['itemname'] = 'Page'; } if (!isset($params['noimg'])) { $params['noimg'] = $prefs['pagination_icons'] == 'n' ? 'y' : 'n'; } if (!isset($params['usedots'])) { $params['usedots'] = 'y'; } if (!isset($params['class'])) { $params['class'] = 'mini'; } if (!isset($params['htmlelement'])) { $params['htmlelement'] = 'tiki-center'; } if (!isset($params['template'])) { $params['template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; if ($params['template'] == 'tiki-index.tpl') { $params['template'] = 'tiki-show_page.tpl'; } } if (!file_exists('templates/' . $params['template']) || $params['template'] == 'noauto') { $params['htmlelement'] = ''; $params['template'] = ''; } if (!isset($params['step']) || $params['step'] <= 0) { $params['step'] = 1; $nb_pages = $params['cant']; } else { $nb_pages = ceil($params['cant'] / $params['step']); } if ($nb_pages == 0 || $nb_pages == 1 && $prefs['pagination_hide_if_one_page'] == 'y') { return ''; } if (empty($url) || preg_match('/^\\s*$/', $url)) { $query_filter = array('_type' => $default_type); if (isset($params['_keepall'])) { $query_filter['_keepall'] = $params['_keepall']; } $url = smarty_function_query($query_filter, $smarty); } // remove empty url arguments (done by default) if (!isset($params['clean']) || $params['clean'] == 'y') { $url = preg_replace('/(?<=\\?|&)[^=]+=(?=&|$)/U', '', $url); } // remove old arguments that will be replaced and add new ones $url = preg_replace('/(?<=&|&|\\?)(move|reloff|' . $params['offset_arg'] . ')=[^&]*/', '', trim($url)); // remove & that are redundant or at the end of url $url = preg_replace('/(?:(\\?|&)(&)+|(\\?|&))$/', '\\1', $url); $url_args_pos = strpos($url, '?'); if ($url_args_pos === false) { $url .= '?'; } elseif ($url_args_pos < strlen($url) - 1) { $url .= '&'; } if (isset($params['reloff'])) { $prev_offset = 'reloff=' . ($params['reloff'] - $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset']; $next_offset = 'reloff=' . ($params['reloff'] + $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset']; $prev_fast_offset = 'reloff=' . ($params['reloff'] - $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset']; $next_fast_offset = 'reloff=' . ($params['reloff'] + $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset']; $real_offset = $params['offset'] + $params['reloff']; } else { $prev_offset_val = max($zero_based_min, $params['offset'] - $params['step']); $prev_offset = $params['offset_arg'] . '=' . $prev_offset_val; $next_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step']); $next_offset = $params['offset_arg'] . '=' . $next_offset_val; $prev_fast_offset_val = max($zero_based_min, $params['offset'] - $params['step'] * ceil($nb_pages / 10)); $prev_fast_offset = $params['offset_arg'] . '=' . $prev_fast_offset_val; $next_fast_offset_val = min($params['cant'] - $zero_based_maxminus, $params['offset'] + $params['step'] * ceil($nb_pages / 10)); $next_fast_offset = $params['offset_arg'] . '=' . $next_fast_offset_val; $real_offset = $params['offset']; } if (!isset($params['next'])) { $params['next'] = $real_offset < ($nb_pages - $zero_based_maxminus) * $params['step'] ? 'y' : 'n'; } if (!isset($params['prev'])) { $params['prev'] = $real_offset > $zero_based_min ? 'y' : 'n'; } // Max. number of links when using direct pagination $max_middle_links = max(0, $prefs['direct_pagination_max_middle_links']); $max_ending_links = $prefs['pagination_firstlast'] != 'n' ? max(0, $prefs['direct_pagination_max_ending_links']) : 0; $max_links = (1 + $max_ending_links + $max_middle_links) * 2 + 1; // Handle next/prev images if ($params['noimg'] == 'n') { $tmp = array('first' => tr("First %0", $params['itemname']), 'last' => tr("Last %0", $params['itemname']), 'next' => tr("Next %0", $params['itemname']), 'previous' => tr("Prev %0", $params['itemname']), 'next_fast' => tra('Fast Next'), 'previous_fast' => tra('Fast Prev')); $images = array(); foreach ($tmp as $ik => $iv) { $images[$ik] = smarty_function_icon(array('_id' => 'resultset_' . $ik, 'alt' => $iv, 'style' => 'vertical-align:middle;'), $smarty); } unset($tmp); } if ($params['cant'] > 0) { $make_prevnext_link = function ($url, $content, $params, $class = 'prevnext', $linkoffset) { $smarty = TikiLib::lib('smarty'); $link = '<a class="' . $class . '" '; $url = TikiLib::tikiUrlOpt($url); if ($params['_ajax'] == 'y') { // setting javascript offset variable if requested if (!empty($params['offset_jsvar'])) { $params['_onclick'] = $params['offset_jsvar'] . "={$linkoffset};" . $params['_onclick']; } $link .= smarty_block_ajax_href(array('template' => $params['template'], 'htmlelement' => $params['htmlelement'], '_ajax' => $params['_ajax'], '_onclick' => $params['_onclick']), $url, $smarty, false); } else { $link .= " href=\"{$url}\" "; } $link .= '>' . $content . '</a>'; return $link; }; if (($prefs['direct_pagination'] == 'y' || $prefs['nextprev_pagination'] === 'y') && $nb_pages > 1) { $html .= '<ul class="pagination">'; if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') { if ($params['offset'] == 0) { $html .= '<li class="disabled"><span>«</span></li>'; } else { $html .= '<li>' . $make_prevnext_link($url . $prev_offset, '«', $params, 'prevnext prev', $prev_offset_val) . '</li>'; } } if ($params['show_numbers'] == 'y') { $last_dots = false; $page_num = floor($real_offset / $params['step']); foreach (range(0, $nb_pages - 1) as $k) { if ($k + $zero_based_min == $page_num) { $html .= '<li class="active"><span>' . ($k + 1) . ' <span class="sr-only">(' . tr('current') . ')</span></span></li>'; $last_dots = false; } elseif ($params['usedots'] != 'y' || $params['usedots'] == 'y' && ($nb_pages <= $max_links || $k <= $max_ending_links && $prefs['pagination_firstlast'] != 'n' || $k >= $nb_pages - $max_ending_links - 1 && $prefs['pagination_firstlast'] != 'n' || abs($page_num - $k) <= $max_middle_links || $prefs['pagination_fastmove_links'] == 'y' && abs($page_num - $k) == ceil($nb_pages / 10))) { if (isset($params['reloff'])) { $url_k = $params['offset_arg'] . '=' . $params['offset'] . '&reloff=' . ($params['step'] * $k - $params['offset']); } else { $url_k_val = $params['step'] * ($k + $zero_based_min); $url_k = $params['offset_arg'] . '=' . $url_k_val; } $html .= '<li>' . $make_prevnext_link($url . $url_k, $k + 1, $params, 'prevnext', $url_k_val) . '</li>'; $last_dots = false; } elseif (!$last_dots) { $html .= '<li class="disabled"><span>…</span>'; $last_dots = true; } } } if ($prefs['nextprev_pagination'] != 'n' || $params['show_numbers'] !== 'y') { if ($params['offset'] + $params['step'] >= $params['cant']) { $html .= '<li class="disabled"><span>»</span></li>'; } else { $html .= '<li>' . $make_prevnext_link($url . $next_offset, '»', $params, 'prevnext next', $next_offset_val) . '</li>'; } } $html .= '</ul>'; } if (isset($params['estimate']) && $params['estimate'] > $params['cant']) { $html .= '<div class="alert alert-info">' . tr('More results may be available. Refine criteria to access the estimated %0 results.', $params['estimate']) . '</div>'; } } return $html; }
function wikiplugin_articles($data, $params) { global $smarty, $tikilib, $prefs, $tiki_p_read_article, $tiki_p_articles_read_heading, $dbTiki, $pageLang; global $artlib; require_once 'lib/articles/artlib.php'; $default = array('max' => -1, 'start' => 0, 'usePagination' => 'n', 'topicId' => '', 'topic' => '', 'sort' => 'publishDate_desc', 'type' => '', 'lang' => '', 'quiet' => 'n', 'categId' => '', 'largefirstimage' => 'n', 'urlparam' => '', 'translationOrphan' => '', 'showtable' => 'n'); $auto_args = array('lang', 'topicId', 'topic', 'sort', 'type', 'lang', 'categId'); $params = array_merge($default, $params); extract($params, EXTR_SKIP); $filter = ''; if ($prefs['feature_articles'] != 'y') { // the feature is disabled or the user can't read articles, not even article headings return ""; } $urlnext = ''; if ($usePagination == 'y') { //Set offset when pagniation is used if (!isset($_REQUEST["offset"])) { $start = 0; } else { $start = $_REQUEST["offset"]; } //Default to 10 when pagination is used if ($max == -1) { $countPagination = 10; } foreach ($auto_args as $arg) { if (!empty(${$arg})) { $paramsnext[$arg] = ${$arg}; } } $paramsnext['_type'] = 'absolute_path'; $smarty->loadPlugin('smarty_function_query'); $urlnext = smarty_function_query($paramsnext, $smarty); } $smarty->assign_by_ref('quiet', $quiet); $smarty->assign_by_ref('urlparam', $urlparam); $smarty->assign_by_ref('urlnext', $urlnext); if (!isset($containerClass)) { $containerClass = 'wikiplugin_articles'; } $smarty->assign('container_class', $containerClass); $dateStartTS = 0; $dateEndTS = 0; // if a period of time is set, date start and end are ignored if (isset($periodQuantity)) { switch ($periodUnit) { case 'hour': $periodUnit = 3600; break; case 'day': $periodUnit = 86400; break; case 'week': $periodUnit = 604800; break; case 'month': $periodUnit = 2628000; break; default: break; } if (is_int($periodUnit)) { $dateStartTS = $tikilib->now - $periodQuantity * $periodUnit; $dateEndTS = $tikilib->now; } } else { if (isset($dateStart)) { $dateStartTS = strtotime($dateStart); } if (isset($dateEnd)) { $dateEndTS = strtotime($dateEnd); } } if (isset($fullbody) && $fullbody == 'y') { $smarty->assign('fullbody', 'y'); } else { $smarty->assign('fullbody', 'n'); $fullbody = 'n'; } $smarty->assign('largefirstimage', $largefirstimage); if (!isset($overrideDates)) { $overrideDates = 'n'; } if (!empty($translationOrphan)) { $filter['translationOrphan'] = $translationOrphan; } if (!empty($articleId)) { $filter['articleId'] = $articleId; } if (!empty($notArticleId)) { $filter['notArticleId'] = $notArticleId; } include_once "lib/comments/commentslib.php"; $commentslib = new Comments($dbTiki); if (count($categId) == 0) { $categIds = ''; } elseif (count($categId) == 1) { // For performance reasons, if there is only one value, the SQL query should not return IN () as it does with arrays // So we send a single value instead of a single-value array $categIds = $categId[0]; } else { // We want the list of articles which are in all categories $categIds = array('AND' => $categId); } $listpages = $artlib->list_articles($start, $max, $sort, '', $dateStartTS, $dateEndTS, 'admin', $type, $topicId, 'y', $topic, $categIds, '', '', $lang, '', '', $overrideDates == 'y', 'y', $filter); if ($prefs['feature_multilingual'] == 'y' && empty($translationOrphan)) { global $multilinguallib; include_once "lib/multilingual/multilinguallib.php"; $listpages['data'] = $multilinguallib->selectLangList('article', $listpages['data'], $pageLang); } for ($i = 0, $icount_listpages = count($listpages["data"]); $i < $icount_listpages; $i++) { $listpages["data"][$i]["parsed_heading"] = $tikilib->parse_data($listpages["data"][$i]["heading"], array('min_one_paragraph' => true)); if ($fullbody == 'y') { $listpages["data"][$i]["parsed_body"] = $tikilib->parse_data($listpages["data"][$i]["body"], array('min_one_paragraph' => true, 'is_html' => $prefs['feature_wysiwyg'] === 'y' && $prefs['wysiwyg_htmltowiki'] !== 'y')); } $comments_prefix_var = 'article:'; $comments_object_var = $listpages["data"][$i]["articleId"]; $comments_objectId = $comments_prefix_var . $comments_object_var; $listpages["data"][$i]["comments_cant"] = $commentslib->count_comments($comments_objectId); //print_r($listpages["data"][$i]['title']); } global $artlib; require_once 'lib/articles/artlib.php'; $topics = $artlib->list_topics(); $smarty->assign_by_ref('topics', $topics); if (!empty($topic) && !strstr($topic, '!') && !strstr($topic, '+')) { $smarty->assign_by_ref('topic', $topic); } elseif (!empty($topicId) && is_numeric($topicId)) { if (!empty($listpages['data'][0]['topicName'])) { $smarty->assign_by_ref('topic', $listpages['data'][0]['topicName']); } else { $topic_info = $artlib->get_topic($topicId); if (isset($topic_info['name'])) { $smarty->assign_by_ref('topic', $topic_info['name']); } } } if (!empty($type) && !strstr($type, '!') && !strstr($type, '+')) { $smarty->assign_by_ref('type', $type); } if ($usePagination == 'y') { $smarty->assign('maxArticles', $max); $smarty->assign_by_ref('offset', $start); $smarty->assign_by_ref('cant', $listpages['cant']); } if (!empty($order)) { foreach ($listpages['data'] as $i => $article) { $memo[$article['articleId']] = $i; } foreach ($order as $articleId) { if (isset($memo[$articleId])) { $list[] = $listpages['data'][$memo[$articleId]]; } } foreach ($listpages['data'] as $i => $article) { if (!in_array($article['articleId'], $order)) { $list[] = $article; } } $smarty->assign_by_ref('listpages', $list); } else { $smarty->assign_by_ref('listpages', $listpages["data"]); } $smarty->assign('usePagination', $usePagination); $smarty->assign_by_ref('actions', $actions); if (isset($titleonly) && $titleonly == 'y') { return "~np~ " . $smarty->fetch('tiki-view_articles-titleonly.tpl') . " ~/np~"; } else { return "~np~ " . $smarty->fetch('tiki-view_articles.tpl') . " ~/np~"; } //return str_replace("\n","",$smarty->fetch('tiki-view_articles.tpl')); // this considers the hour in the header like a link }
$prefName = 'toolbar_' . $section . ($comments ? '_comments' : ''); $tikilib->set_preference($prefName, $_REQUEST['pref']); $tikilib->set_preference($prefName . 'modified', 'y'); } if (isset($_REQUEST['reset']) && $section != 'global' || isset($_REQUEST['reset_global']) && $section == 'global') { $prefName = 'toolbar_' . $section . ($comments ? '_comments' : ''); $tikilib->delete_preference($prefName); $tikilib->set_preference($prefName . 'modified', 'n'); $smarty->loadPlugin('smarty_function_query'); header('location: ?' . smarty_function_query(array('_urlencode' => 'n'), $smarty)); } if (!empty($_REQUEST['save_tool']) && !empty($_REQUEST['tool_name'])) { // input from the tool edit form Toolbar::saveTool($_REQUEST['tool_name'], $_REQUEST['tool_label'], $_REQUEST['tool_icon'], $_REQUEST['tool_token'], $_REQUEST['tool_syntax'], $_REQUEST['tool_type'], $_REQUEST['tool_plugin']); $smarty->loadPlugin('smarty_function_query'); header('location: ?' . smarty_function_query(array('_urlencode' => 'n'), $smarty)); } $current = $tikilib->get_preference('toolbar_' . $section . ($comments ? '_comments' : '')); if (empty($current)) { $current = $tikilib->get_preference('toolbar_global' . ($comments ? '_comments' : '')); $smarty->assign('not_global', false); } else { $smarty->assign('not_global', true); } $smarty->assign('not_default', false); if ($section == 'global') { global $cachelib; if ($defprefs = $cachelib->getSerialized("tiki_default_preferences_cache")) { if ($defprefs['toolbar_global' . ($comments ? '_comments' : '')] != $current) { $smarty->assign('not_default', true); }
function smarty_block_self_link($params, $content, $smarty, &$repeat = false) { $default_type = 'absolute_path'; $default_icon_type = 'relative'; if ($repeat) { return; } $smarty->loadPlugin('smarty_function_query'); if (is_array($params)) { if (!isset($content)) { $content = ''; } if (!isset($params['_ajax'])) { $params['_ajax'] = 'y'; } if (!isset($params['_script'])) { $params['_script'] = ''; } if (!isset($params['_tag'])) { $params['_tag'] = 'y'; } if (!empty($params['_anchor'])) { $anchor = $params['_anchor']; } else { $anchor = ''; } if (empty($params['_disabled'])) { if (!isset($params['_sort_arg'])) { $params['_sort_arg'] = 'sort'; } if (!isset($params['_sort_field'])) { $params['_sort_field'] = ''; } elseif ($params['_sort_arg'] != '' and !isset($params[$params['_sort_arg']])) { $params[$params['_sort_arg']] = $params['_sort_field'] . '_asc,' . $params['_sort_field'] . '_desc'; } // Complete _script path if needed (not empty, not an anchor, ...) if (!empty($params['_script']) && $params['_script'][0] != '#' && $params['_script'] != 'javascript:void(0)' && stripos($params['_script'], 'mailto:') !== 0) { if ($_SERVER['PHP_SELF'][0] == '/' && strpos($params['_script'], '/') === false) { $self_dir = str_replace('\\', '/', dirname($_SERVER['PHP_SELF'])); $params['_script'] = ($self_dir == '/' ? '' : $self_dir) . '/' . $params['_script']; } if ($params['_script'] == $_SERVER['PHP_SELF']) { $params['_script'] = ''; } } $params['_type'] = $default_type; $ret = smarty_function_query($params, $smarty); } if ($params['_tag'] == 'y') { if (empty($params['_disabled'])) { if ($params['_ajax'] === 'y' && $params['_script'] === '') { $smarty->loadPlugin('smarty_block_ajax_href'); if (!isset($params['_htmlelement'])) { $params['_htmlelement'] = 'role_main'; } if (!isset($params['_onclick'])) { $params['_onclick'] = ''; } if (!isset($params['_template'])) { $params['_template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; if ($params['_template'] == 'tiki-index.tpl') { $params['_template'] = 'tiki-show_page.tpl'; } } if (!file_exists('templates/' . $params['_template']) || $params['_template'] == 'noauto') { $params['_htmlelement'] = ''; $params['_template'] = ''; } $ret = smarty_block_ajax_href(array('template' => $params['_template'], 'htmlelement' => $params['_htmlelement'], '_onclick' => $params['_onclick'], '_anchor' => $anchor), $ret, $smarty, $tmp = false); } else { $ret = 'href="' . $ret . '"'; } } if (isset($params['_icon'])) { if (!isset($params['_title']) && $content != '') { $params['_title'] = $content; } $smarty->loadPlugin('smarty_function_icon'); $icon_params = array('_id' => $params['_icon'], '_type' => $default_icon_type); if (isset($params['_alt'])) { $icon_params['alt'] = $params['_alt']; } elseif (isset($params['_title'])) { $icon_params['alt'] = $params['_title']; $icon_params['title'] = ''; // will already be included in the surrounding A tag } if (isset($params['_menu_text']) && $params['_menu_text'] == 'y') { $icon_params['_menu_text'] = $params['_menu_text']; $icon_params['title'] = $params['_title']; // Used as the menu text $params['_title'] = ''; // will already be displayed as the menu text } if (isset($params['_menu_icon'])) { $icon_params['_menu_icon'] = $params['_menu_icon']; } if (isset($params['_icon_class'])) { $icon_params['class'] = $params['_icon_class']; } if (isset($params['_width'])) { $icon_params['width'] = $params['_width']; } if (isset($params['_height'])) { $icon_params['height'] = $params['_height']; } $content = smarty_function_icon($icon_params, $smarty); } $link = (!empty($params['_class']) ? 'class="' . $params['_class'] . '" ' : '') . (!empty($params['_style']) ? 'style="' . $params['_style'] . '" ' : '') . (!empty($params['_title']) ? 'title="' . str_replace('"', '\\"', $params['_title']) . '" ' : '') . (!empty($params['_rel']) ? 'rel="' . str_replace('"', '\\"', $params['_rel']) . '" ' : ''); foreach ($params as $k => $v) { if (strlen($k) > 3 && substr($k, 0, 3) == '_on' && !empty($v)) { $link .= htmlentities(substr($k, 1)) . '="' . $v . '" '; // $v should be already htmlentitized in the template unset($params[$k]); } } $link .= $ret; if (isset($params['_confirm'])) { $link .= ' data-confirm="' . smarty_modifier_escape($params['_confirm']) . '"'; } $ret = "<a {$link}>" . $content . '</a>'; if (!empty($params['_sort_field'])) { $smarty->loadPlugin('smarty_function_show_sort'); $ret = "<a {$link} style='text-decoration:none;'>" . $content . smarty_function_show_sort(array('sort' => $params['_sort_arg'], 'var' => $params['_sort_field']), $smarty) . '</a>'; } } } else { $params = array('_type' => $default_type); $ret = smarty_function_query($params, $smarty); } return $ret; }
function smarty_block_self_link($params, $content, &$smarty, $repeat = false) { global $prefs; $default_type = 'absolute_path'; $default_icon_type = 'relative'; if ($repeat) { return; } require_once $smarty->_get_plugin_filepath('function', 'query'); if (is_array($params)) { if (!isset($content)) { $content = ''; } if (!isset($params['_ajax'])) { $params['_ajax'] = 'y'; } if (!isset($params['_tag'])) { $params['_tag'] = 'y'; } if (!isset($params['_sort_arg'])) { $params['_sort_arg'] = 'sort'; } if (!isset($params['_sort_field'])) { $params['_sort_field'] = ''; } elseif ($params['_sort_arg'] != '' and !isset($params[$params['_sort_arg']])) { $params[$params['_sort_arg']] = $params['_sort_field'] . '_asc,' . $params['_sort_field'] . '_desc'; } // Complete _script path if needed if (isset($params['_script'])) { if ($params['_script'] != '' && $_SERVER['PHP_SELF'][0] == '/' && strpos($params['_script'], '/') === false) { $self_dir = dirname($_SERVER['PHP_SELF']); $params['_script'] = ($self_dir == '/' ? '' : $self_dir) . '/' . $params['_script']; } if ($params['_script'] == $_SERVER['PHP_SELF']) { $params['_script'] = ''; } } else { $params['_script'] = ''; } $params['_type'] = $default_type; $ret = smarty_function_query($params, $smarty); if ($params['_tag'] == 'y') { if ($params['_ajax'] == 'y' && $params['_script'] == '') { require_once $smarty->_get_plugin_filepath('block', 'ajax_href'); if (!isset($params['_htmlelement'])) { $params['_htmlelement'] = 'tiki-center'; } if (!isset($params['_template'])) { $params['_template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; } if (!file_exists('templates/' . $params['_template']) || $params['_template'] == 'noauto') { $params['_htmlelement'] = ''; $params['_template'] = ''; } $ret = smarty_block_ajax_href(array('template' => $params['_template'], 'htmlelement' => $params['_htmlelement']), $ret, $smarty, false); } else { $ret = 'href="' . $ret . '"'; } if (isset($params['_icon'])) { if (!isset($params['_title']) && $content != '') { $params['_title'] = $content; } require_once $smarty->_get_plugin_filepath('function', 'icon'); $icon_params = array('_id' => $params['_icon'], '_type' => $default_icon_type); if (isset($params['_alt'])) { $icon_params['alt'] = $params['_alt']; } elseif (isset($params['_title'])) { $icon_params['alt'] = $params['_title']; $icon_params['title'] = ''; // will already be included in the surrounding A tag } if (isset($params['_menu_text']) && $params['_menu_text'] == 'y') { $icon_params['_menu_text'] = $params['_menu_text']; $icon_params['title'] = $params['_title']; // Used as the menu text $params['_title'] = ''; // will already be displayed as the menu text } if (isset($params['_menu_icon'])) { $icon_params['_menu_icon'] = $params['_menu_icon']; } if (isset($params['_icon_class'])) { $icon_params['class'] = $params['_icon_class']; } $content = smarty_function_icon($icon_params, $smarty); } $link = (isset($params['_class']) && $params['_class'] != '' ? 'class="' . $params['_class'] . '" ' : '') . (isset($params['_title']) && $params['_title'] != '' ? 'title="' . str_replace('"', '\\"', $params['_title']) . '" ' : '') . $ret; $ret = "<a {$link}>" . $content . '</a>'; if ($params['_sort_field'] != '') { require_once $smarty->_get_plugin_filepath('function', 'show_sort'); $ret .= "<a {$link} style='text-decoration:none;'>" . smarty_function_show_sort(array('sort' => $params['_sort_arg'], 'var' => $params['_sort_field']), $smarty) . '</a>'; } } } else { $params = array('_type' => $default_type); $ret = smarty_function_query($params, $smarty); } return $ret; }
/** * smarty_block_pagination_links: Generate pagination links * * url: base url to use for links (specified through the content between the pagination_links starting and ending tags). * Defaults to the current URL. * * params: * - cant: Total number of items. [required] * - offset: Current offset. Defaults to 0. * - reloff: Current relative offset (to keep the original offset unchanged). If not specified, reloff is not used and offset is changed. * - itemname: Untranslated string to use as the item name. Defaults to 'Page'. * - noimg: If set to 'y', will use text instead of images for next/prev links. Only images mode supports first/last links. Defaults to 'n'. * - class: CSS class to use for the whole div. Defaults to 'mini'. * - template: template (.tpl file) used for AJAX_href links. Special value 'noauto', * to get the template that has the same name of the current script (by changing the file extension from .php to .tpl) * and set htmlelement to 'tiki-center' as a default. * - htmlelement: htmlelement used for AJAX_href links. * - step: number to add to an offset to go to the next item. Defaults to 1. * - clean: remove empty arguments from generated URLs (to reduce URL lenght). Defaults to 'y'. * - next: show (or not) next (and last) links. Defaults to 'y' if next elements exists. * - prev: show (or not) previous (and first) links. Defaults to 'y' if previous elements exists. * - usedots: Defaults to 'y'. Only used when 'direct_pagination' pref is set to 'y'. * Instead of displaying one link for each item, only display some items like this * (dots are not replaced by links, it's just a separation text): * 1 2 3 ... k-2 k-1 k k+1 k+2 ... n-2 n-1 n * - offset_arg: Name of the URL argument that contains the offset. Defaults to 'offset'. * */ function smarty_block_pagination_links($params, $url, &$smarty, $repeat) { global $prefs; if ($repeat) { return; } $html = ''; $default_type = 'absolute_path'; // Check main params and return no pagination links if there is a mistake if (!isset($params['cant']) || $params['cant'] <= 0) { return ''; } if (isset($params['step']) && $params['step'] == -1) { return ''; } // display all if (!isset($params['offset'])) { $params['offset'] = 0; } if (!isset($params['offset_arg'])) { $params['offset_arg'] = 'offset'; } if (isset($params['reloff']) && ($params['reloff'] + $params['offset'] >= $params['cant'] || $params['reloff'] + $params['offset'] < 0)) { return ''; } if (!isset($params['reloff']) && ($params['offset'] >= $params['cant'] || $params['offset'] < 0)) { return ''; } // Include smarty functions used below require_once $smarty->_get_plugin_filepath('block', 'ajax_href'); require_once $smarty->_get_plugin_filepath('function', 'query'); require_once $smarty->_get_plugin_filepath('function', 'icon'); // Make sure every params are initialized if (!isset($params['itemname'])) { $params['itemname'] = 'Page'; } if (!isset($params['noimg'])) { $params['noimg'] = $prefs['pagination_icons'] == 'n' ? 'y' : 'n'; } if (!isset($params['usedots'])) { $params['usedots'] = 'y'; } if (!isset($params['class'])) { $params['class'] = 'mini'; } if (!isset($params['htmlelement'])) { $params['htmlelement'] = 'tiki-center'; } if (!isset($params['template'])) { $params['template'] = basename($_SERVER['PHP_SELF'], '.php') . '.tpl'; } if (!file_exists('templates/' . $params['template']) || $params['template'] == 'noauto') { $params['htmlelement'] = ''; $params['template'] = ''; } if (!isset($params['step']) || $params['step'] <= 0) { $params['step'] = 1; $nb_pages = $params['cant']; } else { $nb_pages = ceil($params['cant'] / $params['step']); } if ($nb_pages == 0) { return ''; } if (empty($url) || preg_match('/^\\s*$/', $url)) { $url = smarty_function_query(array('_type' => $default_type), $smarty); } // remove empty url arguments (done by default) if (!isset($params['clean']) || $params['clean'] == 'y') { $url = preg_replace('/(?<=\\?|&)[^=]+=(?=&|$)/U', '', $url); } // remove old arguments that will be replaced and add new ones $url = preg_replace('/(?<=&|&|\\?)(move|reloff|' . $params['offset_arg'] . ')=[^&]*/', '', trim($url)); // remove & that are redundant or at the end of url $url = preg_replace('/(?:(\\?|&)(&)+|(\\?|&))$/', '\\1', $url); $url_args_pos = strpos($url, '?'); if ($url_args_pos === false) { $url .= '?'; } elseif ($url_args_pos < strlen($url) - 1) { $url .= '&'; } if (isset($params['reloff'])) { $prev_offset = 'reloff=' . ($params['reloff'] - $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset']; $next_offset = 'reloff=' . ($params['reloff'] + $params['step']) . '&' . $params['offset_arg'] . '=' . $params['offset']; $prev_fast_offset = 'reloff=' . ($params['reloff'] - $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset']; $next_fast_offset = 'reloff=' . ($params['reloff'] + $params['step'] * ceil($nb_pages / 10)) . '&' . $params['offset_arg'] . '=' . $params['offset']; $real_offset = $params['offset'] + $params['reloff']; } else { $prev_offset = $params['offset_arg'] . '=' . max(0, $params['offset'] - $params['step']); $next_offset = $params['offset_arg'] . '=' . min($params['cant'] - 1, $params['offset'] + $params['step']); $prev_fast_offset = $params['offset_arg'] . '=' . max(0, $params['offset'] - $params['step'] * ceil($nb_pages / 10)); $next_fast_offset = $params['offset_arg'] . '=' . min($params['cant'] - 1, $params['offset'] + $params['step'] * ceil($nb_pages / 10)); $real_offset = $params['offset']; } if (!isset($params['next'])) { $params['next'] = $real_offset < ($nb_pages - 1) * $params['step'] ? 'y' : 'n'; } if (!isset($params['prev'])) { $params['prev'] = $real_offset > 0 ? 'y' : 'n'; } // Max. number of links when using direct pagination $max_middle_links = max(0, $prefs['direct_pagination_max_middle_links']); $max_ending_links = $prefs['pagination_firstlast'] != 'n' ? max(0, $prefs['direct_pagination_max_ending_links']) : 0; $max_links = (1 + $max_ending_links + $max_middle_links) * 2 + 1; // Handle next/prev images if ($params['noimg'] == 'n') { $tmp = array('first' => tra("First {$params['itemname']}"), 'last' => tra("Last {$params['itemname']}"), 'next' => tra("Next {$params['itemname']}"), 'previous' => tra("Prev {$params['itemname']}"), 'next_fast' => tra('Fast Next'), 'previous_fast' => tra('Fast Prev')); $images = array(); foreach ($tmp as $ik => $iv) { $images[$ik] = smarty_function_icon(array('_id' => 'resultset_' . $ik, 'border' => '0', 'alt' => $iv, 'style' => 'vertical-align:middle;'), $smarty); } unset($tmp); } if ($params['cant'] > 0) { if (!function_exists('make_prevnext_link')) { function make_prevnext_link($url, $content, $params, $class = 'prevnext') { global $smarty; return "\n" . '<a class="' . $class . '" ' . smarty_block_ajax_href(array('template' => $params['template'], 'htmlelement' => $params['htmlelement']), $url, $smarty, false) . '>' . $content . '</a>'; } } $html .= '<div class="' . $params['class'] . '" style="text-align: center">'; // inline style can be overriden in css using !important if ($prefs['nextprev_pagination'] != 'n') { if ($params['prev'] == 'y') { if (isset($images)) { if ($prefs['pagination_firstlast'] != 'n' && $params['offset'] > $params['step']) { $html .= make_prevnext_link($url . (isset($params['reloff']) ? $params['offset_arg'] . '=' . $params['offset'] . '&reloff=-' . $params['offset'] : $params['offset_arg'] . '=0'), $images['first'], $params); } if ($prefs['pagination_fastmove_links'] == 'y' && $next_fast_offset != $next_offset) { $html .= make_prevnext_link($url . $prev_fast_offset, $images['previous_fast'], $params); } } $html .= (isset($images) ? '' : '[') . make_prevnext_link($url . $prev_offset, isset($images) ? $images['previous'] : tra('Prev'), $params) . (isset($images) ? '' : '] '); } elseif (isset($images)) { $html .= '<a class="prevnext"><span style="padding-left:16px"></span></a><a class="prevnext"><span style="padding-left:16px"> </span></a>'; } $html .= '<span class="pagenums">' . tra($params['itemname']) . ': ' . (1 + floor($real_offset / $params['step'])) . '/' . $nb_pages . "</span>"; if ($params['next'] == 'y') { $html .= (isset($images) ? '' : ' [') . make_prevnext_link($url . $next_offset, isset($images) ? $images['next'] : tra('Next'), $params) . (isset($images) ? '' : ']'); if (isset($images)) { if ($prefs['pagination_fastmove_links'] == 'y' && $next_fast_offset != $next_offset) { $html .= make_prevnext_link($url . $next_fast_offset, $images['next_fast'], $params); } if ($prefs['pagination_firstlast'] != 'n' && $params['offset'] + 2 * $params['step'] < $params['cant']) { $i = ($nb_pages - 1) * $params['step']; $html .= make_prevnext_link($url . (isset($params['reloff']) ? $params['offset_arg'] . '=' . $params['offset'] . '&reloff=' . ($i - $params['offset']) : $params['offset_arg'] . '=' . $i), $images['last'], $params); } } } elseif (isset($images)) { $html .= '<a class="prevnext"><span style="padding-left:16px"></span></a><a class="prevnext"><span style="padding-left:16px"> </span></a>'; } } if ($prefs['direct_pagination'] == 'y') { $html .= "\n<br />"; $last_dots = false; $page_num = floor($real_offset / $params['step']); foreach (range(0, $nb_pages - 1) as $k) { if ($k == $page_num) { $html .= "\n" . '<span class="prevnext" style="font-weight:bold">' . ($k + 1) . '</span>'; $last_dots = false; } elseif ($params['usedots'] != 'y' || $params['usedots'] == 'y' && ($nb_pages <= $max_links || $k <= $max_ending_links && $prefs['pagination_firstlast'] != 'n' || $k >= $nb_pages - $max_ending_links - 1 && $prefs['pagination_firstlast'] != 'n' || abs($page_num - $k) <= $max_middle_links || $prefs['pagination_fastmove_links'] == 'y' && abs($page_num - $k) == ceil($nb_pages / 10))) { if (isset($params['reloff'])) { $url_k = $params['offset_arg'] . '=' . $params['offset'] . '&reloff=' . ($params['step'] * $k - $params['offset']); } else { $url_k = $params['offset_arg'] . '=' . $params['step'] * $k; } $html .= make_prevnext_link($url . $url_k, $k + 1, $params); $last_dots = false; } elseif (!$last_dots) { $html .= "\n" . '<span class="prevnext" style="font-weight:bold">…</span>'; $last_dots = true; } } } $html .= "\n</div>"; } return $html; }