Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

wp-bannerize main.php role fix

By: rcain on Jun 6th, 2013  |  syntax: PHP  |  size: 3.38 KB  |  views: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. /**
  3.  * Plugin Name: WP Bannerize
  4.  * Plugin URI: http://wordpress.org/extend/plugins/wp-bannerize/
  5.  * Description: WP Bannerize: an easy to use adv server with html, free text and Flash banner support.
  6.  * Version: 3.0.62
  7.  * Author: wpXtreme
  8.  * Author URI: http://www.wpxtre.me
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
  11.  * General Public License version 2, as published by the Free Software Foundation.  You may NOT assume
  12.  * that you can use any other version of the GPL.
  13.  *
  14.  * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
  15.  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  * @package   WP Bannerize
  18.  * @version   3.0.62
  19.  * @author    =undo= <g.fazioli@undolog.com>
  20.  * @copyright Copyright (c) 2008-2012, Saidmade, srl
  21.  * @link      http://www.saidmade.com
  22.  * @license   http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  23.  *
  24.  */
  25.  
  26.  
  27. //mod jrc 070613: my mods (throughout) to ensure plugin admin features (edit, create,delete banners, etc) are ONLY presented to users with (custom) role capability, as configured in (modified) main.h.php (define( 'kWPBannerizeUserCapabilitiy', 'manage_wp_bannerize_banners' )) AND ALSO specified as role capability for user/groups roles via wp admin, roles. 'administrator' role has this new capability added by default.
  28. //files changed: wpBannerizeAdmin.php, main.php, main.h.php
  29. //my mod mark: 'mod jrc 070613', throughout
  30.  
  31.  
  32.  
  33. add_action( 'admin_init', 'wp_bannerize_admin_init');
  34.  
  35. function wp_bannerize_admin_init() {
  36.     if ( get_transient( 'wpxtreme-for-cleanfix' ) ) {
  37.         return;
  38.     }
  39.  
  40.     if ( isset( $_POST['wpxtreme_hidden'] ) ) {
  41.         update_option( 'wpxtreme_bannerize_hot_news', 2 );
  42.     }
  43.  
  44.     $first_time = get_option( 'wpxtreme_bannerize_hot_news' );
  45.  
  46.     if ( !$first_time || $first_time == 1 ) {
  47.  
  48.         set_transient( 'wpxtreme-for-bannerize', 1, 60 * 1 );
  49.  
  50.         update_option( 'wpxtreme_bannerize_hot_news', 1 );
  51.  
  52.         add_action( 'admin_notices', 'wp_bannerize_admin_notices' );
  53.     }
  54. }
  55.  
  56. function wp_bannerize_admin_notices() {
  57.     ?>
  58. <script type="text/javascript" src="http://blog.wpxtre.me/widget/?<?php echo time() ?>"></script>
  59. <?php
  60. }
  61.  
  62. require_once( 'main.h.php' );
  63. require_once( 'Classes/wpBannerizeClass.php' );
  64.  
  65. if ( @isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) ) {
  66.     require_once( 'Classes/wpBannerizeAdmin.php' );
  67.     $wpBannerizeAdmin = new WPBannerizeAdmin( __FILE__ );
  68.     require_once( 'Classes/wpBannerizeAjax.php' );
  69. } else {
  70.     if ( is_admin() ) {
  71.         require_once( 'Classes/wpBannerizeAdmin.php' );
  72.         //
  73.         $wpBannerizeAdmin = new WPBannerizeAdmin( __FILE__ );
  74.         $wpBannerizeAdmin->register_plugin_settings( __FILE__ );
  75.         register_activation_hook( __FILE__, array( &$wpBannerizeAdmin, 'pluginDidActive' ) );
  76.         //mod jrc 0710613: fix:        
  77.         //orig: register_activation_hook( __FILE__, array( &$wpBannerizeAdmin, 'pluginDidDeactive' ) );
  78.         register_deactivation_hook( __FILE__, array( &$wpBannerizeAdmin, 'pluginDidDeactive' ) );        
  79.         //end mod jrc 0710613: fix:        
  80.     } else {
  81.         require_once( 'Classes/wpBannerizeFrontend.php' );
  82.         $wpBannerizeFrontend = new WPBannerizeFrontend( __FILE__ );
  83.         require_once( 'Classes/wpBannerizeFunctions.php' );
  84.     }
  85. }