Changeset 1249
- Timestamp:
- 10/23/07 02:19:37 (1 year ago)
- Files:
-
- branches/1.0/src/lib/functions.php (modified) (1 diff)
- branches/1.0/src/lib/lyceum-registration-functions.php (modified) (1 diff)
- branches/1.0/src/lyceum/system-admin/settings.php (modified) (1 diff)
- branches/1.0/src/lyceum/wp-admin/install.php (modified) (2 diffs)
- branches/1.0/src/lyceum/wp-admin/upgrade-schema.php (modified) (1 diff)
- branches/1.0/src/lyceum/wp-content/themes/default/index.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/src/lib/functions.php
r1233 r1249 182 182 } 183 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'"); 201 } 202 184 203 function bloginput(){ 185 204 global $blogdata; branches/1.0/src/lib/lyceum-registration-functions.php
r1175 r1249 50 50 $catid=$wpdb->insert_id; 51 51 update_option('default_category', $catid); 52 // First post53 $now = date('Y-m-d H:i:s');54 $now_gmt = gmdate('Y-m-d H:i:s');55 52 56 $post_content = $wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!')); 57 $post_title = $wpdb->escape(__('Hello world!')); 58 $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')"); 59 $postid=$wpdb->insert_id; 60 $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($postid, $catid)" ); 61 $wpdb->query( "UPDATE $wpdb->posts SET guid = '".get_permalink($postid)."' WHERE ID = '$postid'" ); 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(__('Hello world!')); 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'" ); 62 63 63 $wpdb->query("64 INSERT INTO $wpdb->postsearch (post_id, component, textdata)65 VALUES ('$postid', 'title', '$post_title')66 ");64 $wpdb->query(" 65 INSERT INTO $wpdb->postsearch (post_id, component, textdata) 66 VALUES ('$postid', 'title', '$post_title') 67 "); 67 68 68 $wpdb->query("69 INSERT INTO $wpdb->postsearch (post_id, component, textdata)70 VALUES ('$postid', 'content', '$post_content')71 ");69 $wpdb->query(" 70 INSERT INTO $wpdb->postsearch (post_id, component, textdata) 71 VALUES ('$postid', 'content', '$post_content') 72 "); 72 73 73 // Default comment74 $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.'));75 $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."')");76 $commentid=$wpdb->insert_id;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; 77 78 78 $wpdb->query(" 79 INSERT INTO $wpdb->postsearch (post_id, object_id, component, textdata) 80 VALUES ('$postid', '$commentid', 'comment', '$comment_content') 81 "); 82 83 // First Page 84 $page_title = $wpdb->escape(__('About')); 85 $page_content = $wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.')); 86 $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')"); 87 $pageid=$wpdb->insert_id; 88 $wpdb->query( "UPDATE $wpdb->posts SET guid = '".get_permalink($pageid)."' WHERE ID = '$pageid'" ); 79 $wpdb->query(" 80 INSERT INTO $wpdb->postsearch (post_id, object_id, component, textdata) 81 VALUES ('$postid', '$commentid', 'comment', '$comment_content') 82 "); 83 } 89 84 90 //temporary fix until i do more sophisticated hacking of class WP_Query 91 $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($pageid, $catid)" ); 85 if( get_settings('create_example_page')){ 86 // First Page 87 $page_title = $wpdb->escape(__('About page example -- edit me!')); 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 92 93 $wpdb->query(" 94 INSERT INTO $wpdb->postsearch (post_id, component, textdata) 95 VALUES ('$pageid', 'title', '$page_title') 96 "); 93 $wpdb->query( "INSERT INTO $wpdb->post2cat (`post_id`, `category_id`) VALUES ($pageid, $catid)" ); 97 94 98 $wpdb->query(" 99 INSERT INTO $wpdb->postsearch (post_id, component, textdata) 100 VALUES ('$pageid', 'content', '$page_content') 101 "); 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 } 102 105 103 106 $wp_rewrite->flush_rules(); branches/1.0/src/lyceum/system-admin/settings.php
r1217 r1249 307 307 308 308 <form method="post" action="setoption.php" class="lyceum_form"> 309 <?php echo tokeninput('setoption.php', 'create_example_post')?> 310 <input type="hidden" name="option" value="create_example_post" /> 311 312 <table class="FormTable"> 313 <col width="20%" /> 314 <col width="80%" /> 315 316 <tbody> 317 <tr> 318 <th scope="row"><span class="Label">Create Example Post</span></th> 319 <td> 320 <ul class="HorizList Inputs"> 321 <li><input type="radio" name="value" id="create_example_post_1" value="1" <?php echo get_option('create_example_post')?'checked="checked"':"" ?> /> <label for="create_example_post_1">Yes</label></li> 322 <li><input type="radio" name="value" id="create_example_post_0" value="0" <?php echo !get_option('create_example_post')?'checked="checked"':"" ?> /> <label for="create_example_post_0">No</label></li> 323 </ul> 324 <input type="submit" value="Submit" name="submit" class="Button" /> 325 <div class="HelpText">Should an example blog post be created when a new blog is created?</div> 326 </td> 327 </tr> 328 </tbody> 329 </table> 330 </form> 331 332 <form method="post" action="setoption.php" class="lyceum_form"> 333 <?php echo tokeninput('setoption.php', 'example_post_body')?> 334 <input type="hidden" name="option" value="example_post_body" /> 335 336 <table class="FormTable"> 337 <col width="20%" /> 338 <col width="80%" /> 339 340 <tbody> 341 <tr> 342 <th scope="row"><label for="username_blacklist">Example post body</label></th> 343 <td> 344 <textarea name="value" cols="60" rows="5" id="example_post_body" class="TextArea"><?php echo get_option('example_post_body') ?></textarea> 345 <input type="submit" value="Submit" name="submit" class="Button" /> 346 <div class="HelpText">The body of the example post.</div> 347 </td> 348 </tr> 349 </tbody> 350 </table> 351 </form> 352 353 <form method="post" action="setoption.php" class="lyceum_form"> 354 <?php echo tokeninput('setoption.php', 'create_example_page')?> 355 <input type="hidden" name="option" value="create_example_page" /> 356 357 <table class="FormTable"> 358 <col width="20%" /> 359 <col width="80%" /> 360 361 <tbody> 362 <tr> 363 <th scope="row"><span class="Label">Create example page</span></th> 364 <td> 365 <ul class="HorizList Inputs"> 366 <li><input type="radio" name="value" id="create_example_page_1" value="1" <?php echo get_option('create_example_page')?'checked="checked"':"" ?> /> <label for="create_example_page_1">Yes</label></li> 367 <li><input type="radio" name="value" id="create_example_page_0" value="0" <?php echo !get_option('create_example_page')?'checked="checked"':"" ?> /> <label for="create_example_page_0">No</label></li> 368 </ul> 369 <input type="submit" value="Submit" name="submit" class="Button" /> 370 <div class="HelpText">Should an example page be created when a new blog is created?</div> 371 </td> 372 </tr> 373 </tbody> 374 </table> 375 </form> 376 377 <form method="post" action="setoption.php" class="lyceum_form"> 378 <?php echo tokeninput('setoption.php', 'example_page_body')?> 379 <input type="hidden" name="option" value="example_page_body" /> 380 381 <table class="FormTable"> 382 <col width="20%" /> 383 <col width="80%" /> 384 385 <tbody> 386 <tr> 387 <th scope="row"><label for="username_blacklist">Example page body</label></th> 388 <td> 389 <textarea name="value" cols="60" rows="5" id="example_page_body" class="TextArea"><?php echo get_option('example_page_body') ?></textarea> 390 <input type="submit" value="Submit" name="submit" class="Button" /> 391 <div class="HelpText">The body of the example page.</div> 392 </td> 393 </tr> 394 </tbody> 395 </table> 396 </form> 397 398 <form method="post" action="setoption.php" class="lyceum_form"> 309 399 <?php echo tokeninput('setoption.php', 'import_allowed')?> 310 400 <input type="hidden" name="option" value="import_allowed" /> branches/1.0/src/lyceum/wp-admin/install.php
r999 r1249 181 181 //populate_options(); 182 182 $optiondomain = 'system'; 183 $wpdb->query("INSERT INTO `$wpdb->options` (`option_name`,`option_value`, `option_domain`) VALUES ('site_title', '" . mysql_real_escape_string($site_title) . "', 'system') "); 183 184 populate_system_options(); 184 185 //populate_roles(); … … 221 222 $admin_email = mysql_real_escape_string($admin_email); 222 223 223 $wpdb->query("INSERT INTO `$wpdb->options` (`option_name`,`option_value`, `option_domain`) VALUES ('site_title', '" . mysql_real_escape_string($site_title) . "', 'system') ");224 224 $wpdb->query("UPDATE `$wpdb->options` SET option_value = '" . mysql_real_escape_string($admin_email) . "' WHERE option_name = 'system_admin_email';"); 225 225 branches/1.0/src/lyceum/wp-admin/upgrade-schema.php
r1160 r1249 337 337 add_option('users_can_create_num_blogs', '0'); 338 338 add_option('users_can_create_blogs', '1'); 339 add_option('create_example_post', '1'); 340 add_option('create_example_page', '1'); 341 add_option('example_post_body', 'Welcome to ' . get_settings('site_title') . '. This is your first post. Edit or delete it, then start blogging!'); 342 add_option('example_page_body', 'This is an example of a page. You may make as many pages as you like, and even structure them in a hierarchy. It\'s quite possible that you won\'t find a use for pages at all. However, one page you may wish to create is an "About" page, telling your readers a little bit about yourself and what you like to write about. Just edit this page, rename the title to "About", and replace this text. Of course, you may also delete this page entirely if you wish.'); 339 343 340 344 //// this is a little ugly branches/1.0/src/lyceum/wp-content/themes/default/index.php
r1004 r1249 25 25 </div> 26 26 27 <?php elseif ( 0 == blog_post_count()) : ?> 28 <?php lyceum_no_posts_message() ?> 27 29 <?php else : ?> 28 30
