Changeset 1283
- Timestamp:
- 06/26/08 23:27:36 (4 months ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/dev/logs (deleted)
- trunk/dev/ReadMe.txt (deleted)
- trunk/dev/script (deleted)
- trunk/dev/spec.rtf (deleted)
- trunk/dev/wordpress_patch_history.txt (deleted)
- trunk/doc/spec.rtf (copied) (copied from branches/1.0/doc/spec.rtf)
- trunk/logs (copied) (copied from branches/1.0/logs)
- trunk/script (copied) (copied from branches/1.0/script)
- trunk/script/compare-wordpress-code (copied) (copied from branches/1.0/script/compare-wordpress-code)
- trunk/script/compare-wordpress-structure (copied) (copied from branches/1.0/script/compare-wordpress-structure)
- trunk/script/console (copied) (copied from branches/1.0/script/console)
- trunk/script/console.php (copied) (copied from branches/1.0/script/console.php)
- trunk/script/phpsh (copied) (copied from branches/1.0/script/phpsh)
- trunk/script/phpsh/ansicolor.py (copied) (copied from branches/1.0/script/phpsh/ansicolor.py)
- trunk/script/phpsh/ctags.py (copied) (copied from branches/1.0/script/phpsh/ctags.py)
- trunk/script/phpsh/LICENSE (copied) (copied from branches/1.0/script/phpsh/LICENSE)
- trunk/script/phpsh/phpsh (copied) (copied from branches/1.0/script/phpsh/phpsh)
- trunk/script/phpsh/phpsh.php (copied) (copied from branches/1.0/script/phpsh/phpsh.php)
- trunk/script/phpsh/README (copied) (copied from branches/1.0/script/phpsh/README)
- trunk/src/config/wp-config-sample.php (modified) (3 diffs)
- trunk/src/lib/backport.php (copied) (copied from branches/1.0/src/lib/backport.php)
- trunk/src/lib/functions.php (modified) (10 diffs)
- trunk/src/lib/lyceum-registration-functions.php (modified) (5 diffs)
- trunk/src/lib/session.php (modified) (1 diff)
- trunk/src/lib/taglib.php (copied) (copied from branches/1.0/src/lib/taglib.php)
- trunk/src/lyceum/ajax/availability.php (modified) (1 diff)
- trunk/src/lyceum/atom.php (copied) (copied from branches/1.0/src/lyceum/atom.php)
- trunk/src/lyceum/lost-pass.php (modified) (1 diff)
- trunk/src/lyceum/portal.php (modified) (1 diff)
- trunk/src/lyceum/private.php (modified) (1 diff)
- trunk/src/lyceum/system-admin/add-users.php (deleted)
- trunk/src/lyceum/system-admin/blog-management.php (modified) (1 diff)
- trunk/src/lyceum/system-admin/createusers.php (modified) (1 diff)
- trunk/src/lyceum/system-admin/lyceum.css (copied) (copied from branches/1.0/src/lyceum/system-admin/lyceum.css)
- trunk/src/lyceum/system-admin/lyceum-footer.php (copied) (copied from branches/1.0/src/lyceum/system-admin/lyceum-footer.php)
- trunk/src/lyceum/system-admin/lyceum-header.php (copied) (copied from branches/1.0/src/lyceum/system-admin/lyceum-header.php)
- trunk/src/lyceum/system-admin/rewriterules.php (modified) (2 diffs)
- trunk/src/lyceum/system-admin/setoption.php (modified) (1 diff)
- trunk/src/lyceum/system-admin/settings.php (modified) (3 diffs)
- trunk/src/lyceum/system-admin/systemplugins.php (modified) (4 diffs)
- trunk/src/lyceum/system-admin/user-management.php (modified) (1 diff)
- trunk/src/lyceum/system-admin/viewregistrationlist.php (modified) (1 diff)
- trunk/src/lyceum/wp-admin/admin-footer.php (modified) (1 diff)
- trunk/src/lyceum/wp-admin/admin-functions.php (modified) (3 diffs)
- trunk/src/lyceum/wp-admin/admin-header.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/export.php (copied) (copied from branches/1.0/src/lyceum/wp-admin/export.php)
- trunk/src/lyceum/wp-admin/import.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/import/wordpress.php (modified) (13 diffs)
- trunk/src/lyceum/wp-admin/index.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/install.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/link-categories.php (modified) (12 diffs)
- trunk/src/lyceum/wp-admin/menu.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/options-general.php (modified) (3 diffs)
- trunk/src/lyceum/wp-admin/options.php (modified) (6 diffs)
- trunk/src/lyceum/wp-admin/post.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/profile.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/profile-update.php (modified) (1 diff)
- trunk/src/lyceum/wp-admin/upgrade-functions.php (modified) (2 diffs)
- trunk/src/lyceum/wp-admin/upgrade.php (modified) (1 diff)
- trunk/src/lyceum/wp-admin/upgrade-schema.php (modified) (5 diffs)
- trunk/src/lyceum/wp-admin/user-list.php (deleted)
- trunk/src/lyceum/wp-admin/users.php (modified) (3 diffs)
- trunk/src/lyceum/wp-admin/wp-admin.css (modified) (1 diff)
- trunk/src/lyceum/wp-atom.php (modified) (1 diff)
- trunk/src/lyceum/wp-commentsrss2.php (modified) (1 diff)
- trunk/src/lyceum/wp-content/plugins/akismet (copied) (copied from branches/1.0/src/lyceum/wp-content/plugins/akismet)
- trunk/src/lyceum/wp-content/plugins/akismet/akismet.gif (copied) (copied from branches/1.0/src/lyceum/wp-content/plugins/akismet/akismet.gif)
- trunk/src/lyceum/wp-content/plugins/akismet/akismet.php (copied) (copied from branches/1.0/src/lyceum/wp-content/plugins/akismet/akismet.php)
- trunk/src/lyceum/wp-content/plugins/akismet.gif (deleted)
- trunk/src/lyceum/wp-content/plugins/akismet.php (deleted)
- trunk/src/lyceum/wp-content/portal/style.css (modified) (1 diff)
- trunk/src/lyceum/wp-content/systemplugins (modified) (1 prop)
- trunk/src/lyceum/wp-content/themes/default/comments.php (modified) (1 diff)
- trunk/src/lyceum/wp-content/themes/default/header.php (modified) (1 diff)
- trunk/src/lyceum/wp-content/themes/default/index.php (modified) (1 diff)
- trunk/src/lyceum/wp-includes/classes.php (modified) (2 diffs)
- trunk/src/lyceum/wp-includes/functions.php (modified) (5 diffs)
- trunk/src/lyceum/wp-includes/pluggable-functions.php (modified) (5 diffs)
- trunk/src/lyceum/wp-includes/registration-functions.php (modified) (1 diff)
- trunk/src/lyceum/wp-includes/template-functions-general.php (modified) (1 diff)
- trunk/src/lyceum/wp-includes/version.php (modified) (1 diff)
- trunk/src/lyceum/wp-includes/wp-db.php (modified) (1 diff)
- trunk/src/lyceum/wp-links-opml.php (modified) (1 diff)
- trunk/src/lyceum/wp-login.php (modified) (3 diffs)
- trunk/src/lyceum/wp-rdf.php (modified) (1 diff)
- trunk/src/lyceum/wp-register.php (modified) (13 diffs)
- trunk/src/lyceum/wp-settings.php (modified) (3 diffs)
- trunk/src/lyceum/wp-trackback.php (modified) (1 diff)
- trunk/src/lyceum/xmlrpc.php (modified) (1 diff)
- trunk/test (copied) (copied from branches/1.0/test)
- trunk/test/ReadMe.txt (copied) (copied from branches/1.0/test/ReadMe.txt)
- trunk/tests (deleted)
- trunk/test/WordPress (copied) (copied from branches/1.0/test/WordPress)
- trunk/test/WordPress/unit (copied) (copied from branches/1.0/test/WordPress/unit)
- trunk/test/WordPress/unit/all_tests.php (copied) (copied from branches/1.0/test/WordPress/unit/all_tests.php)
- trunk/test/WordPress/unit/wp-includes (copied) (copied from branches/1.0/test/WordPress/unit/wp-includes)
- trunk/test/WordPress/unit/wp-includes/functions.php (copied) (copied from branches/1.0/test/WordPress/unit/wp-includes/functions.php)
- trunk/test/WordPress/web (copied) (copied from branches/1.0/test/WordPress/web)
- trunk/test/WordPress/web/all_tests.php (copied) (copied from branches/1.0/test/WordPress/web/all_tests.php)
- trunk/test/WordPress/web/config.php (copied) (copied from branches/1.0/test/WordPress/web/config.php)
- trunk/test/WordPress/web/PageValidator.php (copied) (copied from branches/1.0/test/WordPress/web/PageValidator.php)
- trunk/test/WordPress/web/validation.php (copied) (copied from branches/1.0/test/WordPress/web/validation.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore set to
tags
- Property svn:ignore set to
trunk/src/config/wp-config-sample.php
r986 r1283 9 9 $table_prefix = ''; // Only numbers, letters, and underscores please! 10 10 11 12 define('PROTOCOL', 'http://'); 11 13 // The web path to the base of lyceum (where portal.php is sitting), with NO TRAILING SLASH 12 14 // Something like '' or '/lyceum' or '/src/lyceum' 13 15 define('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 19 define('SRCROOT', WEBROOT); 20 14 21 // The IP address or equivalent domain name of the server (MUST have 1 or more periods - 'localhost' will not work!) 15 22 define('MAINDOMAIN', 'blogs.example.com'); 16 23 define('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); 17 36 18 37 //you probably want to leave these as they are … … 32 51 define('ERRORLOG', LOGDIR . 'lyceum_error_log'); 33 52 define('QUERYLOG', LOGDIR . 'lyceum_query_log'); 53 define('TOKENLOG', LOGDIR . 'lyceum_token_log'); 34 54 35 55 // Change this to localize WordPress. A corresponding MO file for the … … 39 59 define ('WPLANG', ''); 40 60 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) 42 62 define('SAVEWPCOMMENTS', true); 43 63 trunk/src/lib/functions.php
r1055 r1283 14 14 } 15 15 16 function token_log($event, $information){ 17 $time = date('i:s'); 18 $message = "\n".$time." - [$event]: $information"; 19 error_log($message, 3, TOKENLOG); 20 } 21 16 22 function assert_handler($file, $line, $code){ 17 23 //TODO log error in log file when assertion fails … … 68 74 "); 69 75 return $blogs; 76 } 77 78 // Retrieves the $num last posts published on the entire system 79 function 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 105 function 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'; 70 108 } 71 109 … … 124 162 return; 125 163 while (($obj = readdir($dh))) { 126 if( $obj=='.' || $obj=='..')164 if(in_array( $obj, array('.', '..', '.svn'))) 127 165 continue; 128 166 if (!@unlink($dir.'/'.$obj)) { … … 136 174 function arrayify(&$thing){ 137 175 $thing = $thing ? $thing : array(); 176 } 177 178 function lyceum_session_reset(){ 179 setcookie(session_name(), '', time()-42000, '/', '.'.MAINDOMAIN); 180 session_unset(); 181 session_destroy(); 182 } 183 184 function 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 198 function blog_post_count(){ 199 global $wpdb; 200 return $wpdb->get_post_var('count(*)', "post_status = 'publish'"); 138 201 } 139 202 … … 164 227 $key = sha1($targetscript.$action.$id.$userdata->ID); 165 228 //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 ); 167 234 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 ); 172 246 return false; 173 174 if (!$keep) 175 unset($_SESSION['formtokens'][$key][$token]); 247 } 248 249 // if (!$keep) 250 // unset($_SESSION['formtokens'][$key][$token]); 176 251 return true; 177 252 } … … 183 258 184 259 function 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>'); 186 261 } 187 262 … … 196 271 } 197 272 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 274 function validateSlug($slug){ 199 275 $denied = get_admin_option_array('slug_blacklist'); 200 276 $denied[] = ''; … … 233 309 } 234 310 311 function 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 316 function 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 235 325 function delete_blog($blog){ 236 326 global $wpdb; … … 307 397 WHERE blog = '$blog' 308 398 "); 309 399 400 // usermeta 401 $wpdb->query(" 402 DELETE FROM $wpdb->usermeta WHERE blog = '$blog' 403 "); 404 310 405 // blog record 311 406 $wpdb->query(" … … 348 443 } 349 444 445 function remove_b_var_from_query_string($qs){ 446 return preg_replace('/b=[^&]*/', '', $qs); 447 } 448 350 449 function get_url_arg_pairs($url) { 351 $args = parse_url($url, PHP_URL_QUERY); 450 $parsed_url = parse_url($url); 451 $args = $parsed_url['query']; 352 452 $arr = array(); 353 453 foreach (explode('&', $args) as $i) { trunk/src/lib/lyceum-registration-functions.php
r1073 r1283 8 8 } 9 9 10 function lyceum_create_blog_from_username($username, $blog_name =false){10 function lyceum_create_blog_from_username($username, $blog_name){ 11 11 global $wpdb; 12 12 $userid = $wpdb->get_var("SELECT `ID` FROM $wpdb->users WHERE `user_login` = '$username'"); … … 14 14 } 15 15 16 function lyceum_create_blog ($userid, $blog_name =false){16 function lyceum_create_blog ($userid, $blog_name){ 17 17 global $wpdb, $blog, $cache_settings, $table_prefix, $optiondomain, $wp_rewrite; 18 18 $optiondomain = 'blog'; … … 22 22 if (1==$user->user_admin) 23 23 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' )"); 25 25 $blog = $wpdb->insert_id; 26 if (!$blog_name)27 $newname = $user->user_login."_blog_".$blog;28 else29 $newname = $blog_name;30 $wpdb->query("UPDATE $wpdb->blogs SET slug = '$newname' WHERE id = $blog");31 26 assert('isset($blog)'); 32 27 … … 38 33 $wpuser = new WP_User($userid); 39 34 $wpuser->set_role('administrator'); 40 update_option('blogname', $ newname);35 update_option('blogname', $blog_name); 41 36 update_option('admin_email', $user->user_email); 42 37 … … 55 50 $catid=$wpdb->insert_id; 56 51 update_option('default_category', $catid); 57 // First post58 $now = date('Y-m-d H:i:s');59 $now_gmt = gmdate('Y-m-d H:i:s');60 52 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'" ); 64 63 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' 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 "); 67 68 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 "); 71 73 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' 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 } 74 105 75 106 $wp_rewrite->flush_rules(); 76 107 108 lyceum_new_blog_notification($blog, $userid); 109 77 110 return $blog; 78 111 } 112 113 function 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 79 133 ?> trunk/src/lib/session.php
r430 r1283 1 1 <?php 2 2 3 /*session_set_save_handler('_open', 4 '_close', 5 '_read', 6 '_write', 7 '_destroy', 8 '_clean');*/ 3 if (defined('DBSESSIONS')) 4 session_set_save_handler( '_open', 5 '_close', 6 '_read', 7 '_write', 8 '_destroy', 9 '_clean' ); 9 10 10 11 function _open() trunk/src/lyceum/ajax/availability.php
r865 r1283 22 22 if (!validateSlug($slug)){ 23 23 $color='red'; 24 $message = 'Invalid blog name';24 $message = 'Invalid blog address'; 25 25 } else if (isset($_POST['currentSlug']) && 0 == strcmp($slug, $_POST['currentSlug'])) 26 26 echo ""; 27 27 else if(!slugAvailable($slug)){ 28 28 $color = 'red'; 29 $message = 'Blog namein use';29 $message = 'Blog address in use'; 30 30 } else{ 31 31 $color = 'green'; 32 $message = 'Valid blog name';32 $message = 'Valid blog address'; 33 33 } 34 34 echo "<font color=\"$color\">$slug</font>"; trunk/src/lyceum/lost-pass.php
r967 r1283 106 106 $message .= LURL . "/lost-pass.php?action=inputpass&key=$key\r\n"; 107 107 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); 109 109 110 110 if ($m == false) trunk/src/lyceum/portal.php
r1083 r1283 13 13 $site_title = get_settings('site_title'); 14 14 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(" 16 CREATE 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 35 if ( 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 17 45 <html xmlns="http://www.w3.org/1999/xhtml"> 18 46 19 47 <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 27 59 <body> 28 60 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&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 . " • "; 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 ></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 »</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 »</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 35 312 </div> 36
