1 ? "archive" : "index" ) . ".php"); } // Main RSS Feed function page_index_feed() { global $conf; set_theme( $conf['feed.theme'] ); page_index(); } // Author Page function page_author( $author="", $num=1 ) { global $theme_path, $title; $title = $author; load_author_posts( $author, $num ); include("$theme_path/author.php"); } // Author Statuses Page function page_author_statuses( $author="", $num=1 ) { header("Location: /$author/"); exit(); } // Paginated Page function page_archive( $year=0, $month=0, $num=1 ) { global $theme_path, $title; $title = "$year Archives"; if ( $month > 0 ) { $title = date("F", strtotime("$year-$month-01")) . " $title"; } load_archive_posts( 0, 0, $num - 0 ); include("$theme_path/archive.php"); } // Single Post function page_single( $id=0 ) { global $theme_path, $title; load_single_post( $id ); $title = get_title(); include("$theme_path/single.php"); } // Settings Page function page_settings() { global $theme_path, $conf, $title, $timezones; if ( !loggedin() ) { page_error( 'You must be logged in.' ); } else { $profile = get_profile(); if ( $_POST['form'] == 'account' ) { // Update the profile information mysql_query(sprintf("UPDATE users SET location='%s', fullname='%s', timezone='%s', icon='%s' WHERE id=%s;", $_POST['location'], $_POST['fullname'], $_POST['timezone'], $_POST['icon'], $profile['id'] )); // Update the password (when necessary) if ( !empty($_POST['pass']) && $_POST['pass'] == $_POST['pass2'] ) { mysql_query(sprintf("UPDATE users SET password=SHA1('%s') WHERE id=%s;", $_POST['pass'], $profile['id'] )); } // Make sure we're getting the updated profile reload_profile(); $profile = get_profile(); } elseif ( $_POST['form'] == 'settings' && is_admin() ) { // Get a clean copy of the settings $tmp_conf = $_POST; unset($tmp_conf['form']); // Save the updated settings foreach ( $tmp_conf as $name => $value ) { $name = ereg_replace( "_", ".", $name ); mysql_query(sprintf("UPDATE conf SET value='%s' WHERE name='%s';", $value, $name )); } load_conf(); } $title = "Settings"; include("$theme_path/settings.php"); } } // Registration Page function page_register() { global $theme_path, $conf, $title; if ( !can_register() ) { page_error( 'Registration not allowed.' ); } else { $title = "Register"; include("$theme_path/register.php"); } } // Login Page function page_login() { global $theme_path, $conf, $title; if ( loggedin() ) { page_error( 'Login not allowed.' ); } else { $title = "Login"; include("$theme_path/login.php"); } } // Logout Page function page_logout() { global $theme_path, $conf, $title; if ( !loggedin() ) { page_error( 'Logout not allowed.' ); } else { $title = "Logout"; include("$theme_path/logout.php"); } } // Error Page function page_error( $msg="" ) { global $theme_path, $error_msg, $title; $error_msg = $msg; $title = "Error: $msg"; include("$theme_path/error.php"); } ?>