function au_menu()
{
    global $aulis;
    // The menu array itself
    $aulis['menu'] = array('index' => array('text' => MENU_INDEX, 'link' => au_url(), 'visible' => true, 'active' => $aulis['active'] == 'frontpage' ? 1 : 0, 'target' => '_self', 'type' => 1), 'blog' => array('text' => MENU_BLOG, 'link' => au_blog_url(), 'visible' => true, 'active' => $aulis['active'] == 'blog' ? 1 : 0, 'target' => '_self', 'type' => 1), 'forum' => array('text' => MENU_FORUM, 'link' => au_url('?app=boardindex'), 'visible' => true, 'active' => $aulis['active'] == 'forum' ? 1 : 0, 'target' => '_self', 'type' => 1), 'login' => array('text' => MENU_LOGIN, 'link' => au_url('?app=login'), 'visible' => true, 'active' => $aulis['active'] == 'login' ? 1 : 0, 'target' => '_self', 'type' => 1), 'register' => array('text' => MENU_REGISTER, 'link' => au_url('?app=register'), 'visible' => true, 'active' => $aulis['active'] == 'register' ? 1 : 0, 'target' => '_self', 'type' => 1), 'admincp' => array('text' => MENU_ADMIN, 'link' => au_url('Admin.php'), 'visible' => true, 'active' => $aulis['active'] == 'admincp' ? 1 : 0, 'target' => '_self', 'type' => 'c7'), 'moderation' => array('text' => MENU_MOD, 'link' => au_url('?app=modcp'), 'visible' => true, 'active' => $aulis['active'] == 'moderation' ? 1 : 0, 'target' => '_self', 'type' => 'c1'));
    // We're done here
    return $aulis['menu'];
}
示例#2
0
function au_template_blog_preview()
{
    // Our template needs the big $aulis
    global $aulis;
    // Let's make this thing shorter
    $e = $aulis['blog_entry'];
    // If our blog has no seperate intro text, it is the same as the whole blog
    if ($e->blog_intro == '' and $e->blog_content != '') {
        $e->blog_intro = $e->blog_content;
    } else {
        if ($e->blog_intro == '' and $e->blog_content == '') {
            return au_error_box(BLOG_EMPTY);
        }
    }
    // We might have to highlight stuff
    if (isset($_GET['search'])) {
        // Explode the search string, so that we can highlight every word seperatly
        $exploded_search = explode(' ', $aulis['blog_search']);
        // Each word needs to be highlighted in blog_name and blog_intro
        foreach ($exploded_search as $keyword) {
            $e->blog_name = au_highlight($keyword, $e->blog_name, "<span class='highlight'>", "</span>");
            $e->blog_intro = au_highlight($keyword, $e->blog_intro, "<span class='highlight'>", "</span>");
        }
    }
    // The href to the blog entry page
    $href = au_blog_url($aulis['blog_url_input']);
    // The heading
    au_out("<h1><a href='" . $href . "'>" . $e->blog_name . "</a></h1>", true, 'blog_entries');
    // The sub heading with time and catergory
    au_out("<span class='sub'>" . au_icon('category', 12) . ' ' . sprintf(BLOG_POSTED_IN, "<a href='" . au_blog_url(array('app' => 'blogindex', 'category' => $e->blog_category, 'category_name' => $e->category_name)) . "'>" . $e->category_name . "</a>") . "\n\t\t " . au_icon('clock', 12) . ' ' . au_date($e->blog_date) . "</span>", true, 'blog_entries');
    // The content
    au_out("<p>" . au_parse_blog($e->blog_intro, $e->blog_parse_mode) . "</p>", true, 'blog_entries');
    // Comments bar!
    au_out('<div class="comments_bar"><a href="' . $href . '#comments">' . au_icon('comment', 12) . ' ' . ($aulis['blog_comment_count'] == 0 ? BLOG_NO_COMMENTS : $aulis['blog_comment_count'] . ' ' . ($aulis['blog_comment_count'] > 1 ? BLOG_COMMENTS : BLOG_COMMENT)) . '</a> | <a href="' . $href . '">' . au_icon('lamp', 12) . ' ' . BLOG_READMORE . '</a></div>', $e->blog_can_comment == 1, 'blog_entries');
    // We need this for the output
    $blog_preview = '';
    // Finish the output into $aulis['page']['blog_preview']
    foreach ($aulis['page']['blog_entries'] as $entry) {
        $blog_preview .= $entry;
    }
    // Transfer the output
    au_out($blog_preview, true, 'blog_preview');
    // Ready for the next one
    unset($aulis['blog']['entry'], $aulis['page']['blog_entries']);
}
示例#3
0
function au_template_blog_entry()
{
    // Our template needs the big $aulis
    global $aulis;
    // Let's make this thing shorter
    $e = $aulis['blog']['entry'];
    // The href to the blog entry page
    $href = au_blog_url($aulis['blog']['url_input']);
    // The wrapper
    au_out("<div class='blog_full_wrapper'>");
    // The heading
    au_out("<h1><a href='" . $href . "'>" . $e->blog_name . "</a></h1>");
    // The sub heading with time and catergory
    au_out("<span class='sub'><a class='icon i-category i-12'></a> " . sprintf(BLOG_POSTED_IN, "<a href='" . au_url("?app=blogindex&category=" . $e->blog_category) . "'>" . $e->category_name . "</a>") . "\n\t\t <a class='icon i-clock i-12'></a> " . au_date($e->blog_date) . "</span>");
    // The content
    au_out("<p>" . au_parse_blog($e->blog_content) . "</p>");
    // Ending the wrapper
    au_out("</div>");
    // Ready for the next one
    unset($aulis['blog']['entry']);
}
示例#4
0
function au_blog_sidebar_categories()
{
    // Temp output
    $output = '';
    // The title and such
    // We need to get the blog categories
    $categories = au_get_blog_categories();
    // If there are no categories, that needs to be shown
    if ($categories->rowCount() === 0) {
        return au_sidebar_block(BLOG_CATEGORIES, 'category', BLOG_CATEGORIES_NONE);
    }
    // For each category we need to show a line
    while ($category = $categories->fetchObject()) {
        // We need an url element for the au_blog_url function
        $category_url = array("app" => "blogindex", "category" => $category->category_id, "category_name" => $category->category_name);
        $output .= '<a href=' . au_blog_url($category_url) . '>' . $category->category_name . '</a><br />';
    }
    // Remove the final <br />
    $output = preg_replace('/' . preg_quote('<br />', '/') . '$/', '', $output);
    // Return a neat side bar block
    return au_sidebar_block(BLOG_CATEGORIES, 'category', $output);
}
示例#5
0
function au_blog_index_timeline_links()
{
    // We need $aulis, all information we need is stored there
    global $aulis;
    $links = '';
    // We need to make input for the au_blog_url function
    $href_older = array("app" => "blogindex", "offset" => $aulis['blog_next_offset']);
    $href_newer = array("app" => "blogindex", "offset" => $aulis['blog_previous_offset']);
    // Do we need a to add search, category or tag paramaters to the hrefs?
    if (isset($_GET['search']) and !isset($_GET['tag'], $_GET['category'])) {
        $href_older['search'] = $_GET['search'];
        $href_newer['search'] = $_GET['search'];
    }
    if (isset($_GET['category']) and !isset($_GET['tag'], $_GET['search'])) {
        $href_older['category'] = $_GET['category'];
        $href_older['category_name'] = au_get_blog_category_name($_GET['category']);
        $href_newer['category_name'] = au_get_blog_category_name($_GET['category']);
        $href_newer['category'] = $_GET['category'];
    }
    if (isset($_GET['tag']) and !isset($_GET['category'], $_GET['search'])) {
        $href_older['tag'] = $_GET['tag'];
        $href_newer['tag'] = $_GET['tag'];
    }
    // Is the newer link the link to the newest entries, we don't need offset then
    if ($href_newer['offset'] == 0) {
        unset($href_newer['offset']);
    }
    // Are we that far behind that we have newer as well?
    if ($aulis['blog_current_offset'] != 0) {
        $links .= '<span class="float-right"><a href="' . au_blog_url($href_newer) . '">' . BLOG_NEWER_ENTRIES . '</a></span>';
    }
    // Are there, like, any older entries?
    if ($aulis['blog_next_offset'] < $aulis['blog_count']) {
        $links .= '<span class="float-left"><a href="' . au_blog_url($href_older) . '">' . BLOG_OLDER_ENTRIES . '</a></span>';
    }
    return $links;
}
示例#6
0
function au_show_blogindex()
{
    // $aulis might come in handy here
    global $aulis, $setting;
    // Did our lovely user specify an offset?
    if (isset($_GET['offset']) && is_numeric($_GET['offset'])) {
        $offset = $_GET['offset'];
    } else {
        $offset = 0;
    }
    // Extra parameters, in case we need them
    $extra_parameters = '';
    // Are we searching?
    if (isset($_REQUEST['search']) && !isset($_REQUEST['category'], $_REQUEST['tag'])) {
        // Empty searches are not allowed
        if (trim($_REQUEST['search']) == '') {
            au_blog_url('', true);
        }
        // Do we maybe need to clean a search string before redirecting?
        if (isset($_POST['search']) && $_POST['search'] != '') {
            // Do we need to clean it or is urlencode enough?
            if ($setting['enable_blog_url_rewriting'] == 1) {
                $search_string = au_string_clean($_POST['search']);
            } else {
                $search_string = urlencode($_POST['search']);
            }
            // The cleaned string cannot be empty
            if ($search_string != '') {
                // Redirect to clean url if possible
                if ($setting['enable_blog_url_rewriting'] == 1) {
                    au_url('blog/search/' . $search_string, true);
                } else {
                    au_url('?app=blogindex&search=' . $search_string, true);
                }
            }
            // Nothing more here for us now
            die;
        }
        // Do we maybe need to unclean the search string?
        if (isset($_GET['search']) && isset($_GET['rewrite'])) {
            $aulis['blog_search'] = str_replace("+", " ", $_GET['search']);
            $aulis['blog_search'] = str_replace("-plus-", "+", $aulis['blog_search']);
        } else {
            if (isset($_GET['search'])) {
                $aulis['blog_search'] = urldecode($_GET['search']);
            } else {
                $aulis['blog_search'] = '';
            }
        }
        // Time to form the extra parameters
        $exploded_search = explode(' ', $aulis['blog_search']);
        foreach ($exploded_search as $keyword) {
            $regex = "REGEXP '[[:<:]]" . au_db_escape($keyword) . "[[:>:]]'";
            $extra_parameters .= " AND (entries.blog_name {$regex} OR entries.blog_intro {$regex} OR entries.blog_content {$regex})";
        }
    }
    // Do we have to add parameters for category or tag to the query?
    if (isset($_GET['category']) && is_numeric($_GET['category']) && !isset($_GET['search'], $_GET['tag']) && ($aulis['blog_category'] = $_GET['category'])) {
        $extra_parameters .= ' AND ' . (isset($_GET['category']) ? "entries.blog_category = {$_GET['category']}" : '');
    }
    // Let's build the query
    $query = "SELECT entries.*, COUNT(comments.comment_id) AS comment_count, categories.category_name AS category_name\n\tFROM blog_entries AS entries \n\tLEFT JOIN blog_comments AS comments ON entries.entry_id = comments.blog_id \n\tLEFT JOIN blog_categories AS categories ON entries.blog_category = categories.category_id \n\tWHERE entries.blog_activated = 1 and entries.blog_in_queue = 0 {$extra_parameters} GROUP BY entries.entry_id ORDER BY entries.blog_date DESC;";
    // We are building the simple version of the query now, because that's enough to get info from
    $query_simple_parameters = "entries.blog_activated = 1 and entries.blog_in_queue = 0 {$extra_parameters}";
    // We are getting the maximum offset and the initial row count right now
    $query_info = au_get_max_blog_offset($query_simple_parameters);
    // We need to check if our offset is, like, alright, otherwise we need to redirect
    if (!au_check_offset($offset, THEME_BLOG_ENTRIES_PER_PAGE, $query_info['max_offset'])) {
        $_GET['offset'] = au_validate_offset($offset, THEME_BLOG_ENTRIES_PER_PAGE, $query_info['max_offset']);
        au_blog_url($_GET, true);
    }
    // Let's load all blog entries that are activated and are not in the queue (thus are published)
    $entries = au_parse_pagination($query, true, $offset, THEME_BLOG_ENTRIES_PER_PAGE, $query_info['row_count']);
    // For each blog item, we want to show its preview
    while ($entry = $entries['paged']->fetchObject()) {
        au_show_blog_preview($entry);
    }
    // We might want to transfer the information about the pagination, so that it can be used in the template
    $aulis['blog_count'] = $query_info['row_count'];
    $aulis['blog_current_offset'] = $offset;
    $aulis['blog_next_offset'] = $entries['next_position'];
    $aulis['blog_previous_offset'] = $entries['previous_position'];
    $aulis['blog_max_offset'] = $query_info['max_offset'];
    // This will load the wrapper! :)
    return au_load_template('blog_index');
}