@Ghazascanner
_2019runbot
Ghazascanner File Manager
server :Linux phosweb009 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64
Current Path :
/
homepage
/
wordpress
/
wp-content
/
plugins
/
updatednow
/
Path :
Upload File :
New :
File
Dir
//homepage/wordpress/wp-content/plugins/updatednow/update-now.php
<?php /* Plugin Name: Updated Now Banner Version: 2.3 Plugin URI: http://www.koikikukan.com/archives/2007/05/02-003535.php Author: Yujiro Araki Author URI: http://www.koikikukan.com/ Description: Display Latest post using the post information in an easily customizable banner. */ $conf_update_now_design = 'banners/sticker/updated_blue.png'; $conf_update_now_use_style = true; $conf_update_now_use_pngfix = true; $conf_update_now_use_anchor = true; $conf_update_now_display_time = 24; function update_now_init() { global $conf_update_now_use_style, $conf_update_now_use_pngfix, $conf_update_now_use_anchor, $conf_update_now_display_time, $conf_update_now_design; add_action('admin_menu', 'update_now_config_page'); } add_action('init', 'update_now_init'); function update_now_config_page() { if (function_exists('add_submenu_page')) { add_submenu_page('plugins.php', __('Update Now'), __('Update Now'), 'manage_options', 'updatenow-key-config', 'update_now_conf'); } } function update_now_conf() { global $conf_update_now_use_style, $conf_update_now_use_pngfix, $conf_update_now_use_anchor, $conf_update_now_display_time, $conf_update_now_design; if (isset($_POST['submit'])) { if (function_exists('current_user_can') && !current_user_can('manage_options')) { die(__('Cheatin’ uh?')); } if (isset($_POST['conf_update_now_design'])) { update_option('conf_update_now_design', $_POST['conf_update_now_design']); } else { update_option('conf_update_now_design', 'updated.png'); } if (isset($_POST['conf_update_now_display_time'])) { if ($_POST['conf_update_now_display_time'] == '' || $_POST['conf_update_now_display_time'] == '0') { update_option('conf_update_now_display_time', '24'); } else { update_option('conf_update_now_display_time', $_POST['conf_update_now_display_time']); } } if (isset($_POST['conf_update_now_use_style'])) { update_option('conf_update_now_use_style', 'true'); } else { update_option('conf_update_now_use_style', 'false'); } if (isset($_POST['conf_update_now_use_pngfix'])) { update_option('conf_update_now_use_pngfix', 'true'); } else { update_option('conf_update_now_use_pngfix', 'false'); } if (isset($_POST['conf_update_now_use_anchor'])) { update_option('conf_update_now_use_anchor', 'true'); } else { update_option('conf_update_now_use_anchor', 'false'); } } ?> <?php if (!empty($_POST)) { ?> <div id="message" class="updated fade"><p><strong><?php _e('Options saved.') ?></strong></p></div> <?php } ?> <div class="wrap"> <h2><?php _e('Update Now Configuration'); ?></h2> <div id="selectedBanner" style="float:left"></div> <div class="narrow"> <form action="" method="post" id="update-now-conf" style="margin: auto; width: 400px; "> <p><label>Design: <select id="conf_update_now_design" name="conf_update_now_design" onchange="selectUpdateNowBanner(this.value);return false;"> <option value="banners/sticker/updated_blue.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_blue.png') echo ' selected="selected" '; ?>>sticker - blue</option> <option value="banners/sticker/updated_green.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_green.png') echo ' selected="selected" '; ?>>sticker - green</option> <option value="banners/sticker/updated_white.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_white.png') echo ' selected="selected" '; ?>>sticker - white</option> <option value="banners/sticker/updated_red.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_red.png') echo ' selected="selected" '; ?>>sticker - red</option> <option value="banners/sticker/updated_pink.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_pink.png') echo ' selected="selected" '; ?>>sticker - pink</option> <option value="banners/sticker/updated_orange.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_orange.png') echo ' selected="selected" '; ?>>sticker - orange</option> <option value="banners/sticker/updated_brown.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_brown.png') echo ' selected="selected" '; ?>>sticker - brown</option> <option value="banners/sticker/updated_black.png"<?php if (get_option('conf_update_now_design') == 'banners/sticker/updated_black.png') echo ' selected="selected" '; ?>>sticker - black</option> <option value="banners/star/updated_blue.png"<?php if (get_option('conf_update_now_design') == 'banners/star/updated_blue.png') echo ' selected="selected" '; ?>>star - blue</option> <option value="banners/star/updated_green.png"<?php if (get_option('conf_update_now_design') == 'banners/star/updated_green.png') echo ' selected="selected" '; ?>>star - green</option> <option value="banners/star/updated_white.png"<?php if (get_option('conf_update_now_design') == 'banners/star/updated_white.png') echo ' selected="selected" '; ?>>star - white</option> <option value="banners/star/updated_pink.png"<?php if (get_option('conf_update_now_design') == 'banners/star/updated_pink.png') echo ' selected="selected" '; ?>>star - pink</option> <option value="banners/star/updated_orange.png"<?php if (get_option('conf_update_now_design') == 'banners/star/updated_orange.png') echo ' selected="selected" '; ?>>star - orange</option> <option value="updated.png"<?php if (get_option('conf_update_now_design') == 'updated.png') echo ' selected="selected" '; ?>>custom</option> </select> </label></p> <p><label><?php _e('Display the banner for'); ?> <input id="conf_update_now_display_time" name="conf_update_now_display_time" type="text" size="3" maxlength="5" value="<?php if (get_option('conf_update_now_display_time')) { echo get_option('conf_update_now_display_time'); } else { echo $conf_update_now_display_time; } ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> <?php _e('hours.'); ?></label></p> <p><label><input name="conf_update_now_use_anchor" id="conf_update_now_use_anchor" value="true" type="checkbox" <?php if (get_option('conf_update_now_use_anchor')) { if (get_option('conf_update_now_use_anchor') == 'true') echo ' checked="checked" '; } else { echo ' checked="checked" '; } ?> /> <?php _e('Use anchor.'); ?></label></p> <p><label><input name="conf_update_now_use_pngfix" id="conf_update_now_use_pngfix" value="true" type="checkbox" <?php if (get_option('conf_update_now_use_pngfix')) { if (get_option('conf_update_now_use_pngfix') == 'true') echo ' checked="checked" '; } else { echo ' checked="checked" '; } ?> /> <?php _e('Use pngfix.js for IE.'); ?></label></p> <p><label><input name="conf_update_now_use_style" id="conf_update_now_use_style" value="true" type="checkbox" <?php if (get_option('conf_update_now_use_style')) { if (get_option('conf_update_now_use_style') == 'true') echo ' checked="checked" '; } else { echo ' checked="checked" '; } ?> /> <?php _e('Use stylesheet.'); ?></label></p> <p class="submit"><input type="submit" name="submit" value="<?php _e('Update options »'); ?>" /></p> </form> </div> </div> <script type="text/javascript"> function selectUpdateNowBanner(id) { document.getElementById('selectedBanner').innerHTML = '<img src="<?php echo get_option('siteurl') ?>/wp-content/plugins/updatednow/' + id + '">'; } selectUpdateNowBanner('<?php if (get_option('conf_update_now_design')) { echo get_option('conf_update_now_design'); } else { echo 'banners/sticker/updated_blue.png'; } ?> '); </script> <?php } add_action('wp_head', 'ck_wp_head'); add_action('wp_footer', 'ck_wp_footer'); function ck_wp_head () { global $conf_update_now_use_style, $conf_update_now_use_pngfix; if (get_option('conf_update_now_use_style') == 'true') { ?> <style type="text/css"> #updated { z-index: 99; position: absolute; top: 0; left: 0; display: block; height: 120px; width: 120px; } #updated img { border: none; } </style> <?php } if (get_option('conf_update_now_use_pngfix') == 'true') { ?> <!--[if lt IE 7]> <script defer type="text/javascript" src="<?php echo get_option('siteurl') ?>/wp-content/plugins/updatednow/pngfix.js"></script> <![endif]--> <?php } } function get_latest_posted_date() { global $wpdb, $tableposts; $orderby = "$tableposts.post_date"; $now = current_time('mysql'); if (!isset($tableposts)) $tableposts = $wpdb->posts; $sql = "SELECT DISTINCT * FROM $tableposts WHERE $tableposts.post_date <= '$now' AND ($tableposts.post_status = 'publish') GROUP BY $tableposts.ID ORDER BY $orderby DESC LIMIT 0, 1"; $posts = array(); $posts = $wpdb->get_results($sql); return $posts[0]; } function updated_banner() { global $wpdb, $conf_update_now_display_time, $conf_update_now_use_anchor, $conf_update_now_design; $post = get_latest_posted_date(); $date = $post->post_date; $year = substr($date, 0, 4); $month = substr($date, 5, 2) - 1; $day = substr($date, 8, 2); $hour = substr($date, 11, 2); $min = substr($date, 14, 2); $sec = substr($date, 17, 2); $url = get_permalink($post->ID); ?> <script type="text/javascript"> //<![CDATA[ var pass = "<?php echo get_option('conf_update_now_display_time'); ?>"; var currentDate = new Date(); var postDate = new Date(<?php echo("$year,$month,$day,$hour,$min,$sec") ?>); var now = (postDate.getTime() - currentDate.getTime())/(60*60*1000); now = Math.ceil(now); if(pass > -now){ var updated = document.createElement('div'); updated.setAttribute('id', 'updated'); var img = document.createElement('img'); img.setAttribute('src', '<?php echo get_option('siteurl') ?>/wp-content/plugins/updatednow/<?php echo get_option('conf_update_now_design'); ?>'); img.setAttribute('alt', 'updated now'); img.setAttribute('title', 'updated now'); <?php if (get_option('conf_update_now_use_anchor') == 'true') { ?> var anchor = document.createElement('a'); anchor.setAttribute('href', '<?php echo $url; ?>'); anchor.appendChild(img); updated.appendChild(anchor); <?php } else { ?> updated.appendChild(img); <?php } ?> document.getElementsByTagName('body').item(0).appendChild(updated); } //]]> </script> <?php } function ck_wp_footer () { updated_banner(); } ?>