Ejemplo n.º 1
0
/** Print a whole query array, recent or saved
 */
function asearch_print_query_array(&$boxes, &$query_array, &$query_keys, &$action_array, $title, $show_pref)
{
    global $color;
    global $data_dir, $username;
    global $use_icons, $icon_theme;
    $show_flag = getPref($data_dir, $username, $show_pref, 0) & 1;
    $use_icons_flag = $use_icons && $icon_theme != 'none';
    if ($use_icons_flag) {
        $text_array = array('<img src="' . SM_PATH . 'images/minus.png" border="0" height="7" width="7" />', '<img src="' . SM_PATH . 'images/plus.png" border="0" height="7" width="7" />');
    } else {
        $text_array = array('-', '+');
    }
    $toggle_link = asearch_get_toggle_link(!$show_flag, $show_pref, $text_array, array(_("Fold"), _("Unfold")));
    if (!$use_icons_flag) {
        $toggle_link = '<small>[' . $toggle_link . ']</small>';
    }
    echo "<br />\n";
    echo html_tag('table', '', 'center', $color[9], 'width="95%" cellpadding="1" cellspacing="1" border="0"');
    echo html_tag('tr', html_tag('td', $toggle_link, 'center', $color[5], 'width="5%"') . html_tag('td', asearch_get_title_display($color, $title), 'center', $color[5], 'colspan=4'));
    if ($show_flag) {
        $main_key = $query_keys[ASEARCH_WHERE];
        $query_count = count($query_array[$main_key]);
        for ($query_num = 0, $row_num = 0; $query_num < $query_count; $query_num++) {
            if (!empty($query_array[$main_key][$query_num])) {
                echo html_tag('tr', '', '', asearch_get_row_color($color, $row_num));
                unset($search_array);
                foreach ($query_keys as $query_key) {
                    $search_array[] = asearch_unserialize($query_array[$query_key][$query_num]);
                }
                $where_array = $search_array[ASEARCH_WHERE];
                $mailbox_array = $search_array[ASEARCH_MAILBOX];
                $what_array = $search_array[ASEARCH_WHAT];
                $unop_array = $search_array[ASEARCH_UNOP];
                $biop_array = asearch_nz($search_array[ASEARCH_BIOP], array());
                $exclude_array = asearch_nz($search_array[ASEARCH_EXCLUDE], array());
                $sub_array = asearch_nz($search_array[ASEARCH_SUB], array());
                $query_display = asearch_get_query_display($color, $mailbox_array, $biop_array, $unop_array, $where_array, $what_array, $exclude_array, $sub_array);
                echo html_tag('td', $query_num + 1, 'right');
                echo html_tag('td', $query_display, 'center', '', 'width="80%"');
                foreach ($action_array as $action => $action_display) {
                    echo html_tag('td', '<a href="' . asearch_get_href('submit=' . $action . '&amp;rownum=' . $query_num) . '">' . $action_display . '</a>', 'center');
                }
                echo '</tr>' . "\n";
                $row_num++;
            }
        }
    }
    echo '</table>' . "\n";
}
Ejemplo n.º 2
0
/**
 * Print a whole query array, recent or saved
 *
 * Function arguments are different in 1.5.0
 * @param array $boxes (unused)
 * @param array $query_array
 * @param mixed $query_keys
 * @param array $action_array
 * @param mixed $title
 * @param string $show_pref
 * @since 1.5.0
 * @private
 */
function asearch_print_query_array(&$boxes, &$query_array, &$query_keys, &$action_array, $title, $show_pref)
{
    global $data_dir, $username;
    global $icon_theme_path;
    global $oTemplate;
    $show_flag = getPref($data_dir, $username, $show_pref, 0) & 1;
    $a = array();
    $main_key = $query_keys[ASEARCH_WHERE];
    $query_count = count($query_array[$main_key]);
    for ($query_num = 0, $row_num = 0; $query_num < $query_count; $query_num++) {
        if (!empty($query_array[$main_key][$query_num])) {
            unset($search_array);
            foreach ($query_keys as $query_key) {
                $search_array[] = asearch_unserialize($query_array[$query_key][$query_num]);
            }
            $where_array = $search_array[ASEARCH_WHERE];
            $mailbox_array = $search_array[ASEARCH_MAILBOX];
            $what_array = $search_array[ASEARCH_WHAT];
            $unop_array = $search_array[ASEARCH_UNOP];
            $biop_array = asearch_nz($search_array[ASEARCH_BIOP], array());
            $exclude_array = asearch_nz($search_array[ASEARCH_EXCLUDE], array());
            $sub_array = asearch_nz($search_array[ASEARCH_SUB], array());
            $query_display = asearch_get_query_display($color, $mailbox_array, $biop_array, $unop_array, $where_array, $what_array, $exclude_array, $sub_array);
            $a[$query_num] = $query_display;
        }
    }
    $oTemplate->assign('list_title', $title);
    $oTemplate->assign('show_list', $show_flag == 1);
    $oTemplate->assign('is_recent_list', $title == _("Recent Searches"));
    $oTemplate->assign('expand_collapse_toggle', '../src/search.php?' . $show_pref . '=' . ($show_flag == 1 ? 0 : 1));
    $oTemplate->assign('query_list', $a);
    $oTemplate->assign('save_recent', '../src/search.php?submit=save_recent&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->assign('do_recent', '../src/search.php?submit=search_recent&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->assign('forget_recent', '../src/search.php?submit=forget_recent&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->assign('edit_saved', '../src/search.php?submit=edit_saved&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->assign('do_saved', '../src/search.php?submit=search_saved&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->assign('delete_saved', '../src/search.php?submit=delete_saved&smtoken=' . sm_generate_security_token() . '&rownum=');
    $oTemplate->display('search_list.tpl');
}