Ejemplo n.º 1
0
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'];
}
Ejemplo n.º 2
0
function au_blog_sidebar_search($value = '')
{
    // The form
    $search_form = '<form method="POST" action="' . au_url('?app=blogindex') . '">
				<input name="search" type="text" value="' . $value . '"/>
				<input type="submit" value="' . BLOG_SEARCH_BTN . '" />
		</form>';
    // Creating the block
    return au_sidebar_block(BLOG_SEARCH, 'search', $search_form);
}
Ejemplo n.º 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']);
}
Ejemplo n.º 4
0
function au_url($url = '', $redirect = false)
{
    global $aulis;
    // If we have a request starting with ?, it's for the main file
    if (au_string_starts_with($url, '?')) {
        $url = $aulis['absolute_path'] . $aulis['file'] . $url;
    } elseif (au_string_starts_with($url, 'au://')) {
        $exploded = explode('au://', $url);
        // Recursion is awesome!
        $url = au_url($exploded[1]);
    } elseif (au_string_starts_with($url, 'http://') or au_string_starts_with($url, 'ftp://') or au_string_starts_with($url, 'https://') or au_string_starts_with($url, 'mailto:')) {
        $url = $url;
    } else {
        $url = $aulis['absolute_path'] . $url;
    }
    // If we are requested to redirect us to the given URL, we have to do that of course.
    if ($redirect) {
        return header("Location:" . $url);
    } else {
        return $url;
    }
}
Ejemplo n.º 5
0
function au_smiley($smiley_name, $smiley_code = '', $smiley_size = 24)
{
    // This is important.
    global $aulis;
    // We need to see whether or not our smiley exists.
    if (!file_exists(au_get_path_from_root('library/smilies/' . $smiley_name . '.svg'))) {
        return false;
    }
    // The size needs to be known by the icons.css file
    if (!in_array($smiley_size, array(16, 24, 32, 48, 64))) {
        return false;
    }
    // Load the icon template, this makes the variable $aulis['smiley_display'] avaible.
    au_load_template("global_smiley");
    // The url of the smiley
    $smiley = au_url('library/smilies/' . $smiley_name . '.svg');
    // return the icon output by the template
    return sprintf($aulis['smiley_display'], $smiley_size, $smiley);
}
Ejemplo n.º 6
0
function au_template_register($data = array(), $iscomplete = false)
{
    global $setting;
    // Show a thanks-page if we need to
    if ($iscomplete == true) {
        au_out('
				<div class="reglogin">
					<div class="sectiontitle">
						' . au_icon('user_add', 16) . ' ' . REGISTER_DONE . '
					</div>
					<div class="sectioncontent">
						' . REGISTER_DONE_DESC . '
					</div>
				</div>');
        return;
    }
    // Now let's just echo the header
    au_out('
			<div class="reglogin">
				' . (!empty($data['error_message']) ? '<div class="notice bg5 c5"><span class="float-right">' . au_icon('warning', 24, 'red') . '</span> ' . implode('<br />', $data['error_message']) . '</div>' : '') . '
				<div class="sectiontitle">
					' . au_icon('user_add', 16) . ' ' . REGISTER . '
				</div>
				<div class="sectioncontent">
					' . REGISTER_WELCOME . '
					<hr />
					<form action="' . au_url('?app=register') . '" method="post">
						<input type="hidden" name="aulis_register" value="1" />
						<table class="user" width="100%">
							<tr>
								<td><span>' . REGISTER_USERNAME . '</span><br />' . REGISTER_USERNAME_DESCRIPTION . '</td>
								<td><input type="text" name="aulis_username"' . (!empty($data['username']) ? ' value="' . $data['username'] . '"' : '') . ' /></td>
							</tr>
							<tr>
								<td><span>' . REGISTER_PASSWORD . '</span><br />' . REGISTER_PASSWORD_DESCRIPTION . '</td>
								<td><input type="password" name="aulis_password" /></td>
							</tr>
							<tr>
								<td><span>' . REGISTER_PASSWORD2 . '</span><br />' . REGISTER_PASSWORD2_DESCRIPTION . '</td>
								<td><input type="password" name="aulis_password2" /></td>
							</tr>
							<tr>
								<td><span>' . REGISTER_EMAIL . '</span><br />' . REGISTER_EMAIL_DESCRIPTION . '</td>
								<td><input type="text" name="aulis_email"' . (!empty($data['email']) ? ' value="' . $data['email'] . '"' : '') . ' /></td>
							</tr>
							<tr>
								<td><span>' . REGISTER_BIRTHDATE . '</span><br />' . REGISTER_BIRTHDATE_DESCRIPTION . '</td>
								<td>
									<select name="aulis_month" id="aulis_month">');
    // Display the months
    for ($month = 1; $month <= 12; $month++) {
        au_out('
										<option value="' . $month . '"' . (!empty($data['birthdate_month']) && $month == $data['birthdate_month'] ? ' selected="selected"' : '') . '>' . constant('DATE_MONTH_' . $month) . '</option>');
    }
    au_out('
									</select>
									<select name="aulis_day" id="aulis_day">');
    // And the days
    for ($day = 1; $day <= 31; $day++) {
        au_out('
										<option value="' . $day . '"' . (!empty($data['birthdate_day']) && $month == $data['birthdate_day'] ? ' selected="selected"' : '') . '>' . $day . '</option>');
    }
    au_out('
									</select>
									<select name="aulis_year" id="aulis_year">');
    // Now continue with the years
    foreach (range(date('Y'), date('Y') - 100) as $year) {
        au_out('
										<option value="' . $year . '"' . (!empty($data['birthdate_year']) && $month == $data['birthdate_year'] ? ' selected="selected"' : '') . '>' . $year . '</option>');
    }
    au_out('
									</select>
								</td>
							</tr>
							<tr>
								<td colspan="2" id="agreement">
									<strong>' . REGISTER_SIGN_AGREEMENT . '</strong><br />
									' . REGISTER_AGREEMENT . '
								</td>
							</tr>');
    // Do we have registration questions to display?
    if (!empty($data['questions'])) {
        foreach ($data['questions'] as $question) {
            au_out('
							<tr>
								<td><span>' . $question['question_title'] . '</span><br />' . $question['question_description'] . '</td>
								<td><input type="text" name="aulis_squestion_' . $question['question_id'] . '" /></td>
							</tr>');
        }
    }
    au_out('
							<tr>
								<td></td>
								<td><input type="submit" value="' . REGISTER_SUBMIT . '" /></td>
							</tr>
						</table>
					</form>
				</div>
			</div>');
}
Ejemplo n.º 7
0
function au_blog_url($input = '', $header = false)
{
    // Global the big $aulis
    global $aulis, $setting;
    // The input needs to be an array otherwise we will redirect to the blogindex
    if (!(is_array($input) and $input != '')) {
        return au_url($setting["enable_blog_url_rewriting"] == "1" ? 'blog' : '?', $header);
    }
    // If we are an array, we have to have the app value
    if (!array_key_exists("app", $input)) {
        return au_url($setting["enable_blog_url_rewriting"] == "1" ? 'blog' : '?', $header);
    }
    // Is blog rewriting enabled?
    if ($setting["enable_blog_url_rewriting"] == "1") {
        // entries/number/entry-name
        if ($input['app'] == "blogentry") {
            return au_url("entries/" . au_encrypt_blog_id($input['id']) . "/" . strtolower(str_replace(array(" ", "?", "!", "&"), array("-", "", "", ""), $input['title'])), $header);
        } else {
            if ($input['app'] == "blogindex" && array_key_exists('offset', $input)) {
                if (array_key_exists('search', $input)) {
                    return au_url('blog/search/' . $input['search'] . '/offset/' . $input['offset'], $header);
                } else {
                    if (array_key_exists('category', $input) && array_key_exists('category_name', $input)) {
                        return au_url('blog/category/' . $input['category'] . '/offset/' . $input['offset'] . '/' . au_string_clean($input['category_name'], '-'), $header);
                    } else {
                        return au_url('blog/offset/' . $input['offset'], $header);
                    }
                }
            } elseif ($input['app'] == 'blogindex' && array_key_exists('category', $input) && array_key_exists('category_name', $input)) {
                return au_url('blog/category/' . $input['category'] . '/' . au_string_clean($input['category_name'], '-'), $header);
            } elseif ($input['app'] == 'blogindex' && array_key_exists('search', $input)) {
                return au_url('blog/search/' . au_string_clean($input['search']), $header);
            } else {
                if ($input['app'] == 'blogindex' && count($input) == 1) {
                    return au_url('blog', $header);
                } else {
                    return au_url("?" . http_build_query($input), $header);
                }
            }
        }
    }
    // Otherwise just a normal url
    return au_url("?" . http_build_query($input), $header);
}
Ejemplo n.º 8
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');
}
Ejemplo n.º 9
0
 	<link rel="shortcut icon" type="image/png" href="' . $aulis['absolute_path'] . 'library/static/favicon.png" />
 	<script src="' . $aulis['absolute_path'] . 'library/js-assets/jquery-1.11.3.min.js"></script>
  </head>
  <body class="bg4">
  	<header>
  		<div class="top-stripe bg1"></div>
  		<div class="logobar bg2">
  			<div class="userstack float-right">
  				<a href=""><img src="' . $aulis['absolute_path'] . '/uploads/avatars/80183_1.png" /></a>
  				<span class="username"><a href="">Charlie ' . au_icon('small_arrow_down', 8, 'black') . '</a></span>
  			</div>
	  		<div class="iconstack float-left">
	  			<a href="javascript:void();">' . au_icon('menu', 24, 'black') . '</a>
	  			<a href="javascript:void();">' . au_icon('house', 24, 'black') . '</a>
	  		</div> 
	  		<a href="' . au_url() . '"><img src="' . $aulis['absolute_path'] . 'themes/hannover/images/logo.svg" /></a>
  		</div>
  		<div class="navbar bg3">
	  		<div class="menustack float-left">';
// Load the main menu
$menu_tabs = au_menu();
// Show the tabs
foreach ($menu_tabs as $tab) {
    if ($tab['visible'] == true) {
        echo '
					<a href="' . $tab['link'] . '"' . ($tab['active'] == 1 || $tab['type'] != 1 ? ' class="' . ($tab['active'] == 1 ? 'active' : '') . ($tab['type'] != 1 ? ($tab['active'] == 1 ? ' ' : '') . $tab['type'] : '') . '"' : '') . ' target="' . $tab['target'] . '">' . $tab['text'] . '</a>';
    }
}
echo '
  			</div>
  		</div>