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 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>';
}
예제 #3
0
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('/(?<=\\?|&amp;)[^=]+=(?=&amp;|$)/U', '', $url);
    }
    // remove old arguments that will be replaced and add new ones
    $url = preg_replace('/(?<=&amp;|&|\\?)(move|reloff|' . $params['offset_arg'] . ')=[^&]*/', '', trim($url));
    // remove &amp; that are redundant or at the end of url
    $url = preg_replace('/(?:(\\?|&amp;)(&amp;)+|(\\?|&amp;))$/', '\\1', $url);
    $url_args_pos = strpos($url, '?');
    if ($url_args_pos === false) {
        $url .= '?';
    } elseif ($url_args_pos < strlen($url) - 1) {
        $url .= '&amp;';
    }
    if (isset($params['reloff'])) {
        $prev_offset = 'reloff=' . ($params['reloff'] - $params['step']) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $next_offset = 'reloff=' . ($params['reloff'] + $params['step']) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $prev_fast_offset = 'reloff=' . ($params['reloff'] - $params['step'] * ceil($nb_pages / 10)) . '&amp;' . $params['offset_arg'] . '=' . $params['offset'];
        $next_fast_offset = 'reloff=' . ($params['reloff'] + $params['step'] * ceil($nb_pages / 10)) . '&amp;' . $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>&laquo;</span></li>';
                } else {
                    $html .= '<li>' . $make_prevnext_link($url . $prev_offset, '&laquo;', $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'] . '&amp;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>&hellip;</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>&raquo;</span></li>';
                } else {
                    $html .= '<li>' . $make_prevnext_link($url . $next_offset, '&raquo;', $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;
}
예제 #4
0
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;
}
예제 #5
0
function wikiplugin_include($dataIn, $params)
{
    global $tikilib, $userlib, $user, $killtoc;
    static $included_pages, $data;
    $killtoc = true;
    $max_times = 5;
    $params = array_merge(array('nopage_text' => '', 'pagedenied_text' => ''), $params);
    extract($params, EXTR_SKIP);
    if (!isset($page)) {
        return "<b>missing page for plugin INCLUDE</b><br />";
    }
    $memo = $page;
    if (isset($start)) {
        $memo .= "/{$start}";
    }
    if (isset($end)) {
        $memo .= "/{$end}";
    }
    if (isset($included_pages[$memo])) {
        if ($included_pages[$memo] >= $max_times) {
            return '';
        }
        $included_pages[$memo]++;
    } else {
        $included_pages[$memo] = 1;
        // only evaluate permission the first time round
        // evaluate if object or system permissions enables user to see the included page
        $data[$memo] = $tikilib->get_page_info($page);
        if (!$data[$memo]) {
            $text = $nopage_text;
        }
        $perms = $tikilib->get_perm_object($page, 'wiki page', $data[$memo], false);
        if ($perms['tiki_p_view'] != 'y') {
            $included_pages[$memo] = $max_times;
            $text = $pagedenied_text;
            return $text;
        }
    }
    if ($data[$memo]) {
        $text = $data[$memo]['data'];
        if (isset($start) || isset($stop)) {
            $explText = explode("\n", $text);
            if (isset($start) && isset($stop)) {
                $state = 0;
                foreach ($explText as $i => $line) {
                    if ($state == 0) {
                        // Searching for start marker, dropping lines until found
                        unset($explText[$i]);
                        // Drop the line
                        if (0 == strcmp($start, trim($line))) {
                            $state = 1;
                            // Start retaining lines and searching for stop marker
                        }
                    } else {
                        // Searching for stop marker, retaining lines until found
                        if (0 == strcmp($stop, trim($line))) {
                            unset($explText[$i]);
                            // Stop marker, drop the line
                            $state = 0;
                            // Go back to looking for start marker
                        }
                    }
                }
            } else {
                if (isset($start)) {
                    // Only start marker is set. Search for it, dropping all lines until
                    // it is found.
                    foreach ($explText as $i => $line) {
                        unset($explText[$i]);
                        // Drop the line
                        if (0 == strcmp($start, trim($line))) {
                            break;
                        }
                    }
                } else {
                    // Only stop marker is set. Search for it, dropping all lines after
                    // it is found.
                    $state = 1;
                    foreach ($explText as $i => $line) {
                        if ($state == 0) {
                            // Dropping lines
                            unset($explText[$i]);
                        } else {
                            // Searching for stop marker, retaining lines until found
                            if (0 == strcmp($stop, trim($line))) {
                                unset($explText[$i]);
                                // Stop marker, drop the line
                                $state = 0;
                                // Start dropping lines
                            }
                        }
                    }
                }
            }
            $text = implode("\n", $explText);
        }
    }
    $parserlib = TikiLib::lib('parser');
    $options = null;
    if (!empty($_REQUEST['page'])) {
        $options['page'] = $_REQUEST['page'];
    }
    $parserlib->setOptions($options);
    $parserlib->parse_wiki_argvariable($text);
    // append an edit button
    if (isset($perms) && $perms['tiki_p_edit'] === 'y' && strpos($_SERVER['PHP_SELF'], 'tiki-send_newsletters.php') === false) {
        global $smarty;
        $smarty->loadPlugin('smarty_block_ajax_href');
        $smarty->loadPlugin('smarty_function_icon');
        $tip = tra('Include Plugin') . ' | ' . tra('Edit the included page:') . ' &quot;' . $page . '&quot;';
        $text .= '<a class="editplugin tips" ' . smarty_block_ajax_href(array('template' => 'tiki-editpage.tpl'), 'tiki-editpage.php?page=' . urlencode($page) . '&returnto=' . urlencode($GLOBALS['page']), $smarty, $tmp = false) . '>' . smarty_function_icon(array('_id' => 'page_edit', 'title' => $tip, 'class' => 'icon tips'), $smarty) . '</a>';
    }
    return $text;
}
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;
}
 function make_prevnext_link($url, $content, $params, $class = 'prevnext', $linkoffset)
 {
     global $smarty;
     $link = '<a class="' . $class . '" ';
     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;
 }
 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>';
 }