Sidebar Login - Version 2.2.8

Version Description

  • Min level setting for links. Add user level after |true when defining the logged in links.
  • Moved 'settings' from tools to settings.
  • Encoded ampersand for valid markup
  • Moved Labels about
  • Fixed SSL url
  • Reusable widget
Download this release

Release Info

Developer jolley_small
Plugin Icon 128x128 Sidebar Login
Version 2.2.8
Comparing to
See all releases

Code changes from version 2.2.7 to 2.2.8

Files changed (4) hide show
  1. langs/sblogin-tr_TR.mo +0 -0
  2. langs/sblogin-tr_TR.po +125 -0
  3. readme.txt +79 -69
  4. sidebar-login.php +475 -467
langs/sblogin-tr_TR.mo ADDED
Binary file
langs/sblogin-tr_TR.po ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: sidebar-login\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-06-03 11:43+0100\n"
6
+ "PO-Revision-Date: 2009-08-24 18:41+0200\n"
7
+ "Last-Translator: tribak <tribak.zero@gmail.com>\n"
8
+ "Language-Team: Türlçe <muzo178@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=utf-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-Language: Turkish\n"
13
+ "X-Poedit-Country: TURKEY\n"
14
+
15
+ #: sidebar-login.php:14
16
+ #: sidebar-login.php:57
17
+ msgid "Sidebar Login"
18
+ msgstr "Sidebar Login"
19
+
20
+ #: sidebar-login.php:46
21
+ msgid "<p>Changes saved</p>"
22
+ msgstr "<p>Değişiklikler kaydedildi</p>"
23
+
24
+ #: sidebar-login.php:62
25
+ msgid "Login redirect URL"
26
+ msgstr "Giriş sonrası yönlendirme URL"
27
+
28
+ #: sidebar-login.php:63
29
+ msgid "Url to redirect the user to after login. Leave blank to use their current page."
30
+ msgstr "Kullanıcı giriş yaptıktan sonra yönlendirileceği adres. Bulundukları sayfada kalmalarını istiyorsanız boş bırakınız."
31
+
32
+ #: sidebar-login.php:66
33
+ msgid "Logout redirect URL"
34
+ msgstr "Çıkış sonrası yönlendirme URL"
35
+
36
+ #: sidebar-login.php:67
37
+ msgid "Url to redirect the user to after logout. Leave blank to use their current page."
38
+ msgstr "Kullanıcı çıkış yaptıktan sonra yönlendirileceği adres. Bulundukları sayfada kalmalarını istiyorsanız boş bırakınız."
39
+
40
+ #: sidebar-login.php:70
41
+ msgid "Show Register Link"
42
+ msgstr "Kayıt olma linkini göster"
43
+
44
+ #: sidebar-login.php:72
45
+ #: sidebar-login.php:79
46
+ msgid "Yes"
47
+ msgstr "Evet"
48
+
49
+ #: sidebar-login.php:73
50
+ #: sidebar-login.php:80
51
+ msgid "No"
52
+ msgstr "Hayır"
53
+
54
+ #: sidebar-login.php:74
55
+ msgid "User registrations must also be turned on for this to work ('Anyone can register' checkbox in settings)."
56
+ msgstr "Bu opsiyonun çalışması için kayıt açık olmalı (Ayarlar > 'İsteyen herkes kayıt olabilsin')"
57
+
58
+ #: sidebar-login.php:77
59
+ msgid "Show Lost Password Link"
60
+ msgstr "Kayıp parola linkini göster"
61
+
62
+ #: sidebar-login.php:84
63
+ msgid "Logged in links"
64
+ msgstr "Giriş yapılınca gösterilecek linkler"
65
+
66
+ #: sidebar-login.php:85
67
+ msgid "One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users. Default: <br/>&lt;a href=\""
68
+ msgstr "Her satıra bir link. Not: Çıkış linki her zaman gösterilir. İpucu: Linkten sonra <code>|true</code> eklerseniz linki sadece Adminler görebilir. Varsayılan: <br/>&lt;a href=\""
69
+
70
+ #: sidebar-login.php:89
71
+ msgid "Save Changes"
72
+ msgstr "Değişiklikleri kaydet"
73
+
74
+ #: sidebar-login.php:120
75
+ msgid "Login"
76
+ msgstr "Giriş yap"
77
+
78
+ #: sidebar-login.php:121
79
+ msgid "Welcome"
80
+ msgstr "Merhaba"
81
+
82
+ #: sidebar-login.php:122
83
+ msgid "Username:"
84
+ msgstr "Kullanıcı Adı:"
85
+
86
+ #: sidebar-login.php:123
87
+ msgid "Password:"
88
+ msgstr "Parola:"
89
+
90
+ #: sidebar-login.php:124
91
+ msgid "Remember me"
92
+ msgstr "Beni hatırla"
93
+
94
+ #: sidebar-login.php:125
95
+ msgid "Register"
96
+ msgstr "Kayıt ol"
97
+
98
+ #: sidebar-login.php:126
99
+ msgid "Password Lost and Found"
100
+ msgstr "Kayıp parola"
101
+
102
+ #: sidebar-login.php:127
103
+ msgid "Lost your password?"
104
+ msgstr "Parolanızı mı unuttunuz?"
105
+
106
+ #: sidebar-login.php:128
107
+ msgid "Logout"
108
+ msgstr "Çıkış"
109
+
110
+ #: sidebar-login.php:246
111
+ msgid "Dashboard"
112
+ msgstr "Başlangıç"
113
+
114
+ #: sidebar-login.php:246
115
+ msgid "Profile"
116
+ msgstr "Profil"
117
+
118
+ #: sidebar-login.php:292
119
+ msgid "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."
120
+ msgstr "<strong>HATA</strong>: Cookieler tarayıcınız tarafından bloke ediliyor. Wordpress kullanabilmek için<a href=\"http://www.google.com/support/accounts/bin/answer.py?hl=es&answer=61416\">cookieleri</a> etkinleştirmelisiniz."
121
+
122
+ #: sidebar-login.php:300
123
+ msgid "<strong>ERROR</strong>: Please enter a username & password."
124
+ msgstr "<strong>HATA</strong>: Lütfen kullanıcı adı ve şifre giriniz."
125
+
readme.txt CHANGED
@@ -1,69 +1,79 @@
1
- === Plugin Name ===
2
- Contributors: jolley_small
3
- Donate link: http://blue-anvil.com/archives/wordpress-sidebar-login-2-optimised-for-wordpress-26
4
- Tags: login, sidebar, widget, sidebar login, meta, form, register
5
- Requires at least: 2.5
6
- Tested up to: 2.8
7
- Stable tag: 2.2.7
8
-
9
- Adds a sidebar widget to let users login.
10
-
11
- == Description ==
12
-
13
- Sidebar-Login has both a widget and a template tag to allow you to have a login form in the sidebar of your wordpress powered blog.
14
-
15
- It lets users login, and then redirects them back to the page they logged in from rather than the backend, it also shows error messages.
16
-
17
- You can configure the plugin in <code>Admin > Tools > Sidebar Login</code> after installing it.
18
-
19
- = Localization Files =
20
-
21
- Czech Translation - http://wordpress.blog.mantlik.cz/plugins/sblogin-cs/
22
- Catalan Translation by Marc Vinyals
23
- French Translation by Andy
24
- Estonian Translation by Marko Punnar
25
- Dutch Translation by Ruben Janssen
26
- German Translation by GhostLyrics
27
- Italian Translation by Alessandro Spadavecchia
28
- Hungarian translation by Laszlo Dvornik
29
- Hungarian (2) translation by Balint Vereskuti
30
- Russian translation by Fat Cow (http://www.fatcow.com)
31
- Romanian translation by Victor Osorhan
32
- Spanish translation by Tribak (http://blog.tribak.org/sidebar-login-es_es/)
33
- Spanish (2) translation by Ricardo Vilella (http://www.ifconfig.com.ar/general/traduccion-al-espanol-del-plugin-sidebar-login-para-wordpress/)
34
- Danish translation by Per Bovbjerg
35
- Portuguese translation by Alvaro Becker
36
- Polish translation by merito
37
- Polish (2) translation by Darek Wapinski
38
- Icelandic translation by Hákon Ásgeirsson
39
- Arabic translation by khalid
40
- Persian(farsi) translation Amir Beitollahi
41
-
42
- Note: Those with more than one translation are found in langs/alternate/. To use the alternatives move them from /alternate/ into /langs/.
43
-
44
- == Installation ==
45
-
46
- = First time installation instructions =
47
-
48
- 1. Unzip and upload the php file to your wordpress plugin directory
49
- 2. Activate the plugin
50
- 3. For a sidebar widget: Goto the design > widgets tab - Drag the widget into a sidebar and save!
51
- 4. To use the template tag: Add &lt;?php sidebarlogin(); ?&gt; to your template.
52
-
53
- = Configuration =
54
-
55
- You will find a config page in tools/settings > Sidebar Login. Here you can set links and redirects up.
56
-
57
- == Screenshots ==
58
-
59
- 1. Login Form
60
- 2. After Login
61
-
62
- == Changelog ==
63
-
64
- = 2.2.6 =
65
- * Added changelog to readme.
66
- * OpenID Plugin (http://wordpress.org/extend/plugins/openid/) Integration.
67
- * %username% can be used in your custom links shown when logged in (gets replaced with username)
68
- * WP-FacebookConnect (http://wordpress.org/extend/plugins/wp-facebookconnect/) integration (untested!)
69
- * Minor fixes (worked through a big list of em!)
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: jolley_small
3
+ Donate link: http://blue-anvil.com/archives/wordpress-sidebar-login-2-optimised-for-wordpress-26
4
+ Tags: login, sidebar, widget, sidebar login, meta, form, register
5
+ Requires at least: 2.5
6
+ Tested up to: 2.9
7
+ Stable tag: 2.2.8
8
+
9
+ Adds a sidebar widget to let users login. Displayed links can be changed from the <a href="options-general.php?page=Sidebar%20Login">settings page</a>.
10
+
11
+ == Description ==
12
+
13
+ Sidebar-Login has both a widget and a template tag to allow you to have a login form in the sidebar of your wordpress powered blog.
14
+
15
+ It lets users login, and then redirects them back to the page they logged in from rather than the backend, it also shows error messages.
16
+
17
+ You can configure the plugin in <code>Admin > Tools > Sidebar Login</code> after installing it.
18
+
19
+ = Localization Files =
20
+
21
+ Czech Translation - http://wordpress.blog.mantlik.cz/plugins/sblogin-cs/
22
+ Catalan Translation by Marc Vinyals
23
+ French Translation by Andy
24
+ Estonian Translation by Marko Punnar
25
+ Dutch Translation by Ruben Janssen
26
+ German Translation by GhostLyrics
27
+ Italian Translation by Alessandro Spadavecchia
28
+ Hungarian translation by Laszlo Dvornik
29
+ Hungarian (2) translation by Balint Vereskuti
30
+ Russian translation by Fat Cow (http://www.fatcow.com)
31
+ Romanian translation by Victor Osorhan
32
+ Spanish translation by Tribak (http://blog.tribak.org/sidebar-login-es_es/)
33
+ Spanish (2) translation by Ricardo Vilella (http://www.ifconfig.com.ar/general/traduccion-al-espanol-del-plugin-sidebar-login-para-wordpress/)
34
+ Danish translation by Per Bovbjerg
35
+ Portuguese translation by Alvaro Becker
36
+ Polish translation by merito
37
+ Polish (2) translation by Darek Wapinski
38
+ Icelandic translation by Hákon Ásgeirsson
39
+ Arabic translation by khalid
40
+ Persian(farsi) translation Amir Beitollahi
41
+ Turkish translation by Muzo B
42
+ Chinese translation by seven - http://www.anchuang.org
43
+
44
+ Note: Those with more than one translation are found in langs/alternate/. To use the alternatives move them from /alternate/ into /langs/.
45
+
46
+ == Installation ==
47
+
48
+ = First time installation instructions =
49
+
50
+ 1. Unzip and upload the php file to your wordpress plugin directory
51
+ 2. Activate the plugin
52
+ 3. For a sidebar widget: Goto the design > widgets tab - Drag the widget into a sidebar and save!
53
+ 4. To use the template tag: Add &lt;?php sidebarlogin(); ?&gt; to your template.
54
+
55
+ = Configuration =
56
+
57
+ You will find a config page in tools/settings > Sidebar Login. Here you can set links and redirects up.
58
+
59
+ == Screenshots ==
60
+
61
+ 1. Login Form
62
+ 2. After Login
63
+
64
+ == Changelog ==
65
+
66
+ = 2.2.8 =
67
+ * Min level setting for links. Add user level after |true when defining the logged in links.
68
+ * Moved 'settings' from tools to settings.
69
+ * Encoded ampersand for valid markup
70
+ * Moved Labels about
71
+ * Fixed SSL url
72
+ * Reusable widget
73
+
74
+ = 2.2.6 =
75
+ * Added changelog to readme.
76
+ * OpenID Plugin (http://wordpress.org/extend/plugins/openid/) Integration.
77
+ * %username% can be used in your custom links shown when logged in (gets replaced with username)
78
+ * WP-FacebookConnect (http://wordpress.org/extend/plugins/wp-facebookconnect/) integration (untested!)
79
+ * Minor fixes (worked through a big list of em!)
sidebar-login.php CHANGED
@@ -1,468 +1,476 @@
1
- <?php
2
- /*
3
- Plugin Name: Sidebar Login
4
- Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/
5
- Description: Adds a sidebar widget to let users login
6
- Version: 2.2.7
7
- Author: Mike Jolley
8
- Author URI: http://blue-anvil.com
9
- */
10
-
11
- // Pre 2.6 compatibility (BY Stephen Rider)
12
- if ( ! defined( 'WP_CONTENT_URL' ) ) {
13
- if ( defined( 'WP_SITEURL' ) ) define( 'WP_CONTENT_URL', WP_SITEURL . '/wp-content' );
14
- else define( 'WP_CONTENT_URL', get_option( 'url' ) . '/wp-content' );
15
- }
16
- if ( ! defined( 'WP_CONTENT_DIR' ) ) define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
17
- if ( ! defined( 'WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
18
- if ( ! defined( 'WP_PLUGIN_DIR' ) ) define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
19
-
20
- load_plugin_textdomain('sblogin', WP_PLUGIN_URL.'/sidebar-login/langs/', 'sidebar-login/langs/');
21
-
22
- function wp_sidebarlogin_menu() {
23
- add_management_page(__('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 9,'Sidebar Login', 'wp_sidebarlogin_admin');
24
- }
25
-
26
- if (!function_exists('wp_sidebarlogin_magic')) {
27
- function wp_sidebarlogin_magic() {
28
- function stripit($in) {
29
- if (!is_array($in)) $out = stripslashes($in); else $out = $in;
30
- return $out;
31
- }
32
- $_GET = array_map('stripit', $_GET);
33
- $_POST = array_map('stripit', $_POST);
34
- $_REQUEST = array_map('stripit', $_REQUEST);
35
- return;
36
- }
37
- }
38
-
39
- if (!function_exists('is_ssl')) :
40
- function is_ssl() {
41
- return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
42
- }
43
- endif;
44
-
45
- function wp_sidebarlogin_admin(){
46
- // Update options
47
- if ($_POST) {
48
- wp_sidebarlogin_magic();
49
- update_option('sidebarlogin_login_redirect', $_POST['sidebarlogin_login_redirect']);
50
- update_option('sidebarlogin_logout_redirect', $_POST['sidebarlogin_logout_redirect']);
51
- update_option('sidebarlogin_register_link', $_POST['sidebarlogin_register_link']);
52
- update_option('sidebarlogin_forgotton_link', $_POST['sidebarlogin_forgotton_link']);
53
- update_option('sidebarlogin_logged_in_links', $_POST['sidebarlogin_logged_in_links']);
54
- echo '<div id="message"class="updated fade">';
55
- _e('<p>Changes saved</p>',"sblogin");
56
- echo '</div>';
57
- }
58
- // Get options
59
- $sidebarlogin_login_redirect = get_option('sidebarlogin_login_redirect');
60
- $sidebarlogin_logout_redirect = get_option('sidebarlogin_logout_redirect');
61
- $sidebarlogin_register_link = get_option('sidebarlogin_register_link');
62
- $sidebarlogin_forgotton_link = get_option('sidebarlogin_forgotton_link');
63
- $sidebarlogin_logged_in_links = get_option('sidebarlogin_logged_in_links');
64
- ?>
65
- <div class="wrap alternate">
66
- <h2><?php _e('Sidebar Login',"sblogin"); ?></h2>
67
- <br class="a_break" style="clear: both;"/>
68
- <form action="?page=Sidebar Login" method="post">
69
- <table class="niceblue form-table">
70
- <tr>
71
- <th scope="col"><?php _e('Login redirect URL',"sblogin"); ?>:</th>
72
- <td><input type="text" name="sidebarlogin_login_redirect" value="<?php echo $sidebarlogin_login_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after login. Leave blank to use their current page.','sblogin'); ?></span></td>
73
- </tr>
74
- <tr>
75
- <th scope="col"><?php _e('Logout redirect URL',"sblogin"); ?>:</th>
76
- <td><input type="text" name="sidebarlogin_logout_redirect" value="<?php echo $sidebarlogin_logout_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after logout. Leave blank to use their current page.','sblogin'); ?></span></td>
77
- </tr>
78
- <tr>
79
- <th scope="col"><?php _e('Show Register Link',"sblogin"); ?>:</th>
80
- <td><select name="sidebarlogin_register_link">
81
- <option <?php if ($sidebarlogin_register_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>
82
- <option <?php if ($sidebarlogin_register_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>
83
- </select> <span class="setting-description"><?php _e('User registrations must also be turned on for this to work (\'Anyone can register\' checkbox in settings).','sblogin'); ?></span></td>
84
- </tr>
85
- <tr>
86
- <th scope="col"><?php _e('Show Lost Password Link',"sblogin"); ?>:</th>
87
- <td><select name="sidebarlogin_forgotton_link">
88
- <option <?php if ($sidebarlogin_forgotton_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>
89
- <option <?php if ($sidebarlogin_forgotton_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>
90
- </select></td>
91
- </tr>
92
- <tr>
93
- <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
94
- <td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e('One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users. You can also type <code>%USERNAME%</code> which will be replaced by the user\'s username. Default: <br/>&lt;a href="','sblogin');
95
- echo get_bloginfo('wpurl').'/wp-admin/"&gt;Dashboard&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;Profile&lt;/a&gt;'; ?></span></td>
96
- </tr>
97
- </table>
98
- <p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>
99
- </form>
100
- </div>
101
- <?php
102
- }
103
-
104
- /*
105
- example of short call with text
106
-
107
- sidebarlogin('before_title=<h5>&after_title='</h5>');
108
-
109
- suggested by dev.xiligroup.com
110
- */
111
-
112
- function sidebarlogin($myargs = '') {
113
- if (is_array($myargs)) $args = &$myargs;
114
- else parse_str($myargs, $args);
115
-
116
- $defaults = array('before_widget'=>'','after_widget'=>'',
117
- 'before_title'=>'<h2>','after_title'=>'</h2>'
118
- );
119
- $args = array_merge($defaults, $args);
120
-
121
- widget_wp_sidebarlogin($args);
122
- }
123
-
124
- function widget_wp_sidebarlogin($args) {
125
- global $user_ID, $current_user;
126
-
127
- /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */
128
- $defaults = array(
129
- 'thelogin'=>__('Login','sblogin'),
130
- 'thewelcome'=>__("Welcome",'sblogin'),
131
- 'theusername'=>__('Username:','sblogin'),
132
- 'thepassword'=>__('Password:','sblogin'),
133
- 'theremember'=>__('Remember me','sblogin'),
134
- 'theregister'=>__('Register','sblogin'),
135
- 'thepasslostandfound'=>__('Password Lost and Found','sblogin'),
136
- 'thelostpass'=> __('Lost your password?','sblogin'),
137
- 'thelogout'=> __('Logout','sblogin')
138
- );
139
-
140
- $args = array_merge($defaults, $args);
141
- extract($args);
142
-
143
- get_currentuserinfo();
144
-
145
- if ($user_ID != '') {
146
- // User is logged in
147
-
148
- global $current_user;
149
- get_currentuserinfo();
150
-
151
- echo $before_widget . $before_title .$thewelcome.' '.ucwords($current_user->display_name). $after_title;
152
-
153
- echo '<div class="avatar_container">'.get_avatar($user_ID, $size = '38').'</div>';
154
-
155
- echo '<ul class="pagenav">';
156
-
157
- if(isset($current_user->user_level) && $current_user->user_level) $level = $current_user->user_level;
158
-
159
- $links = do_shortcode(get_option('sidebarlogin_logged_in_links'));
160
-
161
- $links = explode("\n", $links);
162
- if (sizeof($links)>0)
163
- foreach ($links as $l) {
164
- $link = explode('|',$l);
165
- if (isset($link[1]) && strtolower(trim($link[1]))=='true' && $level!=10) continue;
166
- else {
167
- // Parse %USERNAME%
168
- $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);
169
- $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);
170
- echo '<li class="page_item">'.$link[0].'</li>';
171
- }
172
- }
173
-
174
- $redir = trim(stripslashes(get_option('sidebarlogin_logout_redirect')));
175
- if (!$redir || empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');
176
-
177
- echo '<li class="page_item"><a href="'.wp_logout_url($redir).'">'.$thelogout.'</a></li></ul>';
178
-
179
- } else {
180
- // User is NOT logged in!!!
181
- echo $before_widget . $before_title .'<span>'. $thelogin .'</span>' . $after_title;
182
- // Show any errors
183
- global $myerrors;
184
-
185
- $wp_error = new WP_Error();
186
-
187
- if ( !empty($myerrors) && is_wp_error($myerrors) ) {
188
- $wp_error = $myerrors;
189
- }
190
-
191
- /* Cookies not supported error handling */
192
- if ( isset($_GET['_login']) && empty($_COOKIE[TEST_COOKIE]) ) $wp_error->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
193
-
194
- if ( $wp_error->get_error_code() ) {
195
-
196
- $errors = '';
197
- $messages = '';
198
-
199
- foreach ( $wp_error->get_error_codes() as $code ) {
200
- $severity = $wp_error->get_error_data($code);
201
- foreach ( $wp_error->get_error_messages($code) as $error ) {
202
- if ( 'message' == $severity )
203
- $messages .= ' ' . $error . "<br />\n";
204
- else
205
- $errors .= ' ' . $error . "<br />\n";
206
- }
207
- }
208
-
209
- if ( !empty($errors) )
210
- echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
211
- if ( !empty($messages) )
212
- echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
213
- }
214
- // login form
215
- echo '<form method="post" action="'.wp_sidebarlogin_current_url().'">';
216
- ?>
217
- <p><label for="user_login"><?php echo $theusername; ?><br/><input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" /></label></p>
218
- <p><label for="user_pass"><?php echo $thepassword; ?><br/><input name="pwd" class="mid" id="user_pass" type="password" /></label></p>
219
-
220
- <?php
221
- // OpenID Plugin (http://wordpress.org/extend/plugins/openid/) Integration
222
- if (function_exists('openid_wp_login_form')) {
223
-
224
- echo '<input type="hidden" name="redirect_to" value="'.wp_sidebarlogin_current_url().'" />';
225
-
226
- //openid_wp_login_form();
227
- echo '<hr id="openid_split" />';
228
-
229
- echo '
230
- <p>
231
- <label for="openid_field">' . __('Or login using an <a href="http://openid.net/what/" title="Learn about OpenID">OpenID</a>', 'sblogin') . '</label>
232
- <input type="text" name="openid_identifier" id="openid_field" class="input mid" value="" /></label>
233
- </p>';
234
- }
235
-
236
- ?>
237
-
238
- <p class="rememberme"><label for="rememberme"><input name="rememberme" class="checkbox" id="rememberme" value="forever" type="checkbox" /> <?php echo $theremember; ?></label></p>
239
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php echo $thelogin; ?> &raquo;" />
240
-
241
- <input type="hidden" name="sidebarlogin_posted" value="1" />
242
- <input type="hidden" name="testcookie" value="1" /></p>
243
-
244
- <?php
245
- // Facebook Plugin
246
- if (function_exists('fbc_init_auth')) do_action('fbc_display_login_button');
247
- ?>
248
-
249
- </form>
250
- <?php
251
- // Output other links
252
- $isul = false; /* ms for w3c - suggested by dev.xiligroup.com */
253
- if (get_option('users_can_register') && get_option('sidebarlogin_register_link')=='yes') {
254
- // MU FIX
255
- global $wpmu_version;
256
- if (empty($wpmu_version)) {
257
- echo '<ul class="sidebarlogin_otherlinks">';
258
- $isul = true;
259
- ?>
260
- <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>
261
- <?php
262
- } else {
263
- echo '<ul class="sidebarlogin_otherlinks">';
264
- $isul = true;
265
- ?>
266
- <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>
267
- <?php
268
- }
269
- }
270
- if (get_option('sidebarlogin_forgotton_link')=='yes') :
271
- if ($isul == false) {
272
- echo '<ul class="sidebarlogin_otherlinks">';
273
- $isul = true;
274
- }
275
- ?>
276
- <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>
277
- <?php
278
- endif;
279
- if ($isul) echo '</ul>';
280
- }
281
-
282
- // echo widget closing tag
283
- echo $after_widget;
284
- }
285
-
286
- function widget_wp_sidebarlogin_init() {
287
- if ( !function_exists('register_sidebar_widget') ) return;
288
- // Register widget for use
289
- register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_wp_sidebarlogin');
290
- }
291
-
292
- function widget_wp_sidebarlogin_check() {
293
-
294
- // Add options - they may not exist
295
- add_option('sidebarlogin_login_redirect','','no');
296
- add_option('sidebarlogin_logout_redirect','','no');
297
- add_option('sidebarlogin_register_link','yes','no');
298
- add_option('sidebarlogin_forgotton_link','yes','no');
299
- add_option('sidebarlogin_logged_in_links', "<a href=\"".get_bloginfo('wpurl')."/wp-admin/\">".__('Dashboard','sblogin')."</a>\n<a href=\"".get_bloginfo('wpurl')."/wp-admin/profile.php\">".__('Profile','sblogin')."</a>",'no');
300
-
301
- // Set a cookie now to see if they are supported by the browser.
302
- setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
303
- if ( SITECOOKIEPATH != COOKIEPATH )
304
- setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
305
-
306
- if (isset($_POST['sidebarlogin_posted'])) {
307
-
308
- global $myerrors;
309
- $myerrors = new WP_Error();
310
-
311
- nocache_headers();
312
-
313
- $secure_cookie = '';
314
-
315
- $redir = trim(stripslashes(get_option('sidebarlogin_login_redirect')));
316
- if ($redir && !empty($redir)) $redirect_to = $redir;
317
- else $redirect_to = wp_sidebarlogin_current_url('nologout');
318
-
319
- // If the user wants ssl but the session is not ssl, force a secure cookie.
320
- if ( !empty($_POST['log']) && !force_ssl_admin() ) {
321
- $user_name = sanitize_user($_POST['log']);
322
- if ( $user = get_userdatabylogin($user_name) ) {
323
- if ( get_user_option('use_ssl', $user->ID) ) {
324
- $secure_cookie = true;
325
- force_ssl_admin(true);
326
- }
327
- }
328
- }
329
-
330
- if ( $redirect_to ) {
331
- // Redirect to https if user wants ssl
332
- if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
333
- $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
334
- }
335
-
336
- if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
337
- $secure_cookie = false;
338
-
339
- $user = wp_signon('', $secure_cookie);
340
-
341
- $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $redirect_to ) ? $redirect_to : '', $user);
342
-
343
- if ( $user && !is_wp_error($user) ) {
344
- /*if ( isset($_POST['testcookie']) && empty($_COOKIE[TEST_COOKIE]) )
345
- $myerrors->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
346
- else {*/
347
- wp_safe_redirect($redirect_to);
348
- exit;
349
- //}
350
- } elseif ($user) {
351
- $myerrors = $user;
352
- if ( empty($_POST['log']) && empty($_POST['pwd']) ) {
353
- $myerrors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username & password.', 'sblogin'));
354
- }
355
- }
356
- }
357
- }
358
-
359
- if ( !function_exists('wp_sidebarlogin_current_url') ) :
360
- function wp_sidebarlogin_current_url($url = '') {
361
-
362
- global $wpdb, $post, $cat, $tag, $author, $year, $monthnum, $day, $wp_query;
363
- $pageURL = "";
364
-
365
- if ( is_home() && $wp_query->is_posts_page==1)
366
- {
367
- $pageURL = get_permalink(get_option('page_for_posts'));
368
- }
369
- elseif (is_home() || is_front_page())
370
- {
371
- $pageURL = get_bloginfo('url');
372
- }
373
- elseif (is_single() || is_page())
374
- {
375
- $pageURL = get_permalink($post->ID);
376
- }
377
- elseif (is_category())
378
- {
379
- $pageURL = get_category_link($cat);
380
- }
381
- elseif (is_tag())
382
- {
383
- $tag_id = $wpdb->get_var("SELECT ".$wpdb->terms.".term_id FROM $wpdb->term_taxonomy
384
- LEFT JOIN $wpdb->terms
385
- ON (".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id)
386
- WHERE ".$wpdb->terms.".slug = '$tag'
387
- AND ".$wpdb->term_taxonomy.".taxonomy = 'post_tag' LIMIT 1");
388
- $pageURL = get_tag_link($tag_id);
389
- }
390
- elseif (is_author())
391
- {
392
- $pageURL = get_author_posts_url($author);
393
- }
394
- elseif (is_date())
395
- {
396
-
397
- if ($day)
398
- {
399
- $pageURL = get_day_link( $year, $month, $day);
400
- }
401
- elseif ($monthnum)
402
- {
403
- $pageURL = get_month_link( $year, $monthnum, $day);
404
- }
405
- elseif ($year)
406
- {
407
- $pageURL = get_year_link( $year, $monthnum, $day);
408
- }
409
-
410
- }
411
- elseif (is_search())
412
- {
413
- $pageURL = get_bloginfo('wpurl');
414
- if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
415
- $pageURL .= '?s='.$_REQUEST['s'].'';
416
- }
417
-
418
- if (!$pageURL || $pageURL=="" || !is_string($pageURL)) {
419
- $pageURL = "";
420
- $pageURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
421
-
422
- if ($_SERVER["SERVER_PORT"] != "80") {
423
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
424
- } else {
425
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
426
- }
427
-
428
- //————–added by mick
429
- if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );
430
- //——————–
431
- }
432
- if ($pageURL && !is_search()) if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
433
-
434
- if ($url != "nologout") {
435
- if (!strpos($pageURL,'_login=')) {
436
- $rand_string = md5(uniqid(rand(), true));
437
- $rand_string = substr($rand_string, 0, 10);
438
-
439
- if (strpos($pageURL,'?'))
440
- if (substr($pageURL,-1)=='/')
441
- $pageURL = substr($pageURL,0,-1);
442
-
443
- $rand = (!strpos($pageURL,'?')) ? '?_login='.$rand_string : '&_login='.$rand_string;
444
- $pageURL .= $rand;
445
- }
446
- //$pageURL .='#login';
447
- }
448
-
449
- if ( force_ssl_login() || force_ssl_admin() ) {
450
- $pageURL = str_replace( 'http://', 'https://', get_option('siteurl') );
451
- }
452
-
453
- return $pageURL;
454
- }
455
- endif;
456
-
457
- function wp_sidebarlogin_css() {
458
- $myStyleFile = WP_PLUGIN_URL . '/sidebar-login/style.css';
459
- wp_register_style('wp_sidebarlogin_css_styles', $myStyleFile);
460
- wp_enqueue_style( 'wp_sidebarlogin_css_styles');
461
- }
462
-
463
- // Run code and init
464
- add_action('wp_print_styles', 'wp_sidebarlogin_css');
465
- add_action('init', 'widget_wp_sidebarlogin_check',0);
466
- add_action('widgets_init', 'widget_wp_sidebarlogin_init');
467
- add_action('admin_menu', 'wp_sidebarlogin_menu');
 
 
 
 
 
 
 
 
468
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: Sidebar Login
4
+ Plugin URI: http://wordpress.org/extend/plugins/sidebar-login/
5
+ Description: Adds a sidebar widget to let users login
6
+ Version: 2.2.8
7
+ Author: Mike Jolley
8
+ Author URI: http://blue-anvil.com
9
+ */
10
+
11
+ // Pre 2.6 compatibility (BY Stephen Rider)
12
+ if ( ! defined( 'WP_CONTENT_URL' ) ) {
13
+ if ( defined( 'WP_SITEURL' ) ) define( 'WP_CONTENT_URL', WP_SITEURL . '/wp-content' );
14
+ else define( 'WP_CONTENT_URL', get_option( 'url' ) . '/wp-content' );
15
+ }
16
+ if ( ! defined( 'WP_PLUGIN_URL' ) ) define( 'WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
17
+
18
+ load_plugin_textdomain('sblogin', WP_PLUGIN_URL.'/sidebar-login/langs/', 'sidebar-login/langs/');
19
+
20
+ function wp_sidebarlogin_menu() {
21
+ add_submenu_page('options-general.php', __('Sidebar Login','sblogin'), __('Sidebar Login','sblogin'), 9,'Sidebar Login', 'wp_sidebarlogin_admin');
22
+ }
23
+
24
+ if (!function_exists('is_ssl')) :
25
+ function is_ssl() {
26
+ return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false;
27
+ }
28
+ endif;
29
+
30
+ function wp_sidebarlogin_admin(){
31
+ // Update options
32
+ if ($_POST) {
33
+ update_option('sidebarlogin_login_redirect', stripslashes($_POST['sidebarlogin_login_redirect']));
34
+ update_option('sidebarlogin_logout_redirect', stripslashes($_POST['sidebarlogin_logout_redirect']));
35
+ update_option('sidebarlogin_register_link', stripslashes($_POST['sidebarlogin_register_link']));
36
+ update_option('sidebarlogin_forgotton_link', stripslashes($_POST['sidebarlogin_forgotton_link']));
37
+ update_option('sidebarlogin_logged_in_links', stripslashes($_POST['sidebarlogin_logged_in_links']));
38
+ echo '<div id="message"class="updated fade">';
39
+ _e('<p>Changes saved</p>',"sblogin");
40
+ echo '</div>';
41
+ }
42
+ // Get options
43
+ $sidebarlogin_login_redirect = get_option('sidebarlogin_login_redirect');
44
+ $sidebarlogin_logout_redirect = get_option('sidebarlogin_logout_redirect');
45
+ $sidebarlogin_register_link = get_option('sidebarlogin_register_link');
46
+ $sidebarlogin_forgotton_link = get_option('sidebarlogin_forgotton_link');
47
+ $sidebarlogin_logged_in_links = get_option('sidebarlogin_logged_in_links');
48
+ ?>
49
+ <div class="wrap alternate">
50
+ <h2><?php _e('Sidebar Login',"sblogin"); ?></h2>
51
+ <br class="a_break" style="clear: both;"/>
52
+ <form action="options-general.php?page=Sidebar%20Login" method="post">
53
+ <table class="niceblue form-table">
54
+ <tr>
55
+ <th scope="col"><?php _e('Login redirect URL',"sblogin"); ?>:</th>
56
+ <td><input type="text" name="sidebarlogin_login_redirect" value="<?php echo $sidebarlogin_login_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after login. Leave blank to use their current page.','sblogin'); ?></span></td>
57
+ </tr>
58
+ <tr>
59
+ <th scope="col"><?php _e('Logout redirect URL',"sblogin"); ?>:</th>
60
+ <td><input type="text" name="sidebarlogin_logout_redirect" value="<?php echo $sidebarlogin_logout_redirect; ?>" /> <span class="setting-description"><?php _e('Url to redirect the user to after logout. Leave blank to use their current page.','sblogin'); ?></span></td>
61
+ </tr>
62
+ <tr>
63
+ <th scope="col"><?php _e('Show Register Link',"sblogin"); ?>:</th>
64
+ <td><select name="sidebarlogin_register_link">
65
+ <option <?php if ($sidebarlogin_register_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>
66
+ <option <?php if ($sidebarlogin_register_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>
67
+ </select> <span class="setting-description"><?php _e('User registrations must also be turned on for this to work (\'Anyone can register\' checkbox in settings).','sblogin'); ?></span></td>
68
+ </tr>
69
+ <tr>
70
+ <th scope="col"><?php _e('Show Lost Password Link',"sblogin"); ?>:</th>
71
+ <td><select name="sidebarlogin_forgotton_link">
72
+ <option <?php if ($sidebarlogin_forgotton_link=='yes') echo 'selected="selected"'; ?> value="yes"><?php _e('Yes','sblogin'); ?></option>
73
+ <option <?php if ($sidebarlogin_forgotton_link=='no') echo 'selected="selected"'; ?> value="no"><?php _e('No','sblogin'); ?></option>
74
+ </select></td>
75
+ </tr>
76
+ <tr>
77
+ <th scope="col"><?php _e('Logged in links',"sblogin"); ?>:</th>
78
+ <td><textarea name="sidebarlogin_logged_in_links" rows="3" cols="80" /><?php echo $sidebarlogin_logged_in_links; ?></textarea><br/><span class="setting-description"><?php _e("One link per line. Note: Logout link will always show regardless. Tip: Add <code>|true</code> after a link to only show it to admin users. If you add a further <code>|USER LEVEL</code> the link will only be shown to users with levels equal to or greater than those defined. See <a href='http://codex.wordpress.org/Roles_and_Capabilities' target='_blank'>http://codex.wordpress.org/Roles_and_Capabilities</a> for more info on roles and Capabilities.<br/> You can also type <code>%USERNAME%</code> which will be replaced by the user's username. Default:",'sblogin');
79
+ echo '<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/"&gt;Dashboard&lt;/a&gt;<br/>&lt;a href="'.get_bloginfo('wpurl').'/wp-admin/profile.php"&gt;Profile&lt;/a&gt;'; ?></span></td>
80
+ </tr>
81
+ </table>
82
+ <p class="submit"><input type="submit" value="<?php _e('Save Changes',"sblogin"); ?>" /></p>
83
+ </form>
84
+ </div>
85
+ <?php
86
+ }
87
+
88
+ /*
89
+ example of short call with text
90
+
91
+ sidebarlogin('before_title=<h5>&after_title='</h5>');
92
+
93
+ suggested by dev.xiligroup.com
94
+ */
95
+
96
+ function sidebarlogin($myargs = '') {
97
+ if (is_array($myargs)) $args = &$myargs;
98
+ else parse_str($myargs, $args);
99
+
100
+ $defaults = array('before_widget'=>'','after_widget'=>'',
101
+ 'before_title'=>'<h2>','after_title'=>'</h2>'
102
+ );
103
+ $args = array_merge($defaults, $args);
104
+
105
+ widget_wp_sidebarlogin($args);
106
+ }
107
+
108
+ function widget_wp_sidebarlogin($args) {
109
+ global $user_ID, $current_user;
110
+
111
+ /* To add more extend i.e when terms came from themes - suggested by dev.xiligroup.com */
112
+ $defaults = array(
113
+ 'thelogin'=>__('Login','sblogin'),
114
+ 'thewelcome'=>__("Welcome",'sblogin'),
115
+ 'theusername'=>__('Username:','sblogin'),
116
+ 'thepassword'=>__('Password:','sblogin'),
117
+ 'theremember'=>__('Remember me','sblogin'),
118
+ 'theregister'=>__('Register','sblogin'),
119
+ 'thepasslostandfound'=>__('Password Lost and Found','sblogin'),
120
+ 'thelostpass'=> __('Lost your password?','sblogin'),
121
+ 'thelogout'=> __('Logout','sblogin')
122
+ );
123
+
124
+ $args = array_merge($defaults, $args);
125
+ extract($args);
126
+
127
+ get_currentuserinfo();
128
+
129
+ if ($user_ID != '') {
130
+ // User is logged in
131
+
132
+ global $current_user;
133
+ get_currentuserinfo();
134
+
135
+ echo $before_widget . $before_title .$thewelcome.' '.ucwords($current_user->display_name). $after_title;
136
+
137
+ echo '<div class="avatar_container">'.get_avatar($user_ID, $size = '38').'</div>';
138
+
139
+ echo '<ul class="pagenav">';
140
+
141
+ if(isset($current_user->user_level) && $current_user->user_level) $level = $current_user->user_level;
142
+
143
+ $links = do_shortcode(get_option('sidebarlogin_logged_in_links'));
144
+
145
+ $links = explode("\n", $links);
146
+ if (sizeof($links)>0)
147
+ foreach ($links as $l) {
148
+ $link = explode('|',$l);
149
+ if (isset($link[2]) && is_numeric(intval(trim($link[2]))) && intval(trim($link[2])) <= 10 ) { // Thanks to John from http://www.area-europa.es/
150
+ $req_level = intval(trim($link[2]));
151
+ } else {
152
+ $req_level=10;
153
+ }
154
+ if (isset($link[1]) && strtolower(trim($link[1]))=='true' && $level < $req_level) continue;
155
+ else {
156
+ // Parse %USERNAME%
157
+ $link[0] = str_replace('%USERNAME%',$current_user->user_login,$link[0]);
158
+ $link[0] = str_replace('%username%',$current_user->user_login,$link[0]);
159
+ echo '<li class="page_item">'.$link[0].'</li>';
160
+ }
161
+ }
162
+
163
+ $redir = trim(stripslashes(get_option('sidebarlogin_logout_redirect')));
164
+ if (!$redir || empty($redir)) $redir = wp_sidebarlogin_current_url('nologout');
165
+
166
+ echo '<li class="page_item"><a href="'.wp_logout_url($redir).'">'.$thelogout.'</a></li></ul>';
167
+
168
+ } else {
169
+ // User is NOT logged in!!!
170
+ echo $before_widget . $before_title .'<span>'. $thelogin .'</span>' . $after_title;
171
+ // Show any errors
172
+ global $myerrors;
173
+
174
+ $wp_error = new WP_Error();
175
+
176
+ if ( !empty($myerrors) && is_wp_error($myerrors) ) {
177
+ $wp_error = $myerrors;
178
+ }
179
+
180
+ /* Cookies not supported error handling */
181
+ if ( isset($_GET['_login']) && empty($_COOKIE[TEST_COOKIE]) ) $wp_error->add('test_cookie', __("<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress."));
182
+
183
+ if ( $wp_error->get_error_code() ) {
184
+
185
+ $errors = '';
186
+ $messages = '';
187
+
188
+ foreach ( $wp_error->get_error_codes() as $code ) {
189
+ $severity = $wp_error->get_error_data($code);
190
+ foreach ( $wp_error->get_error_messages($code) as $error ) {
191
+ if ( 'message' == $severity )
192
+ $messages .= ' ' . $error . "<br />\n";
193
+ else
194
+ $errors .= ' ' . $error . "<br />\n";
195
+ }
196
+ }
197
+
198
+ if ( !empty($errors) )
199
+ echo '<div id="login_error">' . apply_filters('login_errors', $errors) . "</div>\n";
200
+ if ( !empty($messages) )
201
+ echo '<p class="message">' . apply_filters('login_messages', $messages) . "</p>\n";
202
+ }
203
+ // login form
204
+ echo '<form method="post" action="'.wp_sidebarlogin_current_url().'">';
205
+ ?>
206
+ <p><label for="user_login"><?php echo $theusername; ?></label><br/><input name="log" value="<?php echo attribute_escape(stripslashes($_POST['log'])); ?>" class="mid" id="user_login" type="text" /></p>
207
+ <p><label for="user_pass"><?php echo $thepassword; ?></label><br/><input name="pwd" class="mid" id="user_pass" type="password" /></p>
208
+
209
+ <?php
210
+ // OpenID Plugin (http://wordpress.org/extend/plugins/openid/) Integration
211
+ if (function_exists('openid_wp_login_form')) {
212
+
213
+ echo '<input type="hidden" name="redirect_to" value="'.wp_sidebarlogin_current_url().'" />';
214
+
215
+ //openid_wp_login_form();
216
+ echo '<hr id="openid_split" />';
217
+
218
+ echo '
219
+ <p>
220
+ <label for="openid_field">' . __('Or login using an <a href="http://openid.net/what/" title="Learn about OpenID">OpenID</a>', 'sblogin') . '</label>
221
+ <input type="text" name="openid_identifier" id="openid_field" class="input mid" value="" /></label>
222
+ </p>';
223
+ }
224
+
225
+ ?>
226
+
227
+ <p class="rememberme"><input name="rememberme" class="checkbox" id="rememberme" value="forever" type="checkbox" /> <label for="rememberme"><?php echo $theremember; ?></label></p>
228
+ <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" value="<?php echo $thelogin; ?> &raquo;" />
229
+
230
+ <input type="hidden" name="sidebarlogin_posted" value="1" />
231
+ <input type="hidden" name="testcookie" value="1" /></p>
232
+
233
+ <?php
234
+ // Facebook Plugin
235
+ if (function_exists('fbc_init_auth')) do_action('fbc_display_login_button');
236
+ ?>
237
+
238
+ </form>
239
+ <?php
240
+ // Output other links
241
+ $isul = false; /* ms for w3c - suggested by dev.xiligroup.com */
242
+ if (get_option('users_can_register') && get_option('sidebarlogin_register_link')=='yes') {
243
+ // MU FIX
244
+ global $wpmu_version;
245
+ if (empty($wpmu_version)) {
246
+ echo '<ul class="sidebarlogin_otherlinks">';
247
+ $isul = true;
248
+ ?>
249
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=register" rel="nofollow"><?php echo $theregister; ?></a></li>
250
+ <?php
251
+ } else {
252
+ echo '<ul class="sidebarlogin_otherlinks">';
253
+ $isul = true;
254
+ ?>
255
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-signup.php" rel="nofollow"><?php echo $theregister; ?></a></li>
256
+ <?php
257
+ }
258
+ }
259
+ if (get_option('sidebarlogin_forgotton_link')=='yes') :
260
+ if ($isul == false) {
261
+ echo '<ul class="sidebarlogin_otherlinks">';
262
+ $isul = true;
263
+ }
264
+ ?>
265
+ <li><a href="<?php bloginfo('wpurl'); ?>/wp-login.php?action=lostpassword" title="<?php echo $thepasslostfound; ?>" rel="nofollow"><?php echo $thelostpass; ?></a></li>
266
+ <?php
267
+ endif;
268
+ if ($isul) echo '</ul>';
269
+ }
270
+
271
+ // echo widget closing tag
272
+ echo $after_widget;
273
+ }
274
+
275
+ if (class_exists('WP_Widget')) {
276
+
277
+ function widget_wp_sidebarlogin_init() {
278
+ // New Style widgets
279
+ class SidebarLoginMultiWidget extends WP_Widget {
280
+ function SidebarLoginMultiWidget() {
281
+ $widget_ops = array('description' => __( 'Sidebar Login.','sblogin') );
282
+ $this->WP_Widget('wp_sidebarlogin', __('Sidebar Login','sblogin'), $widget_ops);
283
+ }
284
+ function widget($args, $instance) {
285
+
286
+ widget_wp_sidebarlogin($args);
287
+
288
+ }
289
+ }
290
+ register_widget('SidebarLoginMultiWidget');
291
+ }
292
+ add_action('init', 'widget_wp_sidebarlogin_init', 1);
293
+
294
+ } else {
295
+ // Legacy Widgets
296
+ function widget_wp_sidebarlogin_init() {
297
+ if ( !function_exists('register_sidebar_widget') ) return;
298
+ // Register widget for use
299
+ register_sidebar_widget(array('Sidebar Login', 'widgets'), 'widget_wp_sidebarlogin');
300
+ }
301
+ add_action('widgets_init', 'widget_wp_sidebarlogin_init');
302
+ }
303
+
304
+ function widget_wp_sidebarlogin_check() {
305
+
306
+ // Add options - they may not exist
307
+ add_option('sidebarlogin_login_redirect','','no');
308
+ add_option('sidebarlogin_logout_redirect','','no');
309
+ add_option('sidebarlogin_register_link','yes','no');
310
+ add_option('sidebarlogin_forgotton_link','yes','no');
311
+ add_option('sidebarlogin_logged_in_links', "<a href=\"".get_bloginfo('wpurl')."/wp-admin/\">".__('Dashboard','sblogin')."</a>\n<a href=\"".get_bloginfo('wpurl')."/wp-admin/profile.php\">".__('Profile','sblogin')."</a>",'no');
312
+
313
+ echo COOKIE_DOMAIN;
314
+
315
+ // Set a cookie now to see if they are supported by the browser.
316
+ setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
317
+ if ( SITECOOKIEPATH != COOKIEPATH )
318
+ setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
319
+
320
+ if (isset($_POST['sidebarlogin_posted'])) {
321
+
322
+ global $myerrors;
323
+ $myerrors = new WP_Error();
324
+
325
+ nocache_headers();
326
+
327
+ $secure_cookie = '';
328
+
329
+ $redir = trim(stripslashes(get_option('sidebarlogin_login_redirect')));
330
+ if ($redir && !empty($redir)) $redirect_to = $redir;
331
+ else $redirect_to = wp_sidebarlogin_current_url('nologout');
332
+
333
+ // If the user wants ssl but the session is not ssl, force a secure cookie.
334
+ if ( !empty($_POST['log']) && !force_ssl_admin() ) {
335
+ $user_name = sanitize_user(stripslashes($_POST['log']));
336
+ if ( $user = get_userdatabylogin($user_name) ) {
337
+ if ( get_user_option('use_ssl', $user->ID) ) {
338
+ $secure_cookie = true;
339
+ force_ssl_admin(true);
340
+ }
341
+ }
342
+ }
343
+
344
+ if ( $redirect_to ) {
345
+ // Redirect to https if user wants ssl
346
+ if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
347
+ $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
348
+ }
349
+
350
+ if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) ) $secure_cookie = false;
351
+
352
+ $user = wp_signon('', $secure_cookie);
353
+
354
+ $redirect_to = apply_filters('login_redirect', $redirect_to, isset( $redirect_to ) ? $redirect_to : '', $user);
355
+
356
+ if ( $user && !is_wp_error($user) ) {
357
+ wp_safe_redirect($redirect_to);
358
+ exit;
359
+ //}
360
+ } elseif ($user) {
361
+ $myerrors = $user;
362
+ if ( empty($_POST['log']) && empty($_POST['pwd']) ) {
363
+ $myerrors->add('empty_username', __('<strong>ERROR</strong>: Please enter a username & password.', 'sblogin'));
364
+ }
365
+ }
366
+ }
367
+ }
368
+
369
+ if ( !function_exists('wp_sidebarlogin_current_url') ) :
370
+ function wp_sidebarlogin_current_url($url = '') {
371
+
372
+ global $wpdb, $post, $cat, $tag, $author, $year, $monthnum, $day, $wp_query;
373
+ $pageURL = "";
374
+
375
+ if ( is_home() && $wp_query->is_posts_page==1)
376
+ {
377
+ $pageURL = get_permalink(get_option('page_for_posts'));
378
+ }
379
+ elseif (is_home() || is_front_page())
380
+ {
381
+ $pageURL = get_bloginfo('url');
382
+ }
383
+ elseif (is_single() || is_page())
384
+ {
385
+ $pageURL = get_permalink($wp_query->post->ID);
386
+ }
387
+ elseif (is_category())
388
+ {
389
+ $pageURL = get_category_link($cat);
390
+ }
391
+ elseif (is_tag())
392
+ {
393
+ $tag_id = $wpdb->get_var("SELECT ".$wpdb->terms.".term_id FROM $wpdb->term_taxonomy
394
+ LEFT JOIN $wpdb->terms
395
+ ON (".$wpdb->term_taxonomy.".term_id = ".$wpdb->terms.".term_id)
396
+ WHERE ".$wpdb->terms.".slug = '$tag'
397
+ AND ".$wpdb->term_taxonomy.".taxonomy = 'post_tag' LIMIT 1");
398
+ $pageURL = get_tag_link($tag_id);
399
+ }
400
+ elseif (is_author())
401
+ {
402
+ $pageURL = get_author_posts_url($author);
403
+ }
404
+ elseif (is_date())
405
+ {
406
+
407
+ if ($day)
408
+ {
409
+ $pageURL = get_day_link( $year, $month, $day);
410
+ }
411
+ elseif ($monthnum)
412
+ {
413
+ $pageURL = get_month_link( $year, $monthnum, $day);
414
+ }
415
+ elseif ($year)
416
+ {
417
+ $pageURL = get_year_link( $year, $monthnum, $day);
418
+ }
419
+
420
+ }
421
+ elseif (is_search())
422
+ {
423
+ $pageURL = get_bloginfo('wpurl');
424
+ if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
425
+ $pageURL .= '?s='.stripslashes(strip_tags($_REQUEST['s'])).'';
426
+ }
427
+
428
+ if (!$pageURL || $pageURL=="" || !is_string($pageURL)) {
429
+ $pageURL = "";
430
+ $pageURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
431
+
432
+ if ($_SERVER["SERVER_PORT"] != "80") {
433
+ $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
434
+ } else {
435
+ $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
436
+ }
437
+
438
+ //————–added by mick
439
+ if (!strstr(get_bloginfo('url'),'www.')) $pageURL = str_replace('www.','', $pageURL );
440
+ //——————–
441
+ }
442
+ if ($pageURL && !is_search()) if ("/" != substr($pageURL, -1)) $pageURL = $pageURL . "/";
443
+
444
+ if ($url != "nologout") {
445
+ if (!strpos($pageURL,'_login=')) {
446
+ $rand_string = md5(uniqid(rand(), true));
447
+ $rand_string = substr($rand_string, 0, 10);
448
+
449
+ if (strpos($pageURL,'?'))
450
+ if (substr($pageURL,-1)=='/')
451
+ $pageURL = substr($pageURL,0,-1);
452
+
453
+ $rand = (!strpos($pageURL,'?')) ? '?_login='.$rand_string : '&amp;_login='.$rand_string;
454
+ $pageURL .= $rand;
455
+ }
456
+ }
457
+
458
+ if ( force_ssl_login() || force_ssl_admin() ) {
459
+ $pageURL = str_replace( 'http://', 'https://', $pageURL );
460
+ }
461
+
462
+ return $pageURL;
463
+ }
464
+ endif;
465
+
466
+ function wp_sidebarlogin_css() {
467
+ $myStyleFile = WP_PLUGIN_URL . '/sidebar-login/style.css';
468
+ wp_register_style('wp_sidebarlogin_css_styles', $myStyleFile);
469
+ wp_enqueue_style( 'wp_sidebarlogin_css_styles');
470
+ }
471
+
472
+ // Run code and init
473
+ add_action('wp_print_styles', 'wp_sidebarlogin_css');
474
+ add_action('init', 'widget_wp_sidebarlogin_check',0);
475
+ add_action('admin_menu', 'wp_sidebarlogin_menu');
476
  ?>