Changeset 2745551
- Timestamp:
- 06/20/2022 09:42:04 PM (4 years ago)
- Location:
- sharebar
- Files:
-
- 44 added
- 3 edited
-
tags/1.4.2 (added)
-
tags/1.4.2/css (added)
-
tags/1.4.2/css/colorpicker.css (added)
-
tags/1.4.2/css/sharebar.css (added)
-
tags/1.4.2/images (added)
-
tags/1.4.2/images/blank.gif (added)
-
tags/1.4.2/images/colorpicker_background.png (added)
-
tags/1.4.2/images/colorpicker_hex.png (added)
-
tags/1.4.2/images/colorpicker_hsb_b.png (added)
-
tags/1.4.2/images/colorpicker_hsb_h.png (added)
-
tags/1.4.2/images/colorpicker_hsb_s.png (added)
-
tags/1.4.2/images/colorpicker_indic.gif (added)
-
tags/1.4.2/images/colorpicker_overlay.png (added)
-
tags/1.4.2/images/colorpicker_rgb_b.png (added)
-
tags/1.4.2/images/colorpicker_rgb_g.png (added)
-
tags/1.4.2/images/colorpicker_rgb_r.png (added)
-
tags/1.4.2/images/colorpicker_select.gif (added)
-
tags/1.4.2/images/colorpicker_submit.png (added)
-
tags/1.4.2/images/custom_background.png (added)
-
tags/1.4.2/images/custom_hex.png (added)
-
tags/1.4.2/images/custom_hsb_b.png (added)
-
tags/1.4.2/images/custom_hsb_h.png (added)
-
tags/1.4.2/images/custom_hsb_s.png (added)
-
tags/1.4.2/images/custom_indic.gif (added)
-
tags/1.4.2/images/custom_rgb_b.png (added)
-
tags/1.4.2/images/custom_rgb_g.png (added)
-
tags/1.4.2/images/custom_rgb_r.png (added)
-
tags/1.4.2/images/custom_submit.png (added)
-
tags/1.4.2/images/down.gif (added)
-
tags/1.4.2/images/select.png (added)
-
tags/1.4.2/images/select2.png (added)
-
tags/1.4.2/images/slider.png (added)
-
tags/1.4.2/images/up.gif (added)
-
tags/1.4.2/js (added)
-
tags/1.4.2/js/colorpicker.js (added)
-
tags/1.4.2/js/sharebar-admin.js (added)
-
tags/1.4.2/js/sharebar.js (added)
-
tags/1.4.2/readme.txt (added)
-
tags/1.4.2/screenshot-1.gif (added)
-
tags/1.4.2/screenshot-2.gif (added)
-
tags/1.4.2/screenshot-3.gif (added)
-
tags/1.4.2/screenshot-4.gif (added)
-
tags/1.4.2/sharebar-admin.php (added)
-
tags/1.4.2/sharebar.php (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sharebar-admin.php (modified) (12 diffs)
-
trunk/sharebar.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sharebar/trunk/readme.txt
r2045495 r2745551 3 3 Tags: sharing, social networks, marketing, social media, sharebar, sharebox, sharethis, facebook share, twitter, pinterest, reddit, stumbleupon, social buttons, marketing 4 4 Requires at least: 2.0 5 Tested up to: 5.16 Stable tag: 1.4. 15 Tested up to: 6.0 6 Stable tag: 1.4.2 7 7 8 8 Sharebar adds a dynamic and fully customizable vertical box to the left of a blog post that contains links/buttons to popular social networking sites. … … 61 61 62 62 == Changelog == 63 = 1.4.2 = 64 * Add CSRF protection to admin forms. 65 * Fix misc PHP notices. 66 63 67 = 1.4.1 = 64 68 * Use enqueue_scripts for frontend CSS. -
sharebar/trunk/sharebar-admin.php
r1164351 r2745551 20 20 exit(); 21 21 } 22 $id = sanitize($_GET['id'] ? $_GET['id'] : $_POST['id']); 23 $pos = sanitize($_GET['pos'] ? $_GET['pos'] : $_POST['pos']); 24 $status = sanitize($_GET['status'] ? $_GET['status'] : $_POST['status']); 25 $task = sanitize($_GET['t'] ? $_GET['t'] : $_POST['t']); 26 $do = sanitize($_POST['do']); 22 23 $id = sanitize(isset($_REQUEST['id']) ? $_REQUEST['id'] : null); 24 $pos = sanitize(isset($_REQUEST['pos']) ? $_REQUEST['pos'] : null); 25 $status = sanitize(isset($_REQUEST['status']) ? $_REQUEST['status'] : null); 26 $task = sanitize(isset($_REQUEST['t']) ? $_REQUEST['t'] : null); 27 $do = sanitize(isset($_REQUEST['do']) ? $_REQUEST['do'] : null); 27 28 28 29 if($id) $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE id=%d", $id)); 29 30 30 if($do == 'update') $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."sharebar SET enabled='%d', position='%d', name='%s', big='". $_POST['big'] ."', small='". $_POST['small'] ."' WHERE id='%d'", sanitize($_POST['enabled']), sanitize($_POST['position']), sanitize($_POST['name']), $id)); 31 elseif($do == 'add') $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."sharebar (position, name, big, small) VALUES('%d','%s', '". $_POST['big'] ."', '". $_POST['small'] ."')", sanitize($_POST['position']), sanitize($_POST['name']))); 32 elseif($do == 'delete') $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->prefix."sharebar WHERE id=%d LIMIT 1", $id)); 33 elseif($do == 'reset') sharebar_reset(); 31 if($do == 'update') { 32 check_admin_referer( 'wp_sharebar_add_update' ); 33 $wpdb->query($wpdb->prepare("UPDATE ".$wpdb->prefix."sharebar SET enabled='%d', position='%d', name='%s', big='%s', small='%s' WHERE id='%d'", sanitize($_POST['enabled']), sanitize($_POST['position']), $_POST['name'], $_POST['big'], $_POST['small'], $id)); 34 } 35 elseif($do == 'add') { 36 check_admin_referer( 'wp_sharebar_add_update' ); 37 $wpdb->query($wpdb->prepare("INSERT INTO ".$wpdb->prefix."sharebar (position, name, big, small) VALUES('%d','%s', '%s', '%s')", sanitize($_POST['position']), $_POST['name'], $_POST['big'], $_POST['small'])); 38 } 39 elseif($do == 'delete') { 40 check_admin_referer( 'wp_sharebar_delete' ); 41 $wpdb->query($wpdb->prepare("DELETE FROM ".$wpdb->prefix."sharebar WHERE id=%d LIMIT 1", $id)); 42 } 43 elseif($do == 'reset') { 44 check_admin_referer( 'wp_sharebar_reset' ); 45 sharebar_reset(); 46 } 34 47 elseif($do == 'settings'){ 48 check_admin_referer( 'wp_sharebar_settings' ); 35 49 $binaries = array("auto_posts","auto_pages","horizontal","credit"); 36 foreach($binaries as $binary) $_POST[$binary] = $_POST[$binary]? 1:0;50 foreach($binaries as $binary) $_POST[$binary] = isset($_POST[$binary]) ? 1:0; 37 51 $_POST['width'] = $_POST['width'] ? $_POST['width']:1000; 38 52 sharebar_settings($_POST); 39 53 foreach($sharebar_options as $option) $$option = get_option('sharebar_'.$option); 40 54 }elseif($do == 'update-all'){ 55 check_admin_referer( 'wp_sharebar_update_all' ); 41 56 $buttons = $_POST['buttons']; 42 57 $uptask = $_POST['update-task']; … … 132 147 if($task == 'edit'){ 133 148 echo '<table class="thebutton">'; 134 echo "<tr><th class='name'><strong>". $item->name.":</strong></th></tr>";135 echo "<tr><td>". $item->big."</td>";136 echo "<td>". $item->small."</td></tr>";149 echo "<tr><th class='name'><strong>".esc_html($item->name).":</strong></th></tr>"; 150 echo "<tr><td>".($item->big)."</td>"; 151 echo "<td>".($item->small)."</td></tr>"; 137 152 echo '</table>'; 138 153 } 139 if( $item->enabled) $enabled = " checked='true'";154 if(isset($item) && $item->enabled) $enabled = " checked='true'"; 140 155 ?> 141 156 <form action="?page=<?php echo $_GET['page']; ?>" method="post"> 157 <?php wp_nonce_field( 'wp_sharebar_add_update' ); ?> 142 158 <p class="mediumtext alignleft"> 143 159 <label for="name" class="wide">Name:</label> 144 <input type="text" name="name" id="name" value="<?php echo $item->name; ?>" class="mediumtext" />160 <input type="text" name="name" id="name" value="<?php echo isset($item) ? esc_attr($item->name) : ''; ?>" class="mediumtext" /> 145 161 </p> 146 162 <p class="smalltext alignleft"> 147 163 <label for="position" class="wide">Position:</label> 148 <input type=" text" name="position" id="position" value="<?php echo $item->position; ?>" class="smalltext" />164 <input type="number" name="position" min="0" id="position" value="<?php echo isset($item) ? esc_attr($item->position) : ''; ?>" class="smalltext" /> 149 165 </p> 150 166 <p class="checkfield alignleft"> … … 155 171 <p> 156 172 <label for="big" class="wide">Big Button:</label> 157 <textarea name="big" id="big" class="text" rows=5><?php echo $item->big; ?></textarea>173 <textarea name="big" id="big" class="text" rows=5><?php echo isset($item) ? esc_attr($item->big) : ''; ?></textarea> 158 174 </p> 159 175 <p> 160 176 <label for="small" class="wide">Small Button:</label> 161 <textarea name="small" id="small" class="text" rows=5><?php echo $item->small; ?></textarea>177 <textarea name="small" id="small" class="text" rows=5><?php echo isset($item) ? esc_attr($item->small) : ''; ?></textarea> 162 178 </p> 163 179 <input type="hidden" name="do" value="<?php if($task == 'edit') echo "update"; else echo "add"; ?>" /> 164 <input type="hidden" name="id" value="<?php echo $item->id; ?>" />180 <input type="hidden" name="id" value="<?php echo esc_attr($item->id); ?>" /> 165 181 <input type="hidden" name="status" value="Share button has been <?php if($task == 'edit') echo "updated"; else echo "added"; ?>." /> 166 182 <input type="submit" value="<?php if($task == 'edit') echo "Update Button"; else echo "Add Button"; ?>" class="alignleft button-primary" /> … … 173 189 <?php 174 190 echo '<table class="thebutton">'; 175 echo "<tr><th class='name'><strong>". $item->name.":</strong></th></tr>";191 echo "<tr><th class='name'><strong>".esc_html($item->name).":</strong></th></tr>"; 176 192 echo "<tr><td>".$item->big."</td>"; 177 193 echo "<td>".$item->small."</td></tr>"; … … 179 195 ?> 180 196 <p>Are you sure you want to delete this button?</p> 181 <form action="?page=<?php echo $_GET['page']; ?>" method="post"> 197 <form action="?page=<?php echo esc_attr($_GET['page']); ?>" method="post"> 198 <?php wp_nonce_field( 'wp_sharebar_delete' ); ?> 182 199 <input type="hidden" name="do" value="delete" /> 183 <input type="hidden" name="id" value="<?php echo $item->id; ?>" />200 <input type="hidden" name="id" value="<?php echo esc_attr($item->id); ?>" /> 184 201 <input type="hidden" name="status" value="Button has been deleted." /> 185 202 <input type="submit" value="Delete" class="alignleft button-primary" /> 186 203 </form> 187 <a href="?page=<?php echo $_GET['page']; ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a>204 <a href="?page=<?php echo esc_attr($_GET['page']); ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a> 188 205 189 206 <?php }elseif($task == 'reset'){ ?> … … 192 209 <p>Are you sure you want to reset <strong>ALL</strong> share buttons? This cannot be undone and you will lose any customizations - all buttons will be reset to defaults.</p> 193 210 <form action="?page=<?php echo $_GET['page']; ?>" method="post"> 211 <?php wp_nonce_field( 'wp_sharebar_reset' ); ?> 194 212 <input type="hidden" name="do" value="reset" /> 195 213 <input type="hidden" name="status" value="All buttons have been reset to inital configuration." /> 196 214 <input type="submit" value="Reset ALL Buttons" class="alignleft button-primary" /> 197 215 </form> 198 <a href="?page=<?php echo $_GET['page']; ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a>216 <a href="?page=<?php echo esc_attr($_GET['page']); ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a> 199 217 200 218 <?php }elseif($task == 'settings'){ ?> … … 202 220 <h3>Sharebar Settings</h3> 203 221 <form action="?page=<?php echo $_GET['page']; ?>&t=settings" method="post"> 222 <?php wp_nonce_field( 'wp_sharebar_settings' ); ?> 204 223 <h4>Add Sharebar</h4> 205 224 <p>The following settings allow you to automatically add the Sharebars to your posts and pages. If you would like to add them manually, make sure that both are unchecked and paste the PHP code into your template instead.</p> … … 225 244 </p> 226 245 <p> 227 <input type="text" name="leftoffset" id="leftoffset" class="minitext" value="<?php echo $leftoffset; ?>" /><label for="leftoffset">Left Offset (used when positioned to left)</label>228 </p> 229 <p> 230 <input type="text" name="rightoffset" id="rightoffset" class="minitext" value="<?php echo $rightoffset; ?>" /><label for="rightoffset">Right Offset (used when positioned to right)</label>246 <input type="text" name="leftoffset" id="leftoffset" class="minitext" value="<?php echo esc_attr($leftoffset); ?>" /><label for="leftoffset">Left Offset (used when positioned to left)</label> 247 </p> 248 <p> 249 <input type="text" name="rightoffset" id="rightoffset" class="minitext" value="<?php echo esc_attr($rightoffset); ?>" /><label for="rightoffset">Right Offset (used when positioned to right)</label> 231 250 </p> 232 251 <p> … … 244 263 <p> 245 264 <label for="twitter_username">Sharebar Background Color:</label> 246 <input type="text" name="sbg" id="sbg" class="smalltext" value="<?php echo $sbg; ?>" />265 <input type="text" name="sbg" id="sbg" class="smalltext" value="<?php echo esc_attr($sbg); ?>" /> 247 266 </p> 248 267 <p> 249 268 <label for="twitter_username">Sharebar Border Color:</label> 250 <input type="text" name="sborder" id="sborder" class="smalltext" value="<?php echo $sborder; ?>" />269 <input type="text" name="sborder" id="sborder" class="smalltext" value="<?php echo esc_attr($sborder); ?>" /> 251 270 </p> 252 271 <br /> … … 255 274 <input type="submit" value="Update Settings" class="alignleft button-primary" /> 256 275 </form> 257 <a href="?page=<?php echo $_GET['page']; ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a>276 <a href="?page=<?php echo esc_attr($_GET['page']); ?>" class="alignleft" style="margin: 2px 0 0 10px;">Cancel</a> 258 277 259 278 <?php }elseif($task == 'donate'){ ?> … … 318 337 319 338 <form action="?page=<?php echo $_GET['page']; ?>" method="post"> 339 <?php wp_nonce_field( 'wp_sharebar_update_all' ); ?> 320 340 <table id="sharebar-tl"> 321 341 <thead><tr><th><a href="/" class="toggle-all">All</a></th><th class='leftj'>Name</th><th>Position</th><th>Big Button</th><th>Small Button</th><th>Actions</th></tr></thead> … … 330 350 $name = $result->name; 331 351 } 332 echo "\t\t<tr$dis><td><input type='checkbox' name='buttons[]' id='buttons' value='".$result->id."' class='checkbox c23' /></td><td class='leftj'>".$name."</td><td>".$result->position."<a href='?page=Sharebar&pos=moveup&id=".$result->id."'><img src='" . plugins_url() ."/sharebar/images/up.gif'/></a><a href='?page=Sharebar&pos=movedown&id=".$result->id."'><img src='" . plugins_url() ."/sharebar/images/down.gif'/></a></td><td>".$result->big."</td><td>".$result->small."</td><td><a href='?page=". $_GET['page']."&t=edit&id=".$result->id."'>Edit</a> | <a href='?page=".$_GET['page']."&t=delete&id=".$result->id."'>Delete</a></td></tr>\n";352 echo "\t\t<tr$dis><td><input type='checkbox' name='buttons[]' id='buttons' value='".$result->id."' class='checkbox c23' /></td><td class='leftj'>".$name."</td><td>".$result->position."<a href='?page=Sharebar&pos=moveup&id=".$result->id."'><img src='" . plugins_url() ."/sharebar/images/up.gif'/></a><a href='?page=Sharebar&pos=movedown&id=".$result->id."'><img src='" . plugins_url() ."/sharebar/images/down.gif'/></a></td><td>".$result->big."</td><td>".$result->small."</td><td><a href='?page=".esc_attr($_GET['page'])."&t=edit&id=".esc_attr($result->id)."'>Edit</a> | <a href='?page=".esc_attr($_GET['page'])."&t=delete&id=".esc_attr($result->id)."'>Delete</a></td></tr>\n"; 333 353 } ?> 334 354 </tbody> -
sharebar/trunk/sharebar.php
r1629553 r2745551 4 4 Plugin URI: http://devgrow.com/sharebar-wordpress-plugin/ 5 5 Description: Adds a dynamic bar with sharing icons (Facebook, Twitter, etc.) that changes based on browser size and page location. 6 Version: 1.4. 16 Version: 1.4.2 7 7 Author: Monji Dolon 8 8 Author URI: http://mdolon.com/ … … 115 115 $credit = get_option('sharebar_credit'); 116 116 $str = '<ul id="sharebar" style="background:#'.$sbg.';border-color:#'.$sborder.';">'; 117 $results = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE enabled=1 ORDER BY position, id ASC", null)); $str .= "\n";117 $results = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."sharebar WHERE enabled=1 ORDER BY position, id ASC"); $str .= "\n"; 118 118 foreach($results as $result){ $str .= '<li>'.sharebar_filter($result->big).'</li>'; } 119 119 if($credit) $str .= '<li class="credit"><a rel="nofollow" href="http://sumo.com/" target="_blank">Sumo</a></li>'; … … 127 127 global $wpdb; 128 128 $str = '<ul id="sharebarx">'; 129 $results = $wpdb->get_results( $wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE enabled=1 ORDER BY position, id ASC", null)); $str .= "\n";129 $results = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."sharebar WHERE enabled=1 ORDER BY position, id ASC"); $str .= "\n"; 130 130 foreach($results as $result) { $str .= '<li>'.sharebar_filter($result->small).'</li>'; } 131 131 $str .= '</ul>'; … … 136 136 function sharebar_button($name, $size = 'big'){ 137 137 global $wpdb; 138 $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE name=' $name'"));138 $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM ".$wpdb->prefix."sharebar WHERE name='%s'", $name)); 139 139 if($size == 'big') echo stripslashes($item->big); else echo stripslashes($item->small); 140 140 } … … 173 173 174 174 function sharebar_admin_actions(){ 175 if(current_user_can('manage_options')) add_options_page("Sharebar", "Sharebar", 1, "Sharebar", "sharebar_menu");175 if(current_user_can('manage_options')) add_options_page("Sharebar", "Sharebar", 'manage_options', "Sharebar", "sharebar_menu"); 176 176 } 177 177 … … 247 247 } 248 248 else { 249 /* 249 250 if (get_magic_quotes_gpc()) { 250 251 $input = stripslashes($input); 251 252 } 253 */ 252 254 $input = cleanInput($input); 253 255 $output = esc_sql($input);
Note: See TracChangeset
for help on using the changeset viewer.