Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php /* BridgeDD Widgets Copyright 2015 by Dion Designs. All Rights Reserved. */..
Decoded Output download
<?php
/*
BridgeDD Widgets
Copyright 2015 by Dion Designs.
All Rights Reserved.
*/
if (!defined('BRIDGEDD')) { exit; } class bridgedd_widget_recent_topics extends WP_Widget { public function __construct() { $widget_ops = array('classname' => 'bridgedd_recent_topics', 'description' => __('Shows the most recent topics on your phpBB board', 'bridgedd') ); parent::__construct('bridgedd_widget_recent_topics', __('Recent Board Topics', 'bridgedd'), $widget_ops); } function widget($args, $instance) { global $config, $dddb, $phpbb_path, $phpbb_url, $phpEx, $user_forums, $guest_forums, $wflag; extract($args); $title = empty($instance['title']) ? __('Recent Board Topics', 'bridgedd') : apply_filters('widget_title', $instance['title']); $css = (int) $instance['css']; $limit = (int) $instance['max']; $old_tz = date_default_timezone_get(); if ($tz = get_option('timezone_string')) { $dformat = get_option('date_format'); $tformat = get_option('time_format'); date_default_timezone_set($tz); } else { $format = get_option('date_format') . ' ' . get_option('time_format'); $offset = get_option('gmt_offset') * 3600; } if ($css) { echo '<style scoped> #recent_board_topics .ddrow{padding-bottom:0.75em;font-size:1em;line-height:1.3em} </style>'; } echo $before_widget; echo $before_title . $title . $after_title . '<ul id="recent_board_topics">'; $sql = 'SELECT u.username, u.user_colour, t.topic_id, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_title, xp.wp_id FROM ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t LEFT JOIN bridgedd_xpost xp ON (xp.topic_id = t.topic_id) WHERE ' . $dddb->sql_in_set('t.forum_id', ((!empty($wflag)) ? $guest_forums : $user_forums)) . ' AND t.topic_last_poster_id = u.user_id ORDER BY t.topic_last_post_time DESC LIMIT 0,' . strval($limit + 5); $ctime = (RECENT_TOPICS_CACHE_TIME > 1800) ? 1800 : RECENT_TOPICS_CACHE_TIME; $ctime = ($ctime < 60) ? 60 : $ctime; if (!empty($wflag)) { $result = $dddb->sql_query($sql); } else { $result = $dddb->sql_query($sql, $ctime); } $wflag = false; $count = 0; while ($row = $dddb->sql_fetchrow($result)) { if ($count == $limit) { break; } if (empty($row['wp_id'])) { $date = ($tz) ? (date_i18n($dformat, $row['topic_last_post_time']) . ' ' . @date($tformat, $row['topic_last_post_time'])) : @date($format, ($row['topic_last_post_time'] + $offset)); $username = ($row['user_colour']) ? '<span style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</span>' : $row['username'] ; if (defined('RECENT_TOPICS_NOAUTHOR')) { echo '<li class="ddrow bddw-title"> <a href="' . $phpbb_url . 'viewtopic.php?p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '">' . $row['topic_title'] . '</a> </li>'; } else { echo '<li class="ddrow"> <div class="bddw-title"><a href="' . $phpbb_url . 'viewtopic.php?p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '">' . $row['topic_title'] . '</a></div> <div class="bddw-author">' . __('by', 'bridgedd') . ' ' . $username . ', ' . $date . '</div> </li>'; } $count++; } } $dddb->sql_freeresult($result); if (!$count) { echo '<li class="ddrow"><h2>' . __('No Recent Posts', 'bridgedd') . '</h2></li>'; } echo '</ul>' . $after_widget; date_default_timezone_set($old_tz); } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['css'] = (int) $new_instance['css']; $instance['max'] = (int) strip_tags(stripslashes($new_instance['max'])); $instance['max'] = ($instance['max'] < 3 ) ? 3 : $instance['max']; $instance['max'] = ($instance['max'] > 10 ) ? 10 : $instance['max']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'title' => '', 'css' => 1, 'max' => 5, )); $title = strip_tags($instance['title']); $css = (int) $instance['css']; $max = (int) $instance['max']; ?> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php echo __('Title:'); ?> <input name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <p><label for="<?php echo $this->get_field_id('max'); ?>"><?php echo __('Number of recent topics (3-10):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('max'); ?>" type="text" value="<?php echo esc_attr($max); ?>" size="2" maxlength="2" /></label></p> <?php } } class bridgedd_widget_login_logout extends WP_Widget { public function __construct() { $widget_ops = array('classname' => 'bridgedd_login_logout', 'description' => __('Login/Logout', 'bridgedd') ); parent::__construct('bridgedd_widget_login_logout', __('Login/Logout', 'bridgedd'), $widget_ops); } function widget($args, $instance) { global $current_user, $dduser, $integrate_wp, $phpbb_path, $phpbb_root_path, $phpbb_url, $bridgedd_config; extract($args); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = (int) $instance['size']; $avatar_src = ($bridgedd_config[avatar_src] == 'phpbb') ? true : false; if ($css) { echo '<style scoped> #login_logout{margin-top:1em;font-size:1em;line-height:' . ($size / ((current_user_can('edit_posts')) ? 3 : 2)) . 'px} .bridgedd-user{margin-' . (($loc) ? 'left' : 'right') . ':' . ($size + 10) . 'px} .phpbb-user{font-size:1.2em;font-weight:bold} #login_logout img.ddavatar{float:' . (($loc) ? 'left' : 'right') . ';margin:0;padding:0;max-width:' . $size . 'px;max-height:' . $size . 'px;background:transparent;border:none;border-radius:0;box-shadow:none} #login_logout .inputbox{padding:2px} #login_logout .reg_button{float:right} #login_logout .reg_button a{font-size:1.1em;font-weight:bold;text-decoration:none} #integrate_wp{display:block;margin-bottom:5px;font-size:1.1em} </style>'; } echo $before_widget . '<div id="login_logout">'; if (is_user_logged_in()) { if ($avatar_src) { $avatar = phpbb_avatar($dduser->data['user_avatar'],$dduser->data['user_avatar_type'],$dduser->data['user_avatar_width'],$dduser->data['user_avatar_height']); } else { $avatar = preg_replace('`class=(\'|").*?(\'|")`i', 'class="ddavatar"', get_avatar($current_user->ID, $size)); } echo $avatar . ' <div class="bridgedd-user"> <div class="phpbb-user"><a href="' . $phpbb_url . 'memberlist.php?mode=viewprofile&u=' . $dduser->data['user_id'] . '">' . $current_user->display_name . '</a></div>' . wp_loginout(site_url(), false) . ((current_user_can('edit_posts')) ? '<br /><a href="' . admin_url() . '">' . DASHBOARD_NAME . '</a>' : '') . ' </div><div style="clear:both"></div>'; } else { if ($integrate_wp) { echo '<a id="integrate_wp" href="' . site_url() . '/?integrate=wp">' . __('Integrate My Account', 'bridgedd') . '</a>'; } echo '<form name="loginform" id="loginform" action="' . esc_url(site_url('wp-login.php', 'login_post' )) . '" method="post"> <label for="user_login">' . __('Username') . '</label><input type="text" tabindex="1" name="log" id="user_login" class="inputbox" value="" size="24" /><br /> <div style="margin:2px 0 4px"><input type="checkbox" name="rememberme" id="rememberme" style="vertical-align:top" value="forever" /><label for="rememberme"> ' . __('Remember Me') . '</label></div> <label for="user_pass">' . __('Password') . '</label><input type="password" tabindex="2" name="pwd" id="user_pass" class="inputbox" value="" size="24" /><br /> <div style="padding-bottom:10px"><a href="' . esc_url(wp_lostpassword_url()) . '">' . __('Lost your password?') . '</a></div> <span class="reg_button">'; if ($bridgedd_config['reg_app'] == 'phpbb') { echo '<a href="' . $phpbb_url . 'ucp.php?mode=register">' . __('Register') . '</a>'; } else { wp_register('',''); } echo '</span> <input type="submit" tabindex="3" name="wp-submit" id="wp-submit" value="' . __('Log in') . '" /> <input type="hidden" name="redirect_to" value="' . esc_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '" /> </form>'; } echo '</div>' . $after_widget; } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['css'] = (int) $new_instance['css']; $instance['loc'] = (int) $new_instance['loc']; $instance['size'] = (int) strip_tags(stripslashes($new_instance['size'])); $instance['size'] = ($instance['size'] < 48 ) ? 48 : $instance['size']; $instance['size'] = ($instance['size'] > 96 ) ? 96 : $instance['size']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'css' => 1, 'loc' => 1, 'size' => 60, )); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = strip_tags($instance['size']); ?> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <div id="require_css"<?php if (!$css) {echo ' style="display:none"';} ?>> <p><label for="<?php echo $this->get_field_id('size'); ?>"><?php echo __('CSS avatar size (48-96 pixels):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('size'); ?>" type="text" value="<?php echo esc_attr($size); ?>" size="2" maxlength="2" /></label></p> <p><label for="<?php echo $this->get_field_id('loc'); ?>"><?php echo __('CSS avatar location:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="1"<?php echo (($loc == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Left'); ?> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="0"<?php echo (($loc == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('Right'); ?> </strong></label></p> </div> <?php } } class bridgedd_widget_phpbb_login_logout extends WP_Widget { public function __construct() { $name = 'phpBB ' . __('Login/Logout', 'bridgedd'); $widget_ops = array( 'classname' => 'bridgedd_login_logout', 'description' => $name, ); parent::__construct('bridgedd_widget_phpbb_login_logout', $name, $widget_ops); } function widget($args, $instance) { global $current_user, $dduser, $integrate_wp, $phpbb_path, $phpbb_root_path, $phpbb_url, $bridgedd_config; extract($args); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = (int) $instance['size']; $avatar_src = ($bridgedd_config[avatar_src] == 'phpbb') ? true : false; if ($css) { echo '<style scoped> #phpbb_login_logout{margin-top:1em;font-size:1em;line-height:' . ($size / ((current_user_can('edit_posts')) ? 3 : 2)) . 'px} .bridgedd-user{margin-' . (($loc) ? 'left' : 'right') . ':' . ($size + 10) . 'px} .phpbb-user{font-size:1.2em;font-weight:bold} #phpbb_login_logout img.ddavatar{float:' . (($loc) ? 'left' : 'right') . ';margin:0;padding:0;max-width:' . $size . 'px;max-height:' . $size . 'px;background:transparent;border:none;border-radius:0;box-shadow:none} #phpbb_login_logout .inputbox{padding:2px} #phpbb_login_logout .reg_button{float:right} #phpbb_login_logout .reg_button a{font-size:1.1em;font-weight:bold;text-decoration:none} #phpbb_integrate_wp{display:block;margin-bottom:5px;font-size:1.1em} </style>'; } echo $before_widget . '<div id="phpbb_login_logout">'; if (is_user_logged_in()) { if ($avatar_src) { $avatar = phpbb_avatar($dduser->data['user_avatar'],$dduser->data['user_avatar_type'],$dduser->data['user_avatar_width'],$dduser->data['user_avatar_height']); } else { $avatar = preg_replace('`class=(\'|").*?(\'|")`i', 'class="ddavatar"', get_avatar($current_user->ID, $size)); } echo $avatar . ' <div class="bridgedd-user"> <div class="phpbb-user"><a href="' . $phpbb_url . 'memberlist.php?mode=viewprofile&u=' . $dduser->data['user_id'] . '">' . $current_user->display_name . '</a></div>'; echo "<a href='{$phpbb_url}ucp.php?mode=logout&sid={$dduser->session_id}&redirect=" . esc_url(get_option('home')) . "'>" . __('Log out') . '</a>'; echo ((current_user_can('edit_posts')) ? '<br /><a href="' . admin_url() . '">' . DASHBOARD_NAME . '</a>' : '') . ' </div><div style="clear:both"></div>'; } else { if ($integrate_wp) { echo '<a id="phpbb_integrate_wp" href="' . site_url() . '/?integrate=wp">' . __('Integrate My Account', 'bridgedd') . '</a>'; } echo '<form action="' . $phpbb_url . 'ucp.php?mode=login" method="post"> <label for="username">' . __('Username') . '</label><input type="text" tabindex="1" name="username" id="username" class="inputbox" value="" size="24" /><br /> <div style="margin:2px 0 4px"><input type="checkbox" name="autologin" id="autologin" style="vertical-align:top" /><label for="rememberme"> ' . __('Remember me') . '</label></div> <label for="user_pass">' . __('Password') . '</label><input type="password" tabindex="2" name="password" id="password" class="inputbox" value="" size="24" /><br /> <div style="padding-bottom:10px"><a href="' . $phpbb_url . 'ucp.php?mode=sendpassword">' . __('Forgot Password?') . '</a></div> <span class="reg_button">'; if ($bridgedd_config['reg_app'] == 'phpbb') { echo '<a href="' . $phpbb_url . 'ucp.php?mode=register">' . __('Register') . '</a>'; } else { wp_register('',''); } echo '</span> <input type="submit" tabindex="3" name="login" value="' . __('Login') . '" /> <input type="hidden" name="bridgedd" value="' . get_option('home') . '" /> </form>'; } echo '</div>' . $after_widget; } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['css'] = (int) $new_instance['css']; $instance['loc'] = (int) $new_instance['loc']; $instance['size'] = (int) strip_tags(stripslashes($new_instance['size'])); $instance['size'] = ($instance['size'] < 48 ) ? 48 : $instance['size']; $instance['size'] = ($instance['size'] > 96 ) ? 96 : $instance['size']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'css' => 1, 'loc' => 1, 'size' => 60, )); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = strip_tags($instance['size']); ?> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <div id="require_css"<?php if (!$css) {echo ' style="display:none"';} ?>> <p><label for="<?php echo $this->get_field_id('size'); ?>"><?php echo __('CSS avatar size (48-96 pixels):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('size'); ?>" type="text" value="<?php echo esc_attr($size); ?>" size="2" maxlength="2" /></label></p> <p><label for="<?php echo $this->get_field_id('loc'); ?>"><?php echo __('CSS avatar location:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="1"<?php echo (($loc == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Left'); ?> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="0"<?php echo (($loc == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('Right'); ?> </strong></label></p> </div> <?php } } function bridgedd_widgets_setup() { global $phpbb_path; if ($phpbb_path) { register_widget('bridgedd_widget_recent_topics'); register_widget('bridgedd_widget_login_logout'); register_widget('bridgedd_widget_phpbb_login_logout'); } } add_action('widgets_init', 'bridgedd_widgets_setup'); ?>
Did this file decode correctly?
Original Code
<?php
/*
BridgeDD Widgets
Copyright 2015 by Dion Designs.
All Rights Reserved.
*/
if (!defined('BRIDGEDD')) { exit; } class bridgedd_widget_recent_topics extends WP_Widget { public function __construct() { $widget_ops = array('classname' => 'bridgedd_recent_topics', 'description' => __('Shows the most recent topics on your phpBB board', 'bridgedd') ); parent::__construct('bridgedd_widget_recent_topics', __('Recent Board Topics', 'bridgedd'), $widget_ops); } function widget($args, $instance) { global $config, $dddb, $phpbb_path, $phpbb_url, $phpEx, $user_forums, $guest_forums, $wflag; extract($args); $title = empty($instance['title']) ? __('Recent Board Topics', 'bridgedd') : apply_filters('widget_title', $instance['title']); $css = (int) $instance['css']; $limit = (int) $instance['max']; $old_tz = date_default_timezone_get(); if ($tz = get_option('timezone_string')) { $dformat = get_option('date_format'); $tformat = get_option('time_format'); date_default_timezone_set($tz); } else { $format = get_option('date_format') . ' ' . get_option('time_format'); $offset = get_option('gmt_offset') * 3600; } if ($css) { echo '<style scoped> #recent_board_topics .ddrow{padding-bottom:0.75em;font-size:1em;line-height:1.3em} </style>'; } echo $before_widget; echo $before_title . $title . $after_title . '<ul id="recent_board_topics">'; $sql = 'SELECT u.username, u.user_colour, t.topic_id, t.topic_last_post_id, t.topic_last_poster_id, t.topic_last_post_time, t.topic_title, xp.wp_id FROM ' . USERS_TABLE . ' u, ' . TOPICS_TABLE . ' t LEFT JOIN bridgedd_xpost xp ON (xp.topic_id = t.topic_id) WHERE ' . $dddb->sql_in_set('t.forum_id', ((!empty($wflag)) ? $guest_forums : $user_forums)) . ' AND t.topic_last_poster_id = u.user_id ORDER BY t.topic_last_post_time DESC LIMIT 0,' . strval($limit + 5); $ctime = (RECENT_TOPICS_CACHE_TIME > 1800) ? 1800 : RECENT_TOPICS_CACHE_TIME; $ctime = ($ctime < 60) ? 60 : $ctime; if (!empty($wflag)) { $result = $dddb->sql_query($sql); } else { $result = $dddb->sql_query($sql, $ctime); } $wflag = false; $count = 0; while ($row = $dddb->sql_fetchrow($result)) { if ($count == $limit) { break; } if (empty($row['wp_id'])) { $date = ($tz) ? (date_i18n($dformat, $row['topic_last_post_time']) . ' ' . @date($tformat, $row['topic_last_post_time'])) : @date($format, ($row['topic_last_post_time'] + $offset)); $username = ($row['user_colour']) ? '<span style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</span>' : $row['username'] ; if (defined('RECENT_TOPICS_NOAUTHOR')) { echo '<li class="ddrow bddw-title"> <a href="' . $phpbb_url . 'viewtopic.php?p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '">' . $row['topic_title'] . '</a> </li>'; } else { echo '<li class="ddrow"> <div class="bddw-title"><a href="' . $phpbb_url . 'viewtopic.php?p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '">' . $row['topic_title'] . '</a></div> <div class="bddw-author">' . __('by', 'bridgedd') . ' ' . $username . ', ' . $date . '</div> </li>'; } $count++; } } $dddb->sql_freeresult($result); if (!$count) { echo '<li class="ddrow"><h2>' . __('No Recent Posts', 'bridgedd') . '</h2></li>'; } echo '</ul>' . $after_widget; date_default_timezone_set($old_tz); } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags(stripslashes($new_instance['title'])); $instance['css'] = (int) $new_instance['css']; $instance['max'] = (int) strip_tags(stripslashes($new_instance['max'])); $instance['max'] = ($instance['max'] < 3 ) ? 3 : $instance['max']; $instance['max'] = ($instance['max'] > 10 ) ? 10 : $instance['max']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'title' => '', 'css' => 1, 'max' => 5, )); $title = strip_tags($instance['title']); $css = (int) $instance['css']; $max = (int) $instance['max']; ?> <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php echo __('Title:'); ?> <input name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <p><label for="<?php echo $this->get_field_id('max'); ?>"><?php echo __('Number of recent topics (3-10):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('max'); ?>" type="text" value="<?php echo esc_attr($max); ?>" size="2" maxlength="2" /></label></p> <?php } } class bridgedd_widget_login_logout extends WP_Widget { public function __construct() { $widget_ops = array('classname' => 'bridgedd_login_logout', 'description' => __('Login/Logout', 'bridgedd') ); parent::__construct('bridgedd_widget_login_logout', __('Login/Logout', 'bridgedd'), $widget_ops); } function widget($args, $instance) { global $current_user, $dduser, $integrate_wp, $phpbb_path, $phpbb_root_path, $phpbb_url, $bridgedd_config; extract($args); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = (int) $instance['size']; $avatar_src = ($bridgedd_config[avatar_src] == 'phpbb') ? true : false; if ($css) { echo '<style scoped> #login_logout{margin-top:1em;font-size:1em;line-height:' . ($size / ((current_user_can('edit_posts')) ? 3 : 2)) . 'px} .bridgedd-user{margin-' . (($loc) ? 'left' : 'right') . ':' . ($size + 10) . 'px} .phpbb-user{font-size:1.2em;font-weight:bold} #login_logout img.ddavatar{float:' . (($loc) ? 'left' : 'right') . ';margin:0;padding:0;max-width:' . $size . 'px;max-height:' . $size . 'px;background:transparent;border:none;border-radius:0;box-shadow:none} #login_logout .inputbox{padding:2px} #login_logout .reg_button{float:right} #login_logout .reg_button a{font-size:1.1em;font-weight:bold;text-decoration:none} #integrate_wp{display:block;margin-bottom:5px;font-size:1.1em} </style>'; } echo $before_widget . '<div id="login_logout">'; if (is_user_logged_in()) { if ($avatar_src) { $avatar = phpbb_avatar($dduser->data['user_avatar'],$dduser->data['user_avatar_type'],$dduser->data['user_avatar_width'],$dduser->data['user_avatar_height']); } else { $avatar = preg_replace('`class=(\'|").*?(\'|")`i', 'class="ddavatar"', get_avatar($current_user->ID, $size)); } echo $avatar . ' <div class="bridgedd-user"> <div class="phpbb-user"><a href="' . $phpbb_url . 'memberlist.php?mode=viewprofile&u=' . $dduser->data['user_id'] . '">' . $current_user->display_name . '</a></div>' . wp_loginout(site_url(), false) . ((current_user_can('edit_posts')) ? '<br /><a href="' . admin_url() . '">' . DASHBOARD_NAME . '</a>' : '') . ' </div><div style="clear:both"></div>'; } else { if ($integrate_wp) { echo '<a id="integrate_wp" href="' . site_url() . '/?integrate=wp">' . __('Integrate My Account', 'bridgedd') . '</a>'; } echo '<form name="loginform" id="loginform" action="' . esc_url(site_url('wp-login.php', 'login_post' )) . '" method="post"> <label for="user_login">' . __('Username') . '</label><input type="text" tabindex="1" name="log" id="user_login" class="inputbox" value="" size="24" /><br /> <div style="margin:2px 0 4px"><input type="checkbox" name="rememberme" id="rememberme" style="vertical-align:top" value="forever" /><label for="rememberme"> ' . __('Remember Me') . '</label></div> <label for="user_pass">' . __('Password') . '</label><input type="password" tabindex="2" name="pwd" id="user_pass" class="inputbox" value="" size="24" /><br /> <div style="padding-bottom:10px"><a href="' . esc_url(wp_lostpassword_url()) . '">' . __('Lost your password?') . '</a></div> <span class="reg_button">'; if ($bridgedd_config['reg_app'] == 'phpbb') { echo '<a href="' . $phpbb_url . 'ucp.php?mode=register">' . __('Register') . '</a>'; } else { wp_register('',''); } echo '</span> <input type="submit" tabindex="3" name="wp-submit" id="wp-submit" value="' . __('Log in') . '" /> <input type="hidden" name="redirect_to" value="' . esc_url('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']) . '" /> </form>'; } echo '</div>' . $after_widget; } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['css'] = (int) $new_instance['css']; $instance['loc'] = (int) $new_instance['loc']; $instance['size'] = (int) strip_tags(stripslashes($new_instance['size'])); $instance['size'] = ($instance['size'] < 48 ) ? 48 : $instance['size']; $instance['size'] = ($instance['size'] > 96 ) ? 96 : $instance['size']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'css' => 1, 'loc' => 1, 'size' => 60, )); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = strip_tags($instance['size']); ?> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <div id="require_css"<?php if (!$css) {echo ' style="display:none"';} ?>> <p><label for="<?php echo $this->get_field_id('size'); ?>"><?php echo __('CSS avatar size (48-96 pixels):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('size'); ?>" type="text" value="<?php echo esc_attr($size); ?>" size="2" maxlength="2" /></label></p> <p><label for="<?php echo $this->get_field_id('loc'); ?>"><?php echo __('CSS avatar location:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="1"<?php echo (($loc == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Left'); ?> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="0"<?php echo (($loc == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('Right'); ?> </strong></label></p> </div> <?php } } class bridgedd_widget_phpbb_login_logout extends WP_Widget { public function __construct() { $name = 'phpBB ' . __('Login/Logout', 'bridgedd'); $widget_ops = array( 'classname' => 'bridgedd_login_logout', 'description' => $name, ); parent::__construct('bridgedd_widget_phpbb_login_logout', $name, $widget_ops); } function widget($args, $instance) { global $current_user, $dduser, $integrate_wp, $phpbb_path, $phpbb_root_path, $phpbb_url, $bridgedd_config; extract($args); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = (int) $instance['size']; $avatar_src = ($bridgedd_config[avatar_src] == 'phpbb') ? true : false; if ($css) { echo '<style scoped> #phpbb_login_logout{margin-top:1em;font-size:1em;line-height:' . ($size / ((current_user_can('edit_posts')) ? 3 : 2)) . 'px} .bridgedd-user{margin-' . (($loc) ? 'left' : 'right') . ':' . ($size + 10) . 'px} .phpbb-user{font-size:1.2em;font-weight:bold} #phpbb_login_logout img.ddavatar{float:' . (($loc) ? 'left' : 'right') . ';margin:0;padding:0;max-width:' . $size . 'px;max-height:' . $size . 'px;background:transparent;border:none;border-radius:0;box-shadow:none} #phpbb_login_logout .inputbox{padding:2px} #phpbb_login_logout .reg_button{float:right} #phpbb_login_logout .reg_button a{font-size:1.1em;font-weight:bold;text-decoration:none} #phpbb_integrate_wp{display:block;margin-bottom:5px;font-size:1.1em} </style>'; } echo $before_widget . '<div id="phpbb_login_logout">'; if (is_user_logged_in()) { if ($avatar_src) { $avatar = phpbb_avatar($dduser->data['user_avatar'],$dduser->data['user_avatar_type'],$dduser->data['user_avatar_width'],$dduser->data['user_avatar_height']); } else { $avatar = preg_replace('`class=(\'|").*?(\'|")`i', 'class="ddavatar"', get_avatar($current_user->ID, $size)); } echo $avatar . ' <div class="bridgedd-user"> <div class="phpbb-user"><a href="' . $phpbb_url . 'memberlist.php?mode=viewprofile&u=' . $dduser->data['user_id'] . '">' . $current_user->display_name . '</a></div>'; echo "<a href='{$phpbb_url}ucp.php?mode=logout&sid={$dduser->session_id}&redirect=" . esc_url(get_option('home')) . "'>" . __('Log out') . '</a>'; echo ((current_user_can('edit_posts')) ? '<br /><a href="' . admin_url() . '">' . DASHBOARD_NAME . '</a>' : '') . ' </div><div style="clear:both"></div>'; } else { if ($integrate_wp) { echo '<a id="phpbb_integrate_wp" href="' . site_url() . '/?integrate=wp">' . __('Integrate My Account', 'bridgedd') . '</a>'; } echo '<form action="' . $phpbb_url . 'ucp.php?mode=login" method="post"> <label for="username">' . __('Username') . '</label><input type="text" tabindex="1" name="username" id="username" class="inputbox" value="" size="24" /><br /> <div style="margin:2px 0 4px"><input type="checkbox" name="autologin" id="autologin" style="vertical-align:top" /><label for="rememberme"> ' . __('Remember me') . '</label></div> <label for="user_pass">' . __('Password') . '</label><input type="password" tabindex="2" name="password" id="password" class="inputbox" value="" size="24" /><br /> <div style="padding-bottom:10px"><a href="' . $phpbb_url . 'ucp.php?mode=sendpassword">' . __('Forgot Password?') . '</a></div> <span class="reg_button">'; if ($bridgedd_config['reg_app'] == 'phpbb') { echo '<a href="' . $phpbb_url . 'ucp.php?mode=register">' . __('Register') . '</a>'; } else { wp_register('',''); } echo '</span> <input type="submit" tabindex="3" name="login" value="' . __('Login') . '" /> <input type="hidden" name="bridgedd" value="' . get_option('home') . '" /> </form>'; } echo '</div>' . $after_widget; } public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['css'] = (int) $new_instance['css']; $instance['loc'] = (int) $new_instance['loc']; $instance['size'] = (int) strip_tags(stripslashes($new_instance['size'])); $instance['size'] = ($instance['size'] < 48 ) ? 48 : $instance['size']; $instance['size'] = ($instance['size'] > 96 ) ? 96 : $instance['size']; return $instance; } public function form($instance) { $instance = wp_parse_args((array) $instance, array( 'css' => 1, 'loc' => 1, 'size' => 60, )); $css = (int) $instance['css']; $loc = (int) $instance['loc']; $size = strip_tags($instance['size']); ?> <p><label for="<?php echo $this->get_field_id('css'); ?>"><?php echo __('Use internal widget CSS:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="1"<?php echo (($css == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Yes'); ?> <input name="<?php echo $this->get_field_name('css'); ?>" type="radio" value="0"<?php echo (($css == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('No'); ?> </strong></label></p> <div id="require_css"<?php if (!$css) {echo ' style="display:none"';} ?>> <p><label for="<?php echo $this->get_field_id('size'); ?>"><?php echo __('CSS avatar size (48-96 pixels):', 'bridgedd') ?> <input name="<?php echo $this->get_field_name('size'); ?>" type="text" value="<?php echo esc_attr($size); ?>" size="2" maxlength="2" /></label></p> <p><label for="<?php echo $this->get_field_id('loc'); ?>"><?php echo __('CSS avatar location:', 'bridgedd') ?> <strong> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="1"<?php echo (($loc == 1) ? ' checked="checked"' : ''); ?> /><?php echo __('Left'); ?> <input name="<?php echo $this->get_field_name('loc'); ?>" type="radio" value="0"<?php echo (($loc == 0) ? ' checked="checked"' : ''); ?> /><?php echo __('Right'); ?> </strong></label></p> </div> <?php } } function bridgedd_widgets_setup() { global $phpbb_path; if ($phpbb_path) { register_widget('bridgedd_widget_recent_topics'); register_widget('bridgedd_widget_login_logout'); register_widget('bridgedd_widget_phpbb_login_logout'); } } add_action('widgets_init', 'bridgedd_widgets_setup');
Function Calls
| defined | 1 |
Stats
| MD5 | 6f90765890c8f82a39bea9ddd8230901 |
| Eval Count | 0 |
| Decode Time | 121 ms |