コード例 #1
0
function snippet_archiveprevious($text = "")
{
    global $Cfg, $db, $Weblogs, $Current_weblog, $Archive_array, $archive_array_prev, $Pivot_Vars, $Paths;
    if ($text == "") {
        $text = lang('weblog_text', 'previous_archive');
    }
    if (!defined('LIVEPAGE')) {
        // in 'normal' archive pages'..
        if (!isset($db->entry)) {
            return "";
        }
        // get the filename for the current archive..
        $current_archive = make_archive_name();
        $id = $db->entry['code'];
        // get the archive_array, if it's not done yet.
        if (!isset($Archive_array)) {
            make_archive_array();
        }
        // we make another array where we number the archives. As far as i know this is
        // the only decent way to find the next or previous entries..
        // sometime i will want to cache this for performance
        $counter = 0;
        // 2004/11/23 =*=*= JM - foreach() test
        if (is_array($Archive_array[$Current_weblog])) {
            foreach ($Archive_array[$Current_weblog] as $this_key => $this_val) {
                $temp_arr[$counter] = $this_key;
                if ($this_key == $current_archive) {
                    $this_count = $counter;
                }
                $counter++;
            }
        }
        // then, we'll pick out the next one in the array (remember, the array
        // is in reverse chronological order)
        if (isset($temp_arr[$this_count - 1])) {
            $prev_arc = $temp_arr[$this_count - 1];
            $target = set_target('', 'target="_self"');
            $date = $Archive_array[$Current_weblog][$prev_arc];
            $link = make_archive_link($date);
            $text = format_date($date, $text);
            $link = sprintf("<a href=\"%s\" %s>%s</a>", $link, $target, $text);
            return $link;
        } else {
            return "";
        }
    } else {
        // display link for pages in 'live archives'
        // guessstimate the current sybweblog.
        reset($Weblogs[$Current_weblog]['sub_weblog']);
        $my_subweblog = current($Weblogs[$Current_weblog]['sub_weblog']);
        $show = $my_subweblog['num_entries'];
        if (!isset($Pivot_Vars['o']) || empty($Pivot_Vars['o']) || $Pivot_Vars['o'] <= 0) {
            $offset = -1;
        } else {
            if ($Pivot_Vars['o'] < $show) {
                $offset = 0;
            } else {
                $offset = $Pivot_Vars['o'] - $show;
            }
        }
        // if it's the first one, we don't have to show it.
        if ($offset >= 0) {
            if ($Cfg['mod_rewrite'] == 0) {
                $url = $Paths['pivot_url'] . "archive.php?c=%s&amp;o=%s";
            } else {
                $url = $Paths['log_url'] . "category/%s/?o=%s";
            }
            $link = sprintf($url, para_category($Pivot_Vars['c']), $offset);
            if (para_weblog_needed($Current_weblog)) {
                $link .= '&amp;w=' . para_weblog($Current_weblog);
            } elseif (isset($_GET['w']) && !empty($_GET['w'])) {
                $link .= '&amp;w=' . htmlspecialchars($_GET['w']);
            }
            if (isset($_GET['t']) && !empty($_GET['t'])) {
                $link .= '&amp;t=' . htmlspecialchars($_GET['t']);
            }
            $target = set_target('', 'target="_self"');
            $link = sprintf("<a href=\"%s\" %s>%s</a>", $link, $target, $text);
        } else {
            $link = "";
        }
        return $link;
    }
}
コード例 #2
0
ファイル: metaweblog.php プロジェクト: wborbajr/TecnodataApp
/**
 * Creates a list of categories (with description and more properties) for 
 * the given blog ID.
 * 
 * @param string $blogid
 * @return array
 */
function pivot_get_blog_cats($blogid)
{
    global $Paths;
    $cats = find_cats_in_weblog($blogid);
    $cats_info = array();
    foreach ($cats as $cat) {
        // (categoryid is needed by Windows Live Writer.)
        $cats_info[] = array('description' => $cat, 'title' => $cat, 'categoryid' => $cat, 'htmlUrl' => $Paths['host'] . $Paths['pivot_url'] . "archive.php?c=" . para_category($cat));
    }
    i18n_array_to_utf8($cats_info, $dummy, true);
    return $cats_info;
}
コード例 #3
0
ファイル: pv_admin.php プロジェクト: wborbajr/TecnodataApp
/**
 * Display the 'categories' screen.
 */
function see_categories($err = 0)
{
    global $Cfg, $Pivot_Vars;
    PageHeader(lang('adminbar', 'categories_title'), 1, 'switch');
    PageAnkeiler(lang('userbar', 'admin') . ' &raquo; ' . lang('adminbar', 'categories_title'));
    $cat_page = array();
    $cats = cfg_cats();
    //get the list of people that can post..
    $overall = explode("|", $Cfg['users']);
    foreach ($cats as $cat) {
        // Allowed users, but only the ones that still exist.
        $allowed = implode(", ", array_intersect($cat['allowed'], $overall));
        $title = sprintf("%s </a>(users: %s)</i>", $cat['name'], $allowed);
        if ($cat['searchexclusion'] == 1) {
            $title .= ' [not indexed]';
        }
        if ($cat['nonpublic'] == 1) {
            $title .= ' [not public]';
        }
        if ($cat['hidden'] == 1) {
            $title .= ' [hidden]';
        }
        array_push($cat_page, array($title, 'cat_edit&amp;cat=' . para_category($cat['name']), sprintf(lang('category', 'edit_who'), $cat['name'])));
    }
    DispPage($cat_page, 'category');
    if ($err == 1) {
        $err_msg = lang('category', 'same_name');
    } elseif ($err == 2) {
        $err_msg = lang('category', 'need_name');
    }
    StartForm('save_cat', 1);
    StartTable();
    GenSetting('', lang('category', 'make_new'), '', 8, '', 2);
    GenSetting('cat_name', lang('category', 'name'), $err_msg, 0, $Pivot_Vars['cat_name']);
    foreach (explode("|", $Cfg['users']) as $user) {
        $rvar[] = $user;
        $rvar[] = $user;
    }
    $cols = count(explode("|", $Cfg['users'])) - 2;
    if ($cols < 4) {
        $cols = 4;
    }
    GenSetting('allowed', lang('category', 'users'), lang('category', 'canpost'), 4, $rvar, $cols, 'multiple');
    GenSetting('new', '', '', 7, '1');
    // 2004/10/14 =*=*= JM - incorporate search-index switch
    GenSetting('cat_searchindex', lang('category', 'search_index_newctitle'), lang('category', 'search_index_newcdesc'), 3, 'yn', '', '1');
    // Order setting
    GenSetting('cat_order', lang('category', 'order'), lang('category', 'order_desc'), 0, '100');
    // Public setting..
    GenSetting('cat_public', lang('category', 'public'), lang('category', 'public_desc'), 3, 'yn', '', '1');
    // Hidden setting..
    GenSetting('cat_hidden', lang('category', 'hidden'), lang('category', 'hidden_desc'), 3, 'yn', '', '0');
    EndForm(lang('category', 'create'), 1);
    PageFooter();
}