Changeset 1195
- Timestamp:
- 10/09/07 00:43:57 (1 year ago)
- Files:
-
- branches/1.0/src/lyceum/portal.php (modified) (1 diff)
- branches/1.0/src/lyceum/system-admin/blog-management.php (modified) (1 diff)
- branches/1.0/src/lyceum/system-admin/lyceum.css (added)
- branches/1.0/src/lyceum/system-admin/lyceum-footer.php (added)
- branches/1.0/src/lyceum/system-admin/lyceum-header.php (added)
- branches/1.0/src/lyceum/system-admin/rewriterules.php (modified) (2 diffs)
- branches/1.0/src/lyceum/system-admin/settings.php (modified) (1 diff)
- branches/1.0/src/lyceum/system-admin/systemplugins.php (modified) (4 diffs)
- branches/1.0/src/lyceum/system-admin/user-management.php (modified) (1 diff)
- branches/1.0/src/lyceum/system-admin/viewregistrationlist.php (modified) (1 diff)
- branches/1.0/src/lyceum/wp-admin/admin-footer.php (modified) (1 diff)
- branches/1.0/src/lyceum/wp-admin/admin-header.php (modified) (2 diffs)
- branches/1.0/src/lyceum/wp-admin/wp-admin.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/src/lyceum/portal.php
r1180 r1195 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 <link rel="alternate" type="application/atom+xml" title="Atom 1.0" href="<?php echo LURL ?>/atom.php" /> 26 27 </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=UTF-8" /> 56 </head> 57 58 28 59 <body> 29 60 30 31 32 <?php if ($user_identity) { ?> 33 <div id="status"> 34 <div class="description"><?php echo "logged in as <em>$user_identity</em>"?> [<a href="login?action=logout">Log Out</a>]</div> 35 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 36 312 </div> 37 <?php } else { ?> 38 <div id="status" class="closed"> </div> 39 <?php } ?> 40 41 <div id="page"> 42 43 <div id="header"> 44 <h1><?php echo $site_title ?></h1> 45 </div> 46 47 <div id="sidebar"> 48 49 <img src="<?php echo WEBROOT ?>/wp-content/portal/images/lyceum-logo.png" alt="Lyceum logo"/> 50 51 <?php if ( isset($_SESSION['slug_error']) ) : ?> 52 <div style="background: #FFEFF7; 53 border: 1px solid #c69; 54 margin: 1em 5% 10px; 55 padding: 0 1em 0 1em; 56 text-align: center; 57 font-size: 15px;"> 58 <?php 59 echo $_SESSION['slug_error']; 60 ?> 61 </div> 62 <?php unset($_SESSION['slug_error']); endif; ?> 63 <div id="sidemenu" class="widecolumn"> 64 <?php if ($userdata->user_admin): ?> 65 <h3 > 66 <a href="system-admin/settings.php">System Settings</a> 67 </h3> 68 <?php endif; ?> 69 70 <?php 71 if (!$user_identity) { 72 echo ' 73 <h3><a href="register">Register</a></h3> 74 <h2><a href="login">Log In</a></h2> 75 '; 76 } else { 77 echo '<h2><a href="login?action=logout">Log Out</a></h2>'; 78 } 79 echo "</div>"; 80 81 $myblogs = get_userblogs(); 82 83 if ($myblogs) { 84 ?> 85 <h2>My Blogs</h2> 86 <table cellspacing="5"> 87 <?php foreach ($myblogs as $b) { ?> 88 <tr> 89 <th align="left"><a href="<?php echo $b->home ?>"><?php echo $b->blogname ?></a></th> 90 <td><a href="<?php echo $b->home ?>/admin/"><?php echo __('Dashboard') ?></a></td> 91 </tr> 92 <?php } ?> 93 </table> 94 <?php 95 } 96 97 $wpdb->query(" 98 CREATE TEMPORARY TABLE bloginfo 99 SELECT $wpdb->blogs.id, $wpdb->blogs.slug, option_value as blogname, status 100 FROM $wpdb->blogs 101 INNER JOIN $wpdb->options ON ($wpdb->blogs.id = $wpdb->options.blog) 102 INNER JOIN $wpdb->posts 103 INNER JOIN $wpdb->post2cat ON (post_id = $wpdb->posts.ID) 104 INNER JOIN $wpdb->categories ON (category_id = cat_ID AND $wpdb->categories.blog = $wpdb->options.blog) 105 WHERE 106 status = 'active' AND 107 option_name = 'blogname' AND 108 post_title != 'Hello world!' AND 109 post_title != 'About' 110 ORDER BY post_date_gmt DESC 111 "); 112 113 ?> 114 115 </div> 116 117 <?php 118 $posts = get_recent_posts(10); 119 echo "<h2>Recent Posts on $site_title </h2><ul>"; 120 121 foreach ($posts as $p){ 122 ?><li style="list-style: none"><?php 123 echo "<a href=\"$p->siteurl\">$p->blogname</a>:"; 124 ?> 125 126 <blockquote> 127 <?php 128 echo strip_tags($p->post_content) . '...'." <a href=\"$p->guid\">read more</a>"; 129 ?> 130 </blockquote> 131 <br/> 132 </li> 133 <?php 134 } 135 ?></ul> 136 137 138 <div id="blog-list"> 139 <?php 140 141 $blogs = $wpdb->get_results("SELECT DISTINCT(id), slug, blogname, status FROM bloginfo"); 142 echo "<h2>All Blogs</h2>"; 143 echo "<ul>"; 144 if ($blogs) 145 if(SUBDOMAINS) 146 foreach ($blogs as $b) 147 echo "<li><a href=\"http://$b->slug.".MAINDOMAIN."\">$b->blogname</a></li>"; 148 else 149 foreach ($blogs as $b) 150 echo "<li><a href=\"./$b->slug\">$b->blogname</a></li>"; 151 152 else 153 echo "<li><strong>The system does not yet have any blogs</strong></li>"; 154 ?> 155 </ul> 156 <br clear="all"/> 157 </div> 158 159 <div id="footer"> 160 <p>Powered by <a href="http://lyceum.ibiblio.org/">Lyceum</a></p> 161 </div> 162 </div> 313 163 314 164 315 </body> 316 165 317 </html> branches/1.0/src/lyceum/system-admin/blog-management.php
r1027 r1195 1 1 <?php 2 2 require('system-config.php'); 3 ?> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 5 <html xmlns="http://www.w3.org/1999/xhtml"> 6 <head> 7 <title>Lyceum System Settings</title> 8 <link rel="stylesheet" href="../wp-admin/wp-admin.css" type="text/css" /> 9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 10 </head> 11 <body> 12 <?php 3 4 function fetch_blogs($type) { 5 global $wpdb; 6 7 assert('deleted'==$type || 'active'==$type); 8 9 $blog_ids = $wpdb->get_col("SELECT `id` FROM `$wpdb->blogs` WHERE `status` = '$type'"); 10 11 $blogs = array(); 12 13 if ($blog_ids) { 14 $blog_ids = implode(',',$blog_ids); 15 16 $blogs = $wpdb->get_results(" 17 SELECT `blog`, `option_value` AS `name` 18 FROM $wpdb->options 19 WHERE `option_name` = 'blogname' 20 AND `blog` IN 21 ($blog_ids) 22 ORDER BY `name`"); 23 } 24 25 return $blogs; 26 } 27 28 function fetch_users(){ 29 global $wpdb; 30 31 $users = $wpdb->get_results(" 32 SELECT user_login 33 FROM ".$wpdb->users." 34 WHERE user_admin = '0' 35 ORDER BY user_login ASC;"); 36 37 $user_names = array(); 38 39 if ($users) { 40 foreach ($users as $user) { 41 $user_names[] = $user->user_login; 42 } 43 } 44 45 return $user_names; 46 } 47 48 // =========================================================================== 49 50 $site_title = get_settings('site_title'); 51 52 $users = fetch_users(); 53 $active_blogs = fetch_blogs('active'); 54 $deactivated_blogs = fetch_blogs('deleted'); 55 13 56 if ( isset($_POST['action']) ) { 14 57 check_admin_referer(); 58 15 59 if(!('deleted'==$_POST['action'] || 'active' == $_POST['action'] || 'destroy' == $_POST['action'])) 16 60 die; 61 17 62 validateToken($_POST['token'], 'blog-management.php', $_POST['action']); 63 18 64 $whichblog = $_POST['whichblog']; 19 65 $status = $_POST['action']; 20 if('destroy' == $_POST['action']) 66 67 if('destroy' == $_POST['action']) { 21 68 delete_blog(mysql_real_escape_string($whichblog)); 22 else 69 70 } else { 23 71 $wpdb->query("UPDATE `$wpdb->blogs` SET `status`='".mysql_real_escape_string($status)."' WHERE `id`='".mysql_real_escape_string($whichblog)."'"); 72 73 } 24 74 } 25 75 26 function generate_blog_select($type, $action, $name, $message){ 27 global $wpdb; 28 assert('deleted'==$type || 'active'==$type); ?> 29 <form method="post" action="blog-management.php"> 30 <?php echo tokeninput('blog-management.php', $action)?> 31 <input type="hidden" name="action" value="<?php echo $action?>" /> 32 <fieldset> 33 <legend align="left" accesskey=""><strong><?php echo $name?></strong></legend> 34 <p><?php echo $message?></p> 35 <select name="whichblog"> 36 <?php 37 $bloglist = $wpdb->get_col("SELECT `id` FROM `$wpdb->blogs` WHERE `status` = '$type'"); 38 if ($bloglist){ 39 $bloglist = implode(',',$bloglist); 40 $blogs = $wpdb->get_results(" 41 SELECT `blog`, `option_value` AS `name` 42 FROM $wpdb->options 43 WHERE `option_name` = 'blogname' 44 AND `blog` IN 45 ($bloglist) 46 ORDER BY `name`"); 47 foreach( $blogs as $currentblog ) 48 echo "<option value=\"$currentblog->blog\">$currentblog->name</option>"; 49 }else 50 echo "<option >there are no $type blogs</option>"; 51 ?> 52 </select> 53 <p><input type="submit" value="Submit" name="submit" /></p> 54 </fieldset> 55 </form> 56 <?php 57 } 58 59 function generate_user_select(){ 60 global $wpdb; 61 $users = $wpdb->get_results(" 62 SELECT user_login 63 FROM ".$wpdb->users." 64 WHERE user_admin = '0';"); 65 if($users){ 66 $out = '<select name="admin">'; 67 foreach($users as $user){ 68 $out .= sprintf('<option value="%s">%s</option>',$user->user_login,$user->user_login); 69 } 70 $out .= '</select>'; 71 } else $out = '(no users in db)'; 72 return $out; 73 } 74 75 ?> 76 77 78 <p><a href="settings.php">return to Lyceum System Settings</a></p> 79 <hr/> 80 <form method="post" action="createblog.php"> 81 <?php echo tokeninput('createblog.php')?> 82 <fieldset> 83 <legend><strong>Create a Blog</strong></legend> 84 <div id="createblog" style="width:600px; border:1px; padding:5px;"> 85 <div id="adminlabel" style="float:left; width:300px; overflow:auto;"> 86 <label for="admin">Username of administrator of new blog</label> 76 // =========================================================================== 77 ?> 78 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 79 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 80 81 <html xmlns="http://www.w3.org/1999/xhtml"> 82 83 <head> 84 <title><?php echo $site_title ?>: Lyceum System Settings: Manage Blogs</title> 85 86 <link rel="stylesheet" href="<?php echo LURL ?>/wp-admin/wp-admin.css" type="text/css" /> 87 <link rel="stylesheet" href="<?php echo LURL ?>/system-admin/lyceum.css" type="text/css" /> 88 89 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 90 </head> 91 92 93 <body> 94 95 <div id="PageWrapper" class="AdminBlogs"> 96 97 <?php require(ABSPATH . '/system-admin/lyceum-header.php'); ?> 98 99 <hr /> 100 101 <!-- BEGIN: body --> 102 <div id="BodyWrapper"> 103 104 <!-- BEGIN: main column --> 105 <div id="MainColumn"> 106 107 <!-- BEGIN: main nav --> 108 <ul id="MainNav"> 109 <li><span><a href="settings.php">System Settings</a></span></li> 110 <li class="Selected"><span><a href="blog-management.php">Manage Blogs</a></span></li> 111 <li><span><a href="user-management.php">Manage Users</a></span></li> 112 <li><span><a href="systemplugins.php">Manage Plugins</a></span></li> 113 <li><span><a href="rewriterules.php">Rewrite Rules</a></span></li> 114 </ul> 115 <div class="ClearFix TabBorder"><!-- do not remove --></div> 116 <!-- END: main nav --> 117 118 119 <div class="wrap"> 120 121 <!-- BEGIN: create a blog --> 122 <form class="lyceum_form" name="create_blog_form" id="create_blog_form" method="post" action="createblog.php"> 123 <h2>Create a Blog</h2> 124 <p>Create a new blog and assign an administrator.</p> 125 126 <?php 127 if (count($users) > 0) { 128 ?> 129 <fieldset> 130 <legend>Blog Creation</legend> 131 132 <table class="FormTable" summary=""> 133 <col width="40%" /> 134 <col width="60%" /> 135 136 <tbody> 137 <tr> 138 <th scope="row"><label for="blogname">Blog name:</label></th> 139 <td><input type="text" name="blogname" maxlength="100" class="TextInput" /></td> 140 </tr> 141 142 <tr> 143 <th scope="row"><label for="admin">Blog administrator:</label></th> 144 <td> 145 <select name="admin" id="admin"> 146 <?php 147 foreach ($users as $user) { 148 ?> 149 <option value="<?php echo $user ?>"><?php echo $user ?></option> 150 <?php 151 } 152 ?> 153 </select> 154 </td> 155 </tr> 156 157 </tbody> 158 </table> 159 160 <?php echo tokeninput('createblog.php') ?> 161 162 <div class="FormAction"> 163 <input type="submit" value="Create Blog" name="submit" /> 164 </div> 165 166 </fieldset> 167 <?php 168 } else { 169 ?> 170 <div class="Message"> 171 <strong>No users in database.</strong> 172 <p>You must create users before you can create a blog.</p> 173 </div> 174 <?php 175 } 176 ?> 177 </form> 178 <!-- END: create a blog --> 179 180 </div> 181 182 <div class="wrap"> 183 184 <!-- BEGIN: deactivate a blog --> 185 <form class="lyceum_form" name="deactivate_blog_form" id="deactivate_blog_form" method="post" action="blog-management.php"> 186 <h2>Deactivate a Blog</h2> 187 <p>Deactivate a blog from any use. This will appear as a "deletion" to the user, however all state and data is retained in the database.</p> 188 189 <?php 190 if (count($active_blogs) > 0) { 191 ?> 192 <fieldset> 193 <legend>Blog Deactivation</legend> 194 195 <label for="whichblog_deactivate">Blog to deactivate:</label> 196 <select name="whichblog" id="whichblog_deactivate"> 197 <option value="">Select a blog</option> 198 <option value=""></option> 199 <?php 200 foreach ($active_blogs as $blog) { 201 ?> 202 <option value="<?php echo $blog->blog ?>"><?php echo $blog->name ?></option> 203 <?php 204 } 205 ?> 206 </select> 207 208 <?php echo tokeninput('blog-management.php', 'deleted') ?> 209 <input type="hidden" name="action" value="deleted" /> 210 211 <div class="FormAction"> 212 <input type="submit" value="Deactivate Blog" name="submit" /> 213 </div> 214 <?php 215 } else { 216 ?> 217 <p><em>There are no active blogs at the moment.</em></p> 218 <?php 219 } 220 ?> 221 </fieldset> 222 </form> 223 <!-- END: deactivate a blog --> 224 225 </div> 226 227 <div class="wrap"> 228 229 <!-- BEGIN: activate a blog --> 230 <form class="lyceum_form" name="activate_blog_form" id="activate_blog_form" method="post" action="blog-management.php"> 231 <h2>Activate a Blog</h2> 232 <p>Activate a deactivated blog for use.</p> 233 234 <?php 235 if (count($deactivated_blogs) > 0) { 236 ?> 237 <fieldset> 238 <legend>Blog Activation</legend> 239 240 <label for="whichblog_activate">Blog to activate:</label> 241 <select name="whichblog" id="whichblog_activate"> 242 <option value="">Select a blog</option> 243 <option value=""></option> 244 <?php 245 foreach ($deactivated_blogs as $blog) { 246 ?> 247 <option value="<?php echo $blog->blog ?>"><?php echo $blog->name ?></option> 248 <?php 249 } 250 ?> 251 </select> 252 253 <?php echo tokeninput('blog-management.php', 'active') ?> 254 <input type="hidden" name="action" value="active" /> 255 256 <div class="FormAction"> 257 <input type="submit" value="Activate Blog" name="submit" /> 258 </div> 259 260 </fieldset> 261 <?php 262 } else { 263 ?> 264 <p><em>There are no deactivated blogs at the moment.</em></p> 265 <?php 266 } 267 ?> 268 </form> 269 <!-- END: activate a blog --> 270 271 </div> 272 273 <div class="wrap"> 274 275 <!-- BEGIN: delete a blog --> 276 <form class="lyceum_form" name="delete_blog_form" id="delete_blog_form" method="post" action="blog-management.php"> 277 <h2>Delete a Blog</h2> 278 <p>Completely delete a blog from the system. A blog must first be deactivated above for it to appear in this list.</p> 279 280 <?php 281 if (count($deactivated_blogs) > 0) { 282 ?> 283 <fieldset> 284 <legend>Blog Deletion</legend> 285 286 <label for="whichblog_delete">Blog to delete:</label> 287 <select name="whichblog" id="whichblog_delete"> 288 <option value="">Select a blog</option> 289 <option value=""></option> 290 <?php 291 foreach ($deactivated_blogs as $blog) { 292 ?> 293 <option value="<?php echo $blog->blog ?>"><?php echo $blog->name ?></option> 294 <?php 295 } 296 ?> 297 </select> 298 299 <?php echo tokeninput('blog-management.php', 'destroy') ?> 300 <input type="hidden" name="action" value="destroy" /> 301 302 <div class="FormAction"> 303 <input type="submit" value="Delete Blog" name="submit" /> 304 </div> 305 306 </fieldset> 307 <?php 308 } else { 309 ?> 310 <p><em>There are no deactivated blogs at the moment.</em></p> 311 <?php 312 } 313 ?> 314 </form> 315 <!-- END: activate a blog --> 316 317 </div> 318 87 319 </div> 88 <div id="adminfield"><?php echo generate_user_select();?></div> 89 <div id="bloglabel" style="float:left; width:300px;"> 90 <label for="blogname">Name of new blog:</label> 91 </div> 92 <div id="blogfield" style=""> 93 <input type="text" name="blogname" size="20" maxlength="100" /> 94 </div> 95 <div id="submit" style="position:relative; left:300px;"> 96 <input type="submit" value="Submit" name="submit" /> 97 </div> 98 </div> 99 </fieldset> 100 </form> 101 102 <?php 103 generate_blog_select( 104 'active', 105 'deleted', 106 'Blog Deactivation', 107 'Deactivate a blog from any use. This will appear as a "deletion" to the user, however all state and data is maintained in the database' 108 ); 109 110 generate_blog_select( 111 'deleted', 112 'active', 113 'Blog Activation', 114 'Activate a deactivated blog for use.' 115 ); 116 117 generate_blog_select( 118 'deleted', 119 'destroy', 120 'Blog Deletion', 121 'Completely delete a blog from the system. A blog must first be deactivated, above, for it to appear in this list.' 122 ); 123 ?> 320 <!-- END: main column --> 321 322 </div> 323 <!-- END: body --> 324 325 <hr /> 326 327 <?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?> 328 329 </div> 330 124 331 125 332 </body> 333 126 334 </html> branches/1.0/src/lyceum/system-admin/rewriterules.php
r677 r1195 5 5 validateToken($_POST['token'], 'rewriterules.php', $_POST['action']); 6 6 7 switch ($action = $_POST['action']) 8 { 9 case 'delete': 10 $home_path = get_home_path(); 11 unlink($home_path.'.htaccess'); 12 header('Location: rewriterules.php'); 13 break; 14 case 'write': 15 $home_path = get_home_path(); 16 $rules = explode("\n", $wp_rewrite->mod_rewrite_rules()); 17 insert_with_markers($home_path.'.htaccess', 'Lyceum', $rules); 18 header('Location: rewriterules.php'); 19 break; 20 default: 7 switch ($action = $_POST['action']) { 8 case 'delete': 9 $home_path = get_home_path(); 10 unlink($home_path.'.htaccess'); 11 header('Location: rewriterules.php'); 12 exit(); 13 break; 14 15 case 'write': 16 $home_path = get_home_path(); 17 $rules = explode("\n", $wp_rewrite->mod_rewrite_rules()); 18 insert_with_markers($home_path.'.htaccess', 'Lyceum', $rules); 19 header('Location: rewriterules.php'); 20 exit(); 21 break; 22 23 } 24 25 // =========================================================================== 21 26 ?> 22 <p><a href="settings.php">return to Lyceum System Settings</a></p> 23 <hr/> 27 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 28 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 29 30 <html xmlns="http://www.w3.org/1999/xhtml"> 31 32 <head> 33 <title><?php echo $site_title ?>: Lyceum System Settings: Rewrite Rules</title> 34 35 <link rel="stylesheet" href="<?php echo LURL ?>/wp-admin/wp-admin.css" type="text/css" /> 36 <link rel="stylesheet" href="<?php echo LURL ?>/system-admin/lyceum.css" type="text/css" /> 37 38 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_settings('blog_charset'); ?>" /> 39 </head> 40 41 42 <body> 43 44 <div id="PageWrapper" class="AdminRewrite"> 45 46 <?php require(ABSPATH . '/system-admin/lyceum-header.php'); ?> 47 48 <hr /> 49 50 <!-- BEGIN: body --> 51 <div id="BodyWrapper"> 52 53 <!-- BEGIN: main column --> 54 <div id="MainColumn"> 55 56 <!-- BEGIN: main nav --> 57 <ul id="MainNav"> 58 <li><span><a href="settings.php">System Settings</a></span></li> 59 <li><span><a href="blog-management.php">Manage Blogs</a></span></li> 60 <li><span><a href="user-management.php">Manage Users</a></span></li> 61 <li><span><a href="systemplugins.php">Manage Plugins</a></span></li> 62 <li class="Selected"><span><a href="rewriterules.php">Rewrite Rules</a></span></li> 63 </ul> 64 <div class="ClearFix TabBorder"><!-- do not remove --></div> 65 <!-- END: main nav --> 66 67 <div class="wrap"> 68 <h2>mod_rewrite Config</h2> 69 70 <h3>Via .htaccess file</h3> 71 72 <div id="htaccess-status"> 24 73 <?php if (file_exists(get_home_path() . '.htaccess')): ?> 25 <p><strong>.htaccess file present</strong></p> 26 <form action="rewriterules.php" method="post"> 27 <?php echo tokeninput('rewriterules.php', 'delete')?> 28 <input type="hidden" name="action" value="delete" /> 29 <p><input type="submit" value="Delete .htaccess file" /></p> 30 </form> 74 <p><strong>.htaccess file present</strong></p> 75 76 <form action="rewriterules.php" method="post"> 77 <?php echo tokeninput('rewriterules.php', 'delete')?> 78 79 <input type="hidden" name="action" value="delete" /> 80 81 <input type="submit" value="Delete .htaccess file" /> 82 </form> 31 83 <?php else: ?> 32 <p><strong>.htaccess file NOT present</strong></p>84 <p><strong>.htaccess file NOT present</strong></p> 33 85 <?php endif; ?> 34 <form action="rewriterules.php" method="post">35 <?php echo tokeninput('rewriterules.php', 'write')?>36 <input type="hidden" name="action" value="write" />37 86 38 <p><input type="submit" value="Write .htaccess file" /></p> 39 </form> 87 40 88 41 <p>If you would like to put the mod_rewrite rules directly into your Apache configuration, here is the block of code to use (you probably want to delete your .htaccess file):</p> 42 <p><em>Note: if any part of the path to src/lyceum is a symbolic link, then Apache might not be happy with the path in <Directory ... >. Use the path to the symbolic link instead.</em></p> 43 <pre> 89 <form action="rewriterules.php" method="post"> 90 <?php echo tokeninput('rewriterules.php', 'write')?> 91 92 <input type="hidden" name="action" value="write" /> 93 94 <input type="submit" value="Write .htaccess file" /> 95 </form> 96 </div> 97 98 99 <h3>Manual Configuration</h3> 100 101 <p>If you would like to put the mod_rewrite rules directly into your Apache configuration, here is the block of code to use (you probably want to delete your .htaccess file):</p> 102 <p><em>Note: if any part of the path to src/lyceum is a symbolic link, then Apache might not be happy with the path in <Directory ... >. Use the path to the symbolic link instead.</em></p> 103 104 <pre> 44 105 <?php 45 106 //$rules = explode("\n", $wp_rewrite->mod_rewrite_rules()); … … 47 108 $rules = '<Directory "' . ABSPATH . '" >' . "\n" . $rules . "\n" . '</Directory>'; 48 109 echo $rules; 49 break;50 }//end switch51 110 ?> 52 </pre> 111 </pre> 112 113 </div> 114 115 </div> 116 <!-- END: main column --> 117 118 </div> 119 <!-- END: body --> 120 121 <hr /> 122 123 <?php include(ABSPATH . 'wp-admin/admin-footer.php'); ?> 124 125 </div> 126 127 128 </body> 129 130 </html> branches/1.0/src/lyceum/system-admin/settings.php
r1160 r1195 2 2 require('system-config.php'); 3 3 require('../../lib/taglib.php'); 4 $site_title = get_settings('site_title'); 5 6 $myblogs = get_userblogs(); 7 arrayify($myblogs); 8 9 // =
