Log in with username/password: lyceum/lyceum

Changeset 1283

Show
Ignore:
Timestamp:
06/26/08 23:27:36 (4 months ago)
Author:
jjb
Message:

Merging in entire history of 1.0 branch.

svn merge -r1084:1282 http://source.ibiblio.org/svn/lyceum/branches/1.0
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property svn:ignore set to
      tags
  • trunk/src/config/wp-config-sample.php

    r986 r1283  
    99$table_prefix  = '';     // Only numbers, letters, and underscores please! 
    1010 
     11 
     12define('PROTOCOL', 'http://'); 
    1113// The web path to the base of lyceum (where portal.php is sitting), with NO TRAILING SLASH 
    1214// Something like '' or '/lyceum' or '/src/lyceum' 
    1315define('WEBROOT', ''); 
     16// The web path to the base of lyceum (where portal.php is sitting), with NO TRAILING SLASH. 
     17// Only change this if you are doing a non-typical installation, otherwise it will happily be the same 
     18// as WEBROOT 
     19define('SRCROOT', WEBROOT); 
     20 
    1421// The IP address or equivalent domain name of the server (MUST have 1 or more periods - 'localhost' will not work!) 
    1522define('MAINDOMAIN', 'blogs.example.com'); 
    1623define('DEFAULTBLOG', false); 
     24 
     25// Sessions 
     26// 
     27// It is highly recommended that you set your own session path, so that other php applications 
     28// on your server (including possibly those from other users on shared hosting) do not prematurely 
     29// clear your session data. You must ensure that this directory exists and is writable  
     30// by the webserver. Here are two recommended paths for *nix and Windows:  
     31//   define('SESSIONPATH', '/tmp/blogs.example.com');   // *nix 
     32//   define('SESSIONPATH', '\\TEMP\blogs.example.com'); // Windows 
     33// 
     34// Database sessions will be fully supported in Lyceum 1.1 and are currently experimental 
     35//   define('DBSESSIONS', true); 
    1736 
    1837//you probably want to leave these as they are 
     
    3251define('ERRORLOG', LOGDIR . 'lyceum_error_log'); 
    3352define('QUERYLOG', LOGDIR . 'lyceum_query_log'); 
     53define('TOKENLOG', LOGDIR . 'lyceum_token_log'); 
    3454 
    3555// Change this to localize WordPress.  A corresponding MO file for the 
     
    3959define ('WPLANG', ''); 
    4060 
    41 //should lyceum NOT create an obfuscated filename for wp-comments-post.php at install time? (if you don't know what this means just leave it
     61//should lyceum NOT create an obfuscated filename for wp-comments-post.php at install time? (if you don't know what this means just leave it set to true
    4262define('SAVEWPCOMMENTS', true); 
    4363 
  • trunk/src/lib/functions.php

    r1055 r1283  
    1414} 
    1515 
     16function token_log($event, $information){ 
     17      $time = date('i:s'); 
     18      $message = "\n".$time." - [$event]: $information"; 
     19      error_log($message, 3, TOKENLOG); 
     20} 
     21 
    1622function assert_handler($file, $line, $code){ 
    1723   //TODO log error in log file when assertion fails 
     
    6874   "); 
    6975   return $blogs; 
     76} 
     77 
     78// Retrieves the $num last posts published on the entire system 
     79function get_recent_posts($num){ 
     80   global $wpdb; 
     81 
     82   $gmt_now = gmdate('Y-m-d H:i:s'); 
     83 
     84   $post_ids = $wpdb->get_col( 
     85      "SELECT DISTINCT $wpdb->posts.ID 
     86      FROM $wpdb->posts 
     87         INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID) 
     88            INNER JOIN $wpdb->categories ON (category_id = cat_ID ) 
     89               INNER JOIN $wpdb->blogs ON (blog = $wpdb->blogs.id) 
     90      WHERE 
     91         status = 'active' AND 
     92         post_status = 'publish' AND 
     93         post_password = '' AND 
     94         post_date_gmt < '$gmt_now' 
     95      ORDER BY post_date_gmt DESC 
     96      LIMIT $num 
     97   "); 
     98 
     99   $posts = array(); 
     100   foreach($post_ids as $id) 
     101      $posts[] = get_post($id); 
     102   return $posts; 
     103} 
     104 
     105function rfc3339($date){ 
     106   preg_match('/([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]) ([0-9][0-9]:[0-9][0-9]:[0-9][0-9])/', $date, $matches); 
     107   return $matches[1].'T'.$matches[2].'Z'; 
    70108} 
    71109 
     
    124162      return; 
    125163   while (($obj = readdir($dh))) { 
    126       if($obj=='.' || $obj=='..')  
     164      if(in_array( $obj, array('.', '..', '.svn'))) 
    127165         continue; 
    128166      if (!@unlink($dir.'/'.$obj)) { 
     
    136174function arrayify(&$thing){ 
    137175   $thing = $thing ? $thing : array(); 
     176} 
     177 
     178function lyceum_session_reset(){ 
     179   setcookie(session_name(), '', time()-42000, '/',  '.'.MAINDOMAIN); 
     180   session_unset(); 
     181   session_destroy(); 
     182} 
     183 
     184function lyceum_no_posts_message() { 
     185   global $blog, $blogdata; 
     186 
     187   echo '<h2 class="center">' . "This blog does not have any posts." . '</h2>'; 
     188   echo '<p class="center">'; 
     189 
     190   if ( current_user_can('edit_posts') ) 
     191      echo '<a href="' . get_settings('home') . "/admin/post.php\">" . __('Click here to start blogging.') . '</a>'; 
     192   else 
     193      echo '<a href="' . LURL . "\">" . __('Click here to see other content on ' . get_settings('site_title') . '.') . '</a>'; 
     194 
     195   echo '</p>'; 
     196} 
     197 
     198function blog_post_count(){ 
     199   global $wpdb; 
     200   return $wpdb->get_post_var('count(*)', "post_status = 'publish'"); 
    138201} 
    139202 
     
    164227   $key = sha1($targetscript.$action.$id.$userdata->ID); 
    165228//trace('checking token: $token, $targetscript, $action, $id, user, $key', "$token, $targetscript, $action, $id, $userdata->ID, $key"); 
    166    if (!array_key_exists($token, $_SESSION['formtokens'][$key])) 
     229   if (!array_key_exists($token, $_SESSION['formtokens'][$key])){ 
     230      token_log('Token does not exist',  
     231         "Key: " . $key . "\n" . 
     232         "Token: " . $token . "\n" 
     233      ); 
    167234      return false; 
    168  
    169    $token_age = time() - $_SESSION['formtokens'][$key][$token]; 
    170  
    171    if ($token_age >= 86400)//86400 seconds = 24 hours 
     235   } 
     236   $current_time = time(); 
     237   $token_age = $current_time - $_SESSION['formtokens'][$key][$token]; 
     238 
     239   if ($token_age >= 86400){//86400 seconds = 24 hours 
     240      token_log('Token age failure', 
     241         "Key: " . $key . "\n" . 
     242         "Token: " . $token . "\n" . 
     243         "Current time: " . $current_time . "\n" . 
     244         "Token age: " . $token_age . "\n" 
     245      ); 
    172246      return false; 
    173  
    174    if (!$keep) 
    175       unset($_SESSION['formtokens'][$key][$token]); 
     247   } 
     248 
     249   // if (!$keep) 
     250   //    unset($_SESSION['formtokens'][$key][$token]); 
    176251   return true; 
    177252} 
     
    183258 
    184259function badTokenMessage(){ 
    185    die("Your tokens have timed out. <a href='{$_SERVER['HTTP_REFERER']}'>Reload</a> the page to reset your tokens.");   
     260   die("Your tokens have timed out. <a href='{$_SERVER['HTTP_REFERER']}'>Reload</a> the page to reset your tokens. (this link might not take you anywhere useful.). The contents of your request is printed below-- It has not been saved to the system! You should save this if it does not exist elsewhere!<pre>". array_print($_REQUEST) . '</pre>'); 
    186261} 
    187262 
     
    196271} 
    197272 
    198 function validateSlug($slug){ // returns true if slug is lowercase alphanumeric & slug isn't blacklisted 
     273// returns true if slug is lowercase alphanumeric & slug isn't blacklisted 
     274function validateSlug($slug){ 
    199275   $denied = get_admin_option_array('slug_blacklist'); 
    200276   $denied[] = ''; 
     
    233309} 
    234310 
     311function slug_from_blog_id($blog_id){ 
     312   global $wpdb; 
     313   return $wpdb->get_var("SELECT slug FROM $wpdb->blogs WHERE id = '$blog_id'"); 
     314} 
     315 
     316function url_from_blog_id($blog_id){ 
     317   $slug = slug_from_blog_id($blog_id); 
     318   return 
     319      PROTOCOL . 
     320      ( SUBDOMAINS ? $slug . '.' : '' ) . 
     321      MAINDOMAIN . '/' . 
     322      ( SUBDOMAINS ? '' : $slug . '/'  ); 
     323} 
     324 
    235325function delete_blog($blog){ 
    236326   global $wpdb; 
     
    307397      WHERE blog = '$blog' 
    308398   "); 
    309     
     399 
     400   //  usermeta 
     401   $wpdb->query(" 
     402      DELETE FROM $wpdb->usermeta WHERE blog = '$blog' 
     403   "); 
     404 
    310405   // blog record 
    311406   $wpdb->query(" 
     
    348443} 
    349444 
     445function remove_b_var_from_query_string($qs){ 
     446   return preg_replace('/b=[^&]*/', '', $qs); 
     447} 
     448 
    350449function get_url_arg_pairs($url) { 
    351    $args = parse_url($url, PHP_URL_QUERY); 
     450   $parsed_url = parse_url($url); 
     451   $args = $parsed_url['query']; 
    352452   $arr  = array();   
    353453   foreach (explode('&', $args) as $i) { 
  • trunk/src/lib/lyceum-registration-functions.php

    r1073 r1283  
    88} 
    99 
    10 function lyceum_create_blog_from_username($username, $blog_name=false){ 
     10function lyceum_create_blog_from_username($username, $blog_name){ 
    1111   global $wpdb; 
    1212   $userid = $wpdb->get_var("SELECT `ID` FROM $wpdb->users WHERE `user_login` = '$username'"); 
     
    1414} 
    1515 
    16 function lyceum_create_blog ($userid, $blog_name=false){ 
     16function lyceum_create_blog ($userid, $blog_name){ 
    1717   global $wpdb, $blog, $cache_settings, $table_prefix, $optiondomain, $wp_rewrite; 
    1818   $optiondomain = 'blog'; 
     
    2222   if (1==$user->user_admin) 
    2323      die('The system admin user may not create or have specific privileges on a blog (this user already has all privileges on all blogs).'); 
    24    $wpdb->query("INSERT INTO $wpdb->blogs (created) VALUES ( NOW( ) )"); 
     24   $wpdb->query("INSERT INTO $wpdb->blogs (created, slug) VALUES ( NOW( ), '$blog_name' )"); 
    2525   $blog = $wpdb->insert_id; 
    26    if (!$blog_name) 
    27       $newname = $user->user_login."_blog_".$blog; 
    28    else 
    29       $newname = $blog_name; 
    30    $wpdb->query("UPDATE $wpdb->blogs SET slug = '$newname' WHERE id = $blog"); 
    3126   assert('isset($blog)'); 
    3227 
     
    3833   $wpuser = new WP_User($userid); 
    3934   $wpuser->set_role('administrator'); 
    40    update_option('blogname', $newname); 
     35   update_option('blogname', $blog_name); 
    4136   update_option('admin_email', $user->user_email); 
    4237    
     
    5550   $catid=$wpdb->insert_id; 
    5651   update_option('default_category', $catid); 
    57    // First post 
    58    $now = date('Y-m-d H:i:s'); 
    59    $now_gmt = gmdate('Y-m-d H:i:s'); 
    6052 
    61    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, comment_count) VALUES ($userid, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to '.get_settings('site_title').'. This is your first post. Edit or delete it, then start blogging!'))."', '".$wpdb->escape(__('Hello world!'))."', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1')");   
    62    $postid=$wpdb->insert_id; 
    63    $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($postid, $catid)" ); 
     53   if(get_settings('create_example_post')){ 
     54      // First post 
     55      $now = date('Y-m-d H:i:s'); 
     56      $now_gmt = gmdate('Y-m-d H:i:s'); 
     57      $post_content = $wpdb->escape(__(get_settings('example_post_body'))); 
     58      $post_title = $wpdb->escape(__(get_settings('example_post_title'))); 
     59      $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, comment_count) VALUES ($userid, '$now', '$now_gmt', '".$post_content."', '".$post_title."', '".$wpdb->escape(__('hello-world'))."', '$now', '$now_gmt', '1')"); 
     60      $postid=$wpdb->insert_id; 
     61      $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($postid, $catid)" ); 
     62      $wpdb->query( "UPDATE $wpdb->posts SET guid = '".get_permalink($postid)."' WHERE ID = '$postid'" ); 
    6463 
    65    // Default comment 
    66    $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('$postid', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts&#039; comments, there you will have the option to edit or delete them.'))."')"); 
     64      $wpdb->query(" 
     65       INSERT INTO $wpdb->postsearch (post_id, component, textdata) 
     66         VALUES ('$postid', 'title', '$post_title') 
     67     "); 
    6768 
    68    // First Page 
    69    $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, post_status, page_blog) VALUES ($userid, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a page. You could edit this to put information about yourself or your site. You can create as many pages or sub-pages as you like, and manage all of your content inside of the '.get_settings('site_title').' web interface.'))."', '".$wpdb->escape(__('About'))."', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '$blog')"); 
    70    $pageid=$wpdb->insert_id; 
     69      $wpdb->query(" 
     70       INSERT INTO $wpdb->postsearch (post_id, component, textdata) 
     71         VALUES ('$postid', 'content', '$post_content') 
     72     ");  
    7173 
    72    //temporary fix until i do more sophisticated hacking of class WP_Query 
    73    $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($pageid, $catid)" ); 
     74      // Default comment 
     75      $comment_content = $wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in, and view the posts&#039; comments, there you will have the option to edit or delete them.')); 
     76      $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('$postid', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org', '$now', '$now_gmt', '".$comment_content."')"); 
     77      $commentid=$wpdb->insert_id; 
     78 
     79      $wpdb->query(" 
     80       INSERT INTO $wpdb->postsearch (post_id, object_id, component, textdata) 
     81         VALUES ('$postid', '$commentid', 'comment', '$comment_content') 
     82     "); 
     83   }   
     84 
     85   if( get_settings('create_example_page')){ 
     86      // First Page 
     87      $page_title = $wpdb->escape(__(get_settings('example_page_title'))); 
     88      $page_content = $wpdb->escape(__(get_settings('example_page_body'))); 
     89      $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_title, post_name, post_modified, post_modified_gmt, post_status, page_blog) VALUES ($userid, '$now', '$now_gmt', '".$page_content."', '".$page_title."', '".$wpdb->escape(__('about'))."', '$now', '$now_gmt', 'static', '$blog')"); 
     90      $pageid=$wpdb->insert_id; 
     91      $wpdb->query( "UPDATE $wpdb->posts SET guid = '".get_permalink($pageid)."' WHERE ID = '$pageid'" ); 
     92 
     93      $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($pageid, $catid)" ); 
     94 
     95      $wpdb->query(" 
     96       INSERT INTO $wpdb->postsearch (post_id, component, textdata) 
     97         VALUES ('$pageid', 'title', '$page_title') 
     98     "); 
     99 
     100      $wpdb->query(" 
     101       INSERT INTO $wpdb->postsearch (post_id, component, textdata) 
     102         VALUES ('$pageid', 'content', '$page_content') 
     103     ");  
     104   } 
    74105 
    75106   $wp_rewrite->flush_rules(); 
    76107 
     108   lyceum_new_blog_notification($blog, $userid); 
     109 
    77110   return $blog; 
    78111} 
     112 
     113function lyceum_new_blog_notification($blog_id, $user_id) { 
     114   global $wpdb; 
     115 
     116   $user = new WP_User($user_id); 
     117    
     118   $user_login = stripslashes($user->user_login); 
     119   $user_email = stripslashes($user->user_email); 
     120 
     121   $message  = sprintf(__('New blog created on %s: '), get_settings('site_title')) . "\r\n"; 
     122   $message .= sprintf(__('Blog: %s'), url_from_blog_id($blog_id)) . "\r\n"; 
     123   $message .= sprintf(__('Created by: %s (%s)'), $user_login, $user_email) . "\r\n\r\n\r\n"; 
     124    
     125   @wp_mail(get_settings('system_admin_email'), sprintf(__('[%s] New Blog Created'), get_settings('site_title')), $message); 
     126 
     127   $message .= get_settings('new_blog_welcome_message'); 
     128 
     129   wp_mail($user_email, sprintf(__('[%s] New Blog Created'), get_settings('site_title')), $message); 
     130} 
     131 
     132 
    79133?> 
  • trunk/src/lib/session.php

    r430 r1283  
    11<?php 
    22 
    3 /*session_set_save_handler('_open', 
    4                          '_close', 
    5                          '_read', 
    6                          '_write', 
    7                          '_destroy', 
    8                          '_clean');*/ 
     3if (defined('DBSESSIONS')) 
     4   session_set_save_handler( '_open', 
     5                             '_close', 
     6                             '_read', 
     7                             '_write', 
     8                             '_destroy', 
     9                             '_clean' ); 
    910 
    1011function _open() 
  • trunk/src/lyceum/ajax/availability.php

    r865 r1283  
    2222      if (!validateSlug($slug)){ 
    2323         $color='red'; 
    24          $message =  'Invalid blog name'; 
     24         $message =  'Invalid blog address'; 
    2525      } else if (isset($_POST['currentSlug']) && 0 == strcmp($slug, $_POST['currentSlug'])) 
    2626         echo ""; 
    2727      else if(!slugAvailable($slug)){ 
    2828         $color = 'red'; 
    29          $message = 'Blog name in use'; 
     29         $message = 'Blog address in use'; 
    3030      } else{ 
    3131         $color = 'green'; 
    32          $message = 'Valid blog name'; 
     32         $message = 'Valid blog address'; 
    3333      } 
    3434      echo "<font color=\"$color\">$slug</font>"; 
  • trunk/src/lyceum/lost-pass.php

    r967 r1283  
    106106   $message .= LURL . "/lost-pass.php?action=inputpass&key=$key\r\n"; 
    107107 
    108    $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_settings('blogname')), $message); 
     108   $m = wp_mail($user_email, sprintf(__('[%s] Password Reset'), get_settings('site_title')), $message); 
    109109 
    110110   if ($m == false)  
  • trunk/src/lyceum/portal.php

    r1083 r1283  
    1313$site_title = get_settings('site_title'); 
    1414 
    15 ?> 
    16 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     15$wpdb->query(" 
     16CREATE TEMPORARY TABLE bloginfo 
     17   SELECT $wpdb->blogs.id, $wpdb->blogs.slug, option_value as blogname, status 
     18   FROM $wpdb->blogs 
     19      INNER JOIN $wpdb->options ON ($wpdb->blogs.id = $wpdb->options.blog) 
     20      INNER JOIN $wpdb->posts 
     21      INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID) 
     22      INNER JOIN $wpdb->categories ON (category_id = cat_ID AND $wpdb->categories.blog = $wpdb->options.blog) 
     23   WHERE 
     24      status = 'active' AND 
     25      option_name = 'blogname' AND 
     26      post_title != 'Hello world!' AND 
     27      post_title != 'About' 
     28   ORDER BY post_date_gmt DESC       
     29"); 
     30 
     31$blogs = $wpdb->get_results("SELECT DISTINCT(id), slug, blogname, status FROM bloginfo ORDER BY blogname ASC"); 
     32 
     33$posts = get_recent_posts(10); 
     34 
     35if ( isset($_SESSION['slug_error']) ) { 
     36   $slug_error = $_SESSION['slug_error']; 
     37   unset($_SESSION['slug_error']); 
     38
     39 
     40// =========================================================================== 
     41?> 
     42<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
     43   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     44 
    1745<html xmlns="http://www.w3.org/1999/xhtml"> 
    1846 
    1947<head profile="http://gmpg.org/xfn/11"> 
    20 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    21  
    22 <title><?php echo $site_title ?></title> 
    23  
    24 <link rel="stylesheet" href="<?php echo WEBROOT ?>/wp-content/portal/style.css" type="text/css" media="screen" /> 
    25  
    26    </head> 
     48   <title><?php echo $site_title ?></title> 
     49 
     50   <link rel="stylesheet" href="<?php echo LURL ?>/wp-admin/wp-admin.css" type="text/css" /> 
     51   <link rel="stylesheet" href="<?php echo LURL ?>/system-admin/lyceum.css" type="text/css" /> 
     52 
     53   <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php echo LURL ?>/atom.php" /> 
     54 
     55   <meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_option('system_charset') ?>" /> 
     56</head> 
     57 
     58 
    2759<body> 
    2860 
    29  
    30  
    31 <?php if ($user_identity) { ?> 
    32 <div id="status"> 
    33    <div class="description"><?php  echo "logged in as <em>$user_identity</em>"?> [<a href="login?action=logout">Log Out</a>]</div> 
    34 Lyceum 
     61<div id="PageWrapper" class="Portal"> 
     62 
     63   <!-- BEGIN: header --> 
     64   <div id="lyceum-header"> 
     65 
     66      <h1><?php echo $site_title ?></h1> 
     67 
     68<?php 
     69   if ($user_identity) { 
     70?> 
     71      <ul id="authentication-tools"> 
     72         <li> 
     73            logged in as: <?php printf(__('<strong>%s</strong>'), $user_identity) ?>  
     74            [<a href="<?php echo LURL ?>/login?action=logout&amp;redirect_to=/portal.php" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>] 
     75         </li> 
     76         <li> 
     77<?php 
     78   if ($userdata->user_admin) { 
     79      $system_settings_link = "System Settings"; 
     80      if (strpos($_SERVER['REQUEST_URI'],'settings')) { // this is... pretty weak. -jsb 
     81         $system_settings_link = "<strong>" . $system_settings_link . "</strong>"; 
     82      } else { 
     83         $system_settings_link = "<a href=\"" . LURL . "/system-admin/settings.php\">" . $system_settings_link . "</a>"; 
     84      } 
     85      echo $system_settings_link . " &bull; "; 
     86   } 
     87 
     88   $my_account_link = __('My Account'); 
     89   if (strpos($_SERVER['REQUEST_URI'],'profile')) { // this is... pretty weak. -jjb 
     90      $my_account_link = "<strong>" . $my_account_link . "</strong>"; 
     91   } else { 
     92      $my_account_link = "<a href=\"" . LURL . "/profile\">" . $my_account_link . "</a>"; 
     93   } 
     94   echo $my_account_link; 
     95?> 
     96         </li> 
     97      </ul> 
     98<?php 
     99   } 
     100?> 
     101 
     102   </div> 
     103   <!-- END: header --> 
     104 
     105   <hr /> 
     106 
     107   <!-- BEGIN: body --> 
     108   <div id="BodyWrapper"> 
     109 
     110<?php 
     111   if ( isset($slug_error) ) { 
     112?> 
     113      <p class="Error"><?php echo $slug_error; ?></p> 
     114<?php 
     115   } 
     116?> 
     117 
     118      <!-- BEGIN: main column --> 
     119      <div id="MainColumn"> 
     120 
     121         <!-- BEGIN: recent posts --> 
     122         <div id="recent-posts"> 
     123            <h2>Recent Posts</h2> 
     124<?php 
     125   if ($posts) { 
     126?> 
     127            <ul> 
     128<?php 
     129      foreach ($posts as $p) { 
     130?> 
     131               <li> 
     132                  <strong><a href="<?php echo $p->guid ?>"><?php echo $p->post_title ?></a></strong><br /> 
     133                  <span>from <a href="<?php echo $p->siteurl ?>"><?php echo $p->blogname ?></a> by <?php echo $p->author_nickname ?></span> 
     134                  <div><?php echo strip_tags($p->post_content) ?>... <a href="<?php echo $p->guid ?>">Read More &gt;</a></div> 
     135               </li> 
     136<?php 
     137      } 
     138?> 
     139            </ul> 
     140       
     141<?php 
     142   } else { 
     143?> 
     144            <p><em>The system does not have any blog posts yet.</em></p> 
     145<?php 
     146   } 
     147?> 
     148         </div> 
     149         <!-- END: recent posts --> 
     150 
     151 
     152         <!-- BEGIN: all blogs --> 
     153         <div id="all-blogs"> 
     154            <h2>All Blogs <span>(<?php echo count($blogs) ?> total)</span></h2> 
     155<?php 
     156   if ($blogs) { 
     157?> 
     158            <ul> 
     159<?php 
     160      if (SUBDOMAINS) { 
     161         foreach ($blogs as $b) { 
     162?> 
     163               <li> 
     164                  <a href="http://<?php echo $b->slug . "." . MAINDOMAIN ?>"><?php echo $b->blogname ?></a> 
     165               </li> 
     166<?php 
     167         } 
     168      } else { 
     169         foreach ($blogs as $b) { 
     170?> 
     171               <li> 
     172                  <a href="./<?php echo $b->slug ?>"><?php echo $b->blogname ?></a> 
     173               </li> 
     174<?php 
     175         } 
     176      } 
     177?> 
     178            </ul> 
     179<?php 
     180   } else { 
     181?> 
     182            <p><em> 
     183               The system does not have any blogs yet. 
     184<?php 
     185      if ($userdata->user_admin) { 
     186?> 
     187               <a href="system-admin/blog-management.php">Create some now &raquo;</a> 
     188<?php 
     189      } 
     190?> 
     191            </em></p> 
     192<?php 
     193   } 
     194?> 
     195         </div> 
     196         <!-- END: all blogs --> 
     197 
     198      </div> 
     199      <!-- END: main column --> 
     200 
     201      <hr /> 
     202 
     203      <!-- BEGIN: side column --> 
     204      <div id="SideColumn"> 
     205<?php 
     206   if ($userdata->user_admin) { 
     207?> 
     208         <!-- BEGIN: lyceum admin --> 
     209         <div id="lyceum-admin"> 
     210            <h2>Lyceum Admin</h2> 
     211            <ul> 
     212               <li><a href="system-admin/settings.php">System Settings</a></li> 
     213               <li><a href="system-admin/blog-management.php">Manage Blogs</a></li> 
     214               <li><a href="system-admin/user-management.php">Manage Users</a></li> 
     215               <li><a href="system-admin/systemplugins.php">Manage Plugins</a></li> 
     216               <li><a href="system-admin/rewriterules.php">Rewrite Rules</a></li> 
     217            </ul> 
     218         </div> 
     219         <!-- END: lyceum admin --> 
     220<?php 
     221   } elseif ($user_identity) { 
     222?> 
     223         <!-- BEGIN: my blogs --> 
     224         <div id="my-blogs"> 
     225            <h2>My Blogs</h2> 
     226<?php 
     227   $myblogs = get_userblogs(); 
     228 
     229   if ($myblogs) { 
     230?> 
     231            <ul> 
     232<?php 
     233      foreach ($myblogs as $b) { 
     234?>        
     235               <li> 
     236                  <h3><a href="<?php echo $b->home ?>"><?php echo $b->blogname ?></a></h3> 
     237                  <p><?php echo $b->tagline ?></p> 
     238                  <a href="<?php echo $b->home ?>">view</a> | <a href="<?php echo $b->home ?>/admin">admin</a> 
     239               </li> 
     240<?php 
     241      } 
     242?> 
     243            </ul> 
     244<?php 
     245   } else { 
     246?> 
     247            <p><em>You do not have any blogs yet. <a href="/register">Create one now &raquo;</a></em></p> 
     248<?php 
     249   } 
     250?> 
     251         </div> 
     252         <!-- END: my blogs --> 
     253<?php 
     254   } else { 
     255?> 
     256         <!-- BEGIN: login box --> 
     257         <div id="login-box"> 
     258 
     259            <h2>Log In</h2> 
     260 
     261            <form name="login_form" id="login_form" action="<?php echo WEBROOT ?>/login" method="post"> 
     262               <fieldset> 
     263                  <div class="Field"> 
     264                     <label for="username"><?php _e('Username:') ?></label><br /> 
     265                     <input type="text" name="log" id="username" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" class="TextInput" /> 
     266                  </div> 
     267 
     268                  <div class="Field"> 
     269                     <label for="password"><?php _e('Password:') ?></label><br /> 
     270                     <input type="password" name="pwd" id="password" value="" class="TextInput" /> 
     271                  </div> 
     272 
     273                  <input type="hidden" name="redirect_to" value="/portal.php" /> 
     274 
     275                  <ul class="Inputs"> 
     276                     <li><input type="checkbox" name="rememberme" id="remember_me" value="forever" class="CheckboxInput" /> <label for="remember_me"><?php _e('Remember me'); ?></label></li> 
     277                  </ul> 
     278 
     279                  <div class="FormAction"> 
     280                     <input type="submit" value="Log In" /> 
     281                  </div> 
     282          
     283               </fieldset> 
     284            </form> 
     285 
     286            <div id="new-user"> 
     287               <h3>New User?</h3> 
     288               <p><a href="register">Register now</a> for an account.</p> 
     289            </div> 
     290 
     291         </div> 
     292         <!-- END: login box --> 
     293<?php 
     294   } 
     295?> 
     296      </div> 
     297      <!-- END: side column --> 
     298 
     299   </div> 
     300   <!-- END: body --> 
     301 
     302   <div class="ClearFix"><!-- NOTE: do not remove --></div> 
     303 
     304   <hr /> 
     305 
     306   <!-- BEGIN: footer --> 
     307   <div id="lyceum-footer"> 
     308      <p>Powered by <a href="http://lyceum.ibiblio.org/">Lyceum</a></p> 
     309   </div> 
     310   <!-- END: footer --> 
     311    
    35312</div> 
    36